Ejemplo n.º 1
0
            protected override void OnTarget(Mobile from, object o)
            {
                IEntity entity = o as IEntity; if (XmlScript.HasTrigger(entity, TriggerName.onTargeted) && UberScriptTriggers.Trigger(entity, from, TriggerName.onTargeted, null, null, null, 0, null, SkillName.ItemID, from.Skills[SkillName.ItemID].Value))

                {
                    return;
                }

                if (o is Item && !(o is HouseSign))
                {
                    Item item = o as Item;

                    if (from.CheckTargetSkill(SkillName.ItemID, o, 0, 100))
                    {
                        if (o is BaseWeapon)
                        {
                            ((BaseWeapon)o).Identified = true;
                        }
                        else if (o is BaseArmor)
                        {
                            ((BaseArmor)o).Identified = true;
                        }
                        else if (o is BaseClothing)
                        {
                            ((BaseClothing)o).Identified = true;
                        }
                        else if (o is BaseTreasureChest)
                        {
                            BaseTreasureChest tchest = (BaseTreasureChest)o;
                            from.SendMessage("{0} container with {1} treasure.", tchest.Locked ? "a locked" : "an unlocked", m_TreasureValue[(int)tchest.Level]);
                        }

                        //if ( !Core.AOS )
                        item.OnSingleClick(from);
                    }
                    else
                    {
                        from.SendLocalizedMessage(500353);                           // You are not certain...
                    }
                }
                else if (o is Mobile)
                {
                    ((Mobile)o).OnSingleClick(from);
                }
                else
                {
                    from.SendLocalizedMessage(500353);                       // You are not certain...
                }
                //allows the identify skill to reveal attachments
                //Server.Engines.XmlSpawner2.XmlAttach.RevealAttachments(from, o); // we don't care about this -Alan
            }
Ejemplo n.º 2
0
        // wea: 14/Mar/2007 Added rarity check
        public static bool IdentifyItem(Mobile from, object o)
        {
            if (!(o is Item))
            {
                return(false);
            }

            Item itm = (Item)o;

            if (o is BaseWeapon)
            {
                ((BaseWeapon)o).Identified = true;
            }
            else if (o is BaseArmor)
            {
                ((BaseArmor)o).Identified = true;
            }
            else if (o is BaseJewel)
            {
                ((BaseJewel)o).Identified = true;
            }
            else if (o is BaseClothing)
            {
                ((BaseClothing)o).Identified = true;
            }
            else if (o is EnchantedScroll)
            {
                ((EnchantedScroll)o).Identified = true;
            }


            string idstr = "You determine that : ";

            if (itm.PlayerCrafted)
            {
                idstr += "the item was crafted";
            }
            else
            {
                idstr += "the item is of an unknown origin";
            }

            if (!Core.AOS)
            {
                itm.OnSingleClick(from);
            }

            if (itm.RareData > 0)
            {
                idstr += string.Format(" and is number {0} of a collection of {1}",
                                       itm.RareCurIndex,
                                       (itm.RareLastIndex - itm.RareStartIndex) + 1);
            }

            if (idstr != "")
            {
                from.SendMessage(idstr + ".");
            }

            return(true);
        }
        public ItemIdGump(PlayerMobile player, Item item, bool success, bool overrideShowRarity, bool overrideShowWorldItemCount): base(200, 25)
        {
            if (player == null || item == null) return;
            if (item.Deleted) return;

            m_Player = player;
            m_Item = item;

            m_Success = success;

            m_ShowRarity = overrideShowRarity;
            m_ShowWorldItemCount = overrideShowWorldItemCount;
            
            Closable = true;
            Disposable = true;
            Dragable = true;
            Resizable = false;

            int worldItemCount = 0;

            bool showRarity = false;
            bool showWorldItemCount = false;

            bool conductWorldItemQuery = true;

            double itemIDSkill = m_Player.Skills[SkillName.ItemID].Value;

            Type itemType = m_Item.GetType();

            if ((success && itemIDSkill >= 110) || m_ShowRarity || m_Player.AccessLevel > AccessLevel.Player)
                showRarity = true;

            if ((success && itemIDSkill >= 120) || m_ShowWorldItemCount || m_Player.AccessLevel > AccessLevel.Player)
            {
                showWorldItemCount = true;

                if (m_Player.AccessLevel == AccessLevel.Player && itemType == m_Player.m_LastItemIdWorldItemCountSearchType && itemType != null)                
                {
                    if (DateTime.UtcNow < m_Player.m_LastItemIdWorldItemCountSearch + TimeSpan.FromSeconds(10))
                        conductWorldItemQuery = false;
                }               

                if (conductWorldItemQuery)
                {
                    foreach (Item worldItem in World.Items.Values)
                    {
                        if (worldItem.GetType() == itemType)
                            worldItemCount++;
                    }

                    m_Player.m_LastItemIdWorldItemCountSearchCount = worldItemCount;
                    m_Player.m_LastItemIdWorldItemCountSearchType = itemType;
                    m_Player.m_LastItemIdWorldItemCountSearch = DateTime.UtcNow;
                }

                else
                    worldItemCount = m_Player.m_LastItemIdWorldItemCountSearchCount;
            }

            string itemName = m_Item.Name;

            if (itemName == null || itemName == "")
            {
                itemName = "Item Details";

                m_Item.OnSingleClick(m_Player);
            }

            if (itemName != "")
                itemName = Utility.Capitalize(itemName);

            string typeText = Item.GetItemGroupTypeName(m_Item.ItemGroup);
            string rarityText = Item.GetItemRarityName(m_Item.ItemRarity);
            int rarityHue = Item.GetItemRarityTextHue(m_Item.ItemRarity);

            string totalCountText = Utility.CreateCurrencyString(worldItemCount);

            if (!showRarity)
                rarityText = "?";
     
            if (!showWorldItemCount)
                totalCountText = "?";

            m_ShowRarity = showRarity;
            m_ShowWorldItemCount = showWorldItemCount;

            int WhiteTextHue = 2655;

            AddPage(0);

            AddImage(135, 12, 103, 2401);
            AddImage(7, 12, 103, 2401);
            AddBackground(19, 21, 246, 78, 9270);

            AddButton(6, 98, 2094, 2095, 1, GumpButtonType.Reply, 0);
            AddLabel(2, 86, 149, "Guide");

            AddLabel(Utility.CenteredTextOffset(145, itemName), 4, 149, itemName);

            AddLabel(56, 39, WhiteTextHue, "Item Type");
            AddLabel(Utility.CenteredTextOffset(90, typeText), 59, 2599, typeText);

            AddLabel(160, 39, WhiteTextHue, "Item Rarity");
            AddLabel(Utility.CenteredTextOffset(197, rarityText), 59, rarityHue, rarityText);
           
            AddLabel(71, 92, WhiteTextHue, "Total in World:");
            AddLabel(171, 92, 149, totalCountText);            
        }