diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/game/Chat.cpp | 14 | ||||
-rw-r--r-- | src/game/Chat.h | 18 | ||||
-rw-r--r-- | src/game/Creature.h | 5 | ||||
-rw-r--r-- | src/game/GossipDef.cpp | 35 | ||||
-rw-r--r-- | src/game/GossipDef.h | 1 | ||||
-rw-r--r-- | src/game/Level3.cpp | 18 | ||||
-rw-r--r-- | src/game/ObjectMgr.cpp | 103 | ||||
-rw-r--r-- | src/game/ObjectMgr.h | 32 | ||||
-rw-r--r-- | src/game/World.cpp | 4 | ||||
-rw-r--r-- | src/shared/revision_nr.h | 2 |
10 files changed, 217 insertions, 15 deletions
diff --git a/src/game/Chat.cpp b/src/game/Chat.cpp index 4730269b167..bfd711c4737 100644 --- a/src/game/Chat.cpp +++ b/src/game/Chat.cpp @@ -289,6 +289,13 @@ ChatCommand * ChatHandler::getCommandTable() { "item_enchantment_template", SEC_ADMINISTRATOR, true, &ChatHandler::HandleReloadItemEnchantementsCommand, "", NULL }, { "item_loot_template", SEC_ADMINISTRATOR, true, &ChatHandler::HandleReloadLootTemplatesItemCommand, "", NULL }, { "trinity_string", SEC_ADMINISTRATOR, true, &ChatHandler::HandleReloadTrinityStringCommand, "", NULL }, + { "locales_creature", SEC_ADMINISTRATOR, true, &ChatHandler::HandleReloadLocalesCreatureCommand, "", NULL }, + { "locales_gameobject", SEC_ADMINISTRATOR, true, &ChatHandler::HandleReloadLocalesGameobjectCommand, "", NULL }, + { "locales_item", SEC_ADMINISTRATOR, true, &ChatHandler::HandleReloadLocalesItemCommand, "", NULL }, + { "locales_npc_text", SEC_ADMINISTRATOR, true, &ChatHandler::HandleReloadLocalesNpcTextCommand, "", NULL }, + { "locales_page_text", SEC_ADMINISTRATOR, true, &ChatHandler::HandleReloadLocalesPageTextCommand, "", NULL }, + { "locales_points_of_interest", SEC_ADMINISTRATOR, true, &ChatHandler::HandleReloadLocalesPointsOfInterestCommand, "", NULL }, + { "locales_quest", SEC_ADMINISTRATOR, true, &ChatHandler::HandleReloadLocalesQuestCommand, "", NULL }, { "milling_loot_template", SEC_ADMINISTRATOR, true, &ChatHandler::HandleReloadLootTemplatesMillingCommand, "", NULL }, { "npc_gossip", SEC_ADMINISTRATOR, true, &ChatHandler::HandleReloadNpcGossipCommand, "", NULL }, { "npc_option", SEC_ADMINISTRATOR, true, &ChatHandler::HandleReloadNpcOptionCommand, "", NULL }, @@ -296,6 +303,7 @@ ChatCommand * ChatHandler::getCommandTable() { "npc_vendor", SEC_ADMINISTRATOR, true, &ChatHandler::HandleReloadNpcVendorCommand, "", NULL }, { "page_text", SEC_ADMINISTRATOR, true, &ChatHandler::HandleReloadPageTextsCommand, "", NULL }, { "pickpocketing_loot_template", SEC_ADMINISTRATOR, true, &ChatHandler::HandleReloadLootTemplatesPickpocketingCommand,"",NULL}, + { "points_of_interest", SEC_ADMINISTRATOR, true, &ChatHandler::HandleReloadPointsOfInterestCommand, "",NULL}, { "prospecting_loot_template", SEC_ADMINISTRATOR, true, &ChatHandler::HandleReloadLootTemplatesProspectingCommand,"", NULL }, { "quest_mail_loot_template", SEC_ADMINISTRATOR, true, &ChatHandler::HandleReloadLootTemplatesQuestMailCommand, "", NULL }, { "quest_end_scripts", SEC_ADMINISTRATOR, true, &ChatHandler::HandleReloadQuestEndScriptsCommand, "", NULL }, @@ -320,12 +328,6 @@ ChatCommand * ChatHandler::getCommandTable() { "spell_target_position", SEC_ADMINISTRATOR, true, &ChatHandler::HandleReloadSpellTargetPositionCommand, "", NULL }, { "spell_threats", SEC_ADMINISTRATOR, true, &ChatHandler::HandleReloadSpellThreatsCommand, "", NULL }, { "spell_disabled", SEC_ADMINISTRATOR, true, &ChatHandler::HandleReloadSpellDisabledCommand, "", NULL }, - { "locales_creature", SEC_ADMINISTRATOR, true, &ChatHandler::HandleReloadLocalesCreatureCommand, "", NULL }, - { "locales_gameobject", SEC_ADMINISTRATOR, true, &ChatHandler::HandleReloadLocalesGameobjectCommand, "", NULL }, - { "locales_item", SEC_ADMINISTRATOR, true, &ChatHandler::HandleReloadLocalesItemCommand, "", NULL }, - { "locales_npc_text", SEC_ADMINISTRATOR, true, &ChatHandler::HandleReloadLocalesNpcTextCommand, "", NULL }, - { "locales_page_text", SEC_ADMINISTRATOR, true, &ChatHandler::HandleReloadLocalesPageTextCommand, "", NULL }, - { "locales_quest", SEC_ADMINISTRATOR, true, &ChatHandler::HandleReloadLocalesQuestCommand, "", NULL }, { "waypoint_scripts", SEC_ADMINISTRATOR, true, &ChatHandler::HandleReloadWpScriptsCommand, "", NULL }, { "gm_tickets", SEC_ADMINISTRATOR, true, &ChatHandler::HandleGMTicketReloadCommand, "", NULL }, diff --git a/src/game/Chat.h b/src/game/Chat.h index 7ff89e5071c..ab8c840ec4a 100644 --- a/src/game/Chat.h +++ b/src/game/Chat.h @@ -235,6 +235,14 @@ class ChatHandler bool HandleReloadGameTeleCommand(const char* args); bool HandleReloadGOQuestRelationsCommand(const char* args); bool HandleReloadGOQuestInvRelationsCommand(const char* args); + bool HandleReloadItemEnchantementsCommand(const char* args); + bool HandleReloadLocalesCreatureCommand(const char* args); + bool HandleReloadLocalesGameobjectCommand(const char* args); + bool HandleReloadLocalesItemCommand(const char* args); + bool HandleReloadLocalesNpcTextCommand(const char* args); + bool HandleReloadLocalesPageTextCommand(const char* args); + bool HandleReloadLocalesPointsOfInterestCommand(const char* args); + bool HandleReloadLocalesQuestCommand(const char* args); bool HandleReloadLootTemplatesCreatureCommand(const char* args); bool HandleReloadLootTemplatesDisenchantCommand(const char* args); bool HandleReloadLootTemplatesFishingCommand(const char* args); @@ -252,6 +260,8 @@ class ChatHandler bool HandleReloadNpcOptionCommand(const char* args); bool HandleReloadNpcTrainerCommand(const char* args); bool HandleReloadNpcVendorCommand(const char* args); + bool HandleReloadPageTextsCommand(const char* args); + bool HandleReloadPointsOfInterestCommand(const char* args); bool HandleReloadQuestAreaTriggersCommand(const char* args); bool HandleReloadQuestEndScriptsCommand(const char* args); bool HandleReloadQuestStartScriptsCommand(const char* args); @@ -272,14 +282,6 @@ class ChatHandler bool HandleReloadSpellThreatsCommand(const char* args); bool HandleReloadSpellPetAurasCommand(const char* args); bool HandleReloadSpellDisabledCommand(const char* args); - bool HandleReloadPageTextsCommand(const char* args); - bool HandleReloadItemEnchantementsCommand(const char* args); - bool HandleReloadLocalesCreatureCommand(const char* args); - bool HandleReloadLocalesGameobjectCommand(const char* args); - bool HandleReloadLocalesItemCommand(const char* args); - bool HandleReloadLocalesNpcTextCommand(const char* args); - bool HandleReloadLocalesPageTextCommand(const char* args); - bool HandleReloadLocalesQuestCommand(const char* args); bool HandleInstanceListBindsCommand(const char* args); bool HandleInstanceUnbindCommand(const char* args); diff --git a/src/game/Creature.h b/src/game/Creature.h index 8351c76a718..a99b089214e 100644 --- a/src/game/Creature.h +++ b/src/game/Creature.h @@ -242,6 +242,11 @@ struct NpcOptionLocale std::vector<std::string> BoxText; }; +struct PointOfInterestLocale +{ + std::vector<std::string> IconName; +}; + struct EquipmentInfo { uint32 entry; diff --git a/src/game/GossipDef.cpp b/src/game/GossipDef.cpp index 300d02cca4e..65e0f54d925 100644 --- a/src/game/GossipDef.cpp +++ b/src/game/GossipDef.cpp @@ -181,6 +181,7 @@ void PlayerMenu::CloseGossip() //sLog.outDebug( "WORLD: Sent SMSG_GOSSIP_COMPLETE" ); } +// Outdated void PlayerMenu::SendPointOfInterest( float X, float Y, uint32 Icon, uint32 Flags, uint32 Data, char const * locName ) { WorldPacket data( SMSG_GOSSIP_POI, (4+4+4+4+4+10) ); // guess size @@ -194,6 +195,40 @@ void PlayerMenu::SendPointOfInterest( float X, float Y, uint32 Icon, uint32 Flag //sLog.outDebug("WORLD: Sent SMSG_GOSSIP_POI"); } +void PlayerMenu::SendPointOfInterest( uint32 poi_id ) +{ + PointOfInterest const* poi = objmgr.GetPointOfInterest(poi_id); + if(!poi) + { + sLog.outErrorDb("Requested send not existed POI (Id: %u), ignore."); + return; + } + + std::string icon_name = poi->icon_name; + + int loc_idx = pSession->GetSessionDbLocaleIndex(); + if (loc_idx >= 0) + { + PointOfInterestLocale const *pl = objmgr.GetPointOfInterestLocale(poi_id); + if (pl) + { + if (pl->IconName.size() > size_t(loc_idx) && !pl->IconName[loc_idx].empty()) + icon_name = pl->IconName[loc_idx]; + } + } + + 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 << icon_name; + + pSession->SendPacket( &data ); + //sLog.outDebug("WORLD: Sent SMSG_GOSSIP_POI"); +} + void PlayerMenu::SendTalking( uint32 textID ) { GossipText const* pGossip = objmgr.GetGossipText(textID); diff --git a/src/game/GossipDef.h b/src/game/GossipDef.h index cb93a4e7a91..dc52eb4dc3b 100644 --- a/src/game/GossipDef.h +++ b/src/game/GossipDef.h @@ -189,6 +189,7 @@ class TRINITY_DLL_SPEC PlayerMenu void SendGossipMenu( uint32 TitleTextId, uint64 npcGUID ); void CloseGossip(); void SendPointOfInterest( float X, float Y, uint32 Icon, uint32 Flags, uint32 Data, const char * locName ); + void SendPointOfInterest( uint32 poi_id ); void SendTalking( uint32 textID ); void SendTalking( char const * title, char const * text ); diff --git a/src/game/Level3.cpp b/src/game/Level3.cpp index 775252bbe1a..f731d2ce7ad 100644 --- a/src/game/Level3.cpp +++ b/src/game/Level3.cpp @@ -469,6 +469,7 @@ bool ChatHandler::HandleReloadAllNpcCommand(const char* /*args*/) HandleReloadNpcOptionCommand("a"); HandleReloadNpcTrainerCommand("a"); HandleReloadNpcVendorCommand("a"); + HandleReloadPointsOfInterestCommand("a"); return true; } @@ -536,6 +537,7 @@ bool ChatHandler::HandleReloadAllLocalesCommand(const char* /*args*/) HandleReloadLocalesItemCommand("a"); HandleReloadLocalesNpcTextCommand("a"); HandleReloadLocalesPageTextCommand("a"); + HandleReloadLocalesPointsOfInterestCommand("a"); HandleReloadLocalesQuestCommand("a"); return true; } @@ -771,6 +773,14 @@ bool ChatHandler::HandleReloadNpcVendorCommand(const char*) return true; } +bool ChatHandler::HandleReloadPointsOfInterestCommand(const char*) +{ + sLog.outString( "Re-Loading `points_of_interest` Table!" ); + objmgr.LoadPointsOfInterest(); + SendGlobalSysMessage("DB table `points_of_interest` reloaded."); + return true; +} + bool ChatHandler::HandleReloadReservedNameCommand(const char*) { sLog.outString( "Loading ReservedNames... (`reserved_name`)" ); @@ -1100,6 +1110,14 @@ bool ChatHandler::HandleReloadLocalesPageTextCommand(const char* /*arg*/) return true; } +bool ChatHandler::HandleReloadLocalesPointsOfInterestCommand(const char* /*arg*/) +{ + sLog.outString( "Re-Loading Locales Points Of Interest ... "); + objmgr.LoadPointOfInterestLocales(); + SendGlobalSysMessage("DB table `locales_points_of_interest` reloaded."); + return true; +} + bool ChatHandler::HandleReloadLocalesQuestCommand(const char* /*arg*/) { sLog.outString( "Re-Loading Locales Quest ... "); diff --git a/src/game/ObjectMgr.cpp b/src/game/ObjectMgr.cpp index 050ccc0f82e..8b459e7d6de 100644 --- a/src/game/ObjectMgr.cpp +++ b/src/game/ObjectMgr.cpp @@ -460,6 +460,57 @@ void ObjectMgr::LoadNpcOptionLocales() sLog.outString( ">> Loaded %u npc_option locale strings", mNpcOptionLocaleMap.size() ); } +void ObjectMgr::LoadPointOfInterestLocales() +{ + mPointOfInterestLocaleMap.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"); + + if(!result) + { + barGoLink bar(1); + + bar.step(); + + sLog.outString(""); + sLog.outString(">> Loaded 0 points_of_interest locale strings. DB table `locales_points_of_interest` is empty."); + return; + } + + barGoLink bar(result->GetRowCount()); + + do + { + Field *fields = result->Fetch(); + bar.step(); + + uint32 entry = fields[0].GetUInt32(); + + PointOfInterestLocale& data = mPointOfInterestLocaleMap[entry]; + + for(int i = 1; i < MAX_LOCALE; ++i) + { + std::string str = fields[i].GetCppString(); + if(str.empty()) + continue; + + int idx = GetOrNewIndexForLocale(LocaleConstant(i)); + if(idx >= 0) + { + if(data.IconName.size() <= idx) + data.IconName.resize(idx+1); + + data.IconName[idx] = str; + } + } + } while (result->NextRow()); + + delete result; + + sLog.outString(); + sLog.outString( ">> Loaded %u points_of_interest locale strings", mPointOfInterestLocaleMap.size() ); +} + struct SQLCreatureLoader : public SQLStorageLoaderBase<SQLCreatureLoader> { template<class D> @@ -5889,6 +5940,58 @@ void ObjectMgr::LoadReputationOnKill() sLog.outString(">> Loaded %u creature award reputation definitions", count); } +void ObjectMgr::LoadPointsOfInterest() +{ + uint32 count = 0; + + // 0 1 2 3 4 5 + QueryResult *result = WorldDatabase.Query("SELECT entry, x, y, icon, flags, data, icon_name FROM points_of_interest"); + + if(!result) + { + barGoLink bar(1); + + bar.step(); + + sLog.outString(); + sLog.outErrorDb(">> Loaded 0 Points of Interest definitions. DB table `points_of_interest` is empty."); + return; + } + + barGoLink bar(result->GetRowCount()); + + do + { + Field *fields = result->Fetch(); + bar.step(); + + uint32 point_id = fields[0].GetUInt32(); + + PointOfInterest POI; + 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].GetCppString(); + + if(!MaNGOS::IsValidMapCoord(POI.x,POI.y)) + { + sLog.outErrorDb("Table `points_of_interest` (Entry: %u) have invalid coordinates (X: %f Y: %f), ignored.",point_id,POI.x,POI.y); + continue; + } + + mPointsOfInterest[point_id] = POI; + + ++count; + } while (result->NextRow()); + + delete result; + + sLog.outString(); + sLog.outString(">> Loaded %u Points of Interest definitions", count); +} + void ObjectMgr::LoadWeatherZoneChances() { uint32 count = 0; diff --git a/src/game/ObjectMgr.h b/src/game/ObjectMgr.h index 342e87459c4..08f16571734 100644 --- a/src/game/ObjectMgr.h +++ b/src/game/ObjectMgr.h @@ -152,6 +152,7 @@ typedef UNORDERED_MAP<uint32,NpcTextLocale> NpcTextLocaleMap; typedef UNORDERED_MAP<uint32,PageTextLocale> PageTextLocaleMap; typedef UNORDERED_MAP<uint32,TrinityStringLocale> TrinityStringLocaleMap; typedef UNORDERED_MAP<uint32,NpcOptionLocale> NpcOptionLocaleMap; +typedef UNORDERED_MAP<uint32,PointOfInterestLocale> PointOfInterestLocaleMap; typedef std::multimap<uint32,uint32> QuestRelations; @@ -178,6 +179,17 @@ struct ReputationOnKillEntry bool team_dependent; }; +struct PointOfInterest +{ + uint32 entry; + float x; + float y; + uint32 icon; + uint32 flags; + uint32 data; + std::string icon_name; +}; + struct PetCreateSpellEntry { uint32 spellid[4]; @@ -316,6 +328,7 @@ class ObjectMgr typedef UNORDERED_MAP<uint32, uint32> AreaTriggerScriptMap; typedef UNORDERED_MAP<uint32, ReputationOnKillEntry> RepOnKillMap; + typedef UNORDERED_MAP<uint32, PointOfInterest> PointOfInterestMap; typedef UNORDERED_MAP<uint32, WeatherZoneChances> WeatherZoneMap; @@ -458,6 +471,14 @@ class ObjectMgr return NULL; } + PointOfInterest const* GetPointOfInterest(uint32 id) const + { + PointOfInterestMap::const_iterator itr = mPointsOfInterest.find(id); + if(itr != mPointsOfInterest.end()) + return &itr->second; + return NULL; + } + PetCreateSpellEntry const* GetPetCreateSpellEntry(uint32 id) const { PetCreateSpellMap::const_iterator itr = mPetCreateSpell.find(id); @@ -516,6 +537,7 @@ class ObjectMgr void LoadNpcTextLocales(); void LoadPageTextLocales(); void LoadNpcOptionLocales(); + void LoadPointOfInterestLocales(); void LoadInstanceTemplate(); void LoadGossipText(); @@ -538,6 +560,7 @@ class ObjectMgr void LoadFishingBaseSkillLevel(); void LoadReputationOnKill(); + void LoadPointsOfInterest(); void LoadWeatherZoneChances(); void LoadGameTele(); @@ -649,6 +672,12 @@ class ObjectMgr if(itr==mNpcOptionLocaleMap.end()) return NULL; return &itr->second; } + PointOfInterestLocale const* GetPointOfInterestLocale(uint32 poi_id) const + { + PointOfInterestLocaleMap::const_iterator itr = mPointOfInterestLocaleMap.find(poi_id); + if(itr==mPointOfInterestLocaleMap.end()) return NULL; + return &itr->second; + } GameObjectData const* GetGOData(uint32 guid) const { @@ -806,6 +835,8 @@ class ObjectMgr RepOnKillMap mRepOnKill; + PointOfInterestMap mPointsOfInterest; + WeatherZoneMap mWeatherZoneMap; PetCreateSpellMap mPetCreateSpell; @@ -867,6 +898,7 @@ class ObjectMgr PageTextLocaleMap mPageTextLocaleMap; TrinityStringLocaleMap mTrinityStringLocaleMap; NpcOptionLocaleMap mNpcOptionLocaleMap; + PointOfInterestLocaleMap mPointOfInterestLocaleMap; RespawnTimes mCreatureRespawnTimes; RespawnTimes mGORespawnTimes; diff --git a/src/game/World.cpp b/src/game/World.cpp index bad4eeef0c2..d1a10078efc 100644 --- a/src/game/World.cpp +++ b/src/game/World.cpp @@ -1131,6 +1131,7 @@ void World::SetInitialWorldSettings() objmgr.LoadNpcTextLocales(); objmgr.LoadPageTextLocales(); objmgr.LoadNpcOptionLocales(); + objmgr.LoadPointOfInterestLocales(); objmgr.SetDBCLocaleIndex(GetDefaultDbcLocale()); // Get once for all the locale index of DBC language (console/broadcasts) sLog.outString( ">>> Localization strings loaded" ); sLog.outString(); @@ -1195,6 +1196,9 @@ void World::SetInitialWorldSettings() sLog.outString( "Loading Creature Reputation OnKill Data..." ); objmgr.LoadReputationOnKill(); + sLog.outString( "Loading Points Of Interest Data..." ); + objmgr.LoadPointsOfInterest(); + sLog.outString( "Loading Pet Create Spells..." ); objmgr.LoadPetCreateSpells(); diff --git a/src/shared/revision_nr.h b/src/shared/revision_nr.h index 3d9e1623b01..3eb4d8c1f70 100644 --- a/src/shared/revision_nr.h +++ b/src/shared/revision_nr.h @@ -1,4 +1,4 @@ #ifndef __REVISION_NR_H__ #define __REVISION_NR_H__ - #define REVISION_NR "7291" + #define REVISION_NR "7292" #endif // __REVISION_NR_H__ |