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(); }
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; }
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. }
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; }
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); }
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; }
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 ) { victimEPL.Power -= ( powerTransfer + 1 ) / 2; killerEPL.Power += powerTransfer; killerEPL.History += powerTransfer; victimState.OnGivenSilverTo( killer ); } } #endregion } else { int award = Math.Max( victimState.KillPoints / 10, 1 ); if ( award > 40 ) award = 40; if ( victimState.CanGiveSilverTo( killer ) ) { if ( victimState.KillPoints > 0 ) { victimState.IsActive = true; if ( 1 > Utility.Random( 3 ) ) killerState.IsActive = true; int silver = 0; silver = killerState.Faction.AwardSilver( killer, award * 40 ); if ( silver > 0 ) killer.SendLocalizedMessage( 1042736, String.Format( "{0:N0} silver\t{1}", silver, victim.Name ) ); // You have earned ~1_SILVER_AMOUNT~ pieces for vanquishing ~2_PLAYER_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 ); killer.SendLocalizedMessage( 1042737 + offset, args ); // Thou hast been honored with ~1_KILL_POINTS~ kill point(s) for vanquishing ~2_DEAD_PLAYER~! victim.SendLocalizedMessage( 1042738 + offset, args ); // Thou has lost ~1_KILL_POINTS~ kill point(s) to ~3_ATTACKER_NAME~ for being vanquished! #region Ethics Ethics.Player killerEPL = Ethics.Player.Find( killer ); Ethics.Player victimEPL = Ethics.Player.Find( victim ); if ( killerEPL != null && victimEPL != null && victimEPL.Power > 0 ) { int powerTransfer = Math.Max( 1, victimEPL.Power / 5 ); if ( powerTransfer > ( 100 - killerEPL.Power ) ) powerTransfer = 100 - killerEPL.Power; if ( powerTransfer > 0 ) { victimEPL.Power -= ( powerTransfer + 1 ) / 2; killerEPL.Power += powerTransfer; killerEPL.History += powerTransfer; } } #endregion victimState.OnGivenSilverTo( killer ); } else { killer.SendLocalizedMessage( 1042231 ); // You have recently defeated this enemy and thus their death brings you no honor. } } } }
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; int awardedassistpoints = 0; var participants = GetFactionKillParticipants( victim ); int participantAward = (int) Math.Ceiling( (double) participantsAward / participants.Count() ); foreach ( var participant in participants ) { if ( participant != killer ) { if ( awardedassistpoints + participantAward > participantsAward ) participantAward = participantsAward - awardedassistpoints; GiveKillAward( victim, participant, participantAward, 40 ); awardedassistpoints += participantAward; } if ( awardedassistpoints >= participantsAward ) { break; } } if ( awardedassistpoints + killerAward < totalAward ) killerAward += ( participantsAward - awardedassistpoints ); GiveKillAward( victim, killer, killerAward, 100 * victimState.Rank.Rank ); victimState.KillPoints -= totalAward; victimState.OnGivenSilverTo( killer ); victimState.Faction.UpdateRanks(); killerState.Faction.UpdateRanks(); } } if ( killer == victim || killerState.Faction != victimState.Faction ) ApplySkillLoss( victim ); }
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 + "!" ); victim.SendAsciiMessage( "Thou has lost " + award.ToString() + " kill points to " + killer.Name + " for being vanquished!" ); } else { killer.SendAsciiMessage( "Thou hast been honored with a kill point for vanquishing " + victim.Name + "!" ); victim.SendAsciiMessage( "Thou has lost a kill point(s) to " + killer.Name + " for being vanquished!" ); } victimState.OnGivenSilverTo( killer ); } else { killer.SendAsciiMessage( "You have recently defeated this enemy and thus their death brings you no honor." ); } } } }
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; }
// 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; lastTime = (DateTime.Now - info.LastCombatTime); } } } for ( int i = 0; i < victim.Aggressed.Count; ++i ) { AggressorInfo info = (AggressorInfo)victim.Aggressed[i]; if ( info.Defender != null && info.Defender is PlayerMobile && info.Defender.Alive && (DateTime.Now - info.LastCombatTime) < lastTime && (DateTime.Now - info.LastCombatTime) < TimeSpan.FromMinutes( 2.0 ) ) { PlayerMobile tempkiller = info.Defender as PlayerMobile; PlayerState tempkillerState = PlayerState.Find( tempkiller ); if ( tempkillerState != null && tempkillerState.Faction != victimState.Faction ) { killer = tempkiller; killerState = tempkillerState; lastTime = (DateTime.Now - info.LastCombatTime); } } } // END if ( victim == null || killer == null || victimState == null || killerState == 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. } 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.SendLocalizedMessage( 1042736, String.Format( "{0:N0} silver\t{1}", silver, victim.Name ) ); // You have earned ~1_SILVER_AMOUNT~ pieces for vanquishing ~2_PLAYER_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 ); killer.SendLocalizedMessage( 1042737 + offset, args ); // Thou hast been honored with ~1_KILL_POINTS~ kill point(s) for vanquishing ~2_DEAD_PLAYER~! victim.SendLocalizedMessage( 1042738 + offset, args ); // Thou has lost ~1_KILL_POINTS~ kill point(s) to ~3_ATTACKER_NAME~ for being vanquished! victimState.OnGivenSilverTo( killer ); killerState.LastKill = DateTime.Now; // jakob, added this to hand out rares double bonusChance = killerState.Faction.OwnedTowns * RareChancePerOwnedTown; if ( bonusChance > Utility.RandomDouble() ) { Type rareType = FactionRares.Rares[Utility.Random(FactionRares.Rares.Length)]; Item toGive = null; if ( rareType == typeof(RunicHammer) ) // special case for runic hammer { CraftResource resource = (CraftResource)(Utility.Random(9) + 1); int uses = Utility.Random( 1, 5 ); toGive = new RunicHammer( resource, uses ); } else { try { toGive = (Item)Activator.CreateInstance( rareType ); } catch(Exception e) { Console.WriteLine( "Error when rewarding faction member: {0}", e.ToString() ); } } if ( toGive != null ) { killer.AddToBackpack( toGive ); killer.SendMessage( "You have been given something special." ); } } // end } else { killer.SendLocalizedMessage( 1042231 ); // You have recently defeated this enemy and thus their death brings you no honor. } } } }