[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
This commit is contained in:
1 parent
cd0071ae62
commit
05c07aa74a
8 files changed
+165
-5
No files matched your search
@@ -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;
|
||||
}
|
||||
Reference in new issue
Block a user