示例#1
0
        public static void wr_object_memory()
        {
            wr_u16b(Misc.z_info.k_max);
            for (int k_idx = 0; k_idx < Misc.z_info.k_max; k_idx++)
            {
                byte        tmp8u = 0;
                Object_Kind k_ptr = Misc.k_info[k_idx];
                if (k_ptr == null)
                {
                    k_ptr = new Object_Kind();
                }

                if (k_ptr.aware)
                {
                    tmp8u |= 0x01;
                }
                if (k_ptr.tried)
                {
                    tmp8u |= 0x02;
                }
                if (Squelch.kind_is_squelched_aware(k_ptr))
                {
                    tmp8u |= 0x04;
                }
                if (k_ptr.everseen)
                {
                    tmp8u |= 0x08;
                }
                if (Squelch.kind_is_squelched_unaware(k_ptr))
                {
                    tmp8u |= 0x10;
                }

                wr_byte(tmp8u);
            }
        }
示例#2
0
        /*** Pickup ***/

        /*
         * Pickup all gold at the player's current location.
         */
        static void py_pickup_gold()
        {
            int py = Misc.p_ptr.py;
            int px = Misc.p_ptr.px;

            int total_gold = 0;

            byte[] treasure;

            short this_o_idx = 0;
            short next_o_idx = 0;

            Object.Object o_ptr;

            Message_Type sound_msg;
            bool         verbal = false;

            /* Allocate an array of ordinary gold objects */
            treasure = new byte[(int)Object.SVal.sval_gold.SV_GOLD_MAX];


            /* Pick up all the ordinary gold objects */
            for (this_o_idx = Cave.cave.o_idx[py][px]; this_o_idx != 0; this_o_idx = next_o_idx)
            {
                /* Get the object */
                o_ptr = Object.Object.byid(this_o_idx);
                if (o_ptr == null)
                {
                    break;
                }

                /* Get the next object */
                next_o_idx = o_ptr.next_o_idx;

                /* Ignore if not legal treasure */
                if ((o_ptr.tval != TVal.TV_GOLD) ||
                    (o_ptr.sval >= (int)SVal.sval_gold.SV_GOLD_MAX))
                {
                    continue;
                }

                /* Note that we have this kind of treasure */
                treasure[o_ptr.sval]++;

                /* Remember whether feedback message is in order */
                if (!Squelch.item_ok(o_ptr))
                {
                    verbal = true;
                }

                /* Increment total value */
                total_gold += (int)o_ptr.pval[Misc.DEFAULT_PVAL];

                /* Delete the gold */
                Object.Object.delete_object_idx(this_o_idx);
            }

            /* Pick up the gold, if present */
            if (total_gold != 0)
            {
                //char buf[1024];
                //char tmp[80];
                string      buf;
                string      tmp;
                int         i, count, total;
                Object_Kind kind;

                /* Build a message */
                buf = String.Format("You have found {0} gold pieces worth of ", total_gold);

                /* Count the types of treasure present */
                for (total = 0, i = 0; i < (int)SVal.sval_gold.SV_GOLD_MAX; i++)
                {
                    if (treasure[i] != 0)
                    {
                        total++;
                    }
                }

                /* List the treasure types */
                for (count = 0, i = 0; i < (int)SVal.sval_gold.SV_GOLD_MAX; i++)
                {
                    /* Skip if no treasure of this type */
                    if (treasure[i] == 0)
                    {
                        continue;
                    }

                    /* Get this object index */
                    kind = Object_Kind.lookup_kind(TVal.TV_GOLD, i);
                    if (kind == null)
                    {
                        continue;
                    }

                    /* Get the object name */
                    tmp = Object.Object.object_kind_name(kind, true);

                    /* Build up the pickup string */
                    buf = buf + tmp;

                    /* Added another kind of treasure */
                    count++;

                    /* Add a comma if necessary */
                    if ((total > 2) && (count < total))
                    {
                        buf += ",";
                    }

                    /* Add an "and" if necessary */
                    if ((total >= 2) && (count == total - 1))
                    {
                        buf += " and";
                    }

                    /* Add a space or period if necessary */
                    if (count < total)
                    {
                        buf += " ";
                    }
                    else
                    {
                        buf += ".";
                    }
                }

                /* Determine which sound to play */
                if (total_gold < 200)
                {
                    sound_msg = Message_Type.MSG_MONEY1;
                }
                else if (total_gold < 600)
                {
                    sound_msg = Message_Type.MSG_MONEY2;
                }
                else
                {
                    sound_msg = Message_Type.MSG_MONEY3;
                }

                /* Display the message */
                if (verbal)
                {
                    Utilities.msgt(sound_msg, "{0}", buf);
                }

                /* Add gold to purse */
                Misc.p_ptr.au += total_gold;

                /* Redraw gold */
                Misc.p_ptr.redraw |= (Misc.PR_GOLD);
            }

            /* Free the gold array */
            //FREE(treasure);
        }
示例#3
0
 public static void kind_squelch_when_unaware(Object_Kind k_ptr)
 {
     throw new NotImplementedException();
     //k_ptr.squelch |= SQUELCH_IF_UNAWARE;
     //p_ptr.notice |= PN_SQUELCH;
 }
示例#4
0
 public static bool kind_is_squelched_unaware(Object_Kind k_ptr)
 {
     return((k_ptr.squelch & SQUELCH_IF_UNAWARE) != 0 ? true : false);
 }
示例#5
0
 /*
  * Remove any squelching of a particular flavor
  */
 public static void kind_squelch_clear(Object_Kind k_ptr)
 {
     throw new NotImplementedException();
     //k_ptr.squelch = 0;
     //p_ptr.notice |= PN_SQUELCH;
 }
示例#6
0
        /*** Autoinscription stuff ***/

        public static string get_autoinscription(Object_Kind kind)
        {
            return((kind != null) && (kind.note != null) ? kind.note.ToString() : null);
        }