Skip to content

Commit e561de8

Browse files
committed
normalizing ranges for es emitter
1 parent 89b204a commit e561de8

File tree

1 file changed

+68
-33
lines changed

1 file changed

+68
-33
lines changed

EmoteScriptLib/Entity/Emote.cs

Lines changed: 68 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -644,20 +644,30 @@ public string GetFluentString()
644644

645645
case EmoteType.AwardLevelProportionalXP:
646646
var suffix = "";
647-
if ((Max64 ?? 0) != 0)
648-
suffix += $", {Max64:N0}";
649-
if ((Min64 ?? 0) != 0 && Min64 != Max64)
650-
suffix = $", {Min64:N0} - {Max64:N0}";
647+
var min64 = Min64 ?? long.MinValue;
648+
var max64 = Max64 ?? long.MaxValue;
649+
if (min64 != long.MinValue || max64 != long.MaxValue)
650+
{
651+
if (min64 != long.MinValue)
652+
suffix = $", {min64:N0} - {max64:N0}";
653+
else
654+
suffix = $", {max64:N0}";
655+
}
651656
if (Display ?? false)
652657
suffix += $", Share";
653658
return $"{Math.Round((Percent ?? 0) * 100, 2)}%{suffix}";
654659

655660
case EmoteType.AwardLevelProportionalSkillXP:
656661
suffix = "";
657-
if ((Max ?? 0) != 0)
658-
suffix += $", {Max:N0}";
659-
if ((Min ?? 0) != 0 && Min != Max)
660-
suffix = $", {Min:N0} - {Max:N0}";
662+
var min = Min ?? int.MinValue;
663+
var max = Max ?? int.MaxValue;
664+
if (min != int.MinValue || max != int.MaxValue)
665+
{
666+
if (min != int.MinValue)
667+
suffix = $", {min:N0} - {max:N0}";
668+
else
669+
suffix = $", {max:N0}";
670+
}
661671
return $"{((Skill)Stat).ToSentence()}, {Math.Round((Percent ?? 0) * 100, 2)}%{suffix}";
662672

663673
case EmoteType.AwardLuminance:
@@ -698,9 +708,12 @@ public string GetFluentString()
698708
case EmoteType.InqAttributeStat:
699709
case EmoteType.InqRawAttributeStat:
700710

701-
amount = $"{Min:N0}";
702-
if (Max != Min)
703-
amount += $" - {Max:N0}";
711+
min = Min ?? int.MinValue;
712+
max = Max ?? int.MaxValue;
713+
if (max != int.MaxValue)
714+
amount = $"{min:N0} - {max:N0}";
715+
else
716+
amount = $"{min:N0}";
704717

705718
return $"{(PropertyAttribute)Stat}, {amount}{message}";
706719

@@ -710,52 +723,74 @@ public string GetFluentString()
710723

711724
case EmoteType.InqFloatStat:
712725

713-
amount = $"{MinFloat}";
714-
if (MaxFloat != MinFloat)
715-
amount += $" - {MaxFloat}";
726+
var fMin = MinFloat ?? float.MinValue;
727+
var fMax = MaxFloat ?? float.MaxValue;
728+
if (fMax != float.MaxValue)
729+
amount = $"{fMin} - {fMax}";
730+
else
731+
amount = $"{fMin}";
716732

717733
return $"{(PropertyFloat)Stat}, {amount}{message}";
718734

719735
case EmoteType.InqIntStat:
720736

721-
amount = $"{Min:N0}";
722-
if (Max != Min)
723-
amount += $" - {Max:N0}";
737+
min = Min ?? int.MinValue;
738+
max = Max ?? int.MaxValue;
739+
if (max != int.MaxValue)
740+
amount = $"{min:N0} - {max:N0}";
741+
else
742+
amount = $"{min:N0}";
724743

725744
return $"{(PropertyInt)Stat}, {amount}{message}";
726745

727746
case EmoteType.InqInt64Stat:
728747

729-
amount = $"{Min64:N0}";
730-
if (Max64 != Min64)
731-
amount += $" - {Max64:N0}{message}";
748+
min64 = Min64 ?? long.MinValue;
749+
max64 = Max64 ?? long.MaxValue;
750+
if (max64 != long.MaxValue)
751+
amount = $"{min64:N0} - {max64:N0}";
752+
else
753+
amount = $"{min64:N0}";
732754

733-
return $"{(PropertyInt64)Stat}, {amount}";
755+
return $"{(PropertyInt64)Stat}, {amount}{message}";
734756

735757
case EmoteType.InqMyQuestSolves:
736758
case EmoteType.InqQuestSolves:
737-
var numSolves = Min != null ? $", {Min}" : "";
738-
if (Max != null && Min != Max)
739-
numSolves += $" - {Max}";
740-
return $"{Message}{numSolves}";
759+
760+
min = Min ?? int.MinValue;
761+
max = Max ?? int.MaxValue;
762+
763+
var numSolves = "";
764+
if (max != int.MaxValue)
765+
numSolves = $"{min:N0} - {max:N0}";
766+
else
767+
numSolves = $"{min:N0}";
768+
769+
return $"{Message}, {numSolves}";
741770

742771
case EmoteType.InqSecondaryAttributeStat:
743772
case EmoteType.InqRawSecondaryAttributeStat:
744773

745-
amount = $"{Min:N0}";
746-
if (Max != Min)
747-
amount += $" - {Max:N0}{message}";
774+
min = Min ?? int.MinValue;
775+
max = Max ?? int.MaxValue;
776+
if (max != int.MaxValue)
777+
amount = $"{min:N0} - {max:N0}";
778+
else
779+
amount = $"{min:N0}";
748780

749-
return $"{(PropertyAttribute2nd)Stat}, {amount}";
781+
return $"{(PropertyAttribute2nd)Stat}, {amount}{message}";
750782

751783
case EmoteType.InqSkillStat:
752784
case EmoteType.InqRawSkillStat:
753785

754-
amount = $"{Min:N0}";
755-
if (Max != Min)
756-
amount += $" - {Max:N0}{message}";
786+
min = Min ?? int.MinValue;
787+
max = Max ?? int.MaxValue;
788+
if (max != int.MaxValue)
789+
amount = $"{min:N0} - {max:N0}";
790+
else
791+
amount = $"{min:N0}";
757792

758-
return $"{((Skill)Stat).ToSentence()}, {amount}";
793+
return $"{((Skill)Stat).ToSentence()}, {amount}{message}";
759794

760795
case EmoteType.InqStringStat:
761796
return $"{(PropertyString)Stat}, \"{TestString}\"{message}";

0 commit comments

Comments
 (0)