コード例 #1
0
ファイル: OilFlask.cs プロジェクト: greeduomacro/hubroot
			private static void SetDuration( BaseLight light )
			{
				if( light is Lantern )
					light.Duration = ((Lantern)light).duration;
				else if( light is HangingLantern )
					light.Duration = ((HangingLantern)light).duration;
			}
コード例 #2
0
            protected override void OnTarget(Mobile from, object target)
            {
                if (target is BaseLight)
                {
                    BaseLight light = (BaseLight)target;

                    if (light is Candelabra || light is CandelabraStand || light is CandleSkull || light is HeatingStand || light is WallSconce)
                    {
                        light.HasFuel  = true;
                        light.BurntOut = false;

                        SetDuration(light);

                        from.SendMessage("You mount the candle in the stand.");
                        m_Candle.Delete();
                    }
                    else
                    {
                        from.SendMessage("This will not work with that.");
                    }
                }
                else if (target is Mobile && ((Mobile)target) == from)
                {
                    m_Candle.Ignite();
                }
                else
                {
                    from.SendMessage("This will not work with that.");
                }
            }
コード例 #3
0
        private static bool IsControllable(BaseLight baseLight, EffectsObject eo)
        {
            if (!Data.UseAutoLighting || eo == null || eo.EffectsMap == null || !eo.EffectsMap.UseAutoLighting || (baseLight is TSBaseLight && !((TSBaseLight)baseLight).UseAutoLighting))
            {
                return false;
            }

            return true;
        }
コード例 #4
0
        private static bool IsDefraggable(BaseLight baseLight)
        {
            if (baseLight == null || baseLight.Deleted)
            {
                return true;
            }

            return false;
        }
コード例 #5
0
 private static void SetDuration(BaseLight light)
 {
     if (light is Lantern)
     {
         light.Duration = ((Lantern)light).duration;
     }
     else if (light is HangingLantern)
     {
         light.Duration = ((HangingLantern)light).duration;
     }
 }
コード例 #6
0
            protected override void OnTarget(Mobile from, object target)
            {
                if (target is Lantern || target is HangingLantern)
                {
                    BaseLight light = (BaseLight)target;

                    light.HasFuel  = true;
                    light.BurntOut = false;
                    SetDuration(light);

                    from.SendMessage("You fill the lantern with oil.");
                    m_Flask.Delete();
                }
                else
                {
                    from.SendMessage("Target a lantern.");
                }
            }
コード例 #7
0
 private static void SetDuration(BaseLight light)
 {
     if (light is Candelabra)
     {
         light.Duration = ((Candelabra)light).duration;
     }
     else if (light is CandelabraStand)
     {
         light.Duration = ((CandelabraStand)light).duration;
     }
     else if (light is CandleSkull)
     {
         light.Duration = ((CandleSkull)light).duration;
     }
     else if (light is HeatingStand)
     {
         light.Duration = ((HeatingStand)light).duration;
     }
     else if (light is WallSconce)
     {
         light.Duration = ((WallSconce)light).duration;
     }
 }
コード例 #8
0
        public static void CalculateLightOutage(BaseLight baseLight, EffectsObject eo)
        {
            if (!Data.UseRandomLightOutage || IsDefraggable(baseLight) || !IsControllable(baseLight, eo) || !eo.EffectsMap.UseRandomLightOutage || (baseLight is TSBaseLight && !((TSBaseLight)baseLight).UseRandomLightOutage))
            {
                return;
            }

            int lowNumber = Support.GetRandom(0, (100 - eo.EffectsMap.LightOutageChancePerTick));
            int highNumber = lowNumber + eo.EffectsMap.LightOutageChancePerTick;

            int randomChance = Support.GetRandom(0, 100);

            if (randomChance >= lowNumber && randomChance <= highNumber)
            {
                if (baseLight.Burning)
                {
                    baseLight.Douse();
                }
                else
                {
                    baseLight.Ignite();
                }
            }
        }
コード例 #9
0
ファイル: BaseLight.cs プロジェクト: Ravenwolfe/xrunuo
 public InternalTimer( BaseLight light, TimeSpan delay )
     : base(delay)
 {
     m_Light = light;
 }
コード例 #10
0
ファイル: BaseLight.cs プロジェクト: dpisanu/xrunuo
 public InternalTimer(BaseLight light, TimeSpan delay)
     : base(delay)
 {
     m_Light = light;
 }
