-
-
Notifications
You must be signed in to change notification settings - Fork 10
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
5 changed files
with
47 additions
and
17 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,24 +1,39 @@ | ||
using CounterStrikeSharp.API.Core; | ||
using CounterStrikeSharp.API; | ||
using CounterStrikeSharp.API.Core; | ||
using CounterStrikeSharp.API.Modules.Utils; | ||
using GangsAPI.Data; | ||
using GangsAPI.Services; | ||
using Jailbreak.Public; | ||
using Jailbreak.Public.Mod.RTD; | ||
using Microsoft.Extensions.DependencyInjection; | ||
|
||
namespace Jailbreak.RTD.Rewards; | ||
|
||
public class CreditReward(int credits) : IRTDReward { | ||
public static readonly string PREFIX = | ||
$" {ChatColors.Purple}[{ChatColors.LightPurple}RTD{ChatColors.Purple}]"; | ||
|
||
public string Name => credits + " Credit"; | ||
|
||
public string Description | ||
=> "You won " + credits + " credit" + (credits == 1 ? "" : "s") | ||
+ (credits > 500 ? "!" : "."); | ||
|
||
public bool Enabled => false; // TODO: Implement | ||
public bool Enabled => API.Gangs != null; | ||
|
||
public bool PrepareReward(int userid) { | ||
// TODO: When we do implement, set their credits here | ||
return true; | ||
} | ||
public bool PrepareReward(CCSPlayerController player) { | ||
var eco = API.Gangs?.Services.GetService<IEcoManager>(); | ||
if (eco == null) return false; | ||
var wrapper = new PlayerWrapper(player); | ||
eco.Grant(wrapper, credits, true, "RTD"); | ||
|
||
if (Math.Abs(credits) >= 5000) { | ||
Server.PrintToChatAll( | ||
$"{PREFIX} {ChatColors.Yellow}{wrapper.Name} {ChatColors.Default}won the jackpot of {ChatColors.Green}{credits} {ChatColors.Default}credits!"); | ||
} | ||
|
||
public bool GrantReward(CCSPlayerController player) { | ||
// We would have already set their credits in PrepareReward, so do nothing here | ||
return true; | ||
} | ||
|
||
public bool GrantReward(CCSPlayerController player) { return true; } | ||
} |