Core/Reputation: Implemented "friendship reputation"

Port From (https://github.com/TrinityCore/TrinityCore/commit/80a6347b7a0e8dfbe5e690504ed373f75c4f4c76)
This commit is contained in:
hondacrx
2021-06-04 15:03:52 -04:00
parent 32f4bf4c25
commit 9702bd9097
9 changed files with 322 additions and 91 deletions
+4
View File
@@ -139,6 +139,8 @@ namespace Game.DataStorage
ExpectedStatModStorage = ReadDB2<ExpectedStatModRecord>("ExpectedStatMod.db2", HotfixStatements.SEL_EXPECTED_STAT_MOD);
FactionStorage = ReadDB2<FactionRecord>("Faction.db2", HotfixStatements.SEL_FACTION, HotfixStatements.SEL_FACTION_LOCALE);
FactionTemplateStorage = ReadDB2<FactionTemplateRecord>("FactionTemplate.db2", HotfixStatements.SEL_FACTION_TEMPLATE);
FriendshipRepReactionStorage = ReadDB2<FriendshipRepReactionRecord>("FriendshipRepReaction.db2", HotfixStatements.SEL_FRIENDSHIP_REP_REACTION, HotfixStatements.SEL_FRIENDSHIP_REP_REACTION_LOCALE);
FriendshipReputationStorage = ReadDB2<FriendshipReputationRecord>("FriendshipReputation.db2", HotfixStatements.SEL_FRIENDSHIP_REPUTATION, HotfixStatements.SEL_FRIENDSHIP_REPUTATION_LOCALE);
GameObjectDisplayInfoStorage = ReadDB2<GameObjectDisplayInfoRecord>("GameObjectDisplayInfo.db2", HotfixStatements.SEL_GAMEOBJECT_DISPLAY_INFO);
GameObjectsStorage = ReadDB2<GameObjectsRecord>("GameObjects.db2", HotfixStatements.SEL_GAMEOBJECTS, HotfixStatements.SEL_GAMEOBJECTS_LOCALE);
GarrAbilityStorage = ReadDB2<GarrAbilityRecord>("GarrAbility.db2", HotfixStatements.SEL_GARR_ABILITY, HotfixStatements.SEL_GARR_ABILITY_LOCALE);
@@ -503,6 +505,8 @@ namespace Game.DataStorage
public static DB6Storage<ExpectedStatModRecord> ExpectedStatModStorage;
public static DB6Storage<FactionRecord> FactionStorage;
public static DB6Storage<FactionTemplateRecord> FactionTemplateStorage;
public static DB6Storage<FriendshipRepReactionRecord> FriendshipRepReactionStorage;
public static DB6Storage<FriendshipReputationRecord> FriendshipReputationStorage;
public static DB6Storage<GameObjectsRecord> GameObjectsStorage;
public static DB6Storage<GameObjectDisplayInfoRecord> GameObjectDisplayInfoStorage;
public static DB6Storage<GarrAbilityRecord> GarrAbilityStorage;
+20
View File
@@ -263,6 +263,12 @@ namespace Game.DataStorage
if (faction.ParentFactionID != 0)
_factionTeams.Add(faction.ParentFactionID, faction.Id);
foreach (FriendshipRepReactionRecord friendshipRepReaction in CliDB.FriendshipRepReactionStorage.Values)
_friendshipRepReactions.Add(friendshipRepReaction.FriendshipRepID, friendshipRepReaction);
foreach (var key in _friendshipRepReactions.Keys)
_friendshipRepReactions[key].Sort(new FriendshipRepReactionRecordComparer());
foreach (GameObjectDisplayInfoRecord gameObjectDisplayInfo in CliDB.GameObjectDisplayInfoStorage.Values)
{
if (gameObjectDisplayInfo.GeoBoxMax.X < gameObjectDisplayInfo.GeoBoxMin.X)
@@ -1306,6 +1312,11 @@ namespace Game.DataStorage
return _factionTeams.LookupByKey(faction);
}
public List<FriendshipRepReactionRecord> GetFriendshipRepReactions(uint friendshipRepID)
{
return _friendshipRepReactions.LookupByKey(friendshipRepID);
}
public uint GetGlobalCurveId(GlobalCurve globalCurveType)
{
foreach (var globalCurveEntry in CliDB.GlobalCurveStorage.Values)
@@ -2241,6 +2252,7 @@ namespace Game.DataStorage
Dictionary<Tuple<uint, int>, ExpectedStatRecord> _expectedStatsByLevel = new();
MultiMap<uint, ExpectedStatModRecord> _expectedStatModsByContentTuning = new();
MultiMap<uint, uint> _factionTeams = new();
MultiMap<uint, FriendshipRepReactionRecord> _friendshipRepReactions = new();
Dictionary<uint, HeirloomRecord> _heirlooms = new();
MultiMap<uint, uint> _glyphBindableSpells = new();
MultiMap<uint, uint> _glyphRequiredSpecs = new();
@@ -2494,6 +2506,14 @@ namespace Game.DataStorage
}
}
class FriendshipRepReactionRecordComparer : IComparer<FriendshipRepReactionRecord>
{
public int Compare(FriendshipRepReactionRecord left, FriendshipRepReactionRecord right)
{
return left.ReactionThreshold.CompareTo(right.ReactionThreshold);
}
}
class MountTypeXCapabilityRecordComparer : IComparer<MountTypeXCapabilityRecord>
{
public int Compare(MountTypeXCapabilityRecord left, MountTypeXCapabilityRecord right)
@@ -99,4 +99,23 @@ namespace Game.DataStorage
}
public bool IsContestedGuardFaction() { return (Flags & (ushort)FactionTemplateFlags.ContestedGuard) != 0; }
}
public sealed class FriendshipRepReactionRecord
{
public uint Id;
public LocalizedString Reaction;
public uint FriendshipRepID;
public ushort ReactionThreshold;
}
public sealed class FriendshipReputationRecord
{
public LocalizedString Description;
public LocalizedString StandingModified;
public LocalizedString StandingChanged;
public uint Id;
public int FactionID;
public int TextureFileID;
public FriendshipReputationFlags Flags;
}
}