/** * Check no currently worn items are stopping the action 'c' */ public static bool key_confirm_command(char c) { int i; /* Hack -- Scan equipment */ for (i = Misc.INVEN_WIELD; i < Misc.INVEN_TOTAL; i++) { string verify_inscrip = "^" + c; int n; Object.Object o_ptr = Misc.p_ptr.inventory[i]; if (o_ptr.kind == null) { continue; } /* Set up string to look for, e.g. "^d" */ //verify_inscrip[1] = c; /* Verify command */ n = (o_ptr.check_for_inscrip("^*")?1:0) + (o_ptr.check_for_inscrip(verify_inscrip)?1:0); while (n-- != 0) { if (!Utilities.get_check("Are you sure? ")) { return(false); } } } return(true); }
/* * Drop all {squelch}able items. */ public static void drop() { int n; /* Scan through the slots backwards */ for (n = Misc.INVEN_PACK - 1; n >= 0; n--) { Object.Object o_ptr = Misc.p_ptr.inventory[n]; /* Skip non-objects and unsquelchable objects */ if (o_ptr.kind == null) { continue; } if (!item_ok(o_ptr)) { continue; } /* Check for !d (no drop) inscription */ if (!o_ptr.check_for_inscrip("!d") && !o_ptr.check_for_inscrip("!*")) { /* We're allowed to drop it. */ Object.Object.inven_drop(n, o_ptr.number); } } /* Combine/reorder the pack */ Misc.p_ptr.notice |= (Misc.PN_COMBINE | Misc.PN_REORDER); }
/* * Determines if an object is eligible for squelching. */ public static bool item_ok(Object.Object o_ptr) { byte type; if (Misc.p_ptr.unignoring != 0) { return(false); } /* Don't squelch artifacts unless marked to be squelched */ if (o_ptr.artifact != null || o_ptr.check_for_inscrip("!k") || o_ptr.check_for_inscrip("!*")) { return(false); } /* Do squelch individual objects that marked ignore */ if (o_ptr.ignore) { return(true); } /* Auto-squelch dead chests */ if (o_ptr.tval == TVal.TV_CHEST && o_ptr.pval[Misc.DEFAULT_PVAL] == 0) { return(true); } /* Do squelching by kind */ if (o_ptr.flavor_is_aware() ? kind_is_squelched_aware(o_ptr.kind) : kind_is_squelched_unaware(o_ptr.kind)) { return(true); } type = (byte)type_of(o_ptr); if (type == (int)squelch_type_t.TYPE_MAX) { return(false); } /* Squelch items known not to be special */ if (o_ptr.is_known_not_artifact() && squelch_level[type] == (byte)quality_squelch.SQUELCH_ALL) { return(true); } /* Get result based on the feeling and the squelch_level */ if ((byte)squelch_level_of(o_ptr) <= squelch_level[type]) { return(true); } else { return(false); } }
/* * Determines if an object is eligible for squelching. */ public static bool item_ok(Object.Object o_ptr) { byte type; if (Misc.p_ptr.unignoring != 0) return false; /* Don't squelch artifacts unless marked to be squelched */ if (o_ptr.artifact != null || o_ptr.check_for_inscrip("!k") || o_ptr.check_for_inscrip("!*")) return false; /* Do squelch individual objects that marked ignore */ if (o_ptr.ignore) return true; /* Auto-squelch dead chests */ if (o_ptr.tval == TVal.TV_CHEST && o_ptr.pval[Misc.DEFAULT_PVAL] == 0) return true; /* Do squelching by kind */ if (o_ptr.flavor_is_aware() ? kind_is_squelched_aware(o_ptr.kind) : kind_is_squelched_unaware(o_ptr.kind)) return true; type = (byte)type_of(o_ptr); if (type == (int)squelch_type_t.TYPE_MAX) return false; /* Squelch items known not to be special */ if (o_ptr.is_known_not_artifact() && squelch_level[type] == (byte)quality_squelch.SQUELCH_ALL) return true; /* Get result based on the feeling and the squelch_level */ if ((byte)squelch_level_of(o_ptr) <= squelch_level[type]) return true; else return false; }