public override bool OnMoveOver(Mobile from) { PlayerMobile player = from as PlayerMobile; if (null != player) { if (player.FindItemOnLayer(Layer.OneHanded) is JailHammer) { player.Emote("*Seems somewhat more convinced that mining {0} is a good idea*", JailConfig.JailRockName); } else { Jail.FreeThem(player); return(false); } } return(true); }
public override void OnMovement(Mobile m, Point3D oldLocation) { if (0 < DateTime.Compare(DateTime.Now, m_NextSpeakTime) && m.InRange(this, 3)) { PlayerMobile player = m as PlayerMobile; if (null != player) { if (player.AccessLevel < JailConfig.JailImmuneLevel) { m_NextSpeakTime = DateTime.Now + (TimeSpan.FromSeconds(10)); Move(GetDirectionTo(m.Location)); Say(m_Phrases[Utility.Random(m_Phrases.Length)]); if (null == (player.FindItemOnLayer(Layer.OneHanded) as JailHammer) && InLOS(player)) { Say("Don't just stand around {0}, make yourself useful!", player.Name); Jail.JailThem(player, Jail.JailOption.None); } } } } }
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)); }