debug recv Command added

This commit is contained in:
Olion17 2019-01-10 13:26:12 +00:00 committed by Antz
parent 0c44b9d0e0
commit 1dc436398d
4 changed files with 104 additions and 5 deletions

View file

@ -144,6 +144,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();
@ -212,9 +301,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());
@ -226,7 +323,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());

View file

@ -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,

View file

@ -257,6 +257,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 },

View file

@ -244,6 +244,7 @@ class ChatHandler
bool HandleDebugPlayMovieCommand(char* args);
bool HandleDebugPlaySoundCommand(char* args);
bool HandleDebugRecvOpcodeCommand(char* args);
bool HandleDebugSendBuyErrorCommand(char* args);
bool HandleDebugSendChannelNotifyCommand(char* args);
bool HandleDebugSendChatMsgCommand(char* args);