[2] | 1 | /* |
---|
| 2 | * Copyright (C) 2005-2008 MaNGOS <http://www.mangosproject.org/> |
---|
| 3 | * |
---|
| 4 | * This program is free software; you can redistribute it and/or modify |
---|
| 5 | * it under the terms of the GNU General Public License as published by |
---|
| 6 | * the Free Software Foundation; either version 2 of the License, or |
---|
| 7 | * (at your option) any later version. |
---|
| 8 | * |
---|
| 9 | * This program is distributed in the hope that it will be useful, |
---|
| 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
---|
| 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
---|
| 12 | * GNU General Public License for more details. |
---|
| 13 | * |
---|
| 14 | * You should have received a copy of the GNU General Public License |
---|
| 15 | * along with this program; if not, write to the Free Software |
---|
| 16 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
---|
| 17 | */ |
---|
| 18 | |
---|
| 19 | #include "Common.h" |
---|
| 20 | #include "Database/DatabaseEnv.h" |
---|
| 21 | #include "WorldPacket.h" |
---|
| 22 | #include "WorldSession.h" |
---|
| 23 | #include "World.h" |
---|
| 24 | #include "Player.h" |
---|
| 25 | #include "Opcodes.h" |
---|
| 26 | #include "Chat.h" |
---|
| 27 | #include "Log.h" |
---|
| 28 | #include "Unit.h" |
---|
| 29 | #include "ObjectAccessor.h" |
---|
| 30 | #include "GossipDef.h" |
---|
| 31 | #include "Language.h" |
---|
| 32 | #include "MapManager.h" |
---|
[9] | 33 | #include "BattleGroundMgr.h" |
---|
[2] | 34 | |
---|
| 35 | bool ChatHandler::HandleDebugInArcCommand(const char* /*args*/) |
---|
| 36 | { |
---|
| 37 | Object *obj = getSelectedUnit(); |
---|
| 38 | |
---|
| 39 | if(!obj) |
---|
| 40 | { |
---|
| 41 | SendSysMessage(LANG_SELECT_CHAR_OR_CREATURE); |
---|
| 42 | return true; |
---|
| 43 | } |
---|
| 44 | |
---|
| 45 | SendSysMessage(LANG_NOT_IMPLEMENTED); |
---|
| 46 | |
---|
| 47 | return true; |
---|
| 48 | } |
---|
| 49 | |
---|
| 50 | bool ChatHandler::HandleDebugSpellFailCommand(const char* args) |
---|
| 51 | { |
---|
| 52 | if(!args) |
---|
| 53 | return false; |
---|
| 54 | |
---|
| 55 | char* px = strtok((char*)args, " "); |
---|
| 56 | if(!px) |
---|
| 57 | return false; |
---|
| 58 | |
---|
| 59 | uint8 failnum = (uint8)atoi(px); |
---|
| 60 | |
---|
| 61 | WorldPacket data(SMSG_CAST_FAILED, 5); |
---|
| 62 | data << (uint32)133; |
---|
| 63 | data << failnum; |
---|
| 64 | m_session->SendPacket(&data); |
---|
| 65 | |
---|
| 66 | return true; |
---|
| 67 | } |
---|
| 68 | |
---|
| 69 | bool ChatHandler::HandleSetPoiCommand(const char* args) |
---|
| 70 | { |
---|
| 71 | Player *pPlayer = m_session->GetPlayer(); |
---|
| 72 | Unit* target = getSelectedUnit(); |
---|
| 73 | if(!target) |
---|
| 74 | { |
---|
| 75 | SendSysMessage(LANG_SELECT_CHAR_OR_CREATURE); |
---|
| 76 | return true; |
---|
| 77 | } |
---|
| 78 | |
---|
| 79 | if(!args) |
---|
| 80 | return false; |
---|
| 81 | |
---|
| 82 | char* icon_text = strtok((char*)args, " "); |
---|
| 83 | char* flags_text = strtok(NULL, " "); |
---|
| 84 | if(!icon_text || !flags_text) |
---|
| 85 | return false; |
---|
| 86 | |
---|
| 87 | uint32 icon = atol(icon_text); |
---|
| 88 | if ( icon < 0 ) |
---|
| 89 | icon = 0; |
---|
| 90 | |
---|
| 91 | uint32 flags = atol(flags_text); |
---|
| 92 | |
---|
| 93 | sLog.outDetail("Command : POI, NPC = %u, icon = %u flags = %u", target->GetGUIDLow(), icon,flags); |
---|
| 94 | pPlayer->PlayerTalkClass->SendPointOfInterest(target->GetPositionX(), target->GetPositionY(), Poi_Icon(icon), flags, 30, "Test POI"); |
---|
| 95 | return true; |
---|
| 96 | } |
---|
| 97 | |
---|
| 98 | bool ChatHandler::HandleEquipErrorCommand(const char* args) |
---|
| 99 | { |
---|
| 100 | if(!args) |
---|
| 101 | return false; |
---|
| 102 | |
---|
| 103 | uint8 msg = atoi(args); |
---|
| 104 | m_session->GetPlayer()->SendEquipError(msg, 0, 0); |
---|
| 105 | return true; |
---|
| 106 | } |
---|
| 107 | |
---|
| 108 | bool ChatHandler::HandleSellErrorCommand(const char* args) |
---|
| 109 | { |
---|
| 110 | if(!args) |
---|
| 111 | return false; |
---|
| 112 | |
---|
| 113 | uint8 msg = atoi(args); |
---|
| 114 | m_session->GetPlayer()->SendSellError(msg, 0, 0, 0); |
---|
| 115 | return true; |
---|
| 116 | } |
---|
| 117 | |
---|
| 118 | bool ChatHandler::HandleBuyErrorCommand(const char* args) |
---|
| 119 | { |
---|
| 120 | if(!args) |
---|
| 121 | return false; |
---|
| 122 | |
---|
| 123 | uint8 msg = atoi(args); |
---|
| 124 | m_session->GetPlayer()->SendBuyError(msg, 0, 0, 0); |
---|
| 125 | return true; |
---|
| 126 | } |
---|
| 127 | |
---|
| 128 | bool ChatHandler::HandleSendOpcodeCommand(const char* args) |
---|
| 129 | { |
---|
| 130 | Unit *unit = getSelectedUnit(); |
---|
| 131 | if (!unit || (unit->GetTypeId() != TYPEID_PLAYER)) |
---|
| 132 | unit = m_session->GetPlayer(); |
---|
| 133 | |
---|
| 134 | FILE *file = fopen("opcode.txt", "r"); |
---|
| 135 | if(!file) |
---|
| 136 | return false; |
---|
| 137 | |
---|
| 138 | uint32 type; |
---|
| 139 | |
---|
| 140 | uint32 val1; |
---|
| 141 | uint64 val2; |
---|
| 142 | float val3; |
---|
| 143 | char val4[101]; |
---|
| 144 | |
---|
| 145 | uint32 opcode = 0; |
---|
| 146 | fscanf(file, "%u", &opcode); |
---|
| 147 | if(!opcode) |
---|
| 148 | { |
---|
| 149 | fclose(file); |
---|
| 150 | return false; |
---|
| 151 | } |
---|
| 152 | |
---|
| 153 | WorldPacket data(opcode, 0); |
---|
| 154 | |
---|
| 155 | while(fscanf(file, "%u", &type) != EOF) |
---|
| 156 | { |
---|
| 157 | switch(type) |
---|
| 158 | { |
---|
| 159 | case 0: // uint8 |
---|
| 160 | fscanf(file, "%u", &val1); |
---|
| 161 | data << uint8(val1); |
---|
| 162 | break; |
---|
| 163 | case 1: // uint16 |
---|
| 164 | fscanf(file, "%u", &val1); |
---|
| 165 | data << uint16(val1); |
---|
| 166 | break; |
---|
| 167 | case 2: // uint32 |
---|
| 168 | fscanf(file, "%u", &val1); |
---|
| 169 | data << uint32(val1); |
---|
| 170 | break; |
---|
| 171 | case 3: // uint64 |
---|
| 172 | fscanf(file, I64FMTD, &val2); |
---|
| 173 | data << uint64(val2); |
---|
| 174 | break; |
---|
| 175 | case 4: // float |
---|
| 176 | fscanf(file, "%f", &val3); |
---|
| 177 | data << float(val3); |
---|
| 178 | break; |
---|
| 179 | case 5: // string |
---|
| 180 | fscanf(file, "%s", val4, 101); |
---|
| 181 | data << val4; |
---|
| 182 | break; |
---|
| 183 | case 6: // packed guid |
---|
| 184 | data.append(unit->GetPackGUID()); |
---|
| 185 | break; |
---|
| 186 | default: |
---|
| 187 | fclose(file); |
---|
| 188 | return false; |
---|
| 189 | } |
---|
| 190 | } |
---|
| 191 | fclose(file); |
---|
| 192 | sLog.outDebug("Sending opcode %u", data.GetOpcode()); |
---|
| 193 | data.hexlike(); |
---|
| 194 | ((Player*)unit)->GetSession()->SendPacket(&data); |
---|
| 195 | PSendSysMessage(LANG_COMMAND_OPCODESENT, data.GetOpcode(), unit->GetName()); |
---|
| 196 | return true; |
---|
| 197 | } |
---|
| 198 | |
---|
| 199 | bool ChatHandler::HandleUpdateWorldStateCommand(const char* args) |
---|
| 200 | { |
---|
| 201 | char* w = strtok((char*)args, " "); |
---|
| 202 | char* s = strtok(NULL, " "); |
---|
| 203 | |
---|
| 204 | if (!w || !s) |
---|
| 205 | return false; |
---|
| 206 | |
---|
| 207 | uint32 world = (uint32)atoi(w); |
---|
| 208 | uint32 state = (uint32)atoi(s); |
---|
| 209 | m_session->GetPlayer()->SendUpdateWorldState(world, state); |
---|
| 210 | return true; |
---|
| 211 | } |
---|
| 212 | |
---|
| 213 | bool ChatHandler::HandlePlaySound2Command(const char* args) |
---|
| 214 | { |
---|
| 215 | if(!args) |
---|
| 216 | return false; |
---|
| 217 | |
---|
| 218 | uint32 soundid = atoi(args); |
---|
[12] | 219 | m_session->GetPlayer()->SendPlaySound(soundid, false); |
---|
[2] | 220 | return true; |
---|
| 221 | } |
---|
| 222 | |
---|
| 223 | //Send notification in channel |
---|
| 224 | bool ChatHandler::HandleSendChannelNotifyCommand(const char* args) |
---|
| 225 | { |
---|
| 226 | if(!args) |
---|
| 227 | return false; |
---|
| 228 | |
---|
| 229 | const char *name = "test"; |
---|
| 230 | uint8 code = atoi(args); |
---|
| 231 | |
---|
| 232 | WorldPacket data(SMSG_CHANNEL_NOTIFY, (1+10)); |
---|
| 233 | data << code; // notify type |
---|
| 234 | data << name; // channel name |
---|
| 235 | data << uint32(0); |
---|
| 236 | data << uint32(0); |
---|
| 237 | m_session->SendPacket(&data); |
---|
| 238 | return true; |
---|
| 239 | } |
---|
| 240 | |
---|
| 241 | //Send notification in chat |
---|
| 242 | bool ChatHandler::HandleSendChatMsgCommand(const char* args) |
---|
| 243 | { |
---|
| 244 | if(!args) |
---|
| 245 | return false; |
---|
| 246 | |
---|
| 247 | const char *msg = "testtest"; |
---|
| 248 | uint8 type = atoi(args); |
---|
| 249 | WorldPacket data; |
---|
| 250 | ChatHandler::FillMessageData(&data, m_session, type, 0, "chan", m_session->GetPlayer()->GetGUID(), msg, m_session->GetPlayer()); |
---|
| 251 | m_session->SendPacket(&data); |
---|
| 252 | return true; |
---|
| 253 | } |
---|
| 254 | |
---|
| 255 | bool ChatHandler::HandleSendQuestPartyMsgCommand(const char* args) |
---|
| 256 | { |
---|
| 257 | uint32 msg = atol((char*)args); |
---|
| 258 | if (msg >= 0) |
---|
| 259 | m_session->GetPlayer()->SendPushToPartyResponse(m_session->GetPlayer(), msg); |
---|
| 260 | return true; |
---|
| 261 | } |
---|
| 262 | |
---|
| 263 | bool ChatHandler::HandleGetLootRecipient(const char* args) |
---|
| 264 | { |
---|
| 265 | Creature* target = getSelectedCreature(); |
---|
| 266 | if(!target) |
---|
| 267 | return false; |
---|
| 268 | |
---|
| 269 | PSendSysMessage("loot recipient: %s", target->hasLootRecipient()?(target->GetLootRecipient()?target->GetLootRecipient()->GetName():"offline"):"no loot recipient"); |
---|
| 270 | return true; |
---|
| 271 | } |
---|
| 272 | |
---|
| 273 | bool ChatHandler::HandleSendQuestInvalidMsgCommand(const char* args) |
---|
| 274 | { |
---|
| 275 | uint32 msg = atol((char*)args); |
---|
| 276 | if (msg >= 0) |
---|
| 277 | m_session->GetPlayer()->SendCanTakeQuestResponse(msg); |
---|
| 278 | return true; |
---|
| 279 | } |
---|
| 280 | |
---|
| 281 | bool ChatHandler::HandleGetItemState(const char* args) |
---|
| 282 | { |
---|
| 283 | if (!args) |
---|
| 284 | return false; |
---|
| 285 | |
---|
| 286 | std::string state_str = args; |
---|
| 287 | |
---|
| 288 | ItemUpdateState state = ITEM_UNCHANGED; |
---|
| 289 | bool list_queue = false, check_all = false; |
---|
| 290 | if (state_str == "unchanged") state = ITEM_UNCHANGED; |
---|
| 291 | else if (state_str == "changed") state = ITEM_CHANGED; |
---|
| 292 | else if (state_str == "new") state = ITEM_NEW; |
---|
| 293 | else if (state_str == "removed") state = ITEM_REMOVED; |
---|
| 294 | else if (state_str == "queue") list_queue = true; |
---|
| 295 | else if (state_str == "check_all") check_all = true; |
---|
| 296 | else return false; |
---|
| 297 | |
---|
| 298 | Player* player = getSelectedPlayer(); |
---|
| 299 | if (!player) player = m_session->GetPlayer(); |
---|
| 300 | |
---|
| 301 | if (!list_queue && !check_all) |
---|
| 302 | { |
---|
| 303 | state_str = "The player has the following " + state_str + " items: "; |
---|
| 304 | SendSysMessage(state_str.c_str()); |
---|
| 305 | for (uint8 i = PLAYER_SLOT_START; i < PLAYER_SLOT_END; i++) |
---|
| 306 | { |
---|
| 307 | if(i >= BUYBACK_SLOT_START && i < BUYBACK_SLOT_END) |
---|
| 308 | continue; |
---|
| 309 | |
---|
| 310 | Item *item = player->GetItemByPos(INVENTORY_SLOT_BAG_0, i); |
---|
| 311 | if (!item) continue; |
---|
| 312 | if (!item->IsBag()) |
---|
| 313 | { |
---|
| 314 | if (item->GetState() == state) |
---|
| 315 | PSendSysMessage("bag: 255 slot: %d guid: %d owner: %d", item->GetSlot(), item->GetGUIDLow(), GUID_LOPART(item->GetOwnerGUID())); |
---|
| 316 | } |
---|
| 317 | else |
---|
| 318 | { |
---|
| 319 | Bag *bag = (Bag*)item; |
---|
| 320 | const ItemPrototype *proto = bag->GetProto(); |
---|
| 321 | for (uint8 j = 0; j < proto->ContainerSlots; ++j) |
---|
| 322 | { |
---|
| 323 | Item* item = bag->GetItemByPos(j); |
---|
| 324 | if (item && item->GetState() == state) |
---|
| 325 | PSendSysMessage("bag: 255 slot: %d guid: %d owner: %d", item->GetSlot(), item->GetGUIDLow(), GUID_LOPART(item->GetOwnerGUID())); |
---|
| 326 | } |
---|
| 327 | } |
---|
| 328 | } |
---|
| 329 | } |
---|
| 330 | |
---|
| 331 | if (list_queue) |
---|
| 332 | { |
---|
| 333 | std::vector<Item *> &updateQueue = player->GetItemUpdateQueue(); |
---|
| 334 | for(size_t i = 0; i < updateQueue.size(); i++) |
---|
| 335 | { |
---|
| 336 | Item *item = updateQueue[i]; |
---|
| 337 | if(!item) continue; |
---|
| 338 | |
---|
| 339 | Bag *container = item->GetContainer(); |
---|
| 340 | uint8 bag_slot = container ? container->GetSlot() : uint8(INVENTORY_SLOT_BAG_0); |
---|
| 341 | |
---|
| 342 | std::string st; |
---|
| 343 | switch(item->GetState()) |
---|
| 344 | { |
---|
| 345 | case ITEM_UNCHANGED: st = "unchanged"; break; |
---|
| 346 | case ITEM_CHANGED: st = "changed"; break; |
---|
| 347 | case ITEM_NEW: st = "new"; break; |
---|
| 348 | case ITEM_REMOVED: st = "removed"; break; |
---|
| 349 | } |
---|
| 350 | |
---|
| 351 | PSendSysMessage("bag: %d slot: %d guid: %d - state: %s", bag_slot, item->GetSlot(), item->GetGUIDLow(), st.c_str()); |
---|
| 352 | } |
---|
| 353 | if (updateQueue.empty()) |
---|
| 354 | PSendSysMessage("updatequeue empty"); |
---|
| 355 | } |
---|
| 356 | |
---|
| 357 | if (check_all) |
---|
| 358 | { |
---|
| 359 | bool error = false; |
---|
| 360 | std::vector<Item *> &updateQueue = player->GetItemUpdateQueue(); |
---|
| 361 | for (uint8 i = PLAYER_SLOT_START; i < PLAYER_SLOT_END; i++) |
---|
| 362 | { |
---|
| 363 | if(i >= BUYBACK_SLOT_START && i < BUYBACK_SLOT_END) |
---|
| 364 | continue; |
---|
| 365 | |
---|
| 366 | Item *item = player->GetItemByPos(INVENTORY_SLOT_BAG_0, i); |
---|
| 367 | if (!item) continue; |
---|
| 368 | |
---|
| 369 | if (item->GetSlot() != i) |
---|
| 370 | { |
---|
| 371 | PSendSysMessage("item at slot %d, guid %d has an incorrect slot value: %d", i, item->GetGUIDLow(), item->GetSlot()); |
---|
| 372 | error = true; continue; |
---|
| 373 | } |
---|
| 374 | |
---|
| 375 | if (item->GetOwnerGUID() != player->GetGUID()) |
---|
| 376 | { |
---|
| 377 | PSendSysMessage("for the item at slot %d and itemguid %d, owner's guid (%d) and player's guid (%d) don't match!", item->GetSlot(), item->GetGUIDLow(), GUID_LOPART(item->GetOwnerGUID()), player->GetGUIDLow()); |
---|
| 378 | error = true; continue; |
---|
| 379 | } |
---|
| 380 | |
---|
| 381 | if (Bag *container = item->GetContainer()) |
---|
| 382 | { |
---|
| 383 | PSendSysMessage("item at slot: %d guid: %d has a container (slot: %d, guid: %d) but shouldnt!", item->GetSlot(), item->GetGUIDLow(), container->GetSlot(), container->GetGUIDLow()); |
---|
| 384 | error = true; continue; |
---|
| 385 | } |
---|
| 386 | |
---|
| 387 | if (item->IsInUpdateQueue()) |
---|
| 388 | { |
---|
| 389 | uint16 qp = item->GetQueuePos(); |
---|
| 390 | if (qp > updateQueue.size()) |
---|
| 391 | { |
---|
| 392 | PSendSysMessage("item at slot: %d guid: %d has a queuepos (%d) larger than the update queue size! ", item->GetSlot(), item->GetGUIDLow(), qp); |
---|
| 393 | error = true; continue; |
---|
| 394 | } |
---|
| 395 | |
---|
| 396 | if (updateQueue[qp] == NULL) |
---|
| 397 | { |
---|
| 398 | PSendSysMessage("item at slot: %d guid: %d has a queuepos (%d) that points to NULL in the queue!", item->GetSlot(), item->GetGUIDLow(), qp); |
---|
| 399 | error = true; continue; |
---|
| 400 | } |
---|
| 401 | |
---|
| 402 | if (updateQueue[qp] != item) |
---|
| 403 | { |
---|
| 404 | PSendSysMessage("item at slot: %d guid: %d has has a queuepos (%d) that points to another item in the queue (bag: %d, slot: %d, guid: %d)", item->GetSlot(), item->GetGUIDLow(), qp, updateQueue[qp]->GetBagSlot(), updateQueue[qp]->GetSlot(), updateQueue[qp]->GetGUIDLow()); |
---|
| 405 | error = true; continue; |
---|
| 406 | } |
---|
| 407 | } |
---|
| 408 | else if (item->GetState() != ITEM_UNCHANGED) |
---|
| 409 | { |
---|
| 410 | PSendSysMessage("item at slot: %d guid: %d is not in queue but should be (state: %d)!", item->GetSlot(), item->GetGUIDLow(), item->GetState()); |
---|
| 411 | error = true; continue; |
---|
| 412 | } |
---|
| 413 | |
---|
| 414 | if(item->IsBag()) |
---|
| 415 | { |
---|
| 416 | Bag *bag = (Bag*)item; |
---|
| 417 | const ItemPrototype *proto = bag->GetProto(); |
---|
| 418 | for (uint8 j = 0; j < proto->ContainerSlots; ++j) |
---|
| 419 | { |
---|
| 420 | Item* item = bag->GetItemByPos(j); |
---|
| 421 | if (!item) continue; |
---|
| 422 | |
---|
| 423 | if (item->GetSlot() != j) |
---|
| 424 | { |
---|
| 425 | PSendSysMessage("the item in bag %d slot %d, guid %d has an incorrect slot value: %d", bag->GetSlot(), j, item->GetGUIDLow(), item->GetSlot()); |
---|
| 426 | error = true; continue; |
---|
| 427 | } |
---|
| 428 | |
---|
| 429 | if (item->GetOwnerGUID() != player->GetGUID()) |
---|
| 430 | { |
---|
| 431 | PSendSysMessage("for the item in bag %d at slot %d and itemguid %d, owner's guid (%d) and player's guid (%d) don't match!", bag->GetSlot(), item->GetSlot(), item->GetGUIDLow(), GUID_LOPART(item->GetOwnerGUID()), player->GetGUIDLow()); |
---|
| 432 | error = true; continue; |
---|
| 433 | } |
---|
| 434 | |
---|
| 435 | Bag *container = item->GetContainer(); |
---|
| 436 | if (!container) |
---|
| 437 | { |
---|
| 438 | PSendSysMessage("the item in bag %d at slot %d with guid %d has no container!", bag->GetSlot(), item->GetSlot(), item->GetGUIDLow()); |
---|
| 439 | error = true; continue; |
---|
| 440 | } |
---|
| 441 | |
---|
| 442 | if (container != bag) |
---|
| 443 | { |
---|
| 444 | PSendSysMessage("the item in bag %d at slot %d with guid %d has a different container(slot %d guid %d)!", bag->GetSlot(), item->GetSlot(), item->GetGUIDLow(), container->GetSlot(), container->GetGUIDLow()); |
---|
| 445 | error = true; continue; |
---|
| 446 | } |
---|
| 447 | |
---|
| 448 | if (item->IsInUpdateQueue()) |
---|
| 449 | { |
---|
| 450 | uint16 qp = item->GetQueuePos(); |
---|
| 451 | if (qp > updateQueue.size()) |
---|
| 452 | { |
---|
| 453 | PSendSysMessage("item in bag: %d at slot: %d guid: %d has a queuepos (%d) larger than the update queue size! ", bag->GetSlot(), item->GetSlot(), item->GetGUIDLow(), qp); |
---|
| 454 | error = true; continue; |
---|
| 455 | } |
---|
| 456 | |
---|
| 457 | if (updateQueue[qp] == NULL) |
---|
| 458 | { |
---|
| 459 | PSendSysMessage("item in bag: %d at slot: %d guid: %d has a queuepos (%d) that points to NULL in the queue!", bag->GetSlot(), item->GetSlot(), item->GetGUIDLow(), qp); |
---|
| 460 | error = true; continue; |
---|
| 461 | } |
---|
| 462 | |
---|
| 463 | if (updateQueue[qp] != item) |
---|
| 464 | { |
---|
| 465 | PSendSysMessage("item in bag: %d at slot: %d guid: %d has has a queuepos (%d) that points to another item in the queue (bag: %d, slot: %d, guid: %d)", bag->GetSlot(), item->GetSlot(), item->GetGUIDLow(), qp, updateQueue[qp]->GetBagSlot(), updateQueue[qp]->GetSlot(), updateQueue[qp]->GetGUIDLow()); |
---|
| 466 | error = true; continue; |
---|
| 467 | } |
---|
| 468 | } |
---|
| 469 | else if (item->GetState() != ITEM_UNCHANGED) |
---|
| 470 | { |
---|
| 471 | PSendSysMessage("item in bag: %d at slot: %d guid: %d is not in queue but should be (state: %d)!", bag->GetSlot(), item->GetSlot(), item->GetGUIDLow(), item->GetState()); |
---|
| 472 | error = true; continue; |
---|
| 473 | } |
---|
| 474 | } |
---|
| 475 | } |
---|
| 476 | } |
---|
| 477 | |
---|
| 478 | for(size_t i = 0; i < updateQueue.size(); i++) |
---|
| 479 | { |
---|
| 480 | Item *item = updateQueue[i]; |
---|
| 481 | if(!item) continue; |
---|
| 482 | |
---|
| 483 | if (item->GetOwnerGUID() != player->GetGUID()) |
---|
| 484 | { |
---|
| 485 | PSendSysMessage("queue(%d): for the an item (guid %d), the owner's guid (%d) and player's guid (%d) don't match!", i, item->GetGUIDLow(), GUID_LOPART(item->GetOwnerGUID()), player->GetGUIDLow()); |
---|
| 486 | error = true; continue; |
---|
| 487 | } |
---|
| 488 | |
---|
| 489 | if (item->GetQueuePos() != i) |
---|
| 490 | { |
---|
| 491 | PSendSysMessage("queue(%d): for the an item (guid %d), the queuepos doesn't match it's position in the queue!", i, item->GetGUIDLow()); |
---|
| 492 | error = true; continue; |
---|
| 493 | } |
---|
| 494 | |
---|
| 495 | if (item->GetState() == ITEM_REMOVED) continue; |
---|
| 496 | Item *test = player->GetItemByPos( item->GetBagSlot(), item->GetSlot()); |
---|
| 497 | |
---|
| 498 | if (test == NULL) |
---|
| 499 | { |
---|
| 500 | PSendSysMessage("queue(%d): the bag(%d) and slot(%d) values for the item with guid %d are incorrect, the player doesn't have an item at that position!", i, item->GetBagSlot(), item->GetSlot(), item->GetGUIDLow()); |
---|
| 501 | error = true; continue; |
---|
| 502 | } |
---|
| 503 | |
---|
| 504 | if (test != item) |
---|
| 505 | { |
---|
| 506 | PSendSysMessage("queue(%d): the bag(%d) and slot(%d) values for the item with guid %d are incorrect, the item with guid %d is there instead!", i, item->GetBagSlot(), item->GetSlot(), item->GetGUIDLow(), test->GetGUIDLow()); |
---|
| 507 | error = true; continue; |
---|
| 508 | } |
---|
| 509 | } |
---|
| 510 | if (!error) |
---|
| 511 | SendSysMessage("All OK!"); |
---|
| 512 | } |
---|
| 513 | |
---|
| 514 | return true; |
---|
| 515 | } |
---|
[9] | 516 | |
---|
| 517 | bool ChatHandler::HandleDebugArenaCommand(const char * /*args*/) |
---|
| 518 | { |
---|
| 519 | sBattleGroundMgr.ToggleArenaTesting(); |
---|
| 520 | return true; |
---|
| 521 | } |
---|