fix(Core/Professions): Leatherworking specialization (#10415)

This commit is contained in:
Nefertumm
2022-03-14 08:50:18 -03:00
committed by GitHub
parent 1dd05ac390
commit 4806769beb
2 changed files with 144 additions and 47 deletions

View File

@@ -18,7 +18,7 @@
/* ScriptData
SDName: Npc_Professions
SD%Complete: 80
SDComment: Provides learn/unlearn/relearn-options for professions. Not supported: Unlearn engineering, re-learn engineering, re-learn leatherworking.
SDComment: Provides learn/unlearn/relearn-options for professions. Not supported: Unlearn engineering, re-learn engineering.
SDCategory: NPCs
EndScriptData */
@@ -86,10 +86,6 @@ there is no difference here (except that default text is chosen with `gameobject
#define BOX_UNLEARN_WEAPON_SPEC "Do you really want to unlearn your weaponsmith specialty and lose all associated recipes? \n Cost: "
#define GOSSIP_LEARN_DRAGON "I wish to learn Dragonscale Leatherworking"
#define GOSSIP_LEARN_ELEMENTAL "I wish to learn Elemental Leatherworking"
#define GOSSIP_LEARN_TRIBAL "I wish to learn Tribal Leatherworking"
#define GOSSIP_LEARN_SPELLFIRE "Please teach me how to become a Spellcloth tailor"
#define GOSSIP_UNLEARN_SPELLFIRE "I wish to unlearn Spellfire Tailoring"
#define GOSSIP_LEARN_MOONCLOTH "Please teach me how to become a Mooncloth tailor"
@@ -230,6 +226,37 @@ enum SpecializationQuests
Q_MASTER_POTION = 10897,
};
// All referred to gossips (menu, menu_opt, actions)
enum Gossips
{
// Leatherworking
GOSSIP_MENU_PETER_GALEN = 3067,
GOSSIP_MENU_THORKAF_DRAGONEYE = 3068,
GOSSIP_MENU_BRUMN_WINTERHOOF = 3069,
GOSSIP_MENU_SARAH_TANNER = 3070,
GOSSIP_MENU_CARYSSIA_MOONHUNTER = 3072,
GOSSIP_MENU_SEJIB = 3073,
GOSSIP_MENU_UNLEARN_CONFIRM_DRAGONSCALE = 3075,
GOSSIP_MENU_UNLEARN_CONFIRM_ELEMENTAL = 3076,
GOSSIP_MENU_UNLEARN_CONFIRM_TRIBAL = 3077,
GOSSIP_MENU_OPTION_TRAIN = 0,
GOSSIP_MENU_OPTION_CONFIRM_UNLEARN_DRAGONSCALE = 1,
GOSSIP_MENU_OPTION_CONFIRM_UNLEARN_ELEMENTAL = 1,
GOSSIP_MENU_OPTION_CONFIRM_UNLEARN_TRIBAL = 1,
GOSSIP_TEXT_UNLEARN_CONFIRM_DRAGONSCALE = 10304,
GOSSIP_TEXT_UNLEARN_CONFIRM_ELEMENTAL = 10302,
GOSSIP_TEXT_UNLEARN_CONFIRM_TRIBAL = 10303,
GOSSIP_MENU_GO_SOOTHSAYING_FOR_DUMMIES = 7058,
GOSSIP_MENU_OPTION_GO_LEARN_DRAGONSCALE = 4,
GOSSIP_MENU_OPTION_GO_LEARN_ELEMENTAL = 5,
GOSSIP_MENU_OPTION_GO_LEARN_TRIBAL = 6,
};
/*###
# formulas to calculate unlearning cost
###*/
@@ -347,7 +374,11 @@ void ProfessionUnlearnSpells(Player* player, uint32 type)
player->removeSpell(36259, SPEC_MASK_ALL, false); // Lionheart Executioner
break;
case S_UNLEARN_DRAGON: // S_UNLEARN_DRAGON
player->removeSpell(10619, SPEC_MASK_ALL, false); // Dragonscale Guantlets
player->removeSpell(10650, SPEC_MASK_ALL, false); // Dragonscale Breastplate
player->removeSpell(36076, SPEC_MASK_ALL, false); // Dragonstrike Leggings
player->removeSpell(24655, SPEC_MASK_ALL, false); // Green Dragonscale Gauntlets
player->removeSpell(24654, SPEC_MASK_ALL, false); // Blue Dragonscale Leggings
player->removeSpell(36079, SPEC_MASK_ALL, false); // Golden Dragonstrike Breastplate
player->removeSpell(35576, SPEC_MASK_ALL, false); // Ebon Netherscale Belt
player->removeSpell(35577, SPEC_MASK_ALL, false); // Ebon Netherscale Bracers
@@ -362,6 +393,8 @@ void ProfessionUnlearnSpells(Player* player, uint32 type)
player->removeSpell(35590, SPEC_MASK_ALL, false); // Primalstrike Belt
player->removeSpell(35591, SPEC_MASK_ALL, false); // Primalstrike Bracers
player->removeSpell(35589, SPEC_MASK_ALL, false); // Primalstrike Vest
player->removeSpell(10630, SPEC_MASK_ALL, false); // Gauntlets of the Sea
player->removeSpell(10632, SPEC_MASK_ALL, false); // Helm of Fire
break;
case S_UNLEARN_TRIBAL: // S_UNLEARN_TRIBAL
player->removeSpell(35585, SPEC_MASK_ALL, false); // Windhawk Hauberk
@@ -369,6 +402,8 @@ void ProfessionUnlearnSpells(Player* player, uint32 type)
player->removeSpell(35588, SPEC_MASK_ALL, false); // Windhawk Bracers
player->removeSpell(36075, SPEC_MASK_ALL, false); // Wildfeather Leggings
player->removeSpell(36078, SPEC_MASK_ALL, false); // Living Crystal Breastplate
player->removeSpell(10621, SPEC_MASK_ALL, false); // Wolfshead Helm
player->removeSpell(10647, SPEC_MASK_ALL, false); // Feathered Breastplate
break;
case S_UNLEARN_SPELLFIRE: // S_UNLEARN_SPELLFIRE
player->removeSpell(26752, SPEC_MASK_ALL, false); // Spellfire Belt
@@ -950,44 +985,39 @@ public:
bool OnGossipHello(Player* player, Creature* creature) override
{
ClearGossipMenuFor(player);
if (creature->IsQuestGiver())
{
player->PrepareQuestMenu(creature->GetGUID());
}
if (creature->IsVendor())
AddGossipItemFor(player, GOSSIP_ICON_VENDOR, GOSSIP_TEXT_BROWSE_GOODS, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_TRADE);
// pussywizard: NO UNLEARNING! LEATHERWORKING SPECIALTY IS A PERMANENT DECISION AND CANNOT BE CHANGED IN ANY WAY!
// pussywizard: CAN RE-LEARN ONLY THE ONE FOR WHICH QUEST IS COMPLETED!
if (player->HasSkill(SKILL_LEATHERWORKING) && player->GetBaseSkillValue(SKILL_LEATHERWORKING) >= 250 && player->getLevel() > 49)
if (player->HasSkill(SKILL_LEATHERWORKING) && player->GetBaseSkillValue(SKILL_LEATHERWORKING) >= 225 && player->getLevel() > 40)
{
switch (creature->GetEntry())
{
case N_TRAINER_DRAGON1: //Peter Galen
case N_TRAINER_DRAGON2: //Thorkaf Dragoneye
if (!HasLeatherSpecialty(player) && (player->GetQuestRewardStatus(5141) || player->GetQuestRewardStatus(5145)))
AddGossipItemFor(player, GOSSIP_ICON_CHAT, GOSSIP_LEARN_DRAGON, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 1);
case N_TRAINER_DRAGON1: //Peter Galen
case N_TRAINER_DRAGON2: //Thorkaf Dragoneye
if (player->HasSpell(S_DRAGON))
{
AddGossipItemFor(player, GOSSIP_ICON_TRAINER, GOSSIP_TEXT_TRAIN, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_TRAIN);
AddGossipItemFor(player, creature->GetEntry() == N_TRAINER_DRAGON1 ? GOSSIP_MENU_PETER_GALEN : GOSSIP_MENU_THORKAF_DRAGONEYE, GOSSIP_MENU_OPTION_TRAIN, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_TRAIN);
AddGossipItemFor(player, creature->GetEntry() == N_TRAINER_DRAGON1 ? GOSSIP_MENU_PETER_GALEN : GOSSIP_MENU_THORKAF_DRAGONEYE, GOSSIP_MENU_OPTION_CONFIRM_UNLEARN_DRAGONSCALE, GOSSIP_SENDER_MAIN, GOSSIP_MENU_UNLEARN_CONFIRM_DRAGONSCALE);
}
break;
case N_TRAINER_ELEMENTAL1: //Sarah Tanner
case N_TRAINER_ELEMENTAL2: //Brumn Winterhoof
if (!HasLeatherSpecialty(player) && (player->GetQuestRewardStatus(5144) || player->GetQuestRewardStatus(5146)))
AddGossipItemFor(player, GOSSIP_ICON_CHAT, GOSSIP_LEARN_ELEMENTAL, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 2);
case N_TRAINER_ELEMENTAL1: //Sarah Tanner
case N_TRAINER_ELEMENTAL2: //Brumn Winterhoof
if (player->HasSpell(S_ELEMENTAL))
{
AddGossipItemFor(player, GOSSIP_ICON_TRAINER, GOSSIP_TEXT_TRAIN, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_TRAIN);
AddGossipItemFor(player, creature->GetEntry() == N_TRAINER_ELEMENTAL1 ? GOSSIP_MENU_SARAH_TANNER : GOSSIP_MENU_BRUMN_WINTERHOOF, GOSSIP_MENU_OPTION_TRAIN, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_TRAIN);
AddGossipItemFor(player, creature->GetEntry() == N_TRAINER_ELEMENTAL1 ? GOSSIP_MENU_SARAH_TANNER : GOSSIP_MENU_BRUMN_WINTERHOOF, GOSSIP_MENU_OPTION_CONFIRM_UNLEARN_ELEMENTAL, GOSSIP_SENDER_MAIN, GOSSIP_MENU_UNLEARN_CONFIRM_ELEMENTAL);
}
break;
case N_TRAINER_TRIBAL1: //Caryssia Moonhunter
case N_TRAINER_TRIBAL2: //Se'Jib
if (!HasLeatherSpecialty(player) && (player->GetQuestRewardStatus(5143) || player->GetQuestRewardStatus(5148)))
AddGossipItemFor(player, GOSSIP_ICON_CHAT, GOSSIP_LEARN_TRIBAL, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 3);
case N_TRAINER_TRIBAL1: //Caryssia Moonhunter
case N_TRAINER_TRIBAL2: //Se'Jib
if (player->HasSpell(S_TRIBAL))
{
AddGossipItemFor(player, GOSSIP_ICON_TRAINER, GOSSIP_TEXT_TRAIN, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_TRAIN);
AddGossipItemFor(player, creature->GetEntry() == N_TRAINER_TRIBAL1 ? GOSSIP_MENU_CARYSSIA_MOONHUNTER : GOSSIP_MENU_SEJIB, GOSSIP_MENU_OPTION_TRAIN, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_TRAIN);
AddGossipItemFor(player, creature->GetEntry() == N_TRAINER_TRIBAL1 ? GOSSIP_MENU_CARYSSIA_MOONHUNTER : GOSSIP_MENU_SEJIB, GOSSIP_MENU_OPTION_CONFIRM_UNLEARN_TRIBAL, GOSSIP_SENDER_MAIN, GOSSIP_MENU_UNLEARN_CONFIRM_TRIBAL);
}
break;
}
@@ -997,36 +1027,35 @@ public:
return true;
}
void SendActionMenu(Player* player, Creature* creature, uint32 action)
bool OnGossipSelect(Player* player, Creature* creature, uint32 /*sender*/, uint32 action) override
{
ClearGossipMenuFor(player);
switch (action)
{
case GOSSIP_ACTION_TRADE:
player->GetSession()->SendListInventory(creature->GetGUID());
break;
case GOSSIP_ACTION_TRAIN:
player->GetSession()->SendTrainerList(creature->GetGUID());
break;
// Learn Leather
case GOSSIP_MENU_UNLEARN_CONFIRM_DRAGONSCALE:
AddGossipItemFor(player, GOSSIP_MENU_UNLEARN_CONFIRM_DRAGONSCALE, GOSSIP_MENU_OPTION_CONFIRM_UNLEARN_DRAGONSCALE, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 1, DoMedUnlearnCost(player));
SendGossipMenuFor(player, GOSSIP_TEXT_UNLEARN_CONFIRM_DRAGONSCALE, creature);
break;
case GOSSIP_MENU_UNLEARN_CONFIRM_ELEMENTAL:
AddGossipItemFor(player, GOSSIP_MENU_UNLEARN_CONFIRM_ELEMENTAL, GOSSIP_MENU_OPTION_CONFIRM_UNLEARN_ELEMENTAL, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 2, DoMedUnlearnCost(player));
SendGossipMenuFor(player, GOSSIP_TEXT_UNLEARN_CONFIRM_ELEMENTAL, creature);
break;
case GOSSIP_MENU_UNLEARN_CONFIRM_TRIBAL:
AddGossipItemFor(player, GOSSIP_MENU_UNLEARN_CONFIRM_TRIBAL, GOSSIP_MENU_OPTION_CONFIRM_UNLEARN_TRIBAL, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 3, DoMedUnlearnCost(player));
SendGossipMenuFor(player, GOSSIP_TEXT_UNLEARN_CONFIRM_TRIBAL, creature);
break;
case GOSSIP_ACTION_INFO_DEF + 1:
ProcessCastaction(player, creature, S_DRAGON, S_LEARN_DRAGON, 0);
ProcessUnlearnAction(player, creature, S_UNLEARN_DRAGON, 0, DoMedUnlearnCost(player));
break;
case GOSSIP_ACTION_INFO_DEF + 2:
ProcessCastaction(player, creature, S_ELEMENTAL, S_LEARN_ELEMENTAL, 0);
ProcessUnlearnAction(player, creature, S_UNLEARN_ELEMENTAL, 0, DoMedUnlearnCost(player));
break;
case GOSSIP_ACTION_INFO_DEF + 3:
ProcessCastaction(player, creature, S_TRIBAL, S_LEARN_TRIBAL, 0);
break;
}
}
bool OnGossipSelect(Player* player, Creature* creature, uint32 sender, uint32 action) override
{
ClearGossipMenuFor(player);
switch (sender)
{
case GOSSIP_SENDER_MAIN:
SendActionMenu(player, creature, action);
ProcessUnlearnAction(player, creature, S_UNLEARN_TRIBAL, 0, DoMedUnlearnCost(player));
break;
}
return true;
@@ -1210,9 +1239,14 @@ class go_evil_book_for_dummies : public GameObjectScript
public:
go_evil_book_for_dummies() : GameObjectScript("go_evil_book_for_dummies") { }
inline bool HasLeatherSpecialty(Player* player)
{
return (player->HasSpell(S_DRAGON) || player->HasSpell(S_ELEMENTAL) || player->HasSpell(S_TRIBAL));
}
bool OnGossipHello(Player* player, GameObject* gameobject) override
{
//TAILORING SPEC
//ENGINEERING SPEC
if (player->HasSkill(SKILL_ENGINEERING) && player->GetBaseSkillValue(SKILL_ENGINEERING) >= 225 && player->getLevel() >= 35)
{
if (player->GetQuestRewardStatus(3643) || player->GetQuestRewardStatus(3641) || player->GetQuestRewardStatus(3639))
@@ -1233,6 +1267,17 @@ public:
}
}
//LEATHERWORKING SPEC
if (player->HasSkill(SKILL_LEATHERWORKING) && player->GetBaseSkillValue(SKILL_LEATHERWORKING) >= 225 && player->getLevel() >= 40)
{
if (!HasLeatherSpecialty(player) && (player->GetQuestRewardStatus(5141) || player->GetQuestRewardStatus(5143) || player->GetQuestRewardStatus(5144) || player->GetQuestRewardStatus(5145) || player->GetQuestRewardStatus(5146) || player->GetQuestRewardStatus(5148)))
{
AddGossipItemFor(player, GOSSIP_MENU_GO_SOOTHSAYING_FOR_DUMMIES, GOSSIP_MENU_OPTION_GO_LEARN_DRAGONSCALE, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 5);
AddGossipItemFor(player, GOSSIP_MENU_GO_SOOTHSAYING_FOR_DUMMIES, GOSSIP_MENU_OPTION_GO_LEARN_ELEMENTAL, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 6);
AddGossipItemFor(player, GOSSIP_MENU_GO_SOOTHSAYING_FOR_DUMMIES, GOSSIP_MENU_OPTION_GO_LEARN_TRIBAL, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 7);
}
}
SendGossipMenuFor(player, player->GetGossipTextId(gameobject), gameobject->GetGUID());
return true;
}
@@ -1257,6 +1302,18 @@ public:
case GOSSIP_ACTION_INFO_DEF + 4:
ProcessUnlearnAction(player, nullptr, S_UNLEARN_GNOMISH, 0, DoHighUnlearnCost(player));
break;
//Learn Dragon
case GOSSIP_ACTION_INFO_DEF + 5:
ProcessCastaction(player, nullptr, S_DRAGON, S_LEARN_DRAGON, 0);
break;
//Learn Elemental
case GOSSIP_ACTION_INFO_DEF + 6:
ProcessCastaction(player, nullptr, S_ELEMENTAL, S_LEARN_ELEMENTAL, 0);
break;
//Learn Tribal
case GOSSIP_ACTION_INFO_DEF + 7:
ProcessCastaction(player, nullptr, S_TRIBAL, S_LEARN_TRIBAL, 0);
break;
}
}