DB/Gossip: Add and fix a few more gossip menus.

This commit is contained in:
Malcrom
2013-07-15 19:57:18 -02:30
parent 53e5075005
commit bd3fa71d32
2 changed files with 78 additions and 31 deletions

View File

@@ -39,54 +39,64 @@ EndContentData */
enum Spells
{
SPELL_GOLDTHORN_TEA = 13028,
SPELL_TEACHING_GOLDTHORN_TEA = 13029,
SPELL_MIGHT_TROLLS_BLOOD_POTION = 3451,
SPELL_TEACHING_MIGHTY_TROLLS_BLOOD_POTION = 13030,
SPELL_TEACHING_MIGHTY_TROLLS_BLOOD_POTION = 13030
};
enum Gossips
{
GOSSIP_TEXT_TEA_ANSWER = 2114,
GOSSIP_TEXT_POTION_ANSWER = 2115,
GOSSIP_COOKING_SKILL_HIGH = 1444,
GOSSIP_COOKING_SKILL_LOW = 1501,
GOSSIP_ALCHEMY_SKILL_HIGH = 1442,
GOSSIP_ALCHEMY_SKILL_LOW = 1502
};
#define GOSSIP_ITEM_TEA "Teach me the cooking recipe"
#define GOSSIP_ITEM_POTION "Teach me the alchemy recipe"
class npc_henry_stern : public CreatureScript
{
public:
npc_henry_stern() : CreatureScript("npc_henry_stern") { }
bool OnGossipSelect(Player* player, Creature* creature, uint32 /*sender*/, uint32 action) OVERRIDE
struct npc_henry_sternAI : public ScriptedAI
{
player->PlayerTalkClass->ClearMenus();
if (action == GOSSIP_ACTION_INFO_DEF + 1)
npc_henry_sternAI(Creature* creature) : ScriptedAI(creature) { }
void sGossipSelect(Player* player, uint32 /*sender*/, uint32 action) OVERRIDE
{
player->CastSpell(player, SPELL_TEACHING_GOLDTHORN_TEA, true);
player->SEND_GOSSIP_MENU(GOSSIP_TEXT_TEA_ANSWER, creature->GetGUID());
if (action == 0)
{
if (player->GetBaseSkillValue(SKILL_COOKING) >= 175)
{
player->PrepareGossipMenu(me, GOSSIP_COOKING_SKILL_HIGH);
player->SendPreparedGossip(me);
DoCast(player, SPELL_TEACHING_GOLDTHORN_TEA);
}
else
{
player->PrepareGossipMenu(me, GOSSIP_COOKING_SKILL_LOW);
player->SendPreparedGossip(me);
}
}
if (action == 1)
{
if (player->GetBaseSkillValue(SKILL_ALCHEMY) >= 180)
{
player->PrepareGossipMenu(me, GOSSIP_ALCHEMY_SKILL_HIGH);
player->SendPreparedGossip(me);
DoCast(player, SPELL_TEACHING_MIGHTY_TROLLS_BLOOD_POTION);
}
else
{
player->PrepareGossipMenu(me, GOSSIP_ALCHEMY_SKILL_LOW);
player->SendPreparedGossip(me);
}
}
}
};
if (action == GOSSIP_ACTION_INFO_DEF + 2)
{
player->CastSpell(player, SPELL_TEACHING_MIGHTY_TROLLS_BLOOD_POTION, true);
player->SEND_GOSSIP_MENU(GOSSIP_TEXT_POTION_ANSWER, creature->GetGUID());
}
return true;
}
bool OnGossipHello(Player* player, Creature* creature) OVERRIDE
CreatureAI* GetAI(Creature* creature) const OVERRIDE
{
if (player->GetBaseSkillValue(SKILL_COOKING) >= 175 && !player->HasSpell(SPELL_GOLDTHORN_TEA))
player->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_ITEM_TEA, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 1);
if (player->GetBaseSkillValue(SKILL_ALCHEMY) >= 180 && !player->HasSpell(SPELL_MIGHT_TROLLS_BLOOD_POTION))
player->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_ITEM_POTION, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 2);
player->SEND_GOSSIP_MENU(player->GetGossipTextId(creature), creature->GetGUID());
return true;
return new npc_henry_sternAI(creature);
}
};