servuo/Scripts/Items/Internal/EffectMobile.cs
TrueUO 80e0d42d33
Bug Fixes (#4782)
- Whirlwind Attack now does the correct amount of damage.
- Added in new Aqaurium system, with new catchable fish. https://uo.com/wiki/ultima-online-wiki/gameplay/aquariums/
- Fixed an issue where players could get a weird client crash, and be unable to log back in right away, when fighting Beacons.
- Fixed an exploit with RunicReforging. Recommend updating to newest Reforging code.
- Fixed an issue where item stats from equipment sets were not adding their values correctly on Mannequins.
- Fixed an issue where you sometimes had to exit and re-enter a house to get all the items the load correctly.
- Players can now correctly craft Charybdis bait.
- All scale types can now correctly be turned in to community collection Mobiles.cs
- Thieve Consumables from the Monster Stealing system now all work correctly.
- Some more file structure cleanup.

Co-authored-by: TrueUO <knight.daniel.r@gmail.com>
2020-05-16 15:31:52 -07:00

93 lines
2.3 KiB
C#

using System;
using System.Collections.Generic;
namespace Server.Mobiles
{
public class EffectMobile : Mobile
{
public static readonly TimeSpan DefaultDuration = TimeSpan.FromSeconds(1.0);
private static readonly List<EffectMobile> m_Free = new List<EffectMobile>();// List of available EffectMobiles
public EffectMobile(Serial serial)
: base(serial)
{
}
private EffectMobile()
{
CantWalk = true;
Blessed = true;
}
public static EffectMobile Create(Point3D p, Map map, TimeSpan duration)
{
EffectMobile mobile = null;
for (int i = m_Free.Count - 1; mobile == null && i >= 0; --i) // We reuse new entries first so decay works better
{
EffectMobile free = m_Free[i];
m_Free.RemoveAt(i);
if (!free.Deleted && free.Map == Map.Internal)
mobile = free;
}
if (mobile == null)
mobile = new EffectMobile();
mobile.MoveToWorld(p, map);
mobile.BeginFree(duration);
return mobile;
}
public void BeginFree(TimeSpan duration)
{
new FreeTimer(this, duration).Start();
}
public override void Kill()
{
}
public override int Damage(int amount, Mobile from, bool informMount, bool checkDisrupt)
{
return 0;
}
public override void Serialize(GenericWriter writer)
{
base.Serialize(writer);
writer.Write(0); // version
}
public override void Deserialize(GenericReader reader)
{
base.Deserialize(reader);
int version = reader.ReadInt();
Delete();
}
private class FreeTimer : Timer
{
private readonly EffectMobile m_Mobile;
public FreeTimer(EffectMobile mobile, TimeSpan delay)
: base(delay)
{
m_Mobile = mobile;
Priority = TimerPriority.OneSecond;
}
protected override void OnTick()
{
m_Mobile.Internalize();
m_Free.Add(m_Mobile);
}
}
}
}