Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Implementing a new role for better balancing #376

Closed
wants to merge 8 commits into from
Original file line number Diff line number Diff line change
Expand Up @@ -621,6 +621,7 @@ public static void ReviewGifs(Update u, string[] args)
Bot.Api.SendDocumentAsync(id, pack.WolfWin, "Single Wolf Wins");
Thread.Sleep(250);
Bot.Api.SendDocumentAsync(id, pack.WolvesWin, "Wolf Pack Wins");
Thread.Sleep(500);
var msg = $"Approval Status: ";
switch (pack.Approved)
{
Expand Down Expand Up @@ -696,6 +697,7 @@ public static void ApproveGifs(Update u, string[] args)
pack.Approved = true;
pack.ApprovedBy = id;
pack.NSFW = nsfw;
pack.Submitted = false;
var msg = $"Approval Status: ";
var by = db.Players.FirstOrDefault(x => x.TelegramId == pack.ApprovedBy);
msg += "Approved By " + by.Name + "\nNSFW: " + pack.NSFW;
Expand Down
22 changes: 2 additions & 20 deletions Werewolf for Telegram/Werewolf Control/Commands/GifCommands.cs
Original file line number Diff line number Diff line change
Expand Up @@ -39,26 +39,8 @@ public static void Donate(Update u, string[] args)
}
menu.Buttons.Add(new InlineKeyboardUrlButton("PayPal", "https://PayPal.me/greywolfdevelopment"));
var markup = menu.CreateMarkupFromMenu();
var gif = "Donate $10USD or more to unlock a custom gif pack that you can choose. "; //"Custom gif packs are not available at this time, watch the update channel for more news! ";
//using (var db = new WWContext())
//{
// var count = db.Players.Count(x => x.GifPurchased == true);
// if (count < 100)
// gif = "Donate $10USD or more to unlock a custom gif pack that you can choose. ";

//}
Bot.Api.SendTextMessageAsync(u.Message.Chat.Id,
"Want to help keep Werewolf online?\n" +
"We now offer some rewards for donating!\n" +
gif + "There are also donation badges you can get in game. These badges are added to the end of your name in game, so everyone can see you donated!\n\n" +
"•$10 USD: 🥉\n" +
"•$50 USD: 🥈\n" +
"•$100 USD: 🥇\n\n" +
"You might also see this special badge: 💎\nThis is reserved for people who donated prior to there being any rewards for donating\n" +
"If you donate via PayPal, you will need to contact @werewolfsupport to claim your prize. If you donate via Telegram, it's automated, no need to contact an admin :)\n" +
"More information about the Custom Gif Packs: http://telegra.ph/Custom-Gif-Packs-and-Donation-Levels-07-31\n" +
"How would you like to donate?",
replyMarkup: markup);
var txt = $"Want to help keep Werewolf Moderator online? Donate now and gets: {"Custom gifs".ToBold()} and {"Badges".ToBold()}!\n\nClick the button below to donate, and click <a href='https://t.me/greywolfsupport'>here to claim your reward if you donate via Paypal</a>!\n\nMore Info: https://telegra.ph/Custom-Gif-Packs-and-Donation-Levels-06-27";
Bot.Api.SendTextMessageAsync(u.Message.Chat.Id, txt, replyMarkup: markup, parseMode: ParseMode.Html, disableWebPagePreview: true);
}

[Attributes.Command(Trigger = "customgif")]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -867,6 +867,7 @@ internal static void HandleCallback(CallbackQuery query)
Bot.Api.SendDocumentAsync(id, pack.WolfWin, "Single Wolf Wins");
Thread.Sleep(250);
Bot.Api.SendDocumentAsync(id, pack.WolvesWin, "Wolf Pack Wins");
Thread.Sleep(500);
var msg = $"Approval Status: ";
switch (pack.Approved)
{
Expand Down Expand Up @@ -904,6 +905,7 @@ internal static void HandleCallback(CallbackQuery query)
pack.Approved = true;
pack.ApprovedBy = id;
pack.NSFW = nsfw;
pack.Submitted = false;
msg = $"Approval Status: ";
by = DB.Players.FirstOrDefault(x => x.TelegramId == pack.ApprovedBy);
msg += "Approved By " + by.Name + "\nNSFW: " + pack.NSFW;
Expand Down Expand Up @@ -933,6 +935,7 @@ internal static void HandleCallback(CallbackQuery query)
pack.Approved = true;
pack.ApprovedBy = id;
pack.NSFW = nsfw;
pack.Submitted = false;
msg = $"Approval Status: ";
by = DB.Players.FirstOrDefault(x => x.TelegramId == pack.ApprovedBy);
msg += "Approved By " + by.Name + "\nNSFW: " + pack.NSFW;
Expand Down
2 changes: 1 addition & 1 deletion Werewolf for Telegram/Werewolf Control/Helpers/Settings.cs
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ internal static class Settings


public static string TcpSecret => Environment.MachineName.GetHashCode().ToString();
public static readonly long PersianSupportChatId = -1001059174638;
public static readonly long PersianSupportChatId = -1001398432551;
public static readonly long MainChatId = -1001049529775; //Beta group
public static readonly long SupportChatId = -1001060486754; //@werewolfsupport
public static readonly long PrimaryChatId = -1001268085464; //@werewolfgame
Expand Down
27 changes: 16 additions & 11 deletions Werewolf for Telegram/Werewolf Node/Werewolf.cs
Original file line number Diff line number Diff line change
Expand Up @@ -1364,15 +1364,7 @@ private void AssignRoles()
var towolf = rolesToAssign.FindIndex(x => x == IRole.Sorcerer || x == IRole.Traitor); //if there are both, the random order of rolesToAssign will choose for us which one to substitute
rolesToAssign[towolf] = WolfRoles[Program.R.Next(WolfRoles.Count())]; //choose randomly from WolfRoles
}

