临时刷出NPC或则物品,重新启动后消失的服务端代码。。主要就是用于一些变态设计
--- a/src/game/Chat.cpp Mon Nov 17 22:07:59 2008 -0600+++ b/src/game/Chat.cpp Tue Nov 18 15:43:44 2008 +0100
@@ -401,6 +401,7 @@
{ "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 },
@@ -434,6 +435,7 @@
{ "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 }
};
--- a/src/game/Chat.h Mon Nov 17 22:07:59 2008 -0600
+++ b/src/game/Chat.h Tue Nov 18 15:44:11 2008 +0100
@@ -437,6 +437,9 @@
bool HandleRepairitemsCommand(const char* args);
bool HandleFlushArenaPointsCommand(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);
--- a/src/game/Level2.cpp Mon Nov 17 22:07:59 2008 -0600
+++ b/src/game/Level2.cpp Tue Nov 18 15:44:26 2008 +0100
@@ -4288,3 +4288,58 @@
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;
+}
SQL:
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.');
|