Exemple #1
0
        /// <summary>
        /// Returns cost type of the guard using reflection, or defaults to Medium. This is the amount of slots required for the guard.
        /// </summary>
        /// <returns></returns>
        public static int GetGuardCostType(KinFactionGuardTypes guardType)
        {
            //Default to medium cost
            int  cost = (int)KinFactionGuardCostTypes.MediumCost;
            Type t    = SpawnerType.GetType(guardType.ToString());

            if (t == null)
            {
                return(cost);
            }
            //Although foreach is used here, there will only be one of these attributes.
            foreach (KinFactionGuardTypeAttribute att in t.GetCustomAttributes(typeof(KinFactionGuardTypeAttribute), true))
            {
                //Use the custom value if it was provided
                if (att.CustomSlotCost > 0)
                {
                    cost = att.CustomSlotCost;
                }
                else
                {
                    cost = (int)att.GuardCostType;
                }
            }
            return(cost);
        }
Exemple #2
0
        /// <summary>
        /// Returns silver guard hire cost based on guard type using reflection
        /// </summary>
        /// <returns></returns>
        public static int GetGuardHireCost(KinFactionGuardTypes guardType)
        {
            //Default to medium cost
            int  cost = KinSystemSettings.GuardTypeMediumSilverCost;
            Type t    = SpawnerType.GetType(guardType.ToString());

            if (t == null)
            {
                return(cost);
            }
            foreach (KinFactionGuardTypeAttribute att in t.GetCustomAttributes(typeof(KinFactionGuardTypeAttribute), true))
            {                    //Although foreach is used here, there will only be one of these attributes.
                //Use the custom value if it was provided
                if (att.CustomHireCost > 0)
                {
                    cost = att.CustomHireCost;
                }
                else
                {
                    switch (att.GuardCostType)
                    {
                    case KinFactionGuardCostTypes.LowCost: cost = KinSystemSettings.GuardTypeLowSilverCost; break;

                    case KinFactionGuardCostTypes.MediumCost: cost = KinSystemSettings.GuardTypeMediumSilverCost; break;

                    case KinFactionGuardCostTypes.HighCost: cost = KinSystemSettings.GuardTypeHighSilverCost; break;
                    }
                }
            }
            return(cost);
        }
Exemple #3
0
        /// <summary>
        /// Initializes a new instance of the <see cref="KinGuardPost"/> class.
        /// </summary>
        /// <param name="itemID">The item ID.</param>
        /// <param name="owner">The owner.</param>
        /// <param name="guardType">Type of the guard.</param>
        /// <param name="city">The city.</param>
        public KinGuardPost(int itemID, PlayerMobile owner, KinFactionGuardTypes guardType, KinFactionCities city)
        {
            this.ItemID = itemID;
            Movable     = false;
            Visible     = true;
            m_City      = city;
            m_Owner     = owner;
            m_GuardType = guardType;
            ArrayList creaturesName = new ArrayList();             //bah *! $ arraylists

            creaturesName.Add(guardType.ToString());

            InitSpawn(1, TimeSpan.FromSeconds(1), TimeSpan.FromSeconds(1), 0, 4, creaturesName);
        }
Exemple #4
0
		/// <summary>
		/// Initializes a new instance of the <see cref="KinGuardPost"/> class.
		/// </summary>
		/// <param name="itemID">The item ID.</param>
		/// <param name="owner">The owner.</param>
		/// <param name="guardType">Type of the guard.</param>
		/// <param name="city">The city.</param>
		public KinGuardPost(int itemID, PlayerMobile owner, KinFactionGuardTypes guardType, KinFactionCities city)			
		{
			this.ItemID = itemID;
			Movable = false;
			Visible = true;
			m_City = city;
			m_Owner = owner;
			m_GuardType = guardType; 
			ArrayList creaturesName = new ArrayList(); //bah *! $ arraylists			
			creaturesName.Add(guardType.ToString()); 

			InitSpawn(1, TimeSpan.FromSeconds(1), TimeSpan.FromSeconds(1), 0, 4, creaturesName);
		}