Beispiel #1
0
        /// <summary>
        /// Increase status of delivery quest item
        /// by Item.Id
        /// 24.09.05
        /// need correction (amount of item)
        /// </summary>
        public int IncreaseDelivery(int id)
        {
            int result = 0;

            if (HaveDeliveryObj)               // optimisation
            {
                DeliveryObjective d = activeQuest.DeliveryObjectives.GetById(id);
                if (d != null)                  // for quest need this item
                {
                    if (delivery.ContainsKey(id))
                    {
                        int curr = (int)delivery[id];
                        if (curr < d.Amount)
                        {
                            //curr += it.MaxCount;
                            curr++;
                            delivery[id] = curr;
                            result       = curr;
                        }
                    }
                    else
                    {
                        delivery.Add(id, (int)1);
                        result = 1;
                    }
                }
            }
            return(result);
        }
Beispiel #2
0
        /// <summary>
        /// Delivery Objective by id if exist
        /// </summary>
        public DeliveryObjective GetById(int id)
        {
            DeliveryObjective result = null;

            foreach (DeliveryObjective d in _items)
            {
                if (d.Id == id)
                {
                    result = d; break;
                }
            }
            return(result);
        }
Beispiel #3
0
 /// <summary>
 /// Add new DeliveryObjective
 /// </summary>
 public void Add(DeliveryObjective d)
 {
     if (d.ExistsInWorld)
     {
         if (CanAdd)
         {
             _items.Add(d);
         }
     }
     else
     {
         BadIdList.AddItemId(d.Id);
     }
 }
Beispiel #4
0
        /// <summary>
        /// Amount of deliveryObjectives needed
        /// by Item.Id
        /// 24.09.05
        /// </summary>
        public int DeliveryAmount(int id)
        {
            int result = -1;

            if (HaveDeliveryObj)               // optimisation
            {
                DeliveryObjective d = activeQuest.DeliveryObjectives.GetById(id);
                if (d != null)                  // for quest need this item
                {
                    result = d.Amount;
                }
            }
            return(result);
        }
Beispiel #5
0
        /// <summary>
        /// Amount of deliveryObjectives needed
        /// by Item.Id
        /// 24.09.05
        /// </summary>
        public int DeliveryCurrentAmount(int id)
        {
            int result = 0;

            if (HaveDeliveryObj)               // optimisation
            {
                DeliveryObjective d = activeQuest.DeliveryObjectives.GetById(id);
                if (d != null)                  // for quest need this item
                {
                    if (delivery.ContainsKey(id))
                    {
                        result = (int)delivery[id];
                    }
                }
            }
            return(result);
        }
Beispiel #6
0
        /// <summary>
        /// Check item need for this quest
        /// by Item.Id
        /// 24.09.05
        /// </summary>
        public bool NeedItem(int id)
        {
            bool result = false;

            if (HaveDeliveryObj)               // optimisation
            {
                DeliveryObjective d = activeQuest.DeliveryObjectives.GetById(id);
                if (d != null)                  // for quest need this item
                {
                    if (delivery.ContainsKey(id))
                    {
                        result = ((int)delivery[id]) < d.Amount;
                    }
                    else
                    {
                        result = true;
                    }
                }
            }
            return(result);
        }
Beispiel #7
0
 /// <summary>
 /// Add new DeliveryObjective
 /// </summary>
 public void Add( DeliveryObjective d )
 {
     if ( d.ExistsInWorld )
     {
         if ( CanAdd ) _items.Add( d );
     }
     else BadIdList.AddItemId( d.Id );
 }