Apply style fix pt4

This commit is contained in:
Antz 2020-01-14 10:26:15 +00:00
parent d93dbd95fe
commit 4727d8846f
87 changed files with 710 additions and 0 deletions

View file

@ -820,7 +820,9 @@ void WorldSession::HandleRequestPvPOptionsEnabledOpcode(WorldPacket& recv_data)
WorldPacket data(SMSG_PVP_OPTIONS_ENABLED, 1); WorldPacket data(SMSG_PVP_OPTIONS_ENABLED, 1);
for (int i = 0; i < 5; ++i) for (int i = 0; i < 5; ++i)
{
data.WriteBit(true); data.WriteBit(true);
}
SendPacket(&data); SendPacket(&data);
} }

View file

@ -1434,8 +1434,10 @@ void ChatHandler::ShowAchievementListHelper(AchievementEntry const* achEntry, Lo
criteriaMask[((*itr)->showOrder - 1) / 32] |= (1 << (((*itr)->showOrder - 1) % 32)); criteriaMask[((*itr)->showOrder - 1) / 32] |= (1 << (((*itr)->showOrder - 1) % 32));
for (int i = 0; i < 4; ++i) for (int i = 0; i < 4; ++i)
{
ss << criteriaMask[i] << ":"; ss << criteriaMask[i] << ":";
} }
}
else else
ss << "0:0:0:0:"; ss << "0:0:0:0:";
} }
@ -3861,8 +3863,10 @@ bool ChatHandler::HandleWpShowCommand(char* args)
PSendSysMessage(" Emote: %u", behaviour->emote); PSendSysMessage(" Emote: %u", behaviour->emote);
PSendSysMessage(" Spell: %u", behaviour->spell); PSendSysMessage(" Spell: %u", behaviour->spell);
for (int i = 0; i < MAX_WAYPOINT_TEXT; ++i) for (int i = 0; i < MAX_WAYPOINT_TEXT; ++i)
{
PSendSysMessage(" TextId%i: %i \'%s\'", i + 1, behaviour->textid[i], (behaviour->textid[i] ? GetMangosString(behaviour->textid[i]) : "")); PSendSysMessage(" TextId%i: %i \'%s\'", i + 1, behaviour->textid[i], (behaviour->textid[i] ? GetMangosString(behaviour->textid[i]) : ""));
} }
}
return true; return true;
} }

View file

@ -1402,8 +1402,10 @@ bool ChatHandler::HandleAchievementCommand(char* args)
{ {
SendSysMessage(LANG_COMMAND_ACHIEVEMENT_CRITERIA); SendSysMessage(LANG_COMMAND_ACHIEVEMENT_CRITERIA);
for (AchievementCriteriaEntryList::const_iterator itr = criteriaList->begin(); itr != criteriaList->end(); ++itr) for (AchievementCriteriaEntryList::const_iterator itr = criteriaList->begin(); itr != criteriaList->end(); ++itr)
{
ShowAchievementCriteriaListHelper(*itr, achEntry, loc, target); ShowAchievementCriteriaListHelper(*itr, achEntry, loc, target);
} }
}
return true; return true;
} }
@ -1482,7 +1484,9 @@ bool ChatHandler::HandleAchievementRemoveCommand(char* args)
if (AchievementCriteriaEntryList const* criteriaList = sAchievementMgr.GetAchievementCriteriaByAchievement(achEntry->ID)) if (AchievementCriteriaEntryList const* criteriaList = sAchievementMgr.GetAchievementCriteriaByAchievement(achEntry->ID))
for (AchievementCriteriaEntryList::const_iterator itr = criteriaList->begin(); itr != criteriaList->end(); ++itr) for (AchievementCriteriaEntryList::const_iterator itr = criteriaList->begin(); itr != criteriaList->end(); ++itr)
{
mgr.SetCriteriaProgress(*itr, achEntry, 0, AchievementMgr::PROGRESS_SET); mgr.SetCriteriaProgress(*itr, achEntry, 0, AchievementMgr::PROGRESS_SET);
}
LocaleConstant loc = GetSessionDbcLocale(); LocaleConstant loc = GetSessionDbcLocale();
CompletedAchievementData const* completed = target ? target->GetAchievementMgr().GetCompleteData(achId) : NULL; CompletedAchievementData const* completed = target ? target->GetAchievementMgr().GetCompleteData(achId) : NULL;

View file

@ -338,8 +338,10 @@ void ArenaTeam::DelMember(ObjectGuid guid)
player->GetSession()->SendArenaTeamCommandResult(ERR_ARENA_TEAM_QUIT_S, GetName(), "", 0); player->GetSession()->SendArenaTeamCommandResult(ERR_ARENA_TEAM_QUIT_S, GetName(), "", 0);
// delete all info regarding this team // delete all info regarding this team
for (int i = 0; i < ARENA_TEAM_END; ++i) for (int i = 0; i < ARENA_TEAM_END; ++i)
{
player->SetArenaTeamInfoField(GetSlot(), ArenaTeamInfoType(i), 0); player->SetArenaTeamInfoField(GetSlot(), ArenaTeamInfoType(i), 0);
} }
}
CharacterDatabase.PExecute("DELETE FROM arena_team_member WHERE arenateamid = '%u' AND guid = '%u'", GetId(), guid.GetCounter()); CharacterDatabase.PExecute("DELETE FROM arena_team_member WHERE arenateamid = '%u' AND guid = '%u'", GetId(), guid.GetCounter());
} }

View file

@ -1838,8 +1838,10 @@ void Creature::LoadEquipment(uint32 equip_entry, bool force)
m_equipmentId = equip_entry; m_equipmentId = equip_entry;
for (uint8 i = 0; i < MAX_VIRTUAL_ITEM_SLOT; ++i) for (uint8 i = 0; i < MAX_VIRTUAL_ITEM_SLOT; ++i)
{
SetVirtualItem(VirtualItemSlot(i), einfo->equipentry[i]); SetVirtualItem(VirtualItemSlot(i), einfo->equipentry[i]);
} }
}
bool Creature::HasQuest(uint32 quest_id) const bool Creature::HasQuest(uint32 quest_id) const
{ {

View file

@ -96,8 +96,10 @@ void CreatureEventAIMgr::CheckUnusedAITexts()
} }
for (std::set<int32>::const_iterator itr = idx_set.begin(); itr != idx_set.end(); ++itr) for (std::set<int32>::const_iterator itr = idx_set.begin(); itr != idx_set.end(); ++itr)
{
sLog.outErrorEventAI("Entry %i in table `creature_ai_texts` but not used in EventAI scripts.", *itr); sLog.outErrorEventAI("Entry %i in table `creature_ai_texts` but not used in EventAI scripts.", *itr);
} }
}
/// Helper function to check if a target-type is suitable for the event-type /// Helper function to check if a target-type is suitable for the event-type
bool IsValidTargetType(EventAI_Type eventType, EventAI_ActionType actionType, uint32 targetType, uint32 eventId, uint8 action) bool IsValidTargetType(EventAI_Type eventType, EventAI_ActionType actionType, uint32 targetType, uint32 eventId, uint8 action)
@ -229,7 +231,9 @@ void CreatureEventAIMgr::CheckUnusedAISummons()
std::set<int32> idx_set; std::set<int32> idx_set;
// check not used strings this is negative range // check not used strings this is negative range
for (CreatureEventAI_Summon_Map::const_iterator itr = m_CreatureEventAI_Summon_Map.begin(); itr != m_CreatureEventAI_Summon_Map.end(); ++itr) for (CreatureEventAI_Summon_Map::const_iterator itr = m_CreatureEventAI_Summon_Map.begin(); itr != m_CreatureEventAI_Summon_Map.end(); ++itr)
{
idx_set.insert(itr->first); idx_set.insert(itr->first);
}
for (CreatureEventAI_Event_Map::const_iterator itr = m_CreatureEventAI_Event_Map.begin(); itr != m_CreatureEventAI_Event_Map.end(); ++itr) for (CreatureEventAI_Event_Map::const_iterator itr = m_CreatureEventAI_Event_Map.begin(); itr != m_CreatureEventAI_Event_Map.end(); ++itr)
{ {
@ -255,8 +259,10 @@ void CreatureEventAIMgr::CheckUnusedAISummons()
} }
for (std::set<int32>::const_iterator itr = idx_set.begin(); itr != idx_set.end(); ++itr) for (std::set<int32>::const_iterator itr = idx_set.begin(); itr != idx_set.end(); ++itr)
{
sLog.outErrorEventAI("Entry %i in table `creature_ai_summons` but not used in EventAI scripts.", *itr); sLog.outErrorEventAI("Entry %i in table `creature_ai_summons` but not used in EventAI scripts.", *itr);
} }
}
// ------------------- // -------------------
void CreatureEventAIMgr::LoadCreatureEventAI_Scripts() void CreatureEventAIMgr::LoadCreatureEventAI_Scripts()

View file

@ -108,8 +108,10 @@ Guild::Guild()
m_GuildEventLogNextGuid = 0; m_GuildEventLogNextGuid = 0;
m_GuildBankEventLogNextGuid_Money = 0; m_GuildBankEventLogNextGuid_Money = 0;
for (uint8 i = 0; i < GUILD_BANK_MAX_TABS; ++i) for (uint8 i = 0; i < GUILD_BANK_MAX_TABS; ++i)
{
m_GuildBankEventLogNextGuid_Item[i] = 0; m_GuildBankEventLogNextGuid_Item[i] = 0;
} }
}
Guild::~Guild() Guild::~Guild()
{ {
@ -245,7 +247,9 @@ bool Guild::AddMember(ObjectGuid plGuid, uint32 plRank)
newmember.LogoutTime = time(NULL); newmember.LogoutTime = time(NULL);
newmember.BankResetTimeMoney = 0; // this will force update at first query newmember.BankResetTimeMoney = 0; // this will force update at first query
for (int i = 0; i < GUILD_BANK_MAX_TABS; ++i) for (int i = 0; i < GUILD_BANK_MAX_TABS; ++i)
{
newmember.BankResetTimeTab[i] = 0; newmember.BankResetTimeTab[i] = 0;
}
members[lowguid] = newmember; members[lowguid] = newmember;
std::string dbPnote = newmember.Pnote; std::string dbPnote = newmember.Pnote;
@ -333,7 +337,9 @@ bool Guild::LoadGuildFromDB(QueryResult* guildDataResult)
m_TabListMap.resize(purchasedTabs); m_TabListMap.resize(purchasedTabs);
for (uint8 i = 0; i < purchasedTabs; ++i) for (uint8 i = 0; i < purchasedTabs; ++i)
{
m_TabListMap[i] = new GuildBankTab; m_TabListMap[i] = new GuildBankTab;
}
return true; return true;
} }
@ -1115,7 +1121,9 @@ void Guild::QueryRanks(WorldSession* session)
data.WriteBits(m_Ranks.size(), 18); data.WriteBits(m_Ranks.size(), 18);
for (uint8 i = 0; i < m_Ranks.size(); ++i) for (uint8 i = 0; i < m_Ranks.size(); ++i)
{
data.WriteBits(m_Ranks[i].Name.length(), 7); data.WriteBits(m_Ranks[i].Name.length(), 7);
}
for (uint8 i = 0; i < m_Ranks.size(); ++i) for (uint8 i = 0; i < m_Ranks.size(); ++i)
{ {
@ -1183,7 +1191,9 @@ void Guild::DisplayGuildEventLog(WorldSession* session)
// count, max count == 100 // count, max count == 100
data.WriteBits(m_GuildEventLog.size(), 23); data.WriteBits(m_GuildEventLog.size(), 23);
for (GuildEventLog::iterator itr = m_GuildEventLog.begin(); itr != m_GuildEventLog.end(); ++itr) for (GuildEventLog::iterator itr = m_GuildEventLog.begin(); itr != m_GuildEventLog.end(); ++itr)
{
itr->WriteData(data, buffer); itr->WriteData(data, buffer);
}
if (!buffer.empty()) if (!buffer.empty())
{ {
data.FlushBits(); data.FlushBits();
@ -1378,7 +1388,9 @@ void Guild::DisplayGuildBankContentUpdate(uint8 TabId, GuildItemPosCountVec cons
data.WriteBits(0, 22); // Tell client that there's no tab info in this packet data.WriteBits(0, 22); // Tell client that there's no tab info in this packet
for (GuildItemPosCountVec::const_iterator itr = slots.begin(); itr != slots.end(); ++itr) for (GuildItemPosCountVec::const_iterator itr = slots.begin(); itr != slots.end(); ++itr)
{
AppendDisplayGuildBankSlot(data, buffer, tab, itr->Slot); AppendDisplayGuildBankSlot(data, buffer, tab, itr->Slot);
}
data << uint64(GetGuildBankMoney()); data << uint64(GetGuildBankMoney());
if (!buffer.empty()) if (!buffer.empty())
@ -1774,7 +1786,9 @@ void Guild::SetBankRightsAndSlots(uint32 rankId, uint8 TabId, uint32 right, uint
for (MemberList::iterator itr = members.begin(); itr != members.end(); ++itr) for (MemberList::iterator itr = members.begin(); itr != members.end(); ++itr)
if (itr->second.RankId == rankId) if (itr->second.RankId == rankId)
for (int i = 0; i < GUILD_BANK_MAX_TABS; ++i) for (int i = 0; i < GUILD_BANK_MAX_TABS; ++i)
{
itr->second.BankResetTimeTab[i] = 0; itr->second.BankResetTimeTab[i] = 0;
}
CharacterDatabase.PExecute("DELETE FROM guild_bank_right WHERE guildid='%u' AND TabId='%u' AND rid='%u'", m_Id, uint32(TabId), rankId); CharacterDatabase.PExecute("DELETE FROM guild_bank_right WHERE guildid='%u' AND TabId='%u' AND rid='%u'", m_Id, uint32(TabId), rankId);
CharacterDatabase.PExecute("INSERT INTO guild_bank_right (guildid,TabId,rid,gbright,SlotPerDay) VALUES " CharacterDatabase.PExecute("INSERT INTO guild_bank_right (guildid,TabId,rid,gbright,SlotPerDay) VALUES "
@ -1960,16 +1974,20 @@ void Guild::DisplayGuildBankLogs(WorldSession* session, uint8 TabId)
// Here we display money logs // Here we display money logs
data.WriteBits(m_GuildBankEventLog_Money.size(), 23); data.WriteBits(m_GuildBankEventLog_Money.size(), 23);
for (GuildBankEventLog::iterator itr = m_GuildBankEventLog_Money.begin(); itr != m_GuildBankEventLog_Money.end(); ++itr) for (GuildBankEventLog::iterator itr = m_GuildBankEventLog_Money.begin(); itr != m_GuildBankEventLog_Money.end(); ++itr)
{
itr->WriteData(data, buffer); itr->WriteData(data, buffer);
} }
}
else else
{ {
// here we display current tab logs // here we display current tab logs
// number of log entries // number of log entries
data.WriteBits(m_GuildBankEventLog_Item[TabId].size(), 23); data.WriteBits(m_GuildBankEventLog_Item[TabId].size(), 23);
for (GuildBankEventLog::iterator itr = m_GuildBankEventLog_Item[TabId].begin(); itr != m_GuildBankEventLog_Item[TabId].end(); ++itr) for (GuildBankEventLog::iterator itr = m_GuildBankEventLog_Item[TabId].begin(); itr != m_GuildBankEventLog_Item[TabId].end(); ++itr)
{
itr->WriteData(data, buffer); itr->WriteData(data, buffer);
} }
}
if (!buffer.empty()) if (!buffer.empty())
{ {
data.FlushBits(); data.FlushBits();

View file

@ -924,9 +924,11 @@ void Item::SetItemRandomProperties(int32 randomPropId)
SetState(ITEM_CHANGED); SetState(ITEM_CHANGED);
} }
for (uint32 i = PROP_ENCHANTMENT_SLOT_1; i < PROP_ENCHANTMENT_SLOT_4; ++i) for (uint32 i = PROP_ENCHANTMENT_SLOT_1; i < PROP_ENCHANTMENT_SLOT_4; ++i)
{
SetEnchantment(EnchantmentSlot(i), item_rand->enchant_id[i - PROP_ENCHANTMENT_SLOT_1], 0, 0); SetEnchantment(EnchantmentSlot(i), item_rand->enchant_id[i - PROP_ENCHANTMENT_SLOT_1], 0, 0);
} }
} }
}
else else
{ {
ItemRandomSuffixEntry const* item_rand = sItemRandomSuffixStore.LookupEntry(-randomPropId); ItemRandomSuffixEntry const* item_rand = sItemRandomSuffixStore.LookupEntry(-randomPropId);
@ -941,10 +943,12 @@ void Item::SetItemRandomProperties(int32 randomPropId)
} }
for (uint32 i = PROP_ENCHANTMENT_SLOT_0; i < PROP_ENCHANTMENT_SLOT_4; ++i) for (uint32 i = PROP_ENCHANTMENT_SLOT_0; i < PROP_ENCHANTMENT_SLOT_4; ++i)
{
SetEnchantment(EnchantmentSlot(i), item_rand->enchant_id[i - PROP_ENCHANTMENT_SLOT_0], 0, 0); SetEnchantment(EnchantmentSlot(i), item_rand->enchant_id[i - PROP_ENCHANTMENT_SLOT_0], 0, 0);
} }
} }
} }
}
bool Item::UpdateItemSuffixFactor() bool Item::UpdateItemSuffixFactor()
{ {
@ -1268,7 +1272,9 @@ void Item::ClearEnchantment(EnchantmentSlot slot)
} }
for (uint8 x = 0; x < 3; ++x) for (uint8 x = 0; x < 3; ++x)
{
SetUInt32Value(ITEM_FIELD_ENCHANTMENT_1_1 + slot * MAX_ENCHANTMENT_OFFSET + x, 0); SetUInt32Value(ITEM_FIELD_ENCHANTMENT_1_1 + slot * MAX_ENCHANTMENT_OFFSET + x, 0);
}
SetState(ITEM_CHANGED); SetState(ITEM_CHANGED);
} }
@ -1277,7 +1283,9 @@ void Item::SendUpdateSockets()
WorldPacket data(SMSG_SOCKET_GEMS, 8 + 4 + 4 + 4 + 4); WorldPacket data(SMSG_SOCKET_GEMS, 8 + 4 + 4 + 4 + 4);
data << GetObjectGuid(); data << GetObjectGuid();
for (uint32 i = SOCK_ENCHANTMENT_SLOT; i <= BONUS_ENCHANTMENT_SLOT; ++i) for (uint32 i = SOCK_ENCHANTMENT_SLOT; i <= BONUS_ENCHANTMENT_SLOT; ++i)
{
data << uint32(GetEnchantmentId(EnchantmentSlot(i))); data << uint32(GetEnchantmentId(EnchantmentSlot(i)));
}
GetOwner()->SendDirectMessage(&data); GetOwner()->SendDirectMessage(&data);
} }

View file

@ -245,7 +245,9 @@ void LootStore::ReportUnusedIds(LootIdSet const& ids_set) const
if (!ids_set.empty()) if (!ids_set.empty())
{ {
for (LootIdSet::const_iterator itr = ids_set.begin(); itr != ids_set.end(); ++itr) for (LootIdSet::const_iterator itr = ids_set.begin(); itr != ids_set.end(); ++itr)
{
sLog.outErrorDb("Table '%s' entry %d isn't %s and not referenced from loot, and then useless.", GetName(), *itr, GetEntryName()); sLog.outErrorDb("Table '%s' entry %d isn't %s and not referenced from loot, and then useless.", GetName(), *itr, GetEntryName());
}
sLog.outString(); sLog.outString();
} }
} }

View file

@ -277,7 +277,9 @@ struct Loot
void clear() void clear()
{ {
for (QuestItemMap::const_iterator itr = m_playerCurrencies.begin(); itr != m_playerCurrencies.end(); ++itr) for (QuestItemMap::const_iterator itr = m_playerCurrencies.begin(); itr != m_playerCurrencies.end(); ++itr)
{
delete itr->second; delete itr->second;
}
m_playerCurrencies.clear(); m_playerCurrencies.clear();
for (QuestItemMap::const_iterator itr = m_playerQuestItems.begin(); itr != m_playerQuestItems.end(); ++itr) for (QuestItemMap::const_iterator itr = m_playerQuestItems.begin(); itr != m_playerQuestItems.end(); ++itr)

View file

@ -125,8 +125,10 @@ ObjectAccessor::SaveAllPlayers()
HashMapHolder<Player>::ReadGuard g(HashMapHolder<Player>::GetLock()); HashMapHolder<Player>::ReadGuard g(HashMapHolder<Player>::GetLock());
HashMapHolder<Player>::MapType& m = sObjectAccessor.GetPlayers(); HashMapHolder<Player>::MapType& m = sObjectAccessor.GetPlayers();
for (HashMapHolder<Player>::MapType::iterator itr = m.begin(); itr != m.end(); ++itr) for (HashMapHolder<Player>::MapType::iterator itr = m.begin(); itr != m.end(); ++itr)
{
itr->second->SaveToDB(); itr->second->SaveToDB();
} }
}
void ObjectAccessor::KickPlayer(ObjectGuid guid) void ObjectAccessor::KickPlayer(ObjectGuid guid)
{ {

View file

@ -199,7 +199,9 @@ ObjectMgr::~ObjectMgr()
{ delete itr->second; } { delete itr->second; }
for (ArenaTeamMap::iterator itr = mArenaTeamMap.begin(); itr != mArenaTeamMap.end(); ++itr) for (ArenaTeamMap::iterator itr = mArenaTeamMap.begin(); itr != mArenaTeamMap.end(); ++itr)
{
delete itr->second; delete itr->second;
}
for (CacheVendorItemMap::iterator itr = m_mCacheVendorTemplateItemMap.begin(); itr != m_mCacheVendorTemplateItemMap.end(); ++itr) for (CacheVendorItemMap::iterator itr = m_mCacheVendorTemplateItemMap.begin(); itr != m_mCacheVendorTemplateItemMap.end(); ++itr)
{ itr->second.Clear(); } { itr->second.Clear(); }

View file

@ -320,7 +320,9 @@ bool Pet::LoadPetFromDB(Player* owner, uint32 petentry, uint32 petnumber, bool c
Field* fields2 = result->Fetch(); Field* fields2 = result->Fetch();
for (int i = 0; i < MAX_DECLINED_NAME_CASES; ++i) for (int i = 0; i < MAX_DECLINED_NAME_CASES; ++i)
{
m_declinedname->name[i] = fields2[i].GetCppString(); m_declinedname->name[i] = fields2[i].GetCppString();
}
delete result; delete result;
} }
@ -900,7 +902,9 @@ void Pet::InitStatsForLevel(uint32 petlevel)
} }
for (int i = SPELL_SCHOOL_HOLY; i < MAX_SPELL_SCHOOL; ++i) for (int i = SPELL_SCHOOL_HOLY; i < MAX_SPELL_SCHOOL; ++i)
{
SetModifierValue(UnitMods(UNIT_MOD_RESISTANCE_START + i), BASE_VALUE, float(createResistance[i])); SetModifierValue(UnitMods(UNIT_MOD_RESISTANCE_START + i), BASE_VALUE, float(createResistance[i]));
}
float health, mana, armor, minDmg; float health, mana, armor, minDmg;
@ -937,7 +941,9 @@ void Pet::InitStatsForLevel(uint32 petlevel)
if (PetLevelInfo const* pInfo = sObjectMgr.GetPetLevelInfo(1, petlevel)) if (PetLevelInfo const* pInfo = sObjectMgr.GetPetLevelInfo(1, petlevel))
{ {
for (int i = STAT_STRENGTH; i < MAX_STATS;++i) for (int i = STAT_STRENGTH; i < MAX_STATS;++i)
{
SetCreateStat(Stats(i), float(pInfo->stats[i])); SetCreateStat(Stats(i), float(pInfo->stats[i]));
}
health = pInfo->health; health = pInfo->health;
mana = 0; mana = 0;
@ -955,7 +961,9 @@ void Pet::InitStatsForLevel(uint32 petlevel)
sLog.outErrorDb("HUNTER PET levelstats missing in DB! 'Weakifying' pet"); sLog.outErrorDb("HUNTER PET levelstats missing in DB! 'Weakifying' pet");
for (int i = STAT_STRENGTH; i < MAX_STATS;++i) for (int i = STAT_STRENGTH; i < MAX_STATS;++i)
{
SetCreateStat(Stats(i), 1.0f); SetCreateStat(Stats(i), 1.0f);
}
health = 1; health = 1;
mana = 0; mana = 0;
@ -1010,7 +1018,9 @@ void Pet::InitStatsForLevel(uint32 petlevel)
if (PetLevelInfo const* pInfo = sObjectMgr.GetPetLevelInfo(cInfo->Entry, petlevel)) if (PetLevelInfo const* pInfo = sObjectMgr.GetPetLevelInfo(cInfo->Entry, petlevel))
{ {
for (int i = STAT_STRENGTH; i < MAX_STATS;++i) for (int i = STAT_STRENGTH; i < MAX_STATS;++i)
{
SetCreateStat(Stats(i), float(pInfo->stats[i])); SetCreateStat(Stats(i), float(pInfo->stats[i]));
}
health = pInfo->health; health = pInfo->health;
mana = pInfo->mana; mana = pInfo->mana;
@ -1045,7 +1055,9 @@ void Pet::InitStatsForLevel(uint32 petlevel)
sLog.outErrorDb("SUMMON_PET levelstats missing in DB! 'Weakifying' pet and giving it mana to make it obvious"); sLog.outErrorDb("SUMMON_PET levelstats missing in DB! 'Weakifying' pet and giving it mana to make it obvious");
for (int i = STAT_STRENGTH; i < MAX_STATS;++i) for (int i = STAT_STRENGTH; i < MAX_STATS;++i)
{
SetCreateStat(Stats(i), 1.0f); SetCreateStat(Stats(i), 1.0f);
}
health = 1; health = 1;
mana = 1; mana = 1;

View file

@ -149,7 +149,9 @@ void PlayerTaxi::InitTaxiNodesForLevel(uint32 race, uint32 chrClass, uint32 leve
case CLASS_DEATH_KNIGHT: case CLASS_DEATH_KNIGHT:
{ {
for (int i = 0; i < TaxiMaskSize; ++i) for (int i = 0; i < TaxiMaskSize; ++i)
{
m_taximask[i] |= sOldContinentsNodesMask[i]; m_taximask[i] |= sOldContinentsNodesMask[i];
}
break; break;
} }
} }
@ -568,7 +570,9 @@ Player::Player(WorldSession* session): Unit(), m_mover(this), m_camera(this), m_
m_activeSpec = 0; m_activeSpec = 0;
m_specsCount = 1; m_specsCount = 1;
for (int i = 0; i < MAX_TALENT_SPEC_COUNT; ++i) for (int i = 0; i < MAX_TALENT_SPEC_COUNT; ++i)
{
m_talentsPrimaryTree[i] = 0; m_talentsPrimaryTree[i] = 0;
}
for (int i = 0; i < BASEMOD_END; ++i) for (int i = 0; i < BASEMOD_END; ++i)
{ {
@ -577,7 +581,9 @@ Player::Player(WorldSession* session): Unit(), m_mover(this), m_camera(this), m_
} }
for (int i = 0; i < MAX_COMBAT_RATING; ++i) for (int i = 0; i < MAX_COMBAT_RATING; ++i)
{
m_baseRatingValue[i] = 0; m_baseRatingValue[i] = 0;
}
m_baseSpellPower = 0; m_baseSpellPower = 0;
m_baseHealthRegen = 0; m_baseHealthRegen = 0;
@ -641,7 +647,9 @@ Player::~Player()
// clean up player-instance binds, may unload some instance saves // clean up player-instance binds, may unload some instance saves
for (uint8 i = 0; i < MAX_DIFFICULTY; ++i) for (uint8 i = 0; i < MAX_DIFFICULTY; ++i)
for (BoundInstancesMap::iterator itr = m_boundInstances[i].begin(); itr != m_boundInstances[i].end(); ++itr) for (BoundInstancesMap::iterator itr = m_boundInstances[i].begin(); itr != m_boundInstances[i].end(); ++itr)
{
itr->second.state->RemovePlayer(this); itr->second.state->RemovePlayer(this);
}
delete m_declinedname; delete m_declinedname;
delete m_runes; delete m_runes;
@ -793,7 +801,9 @@ bool Player::Create(uint32 guidlow, const std::string& name, uint8 race, uint8 c
// original action bar // original action bar
for (PlayerCreateInfoActions::const_iterator action_itr = info->action.begin(); action_itr != info->action.end(); ++action_itr) for (PlayerCreateInfoActions::const_iterator action_itr = info->action.begin(); action_itr != info->action.end(); ++action_itr)
{
addActionButton(0, action_itr->button, action_itr->action, action_itr->type); addActionButton(0, action_itr->button, action_itr->action, action_itr->type);
}
// original items // original items
uint32 raceClassGender = GetUInt32Value(UNIT_FIELD_BYTES_0) & 0x00FFFFFF; uint32 raceClassGender = GetUInt32Value(UNIT_FIELD_BYTES_0) & 0x00FFFFFF;
@ -2375,7 +2385,9 @@ void Player::RegenerateHealth(uint32 diff)
AuraList const& mModHealthRegenPct = GetAurasByType(SPELL_AURA_MOD_HEALTH_REGEN_PERCENT); AuraList const& mModHealthRegenPct = GetAurasByType(SPELL_AURA_MOD_HEALTH_REGEN_PERCENT);
for (AuraList::const_iterator i = mModHealthRegenPct.begin(); i != mModHealthRegenPct.end(); ++i) for (AuraList::const_iterator i = mModHealthRegenPct.begin(); i != mModHealthRegenPct.end(); ++i)
{
addvalue *= (100.0f + (*i)->GetModifier()->m_amount) / 100.0f; addvalue *= (100.0f + (*i)->GetModifier()->m_amount) / 100.0f;
}
addvalue += GetTotalAuraModifier(SPELL_AURA_MOD_REGEN) * 2.0f / 5.0f; addvalue += GetTotalAuraModifier(SPELL_AURA_MOD_REGEN) * 2.0f / 5.0f;
} }
@ -2732,15 +2744,19 @@ void Player::GiveXP(uint32 xp, Unit* victim)
// handle SPELL_AURA_MOD_KILL_XP_PCT auras // handle SPELL_AURA_MOD_KILL_XP_PCT auras
Unit::AuraList const& ModXPPctAuras = GetAurasByType(SPELL_AURA_MOD_KILL_XP_PCT); Unit::AuraList const& ModXPPctAuras = GetAurasByType(SPELL_AURA_MOD_KILL_XP_PCT);
for (Unit::AuraList::const_iterator i = ModXPPctAuras.begin(); i != ModXPPctAuras.end(); ++i) for (Unit::AuraList::const_iterator i = ModXPPctAuras.begin(); i != ModXPPctAuras.end(); ++i)
{
xp = uint32(xp * (1.0f + (*i)->GetModifier()->m_amount / 100.0f)); xp = uint32(xp * (1.0f + (*i)->GetModifier()->m_amount / 100.0f));
} }
}
else else
{ {
// handle SPELL_AURA_MOD_QUEST_XP_PCT auras // handle SPELL_AURA_MOD_QUEST_XP_PCT auras
Unit::AuraList const& ModXPPctAuras = GetAurasByType(SPELL_AURA_MOD_QUEST_XP_PCT); Unit::AuraList const& ModXPPctAuras = GetAurasByType(SPELL_AURA_MOD_QUEST_XP_PCT);
for (Unit::AuraList::const_iterator i = ModXPPctAuras.begin(); i != ModXPPctAuras.end(); ++i) for (Unit::AuraList::const_iterator i = ModXPPctAuras.begin(); i != ModXPPctAuras.end(); ++i)
{
xp = uint32(xp * (1.0f + (*i)->GetModifier()->m_amount / 100.0f)); xp = uint32(xp * (1.0f + (*i)->GetModifier()->m_amount / 100.0f));
} }
}
// XP resting bonus for kill // XP resting bonus for kill
uint32 rested_bonus_xp = victim ? GetXPRestBonus(xp) : 0; uint32 rested_bonus_xp = victim ? GetXPRestBonus(xp) : 0;
@ -2792,7 +2808,9 @@ void Player::GiveLevel(uint32 level)
data << uint32(0); data << uint32(0);
// end for // end for
for (int i = STAT_STRENGTH; i < MAX_STATS; ++i) // Stats loop (0-4) for (int i = STAT_STRENGTH; i < MAX_STATS; ++i) // Stats loop (0-4)
{
data << uint32(int32(info.stats[i]) - GetCreateStat(Stats(i))); data << uint32(int32(info.stats[i]) - GetCreateStat(Stats(i)));
}
GetSession()->SendPacket(&data); GetSession()->SendPacket(&data);
@ -2809,7 +2827,9 @@ void Player::GiveLevel(uint32 level)
// save base values (bonuses already included in stored stats // save base values (bonuses already included in stored stats
for (int i = STAT_STRENGTH; i < MAX_STATS; ++i) for (int i = STAT_STRENGTH; i < MAX_STATS; ++i)
{
SetCreateStat(Stats(i), info.stats[i]); SetCreateStat(Stats(i), info.stats[i]);
}
SetCreateHealth(basehp); SetCreateHealth(basehp);
SetCreateMana(basemana); SetCreateMana(basemana);
@ -2919,10 +2939,14 @@ void Player::InitStatsForLevel(bool reapplyMods)
// save base values (bonuses already included in stored stats // save base values (bonuses already included in stored stats
for (int i = STAT_STRENGTH; i < MAX_STATS; ++i) for (int i = STAT_STRENGTH; i < MAX_STATS; ++i)
{
SetCreateStat(Stats(i), info.stats[i]); SetCreateStat(Stats(i), info.stats[i]);
}
for (int i = STAT_STRENGTH; i < MAX_STATS; ++i) for (int i = STAT_STRENGTH; i < MAX_STATS; ++i)
{
SetStat(Stats(i), info.stats[i]); SetStat(Stats(i), info.stats[i]);
}
SetCreateHealth(basehp); SetCreateHealth(basehp);
@ -2935,7 +2959,9 @@ void Player::InitStatsForLevel(bool reapplyMods)
// reset rating fields values // reset rating fields values
for (uint16 index = PLAYER_FIELD_COMBAT_RATING_1; index < PLAYER_FIELD_COMBAT_RATING_1 + MAX_COMBAT_RATING; ++index) for (uint16 index = PLAYER_FIELD_COMBAT_RATING_1; index < PLAYER_FIELD_COMBAT_RATING_1 + MAX_COMBAT_RATING; ++index)
{
SetUInt32Value(index, 0); SetUInt32Value(index, 0);
}
SetUInt32Value(PLAYER_FIELD_MOD_HEALING_DONE_POS, 0); SetUInt32Value(PLAYER_FIELD_MOD_HEALING_DONE_POS, 0);
SetFloatValue(PLAYER_FIELD_MOD_HEALING_PCT, 1.0f); SetFloatValue(PLAYER_FIELD_MOD_HEALING_PCT, 1.0f);
@ -2978,7 +3004,9 @@ void Player::InitStatsForLevel(bool reapplyMods)
// Init spell schools (will be recalculated in UpdateAllStats() at loading and in _ApplyAllStatBonuses() at reset // Init spell schools (will be recalculated in UpdateAllStats() at loading and in _ApplyAllStatBonuses() at reset
for (uint8 i = 0; i < MAX_SPELL_SCHOOL; ++i) for (uint8 i = 0; i < MAX_SPELL_SCHOOL; ++i)
{
SetFloatValue(PLAYER_SPELL_CRIT_PERCENTAGE1 + i, 0.0f); SetFloatValue(PLAYER_SPELL_CRIT_PERCENTAGE1 + i, 0.0f);
}
SetFloatValue(PLAYER_PARRY_PERCENTAGE, 0.0f); SetFloatValue(PLAYER_PARRY_PERCENTAGE, 0.0f);
SetFloatValue(PLAYER_BLOCK_PERCENTAGE, 0.0f); SetFloatValue(PLAYER_BLOCK_PERCENTAGE, 0.0f);
@ -3008,13 +3036,17 @@ void Player::InitStatsForLevel(bool reapplyMods)
} }
// Reset no reagent cost field // Reset no reagent cost field
for (int i = 0; i < 3; ++i) for (int i = 0; i < 3; ++i)
{
SetUInt32Value(PLAYER_NO_REAGENT_COST_1 + i, 0); SetUInt32Value(PLAYER_NO_REAGENT_COST_1 + i, 0);
}
// Init data for form but skip reapply item mods for form // Init data for form but skip reapply item mods for form
InitDataForForm(reapplyMods); InitDataForForm(reapplyMods);
// save new stats // save new stats
for (int i = POWER_MANA; i < MAX_POWERS; ++i) for (int i = POWER_MANA; i < MAX_POWERS; ++i)
{
SetMaxPower(Powers(i), GetCreateMaxPowers(Powers(i))); SetMaxPower(Powers(i), GetCreateMaxPowers(Powers(i)));
}
SetMaxHealth(basehp); // stamina bonus will applied later SetMaxHealth(basehp); // stamina bonus will applied later
@ -3783,7 +3815,9 @@ void Player::removeSpell(uint32 spell_id, bool disabled, bool learn_low_rank, bo
SpellLearnSpellMapBounds spell_bounds = sSpellMgr.GetSpellLearnSpellMapBounds(spell_id); SpellLearnSpellMapBounds spell_bounds = sSpellMgr.GetSpellLearnSpellMapBounds(spell_id);
for (SpellLearnSpellMap::const_iterator itr2 = spell_bounds.first; itr2 != spell_bounds.second; ++itr2) for (SpellLearnSpellMap::const_iterator itr2 = spell_bounds.first; itr2 != spell_bounds.second; ++itr2)
{
removeSpell(itr2->second.spell, disabled); removeSpell(itr2->second.spell, disabled);
}
// activate lesser rank in spellbook/action bar, and cast it if need // activate lesser rank in spellbook/action bar, and cast it if need
bool prev_activate = false; bool prev_activate = false;
@ -3923,7 +3957,9 @@ void Player::RemoveAllSpellCooldown()
data.WriteGuidBytes<7, 2, 4, 5, 1, 3>(guid); data.WriteGuidBytes<7, 2, 4, 5, 1, 3>(guid);
for (SpellCooldowns::const_iterator itr = m_spellCooldowns.begin(); itr != m_spellCooldowns.end(); ++itr) for (SpellCooldowns::const_iterator itr = m_spellCooldowns.begin(); itr != m_spellCooldowns.end(); ++itr)
{
data << uint32(itr->first); data << uint32(itr->first);
}
data.WriteGuidBytes<0, 6>(guid); data.WriteGuidBytes<0, 6>(guid);
@ -4111,12 +4147,16 @@ bool Player::resetTalents(bool no_cost, bool all_specs)
{ {
if (std::vector<uint32> const* specSpells = GetTalentTreeMasterySpells(GetTalentTabPages(getClass())[i])) if (std::vector<uint32> const* specSpells = GetTalentTreeMasterySpells(GetTalentTabPages(getClass())[i]))
for (size_t i = 0; i < specSpells->size(); ++i) for (size_t i = 0; i < specSpells->size(); ++i)
{
removeSpell(specSpells->at(i), true); removeSpell(specSpells->at(i), true);
}
if (std::vector<uint32> const* specSpells = GetTalentTreePrimarySpells(GetTalentTabPages(getClass())[i])) if (std::vector<uint32> const* specSpells = GetTalentTreePrimarySpells(GetTalentTabPages(getClass())[i]))
for (size_t i = 0; i < specSpells->size(); ++i) for (size_t i = 0; i < specSpells->size(); ++i)
{
removeSpell(specSpells->at(i), true); removeSpell(specSpells->at(i), true);
} }
}
for (uint8 spec = 0; spec < MAX_TALENT_SPEC_COUNT; ++spec) for (uint8 spec = 0; spec < MAX_TALENT_SPEC_COUNT; ++spec)
{ {
@ -4298,7 +4338,9 @@ void Player::InitVisibleBits()
// PLAYER_QUEST_LOG_x also visible bit on official (but only on party/raid)... // PLAYER_QUEST_LOG_x also visible bit on official (but only on party/raid)...
for (uint16 i = PLAYER_QUEST_LOG_1_1; i < PLAYER_QUEST_LOG_25_2; i += MAX_QUEST_OFFSET) for (uint16 i = PLAYER_QUEST_LOG_1_1; i < PLAYER_QUEST_LOG_25_2; i += MAX_QUEST_OFFSET)
{
updateVisualBits.SetBit(i); updateVisualBits.SetBit(i);
}
// Players visible items are not inventory stuff // Players visible items are not inventory stuff
for (uint16 i = 0; i < EQUIPMENT_SLOT_END; ++i) for (uint16 i = 0; i < EQUIPMENT_SLOT_END; ++i)
@ -5119,14 +5161,18 @@ uint32 Player::DurabilityRepairAll(bool cost, float discountMod, bool guildBank)
uint32 TotalCost = 0; uint32 TotalCost = 0;
// equipped, backpack, bags itself // equipped, backpack, bags itself
for (int i = EQUIPMENT_SLOT_START; i < INVENTORY_SLOT_ITEM_END; ++i) for (int i = EQUIPMENT_SLOT_START; i < INVENTORY_SLOT_ITEM_END; ++i)
{
TotalCost += DurabilityRepair(((INVENTORY_SLOT_BAG_0 << 8) | i), cost, discountMod, guildBank); TotalCost += DurabilityRepair(((INVENTORY_SLOT_BAG_0 << 8) | i), cost, discountMod, guildBank);
}
// bank, buyback and keys not repaired // bank, buyback and keys not repaired
// items in inventory bags // items in inventory bags
for (int j = INVENTORY_SLOT_BAG_START; j < INVENTORY_SLOT_BAG_END; ++j) for (int j = INVENTORY_SLOT_BAG_START; j < INVENTORY_SLOT_BAG_END; ++j)
for (int i = 0; i < MAX_BAG_SIZE; ++i) for (int i = 0; i < MAX_BAG_SIZE; ++i)
{
TotalCost += DurabilityRepair(((j << 8) | i), cost, discountMod, guildBank); TotalCost += DurabilityRepair(((j << 8) | i), cost, discountMod, guildBank);
}
return TotalCost; return TotalCost;
} }
@ -5742,8 +5788,10 @@ void Player::UpdateRating(CombatRating cr)
void Player::UpdateAllRatings() void Player::UpdateAllRatings()
{ {
for (int cr = 0; cr < MAX_COMBAT_RATING; ++cr) for (int cr = 0; cr < MAX_COMBAT_RATING; ++cr)
{
UpdateRating(CombatRating(cr)); UpdateRating(CombatRating(cr));
} }
}
void Player::SetRegularAttackTime() void Player::SetRegularAttackTime()
{ {
@ -7484,7 +7532,9 @@ void Player::DuelComplete(DuelCompleteType type)
} }
for (size_t i = 0; i < auras2remove.size(); ++i) for (size_t i = 0; i < auras2remove.size(); ++i)
{
duel->opponent->RemoveAurasDueToSpell(auras2remove[i]); duel->opponent->RemoveAurasDueToSpell(auras2remove[i]);
}
auras2remove.clear(); auras2remove.clear();
SpellAuraHolderMap const& auras = GetSpellAuraHolderMap(); SpellAuraHolderMap const& auras = GetSpellAuraHolderMap();
@ -7494,7 +7544,9 @@ void Player::DuelComplete(DuelCompleteType type)
auras2remove.push_back(i->second->GetId()); auras2remove.push_back(i->second->GetId());
} }
for (size_t i = 0; i < auras2remove.size(); ++i) for (size_t i = 0; i < auras2remove.size(); ++i)
{
RemoveAurasDueToSpell(auras2remove[i]); RemoveAurasDueToSpell(auras2remove[i]);
}
// cleanup combo points // cleanup combo points
if (GetComboTargetGuid() == duel->opponent->GetObjectGuid()) if (GetComboTargetGuid() == duel->opponent->GetObjectGuid())
@ -7808,16 +7860,22 @@ void Player::_ApplyWeaponDependentAuraMods(Item* item, WeaponAttackType attackTy
{ {
AuraList const& auraCritList = GetAurasByType(SPELL_AURA_MOD_CRIT_PERCENT); AuraList const& auraCritList = GetAurasByType(SPELL_AURA_MOD_CRIT_PERCENT);
for (AuraList::const_iterator itr = auraCritList.begin(); itr != auraCritList.end(); ++itr) for (AuraList::const_iterator itr = auraCritList.begin(); itr != auraCritList.end(); ++itr)
{
_ApplyWeaponDependentAuraCritMod(item, attackType, *itr, apply); _ApplyWeaponDependentAuraCritMod(item, attackType, *itr, apply);
}
AuraList const& auraDamageFlatList = GetAurasByType(SPELL_AURA_MOD_DAMAGE_DONE); AuraList const& auraDamageFlatList = GetAurasByType(SPELL_AURA_MOD_DAMAGE_DONE);
for (AuraList::const_iterator itr = auraDamageFlatList.begin(); itr != auraDamageFlatList.end(); ++itr) for (AuraList::const_iterator itr = auraDamageFlatList.begin(); itr != auraDamageFlatList.end(); ++itr)
{
_ApplyWeaponDependentAuraDamageMod(item, attackType, *itr, apply); _ApplyWeaponDependentAuraDamageMod(item, attackType, *itr, apply);
}
AuraList const& auraDamagePCTList = GetAurasByType(SPELL_AURA_MOD_DAMAGE_PERCENT_DONE); AuraList const& auraDamagePCTList = GetAurasByType(SPELL_AURA_MOD_DAMAGE_PERCENT_DONE);
for (AuraList::const_iterator itr = auraDamagePCTList.begin(); itr != auraDamagePCTList.end(); ++itr) for (AuraList::const_iterator itr = auraDamagePCTList.begin(); itr != auraDamagePCTList.end(); ++itr)
{
_ApplyWeaponDependentAuraDamageMod(item, attackType, *itr, apply); _ApplyWeaponDependentAuraDamageMod(item, attackType, *itr, apply);
} }
}
void Player::_ApplyWeaponDependentAuraCritMod(Item* item, WeaponAttackType attackType, Aura* aura, bool apply) void Player::_ApplyWeaponDependentAuraCritMod(Item* item, WeaponAttackType attackType, Aura* aura, bool apply)
{ {
@ -11382,7 +11440,9 @@ Item* Player::StoreNewItem(ItemPosCountVec const& dest, uint32 item, bool update
{ {
uint32 count = 0; uint32 count = 0;
for (ItemPosCountVec::const_iterator itr = dest.begin(); itr != dest.end(); ++itr) for (ItemPosCountVec::const_iterator itr = dest.begin(); itr != dest.end(); ++itr)
{
count += itr->count; count += itr->count;
}
Item* pItem = Item::CreateItem(item, count, this, randomPropertyId); Item* pItem = Item::CreateItem(item, count, this, randomPropertyId);
if (pItem) if (pItem)
@ -11868,8 +11928,10 @@ void Player::DestroyItem(uint8 bag, uint8 slot, bool update)
if (pItem->IsBag() && pItem->IsEquipped()) // this also prevent infinity loop if empty bag stored in bag==slot if (pItem->IsBag() && pItem->IsEquipped()) // this also prevent infinity loop if empty bag stored in bag==slot
{ {
for (int i = 0; i < MAX_BAG_SIZE; ++i) for (int i = 0; i < MAX_BAG_SIZE; ++i)
{
DestroyItem(slot, i, update); DestroyItem(slot, i, update);
} }
}
if (pItem->HasFlag(ITEM_FIELD_FLAGS, ITEM_DYNFLAG_WRAPPED)) if (pItem->HasFlag(ITEM_FIELD_FLAGS, ITEM_DYNFLAG_WRAPPED))
{ {
@ -12920,8 +12982,10 @@ void Player::AddEnchantmentDuration(Item* item, EnchantmentSlot slot, uint32 dur
void Player::ApplyEnchantment(Item* item, bool apply) void Player::ApplyEnchantment(Item* item, bool apply)
{ {
for (uint32 slot = 0; slot < MAX_ENCHANTMENT_SLOT; ++slot) for (uint32 slot = 0; slot < MAX_ENCHANTMENT_SLOT; ++slot)
{
ApplyEnchantment(item, EnchantmentSlot(slot), apply); ApplyEnchantment(item, EnchantmentSlot(slot), apply);
} }
}
void Player::ApplyEnchantment(Item* item, EnchantmentSlot slot, bool apply, bool apply_dur, bool ignore_condition) void Player::ApplyEnchantment(Item* item, EnchantmentSlot slot, bool apply, bool apply_dur, bool ignore_condition)
{ {
@ -14508,14 +14572,18 @@ void Player::AddQuest(Quest const* pQuest, Object* questGiver)
if (pQuest->HasSpecialFlag(QUEST_SPECIAL_FLAG_DELIVER)) if (pQuest->HasSpecialFlag(QUEST_SPECIAL_FLAG_DELIVER))
{ {
for (int i = 0; i < QUEST_ITEM_OBJECTIVES_COUNT; ++i) for (int i = 0; i < QUEST_ITEM_OBJECTIVES_COUNT; ++i)
{
questStatusData.m_itemcount[i] = 0; questStatusData.m_itemcount[i] = 0;
} }
}
if (pQuest->HasSpecialFlag(QuestSpecialFlags(QUEST_SPECIAL_FLAG_KILL_OR_CAST | QUEST_SPECIAL_FLAG_SPEAKTO))) if (pQuest->HasSpecialFlag(QuestSpecialFlags(QUEST_SPECIAL_FLAG_KILL_OR_CAST | QUEST_SPECIAL_FLAG_SPEAKTO)))
{ {
for (int i = 0; i < QUEST_OBJECTIVES_COUNT; ++i) for (int i = 0; i < QUEST_OBJECTIVES_COUNT; ++i)
{
questStatusData.m_creatureOrGOcount[i] = 0; questStatusData.m_creatureOrGOcount[i] = 0;
} }
}
if (pQuest->GetRepObjectiveFaction()) if (pQuest->GetRepObjectiveFaction())
if (FactionEntry const* factionEntry = sFactionStore.LookupEntry(pQuest->GetRepObjectiveFaction())) if (FactionEntry const* factionEntry = sFactionStore.LookupEntry(pQuest->GetRepObjectiveFaction()))
@ -14596,16 +14664,22 @@ void Player::AddQuest(Quest const* pQuest, Object* questGiver)
GetZoneAndAreaId(zone, area); GetZoneAndAreaId(zone, area);
SpellAreaForAreaMapBounds saBounds = sSpellMgr.GetSpellAreaForAreaMapBounds(zone); SpellAreaForAreaMapBounds saBounds = sSpellMgr.GetSpellAreaForAreaMapBounds(zone);
for (SpellAreaForAreaMap::const_iterator itr = saBounds.first; itr != saBounds.second; ++itr) for (SpellAreaForAreaMap::const_iterator itr = saBounds.first; itr != saBounds.second; ++itr)
{
itr->second->ApplyOrRemoveSpellIfCan(this, zone, area, true); itr->second->ApplyOrRemoveSpellIfCan(this, zone, area, true);
}
if (area != zone) if (area != zone)
{ {
saBounds = sSpellMgr.GetSpellAreaForAreaMapBounds(area); saBounds = sSpellMgr.GetSpellAreaForAreaMapBounds(area);
for (SpellAreaForAreaMap::const_iterator itr = saBounds.first; itr != saBounds.second; ++itr) for (SpellAreaForAreaMap::const_iterator itr = saBounds.first; itr != saBounds.second; ++itr)
{
itr->second->ApplyOrRemoveSpellIfCan(this, zone, area, true); itr->second->ApplyOrRemoveSpellIfCan(this, zone, area, true);
} }
}
saBounds = sSpellMgr.GetSpellAreaForAreaMapBounds(0); saBounds = sSpellMgr.GetSpellAreaForAreaMapBounds(0);
for (SpellAreaForAreaMap::const_iterator itr = saBounds.first; itr != saBounds.second; ++itr) for (SpellAreaForAreaMap::const_iterator itr = saBounds.first; itr != saBounds.second; ++itr)
{
itr->second->ApplyOrRemoveSpellIfCan(this, zone, area, true); itr->second->ApplyOrRemoveSpellIfCan(this, zone, area, true);
}
UpdateForQuestWorldObjects(); UpdateForQuestWorldObjects();
} }
@ -14808,16 +14882,22 @@ void Player::RewardQuest(Quest const* pQuest, uint32 reward, Object* questGiver,
GetZoneAndAreaId(zone, area); GetZoneAndAreaId(zone, area);
SpellAreaForAreaMapBounds saBounds = sSpellMgr.GetSpellAreaForAreaMapBounds(zone); SpellAreaForAreaMapBounds saBounds = sSpellMgr.GetSpellAreaForAreaMapBounds(zone);
for (SpellAreaForAreaMap::const_iterator itr = saBounds.first; itr != saBounds.second; ++itr) for (SpellAreaForAreaMap::const_iterator itr = saBounds.first; itr != saBounds.second; ++itr)
{
itr->second->ApplyOrRemoveSpellIfCan(this, zone, area, false); itr->second->ApplyOrRemoveSpellIfCan(this, zone, area, false);
}
if (area != zone) if (area != zone)
{ {
saBounds = sSpellMgr.GetSpellAreaForAreaMapBounds(area); saBounds = sSpellMgr.GetSpellAreaForAreaMapBounds(area);
for (SpellAreaForAreaMap::const_iterator itr = saBounds.first; itr != saBounds.second; ++itr) for (SpellAreaForAreaMap::const_iterator itr = saBounds.first; itr != saBounds.second; ++itr)
{
itr->second->ApplyOrRemoveSpellIfCan(this, zone, area, false); itr->second->ApplyOrRemoveSpellIfCan(this, zone, area, false);
} }
}
saBounds = sSpellMgr.GetSpellAreaForAreaMapBounds(0); saBounds = sSpellMgr.GetSpellAreaForAreaMapBounds(0);
for (SpellAreaForAreaMap::const_iterator itr = saBounds.first; itr != saBounds.second; ++itr) for (SpellAreaForAreaMap::const_iterator itr = saBounds.first; itr != saBounds.second; ++itr)
{
itr->second->ApplyOrRemoveSpellIfCan(this, zone, area, false); itr->second->ApplyOrRemoveSpellIfCan(this, zone, area, false);
}
// resend quests status directly // resend quests status directly
SendQuestGiverStatusMultiple(); SendQuestGiverStatusMultiple();
@ -15336,7 +15416,9 @@ void Player::GiveQuestSourceItemIfNeed(Quest const* pQuest)
{ {
uint32 count = 0; uint32 count = 0;
for (ItemPosCountVec::const_iterator c_itr = dest.begin(); c_itr != dest.end(); ++c_itr) for (ItemPosCountVec::const_iterator c_itr = dest.begin(); c_itr != dest.end(); ++c_itr)
{
count += c_itr->count; count += c_itr->count;
}
Item* item = StoreNewItem(dest, pQuest->GetSrcItemId(), true); Item* item = StoreNewItem(dest, pQuest->GetSrcItemId(), true);
SendNewItem(item, count, true, false); SendNewItem(item, count, true, false);
@ -16253,7 +16335,9 @@ void Player::_LoadDeclinedNames(QueryResult* result)
Field* fields = result->Fetch(); Field* fields = result->Fetch();
for (int i = 0; i < MAX_DECLINED_NAME_CASES; ++i) for (int i = 0; i < MAX_DECLINED_NAME_CASES; ++i)
{
m_declinedname->name[i] = fields[i].GetCppString(); m_declinedname->name[i] = fields[i].GetCppString();
}
delete result; delete result;
} }
@ -16320,7 +16404,9 @@ void Player::_LoadEquipmentSets(QueryResult* result)
eqSet.state = EQUIPMENT_SET_UNCHANGED; eqSet.state = EQUIPMENT_SET_UNCHANGED;
for (uint32 i = 0; i < EQUIPMENT_SLOT_END; ++i) for (uint32 i = 0; i < EQUIPMENT_SLOT_END; ++i)
{
eqSet.Items[i] = fields[5 + i].GetUInt32(); eqSet.Items[i] = fields[5 + i].GetUInt32();
}
m_EquipmentSets[index] = eqSet; m_EquipmentSets[index] = eqSet;
@ -16545,8 +16631,10 @@ bool Player::LoadFromDB(ObjectGuid guid, SqlQueryHolder* holder)
// arena team not exist or not member, cleanup fields // arena team not exist or not member, cleanup fields
for (int j = 0; j < ARENA_TEAM_END; ++j) for (int j = 0; j < ARENA_TEAM_END; ++j)
{
SetArenaTeamInfoField(arena_slot, ArenaTeamInfoType(j), 0); SetArenaTeamInfoField(arena_slot, ArenaTeamInfoType(j), 0);
} }
}
SetUInt32Value(PLAYER_FIELD_LIFETIME_HONORBALE_KILLS, fields[40].GetUInt32()); SetUInt32Value(PLAYER_FIELD_LIFETIME_HONORBALE_KILLS, fields[40].GetUInt32());
SetUInt16Value(PLAYER_FIELD_KILLS, 0, fields[41].GetUInt16()); // today SetUInt16Value(PLAYER_FIELD_KILLS, 0, fields[41].GetUInt16()); // today
@ -16871,8 +16959,10 @@ bool Player::LoadFromDB(ObjectGuid guid, SqlQueryHolder* holder)
{ {
m_taxi.ClearTaxiDestinations(); m_taxi.ClearTaxiDestinations();
for (int i = 0; i < 2; ++i) for (int i = 0; i < 2; ++i)
{
m_taxi.AddTaxiDestination(m_bgData.taxiPath[i]); m_taxi.AddTaxiDestination(m_bgData.taxiPath[i]);
} }
}
else if (!m_taxi.LoadTaxiDestinationsFromString(taxi_nodes, GetTeam())) else if (!m_taxi.LoadTaxiDestinationsFromString(taxi_nodes, GetTeam()))
{ {
// problems with taxi path loading // problems with taxi path loading
@ -17088,7 +17178,9 @@ bool Player::isAllowedToLoot(Creature* creature)
void Player::_LoadActions(QueryResult* result) void Player::_LoadActions(QueryResult* result)
{ {
for (int i = 0; i < MAX_TALENT_SPEC_COUNT; ++i) for (int i = 0; i < MAX_TALENT_SPEC_COUNT; ++i)
{
m_actionButtons[i].clear(); m_actionButtons[i].clear();
}
// QueryResult *result = CharacterDatabase.PQuery("SELECT spec, button,action,type FROM character_action WHERE guid = '%u' ORDER BY button",GetGUIDLow()); // QueryResult *result = CharacterDatabase.PQuery("SELECT spec, button,action,type FROM character_action WHERE guid = '%u' ORDER BY button",GetGUIDLow());
@ -17704,13 +17796,17 @@ void Player::_LoadQuestStatus(QueryResult* result)
// clear quest log tail // clear quest log tail
for (uint16 i = slot; i < MAX_QUEST_LOG_SIZE; ++i) for (uint16 i = slot; i < MAX_QUEST_LOG_SIZE; ++i)
{
SetQuestSlot(i, 0); SetQuestSlot(i, 0);
} }
}
void Player::_LoadDailyQuestStatus(QueryResult* result) void Player::_LoadDailyQuestStatus(QueryResult* result)
{ {
for (uint32 quest_daily_idx = 0; quest_daily_idx < PLAYER_MAX_DAILY_QUESTS; ++quest_daily_idx) for (uint32 quest_daily_idx = 0; quest_daily_idx < PLAYER_MAX_DAILY_QUESTS; ++quest_daily_idx)
{
SetUInt32Value(PLAYER_FIELD_DAILY_QUESTS_1 + quest_daily_idx, 0); SetUInt32Value(PLAYER_FIELD_DAILY_QUESTS_1 + quest_daily_idx, 0);
}
// QueryResult *result = CharacterDatabase.PQuery("SELECT quest FROM character_queststatus_daily WHERE guid = '%u'", GetGUIDLow()); // QueryResult *result = CharacterDatabase.PQuery("SELECT quest FROM character_queststatus_daily WHERE guid = '%u'", GetGUIDLow());
@ -17938,7 +18034,9 @@ void Player::_LoadGroup(QueryResult* result)
void Player::_LoadBoundInstances(QueryResult* result) void Player::_LoadBoundInstances(QueryResult* result)
{ {
for (uint8 i = 0; i < MAX_DIFFICULTY; ++i) for (uint8 i = 0; i < MAX_DIFFICULTY; ++i)
{
m_boundInstances[i].clear(); m_boundInstances[i].clear();
}
Group* group = GetGroup(); Group* group = GetGroup();
@ -18399,7 +18497,9 @@ void Player::SaveToDB()
uberInsert.addUInt64(uint64(m_resetTalentsTime)); uberInsert.addUInt64(uint64(m_resetTalentsTime));
ss.str(""); ss.str("");
for (int i = 0; i < MAX_TALENT_SPEC_COUNT; ++i) for (int i = 0; i < MAX_TALENT_SPEC_COUNT; ++i)
{
ss << m_talentsPrimaryTree[i] << " "; ss << m_talentsPrimaryTree[i] << " ";
}
uberInsert.addString(ss); uberInsert.addString(ss);
uberInsert.addFloat(finiteAlways(m_movementInfo.GetTransportPos()->x)); uberInsert.addFloat(finiteAlways(m_movementInfo.GetTransportPos()->x));
@ -18440,7 +18540,9 @@ void Player::SaveToDB()
uberInsert.addUInt32(GetHealth()); uberInsert.addUInt32(GetHealth());
for (uint32 i = 0; i < MAX_STORED_POWERS; ++i) for (uint32 i = 0; i < MAX_STORED_POWERS; ++i)
{
uberInsert.addUInt32(GetPowerByIndex(i)); uberInsert.addUInt32(GetPowerByIndex(i));
}
uberInsert.addUInt32(uint32(m_specsCount)); uberInsert.addUInt32(uint32(m_specsCount));
uberInsert.addUInt32(uint32(m_activeSpec)); uberInsert.addUInt32(uint32(m_activeSpec));
@ -18635,10 +18737,14 @@ void Player::_SaveAuras()
stmt.addUInt8(holder->GetAuraCharges()); stmt.addUInt8(holder->GetAuraCharges());
for (uint32 i = 0; i < MAX_EFFECT_INDEX; ++i) for (uint32 i = 0; i < MAX_EFFECT_INDEX; ++i)
{
stmt.addInt32(damage[i]); stmt.addInt32(damage[i]);
}
for (uint32 i = 0; i < MAX_EFFECT_INDEX; ++i) for (uint32 i = 0; i < MAX_EFFECT_INDEX; ++i)
{
stmt.addUInt32(periodicTime[i]); stmt.addUInt32(periodicTime[i]);
}
stmt.addInt32(holder->GetAuraMaxDuration()); stmt.addInt32(holder->GetAuraMaxDuration());
stmt.addInt32(holder->GetAuraDuration()); stmt.addInt32(holder->GetAuraDuration());
@ -18823,7 +18929,9 @@ void Player::_SaveMail()
stmt = CharacterDatabase.CreateStatement(deleteMailItems, "DELETE FROM mail_items WHERE item_guid = ?"); stmt = CharacterDatabase.CreateStatement(deleteMailItems, "DELETE FROM mail_items WHERE item_guid = ?");
for (std::vector<uint32>::const_iterator itr2 = m->removedItems.begin(); itr2 != m->removedItems.end(); ++itr2) for (std::vector<uint32>::const_iterator itr2 = m->removedItems.begin(); itr2 != m->removedItems.end(); ++itr2)
{
stmt.PExecute(*itr2); stmt.PExecute(*itr2);
}
m->removedItems.clear(); m->removedItems.clear();
} }
@ -18835,8 +18943,10 @@ void Player::_SaveMail()
{ {
SqlStatement stmt = CharacterDatabase.CreateStatement(deleteItem, "DELETE FROM item_instance WHERE guid = ?"); SqlStatement stmt = CharacterDatabase.CreateStatement(deleteItem, "DELETE FROM item_instance WHERE guid = ?");
for (MailItemInfoVec::const_iterator itr2 = m->items.begin(); itr2 != m->items.end(); ++itr2) for (MailItemInfoVec::const_iterator itr2 = m->items.begin(); itr2 != m->items.end(); ++itr2)
{
stmt.PExecute(itr2->item_guid); stmt.PExecute(itr2->item_guid);
} }
}
SqlStatement stmt = CharacterDatabase.CreateStatement(deleteMain, "DELETE FROM mail WHERE id = ?"); SqlStatement stmt = CharacterDatabase.CreateStatement(deleteMain, "DELETE FROM mail WHERE id = ?");
stmt.PExecute(m->messageID); stmt.PExecute(m->messageID);
@ -18886,9 +18996,13 @@ void Player::_SaveQuestStatus()
stmt.addUInt8(i->second.m_explored); stmt.addUInt8(i->second.m_explored);
stmt.addUInt64(uint64(i->second.m_timer / IN_MILLISECONDS + sWorld.GetGameTime())); stmt.addUInt64(uint64(i->second.m_timer / IN_MILLISECONDS + sWorld.GetGameTime()));
for (int k = 0; k < QUEST_OBJECTIVES_COUNT; ++k) for (int k = 0; k < QUEST_OBJECTIVES_COUNT; ++k)
{
stmt.addUInt32(i->second.m_creatureOrGOcount[k]); stmt.addUInt32(i->second.m_creatureOrGOcount[k]);
}
for (int k = 0; k < QUEST_ITEM_OBJECTIVES_COUNT; ++k) for (int k = 0; k < QUEST_ITEM_OBJECTIVES_COUNT; ++k)
{
stmt.addUInt32(i->second.m_itemcount[k]); stmt.addUInt32(i->second.m_itemcount[k]);
}
stmt.Execute(); stmt.Execute();
} }
break; break;
@ -18902,9 +19016,13 @@ void Player::_SaveQuestStatus()
stmt.addUInt8(i->second.m_explored); stmt.addUInt8(i->second.m_explored);
stmt.addUInt64(uint64(i->second.m_timer / IN_MILLISECONDS + sWorld.GetGameTime())); stmt.addUInt64(uint64(i->second.m_timer / IN_MILLISECONDS + sWorld.GetGameTime()));
for (int k = 0; k < QUEST_OBJECTIVES_COUNT; ++k) for (int k = 0; k < QUEST_OBJECTIVES_COUNT; ++k)
{
stmt.addUInt32(i->second.m_creatureOrGOcount[k]); stmt.addUInt32(i->second.m_creatureOrGOcount[k]);
}
for (int k = 0; k < QUEST_ITEM_OBJECTIVES_COUNT; ++k) for (int k = 0; k < QUEST_ITEM_OBJECTIVES_COUNT; ++k)
{
stmt.addUInt32(i->second.m_itemcount[k]); stmt.addUInt32(i->second.m_itemcount[k]);
}
stmt.addUInt32(GetGUIDLow()); stmt.addUInt32(GetGUIDLow());
stmt.addUInt32(i->first); stmt.addUInt32(i->first);
stmt.Execute(); stmt.Execute();
@ -19130,7 +19248,9 @@ void Player::_SaveStats()
stmt.addUInt32(GetGUIDLow()); stmt.addUInt32(GetGUIDLow());
stmt.addUInt32(GetMaxHealth()); stmt.addUInt32(GetMaxHealth());
for (uint32 i = 0; i < MAX_STORED_POWERS; ++i) for (uint32 i = 0; i < MAX_STORED_POWERS; ++i)
{
stmt.addUInt32(GetMaxPowerByIndex(i)); stmt.addUInt32(GetMaxPowerByIndex(i));
}
for (int i = 0; i < MAX_STATS; ++i) for (int i = 0; i < MAX_STATS; ++i)
{ stmt.addFloat(GetStat(Stats(i))); } { stmt.addFloat(GetStat(Stats(i))); }
// armor + school resistances // armor + school resistances
@ -21888,7 +22008,9 @@ void Player::SendAurasForTarget(Unit* target)
data << target->GetPackGUID(); data << target->GetPackGUID();
for (Unit::VisibleAuraMap::const_iterator itr = visibleAuras.begin(); itr != visibleAuras.end(); ++itr) for (Unit::VisibleAuraMap::const_iterator itr = visibleAuras.begin(); itr != visibleAuras.end(); ++itr)
{
itr->second->BuildUpdatePacket(data); itr->second->BuildUpdatePacket(data);
}
GetSession()->SendPacket(&data); GetSession()->SendPacket(&data);
} }
@ -21921,7 +22043,9 @@ void Player::SetMonthlyQuestStatus(uint32 quest_id)
void Player::ResetDailyQuestStatus() void Player::ResetDailyQuestStatus()
{ {
for (uint32 quest_daily_idx = 0; quest_daily_idx < PLAYER_MAX_DAILY_QUESTS; ++quest_daily_idx) for (uint32 quest_daily_idx = 0; quest_daily_idx < PLAYER_MAX_DAILY_QUESTS; ++quest_daily_idx)
{
SetUInt32Value(PLAYER_FIELD_DAILY_QUESTS_1 + quest_daily_idx, 0); SetUInt32Value(PLAYER_FIELD_DAILY_QUESTS_1 + quest_daily_idx, 0);
}
// DB data deleted in caller // DB data deleted in caller
m_DailyQuestChanged = false; m_DailyQuestChanged = false;
@ -22576,8 +22700,10 @@ void Player::UpdateZoneDependentAuras()
// Some spells applied at enter into zone (with subzones), aura removed in UpdateAreaDependentAuras that called always at zone->area update // Some spells applied at enter into zone (with subzones), aura removed in UpdateAreaDependentAuras that called always at zone->area update
SpellAreaForAreaMapBounds saBounds = sSpellMgr.GetSpellAreaForAreaMapBounds(m_zoneUpdateId); SpellAreaForAreaMapBounds saBounds = sSpellMgr.GetSpellAreaForAreaMapBounds(m_zoneUpdateId);
for (SpellAreaForAreaMap::const_iterator itr = saBounds.first; itr != saBounds.second; ++itr) for (SpellAreaForAreaMap::const_iterator itr = saBounds.first; itr != saBounds.second; ++itr)
{
itr->second->ApplyOrRemoveSpellIfCan(this, m_zoneUpdateId, 0, true); itr->second->ApplyOrRemoveSpellIfCan(this, m_zoneUpdateId, 0, true);
} }
}
void Player::UpdateAreaDependentAuras() void Player::UpdateAreaDependentAuras()
{ {
@ -22597,8 +22723,10 @@ void Player::UpdateAreaDependentAuras()
// some auras applied at subzone enter // some auras applied at subzone enter
SpellAreaForAreaMapBounds saBounds = sSpellMgr.GetSpellAreaForAreaMapBounds(m_areaUpdateId); SpellAreaForAreaMapBounds saBounds = sSpellMgr.GetSpellAreaForAreaMapBounds(m_areaUpdateId);
for (SpellAreaForAreaMap::const_iterator itr = saBounds.first; itr != saBounds.second; ++itr) for (SpellAreaForAreaMap::const_iterator itr = saBounds.first; itr != saBounds.second; ++itr)
{
itr->second->ApplyOrRemoveSpellIfCan(this, m_zoneUpdateId, m_areaUpdateId, true); itr->second->ApplyOrRemoveSpellIfCan(this, m_zoneUpdateId, m_areaUpdateId, true);
} }
}
struct UpdateZoneDependentPetsHelper struct UpdateZoneDependentPetsHelper
{ {
@ -23069,8 +23197,10 @@ void Player::ApplyGlyph(uint8 slot, bool apply)
void Player::ApplyGlyphs(bool apply) void Player::ApplyGlyphs(bool apply)
{ {
for (uint8 i = 0; i < MAX_GLYPH_SLOT_INDEX; ++i) for (uint8 i = 0; i < MAX_GLYPH_SLOT_INDEX; ++i)
{
ApplyGlyph(i, apply); ApplyGlyph(i, apply);
} }
}
bool Player::isTotalImmune() bool Player::isTotalImmune()
{ {
@ -23189,8 +23319,10 @@ void Player::UpdateRuneRegen(RuneType rune)
void Player::UpdateRuneRegen() void Player::UpdateRuneRegen()
{ {
for (uint8 i = 0; i < NUM_RUNE_TYPES; ++i) for (uint8 i = 0; i < NUM_RUNE_TYPES; ++i)
{
UpdateRuneRegen(RuneType(i)); UpdateRuneRegen(RuneType(i));
} }
}
uint8 Player::GetRuneCooldownFraction(uint8 index) const uint8 Player::GetRuneCooldownFraction(uint8 index) const
{ {
@ -23326,8 +23458,10 @@ void Player::InitRunes()
} }
for (uint32 i = 0; i < NUM_RUNE_TYPES; ++i) for (uint32 i = 0; i < NUM_RUNE_TYPES; ++i)
{
SetFloatValue(PLAYER_RUNE_REGEN_1 + i, 0.1f); SetFloatValue(PLAYER_RUNE_REGEN_1 + i, 0.1f);
} }
}
bool Player::IsBaseRuneSlotsOnCooldown(RuneType runeType) const bool Player::IsBaseRuneSlotsOnCooldown(RuneType runeType) const
{ {
@ -23961,11 +24095,15 @@ bool Player::LearnTalent(uint32 talentId, uint32 talentRank)
m_talentsPrimaryTree[m_activeSpec] = talentInfo->TalentTab; m_talentsPrimaryTree[m_activeSpec] = talentInfo->TalentTab;
if (std::vector<uint32> const* specSpells = GetTalentTreeMasterySpells(talentInfo->TalentTab)) if (std::vector<uint32> const* specSpells = GetTalentTreeMasterySpells(talentInfo->TalentTab))
for (size_t i = 0; i < specSpells->size(); ++i) for (size_t i = 0; i < specSpells->size(); ++i)
{
learnSpell(specSpells->at(i), false); learnSpell(specSpells->at(i), false);
}
if (std::vector<uint32> const* specSpells = GetTalentTreePrimarySpells(talentInfo->TalentTab)) if (std::vector<uint32> const* specSpells = GetTalentTreePrimarySpells(talentInfo->TalentTab))
for (size_t i = 0; i < specSpells->size(); ++i) for (size_t i = 0; i < specSpells->size(); ++i)
{
learnSpell(specSpells->at(i), false); learnSpell(specSpells->at(i), false);
}
// Update talent tree role-dependent mana regen // Update talent tree role-dependent mana regen
UpdateManaRegen(); UpdateManaRegen();
@ -24261,10 +24399,12 @@ void Player::BuildPlayerTalentsInfoData(WorldPacket* data)
// GlyphProperties.dbc // GlyphProperties.dbc
for (uint8 i = 0; i < MAX_GLYPH_SLOT_INDEX; ++i) for (uint8 i = 0; i < MAX_GLYPH_SLOT_INDEX; ++i)
{
*data << uint16(m_glyphs[specIdx][i].GetId()); *data << uint16(m_glyphs[specIdx][i].GetId());
} }
} }
} }
}
void Player::BuildPetTalentsInfoData(WorldPacket* data) void Player::BuildPetTalentsInfoData(WorldPacket* data)
{ {
@ -24494,7 +24634,9 @@ void Player::_SaveEquipmentSets()
stmt.addUInt32(eqset.IgnoreMask); stmt.addUInt32(eqset.IgnoreMask);
for (int i = 0; i < EQUIPMENT_SLOT_END; ++i) for (int i = 0; i < EQUIPMENT_SLOT_END; ++i)
{
stmt.addUInt32(eqset.Items[i]); stmt.addUInt32(eqset.Items[i]);
}
stmt.addUInt32(GetGUIDLow()); stmt.addUInt32(GetGUIDLow());
stmt.addUInt64(eqset.Guid); stmt.addUInt64(eqset.Guid);
@ -24517,7 +24659,9 @@ void Player::_SaveEquipmentSets()
stmt.addUInt32(eqset.IgnoreMask); stmt.addUInt32(eqset.IgnoreMask);
for (int i = 0; i < EQUIPMENT_SLOT_END; ++i) for (int i = 0; i < EQUIPMENT_SLOT_END; ++i)
{
stmt.addUInt32(eqset.Items[i]); stmt.addUInt32(eqset.Items[i]);
}
stmt.Execute(); stmt.Execute();
@ -24610,12 +24754,16 @@ void Player::ActivateSpec(uint8 specNum)
{ {
if (std::vector<uint32> const* specSpells = GetTalentTreeMasterySpells(GetTalentTabPages(getClass())[i])) if (std::vector<uint32> const* specSpells = GetTalentTreeMasterySpells(GetTalentTabPages(getClass())[i]))
for (size_t i = 0; i < specSpells->size(); ++i) for (size_t i = 0; i < specSpells->size(); ++i)
{
removeSpell(specSpells->at(i), true); removeSpell(specSpells->at(i), true);
}
if (std::vector<uint32> const* specSpells = GetTalentTreePrimarySpells(GetTalentTabPages(getClass())[i])) if (std::vector<uint32> const* specSpells = GetTalentTreePrimarySpells(GetTalentTabPages(getClass())[i]))
for (size_t i = 0; i < specSpells->size(); ++i) for (size_t i = 0; i < specSpells->size(); ++i)
{
removeSpell(specSpells->at(i), true); removeSpell(specSpells->at(i), true);
} }
}
ApplyGlyphs(false); ApplyGlyphs(false);
@ -24721,11 +24869,15 @@ void Player::ActivateSpec(uint8 specNum)
if (std::vector<uint32> const* specSpells = GetTalentTreeMasterySpells(m_talentsPrimaryTree[m_activeSpec])) if (std::vector<uint32> const* specSpells = GetTalentTreeMasterySpells(m_talentsPrimaryTree[m_activeSpec]))
for (size_t i = 0; i < specSpells->size(); ++i) for (size_t i = 0; i < specSpells->size(); ++i)
{
learnSpell(specSpells->at(i), false); learnSpell(specSpells->at(i), false);
}
if (std::vector<uint32> const* specSpells = GetTalentTreePrimarySpells(m_talentsPrimaryTree[m_activeSpec])) if (std::vector<uint32> const* specSpells = GetTalentTreePrimarySpells(m_talentsPrimaryTree[m_activeSpec]))
for (size_t i = 0; i < specSpells->size(); ++i) for (size_t i = 0; i < specSpells->size(); ++i)
{
learnSpell(specSpells->at(i), false); learnSpell(specSpells->at(i), false);
}
ApplyGlyphs(true); ApplyGlyphs(true);
@ -24769,10 +24921,12 @@ void Player::UpdateSpecCount(uint8 count)
if (itr->second.uState != ACTIONBUTTON_DELETED) if (itr->second.uState != ACTIONBUTTON_DELETED)
{ {
for (uint8 spec = curCount; spec < count; ++spec) for (uint8 spec = curCount; spec < count; ++spec)
{
addActionButton(spec, itr->first, itr->second.GetAction(), itr->second.GetType()); addActionButton(spec, itr->first, itr->second.GetAction(), itr->second.GetType());
} }
} }
} }
}
// delete spec data for removed specs // delete spec data for removed specs
else if (count < curCount) else if (count < curCount)
{ {
@ -24781,9 +24935,11 @@ void Player::UpdateSpecCount(uint8 count)
{ {
// delete action buttons for removed spec // delete action buttons for removed spec
for (uint8 button = 0; button < MAX_ACTION_BUTTONS; ++button) for (uint8 button = 0; button < MAX_ACTION_BUTTONS; ++button)
{
removeActionButton(spec, button); removeActionButton(spec, button);
} }
} }
}
SetSpecsCount(count); SetSpecsCount(count);
@ -25485,7 +25641,9 @@ void Player::SendRatedBGStats()
WorldPacket data(SMSG_RATED_BG_STATS, 18 * 4); WorldPacket data(SMSG_RATED_BG_STATS, 18 * 4);
for (int i = 0; i < 18; ++i) for (int i = 0; i < 18; ++i)
{
data << uint32(0); data << uint32(0);
}
SendDirectMessage(&data); SendDirectMessage(&data);
} }

View file

@ -708,8 +708,10 @@ struct EquipmentSet
EquipmentSet() : Guid(0), IgnoreMask(0), state(EQUIPMENT_SET_NEW) EquipmentSet() : Guid(0), IgnoreMask(0), state(EQUIPMENT_SET_NEW)
{ {
for (int i = 0; i < EQUIPMENT_SLOT_END; ++i) for (int i = 0; i < EQUIPMENT_SLOT_END; ++i)
{
Items[i] = 0; Items[i] = 0;
} }
}
uint64 Guid; uint64 Guid;
std::string Name; std::string Name;

View file

@ -302,7 +302,9 @@ uint32 GetSpellCastTimeForBonus(SpellEntry const* spellProto, DamageEffectType d
// -5% of total per any additional effect (multiplicative) // -5% of total per any additional effect (multiplicative)
for (int i = 0; i < effects; ++i) for (int i = 0; i < effects; ++i)
{
CastingTime *= 0.95f; CastingTime *= 0.95f;
}
return CastingTime; return CastingTime;
} }
@ -4120,7 +4122,9 @@ void SpellMgr::LoadPetDefaultSpells()
int32 petSpellsId = -(int32)cInfo->PetSpellDataId; int32 petSpellsId = -(int32)cInfo->PetSpellDataId;
PetDefaultSpellsEntry petDefSpells; PetDefaultSpellsEntry petDefSpells;
for (int j = 0; j < MAX_CREATURE_SPELL_DATA_SLOT; ++j) for (int j = 0; j < MAX_CREATURE_SPELL_DATA_SLOT; ++j)
{
petDefSpells.spellid[j] = spellDataEntry->spellId[j]; petDefSpells.spellid[j] = spellDataEntry->spellId[j];
}
if (LoadPetDefaultSpells_helper(cInfo, petDefSpells)) if (LoadPetDefaultSpells_helper(cInfo, petDefSpells))
{ {
@ -4161,7 +4165,9 @@ void SpellMgr::LoadPetDefaultSpells()
PetDefaultSpellsEntry petDefSpells; PetDefaultSpellsEntry petDefSpells;
if (CreatureTemplateSpells const* templateSpells = sCreatureTemplateSpellsStorage.LookupEntry<CreatureTemplateSpells>(cInfo->Entry)) if (CreatureTemplateSpells const* templateSpells = sCreatureTemplateSpellsStorage.LookupEntry<CreatureTemplateSpells>(cInfo->Entry))
for (int j = 0; j < MAX_CREATURE_SPELL_DATA_SLOT; ++j) for (int j = 0; j < MAX_CREATURE_SPELL_DATA_SLOT; ++j)
{
petDefSpells.spellid[j] = templateSpells->spells[j]; petDefSpells.spellid[j] = templateSpells->spells[j];
}
if (LoadPetDefaultSpells_helper(cInfo, petDefSpells)) if (LoadPetDefaultSpells_helper(cInfo, petDefSpells))
{ {

View file

@ -107,8 +107,10 @@ void Player::ApplySpellPowerBonus(int32 amount, bool apply)
// For speed just update for client // For speed just update for client
ApplyModUInt32Value(PLAYER_FIELD_MOD_HEALING_DONE_POS, amount, apply); ApplyModUInt32Value(PLAYER_FIELD_MOD_HEALING_DONE_POS, amount, apply);
for (int i = SPELL_SCHOOL_HOLY; i < MAX_SPELL_SCHOOL; ++i) for (int i = SPELL_SCHOOL_HOLY; i < MAX_SPELL_SCHOOL; ++i)
{
ApplyModUInt32Value(PLAYER_FIELD_MOD_DAMAGE_DONE_POS + i, amount, apply);; ApplyModUInt32Value(PLAYER_FIELD_MOD_DAMAGE_DONE_POS + i, amount, apply);;
} }
}
void Player::UpdateSpellDamageAndHealingBonus() void Player::UpdateSpellDamageAndHealingBonus()
{ {
@ -118,7 +120,9 @@ void Player::UpdateSpellDamageAndHealingBonus()
SetStatInt32Value(PLAYER_FIELD_MOD_HEALING_DONE_POS, SpellBaseHealingBonusDone(SPELL_SCHOOL_MASK_ALL)); SetStatInt32Value(PLAYER_FIELD_MOD_HEALING_DONE_POS, SpellBaseHealingBonusDone(SPELL_SCHOOL_MASK_ALL));
// Get damage bonus for all schools // Get damage bonus for all schools
for (int i = SPELL_SCHOOL_HOLY; i < MAX_SPELL_SCHOOL; ++i) for (int i = SPELL_SCHOOL_HOLY; i < MAX_SPELL_SCHOOL; ++i)
{
SetStatInt32Value(PLAYER_FIELD_MOD_DAMAGE_DONE_POS + i, SpellBaseDamageBonusDone(SpellSchoolMask(1 << i))); SetStatInt32Value(PLAYER_FIELD_MOD_DAMAGE_DONE_POS + i, SpellBaseDamageBonusDone(SpellSchoolMask(1 << i)));
}
SetStatFloatValue(PLAYER_FIELD_OVERRIDE_SPELL_POWER_BY_AP_PCT, GetTotalAuraModifier(SPELL_AURA_OVERRIDE_SPELL_POWER_BY_AP_PCT)); SetStatFloatValue(PLAYER_FIELD_OVERRIDE_SPELL_POWER_BY_AP_PCT, GetTotalAuraModifier(SPELL_AURA_OVERRIDE_SPELL_POWER_BY_AP_PCT));
} }

View file

@ -4402,7 +4402,9 @@ int32 Unit::GetTotalAuraModifier(AuraType auratype) const
AuraList const& mTotalAuraList = GetAurasByType(auratype); AuraList const& mTotalAuraList = GetAurasByType(auratype);
for (AuraList::const_iterator i = mTotalAuraList.begin(); i != mTotalAuraList.end(); ++i) for (AuraList::const_iterator i = mTotalAuraList.begin(); i != mTotalAuraList.end(); ++i)
{
modifier += (*i)->GetModifier()->m_amount; modifier += (*i)->GetModifier()->m_amount;
}
return modifier; return modifier;
} }
@ -4413,7 +4415,9 @@ float Unit::GetTotalAuraMultiplier(AuraType auratype) const
AuraList const& mTotalAuraList = GetAurasByType(auratype); AuraList const& mTotalAuraList = GetAurasByType(auratype);
for (AuraList::const_iterator i = mTotalAuraList.begin(); i != mTotalAuraList.end(); ++i) for (AuraList::const_iterator i = mTotalAuraList.begin(); i != mTotalAuraList.end(); ++i)
{
multiplier *= (100.0f + (*i)->GetModifier()->m_amount) / 100.0f; multiplier *= (100.0f + (*i)->GetModifier()->m_amount) / 100.0f;
}
return multiplier; return multiplier;
} }
@ -8059,7 +8063,9 @@ uint32 Unit::SpellHealingBonusDone(Unit* pVictim, SpellEntry const* spellProto,
// Healing done percent // Healing done percent
AuraList const& mHealingDonePct = GetAurasByType(SPELL_AURA_MOD_HEALING_DONE_PERCENT); AuraList const& mHealingDonePct = GetAurasByType(SPELL_AURA_MOD_HEALING_DONE_PERCENT);
for (AuraList::const_iterator i = mHealingDonePct.begin(); i != mHealingDonePct.end(); ++i) for (AuraList::const_iterator i = mHealingDonePct.begin(); i != mHealingDonePct.end(); ++i)
{
DoneTotalMod *= (100.0f + (*i)->GetModifier()->m_amount) / 100.0f; DoneTotalMod *= (100.0f + (*i)->GetModifier()->m_amount) / 100.0f;
}
AuraList const& mHealingFromHealthPct = GetAurasByType(SPELL_AURA_MOD_HEALING_DONE_FROM_PCT_HEALTH); AuraList const& mHealingFromHealthPct = GetAurasByType(SPELL_AURA_MOD_HEALING_DONE_FROM_PCT_HEALTH);
if (!mHealingFromHealthPct.empty()) if (!mHealingFromHealthPct.empty())
@ -11348,29 +11354,39 @@ CharmInfo::CharmInfo(Unit* unit)
: m_unit(unit), m_CommandState(COMMAND_FOLLOW), m_reactState(REACT_PASSIVE), m_petnumber(0) : m_unit(unit), m_CommandState(COMMAND_FOLLOW), m_reactState(REACT_PASSIVE), m_petnumber(0)
{ {
for (int i = 0; i < CREATURE_MAX_SPELLS; ++i) for (int i = 0; i < CREATURE_MAX_SPELLS; ++i)
{
m_charmspells[i].SetActionAndType(0, ACT_DISABLED); m_charmspells[i].SetActionAndType(0, ACT_DISABLED);
} }
}
void CharmInfo::InitPetActionBar() void CharmInfo::InitPetActionBar()
{ {
// the first 3 SpellOrActions are attack, follow and stay // the first 3 SpellOrActions are attack, follow and stay
for (uint32 i = 0; i < ACTION_BAR_INDEX_PET_SPELL_START - ACTION_BAR_INDEX_START; ++i) for (uint32 i = 0; i < ACTION_BAR_INDEX_PET_SPELL_START - ACTION_BAR_INDEX_START; ++i)
{
SetActionBar(ACTION_BAR_INDEX_START + i, COMMAND_ATTACK - i, ACT_COMMAND); SetActionBar(ACTION_BAR_INDEX_START + i, COMMAND_ATTACK - i, ACT_COMMAND);
}
// middle 4 SpellOrActions are spells/special attacks/abilities // middle 4 SpellOrActions are spells/special attacks/abilities
for (uint32 i = 0; i < ACTION_BAR_INDEX_PET_SPELL_END - ACTION_BAR_INDEX_PET_SPELL_START; ++i) for (uint32 i = 0; i < ACTION_BAR_INDEX_PET_SPELL_END - ACTION_BAR_INDEX_PET_SPELL_START; ++i)
{
SetActionBar(ACTION_BAR_INDEX_PET_SPELL_START + i, 0, ACT_DISABLED); SetActionBar(ACTION_BAR_INDEX_PET_SPELL_START + i, 0, ACT_DISABLED);
}
// last 3 SpellOrActions are reactions // last 3 SpellOrActions are reactions
for (uint32 i = 0; i < ACTION_BAR_INDEX_END - ACTION_BAR_INDEX_PET_SPELL_END; ++i) for (uint32 i = 0; i < ACTION_BAR_INDEX_END - ACTION_BAR_INDEX_PET_SPELL_END; ++i)
{
SetActionBar(ACTION_BAR_INDEX_PET_SPELL_END + i, COMMAND_ATTACK - i, ACT_REACTION); SetActionBar(ACTION_BAR_INDEX_PET_SPELL_END + i, COMMAND_ATTACK - i, ACT_REACTION);
} }
}
void CharmInfo::InitEmptyActionBar() void CharmInfo::InitEmptyActionBar()
{ {
for (uint32 x = ACTION_BAR_INDEX_START; x < ACTION_BAR_INDEX_END; ++x) for (uint32 x = ACTION_BAR_INDEX_START; x < ACTION_BAR_INDEX_END; ++x)
{
SetActionBar(x, 0, ACT_PASSIVE); SetActionBar(x, 0, ACT_PASSIVE);
} }
}
void CharmInfo::InitVehicleCreateSpells() void CharmInfo::InitVehicleCreateSpells()
{ {
@ -11560,8 +11576,10 @@ void CharmInfo::LoadPetActionBar(const std::string& data)
void CharmInfo::BuildActionBar(WorldPacket* data) void CharmInfo::BuildActionBar(WorldPacket* data)
{ {
for (uint32 i = 0; i < MAX_UNIT_ACTION_BAR_INDEX; ++i) for (uint32 i = 0; i < MAX_UNIT_ACTION_BAR_INDEX; ++i)
{
*data << uint32(PetActionBar[i].packedData); *data << uint32(PetActionBar[i].packedData);
} }
}
void CharmInfo::SetSpellAutocast(uint32 spell_id, bool state) void CharmInfo::SetSpellAutocast(uint32 spell_id, bool state)
{ {
@ -11810,9 +11828,11 @@ void Unit::ProcDamageAndSpellFor(bool isVictim, Unit* pTarget, uint32 procFlag,
removedSpells.unique(); removedSpells.unique();
// Remove auras from removedAuras // Remove auras from removedAuras
for (RemoveSpellList::const_iterator i = removedSpells.begin(); i != removedSpells.end(); ++i) for (RemoveSpellList::const_iterator i = removedSpells.begin(); i != removedSpells.end(); ++i)
{
RemoveAurasDueToSpell(*i); RemoveAurasDueToSpell(*i);
} }
} }
}
SpellSchoolMask Unit::GetMeleeDamageSchoolMask() const SpellSchoolMask Unit::GetMeleeDamageSchoolMask() const
{ {
@ -12134,7 +12154,9 @@ void Unit::ClearComboPointHolders()
void Unit::ClearAllReactives() void Unit::ClearAllReactives()
{ {
for (int i = 0; i < MAX_REACTIVE; ++i) for (int i = 0; i < MAX_REACTIVE; ++i)
{
m_reactiveTimer[i] = 0; m_reactiveTimer[i] = 0;
}
if (HasAuraState(AURA_STATE_DEFENSE)) if (HasAuraState(AURA_STATE_DEFENSE))
ModifyAuraState(AURA_STATE_DEFENSE, false); ModifyAuraState(AURA_STATE_DEFENSE, false);
@ -12218,7 +12240,9 @@ Unit* Unit::SelectRandomUnfriendlyTarget(Unit* except /*= NULL*/, float radius /
uint32 rIdx = urand(0, targets.size() - 1); uint32 rIdx = urand(0, targets.size() - 1);
std::list<Unit*>::const_iterator tcIter = targets.begin(); std::list<Unit*>::const_iterator tcIter = targets.begin();
for (uint32 i = 0; i < rIdx; ++i) for (uint32 i = 0; i < rIdx; ++i)
{
++tcIter; ++tcIter;
}
return *tcIter; return *tcIter;
} }
@ -12259,7 +12283,9 @@ Unit* Unit::SelectRandomFriendlyTarget(Unit* except /*= NULL*/, float radius /*=
uint32 rIdx = urand(0, targets.size() - 1); uint32 rIdx = urand(0, targets.size() - 1);
std::list<Unit*>::const_iterator tcIter = targets.begin(); std::list<Unit*>::const_iterator tcIter = targets.begin();
for (uint32 i = 0; i < rIdx; ++i) for (uint32 i = 0; i < rIdx; ++i)
{
++tcIter; ++tcIter;
}
return *tcIter; return *tcIter;
} }
@ -12722,12 +12748,16 @@ bool Unit::IsIgnoreUnitState(SpellEntry const* spell, IgnoreUnitState ignoreStat
void Unit::CleanupDeletedAuras() void Unit::CleanupDeletedAuras()
{ {
for (SpellAuraHolderList::const_iterator iter = m_deletedHolders.begin(); iter != m_deletedHolders.end(); ++iter) for (SpellAuraHolderList::const_iterator iter = m_deletedHolders.begin(); iter != m_deletedHolders.end(); ++iter)
{
delete *iter; delete *iter;
}
m_deletedHolders.clear(); m_deletedHolders.clear();
// really delete auras "deleted" while processing its ApplyModify code // really delete auras "deleted" while processing its ApplyModify code
for (AuraList::const_iterator itr = m_deletedAuras.begin(); itr != m_deletedAuras.end(); ++itr) for (AuraList::const_iterator itr = m_deletedAuras.begin(); itr != m_deletedAuras.end(); ++itr)
{
delete *itr; delete *itr;
}
m_deletedAuras.clear(); m_deletedAuras.clear();
} }

View file

@ -88,15 +88,19 @@ class UpdateMask
{ {
MANGOS_ASSERT(mask.mCount <= mCount); MANGOS_ASSERT(mask.mCount <= mCount);
for (uint32 i = 0; i < mBlocks; ++i) for (uint32 i = 0; i < mBlocks; ++i)
{
mUpdateMask[i] &= mask.mUpdateMask[i]; mUpdateMask[i] &= mask.mUpdateMask[i];
} }
}
void operator |= (const UpdateMask& mask) void operator |= (const UpdateMask& mask)
{ {
MANGOS_ASSERT(mask.mCount <= mCount); MANGOS_ASSERT(mask.mCount <= mCount);
for (uint32 i = 0; i < mBlocks; ++i) for (uint32 i = 0; i < mBlocks; ++i)
{
mUpdateMask[i] |= mask.mUpdateMask[i]; mUpdateMask[i] |= mask.mUpdateMask[i];
} }
}
UpdateMask operator & (const UpdateMask& mask) const UpdateMask operator & (const UpdateMask& mask) const
{ {

View file

@ -527,7 +527,9 @@ uint8 VehicleInfo::GetTakenSeatsMask() const
uint8 takenSeatsMask = 0; uint8 takenSeatsMask = 0;
for (PassengerMap::const_iterator itr = m_passengers.begin(); itr != m_passengers.end(); ++itr) for (PassengerMap::const_iterator itr = m_passengers.begin(); itr != m_passengers.end(); ++itr)
{
takenSeatsMask |= 1 << itr->second->GetTransportSeat(); takenSeatsMask |= 1 << itr->second->GetTransportSeat();
}
return takenSeatsMask; return takenSeatsMask;
} }

View file

@ -39,8 +39,10 @@ OutdoorPvPHP::OutdoorPvPHP() : OutdoorPvP(),
m_towerWorldState[2] = WORLD_STATE_HP_BROKEN_HILL_NEUTRAL; m_towerWorldState[2] = WORLD_STATE_HP_BROKEN_HILL_NEUTRAL;
for (uint8 i = 0; i < MAX_HP_TOWERS; ++i) for (uint8 i = 0; i < MAX_HP_TOWERS; ++i)
{
m_towerOwner[i] = TEAM_NONE; m_towerOwner[i] = TEAM_NONE;
} }
}
void OutdoorPvPHP::FillInitialWorldStates(WorldPacket& data, uint32& count) void OutdoorPvPHP::FillInitialWorldStates(WorldPacket& data, uint32& count)
{ {
@ -50,8 +52,10 @@ void OutdoorPvPHP::FillInitialWorldStates(WorldPacket& data, uint32& count)
FillInitialWorldState(data, count, WORLD_STATE_HP_TOWER_DISPLAY_H, WORLD_STATE_ADD); FillInitialWorldState(data, count, WORLD_STATE_HP_TOWER_DISPLAY_H, WORLD_STATE_ADD);
for (uint8 i = 0; i < MAX_HP_TOWERS; ++i) for (uint8 i = 0; i < MAX_HP_TOWERS; ++i)
{
FillInitialWorldState(data, count, m_towerWorldState[i], WORLD_STATE_ADD); FillInitialWorldState(data, count, m_towerWorldState[i], WORLD_STATE_ADD);
} }
}
void OutdoorPvPHP::SendRemoveWorldStates(Player* player) void OutdoorPvPHP::SendRemoveWorldStates(Player* player)
{ {
@ -59,8 +63,10 @@ void OutdoorPvPHP::SendRemoveWorldStates(Player* player)
player->SendUpdateWorldState(WORLD_STATE_HP_TOWER_DISPLAY_H, WORLD_STATE_REMOVE); player->SendUpdateWorldState(WORLD_STATE_HP_TOWER_DISPLAY_H, WORLD_STATE_REMOVE);
for (uint8 i = 0; i < MAX_HP_TOWERS; ++i) for (uint8 i = 0; i < MAX_HP_TOWERS; ++i)
{
player->SendUpdateWorldState(m_towerWorldState[i], WORLD_STATE_REMOVE); player->SendUpdateWorldState(m_towerWorldState[i], WORLD_STATE_REMOVE);
} }
}
void OutdoorPvPHP::HandlePlayerEnterZone(Player* player, bool isMainZone) void OutdoorPvPHP::HandlePlayerEnterZone(Player* player, bool isMainZone)
{ {

View file

@ -51,8 +51,10 @@ void OutdoorPvPNA::FillInitialWorldStates(WorldPacket& data, uint32& count)
// map states // map states
for (uint8 i = 0; i < MAX_NA_ROOSTS; ++i) for (uint8 i = 0; i < MAX_NA_ROOSTS; ++i)
{
FillInitialWorldState(data, count, m_roostWorldState[i], WORLD_STATE_ADD); FillInitialWorldState(data, count, m_roostWorldState[i], WORLD_STATE_ADD);
} }
}
FillInitialWorldState(data, count, m_zoneMapState, WORLD_STATE_ADD); FillInitialWorldState(data, count, m_zoneMapState, WORLD_STATE_ADD);
FillInitialWorldState(data, count, WORLD_STATE_NA_GUARDS_MAX, MAX_NA_GUARDS); FillInitialWorldState(data, count, WORLD_STATE_NA_GUARDS_MAX, MAX_NA_GUARDS);
@ -65,8 +67,10 @@ void OutdoorPvPNA::SendRemoveWorldStates(Player* player)
player->SendUpdateWorldState(m_zoneMapState, WORLD_STATE_REMOVE); player->SendUpdateWorldState(m_zoneMapState, WORLD_STATE_REMOVE);
for (uint8 i = 0; i < MAX_NA_ROOSTS; ++i) for (uint8 i = 0; i < MAX_NA_ROOSTS; ++i)
{
player->SendUpdateWorldState(m_roostWorldState[i], WORLD_STATE_REMOVE); player->SendUpdateWorldState(m_roostWorldState[i], WORLD_STATE_REMOVE);
} }
}
void OutdoorPvPNA::HandlePlayerEnterZone(Player* player, bool isMainZone) void OutdoorPvPNA::HandlePlayerEnterZone(Player* player, bool isMainZone)
{ {
@ -299,8 +303,10 @@ void OutdoorPvPNA::UpdateWorldState(uint32 value)
void OutdoorPvPNA::UpdateWyvernsWorldState(uint32 value) void OutdoorPvPNA::UpdateWyvernsWorldState(uint32 value)
{ {
for (uint8 i = 0; i < MAX_NA_ROOSTS; ++i) for (uint8 i = 0; i < MAX_NA_ROOSTS; ++i)
{
SendUpdateWorldState(m_roostWorldState[i], value); SendUpdateWorldState(m_roostWorldState[i], value);
} }
}
// process the capture events // process the capture events
bool OutdoorPvPNA::HandleEvent(uint32 eventId, GameObject* go) bool OutdoorPvPNA::HandleEvent(uint32 eventId, GameObject* go)

View file

@ -46,8 +46,10 @@ OutdoorPvPTF::OutdoorPvPTF() : OutdoorPvP(),
m_towerWorldState[4] = WORLD_STATE_TF_SOUTH_TOWER_NEUTRAL; m_towerWorldState[4] = WORLD_STATE_TF_SOUTH_TOWER_NEUTRAL;
for (uint8 i = 0; i < MAX_TF_TOWERS; ++i) for (uint8 i = 0; i < MAX_TF_TOWERS; ++i)
{
m_towerOwner[i] = TEAM_NONE; m_towerOwner[i] = TEAM_NONE;
} }
}
void OutdoorPvPTF::FillInitialWorldStates(WorldPacket& data, uint32& count) void OutdoorPvPTF::FillInitialWorldStates(WorldPacket& data, uint32& count)
{ {
@ -58,8 +60,10 @@ void OutdoorPvPTF::FillInitialWorldStates(WorldPacket& data, uint32& count)
FillInitialWorldState(data, count, WORLD_STATE_TF_TOWER_COUNT_A, m_towersAlliance); FillInitialWorldState(data, count, WORLD_STATE_TF_TOWER_COUNT_A, m_towersAlliance);
for (uint8 i = 0; i < MAX_TF_TOWERS; ++i) for (uint8 i = 0; i < MAX_TF_TOWERS; ++i)
{
FillInitialWorldState(data, count, m_towerWorldState[i], WORLD_STATE_ADD); FillInitialWorldState(data, count, m_towerWorldState[i], WORLD_STATE_ADD);
} }
}
else else
UpdateTimerWorldState(); UpdateTimerWorldState();
} }
@ -69,8 +73,10 @@ void OutdoorPvPTF::SendRemoveWorldStates(Player* player)
player->SendUpdateWorldState(m_zoneWorldState, WORLD_STATE_REMOVE); player->SendUpdateWorldState(m_zoneWorldState, WORLD_STATE_REMOVE);
for (uint8 i = 0; i < MAX_TF_TOWERS; ++i) for (uint8 i = 0; i < MAX_TF_TOWERS; ++i)
{
player->SendUpdateWorldState(m_towerWorldState[i], WORLD_STATE_REMOVE); player->SendUpdateWorldState(m_towerWorldState[i], WORLD_STATE_REMOVE);
} }
}
void OutdoorPvPTF::HandlePlayerEnterZone(Player* player, bool isMainZone) void OutdoorPvPTF::HandlePlayerEnterZone(Player* player, bool isMainZone)
{ {
@ -258,7 +264,9 @@ void OutdoorPvPTF::LockZone(GameObject* go, uint32 towerId, Team team, uint32 ne
// remove tower states when zone has been captured and locked // remove tower states when zone has been captured and locked
for (uint8 i = 0; i < MAX_TF_TOWERS; ++i) for (uint8 i = 0; i < MAX_TF_TOWERS; ++i)
{
SendUpdateWorldState(m_towerWorldState[i], WORLD_STATE_REMOVE); SendUpdateWorldState(m_towerWorldState[i], WORLD_STATE_REMOVE);
}
m_towerWorldState[towerId] = newWorldState; m_towerWorldState[towerId] = newWorldState;
} }
@ -283,7 +291,9 @@ void OutdoorPvPTF::UnlockZone()
m_towerWorldState[3] = WORLD_STATE_TF_SOUTH_EAST_TOWER_NEUTRAL; m_towerWorldState[3] = WORLD_STATE_TF_SOUTH_EAST_TOWER_NEUTRAL;
m_towerWorldState[4] = WORLD_STATE_TF_SOUTH_TOWER_NEUTRAL; m_towerWorldState[4] = WORLD_STATE_TF_SOUTH_TOWER_NEUTRAL;
for (uint8 i = 0; i < MAX_TF_TOWERS; ++i) for (uint8 i = 0; i < MAX_TF_TOWERS; ++i)
{
SendUpdateWorldState(m_towerWorldState[i], WORLD_STATE_ADD); SendUpdateWorldState(m_towerWorldState[i], WORLD_STATE_ADD);
}
// update tower count // update tower count
m_towersAlliance = 0; m_towersAlliance = 0;

View file

@ -46,7 +46,9 @@ OutdoorPvPZM::OutdoorPvPZM() : OutdoorPvP(),
m_towerMapState[1] = WORLD_STATE_ZM_BEACON_WEST_NEUTRAL; m_towerMapState[1] = WORLD_STATE_ZM_BEACON_WEST_NEUTRAL;
for (uint8 i = 0; i < MAX_ZM_TOWERS; ++i) for (uint8 i = 0; i < MAX_ZM_TOWERS; ++i)
{
m_towerOwner[i] = TEAM_NONE; m_towerOwner[i] = TEAM_NONE;
}
// initially set graveyard owner to neither faction // initially set graveyard owner to neither faction
sObjectMgr.SetGraveYardLinkTeam(GRAVEYARD_ID_TWIN_SPIRE, GRAVEYARD_ZONE_TWIN_SPIRE, TEAM_INVALID); sObjectMgr.SetGraveYardLinkTeam(GRAVEYARD_ID_TWIN_SPIRE, GRAVEYARD_ZONE_TWIN_SPIRE, TEAM_INVALID);

View file

@ -123,7 +123,9 @@ void LoadDB2Stores(const std::string& dataPath)
{ {
std::string str; std::string str;
for (StoreProblemList1::iterator i = bad_db2_files.begin(); i != bad_db2_files.end(); ++i) for (StoreProblemList1::iterator i = bad_db2_files.begin(); i != bad_db2_files.end(); ++i)
{
str += *i + "\n"; str += *i + "\n";
}
sLog.outError("Some required *.db2 files (%u from %d) not found or not compatible:\n%s",(uint32)bad_db2_files.size(), DB2FileCount, str.c_str()); sLog.outError("Some required *.db2 files (%u from %d) not found or not compatible:\n%s",(uint32)bad_db2_files.size(), DB2FileCount, str.c_str());
exit(1); exit(1);

View file

@ -496,10 +496,14 @@ void LoadDBCStores(const std::string& dataPath)
for (uint32 i = 0; i < MAX_CLASSES; ++i) for (uint32 i = 0; i < MAX_CLASSES; ++i)
{ {
for (uint32 j = 0; j < MAX_POWERS; ++j) for (uint32 j = 0; j < MAX_POWERS; ++j)
{
sChrClassXPowerTypesStore[i][j] = INVALID_POWER_INDEX; sChrClassXPowerTypesStore[i][j] = INVALID_POWER_INDEX;
}
for (uint32 j = 0; j < MAX_STORED_POWERS; ++j) for (uint32 j = 0; j < MAX_STORED_POWERS; ++j)
{
sChrClassXPowerIndexStore[i][j] = INVALID_POWER; sChrClassXPowerIndexStore[i][j] = INVALID_POWER;
} }
}
for (uint32 i = 0; i < sChrPowerTypesStore.GetNumRows(); ++i) for (uint32 i = 0; i < sChrPowerTypesStore.GetNumRows(); ++i)
{ {
ChrPowerTypesEntry const* entry = sChrPowerTypesStore.LookupEntry(i); ChrPowerTypesEntry const* entry = sChrPowerTypesStore.LookupEntry(i);
@ -787,7 +791,9 @@ void LoadDBCStores(const std::string& dataPath)
// Set path length // Set path length
sTaxiPathNodesByPath.resize(pathCount); // 0 and some other indexes not used sTaxiPathNodesByPath.resize(pathCount); // 0 and some other indexes not used
for (uint32 i = 1; i < sTaxiPathNodesByPath.size(); ++i) for (uint32 i = 1; i < sTaxiPathNodesByPath.size(); ++i)
{
sTaxiPathNodesByPath[i].resize(pathLength[i]); sTaxiPathNodesByPath[i].resize(pathLength[i]);
}
// fill data (pointers to sTaxiPathNodeStore elements // fill data (pointers to sTaxiPathNodeStore elements
for (uint32 i = 1; i < sTaxiPathNodeStore.GetNumRows(); ++i) for (uint32 i = 1; i < sTaxiPathNodeStore.GetNumRows(); ++i)
if (TaxiPathNodeEntry const* entry = sTaxiPathNodeStore.LookupEntry(i)) if (TaxiPathNodeEntry const* entry = sTaxiPathNodeStore.LookupEntry(i))
@ -887,7 +893,9 @@ void LoadDBCStores(const std::string& dataPath)
{ {
std::string str; std::string str;
for (std::list<std::string>::iterator i = bad_dbc_files.begin(); i != bad_dbc_files.end(); ++i) for (std::list<std::string>::iterator i = bad_dbc_files.begin(); i != bad_dbc_files.end(); ++i)
{
str += *i + "\n"; str += *i + "\n";
}
sLog.outError("\nSome required *.dbc files (%u from %d) not found or not compatible:\n%s", (uint32)bad_dbc_files.size(), DBCFilesCount, str.c_str()); sLog.outError("\nSome required *.dbc files (%u from %d) not found or not compatible:\n%s", (uint32)bad_dbc_files.size(), DBCFilesCount, str.c_str());
Log::WaitBeforeContinueIfNeed(); Log::WaitBeforeContinueIfNeed();

View file

@ -45,7 +45,9 @@ OpcodeHandler opcodeTable[NUM_MSG_TYPES];
void InitializeOpcodes() void InitializeOpcodes()
{ {
for (uint16 i = 0; i < NUM_MSG_TYPES; ++i) for (uint16 i = 0; i < NUM_MSG_TYPES; ++i)
{
DefineOpcode(i, "UNKNOWN", STATUS_UNHANDLED, PROCESS_INPLACE, &WorldSession::Handle_NULL); DefineOpcode(i, "UNKNOWN", STATUS_UNHANDLED, PROCESS_INPLACE, &WorldSession::Handle_NULL);
}
OPCODE(MSG_WOW_CONNECTION, STATUS_NEVER, PROCESS_INPLACE, &WorldSession::Handle_EarlyProccess ); OPCODE(MSG_WOW_CONNECTION, STATUS_NEVER, PROCESS_INPLACE, &WorldSession::Handle_EarlyProccess );
OPCODE(SMSG_AUTH_CHALLENGE, STATUS_NEVER, PROCESS_INPLACE, &WorldSession::Handle_ServerSide ); OPCODE(SMSG_AUTH_CHALLENGE, STATUS_NEVER, PROCESS_INPLACE, &WorldSession::Handle_ServerSide );

View file

@ -790,13 +790,17 @@ void WorldSession::SendSetPhaseShift(std::set<uint32> const& phaseIds, std::set<
data << uint32(phaseIds.size() * 2); // Phase.dbc ids data << uint32(phaseIds.size() * 2); // Phase.dbc ids
for (std::set<uint32>::const_iterator itr = phaseIds.begin(); itr != phaseIds.end(); ++itr) for (std::set<uint32>::const_iterator itr = phaseIds.begin(); itr != phaseIds.end(); ++itr)
{
data << uint16(*itr); data << uint16(*itr);
}
data.WriteGuidBytes<3, 0>(guid); data.WriteGuidBytes<3, 0>(guid);
data << uint32(terrainswaps.size() * 2); // Active terrain swaps data << uint32(terrainswaps.size() * 2); // Active terrain swaps
for (std::set<uint32>::const_iterator itr = terrainswaps.begin(); itr != terrainswaps.end(); ++itr) for (std::set<uint32>::const_iterator itr = terrainswaps.begin(); itr != terrainswaps.end(); ++itr)
{
data << uint16(*itr); data << uint16(*itr);
}
data.WriteGuidBytes<5>(guid); data.WriteGuidBytes<5>(guid);
SendPacket(&data); SendPacket(&data);

View file

@ -279,7 +279,9 @@ int WorldSocket::open(void* a)
// Send startup packet. // Send startup packet.
WorldPacket packet (SMSG_AUTH_CHALLENGE, 37); WorldPacket packet (SMSG_AUTH_CHALLENGE, 37);
for (uint32 i = 0; i < 8; i++) for (uint32 i = 0; i < 8; i++)
{
packet << uint32(0); packet << uint32(0);
}
packet << m_Seed; packet << m_Seed;
packet << uint8(1); packet << uint8(1);

View file

@ -198,7 +198,9 @@ uint32 Warden::BuildChecksum(const uint8* data, uint32 length)
SHA1(data, length, hash.bytes.bytes); SHA1(data, length, hash.bytes.bytes);
uint32 checkSum = 0; uint32 checkSum = 0;
for (uint8 i = 0; i < 5; ++i) for (uint8 i = 0; i < 5; ++i)
{
checkSum = checkSum ^ hash.ints.ints[i]; checkSum = checkSum ^ hash.ints.ints[i];
}
return checkSum; return checkSum;
} }

View file

@ -37,11 +37,15 @@ WardenCheckMgr::WardenCheckMgr() { }
WardenCheckMgr::~WardenCheckMgr() WardenCheckMgr::~WardenCheckMgr()
{ {
for (uint16 i = 0; i < CheckStore.size(); ++i) for (uint16 i = 0; i < CheckStore.size(); ++i)
{
delete CheckStore[i]; delete CheckStore[i];
}
for (CheckResultContainer::iterator itr = CheckResultStore.begin(); itr != CheckResultStore.end(); ++itr) for (CheckResultContainer::iterator itr = CheckResultStore.begin(); itr != CheckResultStore.end(); ++itr)
{
delete itr->second; delete itr->second;
} }
}
void WardenCheckMgr::LoadWardenChecks() void WardenCheckMgr::LoadWardenChecks()
{ {

View file

@ -306,7 +306,9 @@ void WardenWin::RequestData()
std::stringstream stream; std::stringstream stream;
stream << "Sent check id's: "; stream << "Sent check id's: ";
for (std::list<uint16>::iterator itr = _currentChecks.begin(); itr != _currentChecks.end(); ++itr) for (std::list<uint16>::iterator itr = _currentChecks.begin(); itr != _currentChecks.end(); ++itr)
{
stream << *itr << " "; stream << *itr << " ";
}
sLog.outWarden("%s", stream.str().c_str()); sLog.outWarden("%s", stream.str().c_str());
} }

View file

@ -267,7 +267,9 @@ bool AccountMgr::normalizeString(std::string& utf8str)
} }
for (uint32 i = 0; i <= wstr_len; ++i) for (uint32 i = 0; i <= wstr_len; ++i)
{
wstr_buf[i] = wcharToUpperOnlyLatin(wstr_buf[i]); wstr_buf[i] = wcharToUpperOnlyLatin(wstr_buf[i]);
}
return WStrToUtf8(wstr_buf, wstr_len, utf8str); return WStrToUtf8(wstr_buf, wstr_len, utf8str);
} }

View file

@ -709,8 +709,10 @@ void AchievementMgr::CheckAllAchievementCriteria()
{ {
// suppress sending packets // suppress sending packets
for (uint32 i = 0; i < ACHIEVEMENT_CRITERIA_TYPE_TOTAL; ++i) for (uint32 i = 0; i < ACHIEVEMENT_CRITERIA_TYPE_TOTAL; ++i)
{
UpdateAchievementCriteria(AchievementCriteriaTypes(i)); UpdateAchievementCriteria(AchievementCriteriaTypes(i));
} }
}
static const uint32 achievIdByArenaSlot[MAX_ARENA_SLOT] = { 1057, 1107, 1108 }; static const uint32 achievIdByArenaSlot[MAX_ARENA_SLOT] = { 1057, 1107, 1108 };
static const uint32 achievIdForDungeon[][4] = static const uint32 achievIdForDungeon[][4] =

View file

@ -680,7 +680,9 @@ void WorldSession::HandleAuctionListItems(WorldPacket& recv_data)
auctions.reserve(aucs.size()); auctions.reserve(aucs.size());
for (AuctionHouseObject::AuctionEntryMap::const_iterator itr = aucs.begin(); itr != aucs.end(); ++itr) for (AuctionHouseObject::AuctionEntryMap::const_iterator itr = aucs.begin(); itr != aucs.end(); ++itr)
{
auctions.push_back(itr->second); auctions.push_back(itr->second);
}
AuctionSorter sorter(Sort, GetPlayer()); AuctionSorter sorter(Sort, GetPlayer());
std::sort(auctions.begin(), auctions.end(), sorter); std::sort(auctions.begin(), auctions.end(), sorter);
@ -733,7 +735,9 @@ void WorldSession::HandleAuctionListPendingSales(WorldPacket& recv_data)
// pending list include all auction house entries for character // pending list include all auction house entries for character
for (int i = 0; i < MAX_AUCTION_HOUSE_TYPE; ++i) for (int i = 0; i < MAX_AUCTION_HOUSE_TYPE; ++i)
{
sAuctionMgr.GetAuctionsMap(AuctionHouseType(i))->BuildListPendingSales(data, _player, count); sAuctionMgr.GetAuctionsMap(AuctionHouseType(i))->BuildListPendingSales(data, _player, count);
}
data.put<uint32>(0, count); data.put<uint32>(0, count);
SendPacket(&data); SendPacket(&data);

View file

@ -35,9 +35,13 @@ ChannelMgr* channelMgr(Team team)
return &MaNGOS::Singleton<AllianceChannelMgr>::Instance(); // cross-faction return &MaNGOS::Singleton<AllianceChannelMgr>::Instance(); // cross-faction
if (team == ALLIANCE) if (team == ALLIANCE)
{
return &MaNGOS::Singleton<AllianceChannelMgr>::Instance(); return &MaNGOS::Singleton<AllianceChannelMgr>::Instance();
}
if (team == HORDE) if (team == HORDE)
{
return &MaNGOS::Singleton<HordeChannelMgr>::Instance(); return &MaNGOS::Singleton<HordeChannelMgr>::Instance();
}
return NULL; return NULL;
} }
@ -45,7 +49,9 @@ ChannelMgr* channelMgr(Team team)
ChannelMgr::~ChannelMgr() ChannelMgr::~ChannelMgr()
{ {
for (ChannelMap::iterator itr = channels.begin(); itr != channels.end(); ++itr) for (ChannelMap::iterator itr = channels.begin(); itr != channels.end(); ++itr)
{
delete itr->second; delete itr->second;
}
channels.clear(); channels.clear();
} }
@ -86,8 +92,10 @@ Channel* ChannelMgr::GetChannel(const std::string& name, Player* p, bool pkt)
return NULL; return NULL;
} }
else else
{
return i->second; return i->second;
} }
}
void ChannelMgr::LeftChannel(const std::string& name) void ChannelMgr::LeftChannel(const std::string& name)
{ {
@ -98,7 +106,9 @@ void ChannelMgr::LeftChannel(const std::string& name)
ChannelMap::const_iterator i = channels.find(wname); ChannelMap::const_iterator i = channels.find(wname);
if (i == channels.end()) if (i == channels.end())
{
return; return;
}
Channel* channel = i->second; Channel* channel = i->second;

View file

@ -985,14 +985,18 @@ void WorldSession::HandleTutorialFlagOpcode(WorldPacket& recv_data)
void WorldSession::HandleTutorialClearOpcode(WorldPacket & /*recv_data*/) void WorldSession::HandleTutorialClearOpcode(WorldPacket & /*recv_data*/)
{ {
for (int i = 0; i < 8; ++i) for (int i = 0; i < 8; ++i)
{
SetTutorialInt(i, 0xFFFFFFFF); SetTutorialInt(i, 0xFFFFFFFF);
} }
}
void WorldSession::HandleTutorialResetOpcode(WorldPacket & /*recv_data*/) void WorldSession::HandleTutorialResetOpcode(WorldPacket & /*recv_data*/)
{ {
for (int i = 0; i < 8; ++i) for (int i = 0; i < 8; ++i)
{
SetTutorialInt(i, 0x00000000); SetTutorialInt(i, 0x00000000);
} }
}
void WorldSession::HandleSetWatchedFactionOpcode(WorldPacket& recv_data) void WorldSession::HandleSetWatchedFactionOpcode(WorldPacket& recv_data)
{ {
@ -1177,7 +1181,9 @@ void WorldSession::HandleSetPlayerDeclinedNamesOpcode(WorldPacket& recv_data)
} }
for (int i = 0; i < MAX_DECLINED_NAME_CASES; ++i) for (int i = 0; i < MAX_DECLINED_NAME_CASES; ++i)
{
CharacterDatabase.escape_string(declinedname.name[i]); CharacterDatabase.escape_string(declinedname.name[i]);
}
CharacterDatabase.BeginTransaction(); CharacterDatabase.BeginTransaction();
CharacterDatabase.PExecute("DELETE FROM character_declinedname WHERE guid = '%u'", guid.GetCounter()); CharacterDatabase.PExecute("DELETE FROM character_declinedname WHERE guid = '%u'", guid.GetCounter());

View file

@ -461,12 +461,16 @@ void CreatureLinkingHolder::DoCreatureLinkingEvent(CreatureLinkingEvent eventTyp
// Process Slaves (by entry) // Process Slaves (by entry)
HolderMapBounds bounds = m_holderMap.equal_range(pSource->GetEntry()); HolderMapBounds bounds = m_holderMap.equal_range(pSource->GetEntry());
for (HolderMap::iterator itr = bounds.first; itr != bounds.second; ++itr) for (HolderMap::iterator itr = bounds.first; itr != bounds.second; ++itr)
{
ProcessSlaveGuidList(eventType, pSource, itr->second.linkingFlag & eventFlagFilter, itr->second.searchRange, itr->second.linkedGuids, pEnemy); ProcessSlaveGuidList(eventType, pSource, itr->second.linkingFlag & eventFlagFilter, itr->second.searchRange, itr->second.linkedGuids, pEnemy);
}
// Process Slaves (by guid) // Process Slaves (by guid)
bounds = m_holderGuidMap.equal_range(pSource->GetGUIDLow()); bounds = m_holderGuidMap.equal_range(pSource->GetGUIDLow());
for (HolderMap::iterator itr = bounds.first; itr != bounds.second; ++itr) for (HolderMap::iterator itr = bounds.first; itr != bounds.second; ++itr)
{
ProcessSlaveGuidList(eventType, pSource, itr->second.linkingFlag & eventFlagFilter, itr->second.searchRange, itr->second.linkedGuids, pEnemy); ProcessSlaveGuidList(eventType, pSource, itr->second.linkingFlag & eventFlagFilter, itr->second.searchRange, itr->second.linkedGuids, pEnemy);
}
// Process Master // Process Master
if (CreatureLinkingInfo const* pInfo = sCreatureLinkingMgr.GetLinkedTriggerInformation(pSource)) if (CreatureLinkingInfo const* pInfo = sCreatureLinkingMgr.GetLinkedTriggerInformation(pSource))

View file

@ -48,7 +48,9 @@ void LoadDisables()
{ {
// reload case // reload case
for (DisableMap::iterator itr = m_DisableMap.begin(); itr != m_DisableMap.end(); ++itr) for (DisableMap::iterator itr = m_DisableMap.begin(); itr != m_DisableMap.end(); ++itr)
{
itr->second.clear(); itr->second.clear();
}
m_DisableMap.clear(); m_DisableMap.clear();

View file

@ -630,8 +630,10 @@ void GameEventMgr::Initialize(MapPersistentState* state)
// other data is global and will be auto-apply // other data is global and will be auto-apply
for (GameEventMgr::ActiveEvents::const_iterator event_itr = m_ActiveEvents.begin(); event_itr != m_ActiveEvents.end(); ++event_itr) for (GameEventMgr::ActiveEvents::const_iterator event_itr = m_ActiveEvents.begin(); event_itr != m_ActiveEvents.end(); ++event_itr)
for (IdList::iterator pool_itr = mGameEventSpawnPoolIds[*event_itr].begin(); pool_itr != mGameEventSpawnPoolIds[*event_itr].end(); ++pool_itr) for (IdList::iterator pool_itr = mGameEventSpawnPoolIds[*event_itr].begin(); pool_itr != mGameEventSpawnPoolIds[*event_itr].end(); ++pool_itr)
{
sPoolMgr.InitSpawnPool(*state, *pool_itr); sPoolMgr.InitSpawnPool(*state, *pool_itr);
} }
}
// return the next event delay in ms // return the next event delay in ms
uint32 GameEventMgr::Update(ActiveEvents const* activeAtShutdown /*= NULL*/) uint32 GameEventMgr::Update(ActiveEvents const* activeAtShutdown /*= NULL*/)
@ -796,9 +798,11 @@ void GameEventMgr::GameEventSpawn(int16 event_id)
} }
for (IdList::iterator itr = mGameEventSpawnPoolIds[event_id].begin(); itr != mGameEventSpawnPoolIds[event_id].end(); ++itr) for (IdList::iterator itr = mGameEventSpawnPoolIds[event_id].begin(); itr != mGameEventSpawnPoolIds[event_id].end(); ++itr)
{
sPoolMgr.SpawnPoolInMaps(*itr, true); sPoolMgr.SpawnPoolInMaps(*itr, true);
} }
} }
}
void GameEventMgr::GameEventUnspawn(int16 event_id) void GameEventMgr::GameEventUnspawn(int16 event_id)
{ {

View file

@ -494,9 +494,13 @@ void PlayerMenu::SendQuestGiverQuestDetails(Quest const* pQuest, ObjectGuid guid
data << pQuest->GetRewChoiceItemsCount(); data << pQuest->GetRewChoiceItemsCount();
for (uint32 i = 0; i < QUEST_REWARD_CHOICES_COUNT; ++i) for (uint32 i = 0; i < QUEST_REWARD_CHOICES_COUNT; ++i)
{
data << pQuest->RewChoiceItemId[i]; data << pQuest->RewChoiceItemId[i];
}
for (uint32 i = 0; i < QUEST_REWARD_CHOICES_COUNT; ++i) for (uint32 i = 0; i < QUEST_REWARD_CHOICES_COUNT; ++i)
{
data << pQuest->RewChoiceItemCount[i]; data << pQuest->RewChoiceItemCount[i];
}
for (uint32 i = 0; i < QUEST_REWARD_CHOICES_COUNT; ++i) for (uint32 i = 0; i < QUEST_REWARD_CHOICES_COUNT; ++i)
if (ItemPrototype const* IProto = ObjectMgr::GetItemPrototype(pQuest->RewChoiceItemId[i])) if (ItemPrototype const* IProto = ObjectMgr::GetItemPrototype(pQuest->RewChoiceItemId[i]))
data << IProto->DisplayInfoID; data << IProto->DisplayInfoID;
@ -506,9 +510,13 @@ void PlayerMenu::SendQuestGiverQuestDetails(Quest const* pQuest, ObjectGuid guid
data << pQuest->GetRewItemsCount(); data << pQuest->GetRewItemsCount();
for (uint32 i = 0; i < QUEST_REWARDS_COUNT; ++i) for (uint32 i = 0; i < QUEST_REWARDS_COUNT; ++i)
{
data << pQuest->RewItemId[i]; data << pQuest->RewItemId[i];
}
for (uint32 i = 0; i < QUEST_REWARDS_COUNT; ++i) for (uint32 i = 0; i < QUEST_REWARDS_COUNT; ++i)
{
data << pQuest->RewItemCount[i]; data << pQuest->RewItemCount[i];
}
for (uint32 i = 0; i < QUEST_REWARDS_COUNT; ++i) for (uint32 i = 0; i < QUEST_REWARDS_COUNT; ++i)
if (ItemPrototype const* IProto = ObjectMgr::GetItemPrototype(pQuest->RewItemId[i])) if (ItemPrototype const* IProto = ObjectMgr::GetItemPrototype(pQuest->RewItemId[i]))
data << IProto->DisplayInfoID; data << IProto->DisplayInfoID;
@ -534,7 +542,9 @@ void PlayerMenu::SendQuestGiverQuestDetails(Quest const* pQuest, ObjectGuid guid
data << pQuest->RewRepFaction[i]; data << pQuest->RewRepFaction[i];
for (int i = 0; i < QUEST_REPUTATIONS_COUNT; ++i) // columnid in QuestFactionReward.dbc (if negative, from second row) for (int i = 0; i < QUEST_REPUTATIONS_COUNT; ++i) // columnid in QuestFactionReward.dbc (if negative, from second row)
{
data << pQuest->RewRepValueId[i]; data << pQuest->RewRepValueId[i];
}
for (int i = 0; i < QUEST_REPUTATIONS_COUNT; ++i) // reward reputation override. No bonus is expected given for (int i = 0; i < QUEST_REPUTATIONS_COUNT; ++i) // reward reputation override. No bonus is expected given
data << int32(0); data << int32(0);
@ -544,10 +554,14 @@ void PlayerMenu::SendQuestGiverQuestDetails(Quest const* pQuest, ObjectGuid guid
data << pQuest->GetRewSpellCast(); // casted spell data << pQuest->GetRewSpellCast(); // casted spell
for (uint32 i = 0; i < QUEST_REWARD_CURRENCY_COUNT; ++i) for (uint32 i = 0; i < QUEST_REWARD_CURRENCY_COUNT; ++i)
{
data << pQuest->RewCurrencyId[i]; data << pQuest->RewCurrencyId[i];
}
for (uint32 i = 0; i < QUEST_REWARD_CURRENCY_COUNT; ++i) for (uint32 i = 0; i < QUEST_REWARD_CURRENCY_COUNT; ++i)
{
data << pQuest->RewCurrencyCount[i]; data << pQuest->RewCurrencyCount[i];
}
data << pQuest->GetRewSkill(); data << pQuest->GetRewSkill();
data << pQuest->GetRewSkillValue(); data << pQuest->GetRewSkillValue();
@ -583,7 +597,9 @@ void PlayerMenu::SendQuestQueryResponse(Quest const* pQuest)
PortraitTurnInText = pQuest->GetPortraitTurnInText(); PortraitTurnInText = pQuest->GetPortraitTurnInText();
for (int i = 0; i < QUEST_OBJECTIVES_COUNT; ++i) for (int i = 0; i < QUEST_OBJECTIVES_COUNT; ++i)
{
ObjectiveText[i] = pQuest->ObjectiveText[i]; ObjectiveText[i] = pQuest->ObjectiveText[i];
}
int loc_idx = GetMenuSession()->GetSessionDbLocaleIndex(); int loc_idx = GetMenuSession()->GetSessionDbLocaleIndex();
if (loc_idx >= 0) if (loc_idx >= 0)
@ -671,10 +687,14 @@ void PlayerMenu::SendQuestQueryResponse(Quest const* pQuest)
/*if (pQuest->HasQuestFlag(QUEST_FLAGS_HIDDEN_REWARDS)) /*if (pQuest->HasQuestFlag(QUEST_FLAGS_HIDDEN_REWARDS))
{ {
for (iI = 0; iI < QUEST_REWARDS_COUNT; ++iI) for (iI = 0; iI < QUEST_REWARDS_COUNT; ++iI)
{
data << uint32(0) << uint32(0); data << uint32(0) << uint32(0);
}
for (iI = 0; iI < QUEST_REWARD_CHOICES_COUNT; ++iI) for (iI = 0; iI < QUEST_REWARD_CHOICES_COUNT; ++iI)
{
data << uint32(0) << uint32(0); data << uint32(0) << uint32(0);
} }
}
else*/ else*/
{ {
for (iI = 0; iI < QUEST_REWARDS_COUNT; ++iI) for (iI = 0; iI < QUEST_REWARDS_COUNT; ++iI)
@ -693,7 +713,9 @@ void PlayerMenu::SendQuestQueryResponse(Quest const* pQuest)
data << uint32(pQuest->RewRepFaction[i]); data << uint32(pQuest->RewRepFaction[i]);
for (int i = 0; i < QUEST_REPUTATIONS_COUNT; ++i) // columnid in QuestFactionReward.dbc (if negative, from second row) for (int i = 0; i < QUEST_REPUTATIONS_COUNT; ++i) // columnid in QuestFactionReward.dbc (if negative, from second row)
{
data << int32(pQuest->RewRepValueId[i]); data << int32(pQuest->RewRepValueId[i]);
}
for (int i = 0; i < QUEST_REPUTATIONS_COUNT; ++i) // reward reputation override. No bonus is expected given for (int i = 0; i < QUEST_REPUTATIONS_COUNT; ++i) // reward reputation override. No bonus is expected given
data << int32(0); data << int32(0);
@ -735,7 +757,9 @@ void PlayerMenu::SendQuestQueryResponse(Quest const* pQuest)
data << uint32(pQuest->GetReqSpellLearned()); data << uint32(pQuest->GetReqSpellLearned());
for (iI = 0; iI < QUEST_OBJECTIVES_COUNT; ++iI) for (iI = 0; iI < QUEST_OBJECTIVES_COUNT; ++iI)
{
data << ObjectiveText[iI]; data << ObjectiveText[iI];
}
for(iI = 0; iI < QUEST_REWARD_CURRENCY_COUNT; ++iI) for(iI = 0; iI < QUEST_REWARD_CURRENCY_COUNT; ++iI)
{ {
@ -825,9 +849,13 @@ void PlayerMenu::SendQuestGiverOfferReward(Quest const* pQuest, ObjectGuid npcGU
data << uint32(pQuest->GetRewChoiceItemsCount()); data << uint32(pQuest->GetRewChoiceItemsCount());
for (uint32 i = 0; i < QUEST_REWARD_CHOICES_COUNT; ++i) for (uint32 i = 0; i < QUEST_REWARD_CHOICES_COUNT; ++i)
{
data << uint32(pQuest->RewChoiceItemId[i]); data << uint32(pQuest->RewChoiceItemId[i]);
}
for (uint32 i = 0; i < QUEST_REWARD_CHOICES_COUNT; ++i) for (uint32 i = 0; i < QUEST_REWARD_CHOICES_COUNT; ++i)
{
data << uint32(pQuest->RewChoiceItemCount[i]); data << uint32(pQuest->RewChoiceItemCount[i]);
}
for (uint32 i = 0; i < QUEST_REWARD_CHOICES_COUNT; ++i) for (uint32 i = 0; i < QUEST_REWARD_CHOICES_COUNT; ++i)
if (ItemPrototype const* pItem = ObjectMgr::GetItemPrototype(pQuest->RewChoiceItemId[i])) if (ItemPrototype const* pItem = ObjectMgr::GetItemPrototype(pQuest->RewChoiceItemId[i]))
data << uint32(pItem->DisplayInfoID); data << uint32(pItem->DisplayInfoID);
@ -836,9 +864,13 @@ void PlayerMenu::SendQuestGiverOfferReward(Quest const* pQuest, ObjectGuid npcGU
data << uint32(pQuest->GetRewItemsCount()); data << uint32(pQuest->GetRewItemsCount());
for (uint32 i = 0; i < QUEST_REWARDS_COUNT; ++i) for (uint32 i = 0; i < QUEST_REWARDS_COUNT; ++i)
{
data << uint32(pQuest->RewItemId[i]); data << uint32(pQuest->RewItemId[i]);
}
for (uint32 i = 0; i < QUEST_REWARDS_COUNT; ++i) for (uint32 i = 0; i < QUEST_REWARDS_COUNT; ++i)
{
data << uint32(pQuest->RewItemCount[i]); data << uint32(pQuest->RewItemCount[i]);
}
for (uint32 i = 0; i < QUEST_REWARDS_COUNT; ++i) for (uint32 i = 0; i < QUEST_REWARDS_COUNT; ++i)
if (ItemPrototype const* pItem = ObjectMgr::GetItemPrototype(pQuest->RewItemId[i])) if (ItemPrototype const* pItem = ObjectMgr::GetItemPrototype(pQuest->RewItemId[i]))
data << uint32(pItem->DisplayInfoID); data << uint32(pItem->DisplayInfoID);
@ -865,7 +897,9 @@ void PlayerMenu::SendQuestGiverOfferReward(Quest const* pQuest, ObjectGuid npcGU
data << uint32(pQuest->RewRepFaction[i]); data << uint32(pQuest->RewRepFaction[i]);
for (int i = 0; i < QUEST_REPUTATIONS_COUNT; ++i) // columnid in QuestFactionReward.dbc (if negative, from second row) for (int i = 0; i < QUEST_REPUTATIONS_COUNT; ++i) // columnid in QuestFactionReward.dbc (if negative, from second row)
{
data << int32(pQuest->RewRepValueId[i]); data << int32(pQuest->RewRepValueId[i]);
}
for (int i = 0; i < QUEST_REPUTATIONS_COUNT; ++i) // reward reputation override. No diplomacy bonus is expected given, reward also does not display in chat window for (int i = 0; i < QUEST_REPUTATIONS_COUNT; ++i) // reward reputation override. No diplomacy bonus is expected given, reward also does not display in chat window
data << int32(0); data << int32(0);
@ -875,10 +909,14 @@ void PlayerMenu::SendQuestGiverOfferReward(Quest const* pQuest, ObjectGuid npcGU
data << uint32(pQuest->GetRewSpellCast()); // casted spell data << uint32(pQuest->GetRewSpellCast()); // casted spell
for (uint32 i = 0; i < QUEST_REWARD_CURRENCY_COUNT; ++i) for (uint32 i = 0; i < QUEST_REWARD_CURRENCY_COUNT; ++i)
{
data << uint32(pQuest->RewCurrencyId[i]); data << uint32(pQuest->RewCurrencyId[i]);
}
for (uint32 i = 0; i < QUEST_REWARD_CURRENCY_COUNT; ++i) for (uint32 i = 0; i < QUEST_REWARD_CURRENCY_COUNT; ++i)
{
data << uint32(pQuest->RewCurrencyCount[i]); data << uint32(pQuest->RewCurrencyCount[i]);
}
data << uint32(pQuest->GetRewSkill()); data << uint32(pQuest->GetRewSkill());
data << uint32(pQuest->GetRewSkillValue()); data << uint32(pQuest->GetRewSkillValue());

View file

@ -761,7 +761,9 @@ TerrainInfo::~TerrainInfo()
{ {
for (int k = 0; k < MAX_NUMBER_OF_GRIDS; ++k) for (int k = 0; k < MAX_NUMBER_OF_GRIDS; ++k)
for (int i = 0; i < MAX_NUMBER_OF_GRIDS; ++i) for (int i = 0; i < MAX_NUMBER_OF_GRIDS; ++i)
{
delete m_GridMaps[i][k]; delete m_GridMaps[i][k];
}
VMAP::VMapFactory::createOrGetVMapManager()->unloadMap(m_mapId); VMAP::VMapFactory::createOrGetVMapManager()->unloadMap(m_mapId);
MMAP::MMapFactory::createOrGetMMapManager()->unloadMap(m_mapId); MMAP::MMapFactory::createOrGetMMapManager()->unloadMap(m_mapId);
@ -1329,8 +1331,10 @@ TerrainManager::TerrainManager()
TerrainManager::~TerrainManager() TerrainManager::~TerrainManager()
{ {
for (TerrainDataMap::iterator it = i_TerrainMap.begin(); it != i_TerrainMap.end(); ++it) for (TerrainDataMap::iterator it = i_TerrainMap.begin(); it != i_TerrainMap.end(); ++it)
{
delete it->second; delete it->second;
} }
}
TerrainInfo* TerrainManager::LoadTerrain(const uint32 mapId) TerrainInfo* TerrainManager::LoadTerrain(const uint32 mapId)
{ {
@ -1375,13 +1379,17 @@ void TerrainManager::Update(const uint32 diff)
{ {
// global garbage collection for GridMap objects and VMaps // global garbage collection for GridMap objects and VMaps
for (TerrainDataMap::iterator iter = i_TerrainMap.begin(); iter != i_TerrainMap.end(); ++iter) for (TerrainDataMap::iterator iter = i_TerrainMap.begin(); iter != i_TerrainMap.end(); ++iter)
{
iter->second->CleanUpGrids(diff); iter->second->CleanUpGrids(diff);
} }
}
void TerrainManager::UnloadAll() void TerrainManager::UnloadAll()
{ {
for (TerrainDataMap::iterator it = i_TerrainMap.begin(); it != i_TerrainMap.end(); ++it) for (TerrainDataMap::iterator it = i_TerrainMap.begin(); it != i_TerrainMap.end(); ++it)
{
delete it->second; delete it->second;
}
i_TerrainMap.clear(); i_TerrainMap.clear();
} }

View file

@ -1329,8 +1329,10 @@ namespace MaNGOS
~LocalizedPacketDo() ~LocalizedPacketDo()
{ {
for (size_t i = 0; i < i_data_cache.size(); ++i) for (size_t i = 0; i < i_data_cache.size(); ++i)
{
delete i_data_cache[i]; delete i_data_cache[i];
} }
}
void operator()(Player* p); void operator()(Player* p);
private: private:
@ -1350,8 +1352,10 @@ namespace MaNGOS
{ {
for (size_t i = 0; i < i_data_cache.size(); ++i) for (size_t i = 0; i < i_data_cache.size(); ++i)
for (size_t j = 0; j < i_data_cache[i].size(); ++j) for (size_t j = 0; j < i_data_cache[i].size(); ++j)
{
delete i_data_cache[i][j]; delete i_data_cache[i][j];
} }
}
void operator()(Player* p); void operator()(Player* p);
private: private:

View file

@ -227,15 +227,19 @@ template<>
inline void MaNGOS::DynamicObjectUpdater::Visit(CreatureMapType& m) inline void MaNGOS::DynamicObjectUpdater::Visit(CreatureMapType& m)
{ {
for (CreatureMapType::iterator itr = m.begin(); itr != m.end(); ++itr) for (CreatureMapType::iterator itr = m.begin(); itr != m.end(); ++itr)
{
VisitHelper(itr->getSource()); VisitHelper(itr->getSource());
} }
}
template<> template<>
inline void MaNGOS::DynamicObjectUpdater::Visit(PlayerMapType& m) inline void MaNGOS::DynamicObjectUpdater::Visit(PlayerMapType& m)
{ {
for (PlayerMapType::iterator itr = m.begin(); itr != m.end(); ++itr) for (PlayerMapType::iterator itr = m.begin(); itr != m.end(); ++itr)
{
VisitHelper(itr->getSource()); VisitHelper(itr->getSource());
} }
}
// SEARCHERS & LIST SEARCHERS & WORKERS // SEARCHERS & LIST SEARCHERS & WORKERS
@ -736,7 +740,9 @@ void MaNGOS::LocalizedPacketListDo<Builder>::operator()(Player* p)
data_list = &i_data_cache[cache_idx]; data_list = &i_data_cache[cache_idx];
for (size_t i = 0; i < data_list->size(); ++i) for (size_t i = 0; i < data_list->size(); ++i)
{
p->SendDirectMessage((*data_list)[i]); p->SendDirectMessage((*data_list)[i]);
} }
}
#endif // MANGOS_GRIDNOTIFIERSIMPL_H #endif // MANGOS_GRIDNOTIFIERSIMPL_H

View file

@ -120,7 +120,9 @@ Group::~Group()
// this may unload some dungeon persistent state // this may unload some dungeon persistent state
for (uint8 i = 0; i < MAX_DIFFICULTY; ++i) for (uint8 i = 0; i < MAX_DIFFICULTY; ++i)
for (BoundInstancesMap::iterator itr2 = m_boundInstances[i].begin(); itr2 != m_boundInstances[i].end(); ++itr2) for (BoundInstancesMap::iterator itr2 = m_boundInstances[i].begin(); itr2 != m_boundInstances[i].end(); ++itr2)
{
itr2->second.state->RemoveGroup(this); itr2->second.state->RemoveGroup(this);
}
// Sub group counters clean up // Sub group counters clean up
delete[] m_subGroupsCounts; delete[] m_subGroupsCounts;
@ -226,7 +228,9 @@ bool Group::LoadGroupFromDB(Field* fields)
m_lootThreshold = ItemQualities(fields[4].GetUInt16()); m_lootThreshold = ItemQualities(fields[4].GetUInt16());
for (int i = 0; i < TARGET_ICON_COUNT; ++i) for (int i = 0; i < TARGET_ICON_COUNT; ++i)
{
m_targetIcons[i] = ObjectGuid(fields[5 + i].GetUInt64()); m_targetIcons[i] = ObjectGuid(fields[5 + i].GetUInt64());
}
return true; return true;
} }
@ -320,7 +324,9 @@ uint32 Group::RemoveInvite(Player* player)
void Group::RemoveAllInvites() void Group::RemoveAllInvites()
{ {
for (InvitesList::iterator itr = m_invitees.begin(); itr != m_invitees.end(); ++itr) for (InvitesList::iterator itr = m_invitees.begin(); itr != m_invitees.end(); ++itr)
{
(*itr)->SetGroupInvite(NULL); (*itr)->SetGroupInvite(NULL);
}
m_invitees.clear(); m_invitees.clear();
} }
@ -1311,8 +1317,10 @@ bool Group::_addMember(ObjectGuid guid, const char* name, bool isAssistant, uint
if (!isRaidGroup()) // reset targetIcons for non-raid-groups if (!isRaidGroup()) // reset targetIcons for non-raid-groups
{ {
for (int i = 0; i < TARGET_ICON_COUNT; ++i) for (int i = 0; i < TARGET_ICON_COUNT; ++i)
{
m_targetIcons[i].Clear(); m_targetIcons[i].Clear();
} }
}
if (!isBGGroup()) if (!isBGGroup())
{ {

View file

@ -437,8 +437,10 @@ class Group
memset((void*)m_subGroupsCounts, 0, MAX_RAID_SUBGROUPS * sizeof(uint8)); memset((void*)m_subGroupsCounts, 0, MAX_RAID_SUBGROUPS * sizeof(uint8));
for (member_citerator itr = m_memberSlots.begin(); itr != m_memberSlots.end(); ++itr) for (member_citerator itr = m_memberSlots.begin(); itr != m_memberSlots.end(); ++itr)
{
++m_subGroupsCounts[itr->group]; ++m_subGroupsCounts[itr->group];
} }
}
member_citerator _getMemberCSlot(ObjectGuid guid) const member_citerator _getMemberCSlot(ObjectGuid guid) const
{ {

View file

@ -857,7 +857,9 @@ void WorldSession::HandleGuildRankOpcode(WorldPacket& recvPacket)
DEBUG_LOG("WORLD: Changed RankName to %s , Rights to 0x%.4X", rankname.c_str(), rights); DEBUG_LOG("WORLD: Changed RankName to %s , Rights to 0x%.4X", rankname.c_str(), rights);
for (int i = 0; i < GUILD_BANK_MAX_TABS; ++i) for (int i = 0; i < GUILD_BANK_MAX_TABS; ++i)
{
guild->SetBankRightsAndSlots(rankId, uint8(i), uint16(BankRights[i] & 0xFF), uint16(BankSlotPerDay[i]), true); guild->SetBankRightsAndSlots(rankId, uint8(i), uint16(BankRights[i] & 0xFF), uint16(BankSlotPerDay[i]), true);
}
guild->SetBankMoneyPerDay(rankId, MoneyPerDay); guild->SetBankMoneyPerDay(rankId, MoneyPerDay);
guild->SetRankName(rankId, rankname); guild->SetRankName(rankId, rankname);

View file

@ -40,8 +40,10 @@ GuildMgr::GuildMgr()
GuildMgr::~GuildMgr() GuildMgr::~GuildMgr()
{ {
for (GuildMap::iterator itr = m_GuildMap.begin(); itr != m_GuildMap.end(); ++itr) for (GuildMap::iterator itr = m_GuildMap.begin(); itr != m_GuildMap.end(); ++itr)
{
delete itr->second; delete itr->second;
} }
}
void GuildMgr::AddGuild(Guild* guild) void GuildMgr::AddGuild(Guild* guild)
{ {

View file

@ -698,7 +698,9 @@ void WorldSession::SendListInventory(ObjectGuid vendorguid)
data.WriteGuidMask<3, 6, 5, 2, 7>(vendorguid); data.WriteGuidMask<3, 6, 5, 2, 7>(vendorguid);
for (uint32 i = 0; i < bitFlags.size(); ++i) for (uint32 i = 0; i < bitFlags.size(); ++i)
{
data.WriteBit(bitFlags[i]); data.WriteBit(bitFlags[i]);
}
data.WriteGuidMask<4>(vendorguid); data.WriteGuidMask<4>(vendorguid);
data.FlushBits(); data.FlushBits();
@ -1064,7 +1066,9 @@ void WorldSession::HandleSocketOpcode(WorldPacket& recv_data)
} }
for (int i = 0; i < MAX_GEM_SOCKETS; ++i) for (int i = 0; i < MAX_GEM_SOCKETS; ++i)
{
recv_data >> gemGuids[i]; recv_data >> gemGuids[i];
}
// cheat -> tried to socket same gem multiple times // cheat -> tried to socket same gem multiple times
for (int i = 0; i < MAX_GEM_SOCKETS; ++i) for (int i = 0; i < MAX_GEM_SOCKETS; ++i)
@ -1102,7 +1106,9 @@ void WorldSession::HandleSocketOpcode(WorldPacket& recv_data)
Item* Gems[MAX_GEM_SOCKETS]; Item* Gems[MAX_GEM_SOCKETS];
for (int i = 0; i < MAX_GEM_SOCKETS; ++i) for (int i = 0; i < MAX_GEM_SOCKETS; ++i)
{
Gems[i] = gemGuids[i] ? _player->GetItemByGuid(gemGuids[i]) : NULL; Gems[i] = gemGuids[i] ? _player->GetItemByGuid(gemGuids[i]) : NULL;
}
GemPropertiesEntry const* GemProps[MAX_GEM_SOCKETS]; GemPropertiesEntry const* GemProps[MAX_GEM_SOCKETS];
for (int i = 0; i < MAX_GEM_SOCKETS; ++i) // get geminfo from dbc storage for (int i = 0; i < MAX_GEM_SOCKETS; ++i) // get geminfo from dbc storage
@ -1252,7 +1258,9 @@ void WorldSession::HandleSocketOpcode(WorldPacket& recv_data)
// remove ALL enchants // remove ALL enchants
for (uint32 enchant_slot = SOCK_ENCHANTMENT_SLOT; enchant_slot < SOCK_ENCHANTMENT_SLOT + MAX_GEM_SOCKETS; ++enchant_slot) for (uint32 enchant_slot = SOCK_ENCHANTMENT_SLOT; enchant_slot < SOCK_ENCHANTMENT_SLOT + MAX_GEM_SOCKETS; ++enchant_slot)
{
_player->ApplyEnchantment(itemTarget, EnchantmentSlot(enchant_slot), false); _player->ApplyEnchantment(itemTarget, EnchantmentSlot(enchant_slot), false);
}
for (int i = 0; i < MAX_GEM_SOCKETS; ++i) for (int i = 0; i < MAX_GEM_SOCKETS; ++i)
{ {
@ -1266,7 +1274,9 @@ void WorldSession::HandleSocketOpcode(WorldPacket& recv_data)
} }
for (uint32 enchant_slot = SOCK_ENCHANTMENT_SLOT; enchant_slot < SOCK_ENCHANTMENT_SLOT + MAX_GEM_SOCKETS; ++enchant_slot) for (uint32 enchant_slot = SOCK_ENCHANTMENT_SLOT; enchant_slot < SOCK_ENCHANTMENT_SLOT + MAX_GEM_SOCKETS; ++enchant_slot)
{
_player->ApplyEnchantment(itemTarget, EnchantmentSlot(enchant_slot), true); _player->ApplyEnchantment(itemTarget, EnchantmentSlot(enchant_slot), true);
}
bool SocketBonusToBeActivated = itemTarget->GemsFitSockets();// current socketbonus state bool SocketBonusToBeActivated = itemTarget->GemsFitSockets();// current socketbonus state
if (SocketBonusActivated != SocketBonusToBeActivated) // if there was a change... if (SocketBonusActivated != SocketBonusToBeActivated) // if there was a change...
@ -1443,16 +1453,24 @@ void WorldSession::SendItemSparseDb2Reply(uint32 entry)
buff << uint32(proto->ContainerSlots); buff << uint32(proto->ContainerSlots);
for (uint32 x = 0; x < MAX_ITEM_PROTO_STATS; ++x) for (uint32 x = 0; x < MAX_ITEM_PROTO_STATS; ++x)
{
buff << uint32(proto->ItemStat[x].ItemStatType); buff << uint32(proto->ItemStat[x].ItemStatType);
}
for (uint32 x = 0; x < MAX_ITEM_PROTO_STATS; ++x) for (uint32 x = 0; x < MAX_ITEM_PROTO_STATS; ++x)
{
buff << int32(proto->ItemStat[x].ItemStatValue); buff << int32(proto->ItemStat[x].ItemStatValue);
}
for (uint32 x = 0; x < MAX_ITEM_PROTO_STATS; ++x) for (uint32 x = 0; x < MAX_ITEM_PROTO_STATS; ++x)
{
buff << int32(proto->ItemStat[x].ItemStatType2); buff << int32(proto->ItemStat[x].ItemStatType2);
}
for (uint32 x = 0; x < MAX_ITEM_PROTO_STATS; ++x) for (uint32 x = 0; x < MAX_ITEM_PROTO_STATS; ++x)
{
buff << int32(proto->ItemStat[x].ItemStatValue2); buff << int32(proto->ItemStat[x].ItemStatValue2);
}
buff << uint32(proto->ScalingStatDistribution); buff << uint32(proto->ScalingStatDistribution);
buff << uint32(proto->DamageType); buff << uint32(proto->DamageType);
@ -1460,22 +1478,34 @@ void WorldSession::SendItemSparseDb2Reply(uint32 entry)
buff << float(proto->RangedModRange); buff << float(proto->RangedModRange);
for (uint32 x = 0; x < MAX_ITEM_PROTO_SPELLS; ++x) for (uint32 x = 0; x < MAX_ITEM_PROTO_SPELLS; ++x)
{
buff << int32(proto->Spells[x].SpellId); buff << int32(proto->Spells[x].SpellId);
}
for (uint32 x = 0; x < MAX_ITEM_PROTO_SPELLS; ++x) for (uint32 x = 0; x < MAX_ITEM_PROTO_SPELLS; ++x)
{
buff << uint32(proto->Spells[x].SpellTrigger); buff << uint32(proto->Spells[x].SpellTrigger);
}
for (uint32 x = 0; x < MAX_ITEM_PROTO_SPELLS; ++x) for (uint32 x = 0; x < MAX_ITEM_PROTO_SPELLS; ++x)
{
buff << int32(proto->Spells[x].SpellCharges); buff << int32(proto->Spells[x].SpellCharges);
}
for (uint32 x = 0; x < MAX_ITEM_PROTO_SPELLS; ++x) for (uint32 x = 0; x < MAX_ITEM_PROTO_SPELLS; ++x)
{
buff << int32(proto->Spells[x].SpellCooldown); buff << int32(proto->Spells[x].SpellCooldown);
}
for (uint32 x = 0; x < MAX_ITEM_PROTO_SPELLS; ++x) for (uint32 x = 0; x < MAX_ITEM_PROTO_SPELLS; ++x)
{
buff << uint32(proto->Spells[x].SpellCategory); buff << uint32(proto->Spells[x].SpellCategory);
}
for (uint32 x = 0; x < MAX_ITEM_PROTO_SPELLS; ++x) for (uint32 x = 0; x < MAX_ITEM_PROTO_SPELLS; ++x)
{
buff << int32(proto->Spells[x].SpellCategoryCooldown); buff << int32(proto->Spells[x].SpellCategoryCooldown);
}
buff << uint32(proto->Bonding); buff << uint32(proto->Bonding);
@ -1510,10 +1540,14 @@ void WorldSession::SendItemSparseDb2Reply(uint32 entry)
buff << uint32(proto->TotemCategory); buff << uint32(proto->TotemCategory);
for (uint32 x = 0; x < MAX_ITEM_PROTO_SOCKETS; ++x) for (uint32 x = 0; x < MAX_ITEM_PROTO_SOCKETS; ++x)
{
buff << uint32(proto->Socket[x].Color); buff << uint32(proto->Socket[x].Color);
}
for (uint32 x = 0; x < MAX_ITEM_PROTO_SOCKETS; ++x) for (uint32 x = 0; x < MAX_ITEM_PROTO_SOCKETS; ++x)
{
buff << uint32(proto->Socket[x].Content); buff << uint32(proto->Socket[x].Content);
}
buff << uint32(proto->socketBonus); buff << uint32(proto->socketBonus);
buff << uint32(proto->GemProperties); buff << uint32(proto->GemProperties);

View file

@ -227,7 +227,9 @@ void WorldSession::SendLfgJoinResult(LfgJoinResult result, LFGState state, party
{ {
uint32 packetSize = 0; uint32 packetSize = 0;
for (partyForbidden::const_iterator it = lockedDungeons.begin(); it != lockedDungeons.end(); ++it) for (partyForbidden::const_iterator it = lockedDungeons.begin(); it != lockedDungeons.end(); ++it)
{
packetSize += 12 + uint32(it->second.size()) * 8; packetSize += 12 + uint32(it->second.size()) * 8;
}
WorldPacket data(SMSG_LFG_JOIN_RESULT, packetSize); WorldPacket data(SMSG_LFG_JOIN_RESULT, packetSize);
data << uint32(result); data << uint32(result);
@ -274,13 +276,17 @@ void WorldSession::SendLfgUpdate(bool isGroup, LfgUpdateType updateType, uint32
{ {
data << uint8(0); data << uint8(0);
for (uint32 i = 0; i < 3; ++i) for (uint32 i = 0; i < 3; ++i)
{
data << uint8(0); data << uint8(0);
} }
}
uint8 count = 1; uint8 count = 1;
data << uint8(count); data << uint8(count);
for (uint32 i = 0; i < count; ++i) for (uint32 i = 0; i < count; ++i)
{
data << uint32(id); data << uint32(id);
}
data << ""; data << "";
} }
SendPacket(&data); SendPacket(&data);
@ -334,12 +340,16 @@ void WorldSession::SendLfgUpdate(bool isGroup, LFGPlayerStatus status)
if (isGroup) if (isGroup)
{ {
for (uint32 i = 0; i < 3; ++i) for (uint32 i = 0; i < 3; ++i)
{
data << uint8(0); data << uint8(0);
} }
}
data << uint8(dungeonSize); data << uint8(dungeonSize);
for (std::set<uint32>::iterator it = status.dungeonList.begin(); it != status.dungeonList.end(); ++it) for (std::set<uint32>::iterator it = status.dungeonList.begin(); it != status.dungeonList.end(); ++it)
{
data << uint32(*it); data << uint32(*it);
}
data << status.comment; data << status.comment;
} }
@ -380,7 +390,9 @@ void WorldSession::SendLfgRoleCheckUpdate(LFGRoleCheck const& roleCheck)
data << uint8(dungeons.size()); data << uint8(dungeons.size());
if (!dungeons.empty()) if (!dungeons.empty())
for (std::set<uint32>::iterator it = dungeons.begin(); it != dungeons.end(); ++it) for (std::set<uint32>::iterator it = dungeons.begin(); it != dungeons.end(); ++it)
{
data << uint32(sLFGMgr.GetDungeonEntry(*it)); data << uint32(sLFGMgr.GetDungeonEntry(*it));
}
data << uint8(roleCheck.currentRoles.size()); data << uint8(roleCheck.currentRoles.size());
if (!roleCheck.currentRoles.empty()) if (!roleCheck.currentRoles.empty())

View file

@ -822,7 +822,9 @@ void LFGMgr::AddToQueue(ObjectGuid guid)
// put info into wait time maps for starters // put info into wait time maps for starters
for (roleMap::iterator it = information->currentRoles.begin(); it != information->currentRoles.end(); ++it) for (roleMap::iterator it = information->currentRoles.begin(); it != information->currentRoles.end(); ++it)
{
AddToWaitMap(it->second, information->dungeonList); AddToWaitMap(it->second, information->dungeonList);
}
// just in case someone's already been in the queue. // just in case someone's already been in the queue.
queueSet::iterator qItr = m_queueSet.find(guid); queueSet::iterator qItr = m_queueSet.find(guid);
@ -918,8 +920,10 @@ void LFGMgr::FindQueueMatches()
{ {
// Fetch information on all the queued players/groups // Fetch information on all the queued players/groups
for (queueSet::iterator itr = m_queueSet.begin(); itr != m_queueSet.end(); ++itr) for (queueSet::iterator itr = m_queueSet.begin(); itr != m_queueSet.end(); ++itr)
{
FindSpecificQueueMatches(*itr); FindSpecificQueueMatches(*itr);
} }
}
void LFGMgr::FindSpecificQueueMatches(ObjectGuid guid) void LFGMgr::FindSpecificQueueMatches(ObjectGuid guid)
{ {
@ -1031,7 +1035,9 @@ void LFGMgr::MergeGroups(ObjectGuid guidOne, ObjectGuid guidTwo, std::set<uint32
// move players / roles into a single roleMap // move players / roles into a single roleMap
for (roleMap::iterator it = bufferGroup->currentRoles.begin(); it != bufferGroup->currentRoles.end(); ++it) for (roleMap::iterator it = bufferGroup->currentRoles.begin(); it != bufferGroup->currentRoles.end(); ++it)
{
mainGroup->currentRoles[it->first] = it->second; mainGroup->currentRoles[it->first] = it->second;
}
// update the role count / needed role info // update the role count / needed role info
UpdateNeededRoles(guidOne, mainGroup); UpdateNeededRoles(guidOne, mainGroup);

View file

@ -343,9 +343,11 @@ void MailDraft::SendMailTo(MailReceiver const& receiver, MailSender const& sende
if (!m_items.empty()) if (!m_items.empty())
{ {
for (MailItemMap::iterator mailItemIter = m_items.begin(); mailItemIter != m_items.end(); ++mailItemIter) for (MailItemMap::iterator mailItemIter = m_items.begin(); mailItemIter != m_items.end(); ++mailItemIter)
{
pReceiver->AddMItem(mailItemIter->second); pReceiver->AddMItem(mailItemIter->second);
} }
} }
}
else if (!m_items.empty()) else if (!m_items.empty())
deleteIncludedItems(); deleteIncludedItems();
} }

View file

@ -141,7 +141,9 @@ void WorldSession::HandleSendMail(WorldPacket& recv_data)
ObjectGuid itemGuids[MAX_MAIL_ITEMS]; ObjectGuid itemGuids[MAX_MAIL_ITEMS];
for (uint8 i = 0; i < items_count; ++i) for (uint8 i = 0; i < items_count; ++i)
{
recv_data.ReadGuidMask<2, 6, 3, 7, 1, 0, 4, 5>(itemGuids[i]); recv_data.ReadGuidMask<2, 6, 3, 7, 1, 0, 4, 5>(itemGuids[i]);
}
recv_data.ReadGuidMask<3, 4>(mailboxGuid); recv_data.ReadGuidMask<3, 4>(mailboxGuid);

View file

@ -1759,8 +1759,10 @@ void DungeonMap::UnloadAll(bool pForce)
void DungeonMap::SendResetWarnings(uint32 timeLeft) const void DungeonMap::SendResetWarnings(uint32 timeLeft) const
{ {
for (MapRefManager::const_iterator itr = m_mapRefManager.begin(); itr != m_mapRefManager.end(); ++itr) for (MapRefManager::const_iterator itr = m_mapRefManager.begin(); itr != m_mapRefManager.end(); ++itr)
{
itr->getSource()->SendInstanceResetWarning(GetId(), itr->getSource()->GetDifficulty(IsRaid()), timeLeft); itr->getSource()->SendInstanceResetWarning(GetId(), itr->getSource()->GetDifficulty(IsRaid()), timeLeft);
} }
}
void DungeonMap::SetResetSchedule(bool on) void DungeonMap::SetResetSchedule(bool on)
{ {

View file

@ -47,10 +47,14 @@ MapManager::MapManager()
MapManager::~MapManager() MapManager::~MapManager()
{ {
for (MapMapType::iterator iter = i_maps.begin(); iter != i_maps.end(); ++iter) for (MapMapType::iterator iter = i_maps.begin(); iter != i_maps.end(); ++iter)
{
delete iter->second; delete iter->second;
}
for (TransportSet::iterator i = m_Transports.begin(); i != m_Transports.end(); ++i) for (TransportSet::iterator i = m_Transports.begin(); i != m_Transports.end(); ++i)
{
delete *i; delete *i;
}
DeleteStateMachine(); DeleteStateMachine();
} }
@ -89,8 +93,10 @@ void MapManager::UpdateGridState(grid_state_t state, Map& map, NGridType& ngrid,
void MapManager::InitializeVisibilityDistanceInfo() void MapManager::InitializeVisibilityDistanceInfo()
{ {
for (MapMapType::iterator iter = i_maps.begin(); iter != i_maps.end(); ++iter) for (MapMapType::iterator iter = i_maps.begin(); iter != i_maps.end(); ++iter)
{
(*iter).second->InitVisibilityDistance(); (*iter).second->InitVisibilityDistance();
} }
}
/// @param id - MapId of the to be created map. @param obj WorldObject for which the map is to be created. Must be player for Instancable maps. /// @param id - MapId of the to be created map. @param obj WorldObject for which the map is to be created. Must be player for Instancable maps.
Map* MapManager::CreateMap(uint32 id, const WorldObject* obj) Map* MapManager::CreateMap(uint32 id, const WorldObject* obj)
@ -186,7 +192,9 @@ void MapManager::Update(uint32 diff)
} }
for (MapMapType::iterator iter = i_maps.begin(); iter != i_maps.end(); ++iter) for (MapMapType::iterator iter = i_maps.begin(); iter != i_maps.end(); ++iter)
{
iter->second->Update((uint32)i_timer.GetCurrent()); iter->second->Update((uint32)i_timer.GetCurrent());
}
for (TransportSet::iterator iter = m_Transports.begin(); iter != m_Transports.end(); ++iter) for (TransportSet::iterator iter = m_Transports.begin(); iter != m_Transports.end(); ++iter)
{ {
@ -217,8 +225,10 @@ void MapManager::Update(uint32 diff)
void MapManager::RemoveAllObjectsInRemoveList() void MapManager::RemoveAllObjectsInRemoveList()
{ {
for (MapMapType::iterator iter = i_maps.begin(); iter != i_maps.end(); ++iter) for (MapMapType::iterator iter = i_maps.begin(); iter != i_maps.end(); ++iter)
{
iter->second->RemoveAllObjectsInRemoveList(); iter->second->RemoveAllObjectsInRemoveList();
} }
}
bool MapManager::ExistMapAndVMap(uint32 mapid, float x, float y) bool MapManager::ExistMapAndVMap(uint32 mapid, float x, float y)
{ {
@ -240,7 +250,9 @@ bool MapManager::IsValidMAP(uint32 mapid)
void MapManager::UnloadAll() void MapManager::UnloadAll()
{ {
for (MapMapType::iterator iter = i_maps.begin(); iter != i_maps.end(); ++iter) for (MapMapType::iterator iter = i_maps.begin(); iter != i_maps.end(); ++iter)
{
iter->second->UnloadAll(true); iter->second->UnloadAll(true);
}
while (!i_maps.empty()) while (!i_maps.empty())
{ {

View file

@ -176,8 +176,10 @@ inline void MapManager::DoForAllMapsWithMapId(uint32 mapId, Do& _do)
MapMapType::const_iterator start = i_maps.lower_bound(MapID(mapId, 0)); MapMapType::const_iterator start = i_maps.lower_bound(MapID(mapId, 0));
MapMapType::const_iterator end = i_maps.lower_bound(MapID(mapId + 1, 0)); MapMapType::const_iterator end = i_maps.lower_bound(MapID(mapId + 1, 0));
for (MapMapType::const_iterator itr = start; itr != end; ++itr) for (MapMapType::const_iterator itr = start; itr != end; ++itr)
{
_do(itr->second); _do(itr->second);
} }
}
#define sMapMgr MapManager::Instance() #define sMapMgr MapManager::Instance()

View file

@ -644,10 +644,14 @@ MapPersistentStateManager::~MapPersistentStateManager()
// so we must be prepared for both cases // so we must be prepared for both cases
lock_instLists = true; lock_instLists = true;
for (PersistentStateMap::iterator itr = m_instanceSaveByInstanceId.begin(); itr != m_instanceSaveByInstanceId.end(); ++itr) for (PersistentStateMap::iterator itr = m_instanceSaveByInstanceId.begin(); itr != m_instanceSaveByInstanceId.end(); ++itr)
{
delete itr->second; delete itr->second;
}
for (PersistentStateMap::iterator itr = m_instanceSaveByMapId.begin(); itr != m_instanceSaveByMapId.end(); ++itr) for (PersistentStateMap::iterator itr = m_instanceSaveByMapId.begin(); itr != m_instanceSaveByMapId.end(); ++itr)
{
delete itr->second; delete itr->second;
} }
}
/* /*
- adding instance into manager - adding instance into manager
@ -960,7 +964,9 @@ void MapPersistentStateManager::_ResetOrWarnAll(uint32 mapid, Difficulty difficu
unbindList.push_back((DungeonPersistentState *)itr->second); unbindList.push_back((DungeonPersistentState *)itr->second);
for (auto i : unbindList) for (auto i : unbindList)
{
i->UnbindThisState(); i->UnbindThisState();
}
// reset maps, teleport player automaticaly to their homebinds and unload maps // reset maps, teleport player automaticaly to their homebinds and unload maps
MapPersistantStateResetWorker worker; MapPersistantStateResetWorker worker;

View file

@ -135,7 +135,9 @@ void MassMailMgr::GetStatistic(uint32& tasks, uint32& mails, uint32& needTime) c
uint32 mailsCount = 0; uint32 mailsCount = 0;
for (MassMailList::const_iterator mailItr = m_massMails.begin(); mailItr != m_massMails.end(); ++mailItr) for (MassMailList::const_iterator mailItr = m_massMails.begin(); mailItr != m_massMails.end(); ++mailItr)
{
mailsCount += mailItr->m_receivers.size(); mailsCount += mailItr->m_receivers.size();
}
mails = mailsCount; mails = mailsCount;

View file

@ -1689,7 +1689,9 @@ void WorldSession::HandleRequestHotfix(WorldPacket& recv_data)
guids.resize(count); guids.resize(count);
for (uint32 i = 0; i < count; ++i) for (uint32 i = 0; i < count; ++i)
{
recv_data.ReadGuidMask<0, 4, 7, 2, 5, 3, 6, 1>(guids[i]); recv_data.ReadGuidMask<0, 4, 7, 2, 5, 3, 6, 1>(guids[i]);
}
uint32 entry = 0; uint32 entry = 0;
for (uint32 i = 0; i < count; ++i) for (uint32 i = 0; i < count; ++i)

View file

@ -57,7 +57,9 @@ namespace MMAP
~MMapData() ~MMapData()
{ {
for (NavMeshQuerySet::iterator i = navMeshQueries.begin(); i != navMeshQueries.end(); ++i) for (NavMeshQuerySet::iterator i = navMeshQueries.begin(); i != navMeshQueries.end(); ++i)
{
dtFreeNavMeshQuery(i->second); dtFreeNavMeshQuery(i->second);
}
if (navMesh) if (navMesh)
dtFreeNavMesh(navMesh); dtFreeNavMesh(navMesh);

View file

@ -278,7 +278,9 @@ ObjectGridUnloader::Visit(GridRefManager<T> &m)
{ {
// remove all cross-reference before deleting // remove all cross-reference before deleting
for (typename GridRefManager<T>::iterator iter = m.begin(); iter != m.end(); ++iter) for (typename GridRefManager<T>::iterator iter = m.begin(); iter != m.end(); ++iter)
{
iter->getSource()->CleanupsBeforeDelete(); iter->getSource()->CleanupsBeforeDelete();
}
while (!m.isEmpty()) while (!m.isEmpty())
{ {

View file

@ -398,8 +398,10 @@ void WorldSession::SendPetNameQuery(ObjectGuid petguid, uint32 petnumber)
{ {
data << uint8(1); data << uint8(1);
for (int i = 0; i < MAX_DECLINED_NAME_CASES; ++i) for (int i = 0; i < MAX_DECLINED_NAME_CASES; ++i)
{
data << ((Pet*)pet)->GetDeclinedNames()->name[i]; data << ((Pet*)pet)->GetDeclinedNames()->name[i];
} }
}
else else
data << uint8(0); data << uint8(0);
@ -586,7 +588,9 @@ void WorldSession::HandlePetRename(WorldPacket& recv_data)
if (isdeclined) if (isdeclined)
{ {
for (int i = 0; i < MAX_DECLINED_NAME_CASES; ++i) for (int i = 0; i < MAX_DECLINED_NAME_CASES; ++i)
{
CharacterDatabase.escape_string(declinedname.name[i]); CharacterDatabase.escape_string(declinedname.name[i]);
}
CharacterDatabase.PExecute("DELETE FROM character_pet_declinedname WHERE owner = '%u' AND id = '%u'", _player->GetGUIDLow(), pet->GetCharmInfo()->GetPetNumber()); CharacterDatabase.PExecute("DELETE FROM character_pet_declinedname WHERE owner = '%u' AND id = '%u'", _player->GetGUIDLow(), pet->GetCharmInfo()->GetPetNumber());
CharacterDatabase.PExecute("INSERT INTO character_pet_declinedname (id, owner, genitive, dative, accusative, instrumental, prepositional) VALUES ('%u','%u','%s','%s','%s','%s','%s')", CharacterDatabase.PExecute("INSERT INTO character_pet_declinedname (id, owner, genitive, dative, accusative, instrumental, prepositional) VALUES ('%u','%u','%s','%s','%s','%s','%s')",
pet->GetCharmInfo()->GetPetNumber(), _player->GetGUIDLow(), declinedname.name[0].c_str(), declinedname.name[1].c_str(), declinedname.name[2].c_str(), declinedname.name[3].c_str(), declinedname.name[4].c_str()); pet->GetCharmInfo()->GetPetNumber(), _player->GetGUIDLow(), declinedname.name[0].c_str(), declinedname.name[1].c_str(), declinedname.name[2].c_str(), declinedname.name[3].c_str(), declinedname.name[4].c_str());
@ -773,8 +777,10 @@ void WorldSession::SendPetNameInvalid(uint32 error, const std::string& name, Dec
{ {
data << uint8(1); data << uint8(1);
for (uint32 i = 0; i < MAX_DECLINED_NAME_CASES; ++i) for (uint32 i = 0; i < MAX_DECLINED_NAME_CASES; ++i)
{
data << declinedName->name[i]; data << declinedName->name[i];
} }
}
else else
data << uint8(0); data << uint8(0);
SendPacket(&data); SendPacket(&data);

View file

@ -73,7 +73,9 @@ void WorldSession::HandlePetitionBuyOpcode(WorldPacket& recv_data)
recv_data.read_skip<uint32>(); // 0 recv_data.read_skip<uint32>(); // 0
for (int i = 0; i < 10; ++i) for (int i = 0; i < 10; ++i)
{
recv_data.read_skip<std::string>(); recv_data.read_skip<std::string>();
}
recv_data.read_skip<uint32>(); // client index recv_data.read_skip<uint32>(); // client index
recv_data.read_skip<uint32>(); // 0 recv_data.read_skip<uint32>(); // 0

View file

@ -158,7 +158,9 @@ bool PoolGroup<T>::CheckPool() const
{ {
float chance = 0; float chance = 0;
for (uint32 i = 0; i < ExplicitlyChanced.size(); ++i) for (uint32 i = 0; i < ExplicitlyChanced.size(); ++i)
{
chance += ExplicitlyChanced[i].chance; chance += ExplicitlyChanced[i].chance;
}
if (chance != 100 && chance != 0) if (chance != 100 && chance != 0)
{ {
return false; return false;
@ -172,11 +174,15 @@ template <class T>
void PoolGroup<T>::CheckEventLinkAndReport(int16 event_id, std::map<uint32, int16> const& creature2event, std::map<uint32, int16> const& go2event) const void PoolGroup<T>::CheckEventLinkAndReport(int16 event_id, std::map<uint32, int16> const& creature2event, std::map<uint32, int16> const& go2event) const
{ {
for (uint32 i = 0; i < EqualChanced.size(); ++i) for (uint32 i = 0; i < EqualChanced.size(); ++i)
{
EqualChanced[i].template CheckEventLinkAndReport<T>(poolId, event_id, creature2event, go2event); EqualChanced[i].template CheckEventLinkAndReport<T>(poolId, event_id, creature2event, go2event);
}
for (uint32 i = 0; i < ExplicitlyChanced.size(); ++i) for (uint32 i = 0; i < ExplicitlyChanced.size(); ++i)
{
ExplicitlyChanced[i].template CheckEventLinkAndReport<T>(poolId, event_id, creature2event, go2event); ExplicitlyChanced[i].template CheckEventLinkAndReport<T>(poolId, event_id, creature2event, go2event);
} }
}
template <class T> template <class T>
void PoolGroup<T>::SetExcludeObject(uint32 guid, bool state) void PoolGroup<T>::SetExcludeObject(uint32 guid, bool state)
@ -1013,7 +1019,9 @@ void PoolManager::LoadFromDB()
std::ostringstream ss; std::ostringstream ss;
ss << "The pool(s) "; ss << "The pool(s) ";
for (std::set<uint16>::const_iterator itr = checkedPools.begin(); itr != checkedPools.end(); ++itr) for (std::set<uint16>::const_iterator itr = checkedPools.begin(); itr != checkedPools.end(); ++itr)
{
ss << *itr << " "; ss << *itr << " ";
}
ss << "create(s) a circular reference, which can cause the server to freeze.\nRemoving the last link between mother pool " ss << "create(s) a circular reference, which can cause the server to freeze.\nRemoving the last link between mother pool "
<< poolItr->first << " and child pool " << poolItr->second; << poolItr->first << " and child pool " << poolItr->second;
sLog.outErrorDb("%s", ss.str().c_str()); sLog.outErrorDb("%s", ss.str().c_str());

View file

@ -60,8 +60,10 @@ void WorldSession::SendNameQueryOpcode(Player* p)
{ {
data << uint8(1); // is declined data << uint8(1); // is declined
for (int i = 0; i < MAX_DECLINED_NAME_CASES; ++i) for (int i = 0; i < MAX_DECLINED_NAME_CASES; ++i)
{
data << names->name[i]; data << names->name[i];
} }
}
else else
data << uint8(0); // is not declined data << uint8(0); // is not declined
@ -128,8 +130,10 @@ void WorldSession::SendNameQueryOpcodeFromDBCallBack(QueryResult* result, uint32
{ {
data << uint8(1); // is declined data << uint8(1); // is declined
for (int i = 5; i < MAX_DECLINED_NAME_CASES + 5; ++i) for (int i = 5; i < MAX_DECLINED_NAME_CASES + 5; ++i)
{
data << fields[i].GetCppString(); data << fields[i].GetCppString();
} }
}
else else
data << uint8(0); // is not declined data << uint8(0); // is not declined
@ -193,7 +197,9 @@ void WorldSession::HandleCreatureQueryOpcode(WorldPacket& recv_data)
data << uint32(ci->KillCredit[1]); // new in 3.1, kill credit data << uint32(ci->KillCredit[1]); // new in 3.1, kill credit
for (int i = 0; i < MAX_CREATURE_MODEL; ++i) for (int i = 0; i < MAX_CREATURE_MODEL; ++i)
{
data << uint32(ci->ModelId[i]); data << uint32(ci->ModelId[i]);
}
data << float(ci->HealthMultiplier); // health modifier data << float(ci->HealthMultiplier); // health modifier
data << float(ci->PowerMultiplier); // power modifier data << float(ci->PowerMultiplier); // power modifier

View file

@ -78,65 +78,103 @@ Quest::Quest(Field* questRecord)
PortraitTurnInText = questRecord[43].GetCppString(); PortraitTurnInText = questRecord[43].GetCppString();
for (int i = 0; i < QUEST_OBJECTIVES_COUNT; ++i) for (int i = 0; i < QUEST_OBJECTIVES_COUNT; ++i)
{
ObjectiveText[i] = questRecord[44 + i].GetCppString(); ObjectiveText[i] = questRecord[44 + i].GetCppString();
}
for (int i = 0; i < QUEST_ITEM_OBJECTIVES_COUNT; ++i) for (int i = 0; i < QUEST_ITEM_OBJECTIVES_COUNT; ++i)
{
ReqItemId[i] = questRecord[48 + i].GetUInt32(); ReqItemId[i] = questRecord[48 + i].GetUInt32();
}
for (int i = 0; i < QUEST_ITEM_OBJECTIVES_COUNT; ++i) for (int i = 0; i < QUEST_ITEM_OBJECTIVES_COUNT; ++i)
{
ReqItemCount[i] = questRecord[54 + i].GetUInt32(); ReqItemCount[i] = questRecord[54 + i].GetUInt32();
}
for (int i = 0; i < QUEST_SOURCE_ITEM_IDS_COUNT; ++i) for (int i = 0; i < QUEST_SOURCE_ITEM_IDS_COUNT; ++i)
{
ReqSourceId[i] = questRecord[60 + i].GetUInt32(); ReqSourceId[i] = questRecord[60 + i].GetUInt32();
}
for (int i = 0; i < QUEST_SOURCE_ITEM_IDS_COUNT; ++i) for (int i = 0; i < QUEST_SOURCE_ITEM_IDS_COUNT; ++i)
{
ReqSourceCount[i] = questRecord[64 + i].GetUInt32(); ReqSourceCount[i] = questRecord[64 + i].GetUInt32();
}
for (int i = 0; i < QUEST_OBJECTIVES_COUNT; ++i) for (int i = 0; i < QUEST_OBJECTIVES_COUNT; ++i)
{
ReqCreatureOrGOId[i] = questRecord[68 + i].GetInt32(); ReqCreatureOrGOId[i] = questRecord[68 + i].GetInt32();
}
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();
}
ReqSpellLearned = questRecord[88].GetUInt32(); ReqSpellLearned = questRecord[88].GetUInt32();
for (int i = 0; i < QUEST_REWARD_CHOICES_COUNT; ++i) for (int i = 0; i < QUEST_REWARD_CHOICES_COUNT; ++i)
{
RewChoiceItemId[i] = questRecord[89 + i].GetUInt32(); RewChoiceItemId[i] = questRecord[89 + i].GetUInt32();
}
for (int i = 0; i < QUEST_REWARD_CHOICES_COUNT; ++i) for (int i = 0; i < QUEST_REWARD_CHOICES_COUNT; ++i)
{
RewChoiceItemCount[i] = questRecord[95 + i].GetUInt32(); RewChoiceItemCount[i] = questRecord[95 + i].GetUInt32();
}
for (int i = 0; i < QUEST_REWARDS_COUNT; ++i) for (int i = 0; i < QUEST_REWARDS_COUNT; ++i)
{
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)
{
RewCurrencyCount[i] = questRecord[113 + i].GetUInt32(); RewCurrencyCount[i] = questRecord[113 + i].GetUInt32();
}
RewSkill = questRecord[117].GetUInt32(); RewSkill = questRecord[117].GetUInt32();
RewSkillValue = questRecord[118].GetUInt32(); RewSkillValue = questRecord[118].GetUInt32();
for (int i = 0; i < QUEST_REPUTATIONS_COUNT; ++i) for (int i = 0; i < QUEST_REPUTATIONS_COUNT; ++i)
{
RewRepFaction[i] = questRecord[119 + i].GetUInt32(); RewRepFaction[i] = questRecord[119 + i].GetUInt32();
}
for (int i = 0; i < QUEST_REPUTATIONS_COUNT; ++i) for (int i = 0; i < QUEST_REPUTATIONS_COUNT; ++i)
{
RewRepValueId[i] = questRecord[124 + i].GetInt32(); RewRepValueId[i] = questRecord[124 + i].GetInt32();
}
for (int i = 0; i < QUEST_REPUTATIONS_COUNT; ++i) for (int i = 0; i < QUEST_REPUTATIONS_COUNT; ++i)
{
RewRepValue[i] = questRecord[129 + i].GetInt32(); RewRepValue[i] = questRecord[129 + i].GetInt32();
}
RewHonorAddition = questRecord[134].GetUInt32(); RewHonorAddition = questRecord[134].GetUInt32();
RewHonorMultiplier = questRecord[135].GetFloat(); RewHonorMultiplier = questRecord[135].GetFloat();
@ -152,19 +190,27 @@ Quest::Quest(Field* questRecord)
PointOpt = questRecord[145].GetUInt32(); PointOpt = questRecord[145].GetUInt32();
for (int i = 0; i < QUEST_EMOTE_COUNT; ++i) for (int i = 0; i < QUEST_EMOTE_COUNT; ++i)
{
DetailsEmote[i] = questRecord[146 + i].GetUInt32(); DetailsEmote[i] = questRecord[146 + i].GetUInt32();
}
for (int i = 0; i < QUEST_EMOTE_COUNT; ++i) for (int i = 0; i < QUEST_EMOTE_COUNT; ++i)
{
DetailsEmoteDelay[i] = questRecord[150 + i].GetUInt32(); DetailsEmoteDelay[i] = questRecord[150 + i].GetUInt32();
}
IncompleteEmote = questRecord[154].GetUInt32(); IncompleteEmote = questRecord[154].GetUInt32();
CompleteEmote = questRecord[155].GetUInt32(); CompleteEmote = questRecord[155].GetUInt32();
for (int i = 0; i < QUEST_EMOTE_COUNT; ++i) for (int i = 0; i < QUEST_EMOTE_COUNT; ++i)
{
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

@ -59,8 +59,10 @@ ScriptMgr::ScriptMgr() : m_scheduledScripts(0)
ScriptChainMap emptyMap; ScriptChainMap emptyMap;
for (int t = DBS_START; t < DBS_END; ++t) for (int t = DBS_START; t < DBS_END; ++t)
{
m_dbScripts[t] = emptyMap; m_dbScripts[t] = emptyMap;
} }
}
ScriptMgr::~ScriptMgr() ScriptMgr::~ScriptMgr()
{ {
@ -2259,7 +2261,9 @@ void ScriptMgr::LoadScriptBinding()
{ {
#ifdef ENABLE_SD3 #ifdef ENABLE_SD3
for (int i = 0; i < SCRIPTED_MAX_TYPE; ++i) for (int i = 0; i < SCRIPTED_MAX_TYPE; ++i)
{
m_scriptBind[i].clear(); m_scriptBind[i].clear();
}
QueryResult* result = WorldDatabase.PQuery("SELECT type, bind, ScriptName, data FROM script_binding"); QueryResult* result = WorldDatabase.PQuery("SELECT type, bind, ScriptName, data FROM script_binding");
uint32 count = 0; uint32 count = 0;

View file

@ -132,8 +132,10 @@ void LoadSkillDiscoveryTable()
} }
for (SkillLineAbilityMap::const_iterator _spell_idx = bounds.first; _spell_idx != bounds.second; ++_spell_idx) for (SkillLineAbilityMap::const_iterator _spell_idx = bounds.first; _spell_idx != bounds.second; ++_spell_idx)
{
SkillDiscoveryStore[-int32(_spell_idx->second->skillId)].push_back(SkillDiscoveryEntry(spellId, reqSkillValue, chance)); SkillDiscoveryStore[-int32(_spell_idx->second->skillId)].push_back(SkillDiscoveryEntry(spellId, reqSkillValue, chance));
} }
}
else else
{ {
sLog.outErrorDb("Spell (ID: %u) have negative value in `reqSpell` field in `skill_discovery_template` table", spellId); sLog.outErrorDb("Spell (ID: %u) have negative value in `reqSpell` field in `skill_discovery_template` table", spellId);

View file

@ -424,7 +424,9 @@ Spell::Spell(Unit* caster, SpellEntry const* info, bool triggered, ObjectGuid or
UpdateOriginalCasterPointer(); UpdateOriginalCasterPointer();
for (int i = 0; i < MAX_EFFECT_INDEX; ++i) for (int i = 0; i < MAX_EFFECT_INDEX; ++i)
{
m_currentBasePoints[i] = m_spellInfo->CalculateSimpleValue(SpellEffectIndex(i)); m_currentBasePoints[i] = m_spellInfo->CalculateSimpleValue(SpellEffectIndex(i));
}
m_spellState = SPELL_STATE_CREATED; m_spellState = SPELL_STATE_CREATED;
@ -785,9 +787,11 @@ void Spell::FillTargetMap()
} }
for (UnitList::const_iterator iunit = tmpUnitLists[effToIndex[i]].begin(); iunit != tmpUnitLists[effToIndex[i]].end(); ++iunit) for (UnitList::const_iterator iunit = tmpUnitLists[effToIndex[i]].begin(); iunit != tmpUnitLists[effToIndex[i]].end(); ++iunit)
{
AddUnitTarget((*iunit), SpellEffectIndex(i)); AddUnitTarget((*iunit), SpellEffectIndex(i));
} }
} }
}
void Spell::prepareDataForTriggerSystem() void Spell::prepareDataForTriggerSystem()
{ {
@ -3127,9 +3131,11 @@ void Spell::SetTargetMap(SpellEffectIndex effIndex, uint32 targetMode, UnitList&
} }
// Add resulting GOs as GOTargets // Add resulting GOs as GOTargets
for (std::list<GameObject*>::iterator iter = tempTargetGOList.begin(); iter != tempTargetGOList.end(); ++iter) for (std::list<GameObject*>::iterator iter = tempTargetGOList.begin(); iter != tempTargetGOList.end(); ++iter)
{
AddGOTarget(*iter, effIndex); AddGOTarget(*iter, effIndex);
} }
} }
}
SpellCastResult Spell::PreCastCheck(Aura* triggeredByAura /*= NULL*/) SpellCastResult Spell::PreCastCheck(Aura* triggeredByAura /*= NULL*/)
{ {
@ -3612,7 +3618,9 @@ void Spell::cast(bool skipCheck)
// fill initial spell damage from caster for delayed casted spells // fill initial spell damage from caster for delayed casted spells
for (TargetList::iterator ihit = m_UniqueTargetInfo.begin(); ihit != m_UniqueTargetInfo.end(); ++ihit) for (TargetList::iterator ihit = m_UniqueTargetInfo.begin(); ihit != m_UniqueTargetInfo.end(); ++ihit)
{
HandleDelayedSpellLaunch(&(*ihit)); HandleDelayedSpellLaunch(&(*ihit));
}
// Okay, maps created, now prepare flags // Okay, maps created, now prepare flags
m_immediateHandled = false; m_immediateHandled = false;
@ -3680,10 +3688,14 @@ void Spell::handle_immediate()
} }
for (TargetList::iterator ihit = m_UniqueTargetInfo.begin(); ihit != m_UniqueTargetInfo.end(); ++ihit) for (TargetList::iterator ihit = m_UniqueTargetInfo.begin(); ihit != m_UniqueTargetInfo.end(); ++ihit)
{
DoAllEffectOnTarget(&(*ihit)); DoAllEffectOnTarget(&(*ihit));
}
for (GOTargetList::iterator ihit = m_UniqueGOTargetInfo.begin(); ihit != m_UniqueGOTargetInfo.end(); ++ihit) for (GOTargetList::iterator ihit = m_UniqueGOTargetInfo.begin(); ihit != m_UniqueGOTargetInfo.end(); ++ihit)
{
DoAllEffectOnTarget(&(*ihit)); DoAllEffectOnTarget(&(*ihit));
}
// spell is finished, perform some last features of the spell here // spell is finished, perform some last features of the spell here
_handle_finish_phase(); _handle_finish_phase();
@ -3776,7 +3788,9 @@ void Spell::_handle_immediate_phase()
// process items // process items
for (ItemTargetList::iterator ihit = m_UniqueItemInfo.begin(); ihit != m_UniqueItemInfo.end(); ++ihit) for (ItemTargetList::iterator ihit = m_UniqueItemInfo.begin(); ihit != m_UniqueItemInfo.end(); ++ihit)
{
DoAllEffectOnTarget(&(*ihit)); DoAllEffectOnTarget(&(*ihit));
}
// process ground // process ground
for (int j = 0; j < MAX_EFFECT_INDEX; ++j) for (int j = 0; j < MAX_EFFECT_INDEX; ++j)
@ -4237,16 +4251,20 @@ void Spell::SendSpellStart()
data << uint8(m_runesState); data << uint8(m_runesState);
data << uint8(caster->GetRunesState()); data << uint8(caster->GetRunesState());
for (uint8 i = 0; i < MAX_RUNES; ++i) for (uint8 i = 0; i < MAX_RUNES; ++i)
{
data << uint8(caster->GetRuneCooldownFraction(i)); data << uint8(caster->GetRuneCooldownFraction(i));
} }
}
else else
{ {
data << uint8(0); data << uint8(0);
data << uint8(0); data << uint8(0);
for (uint8 i = 0; i < MAX_RUNES; ++i) for (uint8 i = 0; i < MAX_RUNES; ++i)
{
data << uint8(0); data << uint8(0);
} }
} }
}
if (castFlags & CAST_FLAG_AMMO) // projectile info if (castFlags & CAST_FLAG_AMMO) // projectile info
WriteAmmoToPacket(&data); WriteAmmoToPacket(&data);
@ -4335,16 +4353,20 @@ void Spell::SendSpellGo()
data << uint8(m_runesState); data << uint8(m_runesState);
data << uint8(caster->GetRunesState()); data << uint8(caster->GetRunesState());
for (uint8 i = 0; i < MAX_RUNES; ++i) for (uint8 i = 0; i < MAX_RUNES; ++i)
{
data << uint8(255 - ((caster->GetRuneCooldown(i) / REGEN_TIME_FULL) * 51)); data << uint8(255 - ((caster->GetRuneCooldown(i) / REGEN_TIME_FULL) * 51));
} }
}
else else
{ {
data << uint8(0); data << uint8(0);
data << uint8(0); data << uint8(0);
for (uint8 i = 0; i < MAX_RUNES; ++i) for (uint8 i = 0; i < MAX_RUNES; ++i)
{
data << uint8(0); data << uint8(0);
} }
} }
}
if (castFlags & CAST_FLAG_ADJUST_MISSILE) // adjust missile trajectory duration if (castFlags & CAST_FLAG_ADJUST_MISSILE) // adjust missile trajectory duration
{ {
@ -5264,8 +5286,10 @@ void Spell::CastTriggerSpells()
void Spell::CastPreCastSpells(Unit* target) void Spell::CastPreCastSpells(Unit* target)
{ {
for (SpellInfoList::const_iterator si = m_preCastSpells.begin(); si != m_preCastSpells.end(); ++si) for (SpellInfoList::const_iterator si = m_preCastSpells.begin(); si != m_preCastSpells.end(); ++si)
{
m_caster->CastSpell(target, (*si), true, m_CastItem); m_caster->CastSpell(target, (*si), true, m_CastItem);
} }
}
Unit* Spell::GetPrefilledUnitTargetOrUnitTarget(SpellEffectIndex effIndex) const Unit* Spell::GetPrefilledUnitTargetOrUnitTarget(SpellEffectIndex effIndex) const
{ {

View file

@ -1309,7 +1309,9 @@ void Aura::TriggerSpell()
Cell::VisitWorldObjects(GetTarget(), checker, 100.0f); Cell::VisitWorldObjects(GetTarget(), checker, 100.0f);
for (std::list<Player*>::iterator itr = targets.begin(); itr != targets.end(); ++itr) for (std::list<Player*>::iterator itr = targets.begin(); itr != targets.end(); ++itr)
{
(*itr)->CastSpell((*itr), debuffSpellId, true, NULL, NULL, casterGUID); (*itr)->CastSpell((*itr), debuffSpellId, true, NULL, NULL, casterGUID);
}
return; return;
} }
@ -1608,9 +1610,13 @@ void Aura::TriggerSpell()
{ {
// cast 24 spells 34269-34289, 34314-34316 // cast 24 spells 34269-34289, 34314-34316
for (uint32 spell_id = 34269; spell_id != 34290; ++spell_id) for (uint32 spell_id = 34269; spell_id != 34290; ++spell_id)
{
triggerTarget->CastSpell(triggerTarget, spell_id, true, NULL, this, casterGUID); triggerTarget->CastSpell(triggerTarget, spell_id, true, NULL, this, casterGUID);
}
for (uint32 spell_id = 34314; spell_id != 34317; ++spell_id) for (uint32 spell_id = 34314; spell_id != 34317; ++spell_id)
{
triggerTarget->CastSpell(triggerTarget, spell_id, true, NULL, this, casterGUID); triggerTarget->CastSpell(triggerTarget, spell_id, true, NULL, this, casterGUID);
}
return; return;
} }
// // Gravity Lapse // // Gravity Lapse
@ -3612,9 +3618,11 @@ void Aura::HandleAuraDummy(bool apply, bool Real)
target->GetZoneAndAreaId(zone, area); target->GetZoneAndAreaId(zone, area);
for (SpellAreaForAreaMap::const_iterator itr = saBounds.first; itr != saBounds.second; ++itr) for (SpellAreaForAreaMap::const_iterator itr = saBounds.first; itr != saBounds.second; ++itr)
{
itr->second->ApplyOrRemoveSpellIfCan((Player*)target, zone, area, false); itr->second->ApplyOrRemoveSpellIfCan((Player*)target, zone, area, false);
} }
} }
}
// script has to "handle with care", only use where data are not ok to use in the above code. // script has to "handle with care", only use where data are not ok to use in the above code.
if (target->GetTypeId() == TYPEID_UNIT) if (target->GetTypeId() == TYPEID_UNIT)
@ -7189,7 +7197,9 @@ void Aura::HandleNoReagentUseAura(bool /*Apply*/, bool Real)
ClassFamilyMask mask; ClassFamilyMask mask;
Unit::AuraList const& noReagent = target->GetAurasByType(SPELL_AURA_NO_REAGENT_USE); Unit::AuraList const& noReagent = target->GetAurasByType(SPELL_AURA_NO_REAGENT_USE);
for (Unit::AuraList::const_iterator i = noReagent.begin(); i != noReagent.end(); ++i) for (Unit::AuraList::const_iterator i = noReagent.begin(); i != noReagent.end(); ++i)
{
mask |= (*i)->GetAuraSpellClassMask(); mask |= (*i)->GetAuraSpellClassMask();
}
target->SetUInt64Value(PLAYER_NO_REAGENT_COST_1 + 0, mask.Flags); target->SetUInt64Value(PLAYER_NO_REAGENT_COST_1 + 0, mask.Flags);
target->SetUInt32Value(PLAYER_NO_REAGENT_COST_1 + 2, mask.Flags2); target->SetUInt32Value(PLAYER_NO_REAGENT_COST_1 + 2, mask.Flags2);
@ -9606,10 +9616,12 @@ void Aura::HandlePhase(bool apply, bool Real)
target->GetZoneAndAreaId(zone, area); target->GetZoneAndAreaId(zone, area);
for (SpellAreaForAreaMap::const_iterator itr = saBounds.first; itr != saBounds.second; ++itr) for (SpellAreaForAreaMap::const_iterator itr = saBounds.first; itr != saBounds.second; ++itr)
{
itr->second->ApplyOrRemoveSpellIfCan((Player*)target, zone, area, false); itr->second->ApplyOrRemoveSpellIfCan((Player*)target, zone, area, false);
} }
} }
} }
}
void Aura::HandleAuraSafeFall(bool Apply, bool Real) void Aura::HandleAuraSafeFall(bool Apply, bool Real)
{ {

View file

@ -1560,7 +1560,9 @@ void Spell::EffectDummy(SpellEffectEntry const* effect)
std::random_shuffle(spellPool.begin(), spellPool.end()); std::random_shuffle(spellPool.begin(), spellPool.end());
for (uint8 i = 0; i < (m_caster->GetMap()->IsRegularDifficulty() ? 2 : 4); ++i) for (uint8 i = 0; i < (m_caster->GetMap()->IsRegularDifficulty() ? 2 : 4); ++i)
{
m_caster->CastSpell(m_caster, spellPool[i], true); m_caster->CastSpell(m_caster, spellPool[i], true);
}
return; return;
} }
@ -3010,7 +3012,9 @@ void Spell::EffectDummy(SpellEffectEntry const* effect)
uint32 random = urand(3, 5); uint32 random = urand(3, 5);
for (uint32 i = 0; i < random; ++i) for (uint32 i = 0; i < random; ++i)
{
m_caster->CastSpell(m_caster, 55528, true); m_caster->CastSpell(m_caster, 55528, true);
}
return; return;
} }
@ -3141,7 +3145,9 @@ void Spell::EffectDummy(SpellEffectEntry const* effect)
} }
for (uint8 i = 0; i < 5; ++i) for (uint8 i = 0; i < 5; ++i)
{
m_caster->CastSpell(unitTarget, effect->CalculateSimpleValue(), true); m_caster->CastSpell(unitTarget, effect->CalculateSimpleValue(), true);
}
return; return;
} }
case 63030: // Boil Ominously case 63030: // Boil Ominously
@ -4133,7 +4139,9 @@ void Spell::EffectDummy(SpellEffectEntry const* effect)
// Righteous Defense (step 2) (in old version 31980 dummy effect) // Righteous Defense (step 2) (in old version 31980 dummy effect)
// Clear targets for eff 1 // Clear targets for eff 1
for (TargetList::iterator ihit = m_UniqueTargetInfo.begin(); ihit != m_UniqueTargetInfo.end(); ++ihit) for (TargetList::iterator ihit = m_UniqueTargetInfo.begin(); ihit != m_UniqueTargetInfo.end(); ++ihit)
{
ihit->effectMask &= ~(1 << 1); ihit->effectMask &= ~(1 << 1);
}
// not empty (checked), copy // not empty (checked), copy
Unit::AttackerSet attackers = friendTarget->getAttackers(); Unit::AttackerSet attackers = friendTarget->getAttackers();
@ -9033,7 +9041,9 @@ void Spell::EffectScriptEffect(SpellEffectEntry const* effect)
// Summon 4 clones of the same player // Summon 4 clones of the same player
for (uint8 i = 0; i < 4; ++i) for (uint8 i = 0; i < 4; ++i)
{
unitTarget->CastSpell(unitTarget, 45891, true, NULL, NULL, m_caster->GetObjectGuid()); unitTarget->CastSpell(unitTarget, 45891, true, NULL, NULL, m_caster->GetObjectGuid());
}
return; return;
} }
case 45918: // Soul Sever case 45918: // Soul Sever
@ -9128,13 +9138,19 @@ void Spell::EffectScriptEffect(SpellEffectEntry const* effect)
// Quest - Jormungar Explosion Summon Object // Quest - Jormungar Explosion Summon Object
for (int i = 0; i < 2; ++i) for (int i = 0; i < 2; ++i)
{
m_caster->CastSpell(m_caster, 47309, true); m_caster->CastSpell(m_caster, 47309, true);
}
for (int i = 0; i < 2; ++i) for (int i = 0; i < 2; ++i)
{
m_caster->CastSpell(m_caster, 47924, true); m_caster->CastSpell(m_caster, 47924, true);
}
for (int i = 0; i < 2; ++i) for (int i = 0; i < 2; ++i)
{
m_caster->CastSpell(m_caster, 47925, true); m_caster->CastSpell(m_caster, 47925, true);
}
return; return;
} }
@ -9687,13 +9703,19 @@ void Spell::EffectScriptEffect(SpellEffectEntry const* effect)
// Quest - Mammoth Explosion Summon Object // Quest - Mammoth Explosion Summon Object
for (int i = 0; i < 2; ++i) for (int i = 0; i < 2; ++i)
{
m_caster->CastSpell(m_caster, 54623, true); m_caster->CastSpell(m_caster, 54623, true);
}
for (int i = 0; i < 2; ++i) for (int i = 0; i < 2; ++i)
{
m_caster->CastSpell(m_caster, 54627, true); m_caster->CastSpell(m_caster, 54627, true);
}
for (int i = 0; i < 2; ++i) for (int i = 0; i < 2; ++i)
{
m_caster->CastSpell(m_caster, 54628, true); m_caster->CastSpell(m_caster, 54628, true);
}
// Summon Main Mammoth Meat // Summon Main Mammoth Meat
m_caster->CastSpell(m_caster, 57444, true); m_caster->CastSpell(m_caster, 57444, true);
@ -9901,8 +9923,10 @@ void Spell::EffectScriptEffect(SpellEffectEntry const* effect)
uint32 stackAmount = urand(1, GetSpellStore()->LookupEntry(62239)->GetStackAmount()); uint32 stackAmount = urand(1, GetSpellStore()->LookupEntry(62239)->GetStackAmount());
for (uint8 i = 0; i < stackAmount; ++i) for (uint8 i = 0; i < stackAmount; ++i)
{
unitTarget->CastSpell(unitTarget, 62239, true); unitTarget->CastSpell(unitTarget, 62239, true);
} }
}
return; return;
} }
case 62282: // Iron Roots case 62282: // Iron Roots
@ -10005,7 +10029,9 @@ void Spell::EffectScriptEffect(SpellEffectEntry const* effect)
uint32 spellId = effect->CalculateSimpleValue(); uint32 spellId = effect->CalculateSimpleValue();
for (uint32 i = 0; i < 10; ++i) for (uint32 i = 0; i < 10; ++i)
{
m_caster->CastSpell(m_caster, spellId, true); m_caster->CastSpell(m_caster, spellId, true);
}
return; return;
} }
@ -10060,7 +10086,9 @@ void Spell::EffectScriptEffect(SpellEffectEntry const* effect)
} }
for (uint8 i = 0; i < 15; ++i) for (uint8 i = 0; i < 15; ++i)
{
unitTarget->CastSpell(unitTarget, 65347, true); unitTarget->CastSpell(unitTarget, 65347, true);
}
return; return;
} }
case 63119: // Block! case 63119: // Block!
@ -10107,7 +10135,9 @@ void Spell::EffectScriptEffect(SpellEffectEntry const* effect)
} }
for (uint8 i = 0; i < 5; ++i) for (uint8 i = 0; i < 5; ++i)
{
unitTarget->CastSpell(unitTarget, effect->CalculateSimpleValue(), true); unitTarget->CastSpell(unitTarget, effect->CalculateSimpleValue(), true);
}
return; return;
} }
case 63667: // Napalm Shell case 63667: // Napalm Shell
@ -10373,7 +10403,9 @@ void Spell::EffectScriptEffect(SpellEffectEntry const* effect)
} }
for (uint8 i = 0; i < 11; ++i) for (uint8 i = 0; i < 11; ++i)
{
unitTarget->CastSpell(unitTarget, effect->CalculateSimpleValue(), true); unitTarget->CastSpell(unitTarget, effect->CalculateSimpleValue(), true);
}
return; return;
} }
@ -10638,7 +10670,9 @@ void Spell::EffectScriptEffect(SpellEffectEntry const* effect)
// Cast summon spells 72701, 72702, 72703, 72704 // Cast summon spells 72701, 72702, 72703, 72704
for (uint32 triggeredSpell = effect->CalculateSimpleValue(); triggeredSpell < m_spellInfo->Id; ++triggeredSpell) for (uint32 triggeredSpell = effect->CalculateSimpleValue(); triggeredSpell < m_spellInfo->Id; ++triggeredSpell)
{
unitTarget->CastSpell(unitTarget, triggeredSpell, true); unitTarget->CastSpell(unitTarget, triggeredSpell, true);
}
return; return;
} }

View file

@ -781,8 +781,10 @@ void WorldSession::HandleGetMirrorimageData(WorldPacket& recv_data)
data << ObjectGuid(); data << ObjectGuid();
for (int i = 0; i < 11; ++i) for (int i = 0; i < 11; ++i)
{
data << (uint32)0; data << (uint32)0;
} }
}
SendPacket(&data); SendPacket(&data);
} }

View file

@ -148,7 +148,9 @@ void WorldSession::SendUpdateTrade(bool trader_state /*= true*/)
data.WriteGuidBytes<1>(creatorGuid); data.WriteGuidBytes<1>(creatorGuid);
data << uint32(item->GetEnchantmentId(PERM_ENCHANTMENT_SLOT)); data << uint32(item->GetEnchantmentId(PERM_ENCHANTMENT_SLOT));
for (uint32 enchant_slot = SOCK_ENCHANTMENT_SLOT; enchant_slot < SOCK_ENCHANTMENT_SLOT + MAX_GEM_SOCKETS; ++enchant_slot) for (uint32 enchant_slot = SOCK_ENCHANTMENT_SLOT; enchant_slot < SOCK_ENCHANTMENT_SLOT + MAX_GEM_SOCKETS; ++enchant_slot)
{
data << uint32(item->GetEnchantmentId(EnchantmentSlot(enchant_slot))); data << uint32(item->GetEnchantmentId(EnchantmentSlot(enchant_slot)));
}
data << uint32(item->GetUInt32Value(ITEM_FIELD_MAXDURABILITY)); data << uint32(item->GetUInt32Value(ITEM_FIELD_MAXDURABILITY));
data.WriteGuidBytes<6, 2, 7, 4>(creatorGuid); data.WriteGuidBytes<6, 2, 7, 4>(creatorGuid);
data << uint32(item->GetEnchantmentId(REFORGE_ENCHANTMENT_SLOT)); // reforge Id data << uint32(item->GetEnchantmentId(REFORGE_ENCHANTMENT_SLOT)); // reforge Id

View file

@ -115,7 +115,9 @@ void MapManager::LoadTransports()
m_Transports.insert(t); m_Transports.insert(t);
for (std::set<uint32>::const_iterator i = mapsUsed.begin(); i != mapsUsed.end(); ++i) for (std::set<uint32>::const_iterator i = mapsUsed.begin(); i != mapsUsed.end(); ++i)
{
m_TransportsByMap[*i].insert(t); m_TransportsByMap[*i].insert(t);
}
// If we someday decide to use the grid to track transports, here: // If we someday decide to use the grid to track transports, here:
t->SetMap(sMapMgr.CreateMap(mapid, t)); t->SetMap(sMapMgr.CreateMap(mapid, t));

View file

@ -2604,7 +2604,9 @@ SpellAuraProcResult Unit::HandleDummyAuraProc(Unit* pVictim, uint32 damage, Aura
// Attack Twice // Attack Twice
for (uint32 i = 0; i < 2; ++i) for (uint32 i = 0; i < 2; ++i)
{
CastCustomSpell(pVictim, triggered_spell_id, &basepoints[0], NULL, NULL, true, castItem, triggeredByAura); CastCustomSpell(pVictim, triggered_spell_id, &basepoints[0], NULL, NULL, true, castItem, triggeredByAura);
}
return SPELL_AURA_PROC_OK; return SPELL_AURA_PROC_OK;
} }

