Rewrite trainer handling to properly support multiple trainers on the same creature

This commit is contained in:
hondacrx
2017-07-27 17:29:22 -04:00
parent 0d8729ae32
commit 0aa7df2f53
18 changed files with 434 additions and 508 deletions
+1 -1
View File
@@ -578,7 +578,7 @@ namespace Framework.Constants
CommandReloadMailLootTemplate = 669,
CommandReloadMillingLootTemplate = 670,
CommandReloadNpcSpellclickSpells = 671,
CommandReloadNpcTrainer = 672,
CommandReloadTrainer = 672,
CommandReloadNpcVendor = 673,
CommandReloadPageText = 674,
CommandReloadPickpocketingLootTemplate = 675,
+1 -1
View File
@@ -36,7 +36,7 @@ namespace Framework.Constants
Stablepet = 14, //Unit_Npc_Flag_Stable (4194304)
Armorer = 15, //Unit_Npc_Flag_Armorer (4096)
Unlearntalents = 16, //Unit_Npc_Flag_Trainer (16) (Bonus Option For Trainer)
Unlearnpettalents = 17, //Unit_Npc_Flag_Trainer (16) (Bonus Option For Trainer)
Unlearnpettalents_Old = 17, // deprecated
Learndualspec = 18, //Unit_Npc_Flag_Trainer (16) (Bonus Option For Trainer)
Outdoorpvp = 19, //Added By Code (Option For Outdoor Pvp Creatures)
Max
+11 -6
View File
@@ -571,17 +571,22 @@ namespace Framework.Constants
public enum TrainerType
{
Class = 0,
Mounts = 1,
None = 0,
Talent = 1,
Tradeskills = 2,
Pets = 3
}
public enum TrainerSpellState
{
Gray = 0,
Green = 1,
Red = 2,
GreenDisabled = 10
Known = 0,
Available = 1,
Unavailable = 2,
}
public enum TrainerFailReason
{
Unavailable = 0,
NotEnoughMoney = 1
}
public enum ChatMsg : uint
@@ -75,7 +75,7 @@ namespace Framework.Database
PrepareStatement(WorldStatements.SEL_WAYPOINT_SCRIPT_ID_BY_GUID, "SELECT id FROM waypoint_scripts WHERE guid = ?");
PrepareStatement(WorldStatements.DEL_CREATURE, "DELETE FROM creature WHERE guid = ?");
PrepareStatement(WorldStatements.SEL_COMMANDS, "SELECT name, permission, help FROM command");
PrepareStatement(WorldStatements.SEL_CREATURE_TEMPLATE, "SELECT entry, difficulty_entry_1, difficulty_entry_2, difficulty_entry_3, KillCredit1, KillCredit2, modelid1, modelid2, modelid3, modelid4, name, femaleName, subname, IconName, gossip_menu_id, minlevel, maxlevel, HealthScalingExpansion, RequiredExpansion, VignetteID, faction, npcflag, speed_walk, speed_run, scale, rank, dmgschool, BaseAttackTime, RangeAttackTime, BaseVariance, RangeVariance, unit_class, unit_flags, unit_flags2, unit_flags3, dynamicflags, family, trainer_type, trainer_class, trainer_race, type, type_flags, type_flags2, lootid, pickpocketloot, skinloot, resistance1, resistance2, resistance3, resistance4, resistance5, resistance6, spell1, spell2, spell3, spell4, spell5, spell6, spell7, spell8, VehicleId, mingold, maxgold, AIName, MovementType, InhabitType, HoverHeight, HealthModifier, HealthModifierExtra, ManaModifier, ManaModifierExtra, ArmorModifier, DamageModifier, ExperienceModifier, RacialLeader, movementId, RegenHealth, mechanic_immune_mask, flags_extra, ScriptName FROM creature_template WHERE entry = ?");
PrepareStatement(WorldStatements.SEL_CREATURE_TEMPLATE, "SELECT entry, difficulty_entry_1, difficulty_entry_2, difficulty_entry_3, KillCredit1, KillCredit2, modelid1, modelid2, modelid3, modelid4, name, femaleName, subname, IconName, gossip_menu_id, minlevel, maxlevel, HealthScalingExpansion, RequiredExpansion, VignetteID, faction, npcflag, speed_walk, speed_run, scale, rank, dmgschool, BaseAttackTime, RangeAttackTime, BaseVariance, RangeVariance, unit_class, unit_flags, unit_flags2, unit_flags3, dynamicflags, family, trainer_class, type, type_flags, type_flags2, lootid, pickpocketloot, skinloot, resistance1, resistance2, resistance3, resistance4, resistance5, resistance6, spell1, spell2, spell3, spell4, spell5, spell6, spell7, spell8, VehicleId, mingold, maxgold, AIName, MovementType, InhabitType, HoverHeight, HealthModifier, HealthModifierExtra, ManaModifier, ManaModifierExtra, ArmorModifier, DamageModifier, ExperienceModifier, RacialLeader, movementId, RegenHealth, mechanic_immune_mask, flags_extra, ScriptName FROM creature_template WHERE entry = ?");
PrepareStatement(WorldStatements.SEL_WAYPOINT_SCRIPT_BY_ID, "SELECT guid, delay, command, datalong, datalong2, dataint, x, y, z, o FROM waypoint_scripts WHERE id = ?");
PrepareStatement(WorldStatements.SEL_CREATURE_BY_ID, "SELECT guid FROM creature WHERE id = ?");
PrepareStatement(WorldStatements.SEL_GAMEOBJECT_NEAREST, "SELECT guid, id, position_x, position_y, position_z, map, (POW(position_x - ?, 2) + POW(position_y - ?, 2) + POW(position_z - ?, 2)) AS order_ FROM gameobject WHERE map = ? AND (POW(position_x - ?, 2) + POW(position_y - ?, 2) + POW(position_z - ?, 2)) <= ? ORDER BY order_");