diff options
author | n0n4m3 <none@none> | 2009-12-17 14:06:20 +0100 |
---|---|---|
committer | n0n4m3 <none@none> | 2009-12-17 14:06:20 +0100 |
commit | eccf162be2e8cb821087f49dfd9a0885e6c0e73c (patch) | |
tree | 9c52c4f530cc864538278167a93601463629eb0e /src/game/Debugcmds.cpp | |
parent | 89656d5749f72803edbdd5f9840ba6b4c21f3987 (diff) |
Fixed compile errors and some typos
--HG--
branch : trunk
Diffstat (limited to 'src/game/Debugcmds.cpp')
-rw-r--r-- | src/game/Debugcmds.cpp | 40 |
1 files changed, 37 insertions, 3 deletions
diff --git a/src/game/Debugcmds.cpp b/src/game/Debugcmds.cpp index e016d8c98b0..375ad770ded 100644 --- a/src/game/Debugcmds.cpp +++ b/src/game/Debugcmds.cpp @@ -823,7 +823,7 @@ bool ChatHandler::HandleDebugSendSetPhaseShiftCommand(const char* args) return true; } -bool ChatHandler::HandleDebugSetItemFlagCommand(const char* args) +bool ChatHandler::HandleDebugGetItemValueCommand(const char* args) { if (!*args) return false; @@ -835,14 +835,48 @@ bool ChatHandler::HandleDebugSetItemFlagCommand(const char* args) return false; uint32 guid = (uint32)atoi(e); - uint32 flag = (uint32)atoi(f); + uint32 index = (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); + if (index >= i->GetValuesCount()) + return false; + + uint32 value = i->GetUInt32Value(index); + + PSendSysMessage("Item %u: value at %u is %u", guid, index, value); + + return true; +} + +bool ChatHandler::HandleDebugSetItemValueCommand(const char* args) +{ + if (!*args) + return false; + + char* e = strtok((char*)args, " "); + char* f = strtok(NULL, " "); + char* g = strtok(NULL, " "); + + if (!e || !f || !g) + return false; + + uint32 guid = (uint32)atoi(e); + uint32 index = (uint32)atoi(f); + uint32 value = (uint32)atoi(g); + + Item *i = m_session->GetPlayer()->GetItemByGuid(MAKE_NEW_GUID(guid, 0, HIGHGUID_ITEM)); + + if (!i) + return false; + + if (index >= i->GetValuesCount()) + return false; + + i->SetUInt32Value(index, value); return true; } |