Esempio n. 1
0
        /// <summary>
        /// Increase NPCObj counter for creature
        /// by Mobile.Id
        /// 24.09.05
        /// </summary>
        public int IncreaseNpcObj(int id)
        {
            int result = 0;

            if (HaveNPCObj)               // optimisation
            {
                NPCObjective npc = activeQuest.NPCObjectives.GetById(id);
                if (npc != null)                  // for quest need this item
                {
                    if (npcobj.ContainsKey(id))
                    {
                        int curr = (int)(npcobj[id]);
                        if (curr < npc.Amount)
                        {
                            curr++;
                            npcobj[id] = curr;
                        }
                        result = curr;
                    }
                    else
                    {
                        npcobj.Add(id, (int)1);
                        result = 1;
                    }
                }
            }
            return(result);
        }
Esempio n. 2
0
        /// <summary>
        /// NPC Objective by id if exist
        /// </summary>
        public NPCObjective GetById(int id)
        {
            NPCObjective result = null;

            foreach (NPCObjective npc in _items)
            {
                if (npc.Id2 == id)
                {
                    result = npc; break;
                }
            }
            return(result);
        }
Esempio n. 3
0
        /// <summary>
        /// Amount of NPC Objectives
        /// by Mobile.Id
        /// 24.09.05
        /// </summary>
        public int NpcObjAmount(int id)
        {
            int result = -1;

            if (HaveNPCObj)               // optimisation
            {
                NPCObjective npc = activeQuest.NPCObjectives.GetById(id);
                if (npc != null)
                {
                    result = npc.Amount;
                }
            }
            return(result);
        }
Esempio n. 4
0
        /// <summary>
        /// Amount of current NPC Objectives
        /// by Mobile.Id
        /// 24.09.05
        /// </summary>
        public int NpcObjCurrentAmount(int id)
        {
            int result = 0;

            if (HaveNPCObj)               // optimisation
            {
                NPCObjective npc = activeQuest.NPCObjectives.GetById(id);
                if (npc != null)                  // for quest need this item
                {
                    if (npcobj.ContainsKey(id))
                    {
                        result = (int)npcobj[id];
                    }
                }
            }
            return(result);
        }
Esempio n. 5
0
 /// <summary>
 /// Add new NPC Objective
 /// </summary>
 public void Add(NPCObjective npco)
 {
     if (npco.TypeObj == TypeNpcObj.Mobile)
     {                   //if Mobile
         if (npco.ExistsInWorld)
         {               // exists in world
             if (CanAdd) //can be added
             {
                 _items.Add(npco);
             }
         }
         else
         {
             BadIdList.AddMobileId(npco.Id);                   //add to bad statistic list
         }
     }
     //else // GameObject objective (not supported yet)
     //{
     //}
 }
Esempio n. 6
0
 /// <summary>
 /// Add new NPC Objective
 /// </summary>
 public void Add( NPCObjective npco )
 {
     if ( npco.TypeObj == TypeNpcObj.Mobile )
     {//if Mobile
         if ( npco.ExistsInWorld )
         {// exists in world
             if ( CanAdd )//can be added
                 _items.Add( npco );
         }
         else BadIdList.AddMobileId( npco.Id );//add to bad statistic list
     }
     //else // GameObject objective (not supported yet)
     //{
     //}
 }