Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include "ScriptPCH.h"
- enum Settings
- {
- NPC_TEXT = 44444,// this is the number for text to be displayed on npc, number is controlled via db in npc_text
- GOSSIP_ICON = 6, // the icon that pops up by the (Max my blah blah blah)
- DONOR_TOKEN = 67890,// vote token id in item_template default: 67890, but should be edited to your custom id
- DONOR_TOKEN_COUNT = 5, // MOD how much you want maxing a skill to cost.
- MAX_SKILL_LEVEL = 225 // Max for professions. the numbers go: 75, 150, 225, 300, 375, 450.
- };
- class Pro_Max : public CreatureScript
- {
- public:
- Pro_Max() : CreatureScript("Pro_Max")
- {
- std::stringstream ss;
- ss << DONOR_TOKEN_COUNT;
- DONOR_TOKEN_COUNT_STR = ss.str();
- }
- std::string DONOR_TOKEN_COUNT_STR;
- bool OnGossipHello(Player* player, Creature* creature)
- {
- player->ADD_GOSSIP_ITEM(GOSSIP_ICON, "Max my Engineering("+DONOR_TOKEN_COUNT_STR+" Donor Tokens)", GOSSIP_SENDER_MAIN, SKILL_ENGINEERING);
- player->ADD_GOSSIP_ITEM(GOSSIP_ICON, "Max my Blacksmithing("+DONOR_TOKEN_COUNT_STR+" Donor Tokens)", GOSSIP_SENDER_MAIN, SKILL_BLACKSMITHING);
- player->ADD_GOSSIP_ITEM(GOSSIP_ICON, "Max my Alchemy("+DONOR_TOKEN_COUNT_STR+" Donor Tokens)", GOSSIP_SENDER_MAIN, SKILL_ALCHEMY);
- player->ADD_GOSSIP_ITEM(GOSSIP_ICON, "Max my Leatherworking("+DONOR_TOKEN_COUNT_STR+" Donor Tokens)", GOSSIP_SENDER_MAIN, SKILL_LEATHERWORKING);
- player->ADD_GOSSIP_ITEM(GOSSIP_ICON, "Max my Tailoring("+DONOR_TOKEN_COUNT_STR+" Donor Tokens)", GOSSIP_SENDER_MAIN, SKILL_TAILORING);
- player->ADD_GOSSIP_ITEM(GOSSIP_ICON, "Max my Skinning("+DONOR_TOKEN_COUNT_STR+" Donor Tokens)", GOSSIP_SENDER_MAIN, SKILL_SKINNING);
- player->ADD_GOSSIP_ITEM(GOSSIP_ICON, "Max my Mining("+DONOR_TOKEN_COUNT_STR+" Donor Tokens)", GOSSIP_SENDER_MAIN, SKILL_MINING);
- player->ADD_GOSSIP_ITEM(GOSSIP_ICON, "Max my Jewelcrafting("+DONOR_TOKEN_COUNT_STR+" Donor Tokens)", GOSSIP_SENDER_MAIN, SKILL_JEWELCRAFTING);
- player->ADD_GOSSIP_ITEM(GOSSIP_ICON, "Max my Inscriptions("+DONOR_TOKEN_COUNT_STR+" Donor Tokens)", GOSSIP_SENDER_MAIN, SKILL_INSCRIPTION);
- player->ADD_GOSSIP_ITEM(GOSSIP_ICON, "Max my Herbalism("+DONOR_TOKEN_COUNT_STR+" Donor Tokens)", GOSSIP_SENDER_MAIN, SKILL_HERBALISM);
- player->ADD_GOSSIP_ITEM(GOSSIP_ICON, "Max my Cooking("+DONOR_TOKEN_COUNT_STR+" Donor Tokens)", GOSSIP_SENDER_MAIN, SKILL_COOKING);
- player->ADD_GOSSIP_ITEM(GOSSIP_ICON, "Max my First Aid("+DONOR_TOKEN_COUNT_STR+" Donor Tokens)", GOSSIP_SENDER_MAIN, SKILL_FIRST_AID);
- player->ADD_GOSSIP_ITEM(GOSSIP_ICON, "Max my Fishing("+DONOR_TOKEN_COUNT_STR+" Donor Tokens)", GOSSIP_SENDER_MAIN, SKILL_FISHING);
- player->SEND_GOSSIP_MENU(NPC_TEXT, creature->GetGUID());
- return true;
- }
- bool OnGossipSelect(Player* player, Creature* creature, uint32 sender, uint32 action)
- {
- player->PlayerTalkClass->ClearMenus();
- if (!player->HasSkill(action))
- player->GetSession()->SendNotification("You already know this profession");
- else if (player->GetSkillValue(action) == MAX_SKILL_LEVEL)
- player->GetSession()->SendNotification("This profession is already maxed out");
- else if (!player->HasItemCount(DONOR_TOKEN, DONOR_TOKEN_COUNT, false))
- player->GetSession()->SendNotification(("You need "+DONOR_TOKEN_COUNT_STR+" donor tokens").c_str());
- else
- {
- player->DestroyItemCount(DONOR_TOKEN, DONOR_TOKEN_COUNT, true);
- player->SetSkill(action, 0, MAX_SKILL_LEVEL, MAX_SKILL_LEVEL);
- }
- OnGossipHello(player, creature);
- return true;
- }
- };
- void AddSC_Pro_Max()
- {
- new Pro_Max();
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement