TModLoader v1.4.4.9
TModLoader source code documentation
Loading...
Searching...
No Matches

◆ GetPartyHatColor()

PartyHatColor Terraria.NPC.GetPartyHatColor ( )
inline

Definition at line 72113 of file NPC.cs.

72114 {
72115 if (!UsesPartyHat() || string.IsNullOrEmpty(GivenOrTypeName))
72116 {
72117 return PartyHatColor.None;
72118 }
72119 int num = GivenOrTypeName.Length + GivenOrTypeName[0];
72120 int num2 = Main.moonPhase;
72121 if (Main.dayTime)
72122 {
72123 num2--;
72124 }
72125 num += whoAmI;
72126 num += num2 * (whoAmI % 2 == 0).ToDirectionInt();
72127 if (num < 0)
72128 {
72129 num += 5;
72130 }
72131 num %= 5;
72132 if (num == 0)
72133 {
72134 num++;
72135 }
72136 return (PartyHatColor)num;
72137 }
int whoAmI
The index of this Entity within its specific array. These arrays track the entities in the world....
Definition Entity.cs:16
string GivenOrTypeName
If this NPC has a given name, returns their given name; otherwise, returns their type name.
Definition NPC.cs:1451
bool UsesPartyHat()
Definition NPC.cs:72084

References Terraria.Main.dayTime, Terraria.NPC.GivenOrTypeName, Terraria.Main.moonPhase, Terraria.NPC.UsesPartyHat(), and Terraria.Entity.whoAmI.

+ Here is the call graph for this function: