Changeset 184
- Timestamp:
- 11/19/08 13:44:16 (17 years ago)
- Files:
-
- 1 modified
-
trunk/src/game/Level3.cpp (modified) (88 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/game/Level3.cpp
r177 r184 1 1 /* 2 * Copyright (C) 2005-2008 MaNGOS <http://www.mangosproject.org/>3 *4 * Copyright (C) 2008 Trinity <http://www.trinitycore.org/>5 *6 * This program is free software; you can redistribute it and/or modify7 * it under the terms of the GNU General Public License as published by8 * the Free Software Foundation; either version 2 of the License, or9 * (at your option) any later version.10 *11 * This program is distributed in the hope that it will be useful,12 * but WITHOUT ANY WARRANTY; without even the implied warranty of13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.See the14 * GNU General Public License for more details.15 *16 * You should have received a copy of the GNU General Public License17 * along with this program; if not, write to the Free Software18 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307USA19 */2 * Copyright (C) 2005-2008 MaNGOS <http://www.mangosproject.org/> 3 * 4 * Copyright (C) 2008 Trinity <http://www.trinitycore.org/> 5 * 6 * This program is free software; you can redistribute it and/or modify 7 * it under the terms of the GNU General Public License as published by 8 * the Free Software Foundation; either version 2 of the License, or 9 * (at your option) any later version. 10 * 11 * This program is distributed in the hope that it will be useful, 12 * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 * GNU General Public License for more details. 15 * 16 * You should have received a copy of the GNU General Public License 17 * along with this program; if not, write to the Free Software 18 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 19 */ 20 20 21 21 #include "Common.h" … … 164 164 } 165 165 166 bool ChatHandler::HandleReloadAllLocalesCommand(const char* args)166 bool ChatHandler::HandleReloadAllLocalesCommand(const char* /*args*/) 167 167 { 168 168 HandleReloadLocalesCreatureCommand("a"); … … 175 175 } 176 176 177 bool ChatHandler::HandleReloadConfigCommand(const char* arg)177 bool ChatHandler::HandleReloadConfigCommand(const char* /*args*/) 178 178 { 179 179 sLog.outString( "Re-Loading config settings..." ); … … 435 435 sLog.outString( "Re-Loading Spell Elixir types..." ); 436 436 spellmgr.LoadSpellElixirs(); 437 SendGlobalSysMessage("DB table `spell_elixir` (spell e xlixir types) reloaded.");437 SendGlobalSysMessage("DB table `spell_elixir` (spell elixir types) reloaded."); 438 438 return true; 439 439 } … … 698 698 return false; 699 699 700 /// must be NULL if targeted syntax and must be not nULL if not targeted 700 701 char* arg2 = strtok(NULL, " "); 701 702 … … 704 705 uint32 targetSecurity = 0; 705 706 706 /// only target player different from self allowed (if targetPlayer!=NULL then not console)707 /// only target player different from self allowed (if targetPlayer!=NULL then not console) 707 708 Player* targetPlayer = getSelectedPlayer(); 708 709 if(targetPlayer && m_session->GetPlayer()!=targetPlayer) 709 710 { 710 711 /// wrong command syntax or unexpected targeting 711 if(arg2) 712 return false; 712 if(arg2) 713 return false; 714 715 /// security level expected in arg2 after this if. 716 arg2 = arg1; 713 717 714 718 targetAccountId = targetPlayer->GetSession()->GetAccountId(); 715 719 targetSecurity = targetPlayer->GetSession()->GetSecurity(); 716 720 if(!accmgr.GetName(targetAccountId,targetAccountName)) 717 {718 PSendSysMessage(LANG_ACCOUNT_NOT_EXIST,targetAccountName.c_str());719 SetSentErrorMessage(true);720 return false;721 }722 }723 else724 {725 targetAccountName = arg1;726 if(!AccountMgr::normilizeString(targetAccountName))727 721 { 728 722 PSendSysMessage(LANG_ACCOUNT_NOT_EXIST,targetAccountName.c_str()); … … 730 724 return false; 731 725 } 726 } 727 else 728 { 729 /// wrong command syntax (second arg expected) 730 if(!arg2) 731 return false; 732 733 targetAccountName = arg1; 734 if(!AccountMgr::normilizeString(targetAccountName)) 735 { 736 PSendSysMessage(LANG_ACCOUNT_NOT_EXIST,targetAccountName.c_str()); 737 SetSentErrorMessage(true); 738 return false; 739 } 732 740 733 741 targetAccountId = accmgr.GetId(targetAccountName); 734 targetSecurity = accmgr.GetSecurity(targetAccountId);742 targetSecurity = accmgr.GetSecurity(targetAccountId); 735 743 } 736 744 … … 744 752 745 753 /// m_session==NULL only for console 746 uint32 plSecurity = m_session ? m_session->GetSecurity() : SEC_CONSOLE;747 748 /// can set security level only for target with less security and to less security that we have749 /// This is also reject self apply in fact750 if(targetSecurity >= plSecurity || uint32(gm) >= plSecurity )754 uint32 plSecurity = m_session ? m_session->GetSecurity() : SEC_CONSOLE; 755 756 /// can set security level only for target with less security and to less security that we have 757 /// This is also reject self apply in fact 758 if(targetSecurity >= plSecurity || uint32(gm) >= plSecurity ) 751 759 { 752 760 SendSysMessage(LANG_YOURS_SECURITY_IS_LOW); … … 770 778 bool ChatHandler::HandleAccountSetPasswordCommand(const char* args) 771 779 { 772 if(!*args)773 return false;774 775 ///- Get the command line arguments776 char *szAccount = strtok ((char*)args," ");777 char *szPassword1 = strtok (NULL," ");778 char *szPassword2 = strtok (NULL," ");779 780 if (!szAccount||!szPassword1 || !szPassword2)781 return false;782 783 std::string account_name = szAccount;784 if(!AccountMgr::normilizeString(account_name))785 {786 PSendSysMessage(LANG_ACCOUNT_NOT_EXIST,account_name.c_str());787 SetSentErrorMessage(true);788 return false;789 }790 791 uint32 targetAccountId = accmgr.GetId(account_name);792 if (!targetAccountId)793 {794 PSendSysMessage(LANG_ACCOUNT_NOT_EXIST,account_name.c_str());795 SetSentErrorMessage(true);796 return false;797 }798 799 uint32 targetSecurity = accmgr.GetSecurity(targetAccountId);800 801 /// m_session==NULL only for console802 uint32 plSecurity = m_session ? m_session->GetSecurity() : SEC_CONSOLE;803 804 /// can set password only for target with less security805 /// This is also reject self apply in fact806 if (targetSecurity >= plSecurity)807 {808 SendSysMessage (LANG_YOURS_SECURITY_IS_LOW);809 SetSentErrorMessage (true);810 return false;811 }812 813 if (strcmp(szPassword1,szPassword2))814 {815 SendSysMessage (LANG_NEW_PASSWORDS_NOT_MATCH);816 SetSentErrorMessage (true);817 return false;818 }819 820 AccountOpResult result = accmgr.ChangePassword(targetAccountId, szPassword1);821 822 switch(result)823 {824 case AOR_OK:825 SendSysMessage(LANG_COMMAND_PASSWORD);826 break;827 case AOR_NAME_NOT_EXIST:828 PSendSysMessage(LANG_ACCOUNT_NOT_EXIST,account_name.c_str());829 SetSentErrorMessage(true);830 return false;831 case AOR_PASS_TOO_LONG:832 SendSysMessage(LANG_PASSWORD_TOO_LONG);833 SetSentErrorMessage(true);834 return false;835 default:836 SendSysMessage(LANG_COMMAND_NOTCHANGEPASSWORD);837 SetSentErrorMessage(true);838 return false;839 }840 841 return true;780 if(!*args) 781 return false; 782 783 ///- Get the command line arguments 784 char *szAccount = strtok ((char*)args," "); 785 char *szPassword1 = strtok (NULL," "); 786 char *szPassword2 = strtok (NULL," "); 787 788 if (!szAccount||!szPassword1 || !szPassword2) 789 return false; 790 791 std::string account_name = szAccount; 792 if(!AccountMgr::normilizeString(account_name)) 793 { 794 PSendSysMessage(LANG_ACCOUNT_NOT_EXIST,account_name.c_str()); 795 SetSentErrorMessage(true); 796 return false; 797 } 798 799 uint32 targetAccountId = accmgr.GetId(account_name); 800 if (!targetAccountId) 801 { 802 PSendSysMessage(LANG_ACCOUNT_NOT_EXIST,account_name.c_str()); 803 SetSentErrorMessage(true); 804 return false; 805 } 806 807 uint32 targetSecurity = accmgr.GetSecurity(targetAccountId); 808 809 /// m_session==NULL only for console 810 uint32 plSecurity = m_session ? m_session->GetSecurity() : SEC_CONSOLE; 811 812 /// can set password only for target with less security 813 /// This is also reject self apply in fact 814 if (targetSecurity >= plSecurity) 815 { 816 SendSysMessage (LANG_YOURS_SECURITY_IS_LOW); 817 SetSentErrorMessage (true); 818 return false; 819 } 820 821 if (strcmp(szPassword1,szPassword2)) 822 { 823 SendSysMessage (LANG_NEW_PASSWORDS_NOT_MATCH); 824 SetSentErrorMessage (true); 825 return false; 826 } 827 828 AccountOpResult result = accmgr.ChangePassword(targetAccountId, szPassword1); 829 830 switch(result) 831 { 832 case AOR_OK: 833 SendSysMessage(LANG_COMMAND_PASSWORD); 834 break; 835 case AOR_NAME_NOT_EXIST: 836 PSendSysMessage(LANG_ACCOUNT_NOT_EXIST,account_name.c_str()); 837 SetSentErrorMessage(true); 838 return false; 839 case AOR_PASS_TOO_LONG: 840 SendSysMessage(LANG_PASSWORD_TOO_LONG); 841 SetSentErrorMessage(true); 842 return false; 843 default: 844 SendSysMessage(LANG_COMMAND_NOTCHANGEPASSWORD); 845 SetSentErrorMessage(true); 846 return false; 847 } 848 849 return true; 842 850 } 843 851 … … 935 943 if (!*args) 936 944 return false; 937 938 945 939 946 // number or [name] Shift-click form |color|Hspell:spell_id|h[name]|h|r … … 1412 1419 "5916", 1413 1420 "6634", 1414 //"6718", phasing stealth, anno ing for learn all case.1421 //"6718", phasing stealth, annoying for learn all case. 1415 1422 "6719", 1416 1423 "8822", … … 1772 1779 } 1773 1780 1774 if(!spellid) // ??? none spells in t elent1781 if(!spellid) // ??? none spells in talent 1775 1782 continue; 1776 1783 … … 2020 2027 { 2021 2028 Item* item = plTarget->StoreNewItem( dest, pProto->ItemId, true); 2029 2022 2030 // remove binding (let GM give it to another player later) 2023 2031 if (pl==plTarget) 2024 2032 item->SetBinding( false ); 2025 2033 2026 pl->SendNewItem(item,1,false,true);2027 if (pl!=plTarget)2028 plTarget->SendNewItem(item,1,true,false);2034 pl->SendNewItem(item,1,false,true); 2035 if (pl!=plTarget) 2036 plTarget->SendNewItem(item,1,true,false); 2029 2037 } 2030 2038 else … … 2043 2051 return false; 2044 2052 } 2053 2045 2054 return true; 2046 2055 } … … 2056 2065 2057 2066 uint32 item_id = atol(cId); 2058 if(!item_id)2059 {2060 PSendSysMessage(LANG_COMMAND_ITEMIDINVALID, item_id);2061 SetSentErrorMessage(true);2062 return false;2063 }2064 2065 ItemPrototype const* itemProto = objmgr.GetItemPrototype(item_id);2067 if(!item_id) 2068 { 2069 PSendSysMessage(LANG_COMMAND_ITEMIDINVALID, item_id); 2070 SetSentErrorMessage(true); 2071 return false; 2072 } 2073 2074 ItemPrototype const* itemProto = objmgr.GetItemPrototype(item_id); 2066 2075 if(!itemProto) 2067 2076 { … … 2089 2098 2090 2099 result=CharacterDatabase.PQuery( 2091 // 0 1 2 3 4 52100 // 0 1 2 3 4 5 2092 2101 "SELECT ci.item, cibag.slot AS bag, ci.slot, ci.guid, characters.account,characters.name " 2093 2102 "FROM character_inventory AS ci LEFT JOIN character_inventory AS cibag ON (cibag.item=ci.bag),characters " … … 2143 2152 { 2144 2153 result=CharacterDatabase.PQuery( 2145 // 0 1 2 3 4 5 62154 // 0 1 2 3 4 5 6 2146 2155 "SELECT mail_items.item_guid, mail.sender, mail.receiver, char_s.account, char_s.name, char_r.account, char_r.name " 2147 2156 "FROM mail,mail_items,characters as char_s,characters as char_r " … … 2193 2202 { 2194 2203 result=CharacterDatabase.PQuery( 2195 // 0 1 2 32204 // 0 1 2 3 2196 2205 "SELECT auctionhouse.itemguid, auctionhouse.itemowner, characters.account, characters.name " 2197 2206 "FROM auctionhouse,characters WHERE auctionhouse.item_template='%u' AND characters.guid = auctionhouse.itemowner LIMIT %u", … … 2220 2229 2221 2230 // guild bank case 2222 uint32 guild_count = 0;2223 result=CharacterDatabase.PQuery("SELECT COUNT(item_entry) FROM guild_bank_item WHERE item_entry='%u'",item_id);2224 if(result)2225 {2226 guild_count = (*result)[0].GetUInt32();2227 delete result;2228 }2229 2230 result=CharacterDatabase.PQuery(2231 // 0 1 22232 "SELECT gi.item_guid, gi.guildid, guild.name "2233 "FROM guild_bank_item AS gi, guild WHERE gi.item_entry='%u' AND gi.guildid = guild.guildid LIMIT %u ",2234 item_id,uint32(count));2235 2236 if(result)2237 {2238 do2239 {2240 Field *fields = result->Fetch();2241 uint32 item_guid = fields[0].GetUInt32();2242 uint32 guild_guid = fields[1].GetUInt32();2243 std::string guild_name = fields[2].GetCppString();2244 2245 char const* item_pos = "[in guild bank]";2246 2247 PSendSysMessage(LANG_ITEMLIST_GUILD,item_guid,guild_name.c_str(),guild_guid,item_pos);2248 } while (result->NextRow());2249 2250 int64 res_count = result->GetRowCount();2251 2252 delete result;2253 2254 if(count > res_count)2255 count-=res_count;2256 else if(count)2257 count = 0;2258 }2259 2260 if(inv_count+mail_count+auc_count+guild_count == 0)2231 uint32 guild_count = 0; 2232 result=CharacterDatabase.PQuery("SELECT COUNT(item_entry) FROM guild_bank_item WHERE item_entry='%u'",item_id); 2233 if(result) 2234 { 2235 guild_count = (*result)[0].GetUInt32(); 2236 delete result; 2237 } 2238 2239 result=CharacterDatabase.PQuery( 2240 // 0 1 2 2241 "SELECT gi.item_guid, gi.guildid, guild.name " 2242 "FROM guild_bank_item AS gi, guild WHERE gi.item_entry='%u' AND gi.guildid = guild.guildid LIMIT %u ", 2243 item_id,uint32(count)); 2244 2245 if(result) 2246 { 2247 do 2248 { 2249 Field *fields = result->Fetch(); 2250 uint32 item_guid = fields[0].GetUInt32(); 2251 uint32 guild_guid = fields[1].GetUInt32(); 2252 std::string guild_name = fields[2].GetCppString(); 2253 2254 char const* item_pos = "[in guild bank]"; 2255 2256 PSendSysMessage(LANG_ITEMLIST_GUILD,item_guid,guild_name.c_str(),guild_guid,item_pos); 2257 } while (result->NextRow()); 2258 2259 int64 res_count = result->GetRowCount(); 2260 2261 delete result; 2262 2263 if(count > res_count) 2264 count-=res_count; 2265 else if(count) 2266 count = 0; 2267 } 2268 2269 if(inv_count+mail_count+auc_count+guild_count == 0) 2261 2270 { 2262 2271 SendSysMessage(LANG_COMMAND_NOITEMFOUND); … … 2281 2290 2282 2291 uint32 go_id = atol(cId); 2283 if(!go_id)2284 {2285 PSendSysMessage(LANG_COMMAND_LISTOBJINVALIDID, go_id);2286 SetSentErrorMessage(true);2287 return false;2288 }2292 if(!go_id) 2293 { 2294 PSendSysMessage(LANG_COMMAND_LISTOBJINVALIDID, go_id); 2295 SetSentErrorMessage(true); 2296 return false; 2297 } 2289 2298 2290 2299 GameObjectInfo const * gInfo = objmgr.GetGameObjectInfo(go_id); 2291 if(!gInfo)2300 if(!gInfo) 2292 2301 { 2293 2302 PSendSysMessage(LANG_COMMAND_LISTOBJINVALIDID, go_id); … … 2313 2322 2314 2323 if(m_session) 2315 {2316 Player* pl = m_session->GetPlayer();2317 result = WorldDatabase.PQuery("SELECT guid, position_x, position_y, position_z, map, (POW(position_x - '%f', 2) + POW(position_y - '%f', 2) + POW(position_z - '%f', 2)) AS order_ FROM gameobject WHERE id = '%u' ORDER BY order_ ASC LIMIT %u",2318 pl->GetPositionX(), pl->GetPositionY(), pl->GetPositionZ(),go_id,uint32(count));2319 }2320 else2321 result = WorldDatabase.PQuery("SELECT guid, position_x, position_y, position_z, map FROM gameobject WHERE id = '%u' LIMIT %u",2322 go_id,uint32(count));2324 { 2325 Player* pl = m_session->GetPlayer(); 2326 result = WorldDatabase.PQuery("SELECT guid, position_x, position_y, position_z, map, (POW(position_x - '%f', 2) + POW(position_y - '%f', 2) + POW(position_z - '%f', 2)) AS order_ FROM gameobject WHERE id = '%u' ORDER BY order_ ASC LIMIT %u", 2327 pl->GetPositionX(), pl->GetPositionY(), pl->GetPositionZ(),go_id,uint32(count)); 2328 } 2329 else 2330 result = WorldDatabase.PQuery("SELECT guid, position_x, position_y, position_z, map FROM gameobject WHERE id = '%u' LIMIT %u", 2331 go_id,uint32(count)); 2323 2332 2324 2333 if (result) … … 2334 2343 2335 2344 if (m_session) 2336 PSendSysMessage(LANG_GO_LIST_CHAT, guid, guid, gInfo->name, x, y, z, mapid);2337 else2338 PSendSysMessage(LANG_GO_LIST_CONSOLE, guid, gInfo->name, x, y, z, mapid);2345 PSendSysMessage(LANG_GO_LIST_CHAT, guid, guid, gInfo->name, x, y, z, mapid); 2346 else 2347 PSendSysMessage(LANG_GO_LIST_CONSOLE, guid, gInfo->name, x, y, z, mapid); 2339 2348 } while (result->NextRow()); 2340 2349 … … 2436 2445 2437 2446 uint32 cr_id = atol(cId); 2438 if(!cr_id)2439 {2440 PSendSysMessage(LANG_COMMAND_INVALIDCREATUREID, cr_id);2441 SetSentErrorMessage(true);2442 return false;2443 }2447 if(!cr_id) 2448 { 2449 PSendSysMessage(LANG_COMMAND_INVALIDCREATUREID, cr_id); 2450 SetSentErrorMessage(true); 2451 return false; 2452 } 2444 2453 2445 2454 CreatureInfo const* cInfo = objmgr.GetCreatureTemplate(cr_id); 2446 if(!cInfo)2455 if(!cInfo) 2447 2456 { 2448 2457 PSendSysMessage(LANG_COMMAND_INVALIDCREATUREID, cr_id); … … 2468 2477 2469 2478 if(m_session) 2470 {2471 Player* pl = m_session->GetPlayer();2472 result = WorldDatabase.PQuery("SELECT guid, position_x, position_y, position_z, map, (POW(position_x - '%f', 2) + POW(position_y - '%f', 2) + POW(position_z - '%f', 2)) AS order_ FROM creature WHERE id = '%u' ORDER BY order_ ASC LIMIT %u",2473 pl->GetPositionX(), pl->GetPositionY(), pl->GetPositionZ(), cr_id,uint32(count));2474 }2475 else2476 result = WorldDatabase.PQuery("SELECT guid, position_x, position_y, position_z, map FROM creature WHERE id = '%u' LIMIT %u",2477 cr_id,uint32(count));2479 { 2480 Player* pl = m_session->GetPlayer(); 2481 result = WorldDatabase.PQuery("SELECT guid, position_x, position_y, position_z, map, (POW(position_x - '%f', 2) + POW(position_y - '%f', 2) + POW(position_z - '%f', 2)) AS order_ FROM creature WHERE id = '%u' ORDER BY order_ ASC LIMIT %u", 2482 pl->GetPositionX(), pl->GetPositionY(), pl->GetPositionZ(), cr_id,uint32(count)); 2483 } 2484 else 2485 result = WorldDatabase.PQuery("SELECT guid, position_x, position_y, position_z, map FROM creature WHERE id = '%u' LIMIT %u", 2486 cr_id,uint32(count)); 2478 2487 2479 2488 if (result) … … 2489 2498 2490 2499 if (m_session) 2491 PSendSysMessage(LANG_CREATURE_LIST_CHAT, guid, guid, cInfo->Name, x, y, z, mapid);2492 else2493 PSendSysMessage(LANG_CREATURE_LIST_CONSOLE, guid, cInfo->Name, x, y, z, mapid);2500 PSendSysMessage(LANG_CREATURE_LIST_CHAT, guid, guid, cInfo->Name, x, y, z, mapid); 2501 else 2502 PSendSysMessage(LANG_CREATURE_LIST_CONSOLE, guid, cInfo->Name, x, y, z, mapid); 2494 2503 } while (result->NextRow()); 2495 2504 … … 2537 2546 { 2538 2547 if (m_session) 2539 PSendSysMessage(LANG_ITEM_LIST_CHAT, id, id, name.c_str());2540 else2541 PSendSysMessage(LANG_ITEM_LIST_CONSOLE, id, name.c_str());2548 PSendSysMessage(LANG_ITEM_LIST_CHAT, id, id, name.c_str()); 2549 else 2550 PSendSysMessage(LANG_ITEM_LIST_CONSOLE, id, name.c_str()); 2542 2551 ++counter; 2543 2552 continue; … … 2554 2563 { 2555 2564 if (m_session) 2556 PSendSysMessage(LANG_ITEM_LIST_CHAT, id, id, name.c_str());2557 else2558 PSendSysMessage(LANG_ITEM_LIST_CONSOLE, id, name.c_str());2565 PSendSysMessage(LANG_ITEM_LIST_CHAT, id, id, name.c_str()); 2566 else 2567 PSendSysMessage(LANG_ITEM_LIST_CONSOLE, id, name.c_str()); 2559 2568 ++counter; 2560 2569 } … … 2590 2599 { 2591 2600 int loc = m_session ? m_session->GetSessionDbcLocale() : sWorld.GetDefaultDbcLocale(); 2592 std::string name = set->name[loc];2601 std::string name = set->name[loc]; 2593 2602 if(name.empty()) 2594 2603 continue; … … 2615 2624 // send item set in "id - [namedlink locale]" format 2616 2625 if (m_session) 2617 PSendSysMessage(LANG_ITEMSET_LIST_CHAT,id,id,name.c_str(),localeNames[loc]);2618 else2619 PSendSysMessage(LANG_ITEMSET_LIST_CONSOLE,id,name.c_str(),localeNames[loc]);2626 PSendSysMessage(LANG_ITEMSET_LIST_CHAT,id,id,name.c_str(),localeNames[loc]); 2627 else 2628 PSendSysMessage(LANG_ITEMSET_LIST_CONSOLE,id,name.c_str(),localeNames[loc]); 2620 2629 ++counter; 2621 2630 } … … 2629 2638 bool ChatHandler::HandleLookupSkillCommand(const char* args) 2630 2639 { 2631 if(!*args)2632 return false; 2633 2634 // can be NULL in console call2635 Player* target = getSelectedPlayer();2640 if(!*args) 2641 return false; 2642 2643 // can be NULL in console call 2644 Player* target = getSelectedPlayer(); 2636 2645 2637 2646 std::string namepart = args; … … 2676 2685 if(loc < MAX_LOCALE) 2677 2686 { 2678 char const* knownStr = "";2679 if(target && target->HasSkill(id))2680 knownStr = GetTrinityString(LANG_KNOWN);2687 char const* knownStr = ""; 2688 if(target && target->HasSkill(id)) 2689 knownStr = GetTrinityString(LANG_KNOWN); 2681 2690 2682 2691 // send skill in "id - [namedlink locale]" format 2683 2692 if (m_session) 2684 PSendSysMessage(LANG_SKILL_LIST_CHAT,id,id,name.c_str(),localeNames[loc],knownStr);2685 else2686 PSendSysMessage(LANG_SKILL_LIST_CONSOLE,id,name.c_str(),localeNames[loc],knownStr);2693 PSendSysMessage(LANG_SKILL_LIST_CHAT,id,id,name.c_str(),localeNames[loc],knownStr); 2694 else 2695 PSendSysMessage(LANG_SKILL_LIST_CONSOLE,id,name.c_str(),localeNames[loc],knownStr); 2687 2696 2688 2697 ++counter; … … 2697 2706 bool ChatHandler::HandleLookupSpellCommand(const char* args) 2698 2707 { 2699 if(!*args)2700 return false; 2701 2702 // can be NULL at console call2703 Player* target = getSelectedPlayer();2708 if(!*args) 2709 return false; 2710 2711 // can be NULL at console call 2712 Player* target = getSelectedPlayer(); 2704 2713 2705 2714 std::string namepart = args; … … 2747 2756 bool learn = (spellInfo->Effect[0] == SPELL_EFFECT_LEARN_SPELL); 2748 2757 2749 uint32 t elentCost = GetTalentSpellCost(id);2750 2751 bool talent = (t elentCost > 0);2758 uint32 talentCost = GetTalentSpellCost(id); 2759 2760 bool talent = (talentCost > 0); 2752 2761 bool passive = IsPassiveSpell(id); 2753 2762 bool active = target && (target->HasAura(id,0) || target->HasAura(id,1) || target->HasAura(id,2)); … … 2755 2764 // unit32 used to prevent interpreting uint8 as char at output 2756 2765 // find rank of learned spell for learning spell, or talent rank 2757 uint32 rank = t elentCost ? telentCost : spellmgr.GetSpellRank(learn ? spellInfo->EffectTriggerSpell[0] : id);2766 uint32 rank = talentCost ? talentCost : spellmgr.GetSpellRank(learn ? spellInfo->EffectTriggerSpell[0] : id); 2758 2767 2759 2768 // send spell in "id - [name, rank N] [talent] [passive] [learn] [known]" format 2760 2769 std::ostringstream ss; 2761 2770 if (m_session) 2762 ss << id << " - |cffffffff|Hspell:" << id << "|h[" << name;2763 else2764 ss << id << " - " << name;2771 ss << id << " - |cffffffff|Hspell:" << id << "|h[" << name; 2772 else 2773 ss << id << " - " << name; 2765 2774 2766 2775 // include rank in link name … … 2769 2778 2770 2779 if (m_session) 2771 ss << " " << localeNames[loc] << "]|h|r";2772 else2773 ss << " " << localeNames[loc];2780 ss << " " << localeNames[loc] << "]|h|r"; 2781 else 2782 ss << " " << localeNames[loc]; 2774 2783 2775 2784 if(talent) … … 2797 2806 bool ChatHandler::HandleLookupQuestCommand(const char* args) 2798 2807 { 2799 if(!*args)2800 return false; 2801 2802 // can be NULL at console call2803 Player* target = getSelectedPlayer();2808 if(!*args) 2809 return false; 2810 2811 // can be NULL at console call 2812 Player* target = getSelectedPlayer(); 2804 2813 2805 2814 std::string namepart = args; … … 2833 2842 char const* statusStr = ""; 2834 2843 2835 if(target)2844 if(target) 2836 2845 { 2837 2846 QuestStatus status = target->GetQuestStatus(qinfo->GetQuestId()); 2838 2847 2839 if(status == QUEST_STATUS_COMPLETE)2840 {2841 if(target->GetQuestRewardStatus(qinfo->GetQuestId()))2842 statusStr = GetTrinityString(LANG_COMMAND_QUEST_REWARDED);2843 else2844 statusStr = GetTrinityString(LANG_COMMAND_QUEST_COMPLETE);2845 }2846 else if(status == QUEST_STATUS_INCOMPLETE)2847 statusStr = GetTrinityString(LANG_COMMAND_QUEST_ACTIVE);2848 if(status == QUEST_STATUS_COMPLETE) 2849 { 2850 if(target->GetQuestRewardStatus(qinfo->GetQuestId())) 2851 statusStr = GetTrinityString(LANG_COMMAND_QUEST_REWARDED); 2852 else 2853 statusStr = GetTrinityString(LANG_COMMAND_QUEST_COMPLETE); 2854 } 2855 else if(status == QUEST_STATUS_INCOMPLETE) 2856 statusStr = GetTrinityString(LANG_COMMAND_QUEST_ACTIVE); 2848 2857 } 2849 2850 if (m_session) 2851 PSendSysMessage(LANG_QUEST_LIST_CHAT,qinfo->GetQuestId(),qinfo->GetQuestId(),title.c_str(),statusStr); 2852 else 2853 PSendSysMessage(LANG_QUEST_LIST_CONSOLE,qinfo->GetQuestId(),title.c_str(),statusStr); 2854 2858 2859 if (m_session) 2860 PSendSysMessage(LANG_QUEST_LIST_CHAT,qinfo->GetQuestId(),qinfo->GetQuestId(),title.c_str(),statusStr); 2861 else 2862 PSendSysMessage(LANG_QUEST_LIST_CONSOLE,qinfo->GetQuestId(),title.c_str(),statusStr); 2855 2863 ++counter; 2856 2864 continue; … … 2867 2875 { 2868 2876 char const* statusStr = ""; 2869 2870 if(target)2877 2878 if(target) 2871 2879 { 2872 2880 QuestStatus status = target->GetQuestStatus(qinfo->GetQuestId()); 2873 2881 2874 if(status == QUEST_STATUS_COMPLETE)2875 {2876 if(target->GetQuestRewardStatus(qinfo->GetQuestId()))2877 statusStr = GetTrinityString(LANG_COMMAND_QUEST_REWARDED);2878 else2879 statusStr = GetTrinityString(LANG_COMMAND_QUEST_COMPLETE);2880 }2881 else if(status == QUEST_STATUS_INCOMPLETE)2882 statusStr = GetTrinityString(LANG_COMMAND_QUEST_ACTIVE);2882 if(status == QUEST_STATUS_COMPLETE) 2883 { 2884 if(target->GetQuestRewardStatus(qinfo->GetQuestId())) 2885 statusStr = GetTrinityString(LANG_COMMAND_QUEST_REWARDED); 2886 else 2887 statusStr = GetTrinityString(LANG_COMMAND_QUEST_COMPLETE); 2888 } 2889 else if(status == QUEST_STATUS_INCOMPLETE) 2890 statusStr = GetTrinityString(LANG_COMMAND_QUEST_ACTIVE); 2883 2891 } 2884 2885 if (m_session)2886 PSendSysMessage(LANG_QUEST_LIST_CHAT,qinfo->GetQuestId(),qinfo->GetQuestId(),title.c_str(),statusStr);2887 else2888 PSendSysMessage(LANG_QUEST_LIST_CONSOLE,qinfo->GetQuestId(),title.c_str(),statusStr);2892 2893 if (m_session) 2894 PSendSysMessage(LANG_QUEST_LIST_CHAT,qinfo->GetQuestId(),qinfo->GetQuestId(),title.c_str(),statusStr); 2895 else 2896 PSendSysMessage(LANG_QUEST_LIST_CONSOLE,qinfo->GetQuestId(),title.c_str(),statusStr); 2889 2897 2890 2898 ++counter; … … 2921 2929 2922 2930 int loc_idx = m_session ? m_session->GetSessionDbLocaleIndex() : objmgr.GetDBCLocaleIndex(); 2923 if (loc_idx >= 0)2931 if (loc_idx >= 0) 2924 2932 { 2925 2933 CreatureLocale const *cl = objmgr.GetCreatureLocale (id); … … 2933 2941 { 2934 2942 if (m_session) 2935 PSendSysMessage (LANG_CREATURE_ENTRY_LIST_CHAT, id, id, name.c_str ()); 2936 else 2937 PSendSysMessage (LANG_CREATURE_ENTRY_LIST_CONSOLE, id, name.c_str ()); 2938 2943 PSendSysMessage (LANG_CREATURE_ENTRY_LIST_CHAT, id, id, name.c_str ()); 2944 else 2945 PSendSysMessage (LANG_CREATURE_ENTRY_LIST_CONSOLE, id, name.c_str ()); 2939 2946 ++counter; 2940 2947 continue; … … 2951 2958 { 2952 2959 if (m_session) 2953 PSendSysMessage (LANG_CREATURE_ENTRY_LIST_CHAT, id, id, name.c_str ());2954 else2955 PSendSysMessage (LANG_CREATURE_ENTRY_LIST_CONSOLE, id, name.c_str ());2960 PSendSysMessage (LANG_CREATURE_ENTRY_LIST_CHAT, id, id, name.c_str ()); 2961 else 2962 PSendSysMessage (LANG_CREATURE_ENTRY_LIST_CONSOLE, id, name.c_str ()); 2956 2963 ++counter; 2957 2964 } … … 2999 3006 { 3000 3007 if (m_session) 3001 PSendSysMessage(LANG_GO_ENTRY_LIST_CHAT, id, id, name.c_str());3002 else3003 PSendSysMessage(LANG_GO_ENTRY_LIST_CONSOLE, id, name.c_str());3008 PSendSysMessage(LANG_GO_ENTRY_LIST_CHAT, id, id, name.c_str()); 3009 else 3010 PSendSysMessage(LANG_GO_ENTRY_LIST_CONSOLE, id, name.c_str()); 3004 3011 ++counter; 3005 3012 continue; … … 3016 3023 { 3017 3024 if (m_session) 3018 PSendSysMessage(LANG_GO_ENTRY_LIST_CHAT, id, id, name.c_str());3019 else3020 PSendSysMessage(LANG_GO_ENTRY_LIST_CONSOLE, id, name.c_str());3025 PSendSysMessage(LANG_GO_ENTRY_LIST_CHAT, id, id, name.c_str()); 3026 else 3027 PSendSysMessage(LANG_GO_ENTRY_LIST_CONSOLE, id, name.c_str()); 3021 3028 ++counter; 3022 3029 } … … 3044 3051 3045 3052 char *lname = strtok ((char*)args, " "); 3046 char *gname = strtok (NULL, "");3053 char *gname = strtok (NULL, ""); 3047 3054 3048 3055 if (!lname) 3049 3056 return false; 3050 3051 if (!gname)3057 3058 if (!gname) 3052 3059 { 3053 3060 SendSysMessage (LANG_INSERT_GUILD_NAME); 3054 SetSentErrorMessage (true);3061 SetSentErrorMessage (true); 3055 3062 return false; 3056 3063 } … … 3059 3066 3060 3067 Player* player = ObjectAccessor::Instance ().FindPlayerByName (lname); 3061 if (!player)3068 if (!player) 3062 3069 { 3063 3070 SendSysMessage (LANG_PLAYER_NOT_FOUND); 3064 SetSentErrorMessage (true);3071 SetSentErrorMessage (true); 3065 3072 return false; 3066 3073 } … … 3069 3076 { 3070 3077 SendSysMessage (LANG_PLAYER_IN_GUILD); 3071 return true;3072 }3073 3074 Guild *guild = new Guild;3075 if (!guild->create (player->GetGUID (),guildname))3076 {3077 delete guild;3078 SendSysMessage (LANG_GUILD_NOT_CREATED);3079 SetSentErrorMessage (true);3080 return false;3081 } 3082 3083 objmgr.AddGuild (guild);3078 return true; 3079 } 3080 3081 Guild *guild = new Guild; 3082 if (!guild->create (player->GetGUID (),guildname)) 3083 { 3084 delete guild; 3085 SendSysMessage (LANG_GUILD_NOT_CREATED); 3086 SetSentErrorMessage (true); 3087 return false; 3088 } 3089 3090 objmgr.AddGuild (guild); 3084 3091 return true; 3085 3092 } … … 3097 3104 std::string glName = par2; 3098 3105 Guild* targetGuild = objmgr.GetGuildByName (glName); 3099 if (!targetGuild)3106 if (!targetGuild) 3100 3107 return false; 3101 3108 … … 3104 3111 { 3105 3112 SendSysMessage (LANG_PLAYER_NOT_FOUND); 3106 SetSentErrorMessage (true);3113 SetSentErrorMessage (true); 3107 3114 return false; 3108 3115 } … … 3110 3117 uint64 plGuid = 0; 3111 3118 if (Player* targetPlayer = ObjectAccessor::Instance ().FindPlayerByName (plName.c_str ())) 3112 plGuid = targetPlayer->GetGUID ();3119 plGuid = targetPlayer->GetGUID (); 3113 3120 else 3114 3121 plGuid = objmgr.GetPlayerGUIDByName (plName.c_str ()); … … 3117 3124 false; 3118 3125 3119 // player s's guild membership checked in AddMember before add3126 // player's guild membership checked in AddMember before add 3120 3127 if (!targetGuild->AddMember (plGuid,targetGuild->GetLowestRank ())) 3121 3128 return false; … … 3137 3144 { 3138 3145 SendSysMessage (LANG_PLAYER_NOT_FOUND); 3139 SetSentErrorMessage (true);3146 SetSentErrorMessage (true); 3140 3147 return false; 3141 3148 } … … 3146 3153 { 3147 3154 plGuid = targetPlayer->GetGUID (); 3148 glId = targetPlayer->GetGuildId ();3155 glId = targetPlayer->GetGuildId (); 3149 3156 } 3150 3157 else 3151 3158 { 3152 3159 plGuid = objmgr.GetPlayerGUIDByName (plName.c_str ()); 3153 glId = Player::GetGuildIdFromDB (plGuid);3160 glId = Player::GetGuildIdFromDB (plGuid); 3154 3161 } 3155 3162 … … 3158 3165 3159 3166 Guild* targetGuild = objmgr.GetGuildById (glId); 3160 if (!targetGuild)3167 if (!targetGuild) 3161 3168 return false; 3162 3169 … … 3172 3179 3173 3180 char* par1 = strtok ((char*)args, " "); 3174 char* par2 = strtok (NULL, " "); 3175 if (!par1 || !par2) 3176 return false; 3177 3181 char* par2 = strtok (NULL, " "); 3182 if (!par1 || !par2) 3183 return false; 3178 3184 std::string plName = par1; 3179 3185 if (!normalizePlayerName (plName)) 3180 3186 { 3181 3187 SendSysMessage (LANG_PLAYER_NOT_FOUND); 3182 SetSentErrorMessage (true);3188 SetSentErrorMessage (true); 3183 3189 return false; 3184 3190 } … … 3189 3195 { 3190 3196 plGuid = targetPlayer->GetGUID (); 3191 glId = targetPlayer->GetGuildId ();3197 glId = targetPlayer->GetGuildId (); 3192 3198 } 3193 3199 else 3194 3200 { 3195 3201 plGuid = objmgr.GetPlayerGUIDByName (plName.c_str ()); 3196 glId = Player::GetGuildIdFromDB (plGuid);3202 glId = Player::GetGuildIdFromDB (plGuid); 3197 3203 } 3198 3204 … … 3201 3207 3202 3208 Guild* targetGuild = objmgr.GetGuildById (glId); 3203 if (!targetGuild)3209 if (!targetGuild) 3204 3210 return false; 3205 3211 3206 3212 uint32 newrank = uint32 (atoi (par2)); 3207 if (newrank > targetGuild->GetLowestRank ())3213 if (newrank > targetGuild->GetLowestRank ()) 3208 3214 return false; 3209 3215 … … 3219 3225 3220 3226 char* par1 = strtok ((char*)args, " "); 3221 if (!par1)3227 if (!par1) 3222 3228 return false; 3223 3229 … … 3225 3231 3226 3232 Guild* targetGuild = objmgr.GetGuildByName (gld); 3227 if (!targetGuild)3233 if (!targetGuild) 3228 3234 return false; 3229 3235 … … 3793 3799 return false; 3794 3800 } 3795 3801 3796 3802 if (strncmp(args, "on", 3) == 0) 3797 3803 player->SetMovement(MOVE_WATER_WALK); // ON … … 3832 3838 addlevel = atoi(px); 3833 3839 } 3834 // else .levelup - nothing do for prep ering3840 // else .levelup - nothing do for preparing 3835 3841 3836 3842 // player … … 3902 3908 else 3903 3909 { 3904 // update lev leand XP at level, all other will be updated at loading3910 // update level and XP at level, all other will be updated at loading 3905 3911 Tokens values; 3906 3912 Player::LoadValuesArrayFromDB(values,chr_guid); … … 4939 4945 bool ChatHandler::HandleBanCharacterCommand(const char* args) 4940 4946 { 4941 return HandleBanHelper(BAN_CHARACTER,args);4947 return HandleBanHelper(BAN_CHARACTER,args); 4942 4948 } 4943 4949 4944 4950 bool ChatHandler::HandleBanIPCommand(const char* args) 4945 4951 { 4946 return HandleBanHelper(BAN_IP,args);4952 return HandleBanHelper(BAN_IP,args); 4947 4953 } 4948 4954 4949 4955 bool ChatHandler::HandleBanHelper(BanMode mode, const char* args) 4950 4956 { 4951 if(!args)4957 if(!args) 4952 4958 return false; 4953 4959 4954 4960 char* cnameOrIP = strtok ((char*)args, " "); 4955 if (!cnameOrIP)4961 if (!cnameOrIP) 4956 4962 return false; 4957 4963 4958 4964 std::string nameOrIP = cnameOrIP; 4959 4965 4960 char* duration = strtok (NULL," ");4966 char* duration = strtok (NULL," "); 4961 4967 if(!duration || !atoi(duration)) 4962 4968 return false; … … 4967 4973 4968 4974 switch(mode) 4969 {4970 case BAN_ACCOUNT:4971 if(!AccountMgr::normilizeString(nameOrIP))4972 {4973 PSendSysMessage(LANG_ACCOUNT_NOT_EXIST,nameOrIP.c_str());4974 SetSentErrorMessage(true);4975 return false;4976 }4977 break;4978 case BAN_CHARACTER:4979 if(!normalizePlayerName(nameOrIP))4980 {4981 SendSysMessage(LANG_PLAYER_NOT_FOUND);4982 SetSentErrorMessage(true);4983 return false;4984 }4985 break;4986 case BAN_IP:4987 if(!IsIPAddress(nameOrIP.c_str()))4988 return false;4989 break;4990 }4991 4992 switch(sWorld.BanAccount(mode, nameOrIP, duration, reason,m_session ? m_session->GetPlayerName() : ""))4975 { 4976 case BAN_ACCOUNT: 4977 if(!AccountMgr::normilizeString(nameOrIP)) 4978 { 4979 PSendSysMessage(LANG_ACCOUNT_NOT_EXIST,nameOrIP.c_str()); 4980 SetSentErrorMessage(true); 4981 return false; 4982 } 4983 break; 4984 case BAN_CHARACTER: 4985 if(!normalizePlayerName(nameOrIP)) 4986 { 4987 SendSysMessage(LANG_PLAYER_NOT_FOUND); 4988 SetSentErrorMessage(true); 4989 return false; 4990 } 4991 break; 4992 case BAN_IP: 4993 if(!IsIPAddress(nameOrIP.c_str())) 4994 return false; 4995 break; 4996 } 4997 4998 switch(sWorld.BanAccount(mode, nameOrIP, duration, reason,m_session ? m_session->GetPlayerName() : "")) 4993 4999 { 4994 5000 case BAN_SUCCESS: … … 5001 5007 return false; 5002 5008 case BAN_NOTFOUND: 5003 switch(mode) 5004 { 5005 default: 5006 PSendSysMessage(LANG_BAN_NOTFOUND,"account",nameOrIP.c_str()); 5007 break; 5008 case BAN_CHARACTER: 5009 PSendSysMessage(LANG_BAN_NOTFOUND,"character",nameOrIP.c_str()); 5010 break; 5011 case BAN_IP: 5012 PSendSysMessage(LANG_BAN_NOTFOUND,"ip",nameOrIP.c_str()); 5013 break; 5014 5015 } 5016 SetSentErrorMessage(true); 5017 return false; 5009 switch(mode) 5010 { 5011 default: 5012 PSendSysMessage(LANG_BAN_NOTFOUND,"account",nameOrIP.c_str()); 5013 break; 5014 case BAN_CHARACTER: 5015 PSendSysMessage(LANG_BAN_NOTFOUND,"character",nameOrIP.c_str()); 5016 break; 5017 case BAN_IP: 5018 PSendSysMessage(LANG_BAN_NOTFOUND,"ip",nameOrIP.c_str()); 5019 break; 5020 } 5021 SetSentErrorMessage(true); 5022 return false; 5018 5023 } 5019 5024 … … 5028 5033 bool ChatHandler::HandleUnBanCharacterCommand(const char* args) 5029 5034 { 5030 return HandleUnBanHelper(BAN_CHARACTER,args);5035 return HandleUnBanHelper(BAN_CHARACTER,args); 5031 5036 } 5032 5037 5033 5038 bool ChatHandler::HandleUnBanIPCommand(const char* args) 5034 5039 { 5035 return HandleUnBanHelper(BAN_IP,args);5040 return HandleUnBanHelper(BAN_IP,args); 5036 5041 } 5037 5042 … … 5042 5047 5043 5048 char* cnameOrIP = strtok ((char*)args, " "); 5044 if(!cnameOrIP)5049 if(!cnameOrIP) 5045 5050 return false; 5046 5051 5047 5052 std::string nameOrIP = cnameOrIP; 5053 5048 5054 switch(mode) 5049 5055 { 5050 5056 case BAN_ACCOUNT: 5051 if(!AccountMgr::normilizeString(nameOrIP))5057 if(!AccountMgr::normilizeString(nameOrIP)) 5052 5058 { 5053 5059 PSendSysMessage(LANG_ACCOUNT_NOT_EXIST,nameOrIP.c_str()); 5054 SetSentErrorMessage(true);5055 return false;5056 }5057 break;5058 case BAN_CHARACTER:5059 if(!normalizePlayerName(nameOrIP))5060 SetSentErrorMessage(true); 5061 return false; 5062 } 5063 break; 5064 case BAN_CHARACTER: 5065 if(!normalizePlayerName(nameOrIP)) 5060 5066 { 5061 5067 SendSysMessage(LANG_PLAYER_NOT_FOUND); … … 5063 5069 return false; 5064 5070 } 5065 break;5066 case BAN_IP:5067 if(!IsIPAddress(nameOrIP.c_str()))5068 return false;5069 break;5070 }5071 5072 if(sWorld.RemoveBanAccount(mode,nameOrIP))5073 PSendSysMessage(LANG_UNBAN_UNBANNED,nameOrIP.c_str());5074 else5075 PSendSysMessage(LANG_UNBAN_ERROR,nameOrIP.c_str());5076 5077 return true;5071 break; 5072 case BAN_IP: 5073 if(!IsIPAddress(nameOrIP.c_str())) 5074 return false; 5075 break; 5076 } 5077 5078 if(sWorld.RemoveBanAccount(mode,nameOrIP)) 5079 PSendSysMessage(LANG_UNBAN_UNBANNED,nameOrIP.c_str()); 5080 else 5081 PSendSysMessage(LANG_UNBAN_ERROR,nameOrIP.c_str()); 5082 5083 return true; 5078 5084 } 5079 5085 5080 5086 bool ChatHandler::HandleBanInfoAccountCommand(const char* args) 5081 5087 { 5082 if(!args) 5083 return false; 5084 5085 char* cname = strtok((char*)args, ""); 5086 if(!cname) 5087 return false; 5088 5089 std::string account_name = cname; 5090 if(!AccountMgr::normilizeString(account_name)) 5091 { 5092 PSendSysMessage(LANG_ACCOUNT_NOT_EXIST,account_name.c_str()); 5093 SetSentErrorMessage(true); 5094 return false; 5095 } 5096 5097 uint32 accountid = accmgr.GetId(account_name); 5098 if(!accountid) 5088 if(!args) 5089 return false; 5090 5091 char* cname = strtok((char*)args, ""); 5092 if(!cname) 5093 return false; 5094 5095 std::string account_name = cname; 5096 if(!AccountMgr::normilizeString(account_name)) 5099 5097 { 5100 5098 PSendSysMessage(LANG_ACCOUNT_NOT_EXIST,account_name.c_str()); 5101 return true; 5102 } 5103 5104 return HandleBanInfoHelper(accountid,account_name.c_str()); 5099 SetSentErrorMessage(true); 5100 return false; 5101 } 5102 5103 uint32 accountid = accmgr.GetId(account_name); 5104 if(!accountid) 5105 { 5106 PSendSysMessage(LANG_ACCOUNT_NOT_EXIST,account_name.c_str()); 5107 return true; 5108 } 5109 5110 return HandleBanInfoHelper(accountid,account_name.c_str()); 5105 5111 } 5106 5112 … … 5111 5117 5112 5118 char* cname = strtok ((char*)args, ""); 5113 if(!cname)5119 if(!cname) 5114 5120 return false; 5115 5121 5116 5122 std::string name = cname; 5117 if(!normalizePlayerName(name))5118 {5119 SendSysMessage(LANG_PLAYER_NOT_FOUND);5120 SetSentErrorMessage(true);5121 return false;5122 }5123 if(!normalizePlayerName(name)) 5124 { 5125 SendSysMessage(LANG_PLAYER_NOT_FOUND); 5126 SetSentErrorMessage(true); 5127 return false; 5128 } 5123 5129 5124 5130 uint32 accountid = objmgr.GetPlayerAccountIdByPlayerName(name); 5125 if(!accountid)5131 if(!accountid) 5126 5132 { 5127 5133 SendSysMessage(LANG_PLAYER_NOT_FOUND); 5128 SetSentErrorMessage(true);5129 return false;5130 }5131 5132 std::string accountname;5133 if(!accmgr.GetName(accountid,accountname))5134 {5135 PSendSysMessage(LANG_BANINFO_NOCHARACTER);5134 SetSentErrorMessage(true); 5135 return false; 5136 } 5137 5138 std::string accountname; 5139 if(!accmgr.GetName(accountid,accountname)) 5140 { 5141 PSendSysMessage(LANG_BANINFO_NOCHARACTER); 5136 5142 return true; 5137 5143 } 5138 5139 return HandleBanInfoHelper(accountid,accountname.c_str());5144 5145 return HandleBanInfoHelper(accountid,accountname.c_str()); 5140 5146 } 5141 5147 5142 5148 bool ChatHandler::HandleBanInfoHelper(uint32 accountid, char const* accountname) 5143 5149 { 5144 QueryResult *result = loginDatabase.PQuery("SELECT FROM_UNIXTIME(bandate), unbandate-bandate, active, unbandate,banreason,bannedby FROM account_banned WHERE id = '%u' ORDER BY bandate ASC",accountid);5145 if(!result)5150 QueryResult *result = loginDatabase.PQuery("SELECT FROM_UNIXTIME(bandate), unbandate-bandate, active, unbandate,banreason,bannedby FROM account_banned WHERE id = '%u' ORDER BY bandate ASC",accountid); 5151 if(!result) 5146 5152 { 5147 5153 PSendSysMessage(LANG_BANINFO_NOACCOUNTBAN, accountname); 5148 return true;5149 } 5150 5151 PSendSysMessage(LANG_BANINFO_BANHISTORY,accountname);5152 do5154 return true; 5155 } 5156 5157 PSendSysMessage(LANG_BANINFO_BANHISTORY,accountname); 5158 do 5153 5159 { 5154 5160 Field* fields = result->Fetch(); 5155 5161 5156 time_t unbandate = time_t(fields[3].GetUInt64());5157 bool active = false;5158 if(fields[2].GetBool() && (fields[1].GetUInt64() == (uint64)0 ||unbandate >= time(NULL)) )5159 active = true;5160 bool permanent = (fields[1].GetUInt64() == (uint64)0);5161 std::string bantime = permanent?GetTrinityString(LANG_BANINFO_INFINITE):secsToTimeString(fields[1].GetUInt64(), true);5162 PSendSysMessage(LANG_BANINFO_HISTORYENTRY,5163 fields[0].GetString(), bantime.c_str(), active ? GetTrinityString(LANG_BANINFO_YES):GetTrinityString(LANG_BANINFO_NO), fields[4].GetString(), fields[5].GetString());5164 }while (result->NextRow());5165 5166 delete result;5167 return true;5162 time_t unbandate = time_t(fields[3].GetUInt64()); 5163 bool active = false; 5164 if(fields[2].GetBool() && (fields[1].GetUInt64() == (uint64)0 ||unbandate >= time(NULL)) ) 5165 active = true; 5166 bool permanent = (fields[1].GetUInt64() == (uint64)0); 5167 std::string bantime = permanent?GetTrinityString(LANG_BANINFO_INFINITE):secsToTimeString(fields[1].GetUInt64(), true); 5168 PSendSysMessage(LANG_BANINFO_HISTORYENTRY, 5169 fields[0].GetString(), bantime.c_str(), active ? GetTrinityString(LANG_BANINFO_YES):GetTrinityString(LANG_BANINFO_NO), fields[4].GetString(), fields[5].GetString()); 5170 }while (result->NextRow()); 5171 5172 delete result; 5173 return true; 5168 5174 } 5169 5175 5170 5176 bool ChatHandler::HandleBanInfoIPCommand(const char* args) 5171 5177 { 5172 if(!args)5173 return false;5174 5175 char* cIP = strtok ((char*)args, "");5176 if(!cIP)5177 return false;5178 5179 if (!IsIPAddress(cIP))5180 return false;5181 5182 std::string IP = cIP;5183 5184 loginDatabase.escape_string(IP);5185 QueryResult *result = loginDatabase.PQuery("SELECT ip, FROM_UNIXTIME(bandate), FROM_UNIXTIME(unbandate), unbandate-UNIX_TIMESTAMP(), banreason,bannedby,unbandate-bandate FROM ip_banned WHERE ip = '%s'",IP.c_str());5186 if(!result)5187 {5188 PSendSysMessage(LANG_BANINFO_NOIP);5189 return true;5190 } 5191 5192 Field *fields = result->Fetch();5193 bool permanent = !fields[6].GetUInt64();5194 PSendSysMessage(LANG_BANINFO_IPENTRY,5195 fields[0].GetString(), fields[1].GetString(), permanent ? GetTrinityString(LANG_BANINFO_NEVER):fields[2].GetString(),5196 permanent ? GetTrinityString(LANG_BANINFO_INFINITE):secsToTimeString(fields[3].GetUInt64(), true).c_str(), fields[4].GetString(), fields[5].GetString());5197 delete result;5198 return true;5178 if(!args) 5179 return false; 5180 5181 char* cIP = strtok ((char*)args, ""); 5182 if(!cIP) 5183 return false; 5184 5185 if (!IsIPAddress(cIP)) 5186 return false; 5187 5188 std::string IP = cIP; 5189 5190 loginDatabase.escape_string(IP); 5191 QueryResult *result = loginDatabase.PQuery("SELECT ip, FROM_UNIXTIME(bandate), FROM_UNIXTIME(unbandate), unbandate-UNIX_TIMESTAMP(), banreason,bannedby,unbandate-bandate FROM ip_banned WHERE ip = '%s'",IP.c_str()); 5192 if(!result) 5193 { 5194 PSendSysMessage(LANG_BANINFO_NOIP); 5195 return true; 5196 } 5197 5198 Field *fields = result->Fetch(); 5199 bool permanent = !fields[6].GetUInt64(); 5200 PSendSysMessage(LANG_BANINFO_IPENTRY, 5201 fields[0].GetString(), fields[1].GetString(), permanent ? GetTrinityString(LANG_BANINFO_NEVER):fields[2].GetString(), 5202 permanent ? GetTrinityString(LANG_BANINFO_INFINITE):secsToTimeString(fields[3].GetUInt64(), true).c_str(), fields[4].GetString(), fields[5].GetString()); 5203 delete result; 5204 return true; 5199 5205 } 5200 5206 5201 5207 bool ChatHandler::HandleBanListCharacterCommand(const char* args) 5202 5208 { 5203 loginDatabase.Execute("DELETE FROM ip_banned WHERE unbandate<=UNIX_TIMESTAMP() AND unbandate<>bandate");5204 5205 char* cFilter = strtok ((char*)args, " ");5206 if(!cFilter)5207 return false; 5208 5209 std::string filter = cFilter;5210 loginDatabase.escape_string(filter);5211 QueryResult* result = CharacterDatabase.PQuery("SELECT account FROM characters WHERE name "_LIKE_" "_CONCAT3_("'%%'","'%s'","'%%'"),filter.c_str());5212 if (!result)5213 {5214 PSendSysMessage(LANG_BANLIST_NOCHARACTER);5215 return true;5216 }5217 5218 return HandleBanListHelper(result);5209 loginDatabase.Execute("DELETE FROM ip_banned WHERE unbandate<=UNIX_TIMESTAMP() AND unbandate<>bandate"); 5210 5211 char* cFilter = strtok ((char*)args, " "); 5212 if(!cFilter) 5213 return false; 5214 5215 std::string filter = cFilter; 5216 loginDatabase.escape_string(filter); 5217 QueryResult* result = CharacterDatabase.PQuery("SELECT account FROM characters WHERE name "_LIKE_" "_CONCAT3_("'%%'","'%s'","'%%'"),filter.c_str()); 5218 if (!result) 5219 { 5220 PSendSysMessage(LANG_BANLIST_NOCHARACTER); 5221 return true; 5222 } 5223 5224 return HandleBanListHelper(result); 5219 5225 } 5220 5226 5221 5227 bool ChatHandler::HandleBanListAccountCommand(const char* args) 5222 5228 { 5223 loginDatabase.Execute("DELETE FROM ip_banned WHERE unbandate<=UNIX_TIMESTAMP() AND unbandate<>bandate");5224 5225 char* cFilter = strtok((char*)args, " ");5226 std::string filter = cFilter ? cFilter : "";5227 loginDatabase.escape_string(filter);5228 5229 QueryResult* result;5230 5231 if(filter.empty())5232 {5233 result = loginDatabase.Query("SELECT account.id, username FROM account, account_banned"5234 " WHERE account.id = account_banned.id AND active = 1 GROUP BY account.id");5235 }5236 else5237 {5238 result = loginDatabase.PQuery("SELECT account.id, username FROM account, account_banned"5239 " WHERE account.id = account_banned.id AND active = 1 AND username "_LIKE_" "_CONCAT3_("'%%'","'%s'","'%%'")" GROUP BY account.id",5240 filter.c_str());5241 }5242 5243 if (!result)5244 {5245 PSendSysMessage(LANG_BANLIST_NOACCOUNT);5246 return true;5247 }5248 5249 return HandleBanListHelper(result);5229 loginDatabase.Execute("DELETE FROM ip_banned WHERE unbandate<=UNIX_TIMESTAMP() AND unbandate<>bandate"); 5230 5231 char* cFilter = strtok((char*)args, " "); 5232 std::string filter = cFilter ? cFilter : ""; 5233 loginDatabase.escape_string(filter); 5234 5235 QueryResult* result; 5236 5237 if(filter.empty()) 5238 { 5239 result = loginDatabase.Query("SELECT account.id, username FROM account, account_banned" 5240 " WHERE account.id = account_banned.id AND active = 1 GROUP BY account.id"); 5241 } 5242 else 5243 { 5244 result = loginDatabase.PQuery("SELECT account.id, username FROM account, account_banned" 5245 " WHERE account.id = account_banned.id AND active = 1 AND username "_LIKE_" "_CONCAT3_("'%%'","'%s'","'%%'")" GROUP BY account.id", 5246 filter.c_str()); 5247 } 5248 5249 if (!result) 5250 { 5251 PSendSysMessage(LANG_BANLIST_NOACCOUNT); 5252 return true; 5253 } 5254 5255 return HandleBanListHelper(result); 5250 5256 } 5251 5257 … … 5253 5259 { 5254 5260 PSendSysMessage(LANG_BANLIST_MATCHINGACCOUNT); 5255 5256 // Chat short output5257 if(m_session)5261 5262 // Chat short output 5263 if(m_session) 5258 5264 { 5259 5265 do 5260 {5261 Field* fields = result->Fetch();5262 uint32 accountid = fields[0].GetUInt32();5263 5264 QueryResult* banresult = loginDatabase.PQuery("SELECT account.username FROM account,account_banned WHERE account_banned.id='%u' AND account_banned.id=account.id",accountid);5265 if(banresult)5266 {5267 Field* fields2 = banresult->Fetch();5268 PSendSysMessage("%s",fields2[0].GetString());5269 delete banresult;5270 }5271 } while (result->NextRow());5272 }5273 // Console wide output5274 else5275 {5276 SendSysMessage(LANG_BANLIST_ACCOUNTS);5277 SendSysMessage("===============================================================================");5278 SendSysMessage(LANG_BANLIST_ACCOUNTS_HEADER);5279 do5280 {5281 SendSysMessage("-------------------------------------------------------------------------------");5282 Field *fields = result->Fetch();5283 uint32 account_id = fields[0].GetUInt32 ();5284 5285 std::string account_name;5286 5287 // "account" case, name can be get in same quary5288 if(result->GetFieldCount() > 1)5289 account_name = fields[1].GetCppString();5290 // "character" case, name need extract from another DB5291 else5292 accmgr.GetName (account_id,account_name);5293 5294 // No SQL injection. id is uint32.5295 QueryResult *banInfo = loginDatabase.PQuery("SELECT bandate,unbandate,bannedby,banreason FROM account_banned WHERE id = %u ORDER BY unbandate", account_id);5296 if (banInfo)5297 {5298 Field *fields2 = banInfo->Fetch();5299 do5300 {5301 time_t t_ban = fields2[0].GetUInt64();5302 tm* aTm_ban = localtime(&t_ban);5303 5304 if (fields2[0].GetUInt64() == fields2[1].GetUInt64())5305 {5306 PSendSysMessage("|%-15.15s|%02d-%02d-%02d %02d:%02d| permanent |%-15.15s|%-15.15s|",5307 account_name.c_str(),aTm_ban->tm_year%100, aTm_ban->tm_mon+1, aTm_ban->tm_mday, aTm_ban->tm_hour, aTm_ban->tm_min,5308 fields2[2].GetString(),fields2[3].GetString());5309 }5310 else5311 {5312 time_t t_unban = fields2[1].GetUInt64();5313 tm* aTm_unban = localtime(&t_unban);5314 PSendSysMessage("|%-15.15s|%02d-%02d-%02d %02d:%02d|%02d-%02d-%02d %02d:%02d|%-15.15s|%-15.15s|",5315 account_name.c_str(),aTm_ban->tm_year%100, aTm_ban->tm_mon+1, aTm_ban->tm_mday, aTm_ban->tm_hour, aTm_ban->tm_min,5316 aTm_unban->tm_year%100, aTm_unban->tm_mon+1, aTm_unban->tm_mday, aTm_unban->tm_hour, aTm_unban->tm_min,5317 fields2[2].GetString(),fields2[3].GetString());5318 }5319 }while ( banInfo->NextRow() );5320 delete banInfo;5321 }5322 }while( result->NextRow() );5323 SendSysMessage("===============================================================================");5324 }5325 5326 delete result;5327 return true;5266 { 5267 Field* fields = result->Fetch(); 5268 uint32 accountid = fields[0].GetUInt32(); 5269 5270 QueryResult* banresult = loginDatabase.PQuery("SELECT account.username FROM account,account_banned WHERE account_banned.id='%u' AND account_banned.id=account.id",accountid); 5271 if(banresult) 5272 { 5273 Field* fields2 = banresult->Fetch(); 5274 PSendSysMessage("%s",fields2[0].GetString()); 5275 delete banresult; 5276 } 5277 } while (result->NextRow()); 5278 } 5279 // Console wide output 5280 else 5281 { 5282 SendSysMessage(LANG_BANLIST_ACCOUNTS); 5283 SendSysMessage("==============================================================================="); 5284 SendSysMessage(LANG_BANLIST_ACCOUNTS_HEADER); 5285 do 5286 { 5287 SendSysMessage("-------------------------------------------------------------------------------"); 5288 Field *fields = result->Fetch(); 5289 uint32 account_id = fields[0].GetUInt32 (); 5290 5291 std::string account_name; 5292 5293 // "account" case, name can be get in same query 5294 if(result->GetFieldCount() > 1) 5295 account_name = fields[1].GetCppString(); 5296 // "character" case, name need extract from another DB 5297 else 5298 accmgr.GetName (account_id,account_name); 5299 5300 // No SQL injection. id is uint32. 5301 QueryResult *banInfo = loginDatabase.PQuery("SELECT bandate,unbandate,bannedby,banreason FROM account_banned WHERE id = %u ORDER BY unbandate", account_id); 5302 if (banInfo) 5303 { 5304 Field *fields2 = banInfo->Fetch(); 5305 do 5306 { 5307 time_t t_ban = fields2[0].GetUInt64(); 5308 tm* aTm_ban = localtime(&t_ban); 5309 5310 if (fields2[0].GetUInt64() == fields2[1].GetUInt64()) 5311 { 5312 PSendSysMessage("|%-15.15s|%02d-%02d-%02d %02d:%02d| permanent |%-15.15s|%-15.15s|", 5313 account_name.c_str(),aTm_ban->tm_year%100, aTm_ban->tm_mon+1, aTm_ban->tm_mday, aTm_ban->tm_hour, aTm_ban->tm_min, 5314 fields2[2].GetString(),fields2[3].GetString()); 5315 } 5316 else 5317 { 5318 time_t t_unban = fields2[1].GetUInt64(); 5319 tm* aTm_unban = localtime(&t_unban); 5320 PSendSysMessage("|%-15.15s|%02d-%02d-%02d %02d:%02d|%02d-%02d-%02d %02d:%02d|%-15.15s|%-15.15s|", 5321 account_name.c_str(),aTm_ban->tm_year%100, aTm_ban->tm_mon+1, aTm_ban->tm_mday, aTm_ban->tm_hour, aTm_ban->tm_min, 5322 aTm_unban->tm_year%100, aTm_unban->tm_mon+1, aTm_unban->tm_mday, aTm_unban->tm_hour, aTm_unban->tm_min, 5323 fields2[2].GetString(),fields2[3].GetString()); 5324 } 5325 }while ( banInfo->NextRow() ); 5326 delete banInfo; 5327 } 5328 }while( result->NextRow() ); 5329 SendSysMessage("==============================================================================="); 5330 } 5331 5332 delete result; 5333 return true; 5328 5334 } 5329 5335 5330 5336 bool ChatHandler::HandleBanListIPCommand(const char* args) 5331 5337 { 5332 loginDatabase.Execute("DELETE FROM ip_banned WHERE unbandate<=UNIX_TIMESTAMP() AND unbandate<>bandate"); 5333 5334 char* cFilter = strtok((char*)args, " "); 5335 std::string filter = cFilter ? cFilter : ""; 5336 loginDatabase.escape_string(filter); 5337 5338 QueryResult* result; 5339 5340 if(filter.empty()) 5341 { 5342 result = loginDatabase.Query ("SELECT ip,bandate,unbandate,bannedby,banreason FROM ip_banned" 5343 " WHERE (bandate=unbandate OR unbandate>UNIX_TIMESTAMP())" 5344 " ORDER BY unbandate" ); 5345 } 5346 else 5347 { 5348 result = loginDatabase.PQuery( "SELECT ip,bandate,unbandate,bannedby,banreason FROM ip_banned" 5349 " WHERE (bandate=unbandate OR unbandate>UNIX_TIMESTAMP()) AND ip "_LIKE_" "_CONCAT3_("'%%'","'%s'","'%%'") 5350 " ORDER BY unbandate",filter.c_str() ); 5351 } 5352 5353 if(!result) 5354 { 5355 PSendSysMessage(LANG_BANLIST_NOIP); 5356 return true; 5357 } 5358 5359 PSendSysMessage(LANG_BANLIST_MATCHINGIP); 5360 // Chat short output 5361 if(m_session) 5362 { 5363 do 5364 { 5365 Field* fields = result->Fetch(); 5366 PSendSysMessage("%s",fields[0].GetString()); 5367 }while (result->NextRow()); 5368 } 5369 // Console wide output 5370 else 5371 { 5372 SendSysMessage(LANG_BANLIST_IPS);SendSysMessage("==============================================================================="); 5373 SendSysMessage(LANG_BANLIST_IPS_HEADER); 5374 do 5338 loginDatabase.Execute("DELETE FROM ip_banned WHERE unbandate<=UNIX_TIMESTAMP() AND unbandate<>bandate"); 5339 5340 char* cFilter = strtok((char*)args, " "); 5341 std::string filter = cFilter ? cFilter : ""; 5342 loginDatabase.escape_string(filter); 5343 5344 QueryResult* result; 5345 5346 if(filter.empty()) 5347 { 5348 result = loginDatabase.Query ("SELECT ip,bandate,unbandate,bannedby,banreason FROM ip_banned" 5349 " WHERE (bandate=unbandate OR unbandate>UNIX_TIMESTAMP())" 5350 " ORDER BY unbandate" ); 5351 } 5352 else 5353 { 5354 result = loginDatabase.PQuery( "SELECT ip,bandate,unbandate,bannedby,banreason FROM ip_banned" 5355 " WHERE (bandate=unbandate OR unbandate>UNIX_TIMESTAMP()) AND ip "_LIKE_" "_CONCAT3_("'%%'","'%s'","'%%'") 5356 " ORDER BY unbandate",filter.c_str() ); 5357 } 5358 5359 if(!result) 5360 { 5361 PSendSysMessage(LANG_BANLIST_NOIP); 5362 return true; 5363 } 5364 5365 PSendSysMessage(LANG_BANLIST_MATCHINGIP); 5366 // Chat short output 5367 if(m_session) 5368 { 5369 do 5370 { 5371 Field* fields = result->Fetch(); 5372 PSendSysMessage("%s",fields[0].GetString()); 5373 } while (result->NextRow()); 5374 } 5375 // Console wide output 5376 else 5377 { 5378 SendSysMessage(LANG_BANLIST_IPS); 5379 SendSysMessage("==============================================================================="); 5380 SendSysMessage(LANG_BANLIST_IPS_HEADER); 5381 do 5375 5382 { 5376 5383 SendSysMessage("-------------------------------------------------------------------------------"); 5377 Field *fields = result->Fetch();5378 time_t t_ban = fields[1].GetUInt64();5379 tm* aTm_ban = localtime(&t_ban);5380 if ( fields[1].GetUInt64() == fields[2].GetUInt64() )5381 {5382 PSendSysMessage("|%-15.15s|%02d-%02d-%02d %02d:%02d| permanent |%-15.15s|%-15.15s|",5383 fields[0].GetString(), aTm_ban->tm_year%100, aTm_ban->tm_mon+1, aTm_ban->tm_mday, aTm_ban->tm_hour, aTm_ban->tm_min,5384 fields[3].GetString(), fields[4].GetString());5385 }5386 else5387 {5388 time_t t_unban = fields[2].GetUInt64();5389 tm* aTm_unban = localtime(&t_unban);5390 PSendSysMessage("|%-15.15s|%02d-%02d-%02d %02d:%02d|%02d-%02d-%02d %02d:%02d|%-15.15s|%-15.15s|",5391 fields[0].GetString(), aTm_ban->tm_year%100, aTm_ban->tm_mon+1, aTm_ban->tm_mday, aTm_ban->tm_hour, aTm_ban->tm_min,5392 aTm_unban->tm_year%100, aTm_unban->tm_mon+1, aTm_unban->tm_mday, aTm_unban->tm_hour, aTm_unban->tm_min,5393 fields[3].GetString(), fields[4].GetString());5394 }5395 }while( result->NextRow() );5396 SendSysMessage("===============================================================================");5384 Field *fields = result->Fetch(); 5385 time_t t_ban = fields[1].GetUInt64(); 5386 tm* aTm_ban = localtime(&t_ban); 5387 if ( fields[1].GetUInt64() == fields[2].GetUInt64() ) 5388 { 5389 PSendSysMessage("|%-15.15s|%02d-%02d-%02d %02d:%02d| permanent |%-15.15s|%-15.15s|", 5390 fields[0].GetString(), aTm_ban->tm_year%100, aTm_ban->tm_mon+1, aTm_ban->tm_mday, aTm_ban->tm_hour, aTm_ban->tm_min, 5391 fields[3].GetString(), fields[4].GetString()); 5392 } 5393 else 5394 { 5395 time_t t_unban = fields[2].GetUInt64(); 5396 tm* aTm_unban = localtime(&t_unban); 5397 PSendSysMessage("|%-15.15s|%02d-%02d-%02d %02d:%02d|%02d-%02d-%02d %02d:%02d|%-15.15s|%-15.15s|", 5398 fields[0].GetString(), aTm_ban->tm_year%100, aTm_ban->tm_mon+1, aTm_ban->tm_mday, aTm_ban->tm_hour, aTm_ban->tm_min, 5399 aTm_unban->tm_year%100, aTm_unban->tm_mon+1, aTm_unban->tm_mday, aTm_unban->tm_hour, aTm_unban->tm_min, 5400 fields[3].GetString(), fields[4].GetString()); 5401 } 5402 }while( result->NextRow() ); 5403 SendSysMessage("==============================================================================="); 5397 5404 } 5398 5405 … … 5403 5410 bool ChatHandler::HandleRespawnCommand(const char* /*args*/) 5404 5411 { 5412 Player* pl = m_session->GetPlayer(); 5413 5414 // accept only explicitly selected target (not implicitly self targeting case) 5405 5415 Unit* target = getSelectedUnit(); 5406 5407 if(target && target->GetTypeId() == TYPEID_UNIT && target->isDead()) 5408 { 5409 ((Creature*)target)->Respawn(); 5416 if(pl->GetSelection() && target) 5417 { 5418 if(target->GetTypeId()!=TYPEID_UNIT) 5419 { 5420 SendSysMessage(LANG_SELECT_CREATURE); 5421 SetSentErrorMessage(true); 5422 return false; 5423 } 5424 5425 if(target->isDead()) 5426 ((Creature*)target)->Respawn(); 5410 5427 return true; 5411 5428 } 5412 5413 Player* pl = m_session->GetPlayer();5414 5429 5415 5430 CellPair p(Trinity::ComputeCellPair(pl->GetPositionX(), pl->GetPositionY())); … … 5456 5471 bool ChatHandler::HandleLoadPDumpCommand(const char *args) 5457 5472 { 5458 if (!args)5473 if(!args) 5459 5474 return false; 5460 5475 5461 5476 char * file = strtok((char*)args, " "); 5462 if(!file)5463 return false;5464 5465 char * account = strtok(NULL, " ");5466 if(!account)5467 return false;5468 5469 std::string account_name = account;5470 if(!AccountMgr::normilizeString(account_name))5471 {5472 PSendSysMessage(LANG_ACCOUNT_NOT_EXIST,account_name.c_str());5473 SetSentErrorMessage(true);5474 return false; 5475 }5477 if(!file) 5478 return false; 5479 5480 char * account = strtok(NULL, " "); 5481 if(!account) 5482 return false; 5483 5484 std::string account_name = account; 5485 if(!AccountMgr::normilizeString(account_name)) 5486 { 5487 PSendSysMessage(LANG_ACCOUNT_NOT_EXIST,account_name.c_str()); 5488 SetSentErrorMessage(true); 5489 return false; 5490 } 5476 5491 5477 5492 uint32 account_id = accmgr.GetId(account_name); … … 5482 5497 { 5483 5498 PSendSysMessage(LANG_ACCOUNT_NOT_EXIST,account_name.c_str()); 5484 SetSentErrorMessage(true);5485 return false;5499 SetSentErrorMessage(true); 5500 return false; 5486 5501 } 5487 } 5488 5489 if(!accmgr.GetName(account_id,account_name)) 5490 { 5491 PSendSysMessage(LANG_ACCOUNT_NOT_EXIST,account_name.c_str()); 5492 SetSentErrorMessage(true); 5493 return false; 5494 } 5495 5496 char* guid_str = NULL; 5497 char* name_str = strtok(NULL, " "); 5498 5499 std::string name; 5500 if(name_str) 5501 { 5502 name = name_str; 5503 // normalize the name if specified and check if it exists 5504 if(!normalizePlayerName(name)) 5505 { 5506 PSendSysMessage(LANG_INVALID_CHARACTER_NAME); 5507 SetSentErrorMessage(true); 5508 return false; 5509 } 5510 5511 if(!ObjectMgr::IsValidName(name,true)) 5512 { 5513 PSendSysMessage(LANG_INVALID_CHARACTER_NAME); 5514 SetSentErrorMessage(true); 5502 } 5503 5504 if(!accmgr.GetName(account_id,account_name)) 5505 { 5506 PSendSysMessage(LANG_ACCOUNT_NOT_EXIST,account_name.c_str()); 5507 SetSentErrorMessage(true); 5508 return false; 5509 } 5510 5511 char* guid_str = NULL; 5512 char* name_str = strtok(NULL, " "); 5513 5514 std::string name; 5515 if(name_str) 5516 { 5517 name = name_str; 5518 // normalize the name if specified and check if it exists 5519 if(!normalizePlayerName(name)) 5520 { 5521 PSendSysMessage(LANG_INVALID_CHARACTER_NAME); 5522 SetSentErrorMessage(true); 5515 5523 return false; 5516 } 5517 5518 guid_str = strtok(NULL, " "); 5524 } 5525 5526 if(!ObjectMgr::IsValidName(name,true)) 5527 { 5528 PSendSysMessage(LANG_INVALID_CHARACTER_NAME); 5529 SetSentErrorMessage(true); 5530 return false; 5531 } 5532 5533 guid_str = strtok(NULL, " "); 5519 5534 } 5520 5535 … … 5522 5537 5523 5538 if(guid_str) 5524 {5525 guid = atoi(guid_str);5526 if(!guid)5527 {5528 PSendSysMessage(LANG_INVALID_CHARACTER_GUID);5529 SetSentErrorMessage(true);5530 return false;5531 }5532 5533 if(objmgr.GetPlayerAccountIdByGUID(guid))5534 {5535 PSendSysMessage(LANG_CHARACTER_GUID_IN_USE,guid);5536 SetSentErrorMessage(true);5537 return false;5538 }5539 }5540 5541 switch(PlayerDumpReader().LoadDump(file, account_id, name, guid))5542 {5543 case DUMP_SUCCESS:5544 PSendSysMessage(LANG_COMMAND_IMPORT_SUCCESS);5545 break;5546 case DUMP_FILE_OPEN_ERROR:5547 PSendSysMessage(LANG_FILE_OPEN_FAIL,file);5548 SetSentErrorMessage(true);5549 return false;5550 case DUMP_FILE_BROKEN:5551 PSendSysMessage(LANG_DUMP_BROKEN,file);5552 SetSentErrorMessage(true);5553 return false;5554 case DUMP_TOO_MANY_CHARS:5555 PSendSysMessage(LANG_ACCOUNT_CHARACTER_LIST_FULL,account_name.c_str(),account_id);5556 SetSentErrorMessage(true);5557 return false;5558 default:5559 PSendSysMessage(LANG_COMMAND_IMPORT_FAILED);5560 SetSentErrorMessage(true);5561 return false;5562 }5539 { 5540 guid = atoi(guid_str); 5541 if(!guid) 5542 { 5543 PSendSysMessage(LANG_INVALID_CHARACTER_GUID); 5544 SetSentErrorMessage(true); 5545 return false; 5546 } 5547 5548 if(objmgr.GetPlayerAccountIdByGUID(guid)) 5549 { 5550 PSendSysMessage(LANG_CHARACTER_GUID_IN_USE,guid); 5551 SetSentErrorMessage(true); 5552 return false; 5553 } 5554 } 5555 5556 switch(PlayerDumpReader().LoadDump(file, account_id, name, guid)) 5557 { 5558 case DUMP_SUCCESS: 5559 PSendSysMessage(LANG_COMMAND_IMPORT_SUCCESS); 5560 break; 5561 case DUMP_FILE_OPEN_ERROR: 5562 PSendSysMessage(LANG_FILE_OPEN_FAIL,file); 5563 SetSentErrorMessage(true); 5564 return false; 5565 case DUMP_FILE_BROKEN: 5566 PSendSysMessage(LANG_DUMP_BROKEN,file); 5567 SetSentErrorMessage(true); 5568 return false; 5569 case DUMP_TOO_MANY_CHARS: 5570 PSendSysMessage(LANG_ACCOUNT_CHARACTER_LIST_FULL,account_name.c_str(),account_id); 5571 SetSentErrorMessage(true); 5572 return false; 5573 default: 5574 PSendSysMessage(LANG_COMMAND_IMPORT_FAILED); 5575 SetSentErrorMessage(true); 5576 return false; 5577 } 5563 5578 5564 5579 return true; … … 5605 5620 5606 5621 if(!objmgr.GetPlayerAccountIdByGUID(guid)) 5607 {5608 PSendSysMessage(LANG_PLAYER_NOT_FOUND);5609 SetSentErrorMessage(true);5610 return false;5611 }5612 5613 switch(PlayerDumpWriter().WriteDump(file, guid))5614 {5615 case DUMP_SUCCESS:5616 PSendSysMessage(LANG_COMMAND_EXPORT_SUCCESS);5617 break;5618 case DUMP_FILE_OPEN_ERROR:5619 PSendSysMessage(LANG_FILE_OPEN_FAIL,file);5620 SetSentErrorMessage(true);5621 return false;5622 default:5623 PSendSysMessage(LANG_COMMAND_EXPORT_FAILED);5624 SetSentErrorMessage(true);5625 return false;5626 }5622 { 5623 PSendSysMessage(LANG_PLAYER_NOT_FOUND); 5624 SetSentErrorMessage(true); 5625 return false; 5626 } 5627 5628 switch(PlayerDumpWriter().WriteDump(file, guid)) 5629 { 5630 case DUMP_SUCCESS: 5631 PSendSysMessage(LANG_COMMAND_EXPORT_SUCCESS); 5632 break; 5633 case DUMP_FILE_OPEN_ERROR: 5634 PSendSysMessage(LANG_FILE_OPEN_FAIL,file); 5635 SetSentErrorMessage(true); 5636 return false; 5637 default: 5638 PSendSysMessage(LANG_COMMAND_EXPORT_FAILED); 5639 SetSentErrorMessage(true); 5640 return false; 5641 } 5627 5642 5628 5643 return true; … … 5831 5846 caster->SendMessageToSet(&data,true); 5832 5847 5833 caster->CastSpell(m_session->GetPlayer(),spell, false);5848 caster->CastSpell(m_session->GetPlayer(),spell,triggered); 5834 5849 5835 5850 return true; … … 5840 5855 if(!*args) 5841 5856 return false; 5842 5843 5857 5844 5858 // number or [name] Shift-click form |color|Hspell:spell_id|h[name]|h|r or Htalent form … … 5923 5937 caster->SendMessageToSet(&data,true); 5924 5938 5925 caster->CastSpell(caster->getVictim(),spell, false);5939 caster->CastSpell(caster->getVictim(),spell,triggered); 5926 5940 5927 5941 return true; … … 6111 6125 bool ChatHandler::HandleGMListFullCommand(const char* /*args*/) 6112 6126 { 6113 ///- Get the accounts with GM Level >06114 QueryResult *result = loginDatabase.Query( "SELECT username,gmlevel FROM account WHERE gmlevel > 0" );6115 if(result)6116 {6117 SendSysMessage(LANG_GMLIST);6118 SendSysMessage("========================");6119 SendSysMessage(LANG_GMLIST_HEADER);6120 SendSysMessage("========================");6121 6122 ///- Circle through them. Display username and GM level6123 do6124 {6125 Field *fields = result->Fetch();6126 PSendSysMessage("|%15s|%6s|", fields[0].GetString(),fields[1].GetString());6127 }while( result->NextRow() );6128 6129 PSendSysMessage("========================");6130 delete result;6131 }6132 else6133 PSendSysMessage(LANG_GMLIST_EMPTY);6134 return true;6127 ///- Get the accounts with GM Level >0 6128 QueryResult *result = loginDatabase.Query( "SELECT username,gmlevel FROM account WHERE gmlevel > 0" ); 6129 if(result) 6130 { 6131 SendSysMessage(LANG_GMLIST); 6132 SendSysMessage("========================"); 6133 SendSysMessage(LANG_GMLIST_HEADER); 6134 SendSysMessage("========================"); 6135 6136 ///- Circle through them. Display username and GM level 6137 do 6138 { 6139 Field *fields = result->Fetch(); 6140 PSendSysMessage("|%15s|%6s|", fields[0].GetString(),fields[1].GetString()); 6141 }while( result->NextRow() ); 6142 6143 PSendSysMessage("========================"); 6144 delete result; 6145 } 6146 else 6147 PSendSysMessage(LANG_GMLIST_EMPTY); 6148 return true; 6135 6149 } 6136 6150 … … 6138 6152 bool ChatHandler::HandleServerSetMotdCommand(const char* args) 6139 6153 { 6140 sWorld.SetMotd(args);6141 PSendSysMessage(LANG_MOTD_NEW, args);6142 return true;6154 sWorld.SetMotd(args); 6155 PSendSysMessage(LANG_MOTD_NEW, args); 6156 return true; 6143 6157 } 6144 6158 … … 6146 6160 bool ChatHandler::HandleAccountSetAddonCommand(const char* args) 6147 6161 { 6148 ///- Get the command line arguments6149 char *szAcc = strtok((char*)args," ");6150 char *szExp = strtok(NULL," ");6151 6152 if(!szAcc)6153 return false;6154 6155 std::string account_name;6156 uint32 account_id;6157 6158 if(!szExp)6159 {6160 Player* player = getSelectedPlayer();6161 if(!player)6162 return false;6163 6164 account_id = player->GetSession()->GetAccountId();6165 accmgr.GetName(account_id,account_name);6166 szExp = szAcc;6167 }6168 else6169 {6170 ///- Convert Account name to Upper Format6171 account_name = szAcc;6172 if(!AccountMgr::normilizeString(account_name))6173 {6174 PSendSysMessage(LANG_ACCOUNT_NOT_EXIST,account_name.c_str());6175 SetSentErrorMessage(true);6176 return false;6177 }6178 6179 account_id = accmgr.GetId(account_name);6180 if(!account_id)6181 {6182 PSendSysMessage(LANG_ACCOUNT_NOT_EXIST,account_name.c_str());6183 SetSentErrorMessage(true);6184 return false;6185 }6186 }6187 6188 int lev=atoi(szExp); //get int anyway (0 if error)6189 if(lev < 0)6190 return false;6191 6192 // No SQL injection6193 loginDatabase.PExecute("UPDATE account SET expansion = '%d' WHERE id = '%u'",lev,account_id);6194 PSendSysMessage(LANG_ACCOUNT_SETADDON,account_name.c_str(),account_id,lev);6195 return true;6162 ///- Get the command line arguments 6163 char *szAcc = strtok((char*)args," "); 6164 char *szExp = strtok(NULL," "); 6165 6166 if(!szAcc) 6167 return false; 6168 6169 std::string account_name; 6170 uint32 account_id; 6171 6172 if(!szExp) 6173 { 6174 Player* player = getSelectedPlayer(); 6175 if(!player) 6176 return false; 6177 6178 account_id = player->GetSession()->GetAccountId(); 6179 accmgr.GetName(account_id,account_name); 6180 szExp = szAcc; 6181 } 6182 else 6183 { 6184 ///- Convert Account name to Upper Format 6185 account_name = szAcc; 6186 if(!AccountMgr::normilizeString(account_name)) 6187 { 6188 PSendSysMessage(LANG_ACCOUNT_NOT_EXIST,account_name.c_str()); 6189 SetSentErrorMessage(true); 6190 return false; 6191 } 6192 6193 account_id = accmgr.GetId(account_name); 6194 if(!account_id) 6195 { 6196 PSendSysMessage(LANG_ACCOUNT_NOT_EXIST,account_name.c_str()); 6197 SetSentErrorMessage(true); 6198 return false; 6199 } 6200 } 6201 6202 int lev=atoi(szExp); //get int anyway (0 if error) 6203 if(lev < 0) 6204 return false; 6205 6206 // No SQL injection 6207 loginDatabase.PExecute("UPDATE account SET expansion = '%d' WHERE id = '%u'",lev,account_id); 6208 PSendSysMessage(LANG_ACCOUNT_SETADDON,account_name.c_str(),account_id,lev); 6209 return true; 6196 6210 } 6197 6211 … … 6199 6213 bool ChatHandler::HandleSendMessageCommand(const char* args) 6200 6214 { 6201 ///- Get the command line arguments6202 char* name_str = strtok((char*)args, " ");6203 char* msg_str = strtok(NULL, "");6204 6205 if(!name_str || !msg_str)6206 return false;6207 6208 std::string name = name_str;6209 6210 if(!normalizePlayerName(name))6211 return false;6212 6213 ///- Find the player and check that he is not logging out.6214 Player *rPlayer = objmgr.GetPlayer(name.c_str());6215 if(!rPlayer)6216 {6217 SendSysMessage(LANG_PLAYER_NOT_FOUND);6218 SetSentErrorMessage(true);6219 return false;6220 }6221 6222 if(rPlayer->GetSession()->isLogingOut())6223 {6224 SendSysMessage(LANG_PLAYER_NOT_FOUND);6225 SetSentErrorMessage(true);6226 return false;6227 }6228 6229 ///- Send the message6230 //Use SendAreaTriggerMessage for fastest delivery.6231 rPlayer->GetSession()->SendAreaTriggerMessage("%s", msg_str);6232 rPlayer->GetSession()->SendAreaTriggerMessage("|cffff0000[Message from administrator]:|r");6233 6234 //Confirmation message6235 PSendSysMessage(LANG_SENDMESSAGE,name.c_str(),msg_str);6236 return true;6215 ///- Get the command line arguments 6216 char* name_str = strtok((char*)args, " "); 6217 char* msg_str = strtok(NULL, ""); 6218 6219 if(!name_str || !msg_str) 6220 return false; 6221 6222 std::string name = name_str; 6223 6224 if(!normalizePlayerName(name)) 6225 return false; 6226 6227 ///- Find the player and check that he is not logging out. 6228 Player *rPlayer = objmgr.GetPlayer(name.c_str()); 6229 if(!rPlayer) 6230 { 6231 SendSysMessage(LANG_PLAYER_NOT_FOUND); 6232 SetSentErrorMessage(true); 6233 return false; 6234 } 6235 6236 if(rPlayer->GetSession()->isLogingOut()) 6237 { 6238 SendSysMessage(LANG_PLAYER_NOT_FOUND); 6239 SetSentErrorMessage(true); 6240 return false; 6241 } 6242 6243 ///- Send the message 6244 //Use SendAreaTriggerMessage for fastest delivery. 6245 rPlayer->GetSession()->SendAreaTriggerMessage("%s", msg_str); 6246 rPlayer->GetSession()->SendAreaTriggerMessage("|cffff0000[Message from administrator]:|r"); 6247 6248 //Confirmation message 6249 PSendSysMessage(LANG_SENDMESSAGE,name.c_str(),msg_str); 6250 return true; 6237 6251 } 6238 6252 6239 6253 bool ChatHandler::HandlePlayAllCommand(const char* args) 6240 6254 { 6241 if(!*args)6242 return false;6243 6244 uint32 soundId = atoi((char*)args);6245 6246 if(!sSoundEntriesStore.LookupEntry(soundId))6247 {6248 PSendSysMessage(LANG_SOUND_NOT_EXIST, soundId);6249 SetSentErrorMessage(true);6250 return false;6251 }6252 6253 WorldPacket data(SMSG_PLAY_SOUND, 4);6254 data << uint32(soundId) << m_session->GetPlayer()->GetGUID();6255 sWorld.SendGlobalMessage(&data);6256 6257 PSendSysMessage(LANG_COMMAND_PLAYED_TO_ALL, soundId);6258 return true;6255 if(!*args) 6256 return false; 6257 6258 uint32 soundId = atoi((char*)args); 6259 6260 if(!sSoundEntriesStore.LookupEntry(soundId)) 6261 { 6262 PSendSysMessage(LANG_SOUND_NOT_EXIST, soundId); 6263 SetSentErrorMessage(true); 6264 return false; 6265 } 6266 6267 WorldPacket data(SMSG_PLAY_SOUND, 4); 6268 data << uint32(soundId) << m_session->GetPlayer()->GetGUID(); 6269 sWorld.SendGlobalMessage(&data); 6270 6271 PSendSysMessage(LANG_COMMAND_PLAYED_TO_ALL, soundId); 6272 return true; 6259 6273 } 6260 6274 6261 6275 bool ChatHandler::HandleModifyGenderCommand(const char *args) 6262 6276 { 6263 if(!*args) return false;6264 Player *player = getSelectedPlayer();6265 6266 if(!player)6267 {6268 PSendSysMessage(LANG_NO_PLAYER);6269 SetSentErrorMessage(true);6270 return false;6271 }6272 6273 std::string gender = (char*)args;6274 uint32 displayId = player->GetNativeDisplayId();6275 6276 if(gender == "male") // MALE6277 {6278 if(player->getGender() == GENDER_MALE)6279 {6280 PSendSysMessage("%s is already male", player->GetName());6281 SetSentErrorMessage(true);6282 return false;6283 }6284 6285 // Set gender6286 player->SetByteValue(UNIT_FIELD_BYTES_0, 2, GENDER_MALE);6287 // Change display ID6288 player->SetDisplayId(player->getRace() == RACE_BLOODELF ? displayId+1 : displayId-1);6289 player->SetNativeDisplayId(player->getRace() == RACE_BLOODELF ? displayId+1 : displayId-1);6290 6291 ChatHandler(player).PSendSysMessage("Gender changed. You are now a man!");6292 PSendSysMessage("Gender changed for %s", player->GetName());6293 return true;6294 }6295 else if(gender == "female") // FEMALE6296 {6297 if(player->getGender() == GENDER_FEMALE)6298 {6299 PSendSysMessage("%s is already female", player->GetName());6300 SetSentErrorMessage(true);6301 return false;6302 }6303 6304 // Set gender6305 player->SetByteValue(UNIT_FIELD_BYTES_0, 2, GENDER_FEMALE);6306 // Change display ID6307 player->SetDisplayId(player->getRace() == RACE_BLOODELF ? displayId-1 : displayId+1);6308 player->SetNativeDisplayId(player->getRace() == RACE_BLOODELF ? displayId-1 : displayId+1);6309 6310 ChatHandler(player).PSendSysMessage("Gender changed. You are now a woman!");6311 PSendSysMessage("Gender changed for %s", player->GetName());6312 return true;6313 }6314 else6315 {6316 PSendSysMessage("You must use male or female as gender.");6317 SetSentErrorMessage(true);6318 return false;6319 }6320 6321 return true;6277 if(!*args) return false; 6278 Player *player = getSelectedPlayer(); 6279 6280 if(!player) 6281 { 6282 PSendSysMessage(LANG_NO_PLAYER); 6283 SetSentErrorMessage(true); 6284 return false; 6285 } 6286 6287 std::string gender = (char*)args; 6288 uint32 displayId = player->GetNativeDisplayId(); 6289 6290 if(gender == "male") // MALE 6291 { 6292 if(player->getGender() == GENDER_MALE) 6293 { 6294 PSendSysMessage("%s is already male", player->GetName()); 6295 SetSentErrorMessage(true); 6296 return false; 6297 } 6298 6299 // Set gender 6300 player->SetByteValue(UNIT_FIELD_BYTES_0, 2, GENDER_MALE); 6301 // Change display ID 6302 player->SetDisplayId(player->getRace() == RACE_BLOODELF ? displayId+1 : displayId-1); 6303 player->SetNativeDisplayId(player->getRace() == RACE_BLOODELF ? displayId+1 : displayId-1); 6304 6305 ChatHandler(player).PSendSysMessage("Gender changed. You are now a man!"); 6306 PSendSysMessage("Gender changed for %s", player->GetName()); 6307 return true; 6308 } 6309 else if(gender == "female") // FEMALE 6310 { 6311 if(player->getGender() == GENDER_FEMALE) 6312 { 6313 PSendSysMessage("%s is already female", player->GetName()); 6314 SetSentErrorMessage(true); 6315 return false; 6316 } 6317 6318 // Set gender 6319 player->SetByteValue(UNIT_FIELD_BYTES_0, 2, GENDER_FEMALE); 6320 // Change display ID 6321 player->SetDisplayId(player->getRace() == RACE_BLOODELF ? displayId-1 : displayId+1); 6322 player->SetNativeDisplayId(player->getRace() == RACE_BLOODELF ? displayId-1 : displayId+1); 6323 6324 ChatHandler(player).PSendSysMessage("Gender changed. You are now a woman!"); 6325 PSendSysMessage("Gender changed for %s", player->GetName()); 6326 return true; 6327 } 6328 else 6329 { 6330 PSendSysMessage("You must use male or female as gender."); 6331 SetSentErrorMessage(true); 6332 return false; 6333 } 6334 6335 return true; 6322 6336 } 6323 6337 … … 6332 6346 if (player) //prevent crash with creature as target 6333 6347 { 6334 name = player->GetName();6335 normalizePlayerName(name);6348 name = player->GetName(); 6349 normalizePlayerName(name); 6336 6350 } 6337 6351 } … … 6342 6356 player = objmgr.GetPlayer(name.c_str()); //get player by name 6343 6357 } 6344 6358 6345 6359 if (!player) 6346 6360 { … … 6364 6378 player->CombatStop(); 6365 6379 if(player->IsNonMeleeSpellCasted(true)) 6366 player->InterruptNonMeleeSpells(true);6380 player->InterruptNonMeleeSpells(true); 6367 6381 player->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE); 6368 6382 player->SetUInt32Value(PLAYER_DUEL_TEAM, 1); … … 6376 6390 // not let dismiss dead pet 6377 6391 if(pet && pet->isAlive()) 6378 player->RemovePet(pet,PET_SAVE_NOT_IN_SLOT);6392 player->RemovePet(pet,PET_SAVE_NOT_IN_SLOT); 6379 6393 } 6380 6394 } … … 6397 6411 Aura *Aur = CreateAura(spellInfo, i, NULL, player); 6398 6412 player->AddAura(Aur); 6399 }6413 } 6400 6414 } 6401 6415 } … … 6417 6431 if (player) //prevent crash with creature as target 6418 6432 { 6419 name = player->GetName();6433 name = player->GetName(); 6420 6434 } 6421 6435 } … … 6485 6499 //Header of the names 6486 6500 PSendSysMessage(LANG_COMMAND_LIST_FREEZE); 6487 6501 6488 6502 //Output of the results 6489 do6503 do 6490 6504 { 6491 6505 Field *fields = result->Fetch();
![(please configure the [header_logo] section in trac.ini)](/TrinityCore/trac.cgi/chrome/site/your_project_logo.png)