public static int MobileNotoriety(Mobile source, Mobile target) { if (Core.AOS && (target.Blessed || (target is BaseVendor && ((BaseVendor)target).IsInvulnerable) || target is PlayerVendor || target is TownCrier)) { return(Notoriety.Invulnerable); } if (target.AccessLevel > AccessLevel.Player) { return(Notoriety.CanBeAttacked); } // MODIFICATIONS FOR Capture the Flag / Double Dom games Server.Items.CTFTeam ft = Server.Items.CTFGame.FindTeamFor(source); if (ft != null) { Server.Items.CTFTeam tt = Server.Items.CTFGame.FindTeamFor(target); if (tt != null && ft.Game == tt.Game) { return(ft == tt ? Notoriety.Ally : Notoriety.Enemy); } } if (source.Player && !target.Player && source is PlayerMobile && target is BaseCreature) { BaseCreature bc = (BaseCreature)target; if (!bc.Summoned && !bc.Controled && ((PlayerMobile)source).EnemyOfOneType == target.GetType()) { return(Notoriety.Enemy); } } if (target.Kills >= 5 || (target.Body.IsMonster && IsSummoned(target as BaseCreature) && !(target is BaseFamiliar) && !(target is Golem)) || (target is BaseCreature && (((BaseCreature)target).AlwaysMurderer || ((BaseCreature)target).IsAnimatedDead))) { return(Notoriety.Murderer); } if (target.Criminal) { return(Notoriety.Criminal); } Guild sourceGuild = GetGuildFor(source.Guild as Guild, source); Guild targetGuild = GetGuildFor(target.Guild as Guild, target); if (sourceGuild != null && targetGuild != null) { if (sourceGuild == targetGuild || sourceGuild.IsAlly(targetGuild)) { return(Notoriety.Ally); } else if (sourceGuild.IsEnemy(targetGuild)) { return(Notoriety.Enemy); } } Faction srcFaction = Faction.Find(source, true, true); Faction trgFaction = Faction.Find(target, true, true); if (srcFaction != null && trgFaction != null && srcFaction != trgFaction && source.Map == Faction.Facet) { return(Notoriety.Enemy); } if (SkillHandlers.Stealing.ClassicMode && target is PlayerMobile && ((PlayerMobile)target).PermaFlags.Contains(source)) { return(Notoriety.CanBeAttacked); } if (target is BaseCreature && ((BaseCreature)target).AlwaysAttackable) { return(Notoriety.CanBeAttacked); } if (CheckHouseFlag(source, target, target.Location, target.Map)) { return(Notoriety.CanBeAttacked); } if (!(target is BaseCreature && ((BaseCreature)target).InitialInnocent)) { if (!target.Body.IsHuman && !target.Body.IsGhost && !IsPet(target as BaseCreature) && !Server.Spells.Necromancy.TransformationSpell.UnderTransformation(target)) { return(Notoriety.CanBeAttacked); } } if (CheckAggressor(source.Aggressors, target)) { return(Notoriety.CanBeAttacked); } if (CheckAggressed(source.Aggressed, target)) { return(Notoriety.CanBeAttacked); } if (target is BaseCreature) { BaseCreature bc = (BaseCreature)target; if (bc.Controled && bc.ControlOrder == OrderType.Guard && bc.ControlTarget == source) { return(Notoriety.CanBeAttacked); } } if (source is BaseCreature) { BaseCreature bc = (BaseCreature)source; Mobile master = bc.GetMaster(); if (master != null && CheckAggressor(master.Aggressors, target)) { return(Notoriety.CanBeAttacked); } } //bounty system if (BountyBoard.Attackable(source, target)) { return(Notoriety.CanBeAttacked); } //end bounty system return(Notoriety.Innocent); }
//bounty system here public override bool OnDragDrop(Mobile from, Item item) { try { bool IsHandled = false; // Check if the item being dropped is a head if (item is Head) { Head head = (Head)item; this.Say(500670); // Ah, a head! Let me check to see if there is a bounty on this. BountyBoardEntry entry; bool canClaim = false; Mobile murderer = (Mobile)head.Owner; // Check if the head is a valid head if (murderer != null && head.Killer != null) { // check if there is a bounty and if the murderer can claim it if (BountyBoard.hasBounty(from, murderer, out entry, out canClaim)) { // check if the claimer killed the murderer if (head.Killer != from) { Say(500543); // I had heard this scum was taken care of...but not by you } else { //check age of head if (head.CreationTime < (entry.ExpireTime - BountyBoardEntry.DefaultDecayRate)) { Say("Their is a bounty on this murderer but this head is from long ago!"); } else { // Check that the player does not have negative karma or is a criminal if (from.Karma >= 0 && from.Kills < 5 && !from.Criminal) { if (canClaim) { if (entry.Expired) { Say("The bounty on this murderer has expired."); BountyBoard.RemoveEntry(entry, true); } else { IsHandled = true; Say(1042855, String.Format("{0}\t{1}\t", murderer.Name, entry.Price.ToString())); // The bounty on ~1_PLAYER_NAME~ was ~2_AMOUNT~ gold, and has been credited to your account. from.BankBox.DropItem(new Gold(entry.Price)); // Give the karma they lost back + an amount equal to the bounty from.Karma += entry.Price; BountyBoard.RemoveEntry(entry, false); head.Delete(); } } else { Say("The bounty owner did not approve a reward to you!"); } } else { Say(500542); // We only accept bounty hunting from honorable folk! Away with thee! } } } } else { this.Say(1042854, murderer.Name); // There was no bounty on ~1_PLAYER_NAME~. } } else { Say(500660); // If this were the head of a murderer, I would check for a bounty. } } else { return(base.OnDragDrop(from, item)); } return(IsHandled); } catch { return(false); } }
private void UpdateBountyBoards() { BountyBoard.UpdateBounty(BountyPlayer); }
public BountyBoardGump( Mobile from, BountyBoard board, int page, ArrayList list, SortType sortType ) : base(0, 24) { from.CloseGump( typeof( BountyBoardGump ) ); from.CloseGump( typeof( EditBountyGump ) ); m_From = from; m_Board = board; m_Page = page; m_SortType = sortType; if ( list == null ) { list = new ArrayList(); for ( int i = BountyBoard.Entries.Count - 1; BountyBoard.Entries != null && i >= 0; --i ) { if ( i >= BountyBoard.Entries.Count ) continue; BountyBoardEntry entry = (BountyBoardEntry) BountyBoard.Entries[i]; if ( entry.Expired ) BountyBoard.RemoveEntry( entry, true ); else list.Add( entry ); } } if( m_SortType != SortType.None ) list.Sort( new InternalSorter( m_SortType ) ); m_List = list; int index = GetIndexForPage( page ); int count = 10; int tableIndex = 0; AddPage( 0 ); AddBackground( 10, 10, 750, 439, 5054 ); AddImageTiled( 18, 20, 733, 420, 2624 ); AddImageTiled( 18, 64, 46, 352, 1416 ); // remove AddImageTiled( 67, 64, 170, 352, 200 ); // wanted AddImageTiled( 240, 64, 170, 352, 1416 ); // owner AddImageTiled( 413, 64, 65, 352, 200 ); // price AddImageTiled( 481, 64, 30, 352, 1416 ); // edit AddImageTiled( 514, 64, 60, 352, 200 ); // request AddImageTiled( 577, 64, 170, 352, 200 ); // Expires for ( int i = index; i < (index + count) && i >= 0 && i < list.Count; ++i ) { object obj = list[i]; AddImageTiled( 24, 94 + (tableIndex * 32), 723, 2, 2624 ); ++tableIndex; } // alpha plus four corners AddAlphaRegion(18, 20, 733, 420); AddImage(5, 5, 10460); AddImage(735, 5, 10460); AddImage(5, 424, 10460); AddImage(735, 424, 10460); //text AddHtmlLocalized( 22, 64, 200, 32, 1011403, HtmlColor, false, false ); // Remove AddButton(120, 67, 2117, 2118, 1, GumpButtonType.Reply, 0); // wanted sort AddHtml( 70, 64, 200, 32, Color( "Wanted", HtmlColor ), false, false ); AddButton(283, 67, 2117, 2118, 2, GumpButtonType.Reply, 0); // owner sort AddHtml( 243, 64, 200, 32, Color( "Owner", HtmlColor ), false, false ); AddButton(446, 67, 2117, 2118, 3, GumpButtonType.Reply, 0); // price sort AddHtmlLocalized( 416, 64, 200, 32, 1062218, HtmlColor, false, false ); // Price AddHtmlLocalized( 484, 64, 200, 32, 3005101, HtmlColor, false, false ); // Edit AddHtml( 517, 64, 200, 32, Color( "Request", HtmlColor ), false, false ); AddHtml( 580, 64, 200, 32, Color( "Expires", HtmlColor ), false, false ); // AddButton(446, 67, 2117, 2118, 4, GumpButtonType.Reply, 0); // expire sort AddHtml( 350,32,200,32, Color( "BOUNTIES", HtmlColor ), false, false ); AddHtmlLocalized( 710, 416, 120, 20, 1011441, HtmlColor, false, false ); // EXIT AddButton(675, 416, 4017, 4018, 0, GumpButtonType.Reply, 0); //exit btn if ( page > 0 ) { AddHtmlLocalized( 110, 416, 150, 20, 1011067, HtmlColor, false, false ); // Previous page AddButton(75, 416, 4014, 4016, 4, GumpButtonType.Reply, 0); } if ( GetIndexForPage( page + 1 ) < list.Count ) { AddHtmlLocalized( 410, 416, 150, 20, 1011066, HtmlColor, false, false ); // Next page AddButton(375, 416, 4005, 4007, 5, GumpButtonType.Reply, 0); } tableIndex = 0; for ( int i = index; i < (index + count) && i >= 0 && i < list.Count; ++i ) { object obj = list[i]; int y = 96 + (tableIndex++ * 32); BountyBoardEntry entry = (BountyBoardEntry) obj; if(m_From == entry.Owner || m_From.AccessLevel > AccessLevel.Player ) { AddButton(31, y+2, 5602, 5606, 6 + (i * 3), GumpButtonType.Reply, 0); // remove btn AddButton(488, y+2, 2117, 2118, 7 + (i * 3), GumpButtonType.Reply, 0); //edit btn } else if( entry.Accepted.Contains( m_From )) { AddHtml( 517, y, 200, 32, Color( "Accepted", HtmlColor ), false, false ); } else if( m_From != entry.Wanted && m_From.Account != entry.Wanted.Account ) { AddButton(536, y+2, 2117, 2118, 8 + (i * 3), GumpButtonType.Reply, 0); //request btn } /* else if( ( m_From != entry.Wanted && !entry.Accepted.Contains( m_From ) && m_From.Account != entry.Wanted.Account ) ) { AddButton(559, y+2, 2117, 2118, 8 + (i * 3), GumpButtonType.Reply, 0); //request btn } /* if( entry.Accepted.Contains( m_From )) { AddHtml( 550, y, 200, 32, Color( "Accepted", HtmlColor ), false, false ); } */ AddHtml( 70, y, 200, 32, Color( entry.Wanted.Name, HtmlColor ), false, false ); AddHtml( 243, y, 200, 32, Color( entry.Owner.Name, HtmlColor ), false, false ); AddHtml( 416, y, 200, 32, Color( entry.Price.ToString(), HtmlColor ), false, false ); AddHtml( 580, y, 200, 32, Color( entry.ExpireTime.ToString(), HtmlColor ), false, false ); } }
public BountyBoardGump( Mobile from, BountyBoard board ) : this(from, board, 0, null, SortType.None) { }
public static void EventSink_PlayerDeath(PlayerDeathEventArgs e) { Mobile m = e.Mobile; ArrayList killers = new ArrayList(); ArrayList toGive = new ArrayList(); foreach (AggressorInfo ai in m.Aggressors) { //bounty system edit // orig if ( ai.Attacker.Player && ai.CanReportMurder && !ai.Reported ) if (ai.Attacker.Player && ai.CanReportMurder && !ai.Reported && !BountyBoard.Attackable(ai.Attacker, e.Mobile)) // end bounty system edit { killers.Add(ai.Attacker); ai.Reported = true; } if (ai.Attacker.Player && (DateTime.Now - ai.LastCombatTime) < TimeSpan.FromSeconds(30.0) && !toGive.Contains(ai.Attacker)) { toGive.Add(ai.Attacker); } } foreach (AggressorInfo ai in m.Aggressed) { if (ai.Defender.Player && (DateTime.Now - ai.LastCombatTime) < TimeSpan.FromSeconds(30.0) && !toGive.Contains(ai.Defender)) { toGive.Add(ai.Defender); } } foreach (Mobile g in toGive) { int n = Notoriety.Compute(g, m); int theirKarma = m.Karma, ourKarma = g.Karma; bool innocent = (n == Notoriety.Innocent); bool criminal = (n == Notoriety.Criminal || n == Notoriety.Murderer); int fameAward = m.Fame / 200; int karmaAward = 0; if (innocent) { karmaAward = (ourKarma > -2500 ? -850 : -110 - (m.Karma / 100)); } else if (criminal) { karmaAward = 50; } Titles.AwardFame(g, fameAward, false); Titles.AwardKarma(g, karmaAward, true); } if (m is PlayerMobile && ((PlayerMobile)m).NpcGuild == NpcGuild.ThievesGuild) { return; } if (killers.Count > 0) { new GumpTimer(m, killers).Start(); } }
public static void EventSink_PlayerDeath(PlayerDeathEventArgs e) { Mobile m = e.Mobile; List <Mobile> killers = new List <Mobile>(); List <Mobile> toGive = new List <Mobile>(); foreach (AggressorInfo ai in m.Aggressors) { if (ai.Attacker.Player && ai.CanReportMurder && !ai.Reported) { //bounty system edit // orig if ( ai.Attacker.Player && ai.CanReportMurder && !ai.Reported ) if (ai.Attacker.Player && ai.CanReportMurder && !ai.Reported && !BountyBoard.Attackable(ai.Attacker, e.Mobile) && !m.IsInEvent) // end bounty system edit { killers.Add(ai.Attacker); ai.Reported = true; ai.CanReportMurder = false; } } if (ai.Attacker.Player && (DateTime.Now - ai.LastCombatTime) < TimeSpan.FromSeconds(30.0) && !toGive.Contains(ai.Attacker)) { toGive.Add(ai.Attacker); } } foreach (AggressorInfo ai in m.Aggressed) { if (ai.Defender.Player && (DateTime.Now - ai.LastCombatTime) < TimeSpan.FromSeconds(30.0) && !toGive.Contains(ai.Defender)) { toGive.Add(ai.Defender); } } foreach (Mobile g in toGive) { /* Taran: Fame and Karma awards already exists in FameKillSystem.cs * int n = Notoriety.Compute( g, m ); * * int theirKarma = m.Karma, ourKarma = g.Karma; * bool innocent = ( n == Notoriety.Innocent ); * bool criminal = ( n == Notoriety.Criminal || n == Notoriety.Murderer ); * * int fameAward = m.Fame / 200; * int karmaAward = 0; * * if ( innocent ) * karmaAward = ( ourKarma > -2500 ? -850 : -110 - (m.Karma / 100) ); * else if ( criminal ) * karmaAward = 50; * * Titles.AwardFame( g, fameAward, false ); * Titles.AwardKarma(g, karmaAward, true) */ // modification to support XmlQuest Killtasks of players Items.XmlQuest.RegisterKill(m, g); } if (m is PlayerMobile && ((PlayerMobile)m).NpcGuild == NpcGuild.ThievesGuild) { return; } if (killers.Count > 0) { new GumpTimer(m, killers).Start(); } }
public static int MobileNotoriety(Mobile source, Mobile target) { CustomRegion cR = target.Region as CustomRegion; #region Event Notorieties //Check event prop first for better use of resources if ((source.IsInEvent && !target.IsInEvent) && (cR == null || cR.Controller.HasAttackPenalty)) { return(Notoriety.Invulnerable); } if ((!source.IsInEvent && target.IsInEvent) && (cR == null || cR.Controller.HasAttackPenalty)) { return(Notoriety.Invulnerable); } //Deathmatch if (Custom.PvpToolkit.PvpCore.IsInDeathmatch(source) && Custom.PvpToolkit.PvpCore.IsInDeathmatch(target)) { Custom.PvpToolkit.DMatch.Items.DMStone dm1 = Custom.PvpToolkit.PvpCore.GetPlayerStone(source); Custom.PvpToolkit.DMatch.Items.DMStone dm2 = Custom.PvpToolkit.PvpCore.GetPlayerStone(target); return(dm1 == dm2 ? Notoriety.Enemy : Notoriety.Invulnerable); } //Tournament if (Custom.PvpToolkit.Tournament.TournamentCore.IsInTournament(source) && Custom.PvpToolkit.Tournament.TournamentCore.IsInTournament(target)) { Custom.PvpToolkit.Tournament.TournamentStone stone1 = Custom.PvpToolkit.Tournament.TournamentCore.GetPlayerStone(source); Custom.PvpToolkit.Tournament.TournamentStone stone2 = Custom.PvpToolkit.Tournament.TournamentCore.GetPlayerStone(target); return(stone1 == stone2 ? Notoriety.Enemy : Notoriety.Invulnerable); } //Capture the Flag / Color Wars / Double Dom games if (source is PlayerMobile && target is PlayerMobile) { PlayerMobile src = source as PlayerMobile; PlayerMobile trg = target as PlayerMobile; BaseTeamGame srcevent = src.CurrentEvent as BaseTeamGame; BaseTeamGame trgevent = trg.CurrentEvent as BaseTeamGame; if (srcevent != null && trgevent != null) { BaseGameTeam srcteam = srcevent.GetTeam(source); if (srcteam != null) { BaseGameTeam trgteam = srcevent.GetTeam(target); if (trgteam != null) { return(srcteam == trgteam ? Notoriety.Ally : Notoriety.Enemy); } } } } #endregion if (Core.AOS && (target.Blessed || (target is BaseVendor && ((BaseVendor)target).IsInvulnerable) || target is PlayerVendor || target is TownCrier)) { return(Notoriety.Invulnerable); } if (target is BaseCreature && (((BaseCreature)target).AlwaysMurderer || ((BaseCreature)target).IsAnimatedDead)) { return(Notoriety.Murderer); } if (target is PlayerMobile && (((PlayerMobile)target).AlwaysMurderer)) { return(Notoriety.Murderer); } //All mobiles have same murder rules. if (target.Kills >= KILLS_FOR_MURDER) { return(Notoriety.Murderer); } //Target should be karma red before guild notoriety if (target is PlayerMobile) { if (target.Karma <= PLAYER_KARMA_RED) { return(Notoriety.Murderer); } } Guild sourceGuild = GetGuildFor(source.Guild as Guild, source); Guild targetGuild = GetGuildFor(target.Guild as Guild, target); if (sourceGuild != null && targetGuild != null) { if (sourceGuild == targetGuild || sourceGuild.IsAlly(targetGuild) || (sourceGuild.Type != GuildType.Regular && sourceGuild.Type == targetGuild.Type)) { return(Notoriety.Ally); } if (sourceGuild.IsEnemy(targetGuild)) { return(Notoriety.Enemy); } } if (cR != null && !cR.Controller.HasAttackPenalty) { return(Notoriety.CanBeAttacked); } if (target.AccessLevel > AccessLevel.Player) { return(Notoriety.CanBeAttacked); } if (target is PlayerMobile) //Player mobile notoriety hierarchy { if (target.Criminal) { return(Notoriety.Criminal); } if (target.Karma <= PLAYER_KARMA_GREY) { return(Notoriety.CanBeAttacked); } } else //Mobile notoriety hierarchy { if (target.Karma <= NPC_KARMA_RED) { return(Notoriety.Murderer); } if (target.Criminal) { return(Notoriety.Criminal); } if (target.Karma <= NPC_KARMA_GREY) { return(Notoriety.CanBeAttacked); } } if (source.Player && !target.Player && source is PlayerMobile && target is BaseCreature) { BaseCreature bc = (BaseCreature)target; Mobile master = bc.GetMaster(); if (master != null && master.AccessLevel > AccessLevel.Player) { return(Notoriety.CanBeAttacked); } if (!bc.Summoned && !bc.Controlled && ((PlayerMobile)source).EnemyOfOneType == target.GetType()) { return(Notoriety.Enemy); } if (bc.ControlMaster == source) { return(Notoriety.CanBeAttacked); } master = bc.ControlMaster; if (Core.ML && master != null) { if (source == master && CheckAggressor(target.Aggressors, source)) { return(Notoriety.CanBeAttacked); } return(MobileNotoriety(source, master)); } } Faction srcFaction = Faction.Find(source, true, true); Faction trgFaction = Faction.Find(target, true, true); if (srcFaction != null && trgFaction != null && srcFaction != trgFaction && source.Map == Faction.Facet) { return(Notoriety.Enemy); } if (Stealing.ClassicMode && target is PlayerMobile && ((PlayerMobile)target).PermaFlags.Contains(source)) { return(Notoriety.CanBeAttacked); } if (target is BaseCreature && ((BaseCreature)target).AlwaysAttackable) { return(Notoriety.CanBeAttacked); } if (!IsGuardCandidate(target) && (target is BaseGuard)) { return(Notoriety.Innocent); } //Maka - Repo update, might mess stuff upp //Taran - Yeah it did, I had to uncomment it :P //if (!(target is BaseCreature && ((BaseCreature)target).InitialInnocent)) //{ // if( !target.Body.IsHuman && !target.Body.IsGhost && !IsPet( target as BaseCreature ) && !TransformationSpellHelper.UnderTransformation( target ) && !AnimalForm.UnderTransformation( target ) ) // return Notoriety.CanBeAttacked; //} if (CheckAggressor(source.Aggressors, target)) { return(Notoriety.CanBeAttacked); } if (CheckAggressed(source.Aggressed, target)) { return(Notoriety.CanBeAttacked); } if (target is BaseCreature) { BaseCreature bc = (BaseCreature)target; if (bc.Controlled && bc.ControlOrder == OrderType.Guard && bc.ControlTarget == source) { return(Notoriety.CanBeAttacked); } } if (source is BaseCreature) { BaseCreature bc = (BaseCreature)source; Mobile master = bc.GetMaster(); if (master != null && CheckAggressor(master.Aggressors, target)) { return(Notoriety.CanBeAttacked); } } //bounty system if (BountyBoard.Attackable(source, target)) { return(Notoriety.CanBeAttacked); } //end bounty system return(Notoriety.Innocent); }