private void DestroyFurniture( Mobile from, Item item ) { if ( !from.InRange( item.GetWorldLocation(), 3 ) ) { from.SendLocalizedMessage( 500446 ); // That is too far away. return; } else if ( !item.IsChildOf( from.Backpack ) && !item.Movable ) { from.SendLocalizedMessage( 500462 ); // You can't destroy that while it is here. return; } from.SendLocalizedMessage( 500461 ); // You destroy the item. Effects.PlaySound( item.GetWorldLocation(), item.Map, 0x3B3 ); if ( item is Container ) { if ( item is TrapableContainer ) (item as TrapableContainer).ExecuteTrap( from ); ((Container)item).Destroy(); } else { item.Delete(); } }
public static void Resurrect( Mobile m, Item item ) { if ( m.Alive ) return; if ( !m.InRange( item.GetWorldLocation(), ResurrectRange ) ) m.SendLocalizedMessage( 500446 ); // That is too far away. else if ( m.Map != null && m.Map.CanFit( m.Location, 16, false, false ) ) m.SendGump( new ResurrectGump( m, ResurrectMessage.VirtueShrine ) ); else m.SendLocalizedMessage( 502391 ); // Thou can not be resurrected there! }
public static void Resurrect( Mobile m, Item item ) { if ( m.Alive ) return; if (m is PlayerMobile && ((PlayerMobile)m).Mortal && m.AccessLevel == AccessLevel.Player) m.SendMessage("Thy soul was too closely intertwined with thy flesh - thou'rt unable to incorporate a new body."); else if ( !m.InRange( item.GetWorldLocation(), ResurrectRange ) ) m.SendLocalizedMessage( 500446 ); // That is too far away. else if (m.Map != null && m.Map.CanFit(m.Location, 16, CanFitFlags.requireSurface)) m.SendGump( new ResurrectGump( m, ResurrectMessage.VirtueShrine ) ); else m.SendLocalizedMessage( 502391 ); // Thou can not be resurrected there! }
private Item TryStealItem( Item toSteal, ref bool caught ) { //Zen make bankbox close when stealing! BankBox box = m_Thief.FindBankNoCreate(); if ( box != null && box.Opened ) { box.Close(); m_Thief.Send( new MobileUpdate(m_Thief) ); } Item stolen = null; object root = toSteal.RootParent; if ( !IsEmptyHanded( m_Thief ) ) { m_Thief.SendLocalizedMessage( 1005584 ); // Both hands must be free to steal. } // stealing off a corpse is looting else if (root is Corpse && CheckStealing(root as Corpse) == false) { m_Thief.SendMessage("You can't steal that!"); // You can't steal that! } else if ( root is Mobile && ((Mobile)root).Player /*&& IsInnocentTo( m_Thief, (Mobile)root )*/ && !IsInGuild( m_Thief ) ) { m_Thief.SendLocalizedMessage( 1005596 ); // You must be in the thieves guild to steal from other players. } else if ( SuspendOnMurder && root is Mobile && ((Mobile)root).Player && IsInGuild( m_Thief ) && m_Thief.Kills > 0 ) { m_Thief.SendLocalizedMessage( 502706 ); // You are currently suspended from the thieves guild. } else if ( root is BaseVendor && ((BaseVendor)root).IsInvulnerable ) { m_Thief.SendLocalizedMessage( 1005598 ); // You can't steal from shopkeepers. } else if ( root is PlayerVendor ) { m_Thief.SendLocalizedMessage( 502709 ); // You can't steal from vendors. } else if ( !m_Thief.CanSee( toSteal ) ) { m_Thief.SendLocalizedMessage( 500237 ); // Target can not be seen. } else if ( toSteal.Parent == null || !toSteal.Movable || toSteal.LootType == LootType.Newbied || toSteal.CheckBlessed( root ) ) { m_Thief.SendLocalizedMessage( 502710 ); // You can't steal that! } else if ( !m_Thief.InRange( toSteal.GetWorldLocation(), 1 ) ) { m_Thief.SendLocalizedMessage( 502703 ); // You must be standing next to an item to steal it. } else if ( toSteal.Parent is Mobile ) { m_Thief.SendLocalizedMessage( 1005585 ); // You cannot steal items which are equiped. } else if ( root == m_Thief ) { m_Thief.SendLocalizedMessage( 502704 ); // You catch yourself red-handed. } else if ( root is Mobile && ((Mobile)root).AccessLevel > AccessLevel.Player ) { m_Thief.SendLocalizedMessage( 502710 ); // You can't steal that! } else if ( root is Mobile && !m_Thief.CanBeHarmful( (Mobile)root ) ) { m_Thief.SendMessage("You can't steal from them."); } else { double w = toSteal.Weight + toSteal.TotalWeight; if ( w > 10 ) { m_Thief.SendMessage( "That is too heavy to steal." ); } else { if ( toSteal.Stackable && toSteal.Amount > 1 ) { int minAmount = (int)((m_Thief.Skills[SkillName.Stealing].Value / 25.0) / toSteal.Weight); int maxAmount = (int)((m_Thief.Skills[SkillName.Stealing].Value / 10.0) / toSteal.Weight); if ( minAmount < 1 ) minAmount = 1; if ( maxAmount < 1 ) maxAmount = 1; else if ( maxAmount > toSteal.Amount ) maxAmount = toSteal.Amount; int amount = Utility.RandomMinMax( minAmount, maxAmount ); if ( amount >= toSteal.Amount ) { int pileWeight = (int)Math.Ceiling( toSteal.Weight * toSteal.Amount ); pileWeight *= 10; if ( m_Thief.CheckTargetSkill( SkillName.Stealing, toSteal, pileWeight - 22.5, pileWeight + 27.5 ) ) stolen = toSteal; } else { int pileWeight = (int)Math.Ceiling( toSteal.Weight * amount ); pileWeight *= 10; if ( m_Thief.CheckTargetSkill( SkillName.Stealing, toSteal, pileWeight - 22.5, pileWeight + 27.5 ) ) { stolen = toSteal.Dupe( amount ); toSteal.Amount -= amount; } } } else { int iw = (int)Math.Ceiling( w ); iw *= 10; if ( m_Thief.CheckTargetSkill( SkillName.Stealing, toSteal, iw - 22.5, iw + 27.5 ) ) stolen = toSteal; } if ( stolen != null ) m_Thief.SendLocalizedMessage( 502724 ); // You succesfully steal the item. if (m_Thief.Player == true) { ((PlayerMobile)m_Thief).LastStoleAt = DateTime.Now; } if ( stolen == null ) //change from else to if - Pigpen m_Thief.SendLocalizedMessage( 502723 ); // You fail to steal the item. caught = ( m_Thief.Skills[SkillName.Stealing].Value < Utility.Random( 150 ) ); } } // wea: reset next skill time m_Thief.NextSkillTime = DateTime.Now + TimeSpan.FromSeconds(10.0); // adam: reset the LootType.Special to LootType.Regular if (stolen != null && stolen.LootType == LootType.Special) stolen.LootType = LootType.Regular; return stolen; }
public static void PublicOverheadItemMessage(Item item, MessageType type, int hue, int font, string text) { if (item != null && item.Map != null) { Packet p = null; Point3D worldLoc = item.GetWorldLocation(); IPooledEnumerable eable = item.Map.GetClientsInRange(worldLoc, item.GetMaxUpdateRange()); foreach (NetState state in eable) { Mobile m = state.Mobile; if (m.CanSee(item) && m.InRange(worldLoc, item.GetUpdateRange(m))) { if (p == null) { p = new AsciiMessage(item.Serial, item.ItemID, type, hue, font, item.Name, text); p.Acquire(); } state.Send(p); } } Packet.Release(p); eable.Free(); } }
public bool LockDown( Mobile m, Item item, bool checkIsInside ) { if ( !IsCoOwner( m ) || !IsActive ) return false; // Mondain's Legacy Mod if ( ( item is BaseAddonContainer || item.Movable ) && !IsSecure( item ) ) { int amt = 1 + item.TotalItems; Item rootItem = item.RootParent as Item; Item parentItem = item.Parent as Item; if ( checkIsInside && item.RootParent is Mobile ) { m.SendLocalizedMessage( 1005525 );//That is not in your house } else if ( checkIsInside && !IsInside( item.GetWorldLocation(), item.ItemData.Height ) ) { m.SendLocalizedMessage( 1005525 );//That is not in your house } else if ( Ethics.Ethic.IsImbued( item ) ) { m.SendLocalizedMessage( 1005377 );//You cannot lock that down } else if ( IsSecure( rootItem ) ) { m.SendLocalizedMessage( 501737 ); // You need not lock down items in a secure container. } else if ( parentItem != null && !IsLockedDown( parentItem ) ) { m.SendLocalizedMessage( 501736 ); // You must lockdown the container first! } else if ( !(item is VendorRentalContract) && ( IsAosRules ? (!CheckAosLockdowns( amt ) || !CheckAosStorage( amt )) : (this.LockDownCount + amt) > m_MaxLockDowns ) ) { m.SendLocalizedMessage( 1005379 );//That would exceed the maximum lock down limit for this house } else { SetLockdown( item, true ); return true; } } else if ( m_LockDowns.IndexOf( item ) != -1 ) { m.SendLocalizedMessage( 1005526 );//That is already locked down return true; } else { m.SendLocalizedMessage( 1005377 );//You cannot lock that down } return false; }
public virtual bool OnDroppedOnto( Mobile from, Item target ) { if ( Deleted || from.Deleted || target.Deleted || from.Map != target.Map || from.Map == null || target.Map == null ) return false; else if ( from.AccessLevel < AccessLevel.GameMaster && !from.InRange( target.GetWorldLocation(), 2 ) ) return false; else if ( !from.CanSee( target ) || !from.InLOS( target ) ) return false; else if ( !target.IsAccessibleTo( from ) ) return false; else if ( !from.OnDroppedItemOnto( this, target ) ) return false; else return target.OnDragDrop( from, this ); }
public virtual void Use( Item item ) { if ( item == null || item.Deleted ) return; DisruptiveAction(); if ( m_Spell != null && !m_Spell.OnCasterUsingObject( item ) ) return; object root = item.RootParent; bool okay = false; if ( !Utility.InUpdateRange( this, item.GetWorldLocation() ) ) item.OnDoubleClickOutOfRange( this ); else if ( !CanSee( item ) ) item.OnDoubleClickCantSee( this ); else if ( !item.IsAccessibleTo( this ) ) { Region reg = Region.Find( item.GetWorldLocation(), item.Map ); if ( reg == null || !reg.SendInaccessibleMessage( item, this ) ) item.OnDoubleClickNotAccessible( this ); } else if ( !CheckAlive( false ) ) item.OnDoubleClickDead( this ); else if ( item.InSecureTrade ) item.OnDoubleClickSecureTrade( this ); else if ( !AllowItemUse( item ) ) okay = false; else if ( !item.CheckItemUse( this, item ) ) okay = false; else if ( root != null && root is Mobile && ((Mobile)root).IsSnoop( this ) ) item.OnSnoop( this ); else if ( m_Region.OnDoubleClick( this, item ) ) okay = true; if ( okay ) { if ( !item.Deleted ) item.OnItemUsed( this, item ); if ( !item.Deleted ) item.OnDoubleClick( this ); } }
public static void Resurrect( Mobile m, Item item ) { if ( m.Alive ) return; if (m.CantWalk) return; if (!m.InRange(item.GetWorldLocation(), ResurrectRange)) { m.SendAsciiMessage("That is too far away."); // m.SendLocalizedMessage(500446); // That is too far away. } else if (m.Map != null && m.Map.CanFit(m.Location, 16, false, false)) { m.CantWalk = true; m.CloseGump(typeof(ResurrectGump)); if (m is PlayerMobile && !((PlayerMobile)m).HasMenu) { ((PlayerMobile)m).HasMenu = true; m.SendMenu(new ResurrectGump(m, ResurrectMessage.VirtueShrine)); } //m.SendGump( new ResurrectGump( m, ResurrectMessage.VirtueShrine ) ); } else m.SendAsciiMessage("Thou can not be resurrected there!"); //m.SendLocalizedMessage( 502391 ); // Thou can not be resurrected there! }
public static bool CheckDoubleClick( this Item item, Mobile from, bool handle = true, bool allowDead = false, int range = -1, bool packOnly = false, bool inTrade = false, bool inDisplay = true, AccessLevel access = AccessLevel.Player) { if (item == null || item.Deleted || from == null || from.Deleted) { return(false); } if (from.AccessLevel < access) { if (handle) { from.SendMessage("You do not have sufficient access to use this item."); } return(false); } if (!from.CanSee(item) && !(item is IAddon)) { if (handle) { from.SendMessage("This item can't be seen."); item.OnDoubleClickCantSee(from); } return(false); } if (!item.IsAccessibleTo(from)) { if (handle) { item.OnDoubleClickNotAccessible(from); } return(false); } if (item.InSecureTrade && !inTrade) { if (handle) { item.OnDoubleClickSecureTrade(from); } return(false); } if (((item.Parent == null && !item.Movable && !item.IsLockedDown && !item.IsSecure && !item.InSecureTrade) || IsShopItem(item)) && !inDisplay) { if (handle) { from.SendMessage("This item can not be accessed because it is part of a display."); } return(false); } if (!from.Alive && !allowDead) { if (handle) { item.OnDoubleClickDead(from); } return(false); } if (range >= 0 && !from.InRange(item.GetWorldLocation(), range) && !packOnly) { if (handle) { if (range > 0) { from.SendMessage("You must be within {0:#,0} paces to use this item.", range); } else { from.SendMessage("You must be standing on this item to use it."); } item.OnDoubleClickOutOfRange(from); } return(false); } if (packOnly && item.RootParent != from) { if (handle) { // This item must be in your backpack. from.SendLocalizedMessage(1054107); } return(false); } return(true); }
public static bool CheckDoubleClick( this Item item, Mobile from, bool handle = true, bool allowDead = false, int range = 20, bool packOnly = false, bool inTrade = false, AccessLevel access = AccessLevel.Player) { if (item == null || item.Deleted || from == null || from.Deleted) { return(false); } if (from.AccessLevel < access) { if (handle) { from.SendMessage("You do not have sufficient access to use this item."); } return(false); } if (!from.CanSee(item)) { if (handle) { from.SendMessage("This item can't be seen."); item.OnDoubleClickCantSee(from); } return(false); } if (!item.IsAccessibleTo(from)) { if (handle) { item.OnDoubleClickNotAccessible(from); } return(false); } if (item.InSecureTrade && !inTrade) { if (handle) { item.OnDoubleClickSecureTrade(from); } return(false); } if (!from.Alive && !allowDead) { if (handle) { item.OnDoubleClickDead(from); } return(false); } if (range >= 0 && !from.InRange(item.GetWorldLocation(), range) && !packOnly) { if (handle) { if (range > 0) { from.SendMessage("You must be within {0:#,0} paces to use this item.", range); } else { from.SendMessage("You must be standing on this item to use it."); } item.OnDoubleClickOutOfRange(from); } return(false); } if (packOnly && (from.Backpack == null || !item.IsChildOf(from.Backpack))) { if (handle) { // This item must be in your backpack. from.SendLocalizedMessage(1054107); } return(false); } return(true); }
private Item TryStealItem( Item toSteal, ref bool caught ) { Item stolen = null; object root = toSteal.RootParent; StealableArtifactsSpawner.StealableInstance si = null; if ( toSteal.Parent == null || !toSteal.Movable ) si = StealableArtifactsSpawner.GetStealableInstance( toSteal ); if ( !IsEmptyHanded( m_Thief ) ) { m_Thief.SendLocalizedMessage( 1005584 ); // Both hands must be free to steal. } else if ( root is Mobile && ( (Mobile) root ).IsPlayer && IsInnocentTo( m_Thief, (Mobile) root ) && !IsInGuild( m_Thief ) ) { m_Thief.SendLocalizedMessage( 1005596 ); // You must be in the thieves guild to steal from other players. } else if ( SuspendOnMurder && root is Mobile && ( (Mobile) root ).IsPlayer && IsInGuild( m_Thief ) && m_Thief.Kills > 0 ) { m_Thief.SendLocalizedMessage( 502706 ); // You are currently suspended from the thieves guild. } else if ( root is BaseVendor && ( (BaseVendor) root ).IsInvulnerable ) { m_Thief.SendLocalizedMessage( 1005598 ); // You can't steal from shopkeepers. } else if ( root is PlayerVendor ) { m_Thief.SendLocalizedMessage( 502709 ); // You can't steal from vendors. } else if ( !m_Thief.CanSee( toSteal ) ) { m_Thief.SendLocalizedMessage( 500237 ); // Target can not be seen. } else if ( m_Thief.Backpack == null || ( !toSteal.Stackable && !m_Thief.Backpack.CheckHold( m_Thief, toSteal, false, true ) ) ) { m_Thief.SendLocalizedMessage( 1048147 ); // Your backpack can't hold anything else. } #region Sigils else if ( toSteal is Sigil ) { PlayerState pl = PlayerState.Find( m_Thief ); Faction faction = ( pl == null ? null : pl.Faction ); Sigil sig = (Sigil) toSteal; if ( !m_Thief.InRange( toSteal.GetWorldLocation(), 1 ) ) { m_Thief.SendLocalizedMessage( 502703 ); // You must be standing next to an item to steal it. } else if ( root != null ) // not on the ground { m_Thief.SendLocalizedMessage( 502710 ); // You can't steal that! } else if ( faction != null ) { if ( !m_Thief.CanBeginAction( typeof( IncognitoSpell ) ) ) { m_Thief.SendLocalizedMessage( 1010581 ); // You cannot steal the sigil when you are incognito } else if ( DisguiseGump.IsDisguised( m_Thief ) ) { m_Thief.SendLocalizedMessage( 1010583 ); // You cannot steal the sigil while disguised } else if ( !m_Thief.CanBeginAction( typeof( PolymorphSpell ) ) ) { m_Thief.SendLocalizedMessage( 1010582 ); // You cannot steal the sigil while polymorphed } else if ( TransformationSpell.UnderTransformation( m_Thief ) ) { m_Thief.SendLocalizedMessage( 1061622 ); // You cannot steal the sigil while in that form. } else if ( Spells.Ninjitsu.AnimalForm.UnderTransformation( m_Thief ) ) { m_Thief.SendLocalizedMessage( 1063222 ); // You cannot steal the sigil while mimicking an animal. } else if ( pl.IsLeaving ) { m_Thief.SendLocalizedMessage( 1005589 ); // You are currently quitting a faction and cannot steal the town sigil } else if ( sig.IsBeingCorrupted && sig.LastMonolith.Faction == faction ) { m_Thief.SendLocalizedMessage( 1005590 ); // You cannot steal your own sigil } else if ( sig.IsPurifying ) { m_Thief.SendLocalizedMessage( 1005592 ); // You cannot steal this sigil until it has been purified } else if ( m_Thief.CheckTargetSkill( SkillName.Stealing, toSteal, 80.0, 80.0 ) ) { if ( Sigil.ExistsOn( m_Thief ) ) { m_Thief.SendLocalizedMessage( 1010258 ); // The sigil has gone back to its home location because you already have a sigil. } else if ( m_Thief.Backpack == null || !m_Thief.Backpack.CheckHold( m_Thief, sig, false, true ) ) { m_Thief.SendLocalizedMessage( 1010259 ); // The sigil has gone home because your backpack is full } else { if ( sig.IsBeingCorrupted ) sig.GraceStart = DateTime.Now; // begin grace period m_Thief.SendLocalizedMessage( 1010586 ); // YOU STOLE THE SIGIL!!! (woah, calm down now) if ( sig.LastMonolith != null ) sig.LastMonolith.Sigil = null; sig.LastStolen = DateTime.Now; sig.OnStolen( m_Thief ); return sig; } } else { m_Thief.SendLocalizedMessage( 1005594 ); // You do not have enough skill to steal the sigil } } else { m_Thief.SendLocalizedMessage( 1005588 ); // You must join a faction to do that } } #endregion else if ( si == null && ( toSteal.Parent == null || !toSteal.Movable ) ) { m_Thief.SendLocalizedMessage( 502710 ); // You can't steal that! } else if ( toSteal.LootType == LootType.Newbied || ( toSteal.CheckBlessed( root ) && !( root is FillableContainer ) ) ) { m_Thief.SendLocalizedMessage( 502710 ); // You can't steal that! } else if ( si == null && toSteal is Container ) { m_Thief.SendLocalizedMessage( 502710 ); // You can't steal that! } else if ( !m_Thief.InRange( toSteal.GetWorldLocation(), 1 ) ) { m_Thief.SendLocalizedMessage( 502703 ); // You must be standing next to an item to steal it. } else if ( si != null && m_Thief.Skills[SkillName.Stealing].Value < 100.0 ) { m_Thief.SendLocalizedMessage( 1060025, "", 0x66D ); // You're not skilled enough to attempt the theft of this item. } else if ( toSteal.Parent is Mobile ) { m_Thief.SendLocalizedMessage( 1005585 ); // You cannot steal items which are equiped. } else if ( root == m_Thief ) { m_Thief.SendLocalizedMessage( 502704 ); // You catch yourself red-handed. } else if ( root is Mobile && ( (Mobile) root ).AccessLevel > AccessLevel.Player ) { m_Thief.SendLocalizedMessage( 502710 ); // You can't steal that! } else if ( root is Mobile && !m_Thief.CanBeHarmful( (Mobile) root ) ) { } else if ( root is Corpse ) { m_Thief.SendLocalizedMessage( 502710 ); // You can't steal that! } else if ( root is BaseCreature && ( (BaseCreature) root ).ControlMaster == null && ( (BaseCreature) root ).StolenFrom ) { m_Thief.SendLocalizedMessage( 1094948 ); // That creature has already been stolen from. There is nothing left to steal. } else if ( root is BaseCreature && SpecialDropChance( m_Thief, (BaseCreature) root ) > Utility.RandomDouble() ) { try { stolen = (Item) Activator.CreateInstance( m_SpecialDrops[Utility.Random( m_SpecialDrops.Length )] ); } catch { } if ( stolen != null ) { m_Thief.SendLocalizedMessage( 1094947 ); // You successfully steal a special item from the creature! ( (BaseCreature) root ).StolenFrom = true; } } else { double w = toSteal.Weight + toSteal.TotalWeight; if ( w > 10 ) { m_Thief.SendMessage( "That is too heavy to steal." ); } else { if ( toSteal.Stackable && toSteal.Amount > 1 ) { int maxAmount = (int) ( ( m_Thief.Skills[SkillName.Stealing].Value / 10.0 ) / toSteal.Weight ); Utility.FixMinMax( ref maxAmount, 1, toSteal.Amount ); int amount = Utility.RandomMinMax( 1, maxAmount ); if ( amount >= toSteal.Amount ) { int pileWeight = (int) Math.Ceiling( toSteal.Weight * toSteal.Amount ); pileWeight *= 10; if ( m_Thief.CheckTargetSkill( SkillName.Stealing, toSteal, pileWeight - 22.5, pileWeight + 27.5 ) ) { if ( !m_Thief.Backpack.CheckHold( m_Thief, toSteal, false, true ) ) m_Thief.SendLocalizedMessage( 1048147 ); // Your backpack can't hold anything else. else stolen = toSteal; } } else { int pileWeight = (int) Math.Ceiling( toSteal.Weight * amount ); pileWeight *= 10; if ( m_Thief.CheckTargetSkill( SkillName.Stealing, toSteal, pileWeight - 22.5, pileWeight + 27.5 ) ) { stolen = Mobile.LiftItemDupe( toSteal, toSteal.Amount - amount ); if ( stolen == null ) stolen = toSteal; if ( !m_Thief.Backpack.CheckHold( m_Thief, stolen, false, true ) ) { stolen.Delete(); stolen = null; m_Thief.SendLocalizedMessage( 1048147 ); // Your backpack can't hold anything else. } } } } else { int iw = (int) Math.Ceiling( w ); iw *= 10; if ( m_Thief.CheckTargetSkill( SkillName.Stealing, toSteal, iw - 22.5, iw + 27.5 ) ) stolen = toSteal; } if ( stolen != null ) { m_Thief.SendLocalizedMessage( 502724 ); // You succesfully steal the item. if ( si != null ) { toSteal.Movable = true; si.Item = null; } if ( root is BaseCreature ) ( (BaseCreature) root ).StolenFrom = true; } else { m_Thief.SendLocalizedMessage( 502723 ); // You fail to steal the item. } caught = ( m_Thief.Skills[SkillName.Stealing].Value < Utility.Random( 150 ) ); } } return stolen; }
public bool InRange(Item item, int range) { return InRange(item.GetWorldLocation(), item.Map, range); }
public static void Resurrect( Mobile m, Item item, bool chaos ) { if ( m == null || item == null || m.Map == null || m.Alive ) return; if ( !chaos && m.Kills >= 5 ) { m.SendMessage( "Thy deeds are those of a scoundrel; thou shalt not be resurrected here." ); return; } Point3D loc = item.GetWorldLocation(); if ( !m.InRange( loc, ResurrectRange ) || !m.Map.LineOfSight( m, loc ) ) m.SendLocalizedMessage( 500446 ); // That is too far away. else if( m.Map.CanFit( m.Location, 16, false, false ) ) { //m.CloseGump( typeof( ResurrectGump ) ); //m.SendGump( new ResurrectGump( m, ResurrectMessage.VirtueShrine ) ); if ( m.NetState != null ) new ResurrectMenu(m, chaos ? ResurrectMessage.ChaosShrine : ResurrectMessage.VirtueShrine).SendTo(m.NetState); } else m.SendLocalizedMessage( 502391 ); // Thou can not be resurrected there! }
public static void Resurrect( Mobile m, Item item ) { if ( m.Alive ) { return; } if ( !m.InRange( item.GetWorldLocation(), ResurrectRange ) ) { m.SendLocalizedMessage( 500446 ); // That is too far away. } else if ( m.Map != null && m.Map.CanFit( m.Location, 16, false, false ) ) { ( (PlayerMobile) m ).CloseGump( typeof( ResurrectGump ) ); m.SendGump( new ResurrectGump( m, ResurrectMessage.VirtueShrine ) ); } else { m.SendLocalizedMessage( 502391 ); // Thou can not be resurrected there! } }
private Item TryStealItem( Item toSteal, ref bool caught ) { Item stolen = null; object root = toSteal.RootParent; if ( !IsEmptyHanded( m_Thief ) ) { m_Thief.SendAsciiMessage( "Both hands must be free to steal." ); } else if ( root is Mobile && ((Mobile)root).Player && IsInnocentTo( m_Thief, (Mobile)root ) && !IsInGuild( m_Thief ) ) { m_Thief.SendAsciiMessage( "You must be in the thieves guild to steal from other players." ); } else if ( SuspendOnMurder && root is Mobile && ((Mobile)root).Player && IsInGuild( m_Thief ) && m_Thief.Kills > 0 ) { m_Thief.SendAsciiMessage( "You are currently suspended from the thieves guild." ); } else if ( root is BaseVendor && ((BaseVendor)root).IsInvulnerable ) { m_Thief.SendAsciiMessage( "You can't steal from shopkeepers." ); } else if ( root is PlayerVendor ) { m_Thief.SendAsciiMessage( "You can't steal from vendors." ); } else if ( !m_Thief.CanSee( toSteal ) ) { m_Thief.SendAsciiMessage( "Target can not be seen." ); } else if ( m_Thief.Backpack == null || !m_Thief.Backpack.CheckHold( m_Thief, toSteal, false, true ) ) { m_Thief.SendAsciiMessage( "Your backpack can't hold anything else." ); } #region Sigils else if ( toSteal is Sigil ) { PlayerState pl = PlayerState.Find( m_Thief ); Faction faction = ( pl == null ? null : pl.Faction ); Sigil sig = (Sigil) toSteal; if ( !m_Thief.InRange( toSteal.GetWorldLocation(), 1 ) ) { m_Thief.SendMessage( "You must be standing next to an item to steal it." ); } else if ( root != null ) // not on the ground { m_Thief.SendMessage( "You can't steal that!" ); } else if ( faction != null ) { if ( !m_Thief.CanBeginAction( typeof( IncognitoSpell ) ) ) { m_Thief.SendAsciiMessage( "You cannot steal the sigil when you are incognitoed." ); } else if ( DisguiseGump.IsDisguised( m_Thief ) ) { m_Thief.SendAsciiMessage( "You cannot steal the sigil while disguised." ); } else if ( !m_Thief.CanBeginAction( typeof( PolymorphSpell ) ) ) { m_Thief.SendAsciiMessage( "You cannot steal the sigil while polymorphed." ); } else if ( TransformationSpell.UnderTransformation( m_Thief ) ) { m_Thief.SendAsciiMessage( "You cannot steal the sigil while in that form." ); } else if ( pl.IsLeaving ) { m_Thief.SendAsciiMessage( "You are currently quitting a faction and cannot steal the town sigil." ); } else if ( sig.IsBeingCorrupted && sig.LastMonolith.Faction == faction ) { m_Thief.SendAsciiMessage( "You cannot steal your own sigil." ); } else if ( sig.IsPurifying ) { m_Thief.SendAsciiMessage( "You cannot steal this sigil until it has been purified." ); } else if ( m_Thief.CheckTargetSkill( SkillName.Stealing, toSteal, 80.0, 80.0 ) ) { if ( Sigil.ExistsOn( m_Thief ) ) { m_Thief.SendMessage( "The sigil has gone back to its home location because you already have a sigil." ); } else if ( m_Thief.Backpack == null || !m_Thief.Backpack.CheckHold( m_Thief, sig, false, true ) ) { m_Thief.SendAsciiMessage( "The sigil has gone home because your backpack is full." ); } else { if ( sig.IsBeingCorrupted ) sig.GraceStart = DateTime.Now; // begin grace period m_Thief.SendAsciiMessage( "YOU STOLE THE SIGIL!!!" ); if ( sig.LastMonolith != null ) sig.LastMonolith.Sigil = null; sig.LastStolen = DateTime.Now; return sig; } } else { m_Thief.SendAsciiMessage( "You do not have enough skill to steal the sigil." ); } } else { m_Thief.SendAsciiMessage( "You must join a faction to do that." ); } } #endregion else if ( toSteal.Parent == null || !toSteal.Movable || toSteal.LootType == LootType.Newbied || toSteal.CheckBlessed( root ) ) { m_Thief.SendAsciiMessage( "You can't steal that!" ); } else if ( Core.AOS && toSteal is Container ) { m_Thief.SendAsciiMessage( "You can't steal that!" ); } else if ( !m_Thief.InRange( toSteal.GetWorldLocation(), 1 ) ) { m_Thief.SendAsciiMessage( "You must be standing next to an item to steal it." ); } else if ( toSteal.Parent is Mobile ) { m_Thief.SendAsciiMessage( "You cannot steal items which are equipped." ); } else if ( root == m_Thief ) { m_Thief.SendAsciiMessage( "You catch yourself red-handed." ); } else if ( root is Mobile && ((Mobile)root).AccessLevel > AccessLevel.Player ) { m_Thief.SendAsciiMessage( "You can't steal that!" ); } else if ( root is Mobile && !m_Thief.CanBeHarmful( (Mobile)root ) ) { } else if ( root is Corpse ) { m_Thief.SendAsciiMessage( "You can't steal that!" ); } else { double w = toSteal.Weight + toSteal.TotalWeight; if ( w > 10 ) { m_Thief.SendMessage( "That is too heavy to steal." ); } else { if ( toSteal.Stackable && toSteal.Amount > 1 ) { int maxAmount = (int)((m_Thief.Skills[SkillName.Stealing].Value / 10.0) / toSteal.Weight); if ( maxAmount < 1 ) maxAmount = 1; else if ( maxAmount > toSteal.Amount ) maxAmount = toSteal.Amount; int amount = Utility.RandomMinMax( 1, maxAmount ); if ( amount >= toSteal.Amount ) { int pileWeight = (int)Math.Ceiling( toSteal.Weight * toSteal.Amount ); pileWeight *= 10; if ( m_Thief.CheckTargetSkill( SkillName.Stealing, toSteal, pileWeight - 22.5, pileWeight + 27.5 ) ) stolen = toSteal; } else { int pileWeight = (int)Math.Ceiling( toSteal.Weight * amount ); pileWeight *= 10; if ( m_Thief.CheckTargetSkill( SkillName.Stealing, toSteal, pileWeight - 22.5, pileWeight + 27.5 ) ) { stolen = toSteal.Dupe( amount ); toSteal.Amount -= amount; } } } else { int iw = (int)Math.Ceiling( w ); iw *= 10; if ( m_Thief.CheckTargetSkill( SkillName.Stealing, toSteal, iw - 22.5, iw + 27.5 ) ) stolen = toSteal; } if ( stolen != null ) m_Thief.SendAsciiMessage( "You succesfully steal the item." ); else m_Thief.SendAsciiMessage( "You fail to steal the item." ); caught = ( m_Thief.Skills[SkillName.Stealing].Value < Utility.Random( 150 ) ); } } return stolen; }
public void Lift( Item item, int amount, out bool rejected, out LRReason reject ) { rejected = true; reject = LRReason.Inspecific; if ( item == null ) return; Mobile from = this; GameClient state = m_Client; if ( from.AccessLevel >= AccessLevel.GameMaster || DateTime.Now >= from.NextActionTime ) { if ( from.CheckAlive() ) { from.DisruptiveAction(); if ( from.Holding != null ) { reject = LRReason.AreHolding; } else if ( from.AccessLevel < AccessLevel.GameMaster && !from.InRange( item.GetWorldLocation(), 2 ) ) { reject = LRReason.OutOfRange; } else if ( !from.CanSee( item ) || !from.InLOS( item ) ) { reject = LRReason.OutOfSight; } else if ( !item.VerifyMove( from ) ) { reject = LRReason.CannotLift; } else if ( !item.IsAccessibleTo( from ) ) { reject = LRReason.CannotLift; } else if ( item.CheckLift( from, item, ref reject ) ) { object root = item.RootParent; if ( root != null && root is Mobile && !( (Mobile) root ).CheckNonlocalLift( from, item ) ) { reject = LRReason.TryToSteal; } else if ( !from.OnDragLift( item ) || !item.OnDragLift( from ) ) { reject = LRReason.Inspecific; } else if ( !from.CheckAlive() ) { reject = LRReason.Inspecific; } else { if ( item.Parent != null && item.Parent is Container ) ( (Container) item.Parent ).FreePosition( item.GridLocation ); item.SetLastMoved(); if ( item.Spawner != null ) { item.Spawner.Remove( item ); item.Spawner = null; } if ( amount == 0 ) amount = 1; if ( amount > item.Amount ) amount = item.Amount; int oldAmount = item.Amount; //item.Amount = amount; //Set in LiftItemDupe if ( amount < oldAmount ) LiftItemDupe( item, amount ); InvokeItemLifted( new ItemLiftedEventArgs( item, amount ) ); item.RecordBounce(); item.OnItemLifted( from, item ); item.Internalize(); from.Holding = item; from.NextActionTime = DateTime.Now + TimeSpan.FromSeconds( 0.5 ); Point3D fixLoc = item.Location; Map fixMap = item.Map; bool shouldFix = ( item.Parent == null ); if ( fixMap != null && shouldFix ) fixMap.FixColumn( fixLoc.X, fixLoc.Y ); reject = LRReason.Inspecific; rejected = false; } } } else { reject = LRReason.Inspecific; } } else { SendActionMessage(); reject = LRReason.Inspecific; } if ( rejected && state != null ) { state.Send( LiftRej.Instantiate( reject ) ); if ( item.Parent is Item ) state.Send( new ContainerContentUpdate( item ) ); else if ( item.Parent is Mobile ) state.Send( new EquipUpdate( item ) ); else item.SendInfoTo( state ); if ( ObjectPropertyListPacket.Enabled && item.Parent != null ) state.Send( item.OPLPacket ); } }
public bool LockDown(Mobile m, Item item, bool checkIsInside) { if (!IsFriend(m)) return false; if (item.Movable && !IsSecure(item)) { // wea: 14/Aug/2006 modified so containers are treated as a single item int amt; if (item is BaseContainer) amt = 1; else amt = 1 + item.TotalItems; Item rootItem = item.RootParent as Item; if (checkIsInside && item.RootParent is Mobile) { m.SendLocalizedMessage(1005525);//That is not in your house } else if (checkIsInside && !IsInside(item.GetWorldLocation(), item.ItemData.Height)) { m.SendLocalizedMessage(1005525);//That is not in your house } else if (IsSecure(rootItem)) { m.SendLocalizedMessage(501737); // You need not lock down items in a secure container. } //Pix: In order to eliminate an exploit where players can create non-movable objects anywhere // in the world, we'll make then not be able to lock down items inside containers. // If the item is not in a container, then the rootItem will be null. else if (rootItem != null) { m.SendMessage("You cannot lock down items inside containers."); } //else if ( rootItem != null && !IsLockedDown( rootItem ) ) //{ // m.SendLocalizedMessage( 501736 ); // You must lockdown the container first! //} else if (IsAosRules ? (!CheckAosLockdowns(amt) || !CheckAosStorage(amt)) : (this.LockDownCount + amt) > m_MaxLockDowns) { m.SendLocalizedMessage(1005379);//That would exceed the maximum lock down limit for this house } else if (item is Container && !IsExceptionContainer(item) && (m_LockBoxCount >= m_MaxLockBoxes /*|| m_Public*/)) { /*if ( m_Public ) m.SendMessage( "Public houses may not have locked down containers." ); else*/ m.SendMessage("The maximum number of LockBoxes has been reached : {0}", m_MaxLockBoxes.ToString()); return false; } else if (item is Container && !IsExceptionContainer(item) && StorageTaxCredits == 0 && m_LockBoxCount >= LockBoxFloor) { m.SendMessage("You do not have enough stored tax credits to lock that down."); return false; } else { SetLockdown(item, true); return true; } } else if (m_LockDowns.IndexOf(item) != -1) { m.SendLocalizedMessage(1005526);//That is already locked down return true; } else { m.SendLocalizedMessage(1005377);//You cannot lock that down } return false; }
public virtual void Lift( Item item, int amount, out bool rejected, out LRReason reject ) { rejected = true; reject = LRReason.Inspecific; if ( item == null ) return; Mobile from = this; NetState state = m_NetState; if ( from.AccessLevel >= AccessLevel.GameMaster || Core.Now >= from.NextActionTime ) { if ( from.CheckAlive() ) { from.DisruptiveAction(); if ( from.Holding != null ) { reject = LRReason.AreHolding; } else if ( from.AccessLevel < AccessLevel.GameMaster && !from.InRange( item.GetWorldLocation(), 2 ) ) { reject = LRReason.OutOfRange; } else if ( !from.CanSee( item ) || !from.InLOS( item ) ) { reject = LRReason.OutOfSight; } else if ( !item.VerifyMove( from ) ) { reject = LRReason.CannotLift; } else if ( item.InSecureTrade || !item.IsAccessibleTo( from ) ) { reject = LRReason.CannotLift; } else if ( !item.CheckLift( from, item ) ) { reject = LRReason.Inspecific; } else { object root = item.RootParent; if ( root != null && root is Mobile && !((Mobile)root).CheckNonlocalLift( from, item ) ) { reject = LRReason.TryToSteal; } else if ( !from.OnDragLift( item ) || !item.OnDragLift( from ) ) { reject = LRReason.Inspecific; } else if ( !from.CheckAlive() ) { reject = LRReason.Inspecific; } else { item.SetLastMoved(); if ( amount == 0 ) amount = 1; if ( amount > item.Amount ) amount = item.Amount; int oldAmount = item.Amount; item.Amount = amount; if ( amount < oldAmount ) item.Dupe( oldAmount - amount ); Map map = from.Map; if ( Mobile.DragEffects && map != null && (root == null || root is Item)) { IPooledEnumerable eable = map.GetClientsInRange( from.Location ); Packet p = null; foreach ( NetState ns in eable ) { if ( ns.Mobile != from && ns.Mobile.CanSee( from ) ) { if ( p == null ) { IEntity src; if ( root == null ) src = new Entity( Serial.Zero, item.Location, map ); else src = new Entity( ((Item)root).Serial, ((Item)root).Location, map ); p = new DragEffect( src, from, item.ItemID, item.Hue, amount ); } ns.Send( p ); } } eable.Free(); } Point3D fixLoc = item.Location; Map fixMap = item.Map; bool shouldFix = ( item.Parent == null ); item.RecordBounce(); item.OnItemLifted( from, item ); item.Internalize(); from.Holding = item; int liftSound = item.GetLiftSound( from ); if ( liftSound != -1 ) from.Send( new PlaySound( liftSound, from ) ); from.NextActionTime = Core.Now + TimeSpan.FromSeconds( 0.5 ); if ( fixMap != null && shouldFix ) fixMap.FixColumn( fixLoc.m_X, fixLoc.m_Y ); reject = LRReason.Inspecific; rejected = false; } } } else { reject = LRReason.Inspecific; } } else { SendActionMessage(); reject = LRReason.Inspecific; } if ( rejected && state != null ) { state.Send( new LiftRej( reject ) ); if( item.Parent is Item ) { if ( state.IsPost6017 ) state.Send( new ContainerContentUpdate6017( item ) ); else state.Send( new ContainerContentUpdate( item ) ); } else if( item.Parent is Mobile ) state.Send( new EquipUpdate( item ) ); else item.SendInfoTo( state ); if ( ObjectPropertyList.Enabled && item.Parent != null ) state.Send( item.OPLPacket ); } }
public bool LockDown( Mobile m, Item item, bool checkIsInside ) { if ( !IsCoOwner( m ) || !IsActive ) return false; if ( item.Movable && !IsSecure( item ) ) { Item rootItem = item.RootParent as Item; if ( checkIsInside && item.RootParent is Mobile ) { m.SendLocalizedMessage( 1005525 ); // That is not in your house } else if ( checkIsInside && !IsInside( item.GetWorldLocation(), item.ItemData.Height ) ) { m.SendLocalizedMessage( 1005525 ); // That is not in your house } else if ( IsSecure( rootItem ) ) { m.SendLocalizedMessage( 501737 ); // You need not lock down items in a secure container. } else if ( rootItem != null ) { m.SendLocalizedMessage( 1005525 ); // That is not in your house } else if ( item.Stackable && ( ( !(item is Gold) && item.Amount > 2 ) || item.Amount > 10 ) ) { m.SendMessage( "You can not lock this down." ); } else if (this.LockDownCount + 1 > m_MaxLockDowns) { m.SendLocalizedMessage( 1005379 );//That would exceed the maximum lock down limit for this house } else { // TODO: better way of restricting placement near stairs? int range = (this is Tower) ? 2 : 1; for ( int i = 0; m_Doors != null && i < m_Doors.Count; ++i ) { BaseDoor door = m_Doors[i] as BaseDoor; Point3D p = door.Location; if ( door.Open ) p = new Point3D( p.X - door.Offset.X, p.Y - door.Offset.Y, p.Z - door.Offset.Z ); //if ( item.Z + 16 >= p.Z && p.Z + 16 >= item.Z ) if ( item.Z + 16 >= p.Z && item.Z - 16 <= p.Z ) { if ( Utility.InRange( item.Location, p, range ) ) { m.SendAsciiMessage( "You cannot lock down items near a door or near stairs." ); return false; } } } SetLockdown( item, true ); if ( IsLockedDown( item ) ) item.PublicOverheadMessage( MessageType.Label, 0x3B2, true, "(locked down)" ); return true; } } else if ( m_LockDowns.IndexOf( item ) != -1 ) { m.SendLocalizedMessage( 1005526 );//That is already locked down return true; } else { m.SendLocalizedMessage( 1005377 );//You cannot lock that down } return false; }
public bool LockDown( Mobile m, Item item, bool checkIsInside ) { if ( !IsKeyOwner( m ) || !IsActive ) return false; if ( item.Movable && !IsSecure( item ) ) { int amt = 1 + item.TotalItems; Item rootItem = item.RootParent as Item; Item parentItem = item.Parent as Item; if ( checkIsInside && item.RootParent is Mobile ) { m.SendAsciiMessage( "That is not in your house" );//That is not in your house } else if ( checkIsInside && !IsInside( item.GetWorldLocation(), item.ItemData.Height ) ) { m.SendAsciiMessage( "That is not in your house" );//That is not in your house } else if ( IsSecure( rootItem ) ) { m.SendAsciiMessage( "You need not lock down items in a secure container." ); // You need not lock down items in a secure container. } else if ( parentItem != null && !IsLockedDown( parentItem ) ) { m.SendAsciiMessage( "You must lockdown the container first!" ); // You must lockdown the container first! } else if ( !(item is VendorRentalContract) && ( IsAosRules ? (!CheckAosLockdowns( amt ) || !CheckAosStorage( amt )) : (this.LockDownCount + amt) > m_MaxLockDowns ) ) { m.SendAsciiMessage( "That would exceed the maximum lock down limit for this house" );//That would exceed the maximum lock down limit for this house } else { //enable protection if ( this.LockDownCount == 0 && this.SecureCount == 0 ) { PlayerMobile pm = m as PlayerMobile; Guild guild = pm.Guild as Guild; if ( pm.ProtectedHouse != null ) { pm.SendAsciiMessage( "You already have a protected house." ); return false; } pm.SendAsciiMessage( "This house is now under the protection of " + pm.Guild.Name + "." ); pm.ProtectedHouse = this; this.Owner = pm; this.ChangeSignType( guild.GuildHouseSignItemID ); if ( m_Sign != null ) m_Sign.InvalidateProperties(); } SetLockdown( item, true ); return true; } } else if ( m_LockDowns.IndexOf( item ) != -1 ) { m.LocalOverheadMessage( MessageType.Regular, 0x3E9, true, "That is already locked down" ); //That is already locked down return true; } else if ( item is HouseSign || item is Static ) { m.LocalOverheadMessage( MessageType.Regular, 0x3E9, true, "This is already locked down." ); // This is already locked down. } else { m.SendAsciiMessage( "You cannot lock that down" );//You cannot lock that down } return false; }
private Item TryStealItem(Item toSteal, object root, int difficulty, ref bool ok, ref bool caught) { Item stolen = null; if (toSteal is KeyRing) toSteal.Weight = 1; /*if ( !IsEmptyHanded( m_Thief ) ) { m_Thief.SendLocalizedMessage( 1005584 ); // Both hands must be free to steal. } else */ if (root is Mobile && ((Mobile)root).Player && IsInnocentTo(m_Thief, (Mobile)root) && !IsInGuild(m_Thief)) { m_Thief.SendLocalizedMessage(1005596); // You must be in the thieves guild to steal from other players. } else if (root is BaseVendor || root is PlayerVendor) { m_Thief.SendLocalizedMessage(1005598); // You can't steal from shopkeepers. } else if (SuspendOnMurder && root is Mobile && ((Mobile)root).Player && IsInGuild(m_Thief) && m_Thief.Kills > 0) { m_Thief.SendLocalizedMessage(502706); // You are currently suspended from the thieves guild. } else if (!m_Thief.CanSee(toSteal) || (root != null && !m_Thief.CanSee(root))) { m_Thief.SendLocalizedMessage(500237); // Target can not be seen. } else if (!toSteal.Movable || toSteal.LootType == LootType.Newbied || toSteal.CheckBlessed(root)) { m_Thief.SendLocalizedMessage(502710); // You can't steal that! } else if (!m_Thief.InRange(toSteal.GetWorldLocation(), 1)) { m_Thief.SendLocalizedMessage(502703); // You must be standing next to an item to steal it. } else if (toSteal.Parent is Mobile) { m_Thief.SendLocalizedMessage(1005585); // You cannot steal items which are equiped. } else if (root == m_Thief) { m_Thief.SendLocalizedMessage(502704); // You catch yourself red-handed. } else if (root is Mobile && (((Mobile)root).AccessLevel > AccessLevel.Player || !m_Thief.CanBeHarmful((Mobile)root))) { m_Thief.SendLocalizedMessage(502710); // You can't steal that! } else { for (Item p = toSteal.Parent as Item; p != null; p = p.Parent as Item) { if (p is LockableContainer && ((LockableContainer)p).Locked) { m_Thief.SendAsciiMessage("That is not accessable."); return null; } } if (toSteal.Weight + toSteal.TotalWeight > 10) { m_Thief.SendAsciiMessage("That is too heavy to steal from someone's backpack."); } else { ok = true; double w = toSteal.PileWeight + toSteal.TotalWeight; double check; if (w >= 10) { //check = 10 * 3.0 * difficulty + 10.0; check = 10 * 3.0 * (difficulty + 1) + 10.0; caught = CheckDetect((10 * 5.0 * difficulty) / (m_Thief.Skills.Stealing.Value + 100.0), root as Mobile); } else { //check = w * 3.0 * difficulty + 10.0; check = w * 3.0 * (difficulty + 1) + 10.0; if (toSteal is Key || toSteal is Multis.Deeds.HouseDeed || toSteal is KeyRing) w += 5; caught = CheckDetect((w * 5.0 * difficulty) / (m_Thief.Skills.Stealing.Value + 100.0), root as Mobile); } if (m_Thief.CheckSkill(SkillName.Stealing, check - 25, check + 25)) { m_Thief.SendLocalizedMessage(502724); // You succesfully steal the item. if (toSteal.Stackable && toSteal.Amount > 1) { int amount; /*int maxAmount = (int)( (m_Thief.Skills[SkillName.Stealing].Value / 10.0) / toSteal.Weight ); if ( maxAmount < 1 ) maxAmount = 1; else if ( maxAmount > toSteal.Amount ) maxAmount = toSteal.Amount; amount = Utility.Random( maxAmount ) + 1;*/ amount = Utility.Random(10) + 1; if (amount > w) amount = toSteal.Amount; else amount = (toSteal.Amount * amount) / (toSteal.PileWeight + toSteal.TotalWeight); if (amount < 1) amount = 1; if (amount >= toSteal.Amount) stolen = toSteal; else stolen = Mobile.LiftItemDupe(toSteal, toSteal.Amount - amount); } else { stolen = toSteal; } } else { m_Thief.SendLocalizedMessage(502723); // You fail to steal the item. } } } return stolen; }
public virtual bool DropToItem( Mobile from, Item target, Point3D p ) { if ( Deleted || from.Deleted || target.Deleted || from.Map != target.Map || from.Map == null || target.Map == null ) return false; object root = target.RootParent; if ( from.AccessLevel < AccessLevel.GameMaster && !from.InRange( target.GetWorldLocation(), 2 ) ) return false; else if ( !from.CanSee( target ) || !from.InLOS( target ) ) return false; else if ( !target.IsAccessibleTo( from ) ) return false; else if ( root is Mobile && !((Mobile)root).CheckNonlocalDrop( from, this, target ) ) return false; else if ( !from.OnDroppedItemToItem( this, target, p ) ) return false; else if ( target is Container && p.m_X != -1 && p.m_Y != -1 ) return OnDroppedInto( from, (Container)target, p ); else return OnDroppedOnto( from, target ); }
private Item TryStealItem(Item toSteal, ref bool caught) { Item stolen = null; object root = toSteal.RootParent; StealableArtifactsSpawner.StealableInstance si = null; if (toSteal.Parent == null || !toSteal.Movable) si = StealableArtifactsSpawner.GetStealableInstance(toSteal); if (!Stealing.IsEmptyHanded(m_Squire)) { if (m_Squire.m_SquireBeQuiet == false) { SquireDialog.DoSquireDialog(m_From, m_Squire, SquireDialogTree.HandsAreFull, null, null); } } else if (m_Squire.Region.IsPartOf(typeof(Engines.ConPVP.SafeZone))) { if (m_Squire.m_SquireBeQuiet == false) { SquireDialog.DoSquireDialog(m_From, m_Squire, SquireDialogTree.StealingNotAllowedHere, null, null); } } else if (root is Mobile && ((Mobile)root).Player && !Stealing.IsInGuild(m_From)) { if (m_Squire.m_SquireBeQuiet == false) { SquireDialog.DoSquireDialog(m_From, m_Squire, SquireDialogTree.NotAPartOfThievesGuild, null, null); } } else if (Stealing.SuspendOnMurder && root is Mobile && ((Mobile)root).Player && Stealing.IsInGuild(m_From) && m_From.Kills > 0) { if (m_Squire.m_SquireBeQuiet == false) { SquireDialog.DoSquireDialog(m_From, m_Squire, SquireDialogTree.SuspendedFromThievesGuild, null, null); } } else if (root is BaseVendor && ((BaseVendor)root).IsInvulnerable) { if (m_Squire.m_SquireBeQuiet == false) { SquireDialog.DoSquireDialog(m_From, m_Squire, SquireDialogTree.CannotStealFromVendors, null, null); } } else if (root is PlayerVendor) { if (m_Squire.m_SquireBeQuiet == false) { SquireDialog.DoSquireDialog(m_From, m_Squire, SquireDialogTree.CannotStealFromVendors, null, null); } } else if (!m_Squire.CanSee(toSteal)) { if (m_Squire.m_SquireBeQuiet == false) { SquireDialog.DoSquireDialog(m_From, m_Squire, SquireDialogTree.CannotSeeStealingTarget, null, null); } } else if (m_Squire.Backpack == null || !m_Squire.Backpack.CheckHold(m_Squire, toSteal, false, true)) { if (m_Squire.m_SquireBeQuiet == false) { SquireDialog.DoSquireDialog(m_From, m_Squire, SquireDialogTree.FullBackpackStealing, null, null); } } #region Sigils else if (toSteal is Sigil) { PlayerState pl = PlayerState.Find(m_From); Faction faction = (pl == null ? null : pl.Faction); Sigil sig = (Sigil)toSteal; if (!m_Squire.InRange(toSteal.GetWorldLocation(), 1)) { if (m_Squire.m_SquireBeQuiet == false) { SquireDialog.DoSquireDialog(m_From, m_Squire, SquireDialogTree.NeedToBeCloserToSteal, null, null); } } else if (root != null) { if (m_Squire.m_SquireBeQuiet == false) { SquireDialog.DoSquireDialog(m_From, m_Squire, SquireDialogTree.CannotStealThat, null, null); } } else if (faction != null) { if (!m_Squire.CanBeginAction(typeof(IncognitoSpell))) { if (m_Squire.m_SquireBeQuiet == false) { SquireDialog.DoSquireDialog(m_From, m_Squire, SquireDialogTree.CannotStealWhileMorphed, null, null); } } else if (DisguiseTimers.IsDisguised(m_Squire)) { if (m_Squire.m_SquireBeQuiet == false) { SquireDialog.DoSquireDialog(m_From, m_Squire, SquireDialogTree.CannotStealWhileMorphed, null, null); } } else if (!m_Squire.CanBeginAction(typeof(PolymorphSpell))) { if (m_Squire.m_SquireBeQuiet == false) { SquireDialog.DoSquireDialog(m_From, m_Squire, SquireDialogTree.CannotStealWhileMorphed, null, null); } } else if (TransformationSpellHelper.UnderTransformation(m_Squire)) { if (m_Squire.m_SquireBeQuiet == false) { SquireDialog.DoSquireDialog(m_From, m_Squire, SquireDialogTree.CannotStealWhileMorphed, null, null); } } else if (AnimalForm.UnderTransformation(m_Squire)) { if (m_Squire.m_SquireBeQuiet == false) { SquireDialog.DoSquireDialog(m_From, m_Squire, SquireDialogTree.CannotStealWhileMorphed, null, null); } } else if (pl.IsLeaving) { if (m_Squire.m_SquireBeQuiet == false) { SquireDialog.DoSquireDialog(m_From, m_Squire, SquireDialogTree.CannotStealWhileLeavingFaction, null, null); } } else if (sig.IsBeingCorrupted && sig.LastMonolith.Faction == faction) { if (m_Squire.m_SquireBeQuiet == false) { SquireDialog.DoSquireDialog(m_From, m_Squire, SquireDialogTree.CannotStealOwnSigil, null, null); } } else if (sig.IsPurifying) { if (m_Squire.m_SquireBeQuiet == false) { SquireDialog.DoSquireDialog(m_From, m_Squire, SquireDialogTree.CannotStealSigilWhilePurifying, null, null); } } else if (m_Squire.CheckTargetSkill(SkillName.Stealing, toSteal, 80.0, 80.0)) { if (Sigil.ExistsOn(m_Squire)) { if (m_Squire.m_SquireBeQuiet == false) { SquireDialog.DoSquireDialog(m_From, m_Squire, SquireDialogTree.SigilHasReturnedBecauseAlreadyHaveOne, null, null); } } else if (m_Squire.Backpack == null || !m_Squire.Backpack.CheckHold(m_Squire, sig, false, true)) { if (m_Squire.m_SquireBeQuiet == false) { SquireDialog.DoSquireDialog(m_From, m_Squire, SquireDialogTree.SigilHasReturnedBecauseBackpackIsFull, null, null); } } else { if (sig.IsBeingCorrupted) sig.GraceStart = DateTime.UtcNow; // begin grace period if (m_Squire.m_SquireBeQuiet == false) { SquireDialog.DoSquireDialog(m_From, m_Squire, SquireDialogTree.SuccessfulSigilSteal, null, null); } if (sig.LastMonolith != null && sig.LastMonolith.Sigil != null) { sig.LastMonolith.Sigil = null; sig.LastStolen = DateTime.UtcNow; } return sig; } } else { if (m_Squire.m_SquireBeQuiet == false) { SquireDialog.DoSquireDialog(m_From, m_Squire, SquireDialogTree.NotSkilledEnoughToStealSigil, null, null); } } } else { if (m_Squire.m_SquireBeQuiet == false) { SquireDialog.DoSquireDialog(m_From, m_Squire, SquireDialogTree.NotInAFactionSteal, null, null); } } } #endregion else if (si == null && (toSteal.Parent == null || !toSteal.Movable)) { if (m_Squire.m_SquireBeQuiet == false) { SquireDialog.DoSquireDialog(m_From, m_Squire, SquireDialogTree.CannotStealThat, null, null); } } else if (toSteal.LootType == LootType.Newbied || toSteal.CheckBlessed(root)) { if (m_Squire.m_SquireBeQuiet == false) { SquireDialog.DoSquireDialog(m_From, m_Squire, SquireDialogTree.CannotStealThat, null, null); } } else if (Core.AOS && si == null && toSteal is Container) { if (m_Squire.m_SquireBeQuiet == false) { SquireDialog.DoSquireDialog(m_From, m_Squire, SquireDialogTree.CannotStealThat, null, null); } } else if (!m_Squire.InRange(toSteal.GetWorldLocation(), 1)) { if (m_Squire.m_SquireBeQuiet == false) { SquireDialog.DoSquireDialog(m_From, m_Squire, SquireDialogTree.NeedToBeCloserToSteal, null, null); } } else if (si != null && m_Squire.Skills[SkillName.Stealing].Value < 100.0) { if (m_Squire.m_SquireBeQuiet == false) { SquireDialog.DoSquireDialog(m_From, m_Squire, SquireDialogTree.NotSkilledEnoughToStealItem, null, null); } } else if (toSteal.Parent is Mobile) { if (m_Squire.m_SquireBeQuiet == false) { SquireDialog.DoSquireDialog(m_From, m_Squire, SquireDialogTree.CannotStealFromTheirHands, null, null); } } else if (root == m_Squire) { if (m_Squire.m_SquireBeQuiet == false) { SquireDialog.DoSquireDialog(m_From, m_Squire, SquireDialogTree.StealFromSelf, null, null); } } else if (root is Mobile && ((Mobile)root).AccessLevel > AccessLevel.Player) { if (m_Squire.m_SquireBeQuiet == false) { SquireDialog.DoSquireDialog(m_From, m_Squire, SquireDialogTree.CannotStealThat, null, null); } } else if (root is Mobile && !m_Squire.CanBeHarmful((Mobile)root)) { } else if (root is Corpse) { if (m_Squire.m_SquireBeQuiet == false) { SquireDialog.DoSquireDialog(m_From, m_Squire, SquireDialogTree.CannotStealThat, null, null); } } else { double w = toSteal.Weight + toSteal.TotalWeight; if (w > 10) { if (m_Squire.m_SquireBeQuiet == false) { SquireDialog.DoSquireDialog(m_From, m_Squire, SquireDialogTree.TooHeavyToSteal, null, null); } } else { if (toSteal.Stackable && toSteal.Amount > 1) { int maxAmount = (int)((m_Squire.Skills[SkillName.Stealing].Value / 10.0) / toSteal.Weight); if (maxAmount < 1) maxAmount = 1; else if (maxAmount > toSteal.Amount) maxAmount = toSteal.Amount; int amount = Utility.RandomMinMax(1, maxAmount); if (amount >= toSteal.Amount) { int pileWeight = (int)Math.Ceiling(toSteal.Weight * toSteal.Amount); pileWeight *= 10; if (m_Squire.CheckTargetSkill(SkillName.Stealing, toSteal, pileWeight - 22.5, pileWeight + 27.5)) stolen = toSteal; } else { int pileWeight = (int)Math.Ceiling(toSteal.Weight * amount); pileWeight *= 10; if (m_Squire.CheckTargetSkill(SkillName.Stealing, toSteal, pileWeight - 22.5, pileWeight + 27.5)) { stolen = Mobile.LiftItemDupe(toSteal, toSteal.Amount - amount); if (stolen == null) stolen = toSteal; } } } else { int iw = (int)Math.Ceiling(w); iw *= 10; if (m_Squire.CheckTargetSkill(SkillName.Stealing, toSteal, iw - 22.5, iw + 27.5)) stolen = toSteal; } if (stolen != null) { if (m_Squire.m_SquireBeQuiet == false) { SquireDialog.DoSquireDialog(m_From, m_Squire, SquireDialogTree.SuccessfulSteal, null, null); } if (si != null) { toSteal.Movable = true; si.Item = null; } } else { if (m_Squire.m_SquireBeQuiet == false) { SquireDialog.DoSquireDialog(m_From, m_Squire, SquireDialogTree.UnsuccessfulSteal, null, null); } } caught = (m_Squire.Skills[SkillName.Stealing].Value < Utility.Random(150)); } } m_Squire.m_StealingDelay = DateTime.Now + TimeSpan.FromSeconds(10); return stolen; }
public BounceInfo( Item item ) { m_Map = item.Map; m_Location = item.Location; m_WorldLoc = item.GetWorldLocation(); m_Parent = item.Parent; }
private Item TryStealItem(Item toSteal, ref bool caught) { Item stolen = null; object root = toSteal.RootParent; StealableArtifactsSpawner.StealableInstance si = null; if (toSteal.Parent == null || !toSteal.Movable) si = StealableArtifactsSpawner.GetStealableInstance(toSteal); if (!IsEmptyHanded(m_Thief)) { m_Thief.SendLocalizedMessage(1005584); // Both hands must be free to steal. } else if (root is Mobile && ((Mobile)root).Player && IsInnocentTo(m_Thief, (Mobile)root) && !IsInGuild(m_Thief)) { m_Thief.SendLocalizedMessage(1005596); // You must be in the thieves guild to steal from other players. } else if (SuspendOnMurder && root is Mobile && ((Mobile)root).Player && IsInGuild(m_Thief) && m_Thief.Kills > 0) { m_Thief.SendLocalizedMessage(502706); // You are currently suspended from the thieves guild. } else if (root is BaseVendor && ((BaseVendor)root).IsInvulnerable) { m_Thief.SendLocalizedMessage(1005598); // You can't steal from shopkeepers. } else if (root is PlayerVendor) { m_Thief.SendLocalizedMessage(502709); // You can't steal from vendors. } else if (!m_Thief.CanSee(toSteal)) { m_Thief.SendLocalizedMessage(500237); // Target can not be seen. } else if (m_Thief.Backpack == null || !m_Thief.Backpack.CheckHold(m_Thief, toSteal, false, true)) { m_Thief.SendLocalizedMessage(1048147); // Your backpack can't hold anything else. } #region Sigils else if (toSteal is Sigil) { PlayerState pl = PlayerState.Find(m_Thief); Faction faction = (pl == null ? null : pl.Faction); Sigil sig = (Sigil)toSteal; if (!m_Thief.InRange(toSteal.GetWorldLocation(), 1)) { m_Thief.SendLocalizedMessage(502703); // You must be standing next to an item to steal it. } else if (root != null) // not on the ground { m_Thief.SendLocalizedMessage(502710); // You can't steal that! } else if (faction != null) { if (!m_Thief.CanBeginAction(typeof(IncognitoSpell))) { m_Thief.SendLocalizedMessage(1010581); // You cannot steal the sigil when you are incognito } else if (DisguiseGump.IsDisguised(m_Thief)) { m_Thief.SendLocalizedMessage(1010583); // You cannot steal the sigil while disguised } else if (!m_Thief.CanBeginAction(typeof(PolymorphSpell))) { m_Thief.SendLocalizedMessage(1010582); // You cannot steal the sigil while polymorphed } else if (TransformationSpellHelper.UnderTransformation(m_Thief)) { m_Thief.SendLocalizedMessage(1061622); // You cannot steal the sigil while in that form. } else if (AnimalForm.UnderTransformation(m_Thief)) { m_Thief.SendLocalizedMessage(1063222); // You cannot steal the sigil while mimicking an animal. } else if (pl.IsLeaving) { m_Thief.SendLocalizedMessage(1005589); // You are currently quitting a faction and cannot steal the town sigil } else if (sig.IsBeingCorrupted && sig.LastMonolith.Faction == faction) { m_Thief.SendLocalizedMessage(1005590); // You cannot steal your own sigil } else if (sig.IsPurifying) { m_Thief.SendLocalizedMessage(1005592); // You cannot steal this sigil until it has been purified } else if (m_Thief.CheckTargetSkill(SkillName.Stealing, toSteal, 80.0, 80.0)) { if (Sigil.ExistsOn(m_Thief)) { m_Thief.SendLocalizedMessage(1010258); // The sigil has gone back to its home location because you already have a sigil. } else if (m_Thief.Backpack == null || !m_Thief.Backpack.CheckHold(m_Thief, sig, false, true)) { m_Thief.SendLocalizedMessage(1010259); // The sigil has gone home because your backpack is full } else { if (sig.IsBeingCorrupted) sig.GraceStart = DateTime.Now; // begin grace period m_Thief.SendLocalizedMessage(1010586); // YOU STOLE THE SIGIL!!! (woah, calm down now) if (sig.LastMonolith != null) sig.LastMonolith.Sigil = null; sig.LastStolen = DateTime.Now; return sig; } } else { m_Thief.SendLocalizedMessage(1005594); // You do not have enough skill to steal the sigil } } else { m_Thief.SendLocalizedMessage(1005588); // You must join a faction to do that } } #endregion //ARTEGORDONMOD // allow stealing of STEALABLE items on the ground or in containers else if (si == null && (toSteal.Parent == null || !toSteal.Movable) && !ItemFlags.GetStealable(toSteal)) { m_Thief.SendLocalizedMessage(502710); // You can't steal that! } //ARTEGORDONMOD // allow stealing of of STEALABLE newbied/blessed items else if ((toSteal.LootType == LootType.Newbied || toSteal.CheckBlessed(root)) && !ItemFlags.GetStealable(toSteal)) { m_Thief.SendLocalizedMessage(502710); // You can't steal that! } //ARTEGORDONMOD // allow stealing of STEALABLE containers else if (Core.AOS && si == null && toSteal is Container && !ItemFlags.GetStealable(toSteal)) { m_Thief.SendLocalizedMessage(502710); // You can't steal that! } else if (!m_Thief.InRange(toSteal.GetWorldLocation(), 1)) { m_Thief.SendLocalizedMessage(502703); // You must be standing next to an item to steal it. } else if (si != null && m_Thief.Skills[SkillName.Stealing].Value < 100.0) { m_Thief.SendLocalizedMessage(1060025, "", 0x66D); // You're not skilled enough to attempt the theft of this item. } else if (toSteal.Parent is Mobile) { m_Thief.SendLocalizedMessage(1005585); // You cannot steal items which are equiped. } else if (root == m_Thief) { m_Thief.SendLocalizedMessage(502704); // You catch yourself red-handed. } else if (root is Mobile && ((Mobile)root).AccessLevel > AccessLevel.Player) { m_Thief.SendLocalizedMessage(502710); // You can't steal that! } else if (root is Mobile && !m_Thief.CanBeHarmful((Mobile)root)) { } else if (root is Corpse) { m_Thief.SendLocalizedMessage(502710); // You can't steal that! } else { double w = toSteal.Weight + toSteal.TotalWeight; if (w > 10) { m_Thief.SendMessage("That is too heavy to steal."); } else { if (toSteal.Stackable && toSteal.Amount > 1) { //ARTEGORDON // fix for zero-weight stackables int maxAmount = toSteal.Amount; if (toSteal.Weight > 0) maxAmount = (int)((m_Thief.Skills[SkillName.Stealing].Value / 10.0) / toSteal.Weight); if (maxAmount < 1) maxAmount = 1; else if (maxAmount > toSteal.Amount) maxAmount = toSteal.Amount; int amount = Utility.RandomMinMax(1, maxAmount); if (amount >= toSteal.Amount) { int pileWeight = (int)Math.Ceiling(toSteal.Weight * toSteal.Amount); pileWeight *= 10; if (m_Thief.CheckTargetSkill(SkillName.Stealing, toSteal, pileWeight - 22.5, pileWeight + 27.5)) stolen = toSteal; } else { int pileWeight = (int)Math.Ceiling(toSteal.Weight * amount); pileWeight *= 10; if (m_Thief.CheckTargetSkill(SkillName.Stealing, toSteal, pileWeight - 22.5, pileWeight + 27.5)) { stolen = Mobile.LiftItemDupe(toSteal, toSteal.Amount - amount); if (stolen == null) stolen = toSteal; } } } else { int iw = (int)Math.Ceiling(w); iw *= 10; if (m_Thief.CheckTargetSkill(SkillName.Stealing, toSteal, iw - 22.5, iw + 27.5)) stolen = toSteal; } if (stolen != null) { m_Thief.SendLocalizedMessage(502724); // You succesfully steal the item. // ARTEGORDONMOD // set the taken flag to trigger release from any controlling spawner ItemFlags.SetTaken(stolen, true); // clear the stealable flag so that the item can only be stolen once if it is later locked down. ItemFlags.SetStealable(stolen, false); // release it if it was locked down stolen.Movable = true; // End mod for stealable rares and other locked down items if (si != null) { toSteal.Movable = true; si.Item = null; } } else { m_Thief.SendLocalizedMessage(502723); // You fail to steal the item. } caught = (m_Thief.Skills[SkillName.Stealing].Value < Utility.Random(150)); } } return stolen; }
public static BaseHouse FindHouseAt( Item item ) { if ( item == null || item.Deleted ) return null; return FindHouseAt( item.GetWorldLocation(), item.Map, item.ItemData.Height ); }
public virtual bool OnDroppedOnto( Mobile from, Item target ) { if ( IsUnderYourFeet( from, target ) ) { from.SendMessage( "No puedes mover eso, ¡estás pisando la bolsa!" ); return false; } else if ( Deleted || from.Deleted || target.Deleted || from.Map != target.Map || from.Map == null || target.Map == null ) return false; else if ( from.AccessLevel < AccessLevel.GameMaster && !from.InRange( target.GetWorldLocation(), 2 ) ) return false; else if ( !from.CanSee( target ) || !from.InLOS( target ) ) return false; else if ( !target.IsAccessibleTo( from ) ) return false; else if ( !from.OnDroppedItemOnto( this, target ) ) return false; else if ( NonTransferable && from.IsPlayer && from.AccessLevel <= AccessLevel.GameMaster ) { HandleInvalidTransfer( from ); return false; } else return target.OnDragDrop( from, this ); }
private Item TryStealItem( Item toSteal, ref bool caught ) { Item stolen = null; object root = toSteal.RootParent; if ( !IsEmptyHanded( m_Thief ) ) { m_Thief.SendLocalizedMessage( 1005584 ); // Both hands must be free to steal. } else if ( root is BaseVendor && ((BaseVendor)root).IsInvulnerable ) { m_Thief.SendLocalizedMessage( 1005598 ); // You can't steal from shopkeepers. } else if ( root is PlayerVendor ) { m_Thief.SendLocalizedMessage( 502709 ); // You can't steal from vendors. } else if ( !m_Thief.CanSee( toSteal ) ) { m_Thief.SendLocalizedMessage( 500237 ); // Target can not be seen. } else if ( m_Thief.Backpack == null || !m_Thief.Backpack.CheckHold( m_Thief, toSteal, false, true ) ) { m_Thief.SendLocalizedMessage( 1048147 ); // Your backpack can't hold anything else. } #region Sigils else if ( toSteal is Sigil ) { PlayerState pl = PlayerState.Find( m_Thief ); Faction faction = ( pl == null ? null : pl.Faction ); Sigil sig = (Sigil) toSteal; if ( !m_Thief.InRange( toSteal.GetWorldLocation(), 1 ) ) { m_Thief.SendLocalizedMessage( 502703 ); // You must be standing next to an item to steal it. } else if ( root != null ) // not on the ground { m_Thief.SendLocalizedMessage( 502710 ); // You can't steal that! } else if ( faction != null ) { if ( !m_Thief.CanBeginAction( typeof( IncognitoSpell ) ) ) { m_Thief.SendLocalizedMessage( 1010581 ); // You cannot steal the sigil when you are incognito } else if ( DisguiseGump.IsDisguised( m_Thief ) ) { m_Thief.SendLocalizedMessage( 1010583 ); // You cannot steal the sigil while disguised } else if ( !m_Thief.CanBeginAction( typeof( PolymorphSpell ) ) ) { m_Thief.SendLocalizedMessage( 1010582 ); // You cannot steal the sigil while polymorphed } else if ( TransformationSpell.UnderTransformation( m_Thief ) ) { m_Thief.SendLocalizedMessage( 1061622 ); // You cannot steal the sigil while in that form. } else if ( Spells.ExoticWeaponry.AnimalForm.UnderTransformation( m_Thief ) ) { m_Thief.SendLocalizedMessage( 1063222 ); // You cannot steal the sigil while mimicking an animal. } else if ( pl.IsLeaving ) { m_Thief.SendLocalizedMessage( 1005589 ); // You are currently quitting a faction and cannot steal the town sigil } else if ( sig.IsBeingCorrupted && sig.LastMonolith.Faction == faction ) { m_Thief.SendLocalizedMessage( 1005590 ); // You cannot steal your own sigil } else if ( sig.IsPurifying ) { m_Thief.SendLocalizedMessage( 1005592 ); // You cannot steal this sigil until it has been purified } else if ( m_Thief.CheckTargetSkill( SkillName.Stealing, toSteal, 80.0, 80.0 ) ) { if ( Sigil.ExistsOn( m_Thief ) ) { m_Thief.SendLocalizedMessage( 1010258 ); // The sigil has gone back to its home location because you already have a sigil. } else if ( m_Thief.Backpack == null || !m_Thief.Backpack.CheckHold( m_Thief, sig, false, true ) ) { m_Thief.SendLocalizedMessage( 1010259 ); // The sigil has gone home because your backpack is full } else { if ( sig.IsBeingCorrupted ) sig.GraceStart = DateTime.Now; // begin grace period m_Thief.SendLocalizedMessage( 1010586 ); // YOU STOLE THE SIGIL!!! (woah, calm down now) if ( sig.LastMonolith != null ) sig.LastMonolith.Sigil = null; sig.LastStolen = DateTime.Now; return sig; } } else { m_Thief.SendLocalizedMessage( 1005594 ); // You do not have enough skill to steal the sigil } } else { m_Thief.SendLocalizedMessage( 1005588 ); // You must join a faction to do that } } #endregion else if ( ( toSteal.Parent == null || !toSteal.Movable ) ) { m_Thief.SendLocalizedMessage( 502710 ); // You can't steal that! } else if ( toSteal.LootType == LootType.Newbied || toSteal.CheckBlessed( root ) ) { m_Thief.SendLocalizedMessage( 502710 ); // You can't steal that! } else if ( Core.AOS && toSteal is Container ) { m_Thief.SendLocalizedMessage( 502710 ); // You can't steal that! } else if ( !m_Thief.InRange( toSteal.GetWorldLocation(), 1 ) ) { m_Thief.SendLocalizedMessage( 502703 ); // You must be standing next to an item to steal it. } else if ( m_Thief.Skills[SkillName.Stealing].Value < 5.0 ) { m_Thief.SendLocalizedMessage( 1060025, "", 0x66D ); // You're not skilled enough to attempt the theft of this item. } else if ( toSteal.Parent is Mobile ) { m_Thief.SendLocalizedMessage( 1005585 ); // You cannot steal items which are equiped. } else if ( root == m_Thief ) { m_Thief.SendLocalizedMessage( 502704 ); // You catch yourself red-handed. } else if ( root is Mobile && ((Mobile)root).AccessLevel > AccessLevel.Player ) { m_Thief.SendLocalizedMessage( 502710 ); // You can't steal that! } else if ( root is Mobile && !m_Thief.CanBeHarmful( (Mobile)root ) ) { } else if ( root is Corpse ) { m_Thief.SendLocalizedMessage( 502710 ); // You can't steal that! } else { double w = toSteal.Weight + toSteal.TotalWeight; if ( w > 10 ) { m_Thief.SendMessage( "That is too heavy to steal." ); } else { if ( toSteal.Stackable && toSteal.Amount > 1 ) { int maxAmount = (int)((m_Thief.Skills[SkillName.Stealing].Value * 0.1) / toSteal.Weight); if ( maxAmount < 1 ) maxAmount = 1; else if ( maxAmount > toSteal.Amount ) maxAmount = toSteal.Amount; int amount = Utility.RandomMinMax( 1, maxAmount ); if ( amount >= toSteal.Amount ) { int pileWeight = (int)Math.Ceiling( toSteal.Weight * toSteal.Amount ); pileWeight *= 10; if ( m_Thief.CheckTargetSkill( SkillName.Stealing, toSteal, pileWeight - 22.5, pileWeight + 27.5 ) ) stolen = toSteal; } else { int pileWeight = (int)Math.Ceiling( toSteal.Weight * amount ); pileWeight *= 10; if ( m_Thief.CheckTargetSkill( SkillName.Stealing, toSteal, pileWeight - 22.5, pileWeight + 27.5 ) ) { stolen = Mobile.LiftItemDupe( toSteal, toSteal.Amount - amount ); if ( stolen == null ) stolen = toSteal; } } } else { int iw = (int)Math.Ceiling( w ); iw *= 10; if ( m_Thief.CheckTargetSkill( SkillName.Stealing, toSteal, iw - 22.5, iw + 27.5 ) ) stolen = toSteal; } if ( stolen != null ) { m_Thief.SendLocalizedMessage( 502724 ); // You succesfully steal the item. } else { m_Thief.SendLocalizedMessage( 502723 ); // You fail to steal the item. } caught = ( m_Thief.Skills[SkillName.Stealing].Value < Utility.Random( 150 ) ); } } return stolen; }
public static void Resurrect( Mobile m, Item item, bool reds ) { if ( m.Alive ) return; if ( !m.InRange( item.GetWorldLocation(), ResurrectRange ) ) m.SendLocalizedMessage( 500446 ); // That is too far away. else if ( m.Map != null && m.Map.CanFit( m.Location, 16, false, false ) && ( reds || m.Karma > (int)Noto.Dark ) ) m.SendMenu( new ResurrectMenu( m, reds ? ResurrectMessage.ChaosShrine : ResurrectMessage.VirtueShrine ) ); else m.SendLocalizedMessage( 502391 ); // Thou can not be resurrected there! }