Various external fixes - part 8 (#121)

* Ported commits from cm

* Various external fixes - part 8
Ported commits from cmangos repositories
  - https://github.com/cmangos/mangos-classic/commit/f4b1f9f
  - https://github.com/cmangos/mangos-classic/commit/dc8b867
Simplify debug log output in Unit.cpp
This commit is contained in:
H0zen 2016-05-09 01:22:18 +03:00 committed by Antz
parent 4f176795ff
commit b15f4711a3
5 changed files with 22 additions and 36 deletions

View File

@ -162,35 +162,21 @@ void Object::BuildCreateUpdateBlockForPlayer(UpdateData* data, Player* target) c
if (target == this) // building packet for yourself
{ updateFlags |= UPDATEFLAG_SELF; }
if (updateFlags & UPDATEFLAG_HAS_POSITION)
if (m_isNewObject)
{
// UPDATETYPE_CREATE_OBJECT2 dynamic objects, corpses...
if (isType(TYPEMASK_DYNAMICOBJECT) || isType(TYPEMASK_CORPSE) || isType(TYPEMASK_PLAYER))
{ updatetype = UPDATETYPE_CREATE_OBJECT2; }
// UPDATETYPE_CREATE_OBJECT2 for pets...
if (target->GetPetGuid() == GetObjectGuid())
{ updatetype = UPDATETYPE_CREATE_OBJECT2; }
// UPDATETYPE_CREATE_OBJECT2 for some gameobject types...
if (isType(TYPEMASK_GAMEOBJECT))
switch (GetObjectGuid().GetHigh())
{
switch (((GameObject*)this)->GetGoType())
{
case GAMEOBJECT_TYPE_TRAP:
case GAMEOBJECT_TYPE_DUEL_ARBITER:
case GAMEOBJECT_TYPE_FLAGSTAND:
case GAMEOBJECT_TYPE_FLAGDROP:
case HighGuid::HIGHGUID_DYNAMICOBJECT:
case HighGuid::HIGHGUID_CORPSE:
case HighGuid::HIGHGUID_PLAYER:
case HighGuid::HIGHGUID_UNIT:
case HighGuid::HIGHGUID_GAMEOBJECT:
updatetype = UPDATETYPE_CREATE_OBJECT2;
break;
case GAMEOBJECT_TYPE_TRANSPORT:
updateFlags |= UPDATEFLAG_TRANSPORT;
break;
default:
break;
}
}
}
// DEBUG_LOG("BuildCreateUpdate: update-type: %u, object-type: %u got updateFlags: %X", updatetype, m_objectTypeId, updateFlags);
@ -200,7 +186,6 @@ void Object::BuildCreateUpdateBlockForPlayer(UpdateData* data, Player* target) c
buf << uint8(m_objectTypeId);
BuildMovementUpdate(&buf, updateFlags);
UpdateMask updateMask;
updateMask.SetCount(m_valuesCount);
_SetCreateBits(&updateMask, target);

View File

@ -404,6 +404,7 @@ class Object
virtual bool HasQuest(uint32 /* quest_id */) const { return false; }
virtual bool HasInvolvedQuest(uint32 /* quest_id */) const { return false; }
void _ReCreate(uint32 entry);
void SetAsNewObject(bool isNew) { m_isNewObject = isNew; }
protected:
Object();
@ -440,6 +441,7 @@ class Object
private:
bool m_inWorld;
bool m_isNewObject;
PackedGuid m_PackGUID;

View File

@ -2177,12 +2177,8 @@ void Unit::AttackerStateUpdate(Unit* pVictim, WeaponAttackType attType, bool ext
ProcDamageAndSpell(damageInfo.target, damageInfo.procAttacker, damageInfo.procVictim, damageInfo.procEx, damageInfo.damage, damageInfo.attackType);
DealMeleeDamage(&damageInfo, true);
if (GetTypeId() == TYPEID_PLAYER)
DEBUG_FILTER_LOG(LOG_FILTER_COMBAT, "AttackerStateUpdate: (Player) %u attacked %u (TypeId: %u) for %u dmg, absorbed %u, blocked %u, resisted %u.",
GetGUIDLow(), pVictim->GetGUIDLow(), pVictim->GetTypeId(), damageInfo.damage, damageInfo.absorb, damageInfo.blocked_amount, damageInfo.resist);
else
DEBUG_FILTER_LOG(LOG_FILTER_COMBAT, "AttackerStateUpdate: (NPC) %u attacked %u (TypeId: %u) for %u dmg, absorbed %u, blocked %u, resisted %u.",
GetGUIDLow(), pVictim->GetGUIDLow(), pVictim->GetTypeId(), damageInfo.damage, damageInfo.absorb, damageInfo.blocked_amount, damageInfo.resist);
DEBUG_FILTER_LOG(LOG_FILTER_COMBAT, "AttackerStateUpdate: %s attacked %s for %u dmg, absorbed %u, blocked %u, resisted %u.",
GetGuidStr().c_str(), pVictim->GetGuidStr().c_str(), damageInfo.damage, damageInfo.absorb, damageInfo.blocked_amount, damageInfo.resist);
// Owner of pet enters combat upon pet attack
if (Unit* owner = GetOwner())

View File

@ -373,7 +373,9 @@ Map::Add(T* obj)
DEBUG_LOG("%s enters grid[%u,%u]", obj->GetGuidStr().c_str(), cell.GridX(), cell.GridY());
obj->GetViewPoint().Event_AddedToWorld(&(*grid)(cell.CellX(), cell.CellY()));
obj->SetAsNewObject(true);
UpdateObjectVisibility(obj, cell, p);
obj->SetAsNewObject(false);
}
void Map::MessageBroadcast(Player const* player, WorldPacket* msg, bool to_self)

View File

@ -2599,8 +2599,11 @@ void Spell::prepare(SpellCastTargets const* targets, Aura* triggeredByAura)
m_caster->RemoveSpellsCausingAura(SPELL_AURA_FEIGN_DEATH);
}
// execute triggered without cast time explicitly in call point
if (!m_timer)
cast(true);
// add non-triggered (with cast time and without)
if (!m_IsTriggeredSpell)
else if (!m_IsTriggeredSpell)
{
// add to cast type slot
m_caster->SetCurrentCastedSpell(this);
@ -2610,9 +2613,7 @@ void Spell::prepare(SpellCastTargets const* targets, Aura* triggeredByAura)
TriggerGlobalCooldown();
}
// execute triggered without cast time explicitly in call point
else if (m_timer == 0)
{ cast(true); }
// else triggered with cast time will execute execute at next tick or later
// without adding to cast type slot
// will not show cast bar but will show effects at casting time etc