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; }
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."); } }
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; }
private static bool IsDefraggable(BaseLight baseLight) { if (baseLight == null || baseLight.Deleted) { return true; } return false; }
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; } }
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."); } }
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; } }
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(); } } }
public InternalTimer( BaseLight light, TimeSpan delay ) : base(delay) { m_Light = light; }
public InternalTimer(BaseLight light, TimeSpan delay) : base(delay) { m_Light = light; }
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; } }
private static void ConvertLampPost(BaseLight baseLight, ref int count) { if (ConvertLampPost(baseLight)) { count++; } }
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 { } } } }
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; }
public InternalTimer(BaseLight light, TimeSpan delay) : base(delay) { this.m_Light = light; this.Priority = TimerPriority.FiveSeconds; }
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(); } }
public InternalTimer(BaseLight light, TimeSpan delay) : base(delay) { m_Light = light; Priority = TimerPriority.FiveSeconds; }
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; }