Example #1
0
        /// <summary>
        /// This gives the money to everyone involved. Will only work the first time its called.
        /// Afterwards <c>IsMoneyLooted</c> will be true.
        /// </summary>
        public void GiveMoney()
        {
            if (this.m_moneyLooted)
            {
                return;
            }
            if (this.Group == null)
            {
                LooterEntry looterEntry = this.Looters.FirstOrDefault <LooterEntry>();
                if (looterEntry != null && looterEntry.Owner != null)
                {
                    this.m_moneyLooted = true;
                    this.SendMoney(looterEntry.Owner, this.Money);
                }
            }
            else
            {
                List <Character> characterList = new List <Character>();
                if (this.UsesRoundRobin)
                {
                    LooterEntry looterEntry = this.Looters.FirstOrDefault <LooterEntry>();
                    if (looterEntry != null && looterEntry.Owner != null)
                    {
                        characterList.Add(looterEntry.Owner);
                        if (this.Lootable is WorldObject)
                        {
                            WorldObject lootable = (WorldObject)this.Lootable;
                        }
                        else
                        {
                            Character owner = looterEntry.Owner;
                        }
                    }
                }
                else
                {
                    foreach (LooterEntry looter in (IEnumerable <LooterEntry>) this.Looters)
                    {
                        if (looter.m_owner != null)
                        {
                            characterList.Add(looter.m_owner);
                        }
                    }
                }

                if (characterList.Count > 0)
                {
                    this.m_moneyLooted = true;
                    uint amount = this.Money / (uint)characterList.Count;
                    foreach (Character character in characterList)
                    {
                        this.SendMoney(character, amount);
                        LootHandler.SendMoneyNotify(character, amount);
                    }
                }
            }

            this.CheckFinished();
        }
Example #2
0
        /// <summary>
        /// This gives the money to everyone involved. Will only work the first time its called.
        /// Afterwards <c>IsMoneyLooted</c> will be true.
        /// </summary>
        public void GiveMoney()
        {
            if (!m_moneyLooted)
            {
                if (Group == null)
                {
                    // we only have a single looter
                    var looter = Looters.FirstOrDefault();
                    if (looter != null && looter.Owner != null)
                    {
                        m_moneyLooted = true;
                        SendMoney(looter.Owner, Money);
                    }
                }
                else
                {
                    var looters = new List <Character>();
                    if (UsesRoundRobin)
                    {
                        // we only added the RoundRobin member, so we have to find everyone in the radius for the money now

                        var looter = Looters.FirstOrDefault();
                        if (looter != null && looter.Owner != null)
                        {
                            looters.Add(looter.Owner);

                            WorldObject center;
                            if (Lootable is WorldObject)
                            {
                                center = (WorldObject)Lootable;
                            }
                            else
                            {
                                center = looter.Owner;
                            }
                        }
                    }
                    else
                    {
                        foreach (var looter in Looters)
                        {
                            if (looter.m_owner != null)
                            {
                                looters.Add(looter.m_owner);
                            }
                        }
                    }

                    if (looters.Count > 0)
                    {
                        m_moneyLooted = true;

                        var amount = Money / (uint)looters.Count;
                        foreach (var looter in looters)
                        {
                            SendMoney(looter, amount);
                            LootHandler.SendMoneyNotify(looter, amount);
                        }
                    }
                }
                CheckFinished();
            }
        }
Example #3
0
        /// <summary>
        /// This gives the money to everyone involved. Will only work the first time its called.
        /// Afterwards <c>IsMoneyLooted</c> will be true.
        /// </summary>
        public void GiveMoney()
        {
            if (!m_moneyLooted)
            {
                if (Group == null)
                {
                    // we only have a single looter
                    var looter = Looters.FirstOrDefault();
                    if (looter != null && looter.Owner != null)
                    {
                        m_moneyLooted = true;
                        SendMoney(looter.Owner, Money);
                    }
                }
                else
                {
                    var looters = new List <Character>();
                    if (UsesRoundRobin)
                    {
                        // we only added the RoundRobin member, so we have to find everyone in the radius for the money now

                        var looter = Looters.FirstOrDefault();
                        if (looter != null && looter.Owner != null)
                        {
                            looters.Add(looter.Owner);

                            WorldObject center;
                            if (Lootable is WorldObject)
                            {
                                center = (WorldObject)Lootable;
                            }
                            else
                            {
                                center = looter.Owner;
                            }

                            GroupMember otherMember;
                            var         chrs = center.GetObjectsInRadius(LootMgr.LootRadius, ObjectTypes.Player, false, 0);
                            foreach (Character chr in chrs)
                            {
                                if (chr.IsAlive && (chr == looter.Owner ||
                                                    ((otherMember = chr.GroupMember) != null && otherMember.Group == Group)))
                                {
                                    looters.Add(chr);
                                }
                            }
                        }
                    }
                    else
                    {
                        foreach (var looter in Looters)
                        {
                            if (looter.m_owner != null)
                            {
                                looters.Add(looter.m_owner);
                            }
                        }
                    }

                    if (looters.Count > 0)
                    {
                        m_moneyLooted = true;

                        var amount = Money / (uint)looters.Count;
                        foreach (var looter in looters)
                        {
                            SendMoney(looter, amount);
                            LootHandler.SendMoneyNotify(looter, amount);
                        }
                    }
                }
                CheckFinished();
            }
        }