Skip to content

DLL - Currency System

by StreamUP
DLL

User Points Management

Adds points to a user by their ID.

cs
long AddUserPointsById(
    string userId, 
    Platform platform, 
    long pointsToAdd, 
    string varName = "points"
)

Adds points to a user by their username.

cs
long AddUserPointsByUser(
    string user, 
    Platform platform, 
    long pointsToAdd, 
    string varName = "points"
    
    )

Sets the points for a user by their ID.

cs
void SetUserPointsById(
    string userId, 
    Platform platform, 
    long points, 
    string varName = "points"
)

Sets the points for a user by their username.

cs
void SetUserPointsByUser(
    string user, 
    Platform platform, 
    long points, 
    string varName = "points"
)

Data Classes

Represents a user on the leaderboard.

cs
public class LeaderboardUser
{
    public string UserId { get; set; }
    public string UserName { get; set; }
    public string UserType { get; set; }
    public long Points { get; set; }
    public int Position { get; set; }
}

Represents a YouTube user.

cs
public class YouTubeUser
{
    public string UserId { get; set; }
    public string UserName { get; set; }
}

Represents a currency user.

cs
[Serializable()]
public class CurrencyUser
{
    public string UserName {get; set;}
    public string UserId {get; set;}
    public Platform Platform {get; set;}
}

Bet and Prize Calculation

Calculates the bet size based on input and constraints.

cs
long GetBetSize(
    string input, 
    long currentPoints, 
    long minBet, 
    long maxBet, 
    long defaultBet, 
    bool rangeError
)

Calculates the prize size based on input and constraints.

cs
long GetPrizeSize(
    string input, 
    long minPrize, 
    long maxPrize, 
    long defaultPrize, 
    bool rangeError
)

Affordability Checks

Checks if a user can afford a cost by their ID.

cs
bool CanUserAffordById(
    string userId, 
    long cost, 
    Platform platform, 
    string varName = "points"
)

Checks if a user can afford a cost by their username.

cs
bool CanUserAffordByName(
    string user, 
    long cost, 
    Platform platform, 
    string varName = "points"
)

User Points Retrieval

Gets the points for a user by their ID.

cs
long GetUserPointsById(string userId, Platform platform, string varName = "points")

Gets the points for a user by their username.

cs
long GetUserPointsByUser(string user, Platform platform, string varName = "points")

User Lists and Leaderboards

Gets all users with points for a given variable name.

cs
List<UserVariableValue<string>> GetAllPointUsers(string varName = "points")

Gets leaderboard users, excluding specified users.

cs
List<LeaderboardUser> GetLeaderboardUsers(
    List<UserVariableValue<long>> currentUsers, 
    List<GroupUser> excludedUsers
)

Gets YouTube users for a given input and variable name.

cs
List<YouTubeUser> GetYouTubeUsers(string input, string varName = "points")

Bulk Points Operations

Adds points to all users.

cs
int AddPointsToAllUsers(long pointsToAdd, string varName = "points")

Sets points to all users.

cs
int SetPointsToAllUsers(long pointsToSet, string varName = "points")

Resets group users' points.

cs
void ResetGroupUsers(List<GroupUser> users, string varName = "points")

Timed and Default Handlers

Adds timed points to users for a platform.

cs
bool AddTimedPoints(
    long pointsToAdd, 
    string platformString, 
    string varName = "points"
)

Handles default point logic for a user.

cs
bool DefaultPointHandler(
    string userId, 
    Platform platform, 
    long points, 
    out long newPoints, 
    string varName = "points"
)