Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include "ScriptPCH.h"
- std::string names[][4] =
- {
- {"", "", "", ""},
- {"Warrior", "Arms", "Fury", "Protection"},
- {"Paladin", "Holy", "Protection", "Retribution"},
- {"Hunter", "Survival", "Marksmanship", "Beast Mastery"},
- {"Rogue", "Combat", "Subtlety", "Assassination"},
- {"Priest", "Holy", "Discipline", "Shadow"},
- {"Death Knight", "", "", ""}, // DK MISSING!!!!
- {"Shaman", "Elemental", "Restoration", "Enhancement"},
- {"Mage", "Fire", "Frost", "Arcane"},
- {"Warlock", "Demonology", "Affliction", "Destruction"},
- {"", "", "", ""},
- {"Druid", "Restoration", "Balance", "Feral"},
- };
- std::string* getNames(uint8 Class)
- {
- return Class < MAX_CLASSES ? names[Class] : NULL;
- }
- #define ALL_SPELLCOUNT 81
- uint32 const all[ALL_SPELLCOUNT] = {1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63,64,65,66,67,68,69,70,72,73,74,75,78,79,80,81};
- class TalentSequence : public PlayerScript
- {
- public:
- std::map<uint8, std::vector<std::list<uint32> > > specs;
- TalentSequence() : PlayerScript("TalentSequence")
- {
- printf("goodsofar\n");
- // addSpec(CLASS, SPELLCOUNT, SPELL1, SPELL2...);
- addSpec(CLASS_DRUID, 3, 15363, 15031, 64129);
- addSpec(CLASS_DRUID, 3, 15363, 15031, 64129);
- addSpec(CLASS_DRUID, 3, 15363, 15031, 64129);
- addSpec(CLASS_HUNTER, 3, 15363, 15031, 64129);
- addSpec(CLASS_HUNTER, 3, 15363, 15031, 64129);
- addSpec(CLASS_HUNTER, 3, 15363, 15031, 64129);
- addSpec(CLASS_MAGE, 3, 15363, 15031, 64129);
- addSpec(CLASS_MAGE, 3, 15363, 15031, 64129);
- addSpec(CLASS_MAGE, 3, 15363, 15031, 64129);
- addSpec(CLASS_PALADIN, 3, 15363, 15031, 64129);
- addSpec(CLASS_PALADIN, 3, 15363, 15031, 64129);
- addSpec(CLASS_PALADIN, 3, 15363, 15031, 64129);
- addSpec(CLASS_PRIEST, 3, 15363, 15031, 64129);
- addSpec(CLASS_PRIEST, 3, 15363, 15031, 64129);
- addSpec(CLASS_PRIEST, 3, 15363, 15031, 64129);
- addSpec(CLASS_ROGUE, 3, 15363, 15031, 64129);
- addSpec(CLASS_ROGUE, 3, 15363, 15031, 64129);
- addSpec(CLASS_ROGUE, 3, 15363, 15031, 64129);
- addSpec(CLASS_SHAMAN, 3, 15363, 15031, 64129);
- addSpec(CLASS_SHAMAN, 3, 15363, 15031, 64129);
- addSpec(CLASS_SHAMAN, 3, 15363, 15031, 64129);
- addSpec(CLASS_WARLOCK, 3, 15363, 15031, 64129);
- addSpec(CLASS_WARLOCK, 3, 15363, 15031, 64129);
- addSpec(CLASS_WARLOCK, 3, 15363, 15031, 64129);
- addSpec(CLASS_WARRIOR, 3, 15363, 15031, 64129);
- addSpec(CLASS_WARRIOR, 3, 15363, 15031, 64129);
- addSpec(CLASS_WARRIOR, 3, 15363, 15031, 64129);
- }
- void addSpec(uint8 Class, uint32 spellAmount, ...)
- {
- uint32 specID = specs[Class].size();
- specs[Class].push_back(std::list<uint32>());
- va_list spells;
- va_start ( spells, spellAmount );
- for ( uint32 i = 0; i < spellAmount; ++i )
- specs[Class][specID].push_back(va_arg ( spells, uint32 ));
- va_end ( spells );
- }
- void OnLogin(Player* player)
- {
- printf("OnLogin\n");
- if(player->GetTotalPlayedTime() < 100)
- {
- printf("OnLogin Success\n");
- player->m_Events.AddEvent(new customEvent(player), player->m_Events.CalculateTime(2000));
- }
- }
- void OnGossipSelectCode(Player* player, uint32 menu_id, uint32 sender, uint32 action, const char* code)
- {
- printf("OnGossipSelectCode\n");
- player->PlayerTalkClass->ClearMenus();
- if(menu_id != 123 || sender != GOSSIP_SENDER_MAIN || action != GOSSIP_ACTION_INFO_DEF+1) // not our menu
- return; // do nothing
- printf("right menu_id\n");
- std::string* names = getNames(player->getClass());
- if(!names || names[0].empty() || names[1].empty() || names[2].empty() || names[3].empty())
- return; // something wrong, stop.
- printf("got names\n");
- uint8 spec = 0;
- for(uint8 i = 1; i < 4; ++i)
- {
- if(stricmp(names[i].c_str(), code))
- {
- spec = i;
- break;
- }
- }
- if(spec)
- {
- printf("got spec, learning\n");
- for (uint32 i = 0; i < ALL_SPELLCOUNT; ++i)
- player->removeSpell(all[i], false, false);
- for (std::list<uint32>::const_iterator it = specs[player->getClass()][spec].begin(); it != specs[player->getClass()][spec].end(); ++it)
- player->learnSpell(*it, false);
- }
- player->CLOSE_GOSSIP_MENU();
- }
- struct customEvent : public BasicEvent
- {
- customEvent(Player* _player) : player(_player), _event(0) {}
- bool Execute(uint64 /*time*/, uint32 /*diff*/)
- {
- switch(_event++)
- {
- case 0:
- printf("first timed event\n");
- ChatHandler(player->GetSession()).PSendSysMessage("Welcome, %s", player->GetName().c_str());
- ChatHandler(player->GetSession()).PSendSysMessage("Please wait whilst the system calculates your class and specialisation options");
- player->m_Events.AddEvent(this, player->m_Events.CalculateTime(4000)); // delay to next event
- break;
- case 1:
- {
- printf("second timed event\n");
- std::string* names = getNames(player->getClass());
- if(!names || names[0].empty() || names[1].empty() || names[2].empty() || names[3].empty())
- return true; // something wrong, stop.
- ChatHandler(player->GetSession()).PSendSysMessage("%s detected", names[0].c_str());
- std::ostringstream oss;
- oss << names[1] << ", " << names[2] << " or " << names[3] << ":";
- player->PlayerTalkClass->ClearMenus();
- player->PlayerTalkClass->GetGossipMenu().SetMenuId(123);
- player->ADD_GOSSIP_ITEM_EXTENDED(GOSSIP_ICON_CHAT, "Please enter the role you wish to play within your class. Click this option and type in your specialisation choice", GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF+1, oss.str().c_str(), 0, true);
- player->SEND_GOSSIP_MENU(DEFAULT_GOSSIP_MESSAGE, player->GetGUID());
- player->m_Events.AddEvent(this, player->m_Events.CalculateTime(15000)); // note that the timer can have different time
- }
- break;
- default:
- return true; // no events anymore, destroy the struct
- }
- return false; // dont destory event
- }
- Player* player;
- uint32 _event;
- };
- };
- void AddSC_TalentSequence()
- {
- new TalentSequence();
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement