//Returns a list of all friendly units missing a specific buff within range public List <Creature> DoFindFriendlyMissingBuff(float range, uint spellId) { List <Creature> list = new(); var u_check = new FriendlyMissingBuffInRange(me, range, spellId); var searcher = new CreatureListSearcher(me, list, u_check); Cell.VisitAllObjects(me, searcher, range); return(list); }
//Returns a list of friendly CC'd units within range public List <Creature> DoFindFriendlyCC(float range) { List <Creature> list = new(); var u_check = new FriendlyCCedInRange(me, range); var searcher = new CreatureListSearcher(me, list, u_check); Cell.VisitAllObjects(me, searcher, range); return(list); }
void HandleLoot(LootUnit packet) { // Check possible cheat if (!GetPlayer().IsAlive() || !packet.Unit.IsCreatureOrVehicle()) { return; } List <Creature> corpses = new List <Creature>(); AELootCreatureCheck check = new AELootCreatureCheck(_player, packet.Unit); CreatureListSearcher searcher = new CreatureListSearcher(_player, corpses, check); Cell.VisitGridObjects(_player, searcher, AELootCreatureCheck.LootDistance); if (!corpses.Empty()) { SendPacket(new AELootTargets((uint)corpses.Count + 1)); } GetPlayer().SendLoot(packet.Unit, LootType.Corpse); if (!corpses.Empty()) { // main target SendPacket(new AELootTargetsAck()); foreach (Creature creature in corpses) { GetPlayer().SendLoot(creature.GetGUID(), LootType.Corpse, true); SendPacket(new AELootTargetsAck()); } } // interrupt cast if (GetPlayer().IsNonMeleeSpellCast(false)) { GetPlayer().InterruptNonMeleeSpells(false); } }