关灯
开启左侧

游戏中的gameobject传送功能的代码(M端TBC)

  [复制链接]
admin实名认证 发表于 2016-4-20 22:55:21 | 显示全部楼层 |阅读模式 打印 上一主题 下一主题
 
diff -Nuar oregoncore-current/sql/CMakeLists.txt oregoncore-pq/sql/CMakeLists.txt--- oregoncore-current/sql/CMakeLists.txt        2011-01-01 10:03:07.000000000 -0500
+++ oregoncore-pq/sql/CMakeLists.txt        2011-01-01 10:12:37.000000000 -0500
@@ -1,6 +1,7 @@
add_subdirectory(updates)
add_subdirectory(tools)
add_subdirectory(scripts)
+add_subdirectory(oc-patch)


########### install files ###############
diff -Nuar oregoncore-current/sql/oc-patch/CMakeLists.txt oregoncore-pq/sql/oc-patch/CMakeLists.txt
--- oregoncore-current/sql/oc-patch/CMakeLists.txt        1969-12-31 19:00:00.000000000 -0500
+++ oregoncore-pq/sql/oc-patch/CMakeLists.txt        2011-01-01 10:12:37.000000000 -0500
@@ -0,0 +1,6 @@
+
+########### install files ###############
+
+FILE(GLOB _SQL *.sql)
+
+install(FILES ${_SQL} DESTINATION share/oregon/sql/oc-patch)
diff -Nuar oregoncore-current/sql/oc-patch/world-goteleport.sql oregoncore-pq/sql/oc-patch/world-goteleport.sql
--- oregoncore-current/sql/oc-patch/world-goteleport.sql        1969-12-31 19:00:00.000000000 -0500
+++ oregoncore-pq/sql/oc-patch/world-goteleport.sql        2011-01-01 10:12:37.000000000 -0500
@@ -0,0 +1,44 @@
+--
+-- Table structure for table `gameobject_teleports`
+--
+
+CREATE TABLE IF NOT EXISTS `gameobject_teleports` (
+  `entry` int(10) unsigned NOT NULL auto_increment,
+  `mapid` int(10) unsigned NOT NULL,
+  `x_pos` float NOT NULL,
+  `y_pos` float NOT NULL,
+  `z_pos` float NOT NULL,
+  `orientation` float NOT NULL,
+  `required_level` int(10) unsigned NOT NULL,
+  PRIMARY KEY  (`entry`)
+) ENGINE=MyISAM  DEFAULT CHARSET=utf8 ROW_FORMAT=DYNAMIC COMMENT='Optional table to create custom portals' AUTO_INCREMENT=2001013 ;
+
+--
+-- Dumping data for table `gameobject_teleports`
+--
+
+INSERT INTO `gameobject_teleports` (`entry`, `mapid`, `x_pos`, `y_pos`, `z_pos`, `orientation`, `required_level`) VALUES
+(2001000, 1, 9950.73, 2605.7, 1316.18, 3.72, 1),
+(2001001, 530, -3956.9, -11660.2, -138.75, 2.25, 1),
+(2001002, 0, -4830.45, -1188.09, 502.46, 1.01, 1),
+(2001003, 1, 1582.05, -4418.27, 8.05, 0.38, 1),
+(2001004, 530, 9474.99, -7295.07, 14.31, 5.92, 1),
+(2001005, 0, -8843.74, 611.06, 92.76, 0.75, 1),
+(2001006, 1, -1242.29, 71.16, 128.26, 5.96, 1),
+(2001007, 0, 1581.04, 276.09, -43.1027, 6.13, 1),
+(2001008, 530, -1833.9, 5371.17, -12.428, 1.92025, 1);
+
+--
+-- Dumping data for table `gameobject_template`
+--
+
+INSERT INTO `gameobject_template` (`entry`, `type`, `displayId`, `name`, `castBarCaption`, `faction`, `flags`, `size`, `data0`, `data1`, `data2`, `data3`, `data4`, `data5`, `data6`, `data7`, `data8`, `data9`, `data10`, `data11`, `data12`, `data13`, `data14`, `data15`, `data16`, `data17`, `data18`, `data19`, `data20`, `data21`, `data22`, `data23`, `ScriptName`) VALUES
+(2001000, 10, 4393, 'Portal to Darnassus', '', 1732, 0, 1, 17608, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, ''),
+(2001001, 10, 6955, 'Portal to Exodar', '', 1732, 0, 1, 32268, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, ''),
+(2001002, 10, 4394, 'Portal to Ironforge', '', 1732, 0, 1, 17607, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, ''),
+(2001003, 10, 4395, 'Portal to Orgrimmar', '', 1735, 0, 1, 17609, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, ''),
+(2001004, 10, 6956, 'Portal to Silvermoon', '', 1735, 0, 1, 32270, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, ''),
+(2001005, 10, 4396, 'Portal to Stormwind', '', 1732, 0, 1, 17334, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, ''),
+(2001006, 10, 4397, 'Portal to Thunder Bluff', '', 1735, 0, 1, 17610, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, ''),
+(2001007, 10, 4398, 'Portal to Undercity', '', 1735, 0, 1, 17611, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, ''),
+(2001008, 10, 7146, 'Portal to Shattrath', '', 0, 0, 1, 33728, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, '')
diff -Nuar oregoncore-current/src/game/GameObject.cpp oregoncore-pq/src/game/GameObject.cpp
--- oregoncore-current/src/game/GameObject.cpp        2011-01-01 10:03:08.000000000 -0500
+++ oregoncore-pq/src/game/GameObject.cpp        2011-01-01 10:12:37.000000000 -0500
@@ -1034,6 +1034,34 @@
             {
                 Player* player = user->ToPlayer();

+                 // Probably not doing this right -- Lunera
+               float xt,yt,zt,orientationt;
+               uint32 mapidt;
+
+               std::ostringstream qry;
+               qry << "SELECT * FROM gameobject_teleports WHERE entry = " << info->id;
+               QueryResult_AutoPtr result = WorldDatabase.Query(qry.str( ).c_str( ));
+               if(result != NULL)
+               {
+                   Field *fields = result->Fetch();
+                   uint32 required_level = fields[6].GetInt32();
+
+                   if ((required_level == 0) || (required_level <= player->getLevel()))
+                   {
+                       mapidt = fields[1].GetInt32();
+                       xt = fields[2].GetFloat();
+                       yt = fields[3].GetFloat();
+                       zt = fields[4].GetFloat();
+                       orientationt = fields[5].GetFloat();
+
+                       player->TeleportTo(mapidt, xt, yt, zt, orientationt, TELE_TO_NOT_LEAVE_TRANSPORT | TELE_TO_NOT_LEAVE_COMBAT | TELE_TO_NOT_UNSUMMON_PET);
+                    }
+                    else if (required_level != 0)
+                    {
+                    }
+               }
+               //I'm done here -- Lunera
+
                 if (info->goober.pageId)                    // show page...
                 {
                     WorldPacket data(SMSG_GAMEOBJECT_PAGETEXT, 8);



回复下载完整代码



游客,如果您要查看本帖隐藏内容请回复


标签:游戏
 
VIP介绍
您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

  • 最佳新人

    注册账号后积极发帖的会员
  • 活跃会员

    经常参与各类话题的讨论,发帖内容较有主见
  • 热心会员

    经常帮助其他会员答疑
  • 推广达人

    积极宣传本站,为本站带来更多注册会员
  • 宣传达人

    积极宣传本站,为本站带来更多的用户访问量
  • 灌水之王

    经常在论坛发帖,且发帖量较大
  • 突出贡献

    长期对论坛的繁荣而不断努力,或多次提出建设性意见
  • 优秀版主

    活跃且尽责职守的版主
  • 荣誉管理

    曾经为论坛做出突出贡献目前已离职的版主
  • 论坛元老

    为论坛做出突出贡献的会员

0关注

5粉丝

3421帖子

排行榜
作者专栏

QQ交流群&&微信订阅号

QQ交流群

微信订阅号

吾爱尚玩资源基地永久域名:

Www.523Play.Com

在线管理员QQ:1589479632

邮箱:Email@523play.com

QQ交流群:558936238

Copyright   ©2015-2116  吾爱尚玩资源基地|523play.comPowered by©523Pplay.Com技术支持:吾爱尚玩资源基地