Exemplo n.º 1
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);
            }
        }
Exemplo n.º 2
0
 /// <summary>
 /// Directly grants luminance to the player, without any additional luminance modifiers
 /// </summary>
 public void GrantLuminance(long amount, XpType xpType, ShareType shareType = ShareType.All)
 {
     if (Fellowship != null && Fellowship.ShareXP && shareType.HasFlag(ShareType.Fellowship))
     {
         // this will divy up the luminance, and re-call this function
         // with ShareType.Fellowship removed
         Fellowship.SplitLuminance((ulong)amount, xpType, shareType, this);
     }
     else
     {
         AddLuminance(amount, xpType);
     }
 }
Exemplo n.º 3
0
 /// <summary>
 /// To the type of the network share.
 /// </summary>
 /// <param name="shareType">Type of the share.</param>
 /// <returns>NetworkShareType.</returns>
 /// <exception cref="System.ArgumentException">Unknown share type</exception>
 private NetworkShareType ToNetworkShareType(ShareType shareType)
 {
     if (shareType.HasFlag(ShareType.Special))
     {
         return(NetworkShareType.Special);
     }
     if (shareType.HasFlag(ShareType.Device))
     {
         return(NetworkShareType.Device);
     }
     if (shareType.HasFlag(ShareType.Disk))
     {
         return(NetworkShareType.Disk);
     }
     if (shareType.HasFlag(ShareType.IPC))
     {
         return(NetworkShareType.Ipc);
     }
     if (shareType.HasFlag(ShareType.Printer))
     {
         return(NetworkShareType.Printer);
     }
     throw new ArgumentException("Unknown share type");
 }
Exemplo n.º 4
0
 /// <summary>
 /// To the type of the network share.
 /// </summary>
 /// <param name="shareType">Type of the share.</param>
 /// <returns>NetworkShareType.</returns>
 /// <exception cref="System.ArgumentException">Unknown share type</exception>
 private NetworkShareType ToNetworkShareType(ShareType shareType)
 {
     if (shareType.HasFlag(ShareType.Special))
     {
         return NetworkShareType.Special;
     }
     if (shareType.HasFlag(ShareType.Device))
     {
         return NetworkShareType.Device;
     }
     if (shareType.HasFlag(ShareType.Disk))
     {
         return NetworkShareType.Disk;
     }
     if (shareType.HasFlag(ShareType.IPC))
     {
         return NetworkShareType.Ipc;
     }
     if (shareType.HasFlag(ShareType.Printer))
     {
         return NetworkShareType.Printer;
     }
     throw new ArgumentException("Unknown share type");
 }
Exemplo n.º 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);
            }
        }