コード例 #11
0
        public void DetermineHeatLevel()
        {
            int MaxHeatDistance = 2;

            double BaseLightHeatScalar = 10.0;
            double OpenFireHeatScalar  = 20.0;
            double ForgeHeatScalar     = 30.0;

            double totalHeat = 0;

            if (RootParent == null)
            {
                IPooledEnumerable nearbyHeatSources = Map.GetItemsInRange(Location, MaxHeatDistance);

                foreach (Item item in nearbyHeatSources)
                {
                    double itemHeat = 0;

                    if (item.RootParent != null)
                    {
                        continue;
                    }

                    int    distance   = Utility.GetDistance(Location, item.Location);
                    double heatScalar = ((double)MaxHeatDistance + 1) - (double)distance;

                    if (Math.Abs(Location.Z - item.Location.Z) > 15)
                    {
                        continue;
                    }

                    //Organized by Ascending Priority
                    if (item is BaseLight)
                    {
                        BaseLight baseLight = item as BaseLight;

                        if (baseLight.Burning)
                        {
                            itemHeat = BaseLightHeatScalar * heatScalar;
                        }
                    }

                    if (item is BaseEquipableLight)
                    {
                        BaseEquipableLight candle = item as BaseEquipableLight;

                        if (candle.Burning)
                        {
                            itemHeat = BaseLightHeatScalar * heatScalar;
                        }
                    }

                    if (item is Campfire)
                    {
                        Campfire campfire = item as Campfire;

                        if (campfire.Status == CampfireStatus.Burning || campfire.Status == CampfireStatus.Extinguishing)
                        {
                            itemHeat = OpenFireHeatScalar * heatScalar;
                        }
                    }

                    if (item is Brazier || item is BrazierTall)
                    {
                        BaseLight brazier = item as BaseLight;

                        if (brazier.Burning)
                        {
                            itemHeat = OpenFireHeatScalar * heatScalar;
                        }
                    }

                    if (item is Forge || item is LargeForgeEast || item is LargeForgeWest || item is ForgeComponent)
                    {
                        itemHeat = ForgeHeatScalar * heatScalar;
                    }

                    totalHeat += itemHeat;
                }

                nearbyHeatSources.Free();
            }

            HeatValue = totalHeat;

            if (HeatValue > PlantPersistance.MaxHeat)
            {
                HeatValue = PlantPersistance.MaxHeat;
            }
        }
コード例 #12
0
ファイル: Support.cs プロジェクト: ITLongwell/aedilis2server
 private static void ConvertLampPost(BaseLight baseLight, ref int count)
 {
     if (ConvertLampPost(baseLight))
     {
         count++;
     }
 }
コード例 #13
0
ファイル: Support.cs プロジェクト: ITLongwell/aedilis2server
        private static void CopyProperties(BaseLight baseLight, TSBaseLight tsBaseLight)
        {
            Type type = typeof(BaseLight);

            PropertyInfo[] props = type.GetProperties(BindingFlags.Public | BindingFlags.Instance);

            for (int i = 0; i < props.Length; i++)
            {
                PropertyInfo prop = props[i];

                if (prop.CanRead && prop.CanWrite)
                {
                    try
                    {
                        prop.SetValue(tsBaseLight, prop.GetValue(baseLight, null), null);
                    }
                    catch
                    {
                    }
                }
            }
        }
コード例 #14
0
ファイル: Support.cs プロジェクト: ITLongwell/aedilis2server
        private static bool ConvertLampPost(BaseLight baseLight)
        {
            if (!(baseLight is TSBaseLight))
            {
                TSBaseLight tsBaseLight = null;

                if (baseLight is LampPost1)
                {
                    tsBaseLight = new TSLampPost1();
                }
                else if (baseLight is LampPost2)
                {
                    tsBaseLight = new TSLampPost2();
                }
                else if (baseLight is LampPost3)
                {
                    tsBaseLight = new TSLampPost3();
                }

                if (tsBaseLight != null)
                {
                    CopyProperties(baseLight, tsBaseLight);

                    tsBaseLight.MoveToWorld(baseLight.Location);

                    baseLight.Delete();

                    return true;
                }
            }

            return false;
        }
コード例 #15
0
ファイル: BaseLight.cs プロジェクト: m309/ForkUO
 public InternalTimer(BaseLight light, TimeSpan delay)
     : base(delay)
 {
     this.m_Light = light;
     this.Priority = TimerPriority.FiveSeconds;
 }
コード例 #16
0
 public static void UpdateManagedLight(BaseLight baseLight, int currentLevel)
 {
     if (currentLevel >= Data.LightsOnLevel && !baseLight.Burning)
     {
         baseLight.Ignite();
     }
     else if (currentLevel < Data.LightsOnLevel && baseLight.Burning)
     {
         baseLight.Douse();
     }
 }
コード例 #17
0
ファイル: BaseLight.cs プロジェクト: tflynt91/TrueUO
 public InternalTimer(BaseLight light, TimeSpan delay)
     : base(delay)
 {
     m_Light  = light;
     Priority = TimerPriority.FiveSeconds;
 }
コード例 #18
0
ファイル: Candle.cs プロジェクト: greeduomacro/hubroot
			private static void SetDuration( BaseLight light )
			{
				if( light is Candelabra )
					light.Duration = ((Candelabra)light).duration;
				else if( light is CandelabraStand )
					light.Duration = ((CandelabraStand)light).duration;
				else if( light is CandleSkull )
					light.Duration = ((CandleSkull)light).duration;
				else if( light is HeatingStand )
					light.Duration = ((HeatingStand)light).duration;
				else if( light is WallSconce )
					light.Duration = ((WallSconce)light).duration;
			}