Skip to content

Commit

Permalink
[8928] Rename internal names for gossipLocale and also correct reload…
Browse files Browse the repository at this point in the history
… gossip tables

Signed-off-by: NoFantasy <nofantasy@nf.no>
  • Loading branch information
NoFantasy committed Dec 6, 2009
1 parent 035b21f commit bcb2541
Show file tree
Hide file tree
Showing 9 changed files with 34 additions and 26 deletions.
3 changes: 2 additions & 1 deletion src/game/Chat.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -423,6 +423,8 @@ ChatCommand * ChatHandler::getCommandTable()
{ "gameobject_questrelation", SEC_ADMINISTRATOR, true, &ChatHandler::HandleReloadGOQuestRelationsCommand, "", NULL },
{ "gameobject_scripts", SEC_ADMINISTRATOR, true, &ChatHandler::HandleReloadGameObjectScriptsCommand, "", NULL },
{ "gameobject_battleground", SEC_ADMINISTRATOR, true, &ChatHandler::HandleReloadBattleEventCommand, "", NULL },
{ "gossip_menu", SEC_ADMINISTRATOR, true, &ChatHandler::HandleReloadGossipMenuCommand, "", NULL },
{ "gossip_menu_option", SEC_ADMINISTRATOR, true, &ChatHandler::HandleReloadGossipMenuOptionCommand, "", NULL },
{ "item_enchantment_template", SEC_ADMINISTRATOR, true, &ChatHandler::HandleReloadItemEnchantementsCommand, "", NULL },
{ "item_loot_template", SEC_ADMINISTRATOR, true, &ChatHandler::HandleReloadLootTemplatesItemCommand, "", NULL },
{ "item_required_target", SEC_ADMINISTRATOR, true, &ChatHandler::HandleReloadItemRequiredTragetCommand, "", NULL },
Expand All @@ -439,7 +441,6 @@ ChatCommand * ChatHandler::getCommandTable()
{ "mangos_string", SEC_ADMINISTRATOR, true, &ChatHandler::HandleReloadMangosStringCommand, "", 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 },
{ "npc_spellclick_spells", SEC_ADMINISTRATOR, true, &ChatHandler::HandleReloadSpellClickSpellsCommand, "",NULL},
{ "npc_trainer", SEC_ADMINISTRATOR, true, &ChatHandler::HandleReloadNpcTrainerCommand, "", NULL },
{ "npc_vendor", SEC_ADMINISTRATOR, true, &ChatHandler::HandleReloadNpcVendorCommand, "", NULL },
Expand Down
3 changes: 2 additions & 1 deletion src/game/Chat.h
Original file line number Diff line number Diff line change
Expand Up @@ -335,6 +335,8 @@ class ChatHandler
bool HandleReloadGameGraveyardZoneCommand(const char* args);
bool HandleReloadGameObjectScriptsCommand(const char* args);
bool HandleReloadGameTeleCommand(const char* args);
bool HandleReloadGossipMenuCommand(const char* args);
bool HandleReloadGossipMenuOptionCommand(const char* args);
bool HandleReloadGOQuestRelationsCommand(const char* args);
bool HandleReloadGOQuestInvRelationsCommand(const char* args);
bool HandleReloadItemEnchantementsCommand(const char* args);
Expand Down Expand Up @@ -362,7 +364,6 @@ class ChatHandler
bool HandleReloadMailLevelRewardCommand(const char* args);
bool HandleReloadMangosStringCommand(const char* args);
bool HandleReloadNpcGossipCommand(const char* args);
bool HandleReloadNpcOptionCommand(const char* args);
bool HandleReloadNpcTrainerCommand(const char* args);
bool HandleReloadNpcVendorCommand(const char* args);
bool HandleReloadPageTextsCommand(const char* args);
Expand Down
2 changes: 1 addition & 1 deletion src/game/Creature.h
Original file line number Diff line number Diff line change
Expand Up @@ -164,7 +164,7 @@ struct CreatureLocale
std::vector<std::string> SubName;
};

