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

◆ ItemCheck_UseEventItems()

void Terraria.Player.ItemCheck_UseEventItems ( Item sItem)
inlineprivate

Definition at line 43077 of file Player.cs.

43078 {
43079 if (ItemTimeIsZero && itemAnimation > 0 && sItem.type == 361 && Main.CanStartInvasion(1, ignoreDelay: true))
43080 {
43082 SoundEngine.PlaySound(15, (int)position.X, (int)position.Y, 0);
43083 if (Main.netMode != 1)
43084 {
43085 if (Main.invasionType == 0)
43086 {
43087 Main.invasionDelay = 0;
43088 Main.StartInvasion();
43089 }
43090 }
43091 else
43092 {
43093 NetMessage.SendData(61, -1, -1, null, whoAmI, -1f);
43094 }
43095 }
43096 if (ItemTimeIsZero && itemAnimation > 0 && sItem.type == 602 && Main.CanStartInvasion(2, ignoreDelay: true))
43097 {
43099 SoundEngine.PlaySound(15, (int)position.X, (int)position.Y, 0);
43100 if (Main.netMode != 1)
43101 {
43102 if (Main.invasionType == 0)
43103 {
43104 Main.invasionDelay = 0;
43105 Main.StartInvasion(2);
43106 }
43107 }
43108 else
43109 {
43110 NetMessage.SendData(61, -1, -1, null, whoAmI, -2f);
43111 }
43112 }
43113 if (ItemTimeIsZero && itemAnimation > 0 && sItem.type == 1315 && Main.CanStartInvasion(3, ignoreDelay: true))
43114 {
43116 SoundEngine.PlaySound(15, (int)position.X, (int)position.Y, 0);
43117 if (Main.netMode != 1)
43118 {
43119 if (Main.invasionType == 0)
43120 {
43121 Main.invasionDelay = 0;
43122 Main.StartInvasion(3);
43123 }
43124 }
43125 else
43126 {
43127 NetMessage.SendData(61, -1, -1, null, whoAmI, -3f);
43128 }
43129 }
43130 if (ItemTimeIsZero && itemAnimation > 0 && sItem.type == 1844 && !Main.dayTime && !Main.pumpkinMoon && !Main.snowMoon && !DD2Event.Ongoing)
43131 {
43133 SoundEngine.PlaySound(15, (int)position.X, (int)position.Y, 0);
43134 if (Main.netMode != 1)
43135 {
43136 Main.NewText(Lang.misc[31].Value, 50, byte.MaxValue, 130);
43137 Main.startPumpkinMoon();
43138 }
43139 else
43140 {
43141 NetMessage.SendData(61, -1, -1, null, whoAmI, -4f);
43142 }
43143 }
43144 if (ItemTimeIsZero && itemAnimation > 0 && sItem.type == 2767 && Main.dayTime && !Main.eclipse)
43145 {
43146 SoundEngine.PlaySound(15, (int)position.X, (int)position.Y, 0);
43148 if (Main.netMode == 0)
43149 {
43150 Main.eclipse = true;
43151 if (Main.remixWorld)
43152 {
43153 Main.NewText(Lang.misc[106].Value, 50, byte.MaxValue, 130);
43154 }
43155 else
43156 {
43157 Main.NewText(Lang.misc[20].Value, 50, byte.MaxValue, 130);
43158 }
43159 }
43160 else
43161 {
43162 NetMessage.SendData(61, -1, -1, null, whoAmI, -6f);
43163 }
43164 }
43165 if (ItemTimeIsZero && itemAnimation > 0 && sItem.type == 4271 && !Main.dayTime && !Main.bloodMoon)
43166 {
43167 SoundEngine.PlaySound(15, (int)position.X, (int)position.Y, 0);
43169 if (Main.netMode == 0)
43170 {
43172 Main.bloodMoon = true;
43173 if (Main.GetMoonPhase() == MoonPhase.Empty)
43174 {
43175 Main.moonPhase = 5;
43176 }
43177 Main.NewText(Lang.misc[8].Value, 50, byte.MaxValue, 130);
43178 }
43179 else
43180 {
43181 NetMessage.SendData(61, -1, -1, null, whoAmI, -10f);
43182 }
43183 }
43184 if (ItemTimeIsZero && itemAnimation > 0 && sItem.type == 3601 && NPC.downedGolemBoss && Main.hardMode && !NPC.AnyDanger() && !NPC.AnyoneNearCultists())
43185 {
43186 SoundEngine.PlaySound(15, (int)position.X, (int)position.Y, 0);
43188 if (Main.netMode == 0)
43189 {
43190 WorldGen.StartImpendingDoom(720);
43191 }
43192 else
43193 {
43194 NetMessage.SendData(61, -1, -1, null, whoAmI, -8f);
43195 }
43196 }
43197 if (ItemTimeIsZero && itemAnimation > 0 && sItem.type == 1958 && !Main.dayTime && !Main.pumpkinMoon && !Main.snowMoon && !DD2Event.Ongoing)
43198 {
43200 SoundEngine.PlaySound(15, (int)position.X, (int)position.Y, 0);
43201 if (Main.netMode != 1)
43202 {
43203 Main.NewText(Lang.misc[34].Value, 50, byte.MaxValue, 130);
43204 Main.startSnowMoon();
43205 }
43206 else
43207 {
43208 NetMessage.SendData(61, -1, -1, null, whoAmI, -5f);
43209 }
43210 }
43211 }
static SlotId PlaySound(in SoundStyle? style, Vector2? position=null, SoundUpdateCallback? updateCallback=null)
Attempts to play a sound style with the provided sound style (if it's not null), and returns a valid ...
int whoAmI
The index of this Entity within its specific array. These arrays track the entities in the world....
Definition Entity.cs:16
Vector2 position
The position of this Entity in world coordinates.
Definition Entity.cs:28
bool ItemTimeIsZero
Definition Player.cs:4402
void ApplyItemTime(Item sItem, float multiplier=1f, bool? callUseItem=null)
Definition Player.cs:4907

References Terraria.NPC.AnyDanger(), Terraria.NPC.AnyoneNearCultists(), Terraria.Player.ApplyItemTime(), Terraria.Main.bloodMoon, Terraria.Main.CanStartInvasion(), Terraria.Main.dayTime, Terraria.NPC.downedGolemBoss, Terraria.Main.eclipse, Terraria.Main.GetMoonPhase(), Terraria.Main.hardMode, Terraria.Main.invasionType, Terraria.Player.itemAnimation, Terraria.Player.ItemTimeIsZero, Terraria.Lang.misc, Terraria.Main.netMode, Terraria.Main.NewText(), Terraria.GameContent.Achievements.AchievementsHelper.NotifyProgressionEvent(), Terraria.GameContent.Events.DD2Event.Ongoing, Terraria.Audio.SoundEngine.PlaySound(), Terraria.Entity.position, Terraria.Main.pumpkinMoon, Terraria.Main.remixWorld, Terraria.NetMessage.SendData(), Terraria.Main.snowMoon, Terraria.WorldGen.StartImpendingDoom(), Terraria.Main.StartInvasion(), Terraria.Main.startPumpkinMoon(), Terraria.Main.startSnowMoon(), and Terraria.Entity.whoAmI.

Referenced by Terraria.Player.ItemCheck_OwnerOnlyCode().

+ Here is the call graph for this function:
+ Here is the caller graph for this function: