mirror of
https://github.com/mangosfour/server.git
synced 2025-12-13 04:37:00 +00:00
[8083] New debug command: .debug setaurastate for test target/caster aura states.
Also fix wrong (!args) checks in debug commands.
This commit is contained in:
parent
df064ebd9f
commit
97721109ff
4 changed files with 65 additions and 33 deletions
|
|
@ -33,7 +33,7 @@
|
|||
|
||||
bool ChatHandler::HandleDebugSendSpellFailCommand(const char* args)
|
||||
{
|
||||
if(!args)
|
||||
if (!*args)
|
||||
return false;
|
||||
|
||||
char* px = strtok((char*)args, " ");
|
||||
|
|
@ -41,7 +41,7 @@ bool ChatHandler::HandleDebugSendSpellFailCommand(const char* args)
|
|||
return false;
|
||||
|
||||
uint8 failnum = (uint8)atoi(px);
|
||||
if(failnum==0 && *px!='0')
|
||||
if (failnum==0 && *px!='0')
|
||||
return false;
|
||||
|
||||
char* p1 = strtok(NULL, " ");
|
||||
|
|
@ -66,20 +66,20 @@ bool ChatHandler::HandleDebugSendSpellFailCommand(const char* args)
|
|||
|
||||
bool ChatHandler::HandleDebugSendPoiCommand(const char* args)
|
||||
{
|
||||
if (!*args)
|
||||
return false;
|
||||
|
||||
Player *pPlayer = m_session->GetPlayer();
|
||||
Unit* target = getSelectedUnit();
|
||||
if(!target)
|
||||
if (!target)
|
||||
{
|
||||
SendSysMessage(LANG_SELECT_CHAR_OR_CREATURE);
|
||||
return true;
|
||||
}
|
||||
|
||||
if(!args)
|
||||
return false;
|
||||
|
||||
char* icon_text = strtok((char*)args, " ");
|
||||
char* flags_text = strtok(NULL, " ");
|
||||
if(!icon_text || !flags_text)
|
||||
if (!icon_text || !flags_text)
|
||||
return false;
|
||||
|
||||
uint32 icon = atol(icon_text);
|
||||
|
|
@ -92,7 +92,7 @@ bool ChatHandler::HandleDebugSendPoiCommand(const char* args)
|
|||
|
||||
bool ChatHandler::HandleDebugSendEquipErrorCommand(const char* args)
|
||||
{
|
||||
if(!args)
|
||||
if (!*args)
|
||||
return false;
|
||||
|
||||
uint8 msg = atoi(args);
|
||||
|
|
@ -102,7 +102,7 @@ bool ChatHandler::HandleDebugSendEquipErrorCommand(const char* args)
|
|||
|
||||
bool ChatHandler::HandleDebugSendSellErrorCommand(const char* args)
|
||||
{
|
||||
if(!args)
|
||||
if (!*args)
|
||||
return false;
|
||||
|
||||
uint8 msg = atoi(args);
|
||||
|
|
@ -112,7 +112,7 @@ bool ChatHandler::HandleDebugSendSellErrorCommand(const char* args)
|
|||
|
||||
bool ChatHandler::HandleDebugSendBuyErrorCommand(const char* args)
|
||||
{
|
||||
if(!args)
|
||||
if (!*args)
|
||||
return false;
|
||||
|
||||
uint8 msg = atoi(args);
|
||||
|
|
@ -127,7 +127,7 @@ bool ChatHandler::HandleDebugSendOpcodeCommand(const char* /*args*/)
|
|||
unit = m_session->GetPlayer();
|
||||
|
||||
std::ifstream ifs("opcode.txt");
|
||||
if(ifs.bad())
|
||||
if (ifs.bad())
|
||||
return false;
|
||||
|
||||
uint32 opcode;
|
||||
|
|
@ -215,7 +215,7 @@ bool ChatHandler::HandleDebugPlayCinematicCommand(const char* args)
|
|||
{
|
||||
// USAGE: .debug play cinematic #cinematicid
|
||||
// #cinematicid - ID decimal number from CinemaicSequences.dbc (1st column)
|
||||
if( !*args )
|
||||
if (!*args)
|
||||
{
|
||||
SendSysMessage(LANG_BAD_VALUE);
|
||||
SetSentErrorMessage(true);
|
||||
|
|
@ -224,7 +224,7 @@ bool ChatHandler::HandleDebugPlayCinematicCommand(const char* args)
|
|||
|
||||
uint32 dwId = atoi((char*)args);
|
||||
|
||||
if(!sCinematicSequencesStore.LookupEntry(dwId))
|
||||
if (!sCinematicSequencesStore.LookupEntry(dwId))
|
||||
{
|
||||
PSendSysMessage(LANG_CINEMATIC_NOT_EXIST, dwId);
|
||||
SetSentErrorMessage(true);
|
||||
|
|
@ -239,7 +239,7 @@ bool ChatHandler::HandleDebugPlayMovieCommand(const char* args)
|
|||
{
|
||||
// USAGE: .debug play movie #movieid
|
||||
// #movieid - ID decimal number from Movie.dbc (1st column)
|
||||
if( !*args )
|
||||
if (!*args)
|
||||
{
|
||||
SendSysMessage(LANG_BAD_VALUE);
|
||||
SetSentErrorMessage(true);
|
||||
|
|
@ -248,7 +248,7 @@ bool ChatHandler::HandleDebugPlayMovieCommand(const char* args)
|
|||
|
||||
uint32 dwId = atoi((char*)args);
|
||||
|
||||
if(!sMovieStore.LookupEntry(dwId))
|
||||
if (!sMovieStore.LookupEntry(dwId))
|
||||
{
|
||||
PSendSysMessage(LANG_MOVIE_NOT_EXIST, dwId);
|
||||
SetSentErrorMessage(true);
|
||||
|
|
@ -264,7 +264,7 @@ bool ChatHandler::HandleDebugPlaySoundCommand(const char* args)
|
|||
{
|
||||
// USAGE: .debug playsound #soundid
|
||||
// #soundid - ID decimal number from SoundEntries.dbc (1st column)
|
||||
if( !*args )
|
||||
if (!*args)
|
||||
{
|
||||
SendSysMessage(LANG_BAD_VALUE);
|
||||
SetSentErrorMessage(true);
|
||||
|
|
@ -273,7 +273,7 @@ bool ChatHandler::HandleDebugPlaySoundCommand(const char* args)
|
|||
|
||||
uint32 dwSoundId = atoi((char*)args);
|
||||
|
||||
if(!sSoundEntriesStore.LookupEntry(dwSoundId))
|
||||
if (!sSoundEntriesStore.LookupEntry(dwSoundId))
|
||||
{
|
||||
PSendSysMessage(LANG_SOUND_NOT_EXIST, dwSoundId);
|
||||
SetSentErrorMessage(true);
|
||||
|
|
@ -281,14 +281,14 @@ bool ChatHandler::HandleDebugPlaySoundCommand(const char* args)
|
|||
}
|
||||
|
||||
Unit* unit = getSelectedUnit();
|
||||
if(!unit)
|
||||
if (!unit)
|
||||
{
|
||||
SendSysMessage(LANG_SELECT_CHAR_OR_CREATURE);
|
||||
SetSentErrorMessage(true);
|
||||
return false;
|
||||
}
|
||||
|
||||
if(m_session->GetPlayer()->GetSelection())
|
||||
if (m_session->GetPlayer()->GetSelection())
|
||||
unit->PlayDistanceSound(dwSoundId,m_session->GetPlayer());
|
||||
else
|
||||
unit->PlayDirectSound(dwSoundId,m_session->GetPlayer());
|
||||
|
|
@ -300,7 +300,7 @@ bool ChatHandler::HandleDebugPlaySoundCommand(const char* args)
|
|||
//Send notification in channel
|
||||
bool ChatHandler::HandleDebugSendChannelNotifyCommand(const char* args)
|
||||
{
|
||||
if(!args)
|
||||
if (!*args)
|
||||
return false;
|
||||
|
||||
const char *name = "test";
|
||||
|
|
@ -318,7 +318,7 @@ bool ChatHandler::HandleDebugSendChannelNotifyCommand(const char* args)
|
|||
//Send notification in chat
|
||||
bool ChatHandler::HandleDebugSendChatMsgCommand(const char* args)
|
||||
{
|
||||
if(!args)
|
||||
if (!*args)
|
||||
return false;
|
||||
|
||||
const char *msg = "testtest";
|
||||
|
|
@ -339,7 +339,7 @@ bool ChatHandler::HandleDebugSendQuestPartyMsgCommand(const char* args)
|
|||
bool ChatHandler::HandleDebugGetLootRecipient(const char* /*args*/)
|
||||
{
|
||||
Creature* target = getSelectedCreature();
|
||||
if(!target)
|
||||
if (!target)
|
||||
return false;
|
||||
|
||||
PSendSysMessage("loot recipient: %s", target->hasLootRecipient()?(target->GetLootRecipient()?target->GetLootRecipient()->GetName():"offline"):"no loot recipient");
|
||||
|
|
@ -355,7 +355,7 @@ bool ChatHandler::HandleDebugSendQuestInvalidMsgCommand(const char* args)
|
|||
|
||||
bool ChatHandler::HandleDebugGetItemState(const char* args)
|
||||
{
|
||||
if (!args)
|
||||
if (!*args)
|
||||
return false;
|
||||
|
||||
std::string state_str = args;
|
||||
|
|
@ -601,7 +601,7 @@ bool ChatHandler::HandleDebugArenaCommand(const char * /*args*/)
|
|||
|
||||
bool ChatHandler::HandleDebugSpawnVehicle(const char* args)
|
||||
{
|
||||
if(!args)
|
||||
if (!*args)
|
||||
return false;
|
||||
|
||||
char* e = strtok((char*)args, " ");
|
||||
|
|
@ -615,17 +615,17 @@ bool ChatHandler::HandleDebugSpawnVehicle(const char* args)
|
|||
|
||||
CreatureInfo const *ci = objmgr.GetCreatureTemplate(entry);
|
||||
|
||||
if(!ci)
|
||||
if (!ci)
|
||||
return false;
|
||||
|
||||
VehicleEntry const *ve = sVehicleStore.LookupEntry(id);
|
||||
|
||||
if(!ve)
|
||||
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()))
|
||||
if (!v->Create(objmgr.GenerateLowGuid(HIGHGUID_VEHICLE), map, entry, id, m_session->GetPlayer()->GetTeam()))
|
||||
{
|
||||
delete v;
|
||||
return false;
|
||||
|
|
@ -636,7 +636,7 @@ bool ChatHandler::HandleDebugSpawnVehicle(const char* args)
|
|||
|
||||
v->Relocate(px, py, pz, m_session->GetPlayer()->GetOrientation());
|
||||
|
||||
if(!v->IsPositionValid())
|
||||
if (!v->IsPositionValid())
|
||||
{
|
||||
sLog.outError("Vehicle (guidlow %d, entry %d) not created. Suggested coordinates isn't valid (X: %f Y: %f)",
|
||||
v->GetGUIDLow(), v->GetEntry(), v->GetPositionX(), v->GetPositionY());
|
||||
|
|
@ -661,7 +661,7 @@ bool ChatHandler::HandleDebugSendLargePacketCommand(const char* /*args*/)
|
|||
|
||||
bool ChatHandler::HandleDebugSendSetPhaseShiftCommand(const char* args)
|
||||
{
|
||||
if(!args)
|
||||
if (!*args)
|
||||
return false;
|
||||
|
||||
uint32 PhaseShift = atoi(args);
|
||||
|
|
@ -671,7 +671,7 @@ bool ChatHandler::HandleDebugSendSetPhaseShiftCommand(const char* args)
|
|||
|
||||
bool ChatHandler::HandleDebugSetItemFlagCommand(const char* args)
|
||||
{
|
||||
if(!args)
|
||||
if (!*args)
|
||||
return false;
|
||||
|
||||
char* e = strtok((char*)args, " ");
|
||||
|
|
@ -685,7 +685,7 @@ bool ChatHandler::HandleDebugSetItemFlagCommand(const char* args)
|
|||
|
||||
Item *i = m_session->GetPlayer()->GetItemByGuid(MAKE_NEW_GUID(guid, 0, HIGHGUID_ITEM));
|
||||
|
||||
if(!i)
|
||||
if (!i)
|
||||
return false;
|
||||
|
||||
i->SetUInt32Value(ITEM_FIELD_FLAGS, flag);
|
||||
|
|
@ -703,3 +703,33 @@ bool ChatHandler::HandleDebugAnimCommand(const char* args)
|
|||
m_session->GetPlayer()->HandleEmoteCommand(anim_id);
|
||||
return true;
|
||||
}
|
||||
|
||||
bool ChatHandler::HandleDebugSetAuraStateCommand(const char* args)
|
||||
{
|
||||
if (!*args)
|
||||
{
|
||||
SendSysMessage(LANG_BAD_VALUE);
|
||||
SetSentErrorMessage(true);
|
||||
return false;
|
||||
}
|
||||
|
||||
Unit* unit = getSelectedUnit();
|
||||
if (!unit)
|
||||
{
|
||||
SendSysMessage(LANG_SELECT_CHAR_OR_CREATURE);
|
||||
SetSentErrorMessage(true);
|
||||
return false;
|
||||
}
|
||||
|
||||
int32 state = atoi((char*)args);
|
||||
if (!state)
|
||||
{
|
||||
// reset all states
|
||||
for(int i = 1; i <= 32; ++i)
|
||||
unit->ModifyAuraState(AuraState(i),false);
|
||||
return true;
|
||||
}
|
||||
|
||||
unit->ModifyAuraState(AuraState(abs(state)),state > 0);
|
||||
return true;
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue