/// <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); }
/// <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); }
/// <summary> /// Add new DeliveryObjective /// </summary> public void Add(DeliveryObjective d) { if (d.ExistsInWorld) { if (CanAdd) { _items.Add(d); } } else { BadIdList.AddItemId(d.Id); } }
/// <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); }
/// <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); }
/// <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); }
/// <summary> /// Add new DeliveryObjective /// </summary> public void Add( DeliveryObjective d ) { if ( d.ExistsInWorld ) { if ( CanAdd ) _items.Add( d ); } else BadIdList.AddItemId( d.Id ); }