本文整理汇总了C#中Server.Mobile.InLOS方法的典型用法代码示例。如果您正苦于以下问题:C# Mobile.InLOS方法的具体用法?C# Mobile.InLOS怎么用?C# Mobile.InLOS使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Server.Mobile
的用法示例。
在下文中一共展示了Mobile.InLOS方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: OnDoubleClick
public override void OnDoubleClick( Mobile from )
{
if ( !from.InRange( this.GetWorldLocation(), 2 ) || !from.InLOS( this ) )
{
from.LocalOverheadMessage( MessageType.Regular, 0x3B2, 1019045 ); // I can't reach that
}
else if ( Visible && ( ItemID == 4656 || ItemID == 4702 ) && DateTime.Now >= m_NextUse )
{
Point3D p = this.GetWorldLocation();
if ( 1 > Utility.Random( Math.Max( Math.Abs( from.X - p.X ), Math.Abs( from.Y - p.Y ) ) ) )
{
Effects.PlaySound( from.Location, from.Map, from.GetHurtSound() );
from.PublicOverheadMessage( MessageType.Regular, from.SpeechHue, true, "Ouch!" );
Spells.SpellHelper.Damage( TimeSpan.FromSeconds( 0.5 ), from, Utility.Dice( 2, 10, 5 ) );
}
Effects.PlaySound( this.GetWorldLocation(), this.Map, 0x387 );
Timer.DelayCall( TimeSpan.FromSeconds( 0.25 ), new TimerCallback( Down1 ) );
Timer.DelayCall( TimeSpan.FromSeconds( 0.50 ), new TimerCallback( Down2 ) );
Timer.DelayCall( TimeSpan.FromSeconds( 5.00 ), new TimerCallback( BackUp ) );
m_NextUse = DateTime.Now + TimeSpan.FromSeconds( 10.0 );
}
}
示例2: OnDoubleClick
public override void OnDoubleClick( Mobile from )
{
Direction dir;
if ( from.Location != this.Location )
dir = from.GetDirectionTo( this );
else if ( this.East )
dir = Direction.West;
else
dir = Direction.North;
from.Direction = dir;
bool canThrow = true;
if ( !from.InRange( this, 4 ) || !from.InLOS( this ) )
canThrow = false;
else if ( this.East )
canThrow = ( dir == Direction.Left || dir == Direction.West || dir == Direction.Up );
else
canThrow = ( dir == Direction.Up || dir == Direction.North || dir == Direction.Right );
if ( canThrow )
Throw( from );
else
from.LocalOverheadMessage( MessageType.Regular, 0x3B2, 1019045 ); // I can't reach that.
}
示例3: DoEffect
public override bool DoEffect( Mobile from, Mobile target )
{
if ( !SpellHelper.HasStatEffect( from, m_Stat ) && from.InLOS( target ) && target.Alive && from.CanBeBeneficial( target ) )
{
from.DoBeneficial( target );
SpellHelper.Turn( from, target );
if ( m_Stat != StatType.All )
{
SpellHelper.AddStatBonus( null, target, m_Stat );
}
else
{
SpellHelper.AddStatBonus( null, target, StatType.Str ); SpellHelper.DisableSkillCheck = true;
SpellHelper.AddStatBonus( null, target, StatType.Dex );
SpellHelper.AddStatBonus( null, target, StatType.Int ); SpellHelper.DisableSkillCheck = false;
}
target.FixedParticles( m_EffIID, m_EffSpd, m_Dur, m_Eff, m_ELayer );
target.PlaySound( m_Snd );
return true;
}
else
{
return false;
}
}
示例4: OnDoubleClick
public override void OnDoubleClick( Mobile from )
{
PlayerMobile pm = from as PlayerMobile;
if ( pm == null )
return;
if ( !from.InLOS( this.GetWorldLocation() ) )
{
from.SendLocalizedMessage( 502800 ); // You can't see that.
return;
}
if ( from.GetDistanceToSqrt( this.GetWorldLocation() ) > 2 )
{
from.SendLocalizedMessage( 500446 ); // That is too far away.
return;
}
if ( pm.Bedlam )
{
BaseCreature.TeleportPets( pm, BedlamEntrance, from.Map );
pm.MoveToWorld( BedlamEntrance, Map );
}
else
{
pm.SendLocalizedMessage( 1074276 ); // You press and push on the iron maiden, but nothing happens.
}
}
示例5: Use
public override bool Use( Mobile from ) {
Faction ourFaction = Faction.Find( from );
bool used = false;
foreach ( Mobile mob in from.GetMobilesInRange( 8 ) ) {
if ( mob.Player && !mob.Alive && from.InLOS( mob ) ) {
if ( Faction.Find( mob ) != ourFaction ) {
continue;
}
BaseHouse house = BaseHouse.FindHouseAt( mob );
if ( house == null || ( house.IsFriend( from ) || house.IsFriend( mob ) ) ) {
Faction.ClearSkillLoss( mob );
mob.SendGump( new ResurrectGump( mob, from, ResurrectMessage.Generic ) );
used = true;
}
}
}
if ( used ) {
from.LocalOverheadMessage( Server.Network.MessageType.Regular, 2219, false, "The urn shatters as you invoke its power." );
from.PlaySound( 64 );
Effects.PlaySound( from.Location, from.Map, 1481 );
}
return used;
}
示例6: GetContextMenuEntries
public override void GetContextMenuEntries( Mobile from, List<ContextMenuEntry> list )
{
base.GetContextMenuEntries( from, list );
if ( ( from == m_owner ) && from.InLOS( this ) )
list.Add( new DismissCRVendorEntry( this ) );
}
示例7: Effect
public static void Effect( Mobile attacker, Mobile defender, int featlevel )
{
IKhaerosMobile featuser = attacker as IKhaerosMobile;
ArrayList list = new ArrayList();
foreach( Mobile m in defender.GetMobilesInRange( featlevel + 2 ) )
{
if( m == null || m.Deleted || m.Map != attacker.Map || !m.Alive || !attacker.CanSee( m ) || !attacker.CanBeHarmful( m ) || featuser.IsAllyOf( m ) )
continue;
if( !attacker.InRange( m, ((BaseWeapon)attacker.Weapon).MaxRange ) )
continue;
if( m != attacker && Spells.SpellHelper.ValidIndirectTarget( attacker, m ) )
{
if( attacker.InLOS( m ) )
list.Add( m );
}
}
for( int i = 0; i < Math.Min( list.Count, featlevel + 1 ); ++i )
{
int random = Utility.Random( list.Count );
Mobile m = (Mobile)list[random];
featuser.CleaveAttack = true;
((BaseWeapon)attacker.Weapon).OnSwing( attacker, m, 0.5, true );
}
}
示例8: OnDoubleClick
public override void OnDoubleClick(Mobile from)
{
if ((!from.InRange(GetWorldLocation(), 2) || !from.InLOS(this)) && from.AccessLevel == AccessLevel.Player)
{
from.SendLocalizedMessage(500446); // That is too far away.
return;
}
m_TimeOut = DateTime.UtcNow - m_LastBuild;
if (m_UpdateTimer < m_TimeOut || itemarray == null)
BuildArrayList(from);
else if (turboslotsarray != null)
{
foreach (TurboSlot t in turboslotsarray)
{
if ((t == null || t.Deleted) )
{
BuildArrayList(from);
break;
}
}
}
if (turboslotsarray != null)
{
from.CloseGump(typeof(TurboSlotsStatGump));
from.SendGump(new TurboSlotsStatGump(from, turboslotsarray));
}
}
示例9: CheckSoulForge
public static void CheckSoulForge( Mobile from, int range, out bool sforge )
{
sforge = false;
Map map = from.Map;
if ( map == null )
return;
IPooledEnumerable eable = map.GetItemsInRange( from.Location,1 );
foreach ( Item item in eable )
{
bool isSForge = ((item.ItemID >= 17015 && item.ItemID <= 17030) || (item.ItemID >= 16995 && item.ItemID <= 17010) );
if ( isSForge )
{
if ( (from.Z + 16) < item.Z || (item.Z + 16) < from.Z || !from.InLOS( item ) )
continue;
sforge = sforge || isSForge;
if ( sforge )
break;
}
}
}
示例10: CheckAnvilAndForge
public static void CheckAnvilAndForge(Mobile from, int range, out bool anvil, out bool forge)
{
anvil = false;
forge = false;
Map map = from.Map;
if (map == null)
return;
IPooledEnumerable eable = map.GetItemsInRange(from.Location, range);
foreach (Item item in eable)
{
Type type = item.GetType();
bool isAnvil = (type.IsDefined(typeofAnvil, false) || item.ItemID == 4015 || item.ItemID == 4016 || item.ItemID == 0x2DD5 || item.ItemID == 0x2DD6);
bool isForge = (type.IsDefined(typeofForge, false) || item.ItemID == 4017 || (item.ItemID >= 6522 && item.ItemID <= 6569) || item.ItemID == 0x2DD8);
if (isAnvil || isForge)
{
if ((from.Z + 16) < item.Z || (item.Z + 16) < from.Z || !from.InLOS(item))
continue;
anvil = anvil || isAnvil;
forge = forge || isForge;
if (anvil && forge)
break;
}
}
eable.Free();
for (int x = -range; (!anvil || !forge) && x <= range; ++x)
{
for (int y = -range; (!anvil || !forge) && y <= range; ++y)
{
StaticTile[] tiles = map.Tiles.GetStaticTiles(from.X + x, from.Y + y, true);
for (int i = 0; (!anvil || !forge) && i < tiles.Length; ++i)
{
int id = tiles[i].ID & 0x3FFF;
bool isAnvil = (id == 4015 || id == 4016 || id == 0x2DD5 || id == 0x2DD6);
bool isForge = (id == 4017 || (id >= 6522 && id <= 6569) || id == 0x2DD8);
if (isAnvil || isForge)
{
if ((from.Z + 16) < tiles[i].Z || (tiles[i].Z + 16) < from.Z || !from.InLOS(new Point3D(from.X + x, from.Y + y, tiles[i].Z + (tiles[i].Height / 2) + 1)))
continue;
anvil = anvil || isAnvil;
forge = forge || isForge;
}
}
}
}
}
示例11: OnDoubleClick
public override void OnDoubleClick(Mobile from)
{
if (m_Boat == null || from == null)
return;
BaseBoat boat = BaseBoat.FindBoatAt(from, from.Map);
int range = boat != null && boat == this.Boat ? 3 : 8;
bool canMove = false;
if (m_Boat != null)
m_Boat.Refresh();
if (boat != null && m_Boat != boat)
boat.Refresh();
if (!from.InRange(this.Location, range))
from.SendLocalizedMessage(500295); //You are too far away to do that.
else if (!from.InLOS(this.Location))
from.SendLocalizedMessage(500950); //You cannot see that.
else if (m_Boat.IsMoving || m_Boat.IsTurning)
from.SendLocalizedMessage(1116611); //You can't use that while the ship is moving!
else if (BaseBoat.IsDriving(from))
from.SendLocalizedMessage(1116610); //You can't do that while piloting a ship!
else if (BaseHouse.FindHouseAt(from) != null)
from.SendLocalizedMessage(1149795); //You may not dock a ship while on another ship or inside a house.
else if (!m_Boat.IsClassicBoat)
{
if (boat == m_Boat && !MoveToNearestDockOrLand(from))
from.SendLocalizedMessage(1149796); //You can not dock a ship this far out to sea. You must be near land or shallow water.
else if (boat == null)
{
if (!from.Alive)
from.SendLocalizedMessage(1060190); //You cannot do that while dead!
else if ((m_Boat is BaseGalleon && ((BaseGalleon)m_Boat).HasAccess(from)) || (m_Boat is RowBoat && ((RowBoat)m_Boat).HasAccess(from)))
canMove = true;
else
from.SendLocalizedMessage(1116617); //You do not have permission to board this ship.
}
else if (boat != null && m_Boat != boat)
{
if (!from.Alive)
from.SendLocalizedMessage(1060190); //You cannot do that while dead!
else if (boat is BaseGalleon && m_Boat is RowBoat && ((RowBoat)m_Boat).HasAccess(from))
canMove = true;
else if (boat is RowBoat && m_Boat is BaseGalleon && ((BaseGalleon)m_Boat).HasAccess(from))
canMove = true;
else if (boat is BaseGalleon && m_Boat is BaseGalleon && ((BaseGalleon)m_Boat).HasAccess(from))
canMove = true;
else
from.SendLocalizedMessage(1149795); //You may not dock a ship while on another ship or inside a house.
}
}
if (canMove)
{
BaseCreature.TeleportPets(from, this.Location, this.Map);
from.MoveToWorld(this.Location, this.Map);
}
}
示例12: OnHit
public override void OnHit( Mobile attacker, Mobile defender, int damage )
{
if ( !Validate( attacker ) )
return;
ClearCurrentAbility( attacker );
Map map = attacker.Map;
if ( map == null )
return;
BaseWeapon weapon = attacker.Weapon as BaseWeapon;
if ( weapon == null )
return;
if ( !CheckMana( attacker, true ) )
return;
attacker.FixedEffect( 0x3728, 10, 15 );
attacker.PlaySound( 0x2A1 );
ArrayList list = new ArrayList();
foreach ( Mobile m in attacker.GetMobilesInRange( 1 ) )
list.Add( m );
Party p = Party.Get( attacker );
for ( int i = 0; i < list.Count; ++i )
{
Mobile m = (Mobile)list[i];
if (m != defender && m != attacker &&
SpellHelper.ValidIndirectTarget(attacker, m) &&
attacker.CanBeHarmful(m, false) &&
(p == null || !p.Contains(m)))
{
if ( m == null || m.Deleted || attacker.Deleted || m.Map != attacker.Map || !m.Alive || !attacker.Alive || !attacker.CanSee( m ) )
continue;
if ( !attacker.InRange( m, weapon.MaxRange ) )
continue;
if ( attacker.InLOS( m ) )
{
attacker.RevealingAction();
attacker.SendLocalizedMessage( 1060161 ); // The whirling attack strikes a target!
m.SendLocalizedMessage( 1060162 ); // You are struck by the whirling attack and take damage!
weapon.OnHit( attacker, m );
}
}
}
}
示例13: OnDoubleClick
public override void OnDoubleClick( Mobile from )
{
Map map = this.Map;
Point3D loc = this.Location;
if ( Parent != null || Movable || IsLockedDown || IsSecure || map == null || map == Map.Internal )
return;
if ( !from.InRange( loc, 2 ) || !from.InLOS( this ) )
from.LocalOverheadMessage( MessageType.Regular, 0x3B2, false, "Vous ne pouvez atteindre cela" ); // I can't reach that.
else if ( !m_Picked )
OnPicked( from, loc, map );
}
示例14: OnDoubleClick
public override void OnDoubleClick(Mobile from)
{
if ( RootParent == from || ( from.InRange( GetWorldLocation(), 3 ) && from.InLOS( GetWorldLocation() ) ) )
{
if ( !Unrolled )
{
Unroll();
MoveToWorld( from.Location, from.Map );
}
else if ( ItemID == 0x0A55 )
{
if ( Parent == null )
{
IPooledEnumerable eable = from.GetItemsInRange( 7 );
Campfire fire = null;
foreach ( Item item in eable )
{
if ( item is Campfire )
{
fire = (Campfire)item;
break;
}
}
eable.Free();
if ( fire != null )
{
if ( fire.CanLogout( from ) )
new BedRollLogoutMenu().SendTo( from.NetState );
else
from.SendAsciiMessage( "Your camp is not yet secure." );
}
else
{
Roll();
from.AddToBackpack( this );
}
}
else
{
// is in a container (not on ground)
Roll();
from.AddToBackpack( this );
}
}
}
else
{
from.SendAsciiMessage( "You must be closer to use that." );
}
}
示例15: GetDeadPets
public static BaseCreature[] GetDeadPets(Mobile from)
{
List<BaseCreature> pets = new List<BaseCreature>();
foreach (Mobile m in from.GetMobilesInRange(12))
{
BaseCreature bc = m as BaseCreature;
if (bc != null && bc.IsDeadBondedPet && bc.ControlMaster == from && from.InLOS(bc))
pets.Add(bc);
}
return pets.ToArray();
}