From 9702bd9097fc11ef99d2881c2374f2ced012d4aa Mon Sep 17 00:00:00 2001 From: hondacrx Date: Fri, 4 Jun 2021 15:03:52 -0400 Subject: [PATCH] Core/Reputation: Implemented "friendship reputation" Port From (https://github.com/TrinityCore/TrinityCore/commit/80a6347b7a0e8dfbe5e690504ed373f75c4f4c76) --- Source/Framework/Constants/CliDBConst.cs | 9 + .../Database/Databases/HotfixDatabase.cs | 15 ++ Source/Game/Chat/Commands/ModifyCommands.cs | 81 +++++---- Source/Game/DataStorage/CliDB.cs | 4 + Source/Game/DataStorage/DB2Manager.cs | 20 +++ Source/Game/DataStorage/Structs/F_Records.cs | 19 ++ Source/Game/Entities/Player/Player.cs | 10 ++ Source/Game/Reputation/ReputationManager.cs | 167 ++++++++++++------ .../master/2021_06_04_00_hotfixes.sql | 88 +++++++++ 9 files changed, 322 insertions(+), 91 deletions(-) create mode 100644 sql/updates/hotfixes/master/2021_06_04_00_hotfixes.sql diff --git a/Source/Framework/Constants/CliDBConst.cs b/Source/Framework/Constants/CliDBConst.cs index 5d20e294b..67b2dfb7c 100644 --- a/Source/Framework/Constants/CliDBConst.cs +++ b/Source/Framework/Constants/CliDBConst.cs @@ -2165,6 +2165,15 @@ namespace Framework.Constants Disabled = 0x1 } + public enum FriendshipReputationFlags : int + { + NoFXOnReactionChange = 0x01, + NoLogTextOnRepGain = 0x02, + NoLogTextOnReactionChange = 0x04, + ShowRepGainandReactionChangeForHiddenFaction = 0x08, + NoRepGainModifiers = 0x10 + } + public enum GlobalCurve { CritDiminishing = 0, diff --git a/Source/Framework/Database/Databases/HotfixDatabase.cs b/Source/Framework/Database/Databases/HotfixDatabase.cs index 6eed9e2c3..3c4365f37 100644 --- a/Source/Framework/Database/Databases/HotfixDatabase.cs +++ b/Source/Framework/Database/Databases/HotfixDatabase.cs @@ -405,6 +405,15 @@ namespace Framework.Database PrepareStatement(HotfixStatements.SEL_FACTION_TEMPLATE, "SELECT ID, Faction, Flags, FactionGroup, FriendGroup, EnemyGroup, Enemies1, Enemies2, Enemies3, " + "Enemies4, Friend1, Friend2, Friend3, Friend4 FROM faction_template"); + // FriendshipRepReaction.db2 + PrepareStatement(HotfixStatements.SEL_FRIENDSHIP_REP_REACTION, "SELECT ID, Reaction, FriendshipRepID, ReactionThreshold FROM friendship_rep_reaction"); + PrepareStatement(HotfixStatements.SEL_FRIENDSHIP_REP_REACTION_LOCALE, "SELECT ID, Reaction_lang FROM friendship_rep_reaction_locale WHERE locale = ?"); + + // FriendshipReputation.db2 + PrepareStatement(HotfixStatements.SEL_FRIENDSHIP_REPUTATION, "SELECT Description, StandingModified, StandingChanged, ID, FactionID, TextureFileID, Flags FROM friendship_reputation"); + PrepareStatement(HotfixStatements.SEL_FRIENDSHIP_REPUTATION_LOCALE, "SELECT ID, Description_lang, StandingModified_lang, StandingChanged_lang FROM friendship_reputation_locale WHERE locale = ?"); + + // GameobjectDisplayInfo.db2 PrepareStatement(HotfixStatements.SEL_GAMEOBJECT_DISPLAY_INFO, "SELECT ID, GeoBoxMinX, GeoBoxMinY, GeoBoxMinZ, GeoBoxMaxX, GeoBoxMaxY, GeoBoxMaxZ, " + "FileDataID, ObjectEffectPackageID, OverrideLootEffectScale, OverrideNameScale FROM gameobject_display_info"); @@ -1376,6 +1385,12 @@ namespace Framework.Database SEL_FACTION_TEMPLATE, + SEL_FRIENDSHIP_REP_REACTION, + SEL_FRIENDSHIP_REP_REACTION_LOCALE, + + SEL_FRIENDSHIP_REPUTATION, + SEL_FRIENDSHIP_REPUTATION_LOCALE, + SEL_GAMEOBJECT_DISPLAY_INFO, SEL_GAMEOBJECTS, diff --git a/Source/Game/Chat/Commands/ModifyCommands.cs b/Source/Game/Chat/Commands/ModifyCommands.cs index ba5c43a67..0379bce46 100644 --- a/Source/Game/Chat/Commands/ModifyCommands.cs +++ b/Source/Game/Chat/Commands/ModifyCommands.cs @@ -393,42 +393,7 @@ namespace Game.Chat if (factionId == 0 || !int.TryParse(rankTxt, out int amount)) return false; - if ((amount == 0) && !(amount < 0) && !rankTxt.IsNumber()) - { - string rankStr = rankTxt.ToLower(); - - int r = 0; - amount = -42000; - for (; r < (int)ReputationRank.Max; ++r) - { - string rank = handler.GetCypherString(ReputationMgr.ReputationRankStrIndex[r]); - if (string.IsNullOrEmpty(rank)) - continue; - - if (rank.Equals(rankStr)) - { - string deltaTxt = args.NextString(); - if (!string.IsNullOrEmpty(deltaTxt)) - { - if (!int.TryParse(deltaTxt, out int delta) || delta < 0 || (delta > ReputationMgr.PointsInRank[r] - 1)) - { - handler.SendSysMessage(CypherStrings.CommandFactionDelta, (ReputationMgr.PointsInRank[r] - 1)); - return false; - } - amount += delta; - } - break; - } - amount += ReputationMgr.PointsInRank[r]; - } - if (r >= (int)ReputationRank.Max) - { - handler.SendSysMessage(CypherStrings.CommandFactionInvparam, rankTxt); - return false; - } - } - - FactionRecord factionEntry = CliDB.FactionStorage.LookupByKey(factionId); + var factionEntry = CliDB.FactionStorage.LookupByKey(factionId); if (factionEntry == null) { handler.SendSysMessage(CypherStrings.CommandFactionUnknown, factionId); @@ -441,6 +406,50 @@ namespace Game.Chat return false; } + // try to find rank by name + if ((amount == 0) && !(amount < 0) && !rankTxt.IsNumber()) + { + string rankStr = rankTxt.ToLower(); + + int i = 0; + int r = 0; + + for (; i != ReputationMgr.ReputationRankThresholds.Length - 1; ++i, ++r) + { + string rank = handler.GetCypherString(ReputationMgr.ReputationRankStrIndex[r]); + if (string.IsNullOrEmpty(rank)) + continue; + + if (rank.Equals(rankStr)) + break; + + if (i == ReputationMgr.ReputationRankThresholds.Length - 1) + { + handler.SendSysMessage(CypherStrings.CommandFactionInvparam, rankTxt); + return false; + } + + amount = ReputationMgr.ReputationRankThresholds[i]; + + string deltaTxt = args.NextString(); + if (!string.IsNullOrEmpty(deltaTxt)) + { + int toNextRank = 0; + var nextThresholdIndex = i; + ++nextThresholdIndex; + if (nextThresholdIndex != ReputationMgr.ReputationRankThresholds.Length - 1) + toNextRank = nextThresholdIndex - i; + + if (!int.TryParse(deltaTxt, out int delta) || delta < 0 || delta >= toNextRank) + { + handler.SendSysMessage(CypherStrings.CommandFactionDelta, Math.Max(0, toNextRank - 1)); + return false; + } + amount += delta; + } + } + } + target.GetReputationMgr().SetOneFactionReputation(factionEntry, amount, false); target.GetReputationMgr().SendState(target.GetReputationMgr().GetState(factionEntry)); handler.SendSysMessage(CypherStrings.CommandModifyRep, factionEntry.Name[handler.GetSessionDbcLocale()], factionId, handler.GetNameLink(target), target.GetReputationMgr().GetReputation(factionEntry)); diff --git a/Source/Game/DataStorage/CliDB.cs b/Source/Game/DataStorage/CliDB.cs index f8e0f0220..929919771 100644 --- a/Source/Game/DataStorage/CliDB.cs +++ b/Source/Game/DataStorage/CliDB.cs @@ -139,6 +139,8 @@ namespace Game.DataStorage ExpectedStatModStorage = ReadDB2("ExpectedStatMod.db2", HotfixStatements.SEL_EXPECTED_STAT_MOD); FactionStorage = ReadDB2("Faction.db2", HotfixStatements.SEL_FACTION, HotfixStatements.SEL_FACTION_LOCALE); FactionTemplateStorage = ReadDB2("FactionTemplate.db2", HotfixStatements.SEL_FACTION_TEMPLATE); + FriendshipRepReactionStorage = ReadDB2("FriendshipRepReaction.db2", HotfixStatements.SEL_FRIENDSHIP_REP_REACTION, HotfixStatements.SEL_FRIENDSHIP_REP_REACTION_LOCALE); + FriendshipReputationStorage = ReadDB2("FriendshipReputation.db2", HotfixStatements.SEL_FRIENDSHIP_REPUTATION, HotfixStatements.SEL_FRIENDSHIP_REPUTATION_LOCALE); GameObjectDisplayInfoStorage = ReadDB2("GameObjectDisplayInfo.db2", HotfixStatements.SEL_GAMEOBJECT_DISPLAY_INFO); GameObjectsStorage = ReadDB2("GameObjects.db2", HotfixStatements.SEL_GAMEOBJECTS, HotfixStatements.SEL_GAMEOBJECTS_LOCALE); GarrAbilityStorage = ReadDB2("GarrAbility.db2", HotfixStatements.SEL_GARR_ABILITY, HotfixStatements.SEL_GARR_ABILITY_LOCALE); @@ -503,6 +505,8 @@ namespace Game.DataStorage public static DB6Storage ExpectedStatModStorage; public static DB6Storage FactionStorage; public static DB6Storage FactionTemplateStorage; + public static DB6Storage FriendshipRepReactionStorage; + public static DB6Storage FriendshipReputationStorage; public static DB6Storage GameObjectsStorage; public static DB6Storage GameObjectDisplayInfoStorage; public static DB6Storage GarrAbilityStorage; diff --git a/Source/Game/DataStorage/DB2Manager.cs b/Source/Game/DataStorage/DB2Manager.cs index 1be3d789d..21b7619be 100644 --- a/Source/Game/DataStorage/DB2Manager.cs +++ b/Source/Game/DataStorage/DB2Manager.cs @@ -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 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, ExpectedStatRecord> _expectedStatsByLevel = new(); MultiMap _expectedStatModsByContentTuning = new(); MultiMap _factionTeams = new(); + MultiMap _friendshipRepReactions = new(); Dictionary _heirlooms = new(); MultiMap _glyphBindableSpells = new(); MultiMap _glyphRequiredSpecs = new(); @@ -2494,6 +2506,14 @@ namespace Game.DataStorage } } + class FriendshipRepReactionRecordComparer : IComparer + { + public int Compare(FriendshipRepReactionRecord left, FriendshipRepReactionRecord right) + { + return left.ReactionThreshold.CompareTo(right.ReactionThreshold); + } + } + class MountTypeXCapabilityRecordComparer : IComparer { public int Compare(MountTypeXCapabilityRecord left, MountTypeXCapabilityRecord right) diff --git a/Source/Game/DataStorage/Structs/F_Records.cs b/Source/Game/DataStorage/Structs/F_Records.cs index 992968cee..fccb89095 100644 --- a/Source/Game/DataStorage/Structs/F_Records.cs +++ b/Source/Game/DataStorage/Structs/F_Records.cs @@ -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; + } } \ No newline at end of file diff --git a/Source/Game/Entities/Player/Player.cs b/Source/Game/Entities/Player/Player.cs index 78a9ef51d..d5c0f5461 100644 --- a/Source/Game/Entities/Player/Player.cs +++ b/Source/Game/Entities/Player/Player.cs @@ -1413,6 +1413,16 @@ namespace Game.Entities //Repitation public int CalculateReputationGain(ReputationSource source, uint creatureOrQuestLevel, int rep, int faction, bool noQuestBonus = false) { + bool noBonuses = false; + var factionEntry = CliDB.FactionStorage.LookupByKey(faction); + if (factionEntry != null) + { + var friendshipReputation = CliDB.FriendshipReputationStorage.LookupByKey(factionEntry.FriendshipRepID); + if (friendshipReputation != null) + if (friendshipReputation.Flags.HasAnyFlag(FriendshipReputationFlags.NoRepGainModifiers)) + noBonuses = true; + } + float percent = 100.0f; float repMod = noQuestBonus ? 0.0f : GetTotalAuraModifier(AuraType.ModReputationGain); diff --git a/Source/Game/Reputation/ReputationManager.cs b/Source/Game/Reputation/ReputationManager.cs index c9b85eb2d..c3953ca7f 100644 --- a/Source/Game/Reputation/ReputationManager.cs +++ b/Source/Game/Reputation/ReputationManager.cs @@ -22,6 +22,7 @@ using Game.Entities; using Game.Networking.Packets; using System; using System.Collections.Generic; +using System.Linq; namespace Game { @@ -37,18 +38,32 @@ namespace Game _sendFactionIncreased = false; } - ReputationRank ReputationToRank(int standing) + ReputationRank ReputationToRankHelper(IList thresholds, int standing, Func thresholdExtractor) { - int limit = Reputation_Cap + 1; - for (var rank = ReputationRank.Max - 1; rank >= ReputationRank.Min; --rank) + int i = 0; + int rank = -1; + while (i != thresholds.Count - 1 && standing >= thresholdExtractor(thresholds[i])) { - limit -= PointsInRank[(int)rank]; - if (standing >= limit) - return rank; + ++rank; + ++i; } - return ReputationRank.Min; + + return (ReputationRank)rank; } + ReputationRank ReputationToRank(FactionRecord factionEntry, int standing) + { + ReputationRank rank = ReputationRank.Min; + + var friendshipReactions = Global.DB2Mgr.GetFriendshipRepReactions(factionEntry.FriendshipRepID); + if (!friendshipReactions.Empty()) + rank = ReputationToRankHelper(friendshipReactions, standing, (FriendshipRepReactionRecord frr) => { return frr.ReactionThreshold; }); + else + rank = ReputationToRankHelper(ReputationRankThresholds, standing, (int threshold) => { return threshold; }); + + return rank; + } + public FactionState GetState(FactionRecord factionEntry) { return factionEntry.CanHaveReputation() ? GetState(factionEntry.ReputationIndex) : null; @@ -88,24 +103,35 @@ namespace Game public int GetBaseReputation(FactionRecord factionEntry) { - if (factionEntry == null) + int dataIndex = GetFactionDataIndexForRaceAndClass(factionEntry); + if (dataIndex < 0) return 0; - long raceMask = SharedConst.GetMaskForRace(_player.GetRace()); - uint classMask = _player.GetClassMask(); - for (var i = 0; i < 4; i++) - { - if ((Convert.ToBoolean(factionEntry.ReputationRaceMask[i] & raceMask) || - (factionEntry.ReputationRaceMask[i] == 0 && factionEntry.ReputationClassMask[i] != 0)) && - (Convert.ToBoolean(factionEntry.ReputationClassMask[i] & classMask) || - factionEntry.ReputationClassMask[i] == 0)) - return factionEntry.ReputationBase[i]; - } - - // in faction.dbc exist factions with (RepListId >=0, listed in character reputation list) with all BaseRepRaceMask[i] == 0 - return 0; + return factionEntry.ReputationBase[dataIndex]; } + int GetMinReputation(FactionRecord factionEntry) + { + var friendshipReactions = Global.DB2Mgr.GetFriendshipRepReactions(factionEntry.FriendshipRepID); + if (!friendshipReactions.Empty()) + return friendshipReactions[0].ReactionThreshold; + + return ReputationRankThresholds[0]; + } + + int GetMaxReputation(FactionRecord factionEntry) + { + var friendshipReactions = Global.DB2Mgr.GetFriendshipRepReactions(factionEntry.FriendshipRepID); + if (!friendshipReactions.Empty()) + return friendshipReactions.LastOrDefault().ReactionThreshold; + + int dataIndex = GetFactionDataIndexForRaceAndClass(factionEntry); + if (dataIndex >= 0 && factionEntry.ReputationMax[dataIndex] != 0) + return factionEntry.ReputationMax[dataIndex]; + + return ReputationRankThresholds.LastOrDefault(); + } + public int GetReputation(FactionRecord factionEntry) { // Faction without recorded reputation. Just ignore. @@ -122,13 +148,13 @@ namespace Game public ReputationRank GetRank(FactionRecord factionEntry) { int reputation = GetReputation(factionEntry); - return ReputationToRank(reputation); + return ReputationToRank(factionEntry, reputation); } ReputationRank GetBaseRank(FactionRecord factionEntry) { int reputation = GetBaseReputation(factionEntry); - return ReputationToRank(reputation); + return ReputationToRank(factionEntry, reputation); } public ReputationRank GetForcedRankIfAny(FactionTemplateRecord factionTemplateEntry) @@ -146,21 +172,11 @@ namespace Game uint GetDefaultStateFlags(FactionRecord factionEntry) { - if (factionEntry == null) + int dataIndex = GetFactionDataIndexForRaceAndClass(factionEntry); + if (dataIndex < 0) return 0; - long raceMask = SharedConst.GetMaskForRace(_player.GetRace()); - uint classMask = _player.GetClassMask(); - for (int i = 0; i < 4; i++) - { - if ((Convert.ToBoolean(factionEntry.ReputationRaceMask[i] & raceMask) || - (factionEntry.ReputationRaceMask[i] == 0 && - factionEntry.ReputationClassMask[i] != 0)) && - (Convert.ToBoolean(factionEntry.ReputationClassMask[i] & classMask) || - factionEntry.ReputationClassMask[i] == 0)) - return factionEntry.ReputationFlags[i]; - } - return 0; + return factionEntry.ReputationFlags[dataIndex]; } public void SendForceReactions() @@ -252,7 +268,8 @@ namespace Game if (Convert.ToBoolean(newFaction.Flags & FactionFlags.Visible)) ++_visibleFactionCount; - UpdateRankCounters(ReputationRank.Hostile, GetBaseRank(factionEntry)); + if (factionEntry.FriendshipRepID == 0) + UpdateRankCounters(ReputationRank.Hostile, GetBaseRank(factionEntry)); _factions[newFaction.ReputationListID] = newFaction; } @@ -363,13 +380,13 @@ namespace Game standing += factionState.Standing + BaseRep; } - if (standing > Reputation_Cap) - standing = Reputation_Cap; - else if (standing < Reputation_Bottom) - standing = Reputation_Bottom; + if (standing > GetMaxReputation(factionEntry)) + standing = GetMaxReputation(factionEntry); + else if (standing < GetMinReputation(factionEntry)) + standing = GetMinReputation(factionEntry); - ReputationRank old_rank = ReputationToRank(factionState.Standing + BaseRep); - ReputationRank new_rank = ReputationToRank(standing); + ReputationRank old_rank = ReputationToRank(factionEntry, factionState.Standing + BaseRep); + ReputationRank new_rank = ReputationToRank(factionEntry, standing); int newStanding = standing - BaseRep; @@ -387,8 +404,8 @@ namespace Game if (new_rank > old_rank) _sendFactionIncreased = true; - UpdateRankCounters(old_rank, new_rank); - + if (factionEntry.FriendshipRepID == 0) + UpdateRankCounters(old_rank, new_rank); _player.UpdateCriteria(CriteriaTypes.KnownFactions, factionEntry.Id); _player.UpdateCriteria(CriteriaTypes.GainReputation, factionEntry.Id); @@ -524,10 +541,13 @@ namespace Game faction.Standing = result.Read(1); // update counters - int BaseRep = GetBaseReputation(factionEntry); - ReputationRank old_rank = ReputationToRank(BaseRep); - ReputationRank new_rank = ReputationToRank(BaseRep + faction.Standing); - UpdateRankCounters(old_rank, new_rank); + if (factionEntry.FriendshipRepID == 0) + { + int BaseRep = GetBaseReputation(factionEntry); + ReputationRank old_rank = ReputationToRank(factionEntry, BaseRep); + ReputationRank new_rank = ReputationToRank(factionEntry, BaseRep + faction.Standing); + UpdateRankCounters(old_rank, new_rank); + } FactionFlags dbFactionFlags = (FactionFlags)result.Read(2); @@ -601,6 +621,24 @@ namespace Game ++_honoredFactionCount; } + int GetFactionDataIndexForRaceAndClass(FactionRecord factionEntry) + { + if (factionEntry == null) + return -1; + + long raceMask = SharedConst.GetMaskForRace(_player.GetRace()); + short classMask = (short)_player.GetClassMask(); + for (int i = 0; i < 4; i++) + { + if ((factionEntry.ReputationRaceMask[i].HasAnyFlag(raceMask) || (factionEntry.ReputationRaceMask[i] == 0 && factionEntry.ReputationClassMask[i] != 0)) + && (factionEntry.ReputationClassMask[i].HasAnyFlag(classMask) || factionEntry.ReputationClassMask[i] == 0)) + + return i; + } + + return -1; + } + public byte GetVisibleFactionCount() { return _visibleFactionCount; } public byte GetHonoredFactionCount() { return _honoredFactionCount; } @@ -633,13 +671,13 @@ namespace Game if (factionEntry == null) return 0; - ulong raceMask = (ulong)SharedConst.GetMaskForRace(race); + long raceMask = SharedConst.GetMaskForRace(race); uint classMask = (1u << ((int)playerClass - 1)); for (int i = 0; i < 4; i++) { if ((factionEntry.ReputationClassMask[i] == 0 || factionEntry.ReputationClassMask[i].HasAnyFlag((short)classMask)) - && (factionEntry.ReputationRaceMask[i] == 0 || factionEntry.ReputationRaceMask[i].HasAnyFlag((uint)raceMask))) + && (factionEntry.ReputationRaceMask[i] == 0 || factionEntry.ReputationRaceMask[i].HasAnyFlag(raceMask))) return factionEntry.ReputationBase[i]; } @@ -655,19 +693,38 @@ namespace Game bool _sendFactionIncreased; //! Play visual effect on next SMSG_SET_FACTION_STANDING sent #endregion - public static int[] PointsInRank = { 36000, 3000, 3000, 3000, 6000, 12000, 21000, 1000 }; + public static int[] ReputationRankThresholds = + { + -42000, + // Hated + -6000, + // Hostile + -3000, + // Unfriendly + 0, + // Neutral + 3000, + // Friendly + 9000, + // Honored + 21000, + // Revered + 42000 + // Exalted + }; + public static CypherStrings[] ReputationRankStrIndex = { CypherStrings.RepHated, CypherStrings.RepHostile, CypherStrings.RepUnfriendly, CypherStrings.RepNeutral, CypherStrings.RepFriendly, CypherStrings.RepHonored, CypherStrings.RepRevered, CypherStrings.RepExalted }; - const int Reputation_Cap = 42999; + + const int Reputation_Cap = 42000; const int Reputation_Bottom = -42000; SortedDictionary _factions = new(); Dictionary _forcedReactions = new(); - - } + public class FactionState { public uint Id; diff --git a/sql/updates/hotfixes/master/2021_06_04_00_hotfixes.sql b/sql/updates/hotfixes/master/2021_06_04_00_hotfixes.sql new file mode 100644 index 000000000..e02eac851 --- /dev/null +++ b/sql/updates/hotfixes/master/2021_06_04_00_hotfixes.sql @@ -0,0 +1,88 @@ +-- +-- Table structure for table `friendship_rep_reaction` +-- +DROP TABLE IF EXISTS `friendship_rep_reaction`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!50503 SET character_set_client = utf8mb4 */; +CREATE TABLE `friendship_rep_reaction` ( + `ID` int(10) unsigned NOT NULL DEFAULT '0', + `Reaction` text, + `FriendshipRepID` int(10) unsigned NOT NULL DEFAULT '0', + `ReactionThreshold` smallint(5) unsigned NOT NULL DEFAULT '0', + `VerifiedBuild` int(11) NOT NULL DEFAULT '0', + PRIMARY KEY (`ID`,`VerifiedBuild`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Table structure for table `friendship_rep_reaction_locale` +-- +DROP TABLE IF EXISTS `friendship_rep_reaction_locale`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!50503 SET character_set_client = utf8mb4 */; +CREATE TABLE `friendship_rep_reaction_locale` ( + `ID` int(10) unsigned NOT NULL DEFAULT '0', + `locale` varchar(4) NOT NULL, + `Reaction_lang` text, + `VerifiedBuild` int(11) NOT NULL DEFAULT '0', + PRIMARY KEY (`ID`,`locale`,`VerifiedBuild`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci +/*!50500 PARTITION BY LIST COLUMNS(locale) +(PARTITION deDE VALUES IN ('deDE') ENGINE = InnoDB, + PARTITION esES VALUES IN ('esES') ENGINE = InnoDB, + PARTITION esMX VALUES IN ('esMX') ENGINE = InnoDB, + PARTITION frFR VALUES IN ('frFR') ENGINE = InnoDB, + PARTITION itIT VALUES IN ('itIT') ENGINE = InnoDB, + PARTITION koKR VALUES IN ('koKR') ENGINE = InnoDB, + PARTITION ptBR VALUES IN ('ptBR') ENGINE = InnoDB, + PARTITION ruRU VALUES IN ('ruRU') ENGINE = InnoDB, + PARTITION zhCN VALUES IN ('zhCN') ENGINE = InnoDB, + PARTITION zhTW VALUES IN ('zhTW') ENGINE = InnoDB) */; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Table structure for table `friendship_reputation` +-- +DROP TABLE IF EXISTS `friendship_reputation`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!50503 SET character_set_client = utf8mb4 */; +CREATE TABLE `friendship_reputation` ( + `Description` text, + `StandingModified` text, + `StandingChanged` text, + `ID` int(10) unsigned NOT NULL DEFAULT '0', + `FactionID` int(11) NOT NULL DEFAULT '0', + `TextureFileID` int(11) NOT NULL DEFAULT '0', + `Flags` int(11) NOT NULL DEFAULT '0', + `VerifiedBuild` int(11) NOT NULL DEFAULT '0', + PRIMARY KEY (`ID`,`VerifiedBuild`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Table structure for table `friendship_reputation_locale` +-- +DROP TABLE IF EXISTS `friendship_reputation_locale`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!50503 SET character_set_client = utf8mb4 */; +CREATE TABLE `friendship_reputation_locale` ( + `ID` int(10) unsigned NOT NULL DEFAULT '0', + `locale` varchar(4) NOT NULL, + `Description_lang` text, + `StandingModified_lang` text, + `StandingChanged_lang` text, + `VerifiedBuild` int(11) NOT NULL DEFAULT '0', + PRIMARY KEY (`ID`,`locale`,`VerifiedBuild`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci +/*!50500 PARTITION BY LIST COLUMNS(locale) +(PARTITION deDE VALUES IN ('deDE') ENGINE = InnoDB, + PARTITION esES VALUES IN ('esES') ENGINE = InnoDB, + PARTITION esMX VALUES IN ('esMX') ENGINE = InnoDB, + PARTITION frFR VALUES IN ('frFR') ENGINE = InnoDB, + PARTITION itIT VALUES IN ('itIT') ENGINE = InnoDB, + PARTITION koKR VALUES IN ('koKR') ENGINE = InnoDB, + PARTITION ptBR VALUES IN ('ptBR') ENGINE = InnoDB, + PARTITION ruRU VALUES IN ('ruRU') ENGINE = InnoDB, + PARTITION zhCN VALUES IN ('zhCN') ENGINE = InnoDB, + PARTITION zhTW VALUES IN ('zhTW') ENGINE = InnoDB) */; +/*!40101 SET character_set_client = @saved_cs_client */;