fix(DB/SAI): Engineer Trinket NPCs (#24695)
Co-authored-by: Ludwig <sudlud@users.noreply.github.com> Co-authored-by: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -833,120 +833,6 @@ public:
|
||||
}
|
||||
};
|
||||
|
||||
/*###
|
||||
# engineering trinkets
|
||||
###*/
|
||||
|
||||
enum EngineeringTrinkets
|
||||
{
|
||||
NPC_ZAP = 14742,
|
||||
NPC_JHORDY = 14743,
|
||||
NPC_KABLAM = 21493,
|
||||
NPC_SMILES = 21494,
|
||||
|
||||
SPELL_LEARN_TO_EVERLOOK = 23490,
|
||||
SPELL_LEARN_TO_GADGET = 23491,
|
||||
SPELL_LEARN_TO_AREA52 = 36956,
|
||||
SPELL_LEARN_TO_TOSHLEY = 36957,
|
||||
|
||||
SPELL_TO_EVERLOOK = 23486,
|
||||
SPELL_TO_GADGET = 23489,
|
||||
SPELL_TO_AREA52 = 36954,
|
||||
SPELL_TO_TOSHLEY = 36955,
|
||||
};
|
||||
|
||||
#define GOSSIP_ITEM_ZAP "This Dimensional Imploder sounds dangerous! How can I make one?"
|
||||
#define GOSSIP_ITEM_JHORDY "I must build a beacon for this marvelous device!"
|
||||
#define GOSSIP_ITEM_KABLAM "[PH] Unknown"
|
||||
|
||||
class npc_engineering_tele_trinket : public CreatureScript
|
||||
{
|
||||
public:
|
||||
npc_engineering_tele_trinket() : CreatureScript("npc_engineering_tele_trinket") { }
|
||||
|
||||
bool CanLearn(Player* player, uint32 textId, uint32 altTextId, uint32 skillValue, uint32 reqSpellId, uint32 spellId, uint32& npcTextId)
|
||||
{
|
||||
bool res = false;
|
||||
npcTextId = textId;
|
||||
if (player->GetBaseSkillValue(SKILL_ENGINEERING) >= skillValue && player->HasSpell(reqSpellId))
|
||||
{
|
||||
if (!player->HasSpell(spellId))
|
||||
res = true;
|
||||
else
|
||||
npcTextId = altTextId;
|
||||
}
|
||||
return res;
|
||||
}
|
||||
|
||||
bool OnGossipHello(Player* player, Creature* creature) override
|
||||
{
|
||||
uint32 npcTextId = 0;
|
||||
std::string gossipItem;
|
||||
bool canLearn = false;
|
||||
|
||||
if (player->HasSkill(SKILL_ENGINEERING))
|
||||
{
|
||||
switch (creature->GetEntry())
|
||||
{
|
||||
case NPC_ZAP:
|
||||
canLearn = CanLearn(player, 6092, 0, 260, S_GOBLIN, SPELL_TO_EVERLOOK, npcTextId);
|
||||
if (canLearn)
|
||||
gossipItem = GOSSIP_ITEM_ZAP;
|
||||
break;
|
||||
case NPC_JHORDY:
|
||||
canLearn = CanLearn(player, 7251, 7252, 260, S_GNOMISH, SPELL_TO_GADGET, npcTextId);
|
||||
if (canLearn)
|
||||
gossipItem = GOSSIP_ITEM_JHORDY;
|
||||
break;
|
||||
case NPC_KABLAM:
|
||||
canLearn = CanLearn(player, 10365, 0, 350, S_GOBLIN, SPELL_TO_AREA52, npcTextId);
|
||||
if (canLearn)
|
||||
gossipItem = GOSSIP_ITEM_KABLAM;
|
||||
break;
|
||||
case NPC_SMILES:
|
||||
canLearn = CanLearn(player, 10363, 0, 350, S_GNOMISH, SPELL_TO_TOSHLEY, npcTextId);
|
||||
if (canLearn)
|
||||
gossipItem = GOSSIP_ITEM_KABLAM;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (canLearn)
|
||||
AddGossipItemFor(player, GOSSIP_ICON_CHAT, gossipItem, creature->GetEntry(), GOSSIP_ACTION_INFO_DEF + 1);
|
||||
|
||||
SendGossipMenuFor(player, npcTextId ? npcTextId : player->GetGossipTextId(creature), creature->GetGUID());
|
||||
return true;
|
||||
}
|
||||
|
||||
bool OnGossipSelect(Player* player, Creature* creature, uint32 sender, uint32 action) override
|
||||
{
|
||||
ClearGossipMenuFor(player);
|
||||
if (action == GOSSIP_ACTION_INFO_DEF + 1)
|
||||
CloseGossipMenuFor(player);
|
||||
|
||||
if (sender != creature->GetEntry())
|
||||
return true;
|
||||
|
||||
switch (sender)
|
||||
{
|
||||
case NPC_ZAP:
|
||||
player->CastSpell(player, SPELL_LEARN_TO_EVERLOOK, false);
|
||||
break;
|
||||
case NPC_JHORDY:
|
||||
player->CastSpell(player, SPELL_LEARN_TO_GADGET, false);
|
||||
break;
|
||||
case NPC_KABLAM:
|
||||
player->CastSpell(player, SPELL_LEARN_TO_AREA52, false);
|
||||
break;
|
||||
case NPC_SMILES:
|
||||
player->CastSpell(player, SPELL_LEARN_TO_TOSHLEY, false);
|
||||
break;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
};
|
||||
|
||||
/*###
|
||||
# start menues leatherworking
|
||||
###*/
|
||||
@@ -1358,7 +1244,6 @@ void AddSC_npc_professions()
|
||||
{
|
||||
new npc_prof_alchemy();
|
||||
new npc_prof_blacksmith();
|
||||
new npc_engineering_tele_trinket();
|
||||
new npc_prof_leather();
|
||||
new npc_prof_tailor();
|
||||
new go_evil_book_for_dummies();
|
||||
|
||||
Reference in New Issue
Block a user