本文整理汇总了C#中Server.Mobiles.PlayerMobile.InRange方法的典型用法代码示例。如果您正苦于以下问题:C# PlayerMobile.InRange方法的具体用法?C# PlayerMobile.InRange怎么用?C# PlayerMobile.InRange使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Server.Mobiles.PlayerMobile
的用法示例。
在下文中一共展示了PlayerMobile.InRange方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Resurrect
public static void Resurrect( PlayerMobile m, AnkhOfSacrificeAddon ankh )
{
if ( m == null )
{
}
else if ( !m.InRange( ankh.GetWorldLocation(), 2 ) )
{
m.SendLocalizedMessage( 500446 ); // That is too far away.
}
else if ( m.Alive )
{
m.SendLocalizedMessage( 1060197 ); // You are not dead, and thus cannot be resurrected!
}
else if ( m.AnkhNextUse > DateTime.UtcNow )
{
TimeSpan delay = m.AnkhNextUse - DateTime.UtcNow;
if ( delay.TotalMinutes > 0 )
m.SendLocalizedMessage( 1079265, Math.Round( delay.TotalMinutes ).ToString() ); // You must wait ~1_minutes~ minutes before you can use this item.
else
m.SendLocalizedMessage( 1079263, Math.Round( delay.TotalSeconds ).ToString() ); // You must wait ~1_seconds~ seconds before you can use this item.
}
else
{
m.CloseGump( typeof( AnkhResurrectGump ) );
m.SendGump( new AnkhResurrectGump( m, ResurrectMessage.VirtueShrine ) );
}
}
示例2: Shoot
private static void Shoot(PlayerMobile from, Mobile target, INinjaWeapon weapon)
{
if (from != target && CanUseWeapon(from, weapon) && from.CanBeHarmful(target))
{
if (weapon.WeaponMinRange == 0 || !from.InRange(target, weapon.WeaponMinRange))
{
from.NinjaWepCooldown = true;
from.Direction = from.GetDirectionTo(target);
from.RevealingAction();
weapon.AttackAnimation(from, target);
ConsumeUse(weapon);
if (CombatCheck(from, target))
{
Timer.DelayCall(TimeSpan.FromSeconds(1.0), new TimerStateCallback<object[]>(OnHit), new object[] { from, target, weapon });
}
Timer.DelayCall(TimeSpan.FromSeconds(2.5), new TimerStateCallback<PlayerMobile>(ResetUsing), from);
}
else
{
from.SendLocalizedMessage(1063303); // Your target is too close!
}
}
}
示例3: Resurrect
public static void Resurrect( PlayerMobile m, AnkhOfSacrificeAddon ankh )
{
BaseHouse ankhhouse = BaseHouse.FindHouseAt( ankh );
if ( m != null && ankhhouse != null && ankhhouse.IsFriend( m ) )
{
if ( !m.InRange( ankh.GetWorldLocation(), 2 ) )
m.SendLocalizedMessage( 500446 ); // That is too far away.
else if ( m.Alive )
m.SendLocalizedMessage( 1060197 ); // You are not dead, and thus cannot be resurrected!
else if ( m.AnkhNextUse > DateTime.UtcNow )
{
TimeSpan delay = m.AnkhNextUse - DateTime.UtcNow;
if ( delay.TotalMinutes > 0 )
m.SendLocalizedMessage( 1079265, Math.Round( delay.TotalMinutes ).ToString() ); // You must wait ~1_minutes~ minutes before you can use this item.
else
m.SendLocalizedMessage( 1079263, Math.Round( delay.TotalSeconds ).ToString() ); // You must wait ~1_seconds~ seconds before you can use this item.
}
else
{
m.CloseGump( typeof( AnkhResurrectGump ) );
/*PlayerMobile pres = m as PlayerMobile;
if (pres.MurderBounty > 0)
m.SendGump( new ResurrectGump( m, m, pres.MurderBounty ) );
else*/
m.SendGump( new AnkhResurrectGump( m, ResurrectMessage.VirtueShrine ) );
}
}
}
示例4: HandleTerror
public static void HandleTerror( PlayerMobile m )
{
if( m.Feats.GetFeatLevel( FeatList.Terror ) < 1 )
{
m.SendMessage( "You need the first level of Terror to use this ability." );
return;
}
if( m.Combatant != null && m.InRange( m.Combatant.Location, 6 ) )
TerrorTarget.TryTerror( m, m.Combatant );
else
m.Target = new TerrorTarget();
}
示例5: RegisterMove
// Unused...was it meant to do anything?!
/*public static Hashtable VisitSectorList = new Hashtable();
public static void RegisterMove(PlayerMobile m_player)
{
if (m_player == null || m_player.Map == null) return;
// check for any attachments that might support the OnMove method
//XmlAttach.CheckOnMove(m_player);
// check to see if the current sector that the player is in, is registered in the VISIT sector list
Sector newSector = m_player.Map.GetSector(m_player.Location);
if (VisitSectorList != null && VisitSectorList.Contains(newSector))
{
// check to see if the player has a quest with a VISIT type objective
if (m_player.GetFlag(CarriedXmlQuestFlag))
{
CheckVisited(m_player);
}
}
}*/
public static bool CheckVisitObjective(IXmlQuest quest, PlayerMobile m_player, string objectivestr, string statestr, out string newstatestr, out bool visitstatus)
{
newstatestr = statestr;
visitstatus = false;
if (objectivestr == null) return false;
// format for the objective string will be VISIT,x,y,range[,duration]
string[] arglist = BaseXmlSpawner.ParseString(objectivestr, 5, ",");
bool found = false;
int targetcount = 1;
string status_str = null;
if (status_str != null) quest.Status = status_str;
if (arglist.Length > 3)
{
// escort task objective
if (arglist[0] == "VISIT")
{
double duration = 0; // duration in minutes
// get the coords
int x = 0;
if(!int.TryParse(arglist[1], out x))
status_str = "invalid VISIT x";
int y = 0;
if(!int.TryParse(arglist[2], out y))
status_str = "invalid VISIT y";
int range = 0;
if(!int.TryParse(arglist[3], out range))
status_str = "invalid VISIT range";
if (arglist.Length > 4)
{
if(!double.TryParse(arglist[4], NumberStyles.Any, CultureInfo.InvariantCulture, out duration))
status_str = "invalid VISIT duration";
}
// check them against the players current location
if (m_player != null && m_player.InRange(new Point2D(x, y), range))
{
if (duration > 0)
{
// is there already a timer started on the quest object?
}
else
{
found = true;
}
// if it is in range, then start the timer
}
}
}
// update the objective state
if (found)
{
// get the current visitation count and update it
int current = 0;
int.TryParse(statestr, out current);
int visited = current + 1;
newstatestr = String.Format("{0}", visited);
if (visited >= targetcount)
{
// visitation completed
//.........这里部分代码省略.........
示例6: ValidatePet
private bool ValidatePet( Mobile pet, PlayerMobile messageReciever, RequestType type )
{
if ( pet != null && pet is BaseCreature && !pet.Deleted )
{
BaseCreature bc = pet as BaseCreature;
if ( bc.IsStabled )
{
this.SayTo( messageReciever, "That creature is in your stables. If you wish to see it, talk to your stablemaster." );
return false;
}
switch(type)
{
case RequestType.Spirit:
{
if ( !bc.IsBonded)
{
this.SayTo( messageReciever, "You have not bonded with that pet, and so I cannot reach it's spirit through you." );
return false;
}
else if ( messageReciever.InRange( bc, 12 ) )
{
this.SayTo( messageReciever, "Your pet is not far from here, you do not require my assistance." );
return false;
}
break;
}
case RequestType.Locate:
{
if ( messageReciever.InRange( bc, 12 ) )
{
this.SayTo( messageReciever, "Your pet is not far from here, you do not require my assistance." );
return false;
}
break;
}
case RequestType.Bond:
{
if(bc.IsBonded)
{
this.SayTo( messageReciever, "Your pet is bonded too you already for all time, you do not require my assistance." );
return false;
}
else if ( !messageReciever.InRange( bc, 6 ) )
{
this.SayTo( messageReciever, "Your pet is too far away from here, and the bonding process can not begin." );
return false;
}
else if(bc.BondingBegin != DateTime.MinValue)
{
this.SayTo( messageReciever, "The bonding of {0}'s spirit has already begun, you must now wait some time for it to complete.", bc.Name.ToString());
return false;
}
else if(bc.MinTameSkill >= 29.1 && messageReciever.Skills[SkillName.AnimalTaming].Value < bc.MinTameSkill)
{
this.SayTo( messageReciever, "Your connection and control over your pet is too weak, and you may not bond with it.");
return false;
}
break;
}
case RequestType.Release:
{
if ( messageReciever.InRange( bc, 12 ) )
{
this.SayTo( messageReciever, "Your pet is not far from here, you do not require my assistance." );
return false;
}
break;
}
}
if ( GetSpiritPrice(bc) == -1 )
return false;
return true;
}
else
this.SayTo( messageReciever, "You have no pets by that name." );
return false;
}
示例7: TryToWithdraw
public void TryToWithdraw( PlayerMobile m )
{
if( !IsGuildMember(m, this, true) || !HasTreasury(m, true) )
return;
if( m.CustomGuilds[this].Balance < 1 )
{
m.SendMessage( "You currently have no funds to withdraw." );
return;
}
if( !m.InRange(this, 3) )
{
m.SendMessage( "You need to be near your organization's stone in order to do that." );
return;
}
int amount = 0;
ArrayList list = new ArrayList();
foreach( Item item in Treasury.Items )
{
if( item is Copper )
{
amount += item.Amount;
list.Add( item );
}
}
for( int i = 0; i < list.Count; i++ )
{
Item item = list[i] as Item;
item.Delete();
}
if( amount == 0 )
{
m.SendMessage( "Your organization currently has no funds." );
return;
}
if( amount < m.CustomGuilds[this].Balance )
{
m.SendMessage( "You withdraw every single coin available, but it is still not enough." );
m.Backpack.DropItem( new Copper(amount) );
m.CustomGuilds[this].Balance -= amount;
}
else
{
m.SendMessage( "You withdraw all the copper you are entitled to." );
m.Backpack.DropItem( new Copper(m.CustomGuilds[this].Balance) );
amount -= m.CustomGuilds[this].Balance;
m.CustomGuilds[this].Balance = 0;
if( amount > 0 )
Treasury.DropItem( new Copper(amount) );
}
}
示例8: ValidatePet
private static bool ValidatePet( Mobile pet, PlayerMobile messageReciever )
{
if ( pet != null && pet is BaseCreature && !pet.Deleted )
{
BaseCreature bc = pet as BaseCreature;
if ( bc.IsStabled )
{
messageReciever.SendMessage( "That creature is in your stables." );
return false;
}
else if ( !bc.IsBonded )
{
messageReciever.SendMessage( "That pet is not bonded to you." );
return false;
}
else if ( messageReciever.InRange( bc, 12 ) )
{
messageReciever.SendMessage( "Your pet is not far from here, you do not require my assistance." );
return false;
}
return true;
}
else
messageReciever.SendMessage( "You have no pets by that name." );
return false;
}