aboutsummaryrefslogtreecommitdiff
path: root/src/game/Level2.cpp
diff options
context:
space:
mode:
authormegamage <none@none>2009-02-01 16:46:57 -0600
committermegamage <none@none>2009-02-01 16:46:57 -0600
commit05c07aa74a38e73006ba7106574290179942692c (patch)
tree70cd33698562658805c3643c22890ce23263c3a8 /src/game/Level2.cpp
parentcd0071ae620f2634f609df8b83b24687f073733e (diff)
[7214] Phase system continue development - Commands and fixes.
* Fixed creature/gameobject save from game (used in commands code only) * Implement .modify phase (for player), .npc setphase (for creature/pet), .gobject phase (for gameobjects) commands for set phasemask of selected object. In player/pet case temporary until in game phase switch/re-login/GM-mode change. In creature/gameobject case change saved in DB. * Add to .gps output phasemask value print. Allow use .gps command with creature/gameobject shift-link (work for objects loaded in game in command time). Author: VladimirMangos --HG-- branch : trunk
Diffstat (limited to 'src/game/Level2.cpp')
-rw-r--r--src/game/Level2.cpp91
1 files changed, 91 insertions, 0 deletions
diff --git a/src/game/Level2.cpp b/src/game/Level2.cpp
index e1c43c49b93..b43c4a971f5 100644
--- a/src/game/Level2.cpp
+++ b/src/game/Level2.cpp
@@ -1754,6 +1754,27 @@ bool ChatHandler::HandleKickPlayerCommand(const char *args)
return true;
}
+//set temporary phase mask for player
+bool ChatHandler::HandleModifyPhaseCommand(const char* args)
+{
+ if (!*args)
+ return false;
+
+ uint32 phasemask = (uint32)atoi((char*)args);
+
+ Unit *target = getSelectedUnit();
+ if(!target)
+ target = m_session->GetPlayer();
+
+ // check online security
+ else if (target->GetTypeId() == TYPEID_PLAYER && HasLowerSecurity((Player*)target, 0))
+ return false;
+
+ target->SetPhaseMask(phasemask,true);
+
+ return true;
+}
+
//show info of player
bool ChatHandler::HandlePInfoCommand(const char* args)
{
@@ -4410,3 +4431,73 @@ bool ChatHandler::HandleNpcAddFormationCommand(const char* args)
return true;
}
+
+//change phasemask of creature or pet
+bool ChatHandler::HandleNpcSetPhaseCommand(const char* args)
+{
+ if (!*args)
+ return false;
+
+ uint32 phasemask = (uint32) atoi((char*)args);
+ if ( phasemask == 0 )
+ {
+ SendSysMessage(LANG_BAD_VALUE);
+ SetSentErrorMessage(true);
+ return false;
+ }
+
+ Creature* pCreature = getSelectedCreature();
+ if(!pCreature)
+ {
+ SendSysMessage(LANG_SELECT_CREATURE);
+ SetSentErrorMessage(true);
+ return false;
+ }
+
+ pCreature->SetPhaseMask(phasemask,true);
+
+ if(!pCreature->isPet())
+ pCreature->SaveToDB();
+
+ return true;
+}
+
+//set pahsemask for selected object
+bool ChatHandler::HandleGOPhaseCommand(const char* args)
+{
+ // number or [name] Shift-click form |color|Hgameobject:go_id|h[name]|h|r
+ char* cId = extractKeyFromLink((char*)args,"Hgameobject");
+ if(!cId)
+ return false;
+
+ uint32 lowguid = atoi(cId);
+ if(!lowguid)
+ return false;
+
+ GameObject* obj = NULL;
+ // by DB guid
+ if (GameObjectData const* go_data = objmgr.GetGOData(lowguid))
+ obj = GetObjectGlobalyWithGuidOrNearWithDbGuid(lowguid,go_data->id);
+
+ if(!obj)
+ {
+ PSendSysMessage(LANG_COMMAND_OBJNOTFOUND, lowguid);
+ SetSentErrorMessage(true);
+ return false;
+ }
+
+ if (!*args)
+ return false;
+
+ uint32 phasemask = (uint32) atoi((char*)args);
+ if ( phasemask == 0 )
+ {
+ SendSysMessage(LANG_BAD_VALUE);
+ SetSentErrorMessage(true);
+ return false;
+ }
+
+ obj->SetPhaseMask(phasemask,true);
+ obj->SaveToDB();
+ return true;
+}