Ejemplo n.º 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;
            }
        }
Ejemplo n.º 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;
        }
Ejemplo n.º 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}");
            }
        }
Ejemplo n.º 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}");
            }
        }
Ejemplo n.º 5
0
 public static int Balance(string username, Service service)
 {
     return(Ledgers.ActiveLedger().GetViewerBalance(username, service));
 }