struct NpcOptionLocale
struct GossipMenuItemsLocale
{
std::vector<std::string> OptionText;
std::vector<std::string> BoxText;
Expand Down
26 changes: 16 additions & 10 deletions src/game/Level3.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,6 @@ bool ChatHandler::HandleReloadAllLootCommand(const char*)
bool ChatHandler::HandleReloadAllNpcCommand(const char* /*args*/)
{
HandleReloadNpcGossipCommand("a");
HandleReloadNpcOptionCommand("a");
HandleReloadNpcTrainerCommand("a");
HandleReloadNpcVendorCommand("a");
HandleReloadPointsOfInterestCommand("a");
Expand Down Expand Up @@ -252,6 +251,22 @@ bool ChatHandler::HandleReloadCreatureQuestInvRelationsCommand(const char*)
return true;
}

bool ChatHandler::HandleReloadGossipMenuCommand(const char*)
{
sLog.outString( "Re-Loading `gossip_menu` Table!" );
sObjectMgr.LoadGossipMenu();
SendGlobalSysMessage("DB table `gossip_menu` reloaded.");
return true;
}

bool ChatHandler::HandleReloadGossipMenuOptionCommand(const char*)
{
sLog.outString( "Re-Loading `gossip_menu_option` Table!" );
sObjectMgr.LoadGossipMenuItems();
SendGlobalSysMessage("DB table `gossip_menu_option` reloaded.");
return true;
}

bool ChatHandler::HandleReloadGOQuestRelationsCommand(const char*)
{
sLog.outString( "Loading Quests Relations... (`gameobject_questrelation`)" );
Expand Down Expand Up @@ -404,15 +419,6 @@ bool ChatHandler::HandleReloadMangosStringCommand(const char*)
return true;
}

bool ChatHandler::HandleReloadNpcOptionCommand(const char*)
{
sLog.outString( "Re-Loading `npc_option` Table!" );
//sObjectMgr.LoadGossipMenu();
//sObjectMgr.LoadGossipMenuItems();
SendGlobalSysMessage("DB table `npc_option` reloaded.");
return true;
}

bool ChatHandler::HandleReloadNpcGossipCommand(const char*)
{
sLog.outString( "Re-Loading `npc_gossip` Table!" );
Expand Down
8 changes: 4 additions & 4 deletions src/game/ObjectMgr.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -338,9 +338,9 @@ void ObjectMgr::LoadCreatureLocales()
sLog.outString( ">> Loaded %lu creature locale strings", (unsigned long)mCreatureLocaleMap.size() );
}

void ObjectMgr::LoadNpcOptionLocales()
void ObjectMgr::LoadGossipMenuItemsLocales()
{
mNpcOptionLocaleMap.clear(); // need for reload case
mGossipMenuItemsLocaleMap.clear(); // need for reload case

QueryResult *result = WorldDatabase.Query("SELECT menu_id,id,"
"option_text_loc1,box_text_loc1,option_text_loc2,box_text_loc2,"
Expand Down Expand Up @@ -370,7 +370,7 @@ void ObjectMgr::LoadNpcOptionLocales()
uint16 menuId = fields[0].GetUInt16();
uint16 id = fields[1].GetUInt16();

NpcOptionLocale& data = mNpcOptionLocaleMap[MAKE_PAIR32(menuId,id)];
GossipMenuItemsLocale& data = mGossipMenuItemsLocaleMap[MAKE_PAIR32(menuId,id)];

for(int i = 1; i < MAX_LOCALE; ++i)
{
Expand Down Expand Up @@ -404,7 +404,7 @@ void ObjectMgr::LoadNpcOptionLocales()
delete result;

sLog.outString();
sLog.outString( ">> Loaded %lu gossip_menu_option locale strings", (unsigned long)mNpcOptionLocaleMap.size() );
sLog.outString( ">> Loaded %lu gossip_menu_option locale strings", (unsigned long)mGossipMenuItemsLocaleMap.size() );
}

void ObjectMgr::LoadPointOfInterestLocales()
Expand Down
12 changes: 6 additions & 6 deletions src/game/ObjectMgr.h
Original file line number Diff line number Diff line change
Expand Up @@ -162,7 +162,7 @@ typedef UNORDERED_MAP<uint32,QuestLocale> QuestLocaleMap;
typedef UNORDERED_MAP<uint32,NpcTextLocale> NpcTextLocaleMap;
typedef UNORDERED_MAP<uint32,PageTextLocale> PageTextLocaleMap;
typedef UNORDERED_MAP<int32,MangosStringLocale> MangosStringLocaleMap;
typedef UNORDERED_MAP<uint32,NpcOptionLocale> NpcOptionLocaleMap;
typedef UNORDERED_MAP<uint32,GossipMenuItemsLocale> GossipMenuItemsLocaleMap;
typedef UNORDERED_MAP<uint32,PointOfInterestLocale> PointOfInterestLocaleMap;

typedef std::multimap<uint32,uint32> QuestRelations;
Expand Down Expand Up @@ -556,7 +556,7 @@ class ObjectMgr
void LoadQuestLocales();
void LoadNpcTextLocales();
void LoadPageTextLocales();
void LoadNpcOptionLocales();
void LoadGossipMenuItemsLocales();
void LoadPointOfInterestLocales();
void LoadInstanceTemplate();
void LoadMailLevelRewards();
Expand Down Expand Up @@ -703,10 +703,10 @@ class ObjectMgr
if(itr==mPageTextLocaleMap.end()) return NULL;
return &itr->second;
}
NpcOptionLocale const* GetNpcOptionLocale(uint32 entry) const
GossipMenuItemsLocale const* GetGossipMenuItemsLocale(uint32 entry) const
{
NpcOptionLocaleMap::const_iterator itr = mNpcOptionLocaleMap.find(entry);
if(itr==mNpcOptionLocaleMap.end()) return NULL;
GossipMenuItemsLocaleMap::const_iterator itr = mGossipMenuItemsLocaleMap.find(entry);
if(itr==mGossipMenuItemsLocaleMap.end()) return NULL;
return &itr->second;
}
PointOfInterestLocale const* GetPointOfInterestLocale(uint32 poi_id) const
Expand Down Expand Up @@ -949,7 +949,7 @@ class ObjectMgr
NpcTextLocaleMap mNpcTextLocaleMap;
PageTextLocaleMap mPageTextLocaleMap;
MangosStringLocaleMap mMangosStringLocaleMap;
NpcOptionLocaleMap mNpcOptionLocaleMap;
GossipMenuItemsLocaleMap mGossipMenuItemsLocaleMap;
PointOfInterestLocaleMap mPointOfInterestLocaleMap;
RespawnTimes mCreatureRespawnTimes;
RespawnTimes mGORespawnTimes;
Expand Down
2 changes: 1 addition & 1 deletion src/game/Player.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -12304,7 +12304,7 @@ void Player::PrepareGossipMenu(WorldObject *pSource, uint32 menuId)
{
uint32 idxEntry = MAKE_PAIR32(menuId, itr->second.id);

if (NpcOptionLocale const *no = sObjectMgr.GetNpcOptionLocale(idxEntry))
if (GossipMenuItemsLocale const *no = sObjectMgr.GetGossipMenuItemsLocale(idxEntry))
{
if (no->OptionText.size() > (size_t)loc_idx && !no->OptionText[loc_idx].empty())
strOptionText = no->OptionText[loc_idx];
Expand Down
2 changes: 1 addition & 1 deletion src/game/World.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1176,7 +1176,7 @@ void World::SetInitialWorldSettings()
sObjectMgr.LoadQuestLocales();
sObjectMgr.LoadNpcTextLocales();
sObjectMgr.LoadPageTextLocales();
sObjectMgr.LoadNpcOptionLocales();
sObjectMgr.LoadGossipMenuItemsLocales();
sObjectMgr.LoadPointOfInterestLocales();
sObjectMgr.SetDBCLocaleIndex(GetDefaultDbcLocale()); // Get once for all the locale index of DBC language (console/broadcasts)
sLog.outString( ">>> Localization strings loaded" );
Expand Down
2 changes: 1 addition & 1 deletion src/shared/revision_nr.h
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#ifndef __REVISION_NR_H__
#define __REVISION_NR_H__
#define REVISION_NR "8927"
#define REVISION_NR "8928"
#endif // __REVISION_NR_H__

7 comments on commit bcb2541

@przemratajczak
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

when will be availeble documentation for new gossip system?

@Wowka321
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

NoFantasy, now menu looking like:
GOSSIP_OPTION_TRAINER
GOSSIP_OPTION_UNLEARNTALENTS
but not:
I wanna reset my talents
..etc..
It's DB issue? Where we can handle texts for menu? Also locales possible now? ^_^

@Wowka321
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

damn. not showing ((
like:
http://paste2.org/p/549681

@LordJZ
Copy link
Contributor

@LordJZ LordJZ commented on bcb2541 Dec 6, 2009

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can anyone please copy-paste link to paste2.org or something like this?

http://udbforums.kicks-ass.net/index.php?topic=14977

@LordJZ
Copy link
Contributor

@LordJZ LordJZ commented on bcb2541 Dec 6, 2009

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That's a small documentation by NoFantasy

@Wowka321
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@LordJZ
Copy link
Contributor

@LordJZ LordJZ commented on bcb2541 Dec 6, 2009

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks

Please sign in to comment.