private void OnNpcSpwan(NpcSpawnEventArgs args) { var npc = Main.npc[args.NpcId]; ///TShock.Utils.Broadcast(Lang.GetNPCName(npc.netID) + "已苏醒,ID:" + args.NpcId, Color.Red); if (!Config.GetConfig().Open) { return; } int life = Config.GetConfig().Num; if (!npc.boss) { return; } foreach (var i in Config.GetConfig().SpecialIDs) { if (i == npc.netID) { AddHP.Add(i); return; } } npc.lifeMax *= life; npc.life *= life; npc.UpdateNPCDirect(args.NpcId); npc.StrikeNPC(1, 0, 0); }
private static void OnSpawn(NpcSpawnEventArgs args) { if (args.Handled) { return; } if (Config.disableCultists) { args.Handled = true; Main.npc[NPCID.CultistArcherBlue].active = false; Main.npc[NPCID.CultistDevote].active = false; Main.npc[NPCID.CultistBoss].active = false; args.NpcId = Main.maxNPCs; } if (Config.disableLunarInvasion) { args.Handled = true; Main.npc[NPCID.LunarTowerVortex].active = false; Main.npc[NPCID.LunarTowerStardust].active = false; Main.npc[NPCID.LunarTowerNebula].active = false; Main.npc[NPCID.LunarTowerSolar].active = false; args.NpcId = Main.maxNPCs; } }
private void OnNPCSpwan(NpcSpawnEventArgs args) { var npc = Main.npc[args.NpcId]; npc.lifeMax += npc.lifeMax * Data.Config.GetConfig().NPC.Level; Main.npcLifeBytes[args.NpcId] = 4; npc.UpdateNPCDirect(args.NpcId); }
private void OnNPCSpawn(NpcSpawnEventArgs args) { NPC npc = Main.npc[args.NpcId]; if (BossIDs.Contains(npc.netID)) { Core.RaiseTerrariaMessageReceived(this, TCRPlayer.Server, $"{npc.FullName} has awoken!"); } }
private void OnSpawn(NpcSpawnEventArgs args) { if (args.Handled) { return; } if (blockedNPC.Contains(args.Npc.netID)) { args.Handled = true; return; } }
private void OnSpawn(NpcSpawnEventArgs args) { if (args.Handled) { return; } if (blockedNPC.Contains(Main.npc[args.NpcId].netID)) { args.Handled = true; Main.npc[args.NpcId].active = false; args.NpcId = 200; } }
private void OnNpcSpawn(NpcSpawnEventArgs args) { if (args.Handled) { return; } //Debug.Print($"OnNpcSpawn!! NpcId: {args.NpcId}"); var npcId = args.NpcId; // Set npc.whoAmI. This is normally set only when the NPC is first updated; in this case, this needs to be // done now as we make several assumptions regarding it. Main.npc[npcId].whoAmI = npcId; _checkNpcForReplacement[npcId] = true; }
private void OnNpcSpawn(NpcSpawnEventArgs args) { var npc = Main.npc[args.NpcId]; var life = npc.life; //...should we use npc.lifeMax? //this wont work here.. NpcManager hasn't added the npc to the custom npcs conditional weak table at the point //this is raised. So we reverse things... CustomNpcs plugin can now access NpcSpawnHP, and set it manually within. //var customNpc = NpcManager.Instance?.GetCustomNpc(npc); //if( customNpc != null ) // life = customNpc.MaxHp; //TODO throws exceptions when generating a new world, why? try { //Debug.Print("** Regular set life."); NpcSpawnHP[args.NpcId] = life; } catch (Exception ex) { Debug.Print(ex.ToString()); } }
private void OnNPCSpawn(NpcSpawnEventArgs args) { //DEBUG TShock.Log.ConsoleInfo("DEBUG [NPCSpawn] NPCIndex {0}", args.NpcId); //DEBUG //If the id falls outside the possible range, we can return. if (args.NpcId < 0 || args.NpcId >= 200) { return; } //This NPC is custom and not dead. if (NPCManager.NPCs[args.NpcId] != null && !NPCManager.NPCs[args.NpcId].isDead) { return; } NPC spawned = Main.npc[args.NpcId]; foreach (CustomNPCDefinition customnpc in NPCManager.Data.CustomNPCs.Values) { if (!customnpc.isReplacement || customnpc.ReplacementChance >= 100 || NPCManager.Chance(customnpc.ReplacementChance) || spawned.netID != customnpc.customBase.netID) { continue; } DateTime[] dt = null; if (customnpc.customProjectiles != null) { dt = Enumerable.Repeat(DateTime.Now, customnpc.customProjectiles.Count).ToArray(); } NPCManager.NPCs[spawned.whoAmI] = new CustomNPCVars(customnpc, dt, spawned); NPCManager.Data.ConvertNPCToCustom(spawned.whoAmI, customnpc); break; } }
public static void NpcSpawn(NpcSpawnEventArgs args) { var npc = Main.npc[args.NpcId]; Bank.OnSpawn(npc); }