Core/Spells: Fix display for Shaman totems
This commit is contained in:
@@ -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
|
||||
{
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -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); }
|
||||
|
||||
@@ -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();
|
||||
|
||||
|
||||
@@ -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>();
|
||||
|
||||
Reference in New Issue
Block a user