diff options
| author | Chazy Chaz <ChazyTheBest@hotmail.es> | 2017-04-18 13:06:09 +0200 |
|---|---|---|
| committer | Aokromes <Aokromes@users.noreply.github.com> | 2017-04-18 13:06:09 +0200 |
| commit | fbbe247114d092be1d20768419608bfa9cc57608 (patch) | |
| tree | 105acf87cb2c1a9cb521590cb19d32c77380c7e9 /src | |
| parent | db0da2cf5c18522a8f165991b2025f6c4943b77b (diff) | |
Core/Misc: Sync database schema with master
Diffstat (limited to 'src')
| -rw-r--r-- | src/server/game/Achievements/AchievementMgr.cpp | 8 | ||||
| -rw-r--r-- | src/server/game/AuctionHouse/AuctionHouseMgr.cpp | 6 | ||||
| -rw-r--r-- | src/server/game/Entities/Creature/Creature.h | 20 | ||||
| -rw-r--r-- | src/server/game/Entities/Creature/GossipDef.cpp | 68 | ||||
| -rw-r--r-- | src/server/game/Entities/Player/Player.cpp | 38 | ||||
| -rw-r--r-- | src/server/game/Globals/ObjectMgr.cpp | 140 | ||||
| -rw-r--r-- | src/server/game/Globals/ObjectMgr.h | 30 | ||||
| -rw-r--r-- | src/server/game/Handlers/ItemHandler.cpp | 6 | ||||
| -rw-r--r-- | src/server/game/Handlers/NPCHandler.cpp | 26 | ||||
| -rw-r--r-- | src/server/game/Handlers/QueryHandler.cpp | 12 | ||||
| -rw-r--r-- | src/server/scripts/Commands/cs_reload.cpp | 4 |
11 files changed, 182 insertions, 176 deletions
diff --git a/src/server/game/Achievements/AchievementMgr.cpp b/src/server/game/Achievements/AchievementMgr.cpp index 986badd2471..203909f0997 100644 --- a/src/server/game/Achievements/AchievementMgr.cpp +++ b/src/server/game/Achievements/AchievementMgr.cpp @@ -1530,13 +1530,13 @@ void AchievementMgr::CompletedAchievement(AchievementEntry const* achievement) std::string subject = reward->subject; std::string text = reward->text; - int locIdx = GetPlayer()->GetSession()->GetSessionDbLocaleIndex(); - if (locIdx >= 0) + LocaleConstant localeConstant = GetPlayer()->GetSession()->GetSessionDbLocaleIndex(); + if (localeConstant >= LOCALE_enUS) { if (AchievementRewardLocale const* loc = sAchievementMgr->GetAchievementRewardLocale(achievement)) { - ObjectMgr::GetLocaleString(loc->subject, locIdx, subject); - ObjectMgr::GetLocaleString(loc->text, locIdx, text); + ObjectMgr::GetLocaleString(loc->subject, localeConstant, subject); + ObjectMgr::GetLocaleString(loc->text, localeConstant, text); } } diff --git a/src/server/game/AuctionHouse/AuctionHouseMgr.cpp b/src/server/game/AuctionHouse/AuctionHouseMgr.cpp index 7976b38f37c..a6ff7f558a7 100644 --- a/src/server/game/AuctionHouse/AuctionHouseMgr.cpp +++ b/src/server/game/AuctionHouse/AuctionHouseMgr.cpp @@ -682,7 +682,7 @@ void AuctionHouseObject::BuildListAuctionItems(WorldPacket& data, Player* player uint32 inventoryType, uint32 itemClass, uint32 itemSubClass, uint32 quality, uint32& count, uint32& totalcount, bool getall) { - int loc_idx = player->GetSession()->GetSessionDbLocaleIndex(); + LocaleConstant localeConstant = player->GetSession()->GetSessionDbLocaleIndex(); int locdbc_idx = player->GetSession()->GetSessionDbcLocale(); time_t curTime = GameTime::GetGameTime(); @@ -754,9 +754,9 @@ void AuctionHouseObject::BuildListAuctionItems(WorldPacket& data, Player* player continue; // local name - if (loc_idx >= 0) + if (localeConstant >= LOCALE_enUS) if (ItemLocale const* il = sObjectMgr->GetItemLocale(proto->ItemId)) - ObjectMgr::GetLocaleString(il->Name, loc_idx, name); + ObjectMgr::GetLocaleString(il->Name, localeConstant, name); // DO NOT use GetItemEnchantMod(proto->RandomProperty) as it may return a result // that matches the search but it may not equal item->GetItemRandomPropertyId() diff --git a/src/server/game/Entities/Creature/Creature.h b/src/server/game/Entities/Creature/Creature.h index c37acb8c18e..fd1758562b2 100644 --- a/src/server/game/Entities/Creature/Creature.h +++ b/src/server/game/Entities/Creature/Creature.h @@ -254,7 +254,7 @@ struct GossipMenuItemsLocale struct PointOfInterestLocale { - StringVector IconName; + StringVector Name; }; #define MAX_EQUIPMENT_ITEMS 3 @@ -405,21 +405,21 @@ typedef std::list<VendorItemCount> VendorItemCounts; struct TrainerSpell { - TrainerSpell() : spell(0), spellCost(0), reqSkill(0), reqSkillValue(0), reqLevel(0) + TrainerSpell() : SpellID(0), MoneyCost(0), ReqSkillLine(0), ReqSkillRank(0), ReqLevel(0) { for (uint8 i = 0; i < MAX_SPELL_EFFECTS; ++i) - learnedSpell[i] = 0; + ReqAbility[i] = 0; } - uint32 spell; - uint32 spellCost; - uint32 reqSkill; - uint32 reqSkillValue; - uint32 reqLevel; - uint32 learnedSpell[3]; + uint32 SpellID; + uint32 MoneyCost; + uint32 ReqSkillLine; + uint32 ReqSkillRank; + uint32 ReqLevel; + uint32 ReqAbility[3]; // helpers - bool IsCastable() const { return learnedSpell[0] != spell; } + bool IsCastable() const { return ReqAbility[0] != SpellID; } }; typedef std::unordered_map<uint32 /*spellid*/, TrainerSpell> TrainerSpellMap; diff --git a/src/server/game/Entities/Creature/GossipDef.cpp b/src/server/game/Entities/Creature/GossipDef.cpp index 4ace28fc131..3a8eef65c59 100644 --- a/src/server/game/Entities/Creature/GossipDef.cpp +++ b/src/server/game/Entities/Creature/GossipDef.cpp @@ -228,10 +228,10 @@ void PlayerMenu::SendGossipMenu(uint32 titleTextId, ObjectGuid objectGUID) data << uint8(0); // 3.3.3 changes icon: blue question or yellow exclamation std::string title = quest->GetTitle(); - int32 locale = _session->GetSessionDbLocaleIndex(); - if (locale >= 0) + LocaleConstant localeConstant = _session->GetSessionDbLocaleIndex(); + if (localeConstant >= LOCALE_enUS) if (QuestLocale const* localeData = sObjectMgr->GetQuestLocale(questID)) - ObjectMgr::GetLocaleString(localeData->Title, locale, title); + ObjectMgr::GetLocaleString(localeData->Title, localeConstant, title); if (questLevelInTitle) Quest::AddQuestLevelToTitle(title, quest->GetQuestLevel()); @@ -252,28 +252,28 @@ void PlayerMenu::SendCloseGossip() _session->SendPacket(&data); } -void PlayerMenu::SendPointOfInterest(uint32 poiId) const +void PlayerMenu::SendPointOfInterest(uint32 id) const { - PointOfInterest const* poi = sObjectMgr->GetPointOfInterest(poiId); + PointOfInterest const* poi = sObjectMgr->GetPointOfInterest(id); if (!poi) { - TC_LOG_ERROR("sql.sql", "Request to send non-existing POI (Id: %u), ignored.", poiId); + TC_LOG_ERROR("sql.sql", "Request to send non-existing POI (Id: %u), ignored.", id); return; } - std::string iconText = poi->icon_name; - int32 locale = _session->GetSessionDbLocaleIndex(); - if (locale >= 0) - if (PointOfInterestLocale const* localeData = sObjectMgr->GetPointOfInterestLocale(poiId)) - ObjectMgr::GetLocaleString(localeData->IconName, locale, iconText); + std::string name = poi->Name; + LocaleConstant localeConstant = _session->GetSessionDbLocaleIndex(); + if (localeConstant >= LOCALE_enUS) + if (PointOfInterestLocale const* localeData = sObjectMgr->GetPointOfInterestLocale(id)) + ObjectMgr::GetLocaleString(localeData->Name, localeConstant, name); WorldPacket data(SMSG_GOSSIP_POI, 4 + 4 + 4 + 4 + 4 + 10); // guess size - data << uint32(poi->flags); - data << float(poi->x); - data << float(poi->y); - data << uint32(poi->icon); - data << uint32(poi->data); - data << iconText; + data << uint32(poi->Flags); + data << float(poi->PositionX); + data << float(poi->PositionY); + data << uint32(poi->Icon); + data << uint32(poi->Importance); + data << name; _session->SendPacket(&data); } @@ -347,10 +347,10 @@ void PlayerMenu::SendQuestGiverQuestList(QEmote const& eEmote, const std::string ++count; std::string title = quest->GetTitle(); - int32 locale = _session->GetSessionDbLocaleIndex(); - if (locale >= 0) + LocaleConstant localeConstant = _session->GetSessionDbLocaleIndex(); + if (localeConstant >= LOCALE_enUS) if (QuestLocale const* localeData = sObjectMgr->GetQuestLocale(questID)) - ObjectMgr::GetLocaleString(localeData->Title, locale, title); + ObjectMgr::GetLocaleString(localeData->Title, localeConstant, title); if (questLevelInTitle) Quest::AddQuestLevelToTitle(title, quest->GetQuestLevel()); @@ -386,15 +386,15 @@ void PlayerMenu::SendQuestGiverQuestDetails(Quest const* quest, ObjectGuid npcGU std::string questObjectives = quest->GetObjectives(); std::string questAreaDescription = quest->GetAreaDescription(); - int32 locale = _session->GetSessionDbLocaleIndex(); - if (locale >= 0) + LocaleConstant localeConstant = _session->GetSessionDbLocaleIndex(); + if (localeConstant >= LOCALE_enUS) { if (QuestLocale const* localeData = sObjectMgr->GetQuestLocale(quest->GetQuestId())) { - ObjectMgr::GetLocaleString(localeData->Title, locale, questTitle); - ObjectMgr::GetLocaleString(localeData->Details, locale, questDetails); - ObjectMgr::GetLocaleString(localeData->Objectives, locale, questObjectives); - ObjectMgr::GetLocaleString(localeData->AreaDescription, locale, questAreaDescription); + ObjectMgr::GetLocaleString(localeData->Title, localeConstant, questTitle); + ObjectMgr::GetLocaleString(localeData->Details, localeConstant, questDetails); + ObjectMgr::GetLocaleString(localeData->Objectives, localeConstant, questObjectives); + ObjectMgr::GetLocaleString(localeData->AreaDescription, localeConstant, questAreaDescription); } } @@ -505,13 +505,13 @@ void PlayerMenu::SendQuestGiverOfferReward(Quest const* quest, ObjectGuid npcGUI std::string questTitle = quest->GetTitle(); std::string questOfferRewardText = quest->GetOfferRewardText(); - int32 locale = _session->GetSessionDbLocaleIndex(); - if (locale >= 0) + LocaleConstant localeConstant = _session->GetSessionDbLocaleIndex(); + if (localeConstant >= LOCALE_enUS) { if (QuestLocale const* localeData = sObjectMgr->GetQuestLocale(quest->GetQuestId())) { - ObjectMgr::GetLocaleString(localeData->Title, locale, questTitle); - ObjectMgr::GetLocaleString(localeData->OfferRewardText, locale, questOfferRewardText); + ObjectMgr::GetLocaleString(localeData->Title, localeConstant, questTitle); + ObjectMgr::GetLocaleString(localeData->OfferRewardText, localeConstant, questOfferRewardText); } } @@ -602,13 +602,13 @@ void PlayerMenu::SendQuestGiverRequestItems(Quest const* quest, ObjectGuid npcGU std::string questTitle = quest->GetTitle(); std::string requestItemsText = quest->GetRequestItemsText(); - int32 locale = _session->GetSessionDbLocaleIndex(); - if (locale >= 0) + LocaleConstant localeConstant = _session->GetSessionDbLocaleIndex(); + if (localeConstant >= LOCALE_enUS) { if (QuestLocale const* localeData = sObjectMgr->GetQuestLocale(quest->GetQuestId())) { - ObjectMgr::GetLocaleString(localeData->Title, locale, questTitle); - ObjectMgr::GetLocaleString(localeData->RequestItemsText, locale, requestItemsText); + ObjectMgr::GetLocaleString(localeData->Title, localeConstant, questTitle); + ObjectMgr::GetLocaleString(localeData->RequestItemsText, localeConstant, requestItemsText); } } diff --git a/src/server/game/Entities/Player/Player.cpp b/src/server/game/Entities/Player/Player.cpp index e5620a0e0b0..718626e6ad3 100644 --- a/src/server/game/Entities/Player/Player.cpp +++ b/src/server/game/Entities/Player/Player.cpp @@ -4149,10 +4149,10 @@ TrainerSpellState Player::GetTrainerSpellState(TrainerSpell const* trainer_spell bool hasSpell = true; for (uint8 i = 0; i < MAX_SPELL_EFFECTS; ++i) { - if (!trainer_spell->learnedSpell[i]) + if (!trainer_spell->ReqAbility[i]) continue; - if (!HasSpell(trainer_spell->learnedSpell[i])) + if (!HasSpell(trainer_spell->ReqAbility[i])) { hasSpell = false; break; @@ -4163,30 +4163,30 @@ TrainerSpellState Player::GetTrainerSpellState(TrainerSpell const* trainer_spell return TRAINER_SPELL_GRAY; // check skill requirement - if (trainer_spell->reqSkill && GetBaseSkillValue(trainer_spell->reqSkill) < trainer_spell->reqSkillValue) + if (trainer_spell->ReqSkillLine && GetBaseSkillValue(trainer_spell->ReqSkillLine) < trainer_spell->ReqSkillRank) return TRAINER_SPELL_RED; // check level requirement - if (getLevel() < trainer_spell->reqLevel) + if (getLevel() < trainer_spell->ReqLevel) return TRAINER_SPELL_RED; for (uint8 i = 0; i < MAX_SPELL_EFFECTS; ++i) { - if (!trainer_spell->learnedSpell[i]) + if (!trainer_spell->ReqAbility[i]) continue; // check race/class requirement - if (!IsSpellFitByClassAndRace(trainer_spell->learnedSpell[i])) + if (!IsSpellFitByClassAndRace(trainer_spell->ReqAbility[i])) return TRAINER_SPELL_RED; - if (uint32 prevSpell = sSpellMgr->GetPrevSpellInChain(trainer_spell->learnedSpell[i])) + if (uint32 prevSpell = sSpellMgr->GetPrevSpellInChain(trainer_spell->ReqAbility[i])) { // check prev.rank requirement if (prevSpell && !HasSpell(prevSpell)) return TRAINER_SPELL_RED; } - SpellsRequiringSpellMapBounds spellsRequired = sSpellMgr->GetSpellsRequiredForSpellBounds(trainer_spell->learnedSpell[i]); + SpellsRequiringSpellMapBounds spellsRequired = sSpellMgr->GetSpellsRequiredForSpellBounds(trainer_spell->ReqAbility[i]); for (SpellsRequiringSpellMap::const_iterator itr = spellsRequired.first; itr != spellsRequired.second; ++itr) { // check additional spell requirement @@ -4199,9 +4199,9 @@ TrainerSpellState Player::GetTrainerSpellState(TrainerSpell const* trainer_spell // first rank of primary profession spell when there are no professions available is disabled for (uint8 i = 0; i < MAX_SPELL_EFFECTS; ++i) { - if (!trainer_spell->learnedSpell[i]) + if (!trainer_spell->ReqAbility[i]) continue; - SpellInfo const* learnedSpellInfo = sSpellMgr->GetSpellInfo(trainer_spell->learnedSpell[i]); + SpellInfo const* learnedSpellInfo = sSpellMgr->GetSpellInfo(trainer_spell->ReqAbility[i]); if (learnedSpellInfo && learnedSpellInfo->IsPrimaryProfessionFirstRank() && (GetFreePrimaryProfessionPoints() == 0)) return TRAINER_SPELL_GREEN_DISABLED; } @@ -14697,19 +14697,19 @@ void Player::SendPreparedQuest(ObjectGuid guid) { title = gossiptext->Options[0].Text_0; - int loc_idx = GetSession()->GetSessionDbLocaleIndex(); - if (loc_idx >= 0) + LocaleConstant localeConstant = GetSession()->GetSessionDbLocaleIndex(); + if (localeConstant >= LOCALE_enUS) if (NpcTextLocale const* nl = sObjectMgr->GetNpcTextLocale(textid)) - ObjectMgr::GetLocaleString(nl->Text_0[0], loc_idx, title); + ObjectMgr::GetLocaleString(nl->Text_0[0], localeConstant, title); } else { title = gossiptext->Options[0].Text_1; - int loc_idx = GetSession()->GetSessionDbLocaleIndex(); - if (loc_idx >= 0) + LocaleConstant localeConstant = GetSession()->GetSessionDbLocaleIndex(); + if (localeConstant >= LOCALE_enUS) if (NpcTextLocale const* nl = sObjectMgr->GetNpcTextLocale(textid)) - ObjectMgr::GetLocaleString(nl->Text_1[0], loc_idx, title); + ObjectMgr::GetLocaleString(nl->Text_1[0], localeConstant, title); } } } @@ -16782,10 +16782,10 @@ void Player::SendQuestConfirmAccept(const Quest* quest, Player* pReceiver) const { std::string strTitle = quest->GetTitle(); - int loc_idx = pReceiver->GetSession()->GetSessionDbLocaleIndex(); - if (loc_idx >= 0) + LocaleConstant localeConstant = pReceiver->GetSession()->GetSessionDbLocaleIndex(); + if (localeConstant >= LOCALE_enUS) if (const QuestLocale* pLocale = sObjectMgr->GetQuestLocale(quest->GetQuestId())) - ObjectMgr::GetLocaleString(pLocale->Title, loc_idx, strTitle); + ObjectMgr::GetLocaleString(pLocale->Title, localeConstant, strTitle); WorldPacket data(SMSG_QUEST_CONFIRM_ACCEPT, (4 + strTitle.size() + 8)); data << uint32(quest->GetQuestId()); diff --git a/src/server/game/Globals/ObjectMgr.cpp b/src/server/game/Globals/ObjectMgr.cpp index 0b82a4b60c7..587e776ff74 100644 --- a/src/server/game/Globals/ObjectMgr.cpp +++ b/src/server/game/Globals/ObjectMgr.cpp @@ -282,14 +282,14 @@ ObjectMgr::~ObjectMgr() delete itr->second; } -void ObjectMgr::AddLocaleString(std::string const& s, LocaleConstant locale, StringVector& data) +void ObjectMgr::AddLocaleString(std::string const& value, LocaleConstant localeConstant, StringVector& data) { - if (!s.empty()) + if (!value.empty()) { - if (data.size() <= size_t(locale)) - data.resize(locale + 1); + if (data.size() <= size_t(localeConstant)) + data.resize(localeConstant + 1); - data[locale] = s; + data[localeConstant] = value; } } @@ -370,7 +370,8 @@ void ObjectMgr::LoadPointOfInterestLocales() _pointOfInterestLocaleStore.clear(); // need for reload case - QueryResult result = WorldDatabase.Query("SELECT entry, icon_name_loc1, icon_name_loc2, icon_name_loc3, icon_name_loc4, icon_name_loc5, icon_name_loc6, icon_name_loc7, icon_name_loc8 FROM locales_points_of_interest"); + // 0 1 2 + QueryResult result = WorldDatabase.Query("SELECT ID, locale, Name FROM points_of_interest_locale"); if (!result) return; @@ -379,12 +380,14 @@ void ObjectMgr::LoadPointOfInterestLocales() { Field* fields = result->Fetch(); - uint32 entry = fields[0].GetUInt32(); + uint32 id = fields[0].GetUInt32(); + std::string localeName = fields[1].GetString(); + std::string name = fields[2].GetString(); - PointOfInterestLocale& data = _pointOfInterestLocaleStore[entry]; + PointOfInterestLocale& data = _pointOfInterestLocaleStore[id]; + LocaleConstant locale = GetLocaleByName(localeName); - for (uint8 i = TOTAL_LOCALES - 1; i > 0; --i) - AddLocaleString(fields[i].GetString(), LocaleConstant(i), data.IconName); + AddLocaleString(name, locale, data.Name); } while (result->NextRow()); TC_LOG_INFO("server.loading", ">> Loaded %u points_of_interest locale strings in %u ms", uint32(_pointOfInterestLocaleStore.size()), GetMSTimeDiffToNow(oldMSTime)); @@ -5252,10 +5255,10 @@ void ObjectMgr::LoadPageTexts() { Field* fields = result->Fetch(); - PageText& pageText = _pageTextStore[fields[0].GetUInt32()]; + PageText& pageText = _pageTextStore[fields[0].GetUInt32()]; - pageText.Text = fields[1].GetString(); - pageText.NextPage = fields[2].GetUInt32(); + pageText.Text = fields[1].GetString(); + pageText.NextPageID = fields[2].GetUInt32(); ++count; } @@ -5263,11 +5266,11 @@ void ObjectMgr::LoadPageTexts() for (PageTextContainer::const_iterator itr = _pageTextStore.begin(); itr != _pageTextStore.end(); ++itr) { - if (itr->second.NextPage) + if (itr->second.NextPageID) { - PageTextContainer::const_iterator itr2 = _pageTextStore.find(itr->second.NextPage); + PageTextContainer::const_iterator itr2 = _pageTextStore.find(itr->second.NextPageID); if (itr2 == _pageTextStore.end()) - TC_LOG_ERROR("sql.sql", "Page text (Id: %u) has not existing next page (Id: %u)", itr->first, itr->second.NextPage); + TC_LOG_ERROR("sql.sql", "Page text (ID: %u) has non-existing `NextPageID` (%u)", itr->first, itr->second.NextPageID); } } @@ -5290,7 +5293,8 @@ void ObjectMgr::LoadPageTextLocales() _pageTextLocaleStore.clear(); // need for reload case - QueryResult result = WorldDatabase.Query("SELECT entry, text_loc1, text_loc2, text_loc3, text_loc4, text_loc5, text_loc6, text_loc7, text_loc8 FROM locales_page_text"); + // 0 1 2 + QueryResult result = WorldDatabase.Query("SELECT ID, locale, Text FROM page_text_locale"); if (!result) return; @@ -5299,12 +5303,14 @@ void ObjectMgr::LoadPageTextLocales() { Field* fields = result->Fetch(); - uint32 entry = fields[0].GetUInt32(); + uint32 id = fields[0].GetUInt32(); + std::string localeName = fields[1].GetString(); + std::string text = fields[2].GetString(); - PageTextLocale& data = _pageTextLocaleStore[entry]; + PageTextLocale& data = _pageTextLocaleStore[id]; + LocaleConstant locale = GetLocaleByName(localeName); - for (uint8 i = TOTAL_LOCALES - 1; i > 0; --i) - AddLocaleString(fields[i].GetString(), LocaleConstant(i), data.Text); + AddLocaleString(text, locale, data.Text); } while (result->NextRow()); TC_LOG_INFO("server.loading", ">> Loaded %u PageText locale strings in %u ms", uint32(_pageTextLocaleStore.size()), GetMSTimeDiffToNow(oldMSTime)); @@ -7239,7 +7245,7 @@ void ObjectMgr::LoadPointsOfInterest() uint32 count = 0; // 0 1 2 3 4 5 6 - QueryResult result = WorldDatabase.Query("SELECT ID, PositionX, PositionY, Icon, Flags, Data, Name FROM points_of_interest"); + QueryResult result = WorldDatabase.Query("SELECT ID, PositionX, PositionY, Icon, Flags, Importance, Name FROM points_of_interest"); if (!result) { @@ -7251,24 +7257,24 @@ void ObjectMgr::LoadPointsOfInterest() { Field* fields = result->Fetch(); - uint32 point_id = fields[0].GetUInt32(); + uint32 id = fields[0].GetUInt32(); - PointOfInterest POI; - POI.entry = point_id; - POI.x = fields[1].GetFloat(); - POI.y = fields[2].GetFloat(); - POI.icon = fields[3].GetUInt32(); - POI.flags = fields[4].GetUInt32(); - POI.data = fields[5].GetUInt32(); - POI.icon_name = fields[6].GetString(); + PointOfInterest pointOfInterest; + pointOfInterest.ID = id; + pointOfInterest.PositionX = fields[1].GetFloat(); + pointOfInterest.PositionY = fields[2].GetFloat(); + pointOfInterest.Icon = fields[3].GetUInt32(); + pointOfInterest.Flags = fields[4].GetUInt32(); + pointOfInterest.Importance = fields[5].GetUInt32(); + pointOfInterest.Name = fields[6].GetString(); - if (!Trinity::IsValidMapCoord(POI.x, POI.y)) + if (!Trinity::IsValidMapCoord(pointOfInterest.PositionX, pointOfInterest.PositionY)) { - TC_LOG_ERROR("sql.sql", "Table `points_of_interest` (Entry: %u) have invalid coordinates (X: %f Y: %f), ignored.", point_id, POI.x, POI.y); + TC_LOG_ERROR("sql.sql", "Table `points_of_interest` (ID: %u) have invalid coordinates (X: %f Y: %f), ignored.", id, pointOfInterest.PositionX, pointOfInterest.PositionY); continue; } - _pointsOfInterestStore[point_id] = POI; + _pointsOfInterestStore[id] = pointOfInterest; ++count; } while (result->NextRow()); @@ -8199,76 +8205,76 @@ void ObjectMgr::LoadMailLevelRewards() TC_LOG_INFO("server.loading", ">> Loaded %u level dependent mail rewards in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); } -void ObjectMgr::AddSpellToTrainer(uint32 entry, uint32 spell, uint32 spellCost, uint32 reqSkill, uint32 reqSkillValue, uint32 reqLevel) +void ObjectMgr::AddSpellToTrainer(uint32 ID, uint32 SpellID, uint32 MoneyCost, uint32 ReqSkillLine, uint32 ReqSkillRank, uint32 ReqLevel) { - if (entry >= TRINITY_TRAINER_START_REF) + if (ID >= TRINITY_TRAINER_START_REF) return; - CreatureTemplate const* cInfo = GetCreatureTemplate(entry); + CreatureTemplate const* cInfo = GetCreatureTemplate(ID); if (!cInfo) { - TC_LOG_ERROR("sql.sql", "Table `npc_trainer` contains entries for a non-existing creature template (Entry: %u), ignoring", entry); + TC_LOG_ERROR("sql.sql", "Table `npc_trainer` contains entries for a non-existing creature template (ID: %u), ignoring", ID); return; } if (!(cInfo->npcflag & UNIT_NPC_FLAG_TRAINER)) { - TC_LOG_ERROR("sql.sql", "Table `npc_trainer` contains entries for a creature template (Entry: %u) without trainer flag, ignoring", entry); + TC_LOG_ERROR("sql.sql", "Table `npc_trainer` contains entries for a creature template (ID: %u) without trainer flag, ignoring", ID); return; } - SpellInfo const* spellinfo = sSpellMgr->GetSpellInfo(spell); + SpellInfo const* spellinfo = sSpellMgr->GetSpellInfo(SpellID); if (!spellinfo) { - TC_LOG_ERROR("sql.sql", "Table `npc_trainer` contains an entry (Entry: %u) for a non-existing spell (Spell: %u), ignoring", entry, spell); + TC_LOG_ERROR("sql.sql", "Table `npc_trainer` contains an ID (%u) for a non-existing SpellID (%u), ignoring", ID, SpellID); return; } if (!SpellMgr::IsSpellValid(spellinfo)) { - TC_LOG_ERROR("sql.sql", "Table `npc_trainer` contains an entry (Entry: %u) for a broken spell (Spell: %u), ignoring", entry, spell); + TC_LOG_ERROR("sql.sql", "Table `npc_trainer` contains an ID (%u) for a broken SpellID (%u), ignoring", ID, SpellID); return; } - if (GetTalentSpellCost(spell)) + if (GetTalentSpellCost(SpellID)) { - TC_LOG_ERROR("sql.sql", "Table `npc_trainer` contains an entry (Entry: %u) for a non-existing spell (Spell: %u) which is a talent, ignoring", entry, spell); + TC_LOG_ERROR("sql.sql", "Table `npc_trainer` contains an ID (%u) for a non-existing SpellID (%u) which is a talent, ignoring", ID, SpellID); return; } - TrainerSpellData& data = _cacheTrainerSpellStore[entry]; + TrainerSpellData& data = _cacheTrainerSpellStore[ID]; - TrainerSpell& trainerSpell = data.spellList[spell]; - trainerSpell.spell = spell; - trainerSpell.spellCost = spellCost; - trainerSpell.reqSkill = reqSkill; - trainerSpell.reqSkillValue = reqSkillValue; - trainerSpell.reqLevel = reqLevel; + TrainerSpell& trainerSpell = data.spellList[SpellID]; + trainerSpell.SpellID = SpellID; + trainerSpell.MoneyCost = MoneyCost; + trainerSpell.ReqSkillLine = ReqSkillLine; + trainerSpell.ReqSkillRank = ReqSkillRank; + trainerSpell.ReqLevel = ReqLevel; - if (!trainerSpell.reqLevel) - trainerSpell.reqLevel = spellinfo->SpellLevel; + if (!trainerSpell.ReqLevel) + trainerSpell.ReqLevel = spellinfo->SpellLevel; // calculate learned spell for profession case when stored cast-spell - trainerSpell.learnedSpell[0] = spell; + trainerSpell.ReqAbility[0] = SpellID; for (uint8 i = 0; i < MAX_SPELL_EFFECTS; ++i) { if (spellinfo->Effects[i].Effect != SPELL_EFFECT_LEARN_SPELL) continue; - if (trainerSpell.learnedSpell[0] == spell) - trainerSpell.learnedSpell[0] = 0; + if (trainerSpell.ReqAbility[0] == SpellID) + trainerSpell.ReqAbility[0] = 0; // player must be able to cast spell on himself if (spellinfo->Effects[i].TargetA.GetTarget() != 0 && spellinfo->Effects[i].TargetA.GetTarget() != TARGET_UNIT_TARGET_ALLY && spellinfo->Effects[i].TargetA.GetTarget() != TARGET_UNIT_TARGET_ANY && spellinfo->Effects[i].TargetA.GetTarget() != TARGET_UNIT_CASTER) { - TC_LOG_ERROR("sql.sql", "Table `npc_trainer` has spell %u for trainer entry %u with learn effect which has incorrect target type, ignoring learn effect!", spell, entry); + TC_LOG_ERROR("sql.sql", "Table `npc_trainer` has spell %u for trainer entry %u with learn effect which has incorrect target type, ignoring learn effect!", SpellID, ID); continue; } - trainerSpell.learnedSpell[i] = spellinfo->Effects[i].TriggerSpell; + trainerSpell.ReqAbility[i] = spellinfo->Effects[i].TriggerSpell; - if (trainerSpell.learnedSpell[i]) + if (trainerSpell.ReqAbility[i]) { - SpellInfo const* learnedSpellInfo = sSpellMgr->GetSpellInfo(trainerSpell.learnedSpell[i]); + SpellInfo const* learnedSpellInfo = sSpellMgr->GetSpellInfo(trainerSpell.ReqAbility[i]); if (learnedSpellInfo && learnedSpellInfo->IsProfession()) data.trainerType = 2; } @@ -8301,14 +8307,14 @@ void ObjectMgr::LoadTrainerSpell() { Field* fields = result->Fetch(); - uint32 entry = fields[0].GetUInt32(); - uint32 spell = fields[1].GetUInt32(); - uint32 spellCost = fields[2].GetUInt32(); - uint32 reqSkill = fields[3].GetUInt16(); - uint32 reqSkillValue = fields[4].GetUInt16(); - uint32 reqLevel = fields[5].GetUInt8(); + uint32 ID = fields[0].GetUInt32(); + uint32 SpellID = fields[1].GetUInt32(); + uint32 MoneyCost = fields[2].GetUInt32(); + uint32 ReqSkillLine = fields[3].GetUInt16(); + uint32 ReqSkillRank = fields[4].GetUInt16(); + uint32 ReqLevel = fields[5].GetUInt8(); - AddSpellToTrainer(entry, spell, spellCost, reqSkill, reqSkillValue, reqLevel); + AddSpellToTrainer(ID, SpellID, MoneyCost, ReqSkillLine, ReqSkillRank, ReqLevel); ++count; } diff --git a/src/server/game/Globals/ObjectMgr.h b/src/server/game/Globals/ObjectMgr.h index 2e4c7954021..a53d9487c5e 100644 --- a/src/server/game/Globals/ObjectMgr.h +++ b/src/server/game/Globals/ObjectMgr.h @@ -57,7 +57,7 @@ struct PlayerLevelInfo; struct PageText { std::string Text; - uint32 NextPage; + uint32 NextPageID; }; /// Key for storing temp summon data in TempSummonDataContainer @@ -552,13 +552,13 @@ struct RepSpilloverTemplate struct PointOfInterest { - uint32 entry; - float x; - float y; - uint32 icon; - uint32 flags; - uint32 data; - std::string icon_name; + uint32 ID; + float PositionX; + float PositionY; + uint32 Icon; + uint32 Flags; + uint32 Importance; + std::string Name; }; struct GossipMenuItems @@ -1060,7 +1060,7 @@ class TC_GAME_API ObjectMgr void LoadVendors(); void LoadTrainerSpell(); - void AddSpellToTrainer(uint32 entry, uint32 spell, uint32 spellCost, uint32 reqSkill, uint32 reqSkillValue, uint32 reqLevel); + void AddSpellToTrainer(uint32 ID, uint32 SpellID, uint32 MoneyCost, uint32 ReqSkillLine, uint32 ReqSkillRank, uint32 ReqLevel); void InitializeQueriesData(QueryDataGroup mask); @@ -1205,9 +1205,9 @@ class TC_GAME_API ObjectMgr if (itr == _gossipMenuItemsLocaleStore.end()) return nullptr; return &itr->second; } - PointOfInterestLocale const* GetPointOfInterestLocale(uint32 poi_id) const + PointOfInterestLocale const* GetPointOfInterestLocale(uint32 id) const { - PointOfInterestLocaleContainer::const_iterator itr = _pointOfInterestLocaleStore.find(poi_id); + PointOfInterestLocaleContainer::const_iterator itr = _pointOfInterestLocaleStore.find(id); if (itr == _pointOfInterestLocaleStore.end()) return nullptr; return &itr->second; } @@ -1317,11 +1317,11 @@ class TC_GAME_API ObjectMgr // for wintergrasp only GraveYardContainer GraveYardStore; - static void AddLocaleString(std::string const& s, LocaleConstant locale, StringVector& data); - static inline void GetLocaleString(const StringVector& data, int loc_idx, std::string& value) + static void AddLocaleString(std::string const& value, LocaleConstant localeConstant, StringVector& data); + static inline void GetLocaleString(StringVector const& data, LocaleConstant localeConstant, std::string& value) { - if (data.size() > size_t(loc_idx) && !data[loc_idx].empty()) - value = data[loc_idx]; + if (data.size() > size_t(localeConstant) && !data[localeConstant].empty()) + value = data[localeConstant]; } CharacterConversionMap FactionChangeAchievements; diff --git a/src/server/game/Handlers/ItemHandler.cpp b/src/server/game/Handlers/ItemHandler.cpp index 721e0a9b54e..9159cf7f329 100644 --- a/src/server/game/Handlers/ItemHandler.cpp +++ b/src/server/game/Handlers/ItemHandler.cpp @@ -933,10 +933,10 @@ void WorldSession::HandleItemNameQueryOpcode(WorldPacket& recvData) if (pName) { std::string Name = pName->name; - int loc_idx = GetSessionDbLocaleIndex(); - if (loc_idx >= 0) + LocaleConstant localeConstant = GetSessionDbLocaleIndex(); + if (localeConstant >= LOCALE_enUS) if (ItemSetNameLocale const* isnl = sObjectMgr->GetItemSetNameLocale(itemid)) - ObjectMgr::GetLocaleString(isnl->Name, loc_idx, Name); + ObjectMgr::GetLocaleString(isnl->Name, localeConstant, Name); WorldPacket data(SMSG_ITEM_NAME_QUERY_RESPONSE, (4+Name.size()+1+4)); data << uint32(itemid); diff --git a/src/server/game/Handlers/NPCHandler.cpp b/src/server/game/Handlers/NPCHandler.cpp index 34b4acd5c0b..53f855c7872 100644 --- a/src/server/game/Handlers/NPCHandler.cpp +++ b/src/server/game/Handlers/NPCHandler.cpp @@ -164,14 +164,14 @@ void WorldSession::SendTrainerList(ObjectGuid guid, const std::string& strTitle) bool primary_prof_first_rank = false; for (uint8 i = 0; i < MAX_SPELL_EFFECTS; ++i) { - if (!tSpell->learnedSpell[i]) + if (!tSpell->ReqAbility[i]) continue; - if (!_player->IsSpellFitByClassAndRace(tSpell->learnedSpell[i])) + if (!_player->IsSpellFitByClassAndRace(tSpell->ReqAbility[i])) { valid = false; break; } - SpellInfo const* learnedSpellInfo = sSpellMgr->GetSpellInfo(tSpell->learnedSpell[i]); + SpellInfo const* learnedSpellInfo = sSpellMgr->GetSpellInfo(tSpell->ReqAbility[i]); if (learnedSpellInfo && learnedSpellInfo->IsPrimaryProfessionFirstRank()) primary_prof_first_rank = true; } @@ -180,30 +180,30 @@ void WorldSession::SendTrainerList(ObjectGuid guid, const std::string& strTitle) TrainerSpellState state = _player->GetTrainerSpellState(tSpell); - data << uint32(tSpell->spell); // learned spell (or cast-spell in profession case) + data << uint32(tSpell->SpellID); // learned spell (or cast-spell in profession case) data << uint8(state == TRAINER_SPELL_GREEN_DISABLED ? TRAINER_SPELL_GREEN : state); - data << uint32(floor(tSpell->spellCost * fDiscountMod)); + data << uint32(floor(tSpell->MoneyCost * fDiscountMod)); data << uint32(primary_prof_first_rank && can_learn_primary_prof ? 1 : 0); // primary prof. learn confirmation dialog data << uint32(primary_prof_first_rank ? 1 : 0); // must be equal prev. field to have learn button in enabled state - data << uint8(tSpell->reqLevel); - data << uint32(tSpell->reqSkill); - data << uint32(tSpell->reqSkillValue); + data << uint8(tSpell->ReqLevel); + data << uint32(tSpell->ReqSkillLine); + data << uint32(tSpell->ReqSkillRank); //prev + req or req + 0 uint8 maxReq = 0; for (uint8 i = 0; i < MAX_SPELL_EFFECTS; ++i) { - if (!tSpell->learnedSpell[i]) + if (!tSpell->ReqAbility[i]) continue; - if (uint32 prevSpellId = sSpellMgr->GetPrevSpellInChain(tSpell->learnedSpell[i])) + if (uint32 prevSpellId = sSpellMgr->GetPrevSpellInChain(tSpell->ReqAbility[i])) { data << uint32(prevSpellId); ++maxReq; } if (maxReq == 3) break; - SpellsRequiringSpellMapBounds spellsRequired = sSpellMgr->GetSpellsRequiredForSpellBounds(tSpell->learnedSpell[i]); + SpellsRequiringSpellMapBounds spellsRequired = sSpellMgr->GetSpellsRequiredForSpellBounds(tSpell->ReqAbility[i]); for (SpellsRequiringSpellMap::const_iterator itr2 = spellsRequired.first; itr2 != spellsRequired.second && maxReq < 3; ++itr2) { data << uint32(itr2->second); @@ -273,7 +273,7 @@ void WorldSession::HandleTrainerBuySpellOpcode(WorldPacket& recvData) return; // apply reputation discount - uint32 nSpellCost = uint32(floor(trainer_spell->spellCost * _player->GetReputationPriceDiscount(trainer))); + uint32 nSpellCost = uint32(floor(trainer_spell->MoneyCost * _player->GetReputationPriceDiscount(trainer))); // check money requirement if (!_player->HasEnoughMoney(nSpellCost)) @@ -286,7 +286,7 @@ void WorldSession::HandleTrainerBuySpellOpcode(WorldPacket& recvData) // learn explicitly or cast explicitly if (trainer_spell->IsCastable()) - _player->CastSpell(_player, trainer_spell->spell, true); + _player->CastSpell(_player, trainer_spell->SpellID, true); else _player->LearnSpell(spellId, false); diff --git a/src/server/game/Handlers/QueryHandler.cpp b/src/server/game/Handlers/QueryHandler.cpp index 3e541aed253..aec8553cb53 100644 --- a/src/server/game/Handlers/QueryHandler.cpp +++ b/src/server/game/Handlers/QueryHandler.cpp @@ -299,14 +299,14 @@ void WorldSession::HandlePageTextQueryOpcode(WorldPacket& recvData) { std::string Text = pageText->Text; - int loc_idx = GetSessionDbLocaleIndex(); - if (loc_idx >= 0) - if (PageTextLocale const* player = sObjectMgr->GetPageTextLocale(pageID)) - ObjectMgr::GetLocaleString(player->Text, loc_idx, Text); + LocaleConstant localeConstant = GetSessionDbLocaleIndex(); + if (localeConstant >= LOCALE_enUS) + if (PageTextLocale const* pageTextLocale = sObjectMgr->GetPageTextLocale(pageID)) + ObjectMgr::GetLocaleString(pageTextLocale->Text, localeConstant, Text); data << Text; - data << uint32(pageText->NextPage); - pageID = pageText->NextPage; + data << uint32(pageText->NextPageID); + pageID = pageText->NextPageID; } SendPacket(&data); diff --git a/src/server/scripts/Commands/cs_reload.cpp b/src/server/scripts/Commands/cs_reload.cpp index ee40877e721..97a8b8a8fc3 100644 --- a/src/server/scripts/Commands/cs_reload.cpp +++ b/src/server/scripts/Commands/cs_reload.cpp @@ -862,9 +862,9 @@ public: static bool HandleReloadPageTextsCommand(ChatHandler* handler, const char* /*args*/) { - TC_LOG_INFO("misc", "Re-Loading Page Texts..."); + TC_LOG_INFO("misc", "Re-Loading Page Text..."); sObjectMgr->LoadPageTexts(); - handler->SendGlobalGMSysMessage("DB table `page_texts` reloaded."); + handler->SendGlobalGMSysMessage("DB table `page_text` reloaded."); return true; } |
