mirror of
https://github.com/mangosfour/server.git
synced 2025-12-13 22:37:03 +00:00
[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).
This commit is contained in:
parent
ed52e3f8f0
commit
4602ff9c21
11 changed files with 183 additions and 5 deletions
|
|
@ -1720,6 +1720,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)
|
||||
{
|
||||
|
|
@ -4215,3 +4236,74 @@ bool ChatHandler::HandleNpcTameCommand(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;
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue