Beispiel #1
0
        /*
         * Identify an item.
         *
         * `item` is used to print the slot occupied by an object in equip/inven.
         * Any negative value assigned to "item" can be used for specifying an object
         * on the floor.
         */
        public static void do_ident_item(int item, Object.Object o_ptr)
        {
            string o_name = "";//80

            Message_Type msg_type = (Message_Type)0;
            int i;
            bool bad = true;

            /* Identify it */
            o_ptr.flavor_aware();
            o_ptr.notice_everything();

            /* Apply an autoinscription, if necessary */
            Squelch.apply_autoinscription(o_ptr);

            /* Set squelch flag */
            Misc.p_ptr.notice |= (int)Misc.PN_SQUELCH;

            /* Recalculate bonuses */
            Misc.p_ptr.update |= (Misc.PU_BONUS);

            /* Combine / Reorder the pack (later) */
            Misc.p_ptr.notice |= (int)(Misc.PN_COMBINE | Misc.PN_REORDER | Misc.PN_SORT_QUIVER);

            /* Window stuff */
            Misc.p_ptr.redraw |= (Misc.PR_INVEN | Misc.PR_EQUIP);

            /* Description */
            o_name = o_ptr.object_desc(Object.Object.Detail.PREFIX | Object.Object.Detail.FULL);

            /* Determine the message type. */
            /* CC: we need to think more carefully about how we define "bad" with
             * multiple pvals - currently using "all nonzero pvals < 0" */
            for (i = 0; i < o_ptr.num_pvals; i++)
                if (o_ptr.pval[i] > 0)
                    bad = false;

            if (bad)
                msg_type = Message_Type.MSG_IDENT_BAD;
            else if (o_ptr.artifact != null)
                msg_type = Message_Type.MSG_IDENT_ART;
            else if (o_ptr.ego != null)
                msg_type = Message_Type.MSG_IDENT_EGO;
            else
                msg_type = Message_Type.MSG_GENERIC;

            /* Log artifacts to the history list. */
            if (o_ptr.artifact != null)
                History.add_artifact(o_ptr.artifact, true, true);

            /* Describe */
            if (item >= Misc.INVEN_WIELD)
            {
                Utilities.msgt(msg_type, "{0}: {1} ({2}).", Object.Object.describe_use(item), o_name, Object.Object.index_to_label(item));
                //Utilities.msgt(msg_type, "%^s: %s (%c).", describe_use(item), o_name, index_to_label(item));
            }
            else if (item >= 0)
            {
                Utilities.msgt(msg_type, "In your pack: {0} ({1}).", o_name, Object.Object.index_to_label(item));
                //Utilities.msgt(msg_type, "In your pack: %s (%c).", o_name, index_to_label(item));
            }
            else
            {
                Utilities.msgt(msg_type, "On the ground: {0}.", o_name);
            }
        }