44 #include "ace/INET_Addr.h" 60 char* charname = strtok((
char*)args,
" ");
64 std::string cname = charname;
66 char* timetonotspeak = strtok(NULL,
" ");
70 char* mutereason = strtok(NULL,
"");
71 std::string mutereasonstr;
73 mutereasonstr =
"No reason.";
75 mutereasonstr = mutereason;
107 account_id =
sObjectMgr.GetPlayerAccountIdByGUID(guid);
118 time_t mutetime = time(NULL) + notspeaktime * 60;
139 char* charname = strtok((
char*)args,
" ");
143 std::string cname = charname;
173 account_id =
sObjectMgr.GetPlayerAccountIdByGUID(guid);
210 char* cstrticket_id = strtok((
char*)args,
" ");
215 uint64 ticket_id = atoi(cstrticket_id);
254 char* atId = strtok((
char*)args,
" ");
258 int32 i_atId = atoi(atId);
299 char* gyId = strtok((
char*)args,
" ");
303 int32 i_gyId = atoi(gyId);
359 std::ostringstream whereClause;
362 if (strcmp(pParam1,
"id") == 0)
368 char* tail = strtok(NULL,
"");
375 int32 tEntry = atoi(cId);
380 whereClause <<
"WHERE id = '" << tEntry <<
"'";
386 int32 guid = atoi(pParam1);
391 std::string name = pParam1;
393 whereClause <<
", creature_template WHERE creature.id = creature_template.entry AND creature_template.name " _LIKE_ " '" << name <<
"'";
396 whereClause <<
"WHERE guid = '" << guid <<
"'";
407 if (result->GetRowCount() > 1)
410 Field* fields = result->Fetch();
411 float x = fields[0].GetFloat();
412 float y = fields[1].GetFloat();
413 float z = fields[2].GetFloat();
414 float ort = fields[3].GetFloat();
415 int mapid = fields[4].GetUInt16();
451 int32 guid = atoi(cId);
464 ort = go_data->orientation;
465 mapid = go_data->mapid;
502 int32 id = atoi((
char*)args);
504 result =
WorldDatabase.
PQuery(
"SELECT guid, id, position_x, position_y, position_z, orientation, map, (POW(position_x - '%f', 2) + POW(position_y - '%f', 2) + POW(position_z - '%f', 2)) AS order_ FROM gameobject WHERE map = '%i' AND id = '%u' ORDER BY order_ ASC LIMIT 1",
508 std::string name = args;
511 "SELECT guid, id, position_x, position_y, position_z, orientation, map, (POW(position_x - %f, 2) + POW(position_y - %f, 2) + POW(position_z - %f, 2)) AS order_ " 512 "FROM gameobject,gameobject_template WHERE gameobject_template.entry = gameobject.id AND map = %i AND name " _LIKE_ " " _CONCAT3_(
"'%%'",
"'%s'",
"'%%'")
" ORDER BY order_ ASC LIMIT 1",
518 std::ostringstream eventFilter;
519 eventFilter <<
" AND (event IS NULL ";
520 bool initString =
true;
522 for (GameEventMgr::ActiveEvents::const_iterator itr = activeEventsList.begin(); itr != activeEventsList.end(); ++itr)
526 eventFilter <<
"OR event IN (" << *itr;
530 eventFilter <<
"," << *itr;
538 result =
WorldDatabase.
PQuery(
"SELECT gameobject.guid, id, position_x, position_y, position_z, orientation, map, " 539 "(POW(position_x - %f, 2) + POW(position_y - %f, 2) + POW(position_z - %f, 2)) AS order_ FROM gameobject " 540 "LEFT OUTER JOIN game_event_gameobject on gameobject.guid=game_event_gameobject.guid WHERE map = '%i' %s ORDER BY order_ ASC LIMIT 10",
558 Field* fields = result->Fetch();
559 lowguid = fields[0].GetUInt32();
560 id = fields[1].GetUInt32();
561 x = fields[2].GetFloat();
562 y = fields[3].GetFloat();
563 z = fields[4].GetFloat();
564 o = fields[5].GetFloat();
565 mapid = fields[6].GetUInt16();
570 while (result->NextRow() && (!found));
593 if (curRespawnDelay < 0)
612 uint32 lowguid = atoi(cId);
660 uint32 lowguid = atoi(cId);
677 char* po = strtok(NULL,
" ");
709 uint32 lowguid = atoi(cId);
726 char* px = strtok(NULL,
" ");
727 char* py = strtok(NULL,
" ");
728 char* pz = strtok(NULL,
" ");
746 float x = (float)atof(px);
747 float y = (float)atof(py);
748 float z = (float)atof(pz);
780 char* pParam1 = strtok((
char*)args,
" ");
784 uint32 id = atoi((
char*)pParam1);
788 char* spawntimeSecs = strtok(NULL,
" ");
809 if (!pGameObj->
Create(db_lowGUID, gInfo->
id, map, 0x00000001, x, y, z, o, 0.0f, 0.0f, 0.0f, 0.0f, 0,
GO_STATE_READY))
859 if (!*args)
return false;
875 uint32 factionId = atoi(factionTxt);
878 char* rankTxt = strtok(NULL,
" ");
882 amount = atoi(rankTxt);
883 if ((amount == 0) && (rankTxt[0] !=
'-') && !isdigit(rankTxt[0]))
885 std::string rankStr = rankTxt;
886 std::wstring wrankStr;
905 if (wrank.substr(0, wrankStr.size()) == wrankStr)
907 char* deltaTxt = strtok(NULL,
" ");
910 int32 delta = atoi(deltaTxt);
923 if (r >= MAX_REPUTATION_RANK)
958 char* charID = strtok((
char*)args,
" ");
962 char* team = strtok(NULL,
" ");
965 teamval = atoi(team);
1016 char* fmaxcount = strtok(NULL,
" ");
1019 maxcount =
atol(fmaxcount);
1021 char* fincrtime = strtok(NULL,
" ");
1024 incrtime =
atol(fincrtime);
1026 char* fextendedcost = strtok(NULL,
" ");
1027 uint32 extendedcost = fextendedcost ?
atol(fextendedcost) : 0;
1039 sObjectMgr.AddVendorItem(vendor_entry, itemId, maxcount, incrtime, extendedcost);
1054 if (!vendor || !vendor->
IsVendor())
1105 if (pCreature->
IsPet())
1106 ((
Pet*)pCreature)->GivePetLevel(lvl);
1155 uint32 lowguid = atoi(cId);
1196 lowguid = atoi(cId);
1252 WorldDatabase.
PExecuteLog(
"UPDATE creature SET position_x = '%f', position_y = '%f', position_z = '%f', orientation = '%f' WHERE guid = '%u'", x, y, z, o, lowguid);
1281 char* guid_str = strtok((
char*)args,
" ");
1282 char* type_str = strtok((
char*)NULL,
" ");
1283 char* dontdel_str = strtok((
char*)NULL,
" ");
1285 bool doNotDelete =
false;
1301 if (stricmp(dontdel_str,
"NODEL") == 0)
1312 sLog.outError(
"DEBUG: Only 2 params ");
1313 if (stricmp(type_str,
"NODEL") == 0)
1324 type_str = guid_str;
1326 if (!pCreature || pCreature->
IsPet())
1332 lowguid = atoi((
char*)guid_str);
1359 std::string type = type_str;
1363 else if (type ==
"random")
1365 else if (type ==
"way")
1373 if (doNotDelete ==
false)
1385 if (doNotDelete ==
false)
1403 if (!pCreature || pCreature->
IsPet())
1464 float option = atof((
char*)args);
1492 WorldDatabase.
PExecuteLog(
"UPDATE creature SET spawndist=%f, MovementType=%i WHERE guid=%u", option, mtype, u_guidlow);
1502 char* stime = strtok((
char*)args,
" ");
1507 int i_stime = atoi((
char*)stime);
1690 uint8 srcslot, dstslot;
1692 char* pParam1 = strtok((
char*)args,
" ");
1696 char* pParam2 = strtok(NULL,
" ");
1700 srcslot = (
uint8)atoi(pParam1);
1701 dstslot = (
uint8)atoi(pParam2);
1703 if (srcslot == dstslot)
1752 const char* kickName = strtok((
char*)args,
" ");
1753 char* kickReason = strtok(NULL,
"\n");
1754 std::string reason =
"No Reason";
1755 std::string kicker =
"Console";
1757 reason = kickReason;
1787 std::string name = kickName;
1817 if (
sWorld.KickPlayer(name.c_str()))
1858 char* px = strtok((
char*)args,
" ");
1879 py = strtok(NULL,
" ");
1882 targetGUID =
sObjectMgr.GetPlayerGUIDByName(name);
1884 py = strtok(NULL,
" ");
1890 if (!target && !targetGUID)
1893 if (!target && !targetGUID)
1902 uint32 total_player_time = 0;
1911 targetGUID = target->
GetGUID();
1931 Field* fields = result->Fetch();
1932 total_player_time = fields[0].GetUInt32();
1933 level = fields[1].GetUInt32();
1934 money = fields[2].GetUInt32();
1935 accId = fields[3].GetUInt32();
1936 race = fields[4].GetUInt8();
1937 Class = fields[5].GetUInt8();
1948 "LEFT JOIN account_access aa " 1949 "ON (a.id = aa.id) " 1950 "WHERE a.id = '%u'", accId);
1953 Field* fields = result->Fetch();
1955 security = fields[1].GetUInt32();
1966 uint32 ip = inet_addr(last_ip.c_str());
1967 #if OREGON_ENDIAN == BIGENDIAN 1972 "i.ip < %u AND c.code = i.country ORDER BY i.ip DESC LIMIT 0,1", ip))
1974 Field* fields2 = result2->Fetch();
1975 last_ip.append(
" (");
1976 last_ip.append(fields2[0].GetString());
1977 last_ip.append(
")");
1987 PSendSysMessage(
LANG_PINFO_ACCOUNT, (target ?
"" :
GetOregonString(
LANG_OFFLINE)), name.c_str(),
GUID_LOPART(targetGUID), username.c_str(), accId, email.c_str(), security, last_ip.c_str(), last_login.c_str(), latency);
1989 std::string race_s, Class_s;
2002 race_s =
"Night Elf";
2017 race_s =
"Blood Elf";
2026 Class_s =
"Warrior";
2029 Class_s =
"Paladin";
2047 Class_s =
"Warlock";
2060 if (py && strncmp(py,
"rep", 3) == 0)
2070 const char* FactionName;
2072 for (FactionStateList::const_iterator itr = targetFSL.begin(); itr != targetFSL.end(); ++itr)
2078 FactionName =
"#Not found#";
2081 std::ostringstream ss;
2082 ss << itr->second.ID <<
": |cffffffff|Hfaction:" << itr->second.ID <<
"|h[" << FactionName <<
"]|h|r " << rankName <<
"|h|r (" << target->
GetReputationMgr().
GetReputation(factionEntry) <<
")";
2107 sLog.outDebug(
"DEBUG: HandleWpAddCommand");
2110 char* path_number = NULL;
2114 path_number = strtok((
char*)args,
" ");
2126 uint32 maxpathid = result->Fetch()->GetInt32();
2127 pathid = maxpathid + 1;
2128 sLog.outDebug(
"DEBUG: HandleWpAddCommand - New path started.");
2133 pathid = atoi(path_number);
2140 sLog.outDebug(
"DEBUG: HandleWpAddCommand - Current creature has no loaded path.");
2141 PSendSysMessage(
"%s%s|r",
"|cffff33ff",
"Current creature has no loaded path.");
2145 sLog.outDebug(
"DEBUG: HandleWpAddCommand - point == 0");
2150 point = (*result)[0].GetUInt32();
2155 WorldDatabase.
PExecuteLog(
"INSERT INTO waypoint_data (id, point, position_x, position_y, position_z) VALUES ('%u','%u','%f', '%f', '%f')",
2158 PSendSysMessage(
"%s%s%u%s%u%s|r",
"|cff00ff00",
"PathID: |r|cff00ffff", pathid,
"|r|cff00ff00: Waypoint |r|cff00ffff", point+1,
"|r|cff00ff00 created. ");
2168 char* path_number = NULL;
2171 path_number = strtok((
char*)args,
" ");
2179 sLog.outDebug(
"DEBUG: HandleWpLoadPathCommand - No path number provided");
2190 PSendSysMessage(
"%s%s|r",
"|cffff33ff",
"You want to load path to a waypoint? Aren't you?");
2195 pathid = atoi(path_number);
2199 PSendSysMessage(
"%s%s|r",
"|cffff33ff",
"No vallid path number provided.");
2207 WorldDatabase.
PExecute(
"UPDATE creature_addon SET path_id = '%u' WHERE guid = '%u'", pathid, guidlow);
2209 WorldDatabase.
PExecute(
"INSERT INTO creature_addon(guid,path_id) VALUES ('%u','%u')", guidlow, pathid);
2216 target->
Say(
"Path loaded.", 0, 0);
2231 PSendSysMessage(
"%s%s|r|cff00ffff%u|r",
"|cff00ff00",
"Loading Path: ",
id);
2258 target->
Say(
"Path unloaded.", 0, 0);
2261 PSendSysMessage(
"%s%s|r",
"|cffff33ff",
"Target has no loaded path.");
2271 char* show_str = strtok((
char*)args,
" ");
2272 std::string show = show_str;
2275 if ((show !=
"add") && (show !=
"mod") && (show !=
"del") && (show !=
"listid"))
return false;
2277 char* arg_id = strtok(NULL,
" ");
2292 PSendSysMessage(
"%s%s%u|r",
"|cff00ff00",
"Wp Event: New waypoint event added: ",
id);
2295 PSendSysMessage(
"|cff00ff00Wp Event: You have chosen an existing waypoint script guid: %u|r",
id);
2300 id = result->Fetch()->GetUInt32();
2302 PSendSysMessage(
"%s%s%u|r",
"|cff00ff00",
"Wp Event: New waypoint event added: |r|cff00ffff",
id + 1);
2308 if (show ==
"listid")
2312 PSendSysMessage(
"%s%s|r",
"|cff33ffff",
"Wp Event: You must provide waypoint script id.");
2318 uint32 a2, a3, a4, a5, a6;
2319 float a8, a9, a10, a11;
2322 QueryResult_AutoPtr result =
WorldDatabase.
PQuery(
"SELECT guid, delay, command, datalong, datalong2, dataint, x, y, z, o FROM waypoint_scripts WHERE id = %u",
id);
2326 PSendSysMessage(
"%s%s%u|r",
"|cff33ffff",
"Wp Event: No waypoint scripts found on id: ",
id);
2334 fields = result->Fetch();
2335 a2 = fields[0].GetUInt32();
2336 a3 = fields[1].GetUInt32();
2337 a4 = fields[2].GetUInt32();
2338 a5 = fields[3].GetUInt32();
2339 a6 = fields[4].GetUInt32();
2341 a8 = fields[6].GetFloat();
2342 a9 = fields[7].GetFloat();
2343 a10 = fields[8].GetFloat();
2344 a11 = fields[9].GetFloat();
2346 PSendSysMessage(
"|cffff33ffid:|r|cff00ffff %u|r|cff00ff00, guid: |r|cff00ffff%u|r|cff00ff00, delay: |r|cff00ffff%u|r|cff00ff00, command: |r|cff00ffff%u|r|cff00ff00, datalong: |r|cff00ffff%u|r|cff00ff00, datalong2: |r|cff00ffff%u|r|cff00ff00, datatext: |r|cff00ffff%s|r|cff00ff00, posx: |r|cff00ffff%f|r|cff00ff00, posy: |r|cff00ffff%f|r|cff00ff00, posz: |r|cff00ffff%f|r|cff00ff00, orientation: |r|cff00ffff%f|r",
id, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11);
2348 while (result->NextRow());
2360 PSendSysMessage(
"%s%s%u|r",
"|cff00ff00",
"Wp Event: Waypoint script removed: ",
id);
2363 PSendSysMessage(
"|cffff33ffWp Event: ERROR: you have selected an invalid script: %u|r",
id);
2372 SendSysMessage(
"|cffff33ffERROR: Waypoint script guid not present.|r");
2380 SendSysMessage(
"|cffff33ffERROR: No vallid waypoint script id not present.|r");
2384 char* arg_2 = strtok(NULL,
" ");
2392 std::string arg_string = arg_2;
2394 if ((arg_string !=
"setid") && (arg_string !=
"delay") && (arg_string !=
"command")
2395 && (arg_string !=
"datalong") && (arg_string !=
"datalong2") && (arg_string !=
"dataint") && (arg_string !=
"posx")
2396 && (arg_string !=
"posy") && (arg_string !=
"posz") && (arg_string !=
"orientation"))
2403 std::string arg_str_2 = arg_2;
2404 arg_3 = strtok(NULL,
" ");
2408 SendSysMessage(
"|cffff33ffERROR: No additional argument present.|r");
2414 if (arg_str_2 ==
"setid")
2416 uint32 newid = atoi(arg_3);
2417 PSendSysMessage(
"%s%s|r|cff00ffff%u|r|cff00ff00%s|r|cff00ffff%u|r",
"|cff00ff00",
"Wp Event: Wypoint scipt guid: ", newid,
" id changed: ",
id);
2428 SendSysMessage(
"|cffff33ffERROR: You have selected an invalid waypoint script guid.|r");
2432 if (arg_str_2 ==
"posx")
2434 coord = atof(arg_3);
2437 PSendSysMessage(
"|cff00ff00Waypoint script:|r|cff00ffff %u|r|cff00ff00 position_x updated.|r",
id);
2440 else if (arg_str_2 ==
"posy")
2442 coord = atof(arg_3);
2445 PSendSysMessage(
"|cff00ff00Waypoint script: %u position_y updated.|r",
id);
2448 else if (arg_str_2 ==
"posz")
2450 coord = atof(arg_3);
2453 PSendSysMessage(
"|cff00ff00Waypoint script: |r|cff00ffff%u|r|cff00ff00 position_z updated.|r",
id);
2456 else if (arg_str_2 ==
"orientation")
2458 coord = atof(arg_3);
2461 PSendSysMessage(
"|cff00ff00Waypoint script: |r|cff00ffff%u|r|cff00ff00 orientation updated.|r",
id);
2464 else if (arg_str_2 ==
"dataint")
2467 arg_2, atoi(arg_3),
id);
2468 PSendSysMessage(
"|cff00ff00Waypoint script: |r|cff00ffff%u|r|cff00ff00 dataint updated.|r",
id);
2473 std::string arg_str_3 = arg_3;
2476 arg_2, arg_str_3.c_str(), id);
2479 PSendSysMessage(
"%s%s|r|cff00ffff%u:|r|cff00ff00 %s %s|r",
"|cff00ff00",
"Waypoint script:",
id, arg_2,
"updated.");
2486 sLog.outDebug(
"DEBUG: HandleWpModifyCommand");
2492 char* show_str = strtok((
char*)args,
" ");
2496 std::string show = show_str;
2499 if ((show !=
"delay") && (show !=
"action") && (show !=
"action_chance")
2500 && (show !=
"move_type") && (show !=
"del") && (show !=
"move") && (show !=
"wpadd")
2505 char* arg_str = NULL;
2517 SendSysMessage(
"|cffff33ffERROR: You must select a waypoint.|r");
2521 sLog.outDebug(
"DEBUG: HandleWpModifyCommand - User did select an NPC");
2543 sLog.outDebug(
"DEBUG: HandleWpModifyCommand - No waypoint found - used 'wpguid'");
2552 const char* maxDIFF =
"0.01";
2553 result =
WorldDatabase.
PQuery(
"SELECT id, point FROM waypoint_data WHERE (abs(position_x - %f) <= %s) and (abs(position_y - %f) <= %s) and (abs(position_z - %f) <= %s)",
2561 sLog.outDebug(
"DEBUG: HandleWpModifyCommand - After getting wpGuid");
2565 Field* fields = result->Fetch();
2566 pathid = fields[0].GetUInt32();
2567 point = fields[1].GetUInt32();
2569 while (result->NextRow());
2573 arg_str = strtok((
char*)NULL,
" ");
2576 sLog.outDebug(
"DEBUG: HandleWpModifyCommand - Parameters parsed - now execute the command");
2579 if (show !=
"del" && show !=
"move" && arg_str == NULL)
2585 if (show ==
"del" && target)
2587 PSendSysMessage(
"|cff00ff00DEBUG: wp modify del, PathID: |r|cff00ffff%u|r", pathid);
2609 if (show ==
"move" && target)
2611 PSendSysMessage(
"|cff00ff00DEBUG: wp move, PathID: |r|cff00ffff%u|r", pathid);
2647 WorldDatabase.
PExecuteLog(
"UPDATE waypoint_data SET position_x = '%f',position_y = '%f',position_z = '%f' where id = '%u' AND point='%u'",
2655 const char* text = arg_str;
2661 show_str, pathid, point);
2666 std::string text2 = text;
2669 show_str, text2.c_str(), pathid, point);
2678 sLog.outDebug(
"DEBUG: HandleWpShowCommand");
2684 char* show_str = strtok((
char*)args,
" ");
2689 char* guid_str = strtok((
char*)NULL,
" ");
2690 sLog.outDebug(
"DEBUG: HandleWpShowCommand: show_str: %s guid_str: %s", show_str, guid_str);
2699 sLog.outDebug(
"DEBUG: HandleWpShowCommand: !guid_str");
2714 sLog.outDebug(
"|cff00ff00DEBUG: HandleWpShowCommand: PathID provided|r");
2721 pathid = atoi((
char*)guid_str);
2724 sLog.outDebug(
"DEBUG: HandleWpShowCommand: danach");
2726 std::string show = show_str;
2729 sLog.outDebug(
"DEBUG: HandleWpShowCommand: PathID: %u", pathid);
2755 Field* fields = result->Fetch();
2756 pathid = fields[0].GetUInt32();
2757 uint32 point = fields[1].GetUInt32();
2758 uint32 delay = fields[2].GetUInt32();
2759 uint32 flag = fields[3].GetUInt32();
2760 uint32 ev_id = fields[4].GetUInt32();
2761 uint32 ev_chance = fields[5].GetUInt32();
2763 PSendSysMessage(
"|cff00ff00Show info: for current point: |r|cff00ffff%u|r|cff00ff00, Path ID: |r|cff00ffff%u|r", point, pathid);
2764 PSendSysMessage(
"|cff00ff00Show info: delay: |r|cff00ffff%u|r", delay);
2765 PSendSysMessage(
"|cff00ff00Show info: Move flag: |r|cff00ffff%u|r", flag);
2766 PSendSysMessage(
"|cff00ff00Show info: Waypoint event: |r|cff00ffff%u|r", ev_id);
2767 PSendSysMessage(
"|cff00ff00Show info: Event chance: |r|cff00ffff%u|r", ev_chance);
2769 while (result->NextRow());
2785 PSendSysMessage(
"|cff00ff00DEBUG: wp on, PathID: |cff00ffff%u|r", pathid);
2792 bool hasError =
false;
2795 Field* fields = result2->Fetch();
2796 uint32 wpguid = fields[0].GetUInt32();
2813 while (result2->NextRow());
2825 Field* fields = result->Fetch();
2826 uint32 point = fields[0].GetUInt32();
2827 float x = fields[1].GetFloat();
2828 float y = fields[2].GetFloat();
2829 float z = fields[3].GetFloat();
2845 sLog.outDebug(
"DEBUG: UPDATE waypoint_data SET wpguid = '%u'", wpCreature->
GetGUIDLow());
2863 while (result->NextRow());
2865 SendSysMessage(
"|cff00ff00Showing the current creature's path.|r");
2869 if (show ==
"first")
2881 Field* fields = result->Fetch();
2882 float x = fields[0].GetFloat();
2883 float y = fields[1].GetFloat();
2884 float z = fields[2].GetFloat();
2885 float o = fields[3].GetFloat();
2918 PSendSysMessage(
"|cff00ff00DEBUG: wp last, PathID: |r|cff00ffff%u|r", pathid);
2922 Maxpoint = (*result)[0].GetUInt32();
2926 result =
WorldDatabase.
PQuery(
"SELECT position_x,position_y,position_z FROM waypoint_data WHERE point ='%u' AND id = '%u'", Maxpoint, pathid);
2933 Field* fields = result->Fetch();
2934 float x = fields[0].GetFloat();
2935 float y = fields[1].GetFloat();
2936 float z = fields[2].GetFloat();
2937 float o = fields[3].GetFloat();
2977 bool hasError =
false;
2980 Field* fields = result->Fetch();
2981 uint32 guid = fields[0].GetUInt32();
2996 while (result->NextRow());
3012 PSendSysMessage(
"|cffff33ffDEBUG: wpshow - no valid command found|r");
3023 std::string oldname;
3025 char* px = strtok((
char*)args,
" ");
3038 target =
sObjectMgr.GetPlayer(oldname.c_str());
3041 targetGUID =
sObjectMgr.GetPlayerGUIDByName(oldname);
3044 if (!target && !targetGUID)
3047 if (!target && !targetGUID)
3076 std::string namepart = args;
3077 std::wstring wnamepart;
3095 std::string name = factionEntry->
name[loc];
3107 name = factionEntry->
name[loc];
3120 std::ostringstream ss;
3122 ss <<
id <<
" - |cffffffff|Hfaction:" <<
id <<
"|h[" << name <<
" " <<
localeNames[loc] <<
"]|h|r";
3124 ss <<
id <<
" - " << name <<
" " << localeNames[loc];
3166 uint32 anim_id = atoi((
char*)args);
3177 uint32 anim_id = atoi((
char*)args);
3234 std::string namepart = args;
3235 std::wstring wnamepart;
3250 for (
uint32 id = 0;
id < events.size(); ++id)
3260 if (maxResults && count++ == maxResults)
3293 for (GameEventMgr::ActiveEvents::const_iterator itr = activeEvents.begin(); itr != activeEvents.end(); ++itr)
3322 uint32 event_id = atoi(cId);
3326 if (event_id >= events.size())
3342 bool active = activeEvents.find(event_id) != activeEvents.end();
3349 time_t nextTime = time(NULL) + delay;
3350 std::string nextStr = nextTime >= eventData.
start && nextTime < eventData.
end ?
TimeToTimestampStr(time(NULL) + delay) :
"-";
3356 startTimeStr.c_str(), endTimeStr.c_str(), occurenceStr.c_str(), lengthStr.c_str(),
3371 int32 event_id = atoi(cId);
3375 if (event_id < 1 ||
uint32(event_id) >= events.size())
3391 if (activeEvents.find(event_id) != activeEvents.end())
3412 int32 event_id = atoi(cId);
3416 if (event_id < 1 ||
uint32(event_id) >= events.size())
3433 if (activeEvents.find(event_id) == activeEvents.end())
3450 std::string playername = args;
3459 player =
sObjectMgr.GetPlayer(playername.c_str());
3538 std::wstring wnamepart;
3559 std::string name = skillInfo->
name[loc];
3589 target->
SetSkill(skillInfo->
id, maxLevel, maxLevel);
3604 std::string ip = strtok ((
char*)args,
" ");
3605 char* limit_str = strtok (NULL,
" ");
3606 int32 limit = limit_str ? atoi (limit_str) : -1;
3620 std::string account = strtok ((
char*)args,
" ");
3621 char* limit_str = strtok (NULL,
" ");
3622 int32 limit = limit_str ? atoi (limit_str) : -1;
3640 std::string email = strtok ((
char*)args,
" ");
3641 char* limit_str = strtok (NULL,
" ");
3642 int32 limit = limit_str ? atoi (limit_str) : -1;
3665 if (maxResults && count++ == maxResults)
3671 Field* fields = result->Fetch();
3672 uint32 acc_id = fields[0].GetUInt32();
3685 Field* charfields = chars->Fetch();
3686 guid = charfields[0].GetUInt64();
3693 while (chars->NextRow() && (limit == -1 || i < limit));
3696 while (result->NextRow());
3744 PSendSysMessage(
"This creature cannot be tamed. Family id: 0 (CREATURE_FAMILY_NONE).");
3778 sLog.outError(
"InitStatsForLevel() in EffectTameCreature failed! Pet deleted.");
3821 if (!spellId || !
sSpellStore.LookupEntry(spellId))
3904 uint32 lowguid = atoi(cId);
3935 char* charID = strtok((
char*)args,
" ");
3946 uint32 id = atoi(charID);
3958 char*
id = strtok((
char*)args,
" ");
3964 char* spawntime = strtok(NULL,
" ");
3968 spawntm = atoi((
char*)spawntime);
3975 float rot2 = sin(ang / 2);
3976 float rot3 = cos(ang / 2);
3978 uint32 objectId = atoi(
id);
3987 player->
SummonGameObject(objectId, x, y, z, ang, 0, 0, rot2, rot3, spawntm);
4017 PSendSysMessage(
"Selected creature can't link with guid '%u'", linkguid);
4035 char const* targetName = target ? target->
GetName() :
"NAME";
4037 std::string namepart = args;
4038 std::wstring wnamepart;
4056 std::string name = titleInfo->
name[loc];
4068 name = titleInfo->
name[loc];
4079 if (maxResults && counter == maxResults)
4091 char titleNameStr[80];
4092 snprintf(titleNameStr, 80, name.c_str(), targetName);
4116 int32 id = atoi(id_p);
4140 std::string tNameLink = target->
GetName();
4142 char const* targetName = target->
GetName();
4143 char titleNameStr[80];
4159 int32 id = atoi(id_p);
4185 char const* targetName = target->
GetName();
4186 char titleNameStr[80];
4208 sscanf((
char*)args,
UI64FMTD, &titles);
4222 titles2 &= ~(
uint64(1) << tEntry->bit_index);
4250 char const* targetName = target->
GetName();
4257 if (titleInfo && target->
HasTitle(titleInfo))
4259 std::string name = titleInfo->
name[loc];
4267 char titleNameStr[80];
4268 snprintf(titleNameStr, 80, name.c_str(), targetName);
4287 int32 id = atoi(id_p);
4311 std::string tNameLink = target->
GetName();
4328 switch (
sObjectMgr.GetRAFLinkStatus(account, &linked))
4337 PSendSysMessage(
"Account " UI64FMTD
" is referred account. (friend is: " UI64FMTD
")", account, linked);
4339 PSendSysMessage(
"Character %s has %.02f grantable levels", player->GetName(), player->GetGrantableLevels());
4352 args = strchr(args,
' ');
4363 PSendSysMessage(
"First or second account is already linked with an account.");
4407 if (!pCreature->
IsPet())
4421 uint32 lowguid = atoi(cId);
4437 char* phaseStr = strtok(NULL,
" ");
4438 uint32 phasemask = phaseStr ? atoi(phaseStr) : 0;
bool HandleCharacterRenameCommand(const char *args)
bool Utf8FitTo(const std::string &str, std::wstring search)
DBCStorage< WorldSafeLocsEntry > sWorldSafeLocsStore(WorldSafeLocsEntryfmt)
bool HandleAnimCommand(const char *args)
void CreatureRelocation(Creature *creature, float x, float y, float z, float ang, bool respawnRelocationOnFail=true)
GameObject * SummonGameObject(uint32 entry, float x, float y, float z, float ang, float rotation0, float rotation1, float rotation2, float rotation3, uint32 respawnTime)
bool HandleWpLoadPathCommand(const char *args)
void SetSentErrorMessage(bool val)
uint8 GetSpawnMode() const
bool LoadCreatureFromDB(uint32 guid, Map *map, bool addToMap=true)
bool HasSpell(uint32 spell) const override
int32 GetReputation(uint32 faction_id) const
bool HandleEventActiveListCommand(const char *args)
GameObject * GetObjectGlobalyWithGuidOrNearWithDbGuid(uint32 lowguid, uint32 entry)
const uint32 & GetUInt32Value(uint16 index) const
bool HandleNpcSpawnDistCommand(const char *args)
DBCStorage< SkillLineEntry > sSkillLineStore(SkillLinefmt)
bool HandleUnmuteCommand(const char *args)
bool HandleLookupEventCommand(const char *args)
void SetPetNumber(uint32 petnumber, bool statwindow)
static const int32 PointsInRank[MAX_REPUTATION_RANK]
bool HandleLookupPlayerIpCommand(const char *args)
bool HandleGOPhaseCommand(const char *args)
uint32 GetMaxHealth() const
bool HandleNpcFlagCommand(const char *args)
uint32 GetPhaseMaskForSpawn() const
Creature * getSelectedCreature()
bool HandleTitlesCurrentCommand(const char *args)
bool HandleNpcAddCommand(const char *args)
DatabaseType WorldDatabase
Accessor to the world database.
uint32 GetFaction() const
uint32 GetDBTableGUIDLow() const
bool HandleRAFInfoCommand(const char *args)
bool HandleActivateObjectCommand(const char *args)
bool HandleUpdateHonorFieldsCommand(const char *args)
void UpdateWaypointID(uint32 wpID)
QueryResult_AutoPtr PQuery(const char *format,...) ATTR_PRINTF(2
bool HandlePetLearnCommand(const char *args)
bool HandleServerCorpsesCommand(const char *args)
void SetObjectScale(float scale)
bool IsValidPos(uint16 pos)
uint64 GetOwnerGUID() const
bool HandleTitlesSetMaskCommand(const char *args)
bool HandleWpEventCommand(const char *args)
bool HandleAddHonorCommand(const char *args)
bool HandleTurnObjectCommand(const char *args)
void SetTitle(CharTitlesEntry const *title, bool lost=false)
MotionMaster * GetMotionMaster()
TempSummon * SummonCreature(uint32 id, const Position &pos, TempSummonType spwtype=TEMPSUMMON_MANUAL_DESPAWN, uint32 despwtime=0)
DBCStorage< FactionTemplateEntry > sFactionTemplateStore(FactionTemplateEntryfmt)
bool HandleNpcFactionIdCommand(const char *args)
bool HandleRAFUnlinkCommand(const char *args)
bool HandleNpcSetPhaseCommand(const char *args)
#define sLog
Log class singleton.
bool HandleNpcFollowCommand(const char *args)
bool HandleNpcMoveCommand(const char *args)
MovementGeneratorType GetCurrentMovementGeneratorType() const
bool HandleKickPlayerCommand(const char *args)
bool HandleNpcSetLinkCommand(const char *args)
void SetUInt32Value(uint16 index, uint32 value)
unsigned long escape_string(char *to, const char *from, unsigned long length)
bool HandlePInfoCommand(const char *args)
bool HandleLookupPlayerAccountCommand(const char *args)
bool HandleGoTicketCommand(const char *args)
void SaveRecallPosition()
QueryResult_AutoPtr Query(const char *sql)
time_t GetRespawnTimeEx() const
bool HandleGoGraveyardCommand(const char *args)
bool HandlePetTpCommand(const char *args)
bool LookupPlayerSearchCommand(QueryResult_AutoPtr result, int32 limit)
DBCStorage< AreaTriggerEntry > sAreaTriggerStore(AreaTriggerEntryfmt)
void SetNativeDisplayId(uint32 modelId)
virtual void SendSysMessage(const char *str)
uint32 GetAccountId() const
bool HandleNameCommand(const char *args)
bool CreateBaseAtCreature(Creature *creature)
void SetRespawnTime(int32 respawn)
Player * GetPlayer() const
uint32 GetGUIDLow() const
bool HandleWpModifyCommand(const char *args)
LocaleConstant GetSessionDbcLocale() const
bool Utf8toWStr(char const *utf8str, size_t csize, wchar_t *wstr, size_t &wsize)
void LoadPath(uint32 pathid)
bool HandleMorphCommand(const char *args)
void SetMinion(Minion *minion, bool apply)
FactionState const * GetState(FactionEntry const *factionEntry) const
bool HandleRepairitemsCommand(const char *args)
void wstrToLower(std::wstring &str)
bool HandleMuteCommand(const char *args)
CharmInfo * GetCharmInfo()
DBCStorage< SpellEntry > sSpellStore(SpellEntryfmt)
static ObjectAccessor & Instance()
bool HandleNpcSetMoveTypeCommand(const char *args)
const char * GetString() const
virtual void DeleteFromDB()
bool PExecuteLog(const char *format,...) ATTR_PRINTF(2
uint32 GetRespawnDelay() const
#define MAX_REPUTATION_RANK
uint16 GetPureMaxSkillValue(uint32 skill) const
bool HasSpell(uint32 spell) const override
bool HandleRAFLinkCommand(const char *args)
DBCStorage< CharTitlesEntry > sCharTitlesStore(CharTitlesEntryfmt)
#define IS_PLAYER_GUID(Guid)
void SetLootState(LootState s, Unit *unit=NULL)
void SavePetToDB(PetSaveMode mode)
uint32 GetTotalPlayedTime()
char const * localeNames[MAX_LOCALE]
bool normalizePlayerName(std::string &name)
bool TeleportTo(uint32 mapid, float x, float y, float z, float orientation, uint32 options=0)
bool InitStatsForLevel(uint32 level)
Creature * GetCreature(uint64 guid)
bool HandleModifyPhaseCommand(const char *args)
float GetOrientation() const
void setDeathState(DeathState s) override
void Relocate(float x, float y)
std::string GetCppString() const
bool HandleCharacterTitlesCommand(const char *args)
bool learnSpell(uint16 spell_id)
bool HandleTitlesRemoveCommand(const char *args)
void SetPhaseMask(uint32 newPhaseMask, bool update) override
void PetSpellInitialize()
HostileRefManager & getHostileRefManager()
bool HandleSubNameCommand(const char *args)
void AddObjectToRemoveList()
void PSendSysMessage(const char *format,...) ATTR_PRINTF(2
void SetDisplayId(uint32 modelId)
void SetRespawnRadius(float dist)
bool HandleLookupFactionCommand(const char *args)
DatabaseType LoginDatabase
Accessor to the realm/login database.
void SetDefaultMovementType(MovementGeneratorType mgt)
void EndianConvertReverse(T &)
bool HandleDeMorphCommand(const char *args)
float GetPositionY() const
#define MAKE_NEW_GUID(l, e, h)
bool HandleNpcSpawnTimeCommand(const char *args)
bool HandleStandStateCommand(const char *args)
etc mysql my cnf *Then change max_allowed_packet to a bigger value
float GetPositionZ() const
bool HandleModifyRepCommand(const char *args)
const uint64 & GetSelection() const
void Say(const char *text, uint32 language, uint64 TargetGuid)
void CombatStop(bool cast=false)
bool Create(uint32 guidlow, Map *map, uint32 phaseMask, uint32 Entry, uint32 team, float x, float y, float z, float ang, const CreatureData *data=NULL)
static bool normalizeString(std::string &utf8str)
bool HandleWpUnLoadPathCommand(const char *args)
void UpdateObjectVisibility(bool forced=true) override
bool HandleGUIDCommand(const char *args)
std::string TimeToTimestampStr(time_t t)
void SetMaxHealth(uint32 val)
uint32 extractSpellIdFromLink(char *text)
bool PExecute(const char *format,...) ATTR_PRINTF(2
bool HandleEventStartCommand(const char *args)
bool HandleLookupTitleCommand(const char *args)
FactionStateList const & GetStateList() const
void SetAtLoginFlag(AtLoginFlags f)
void CleanupAfterTaxiFlight()
void SetUInt64Value(uint16 index, const uint64 &value)
bool HandleLearnAllCraftsCommand(const char *args)
void UseDoorOrButton(uint32 time_to_restore=0, bool alternative=false, Unit *user=NULL)
uint32 DurabilityRepairAll(bool cost, float discountMod, bool guildBank)
std::string secsToTimeString(uint32 timeInSecs, bool shortText, bool hoursOnly)
bool HandleItemMoveCommand(const char *args)
void InitPetCreateSpells()
const char * GetName() const
ReputationMgr & GetReputationMgr()
Player * getSelectedPlayer()
uint32 GetLatency() const
uint32 getClassMask() const
void Respawn(bool force=false)
uint64 GetPetGUID() const
bool HandleWpShowCommand(const char *args)
bool HandleGoCreatureCommand(const char *args)
Teleport the GM to the specified creature.
bool HandleTempGameObjectCommand(const char *args)
bool RewardHonor(Unit *victim, uint32 groupsize, float honor=-1, bool pvptoken=false)
void RemoveGameObject(GameObject *gameObj, bool del)
CreatureInfo const * GetCreatureTemplate() const
void SetPhaseMask(uint32 newPhaseMask, bool update) override
bool HandleTitlesAddCommand(const char *args)
virtual const char * GetOregonString(int32 entry) const
#define _CONCAT3_(A, B, C)
ACE_Refcounted_Auto_Ptr< QueryResult, ACE_Null_Mutex > QueryResult_AutoPtr
std::set< uint16 > ActiveEvents
bool HandleLookupPlayerEmailCommand(const char *args)
static bool IsValidMapCoord(uint32 mapid, float x, float y)
bool HandleGoObjectCommand(const char *args)
virtual void UpdateObjectVisibility(bool forced=true)
bool HandleTargetObjectCommand(const char *args)
void SetFaction(uint32 faction)
bool HandleDelVendorItemCommand(const char *args)
DBCStorage< FactionEntry > sFactionStore(FactionEntryfmt)
void SetFloatValue(uint16 index, float value)
bool HandleWpAddCommand(const char *args)
bool Create(uint32 guidlow, uint32 name_id, Map *map, uint32 phaseMask, float x, float y, float z, float ang, float rotation0, float rotation1, float rotation2, float rotation3, uint32 animprogress, GOState go_state, uint32 ArtKit=0)
void SwapItem(uint16 src, uint16 dst)
std::vector< GameEventData > GameEventDataMap
ReputationRank GetRank(FactionEntry const *factionEntry) const
bool HandleAddVendorItemCommand(const char *args)
void SetSkill(uint32 id, uint16 currVal, uint16 maxVal)
bool HasTitle(uint32 bitIndex)
void RemoveCorpse(bool setSpawnTime=true)
bool HandleMoveObjectCommand(const char *args)
bool HandleChangeLevelCommand(const char *args)
void HandleEmoteCommand(uint32 anim_id)
bool HandleGameObjectCommand(const char *args)
static Unit * GetUnit(WorldObject const &, uint64 guid)
std::map< RepListID, FactionState > FactionStateList
void DestroyForNearbyPlayers()
void SetLevel(uint32 lvl)
const int32 & GetInt32Value(uint16 index) const
WorldSession * GetSession() const
bool HandleGoTriggerCommand(const char *args)
bool HandlePetUnlearnCommand(const char *args)
bool HandleTempAddSpwCommand(const char *args)
DatabaseType CharacterDatabase
Accessor to the character database.
void uint32 GetSecurity() const
bool HandleEventStopCommand(const char *args)
void SetHealth(uint32 val)
bool HandleEventInfoCommand(const char *args)
float GetPositionX() const
void MovementExpired(bool reset=true)
void removeSpell(uint16 spell_id)
GameObject * GetGameObject(uint64 guid)
despawns instantly after death
CreatureDataAddon const * GetCreatureAddon() const
bool SetReputation(FactionEntry const *factionEntry, int32 standing)
char * extractKeyFromLink(char *text, char const *linkType, char **something1=NULL)
bool HandleCreatePetCommand(const char *args)
void SetRespawnDelay(uint32 delay)
virtual bool needReportToTarget(Player *chr) const