*New commands: .gobject addtemp/.npc addtemp - by XTZGZoReX
--HG-- branch : trunk
This commit is contained in:
@@ -0,0 +1,4 @@
|
||||
delete from command where name in ('gobject tempadd', 'npc tempadd');
|
||||
insert into command (name, security, help) values
|
||||
('gobject tempadd','2','Adds a temporary gameobject that is not saved to DB.'),
|
||||
('npc tempadd','2','Adds temporary NPC, not saved to database.');
|
||||
@@ -438,6 +438,7 @@ ChatCommand * ChatHandler::getCommandTable()
|
||||
{ "unfollow", SEC_GAMEMASTER, false, &ChatHandler::HandleNpcUnFollowCommand, "", NULL },
|
||||
{ "whisper", SEC_MODERATOR, false, &ChatHandler::HandleNpcWhisperCommand, "", NULL },
|
||||
{ "yell", SEC_MODERATOR, false, &ChatHandler::HandleNpcYellCommand, "", NULL },
|
||||
{ "addtemp", SEC_GAMEMASTER, false, &ChatHandler::HandleTempAddSpwCommand, "", NULL },
|
||||
|
||||
//{ TODO: fix or remove this commands
|
||||
{ "name", SEC_GAMEMASTER, false, &ChatHandler::HandleNameCommand, "", NULL },
|
||||
@@ -471,6 +472,7 @@ ChatCommand * ChatHandler::getCommandTable()
|
||||
{ "move", SEC_GAMEMASTER, false, &ChatHandler::HandleMoveObjectCommand, "", NULL },
|
||||
{ "near", SEC_ADMINISTRATOR, false, &ChatHandler::HandleNearObjectCommand, "", NULL },
|
||||
{ "activate", SEC_GAMEMASTER, false, &ChatHandler::HandleActivateObjectCommand, "", NULL },
|
||||
{ "addtemp", SEC_GAMEMASTER, false, &ChatHandler::HandleTempGameObjectCommand, "", NULL },
|
||||
{ NULL, 0, false, NULL, "", NULL }
|
||||
};
|
||||
|
||||
|
||||
@@ -463,6 +463,9 @@ class ChatHandler
|
||||
bool HandlePlayAllCommand(const char* args);
|
||||
bool HandleRepairitemsCommand(const char* args);
|
||||
|
||||
bool HandleTempGameObjectCommand(const char* args);
|
||||
bool HandleTempAddSpwCommand(const char* args);
|
||||
|
||||
//! Development Commands
|
||||
bool HandleSetValue(const char* args);
|
||||
bool HandleGetValue(const char* args);
|
||||
|
||||
+56
-1
@@ -3946,9 +3946,64 @@ bool ChatHandler::HandleActivateObjectCommand(const char *args)
|
||||
|
||||
// Activate
|
||||
obj->SetLootState(GO_READY);
|
||||
obj->UseDoorOrButton(10000);
|
||||
obj->UseDoorOrButton(10000);
|
||||
|
||||
PSendSysMessage("Object activated!");
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
// add creature, temp only
|
||||
bool ChatHandler::HandleTempAddSpwCommand(const char* args)
|
||||
{
|
||||
if(!*args)
|
||||
return false;
|
||||
char* charID = strtok((char*)args, " ");
|
||||
if (!charID)
|
||||
return false;
|
||||
|
||||
Player *chr = m_session->GetPlayer();
|
||||
|
||||
float x = chr->GetPositionX();
|
||||
float y = chr->GetPositionY();
|
||||
float z = chr->GetPositionZ();
|
||||
float ang = chr->GetOrientation();
|
||||
|
||||
uint32 id = atoi(charID);
|
||||
|
||||
chr->SummonCreature(id,x,y,z,ang,TEMPSUMMON_CORPSE_DESPAWN,120);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
// add go, temp only
|
||||
bool ChatHandler::HandleTempGameObjectCommand(const char* args)
|
||||
{
|
||||
if(!*args)
|
||||
return false;
|
||||
char* charID = strtok((char*)args, " ");
|
||||
if (!charID)
|
||||
return false;
|
||||
|
||||
Player *chr = m_session->GetPlayer();
|
||||
|
||||
char* spawntime = strtok(NULL, " ");
|
||||
uint32 spawntm;
|
||||
|
||||
if( spawntime )
|
||||
spawntm = atoi((char*)spawntime);
|
||||
|
||||
float x = chr->GetPositionX();
|
||||
float y = chr->GetPositionY();
|
||||
float z = chr->GetPositionZ();
|
||||
float ang = chr->GetOrientation();
|
||||
|
||||
float rot2 = sin(ang/2);
|
||||
float rot3 = cos(ang/2);
|
||||
|
||||
uint32 id = atoi(charID);
|
||||
|
||||
chr->SummonGameObject(id,x,y,z,ang,0,0,rot2,rot3,spawntm);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user