/* Put the autoinscription on an object */ public static int apply_autoinscription(Object.Object o_ptr) { string o_name = ""; //80 string note = get_autoinscription(o_ptr.kind); /* Don't inscribe unaware objects */ if (note == null || note.Length == 0 || !o_ptr.flavor_is_aware()) { return(0); } /* Don't re-inscribe if it's already inscribed */ if (o_ptr.note != null) { return(0); } /* Get an object description */ o_name = o_ptr.object_desc(Object.Object.Detail.PREFIX | Object.Object.Detail.FULL); if (note == null) { o_ptr.note = Quark.Add(note); } else { o_ptr.note = null; } Utilities.msg("You autoinscribe {0}.", o_name); return(1); }
/* Add "unseen" to the end of unaware items in stores */ static int obj_desc_aware(Object o_ptr, ref string buf, int max, int end) { if (!o_ptr.flavor_is_aware()) { buf += " {unseen}"; } return(end); }
/* * 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); } }
static int obj_desc_charges(Object o_ptr, ref string buf, int max, int end) { bool aware = o_ptr.flavor_is_aware() || ((o_ptr.ident & Object.IDENT_STORE) != 0); /* Wands and Staffs have charges */ if (aware && (o_ptr.tval == TVal.TV_STAFF || o_ptr.tval == TVal.TV_WAND)) { buf = buf + " (" + o_ptr.pval[Misc.DEFAULT_PVAL] + " charge" + (o_ptr.pval[Misc.DEFAULT_PVAL] > 1 ? "s":"") + ")"; } /* Charging things */ else if (o_ptr.timeout > 0) { if (o_ptr.tval == TVal.TV_ROD && o_ptr.number > 1) { int power; int time_base = Random.randcalc(o_ptr.kind.time, 0, aspect.MINIMISE); if (time_base == 0) { time_base = 1; } /* * Find out how many rods are charging, by dividing * current timeout by each rod's maximum timeout. * Ensure that any remainder is rounded up. Display * very discharged stacks as merely fully discharged. */ power = (o_ptr.timeout + (time_base - 1)) / time_base; if (power > o_ptr.number) { power = o_ptr.number; } /* Display prettily */ buf = " (" + power + " charging)"; } /* Artifacts, single rods */ else if (!(o_ptr.tval == TVal.TV_LIGHT && o_ptr.artifact == null)) { buf = buf + " (charging)"; } } return(end); }
/* * Format object o_ptr's name into 'buf'. */ static int obj_desc_name(ref string buf, int max, int end, Object o_ptr, bool prefix, Detail mode, bool spoil) { bool known = o_ptr.is_known() || ((o_ptr.ident & Object.IDENT_STORE) != 0) || spoil; bool aware = o_ptr.flavor_is_aware() || ((o_ptr.ident & Object.IDENT_STORE) != 0) || spoil; string basename = obj_desc_get_basename(o_ptr, aware); string modstr = obj_desc_get_modstr(o_ptr.kind); if (aware && !o_ptr.kind.everseen && !spoil) { o_ptr.kind.everseen = true; } if (prefix) { end = obj_desc_name_prefix(ref buf, max, end, o_ptr, known, basename, modstr); } /* Pluralize if (not forced singular) and * (not a known/visible artifact) and * (not one in stack or forced plural) */ obj_desc_name_format(ref buf, basename, modstr, ((mode & Detail.SINGULAR) == 0) && !(o_ptr.artifact == null && (o_ptr.name_is_visible() || known)) && (o_ptr.number != 1 || ((mode & Detail.PLURAL) != 0))); /** Append extra names of various kinds **/ if ((o_ptr.name_is_visible() || known) && o_ptr.artifact != null) { buf = buf + " " + o_ptr.artifact.Name; } else if ((spoil && o_ptr.ego != null) || o_ptr.ego_is_visible()) { buf = buf + " " + o_ptr.ego.name; } else if (aware && o_ptr.artifact == null && (o_ptr.kind.flavor != null || o_ptr.kind.tval == TVal.TV_SCROLL)) { buf = buf + " of " + o_ptr.kind.Name; } return(end); }
static int obj_desc_inscrip(Object o_ptr, ref string buf, int max, int end) { string[] u = { "", "", "", "" }; int n = 0; Object.obj_pseudo_t feel = o_ptr.pseudo(); Bitflag flags_known = new Bitflag(Object_Flag.SIZE); Bitflag f2 = new Bitflag(Object_Flag.SIZE); o_ptr.object_flags_known(ref flags_known); /* Get inscription */ if (o_ptr.note != null && o_ptr.note.value != null) { u[n++] = o_ptr.note.ToString(); } /* Use special inscription, if any */ if (!o_ptr.is_known() && feel != 0) { /* cannot tell excellent vs strange vs splendid until wield */ if (!o_ptr.was_worn() && o_ptr.ego != null) { u[n++] = "ego"; } else { u[n++] = Misc.inscrip_text[(int)feel]; //I know that feel bro. } } else if (((o_ptr.ident & Object.IDENT_EMPTY) != 0) && !o_ptr.is_known()) { u[n++] = "empty"; } else if (!o_ptr.is_known() && o_ptr.was_worn()) { if (o_ptr.wield_slot() == Misc.INVEN_WIELD || o_ptr.wield_slot() == Misc.INVEN_BOW) { u[n++] = "wielded"; } else { u[n++] = "worn"; } } else if (!o_ptr.is_known() && o_ptr.was_fired()) { u[n++] = "fired"; } else if (!o_ptr.flavor_is_aware() && o_ptr.flavor_was_tried()) { u[n++] = "tried"; } /* Note curses */ Object_Flag.create_mask(f2, false, Object_Flag.object_flag_type.CURSE); if (flags_known.is_inter(f2)) { u[n++] = "cursed"; } /* Note squelch */ if (Squelch.item_ok(o_ptr)) { u[n++] = "squelch"; } if (n != 0) { int i; for (i = 0; i < n; i++) { if (i == 0) { buf = buf + " {"; } buf = buf + u[i]; if (i < n - 1) { buf += ", "; } } buf += "}"; } return(end); }
/* * Format object o_ptr's name into 'buf'. */ static int obj_desc_name(ref string buf, int max, int end, Object o_ptr, bool prefix, Detail mode, bool spoil) { bool known = o_ptr.is_known() || ((o_ptr.ident & Object.IDENT_STORE) != 0) || spoil; bool aware = o_ptr.flavor_is_aware() || ((o_ptr.ident & Object.IDENT_STORE) != 0) || spoil; string basename = obj_desc_get_basename(o_ptr, aware); string modstr = obj_desc_get_modstr(o_ptr.kind); if (aware && !o_ptr.kind.everseen && !spoil) o_ptr.kind.everseen = true; if (prefix) end = obj_desc_name_prefix(ref buf, max, end, o_ptr, known, basename, modstr); /* Pluralize if (not forced singular) and * (not a known/visible artifact) and * (not one in stack or forced plural) */ obj_desc_name_format(ref buf, basename, modstr, ((mode & Detail.SINGULAR) == 0) && !(o_ptr.artifact == null && (o_ptr.name_is_visible() || known)) && (o_ptr.number != 1 || ((mode & Detail.PLURAL) != 0))); /** Append extra names of various kinds **/ if((o_ptr.name_is_visible() || known) && o_ptr.artifact != null) buf = buf + " " + o_ptr.artifact.Name; else if((spoil && o_ptr.ego != null) || o_ptr.ego_is_visible()) buf = buf + " " + o_ptr.ego.name; else if(aware && o_ptr.artifact == null && (o_ptr.kind.flavor != null || o_ptr.kind.tval == TVal.TV_SCROLL)) buf = buf + " of " + o_ptr.kind.Name; return end; }
static int obj_desc_inscrip(Object o_ptr, ref string buf, int max, int end) { string[] u = {"", "", "", ""}; int n = 0; Object.obj_pseudo_t feel = o_ptr.pseudo(); Bitflag flags_known = new Bitflag(Object_Flag.SIZE); Bitflag f2 = new Bitflag(Object_Flag.SIZE); o_ptr.object_flags_known(ref flags_known); /* Get inscription */ if (o_ptr.note != null && o_ptr.note.value != null) u[n++] = o_ptr.note.ToString(); /* Use special inscription, if any */ if (!o_ptr.is_known() && feel != 0) { /* cannot tell excellent vs strange vs splendid until wield */ if (!o_ptr.was_worn() && o_ptr.ego != null) u[n++] = "ego"; else u[n++] = Misc.inscrip_text[(int)feel]; //I know that feel bro. } else if (((o_ptr.ident & Object.IDENT_EMPTY) != 0) && !o_ptr.is_known()) u[n++] = "empty"; else if (!o_ptr.is_known() && o_ptr.was_worn()) { if (o_ptr.wield_slot() == Misc.INVEN_WIELD || o_ptr.wield_slot() == Misc.INVEN_BOW) u[n++] = "wielded"; else u[n++] = "worn"; } else if (!o_ptr.is_known() && o_ptr.was_fired()) u[n++] = "fired"; else if (!o_ptr.flavor_is_aware() && o_ptr.flavor_was_tried()) u[n++] = "tried"; /* Note curses */ Object_Flag.create_mask(f2, false, Object_Flag.object_flag_type.CURSE); if (flags_known.is_inter(f2)) u[n++] = "cursed"; /* Note squelch */ if (Squelch.item_ok(o_ptr)) u[n++] = "squelch"; if (n != 0) { int i; for (i = 0; i < n; i++) { if(i == 0) buf = buf + " {"; buf = buf + u[i]; if (i < n-1) buf += ", "; } buf += "}"; } return end; }
static int obj_desc_charges(Object o_ptr, ref string buf, int max, int end) { bool aware = o_ptr.flavor_is_aware() || ((o_ptr.ident & Object.IDENT_STORE) != 0); /* Wands and Staffs have charges */ if (aware && (o_ptr.tval == TVal.TV_STAFF || o_ptr.tval == TVal.TV_WAND)) buf = buf + " (" + o_ptr.pval[Misc.DEFAULT_PVAL] + " charge" + (o_ptr.pval[Misc.DEFAULT_PVAL] > 1 ? "s":"") + ")"; /* Charging things */ else if (o_ptr.timeout > 0) { if (o_ptr.tval == TVal.TV_ROD && o_ptr.number > 1) { int power; int time_base = Random.randcalc(o_ptr.kind.time, 0, aspect.MINIMISE); if (time_base == 0) time_base = 1; /* * Find out how many rods are charging, by dividing * current timeout by each rod's maximum timeout. * Ensure that any remainder is rounded up. Display * very discharged stacks as merely fully discharged. */ power = (o_ptr.timeout + (time_base - 1)) / time_base; if (power > o_ptr.number) power = o_ptr.number; /* Display prettily */ buf = " (" + power + " charging)"; } /* Artifacts, single rods */ else if (!(o_ptr.tval == TVal.TV_LIGHT && o_ptr.artifact == null)) { buf = buf + " (charging)"; } } return end; }
/* Add "unseen" to the end of unaware items in stores */ static int obj_desc_aware(Object o_ptr, ref string buf, int max, int end) { if(!o_ptr.flavor_is_aware()) buf += " {unseen}"; return end; }
/* * 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; }
/* Put the autoinscription on an object */ public static int apply_autoinscription(Object.Object o_ptr) { string o_name = ""; //80 string note = get_autoinscription(o_ptr.kind); /* Don't inscribe unaware objects */ if (note == null || note.Length == 0 || !o_ptr.flavor_is_aware()) return 0; /* Don't re-inscribe if it's already inscribed */ if (o_ptr.note != null) return 0; /* Get an object description */ o_name = o_ptr.object_desc(Object.Object.Detail.PREFIX | Object.Object.Detail.FULL); if(note == null) o_ptr.note = Quark.Add(note); else o_ptr.note = null; Utilities.msg("You autoinscribe {0}.", o_name); return 1; }