mirror of
https://github.com/mod-playerbots/azerothcore-wotlk.git
synced 2026-01-18 03:15:41 +00:00
feat(Core/Pet): DK Petname generation locale (#14059)
This commit is contained in:
125
data/sql/updates/pending_db_world/rev_1670175005015833100.sql
Normal file
125
data/sql/updates/pending_db_world/rev_1670175005015833100.sql
Normal file
@@ -0,0 +1,125 @@
|
||||
--
|
||||
/*
|
||||
SQLyog Community v13.1.2 (64 bit)
|
||||
MySQL - 5.7.37-log : Database - acore_world
|
||||
*********************************************************************
|
||||
|
||||
Table structure for table `pet_name_generation_locale` */
|
||||
|
||||
DROP TABLE IF EXISTS `pet_name_generation_locale`;
|
||||
CREATE TABLE `pet_name_generation_locale` (
|
||||
`id` mediumint(8) unsigned NOT NULL AUTO_INCREMENT,
|
||||
`locale` varchar(4) NOT NULL,
|
||||
`word` tinytext NOT NULL,
|
||||
`entry` mediumint(8) unsigned NOT NULL DEFAULT '0',
|
||||
`half` tinyint(3) unsigned NOT NULL DEFAULT '0',
|
||||
PRIMARY KEY (`ID`,`locale`)
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 ROW_FORMAT=COMPACT;
|
||||
|
||||
INSERT INTO `pet_name_generation_locale` (`id`, `locale`, `word`, `entry`, `half`) VALUES (261, 'esES', 'piedras', 26125, 1),
|
||||
(262, 'esES', 'rocas', 26125, 1),
|
||||
(263, 'esES', 'ojos', 26125, 1),
|
||||
(264, 'esES', 'tierra', 26125, 1),
|
||||
(265, 'esES', 'sepulcros', 26125, 1),
|
||||
(266, 'esES', 'murciélagos', 26125, 1),
|
||||
(267, 'esES', 'ratas', 26125, 1),
|
||||
(268, 'esES', 'cuerpos', 26125, 1),
|
||||
(269, 'esES', 'tumbas', 26125, 1),
|
||||
(270, 'esES', 'carroña', 26125, 1),
|
||||
(271, 'esES', 'cráneos', 26125, 1),
|
||||
(272, 'esES', 'huesos', 26125, 1),
|
||||
(273, 'esES', 'criptas', 26125, 1),
|
||||
(274, 'esES', 'costillas', 26125, 1),
|
||||
(275, 'esES', 'cerebros', 26125, 1),
|
||||
(276, 'esES', 'sarcófagos', 26125, 1),
|
||||
(277, 'esES', 'podredumbre', 26125, 1),
|
||||
(278, 'esES', 'gravilla', 26125, 1),
|
||||
(279, 'esES', 'plaga', 26125, 1),
|
||||
(280, 'esES', 'ataúdes', 26125, 1),
|
||||
(281, 'esES', 'miembros', 26125, 1),
|
||||
(282, 'esES', 'gusanos', 26125, 1),
|
||||
(283, 'esES', 'suelos', 26125, 1),
|
||||
(284, 'esES', 'espinas', 26125, 1),
|
||||
(285, 'esES', 'guijarros', 26125, 1),
|
||||
(286, 'esES', 'raíces', 26125, 1),
|
||||
(287, 'esES', 'médulas', 26125, 1),
|
||||
(288, 'esES', 'martillos', 26125, 1),
|
||||
(289, 'esES', 'Devasta', 26125, 0),
|
||||
(290, 'esES', 'Mastica', 26125, 0),
|
||||
(291, 'esES', 'Tritura', 26125, 0),
|
||||
(292, 'esES', 'Machaca', 26125, 0),
|
||||
(293, 'esES', 'Salta', 26125, 0),
|
||||
(294, 'esES', 'Afila', 26125, 0),
|
||||
(295, 'esES', 'Acosa', 26125, 0),
|
||||
(296, 'esES', 'Engulle', 26125, 0),
|
||||
(297, 'esES', 'Come', 26125, 0),
|
||||
(298, 'esES', 'Golpea', 26125, 0),
|
||||
(299, 'esES', 'Masca', 26125, 0),
|
||||
(300, 'esES', 'Destripa', 26125, 0),
|
||||
(301, 'esES', 'Trocea', 26125, 0),
|
||||
(302, 'esES', 'Roe', 26125, 0),
|
||||
(303, 'esES', 'Desolla', 26125, 0),
|
||||
(304, 'esES', 'Retumba', 26125, 0),
|
||||
(305, 'esES', 'Muerde', 26125, 0),
|
||||
(306, 'esES', 'Rompe', 26125, 0),
|
||||
(307, 'esES', 'Guarda', 26125, 0),
|
||||
(308, 'esES', 'Seca', 26125, 0),
|
||||
(309, 'esES', 'Atraca', 26125, 0),
|
||||
(310, 'esES', 'Roba', 26125, 0),
|
||||
(311, 'esES', 'Captura', 26125, 0),
|
||||
(312, 'esES', 'Bebe', 26125, 0),
|
||||
(313, 'esES', 'Rebana', 26125, 0),
|
||||
(261, 'esMX', 'piedras', 26125, 1),
|
||||
(262, 'esMX', 'rocas', 26125, 1),
|
||||
(263, 'esMX', 'ojos', 26125, 1),
|
||||
(264, 'esMX', 'tierra', 26125, 1),
|
||||
(265, 'esMX', 'sepulcros', 26125, 1),
|
||||
(266, 'esMX', 'murciélagos', 26125, 1),
|
||||
(267, 'esMX', 'ratas', 26125, 1),
|
||||
(268, 'esMX', 'cuerpos', 26125, 1),
|
||||
(269, 'esMX', 'tumbas', 26125, 1),
|
||||
(270, 'esMX', 'carroña', 26125, 1),
|
||||
(271, 'esMX', 'cráneos', 26125, 1),
|
||||
(272, 'esMX', 'huesos', 26125, 1),
|
||||
(273, 'esMX', 'criptas', 26125, 1),
|
||||
(274, 'esMX', 'costillas', 26125, 1),
|
||||
(275, 'esMX', 'cerebros', 26125, 1),
|
||||
(276, 'esMX', 'sarcófagos', 26125, 1),
|
||||
(277, 'esMX', 'podredumbre', 26125, 1),
|
||||
(278, 'esMX', 'gravilla', 26125, 1),
|
||||
(279, 'esMX', 'plaga', 26125, 1),
|
||||
(280, 'esMX', 'ataúdes', 26125, 1),
|
||||
(281, 'esMX', 'miembros', 26125, 1),
|
||||
(282, 'esMX', 'gusanos', 26125, 1),
|
||||
(283, 'esMX', 'suelos', 26125, 1),
|
||||
(284, 'esMX', 'espinas', 26125, 1),
|
||||
(285, 'esMX', 'guijarros', 26125, 1),
|
||||
(286, 'esMX', 'raíces', 26125, 1),
|
||||
(287, 'esMX', 'médulas', 26125, 1),
|
||||
(288, 'esMX', 'martillos', 26125, 1),
|
||||
(289, 'esMX', 'Devasta', 26125, 0),
|
||||
(290, 'esMX', 'Mastica', 26125, 0),
|
||||
(291, 'esMX', 'Tritura', 26125, 0),
|
||||
(292, 'esMX', 'Machaca', 26125, 0),
|
||||
(293, 'esMX', 'Salta', 26125, 0),
|
||||
(294, 'esMX', 'Afila', 26125, 0),
|
||||
(295, 'esMX', 'Acosa', 26125, 0),
|
||||
(296, 'esMX', 'Engulle', 26125, 0),
|
||||
(297, 'esMX', 'Come', 26125, 0),
|
||||
(298, 'esMX', 'Golpea', 26125, 0),
|
||||
(299, 'esMX', 'Masca', 26125, 0),
|
||||
(300, 'esMX', 'Destripa', 26125, 0),
|
||||
(301, 'esMX', 'Trocea', 26125, 0),
|
||||
(302, 'esMX', 'Roe', 26125, 0),
|
||||
(303, 'esMX', 'Desolla', 26125, 0),
|
||||
(304, 'esMX', 'Retumba', 26125, 0),
|
||||
(305, 'esMX', 'Muerde', 26125, 0),
|
||||
(306, 'esMX', 'Rompe', 26125, 0),
|
||||
(307, 'esMX', 'Guarda', 26125, 0),
|
||||
(308, 'esMX', 'Seca', 26125, 0),
|
||||
(309, 'esMX', 'Atraca', 26125, 0),
|
||||
(310, 'esMX', 'Roba', 26125, 0),
|
||||
(311, 'esMX', 'Captura', 26125, 0),
|
||||
(312, 'esMX', 'Bebe', 26125, 0),
|
||||
(313, 'esMX', 'Rebana', 26125, 0);
|
||||
|
||||
@@ -8827,7 +8827,7 @@ Pet* Player::SummonPet(uint32 entry, float x, float y, float z, float ang, PetTy
|
||||
// Generate a new name for the newly summoned ghoul
|
||||
if (pet->IsPetGhoul())
|
||||
{
|
||||
std::string new_name = sObjectMgr->GeneratePetName(entry);
|
||||
std::string new_name = sObjectMgr->GeneratePetNameLocale(entry, GetSession()->GetSessionDbLocaleIndex());
|
||||
if (!new_name.empty())
|
||||
pet->SetName(new_name);
|
||||
}
|
||||
|
||||
@@ -448,6 +448,42 @@ void ObjectMgr::LoadGossipMenuItemsLocales()
|
||||
LOG_INFO("server.loading", ">> Loaded {} Gossip Menu Option Locale Strings in {} ms", (uint32)_gossipMenuItemsLocaleStore.size(), GetMSTimeDiffToNow(oldMSTime));
|
||||
}
|
||||
|
||||
void ObjectMgr::LoadPetNamesLocales()
|
||||
{
|
||||
uint32 oldMSTime = getMSTime();
|
||||
|
||||
// 0 1 2 3
|
||||
QueryResult result = WorldDatabase.Query("SELECT locale, word, entry, half FROM pet_name_generation_locale");
|
||||
|
||||
if (!result)
|
||||
{
|
||||
LOG_WARN("server.loading", ">> Loaded 0 pet name locales parts. DB table `pet_name_generation_locale` is empty!");
|
||||
LOG_INFO("server.loading", " ");
|
||||
return;
|
||||
}
|
||||
|
||||
uint32 count = 0;
|
||||
|
||||
do
|
||||
{
|
||||
Field* fields = result->Fetch();
|
||||
LocaleConstant locale = GetLocaleByName(fields[0].Get<std::string>());
|
||||
std::string word = fields[1].Get<std::string>();
|
||||
|
||||
uint32 entry = fields[2].Get<uint32>();
|
||||
bool half = fields[3].Get<bool>();
|
||||
std::pair<uint32, LocaleConstant> pairkey = std::make_pair(entry, locale);
|
||||
if (half)
|
||||
_petHalfLocaleName1[pairkey].push_back(word);
|
||||
else
|
||||
_petHalfLocaleName0[pairkey].push_back(word);
|
||||
++count;
|
||||
} while (result->NextRow());
|
||||
|
||||
LOG_INFO("server.loading", ">> Loaded {} Pet Name Locales Parts in {} ms", count, GetMSTimeDiffToNow(oldMSTime));
|
||||
LOG_INFO("server.loading", " ");
|
||||
}
|
||||
|
||||
void ObjectMgr::LoadPointOfInterestLocales()
|
||||
{
|
||||
uint32 oldMSTime = getMSTime();
|
||||
@@ -7402,6 +7438,19 @@ void ObjectMgr::LoadPetNumber()
|
||||
LOG_INFO("server.loading", " ");
|
||||
}
|
||||
|
||||
std::string ObjectMgr::GeneratePetNameLocale(uint32 entry, LocaleConstant locale)
|
||||
{
|
||||
std::vector<std::string>& list0 = _petHalfLocaleName0[std::make_pair(entry, locale)];
|
||||
std::vector<std::string>& list1 = _petHalfLocaleName1[std::make_pair(entry, locale)];
|
||||
|
||||
if (list0.empty() || list1.empty())
|
||||
{
|
||||
return GeneratePetName(entry);
|
||||
}
|
||||
|
||||
return *(list0.begin() + urand(0, list0.size() - 1)) + *(list1.begin() + urand(0, list1.size() - 1));
|
||||
}
|
||||
|
||||
std::string ObjectMgr::GeneratePetName(uint32 entry)
|
||||
{
|
||||
std::vector<std::string>& list0 = _petHalfName0[entry];
|
||||
|
||||
@@ -1075,6 +1075,7 @@ public:
|
||||
void LoadPetLevelInfo();
|
||||
void LoadExplorationBaseXP();
|
||||
void LoadPetNames();
|
||||
void LoadPetNamesLocales();
|
||||
void LoadPetNumber();
|
||||
void LoadFishingBaseSkillLevel();
|
||||
void ChangeFishingBaseSkillLevel(uint32 entry, int32 skill);
|
||||
@@ -1098,6 +1099,7 @@ public:
|
||||
void AddSpellToTrainer(uint32 entry, uint32 spell, uint32 spellCost, uint32 reqSkill, uint32 reqSkillValue, uint32 reqLevel, uint32 reqSpell);
|
||||
|
||||
std::string GeneratePetName(uint32 entry);
|
||||
std::string GeneratePetNameLocale(uint32 entry, LocaleConstant locale);
|
||||
uint32 GetBaseXP(uint8 level);
|
||||
[[nodiscard]] uint32 GetXPForLevel(uint8 level) const;
|
||||
|
||||
@@ -1549,6 +1551,9 @@ private:
|
||||
typedef std::map<uint32, std::vector<std::string>> HalfNameContainer;
|
||||
HalfNameContainer _petHalfName0;
|
||||
HalfNameContainer _petHalfName1;
|
||||
typedef std::map<std::pair<uint32, LocaleConstant>, std::vector<std::string>> HalfNameContainerLocale;
|
||||
HalfNameContainerLocale _petHalfLocaleName0;
|
||||
HalfNameContainerLocale _petHalfLocaleName1;
|
||||
|
||||
typedef std::unordered_map<uint32, ItemSetNameEntry> ItemSetNameContainer;
|
||||
ItemSetNameContainer _itemSetNameStore;
|
||||
|
||||
@@ -1634,6 +1634,7 @@ void World::SetInitialWorldSettings()
|
||||
sObjectMgr->LoadPageTextLocales();
|
||||
sObjectMgr->LoadGossipMenuItemsLocales();
|
||||
sObjectMgr->LoadPointOfInterestLocales();
|
||||
sObjectMgr->LoadPetNamesLocales();
|
||||
|
||||
sObjectMgr->SetDBCLocaleIndex(GetDefaultDbcLocale()); // Get once for all the locale index of DBC language (console/broadcasts)
|
||||
LOG_INFO("server.loading", ">> Localization Strings loaded in {} ms", GetMSTimeDiffToNow(oldMSTime));
|
||||
|
||||
Reference in New Issue
Block a user