Skip to content

Commit

Permalink
Fix parity
Browse files Browse the repository at this point in the history
  • Loading branch information
MSWS committed Sep 6, 2024
1 parent 968749e commit 7cf2cd7
Show file tree
Hide file tree
Showing 8 changed files with 76 additions and 36 deletions.
4 changes: 2 additions & 2 deletions mod/Jailbreak.RTD/AutoRTD.cs
Original file line number Diff line number Diff line change
Expand Up @@ -96,8 +96,8 @@ public void Command_AutoRTD(CCSPlayerController? executor, CommandInfo info) {
await cookie.Set(steam, enable ? "Y" : "N");
Server.NextFrame(() => {
if (!executor.IsValid) return;
locale.AutoRTDToggled(!enable).ToChat(executor);
cachedCookies[steam] = !enable;
locale.AutoRTDToggled(enable).ToChat(executor);
cachedCookies[steam] = enable;
});
});
}
Expand Down
50 changes: 26 additions & 24 deletions mod/Jailbreak.RTD/RewardGenerator.cs
Original file line number Diff line number Diff line change
Expand Up @@ -34,51 +34,53 @@ public void Start(BasePlugin basePlugin) {
(new NothingReward(), PROB_VERY_OFTEN),

// Often
(new WeaponReward(basePlugin, "weapon_healthshot"), PROB_OFTEN),
(new WeaponReward(basePlugin, "weapon_decoy"), PROB_OFTEN),
(new WeaponReward("weapon_healthshot"), PROB_OFTEN),
(new WeaponReward("weapon_decoy"), PROB_OFTEN),
(new HPReward(110), PROB_OFTEN), (new ArmorReward(15), PROB_OFTEN),

// Medium
(new CreditReward(1), PROB_MEDIUM), (new CreditReward(2), PROB_MEDIUM),
(new CreditReward(3), PROB_MEDIUM),
(new WeaponReward(basePlugin, "weapon_flashbang"), PROB_MEDIUM),
(new WeaponReward(basePlugin, "weapon_hegrenade"), PROB_MEDIUM),
(new WeaponReward(basePlugin, "weapon_smokegrenade"), PROB_MEDIUM),
(new WeaponReward(basePlugin, "weapon_molotov"), PROB_MEDIUM),
(new WeaponReward(basePlugin, "weapon_taser"), PROB_MEDIUM),
(new WeaponReward("weapon_flashbang"), PROB_MEDIUM),
(new WeaponReward("weapon_hegrenade"), PROB_MEDIUM),
(new WeaponReward("weapon_smokegrenade"), PROB_MEDIUM),
(new WeaponReward("weapon_molotov"), PROB_MEDIUM),
(new WeaponReward("weapon_taser"), PROB_MEDIUM),
(new HPReward(150), PROB_MEDIUM), (new HPReward(50), PROB_MEDIUM),
(new ArmorReward(150), PROB_MEDIUM),
(new GuaranteedWardenReward(warden), PROB_MEDIUM),
(new WeaponReward(basePlugin, "weapon_g3sg1", CsTeam.CounterTerrorist),
PROB_MEDIUM),
(new WeaponReward("weapon_g3sg1", CsTeam.CounterTerrorist), PROB_MEDIUM),

// Low
(new ChatSpyReward(basePlugin), PROB_LOW), (new HPReward(1), PROB_LOW),
(new ChatSpyReward(basePlugin), PROB_LOW),
(new ColorReward(Color.FromArgb(0, 255, 0), true), PROB_LOW),
(new ColorReward(Color.FromArgb(255, 0, 0), true), PROB_LOW),
(new CannotPickupReward(basePlugin, WeaponType.GRENADE), PROB_LOW),
(new CannotPickupReward(basePlugin, WeaponType.UTILITY), PROB_LOW),
(new CannotPickupReward(basePlugin, WeaponType.GRENADE | WeaponType.UTILITY),
PROB_LOW),
(new CannotUseReward(basePlugin, WeaponType.GRENADE), PROB_LOW),
(new CannotScope(basePlugin), PROB_LOW),
(new CannotRightKnife(basePlugin), PROB_LOW),
(new TransparentReward(), PROB_LOW),
(new AmmoWeaponReward(basePlugin, "weapon_glock", 2, 0), PROB_LOW),
(new AmmoWeaponReward(basePlugin, "weapon_negev", 0, 5), PROB_LOW),
(new AmmoWeaponReward("weapon_glock", 2, 0), PROB_LOW),
(new AmmoWeaponReward("weapon_negev", 0, 5), PROB_LOW),
(new CannotUseReward(basePlugin, WeaponType.SNIPERS), PROB_LOW),
(new CannotUseReward(basePlugin, WeaponType.HEAVY), PROB_LOW),
(new HPReward(1), PROB_LOW / 2),

// Very low
(new FakeBombReward(), PROB_VERY_LOW * 2),
(new CannotLeftKnife(basePlugin), PROB_VERY_LOW),
(new NoWeaponReward(), PROB_VERY_LOW),
(new AmmoWeaponReward(basePlugin, "weapon_deagle", 1, 0), PROB_VERY_LOW),
(new CannotPickupReward(basePlugin, WeaponType.PISTOLS), PROB_VERY_LOW),
(new CannotPickupReward(basePlugin, WeaponType.SNIPERS), PROB_VERY_LOW),
(new CannotPickupReward(basePlugin, WeaponType.HEAVY), PROB_VERY_LOW),
(new AmmoWeaponReward("weapon_deagle", 1, 0), PROB_VERY_LOW),
(new CannotUseReward(basePlugin, WeaponType.SMGS), PROB_VERY_LOW),
(new CannotUseReward(basePlugin, WeaponType.PISTOLS), PROB_VERY_LOW),
(new RandomTeleportReward(mgr), PROB_VERY_LOW),
(new BombReward(bomb), PROB_VERY_LOW),
(new CannotUseReward(basePlugin, WeaponType.UTILITY), PROB_VERY_LOW),
(new AmmoWeaponReward("weapon_awp", 1, 0), PROB_VERY_LOW / 2),

// Extremely low
(new AmmoWeaponReward(basePlugin, "weapon_awp", 1, 0),
PROB_EXTREMELY_LOW),
(new CannotPickupReward(basePlugin, WeaponType.RIFLES),
PROB_EXTREMELY_LOW),
(new AmmoWeaponReward("weapon_awp", 3, 0), PROB_EXTREMELY_LOW),
(new WeaponReward("weapon_glock"), PROB_EXTREMELY_LOW),
(new CannotUseReward(basePlugin, WeaponType.GUNS), PROB_EXTREMELY_LOW),

// Lottery
(new CreditReward(10000), PROB_LOTTERY)
Expand Down
5 changes: 2 additions & 3 deletions mod/Jailbreak.RTD/Rewards/AmmoWeaponReward.cs
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,8 @@ namespace Jailbreak.RTD.Rewards;
public class AmmoWeaponReward : WeaponReward {
private readonly int primary, secondary;

public AmmoWeaponReward(BasePlugin plugin, string weapon, int primary,
int secondary, CsTeam requiredTeam = CsTeam.Terrorist) : base(plugin,
weapon, requiredTeam) {
public AmmoWeaponReward(string weapon, int primary, int secondary,
CsTeam requiredTeam = CsTeam.Terrorist) : base(weapon, requiredTeam) {
Trace.Assert(Tag.GUNS.Contains(weapon));
this.primary = primary;
this.secondary = secondary;
Expand Down
28 changes: 28 additions & 0 deletions mod/Jailbreak.RTD/Rewards/CannotLeftKnife.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
using CounterStrikeSharp.API;
using CounterStrikeSharp.API.Core;
using Jailbreak.Public.Extensions;
using Jailbreak.Public.Mod.RTD;

namespace Jailbreak.RTD.Rewards;

public class CannotLeftKnife(BasePlugin plugin)
: AbstractOnTickReward(plugin) {
private readonly HashSet<int> blockedPlayerIDs = [];

public override string Name => "Cannot Left-Knife";

public override string Description
=> "You will not be able to left-click knife next round.";

override protected void tick(CCSPlayerController player) {
if (!player.IsReal()) return;
var pawn = player.PlayerPawn.Value;
if (pawn == null || !pawn.IsValid) return;
var weaponServices = pawn.WeaponServices;
if (weaponServices == null) return;
var activeWeapon = weaponServices.ActiveWeapon.Value;
if (activeWeapon == null || !activeWeapon.IsValid) return;
if (activeWeapon.DesignerName != "weapon_knife") return;
activeWeapon.NextPrimaryAttackTick = Server.TickCount + 500;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -6,15 +6,15 @@

namespace Jailbreak.RTD.Rewards;

public class CannotPickupReward : AbstractOnTickReward {
public class CannotUseReward : AbstractOnTickReward {
private readonly ImmutableHashSet<string> blockedWeapons;

public CannotPickupReward(BasePlugin plugin, WeaponType blocked) : this(
public CannotUseReward(BasePlugin plugin, WeaponType blocked) : this(
plugin, blocked.GetItems().ToArray()) {
NameShort = blocked.ToString().ToTitleCase();
}

public CannotPickupReward(BasePlugin plugin, params string[] weapons) : base(
public CannotUseReward(BasePlugin plugin, params string[] weapons) : base(
plugin) {
blockedWeapons = weapons.ToImmutableHashSet();
NameShort = string.Join(", ",
Expand Down
11 changes: 11 additions & 0 deletions mod/Jailbreak.RTD/Rewards/FakeBombReward.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
using CounterStrikeSharp.API.Modules.Utils;
using Jailbreak.Public.Mod.RTD;

namespace Jailbreak.RTD.Rewards;

public class FakeBombReward() : WeaponReward("weapon_c4") {
public override string Name => "Fake Bomb";

public override string Description
=> "You will spawn with a fake bomb next round.";
}
7 changes: 3 additions & 4 deletions mod/Jailbreak.RTD/Rewards/WeaponReward.cs
Original file line number Diff line number Diff line change
Expand Up @@ -12,16 +12,15 @@ public class WeaponReward : IRTDReward {
protected readonly string weapon;
protected CsTeam? requiredTeam;

public WeaponReward(BasePlugin plugin, string weapon,
CsTeam? requiredTeam = CsTeam.Terrorist) {
public WeaponReward(string weapon, CsTeam? requiredTeam = CsTeam.Terrorist) {
this.requiredTeam = requiredTeam;
this.weapon = weapon;
Trace.Assert(new ItemValidator().Validate(weapon, out var error), error);
}

public string Name => weapon.GetFriendlyWeaponName();
public virtual string Name => weapon.GetFriendlyWeaponName();

public string Description
public virtual string Description
=> "You won a"
+ (weapon.GetFriendlyWeaponName()[0].IsVowel() ? "n" : "" + " ")
+ weapon.GetFriendlyWeaponName() + " next round.";
Expand Down
1 change: 1 addition & 0 deletions mod/Jailbreak.SpecialDay/SpecialDays/SpeedrunDay.cs
Original file line number Diff line number Diff line change
Expand Up @@ -141,6 +141,7 @@ public override void Setup() {
// Needed since players who respawned are given knife later
foreach (var player in PlayerUtil.GetAlive()) {
player.RemoveWeapons();
if (player.Slot == speedrunner.Slot) continue;
player.SetColor(Color.FromArgb(100, 255, 255, 255));
}
};
Expand Down

0 comments on commit 7cf2cd7

Please sign in to comment.