public static void FreeThem(PlayerMobile player) { if (null == player) { return; } // Take away any JailRock // No need to recurse containers since all their items were removed when jailed RemoveRockFromList(new ArrayList(player.Items)); RemoveRockFromList(new ArrayList(player.Backpack.Items)); // Restore their access level JailHammer hammer = player.FindItemOnLayer(Layer.OneHanded) as JailHammer; if (null != hammer) { player.AccessLevel = hammer.PlayerAccessLevel; hammer.Delete(); } if (player.Kills >= 5) { player.MoveToWorld(JailConfig.FreeMurdererLocation, JailConfig.FreeMurdererMap); } else { player.MoveToWorld(JailConfig.FreeLocation, JailConfig.FreeMap); } player.SendMessage("You have been released from Jail!"); }
private static void JailPlayerInQueue() { try { PlayerMobile player = s_JailProcessingQueue.Dequeue() as PlayerMobile; if (null != player) { Boots boots = new JailBoots(player.Name); boots.MoveToWorld(player.Location, player.Map); player.MoveToWorld(JailConfig.JailLocation, JailConfig.JailMap); Item robe = new Robe(); robe.Hue = JailConfig.RobeHue; robe.Name = JailConfig.RobeTitle; player.AddItem(robe); player.SendMessage("You have been JAILED!"); if (0 < JailConfig.FineAmount) { if (!Banker.Withdraw(player, JailConfig.FineAmount)) { JailHammer hammer = player.FindItemOnLayer(Layer.OneHanded) as JailHammer; if (null != hammer) { hammer.UsesRemaining *= 2; player.SendMessage("You could not afford the fine so your sentence has been doubled!"); } } else { player.SendMessage("You have been fined {0} gold!", JailConfig.FineAmount); } } } } catch { } }
public override bool OnDragDrop(Mobile from, Item dropped) { if (dropped is JailRock) { PlayerMobile player = from as PlayerMobile; if (null != player) { JailHammer hammer = player.FindItemOnLayer(Layer.OneHanded) as JailHammer; if (null == hammer) { Say("How nice of you to volunteer {0}; get busy mining {1}!", player.Name, JailConfig.JailRockName); Jail.JailThem(player, Jail.JailOption.None); } else { if ((hammer.UsesRemaining -= dropped.Amount) <= 0) { Jail.FreeThem(player); } else { this.Say(hammer.UsesRemaining + " to go, Keep working scoundrel!"); } } } return(true); } else { Say("I dont want that junk! Get me some {0}!", JailConfig.JailRockName); } return(false); }
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 ) ); }
protected override void OnTarget(Mobile from, object to) { LandTarget toLand = to as LandTarget; StaticTarget toStatic = to as StaticTarget; if ((null != toLand && toLand.Name == JailConfig.WhatToMine) || (null != toStatic && toStatic.Name == JailConfig.WhatToMine)) { from.Animate(9, 1, 1, true, false, 0); from.PlaySound(0x145); JailHammer hammer = from.FindItemOnLayer(Layer.OneHanded) as JailHammer; if (null != hammer) { if (Utility.RandomMinMax(0, 101) >= hammer.Difficulty) { from.SendMessage("The {0} crumbles under your hammer.", JailConfig.WhatToMine); from.AddToBackpack(new JailRock()); } else { from.SendMessage("You did not swing hard enough."); } } } else if (to is PlayerMobile) { from.Animate(9, 1, 1, true, false, 0); from.PlaySound(0x145); PlayerMobile toPlayer = to as PlayerMobile; if (toPlayer == from) { from.Say("Ouch, I hit myself with my hammer!"); } else { from.SendMessage("You hit " + toPlayer.Name + " with your hammer!"); toPlayer.SendMessage(from.Name + " has hit you with a hammer!"); toPlayer.Say("Ouch"); JailHammer hammer = from.FindItemOnLayer(Layer.OneHanded) as JailHammer; if (null != hammer) { hammer.UsesRemaining++; } } } else if (to is Mobile) { Mobile toMobile = to as JailSlaveDriver; if (null != toMobile) { from.Animate(9, 1, 1, true, false, 0); from.PlaySound(0x145); toMobile.Say("How dare you!, You\'ll pay with your life!"); from.Criminal = true; toMobile.Combatant = from; } else { from.SendMessage("You dont think they would like that very much."); } } else { from.SendMessage("You should try breaking up some {0} with your hammer!", JailConfig.WhatToMine); } }
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)); }