Core/Items: Implemented corruption and corruption resistance stats
Port From (https://github.com/TrinityCore/TrinityCore/commit/6533de31005fc9680d9f2b61a4d8ea4958fc8edc)
This commit is contained in:
@@ -1945,4 +1945,10 @@ namespace Framework.Constants
|
|||||||
|
|
||||||
Max,
|
Max,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public enum CorruptionEffectsFlag
|
||||||
|
{
|
||||||
|
None = 0,
|
||||||
|
Disabled = 0x1
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -203,8 +203,8 @@ namespace Framework.Constants
|
|||||||
CritMeleeRating = 19,
|
CritMeleeRating = 19,
|
||||||
CritRangedRating = 20,
|
CritRangedRating = 20,
|
||||||
CritSpellRating = 21,
|
CritSpellRating = 21,
|
||||||
HitTakenMeleeRating = 22,
|
Corruption = 22,
|
||||||
HitTakenRangedRating = 23,
|
CorruptionResistance = 23,
|
||||||
HitTakenSpellRating = 24,
|
HitTakenSpellRating = 24,
|
||||||
CritTakenMeleeRating = 25,
|
CritTakenMeleeRating = 25,
|
||||||
CritTakenRangedRating = 26,
|
CritTakenRangedRating = 26,
|
||||||
@@ -239,15 +239,15 @@ namespace Framework.Constants
|
|||||||
NatureResistance = 55,
|
NatureResistance = 55,
|
||||||
ArcaneResistance = 56,
|
ArcaneResistance = 56,
|
||||||
PvpPower = 57,
|
PvpPower = 57,
|
||||||
CrAmplify = 58,
|
Unused0 = 58,
|
||||||
CrMultistrike = 59,
|
Unused1 = 59,
|
||||||
CrReadiness = 60,
|
Unused3 = 60,
|
||||||
CrSpeed = 61,
|
CrSpeed = 61,
|
||||||
CrLifesteal = 62,
|
CrLifesteal = 62,
|
||||||
CrAvoidance = 63,
|
CrAvoidance = 63,
|
||||||
CrSturdiness = 64,
|
CrSturdiness = 64,
|
||||||
CrUnused7 = 65,
|
CrUnused7 = 65,
|
||||||
CrCleave = 66,
|
Unused27 = 66,
|
||||||
CrUnused9 = 67,
|
CrUnused9 = 67,
|
||||||
CrUnused10 = 68,
|
CrUnused10 = 68,
|
||||||
CrUnused11 = 69,
|
CrUnused11 = 69,
|
||||||
|
|||||||
@@ -401,8 +401,8 @@ namespace Framework.Constants
|
|||||||
CritMelee = 8,
|
CritMelee = 8,
|
||||||
CritRanged = 9,
|
CritRanged = 9,
|
||||||
CritSpell = 10,
|
CritSpell = 10,
|
||||||
Multistrike = 11,
|
Corruption = 11,
|
||||||
Readiness = 12,
|
CorruptionResistance = 12,
|
||||||
Speed = 13,
|
Speed = 13,
|
||||||
ResilienceCritTaken = 14,
|
ResilienceCritTaken = 14,
|
||||||
ResiliencePlayerDamage = 15,
|
ResiliencePlayerDamage = 15,
|
||||||
|
|||||||
@@ -257,6 +257,9 @@ namespace Framework.Database
|
|||||||
PrepareStatement(HotfixStatements.SEL_CONVERSATION_LINE, "SELECT ID, BroadcastTextID, SpellVisualKitID, AdditionalDuration, NextConversationLineID, " +
|
PrepareStatement(HotfixStatements.SEL_CONVERSATION_LINE, "SELECT ID, BroadcastTextID, SpellVisualKitID, AdditionalDuration, NextConversationLineID, " +
|
||||||
"AnimKitID, SpeechType, StartAnimation, EndAnimation FROM conversation_line");
|
"AnimKitID, SpeechType, StartAnimation, EndAnimation FROM conversation_line");
|
||||||
|
|
||||||
|
// CorruptionEffects.db2
|
||||||
|
PrepareStatement(HotfixStatements.SEL_CORRUPTION_EFFECTS, "SELECT ID, MinCorruption, Aura, PlayerConditionID, Flags FROM corruption_effects");
|
||||||
|
|
||||||
// CreatureDisplayInfo.db2
|
// CreatureDisplayInfo.db2
|
||||||
PrepareStatement(HotfixStatements.SEL_CREATURE_DISPLAY_INFO, "SELECT ID, ModelID, SoundID, SizeClass, CreatureModelScale, CreatureModelAlpha, BloodID, " +
|
PrepareStatement(HotfixStatements.SEL_CREATURE_DISPLAY_INFO, "SELECT ID, ModelID, SoundID, SizeClass, CreatureModelScale, CreatureModelAlpha, BloodID, " +
|
||||||
"ExtendedDisplayInfoID, NPCSoundID, ParticleColorID, PortraitCreatureDisplayInfoID, PortraitTextureFileDataID, ObjectEffectPackageID, " +
|
"ExtendedDisplayInfoID, NPCSoundID, ParticleColorID, PortraitCreatureDisplayInfoID, PortraitTextureFileDataID, ObjectEffectPackageID, " +
|
||||||
@@ -1260,6 +1263,8 @@ namespace Framework.Database
|
|||||||
|
|
||||||
SEL_CONVERSATION_LINE,
|
SEL_CONVERSATION_LINE,
|
||||||
|
|
||||||
|
SEL_CORRUPTION_EFFECTS,
|
||||||
|
|
||||||
SEL_CREATURE_DISPLAY_INFO,
|
SEL_CREATURE_DISPLAY_INFO,
|
||||||
|
|
||||||
SEL_CREATURE_DISPLAY_INFO_EXTRA,
|
SEL_CREATURE_DISPLAY_INFO_EXTRA,
|
||||||
|
|||||||
@@ -91,6 +91,7 @@ namespace Game.DataStorage
|
|||||||
ContentTuningStorage = DBReader.Read<ContentTuningRecord>("ContentTuning.db2", HotfixStatements.SEL_CONTENT_TUNING);
|
ContentTuningStorage = DBReader.Read<ContentTuningRecord>("ContentTuning.db2", HotfixStatements.SEL_CONTENT_TUNING);
|
||||||
ContentTuningXExpectedStorage = DBReader.Read<ContentTuningXExpectedRecord>("ContentTuningXExpected.db2", HotfixStatements.SEL_CONTENT_TUNING_X_EXPECTED);
|
ContentTuningXExpectedStorage = DBReader.Read<ContentTuningXExpectedRecord>("ContentTuningXExpected.db2", HotfixStatements.SEL_CONTENT_TUNING_X_EXPECTED);
|
||||||
ConversationLineStorage = DBReader.Read<ConversationLineRecord>("ConversationLine.db2", HotfixStatements.SEL_CONVERSATION_LINE);
|
ConversationLineStorage = DBReader.Read<ConversationLineRecord>("ConversationLine.db2", HotfixStatements.SEL_CONVERSATION_LINE);
|
||||||
|
CorruptionEffectsStorage = DBReader.Read<CorruptionEffectsRecord>("CorruptionEffects.db2", HotfixStatements.SEL_CORRUPTION_EFFECTS);
|
||||||
CreatureDisplayInfoStorage = DBReader.Read<CreatureDisplayInfoRecord>("CreatureDisplayInfo.db2", HotfixStatements.SEL_CREATURE_DISPLAY_INFO);
|
CreatureDisplayInfoStorage = DBReader.Read<CreatureDisplayInfoRecord>("CreatureDisplayInfo.db2", HotfixStatements.SEL_CREATURE_DISPLAY_INFO);
|
||||||
CreatureDisplayInfoExtraStorage = DBReader.Read<CreatureDisplayInfoExtraRecord>("CreatureDisplayInfoExtra.db2", HotfixStatements.SEL_CREATURE_DISPLAY_INFO_EXTRA);
|
CreatureDisplayInfoExtraStorage = DBReader.Read<CreatureDisplayInfoExtraRecord>("CreatureDisplayInfoExtra.db2", HotfixStatements.SEL_CREATURE_DISPLAY_INFO_EXTRA);
|
||||||
CreatureFamilyStorage = DBReader.Read<CreatureFamilyRecord>("CreatureFamily.db2", HotfixStatements.SEL_CREATURE_FAMILY, HotfixStatements.SEL_CREATURE_FAMILY_LOCALE);
|
CreatureFamilyStorage = DBReader.Read<CreatureFamilyRecord>("CreatureFamily.db2", HotfixStatements.SEL_CREATURE_FAMILY, HotfixStatements.SEL_CREATURE_FAMILY_LOCALE);
|
||||||
@@ -432,6 +433,7 @@ namespace Game.DataStorage
|
|||||||
public static DB6Storage<ContentTuningRecord> ContentTuningStorage;
|
public static DB6Storage<ContentTuningRecord> ContentTuningStorage;
|
||||||
public static DB6Storage<ContentTuningXExpectedRecord> ContentTuningXExpectedStorage;
|
public static DB6Storage<ContentTuningXExpectedRecord> ContentTuningXExpectedStorage;
|
||||||
public static DB6Storage<ConversationLineRecord> ConversationLineStorage;
|
public static DB6Storage<ConversationLineRecord> ConversationLineStorage;
|
||||||
|
public static DB6Storage<CorruptionEffectsRecord> CorruptionEffectsStorage;
|
||||||
public static DB6Storage<CreatureDisplayInfoRecord> CreatureDisplayInfoStorage;
|
public static DB6Storage<CreatureDisplayInfoRecord> CreatureDisplayInfoStorage;
|
||||||
public static DB6Storage<CreatureDisplayInfoExtraRecord> CreatureDisplayInfoExtraStorage;
|
public static DB6Storage<CreatureDisplayInfoExtraRecord> CreatureDisplayInfoExtraStorage;
|
||||||
public static DB6Storage<CreatureFamilyRecord> CreatureFamilyStorage;
|
public static DB6Storage<CreatureFamilyRecord> CreatureFamilyStorage;
|
||||||
|
|||||||
@@ -663,7 +663,6 @@ namespace Game.DataStorage
|
|||||||
hotfixRecord.RecordID = recordId;
|
hotfixRecord.RecordID = recordId;
|
||||||
hotfixRecord.HotfixID = id;
|
hotfixRecord.HotfixID = id;
|
||||||
_hotfixData.Add(hotfixRecord);
|
_hotfixData.Add(hotfixRecord);
|
||||||
++_hotfixCount;
|
|
||||||
deletedRecords[Tuple.Create(tableHash, recordId)] = deleted;
|
deletedRecords[Tuple.Create(tableHash, recordId)] = deleted;
|
||||||
|
|
||||||
++count;
|
++count;
|
||||||
@@ -711,7 +710,8 @@ namespace Game.DataStorage
|
|||||||
Log.outInfo(LogFilter.ServerLoading, $"Loaded {_hotfixBlob.Count} hotfix blob records in {Time.GetMSTimeDiffToNow(oldMSTime)} ms");
|
Log.outInfo(LogFilter.ServerLoading, $"Loaded {_hotfixBlob.Count} hotfix blob records in {Time.GetMSTimeDiffToNow(oldMSTime)} ms");
|
||||||
}
|
}
|
||||||
|
|
||||||
public uint GetHotfixCount() { return _hotfixCount; }
|
public uint GetHotfixCount() { return (uint)_hotfixData.Count; }
|
||||||
|
|
||||||
public List<HotfixRecord> GetHotfixData() { return _hotfixData; }
|
public List<HotfixRecord> GetHotfixData() { return _hotfixData; }
|
||||||
|
|
||||||
public byte[] GetHotfixBlobData(uint tableHash, int recordId)
|
public byte[] GetHotfixBlobData(uint tableHash, int recordId)
|
||||||
@@ -2054,7 +2054,6 @@ namespace Game.DataStorage
|
|||||||
}
|
}
|
||||||
|
|
||||||
Dictionary<uint, IDB2Storage> _storage = new Dictionary<uint, IDB2Storage>();
|
Dictionary<uint, IDB2Storage> _storage = new Dictionary<uint, IDB2Storage>();
|
||||||
uint _hotfixCount = 0;
|
|
||||||
List<HotfixRecord> _hotfixData = new List<HotfixRecord>();
|
List<HotfixRecord> _hotfixData = new List<HotfixRecord>();
|
||||||
Dictionary<Tuple<uint, int>, byte[]> _hotfixBlob = new Dictionary<Tuple<uint, int>, byte[]>();
|
Dictionary<Tuple<uint, int>, byte[]> _hotfixBlob = new Dictionary<Tuple<uint, int>, byte[]>();
|
||||||
|
|
||||||
|
|||||||
@@ -240,6 +240,15 @@ namespace Game.DataStorage
|
|||||||
public byte EndAnimation;
|
public byte EndAnimation;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public sealed class CorruptionEffectsRecord
|
||||||
|
{
|
||||||
|
public uint Id;
|
||||||
|
public float MinCorruption;
|
||||||
|
public uint Aura;
|
||||||
|
public int PlayerConditionID;
|
||||||
|
public int Flags;
|
||||||
|
}
|
||||||
|
|
||||||
public sealed class CreatureDisplayInfoRecord
|
public sealed class CreatureDisplayInfoRecord
|
||||||
{
|
{
|
||||||
public uint Id;
|
public uint Id;
|
||||||
|
|||||||
@@ -62,8 +62,8 @@ namespace Game.DataStorage
|
|||||||
public float CritMelee;
|
public float CritMelee;
|
||||||
public float CritRanged;
|
public float CritRanged;
|
||||||
public float CritSpell;
|
public float CritSpell;
|
||||||
public float MultiStrike;
|
public float Corruption;
|
||||||
public float Readiness;
|
public float CorruptionResistance;
|
||||||
public float Speed;
|
public float Speed;
|
||||||
public float ResilienceCritTaken;
|
public float ResilienceCritTaken;
|
||||||
public float ResiliencePlayerDamage;
|
public float ResiliencePlayerDamage;
|
||||||
|
|||||||
@@ -1810,6 +1810,15 @@ namespace Game.Entities
|
|||||||
public int GetItemStatValue(uint index, Player owner)
|
public int GetItemStatValue(uint index, Player owner)
|
||||||
{
|
{
|
||||||
Cypher.Assert(index < ItemConst.MaxStats);
|
Cypher.Assert(index < ItemConst.MaxStats);
|
||||||
|
switch ((ItemModType)GetItemStatType(index))
|
||||||
|
{
|
||||||
|
case ItemModType.Corruption:
|
||||||
|
case ItemModType.CorruptionResistance:
|
||||||
|
return _bonusData.ItemStatAllocation[index];
|
||||||
|
default:
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
uint itemLevel = GetItemLevel(owner);
|
uint itemLevel = GetItemLevel(owner);
|
||||||
uint randomPropPoints = ItemEnchantmentManager.GetRandomPropertyPoints(itemLevel, GetQuality(), GetTemplate().GetInventoryType(), GetTemplate().GetSubClass());
|
uint randomPropPoints = ItemEnchantmentManager.GetRandomPropertyPoints(itemLevel, GetQuality(), GetTemplate().GetInventoryType(), GetTemplate().GetSubClass());
|
||||||
if (randomPropPoints != 0)
|
if (randomPropPoints != 0)
|
||||||
|
|||||||
@@ -4183,14 +4183,11 @@ namespace Game.Entities
|
|||||||
case ItemModType.PvpPower:
|
case ItemModType.PvpPower:
|
||||||
ApplyRatingMod(CombatRating.PvpPower, val, apply);
|
ApplyRatingMod(CombatRating.PvpPower, val, apply);
|
||||||
break;
|
break;
|
||||||
case ItemModType.CrAmplify:
|
case ItemModType.Corruption:
|
||||||
ApplyRatingMod(CombatRating.Amplify, val, apply);
|
ApplyRatingMod(CombatRating.Corruption, val, apply);
|
||||||
break;
|
break;
|
||||||
case ItemModType.CrMultistrike:
|
case ItemModType.CorruptionResistance:
|
||||||
ApplyRatingMod(CombatRating.Multistrike, val, apply);
|
ApplyRatingMod(CombatRating.CorruptionResistance, val, apply);
|
||||||
break;
|
|
||||||
case ItemModType.CrReadiness:
|
|
||||||
ApplyRatingMod(CombatRating.Readiness, (int)(val * combatRatingMultiplier), apply);
|
|
||||||
break;
|
break;
|
||||||
case ItemModType.CrSpeed:
|
case ItemModType.CrSpeed:
|
||||||
ApplyRatingMod(CombatRating.Speed, (int)(val * combatRatingMultiplier), apply);
|
ApplyRatingMod(CombatRating.Speed, (int)(val * combatRatingMultiplier), apply);
|
||||||
@@ -4204,15 +4201,6 @@ namespace Game.Entities
|
|||||||
case ItemModType.CrSturdiness:
|
case ItemModType.CrSturdiness:
|
||||||
ApplyRatingMod(CombatRating.Studiness, (int)(val * combatRatingMultiplier), apply);
|
ApplyRatingMod(CombatRating.Studiness, (int)(val * combatRatingMultiplier), apply);
|
||||||
break;
|
break;
|
||||||
case ItemModType.CrUnused7:
|
|
||||||
ApplyRatingMod(CombatRating.Unused7, val, apply);
|
|
||||||
break;
|
|
||||||
case ItemModType.CrCleave:
|
|
||||||
ApplyRatingMod(CombatRating.Cleave, val, apply);
|
|
||||||
break;
|
|
||||||
case ItemModType.CrUnused12:
|
|
||||||
ApplyRatingMod(CombatRating.Unused12, val, apply);
|
|
||||||
break;
|
|
||||||
case ItemModType.AgiStrInt:
|
case ItemModType.AgiStrInt:
|
||||||
HandleStatFlatModifier(UnitMods.StatAgility, UnitModifierFlatType.Base, val, apply);
|
HandleStatFlatModifier(UnitMods.StatAgility, UnitModifierFlatType.Base, val, apply);
|
||||||
HandleStatFlatModifier(UnitMods.StatStrength, UnitModifierFlatType.Base, val, apply);
|
HandleStatFlatModifier(UnitMods.StatStrength, UnitModifierFlatType.Base, val, apply);
|
||||||
|
|||||||
@@ -1377,6 +1377,10 @@ namespace Game.Entities
|
|||||||
if (affectStats)
|
if (affectStats)
|
||||||
UpdateSpellCritChance();
|
UpdateSpellCritChance();
|
||||||
break;
|
break;
|
||||||
|
case CombatRating.Corruption:
|
||||||
|
case CombatRating.CorruptionResistance:
|
||||||
|
UpdateCorruption();
|
||||||
|
break;
|
||||||
case CombatRating.HasteMelee:
|
case CombatRating.HasteMelee:
|
||||||
case CombatRating.HasteRanged:
|
case CombatRating.HasteRanged:
|
||||||
case CombatRating.HasteSpell:
|
case CombatRating.HasteSpell:
|
||||||
@@ -1489,6 +1493,34 @@ namespace Game.Entities
|
|||||||
SetUpdateFieldStatValue(m_values.ModifyValue(m_activePlayerData).ModifyValue(m_activePlayerData.ModHealingDonePercent), value);
|
SetUpdateFieldStatValue(m_values.ModifyValue(m_activePlayerData).ModifyValue(m_activePlayerData.ModHealingDonePercent), value);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void UpdateCorruption()
|
||||||
|
{
|
||||||
|
float effectiveCorruption = GetRatingBonusValue(CombatRating.Corruption) - GetRatingBonusValue(CombatRating.CorruptionResistance);
|
||||||
|
foreach (var corruptionEffect in CliDB.CorruptionEffectsStorage.Values)
|
||||||
|
{
|
||||||
|
if (((CorruptionEffectsFlag)corruptionEffect.Flags).HasAnyFlag(CorruptionEffectsFlag.Disabled))
|
||||||
|
continue;
|
||||||
|
|
||||||
|
if (effectiveCorruption < corruptionEffect.MinCorruption)
|
||||||
|
{
|
||||||
|
RemoveAura(corruptionEffect.Aura);
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
PlayerConditionRecord playerCondition = CliDB.PlayerConditionStorage.LookupByKey(corruptionEffect.PlayerConditionID);
|
||||||
|
if (playerCondition != null)
|
||||||
|
{
|
||||||
|
if (!ConditionManager.IsPlayerMeetingCondition(this, playerCondition))
|
||||||
|
{
|
||||||
|
RemoveAura(corruptionEffect.Aura);
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
CastSpell(this, corruptionEffect.Aura, true);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
void UpdateArmorPenetration(int amount)
|
void UpdateArmorPenetration(int amount)
|
||||||
{
|
{
|
||||||
// Store Rating Value
|
// Store Rating Value
|
||||||
@@ -1702,10 +1734,10 @@ namespace Game.Entities
|
|||||||
return row.CritRanged;
|
return row.CritRanged;
|
||||||
case CombatRating.CritSpell:
|
case CombatRating.CritSpell:
|
||||||
return row.CritSpell;
|
return row.CritSpell;
|
||||||
case CombatRating.Multistrike:
|
case CombatRating.Corruption:
|
||||||
return row.MultiStrike;
|
return row.Corruption;
|
||||||
case CombatRating.Readiness:
|
case CombatRating.CorruptionResistance:
|
||||||
return row.Readiness;
|
return row.CorruptionResistance;
|
||||||
case CombatRating.Speed:
|
case CombatRating.Speed:
|
||||||
return row.Speed;
|
return row.Speed;
|
||||||
case CombatRating.ResilienceCritTaken:
|
case CombatRating.ResilienceCritTaken:
|
||||||
|
|||||||
@@ -3820,7 +3820,7 @@ namespace Game.Spells
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (IsAura(AuraType.ModRating))
|
if (IsAura(AuraType.ModRating) && (MiscValue & ((1 << (int)CombatRating.Corruption) | 1 << ((int)CombatRating.CorruptionResistance))) == 0)
|
||||||
{
|
{
|
||||||
GtGenericMultByILvlRecord ratingMult = CliDB.CombatRatingsMultByILvlGameTable.GetRow(effectiveItemLevel);
|
GtGenericMultByILvlRecord ratingMult = CliDB.CombatRatingsMultByILvlGameTable.GetRow(effectiveItemLevel);
|
||||||
if (ratingMult != null)
|
if (ratingMult != null)
|
||||||
|
|||||||
Reference in New Issue
Block a user