Permalink
Browse files

debug recv Command added

  • Loading branch information...
Olion17 authored and billy1arm committed Jan 10, 2019
1 parent 1946865 commit 75016c50b79e536b0a156caa47786d5fd5bfd89e
@@ -121,6 +121,95 @@ bool ChatHandler::HandleDebugSendBuyErrorCommand(char* args)
return true;
}

bool ChatHandler::HandleDebugRecvOpcodeCommand(char* /*args*/)
{
Unit* unit = getSelectedUnit();
if (!unit || (unit->GetTypeId() != TYPEID_PLAYER))
{ unit = m_session->GetPlayer(); }

std::ifstream stream("ropcode.txt");
if (!stream.is_open())
{ return false; }

uint32 opcode = 0;
if (!(stream >> opcode))
{
stream.close();
return false;
}

WorldPacket *data = new WorldPacket(opcode, 10);

std::string type;
while (stream >> type)
{
if (type.empty())
{ break; }

if (type == "uint8")
{
uint16 value;
stream >> value;
*data << uint8(value);
}
else if (type == "uint16")
{
uint16 value;
stream >> value;
*data << value;
}
else if (type == "uint32")
{
uint32 value;
stream >> value;
*data << value;
}
else if (type == "uint64")
{
uint64 value;
stream >> value;
*data << value;
}
else if (type == "float")
{
float value;
stream >> value;
*data << value;
}
else if (type == "string")
{
std::string value;
stream >> value;
*data << value;
}
else if (type == "pguid")
{ *data << unit->GetPackGUID(); }
else if (type == "guid")
{ *data << unit->GetObjectGuid(); }
else if (type == "mypguid")
{ *data << m_session->GetPlayer()->GetPackGUID(); }
else if (type == "myguid")
{ *data << m_session->GetPlayer()->GetObjectGuid(); }
else if (type == "name")
{ *data << unit->GetName(); }
else if (type == "myname")
{ *data << m_session->GetPlayerName(); }
else
{
DEBUG_LOG("Sending opcode: unknown type '%s'", type.c_str());
break;
}
}
stream.close();

DEBUG_LOG("Queued opcode %u, %s", data->GetOpcode(), data->GetOpcodeName());

m_session->QueuePacket(data);

PSendSysMessage(LANG_COMMAND_OPCODEGOT, data->GetOpcode(), unit->GetName());
return true;
}

bool ChatHandler::HandleDebugSendOpcodeCommand(char* /*args*/)
{
Unit* unit = getSelectedUnit();
@@ -183,9 +272,17 @@ bool ChatHandler::HandleDebugSendOpcodeCommand(char* /*args*/)
data << value;
}
else if (type == "pguid")
{
data << unit->GetPackGUID();
}
{ data << unit->GetPackGUID(); }
else if (type == "guid")
{ data << unit->GetObjectGuid(); }
else if(type == "mypguid")
{ data << m_session->GetPlayer()->GetPackGUID(); }
else if (type == "myguid")
{ data << m_session->GetPlayer()->GetObjectGuid(); }
else if (type == "name")
{ data << unit->GetName(); }
else if (type == "myname")
{ data << m_session->GetPlayerName(); }
else
{
DEBUG_LOG("Sending opcode: unknown type '%s'", type.c_str());
@@ -197,7 +294,7 @@ bool ChatHandler::HandleDebugSendOpcodeCommand(char* /*args*/)
DEBUG_LOG("Sending opcode %u, %s", data.GetOpcode(), data.GetOpcodeName());

data.hexlike();
((Player*)unit)->GetSession()->SendPacket(&data);
unit->ToPlayer()->SendDirectMessage(&data);

PSendSysMessage(LANG_COMMAND_OPCODESENT, data.GetOpcode(), unit->GetName());

@@ -578,7 +578,7 @@ enum MangosStrings
LANG_YOURS_EXPLORE_SET_ALL = 553,
LANG_YOURS_EXPLORE_SET_NOTHING = 554,

// 555, // not used
LANG_COMMAND_OPCODEGOT = 555,
// 556, // not used
LANG_YOURS_LEVEL_UP = 557,
LANG_YOURS_LEVEL_DOWN = 558,
@@ -227,6 +227,7 @@ ChatCommand* ChatHandler::getCommandTable()
{ "moditemvalue", SEC_ADMINISTRATOR, false, &ChatHandler::HandleDebugModItemValueCommand, "", NULL },
{ "modvalue", SEC_ADMINISTRATOR, false, &ChatHandler::HandleDebugModValueCommand, "", NULL },
{ "play", SEC_MODERATOR, false, NULL, "", debugPlayCommandTable },
{ "recv", SEC_ADMINISTRATOR, false, &ChatHandler::HandleDebugRecvOpcodeCommand, "", NULL },
{ "send", SEC_ADMINISTRATOR, false, NULL, "", debugSendCommandTable },
{ "setaurastate", SEC_ADMINISTRATOR, false, &ChatHandler::HandleDebugSetAuraStateCommand, "", NULL },
{ "setitemvalue", SEC_ADMINISTRATOR, false, &ChatHandler::HandleDebugSetItemValueCommand, "", NULL },
@@ -227,6 +227,7 @@ class ChatHandler
bool HandleDebugPlayCinematicCommand(char* args);
bool HandleDebugPlaySoundCommand(char* args);

bool HandleDebugRecvOpcodeCommand(char* args);
bool HandleDebugSendBuyErrorCommand(char* args);
bool HandleDebugSendChannelNotifyCommand(char* args);
bool HandleDebugSendChatMsgCommand(char* args);
@@ -24,7 +24,7 @@

#ifndef MANGOS_H_REVISION
#define MANGOS_H_REVISION
#define REVISION_NR "2110001"
#define REVISION_NR "2110002"

#define REALMD_DB_VERSION_NR 21
#define REALMD_DB_STRUCTURE_NR 1
@@ -38,6 +38,6 @@

#define WORLD_DB_VERSION_NR 21
#define WORLD_DB_STRUCTURE_NR 10
#define WORLD_DB_CONTENT_NR 1
#define WORLD_DB_UPDATE_DESCRIPTION "quest_relations"
#define WORLD_DB_CONTENT_NR 2
#define WORLD_DB_UPDATE_DESCRIPTION "debug recv Command"
#endif // __REVISION_H__

0 comments on commit 75016c5

Please sign in to comment.