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,
|
||||
}
|
||||
|
||||
public enum CorruptionEffectsFlag
|
||||
{
|
||||
None = 0,
|
||||
Disabled = 0x1
|
||||
}
|
||||
}
|
||||
|
||||
@@ -203,8 +203,8 @@ namespace Framework.Constants
|
||||
CritMeleeRating = 19,
|
||||
CritRangedRating = 20,
|
||||
CritSpellRating = 21,
|
||||
HitTakenMeleeRating = 22,
|
||||
HitTakenRangedRating = 23,
|
||||
Corruption = 22,
|
||||
CorruptionResistance = 23,
|
||||
HitTakenSpellRating = 24,
|
||||
CritTakenMeleeRating = 25,
|
||||
CritTakenRangedRating = 26,
|
||||
@@ -239,15 +239,15 @@ namespace Framework.Constants
|
||||
NatureResistance = 55,
|
||||
ArcaneResistance = 56,
|
||||
PvpPower = 57,
|
||||
CrAmplify = 58,
|
||||
CrMultistrike = 59,
|
||||
CrReadiness = 60,
|
||||
Unused0 = 58,
|
||||
Unused1 = 59,
|
||||
Unused3 = 60,
|
||||
CrSpeed = 61,
|
||||
CrLifesteal = 62,
|
||||
CrAvoidance = 63,
|
||||
CrSturdiness = 64,
|
||||
CrUnused7 = 65,
|
||||
CrCleave = 66,
|
||||
Unused27 = 66,
|
||||
CrUnused9 = 67,
|
||||
CrUnused10 = 68,
|
||||
CrUnused11 = 69,
|
||||
|
||||
@@ -401,8 +401,8 @@ namespace Framework.Constants
|
||||
CritMelee = 8,
|
||||
CritRanged = 9,
|
||||
CritSpell = 10,
|
||||
Multistrike = 11,
|
||||
Readiness = 12,
|
||||
Corruption = 11,
|
||||
CorruptionResistance = 12,
|
||||
Speed = 13,
|
||||
ResilienceCritTaken = 14,
|
||||
ResiliencePlayerDamage = 15,
|
||||
|
||||
@@ -257,6 +257,9 @@ namespace Framework.Database
|
||||
PrepareStatement(HotfixStatements.SEL_CONVERSATION_LINE, "SELECT ID, BroadcastTextID, SpellVisualKitID, AdditionalDuration, NextConversationLineID, " +
|
||||
"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
|
||||
PrepareStatement(HotfixStatements.SEL_CREATURE_DISPLAY_INFO, "SELECT ID, ModelID, SoundID, SizeClass, CreatureModelScale, CreatureModelAlpha, BloodID, " +
|
||||
"ExtendedDisplayInfoID, NPCSoundID, ParticleColorID, PortraitCreatureDisplayInfoID, PortraitTextureFileDataID, ObjectEffectPackageID, " +
|
||||
@@ -1260,6 +1263,8 @@ namespace Framework.Database
|
||||
|
||||
SEL_CONVERSATION_LINE,
|
||||
|
||||
SEL_CORRUPTION_EFFECTS,
|
||||
|
||||
SEL_CREATURE_DISPLAY_INFO,
|
||||
|
||||
SEL_CREATURE_DISPLAY_INFO_EXTRA,
|
||||
|
||||
@@ -91,6 +91,7 @@ namespace Game.DataStorage
|
||||
ContentTuningStorage = DBReader.Read<ContentTuningRecord>("ContentTuning.db2", HotfixStatements.SEL_CONTENT_TUNING);
|
||||
ContentTuningXExpectedStorage = DBReader.Read<ContentTuningXExpectedRecord>("ContentTuningXExpected.db2", HotfixStatements.SEL_CONTENT_TUNING_X_EXPECTED);
|
||||
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);
|
||||
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);
|
||||
@@ -432,6 +433,7 @@ namespace Game.DataStorage
|
||||
public static DB6Storage<ContentTuningRecord> ContentTuningStorage;
|
||||
public static DB6Storage<ContentTuningXExpectedRecord> ContentTuningXExpectedStorage;
|
||||
public static DB6Storage<ConversationLineRecord> ConversationLineStorage;
|
||||
public static DB6Storage<CorruptionEffectsRecord> CorruptionEffectsStorage;
|
||||
public static DB6Storage<CreatureDisplayInfoRecord> CreatureDisplayInfoStorage;
|
||||
public static DB6Storage<CreatureDisplayInfoExtraRecord> CreatureDisplayInfoExtraStorage;
|
||||
public static DB6Storage<CreatureFamilyRecord> CreatureFamilyStorage;
|
||||
|
||||
@@ -663,7 +663,6 @@ namespace Game.DataStorage
|
||||
hotfixRecord.RecordID = recordId;
|
||||
hotfixRecord.HotfixID = id;
|
||||
_hotfixData.Add(hotfixRecord);
|
||||
++_hotfixCount;
|
||||
deletedRecords[Tuple.Create(tableHash, recordId)] = deleted;
|
||||
|
||||
++count;
|
||||
@@ -711,7 +710,8 @@ namespace Game.DataStorage
|
||||
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 byte[] GetHotfixBlobData(uint tableHash, int recordId)
|
||||
@@ -2054,7 +2054,6 @@ namespace Game.DataStorage
|
||||
}
|
||||
|
||||
Dictionary<uint, IDB2Storage> _storage = new Dictionary<uint, IDB2Storage>();
|
||||
uint _hotfixCount = 0;
|
||||
List<HotfixRecord> _hotfixData = new List<HotfixRecord>();
|
||||
Dictionary<Tuple<uint, int>, byte[]> _hotfixBlob = new Dictionary<Tuple<uint, int>, byte[]>();
|
||||
|
||||
|
||||
@@ -240,6 +240,15 @@ namespace Game.DataStorage
|
||||
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 uint Id;
|
||||
|
||||
@@ -62,8 +62,8 @@ namespace Game.DataStorage
|
||||
public float CritMelee;
|
||||
public float CritRanged;
|
||||
public float CritSpell;
|
||||
public float MultiStrike;
|
||||
public float Readiness;
|
||||
public float Corruption;
|
||||
public float CorruptionResistance;
|
||||
public float Speed;
|
||||
public float ResilienceCritTaken;
|
||||
public float ResiliencePlayerDamage;
|
||||
|
||||
@@ -1810,6 +1810,15 @@ namespace Game.Entities
|
||||
public int GetItemStatValue(uint index, Player owner)
|
||||
{
|
||||
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 randomPropPoints = ItemEnchantmentManager.GetRandomPropertyPoints(itemLevel, GetQuality(), GetTemplate().GetInventoryType(), GetTemplate().GetSubClass());
|
||||
if (randomPropPoints != 0)
|
||||
|
||||
@@ -4183,14 +4183,11 @@ namespace Game.Entities
|
||||
case ItemModType.PvpPower:
|
||||
ApplyRatingMod(CombatRating.PvpPower, val, apply);
|
||||
break;
|
||||
case ItemModType.CrAmplify:
|
||||
ApplyRatingMod(CombatRating.Amplify, val, apply);
|
||||
case ItemModType.Corruption:
|
||||
ApplyRatingMod(CombatRating.Corruption, val, apply);
|
||||
break;
|
||||
case ItemModType.CrMultistrike:
|
||||
ApplyRatingMod(CombatRating.Multistrike, val, apply);
|
||||
break;
|
||||
case ItemModType.CrReadiness:
|
||||
ApplyRatingMod(CombatRating.Readiness, (int)(val * combatRatingMultiplier), apply);
|
||||
case ItemModType.CorruptionResistance:
|
||||
ApplyRatingMod(CombatRating.CorruptionResistance, val, apply);
|
||||
break;
|
||||
case ItemModType.CrSpeed:
|
||||
ApplyRatingMod(CombatRating.Speed, (int)(val * combatRatingMultiplier), apply);
|
||||
@@ -4204,15 +4201,6 @@ namespace Game.Entities
|
||||
case ItemModType.CrSturdiness:
|
||||
ApplyRatingMod(CombatRating.Studiness, (int)(val * combatRatingMultiplier), apply);
|
||||
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:
|
||||
HandleStatFlatModifier(UnitMods.StatAgility, UnitModifierFlatType.Base, val, apply);
|
||||
HandleStatFlatModifier(UnitMods.StatStrength, UnitModifierFlatType.Base, val, apply);
|
||||
|
||||
@@ -1377,6 +1377,10 @@ namespace Game.Entities
|
||||
if (affectStats)
|
||||
UpdateSpellCritChance();
|
||||
break;
|
||||
case CombatRating.Corruption:
|
||||
case CombatRating.CorruptionResistance:
|
||||
UpdateCorruption();
|
||||
break;
|
||||
case CombatRating.HasteMelee:
|
||||
case CombatRating.HasteRanged:
|
||||
case CombatRating.HasteSpell:
|
||||
@@ -1489,6 +1493,34 @@ namespace Game.Entities
|
||||
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)
|
||||
{
|
||||
// Store Rating Value
|
||||
@@ -1702,10 +1734,10 @@ namespace Game.Entities
|
||||
return row.CritRanged;
|
||||
case CombatRating.CritSpell:
|
||||
return row.CritSpell;
|
||||
case CombatRating.Multistrike:
|
||||
return row.MultiStrike;
|
||||
case CombatRating.Readiness:
|
||||
return row.Readiness;
|
||||
case CombatRating.Corruption:
|
||||
return row.Corruption;
|
||||
case CombatRating.CorruptionResistance:
|
||||
return row.CorruptionResistance;
|
||||
case CombatRating.Speed:
|
||||
return row.Speed;
|
||||
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);
|
||||
if (ratingMult != null)
|
||||
|
||||
Reference in New Issue
Block a user