Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include "ScriptMgr.h"
- struct ClassSpec
- {
- uint32 gossip_action_id;
- Classes plrClass;
- const char* specName;
- uint32 spells[3];
- };
- std::vector<ClassSpec> Class_Specializations =
- {
- {
- 1,
- CLASS_PALADIN,
- "Holy",
- {
- 19746,
- 7328,
- 31836
- }
- },
- {
- 2,
- CLASS_PALADIN,
- "Protection",
- {
- 25780,
- 26573,
- 20925
- }
- },
- {
- 3,
- CLASS_PALADIN,
- "Retribution",
- {
- 20271,
- 35395,
- 7294
- }
- },
- {
- 4,
- CLASS_DRUID,
- "Balance",
- {
- 5176,
- 8921
- }
- },
- {
- 5,
- CLASS_DRUID,
- "Feral (Cat)",
- {
- 768,
- 1082,
- 22568
- }
- },
- {
- 6,
- CLASS_DRUID,
- "Feral (Bear)",
- {
- 5487,
- 6807,
- 6795
- }
- },
- {
- 7,
- CLASS_DRUID,
- "Restoration",
- {
- 5185,
- 774
- }
- },
- };
- class TalentSpecNPC : public CreatureScript
- {
- public:
- TalentSpecNPC() : CreatureScript("TalentSpecNPC") { }
- bool OnGossipHello(Player* player, Creature* creature)
- {
- for (auto itr = Class_Specializations.begin(); itr != Class_Specializations.end(); ++itr)
- {
- if (player->getClass() == itr->plrClass)
- {
- std::ostringstream ss;
- const SpellInfo* info;
- ss << itr->specName << "\n";
- for (int i = 0; i < (sizeof(itr->spells) / sizeof(uint32)); i++)
- {
- info = sSpellMgr->GetSpellInfo(itr->spells[i]);
- if(info)
- ss << info->SpellName[sWorld->GetDefaultDbcLocale()] << "\n";
- }
- player->ADD_GOSSIP_ITEM(0, ss.str(), GOSSIP_SENDER_MAIN, itr->gossip_action_id);
- }
- }
- player->PlayerTalkClass->SendGossipMenu(1, creature->GetGUID());
- return true;
- }
- bool OnGossipSelect(Player* player, Creature* creature, uint32 sender, uint32 action)
- {
- for (auto itr = Class_Specializations.begin(); itr != Class_Specializations.end(); ++itr)
- {
- if (action == itr->gossip_action_id)
- {
- for (int i = 0; i < sizeof(itr->spells) / sizeof(uint32); i++)
- {
- player->LearnSpell(itr->spells[i], false);
- }
- }
- if (itr->plrClass == player->getClass() && itr->gossip_action_id != action)
- {
- for (int i = 0; i < sizeof(itr->spells) / sizeof(uint32); i++)
- {
- if (player->HasSpell(itr->spells[i]))
- player->RemoveSpell(itr->spells[i], true, false);
- }
- }
- }
- player->PlayerTalkClass->SendCloseGossip();
- return true;
- }
- };
- void AddSC_TalentSpecNPC()
- {
- new TalentSpecNPC();
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement