Changeset 79
- Timestamp:
- 11/19/08 13:32:21 (17 years ago)
- Location:
- trunk
- Files:
-
- 1 added
- 12 modified
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/game/AccountMgr.cpp
r44 r79 19 19 */ 20 20 21 #include "Account Mgr.h"21 #include "AccountAccessor.h" 22 22 #include "Database/DatabaseEnv.h" 23 23 #include "ObjectMgr.h" … … 82 82 83 83 // kick if player currently 84 if(Player* p = objmgr.GetPlayer(guid))84 if(Player* p = ObjectAccessor::FindPlayer(guid)) 85 85 { 86 86 WorldSession* s = p->GetSession(); … … 169 169 } 170 170 171 uint32 AccountMgr::GetSecurity(uint32 acc_id) 172 { 173 QueryResult *result = loginDatabase.PQuery("SELECT gmlevel FROM account WHERE id = '%u'", acc_id); 174 if(result) 175 { 176 uint32 sec = (*result)[0].GetUInt32(); 177 delete result; 178 return sec; 179 } 180 181 return 0; 182 } 183 184 bool AccountMgr::GetName(uint32 acc_id, std::string &name) 185 { 186 QueryResult *result = loginDatabase.PQuery("SELECT username FROM account WHERE id = '%u'", acc_id); 187 if(result) 188 { 189 name = (*result)[0].GetCppString(); 190 delete result; 191 return true; 192 } 193 194 return false; 195 } 196 171 197 bool AccountMgr::CheckPassword(uint32 accid, std::string passwd) 172 198 { -
trunk/src/game/AccountMgr.h
r44 r79 51 51 52 52 uint32 GetId(std::string username); 53 uint32 GetIdByGUID(const uint64 &guid) const; 54 uint32 GetSecurity(uint32 acc_id); 55 bool GetName(uint32 acc_id, std::string &name); 53 56 54 57 static bool normilizeString(std::string& utf8str); -
trunk/src/game/Chat.cpp
r78 r79 149 149 { "all_spell", SEC_ADMINISTRATOR, &ChatHandler::HandleReloadAllSpellCommand, "", NULL }, 150 150 { "all_item", SEC_ADMINISTRATOR, &ChatHandler::HandleReloadAllItemCommand, "", NULL }, 151 { "all_locales", SEC_ADMINISTRATOR, &ChatHandler::HandleReloadAllLocalesCommand, "", NULL }, 151 152 152 153 { "config", SEC_ADMINISTRATOR, &ChatHandler::HandleReloadConfigCommand, "", NULL }, … … 197 198 { "spell_target_position", SEC_ADMINISTRATOR, &ChatHandler::HandleReloadSpellTargetPositionCommand, "", NULL }, 198 199 { "spell_threats", SEC_ADMINISTRATOR, &ChatHandler::HandleReloadSpellThreatsCommand, "", NULL }, 200 { "locales_creature", SEC_ADMINISTRATOR, &ChatHandler::HandleReloadLocalesCreatureCommand, "", NULL }, 201 { "locales_gameobject", SEC_ADMINISTRATOR, &ChatHandler::HandleReloadLocalesGameobjectCommand, "", NULL }, 202 { "locales_item", SEC_ADMINISTRATOR, &ChatHandler::HandleReloadLocalesItemCommand, "", NULL }, 203 { "locales_npc_text", SEC_ADMINISTRATOR, &ChatHandler::HandleReloadLocalesNpcTextCommand, "", NULL }, 204 { "locales_page_text", SEC_ADMINISTRATOR, &ChatHandler::HandleReloadLocalesPageTextCommand, "", NULL }, 205 { "locales_quest", SEC_ADMINISTRATOR, &ChatHandler::HandleReloadLocalesQuestCommand, "", NULL }, 199 206 { "", SEC_ADMINISTRATOR, &ChatHandler::HandleReloadCommand, "", NULL }, 200 207 { NULL, 0, NULL, "", NULL } … … 716 723 717 724 if( !hasStringAbbr(table[i].Name, subcmd) ) 725 continue; 718 726 719 727 (list += "\n ") += table[i].Name; -
trunk/src/game/Chat.h
r62 r79 147 147 bool HandleReloadAllScriptsCommand(const char* args); 148 148 bool HandleReloadAllSpellCommand(const char* args); 149 bool HandleReloadAllLocalesCommand(const char* args); 149 150 150 151 bool HandleReloadConfigCommand(const char* args); … … 195 196 bool HandleReloadPageTextsCommand(const char* args); 196 197 bool HandleReloadItemEnchantementsCommand(const char* args); 198 bool HandleReloadLocalesCreatureCommand(const char* args); 199 bool HandleReloadLocalesGameobjectCommand(const char* args); 200 bool HandleReloadLocalesItemCommand(const char* args); 201 bool HandleReloadLocalesNpcTextCommand(const char* args); 202 bool HandleReloadLocalesPageTextCommand(const char* args); 203 bool HandleReloadLocalesQuestCommand(const char* args); 197 204 198 205 bool HandleInstanceListBindsCommand(const char* args); -
trunk/src/game/Level2.cpp
r44 r79 97 97 { 98 98 account_id = objmgr.GetPlayerAccountIdByGUID(guid); 99 security = objmgr.GetSecurityByAccount(account_id);99 security = accmgr.GetSecurity(account_id); 100 100 } 101 101 … … 163 163 { 164 164 account_id = objmgr.GetPlayerAccountIdByGUID(guid); 165 security = objmgr.GetSecurityByAccount(account_id);165 security = accmgr.GetSecurity(account_id); 166 166 } 167 167 … … 1450 1450 type_str = guid_str; 1451 1451 pCreature = getSelectedCreature(); 1452 if(!pCreature )1452 if(!pCreature || pCreature->isPet()) 1453 1453 return false; 1454 1454 lowguid = pCreature->GetDBTableGUIDLow(); … … 1596 1596 Creature *pCreature = getSelectedCreature(); 1597 1597 1598 if(!pCreature )1598 if(!pCreature || pCreature->isPet()) 1599 1599 { 1600 1600 SendSysMessage(LANG_SELECT_CREATURE); … … 2213 2213 // -> Player must have selected a creature 2214 2214 2215 if(!target )2215 if(!target || target->isPet()) 2216 2216 { 2217 2217 SendSysMessage(LANG_SELECT_CREATURE); … … 2297 2297 2298 2298 target = ObjectAccessor::GetCreature(*m_session->GetPlayer(),MAKE_NEW_GUID(lowguid,data->id,HIGHGUID_UNIT)); 2299 if(!target )2299 if(!target || target->isPet()) 2300 2300 { 2301 2301 PSendSysMessage(LANG_WAYPOINT_CREATNOTFOUND, lowguid); -
trunk/src/game/Level3.cpp
r62 r79 25 25 #include "World.h" 26 26 #include "ObjectMgr.h" 27 #include "AccountMgr.h" 27 28 #include "PlayerDump.h" 28 29 #include "SpellMgr.h" … … 73 74 HandleReloadAllSpellCommand(""); 74 75 HandleReloadAllItemCommand(""); 76 HandleReloadAllLocalesCommand(""); 75 77 76 78 HandleReloadCommandCommand(""); … … 159 161 } 160 162 163 bool ChatHandler::HandleReloadAllLocalesCommand(const char* args) 164 { 165 HandleReloadLocalesCreatureCommand("a"); 166 HandleReloadLocalesGameobjectCommand("a"); 167 HandleReloadLocalesItemCommand("a"); 168 HandleReloadLocalesNpcTextCommand("a"); 169 HandleReloadLocalesPageTextCommand("a"); 170 HandleReloadLocalesQuestCommand("a"); 171 return true; 172 } 173 161 174 bool ChatHandler::HandleReloadConfigCommand(const char* arg) 162 175 { … … 598 611 SendGlobalSysMessage("DB table `game_tele` reloaded."); 599 612 613 return true; 614 } 615 616 bool ChatHandler::HandleReloadLocalesCreatureCommand(const char* /*arg*/) 617 { 618 sLog.outString( "Re-Loading Locales Creature ..."); 619 objmgr.LoadCreatureLocales(); 620 SendGlobalSysMessage("DB table `locales_creature` reloaded."); 621 return true; 622 } 623 624 bool ChatHandler::HandleReloadLocalesGameobjectCommand(const char* /*arg*/) 625 { 626 sLog.outString( "Re-Loading Locales Gameobject ... "); 627 objmgr.LoadGameObjectLocales(); 628 SendGlobalSysMessage("DB table `locales_gameobject` reloaded."); 629 return true; 630 } 631 632 bool ChatHandler::HandleReloadLocalesItemCommand(const char* /*arg*/) 633 { 634 sLog.outString( "Re-Loading Locales Item ... "); 635 objmgr.LoadItemLocales(); 636 SendGlobalSysMessage("DB table `locales_item` reloaded."); 637 return true; 638 } 639 640 bool ChatHandler::HandleReloadLocalesNpcTextCommand(const char* /*arg*/) 641 { 642 sLog.outString( "Re-Loading Locales NPC Text ... "); 643 objmgr.LoadNpcTextLocales(); 644 SendGlobalSysMessage("DB table `locales_npc_text` reloaded."); 645 return true; 646 } 647 648 bool ChatHandler::HandleReloadLocalesPageTextCommand(const char* /*arg*/) 649 { 650 sLog.outString( "Re-Loading Locales Page Text ... "); 651 objmgr.LoadPageTextLocales(); 652 SendGlobalSysMessage("DB table `locales_page_text` reloaded."); 653 return true; 654 } 655 656 bool ChatHandler::HandleReloadLocalesQuestCommand(const char* /*arg*/) 657 { 658 sLog.outString( "Re-Loading Locales Quest ... "); 659 objmgr.LoadQuestLocales(); 660 SendGlobalSysMessage("DB table `locales_quest` reloaded."); 600 661 return true; 601 662 } … … 655 716 } 656 717 targetAccountId = objmgr.GetPlayerAccountIdByGUID(targetGUID); 657 targetSecurity = objmgr.GetSecurityByAccount(targetAccountId);718 targetSecurity = accmgr.GetSecurity(targetAccountId); 658 719 } 659 720 … … 4955 5016 return false; 4956 5017 4957 uint32 account_id = objmgr.GetAccountByAccountName(acc);5018 uint32 account_id = accmgr.GetId(acc); 4958 5019 if(!account_id) 4959 5020 { … … 4962 5023 { 4963 5024 std::string acc_name; 4964 if(! objmgr.GetAccountNameByAccount(account_id,acc_name))5025 if(!accmgr.GetName(account_id,acc_name)) 4965 5026 return false; 4966 5027 } -
trunk/src/game/ObjectMgr.cpp
r78 r79 40 40 #include "Spell.h" 41 41 #include "Chat.h" 42 #include "AccountMgr.h" 42 43 #include "InstanceSaveMgr.h" 43 44 #include "SpellAuras.h" … … 321 322 bidder_accId = GetPlayerAccountIdByGUID(bidder_guid); 322 323 bidder_security = GetSecurityByAccount(bidder_accId); 324 bidder_security = accmgr.GetSecurity(bidder_accId); 323 325 324 326 if(bidder_security > SEC_PLAYER ) // not do redundant DB requests … … 505 507 void ObjectMgr::LoadCreatureLocales() 506 508 { 509 mCreatureLocaleMap.clear(); 510 507 511 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"); 508 512 … … 1298 1302 } 1299 1303 1300 uint32 ObjectMgr::GetSecurityByAccount(uint32 acc_id) const1301 {1302 QueryResult *result = loginDatabase.PQuery("SELECT gmlevel FROM account WHERE id = '%u'", acc_id);1303 if(result)1304 {1305 uint32 sec = (*result)[0].GetUInt32();1306 delete result;1307 return sec;1308 }1309 1310 return 0;1311 }1312 1313 bool ObjectMgr::GetAccountNameByAccount(uint32 acc_id, std::string &name) const1314 {1315 QueryResult *result = loginDatabase.PQuery("SELECT username FROM account WHERE id = '%u'", acc_id);1316 if(result)1317 {1318 name = (*result)[0].GetCppString();1319 delete result;1320 return true;1321 }1322 1323 return false;1324 }1325 1326 uint32 ObjectMgr::GetAccountByAccountName(std::string name) const1327 {1328 loginDatabase.escape_string(name);1329 QueryResult *result = loginDatabase.PQuery("SELECT id FROM account WHERE username = '%s'", name.c_str());1330 if(result)1331 {1332 uint32 id = (*result)[0].GetUInt32();1333 delete result;1334 return id;1335 }1336 1337 return 0;1338 }1339 1340 1304 void ObjectMgr::LoadAuctions() 1341 1305 { … … 1399 1363 void ObjectMgr::LoadItemLocales() 1400 1364 { 1365 mItemLocaleMap.clear(); 1366 1401 1367 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"); 1402 1368 … … 3420 3386 void ObjectMgr::LoadQuestLocales() 3421 3387 { 3388 mQuestLocaleMap.clear(); 3389 3422 3390 QueryResult *result = WorldDatabase.Query("SELECT entry," 3423 3391 "Title_loc1,Details_loc1,Objectives_loc1,OfferRewardText_loc1,RequestItemsText_loc1,EndText_loc1,ObjectiveText1_loc1,ObjectiveText2_loc1,ObjectiveText3_loc1,ObjectiveText4_loc1," … … 4015 3983 void ObjectMgr::LoadPageTextLocales() 4016 3984 { 3985 mPageTextLocaleMap.clear(); 3986 4017 3987 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"); 4018 3988 … … 4181 4151 void ObjectMgr::LoadNpcTextLocales() 4182 4152 { 4153 mNpcTextLocaleMap.clear(); 4154 4183 4155 QueryResult *result = WorldDatabase.Query("SELECT entry," 4184 4156 "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," … … 5204 5176 void ObjectMgr::LoadGameObjectLocales() 5205 5177 { 5178 mGameObjectLocaleMap.clear(); 5179 5206 5180 QueryResult *result = WorldDatabase.Query("SELECT entry," 5207 5181 "name_loc1,name_loc2,name_loc3,name_loc4,name_loc5,name_loc6,name_loc7,name_loc8," -
trunk/src/game/ObjectMgr.h
r44 r79 397 397 uint32 GetPlayerTeamByGUID(const uint64 &guid) const; 398 398 uint32 GetPlayerAccountIdByGUID(const uint64 &guid) const; 399 uint32 GetSecurityByAccount(uint32 acc_id) const;400 bool GetAccountNameByAccount(uint32 acc_id, std::string &name) const;401 uint32 GetAccountByAccountName(std::string name) const;402 399 403 400 uint32 GetNearestTaxiNode( float x, float y, float z, uint32 mapid ); -
trunk/src/game/SharedDefines.h
r78 r79 2058 2058 SUMMON_TYPE_UNKNOWN4 = 187, 2059 2059 SUMMON_TYPE_UNKNOWN1 = 247, 2060 SUMMON_TYPE_UNKNOWN5 = 307,2061 2060 SUMMON_TYPE_CRITTER2 = 407, 2062 SUMMON_TYPE_UNKNOWN6 = 409, 2061 SUMMON_TYPE_CRITTER3 = 307, 2062 SUMMON_TYPE_UNKNOWN5 = 409, 2063 2063 SUMMON_TYPE_UNKNOWN2 = 427, 2064 2064 SUMMON_TYPE_POSESSED2 = 428 -
trunk/src/game/SpellEffects.cpp
r70 r79 3084 3084 case SUMMON_TYPE_CRITTER: 3085 3085 case SUMMON_TYPE_CRITTER2: 3086 case SUMMON_TYPE_CRITTER3: 3086 3087 EffectSummonCritter(i); 3087 3088 break; … … 3098 3099 case SUMMON_TYPE_UNKNOWN4: 3099 3100 case SUMMON_TYPE_UNKNOWN5: 3100 case SUMMON_TYPE_UNKNOWN6:3101 3101 break; 3102 3102 default: -
trunk/src/game/SpellMgr.cpp
r73 r79 326 326 case 13139: // net-o-matic special effect 327 327 case 23445: // evil twin 328 case 38637: // Nether Exhaustion (red) 329 case 38638: // Nether Exhaustion (green) 330 case 38639: // Nether Exhaustion (blue) 328 331 return false; 329 332 default: -
trunk/src/trinitycore/CliRunnable.cpp
r78 r79 169 169 } 170 170 171 uint32 account_id = objmgr.GetAccountByAccountName(acc);171 uint32 account_id = accmgr.GetId(acc); 172 172 if(!account_id) 173 173 { … … 176 176 { 177 177 std::string acc_name; 178 if(! objmgr.GetAccountNameByAccount(account_id,acc_name))178 if(!accmgr.GetName(account_id,acc_name)) 179 179 { 180 180 zprintf("Failed to load the character! Account not exist.\r\n");