Core/Spells: Fix display for Shaman totems

This commit is contained in:
hondacrx
2018-04-24 17:57:30 -04:00
parent c2b882eb45
commit e88d23ff50
6 changed files with 273 additions and 118 deletions
-7
View File
@@ -83,13 +83,6 @@ namespace Framework.Constants
MiniPet = 5,
Quest = 6,
}
public enum PlayerTotemType
{
Fire = 63,
Earth = 81,
Water = 82,
Air = 83
}
public enum BaseModType
{
+5 -12
View File
@@ -68,18 +68,11 @@ namespace Game.Entities
}
// set display id depending on caster's race
SpellInfo createdBySpell = Global.SpellMgr.GetSpellInfo(GetUInt32Value(UnitFields.CreatedBySpell));
if (createdBySpell != null)
{
SpellEffectInfo[] effects = createdBySpell.GetEffectsForDifficulty(Difficulty.None);
var summonEffect = effects.FirstOrDefault(effect =>
{
return effect != null && effect.IsEffect(SpellEffectName.Summon);
});
if (summonEffect != null)
SetDisplayId(owner.GetModelForTotem((PlayerTotemType)summonEffect.MiscValueB));
}
uint totemDisplayId = Global.SpellMgr.GetModelForTotem(GetUInt32Value(UnitFields.CreatedBySpell), owner.GetRace());
if (totemDisplayId == 0)
Log.outError(LogFilter.Spells, $"Spell {GetUInt32Value(UnitFields.CreatedBySpell)} with RaceID ({owner.GetRace()}) have no totem model data defined, set to default model.");
else
SetDisplayId(totemDisplayId);
}
base.InitStats(duration);
-98
View File
@@ -2235,104 +2235,6 @@ namespace Game.Entities
SetDisplayId(GetNativeDisplayId());
}
public uint GetModelForTotem(PlayerTotemType totemType)
{
switch (GetRace())
{
case Race.Orc:
{
switch (totemType)
{
case PlayerTotemType.Fire: // fire
return 30758;
case PlayerTotemType.Earth: // earth
return 30757;
case PlayerTotemType.Water: // water
return 30759;
case PlayerTotemType.Air: // air
return 30756;
}
break;
}
case Race.Dwarf:
{
switch (totemType)
{
case PlayerTotemType.Fire: // fire
return 30754;
case PlayerTotemType.Earth: // earth
return 30753;
case PlayerTotemType.Water: // water
return 30755;
case PlayerTotemType.Air: // air
return 30736;
}
break;
}
case Race.Troll:
{
switch (totemType)
{
case PlayerTotemType.Fire: // fire
return 30762;
case PlayerTotemType.Earth: // earth
return 30761;
case PlayerTotemType.Water: // water
return 30763;
case PlayerTotemType.Air: // air
return 30760;
}
break;
}
case Race.Tauren:
{
switch (totemType)
{
case PlayerTotemType.Fire: // fire
return 4589;
case PlayerTotemType.Earth: // earth
return 4588;
case PlayerTotemType.Water: // water
return 4587;
case PlayerTotemType.Air: // air
return 4590;
}
break;
}
case Race.Draenei:
{
switch (totemType)
{
case PlayerTotemType.Fire: // fire
return 19074;
case PlayerTotemType.Earth: // earth
return 19073;
case PlayerTotemType.Water: // water
return 19075;
case PlayerTotemType.Air: // air
return 19071;
}
break;
}
case Race.Goblin:
{
switch (totemType)
{
case PlayerTotemType.Fire: // fire
return 30783;
case PlayerTotemType.Earth: // earth
return 30782;
case PlayerTotemType.Water: // water
return 30784;
case PlayerTotemType.Air: // air
return 30781;
}
break;
}
}
return 0;
}
public bool IsStopped() { return !HasUnitState(UnitState.Moving); }
public bool HasUnitTypeMask(UnitTypeMask mask) { return Convert.ToBoolean(mask & m_unitTypeMask); }
+3
View File
@@ -390,6 +390,9 @@ namespace Game
Log.outInfo(LogFilter.ServerLoading, "Loading PetFamilySpellsStore Data...");
Global.SpellMgr.LoadPetFamilySpellsStore();
Log.outInfo(LogFilter.ServerLoading, "Loading Spell Totem models...");
Global.SpellMgr.LoadSpellTotemModel();
Log.outInfo(LogFilter.ServerLoading, "Loading GameObject models...");
GameObjectModel.LoadGameObjectModelList();
+52 -1
View File
@@ -2899,6 +2899,52 @@ namespace Game.Entities
}
}
}
public void LoadSpellTotemModel()
{
uint oldMSTime = Time.GetMSTime();
SQLResult result = DB.World.Query("SELECT SpellID, RaceID, DisplayID from spell_totem_model");
if (result.IsEmpty())
{
Log.outInfo(LogFilter.ServerLoading, "Loaded 0 spell totem model records. DB table `spell_totem_model` is empty.");
return;
}
uint count = 0;
do
{
uint spellId = result.Read<uint>(0);
byte race = result.Read<byte>(1);
uint displayId = result.Read<uint>(2);
SpellInfo spellEntry = GetSpellInfo(spellId);
if (spellEntry == null)
{
Log.outError(LogFilter.Sql, $"SpellID: {spellId} in `spell_totem_model` table could not be found in dbc, skipped.");
continue;
}
if (!CliDB.ChrRacesStorage.ContainsKey(race))
{
Log.outError(LogFilter.Sql, $"Race {race} defined in `spell_totem_model` does not exists, skipped.");
continue;
}
if (!CliDB.CreatureDisplayInfoStorage.ContainsKey(displayId))
{
Log.outError(LogFilter.Sql, $"SpellID: {spellId} defined in `spell_totem_model` has non-existing model ({displayId}).");
continue;
}
mSpellTotemModel[Tuple.Create(spellId, race)] = displayId;
++count;
} while (result.NextRow());
Log.outInfo(LogFilter.ServerLoading, $"Loaded {count} spell totem model records in {Time.GetMSTimeDiffToNow(oldMSTime)} ms");
}
#endregion
bool isTriggerAura(AuraType type)
@@ -2981,7 +3027,6 @@ namespace Game.Entities
}
}
// SpellInfo object management
public SpellInfo GetSpellInfo(uint spellId)
{
@@ -3085,6 +3130,11 @@ namespace Game.Entities
return SpellSchools.Normal;
}
public uint GetModelForTotem(uint spellId, Race race)
{
return mSpellTotemModel.LookupByKey(Tuple.Create(spellId, race));
}
#region Fields
//private:
Dictionary<uint, SpellChainNode> mSpellChains = new Dictionary<uint, SpellChainNode>();
@@ -3112,6 +3162,7 @@ namespace Game.Entities
Dictionary<uint, MultiMap<uint, uint>> mPetLevelupSpellMap = new Dictionary<uint, MultiMap<uint, uint>>();
Dictionary<uint, PetDefaultSpellsEntry> mPetDefaultSpellsMap = new Dictionary<uint, PetDefaultSpellsEntry>(); // only spells not listed in related mPetLevelupSpellMap entry
Dictionary<uint, SpellInfo> mSpellInfoMap = new Dictionary<uint, SpellInfo>();
Dictionary<Tuple<uint, byte>, uint> mSpellTotemModel = new Dictionary<Tuple<uint, byte>, uint>();
public delegate void AuraEffectHandler(AuraEffect effect, AuraApplication aurApp, AuraEffectHandleModes mode, bool apply);
Dictionary<AuraType, AuraEffectHandler> AuraEffectHandlers = new Dictionary<AuraType, AuraEffectHandler>();
@@ -0,0 +1,213 @@
--
-- Table structure for table `spell_totem_model`
--
DROP TABLE IF EXISTS `spell_totem_model`;
CREATE TABLE `spell_totem_model` (
`SpellID` int(10) unsigned NOT NULL,
`RaceID` tinyint(3) unsigned NOT NULL,
`DisplayID` int(10) unsigned NOT NULL DEFAULT '0',
PRIMARY KEY (`SpellID`,`RaceID`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8;
DELETE FROM `spell_totem_model` WHERE `SpellID` IN (2484, 5394, 51485, 98008, 108280, 157153, 192058, 192077, 192222, 196932, 198838, 202188, 204330, 204331, 204332, 204336, 207399, 210651, 210657, 210660);
INSERT INTO `spell_totem_model` (`SpellID`, `RaceID`, `DisplayID`) VALUES
(2484, 2, 30757),
(2484, 3, 30753),
(2484, 6, 4588),
(2484, 8, 30761),
(2484, 9, 30782),
(2484, 11, 19073),
(2484, 24, 41669),
(2484, 25, 41669),
(2484, 26, 41669),
(2484, 28, 81443),
(5394, 2, 30759),
(5394, 3, 30755),
(5394, 6, 4587),
(5394, 8, 30763),
(5394, 9, 30784),
(5394, 11, 19075),
(5394, 24, 41671),
(5394, 25, 41671),
(5394, 26, 41671),
(5394, 28, 81442),
(51485, 2, 30757),
(51485, 3, 30753),
(51485, 6, 4588),
(51485, 8, 30761),
(51485, 9, 30782),
(51485, 11, 19073),
(51485, 24, 41669),
(51485, 25, 41669),
(51485, 26, 41669),
(51485, 28, 81443),
(98008, 2, 30756),
(98008, 3, 30736),
(98008, 6, 4590),
(98008, 8, 30760),
(98008, 9, 30781),
(98008, 11, 19071),
(98008, 24, 41668),
(98008, 25, 41668),
(98008, 26, 41668),
(98008, 28, 81441),
(108280, 2, 30759),
(108280, 3, 30755),
(108280, 6, 4587),
(108280, 8, 30763),
(108280, 9, 30784),
(108280, 11, 19075),
(108280, 24, 41671),
(108280, 25, 41671),
(108280, 26, 41671),
(108280, 28, 81442),
(157153, 2, 30759),
(157153, 3, 30755),
(157153, 6, 4587),
(157153, 8, 30763),
(157153, 9, 30784),
(157153, 11, 19075),
(157153, 24, 41671),
(157153, 25, 41671),
(157153, 26, 41671),
(157153, 28, 81442),
(192058, 2, 30756),
(192058, 3, 30736),
(192058, 6, 4590),
(192058, 8, 30760),
(192058, 9, 30781),
(192058, 11, 19071),
(192058, 24, 41668),
(192058, 25, 41668),
(192058, 26, 41668),
(192058, 28, 81441),
(192077, 2, 30756),
(192077, 3, 30736),
(192077, 6, 4590),
(192077, 8, 30760),
(192077, 9, 30781),
(192077, 11, 19071),
(192077, 24, 41668),
(192077, 25, 41668),
(192077, 26, 41668),
(192077, 28, 81441),
(192222, 2, 30758),
(192222, 3, 30754),
(192222, 6, 4589),
(192222, 8, 30762),
(192222, 9, 30783),
(192222, 11, 19074),
(192222, 24, 41670),
(192222, 25, 41670),
(192222, 26, 41670),
(192222, 28, 81444),
(196932, 2, 30758),
(196932, 3, 30754),
(196932, 6, 4589),
(196932, 8, 30762),
(196932, 9, 30783),
(196932, 11, 19074),
(196932, 24, 41670),
(196932, 25, 41670),
(196932, 26, 41670),
(196932, 28, 81444),
(198838, 2, 30757),
(198838, 3, 30753),
(198838, 6, 4588),
(198838, 8, 30761),
(198838, 9, 30782),
(198838, 11, 19073),
(198838, 24, 41669),
(198838, 25, 41669),
(198838, 26, 41669),
(198838, 28, 81443),
(202188, 2, 30757),
(202188, 3, 30753),
(202188, 6, 4588),
(202188, 8, 30761),
(202188, 9, 30782),
(202188, 11, 19073),
(202188, 24, 41669),
(202188, 25, 41669),
(202188, 26, 41669),
(202188, 28, 81443),
(204330, 2, 30758),
(204330, 3, 30754),
(204330, 6, 4589),
(204330, 8, 30762),
(204330, 9, 30783),
(204330, 11, 19074),
(204330, 24, 41670),
(204330, 25, 41670),
(204330, 26, 41670),
(204330, 28, 81444),
(204331, 2, 30756),
(204331, 3, 30736),
(204331, 6, 4590),
(204331, 8, 30760),
(204331, 9, 30781),
(204331, 11, 19071),
(204331, 24, 41668),
(204331, 25, 41668),
(204331, 26, 41668),
(204331, 28, 81441),
(204332, 2, 30756),
(204332, 3, 30736),
(204332, 6, 4590),
(204332, 8, 30760),
(204332, 9, 30781),
(204332, 11, 19071),
(204332, 24, 41668),
(204332, 25, 41668),
(204332, 26, 41668),
(204332, 28, 81441),
(204336, 2, 30756),
(204336, 3, 30736),
(204336, 6, 4590),
(204336, 8, 30760),
(204336, 9, 30781),
(204336, 11, 19071),
(204336, 24, 41668),
(204336, 25, 41668),
(204336, 26, 41668),
(204336, 28, 81441),
(207399, 2, 30757),
(207399, 3, 30753),
(207399, 6, 4588),
(207399, 8, 30761),
(207399, 9, 30782),
(207399, 11, 19073),
(207399, 24, 41669),
(207399, 25, 41669),
(207399, 26, 41669),
(207399, 28, 81443),
(210651, 2, 30759),
(210651, 3, 30755),
(210651, 6, 4587),
(210651, 8, 30763),
(210651, 9, 30784),
(210651, 11, 19075),
(210651, 24, 41671),
(210651, 25, 41671),
(210651, 26, 41671),
(210651, 28, 81442),
(210657, 2, 30758),
(210657, 3, 30754),
(210657, 6, 4589),
(210657, 8, 30762),
(210657, 9, 30783),
(210657, 11, 19074),
(210657, 24, 41670),
(210657, 25, 41670),
(210657, 26, 41670),
(210657, 28, 81444),
(210660, 2, 30756),
(210660, 3, 30736),
(210660, 6, 4590),
(210660, 8, 30760),
(210660, 9, 30781),
(210660, 11, 19071),
(210660, 24, 41668),
(210660, 25, 41668),
(210660, 26, 41668),
(210660, 28, 81441);