aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorw12x <none@none>2008-10-20 13:41:05 -0500
committerw12x <none@none>2008-10-20 13:41:05 -0500
commit4f06be912b601fd05053a42f869e52ab09fa0f0e (patch)
tree4630fa5c581e3b551687a5f917f1aeeef2eadddc /src
parent192dada7bd697f0bc4bfb3d3429f65a123d92285 (diff)
[svn] Implement CREATURE_FLAG_EXTRA_TRIGGER. In GM mode, creatures flagged with this will be displayed with displayid_a, in non-gm mode with displayid_h.
--HG-- branch : trunk
Diffstat (limited to 'src')
-rw-r--r--src/game/Creature.h1
-rw-r--r--src/game/CreatureAISelector.cpp2
-rw-r--r--src/game/Object.cpp14
-rw-r--r--src/game/Unit.cpp3
4 files changed, 20 insertions, 0 deletions
diff --git a/src/game/Creature.h b/src/game/Creature.h
index 550d9b9fff3..0581525db28 100644
--- a/src/game/Creature.h
+++ b/src/game/Creature.h
@@ -124,6 +124,7 @@ enum CreatureFlagsExtra
CREATURE_FLAG_EXTRA_NO_BLOCK = 0x00000010, // creature can't block
CREATURE_FLAG_EXTRA_NO_CRUSH = 0x00000020, // creature can't do crush attacks
CREATURE_FLAG_EXTRA_NO_XP_AT_KILL = 0x00000040, // creature kill not provide XP
+ CREATURE_FLAG_EXTRA_TRIGGER = 0x00000080, // trigger creature
CREATURE_FLAG_EXTRA_WORLDEVENT = 0x00004000, // custom flag for world event creatures (left room for merging)
};
diff --git a/src/game/CreatureAISelector.cpp b/src/game/CreatureAISelector.cpp
index ab902b2f2fe..60e28394532 100644
--- a/src/game/CreatureAISelector.cpp
+++ b/src/game/CreatureAISelector.cpp
@@ -60,6 +60,8 @@ namespace FactorySelector
ai_factory = ai_registry.GetRegistryItem("PetAI");
else if(creature->isTotem())
ai_factory = ai_registry.GetRegistryItem("TotemAI");
+ else if(creature->GetCreatureInfo()->flags_extra & CREATURE_FLAG_EXTRA_TRIGGER)
+ ai_factory = ai_registry.GetRegistryItem("NullCreatureAI");
}
// select by permit check
diff --git a/src/game/Object.cpp b/src/game/Object.cpp
index a64ef9fa744..500143bad4f 100644
--- a/src/game/Object.cpp
+++ b/src/game/Object.cpp
@@ -594,6 +594,20 @@ void Object::_BuildValuesUpdate(uint8 updatetype, ByteBuffer * data, UpdateMask
{
*data << (m_uint32Values[ index ] & ~UNIT_FLAG_NOT_SELECTABLE);
}
+ // use modelid_a if not gm, _h if gm for CREATURE_FLAG_EXTRA_TRIGGER creatures
+ else if(index == UNIT_FIELD_DISPLAYID && GetTypeId() == TYPEID_UNIT)
+ {
+ const CreatureInfo* cinfo = ((Creature*)this)->GetCreatureInfo();
+ if(cinfo->flags_extra & CREATURE_FLAG_EXTRA_TRIGGER)
+ {
+ if(target->isGameMaster())
+ *data << cinfo->DisplayID_A;
+ else
+ *data << cinfo->DisplayID_H;
+ }
+ else
+ *data << m_uint32Values[ index ];
+ }
// hide lootable animation for unallowed players
else if(index == UNIT_DYNAMIC_FLAGS && GetTypeId() == TYPEID_UNIT)
{
diff --git a/src/game/Unit.cpp b/src/game/Unit.cpp
index 24acc4c18f8..d6347ff5491 100644
--- a/src/game/Unit.cpp
+++ b/src/game/Unit.cpp
@@ -8457,6 +8457,9 @@ bool Unit::isTargetableForAttack() const
if(HasFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE | UNIT_FLAG_NOT_SELECTABLE))
return false;
+ if(GetTypeId()==TYPEID_UNIT && (((Creature *)this)->GetCreatureInfo()->flags_extra & CREATURE_FLAG_EXTRA_TRIGGER))
+ return false;
+
return isAlive() && !hasUnitState(UNIT_STAT_DIED)&& !isInFlight() /*&& !isStealth()*/;
}