/* * Init players with some belongings * * Having an item identifies it and makes the player "aware" of its purpose. */ static void player_outfit(Player.Player p) { //Object.Object object_type_body = new Object.Object(); /* Give the player starting equipment */ for (Start_Item si = Player.Player.instance.Class.start_items; si != null; si = si.next) { /* Get local object */ Object.Object i_ptr = new Object.Object(); /* Prepare the item */ i_ptr.prep(si.kind, 0, aspect.MINIMISE); i_ptr.number = (byte)Random.rand_range(si.min, si.max); i_ptr.origin = Origin.BIRTH; i_ptr.flavor_aware(); i_ptr.notice_everything(); i_ptr.inven_carry(p); si.kind.everseen = true; /* Deduct the cost of the item from starting cash */ p.au -= i_ptr.value(i_ptr.number, false); } /* Sanity check */ if (p.au < 0) { p.au = 0; } /* Now try wielding everything */ wield_all(p); }
/** * Notice a given special flag on wielded items. * * \param flag is the flag to notice */ public static void wieldeds_notice_flag(Player.Player p, int flag) { int i; /* Sanity check */ if (flag == 0) { return; } /* XXX Eddie need different naming conventions for starting wieldeds at INVEN_WIELD vs INVEN_WIELD+2 */ for (i = Misc.INVEN_WIELD; i < Misc.ALL_INVEN_TOTAL; i++) { Object o_ptr = p.inventory[i]; Bitflag f = new Bitflag(Object_Flag.SIZE); if (o_ptr.kind == null) { continue; } o_ptr.object_flags(ref f); if (f.has(flag) && !o_ptr.known_flags.has(flag)) { //char o_name[80]; string o_name = o_ptr.object_desc(Detail.BASE); /* Notice the flag */ o_ptr.notice_flag(flag); /* XXX Eddie should this go before noticing the flag to avoid learning twice? */ if (EASY_LEARN && o_ptr.is_jewelry()) { /* XXX Eddie EASY_LEARN Possible concern: gets =teleportation just from +2 speed */ o_ptr.flavor_aware(); o_ptr.check_for_ident(); } /* Message */ Object_Flag.flag_message(flag, o_name); } else { /* Notice that flag is absent */ o_ptr.notice_flag(flag); } /* XXX Eddie should not need this, should be done in noticing, but will remove later */ o_ptr.check_for_ident(); } return; }
/* * Init players with some belongings * * Having an item identifies it and makes the player "aware" of its purpose. */ static void player_outfit(Player.Player p) { //Object.Object object_type_body = new Object.Object(); /* Give the player starting equipment */ for (Start_Item si = Player.Player.instance.Class.start_items; si != null; si = si.next) { /* Get local object */ Object.Object i_ptr = new Object.Object(); /* Prepare the item */ i_ptr.prep(si.kind, 0, aspect.MINIMISE); i_ptr.number = (byte)Random.rand_range(si.min, si.max); i_ptr.origin = Origin.BIRTH; i_ptr.flavor_aware(); i_ptr.notice_everything(); i_ptr.inven_carry(p); si.kind.everseen = true; /* Deduct the cost of the item from starting cash */ p.au -= i_ptr.value(i_ptr.number, false); } /* Sanity check */ if (p.au < 0) p.au = 0; /* Now try wielding everything */ wield_all(p); }
/* * 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); } }