View file

@ -124,8 +124,10 @@ bool UpdateData::BuildPacket(WorldPacket* packet)
buf << uint32(m_outOfRangeGUIDs.size()); buf << uint32(m_outOfRangeGUIDs.size());
for (GuidSet::const_iterator i = m_outOfRangeGUIDs.begin(); i != m_outOfRangeGUIDs.end(); ++i) for (GuidSet::const_iterator i = m_outOfRangeGUIDs.begin(); i != m_outOfRangeGUIDs.end(); ++i)
{
buf << i->WriteAsPacked(); buf << i->WriteAsPacked();
} }
}
buf.append(m_data); buf.append(m_data);

View file

@ -56,8 +56,10 @@ WaypointBehavior::WaypointBehavior(const WaypointBehavior& b)
model1 = b.model1; model1 = b.model1;
model2 = b.model2; model2 = b.model2;
for (int i = 0; i < MAX_WAYPOINT_TEXT; ++i) for (int i = 0; i < MAX_WAYPOINT_TEXT; ++i)
{
textid[i] = b.textid[i]; textid[i] = b.textid[i];
} }
}
void WaypointManager::Load() void WaypointManager::Load()
{ {
@ -401,9 +403,11 @@ void WaypointManager::Load()
if (!movementScriptSet.empty()) if (!movementScriptSet.empty())
{ {
for (std::set<uint32>::const_iterator itr = movementScriptSet.begin(); itr != movementScriptSet.end(); ++itr) for (std::set<uint32>::const_iterator itr = movementScriptSet.begin(); itr != movementScriptSet.end(); ++itr)
{
sLog.outErrorDb("Table `dbscripts_on_creature_movement` contain unused script, id %u.", *itr); sLog.outErrorDb("Table `dbscripts_on_creature_movement` contain unused script, id %u.", *itr);
} }
} }
}
void WaypointManager::Unload() void WaypointManager::Unload()
{ {
@ -423,7 +427,9 @@ void WaypointManager::Unload()
void WaypointManager::_clearPath(WaypointPath& path) void WaypointManager::_clearPath(WaypointPath& path)
{ {
for (WaypointPath::const_iterator itr = path.begin(); itr != path.end(); ++itr) for (WaypointPath::const_iterator itr = path.begin(); itr != path.end(); ++itr)
{
delete itr->second.behavior; delete itr->second.behavior;
}
path.clear(); path.clear();
} }

View file

@ -462,7 +462,9 @@ WeatherSystem::~WeatherSystem()
{ {
///- Empty the WeatherMap ///- Empty the WeatherMap
for (WeatherMap::const_iterator itr = m_weathers.begin(); itr != m_weathers.end(); ++itr) for (WeatherMap::const_iterator itr = m_weathers.begin(); itr != m_weathers.end(); ++itr)
{
delete itr->second; delete itr->second;
}
m_weathers.clear(); m_weathers.clear();
} }

View file

@ -161,13 +161,19 @@ World::~World()
///- Empty the kicked session set ///- Empty the kicked session set
for (auto const session : m_sessions) for (auto const session : m_sessions)
{
delete session.second; delete session.second;
}
for (auto const cliCommand : m_cliCommandQueue) for (auto const cliCommand : m_cliCommandQueue)
{
delete cliCommand; delete cliCommand;
}
for (auto const session : m_sessionAddQueue) for (auto const session : m_sessionAddQueue)
{
delete session; delete session;
}
VMAP::VMapFactory::clear(); VMAP::VMapFactory::clear();
MMAP::MMapFactory::clear(); MMAP::MMapFactory::clear();
@ -1692,7 +1698,9 @@ void World::showFooter()
std::string sModules; std::string sModules;
for (std::set<std::string>::const_iterator it = modules_.begin(); it != modules_.end(); ++it) for (std::set<std::string>::const_iterator it = modules_.begin(); it != modules_.end(); ++it)
{
sModules = sModules + " \n" + *it; sModules = sModules + " \n" + *it;
}
sLog.outString("\n" sLog.outString("\n"
"_______________________________________________________\n" "_______________________________________________________\n"

View file

@ -365,7 +365,9 @@ char* DB2FileLoader::AutoProduceStringsArrayHolders(const char* format, char* da
// dbc strings expected to have at least empty string // dbc strings expected to have at least empty string
for(size_t i = 0; i < stringHoldersPoolSize / sizeof(char*); ++i) for(size_t i = 0; i < stringHoldersPoolSize / sizeof(char*); ++i)
{
((char const**)stringHoldersPool)[i] = nullStr; ((char const**)stringHoldersPool)[i] = nullStr;
}
uint32 offset=0; uint32 offset=0;

View file

@ -307,7 +307,9 @@ char* DBCFileLoader::AutoProduceStringsArrayHolders(const char* format, char* da
// dbc strings expected to have at least empty string // dbc strings expected to have at least empty string
for(size_t i = 0; i < stringHoldersPoolSize / sizeof(char*); ++i) for(size_t i = 0; i < stringHoldersPoolSize / sizeof(char*); ++i)
{
((char const**)stringHoldersPool)[i] = nullStr; ((char const**)stringHoldersPool)[i] = nullStr;
}
uint32 offset=0; uint32 offset=0;

View file

@ -34,8 +34,10 @@ QueryResultMysql::QueryResultMysql(MYSQL_RES* result, MYSQL_FIELD* fields, uint6
MANGOS_ASSERT(mCurrentRow); MANGOS_ASSERT(mCurrentRow);
for (uint32 i = 0; i < mFieldCount; ++i) for (uint32 i = 0; i < mFieldCount; ++i)
{
mCurrentRow[i].SetType(ConvertNativeType(fields[i].type)); mCurrentRow[i].SetType(ConvertNativeType(fields[i].type));
} }
}
QueryResultMysql::~QueryResultMysql() QueryResultMysql::~QueryResultMysql()
{ {

View file

@ -54,8 +54,10 @@ void BitStream::WriteBit(uint32 bit)
template <typename T> void BitStream::WriteBits(T value, size_t bits) template <typename T> void BitStream::WriteBits(T value, size_t bits)
{ {
for (int32 i = bits-1; i >= 0; --i) for (int32 i = bits-1; i >= 0; --i)
{
WriteBit((value >> i) & 1); WriteBit((value >> i) & 1);
} }
}
bool BitStream::Empty() bool BitStream::Empty()
{ {
@ -69,15 +71,19 @@ void BitStream::Reverse()
Clear(); Clear();
for(uint32 i = len; i > 0; --i) for(uint32 i = len; i > 0; --i)
{
WriteBit(b[i-1]); WriteBit(b[i-1]);
} }
}
void BitStream::Print() void BitStream::Print()
{ {
std::stringstream ss; std::stringstream ss;
ss << "BitStream: "; ss << "BitStream: ";
for (uint32 i = 0; i < GetLength(); ++i) for (uint32 i = 0; i < GetLength(); ++i)
{
ss << uint32(GetBit(i)) << " "; ss << uint32(GetBit(i)) << " ";
}
sLog.outDebug("%s", ss.str().c_str()); sLog.outDebug("%s", ss.str().c_str());
} }

View file

@ -244,8 +244,10 @@ class ByteBuffer
template <typename T> void WriteBits(T value, size_t bits) template <typename T> void WriteBits(T value, size_t bits)
{ {
for (int32 i = bits-1; i >= 0; --i) for (int32 i = bits-1; i >= 0; --i)
{
WriteBit((value >> i) & 1); WriteBit((value >> i) & 1);
} }
}
uint32 ReadBits(size_t bits) uint32 ReadBits(size_t bits)
{ {
@ -261,7 +263,9 @@ class ByteBuffer
{ {
BitStream b; BitStream b;
for (uint32 i = 0; i < len; ++i) for (uint32 i = 0; i < len; ++i)
{
b.WriteBit(ReadBit()); b.WriteBit(ReadBit());
}
return b; return b;
} }
@ -270,8 +274,10 @@ class ByteBuffer
uint8* guidByte = ((uint8*)&guid); uint8* guidByte = ((uint8*)&guid);
for (uint8 i = 0; i < maskCount; i++) for (uint8 i = 0; i < maskCount; i++)
{
WriteBit(guidByte[maskOrder[i + maskPos]]); WriteBit(guidByte[maskOrder[i + maskPos]]);
} }
}
void WriteGuidBytes(uint64 guid, uint8* byteOrder, uint8 byteCount, uint8 bytePos) void WriteGuidBytes(uint64 guid, uint8* byteOrder, uint8 byteCount, uint8 bytePos)
{ {
@ -1081,7 +1087,9 @@ class ByteBuffer
{ {
sLog.outDebug("STORAGE_SIZE: %lu", (unsigned long)size() ); sLog.outDebug("STORAGE_SIZE: %lu", (unsigned long)size() );
for (uint32 i = 0; i < size(); ++i) for (uint32 i = 0; i < size(); ++i)
{
sLog.outDebug("%u - ", read<uint8>(i) ); sLog.outDebug("%u - ", read<uint8>(i) );
}
sLog.outDebug(" "); sLog.outDebug(" ");
} }
@ -1089,7 +1097,9 @@ class ByteBuffer
{ {
sLog.outDebug("STORAGE_SIZE: %lu", (unsigned long)size() ); sLog.outDebug("STORAGE_SIZE: %lu", (unsigned long)size() );
for (uint32 i = 0; i < size(); ++i) for (uint32 i = 0; i < size(); ++i)
{
sLog.outDebug("%c", read<uint8>(i) ); sLog.outDebug("%c", read<uint8>(i) );
}
sLog.outDebug(" "); sLog.outDebug(" ");
} }

View file

@ -124,7 +124,9 @@ int getBuildNumber()
/// jump over as much of the file as possible, before we start searching for the base # /// jump over as much of the file as possible, before we start searching for the base #
for (int i = 0; i < 3300; i++) for (int i = 0; i < 3300; i++)
{
fread(jumpBytesBuffer, sizeof(jumpBytesBuffer), 1, pFile); fread(jumpBytesBuffer, sizeof(jumpBytesBuffer), 1, pFile);
}
/// Search for the build # /// Search for the build #
while (!bBuildFound && fread(byteSearchBuffer, 1, 1, pFile)) while (!bBuildFound && fread(byteSearchBuffer, 1, 1, pFile))

View file

@ -64,8 +64,10 @@ void fixnamen(char* name, size_t len)
} }
//extension in lowercase //extension in lowercase
for (size_t i = len - 3; i < len; i++) for (size_t i = len - 3; i < len; i++)
{
name[i] |= 0x20; name[i] |= 0x20;
} }
}
void fixname2(char* name, size_t len) void fixname2(char* name, size_t len)
{ {

View file

@ -109,7 +109,9 @@ void ExtractGameobjectModels()
{ {
printf("Warning: Some models could not be extracted, see below\n"); printf("Warning: Some models could not be extracted, see below\n");
for (StringSet::const_iterator itr = failedPaths.begin(); itr != failedPaths.end(); ++itr) for (StringSet::const_iterator itr = failedPaths.begin(); itr != failedPaths.end(); ++itr)
{
printf("Could not find file of model %s\n", itr->c_str()); printf("Could not find file of model %s\n", itr->c_str());
}
printf("A few of these warnings are expected to happen, so be not alarmed!\n"); printf("A few of these warnings are expected to happen, so be not alarmed!\n");
} }