//appseer without seer -> seer
if (rolesToAssign.Contains(IRole.ApprenticeSeer) && !rolesToAssign.Contains(IRole.Seer))
{
//substitute with seer
var apps = rolesToAssign.IndexOf(IRole.ApprenticeSeer);
rolesToAssign[apps] = IRole.Seer;
}


//cult without CH -> add CH
if (rolesToAssign.Contains(IRole.Cultist) && !rolesToAssign.Contains(IRole.CultistHunter))
{
Expand All @@ -1381,6 +1373,13 @@ private void AssignRoles()
rolesToAssign[vg] = IRole.CultistHunter;
}

//appseer without seer -> seer
if (rolesToAssign.Contains(IRole.ApprenticeSeer) && !rolesToAssign.Contains(IRole.Seer))
{
//substitute with seer
var apps = rolesToAssign.IndexOf(IRole.ApprenticeSeer);
rolesToAssign[apps] = IRole.Seer;
}

//make sure that we have at least two teams
if (
Expand Down Expand Up @@ -2360,7 +2359,8 @@ private void DayCycle()
//first off, chance to tell wolves
if (Program.R.Next(100) < Settings.ChanceDetectiveCaught)
{
foreach (var w in Players.Where(x => !x.IsDead && (x.PlayerRole == IRole.Wolf || x.PlayerRole == IRole.AlphaWolf || x.PlayerRole == IRole.WolfCub)))
IRole[] WolfRoles = new[] { IRole.Wolf, IRole.AlphaWolf, IRole.WolfCub, IRole.Lycan };
foreach (var w in Players.Where(x => !x.IsDead && WolfRoles.Contains(x.PlayerRole)))
{
Send(GetLocaleString("DetectiveCaught", $"{detect.GetName()}"), w.Id);
}
Expand Down Expand Up @@ -2451,6 +2451,10 @@ private void NightCycle()
foreach (var m in Players.Where(x => x.PlayerRole == IRole.Mason & !x.IsDead && x.Id != p.Id))
Send(GetLocaleString("MasonConverted", p.GetName()), m.Id);

else if (p.PlayerRole == IRole.Cultist)
foreach (var m in Players.Where(x => x.PlayerRole == IRole.Cultist & !x.IsDead && x.Id != p.Id))
Send(GetLocaleString("CultistBitten", p.GetName()), m.Id);

p.Bitten = false;
p.PlayerRole = IRole.Wolf;
p.Team = ITeam.Wolf;
Expand Down Expand Up @@ -3640,6 +3644,7 @@ private bool CheckForGameEnd(bool checkbitten = false)
case IRole.Wolf:
case IRole.WolfCub:
case IRole.AlphaWolf:
case IRole.Lycan:
return DoGameEnd(ITeam.Wolf);
case IRole.CultistHunter:
var cultist = alivePlayers.FirstOrDefault(x => x.PlayerRole == IRole.Cultist);
Expand Down Expand Up @@ -4327,7 +4332,7 @@ public void HunterFinalShot(IPlayer hunter, KillMthd method)
if (killed.PlayerRole == IRole.WolfCub)
WolfCubKilled = true;
killed.TimeDied = DateTime.Now;
if (killed.PlayerRole == IRole.Wolf || killed.PlayerRole == IRole.AlphaWolf || killed.PlayerRole == IRole.WolfCub || killed.PlayerRole == IRole.SerialKiller)
if (killed.PlayerRole == IRole.Wolf || killed.PlayerRole == IRole.AlphaWolf || killed.PlayerRole == IRole.WolfCub || killed.PlayerRole == IRole.SerialKiller || killed.PlayerRole == IRole.Lycan)
AddAchievement(hunter, Achievements.HeyManNiceShot);

DBKill(hunter, killed, KillMthd.HunterShot);
Expand Down