public override void OnHitAnything(float x, float y, Entity victim) { if (victim is NPC && !(victim as NPC).townNPC) { InfoCombat.Combat(victim as NPC); } }
public override void Update(GameTime gameTime) { base.Update(gameTime); switch (ViewMode) { case ViewMode.CombatNPC: InfoCombat.Update(); updateNeeded = InfoCombat.isUpdate; break; case ViewMode.SpawnNPC: var bFilterTown = btnSpawnNPCFilter.GetValue <SpawnNPCFilter>() == SpawnNPCFilter.HideTownNPC; var npcList = Main.npc.Where(x => x.active && x.netID != 0 && (bFilterTown ? !x.townNPC : true) && x.whoAmI < 200).GroupBy(x => x.netID); if (dicSpawnNPC.Count != npcList.Count() || dicSpawnNPC.Sum(x => x.Value) != npcList.Sum(x => x.Count())) { dicSpawnNPC.Clear(); foreach (var npc in npcList) { dicSpawnNPC.Add(npc.ToArray()[0].netID, npc.Count()); } updateNeeded = true; } break; case ViewMode.DropItem: var itemList = Main.item.Where(x => x.active && x.netID != 0).GroupBy(x => x.netID); if (dicDropItem.Count != itemList.Count() || dicDropItem.Sum(x => x.Value) != itemList.Sum(x => x.Sum(y => y.stack))) { dicDropItem.Clear(); foreach (var item in itemList) { dicDropItem.Add(item.ToArray()[0].netID, item.Sum(x => x.stack)); } updateNeeded = true; } break; } if (ViewMode == ViewMode.CombatNPC) { } UpdateGrid(); }
public override void OnHitByNPC(NPC npc, int damage, bool crit) { InfoCombat.Combat(npc); }