public boolean dbMerge(MOB mob, String name, Modifiable dbM, Modifiable M, Set<String> ignores) throws java.io.IOException, CMException { if ((M instanceof Physical) && (dbM instanceof Physical)) { final Physical PM = (Physical) M; final Physical dbPM = (Physical) dbM; if (CMLib.flags().isCataloged(PM)) { mob.tell(L("^H**Warning: Changes will remove this object from the catalog.")); PM.basePhyStats() .setDisposition(CMath.unsetb(PM.basePhyStats().disposition(), PhyStats.IS_CATALOGED)); } if (CMLib.flags().isCataloged(dbPM)) dbPM.basePhyStats() .setDisposition(CMath.unsetb(dbPM.basePhyStats().disposition(), PhyStats.IS_CATALOGED)); PM.image(); dbPM.image(); } final String[] statCodes = dbM.getStatCodes(); int showFlag = -1; if (CMProps.getIntVar(CMProps.Int.EDITORTYPE) > 0) showFlag = -999; boolean ok = false; boolean didSomething = false; while (!ok) { int showNumber = 0; mob.tell(name); for (int i = 0; i < statCodes.length; i++) { final String statCode = M.getStatCodes()[i]; if (ignores.contains(statCode) || ((M instanceof MOB) && statCode.equalsIgnoreCase("INVENTORY"))) continue; final String promptStr = CMStrings.capitalizeAndLower(M.getStatCodes()[i]); final String dbVal = dbM.getStat(statCode); final String loVal = M.getStat(statCode); if (dbVal.equals(loVal)) continue; ++showNumber; if ((showFlag > 0) && (showFlag != showNumber)) continue; mob.tell( L( "^H@x1. @x2\n\rValue: ^W'@x3'\n\r^HDBVal: ^N'@x4'", "" + showNumber, promptStr, loVal, dbVal)); if ((showFlag != showNumber) && (showFlag > -999)) continue; final String res = mob.session() .choose( L("D)atabase Value, E)dit Value, or N)o Change, or Q)uit All: "), L("DENQ"), L("N")); if (res.trim().equalsIgnoreCase("N")) continue; if (res.trim().equalsIgnoreCase("Q")) throw new CMException("Cancelled by user."); didSomething = true; if (res.trim().equalsIgnoreCase("D")) { M.setStat(statCode, dbVal); continue; } M.setStat( statCode, CMLib.genEd().prompt(mob, M.getStat(statCode), ++showNumber, showFlag, promptStr)); } if (showNumber == 0) return didSomething; if (showFlag < -900) { ok = true; break; } if (showFlag > 0) { showFlag = -1; continue; } showFlag = CMath.s_int(mob.session().prompt(L("Edit which? "), "")); if (showFlag <= 0) { showFlag = -1; ok = true; } } return didSomething; }