Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save theresajayne/9c92e0c8db3a3a4ffd809b2724349246 to your computer and use it in GitHub Desktop.
Save theresajayne/9c92e0c8db3a3a4ffd809b2724349246 to your computer and use it in GitHub Desktop.
how not to do configuration files
DEFAULT_DUNGEON = tempLine.substring(15);
} else if(tempLine.startsWith("enablesavedgame")) {
ENABLE_SAVED_DUNGEON = Integer.parseInt(tempLine.substring(16)) != 0;
} else if(tempLine.startsWith("savedgame")) {
SAVED_DUNGEON = tempLine.substring(10);
} else if(tempLine.startsWith("showspell")) {
SHOWSPELL = Integer.parseInt(tempLine.substring(10)) != 0;
SHOWSPELL_BAK = SHOWSPELL;
} else if(tempLine.startsWith("showitemstat")) {
SHOWITEMSTAT = Integer.parseInt(tempLine.substring(13)) != 0;
} else if(tempLine.startsWith("showitemset")) {
SHOWITEMSET = Integer.parseInt(tempLine.substring(12)) != 0;
} else if(tempLine.startsWith("showdamage")) {
SHOWDAMAGE = Integer.parseInt(tempLine.substring(11)) != 0;
} else if(tempLine.startsWith("showfontshadow")) {
DRAW_SHADOW = Integer.parseInt(tempLine.substring(15)) != 0;
} else if(tempLine.startsWith("showmonsters_fakewall")) {
SHOWMONSTER_INFAKEFALL = Integer.parseInt(tempLine.substring(22)) != 0;
} else if(tempLine.startsWith("showmonsters_stat")) {
SHOWMONSTER_STAT = Integer.parseInt(tempLine.substring(18)) != 0;
} else if(tempLine.startsWith("usemousezone")) {
USEZONE_MOUSE = Integer.parseInt(tempLine.substring(13)) != 0;
} else if(tempLine.startsWith("drawmousezone")) {
DRAWZONE_MOUSE = Integer.parseInt(tempLine.substring(14)) != 0;
} else if(tempLine.startsWith("drawmouseguide")) {
LINEZONE_MOUSE = Integer.parseInt(tempLine.substring(15)) != 0;
} else if(tempLine.startsWith("mousezonecolor")) {
try {
tempLine = tempLine.substring(15);
var11 = tempLine.split(",");
ZONE_MOUSE_RED = Integer.parseInt(var11[0]);
ZONE_MOUSE_GREEN = Integer.parseInt(var11[1]);
ZONE_MOUSE_BLUE = Integer.parseInt(var11[2]);
} catch (Exception var5) {
;
}
} else if(tempLine.startsWith("trace")) {
TRACE = Integer.parseInt(tempLine.substring(6)) != 0;
} else if(tempLine.startsWith("monsters_directory")) {
DEFAULT_MONSTERS = tempLine.substring(19).trim();
MONSTERS_DIRECTORY = DEFAULT_MONSTERS;
if(!MONSTERS_DIRECTORY.equals("")) {
MONSTERS_DIRECTORY = MONSTERS_DIRECTORY.replace("\\", File.separator);
MONSTERS_DIRECTORY = MONSTERS_DIRECTORY.replace("/", File.separator);
MONSTERS_DIRECTORY = MONSTERS_DIRECTORY + File.separator;
}
} else if(tempLine.startsWith("spells_directory")) {
DEFAULT_SPELLS = tempLine.substring(17).trim();
SPELLS_DIRECTORY = DEFAULT_SPELLS;
if(!SPELLS_DIRECTORY.equals("")) {
SPELLS_DIRECTORY = SPELLS_DIRECTORY.replace("\\", File.separator);
SPELLS_DIRECTORY = SPELLS_DIRECTORY.replace("/", File.separator);
SPELLS_DIRECTORY = SPELLS_DIRECTORY + File.separator;
}
} else if(tempLine.startsWith("showexperience")) {
SHOWEXPERIENCE = Integer.parseInt(tempLine.substring(15)) != 0;
} else if(tempLine.startsWith("experience_factor")) {
soundAdjust = Double.parseDouble(tempLine.substring(18));
if(soundAdjust < 0.0D) {
soundAdjust = 0.0D;
} else if(soundAdjust > 9999999.0D) {
soundAdjust = 9999999.0D;
}
EXPERIENCERANGE = soundAdjust;
} else if(tempLine.startsWith("animatepotions")) {
ANIMATE_POTION = Integer.parseInt(tempLine.substring(15)) != 0;
} else if(tempLine.startsWith("animateglassdoor")) {
ANIMATE_GLASSDOOR = Integer.parseInt(tempLine.substring(17)) != 0;
} else if(tempLine.startsWith("animatebrokenglassdoor")) {
ANIMATE_BROKEN_GLASSDOOR = Integer.parseInt(tempLine.substring(23)) != 0;
} else if(tempLine.startsWith("brokendoormask")) {
GENERIC_BROKENDOORS = Integer.parseInt(tempLine.substring(15)) != 0;
} else if(tempLine.startsWith("fluxcage_opacity")) {
messageOpacity = Float.parseFloat(tempLine.substring(17));
if(messageOpacity < 0.0F) {
messageOpacity = 0.0F;
} else if(messageOpacity > 1.0F) {
messageOpacity = 1.0F;
}
FLUX_ALPHA = messageOpacity;
} else if(tempLine.startsWith("puddle_opacity")) {
messageOpacity = Float.parseFloat(tempLine.substring(15));
if(messageOpacity < 0.0F) {
messageOpacity = 0.0F;
} else if(messageOpacity > 1.0F) {
messageOpacity = 1.0F;
}
PUDDLE_ALPHA = messageOpacity;
} else if(tempLine.startsWith("seal_opacity")) {
messageOpacity = Float.parseFloat(tempLine.substring(13));
if(messageOpacity < 0.0F) {
messageOpacity = 0.0F;
} else if(messageOpacity > 1.0F) {
messageOpacity = 1.0F;
}
SEAL_ALPHA = messageOpacity;
} else if(tempLine.startsWith("immaterialbeings_opacity")) {
messageOpacity = Float.parseFloat(tempLine.substring(25));
if(messageOpacity < 0.0F) {
messageOpacity = 0.0F;
} else if(messageOpacity > 1.0F) {
messageOpacity = 1.0F;
}
IMBEINGS_ALPHA = messageOpacity;
} else if(tempLine.startsWith("spellcloud")) {
SPELL_CLOUD = Integer.parseInt(tempLine.substring(11)) != 0;
} else if(tempLine.startsWith("dmjava_rules")) {
DMJAVARULES = Integer.parseInt(tempLine.substring(13)) != 0;
} else if(tempLine.startsWith("load_ammo_from_pack")) {
AMMO_FROM_PACK = Integer.parseInt(tempLine.substring(20)) != 0;
} else if(tempLine.startsWith("auto_ammo")) {
AUTO_AMMO = Integer.parseInt(tempLine.substring(10)) != 0;
} else if(tempLine.startsWith("reincarnateattributepenalty")) {
REINCARNATEATTRIBUTEPENALTY = Integer.parseInt(tempLine.substring(28));
REINCARNATEATTRIBUTEPENALTY = Formulas.ApplyLimits(0, REINCARNATEATTRIBUTEPENALTY, 16);
} else if(tempLine.startsWith("reincarnatestatpenalty")) {
REINCARNATESTATPENALTY = Integer.parseInt(tempLine.substring(23));
REINCARNATESTATPENALTY = Formulas.ApplyLimits(0, REINCARNATESTATPENALTY, 16);
} else {
char[] var12;
if(tempLine.startsWith("key_display_spells")) {
var12 = tempLine.substring(19).trim().toCharArray();
key_display_spells = Character.toLowerCase(var12[0]);
} else if(tempLine.startsWith("key_default_size")) {
var12 = tempLine.substring(17).trim().toCharArray();
key_default_size = Character.toLowerCase(var12[0]);
} else if(tempLine.startsWith("key_turn_left")) {
var12 = tempLine.substring(14).trim().toCharArray();
key_turn_left = Character.toLowerCase(var12[0]);
} else if(tempLine.startsWith("key_turn_right")) {
var12 = tempLine.substring(15).trim().toCharArray();
key_turn_right = Character.toLowerCase(var12[0]);
} else if(tempLine.startsWith("key_forward")) {
var12 = tempLine.substring(12).trim().toCharArray();
key_forward = Character.toLowerCase(var12[0]);
} else if(tempLine.startsWith("key_backward")) {
var12 = tempLine.substring(13).trim().toCharArray();
key_backward = Character.toLowerCase(var12[0]);
} else if(tempLine.startsWith("key_left")) {
var12 = tempLine.substring(9).trim().toCharArray();
key_left = Character.toLowerCase(var12[0]);
} else if(tempLine.startsWith("key_right")) {
var12 = tempLine.substring(10).trim().toCharArray();
key_right = Character.toLowerCase(var12[0]);
} else if(tempLine.startsWith("key_map")) {
var12 = tempLine.substring(8).trim().toCharArray();
key_map = Character.toLowerCase(var12[0]);
} else if(tempLine.startsWith("key_oracle")) {
var12 = tempLine.substring(11).trim().toCharArray();
key_oracle = Character.toLowerCase(var12[0]);
} else if(tempLine.startsWith("key_info")) {
var12 = tempLine.substring(9).trim().toCharArray();
key_info = Character.toLowerCase(var12[0]);
}
}
}
}
}
}
bufferedReader.close();
} catch (Exception var7) {
var7.printStackTrace(System.out);
writeDmnewLog("** ERROR: Could not read config file. " + var7.getMessage());
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment