本文整理汇总了C#中GamePlayer.IsWithinRadius方法的典型用法代码示例。如果您正苦于以下问题:C# GamePlayer.IsWithinRadius方法的具体用法?C# GamePlayer.IsWithinRadius怎么用?C# GamePlayer.IsWithinRadius使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类GamePlayer
的用法示例。
在下文中一共展示了GamePlayer.IsWithinRadius方法的13个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Execute
/// <summary>
/// Action
/// </summary>
/// <param name="living"></param>
public override void Execute(GameLiving living)
{
if (CheckPreconditions(living, DEAD | SITTING | MEZZED | STUNNED)) return;
if (living is GamePlayer)
{
player = living as GamePlayer;
if (player.TargetObject == null)
{
player.Out.SendMessage("You need a target for this ability!", eChatType.CT_System, eChatLoc.CL_SystemWindow);
player.DisableSkill(this, 3 * 1000);
return;
}
if (!(player.TargetObject is GamePlayer))
{
player.Out.SendMessage("This work only on players!", eChatType.CT_System, eChatLoc.CL_SystemWindow);
player.DisableSkill(this, 3 * 1000);
return;
}
if (!GameServer.ServerRules.IsAllowedToAttack(player, (GamePlayer)player.TargetObject, true))
{
player.Out.SendMessage("This work only on enemies!", eChatType.CT_Spell, eChatLoc.CL_SystemWindow);
player.DisableSkill(this, 3 * 1000);
return;
}
if ( !player.IsWithinRadius( player.TargetObject, SpellRange ) )
{
player.Out.SendMessage(player.TargetObject + " is too far away!", eChatType.CT_Spell, eChatLoc.CL_SystemWindow);
player.DisableSkill(this, 3 * 1000);
return;
}
foreach (GamePlayer radiusPlayer in player.GetPlayersInRadius(WorldMgr.INFO_DISTANCE))
{
if (radiusPlayer == player) radiusPlayer.Out.SendMessage("You cast " + this.Name + "!", eChatType.CT_Spell, eChatLoc.CL_SystemWindow);
else radiusPlayer.Out.SendMessage(player.Name + " casts a spell!", eChatType.CT_Spell, eChatLoc.CL_SystemWindow);
radiusPlayer.Out.SendSpellCastAnimation(player, 7059, 0);
}
if (player.RealmAbilityCastTimer != null)
{
player.RealmAbilityCastTimer.Stop();
player.RealmAbilityCastTimer = null;
player.Out.SendMessage("You cancel your Spell!", eChatType.CT_SpellResisted, eChatLoc.CL_SystemWindow);
}
targetPlayer = player.TargetObject as GamePlayer;
//[StephenxPimentel]
//1.108 - this ability is now instant cast.
EndCast();
}
}
示例2: Execute
public override void Execute(GameLiving living)
{
if (CheckPreconditions(living, DEAD | SITTING | MEZZED | STUNNED)) return;
m_caster = living as GamePlayer;
if (m_caster == null)
return;
if (m_caster.TargetObject == null)
{
m_caster.Out.SendMessage("You need a target for this ability!", eChatType.CT_System, eChatLoc.CL_SystemWindow);
m_caster.DisableSkill(this, 3 * 1000);
return;
}
if ( !m_caster.IsWithinRadius( m_caster.TargetObject, (int)( 1500 * m_caster.GetModified(eProperty.SpellRange) * 0.01 ) ) )
{
m_caster.Out.SendMessage(m_caster.TargetObject + " is too far away.", eChatType.CT_Spell, eChatLoc.CL_SystemWindow);
return;
}
switch (Level)
{
case 1: m_dmgValue = 200; break;
case 2: m_dmgValue = 500; break;
case 3: m_dmgValue = 750; break;
default: return;
}
foreach (GamePlayer i_player in m_caster.GetPlayersInRadius(WorldMgr.INFO_DISTANCE))
{
if (i_player == m_caster)
{
i_player.MessageToSelf("You cast " + this.Name + "!", eChatType.CT_Spell);
}
else
{
i_player.MessageFromArea(m_caster, m_caster.Name + " casts a spell!", eChatType.CT_Spell, eChatLoc.CL_SystemWindow);
}
i_player.Out.SendSpellCastAnimation(m_caster, 7025, 20);
}
if (m_caster.RealmAbilityCastTimer != null)
{
m_caster.RealmAbilityCastTimer.Stop();
m_caster.RealmAbilityCastTimer = null;
m_caster.Out.SendMessage("You cancel your Spell!", eChatType.CT_SpellResisted, eChatLoc.CL_SystemWindow);
}
m_caster.RealmAbilityCastTimer = new RegionTimer(m_caster);
m_caster.RealmAbilityCastTimer.Callback = new RegionTimerCallback(EndCast);
m_caster.RealmAbilityCastTimer.Start(2000);
}
示例3: UpdatePlayerHousing
/// <summary>
/// Send Housing Items depending on last refresh.
/// </summary>
/// <param name="player"></param>
/// <param name="nowTicks"></param>
public static void UpdatePlayerHousing(GamePlayer player, long nowTicks)
{
// If no house update needed exit.
if (player.CurrentRegion == null || !player.CurrentRegion.HousingEnabled)
return;
// Get All House in Region
IDictionary<int, House> housesDict = HouseMgr.GetHouses(player.CurrentRegionID);
// Build Vincinity List
var houses = housesDict.Values.Where(h => h != null && player.IsWithinRadius(h, HousingConstants.HouseViewingDistance)).ToArray();
try
{
// Clean Cache
foreach (var houseEntry in player.Client.HouseUpdateArray)
{
var houseKey = houseEntry.Key;
House house = HouseMgr.GetHouse(houseKey.Item1, houseKey.Item2);
// We have a House in cache that is not in vincinity
if (!houses.Contains(house) && (nowTicks - houseEntry.Value) >= (GetPlayerHousingUpdateInterval >> 2))
{
long dummy;
player.Client.HouseUpdateArray.TryRemove(houseKey, out dummy);
}
}
}
catch (Exception e)
{
if (log.IsErrorEnabled)
log.ErrorFormat("Error while Cleaning House cache for Player : {0}, Exception : {1}", player.Name, e);
}
try
{
// Now Send remaining houses
foreach (House lhouse in houses)
{
House house = lhouse;
// Get last update time
long lastUpdate;
if (player.Client.HouseUpdateArray.TryGetValue(new Tuple<ushort, ushort>(house.RegionID, (ushort)house.HouseNumber), out lastUpdate))
{
// This House Needs Update
if ((nowTicks - lastUpdate) >= GetPlayerHousingUpdateInterval)
{
player.Client.Out.SendHouseOccupied(house, house.IsOccupied);
}
}
else
{
// Not in cache, House entering in range !
player.Client.Out.SendHouse(house);
player.Client.Out.SendGarden(house);
player.Client.Out.SendHouseOccupied(house, house.IsOccupied);
}
}
}
catch (Exception e)
{
if (log.IsErrorEnabled)
log.ErrorFormat("Error while updating Houses for Player : {0}, Exception : {1}", player.Name, e);
}
}
示例4: Execute
public override void Execute(GameLiving living)
{
if (CheckPreconditions(living, DEAD | SITTING | MEZZED | STUNNED)) return;
caster = living as GamePlayer;
if (caster == null)
return;
if (caster.TargetObject == null)
{
caster.Out.SendMessage("You need a target for this ability!", eChatType.CT_System, eChatLoc.CL_SystemWindow);
caster.DisableSkill(this, 3 * 1000);
return;
}
if (!caster.TargetInView)
{
caster.Out.SendMessage(caster.TargetObject.Name + " is not in view.", eChatType.CT_SpellResisted, eChatLoc.CL_SystemWindow);
caster.DisableSkill(this, 3 * 1000);
return;
}
if (!caster.IsWithinRadius( caster.TargetObject, 1875 ))
{
caster.Out.SendMessage(caster.TargetObject.Name + " is too far away.", eChatType.CT_Spell, eChatLoc.CL_SystemWindow);
caster.DisableSkill(this, 3 * 1000);
return;
}
if (m_expireTimerID != null && m_expireTimerID.IsAlive)
{
caster.Out.SendMessage("You are already casting this ability.", eChatType.CT_Spell, eChatLoc.CL_SystemWindow);
caster.DisableSkill(this, 3 * 1000);
return;
}
if(ServerProperties.Properties.USE_NEW_ACTIVES_RAS_SCALING)
{
switch (Level)
{
case 1: dmgValue = 150; duration = 10000; break;
case 2: dmgValue = 275; duration = 15000; break;
case 3: dmgValue = 400; duration = 20000; break;
case 4: dmgValue = 500; duration = 25000; break;
case 5: dmgValue = 600; duration = 30000; break;
default: return;
}
}
//150 dam/10 sec || 400/20 || 600/30
switch (Level)
{
case 1: dmgValue = 150; duration = 10000; break;
case 2: dmgValue = 400; duration = 20000; break;
case 3: dmgValue = 600; duration = 30000; break;
default: return;
}
#region resist and det
GameLiving m_target = caster.TargetObject as GameLiving;
int primaryResistModifier = m_target.GetResist(eDamageType.Spirit);
int secondaryResistModifier = m_target.SpecBuffBonusCategory[(int)eProperty.Resist_Spirit];
int rootdet = ((m_target.GetModified(eProperty.SpeedDecreaseDurationReduction) - 100) * -1);
int ResistModifier = 0;
ResistModifier += (int)((dmgValue * (double)primaryResistModifier) * -0.01);
ResistModifier += (int)((dmgValue + (double)ResistModifier) * (double)secondaryResistModifier * -0.01);
if (m_target is GamePlayer)
{
dmgValue += ResistModifier;
}
if (m_target is GameNPC)
{
dmgValue += ResistModifier;
}
int rootmodifier = 0;
rootmodifier += (int)((duration * (double)primaryResistModifier) * -0.01);
rootmodifier += (int)((duration + (double)primaryResistModifier) * (double)secondaryResistModifier * -0.01);
rootmodifier += (int)((duration + (double)rootmodifier) * (double)rootdet * -0.01);
duration += rootmodifier;
if (duration < 1)
duration = 1;
#endregion
foreach (GamePlayer i_player in caster.GetPlayersInRadius(WorldMgr.INFO_DISTANCE))
{
if (i_player == caster)
{
i_player.MessageToSelf("You cast " + this.Name + "!", eChatType.CT_Spell);
}
else
{
i_player.MessageFromArea(caster, caster.Name + " casts a spell!", eChatType.CT_Spell, eChatLoc.CL_SystemWindow);
}
//.........这里部分代码省略.........
示例5: Execute
/// <summary>
/// Execute the ability
/// </summary>
/// <param name="ab">The ability executed</param>
/// <param name="player">The player that used the ability</param>
public void Execute(Ability ab, GamePlayer player)
{
if (player == null)
{
if (log.IsWarnEnabled)
log.Warn("Could not retrieve player in FlurryAbilityHandler.");
return;
}
#region precheck
if (!player.IsAlive)
{
player.Out.SendMessage(LanguageMgr.GetTranslation(player.Client.Account.Language, "Skill.Ability.CannotUseDead"), eChatType.CT_System, eChatLoc.CL_SystemWindow);
return;
}
if (player.IsMezzed)
{
player.Out.SendMessage(LanguageMgr.GetTranslation(player.Client.Account.Language, "Skill.Ability.CannotUseMezzed"), eChatType.CT_System, eChatLoc.CL_SystemWindow);
return;
}
if (player.IsStunned)
{
player.Out.SendMessage(LanguageMgr.GetTranslation(player.Client.Account.Language, "Skill.Ability.CannotUseStunned"), eChatType.CT_System, eChatLoc.CL_SystemWindow);
return;
}
if (player.IsSitting)
{
player.Out.SendMessage(LanguageMgr.GetTranslation(player.Client.Account.Language, "Skill.Ability.CannotUseStanding"), eChatType.CT_System, eChatLoc.CL_SystemWindow);
return;
}
if (player.TargetObject == null)
{
player.Out.SendMessage(LanguageMgr.GetTranslation(player.Client.Account.Language, "Skill.Ability.CannotUseNoTarget"), eChatType.CT_System, eChatLoc.CL_SystemWindow);
return;
}
if (!(player.TargetObject is GamePlayer || player.TargetObject is GameKeepGuard))
{
player.Out.SendMessage(LanguageMgr.GetTranslation(player.Client.Account.Language, "Skill.Ability.Flurry.TargetNotPlayerOrGuards"), eChatType.CT_System, eChatLoc.CL_SystemWindow);
return;
}
if (!GameServer.ServerRules.IsAllowedToAttack(player, (GameLiving)player.TargetObject, true))
{
player.Out.SendMessage(LanguageMgr.GetTranslation(player.Client.Account.Language, "Skill.Ability.CannotAttackTarget", player.TargetObject.Name), eChatType.CT_System, eChatLoc.CL_SystemWindow);
return;
}
if (!player.IsObjectInFront(player.TargetObject, 180) || !player.TargetInView)
{
player.Out.SendMessage(LanguageMgr.GetTranslation(player.Client.Account.Language, "Skill.Ability.CannotSeeTarget", player.TargetObject.Name), eChatType.CT_System, eChatLoc.CL_SystemWindow);
return;
}
if (!player.IsWithinRadius(player.TargetObject, 135)) //Didn't use AttackRange cause of the fact that player could use a Bow
{
player.Out.SendMessage(LanguageMgr.GetTranslation(player.Client.Account.Language, "Skill.Ability.TargetIsWithinRadius"), eChatType.CT_System, eChatLoc.CL_SystemWindow);
return;
}
if (player.TargetObject is GamePlayer && SpellHandler.FindEffectOnTarget((GamePlayer)player.TargetObject, "Phaseshift") != null)
{
player.Out.SendMessage(LanguageMgr.GetTranslation(player.Client.Account.Language, "Skill.Ability.TargetIsPhaseshifted", player.TargetObject.Name), eChatType.CT_Missed, eChatLoc.CL_SystemWindow);
return;
}
if(player.TargetObject is GamePlayer)
{
SputinsLegacyEffect SputinLegacy = (player.TargetObject as GamePlayer).EffectList.GetOfType<SputinsLegacyEffect>();
if(SputinLegacy != null)
{
player.Out.SendMessage(LanguageMgr.GetTranslation(player.Client.Account.Language, "Skill.Ability.TargetIsUnderSputinLegacy", player.TargetObject.Name), eChatType.CT_Missed, eChatLoc.CL_SystemWindow);
return;
}
}
#endregion
GameLiving target = (GameLiving)player.TargetObject;
int damage = 0;
int specc = (player.CharacterClass is PlayerClass.ClassBlademaster) ?
player.GetModifiedSpecLevel(Specs.Celtic_Dual) : player.GetModifiedSpecLevel(Specs.Dual_Wield);
//damage = base HP / 100 * DWspec / 2.7 that would be the original calculation
if (target is GamePlayer)
{
damage = (int)(target.MaxHealth / 100 * specc / 4.5); // prev 3.5
}
else
{ damage = (int)(target.MaxHealth / 100 * specc / 4.6); } // prev 3.6
#region Resists
int primaryResistModifier = target.GetResist(eDamageType.Slash);
//Using the resist BuffBonusCategory2 - its unused in ResistCalculator
int secondaryResistModifier = target.SpecBuffBonusCategory[(int)eProperty.Resist_Slash];
int resistModifier = 0;
//primary resists
resistModifier += (int)(damage * (double)primaryResistModifier * -0.01);
//secondary resists
resistModifier += (int)((damage + (double)resistModifier) * (double)secondaryResistModifier * -0.01);
//.........这里部分代码省略.........
示例6: RPsEarnedFromKill
public static uint RPsEarnedFromKill(GamePlayer killer, GamePlayer killedPlayer)
{
long noExpSeconds = ServerProperties.Properties.RP_WORTH_SECONDS;
if (killedPlayer.DBCharacter.DeathTime + noExpSeconds > killedPlayer.PlayedTime)
return 0;
float totaldmg = 0f;
foreach (DictionaryEntry de in killedPlayer.XPGainers)
{
totaldmg += (float)de.Value;
}
foreach (DictionaryEntry de in killedPlayer.XPGainers)
{
GamePlayer key = de.Key as GamePlayer;
if (killer == key)
{
if (!killer.IsWithinRadius(killedPlayer, WorldMgr.MAX_EXPFORKILL_DISTANCE))
return 0;
double damagePercent = (float)de.Value / totaldmg;
if (!key.IsAlive)//Dead living gets 25% exp only
damagePercent *= 0.25;
int rpCap = key.RealmPointsValue * 2;
uint realmPoints = (uint)(killedPlayer.RealmPointsValue * damagePercent);
realmPoints = (uint)(realmPoints * (1.0 + 2.0 * (killedPlayer.RealmLevel - killer.RealmLevel) / 900.0));
if (killer.Group != null && killer.Group.MemberCount > 1)
{
int count = 0;
foreach (GamePlayer player in killer.Group.GetPlayersInTheGroup())
{
if (!player.IsWithinRadius(killedPlayer, WorldMgr.MAX_EXPFORKILL_DISTANCE)) continue;
count++;
}
realmPoints = (uint)(realmPoints * (1.0 + count * 0.125));
}
if (realmPoints > rpCap)
realmPoints = (uint)rpCap;
return realmPoints;
}
else
continue;
}
return 0;
}
示例7: NotifyObservers
protected override void NotifyObservers(GamePlayer player, IDictionary<int, InventoryItem> updateItems)
{
if (!player.IsWithinRadius(m_vaultNPC, WorldMgr.INTERACT_DISTANCE))
{
player.Out.SendMessage("You are out of range of the vault keeper.", eChatType.CT_System, eChatLoc.CL_SystemWindow);
player.ActiveInventoryObject = null;
}
player.Out.SendInventoryItemsUpdate(GetClientInventory(player), eInventoryWindowType.HouseVault);
}
示例8: Start
/// <summary>
/// Start the guarding on player
/// </summary>
/// <param name="guardSource">The guarder</param>
/// <param name="guardTarget">The player guarded by guarder</param>
public void Start(GamePlayer guardSource, GamePlayer guardTarget)
{
if (guardSource == null || guardTarget == null)
return;
m_playerGroup = guardSource.Group;
if (m_playerGroup != guardTarget.Group)
return;
m_guardSource = guardSource;
m_guardTarget = guardTarget;
m_owner = m_guardSource;
GameEventMgr.AddHandler(m_playerGroup, GroupEvent.MemberDisbanded, new DOLEventHandler(GroupDisbandCallback1));
m_guardSource.EffectList.Add(this);
m_guardTarget.EffectList.Add(this);
if (!guardSource.IsWithinRadius(guardTarget, BodyguardAbilityHandler.BODYGUARD_DISTANCE))
{
guardSource.Out.SendMessage(LanguageMgr.GetTranslation(guardSource.Client, "Effects.BodyguardEffect.NowBGXButSC", guardTarget.GetName(0, false)), eChatType.CT_System, eChatLoc.CL_SystemWindow);
guardTarget.Out.SendMessage(LanguageMgr.GetTranslation(guardTarget.Client, "Effects.BodyguardEffect.XNowBGYouButSC", guardSource.GetName(0, true)), eChatType.CT_System, eChatLoc.CL_SystemWindow);
}
else
{
guardSource.Out.SendMessage(LanguageMgr.GetTranslation(guardSource.Client, "Effects.BodyguardEffect.YouAreNowBGX", guardTarget.GetName(0, false)), eChatType.CT_System, eChatLoc.CL_SystemWindow);
guardTarget.Out.SendMessage(LanguageMgr.GetTranslation(guardTarget.Client, "Effects.BodyguardEffect.XIsBGYou", guardSource.GetName(0, true)), eChatType.CT_System, eChatLoc.CL_SystemWindow);
}
}
示例9: PickTarget
/// <summary>
/// Pick a random target from the attacker's group that is within a certain
/// range of the original puller.
/// </summary>
/// <param name="attacker">The original attacker.</param>
/// <returns></returns>
protected virtual GamePlayer PickTarget(GamePlayer attacker)
{
Group attackerGroup = attacker.Group;
// If no group, pick the attacker himself.
if (attackerGroup == null) return attacker;
// Make a list of all players in the attacker's group within
// a certain range around the puller.
ArrayList attackersInRange = new ArrayList();
foreach (GamePlayer player in attackerGroup.GetPlayersInTheGroup())
if (attacker.IsWithinRadius(player, BAFTargetPlayerRange))
attackersInRange.Add(player);
// Pick a random player from the list.
return (GamePlayer)(attackersInRange[Util.Random(1, attackersInRange.Count) - 1]);
}
示例10: LastNameDialogResponse
protected void LastNameDialogResponse(GamePlayer player, byte response)
{
string NewLastName =
(string)player.TempProperties.getProperty<object>(
LASTNAME_WEAK,
String.Empty
);
player.TempProperties.removeProperty(LASTNAME_WEAK);
if (!(player.TargetObject is NameRegistrar))
{
player.Out.SendMessage("You must select a name registrar to set your last name with!", eChatType.CT_System, eChatLoc.CL_SystemWindow);
return;
}
if ( !player.IsWithinRadius( player.TargetObject, WorldMgr.INTERACT_DISTANCE ) )
{
player.Out.SendMessage("You are too far away to interact with " + player.TargetObject.Name + ".", eChatType.CT_System, eChatLoc.CL_SystemWindow);
return;
}
/* Check money only if your lastname is not blank */
if (player.LastName != "" && player.GetCurrentMoney() < Money.GetMoney(0, 0, LASTNAME_FEE, 0, 0))
{
player.Out.SendMessage("Changing your last name costs " + Money.GetString(Money.GetMoney(0, 0, LASTNAME_FEE, 0, 0)) + "!", eChatType.CT_System, eChatLoc.CL_SystemWindow);
return;
}
if (response != 0x01)
{
player.Out.SendMessage("You decline to " + (NewLastName != "" ? ("take " + NewLastName + " as") : "clear") + " your last name.", eChatType.CT_System, eChatLoc.CL_SystemWindow);
return;
}
/* Remove money only if your lastname is not blank and is different from the previous one */
if (player.LastName != "" && player.LastName != NewLastName)
{
player.RemoveMoney(Money.GetMoney(0, 0, LASTNAME_FEE, 0, 0), null);
InventoryLogging.LogInventoryAction(player, player.TargetObject, eInventoryActionType.Merchant, LASTNAME_FEE * 10000);
}
/* Set the new lastname */
player.LastName = NewLastName;
player.Out.SendMessage("Your last name has been " + (NewLastName != "" ? ("set to " + NewLastName) : "cleared") + "!", eChatType.CT_System, eChatLoc.CL_SystemWindow);
}
示例11: Start
/// <summary>
/// Start the guarding on player
/// </summary>
public void Start(GamePlayer protectSource, GamePlayer protectTarget)
{
if (protectSource == null || protectTarget == null)
return;
m_owner = protectSource;
m_playerGroup = protectSource.Group;
if (m_playerGroup != protectTarget.Group)
return;
m_protectSource = protectSource;
m_protectTarget = protectTarget;
GameEventMgr.AddHandler(m_playerGroup, GroupEvent.MemberDisbanded, new DOLEventHandler(GroupDisbandCallback));
m_protectSource.EffectList.Add(this);
m_protectTarget.EffectList.Add(this);
if (!protectSource.IsWithinRadius(protectTarget, ProtectAbilityHandler.PROTECT_DISTANCE))
{
protectSource.Out.SendMessage(LanguageMgr.GetTranslation(protectSource.Client, "Effects.ProtectEffect.YouProtectingYBut", protectTarget.GetName(0, false)), eChatType.CT_System, eChatLoc.CL_SystemWindow);
protectTarget.Out.SendMessage(LanguageMgr.GetTranslation(protectTarget.Client, "Effects.ProtectEffect.XProtectingYouBut", protectSource.GetName(0, true)), eChatType.CT_System, eChatLoc.CL_SystemWindow);
}
else
{
protectSource.Out.SendMessage(LanguageMgr.GetTranslation(protectSource.Client, "Effects.ProtectEffect.YouProtectingY", protectTarget.GetName(0, false)), eChatType.CT_System, eChatLoc.CL_SystemWindow);
protectTarget.Out.SendMessage(LanguageMgr.GetTranslation(protectTarget.Client, "Effects.ProtectEffect.XProtectingYou", protectSource.GetName(0, true)), eChatType.CT_System, eChatLoc.CL_SystemWindow);
}
}
示例12: Start
// <summary>
// Start the guarding on player
// <//summary>
// <param name="guardSource">The guarder<//param>
// <param name="guardTarget">The player guarded by guarder<//param>
public void Start(GamePlayer guardSource, GamePlayer guardTarget, int duration)
{
if (guardSource == null || guardTarget == null)
return;
m_playerGroup = guardSource.Group;
if (m_playerGroup != guardTarget.Group)
return;
m_guardSource = guardSource;
m_guardTarget = guardTarget;
// Set the duration & start the timers
m_effectDuration = duration;
StartTimers();
m_guardSource.EffectList.Add(this);
m_guardTarget.EffectList.Add(this);
if (!guardSource.IsWithinRadius(guardTarget, DashingDefenseEffect.GUARD_DISTANCE))
{
guardSource.Out.SendMessage(string.Format("You are now guarding {0}, but you must stand closer.", guardTarget.GetName(0, false)), eChatType.CT_System, eChatLoc.CL_SystemWindow);
guardTarget.Out.SendMessage(string.Format("{0} is now guarding you, but you must stand closer.", guardSource.GetName(0, true)), eChatType.CT_System, eChatLoc.CL_SystemWindow);
}
else
{
guardSource.Out.SendMessage(string.Format("You are now guarding {0}.", guardTarget.GetName(0, false)), eChatType.CT_System, eChatLoc.CL_SystemWindow);
guardTarget.Out.SendMessage(string.Format("{0} is now guarding you.", guardSource.GetName(0, true)), eChatType.CT_System, eChatLoc.CL_SystemWindow);
}
guardTarget.TempProperties.setProperty(RealmAbilities.DashingDefenseAbility.Dashing, true);
}
示例13: PreFireChecks
public bool PreFireChecks(GamePlayer player, GameLiving obj)
{
if (obj == null)
return false;
if (player.Realm != obj.Realm)
return false;
if (player.Client.Account.PrivLevel > (int)ePrivLevel.Player)
return true;
if ((obj as GameLiving).InCombat)
{
DisplayMessage(player, "You can't repair object while it is under attack!");
return false;
}
if (obj is GameKeepDoor)
{
GameKeepDoor doorcomponent = obj as GameKeepDoor;
if (doorcomponent.Component.AbstractKeep.InCombat)
{
DisplayMessage(player, "You can't repair the keep door while keep is under attack!");
return false;
}
}
if (obj is IKeepItem)
{
if (obj.CurrentRegion.Time - obj.LastAttackedByEnemyTick <= 60 * 1000)
{
DisplayMessage(player, "You can't repair the keep component while it is under attack!");
return false;
}
}
if ((obj as GameLiving).HealthPercent == 100)
{
DisplayMessage(player, "The component is already at full health!");
return false;
}
if (obj is GameKeepComponent)
{
GameKeepComponent component = obj as GameKeepComponent;
if (component.IsRaized)
{
DisplayMessage(player, "You cannot repair a raized tower!");
return false;
}
}
if (player.IsCrafting)
{
DisplayMessage(player, "You must end your current action before you repair anything!");
return false;
}
if (player.IsMoving)
{
DisplayMessage(player, "You can't repair while moving");
return false;
}
if (!player.IsAlive)
{
DisplayMessage(player, "You can't repair while dead.");
return false;
}
if (player.IsSitting)
{
DisplayMessage(player, "You can't repair while sitting.");
return false;
}
if (player.InCombat)
{
DisplayMessage(player, "You can't repair while in combat.");
return false;
}
if (!player.IsWithinRadius(obj, WorldMgr.INTERACT_DISTANCE))
{
DisplayMessage(player, "You are too far away to repair this component.");
return false;
}
int repairamount = (GetTotalWoodForLevel(obj.Level) / 100) * 15;
int playerswood = CalculatePlayersWood(player, 0);
if (playerswood < repairamount)
{
DisplayMessage(player, "You need another " + (repairamount - playerswood) + " units of wood!");
return false;
}
if (player.GetCraftingSkillValue(eCraftingSkill.WoodWorking) < 1)
{
DisplayMessage(player, "You need woodworking skill to repair.");
return false;
}
player.Stealth(false);
//.........这里部分代码省略.........