diff options
-rw-r--r-- | sql/updates/84_world.sql | 3 | ||||
-rw-r--r-- | src/game/AccountMgr.cpp | 30 | ||||
-rw-r--r-- | src/game/AccountMgr.h | 3 | ||||
-rw-r--r-- | src/game/Chat.cpp | 8 | ||||
-rw-r--r-- | src/game/Chat.h | 7 | ||||
-rw-r--r-- | src/game/Level2.cpp | 12 | ||||
-rw-r--r-- | src/game/Level3.cpp | 67 | ||||
-rw-r--r-- | src/game/ObjectMgr.cpp | 54 | ||||
-rw-r--r-- | src/game/ObjectMgr.h | 3 | ||||
-rw-r--r-- | src/game/SharedDefines.h | 4 | ||||
-rw-r--r-- | src/game/SpellEffects.cpp | 2 | ||||
-rw-r--r-- | src/game/SpellMgr.cpp | 3 | ||||
-rw-r--r-- | src/trinitycore/CliRunnable.cpp | 4 |
13 files changed, 141 insertions, 59 deletions
diff --git a/sql/updates/84_world.sql b/sql/updates/84_world.sql new file mode 100644 index 00000000000..7b2651071d0 --- /dev/null +++ b/sql/updates/84_world.sql @@ -0,0 +1,3 @@ +DELETE FROM command WHERE name = 'reload all_locales';
+INSERT INTO `command` VALUES
+('reload all_locales',3,'Syntax: .reload all_locales\r\n\r\nReload all `locales_*` tables with reload support added and that can be _safe_ reloaded.');
diff --git a/src/game/AccountMgr.cpp b/src/game/AccountMgr.cpp index b9bd00bb2cb..5deae7a75f9 100644 --- a/src/game/AccountMgr.cpp +++ b/src/game/AccountMgr.cpp @@ -18,7 +18,7 @@ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ -#include "AccountMgr.h" +#include "AccountAccessor.h" #include "Database/DatabaseEnv.h" #include "ObjectMgr.h" #include "Player.h" @@ -81,7 +81,7 @@ AccountOpResult AccountMgr::DeleteAccount(uint32 accid) uint64 guid = MAKE_NEW_GUID(guidlo, 0, HIGHGUID_PLAYER); // kick if player currently - if(Player* p = objmgr.GetPlayer(guid)) + if(Player* p = ObjectAccessor::FindPlayer(guid)) { WorldSession* s = p->GetSession(); s->KickPlayer(); // mark session to remove at next session list update @@ -168,6 +168,32 @@ uint32 AccountMgr::GetId(std::string username) } } +uint32 AccountMgr::GetSecurity(uint32 acc_id) +{ + QueryResult *result = loginDatabase.PQuery("SELECT gmlevel FROM account WHERE id = '%u'", acc_id); + if(result) + { + uint32 sec = (*result)[0].GetUInt32(); + delete result; + return sec; + } + + return 0; +} + +bool AccountMgr::GetName(uint32 acc_id, std::string &name) +{ + QueryResult *result = loginDatabase.PQuery("SELECT username FROM account WHERE id = '%u'", acc_id); + if(result) + { + name = (*result)[0].GetCppString(); + delete result; + return true; + } + + return false; +} + bool AccountMgr::CheckPassword(uint32 accid, std::string passwd) { normilizeString(passwd); diff --git a/src/game/AccountMgr.h b/src/game/AccountMgr.h index 20424094367..a5bf6adf799 100644 --- a/src/game/AccountMgr.h +++ b/src/game/AccountMgr.h @@ -50,6 +50,9 @@ class AccountMgr bool CheckPassword(uint32 accid, std::string passwd); uint32 GetId(std::string username); + uint32 GetIdByGUID(const uint64 &guid) const; + uint32 GetSecurity(uint32 acc_id); + bool GetName(uint32 acc_id, std::string &name); static bool normilizeString(std::string& utf8str); }; diff --git a/src/game/Chat.cpp b/src/game/Chat.cpp index 2f5eb5d71fb..1ade86026fa 100644 --- a/src/game/Chat.cpp +++ b/src/game/Chat.cpp @@ -148,6 +148,7 @@ ChatCommand * ChatHandler::getCommandTable() { "all_scripts", SEC_ADMINISTRATOR, &ChatHandler::HandleReloadAllScriptsCommand, "", NULL }, { "all_spell", SEC_ADMINISTRATOR, &ChatHandler::HandleReloadAllSpellCommand, "", NULL }, { "all_item", SEC_ADMINISTRATOR, &ChatHandler::HandleReloadAllItemCommand, "", NULL }, + { "all_locales", SEC_ADMINISTRATOR, &ChatHandler::HandleReloadAllLocalesCommand, "", NULL }, { "config", SEC_ADMINISTRATOR, &ChatHandler::HandleReloadConfigCommand, "", NULL }, @@ -196,6 +197,12 @@ ChatCommand * ChatHandler::getCommandTable() { "spell_scripts", SEC_ADMINISTRATOR, &ChatHandler::HandleReloadSpellScriptsCommand, "", NULL }, { "spell_target_position", SEC_ADMINISTRATOR, &ChatHandler::HandleReloadSpellTargetPositionCommand, "", NULL }, { "spell_threats", SEC_ADMINISTRATOR, &ChatHandler::HandleReloadSpellThreatsCommand, "", NULL }, + { "locales_creature", SEC_ADMINISTRATOR, &ChatHandler::HandleReloadLocalesCreatureCommand, "", NULL }, + { "locales_gameobject", SEC_ADMINISTRATOR, &ChatHandler::HandleReloadLocalesGameobjectCommand, "", NULL }, + { "locales_item", SEC_ADMINISTRATOR, &ChatHandler::HandleReloadLocalesItemCommand, "", NULL }, + { "locales_npc_text", SEC_ADMINISTRATOR, &ChatHandler::HandleReloadLocalesNpcTextCommand, "", NULL }, + { "locales_page_text", SEC_ADMINISTRATOR, &ChatHandler::HandleReloadLocalesPageTextCommand, "", NULL }, + { "locales_quest", SEC_ADMINISTRATOR, &ChatHandler::HandleReloadLocalesQuestCommand, "", NULL }, { "", SEC_ADMINISTRATOR, &ChatHandler::HandleReloadCommand, "", NULL }, { NULL, 0, NULL, "", NULL } }; @@ -715,6 +722,7 @@ bool ChatHandler::ShowHelpForSubCommands(ChatCommand *table, char const* cmd, ch continue; if( !hasStringAbbr(table[i].Name, subcmd) ) + continue; (list += "\n ") += table[i].Name; } diff --git a/src/game/Chat.h b/src/game/Chat.h index e6cbb4cb83a..686bf49eb9a 100644 --- a/src/game/Chat.h +++ b/src/game/Chat.h @@ -146,6 +146,7 @@ class ChatHandler bool HandleReloadAllQuestCommand(const char* args); bool HandleReloadAllScriptsCommand(const char* args); bool HandleReloadAllSpellCommand(const char* args); + bool HandleReloadAllLocalesCommand(const char* args); bool HandleReloadConfigCommand(const char* args); @@ -194,6 +195,12 @@ class ChatHandler bool HandleReloadSpellPetAurasCommand(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/Level2.cpp b/src/game/Level2.cpp index 485555e09f2..eb84bcbd1cd 100644 --- a/src/game/Level2.cpp +++ b/src/game/Level2.cpp @@ -96,7 +96,7 @@ bool ChatHandler::HandleMuteCommand(const char* args) else { account_id = objmgr.GetPlayerAccountIdByGUID(guid); - security = objmgr.GetSecurityByAccount(account_id); + security = accmgr.GetSecurity(account_id); } if(security >= m_session->GetSecurity()) @@ -162,7 +162,7 @@ bool ChatHandler::HandleUnmuteCommand(const char* args) else { account_id = objmgr.GetPlayerAccountIdByGUID(guid); - security = objmgr.GetSecurityByAccount(account_id); + security = accmgr.GetSecurity(account_id); } if(security >= m_session->GetSecurity()) @@ -1449,7 +1449,7 @@ bool ChatHandler::HandleSetMoveTypeCommand(const char* args) { type_str = guid_str; pCreature = getSelectedCreature(); - if(!pCreature) + if(!pCreature || pCreature->isPet()) return false; lowguid = pCreature->GetDBTableGUIDLow(); } @@ -1595,7 +1595,7 @@ bool ChatHandler::HandleSetModelCommand(const char* args) Creature *pCreature = getSelectedCreature(); - if(!pCreature) + if(!pCreature || pCreature->isPet()) { SendSysMessage(LANG_SELECT_CREATURE); SetSentErrorMessage(true); @@ -2212,7 +2212,7 @@ bool ChatHandler::HandleWpAddCommand(const char* args) // No GUID provided // -> Player must have selected a creature - if(!target) + if(!target || target->isPet()) { SendSysMessage(LANG_SELECT_CREATURE); SetSentErrorMessage(true); @@ -2296,7 +2296,7 @@ bool ChatHandler::HandleWpAddCommand(const char* args) } target = ObjectAccessor::GetCreature(*m_session->GetPlayer(),MAKE_NEW_GUID(lowguid,data->id,HIGHGUID_UNIT)); - if(!target) + if(!target || target->isPet()) { PSendSysMessage(LANG_WAYPOINT_CREATNOTFOUND, lowguid); SetSentErrorMessage(true); diff --git a/src/game/Level3.cpp b/src/game/Level3.cpp index 050b70fce6d..9298567ccdd 100644 --- a/src/game/Level3.cpp +++ b/src/game/Level3.cpp @@ -24,6 +24,7 @@ #include "WorldSession.h" #include "World.h" #include "ObjectMgr.h" +#include "AccountMgr.h" #include "PlayerDump.h" #include "SpellMgr.h" #include "Player.h" @@ -72,6 +73,7 @@ bool ChatHandler::HandleReloadAllCommand(const char*) HandleReloadAllQuestCommand(""); HandleReloadAllSpellCommand(""); HandleReloadAllItemCommand(""); + HandleReloadAllLocalesCommand(""); HandleReloadCommandCommand(""); HandleReloadReservedNameCommand(""); @@ -158,6 +160,17 @@ bool ChatHandler::HandleReloadAllItemCommand(const char*) return true; } +bool ChatHandler::HandleReloadAllLocalesCommand(const char* args) +{ + HandleReloadLocalesCreatureCommand("a"); + HandleReloadLocalesGameobjectCommand("a"); + HandleReloadLocalesItemCommand("a"); + HandleReloadLocalesNpcTextCommand("a"); + HandleReloadLocalesPageTextCommand("a"); + HandleReloadLocalesQuestCommand("a"); + return true; +} + bool ChatHandler::HandleReloadConfigCommand(const char* arg) { sLog.outString( "Re-Loading config settings..." ); @@ -600,6 +613,54 @@ bool ChatHandler::HandleReloadGameTeleCommand(const char* /*arg*/) return true; } +bool ChatHandler::HandleReloadLocalesCreatureCommand(const char* /*arg*/) +{ + sLog.outString( "Re-Loading Locales Creature ..."); + objmgr.LoadCreatureLocales(); + SendGlobalSysMessage("DB table `locales_creature` reloaded."); + return true; +} + +bool ChatHandler::HandleReloadLocalesGameobjectCommand(const char* /*arg*/) +{ + sLog.outString( "Re-Loading Locales Gameobject ... "); + objmgr.LoadGameObjectLocales(); + SendGlobalSysMessage("DB table `locales_gameobject` reloaded."); + return true; +} + +bool ChatHandler::HandleReloadLocalesItemCommand(const char* /*arg*/) +{ + sLog.outString( "Re-Loading Locales Item ... "); + objmgr.LoadItemLocales(); + SendGlobalSysMessage("DB table `locales_item` reloaded."); + return true; +} + +bool ChatHandler::HandleReloadLocalesNpcTextCommand(const char* /*arg*/) +{ + sLog.outString( "Re-Loading Locales NPC Text ... "); + objmgr.LoadNpcTextLocales(); + SendGlobalSysMessage("DB table `locales_npc_text` reloaded."); + return true; +} + +bool ChatHandler::HandleReloadLocalesPageTextCommand(const char* /*arg*/) +{ + sLog.outString( "Re-Loading Locales Page Text ... "); + objmgr.LoadPageTextLocales(); + SendGlobalSysMessage("DB table `locales_page_text` reloaded."); + return true; +} + +bool ChatHandler::HandleReloadLocalesQuestCommand(const char* /*arg*/) +{ + sLog.outString( "Re-Loading Locales Quest ... "); + objmgr.LoadQuestLocales(); + SendGlobalSysMessage("DB table `locales_quest` reloaded."); + return true; +} + bool ChatHandler::HandleLoadScriptsCommand(const char* args) { if(!LoadScriptingModule(args)) return true; @@ -654,7 +715,7 @@ bool ChatHandler::HandleSecurityCommand(const char* args) return false; } targetAccountId = objmgr.GetPlayerAccountIdByGUID(targetGUID); - targetSecurity = objmgr.GetSecurityByAccount(targetAccountId); + targetSecurity = accmgr.GetSecurity(targetAccountId); } arg2 = strtok(NULL, " "); @@ -4954,14 +5015,14 @@ bool ChatHandler::HandleLoadPDumpCommand(const char *args) if(!file || !acc) return false; - uint32 account_id = objmgr.GetAccountByAccountName(acc); + uint32 account_id = accmgr.GetId(acc); if(!account_id) { account_id = atoi(acc); if(account_id) { std::string acc_name; - if(!objmgr.GetAccountNameByAccount(account_id,acc_name)) + if(!accmgr.GetName(account_id,acc_name)) return false; } else diff --git a/src/game/ObjectMgr.cpp b/src/game/ObjectMgr.cpp index 7affe141f89..653049f5256 100644 --- a/src/game/ObjectMgr.cpp +++ b/src/game/ObjectMgr.cpp @@ -39,6 +39,7 @@ #include "GameEvent.h" #include "Spell.h" #include "Chat.h" +#include "AccountMgr.h" #include "InstanceSaveMgr.h" #include "SpellAuras.h" #include "Util.h" @@ -320,6 +321,7 @@ void ObjectMgr::SendAuctionWonMail( AuctionEntry *auction ) { bidder_accId = GetPlayerAccountIdByGUID(bidder_guid); bidder_security = GetSecurityByAccount(bidder_accId); + bidder_security = accmgr.GetSecurity(bidder_accId); if(bidder_security > SEC_PLAYER ) // not do redundant DB requests { @@ -504,6 +506,8 @@ CreatureInfo const* ObjectMgr::GetCreatureTemplate(uint32 id) void ObjectMgr::LoadCreatureLocales() { + mCreatureLocaleMap.clear(); + QueryResult *result = WorldDatabase.Query("SELECT entry,name_loc1,subname_loc1,name_loc2,subname_loc2,name_loc3,subname_loc3,name_loc4,subname_loc4,name_loc5,subname_loc5,name_loc6,subname_loc6,name_loc7,subname_loc7,name_loc8,subname_loc8 FROM locales_creature"); if(!result) @@ -1297,46 +1301,6 @@ uint32 ObjectMgr::GetPlayerAccountIdByGUID(const uint64 &guid) const return 0; } -uint32 ObjectMgr::GetSecurityByAccount(uint32 acc_id) const -{ - QueryResult *result = loginDatabase.PQuery("SELECT gmlevel FROM account WHERE id = '%u'", acc_id); - if(result) - { - uint32 sec = (*result)[0].GetUInt32(); - delete result; - return sec; - } - - return 0; -} - -bool ObjectMgr::GetAccountNameByAccount(uint32 acc_id, std::string &name) const -{ - QueryResult *result = loginDatabase.PQuery("SELECT username FROM account WHERE id = '%u'", acc_id); - if(result) - { - name = (*result)[0].GetCppString(); - delete result; - return true; - } - - return false; -} - -uint32 ObjectMgr::GetAccountByAccountName(std::string name) const -{ - loginDatabase.escape_string(name); - QueryResult *result = loginDatabase.PQuery("SELECT id FROM account WHERE username = '%s'", name.c_str()); - if(result) - { - uint32 id = (*result)[0].GetUInt32(); - delete result; - return id; - } - - return 0; -} - void ObjectMgr::LoadAuctions() { QueryResult *result = CharacterDatabase.Query("SELECT COUNT(*) FROM auctionhouse"); @@ -1398,6 +1362,8 @@ void ObjectMgr::LoadAuctions() void ObjectMgr::LoadItemLocales() { + mItemLocaleMap.clear(); + QueryResult *result = WorldDatabase.Query("SELECT entry,name_loc1,description_loc1,name_loc2,description_loc2,name_loc3,description_loc3,name_loc4,description_loc4,name_loc5,description_loc5,name_loc6,description_loc6,name_loc7,description_loc7,name_loc8,description_loc8 FROM locales_item"); if(!result) @@ -3419,6 +3385,8 @@ void ObjectMgr::LoadQuests() void ObjectMgr::LoadQuestLocales() { + mQuestLocaleMap.clear(); + QueryResult *result = WorldDatabase.Query("SELECT entry," "Title_loc1,Details_loc1,Objectives_loc1,OfferRewardText_loc1,RequestItemsText_loc1,EndText_loc1,ObjectiveText1_loc1,ObjectiveText2_loc1,ObjectiveText3_loc1,ObjectiveText4_loc1," "Title_loc2,Details_loc2,Objectives_loc2,OfferRewardText_loc2,RequestItemsText_loc2,EndText_loc2,ObjectiveText1_loc2,ObjectiveText2_loc2,ObjectiveText3_loc2,ObjectiveText4_loc2," @@ -4014,6 +3982,8 @@ void ObjectMgr::LoadPageTexts() void ObjectMgr::LoadPageTextLocales() { + mPageTextLocaleMap.clear(); + QueryResult *result = WorldDatabase.PQuery("SELECT entry,text_loc1,text_loc2,text_loc3,text_loc4,text_loc5,text_loc6,text_loc7,text_loc8 FROM locales_page_text"); if(!result) @@ -4180,6 +4150,8 @@ void ObjectMgr::LoadGossipText() void ObjectMgr::LoadNpcTextLocales() { + mNpcTextLocaleMap.clear(); + QueryResult *result = WorldDatabase.Query("SELECT entry," "Text0_0_loc1,Text0_1_loc1,Text1_0_loc1,Text1_1_loc1,Text2_0_loc1,Text2_1_loc1,Text3_0_loc1,Text3_1_loc1,Text4_0_loc1,Text4_1_loc1,Text5_0_loc1,Text5_1_loc1,Text6_0_loc1,Text6_1_loc1,Text7_0_loc1,Text7_1_loc1," "Text0_0_loc2,Text0_1_loc2,Text1_0_loc2,Text1_1_loc2,Text2_0_loc2,Text2_1_loc2,Text3_0_loc2,Text3_1_loc1,Text4_0_loc2,Text4_1_loc2,Text5_0_loc2,Text5_1_loc2,Text6_0_loc2,Text6_1_loc2,Text7_0_loc2,Text7_1_loc2," @@ -5203,6 +5175,8 @@ uint32 ObjectMgr::GenerateLowGuid(HighGuid guidhigh) void ObjectMgr::LoadGameObjectLocales() { + mGameObjectLocaleMap.clear(); + QueryResult *result = WorldDatabase.Query("SELECT entry," "name_loc1,name_loc2,name_loc3,name_loc4,name_loc5,name_loc6,name_loc7,name_loc8," "castbarcaption_loc1,castbarcaption_loc2,castbarcaption_loc3,castbarcaption_loc4," diff --git a/src/game/ObjectMgr.h b/src/game/ObjectMgr.h index 6afd1fc094e..19a3f07a359 100644 --- a/src/game/ObjectMgr.h +++ b/src/game/ObjectMgr.h @@ -396,9 +396,6 @@ class ObjectMgr bool GetPlayerNameByGUID(const uint64 &guid, std::string &name) const; uint32 GetPlayerTeamByGUID(const uint64 &guid) const; uint32 GetPlayerAccountIdByGUID(const uint64 &guid) const; - uint32 GetSecurityByAccount(uint32 acc_id) const; - bool GetAccountNameByAccount(uint32 acc_id, std::string &name) const; - uint32 GetAccountByAccountName(std::string name) const; uint32 GetNearestTaxiNode( float x, float y, float z, uint32 mapid ); void GetTaxiPath( uint32 source, uint32 destination, uint32 &path, uint32 &cost); diff --git a/src/game/SharedDefines.h b/src/game/SharedDefines.h index ad5426aeff1..643a3f85e9b 100644 --- a/src/game/SharedDefines.h +++ b/src/game/SharedDefines.h @@ -2057,9 +2057,9 @@ enum SummonType SUMMON_TYPE_UNKNOWN3 = 181, SUMMON_TYPE_UNKNOWN4 = 187, SUMMON_TYPE_UNKNOWN1 = 247, - SUMMON_TYPE_UNKNOWN5 = 307, SUMMON_TYPE_CRITTER2 = 407, - SUMMON_TYPE_UNKNOWN6 = 409, + SUMMON_TYPE_CRITTER3 = 307, + SUMMON_TYPE_UNKNOWN5 = 409, SUMMON_TYPE_UNKNOWN2 = 427, SUMMON_TYPE_POSESSED2 = 428 }; diff --git a/src/game/SpellEffects.cpp b/src/game/SpellEffects.cpp index 715fb276b29..085fb44b136 100644 --- a/src/game/SpellEffects.cpp +++ b/src/game/SpellEffects.cpp @@ -3083,6 +3083,7 @@ void Spell::EffectSummonType(uint32 i) break; case SUMMON_TYPE_CRITTER: case SUMMON_TYPE_CRITTER2: + case SUMMON_TYPE_CRITTER3: EffectSummonCritter(i); break; case SUMMON_TYPE_TOTEM_SLOT1: @@ -3097,7 +3098,6 @@ void Spell::EffectSummonType(uint32 i) case SUMMON_TYPE_UNKNOWN3: case SUMMON_TYPE_UNKNOWN4: case SUMMON_TYPE_UNKNOWN5: - case SUMMON_TYPE_UNKNOWN6: break; default: sLog.outError("EffectSummonType: Unhandled summon type %u", m_spellInfo->EffectMiscValueB[i]); diff --git a/src/game/SpellMgr.cpp b/src/game/SpellMgr.cpp index 02ff2395c1e..71831cb14ef 100644 --- a/src/game/SpellMgr.cpp +++ b/src/game/SpellMgr.cpp @@ -325,6 +325,9 @@ bool IsPositiveEffect(uint32 spellId, uint32 effIndex) { case 13139: // net-o-matic special effect case 23445: // evil twin + case 38637: // Nether Exhaustion (red) + case 38638: // Nether Exhaustion (green) + case 38639: // Nether Exhaustion (blue) return false; default: break; diff --git a/src/trinitycore/CliRunnable.cpp b/src/trinitycore/CliRunnable.cpp index ee4e5c3be54..394459ad787 100644 --- a/src/trinitycore/CliRunnable.cpp +++ b/src/trinitycore/CliRunnable.cpp @@ -168,14 +168,14 @@ void CliLoadPlayerDump(char*command,pPrintf zprintf) return; } - uint32 account_id = objmgr.GetAccountByAccountName(acc); + uint32 account_id = accmgr.GetId(acc); if(!account_id) { account_id = atoi(acc); if(account_id) { std::string acc_name; - if(!objmgr.GetAccountNameByAccount(account_id,acc_name)) + if(!accmgr.GetName(account_id,acc_name)) { zprintf("Failed to load the character! Account not exist.\r\n"); return; |