aboutsummaryrefslogtreecommitdiff
path: root/src/game/Debugcmds.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/game/Debugcmds.cpp')
-rw-r--r--src/game/Debugcmds.cpp178
1 files changed, 178 insertions, 0 deletions
diff --git a/src/game/Debugcmds.cpp b/src/game/Debugcmds.cpp
index a74750ebce9..97f90e33af4 100644
--- a/src/game/Debugcmds.cpp
+++ b/src/game/Debugcmds.cpp
@@ -17,6 +17,7 @@
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
+
#include "Common.h"
#include "Database/DatabaseEnv.h"
#include "WorldPacket.h"
@@ -37,20 +38,26 @@
#include "GridNotifiersImpl.h"
#include "SpellMgr.h"
#include "ScriptCalls.h"
+
bool ChatHandler::HandleDebugSendSpellFailCommand(const char* args)
{
if (!*args)
return false;
+
char* px = strtok((char*)args, " ");
if (!px)
return false;
+
uint8 failnum = (uint8)atoi(px);
if (failnum==0 && *px!='0')
return false;
+
char* p1 = strtok(NULL, " ");
uint8 failarg1 = p1 ? (uint8)atoi(p1) : 0;
+
char* p2 = strtok(NULL, " ");
uint8 failarg2 = p2 ? (uint8)atoi(p2) : 0;
+
WorldPacket data(SMSG_CAST_FAILED, 5);
data << uint8(0);
data << uint32(133);
@@ -59,13 +66,17 @@ bool ChatHandler::HandleDebugSendSpellFailCommand(const char* args)
data << uint32(failarg1);
if (p2)
data << uint32(failarg2);
+
m_session->SendPacket(&data);
+
return true;
}
+
bool ChatHandler::HandleDebugSendPoiCommand(const char* args)
{
if (!*args)
return false;
+
Player *pPlayer = m_session->GetPlayer();
Unit* target = getSelectedUnit();
if (!target)
@@ -73,40 +84,50 @@ bool ChatHandler::HandleDebugSendPoiCommand(const char* args)
SendSysMessage(LANG_SELECT_CHAR_OR_CREATURE);
return true;
}
+
char* icon_text = strtok((char*)args, " ");
char* flags_text = strtok(NULL, " ");
if (!icon_text || !flags_text)
return false;
+
uint32 icon = atol(icon_text);
uint32 flags = atol(flags_text);
+
sLog.outDetail("Command : POI, NPC = %u, icon = %u flags = %u", target->GetGUIDLow(), icon,flags);
pPlayer->PlayerTalkClass->SendPointOfInterest(target->GetPositionX(), target->GetPositionY(), Poi_Icon(icon), flags, 30, "Test POI");
return true;
}
+
bool ChatHandler::HandleDebugSendEquipErrorCommand(const char* args)
{
if (!*args)
return false;
+
uint8 msg = atoi(args);
m_session->GetPlayer()->SendEquipError(msg, 0, 0);
return true;
}
+
bool ChatHandler::HandleDebugSendSellErrorCommand(const char* args)
{
if (!*args)
return false;
+
uint8 msg = atoi(args);
m_session->GetPlayer()->SendSellError(msg, 0, 0, 0);
return true;
}
+
bool ChatHandler::HandleDebugSendBuyErrorCommand(const char* args)
{
if (!*args)
return false;
+
uint8 msg = atoi(args);
m_session->GetPlayer()->SendBuyError(msg, 0, 0, 0);
return true;
}
+
bool ChatHandler::HandleDebugSendOpcodeCommand(const char* /*args*/)
{
Unit *unit = getSelectedUnit();
@@ -116,18 +137,24 @@ bool ChatHandler::HandleDebugSendOpcodeCommand(const char* /*args*/)
else
player = (Player*)unit;
if(!unit) unit = player;
+
std::ifstream ifs("opcode.txt");
if (ifs.bad())
return false;
+
uint32 opcode;
ifs >> opcode;
+
WorldPacket data(opcode, 0);
+
while(!ifs.eof())
{
std::string type;
ifs >> type;
+
if(type == "")
break;
+
if(type == "uint8")
{
uint16 val1;
@@ -229,17 +256,21 @@ bool ChatHandler::HandleDebugSendOpcodeCommand(const char* /*args*/)
PSendSysMessage(LANG_COMMAND_OPCODESENT, data.GetOpcode(), unit->GetName());
return true;
}
+
bool ChatHandler::HandleDebugUpdateWorldStateCommand(const char* args)
{
char* w = strtok((char*)args, " ");
char* s = strtok(NULL, " ");
+
if (!w || !s)
return false;
+
uint32 world = (uint32)atoi(w);
uint32 state = (uint32)atoi(s);
m_session->GetPlayer()->SendUpdateWorldState(world, state);
return true;
}
+
bool ChatHandler::HandleDebugPlayCinematicCommand(const char* args)
{
// USAGE: .debug play cinematic #cinematicid
@@ -250,16 +281,20 @@ bool ChatHandler::HandleDebugPlayCinematicCommand(const char* args)
SetSentErrorMessage(true);
return false;
}
+
uint32 dwId = atoi((char*)args);
+
if (!sCinematicSequencesStore.LookupEntry(dwId))
{
PSendSysMessage(LANG_CINEMATIC_NOT_EXIST, dwId);
SetSentErrorMessage(true);
return false;
}
+
m_session->GetPlayer()->SendCinematicStart(dwId);
return true;
}
+
bool ChatHandler::HandleDebugPlayMovieCommand(const char* args)
{
// USAGE: .debug play movie #movieid
@@ -270,16 +305,20 @@ bool ChatHandler::HandleDebugPlayMovieCommand(const char* args)
SetSentErrorMessage(true);
return false;
}
+
uint32 dwId = atoi((char*)args);
+
if (!sMovieStore.LookupEntry(dwId))
{
PSendSysMessage(LANG_MOVIE_NOT_EXIST, dwId);
SetSentErrorMessage(true);
return false;
}
+
m_session->GetPlayer()->SendMovieStart(dwId);
return true;
}
+
//Play sound
bool ChatHandler::HandleDebugPlaySoundCommand(const char* args)
{
@@ -291,13 +330,16 @@ bool ChatHandler::HandleDebugPlaySoundCommand(const char* args)
SetSentErrorMessage(true);
return false;
}
+
uint32 dwSoundId = atoi((char*)args);
+
if (!sSoundEntriesStore.LookupEntry(dwSoundId))
{
PSendSysMessage(LANG_SOUND_NOT_EXIST, dwSoundId);
SetSentErrorMessage(true);
return false;
}
+
Unit* unit = getSelectedUnit();
if (!unit)
{
@@ -305,20 +347,25 @@ bool ChatHandler::HandleDebugPlaySoundCommand(const char* args)
SetSentErrorMessage(true);
return false;
}
+
if (m_session->GetPlayer()->GetSelection())
unit->PlayDistanceSound(dwSoundId,m_session->GetPlayer());
else
unit->PlayDirectSound(dwSoundId,m_session->GetPlayer());
+
PSendSysMessage(LANG_YOU_HEAR_SOUND, dwSoundId);
return true;
}
+
//Send notification in channel
bool ChatHandler::HandleDebugSendChannelNotifyCommand(const char* args)
{
if (!*args)
return false;
+
const char *name = "test";
uint8 code = atoi(args);
+
WorldPacket data(SMSG_CHANNEL_NOTIFY, (1+10));
data << code; // notify type
data << name; // channel name
@@ -327,11 +374,13 @@ bool ChatHandler::HandleDebugSendChannelNotifyCommand(const char* args)
m_session->SendPacket(&data);
return true;
}
+
//Send notification in chat
bool ChatHandler::HandleDebugSendChatMsgCommand(const char* args)
{
if (!*args)
return false;
+
const char *msg = "testtest";
uint8 type = atoi(args);
WorldPacket data;
@@ -339,31 +388,38 @@ bool ChatHandler::HandleDebugSendChatMsgCommand(const char* args)
m_session->SendPacket(&data);
return true;
}
+
bool ChatHandler::HandleDebugSendQuestPartyMsgCommand(const char* args)
{
uint32 msg = atol((char*)args);
m_session->GetPlayer()->SendPushToPartyResponse(m_session->GetPlayer(), msg);
return true;
}
+
bool ChatHandler::HandleDebugGetLootRecipientCommand(const char* /*args*/)
{
Creature* target = getSelectedCreature();
if (!target)
return false;
+
PSendSysMessage("loot recipient: %s", target->hasLootRecipient()?(target->GetLootRecipient()?target->GetLootRecipient()->GetName():"offline"):"no loot recipient");
return true;
}
+
bool ChatHandler::HandleDebugSendQuestInvalidMsgCommand(const char* args)
{
uint32 msg = atol((char*)args);
m_session->GetPlayer()->SendCanTakeQuestResponse(msg);
return true;
}
+
bool ChatHandler::HandleDebugGetItemStateCommand(const char* args)
{
if (!*args)
return false;
+
std::string state_str = args;
+
ItemUpdateState state = ITEM_UNCHANGED;
bool list_queue = false, check_all = false;
if (state_str == "unchanged") state = ITEM_UNCHANGED;
@@ -373,8 +429,10 @@ bool ChatHandler::HandleDebugGetItemStateCommand(const char* args)
else if (state_str == "queue") list_queue = true;
else if (state_str == "check_all") check_all = true;
else return false;
+
Player* player = getSelectedPlayer();
if (!player) player = m_session->GetPlayer();
+
if (!list_queue && !check_all)
{
state_str = "The player has the following " + state_str + " items: ";
@@ -383,6 +441,7 @@ bool ChatHandler::HandleDebugGetItemStateCommand(const char* args)
{
if(i >= BUYBACK_SLOT_START && i < BUYBACK_SLOT_END)
continue;
+
Item *item = player->GetItemByPos(INVENTORY_SLOT_BAG_0, i);
if (!item) continue;
if (!item->IsBag())
@@ -402,6 +461,7 @@ bool ChatHandler::HandleDebugGetItemStateCommand(const char* args)
}
}
}
+
if (list_queue)
{
std::vector<Item *> &updateQueue = player->GetItemUpdateQueue();
@@ -409,8 +469,10 @@ bool ChatHandler::HandleDebugGetItemStateCommand(const char* args)
{
Item *item = updateQueue[i];
if(!item) continue;
+
Bag *container = item->GetContainer();
uint8 bag_slot = container ? container->GetSlot() : uint8(INVENTORY_SLOT_BAG_0);
+
std::string st;
switch(item->GetState())
{
@@ -419,11 +481,13 @@ bool ChatHandler::HandleDebugGetItemStateCommand(const char* args)
case ITEM_NEW: st = "new"; break;
case ITEM_REMOVED: st = "removed"; break;
}
+
PSendSysMessage("bag: %d slot: %d guid: %d - state: %s", bag_slot, item->GetSlot(), item->GetGUIDLow(), st.c_str());
}
if (updateQueue.empty())
PSendSysMessage("updatequeue empty");
}
+
if (check_all)
{
bool error = false;
@@ -432,23 +496,28 @@ bool ChatHandler::HandleDebugGetItemStateCommand(const char* args)
{
if(i >= BUYBACK_SLOT_START && i < BUYBACK_SLOT_END)
continue;
+
Item *item = player->GetItemByPos(INVENTORY_SLOT_BAG_0, i);
if (!item) continue;
+
if (item->GetSlot() != i)
{
PSendSysMessage("item at slot %d, guid %d has an incorrect slot value: %d", i, item->GetGUIDLow(), item->GetSlot());
error = true; continue;
}
+
if (item->GetOwnerGUID() != player->GetGUID())
{
PSendSysMessage("for the item at slot %d and itemguid %d, owner's guid (%d) and player's guid (%d) don't match!", item->GetSlot(), item->GetGUIDLow(), GUID_LOPART(item->GetOwnerGUID()), player->GetGUIDLow());
error = true; continue;
}
+
if (Bag *container = item->GetContainer())
{
PSendSysMessage("item at slot: %d guid: %d has a container (slot: %d, guid: %d) but shouldnt!", item->GetSlot(), item->GetGUIDLow(), container->GetSlot(), container->GetGUIDLow());
error = true; continue;
}
+
if (item->IsInUpdateQueue())
{
uint16 qp = item->GetQueuePos();
@@ -457,11 +526,13 @@ bool ChatHandler::HandleDebugGetItemStateCommand(const char* args)
PSendSysMessage("item at slot: %d guid: %d has a queuepos (%d) larger than the update queue size! ", item->GetSlot(), item->GetGUIDLow(), qp);
error = true; continue;
}
+
if (updateQueue[qp] == NULL)
{
PSendSysMessage("item at slot: %d guid: %d has a queuepos (%d) that points to NULL in the queue!", item->GetSlot(), item->GetGUIDLow(), qp);
error = true; continue;
}
+
if (updateQueue[qp] != item)
{
PSendSysMessage("item at slot: %d guid: %d has has a queuepos (%d) that points to another item in the queue (bag: %d, slot: %d, guid: %d)", item->GetSlot(), item->GetGUIDLow(), qp, updateQueue[qp]->GetBagSlot(), updateQueue[qp]->GetSlot(), updateQueue[qp]->GetGUIDLow());
@@ -473,6 +544,7 @@ bool ChatHandler::HandleDebugGetItemStateCommand(const char* args)
PSendSysMessage("item at slot: %d guid: %d is not in queue but should be (state: %d)!", item->GetSlot(), item->GetGUIDLow(), item->GetState());
error = true; continue;
}
+
if(item->IsBag())
{
Bag *bag = (Bag*)item;
@@ -480,27 +552,32 @@ bool ChatHandler::HandleDebugGetItemStateCommand(const char* args)
{
Item* item2 = bag->GetItemByPos(j);
if (!item2) continue;
+
if (item2->GetSlot() != j)
{
PSendSysMessage("the item in bag %d slot %d, guid %d has an incorrect slot value: %d", bag->GetSlot(), j, item2->GetGUIDLow(), item2->GetSlot());
error = true; continue;
}
+
if (item2->GetOwnerGUID() != player->GetGUID())
{
PSendSysMessage("for the item in bag %d at slot %d and itemguid %d, owner's guid (%d) and player's guid (%d) don't match!", bag->GetSlot(), item2->GetSlot(), item2->GetGUIDLow(), GUID_LOPART(item2->GetOwnerGUID()), player->GetGUIDLow());
error = true; continue;
}
+
Bag *container = item2->GetContainer();
if (!container)
{
PSendSysMessage("the item in bag %d at slot %d with guid %d has no container!", bag->GetSlot(), item2->GetSlot(), item2->GetGUIDLow());
error = true; continue;
}
+
if (container != bag)
{
PSendSysMessage("the item in bag %d at slot %d with guid %d has a different container(slot %d guid %d)!", bag->GetSlot(), item2->GetSlot(), item2->GetGUIDLow(), container->GetSlot(), container->GetGUIDLow());
error = true; continue;
}
+
if (item2->IsInUpdateQueue())
{
uint16 qp = item2->GetQueuePos();
@@ -509,11 +586,13 @@ bool ChatHandler::HandleDebugGetItemStateCommand(const char* args)
PSendSysMessage("item in bag: %d at slot: %d guid: %d has a queuepos (%d) larger than the update queue size! ", bag->GetSlot(), item2->GetSlot(), item2->GetGUIDLow(), qp);
error = true; continue;
}
+
if (updateQueue[qp] == NULL)
{
PSendSysMessage("item in bag: %d at slot: %d guid: %d has a queuepos (%d) that points to NULL in the queue!", bag->GetSlot(), item2->GetSlot(), item2->GetGUIDLow(), qp);
error = true; continue;
}
+
if (updateQueue[qp] != item2)
{
PSendSysMessage("item in bag: %d at slot: %d guid: %d has has a queuepos (%d) that points to another item in the queue (bag: %d, slot: %d, guid: %d)", bag->GetSlot(), item2->GetSlot(), item2->GetGUIDLow(), qp, updateQueue[qp]->GetBagSlot(), updateQueue[qp]->GetSlot(), updateQueue[qp]->GetGUIDLow());
@@ -528,27 +607,33 @@ bool ChatHandler::HandleDebugGetItemStateCommand(const char* args)
}
}
}
+
for(size_t i = 0; i < updateQueue.size(); ++i)
{
Item *item = updateQueue[i];
if(!item) continue;
+
if (item->GetOwnerGUID() != player->GetGUID())
{
PSendSysMessage("queue(" SIZEFMTD "): for the an item (guid %d), the owner's guid (%d) and player's guid (%d) don't match!", i, item->GetGUIDLow(), GUID_LOPART(item->GetOwnerGUID()), player->GetGUIDLow());
error = true; continue;
}
+
if (item->GetQueuePos() != i)
{
PSendSysMessage("queue(" SIZEFMTD "): for the an item (guid %d), the queuepos doesn't match it's position in the queue!", i, item->GetGUIDLow());
error = true; continue;
}
+
if (item->GetState() == ITEM_REMOVED) continue;
Item *test = player->GetItemByPos( item->GetBagSlot(), item->GetSlot());
+
if (test == NULL)
{
PSendSysMessage("queue(" SIZEFMTD "): the bag(%d) and slot(%d) values for the item with guid %d are incorrect, the player doesn't have an item at that position!", i, item->GetBagSlot(), item->GetSlot(), item->GetGUIDLow());
error = true; continue;
}
+
if (test != item)
{
PSendSysMessage("queue(" SIZEFMTD "): the bag(%d) and slot(%d) values for the item with guid %d are incorrect, the item with guid %d is there instead!", i, item->GetBagSlot(), item->GetSlot(), item->GetGUIDLow(), test->GetGUIDLow());
@@ -558,23 +643,28 @@ bool ChatHandler::HandleDebugGetItemStateCommand(const char* args)
if (!error)
SendSysMessage("All OK!");
}
+
return true;
}
+
bool ChatHandler::HandleDebugBattlegroundCommand(const char * /*args*/)
{
sBattleGroundMgr.ToggleTesting();
return true;
}
+
bool ChatHandler::HandleDebugArenaCommand(const char * /*args*/)
{
sBattleGroundMgr.ToggleArenaTesting();
return true;
}
+
bool ChatHandler::HandleDebugThreatList(const char * /*args*/)
{
Creature* target = getSelectedCreature();
if(!target || target->isTotem() || target->isPet())
return false;
+
std::list<HostilReference*>& tlist = target->getThreatManager().getThreatList();
std::list<HostilReference*>::iterator itr;
uint32 cnt = 0;
@@ -590,6 +680,7 @@ bool ChatHandler::HandleDebugThreatList(const char * /*args*/)
SendSysMessage("End of threat list.");
return true;
}
+
bool ChatHandler::HandleDebugHostilRefList(const char * /*args*/)
{
Unit* target = getSelectedUnit();
@@ -610,35 +701,45 @@ bool ChatHandler::HandleDebugHostilRefList(const char * /*args*/)
SendSysMessage("End of hostil reference list.");
return true;
}
+
bool ChatHandler::HandleDebugSetVehicleId(const char *args)
{
Unit* target = getSelectedUnit();
if(!target || target->IsVehicle())
return false;
+
if(!args)
return false;
+
char* i = strtok((char*)args, " ");
if(!i)
return false;
+
uint32 id = (uint32)atoi(i);
//target->SetVehicleId(id);
target->SendUpdateObjectToAllExcept(NULL);
PSendSysMessage("Vehicle id set to %u", id);
return true;
}
+
bool ChatHandler::HandleDebugEnterVehicle(const char * args)
{
Unit* target = getSelectedUnit();
if(!target || !target->IsVehicle())
return false;
+
if(!args)
return false;
+
char* i = strtok((char*)args, " ");
if(!i)
return false;
+
char* j = strtok(NULL, " ");
+
uint32 entry = (uint32)atoi(i);
int8 seatId = j ? (int8)atoi(j) : -1;
+
if(!entry)
m_session->GetPlayer()->EnterVehicle(target, seatId);
else
@@ -651,39 +752,57 @@ bool ChatHandler::HandleDebugEnterVehicle(const char * args)
return false;
passenger->EnterVehicle(target, seatId);
}
+
PSendSysMessage("Unit %u entered vehicle %d", entry, (int32)seatId);
return true;
}
+
bool ChatHandler::HandleDebugSpawnVehicle(const char* args)
{
if (!*args)
return false;
+
char* e = strtok((char*)args, " ");
char* i = strtok(NULL, " ");
+
if (!e)
return false;
+
uint32 entry = (uint32)atoi(e);
+
float x, y, z, o = m_session->GetPlayer()->GetOrientation();
m_session->GetPlayer()->GetClosePoint(x, y, z, m_session->GetPlayer()->GetObjectSize());
+
if(!i)
return m_session->GetPlayer()->SummonCreature(entry, x, y, z, o);
+
uint32 id = (uint32)atoi(i);
+
CreatureInfo const *ci = objmgr.GetCreatureTemplate(entry);
+
if (!ci)
return false;
+
VehicleEntry const *ve = sVehicleStore.LookupEntry(id);
+
if (!ve)
return false;
+
Creature *v = new Creature;
+
Map *map = m_session->GetPlayer()->GetMap();
+
if(!v->Create(objmgr.GenerateLowGuid(HIGHGUID_VEHICLE), map, m_session->GetPlayer()->GetPhaseMask(), entry, id, m_session->GetPlayer()->GetTeam(), x, y, z, o))
{
delete v;
return false;
}
+
map->Add((Creature*)v);
+
return true;
}
+
bool ChatHandler::HandleDebugSendLargePacketCommand(const char* /*args*/)
{
const char* stuffingString = "This is a dummy string to push the packet's size beyond 128000 bytes. ";
@@ -693,54 +812,74 @@ bool ChatHandler::HandleDebugSendLargePacketCommand(const char* /*args*/)
SendSysMessage(ss.str().c_str());
return true;
}
+
bool ChatHandler::HandleDebugSendSetPhaseShiftCommand(const char* args)
{
if (!*args)
return false;
+
uint32 PhaseShift = atoi(args);
m_session->SendSetPhaseShift(PhaseShift);
return true;
}
+
bool ChatHandler::HandleDebugSetItemFlagCommand(const char* args)
{
if (!*args)
return false;
+
char* e = strtok((char*)args, " ");
char* f = strtok(NULL, " ");
+
if (!e || !f)
return false;
+
uint32 guid = (uint32)atoi(e);
uint32 flag = (uint32)atoi(f);
+
Item *i = m_session->GetPlayer()->GetItemByGuid(MAKE_NEW_GUID(guid, 0, HIGHGUID_ITEM));
+
if (!i)
return false;
+
i->SetUInt32Value(ITEM_FIELD_FLAGS, flag);
+
return true;
}
+
bool ChatHandler::HandleDebugItemExpireCommand(const char* args)
{
if (!*args)
return false;
+
char* e = strtok((char*)args, " ");
if (!e)
return false;
+
uint32 guid = (uint32)atoi(e);
+
Item *i = m_session->GetPlayer()->GetItemByGuid(MAKE_NEW_GUID(guid, 0, HIGHGUID_ITEM));
+
if (!i)
return false;
+
m_session->GetPlayer()->DestroyItem( i->GetBagSlot(),i->GetSlot(), true);
Script->ItemExpire(m_session->GetPlayer(),i->GetProto());
+
return true;
}
+
//show animation
bool ChatHandler::HandleDebugAnimCommand(const char* args)
{
if (!*args)
return false;
+
uint32 anim_id = atoi((char*)args);
m_session->GetPlayer()->HandleEmoteCommand(anim_id);
return true;
}
+
bool ChatHandler::HandleDebugSetAuraStateCommand(const char* args)
{
if (!*args)
@@ -749,6 +888,7 @@ bool ChatHandler::HandleDebugSetAuraStateCommand(const char* args)
SetSentErrorMessage(true);
return false;
}
+
Unit* unit = getSelectedUnit();
if (!unit)
{
@@ -756,6 +896,7 @@ bool ChatHandler::HandleDebugSetAuraStateCommand(const char* args)
SetSentErrorMessage(true);
return false;
}
+
int32 state = atoi((char*)args);
if (!state)
{
@@ -764,18 +905,23 @@ bool ChatHandler::HandleDebugSetAuraStateCommand(const char* args)
unit->ModifyAuraState(AuraState(i),false);
return true;
}
+
unit->ModifyAuraState(AuraState(abs(state)),state > 0);
return true;
}
+
bool ChatHandler::HandleDebugSetValueCommand(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)
{
@@ -783,7 +929,9 @@ bool ChatHandler::HandleDebugSetValueCommand(const char* args)
SetSentErrorMessage(true);
return false;
}
+
uint64 guid = target->GetGUID();
+
uint32 Opcode = (uint32)atoi(px);
if(Opcode >= target->GetValuesCount())
{
@@ -809,16 +957,21 @@ bool ChatHandler::HandleDebugSetValueCommand(const char* args)
target->SetFloatValue( Opcode , fValue );
PSendSysMessage(LANG_SET_FLOAT_FIELD, GUID_LOPART(guid), Opcode,fValue);
}
+
return true;
}
+
bool ChatHandler::HandleDebugGetValueCommand(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)
{
@@ -826,7 +979,9 @@ bool ChatHandler::HandleDebugGetValueCommand(const char* args)
SetSentErrorMessage(true);
return false;
}
+
uint64 guid = target->GetGUID();
+
uint32 Opcode = (uint32)atoi(px);
if(Opcode >= target->GetValuesCount())
{
@@ -838,6 +993,7 @@ bool ChatHandler::HandleDebugGetValueCommand(const char* args)
bool isint32 = true;
if(pz)
isint32 = (bool)atoi(pz);
+
if(isint32)
{
iValue = target->GetUInt32Value( Opcode );
@@ -850,37 +1006,52 @@ bool ChatHandler::HandleDebugGetValueCommand(const char* args)
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::HandleDebugMod32ValueCommand(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::HandleDebugUpdateCommand(const char* args)
{
if(!*args)
return false;
+
uint32 updateIndex;
uint32 value;
+
char* pUpdateIndex = strtok((char*)args, " ");
+
Unit* chr = getSelectedUnit();
if (chr == NULL)
{
@@ -888,6 +1059,7 @@ bool ChatHandler::HandleDebugUpdateCommand(const char* args)
SetSentErrorMessage(true);
return false;
}
+
if(!pUpdateIndex)
{
return true;
@@ -902,15 +1074,21 @@ bool ChatHandler::HandleDebugUpdateCommand(const char* args)
{
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;
}