当前位置:首页>>魔兽单机>>正文
临时刷出NPC或则物品,重新启动后消失的服务端代码
2013-07-05 17:41:54 作者:网络 来源: 浏览次数:0
摘要:临时刷出NPC或则物品,重新启动后消失
临时刷出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.');


相关报道:

[关闭] [返回顶部]


  返回首页 | 最新资讯 | 资源下载 | 魔兽图片 | 单机文档 | 技术攻略 | 玩家视频
备案号:蜀ICP备2024062380号-1
免责声明:本网站为热爱怀旧WOW的玩家们建立的魔兽世界资料网站,仅供交流和学习使用,非盈利和商用.如有侵权之处,请联系我们,我们会在24小时内确认删除侵权内容,谢谢合作。
Copyright © 2024 - 2024 WOWAII.COM Corporation, All Rights Reserved

机器人国度