Beispiel #1
0
        public static void GiveViewersPoints()
        {
            Log.Message($"Total viewers to reward points: {TCText.ColoredText(viewers.Count.ToString(), ColorLibrary.BlueGreen)}");

            if (Ledgers.Instance == null)
            {
                Log.Error("ledger instance null");
                return;
            }

            Ledger activeLedger = Ledgers.ActiveLedger();

            if (activeLedger == null)
            {
                Log.Error("Current Active Ledger is null. Report to mod author.");
                return;
            }

            foreach (Viewer viewer in viewers)
            {
                LedgerRecord ledgerRecord = activeLedger.GetLedgerRecord(viewer.Username, viewer.Service);

                ledgerRecord.PointBalance += ToolkitPointsSettings.pointsPerReward;
            }
        }
Beispiel #2
0
        public static void AddPoints(string username, Service service, int points)
        {
            if (points < 1)
            {
                Log.Error("Cannot add negative or zero points");
                return;
            }

            Ledger ledger = Ledgers.ActiveLedger();

            LedgerRecord ledgerRecord = ledger.GetLedgerRecord(username, service);

            ledgerRecord.PointBalance += points;
        }
Beispiel #3
0
        public void SetDefaultId(int id = 0)
        {
            Ledgers ledgers = Ledgers.Instance;

            if (ledgers.All.Where((l) => l.Id == id).FirstOrDefault() != null)
            {
                SetDefaultId(id + 1);
            }
            else
            {
                Id = id;

                Log.Message($"Created new ledger with Id {id}");
            }
        }
Beispiel #4
0
        public void SetDefaultName(int id = 1)
        {
            Ledgers ledgers = Ledgers.Instance;

            if (ledgers.All.Where((l) => l.Name == $"NewLedger {id}").FirstOrDefault() != null)
            {
                SetDefaultName(id + 1);
            }
            else
            {
                Name = $"NewLedger {id}";

                Log.Message($"Created new Ledger with name {Name}");
            }
        }
Beispiel #5
0
 public static int Balance(string username, Service service)
 {
     return(Ledgers.ActiveLedger().GetViewerBalance(username, service));
 }