public void AddEntry(Mobile from, LedgerEntry e, int index) { if (IsOpen(from)) { from.SendMessage("You can not add Bounties while the Ledger is open."); } else if (m_Entries.Count < 16) { if (e != null) { foreach (LedgerEntry q in m_Entries) { if (e.Mob == q.Mob) { from.SendMessage("You may not have duplicate entries."); return; } } if (from == e.Mob) { from.SendMessage("You may not add yourself to your ledger."); return; } m_Entries.Add(new LedgerEntry(e.Mob, e.Amount, e.IsBounty)); string desc = e.Mob.Name; if (desc == null || (desc = desc.Trim()).Length == 0) { desc = "(indescript)"; } from.SendMessage("You add {0} to your Ledger.", desc); } } else { from.SendMessage("The ledger is full."); } }
// Adam: pack-out null mobs from the list // Not sure, but null mobs may happen when a char is deleted? public void PackEntries() { Console.WriteLine("BountyLedger: Packing..."); while (m_Entries.Count > 0) { bool found = false; for (int ix = 0; ix < m_Entries.Count; ix++) { // wea: 14/Mar/2007 Added additional safety LedgerEntry e = null; if (m_Entries[ix] is LedgerEntry) { e = (LedgerEntry)m_Entries[ix]; } if (e == null) { m_Entries.RemoveAt(ix); found = true; Console.WriteLine("BountyLedger: Removing stale entry"); break; } Mobile mob = (Mobile)e.Mob; if (mob == null || mob.Deleted == true) { m_Entries.RemoveAt(ix); found = true; Console.WriteLine("BountyLedger: Removing stale mob"); break; } } if (found == false) { break; } } }
protected void OnTargetWrapper( Mobile from, object target ) { double skillvalue = from.Skills[SkillName.Forensics].Value; bool wanted = false; bool bonusExists = false; int amount = 0; if(target == null) //kit 12/29/06 sanity checking { from.SendMessage("You have specified an invalid target."); return; } // Packout old entries; m_Book.PackEntries(); if ( target != null && target is Mobile ) { if ( target is PlayerMobile ) { if ( from == (PlayerMobile)target ) { from.SendMessage( "You may not add yourself to your ledger." ); return; } foreach( LedgerEntry q in m_Book.Entries ) { if(q == null || q.Mob == null) //kit 12/19/06 sanity check continue; if ( (PlayerMobile)q.Mob == (PlayerMobile)target ) { from.SendMessage( "You may not have duplicate entries." ); return; } } if ( skillvalue > 80 ) { if( BountyKeeper.BountiesOnPlayer((PlayerMobile)target) > 0 ) { wanted = true; } amount = BountyKeeper.RewardForPlayer((PlayerMobile)target); bonusExists = BountyKeeper.IsEligibleForLBBonus((PlayerMobile)target); if( bonusExists ) { amount += BountyKeeper.CurrentLBBonusAmount; } int infoAmount = 1; if ( skillvalue > 80 ) infoAmount = 1; if ( skillvalue > 95 ) infoAmount = Utility.Random( 1, 2 ); if ( skillvalue > 98 ) infoAmount = Utility.Random( 2, 3 ); if ( skillvalue == 100 ) infoAmount = 3; string whoWants = bonusExists ? "Lord British" : "an Independant Party"; switch ( infoAmount ) { case 0: { from.SendMessage( "You don't recall any bounties out on this person." ); break; } case 1: { if ( wanted ) { from.SendMessage( "That person is wanted." ); LedgerEntry e = new LedgerEntry( (Mobile)target, 0, true ); m_Book.AddEntry( from, e, m_Book.Entries.Count + 1 ); } else { from.SendMessage( "That person is not wanted." ); } break; } case 2: { if ( wanted ) { from.SendMessage( "That person is wanted by {0}.", whoWants ); LedgerEntry e = new LedgerEntry( (Mobile)target, 0, true ); m_Book.AddEntry( from, e, m_Book.Entries.Count + 1 ); } else { from.SendMessage( "That person is not wanted." ); } break; } case 3: { if ( wanted ) { from.SendMessage( "That person is wanted by {0} for {1} GP!", whoWants, amount.ToString() ); LedgerEntry e = new LedgerEntry( (Mobile)target, amount, true ); m_Book.AddEntry( from, e, m_Book.Entries.Count + 1 ); } else { from.SendMessage( "That person is not wanted." ); } break; } default: { if ( wanted ) { from.SendMessage( "You don't recall any bounties out on this person." ); } else { from.SendMessage( "That person is not wanted." ); } break; } } } else { from.SendMessage( "You fail to recall any bounties out on this person." ); } } else { from.SendMessage( "You can not evaluate their status." ); } } else if ( target != null && target is Corpse ) { // Looters ---- if ( from.CheckTargetSkill( SkillName.Forensics, target, 25.0, 100.0 ) ) { Corpse c = (Corpse)target; ArrayList looters = new ArrayList(); if ( c.Looters.Count > 0 ) { foreach ( Mobile mob in c.Looters ) { if(mob == null) //kit 12/29/06 sanity check continue; if ( mob is PlayerMobile ) looters.Add( mob ); } } else { c.LabelTo( from, 501002 );//The corpse has not been desecrated. } if ( !(c.Killer is PlayerMobile) ) { c.LabelTo( from, "They were killed by {0} (NPC)", c.Killer.Name ); } // Corpse Gump Management ---- if ( ((Body)c.Amount).IsHuman && c.Killer != null && looters != null && looters.Count > 0 && c.Killer is PlayerMobile ) { from.SendGump( new ForensicChoiceGump( from, c.Killer, looters, m_Book ) ); return; } else if ( ((Body)c.Amount).IsHuman && c.Killer != null && c.Killer is PlayerMobile ) { from.SendGump( new ForensicKillerGump( from, c.Killer, m_Book ) ); return; } else if ( looters != null && looters.Count > 0 ) { from.SendGump( new ForensicLootGump( from, looters, 0, m_Book ) ); return; } } else { from.SendLocalizedMessage( 501001 );//You cannot determain anything useful. } } else { from.SendMessage( "You have specified an invalid target. Try again." ); from.Target = new AddEntryTarget( m_Book ); } }
public override void OnResponse( NetState state, RelayInfo info ) { Mobile from = state.Mobile; switch ( info.ButtonID ) { case 0: // Closed { from.SendMessage( "You decide not to persue that person." ); break; } case 1: // Cancel { from.SendMessage( "You decide not to persue that person." ); break; } default: // Add { if ( m_Killer is PlayerMobile ) { Mobile m = m_Killer; if ( m.Deleted ) { from.SendMessage( "That player has deleted their character." ); from.SendGump( new ForensicKillerGump( from, m_Killer, m_Book ) ); } else { LedgerEntry e = new LedgerEntry( m_Killer, 0, false ); m_Book.AddEntry( from, e, m_Book.Entries.Count + 1 ); } } else { from.SendMessage( "You have specified an invalid target." ); return; } } break; } }
public void RemoveEntry( Mobile from, LedgerEntry e, int index ) { if ( m_DefaultIndex == index ) m_DefaultIndex = -1; m_Entries.RemoveAt( index ); from.SendMessage( "You erase the listing." ); // You have removed the rune. }
public void AddEntry( Mobile from, LedgerEntry e, int index ) { if ( IsOpen( from ) ) { from.SendMessage( "You can not add Bounties while the Ledger is open." ); } else if ( m_Entries.Count < 16 ) { if ( e != null ) { foreach ( LedgerEntry q in m_Entries ) { if ( e.Mob == q.Mob ) { from.SendMessage( "You may not have duplicate entries." ); return; } } if ( from == e.Mob ) { from.SendMessage( "You may not add yourself to your ledger." ); return; } m_Entries.Add( new LedgerEntry( e.Mob, e.Amount, e.IsBounty ) ); string desc = e.Mob.Name; if ( desc == null || (desc = desc.Trim()).Length == 0 ) desc = "(indescript)"; from.SendMessage( "You add {0} to your Ledger.", desc ); } } else { from.SendMessage( "The ledger is full." ); } }
// private static int GetHueFor( Mobile m ) // { // switch ( m.AccessLevel ) // { // case AccessLevel.Administrator: return 0x516; // case AccessLevel.Seer: return 0x144; // case AccessLevel.GameMaster: return 0x21; // case AccessLevel.Counselor: return 0x2; // case AccessLevel.Player: default: // { // if ( m.Kills >= 5 ) // return 0x21; // else if ( m.Criminal ) // return 0x3B1; // // return 0x58; // } // } // } public override void OnResponse( NetState state, RelayInfo info ) { Mobile from = state.Mobile; switch ( info.ButtonID ) { case 0: // Closed { return; } case 1: // Previous { if ( m_Page > 0 ) from.SendGump( new ForensicLootGump( from, m_Mobiles, m_Page - 1, m_Book ) ); break; } case 2: // Next { if ( (m_Page + 1) * EntryCount < m_Mobiles.Count ) from.SendGump( new ForensicLootGump( from, m_Mobiles, m_Page + 1, m_Book ) ); break; } default: { int index = (m_Page * EntryCount) + (info.ButtonID - 3); if ( index >= 0 && index < m_Mobiles.Count ) { Mobile m = (Mobile)m_Mobiles[index]; if ( m.Deleted ) { from.SendMessage( "That player has deleted their character." ); from.SendGump( new ForensicLootGump( from, m_Mobiles, m_Page, m_Book ) ); } else { LedgerEntry e = new LedgerEntry( m, 0, false ); m_Book.AddEntry( from, e, m_Book.Entries.Count + 1 ); } } break; } } }