本文整理汇总了C#中GameLiving.GetName方法的典型用法代码示例。如果您正苦于以下问题:C# GameLiving.GetName方法的具体用法?C# GameLiving.GetName怎么用?C# GameLiving.GetName使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类GameLiving
的用法示例。
在下文中一共展示了GameLiving.GetName方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: ApplyEffectOnTarget
/// <summary>
/// called when spell effect has to be started and applied to targets
/// </summary>
public override void ApplyEffectOnTarget(GameLiving target, double effectiveness)
{
var npcTarget = target as GameNPC;
if (npcTarget == null) return;
if (npcTarget.Level > Spell.Value)
{
// Resisted
SendSpellResistAnimation(target);
this.MessageToCaster(eChatType.CT_SpellResisted, "{0} is too strong for you to charm!", target.GetName(0, true));
return;
}
if (npcTarget.Brain is IControlledBrain)
{
SendSpellResistAnimation(target);
this.MessageToCaster(eChatType.CT_SpellResisted, "{0} is already under control.", target.GetName(0, true));
return;
}
base.ApplyEffectOnTarget(target, effectiveness);
}
示例2: HealTarget
/// <summary>
/// Heals hit points of one target and sends needed messages, no spell effects
/// </summary>
/// <param name="target"></param>
/// <param name="amount">amount of hit points to heal</param>
/// <returns>true if heal was done</returns>
public virtual bool HealTarget(GameLiving target, int amount)
{
if (target == null || target.ObjectState != GameLiving.eObjectState.Active) return false;
// we can't heal people we can attack
if (GameServer.ServerRules.IsAllowedToAttack(Caster, target, true))
return false;
if (!target.IsAlive)
{
//"You cannot heal the dead!" sshot550.tga
MessageToCaster(target.GetName(0, true) + " is dead!", eChatType.CT_SpellResisted);
return false;
}
int heal = target.ChangeMana(Caster, GameLiving.eManaChangeType.Spell, amount);
if (heal == 0)
{
if (Spell.Pulse == 0)
{
if (target == m_caster) MessageToCaster("Your power is full.", eChatType.CT_SpellResisted);
else MessageToCaster(target.GetName(0, true) + " power is full.", eChatType.CT_SpellResisted);
}
return false;
}
if (m_caster == target)
{
MessageToCaster("You restore " + heal + " power points.", eChatType.CT_Spell);
if (heal < amount)
MessageToCaster("Your power is full.", eChatType.CT_Spell);
}
else
{
MessageToCaster("You restore " + target.GetName(0, false) + " for " + heal + " power points!", eChatType.CT_Spell);
MessageToLiving(target, "Your power was restored by " + m_caster.GetName(0, false) + " for " + heal + " points.", eChatType.CT_Spell);
if (heal < amount)
MessageToCaster(target.GetName(0, true) + " mana is full.", eChatType.CT_Spell);
}
return true;
}
示例3: Start
/// <summary>
/// Start the effect.
/// </summary>
/// <param name="target"></param>
public override void Start(GameLiving target)
{
base.Start(target);
GamePlayer petOwner = null;
if (target is GameNPC && (target as GameNPC).Brain is IControlledBrain)
petOwner = ((target as GameNPC).Brain as IControlledBrain).Owner as GamePlayer;
foreach (GamePlayer player in target.GetPlayersInRadius(WorldMgr.INFO_DISTANCE))
{
if (player == null)
continue;
player.Out.SendSpellEffectAnimation(target, target, 1073, 0, false, 1);
eChatType chatType = (player != null && player == petOwner)
? eChatType.CT_Spell
: eChatType.CT_System;
player.Out.SendMessage(LanguageMgr.GetTranslation(player.Client.Account.Language, "Effects.Necro.TauntEffect.SeemsChange", target.GetName(0, true)), chatType, eChatLoc.CL_SystemWindow);
}
}
示例4: Start
/// <summary>
/// Start the berserk on player
/// </summary>
public override void Start(GameLiving engageSource)
{
base.Start(engageSource);
m_engageTarget = engageSource.TargetObject as GameLiving;
engageSource.IsEngaging = true;
if (m_owner is GamePlayer)
(m_owner as GamePlayer).Out.SendMessage(LanguageMgr.GetTranslation((m_owner as GamePlayer).Client, "Effects.EngageEffect.ConcOnBlockingX", m_engageTarget.GetName(0, false)), eChatType.CT_System, eChatLoc.CL_SystemWindow);
/*
// only emulate attack mode so it works more like on live servers
// entering real attack mode while engaging someone stops engage
// other players will see attack mode after pos update packet is sent
if (!m_owner.AttackState)
{
m_owner.StartAttack(m_engageTarget);
if (m_owner is GamePlayer)
(m_owner as GamePlayer).Out.SendAttackMode(true);
//m_engageSource.Out.SendMessage("You enter combat mode to engage your target!", eChatType.CT_YouHit, eChatLoc.CL_SystemWindow);
//m_engageSource.Out.SendMessage("You enter combat mode and target ["+engageTarget.GetName(0, false)+"]", eChatType.CT_YouHit, eChatLoc.CL_SystemWindow);
}
*/
}
示例5: CasterIsAttacked
public override bool CasterIsAttacked(GameLiving attacker)
{
if (Spell.Uninterruptible)
return false;
if (IsCasting && Stage < 2)
{
double mod = Caster.GetConLevel(attacker);
double chance = 65;
chance += mod * 10;
chance = Math.Max(1, chance);
chance = Math.Min(99, chance);
if (attacker is GamePlayer) chance = 100;
if (Util.Chance((int)chance))
{
Caster.TempProperties.setProperty(INTERRUPT_TIMEOUT_PROPERTY, Caster.CurrentRegion.Time + Caster.SpellInterruptDuration);
MessageToLiving(Caster, attacker.GetName(0, true) + " attacks you and your shot is interrupted!", eChatType.CT_SpellResisted);
InterruptCasting();
return true;
}
}
return true;
}
示例6: WhisperReceive
/// <summary>
/// Talk to trainer
/// </summary>
/// <param name="source"></param>
/// <param name="text"></param>
/// <returns></returns>
public override bool WhisperReceive(GameLiving source, string text)
{
if (!base.WhisperReceive(source, text)) return false;
GamePlayer player = source as GamePlayer;
if (player == null) return false;
switch (text)
{
case "Vampiir":
// promote player to other class
if (CanPromotePlayer(player))
{
player.RemoveAllSpellLines();
player.RemoveAllSkills();
player.RemoveAllSpecs();
player.RemoveAllStyles();
player.Out.SendUpdatePlayerSkills();
player.SkillSpecialtyPoints = 14;//lvl 5 skill points full
PromotePlayer(player, (int)eCharacterClass.Vampiir, "Very well, " + source.GetName(0, false) + ". I gladly take your training into my hands. Congratulations, from this day forth, you are a Vampiir. Here, take this gift to aid you.", null);
foreach (GamePlayer plr in player.GetPlayersInRadius(WorldMgr.VISIBILITY_DISTANCE)) // inform nearest clients about this player now is vampire (can fly)
if (plr != null)
plr.Out.SendVampireEffect(player, true);
// drop any equiped-non usable item, in inventory or on the ground if full
CheckAbilityToUseItem(player);
}
break;
}
return true;
}
示例7: WhisperReceive
/// <summary>
/// Talk to trainer
/// </summary>
/// <param name="source"></param>
/// <param name="text"></param>
/// <returns></returns>
public override bool WhisperReceive(GameLiving source, string text)
{
if (!base.WhisperReceive(source, text)) return false;
GamePlayer player = source as GamePlayer;
switch (text) {
case "song":
// promote player to other class
if (CanPromotePlayer(player)) {
PromotePlayer(player, (int)eCharacterClass.Bard, "Welcome then, " + source.GetName(0, false) + ", to the Bard's life. Here, take this. Keep it well, " + source.GetName(0, false) + ", for the tools of our trade can be quite expensive.", null);
player.ReceiveItem(this,WEAPON_ID1);
}
break;
}
return true;
}
示例8: IsSameRealm
public override bool IsSameRealm(GameLiving source, GameLiving target, bool quiet)
{
if (source == null || target == null)
return false;
// if controlled NPC - do checks for owner instead
if (source is GameNPC)
{
IControlledBrain controlled = ((GameNPC)source).Brain as IControlledBrain;
if (controlled != null)
{
source = controlled.GetLivingOwner();
quiet = true; // silence all attacks by controlled npc
}
}
if (target is GameNPC)
{
IControlledBrain controlled = ((GameNPC)target).Brain as IControlledBrain;
if (controlled != null)
target = controlled.GetLivingOwner();
}
if (source == target)
return true;
// clients with priv level > 1 are considered friendly by anyone
if (target is GamePlayer && ((GamePlayer)target).Client.Account.PrivLevel > 1) return true;
// checking as a gm, targets are considered friendly
if (source is GamePlayer && ((GamePlayer)source).Client.Account.PrivLevel > 1) return true;
// mobs can heal mobs, players heal players/NPC
if (source.Realm == 0 && target.Realm == 0) return true;
//keep guards
if (source is GameKeepGuard && target is GamePlayer)
{
if (!GameServer.KeepManager.IsEnemy(source as GameKeepGuard, target as GamePlayer))
return true;
}
if (target is GameKeepGuard && source is GamePlayer)
{
if (!GameServer.KeepManager.IsEnemy(target as GameKeepGuard, source as GamePlayer))
return true;
}
//doors need special handling
if (target is GameKeepDoor && source is GamePlayer)
return GameServer.KeepManager.IsEnemy(target as GameKeepDoor, source as GamePlayer);
if (source is GameKeepDoor && target is GamePlayer)
return GameServer.KeepManager.IsEnemy(source as GameKeepDoor, target as GamePlayer);
//components need special handling
if (target is GameKeepComponent && source is GamePlayer)
return GameServer.KeepManager.IsEnemy(target as GameKeepComponent, source as GamePlayer);
//Peace flag NPCs are same realm
if (target is GameNPC)
if ((((GameNPC)target).Flags & GameNPC.eFlags.PEACE) != 0)
return true;
if (source is GameNPC)
if ((((GameNPC)source).Flags & GameNPC.eFlags.PEACE) != 0)
return true;
if (source is GamePlayer && target is GamePlayer)
return true;
if (source is GamePlayer && target is GameNPC && target.Realm != 0)
return true;
if (quiet == false) MessageToLiving(source, target.GetName(0, true) + " is not a member of your realm!");
return false;
}
示例9: Execute
public override void Execute(GameLiving living)
{
if (CheckPreconditions(living, DEAD | SITTING | MEZZED | STUNNED))
return;
GamePlayer player = living as GamePlayer;
if (player == null)
return;
GamePlayer targetPlayer = null;
bool isGoodTarget = true;
if (player.TargetObject == null)
{
isGoodTarget = false;
}
else
{
targetPlayer = player.TargetObject as GamePlayer;
if (targetPlayer == null ||
targetPlayer.IsAlive ||
GameServer.ServerRules.IsSameRealm(living, player.TargetObject as GameLiving, true) == false)
{
isGoodTarget = false;
}
}
if (isGoodTarget == false)
{
player.Out.SendMessage("You have to target a dead member of your realm!", eChatType.CT_SpellResisted, eChatLoc.CL_SystemWindow);
return;
}
switch (Level)
{
case 2: m_resurrectValue = 50; break;
case 3: m_resurrectValue = 100; break;
}
GameLiving resurrectionCaster = targetPlayer.TempProperties.getProperty<object>(RESURRECT_CASTER_PROPERTY, null) as GameLiving;
if (resurrectionCaster != null)
{
player.Out.SendMessage("Your target is already considering a resurrection!", eChatType.CT_SpellResisted, eChatLoc.CL_SystemWindow);
return;
}
if( !player.IsWithinRadius( targetPlayer, (int)( 1500 * player.GetModified(eProperty.SpellRange) * 0.01 ) ) )
{
player.Out.SendMessage("You are too far away from your target to use this ability!", eChatType.CT_SpellResisted, eChatLoc.CL_SystemWindow);
return;
}
if (targetPlayer != null)
{
SendCasterSpellEffectAndCastMessage(living, 7019, true);
DisableSkill(living);
//Lifeflight:
//don't rez just yet
//ResurrectLiving(targetPlayer, player);
//we need to add a dialogue response to the rez, copying from the rez spellhandler
targetPlayer.TempProperties.setProperty(RESURRECT_CASTER_PROPERTY, living);
RegionTimer resurrectExpiredTimer = new RegionTimer(targetPlayer);
resurrectExpiredTimer.Callback = new RegionTimerCallback(ResurrectExpiredCallback);
resurrectExpiredTimer.Properties.setProperty("targetPlayer", targetPlayer);
resurrectExpiredTimer.Start(15000);
lock (m_resTimersByLiving.SyncRoot)
{
m_resTimersByLiving.Add(player.TargetObject, resurrectExpiredTimer);
}
//send resurrect dialog
targetPlayer.Out.SendCustomDialog("Do you allow " + living.GetName(0, true) + " to resurrect you\nwith " + m_resurrectValue +" percent hits?", new CustomDialogResponse(ResurrectResponceHandler));
}
}
示例10: IsSameRealm
public override bool IsSameRealm(GameLiving source, GameLiving target, bool quiet)
{
if (source == null || target == null)
return false;
// if controlled NPC - do checks for owner instead
if (source is GameNPC)
{
IControlledBrain controlled = ((GameNPC)source).Brain as IControlledBrain;
if (controlled != null)
{
source = controlled.GetLivingOwner();
quiet = true; // silence all attacks by controlled npc
}
}
if (target is GameNPC)
{
IControlledBrain controlled = ((GameNPC)target).Brain as IControlledBrain;
if (controlled != null)
target = controlled.GetLivingOwner();
}
if (source == target)
return true;
// clients with priv level > 1 are considered friendly by anyone
if (target is GamePlayer && ((GamePlayer)target).Client.Account.PrivLevel > 1) return true;
// checking as a gm, targets are considered friendly
if (source is GamePlayer && ((GamePlayer)source).Client.Account.PrivLevel > 1) return true;
//Peace flag NPCs are same realm
if (target is GameNPC)
if ((((GameNPC)target).Flags & GameNPC.eFlags.PEACE) != 0)
return true;
if (source is GameNPC)
if ((((GameNPC)source).Flags & GameNPC.eFlags.PEACE) != 0)
return true;
if (source.Realm != target.Realm)
{
if (quiet == false) MessageToLiving(source, target.GetName(0, true) + " is not a member of your realm!");
return false;
}
return true;
}
示例11: NoValidTarget
private void NoValidTarget(GameClient client, GameLiving livingToAssist)
{
//Original live text: {0} is not a member of your realm!
//
//The original text sounds stupid if we use it for rams or other things: The battle ram is not a member of your realm!
//
//But the text is also used for rams that are a member of our realm, so we don't use it.
client.Out.SendMessage(LanguageMgr.GetTranslation(client.Account.Language, "Scripts.Players.Assist.NotValid", livingToAssist.GetName(0, true)), eChatType.CT_System, eChatLoc.CL_SystemWindow);
return;
}
示例12: OnDurationEffectApply
/// <summary>
/// Execute Duration Spell Effect on Target
/// </summary>
/// <param name="target"></param>
/// <param name="effectiveness"></param>
public virtual void OnDurationEffectApply(GameLiving target, double effectiveness)
{
if (!target.IsAlive || target.EffectList == null)
return;
eChatType noOverwrite = (Spell.Pulse == 0) ? eChatType.CT_SpellResisted : eChatType.CT_SpellPulse;
GameSpellEffect neweffect = CreateSpellEffect(target, effectiveness);
// Iterate through Overwritable Effect
var overwritenEffects = target.EffectList.OfType<GameSpellEffect>().Where(effect => effect.SpellHandler != null && effect.SpellHandler.IsOverwritable(neweffect));
// Store Overwritable or Cancellable
var enable = true;
var cancellableEffects = new List<GameSpellEffect>(1);
GameSpellEffect overwriteEffect = null;
foreach (var ovEffect in overwritenEffects)
{
// If we can cancel spell effect we don't need to overwrite it
if (ovEffect.SpellHandler.IsCancellable(neweffect))
{
// Spell is better than existing "Cancellable" or it should start disabled
if (IsCancellableEffectBetter(ovEffect, neweffect))
cancellableEffects.Add(ovEffect);
else
enable = false;
}
else
{
// Check for Overwriting.
if (IsNewEffectBetter(ovEffect, neweffect))
{
// New Spell is overwriting this one.
overwriteEffect = ovEffect;
}
else
{
// Old Spell is Better than new one
SendSpellResistAnimation(target);
if (target == Caster)
{
if (ovEffect.ImmunityState)
MessageToCaster("You can't have that effect again yet!", noOverwrite);
else
MessageToCaster("You already have that effect. Wait until it expires. Spell failed.", noOverwrite);
}
else
{
if (ovEffect.ImmunityState)
{
this.MessageToCaster(noOverwrite, "{0} can't have that effect again yet!", ovEffect.Owner != null ? ovEffect.Owner.GetName(0, true) : "(null)");
}
else
{
this.MessageToCaster(noOverwrite, "{0} already has that effect.", target.GetName(0, true));
MessageToCaster("Wait until it expires. Spell Failed.", noOverwrite);
}
}
// Prevent Adding.
return;
}
}
}
// Register Effect list Changes
target.EffectList.BeginChanges();
try
{
// Check for disabled effect
foreach (var disableEffect in cancellableEffects)
disableEffect.DisableEffect(false);
if (overwriteEffect != null)
{
if (enable)
overwriteEffect.Overwrite(neweffect);
else
overwriteEffect.OverwriteDisabled(neweffect);
}
else
{
if (enable)
neweffect.Start(target);
else
neweffect.StartDisabled(target);
}
}
finally
{
target.EffectList.CommitChanges();
}
}
示例13: SendSpellResistMessages
/// <summary>
/// Send Spell Resist Messages to Caster and Target
/// </summary>
/// <param name="target"></param>
public virtual void SendSpellResistMessages(GameLiving target)
{
// Deliver message to the target, if the target is a pet, to its
// owner instead.
if (target is GameNPC)
{
IControlledBrain brain = ((GameNPC)target).Brain as IControlledBrain;
if (brain != null)
{
GamePlayer owner = brain.GetPlayerOwner();
if (owner != null)
{
this.MessageToLiving(owner, eChatType.CT_SpellResisted, "Your {0} resists the effect!", target.Name);
}
}
}
else
{
MessageToLiving(target, "You resist the effect!", eChatType.CT_SpellResisted);
}
// Deliver message to the caster as well.
this.MessageToCaster(eChatType.CT_SpellResisted, "{0} resists the effect!", target.GetName(0, true));
}
示例14: CasterIsAttacked
/// <summary>
/// casting sequence has a chance for interrupt through attack from enemy
/// the final decision and the interrupt is done here
/// TODO: con level dependend
/// </summary>
/// <param name="attacker">attacker that interrupts the cast sequence</param>
/// <returns>true if casting was interrupted</returns>
public virtual bool CasterIsAttacked(GameLiving attacker)
{
//[StephenxPimentel] Check if the necro has MoC effect before interrupting.
if (Caster is NecromancerPet)
{
if ((Caster as NecromancerPet).Owner.EffectList.GetOfType<MasteryofConcentrationEffect>() != null)
{
return false;
}
}
if (Spell.Uninterruptible)
return false;
if (Caster.EffectList.CountOfType(typeof(QuickCastEffect), typeof(MasteryofConcentrationEffect), typeof(FacilitatePainworkingEffect)) > 0)
return false;
if (IsCasting && Stage < 2)
{
if (Caster.ChanceSpellInterrupt(attacker))
{
Caster.LastInterruptMessage = attacker.GetName(0, true) + " attacks you and your spell is interrupted!";
MessageToLiving(Caster, Caster.LastInterruptMessage, eChatType.CT_SpellResisted);
InterruptCasting(); // always interrupt at the moment
return true;
}
}
return false;
}
示例15: CheckBeginCast
/// <summary>
/// All checks before any casting begins
/// </summary>
/// <param name="selectedTarget"></param>
/// <returns></returns>
public virtual bool CheckBeginCast(GameLiving selectedTarget, bool quiet)
{
if (m_caster.ObjectState != GameLiving.eObjectState.Active)
{
return false;
}
if (!m_caster.IsAlive)
{
if(!quiet) MessageToCaster("You are dead and can't cast!", eChatType.CT_System);
return false;
}
if (m_caster is GamePlayer)
{
long nextSpellAvailTime = m_caster.TempProperties.getProperty<long>(GamePlayer.NEXT_SPELL_AVAIL_TIME_BECAUSE_USE_POTION);
if (nextSpellAvailTime > m_caster.CurrentRegion.Time)
{
((GamePlayer)m_caster).Out.SendMessage(LanguageMgr.GetTranslation(((GamePlayer)m_caster).Client, "GamePlayer.CastSpell.MustWaitBeforeCast", (nextSpellAvailTime - m_caster.CurrentRegion.Time) / 1000), eChatType.CT_System, eChatLoc.CL_SystemWindow);
return false;
}
if (((GamePlayer)m_caster).Steed != null && ((GamePlayer)m_caster).Steed is GameSiegeRam)
{
if (!quiet) MessageToCaster("You can't cast in a siegeram!.", eChatType.CT_System);
return false;
}
GameSpellEffect naturesWomb = FindEffectOnTarget(Caster, typeof(NaturesWombEffect));
if (naturesWomb != null)
{
//[StephenxPimentel]
//Get Correct Message for 1.108 update.
MessageToCaster("You are silenced and cannot cast a spell right now.", eChatType.CT_SpellResisted);
return false;
}
}
GameSpellEffect Phaseshift = FindEffectOnTarget(Caster, "Phaseshift");
if (Phaseshift != null && (Spell.InstrumentRequirement == 0 || Spell.SpellType == "Mesmerize"))
{
if (!quiet) MessageToCaster("You're phaseshifted and can't cast a spell", eChatType.CT_System);
return false;
}
// Apply Mentalist RA5L
if (Spell.Range>0)
{
SelectiveBlindnessEffect SelectiveBlindness = Caster.EffectList.GetOfType<SelectiveBlindnessEffect>();
if (SelectiveBlindness != null)
{
GameLiving EffectOwner = SelectiveBlindness.EffectSource;
if(EffectOwner==selectedTarget)
{
if (m_caster is GamePlayer && !quiet)
((GamePlayer)m_caster).Out.SendMessage(string.Format("{0} is invisible to you!", selectedTarget.GetName(0, true)), eChatType.CT_Missed, eChatLoc.CL_SystemWindow);
return false;
}
}
}
if (selectedTarget!=null && selectedTarget.HasAbility("DamageImmunity") && Spell.SpellType == "DirectDamage" && Spell.Radius == 0)
{
if (!quiet) MessageToCaster(selectedTarget.Name + " is immune to this effect!", eChatType.CT_SpellResisted);
return false;
}
if (m_spell.InstrumentRequirement != 0)
{
if (!CheckInstrument())
{
if (!quiet) MessageToCaster("You are not wielding the right type of instrument!",
eChatType.CT_SpellResisted);
return false;
}
}
else if (m_caster.IsSitting) // songs can be played if sitting
{
//Purge can be cast while sitting but only if player has negative effect that
//don't allow standing up (like stun or mez)
if (!quiet) MessageToCaster("You can't cast while sitting!", eChatType.CT_SpellResisted);
return false;
}
if (m_caster.AttackState && m_spell.CastTime != 0)
{
if (m_caster.CanCastInCombat(Spell) == false)
{
m_caster.StopAttack();
return false;
}
}
if (!m_spell.Uninterruptible && m_spell.CastTime > 0 && m_caster is GamePlayer &&
m_caster.EffectList.GetOfType<QuickCastEffect>() == null && m_caster.EffectList.GetOfType<MasteryofConcentrationEffect>() == null)
//.........这里部分代码省略.........