Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /*
- ~ EmuDevs TC C++ Tutorial ~
- <http://emudevs.com>
- */
- struct GossipHelper
- {
- uint32 icon;
- std::string optText;
- uint32 menuId;
- uint32 honorAmt;
- };
- GossipHelper Helper[18] =
- {
- { GOSSIP_ICON_CHAT, "MenuA 1", 1, 1000 },
- { GOSSIP_ICON_DOT, "MenuA 2", 2, 2000 },
- { GOSSIP_ICON_CHAT, "MenuA 3", 3, 3000 },
- { GOSSIP_ICON_CHAT, "MenuA 4", 4, 4000 },
- { GOSSIP_ICON_CHAT, "MenuA 5", 5, 5000 },
- { GOSSIP_ICON_CHAT, "MenuA 6", 6, 6000 },
- { GOSSIP_ICON_CHAT, "MenuA 7", 7, 7000 },
- { GOSSIP_ICON_CHAT, "MenuA 8", 8, 8000 },
- { GOSSIP_ICON_CHAT, "MenuH 1", 1, 1000 },
- { GOSSIP_ICON_DOT, "MenuH 2", 2, 2000 },
- { GOSSIP_ICON_CHAT, "MenuH 3", 3, 3000 },
- { GOSSIP_ICON_CHAT, "MenuH 4", 4, 4000 },
- { GOSSIP_ICON_CHAT, "MenuH 5", 5, 5000 },
- { GOSSIP_ICON_CHAT, "MenuH 6", 6, 6000 },
- { GOSSIP_ICON_CHAT, "MenuH 7", 7, 7000 },
- { GOSSIP_ICON_CHAT, "MenuH 8", 8, 8000 },
- { GOSSIP_ICON_CHAT, "Nevermind..", 99 }
- };
- class npc_gossip_helper : public CreatureScript
- {
- public:
- npc_gossip_helper() : CreatureScript("npc_gossip_helper") { }
- bool OnGossipHello(Player* player, Creature* creature)
- {
- if (player->GetTeam() == ALLIANCE)
- for (int i = 0; i < 8; i++)
- player->ADD_GOSSIP_ITEM(Helper[i].icon, Helper[i].optText, GOSSIP_SENDER_MAIN, Helper[i].menuId);
- else
- for (int i = 8; i < 17; i++)
- player->ADD_GOSSIP_ITEM(Helper[i].icon, Helper[i].optText, GOSSIP_SENDER_MAIN, Helper[i].menuId);
- player->ADD_GOSSIP_ITEM(Helper[18].icon, Helper[18].optText, GOSSIP_SENDER_MAIN, Helper[18].menuId);
- player->SEND_GOSSIP_MENU(1, creature->GetGUID());
- return true;
- }
- bool OnGossipSelect(Player* player, Creature* creature, uint32 /* sender */, uint32 actions)
- {
- player->PlayerTalkClass->ClearMenus();
- for (int i = 0; i < sizeof (Helper) / sizeof(uint32); i++)
- if (actions == Helper[i].menuId)
- player->ModifyHonorPoints(Helper[i].honorAmt);
- player->CLOSE_GOSSIP_MENU();
- return true;
- }
- };
- void AddSC_gossip_helper()
- {
- new npc_gossip_helper;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement