mirror of
https://github.com/mangosfour/server.git
synced 2025-12-12 10:37:03 +00:00
Fix build and tidy up file
This commit is contained in:
parent
3875a3b094
commit
f97a43e3fc
1 changed files with 56 additions and 9 deletions
|
|
@ -52,6 +52,7 @@
|
||||||
#include "CellImpl.h"
|
#include "CellImpl.h"
|
||||||
#include "movement/MoveSplineInit.h"
|
#include "movement/MoveSplineInit.h"
|
||||||
#include "CreatureLinkingMgr.h"
|
#include "CreatureLinkingMgr.h"
|
||||||
|
#include "DisableMgr.h"
|
||||||
#ifdef ENABLE_ELUNA
|
#ifdef ENABLE_ELUNA
|
||||||
#include "LuaEngine.h"
|
#include "LuaEngine.h"
|
||||||
#endif /* ENABLE_ELUNA */
|
#endif /* ENABLE_ELUNA */
|
||||||
|
|
@ -223,7 +224,9 @@ void Creature::AddToWorld()
|
||||||
|
|
||||||
#ifdef ENABLE_ELUNA
|
#ifdef ENABLE_ELUNA
|
||||||
if (!inWorld)
|
if (!inWorld)
|
||||||
|
{
|
||||||
sEluna->OnAddToWorld(this);
|
sEluna->OnAddToWorld(this);
|
||||||
|
}
|
||||||
#endif /* ENABLE_ELUNA */
|
#endif /* ENABLE_ELUNA */
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -231,7 +234,9 @@ void Creature::RemoveFromWorld()
|
||||||
{
|
{
|
||||||
#ifdef ENABLE_ELUNA
|
#ifdef ENABLE_ELUNA
|
||||||
if (IsInWorld())
|
if (IsInWorld())
|
||||||
|
{
|
||||||
sEluna->OnRemoveFromWorld(this);
|
sEluna->OnRemoveFromWorld(this);
|
||||||
|
}
|
||||||
#endif /* ENABLE_ELUNA */
|
#endif /* ENABLE_ELUNA */
|
||||||
|
|
||||||
///- Remove the creature from the accessor
|
///- Remove the creature from the accessor
|
||||||
|
|
@ -279,7 +284,9 @@ void Creature::RemoveCorpse()
|
||||||
}
|
}
|
||||||
|
|
||||||
if (m_isCreatureLinkingTrigger)
|
if (m_isCreatureLinkingTrigger)
|
||||||
|
{
|
||||||
GetMap()->GetCreatureLinkingHolder()->DoCreatureLinkingEvent(LINKING_EVENT_DESPAWN, this);
|
GetMap()->GetCreatureLinkingHolder()->DoCreatureLinkingEvent(LINKING_EVENT_DESPAWN, this);
|
||||||
|
}
|
||||||
|
|
||||||
if (InstanceData* mapInstance = GetInstanceData())
|
if (InstanceData* mapInstance = GetInstanceData())
|
||||||
{
|
{
|
||||||
|
|
@ -399,7 +406,9 @@ bool Creature::InitEntry(uint32 Entry, CreatureData const* data /*=NULL*/, GameE
|
||||||
else if (!data || data->equipmentId == 0)
|
else if (!data || data->equipmentId == 0)
|
||||||
{
|
{
|
||||||
if (cinfo->EquipmentTemplateId== 0)
|
if (cinfo->EquipmentTemplateId== 0)
|
||||||
|
{
|
||||||
LoadEquipment(normalInfo->EquipmentTemplateId); // use default from normal template if diff does not have any
|
LoadEquipment(normalInfo->EquipmentTemplateId); // use default from normal template if diff does not have any
|
||||||
|
}
|
||||||
else
|
else
|
||||||
LoadEquipment(cinfo->EquipmentTemplateId); // else use from diff template
|
LoadEquipment(cinfo->EquipmentTemplateId); // else use from diff template
|
||||||
}
|
}
|
||||||
|
|
@ -695,9 +704,13 @@ void Creature::Update(uint32 update_diff, uint32 diff)
|
||||||
case ALIVE:
|
case ALIVE:
|
||||||
{
|
{
|
||||||
if (m_aggroDelay <= update_diff)
|
if (m_aggroDelay <= update_diff)
|
||||||
|
{
|
||||||
m_aggroDelay = 0;
|
m_aggroDelay = 0;
|
||||||
|
}
|
||||||
else
|
else
|
||||||
|
{
|
||||||
m_aggroDelay -= update_diff;
|
m_aggroDelay -= update_diff;
|
||||||
|
}
|
||||||
|
|
||||||
if (m_IsDeadByDefault)
|
if (m_IsDeadByDefault)
|
||||||
{
|
{
|
||||||
|
|
@ -824,7 +837,9 @@ void Creature::RegeneratePower()
|
||||||
addValue = uint32(Spirit / 5.0f + 17.0f) * ManaIncreaseRate;
|
addValue = uint32(Spirit / 5.0f + 17.0f) * ManaIncreaseRate;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
{
|
||||||
addValue = maxValue / 3.0f;
|
addValue = maxValue / 3.0f;
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
case POWER_ENERGY:
|
case POWER_ENERGY:
|
||||||
// ToDo: for vehicle this is different - NEEDS TO BE FIXED!
|
// ToDo: for vehicle this is different - NEEDS TO BE FIXED!
|
||||||
|
|
@ -882,8 +897,7 @@ void Creature::RegenerateHealth()
|
||||||
if (GetCharmerOrOwnerGuid())
|
if (GetCharmerOrOwnerGuid())
|
||||||
{
|
{
|
||||||
float HealthIncreaseRate = sWorld.getConfig(CONFIG_FLOAT_RATE_HEALTH);
|
float HealthIncreaseRate = sWorld.getConfig(CONFIG_FLOAT_RATE_HEALTH);
|
||||||
float Spirit = GetStat(STAT_SPIRIT);
|
float Spirit = GetStat(STAT_SPIRIT); //for charmed creatures, spirit = 0!
|
||||||
|
|
||||||
if (GetPower(POWER_MANA) > 0)
|
if (GetPower(POWER_MANA) > 0)
|
||||||
{
|
{
|
||||||
addvalue = uint32(Spirit * 0.25 * HealthIncreaseRate);
|
addvalue = uint32(Spirit * 0.25 * HealthIncreaseRate);
|
||||||
|
|
@ -1156,7 +1170,9 @@ bool Creature::CanInteractWithBattleMaster(Player* pPlayer, bool msg) const
|
||||||
case BATTLEGROUND_RL:
|
case BATTLEGROUND_RL:
|
||||||
case BATTLEGROUND_SA:
|
case BATTLEGROUND_SA:
|
||||||
case BATTLEGROUND_DS:
|
case BATTLEGROUND_DS:
|
||||||
case BATTLEGROUND_RV: pPlayer->PlayerTalkClass->SendGossipMenu(10024, GetObjectGuid()); break;
|
case BATTLEGROUND_RV:
|
||||||
|
pPlayer->PlayerTalkClass->SendGossipMenu(10024, GetObjectGuid());
|
||||||
|
break;
|
||||||
default: break;
|
default: break;
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
|
|
@ -1327,12 +1343,18 @@ void Creature::SaveToDB(uint32 mapid, uint8 spawnMask, uint32 phaseMask)
|
||||||
displayId != cinfo->ModelId[2] && displayId != cinfo->ModelId[3])
|
displayId != cinfo->ModelId[2] && displayId != cinfo->ModelId[3])
|
||||||
{
|
{
|
||||||
for (int i = 0; i < MAX_CREATURE_MODEL && displayId; ++i)
|
for (int i = 0; i < MAX_CREATURE_MODEL && displayId; ++i)
|
||||||
|
{
|
||||||
if (cinfo->ModelId[i])
|
if (cinfo->ModelId[i])
|
||||||
|
{
|
||||||
if (CreatureModelInfo const* minfo = sObjectMgr.GetCreatureModelInfo(cinfo->ModelId[i]))
|
if (CreatureModelInfo const* minfo = sObjectMgr.GetCreatureModelInfo(cinfo->ModelId[i]))
|
||||||
|
{
|
||||||
if (displayId == minfo->modelid_other_gender)
|
if (displayId == minfo->modelid_other_gender)
|
||||||
{
|
{
|
||||||
displayId = 0;
|
displayId = 0;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
|
@ -1559,9 +1581,11 @@ void Creature::SelectLevel(const CreatureInfo* cinfo, float percentHealth /*= 10
|
||||||
mana = minmana + uint32(rellevel * (maxmana - minmana));
|
mana = minmana + uint32(rellevel * (maxmana - minmana));
|
||||||
}
|
}
|
||||||
|
|
||||||
health *= _GetHealthMod(rank); // Apply custom config settting
|
health *= _GetHealthMod(rank); // Apply custom config setting
|
||||||
if (health < 1)
|
if (health < 1)
|
||||||
|
{
|
||||||
health = 1;
|
health = 1;
|
||||||
|
}
|
||||||
|
|
||||||
//////////////////////////////////////////////////////////////////////////
|
//////////////////////////////////////////////////////////////////////////
|
||||||
// Set values
|
// Set values
|
||||||
|
|
@ -1595,17 +1619,22 @@ void Creature::SelectLevel(const CreatureInfo* cinfo, float percentHealth /*= 10
|
||||||
case POWER_ENERGY: maxValue = POWER_ENERGY_DEFAULT * cinfo->PowerMultiplier; break;
|
case POWER_ENERGY: maxValue = POWER_ENERGY_DEFAULT * cinfo->PowerMultiplier; break;
|
||||||
case POWER_RUNE: maxValue = 0; break;
|
case POWER_RUNE: maxValue = 0; break;
|
||||||
case POWER_RUNIC_POWER: maxValue = 0; break;
|
case POWER_RUNIC_POWER: maxValue = 0; break;
|
||||||
|
default: break; // make compilers happy
|
||||||
}
|
}
|
||||||
|
|
||||||
uint32 value = maxValue;
|
uint32 value = maxValue;
|
||||||
|
|
||||||
// For non regenerating powers set 0
|
// For non regenerating powers set 0
|
||||||
if ((i == POWER_ENERGY || i == POWER_MANA) && !IsRegeneratingPower())
|
if ((i == POWER_ENERGY || i == POWER_MANA) && !IsRegeneratingPower())
|
||||||
|
{
|
||||||
value = 0;
|
value = 0;
|
||||||
|
}
|
||||||
|
|
||||||
// Mana requires an extra field to be set
|
// Mana requires an extra field to be set
|
||||||
if (i == POWER_MANA)
|
if (i == POWER_MANA)
|
||||||
|
{
|
||||||
SetCreateMana(value);
|
SetCreateMana(value);
|
||||||
|
}
|
||||||
|
|
||||||
SetMaxPower(Powers(i), maxValue);
|
SetMaxPower(Powers(i), maxValue);
|
||||||
SetPower(Powers(i), value);
|
SetPower(Powers(i), value);
|
||||||
|
|
@ -2028,13 +2057,12 @@ void Creature::SetDeathState(DeathState s)
|
||||||
|
|
||||||
void Creature::Respawn()
|
void Creature::Respawn()
|
||||||
{
|
{
|
||||||
|
RemoveCorpse();
|
||||||
if (!IsInWorld()) // Could be removed as part of a pool (in which case respawn-time is handled with pool-system)
|
if (!IsInWorld()) // Could be removed as part of a pool (in which case respawn-time is handled with pool-system)
|
||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
RemoveCorpse();
|
|
||||||
|
|
||||||
if (IsDespawned())
|
if (IsDespawned())
|
||||||
{
|
{
|
||||||
if (HasStaticDBSpawnData())
|
if (HasStaticDBSpawnData())
|
||||||
|
|
@ -2293,7 +2321,7 @@ SpellEntry const* Creature::ReachWithSpellCure(Unit* pVictim)
|
||||||
|
|
||||||
float dist = GetCombatDistance(pVictim, rangeIndex == SPELL_RANGE_IDX_COMBAT);
|
float dist = GetCombatDistance(pVictim, rangeIndex == SPELL_RANGE_IDX_COMBAT);
|
||||||
|
|
||||||
// if(!isInFront( pVictim, range ) && spellInfo->AttributesEx )
|
// if(!IsInFront( pVictim, range ) && spellInfo->AttributesEx )
|
||||||
// continue;
|
// continue;
|
||||||
if (dist > range || dist < minrange)
|
if (dist > range || dist < minrange)
|
||||||
{
|
{
|
||||||
|
|
@ -2614,7 +2642,9 @@ bool Creature::LoadCreatureAddon(bool reload)
|
||||||
SetByteValue(UNIT_FIELD_BYTES_2, 0, cainfo->sheath_state);
|
SetByteValue(UNIT_FIELD_BYTES_2, 0, cainfo->sheath_state);
|
||||||
|
|
||||||
if (cainfo->pvp_state != 0)
|
if (cainfo->pvp_state != 0)
|
||||||
|
{
|
||||||
SetByteValue(UNIT_FIELD_BYTES_2, 1, cainfo->pvp_state);
|
SetByteValue(UNIT_FIELD_BYTES_2, 1, cainfo->pvp_state);
|
||||||
|
}
|
||||||
|
|
||||||
// SetByteValue(UNIT_FIELD_BYTES_2, 2, 0);
|
// SetByteValue(UNIT_FIELD_BYTES_2, 2, 0);
|
||||||
// SetByteValue(UNIT_FIELD_BYTES_2, 3, 0);
|
// SetByteValue(UNIT_FIELD_BYTES_2, 3, 0);
|
||||||
|
|
@ -2856,7 +2886,9 @@ void Creature::AddCreatureSpellCooldown(uint32 spellid)
|
||||||
}
|
}
|
||||||
|
|
||||||
if(uint32 category = spellInfo->GetCategory())
|
if(uint32 category = spellInfo->GetCategory())
|
||||||
|
{
|
||||||
_AddCreatureCategoryCooldown(category, time(NULL));
|
_AddCreatureCategoryCooldown(category, time(NULL));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
bool Creature::HasCategoryCooldown(uint32 spell_id) const
|
bool Creature::HasCategoryCooldown(uint32 spell_id) const
|
||||||
|
|
@ -3291,8 +3323,7 @@ void Creature::AddToRemoveListInMaps(uint32 db_guid, CreatureData const* data)
|
||||||
|
|
||||||
struct SpawnCreatureInMapsWorker
|
struct SpawnCreatureInMapsWorker
|
||||||
{
|
{
|
||||||
SpawnCreatureInMapsWorker(uint32 guid, CreatureData const* data)
|
SpawnCreatureInMapsWorker(uint32 guid, CreatureData const* data) : i_guid(guid), i_data(data) {}
|
||||||
: i_guid(guid), i_data(data) {}
|
|
||||||
|
|
||||||
void operator()(Map* map)
|
void operator()(Map* map)
|
||||||
{
|
{
|
||||||
|
|
@ -3406,9 +3437,13 @@ void Creature::SetLevitate(bool enable)
|
||||||
void Creature::SetSwim(bool enable)
|
void Creature::SetSwim(bool enable)
|
||||||
{
|
{
|
||||||
if (enable)
|
if (enable)
|
||||||
|
{
|
||||||
m_movementInfo.AddMovementFlag(MOVEFLAG_SWIMMING);
|
m_movementInfo.AddMovementFlag(MOVEFLAG_SWIMMING);
|
||||||
|
}
|
||||||
else
|
else
|
||||||
|
{
|
||||||
m_movementInfo.RemoveMovementFlag(MOVEFLAG_SWIMMING);
|
m_movementInfo.RemoveMovementFlag(MOVEFLAG_SWIMMING);
|
||||||
|
}
|
||||||
|
|
||||||
WorldPacket data(enable ? SMSG_SPLINE_MOVE_START_SWIM : SMSG_SPLINE_MOVE_STOP_SWIM);
|
WorldPacket data(enable ? SMSG_SPLINE_MOVE_START_SWIM : SMSG_SPLINE_MOVE_STOP_SWIM);
|
||||||
data << GetPackGUID();
|
data << GetPackGUID();
|
||||||
|
|
@ -3418,9 +3453,13 @@ void Creature::SetSwim(bool enable)
|
||||||
void Creature::SetCanFly(bool enable)
|
void Creature::SetCanFly(bool enable)
|
||||||
{
|
{
|
||||||
if (enable)
|
if (enable)
|
||||||
|
{
|
||||||
m_movementInfo.AddMovementFlag(MOVEFLAG_CAN_FLY);
|
m_movementInfo.AddMovementFlag(MOVEFLAG_CAN_FLY);
|
||||||
|
}
|
||||||
else
|
else
|
||||||
|
{
|
||||||
m_movementInfo.RemoveMovementFlag(MOVEFLAG_CAN_FLY);
|
m_movementInfo.RemoveMovementFlag(MOVEFLAG_CAN_FLY);
|
||||||
|
}
|
||||||
|
|
||||||
WorldPacket data(enable ? SMSG_SPLINE_MOVE_SET_FLYING : SMSG_SPLINE_MOVE_UNSET_FLYING, 9);
|
WorldPacket data(enable ? SMSG_SPLINE_MOVE_SET_FLYING : SMSG_SPLINE_MOVE_UNSET_FLYING, 9);
|
||||||
data << GetPackGUID();
|
data << GetPackGUID();
|
||||||
|
|
@ -3430,9 +3469,13 @@ void Creature::SetCanFly(bool enable)
|
||||||
void Creature::SetFeatherFall(bool enable)
|
void Creature::SetFeatherFall(bool enable)
|
||||||
{
|
{
|
||||||
if (enable)
|
if (enable)
|
||||||
|
{
|
||||||
m_movementInfo.AddMovementFlag(MOVEFLAG_SAFE_FALL);
|
m_movementInfo.AddMovementFlag(MOVEFLAG_SAFE_FALL);
|
||||||
|
}
|
||||||
else
|
else
|
||||||
|
{
|
||||||
m_movementInfo.RemoveMovementFlag(MOVEFLAG_SAFE_FALL);
|
m_movementInfo.RemoveMovementFlag(MOVEFLAG_SAFE_FALL);
|
||||||
|
}
|
||||||
|
|
||||||
WorldPacket data(enable ? SMSG_SPLINE_MOVE_FEATHER_FALL : SMSG_SPLINE_MOVE_NORMAL_FALL);
|
WorldPacket data(enable ? SMSG_SPLINE_MOVE_FEATHER_FALL : SMSG_SPLINE_MOVE_NORMAL_FALL);
|
||||||
data << GetPackGUID();
|
data << GetPackGUID();
|
||||||
|
|
@ -3442,9 +3485,13 @@ void Creature::SetFeatherFall(bool enable)
|
||||||
void Creature::SetHover(bool enable)
|
void Creature::SetHover(bool enable)
|
||||||
{
|
{
|
||||||
if (enable)
|
if (enable)
|
||||||
|
{
|
||||||
m_movementInfo.AddMovementFlag(MOVEFLAG_HOVER);
|
m_movementInfo.AddMovementFlag(MOVEFLAG_HOVER);
|
||||||
|
}
|
||||||
else
|
else
|
||||||
|
{
|
||||||
m_movementInfo.RemoveMovementFlag(MOVEFLAG_HOVER);
|
m_movementInfo.RemoveMovementFlag(MOVEFLAG_HOVER);
|
||||||
|
}
|
||||||
|
|
||||||
WorldPacket data(enable ? SMSG_SPLINE_MOVE_SET_HOVER : SMSG_SPLINE_MOVE_UNSET_HOVER, 9);
|
WorldPacket data(enable ? SMSG_SPLINE_MOVE_SET_HOVER : SMSG_SPLINE_MOVE_UNSET_HOVER, 9);
|
||||||
data << GetPackGUID();
|
data << GetPackGUID();
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue