Apply style fix pt2

This commit is contained in:
Antz 2020-01-12 00:21:01 +00:00
parent 35405dd549
commit 1392c131e7
77 changed files with 1318 additions and 817 deletions

View file

@ -828,7 +828,10 @@ bool AuctionBotBuyer::IsBuyableEntry(uint64 buyoutPrice, double InGame_BuyPrice,
{ {
Chance = MaxChance - (ratio * (MaxChance / 10)); Chance = MaxChance - (ratio * (MaxChance / 10));
} }
else { Chance = 1; } else
{
Chance = 1;
}
} }
} }
} }
@ -847,7 +850,10 @@ bool AuctionBotBuyer::IsBuyableEntry(uint64 buyoutPrice, double InGame_BuyPrice,
{ {
Chance = (MaxChance / 5) - (ratio * (MaxChance / 50)); Chance = (MaxChance / 5) - (ratio * (MaxChance / 50));
} }
else { Chance = 1; } else
{
Chance = 1;
}
} }
} }
} }
@ -862,9 +868,15 @@ bool AuctionBotBuyer::IsBuyableEntry(uint64 buyoutPrice, double InGame_BuyPrice,
{ {
Chance = (MaxChance / 5) - (ratio * (MaxChance / 50)); Chance = (MaxChance / 5) - (ratio * (MaxChance / 50));
} }
else { Chance = 0; } else
{
Chance = 0;
}
}
else
{
Chance = 0;
} }
else { Chance = 0; }
} }
uint32 RandNum = urand(1, ChanceRatio); uint32 RandNum = urand(1, ChanceRatio);
if (RandNum <= Chance) if (RandNum <= Chance)
@ -1056,8 +1068,14 @@ void AuctionBotBuyer::addNewAuctionBuyerBotBid(AHB_Buyer_Config& config)
if (IsBuyableEntry(buyoutPrice, InGame_BuyPrice, MaxBuyablePrice, minBuyPrice, MaxChance, config.FactionChance)) if (IsBuyableEntry(buyoutPrice, InGame_BuyPrice, MaxBuyablePrice, minBuyPrice, MaxChance, config.FactionChance))
{ {
if (IsBidableEntry(bidPriceByItem, InGame_BuyPrice, MaxBidablePrice, minBidPrice, MaxChance / 2, config.FactionChance)) if (IsBidableEntry(bidPriceByItem, InGame_BuyPrice, MaxBidablePrice, minBidPrice, MaxChance / 2, config.FactionChance))
if (urand(0, 5) == 0) { PlaceBidToEntry(auction, bidPrice); } if (urand(0, 5) == 0)
else { BuyEntry(auction); } {
PlaceBidToEntry(auction, bidPrice);
}
else
{
BuyEntry(auction);
}
else else
{ BuyEntry(auction); } { BuyEntry(auction); }
} }
@ -1093,7 +1111,10 @@ bool AuctionBotBuyer::Update(AuctionHouseType houseType)
} }
return true; return true;
} }
else { return false; } else
{
return false;
}
} }
//== AuctionBotSeller functions ============================ //== AuctionBotSeller functions ============================
@ -1898,7 +1919,10 @@ void AuctionBotSeller::addNewAuctions(AHB_Seller_Config& config)
items = sAuctionBotConfig.GetItemPerCycleBoost(); items = sAuctionBotConfig.GetItemPerCycleBoost();
BASIC_FILTER_LOG(LOG_FILTER_AHBOT_BUYER, "AHBot: Boost value used to fill AH! (if this happens often adjust both ItemsPerCycle in ahbot.conf)"); BASIC_FILTER_LOG(LOG_FILTER_AHBOT_BUYER, "AHBot: Boost value used to fill AH! (if this happens often adjust both ItemsPerCycle in ahbot.conf)");
} }
else { items = sAuctionBotConfig.GetItemPerCycleNormal(); } else
{
items = sAuctionBotConfig.GetItemPerCycleNormal();
}
uint32 houseid; uint32 houseid;
switch (config.GetHouseType()) switch (config.GetHouseType())

View file

