*Update of some debug command.

--HG--
branch : trunk
This commit is contained in:
megamage
2009-02-24 21:06:12 -06:00
parent 0f9afd76a1
commit 8770a90bc6
2 changed files with 31 additions and 11 deletions

View File

@@ -132,8 +132,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 +196,22 @@ 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 if(type == "mypos")
{
data << player->GetPositionX();
data << player->GetPositionY();
data << player->GetPositionZ();
}
else
{
sLog.outDebug("Sending opcode: unknown type '%s'", type.c_str());