public static void AddFeat(FeatMentioning.FeatType feat, string PlayerName, string SubjectName = "", float FeatDurationDays = 8, float ImportanceLevel = 0, GuardianID[] GuardiansWhoMentionThis = null)
        {
            if (GuardiansWhoMentionThis == null)
            {
                GuardiansWhoMentionThis = new GuardianID[0];
            }
            uint Duration = (uint)(FeatDurationDays * (60 * 60 * 24));

            foreach (FeatMentioning f in Feats)
            {
                if (f.type == feat && f.PlayerName == PlayerName)
                {
                    bool Skip = false;
                    foreach (GuardianID g in GuardiansWhoMentionThis)
                    {
                        if (!f.GuardianMentionsThis(g))
                        {
                            if (feat == FeatMentioning.FeatType.MentionPlayer)
                            {
                                Skip = true;
                                break;
                            }
                            f.AddGuardianWhoMentionsThis(g);
                        }
                    }
                    if (Skip)
                    {
                        continue;
                    }
                    if (f.Importance <= ImportanceLevel)
                    {
                        f.FeatSubject = SubjectName;
                        f.Importance  = ImportanceLevel;
                    }
                    if (f.FeatSubject == SubjectName && f.FeatDurationInGameDays < Duration)
                    {
                        f.FeatDurationInGameDays = Duration;
                    }
                    return;
                }
            }
            FeatMentioning newFeat = new FeatMentioning();

            newFeat.type                    = feat;
            newFeat.PlayerName              = PlayerName;
            newFeat.FeatSubject             = SubjectName;
            newFeat.FeatDurationInGameDays  = Duration;
            newFeat.Importance              = ImportanceLevel;
            newFeat.GuardiansWhoMentionThis = GuardiansWhoMentionThis;
            Feats.Add(newFeat);
        }
        public static void LoadFeats()
        {
            FeatsLoaded = true;
            Feats.Clear();
            string SaveFolder = GetSaveFolder;

            if (!Directory.Exists(SaveFolder))
            {
                return;
            }
            string FeatsFile = SaveFolder + "/feats.sav";

            if (!File.Exists(FeatsFile))
            {
                return;
            }
            using (FileStream stream = new FileStream(FeatsFile, FileMode.Open))
            {
                using (BinaryReader reader = new BinaryReader(stream))
                {
                    int Version    = reader.ReadInt32();
                    int TotalFeats = reader.ReadInt32();
                    for (int f = 0; f < TotalFeats; f++)
                    {
                        FeatMentioning feat = new FeatMentioning();
                        feat.type        = (FeatMentioning.FeatType)reader.ReadInt32();
                        feat.PlayerName  = ScrambleText(reader.ReadString(), false);
                        feat.FeatSubject = ScrambleText(reader.ReadString(), false);
                        if (Version < 91)
                        {
                            feat.FeatDurationInGameDays = (uint)reader.ReadSingle();
                        }
                        else
                        {
                            feat.FeatDurationInGameDays = reader.ReadUInt32();
                        }
                        Feats.Add(feat);
                    }
                }
            }
        }
        public static string GetFeatMessage(FeatMentioning feat, TerraGuardian tg)
        {
            string Message = "";
            string Subject = feat.FeatSubject;

            switch (feat.type)
            {
            case FeatMentioning.FeatType.BossDefeated:
            case FeatMentioning.FeatType.MinibossDefeated:
                Message = tg.GetMessage(GuardianBase.MessageIDs.FeatMentionBossDefeat);
                break;

            case FeatMentioning.FeatType.CoinPortalSpawned:
                Message = tg.GetMessage(GuardianBase.MessageIDs.FeatCoinPortal);
                break;

            case FeatMentioning.FeatType.EventFinished:
                Message = tg.GetMessage(GuardianBase.MessageIDs.FeatEventFinished);
                break;

            case FeatMentioning.FeatType.FoundSomethingGood:
                Message = tg.GetMessage(GuardianBase.MessageIDs.FeatFoundSomethingGood);
                break;

            case FeatMentioning.FeatType.MentionPlayer:
                Message = tg.GetMessage(GuardianBase.MessageIDs.FeatMentionPlayer);
                break;

            case FeatMentioning.FeatType.MetSomeoneNew:
            {
                if (tg.Base.Name == feat.FeatSubject || tg.Base.PossibleNames.Contains(feat.FeatSubject))
                {
                    Message = tg.GetMessage(GuardianBase.MessageIDs.FeatPlayerMetMe);
                }
                else
                {
                    Message = tg.GetMessage(GuardianBase.MessageIDs.FeatMetSomeoneNew);
                }
            }
            break;

            case FeatMentioning.FeatType.OpenedTemple:
                Message = tg.GetMessage(GuardianBase.MessageIDs.FeatOpenTemple);
                break;

            case FeatMentioning.FeatType.PlayerDied:
                Message = tg.GetMessage(GuardianBase.MessageIDs.FeatPlayerDied);
                break;

            case FeatMentioning.FeatType.SomeonePickedABuddy:
            {
                bool IsMe = (tg.Base.Name == feat.FeatSubject || tg.Base.PossibleNames.Contains(feat.FeatSubject));
                if (IsMe && feat.PlayerName == Main.player[Main.myPlayer].name)
                {
                    Message = tg.GetMessage(GuardianBase.MessageIDs.FeatSpeakerPlayerPickedMeAsBuddy);
                }
                else
                {
                    if (!IsMe)
                    {
                        Message = tg.GetMessage(GuardianBase.MessageIDs.FeatMentionSomeonePickedAsBuddy);
                    }
                }
            }
            break;

            case FeatMentioning.FeatType.SomeoneMovedInToAWorld:
            {
                bool IsMe = (tg.Base.Name == Subject || tg.Base.PossibleNames.Contains(Subject));
                if (!IsMe && feat.PlayerName != Main.LocalPlayer.name)
                {
                    string[] SubjectSplit = feat.FeatSubject.Split(':');
                    Subject = SubjectSplit[0];
                    string WorldName = SubjectSplit[1];
                    Message = tg.GetMessage(GuardianBase.MessageIDs.FeatMentionSomeoneMovingIntoAWorld).Replace("[world]", WorldName);
                }
            }
            break;
            }
            Message = Message.Replace("[player]", feat.PlayerName).Replace("[subject]", Subject);
            return(Message);
        }