@ -607,7 +607,10 @@ void BattleGround::SendPacketToTeam(Team teamId, WorldPacket* packet, Player* se
} }
Team team = itr->second.PlayerTeam; Team team = itr->second.PlayerTeam;
if (!team) { team = plr->GetTeam(); } if (!team)
{
team = plr->GetTeam();
}
if (team == teamId) if (team == teamId)
{ {
@ -651,7 +654,10 @@ void BattleGround::PlaySoundToTeam(uint32 SoundID, Team teamId)
} }
Team team = itr->second.PlayerTeam; Team team = itr->second.PlayerTeam;
if (!team) { team = plr->GetTeam(); } if (!team)
{
team = plr->GetTeam();
}
if (team == teamId) if (team == teamId)
{ {
@ -684,7 +690,10 @@ void BattleGround::CastSpellOnTeam(uint32 SpellID, Team teamId)
} }
Team team = itr->second.PlayerTeam; Team team = itr->second.PlayerTeam;
if (!team) { team = plr->GetTeam(); } if (!team)
{
team = plr->GetTeam();
}
if (team == teamId) if (team == teamId)
{ {
@ -716,7 +725,10 @@ void BattleGround::RewardHonorToTeam(uint32 Honor, Team teamId)
} }
Team team = itr->second.PlayerTeam; Team team = itr->second.PlayerTeam;
if (!team) { team = plr->GetTeam(); } if (!team)
{
team = plr->GetTeam();
}
if (team == teamId) if (team == teamId)
{ {
@ -756,7 +768,10 @@ void BattleGround::RewardReputationToTeam(uint32 faction_id, uint32 Reputation,
} }
Team team = itr->second.PlayerTeam; Team team = itr->second.PlayerTeam;
if (!team) { team = plr->GetTeam(); } if (!team)
{
team = plr->GetTeam();
}
if (team == teamId) if (team == teamId)
{ {
@ -1286,7 +1301,10 @@ void BattleGround::RemovePlayerAtLeave(ObjectGuid guid, bool Transport, bool Sen
{ {
plr->ClearAfkReports(); plr->ClearAfkReports();
if (!team) { team = plr->GetTeam(); } if (!team)
{
team = plr->GetTeam();
}
// if arena, remove the specific arena auras // if arena, remove the specific arena auras
if (isArena()) if (isArena())

View file

@ -1915,7 +1915,7 @@ uint32 BattleGroundMgr::CreateBattleGround(BattleGroundTypeId bgTypeId, bool IsA
// add bg to update list // add bg to update list
AddBattleGround(bg->GetInstanceID(), bg->GetTypeID(), bg); AddBattleGround(bg->GetInstanceID(), bg->GetTypeID(), bg);
#ifdef ENABLE_ELUNA #ifdef ENABLE_ELUNA
sEluna->OnBGCreate(bg, bgTypeId, bg->GetInstanceID()); sEluna->OnBGCreate(bg, bgTypeId, bg->GetInstanceID());
#endif /* ENABLE_ELUNA */ #endif /* ENABLE_ELUNA */

View file

@ -179,8 +179,8 @@ bool ChatHandler::HandleGMCommand(char* args)
if (!*args) if (!*args)
{ {
if (m_session->GetPlayer()->isGameMaster()) if (m_session->GetPlayer()->isGameMaster())
{ {
m_session->SendNotification(LANG_GM_ON); m_session->SendNotification(LANG_GM_ON);
} }
else else
{ {
@ -363,7 +363,10 @@ bool ChatHandler::HandleGPSCommand(char* args)
else else
{ PSendSysMessage("You are INdoor"); } { PSendSysMessage("You are INdoor"); }
} }
else { PSendSysMessage("no VMAP available for area info"); } else
{
PSendSysMessage("no VMAP available for area info");
}
PSendSysMessage(LANG_MAP_POSITION, PSendSysMessage(LANG_MAP_POSITION,
obj->GetMapId(), (mapEntry ? mapEntry->name[GetSessionDbcLocale()] : "<unknown>"), obj->GetMapId(), (mapEntry ? mapEntry->name[GetSessionDbcLocale()] : "<unknown>"),

View file

@ -5045,7 +5045,7 @@ bool ChatHandler::HandleLevelUpCommand(char* args)
return true; return true;
} }
} }
return false; return false;
} }
} }
@ -5464,7 +5464,10 @@ bool ChatHandler::HandleListAurasCommand(char* /*args*/)
for (int i = 0; i < TOTAL_AURAS; ++i) for (int i = 0; i < TOTAL_AURAS; ++i)
{ {
Unit::AuraList const& uAuraList = unit->GetAurasByType(AuraType(i)); Unit::AuraList const& uAuraList = unit->GetAurasByType(AuraType(i));
if (uAuraList.empty()) { continue; } if (uAuraList.empty())
{
continue;
}
PSendSysMessage(LANG_COMMAND_TARGET_LISTAURATYPE, uAuraList.size(), i); PSendSysMessage(LANG_COMMAND_TARGET_LISTAURATYPE, uAuraList.size(), i);
for (Unit::AuraList::const_iterator itr = uAuraList.begin(); itr != uAuraList.end(); ++itr) for (Unit::AuraList::const_iterator itr = uAuraList.begin(); itr != uAuraList.end(); ++itr)
{ {
@ -7226,7 +7229,10 @@ bool ChatHandler::HandleCastSelfCommand(char* args)
bool ChatHandler::HandleInstanceListBindsCommand(char* /*args*/) bool ChatHandler::HandleInstanceListBindsCommand(char* /*args*/)
{ {
Player* player = getSelectedPlayer(); Player* player = getSelectedPlayer();
if (!player) { player = m_session->GetPlayer(); } if (!player)
{
player = m_session->GetPlayer();
}
uint32 counter = 0; uint32 counter = 0;
for (uint8 i = 0; i < MAX_DIFFICULTY; ++i) for (uint8 i = 0; i < MAX_DIFFICULTY; ++i)
{ {

View file

@ -447,7 +447,10 @@ bool ChatHandler::HandleDebugGetItemStateCommand(char* args)
{ return false; } { return false; }
Player* player = getSelectedPlayer(); Player* player = getSelectedPlayer();
if (!player) { player = m_session->GetPlayer(); } if (!player)
{
player = m_session->GetPlayer();
}
if (!list_queue && !check_all) if (!list_queue && !check_all)
{ {
@ -461,7 +464,10 @@ bool ChatHandler::HandleDebugGetItemStateCommand(char* args)
} }
Item* item = player->GetItemByPos(INVENTORY_SLOT_BAG_0, i); Item* item = player->GetItemByPos(INVENTORY_SLOT_BAG_0, i);
if (!item) { continue; } if (!item)
{
continue;
}
if (!item->IsBag()) if (!item->IsBag())
{ {
if (item->GetState() == state) if (item->GetState() == state)
@ -489,7 +495,10 @@ bool ChatHandler::HandleDebugGetItemStateCommand(char* args)
for (size_t i = 0; i < updateQueue.size(); ++i) for (size_t i = 0; i < updateQueue.size(); ++i)
{ {
Item* item = updateQueue[i]; Item* item = updateQueue[i];
if (!item) { continue; } if (!item)
{
continue;
}
Bag* container = item->GetContainer(); Bag* container = item->GetContainer();
uint8 bag_slot = container ? container->GetSlot() : uint8(INVENTORY_SLOT_BAG_0); uint8 bag_slot = container ? container->GetSlot() : uint8(INVENTORY_SLOT_BAG_0);
@ -524,7 +533,10 @@ bool ChatHandler::HandleDebugGetItemStateCommand(char* args)
} }
Item* item = player->GetItemByPos(INVENTORY_SLOT_BAG_0, i); Item* item = player->GetItemByPos(INVENTORY_SLOT_BAG_0, i);
if (!item) { continue; } if (!item)
{
continue;
}
if (item->GetSlot() != i) if (item->GetSlot() != i)
{ {
@ -587,7 +599,10 @@ bool ChatHandler::HandleDebugGetItemStateCommand(char* args)
for (uint8 j = 0; j < bag->GetBagSize(); ++j) for (uint8 j = 0; j < bag->GetBagSize(); ++j)
{ {
Item* item2 = bag->GetItemByPos(j); Item* item2 = bag->GetItemByPos(j);
if (!item2) { continue; } if (!item2)
{
continue;
}
if (item2->GetSlot() != j) if (item2->GetSlot() != j)
{ {
@ -658,7 +673,10 @@ bool ChatHandler::HandleDebugGetItemStateCommand(char* args)
for (size_t i = 0; i < updateQueue.size(); ++i) for (size_t i = 0; i < updateQueue.size(); ++i)
{ {
Item* item = updateQueue[i]; Item* item = updateQueue[i];
if (!item) { continue; } if (!item)
{
continue;
}
if (item->GetOwnerGuid() != player->GetObjectGuid()) if (item->GetOwnerGuid() != player->GetObjectGuid())
{ {
@ -675,7 +693,10 @@ bool ChatHandler::HandleDebugGetItemStateCommand(char* args)
error = true; continue; error = true; continue;
} }
if (item->GetState() == ITEM_REMOVED) { continue; } if (item->GetState() == ITEM_REMOVED)
{
continue;
}
Item* test = player->GetItemByPos(item->GetBagSlot(), item->GetSlot()); Item* test = player->GetItemByPos(item->GetBagSlot(), item->GetSlot());
if (test == NULL) if (test == NULL)

View file

@ -2173,7 +2173,10 @@ SpellEntry const* Creature::ReachWithSpellAttack(Unit* pVictim)
break; break;
} }
} }
if (bcontinue) { continue; } if (bcontinue)
{
continue;
}
if(spellInfo->GetManaCost() > GetPower(POWER_MANA)) if(spellInfo->GetManaCost() > GetPower(POWER_MANA))
{ {

View file

@ -379,7 +379,10 @@ struct VendorItemData
VendorItem* GetItem(uint32 slot) const VendorItem* GetItem(uint32 slot) const
{ {
if (slot >= m_items.size()) { return NULL; } if (slot >= m_items.size())
{
return NULL;
}
return m_items[slot]; return m_items[slot];
} }
bool Empty() const { return m_items.empty(); } bool Empty() const { return m_items.empty(); }
@ -714,7 +717,7 @@ class Creature : public Unit
/** /**
* function indicating whether the recipient is a group. * function indicating whether the recipient is a group.
* *
* \return boolean true if the creature's recipient is a group, false otherwise. * \return boolean true if the creature's recipient is a group, false otherwise.
*/ */
bool IsGroupLootRecipient() const { return m_lootGroupRecipientId; } bool IsGroupLootRecipient() const { return m_lootGroupRecipientId; }

View file

@ -131,7 +131,7 @@ CanCastResult CreatureAI::DoCastSpellIfCan(Unit* pTarget, uint32 uiSpell, uint32
CanCastResult castResult = CanCastSpell(pTarget, pSpell, uiCastFlags & CAST_TRIGGERED); CanCastResult castResult = CanCastSpell(pTarget, pSpell, uiCastFlags & CAST_TRIGGERED);
if (castResult != CAST_OK) if (castResult != CAST_OK)
{ {
return castResult; return castResult;
} }
} }
@ -142,7 +142,7 @@ CanCastResult CreatureAI::DoCastSpellIfCan(Unit* pTarget, uint32 uiSpell, uint32
pCaster->InterruptNonMeleeSpells(false); pCaster->InterruptNonMeleeSpells(false);
} }
// Creature should always stop before it will cast a non-instant spell // Creature should always stop before it will cast a non-instant spell
if (GetSpellCastTime(pSpell)) if (GetSpellCastTime(pSpell))
pCaster->StopMoving(); pCaster->StopMoving();

View file

@ -74,17 +74,50 @@ namespace MaNGOS
inline uint32 GetZeroDifference(uint32 pl_level) inline uint32 GetZeroDifference(uint32 pl_level)
{ {
if (pl_level < 8) { return 5; } if (pl_level < 8)
if (pl_level < 10) { return 6; } {
if (pl_level < 12) { return 7; } return 5;
if (pl_level < 16) { return 8; } }
if (pl_level < 20) { return 9; } if (pl_level < 10)
if (pl_level < 30) { return 11; } {
if (pl_level < 40) { return 12; } return 6;
if (pl_level < 45) { return 13; } }
if (pl_level < 50) { return 14; } if (pl_level < 12)
if (pl_level < 55) { return 15; } {
if (pl_level < 60) { return 16; } return 7;
}
if (pl_level < 16)
{
return 8;
}
if (pl_level < 20)
{
return 9;
}
if (pl_level < 30)
{
return 11;
}
if (pl_level < 40)
{
return 12;
}
if (pl_level < 45)
{
return 13;
}
if (pl_level < 50)
{
return 14;
}
if (pl_level < 55)
{
return 15;
}
if (pl_level < 60)
{
return 16;
}
return 17; return 17;
} }

View file

@ -43,7 +43,7 @@ void GMTicketMgr::LoadGMTickets()
"SELECT guid, ticket_text, response_text, UNIX_TIMESTAMP(ticket_lastchange), ticket_id " "SELECT guid, ticket_text, response_text, UNIX_TIMESTAMP(ticket_lastchange), ticket_id "
"FROM character_ticket " "FROM character_ticket "
"ORDER BY ticket_id ASC"); "ORDER BY ticket_id ASC");
if (!result) if (!result)
{ {
BarGoLink bar(1); BarGoLink bar(1);

View file

@ -97,7 +97,7 @@ class GMTicket
m_lastUpdate = update; m_lastUpdate = update;
} }
/** /**
* Gets the \ref Player s \ref ObjectGuid which asked the question and created the ticket * Gets the \ref Player s \ref ObjectGuid which asked the question and created the ticket
* @return the \ref ObjectGuid for the \ref Player that asked the question * @return the \ref ObjectGuid for the \ref Player that asked the question
*/ */
@ -121,7 +121,7 @@ class GMTicket
return m_lastUpdate; return m_lastUpdate;
} }
/** /**
* Changes the tickets question text. * Changes the tickets question text.
* @param text the text to change the question to * @param text the text to change the question to
*/ */
@ -214,7 +214,7 @@ class GMTicketMgr
return *itr; return *itr;
} }
/** /**
* This will delete a \ref GMTicket from this manager of tickets so that we don't * This will delete a \ref GMTicket from this manager of tickets so that we don't
* need to handle it anymore, this should be used in conjunction with setting * need to handle it anymore, this should be used in conjunction with setting
* resolved = 1 in the character_ticket table. * resolved = 1 in the character_ticket table.
@ -236,7 +236,7 @@ class GMTicketMgr
void DeleteAll(); void DeleteAll();
/** /**
* This will create a new \ref GMTicket and fill it with the given question so that * This will create a new \ref GMTicket and fill it with the given question so that
* a GM can find it and answer it. Should only be called if we've already checked * a GM can find it and answer it. Should only be called if we've already checked
* that there are no open tickets already, as this function will close any other * that there are no open tickets already, as this function will close any other

View file

@ -815,7 +815,10 @@ bool GameObject::IsTransport() const
{ {
// If something is marked as a transport, don't transmit an out of range packet for it. // If something is marked as a transport, don't transmit an out of range packet for it.
GameObjectInfo const* gInfo = GetGOInfo(); GameObjectInfo const* gInfo = GetGOInfo();
if (!gInfo) { return false; } if (!gInfo)
{
return false;
}
return gInfo->type == GAMEOBJECT_TYPE_TRANSPORT || gInfo->type == GAMEOBJECT_TYPE_MO_TRANSPORT; return gInfo->type == GAMEOBJECT_TYPE_TRANSPORT || gInfo->type == GAMEOBJECT_TYPE_MO_TRANSPORT;
} }

View file

@ -474,7 +474,7 @@ void Item::UpdateDuration(Player* owner, uint32 diff)
#ifdef ENABLE_ELUNA #ifdef ENABLE_ELUNA
sEluna->OnExpire(owner, GetProto()); sEluna->OnExpire(owner, GetProto());
#endif /* ENABLE_ELUNA */ #endif /* ENABLE_ELUNA */
if (uint32 newItemId = sObjectMgr.GetItemExpireConvert(GetEntry())) if (uint32 newItemId = sObjectMgr.GetItemExpireConvert(GetEntry()))
owner->ConvertItem(this, newItemId); owner->ConvertItem(this, newItemId);
else else
@ -941,7 +941,10 @@ void Item::SetState(ItemUpdateState state, Player* forplayer)
if (state != ITEM_UNCHANGED) if (state != ITEM_UNCHANGED)
{ {
// new items must stay in new state until saved // new items must stay in new state until saved
if (uState != ITEM_NEW) { uState = state; } if (uState != ITEM_NEW)
{
uState = state;
}
if (forplayer || GetOwnerGuid()) if (forplayer || GetOwnerGuid())
{ {

View file

@ -104,7 +104,10 @@ void LoadRandomEnchantmentsTable()
uint32 GetItemEnchantMod(int32 entry) uint32 GetItemEnchantMod(int32 entry)
{ {
if (!entry) { return 0; } if (!entry)
{
return 0;
}
EnchantmentStore::const_iterator tab; EnchantmentStore::const_iterator tab;
if (entry > 0) if (entry > 0)
@ -134,7 +137,10 @@ uint32 GetItemEnchantMod(int32 entry)
{ {
fCount += ench_iter->chance; fCount += ench_iter->chance;
if (fCount > dRoll) { return ench_iter->ench; } if (fCount > dRoll)
{
return ench_iter->ench;
}
} }
// we could get here only if sum of all enchantment chances is lower than 100% // we could get here only if sum of all enchantment chances is lower than 100%
@ -145,7 +151,10 @@ uint32 GetItemEnchantMod(int32 entry)
{ {
fCount += ench_iter->chance; fCount += ench_iter->chance;
if (fCount > dRoll) { return ench_iter->ench; } if (fCount > dRoll)
{
return ench_iter->ench;
}
} }
return 0; return 0;

View file

@ -670,7 +670,10 @@ QuestItemList* Loot::FillFFALoot(Player* player)
QuestItemList* Loot::FillQuestLoot(Player* player) QuestItemList* Loot::FillQuestLoot(Player* player)
{ {
if (items.size() == MAX_NR_LOOT_ITEMS) { return NULL; } if (items.size() == MAX_NR_LOOT_ITEMS)
{
return NULL;
}
QuestItemList* ql = new QuestItemList(); QuestItemList* ql = new QuestItemList();
for (uint8 i = 0; i < m_questItems.size(); ++i) for (uint8 i = 0; i < m_questItems.size(); ++i)

View file

@ -782,7 +782,10 @@ void Object::ClearUpdateMask(bool remove)
bool Object::LoadValues(const char* data) bool Object::LoadValues(const char* data)
{ {
if (!m_uint32Values) { _InitValues(); } if (!m_uint32Values)
{
_InitValues();
}
Tokens tokens = StrSplit(data, " "); Tokens tokens = StrSplit(data, " ");
@ -1318,7 +1321,10 @@ bool WorldObject::_IsWithinDist(WorldObject const* obj, float dist2compare, bool
bool WorldObject::IsWithinLOSInMap(const WorldObject* obj) const bool WorldObject::IsWithinLOSInMap(const WorldObject* obj) const
{ {
if (!IsInMap(obj)) { return false; } if (!IsInMap(obj))
{
return false;
}
float ox, oy, oz; float ox, oy, oz;
obj->GetPosition(ox, oy, oz); obj->GetPosition(ox, oy, oz);
return(IsWithinLOS(ox, oy, oz)); return(IsWithinLOS(ox, oy, oz));

View file

@ -3909,8 +3909,8 @@ void ObjectMgr::LoadQuests()
// 29 30 31 32 // 29 30 31 32
"RewXPId, SrcItemId, SrcItemCount, SrcSpell," "RewXPId, SrcItemId, SrcItemCount, SrcSpell,"
// 33 34 35 36 37 38 39 40 41 42 43 // 33 34 35 36 37 38 39 40 41 42 43
"Title, Details, Objectives, OfferRewardText, RequestItemsText, EndText, CompletedText, PortraitGiverName, PortraitGiverText, PortraitTurnInName, PortraitTurnInText," "Title, Details, Objectives, OfferRewardText, RequestItemsText, EndText, CompletedText, PortraitGiverName, PortraitGiverText, PortraitTurnInName, PortraitTurnInText,"
// 44 45 46 47 // 44 45 46 47
"ObjectiveText1, ObjectiveText2, ObjectiveText3, ObjectiveText4," "ObjectiveText1, ObjectiveText2, ObjectiveText3, ObjectiveText4,"
// 48 49 50 51 52 53 54 55 56 57 58 59 // 48 49 50 51 52 53 54 55 56 57 58 59
"ReqItemId1, ReqItemId2, ReqItemId3, ReqItemId4, ReqItemId5, ReqItemId6, ReqItemCount1, ReqItemCount2, ReqItemCount3, ReqItemCount4, ReqItemCount5, ReqItemCount6," "ReqItemId1, ReqItemId2, ReqItemId3, ReqItemId4, ReqItemId5, ReqItemId6, ReqItemCount1, ReqItemCount2, ReqItemCount3, ReqItemCount4, ReqItemCount5, ReqItemCount6,"
@ -3929,12 +3929,12 @@ void ObjectMgr::LoadQuests()
// 95 96 97 98 99 100 // 95 96 97 98 99 100
"RewChoiceItemCount1, RewChoiceItemCount2, RewChoiceItemCount3, RewChoiceItemCount4, RewChoiceItemCount5, RewChoiceItemCount6," "RewChoiceItemCount1, RewChoiceItemCount2, RewChoiceItemCount3, RewChoiceItemCount4, RewChoiceItemCount5, RewChoiceItemCount6,"
// 101 102 103 104 105 106 107 108 // 101 102 103 104 105 106 107 108
"RewItemId1, RewItemId2, RewItemId3, RewItemId4, RewItemCount1, RewItemCount2, RewItemCount3, RewItemCount4," "RewItemId1, RewItemId2, RewItemId3, RewItemId4, RewItemCount1, RewItemCount2, RewItemCount3, RewItemCount4,"
// 109 110 111 112 // 109 110 111 112
"RewCurrencyId1, RewCurrencyId2, RewCurrencyId3, RewCurrencyId4," "RewCurrencyId1, RewCurrencyId2, RewCurrencyId3, RewCurrencyId4,"
// 113 114 115 116 // 113 114 115 116
"RewCurrencyCount1, RewCurrencyCount2, RewCurrencyCount3, RewCurrencyCount4," "RewCurrencyCount1, RewCurrencyCount2, RewCurrencyCount3, RewCurrencyCount4,"
// 117 118 // 117 118
"RewSkill, RewSkillValue," "RewSkill, RewSkillValue,"
// 119 120 121 122 123 // 119 120 121 122 123
"RewRepFaction1, RewRepFaction2, RewRepFaction3, RewRepFaction4, RewRepFaction5," "RewRepFaction1, RewRepFaction2, RewRepFaction3, RewRepFaction4, RewRepFaction5,"
@ -11050,4 +11050,4 @@ void ObjectMgr::LoadHotfixData()
sLog.outString(); sLog.outString();
sLog.outString(">> Loaded %u hotfix info entries.", count); sLog.outString(">> Loaded %u hotfix info entries.", count);
} }

View file

@ -617,10 +617,19 @@ class ObjectMgr
PlayerInfo const* GetPlayerInfo(uint32 race, uint32 class_) const PlayerInfo const* GetPlayerInfo(uint32 race, uint32 class_) const
{ {
if (race >= MAX_RACES) { return NULL; } if (race >= MAX_RACES)
if (class_ >= MAX_CLASSES) { return NULL; } {
return NULL;
}
if (class_ >= MAX_CLASSES)
{
return NULL;
}
PlayerInfo const* info = &playerInfo[race][class_]; PlayerInfo const* info = &playerInfo[race][class_];
if (info->displayId_m == 0 || info->displayId_f == 0) { return NULL; } if (info->displayId_m == 0 || info->displayId_f == 0)
{
return NULL;
}
return info; return info;
} }
void GetPlayerLevelInfo(uint32 race, uint32 class_, uint32 level, PlayerLevelInfo* info) const; void GetPlayerLevelInfo(uint32 race, uint32 class_, uint32 level, PlayerLevelInfo* info) const;
@ -963,7 +972,10 @@ class ObjectMgr
CreatureDataPair const* GetCreatureDataPair(uint32 guid) const CreatureDataPair const* GetCreatureDataPair(uint32 guid) const
{ {
CreatureDataMap::const_iterator itr = mCreatureDataMap.find(guid); CreatureDataMap::const_iterator itr = mCreatureDataMap.find(guid);
if (itr == mCreatureDataMap.end()) { return NULL; } if (itr == mCreatureDataMap.end())
{
return NULL;
}
return &*itr; return &*itr;
} }
@ -992,7 +1004,10 @@ class ObjectMgr
CreatureLocale const* GetCreatureLocale(uint32 entry) const CreatureLocale const* GetCreatureLocale(uint32 entry) const
{ {
CreatureLocaleMap::const_iterator itr = mCreatureLocaleMap.find(entry); CreatureLocaleMap::const_iterator itr = mCreatureLocaleMap.find(entry);
if (itr == mCreatureLocaleMap.end()) { return NULL; } if (itr == mCreatureLocaleMap.end())
{
return NULL;
}
return &itr->second; return &itr->second;
} }
@ -1001,14 +1016,20 @@ class ObjectMgr
GameObjectLocale const* GetGameObjectLocale(uint32 entry) const GameObjectLocale const* GetGameObjectLocale(uint32 entry) const
{ {
GameObjectLocaleMap::const_iterator itr = mGameObjectLocaleMap.find(entry); GameObjectLocaleMap::const_iterator itr = mGameObjectLocaleMap.find(entry);
if (itr == mGameObjectLocaleMap.end()) { return NULL; } if (itr == mGameObjectLocaleMap.end())
{
return NULL;
}
return &itr->second; return &itr->second;
} }
ItemLocale const* GetItemLocale(uint32 entry) const ItemLocale const* GetItemLocale(uint32 entry) const
{ {
ItemLocaleMap::const_iterator itr = mItemLocaleMap.find(entry); ItemLocaleMap::const_iterator itr = mItemLocaleMap.find(entry);
if (itr == mItemLocaleMap.end()) { return NULL; } if (itr == mItemLocaleMap.end())
{
return NULL;
}
return &itr->second; return &itr->second;
} }
@ -1017,7 +1038,10 @@ class ObjectMgr
QuestLocale const* GetQuestLocale(uint32 entry) const QuestLocale const* GetQuestLocale(uint32 entry) const
{ {
QuestLocaleMap::const_iterator itr = mQuestLocaleMap.find(entry); QuestLocaleMap::const_iterator itr = mQuestLocaleMap.find(entry);
if (itr == mQuestLocaleMap.end()) { return NULL; } if (itr == mQuestLocaleMap.end())
{
return NULL;
}
return &itr->second; return &itr->second;
} }
@ -1026,7 +1050,10 @@ class ObjectMgr
NpcTextLocale const* GetNpcTextLocale(uint32 entry) const NpcTextLocale const* GetNpcTextLocale(uint32 entry) const
{ {
NpcTextLocaleMap::const_iterator itr = mNpcTextLocaleMap.find(entry); NpcTextLocaleMap::const_iterator itr = mNpcTextLocaleMap.find(entry);
if (itr == mNpcTextLocaleMap.end()) { return NULL; } if (itr == mNpcTextLocaleMap.end())
{
return NULL;
}
return &itr->second; return &itr->second;
} }
@ -1037,28 +1064,40 @@ class ObjectMgr
PageTextLocale const* GetPageTextLocale(uint32 entry) const PageTextLocale const* GetPageTextLocale(uint32 entry) const
{ {
PageTextLocaleMap::const_iterator itr = mPageTextLocaleMap.find(entry); PageTextLocaleMap::const_iterator itr = mPageTextLocaleMap.find(entry);
if (itr == mPageTextLocaleMap.end()) { return NULL; } if (itr == mPageTextLocaleMap.end())
{
return NULL;
}
return &itr->second; return &itr->second;
} }
GossipMenuItemsLocale const* GetGossipMenuItemsLocale(uint32 entry) const GossipMenuItemsLocale const* GetGossipMenuItemsLocale(uint32 entry) const
{ {
GossipMenuItemsLocaleMap::const_iterator itr = mGossipMenuItemsLocaleMap.find(entry); GossipMenuItemsLocaleMap::const_iterator itr = mGossipMenuItemsLocaleMap.find(entry);
if (itr == mGossipMenuItemsLocaleMap.end()) { return NULL; } if (itr == mGossipMenuItemsLocaleMap.end())
{
return NULL;
}
return &itr->second; return &itr->second;
} }
PointOfInterestLocale const* GetPointOfInterestLocale(uint32 poi_id) const PointOfInterestLocale const* GetPointOfInterestLocale(uint32 poi_id) const
{ {
PointOfInterestLocaleMap::const_iterator itr = mPointOfInterestLocaleMap.find(poi_id); PointOfInterestLocaleMap::const_iterator itr = mPointOfInterestLocaleMap.find(poi_id);
if (itr == mPointOfInterestLocaleMap.end()) { return NULL; } if (itr == mPointOfInterestLocaleMap.end())
{
return NULL;
}
return &itr->second; return &itr->second;
} }
GameObjectDataPair const* GetGODataPair(uint32 guid) const GameObjectDataPair const* GetGODataPair(uint32 guid) const
{ {
GameObjectDataMap::const_iterator itr = mGameObjectDataMap.find(guid); GameObjectDataMap::const_iterator itr = mGameObjectDataMap.find(guid);
if (itr == mGameObjectDataMap.end()) { return NULL; } if (itr == mGameObjectDataMap.end())
{
return NULL;
}
return &*itr; return &*itr;
} }
@ -1087,7 +1126,10 @@ class ObjectMgr
MangosStringLocale const* GetMangosStringLocale(int32 entry) const MangosStringLocale const* GetMangosStringLocale(int32 entry) const
{ {
MangosStringLocaleMap::const_iterator itr = mMangosStringLocaleMap.find(entry); MangosStringLocaleMap::const_iterator itr = mMangosStringLocaleMap.find(entry);
if (itr == mMangosStringLocaleMap.end()) { return NULL; } if (itr == mMangosStringLocaleMap.end())
{
return NULL;
}
return &itr->second; return &itr->second;
} }
uint32 GetLoadedStringsCount(int32 minEntry) const uint32 GetLoadedStringsCount(int32 minEntry) const
@ -1142,7 +1184,10 @@ class ObjectMgr
GameTele const* GetGameTele(uint32 id) const GameTele const* GetGameTele(uint32 id) const
{ {
GameTeleMap::const_iterator itr = m_GameTeleMap.find(id); GameTeleMap::const_iterator itr = m_GameTeleMap.find(id);
if (itr == m_GameTeleMap.end()) { return NULL; } if (itr == m_GameTeleMap.end())
{
return NULL;
}
return &itr->second; return &itr->second;
} }

View file

@ -903,7 +903,7 @@ void Pet::InitStatsForLevel(uint32 petlevel)
case HUNTER_PET: case HUNTER_PET:
{ {
CreatureFamilyEntry const* cFamily = sCreatureFamilyStore.LookupEntry(cInfo->Family); CreatureFamilyEntry const* cFamily = sCreatureFamilyStore.LookupEntry(cInfo->Family);
if (cFamily && cFamily->minScale > 0.0f) if (cFamily && cFamily->minScale > 0.0f)
{ {
float scale; float scale;
@ -1028,7 +1028,7 @@ void Pet::InitStatsForLevel(uint32 petlevel)
float dMinLevel = cInfo->MinMeleeDmg / cInfo->MinLevel; float dMinLevel = cInfo->MinMeleeDmg / cInfo->MinLevel;
float dMaxLevel = cInfo->MaxMeleeDmg / cInfo->MaxLevel; float dMaxLevel = cInfo->MaxMeleeDmg / cInfo->MaxLevel;
float mDmg = (dMaxLevel - ((dMaxLevel - dMinLevel) / 2)) * petlevel; float mDmg = (dMaxLevel - ((dMaxLevel - dMinLevel) / 2)) * petlevel;
// Set damage // Set damage
SetBaseWeaponDamage(BASE_ATTACK, MINDAMAGE, float(mDmg - mDmg / 4)); SetBaseWeaponDamage(BASE_ATTACK, MINDAMAGE, float(mDmg - mDmg / 4));
SetBaseWeaponDamage(BASE_ATTACK, MAXDAMAGE, float((mDmg - mDmg / 4) * 1.5)); SetBaseWeaponDamage(BASE_ATTACK, MAXDAMAGE, float((mDmg - mDmg / 4) * 1.5));
@ -1044,7 +1044,7 @@ void Pet::InitStatsForLevel(uint32 petlevel)
health = 1; health = 1;
mana = 1; mana = 1;
armor = 1; armor = 1;
// Set damage // Set damage
SetBaseWeaponDamage(BASE_ATTACK, MINDAMAGE, 1); SetBaseWeaponDamage(BASE_ATTACK, MINDAMAGE, 1);
SetBaseWeaponDamage(BASE_ATTACK, MAXDAMAGE, 1); SetBaseWeaponDamage(BASE_ATTACK, MAXDAMAGE, 1);

View file

@ -151,7 +151,7 @@ class Pet : public Creature
void setPetType(PetType type) { m_petType = type; } void setPetType(PetType type) { m_petType = type; }
bool isControlled() const { return getPetType() == SUMMON_PET || getPetType() == HUNTER_PET; } bool isControlled() const { return getPetType() == SUMMON_PET || getPetType() == HUNTER_PET; }
bool isTemporarySummoned() const { return m_duration > 0; } bool isTemporarySummoned() const { return m_duration > 0; }
bool Create(uint32 guidlow, CreatureCreatePos& cPos, CreatureInfo const* cinfo, uint32 pet_number); bool Create(uint32 guidlow, CreatureCreatePos& cPos, CreatureInfo const* cinfo, uint32 pet_number);
bool CreateBaseAtCreature(Creature* creature); bool CreateBaseAtCreature(Creature* creature);
bool LoadPetFromDB(Player* owner, uint32 petentry = 0, uint32 petnumber = 0, bool current = false); bool LoadPetFromDB(Player* owner, uint32 petentry = 0, uint32 petnumber = 0, bool current = false);

View file

@ -368,7 +368,7 @@ void PetAI::UpdateAI(const uint32 diff)
DEBUG_FILTER_LOG(LOG_FILTER_AI_AND_MOVEGENSS, "PetAI (guid = %u) is stopping attack.", m_creature->GetGUIDLow()); DEBUG_FILTER_LOG(LOG_FILTER_AI_AND_MOVEGENSS, "PetAI (guid = %u) is stopping attack.", m_creature->GetGUIDLow());
m_creature->CombatStop(); m_creature->CombatStop();
inCombat = false; inCombat = false;
return; return;
} }

View file

@ -1218,7 +1218,7 @@ DrunkenState Player::GetDrunkenstateByValue(uint8 value)
return DRUNKEN_SMASHED; return DRUNKEN_SMASHED;
if (value >= 50) if (value >= 50)
return DRUNKEN_DRUNK; return DRUNKEN_DRUNK;
if (value) if (value)
return DRUNKEN_TIPSY; return DRUNKEN_TIPSY;
return DRUNKEN_SOBER; return DRUNKEN_SOBER;
} }
@ -1235,7 +1235,7 @@ void Player::SetDrunkValue(uint8 newDrunkValue, uint32 itemId /*= 0*/)
SetByteValue(PLAYER_BYTES_3, 1, newDrunkValue); SetByteValue(PLAYER_BYTES_3, 1, newDrunkValue);
uint32 newDrunkenState = Player::GetDrunkenstateByValue(newDrunkValue); uint32 newDrunkenState = Player::GetDrunkenstateByValue(newDrunkValue);
// special drunk invisibility detection // special drunk invisibility detection
if (newDrunkenState >= DRUNKEN_DRUNK) if (newDrunkenState >= DRUNKEN_DRUNK)
@ -7045,7 +7045,7 @@ void Player::UpdateZone(uint32 newZone, uint32 newArea)
#ifdef ENABLE_ELUNA #ifdef ENABLE_ELUNA
sEluna->OnUpdateZone(this, newZone, newArea); sEluna->OnUpdateZone(this, newZone, newArea);
#endif #endif
m_zoneUpdateId = newZone; m_zoneUpdateId = newZone;
m_zoneUpdateTimer = ZONE_UPDATE_INTERVAL; m_zoneUpdateTimer = ZONE_UPDATE_INTERVAL;
@ -15619,7 +15619,7 @@ bool Player::LoadFromDB(ObjectGuid guid, SqlQueryHolder* holder)
SetUInt32Value(PLAYER_BYTES_2, fields[10].GetUInt32()); SetUInt32Value(PLAYER_BYTES_2, fields[10].GetUInt32());
SetByteValue(PLAYER_BYTES_3, 0, gender); SetByteValue(PLAYER_BYTES_3, 0, gender);
SetByteValue(PLAYER_BYTES_3, 1, fields[45].GetUInt8()); SetByteValue(PLAYER_BYTES_3, 1, fields[45].GetUInt8());
SetUInt32Value(PLAYER_FLAGS, fields[11].GetUInt32()); SetUInt32Value(PLAYER_FLAGS, fields[11].GetUInt32());
SetInt32Value(PLAYER_FIELD_WATCHED_FACTION_INDEX, fields[44].GetInt32()); SetInt32Value(PLAYER_FIELD_WATCHED_FACTION_INDEX, fields[44].GetInt32());
@ -15855,7 +15855,7 @@ bool Player::LoadFromDB(ObjectGuid guid, SqlQueryHolder* holder)
if (time_diff < uint32(GetDrunkValue()) * 9) if (time_diff < uint32(GetDrunkValue()) * 9)
newDrunkValue = GetDrunkValue() - time_diff / 9; newDrunkValue = GetDrunkValue() - time_diff / 9;
SetDrunkValue(newDrunkValue); SetDrunkValue(newDrunkValue);
m_cinematic = fields[18].GetUInt32(); m_cinematic = fields[18].GetUInt32();
m_Played_time[PLAYED_TIME_TOTAL] = fields[19].GetUInt32(); m_Played_time[PLAYED_TIME_TOTAL] = fields[19].GetUInt32();
@ -20503,7 +20503,7 @@ void Player::SendInitialPacketsBeforeAddToMap()
data << uint32(sWorld.GetNextWeeklyQuestsResetTime() - WEEK); // LastWeeklyReset (not instance reset) data << uint32(sWorld.GetNextWeeklyQuestsResetTime() - WEEK); // LastWeeklyReset (not instance reset)
data << uint32(GetMap()->GetDifficulty()); data << uint32(GetMap()->GetDifficulty());
GetSession()->SendPacket(&data); GetSession()->SendPacket(&data);
SendInitialSpells(); SendInitialSpells();
@ -22956,7 +22956,7 @@ void Player::UnsummonPetIfAny()
Pet* pet = GetPet(); Pet* pet = GetPet();
if (!pet) if (!pet)
return; return;
pet->Unsummon(PET_SAVE_NOT_IN_SLOT, this); pet->Unsummon(PET_SAVE_NOT_IN_SLOT, this);
} }

View file

@ -1173,8 +1173,14 @@ class Player : public Unit
void SetGMVisible(bool on); void SetGMVisible(bool on);
void SetPvPDeath(bool on) void SetPvPDeath(bool on)
{ {
if (on) { m_ExtraFlags |= PLAYER_EXTRA_PVP_DEATH; } if (on)
else { m_ExtraFlags &= ~PLAYER_EXTRA_PVP_DEATH; } {
m_ExtraFlags |= PLAYER_EXTRA_PVP_DEATH;
}
else
{
m_ExtraFlags &= ~PLAYER_EXTRA_PVP_DEATH;
}
} }
// 0 = own auction, -1 = enemy auction, 1 = goblin auction // 0 = own auction, -1 = enemy auction, 1 = goblin auction
@ -1223,7 +1229,7 @@ class Player : public Unit
return m_rest_bonus; return m_rest_bonus;
} }
void SetRestBonus(float rest_bonus_new); void SetRestBonus(float rest_bonus_new);
/** /**
* \brief: compute rest bonus * \brief: compute rest bonus
* \param: time_t timePassed > time from last check * \param: time_t timePassed > time from last check
@ -1589,7 +1595,7 @@ class Player : public Unit
void AddTimedQuest(uint32 quest_id) { m_timedquests.insert(quest_id); } void AddTimedQuest(uint32 quest_id) { m_timedquests.insert(quest_id); }
void RemoveTimedQuest(uint32 quest_id) { m_timedquests.erase(quest_id); } void RemoveTimedQuest(uint32 quest_id) { m_timedquests.erase(quest_id); }
/// Return collision height sent to client /// Return collision height sent to client
float GetCollisionHeight(bool mounted) const; float GetCollisionHeight(bool mounted) const;
@ -2574,7 +2580,7 @@ class Player : public Unit
GridReference<Player>& GetGridRef() { return m_gridRef; } GridReference<Player>& GetGridRef() { return m_gridRef; }
MapReference& GetMapRef() { return m_mapRef; } MapReference& GetMapRef() { return m_mapRef; }
bool IsTappedByMeOrMyGroup(Creature* creature); bool IsTappedByMeOrMyGroup(Creature* creature);
bool isAllowedToLoot(Creature* creature); bool isAllowedToLoot(Creature* creature);

View file

@ -1402,7 +1402,7 @@ struct DoSpellProcEvent
else else
++count; ++count;
} }
bool HasEntry(uint32 spellId) { return spe_map.find(spellId) != spe_map.end(); } bool HasEntry(uint32 spellId) { return spe_map.find(spellId) != spe_map.end(); }
bool SetStateToEntry(uint32 spellId) { return (state = spe_map.find(spellId)) != spe_map.end(); } bool SetStateToEntry(uint32 spellId) { return (state = spe_map.find(spellId)) != spe_map.end(); }
SpellProcEventMap& spe_map; SpellProcEventMap& spe_map;

View file

@ -752,7 +752,7 @@ enum ProcFlagsEx
/// If set trigger always but only one time (not used) /// If set trigger always but only one time (not used)
PROC_EX_EX_ONE_TIME_TRIGGER = 0x0020000, PROC_EX_EX_ONE_TIME_TRIGGER = 0x0020000,
/// For periodic heal /// For periodic heal
PROC_EX_PERIODIC_POSITIVE = 0x0040000, PROC_EX_PERIODIC_POSITIVE = 0x0040000,
PROC_EX_CAST_END = 0x0080000 // procs on end of cast PROC_EX_CAST_END = 0x0080000 // procs on end of cast
}; };
@ -1127,7 +1127,7 @@ class SpellMgr
return 0; return 0;
} }
bool IsHighRankOfSpell(uint32 spell1, uint32 spell2) const bool IsHighRankOfSpell(uint32 spell1, uint32 spell2) const
{ {
SpellChainMap::const_iterator itr = mSpellChains.find(spell1); SpellChainMap::const_iterator itr = mSpellChains.find(spell1);

View file

@ -213,7 +213,7 @@ void TemporarySummon::Update(uint32 update_diff, uint32 diff)
default: default:
break; break;
} }
Creature::Update(update_diff, diff); Creature::Update(update_diff, diff);
} }

View file

@ -100,7 +100,7 @@ void MovementInfo::Read(ByteBuffer& data, uint16 opcode)
MovementStatusElements element = sequence[i]; MovementStatusElements element = sequence[i];
if (element == MSEEnd) if (element == MSEEnd)
break; break;
if (element >= MSEGuidBit0 && element <= MSEGuidBit7) if (element >= MSEGuidBit0 && element <= MSEGuidBit7)
{ {
guid[element - MSEGuidBit0] = data.ReadBit(); guid[element - MSEGuidBit0] = data.ReadBit();
@ -2197,7 +2197,10 @@ void Unit::CalculateMeleeDamage(Unit* pVictim, CalcDamageInfo* damageInfo, Weapo
void Unit::DealMeleeDamage(CalcDamageInfo* damageInfo, bool durabilityLoss) void Unit::DealMeleeDamage(CalcDamageInfo* damageInfo, bool durabilityLoss)
{ {
if (damageInfo == 0) { return; } if (damageInfo == 0)
{
return;
}
Unit* pVictim = damageInfo->target; Unit* pVictim = damageInfo->target;
if (!this || !pVictim) if (!this || !pVictim)
@ -9851,7 +9854,7 @@ bool Unit::SelectHostileTarget()
m_ThreatManager.modifyThreatPercent(target, -101); m_ThreatManager.modifyThreatPercent(target, -101);
// remove target from current attacker, do not exit combat settings // remove target from current attacker, do not exit combat settings
AttackStop(true); AttackStop(true);
} }
return false; return false;
@ -12562,7 +12565,7 @@ Unit* Unit::TakePossessOf(SpellEntry const* spellEntry, SummonPropertiesEntry co
// initialize AI // initialize AI
pCreature->AIM_Initialize(); pCreature->AIM_Initialize();
if (player) if (player)
{ {
// Initialize pet bar // Initialize pet bar

File diff suppressed because it is too large Load diff

View file

@ -40,7 +40,10 @@ class MapReference : public Reference<Map, Player>
void targetObjectDestroyLink() override void targetObjectDestroyLink() override
{ {
// called from unlink() // called from unlink()
if (isValid()) { getTarget()->m_mapRefManager.decSize(); } if (isValid())
{
getTarget()->m_mapRefManager.decSize();
}
} }
void sourceObjectDestroyLink() override void sourceObjectDestroyLink() override
{ {

View file

@ -137,7 +137,7 @@ void LoadDB2Stores(const std::string& dataPath)
sLog.outError("Please extract correct db2 files from build %s", AcceptableClientBuildsListStr().c_str()); sLog.outError("Please extract correct db2 files from build %s", AcceptableClientBuildsListStr().c_str());
exit(1); exit(1);
} }
sLog.outString(); sLog.outString();
sLog.outString( ">> Initialized %d db2 stores", DB2FileCount ); sLog.outString( ">> Initialized %d db2 stores", DB2FileCount );
} }

View file

@ -297,7 +297,7 @@ int ReadDBCLocale(const std::string sDataPath)
{ {
std::string sDBCpath = sDataPath + "dbc/"; std::string sDBCpath = sDataPath + "dbc/";
std::string sFilename; std::string sFilename;
for (int uLocaleIndex = 0; uLocaleIndex < MAX_LOCALE; ++uLocaleIndex) for (int uLocaleIndex = 0; uLocaleIndex < MAX_LOCALE; ++uLocaleIndex)
{ {
sFilename = sDBCpath + "component.wow-" + fullLocaleNameList[uLocaleIndex].name + ".txt"; sFilename = sDBCpath + "component.wow-" + fullLocaleNameList[uLocaleIndex].name + ".txt";
@ -848,7 +848,7 @@ void LoadDBCStores(const std::string& dataPath)
} }
LoadDBC(availableDbcLocales, bar, bad_dbc_files, sTotemCategoryStore, dbcPath, "TotemCategory.dbc"); LoadDBC(availableDbcLocales, bar, bad_dbc_files, sTotemCategoryStore, dbcPath, "TotemCategory.dbc");
LoadDBC(availableDbcLocales,bar,bad_dbc_files,sTransportAnimationStore, dbcPath,"TransportAnimation.dbc"); LoadDBC(availableDbcLocales,bar,bad_dbc_files,sTransportAnimationStore, dbcPath,"TransportAnimation.dbc");
for (uint32 i = 0; i < sTransportAnimationStore.GetNumRows(); ++i) for (uint32 i = 0; i < sTransportAnimationStore.GetNumRows(); ++i)
if (TransportAnimationEntry const* entry = sTransportAnimationStore.LookupEntry(i)) if (TransportAnimationEntry const* entry = sTransportAnimationStore.LookupEntry(i))

View file

@ -35,7 +35,7 @@ bool IsAcceptableClientBuild(uint32 build);
std::string AcceptableClientBuildsListStr(); std::string AcceptableClientBuildsListStr();
/** /**
* This function checks to see if there is a valid locale file (component.wow-<locale>.txt) * This function checks to see if there is a valid locale file (component.wow-<locale>.txt)
* and returns an index to the locale or -1 if not found * and returns an index to the locale or -1 if not found
* @PARAM dataPath full path to the data directory * @PARAM dataPath full path to the data directory
* @RETURN index number representing the location of the locale in the its structure, * @RETURN index number representing the location of the locale in the its structure,

View file

@ -127,7 +127,7 @@ const char SpellCastingRequirementsEntryfmt[]="dixxixi";
const char SpellCategoriesEntryfmt[]="diiiiii"; const char SpellCategoriesEntryfmt[]="diiiiii";
const char SpellClassOptionsEntryfmt[]="dxiiiix"; const char SpellClassOptionsEntryfmt[]="dxiiiix";
const char SpellCooldownsEntryfmt[]="diii"; const char SpellCooldownsEntryfmt[]="diii";
// 1 10 20 30 // 1 10 20 30
const char SpellEffectEntryfmt[]="difiiiffiiiiiifiifiiiiiiiix"; const char SpellEffectEntryfmt[]="difiiiffiiiiiifiifiiiiiiiix";
const char SpellEquippedItemsEntryfmt[]="diii"; const char SpellEquippedItemsEntryfmt[]="diii";
const char SpellInterruptsEntryfmt[]="dixixi"; const char SpellInterruptsEntryfmt[]="dixixi";

View file

@ -429,7 +429,7 @@ void InitializeOpcodes()
OPCODE(CMSG_REPOP_REQUEST, STATUS_LOGGEDIN, PROCESS_THREADUNSAFE, &WorldSession::HandleRepopRequestOpcode ); OPCODE(CMSG_REPOP_REQUEST, STATUS_LOGGEDIN, PROCESS_THREADUNSAFE, &WorldSession::HandleRepopRequestOpcode );
OPCODE(SMSG_RESURRECT_REQUEST, STATUS_NEVER, PROCESS_INPLACE, &WorldSession::Handle_ServerSide ); OPCODE(SMSG_RESURRECT_REQUEST, STATUS_NEVER, PROCESS_INPLACE, &WorldSession::Handle_ServerSide );
OPCODE(CMSG_RESURRECT_RESPONSE, STATUS_LOGGEDIN, PROCESS_THREADUNSAFE, &WorldSession::HandleResurrectResponseOpcode ); OPCODE(CMSG_RESURRECT_RESPONSE, STATUS_LOGGEDIN, PROCESS_THREADUNSAFE, &WorldSession::HandleResurrectResponseOpcode );
OPCODE(CMSG_RETURN_TO_GRAVEYARD, STATUS_LOGGEDIN, PROCESS_THREADUNSAFE, &WorldSession::HandleReturnToGraveyard ); OPCODE(CMSG_RETURN_TO_GRAVEYARD, STATUS_LOGGEDIN, PROCESS_THREADUNSAFE, &WorldSession::HandleReturnToGraveyard );
OPCODE(CMSG_LOOT, STATUS_LOGGEDIN, PROCESS_THREADUNSAFE, &WorldSession::HandleLootOpcode ); OPCODE(CMSG_LOOT, STATUS_LOGGEDIN, PROCESS_THREADUNSAFE, &WorldSession::HandleLootOpcode );
OPCODE(CMSG_LOOT_MONEY, STATUS_LOGGEDIN, PROCESS_THREADUNSAFE, &WorldSession::HandleLootMoneyOpcode ); OPCODE(CMSG_LOOT_MONEY, STATUS_LOGGEDIN, PROCESS_THREADUNSAFE, &WorldSession::HandleLootMoneyOpcode );
OPCODE(CMSG_LOOT_RELEASE, STATUS_LOGGEDIN, PROCESS_THREADUNSAFE, &WorldSession::HandleLootReleaseOpcode ); OPCODE(CMSG_LOOT_RELEASE, STATUS_LOGGEDIN, PROCESS_THREADUNSAFE, &WorldSession::HandleLootReleaseOpcode );

View file

@ -1324,7 +1324,7 @@ enum Opcodes
SMSG_BATTLEFIELD_MANAGER_ENTERING = 0x14E1, SMSG_BATTLEFIELD_MANAGER_ENTERING = 0x14E1,
SMSG_BATTLEFIELD_MANAGER_QUEUE_INVITE = 0x14E2, SMSG_BATTLEFIELD_MANAGER_QUEUE_INVITE = 0x14E2,
CMSG_BATTLEFIELD_MANAGER_QUEUE_INVITE_RESPONSE = 0x14E3, CMSG_BATTLEFIELD_MANAGER_QUEUE_INVITE_RESPONSE = 0x14E3,
CMSG_BATTLEFIELD_MANAGER_QUEUE_REQUEST = 0x710C, // 4.3.4 15595 CMSG_BATTLEFIELD_MANAGER_QUEUE_REQUEST = 0x710C, // 4.3.4 15595
SMSG_BATTLEFIELD_MANAGER_QUEUE_REQUEST_RESPONSE = 0x14E5, SMSG_BATTLEFIELD_MANAGER_QUEUE_REQUEST_RESPONSE = 0x14E5,
SMSG_BATTLEFIELD_MANAGER_EJECT_PENDING = 0x14E6, SMSG_BATTLEFIELD_MANAGER_EJECT_PENDING = 0x14E6,
SMSG_BATTLEFIELD_MANAGER_EJECTED = 0x14E7, SMSG_BATTLEFIELD_MANAGER_EJECTED = 0x14E7,

View file

@ -390,7 +390,7 @@ bool WorldSession::Update(PacketFilter& updater)
{ {
LogoutPlayer(true); LogoutPlayer(true);
} }
// WARDEN ISSUE - commented out to stop crash // WARDEN ISSUE - commented out to stop crash
// if (m_Socket && GetPlayer() && _warden) // if (m_Socket && GetPlayer() && _warden)
// _warden->Update(); // _warden->Update();

View file

@ -541,7 +541,7 @@ class WorldSession
void HandleLogoutRequestOpcode(WorldPacket& recvPacket); void HandleLogoutRequestOpcode(WorldPacket& recvPacket);
void HandlePlayerLogoutOpcode(WorldPacket& recvPacket); void HandlePlayerLogoutOpcode(WorldPacket& recvPacket);
void HandleLogoutCancelOpcode(WorldPacket& recvPacket); void HandleLogoutCancelOpcode(WorldPacket& recvPacket);
void HandleGMTicketGetTicketOpcode(WorldPacket& recvPacket); void HandleGMTicketGetTicketOpcode(WorldPacket& recvPacket);
void HandleGMTicketCreateOpcode(WorldPacket& recvPacket); void HandleGMTicketCreateOpcode(WorldPacket& recvPacket);
void HandleGMTicketSystemStatusOpcode(WorldPacket& recvPacket); void HandleGMTicketSystemStatusOpcode(WorldPacket& recvPacket);
@ -962,7 +962,7 @@ class WorldSession
// Hotfix handlers // Hotfix handlers
void HandleRequestHotfix(WorldPacket& recv_data); void HandleRequestHotfix(WorldPacket& recv_data);
void SendItemDb2Reply(uint32 entry); void SendItemDb2Reply(uint32 entry);
void SendItemSparseDb2Reply(uint32 entry); void SendItemSparseDb2Reply(uint32 entry);
void HandleObjectUpdateFailedOpcode(WorldPacket& recv_data); void HandleObjectUpdateFailedOpcode(WorldPacket& recv_data);

View file

@ -485,7 +485,10 @@ DumpReturn PlayerDumpReader::LoadDump(const std::string& file, uint32 account, s
guid = sObjectMgr.m_CharGuids.GetNextAfterMaxUsed(); guid = sObjectMgr.m_CharGuids.GetNextAfterMaxUsed();
delete result; delete result;
} }
else { incHighest = false; } else
{
incHighest = false;
}
} }
else else
{ guid = sObjectMgr.m_CharGuids.GetNextAfterMaxUsed(); } { guid = sObjectMgr.m_CharGuids.GetNextAfterMaxUsed(); }
@ -528,7 +531,10 @@ DumpReturn PlayerDumpReader::LoadDump(const std::string& file, uint32 account, s
{ {
if (!fgets(buf, 32000, fin)) if (!fgets(buf, 32000, fin))
{ {
if (feof(fin)) { break; } if (feof(fin))
{
break;
}
ROLLBACK(DUMP_FILE_BROKEN); ROLLBACK(DUMP_FILE_BROKEN);
} }

View file

@ -235,7 +235,7 @@ ChatCommand* ChatHandler::getCommandTable()
{ "equiperror", SEC_ADMINISTRATOR, false, &ChatHandler::HandleDebugSendEquipErrorCommand, "", NULL }, { "equiperror", SEC_ADMINISTRATOR, false, &ChatHandler::HandleDebugSendEquipErrorCommand, "", NULL },
{ "largepacket", SEC_ADMINISTRATOR, false, &ChatHandler::HandleDebugSendLargePacketCommand, "", NULL }, { "largepacket", SEC_ADMINISTRATOR, false, &ChatHandler::HandleDebugSendLargePacketCommand, "", NULL },
{ "opcode", SEC_ADMINISTRATOR, false, &ChatHandler::HandleDebugSendOpcodeCommand, "", NULL }, { "opcode", SEC_ADMINISTRATOR, false, &ChatHandler::HandleDebugSendOpcodeCommand, "", NULL },
{ "phase", SEC_ADMINISTRATOR, false, &ChatHandler::HandleDebugPhaseCommand, "", NULL }, { "phase", SEC_ADMINISTRATOR, false, &ChatHandler::HandleDebugPhaseCommand, "", NULL },
{ "poi", SEC_ADMINISTRATOR, false, &ChatHandler::HandleDebugSendPoiCommand, "", NULL }, { "poi", SEC_ADMINISTRATOR, false, &ChatHandler::HandleDebugSendPoiCommand, "", NULL },
{ "qpartymsg", SEC_ADMINISTRATOR, false, &ChatHandler::HandleDebugSendQuestPartyMsgCommand, "", NULL }, { "qpartymsg", SEC_ADMINISTRATOR, false, &ChatHandler::HandleDebugSendQuestPartyMsgCommand, "", NULL },
{ "qinvalidmsg", SEC_ADMINISTRATOR, false, &ChatHandler::HandleDebugSendQuestInvalidMsgCommand, "", NULL }, { "qinvalidmsg", SEC_ADMINISTRATOR, false, &ChatHandler::HandleDebugSendQuestInvalidMsgCommand, "", NULL },
@ -1471,8 +1471,8 @@ bool ChatHandler::isValidChatMessage(const char* message)
/* /*
valid examples: valid examples:
|cff00aa00|Hcurrency:391|h[Ðåêîìåíäàòåëüíûé çíà÷îê Òîë Áàðàäà]|h|r |cff00aa00|Hcurrency:391|h[<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>]|h|r
|cffff8000|Hinstancelock:070000000177AF81:532:0:1|h[Êàðàæàí]|h|r NYI |cffff8000|Hinstancelock:070000000177AF81:532:0:1|h[<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>]|h|r NYI
|cffa335ee|Hitem:812:0:0:0:0:0:0:0:70|h[Glowing Brightwood Staff]|h|r |cffa335ee|Hitem:812:0:0:0:0:0:0:0:70|h[Glowing Brightwood Staff]|h|r
|cff808080|Hquest:2278:47|h[The Platinum Discs]|h|r |cff808080|Hquest:2278:47|h[The Platinum Discs]|h|r
|cffffd000|Htrade:4037:1:150:1:6AAAAAAAAAAAAAAAAAAAAAAOAADAAAAAAAAAAAAAAAAIAAAAAAAAA|h[Engineering]|h|r |cffffd000|Htrade:4037:1:150:1:6AAAAAAAAAAAAAAAAAAAAAAOAADAAAAAAAAAAAAAAAAIAAAAAAAAA|h[Engineering]|h|r

View file

@ -570,7 +570,7 @@ void WorldSession::HandleMessagechatOpcode(WorldPacket& recv_data)
if (!sEluna->OnChat(GetPlayer(), type, lang, msg, chn)) if (!sEluna->OnChat(GetPlayer(), type, lang, msg, chn))
return; return;
#endif /* ENABLE_ELUNA */ #endif /* ENABLE_ELUNA */
chn->Say(_player, msg.c_str(), lang); chn->Say(_player, msg.c_str(), lang);
} }
} }

View file

@ -457,7 +457,7 @@ void PlayerMenu::SendQuestGiverQuestDetails(Quest const* pQuest, ObjectGuid guid
if (ql->PortraitTurnInText.size() > (size_t)loc_idx && !ql->PortraitTurnInText[loc_idx].empty()) if (ql->PortraitTurnInText.size() > (size_t)loc_idx && !ql->PortraitTurnInText[loc_idx].empty())
PortraitTurnInText = ql->PortraitTurnInText[loc_idx]; PortraitTurnInText = ql->PortraitTurnInText[loc_idx];
} }
} }
WorldPacket data(SMSG_QUESTGIVER_QUEST_DETAILS, 100); // guess size WorldPacket data(SMSG_QUESTGIVER_QUEST_DETAILS, 100); // guess size
data << guid; data << guid;
@ -519,7 +519,7 @@ void PlayerMenu::SendQuestGiverQuestDetails(Quest const* pQuest, ObjectGuid guid
data << pQuest->GetBonusTalents(); // bonus talents data << pQuest->GetBonusTalents(); // bonus talents
data << uint32(0); // unk, unused bonus arena points? data << uint32(0); // unk, unused bonus arena points?
data << uint32(0); // rep reward show mask? data << uint32(0); // rep reward show mask?
for (int i = 0; i < QUEST_REPUTATIONS_COUNT; ++i) // reward factions ids for (int i = 0; i < QUEST_REPUTATIONS_COUNT; ++i) // reward factions ids
data << pQuest->RewRepFaction[i]; data << pQuest->RewRepFaction[i];
@ -553,7 +553,7 @@ void PlayerMenu::SendQuestGiverQuestDetails(Quest const* pQuest, ObjectGuid guid
GetMenuSession()->SendPacket(&data); GetMenuSession()->SendPacket(&data);
DEBUG_LOG("WORLD: Sent SMSG_QUESTGIVER_QUEST_DETAILS - for %s of %s, questid = %u", GetMenuSession()->GetPlayer()->GetGuidStr().c_str(), guid.GetString().c_str(), pQuest->GetQuestId()); DEBUG_LOG("WORLD: Sent SMSG_QUESTGIVER_QUEST_DETAILS - for %s of %s, questid = %u", GetMenuSession()->GetPlayer()->GetGuidStr().c_str(), guid.GetString().c_str(), pQuest->GetQuestId());
} }
// send only static data in this packet! // send only static data in this packet!
void PlayerMenu::SendQuestQueryResponse(Quest const* pQuest) void PlayerMenu::SendQuestQueryResponse(Quest const* pQuest)
@ -652,8 +652,8 @@ void PlayerMenu::SendQuestQueryResponse(Quest const* pQuest)
data << uint32(pQuest->GetRewSkill()); // Rewarded skill id data << uint32(pQuest->GetRewSkill()); // Rewarded skill id
data << uint32(pQuest->GetRewSkillValue()); // Rewarded skill bonus points data << uint32(pQuest->GetRewSkillValue()); // Rewarded skill bonus points
data << uint32(0); // rew rep show mask? data << uint32(0); // rew rep show mask?
data << uint32(pQuest->GetPortraitGiver()); data << uint32(pQuest->GetPortraitGiver());
data << uint32(pQuest->GetPortraitTurnIn()); data << uint32(pQuest->GetPortraitTurnIn());
int iI; int iI;

View file

@ -128,7 +128,7 @@ struct GridMapLiquidData
class GridMap class GridMap
{ {
private: private:
uint16 m_holes[16][16]; uint16 m_holes[16][16];
uint32 m_flags; uint32 m_flags;

View file

@ -243,7 +243,7 @@ namespace MaNGOS
/* /*
template<class Check> template<class Check>
struct WorldObjectLastSearcher struct WorldObjectLastSearcher
{ {
WorldObject*& i_object; WorldObject*& i_object;
Check& i_check; Check& i_check;

View file

@ -406,7 +406,7 @@ class Group
void _setLeader(ObjectGuid guid); void _setLeader(ObjectGuid guid);
void _removeRolls(ObjectGuid guid); void _removeRolls(ObjectGuid guid);
void _updateLeaderFlag(const bool remove = false); void _updateLeaderFlag(const bool remove = false);
bool _setMembersGroup(ObjectGuid guid, uint8 group); bool _setMembersGroup(ObjectGuid guid, uint8 group);

View file

@ -535,7 +535,7 @@ void WorldSession::HandleGuildSetRankOpcode(WorldPacket& recvPacket)
if (promote) if (promote)
{ {
// allow to promote only to lower rank than member's rank // allow to promote only to lower rank than member's rank
// and only to rank not higher that invoker's // and only to rank not higher that invoker's
if (GetPlayer()->GetRank() + 1 >= slot->RankId || newRankId <= GetPlayer()->GetRank()) if (GetPlayer()->GetRank() + 1 >= slot->RankId || newRankId <= GetPlayer()->GetRank())
{ {
SendGuildCommandResult(GUILD_INVITE_S, plName, ERR_GUILD_RANK_TOO_HIGH_S); SendGuildCommandResult(GUILD_INVITE_S, plName, ERR_GUILD_RANK_TOO_HIGH_S);

File diff suppressed because it is too large Load diff

View file

@ -178,7 +178,7 @@ enum LFGRoleCheckState
LFG_ROLECHECK_NO_ROLE = 6 // Someone didn't select a role LFG_ROLECHECK_NO_ROLE = 6 // Someone didn't select a role
}; };
/// Role types /// Role types
enum LFGRoles enum LFGRoles
{ {
PLAYER_ROLE_NONE = 0x00, PLAYER_ROLE_NONE = 0x00,
@ -260,7 +260,7 @@ struct ItemRewards
{ {
uint32 itemId; uint32 itemId;
uint32 itemAmount; uint32 itemAmount;
ItemRewards() : itemId(0), itemAmount(0) {} ItemRewards() : itemId(0), itemAmount(0) {}
ItemRewards(uint32 ItemId, uint32 ItemAmount) : itemId(ItemId), itemAmount(ItemAmount) {} ItemRewards(uint32 ItemId, uint32 ItemAmount) : itemId(ItemId), itemAmount(ItemAmount) {}
}; };
@ -273,12 +273,12 @@ struct LFGPlayers //TODO: rename to LFGQueueData
roleMap currentRoles; // tank, dps, healer, etc.. roleMap currentRoles; // tank, dps, healer, etc..
std::string comments; std::string comments;
bool isGroup; bool isGroup;
time_t joinedTime; time_t joinedTime;
uint8 neededTanks; uint8 neededTanks;
uint8 neededHealers; uint8 neededHealers;
uint8 neededDps; uint8 neededDps;
LFGPlayers() : currentState(LFG_STATE_NONE), currentRoles(0), isGroup(false) {} LFGPlayers() : currentState(LFG_STATE_NONE), currentRoles(0), isGroup(false) {}
LFGPlayers(LFGState state, std::set<uint32> dungeonSelection, roleMap CurrentRoles, std::string comment, bool IsGroup, time_t JoinedTime, LFGPlayers(LFGState state, std::set<uint32> dungeonSelection, roleMap CurrentRoles, std::string comment, bool IsGroup, time_t JoinedTime,
uint8 NeededTanks, uint8 NeededHealers, uint8 NeededDps) : currentState(state), dungeonList(dungeonSelection), uint8 NeededTanks, uint8 NeededHealers, uint8 NeededDps) : currentState(state), dungeonList(dungeonSelection),
@ -290,7 +290,7 @@ struct LFGRoleCheck
{ {
LFGRoleCheckState state; // current status of the role check LFGRoleCheckState state; // current status of the role check
roleMap currentRoles; // map of players to roles roleMap currentRoles; // map of players to roles
std::set<uint32> dungeonList; // The dungeons this player or group are queued for std::set<uint32> dungeonList; // The dungeons this player or group are queued for
uint32 randomDungeonID; // The random dungeon ID uint32 randomDungeonID; // The random dungeon ID
uint64 leaderGuidRaw; // ObjectGuid(raw) of leader uint64 leaderGuidRaw; // ObjectGuid(raw) of leader
time_t waitForRoleTime; // How long we'll wait for the players to confirm their roles time_t waitForRoleTime; // How long we'll wait for the players to confirm their roles
@ -302,7 +302,7 @@ struct LFGWait
int32 previousTime; // how long it took for the last person to go from queue to instance int32 previousTime; // how long it took for the last person to go from queue to instance
uint32 playerCount; // amount of players in x queue for calculations [not sure if needed when finished implementing system] uint32 playerCount; // amount of players in x queue for calculations [not sure if needed when finished implementing system]
bool doAverage; // tells the lfgmgr during a world update whether or not to recalculate waiting time bool doAverage; // tells the lfgmgr during a world update whether or not to recalculate waiting time
LFGWait() : time(-1), previousTime(-1), playerCount(0), doAverage(false) {} LFGWait() : time(-1), previousTime(-1), playerCount(0), doAverage(false) {}
LFGWait(int32 currentTime, int32 lastTime, uint32 currentPlayerCount, bool shouldRecalculate) LFGWait(int32 currentTime, int32 lastTime, uint32 currentPlayerCount, bool shouldRecalculate)
: time(currentTime), previousTime(lastTime), playerCount(currentPlayerCount), doAverage(shouldRecalculate) {} : time(currentTime), previousTime(lastTime), playerCount(currentPlayerCount), doAverage(shouldRecalculate) {}
@ -330,7 +330,7 @@ struct LFGPlayerStatus
LfgUpdateType updateType; LfgUpdateType updateType;
std::set<uint32> dungeonList; std::set<uint32> dungeonList;
std::string comment; std::string comment;
LFGPlayerStatus() { } LFGPlayerStatus() { }
LFGPlayerStatus(LFGState State, LfgUpdateType UpdateType, std::set<uint32> DungeonList, std::string Comment) LFGPlayerStatus(LFGState State, LfgUpdateType UpdateType, std::set<uint32> DungeonList, std::string Comment)
: state(State), updateType(UpdateType), dungeonList(DungeonList), comment(Comment) { } : state(State), updateType(UpdateType), dungeonList(DungeonList), comment(Comment) { }
@ -343,7 +343,7 @@ struct LFGGroupStatus //todo: check for this in joinlfg function, not lfgplayers
uint32 dungeonID; // ID of the dungeon the group should be in uint32 dungeonID; // ID of the dungeon the group should be in
roleMap playerRoles; // Container holding each player's objectguid and their roles roleMap playerRoles; // Container holding each player's objectguid and their roles
ObjectGuid leaderGuid; // The group leader's object guid ObjectGuid leaderGuid; // The group leader's object guid
LFGGroupStatus() { } LFGGroupStatus() { }
LFGGroupStatus(LFGState State, uint32 DungeonID, roleMap PlayerRoles, ObjectGuid LeaderGuid) LFGGroupStatus(LFGState State, uint32 DungeonID, roleMap PlayerRoles, ObjectGuid LeaderGuid)
: state(State), dungeonID(DungeonID), playerRoles(PlayerRoles), leaderGuid(LeaderGuid) { } : state(State), dungeonID(DungeonID), playerRoles(PlayerRoles), leaderGuid(LeaderGuid) { }
@ -375,7 +375,7 @@ struct LFGRewards
uint32 expReward; // Amount of experience rewarded uint32 expReward; // Amount of experience rewarded
uint32 itemID; // ID of item reward uint32 itemID; // ID of item reward
uint32 itemAmount; // How many of x item is rewarded uint32 itemAmount; // How many of x item is rewarded
LFGRewards() { } LFGRewards() { }
LFGRewards(uint32 RandomDungeonEntry, uint32 GroupDungeonEntry, bool HasDoneDaily, LFGRewards(uint32 RandomDungeonEntry, uint32 GroupDungeonEntry, bool HasDoneDaily,
uint32 MoneyReward, uint32 ExpReward, uint32 ItemID, uint32 ItemAmount) : uint32 MoneyReward, uint32 ExpReward, uint32 ItemID, uint32 ItemAmount) :
@ -392,7 +392,7 @@ struct LFGBoot
std::string reason; // Reason stated for the vote std::string reason; // Reason stated for the vote
proposalAnswerMap answers; // Player's votes proposalAnswerMap answers; // Player's votes
time_t startTime; // When the vote started time_t startTime; // When the vote started
LFGBoot() { } LFGBoot() { }
LFGBoot(bool InProgress, ObjectGuid PlayerVotedOn, std::string Reason, proposalAnswerMap Answers, time_t StartTime) LFGBoot(bool InProgress, ObjectGuid PlayerVotedOn, std::string Reason, proposalAnswerMap Answers, time_t StartTime)
: inProgress(InProgress), playerVotedOn(PlayerVotedOn), reason(Reason), answers(Answers), startTime(StartTime) { } : inProgress(InProgress), playerVotedOn(PlayerVotedOn), reason(Reason), answers(Answers), startTime(StartTime) { }
@ -405,291 +405,291 @@ class LFGMgr
public: public:
LFGMgr(); LFGMgr();
~LFGMgr(); ~LFGMgr();
/// Update queue information and such /// Update queue information and such
void Update(); void Update();
/** /**
* @brief Attempt to join the dungeon finder queue, as long as the player(s) * @brief Attempt to join the dungeon finder queue, as long as the player(s)
* fit the criteria. * fit the criteria.
* *
* @param roles Roles selected in lfg window * @param roles Roles selected in lfg window
* @param dungeons List of dungeon(s) selected * @param dungeons List of dungeon(s) selected
* @param comments Comments made by the player * @param comments Comments made by the player
* @param plr Pointer to the player sending the packet * @param plr Pointer to the player sending the packet
*/ */
void JoinLFG(uint32 roles, std::set<uint32> dungeons, std::string comments, Player* plr); void JoinLFG(uint32 roles, std::set<uint32> dungeons, std::string comments, Player* plr);
/** /**
* @brief Leave the lfg/dungeon finder system. * @brief Leave the lfg/dungeon finder system.
* *
* @param plr The pointer to the player sending the request * @param plr The pointer to the player sending the request
* @param isGroup Whether or not they are the leader of a group / in a group * @param isGroup Whether or not they are the leader of a group / in a group
*/ */
void LeaveLFG(Player* plr, bool isGroup); void LeaveLFG(Player* plr, bool isGroup);
/** /**
* @brief Go through a number of checks to see if the player/group can join * @brief Go through a number of checks to see if the player/group can join
* the LFG queue * the LFG queue
* *
* @param plr The pointer to the player * @param plr The pointer to the player
*/ */
LfgJoinResult GetJoinResult(Player* plr); LfgJoinResult GetJoinResult(Player* plr);
/** /**
* @brief Fetch the playerstatus struct of a player on request, if existant * @brief Fetch the playerstatus struct of a player on request, if existant
* *
* @param guid the player's objectguid * @param guid the player's objectguid
*/ */
LFGPlayerStatus GetPlayerStatus(ObjectGuid guid); LFGPlayerStatus GetPlayerStatus(ObjectGuid guid);
/** /**
* @brief Set the player's comment string * @brief Set the player's comment string
* *
* @param guid The player's objectguid * @param guid The player's objectguid
* @param comment Their comments * @param comment Their comments
*/ */
void SetPlayerComment(ObjectGuid guid, std::string comment); void SetPlayerComment(ObjectGuid guid, std::string comment);
/** /**
* @brief Set the player's LFG state * @brief Set the player's LFG state
* *
* @param guid The player's objectguid * @param guid The player's objectguid
* @param state the LFGState value * @param state the LFGState value
*/ */
void SetPlayerState(ObjectGuid guid, LFGState state); void SetPlayerState(ObjectGuid guid, LFGState state);
/** /**
* @brief Set the player's LFG update type * @brief Set the player's LFG update type
* *
* @param guid The player's objectguid * @param guid The player's objectguid
* @param updateType The LfgUpdateType value * @param updateType The LfgUpdateType value
*/ */
void SetPlayerUpdateType(ObjectGuid guid, LfgUpdateType updateType); void SetPlayerUpdateType(ObjectGuid guid, LfgUpdateType updateType);
/** /**
* @brief Used to fetch the item rewards of a dungeon from the database * @brief Used to fetch the item rewards of a dungeon from the database
* *
* @param dungeonId the dungeon ID used in the DBCs * @param dungeonId the dungeon ID used in the DBCs
* @param type the type of dungeon * @param type the type of dungeon
*/ */
ItemRewards GetDungeonItemRewards(uint32 dungeonId, DungeonTypes type); ItemRewards GetDungeonItemRewards(uint32 dungeonId, DungeonTypes type);
/** /**
* @brief Used to determine the type of dungeon for ease of use. * @brief Used to determine the type of dungeon for ease of use.
* *
* @param dungeonId the dungeon ID used in the DBCs * @param dungeonId the dungeon ID used in the DBCs
*/ */
DungeonTypes GetDungeonType(uint32 dungeonId); DungeonTypes GetDungeonType(uint32 dungeonId);
/** /**
* @brief Used to record the first time a player has entered x type of dungeon in the day. * @brief Used to record the first time a player has entered x type of dungeon in the day.
* *
* @param guidLow the player's guidLow * @param guidLow the player's guidLow
* @param dungeon the specific type/expansion of dungeon * @param dungeon the specific type/expansion of dungeon
*/ */
void RegisterPlayerDaily(uint32 guidLow, DungeonTypes dungeon); void RegisterPlayerDaily(uint32 guidLow, DungeonTypes dungeon);
/** /**
* @brief Used to find whether or not the player has done x type of dungeon today. * @brief Used to find whether or not the player has done x type of dungeon today.
* *
* @param guidLow the player's guidLow * @param guidLow the player's guidLow
* @param dungeon the specific type/expansion of dungeon * @param dungeon the specific type/expansion of dungeon
*/ */
bool HasPlayerDoneDaily(uint32 guidLow, DungeonTypes dungeon); bool HasPlayerDoneDaily(uint32 guidLow, DungeonTypes dungeon);
/// Reset accounts of players completing a/any dungeon for the day for new rewards /// Reset accounts of players completing a/any dungeon for the day for new rewards
void ResetDailyRecords(); void ResetDailyRecords();
/** /**
* @brief Find out whether or not a special dungeon is available for that season * @brief Find out whether or not a special dungeon is available for that season
* *
* @param dungeonId the ID of the dungeon in question * @param dungeonId the ID of the dungeon in question
*/ */
bool IsSeasonActive(uint32 dungeonId); bool IsSeasonActive(uint32 dungeonId);
/** /**
* @brief Find the random dungeons applicable for a player * @brief Find the random dungeons applicable for a player
* *
* @param level The level of said player * @param level The level of said player
* @param expansion The player's expansion * @param expansion The player's expansion
*/ */
dungeonEntries FindRandomDungeonsForPlayer(uint32 level, uint8 expansion); dungeonEntries FindRandomDungeonsForPlayer(uint32 level, uint8 expansion);
/** /**
* @brief Find the random dungeons not applicable for a player * @brief Find the random dungeons not applicable for a player
* *
* @param level The level of said player * @param level The level of said player
* @param expansion The player's expansion * @param expansion The player's expansion
*/ */
dungeonForbidden FindRandomDungeonsNotForPlayer(Player* plr); dungeonForbidden FindRandomDungeonsNotForPlayer(Player* plr);
/// Given the ID of a dungeon, spit out its entry /// Given the ID of a dungeon, spit out its entry
uint32 GetDungeonEntry(uint32 ID); uint32 GetDungeonEntry(uint32 ID);
/// Teleports a player out of a dungeon (called by CMSG_LFG_TELEPORT) /// Teleports a player out of a dungeon (called by CMSG_LFG_TELEPORT)
void TeleportPlayer(Player* pPlayer, bool out); void TeleportPlayer(Player* pPlayer, bool out);
/// Queue Functions Below /// Queue Functions Below
/** /**
* Find the player's or group's information and update the system with * Find the player's or group's information and update the system with
* the amount of each role they need to find. * the amount of each role they need to find.
* *
* @param guid The guid assigned to the structure * @param guid The guid assigned to the structure
* @param information The LFGPlayers structure containing their information * @param information The LFGPlayers structure containing their information
*/ */
void UpdateNeededRoles(ObjectGuid guid, LFGPlayers* information); void UpdateNeededRoles(ObjectGuid guid, LFGPlayers* information);
/** /**
* @brief Add the player or group to the Dungeon Finder queue * @brief Add the player or group to the Dungeon Finder queue
* *
* @param guid the player/group's ObjectGuid * @param guid the player/group's ObjectGuid
*/ */
void AddToQueue(ObjectGuid guid); void AddToQueue(ObjectGuid guid);
/** /**
* @brief Remove the player or group from the Dungeon Finder queue * @brief Remove the player or group from the Dungeon Finder queue
* *
* @param guid the player/group's ObjectGuid * @param guid the player/group's ObjectGuid
*/ */
void RemoveFromQueue(ObjectGuid guid); void RemoveFromQueue(ObjectGuid guid);
/// Search the queue for compatible matches /// Search the queue for compatible matches
void FindQueueMatches(); void FindQueueMatches();
/** /**
* @brief Search the queue for matches based off of one's guid * @brief Search the queue for matches based off of one's guid
* *
* @param guid The player or group's guid * @param guid The player or group's guid
*/ */
void FindSpecificQueueMatches(ObjectGuid guid); void FindSpecificQueueMatches(ObjectGuid guid);
/// Send a periodic status update for queued players /// Send a periodic status update for queued players
void SendQueueStatus(); void SendQueueStatus();
/// Role-Related Functions /// Role-Related Functions
/** /**
* @brief Set and/or confirm roles for a group. * @brief Set and/or confirm roles for a group.
* *
* @param pPlayer The pointer to the player issuing the request * @param pPlayer The pointer to the player issuing the request
* @param pGroup The pointer to that player's group * @param pGroup The pointer to that player's group
* @param roles The group leader's role(s) * @param roles The group leader's role(s)
*/ */
void PerformRoleCheck(Player* pPlayer, Group* pGroup, uint8 roles); void PerformRoleCheck(Player* pPlayer, Group* pGroup, uint8 roles);
/// Make sure role selections are okay /// Make sure role selections are okay
bool ValidateGroupRoles(roleMap groupMap); bool ValidateGroupRoles(roleMap groupMap);
/// Proposal-Related Functions /// Proposal-Related Functions
void ProposalUpdate(uint32 proposalID, ObjectGuid plrGuid, bool accepted); void ProposalUpdate(uint32 proposalID, ObjectGuid plrGuid, bool accepted);
/// Handles reward hooks -- called by achievement manager /// Handles reward hooks -- called by achievement manager
void HandleBossKilled(Player* pPlayer); void HandleBossKilled(Player* pPlayer);
/// Group kick hook /// Group kick hook
void AttemptToKickPlayer(Group* pGroup, ObjectGuid guid, ObjectGuid kicker, std::string reason); void AttemptToKickPlayer(Group* pGroup, ObjectGuid guid, ObjectGuid kicker, std::string reason);
// Called when a player votes yes or no on a boot vote // Called when a player votes yes or no on a boot vote
void CastVote(Player* pPlayer, bool vote); void CastVote(Player* pPlayer, bool vote);
protected: protected:
bool IsSeasonal(uint32 dbcFlags) { return ((dbcFlags & LFG_FLAG_SEASONAL) != 0) ? true : false; } bool IsSeasonal(uint32 dbcFlags) { return ((dbcFlags & LFG_FLAG_SEASONAL) != 0) ? true : false; }
/// Check if player/party is already in the system, return that data /// Check if player/party is already in the system, return that data
LFGPlayers* GetPlayerOrPartyData(ObjectGuid guid); LFGPlayers* GetPlayerOrPartyData(ObjectGuid guid);
/// Get a proposal structure given its id /// Get a proposal structure given its id
LFGProposal* GetProposalData(uint32 proposalID); LFGProposal* GetProposalData(uint32 proposalID);
/// Get information on a group currently in a dungeon /// Get information on a group currently in a dungeon
LFGGroupStatus* GetGroupStatus(ObjectGuid guid); LFGGroupStatus* GetGroupStatus(ObjectGuid guid);
/// Add the player to their respective waiting map for their dungeon /// Add the player to their respective waiting map for their dungeon
void AddToWaitMap(uint8 role, std::set<uint32> dungeons); void AddToWaitMap(uint8 role, std::set<uint32> dungeons);
/// Checks if any players have the leader flag for their roles /// Checks if any players have the leader flag for their roles
bool HasLeaderFlag(roleMap const& roles); bool HasLeaderFlag(roleMap const& roles);
/// Compares two groups/players to see if their role combinations are compatible /// Compares two groups/players to see if their role combinations are compatible
bool RoleMapsAreCompatible(LFGPlayers* groupOne, LFGPlayers* groupTwo); bool RoleMapsAreCompatible(LFGPlayers* groupOne, LFGPlayers* groupTwo);
/// Checks whether or not two combinations of players/groups are on the same team (alliance/horde) /// Checks whether or not two combinations of players/groups are on the same team (alliance/horde)
bool MatchesAreOfSameTeam(LFGPlayers* groupOne, LFGPlayers* groupTwo); bool MatchesAreOfSameTeam(LFGPlayers* groupOne, LFGPlayers* groupTwo);
/// Are the players in a proposal already grouped up? /// Are the players in a proposal already grouped up?
bool IsProposalSameGroup(LFGProposal const& proposal); bool IsProposalSameGroup(LFGProposal const& proposal);
/// Update a proposal after a player refused to join /// Update a proposal after a player refused to join
void ProposalDeclined(ObjectGuid guid, LFGProposal* proposal); void ProposalDeclined(ObjectGuid guid, LFGProposal* proposal);
/// Updates a wait map with the amount of time it took the last player to join /// Updates a wait map with the amount of time it took the last player to join
void UpdateWaitMap(LFGRoles role, uint32 dungeonID, time_t waitTime); void UpdateWaitMap(LFGRoles role, uint32 dungeonID, time_t waitTime);
/// Creates a group so they can enter a dungeon together /// Creates a group so they can enter a dungeon together
void CreateDungeonGroup(LFGProposal* proposal); void CreateDungeonGroup(LFGProposal* proposal);
/// Sends a group to the dungeon assigned to them /// Sends a group to the dungeon assigned to them
void TeleportToDungeon(uint32 dungeonID, Group* pGroup); void TeleportToDungeon(uint32 dungeonID, Group* pGroup);
/** /**
* @brief Merges two players/groups/etc into one for dungeon assignment. * @brief Merges two players/groups/etc into one for dungeon assignment.
* *
* @param guidOne The guid assigned to the first group in m_playerData * @param guidOne The guid assigned to the first group in m_playerData
* @param guidTwo The guid assigned to the second group in m_playerData * @param guidTwo The guid assigned to the second group in m_playerData
* @param compatibleDungeons The dungeons that both players or groups agreed to doing * @param compatibleDungeons The dungeons that both players or groups agreed to doing
*/ */
void MergeGroups(ObjectGuid guidOne, ObjectGuid guidTwo, std::set<uint32> compatibleDungeons); void MergeGroups(ObjectGuid guidOne, ObjectGuid guidTwo, std::set<uint32> compatibleDungeons);
/// Send a proposal to each member of a group /// Send a proposal to each member of a group
void SendDungeonProposal(LFGPlayers* lfgGroup); void SendDungeonProposal(LFGPlayers* lfgGroup);
/// Tell a group member that someone else just confirmed their role /// Tell a group member that someone else just confirmed their role
void SendRoleChosen(ObjectGuid plrGuid, ObjectGuid confirmedGuid, uint8 roles); void SendRoleChosen(ObjectGuid plrGuid, ObjectGuid confirmedGuid, uint8 roles);
/// Send SMSG_LFG_ROLE_CHECK_UPDATE to a specific player /// Send SMSG_LFG_ROLE_CHECK_UPDATE to a specific player
void SendRoleCheckUpdate(ObjectGuid plrGuid, LFGRoleCheck const& roleCheck); void SendRoleCheckUpdate(ObjectGuid plrGuid, LFGRoleCheck const& roleCheck);
/// Send SMSG_LFG_UPDATE_PARTY or SMSG_LFG_UPDATE_PLAYER /// Send SMSG_LFG_UPDATE_PARTY or SMSG_LFG_UPDATE_PLAYER
void SendLfgUpdate(ObjectGuid plrGuid, LFGPlayerStatus status, bool isGroup); void SendLfgUpdate(ObjectGuid plrGuid, LFGPlayerStatus status, bool isGroup);
/// Send SMSG_LFG_JOIN_RESULT /// Send SMSG_LFG_JOIN_RESULT
void SendLfgJoinResult(ObjectGuid plrGuid, LfgJoinResult result, LFGState state, partyForbidden const& lockedDungeons); void SendLfgJoinResult(ObjectGuid plrGuid, LfgJoinResult result, LFGState state, partyForbidden const& lockedDungeons);
/// Get rid of expired role checks /// Get rid of expired role checks
void RemoveOldRoleChecks(); void RemoveOldRoleChecks();
private: private:
/// Daily occurences of a player doing X type dungeon /// Daily occurences of a player doing X type dungeon
dailyEntries m_dailyAny; dailyEntries m_dailyAny;
dailyEntries m_dailyTBCHeroic; dailyEntries m_dailyTBCHeroic;
dailyEntries m_dailyLKNormal; dailyEntries m_dailyLKNormal;
dailyEntries m_dailyLKHeroic; dailyEntries m_dailyLKHeroic;
/// General info related to joining / leaving the dungeon finder /// General info related to joining / leaving the dungeon finder
playerData m_playerData; playerData m_playerData;
queueSet m_queueSet; queueSet m_queueSet;
/// Dungeon Finder Status for players /// Dungeon Finder Status for players
playerStatusMap m_playerStatusMap; playerStatusMap m_playerStatusMap;
groupSet m_groupSet; groupSet m_groupSet;
groupStatusMap m_groupStatusMap; groupStatusMap m_groupStatusMap;
/// Role check information /// Role check information
roleCheckMap m_roleCheckMap; roleCheckMap m_roleCheckMap;
/// Boot vote information /// Boot vote information
bootStatusMap m_bootStatusMap; bootStatusMap m_bootStatusMap;
/// Wait times for the queue /// Wait times for the queue
waitTimeMap m_tankWaitTime; waitTimeMap m_tankWaitTime;
waitTimeMap m_healerWaitTime; waitTimeMap m_healerWaitTime;
waitTimeMap m_dpsWaitTime; waitTimeMap m_dpsWaitTime;
waitTimeMap m_avgWaitTime; waitTimeMap m_avgWaitTime;
/// Proposal information /// Proposal information
uint32 m_proposalId; uint32 m_proposalId;
proposalMap m_proposalMap; proposalMap m_proposalMap;

View file

@ -114,8 +114,14 @@ class Map : public GridRefManager<NGridType>
// currently unused for normal maps // currently unused for normal maps
bool CanUnload(uint32 diff) bool CanUnload(uint32 diff)
{ {
if (!m_unloadTimer) { return false; } if (!m_unloadTimer)
if (m_unloadTimer <= diff) { return true; } {
return false;
}
if (m_unloadTimer <= diff)
{
return true;
}
m_unloadTimer -= diff; m_unloadTimer -= diff;
return false; return false;
} }
@ -492,4 +498,4 @@ Map::Visit(const Cell& cell, TypeContainerVisitor<T, CONTAINER>& visitor)
getNGrid(x, y)->Visit(cell_x, cell_y, visitor); getNGrid(x, y)->Visit(cell_x, cell_y, visitor);
} }
} }
#endif #endif

View file

@ -240,7 +240,7 @@ void WorldSession::HandlePetAction(WorldPacket& recv_data)
const SpellRangeEntry* sRange = sSpellRangeStore.LookupEntry(spellInfo->rangeIndex); const SpellRangeEntry* sRange = sSpellRangeStore.LookupEntry(spellInfo->rangeIndex);
if (unit_target && !(pet->IsWithinDistInMap(unit_target, sRange->maxRange) && pet->IsWithinLOSInMap(unit_target)) if (unit_target && !(pet->IsWithinDistInMap(unit_target, sRange->maxRange) && pet->IsWithinLOSInMap(unit_target))
&& !(GetPlayer()->IsFriendlyTo(unit_target) || pet->HasAuraType(SPELL_AURA_MOD_POSSESS))) && !(GetPlayer()->IsFriendlyTo(unit_target) || pet->HasAuraType(SPELL_AURA_MOD_POSSESS)))
{ {
((Pet*)pet)->SetSpellOpener(spellid, sRange->minRange, sRange->maxRange); ((Pet*)pet)->SetSpellOpener(spellid, sRange->minRange, sRange->maxRange);
@ -805,4 +805,4 @@ void WorldSession::HandleDismissCritter(WorldPacket& recvData)
if (pet->GetTypeId() == TYPEID_UNIT && ((Creature*)pet)->IsTemporarySummon()) if (pet->GetTypeId() == TYPEID_UNIT && ((Creature*)pet)->IsTemporarySummon())
((TemporarySummon*)pet)->UnSummon(); ((TemporarySummon*)pet)->UnSummon();
} }
} }

View file

@ -52,7 +52,7 @@ Quest::Quest(Field* questRecord)
CharTitleId = questRecord[20].GetUInt32(); CharTitleId = questRecord[20].GetUInt32();
PlayersSlain = questRecord[21].GetUInt32(); PlayersSlain = questRecord[21].GetUInt32();
BonusTalents = questRecord[22].GetUInt32(); BonusTalents = questRecord[22].GetUInt32();
PortraitGiver = questRecord[23].GetUInt32(); PortraitGiver = questRecord[23].GetUInt32();
PortraitTurnIn = questRecord[24].GetUInt32(); PortraitTurnIn = questRecord[24].GetUInt32();
@ -71,7 +71,7 @@ Quest::Quest(Field* questRecord)
RequestItemsText = questRecord[37].GetCppString(); RequestItemsText = questRecord[37].GetCppString();
EndText = questRecord[38].GetCppString(); EndText = questRecord[38].GetCppString();
CompletedText = questRecord[39].GetCppString(); CompletedText = questRecord[39].GetCppString();
PortraitGiverName = questRecord[40].GetCppString(); PortraitGiverName = questRecord[40].GetCppString();
PortraitGiverText = questRecord[41].GetCppString(); PortraitGiverText = questRecord[41].GetCppString();
PortraitTurnInName = questRecord[42].GetCppString(); PortraitTurnInName = questRecord[42].GetCppString();
@ -97,12 +97,12 @@ Quest::Quest(Field* questRecord)
for (int i = 0; i < QUEST_OBJECTIVES_COUNT; ++i) for (int i = 0; i < QUEST_OBJECTIVES_COUNT; ++i)
ReqCreatureOrGOCount[i] = questRecord[72 + i].GetUInt32(); ReqCreatureOrGOCount[i] = questRecord[72 + i].GetUInt32();
for (int i = 0; i < QUEST_REQUIRED_CURRENCY_COUNT; ++i) for (int i = 0; i < QUEST_REQUIRED_CURRENCY_COUNT; ++i)
ReqCurrencyId[i] = questRecord[76 + i].GetUInt32(); ReqCurrencyId[i] = questRecord[76 + i].GetUInt32();
for (int i = 0; i < QUEST_REQUIRED_CURRENCY_COUNT; ++i) for (int i = 0; i < QUEST_REQUIRED_CURRENCY_COUNT; ++i)
ReqCurrencyCount[i] = questRecord[80 + i].GetUInt32(); ReqCurrencyCount[i] = questRecord[80 + i].GetUInt32();
for (int i = 0; i < QUEST_OBJECTIVES_COUNT; ++i) for (int i = 0; i < QUEST_OBJECTIVES_COUNT; ++i)
ReqSpell[i] = questRecord[84 + i].GetUInt32(); ReqSpell[i] = questRecord[84 + i].GetUInt32();
@ -119,8 +119,8 @@ Quest::Quest(Field* questRecord)
RewItemId[i] = questRecord[101 + i].GetUInt32(); RewItemId[i] = questRecord[101 + i].GetUInt32();
for (int i = 0; i < QUEST_REWARDS_COUNT; ++i) for (int i = 0; i < QUEST_REWARDS_COUNT; ++i)
RewItemCount[i] = questRecord[105 + i].GetUInt32(); RewItemCount[i] = questRecord[105 + i].GetUInt32();
for (int i = 0; i < QUEST_REWARD_CURRENCY_COUNT; ++i) for (int i = 0; i < QUEST_REWARD_CURRENCY_COUNT; ++i)
RewCurrencyId[i] = questRecord[109 + i].GetUInt32(); RewCurrencyId[i] = questRecord[109 + i].GetUInt32();
for (int i = 0; i < QUEST_REWARD_CURRENCY_COUNT; ++i) for (int i = 0; i < QUEST_REWARD_CURRENCY_COUNT; ++i)
@ -164,7 +164,7 @@ Quest::Quest(Field* questRecord)
OfferRewardEmote[i] = questRecord[156 + i].GetInt32(); OfferRewardEmote[i] = questRecord[156 + i].GetInt32();
for (int i = 0; i < QUEST_EMOTE_COUNT; ++i) for (int i = 0; i < QUEST_EMOTE_COUNT; ++i)
OfferRewardEmoteDelay[i] = questRecord[160 + i].GetInt32(); OfferRewardEmoteDelay[i] = questRecord[160 + i].GetInt32();
SoundAcceptId = questRecord[164].GetUInt32(); SoundAcceptId = questRecord[164].GetUInt32();
SoundTurnInId = questRecord[165].GetUInt32(); SoundTurnInId = questRecord[165].GetUInt32();

View file

@ -2713,7 +2713,7 @@ bool ScriptMgr::OnEffectDummy(Unit* pCaster, uint32 spellId, SpellEffectIndex ef
return false; return false;
#endif #endif
} }
bool ScriptMgr::OnEffectDummy(Unit* pCaster, uint32 spellId, SpellEffectIndex effIndex, GameObject* pTarget, ObjectGuid originalCasterGuid) bool ScriptMgr::OnEffectDummy(Unit* pCaster, uint32 spellId, SpellEffectIndex effIndex, GameObject* pTarget, ObjectGuid originalCasterGuid)
{ {
// Used by Eluna // Used by Eluna
@ -2728,7 +2728,7 @@ bool ScriptMgr::OnEffectDummy(Unit* pCaster, uint32 spellId, SpellEffectIndex ef
return false; return false;
#endif #endif
} }
bool ScriptMgr::OnEffectDummy(Unit* pCaster, uint32 spellId, SpellEffectIndex effIndex, Item* pTarget, ObjectGuid originalCasterGuid) bool ScriptMgr::OnEffectDummy(Unit* pCaster, uint32 spellId, SpellEffectIndex effIndex, Item* pTarget, ObjectGuid originalCasterGuid)
{ {
// Used by Eluna // Used by Eluna

View file

@ -709,7 +709,7 @@ class ScriptMgr
ScriptNameMap m_scriptNames; ScriptNameMap m_scriptNames;
DBScripts m_dbScripts; DBScripts m_dbScripts;
#ifdef _DEBUG #ifdef _DEBUG
// mutex allowing to reload the script binding table; TODO just do it AWAY from any map update, e.g. right after sessions update // mutex allowing to reload the script binding table; TODO just do it AWAY from any map update, e.g. right after sessions update
ACE_RW_Thread_Mutex m_bindMutex; ACE_RW_Thread_Mutex m_bindMutex;
#endif /* _DEBUG */ #endif /* _DEBUG */
// atomic op counter for active scripts amount // atomic op counter for active scripts amount

View file

@ -247,7 +247,7 @@ void SpellCastTargets::read(ByteBuffer& data, Unit* caster)
// TARGET_FLAG_UNK2 is used for non-combat pets, maybe other? // TARGET_FLAG_UNK2 is used for non-combat pets, maybe other?
if (m_targetMask & (TARGET_FLAG_UNIT | TARGET_FLAG_UNK2)) if (m_targetMask & (TARGET_FLAG_UNIT | TARGET_FLAG_UNK2))
data >> m_unitTargetGUID.ReadAsPacked(); data >> m_unitTargetGUID.ReadAsPacked();
if (m_targetMask & (TARGET_FLAG_OBJECT | TARGET_FLAG_GAMEOBJECT_ITEM)) if (m_targetMask & (TARGET_FLAG_OBJECT | TARGET_FLAG_GAMEOBJECT_ITEM))
data >> m_GOTargetGUID.ReadAsPacked(); data >> m_GOTargetGUID.ReadAsPacked();
@ -1692,7 +1692,7 @@ void Spell::SetTargetMap(SpellEffectIndex effIndex, uint32 targetMode, UnitList&
uint32 unMaxTargets = m_spellInfo->GetMaxAffectedTargets(); uint32 unMaxTargets = m_spellInfo->GetMaxAffectedTargets();
float radius; float radius;
GetSpellRangeAndRadius(spellEffect, radius, EffectChainTarget, unMaxTargets); GetSpellRangeAndRadius(spellEffect, radius, EffectChainTarget, unMaxTargets);
std::list<GameObject*> tempTargetGOList; std::list<GameObject*> tempTargetGOList;
@ -6387,7 +6387,7 @@ SpellCastResult Spell::CheckCast(bool strict)
return SPELL_FAILED_NO_MOUNTS_ALLOWED; return SPELL_FAILED_NO_MOUNTS_ALLOWED;
if (spellEffect->EffectMiscValueB && !m_caster->GetMountCapability(spellEffect->EffectMiscValueB)) if (spellEffect->EffectMiscValueB && !m_caster->GetMountCapability(spellEffect->EffectMiscValueB))
return SPELL_FAILED_NOT_HERE; return SPELL_FAILED_NOT_HERE;
// Ignore map check if spell have AreaId. AreaId already checked and this prevent special mount spells // Ignore map check if spell have AreaId. AreaId already checked and this prevent special mount spells
if (m_caster->GetTypeId() == TYPEID_PLAYER && !sMapStore.LookupEntry(m_caster->GetMapId())->IsMountAllowed() && !m_IsTriggeredSpell && !m_spellInfo->GetAreaGroupId()) if (m_caster->GetTypeId() == TYPEID_PLAYER && !sMapStore.LookupEntry(m_caster->GetMapId())->IsMountAllowed() && !m_IsTriggeredSpell && !m_spellInfo->GetAreaGroupId())

View file

@ -1236,7 +1236,7 @@ void Aura::TriggerSpell()
// // Haunted // // Haunted
// case 18347: break; // case 18347: break;
// // Ranshalla Waiting // // Ranshalla Waiting
// case 18953: break; // case 18953: break;
case 19695: // Inferno case 19695: // Inferno
{ {
@ -3535,7 +3535,7 @@ void Aura::HandleAuraMounted(bool apply, bool Real)
if (apply) if (apply)
{ {
// Running Wild // Running Wild
if (GetId() == 87840) if (GetId() == 87840)
target->Mount(target->getGender() == GENDER_MALE ? 29422 : 29423, GetId()); target->Mount(target->getGender() == GENDER_MALE ? 29422 : 29423, GetId());
@ -4497,7 +4497,7 @@ void Aura::HandleModCharm(bool apply, bool Real)
{ {
//remove any existing charm just in case //remove any existing charm just in case
caster->Uncharm(); caster->Uncharm();
//pets should be removed when possesing a target if somehow check was bypassed //pets should be removed when possesing a target if somehow check was bypassed
((Player*)caster)->UnsummonPetIfAny(); ((Player*)caster)->UnsummonPetIfAny();
} }
@ -6395,7 +6395,7 @@ void Aura::HandleAuraModIncreaseHealth(bool apply, bool Real)
{ {
// Special case with temporary increase max/current health // Special case with temporary increase max/current health
// Cases where we need to manually calculate the amount for the spell (by percentage) // Cases where we need to manually calculate the amount for the spell (by percentage)
// recalculate to full amount at apply for proper remove // recalculate to full amount at apply for proper remove
case 54443: // Demonic Empowerment (Voidwalker) case 54443: // Demonic Empowerment (Voidwalker)
case 55233: // Vampiric Blood case 55233: // Vampiric Blood
case 61254: // Will of Sartharion (Obsidian Sanctum) case 61254: // Will of Sartharion (Obsidian Sanctum)
@ -6404,7 +6404,7 @@ void Aura::HandleAuraModIncreaseHealth(bool apply, bool Real)
// no break here // no break here
// Cases where m_amount already has the correct value (spells cast with CastCustomSpell or absolute values) // Cases where m_amount already has the correct value (spells cast with CastCustomSpell or absolute values)
case 12976: // Warrior Last Stand triggered spell case 12976: // Warrior Last Stand triggered spell
case 28726: // Nightmare Seed ( Nightmare Seed ) case 28726: // Nightmare Seed ( Nightmare Seed )
case 31616: // Nature's Guardian case 31616: // Nature's Guardian
@ -7121,8 +7121,14 @@ void Aura::HandleShapeshiftBoosts(bool apply)
const PlayerSpellMap& sp_list = ((Player*)target)->GetSpellMap(); const PlayerSpellMap& sp_list = ((Player*)target)->GetSpellMap();
for (PlayerSpellMap::const_iterator itr = sp_list.begin(); itr != sp_list.end(); ++itr) for (PlayerSpellMap::const_iterator itr = sp_list.begin(); itr != sp_list.end(); ++itr)
{ {
if (itr->second.state == PLAYERSPELL_REMOVED) { continue; } if (itr->second.state == PLAYERSPELL_REMOVED)
if (itr->first == spellId1 || itr->first == spellId2) { continue; } {
continue;
}
if (itr->first == spellId1 || itr->first == spellId2)
{
continue;
}
SpellEntry const* spellInfo = sSpellStore.LookupEntry(itr->first); SpellEntry const* spellInfo = sSpellStore.LookupEntry(itr->first);
if (!spellInfo || !IsNeedCastSpellAtFormApply(spellInfo, form)) if (!spellInfo || !IsNeedCastSpellAtFormApply(spellInfo, form))
{ {
@ -7900,7 +7906,7 @@ void Aura::PeriodicTick()
{ {
spell->cancel(); spell->cancel();
} }
if (Player* modOwner = pCaster->GetSpellModOwner()) if (Player* modOwner = pCaster->GetSpellModOwner())
{ {
modOwner->ApplySpellMod(GetId(), SPELLMOD_ALL_EFFECTS, new_damage); modOwner->ApplySpellMod(GetId(), SPELLMOD_ALL_EFFECTS, new_damage);
@ -8125,7 +8131,7 @@ void Aura::PeriodicTick()
pdamage = target->GetMaxPower(POWER_MANA) * 5 / 100; pdamage = target->GetMaxPower(POWER_MANA) * 5 / 100;
drain_amount = target->GetPower(POWER_MANA) > pdamage ? pdamage : target->GetPower(POWER_MANA); drain_amount = target->GetPower(POWER_MANA) > pdamage ? pdamage : target->GetPower(POWER_MANA);
target->ModifyPower(POWER_MANA, -drain_amount); target->ModifyPower(POWER_MANA, -drain_amount);
SpellPeriodicAuraLogInfo info(this, drain_amount, 0, 0, 0, 0.0f); SpellPeriodicAuraLogInfo info(this, drain_amount, 0, 0, 0, 0.0f);
target->SendPeriodicAuraLog(&info); target->SendPeriodicAuraLog(&info);
} }

View file

@ -439,7 +439,7 @@ class Aura
Modifier const* GetModifier() const { return &m_modifier; } Modifier const* GetModifier() const { return &m_modifier; }
int32 GetMiscValue() const { return m_spellEffect ? m_spellEffect->EffectMiscValue : 0; } int32 GetMiscValue() const { return m_spellEffect ? m_spellEffect->EffectMiscValue : 0; }
int32 GetMiscBValue() const { return m_spellEffect ? m_spellEffect->EffectMiscValueB : 0; } int32 GetMiscBValue() const { return m_spellEffect ? m_spellEffect->EffectMiscValueB : 0; }
SpellEntry const* GetSpellProto() const { return GetHolder()->GetSpellProto(); } SpellEntry const* GetSpellProto() const { return GetHolder()->GetSpellProto(); }
SpellEffectEntry const* GetSpellEffect() const { return m_spellEffect; } SpellEffectEntry const* GetSpellEffect() const { return m_spellEffect; }
uint32 GetId() const{ return GetHolder()->GetSpellProto()->Id; } uint32 GetId() const{ return GetHolder()->GetSpellProto()->Id; }

View file

@ -309,7 +309,7 @@ void Spell::EffectInstaKill(SpellEffectEntry const* /*effect*/)
data << unitTarget->GetObjectGuid(); // Victim GUID data << unitTarget->GetObjectGuid(); // Victim GUID
data << uint32(m_spellInfo->Id); data << uint32(m_spellInfo->Id);
m_caster->SendMessageToSet(&data, true); m_caster->SendMessageToSet(&data, true);
m_caster->DealDamage(unitTarget, unitTarget->GetHealth(), NULL, DIRECT_DAMAGE, SPELL_SCHOOL_MASK_NORMAL, m_spellInfo, false); m_caster->DealDamage(unitTarget, unitTarget->GetHealth(), NULL, DIRECT_DAMAGE, SPELL_SCHOOL_MASK_NORMAL, m_spellInfo, false);
} }
@ -5390,7 +5390,7 @@ void Spell::EffectSummonType(SpellEffectEntry const* effect)
Unit* responsibleCaster = m_originalCaster; Unit* responsibleCaster = m_originalCaster;
if (realCaster->GetTypeId() == TYPEID_GAMEOBJECT) if (realCaster->GetTypeId() == TYPEID_GAMEOBJECT)
responsibleCaster = ((GameObject*)realCaster)->GetOwner(); responsibleCaster = ((GameObject*)realCaster)->GetOwner();
// Expected Level (Totem, Pet and Critter may not use this) // Expected Level (Totem, Pet and Critter may not use this)
uint32 level = responsibleCaster ? responsibleCaster->getLevel() : m_caster->getLevel(); uint32 level = responsibleCaster ? responsibleCaster->getLevel() : m_caster->getLevel();
@ -5429,7 +5429,7 @@ void Spell::EffectSummonType(SpellEffectEntry const* effect)
{ {
realCaster->GetRandomPoint(summonPositions[0].x, summonPositions[0].y, summonPositions[0].z, radius, itr->x, itr->y, itr->z); realCaster->GetRandomPoint(summonPositions[0].x, summonPositions[0].y, summonPositions[0].z, radius, itr->x, itr->y, itr->z);
if (realCaster->GetMap()->GetHitPosition(summonPositions[0].x, summonPositions[0].y, summonPositions[0].z, itr->x, itr->y, itr->z, m_caster->GetPhaseMask(), -0.5f)) if (realCaster->GetMap()->GetHitPosition(summonPositions[0].x, summonPositions[0].y, summonPositions[0].z, itr->x, itr->y, itr->z, m_caster->GetPhaseMask(), -0.5f))
realCaster->UpdateAllowedPositionZ(itr->x, itr->y, itr->z); realCaster->UpdateAllowedPositionZ(itr->x, itr->y, itr->z);
} }
else // Get a point near the caster else // Get a point near the caster
{ {
@ -5548,7 +5548,7 @@ void Spell::EffectSummonType(SpellEffectEntry const* effect)
if (!summonResult) if (!summonResult)
return; // No further handling required return; // No further handling required
for (itr = summonPositions.begin(); itr != summonPositions.end(); ++itr) for (itr = summonPositions.begin(); itr != summonPositions.end(); ++itr)
{ {
MANGOS_ASSERT(itr->creature || itr != summonPositions.begin()); MANGOS_ASSERT(itr->creature || itr != summonPositions.begin());
@ -10322,7 +10322,7 @@ void Spell::EffectActivateObject(SpellEffectEntry const* effect)
uint32 templars[] = {15209, 15211, 15212, 15307}; uint32 templars[] = {15209, 15211, 15212, 15307};
uint32 dukes[] = {15206, 15207, 15208, 15220}; uint32 dukes[] = {15206, 15207, 15208, 15220};
uint32 royals[] = {15203, 15204, 15205, 15305}; uint32 royals[] = {15203, 15204, 15205, 15305};
switch (m_spellInfo->Id) switch (m_spellInfo->Id)
{ {
case 24734: npcEntry = templars[urand(0, 3)]; break; case 24734: npcEntry = templars[urand(0, 3)]; break;
@ -10533,7 +10533,7 @@ void Spell::EffectInebriate(SpellEffectEntry const* /*effect*/)
if (roll_chance_i(25)) if (roll_chance_i(25))
player->CastSpell(player, 67468, false); // Drunken Vomit player->CastSpell(player, 67468, false); // Drunken Vomit
} }
player->SetDrunkValue(drunkValue, m_CastItem ? m_CastItem->GetEntry() : 0); player->SetDrunkValue(drunkValue, m_CastItem ? m_CastItem->GetEntry() : 0);
} }
void Spell::EffectFeedPet(SpellEffectEntry const* effect) void Spell::EffectFeedPet(SpellEffectEntry const* effect)
@ -11723,7 +11723,7 @@ void Spell::EffectBind(SpellEffectEntry const* effect)
{ {
player->GetPosition(loc); player->GetPosition(loc);
if (!area_id) if (!area_id)
area_id = player->GetAreaId(); area_id = player->GetAreaId();
} }
player->SetHomebindToLocation(loc, area_id); player->SetHomebindToLocation(loc, area_id);

View file

@ -3034,13 +3034,25 @@ SpellAuraProcResult Unit::HandleProcTriggerSpellAuraProc(Unit* pVictim, uint32 d
{ {
float stat = 0.0f; float stat = 0.0f;
// strength // strength
if (GetStat(STAT_STRENGTH) > stat) { trigger_spell_id = 60229; stat = GetStat(STAT_STRENGTH); } if (GetStat(STAT_STRENGTH) > stat)
{
trigger_spell_id = 60229; stat = GetStat(STAT_STRENGTH);
}
// agility // agility
if (GetStat(STAT_AGILITY) > stat) { trigger_spell_id = 60233; stat = GetStat(STAT_AGILITY); } if (GetStat(STAT_AGILITY) > stat)
{
trigger_spell_id = 60233; stat = GetStat(STAT_AGILITY);
}
// intellect // intellect
if (GetStat(STAT_INTELLECT) > stat) { trigger_spell_id = 60234; stat = GetStat(STAT_INTELLECT);} if (GetStat(STAT_INTELLECT) > stat)
{
trigger_spell_id = 60234; stat = GetStat(STAT_INTELLECT);
}
// spirit // spirit
if (GetStat(STAT_SPIRIT) > stat) { trigger_spell_id = 60235; } if (GetStat(STAT_SPIRIT) > stat)
{
trigger_spell_id = 60235;
}
break; break;
} }
// case 55580: break: // Mana Link // case 55580: break: // Mana Link
@ -3093,18 +3105,30 @@ SpellAuraProcResult Unit::HandleProcTriggerSpellAuraProc(Unit* pVictim, uint32 d
{ {
float stat = 0.0f; float stat = 0.0f;
// strength // strength
if (GetStat(STAT_STRENGTH) > stat) { trigger_spell_id = 67708; stat = GetStat(STAT_STRENGTH); } if (GetStat(STAT_STRENGTH) > stat)
{
trigger_spell_id = 67708; stat = GetStat(STAT_STRENGTH);
}
// agility // agility
if (GetStat(STAT_AGILITY) > stat) { trigger_spell_id = 67703; } if (GetStat(STAT_AGILITY) > stat)
{
trigger_spell_id = 67703;
}
break; break;
} }
case 67771: // Death's Choice (heroic), Item - Coliseum 25 Heroic Melee Trinket case 67771: // Death's Choice (heroic), Item - Coliseum 25 Heroic Melee Trinket
{ {
float stat = 0.0f; float stat = 0.0f;
// strength // strength
if (GetStat(STAT_STRENGTH) > stat) { trigger_spell_id = 67773; stat = GetStat(STAT_STRENGTH); } if (GetStat(STAT_STRENGTH) > stat)
{
trigger_spell_id = 67773; stat = GetStat(STAT_STRENGTH);
}
// agility // agility
if (GetStat(STAT_AGILITY) > stat) { trigger_spell_id = 67772; } if (GetStat(STAT_AGILITY) > stat)
{
trigger_spell_id = 67772;
}
break; break;
} }
case 69023: // Mirrored Soul case 69023: // Mirrored Soul

View file

@ -106,7 +106,7 @@ void WorldSession::HandleChangeSeatsOnControlledVehicle(WorldPacket& recvPacket)
ObjectGuid destVehicleGuid; ObjectGuid destVehicleGuid;
uint8 seat; uint8 seat;
recvPacket >> movementInfo; recvPacket >> movementInfo;
srcVehicleGuid = movementInfo.GetGuid(); srcVehicleGuid = movementInfo.GetGuid();
destVehicleGuid = movementInfo.GetGuid2(); destVehicleGuid = movementInfo.GetGuid2();
@ -194,13 +194,13 @@ void WorldSession::HandleEjectPassenger(WorldPacket& recvPacket)
void WorldSession::HandleRequestVehiclePrevSeat(WorldPacket& recv_data) void WorldSession::HandleRequestVehiclePrevSeat(WorldPacket& recv_data)
{ {
DEBUG_LOG("WORLD: Received CMSG_REQUEST_VEHICLE_PREV_SEAT"); DEBUG_LOG("WORLD: Received CMSG_REQUEST_VEHICLE_PREV_SEAT");
// ToDo // ToDo
} }
void WorldSession::HandleRequestVehicleNextSeat(WorldPacket& recv_data) void WorldSession::HandleRequestVehicleNextSeat(WorldPacket& recv_data)
{ {
DEBUG_LOG("WORLD: Received CMSG_REQUEST_VEHICLE_NEXT_SEAT"); DEBUG_LOG("WORLD: Received CMSG_REQUEST_VEHICLE_NEXT_SEAT");
// ToDo // ToDo
} }

View file

@ -184,7 +184,7 @@ namespace Movement
time_passed = 0; time_passed = 0;
vertical_acceleration = 0.f; vertical_acceleration = 0.f;
effect_start_time = 0; effect_start_time = 0;
// detect Stop command // detect Stop command
if (splineflags.done) if (splineflags.done)
{ {

View file

@ -60,10 +60,10 @@ namespace Movement
* @return int32 duration - estimated travel time * @return int32 duration - estimated travel time
*/ */
int32 Launch(); int32 Launch();
/** /**
* @brief Stop any creature movement * @brief Stop any creature movement
* *
*/ */
void Stop(); void Stop();
@ -113,7 +113,7 @@ namespace Movement
* @param destination * @param destination
* @param generatePath * @param generatePath
* @param forceDestination * @param forceDestination
* @param maxPathRange * @param maxPathRange
*/ */
void MoveTo(const Vector3& destination, bool generatePath = false, bool forceDestination = false); void MoveTo(const Vector3& destination, bool generatePath = false, bool forceDestination = false);
/** /**

View file

@ -298,7 +298,10 @@ class BIH
while (n > 0) while (n > 0)
{ {
bool hit = intersectCallback(r, objects[offset], maxDist, stopAtFirst); bool hit = intersectCallback(r, objects[offset], maxDist, stopAtFirst);
if (stopAtFirst && hit) { return; } if (stopAtFirst && hit)
{
return;
}
--n; --n;
++offset; ++offset;
} }

View file

@ -66,7 +66,7 @@ class BIHWrap
*/ */
bool operator()(const Ray& r, uint32 Idx, float& MaxDist, bool /*stopAtFirst*/) bool operator()(const Ray& r, uint32 Idx, float& MaxDist, bool /*stopAtFirst*/)
{ {
if (Idx >= objects_size) if (Idx >= objects_size)
{ {
return false; return false;
} }
@ -86,7 +86,7 @@ class BIHWrap
*/ */
void operator()(const Vector3& p, uint32 Idx) void operator()(const Vector3& p, uint32 Idx)
{ {
if (Idx >= objects_size) if (Idx >= objects_size)
{ {
return; return;
} }

View file

@ -313,20 +313,35 @@ namespace VMAP
{ {
char chunk[8]; char chunk[8];
// general info // general info
if (!readChunk(rf, chunk, VMAP_MAGIC, 8)) { success = false; } if (!readChunk(rf, chunk, VMAP_MAGIC, 8))
{
success = false;
}
char tiled=0; char tiled=0;
if (success && fread(&tiled, sizeof(char), 1, rf) != 1) { success = false; } if (success && fread(&tiled, sizeof(char), 1, rf) != 1)
{
success = false;
}
iIsTiled = bool(tiled); iIsTiled = bool(tiled);
// Nodes // Nodes
if (success && !readChunk(rf, chunk, "NODE", 4)) { success = false; } if (success && !readChunk(rf, chunk, "NODE", 4))
if (success) { success = iTree.readFromFile(rf); } {
success = false;
}
if (success)
{
success = iTree.readFromFile(rf);
}
if (success) if (success)
{ {
iNTreeValues = iTree.primCount(); iNTreeValues = iTree.primCount();
iTreeValues = new ModelInstance[iNTreeValues]; iTreeValues = new ModelInstance[iNTreeValues];
} }
if (success && !readChunk(rf, chunk, "GOBJ", 4)) { success = false; } if (success && !readChunk(rf, chunk, "GOBJ", 4))
{
success = false;
}
// global model spawns // global model spawns
// only non-tiled maps have them, and if so exactly one (so far at least...) // only non-tiled maps have them, and if so exactly one (so far at least...)
ModelSpawn spawn; ModelSpawn spawn;

View file

@ -229,9 +229,15 @@ namespace VMAP
} }
uint32 nameLen = spawn.name.length(); uint32 nameLen = spawn.name.length();
check += fwrite(&nameLen, sizeof(uint32), 1, wf); check += fwrite(&nameLen, sizeof(uint32), 1, wf);
if (check != uint32(has_bound ? 17 : 11)) { return false; } if (check != uint32(has_bound ? 17 : 11))
{
return false;
}
check = fwrite(spawn.name.c_str(), sizeof(char), nameLen, wf); check = fwrite(spawn.name.c_str(), sizeof(char), nameLen, wf);
if (check != nameLen) { return false; } if (check != nameLen)
{
return false;
}
return true; return true;
} }
} }

View file

@ -46,7 +46,10 @@ namespace VMAP
{ {
bool readChunk(FILE* rf, char* dest, const char* compare, uint32 len) bool readChunk(FILE* rf, char* dest, const char* compare, uint32 len)
{ {
if (fread(dest, sizeof(char), len, rf) != len) { return false; } if (fread(dest, sizeof(char), len, rf) != len)
{
return false;
}
return memcmp(dest, compare, len) == 0; return memcmp(dest, compare, len) == 0;
} }
@ -130,16 +133,31 @@ namespace VMAP
} }
// general info // general info
if (success && fwrite(VMAP_MAGIC, 1, 8, mapfile) != 8) { success = false; } if (success && fwrite(VMAP_MAGIC, 1, 8, mapfile) != 8)
{
success = false;
}
uint32 globalTileID = StaticMapTree::packTileID(65, 65); uint32 globalTileID = StaticMapTree::packTileID(65, 65);
pair<TileMap::iterator, TileMap::iterator> globalRange = map_iter->second->TileEntries.equal_range(globalTileID); pair<TileMap::iterator, TileMap::iterator> globalRange = map_iter->second->TileEntries.equal_range(globalTileID);
char isTiled = globalRange.first == globalRange.second; // only maps without terrain (tiles) have global WMO char isTiled = globalRange.first == globalRange.second; // only maps without terrain (tiles) have global WMO
if (success && fwrite(&isTiled, sizeof(char), 1, mapfile) != 1) { success = false; } if (success && fwrite(&isTiled, sizeof(char), 1, mapfile) != 1)
{
success = false;
}
// Nodes // Nodes
if (success && fwrite("NODE", 4, 1, mapfile) != 1) { success = false; } if (success && fwrite("NODE", 4, 1, mapfile) != 1)
if (success) { success = pTree.writeToFile(mapfile); } {
success = false;
}
if (success)
{
success = pTree.writeToFile(mapfile);
}
// global map spawns (WDT), if any (most instances) // global map spawns (WDT), if any (most instances)
if (success && fwrite("GOBJ", 4, 1, mapfile) != 1) { success = false; } if (success && fwrite("GOBJ", 4, 1, mapfile) != 1)
{
success = false;
}
for (TileMap::iterator glob = globalRange.first; glob != globalRange.second && success; ++glob) for (TileMap::iterator glob = globalRange.first; glob != globalRange.second && success; ++glob)
{ {
@ -169,9 +187,15 @@ namespace VMAP
tilefilename << std::setw(2) << x << "_" << std::setw(2) << y << ".vmtile"; tilefilename << std::setw(2) << x << "_" << std::setw(2) << y << ".vmtile";
FILE* tilefile = fopen(tilefilename.str().c_str(), "wb"); FILE* tilefile = fopen(tilefilename.str().c_str(), "wb");
// file header // file header
if (success && fwrite(VMAP_MAGIC, 1, 8, tilefile) != 8) { success = false; } if (success && fwrite(VMAP_MAGIC, 1, 8, tilefile) != 8)
{
success = false;
}
// write number of tile spawns // write number of tile spawns
if (success && fwrite(&nSpawns, sizeof(uint32), 1, tilefile) != 1) { success = false; } if (success && fwrite(&nSpawns, sizeof(uint32), 1, tilefile) != 1)
{
success = false;
}
// write tile spawns // write tile spawns
for (uint32 s = 0; s < nSpawns; ++s) for (uint32 s = 0; s < nSpawns; ++s)
{ {
@ -183,7 +207,10 @@ namespace VMAP
success = success && ModelSpawn::writeToFile(tilefile, spawn2); success = success && ModelSpawn::writeToFile(tilefile, spawn2);
// MapTree nodes to update when loading tile: // MapTree nodes to update when loading tile:
std::map<uint32, uint32>::iterator nIdx = modelNodeIdx.find(spawn2.ID); std::map<uint32, uint32>::iterator nIdx = modelNodeIdx.find(spawn2.ID);
if (success && fwrite(&nIdx->second, sizeof(uint32), 1, tilefile) != 1) { success = false; } if (success && fwrite(&nIdx->second, sizeof(uint32), 1, tilefile) != 1)
{
success = false;
}
} }
fclose(tilefile); fclose(tilefile);
} }
@ -250,7 +277,10 @@ namespace VMAP
printf("spawning Map %d\n", mapID); printf("spawning Map %d\n", mapID);
mapData[mapID] = current = new MapSpawns(); mapData[mapID] = current = new MapSpawns();
} }
else { current = (*map_iter).second; } else
{
current = (*map_iter).second;
}
current->UniqueEntries.insert(pair<uint32, ModelSpawn>(spawn.ID, spawn)); current->UniqueEntries.insert(pair<uint32, ModelSpawn>(spawn.ID, spawn));
current->TileEntries.insert(pair<uint32, uint32>(StaticMapTree::packTileID(tileX, tileY), spawn.ID)); current->TileEntries.insert(pair<uint32, uint32>(StaticMapTree::packTileID(tileX, tileY), spawn.ID));
} }

View file

@ -229,14 +229,32 @@ namespace VMAP
bool WmoLiquid::writeToFile(FILE* wf) bool WmoLiquid::writeToFile(FILE* wf)
{ {
bool result = true; bool result = true;
if (result && fwrite(&iTilesX, sizeof(uint32), 1, wf) != 1) { result = false; } if (result && fwrite(&iTilesX, sizeof(uint32), 1, wf) != 1)
if (result && fwrite(&iTilesY, sizeof(uint32), 1, wf) != 1) { result = false; } {
if (result && fwrite(&iCorner, sizeof(Vector3), 1, wf) != 1) { result = false; } result = false;
if (result && fwrite(&iType, sizeof(uint32), 1, wf) != 1) { result = false; } }
if (result && fwrite(&iTilesY, sizeof(uint32), 1, wf) != 1)
{
result = false;
}
if (result && fwrite(&iCorner, sizeof(Vector3), 1, wf) != 1)
{
result = false;
}
if (result && fwrite(&iType, sizeof(uint32), 1, wf) != 1)
{
result = false;
}
uint32 size = (iTilesX + 1) * (iTilesY + 1); uint32 size = (iTilesX + 1) * (iTilesY + 1);
if (result && fwrite(iHeight, sizeof(float), size, wf) != size) { result = false; } if (result && fwrite(iHeight, sizeof(float), size, wf) != size)
{
result = false;
}
size = iTilesX * iTilesY; size = iTilesX * iTilesY;
if (result && fwrite(iFlags, sizeof(uint8), size, wf) != size) { result = false; } if (result && fwrite(iFlags, sizeof(uint8), size, wf) != size)
{
result = false;
}
return result; return result;
} }
@ -244,16 +262,34 @@ namespace VMAP
{ {
bool result = true; bool result = true;
WmoLiquid* liquid = new WmoLiquid(); WmoLiquid* liquid = new WmoLiquid();
if (result && fread(&liquid->iTilesX, sizeof(uint32), 1, rf) != 1) { result = false; } if (result && fread(&liquid->iTilesX, sizeof(uint32), 1, rf) != 1)
if (result && fread(&liquid->iTilesY, sizeof(uint32), 1, rf) != 1) { result = false; } {
if (result && fread(&liquid->iCorner, sizeof(Vector3), 1, rf) != 1) { result = false; } result = false;
if (result && fread(&liquid->iType, sizeof(uint32), 1, rf) != 1) { result = false; } }
if (result && fread(&liquid->iTilesY, sizeof(uint32), 1, rf) != 1)
{
result = false;
}
if (result && fread(&liquid->iCorner, sizeof(Vector3), 1, rf) != 1)
{
result = false;
}
if (result && fread(&liquid->iType, sizeof(uint32), 1, rf) != 1)
{
result = false;
}
uint32 size = (liquid->iTilesX + 1) * (liquid->iTilesY + 1); uint32 size = (liquid->iTilesX + 1) * (liquid->iTilesY + 1);
liquid->iHeight = new float[size]; liquid->iHeight = new float[size];
if (result && fread(liquid->iHeight, sizeof(float), size, rf) != size) { result = false; } if (result && fread(liquid->iHeight, sizeof(float), size, rf) != size)
{
result = false;
}
size = liquid->iTilesX * liquid->iTilesY; size = liquid->iTilesX * liquid->iTilesY;
liquid->iFlags = new uint8[size]; liquid->iFlags = new uint8[size];
if (result && fread(liquid->iFlags, sizeof(uint8), size, rf) != size) { result = false; } if (result && fread(liquid->iFlags, sizeof(uint8), size, rf) != size)
{
result = false;
}
if (!result) if (!result)
{ {
delete liquid; delete liquid;
@ -290,41 +326,89 @@ namespace VMAP
bool result = true; bool result = true;
uint32 chunkSize, count; uint32 chunkSize, count;
if (result && fwrite(&iBound, sizeof(G3D::AABox), 1, wf) != 1) { result = false; } if (result && fwrite(&iBound, sizeof(G3D::AABox), 1, wf) != 1)
if (result && fwrite(&iMogpFlags, sizeof(uint32), 1, wf) != 1) { result = false; } {
if (result && fwrite(&iGroupWMOID, sizeof(uint32), 1, wf) != 1) { result = false; } result = false;
}
if (result && fwrite(&iMogpFlags, sizeof(uint32), 1, wf) != 1)
{
result = false;
}
if (result && fwrite(&iGroupWMOID, sizeof(uint32), 1, wf) != 1)
{
result = false;
}
// write vertices // write vertices
if (result && fwrite("VERT", 1, 4, wf) != 4) { result = false; } if (result && fwrite("VERT", 1, 4, wf) != 4)
{
result = false;
}
count = vertices.size(); count = vertices.size();
chunkSize = sizeof(uint32) + sizeof(Vector3) * count; chunkSize = sizeof(uint32) + sizeof(Vector3) * count;
if (result && fwrite(&chunkSize, sizeof(uint32), 1, wf) != 1) { result = false; } if (result && fwrite(&chunkSize, sizeof(uint32), 1, wf) != 1)
if (result && fwrite(&count, sizeof(uint32), 1, wf) != 1) { result = false; } {
result = false;
}
if (result && fwrite(&count, sizeof(uint32), 1, wf) != 1)
{
result = false;
}
if (!count) // models without (collision) geometry end here, unsure if they are useful if (!count) // models without (collision) geometry end here, unsure if they are useful
{ {
return result; return result;
} }
if (result && fwrite(&vertices[0], sizeof(Vector3), count, wf) != count) { result = false; } if (result && fwrite(&vertices[0], sizeof(Vector3), count, wf) != count)
{
result = false;
}
// write triangle mesh // write triangle mesh
if (result && fwrite("TRIM", 1, 4, wf) != 4) { result = false; } if (result && fwrite("TRIM", 1, 4, wf) != 4)
{
result = false;
}
count = triangles.size(); count = triangles.size();
chunkSize = sizeof(uint32) + sizeof(MeshTriangle) * count; chunkSize = sizeof(uint32) + sizeof(MeshTriangle) * count;
if (result && fwrite(&chunkSize, sizeof(uint32), 1, wf) != 1) { result = false; } if (result && fwrite(&chunkSize, sizeof(uint32), 1, wf) != 1)
if (result && fwrite(&count, sizeof(uint32), 1, wf) != 1) { result = false; } {
result = false;
}
if (result && fwrite(&count, sizeof(uint32), 1, wf) != 1)
{
result = false;
}
if (count) if (count)
if (result && fwrite(&triangles[0], sizeof(MeshTriangle), count, wf) != count) { result = false; } if (result && fwrite(&triangles[0], sizeof(MeshTriangle), count, wf) != count)
{
result = false;
}
// write mesh BIH // write mesh BIH
if (result && fwrite("MBIH", 1, 4, wf) != 4) { result = false; } if (result && fwrite("MBIH", 1, 4, wf) != 4)
if (result) { result = meshTree.writeToFile(wf); } {
result = false;
}
if (result)
{
result = meshTree.writeToFile(wf);
}
// write liquid data // write liquid data
if (result && fwrite("LIQU", 1, 4, wf) != 4) { result = false; } if (result && fwrite("LIQU", 1, 4, wf) != 4)
{
result = false;
}
chunkSize = iLiquid ? iLiquid->GetFileSize() : 0; chunkSize = iLiquid ? iLiquid->GetFileSize() : 0;
if (result && fwrite(&chunkSize, sizeof(uint32), 1, wf) != 1) { result = false; } if (result && fwrite(&chunkSize, sizeof(uint32), 1, wf) != 1)
{
result = false;
}
if (chunkSize) if (chunkSize)
if (result) { result = iLiquid->writeToFile(wf); } if (result)
{
result = iLiquid->writeToFile(wf);
}
return result; return result;
} }
@ -340,38 +424,89 @@ namespace VMAP
delete iLiquid; delete iLiquid;
iLiquid = 0; iLiquid = 0;
if (result && fread(&iBound, sizeof(G3D::AABox), 1, rf) != 1) { result = false; } if (result && fread(&iBound, sizeof(G3D::AABox), 1, rf) != 1)
if (result && fread(&iMogpFlags, sizeof(uint32), 1, rf) != 1) { result = false; } {
if (result && fread(&iGroupWMOID, sizeof(uint32), 1, rf) != 1) { result = false; } result = false;
}
if (result && fread(&iMogpFlags, sizeof(uint32), 1, rf) != 1)
{
result = false;
}
if (result && fread(&iGroupWMOID, sizeof(uint32), 1, rf) != 1)
{
result = false;
}
// read vertices // read vertices
if (result && !readChunk(rf, chunk, "VERT", 4)) { result = false; } if (result && !readChunk(rf, chunk, "VERT", 4))
if (result && fread(&chunkSize, sizeof(uint32), 1, rf) != 1) { result = false; } {
if (result && fread(&count, sizeof(uint32), 1, rf) != 1) { result = false; } result = false;
}
if (result && fread(&chunkSize, sizeof(uint32), 1, rf) != 1)
{
result = false;
}
if (result && fread(&count, sizeof(uint32), 1, rf) != 1)
{
result = false;
}
if (!count) // models without (collision) geometry end here, unsure if they are useful if (!count) // models without (collision) geometry end here, unsure if they are useful
{ {
return result; return result;
} }
if (result) { vertices.resize(count); } if (result)
if (result && fread(&vertices[0], sizeof(Vector3), count, rf) != count) { result = false; } {
vertices.resize(count);
}
if (result && fread(&vertices[0], sizeof(Vector3), count, rf) != count)
{
result = false;
}
// read triangle mesh // read triangle mesh
if (result && !readChunk(rf, chunk, "TRIM", 4)) { result = false; } if (result && !readChunk(rf, chunk, "TRIM", 4))
if (result && fread(&chunkSize, sizeof(uint32), 1, rf) != 1) { result = false; } {
if (result && fread(&count, sizeof(uint32), 1, rf) != 1) { result = false; } result = false;
}
if (result && fread(&chunkSize, sizeof(uint32), 1, rf) != 1)
{
result = false;
}
if (result && fread(&count, sizeof(uint32), 1, rf) != 1)
{
result = false;
}
if (count) if (count)
{ {
if (result) { triangles.resize(count); } if (result)
if (result && fread(&triangles[0], sizeof(MeshTriangle), count, rf) != count) { result = false; } {
triangles.resize(count);
}
if (result && fread(&triangles[0], sizeof(MeshTriangle), count, rf) != count)
{
result = false;
}
} }
// read mesh BIH // read mesh BIH
if (result && !readChunk(rf, chunk, "MBIH", 4)) { result = false; } if (result && !readChunk(rf, chunk, "MBIH", 4))
if (result) { result = meshTree.readFromFile(rf); } {
result = false;
}
if (result)
{
result = meshTree.readFromFile(rf);
}
// read liquid data // read liquid data
if (result && !readChunk(rf, chunk, "LIQU", 4)) { result = false; } if (result && !readChunk(rf, chunk, "LIQU", 4))
if (result && fread(&chunkSize, sizeof(uint32), 1, rf) != 1) { result = false; } {
result = false;
}
if (result && fread(&chunkSize, sizeof(uint32), 1, rf) != 1)
{
result = false;
}
if (result && chunkSize > 0) if (result && chunkSize > 0)
{ {
result = WmoLiquid::readFromFile(rf, iLiquid); result = WmoLiquid::readFromFile(rf, iLiquid);
@ -386,7 +521,10 @@ namespace VMAP
bool operator()(const G3D::Ray& ray, uint32 entry, float& distance, bool /*pStopAtFirstHit*/) bool operator()(const G3D::Ray& ray, uint32 entry, float& distance, bool /*pStopAtFirstHit*/)
{ {
bool result = IntersectTriangle(triangles[entry], vertices, ray, distance); bool result = IntersectTriangle(triangles[entry], vertices, ray, distance);
if (result) { hit = true; } if (result)
{
hit = true;
}
return hit; return hit;
} }
std::vector<Vector3>::const_iterator vertices; std::vector<Vector3>::const_iterator vertices;
@ -455,7 +593,10 @@ namespace VMAP
bool operator()(const G3D::Ray& ray, uint32 entry, float& distance, bool pStopAtFirstHit) bool operator()(const G3D::Ray& ray, uint32 entry, float& distance, bool pStopAtFirstHit)
{ {
bool result = models[entry].IntersectRay(ray, distance, pStopAtFirstHit); bool result = models[entry].IntersectRay(ray, distance, pStopAtFirstHit);
if (result) { hit = true; } if (result)
{
hit = true;
}
return hit; return hit;
} }
std::vector<GroupModel>::const_iterator models; std::vector<GroupModel>::const_iterator models;
@ -561,25 +702,46 @@ namespace VMAP
uint32 chunkSize, count; uint32 chunkSize, count;
bool result = fwrite(VMAP_MAGIC, 1, 8, wf) == 8; bool result = fwrite(VMAP_MAGIC, 1, 8, wf) == 8;
if (result && fwrite("WMOD", 1, 4, wf) != 4) { result = false; } if (result && fwrite("WMOD", 1, 4, wf) != 4)
{
result = false;
}
chunkSize = sizeof(uint32) + sizeof(uint32); chunkSize = sizeof(uint32) + sizeof(uint32);
if (result && fwrite(&chunkSize, sizeof(uint32), 1, wf) != 1) { result = false; } if (result && fwrite(&chunkSize, sizeof(uint32), 1, wf) != 1)
if (result && fwrite(&RootWMOID, sizeof(uint32), 1, wf) != 1) { result = false; } {
result = false;
}
if (result && fwrite(&RootWMOID, sizeof(uint32), 1, wf) != 1)
{
result = false;
}
// write group models // write group models
count = groupModels.size(); count = groupModels.size();
if (count) if (count)
{ {
if (result && fwrite("GMOD", 1, 4, wf) != 4) { result = false; } if (result && fwrite("GMOD", 1, 4, wf) != 4)
{
result = false;
}
// chunkSize = sizeof(uint32)+ sizeof(GroupModel)*count; // chunkSize = sizeof(uint32)+ sizeof(GroupModel)*count;
// if (result && fwrite(&chunkSize, sizeof(uint32), 1, wf) != 1) result = false; // if (result && fwrite(&chunkSize, sizeof(uint32), 1, wf) != 1) result = false;
if (result && fwrite(&count, sizeof(uint32), 1, wf) != 1) { result = false; } if (result && fwrite(&count, sizeof(uint32), 1, wf) != 1)
{
result = false;
}
for (uint32 i = 0; i < groupModels.size() && result; ++i) for (uint32 i = 0; i < groupModels.size() && result; ++i)
{ result = groupModels[i].writeToFile(wf); } { result = groupModels[i].writeToFile(wf); }
// write group BIH // write group BIH
if (result && fwrite("GBIH", 1, 4, wf) != 4) { result = false; } if (result && fwrite("GBIH", 1, 4, wf) != 4)
if (result) { result = groupTree.writeToFile(wf); } {
result = false;
}
if (result)
{
result = groupTree.writeToFile(wf);
}
} }
fclose(wf); fclose(wf);
@ -598,26 +760,50 @@ namespace VMAP
uint32 chunkSize = 0; uint32 chunkSize = 0;
uint32 count = 0; uint32 count = 0;
char chunk[8]; // Ignore the added magic header char chunk[8]; // Ignore the added magic header
if (!readChunk(rf, chunk, VMAP_MAGIC, 8)) { result = false; } if (!readChunk(rf, chunk, VMAP_MAGIC, 8))
{
result = false;
}
if (result && !readChunk(rf, chunk, "WMOD", 4)) { result = false; } if (result && !readChunk(rf, chunk, "WMOD", 4))
if (result && fread(&chunkSize, sizeof(uint32), 1, rf) != 1) { result = false; } {
if (result && fread(&RootWMOID, sizeof(uint32), 1, rf) != 1) { result = false; } result = false;
}
if (result && fread(&chunkSize, sizeof(uint32), 1, rf) != 1)
{
result = false;
}
if (result && fread(&RootWMOID, sizeof(uint32), 1, rf) != 1)
{
result = false;
}
// read group models // read group models
if (result && readChunk(rf, chunk, "GMOD", 4)) if (result && readChunk(rf, chunk, "GMOD", 4))
{ {
// if (fread(&chunkSize, sizeof(uint32), 1, rf) != 1) result = false; // if (fread(&chunkSize, sizeof(uint32), 1, rf) != 1) result = false;
if (result && fread(&count, sizeof(uint32), 1, rf) != 1) { result = false; } if (result && fread(&count, sizeof(uint32), 1, rf) != 1)
if (result) { groupModels.resize(count); } {
result = false;
}
if (result)
{
groupModels.resize(count);
}
// if (result && fread(&groupModels[0], sizeof(GroupModel), count, rf) != count) result = false; // if (result && fread(&groupModels[0], sizeof(GroupModel), count, rf) != count) result = false;
for (uint32 i = 0; i < count && result; ++i) for (uint32 i = 0; i < count && result; ++i)
{ result = groupModels[i].readFromFile(rf); } { result = groupModels[i].readFromFile(rf); }
// read group BIH // read group BIH
if (result && !readChunk(rf, chunk, "GBIH", 4)) { result = false; } if (result && !readChunk(rf, chunk, "GBIH", 4))
if (result) { result = groupTree.readFromFile(rf); } {
result = false;
}
if (result)
{
result = groupTree.readFromFile(rf);
}
} }
fclose(rf); fclose(rf);

View file

@ -48,7 +48,10 @@ BigNumber::BigNumber(uint32 val)
BigNumber::~BigNumber() BigNumber::~BigNumber()
{ {
BN_free(_bn); BN_free(_bn);
if (_array) { delete[] _array; } if (_array)
{
delete[] _array;
}
} }
void BigNumber::SetDword(uint32 val) void BigNumber::SetDword(uint32 val)

View file

@ -210,7 +210,10 @@ void Database::InitDelayThread()
void Database::HaltDelayThread() void Database::HaltDelayThread()
{ {
if (!m_threadBody || !m_delayThread) { return; } if (!m_threadBody || !m_delayThread)
{
return;
}
m_threadBody->Stop(); // Stop event m_threadBody->Stop(); // Stop event
m_delayThread->wait(); // Wait for flush to DB m_delayThread->wait(); // Wait for flush to DB
@ -329,7 +332,10 @@ bool Database::PExecuteLog(const char* format, ...)
QueryResult* Database::PQuery(const char* format, ...) QueryResult* Database::PQuery(const char* format, ...)
{ {
if (!format) { return NULL; } if (!format)
{
return NULL;
}
va_list ap; va_list ap;
char szQuery [MAX_QUERY_LEN]; char szQuery [MAX_QUERY_LEN];
@ -348,7 +354,10 @@ QueryResult* Database::PQuery(const char* format, ...)
QueryNamedResult* Database::PQueryNamed(const char* format, ...) QueryNamedResult* Database::PQueryNamed(const char* format, ...)
{ {
if (!format) { return NULL; } if (!format)
{
return NULL;
}
va_list ap; va_list ap;
char szQuery [MAX_QUERY_LEN]; char szQuery [MAX_QUERY_LEN];
@ -522,7 +531,7 @@ bool Database::CheckDatabaseVersion(DatabaseTypes database)
// db_version table does not exist or is empty // db_version table does not exist or is empty
if (!result) if (!result)
{ {
sLog.outErrorDb("The table `db_version` in your [%s] database is missing or corrupt.", dbversion.dbname.c_str()); sLog.outErrorDb("The table `db_version` in your [%s] database is missing or corrupt.", dbversion.dbname.c_str());
sLog.outErrorDb(); sLog.outErrorDb();
sLog.outErrorDb(" [A] You have database Version: MaNGOS can not verify your database version or its existence!"); sLog.outErrorDb(" [A] You have database Version: MaNGOS can not verify your database version or its existence!");
@ -571,7 +580,7 @@ bool Database::CheckDatabaseVersion(DatabaseTypes database)
sLog.outErrorDb("Current DB content is %u, core expects %u", content, dbversion.expected_content); sLog.outErrorDb("Current DB content is %u, core expects %u", content, dbversion.expected_content);
sLog.outErrorDb("This is ok for now but should not last long."); sLog.outErrorDb("This is ok for now but should not last long.");
} }
else if (content != dbversion.expected_content) else if (content != dbversion.expected_content)
{ {
sLog.outErrorDb("The table `db_version` indicates that your [%s] database does not match the expected version!", dbversion.dbname.c_str()); sLog.outErrorDb("The table `db_version` indicates that your [%s] database does not match the expected version!", dbversion.dbname.c_str());
sLog.outErrorDb(); sLog.outErrorDb();

View file

@ -625,7 +625,7 @@ class Database
/** /**
* @brief Function to check that the database version matches expected core version * @brief Function to check that the database version matches expected core version
* *
* @param DatabaseTypes * @param DatabaseTypes
* @return bool * @return bool
*/ */
bool CheckDatabaseVersion(DatabaseTypes database); bool CheckDatabaseVersion(DatabaseTypes database);

View file

@ -234,7 +234,10 @@ bool SqlQueryHolderEx::Execute(SqlConnection* conn)
{ {
/// execute all queries in the holder and pass the results /// execute all queries in the holder and pass the results
char const* sql = queries[i].first; char const* sql = queries[i].first;
if (sql) { m_holder->SetResult(i, conn->Query(sql)); } if (sql)
{
m_holder->SetResult(i, conn->Query(sql));
}
} }
/// sync with the caller thread /// sync with the caller thread

View file

@ -73,9 +73,9 @@ enum LogType
const int LogType_count = int(LogError) + 1; const int LogType_count = int(LogError) + 1;
Log::Log() : Log::Log() :
raLogfile(NULL), logfile(NULL), gmLogfile(NULL), charLogfile(NULL), dberLogfile(NULL), raLogfile(NULL), logfile(NULL), gmLogfile(NULL), charLogfile(NULL), dberLogfile(NULL),
#ifdef ENABLE_ELUNA #ifdef ENABLE_ELUNA
elunaErrLogfile(NULL), elunaErrLogfile(NULL),
#endif /* ENABLE_ELUNA */ #endif /* ENABLE_ELUNA */
eventAiErLogfile(NULL), scriptErrLogFile(NULL), worldLogfile(NULL), wardenLogfile(NULL), m_colored(false), eventAiErLogfile(NULL), scriptErrLogFile(NULL), worldLogfile(NULL), wardenLogfile(NULL), m_colored(false),
m_includeTime(false), m_gmlog_per_account(false), m_scriptLibName(NULL) m_includeTime(false), m_gmlog_per_account(false), m_scriptLibName(NULL)

View file

@ -132,4 +132,4 @@ bool DelayExecutor::activated()
void DelayExecutor::activated(bool s) void DelayExecutor::activated(bool s)
{ {
activated_ = s; activated_ = s;
} }

View file

@ -221,7 +221,7 @@ ACE_THR_FUNC_RETURN Thread::ThreadTask(void* param)
{ {
Runnable* _task = static_cast<Runnable*>(param); Runnable* _task = static_cast<Runnable*>(param);
_task->incReference(); _task->incReference();
_task->run(); _task->run();
// task execution complete, free referecne added at // task execution complete, free referecne added at

View file

@ -87,7 +87,10 @@ void BarGoLink::step()
int i, n; int i, n;
if (num_rec == 0) { return; } if (num_rec == 0)
{
return;
}
++rec_no; ++rec_no;
n = rec_no * indic_len / num_rec; n = rec_no * indic_len / num_rec;
if (n != rec_pos) if (n != rec_pos)

View file

@ -133,7 +133,10 @@ Tokens StrSplit(const std::string& src, const std::string& sep)
{ {
if (sep.find(*i) != std::string::npos) if (sep.find(*i) != std::string::npos)
{ {
if (s.length()) { r.push_back(s); } if (s.length())
{
r.push_back(s);
}
s = ""; s = "";
} }
else else
@ -141,7 +144,10 @@ Tokens StrSplit(const std::string& src, const std::string& sep)
s += *i; s += *i;
} }
} }
if (s.length()) { r.push_back(s); } if (s.length())
{
r.push_back(s);
}
return r; return r;
} }

View file

@ -238,7 +238,10 @@ void WINAPI ServiceMain(DWORD argc, char* argv[])
for (i = 0; i < std::strlen(path); ++i) for (i = 0; i < std::strlen(path); ++i)
{ {
if (path[i] == '\\') { last_slash = i; } if (path[i] == '\\')
{
last_slash = i;
}
} }
path[last_slash] = 0; path[last_slash] = 0;