示例#1
0
        public void DoLootRoll(int itemNumber, List <PersonViewModel> rollers, List <PersonViewModel> nonRollers, RollType rollType)
        {
            ItemNumber = itemNumber;
            var itemDisplay = PersonItemViewModel.GetDisplay(itemNumber);
            var rollOutput  = new StringBuilder();

            rollOutput.AppendLine($"*** Roll for item {itemDisplay}.  This is a [{rollType}] roll. ***");

            if (rollers.Count == 0)
            {
                rollOutput.AppendLine("No Rollers");
            }
            else
            {
                var rolls = new Dictionary <PersonViewModel, int>();

                foreach (var nonRoller in nonRollers)
                {
                    rollOutput.AppendLine($"{nonRoller.Name} can't roll for this because they have won {nonRoller.GetItemsWon().Count} item(s) so far");
                }

                foreach (var roller in rollers.OrderBy(x => Rng.Next(1, 10000000)))
                {
                    rolls.Add(roller, Rng.Next(1, 10001));
                }

                foreach (var roll in rolls.OrderByDescending(x => x.Value))
                {
                    if (Winner == null)
                    {
                        rollOutput.AppendLine($"{roll.Key.Name} (Won {roll.Key.GetItemsWon().Count} so far) : {rolls[roll.Key]} WINNER!");
                        roll.Key.ItemList.Single(x => x.Index == ItemNumber).IsWon = true;
                        Winner = roll.Key;
                    }
                    else
                    {
                        rollOutput.AppendLine($"{roll.Key.Name} (Won {roll.Key.GetItemsWon().Count} so far) : {rolls[roll.Key]}");
                    }
                }
            }

            if (Winner == null)
            {
                Header = $"{itemDisplay} - (NO ROLLERS)";
            }
            else
            {
                Header = $"{itemDisplay} - {Winner.Name}";
            }

            RollOutput = rollOutput.ToString();
        }
示例#2
0
        public void DoHighGlory(Dictionary <int, List <PersonViewModel> > highGloryDict)
        {
            Header = "High Glory";
            var orderOutput = new StringBuilder();

            orderOutput.AppendLine("High Glory Picks");

            foreach (var highGloryItem in highGloryDict)
            {
                foreach (var person in highGloryItem.Value)
                {
                    foreach (var item in person.ItemList.Where(x => x.IsHighGlory))
                    {
                        orderOutput.AppendLine($"{person.Name} - {PersonItemViewModel.GetDisplay(highGloryItem.Key)}");
                        item.IsWon = true;
                    }
                }
            }

            RollOutput = orderOutput.ToString();
        }