public void Target( Container item ) { if ( CheckSequence() ) { SpellHelper.Turn( Caster, item ); object root = item.RootParent; if ( !item.IsAccessibleTo( Caster ) ) { item.OnDoubleClickNotAccessible( Caster ); } else if ( !item.CheckItemUse( Caster, item ) ) { } else if ( root != null && root is Mobile && root != Caster ) { item.OnSnoop( Caster ); } else if ( item is Corpse && !((Corpse)item).CheckLoot( Caster, null ) ) { } else if ( Caster.Region.OnDoubleClick( Caster, item ) ) { Effects.SendLocationParticles( EffectItem.Create( item.Location, item.Map, EffectItem.DefaultDuration ), 0x376A, 9, 32, 5022 ); Effects.PlaySound( item.Location, item.Map, 0x1F5 ); item.DisplayTo( Caster ); item.OnItemUsed( Caster, item ); } } FinishSequence(); }
private bool IsAccessible() { if (!m_Container.IsAccessibleTo(m_Mobile)) { return(false); } if (!m_Mobile.InRange(m_Container.GetWorldLocation(), 18)) { return(false); } return(true); }
public override void OnClick() { if ((m_quiver == null) || m_quiver.Deleted || (m_quiver.Ammo != null && m_quiver.Ammo.Amount >= m_quiver.Capacity)) { return; } object owner = m_quiver.Parent; while (owner != null) { if (owner is Mobile) { break; } if (owner is Item) { owner = ((Item)owner).Parent; continue; } owner = null; } if (owner == null) { return; } if (!(owner is Mobile)) { return; } Mobile m = (Mobile)owner; if (m.Backpack == null) { return; } if (!(m.Items.Contains(m_quiver) || m_quiver.IsChildOf(m.Backpack))) { return; } // Try to fill from the bank box if ((m.BankBox != null) && (m.BankBox.Opened)) { if (m_quiver.IsArrowAmmo ? Refill <Arrow>(m, m.BankBox) : Refill <Bolt>(m, m.BankBox)) { return; } } // Otherwise look for secure containers within two tiles IPooledEnumerable <Item> items = m.Map.GetItemsInRange(m.Location, 1); foreach (Item i in items) { if (!(i is Container)) { continue; } Container c = (Container)i; if (!c.IsSecure || !c.IsAccessibleTo(m)) { continue; } if (m_quiver.IsArrowAmmo ? Refill <Arrow>(m, c) : Refill <Bolt>(m, c)) { return; } } m.SendLocalizedMessage(1072673); //There are no source containers nearby. }
private bool isContainerLootable(PlayerMobile player, Container container) { if (container.Movable || container.Deleted || container.IsAccessibleTo(player) ) return false; if (container is Corpse) return isCorpseLootable(player, (Corpse)container); return true; }