Jump to content

[REQUEST]Item Menu


Guest DarkMessiah

Recommended Posts

Hello guys,

Is it possible for the dev-team to build in some way so items can have a gossip menu that works? i made a gossipmenu out of an item but when u click something just nothing happens (i use SD2 also but they told me MaNGOS does not allow to use item menus).

Thanks,

DarkMessiah

Link to comment
Share on other sites

How did you make the gossip menu?

This is what i have atm.

#include "precompiled.h"

void SendDefaultMenu_MorphStone(Player* pPlayer, Item* pItem, uint32 action)
{
   pPlayer->MonsterSay("SendDefaultMenu", LANG_UNIVERSAL, NULL);
   // Not allow in combat
   if (pPlayer->isInCombat())
   {
       pPlayer->CLOSE_GOSSIP_MENU();
       pPlayer->MonsterSay("You are in combat!", LANG_UNIVERSAL, NULL);
       return;
   }
   switch(action)
   {
       case 1: // Demorph
           pPlayer->DeMorph();
       break;

       case 2: //Illidan
           pPlayer->SetDisplayId(21135);
       break;
       pPlayer->CLOSE_GOSSIP_MENU();
       pPlayer->MonsterSay("End of Switch", LANG_UNIVERSAL, NULL);
   } // end of switch
} //end of function

bool GossipHello_MorphStone(Player* pPlayer, Item* pItem)
{

   {
       pPlayer->ADD_GOSSIP_ITEM( 7, "Demorph"             , GOSSIP_SENDER_MAIN, 1);
       pPlayer->ADD_GOSSIP_ITEM( 9, "Illidan"               , GOSSIP_SENDER_MAIN, 2);
       pPlayer->MonsterSay("Menu Shown", LANG_UNIVERSAL, NULL);
   }

   pPlayer->SEND_GOSSIP_MENU(DEFAULT_GOSSIP_MESSAGE,pItem->GetGUID());
   return true;
}

bool ItemUse_item_custom_MorphStone(Player* pPlayer, Item* pItem, const SpellCastTargets &pTargets)
{
   if ( (pPlayer->isInCombat()) || (pPlayer->isInFlight()) || (pPlayer->isDead()))
   {
       pPlayer->SendEquipError(EQUIP_ERR_NOT_IN_COMBAT,pItem,NULL );
       return false;
   }
   pPlayer->RemoveSpellsCausingAura(SPELL_AURA_MOUNTED);
   {
       pPlayer->MonsterSay("ItemUse", LANG_UNIVERSAL, NULL);
       GossipHello_MorphStone(pPlayer, pItem);
   }
   return true;
}

bool GossipSelect_MorphStone(Player* pPlayer, Creature* pCreature, uint32 sender, uint32 action)
{
   // Main menu
   if (sender == GOSSIP_SENDER_MAIN)
   //Item* pItem = (Item) pCreature;
   //SendDefaultMenu_MorphStone(pPlayer, pItem, action);

return true;
}

void AddSC_item_custom_MorphStone()
{
   Script *newscript;
   newscript = new Script;
   newscript->Name="item_custom_MorphStone";
   newscript->pItemUse = &ItemUse_item_custom_MorphStone;
   //newscript->pGossipSelect = &GossipSelect_MorphStone;
   newscript->RegisterSelf();
}

Link to comment
Share on other sites

maybe this is what you want

/*
* Copyright (C) 2005-2009 MaNGOS <http://getmangos.eu/>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
*/
#include "precompiled.h"
#include "sc_gossip.h"
#include "Player.h"
#include "GossipDef.h"
#include "Spell.h"
bool GossipHello_ItemUse_Item_teleport(Player *player, Item* _Item, SpellCastTargets const& targets)
{

       //判断是否战斗状态
       if(player->isInCombat())
       {
           player->SEND_GOSSIP_MENU(100007,_Item->GetGUID());
           return true;
       }
       //判断是否死亡状态
       if( player->isDead() )
          {
       player->SEND_SPRESURRECT();
       return true;
              }
   player->ADD_GOSSIP_ITEM( 0, " |CFFFF8000【世界主城传送】|CFF009933 "                            , 1, GOSSIP_ACTION_INFO_DEF + 1);
   player->ADD_GOSSIP_ITEM( 0, " |CFFFF8000【外域地区传送】|CFF009933 "                            , 1, GOSSIP_ACTION_INFO_DEF + 2);
   player->ADD_GOSSIP_ITEM( 0, " |CFFFF8000【诺森德大陆传送】|CFF009933 "                          , 1, GOSSIP_ACTION_INFO_DEF + 3);
   player->ADD_GOSSIP_ITEM( 0, " |CFFFF8000【世界风景传送】|CFF009933 "                            , 1, GOSSIP_ACTION_INFO_DEF + 4);
   player->ADD_GOSSIP_ITEM( 0, " |CFFFF8000【初级副本传送】|CFF009933 "                            , 1, GOSSIP_ACTION_INFO_DEF + 5);
   player->ADD_GOSSIP_ITEM( 0, " |CFFFF8000【中级副本传送】|CFF009933 "                            , 1, GOSSIP_ACTION_INFO_DEF + 6);
   player->ADD_GOSSIP_ITEM( 0, " |CFFFF8000【团队副本传送】|CFF009933 "                            , 1, GOSSIP_ACTION_INFO_DEF + 7);
   player->ADD_GOSSIP_ITEM( 0, " |CFFFF8000【外域副本之一】|CFF009933 "                            , 1, GOSSIP_ACTION_INFO_DEF + 8);
   player->ADD_GOSSIP_ITEM( 0, " |CFFFF8000【外域副本之二】|CFF009933 "                            , 1, GOSSIP_ACTION_INFO_DEF + 9);
   player->ADD_GOSSIP_ITEM( 0, " |CFFFF8000【诺森德副本传送】|CFF009933 "                          , 1, GOSSIP_ACTION_INFO_DEF + 10);
   player->ADD_GOSSIP_ITEM( 0, " |CFFFF8000【野外BOSS传送】|CFF009933 "                            , 1, GOSSIP_ACTION_INFO_DEF + 11);
   player->ADD_GOSSIP_ITEM( 0, " |CFFFF8000【世界战场传送】|CFF009933 "                            , 1, GOSSIP_ACTION_INFO_DEF + 12);
   player->ADD_GOSSIP_ITEM( 0, " |CFFFF8000【附加功能】|CFF009933 "                                , 1, GOSSIP_ACTION_INFO_DEF + 13);
   player->SEND_GOSSIP_MENU(99990,_Item->GetGUID());
   return true;
}

