Ejemplo n.º 1
0
        public void PickUpItem(Companion ob)
        {
            if (!CanPickUpItem(ob.CompanionOwner))
            {
                return;
            }

            long amount = 0;

            if (Account != null && Item.Info.Effect == ItemEffect.Gold && Account.GuildMember != null && Account.GuildMember.Guild.GuildTax > 0)
            {
                amount = (long)Math.Ceiling(Item.Count * Account.GuildMember.Guild.GuildTax);
            }

            ItemCheck check = new ItemCheck(Item, Item.Count - amount, Item.Flags, Item.ExpireTime);

            if (ob.CanGainItems(false, check))
            {
                if (amount > 0)
                {
                    Item.Count -= amount;

                    Account.GuildMember.Guild.GuildFunds  += amount;
                    Account.GuildMember.Guild.DailyGrowth += amount;

                    Account.GuildMember.Guild.DailyContribution += amount;
                    Account.GuildMember.Guild.TotalContribution += amount;

                    Account.GuildMember.DailyContribution += amount;
                    Account.GuildMember.TotalContribution += amount;

                    foreach (GuildMemberInfo member in Account.GuildMember.Guild.Members)
                    {
                        if (member.Account.Connection?.Player == null)
                        {
                            continue;
                        }

                        member.Account.Connection.Enqueue(new S.GuildMemberContribution {
                            Index = Account.GuildMember.Index, Contribution = amount, ObserverPacket = false
                        });
                    }
                }

                Item.UserTask?.Objects.Remove(this);

                ob.GainItem(Item);
                Despawn();
                return;
            }

            //Get Max Carry of type
            //Reduce Amount by type.
            //Send updated floor counts
            //Gain New / partial items
            return;
        }