コード例 #1
0
        /// <summary>
        /// Lets the given Character roll for the item at the given index
        /// </summary>
        /// <param name="index"></param>
        /// <param name="type"></param>
        public void Roll(Character chr, uint index, LootRollType type)
        {
            var item = Items[index];

            if (item.RollProgress != null)
            {
                // item is actually being rolled for
                item.RollProgress.Roll(chr, type);

                if (item.RollProgress.IsRollFinished)
                {
                    // handout the item, once the Roll finished
                    var highest = item.RollProgress.HighestParticipant;

                    if (highest != null)
                    {
                        LootHandler.SendRollWon(highest, this, item, item.RollProgress.HighestEntry);
                        HandoutItem(highest, item, null, BaseInventory.INVALID_SLOT);
                    }
                    else
                    {
                        // no one online to receive the item (odd) -> Simply remove it
                        RemoveItem(item);
                    }
                    item.RollProgress.Dispose();
                }
            }
        }
コード例 #2
0
        /// <summary>
        /// Lets the given Character roll for the item at the given index
        /// </summary>
        /// <param name="index"></param>
        /// <param name="type"></param>
        public void Roll(Character chr, uint index, LootRollType type)
        {
            LootItem lootItem = this.Items[index];

            if (lootItem.RollProgress == null)
            {
                return;
            }
            lootItem.RollProgress.Roll(chr, type);
            if (!lootItem.RollProgress.IsRollFinished)
            {
                return;
            }
            Character highestParticipant = lootItem.RollProgress.HighestParticipant;

            if (highestParticipant != null)
            {
                LootHandler.SendRollWon(highestParticipant, this, lootItem, lootItem.RollProgress.HighestEntry);
                this.HandoutItem(highestParticipant, lootItem, (BaseInventory)null, (int)byte.MaxValue);
            }
            else
            {
                this.RemoveItem(lootItem);
            }

            lootItem.RollProgress.Dispose();
        }