void SendDefaultMenu_ItemUse_Item_teleport(Player *player, Item *_Item, uint32 action, SpellCastTargets const& targets)
{
       switch(action) {
               // 主城
               case GOSSIP_ACTION_INFO_DEF + 1 :
       if ( player->GetTeam() == ALLIANCE )//判断是否联盟
       {
                       player->ADD_GOSSIP_ITEM( 0, " |Cffffff00【联盟 暴风城】|CFF009933 "                , 2, GOSSIP_ACTION_INFO_DEF + 1);
                       player->ADD_GOSSIP_ITEM( 0, " |Cffffff00【联盟 铁炉堡】|CFF009933 "                , 2, GOSSIP_ACTION_INFO_DEF + 2);
                       player->ADD_GOSSIP_ITEM( 0, " |Cffffff00【联盟 达纳苏斯】|CFF009933 "              , 2, GOSSIP_ACTION_INFO_DEF + 3);
                       player->ADD_GOSSIP_ITEM( 0, " |Cffffff00【联盟 艾克索达】|CFF009933 "              , 2, GOSSIP_ACTION_INFO_DEF + 4);
                       player->ADD_GOSSIP_ITEM( 0, " |Cffffff00【联盟 人类出生地】|CFF009933 "            , 2, GOSSIP_ACTION_INFO_DEF + 5);
                       player->ADD_GOSSIP_ITEM( 0, " |Cffffff00【联盟 暗夜精灵出生地】|CFF009933 "        , 2, GOSSIP_ACTION_INFO_DEF + 6);
                       player->ADD_GOSSIP_ITEM( 0, " |Cffffff00【联盟 侏儒矮人出生地】|CFF009933 "        , 2, GOSSIP_ACTION_INFO_DEF + 7);
                       player->ADD_GOSSIP_ITEM( 0, " |Cffffff00【联盟 德莱尼出生地】|CFF009933 "          , 2, GOSSIP_ACTION_INFO_DEF + 8);

       }
       else
       {
                       player->ADD_GOSSIP_ITEM( 0, " |CFFFF0000【部落 奥格瑞玛】|CFF009933 "              , 2, GOSSIP_ACTION_INFO_DEF + 9);
                       player->ADD_GOSSIP_ITEM( 0, " |CFFFF0000【部落 雷霆崖】|CFF009933 "                , 2, GOSSIP_ACTION_INFO_DEF + 10);
                       player->ADD_GOSSIP_ITEM( 0, " |CFFFF0000【部落 幽暗城】|CFF009933 "                , 2, GOSSIP_ACTION_INFO_DEF + 11);
                       player->ADD_GOSSIP_ITEM( 0, " |CFFFF0000【部落 银月城】|CFF009933 "                , 2, GOSSIP_ACTION_INFO_DEF + 12);
                       player->ADD_GOSSIP_ITEM( 0, " |CFFFF0000【部落 兽人出生地】|CFF009933 "            , 2, GOSSIP_ACTION_INFO_DEF + 13);
                       player->ADD_GOSSIP_ITEM( 0, " |CFFFF0000【部落 牛头人出生地】|CFF009933 "          , 2, GOSSIP_ACTION_INFO_DEF + 14);
                       player->ADD_GOSSIP_ITEM( 0, " |CFFFF0000【部落 亡灵出生地】|CFF009933 "            , 2, GOSSIP_ACTION_INFO_DEF + 15);
                       player->ADD_GOSSIP_ITEM( 0, " |CFFFF0000【部落 血精灵出生地】|CFF009933 "          , 2, GOSSIP_ACTION_INFO_DEF + 16);
}
                       player->ADD_GOSSIP_ITEM( 0, " |Cff808000【中立 棘齿城】|CFF009933 "                , 2, GOSSIP_ACTION_INFO_DEF + 17);
                       player->ADD_GOSSIP_ITEM( 0, " |Cff808000【中立 藏宝海湾】|CFF009933 "              , 2, GOSSIP_ACTION_INFO_DEF + 18);
                       player->ADD_GOSSIP_ITEM( 0, " |Cff808000【中立 加基森】|CFF009933 "                , 2, GOSSIP_ACTION_INFO_DEF + 19);
                       player->ADD_GOSSIP_ITEM( 0, " |Cff808000【中立 冬泉谷】|CFF009933 "                , 2, GOSSIP_ACTION_INFO_DEF + 20);
                       player->ADD_GOSSIP_ITEM( 7, " |Cff808000【返回到上一级选项菜单】|CFF009933 "       , 2, GOSSIP_ACTION_INFO_DEF + 99);
                       player->SEND_GOSSIP_MENU(99991,_Item->GetGUID());
                       break;}
}

