mirror of
https://github.com/TrinityCore/TrinityCore.git
synced 2026-01-23 18:36:31 +01:00
[8167] Use more consistence debug command handler names and move its code to debugcmds.cpp Author: VladimirMangos
--HG-- branch : trunk
This commit is contained in:
@@ -4942,57 +4942,6 @@ bool ChatHandler::HandleHideAreaCommand(const char* args)
|
||||
return true;
|
||||
}
|
||||
|
||||
bool ChatHandler::HandleDebugUpdate(const char* args)
|
||||
{
|
||||
if(!*args)
|
||||
return false;
|
||||
|
||||
uint32 updateIndex;
|
||||
uint32 value;
|
||||
|
||||
char* pUpdateIndex = strtok((char*)args, " ");
|
||||
|
||||
Unit* chr = getSelectedUnit();
|
||||
if (chr == NULL)
|
||||
{
|
||||
SendSysMessage(LANG_SELECT_CHAR_OR_CREATURE);
|
||||
SetSentErrorMessage(true);
|
||||
return false;
|
||||
}
|
||||
|
||||
if(!pUpdateIndex)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
updateIndex = atoi(pUpdateIndex);
|
||||
//check updateIndex
|
||||
if(chr->GetTypeId() == TYPEID_PLAYER)
|
||||
{
|
||||
if (updateIndex>=PLAYER_END) return true;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (updateIndex>=UNIT_END) return true;
|
||||
}
|
||||
|
||||
char* pvalue = strtok(NULL, " ");
|
||||
if (!pvalue)
|
||||
{
|
||||
value=chr->GetUInt32Value(updateIndex);
|
||||
|
||||
PSendSysMessage(LANG_UPDATE, chr->GetGUIDLow(),updateIndex,value);
|
||||
return true;
|
||||
}
|
||||
|
||||
value=atoi(pvalue);
|
||||
|
||||
PSendSysMessage(LANG_UPDATE_CHANGE, chr->GetGUIDLow(),updateIndex,value);
|
||||
|
||||
chr->SetUInt32Value(updateIndex,value);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
bool ChatHandler::HandleBankCommand(const char* /*args*/)
|
||||
{
|
||||
m_session->SendShowBank( m_session->GetPlayer()->GetGUID() );
|
||||
@@ -5042,106 +4991,6 @@ bool ChatHandler::HandleChangeWeather(const char* args)
|
||||
return true;
|
||||
}
|
||||
|
||||
bool ChatHandler::HandleDebugSetValue(const char* args)
|
||||
{
|
||||
if(!*args)
|
||||
return false;
|
||||
|
||||
char* px = strtok((char*)args, " ");
|
||||
char* py = strtok(NULL, " ");
|
||||
char* pz = strtok(NULL, " ");
|
||||
|
||||
if (!px || !py)
|
||||
return false;
|
||||
|
||||
WorldObject* target = getSelectedObject();
|
||||
if(!target)
|
||||
{
|
||||
SendSysMessage(LANG_SELECT_CHAR_OR_CREATURE);
|
||||
SetSentErrorMessage(true);
|
||||
return false;
|
||||
}
|
||||
|
||||
uint64 guid = target->GetGUID();
|
||||
|
||||
uint32 Opcode = (uint32)atoi(px);
|
||||
if(Opcode >= target->GetValuesCount())
|
||||
{
|
||||
PSendSysMessage(LANG_TOO_BIG_INDEX, Opcode, GUID_LOPART(guid), target->GetValuesCount());
|
||||
return false;
|
||||
}
|
||||
uint32 iValue;
|
||||
float fValue;
|
||||
bool isint32 = true;
|
||||
if(pz)
|
||||
isint32 = (bool)atoi(pz);
|
||||
if(isint32)
|
||||
{
|
||||
iValue = (uint32)atoi(py);
|
||||
sLog.outDebug(GetTrinityString(LANG_SET_UINT), GUID_LOPART(guid), Opcode, iValue);
|
||||
target->SetUInt32Value( Opcode , iValue );
|
||||
PSendSysMessage(LANG_SET_UINT_FIELD, GUID_LOPART(guid), Opcode,iValue);
|
||||
}
|
||||
else
|
||||
{
|
||||
fValue = (float)atof(py);
|
||||
sLog.outDebug(GetTrinityString(LANG_SET_FLOAT), GUID_LOPART(guid), Opcode, fValue);
|
||||
target->SetFloatValue( Opcode , fValue );
|
||||
PSendSysMessage(LANG_SET_FLOAT_FIELD, GUID_LOPART(guid), Opcode,fValue);
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
bool ChatHandler::HandleDebugGetValue(const char* args)
|
||||
{
|
||||
if(!*args)
|
||||
return false;
|
||||
|
||||
char* px = strtok((char*)args, " ");
|
||||
char* pz = strtok(NULL, " ");
|
||||
|
||||
if (!px)
|
||||
return false;
|
||||
|
||||
Unit* target = getSelectedUnit();
|
||||
if(!target)
|
||||
{
|
||||
SendSysMessage(LANG_SELECT_CHAR_OR_CREATURE);
|
||||
SetSentErrorMessage(true);
|
||||
return false;
|
||||
}
|
||||
|
||||
uint64 guid = target->GetGUID();
|
||||
|
||||
uint32 Opcode = (uint32)atoi(px);
|
||||
if(Opcode >= target->GetValuesCount())
|
||||
{
|
||||
PSendSysMessage(LANG_TOO_BIG_INDEX, Opcode, GUID_LOPART(guid), target->GetValuesCount());
|
||||
return false;
|
||||
}
|
||||
uint32 iValue;
|
||||
float fValue;
|
||||
bool isint32 = true;
|
||||
if(pz)
|
||||
isint32 = (bool)atoi(pz);
|
||||
|
||||
if(isint32)
|
||||
{
|
||||
iValue = target->GetUInt32Value( Opcode );
|
||||
sLog.outDebug(GetTrinityString(LANG_GET_UINT), GUID_LOPART(guid), Opcode, iValue);
|
||||
PSendSysMessage(LANG_GET_UINT_FIELD, GUID_LOPART(guid), Opcode, iValue);
|
||||
}
|
||||
else
|
||||
{
|
||||
fValue = target->GetFloatValue( Opcode );
|
||||
sLog.outDebug(GetTrinityString(LANG_GET_FLOAT), GUID_LOPART(guid), Opcode, fValue);
|
||||
PSendSysMessage(LANG_GET_FLOAT_FIELD, GUID_LOPART(guid), Opcode, fValue);
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
bool ChatHandler::HandleDebugSet32Bit(const char* args)
|
||||
{
|
||||
if(!*args)
|
||||
@@ -5175,38 +5024,6 @@ bool ChatHandler::HandleDebugSet32Bit(const char* args)
|
||||
return true;
|
||||
}
|
||||
|
||||
bool ChatHandler::HandleDebugMod32Value(const char* args)
|
||||
{
|
||||
if(!*args)
|
||||
return false;
|
||||
|
||||
char* px = strtok((char*)args, " ");
|
||||
char* py = strtok(NULL, " ");
|
||||
|
||||
if (!px || !py)
|
||||
return false;
|
||||
|
||||
uint32 Opcode = (uint32)atoi(px);
|
||||
int Value = atoi(py);
|
||||
|
||||
if(Opcode >= m_session->GetPlayer()->GetValuesCount())
|
||||
{
|
||||
PSendSysMessage(LANG_TOO_BIG_INDEX, Opcode, m_session->GetPlayer()->GetGUIDLow(), m_session->GetPlayer( )->GetValuesCount());
|
||||
return false;
|
||||
}
|
||||
|
||||
sLog.outDebug(GetTrinityString(LANG_CHANGE_32BIT), Opcode, Value);
|
||||
|
||||
int CurrentValue = (int)m_session->GetPlayer( )->GetUInt32Value( Opcode );
|
||||
|
||||
CurrentValue += Value;
|
||||
m_session->GetPlayer( )->SetUInt32Value( Opcode , (uint32)CurrentValue );
|
||||
|
||||
PSendSysMessage(LANG_CHANGE_32BIT_FIELD, Opcode,CurrentValue);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
bool ChatHandler::HandleTeleAddCommand(const char * args)
|
||||
{
|
||||
if(!*args)
|
||||
|
||||
Reference in New Issue
Block a user