Core/Creatures: Deleted obsolete pet trainer script and fixed build

This commit is contained in:
Shauren
2017-07-27 00:04:37 +02:00
parent 0cd5179726
commit b85d46138b
8 changed files with 26 additions and 57 deletions

View File

@@ -0,0 +1 @@
UPDATE `creature_template` SET `ScriptName`='' WHERE `ScriptName`='npc_pet_trainer';

View File

@@ -41,27 +41,27 @@ GossipMenu::~GossipMenu()
ClearMenu();
}
void GossipMenu::AddMenuItem(int32 menuItemId, uint8 icon, std::string const& message, uint32 sender, uint32 action, std::string const& boxMessage, uint32 boxMoney, bool coded /*= false*/)
uint32 GossipMenu::AddMenuItem(int32 optionIndex, uint8 icon, std::string const& message, uint32 sender, uint32 action, std::string const& boxMessage, uint32 boxMoney, bool coded /*= false*/)
{
ASSERT(_menuItems.size() <= GOSSIP_MAX_MENU_ITEMS);
// Find a free new id - script case
if (menuItemId == -1)
if (optionIndex == -1)
{
menuItemId = 0;
optionIndex = 0;
if (!_menuItems.empty())
{
for (GossipMenuItemContainer::const_iterator itr = _menuItems.begin(); itr != _menuItems.end(); ++itr)
{
if (int32(itr->first) > menuItemId)
if (int32(itr->first) > optionIndex)
break;
menuItemId = itr->first + 1;
optionIndex = itr->first + 1;
}
}
}
GossipMenuItem& menuItem = _menuItems[menuItemId];
GossipMenuItem& menuItem = _menuItems[optionIndex];
menuItem.MenuItemIcon = icon;
menuItem.Message = message;
@@ -70,6 +70,7 @@ void GossipMenu::AddMenuItem(int32 menuItemId, uint8 icon, std::string const& me
menuItem.OptionType = action;
menuItem.BoxMessage = boxMessage;
menuItem.BoxMoney = boxMoney;
return optionIndex;
}
/**
@@ -131,7 +132,8 @@ void GossipMenu::AddMenuItem(uint32 menuId, uint32 menuItemId, uint32 sender, ui
}
/// Add menu item with existing method. Menu item id -1 is also used in ADD_GOSSIP_ITEM macro.
AddMenuItem(-1, itr->second.OptionIcon, strOptionText, sender, action, strBoxText, itr->second.BoxMoney, itr->second.BoxCoded);
uint32 optionIndex = AddMenuItem(-1, itr->second.OptionIcon, strOptionText, sender, action, strBoxText, itr->second.BoxMoney, itr->second.BoxCoded);
AddGossipMenuItemData(optionIndex, itr->second.ActionMenuId, itr->second.ActionPoiId, itr->second.TrainerId);
}
}

View File

@@ -167,7 +167,7 @@ class TC_GAME_API GossipMenu
GossipMenu();
~GossipMenu();
void AddMenuItem(int32 menuItemId, uint8 icon, std::string const& message, uint32 sender, uint32 action, std::string const& boxMessage, uint32 boxMoney, bool coded = false);
uint32 AddMenuItem(int32 menuItemId, uint8 icon, std::string const& message, uint32 sender, uint32 action, std::string const& boxMessage, uint32 boxMoney, bool coded = false);
void AddMenuItem(uint32 menuId, uint32 menuItemId, uint32 sender, uint32 action);
void SetMenuId(uint32 menu_id) { _menuId = menu_id; }

View File

@@ -132,11 +132,11 @@ void WorldSession::HandleTrainerBuySpellOpcode(WorldPackets::NPC::TrainerBuySpel
if (GetPlayer()->HasUnitState(UNIT_STATE_DIED))
GetPlayer()->RemoveAurasByType(SPELL_AURA_FEIGN_DEATH);
if (_player->GetCurrentTrainerId() != packet.TrainerID)
if (_player->GetCurrentTrainerId() != uint32(packet.TrainerID))
return;
Trainer::Trainer const* trainer = sObjectMgr->GetTrainer(packet.TrainerID);
if (!npc)
if (!trainer)
return;
trainer->TeachSpell(npc, _player, packet.SpellID);

View File

@@ -119,7 +119,8 @@ public:
enum RoxiRamrocket
{
SPELL_MECHANO_HOG = 60866,
SPELL_MEKGINEERS_CHOPPER = 60867
SPELL_MEKGINEERS_CHOPPER = 60867,
TRAINER_ID_ROXI_RAMROCKET = 102,
};
class npc_roxi_ramrocket : public CreatureScript
@@ -134,11 +135,11 @@ public:
player->PrepareQuestMenu(creature->GetGUID());
//Trainer Menu
if ( creature->IsTrainer() )
if (creature->IsTrainer())
AddGossipItemFor(player, GOSSIP_ICON_TRAINER, GOSSIP_TEXT_TRAIN, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_TRAIN);
//Vendor Menu
if ( creature->IsVendor() )
if (creature->IsVendor())
if (player->HasSpell(SPELL_MECHANO_HOG) || player->HasSpell(SPELL_MEKGINEERS_CHOPPER))
AddGossipItemFor(player, GOSSIP_ICON_VENDOR, GOSSIP_TEXT_BROWSE_GOODS, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_TRADE);
@@ -152,7 +153,7 @@ public:
switch (action)
{
case GOSSIP_ACTION_TRAIN:
player->GetSession()->SendTrainerList(creature->GetGUID());
player->GetSession()->SendTrainerList(creature->GetGUID(), TRAINER_ID_ROXI_RAMROCKET);
break;
case GOSSIP_ACTION_TRADE:
player->GetSession()->SendListInventory(creature->GetGUID());

View File

@@ -396,10 +396,7 @@ class npc_wg_quest_giver : public CreatureScript
return true;
if (creature->IsVendor())
{
AddGossipItemFor(player, Player::GetDefaultGossipMenuForSource(creature), 0, GOSSIP_SENDER_MAIN, GOSSIP_OPTION_VENDOR);
player->PlayerTalkClass->GetGossipMenu().AddGossipMenuItemData(0, 0, 0);
}
/// @todo: move this to conditions or something else

View File

@@ -190,6 +190,7 @@ enum SpecializationTrainers
N_TRAINER_TRANSMUTE = 22427, // Zarevhi
N_TRAINER_ELIXIR = 19052, // Lorokeem
N_TRAINER_POTION = 17909, // Lauranna Thar'well
TRAINER_ID_ALCHEMY = 122,
/* Blacksmithing */
N_TRAINER_SMITHOMNI1 = 11145, // Myolor Sunderfury
@@ -201,6 +202,7 @@ enum SpecializationTrainers
N_TRAINER_HAMMER = 11191, // Lilith the Lithe
N_TRAINER_AXE = 11192, // Kilram
N_TRAINER_SWORD = 11193, // Seril Scourgebane
TRAINER_ID_BLACKSMITHING = 80,
/* Leatherworking */
N_TRAINER_DRAGON1 = 7866, // Peter Galen
@@ -209,11 +211,13 @@ enum SpecializationTrainers
N_TRAINER_ELEMENTAL2 = 7869, // Brumn Winterhoof
N_TRAINER_TRIBAL1 = 7870, // Caryssia Moonhunter
N_TRAINER_TRIBAL2 = 7871, // Se'Jib
TRAINER_ID_LEATHERWORKING = 103,
/* Tailoring */
N_TRAINER_SPELLFIRE = 22213, // Gidge Spellweaver
N_TRAINER_MOONCLOTH = 22208, // Nasmara Moonsong
N_TRAINER_SHADOWEAVE = 22212, // Andrion Darkspinner
TRAINER_ID_TAILORING = 117,
};
/*###
@@ -485,7 +489,7 @@ public:
player->GetSession()->SendListInventory(creature->GetGUID());
break;
case GOSSIP_ACTION_TRAIN:
player->GetSession()->SendTrainerList(creature->GetGUID());
player->GetSession()->SendTrainerList(creature->GetGUID(), TRAINER_ID_ALCHEMY);
break;
//Learn Alchemy
case GOSSIP_ACTION_INFO_DEF + 1:
@@ -673,7 +677,7 @@ public:
player->GetSession()->SendListInventory(creature->GetGUID());
break;
case GOSSIP_ACTION_TRAIN:
player->GetSession()->SendTrainerList(creature->GetGUID());
player->GetSession()->SendTrainerList(creature->GetGUID(), TRAINER_ID_BLACKSMITHING);
break;
//Learn Armor/Weapon
case GOSSIP_ACTION_INFO_DEF + 1:
@@ -983,7 +987,7 @@ public:
player->GetSession()->SendListInventory(creature->GetGUID());
break;
case GOSSIP_ACTION_TRAIN:
player->GetSession()->SendTrainerList(creature->GetGUID());
player->GetSession()->SendTrainerList(creature->GetGUID(), TRAINER_ID_LEATHERWORKING);
break;
//Unlearn Leather
case GOSSIP_ACTION_INFO_DEF + 1:
@@ -1113,7 +1117,7 @@ public:
player->GetSession()->SendListInventory(creature->GetGUID());
break;
case GOSSIP_ACTION_TRAIN:
player->GetSession()->SendTrainerList(creature->GetGUID());
player->GetSession()->SendTrainerList(creature->GetGUID(), TRAINER_ID_TAILORING);
break;
//Learn Tailor
case GOSSIP_ACTION_INFO_DEF + 1:

View File

@@ -1732,41 +1732,6 @@ class npc_wormhole : public CreatureScript
}
};
/*######
## npc_pet_trainer
######*/
enum PetTrainer
{
MENU_ID_PET_UNLEARN = 6520,
OPTION_ID_PLEASE_DO = 0
};
class npc_pet_trainer : public CreatureScript
{
public:
npc_pet_trainer() : CreatureScript("npc_pet_trainer") { }
struct npc_pet_trainerAI : public ScriptedAI
{
npc_pet_trainerAI(Creature* creature) : ScriptedAI(creature) { }
void sGossipSelect(Player* player, uint32 menuId, uint32 gossipListId) override
{
if (menuId == MENU_ID_PET_UNLEARN && gossipListId == OPTION_ID_PLEASE_DO)
{
player->ResetPetTalents();
CloseGossipMenuFor(player);
}
}
};
CreatureAI* GetAI(Creature* creature) const override
{
return new npc_pet_trainerAI(creature);
}
};
/*######
## npc_experience
######*/
@@ -2553,7 +2518,6 @@ void AddSC_npcs_special()
new npc_brewfest_reveler();
new npc_training_dummy();
new npc_wormhole();
new npc_pet_trainer();
new npc_experience();
new npc_firework();
new npc_spring_rabbit();