bool GossipSelect_ItemUse_Item_teleport(Player *player, Item *_Item, uint32 sender, uint32 action, SpellCastTargets const& targets)
{
               switch(sender) {
               // 主选单
               case GOSSIP_SENDER_MAIN :
                       SendDefaultMenu_ItemUse_Item_teleport(player, _Item, action,targets);
                       break;
               // 各大主城
               case 2 :
                       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(530,-4071.7f,-12036.7f,-1.5f,0);
                   break;
                   // ·人类出生地 统一格式说明:(MapID, X, Y, Z, 0);
               case GOSSIP_ACTION_INFO_DEF + 5 :
                   player->TeleportTo(0,-8945.808594,-152.064667,82.491745,0);
                   break;
                   // ·暗夜精灵出生地
               case GOSSIP_ACTION_INFO_DEF + 6 :
                   player->TeleportTo(1,10321.046875,834.703125,1326.373413,0);
                   break;
                   // ·地精出生地
               case GOSSIP_ACTION_INFO_DEF + 7 :
                   player->TeleportTo(0,-6238.875488,336.343140,382.963715,0);
                   break;
                   // ·德莱妮出生地
               case GOSSIP_ACTION_INFO_DEF + 8 :
                   player->TeleportTo(530,-3963.237549,-13929.471680,100.529718,0);
                   break;
                   // 奥格瑞玛
               case GOSSIP_ACTION_INFO_DEF + 9 :
                   player->TeleportTo(1,1317,-4383,27,0);
                   break;
                   // 雷霆崖
               case GOSSIP_ACTION_INFO_DEF + 10 :
                   player->TeleportTo(1,-1391,140,23,0);
                   break;
                   // 幽暗城
               case GOSSIP_ACTION_INFO_DEF + 11 :
                   player->TeleportTo(0,1909,235,53,0);
                   break;
                   //血精灵主城
               case GOSSIP_ACTION_INFO_DEF + 12 :
                   player->TeleportTo(530,9336.9f,-7278.4f,13.6f,0);
                   break;
                   // ·兽人出生地
               case GOSSIP_ACTION_INFO_DEF + 13 :
                   player->TeleportTo(1,-600.34890,-4263.093262,38.956245,0);
                   break;
                   // ·牛头人出生地
               case GOSSIP_ACTION_INFO_DEF + 14 :
                   player->TeleportTo(1,-2938.627686,-265.806152,53.438744,0);
                   break;
                   // ·亡灵出生地
               case GOSSIP_ACTION_INFO_DEF + 15 :
                   player->TeleportTo(0,1664.067139,1677.903564,120.529999,0);
                   break;
                   // ·血精灵出生地
               case GOSSIP_ACTION_INFO_DEF + 16 :
                   player->TeleportTo(530,10351.513250,-6358.020020,33.610661,0);
                   break;
                   // 棘齿城
               case GOSSIP_ACTION_INFO_DEF + 17 :
                   player->TeleportTo(1,-977,-3788,6,0);
                   break;
                   // 藏宝海湾
               case GOSSIP_ACTION_INFO_DEF + 18 :
                   player->TeleportTo(0,-14302,518,9,0);
                   break;
                   // 加基森
               case GOSSIP_ACTION_INFO_DEF + 19 :
                   player->TeleportTo(1,-7177.103516,-3788.077393,8.370177,3.621340);
                   break;
                   // 冬泉谷
               case GOSSIP_ACTION_INFO_DEF + 20 :
                   player->TeleportTo(1,6723.473145,-4649.303711,720.980835,4.653478);
                   break;
                   //返回
               case GOSSIP_ACTION_INFO_DEF + 99 :
                   GossipHello_ItemUse_Item_teleport(player,_Item,targets);
                   break;
                       }
                       break;
void AddSC_item_teleport()
{
   Script *newscript;
   newscript = new Script;
   newscript->Name="item_teleport";
   newscript->pItemUse = GossipHello_ItemUse_Item_teleport;
   newscript->pGossipSelect_Item = GossipSelect_ItemUse_Item_teleport;
   newscript->RegisterSelf();
}

Link to comment
Share on other sites

#include "precompiled.h"
#include "sc_gossip.h"
#include "Player.h"
#include "GossipDef.h"
#include "Spell.h"
bool GossipHello_ItemUse_Item_teleport(Player *player, Item* _Item, SpellCastTargets const& targets)
{
       if(player->isInCombat())
       {
           return true;
       }
       if( player->isDead() )
       {
           return true;
       }
   player->ADD_GOSSIP_ITEM( 0, "", 1, 1);
   player->SEND_GOSSIP_MENU(99990,_Item->GetGUID());
   return true;
}

void SendDefaultMenu_ItemUse_Item_teleport(Player *player, Item *_Item, uint32 action, SpellCastTargets const& targets)
{
   switch(action) {
       case GOSSIP_ACTION_INFO_DEF + 1 :
           // Main Menu
               player->ADD_GOSSIP_ITEM( 2, "Level Road", GOSSIP_SENDER_MAIN, 2013); //Werkt 100%
               if (player->GetTeam() == ALLIANCE)
               {
                   player->ADD_GOSSIP_ITEM( 1, "[Alliance Cities]", GOSSIP_SENDER_MAIN, 2); //Werkt 100%
                   player->ADD_GOSSIP_ITEM( 1, "[Horde Cities]", GOSSIP_SENDER_MAIN, 1); //Werkt 100%
               }else{
                   player->ADD_GOSSIP_ITEM( 0, "[Horde Cities]", GOSSIP_SENDER_MAIN, 1); //Werkt 100%
                   player->ADD_GOSSIP_ITEM( 0, "[Alliance Cities]", GOSSIP_SENDER_MAIN, 2); //Werkt 100%
               }
               player->ADD_GOSSIP_ITEM( 2 , "[Neutral Cities]", GOSSIP_SENDER_MAIN, 3); //Werkt 100%
               player->ADD_GOSSIP_ITEM( 2 , "PVP-Arena", GOSSIP_SENDER_MAIN, 116); //Werkt 100%
               //Instances
               player->ADD_GOSSIP_ITEM( 7, "[Dungeons]", GOSSIP_SENDER_MAIN, 5000); //Werkt 100%
               //Locations
               player->ADD_GOSSIP_ITEM( 2, "[Outland Locations]", GOSSIP_SENDER_MAIN, 2005); //Werkt 100%
               player->ADD_GOSSIP_ITEM( 4, "[Northrend Locations]", GOSSIP_SENDER_MAIN, 5); //Werkt 100%
               //Malls
               player->ADD_GOSSIP_ITEM( 2, "PvP-Mall", GOSSIP_SENDER_MAIN, 2004); //Werkt 100%
               player->ADD_GOSSIP_ITEM( 2, "NoN-PvP Mall + Trainers", GOSSIP_SENDER_MAIN, 2003); //Werkt 100%
               player->ADD_GOSSIP_ITEM( 2, "Dalaran (WotLK Mall)", GOSSIP_SENDER_MAIN, 56); //Werkt 100%
               player->ADD_GOSSIP_ITEM( 7, "[Player Tools]", GOSSIP_SENDER_MAIN, 4000); //Werkt 100%
               player->ADD_GOSSIP_ITEM( 6, "[buy Items]", GOSSIP_SENDER_MAIN, 1003); //Werkt 100%
               player->SEND_GOSSIP_MENU(DEFAULT_GOSSIP_MESSAGE,_Item->GetGUID());
       break;
   }
}

bool GossipSelect_ItemUse_Item_teleport(Player *player, Item *_Item, uint32 sender, uint32 action, SpellCastTargets const& targets)
{
   switch(sender) {
   case GOSSIP_SENDER_MAIN :
           SendDefaultMenu_ItemUse_Item_teleport(player, _Item, action,targets);
           break;

   case 2 :
       switch(action)
       {
           case 1:     // Horde Cities
                 {
                   player->ADD_GOSSIP_ITEM(5, "Orgrimmar", GOSSIP_SENDER_MAIN, 7);
                   player->ADD_GOSSIP_ITEM(5, "Silvermoon", GOSSIP_SENDER_MAIN, 6);
                   player->ADD_GOSSIP_ITEM(5, "Thunder Bluff", GOSSIP_SENDER_MAIN, 8);
                   player->ADD_GOSSIP_ITEM(5, "Undercity", GOSSIP_SENDER_MAIN, 9);
                   player->ADD_GOSSIP_ITEM( 7, "[Main Menu]", GOSSIP_SENDER_MAIN, 5005);
                   player->SEND_GOSSIP_MENU(DEFAULT_GOSSIP_MESSAGE,_Item->GetGUID());
                 }
                   break;



           case 2:     // Alliance Cities
                 {
                   player->ADD_GOSSIP_ITEM(5, "Stormwind", GOSSIP_SENDER_MAIN, 11);
                   player->ADD_GOSSIP_ITEM(5, "The Exodar", GOSSIP_SENDER_MAIN, 10);
                   player->ADD_GOSSIP_ITEM(5, "Ironforge", GOSSIP_SENDER_MAIN, 12);
                   player->ADD_GOSSIP_ITEM(5, "Darnassus", GOSSIP_SENDER_MAIN, 13);
                   player->ADD_GOSSIP_ITEM( 7, "[Main Menu]", GOSSIP_SENDER_MAIN, 5005);                
                   player->SEND_GOSSIP_MENU(DEFAULT_GOSSIP_MESSAGE,_Item->GetGUID());
                 }
               break;

           case 3: //Neutral Town
                   player->ADD_GOSSIP_ITEM( 5, "Booty Bay"                    , GOSSIP_SENDER_MAIN, 3001);
                   player->ADD_GOSSIP_ITEM( 5, "Everlook"                     , GOSSIP_SENDER_MAIN, 3010);
                   player->ADD_GOSSIP_ITEM( 5, "Gadegetzan"                   , GOSSIP_SENDER_MAIN, 3015);
                   player->ADD_GOSSIP_ITEM( 5, "Mudsprocket"                  , GOSSIP_SENDER_MAIN, 3020);
                   player->ADD_GOSSIP_ITEM( 5, "Ratchet"                      , GOSSIP_SENDER_MAIN, 3025);
                   player->ADD_GOSSIP_ITEM( 5, "Isle Of Quel'Danas"           , GOSSIP_SENDER_MAIN, 3035);
                   player->ADD_GOSSIP_ITEM( 7, "[Main Menu]", GOSSIP_SENDER_MAIN, 5005);                
                   player->SEND_GOSSIP_MENU(DEFAULT_GOSSIP_MESSAGE,_Item->GetGUID());
           break;

           case 5: // World of the Lich King Locations
               {
                   player->ADD_GOSSIP_ITEM(5, "Howling Fjord", GOSSIP_SENDER_MAIN, 46);
                   player->ADD_GOSSIP_ITEM(5, "Grizzly Hills", GOSSIP_SENDER_MAIN, 47);
                   player->ADD_GOSSIP_ITEM(5, "Zul'Drak", GOSSIP_SENDER_MAIN, 48);
                   player->ADD_GOSSIP_ITEM(5, "Storm Peaks", GOSSIP_SENDER_MAIN, 49);
                   player->ADD_GOSSIP_ITEM(5, "Icecrown", GOSSIP_SENDER_MAIN, 50);
                   player->ADD_GOSSIP_ITEM(5, "Sholazar Basin", GOSSIP_SENDER_MAIN, 51);
                   player->ADD_GOSSIP_ITEM(5, "Borean Tundra", GOSSIP_SENDER_MAIN, 52);
                   player->ADD_GOSSIP_ITEM(5, "Wintergrasp", GOSSIP_SENDER_MAIN, 53);
                   player->ADD_GOSSIP_ITEM(5, "Crystalsong", GOSSIP_SENDER_MAIN, 54);
                   player->ADD_GOSSIP_ITEM(5, "Dragonblight", GOSSIP_SENDER_MAIN, 55);
                   player->ADD_GOSSIP_ITEM(5, "Dalaran City", GOSSIP_SENDER_MAIN, 56);
                   player->ADD_GOSSIP_ITEM( 7, "[Main Menu]", GOSSIP_SENDER_MAIN, 5005);                
                   player->SEND_GOSSIP_MENU(DEFAULT_GOSSIP_MESSAGE,_Item->GetGUID());
               }
           break;    


               case 6://Silvermoon
                   {
                       //Plr->EventTeleport(530, 9400.486328, -7278.376953, 14.206780);
                       player->CLOSE_GOSSIP_MENU();
                       player->TeleportTo(530, 9400.486328, -7278.376953, 14.206780, 4.78f);

                   }
               break;

               case 7://Orgrimmar
                   {
                       if (player->GetTeam() == ALLIANCE)
                       {
                           //Plr->EventTeleport(1, 1563.854492, -4435.740723, 8);
                           player->CLOSE_GOSSIP_MENU();
                           player->TeleportTo(1, 1563.854492, -4435.740723, 8, 4.78f);

                       } else {
                           //Plr->EventTeleport(1, 1371.068970, -4370.801758, 26.052483);
                           player->CLOSE_GOSSIP_MENU();
                           player->TeleportTo(1, 1371.068970, -4370.801758, 26.052483, 4.78f);


                       }
                   }
               break;

               case 8://ThunderBluff
                   {
                       //Plr->EventTeleport(1, -1304.569946, 205.285004, 68.681396);
                       player->CLOSE_GOSSIP_MENU();
                       player->TeleportTo(1, -1304.569946, 205.285004, 68.681396, 4.78f);

                   }
               break;

               case 2005:     // Outland Locations
                   {
                       player->ADD_GOSSIP_ITEM(5, "Hellfire Peninsula", GOSSIP_SENDER_MAIN, 2006);
                       player->ADD_GOSSIP_ITEM(5, "Zangarmarsh", GOSSIP_SENDER_MAIN, 2007);
                       player->ADD_GOSSIP_ITEM(5, "Nagrand", GOSSIP_SENDER_MAIN, 2008);
                       player->ADD_GOSSIP_ITEM(5, "Terokkar Forrest", GOSSIP_SENDER_MAIN, 2009);
                       player->ADD_GOSSIP_ITEM(5, "Shadowmoon Valley", GOSSIP_SENDER_MAIN, 2010);
                       player->ADD_GOSSIP_ITEM(5, "Blade's Edge Mountains", GOSSIP_SENDER_MAIN, 2011);
                       player->ADD_GOSSIP_ITEM(5, "Netherstorm", GOSSIP_SENDER_MAIN, 2012);
                       player->ADD_GOSSIP_ITEM( 7, "[Main Menu]", GOSSIP_SENDER_MAIN, 5005);                
                       player->SEND_GOSSIP_MENU(DEFAULT_GOSSIP_MESSAGE,_Item->GetGUID());
                   }
               break;



               case 2006: // Hellfire Peninsula
                   {
                       //Plr->EventTeleport(530, -248.973557, 957.101685, 85);
                       player->CLOSE_GOSSIP_MENU();
                       player->TeleportTo(530, -248.973557, 957.101685, 85, 4.78f);

                   }
               break;    

       case 9055:// Violet Hold
           player->CLOSE_GOSSIP_MENU();
           player->TeleportTo(571, 5679.82f, 486.80f, 652.40f, 4.08f);

       break;

       //////////////////////////////////////////Player Tools////////////////////////////////////////////////////////

       case 4005:// Innkeeper Bind your new Home
           player->CLOSE_GOSSIP_MENU();
           player->SetBindPoint(_Item->GetGUID());
           player->MonsterWhisper("This is your new home location!.", player->GetGUID());
       break;

       case 4010:// Reset Talent Points
           player->CLOSE_GOSSIP_MENU();
           player->resetTalents(true);
           player->MonsterWhisper("You have reset your talent points.", player->GetGUID());
       break;

       case 4015:// Reset Pet Talent Points
           player->CLOSE_GOSSIP_MENU();
           if(player->GetPet())
           player->SendPetSkillWipeConfirm();
           else
           player->MonsterWhisper("You don't have a pet.", player->GetGUID());
       break;

       case 4020://Remove Res Sickness
           if(!player->HasAura(SPELL_ID_PASSIVE_RESURRECTION_SICKNESS,0))
           {
               player->MonsterWhisper("You don't have resurrection sickness.", player->GetGUID());
               return true;
           }

           player->CastSpell(player,38588,false); // Healing effect
           player->MonsterWhisper("Your Resurrection Sickness has been removed!.", player->GetGUID());
           player->RemoveAurasDueToSpell(SPELL_ID_PASSIVE_RESURRECTION_SICKNESS);
           player->CLOSE_GOSSIP_MENU();
       break;

       case 4021://Repair Items
           player->DurabilityRepairAll(0, 0, false);
           player->MonsterWhisper("Your Items have been Repaired!.", player->GetGUID());
           player->CLOSE_GOSSIP_MENU();
       break;

        player->CLOSE_GOSSIP_MENU();

       } // end of switch
   break;
   }
}
void AddSC_item_teleport()
{
   Script *newscript;
   newscript = new Script;
   newscript->Name="item_teleport";
   newscript->pItemUse = GossipHello_ItemUse_Item_teleport;
   newscript->pGossipSelect_Item = GossipSelect_ItemUse_Item_teleport;
   newscript->RegisterSelf();
}

This is what i have now but it gives me this error:

Error    1    error C2039: 'pGossipSelect_Item' : is not a member of 'Script'    c:\\Documents and Settings\\Administrator\\Desktop\\SVN\\MaNGOS\\src\\bindings\\ScriptDev2\\scripts\\custom\\TeleStone.cpp    964    ScriptDev2

NOTE: i ripped out some code because this forum only allows 20000 chars:

The text that you have entered is too long (23690 characters). Please shorten it to 20000 characters long.

Link to comment
Share on other sites

MANGOS:

Index: src/game/ItemHandler.cpp
===================================================================
--- src/game/ItemHandler.cpp    (版本 276)
+++ src/game/ItemHandler.cpp    (工作副本)
@@ -26,6 +26,8 @@
#include "Item.h"
#include "UpdateData.h"
#include "ObjectAccessor.h"
+#include "Spell.h"
+#include "ScriptCalls.h"

void WorldSession::HandleSplitItemOpcode( WorldPacket & recv_data )
{
@@ -458,6 +460,7 @@
    //sLog.outDebug( "WORLD: CMSG_READ_ITEM");

    uint8 bag, slot;
+    SpellCastTargets targets;
    recv_data >> bag >> slot;

    //sLog.outDetail("STORAGE: Read bag = %u, slot = %u", bag, slot);
@@ -468,6 +471,8 @@
        WorldPacket data;

        uint8 msg = _player->CanUseItem( pItem );
+        if(!Script->ItemUse(GetPlayer(),pItem,targets))
+        {
        if( msg == EQUIP_ERR_OK )
        {
            data.Initialize (SMSG_READ_ITEM_OK, 8);
@@ -480,7 +485,8 @@
            _player->SendEquipError( msg, pItem, NULL );
        }
        data << pItem->GetGUID();
-        SendPacket(&data);
+        SendPacket(&data);
+        }
    }
    else
        _player->SendEquipError( EQUIP_ERR_ITEM_NOT_FOUND, NULL, NULL );
Index: src/game/NPCHandler.cpp
===================================================================
--- src/game/NPCHandler.cpp    (版本 276)
+++ src/game/NPCHandler.cpp    (工作副本)
@@ -35,6 +35,7 @@
#include "BattleGroundMgr.h"
#include "BattleGround.h"
#include "Guild.h"
+#include "Spell.h"

void WorldSession::HandleTabardVendorActivateOpcode( WorldPacket & recv_data )
{
@@ -313,9 +314,11 @@
    uint32 option;
    uint32 unk;
    uint64 guid;
+    SpellCastTargets targets;
    std::string code = "";

    recv_data >> guid >> unk >> option;
+    Item *pItem = _player->GetItemByGuid(guid);

    if(_player->PlayerTalkClass->GossipOptionCoded( option ))
    {
@@ -329,7 +332,8 @@
    Creature *unit = GetPlayer()->GetNPCIfCanInteractWith(guid, UNIT_NPC_FLAG_NONE);
    if (!unit)
    {
-        sLog.outDebug( "WORLD: HandleGossipSelectOptionOpcode - Unit (GUID: %u) not found or you can't interact with him.", uint32(GUID_LOPART(guid)) );
+        if (!Script->GossipSelect_Item( _player, pItem, _player->PlayerTalkClass->GossipOptionSender( option ), _player->PlayerTalkClass->GossipOptionAction( option ),targets))
+        sLog.outDebug( "WORLD: HandleGossipSelectOptionOpcode - Unit (GUID: %u) not found or you can't interact with him.", uint32(GUID_LOPART(guid)) );
        return;
    }

Index: src/game/ScriptCalls.cpp
===================================================================
--- src/game/ScriptCalls.cpp    (版本 276)
+++ src/game/ScriptCalls.cpp    (工作副本)
@@ -73,6 +73,7 @@
        ||!(testScript->ItemQuestAccept     =(scriptCallItemQuestAccept     )MANGOS_GET_PROC_ADDR(testScript->hScriptsLib,"ItemQuestAccept"     ))
        ||!(testScript->GOQuestAccept       =(scriptCallGOQuestAccept       )MANGOS_GET_PROC_ADDR(testScript->hScriptsLib,"GOQuestAccept"       ))
        ||!(testScript->ItemUse             =(scriptCallItemUse             )MANGOS_GET_PROC_ADDR(testScript->hScriptsLib,"ItemUse"             ))
+        ||!(testScript->GossipSelect_Item   =(scriptCallGossipSelect_Item   )MANGOS_GET_PROC_ADDR(testScript->hScriptsLib,"GossipSelect_Item"   ))
        ||!(testScript->EffectDummyGameObj  =(scriptCallEffectDummyGameObj  )MANGOS_GET_PROC_ADDR(testScript->hScriptsLib,"EffectDummyGameObj"  ))
        ||!(testScript->EffectDummyCreature =(scriptCallEffectDummyCreature )MANGOS_GET_PROC_ADDR(testScript->hScriptsLib,"EffectDummyCreature" ))
        ||!(testScript->EffectDummyItem     =(scriptCallEffectDummyItem     )MANGOS_GET_PROC_ADDR(testScript->hScriptsLib,"EffectDummyItem"     ))
Index: src/game/ScriptCalls.h
===================================================================
--- src/game/ScriptCalls.h    (版本 276)
+++ src/game/ScriptCalls.h    (工作副本)
@@ -55,6 +55,7 @@
typedef bool(MANGOS_IMPORT * scriptCallGOQuestAccept)(Player *player, GameObject *, Quest const*);
typedef bool(MANGOS_IMPORT * scriptCallGOChooseReward)(Player *player, GameObject *, Quest const*, uint32 opt );
typedef bool(MANGOS_IMPORT * scriptCallItemUse) (Player *player, Item *_Item, SpellCastTargets const& targets);
+typedef bool(MANGOS_IMPORT * scriptCallGossipSelect_Item)(Player *player, Item *_Item, uint32 sender, uint32 action, SpellCastTargets const& targets);
typedef bool(MANGOS_IMPORT * scriptCallEffectDummyGameObj) (Unit *caster, uint32 spellId, uint32 effIndex, GameObject *gameObjTarget);
typedef bool(MANGOS_IMPORT * scriptCallEffectDummyCreature) (Unit *caster, uint32 spellId, uint32 effIndex, Creature *crTarget);
typedef bool(MANGOS_IMPORT * scriptCallEffectDummyItem) (Unit *caster, uint32 spellId, uint32 effIndex, Item *itemTarget);
@@ -83,6 +84,7 @@
    scriptCallItemQuestAccept ItemQuestAccept;
    scriptCallGOQuestAccept GOQuestAccept;
    scriptCallItemUse ItemUse;
+    scriptCallGossipSelect_Item GossipSelect_Item;
    scriptCallEffectDummyGameObj  EffectDummyGameObj;
    scriptCallEffectDummyCreature EffectDummyCreature;
    scriptCallEffectDummyItem     EffectDummyItem;

scriptsev2:

Index: ScriptMgr.cpp
===================================================================
--- ScriptMgr.cpp    (版本 1237)
+++ ScriptMgr.cpp    (工作副本)
@@ -1669,6 +1687,19 @@
}

MANGOS_DLL_EXPORT
+bool GossipSelect_Item(Player* pPlayer, Item* _Item, uint32 sender, uint32 action, SpellCastTargets const& targets)
+{
+    Script *tmpscript = NULL;
+
+    printf("action: %d\\n",action);
+    pPlayer->PlayerTalkClass->ClearMenus();
+    tmpscript = m_scripts[_Item->GetProto()->ScriptId];
+    if (!tmpscript || !tmpscript->pGossipSelect_Item) return false;
+    
+    return tmpscript->pGossipSelect_Item(pPlayer,_Item,sender,action,targets);
+}
+
+MANGOS_DLL_EXPORT
bool QuestSelect(Player* pPlayer, Creature* pCreature, const Quest* pQuest)
{
    Script *tmpscript = m_scripts[pCreature->GetScriptId()];
@@ -1791,6 +1822,7 @@
{
    Script *tmpscript = m_scripts[_Item->GetProto()->ScriptId];
    if (!tmpscript || !tmpscript->pItemUse) return false;
+    pPlayer->PlayerTalkClass->ClearMenus();

    return tmpscript->pItemUse(pPlayer,_Item,targets);
}
Index: ScriptMgr.h
===================================================================
--- ScriptMgr.h    (版本 1237)
+++ ScriptMgr.h    (工作副本)
@@ -30,8 +30,8 @@
        pGossipHello(NULL), pQuestAccept(NULL), pGossipSelect(NULL), pGossipSelectWithCode(NULL),
        pQuestSelect(NULL), pQuestComplete(NULL), pNPCDialogStatus(NULL), pGODialogStatus(NULL),
        pChooseReward(NULL), pItemHello(NULL), pGOHello(NULL), pAreaTrigger(NULL), pItemQuestAccept(NULL),
-        pGOQuestAccept(NULL), pGOChooseReward(NULL), pItemUse(NULL),
-        pEffectDummyCreature(NULL), pEffectDummyGameObj(NULL), pEffectDummyItem(NULL),
+        pGOQuestAccept(NULL), pGOChooseReward(NULL), pItemUse(NULL),pGossipSelect_Item(NULL),
+        pEffectDummyCreature(NULL), pEffectDummyGameObj(NULL), pEffectDummyItem(NULL),
        GetAI(NULL), GetInstanceData(NULL)
    {}

@@ -54,6 +54,7 @@
    bool (*pGOQuestAccept       )(Player*, GameObject*, const Quest*);
    bool (*pGOChooseReward      )(Player*, GameObject*, const Quest*, uint32);
    bool (*pItemUse             )(Player*, Item*, SpellCastTargets const&);
+    bool (*pGossipSelect_Item   )(Player* pPlayer, Item* _Item, uint32 sender, uint32 action, SpellCastTargets const& targets);
    bool (*pEffectDummyCreature )(Unit*, uint32, uint32, Creature*);
    bool (*pEffectDummyGameObj  )(Unit*, uint32, uint32, GameObject*);
    bool (*pEffectDummyItem     )(Unit*, uint32, uint32, Item*);

SQL:

INSERT INTO item_template
 (entry, class, subclass, unk0, name, displayid, Quality, Flags, BuyCount, BuyPrice, SellPrice, InventoryType, AllowableClass, AllowableRace, ItemLevel, RequiredLevel, RequiredSkill, RequiredSkillRank, requiredspell, requiredhonorrank, RequiredCityRank, RequiredReputationFaction, RequiredReputationRank, maxcount, stackable, ContainerSlots, StatsCount, stat_type1, stat_value1, stat_type2, stat_value2, stat_type3, stat_value3, stat_type4, stat_value4, stat_type5, stat_value5, stat_type6, stat_value6, stat_type7, stat_value7, stat_type8, stat_value8, stat_type9, stat_value9, stat_type10, stat_value10, ScalingStatDistribution, ScalingStatValue, dmg_min1, dmg_max1, dmg_type1, dmg_min2, dmg_max2, dmg_type2, armor, holy_res, fire_res, nature_res, frost_res, shadow_res, arcane_res, delay, ammo_type, RangedModRange, spellid_1, spelltrigger_1, spellcharges_1, spellppmRate_1, spellcooldown_1, spellcategory_1, spellcategorycooldown_1, spellid_2, spelltrigger_2, spellcharges_2, spellppmRate_2, spellcooldown_2, spellcategory_2, spellcategorycooldown_2, spellid_3, spelltrigger_3, spellcharges_3, spellppmRate_3, spellcooldown_3, spellcategory_3, spellcategorycooldown_3, spellid_4, spelltrigger_4, spellcharges_4, spellppmRate_4, spellcooldown_4, spellcategory_4, spellcategorycooldown_4, spellid_5, spelltrigger_5, spellcharges_5, spellppmRate_5, spellcooldown_5, spellcategory_5, spellcategorycooldown_5, bonding, description, PageText, LanguageID, PageMaterial, startquest, lockid, Material, sheath, RandomProperty, RandomSuffix, block, itemset, MaxDurability, area, Map, BagFamily, TotemCategory, socketColor_1, socketContent_1, socketColor_2, socketContent_2, socketColor_3, socketContent_3, socketBonus, GemProperties, RequiredDisenchantSkill, ArmorDamageModifier, Duration, ItemLimitCategory, ScriptName, DisenchantID, FoodType, minMoneyLoot, maxMoneyLoot)
VALUES
 (900001, 15, 0, -1, "telestone", 6270, 6, 64, 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, 1, "where are you want to", 3034, 0, 0, 0, 0, -1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, -1, 0, 0, 0, "item_teleport", 0, 0, 0, 0

);

Link to comment
Share on other sites

TYvm! it seems to work now, but i have 1 problem

Try rightclicking the item 2 or more times it will stack up menu's. U got a fix for that?

I called the ClearMenus(); function upon the close of any menu.. this was a modification I did to the mangos core. It really should be in there by default anyway.

so, upon closing the menu, call the ClearMenus(); function in the same script. cant think of the script name atm.

Link to comment
Share on other sites

I called the ClearMenus(); function upon the close of any menu.. this was a modification I did to the mangos core. It really should be in there by default anyway.

so, upon closing the menu, call the ClearMenus(); function in the same script. cant think of the script name atm.

Error    1    error C2039: 'ClearMenus' : is not a member of 'Player'    c:\\Documents and Settings\\Administrator\\Desktop\\SVN\\MaNGOS\\src\\bindings\\ScriptDev2\\scripts\\custom\\BookofDarkness.cpp    83    ScriptDev2

This is what i get. Are you sure it is ClearMenus()?

Link to comment
Share on other sites

TYvm! it seems to work now, but i have 1 problem

Try rightclicking the item 2 or more times it will stack up menu's. U got a fix for that?

Sorry,i can not do that,i am a new for C++,this code is very old and not to work,i only fix it to work.:(

Link to comment
Share on other sites

Sorry,i can not do that,i am a new for C++,this code is very old and not to work,i only fix it to work.:(

Hehe im new to MaNGOS i've done some C++ on ArcEmu before and Ascent and before that long time ago i did some on MaNGOS but its like 3 years ago or w/e. Anyway the Menu doesnt clear but that function the other man gave me isn't recognized.

Any more ideas?

Link to comment
Share on other sites

  • 7 months later...
MANGOS:

Index: src/game/ItemHandler.cpp
===================================================================
--- src/game/ItemHandler.cpp    (版本 276)
+++ src/game/ItemHandler.cpp    (工作副本)
@@ -26,6 +26,8 @@
#include "Item.h"
#include "UpdateData.h"
#include "ObjectAccessor.h"
+#include "Spell.h"
+#include "ScriptCalls.h"

void WorldSession::HandleSplitItemOpcode( WorldPacket & recv_data )
{
@@ -458,6 +460,7 @@
    //sLog.outDebug( "WORLD: CMSG_READ_ITEM");

    uint8 bag, slot;
+    SpellCastTargets targets;
    recv_data >> bag >> slot;

    //sLog.outDetail("STORAGE: Read bag = %u, slot = %u", bag, slot);
@@ -468,6 +471,8 @@
        WorldPacket data;

        uint8 msg = _player->CanUseItem( pItem );
+        if(!Script->ItemUse(GetPlayer(),pItem,targets))
+        {
        if( msg == EQUIP_ERR_OK )
        {
            data.Initialize (SMSG_READ_ITEM_OK, 8);
@@ -480,7 +485,8 @@
            _player->SendEquipError( msg, pItem, NULL );
        }
        data << pItem->GetGUID();
-        SendPacket(&data);
+        SendPacket(&data);
+        }
    }
    else
        _player->SendEquipError( EQUIP_ERR_ITEM_NOT_FOUND, NULL, NULL );
Index: src/game/NPCHandler.cpp
===================================================================
--- src/game/NPCHandler.cpp    (版本 276)
+++ src/game/NPCHandler.cpp    (工作副本)
@@ -35,6 +35,7 @@
#include "BattleGroundMgr.h"
#include "BattleGround.h"
#include "Guild.h"
+#include "Spell.h"

void WorldSession::HandleTabardVendorActivateOpcode( WorldPacket & recv_data )
{
@@ -313,9 +314,11 @@
    uint32 option;
    uint32 unk;
    uint64 guid;
+    SpellCastTargets targets;
    std::string code = "";

    recv_data >> guid >> unk >> option;
+    Item *pItem = _player->GetItemByGuid(guid);

    if(_player->PlayerTalkClass->GossipOptionCoded( option ))
    {
@@ -329,7 +332,8 @@
    Creature *unit = GetPlayer()->GetNPCIfCanInteractWith(guid, UNIT_NPC_FLAG_NONE);
    if (!unit)
    {
-        sLog.outDebug( "WORLD: HandleGossipSelectOptionOpcode - Unit (GUID: %u) not found or you can't interact with him.", uint32(GUID_LOPART(guid)) );
+        if (!Script->GossipSelect_Item( _player, pItem, _player->PlayerTalkClass->GossipOptionSender( option ), _player->PlayerTalkClass->GossipOptionAction( option ),targets))
+        sLog.outDebug( "WORLD: HandleGossipSelectOptionOpcode - Unit (GUID: %u) not found or you can't interact with him.", uint32(GUID_LOPART(guid)) );
        return;
    }

Index: src/game/ScriptCalls.cpp
===================================================================
--- src/game/ScriptCalls.cpp    (版本 276)
+++ src/game/ScriptCalls.cpp    (工作副本)
@@ -73,6 +73,7 @@
        ||!(testScript->ItemQuestAccept     =(scriptCallItemQuestAccept     )MANGOS_GET_PROC_ADDR(testScript->hScriptsLib,"ItemQuestAccept"     ))
        ||!(testScript->GOQuestAccept       =(scriptCallGOQuestAccept       )MANGOS_GET_PROC_ADDR(testScript->hScriptsLib,"GOQuestAccept"       ))
        ||!(testScript->ItemUse             =(scriptCallItemUse             )MANGOS_GET_PROC_ADDR(testScript->hScriptsLib,"ItemUse"             ))
+        ||!(testScript->GossipSelect_Item   =(scriptCallGossipSelect_Item   )MANGOS_GET_PROC_ADDR(testScript->hScriptsLib,"GossipSelect_Item"   ))
        ||!(testScript->EffectDummyGameObj  =(scriptCallEffectDummyGameObj  )MANGOS_GET_PROC_ADDR(testScript->hScriptsLib,"EffectDummyGameObj"  ))
        ||!(testScript->EffectDummyCreature =(scriptCallEffectDummyCreature )MANGOS_GET_PROC_ADDR(testScript->hScriptsLib,"EffectDummyCreature" ))
        ||!(testScript->EffectDummyItem     =(scriptCallEffectDummyItem     )MANGOS_GET_PROC_ADDR(testScript->hScriptsLib,"EffectDummyItem"     ))
Index: src/game/ScriptCalls.h
===================================================================
--- src/game/ScriptCalls.h    (版本 276)
+++ src/game/ScriptCalls.h    (工作副本)
@@ -55,6 +55,7 @@
typedef bool(MANGOS_IMPORT * scriptCallGOQuestAccept)(Player *player, GameObject *, Quest const*);
typedef bool(MANGOS_IMPORT * scriptCallGOChooseReward)(Player *player, GameObject *, Quest const*, uint32 opt );
typedef bool(MANGOS_IMPORT * scriptCallItemUse) (Player *player, Item *_Item, SpellCastTargets const& targets);
+typedef bool(MANGOS_IMPORT * scriptCallGossipSelect_Item)(Player *player, Item *_Item, uint32 sender, uint32 action, SpellCastTargets const& targets);
typedef bool(MANGOS_IMPORT * scriptCallEffectDummyGameObj) (Unit *caster, uint32 spellId, uint32 effIndex, GameObject *gameObjTarget);
typedef bool(MANGOS_IMPORT * scriptCallEffectDummyCreature) (Unit *caster, uint32 spellId, uint32 effIndex, Creature *crTarget);
typedef bool(MANGOS_IMPORT * scriptCallEffectDummyItem) (Unit *caster, uint32 spellId, uint32 effIndex, Item *itemTarget);
@@ -83,6 +84,7 @@
    scriptCallItemQuestAccept ItemQuestAccept;
    scriptCallGOQuestAccept GOQuestAccept;
    scriptCallItemUse ItemUse;
+    scriptCallGossipSelect_Item GossipSelect_Item;
    scriptCallEffectDummyGameObj  EffectDummyGameObj;
    scriptCallEffectDummyCreature EffectDummyCreature;
    scriptCallEffectDummyItem     EffectDummyItem;

scriptsev2:

Index: ScriptMgr.cpp
===================================================================
--- ScriptMgr.cpp    (版本 1237)
+++ ScriptMgr.cpp    (工作副本)
@@ -1669,6 +1687,19 @@
}

MANGOS_DLL_EXPORT
+bool GossipSelect_Item(Player* pPlayer, Item* _Item, uint32 sender, uint32 action, SpellCastTargets const& targets)
+{
+    Script *tmpscript = NULL;
+
+    printf("action: %d\\n",action);
+    pPlayer->PlayerTalkClass->ClearMenus();
+    tmpscript = m_scripts[_Item->GetProto()->ScriptId];
+    if (!tmpscript || !tmpscript->pGossipSelect_Item) return false;
+    
+    return tmpscript->pGossipSelect_Item(pPlayer,_Item,sender,action,targets);
+}
+
+MANGOS_DLL_EXPORT
bool QuestSelect(Player* pPlayer, Creature* pCreature, const Quest* pQuest)
{
    Script *tmpscript = m_scripts[pCreature->GetScriptId()];
@@ -1791,6 +1822,7 @@
{
    Script *tmpscript = m_scripts[_Item->GetProto()->ScriptId];
    if (!tmpscript || !tmpscript->pItemUse) return false;
+    pPlayer->PlayerTalkClass->ClearMenus();

    return tmpscript->pItemUse(pPlayer,_Item,targets);
}
Index: ScriptMgr.h
===================================================================
--- ScriptMgr.h    (版本 1237)
+++ ScriptMgr.h    (工作副本)
@@ -30,8 +30,8 @@
        pGossipHello(NULL), pQuestAccept(NULL), pGossipSelect(NULL), pGossipSelectWithCode(NULL),
        pQuestSelect(NULL), pQuestComplete(NULL), pNPCDialogStatus(NULL), pGODialogStatus(NULL),
        pChooseReward(NULL), pItemHello(NULL), pGOHello(NULL), pAreaTrigger(NULL), pItemQuestAccept(NULL),
-        pGOQuestAccept(NULL), pGOChooseReward(NULL), pItemUse(NULL),
-        pEffectDummyCreature(NULL), pEffectDummyGameObj(NULL), pEffectDummyItem(NULL),
+        pGOQuestAccept(NULL), pGOChooseReward(NULL), pItemUse(NULL),pGossipSelect_Item(NULL),
+        pEffectDummyCreature(NULL), pEffectDummyGameObj(NULL), pEffectDummyItem(NULL),
        GetAI(NULL), GetInstanceData(NULL)
    {}

@@ -54,6 +54,7 @@
    bool (*pGOQuestAccept       )(Player*, GameObject*, const Quest*);
    bool (*pGOChooseReward      )(Player*, GameObject*, const Quest*, uint32);
    bool (*pItemUse             )(Player*, Item*, SpellCastTargets const&);
+    bool (*pGossipSelect_Item   )(Player* pPlayer, Item* _Item, uint32 sender, uint32 action, SpellCastTargets const& targets);
    bool (*pEffectDummyCreature )(Unit*, uint32, uint32, Creature*);
    bool (*pEffectDummyGameObj  )(Unit*, uint32, uint32, GameObject*);
    bool (*pEffectDummyItem     )(Unit*, uint32, uint32, Item*);

SQL:

INSERT INTO item_template
 (entry, class, subclass, unk0, name, displayid, Quality, Flags, BuyCount, BuyPrice, SellPrice, InventoryType, AllowableClass, AllowableRace, ItemLevel, RequiredLevel, RequiredSkill, RequiredSkillRank, requiredspell, requiredhonorrank, RequiredCityRank, RequiredReputationFaction, RequiredReputationRank, maxcount, stackable, ContainerSlots, StatsCount, stat_type1, stat_value1, stat_type2, stat_value2, stat_type3, stat_value3, stat_type4, stat_value4, stat_type5, stat_value5, stat_type6, stat_value6, stat_type7, stat_value7, stat_type8, stat_value8, stat_type9, stat_value9, stat_type10, stat_value10, ScalingStatDistribution, ScalingStatValue, dmg_min1, dmg_max1, dmg_type1, dmg_min2, dmg_max2, dmg_type2, armor, holy_res, fire_res, nature_res, frost_res, shadow_res, arcane_res, delay, ammo_type, RangedModRange, spellid_1, spelltrigger_1, spellcharges_1, spellppmRate_1, spellcooldown_1, spellcategory_1, spellcategorycooldown_1, spellid_2, spelltrigger_2, spellcharges_2, spellppmRate_2, spellcooldown_2, spellcategory_2, spellcategorycooldown_2, spellid_3, spelltrigger_3, spellcharges_3, spellppmRate_3, spellcooldown_3, spellcategory_3, spellcategorycooldown_3, spellid_4, spelltrigger_4, spellcharges_4, spellppmRate_4, spellcooldown_4, spellcategory_4, spellcategorycooldown_4, spellid_5, spelltrigger_5, spellcharges_5, spellppmRate_5, spellcooldown_5, spellcategory_5, spellcategorycooldown_5, bonding, description, PageText, LanguageID, PageMaterial, startquest, lockid, Material, sheath, RandomProperty, RandomSuffix, block, itemset, MaxDurability, area, Map, BagFamily, TotemCategory, socketColor_1, socketContent_1, socketColor_2, socketContent_2, socketColor_3, socketContent_3, socketBonus, GemProperties, RequiredDisenchantSkill, ArmorDamageModifier, Duration, ItemLimitCategory, ScriptName, DisenchantID, FoodType, minMoneyLoot, maxMoneyLoot)
VALUES
 (900001, 15, 0, -1, "telestone", 6270, 6, 64, 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, 1, "where are you want to", 3034, 0, 0, 0, 0, -1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, -1, 0, 0, 0, "item_teleport", 0, 0, 0, 0

);

This script works 50% nowadays. It shows the menu, but when you click one of the Menu Items it does nothin. Can anyone give me a hand fixing this? I can't figure out what's wrong.

Link to comment
Share on other sites

  • 3 months later...

This script can still be implemented, it just requires some major hackage to work on.

I know MaNGOS is to be ultimately blizzlike and great, but, ItemGossip menus should be allowed without the majorly specific implementation of Gossip in the game right now (Gossip should work for items, gobjects, and creatures without having to have separate implementation for all three)

Link to comment
Share on other sites

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue. Privacy Policy Terms of Use