| 1 | /* |
|---|
| 2 | * ArcEmu MMORPG Server |
|---|
| 3 | * Copyright (C) 2005-2007 Ascent Team <http://www.ascentemu.com/> |
|---|
| 4 | * Copyright (C) 2008-2010 <http://www.ArcEmu.org/> |
|---|
| 5 | * |
|---|
| 6 | * This program is free software: you can redistribute it and/or modify |
|---|
| 7 | * it under the terms of the GNU Affero General Public License as published by |
|---|
| 8 | * the Free Software Foundation, either version 3 of the License, or |
|---|
| 9 | * 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 Affero General Public License for more details. |
|---|
| 15 | * |
|---|
| 16 | * You should have received a copy of the GNU Affero General Public License |
|---|
| 17 | * along with this program. If not, see <http://www.gnu.org/licenses/>. |
|---|
| 18 | * |
|---|
| 19 | */ |
|---|
| 20 | |
|---|
| 21 | ///////////////////////////////////////////////// |
|---|
| 22 | // GM Chat Commands |
|---|
| 23 | // |
|---|
| 24 | |
|---|
| 25 | #include "StdAfx.h" |
|---|
| 26 | |
|---|
| 27 | uint16 GetItemIDFromLink(const char* itemlink, uint32* itemid) |
|---|
| 28 | { |
|---|
| 29 | if(itemlink== NULL) |
|---|
| 30 | { |
|---|
| 31 | *itemid = 0; |
|---|
| 32 | return 0; |
|---|
| 33 | } |
|---|
| 34 | uint16 slen = (uint16)strlen(itemlink); |
|---|
| 35 | |
|---|
| 36 | const char* ptr = strstr(itemlink, "|Hitem:"); |
|---|
| 37 | if(ptr == NULL) |
|---|
| 38 | { |
|---|
| 39 | *itemid = 0; |
|---|
| 40 | return slen; |
|---|
| 41 | } |
|---|
| 42 | |
|---|
| 43 | ptr += 7; // item id is just past "|Hitem:" (7 bytes) |
|---|
| 44 | *itemid = atoi(ptr); |
|---|
| 45 | |
|---|
| 46 | ptr = strstr(itemlink, "|r"); // the end of the item link |
|---|
| 47 | if(ptr == NULL) // item link was invalid |
|---|
| 48 | { |
|---|
| 49 | *itemid = 0; |
|---|
| 50 | return slen; |
|---|
| 51 | } |
|---|
| 52 | |
|---|
| 53 | ptr += 2; |
|---|
| 54 | return (ptr-itemlink) & 0x0000ffff; |
|---|
| 55 | } |
|---|
| 56 | |
|---|
| 57 | bool ChatHandler::HandleAnnounceCommand(const char* args, WorldSession *m_session) |
|---|
| 58 | { |
|---|
| 59 | if( !*args || strlen(args) < 4 || strchr(args, '%')) |
|---|
| 60 | { |
|---|
| 61 | m_session->SystemMessage("Announces cannot contain the %% character and must be at least 4 characters."); |
|---|
| 62 | return true; |
|---|
| 63 | } |
|---|
| 64 | |
|---|
| 65 | char msg[1024]; |
|---|
| 66 | string input2; |
|---|
| 67 | input2 = sWorld.ann_tagcolor; |
|---|
| 68 | input2 += "["; |
|---|
| 69 | input2 += sWorld.announce_tag; |
|---|
| 70 | input2 += "]"; |
|---|
| 71 | input2 += sWorld.ann_gmtagcolor; |
|---|
| 72 | if(sWorld.GMAdminTag) |
|---|
| 73 | { |
|---|
| 74 | if(m_session->CanUseCommand('z')) input2+="<Admin>"; |
|---|
| 75 | else if(m_session->GetPermissionCount()) input2+="<GM>"; |
|---|
| 76 | } |
|---|
| 77 | if(sWorld.NameinAnnounce) |
|---|
| 78 | { |
|---|
| 79 | input2+="|r"+sWorld.ann_namecolor+"|Hplayer:"; |
|---|
| 80 | input2+=m_session->GetPlayer()->GetName(); |
|---|
| 81 | input2+="|h["; |
|---|
| 82 | input2+=m_session->GetPlayer()->GetName(); |
|---|
| 83 | input2+="]|h:|r "+sWorld.ann_msgcolor; |
|---|
| 84 | } |
|---|
| 85 | else if(!sWorld.NameinAnnounce) {input2+= ": "; input2+= sWorld.ann_msgcolor;} |
|---|
| 86 | snprintf((char*)msg, 1024, "%s%s", input2.c_str(), args); |
|---|
| 87 | sWorld.SendWorldText(msg); // send message |
|---|
| 88 | sGMLog.writefromsession(m_session, "used announce command, [%s]", args); |
|---|
| 89 | return true; |
|---|
| 90 | } |
|---|
| 91 | |
|---|
| 92 | bool ChatHandler::HandleGMAnnounceCommand(const char* args, WorldSession *m_session) |
|---|
| 93 | { |
|---|
| 94 | if(!*args) |
|---|
| 95 | { |
|---|
| 96 | printf("HandleGMAnnounceCommand !args = failed\n"); |
|---|
| 97 | return false; |
|---|
| 98 | } |
|---|
| 99 | |
|---|
| 100 | char GMAnnounce[1024]; |
|---|
| 101 | snprintf(GMAnnounce, 1024, MSG_COLOR_RED"[Team]"MSG_COLOR_GREEN" |Hplayer:%s|h[%s]|h:"MSG_COLOR_YELLOW" %s", m_session->GetPlayer()->GetName(), m_session->GetPlayer()->GetName(), args); |
|---|
| 102 | sWorld.SendGMWorldText(GMAnnounce); |
|---|
| 103 | sGMLog.writefromsession(m_session, "used team announce command, [%s]", args); |
|---|
| 104 | return true; |
|---|
| 105 | } |
|---|
| 106 | |
|---|
| 107 | bool ChatHandler::HandleWAnnounceCommand(const char* args, WorldSession *m_session) |
|---|
| 108 | { |
|---|
| 109 | if(!*args) |
|---|
| 110 | return false; |
|---|
| 111 | |
|---|
| 112 | char pAnnounce[1024]; |
|---|
| 113 | string input3; |
|---|
| 114 | input3 = sWorld.ann_tagcolor; |
|---|
| 115 | input3 += "["; |
|---|
| 116 | input3 += sWorld.announce_tag; |
|---|
| 117 | input3 += "]"; |
|---|
| 118 | input3 += sWorld.ann_gmtagcolor; |
|---|
| 119 | if(sWorld.GMAdminTag) |
|---|
| 120 | { |
|---|
| 121 | if(m_session->CanUseCommand('z')) input3+="<Admin>"; |
|---|
| 122 | else if(m_session->GetPermissionCount()) input3+="<GM>"; |
|---|
| 123 | } |
|---|
| 124 | if(sWorld.NameinWAnnounce) |
|---|
| 125 | { |
|---|
| 126 | input3+="|r"+sWorld.ann_namecolor+"["; |
|---|
| 127 | input3+=m_session->GetPlayer()->GetName(); |
|---|
| 128 | input3+="]:|r "+sWorld.ann_msgcolor; |
|---|
| 129 | } |
|---|
| 130 | else if(!sWorld.NameinWAnnounce) {input3+= ": "; input3+= sWorld.ann_msgcolor;} |
|---|
| 131 | snprintf((char*)pAnnounce, 1024, "%s%s", input3.c_str(), args); |
|---|
| 132 | |
|---|
| 133 | sWorld.SendWorldWideScreenText(pAnnounce); // send message |
|---|
| 134 | sGMLog.writefromsession(m_session, "used wannounce command [%s]", args); |
|---|
| 135 | return true; |
|---|
| 136 | } |
|---|
| 137 | |
|---|
| 138 | bool ChatHandler::HandleGMOnCommand(const char* args, WorldSession *m_session) |
|---|
| 139 | { |
|---|
| 140 | GreenSystemMessage(m_session, "Setting GM Flag on yourself."); |
|---|
| 141 | |
|---|
| 142 | Player * _player = m_session->GetPlayer(); |
|---|
| 143 | if(_player->bGMTagOn) |
|---|
| 144 | RedSystemMessage(m_session, "GM Flag is already set on. Use .gm off to disable it."); |
|---|
| 145 | else |
|---|
| 146 | { |
|---|
| 147 | _player->bGMTagOn = true; |
|---|
| 148 | _player->SetFlag(PLAYER_FLAGS, PLAYER_FLAG_GM); // <GM> |
|---|
| 149 | |
|---|
| 150 | _player->SetFaction( 35 ); |
|---|
| 151 | _player->RemovePvPFlag(); |
|---|
| 152 | |
|---|
| 153 | BlueSystemMessage(m_session, "GM flag set. It will now appear above your name and in chat messages until you use .gm off."); |
|---|
| 154 | |
|---|
| 155 | _player->UpdateVisibility(); |
|---|
| 156 | } |
|---|
| 157 | |
|---|
| 158 | return true; |
|---|
| 159 | } |
|---|
| 160 | |
|---|
| 161 | |
|---|
| 162 | bool ChatHandler::HandleGMOffCommand(const char* args, WorldSession *m_session) |
|---|
| 163 | { |
|---|
| 164 | |
|---|
| 165 | GreenSystemMessage(m_session, "Unsetting GM Flag on yourself..."); |
|---|
| 166 | |
|---|
| 167 | Player * _player = m_session->GetPlayer(); |
|---|
| 168 | if(!_player->bGMTagOn) |
|---|
| 169 | RedSystemMessage(m_session, "GM Flag not set. Use .gm on to enable it."); |
|---|
| 170 | else |
|---|
| 171 | { |
|---|
| 172 | _player->bGMTagOn = false; |
|---|
| 173 | _player->RemoveFlag(PLAYER_FLAGS, PLAYER_FLAG_GM); // <GM> |
|---|
| 174 | |
|---|
| 175 | _player->SetFaction( _player->GetInitialFactionId() ); |
|---|
| 176 | _player->UpdatePvPArea(); |
|---|
| 177 | |
|---|
| 178 | BlueSystemMessage(m_session, "GM Flag Removed. <GM> Will no longer show in chat messages or above your name."); |
|---|
| 179 | |
|---|
| 180 | _player->UpdateVisibility(); |
|---|
| 181 | } |
|---|
| 182 | |
|---|
| 183 | return true; |
|---|
| 184 | } |
|---|
| 185 | |
|---|
| 186 | |
|---|
| 187 | bool ChatHandler::HandleGPSCommand(const char* args, WorldSession *m_session) |
|---|
| 188 | { |
|---|
| 189 | Object *obj; |
|---|
| 190 | |
|---|
| 191 | uint64 guid = m_session->GetPlayer()->GetSelection(); |
|---|
| 192 | if (guid != 0) |
|---|
| 193 | { |
|---|
| 194 | if((obj = m_session->GetPlayer()->GetMapMgr()->GetUnit(guid)) == 0) |
|---|
| 195 | { |
|---|
| 196 | SystemMessage(m_session, "You should select a character or a creature."); |
|---|
| 197 | return true; |
|---|
| 198 | } |
|---|
| 199 | } |
|---|
| 200 | else |
|---|
| 201 | obj = (Object*)m_session->GetPlayer(); |
|---|
| 202 | |
|---|
| 203 | char buf[328]; |
|---|
| 204 | AreaTable * at = dbcArea.LookupEntryForced(obj->GetMapMgr()->GetAreaID(obj->GetPositionX(), obj->GetPositionY())); |
|---|
| 205 | if(!at) |
|---|
| 206 | { |
|---|
| 207 | snprintf((char*)buf, 328, "|cff00ff00Current Position: |cffffffffMap: |cff00ff00%d |cffffffffX: |cff00ff00%f |cffffffffY: |cff00ff00%f |cffffffffZ: |cff00ff00%f |cffffffffOrientation: |cff00ff00%f|r", |
|---|
| 208 | (unsigned int)obj->GetMapId(), obj->GetPositionX(), obj->GetPositionY(), obj->GetPositionZ()); |
|---|
| 209 | SystemMessage(m_session, buf); |
|---|
| 210 | return true; |
|---|
| 211 | } |
|---|
| 212 | |
|---|
| 213 | snprintf((char*)buf, 328, "|cff00ff00Current Position: |cffffffffMap: |cff00ff00%d |cffffffffZone: |cff00ff00%u |cffffffffArea: |cff00ff00%u |cffffffffX: |cff00ff00%f |cffffffffY: |cff00ff00%f |cffffffffZ: |cff00ff00%f |cffffffffOrientation: |cff00ff00%f |cffffffffArea Name: |cff00ff00%s |r", |
|---|
| 214 | (unsigned int)obj->GetMapId(), at->ZoneId,at->AreaId, obj->GetPositionX(), obj->GetPositionY(), obj->GetPositionZ(), obj->GetOrientation(),at->name); |
|---|
| 215 | |
|---|
| 216 | |
|---|
| 217 | SystemMessage(m_session, buf); |
|---|
| 218 | // ".gps 1" will save gps info to file logs/gps.log - This probably isn't very multithread safe so don't have many gms spamming it! |
|---|
| 219 | if(args != NULL && *args=='1') |
|---|
| 220 | { |
|---|
| 221 | FILE* gpslog = fopen(FormatOutputString("logs","gps",false).c_str(), "at"); |
|---|
| 222 | if(gpslog) |
|---|
| 223 | { |
|---|
| 224 | fprintf(gpslog, "%d, %u, %u, %f, %f, %f, %f, \'%s\'", |
|---|
| 225 | (unsigned int)obj->GetMapId(), at->ZoneId,at->AreaId, obj->GetPositionX(), obj->GetPositionY(), obj->GetPositionZ(), obj->GetOrientation(),at->name); |
|---|
| 226 | // ".gps 1 comment" will save comment after the gps data |
|---|
| 227 | if(*(args+1) == ' ') |
|---|
| 228 | fprintf(gpslog,",%s\n",args+2); |
|---|
| 229 | else |
|---|
| 230 | fprintf(gpslog,"\n"); |
|---|
| 231 | fclose(gpslog); |
|---|
| 232 | } |
|---|
| 233 | } |
|---|
| 234 | return true; |
|---|
| 235 | } |
|---|
| 236 | |
|---|
| 237 | |
|---|
| 238 | bool ChatHandler::HandleKickCommand(const char* args, WorldSession *m_session) |
|---|
| 239 | { |
|---|
| 240 | |
|---|
| 241 | if(!*args) |
|---|
| 242 | return false; |
|---|
| 243 | char *pname = strtok((char*)args, " "); |
|---|
| 244 | if(!pname) |
|---|
| 245 | { |
|---|
| 246 | RedSystemMessage(m_session, "No name specified."); |
|---|
| 247 | return true; |
|---|
| 248 | } |
|---|
| 249 | Player *chr = objmgr.GetPlayer((const char*)pname, false); |
|---|
| 250 | if (chr) |
|---|
| 251 | { |
|---|
| 252 | char *reason = strtok(NULL, "\n"); |
|---|
| 253 | std::string kickreason = "No reason"; |
|---|
| 254 | if(reason) |
|---|
| 255 | kickreason = reason; |
|---|
| 256 | |
|---|
| 257 | BlueSystemMessage(m_session, "Attempting to kick %s from the server for \'%s\'.", chr->GetName(), kickreason.c_str()); |
|---|
| 258 | sGMLog.writefromsession(m_session, "Kicked player %s from the server for %s", chr->GetName(), kickreason.c_str()); |
|---|
| 259 | if(!m_session->CanUseCommand('z') && chr->GetSession()->CanUseCommand('z')) |
|---|
| 260 | { |
|---|
| 261 | RedSystemMessage(m_session, "You cannot kick %s, a GM whose permissions outrank yours.", chr->GetName()); |
|---|
| 262 | return true; |
|---|
| 263 | } |
|---|
| 264 | /*if(m_session->GetSecurity() < chr->GetSession()->GetSecurity()) |
|---|
| 265 | { |
|---|
| 266 | SystemMessage(m_session, "You cannot kick %s, as he is a higher GM level than you.", chr->GetName()); |
|---|
| 267 | return true; |
|---|
| 268 | }*/ // we might have to re-work this |
|---|
| 269 | |
|---|
| 270 | char msg[200]; |
|---|
| 271 | snprintf(msg, 200, "%sGM: %s was kicked from the server by %s. Reason: %s", MSG_COLOR_RED, chr->GetName(), m_session->GetPlayer()->GetName(), kickreason.c_str()); |
|---|
| 272 | sWorld.SendWorldText(msg, NULL); |
|---|
| 273 | //sWorld.SendIRCMessage(msg); |
|---|
| 274 | SystemMessageToPlr(chr, "You are being kicked from the server by %s. Reason: %s", m_session->GetPlayer()->GetName(), kickreason.c_str()); |
|---|
| 275 | |
|---|
| 276 | chr->Kick(6000); |
|---|
| 277 | |
|---|
| 278 | return true; |
|---|
| 279 | } |
|---|
| 280 | else |
|---|
| 281 | { |
|---|
| 282 | RedSystemMessage(m_session, "Player is not online at the moment."); |
|---|
| 283 | return true; |
|---|
| 284 | } |
|---|
| 285 | } |
|---|
| 286 | |
|---|
| 287 | bool ChatHandler::HandleAddInvItemCommand(const char *args, WorldSession *m_session) |
|---|
| 288 | { |
|---|
| 289 | uint32 itemid, count=1; |
|---|
| 290 | int32 randomprop= 0; |
|---|
| 291 | int32 numadded = 0; |
|---|
| 292 | |
|---|
| 293 | if(strlen(args) < 1) |
|---|
| 294 | { |
|---|
| 295 | return false; |
|---|
| 296 | } |
|---|
| 297 | |
|---|
| 298 | if(sscanf(args, "%u %u %d", &itemid, &count, &randomprop) < 1) |
|---|
| 299 | { |
|---|
| 300 | // check for item link |
|---|
| 301 | uint16 ofs = GetItemIDFromLink(args, &itemid); |
|---|
| 302 | if(itemid == 0) |
|---|
| 303 | return false; |
|---|
| 304 | sscanf(args+ofs,"%u %d", &count, &randomprop); // these may be empty |
|---|
| 305 | } |
|---|
| 306 | |
|---|
| 307 | Player * chr = getSelectedChar( m_session, false ); |
|---|
| 308 | if ( chr == NULL ) |
|---|
| 309 | chr = m_session->GetPlayer(); |
|---|
| 310 | |
|---|
| 311 | ItemPrototype* it = ItemPrototypeStorage.LookupEntry(itemid); |
|---|
| 312 | if(it) |
|---|
| 313 | { |
|---|
| 314 | numadded -= chr->GetItemInterface()->GetItemCount( itemid ); |
|---|
| 315 | bool result = false; |
|---|
| 316 | result = chr->GetItemInterface()->AddItemById( itemid, count, randomprop ); |
|---|
| 317 | numadded += chr->GetItemInterface()->GetItemCount( itemid ); |
|---|
| 318 | if( result == true ){ |
|---|
| 319 | if( count == 0 ){ |
|---|
| 320 | sGMLog.writefromsession(m_session, "used add item command, item id %u [%s], quantity %u, to %s", it->ItemId, it->Name1, numadded, chr->GetName()); |
|---|
| 321 | }else{ |
|---|
| 322 | sGMLog.writefromsession(m_session, "used add item command, item id %u [%s], quantity %u (only %lu added due to full inventory), to %s", it->ItemId, it->Name1, numadded, numadded, chr->GetName()); |
|---|
| 323 | } |
|---|
| 324 | |
|---|
| 325 | char messagetext[512]; |
|---|
| 326 | |
|---|
| 327 | snprintf(messagetext, 512, "Added item %s (id: %d), quantity %u, to %s's inventory.", GetItemLinkByProto(it, m_session->language).c_str(), (unsigned int)it->ItemId, numadded, chr->GetName()); |
|---|
| 328 | SystemMessage(m_session, messagetext); |
|---|
| 329 | //snprintf(messagetext, 128, "%s added item %d (%s) to your inventory.", m_session->GetPlayer()->GetName(), (unsigned int)itemid, it->Name1); |
|---|
| 330 | snprintf(messagetext, 512, "%s added item %s, quantity %u, to your inventory.", m_session->GetPlayer()->GetName(), GetItemLinkByProto(it, chr->GetSession()->language).c_str(), numadded); |
|---|
| 331 | |
|---|
| 332 | SystemMessageToPlr(chr, messagetext); |
|---|
| 333 | } |
|---|
| 334 | return true; |
|---|
| 335 | |
|---|
| 336 | } else{ |
|---|
| 337 | RedSystemMessage(m_session, "Item %d is not a valid item!", itemid); |
|---|
| 338 | return true; |
|---|
| 339 | } |
|---|
| 340 | } |
|---|
| 341 | |
|---|
| 342 | bool ChatHandler::HandleSummonCommand(const char* args, WorldSession *m_session) |
|---|
| 343 | { |
|---|
| 344 | if(!*args) |
|---|
| 345 | return false; |
|---|
| 346 | |
|---|
| 347 | // Summon Blocking |
|---|
| 348 | if (!stricmp(args, "on")) |
|---|
| 349 | { |
|---|
| 350 | if(m_session->GetPlayer()->IsSummonDisabled()) |
|---|
| 351 | { |
|---|
| 352 | BlueSystemMessage(m_session, "Summon blocking is already enabled"); |
|---|
| 353 | } |
|---|
| 354 | else |
|---|
| 355 | { |
|---|
| 356 | m_session->GetPlayer()->DisableSummon(true); |
|---|
| 357 | GreenSystemMessage(m_session, "Summon blocking is now enabled"); |
|---|
| 358 | } |
|---|
| 359 | return true; |
|---|
| 360 | } |
|---|
| 361 | else if (!stricmp(args, "off")) |
|---|
| 362 | { |
|---|
| 363 | if(m_session->GetPlayer()->IsSummonDisabled()) |
|---|
| 364 | { |
|---|
| 365 | m_session->GetPlayer()->DisableSummon(false); |
|---|
| 366 | GreenSystemMessage(m_session, "Summon blocking is now disabled"); |
|---|
| 367 | } |
|---|
| 368 | else |
|---|
| 369 | { |
|---|
| 370 | BlueSystemMessage(m_session, "Summon blocking is already disabled"); |
|---|
| 371 | } |
|---|
| 372 | return true; |
|---|
| 373 | } |
|---|
| 374 | |
|---|
| 375 | Player *chr = objmgr.GetPlayer(args, false); |
|---|
| 376 | if (chr) |
|---|
| 377 | { |
|---|
| 378 | // send message to user |
|---|
| 379 | char buf[256]; |
|---|
| 380 | char buf0[256]; |
|---|
| 381 | |
|---|
| 382 | if (!m_session->CanUseCommand('z') && chr->IsSummonDisabled()) |
|---|
| 383 | { |
|---|
| 384 | snprintf((char*)buf,256, "%s has blocked other GMs from summoning them.", chr->GetName()); |
|---|
| 385 | SystemMessage(m_session, buf); |
|---|
| 386 | return true; |
|---|
| 387 | } |
|---|
| 388 | |
|---|
| 389 | if (chr->IsBeingTeleported() == true) |
|---|
| 390 | { |
|---|
| 391 | snprintf((char*)buf,256, "%s is already being teleported.", chr->GetName()); |
|---|
| 392 | SystemMessage(m_session, buf); |
|---|
| 393 | return true; |
|---|
| 394 | } |
|---|
| 395 | snprintf((char*)buf,256, "You are summoning %s.", chr->GetName()); |
|---|
| 396 | SystemMessage(m_session, buf); |
|---|
| 397 | |
|---|
| 398 | // Don't summon the dead, lol, I see dead people. :P |
|---|
| 399 | // If you do, we better bring them back to life |
|---|
| 400 | if (chr->getDeathState() == 1) // Just died |
|---|
| 401 | chr->RemoteRevive(); |
|---|
| 402 | if (chr->getDeathState() != 0) // Not alive |
|---|
| 403 | chr->ResurrectPlayer(); |
|---|
| 404 | |
|---|
| 405 | if (!m_session->GetPlayer()->m_isGmInvisible) |
|---|
| 406 | { |
|---|
| 407 | // send message to player |
|---|
| 408 | snprintf((char*)buf0,256, "You are being summoned by %s.", m_session->GetPlayer()->GetName()); |
|---|
| 409 | SystemMessageToPlr(chr, buf0); |
|---|
| 410 | } |
|---|
| 411 | |
|---|
| 412 | Player * plr = m_session->GetPlayer(); |
|---|
| 413 | |
|---|
| 414 | if (plr->GetMapMgr()==chr->GetMapMgr()) |
|---|
| 415 | chr->_Relocate(plr->GetMapId(),plr->GetPosition(),false,false,plr->GetInstanceID()); |
|---|
| 416 | else |
|---|
| 417 | { |
|---|
| 418 | sEventMgr.AddEvent(chr,&Player::EventPortToGM,plr,0,1,1, EVENT_FLAG_DO_NOT_EXECUTE_IN_WORLD_CONTEXT); |
|---|
| 419 | } |
|---|
| 420 | } |
|---|
| 421 | else |
|---|
| 422 | { |
|---|
| 423 | PlayerInfo * pinfo = objmgr.GetPlayerInfoByName(args); |
|---|
| 424 | if (!pinfo) |
|---|
| 425 | { |
|---|
| 426 | char buf[256]; |
|---|
| 427 | snprintf((char*)buf,256,"Player (%s) does not exist.", args); |
|---|
| 428 | SystemMessage(m_session, buf); |
|---|
| 429 | return true; |
|---|
| 430 | } |
|---|
| 431 | else |
|---|
| 432 | { |
|---|
| 433 | Player * pPlayer = m_session->GetPlayer(); |
|---|
| 434 | char query[512]; |
|---|
| 435 | snprintf((char*) &query,512, "UPDATE characters SET mapId = %u, positionX = %f, positionY = %f, positionZ = %f, zoneId = %u WHERE guid = %u;", pPlayer->GetMapId(), pPlayer->GetPositionX(), pPlayer->GetPositionY(), pPlayer->GetPositionZ(), pPlayer->GetZoneId(), pinfo->guid); |
|---|
| 436 | CharacterDatabase.Execute(query); |
|---|
| 437 | char buf[256]; |
|---|
| 438 | snprintf((char*)buf,256,"(Offline) %s has been summoned.", pinfo->name); |
|---|
| 439 | SystemMessage(m_session, buf); |
|---|
| 440 | return true; |
|---|
| 441 | } |
|---|
| 442 | } |
|---|
| 443 | |
|---|
| 444 | sGMLog.writefromsession(m_session, "summoned %s on map %u, %f %f %f", args, m_session->GetPlayer()->GetMapId(),m_session->GetPlayer()->GetPositionX(),m_session->GetPlayer()->GetPositionY(),m_session->GetPlayer()->GetPositionZ()); |
|---|
| 445 | return true; |
|---|
| 446 | } |
|---|
| 447 | |
|---|
| 448 | |
|---|
| 449 | bool ChatHandler::HandleAppearCommand(const char* args, WorldSession *m_session) |
|---|
| 450 | { |
|---|
| 451 | if(!*args) |
|---|
| 452 | return false; |
|---|
| 453 | |
|---|
| 454 | // Appear Blocking |
|---|
| 455 | if (!stricmp(args, "on")) |
|---|
| 456 | { |
|---|
| 457 | if(m_session->GetPlayer()->IsAppearDisabled()) |
|---|
| 458 | { |
|---|
| 459 | BlueSystemMessage(m_session, "Appear blocking is already enabled"); |
|---|
| 460 | } |
|---|
| 461 | else |
|---|
| 462 | { |
|---|
| 463 | m_session->GetPlayer()->DisableAppear(true); |
|---|
| 464 | GreenSystemMessage(m_session, "Appear blocking is now enabled"); |
|---|
| 465 | } |
|---|
| 466 | return true; |
|---|
| 467 | } |
|---|
| 468 | else if (!stricmp(args, "off")) |
|---|
| 469 | { |
|---|
| 470 | if(m_session->GetPlayer()->IsAppearDisabled()) |
|---|
| 471 | { |
|---|
| 472 | m_session->GetPlayer()->DisableAppear(false); |
|---|
| 473 | GreenSystemMessage(m_session, "Appear blocking is now disabled"); |
|---|
| 474 | } |
|---|
| 475 | else |
|---|
| 476 | { |
|---|
| 477 | BlueSystemMessage(m_session, "Appear blocking is already disabled"); |
|---|
| 478 | } |
|---|
| 479 | return true; |
|---|
| 480 | } |
|---|
| 481 | |
|---|
| 482 | Player *chr = objmgr.GetPlayer(args, false); |
|---|
| 483 | if (chr) |
|---|
| 484 | { |
|---|
| 485 | char buf[256]; |
|---|
| 486 | |
|---|
| 487 | if (!m_session->CanUseCommand('z') && chr->IsAppearDisabled()) |
|---|
| 488 | { |
|---|
| 489 | snprintf((char*)buf,256, "%s has blocked other GMs from appearing to them.", chr->GetName()); |
|---|
| 490 | SystemMessage(m_session, buf); |
|---|
| 491 | return true; |
|---|
| 492 | } |
|---|
| 493 | |
|---|
| 494 | if (chr->IsBeingTeleported()) |
|---|
| 495 | { |
|---|
| 496 | snprintf((char*)buf,256, "%s is already being teleported.", chr->GetName()); |
|---|
| 497 | SystemMessage(m_session, buf); |
|---|
| 498 | return true; |
|---|
| 499 | } |
|---|
| 500 | snprintf((char*)buf,256, "Appearing at %s's location.", chr->GetName()); // -- europa |
|---|
| 501 | SystemMessage(m_session, buf); |
|---|
| 502 | |
|---|
| 503 | if (!m_session->GetPlayer()->m_isGmInvisible) |
|---|
| 504 | { |
|---|
| 505 | char buf0[256]; |
|---|
| 506 | snprintf((char*)buf0,256, "%s is appearing to your location.", m_session->GetPlayer()->GetName()); |
|---|
| 507 | SystemMessageToPlr(chr, buf0); |
|---|
| 508 | } |
|---|
| 509 | |
|---|
| 510 | //m_session->GetPlayer()->SafeTeleport(chr->GetMapId(), chr->GetInstanceID(), chr->GetPosition()); |
|---|
| 511 | //If the GM is on the same map as the player, use the normal safeteleport method |
|---|
| 512 | if ( m_session->GetPlayer()->GetMapId() == chr->GetMapId() && m_session->GetPlayer()->GetInstanceID() == chr->GetInstanceID() ) |
|---|
| 513 | m_session->GetPlayer()->SafeTeleport(chr->GetMapId(),chr->GetInstanceID(),chr->GetPosition()); |
|---|
| 514 | else |
|---|
| 515 | m_session->GetPlayer()->SafeTeleport(chr->GetMapMgr(), chr->GetPosition()); |
|---|
| 516 | //The player and GM are not on the same map. We use this method so we can port to BG's (Above method doesn't support them) |
|---|
| 517 | } |
|---|
| 518 | else |
|---|
| 519 | { |
|---|
| 520 | char buf[256]; |
|---|
| 521 | snprintf((char*)buf,256, "Player (%s) does not exist or is not logged in.", args); |
|---|
| 522 | SystemMessage(m_session, buf); |
|---|
| 523 | } |
|---|
| 524 | |
|---|
| 525 | return true; |
|---|
| 526 | } |
|---|
| 527 | |
|---|
| 528 | bool ChatHandler::HandleTaxiCheatCommand(const char* args, WorldSession *m_session) |
|---|
| 529 | { |
|---|
| 530 | if (!*args) |
|---|
| 531 | return false; |
|---|
| 532 | |
|---|
| 533 | Player *chr = getSelectedChar(m_session); |
|---|
| 534 | if (chr == NULL) |
|---|
| 535 | return true; |
|---|
| 536 | |
|---|
| 537 | if(stricmp(args, "on") == 0) |
|---|
| 538 | { |
|---|
| 539 | GreenSystemMessage(m_session, "%s has all taxi nodes now.", chr->GetName()); |
|---|
| 540 | SystemMessage(m_session, "%s has given you all taxi nodes.", m_session->GetPlayer()->GetName()); |
|---|
| 541 | } |
|---|
| 542 | else if(stricmp(args, "off") == 0) |
|---|
| 543 | { |
|---|
| 544 | GreenSystemMessage(m_session, "%s has no more taxi nodes now.", chr->GetName()); |
|---|
| 545 | SystemMessage(chr->GetSession(), "%s has deleted all your taxi nodes.", m_session->GetPlayer()->GetName()); |
|---|
| 546 | } |
|---|
| 547 | else |
|---|
| 548 | return false; |
|---|
| 549 | |
|---|
| 550 | for (uint8 i= 0; i<12; i++) |
|---|
| 551 | { |
|---|
| 552 | if(stricmp(args, "on") == 0) |
|---|
| 553 | { |
|---|
| 554 | chr->SetTaximask(i, 0xFFFFFFFF); |
|---|
| 555 | } |
|---|
| 556 | else if(stricmp(args, "off") == 0) |
|---|
| 557 | { |
|---|
| 558 | chr->SetTaximask(i, 0); |
|---|
| 559 | } |
|---|
| 560 | } |
|---|
| 561 | return true; |
|---|
| 562 | } |
|---|
| 563 | |
|---|
| 564 | bool ChatHandler::HandleModifySpeedCommand(const char* args, WorldSession *m_session) |
|---|
| 565 | { |
|---|
| 566 | WorldPacket data; |
|---|
| 567 | |
|---|
| 568 | if (!*args) |
|---|
| 569 | return false; |
|---|
| 570 | |
|---|
| 571 | float Speed = (float)atof((char*)args); |
|---|
| 572 | |
|---|
| 573 | if (Speed > 255 || Speed < 1) |
|---|
| 574 | { |
|---|
| 575 | RedSystemMessage(m_session, "Incorrect value. Range is 1..255"); |
|---|
| 576 | return true; |
|---|
| 577 | } |
|---|
| 578 | |
|---|
| 579 | Player *chr = getSelectedChar(m_session); |
|---|
| 580 | if( chr == NULL ) |
|---|
| 581 | return true; |
|---|
| 582 | |
|---|
| 583 | if ( chr!=m_session->GetPlayer() ) |
|---|
| 584 | sGMLog.writefromsession( m_session, "modified speed of %s to %2.2f.",chr->GetName(), Speed ); |
|---|
| 585 | |
|---|
| 586 | |
|---|
| 587 | char buf[256]; |
|---|
| 588 | |
|---|
| 589 | // send message to user |
|---|
| 590 | BlueSystemMessage(m_session, "You set the speed of %s to %2.2f.", chr->GetName(), Speed); |
|---|
| 591 | |
|---|
| 592 | // send message to player |
|---|
| 593 | snprintf((char*)buf,256, "%s set your speed to %2.2f.", m_session->GetPlayer()->GetName(), Speed); |
|---|
| 594 | SystemMessage(chr->GetSession(), buf); |
|---|
| 595 | |
|---|
| 596 | chr->SetPlayerSpeed(RUN, Speed); |
|---|
| 597 | chr->SetPlayerSpeed(SWIM, Speed); |
|---|
| 598 | chr->SetPlayerSpeed(RUNBACK, Speed / 2); // Backwards slower, it's more natural :P |
|---|
| 599 | chr->SetPlayerSpeed(FLY, Speed * 2); // Flying is faster :P |
|---|
| 600 | |
|---|
| 601 | return true; |
|---|
| 602 | } |
|---|
| 603 | |
|---|
| 604 | bool ChatHandler::HandleLearnSkillCommand(const char *args, WorldSession *m_session) |
|---|
| 605 | { |
|---|
| 606 | uint32 skill, min, max; |
|---|
| 607 | min = max = 1; |
|---|
| 608 | char *pSkill = strtok((char*)args, " "); |
|---|
| 609 | if(!pSkill) |
|---|
| 610 | return false; |
|---|
| 611 | else |
|---|
| 612 | skill = atol(pSkill); |
|---|
| 613 | |
|---|
| 614 | BlueSystemMessage(m_session, "Adding skill line %d", skill); |
|---|
| 615 | |
|---|
| 616 | char *pMin = strtok(NULL, " "); |
|---|
| 617 | if(pMin) |
|---|
| 618 | { |
|---|
| 619 | min = atol(pMin); |
|---|
| 620 | char *pMax = strtok(NULL, "\n"); |
|---|
| 621 | if(pMax) |
|---|
| 622 | max = atol(pMax); |
|---|
| 623 | } else { |
|---|
| 624 | return false; |
|---|
| 625 | } |
|---|
| 626 | |
|---|
| 627 | Player *plr = getSelectedChar(m_session, true); |
|---|
| 628 | if(!plr) return false; |
|---|
| 629 | if(plr->GetTypeId() != TYPEID_PLAYER) return false; |
|---|
| 630 | sGMLog.writefromsession(m_session, "used add skill of %u %u %u on %s", skill, min, max, plr->GetName()); |
|---|
| 631 | |
|---|
| 632 | plr->_AddSkillLine(skill, min, max); |
|---|
| 633 | |
|---|
| 634 | return true; |
|---|
| 635 | } |
|---|
| 636 | |
|---|
| 637 | bool ChatHandler::HandleModifySkillCommand(const char *args, WorldSession *m_session) |
|---|
| 638 | { |
|---|
| 639 | uint32 skill, min, max; |
|---|
| 640 | min = max = 1; |
|---|
| 641 | char *pSkill = strtok((char*)args, " "); |
|---|
| 642 | if(!pSkill) |
|---|
| 643 | return false; |
|---|
| 644 | else |
|---|
| 645 | skill = atol(pSkill); |
|---|
| 646 | |
|---|
| 647 | char *pMin = strtok(NULL, " "); |
|---|
| 648 | uint32 cnt = 0; |
|---|
| 649 | if(!pMin) |
|---|
| 650 | cnt = 1; |
|---|
| 651 | else |
|---|
| 652 | cnt = atol(pMin); |
|---|
| 653 | |
|---|
| 654 | skill = atol(pSkill); |
|---|
| 655 | |
|---|
| 656 | BlueSystemMessage(m_session, "Modifying skill line %d. Advancing %d times.", skill, cnt); |
|---|
| 657 | |
|---|
| 658 | Player *plr = getSelectedChar(m_session, true); |
|---|
| 659 | if(!plr) plr = m_session->GetPlayer(); |
|---|
| 660 | if(!plr) return false; |
|---|
| 661 | sGMLog.writefromsession(m_session, "used modify skill of %u %u on %s", skill, cnt,plr->GetName()); |
|---|
| 662 | |
|---|
| 663 | if(!plr->_HasSkillLine(skill)) |
|---|
| 664 | { |
|---|
| 665 | SystemMessage(m_session, "Does not have skill line, adding."); |
|---|
| 666 | plr->_AddSkillLine(skill, 1, 300); |
|---|
| 667 | } else { |
|---|
| 668 | plr->_AdvanceSkillLine(skill,cnt); |
|---|
| 669 | } |
|---|
| 670 | |
|---|
| 671 | return true; |
|---|
| 672 | } |
|---|
| 673 | |
|---|
| 674 | /// DGM: Get skill level command for getting information about a skill |
|---|
| 675 | bool ChatHandler::HandleGetSkillLevelCommand(const char *args, WorldSession *m_session) |
|---|
| 676 | { |
|---|
| 677 | uint32 skill = 0; |
|---|
| 678 | char *pSkill = strtok((char*)args, " "); |
|---|
| 679 | if(!pSkill) |
|---|
| 680 | return false; |
|---|
| 681 | else |
|---|
| 682 | skill = atol(pSkill); |
|---|
| 683 | |
|---|
| 684 | Player *plr = getSelectedChar(m_session, true); |
|---|
| 685 | if(!plr) return false; |
|---|
| 686 | |
|---|
| 687 | if(skill > SkillNameManager->maxskill) |
|---|
| 688 | { |
|---|
| 689 | BlueSystemMessage(m_session, "Skill: %u does not exists", skill); |
|---|
| 690 | return false; |
|---|
| 691 | } |
|---|
| 692 | |
|---|
| 693 | char * SkillName = SkillNameManager->SkillNames[skill]; |
|---|
| 694 | |
|---|
| 695 | if (SkillName== 0) |
|---|
| 696 | { |
|---|
| 697 | BlueSystemMessage(m_session, "Skill: %u does not exists", skill); |
|---|
| 698 | return false; |
|---|
| 699 | } |
|---|
| 700 | |
|---|
| 701 | if (!plr->_HasSkillLine(skill)) |
|---|
| 702 | { |
|---|
| 703 | BlueSystemMessage(m_session, "Player does not have %s skill.", SkillName); |
|---|
| 704 | return false; |
|---|
| 705 | } |
|---|
| 706 | |
|---|
| 707 | uint32 nobonus = plr->_GetSkillLineCurrent(skill,false); |
|---|
| 708 | uint32 bonus = plr->_GetSkillLineCurrent(skill,true) - nobonus; |
|---|
| 709 | uint32 max = plr->_GetSkillLineMax(skill); |
|---|
| 710 | |
|---|
| 711 | BlueSystemMessage(m_session, "Player's %s skill has level: %u maxlevel: %u. (+ %u bonus)", SkillName, nobonus, max, bonus); |
|---|
| 712 | return true; |
|---|
| 713 | } |
|---|
| 714 | |
|---|
| 715 | bool ChatHandler::HandleGetSkillsInfoCommand(const char *args, WorldSession *m_session) |
|---|
| 716 | { |
|---|
| 717 | Player *plr = getSelectedChar(m_session, true); |
|---|
| 718 | if(!plr) return false; |
|---|
| 719 | |
|---|
| 720 | uint32 nobonus = 0; |
|---|
| 721 | int32 bonus = 0; |
|---|
| 722 | uint32 max = 0; |
|---|
| 723 | |
|---|
| 724 | BlueSystemMessage(m_session, "Player: %s has skills", plr->GetName() ); |
|---|
| 725 | |
|---|
| 726 | for (uint32 SkillId = 0; SkillId <= SkillNameManager->maxskill; SkillId++) |
|---|
| 727 | { |
|---|
| 728 | if (plr->_HasSkillLine(SkillId)) |
|---|
| 729 | { |
|---|
| 730 | char * SkillName = SkillNameManager->SkillNames[SkillId]; |
|---|
| 731 | if (!SkillName) |
|---|
| 732 | { |
|---|
| 733 | RedSystemMessage(m_session, "Invalid skill: %u", SkillId); |
|---|
| 734 | continue; |
|---|
| 735 | } |
|---|
| 736 | |
|---|
| 737 | nobonus = plr->_GetSkillLineCurrent(SkillId,false); |
|---|
| 738 | bonus = plr->_GetSkillLineCurrent(SkillId,true) - nobonus; |
|---|
| 739 | max = plr->_GetSkillLineMax(SkillId); |
|---|
| 740 | |
|---|
| 741 | BlueSystemMessage(m_session, " %s: Value: %u, MaxValue: %u. (+ %d bonus)", SkillName, nobonus, max, bonus); |
|---|
| 742 | } |
|---|
| 743 | } |
|---|
| 744 | |
|---|
| 745 | return true; |
|---|
| 746 | } |
|---|
| 747 | |
|---|
| 748 | |
|---|
| 749 | bool ChatHandler::HandleRemoveSkillCommand(const char *args, WorldSession *m_session) |
|---|
| 750 | { |
|---|
| 751 | uint32 skill = 0; |
|---|
| 752 | char *pSkill = strtok((char*)args, " "); |
|---|
| 753 | if(!pSkill) |
|---|
| 754 | return false; |
|---|
| 755 | else |
|---|
| 756 | skill = atol(pSkill); |
|---|
| 757 | BlueSystemMessage(m_session, "Removing skill line %d", skill); |
|---|
| 758 | |
|---|
| 759 | Player *plr = getSelectedChar(m_session, true); |
|---|
| 760 | if(plr && plr->_HasSkillLine(skill) ) //fix bug; removing skill twice will mess up skills |
|---|
| 761 | { |
|---|
| 762 | plr->_RemoveSkillLine(skill); |
|---|
| 763 | sGMLog.writefromsession(m_session, "used remove skill of %u on %s", skill, plr->GetName()); |
|---|
| 764 | SystemMessageToPlr(plr, "%s removed skill line %d from you. ", m_session->GetPlayer()->GetName(), skill); |
|---|
| 765 | } |
|---|
| 766 | else |
|---|
| 767 | { |
|---|
| 768 | BlueSystemMessage(m_session, "Player doesn't have skill line %d", skill); |
|---|
| 769 | } |
|---|
| 770 | return true; |
|---|
| 771 | } |
|---|
| 772 | |
|---|
| 773 | |
|---|
| 774 | bool ChatHandler::HandleEmoteCommand(const char* args, WorldSession *m_session) |
|---|
| 775 | { |
|---|
| 776 | uint32 emote = atoi((char*)args); |
|---|
| 777 | Unit* target = this->getSelectedCreature(m_session); |
|---|
| 778 | if(!target) return false; |
|---|
| 779 | if(target) target->SetEmoteState(emote); |
|---|
| 780 | |
|---|
| 781 | return true; |
|---|
| 782 | } |
|---|
| 783 | |
|---|
| 784 | bool ChatHandler::HandleModifyGoldCommand(const char* args, WorldSession *m_session) |
|---|
| 785 | { |
|---|
| 786 | // WorldPacket data; |
|---|
| 787 | |
|---|
| 788 | if ( *args == 0 ) |
|---|
| 789 | return false; |
|---|
| 790 | |
|---|
| 791 | Player *chr = getSelectedChar( m_session, true ); |
|---|
| 792 | if( chr == NULL ) return true; |
|---|
| 793 | |
|---|
| 794 | int32 total = atoi( (char*)args ); |
|---|
| 795 | |
|---|
| 796 | // gold = total / 10000; |
|---|
| 797 | // silver = (total / 100) % 100; |
|---|
| 798 | // copper = total % 100; |
|---|
| 799 | uint32 gold = (uint32) floor( (float)int32abs( total ) / 10000.0f ); |
|---|
| 800 | uint32 silver = (uint32) floor( ((float)int32abs( total ) / 100.0f) ) % 100; |
|---|
| 801 | uint32 copper = int32abs2uint32( total ) % 100; |
|---|
| 802 | |
|---|
| 803 | sGMLog.writefromsession( m_session, "used modify gold on %s, gold: %d", chr->GetName(), total ); |
|---|
| 804 | |
|---|
| 805 | int32 newgold = chr->GetGold() + total; |
|---|
| 806 | |
|---|
| 807 | if(newgold < 0) |
|---|
| 808 | { |
|---|
| 809 | BlueSystemMessage( m_session, "Taking all gold from %s's backpack...", chr->GetName() ); |
|---|
| 810 | GreenSystemMessageToPlr(chr, "%s took the all gold from your backpack.", m_session->GetPlayer()->GetName()); |
|---|
| 811 | newgold = 0; |
|---|
| 812 | } |
|---|
| 813 | else |
|---|
| 814 | { |
|---|
| 815 | if(total >= 0) { |
|---|
| 816 | BlueSystemMessage( m_session, |
|---|
| 817 | "Adding %u gold, %u silver, %u copper to %s's backpack...", |
|---|
| 818 | gold, silver, copper, |
|---|
| 819 | chr->GetName() ); |
|---|
| 820 | |
|---|
| 821 | GreenSystemMessageToPlr( chr, "%s added %u gold, %u silver, %u copper to your backpack.", |
|---|
| 822 | m_session->GetPlayer()->GetName(), |
|---|
| 823 | gold, silver, copper ); |
|---|
| 824 | } |
|---|
| 825 | else |
|---|
| 826 | { |
|---|
| 827 | BlueSystemMessage( m_session, |
|---|
| 828 | "Taking %u gold, %u silver, %u copper from %s's backpack...", |
|---|
| 829 | gold, silver, copper, |
|---|
| 830 | chr->GetName() ); |
|---|
| 831 | |
|---|
| 832 | GreenSystemMessageToPlr( chr, "%s took %u gold, %u silver, %u copper from your backpack.", |
|---|
| 833 | m_session->GetPlayer()->GetName(), |
|---|
| 834 | gold, silver, copper ); |
|---|
| 835 | } |
|---|
| 836 | } |
|---|
| 837 | |
|---|
| 838 | // Check they don't have more than the max gold |
|---|
| 839 | if(sWorld.GoldCapEnabled) |
|---|
| 840 | { |
|---|
| 841 | if( (chr->GetGold() + newgold) > sWorld.GoldLimit) |
|---|
| 842 | { |
|---|
| 843 | RedSystemMessage(m_session, "Maximum amount of gold is %u and %s already has %u", (sWorld.GoldLimit/10000), chr->GetName(), (chr->GetGold()/10000)); |
|---|
| 844 | return true; |
|---|
| 845 | } |
|---|
| 846 | } |
|---|
| 847 | |
|---|
| 848 | chr->SetGold( newgold ); |
|---|
| 849 | |
|---|
| 850 | return true; |
|---|
| 851 | } |
|---|
| 852 | |
|---|
| 853 | bool ChatHandler::HandleTriggerCommand(const char* args, WorldSession* m_session) |
|---|
| 854 | { |
|---|
| 855 | if(!args) |
|---|
| 856 | { |
|---|
| 857 | RedSystemMessage(m_session, "No information was provided."); |
|---|
| 858 | return true; |
|---|
| 859 | } |
|---|
| 860 | int32 instance_id; |
|---|
| 861 | uint32 trigger_id; |
|---|
| 862 | int valcount = sscanf(args, "%u %d", (unsigned int*)&trigger_id, (int*)&instance_id); |
|---|
| 863 | if(!valcount) |
|---|
| 864 | return false; |
|---|
| 865 | if(valcount == 1) |
|---|
| 866 | instance_id = 0; |
|---|
| 867 | |
|---|
| 868 | AreaTriggerEntry *entry = dbcAreaTrigger.LookupEntryForced(trigger_id); |
|---|
| 869 | if(trigger_id == 0 || entry == NULL) |
|---|
| 870 | { |
|---|
| 871 | RedSystemMessage(m_session, "Could not find trigger %s", args); |
|---|
| 872 | return true; |
|---|
| 873 | } |
|---|
| 874 | |
|---|
| 875 | m_session->GetPlayer()->SafeTeleport(entry->mapid, instance_id, LocationVector(entry->x, entry->y, |
|---|
| 876 | entry->z, entry->o)); |
|---|
| 877 | |
|---|
| 878 | BlueSystemMessage(m_session, "Teleported to trigger %u on [%u][%.2f][%.2f][%.2f]", entry->id, |
|---|
| 879 | entry->mapid, entry->x, entry->y, entry->z); |
|---|
| 880 | return true; |
|---|
| 881 | } |
|---|
| 882 | |
|---|
| 883 | bool ChatHandler::HandleUnlearnCommand(const char* args, WorldSession * m_session) |
|---|
| 884 | { |
|---|
| 885 | Player * plr = getSelectedChar(m_session, true); |
|---|
| 886 | if(plr == 0) |
|---|
| 887 | return true; |
|---|
| 888 | |
|---|
| 889 | uint32 SpellId = atol(args); |
|---|
| 890 | if(SpellId == 0) |
|---|
| 891 | { |
|---|
| 892 | SpellId = GetSpellIDFromLink(args); |
|---|
| 893 | if(SpellId == 0) |
|---|
| 894 | { |
|---|
| 895 | RedSystemMessage(m_session, "You must specify a spell id."); |
|---|
| 896 | return true; |
|---|
| 897 | } |
|---|
| 898 | } |
|---|
| 899 | |
|---|
| 900 | sGMLog.writefromsession(m_session, "removed spell %u from %s", SpellId, plr->GetName()); |
|---|
| 901 | |
|---|
| 902 | if(plr->HasSpell(SpellId)) |
|---|
| 903 | { |
|---|
| 904 | GreenSystemMessageToPlr(plr, "Removed spell %u.", SpellId); |
|---|
| 905 | GreenSystemMessage(m_session, "Removed spell %u from %s.", SpellId, plr->GetName()); |
|---|
| 906 | plr->removeSpell(SpellId, false, false, 0); |
|---|
| 907 | } |
|---|
| 908 | else |
|---|
| 909 | { |
|---|
| 910 | RedSystemMessage(m_session, "That player does not have spell %u learnt.", SpellId); |
|---|
| 911 | } |
|---|
| 912 | |
|---|
| 913 | return true; |
|---|
| 914 | } |
|---|
| 915 | |
|---|
| 916 | bool ChatHandler::HandleNpcSpawnLinkCommand(const char* args, WorldSession *m_session) |
|---|
| 917 | { |
|---|
| 918 | uint32 id; |
|---|
| 919 | char sql[512]; |
|---|
| 920 | Creature* target = m_session->GetPlayer()->GetMapMgr()->GetCreature(GET_LOWGUID_PART(m_session->GetPlayer()->GetSelection())); |
|---|
| 921 | if (!target) |
|---|
| 922 | return false; |
|---|
| 923 | |
|---|
| 924 | int valcount = sscanf(args, "%u", (unsigned int*)&id); |
|---|
| 925 | if(valcount) |
|---|
| 926 | { |
|---|
| 927 | snprintf(sql, 512, "UPDATE creature_spawns SET npc_respawn_link = '%u' WHERE id = '%u'", (unsigned int)id, (unsigned int)target->GetSQL_id()); |
|---|
| 928 | WorldDatabase.Execute( sql ); |
|---|
| 929 | BlueSystemMessage(m_session, "Spawn linking for this NPC has been updated: %u", id); |
|---|
| 930 | } |
|---|
| 931 | else |
|---|
| 932 | { |
|---|
| 933 | RedSystemMessage(m_session, "Sql entry invalid %u", id); |
|---|
| 934 | } |
|---|
| 935 | |
|---|
| 936 | return true; |
|---|
| 937 | } |
|---|
| 938 | |
|---|
| 939 | bool ChatHandler::HandleModifyTPsCommand(const char* args, WorldSession *m_session) |
|---|
| 940 | { |
|---|
| 941 | if(!args) |
|---|
| 942 | return false; |
|---|
| 943 | |
|---|
| 944 | Player * Pl = getSelectedChar(m_session, false); |
|---|
| 945 | if(!Pl) |
|---|
| 946 | { |
|---|
| 947 | SystemMessage(m_session, "Invalid or no target provided, please target a player to modify its talentpoints."); |
|---|
| 948 | return true; |
|---|
| 949 | } |
|---|
| 950 | |
|---|
| 951 | uint32 TP1 = 0; |
|---|
| 952 | uint32 TP2 = 0; |
|---|
| 953 | if(sscanf(args, "%u %u", &TP1, &TP2) != 2) |
|---|
| 954 | { |
|---|
| 955 | SystemMessage(m_session, "Enter two amounts to modify your target's both specs to (enter 0 to that spec at default)."); |
|---|
| 956 | return true; |
|---|
| 957 | } |
|---|
| 958 | |
|---|
| 959 | Pl->m_specs[SPEC_PRIMARY].m_customTalentPointOverride = TP1; |
|---|
| 960 | Pl->m_specs[SPEC_SECONDARY].m_customTalentPointOverride = TP2; |
|---|
| 961 | Pl->smsg_TalentsInfo(false); |
|---|
| 962 | return true; |
|---|
| 963 | } |
|---|
| 964 | |
|---|
| 965 | #ifdef ENABLE_ACHIEVEMENTS |
|---|
| 966 | /** |
|---|
| 967 | Handles .achieve complete |
|---|
| 968 | .achieve complete id : completes achievement "id" (can be an achievement link) for the selected player |
|---|
| 969 | */ |
|---|
| 970 | bool ChatHandler::HandleAchievementCompleteCommand(const char * args, WorldSession * m_session) |
|---|
| 971 | { |
|---|
| 972 | if(!*args) |
|---|
| 973 | return false; |
|---|
| 974 | |
|---|
| 975 | Player *plr = getSelectedChar(m_session, true); |
|---|
| 976 | if(!plr) |
|---|
| 977 | { |
|---|
| 978 | plr = m_session->GetPlayer(); |
|---|
| 979 | SystemMessage(m_session, "Auto-targeting self."); |
|---|
| 980 | } |
|---|
| 981 | |
|---|
| 982 | uint32 achievement_id = atol(args); |
|---|
| 983 | if(achievement_id== 0) |
|---|
| 984 | { |
|---|
| 985 | achievement_id = GetAchievementIDFromLink(args); |
|---|
| 986 | if(achievement_id== 0) |
|---|
| 987 | { |
|---|
| 988 | if( stricmp(args,"all") == 0 ) |
|---|
| 989 | { |
|---|
| 990 | plr->GetAchievementMgr().GMCompleteAchievement(m_session, -1); |
|---|
| 991 | SystemMessage(m_session,"All achievements have now been completed for that player."); |
|---|
| 992 | sGMLog.writefromsession(m_session,"completed all achievements for player %s", plr->GetName()); |
|---|
| 993 | return true; |
|---|
| 994 | } |
|---|
| 995 | return false; |
|---|
| 996 | } |
|---|
| 997 | } |
|---|
| 998 | |
|---|
| 999 | if(plr->GetAchievementMgr().GMCompleteAchievement(m_session, achievement_id)) |
|---|
| 1000 | { |
|---|
| 1001 | SystemMessage(m_session,"The achievement has now been completed for that player."); |
|---|
| 1002 | sGMLog.writefromsession( m_session, "completed achievement %u for player %s", achievement_id, plr->GetName() ); |
|---|
| 1003 | } |
|---|
| 1004 | return true; |
|---|
| 1005 | } |
|---|
| 1006 | |
|---|
| 1007 | /** |
|---|
| 1008 | Handles .achieve criteria |
|---|
| 1009 | .achieve criteria id : completes achievement criteria "id" for the selected player |
|---|
| 1010 | */ |
|---|
| 1011 | bool ChatHandler::HandleAchievementCriteriaCommand(const char * args, WorldSession * m_session) |
|---|
| 1012 | { |
|---|
| 1013 | if(!*args) |
|---|
| 1014 | return false; |
|---|
| 1015 | |
|---|
| 1016 | Player *plr = getSelectedChar(m_session, true); |
|---|
| 1017 | if(!plr) |
|---|
| 1018 | { |
|---|
| 1019 | plr = m_session->GetPlayer(); |
|---|
| 1020 | SystemMessage(m_session, "Auto-targeting self."); |
|---|
| 1021 | } |
|---|
| 1022 | |
|---|
| 1023 | uint32 criteria_id = atol(args); |
|---|
| 1024 | if( criteria_id == 0 ) |
|---|
| 1025 | { |
|---|
| 1026 | if( stricmp(args,"all")== 0 ) |
|---|
| 1027 | { |
|---|
| 1028 | plr->GetAchievementMgr().GMCompleteCriteria(m_session, -1); |
|---|
| 1029 | SystemMessage(m_session,"All achievement criteria have now been completed for that player."); |
|---|
| 1030 | sGMLog.writefromsession(m_session,"completed all achievement criteria for player %s", plr->GetName()); |
|---|
| 1031 | return true; |
|---|
| 1032 | } |
|---|
| 1033 | return false; |
|---|
| 1034 | } |
|---|
| 1035 | |
|---|
| 1036 | if(plr->GetAchievementMgr().GMCompleteCriteria(m_session, criteria_id)) |
|---|
| 1037 | { |
|---|
| 1038 | SystemMessage(m_session,"The achievement criteria has now been completed for that player."); |
|---|
| 1039 | sGMLog.writefromsession( m_session, "completed achievement criteria %u for player %s", criteria_id, plr->GetName() ); |
|---|
| 1040 | } |
|---|
| 1041 | return true; |
|---|
| 1042 | } |
|---|
| 1043 | |
|---|
| 1044 | /** |
|---|
| 1045 | Handles .achieve reset |
|---|
| 1046 | .achieve reset id : removes achievement "id" (can be an achievement link) from the selected player |
|---|
| 1047 | .achieve reset criteria id : removes achievement criteria "id" from the selected player |
|---|
| 1048 | .achieve reset all : removes all achievement and criteria data from the selected player |
|---|
| 1049 | */ |
|---|
| 1050 | bool ChatHandler::HandleAchievementResetCommand(const char * args, WorldSession * m_session) |
|---|
| 1051 | { |
|---|
| 1052 | if(!*args) |
|---|
| 1053 | return false; |
|---|
| 1054 | |
|---|
| 1055 | Player *plr = getSelectedChar(m_session, true); |
|---|
| 1056 | if(!plr) |
|---|
| 1057 | { |
|---|
| 1058 | plr = m_session->GetPlayer(); |
|---|
| 1059 | SystemMessage(m_session, "Auto-targeting self."); |
|---|
| 1060 | } |
|---|
| 1061 | |
|---|
| 1062 | bool resetAch = true, resetCri = false; |
|---|
| 1063 | int32 achievement_id; |
|---|
| 1064 | if(strnicmp(args, "criteria ", 9) == 0) |
|---|
| 1065 | { |
|---|
| 1066 | achievement_id = atol(args+9); |
|---|
| 1067 | if(achievement_id== 0) |
|---|
| 1068 | { |
|---|
| 1069 | if(stricmp(args+9,"all") != 0) |
|---|
| 1070 | { |
|---|
| 1071 | return false; |
|---|
| 1072 | } |
|---|
| 1073 | achievement_id = -1; |
|---|
| 1074 | } |
|---|
| 1075 | resetCri = true; |
|---|
| 1076 | resetAch = false; |
|---|
| 1077 | } |
|---|
| 1078 | else if(stricmp(args,"all") == 0) |
|---|
| 1079 | { |
|---|
| 1080 | achievement_id = -1; |
|---|
| 1081 | resetCri = true; |
|---|
| 1082 | } |
|---|
| 1083 | else |
|---|
| 1084 | { |
|---|
| 1085 | achievement_id = atol(args); |
|---|
| 1086 | if(achievement_id== 0) |
|---|
| 1087 | { |
|---|
| 1088 | achievement_id = GetAchievementIDFromLink(args); |
|---|
| 1089 | if(achievement_id== 0) |
|---|
| 1090 | return false; |
|---|
| 1091 | } |
|---|
| 1092 | } |
|---|
| 1093 | |
|---|
| 1094 | if(resetAch) |
|---|
| 1095 | plr->GetAchievementMgr().GMResetAchievement(achievement_id); |
|---|
| 1096 | if(resetCri) |
|---|
| 1097 | plr->GetAchievementMgr().GMResetCriteria(achievement_id); |
|---|
| 1098 | return true; |
|---|
| 1099 | } |
|---|
| 1100 | |
|---|
| 1101 | /** |
|---|
| 1102 | Handles .lookup achievement |
|---|
| 1103 | GM achievement lookup command usage: |
|---|
| 1104 | .lookup achievement string : searches for "string" in achievement name |
|---|
| 1105 | .lookup achievement desc string : searches for "string" in achievement description |
|---|
| 1106 | .lookup achievement reward string : searches for "string" in achievement reward name |
|---|
| 1107 | .lookup achievement criteria string : searches for "string" in achievement criteria name |
|---|
| 1108 | .lookup achievement all string : searches for "string" in achievement name, description, reward, and critiera |
|---|
| 1109 | */ |
|---|
| 1110 | bool ChatHandler::HandleLookupAchievementCmd(const char* args, WorldSession* m_session) |
|---|
| 1111 | { |
|---|
| 1112 | if(!*args) |
|---|
| 1113 | return false; |
|---|
| 1114 | |
|---|
| 1115 | string x; |
|---|
| 1116 | bool lookupname = true, lookupdesc = false, lookupcriteria = false, lookupreward = false; |
|---|
| 1117 | if( strnicmp(args,"name ",5) == 0 ) |
|---|
| 1118 | { |
|---|
| 1119 | x = string(args+5); |
|---|
| 1120 | } |
|---|
| 1121 | else if( strnicmp(args,"desc ",5) == 0 ) |
|---|
| 1122 | { |
|---|
| 1123 | lookupname = false; |
|---|
| 1124 | lookupdesc = true; |
|---|
| 1125 | x = string(args+5); |
|---|
| 1126 | } |
|---|
| 1127 | else if( strnicmp(args,"criteria ",9) == 0 ) |
|---|
| 1128 | { |
|---|
| 1129 | lookupname = false; |
|---|
| 1130 | lookupcriteria = true; |
|---|
| 1131 | x = string(args+9); |
|---|
| 1132 | } |
|---|
| 1133 | else if( strnicmp(args,"reward ",7) == 0 ) |
|---|
| 1134 | { |
|---|
| 1135 | lookupname = false; |
|---|
| 1136 | lookupreward = true; |
|---|
| 1137 | x = string(args+7); |
|---|
| 1138 | } |
|---|
| 1139 | else if( strnicmp(args,"all ",4) == 0 ) |
|---|
| 1140 | { |
|---|
| 1141 | lookupdesc = true; |
|---|
| 1142 | lookupcriteria = true; |
|---|
| 1143 | lookupreward = true; |
|---|
| 1144 | x = string(args+4); |
|---|
| 1145 | } |
|---|
| 1146 | else |
|---|
| 1147 | { |
|---|
| 1148 | x = string(args); |
|---|
| 1149 | } |
|---|
| 1150 | if( x.length() < 4 ) |
|---|
| 1151 | { |
|---|
| 1152 | RedSystemMessage(m_session, "Your search string must be at least 4 characters long."); |
|---|
| 1153 | return true; |
|---|
| 1154 | } |
|---|
| 1155 | arcemu_TOLOWER(x); |
|---|
| 1156 | GreenSystemMessage(m_session, "Starting search of achievement `%s`...", x.c_str()); |
|---|
| 1157 | uint32 t = getMSTime(); |
|---|
| 1158 | uint32 i, j, numFound= 0; |
|---|
| 1159 | string y, recout; |
|---|
| 1160 | std::set<uint8, uint32> foundList; |
|---|
| 1161 | char playerGUID[17]; |
|---|
| 1162 | snprintf(playerGUID,17,I64FMT,m_session->GetPlayer()->GetGUID()); |
|---|
| 1163 | |
|---|
| 1164 | if( lookupname || lookupdesc || lookupreward ) |
|---|
| 1165 | { |
|---|
| 1166 | std::set<uint32> foundList; |
|---|
| 1167 | j = dbcAchievementStore.GetNumRows(); |
|---|
| 1168 | bool foundmatch; |
|---|
| 1169 | for( i = 0; i < j && numFound < 25; ++i ) |
|---|
| 1170 | { |
|---|
| 1171 | AchievementEntry const* achievement = dbcAchievementStore.LookupRowForced(i); |
|---|
| 1172 | if(achievement) |
|---|
| 1173 | { |
|---|
| 1174 | if( foundList.find(achievement->ID) != foundList.end() ) |
|---|
| 1175 | { |
|---|
| 1176 | // already listed this achievement (some achievements have multiple entries in dbc) |
|---|
| 1177 | continue; |
|---|
| 1178 | } |
|---|
| 1179 | foundmatch = false; |
|---|
| 1180 | if( lookupname ) |
|---|
| 1181 | { |
|---|
| 1182 | y = string(achievement->name); |
|---|
| 1183 | arcemu_TOLOWER(y); |
|---|
| 1184 | foundmatch = FindXinYString(x,y); |
|---|
| 1185 | } |
|---|
| 1186 | if( !foundmatch && lookupdesc ) |
|---|
| 1187 | { |
|---|
| 1188 | y = string(achievement->description); |
|---|
| 1189 | arcemu_TOLOWER(y); |
|---|
| 1190 | foundmatch = FindXinYString(x,y); |
|---|
| 1191 | } |
|---|
| 1192 | if( !foundmatch && lookupreward ) |
|---|
| 1193 | { |
|---|
| 1194 | y = string(achievement->rewardName); |
|---|
| 1195 | arcemu_TOLOWER(y); |
|---|
| 1196 | foundmatch = FindXinYString(x,y); |
|---|
| 1197 | } |
|---|
| 1198 | if( !foundmatch ) |
|---|
| 1199 | { |
|---|
| 1200 | continue; |
|---|
| 1201 | } |
|---|
| 1202 | foundList.insert(achievement->ID); |
|---|
| 1203 | std::stringstream strm; |
|---|
| 1204 | strm << achievement->ID; |
|---|
| 1205 | // create achievement link |
|---|
| 1206 | recout = "|cffffffffAchievement "; |
|---|
| 1207 | recout += strm.str(); |
|---|
| 1208 | recout += ": |cfffff000|Hachievement:"; |
|---|
| 1209 | recout += strm.str(); |
|---|
| 1210 | recout += ":"; |
|---|
| 1211 | recout += (char*)playerGUID; |
|---|
| 1212 | time_t completetime = m_session->GetPlayer()->GetAchievementMgr().GetCompletedTime(achievement); |
|---|
| 1213 | if( completetime ) |
|---|
| 1214 | { |
|---|
| 1215 | // achievement is completed |
|---|
| 1216 | struct tm* ct; |
|---|
| 1217 | ct = localtime(&completetime); |
|---|
| 1218 | strm.str(""); |
|---|
| 1219 | strm << ":1:" << ct->tm_mon + 1 << ":" << ct->tm_mday << ":" << ct->tm_year - 100 << ":-1:-1:-1:-1|h["; |
|---|
| 1220 | recout += strm.str(); |
|---|
| 1221 | } |
|---|
| 1222 | else |
|---|
| 1223 | { |
|---|
| 1224 | // achievement is not completed |
|---|
| 1225 | recout += ":0:0:0:-1:0:0:0:0|h["; |
|---|
| 1226 | } |
|---|
| 1227 | recout += achievement->name; |
|---|
| 1228 | if( !lookupreward ) |
|---|
| 1229 | { |
|---|
| 1230 | recout += "]|h|r"; |
|---|
| 1231 | } |
|---|
| 1232 | else |
|---|
| 1233 | { |
|---|
| 1234 | recout += "]|h |cffffffff"; |
|---|
| 1235 | recout += achievement->rewardName; |
|---|
| 1236 | recout += "|r"; |
|---|
| 1237 | } |
|---|
| 1238 | strm.str(""); |
|---|
| 1239 | SendMultilineMessage(m_session,recout.c_str()); |
|---|
| 1240 | if( ++numFound >= 25 ) |
|---|
| 1241 | { |
|---|
| 1242 | RedSystemMessage(m_session,"More than 25 results found."); |
|---|
| 1243 | break; |
|---|
| 1244 | } |
|---|
| 1245 | } |
|---|
| 1246 | } // for loop (number of rows, up to 25) |
|---|
| 1247 | } // lookup name or description |
|---|
| 1248 | |
|---|
| 1249 | if( lookupcriteria && numFound < 25 ) |
|---|
| 1250 | { |
|---|
| 1251 | std::set<uint32> foundList; |
|---|
| 1252 | j = dbcAchievementCriteriaStore.GetNumRows(); |
|---|
| 1253 | for( i = 0; i < j && numFound < 25; ++i ) |
|---|
| 1254 | { |
|---|
| 1255 | AchievementCriteriaEntry const* criteria = dbcAchievementCriteriaStore.LookupRowForced(i); |
|---|
| 1256 | if( criteria ) |
|---|
| 1257 | { |
|---|
| 1258 | if( foundList.find(criteria->ID) != foundList.end() ) |
|---|
| 1259 | { |
|---|
| 1260 | // already listed this achievement (some achievements have multiple entries in dbc) |
|---|
| 1261 | continue; |
|---|
| 1262 | } |
|---|
| 1263 | y = string(criteria->name); |
|---|
| 1264 | arcemu_TOLOWER(y); |
|---|
| 1265 | if( !FindXinYString(x,y) ) |
|---|
| 1266 | { |
|---|
| 1267 | continue; |
|---|
| 1268 | } |
|---|
| 1269 | foundList.insert(criteria->ID); |
|---|
| 1270 | std::stringstream strm; |
|---|
| 1271 | strm << criteria->ID; |
|---|
| 1272 | recout = "|cffffffffCriteria "; |
|---|
| 1273 | recout += strm.str(); |
|---|
| 1274 | recout += ": |cfffff000"; |
|---|
| 1275 | recout += criteria->name; |
|---|
| 1276 | strm.str(""); |
|---|
| 1277 | AchievementEntry const* achievement = dbcAchievementStore.LookupEntryForced(criteria->referredAchievement); |
|---|
| 1278 | if( achievement ) |
|---|
| 1279 | { |
|---|
| 1280 | // create achievement link |
|---|
| 1281 | recout += " |cffffffffAchievement "; |
|---|
| 1282 | strm << achievement->ID; |
|---|
| 1283 | recout += strm.str(); |
|---|
| 1284 | recout += ": |cfffff000|Hachievement:"; |
|---|
| 1285 | recout += strm.str(); |
|---|
| 1286 | recout += ":"; |
|---|
| 1287 | recout += (char*)playerGUID; |
|---|
| 1288 | time_t completetime = m_session->GetPlayer()->GetAchievementMgr().GetCompletedTime(achievement); |
|---|
| 1289 | if( completetime ) |
|---|
| 1290 | { |
|---|
| 1291 | // achievement is completed |
|---|
| 1292 | struct tm* ct; |
|---|
| 1293 | ct = localtime(&completetime); |
|---|
| 1294 | strm.str(""); |
|---|
| 1295 | strm << ":1:" << ct->tm_mon + 1 << ":" << ct->tm_mday << ":" << ct->tm_year - 100 << ":-1:-1:-1:-1|h["; |
|---|
| 1296 | recout += strm.str(); |
|---|
| 1297 | } |
|---|
| 1298 | else |
|---|
| 1299 | { |
|---|
| 1300 | // achievement is not completed |
|---|
| 1301 | recout += ":0:0:0:-1:0:0:0:0|h["; |
|---|
| 1302 | } |
|---|
| 1303 | recout += achievement->name; |
|---|
| 1304 | if( !lookupreward ) |
|---|
| 1305 | { |
|---|
| 1306 | recout += "]|h|r"; |
|---|
| 1307 | } |
|---|
| 1308 | else |
|---|
| 1309 | { |
|---|
| 1310 | recout += "]|h |cffffffff"; |
|---|
| 1311 | recout += achievement->rewardName; |
|---|
| 1312 | recout += "|r"; |
|---|
| 1313 | } |
|---|
| 1314 | strm.str(""); |
|---|
| 1315 | } |
|---|
| 1316 | SendMultilineMessage(m_session,recout.c_str()); |
|---|
| 1317 | if( ++numFound >= 25 ) |
|---|
| 1318 | { |
|---|
| 1319 | RedSystemMessage(m_session,"More than 25 results found."); |
|---|
| 1320 | break; |
|---|
| 1321 | } |
|---|
| 1322 | } |
|---|
| 1323 | } // for loop (number of rows, up to 25) |
|---|
| 1324 | } // lookup criteria |
|---|
| 1325 | |
|---|
| 1326 | if( numFound == 0 ) |
|---|
| 1327 | { |
|---|
| 1328 | recout = "|cff00ccffNo matches found."; |
|---|
| 1329 | SendMultilineMessage(m_session,recout.c_str()); |
|---|
| 1330 | } |
|---|
| 1331 | |
|---|
| 1332 | BlueSystemMessage(m_session,"Search completed in %u ms.",getMSTime()-t); |
|---|
| 1333 | |
|---|
| 1334 | return true; |
|---|
| 1335 | } |
|---|
| 1336 | |
|---|
| 1337 | |
|---|
| 1338 | |
|---|
| 1339 | #endif |
|---|