M端的飞行宝石代码(启发性代码)
#include "sc_gossip.h" #include "Item.h" #include "Player.h" #include "SpellAuras.h" #include "GossipDef.h" #include "Chat.h" bool GossipHello_ItemUse_flying_mount(Player *player, Item* _Item, SpellCastTargets const& targets) { player->CLEAR_GOSSIP_MENU(); if (!player->isDead() && !player->isInCombat()) { player->ADD_GOSSIP_ITEM( 1, " |CFF0000FF【大芒果系统WWW.MangosCn.COM】|CFF009933 ", 1, GOSSIP_ACTION_INFO_DEF + 10); player->ADD_GOSSIP_ITEM( 8, "【普通陆地坐骑】 普通陆地坐骑 " , 1, GOSSIP_ACTION_INFO_DEF + 1); player->ADD_GOSSIP_ITEM( 4, "【高级陆地坐骑】 高级陆地坐骑 " , 1, GOSSIP_ACTION_INFO_DEF + 2); player->ADD_GOSSIP_ITEM( 4, "【普通飞行坐骑】 普通飞行坐骑 " , 1, GOSSIP_ACTION_INFO_DEF + 3); player->ADD_GOSSIP_ITEM( 4, "【高级飞行坐骑】 高级飞行坐骑 " , 1, GOSSIP_ACTION_INFO_DEF + 4); player->ADD_GOSSIP_ITEM( 4, "【特殊最新坐骑】 特殊最新坐骑 " , 1, GOSSIP_ACTION_INFO_DEF + 5); player->SEND_GOSSIP_MENU(999999,_Item->GetGUID()); return true; } else { return true; } } void SendDefaultMenu_ItemUse_flying_mount(Player *player, Item *_Item, uint32 action ,SpellCastTargets const& targets) { switch(action) { //【普通陆地坐骑】 case GOSSIP_ACTION_INFO_DEF + 1 : player->ADD_GOSSIP_ITEM( 0, " ·普通坐骑1 " , 2, GOSSIP_ACTION_INFO_DEF + 1); player->ADD_GOSSIP_ITEM( 0, " ·普通坐骑2 " , 2, GOSSIP_ACTION_INFO_DEF + 2); player->ADD_GOSSIP_ITEM( 7, "·返回上一级菜单 ", 2, GOSSIP_ACTION_INFO_DEF + 99); player->SEND_GOSSIP_MENU(999999,_Item->GetGUID()); break; //【高级陆地坐骑】 case GOSSIP_ACTION_INFO_DEF + 2 : player->ADD_GOSSIP_ITEM( 0, " ·高级坐骑1 " , 3, GOSSIP_ACTION_INFO_DEF + 1); player->ADD_GOSSIP_ITEM( 0, " ·高级坐骑2 " , 3, GOSSIP_ACTION_INFO_DEF + 2); player->ADD_GOSSIP_ITEM( 7, "·返回上一级菜单 ", 3, GOSSIP_ACTION_INFO_DEF + 99); player->SEND_GOSSIP_MENU(999999,_Item->GetGUID()); break; //【普通飞行坐骑】 case GOSSIP_ACTION_INFO_DEF + 3 : player->ADD_GOSSIP_ITEM( 0, " ·普通飞行坐骑1 " , 4, GOSSIP_ACTION_INFO_DEF + 1); player->ADD_GOSSIP_ITEM( 0, " ·普通飞行坐骑2 " , 4, GOSSIP_ACTION_INFO_DEF + 2); player->ADD_GOSSIP_ITEM( 7, "·返回上一级菜单 ", 4, GOSSIP_ACTION_INFO_DEF + 99); player->SEND_GOSSIP_MENU(999999,_Item->GetGUID()); break; //【高级飞行坐骑】 case GOSSIP_ACTION_INFO_DEF + 4 : player->ADD_GOSSIP_ITEM( 0, " ·高级飞行坐骑1 " , 5, GOSSIP_ACTION_INFO_DEF + 1); player->ADD_GOSSIP_ITEM( 0, " ·高级飞行坐骑2 " , 5, GOSSIP_ACTION_INFO_DEF + 2); player->ADD_GOSSIP_ITEM( 7, "·返回上一级菜单 ", 5, GOSSIP_ACTION_INFO_DEF + 99); player->SEND_GOSSIP_MENU(999999,_Item->GetGUID()); break; //【特殊最新坐骑】 case GOSSIP_ACTION_INFO_DEF + 5 : player->ADD_GOSSIP_ITEM( 0, " ·特殊最新坐骑1 " , 6, GOSSIP_ACTION_INFO_DEF + 1); player->ADD_GOSSIP_ITEM( 0, " ·特殊最新坐骑2 " , 6, GOSSIP_ACTION_INFO_DEF + 2); player->ADD_GOSSIP_ITEM( 7, "·返回上一级菜单 ", 6, GOSSIP_ACTION_INFO_DEF + 99); player->SEND_GOSSIP_MENU(999999,_Item->GetGUID()); break; } } bool GossipSelect_ItemUse_flying_mount(Player *player, Item *_Item, uint32 sender, uint32 action ,SpellCastTargets const& targets) { int icount = 0; //uint32 price_city; switch(sender) { // 主选单 case 1 : SendDefaultMenu_ItemUse_flying_mount(player, _Item, action,targets); break; case 2 ://普通陆地坐骑 switch(action) { case GOSSIP_ACTION_INFO_DEF + 1 : if (!player->IsMounted()) //判断是否在飞行状态 { player->FlyingMount(player,34790); break; //执行飞行命令 } else { player->GetSession()->SendAreaTriggerMessage("你正在使用-行驶工具"); GossipHello_ItemUse_flying_mount(player,_Item,targets); //返回菜单 } case GOSSIP_ACTION_INFO_DEF + 2 : if (!player->IsMounted()) //判断是否在飞行状态 { player->FlyingMount(player,34896); break; //执行飞行命令 } else { player->GetSession()->SendAreaTriggerMessage("你正在使用-行驶工具"); GossipHello_ItemUse_flying_mount(player,_Item,targets);//返回菜单 } break; case GOSSIP_ACTION_INFO_DEF + 99 : { GossipHello_ItemUse_flying_mount(player,_Item,targets);//返回菜单 break; } } break; case 3 ://高级陆地坐骑 switch(action) { case GOSSIP_ACTION_INFO_DEF + 1 : if (!player->IsMounted()) //判断是否在飞行状态 { player->FlyingMount(player,39315); break; //执行飞行命令 } else { player->GetSession()->SendAreaTriggerMessage("你正在使用-行驶工具"); GossipHello_ItemUse_flying_mount(player,_Item,targets); //返回菜单 } case GOSSIP_ACTION_INFO_DEF + 2 : if (!player->IsMounted()) //判断是否在飞行状态 { player->FlyingMount(player,36702); break; //执行飞行命令 } else { player->GetSession()->SendAreaTriggerMessage("你正在使用-行驶工具"); GossipHello_ItemUse_flying_mount(player,_Item,targets);//返回菜单 } break; case GOSSIP_ACTION_INFO_DEF + 99 : { GossipHello_ItemUse_flying_mount(player,_Item,targets);//返回菜单 break; } } break; case 4 ://普通飞行坐骑 switch(action) { case GOSSIP_ACTION_INFO_DEF + 1 : if (!player->IsMounted()) //判断是否在飞行状态 { player->FlyingMount(player,32235); break; //执行飞行命令 } else { player->GetSession()->SendAreaTriggerMessage("你正在使用-行驶工具"); GossipHello_ItemUse_flying_mount(player,_Item,targets); //返回菜单 } case GOSSIP_ACTION_INFO_DEF + 2 : if (!player->IsMounted()) //判断是否在飞行状态 { player->FlyingMount(player,32244); break; //执行飞行命令 } else { player->GetSession()->SendAreaTriggerMessage("你正在使用-行驶工具"); GossipHello_ItemUse_flying_mount(player,_Item,targets);//返回菜单 } break; case GOSSIP_ACTION_INFO_DEF + 99 : { GossipHello_ItemUse_flying_mount(player,_Item,targets);//返回菜单 break; } } break; case 5 ://高级飞行坐骑 switch(action) { case GOSSIP_ACTION_INFO_DEF + 1 : if (!player->IsMounted()) //判断是否在飞行状态 { player->FlyingMount(player,37015); break; //执行飞行命令 } else { player->GetSession()->SendAreaTriggerMessage("你正在使用-行驶工具"); GossipHello_ItemUse_flying_mount(player,_Item,targets); //返回菜单 } case GOSSIP_ACTION_INFO_DEF + 2 : if (!player->IsMounted()) //判断是否在飞行状态 { player->FlyingMount(player,32345); break; //执行飞行命令 } else { player->GetSession()->SendAreaTriggerMessage("你正在使用-行驶工具"); GossipHello_ItemUse_flying_mount(player,_Item,targets);//返回菜单 } break; case GOSSIP_ACTION_INFO_DEF + 99 : { GossipHello_ItemUse_flying_mount(player,_Item,targets);//返回菜单 break; } } break; case 6 ://特殊最新坐骑 switch(action) { case GOSSIP_ACTION_INFO_DEF + 1 : if (!player->IsMounted()) //判断是否在飞行状态 { player->FlyingMount(player,34767); break; //执行飞行命令 } else { player->GetSession()->SendAreaTriggerMessage("你正在使用-行驶工具"); GossipHello_ItemUse_flying_mount(player,_Item,targets); //返回菜单 } case GOSSIP_ACTION_INFO_DEF + 2 : if (!player->IsMounted()) //判断是否在飞行状态 { player->FlyingMount(player,33943); break; //执行飞行命令 } else { player->GetSession()->SendAreaTriggerMessage("你正在使用-行驶工具"); GossipHello_ItemUse_flying_mount(player,_Item,targets);//返回菜单 } break; case GOSSIP_ACTION_INFO_DEF + 99 : { GossipHello_ItemUse_flying_mount(player,_Item,targets);//返回菜单 break; } } break; } return true; } void AddSC_flying_mount() { Script *newscript; newscript = new Script; newscript->Name="flying_mount"; newscript->pItemUse = GossipHello_ItemUse_flying_mount; newscript->pGossipSelect_Item = GossipSelect_ItemUse_flying_mount; m_scripts[nrscripts++] = newscript; }