From 55177e392c4c596c1968b8e90d2e464901e1442c Mon Sep 17 00:00:00 2001 From: Biglad Date: Mon, 9 Feb 2009 08:06:16 -0500 Subject: humanoids combat assist --HG-- branch : trunk --- src/game/CreatureAI.cpp | 14 ++++++++++++++ 1 file changed, 14 insertions(+) (limited to 'src') diff --git a/src/game/CreatureAI.cpp b/src/game/CreatureAI.cpp index 8682bf064a5..885d9ddcadb 100644 --- a/src/game/CreatureAI.cpp +++ b/src/game/CreatureAI.cpp @@ -40,6 +40,20 @@ void CreatureAI::MoveInLineOfSight(Unit *who) { if(!me->getVictim() && me->canStartAttack(who)) AttackStart(who); + + if (who->isInCombat() && who->getVictim() && me->GetCreatureType()==CREATURE_TYPE_HUMANOID && me->IsFriendlyTo(who)) + { + if (me->GetDistanceZ(who) <= 2 && me->IsWithinLOSInMap(who)) + { + float attackRadius = (me->GetAttackDistance(who) *0.5); + if (me->IsWithinDistInMap(who, attackRadius)) + { + Unit* target = NULL; + target = who->getVictim(); + AttackStart(target); + } + } + } } bool CreatureAI::UpdateVictim() -- cgit v1.2.3 From b0694d7e5e794b361fa178d55fefdb98cf47e9ca Mon Sep 17 00:00:00 2001 From: Biglad Date: Mon, 9 Feb 2009 08:06:43 -0500 Subject: Fix exploit, dont allow possessed NPCs to gossip to player --HG-- branch : trunk --- src/game/Creature.cpp | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'src') diff --git a/src/game/Creature.cpp b/src/game/Creature.cpp index e8d48b55f38..efad9c5e484 100644 --- a/src/game/Creature.cpp +++ b/src/game/Creature.cpp @@ -795,6 +795,11 @@ bool Creature::isCanTrainingAndResetTalentsOf(Player* pPlayer) const void Creature::prepareGossipMenu( Player *pPlayer,uint32 gossipid ) { + //Prevent gossip from NPCs that are possessed. + Unit* Charmed = Unit::GetCharmer(); + if (Charmed) + return; + PlayerMenu* pm=pPlayer->PlayerTalkClass; pm->ClearMenus(); -- cgit v1.2.3