本文整理匯總了C#中Server.Mobile.FindMostRecentDamager方法的典型用法代碼示例。如果您正苦於以下問題:C# Mobile.FindMostRecentDamager方法的具體用法?C# Mobile.FindMostRecentDamager怎麽用?C# Mobile.FindMostRecentDamager使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類Server.Mobile
的用法示例。
在下文中一共展示了Mobile.FindMostRecentDamager方法的11個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的C#代碼示例。
示例1: HandleDeath
public static void HandleDeath( Mobile victim, Mobile killer )
{
if( !NewGuildSystem )
return;
if ( killer == null )
killer = victim.FindMostRecentDamager( false );
if( killer == null || victim.Guild == null || killer.Guild == null )
return;
Guild victimGuild = GetAllianceLeader( victim.Guild as Guild );
Guild killerGuild = GetAllianceLeader( killer.Guild as Guild );
WarDeclaration war = killerGuild.FindActiveWar( victimGuild );
if( war == null )
return;
war.Kills++;
if ( war.Opponent == victimGuild )
killerGuild.CheckExpiredWars();
else
victimGuild.CheckExpiredWars();
}
示例2: OnDeath
public override bool OnDeath( Mobile mob, Container corpse )
{
Mobile killer = mob.FindMostRecentDamager( false );
bool hadBomb = false;
Item[] bombs = corpse.FindItemsByType( typeof( BRBomb ), false );
for ( int i = 0; i < bombs.Length; ++i )
( bombs[i] as BRBomb ).DropTo( mob, killer );
hadBomb = ( hadBomb || bombs.Length > 0 );
if ( mob.Backpack != null )
{
bombs = mob.Backpack.FindItemsByType( typeof( BRBomb ), false );
for ( int i = 0; i < bombs.Length; ++i )
( bombs[i] as BRBomb ).DropTo( mob, killer );
hadBomb = ( hadBomb || bombs.Length > 0 );
}
if ( killer != null && killer.Player )
{
BRTeamInfo teamInfo = GetTeamInfo( killer );
BRTeamInfo victInfo = GetTeamInfo( mob );
if ( teamInfo != null && teamInfo != victInfo )
{
BRPlayerInfo playerInfo = teamInfo[killer];
if ( playerInfo != null )
{
playerInfo.Kills += 1;
playerInfo.Score += 1; // base frag
if ( hadBomb )
playerInfo.Score += 4; // fragged bomb carrier
}
}
}
mob.CloseGump( typeof( BRBoardGump ) );
mob.SendGump( new BRBoardGump( mob, this ) );
m_Context.Requip( mob, corpse );
DelayBounce( TimeSpan.FromSeconds( 30.0 ), mob, corpse );
return false;
}
示例3: Requip
public void Requip( Mobile from, Container cont )
{
Corpse corpse = cont as Corpse;
if ( corpse == null )
return;
List<Item> items = new List<Item>( corpse.Items );
bool gathered = false;
bool didntFit = false;
Container pack = from.Backpack;
for ( int i = 0; !didntFit && i < items.Count; ++i )
{
Item item = items[i];
Point3D loc = item.Location;
if ( (item.Layer == Layer.Hair || item.Layer == Layer.FacialHair) || !item.Movable )
continue;
if ( pack != null )
{
pack.DropItem( item );
gathered = true;
}
else
{
didntFit = true;
}
}
corpse.Carved = true;
if ( corpse.ItemID == 0x2006 )
{
corpse.ProcessDelta();
corpse.SendRemovePacket();
corpse.ItemID = Utility.Random( 0xECA, 9 ); // bone graphic
corpse.Hue = 0;
corpse.ProcessDelta();
Mobile killer = from.FindMostRecentDamager( false );
if ( killer != null && killer.Player )
killer.AddToBackpack( new Head( m_Tournament == null ? HeadType.Duel : HeadType.Tournament, from.Name ) );
}
from.PlaySound( 0x3E3 );
if ( gathered && !didntFit )
from.SendLocalizedMessage( 1062471 ); // You quickly gather all of your belongings.
else if ( gathered && didntFit )
from.SendLocalizedMessage( 1062472 ); // You gather some of your belongings. The rest remain on the corpse.
}
示例4: OnDeath
public override bool OnDeath( Mobile mob, Container corpse )
{
Mobile killer = mob.FindMostRecentDamager( false );
bool hadFlag = false;
Item[] flags = corpse.FindItemsByType( typeof( CTFFlag ), false );
for ( int i = 0; i < flags.Length; ++i )
( flags[i] as CTFFlag ).DropTo( mob, killer );
hadFlag = ( hadFlag || flags.Length > 0 );
if ( mob.Backpack != null )
{
flags = mob.Backpack.FindItemsByType( typeof( CTFFlag ), false );
for ( int i = 0; i < flags.Length; ++i )
( flags[i] as CTFFlag ).DropTo( mob, killer );
hadFlag = ( hadFlag || flags.Length > 0 );
}
if ( killer != null && killer.Player )
{
CTFTeamInfo teamInfo = GetTeamInfo( killer );
CTFTeamInfo victInfo = GetTeamInfo( mob );
if ( teamInfo != null && teamInfo != victInfo )
{
CTFPlayerInfo playerInfo = teamInfo[killer];
if ( playerInfo != null )
{
playerInfo.Kills += 1;
playerInfo.Score += 1; // base frag
if ( hadFlag )
playerInfo.Score += 4; // fragged flag carrier
if ( mob.InRange( teamInfo.Origin, 24 ) && mob.Map == this.Facet )
playerInfo.Score += 1; // fragged in base -- guarding
for ( int i = 0; i < m_Controller.TeamInfo.Length; ++i )
{
if ( m_Controller.TeamInfo[i] == teamInfo )
continue;
Mobile ourFlagCarrier = null;
if ( m_Controller.TeamInfo[i].Flag != null )
ourFlagCarrier = m_Controller.TeamInfo[i].Flag.RootParent as Mobile;
if ( ourFlagCarrier != null && GetTeamInfo( ourFlagCarrier ) == teamInfo )
{
for ( int j = 0; j < ourFlagCarrier.Aggressors.Count; ++j )
{
AggressorInfo aggr = ourFlagCarrier.Aggressors[j];
if ( aggr == null || aggr.Defender != ourFlagCarrier || aggr.Attacker != mob )
continue;
playerInfo.Score += 2; // helped defend guy capturing enemy flag
break;
}
if ( mob.Map == ourFlagCarrier.Map && ourFlagCarrier.InRange( mob, 12 ) )
playerInfo.Score += 1; // helped defend guy capturing enemy flag
}
}
}
}
}
mob.CloseGump( typeof( CTFBoardGump ) );
mob.SendGump( new CTFBoardGump( mob, this ) );
m_Context.Requip( mob, corpse );
DelayBounce( TimeSpan.FromSeconds( 30.0 ), mob, corpse );
return false;
}
示例5: OnDamage
public override bool OnDamage(Mobile m, ref int damage)
{
if (Battle != null && Battle.State != PvPBattleState.Internal && !Battle.Hidden &&
!Battle.OnDamage(m.FindMostRecentDamager(true), m, ref damage))
{
return false;
}
return base.OnDamage(m, ref damage);
}
示例6: OnDeath
public override bool OnDeath( Mobile mob, Container corpse )
{
Mobile killer = mob.FindMostRecentDamager( false );
if ( killer != null && killer.Player )
{
DDTeamInfo teamInfo = GetTeamInfo( killer );
DDTeamInfo victInfo = GetTeamInfo( mob );
if ( teamInfo != null && teamInfo != victInfo )
{
DDPlayerInfo playerInfo = teamInfo[killer];
if ( playerInfo != null )
{
playerInfo.Kills += 1;
playerInfo.Score += 1; // base frag
// extra points for killing someone on the waypoint
if ( this.Controller.PointA != null )
{
if ( mob.InRange( this.Controller.PointA, 2 ) )
playerInfo.Score += 1;
}
if ( this.Controller.PointB != null )
{
if ( mob.InRange( this.Controller.PointB, 2 ) )
playerInfo.Score += 1;
}
}
playerInfo = victInfo[mob];
if ( playerInfo != null )
playerInfo.Score -= 1;
}
}
mob.CloseGump( typeof( DDBoardGump ) );
mob.SendGump( new DDBoardGump( mob, this ) );
m_Context.Requip( mob, corpse );
DelayBounce( TimeSpan.FromSeconds( 30.0 ), mob, corpse );
return false;
}
示例7: HandleDeath
public static void HandleDeath( Mobile victim, Mobile killer )
{
if ( killer == null )
killer = victim.FindMostRecentDamager( true );
PlayerState killerState = PlayerState.Find( killer );
Container pack = victim.Backpack;
if ( pack != null )
{
Container killerPack = ( killer == null ? null : killer.Backpack );
Item[] sigils = pack.FindItemsByType( typeof( Sigil ) );
for ( int i = 0; i < sigils.Length; ++i )
{
Sigil sigil = (Sigil)sigils[i];
if ( killerState != null && killerPack != null )
{
if ( killer.GetDistanceToSqrt( victim ) > 64 ) {
sigil.ReturnHome();
killer.SendLocalizedMessage( 1042230 ); // The sigil has gone back to its home location.
}
else if ( Sigil.ExistsOn( killer ) )
{
sigil.ReturnHome();
killer.SendLocalizedMessage( 1010258 ); // The sigil has gone back to its home location because you already have a sigil.
}
else if ( !killerPack.TryDropItem( killer, sigil, false ) )
{
sigil.ReturnHome();
killer.SendLocalizedMessage( 1010259 ); // The sigil has gone home because your backpack is full.
}
}
else
{
sigil.ReturnHome();
}
}
}
if ( killerState == null )
return;
if ( victim is BaseCreature )
{
BaseCreature bc = (BaseCreature)victim;
Faction victimFaction = bc.FactionAllegiance;
if ( bc.Map == Faction.Facet && victimFaction != null && killerState.Faction != victimFaction )
{
int silver = killerState.Faction.AwardSilver( killer, bc.FactionSilverWorth );
if ( silver > 0 )
killer.SendLocalizedMessage( 1042748, silver.ToString( "N0" ) ); // Thou hast earned ~1_AMOUNT~ silver for vanquishing the vile creature.
}
#region Ethics
if ( bc.Map == Faction.Facet && bc.GetEthicAllegiance( killer ) == BaseCreature.Allegiance.Enemy )
{
Ethics.Player killerEPL = Ethics.Player.Find( killer );
if ( killerEPL != null && ( 100 - killerEPL.Power ) > Utility.Random( 100 ) )
{
++killerEPL.Power;
++killerEPL.History;
}
}
#endregion
return;
}
PlayerState victimState = PlayerState.Find( victim );
if ( victimState == null )
return;
if ( killer == victim || killerState.Faction != victimState.Faction )
ApplySkillLoss( victim );
if ( killerState.Faction != victimState.Faction )
{
if ( victimState.KillPoints <= -6 )
{
killer.SendLocalizedMessage( 501693 ); // This victim is not worth enough to get kill points from.
#region Ethics
Ethics.Player killerEPL = Ethics.Player.Find( killer );
Ethics.Player victimEPL = Ethics.Player.Find( victim );
if ( killerEPL != null && victimEPL != null && victimEPL.Power > 0 && victimState.CanGiveSilverTo( killer ) )
{
int powerTransfer = Math.Max( 1, victimEPL.Power / 5 );
if ( powerTransfer > ( 100 - killerEPL.Power ) )
powerTransfer = 100 - killerEPL.Power;
if ( powerTransfer > 0 )
//.........這裏部分代碼省略.........
示例8: HandleDeath
public static void HandleDeath( Mobile victim, Mobile killer )
{
if ( victim.Map != Faction.Facet )
return;
if ( killer == null )
killer = victim.FindMostRecentDamager( true );
PlayerState killerState = PlayerState.Find( killer );
Container pack = victim.Backpack;
if ( pack != null )
{
Container killerPack = ( killer == null ? null : killer.Backpack );
Item[] sigils = pack.FindItemsByType( typeof( Sigil ) );
for ( int i = 0; i < sigils.Length; ++i )
{
Sigil sigil = (Sigil) sigils[i];
if ( killerState != null && killerPack != null )
{
if ( Sigil.ExistsOn( killer ) )
{
sigil.ReturnHome();
killer.SendLocalizedMessage( 1010258 ); // The sigil has gone back to its home location because you already have a sigil.
}
else if ( !killerPack.TryDropItem( killer, sigil, false ) )
{
sigil.ReturnHome();
killer.SendLocalizedMessage( 1010259 ); // The sigil has gone home because your backpack is full.
}
sigil.RestoreThief( killerState.Faction );
}
else
{
sigil.ReturnHome();
}
}
}
PlayerState victimState = PlayerState.Find( victim );
if ( killerState == null )
{
if ( victimState != null && killer is BaseCreature && victim is PlayerMobile )
{
BaseCreature slayingCreature = killer as BaseCreature;
if ( slayingCreature.FactionAllegiance != null && slayingCreature.FactionAllegiance != victimState.Faction )
ApplySkillLoss( victim );
}
return;
}
if ( victim is BaseCreature )
{
BaseCreature bc = (BaseCreature) victim;
Faction victimFaction = bc.FactionAllegiance;
if ( bc.Map == Faction.Facet && victimFaction != null && killerState.Faction != victimFaction )
{
int silver = killerState.Faction.AwardSilver( killer, bc.FactionSilverWorth );
if ( silver > 0 )
{
killer.SendLocalizedMessage( 1042748, silver.ToString( "N0" ) ); // Thou hast earned ~1_AMOUNT~ silver for vanquishing the vile creature.
}
}
return;
}
if ( victimState == null )
return;
if ( killerState.Faction != victimState.Faction )
{
if ( !victimState.CanGiveSilverTo( killer ) )
{
killer.SendLocalizedMessage( 1042231 ); // You have recently defeated this enemy and thus their death brings you no honor.
}
else
{
int totalAward = ComputeKillPointAward( victim );
totalAward = Math.Min( totalAward, victimState.KillPoints - MinFactionKillPoints );
if ( totalAward <= 0 )
{
if ( killer == victim || killerState.Faction != victimState.Faction )
ApplySkillLoss( victim );
killer.SendLocalizedMessage( 501693 ); // This victim is not worth enough to get kill points from.
return;
}
int killerAward = (int) Math.Ceiling( 0.4 * totalAward );
int participantsAward = totalAward - killerAward;
//.........這裏部分代碼省略.........
示例9: HandleDeath
public static void HandleDeath( Mobile victim, Mobile killer )
{
if ( killer == null )
killer = victim.FindMostRecentDamager( true );
PlayerState killerState = PlayerState.Find( killer );
Container pack = victim.Backpack;
if ( pack != null )
{
Container killerPack = ( killer == null ? null : killer.Backpack );
Item[] sigils = pack.FindItemsByType( typeof( Sigil ) );
for ( int i = 0; i < sigils.Length; ++i )
{
Sigil sigil = (Sigil)sigils[i];
if ( killerState != null && killerPack != null )
{
if ( Sigil.ExistsOn( killer ) )
{
sigil.ReturnHome();
killer.SendAsciiMessage( "The sigil has gone back to its home location because you already have a sigil." );
}
else if ( !killerPack.TryDropItem( killer, sigil, false ) )
{
sigil.ReturnHome();
killer.SendAsciiMessage( "The sigil has gone home because your backpack is full." );
}
}
else
{
sigil.ReturnHome();
}
}
}
if ( killerState == null )
return;
if ( victim is BaseCreature )
{
BaseCreature bc = (BaseCreature)victim;
Faction victimFaction = bc.FactionAllegiance;
if ( bc.Map == Faction.Facet && victimFaction != null && killerState.Faction != victimFaction )
{
int silver = killerState.Faction.AwardSilver( killer, bc.FactionSilverWorth );
if ( silver > 0 )
killer.SendAsciiMessage( "Thou hast earned " + silver.ToString( "N0" ) + " silver for vanquishing the vile creature." );
}
return;
}
PlayerState victimState = PlayerState.Find( victim );
if ( victimState == null )
return;
if ( killer == victim || killerState.Faction != victimState.Faction )
ApplySkillLoss( victim );
if ( killerState.Faction != victimState.Faction )
{
if ( victimState.KillPoints <= -6 )
{
killer.SendAsciiMessage( "This victim is not worth enough to get kill points from. " );
}
else
{
int award = Math.Max( victimState.KillPoints / 10, 1 );
if ( award > 40 )
award = 40;
if ( victimState.CanGiveSilverTo( killer ) )
{
if ( victimState.KillPoints > 0 )
{
int silver = 0;
silver = killerState.Faction.AwardSilver( killer, award * 40 );
if ( silver > 0 )
killer.SendAsciiMessage( "You have earned " + silver.ToString() + " pieces for vanquishing " + victim.Name + "!" );
}
victimState.KillPoints -= award;
killerState.KillPoints += award;
int offset = ( award != 1 ? 0 : 2 ); // for pluralization
string args = String.Format( "{0}\t{1}\t{2}", award, victim.Name, killer.Name );
if ( award > 1 )
{
killer.SendAsciiMessage( "Thou hast been honored with " + award.ToString() + " kill points for vanquishing " + victim.Name + "!" );
//.........這裏部分代碼省略.........
示例10: OnDeath
public override bool OnDeath(Mobile mob, Container corpse)
{
Mobile killer = mob.FindMostRecentDamager(false);
KHTeamInfo teamInfo = null;
KHTeamInfo victInfo = GetTeamInfo(mob);
int bonus = 0;
if (killer != null && killer.Player)
teamInfo = GetTeamInfo(killer);
for (int i = 0; i < m_Controller.Hills.Length; i++)
{
if (m_Controller.Hills[i] == null)
continue;
if (m_Controller.Hills[i].King == mob)
{
bonus += m_Controller.Hills[i].CapturesSoFar;
m_Controller.Hills[i].OnKingDied(mob, victInfo, killer, teamInfo);
}
if (m_Controller.Hills[i].King == killer)
bonus += 2;
}
if (teamInfo != null && teamInfo != victInfo)
{
KHPlayerInfo playerInfo = teamInfo[killer];
if (playerInfo != null)
{
playerInfo.Kills += 1;
playerInfo.Score += 1 + bonus;
}
}
mob.CloseGump(typeof(KHBoardGump));
mob.SendGump(new KHBoardGump(mob, this));
m_Context.Requip(mob, corpse);
DelayBounce(TimeSpan.FromSeconds(30.0), mob, corpse);
return false;
}
示例11: HandleDeath
// end
public static void HandleDeath( Mobile victim, Mobile killer )
{
if ((victim != null && victim.Region is CustomRegion && ((CustomRegion)victim.Region).NoFactionEffects) ||
(killer != null && killer.Region is CustomRegion && ((CustomRegion)killer.Region).NoFactionEffects))
return;
if ( killer == null )
killer = victim.FindMostRecentDamager( true );
PlayerState victimState = PlayerState.Find( victim );
//to give statloss from guards
if ( victimState != null && killer is BaseFactionGuard && ((BaseFactionGuard)killer).Faction != victimState.Faction )
ApplySkillLoss( victim );
PlayerState killerState = PlayerState.Find( killer );
Container pack = victim.Backpack;
if ( pack != null )
{
Container killerPack = ( killer == null ? null : killer.Backpack );
Item[] sigils = pack.FindItemsByType( typeof( Sigil ) );
for ( int i = 0; i < sigils.Length; ++i )
{
Sigil sigil = (Sigil)sigils[i];
if ( killerState != null && killerPack != null )
{
if ( Sigil.ExistsOn( killer ) )
{
sigil.ReturnHome();
killer.SendLocalizedMessage( 1010258 ); // The sigil has gone back to its home location because you already have a sigil.
}
else if ( !killerPack.TryDropItem( killer, sigil, false ) )
{
sigil.ReturnHome();
killer.SendLocalizedMessage( 1010259 ); // The sigil has gone home because your backpack is full.
}
}
else
{
sigil.ReturnHome();
}
}
}
if ( killerState == null )
return;
if ( victim is BaseCreature )
{
BaseCreature bc = (BaseCreature)victim;
Faction victimFaction = bc.FactionAllegiance;
bool bcRegionIsNoFactions = (bc.Region is CustomRegion && ((CustomRegion)bc.Region).NoFactionEffects);
if ( Faction.IsFactionMap(bc.Map) && victimFaction != null && killerState.Faction != victimFaction && !bcRegionIsNoFactions)
{
int silver = killerState.Faction.AwardSilver( killer, bc.FactionSilverWorth );
if ( silver > 0 )
killer.SendLocalizedMessage( 1042748, silver.ToString( "N0" ) ); // Thou hast earned ~1_AMOUNT~ silver for vanquishing the vile creature.
}
return;
}
//PlayerState victimState = PlayerState.Find( victim );
if ( victimState == null )
return;
// MODIFICATIONS FOR Capture the Flag / Double Dom games
Server.Items.CTFTeam ft = Server.Items.CTFGame.FindTeamFor( killer );
if ( ft != null )
{
Server.Items.CTFTeam tt = Server.Items.CTFGame.FindTeamFor( victim );
if ( tt != null && ft.Game == tt.Game )
return;
}
// END
// MODIFICATIONS TO award correct player for faction kill ( last damager )
TimeSpan lastTime = TimeSpan.MaxValue;
for ( int i = 0; i < victim.Aggressors.Count; ++i )
{
AggressorInfo info = (AggressorInfo)victim.Aggressors[i];
if ( info.Attacker != null && info.Attacker is PlayerMobile && info.Attacker.Alive && (DateTime.Now - info.LastCombatTime) < lastTime && (DateTime.Now - info.LastCombatTime) < TimeSpan.FromMinutes( 2.0 ) )
{
PlayerMobile tempkiller = info.Attacker as PlayerMobile;
PlayerState tempkillerState = PlayerState.Find( tempkiller );
if ( tempkillerState != null && tempkillerState.Faction != victimState.Faction )
{
killer = tempkiller;
killerState = tempkillerState;
//.........這裏部分代碼省略.........