Some random cleanup here and there

This commit is contained in:
Spp
2012-03-09 13:42:52 +01:00
parent a1a7a2d7c0
commit f1949b20a6
32 changed files with 219 additions and 224 deletions
-1
View File
@@ -91,4 +91,3 @@ class Corpse : public WorldObject, public GridObject<Corpse>
GridCoord _gridCoord; // gride for corpse position for fast search
};
#endif
+15 -15
View File
@@ -1663,9 +1663,9 @@ bool Creature::IsImmunedToSpellEffect(SpellInfo const* spellInfo, uint32 index)
return Unit::IsImmunedToSpellEffect(spellInfo, index);
}
SpellInfo const* Creature::reachWithSpellAttack(Unit* pVictim)
SpellInfo const* Creature::reachWithSpellAttack(Unit* victim)
{
if (!pVictim)
if (!victim)
return NULL;
for (uint32 i=0; i < CREATURE_MAX_SPELLS; ++i)
@@ -1698,7 +1698,7 @@ SpellInfo const* Creature::reachWithSpellAttack(Unit* pVictim)
continue;
float range = spellInfo->GetMaxRange(false);
float minrange = spellInfo->GetMinRange(false);
float dist = GetDistance(pVictim);
float dist = GetDistance(victim);
if (dist > range || dist < minrange)
continue;
if (spellInfo->PreventionType == SPELL_PREVENTION_TYPE_SILENCE && HasFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_SILENCED))
@@ -1710,9 +1710,9 @@ SpellInfo const* Creature::reachWithSpellAttack(Unit* pVictim)
return NULL;
}
SpellInfo const* Creature::reachWithSpellCure(Unit* pVictim)
SpellInfo const* Creature::reachWithSpellCure(Unit* victim)
{
if (!pVictim)
if (!victim)
return NULL;
for (uint32 i=0; i < CREATURE_MAX_SPELLS; ++i)
@@ -1742,8 +1742,8 @@ SpellInfo const* Creature::reachWithSpellCure(Unit* pVictim)
float range = spellInfo->GetMaxRange(true);
float minrange = spellInfo->GetMinRange(true);
float dist = GetDistance(pVictim);
//if (!isInFront(pVictim, range) && spellInfo->AttributesEx)
float dist = GetDistance(victim);
//if (!isInFront(victim, range) && spellInfo->AttributesEx)
// continue;
if (dist > range || dist < minrange)
continue;
@@ -1980,30 +1980,30 @@ void Creature::SaveRespawnTime()
}
// this should not be called by petAI or
bool Creature::canCreatureAttack(Unit const* pVictim, bool /*force*/) const
bool Creature::canCreatureAttack(Unit const* victim, bool /*force*/) const
{
if (!pVictim->IsInMap(this))
if (!victim->IsInMap(this))
return false;
if (!IsValidAttackTarget(pVictim))
if (!IsValidAttackTarget(victim))
return false;
if (!pVictim->isInAccessiblePlaceFor(this))
if (!victim->isInAccessiblePlaceFor(this))
return false;
if (IsAIEnabled && !AI()->CanAIAttack(pVictim))
if (IsAIEnabled && !AI()->CanAIAttack(victim))
return false;
if (sMapStore.LookupEntry(GetMapId())->IsDungeon())
return true;
//Use AttackDistance in distance check if threat radius is lower. This prevents creature bounce in and out of combat every update tick.
float dist = std::max(GetAttackDistance(pVictim), sWorld->getFloatConfig(CONFIG_THREAT_RADIUS)) + m_CombatDistance;
float dist = std::max(GetAttackDistance(victim), sWorld->getFloatConfig(CONFIG_THREAT_RADIUS)) + m_CombatDistance;
if (Unit* unit = GetCharmerOrOwner())
return pVictim->IsWithinDist(unit, dist);
return victim->IsWithinDist(unit, dist);
else
return pVictim->IsInDist(&m_homePosition, dist);
return victim->IsInDist(&m_homePosition, dist);
}
CreatureAddon const* Creature::GetCreatureAddon() const
@@ -107,4 +107,3 @@ private:
TempSummon& m_owner;
};
#endif
@@ -116,7 +116,7 @@ bool DynamicObject::CreateDynamicObject(uint32 guidlow, Unit* caster, uint32 spe
void DynamicObject::Update(uint32 p_time)
{
// caster has to be always avalible and in the same map
// caster has to be always available and in the same map
ASSERT(_caster);
ASSERT(_caster->GetMap() == GetMap());
@@ -127,7 +127,7 @@ void DynamicObject::Update(uint32 p_time)
if (!_aura->IsRemoved())
_aura->UpdateOwner(p_time, this);
// m_aura may be set to null in Aura::UpdateOwner call
// _aura may be set to null in Aura::UpdateOwner call
if (_aura && (_aura->IsRemoved() || _aura->IsExpired()))
expired = true;
}
@@ -223,7 +223,6 @@ bool GameObject::Create(uint32 guidlow, uint32 name_id, Map* map, uint32 phaseMa
SetGoArtKit(0); // unknown what this is
SetByteValue(GAMEOBJECT_BYTES_1, 2, artKit);
switch (goinfo->type)
{
case GAMEOBJECT_TYPE_DESTRUCTIBLE_BUILDING:
@@ -252,7 +251,6 @@ bool GameObject::Create(uint32 guidlow, uint32 name_id, Map* map, uint32 phaseMa
m_invisibility.AddFlag(INVISIBILITY_TRAP);
m_invisibility.AddValue(INVISIBILITY_TRAP, 300);
}
break;
default:
SetGoAnimProgress(animprogress);
@@ -402,7 +402,6 @@ struct GameObjectTemplate
} raw;
};
std::string AIName;
uint32 ScriptId;
+15 -15
View File
@@ -13295,8 +13295,8 @@ void Player::AddItemToBuyBackSlot(Item* pItem)
uint32 eslot = slot - BUYBACK_SLOT_START;
SetUInt64Value(PLAYER_FIELD_VENDORBUYBACK_SLOT_1 + (eslot * 2), pItem->GetGUID());
if (ItemTemplate const* pProto = pItem->GetTemplate())
SetUInt32Value(PLAYER_FIELD_BUYBACK_PRICE_1 + eslot, pProto->SellPrice * pItem->GetCount());
if (ItemTemplate const* proto = pItem->GetTemplate())
SetUInt32Value(PLAYER_FIELD_BUYBACK_PRICE_1 + eslot, proto->SellPrice * pItem->GetCount());
else
SetUInt32Value(PLAYER_FIELD_BUYBACK_PRICE_1 + eslot, 0);
SetUInt32Value(PLAYER_FIELD_BUYBACK_TIMESTAMP_1 + eslot, (uint32)etime);
@@ -14374,7 +14374,7 @@ void Player::OnGossipSelect(WorldObject* source, uint32 gossipListId, uint32 men
return;
}
GetSession()->SendBattlegGroundList(guid, bgTypeId);
GetSession()->SendBattleGroundList(guid, bgTypeId);
break;
}
}
@@ -14429,15 +14429,15 @@ uint32 Player::GetDefaultGossipMenuForSource(WorldObject* source)
void Player::PrepareQuestMenu(uint64 guid)
{
QuestRelationBounds pObjectQR;
QuestRelationBounds pObjectQIR;
QuestRelationBounds objectQR;
QuestRelationBounds objectQIR;
// pets also can have quests
Creature* creature = ObjectAccessor::GetCreatureOrPetOrVehicle(*this, guid);
if (creature)
{
pObjectQR = sObjectMgr->GetCreatureQuestRelationBounds(creature->GetEntry());
pObjectQIR = sObjectMgr->GetCreatureQuestInvolvedRelationBounds(creature->GetEntry());
objectQR = sObjectMgr->GetCreatureQuestRelationBounds(creature->GetEntry());
objectQIR = sObjectMgr->GetCreatureQuestInvolvedRelationBounds(creature->GetEntry());
}
else
{
@@ -14448,8 +14448,8 @@ void Player::PrepareQuestMenu(uint64 guid)
GameObject* pGameObject = _map->GetGameObject(guid);
if (pGameObject)
{
pObjectQR = sObjectMgr->GetGOQuestRelationBounds(pGameObject->GetEntry());
pObjectQIR = sObjectMgr->GetGOQuestInvolvedRelationBounds(pGameObject->GetEntry());
objectQR = sObjectMgr->GetGOQuestRelationBounds(pGameObject->GetEntry());
objectQIR = sObjectMgr->GetGOQuestInvolvedRelationBounds(pGameObject->GetEntry());
}
else
return;
@@ -14458,7 +14458,7 @@ void Player::PrepareQuestMenu(uint64 guid)
QuestMenu &qm = PlayerTalkClass->GetQuestMenu();
qm.ClearMenu();
for (QuestRelations::const_iterator i = pObjectQIR.first; i != pObjectQIR.second; ++i)
for (QuestRelations::const_iterator i = objectQIR.first; i != objectQIR.second; ++i)
{
uint32 quest_id = i->second;
QuestStatus status = GetQuestStatus(quest_id);
@@ -14470,7 +14470,7 @@ void Player::PrepareQuestMenu(uint64 guid)
// qm.AddMenuItem(quest_id, 2);
}
for (QuestRelations::const_iterator i = pObjectQR.first; i != pObjectQR.second; ++i)
for (QuestRelations::const_iterator i = objectQR.first; i != objectQR.second; ++i)
{
uint32 quest_id = i->second;
Quest const* quest = sObjectMgr->GetQuestTemplate(quest_id);
@@ -14590,11 +14590,11 @@ bool Player::IsActiveQuest(uint32 quest_id) const
Quest const* Player::GetNextQuest(uint64 guid, Quest const* quest)
{
QuestRelationBounds pObjectQR;
QuestRelationBounds objectQR;
Creature* creature = ObjectAccessor::GetCreatureOrPetOrVehicle(*this, guid);
if (creature)
pObjectQR = sObjectMgr->GetCreatureQuestRelationBounds(creature->GetEntry());
objectQR = sObjectMgr->GetCreatureQuestRelationBounds(creature->GetEntry());
else
{
//we should obtain map pointer from GetMap() in 99% of cases. Special case
@@ -14603,13 +14603,13 @@ Quest const* Player::GetNextQuest(uint64 guid, Quest const* quest)
ASSERT(_map);
GameObject* pGameObject = _map->GetGameObject(guid);
if (pGameObject)
pObjectQR = sObjectMgr->GetGOQuestRelationBounds(pGameObject->GetEntry());
objectQR = sObjectMgr->GetGOQuestRelationBounds(pGameObject->GetEntry());
else
return NULL;
}
uint32 nextQuestID = quest->GetNextQuestInChain();
for (QuestRelations::const_iterator itr = pObjectQR.first; itr != pObjectQR.second; ++itr)
for (QuestRelations::const_iterator itr = objectQR.first; itr != objectQR.second; ++itr)
{
if (itr->second == nextQuestID)
return sObjectMgr->GetQuestTemplate(nextQuestID);
+2 -2
View File
@@ -1561,7 +1561,7 @@ class Player : public Unit, public GridObject<Player>
}
RewardedQuestSet const& getRewardedQuests() const { return m_RewardedQuests; }
QuestStatusMap& getQuestStatusMap() { return m_QuestStatus; };
QuestStatusMap& getQuestStatusMap() { return m_QuestStatus; }
size_t GetRewardedQuestCount() const { return m_RewardedQuests.size(); }
bool IsQuestRewarded(uint32 quest_id) const
@@ -1574,7 +1574,7 @@ class Player : public Unit, public GridObject<Player>
Player* GetSelectedPlayer() const;
void SetSelection(uint64 guid) { m_curSelection = guid; SetUInt64Value(UNIT_FIELD_TARGET, guid); }
uint8 GetComboPoints() { return m_comboPoints; }
uint8 GetComboPoints() const { return m_comboPoints; }
uint64 GetComboTarget() const { return m_comboTarget; }
void AddComboPoints(Unit* target, int8 count, Spell* spell = NULL);
-1
View File
@@ -60,4 +60,3 @@ class Totem : public Minion
uint32 m_duration;
};
#endif
@@ -60,10 +60,10 @@ void WorldSession::HandleBattlemasterHelloOpcode(WorldPacket & recv_data)
return;
}
SendBattlegGroundList(guid, bgTypeId);
SendBattleGroundList(guid, bgTypeId);
}
void WorldSession::SendBattlegGroundList(uint64 guid, BattlegroundTypeId bgTypeId)
void WorldSession::SendBattleGroundList(uint64 guid, BattlegroundTypeId bgTypeId)
{
WorldPacket data;
sBattlegroundMgr->BuildBattlegroundListPacket(&data, guid, _player, bgTypeId, 0);
+96 -101
View File
@@ -53,7 +53,7 @@ void WorldSession::HandleQuestgiverStatusQueryOpcode(WorldPacket & recv_data)
{
sLog->outDebug(LOG_FILTER_NETWORKIO, "WORLD: Received CMSG_QUESTGIVER_STATUS_QUERY for npc, guid = %u", uint32(GUID_LOPART(guid)));
Creature* cr_questgiver=questgiver->ToCreature();
if (!cr_questgiver->IsHostileTo(_player)) // not show quest status to enemies
if (!cr_questgiver->IsHostileTo(_player)) // do not show quest status to enemies
{
questStatus = sScriptMgr->GetDialogStatus(_player, cr_questgiver);
if (questStatus > 6)
@@ -112,17 +112,17 @@ void WorldSession::HandleQuestgiverHelloOpcode(WorldPacket & recv_data)
void WorldSession::HandleQuestgiverAcceptQuestOpcode(WorldPacket & recv_data)
{
uint64 guid;
uint32 quest;
uint32 questId;
uint32 unk1;
recv_data >> guid >> quest >> unk1;
recv_data >> guid >> questId >> unk1;
sLog->outDebug(LOG_FILTER_NETWORKIO, "WORLD: Received CMSG_QUESTGIVER_ACCEPT_QUEST npc = %u, quest = %u, unk1 = %u", uint32(GUID_LOPART(guid)), quest, unk1);
sLog->outDebug(LOG_FILTER_NETWORKIO, "WORLD: Received CMSG_QUESTGIVER_ACCEPT_QUEST npc = %u, quest = %u, unk1 = %u", uint32(GUID_LOPART(guid)), questId, unk1);
Object* pObject = ObjectAccessor::GetObjectByTypeMask(*_player, guid, TYPEMASK_UNIT|TYPEMASK_GAMEOBJECT|TYPEMASK_ITEM|TYPEMASK_PLAYER);
Object* object = ObjectAccessor::GetObjectByTypeMask(*_player, guid, TYPEMASK_UNIT|TYPEMASK_GAMEOBJECT|TYPEMASK_ITEM|TYPEMASK_PLAYER);
// no or incorrect quest giver
if (!pObject || (pObject->GetTypeId() != TYPEID_PLAYER && !pObject->hasQuest(quest)) ||
(pObject->GetTypeId() == TYPEID_PLAYER && !pObject->ToPlayer()->CanShareQuest(quest)))
if (!object || (object->GetTypeId() != TYPEID_PLAYER && !object->hasQuest(questId)) ||
(object->GetTypeId() == TYPEID_PLAYER && !object->ToPlayer()->CanShareQuest(questId)))
{
_player->PlayerTalkClass->SendCloseGossip();
_player->SetDivider(0);
@@ -130,14 +130,13 @@ void WorldSession::HandleQuestgiverAcceptQuestOpcode(WorldPacket & recv_data)
}
// some kind of WPE protection
if (!_player->CanInteractWithQuestGiver(pObject))
if (!_player->CanInteractWithQuestGiver(object))
return;
Quest const* qInfo = sObjectMgr->GetQuestTemplate(quest);
if (qInfo)
if (Quest const* quest = sObjectMgr->GetQuestTemplate(questId))
{
// prevent cheating
if (!GetPlayer()->CanTakeQuest(qInfo, true))
if (!GetPlayer()->CanTakeQuest(quest, true))
{
_player->PlayerTalkClass->SendCloseGossip();
_player->SetDivider(0);
@@ -154,11 +153,11 @@ void WorldSession::HandleQuestgiverAcceptQuestOpcode(WorldPacket & recv_data)
}
}
if (_player->CanAddQuest(qInfo, true))
if (_player->CanAddQuest(quest, true))
{
_player->AddQuest(qInfo, pObject);
_player->AddQuest(quest, object);
if (qInfo->HasFlag(QUEST_FLAGS_PARTY_ACCEPT))
if (quest->HasFlag(QUEST_FLAGS_PARTY_ACCEPT))
{
if (Group* group = _player->GetGroup())
{
@@ -169,38 +168,38 @@ void WorldSession::HandleQuestgiverAcceptQuestOpcode(WorldPacket & recv_data)
if (!player || player == _player) // not self
continue;
if (player->CanTakeQuest(qInfo, true))
if (player->CanTakeQuest(quest, true))
{
player->SetDivider(_player->GetGUID());
//need confirmation that any gossip window will close
player->PlayerTalkClass->SendCloseGossip();
_player->SendQuestConfirmAccept(qInfo, player);
_player->SendQuestConfirmAccept(quest, player);
}
}
}
}
if (_player->CanCompleteQuest(quest))
_player->CompleteQuest(quest);
if (_player->CanCompleteQuest(questId))
_player->CompleteQuest(questId);
switch (pObject->GetTypeId())
switch (object->GetTypeId())
{
case TYPEID_UNIT:
sScriptMgr->OnQuestAccept(_player, (pObject->ToCreature()), qInfo);
(pObject->ToCreature())->AI()->sQuestAccept(_player, qInfo);
sScriptMgr->OnQuestAccept(_player, (object->ToCreature()), quest);
(object->ToCreature())->AI()->sQuestAccept(_player, quest);
break;
case TYPEID_ITEM:
case TYPEID_CONTAINER:
{
sScriptMgr->OnQuestAccept(_player, ((Item*)pObject), qInfo);
sScriptMgr->OnQuestAccept(_player, ((Item*)object), quest);
// destroy not required for quest finish quest starting item
bool destroyItem = true;
for (int i = 0; i < QUEST_ITEM_OBJECTIVES_COUNT; ++i)
{
if ((qInfo->RequiredItemId[i] == ((Item*)pObject)->GetEntry()) && (((Item*)pObject)->GetTemplate()->MaxCount > 0))
if ((quest->RequiredItemId[i] == ((Item*)object)->GetEntry()) && (((Item*)object)->GetTemplate()->MaxCount > 0))
{
destroyItem = false;
break;
@@ -208,21 +207,21 @@ void WorldSession::HandleQuestgiverAcceptQuestOpcode(WorldPacket & recv_data)
}
if (destroyItem)
_player->DestroyItem(((Item*)pObject)->GetBagSlot(), ((Item*)pObject)->GetSlot(), true);
_player->DestroyItem(((Item*)object)->GetBagSlot(), ((Item*)object)->GetSlot(), true);
break;
}
case TYPEID_GAMEOBJECT:
sScriptMgr->OnQuestAccept(_player, ((GameObject*)pObject), qInfo);
(pObject->ToGameObject())->AI()->QuestAccept(_player, qInfo);
sScriptMgr->OnQuestAccept(_player, ((GameObject*)object), quest);
(object->ToGameObject())->AI()->QuestAccept(_player, quest);
break;
default:
break;
}
_player->PlayerTalkClass->SendCloseGossip();
if (qInfo->GetSrcSpell() > 0)
_player->CastSpell(_player, qInfo->GetSrcSpell(), true);
if (quest->GetSrcSpell() > 0)
_player->CastSpell(_player, quest->GetSrcSpell(), true);
return;
}
@@ -247,8 +246,7 @@ void WorldSession::HandleQuestgiverQueryQuestOpcode(WorldPacket & recv_data)
return;
}
Quest const* quest = sObjectMgr->GetQuestTemplate(questId);
if (quest)
if (Quest const* quest = sObjectMgr->GetQuestTemplate(questId))
{
// not sure here what should happen to quests with QUEST_FLAGS_AUTOCOMPLETE
// if this breaks them, add && object->GetTypeId() == TYPEID_ITEM to this check
@@ -275,15 +273,12 @@ void WorldSession::HandleQuestQueryOpcode(WorldPacket & recv_data)
if (!_player)
return;
uint32 quest;
recv_data >> quest;
sLog->outDebug(LOG_FILTER_NETWORKIO, "WORLD: Received CMSG_QUEST_QUERY quest = %u", quest);
uint32 questId;
recv_data >> questId;
sLog->outDebug(LOG_FILTER_NETWORKIO, "WORLD: Received CMSG_QUEST_QUERY quest = %u", questId);
Quest const* pQuest = sObjectMgr->GetQuestTemplate(quest);
if (pQuest)
{
_player->PlayerTalkClass->SendQuestQueryResponse(pQuest);
}
if (Quest const* quest = sObjectMgr->GetQuestTemplate(questId))
_player->PlayerTalkClass->SendQuestQueryResponse(quest);
}
void WorldSession::HandleQuestgiverChooseRewardOpcode(WorldPacket & recv_data)
@@ -372,28 +367,28 @@ void WorldSession::HandleQuestgiverChooseRewardOpcode(WorldPacket & recv_data)
void WorldSession::HandleQuestgiverRequestRewardOpcode(WorldPacket & recv_data)
{
uint32 quest;
uint32 questId;
uint64 guid;
recv_data >> guid >> quest;
recv_data >> guid >> questId;
sLog->outDebug(LOG_FILTER_NETWORKIO, "WORLD: Received CMSG_QUESTGIVER_REQUEST_REWARD npc = %u, quest = %u", uint32(GUID_LOPART(guid)), quest);
sLog->outDebug(LOG_FILTER_NETWORKIO, "WORLD: Received CMSG_QUESTGIVER_REQUEST_REWARD npc = %u, quest = %u", uint32(GUID_LOPART(guid)), questId);
Object* pObject = ObjectAccessor::GetObjectByTypeMask(*_player, guid, TYPEMASK_UNIT|TYPEMASK_GAMEOBJECT);
if (!pObject || !pObject->hasInvolvedQuest(quest))
Object* object = ObjectAccessor::GetObjectByTypeMask(*_player, guid, TYPEMASK_UNIT|TYPEMASK_GAMEOBJECT);
if (!object || !object->hasInvolvedQuest(questId))
return;
// some kind of WPE protection
if (!_player->CanInteractWithQuestGiver(pObject))
if (!_player->CanInteractWithQuestGiver(object))
return;
if (_player->CanCompleteQuest(quest))
_player->CompleteQuest(quest);
if (_player->CanCompleteQuest(questId))
_player->CompleteQuest(questId);
if (_player->GetQuestStatus(quest) != QUEST_STATUS_COMPLETE)
if (_player->GetQuestStatus(questId) != QUEST_STATUS_COMPLETE)
return;
if (Quest const* pQuest = sObjectMgr->GetQuestTemplate(quest))
_player->PlayerTalkClass->SendQuestGiverOfferReward(pQuest, guid, true);
if (Quest const* quest = sObjectMgr->GetQuestTemplate(questId))
_player->PlayerTalkClass->SendQuestGiverOfferReward(quest, guid, true);
}
void WorldSession::HandleQuestgiverCancel(WorldPacket& /*recv_data*/)
@@ -425,22 +420,22 @@ void WorldSession::HandleQuestLogRemoveQuest(WorldPacket& recv_data)
if (slot < MAX_QUEST_LOG_SIZE)
{
if (uint32 quest = _player->GetQuestSlotQuestId(slot))
if (uint32 questId = _player->GetQuestSlotQuestId(slot))
{
if (!_player->TakeQuestSourceItem(quest, true))
if (!_player->TakeQuestSourceItem(questId, true))
return; // can't un-equip some items, reject quest cancel
if (const Quest *pQuest = sObjectMgr->GetQuestTemplate(quest))
if (const Quest *quest = sObjectMgr->GetQuestTemplate(questId))
{
if (pQuest->HasFlag(QUEST_TRINITY_FLAGS_TIMED))
_player->RemoveTimedQuest(quest);
if (quest->HasFlag(QUEST_TRINITY_FLAGS_TIMED))
_player->RemoveTimedQuest(questId);
}
_player->TakeQuestSourceItem(quest, true); // remove quest src item from player
_player->RemoveActiveQuest(quest);
_player->GetAchievementMgr().RemoveTimedAchievement(ACHIEVEMENT_TIMED_TYPE_QUEST, quest);
_player->TakeQuestSourceItem(questId, true); // remove quest src item from player
_player->RemoveActiveQuest(questId);
_player->GetAchievementMgr().RemoveTimedAchievement(ACHIEVEMENT_TIMED_TYPE_QUEST, questId);
sLog->outDetail("Player %u abandoned quest %u", _player->GetGUIDLow(), quest);
sLog->outDetail("Player %u abandoned quest %u", _player->GetGUIDLow(), questId);
}
_player->SetQuestSlot(slot, 0);
@@ -451,14 +446,14 @@ void WorldSession::HandleQuestLogRemoveQuest(WorldPacket& recv_data)
void WorldSession::HandleQuestConfirmAccept(WorldPacket& recv_data)
{
uint32 quest;
recv_data >> quest;
uint32 questId;
recv_data >> questId;
sLog->outDebug(LOG_FILTER_NETWORKIO, "WORLD: Received CMSG_QUEST_CONFIRM_ACCEPT quest = %u", quest);
sLog->outDebug(LOG_FILTER_NETWORKIO, "WORLD: Received CMSG_QUEST_CONFIRM_ACCEPT quest = %u", questId);
if (const Quest* pQuest = sObjectMgr->GetQuestTemplate(quest))
if (const Quest* quest = sObjectMgr->GetQuestTemplate(questId))
{
if (!pQuest->HasFlag(QUEST_FLAGS_PARTY_ACCEPT))
if (!quest->HasFlag(QUEST_FLAGS_PARTY_ACCEPT))
return;
Player* pOriginalPlayer = ObjectAccessor::FindPlayer(_player->GetDivider());
@@ -466,7 +461,7 @@ void WorldSession::HandleQuestConfirmAccept(WorldPacket& recv_data)
if (!pOriginalPlayer)
return;
if (pQuest->IsRaidQuest())
if (quest->IsRaidQuest())
{
if (!_player->IsInSameRaidWith(pOriginalPlayer))
return;
@@ -477,8 +472,8 @@ void WorldSession::HandleQuestConfirmAccept(WorldPacket& recv_data)
return;
}
if (_player->CanAddQuest(pQuest, true))
_player->AddQuest(pQuest, NULL); // NULL, this prevent DB script from duplicate running
if (_player->CanAddQuest(quest, true))
_player->AddQuest(quest, NULL); // NULL, this prevent DB script from duplicate running
_player->SetDivider(0);
}
@@ -486,48 +481,48 @@ void WorldSession::HandleQuestConfirmAccept(WorldPacket& recv_data)
void WorldSession::HandleQuestgiverCompleteQuest(WorldPacket& recv_data)
{
uint32 quest;
uint32 questId;
uint64 guid;
recv_data >> guid >> quest;
sLog->outDebug(LOG_FILTER_NETWORKIO, "WORLD: Received CMSG_QUESTGIVER_COMPLETE_QUEST npc = %u, quest = %u", uint32(GUID_LOPART(guid)), quest);
recv_data >> guid >> questId;
Object* pObject = ObjectAccessor::GetObjectByTypeMask(*_player, guid, TYPEMASK_UNIT|TYPEMASK_GAMEOBJECT);
if (!pObject || !pObject->hasInvolvedQuest(quest))
sLog->outDebug(LOG_FILTER_NETWORKIO, "WORLD: Received CMSG_QUESTGIVER_COMPLETE_QUEST npc = %u, quest = %u", uint32(GUID_LOPART(guid)), questId);
Object* object = ObjectAccessor::GetObjectByTypeMask(*_player, guid, TYPEMASK_UNIT|TYPEMASK_GAMEOBJECT);
if (!object || !object->hasInvolvedQuest(questId))
return;
// some kind of WPE protection
if (!_player->CanInteractWithQuestGiver(pObject))
if (!_player->CanInteractWithQuestGiver(object))
return;
Quest const* pQuest = sObjectMgr->GetQuestTemplate(quest);
if (pQuest)
if (Quest const* quest = sObjectMgr->GetQuestTemplate(questId))
{
if (!_player->CanSeeStartQuest(pQuest) && _player->GetQuestStatus(quest)==QUEST_STATUS_NONE)
if (!_player->CanSeeStartQuest(quest) && _player->GetQuestStatus(questId) == QUEST_STATUS_NONE)
{
sLog->outError("Possible hacking attempt: Player %s [guid: %u] tried to complete quest [entry: %u] without being in possession of the quest!",
_player->GetName(), _player->GetGUIDLow(), quest);
_player->GetName(), _player->GetGUIDLow(), questId);
return;
}
// TODO: need a virtual function
if (_player->InBattleground())
if (Battleground* bg = _player->GetBattleground())
if (bg->GetTypeID() == BATTLEGROUND_AV)
((BattlegroundAV*)bg)->HandleQuestComplete(quest, _player);
((BattlegroundAV*)bg)->HandleQuestComplete(questId, _player);
if (_player->GetQuestStatus(quest) != QUEST_STATUS_COMPLETE)
if (_player->GetQuestStatus(questId) != QUEST_STATUS_COMPLETE)
{
if (pQuest->IsRepeatable())
_player->PlayerTalkClass->SendQuestGiverRequestItems(pQuest, guid, _player->CanCompleteRepeatableQuest(pQuest), false);
if (quest->IsRepeatable())
_player->PlayerTalkClass->SendQuestGiverRequestItems(quest, guid, _player->CanCompleteRepeatableQuest(quest), false);
else
_player->PlayerTalkClass->SendQuestGiverRequestItems(pQuest, guid, _player->CanRewardQuest(pQuest, false), false);
_player->PlayerTalkClass->SendQuestGiverRequestItems(quest, guid, _player->CanRewardQuest(quest, false), false);
}
else
{
if (pQuest->GetReqItemsCount()) // some items required
_player->PlayerTalkClass->SendQuestGiverRequestItems(pQuest, guid, _player->CanRewardQuest(pQuest, false), false);
if (quest->GetReqItemsCount()) // some items required
_player->PlayerTalkClass->SendQuestGiverRequestItems(quest, guid, _player->CanRewardQuest(quest, false), false);
else // no items required
_player->PlayerTalkClass->SendQuestGiverOfferReward(pQuest, guid, true);
_player->PlayerTalkClass->SendQuestGiverOfferReward(quest, guid, true);
}
}
}
@@ -544,7 +539,7 @@ void WorldSession::HandlePushQuestToParty(WorldPacket& recvPacket)
sLog->outDebug(LOG_FILTER_NETWORKIO, "WORLD: Received CMSG_PUSHQUESTTOPARTY quest = %u", questId);
if (Quest const* pQuest = sObjectMgr->GetQuestTemplate(questId))
if (Quest const* quest = sObjectMgr->GetQuestTemplate(questId))
{
if (Group* group = _player->GetGroup())
{
@@ -557,7 +552,7 @@ void WorldSession::HandlePushQuestToParty(WorldPacket& recvPacket)
_player->SendPushToPartyResponse(player, QUEST_PARTY_MSG_SHARING_QUEST);
if (!player->SatisfyQuestStatus(pQuest, false))
if (!player->SatisfyQuestStatus(quest, false))
{
_player->SendPushToPartyResponse(player, QUEST_PARTY_MSG_HAVE_QUEST);
continue;
@@ -569,7 +564,7 @@ void WorldSession::HandlePushQuestToParty(WorldPacket& recvPacket)
continue;
}
if (!player->CanTakeQuest(pQuest, false))
if (!player->CanTakeQuest(quest, false))
{
_player->SendPushToPartyResponse(player, QUEST_PARTY_MSG_CANT_TAKE_QUEST);
continue;
@@ -587,7 +582,7 @@ void WorldSession::HandlePushQuestToParty(WorldPacket& recvPacket)
continue;
}
player->PlayerTalkClass->SendQuestGiverQuestDetails(pQuest, _player->GetGUID(), true);
player->PlayerTalkClass->SendQuestGiverQuestDetails(quest, _player->GetGUID(), true);
player->SetDivider(_player->GetGUID());
}
}
@@ -647,18 +642,18 @@ uint32 WorldSession::getDialogStatus(Player* player, Object* questgiver, uint32
{
uint32 result2 = 0;
uint32 quest_id = i->second;
Quest const* pQuest = sObjectMgr->GetQuestTemplate(quest_id);
if (!pQuest) continue;
Quest const* quest = sObjectMgr->GetQuestTemplate(quest_id);
if (!quest) continue;
ConditionList conditions = sConditionMgr->GetConditionsForNotGroupedEntry(CONDITION_SOURCE_TYPE_QUEST_SHOW_MARK, pQuest->GetQuestId());
ConditionList conditions = sConditionMgr->GetConditionsForNotGroupedEntry(CONDITION_SOURCE_TYPE_QUEST_SHOW_MARK, quest->GetQuestId());
if (!sConditionMgr->IsObjectMeetToConditions(player, conditions))
continue;
QuestStatus status = player->GetQuestStatus(quest_id);
if ((status == QUEST_STATUS_COMPLETE && !player->GetQuestRewardStatus(quest_id)) ||
(pQuest->IsAutoComplete() && player->CanTakeQuest(pQuest, false)))
(quest->IsAutoComplete() && player->CanTakeQuest(quest, false)))
{
if (pQuest->IsAutoComplete() && pQuest->IsRepeatable())
if (quest->IsAutoComplete() && quest->IsRepeatable())
result2 = DIALOG_STATUS_REWARD_REP;
else
result2 = DIALOG_STATUS_REWARD;
@@ -674,26 +669,26 @@ uint32 WorldSession::getDialogStatus(Player* player, Object* questgiver, uint32
{
uint32 result2 = 0;
uint32 quest_id = i->second;
Quest const* pQuest = sObjectMgr->GetQuestTemplate(quest_id);
if (!pQuest)
Quest const* quest = sObjectMgr->GetQuestTemplate(quest_id);
if (!quest)
continue;
ConditionList conditions = sConditionMgr->GetConditionsForNotGroupedEntry(CONDITION_SOURCE_TYPE_QUEST_SHOW_MARK, pQuest->GetQuestId());
ConditionList conditions = sConditionMgr->GetConditionsForNotGroupedEntry(CONDITION_SOURCE_TYPE_QUEST_SHOW_MARK, quest->GetQuestId());
if (!sConditionMgr->IsObjectMeetToConditions(player, conditions))
continue;
QuestStatus status = player->GetQuestStatus(quest_id);
if (status == QUEST_STATUS_NONE)
{
if (player->CanSeeStartQuest(pQuest))
if (player->CanSeeStartQuest(quest))
{
if (player->SatisfyQuestLevel(pQuest, false))
if (player->SatisfyQuestLevel(quest, false))
{
if (pQuest->IsAutoComplete() || (pQuest->IsRepeatable() && player->IsQuestRewarded(quest_id)))
if (quest->IsAutoComplete() || (quest->IsRepeatable() && player->IsQuestRewarded(quest_id)))
result2 = DIALOG_STATUS_REWARD_REP;
else if (player->getLevel() <= ((player->GetQuestLevel(pQuest) == -1) ? player->getLevel() : player->GetQuestLevel(pQuest) + sWorld->getIntConfig(CONFIG_QUEST_LOW_LEVEL_HIDE_DIFF)))
else if (player->getLevel() <= ((player->GetQuestLevel(quest) == -1) ? player->getLevel() : player->GetQuestLevel(quest) + sWorld->getIntConfig(CONFIG_QUEST_LOW_LEVEL_HIDE_DIFF)))
{
if (pQuest->HasFlag(QUEST_FLAGS_DAILY) || pQuest->HasFlag(QUEST_FLAGS_WEEKLY))
if (quest->HasFlag(QUEST_FLAGS_DAILY) || quest->HasFlag(QUEST_FLAGS_WEEKLY))
result2 = DIALOG_STATUS_AVAILABLE_REP;
else
result2 = DIALOG_STATUS_AVAILABLE;
@@ -90,4 +90,3 @@ void WorldSession::HandleUnlearnSkillOpcode(WorldPacket & recv_data)
recv_data >> skill_id;
GetPlayer()->SetSkill(skill_id, 0, 0, 0);
}
+3 -7
View File
@@ -546,15 +546,12 @@ void WorldSession::HandleCancelTradeOpcode(WorldPacket& /*recvPacket*/)
void WorldSession::HandleInitiateTradeOpcode(WorldPacket& recvPacket)
{
if (GetPlayer()->m_trade)
{
recvPacket.rfinish();
return;
}
uint64 ID;
recvPacket >> ID;
if (GetPlayer()->m_trade)
return;
if (!GetPlayer()->isAlive())
{
SendTradeStatus(TRADE_STATUS_YOU_DEAD);
@@ -728,4 +725,3 @@ void WorldSession::HandleClearTradeItemOpcode(WorldPacket& recvPacket)
my_trade->SetItem(TradeSlots(tradeSlot), NULL);
}
+1
View File
@@ -15,6 +15,7 @@
* You should have received a copy of the GNU General Public License along
* with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef TRINITY_MAIL_H
#define TRINITY_MAIL_H
+5 -5
View File
@@ -436,20 +436,20 @@ void OutdoorPvP::HandleKill(Player* killer, Unit* killed)
{
for (GroupReference* itr = group->GetFirstMember(); itr != NULL; itr = itr->next())
{
Player* pGroupGuy = itr->getSource();
Player* groupGuy = itr->getSource();
if (!pGroupGuy)
if (!groupGuy)
continue;
// skip if too far away
if (!pGroupGuy->IsAtGroupRewardDistance(killed))
if (!groupGuy->IsAtGroupRewardDistance(killed))
continue;
// creature kills must be notified, even if not inside objective / not outdoor pvp active
// player kills only count if active and inside objective
if ((pGroupGuy->IsOutdoorPvPActive() && IsInsideObjective(pGroupGuy)) || killed->GetTypeId() == TYPEID_UNIT)
if ((groupGuy->IsOutdoorPvPActive() && IsInsideObjective(groupGuy)) || killed->GetTypeId() == TYPEID_UNIT)
{
HandleKillImpl(pGroupGuy, killed);
HandleKillImpl(groupGuy, killed);
}
}
}
+16 -3
View File
@@ -1,6 +1,19 @@
/* Copyright (C) 2006 - 2009 ScriptDev2 <https://scriptdev2.svn.sourceforge.net/>
* This program is free software licensed under GPL version 2
* Please see the included DOCS/LICENSE.TXT for more information */
/*
* Copyright (C) 2008-2012 TrinityCore <http://www.trinitycore.org/>
*
* This program is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by the
* Free Software Foundation; either version 2 of the License, or (at your
* option) any later version.
*
* This program is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
* more details.
*
* You should have received a copy of the GNU General Public License along
* with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef SC_SCRIPTLOADER_H
#define SC_SCRIPTLOADER_H
+6 -3
View File
@@ -79,7 +79,8 @@ void SystemMgr::LoadScriptTexts()
m_mTextDataMap[iId] = temp;
++uiCount;
} while (result->NextRow());
}
while (result->NextRow());
sLog->outString(">> Loaded %u additional Script Texts data in %u ms", uiCount, GetMSTimeDiffToNow(oldMSTime));
sLog->outString();
@@ -140,7 +141,8 @@ void SystemMgr::LoadScriptTextsCustom()
m_mTextDataMap[iId] = temp;
++uiCount;
} while (result->NextRow());
}
while (result->NextRow());
sLog->outString(">> Loaded %u additional Custom Texts data.", uiCount);
sLog->outString();
@@ -199,7 +201,8 @@ void SystemMgr::LoadScriptWaypoints()
m_mPointMoveMap[uiEntry].push_back(temp);
++count;
} while (result->NextRow());
}
while (result->NextRow());
sLog->outString(">> Loaded %u Script Waypoint nodes in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
sLog->outString();
+1
View File
@@ -4,6 +4,7 @@
#ifndef SC_SYSTEM_H
#define SC_SYSTEM_H
#include <ace/Singleton.h>
#define TEXT_SOURCE_RANGE -1000000 //the amount of entries each text source has available
+1 -1
View File
@@ -26,7 +26,7 @@
#include "Common.h"
// Note: this include need for be sure have full definition of class WorldSession
// if this class definition not complite then VS for x64 release use different size for
// if this class definition not complete then VS for x64 release use different size for
// struct OpcodeHandler in this header and Opcode.cpp and get totally wrong data from
// table opcodeTable in source when Opcode.h included but WorldSession.h not included
#include "WorldSession.h"
+2 -2
View File
@@ -105,7 +105,7 @@ isRecruiter(isARecruiter), timeLastWhoCommand(0)
m_Address = sock->GetRemoteAddress();
sock->AddReference();
ResetTimeOutTime();
LoginDatabase.PExecute("UPDATE account SET online = 1 WHERE id = %u;", GetAccountId()); // One-time query
LoginDatabase.PExecute("UPDATE account SET online = 1 WHERE id = %u;", GetAccountId());
}
InitializeQueryCallbackParameters();
@@ -134,7 +134,7 @@ WorldSession::~WorldSession()
while (_recvQueue.next(packet))
delete packet;
LoginDatabase.PExecute("UPDATE account SET online = 0 WHERE id = %u;", GetAccountId()); // One-time query
LoginDatabase.PExecute("UPDATE account SET online = 0 WHERE id = %u;", GetAccountId());
}
void WorldSession::SizeError(WorldPacket const& packet, uint32 size) const
+1 -1
View File
@@ -294,7 +294,7 @@ class WorldSession
void SendAttackStop(Unit const* enemy);
void SendBattlegGroundList(uint64 guid, BattlegroundTypeId bgTypeId);
void SendBattleGroundList(uint64 guid, BattlegroundTypeId bgTypeId);
void SendTradeStatus(TradeStatus status);
void SendUpdateTrade(bool trader_data = true);
+2 -2
View File
@@ -132,7 +132,8 @@ void LoadSkillDiscoveryTable()
}
++count;
} while (result->NextRow());
}
while (result->NextRow());
if (!ssNonDiscoverableEntries.str().empty())
sLog->outErrorDb("Some items can't be successfully discovered: have in chance field value < 0.000001 in `skill_discovery_template` DB table . List:\n%s", ssNonDiscoverableEntries.str().c_str());
@@ -246,4 +247,3 @@ uint32 GetSkillDiscoverySpell(uint32 skillId, uint32 spellId, Player* player)
return 0;
}
-1
View File
@@ -28,4 +28,3 @@ uint32 GetSkillDiscoverySpell(uint32 skillId, uint32 spellId, Player* player);
bool HasDiscoveredAllSpells(uint32 spellId, Player* player);
uint32 GetExplicitDiscoverySpell(uint32 spellId, Player* player);
#endif
@@ -138,4 +138,3 @@ bool canCreateExtraItems(Player* player, uint32 spellId, float &additionalChance
// enable extra item creation
return true;
}
-1
View File
@@ -28,4 +28,3 @@ bool canCreateExtraItems(Player* player, uint32 spellId, float &additionalChance
// function to load the extra item creation info from DB
void LoadSkillExtraItemTable();
#endif
-1
View File
@@ -89,4 +89,3 @@ class Weather
WeatherData const* m_weatherChances;
};
#endif
@@ -244,7 +244,6 @@ void OPvPCapturePointEP_NPT::ChangeState()
// complete quest objective
if (m_TowerState == EP_TS_A || m_TowerState == EP_TS_H)
SendObjectiveComplete(EP_NPT_CM, 0);
}
void OPvPCapturePointEP_NPT::SendChangePhase()
@@ -329,4 +329,3 @@ class OutdoorPvPEP : public OutdoorPvP
};
#endif
@@ -176,7 +176,6 @@ OutdoorPvPZM::OutdoorPvPZM()
m_GraveYard = NULL;
m_AllianceTowersControlled = 0;
m_HordeTowersControlled = 0;
}
bool OutdoorPvPZM::SetupOutdoorPvP()