From d38bc3a17857c36a3ab871deac57b314987194bb Mon Sep 17 00:00:00 2001 From: Spp Date: Mon, 27 Feb 2012 14:58:47 +0100 Subject: Core: Rename GetCreatureInfo to GetCreatureTemplate and minor cleanup here and there --- src/server/game/Handlers/QuestHandler.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/server/game/Handlers/QuestHandler.cpp') diff --git a/src/server/game/Handlers/QuestHandler.cpp b/src/server/game/Handlers/QuestHandler.cpp index 05d945d3a93..6725992b48a 100755 --- a/src/server/game/Handlers/QuestHandler.cpp +++ b/src/server/game/Handlers/QuestHandler.cpp @@ -103,7 +103,7 @@ void WorldSession::HandleQuestgiverHelloOpcode(WorldPacket & recv_data) if (sScriptMgr->OnGossipHello(_player, creature)) return; - _player->PrepareGossipMenu(creature, creature->GetCreatureInfo()->GossipMenuId, true); + _player->PrepareGossipMenu(creature, creature->GetCreatureTemplate()->GossipMenuId, true); _player->SendPreparedGossip(creature); creature->AI()->sGossipHello(_player); -- cgit v1.2.3 From f1949b20a6545b11361d6fa223907393a0070327 Mon Sep 17 00:00:00 2001 From: Spp Date: Fri, 9 Mar 2012 13:42:52 +0100 Subject: Some random cleanup here and there --- src/server/game/Accounts/AccountMgr.h | 38 ++-- src/server/game/Entities/Corpse/Corpse.h | 1 - src/server/game/Entities/Creature/Creature.cpp | 30 ++-- .../game/Entities/Creature/TemporarySummon.h | 1 - .../game/Entities/DynamicObject/DynamicObject.cpp | 4 +- src/server/game/Entities/GameObject/GameObject.cpp | 2 - src/server/game/Entities/GameObject/GameObject.h | 1 - src/server/game/Entities/Player/Player.cpp | 76 ++++---- src/server/game/Entities/Player/Player.h | 8 +- src/server/game/Entities/Totem/Totem.h | 1 - src/server/game/Handlers/BattleGroundHandler.cpp | 4 +- src/server/game/Handlers/QuestHandler.cpp | 197 ++++++++++----------- src/server/game/Handlers/SkillHandler.cpp | 1 - src/server/game/Handlers/TaxiHandler.cpp | 2 +- src/server/game/Handlers/TradeHandler.cpp | 10 +- src/server/game/Instances/InstanceSaveMgr.cpp | 2 +- src/server/game/Mails/Mail.h | 1 + src/server/game/OutdoorPvP/OutdoorPvP.cpp | 10 +- src/server/game/Scripting/ScriptLoader.h | 19 +- src/server/game/Scripting/ScriptSystem.cpp | 9 +- src/server/game/Scripting/ScriptSystem.h | 1 + src/server/game/Server/Protocol/Opcodes.h | 2 +- src/server/game/Server/WorldSession.cpp | 14 +- src/server/game/Server/WorldSession.h | 2 +- src/server/game/Skills/SkillDiscovery.cpp | 4 +- src/server/game/Skills/SkillDiscovery.h | 1 - src/server/game/Skills/SkillExtraItems.cpp | 1 - src/server/game/Skills/SkillExtraItems.h | 1 - src/server/game/Weather/Weather.h | 1 - src/server/scripts/OutdoorPvP/OutdoorPvPEP.cpp | 1 - src/server/scripts/OutdoorPvP/OutdoorPvPEP.h | 1 - src/server/scripts/OutdoorPvP/OutdoorPvPZM.cpp | 1 - 32 files changed, 221 insertions(+), 226 deletions(-) (limited to 'src/server/game/Handlers/QuestHandler.cpp') diff --git a/src/server/game/Accounts/AccountMgr.h b/src/server/game/Accounts/AccountMgr.h index 1b1ecfa994a..467972cdf65 100755 --- a/src/server/game/Accounts/AccountMgr.h +++ b/src/server/game/Accounts/AccountMgr.h @@ -36,25 +36,25 @@ enum AccountOpResult namespace AccountMgr { - AccountOpResult CreateAccount(std::string username, std::string password); - AccountOpResult DeleteAccount(uint32 accountId); - AccountOpResult ChangeUsername(uint32 accountId, std::string newUsername, std::string newPassword); - AccountOpResult ChangePassword(uint32 accountId, std::string newPassword); - bool CheckPassword(uint32 accountId, std::string password); - - uint32 GetId(std::string username); - uint32 GetSecurity(uint32 accountId); - uint32 GetSecurity(uint64 accountId, int32 realmId); - bool GetName(uint32 accountId, std::string& name); - uint32 GetCharactersCount(uint32 accountId); - std::string CalculateShaPassHash(std::string& name, std::string& password); - - bool normalizeString(std::string& utf8String); - bool IsPlayerAccount(uint32 gmlevel); - bool IsModeratorAccount(uint32 gmlevel); - bool IsGMAccount(uint32 gmlevel); - bool IsAdminAccount(uint32 gmlevel); - bool IsConsoleAccount(uint32 gmlevel); + AccountOpResult CreateAccount(std::string username, std::string password); + AccountOpResult DeleteAccount(uint32 accountId); + AccountOpResult ChangeUsername(uint32 accountId, std::string newUsername, std::string newPassword); + AccountOpResult ChangePassword(uint32 accountId, std::string newPassword); + bool CheckPassword(uint32 accountId, std::string password); + + uint32 GetId(std::string username); + uint32 GetSecurity(uint32 accountId); + uint32 GetSecurity(uint64 accountId, int32 realmId); + bool GetName(uint32 accountId, std::string& name); + uint32 GetCharactersCount(uint32 accountId); + std::string CalculateShaPassHash(std::string& name, std::string& password); + + bool normalizeString(std::string& utf8String); + bool IsPlayerAccount(uint32 gmlevel); + bool IsModeratorAccount(uint32 gmlevel); + bool IsGMAccount(uint32 gmlevel); + bool IsAdminAccount(uint32 gmlevel); + bool IsConsoleAccount(uint32 gmlevel); }; #endif diff --git a/src/server/game/Entities/Corpse/Corpse.h b/src/server/game/Entities/Corpse/Corpse.h index 1aaf56eaf27..afac900df32 100755 --- a/src/server/game/Entities/Corpse/Corpse.h +++ b/src/server/game/Entities/Corpse/Corpse.h @@ -91,4 +91,3 @@ class Corpse : public WorldObject, public GridObject GridCoord _gridCoord; // gride for corpse position for fast search }; #endif - diff --git a/src/server/game/Entities/Creature/Creature.cpp b/src/server/game/Entities/Creature/Creature.cpp index 0fe2016950b..2b4f1275993 100755 --- a/src/server/game/Entities/Creature/Creature.cpp +++ b/src/server/game/Entities/Creature/Creature.cpp @@ -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 diff --git a/src/server/game/Entities/Creature/TemporarySummon.h b/src/server/game/Entities/Creature/TemporarySummon.h index fa1e134b1ac..829eb73bf80 100755 --- a/src/server/game/Entities/Creature/TemporarySummon.h +++ b/src/server/game/Entities/Creature/TemporarySummon.h @@ -107,4 +107,3 @@ private: TempSummon& m_owner; }; #endif - diff --git a/src/server/game/Entities/DynamicObject/DynamicObject.cpp b/src/server/game/Entities/DynamicObject/DynamicObject.cpp index 0a4e4c73f42..abeae0656ee 100755 --- a/src/server/game/Entities/DynamicObject/DynamicObject.cpp +++ b/src/server/game/Entities/DynamicObject/DynamicObject.cpp @@ -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; } diff --git a/src/server/game/Entities/GameObject/GameObject.cpp b/src/server/game/Entities/GameObject/GameObject.cpp index c7101e918ba..0ba46609945 100755 --- a/src/server/game/Entities/GameObject/GameObject.cpp +++ b/src/server/game/Entities/GameObject/GameObject.cpp @@ -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); diff --git a/src/server/game/Entities/GameObject/GameObject.h b/src/server/game/Entities/GameObject/GameObject.h index a4fece4d301..ee643648a6a 100755 --- a/src/server/game/Entities/GameObject/GameObject.h +++ b/src/server/game/Entities/GameObject/GameObject.h @@ -402,7 +402,6 @@ struct GameObjectTemplate } raw; }; - std::string AIName; uint32 ScriptId; diff --git a/src/server/game/Entities/Player/Player.cpp b/src/server/game/Entities/Player/Player.cpp index 54178cd6720..127b45e1739 100755 --- a/src/server/game/Entities/Player/Player.cpp +++ b/src/server/game/Entities/Player/Player.cpp @@ -11547,7 +11547,7 @@ InventoryResult Player::CanBankItem(uint8 bag, uint8 slot, ItemPosCountVec &dest uint32 count = pItem->GetCount(); - sLog->outDebug(LOG_FILTER_PLAYER_ITEMS, "STORAGE: CanBankItem bag = %u, slot = %u, item = %u, count = %u", bag, slot, pItem->GetEntry(), pItem->GetCount()); + sLog->outDebug(LOG_FILTER_PLAYER_ITEMS, "STORAGE: CanBankItem bag = %u, slot = %u, item = %u, count = %u", bag, slot, pItem->GetEntry(), pItem->GetCount()); ItemTemplate const* pProto = pItem->GetTemplate(); if (!pProto) return swap ? EQUIP_ERR_ITEMS_CANT_BE_SWAPPED : EQUIP_ERR_ITEM_NOT_FOUND; @@ -11731,7 +11731,7 @@ InventoryResult Player::CanUseItem(Item* pItem, bool not_loading) const { if (pItem) { - sLog->outDebug(LOG_FILTER_PLAYER_ITEMS, "STORAGE: CanUseItem item = %u", pItem->GetEntry()); + sLog->outDebug(LOG_FILTER_PLAYER_ITEMS, "STORAGE: CanUseItem item = %u", pItem->GetEntry()); if (!isAlive() && not_loading) return EQUIP_ERR_YOU_ARE_DEAD; @@ -11914,7 +11914,7 @@ InventoryResult Player::CanRollForItemInLFG(ItemTemplate const* proto, WorldObje InventoryResult Player::CanUseAmmo(uint32 item) const { - sLog->outDebug(LOG_FILTER_PLAYER_ITEMS, "STORAGE: CanUseAmmo item = %u", item); + sLog->outDebug(LOG_FILTER_PLAYER_ITEMS, "STORAGE: CanUseAmmo item = %u", item); if (!isAlive()) return EQUIP_ERR_YOU_ARE_DEAD; //if (isStunned()) @@ -12060,7 +12060,7 @@ Item* Player::_StoreItem(uint16 pos, Item* pItem, uint32 count, bool clone, bool uint8 bag = pos >> 8; uint8 slot = pos & 255; - sLog->outDebug(LOG_FILTER_PLAYER_ITEMS, "STORAGE: StoreItem bag = %u, slot = %u, item = %u, count = %u, guid = %u", bag, slot, pItem->GetEntry(), count, pItem->GetGUIDLow()); + sLog->outDebug(LOG_FILTER_PLAYER_ITEMS, "STORAGE: StoreItem bag = %u, slot = %u, item = %u, count = %u, guid = %u", bag, slot, pItem->GetEntry(), count, pItem->GetGUIDLow()); Item* pItem2 = GetItemByPos(bag, slot); @@ -12316,7 +12316,7 @@ void Player::VisualizeItem(uint8 slot, Item* pItem) if (pItem->GetTemplate()->Bonding == BIND_WHEN_EQUIPED || pItem->GetTemplate()->Bonding == BIND_WHEN_PICKED_UP || pItem->GetTemplate()->Bonding == BIND_QUEST_ITEM) pItem->SetBinding(true); - sLog->outDebug(LOG_FILTER_PLAYER_ITEMS, "STORAGE: EquipItem slot = %u, item = %u", slot, pItem->GetEntry()); + sLog->outDebug(LOG_FILTER_PLAYER_ITEMS, "STORAGE: EquipItem slot = %u, item = %u", slot, pItem->GetEntry()); m_items[slot] = pItem; SetUInt64Value(PLAYER_FIELD_INV_SLOT_HEAD + (slot * 2), pItem->GetGUID()); @@ -12341,7 +12341,7 @@ void Player::RemoveItem(uint8 bag, uint8 slot, bool update) Item* pItem = GetItemByPos(bag, slot); if (pItem) { - sLog->outDebug(LOG_FILTER_PLAYER_ITEMS, "STORAGE: RemoveItem bag = %u, slot = %u, item = %u", bag, slot, pItem->GetEntry()); + sLog->outDebug(LOG_FILTER_PLAYER_ITEMS, "STORAGE: RemoveItem bag = %u, slot = %u, item = %u", bag, slot, pItem->GetEntry()); RemoveEnchantmentDurations(pItem); RemoveItemDurations(pItem); @@ -12460,7 +12460,7 @@ void Player::DestroyItem(uint8 bag, uint8 slot, bool update) Item* pItem = GetItemByPos(bag, slot); if (pItem) { - sLog->outDebug(LOG_FILTER_PLAYER_ITEMS, "STORAGE: DestroyItem bag = %u, slot = %u, item = %u", bag, slot, pItem->GetEntry()); + sLog->outDebug(LOG_FILTER_PLAYER_ITEMS, "STORAGE: DestroyItem bag = %u, slot = %u, item = %u", bag, slot, pItem->GetEntry()); // Also remove all contained items if the item is a bag. // This if () prevents item saving crashes if the condition for a bag to be empty before being destroyed was bypassed somehow. if (pItem->IsNotEmptyBag()) @@ -12551,7 +12551,7 @@ void Player::DestroyItem(uint8 bag, uint8 slot, bool update) void Player::DestroyItemCount(uint32 item, uint32 count, bool update, bool unequip_check) { - sLog->outDebug(LOG_FILTER_PLAYER_ITEMS, "STORAGE: DestroyItemCount item = %u, count = %u", item, count); + sLog->outDebug(LOG_FILTER_PLAYER_ITEMS, "STORAGE: DestroyItemCount item = %u, count = %u", item, count); uint32 remcount = 0; // in inventory @@ -12680,7 +12680,7 @@ void Player::DestroyItemCount(uint32 item, uint32 count, bool update, bool unequ void Player::DestroyZoneLimitedItem(bool update, uint32 new_zone) { - sLog->outDebug(LOG_FILTER_PLAYER_ITEMS, "STORAGE: DestroyZoneLimitedItem in map %u and area %u", GetMapId(), new_zone); + sLog->outDebug(LOG_FILTER_PLAYER_ITEMS, "STORAGE: DestroyZoneLimitedItem in map %u and area %u", GetMapId(), new_zone); // in inventory for (uint8 i = INVENTORY_SLOT_ITEM_START; i < INVENTORY_SLOT_ITEM_END; i++) @@ -12712,7 +12712,7 @@ void Player::DestroyConjuredItems(bool update) { // used when entering arena // destroys all conjured items - sLog->outDebug(LOG_FILTER_PLAYER_ITEMS, "STORAGE: DestroyConjuredItems"); + sLog->outDebug(LOG_FILTER_PLAYER_ITEMS, "STORAGE: DestroyConjuredItems"); // in inventory for (uint8 i = INVENTORY_SLOT_ITEM_START; i < INVENTORY_SLOT_ITEM_END; i++) @@ -12763,7 +12763,7 @@ void Player::DestroyItemCount(Item* pItem, uint32 &count, bool update) if (!pItem) return; - sLog->outDebug(LOG_FILTER_PLAYER_ITEMS, "STORAGE: DestroyItemCount item (GUID: %u, Entry: %u) count = %u", pItem->GetGUIDLow(), pItem->GetEntry(), count); + sLog->outDebug(LOG_FILTER_PLAYER_ITEMS, "STORAGE: DestroyItemCount item (GUID: %u, Entry: %u) count = %u", pItem->GetGUIDLow(), pItem->GetEntry(), count); if (pItem->GetCount() <= count) { @@ -12826,7 +12826,7 @@ void Player::SplitItem(uint16 src, uint16 dst, uint32 count) return; } - sLog->outDebug(LOG_FILTER_PLAYER_ITEMS, "STORAGE: SplitItem bag = %u, slot = %u, item = %u, count = %u", dstbag, dstslot, pSrcItem->GetEntry(), count); + sLog->outDebug(LOG_FILTER_PLAYER_ITEMS, "STORAGE: SplitItem bag = %u, slot = %u, item = %u, count = %u", dstbag, dstslot, pSrcItem->GetEntry(), count); Item* pNewItem = pSrcItem->CloneItem(count, this); if (!pNewItem) { @@ -12911,7 +12911,7 @@ void Player::SwapItem(uint16 src, uint16 dst) if (!pSrcItem) return; - sLog->outDebug(LOG_FILTER_PLAYER_ITEMS, "STORAGE: SwapItem bag = %u, slot = %u, item = %u", dstbag, dstslot, pSrcItem->GetEntry()); + sLog->outDebug(LOG_FILTER_PLAYER_ITEMS, "STORAGE: SwapItem bag = %u, slot = %u, item = %u", dstbag, dstslot, pSrcItem->GetEntry()); if (!isAlive()) { @@ -12941,7 +12941,7 @@ void Player::SwapItem(uint16 src, uint16 dst) } // prevent put equipped/bank bag in self - if (IsBagPos (src) && srcslot == dstbag) + if (IsBagPos(src) && srcslot == dstbag) { SendEquipError(EQUIP_ERR_NONEMPTY_BAG_OVER_OTHER_BAG, pSrcItem, pDstItem); return; @@ -12999,7 +12999,7 @@ void Player::SwapItem(uint16 src, uint16 dst) if (IsBankPos(src)) ItemAddedQuestCheck(pSrcItem->GetEntry(), pSrcItem->GetCount()); } - else if (IsBankPos (dst)) + else if (IsBankPos(dst)) { ItemPosCountVec dest; InventoryResult msg = CanBankItem(dstbag, dstslot, dest, pSrcItem, false); @@ -13013,7 +13013,7 @@ void Player::SwapItem(uint16 src, uint16 dst) BankItem(dest, pSrcItem, true); ItemRemovedQuestCheck(pSrcItem->GetEntry(), pSrcItem->GetCount()); } - else if (IsEquipmentPos (dst)) + else if (IsEquipmentPos(dst)) { uint16 dest; InventoryResult msg = CanEquipItem(dstslot, dest, pSrcItem, false); @@ -13039,9 +13039,9 @@ void Player::SwapItem(uint16 src, uint16 dst) uint16 eDest = 0; if (IsInventoryPos(dst)) msg = CanStoreItem(dstbag, dstslot, sDest, pSrcItem, false); - else if (IsBankPos (dst)) + else if (IsBankPos(dst)) msg = CanBankItem(dstbag, dstslot, sDest, pSrcItem, false); - else if (IsEquipmentPos (dst)) + else if (IsEquipmentPos(dst)) msg = CanEquipItem(dstslot, eDest, pSrcItem, false); else return; @@ -13055,9 +13055,9 @@ void Player::SwapItem(uint16 src, uint16 dst) if (IsInventoryPos(dst)) StoreItem(sDest, pSrcItem, true); - else if (IsBankPos (dst)) + else if (IsBankPos(dst)) BankItem(sDest, pSrcItem, true); - else if (IsEquipmentPos (dst)) + else if (IsEquipmentPos(dst)) { EquipItem(eDest, pSrcItem, true); AutoUnequipOffhandIfNeed(); @@ -13287,7 +13287,7 @@ void Player::AddItemToBuyBackSlot(Item* pItem) } RemoveItemFromBuyBackSlot(slot, true); - sLog->outDebug(LOG_FILTER_PLAYER_ITEMS, "STORAGE: AddItemToBuyBackSlot item = %u, slot = %u", pItem->GetEntry(), slot); + sLog->outDebug(LOG_FILTER_PLAYER_ITEMS, "STORAGE: AddItemToBuyBackSlot item = %u, slot = %u", pItem->GetEntry(), slot); m_items[slot] = pItem; time_t base = time(NULL); @@ -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); @@ -13309,7 +13309,7 @@ void Player::AddItemToBuyBackSlot(Item* pItem) Item* Player::GetItemFromBuyBackSlot(uint32 slot) { - sLog->outDebug(LOG_FILTER_PLAYER_ITEMS, "STORAGE: GetItemFromBuyBackSlot slot = %u", slot); + sLog->outDebug(LOG_FILTER_PLAYER_ITEMS, "STORAGE: GetItemFromBuyBackSlot slot = %u", slot); if (slot >= BUYBACK_SLOT_START && slot < BUYBACK_SLOT_END) return m_items[slot]; return NULL; @@ -13317,7 +13317,7 @@ Item* Player::GetItemFromBuyBackSlot(uint32 slot) void Player::RemoveItemFromBuyBackSlot(uint32 slot, bool del) { - sLog->outDebug(LOG_FILTER_PLAYER_ITEMS, "STORAGE: RemoveItemFromBuyBackSlot slot = %u", slot); + sLog->outDebug(LOG_FILTER_PLAYER_ITEMS, "STORAGE: RemoveItemFromBuyBackSlot slot = %u", slot); if (slot >= BUYBACK_SLOT_START && slot < BUYBACK_SLOT_END) { Item* pItem = m_items[slot]; @@ -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); diff --git a/src/server/game/Entities/Player/Player.h b/src/server/game/Entities/Player/Player.h index 362fd8a9016..bd58827c0e4 100755 --- a/src/server/game/Entities/Player/Player.h +++ b/src/server/game/Entities/Player/Player.h @@ -1543,7 +1543,7 @@ class Player : public Unit, public GridObject void setRegenTimerCount(uint32 time) {m_regenTimerCount = time;} void setWeaponChangeTimer(uint32 time) {m_weaponChangeTimer = time;} - uint32 GetMoney() const { return GetUInt32Value (PLAYER_FIELD_COINAGE); } + uint32 GetMoney() const { return GetUInt32Value(PLAYER_FIELD_COINAGE); } void ModifyMoney(int32 d); bool HasEnoughMoney(uint32 amount) const { return (GetMoney() >= amount); } bool HasEnoughMoney(int32 amount) const @@ -1555,13 +1555,13 @@ class Player : public Unit, public GridObject void SetMoney(uint32 value) { - SetUInt32Value (PLAYER_FIELD_COINAGE, value); + SetUInt32Value(PLAYER_FIELD_COINAGE, value); MoneyChanged(value); UpdateAchievementCriteria(ACHIEVEMENT_CRITERIA_TYPE_HIGHEST_GOLD_VALUE_OWNED); } 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* 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); diff --git a/src/server/game/Entities/Totem/Totem.h b/src/server/game/Entities/Totem/Totem.h index 8b00da34d73..c33b8776660 100755 --- a/src/server/game/Entities/Totem/Totem.h +++ b/src/server/game/Entities/Totem/Totem.h @@ -60,4 +60,3 @@ class Totem : public Minion uint32 m_duration; }; #endif - diff --git a/src/server/game/Handlers/BattleGroundHandler.cpp b/src/server/game/Handlers/BattleGroundHandler.cpp index d1aa0021a75..e11f6e5b4e2 100755 --- a/src/server/game/Handlers/BattleGroundHandler.cpp +++ b/src/server/game/Handlers/BattleGroundHandler.cpp @@ -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); diff --git a/src/server/game/Handlers/QuestHandler.cpp b/src/server/game/Handlers/QuestHandler.cpp index 6725992b48a..73bbc58c445 100755 --- a/src/server/game/Handlers/QuestHandler.cpp +++ b/src/server/game/Handlers/QuestHandler.cpp @@ -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; diff --git a/src/server/game/Handlers/SkillHandler.cpp b/src/server/game/Handlers/SkillHandler.cpp index 355effba0c6..f9731ba85db 100755 --- a/src/server/game/Handlers/SkillHandler.cpp +++ b/src/server/game/Handlers/SkillHandler.cpp @@ -90,4 +90,3 @@ void WorldSession::HandleUnlearnSkillOpcode(WorldPacket & recv_data) recv_data >> skill_id; GetPlayer()->SetSkill(skill_id, 0, 0, 0); } - diff --git a/src/server/game/Handlers/TaxiHandler.cpp b/src/server/game/Handlers/TaxiHandler.cpp index 44889e6dda8..b774fbcba70 100755 --- a/src/server/game/Handlers/TaxiHandler.cpp +++ b/src/server/game/Handlers/TaxiHandler.cpp @@ -103,7 +103,7 @@ void WorldSession::SendTaxiMenu(Creature* unit) sLog->outDebug(LOG_FILTER_NETWORKIO, "WORLD: CMSG_TAXINODE_STATUS_QUERY %u ", curloc); - WorldPacket data(SMSG_SHOWTAXINODES, (4+8+4+8*4)); + WorldPacket data(SMSG_SHOWTAXINODES, (4 + 8 + 4 + 8 * 4)); data << uint32(1); data << uint64(unit->GetGUID()); data << uint32(curloc); diff --git a/src/server/game/Handlers/TradeHandler.cpp b/src/server/game/Handlers/TradeHandler.cpp index 4c39992f344..17617c399e4 100755 --- a/src/server/game/Handlers/TradeHandler.cpp +++ b/src/server/game/Handlers/TradeHandler.cpp @@ -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); } - diff --git a/src/server/game/Instances/InstanceSaveMgr.cpp b/src/server/game/Instances/InstanceSaveMgr.cpp index 722b7089a17..557977f9468 100755 --- a/src/server/game/Instances/InstanceSaveMgr.cpp +++ b/src/server/game/Instances/InstanceSaveMgr.cpp @@ -639,4 +639,4 @@ uint32 InstanceSaveManager::GetNumBoundGroupsTotal() ret += itr->second->GetGroupCount(); return ret; -} \ No newline at end of file +} diff --git a/src/server/game/Mails/Mail.h b/src/server/game/Mails/Mail.h index 6615d59160a..dbd03bd96ee 100755 --- a/src/server/game/Mails/Mail.h +++ b/src/server/game/Mails/Mail.h @@ -15,6 +15,7 @@ * You should have received a copy of the GNU General Public License along * with this program. If not, see . */ + #ifndef TRINITY_MAIL_H #define TRINITY_MAIL_H diff --git a/src/server/game/OutdoorPvP/OutdoorPvP.cpp b/src/server/game/OutdoorPvP/OutdoorPvP.cpp index 9f6ec547342..465fca75030 100755 --- a/src/server/game/OutdoorPvP/OutdoorPvP.cpp +++ b/src/server/game/OutdoorPvP/OutdoorPvP.cpp @@ -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); } } } diff --git a/src/server/game/Scripting/ScriptLoader.h b/src/server/game/Scripting/ScriptLoader.h index 409b3db4b7f..0db6917a0d4 100644 --- a/src/server/game/Scripting/ScriptLoader.h +++ b/src/server/game/Scripting/ScriptLoader.h @@ -1,6 +1,19 @@ -/* Copyright (C) 2006 - 2009 ScriptDev2 -* 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 + * + * 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 . + */ #ifndef SC_SCRIPTLOADER_H #define SC_SCRIPTLOADER_H diff --git a/src/server/game/Scripting/ScriptSystem.cpp b/src/server/game/Scripting/ScriptSystem.cpp index 56d3109a6a0..65e855cd887 100755 --- a/src/server/game/Scripting/ScriptSystem.cpp +++ b/src/server/game/Scripting/ScriptSystem.cpp @@ -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(); diff --git a/src/server/game/Scripting/ScriptSystem.h b/src/server/game/Scripting/ScriptSystem.h index daa7fe0d596..cf6332b22f2 100644 --- a/src/server/game/Scripting/ScriptSystem.h +++ b/src/server/game/Scripting/ScriptSystem.h @@ -4,6 +4,7 @@ #ifndef SC_SYSTEM_H #define SC_SYSTEM_H + #include #define TEXT_SOURCE_RANGE -1000000 //the amount of entries each text source has available diff --git a/src/server/game/Server/Protocol/Opcodes.h b/src/server/game/Server/Protocol/Opcodes.h index 81a37ece4f9..775b832d79a 100755 --- a/src/server/game/Server/Protocol/Opcodes.h +++ b/src/server/game/Server/Protocol/Opcodes.h @@ -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" diff --git a/src/server/game/Server/WorldSession.cpp b/src/server/game/Server/WorldSession.cpp index 48fa95ff6a5..c88c5c6e087 100755 --- a/src/server/game/Server/WorldSession.cpp +++ b/src/server/game/Server/WorldSession.cpp @@ -47,7 +47,7 @@ bool MapSessionFilter::Process(WorldPacket* packet) { - OpcodeHandler const &opHandle = opcodeTable[packet->GetOpcode()]; + OpcodeHandler const& opHandle = opcodeTable[packet->GetOpcode()]; //let's check if our opcode can be really processed in Map::Update() if (opHandle.packetProcessing == PROCESS_INPLACE) @@ -69,7 +69,7 @@ bool MapSessionFilter::Process(WorldPacket* packet) //OR packet handler is not thread-safe! bool WorldSessionFilter::Process(WorldPacket* packet) { - OpcodeHandler const &opHandle = opcodeTable[packet->GetOpcode()]; + OpcodeHandler const& opHandle = opcodeTable[packet->GetOpcode()]; //check if packet handler is supposed to be safe if (opHandle.packetProcessing == PROCESS_INPLACE) return true; @@ -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,10 +134,10 @@ 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 +void WorldSession::SizeError(WorldPacket const& packet, uint32 size) const { sLog->outError("Client (account %u) send packet %s (%u) with size " SIZEFMTD " but expected %u (attempt to crash server?), skipped", GetAccountId(), LookupOpcodeName(packet.GetOpcode()), packet.GetOpcode(), packet.size(), size); @@ -345,7 +345,7 @@ bool WorldSession::Update(uint32 diff, PacketFilter& updater) break; } } - catch (ByteBufferException &) + catch(ByteBufferException &) { sLog->outError("WorldSession::Update ByteBufferException occured while parsing a packet (opcode: %u) from client %s, accountid=%i. Skipped packet.", packet->GetOpcode(), GetRemoteAddress().c_str(), GetAccountId()); @@ -896,7 +896,7 @@ void WorldSession::ReadAddonsInfo(WorldPacket &data) ByteBuffer addonInfo; addonInfo.resize(size); - if (uncompress(const_cast(addonInfo.contents()), &uSize, const_cast(data.contents() + pos), data.size() - pos) == Z_OK) + if (uncompress(const_cast(addonInfo.contents()), &uSize, const_cast(data.contents() + pos), data.size() - pos) == Z_OK) { uint32 addonsCount; addonInfo >> addonsCount; // addons count diff --git a/src/server/game/Server/WorldSession.h b/src/server/game/Server/WorldSession.h index a18067ff612..0fce0a372ff 100755 --- a/src/server/game/Server/WorldSession.h +++ b/src/server/game/Server/WorldSession.h @@ -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); diff --git a/src/server/game/Skills/SkillDiscovery.cpp b/src/server/game/Skills/SkillDiscovery.cpp index 466d3ac83a2..3ece4b57741 100755 --- a/src/server/game/Skills/SkillDiscovery.cpp +++ b/src/server/game/Skills/SkillDiscovery.cpp @@ -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; } - diff --git a/src/server/game/Skills/SkillDiscovery.h b/src/server/game/Skills/SkillDiscovery.h index 110adb91cf2..ba5542e0189 100755 --- a/src/server/game/Skills/SkillDiscovery.h +++ b/src/server/game/Skills/SkillDiscovery.h @@ -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 - diff --git a/src/server/game/Skills/SkillExtraItems.cpp b/src/server/game/Skills/SkillExtraItems.cpp index b5b6b5d7b96..c68e3cdcfe0 100755 --- a/src/server/game/Skills/SkillExtraItems.cpp +++ b/src/server/game/Skills/SkillExtraItems.cpp @@ -138,4 +138,3 @@ bool canCreateExtraItems(Player* player, uint32 spellId, float &additionalChance // enable extra item creation return true; } - diff --git a/src/server/game/Skills/SkillExtraItems.h b/src/server/game/Skills/SkillExtraItems.h index c4e20b9fbef..0cf49021e1c 100755 --- a/src/server/game/Skills/SkillExtraItems.h +++ b/src/server/game/Skills/SkillExtraItems.h @@ -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 - diff --git a/src/server/game/Weather/Weather.h b/src/server/game/Weather/Weather.h index 0c17cfd1efe..dadd1151a53 100755 --- a/src/server/game/Weather/Weather.h +++ b/src/server/game/Weather/Weather.h @@ -89,4 +89,3 @@ class Weather WeatherData const* m_weatherChances; }; #endif - diff --git a/src/server/scripts/OutdoorPvP/OutdoorPvPEP.cpp b/src/server/scripts/OutdoorPvP/OutdoorPvPEP.cpp index 6eb306b52af..1db4fb4dfc9 100755 --- a/src/server/scripts/OutdoorPvP/OutdoorPvPEP.cpp +++ b/src/server/scripts/OutdoorPvP/OutdoorPvPEP.cpp @@ -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() diff --git a/src/server/scripts/OutdoorPvP/OutdoorPvPEP.h b/src/server/scripts/OutdoorPvP/OutdoorPvPEP.h index e019ba7ed7b..14712e0150d 100755 --- a/src/server/scripts/OutdoorPvP/OutdoorPvPEP.h +++ b/src/server/scripts/OutdoorPvP/OutdoorPvPEP.h @@ -329,4 +329,3 @@ class OutdoorPvPEP : public OutdoorPvP }; #endif - diff --git a/src/server/scripts/OutdoorPvP/OutdoorPvPZM.cpp b/src/server/scripts/OutdoorPvP/OutdoorPvPZM.cpp index 5b3468de203..38fed30f542 100755 --- a/src/server/scripts/OutdoorPvP/OutdoorPvPZM.cpp +++ b/src/server/scripts/OutdoorPvP/OutdoorPvPZM.cpp @@ -176,7 +176,6 @@ OutdoorPvPZM::OutdoorPvPZM() m_GraveYard = NULL; m_AllianceTowersControlled = 0; m_HordeTowersControlled = 0; - } bool OutdoorPvPZM::SetupOutdoorPvP() -- cgit v1.2.3 From 1e94ab8d51eda1e139a0f6d06b5843dcf9f10ef7 Mon Sep 17 00:00:00 2001 From: Gyx <2359980687@qq.com> Date: Sat, 17 Mar 2012 20:13:37 +0800 Subject: Core/Game: Code style and remove unused core. Signed-off-by: Gyx <2359980687@qq.com> --- src/server/game/Chat/Commands/Level0.cpp | 8 ++--- src/server/game/Chat/Commands/Level1.cpp | 19 ++++------- src/server/game/Chat/Commands/Level2.cpp | 9 ++---- src/server/game/Chat/Commands/Level3.cpp | 31 +++++++----------- src/server/game/DataStores/DBCStores.cpp | 4 ++- src/server/game/Entities/Creature/Creature.cpp | 8 +++-- src/server/game/Entities/Pet/Pet.cpp | 3 +- src/server/game/Entities/Player/Player.cpp | 39 +++++++++++++++-------- src/server/game/Handlers/BattleGroundHandler.cpp | 3 +- src/server/game/Handlers/QuestHandler.cpp | 3 +- src/server/game/Spells/Auras/SpellAuraEffects.cpp | 16 +++++++--- src/server/game/Spells/SpellEffects.cpp | 4 ++- src/server/game/Tools/PlayerDump.cpp | 3 +- 13 files changed, 83 insertions(+), 67 deletions(-) (limited to 'src/server/game/Handlers/QuestHandler.cpp') diff --git a/src/server/game/Chat/Commands/Level0.cpp b/src/server/game/Chat/Commands/Level0.cpp index 6d33a5761f4..bb744016257 100755 --- a/src/server/game/Chat/Commands/Level0.cpp +++ b/src/server/game/Chat/Commands/Level0.cpp @@ -70,11 +70,11 @@ bool ChatHandler::HandleStartCommand(const char* /*args*/) return false; } - if ((chr->isDead()) || (chr->HasFlag(PLAYER_FLAGS, PLAYER_FLAGS_GHOST))) + if (chr->isDead() || chr->HasFlag(PLAYER_FLAGS, PLAYER_FLAGS_GHOST)) { - // if player is dead and stuck, send ghost to graveyard - chr->RepopAtGraveyard(); - return true; + // if player is dead and stuck, send ghost to graveyard + chr->RepopAtGraveyard(); + return true; } // cast spell Stuck diff --git a/src/server/game/Chat/Commands/Level1.cpp b/src/server/game/Chat/Commands/Level1.cpp index cb42863ca73..a5647d2a5c0 100755 --- a/src/server/game/Chat/Commands/Level1.cpp +++ b/src/server/game/Chat/Commands/Level1.cpp @@ -42,7 +42,6 @@ bool ChatHandler::HandleNameAnnounceCommand(const char* args) { - WorldPacket data; if (!*args) return false; @@ -56,7 +55,6 @@ bool ChatHandler::HandleNameAnnounceCommand(const char* args) bool ChatHandler::HandleGMNameAnnounceCommand(const char* args) { - WorldPacket data; if (!*args) return false; @@ -422,13 +420,10 @@ bool ChatHandler::HandleTaxiCheatCommand(const char* args) std::string argstr = (char*)args; Player* chr = getSelectedPlayer(); - if (!chr) - { - chr=m_session->GetPlayer(); - } - // check online security - else if (HasLowerSecurity(chr, 0)) + if (!chr) + chr = m_session->GetPlayer(); + else if (HasLowerSecurity(chr, 0)) // check online security return false; if (argstr == "on") @@ -474,12 +469,12 @@ bool ChatHandler::HandleLookupAreaCommand(const char* args) wstrToLower (wnamepart); // Search in AreaTable.dbc - for (uint32 areaflag = 0; areaflag < sAreaStore.GetNumRows (); ++areaflag) + for (uint32 areaflag = 0; areaflag < sAreaStore.GetNumRows(); ++areaflag) { - AreaTableEntry const* areaEntry = sAreaStore.LookupEntry (areaflag); + AreaTableEntry const* areaEntry = sAreaStore.LookupEntry(areaflag); if (areaEntry) { - int loc = GetSessionDbcLocale (); + int loc = GetSessionDbcLocale(); std::string name = areaEntry->area_name[loc]; if (name.empty()) continue; @@ -489,7 +484,7 @@ bool ChatHandler::HandleLookupAreaCommand(const char* args) loc = 0; for (; loc < TOTAL_LOCALES; ++loc) { - if (loc == GetSessionDbcLocale ()) + if (loc == GetSessionDbcLocale()) continue; name = areaEntry->area_name[loc]; diff --git a/src/server/game/Chat/Commands/Level2.cpp b/src/server/game/Chat/Commands/Level2.cpp index 68961b9de61..062cdb331ea 100755 --- a/src/server/game/Chat/Commands/Level2.cpp +++ b/src/server/game/Chat/Commands/Level2.cpp @@ -175,7 +175,6 @@ bool ChatHandler::HandleItemMoveCommand(const char* args) { if (!*args) return false; - uint8 srcslot, dstslot; char* pParam1 = strtok((char*)args, " "); if (!pParam1) @@ -185,8 +184,8 @@ bool ChatHandler::HandleItemMoveCommand(const char* args) if (!pParam2) return false; - srcslot = (uint8)atoi(pParam1); - dstslot = (uint8)atoi(pParam2); + uint8 srcslot = (uint8)atoi(pParam1); + uint8 dstslot = (uint8)atoi(pParam2); if (srcslot == dstslot) return true; @@ -279,7 +278,6 @@ bool ChatHandler::HandlePInfoCommand(const char* args) uint32 areaId; uint32 phase = 0; - // get additional information from Player object if (target) { @@ -756,7 +754,6 @@ bool ChatHandler::HandleLookupPlayerAccountCommand(const char* args) bool ChatHandler::HandleLookupPlayerEmailCommand(const char* args) { - if (!*args) return false; @@ -768,7 +765,7 @@ bool ChatHandler::HandleLookupPlayerEmailCommand(const char* args) QueryResult result = LoginDatabase.PQuery ("SELECT id, username FROM account WHERE email = '%s'", email.c_str ()); - return LookupPlayerSearchCommand (result, limit); + return LookupPlayerSearchCommand(result, limit); } bool ChatHandler::LookupPlayerSearchCommand(QueryResult result, int32 limit) diff --git a/src/server/game/Chat/Commands/Level3.cpp b/src/server/game/Chat/Commands/Level3.cpp index cb3eb825354..0b7bbf9e7ba 100755 --- a/src/server/game/Chat/Commands/Level3.cpp +++ b/src/server/game/Chat/Commands/Level3.cpp @@ -87,11 +87,10 @@ bool ChatHandler::HandleSetSkillCommand(const char *args) return false; char *level_p = strtok (NULL, " "); - if (!level_p) return false; - char *max_p = strtok (NULL, " "); + char *max_p = strtok (NULL, " "); int32 skill = atoi(skill_p); if (skill <= 0) @@ -128,7 +127,7 @@ bool ChatHandler::HandleSetSkillCommand(const char *args) return false; } - int32 max = max_p ? atol (max_p) : target->GetPureMaxSkillValue(skill); + int32 max = max_p ? atol (max_p) : target->GetPureMaxSkillValue(skill); if (level <= 0 || level > max || max <= 0) return false; @@ -631,7 +630,7 @@ bool ChatHandler::HandleListObjectCommand(const char *args) QueryResult result; uint32 obj_count = 0; - result=WorldDatabase.PQuery("SELECT COUNT(guid) FROM gameobject WHERE id='%u'", go_id); + result = WorldDatabase.PQuery("SELECT COUNT(guid) FROM gameobject WHERE id='%u'", go_id); if (result) obj_count = (*result)[0].GetUInt32(); @@ -703,7 +702,7 @@ bool ChatHandler::HandleListCreatureCommand(const char *args) QueryResult result; uint32 cr_count = 0; - result=WorldDatabase.PQuery("SELECT COUNT(guid) FROM creature WHERE id='%u'", cr_id); + result = WorldDatabase.PQuery("SELECT COUNT(guid) FROM creature WHERE id='%u'", cr_id); if (result) cr_count = (*result)[0].GetUInt32(); @@ -2143,16 +2142,12 @@ bool ChatHandler::HandleExploreCheatCommand(const char *args) ChatHandler(chr).PSendSysMessage(LANG_YOURS_EXPLORE_SET_NOTHING, GetNameLink().c_str()); } - for (uint8 i=0; iGetPlayer()->SetFlag(PLAYER_EXPLORED_ZONES_1+i, 0xFFFFFFFF); - } else - { m_session->GetPlayer()->SetFlag(PLAYER_EXPLORED_ZONES_1+i, 0); - } } return true; @@ -2434,7 +2429,9 @@ bool ChatHandler::HandleListAurasCommand (const char * /*args*/) for (uint16 i = 0; i < TOTAL_AURAS; ++i) { Unit::AuraEffectList const& uAuraList = unit->GetAuraEffectsByType(AuraType(i)); - if (uAuraList.empty()) continue; + if (uAuraList.empty()) + continue; + PSendSysMessage(LANG_COMMAND_TARGET_LISTAURATYPE, uAuraList.size(), i); for (Unit::AuraEffectList::const_iterator itr = uAuraList.begin(); itr != uAuraList.end(); ++itr) { @@ -2739,7 +2736,7 @@ bool ChatHandler::HandleServerShutDownCommand(const char *args) if (exitcode < 0 || exitcode > 125) return false; - sWorld->ShutdownServ (time, 0, exitcode); + sWorld->ShutdownServ(time, 0, exitcode); } else sWorld->ShutdownServ(time, 0, SHUTDOWN_EXIT_CODE); @@ -2774,7 +2771,7 @@ bool ChatHandler::HandleServerRestartCommand(const char *args) if (exitcode < 0 || exitcode > 125) return false; - sWorld->ShutdownServ (time, SHUTDOWN_MASK_RESTART, exitcode); + sWorld->ShutdownServ(time, SHUTDOWN_MASK_RESTART, exitcode); } else sWorld->ShutdownServ(time, SHUTDOWN_MASK_RESTART, RESTART_EXIT_CODE); @@ -2809,7 +2806,7 @@ bool ChatHandler::HandleServerIdleRestartCommand(const char *args) if (exitcode < 0 || exitcode > 125) return false; - sWorld->ShutdownServ (time, SHUTDOWN_MASK_RESTART|SHUTDOWN_MASK_IDLE, exitcode); + sWorld->ShutdownServ(time, SHUTDOWN_MASK_RESTART|SHUTDOWN_MASK_IDLE, exitcode); } else sWorld->ShutdownServ(time, SHUTDOWN_MASK_RESTART|SHUTDOWN_MASK_IDLE, RESTART_EXIT_CODE); @@ -2844,7 +2841,7 @@ bool ChatHandler::HandleServerIdleShutDownCommand(const char *args) if (exitcode < 0 || exitcode > 125) return false; - sWorld->ShutdownServ (time, SHUTDOWN_MASK_IDLE, exitcode); + sWorld->ShutdownServ(time, SHUTDOWN_MASK_IDLE, exitcode); } else sWorld->ShutdownServ(time, SHUTDOWN_MASK_IDLE, SHUTDOWN_EXIT_CODE); @@ -4494,10 +4491,6 @@ bool ChatHandler::HandleChannelSetOwnership(const char *args) return true; } -/*------------------------------------------ - *-------------TRINITY---------------------- - *-------------------------------------*/ - bool ChatHandler::HandlePlayAllCommand(const char *args) { if (!*args) diff --git a/src/server/game/DataStores/DBCStores.cpp b/src/server/game/DataStores/DBCStores.cpp index cbff5c900f6..65a51da037f 100755 --- a/src/server/game/DataStores/DBCStores.cpp +++ b/src/server/game/DataStores/DBCStores.cpp @@ -474,7 +474,9 @@ void LoadDBCStores(const std::string& dataPath) for (unsigned int i = 0; i < sTalentStore.GetNumRows(); ++i) { TalentEntry const* talentInfo = sTalentStore.LookupEntry(i); - if (!talentInfo) continue; + if (!talentInfo) + continue; + for (int j = 0; j < MAX_TALENT_RANK; j++) if (talentInfo->RankID[j]) sTalentSpellPosMap[talentInfo->RankID[j]] = TalentSpellPos(i, j); diff --git a/src/server/game/Entities/Creature/Creature.cpp b/src/server/game/Entities/Creature/Creature.cpp index 94dfa938cb8..ca893a7c482 100755 --- a/src/server/game/Entities/Creature/Creature.cpp +++ b/src/server/game/Entities/Creature/Creature.cpp @@ -1695,13 +1695,14 @@ SpellInfo const* Creature::reachWithSpellAttack(Unit* victim) (spellInfo->Effects[j].Effect == SPELL_EFFECT_INSTAKILL) || (spellInfo->Effects[j].Effect == SPELL_EFFECT_ENVIRONMENTAL_DAMAGE) || (spellInfo->Effects[j].Effect == SPELL_EFFECT_HEALTH_LEECH) -) + ) { bcontinue = false; break; } } - if (bcontinue) continue; + if (bcontinue) + continue; if (spellInfo->ManaCost > GetPower(POWER_MANA)) continue; @@ -1744,7 +1745,8 @@ SpellInfo const* Creature::reachWithSpellCure(Unit* victim) break; } } - if (bcontinue) continue; + if (bcontinue) + continue; if (spellInfo->ManaCost > GetPower(POWER_MANA)) continue; diff --git a/src/server/game/Entities/Pet/Pet.cpp b/src/server/game/Entities/Pet/Pet.cpp index e7103e2cb70..3221017e108 100755 --- a/src/server/game/Entities/Pet/Pet.cpp +++ b/src/server/game/Entities/Pet/Pet.cpp @@ -1336,7 +1336,8 @@ bool Pet::addSpell(uint32 spellId, ActiveStates active /*= ACT_DECIDE*/, PetSpel { for (PetSpellMap::const_iterator itr2 = m_spells.begin(); itr2 != m_spells.end(); ++itr2) { - if (itr2->second.state == PETSPELL_REMOVED) continue; + if (itr2->second.state == PETSPELL_REMOVED) + continue; SpellInfo const* oldRankSpellInfo = sSpellMgr->GetSpellInfo(itr2->first); diff --git a/src/server/game/Entities/Player/Player.cpp b/src/server/game/Entities/Player/Player.cpp index ffa216dd605..bd5b1010f45 100755 --- a/src/server/game/Entities/Player/Player.cpp +++ b/src/server/game/Entities/Player/Player.cpp @@ -3692,9 +3692,12 @@ bool Player::addSpell(uint32 spellId, bool active, bool learning, bool dependent { for (PlayerSpellMap::iterator itr2 = m_spells.begin(); itr2 != m_spells.end(); ++itr2) { - if (itr2->second->state == PLAYERSPELL_REMOVED) continue; + if (itr2->second->state == PLAYERSPELL_REMOVED) + continue; + SpellInfo const* i_spellInfo = sSpellMgr->GetSpellInfo(itr2->first); - if (!i_spellInfo) continue; + if (!i_spellInfo) + continue; if (spellInfo->IsDifferentRankOf(i_spellInfo)) { @@ -8293,7 +8296,9 @@ void Player::CastItemCombatSpell(Unit* target, WeaponAttackType attType, uint32 { uint32 enchant_id = item->GetEnchantmentId(EnchantmentSlot(e_slot)); SpellItemEnchantmentEntry const* pEnchant = sSpellItemEnchantmentStore.LookupEntry(enchant_id); - if (!pEnchant) continue; + if (!pEnchant) + continue; + for (uint8 s = 0; s < MAX_ITEM_ENCHANTMENT_EFFECTS; ++s) { if (pEnchant->type[s] != ITEM_ENCHANTMENT_TYPE_COMBAT_SPELL) @@ -11165,7 +11170,8 @@ InventoryResult Player::CanStoreItems(Item** pItems, int count) const Item* pItem = pItems[k]; // no item - if (!pItem) continue; + if (!pItem) + continue; sLog->outDebug(LOG_FILTER_PLAYER_ITEMS, "STORAGE: CanStoreItems %i. item = %u, count = %u", k + 1, pItem->GetEntry(), pItem->GetCount()); ItemTemplate const* pProto = pItem->GetTemplate(); @@ -11204,7 +11210,8 @@ InventoryResult Player::CanStoreItems(Item** pItems, int count) const break; } } - if (b_found) continue; + if (b_found) + continue; for (int t = CURRENCYTOKEN_SLOT_START; t < CURRENCYTOKEN_SLOT_END; ++t) { @@ -11216,7 +11223,8 @@ InventoryResult Player::CanStoreItems(Item** pItems, int count) const break; } } - if (b_found) continue; + if (b_found) + continue; for (int t = INVENTORY_SLOT_ITEM_START; t < INVENTORY_SLOT_ITEM_END; ++t) { @@ -11228,7 +11236,8 @@ InventoryResult Player::CanStoreItems(Item** pItems, int count) const break; } } - if (b_found) continue; + if (b_found) + continue; for (int t = INVENTORY_SLOT_BAG_START; !b_found && t < INVENTORY_SLOT_BAG_END; ++t) { @@ -11249,7 +11258,8 @@ InventoryResult Player::CanStoreItems(Item** pItems, int count) const } } } - if (b_found) continue; + if (b_found) + continue; } // special bag case @@ -11270,7 +11280,8 @@ InventoryResult Player::CanStoreItems(Item** pItems, int count) const } } - if (b_found) continue; + if (b_found) + continue; if (pProto->BagFamily & BAG_FAMILY_MASK_CURRENCY_TOKENS) { @@ -11285,7 +11296,8 @@ InventoryResult Player::CanStoreItems(Item** pItems, int count) const } } - if (b_found) continue; + if (b_found) + continue; for (int t = INVENTORY_SLOT_BAG_START; !b_found && t < INVENTORY_SLOT_BAG_END; ++t) { @@ -11309,7 +11321,8 @@ InventoryResult Player::CanStoreItems(Item** pItems, int count) const } } } - if (b_found) continue; + if (b_found) + continue; } // search free slot @@ -11323,7 +11336,8 @@ InventoryResult Player::CanStoreItems(Item** pItems, int count) const break; } } - if (b_found) continue; + if (b_found) + continue; // search free slot in bags for (int t = INVENTORY_SLOT_BAG_START; !b_found && t < INVENTORY_SLOT_BAG_END; ++t) @@ -23353,7 +23367,6 @@ void Player::SetTitle(CharTitlesEntry const* title, bool lost) GetSession()->SendPacket(&data); } -/*-----------------------TRINITY--------------------------*/ bool Player::isTotalImmunity() { AuraEffectList const& immune = GetAuraEffectsByType(SPELL_AURA_SCHOOL_IMMUNITY); diff --git a/src/server/game/Handlers/BattleGroundHandler.cpp b/src/server/game/Handlers/BattleGroundHandler.cpp index e11f6e5b4e2..a0c5268136b 100755 --- a/src/server/game/Handlers/BattleGroundHandler.cpp +++ b/src/server/game/Handlers/BattleGroundHandler.cpp @@ -216,7 +216,8 @@ void WorldSession::HandleBattlemasterJoinOpcode(WorldPacket & recv_data) for (GroupReference* itr = grp->GetFirstMember(); itr != NULL; itr = itr->next()) { Player* member = itr->getSource(); - if (!member) continue; // this should never happen + if (!member) + continue; // this should never happen WorldPacket data; diff --git a/src/server/game/Handlers/QuestHandler.cpp b/src/server/game/Handlers/QuestHandler.cpp index 73bbc58c445..34fed5e9a97 100755 --- a/src/server/game/Handlers/QuestHandler.cpp +++ b/src/server/game/Handlers/QuestHandler.cpp @@ -643,7 +643,8 @@ uint32 WorldSession::getDialogStatus(Player* player, Object* questgiver, uint32 uint32 result2 = 0; uint32 quest_id = i->second; Quest const* quest = sObjectMgr->GetQuestTemplate(quest_id); - if (!quest) continue; + if (!quest) + continue; ConditionList conditions = sConditionMgr->GetConditionsForNotGroupedEntry(CONDITION_SOURCE_TYPE_QUEST_SHOW_MARK, quest->GetQuestId()); if (!sConditionMgr->IsObjectMeetToConditions(player, conditions)) diff --git a/src/server/game/Spells/Auras/SpellAuraEffects.cpp b/src/server/game/Spells/Auras/SpellAuraEffects.cpp index 9400ec1e798..3c266c7139c 100755 --- a/src/server/game/Spells/Auras/SpellAuraEffects.cpp +++ b/src/server/game/Spells/Auras/SpellAuraEffects.cpp @@ -1462,10 +1462,16 @@ void AuraEffect::HandleShapeshiftBoosts(Unit* target, bool apply) const const PlayerSpellMap& sp_list = target->ToPlayer()->GetSpellMap(); for (PlayerSpellMap::const_iterator itr = sp_list.begin(); itr != sp_list.end(); ++itr) { - if (itr->second->state == PLAYERSPELL_REMOVED || itr->second->disabled) continue; - if (itr->first == spellId || itr->first == spellId2) continue; + if (itr->second->state == PLAYERSPELL_REMOVED || itr->second->disabled) + continue; + + if (itr->first == spellId || itr->first == spellId2) + continue; + SpellInfo const* spellInfo = sSpellMgr->GetSpellInfo(itr->first); - if (!spellInfo || !(spellInfo->Attributes & (SPELL_ATTR0_PASSIVE | SPELL_ATTR0_HIDDEN_CLIENTSIDE))) continue; + if (!spellInfo || !(spellInfo->Attributes & (SPELL_ATTR0_PASSIVE | SPELL_ATTR0_HIDDEN_CLIENTSIDE))) + continue; + if (spellInfo->Stances & (1<<(GetMiscValue()-1))) target->CastSpell(target, itr->first, true, NULL, this); } @@ -2069,7 +2075,9 @@ void AuraEffect::HandleAuraModShapeshift(AuraApplication const* aurApp, uint8 mo PlayerSpellMap const& sp_list = target->ToPlayer()->GetSpellMap(); for (PlayerSpellMap::const_iterator itr = sp_list.begin(); itr != sp_list.end(); ++itr) { - if (itr->second->state == PLAYERSPELL_REMOVED || itr->second->disabled) continue; + if (itr->second->state == PLAYERSPELL_REMOVED || itr->second->disabled) + continue; + SpellInfo const* spellInfo = sSpellMgr->GetSpellInfo(itr->first); if (spellInfo && spellInfo->SpellFamilyName == SPELLFAMILY_WARRIOR && spellInfo->SpellIconID == 139) Rage_val += target->CalculateSpellDamage(target, spellInfo, 0) * 10; diff --git a/src/server/game/Spells/SpellEffects.cpp b/src/server/game/Spells/SpellEffects.cpp index 01782ba4312..56cc6b6f8ec 100755 --- a/src/server/game/Spells/SpellEffects.cpp +++ b/src/server/game/Spells/SpellEffects.cpp @@ -4038,7 +4038,9 @@ void Spell::EffectScriptEffect(SpellEffIndex effIndex) while (bag) // 256 = 0 due to var type { item = m_caster->ToPlayer()->GetItemByPos(bag, slot); - if (item && item->GetEntry() == 38587) break; + if (item && item->GetEntry() == 38587) + break; + ++slot; if (slot == 39) { diff --git a/src/server/game/Tools/PlayerDump.cpp b/src/server/game/Tools/PlayerDump.cpp index 4d9c5a93875..900fcf7392a 100644 --- a/src/server/game/Tools/PlayerDump.cpp +++ b/src/server/game/Tools/PlayerDump.cpp @@ -452,7 +452,8 @@ DumpReturn PlayerDumpReader::LoadDump(const std::string& file, uint32 account, s { if (!fgets(buf, 32000, fin)) { - if (feof(fin)) break; + if (feof(fin)) + break; ROLLBACK(DUMP_FILE_BROKEN); } -- cgit v1.2.3 From ff77610e1d3fee89507b8469b10bea800f8c0815 Mon Sep 17 00:00:00 2001 From: kaelima Date: Tue, 5 Jun 2012 10:30:44 +0200 Subject: Core/Quests: Fixed auto-accepting chain quests Closes #6475 --- src/server/game/Handlers/QuestHandler.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/server/game/Handlers/QuestHandler.cpp') diff --git a/src/server/game/Handlers/QuestHandler.cpp b/src/server/game/Handlers/QuestHandler.cpp index 34fed5e9a97..ca5a5c311c5 100755 --- a/src/server/game/Handlers/QuestHandler.cpp +++ b/src/server/game/Handlers/QuestHandler.cpp @@ -324,7 +324,7 @@ void WorldSession::HandleQuestgiverChooseRewardOpcode(WorldPacket & recv_data) // Send next quest if (Quest const* nextQuest = _player->GetNextQuest(guid, quest)) { - if (nextQuest->IsAutoAccept() && _player->CanAddQuest(nextQuest, true) && _player->CanTakeQuest(quest, true)) + if (nextQuest->IsAutoAccept() && _player->CanAddQuest(nextQuest, true) && _player->CanTakeQuest(nextQuest, true)) { _player->AddQuest(nextQuest, object); if (_player->CanCompleteQuest(nextQuest->GetQuestId())) -- cgit v1.2.3 From c6c23b7f7ef148f88b64346a44a46f51d2cad212 Mon Sep 17 00:00:00 2001 From: kaelima Date: Tue, 12 Jun 2012 18:14:33 +0200 Subject: Core/DungeonFinder: - Prevent players from vote kicking in combat (basic implementation, still needs a timer) partially closes #2563 - Prevent players from teleporting to a finished dungeon using macro commands. Closes #6748 Also add a missing change for ff77610e1d3fee89507b8469b10bea800f8c0815 thanks 2010phenix for the hint. --- src/server/game/DungeonFinding/LFGMgr.cpp | 13 ++++++------- src/server/game/Entities/Player/Player.cpp | 8 ++++++-- src/server/game/Handlers/QuestHandler.cpp | 2 +- src/server/game/Server/Protocol/PacketLog.cpp | 2 +- 4 files changed, 14 insertions(+), 11 deletions(-) (limited to 'src/server/game/Handlers/QuestHandler.cpp') diff --git a/src/server/game/DungeonFinding/LFGMgr.cpp b/src/server/game/DungeonFinding/LFGMgr.cpp index 47c298d7467..f63d3172e52 100755 --- a/src/server/game/DungeonFinding/LFGMgr.cpp +++ b/src/server/game/DungeonFinding/LFGMgr.cpp @@ -1626,6 +1626,7 @@ void LFGMgr::InitBoot(Group* grp, uint64 kicker, uint64 victim, std::string reas { if (!grp) return; + uint64 gguid = grp->GetGUID(); SetState(gguid, LFG_STATE_BOOT); @@ -1635,7 +1636,6 @@ void LFGMgr::InitBoot(Group* grp, uint64 kicker, uint64 victim, std::string reas pBoot->reason = reason; pBoot->victim = victim; pBoot->votedNeeded = GetVotesNeeded(gguid); - PlayerSet players; // Set votes for (GroupReference* itr = grp->GetFirstMember(); itr != NULL; itr = itr->next()) @@ -1651,15 +1651,11 @@ void LFGMgr::InitBoot(Group* grp, uint64 kicker, uint64 victim, std::string reas else { pBoot->votes[guid] = LFG_ANSWER_PENDING; // Other members need to vote - players.insert(plrg); + plrg->GetSession()->SendLfgBootPlayer(pBoot); } } } - // Notify players - for (PlayerSet::const_iterator it = players.begin(); it != players.end(); ++it) - (*it)->GetSession()->SendLfgBootPlayer(pBoot); - m_Boots[grp->GetLowGUID()] = pBoot; } @@ -1770,6 +1766,9 @@ void LFGMgr::TeleportPlayer(Player* player, bool out, bool fromOpcode /*= false* uint64 gguid = grp->GetGUID(); LFGDungeonEntry const* dungeon = sLFGDungeonStore.LookupEntry(GetDungeon(gguid)); + if (GetState(gguid) == LFG_STATE_FINISHED_DUNGEON) + error = LFG_TELEPORTERROR_INVALID_LOCATION; + if (!dungeon) error = LFG_TELEPORTERROR_INVALID_LOCATION; else if (player->GetMapId() != uint32(dungeon->map)) // Do not teleport players in dungeon to the entrance @@ -1817,7 +1816,7 @@ void LFGMgr::TeleportPlayer(Player* player, bool out, bool fromOpcode /*= false* if (error == LFG_TELEPORTERROR_OK) { - if (!player->GetMap()->IsDungeon() && !player->GetMap()->IsRaid()) + if (!player->GetMap()->IsDungeon()) player->SetBattlegroundEntryPoint(); if (player->isInFlight()) diff --git a/src/server/game/Entities/Player/Player.cpp b/src/server/game/Entities/Player/Player.cpp index 53defc0c017..5dd3acfa13c 100755 --- a/src/server/game/Entities/Player/Player.cpp +++ b/src/server/game/Entities/Player/Player.cpp @@ -23362,7 +23362,7 @@ Player* Player::GetNextRandomRaidMember(float radius) PartyResult Player::CanUninviteFromGroup() const { - const Group* grp = GetGroup(); + Group const* grp = GetGroup(); if (!grp) return ERR_NOT_IN_GROUP; @@ -23385,8 +23385,12 @@ PartyResult Player::CanUninviteFromGroup() const if (grp->isRollLootActive()) return ERR_PARTY_LFG_BOOT_LOOT_ROLLS; + // TODO: Should also be sent when anyone has recently left combat, with an aprox ~5 seconds timer. + for (GroupReference* itr = grp->GetFirstMember(); itr != NULL; itr = itr->next()) + if (itr->getSource() && itr->getSource()->isInCombat()) + return ERR_PARTY_LFG_BOOT_IN_COMBAT; + /* Missing support for these types - return ERR_PARTY_LFG_BOOT_IN_COMBAT; // also have a cooldown (some secs after combat finish return ERR_PARTY_LFG_BOOT_COOLDOWN_S; return ERR_PARTY_LFG_BOOT_NOT_ELIGIBLE_S; */ diff --git a/src/server/game/Handlers/QuestHandler.cpp b/src/server/game/Handlers/QuestHandler.cpp index ca5a5c311c5..d13c2fb0956 100755 --- a/src/server/game/Handlers/QuestHandler.cpp +++ b/src/server/game/Handlers/QuestHandler.cpp @@ -343,7 +343,7 @@ void WorldSession::HandleQuestgiverChooseRewardOpcode(WorldPacket & recv_data) // Send next quest if (Quest const* nextQuest = _player->GetNextQuest(guid, quest)) { - if (nextQuest->IsAutoAccept() && _player->CanAddQuest(nextQuest, true) && _player->CanTakeQuest(quest, true)) + if (nextQuest->IsAutoAccept() && _player->CanAddQuest(nextQuest, true) && _player->CanTakeQuest(nextQuest, true)) { _player->AddQuest(nextQuest, object); if (_player->CanCompleteQuest(nextQuest->GetQuestId())) diff --git a/src/server/game/Server/Protocol/PacketLog.cpp b/src/server/game/Server/Protocol/PacketLog.cpp index a8e184c369a..cb6dcdbdb9e 100644 --- a/src/server/game/Server/Protocol/PacketLog.cpp +++ b/src/server/game/Server/Protocol/PacketLog.cpp @@ -51,7 +51,7 @@ void PacketLog::LogPacket(WorldPacket const& packet, Direction direction) ByteBuffer data(4+4+4+1+packet.size()); data << int32(packet.GetOpcode()); data << int32(packet.size()); - data << int32(time(NULL)); + data << uint32(time(NULL)); data << uint8(direction); for (uint32 i = 0; i < packet.size(); i++) -- cgit v1.2.3