本文整理汇总了C#中WCell.RealmServer.Entities.Character.IsInRadius方法的典型用法代码示例。如果您正苦于以下问题:C# Character.IsInRadius方法的具体用法?C# Character.IsInRadius怎么用?C# Character.IsInRadius使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类WCell.RealmServer.Entities.Character
的用法示例。
在下文中一共展示了Character.IsInRadius方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: MayProposeTrade
/// <summary>
/// Checks requirements for trading between two characters
/// </summary>
/// <param name="initChr">possible initiator of trading</param>
/// <param name="targetChr">possible target of trading</param>
public static bool MayProposeTrade(Character initChr, Character targetChr)
{
TradeStatus tradeStatus;
if (targetChr == null || !targetChr.IsInContext)
{
tradeStatus = TradeStatus.PlayerNotFound;
return false;
}
else if (initChr.IsLoggingOut || targetChr.IsLoggingOut)
{
tradeStatus = TradeStatus.LoggingOut;
}
else if (!initChr.IsAlive)
{
tradeStatus = TradeStatus.PlayerDead;
}
else if (!targetChr.IsInRadius(initChr, MaxTradeRadius))
{
tradeStatus = TradeStatus.TooFarAway;
}
else if (!targetChr.IsAlive)
{
tradeStatus = TradeStatus.TargetDead;
}
else if (targetChr.IsStunned)
{
tradeStatus = TradeStatus.TargetStunned;
}
else if (targetChr.IsIgnoring(initChr))
{
tradeStatus = TradeStatus.PlayerIgnored;
}
else if (targetChr.TradeWindow != null)
{
tradeStatus = TradeStatus.AlreadyTrading;
}
else if (targetChr.Faction.Group != initChr.Faction.Group && !initChr.Role.IsStaff)
{
tradeStatus = TradeStatus.WrongFaction;
}
else if (targetChr.IsLoggingOut)
{
tradeStatus = TradeStatus.TargetLoggingOut;
}
else
{
tradeStatus = TradeStatus.Proposed;
return true;
}
TradeHandler.SendTradeStatus(initChr, tradeStatus);
return false;
}
示例2: SeekForgiveness
/// <summary>
/// Move to the killer and pleed
/// </summary>
/// <param name="ambusher"></param>
/// <param name="killer"></param>
private static void SeekForgiveness(NPC ambusher, Character killer)
{
if (killer.IsInWorld &&
killer.IsAlive &&
killer.Map == ambusher.Map &&
killer.IsInRadius(ambusher, MaxForgivenessDistance))
{
// make sure we are using the right means of transportation
if (killer.IsFlying)
{
ambusher.Mount(MountId.FlyingBroom); // probably won't display correctly
ambusher.Movement.MoveType = AIMoveType.Fly;
}
else
{
ambusher.Dismount();
ambusher.Movement.MoveType = AIMoveType.Walk;
}
// go to killer
ambusher.MoveInFrontThenExecute(killer, mover => {
mover.StandState = StandState.Kneeling;
mover.Say("I beg thee for forgiveness!");
});
}
else
{
// killer is not in reach anymore
ambusher.Say("Sigh!");
ambusher.Delete();
}
}
示例3: CheckRequirements
/// <summary>
/// Checks requirements for trading between two characters
/// </summary>
/// <param name="initChr">possible initiator of trading</param>
/// <param name="targetChr">possible target of trading</param>
/// <returns></returns>
public static bool CheckRequirements(Character initChr, Character targetChr)
{
var tradeStatus = TradeStatus.Proposed;
if (initChr.IsLoggingOut)
{
tradeStatus = TradeStatus.LoggingOut;
}
else if (!initChr.IsAlive)
{
tradeStatus = TradeStatus.PlayerDead;
}
if (tradeStatus != TradeStatus.Proposed)
{
TradeHandler.SendTradeStatus(initChr, tradeStatus);
return false;
}
if (targetChr == null)
{
TradeHandler.SendTradeStatus(initChr, TradeStatus.PlayerNotFound);
return false;
}
if (!targetChr.IsInRadius(initChr, 10.0f))
{
tradeStatus = TradeStatus.TooFarAway;
}
else if (!targetChr.IsAlive)
{
tradeStatus = TradeStatus.TargetDead;
}
else if (targetChr.IsStunned)
{
tradeStatus = TradeStatus.TargetStunned;
}
else if (Singleton<RelationMgr>.Instance.HasRelation(
targetChr.EntityId.Low, initChr.EntityId.Low, CharacterRelationType.Ignored))
{
tradeStatus = TradeStatus.PlayerIgnored;
}
else if (targetChr.TradeInfo != null)
{
tradeStatus = TradeStatus.AlreadyTrading;
}
else if (targetChr.Faction.Group != initChr.Faction.Group && !initChr.Role.IsStaff)
{
tradeStatus = TradeStatus.WrongFaction;
}
else if (targetChr.IsLoggingOut)
{
tradeStatus = TradeStatus.TargetLoggingOut;
}
if (tradeStatus != TradeStatus.Proposed)
{
TradeHandler.SendTradeStatus(initChr.Client, tradeStatus);
return false;
}
return true;
}