Exemple #1
0
        public virtual void AwardPoints(Mobile from, double points, bool quest = false, bool message = true)
        {
            if (!(from is PlayerMobile) || points <= 0)
            {
                return;
            }

            PlayerMobile pm = from as PlayerMobile;

            if (!PlayerTable.ContainsKey(pm))
            {
                if (!AutoAdd)
                {
                    return;
                }

                PlayerTable[pm] = 0;
                OnPlayerAdded(pm);
            }

            double old = PlayerTable[pm];

            SendMessage(pm, old, points, quest);

            SetPoints(pm, Math.Min(MaxPoints, PlayerTable[pm] + points));
        }
Exemple #2
0
 public void SetPoints(PlayerMobile pm, double points)
 {
     if (PlayerTable.ContainsKey(pm))
     {
         PlayerTable[pm] = points;
     }
 }
Exemple #3
0
        public double GetPoints(Mobile from)
        {
            if (from is PlayerMobile && PlayerTable.ContainsKey(from as PlayerMobile))
            {
                return(PlayerTable[(PlayerMobile)from]);
            }

            return(0.0);
        }
Exemple #4
0
        public virtual void ConvertFromOldSystem(PlayerMobile from, double points)
        {
            if (!PlayerTable.ContainsKey(from))
            {
                if (points > MaxPoints)
                {
                    points = MaxPoints;
                }

                Utility.PushColor(ConsoleColor.Green);
                Console.WriteLine("Converted {0} points for {1} to {2}!", (int)points, from.Name, this.GetType().Name);
                Utility.PopColor();

                PlayerTable[from] = points;
            }
        }
Exemple #5
0
        public virtual bool DeductPoints(Mobile from, double points, bool message = false)
        {
            if (!(from is PlayerMobile) || !PlayerTable.ContainsKey((PlayerMobile)from) || PlayerTable[(PlayerMobile)from] < points)
            {
                return(false);
            }
            else
            {
                PlayerTable[(PlayerMobile)from] -= points;

                if (message)
                {
                    from.SendLocalizedMessage(1115921, String.Format("{0}\t{1}", Name.ToString(), ((int)points).ToString()));  // Your loyalty to ~1_GROUP~ has decreased by ~2_AMOUNT~;Original
                }
            }

            return(true);
        }