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

◆ SpawnSkeletron()

static void Terraria.NPC.SpawnSkeletron ( int onWho)
inlinestatic

Definition at line 77174 of file NPC.cs.

77175 {
77176 bool flag = true;
77177 bool flag2 = false;
77179 int num = 0;
77180 int num2 = 0;
77181 for (int i = 0; i < 200; i++)
77182 {
77183 if (Main.npc[i].active && Main.npc[i].type == 35)
77184 {
77185 flag = false;
77186 break;
77187 }
77188 }
77189 for (int j = 0; j < 200; j++)
77190 {
77191 if (!Main.npc[j].active)
77192 {
77193 continue;
77194 }
77195 if (Main.npc[j].type == 37)
77196 {
77197 flag2 = true;
77198 Main.npc[j].ai[3] = 1f;
77199 zero = Main.npc[j].position;
77200 num = Main.npc[j].width;
77201 num2 = Main.npc[j].height;
77202 if (Main.netMode == 2)
77203 {
77204 NetMessage.SendData(23, -1, -1, null, j);
77205 }
77206 }
77207 else if (Main.npc[j].type == 54)
77208 {
77209 flag2 = true;
77210 zero = Main.npc[j].position;
77211 num = Main.npc[j].width;
77212 num2 = Main.npc[j].height;
77213 }
77214 }
77215 if (flag && flag2)
77216 {
77217 int num3 = NewNPC(GetBossSpawnSource(onWho), (int)zero.X + num / 2, (int)zero.Y + num2 / 2, 35);
77218 Main.npc[num3].netUpdate = true;
77219 string nPCNameValue = Lang.GetNPCNameValue(35);
77220 if (Main.netMode == 0)
77221 {
77222 Main.NewText(Language.GetTextValue("Announcement.HasAwoken", nPCNameValue), 175, 75);
77223 }
77224 else if (Main.netMode == 2)
77225 {
77226 ChatHelper.BroadcastChatMessage(NetworkText.FromKey("Announcement.HasAwoken", Lang.GetNPCName(35).ToNetworkText()), new Color(175, 75, 255));
77227 }
77228 }
77229 }
static void BroadcastChatMessage(NetworkText text, Color color, int excludedPlayer=-1)
Definition ChatHelper.cs:46
static string GetTextValue(string key)
Definition Language.cs:15
static NetworkText FromKey(string key, params object[] substitutions)
static int NewNPC(IEntitySource source, int X, int Y, int Type, int Start=0, float ai0=0f, float ai1=0f, float ai2=0f, float ai3=0f, int Target=255)
Definition NPC.cs:77654
static IEntitySource GetBossSpawnSource(int targetPlayerIndex)
Definition NPC.cs:77579

References Terraria.Chat.ChatHelper.BroadcastChatMessage(), Terraria.Localization.NetworkText.FromKey(), Terraria.Lang.GetNPCName(), Terraria.Lang.GetNPCNameValue(), Terraria.Localization.Language.GetTextValue(), Terraria.Main.netMode, Terraria.Main.NewText(), Terraria.Main.npc, Terraria.NetMessage.SendData(), and Microsoft.Xna.Framework.Vector2.Zero.

Referenced by Terraria.NPC.checkDead(), Terraria.MessageBuffer.GetData(), and Terraria.Main.GUIChatDrawInner().