public virtual void StoreWeapon_Callback(object state) { object[] args = (object[])state; Mobile from = (Mobile)args[0]; BaseSiegeWeapon weapon = (BaseSiegeWeapon)args[1]; if (weapon == null || weapon.Deleted || from == null) { return; } // make sure that there is only one person nearby IPooledEnumerable moblist = from.Map.GetMobilesInRange(weapon.Location, MinStorageRange); int count = 0; if (moblist != null) { foreach (Mobile m in moblist) { if (m.Player) { count++; } } } moblist.Free(); if (count > 1) { from.SendMessage("Too many players nearby. Storage failed."); return; } // make sure that the player is still next to the weapon if (!from.InRange(weapon.Location, MinStorageRange) || from.Map != weapon.Map) { from.SendLocalizedMessage(500446); // That is too far away. from.SendMessage("{0} not stored.", weapon.Name); return; } // use the crate itemid while stored weapon.ItemID = StoredWeaponID; weapon.Visible = true; weapon.Movable = true; from.AddToBackpack(weapon); // hide the components foreach (AddonComponent i in weapon.Components) { if (i != null) { i.Internalize(); } } from.SendMessage("{0} stored.", weapon.Name); weapon.Storing = false; }
public virtual void DamageTarget_Callback(object state) { object[] args = (object[])state; Mobile from = (Mobile)args[0]; BaseSiegeWeapon weapon = (BaseSiegeWeapon)args[1]; IEntity target = (IEntity)args[2]; Point3D targetloc = (Point3D)args[3]; Item pitem = (Item)args[4]; ISiegeProjectile projectile = pitem as ISiegeProjectile; if (projectile != null) { projectile.OnHit(from, weapon, target, targetloc); } }
public SiegeTarget(BaseSiegeWeapon weapon, Mobile from, bool checklos) : base(30, true, TargetFlags.None) { m_weapon = weapon; m_from = from; m_checklos = checklos; }