示例#1
0
        /// <summary>
        /// Directly raises the available XP by a specified amount
        /// For debugging purposes only. Normal XP progression should use EarnXP above.
        /// </summary>
        /// <param name="amount">The amount of XP to grant to the player</param>
        /// <param name="passup">If TRUE, additional XP is passed up the allegiance chain</param>
        public void GrantXP(long amount, bool sharable = true, bool fixedAmount = false, bool message = true)
        {
            if (sharable)
            {
                if (Fellowship != null && Fellowship.ShareXP && Fellowship.SharableMembers.Contains(this))
                {
                    Fellowship.SplitXp((ulong)amount, fixedAmount);
                }
                else
                {
                    UpdateXpAndLevel(amount);
                }

                UpdateXpAllegiance(amount);
            }
            else
            {
                UpdateXpAndLevel(amount);
            }

            if (message)
            {
                Session.Network.EnqueueSend(new GameMessageSystemChat($"{amount:N0} experience granted.", ChatMessageType.Advancement));
            }
        }
示例#2
0
        /// <summary>
        /// Directly grants XP to the player, without the XP modifier
        /// </summary>
        /// <param name="amount">The amount of XP to grant to the player</param>
        /// <param name="xpType">The source of the XP being granted</param>
        /// <param name="shareable">If TRUE, this XP can be shared with fellowship members</param>
        public void GrantXP(long amount, XpType xpType, ShareType shareType = ShareType.All)
        {
            if (Fellowship != null && Fellowship.ShareXP && shareType.HasFlag(ShareType.Fellowship))
            {
                // this will divy up the XP, and re-call this function
                // with ShareType.Fellowship removed
                Fellowship.SplitXp((ulong)amount, xpType, shareType, this);
                return;
            }

            UpdateXpAndLevel(amount, xpType);

            // for passing XP up the allegiance chain,
            // this function is only called at the very beginning, to start the process.
            if (shareType.HasFlag(ShareType.Allegiance))
            {
                UpdateXpAllegiance(amount);
            }

            // only certain types of XP are granted to items
            if (xpType == XpType.Kill || xpType == XpType.Quest)
            {
                GrantItemXP(amount);
            }
        }
示例#3
0
        /// <summary>
        /// Directly grants XP to the player, without the XP modifier
        /// </summary>
        /// <param name="amount">The amount of XP to grant to the player</param>
        /// <param name="passup">The source of the XP being granted</param>
        /// <param name="shareable">If TRUE, this XP can be shared with fellowship members</param>
        public void GrantXP(long amount, XpType xpType, bool shareable = true)
        {
            if (shareable && Fellowship != null && Fellowship.ShareXP && Fellowship.ShareableMembers.ContainsKey(Guid.Full))
            {
                // this will divy up the XP, and re-call this function
                // with shareable = false
                Fellowship.SplitXp((ulong)amount, xpType, this);
                return;
            }

            UpdateXpAndLevel(amount);

            // for passing XP up the allegiance chain,
            // this function is only called at the very beginning, to start the process.
            if (xpType != XpType.Allegiance)
            {
                UpdateXpAllegiance(amount);
            }

            // only certain types of XP are granted to items
            if (xpType == XpType.Kill || xpType == XpType.Quest)
            {
                GrantItemXP(amount);
            }
        }
示例#4
0
 public void EarnXP(long amount, bool sharable = true, bool fixedAmount = false)
 {
     if (sharable)
     {
         if (Fellowship != null && Fellowship.ShareXP)
         {
             Fellowship.SplitXp((ulong)amount, fixedAmount);
         }
         else
         {
             UpdateXpAndLevel(amount);
         }
     }
     else
     {
         UpdateXpAndLevel(amount);
     }
 }
示例#5
0
        /// <summary>
        /// Directly grants XP to the player, without the XP modifier
        /// </summary>
        /// <param name="amount">The amount of XP to grant to the player</param>
        /// <param name="xpType">The source of the XP being granted</param>
        /// <param name="shareable">If TRUE, this XP can be shared with fellowship members</param>
        public void GrantXP(long amount, XpType xpType, ShareType shareType = ShareType.All)
        {
            if (IsOlthoiPlayer)
            {
                if (HasVitae)
                {
                    UpdateXpVitae(amount);
                }

                return;
            }

            if (Fellowship != null && Fellowship.ShareXP && shareType.HasFlag(ShareType.Fellowship))
            {
                // this will divy up the XP, and re-call this function
                // with ShareType.Fellowship removed
                Fellowship.SplitXp((ulong)amount, xpType, shareType, this);
                return;
            }

            // Make sure UpdateXpAndLevel is done on this players thread
            EnqueueAction(new ActionEventDelegate(() => UpdateXpAndLevel(amount, xpType)));

            // for passing XP up the allegiance chain,
            // this function is only called at the very beginning, to start the process.
            if (shareType.HasFlag(ShareType.Allegiance))
            {
                UpdateXpAllegiance(amount);
            }

            // only certain types of XP are granted to items
            if (xpType == XpType.Kill || xpType == XpType.Quest)
            {
                GrantItemXP(amount);
            }
        }