diff --git a/Werewolf for Telegram/Database/AchievementsReworked.cs b/Werewolf for Telegram/Database/AchievementsReworked.cs index c215de03c..babaa1f47 100644 --- a/Werewolf for Telegram/Database/AchievementsReworked.cs +++ b/Werewolf for Telegram/Database/AchievementsReworked.cs @@ -205,30 +205,40 @@ public enum AchievementsReworked public static partial class Extensions { - public static string GetDescription(this AchievementsReworked value) + public static string GetDescription(this AchievementsReworked value, bool text = true) { - FieldInfo fi = value.GetType().GetField(value.ToString()); + if (text) + { + FieldInfo fi = value.GetType().GetField(value.ToString()); - DescriptionAttribute[] attributes = - (DescriptionAttribute[])fi.GetCustomAttributes( - typeof(DescriptionAttribute), - false); + DescriptionAttribute[] attributes = + (DescriptionAttribute[])fi.GetCustomAttributes( + typeof(DescriptionAttribute), + false); - if (attributes != null && - attributes.Length > 0) - return attributes[0].Description; + if (attributes != null && + attributes.Length > 0) + return attributes[0].Description; + else + return value.ToString(); + } else - return value.ToString(); + return $"Achievement{value.ToString()}Descr"; } - public static string GetName(this AchievementsReworked value) + public static string GetName(this AchievementsReworked value, bool text = true) { - var fieldInfo = value.GetType().GetField(value.ToString()); + if (text) + { + var fieldInfo = value.GetType().GetField(value.ToString()); - var descriptionAttributes = fieldInfo.GetCustomAttributes( - typeof(DisplayAttribute), false) as DisplayAttribute[]; + var descriptionAttributes = fieldInfo.GetCustomAttributes( + typeof(DisplayAttribute), false) as DisplayAttribute[]; - if (descriptionAttributes == null) return string.Empty; - return (descriptionAttributes.Length > 0) ? descriptionAttributes[0].Name : value.ToString(); + if (descriptionAttributes == null) return string.Empty; + return (descriptionAttributes.Length > 0) ? descriptionAttributes[0].Name : value.ToString(); + } + else + return $"Achievement{value.ToString()}Name"; } public static byte[] ToByteArray(this BitArray bits) diff --git a/Werewolf for Telegram/Languages/English.xml b/Werewolf for Telegram/Languages/English.xml index 027549e48..af59fb8ac 100644 --- a/Werewolf for Telegram/Languages/English.xml +++ b/Werewolf for Telegram/Languages/English.xml @@ -2265,5 +2265,577 @@ Ah! How miserable can the life of someone, who is not even able to do the only task they were made for, be? Is the ability of taking the appearance of others only a legend? We will never know!\n{0} is now alone in the village and there is nobody to mimic. The only thing they can do is copy the person in the mirror! + + + Achievement Unlocked! + + + New Unlocks! + + + + None + + + You haven't played a game yet! + + + Welcome to Hell + + + Play a game + + + Welcome to the Asylum + + + Play a chaos game + + + Alzheimer's Patient + + + Play a game with an amnesia language pack + + + O HAI DER! + + + Play a game with Para's secret account (not @para949) + + + Spy vs Spy + + + Play a game in secret mode (no role reveal) + + + Explorer + + + Play at least 2 games each in 10 different groups + + + Linguist + + + Play at least 2 games each in 10 different language packs + + + I Have No Idea What I'm Doing + + + Play a game in secret amnesia mode + + + Enochlophobia + + + Play a 35 player game + + + Introvert + + + Play a 5 player game + + + Naughty! + + + Play a game using any NSFW language pack + + + Dedicated + + + Play 100 games + + + Obsessed + + + Play 1000 games + + + Here's Johnny! + + + Get 50 kills as the serial killer + + + I've Got Your Back + + + Save 50 people as the Guardian Angel + + + Masochist + + + Win a game as the Tanner + + + Wobble Wobble + + + Survive a game as the drunk (at least 10 players) + + + Inconspicuous + + + In a game of 20 or more people, do not get a single lynch vote against you (and survive) + + + Survivalist + + + Survive 100 games + + + Black Sheep + + + Get lynched first 3 games in a row + + + Promiscuous + + + As the harlot, survive a 5+ night game without staying home or visiting the same person more than once + + + Mason Brother + + + Be one of at least two surviving masons in a game + + + Double Shifter + + + Change roles twice in one game (cult conversion does not count) + + + Hey Man, Nice Shot + + + As the hunter, use your dying shot to kill a wolf or serial killer + + + That's Why You Don't Stay Home + + + As a wolf or cultist, kill or convert a harlot that stayed home + + + Double Vision + + + Be one of two seers at the same time + + + Double Kill + + + Be part of the Serial Killer / Hunter ending + + + Should Have Known + + + As the Seer, reveal the Beholder + + + I See a Lack of Trust + + + As the Seer, get lynched on the first day + + + Sunday Bloody Sunday + + + Be one of at least 4 victims to die in a single night + + + Change Sides Works + + + Change roles in a game, and win + + + Forbidden Love + + + Win as a wolf / villager couple (villager, not village team) + + + Developer + + + Have a pull request merged into the repo + + + The First Stone + + + Be the first to cast a lynch vote 5 times in a single game + + + Smart Gunner + + + As the Gunner, both of your bullets hit a wolf, serial killer, or cultist + + + Streetwise + + + Find a different wolf, serial killer, arsonist, or cultist 4 nights in a row as the detective + + + Speed Dating + + + Have the bot select you as a lover (cupid failed to choose) + + + Even a Stopped Clock is Right Twice a Day + + + As the Fool, have at least two of your visions be correct by the end of the game + + + So Close! + + + As the Tanner, be tied for the most lynch votes + + + Cultist Convention + + + Be one of 10 or more cultists alive at the end of a game + + + Self Loving + + + As cupid, pick yourself as one of the lovers + + + Should've Said Something + + + As a wolf, your pack eats your lover (first night does not count) + + + Tanner Overkill + + + As the Tanner, have everyone (but yourself) vote to lynch you + + + Serial Samaritan + + + As the Serial Killer, kill at least 3 wolves in single game + + + Cultist Fodder + + + Be the cultist that is sent to attempt to convert the Cult Hunter + + + Lone Wolf + + + In a chaos game of 10 or more people, be the only wolf - and win + + + Pack Hunter + + + Be one of 7 living wolves at one time + + + Saved by the Bull(et) + + + As a villager, the wolves match the number of villagers, but the game does not end because the gunner has a bullet + + + In for the Long Haul + + + Survive for at least an hour in a single game + + + OH SHI- + + + Kill your lover on the first night + + + Veteran + + + Play 500 games. You can now join @werewolfvets + + + No Sorcery! + + + As a wolf, kill your sorcerer + + + Cultist Tracker + + + As the cultist hunter, kill at least 3 cultists in one game + + + I'M NOT DRUN-- *BURPPP* + + + As the clumsy guy, have at least 3 correct lynches by the end of the game + + + Wuffie-Cult + + + As the alpha wolf, successfully convert at least 3 victims into wolves + + + Did you guard yourself? + + + As the guardian angel, survive after 3 tries guarding an unattacked wolf + + + Spoiled Rich Brat + + + As the prince, still gets lynched even after revealing your identity + + + Three Little Wolves and a Big Bad Pig + + + As the sorcerer, survive a game with three or more alive wolves + + + President + + + As the mayor, successfully cast 3 lynch votes after revealing + + + I Helped! + + + As a wolf cub, the alive pack has 2 successful eat attempts after you die + + + It Was a Busy Night! + + + During the same night, got visited by 3 or more different visiting roles + + + Strongest Alpha + + + As the alpha wolf, successfully infect the serial killer! + + + Am I Your Seer? + + + As the fool, correctly spot the beholder + + + Demoted by the Death + + + As the hunter, shoot the wise elder with your final shot and die as lowly villager + + + Wasted Silver + + + As the blacksmith, spread your silver dust the same day that the sandman sings + + + Trustworthy! + + + As the wolf man, survive and win the game after being checked by seer + + + Deep Love + + + As the doppelgänger, choose your lover as role model. What a deep love <3 + + + Time to retire... + + + As the sorcerer, be the last person alive in the village and lose the game + + + Seeing between Teams + + + Be in a seer/sorcerer couple + + + Just a Beardy Guy..? + + + As the wolf man, be infected by the alpha wolf and become a real werewolf. AWOOOOOOO! + + + That Came Unexpected! + + + As tanner, be lynched and win the game when there are only 3 persons left + + + Now I'm Blind + + + As the oracle, fail to get a vision because everyone else has the same role. + + + Every Man for Himself! + + + As the pacifist, save yourself from being lynched (at least 50% of votes have been cast for you already) + + + My Sweetie so Strong! + + + Be in love with the pacifist, and get saved from being lynched by them (at least 50% of votes have been cast for you already) + + + Cult Leader + + + Be a cultist from the beginning of the game, survive and win. + + + Thanks, Junior! + + + After the wolf pack ate the Drunk, you turn into a wolf and can try to eat someone while the rest of the wolf pack is drunk! + + + Death Village + + + Participate in a game that has no winner. + + + I Lost my Wisdom + + + As the wise elder, change your role! Suddenly you're not that wise anymore... + + + Affectionate + + + As the harlot, visit your lover! + + + Lucky Day + + + As the Alpha Wolf, infect the drunk and stay sober! Phew... + + + Condition Red! + + + As the last wolf alive, eat the traitor. Oh no! + + + Indestructible + + + Become Doppelgänger or Wild Child with your role model being yourself! + + + Psychopath Killer + + + As the serial killer, win a game with 35 players! + + + Today's Special! + + + Take part in a special werewolf event! Currently: Be fooled on April Fool's 2020! + + + Romeo and Juliet + + + Be in love with the tanner, and win by lynching your lover! + + + Really bad luck + + + As a serial killer, stumble in a grave, then kill someone randomly and get fought off by the guardian angel. + + + Domino + + + As a hunter, shoot another hunter causing them to shoot as well. + + + Double Shot + + + As the hunter or the gunner, shoot a bad role who is in love with another bad role! + + + Playing with the Fire + + + As the arsonist, burn 5 or more houses in one night. + + + Firework + + + As the arsonist, burn 10 or more houses in one night! What a nice firework :) + + + Cold as Ice + + + As the Snow Wolf, freeze the harlot. Their love is cold as ice. + + + Good Choice... For You + + + As the chemist, visit a player and survive 3 times in a single game. + + + Increase the Pack! + + + After the wolf cub died, infect 2 players as the alpha wolf! + diff --git a/Werewolf for Telegram/Werewolf Control/Commands/AdminCommands.cs b/Werewolf for Telegram/Werewolf Control/Commands/AdminCommands.cs index 962a6f7c9..8bdc0b900 100644 --- a/Werewolf for Telegram/Werewolf Control/Commands/AdminCommands.cs +++ b/Werewolf for Telegram/Werewolf Control/Commands/AdminCommands.cs @@ -386,7 +386,12 @@ public static void AddAchievement(Update u, string[] args) ach = ach.Set(a); p.NewAchievements = ach.ToByteArray(); db.SaveChanges(); - Send($"Achievement Unlocked!\n{a.GetName().ToBold()}\n{a.GetDescription()}", p.TelegramId); + var language = GetLanguage(p.TelegramId); + var msg = GetLocaleString("AchUnlocked", language) + Environment.NewLine; + msg += GetLocaleString(a.GetName(false), language).ToBold() + Environment.NewLine; + msg += GetLocaleString(a.GetDescription(false), language); + Send(msg, p.TelegramId); + //Send($"Achievement Unlocked!\n{a.GetName().ToBold()}\n{a.GetDescription()}", p.TelegramId); Send($"Achievement {a} unlocked for {p.Name}", u.Message.Chat.Id); } } diff --git a/Werewolf for Telegram/Werewolf Control/Handlers/UpdateHandler.cs b/Werewolf for Telegram/Werewolf Control/Handlers/UpdateHandler.cs index c53e685b1..e317ae9fb 100644 --- a/Werewolf for Telegram/Werewolf Control/Handlers/UpdateHandler.cs +++ b/Werewolf for Telegram/Werewolf Control/Handlers/UpdateHandler.cs @@ -2021,7 +2021,13 @@ private static bool AddAchievement(Player p, AchievementsReworked a, WWContext d p.NewAchievements = ach.ToByteArray(); db.SaveChanges(); - Send($"Achievement Unlocked!\n{a.GetName().ToBold()}\n{a.GetDescription()}", p.TelegramId); + //composing message + var language = GetLanguage(p.TelegramId); + var msg = GetLocaleString("AchUnlocked", language) + Environment.NewLine; + msg += GetLocaleString(a.GetName(false), language).ToBold() + Environment.NewLine; + msg += GetLocaleString(a.GetDescription(false), language); + Send(msg, p.TelegramId); + //Send($"Achievement Unlocked!\n{a.GetName().ToBold()}\n{a.GetDescription()}", p.TelegramId); return true; } return false; diff --git a/Werewolf for Telegram/Werewolf Node/Werewolf.cs b/Werewolf for Telegram/Werewolf Node/Werewolf.cs index 35c90192a..fe17bfdee 100644 --- a/Werewolf for Telegram/Werewolf Node/Werewolf.cs +++ b/Werewolf for Telegram/Werewolf Node/Werewolf.cs @@ -5838,8 +5838,9 @@ private void UpdateAchievements() //notify var newFlags2 = newAch2.GetUniqueFlags().ToList(); if (newAch2.Cast().All(x => x == false)) continue; - var msg2 = "New Unlocks!".ToBold() + Environment.NewLine; - msg2 = newFlags2.Aggregate(msg2, (current, a) => current + $"{a.GetName().ToBold()}\n{a.GetDescription()}\n\n"); + var msg2 = GetLocaleString("MoreAchUnlocked").ToBold() + Environment.NewLine; + msg2 = newFlags2.Aggregate( + msg2, (current, a) => current + $"{GetLocaleString(a.GetName(false)).ToBold()}\n{GetLocaleString(a.GetDescription(false))}\n\n"); Send(msg2, p.TelegramId); } } @@ -5974,7 +5975,11 @@ private void AddAchievement(IPlayer player, AchievementsReworked a) p.NewAchievements = ach.ToByteArray(); db.SaveChanges(); - Send($"Achievement Unlocked!\n{a.GetName().ToBold()}\n{a.GetDescription()}", player.Id); + //composing message + var msg = GetLocaleString("AchUnlocked") + Environment.NewLine; + msg += GetLocaleString(a.GetName(false)).ToBold() + Environment.NewLine; + msg += GetLocaleString(a.GetDescription(false)); + Send(msg, player.Id); } } }