rendered paste bodyIndex: src/ascent-world/AIInterface.cpp
===================================================================
--- src/ascent-world/AIInterface.cpp (revision 4293)
+++ src/ascent-world/AIInterface.cpp (working copy)
@@ -1349,7 +1349,56 @@
{
return 0;
}
+ if (m_Unit->IsCreature() == true && static_cast< Creature*> (m_Unit)->proto->peacekeeper == 1)
+ {
+ //Creature is a peace keeper. Lets check for targets, agro if someone is in combat, and RETURN.
+ // -May not be the best way. Feel free to edit, fix, update, delete - optical
+ Player *pPlayer = NULL;
+ std::set<Player*>::iterator itr2, itr3;
+ for (itr2 = m_Unit->GetInRangePlayerSetBegin(); itr2 != m_Unit->GetInRangePlayerSetEnd();)
+ {
+ itr3 = itr2;
+ ++itr2;
+ pPlayer = (*itr3);
+ if (pPlayer->CombatStatus.IsInFullCombat() == true)
+ {
+ //Player is in combat, attack. TODO: Check if player has dealt any damage to target.
+ if (pPlayer->CalcDistance((Object*)m_Unit) < oocr) //only agro if they are 50 feet away or less.
+ {
+ if (pPlayer->CombatStatus.IsInCombat())
+ {
+#ifdef LOS_CHECKS
+#ifdef LOS_ONLY_IN_INSTANCE
+ if( !check_los )
+ {
+ WorldPacket data(SMSG_AI_REACTION, 12);
+ data << m_Unit->GetGUID() << uint32(2); // Aggro sound
+ static_cast< Player* >( pPlayer )->GetSession()->SendPacket( &data );
+ return (Unit*)pPlayer;
+ }
+#endif // LOS_ONLY_IN_INSTANCE
+
+ if( CollideInterface.CheckLOS( m_Unit->GetMapId( ), m_Unit->GetPositionNC( ), pPlayer->GetPositionNC( ) ) )
+ {
+ WorldPacket data(SMSG_AI_REACTION, 12);
+ data << m_Unit->GetGUID() << uint32(2); // Aggro sound
+ static_cast< Player* >( pPlayer )->GetSession()->SendPacket( &data );
+ return (Unit*)pPlayer;
+ }
+#else
+
+ WorldPacket data(SMSG_AI_REACTION, 12);
+ data << m_Unit->GetGUID() << uint32(2); // Aggro sound
+ static_cast< Player* >( pPlayer )->GetSession()->SendPacket( &data );
+ return (Unit*)pPlayer;
+#endif // LOS_CHECKS
+ }
+ }
+ }
+ }
+ }
+ //If we are here, the unit is either not a peace keeper, or could not find players in combat. Now we look for agro creatures/players.
for( itr = m_Unit->GetInRangeOppFactsSetBegin(); itr != m_Unit->GetInRangeOppFactsSetEnd(); )
{
it2 = itr;
@@ -1540,7 +1589,11 @@
std::set<Object*>::iterator itr;
Unit *pUnit;
-
+ if ( m_Unit->IsCreature() == true )
+ {
+ if ( static_cast<Creature*>(m_Unit)->proto->peacekeeper == 1 )
+ return NULL; //Peace keeper guards do not chain agro others around them.
+ }
for( itr = m_Unit->GetInRangeSetBegin(); itr != m_Unit->GetInRangeSetEnd(); itr++ )
Index: src/ascent-world/Creature.h
===================================================================
--- src/ascent-world/Creature.h (revision 4293)
+++ src/ascent-world/Creature.h (working copy)
@@ -191,7 +191,7 @@
float run_speed;//most of the time mobs use this
float fly_speed;
uint32 extra_a9_flags;
-
+ uint32 peacekeeper; //Is it a booty bay/ratchet etc style npc
/* AI Stuff */
bool m_canRangedAttack;
bool m_canFlee;
Index: src/ascent-world/ObjectStorage.cpp
===================================================================
--- src/ascent-world/ObjectStorage.cpp (revision 4293)
+++ src/ascent-world/ObjectStorage.cpp (working copy)
@@ -24,7 +24,7 @@
const char * gItemPrototypeFormat = "uuuussssuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuffuffuffuffuffuuuuuuuuuufuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuusuuuuuuuuuuuuuuuuuuuuuuuuuuuu";
const char * gCreatureNameFormat = "usssuuuuuuuuuuffcc";
const char * gGameObjectNameFormat = "uuusuuuuuuuuuuuuuuuuuuuuuuuu";
-const char * gCreatureProtoFormat = "uuuuuuufuuuffuffuuuuuuuuuuuuuuuuuuffsuuuufffu";
+const char * gCreatureProtoFormat = "uuuuuuufuuuffuffuuuuuuuuuuuuuuuuuuffsuuuufffuu";
const char * gAreaTriggerFormat = "ucuusffffuu";
const char * gItemPageFormat = "usu";
const char * gNpcTextFormat = "ufssuuuuuuufssuuuuuuufssuuuuuuufssuuuuuuufssuuuuuuufssuuuuuuufssuuuuuuufssuuuuuuu";
@@ -626,3 +626,4 @@
}
+
Index: src/ascent-world/Unit.h
===================================================================
--- src/ascent-world/Unit.h (revision 4293)
+++ src/ascent-world/Unit.h (working copy)
@@ -617,8 +617,8 @@
void UpdateFlag(); // detects if we have changed combat state (in/out), and applies the flag.
- ASCENT_INLINE bool IsInCombat() { return m_lastStatus; } // checks if we are in combat or not.
-
+ ASCENT_INLINE bool IsInCombat() { return m_lastStatus; } // checks if we are in combat or not. - This will be true even if you deal no damage to a target
+ ASCENT_INLINE bool IsInFullCombat() { return (m_attackTargets.size() != 0)?true:false; } //"Fully" in combat check, this will be true if you have healed or dealt damage to a target.
void OnRemoveFromWorld(); // called when we are removed from world, kills all references to us.
ASCENT_INLINE void Vanished()