Core/Cleanup:
Mostly if(.. -> if (.. and for(.. -> for (.. but also some miscellaneous cleanup
This commit is contained in:
@@ -27,8 +27,7 @@
|
|||||||
#include "GridNotifiersImpl.h"
|
#include "GridNotifiersImpl.h"
|
||||||
#include "CellImpl.h"
|
#include "CellImpl.h"
|
||||||
|
|
||||||
int
|
int TotemAI::Permissible(Creature const* creature)
|
||||||
TotemAI::Permissible(const Creature* creature)
|
|
||||||
{
|
{
|
||||||
if (creature->isTotem())
|
if (creature->isTotem())
|
||||||
return PERMIT_BASE_PROACTIVE;
|
return PERMIT_BASE_PROACTIVE;
|
||||||
@@ -41,8 +40,7 @@ TotemAI::TotemAI(Creature* c) : CreatureAI(c), i_victimGuid(0)
|
|||||||
ASSERT(c->isTotem());
|
ASSERT(c->isTotem());
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void TotemAI::MoveInLineOfSight(Unit* /*who*/)
|
||||||
TotemAI::MoveInLineOfSight(Unit*)
|
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -51,8 +49,7 @@ void TotemAI::EnterEvadeMode()
|
|||||||
me->CombatStop(true);
|
me->CombatStop(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void TotemAI::UpdateAI(uint32 const /*diff*/)
|
||||||
TotemAI::UpdateAI(const uint32 /*diff*/)
|
|
||||||
{
|
{
|
||||||
if (me->ToTotem()->GetTotemType() != TOTEM_ACTIVE)
|
if (me->ToTotem()->GetTotemType() != TOTEM_ACTIVE)
|
||||||
return;
|
return;
|
||||||
@@ -98,8 +95,7 @@ TotemAI::UpdateAI(const uint32 /*diff*/)
|
|||||||
i_victimGuid = 0;
|
i_victimGuid = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void TotemAI::AttackStart(Unit* /*victim*/)
|
||||||
TotemAI::AttackStart(Unit*)
|
|
||||||
{
|
{
|
||||||
// Sentry totem sends ping on attack
|
// Sentry totem sends ping on attack
|
||||||
if (me->GetEntry() == SENTRY_TOTEM_ENTRY && me->GetOwner()->GetTypeId() == TYPEID_PLAYER)
|
if (me->GetEntry() == SENTRY_TOTEM_ENTRY && me->GetOwner()->GetTypeId() == TYPEID_PLAYER)
|
||||||
|
|||||||
@@ -31,12 +31,12 @@ class TotemAI : public CreatureAI
|
|||||||
|
|
||||||
explicit TotemAI(Creature* c);
|
explicit TotemAI(Creature* c);
|
||||||
|
|
||||||
void MoveInLineOfSight(Unit*);
|
void MoveInLineOfSight(Unit* who);
|
||||||
void AttackStart(Unit*);
|
void AttackStart(Unit* victim);
|
||||||
void EnterEvadeMode();
|
void EnterEvadeMode();
|
||||||
|
|
||||||
void UpdateAI(const uint32);
|
void UpdateAI(uint32 const diff);
|
||||||
static int Permissible(const Creature*);
|
static int Permissible(Creature const* creature);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
uint64 i_victimGuid;
|
uint64 i_victimGuid;
|
||||||
|
|||||||
@@ -82,7 +82,7 @@ namespace FactorySelector
|
|||||||
{
|
{
|
||||||
const CreatureAICreator* factory = iter->second;
|
const CreatureAICreator* factory = iter->second;
|
||||||
const SelectableAI* p = dynamic_cast<const SelectableAI*>(factory);
|
const SelectableAI* p = dynamic_cast<const SelectableAI*>(factory);
|
||||||
ASSERT(p != NULL);
|
ASSERT(p);
|
||||||
int val = p->Permit(creature);
|
int val = p->Permit(creature);
|
||||||
if (val > best_val)
|
if (val > best_val)
|
||||||
{
|
{
|
||||||
@@ -102,7 +102,7 @@ namespace FactorySelector
|
|||||||
MovementGenerator* selectMovementGenerator(Creature* creature)
|
MovementGenerator* selectMovementGenerator(Creature* creature)
|
||||||
{
|
{
|
||||||
MovementGeneratorRegistry& mv_registry(*MovementGeneratorRepository::instance());
|
MovementGeneratorRegistry& mv_registry(*MovementGeneratorRepository::instance());
|
||||||
ASSERT(creature->GetCreatureTemplate() != NULL);
|
ASSERT(creature->GetCreatureTemplate());
|
||||||
const MovementGeneratorCreator* mv_factory = mv_registry.GetRegistryItem(creature->GetDefaultMovementType());
|
const MovementGeneratorCreator* mv_factory = mv_registry.GetRegistryItem(creature->GetDefaultMovementType());
|
||||||
|
|
||||||
/* if (mv_factory == NULL)
|
/* if (mv_factory == NULL)
|
||||||
|
|||||||
@@ -1630,7 +1630,7 @@ void WorldObject::UpdateAllowedPositionZ(float x, float y, float &z) const
|
|||||||
default:
|
default:
|
||||||
{
|
{
|
||||||
float ground_z = GetBaseMap()->GetHeight(GetPhaseMask(), x, y, z, true);
|
float ground_z = GetBaseMap()->GetHeight(GetPhaseMask(), x, y, z, true);
|
||||||
if(ground_z > INVALID_HEIGHT)
|
if (ground_z > INVALID_HEIGHT)
|
||||||
z = ground_z;
|
z = ground_z;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -21148,10 +21148,10 @@ bool Player::BuyItemFromVendorSlot(uint64 vendorguid, uint32 vendorslot, uint32
|
|||||||
}
|
}
|
||||||
|
|
||||||
uint32 price = 0;
|
uint32 price = 0;
|
||||||
if(crItem->IsGoldRequired(pProto) && pProto->BuyPrice > 0) //Assume price cannot be negative (do not know why it is int32)
|
if (crItem->IsGoldRequired(pProto) && pProto->BuyPrice > 0) //Assume price cannot be negative (do not know why it is int32)
|
||||||
{
|
{
|
||||||
uint32 maxCount = MAX_MONEY_AMOUNT / pProto->BuyPrice;
|
uint32 maxCount = MAX_MONEY_AMOUNT / pProto->BuyPrice;
|
||||||
if((uint32)count > maxCount)
|
if ((uint32)count > maxCount)
|
||||||
{
|
{
|
||||||
sLog->outError("Player %s tried to buy %u item id %u, causing overflow", GetName(), (uint32)count, pProto->ItemId);
|
sLog->outError("Player %s tried to buy %u item id %u, causing overflow", GetName(), (uint32)count, pProto->ItemId);
|
||||||
count = (uint8)maxCount;
|
count = (uint8)maxCount;
|
||||||
|
|||||||
@@ -1494,7 +1494,7 @@ uint32 Unit::CalcArmorReducedDamage(Unit* victim, const uint32 damage, SpellInfo
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if (ToPlayer() && ToPlayer()->HasItemFitToSpellRequirements((*itr)->GetSpellInfo()))
|
if (ToPlayer()->HasItemFitToSpellRequirements((*itr)->GetSpellInfo()))
|
||||||
bonusPct += (*itr)->GetAmount();
|
bonusPct += (*itr)->GetAmount();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1504,6 +1504,7 @@ uint32 Unit::CalcArmorReducedDamage(Unit* victim, const uint32 damage, SpellInfo
|
|||||||
maxArmorPen = float(400 + 85 * victim->getLevel());
|
maxArmorPen = float(400 + 85 * victim->getLevel());
|
||||||
else
|
else
|
||||||
maxArmorPen = 400 + 85 * victim->getLevel() + 4.5f * 85 * (victim->getLevel() - 59);
|
maxArmorPen = 400 + 85 * victim->getLevel() + 4.5f * 85 * (victim->getLevel() - 59);
|
||||||
|
|
||||||
// Cap armor penetration to this number
|
// Cap armor penetration to this number
|
||||||
maxArmorPen = std::min((armor + maxArmorPen) / 3, armor);
|
maxArmorPen = std::min((armor + maxArmorPen) / 3, armor);
|
||||||
// Figure out how much armor do we ignore
|
// Figure out how much armor do we ignore
|
||||||
@@ -5751,7 +5752,7 @@ bool Unit::HandleDummyAuraProc(Unit* victim, uint32 damage, AuraEffect* triggere
|
|||||||
// Glyph of Polymorph
|
// Glyph of Polymorph
|
||||||
case 56375:
|
case 56375:
|
||||||
{
|
{
|
||||||
if(!target)
|
if (!target)
|
||||||
return false;
|
return false;
|
||||||
target->RemoveAurasByType(SPELL_AURA_PERIODIC_DAMAGE, 0, target->GetAura(32409)); // SW:D shall not be removed.
|
target->RemoveAurasByType(SPELL_AURA_PERIODIC_DAMAGE, 0, target->GetAura(32409)); // SW:D shall not be removed.
|
||||||
target->RemoveAurasByType(SPELL_AURA_PERIODIC_DAMAGE_PERCENT);
|
target->RemoveAurasByType(SPELL_AURA_PERIODIC_DAMAGE_PERCENT);
|
||||||
@@ -5810,7 +5811,7 @@ bool Unit::HandleDummyAuraProc(Unit* victim, uint32 damage, AuraEffect* triggere
|
|||||||
// Blessing of Ancient Kings (Val'anyr, Hammer of Ancient Kings)
|
// Blessing of Ancient Kings (Val'anyr, Hammer of Ancient Kings)
|
||||||
case 64411:
|
case 64411:
|
||||||
{
|
{
|
||||||
if(!victim)
|
if (!victim)
|
||||||
return false;
|
return false;
|
||||||
basepoints0 = int32(CalculatePctN(damage, 15));
|
basepoints0 = int32(CalculatePctN(damage, 15));
|
||||||
if (AuraEffect* aurEff = victim->GetAuraEffect(64413, 0, GetGUID()))
|
if (AuraEffect* aurEff = victim->GetAuraEffect(64413, 0, GetGUID()))
|
||||||
@@ -6121,7 +6122,7 @@ bool Unit::HandleDummyAuraProc(Unit* victim, uint32 damage, AuraEffect* triggere
|
|||||||
// Divine Aegis
|
// Divine Aegis
|
||||||
if (dummySpell->SpellIconID == 2820)
|
if (dummySpell->SpellIconID == 2820)
|
||||||
{
|
{
|
||||||
if(!target)
|
if (!target)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
// Multiple effects stack, so let's try to find this aura.
|
// Multiple effects stack, so let's try to find this aura.
|
||||||
@@ -6291,7 +6292,7 @@ bool Unit::HandleDummyAuraProc(Unit* victim, uint32 damage, AuraEffect* triggere
|
|||||||
// Glyph of Shred
|
// Glyph of Shred
|
||||||
case 54815:
|
case 54815:
|
||||||
{
|
{
|
||||||
if(!target)
|
if (!target)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
// try to find spell Rip on the target
|
// try to find spell Rip on the target
|
||||||
@@ -6597,7 +6598,7 @@ bool Unit::HandleDummyAuraProc(Unit* victim, uint32 damage, AuraEffect* triggere
|
|||||||
// Explosive Shot
|
// Explosive Shot
|
||||||
if (procSpell->SpellFamilyFlags[2] & 0x200)
|
if (procSpell->SpellFamilyFlags[2] & 0x200)
|
||||||
{
|
{
|
||||||
if(!victim)
|
if (!victim)
|
||||||
return false;
|
return false;
|
||||||
if (AuraEffect const* pEff = victim->GetAuraEffect(SPELL_AURA_PERIODIC_DUMMY, SPELLFAMILY_HUNTER, 0x0, 0x80000000, 0x0, GetGUID()))
|
if (AuraEffect const* pEff = victim->GetAuraEffect(SPELL_AURA_PERIODIC_DUMMY, SPELLFAMILY_HUNTER, 0x0, 0x80000000, 0x0, GetGUID()))
|
||||||
basepoints0 = pEff->GetSpellInfo()->CalcPowerCost(this, SpellSchoolMask(pEff->GetSpellInfo()->SchoolMask)) * 4/10/3;
|
basepoints0 = pEff->GetSpellInfo()->CalcPowerCost(this, SpellSchoolMask(pEff->GetSpellInfo()->SchoolMask)) * 4/10/3;
|
||||||
|
|||||||
@@ -797,7 +797,7 @@ namespace Trinity
|
|||||||
if (u->GetTypeId() == TYPEID_UNIT && ((Creature*)u)->isTotem())
|
if (u->GetTypeId() == TYPEID_UNIT && ((Creature*)u)->isTotem())
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
if(!u->isTargetableForAttack(false))
|
if (!u->isTargetableForAttack(false))
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
return i_obj->IsWithinDistInMap(u, i_range) && !i_funit->IsFriendlyTo(u);
|
return i_obj->IsWithinDistInMap(u, i_range) && !i_funit->IsFriendlyTo(u);
|
||||||
|
|||||||
@@ -787,20 +787,20 @@ void Map::RemoveCreatureFromMoveList(Creature* c)
|
|||||||
void Map::MoveAllCreaturesInMoveList()
|
void Map::MoveAllCreaturesInMoveList()
|
||||||
{
|
{
|
||||||
_creatureToMoveLock = true;
|
_creatureToMoveLock = true;
|
||||||
for(std::vector<Creature*>::iterator itr = _creaturesToMove.begin(); itr != _creaturesToMove.end(); ++itr)
|
for (std::vector<Creature*>::iterator itr = _creaturesToMove.begin(); itr != _creaturesToMove.end(); ++itr)
|
||||||
{
|
{
|
||||||
Creature* c = *itr;
|
Creature* c = *itr;
|
||||||
if(c->FindMap() != this) //pet is teleported to another map
|
if (c->FindMap() != this) //pet is teleported to another map
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
if(c->_moveState != CREATURE_CELL_MOVE_ACTIVE)
|
if (c->_moveState != CREATURE_CELL_MOVE_ACTIVE)
|
||||||
{
|
{
|
||||||
c->_moveState = CREATURE_CELL_MOVE_NONE;
|
c->_moveState = CREATURE_CELL_MOVE_NONE;
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
c->_moveState = CREATURE_CELL_MOVE_NONE;
|
c->_moveState = CREATURE_CELL_MOVE_NONE;
|
||||||
if(!c->IsInWorld())
|
if (!c->IsInWorld())
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
// do move or do move to respawn or remove creature if previous all fail
|
// do move or do move to respawn or remove creature if previous all fail
|
||||||
|
|||||||
@@ -96,32 +96,32 @@ void MapManager::checkAndCorrectGridStatesArray()
|
|||||||
|
|
||||||
Map* MapManager::CreateBaseMap(uint32 id)
|
Map* MapManager::CreateBaseMap(uint32 id)
|
||||||
{
|
{
|
||||||
Map* m = FindBaseMap(id);
|
Map* map = FindBaseMap(id);
|
||||||
|
|
||||||
if (m == NULL)
|
if (map == NULL)
|
||||||
{
|
{
|
||||||
TRINITY_GUARD(ACE_Thread_Mutex, Lock);
|
TRINITY_GUARD(ACE_Thread_Mutex, Lock);
|
||||||
|
|
||||||
const MapEntry* entry = sMapStore.LookupEntry(id);
|
const MapEntry* entry = sMapStore.LookupEntry(id);
|
||||||
if (entry && entry->Instanceable())
|
if (entry && entry->Instanceable())
|
||||||
{
|
{
|
||||||
m = new MapInstanced(id, i_gridCleanUpDelay);
|
map = new MapInstanced(id, i_gridCleanUpDelay);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
m = new Map(id, i_gridCleanUpDelay, 0, REGULAR_DIFFICULTY);
|
map = new Map(id, i_gridCleanUpDelay, 0, REGULAR_DIFFICULTY);
|
||||||
}
|
}
|
||||||
i_maps[id] = m;
|
i_maps[id] = map;
|
||||||
}
|
}
|
||||||
|
|
||||||
ASSERT(m != NULL);
|
ASSERT(map);
|
||||||
return m;
|
return map;
|
||||||
}
|
}
|
||||||
|
|
||||||
Map* MapManager::FindBaseNonInstanceMap(uint32 mapId) const
|
Map* MapManager::FindBaseNonInstanceMap(uint32 mapId) const
|
||||||
{
|
{
|
||||||
Map* map = FindBaseMap(mapId);
|
Map* map = FindBaseMap(mapId);
|
||||||
if(map && map->Instanceable())
|
if (map && map->Instanceable())
|
||||||
return NULL;
|
return NULL;
|
||||||
return map;
|
return map;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -410,7 +410,7 @@ enum SpellAttr3
|
|||||||
|
|
||||||
enum SpellAttr4
|
enum SpellAttr4
|
||||||
{
|
{
|
||||||
SPELL_ATTR4_IGNORE_RESISTANCES = 0x00000001, // 0 spells with this attribute will completely ignore the target resistances (theese spells cant be resisted)
|
SPELL_ATTR4_IGNORE_RESISTANCES = 0x00000001, // 0 spells with this attribute will completely ignore the target's resistance (these spells can't be resisted)
|
||||||
SPELL_ATTR4_PROC_ONLY_ON_CASTER = 0x00000002, // 1 proc only on effects with TARGET_UNIT_CASTER?
|
SPELL_ATTR4_PROC_ONLY_ON_CASTER = 0x00000002, // 1 proc only on effects with TARGET_UNIT_CASTER?
|
||||||
SPELL_ATTR4_UNK2 = 0x00000004, // 2
|
SPELL_ATTR4_UNK2 = 0x00000004, // 2
|
||||||
SPELL_ATTR4_UNK3 = 0x00000008, // 3
|
SPELL_ATTR4_UNK3 = 0x00000008, // 3
|
||||||
|
|||||||
@@ -28,8 +28,7 @@
|
|||||||
#define MAX_QUIET_DISTANCE 43.0f
|
#define MAX_QUIET_DISTANCE 43.0f
|
||||||
|
|
||||||
template<class T>
|
template<class T>
|
||||||
void
|
void FleeingMovementGenerator<T>::_setTargetLocation(T &owner)
|
||||||
FleeingMovementGenerator<T>::_setTargetLocation(T &owner)
|
|
||||||
{
|
{
|
||||||
if (!&owner)
|
if (!&owner)
|
||||||
return;
|
return;
|
||||||
@@ -53,8 +52,7 @@ FleeingMovementGenerator<T>::_setTargetLocation(T &owner)
|
|||||||
}
|
}
|
||||||
|
|
||||||
template<class T>
|
template<class T>
|
||||||
bool
|
bool FleeingMovementGenerator<T>::_getPoint(T &owner, float &x, float &y, float &z)
|
||||||
FleeingMovementGenerator<T>::_getPoint(T &owner, float &x, float &y, float &z)
|
|
||||||
{
|
{
|
||||||
if (!&owner)
|
if (!&owner)
|
||||||
return false;
|
return false;
|
||||||
@@ -65,8 +63,8 @@ FleeingMovementGenerator<T>::_getPoint(T &owner, float &x, float &y, float &z)
|
|||||||
|
|
||||||
float temp_x, temp_y, angle;
|
float temp_x, temp_y, angle;
|
||||||
const Map* _map = owner.GetBaseMap();
|
const Map* _map = owner.GetBaseMap();
|
||||||
//primitive path-finding
|
// primitive path-finding
|
||||||
for(uint8 i = 0; i < 18; ++i)
|
for (uint8 i = 0; i < 18; ++i)
|
||||||
{
|
{
|
||||||
if (i_only_forward && i > 2)
|
if (i_only_forward && i > 2)
|
||||||
break;
|
break;
|
||||||
@@ -187,8 +185,7 @@ FleeingMovementGenerator<T>::_getPoint(T &owner, float &x, float &y, float &z)
|
|||||||
}
|
}
|
||||||
|
|
||||||
template<class T>
|
template<class T>
|
||||||
bool
|
bool FleeingMovementGenerator<T>::_setMoveData(T &owner)
|
||||||
FleeingMovementGenerator<T>::_setMoveData(T &owner)
|
|
||||||
{
|
{
|
||||||
float cur_dist_xyz = owner.GetDistance(i_caster_x, i_caster_y, i_caster_z);
|
float cur_dist_xyz = owner.GetDistance(i_caster_x, i_caster_y, i_caster_z);
|
||||||
|
|
||||||
@@ -280,8 +277,7 @@ FleeingMovementGenerator<T>::_setMoveData(T &owner)
|
|||||||
}
|
}
|
||||||
|
|
||||||
template<class T>
|
template<class T>
|
||||||
void
|
void FleeingMovementGenerator<T>::Initialize(T &owner)
|
||||||
FleeingMovementGenerator<T>::Initialize(T &owner)
|
|
||||||
{
|
{
|
||||||
if (!&owner)
|
if (!&owner)
|
||||||
return;
|
return;
|
||||||
@@ -312,8 +308,7 @@ FleeingMovementGenerator<T>::Initialize(T &owner)
|
|||||||
}
|
}
|
||||||
|
|
||||||
template<>
|
template<>
|
||||||
void
|
void FleeingMovementGenerator<Creature>::_Init(Creature &owner)
|
||||||
FleeingMovementGenerator<Creature>::_Init(Creature &owner)
|
|
||||||
{
|
{
|
||||||
if (!&owner)
|
if (!&owner)
|
||||||
return;
|
return;
|
||||||
@@ -324,8 +319,7 @@ FleeingMovementGenerator<Creature>::_Init(Creature &owner)
|
|||||||
}
|
}
|
||||||
|
|
||||||
template<>
|
template<>
|
||||||
void
|
void FleeingMovementGenerator<Player>::_Init(Player &)
|
||||||
FleeingMovementGenerator<Player>::_Init(Player &)
|
|
||||||
{
|
{
|
||||||
is_water_ok = true;
|
is_water_ok = true;
|
||||||
is_land_ok = true;
|
is_land_ok = true;
|
||||||
@@ -354,8 +348,7 @@ void FleeingMovementGenerator<T>::Reset(T &owner)
|
|||||||
}
|
}
|
||||||
|
|
||||||
template<class T>
|
template<class T>
|
||||||
bool
|
bool FleeingMovementGenerator<T>::Update(T &owner, const uint32 &time_diff)
|
||||||
FleeingMovementGenerator<T>::Update(T &owner, const uint32 &time_diff)
|
|
||||||
{
|
{
|
||||||
if (!&owner || !owner.isAlive())
|
if (!&owner || !owner.isAlive())
|
||||||
return false;
|
return false;
|
||||||
|
|||||||
@@ -22,8 +22,7 @@
|
|||||||
#include "MovementGenerator.h"
|
#include "MovementGenerator.h"
|
||||||
|
|
||||||
template<class T>
|
template<class T>
|
||||||
class FleeingMovementGenerator
|
class FleeingMovementGenerator : public MovementGeneratorMedium< T, FleeingMovementGenerator<T> >
|
||||||
: public MovementGeneratorMedium< T, FleeingMovementGenerator<T> >
|
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
FleeingMovementGenerator(uint64 fright) : i_frightGUID(fright), i_nextCheckTime(0) {}
|
FleeingMovementGenerator(uint64 fright) : i_frightGUID(fright), i_nextCheckTime(0) {}
|
||||||
@@ -55,8 +54,7 @@ class FleeingMovementGenerator
|
|||||||
TimeTracker i_nextCheckTime;
|
TimeTracker i_nextCheckTime;
|
||||||
};
|
};
|
||||||
|
|
||||||
class TimedFleeingMovementGenerator
|
class TimedFleeingMovementGenerator : public FleeingMovementGenerator<Creature>
|
||||||
: public FleeingMovementGenerator<Creature>
|
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
TimedFleeingMovementGenerator(uint64 fright, uint32 time) :
|
TimedFleeingMovementGenerator(uint64 fright, uint32 time) :
|
||||||
|
|||||||
@@ -27,8 +27,7 @@ template < class T >
|
|||||||
class HomeMovementGenerator;
|
class HomeMovementGenerator;
|
||||||
|
|
||||||
template <>
|
template <>
|
||||||
class HomeMovementGenerator<Creature>
|
class HomeMovementGenerator<Creature> : public MovementGeneratorMedium< Creature, HomeMovementGenerator<Creature> >
|
||||||
: public MovementGeneratorMedium< Creature, HomeMovementGenerator<Creature> >
|
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
|
|
||||||
|
|||||||
@@ -46,7 +46,7 @@ bool PointMovementGenerator<T>::Update(T &unit, const uint32 & /*diff*/)
|
|||||||
if (!&unit)
|
if (!&unit)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
if(unit.HasUnitState(UNIT_STATE_ROOT | UNIT_STATE_STUNNED))
|
if (unit.HasUnitState(UNIT_STATE_ROOT | UNIT_STATE_STUNNED))
|
||||||
{
|
{
|
||||||
unit.ClearUnitState(UNIT_STATE_ROAMING_MOVE);
|
unit.ClearUnitState(UNIT_STATE_ROAMING_MOVE);
|
||||||
return true;
|
return true;
|
||||||
|
|||||||
@@ -23,8 +23,7 @@
|
|||||||
#include "FollowerReference.h"
|
#include "FollowerReference.h"
|
||||||
|
|
||||||
template<class T>
|
template<class T>
|
||||||
class PointMovementGenerator
|
class PointMovementGenerator : public MovementGeneratorMedium< T, PointMovementGenerator<T> >
|
||||||
: public MovementGeneratorMedium< T, PointMovementGenerator<T> >
|
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
PointMovementGenerator(uint32 _id, float _x, float _y, float _z, float _speed = 0.0f) : id(_id),
|
PointMovementGenerator(uint32 _id, float _x, float _y, float _z, float _speed = 0.0f) : id(_id),
|
||||||
@@ -46,8 +45,7 @@ class PointMovementGenerator
|
|||||||
float speed;
|
float speed;
|
||||||
};
|
};
|
||||||
|
|
||||||
class AssistanceMovementGenerator
|
class AssistanceMovementGenerator : public PointMovementGenerator<Creature>
|
||||||
: public PointMovementGenerator<Creature>
|
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
AssistanceMovementGenerator(float _x, float _y, float _z) :
|
AssistanceMovementGenerator(float _x, float _y, float _z) :
|
||||||
|
|||||||
@@ -127,8 +127,7 @@ void RandomMovementGenerator<Creature>::Initialize(Creature &creature)
|
|||||||
}
|
}
|
||||||
|
|
||||||
template<>
|
template<>
|
||||||
void
|
void RandomMovementGenerator<Creature>::Reset(Creature &creature)
|
||||||
RandomMovementGenerator<Creature>::Reset(Creature &creature)
|
|
||||||
{
|
{
|
||||||
Initialize(creature);
|
Initialize(creature);
|
||||||
}
|
}
|
||||||
@@ -141,8 +140,7 @@ void RandomMovementGenerator<Creature>::Finalize(Creature &creature)
|
|||||||
}
|
}
|
||||||
|
|
||||||
template<>
|
template<>
|
||||||
bool
|
bool RandomMovementGenerator<Creature>::Update(Creature &creature, const uint32 diff)
|
||||||
RandomMovementGenerator<Creature>::Update(Creature &creature, const uint32 diff)
|
|
||||||
{
|
{
|
||||||
if (creature.HasUnitState(UNIT_STATE_ROOT | UNIT_STATE_STUNNED | UNIT_STATE_DISTRACTED))
|
if (creature.HasUnitState(UNIT_STATE_ROOT | UNIT_STATE_STUNNED | UNIT_STATE_DISTRACTED))
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -22,8 +22,7 @@
|
|||||||
#include "MovementGenerator.h"
|
#include "MovementGenerator.h"
|
||||||
|
|
||||||
template<class T>
|
template<class T>
|
||||||
class RandomMovementGenerator
|
class RandomMovementGenerator : public MovementGeneratorMedium< T, RandomMovementGenerator<T> >
|
||||||
: public MovementGeneratorMedium< T, RandomMovementGenerator<T> >
|
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
RandomMovementGenerator(float spawn_dist = 0.0f) : i_nextMoveTime(0), wander_distance(spawn_dist) {}
|
RandomMovementGenerator(float spawn_dist = 0.0f) : i_nextMoveTime(0), wander_distance(spawn_dist) {}
|
||||||
|
|||||||
@@ -78,7 +78,7 @@ void TargetedMovementGeneratorMedium<T,D>::_setTargetLocation(T &owner)
|
|||||||
|
|
||||||
//We don't update Mob Movement, if the difference between New destination and last destination is < BothObjectSize
|
//We don't update Mob Movement, if the difference between New destination and last destination is < BothObjectSize
|
||||||
float bothObjectSize = i_target->GetObjectBoundingRadius() + owner.GetObjectBoundingRadius() + CONTACT_DISTANCE;
|
float bothObjectSize = i_target->GetObjectBoundingRadius() + owner.GetObjectBoundingRadius() + CONTACT_DISTANCE;
|
||||||
if( i_destinationHolder.HasDestination() && i_destinationHolder.GetDestinationDiff(x,y,z) < bothObjectSize )
|
if ( i_destinationHolder.HasDestination() && i_destinationHolder.GetDestinationDiff(x,y,z) < bothObjectSize )
|
||||||
return;
|
return;
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|||||||
@@ -34,8 +34,7 @@ class TargetedMovementGeneratorBase
|
|||||||
};
|
};
|
||||||
|
|
||||||
template<class T, typename D>
|
template<class T, typename D>
|
||||||
class TargetedMovementGeneratorMedium
|
class TargetedMovementGeneratorMedium : public MovementGeneratorMedium< T, D >, public TargetedMovementGeneratorBase
|
||||||
: public MovementGeneratorMedium< T, D >, public TargetedMovementGeneratorBase
|
|
||||||
{
|
{
|
||||||
protected:
|
protected:
|
||||||
TargetedMovementGeneratorMedium(Unit &target, float offset, float angle) :
|
TargetedMovementGeneratorMedium(Unit &target, float offset, float angle) :
|
||||||
|
|||||||
@@ -58,9 +58,8 @@ template<class T>
|
|||||||
class WaypointMovementGenerator;
|
class WaypointMovementGenerator;
|
||||||
|
|
||||||
template<>
|
template<>
|
||||||
class WaypointMovementGenerator<Creature>
|
class WaypointMovementGenerator<Creature> : public MovementGeneratorMedium< Creature, WaypointMovementGenerator<Creature> >,
|
||||||
: public MovementGeneratorMedium< Creature, WaypointMovementGenerator<Creature> >,
|
public PathMovementBase<Creature, WaypointPath const*>
|
||||||
public PathMovementBase<Creature, WaypointPath const*>
|
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
WaypointMovementGenerator(uint32 _path_id = 0, bool _repeating = true)
|
WaypointMovementGenerator(uint32 _path_id = 0, bool _repeating = true)
|
||||||
@@ -110,9 +109,8 @@ public PathMovementBase<Creature, WaypointPath const*>
|
|||||||
/** FlightPathMovementGenerator generates movement of the player for the paths
|
/** FlightPathMovementGenerator generates movement of the player for the paths
|
||||||
* and hence generates ground and activities for the player.
|
* and hence generates ground and activities for the player.
|
||||||
*/
|
*/
|
||||||
class FlightPathMovementGenerator
|
class FlightPathMovementGenerator : public MovementGeneratorMedium< Player, FlightPathMovementGenerator >,
|
||||||
: public MovementGeneratorMedium< Player, FlightPathMovementGenerator >,
|
public PathMovementBase<Player, TaxiPathNodeList const*>
|
||||||
public PathMovementBase<Player, TaxiPathNodeList const*>
|
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
explicit FlightPathMovementGenerator(TaxiPathNodeList const& pathnodes, uint32 startNode = 0)
|
explicit FlightPathMovementGenerator(TaxiPathNodeList const& pathnodes, uint32 startNode = 0)
|
||||||
|
|||||||
@@ -288,7 +288,7 @@ std::string MoveSpline::ToString() const
|
|||||||
str << "facing angle: " << facing.angle;
|
str << "facing angle: " << facing.angle;
|
||||||
else if (splineflags.final_target)
|
else if (splineflags.final_target)
|
||||||
str << "facing target: " << facing.target;
|
str << "facing target: " << facing.target;
|
||||||
else if(splineflags.final_point)
|
else if (splineflags.final_point)
|
||||||
str << "facing point: " << facing.f.x << " " << facing.f.y << " " << facing.f.z;
|
str << "facing point: " << facing.f.x << " " << facing.f.y << " " << facing.f.z;
|
||||||
str << std::endl;
|
str << std::endl;
|
||||||
str << "time passed: " << time_passed << std::endl;
|
str << "time passed: " << time_passed << std::endl;
|
||||||
|
|||||||
@@ -111,7 +111,7 @@ namespace Movement
|
|||||||
Vector3 middle = (real_path[0] + real_path[last_idx]) / 2.f;
|
Vector3 middle = (real_path[0] + real_path[last_idx]) / 2.f;
|
||||||
Vector3 offset;
|
Vector3 offset;
|
||||||
// first and last points already appended
|
// first and last points already appended
|
||||||
for(uint32 i = 1; i < last_idx; ++i)
|
for (uint32 i = 1; i < last_idx; ++i)
|
||||||
{
|
{
|
||||||
offset = middle - real_path[i];
|
offset = middle - real_path[i];
|
||||||
data.appendPackXYZ(offset.x, offset.y, offset.z);
|
data.appendPackXYZ(offset.x, offset.y, offset.z);
|
||||||
@@ -169,7 +169,7 @@ namespace Movement
|
|||||||
{
|
{
|
||||||
data << move_spline.facing.target;
|
data << move_spline.facing.target;
|
||||||
}
|
}
|
||||||
else if(splineFlags.final_point)
|
else if (splineFlags.final_point)
|
||||||
{
|
{
|
||||||
data << move_spline.facing.f.x << move_spline.facing.f.y << move_spline.facing.f.z;
|
data << move_spline.facing.f.x << move_spline.facing.f.y << move_spline.facing.f.z;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -122,7 +122,7 @@ void WardenMac::HandleHashResult(ByteBuffer &buff)
|
|||||||
|
|
||||||
uint8 mod_seed[16] = { 0x4D, 0x80, 0x8D, 0x2C, 0x77, 0xD9, 0x05, 0xC4, 0x1A, 0x63, 0x80, 0xEC, 0x08, 0x58, 0x6A, 0xFE };
|
uint8 mod_seed[16] = { 0x4D, 0x80, 0x8D, 0x2C, 0x77, 0xD9, 0x05, 0xC4, 0x1A, 0x63, 0x80, 0xEC, 0x08, 0x58, 0x6A, 0xFE };
|
||||||
|
|
||||||
for(int i = 0; i < 4; ++i)
|
for (int i = 0; i < 4; ++i)
|
||||||
{
|
{
|
||||||
keyIn[i] = *(int*)(&mod_seed[0] + i * 4);
|
keyIn[i] = *(int*)(&mod_seed[0] + i * 4);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user