原始的Mangos+ScriptDev2中如何加入传送宝石的程序(整理版)-感谢以前很多的大大们把它们写出来^^
不过我一直没看到完整的教学文章,东拼西拼的终于把它弄出来了
这些Code其实在十字佣兵里发布的源码里都有,我只是把它整理出来而以^^
主要是给有兴趣的人一起研究啰^^看懂之后对传送宝石的实作会了解的更多^^
功能说明:
你会觉得在魔兽里老是要找坐标位置很麻烦吗?随身的传送宝石是一个超级方便的物品^^有了它想去那就去那再也不用找坐标打命令了!
魔兽工资领取很有趣的一个功能,这里是设定成你只要在游戏里每待60秒以上,再按一下"魔兽工资领取",人物就会领到10G@@
也包含了个人随身银行,灵魂医者复活功能
底下开始就都是要修改的程序代码了^^
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
进入src/bindings/ScriptDev2/scripts/item里:
先备份sc_item_test.cpp然后编辑它机乎全部改写了,我就直接贴Code了
====================================================================
#include "../sc_defines.h"
bool GossipHello_Item(Player *player, Item *_Item)
{
player->ADD_GOSSIP_ITEM( 3, " 世界主城传送 " , 1, GOSSIP_ACTION_INFO_DEF + 1);
player->ADD_GOSSIP_ITEM( 3, " 初级副本传送 " , 1, GOSSIP_ACTION_INFO_DEF + 2);
player->ADD_GOSSIP_ITEM( 3, " 中级副本传送 " , 1, GOSSIP_ACTION_INFO_DEF + 3);
player->ADD_GOSSIP_ITEM( 3, " 团队副本传送 " , 1, GOSSIP_ACTION_INFO_DEF + 4);
player->ADD_GOSSIP_ITEM( 3, " 野外BOSS传送 " , 1, GOSSIP_ACTION_INFO_DEF + 5);
player->ADD_GOSSIP_ITEM( 3, " 三大战场传送 " , 1, GOSSIP_ACTION_INFO_DEF + 6);
player->ADD_GOSSIP_ITEM( 3, " 世界风景传送 " , 1, GOSSIP_ACTION_INFO_DEF + 7);
player->ADD_GOSSIP_ITEM( 3, " 开通我的飞行点 " , 6, GOSSIP_ACTION_INFO_DEF + 8);
player->ADD_GOSSIP_ITEM( 3, " 我的个人银行 " , 8, GOSSIP_ACTION_INFO_DEF + 9);
player->ADD_GOSSIP_ITEM( 3, " 魔兽工资领取 " , 7, GOSSIP_ACTION_INFO_DEF + 10);
player->ADD_GOSSIP_ITEM( 3, " 灵魂医者复活 " , 12, GOSSIP_ACTION_INFO_DEF + 12);
player->SEND_GOSSIP_MENU(99990,_Item->GetGUID());
return true;
}
void SendDefaultMenu_Item(Player *player, Item *_Item, uint32 action)
{
switch(action) {
// 主城
case GOSSIP_ACTION_INFO_DEF + 1 :
player->ADD_GOSSIP_ITEM( 0, " 联盟 暴风城 " , 2, GOSSIP_ACTION_INFO_DEF + 1);
player->ADD_GOSSIP_ITEM( 0, " 联盟 铁炉堡 " , 2, GOSSIP_ACTION_INFO_DEF + 2);
player->ADD_GOSSIP_ITEM( 0, " 联盟 达纳苏斯 " , 2, GOSSIP_ACTION_INFO_DEF + 3);
player->ADD_GOSSIP_ITEM( 0, " 部落 奥格瑞玛 " , 2, GOSSIP_ACTION_INFO_DEF + 4);
player->ADD_GOSSIP_ITEM( 0, " 部落 雷霆崖 " , 2, GOSSIP_ACTION_INFO_DEF + 5);
player->ADD_GOSSIP_ITEM( 0, " 部落 幽暗城 " , 2, GOSSIP_ACTION_INFO_DEF + 6);
player->ADD_GOSSIP_ITEM( 0, " 中立 棘齿城 " , 2, GOSSIP_ACTION_INFO_DEF + 7);
player->ADD_GOSSIP_ITEM( 0, " 中立 藏宝海湾 " , 2, GOSSIP_ACTION_INFO_DEF + 8);
player->SEND_GOSSIP_MENU(99991,_Item->GetGUID());
break;
// 初级副本
case GOSSIP_ACTION_INFO_DEF + 2 :
player->ADD_GOSSIP_ITEM( 0, " •[14] 怒焰裂谷 " , 3, GOSSIP_ACTION_INFO_DEF + 1);
player->ADD_GOSSIP_ITEM( 0, " •[19] 死亡矿坑 " , 3, GOSSIP_ACTION_INFO_DEF + 2);
player->ADD_GOSSIP_ITEM( 0, " •[22] 哀嚎洞穴 " , 3, GOSSIP_ACTION_INFO_DEF + 3);
player->ADD_GOSSIP_ITEM( 0, " •[24] 影牙城堡 " , 3, GOSSIP_ACTION_INFO_DEF + 4);
player->ADD_GOSSIP_ITEM( 0, " •[26] 黑暗深渊 " , 3, GOSSIP_ACTION_INFO_DEF + 5);
player->ADD_GOSSIP_ITEM( 0, " •[27] 暴风城监狱 " , 3, GOSSIP_ACTION_INFO_DEF + 6);
player->ADD_GOSSIP_ITEM( 0, " •[31] 剃刀沼泽 " , 3, GOSSIP_ACTION_INFO_DEF + 7);
player->ADD_GOSSIP_ITEM( 0, " •[33] 诺莫瑞根 " , 3, GOSSIP_ACTION_INFO_DEF + 8);
player->ADD_GOSSIP_ITEM( 0, " •[40] 血色修道院 " , 3, GOSSIP_ACTION_INFO_DEF + 9);
player->ADD_GOSSIP_ITEM( 0, " •[42] 剃刀高地 " , 3, GOSSIP_ACTION_INFO_DEF + 10);
player->ADD_GOSSIP_ITEM( 0, " •[45] 奥达曼 " , 3, GOSSIP_ACTION_INFO_DEF + 11);
player->SEND_GOSSIP_MENU(99992,_Item->GetGUID());
break;
// 中级副本
case GOSSIP_ACTION_INFO_DEF + 3 :
player->ADD_GOSSIP_ITEM( 0, " •[46] 祖尔法拉克 " , 4, GOSSIP_ACTION_INFO_DEF + 1);
player->ADD_GOSSIP_ITEM( 0, " •[49] 马拉顿 " , 4, GOSSIP_ACTION_INFO_DEF + 2);
player->ADD_GOSSIP_ITEM( 0, " •[53] 失落的神庙 " , 4, GOSSIP_ACTION_INFO_DEF + 3);
player->ADD_GOSSIP_ITEM( 0, " •[57] 黑石深渊 " , 4, GOSSIP_ACTION_INFO_DEF + 4);
player->ADD_GOSSIP_ITEM( 0, " •[60] 通灵学院 " , 4, GOSSIP_ACTION_INFO_DEF + 5);
player->ADD_GOSSIP_ITEM( 0, " •[60] 厄运之槌 (北区) " , 4, GOSSIP_ACTION_INFO_DEF + 6);
player->ADD_GOSSIP_ITEM( 0, " •[60] 厄运之槌 (东区) " , 4, GOSSIP_ACTION_INFO_DEF + 7);
player->ADD_GOSSIP_ITEM( 0, " •[60] 厄运之槌 (西区) " , 4, GOSSIP_ACTION_INFO_DEF + 8);
player->ADD_GOSSIP_ITEM( 0, " •[60] 斯坦索姆 " , 4, GOSSIP_ACTION_INFO_DEF + 9);
player->ADD_GOSSIP_ITEM( 0, " •[60] 黑石塔 " , 4, GOSSIP_ACTION_INFO_DEF + 10);
player->SEND_GOSSIP_MENU(99993,_Item->GetGUID());
break;
// 高级副本
case GOSSIP_ACTION_INFO_DEF + 4 :
player->ADD_GOSSIP_ITEM( 0, " •[团] 溶火之心 " , 5, GOSSIP_ACTION_INFO_DEF + 1);
player->ADD_GOSSIP_ITEM( 0, " •[团] 黑石塔 " , 5, GOSSIP_ACTION_INFO_DEF + 2);
player->ADD_GOSSIP_ITEM( 0, " •[团] 祖尔格拉布 " , 5, GOSSIP_ACTION_INFO_DEF + 3);
player->ADD_GOSSIP_ITEM( 0, " •[团] 黑翼之巢 " , 5, GOSSIP_ACTION_INFO_DEF + 4);
player->ADD_GOSSIP_ITEM( 0, " •[团] 安其拉神庙 " , 5, GOSSIP_ACTION_INFO_DEF + 5);
player->ADD_GOSSIP_ITEM( 0, " •[团] 安其拉废墟 " , 5, GOSSIP_ACTION_INFO_DEF + 6);
player->ADD_GOSSIP_ITEM( 0, " •[团] 奥妮克希亚的巢穴 " , 5, GOSSIP_ACTION_INFO_DEF + 7);
player->ADD_GOSSIP_ITEM( 0, " •[团] 纳克萨玛斯 " , 5, GOSSIP_ACTION_INFO_DEF + 8);
player->ADD_GOSSIP_ITEM( 0, " •[团] 冰龙巢穴 " , 5, GOSSIP_ACTION_INFO_DEF + 9);
player->SEND_GOSSIP_MENU(99994,_Item->GetGUID());
break;
// 野外BOSS传送
case GOSSIP_ACTION_INFO_DEF + 5 :
player->ADD_GOSSIP_ITEM( 0, " 暮色森林 " , 9, GOSSIP_ACTION_INFO_DEF + 1);
player->ADD_GOSSIP_ITEM( 0, " 辛特兰 " , 9, GOSSIP_ACTION_INFO_DEF + 2);
player->ADD_GOSSIP_ITEM( 0, " 灰谷 " , 9, GOSSIP_ACTION_INFO_DEF + 3);
player->ADD_GOSSIP_ITEM( 0, " 艾萨拉 " , 9, GOSSIP_ACTION_INFO_DEF + 4);
player->ADD_GOSSIP_ITEM( 0, " 菲拉斯 " , 9, GOSSIP_ACTION_INFO_DEF + 5);
player->ADD_GOSSIP_ITEM( 0, " 诅咒之地 " , 9, GOSSIP_ACTION_INFO_DEF + 6);
player->ADD_GOSSIP_ITEM( 0, " 水晶谷 " , 9, GOSSIP_ACTION_INFO_DEF + 7);
player->SEND_GOSSIP_MENU(99995,_Item->GetGUID());
break;
// 三大战场传送
case GOSSIP_ACTION_INFO_DEF + 6 :
player->ADD_GOSSIP_ITEM( 0, " 古拉巴什竞技场 " , 10, GOSSIP_ACTION_INFO_DEF + 1);
player->ADD_GOSSIP_ITEM( 0, " 奥特兰战场 " , 10, GOSSIP_ACTION_INFO_DEF + 2);
player->ADD_GOSSIP_ITEM( 0, " 战歌峡谷 " , 10, GOSSIP_ACTION_INFO_DEF + 3);
player->ADD_GOSSIP_ITEM( 0, " 阿拉希战场 " , 10, GOSSIP_ACTION_INFO_DEF + 4);
player->SEND_GOSSIP_MENU(99996,_Item->GetGUID());
break;
// 风景传送
case GOSSIP_ACTION_INFO_DEF + 7 :
player->ADD_GOSSIP_ITEM( 0, " 海加尔山 " , 11, GOSSIP_ACTION_INFO_DEF + 1);
player->ADD_GOSSIP_ITEM( 0, " 翡翠圣地 " , 11, GOSSIP_ACTION_INFO_DEF + 2);
player->ADD_GOSSIP_ITEM( 0, " 时光之穴 " , 11, GOSSIP_ACTION_INFO_DEF + 3);
player->ADD_GOSSIP_ITEM( 0, " 黑暗之门 " , 11, GOSSIP_ACTION_INFO_DEF + 4);
player->ADD_GOSSIP_ITEM( 0, " 双塔山 " , 11, GOSSIP_ACTION_INFO_DEF + 5);
player->ADD_GOSSIP_ITEM( 0, " 梦境之树 " , 11, GOSSIP_ACTION_INFO_DEF + 6);
player->ADD_GOSSIP_ITEM( 0, " GM之岛 " , 11, GOSSIP_ACTION_INFO_DEF + 7);
player->ADD_GOSSIP_ITEM( 0, " 海加尔山 - 暴雪路障 " , 11, GOSSIP_ACTION_INFO_DEF + 8);
player->ADD_GOSSIP_ITEM( 0, " 天涯海滩 " , 11, GOSSIP_ACTION_INFO_DEF + 9);
player->ADD_GOSSIP_ITEM( 0, " 安戈洛环形山 " , 11, GOSSIP_ACTION_INFO_DEF + 10);
player->ADD_GOSSIP_ITEM( 0, " 比吉尔的飞艇残骸 " , 11, GOSSIP_ACTION_INFO_DEF + 11);
player->ADD_GOSSIP_ITEM( 0, " 石堡瀑布" , 11, GOSSIP_ACTION_INFO_DEF + 12);
player->ADD_GOSSIP_ITEM( 0, " 地铁海底" , 11, GOSSIP_ACTION_INFO_DEF + 13);
player->ADD_GOSSIP_ITEM( 0, " 工程师之岛" , 11, GOSSIP_ACTION_INFO_DEF + 14);
player->ADD_GOSSIP_ITEM( 0, " 卡拉赞" , 11, GOSSIP_ACTION_INFO_DEF + 15);
player->SEND_GOSSIP_MENU(99997,_Item->GetGUID());
break;
}
}
bool GossipSelect_Item(Player *player, Item *_Item, uint32 sender, uint32 action )
{
switch(sender) {
// 主选单
case GOSSIP_SENDER_MAIN :
SendDefaultMenu_Item(player, _Item, action);
break;
// 各大主城
case 2 :
uint32 price_city;
price_city= 10000; //city
switch(action) {
// 暴风城 统一格式说明:(MapID, X, Y, Z, 0);
case GOSSIP_ACTION_INFO_DEF + 1 :
player->TeleportTo(0,-9065,434,94,0);
break;
// 铁炉堡
case GOSSIP_ACTION_INFO_DEF + 2 :
player->TeleportTo(0,-5032,-819,495,0);
break;
// 达纳苏斯
case GOSSIP_ACTION_INFO_DEF + 3 :
player->TeleportTo(1,9961,2055,1329,0);
break;
// 奥格瑞玛
case GOSSIP_ACTION_INFO_DEF + 4 :
player->TeleportTo(1,1317,-4383,27,0);
break;
// 雷霆崖
case GOSSIP_ACTION_INFO_DEF + 5 :
player->TeleportTo(1,-1391,140,23,0);
break;
// 幽暗城
case GOSSIP_ACTION_INFO_DEF + 6 :
player->TeleportTo(0,1909,235,53,0);
break;
// 棘齿城
case GOSSIP_ACTION_INFO_DEF + 7 :
player->TeleportTo(1,-977,-3788,6,0);
break;
// 藏宝海湾
case GOSSIP_ACTION_INFO_DEF + 8 :
player->TeleportTo(0,-14302,518,9,0);
break;
}
break;
// 初级副本
case 3:
switch(action) {
// •[14] 怒焰裂谷 统一格式说明:(MapID, X, Y, Z, 0);
case GOSSIP_ACTION_INFO_DEF + 1 :
player->TeleportTo(389,2.024650,-10.021000,-16.187500,0);
break;
// •[19] 死亡矿井
case GOSSIP_ACTION_INFO_DEF + 2 :
player->TeleportTo(36,-16.4,-383.07,61.78,0);
break;
// •[22] 哀嚎洞穴
case GOSSIP_ACTION_INFO_DEF + 3 :
player->TeleportTo(43,-161.841995,133.266998,-73.866203,0);
break;
// •[24] 影牙城堡
case GOSSIP_ACTION_INFO_DEF + 4 :
player->TeleportTo(33,-228.19,2110.56,76.89,0);
break;
// •[26] 黑暗深渊
case GOSSIP_ACTION_INFO_DEF + 5 :
player->TeleportTo(48,-150.367004,102.995003,-40.555801,0);
break;
// •[27] 暴风城监狱
case GOSSIP_ACTION_INFO_DEF + 6 :
player->TeleportTo(34,48.29,0.45,-16.14,0);
break;
// •[31] 剃刀沼泽
case GOSSIP_ACTION_INFO_DEF + 7 :
player->TeleportTo(47,1943,1544,82,0);
break;
// •[33] 诺莫瑞根
case GOSSIP_ACTION_INFO_DEF + 8 :
player->TeleportTo(90,-332.562988,-3.445,-152.845993,0);
break;
// •[40] 血色修道院
case GOSSIP_ACTION_INFO_DEF + 9 :
player->TeleportTo(189,855.903992,1321.939941,18.673000,0);
break;
// •[42] 剃刀高地
case GOSSIP_ACTION_INFO_DEF + 10 :
player->TeleportTo(129,2593.209961,1109.459961,51.093300,0);
break;
// •[45] 奥达曼
case GOSSIP_ACTION_INFO_DEF + 11 :
player->TeleportTo(70,-227.529007,45.009800,-46.019600,0);
break;
}
break;
// 中级副本
case 4:
switch(action) {
// •[46] 祖尔法拉克 统一格式说明:(MapID, X, Y, Z, 0);
case GOSSIP_ACTION_INFO_DEF + 1 :
player->TeleportTo(209,1213,841,8.9,0);
break;
// •[49] 玛拉顿
case GOSSIP_ACTION_INFO_DEF + 2 :
player->TeleportTo(349,1012.700012,-459.317993,-43.547100,0);
break;
// •[53] 失落的神庙
case GOSSIP_ACTION_INFO_DEF + 3 :
player->TeleportTo(109,-313.369995,99.955399,-131.848999,0);
break;
// •[57] 黑石深渊
case GOSSIP_ACTION_INFO_DEF + 4 :
player->TeleportTo(230,456.928986,34.927700,-69.388100,0);
break;
// •[60] 通灵学院
case GOSSIP_ACTION_INFO_DEF + 5 :
player->TeleportTo(289,199,126,135,0);
break;
// •[60] 厄运之槌 (北区)
case GOSSIP_ACTION_INFO_DEF + 6 :
player->TeleportTo(429,255.164001,-17.024200,-2.560600,0);
break;
// •[60] 厄运之槌 (东区)
case GOSSIP_ACTION_INFO_DEF + 7 :
player->TeleportTo(429,46.24,-155.53,-2.71349,0);
break;
// •[60] 厄运之槌 (西区)
case GOSSIP_ACTION_INFO_DEF + 8 :
player->TeleportTo(429,32.722599,159.417007,-3.470170,0);
break;
// •[60] 斯坦索姆
case GOSSIP_ACTION_INFO_DEF + 9 :
player->TeleportTo(329,3392,-3379,143,0);
break;
// •[60] 黑石塔下
case GOSSIP_ACTION_INFO_DEF + 10 :
player->TeleportTo(229,78.19,-227.63,49.72,0);
break;
}
break;
// 高级副本
case 5:
uint32 price;
price = 100000;
switch(action) {
// •[团] 溶火之心 统一格式说明:(MapID, X, Y, Z, 0);
case GOSSIP_ACTION_INFO_DEF + 1 :
player->TeleportTo(409,1089.601685,-470.190247,-106.413055,0);
break;
// •[团] 黑石塔上
case GOSSIP_ACTION_INFO_DEF + 2 :
player->TeleportTo(229,78.339836,-227.793518,49.7103,0);
break;
// •[团] 祖尔格拉布
case GOSSIP_ACTION_INFO_DEF + 3 :
player->TeleportTo(309,-11916,-1251.469971,92.32,0);
break;
// •[团] 黑翼之巢
case GOSSIP_ACTION_INFO_DEF + 4 :
player->TeleportTo(469,-7674.470215,-1108.380005,396.649994,0);
break;
// •[团] 安其拉神庙
case GOSSIP_ACTION_INFO_DEF + 5 :
player->TeleportTo(531,-8212.002930,2034.474854,129.141342,0);
break;
// •[团] 安其拉废墟
case GOSSIP_ACTION_INFO_DEF + 6 :
player->TeleportTo(509,-8443.475586,1518.648560,31.906958,0);
break;
// •[团] 奥妮克希亚的巢穴
case GOSSIP_ACTION_INFO_DEF + 7 :
player->TeleportTo(249,30.010290,-58.840508,-5.325367,0);
break;
//•[团] 纳克萨玛斯
case GOSSIP_ACTION_INFO_DEF + 8 :
player->TeleportTo(533,3005.87,-3435.01,293.882,0);
break;
// •[团] 冰龙巢穴
case GOSSIP_ACTION_INFO_DEF + 9 :
player->TeleportTo(533,3700.35,-5185.92,143.957,4.403038,0);
break;
}
break;
// 野外BOSS坐标
case 9:
uint32 price_worldboss;
price_worldboss = 100000;
switch(action) {
// 暮色森林 统一格式说明:(MapID, X, Y, Z, 0);
case GOSSIP_ACTION_INFO_DEF + 1 :
player->TeleportTo(0,-10526.168945,-434.996796,50.894821,0);
break;
// 辛特兰
case GOSSIP_ACTION_INFO_DEF + 2 :
player->TeleportTo(0,759.605713,-3893.341309,116.475304,0);
break;
// 梣谷
case GOSSIP_ACTION_INFO_DEF + 3 :
player->TeleportTo(1,3120.289307,-3439.444336,139.566345,1);
break;
// 艾萨拉
case GOSSIP_ACTION_INFO_DEF + 4 :
player->TeleportTo(1,2622.219971,-5977.930176,100.562897,1);
break;
// 菲拉斯
case GOSSIP_ACTION_INFO_DEF + 5 :
player->TeleportTo(1,-2741.290039,2009.481323,31.877323,1);
break;
// 诅咒之地
case GOSSIP_ACTION_INFO_DEF + 6 :
player->TeleportTo(0,-12234.000000,-2474.000000,-3.000000,0);
break;
//水晶谷
case GOSSIP_ACTION_INFO_DEF + 7 :
player->TeleportTo(1,-6292.463379,1578.029053,0.155348,1);
break;
}
break;
// 三大战场坐标
case 10 :
switch(action) {
// 古拉巴什竞技场 统一格式说明:(MapID, X, Y, Z, 0);
case GOSSIP_ACTION_INFO_DEF + 1 :
player->TeleportTo(0,-13289.353516,118.628067,24.414938,1.047498);
break;
// 奥特兰战场(部落)
case GOSSIP_ACTION_INFO_DEF + 2 :
player->TeleportTo(30,390.553680,-283.560547,-42.987301,3.135666);
break;
// 战歌峡谷(部落)
case GOSSIP_ACTION_INFO_DEF + 3 :
player->TeleportTo(489,1123.168823,1462.474976,315.564148,3.464511);
break;
// 阿拉希战场(部落)
case GOSSIP_ACTION_INFO_DEF + 4 :
player->TeleportTo(529,855.156128,828.636108,-57.707348,2.812707);
break;
}
break;
// 风景传送
case 11 :
switch(action) {
//海加尔山 统一格式说明:(MapID, X, Y, Z, 0);
case GOSSIP_ACTION_INFO_DEF + 1 :
player->TeleportTo(1,4603.946777,-3879.250977,944.183472,1);
break;
//翡翠圣地 统一格式说明:(MapID, X, Y, Z, 0);
case GOSSIP_ACTION_INFO_DEF + 2 :
player->TeleportTo(1,3968.264648,-1290.036011,240.326889,5.927989);
break;
//时光之穴 统一格式说明:(MapID, X, Y, Z, 0);
case GOSSIP_ACTION_INFO_DEF + 3 :
player->TeleportTo(1,-8173.930176,-4737.463867,33.777351,4.772119);
break;
//黑暗之门 统一格式说明:(MapID, X, Y, Z, 0);
case GOSSIP_ACTION_INFO_DEF + 4 :
player->TeleportTo(0,-11849.031250,-3201.170654,-28.885090,3.280838);
break;
//双塔山 统一格式说明:(MapID, X, Y, Z, 0);
case GOSSIP_ACTION_INFO_DEF + 5 :
player->TeleportTo(1,-3331.353271,2225.728271,30.987701,6.267522);
break;
//梦境之树 统一格式说明:(MapID, X, Y, Z, 0);
case GOSSIP_ACTION_INFO_DEF + 6 :
player->TeleportTo(1,-2914.756104,1902.199341,34.741035,5.690404);
break;
//GM之岛 统一格式说明:(MapID, X, Y, Z, 0);
case GOSSIP_ACTION_INFO_DEF + 7 :
player->TeleportTo(1, 16222.1 ,16252.1,12.5872,1);
break;
//暴雪建设公司路障 统一格式说明:(MapID, X, Y, Z, 0);
case GOSSIP_ACTION_INFO_DEF + 8 :
player->TeleportTo(1,5478.060059,-3730.850098,1593.439941,5.610376);
break;
//天涯海滩 统一格式说明:(MapID, X, Y, Z, 0);
case GOSSIP_ACTION_INFO_DEF + 9 :
player->TeleportTo(1,-9851.617188,-3608.474121,8.939731,2.513388);
break;
//安戈洛环形山 统一格式说明:(MapID, X, Y, Z, 0);
case GOSSIP_ACTION_INFO_DEF + 10 :
player->TeleportTo(1,-8562.096680,-2106.056641,8.852538,0.090425);
break;
//比吉尔的飞艇残骸 统一格式说明:(MapID, X, Y, Z, 0);
case GOSSIP_ACTION_INFO_DEF + 11 :
player->TeleportTo(1,-4014.003418,-3768.186523,42.123295,5.220697);
break;
//石堡瀑布 统一格式说明:(MapID, X, Y, Z, 0);
case GOSSIP_ACTION_INFO_DEF + 12 :
player->TeleportTo(0,-9481.493164,-3326.915283,8.864347,0.846896);
break;
//地铁海底
case GOSSIP_ACTION_INFO_DEF + 13 :
player->TeleportTo(369, -9.96166,1238.17,-126.102,0);
break;
//工程师之岛
case GOSSIP_ACTION_INFO_DEF + 14 :
player->TeleportTo(451, 16299.464844, 16272.843750, 69.443901 ,0);
break;
//卡拉赞
case GOSSIP_ACTION_INFO_DEF + 15 :
player->TeleportTo(0, 11037.7 ,1999.49, 92.9823 ,0);
break;
}
break;
//开飞行点
case 6:
uint32 price_flags;
price_flags = 300000; //收10G的钱
if (player->GetMoney() >= price_flags) {
player->ModifyMoney(-int32(price_flags));
for (uint8 i=0; i<8; i++)
{ player->SetTaximask(i, 0xFFFFFFFF); }
player->SEND_GOSSIP_MENU(99995,_Item->GetGUID());
}
else player->SEND_GOSSIP_MENU(99997,_Item->GetGUID());
break;
//银行
case 8 :
player->GetSession()->SendShowBank( player->GetGUID() );
break;
// 灵魂医者复活
case 12 :
player-> GetSession()->SendSpiritResurrect();
break;
//魔兽工资领取,这个功能看起来比较算是测试用的,造理说不应该把玩家在线时间归零的
case 7 :
if(player->GetLevelPlayedTime() > 60) // 条件检查你在线时间大于60秒.这可以自己改
{
player->ModifyMoney(int32(100000)); //满足条件获得金币
player->SetInGameTime(uint32(NULL)); //将玩家在线时间归零
}else{
player->SEND_GOSSIP_MENU(99998,_Item->GetGUID());
}
break;
}
return true;
}
void AddSC_item_test()
{
Script *newscript;
newscript = new Script;
newscript->Name="item_test";
newscript->pItemUse = GossipHello_Item;
newscript->pGossipSelect_Item = GossipSelect_Item; //<--这个在十字佣兵里的程序是写&GossipSelect_Item没当真的蛮神奇的@@
m_scripts[nrscripts++] = newscript;
}
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
编辑: src/bindings/ScriptDev2/ScriptMgr.h
====================================================================
原始:
Script() :
pGossipHello(NULL), pQuestAccept(NULL), pGossipSelect(NULL), pGossipSelectWithCode(NULL),
pQuestSelect(NULL), pQuestComplete(NULL), pNPCDialogStatus(NULL), pChooseReward(NULL),
pItemHello(NULL), pGOHello(NULL), pAreaTrigger(NULL), pItemQuestAccept(NULL), pGOQuestAccept(NULL),
pGOChooseReward(NULL),pReceiveEmote(NULL),pItemUse(NULL), GetAI(NULL)
{}
改成:
Script() :
pGossipHello(NULL), pQuestAccept(NULL), pGossipSelect(NULL), pGossipSelectWithCode(NULL),
pQuestSelect(NULL), pQuestComplete(NULL), pNPCDialogStatus(NULL), pChooseReward(NULL),
pItemHello(NULL), pGOHello(NULL), pAreaTrigger(NULL), pItemQuestAccept(NULL), pGOQuestAccept(NULL),
pGOChooseReward(NULL),pReceiveEmote(NULL),pItemUse(NULL), pGossipSelect_Item(NULL),GetAI(NULL)
{}
//只是多加一个pGossipSelect_Item(NULL)
再找到底下这2行:
bool (*pGOChooseReward )(Player *player, GameObject *_GO, Quest *_Quest, uint32 opt );
CreatureAI* (*GetAI)(Creature *_Creature);
在中间补1行变成:
bool (*pGOChooseReward )(Player *player, GameObject *_GO, Quest *_Quest, uint32 opt );
bool (*pGossipSelect_Item )(Player *player, Item *_Item, uint32 sender, uint32 action );
CreatureAI* (*GetAI)(Creature *_Creature);
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
编辑: src/bindings/ScriptDev2/ScriptMgr.cpp
====================================================================
在底下的2个函式中间:
MANGOS_DLL_EXPORT
bool GossipSelectWithCode( Player *player, Creature *_Creature, uint32 sender, uint32 action, char* sCode )
{...}
MANGOS_DLL_EXPORT
bool QuestAccept( Player *player, Creature *_Creature, Quest *_Quest )
{...}
加入底下的一个函式:
MANGOS_DLL_EXPORT
bool GossipSelect_Item( Player *player, Item *_Item,uint32 sender, uint32 action )
{
Script *tmpscript = NULL;
printf("action: %d\n",action);
player->PlayerTalkClass->ClearMenus();
tmpscript = GetScriptByName(_Item->GetProto()->ScriptName);
if(!tmpscript || !tmpscript->pGossipSelect_Item) return false;
return tmpscript->pGossipSelect_Item(player,_Item,sender,action);
}
修改底下ItemUse的函式:
MANGOS_DLL_EXPORT
bool ItemUse( Player *player, Item* _Item)
{
Script *tmpscript = NULL;
tmpscript = GetScriptByName(_Item->GetProto()->ScriptName);
if(!tmpscript || !tmpscript->pItemUse) return false;
player->PlayerTalkClass->ClearMenus();
return tmpscript->pItemUse(player,_Item);
}
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
编辑: src/game/ScriptCalls.cpp
===================================================================
找到底下4行:
||!(testScript->ItemQuestAccept =(scriptCallItemQuestAccept )MANGOS_GET_PROC_ADDR(testScript->hScriptsLib,"ItemQuestAccept" ))
||!(testScript->GOQuestAccept =(scriptCallGOQuestAccept )MANGOS_GET_PROC_ADDR(testScript->hScriptsLib,"GOQuestAccept" ))
||!(testScript->ReceiveEmote =(scriptCallReceiveEmote )MANGOS_GET_PROC_ADDR(testScript->hScriptsLib,"ReceiveEmote" ))
||!(testScript->GetAI =(scriptCallGetAI )MANGOS_GET_PROC_ADDR(testScript->hScriptsLib,"GetAI" ))
修改成:
||!(testScript->ItemQuestAccept =(scriptCallItemQuestAccept )MANGOS_GET_PROC_ADDR(testScript->hScriptsLib,"ItemQuestAccept" ))
||!(testScript->GOQuestAccept =(scriptCallGOQuestAccept )MANGOS_GET_PROC_ADDR(testScript->hScriptsLib,"GOQuestAccept" ))
||!(testScript->ReceiveEmote =(scriptCallReceiveEmote )MANGOS_GET_PROC_ADDR(testScript->hScriptsLib,"ReceiveEmote" ))
||!(testScript->ItemUse =(scriptCallItemUse )MANGOS_GET_PROC_ADDR(testScript->hScriptsLib,"ItemUse" ))
||!(testScript->GossipSelect_Item =(scriptCallGossipSelect_Item )MANGOS_GET_PROC_ADDR(testScript->hScriptsLib,"GossipSelect_Item" ))
||!(testScript->GetAI =(scriptCallGetAI )MANGOS_GET_PROC_ADDR(testScript->hScriptsLib,"GetAI" ))
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
编辑: src/game/ScriptCalls.h
===================================================================
找到底下3行:
typedef bool(MANGOS_IMPORT * scriptCallGOChooseReward)(Player *player, GameObject *, Quest *, uint32 opt );
typedef bool(MANGOS_IMPORT * scriptCallReceiveEmote) ( Player *player, Creature *_Creature, uint32 emote );
typedef CreatureAI* (MANGOS_IMPORT * scriptCallGetAI) ( Creature *_Creature );
在底下补上下面这两行:
typedef bool(MANGOS_IMPORT * scriptCallItemUse) ( Player *player, Item* _Item);
typedef bool(MANGOS_IMPORT * scriptCallGossipSelect_Item)(Player *player, Item *_Item, uint32 sender, uint32 action);
找到底下3行:
scriptCallGOQuestAccept GOQuestAccept;
scriptCallReceiveEmote ReceiveEmote;
scriptCallGetAI GetAI;
在底下补上下面这两行:
scriptCallItemUse ItemUse;
scriptCallGossipSelect_Item GossipSelect_Item;
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
编辑: src/game/ItemHandler.cpp
====================================================================
#include "ScriptCalls.h" //<---在档案最上面的#include xxx底下加入此行,然后修改底下的HandleReadItem函式
void WorldSession::HandleReadItem( WorldPacket & recv_data )
{
CHECK_PACKET_SIZE(recv_data,1+1);
//sLog.outDebug( "WORLD: CMSG_READ_ITEM");
WorldPacket data;
uint8 bag, slot;
recv_data >> bag >> slot;
//sLog.outDetail("STORAGE: Read bag = %u, slot = %u", bag, slot);
Item *pItem = _player->GetItemByPos( bag, slot );
if( pItem && pItem->GetProto()->PageText )
{
uint8 msg = _player->CanUseItem( pItem );
if(!Script->ItemUse(GetPlayer(),pItem)){ //加入此行,不加这里的话会造成使用传送宝石不会出现选单,会要你去接任务@@
if( msg == EQUIP_ERR_OK ){
data.Initialize (SMSG_READ_ITEM_OK, 8);
sLog.outDetail("STORAGE: Item page sent");
}else{
data.Initialize( SMSG_READ_ITEM_FAILED, 8 );
sLog.outDetail("STORAGE: Unable to read item");
_player->SendEquipError( msg, pItem, NULL );
}
data << pItem->GetGUID();
SendPacket(&data);
} //加入此行
}
else
_player->SendEquipError( EQUIP_ERR_ITEM_NOT_FOUND, NULL, NULL );
}
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
编辑: src/game/NPCHandler.cpp <---这个不改的话会造成无法使用到GossipSelect_Item函式喔
====================================================================
找到底下的HandleGossipSelectOptionOpcode函式:
void WorldSession::HandleGossipSelectOptionOpcode( WorldPacket & recv_data )
{
CHECK_PACKET_SIZE(recv_data,8+4);
sLog.outDetail("WORLD: CMSG_GOSSIP_SELECT_OPTION");
uint32 option;
uint64 guid;
recv_data >> guid >> option;
uint16 pos = _player->GetPosByGuid(guid);//加入此行
Item *pItem = _player->GetItemByPos( pos ); //加入此行
Creature *unit = ObjectAccessor::Instance().GetNPCIfCanInteractWith(*_player, guid,UNIT_NPC_FLAG_NONE);
//底下程序要修正,请注意看
if (unit){
if(!Script->GossipSelect( _player, unit, _player->PlayerTalkClass->GossipOptionSender( option ), _player->PlayerTalkClass->GossipOptionAction( option )) )
unit->OnGossipSelect( _player, option );
}else{
if (!Script->GossipSelect_Item( _player, pItem, _player->PlayerTalkClass->GossipOptionSender( option ), _player->PlayerTalkClass->GossipOptionAction( option )))
{
sLog.outDebug( "WORLD: HandleGossipSelectOptionOpcode - Unit (GUID: %u) not found or you can't interact with him.", uint32(GUID_LOPART(guid)) );
return;
}
}
}
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
====================================================================
最后在你的数据库里增加一笔数据如下
INSERT INTO `item_template` VALUES (’31023′, ‘12′, ‘0′, ‘传送宝石’, ‘传送宝石’, ‘传送宝石’, ‘传送宝石’, ‘29691′, ‘1′, ‘0′, ‘1′, ‘0′, ‘0′, ‘0′, ‘-1′, ‘-1′, ‘1′, ‘0′, ‘0′, ‘0′, ‘0′, ‘0′, ‘0′, ‘0′, ‘0′, ‘1′, ‘1′, ‘0′, ‘0′, ‘0′, ‘0′, ‘0′, ‘0′, ‘0′, ‘0′, ‘0′, ‘0′, ‘0′, ‘0′, ‘0′, ‘0′, ‘0′, ‘0′, ‘0′, ‘0′, ‘0′, ‘0′, ‘0′, ‘0′, ‘0′, ‘0′, ‘0′, ‘0′, ‘0′, ‘0′, ‘0′, ‘0′, ‘0′, ‘0′, ‘0′, ‘0′, ‘0′, ‘0′, ‘0′, ‘0′, ‘0′, ‘0′, ‘0′, ‘0′, ‘0′, ‘0′, ‘0′, ‘0′, ‘0′, ‘0′, ‘0′, ‘0′, ‘0′, ‘0′, ‘0′, ‘0′, ‘0′, ‘0′, ‘0′, ‘0′, ‘0′, ‘0′, ‘0′, ‘0′, ‘0′, ‘0′, ‘0′, ‘0′, ‘0′, ‘0′, ‘0′, ‘0′, ‘0′, ‘0′, ‘0′, ‘0′, ‘0′, ‘0′, ‘4′, ”, ‘78′, ‘0′, ‘0′, ‘0′, ‘0′, ‘0′, ‘0′, ‘0′, ‘0′, ‘0′, ‘0′, ‘0′, ‘0′, ‘0′, ‘item_test’);
然后就可以使用.additem 31023产生这个对象使用传送宝石啰^^
好了收工啰,快去体验结果吧^^
////////////////////////////////////////////////////////////////////////////////
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
修改Formulas.h中的打怪获得经验值 - 主要是修改万一等级差超过5级后会没有任何经验值
如果觉得差5级以上本来就不需要经验值者就不需要变动
可是如果有开放到60级以上的话...就可能要改了...不然打到70级可能就升不上去了
===================================================================
inline uint32 BaseGain(uint32 pl_level, uint32 mob_level)
{
if( pl_level == mob_level )
return (pl_level*5 + 45);
else if( mob_level > pl_level )
return static_cast(( (pl_level*5 + 45) * (1 + 0.05*(mob_level - pl_level)) ) + 0.5);
else
{
uint32 gray_level = GetGrayLevel(pl_level);
if( mob_level > gray_level )
{
uint32 ZD = GetZeroDifference(pl_level);
return ( (pl_level*5 + 45) * (1 - (pl_level - mob_level)/ZD) );
}
return 100/(pl_level-mob_level); //原本是return 0;
}
}
回复 更多评论