diff options
Diffstat (limited to 'src/game/debugcmds.cpp')
-rw-r--r-- | src/game/debugcmds.cpp | 77 |
1 files changed, 75 insertions, 2 deletions
diff --git a/src/game/debugcmds.cpp b/src/game/debugcmds.cpp index daa8a2f8fa3..0492a85a8f4 100644 --- a/src/game/debugcmds.cpp +++ b/src/game/debugcmds.cpp @@ -63,6 +63,7 @@ bool ChatHandler::HandleDebugSpellFailCommand(const char* args) uint8 failnum = (uint8)atoi(px); WorldPacket data(SMSG_CAST_FAILED, 5); + data << uint8(0); data << uint32(133); data << uint8(failnum); m_session->SendPacket(&data); @@ -132,8 +133,12 @@ bool ChatHandler::HandleBuyErrorCommand(const char* args) bool ChatHandler::HandleSendOpcodeCommand(const char* /*args*/) { Unit *unit = getSelectedUnit(); + Player *player = NULL; if (!unit || (unit->GetTypeId() != TYPEID_PLAYER)) - unit = m_session->GetPlayer(); + player = m_session->GetPlayer(); + else + player = (Player*)unit; + if(!unit) unit = player; std::ifstream ifs("opcode.txt"); if(ifs.bad()) @@ -192,6 +197,14 @@ bool ChatHandler::HandleSendOpcodeCommand(const char* /*args*/) { data.append(unit->GetPackGUID()); } + else if(type == "myguid") + data.append(player->GetPackGUID()); + else if(type == "pos") + { + data << unit->GetPositionX(); + data << unit->GetPositionY(); + data << unit->GetPositionZ(); + } else { sLog.outDebug("Sending opcode: unknown type '%s'", type.c_str()); @@ -201,7 +214,7 @@ bool ChatHandler::HandleSendOpcodeCommand(const char* /*args*/) ifs.close(); sLog.outDebug("Sending opcode %u", data.GetOpcode()); data.hexlike(); - ((Player*)unit)->GetSession()->SendPacket(&data); + player->GetSession()->SendPacket(&data); PSendSysMessage(LANG_COMMAND_OPCODESENT, data.GetOpcode(), unit->GetName()); return true; } @@ -570,3 +583,63 @@ bool ChatHandler::HandleDebugHostilRefList(const char * /*args*/) SendSysMessage("End of hostil reference list."); return true; } + +bool ChatHandler::HandleSpawnVehicle(const char* args) +{ + if(!args) + return false; + + char* e = strtok((char*)args, " "); + char* i = strtok(NULL, " "); + + if (!e || !i) + return false; + + uint32 entry = (uint32)atoi(e); + uint32 id = (uint32)atoi(i); + + CreatureInfo const *ci = objmgr.GetCreatureTemplate(entry); + + if(!ci) + return false; + + VehicleEntry const *ve = sVehicleStore.LookupEntry(id); + + if(!ve) + return false; + + Vehicle *v = new Vehicle; + Map *map = m_session->GetPlayer()->GetMap(); + if(!v->Create(objmgr.GenerateLowGuid(HIGHGUID_VEHICLE), map, entry, id, m_session->GetPlayer()->GetTeam())) + { + delete v; + return false; + } + + float px, py, pz; + m_session->GetPlayer()->GetClosePoint(px, py, pz, m_session->GetPlayer()->GetObjectSize()); + + v->Relocate(px, py, pz, m_session->GetPlayer()->GetOrientation()); + + if(!v->IsPositionValid()) + { + sLog.outError("ERROR: Vehicle (guidlow %d, entry %d) not created. Suggested coordinates isn't valid (X: %f Y: %f)", + v->GetGUIDLow(), v->GetEntry(), v->GetPositionX(), v->GetPositionY()); + delete v; + return false; + } + + map->Add((Creature*)v); + + return true; +} + +bool ChatHandler::HandleSendLargePacketCommand(const char* args) +{ + const char* stuffingString = "This is a dummy string to push the packet's size beyond 128000 bytes. "; + std::ostringstream ss; + while(strlen(ss.str().c_str()) < 128000) + ss << stuffingString; + SendSysMessage(ss.str().c_str()); + return true; +} |