public void HandleLootBoxes(PSXAPI.Response.Lootbox[] boxes) { if (boxes != null) { for (int i = 0; i < boxes.Length; i++) { if (boxes[i].Remaining > 0 && boxes[i].Action != PSXAPI.Response.LootboxAction.Opened) { Lootboxes.Add(boxes[i]); } if (boxes[i].Type == PSXAPI.Response.LootboxType.Normal) { NormalBoxes = boxes[i].Remaining; } else if (boxes[i].Type == PSXAPI.Response.LootboxType.Small) { SmallBoxes = boxes[i].Remaining; } if (boxes[i].Action == PSXAPI.Response.LootboxAction.Opened) { if (boxes[i].Rolls != null) { Rewards = boxes[i].Rolls; BoxOpened?.Invoke(Rewards, boxes[i].Type); } } } } // PokeOne's way.... int count = (int)(NormalBoxes + SmallBoxes - oldAmount); if (count > (long)((ulong)oldAmount)) { LootBoxMessage?.Invoke("You gained Loot Box x" + count + "."); RecievedBox?.Invoke(this); } TotalLootBoxes = (int)(NormalBoxes + SmallBoxes); oldAmount = NormalBoxes + SmallBoxes; UpdateFreeLootBox(); }
//PokeOne's way I don't care. public void UpdateFreeLootBox() { string text = ""; TimeSpan t = DateTime.UtcNow - LastUpdated; t = DailyTime - t; if ((DailyBox == null && t.TotalSeconds <= 0.0) || (DailyBox != null && DailyBox.Type == PSXAPI.Response.LootboxType.None)) { if (DailyTime.TotalSeconds > 0.0) { text += t.FormatTimeString(); //if (t.Days > 0) //{ // if (t.Days > 1) // { // text = text + t.Days.ToString() + " days"; // } // else // { // text = text + t.Days.ToString() + " day"; // } //} //else if (t.Hours > 0) //{ // if (t.Hours > 1) // { // text = text + t.Hours.ToString() + " hours"; // } // else // { // text = text + t.Hours.ToString() + " hour"; // } //} //else if (t.Minutes > 0) //{ // if (t.Minutes > 1) // { // text = text + t.Minutes.ToString() + " minutes"; // } // else // { // text = text + t.Minutes.ToString() + " minute"; // } //} //else //{ // text += "< 1 minute"; //} if (t.TotalSeconds > 0.0) { LootBoxMessage?.Invoke("Daily Reset\n" + text); } } } else if (DailyBox != null) { t = DateTime.UtcNow - BoxLastUpdated; t = DailyBox.Timer - t; if (DailyTime.TotalSeconds > 0.0) { text += t.FormatTimeString(); //if (t.Days > 0) //{ // if (t.Days > 1) // { // text = text + t.Days.ToString() + " days"; // } // else // { // text = text + t.Days.ToString() + " day"; // } //} //else if (t.Hours > 0) //{ // if (t.Hours > 1) // { // text = text + t.Hours.ToString() + " hours"; // } // else // { // text = text + t.Hours.ToString() + " hour"; // } //} //else if (t.Minutes > 0) //{ // if (t.Minutes > 1) // { // text = text + t.Minutes.ToString() + " minutes"; // } // else // { // text = text + t.Minutes.ToString() + " minute"; // } //} //else //{ // text += "< 1 minute"; //} if (t.TotalSeconds > 0.0) { //if (text.Contains("1 minute") && !text.Contains("minutes")) //LootBoxMessage?.Invoke("Next Free Lootbox in " + text); } } } }