private static void Jail_OnCommand(CommandEventArgs e) { JailOption option = GetOptions(e); e.Mobile.Target = new JailTarget(option); e.Mobile.SendMessage("Whom do you wish to Jail?"); }
private static JailOption GetOptions(CommandEventArgs e) { JailOption option = JailOption.None; if (1 <= e.Length) { string str = e.GetString(0).ToLower(); if (str.Equals("-s")) { option = JailOption.Squelch; } } return(option); }
public static void JailThem( PlayerMobile player, JailOption option ) { if ( null == player || player.AccessLevel >= JailConfig.JailImmuneLevel ) return; if ( JailOption.Squelch == option ) player.Squelched = true; foreach ( Item item in player.Items ) { if ( item is JailHammer ) // Jailed while jailed gets them another load of rock to mine { if ( 0 > ( ((JailHammer)item).UsesRemaining += JailConfig.UsesRemaining ) ) // handle integer overflow ((JailHammer)item).UsesRemaining *= -1; Banker.Withdraw( player, JailConfig.FineAmount ); player.SendMessage( "Your remaining sentence has been increased!" ); player.SendMessage( "You have been fined {0} gold and are being kicked!", JailConfig.FineAmount ); // This gives a nice little delay for the message to be read s_KickProcessingQueue.Enqueue( player ); player.Squelched = true; Server.Timer.DelayCall( TimeSpan.FromSeconds( kSecondsTillKick ), new Server.TimerCallback( KickPlayerInQueue ) ); return; } } // If mounted, dismount them and stable mount if ( player.Mounted ) { if ( player.Mount is EtherealMount ) { EtherealMount pet = player.Mount as EtherealMount; pet.Internalize(); pet.Rider = null; } else if ( player.Mount is BaseMount ) { BaseMount pet = player.Mount as BaseMount; pet.Rider = null; Jail.StablePet( player, pet ); } } // Stable all other pets foreach ( Mobile mobile in World.Mobiles.Values ) { if ( mobile is BaseCreature ) { BaseCreature bc = mobile as BaseCreature; if ( null != bc && (bc.Controlled && bc.ControlMaster == player) || (bc.Summoned && bc.SummonMaster == player) ) Jail.StablePet( player, bc ); } } // Move all items to a bag and move that to the bank Container backpack = player.Backpack; Backpack bag = new Backpack(); bag.Hue = JailConfig.RobeHue; ArrayList equipedItems = new ArrayList( player.Items ); foreach ( Item item in equipedItems ) { if ( item.Layer == Layer.Bank || item.Layer == Layer.Backpack || item.Layer == Layer.Hair || item.Layer == Layer.FacialHair || item is DeathShroud ) continue; bag.DropItem( item ); } ArrayList backpackItems = new ArrayList( backpack.Items ); foreach ( Item item in backpackItems ) { if ( item is JailRock ) item.Delete(); else if ( item.Movable ) // Non movable pack items must remain (i.e. skill balls) bag.DropItem( item ); } // Remember their access level and make them a player JailHammer hammer = new JailHammer(); hammer.PlayerAccessLevel = player.AccessLevel; player.AccessLevel = AccessLevel.Player; // Bank the bag of belongings, give them a hammer and welcome them player.BankBox.DropItem( bag ); player.AddItem( hammer ); // Explosively move player to jail player.BoltEffect( 0 ); player.FixedParticles( 0x36BD, 20, 10, 5044, EffectLayer.Waist ); player.PlaySound( 0x307 ); player.FixedParticles( 0x3709, 10, 30, 5052, EffectLayer.LeftFoot ); player.PlaySound( 0x225 ); // This gives a nice little delay for the effect to complete s_JailProcessingQueue.Enqueue( player ); Server.Timer.DelayCall( TimeSpan.FromSeconds( kSecondsTillJail ), new Server.TimerCallback( JailPlayerInQueue ) ); }
public JailTarget( JailOption option ) : base( -1, true, TargetFlags.None ) { m_Option = option; }
public static void JailThem(PlayerMobile player, JailOption option) { if (null == player || player.AccessLevel >= JailConfig.JailImmuneLevel) { return; } if (JailOption.Squelch == option) { player.Squelched = true; } foreach (Item item in player.Items) { if (item is JailHammer) // Jailed while jailed gets them another load of rock to mine { if (0 > (((JailHammer)item).UsesRemaining += JailConfig.UsesRemaining)) // handle integer overflow { ((JailHammer)item).UsesRemaining *= -1; } Banker.Withdraw(player, JailConfig.FineAmount); player.SendMessage("Your remaining sentence has been increased!"); player.SendMessage("You have been fined {0} gold and are being kicked!", JailConfig.FineAmount); // This gives a nice little delay for the message to be read s_KickProcessingQueue.Enqueue(player); player.Squelched = true; Server.Timer.DelayCall(TimeSpan.FromSeconds(kSecondsTillKick), new Server.TimerCallback(KickPlayerInQueue)); return; } } // If mounted, dismount them and stable mount if (player.Mounted) { if (player.Mount is EtherealMount) { EtherealMount pet = player.Mount as EtherealMount; pet.Internalize(); pet.Rider = null; } else if (player.Mount is BaseMount) { BaseMount pet = player.Mount as BaseMount; pet.Rider = null; Jail.StablePet(player, pet); } } // Stable all other pets foreach (Mobile mobile in World.Mobiles.Values) { if (mobile is BaseCreature) { BaseCreature bc = mobile as BaseCreature; if (null != bc && (bc.Controlled && bc.ControlMaster == player) || (bc.Summoned && bc.SummonMaster == player)) { Jail.StablePet(player, bc); } } } // Move all items to a bag and move that to the bank Container backpack = player.Backpack; Backpack bag = new Backpack(); bag.Hue = JailConfig.RobeHue; ArrayList equipedItems = new ArrayList(player.Items); foreach (Item item in equipedItems) { if (item.Layer == Layer.Bank || item.Layer == Layer.Backpack || item.Layer == Layer.Hair || item.Layer == Layer.FacialHair || item is DeathShroud) { continue; } bag.DropItem(item); } ArrayList backpackItems = new ArrayList(backpack.Items); foreach (Item item in backpackItems) { if (item is JailRock) { item.Delete(); } else if (item.Movable) // Non movable pack items must remain (i.e. skill balls) { bag.DropItem(item); } } // Remember their access level and make them a player JailHammer hammer = new JailHammer(); hammer.PlayerAccessLevel = player.AccessLevel; player.AccessLevel = AccessLevel.Player; // Bank the bag of belongings, give them a hammer and welcome them player.BankBox.DropItem(bag); player.AddItem(hammer); // Explosively move player to jail player.BoltEffect(0); player.FixedParticles(0x36BD, 20, 10, 5044, EffectLayer.Waist); player.PlaySound(0x307); player.FixedParticles(0x3709, 10, 30, 5052, EffectLayer.LeftFoot); player.PlaySound(0x225); // This gives a nice little delay for the effect to complete s_JailProcessingQueue.Enqueue(player); Server.Timer.DelayCall(TimeSpan.FromSeconds(kSecondsTillJail), new Server.TimerCallback(JailPlayerInQueue)); }
public JailTarget(JailOption option) : base(-1, true, TargetFlags.None) { m_Option = option; }