Beispiel #1
0
        /// <summary>
        ///     Pull values from the player, based on this state.
        /// </summary>
        public bool Pull()
        {
            if (Owner == null || Owner.Deleted)
            {
                return(false);
            }

            #region BankBox

            if (Owner.BankBox == null || Owner.BankBox.Deleted)
            {
                Owner.BankBox = new BankBox(Owner, Expansion);
            }

            if (Owner.BankBox.Expansion != Expansion)
            {
                if (Owner.BankBox.Expansion != Expansion.None)
                {
                    Owner.BankBox = Owner.BankBoxes.FirstOrDefault(b => b.Expansion == Expansion) ??
                                    BankBox ?? new BankBox(Owner, Expansion);
                }
                else
                {
                    Owner.BankBox.Expansion = Expansion;
                }
            }

            BankBox = Owner.BankBox;

            BankBox.UpdateTotals();

            #endregion

            #region Backpack

            if (Owner.Backpack == null || Owner.Backpack.Deleted)
            {
                Owner.Backpack = new Backpack(Expansion);
            }

            if (Owner.Backpack.Expansion != Expansion)
            {
                if (Owner.Backpack.Expansion != Expansion.None)
                {
                    Owner.Backpack = Owner.Backpacks.FirstOrDefault(b => b.Expansion == Expansion) ??
                                     Backpack ?? new Backpack(Expansion);
                }
                else
                {
                    Owner.Backpack.Expansion = Expansion;
                }
            }

            Backpack = Owner.Backpack;

            Backpack.UpdateTotals();

            #endregion

            StatCap = Owner.StatCap;

            RawStr = Owner.RawStr;
            RawDex = Owner.RawDex;
            RawInt = Owner.RawInt;

            SkillsCap = Owner.SkillsCap;

            Skills.For(
                (i, s) =>
            {
                Skill sk = Owner.Skills[i];

                s.SetCap(sk.Cap);
                s.SetBase(sk.Base, true, false);
            });

            return(true);
        }