aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authormegamage <none@none>2009-02-12 16:48:42 -0600
committermegamage <none@none>2009-02-12 16:48:42 -0600
commit2d2f433b4de1c35b22aaf07854fc0ee11fcb350d (patch)
tree0c96ad0fc6b02dbef9d48e05f9a54995bebcc51a
parent58545982e47d571a6c854c780af8b450747f226a (diff)
parentb0694d7e5e794b361fa178d55fefdb98cf47e9ca (diff)
*Merge.
--HG-- branch : trunk
-rw-r--r--src/game/Creature.cpp5
-rw-r--r--src/game/CreatureAI.cpp14
2 files changed, 19 insertions, 0 deletions
diff --git a/src/game/Creature.cpp b/src/game/Creature.cpp
index b87540e1802..127c679463d 100644
--- a/src/game/Creature.cpp
+++ b/src/game/Creature.cpp
@@ -796,6 +796,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();
diff --git a/src/game/CreatureAI.cpp b/src/game/CreatureAI.cpp
index df22dbbf082..7343bb8333a 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()