mirror of
https://github.com/mangosfour/server.git
synced 2025-12-12 10:37:03 +00:00
Fixed error output at creature loading.
This commit is contained in:
parent
0ef8305ebb
commit
c990e2aaef
1 changed files with 61 additions and 59 deletions
|
|
@ -60,7 +60,7 @@ bool VendorItemData::RemoveItem( uint32 item_id )
|
||||||
{
|
{
|
||||||
for(VendorItemList::iterator i = m_items.begin(); i != m_items.end(); ++i )
|
for(VendorItemList::iterator i = m_items.begin(); i != m_items.end(); ++i )
|
||||||
{
|
{
|
||||||
if((*i)->item==item_id)
|
if((*i)->item == item_id)
|
||||||
{
|
{
|
||||||
m_items.erase(i);
|
m_items.erase(i);
|
||||||
return true;
|
return true;
|
||||||
|
|
@ -72,7 +72,7 @@ bool VendorItemData::RemoveItem( uint32 item_id )
|
||||||
size_t VendorItemData::FindItemSlot(uint32 item_id) const
|
size_t VendorItemData::FindItemSlot(uint32 item_id) const
|
||||||
{
|
{
|
||||||
for(size_t i = 0; i < m_items.size(); ++i )
|
for(size_t i = 0; i < m_items.size(); ++i )
|
||||||
if(m_items[i]->item==item_id)
|
if(m_items[i]->item == item_id)
|
||||||
return i;
|
return i;
|
||||||
return m_items.size();
|
return m_items.size();
|
||||||
}
|
}
|
||||||
|
|
@ -80,7 +80,7 @@ size_t VendorItemData::FindItemSlot(uint32 item_id) const
|
||||||
VendorItem const* VendorItemData::FindItem(uint32 item_id) const
|
VendorItem const* VendorItemData::FindItem(uint32 item_id) const
|
||||||
{
|
{
|
||||||
for(VendorItemList::const_iterator i = m_items.begin(); i != m_items.end(); ++i )
|
for(VendorItemList::const_iterator i = m_items.begin(); i != m_items.end(); ++i )
|
||||||
if((*i)->item==item_id)
|
if((*i)->item == item_id)
|
||||||
return *i;
|
return *i;
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
@ -124,7 +124,7 @@ m_creatureInfo(NULL), m_isActiveObject(false), m_monsterMoveFlags(MONSTER_MOVE_W
|
||||||
m_regenTimer = 200;
|
m_regenTimer = 200;
|
||||||
m_valuesCount = UNIT_END;
|
m_valuesCount = UNIT_END;
|
||||||
|
|
||||||
for(int i =0; i<4; ++i)
|
for(int i = 0; i < 4; ++i)
|
||||||
m_spells[i] = 0;
|
m_spells[i] = 0;
|
||||||
|
|
||||||
m_CreatureSpellCooldowns.clear();
|
m_CreatureSpellCooldowns.clear();
|
||||||
|
|
@ -147,7 +147,7 @@ Creature::~Creature()
|
||||||
void Creature::AddToWorld()
|
void Creature::AddToWorld()
|
||||||
{
|
{
|
||||||
///- Register the creature for guid lookup
|
///- Register the creature for guid lookup
|
||||||
if(!IsInWorld() && GetGUIDHigh()==HIGHGUID_UNIT)
|
if(!IsInWorld() && GetGUIDHigh() == HIGHGUID_UNIT)
|
||||||
GetMap()->GetObjectsStore().insert<Creature>(GetGUID(), (Creature*)this);
|
GetMap()->GetObjectsStore().insert<Creature>(GetGUID(), (Creature*)this);
|
||||||
|
|
||||||
Unit::AddToWorld();
|
Unit::AddToWorld();
|
||||||
|
|
@ -156,7 +156,7 @@ void Creature::AddToWorld()
|
||||||
void Creature::RemoveFromWorld()
|
void Creature::RemoveFromWorld()
|
||||||
{
|
{
|
||||||
///- Remove the creature from the accessor
|
///- Remove the creature from the accessor
|
||||||
if(IsInWorld() && GetGUIDHigh()==HIGHGUID_UNIT)
|
if(IsInWorld() && GetGUIDHigh() == HIGHGUID_UNIT)
|
||||||
GetMap()->GetObjectsStore().erase<Creature>(GetGUID(), (Creature*)NULL);
|
GetMap()->GetObjectsStore().erase<Creature>(GetGUID(), (Creature*)NULL);
|
||||||
|
|
||||||
Unit::RemoveFromWorld();
|
Unit::RemoveFromWorld();
|
||||||
|
|
@ -177,9 +177,9 @@ void Creature::RemoveCorpse()
|
||||||
|
|
||||||
m_respawnTime = time(NULL) + respawnDelay;
|
m_respawnTime = time(NULL) + respawnDelay;
|
||||||
|
|
||||||
float x,y,z,o;
|
float x, y, z, o;
|
||||||
GetRespawnCoord(x, y, z, &o);
|
GetRespawnCoord(x, y, z, &o);
|
||||||
GetMap()->CreatureRelocation(this,x,y,z,o);
|
GetMap()->CreatureRelocation(this, x, y, z, o);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
@ -228,14 +228,14 @@ bool Creature::InitEntry(uint32 Entry, uint32 team, const CreatureData *data )
|
||||||
uint32 display_id = sObjectMgr.ChooseDisplayId(team, GetCreatureInfo(), data);
|
uint32 display_id = sObjectMgr.ChooseDisplayId(team, GetCreatureInfo(), data);
|
||||||
if (!display_id) // Cancel load if no display id
|
if (!display_id) // Cancel load if no display id
|
||||||
{
|
{
|
||||||
sLog.outErrorDb("Creature (Entry: %u) has model %u not found in table `creature_model_info`, can't load. ", Entry, display_id);
|
sLog.outErrorDb("Creature (Entry: %u) has no model defined in table `creature_template`, can't load.", Entry);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
CreatureModelInfo const *minfo = sObjectMgr.GetCreatureModelRandomGender(display_id);
|
CreatureModelInfo const *minfo = sObjectMgr.GetCreatureModelRandomGender(display_id);
|
||||||
if (!minfo) // Cancel load if no model defined
|
if (!minfo) // Cancel load if no model defined
|
||||||
{
|
{
|
||||||
sLog.outErrorDb("Creature (Entry: %u) has no model defined in table `creature_template`, can't load. ",Entry);
|
sLog.outErrorDb("Creature (Entry: %u) has no model info defined in table `creature_model_info`, can't load.", Entry);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -257,20 +257,20 @@ bool Creature::InitEntry(uint32 Entry, uint32 team, const CreatureData *data )
|
||||||
|
|
||||||
SetName(normalInfo->Name); // at normal entry always
|
SetName(normalInfo->Name); // at normal entry always
|
||||||
|
|
||||||
SetFloatValue(UNIT_FIELD_BOUNDINGRADIUS,minfo->bounding_radius);
|
SetFloatValue(UNIT_FIELD_BOUNDINGRADIUS, minfo->bounding_radius);
|
||||||
SetFloatValue(UNIT_FIELD_COMBATREACH,minfo->combat_reach );
|
SetFloatValue(UNIT_FIELD_COMBATREACH, minfo->combat_reach);
|
||||||
|
|
||||||
SetFloatValue(UNIT_MOD_CAST_SPEED, 1.0f);
|
SetFloatValue(UNIT_MOD_CAST_SPEED, 1.0f);
|
||||||
|
|
||||||
SetSpeedRate(MOVE_WALK, cinfo->speed );
|
SetSpeedRate(MOVE_WALK, cinfo->speed);
|
||||||
SetSpeedRate(MOVE_RUN, cinfo->speed );
|
SetSpeedRate(MOVE_RUN, cinfo->speed);
|
||||||
SetSpeedRate(MOVE_SWIM, cinfo->speed );
|
SetSpeedRate(MOVE_SWIM, cinfo->speed);
|
||||||
|
|
||||||
SetFloatValue(OBJECT_FIELD_SCALE_X, cinfo->scale);
|
SetFloatValue(OBJECT_FIELD_SCALE_X, cinfo->scale);
|
||||||
|
|
||||||
// checked at loading
|
// checked at loading
|
||||||
m_defaultMovementType = MovementGeneratorType(cinfo->MovementType);
|
m_defaultMovementType = MovementGeneratorType(cinfo->MovementType);
|
||||||
if(!m_respawnradius && m_defaultMovementType==RANDOM_MOTION_TYPE)
|
if(!m_respawnradius && m_defaultMovementType == RANDOM_MOTION_TYPE)
|
||||||
m_defaultMovementType = IDLE_MOTION_TYPE;
|
m_defaultMovementType = IDLE_MOTION_TYPE;
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
|
|
@ -278,7 +278,7 @@ bool Creature::InitEntry(uint32 Entry, uint32 team, const CreatureData *data )
|
||||||
|
|
||||||
bool Creature::UpdateEntry(uint32 Entry, uint32 team, const CreatureData *data )
|
bool Creature::UpdateEntry(uint32 Entry, uint32 team, const CreatureData *data )
|
||||||
{
|
{
|
||||||
if(!InitEntry(Entry,team,data))
|
if(!InitEntry(Entry, team, data))
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
m_regenHealth = GetCreatureInfo()->RegenHealth;
|
m_regenHealth = GetCreatureInfo()->RegenHealth;
|
||||||
|
|
@ -321,7 +321,7 @@ bool Creature::UpdateEntry(uint32 Entry, uint32 team, const CreatureData *data )
|
||||||
SetPvP(false);
|
SetPvP(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
for(int i=0; i < CREATURE_MAX_SPELLS; ++i)
|
for(int i = 0; i < CREATURE_MAX_SPELLS; ++i)
|
||||||
m_spells[i] = GetCreatureInfo()->spells[i];
|
m_spells[i] = GetCreatureInfo()->spells[i];
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
|
|
@ -493,11 +493,11 @@ void Creature::RegenerateMana()
|
||||||
float ManaIncreaseRate = sWorld.getRate(RATE_POWER_MANA);
|
float ManaIncreaseRate = sWorld.getRate(RATE_POWER_MANA);
|
||||||
float Spirit = GetStat(STAT_SPIRIT);
|
float Spirit = GetStat(STAT_SPIRIT);
|
||||||
|
|
||||||
addvalue = uint32((Spirit/5.0f + 17.0f) * ManaIncreaseRate);
|
addvalue = uint32((Spirit / 5.0f + 17.0f) * ManaIncreaseRate);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
addvalue = maxValue/3;
|
addvalue = maxValue / 3;
|
||||||
|
|
||||||
ModifyPower(POWER_MANA, addvalue);
|
ModifyPower(POWER_MANA, addvalue);
|
||||||
}
|
}
|
||||||
|
|
@ -638,7 +638,7 @@ bool Creature::isCanTrainingOf(Player* pPlayer, bool msg) const
|
||||||
switch(GetCreatureInfo()->trainer_type)
|
switch(GetCreatureInfo()->trainer_type)
|
||||||
{
|
{
|
||||||
case TRAINER_TYPE_CLASS:
|
case TRAINER_TYPE_CLASS:
|
||||||
if(pPlayer->getClass()!=GetCreatureInfo()->trainer_class)
|
if(pPlayer->getClass() != GetCreatureInfo()->trainer_class)
|
||||||
{
|
{
|
||||||
if(msg)
|
if(msg)
|
||||||
{
|
{
|
||||||
|
|
@ -660,10 +660,10 @@ bool Creature::isCanTrainingOf(Player* pPlayer, bool msg) const
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case TRAINER_TYPE_PETS:
|
case TRAINER_TYPE_PETS:
|
||||||
if(pPlayer->getClass()!=CLASS_HUNTER)
|
if(pPlayer->getClass() != CLASS_HUNTER)
|
||||||
{
|
{
|
||||||
pPlayer->PlayerTalkClass->ClearMenus();
|
pPlayer->PlayerTalkClass->ClearMenus();
|
||||||
pPlayer->PlayerTalkClass->SendGossipMenu(3620,GetGUID());
|
pPlayer->PlayerTalkClass->SendGossipMenu(3620, GetGUID());
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
@ -696,7 +696,7 @@ bool Creature::isCanTrainingOf(Player* pPlayer, bool msg) const
|
||||||
if(msg)
|
if(msg)
|
||||||
{
|
{
|
||||||
pPlayer->PlayerTalkClass->ClearMenus();
|
pPlayer->PlayerTalkClass->ClearMenus();
|
||||||
pPlayer->PlayerTalkClass->SendGossipMenu(11031,GetGUID());
|
pPlayer->PlayerTalkClass->SendGossipMenu(11031, GetGUID());
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
@ -724,9 +724,9 @@ bool Creature::isCanInteractWithBattleMaster(Player* pPlayer, bool msg) const
|
||||||
pPlayer->PlayerTalkClass->ClearMenus();
|
pPlayer->PlayerTalkClass->ClearMenus();
|
||||||
switch(bgTypeId)
|
switch(bgTypeId)
|
||||||
{
|
{
|
||||||
case BATTLEGROUND_AV: pPlayer->PlayerTalkClass->SendGossipMenu(7616,GetGUID()); break;
|
case BATTLEGROUND_AV: pPlayer->PlayerTalkClass->SendGossipMenu(7616, GetGUID()); break;
|
||||||
case BATTLEGROUND_WS: pPlayer->PlayerTalkClass->SendGossipMenu(7599,GetGUID()); break;
|
case BATTLEGROUND_WS: pPlayer->PlayerTalkClass->SendGossipMenu(7599, GetGUID()); break;
|
||||||
case BATTLEGROUND_AB: pPlayer->PlayerTalkClass->SendGossipMenu(7642,GetGUID()); break;
|
case BATTLEGROUND_AB: pPlayer->PlayerTalkClass->SendGossipMenu(7642, GetGUID()); break;
|
||||||
case BATTLEGROUND_EY:
|
case BATTLEGROUND_EY:
|
||||||
case BATTLEGROUND_NA:
|
case BATTLEGROUND_NA:
|
||||||
case BATTLEGROUND_BE:
|
case BATTLEGROUND_BE:
|
||||||
|
|
@ -734,7 +734,7 @@ bool Creature::isCanInteractWithBattleMaster(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,GetGUID()); break;
|
case BATTLEGROUND_RV: pPlayer->PlayerTalkClass->SendGossipMenu(10024, GetGUID()); break;
|
||||||
default: break;
|
default: break;
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
|
|
@ -774,7 +774,8 @@ void Creature::AI_SendMoveToPacket(float x, float y, float z, uint32 time, Monst
|
||||||
|
|
||||||
Player *Creature::GetLootRecipient() const
|
Player *Creature::GetLootRecipient() const
|
||||||
{
|
{
|
||||||
if (!m_lootRecipient) return NULL;
|
if (!m_lootRecipient)
|
||||||
|
return NULL;
|
||||||
else return ObjectAccessor::FindPlayer(m_lootRecipient);
|
else return ObjectAccessor::FindPlayer(m_lootRecipient);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -932,7 +933,7 @@ void Creature::SelectLevel(const CreatureInfo *cinfo)
|
||||||
// mana
|
// mana
|
||||||
uint32 minmana = std::min(cinfo->maxmana, cinfo->minmana);
|
uint32 minmana = std::min(cinfo->maxmana, cinfo->minmana);
|
||||||
uint32 maxmana = std::max(cinfo->maxmana, cinfo->minmana);
|
uint32 maxmana = std::max(cinfo->maxmana, cinfo->minmana);
|
||||||
uint32 mana = minmana + uint32(rellevel*(maxmana - minmana));
|
uint32 mana = minmana + uint32(rellevel * (maxmana - minmana));
|
||||||
|
|
||||||
SetCreateMana(mana);
|
SetCreateMana(mana);
|
||||||
SetMaxPower(POWER_MANA, mana); //MAX Mana
|
SetMaxPower(POWER_MANA, mana); //MAX Mana
|
||||||
|
|
@ -1047,21 +1048,21 @@ bool Creature::LoadFromDB(uint32 guid, Map *map)
|
||||||
// FIXME: until creature guids is global and for instances used dynamic generated guids
|
// FIXME: until creature guids is global and for instances used dynamic generated guids
|
||||||
// in instance possible load creature duplicates with same DB guid but different in game guids
|
// in instance possible load creature duplicates with same DB guid but different in game guids
|
||||||
// This will be until implementing per-map creature guids
|
// This will be until implementing per-map creature guids
|
||||||
if (map->GetCreature(MAKE_NEW_GUID(guid,data->id,HIGHGUID_UNIT)))
|
if (map->GetCreature(MAKE_NEW_GUID(guid, data->id, HIGHGUID_UNIT)))
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
guid = sObjectMgr.GenerateLowGuid(HIGHGUID_UNIT);
|
guid = sObjectMgr.GenerateLowGuid(HIGHGUID_UNIT);
|
||||||
|
|
||||||
uint16 team = 0;
|
uint16 team = 0;
|
||||||
if(!Create(guid,map,data->phaseMask,data->id,team,data))
|
if(!Create(guid, map, data->phaseMask, data->id, team, data))
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
Relocate(data->posX,data->posY,data->posZ,data->orientation);
|
Relocate(data->posX, data->posY, data->posZ, data->orientation);
|
||||||
|
|
||||||
if(!IsPositionValid())
|
if(!IsPositionValid())
|
||||||
{
|
{
|
||||||
sLog.outError("Creature (guidlow %d, entry %d) not loaded. Suggested coordinates isn't valid (X: %f Y: %f)",GetGUIDLow(),GetEntry(),GetPositionX(),GetPositionY());
|
sLog.outError("Creature (guidlow %d, entry %d) not loaded. Suggested coordinates isn't valid (X: %f Y: %f)", GetGUIDLow(), GetEntry(), GetPositionX(), GetPositionY());
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -1071,15 +1072,15 @@ bool Creature::LoadFromDB(uint32 guid, Map *map)
|
||||||
m_isDeadByDefault = data->is_dead;
|
m_isDeadByDefault = data->is_dead;
|
||||||
m_deathState = m_isDeadByDefault ? DEAD : ALIVE;
|
m_deathState = m_isDeadByDefault ? DEAD : ALIVE;
|
||||||
|
|
||||||
m_respawnTime = sObjectMgr.GetCreatureRespawnTime(m_DBTableGuid,GetInstanceId());
|
m_respawnTime = sObjectMgr.GetCreatureRespawnTime(m_DBTableGuid, GetInstanceId());
|
||||||
if(m_respawnTime > time(NULL)) // not ready to respawn
|
if(m_respawnTime > time(NULL)) // not ready to respawn
|
||||||
{
|
{
|
||||||
m_deathState = DEAD;
|
m_deathState = DEAD;
|
||||||
if(canFly())
|
if(canFly())
|
||||||
{
|
{
|
||||||
float tz = GetMap()->GetHeight(data->posX,data->posY,data->posZ,false);
|
float tz = GetMap()->GetHeight(data->posX, data->posY, data->posZ, false);
|
||||||
if(data->posZ - tz > 0.1)
|
if(data->posZ - tz > 0.1)
|
||||||
Relocate(data->posX,data->posY,tz);
|
Relocate(data->posX, data->posY, tz);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if(m_respawnTime) // respawn time set but expired
|
else if(m_respawnTime) // respawn time set but expired
|
||||||
|
|
@ -1097,7 +1098,7 @@ bool Creature::LoadFromDB(uint32 guid, Map *map)
|
||||||
}
|
}
|
||||||
|
|
||||||
SetHealth(m_deathState == ALIVE ? curhealth : 0);
|
SetHealth(m_deathState == ALIVE ? curhealth : 0);
|
||||||
SetPower(POWER_MANA,data->curmana);
|
SetPower(POWER_MANA, data->curmana);
|
||||||
|
|
||||||
SetMeleeDamageSchool(SpellSchools(GetCreatureInfo()->dmgschool));
|
SetMeleeDamageSchool(SpellSchools(GetCreatureInfo()->dmgschool));
|
||||||
|
|
||||||
|
|
@ -1146,7 +1147,7 @@ bool Creature::hasInvolvedQuest(uint32 quest_id) const
|
||||||
QuestRelations const& qr = sObjectMgr.mCreatureQuestInvolvedRelations;
|
QuestRelations const& qr = sObjectMgr.mCreatureQuestInvolvedRelations;
|
||||||
for(QuestRelations::const_iterator itr = qr.lower_bound(GetEntry()); itr != qr.upper_bound(GetEntry()); ++itr)
|
for(QuestRelations::const_iterator itr = qr.lower_bound(GetEntry()); itr != qr.upper_bound(GetEntry()); ++itr)
|
||||||
{
|
{
|
||||||
if(itr->second==quest_id)
|
if(itr->second == quest_id)
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
|
|
@ -1176,7 +1177,7 @@ void Creature::DeleteFromDB()
|
||||||
float Creature::GetAttackDistance(Unit const* pl) const
|
float Creature::GetAttackDistance(Unit const* pl) const
|
||||||
{
|
{
|
||||||
float aggroRate = sWorld.getRate(RATE_CREATURE_AGGRO);
|
float aggroRate = sWorld.getRate(RATE_CREATURE_AGGRO);
|
||||||
if(aggroRate==0)
|
if(aggroRate == 0)
|
||||||
return 0.0f;
|
return 0.0f;
|
||||||
|
|
||||||
uint32 playerlevel = pl->getLevelForTarget(this);
|
uint32 playerlevel = pl->getLevelForTarget(this);
|
||||||
|
|
@ -1213,7 +1214,7 @@ float Creature::GetAttackDistance(Unit const* pl) const
|
||||||
|
|
||||||
void Creature::setDeathState(DeathState s)
|
void Creature::setDeathState(DeathState s)
|
||||||
{
|
{
|
||||||
if ((s == JUST_DIED && !m_isDeadByDefault)||(s == JUST_ALIVED && m_isDeadByDefault))
|
if ((s == JUST_DIED && !m_isDeadByDefault) || (s == JUST_ALIVED && m_isDeadByDefault))
|
||||||
{
|
{
|
||||||
m_deathTimer = m_corpseDelay*IN_MILISECONDS;
|
m_deathTimer = m_corpseDelay*IN_MILISECONDS;
|
||||||
|
|
||||||
|
|
@ -1296,10 +1297,10 @@ void Creature::Respawn()
|
||||||
SetVisibility(currentVis); // restore visibility state
|
SetVisibility(currentVis); // restore visibility state
|
||||||
UpdateObjectVisibility();
|
UpdateObjectVisibility();
|
||||||
|
|
||||||
if(getDeathState()==DEAD)
|
if(getDeathState() == DEAD)
|
||||||
{
|
{
|
||||||
if (m_DBTableGuid)
|
if (m_DBTableGuid)
|
||||||
sObjectMgr.SaveCreatureRespawnTime(m_DBTableGuid,GetInstanceId(),0);
|
sObjectMgr.SaveCreatureRespawnTime(m_DBTableGuid,GetInstanceId(), 0);
|
||||||
m_respawnTime = time(NULL); // respawn at next tick
|
m_respawnTime = time(NULL); // respawn at next tick
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -1359,7 +1360,7 @@ SpellEntry const *Creature::reachWithSpellAttack(Unit *pVictim)
|
||||||
if(!pVictim)
|
if(!pVictim)
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
||||||
for(uint32 i=0; i < CREATURE_MAX_SPELLS; ++i)
|
for(uint32 i = 0; i < CREATURE_MAX_SPELLS; ++i)
|
||||||
{
|
{
|
||||||
if(!m_spells[i])
|
if(!m_spells[i])
|
||||||
continue;
|
continue;
|
||||||
|
|
@ -1371,7 +1372,7 @@ SpellEntry const *Creature::reachWithSpellAttack(Unit *pVictim)
|
||||||
}
|
}
|
||||||
|
|
||||||
bool bcontinue = true;
|
bool bcontinue = true;
|
||||||
for(uint32 j=0;j<3;j++)
|
for(uint32 j = 0; j < 3; ++j)
|
||||||
{
|
{
|
||||||
if( (spellInfo->Effect[j] == SPELL_EFFECT_SCHOOL_DAMAGE ) ||
|
if( (spellInfo->Effect[j] == SPELL_EFFECT_SCHOOL_DAMAGE ) ||
|
||||||
(spellInfo->Effect[j] == SPELL_EFFECT_INSTAKILL) ||
|
(spellInfo->Effect[j] == SPELL_EFFECT_INSTAKILL) ||
|
||||||
|
|
@ -1411,7 +1412,7 @@ SpellEntry const *Creature::reachWithSpellCure(Unit *pVictim)
|
||||||
if(!pVictim)
|
if(!pVictim)
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
||||||
for(uint32 i=0; i < CREATURE_MAX_SPELLS; ++i)
|
for(uint32 i = 0; i < CREATURE_MAX_SPELLS; ++i)
|
||||||
{
|
{
|
||||||
if(!m_spells[i])
|
if(!m_spells[i])
|
||||||
continue;
|
continue;
|
||||||
|
|
@ -1423,7 +1424,7 @@ SpellEntry const *Creature::reachWithSpellCure(Unit *pVictim)
|
||||||
}
|
}
|
||||||
|
|
||||||
bool bcontinue = true;
|
bool bcontinue = true;
|
||||||
for(uint32 j=0;j<3;j++)
|
for(uint32 j = 0; j < 3; ++j)
|
||||||
{
|
{
|
||||||
if( (spellInfo->Effect[j] == SPELL_EFFECT_HEAL ) )
|
if( (spellInfo->Effect[j] == SPELL_EFFECT_HEAL ) )
|
||||||
{
|
{
|
||||||
|
|
@ -1431,7 +1432,8 @@ SpellEntry const *Creature::reachWithSpellCure(Unit *pVictim)
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if(bcontinue) continue;
|
if(bcontinue)
|
||||||
|
continue;
|
||||||
|
|
||||||
if(spellInfo->manaCost > GetPower(POWER_MANA))
|
if(spellInfo->manaCost > GetPower(POWER_MANA))
|
||||||
continue;
|
continue;
|
||||||
|
|
@ -1602,9 +1604,9 @@ void Creature::SaveRespawnTime()
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if(m_respawnTime > time(NULL)) // dead (no corpse)
|
if(m_respawnTime > time(NULL)) // dead (no corpse)
|
||||||
sObjectMgr.SaveCreatureRespawnTime(m_DBTableGuid,GetInstanceId(),m_respawnTime);
|
sObjectMgr.SaveCreatureRespawnTime(m_DBTableGuid, GetInstanceId(), m_respawnTime);
|
||||||
else if(m_deathTimer > 0) // dead (corpse)
|
else if(m_deathTimer > 0) // dead (corpse)
|
||||||
sObjectMgr.SaveCreatureRespawnTime(m_DBTableGuid,GetInstanceId(),time(NULL)+m_respawnDelay+m_deathTimer/IN_MILISECONDS);
|
sObjectMgr.SaveCreatureRespawnTime(m_DBTableGuid, GetInstanceId(), time(NULL) + m_respawnDelay + m_deathTimer / IN_MILISECONDS);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool Creature::IsOutOfThreatArea(Unit* pVictim) const
|
bool Creature::IsOutOfThreatArea(Unit* pVictim) const
|
||||||
|
|
@ -1631,7 +1633,7 @@ bool Creature::IsOutOfThreatArea(Unit* pVictim) const
|
||||||
uint32 ThreatRadius = sWorld.getConfig(CONFIG_THREAT_RADIUS);
|
uint32 ThreatRadius = sWorld.getConfig(CONFIG_THREAT_RADIUS);
|
||||||
|
|
||||||
//Use AttackDistance in distance check if threat radius is lower. This prevents creature bounce in and out of combat every update tick.
|
//Use AttackDistance in distance check if threat radius is lower. This prevents creature bounce in and out of combat every update tick.
|
||||||
return !pVictim->IsWithinDist3d(CombatStartX,CombatStartY,CombatStartZ,
|
return !pVictim->IsWithinDist3d(CombatStartX, CombatStartY, CombatStartZ,
|
||||||
ThreatRadius > AttackDist ? ThreatRadius : AttackDist);
|
ThreatRadius > AttackDist ? ThreatRadius : AttackDist);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -1725,9 +1727,9 @@ void Creature::SendZoneUnderAttackMessage(Player* attacker)
|
||||||
{
|
{
|
||||||
uint32 enemy_team = attacker->GetTeam();
|
uint32 enemy_team = attacker->GetTeam();
|
||||||
|
|
||||||
WorldPacket data(SMSG_ZONE_UNDER_ATTACK,4);
|
WorldPacket data(SMSG_ZONE_UNDER_ATTACK, 4);
|
||||||
data << (uint32)GetZoneId();
|
data << uint32(GetZoneId());
|
||||||
sWorld.SendGlobalMessage(&data,NULL,(enemy_team==ALLIANCE ? HORDE : ALLIANCE));
|
sWorld.SendGlobalMessage(&data, NULL, (enemy_team == ALLIANCE ? HORDE : ALLIANCE));
|
||||||
}
|
}
|
||||||
|
|
||||||
void Creature::SetInCombatWithZone()
|
void Creature::SetInCombatWithZone()
|
||||||
|
|
@ -1804,7 +1806,7 @@ bool Creature::HasCategoryCooldown(uint32 spell_id) const
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
CreatureSpellCooldowns::const_iterator itr = m_CreatureCategoryCooldowns.find(spellInfo->Category);
|
CreatureSpellCooldowns::const_iterator itr = m_CreatureCategoryCooldowns.find(spellInfo->Category);
|
||||||
return(itr != m_CreatureCategoryCooldowns.end() && time_t(itr->second + (spellInfo->CategoryRecoveryTime / IN_MILISECONDS)) > time(NULL));
|
return (itr != m_CreatureCategoryCooldowns.end() && time_t(itr->second + (spellInfo->CategoryRecoveryTime / IN_MILISECONDS)) > time(NULL));
|
||||||
}
|
}
|
||||||
|
|
||||||
bool Creature::HasSpellCooldown(uint32 spell_id) const
|
bool Creature::HasSpellCooldown(uint32 spell_id) const
|
||||||
|
|
@ -1824,7 +1826,7 @@ bool Creature::HasSpell(uint32 spellID) const
|
||||||
for(i = 0; i < CREATURE_MAX_SPELLS; ++i)
|
for(i = 0; i < CREATURE_MAX_SPELLS; ++i)
|
||||||
if(spellID == m_spells[i])
|
if(spellID == m_spells[i])
|
||||||
break;
|
break;
|
||||||
return i < CREATURE_MAX_SPELLS; //broke before end of iteration of known spells
|
return i < CREATURE_MAX_SPELLS; // break before end of iteration of known spells
|
||||||
}
|
}
|
||||||
|
|
||||||
time_t Creature::GetRespawnTimeEx() const
|
time_t Creature::GetRespawnTimeEx() const
|
||||||
|
|
@ -1833,7 +1835,7 @@ time_t Creature::GetRespawnTimeEx() const
|
||||||
if(m_respawnTime > now) // dead (no corpse)
|
if(m_respawnTime > now) // dead (no corpse)
|
||||||
return m_respawnTime;
|
return m_respawnTime;
|
||||||
else if(m_deathTimer > 0) // dead (corpse)
|
else if(m_deathTimer > 0) // dead (corpse)
|
||||||
return now+m_respawnDelay+m_deathTimer/IN_MILISECONDS;
|
return now + m_respawnDelay + m_deathTimer / IN_MILISECONDS;
|
||||||
else
|
else
|
||||||
return now;
|
return now;
|
||||||
}
|
}
|
||||||
|
|
@ -2047,12 +2049,12 @@ void Creature::SendMonsterMoveWithSpeed(float x, float y, float z, uint32 transi
|
||||||
if(GetTypeId()==TYPEID_PLAYER)
|
if(GetTypeId()==TYPEID_PLAYER)
|
||||||
{
|
{
|
||||||
Traveller<Player> traveller(*(Player*)this);
|
Traveller<Player> traveller(*(Player*)this);
|
||||||
transitTime = traveller.GetTotalTrevelTimeTo(x,y,z);
|
transitTime = traveller.GetTotalTrevelTimeTo(x, y, z);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
Traveller<Creature> traveller(*(Creature*)this);
|
Traveller<Creature> traveller(*(Creature*)this);
|
||||||
transitTime = traveller.GetTotalTrevelTimeTo(x,y,z);
|
transitTime = traveller.GetTotalTrevelTimeTo(x, y, z);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
//float orientation = (float)atan2((double)dy, (double)dx);
|
//float orientation = (float)atan2((double)dy, (double)dx);
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue