2007年4月2日 星期一

mangos 傳送寶石[整理版]

傳送寶石[整理版-繁體中文-stenly]

原始的Mangos+ScriptDev2中如何加入傳送寶石的程式(整理版)-感謝以前很多的大大們把它們寫出來^^

不過我一直沒看到完整的教學文章,東拼西拼的終於把它弄出來了

這些Code其實在十字佣兵裏發佈的源碼裏都有,我只是把它整理出來而以^^

主要是給有興趣的人一起研究囉^^看懂之後對傳送寶石的實作會了解的更多^^


功能說明:

你會覺得在魔獸裏老是要找坐標位置很麻煩嗎?隨身的傳送寶石是一個超級方便的物品^^有了它想去那就去那再也不用找坐標打命令了!

魔獸工資領取很有趣的一個功能,這裏是設定成你只要在遊戲裏每待60秒以上,再按一下"魔獸工資領取",人物就會領到10G@@

也包含了個人隨身銀行,靈魂醫者復活功能


底下開始就都是要修改的程式碼了^^



傳送寶石[整理版-繁體中文-stenly]
原始的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;
}
}

沒有留言: