Last active
May 5, 2022 09:26
-
-
Save Zarkonnen/40a4962f9f2a4a29243fd0932ddec975 to your computer and use it in GitHub Desktop.
Moddable data loading code from Airships
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // Dump of the data loading code for the game for modders to pick apart. | |
| // Code is for version 1.0.23.10 | |
| // See also: | |
| // http://zarkonnen.com/airships/modding_guide | |
| // http://zarkonnen.com/airships/modding_guide/crew_animation | |
| // http://zarkonnen.com/airships/modding_guide/bonusable_values | |
| // Documentation on what the weather/landscape stuff will look like after the landscape update | |
| // https://gist.github.com/Zarkonnen/bf56b5c72b203767cac8ddc264781fc3 | |
| // Appearances are used all over the place | |
| public Appearance(JSONObject o) { | |
| spritesheetBundle = SpritesheetBundle.ofName(o.getString("src")); | |
| if (spritesheetBundle == null) { | |
| throw new RuntimeException("No spritesheet bundle of name \"" + o.getString("src") + "\""); | |
| } | |
| if (o.has("x")) { | |
| frame(o.getInt("x"), o.getInt("y"), o.optInt("w", 1), o.optInt("h", 1), o.optBoolean("flipped", false), o.optInt("shiftX", 0), o.optInt("shiftY", 0)); | |
| } else { | |
| JSONArray framesA = o.getJSONArray("frames"); | |
| for (int i = 0; i < framesA.length(); i++) { | |
| JSONObject f = framesA.getJSONObject(i); | |
| frame(f.getInt("x"), f.getInt("y"), f.optInt("w", 1), f.optInt("h", 1), f.optBoolean("flipped", false), f.optInt("shiftX", 0), f.optInt("shiftY", 0)); | |
| } | |
| } | |
| interval = o.optInt("interval", 300); | |
| if (interval <= 0) { | |
| interval = 300; | |
| } | |
| } | |
| // All loadables, in the order they're loaded: | |
| public LoadingQuote(JSONObject o) { | |
| super(o.getString("name")); | |
| img = new Img(o.getString("name")); | |
| numQuotes = o.getInt("numQuotes"); | |
| } | |
| public Shouts(JSONObject o) { | |
| super(o.getString("name")); | |
| for (Object key : o.keySet()) { | |
| if (key instanceof String) { | |
| String k = (String) key; | |
| if (k.equals("name")) { continue; } | |
| JSONArray a = o.getJSONArray(k); | |
| ArrayList<String> l = new ArrayList<String>(); | |
| for (int i = 0; i < a.length(); i++) { | |
| l.add(a.getString(i)); | |
| } | |
| shouts.put(k, l); | |
| } | |
| } | |
| } | |
| public VariantType(JSONObject o) { | |
| super(o.getString("name")); | |
| icon = new Img(o.getJSONObject("icon").getString("src"), o.getJSONObject("icon").getInt("x"), o.getJSONObject("icon").getInt("y"), o.getJSONObject("icon").optInt("w", 16), o.getJSONObject("icon").optInt("h", 16), o.getJSONObject("icon").optBoolean("flipped", false)); | |
| isDefault = o.optBoolean("isDefault", false); | |
| reverseIterationOrderIfFlipped = o.optBoolean("reverseIterationOrderIfFlipped", false); | |
| if (isDefault) { | |
| def = this; | |
| } | |
| } | |
| public GenericFragment(JSONObject o) { | |
| super(o.getString("name")); | |
| img = new Img(o.getString("src"), o.getInt("x"), o.getInt("y"), o.getInt("w"), o.getInt("h"), o.optBoolean("flipped", false)); | |
| } | |
| public CityName(JSONObject o) { | |
| super(o.getString("name")); | |
| } | |
| public Tincture(JSONObject o) { | |
| super(o.getString("name"), o.optInt("sort", 0)); | |
| tint = new Clr(o.getJSONObject("pureColour").getInt("r"), o.getJSONObject("pureColour").getInt("g"), o.getJSONObject("pureColour").getInt("b")); | |
| metal = o.optBoolean("metal", false); | |
| if (o.has("addToHeraldicStylesAsLayoutTincture")) { | |
| JSONArray a = o.getJSONArray("addToHeraldicStylesAsLayoutTincture"); | |
| for (int i = 0; i < a.length(); i++) { | |
| addToHeraldicStylesAsLayoutTincture.add(a.getString(i)); | |
| } | |
| } | |
| if (o.has("addToHeraldicStylesAsChargeTincture")) { | |
| JSONArray a = o.getJSONArray("addToHeraldicStylesAsChargeTincture"); | |
| for (int i = 0; i < a.length(); i++) { | |
| addToHeraldicStylesAsChargeTincture.add(a.getString(i)); | |
| } | |
| } | |
| } | |
| public PaintType(JSONObject o) { | |
| super(o.getString("name"), o.optInt("sort", 0)); | |
| if (o.has("tincture")) { | |
| tinc = Tincture.valueOf(o.getString("tincture")); | |
| if (tinc.paintType != null) { | |
| throw new RuntimeException("Tincture " + tinc.name + " already referenced by a paint type."); | |
| } | |
| tinc.paintType = this; | |
| if (o.has("tint")) { | |
| JSONObject t = o.getJSONObject("tint"); | |
| tint = new Clr(t.getInt("r"), t.getInt("g"), t.getInt("b"), t.optInt("a", 200)); | |
| } else { | |
| tint = null; | |
| } | |
| armsTincIndex = 0; | |
| metal = tinc.metal; | |
| } else if (o.has("tint")) { | |
| JSONObject t = o.getJSONObject("tint"); | |
| tint = new Clr(t.getInt("r"), t.getInt("g"), t.getInt("b"), t.optInt("a", 200)); | |
| tinc = null; | |
| armsTincIndex = 0; | |
| metal = o.optBoolean("metal", false); | |
| } else { | |
| tint = null; | |
| tinc = null; | |
| armsTincIndex = o.getInt("armsTinctureIndex"); | |
| metal = false; | |
| } | |
| } | |
| public GameSetting(JSONObject o) { | |
| super(o.getString("name")); | |
| if (name.equals("minStructuralStress")) { | |
| minStructuralStress = o.getInt("value"); | |
| } | |
| if (name.equals("structuralStressPerHPPenalty")) { | |
| structuralStressPerHPPenalty = o.getInt("value"); | |
| } | |
| if (name.equals("maxStructuralStressHPPenalty")) { | |
| maxStructuralStressHPPenalty = o.getDouble("value"); | |
| } | |
| } | |
| public DifficultyLevel(JSONObject o) { | |
| super(o.getString("name"), o.optInt("sort", 0)); | |
| enemyAI = AIQuality.valueOf(o.getString("enemyAI")); | |
| playerIncome = o.getInt("playerIncome"); | |
| playerExtraMoney = o.getInt("playerExtraMoney"); | |
| playerShipyardLevel = o.getInt("playerShipyardLevel"); | |
| playerFinalCash = o.getInt("playerFinalCash"); | |
| monsterNestDensity = o.getDouble("monsterNestDensity"); | |
| monsterNestIncomeMult = o.getDouble("monsterNestIncomeMult"); | |
| mergeUrgency = o.getDouble("mergeUrgency"); | |
| extraAIStartingTechs = o.optInt("extraAIStartingTechs", 2); | |
| aiIncomeMultiplier = o.optDouble("aiIncomeMultiplier", 1); | |
| aiProductionMultiplier = o.optDouble("aiProductionMultiplier", 1); | |
| attackInterval = o.optInt("attackInterval", 40000); | |
| playerAttackInterval = o.optInt("playerAttackInterval", 30000); | |
| aiExtraMoney = o.optInt("aiExtraMoney", 0); | |
| startingShip = o.optBoolean("startingShip", true); | |
| maxAIBonusConstructions = o.optInt("maxAIBonusConstructions", 9); | |
| minimalNestUpgradeTimeDivider = o.optInt("minimalNestUpgradeTimeDivider", 4); | |
| } | |
| public MapSize(JSONObject o) { | |
| super(o.getString("name"), o.getInt("gridSize")); | |
| gridSize = 256 * o.getInt("gridSize") / WorldMap.SCALE_FACTOR; | |
| empires = o.getInt("empires"); | |
| townsPerEmpire = o.optInt("townsPerEmpire", 3); | |
| nests = o.getInt("nests"); | |
| } | |
| public Bonus(JSONObject o) { | |
| super(o.getString("name")); | |
| standard = o.optBoolean("standard", false); | |
| } | |
| public EmpireStat(JSONObject o) { | |
| super(o.getString("name")); | |
| if (name.equals("CITY_INCOME_PERCENTAGE_BONUS")) { | |
| CITY_INCOME_PERCENTAGE_BONUS = BonusableValue.intFromJSON(o, "value", 0); | |
| } | |
| if (name.equals("TAKEOVER_NEEDED")) { | |
| TAKEOVER_NEEDED = BonusableValue.booleanFromJSON(o, "value", true); | |
| } | |
| if (name.equals("FIRE_QUENCH_AMOUNT")) { | |
| FIRE_QUENCH_AMOUNT = BonusableValue.intFromJSON(o, "value", 0); | |
| } | |
| if (name.equals("REPAIR_AMOUNT")) { | |
| REPAIR_AMOUNT = BonusableValue.intFromJSON(o, "value", 0); | |
| } | |
| if (name.equals("ESPIONAGE_SUCCESS_PERCENTAGE_BONUS")) { | |
| ESPIONAGE_SUCCESS_PERCENTAGE_BONUS = BonusableValue.intFromJSON(o, "value", 0); | |
| } | |
| if (name.equals("ESPIONAGE_DEFENCE_PERCENTAGE_BONUS")) { | |
| ESPIONAGE_DEFENCE_PERCENTAGE_BONUS = BonusableValue.intFromJSON(o, "value", 0); | |
| } | |
| if (name.equals("ESPIONAGE_COST_PERCENTAGE_BONUS")) { | |
| ESPIONAGE_COST_PERCENTAGE_BONUS = BonusableValue.intFromJSON(o, "value", 0); | |
| } | |
| if (name.equals("PRODUCTION_PERCENTAGE_BONUS")) { | |
| PRODUCTION_PERCENTAGE_BONUS = BonusableValue.intFromJSON(o, "value", 0); | |
| } | |
| if (name.equals("REVOLTING_CITIES_JOIN_EMPIRE")) { | |
| REVOLTING_CITIES_JOIN_EMPIRE = BonusableValue.booleanFromJSON(o, "value", false); | |
| } | |
| if (name.equals("BASE_RESEARCH_COST")) { | |
| BASE_RESEARCH_COST = BonusableValue.intFromJSON(o, "value", 300); | |
| } | |
| if (name.equals("RESEARCH_COST_EXPONENT")) { | |
| RESEARCH_COST_EXPONENT = BonusableValue.doubleFromJSON(o, "value", 1.5); | |
| } | |
| if (name.equals("BIO_MONSTER_RESEARCH_MULT")) { | |
| BIO_MONSTER_RESEARCH_MULT = BonusableValue.doubleFromJSON(o, "value", 1.0); | |
| } | |
| if (name.equals("BIO_MONSTER_MONEY_MULT")) { | |
| BIO_MONSTER_MONEY_MULT = BonusableValue.doubleFromJSON(o, "value", 1.0); | |
| } | |
| if (name.equals("DAYS_PER_MONTH")) { | |
| DAYS_PER_MONTH = BonusableValue.intFromJSON(o, "value", 28); | |
| } | |
| if (name.equals("STARTING_DAY")) { | |
| STARTING_DAY = BonusableValue.intFromJSON(o, "value", 404 * 364); | |
| } | |
| if (name.equals("MONTHS")) { | |
| MONTHS = BonusableValue.listFromJSON(o, "value", DEFAULT_MONTHS, new BonusableValue.FromJSON<String>() { | |
| @Override | |
| public String construct(JSONObject o, BonusSet bs) { | |
| return o.getString("name"); | |
| } | |
| }); | |
| } | |
| if (name.equals("CALENDAR_NAME")) { | |
| CALENDAR_NAME = BonusableValue.stringFromJSON(o, "value", "lunar_calendar"); | |
| } | |
| } | |
| public SpritesheetBundle(JSONObject o) { | |
| super(o.getString("name")); | |
| bump = o.optString("bump", null); | |
| fragments = o.optString("fragments", null); | |
| if (bump != null && fragments != null) { | |
| damagedVersion = new SpritesheetBundle(name + "DAMAGED", bump + "DAMAGED"); | |
| fragmentsSheet = new SpritesheetBundle(name + "FRAGMENTS", bump + "FRAGMENTS"); | |
| } else { | |
| damagedVersion = null; | |
| fragmentsSheet = null; | |
| } | |
| } | |
| public ArmsLayout(JSONObject o) { | |
| super(o.getString("name"), o.optInt("sort", 0)); | |
| tinctures = o.getInt("tinctures"); | |
| detailPrefix = o.optString("detailPrefix", null); | |
| JSONArray a; | |
| if (o.has("charges")) { | |
| a = o.getJSONArray("charges"); | |
| charges = o.optInt("numCharges", a.length()); | |
| JSONArray a2 = o.getJSONArray("shieldCharges"); | |
| for (int i = 0; i < a.length(); i++) { | |
| chargeLocations.add(new ChargeLocation(a.getJSONObject(i), TinctureSlot.chargeTOf(i))); | |
| shieldChargeLocations.add(new ChargeLocation(a2.getJSONObject(i), TinctureSlot.chargeTOf(i))); | |
| } | |
| } else { | |
| charges = 0; | |
| } | |
| if (o.has("adjacent")) { | |
| a = o.getJSONArray("adjacent"); | |
| for (int i = 0; i < a.length(); i += 2) { | |
| adjacent(CoatOfArms.TinctureSlot.valueOf(a.getString(i)), CoatOfArms.TinctureSlot.valueOf(a.getString(i + 1))); | |
| } | |
| } | |
| if (o.has("onTop")) { | |
| a = o.getJSONArray("onTop"); | |
| for (int i = 0; i < a.length(); i += 2) { | |
| onTop(CoatOfArms.TinctureSlot.valueOf(a.getString(i)), CoatOfArms.TinctureSlot.valueOf(a.getString(i + 1))); | |
| } | |
| } | |
| if (o.has("apps")) { | |
| a = o.getJSONArray("apps"); | |
| for (int i = 0; i < a.length(); i++) { | |
| apps.add(new TincturedApp(a.getJSONObject(i))); | |
| } | |
| } | |
| if (o.has("unlitApps")) { | |
| a = o.getJSONArray("unlitApps"); | |
| for (int i = 0; i < a.length(); i++) { | |
| unlitApps.add(new TincturedApp(a.getJSONObject(i))); | |
| } | |
| } | |
| if (o.has("shieldImages")) { | |
| a = o.getJSONArray("shieldImages"); | |
| for (int i = 0; i < a.length(); i++) { | |
| shieldImages.add(new TincturedImg(a.getJSONObject(i))); | |
| } | |
| } | |
| if (o.has("shieldOutline")) { | |
| JSONObject io = o.getJSONObject("shieldOutline"); | |
| shieldOutline = new Img(io.getString("src"), io.getInt("x"), io.getInt("y"), io.getInt("w"), io.getInt("h"), io.optBoolean("flipped", false)); | |
| } else { | |
| shieldOutline = null; | |
| } | |
| if (o.has("addToHeraldicStyles")) { | |
| a = o.getJSONArray("addToHeraldicStyles"); | |
| for (int i = 0; i < a.length(); i++) { | |
| addToHeraldicStyles.add(a.getString(i)); | |
| } | |
| } | |
| } | |
| public Cursor(JSONObject o) { | |
| super(o.getString("name")); | |
| JSONObject i; | |
| dxSmall = o.optInt("dxSmall", 0); | |
| dySmall = o.optInt("dySmall", 0); | |
| i = o.getJSONObject("imgSmall"); | |
| imgSmall = new Img(i.getString("src"), i.getInt("x"), i.getInt("y"), i.getInt("w"), i.getInt("h"), false); | |
| if (o.has("imgMedium")) { | |
| dxMedium = o.optInt("dxMedium", 0); | |
| dyMedium = o.optInt("dyMedium", 0); | |
| i = o.getJSONObject("imgMedium"); | |
| imgMedium = new Img(i.getString("src"), i.getInt("x"), i.getInt("y"), i.getInt("w"), i.getInt("h"), false); | |
| } else { | |
| dxMedium = dxSmall; | |
| dyMedium = dySmall; | |
| imgMedium = imgSmall; | |
| } | |
| if (o.has("imgLarge")) { | |
| dxLarge = o.optInt("dxLarge", 0); | |
| dyLarge = o.optInt("dyLarge", 0); | |
| i = o.getJSONObject("imgLarge"); | |
| imgLarge = new Img(i.getString("src"), i.getInt("x"), i.getInt("y"), i.getInt("w"), i.getInt("h"), false); | |
| } else { | |
| dxLarge = dxMedium; | |
| dyLarge = dyMedium; | |
| imgLarge = imgMedium; | |
| } | |
| } | |
| // This weather stuff will change shortly. | |
| public CloudType(JSONObject o) { | |
| super(o.getString("name")); | |
| JSONArray a = o.getJSONArray("clouds"); | |
| for (int i = 0; i < a.length(); i++) { | |
| clouds.add(new Appearance(a.getJSONObject(i))); | |
| } | |
| } | |
| public Backdrop(JSONObject o) { | |
| super(o.getString("name")); | |
| typeName = o.getString("type"); | |
| snowy = o.optBoolean("snowy", false); | |
| app = new Appearance(o.getJSONObject("app")); | |
| } | |
| public BackdropType(JSONObject o) { | |
| super(o.getString("name")); | |
| for (Backdrop bd : Loadable.all(Backdrop.class)) { | |
| if (bd.typeName.equals(name)) { | |
| (bd.snowy ? snowyBackdrops : backdrops).add(bd); | |
| } | |
| } | |
| } | |
| public BackgroundFloatieType(JSONObject o) { | |
| super(o.getString("name")); | |
| weight = o.getInt("weight"); | |
| xSpeed = o.getDouble("xSpeed"); | |
| yAmplitude = o.getDouble("yAmplitude"); | |
| yPeriod = o.getInt("yPeriod"); | |
| app = new Appearance(o.getJSONObject("appearance")); | |
| if (o.has("subColor")) { | |
| JSONObject co = o.getJSONObject("subColor"); | |
| subColor = new Clr(co.getInt("r"), co.getInt("g"), co.getInt("b")); | |
| JSONArray a = o.getJSONArray("replacementColors"); | |
| for (int i = 0; i < a.length(); i++) { | |
| co = a.getJSONObject(i); | |
| replacementColors.add(new Clr(co.getInt("r"), co.getInt("g"), co.getInt("b"))); | |
| } | |
| } else { | |
| subColor = new Clr(255, 0, 255); | |
| replacementColors.add(new Clr(255, 0, 255)); | |
| } | |
| } | |
| public BirdType(JSONObject o) { | |
| super(o.getString("name")); | |
| maxSpeed = o.getInt("maxSpeed"); | |
| left = new Appearance(o.getJSONObject("left")); | |
| right = new Appearance(o.getJSONObject("right")); | |
| down = new Appearance(o.getJSONObject("down")); | |
| if (o.getString("behavior").equals("circle")) { | |
| behavior = new Bird.Circle( | |
| o.optInt("circleW", 100), | |
| o.optInt("circleH", 10), | |
| o.optInt("upDownH", 200), | |
| o.optInt("circlePeriod", 5100), | |
| o.optInt("upDownPeriod", 62300) | |
| ); | |
| } else if (o.getString("behavior").equals("flyAcross")) { | |
| behavior = new Bird.FlyAcross(); | |
| } else { | |
| behavior = new Bird.Boid(); | |
| } | |
| if (o.getString("spawner").equals("v")) { | |
| spawner = new Bird.VSpawner(o.getInt("vMinY"), o.getInt("vMaxY"), o.getInt("vXSpawn")); | |
| } else { | |
| if (o.optBoolean("flockTargetH", false)) { | |
| spawner = new Bird.FlockSpawner( | |
| o.getInt("flockMin"), | |
| o.getInt("flockMax"), | |
| o.getInt("flockDist"), | |
| o.getInt("flockTargetH") | |
| ); | |
| } else { | |
| spawner = new Bird.FlockSpawner( | |
| o.getInt("flockMin"), | |
| o.getInt("flockMax"), | |
| o.getInt("flockDist") | |
| ); | |
| } | |
| } | |
| } | |
| public CombatBackgroundFlavor(JSONObject o) { | |
| super(o.getString("name")); | |
| if (o.has("birds")) { | |
| birds = BirdType.ofName(o.getString("birds")); | |
| } else { | |
| birds = null; | |
| } | |
| JSONArray bs = o.getJSONArray("backdrops"); | |
| for (int i = 0; i < bs.length(); i++) { | |
| backdrops.add(BackdropType.ofName(bs.getString(i))); | |
| } | |
| } | |
| // Soon to change stuff ends | |
| public ParticleType(JSONObject o) { | |
| super(o.getString("name")); | |
| this.pt = o.has("pictureType") ? Particle.PictureType.valueOf(o.getString("pictureType")) : null; | |
| this.directional = o.optBoolean("directional", false); | |
| this.lit = o.optBoolean("lit", false); | |
| this.stickSpeed = o.optDouble("stickSpeed", 0); | |
| this.dissolveWhenStuck = o.optBoolean("dissolveWhenStuck", false); | |
| this.grav = o.getDouble("grav"); | |
| this.windMult = o.optDouble("windMult", 1); | |
| this.offset = o.getDouble("offset"); | |
| this.minDx = o.getDouble("minDx"); | |
| this.maxDx = o.getDouble("maxDx"); | |
| this.minDy = o.getDouble("minDy"); | |
| this.maxDy = o.getDouble("maxDy"); | |
| this.minLifespan = StrictMath.max(10, o.getInt("minLifespan")); | |
| this.maxLifespan = StrictMath.max(10, o.getInt("maxLifespan")); | |
| this.startSize = o.getInt("startSize"); | |
| this.endSize = o.getInt("endSize"); | |
| this.startClr = o.has("startClr") ? new Clr(o.getJSONObject("startClr").getInt("r"), o.getJSONObject("startClr").getInt("g"), o.getJSONObject("startClr").getInt("b"), o.getJSONObject("startClr").getInt("a")) : null; | |
| this.earlyClr = o.has("earlyClr") ? new Clr(o.getJSONObject("earlyClr").getInt("r"), o.getJSONObject("earlyClr").getInt("g"), o.getJSONObject("earlyClr").getInt("b"), o.getJSONObject("earlyClr").getInt("a")) : null; | |
| this.endClr = o.has("endClr") ? new Clr(o.getJSONObject("endClr").getInt("r"), o.getJSONObject("endClr").getInt("g"), o.getJSONObject("endClr").getInt("b"), o.getJSONObject("endClr").getInt("a")) : null; | |
| this.tintStartClr = o.has("tintStartClr") ? new Clr(o.getJSONObject("tintStartClr").getInt("r"), o.getJSONObject("tintStartClr").getInt("g"), o.getJSONObject("tintStartClr").getInt("b"), o.getJSONObject("tintStartClr").getInt("a")) : null; | |
| this.tintEndClr = o.has("tintEndClr") ? new Clr(o.getJSONObject("tintEndClr").getInt("r"), o.getJSONObject("tintEndClr").getInt("g"), o.getJSONObject("tintEndClr").getInt("b"), o.getJSONObject("tintEndClr").getInt("a")) : null; | |
| this.haloStrength = o.optDouble("haloStrength", 1.0); | |
| if (earlyClr != null) { | |
| for (int i = 0; i < 3; i++) { | |
| Clr c = startClr.mix(1.0 * i / 5, earlyClr); | |
| gradient[i] = new float[] {c.r / 255f, c.g / 255f, c.b / 255f, c.a / 255f}; | |
| } | |
| for (int i = 3; i < gradient.length; i++) { | |
| Clr c = earlyClr.mix(1.0 * (i - 3) / (gradient.length - 3), endClr); | |
| gradient[i] = new float[] {c.r / 255f, c.g / 255f, c.b / 255f, c.a / 255f}; | |
| } | |
| } else { | |
| for (int i = 0; i < gradient.length; i++) { | |
| Clr c = startClr.mix(1.0 * i / gradient.length, endClr); | |
| gradient[i] = new float[] {c.r / 255f, c.g / 255f, c.b / 255f, c.a / 255f}; | |
| } | |
| } | |
| if (tintStartClr != null) { | |
| for (int i = 0; i < tintGradient.length; i++) { | |
| tintGradient[i] = tintStartClr.mix(1.0 * i / tintGradient.length, tintEndClr); | |
| } | |
| } | |
| maxSize = StrictMath.max(startSize, endSize); | |
| this.lightClr = o.has("lightClr") ? new Clr(o.getJSONObject("lightClr").getInt("r"), o.getJSONObject("lightClr").getInt("g"), o.getJSONObject("lightClr").getInt("b"), o.getJSONObject("lightClr").getInt("a")) : null; | |
| this.lightRadius = o.optInt("lightRadius", 0); | |
| this.strongLight = o.optBoolean("strongLight", false); | |
| this.accumulates = o.optBoolean("accumulates", false); | |
| } | |
| // These will also change | |
| public WeatherEffect(JSONObject o) { | |
| super(o.getString("name")); | |
| shootJitterMult = o.optDouble("shootJitterMult", 1.0); | |
| shootToRightJitterMult = o.optDouble("shootToRightJitterMult", 1.0); | |
| shootToLeftJitterMult = o.optDouble("shootToLeftJitterMult", 1.0); | |
| fireExtinguishChance = o.optDouble("fireExtinguishChance", 0); | |
| wind = o.optDouble("wind", 0); | |
| lightning = o.optBoolean("lightning", false); | |
| rain = o.optBoolean("rain", false); | |
| snow = o.optBoolean("snow", false); | |
| snowing = o.optBoolean("snowing", snow); | |
| fog = o.optBoolean("fog", false); | |
| fewStars = o.optBoolean("fewStars", false); | |
| manyStars = o.optBoolean("manyStars", false); | |
| groundImpactParticle = ParticleType.ofName(o.getString("groundImpactParticle")); | |
| numGroundImpactParticles = o.getInt("numGroundImpactParticles"); | |
| if (o.has("icon")) { | |
| icon = new Appearance(o.getJSONObject("icon")); | |
| } else { | |
| icon = null; | |
| } | |
| if (o.has("icon2")) { | |
| icon2 = new Appearance(o.getJSONObject("icon2")); | |
| } else { | |
| icon2 = null; | |
| } | |
| } | |
| public TimeOfDay(JSONObject o) { | |
| super(o.getString("name")); | |
| light = new Color[] { | |
| getColor(o.getJSONObject("topLight")), | |
| getColor(o.getJSONObject("leftLight")), | |
| getColor(o.getJSONObject("rightLight")), | |
| getColor(o.getJSONObject("bottomLight")) | |
| }; | |
| ambientSaturation = (float) o.optDouble("ambientSaturation", 1.0); | |
| if (o.optJSONObject("ambient") != null) { | |
| ambient = getColor(o.getJSONObject("ambient")); | |
| ambientTint = getClr(o.getJSONObject("ambient")); | |
| ambientAmt = (float) ((ambient.r + ambient.g + ambient.b) * 1.0 / (255 * 3)); | |
| deepSoilTint = new Clr((int) (97 * 0.9 * ambientTint.r / 255), (int) (63 * 0.9 * ambientTint.g / 255), (int) (45 * 0.9 * ambientTint.b / 255)); | |
| } else { | |
| ambientAmt = (float) o.getDouble("ambient"); | |
| ambient = new Color(ambientAmt, ambientAmt, ambientAmt); | |
| ambientTint = new Clr((int) (255 * ambientAmt), (int) (255 * ambientAmt), (int) (255 * ambientAmt)); | |
| float a2 = 0.1f + ambientAmt; | |
| deepSoilTint = new Clr((int) (97 * 0.9 * a2), (int) (63 * 0.9 * a2), (int) (45 * 0.9 * a2)); | |
| } | |
| if (o.optJSONObject("backdropAmbient") != null) { | |
| backdropAmbient = getColor(o.getJSONObject("backdropAmbient")); | |
| } else { | |
| backdropAmbient = ambient; | |
| } | |
| backdropAmbientSaturation = (float) o.optDouble("backdropAmbientSaturation", ambientSaturation * 0.5); | |
| lightStrength = (float) o.getDouble("lightStrength"); | |
| haloStrength = o.getDouble("haloSize"); | |
| JSONArray sc = o.getJSONArray("skyColors"); | |
| skyColors = new Clr[sc.length()]; | |
| for (int i = 0; i < skyColors.length; i++) { | |
| skyColors[i] = getClr(sc.getJSONObject(i)); | |
| } | |
| skyColorBandHeight = o.getInt("skyColorBandHeight"); | |
| effect = WeatherEffect.ofName(o.getString("weatherEffect")); | |
| clouds = CloudType.ofName(o.getString("clouds")); | |
| cloudBottomsAligned = o.getBoolean("cloudBottomsAligned"); | |
| String apf = o.optString("appearancePostfix", name); | |
| if (!ORIGINAL_APPEARANCE_POSTFIXES.contains(apf)) { | |
| appearancePostfixIsBad = true; | |
| appearancePostfix = "DAY"; | |
| } else { | |
| appearancePostfixIsBad = false; | |
| appearancePostfix = apf; | |
| } | |
| } | |
| public Season(JSONObject o) { | |
| super(o.getString("name"), o.getInt("sort")); | |
| lengthInDays = o.getInt("lengthInDays"); | |
| JSONObject icn = o.getJSONObject("icon"); | |
| icon = new Img(icn.getString("src"), icn.getInt("x"), icn.getInt("y"), icn.optInt("w", 16), icn.optInt("h", 16), icn.optBoolean("flipped", false)); | |
| if (o.has("timesOfDay")) { | |
| JSONArray a = o.getJSONArray("timesOfDay"); | |
| for (int i = 0; i < a.length(); i++) { | |
| timesOfDay.add(TimeOfDay.ofName(a.getString(i))); | |
| } | |
| } | |
| if (o.has("defaultTimeOfDay")) { | |
| defaultTimeOfDay = TimeOfDay.ofName(o.getString("defaultTimeOfDay")); | |
| } else if (!timesOfDay.isEmpty()) { | |
| defaultTimeOfDay = timesOfDay.get(0); | |
| } else { | |
| defaultTimeOfDay = null; | |
| } | |
| } | |
| // End of soon to change stuff again | |
| public Moon(JSONObject o) { | |
| super(o.getString("name"), o.getInt("sort")); | |
| offsetInDays = o.getInt("offsetInDays"); | |
| periodInDays = o.getInt("periodInDays"); | |
| show = BonusableValue.booleanFromJSON(o, "show", true); | |
| } | |
| // Also will change a bit with the weather stuff, but not much | |
| public LandBlockType(JSONObject o) { | |
| super(o.getString("name"), o.optInt("sort", 0)); | |
| landFormationRemoveStopper = o.optBoolean("landFormationRemoveStopper"); | |
| canPlace = o.optBoolean("canPlace", false); | |
| canPlaceInMissionEditor = o.optBoolean("canPlaceInMissionEditor", false); | |
| canOverhang = o.optBoolean("canOverhang", false); | |
| removeCost = o.getInt("removeCost"); | |
| addCost = o.getInt("addCost"); | |
| solid = o.optBoolean("solid", true); | |
| opaque = o.optBoolean("opaque", true); | |
| damageMultiplier = o.getDouble("damageMultiplier"); | |
| hp = StrictMath.max(0, StrictMath.min(35, o.getInt("hp"))); | |
| armour = o.getInt("armour"); | |
| weight = o.getInt("weight"); | |
| liftGenerated = o.optInt("liftGenerated", 0); | |
| if (o.has("destroyParticle")) { | |
| destroyparticle = ParticleType.ofName(o.getString("destroyParticle")); | |
| } else { | |
| destroyparticle = null; | |
| } | |
| SoundEffect ds = null; | |
| if (o.has("destroySound")) { | |
| try { | |
| ds = new SoundEffect(o.getString("destroySound"), o.optInt("numDestroySounds", 1)); | |
| } catch (Exception e) { | |
| ds = new SoundEffect(o.getJSONObject("destroySound")); | |
| } | |
| } | |
| destroySound = ds; | |
| if (o.has("appearance")) { | |
| app = new Appearance(o.getJSONObject("appearance")); | |
| } else { | |
| app = null; | |
| } | |
| if (o.has("topSnowAppearance")) { | |
| topSnowApp = new Appearance(o.getJSONObject("topSnowAppearance")); | |
| } else { | |
| topSnowApp = null; | |
| } | |
| if (o.has("snowAppearance")) { | |
| snowApp = new Appearance(o.getJSONObject("snowAppearance")); | |
| } else { | |
| snowApp = null; | |
| } | |
| if (o.has("particleEmitter")) { | |
| JSONObject pe = o.getJSONObject("particleEmitter"); | |
| SoundEffect ef = null; | |
| if (pe.has("sound")) { | |
| try { | |
| String sound = pe.getString("sound"); | |
| ef = new SoundEffect(sound, pe.optDouble("volume")); | |
| } catch (Exception e) { | |
| ef = new SoundEffect(pe.getJSONObject("sound")); | |
| } | |
| } | |
| particleEmitter = new Particle.Emitter( | |
| ParticleType.ofName(pe.getString("type")), | |
| pe.getDouble("emitProbability"), | |
| pe.optInt("numParticles", 1), | |
| ef); | |
| } else { | |
| particleEmitter = null; | |
| } | |
| if (o.has("snowParticleEmitter")) { | |
| JSONObject pe = o.getJSONObject("snowParticleEmitter"); | |
| SoundEffect ef = null; | |
| if (pe.has("sound")) { | |
| try { | |
| String sound = pe.getString("sound"); | |
| ef = new SoundEffect(sound, pe.optDouble("volume")); | |
| } catch (Exception e) { | |
| ef = new SoundEffect(pe.getJSONObject("sound")); | |
| } | |
| } | |
| snowParticleEmitter = new Particle.Emitter( | |
| ParticleType.ofName(pe.getString("type")), | |
| pe.getDouble("emitProbability"), | |
| pe.optInt("numParticles", 1), | |
| ef); | |
| } else { | |
| snowParticleEmitter = null; | |
| } | |
| if (o.has("externalApp")) { | |
| JSONObject ea = o.getJSONObject("externalApp"); | |
| externalApp = new ExternalApp( | |
| new Appearance(ea.getJSONObject("appearance")), | |
| ea.optInt("x"), | |
| ea.optInt("y")); | |
| } else { | |
| externalApp = null; | |
| } | |
| if (o.has("externalSnowApp")) { | |
| JSONObject ea = o.getJSONObject("externalSnowApp"); | |
| externalSnowApp = new ExternalApp( | |
| new Appearance(ea.getJSONObject("appearance")), | |
| ea.optInt("x"), | |
| ea.optInt("y")); | |
| } else { | |
| externalSnowApp = externalApp; | |
| } | |
| if (o.has("externalTopSnowApp")) { | |
| JSONObject ea = o.getJSONObject("externalTopSnowApp"); | |
| externalTopSnowApp = new ExternalApp( | |
| new Appearance(ea.getJSONObject("appearance")), | |
| ea.optInt("x"), | |
| ea.optInt("y")); | |
| } else { | |
| externalTopSnowApp = null; | |
| } | |
| externalDrawPriority = o.optBoolean("externalDrawPriority", false); | |
| } | |
| public LandscapeType(JSONObject o) { | |
| super(o.getString("name")); | |
| soil = LandBlockType.ofName(o.optString("soil", "SOIL")); | |
| rock = LandBlockType.ofName(o.optString("rock", "ROCK")); | |
| suspendiumOre = LandBlockType.ofName(o.optString("suspendiumOre", "SUSPENDIUM_ORE")); | |
| grass = LandBlockType.ofName(o.optString("grass", "GRASS")); | |
| bush = LandBlockType.ofName(o.optString("bush", "BUSH")); | |
| smallTreeRoot = LandBlockType.ofName(o.optString("smallTreeRoot", "THIN_TRUNK")); | |
| smallTreeTrunk = LandBlockType.ofName(o.optString("smallTreeTrunk", "THIN_TRUNK")); | |
| smallTreeCrown = LandBlockType.ofName(o.optString("smallTreeCrown", "SMALL_CROWN")); | |
| largeTreeRoot = LandBlockType.ofName(o.optString("largeTreeRoot", "ROOTS")); | |
| largeTreeTrunk = LandBlockType.ofName(o.optString("largeTreeTrunk", "TRUNK")); | |
| largeTreeCrown = LandBlockType.ofName(o.optString("largeTreeCrown", "CROWN")); | |
| floaterTop = LandBlockType.ofName(o.optString("floaterTop", "FLOATER_TOP")); | |
| floaterUp = LandBlockType.ofName(o.optString("floaterUp", "FLOATER_UP")); | |
| floaterMiddle = LandBlockType.ofName(o.optString("floaterMiddle", "FLOATER_MIDDLE")); | |
| floaterDown = LandBlockType.ofName(o.optString("floaterDown", "FLOATER_DOWN")); | |
| floaterDowner = LandBlockType.ofName(o.optString("floaterDowner", "FLOATER_DOWNER")); | |
| floaterDownerRock = LandBlockType.ofName(o.optString("floaterDownerRock", "FLOATER_DOWNER_ROCK")); | |
| floaterDownerSuspendium = LandBlockType.ofName(o.optString("floaterDownerSuspendium", "FLOATER_DOWNER_SUSPENDIUM")); | |
| floaterBottom = LandBlockType.ofName(o.optString("floaterBottom", "FLOATER_BOTTOM")); | |
| JSONArray a = o.getJSONArray("backgroundFlavors"); | |
| for (int i = 0; i < a.length(); i++) { | |
| backgroundFlavors.add(CombatBackgroundFlavor.ofName(a.getString(i))); | |
| } | |
| hills = o.getDouble("hills"); | |
| treeDensity = o.getDouble("treeDensity"); | |
| largeTreeP = o.optDouble("largeTreeP", 1); | |
| bushDensity = o.optDouble("bushDensity"); | |
| if (o.has("specialGrasses")) { | |
| a = o.getJSONArray("specialGrasses"); | |
| for (int i = 0; i < a.length(); i++) { | |
| specialGrasses.add(LandBlockType.ofName(a.getString(i))); | |
| } | |
| } | |
| if (specialGrasses.isEmpty()) { | |
| specialGrassDensity = 0; | |
| } else { | |
| specialGrassDensity = o.getDouble("specialGrassDensity"); | |
| } | |
| if (o.has("specialFloaterTops")) { | |
| a = o.getJSONArray("specialFloaterTops"); | |
| for (int i = 0; i < a.length(); i++) { | |
| specialFloaterTops.add(LandBlockType.ofName(a.getString(i))); | |
| } | |
| } | |
| if (specialFloaterTops.isEmpty()) { | |
| specialFloaterTopDensity = 0; | |
| } else { | |
| specialFloaterTopDensity = o.getDouble("specialFloaterTopDensity"); | |
| } | |
| if (o.has("timesOfDay")) { | |
| a = o.getJSONArray("timesOfDay"); | |
| for (int i = 0; i < a.length(); i++) { | |
| timesOfDay.add(new Pair<Integer, TimeOfDay>(a.getJSONObject(i).getInt("spawnWeight"), TimeOfDay.ofName(a.getJSONObject(i).getString("name")))); | |
| } | |
| } else { | |
| for (TimeOfDay tod : Loadable.all(TimeOfDay.class)) { | |
| timesOfDay.add(new Pair<Integer, TimeOfDay>(1, tod)); | |
| } | |
| } | |
| } | |
| // OK, completely done with the things that will change with the weather/landscape update | |
| public BodyPlan(JSONObject o) { | |
| super(o.getString("name")); | |
| for (Side side : Side.values()) { | |
| JSONArray pn = o.getJSONArray(side.name()); | |
| ArrayList<String> pns = new ArrayList<String>(); | |
| for (int i = 0; i < pn.length(); i++) { | |
| pns.add(pn.getString(i)); | |
| } | |
| partNames.put(side, Collections.unmodifiableList(pns)); | |
| } | |
| } | |
| public AnimationBundle(JSONObject o) { | |
| super(o.getString("name")); | |
| bodyPlan = BodyPlan.ofName(o.getString("bodyPlan")); | |
| width = o.getDouble("width"); | |
| height = o.getDouble("height"); | |
| animations = new EnumMap<AnimationType, AnimationBundle.Animation>(AnimationType.class); | |
| JSONArray a = o.getJSONArray("animations"); | |
| for (int i = 0; i < a.length(); i++) { | |
| animations.put(AnimationType.valueOf(a.getJSONObject(i).getString("type")), new Animation(a.getJSONObject(i), bodyPlan)); | |
| } | |
| } | |
| // And inside | |
| public Animation(JSONObject o, BodyPlan bodyPlan) { | |
| length = o.optInt("length", LOOPING); | |
| side = Side.valueOf(o.getString("side")); | |
| this.bodyPlan = bodyPlan; | |
| parts = new Part[bodyPlan.partNames.get(side).size()]; | |
| JSONArray a = o.getJSONArray("parts"); | |
| for (int i = 0; i < a.length(); i++) { | |
| JSONObject p = a.getJSONObject(i); | |
| parts[bodyPlan.getIndex(side, p.getString("name"))] = new Part(p); | |
| } | |
| } | |
| // And inside | |
| public Part(JSONObject o) { | |
| x = o.getDouble("x"); | |
| y = o.getDouble("y"); | |
| rotationOffset = o.optDouble("cOff", 0); | |
| rotationPeriod = o.optDouble("cPeriod", 1000); | |
| rotationWidth = o.optDouble("cW", 0); | |
| rotationHeight = o.optDouble("cH", 0); | |
| waveOffset = o.optDouble("wOff", 0); | |
| wavePeriod = o.optDouble("wPeriod", 1000); | |
| waveStartAngle = o.optDouble("wStart", 0); | |
| waveEndAngle = o.optDouble("wEnd", 0); | |
| holdsResource = o.optBoolean("holdsResource", false); | |
| } | |
| public AnimationAppearance(JSONObject o) { | |
| super(o.getString("name")); | |
| if (o.has("frameAnimations")) { | |
| bundle = null; | |
| frameAnimations = new EnumMap<AnimationType, CrewFrameAnimation>(AnimationType.class); | |
| JSONObject fas = o.getJSONObject("frameAnimations"); | |
| for (AnimationType at : AnimationType.values()) { | |
| if (fas.has(at.name())) { | |
| frameAnimations.put(at, new CrewFrameAnimation(fas.getJSONObject(at.name()))); | |
| } | |
| } | |
| frameAnimationBoundingBoxWidth = o.getInt("frameAnimationBoundingBoxWidth"); | |
| frameAnimationBoundingBoxHeight = o.getInt("frameAnimationBoundingBoxHeight"); | |
| } else { | |
| bundle = AnimationBundle.ofName(o.getString("bundle")); | |
| frameAnimations = null; | |
| frameAnimationBoundingBoxWidth = 0; | |
| frameAnimationBoundingBoxHeight = 0; | |
| String spritesheet = o.getString("spritesheet"); | |
| for (Side side : Side.values()) { | |
| images.put(side, new Img[bundle.bodyPlan.partNames.get(side).size()]); | |
| emitters.put(side, new ArrayList[bundle.bodyPlan.partNames.get(side).size()]); | |
| deadEmitters.put(side, new ArrayList[bundle.bodyPlan.partNames.get(side).size()]); | |
| } | |
| JSONArray a = o.getJSONArray("images"); | |
| for (int i = 0; i < a.length(); i++) { | |
| JSONObject io = a.getJSONObject(i); | |
| Side side = Side.valueOf(io.getString("side")); | |
| images.get(side)[bundle.bodyPlan.getIndex(side, io.getString("part"))] = | |
| new Img(spritesheet, io.getInt("x"), io.getInt("y"), io.getInt("w"), io.getInt("h"), io.optBoolean("flipped", false)); | |
| if (io.has("emitters")) { | |
| ArrayList<BodyPartEmitter> l = new ArrayList<BodyPartEmitter>(); | |
| emitters.get(side)[bundle.bodyPlan.getIndex(side, io.getString("part"))] = l; | |
| JSONArray ems = io.getJSONArray("emitters"); | |
| for (int ei = 0; ei < ems.length(); ei++) { | |
| JSONObject em = ems.getJSONObject(ei); | |
| l.add(new BodyPartEmitter(ParticleType.ofName(em.getString("type")), em.getDouble("freq"), em.getDouble("x"), em.getDouble("y"), em.optDouble("scale", 1.0))); | |
| } | |
| } | |
| if (io.has("deadEmitters")) { | |
| ArrayList<BodyPartEmitter> l = new ArrayList<BodyPartEmitter>(); | |
| deadEmitters.get(side)[bundle.bodyPlan.getIndex(side, io.getString("part"))] = l; | |
| JSONArray ems = io.getJSONArray("deadEmitters"); | |
| for (int ei = 0; ei < ems.length(); ei++) { | |
| JSONObject em = ems.getJSONObject(ei); | |
| l.add(new BodyPartEmitter(ParticleType.ofName(em.getString("type")), em.getDouble("freq"), em.getDouble("x"), em.getDouble("y"), em.optDouble("scale", 1.0))); | |
| } | |
| } | |
| } | |
| } | |
| } | |
| // See also: http://zarkonnen.com/airships/modding_guide/crew_animation | |
| // And here's the AnimationType enum: | |
| public enum AnimationType { | |
| STANDING, | |
| STANDING_LEFT, | |
| STANDING_RIGHT, | |
| WALK_LEFT, | |
| WALK_RIGHT, | |
| CLIMB, | |
| FALL, | |
| JUMP_LEFT, | |
| JUMP_RIGHT, | |
| SHOOT_LEFT, | |
| SHOOT_RIGHT, | |
| REPAIR, | |
| WORK, | |
| GIVE_LEFT, | |
| GIVE_RIGHT, | |
| HANG_IN_THERE, | |
| CLIMB_SIDEWAYS, | |
| INJURED, | |
| HAPPY, | |
| SAD, | |
| COLLAPSE, | |
| SHOT_FROM_LEFT, | |
| SHOT_FROM_RIGHT, | |
| WALK_LEFT_ARMED, | |
| WALK_RIGHT_ARMED, | |
| STANDING_ARMED, | |
| DEAD, | |
| FLY_LEFT, | |
| FLY_RIGHT, | |
| FLY_DEAD_LEFT, | |
| FLY_DEAD_RIGHT, | |
| FLY_INJURED_LEFT, | |
| FLY_INJURED_RIGHT, | |
| CARRIED; | |
| } | |
| public CrewType(JSONObject o) { | |
| super(o.getString("name")); | |
| this.doesWork = o.optBoolean("doesWork", false); | |
| this.doesGuard = o.optBoolean("doesGuard", false); | |
| this.canBoard = o.optBoolean("canBoard", false); | |
| commandPointsRequired = o.optInt("commandPointsRequired", 50); | |
| this.crewEffectiveness = o.optDouble("crewEffectiveness", 1); | |
| this.hasHook = o.optBoolean("hasHook", false); | |
| this.supplyCost = o.optDouble("supplyCost", 0); | |
| if (o.has("animLook")) { | |
| this.animLooks = new AnimationAppearance[] { AnimationAppearance.ofName(o.getString("animLook")) }; | |
| } else { | |
| JSONArray lx = o.getJSONArray("animLooks"); | |
| this.animLooks = new AnimationAppearance[lx.length()]; | |
| for (int i = 0; i < animLooks.length; i++) { | |
| this.animLooks[i] = AnimationAppearance.ofName(lx.getString(i)); | |
| } | |
| } | |
| if (o.has("simpleLookImg")) { | |
| this.simpleLook = new Img( | |
| o.getJSONObject("simpleLookImg").getString("src"), | |
| o.getJSONObject("simpleLookImg").getInt("x"), | |
| o.getJSONObject("simpleLookImg").getInt("y"), | |
| o.getJSONObject("simpleLookImg").getInt("w"), | |
| o.getJSONObject("simpleLookImg").getInt("h"), | |
| o.getJSONObject("simpleLookImg").optBoolean("flipped", false) | |
| ); | |
| } else { | |
| this.simpleLook = new Img( | |
| o.getJSONObject("simpleLook").getString("src"), | |
| o.getJSONObject("simpleLook").getInt("x") * AGame.SGS, | |
| o.getJSONObject("simpleLook").getInt("y") * AGame.SGS, | |
| 16, | |
| 16, | |
| false | |
| ); | |
| } | |
| this.maxHP = o.getInt("maxHP"); | |
| this.minWorkingHP = o.getInt("minWorkingHP"); | |
| isMachine = o.optBoolean("isMachine", false); | |
| double ceDiv = Math.max(0.25, crewEffectiveness); | |
| pickupMs = (int) (300 / ceDiv); | |
| insideSpeed = o.optDouble("insideSpeed", 1.0); | |
| reloadSlowdown = o.optDouble("reloadSlowdown", 0.5); | |
| pickupDmgMaxMalus = 3; | |
| pickupFireMult = 1 + 0.5 / ceDiv; | |
| fireSpeedMult = 1 - 0.3 / ceDiv; | |
| dmgWorstSpeedMalus = -0.3; | |
| goingUpSpeedMult = o.optDouble("goingUpSpeedMult", 1); | |
| carrySpeedMult = 1 - 0.2 / ceDiv; | |
| repairTime = (int) (4000 / ceDiv); | |
| if (o.has("shotDamageMin")) { | |
| penDmg = o.getInt("shotDamageMin") + o.optInt("shotDamageRange", 2) / 2; | |
| blastDmg = 0; | |
| directDmg = 0; | |
| } else { | |
| penDmg = o.optInt("penDmg", 0); | |
| blastDmg = o.optInt("blastDmg", 0); | |
| directDmg = o.optInt("directDmg", 0); | |
| } | |
| blastSplashRadius = o.optInt("blastSplashRadius", 0); | |
| weaponReload = BonusableValue.intFromJSONWithDivAndMinAndMax(o, "weaponReload", 1000, 1, 1, 100000); | |
| meleeAttack = o.optBoolean("meleeAttack", false); | |
| sickbayHealPMs = o.optDouble("sickbayHealPMs", 0.00003); | |
| fireHarmPMs = o.optDouble("fireHarmPMs", 0.00005); | |
| hookSpeed = o.optDouble("hookSpeed", 0.5); | |
| winchSpeed = o.optDouble("winchSpeed", 0.1); | |
| hookRopeLength = o.optInt("hookRopeLength", 260); | |
| jumpStrength = o.optDouble("jumpStrength", 0.15); | |
| outsideSpeed = o.optDouble("outsideSpeed", 0.035); | |
| assumedJumpDist = o.optInt("assumedJumpDist", 50); | |
| popOutDelayMin = o.optInt("popOutDelayMin", 0); | |
| popOutDelayRange = o.optInt("popOutDelayRange", 0); | |
| aimTime = o.optInt("aimTime", 500); | |
| explosionSize = o.optDouble("explosionSize", 0); | |
| shouts = o.has("shouts") ? Shouts.ofName(o.getString("shouts")) : null; | |
| if (o.has("hookImg")) { | |
| JSONObject hi = o.getJSONObject("hookImg"); | |
| hookImg = new Img(hi.getString("src"), hi.getInt("x"), hi.getInt("y"), hi.getInt("w"), hi.getInt("h"), hi.optBoolean("flipped", false)); | |
| } else { | |
| hookImg = null; | |
| } | |
| hookRopeWidth = o.optDouble("hookRopeWidth", 1); | |
| if (o.has("deathSnd")) { | |
| SoundEffect se = null; | |
| try { | |
| se = new SoundEffect(o.getString("deathSnd"), o.optInt("numDeathSnds", 1)); | |
| } catch (Exception e) { | |
| se = new SoundEffect(o.getJSONObject("deathSnd")); | |
| } | |
| deathSnd = se; | |
| } else { | |
| deathSnd = null; | |
| } | |
| if (o.has("coughSnd")) { | |
| SoundEffect se = null; | |
| try { | |
| se = new SoundEffect(o.getString("coughSnd"), o.optInt("numCoughSnds", 1)); | |
| } catch (Exception e) { | |
| se = new SoundEffect(o.getJSONObject("coughSnd")); | |
| } | |
| coughSnd = se; | |
| } else { | |
| coughSnd = null; | |
| } | |
| if (o.has("hookLaunchSnd")) { | |
| SoundEffect se = null; | |
| try { | |
| se = new SoundEffect(o.getString("hookLaunchSnd"), o.optInt("numHookLaunchSnds", 1)); | |
| } catch (Exception e) { | |
| se = new SoundEffect(o.getJSONObject("hookLaunchSnd")); | |
| } | |
| hookLaunchSnd = se; | |
| } else { | |
| hookLaunchSnd = null; | |
| } | |
| if (o.has("hookHitSnd")) { | |
| SoundEffect se = null; | |
| try { | |
| se = new SoundEffect(o.getString("hookHitSnd"), o.optInt("numHookHitSnds", 1)); | |
| } catch (Exception e) { | |
| se = new SoundEffect(o.getJSONObject("hookHitSnd")); | |
| } | |
| hookHitSnd = se; | |
| } else { | |
| hookHitSnd = null; | |
| } | |
| if (o.has("attackSnd")) { | |
| SoundEffect se = null; | |
| try { | |
| se = new SoundEffect(o.getString("attackSnd"), o.optInt("numAttackSnds", 1)); | |
| } catch (Exception e) { | |
| se = new SoundEffect(o.getJSONObject("attackSnd")); | |
| } | |
| attackSnd = se; | |
| } else { | |
| attackSnd = null; | |
| } | |
| bloodParticle = o.has("bloodParticle") | |
| ? ParticleType.ofName(o.getString("bloodParticle")) | |
| : null; | |
| bloodParticleExternal = o.has("bloodParticleExternal") | |
| ? ParticleType.ofName(o.getString("bloodParticleExternal")) | |
| : null; | |
| attackParticle = o.has("attackParticle") | |
| ? ParticleType.ofName(o.getString("attackParticle")) | |
| : null; | |
| shootsShips = o.optBoolean("shootsShips", false); | |
| strafeOvershoot = o.optInt("strafeOvershoot", AGame.SGS * 8); | |
| if (o.has("recolorOriginalA")) { | |
| recolorOriginalA = new float[] { | |
| o.getJSONObject("recolorOriginalA").getInt("r") / 255f, | |
| o.getJSONObject("recolorOriginalA").getInt("g") / 255f, | |
| o.getJSONObject("recolorOriginalA").getInt("b") / 255f | |
| }; | |
| recolorReplacementA = RecolorReplacement.valueOf(o.getString("recolorReplacementA")); | |
| } else { | |
| recolorOriginalA = NO_COLOUR; | |
| recolorReplacementA = RecolorReplacement.COA_1; | |
| } | |
| if (o.has("recolorOriginalB")) { | |
| recolorOriginalB = new float[] { | |
| o.getJSONObject("recolorOriginalB").getInt("r") / 255f, | |
| o.getJSONObject("recolorOriginalB").getInt("g") / 255f, | |
| o.getJSONObject("recolorOriginalB").getInt("b") / 255f | |
| }; | |
| recolorReplacementB = RecolorReplacement.valueOf(o.getString("recolorReplacementB")); | |
| } else { | |
| recolorOriginalB = NO_COLOUR; | |
| recolorReplacementB = RecolorReplacement.COA_1; | |
| } | |
| if (o.has("shot")) { | |
| JSONObject so = o.getJSONObject("shot"); | |
| shot = new Img(so.getString("src"), so.getInt("x"), so.getInt("y"), so.getInt("w"), so.getInt("h"), so.optBoolean("flipped")); | |
| } else { | |
| shot = null; | |
| } | |
| inaccuracy = o.optDouble("inaccuracy", 0.005); | |
| maxRange = o.optDouble("maxRange", 500); | |
| barrelX = o.optInt("barrelX", 18); | |
| barrelY = o.optInt("barrelY", 4); | |
| shotSpeed = o.optDouble("shotSpeed", 0.7); | |
| missExplosionSize = o.optDouble("missExplosionSize", 0); | |
| hitExplosionSize = o.optDouble("hitExplosionSize", 0); | |
| returnToRepairHP = o.optInt("returnToRepairHP", 0); | |
| msPerHPRepaired = o.optInt("msPerHPRepaired", 0); | |
| shootTroopsRange = o.optInt("shootTroopsRange", 0); | |
| interceptTroops = o.optBoolean("interceptTroops", false); | |
| canWalk = o.optBoolean("canWalk", true); | |
| canFly = o.optBoolean("canFly", false); | |
| autoAcquireNewBoardTarget = o.optBoolean("autoAcquireNewBoardTarget", false); | |
| if (o.has("shotEmitter")) { | |
| JSONObject em = o.getJSONObject("shotEmitter"); | |
| SoundEffect ef = null; | |
| if (em.has("sound")) { | |
| try { | |
| String sound = em.getString("sound"); | |
| ef = new SoundEffect(sound, em.optDouble("volume")); | |
| } catch (Exception e) { | |
| ef = new SoundEffect(em.getJSONObject("sound")); | |
| } | |
| } | |
| shotEmitter = new Particle.Emitter( | |
| ParticleType.ofName(em.getString("type")), | |
| em.getDouble("emitProbability"), | |
| em.optInt("numParticles", 1), | |
| ef); | |
| } else { | |
| shotEmitter = null; | |
| } | |
| if (o.has("exhaust")) { | |
| JSONObject e = o.getJSONObject("exhaust"); | |
| exhaust = new WeaponAppearance.ShotExhaustEmitter( | |
| ParticleType.ofName(e.getString("type")), | |
| e.getDouble("p"), | |
| e.getDouble("backOffset"), | |
| e.getDouble("angleRange"), | |
| e.getDouble("randomOffset"), | |
| e.getDouble("speedMin"), | |
| e.getDouble("speedMax") | |
| ); | |
| } else { | |
| exhaust = null; | |
| } | |
| if (canFly) { | |
| crashesOnDeath = o.optBoolean("crashesOnDeath", false); | |
| bombs = o.optBoolean("bombs", false); | |
| airXTopSpeed = o.getDouble("airXTopSpeed"); | |
| airUpTopSpeed = o.getDouble("airUpTopSpeed"); | |
| airDownTopSpeed = o.getDouble("airDownTopSpeed"); | |
| airXAcceleration = o.getDouble("airXAcceleration"); | |
| airUpAcceleration = o.getDouble("airUpAcceleration"); | |
| airDownAcceleration = o.getDouble("airDownAcceleration"); | |
| launchMinXSpeed = o.getDouble("launchMinXSpeed"); | |
| launchMaxXSpeed = o.getDouble("launchMaxXSpeed"); | |
| launchMinYSpeed = o.getDouble("launchMinYSpeed"); | |
| launchMaxYSpeed = o.getDouble("launchMaxYSpeed"); | |
| airOvershoot = o.getDouble("airOvershoot"); | |
| launchLength = o.optInt("launchLength", 0); | |
| airXMinSpeed = o.optDouble("airXMinSpeed", 0); | |
| aimForCenter = o.optBoolean("aimForCenter"); | |
| ammoCapacity = o.optInt("ammoCapacity", 0); | |
| rearmTime = o.optInt("rearmTime", 0); | |
| guardRange = o.optInt("guardRange", 40 * AGame.SGS); | |
| if (o.has("launchSnd")) { | |
| SoundEffect se = null; | |
| try { | |
| se = new SoundEffect(o.getString("launchSnd"), o.optInt("numLaunchSnds", 1)); | |
| } catch (Exception e) { | |
| se = new SoundEffect(o.getJSONObject("launchSnd")); | |
| } | |
| launchSnd = se; | |
| } else { | |
| launchSnd = null; | |
| } | |
| } else { | |
| crashesOnDeath = false; | |
| airXTopSpeed = 0; | |
| airUpTopSpeed = 0; | |
| airDownTopSpeed = 0; | |
| airXAcceleration = 0; | |
| airUpAcceleration = 0; | |
| airDownAcceleration = 0; | |
| launchMinXSpeed = 0; | |
| launchMaxXSpeed = 0; | |
| launchMinYSpeed = 0; | |
| launchMaxYSpeed = 0; | |
| airOvershoot = 0; | |
| launchSnd = null; | |
| launchLength = 0; | |
| airXMinSpeed = 0; | |
| bombs = false; | |
| aimForCenter = false; | |
| ammoCapacity = 0; | |
| rearmTime = 0; | |
| guardRange = 0; | |
| } | |
| } | |
| public DecalCategory(JSONObject o) { | |
| super(o.getString("name"), o.optInt("sort", 0)); | |
| } | |
| public DecalType(JSONObject o) { | |
| super(o.getString("name"), o.optInt("sort", 0)); | |
| w = o.getInt("w"); | |
| h = o.getInt("h"); | |
| availableTextWidth = o.optInt("availableTextWidth", w * AGame.SGS - 8); | |
| flippedName = o.optString("flippedVersion", null); | |
| verticalFlippedName = o.optString("verticallyFlippedVersion", null); | |
| if (o.has("variants")) { | |
| JSONArray a = o.getJSONArray("variants"); | |
| for (int i = 0; i < a.length(); i++) { | |
| variantNames.add(a.getString(i)); | |
| } | |
| } | |
| if (o.has("variantType")) { | |
| variantType = VariantType.ofName(o.getString("variantType")); | |
| } else { | |
| variantType = VariantType.getDefault(); | |
| } | |
| if (o.has("categories")) { | |
| JSONArray cats = o.getJSONArray("categories"); | |
| for (int i = 0; i < cats.length(); i++) { | |
| categories.add(DecalCategory.ofName(cats.getString(i))); | |
| } | |
| } | |
| if (o.has("appearances")) { | |
| JSONArray a = o.getJSONArray("appearances"); | |
| for (int i = 0; i < a.length(); i++) { | |
| apps.add(new TintedApp(a.getJSONObject(i))); | |
| } | |
| } | |
| flipWithShip = o.optBoolean("flipWithShip", false); | |
| nameDetails = o.has("shipName") ? new NameDetails(o.getJSONObject("shipName")) : null; | |
| armsDetails = o.has("arms") ? new ArmsDetails(o.getJSONObject("arms")) : null; | |
| chargeDetails = o.has("charge") ? new ChargeDetails(o.getJSONObject("charge")) : null; | |
| if (o.has("flag")) { | |
| flag = new FlagSpec(o.getJSONObject("flag")); | |
| } else { | |
| flag = null; | |
| } | |
| if (o.has("subColor")) { | |
| JSONObject co = o.getJSONObject("subColor"); | |
| this.subColor = new Clr(co.getInt("r"), co.getInt("g"), co.getInt("b")); | |
| if (o.has("subBaseColor")) { | |
| JSONObject bco = o.getJSONObject("subBaseColor"); | |
| this.subBaseColor = new Clr(bco.getInt("r"), bco.getInt("g"), bco.getInt("b")); | |
| } else { | |
| this.subBaseColor = subColor; | |
| } | |
| ArrayList<PaintType> ps = PaintType.values(); | |
| subColorByPaintTypeIndex = new Clr[ps.size()]; | |
| for (int i = 0; i < ps.size(); i++) { | |
| Clr tc = ps.get(i).getBaseTint(); | |
| subColorByPaintTypeIndex[i] = new Clr( | |
| subBaseColor.r * (255 - tc.a) / 255 + tc.r * tc.a / 255, | |
| subBaseColor.g * (255 - tc.a) / 255 + tc.g * tc.a / 255, | |
| subBaseColor.b * (255 - tc.a) / 255 + tc.b * tc.a / 255 | |
| ); | |
| } | |
| } | |
| if (!apps.isEmpty() && !apps.get(0).app.frames.isEmpty()) { | |
| imgW = apps.get(0).app.frames.get(0).srcWidth / AGame.SGS; | |
| } else { | |
| imgW = w; | |
| } | |
| if (o.has("lights")) { | |
| JSONArray a = o.getJSONArray("lights"); | |
| for (int i = 0; i < a.length(); i++) { | |
| JSONObject l = a.getJSONObject(i); | |
| lights.add(new DecalLightSource( | |
| new Clr(l.getInt("r"), l.getInt("g"), l.getInt("b")), | |
| l.getInt("radius"), | |
| l.getDouble("x"), | |
| l.getDouble("y"))); | |
| } | |
| } | |
| } | |
| public ArmourType(JSONObject o) { | |
| super(o.getString("name"), o.optInt("sort", 0)); | |
| windowApp = BonusableValue.objectFromJSON(o, "windowApp", null, new Appearance.FromJSON()); | |
| damagedApps = BonusableValue.listFromJSONRequired(o, "damagedApps", new Appearance.FromJSON()); | |
| required = o.has("required") ? Bonus.ofNameOrNull(o.getString("required")) : null; | |
| placeSound = o.optString("placeSound", null); | |
| placePitch = o.optDouble("placePitch", 1.0); | |
| cost = BonusableValue.intFromJSON(o, "cost", 0); | |
| hp = BonusableValue.intFromJSON(o, "hp", 1); | |
| weight = BonusableValue.intFromJSON(o, "weight", 0); | |
| blastDmgAbsorb = BonusableValue.intFromJSON(o, "blastDmgAbsorb", 0); | |
| penDmgAbsorb = BonusableValue.intFromJSON(o, "penDmgAbsorb", 0); | |
| hidden = o.optBoolean("hidden", false); | |
| brokenSound = BonusableValue.objectFromJSON(o, "brokenSound", null, new SoundEffect.FromJSON(false)); | |
| largeHitSound = BonusableValue.objectFromJSON(o, "largeHitSound", null, new SoundEffect.FromJSON(false)); | |
| smallHitSound = BonusableValue.objectFromJSON(o, "smallHitSound", null, new SoundEffect.FromJSON(false)); | |
| lift = BonusableValue.intFromJSON(o, "lift", 0); | |
| enterable = o.optBoolean("enterable", false); | |
| fragments = BonusableValue.derive(damagedApps, new BonusableValue.Derive<ArrayList<Appearance>, ArrayList<ModuleType.FragmentImg>[][]>() { | |
| @Override | |
| public ArrayList<ModuleType.FragmentImg>[][] derive(ArrayList<Appearance> from) { | |
| return new ArrayList[5][5]; | |
| } | |
| }); | |
| if (o.has("variants")) { | |
| JSONArray a = o.getJSONArray("variants"); | |
| for (int i = 0; i < a.length(); i++) { | |
| variantNames.add(a.getString(i)); | |
| } | |
| } | |
| if (o.has("variantType")) { | |
| variantType = VariantType.ofName(o.getString("variantType")); | |
| } else { | |
| variantType = VariantType.getDefault(); | |
| } | |
| } | |
| public ModuleCategory(JSONObject o) { | |
| super(o.getString("name"), o.optInt("sort", 0)); | |
| } | |
| public ModuleType(JSONObject o) { | |
| super(o.getString("name"), o.optInt("sort", 0)); | |
| isTargetComp = o.getString("name").equals("TARGETING_COMPUTER"); // qqDPS This is terrible | |
| if (o.has("flippedFrom")) { | |
| flippedFrom = o.getString("flippedFrom"); | |
| return; // Everything else is handled in post-load. | |
| } | |
| verticallyFlippedVersionName = o.optString("verticallyFlippedVersion", null); | |
| if (o.has("variants")) { | |
| JSONArray a = o.getJSONArray("variants"); | |
| variantNames.add(name); | |
| for (int i = 0; i < a.length(); i++) { | |
| variantNames.add(a.getString(i)); | |
| } | |
| } | |
| if (o.has("variantType")) { | |
| variantType = VariantType.ofName(o.getString("variantType")); | |
| } else { | |
| variantType = VariantType.getDefault(); | |
| } | |
| w = o.getInt("w"); | |
| h = o.getInt("h"); | |
| app = BonusableValue.objectFromJSONRequired(o, "appearance", new Appearance.FromJSON()); | |
| appFragments = BonusableValue.derive(app, new BonusableValue.Derive<Appearance, ArrayList<ArrayList<FragmentImg>>>() { | |
| @Override | |
| public ArrayList<ArrayList<FragmentImg>> derive(Appearance from) { | |
| return new ArrayList<ArrayList<FragmentImg>>(); | |
| } | |
| }); | |
| appWreckage = BonusableValue.derive(app, new BonusableValue.Derive<Appearance, ArrayList<ArrayList<FragmentImg>>>() { | |
| @Override | |
| public ArrayList<ArrayList<FragmentImg>> derive(Appearance from) { | |
| return new ArrayList<ArrayList<FragmentImg>>(); | |
| } | |
| }); | |
| TileMask[][] defaultTMs = new TileMask[h][w]; | |
| for (int y = 0; y < h; y++) { | |
| for (int x = 0; x < w; x++) { | |
| defaultTMs[y][x] = TileMask.FULL; | |
| } | |
| } | |
| tileMasks = BonusableValue.objectFromJSON(o, "mask", defaultTMs, new BonusableValue.FromJSON<TileMask[][]>() { | |
| @Override | |
| public TileMask[][] construct(JSONObject o, BonusSet b) { | |
| TileMask[][] tms = new TileMask[h][w]; | |
| String src = app.get(b).spritesheetBundle.name; | |
| int mx = o.getInt("x"); | |
| int my = o.getInt("y"); | |
| if (!MASKCACHE.containsKey(src)) { | |
| MASKCACHE.put(src, SpriteUtils.loadBufferedImage(src)); | |
| } | |
| BufferedImage img = MASKCACHE.get(src); | |
| for (int y = 0; y < h; y++) { | |
| for (int x = 0; x < w; x++) { | |
| tms[y][x] = TileMask.fromImage(img, (mx + x) * AGame.SGS, (my + y) * AGame.SGS); | |
| } | |
| } | |
| return tms; | |
| } | |
| }); | |
| if (!o.optBoolean("external", false)) { | |
| armourMask = BonusableValue.objectFromJSON(o, "mask", null, new BonusableValue.FromJSON<Img>() { | |
| @Override | |
| public Img construct(JSONObject o, BonusSet b) { | |
| String src = app.get(b).spritesheetBundle.name; | |
| int mx = o.getInt("x"); | |
| int my = o.getInt("y"); | |
| return new Img(src, mx * AGame.SGS, my * AGame.SGS, w * AGame.SGS, h * AGame.SGS, false); | |
| } | |
| }); | |
| } else { | |
| armourMask = BonusableValue.of(null); | |
| } | |
| drawAppearanceInside = o.optBoolean("drawAppearanceInside", true); | |
| for (int x = 0; x < w; x++) { | |
| canOccupy.add(p(x, h - 1)); | |
| } | |
| if (o.has("canOccupy")) { | |
| canOccupy.clear(); | |
| if (o.optBoolean("canOccupy")) { | |
| for (int y = 0; y < h; y++) { | |
| for (int x = 0; x < w; x++) { | |
| canOccupy.add(p(x, y)); | |
| } | |
| } | |
| } else { | |
| JSONArray ws = o.getJSONArray("canOccupy"); | |
| for (int i = 0; i < ws.length(); i++) { | |
| canOccupy.add(new Pair<Integer, Integer>( | |
| ws.getJSONObject(i).getInt("x"), ws.getJSONObject(i).getInt("y"))); | |
| } | |
| } | |
| } | |
| leftDoors = new boolean[h]; leftDoors[h - 1] = true; | |
| rightDoors = new boolean[h]; rightDoors[h - 1] = true; | |
| upDoors = new boolean[w]; | |
| frontOnly = new boolean[h]; | |
| backOnly = new boolean[h]; | |
| topOnly = new boolean[w]; | |
| bottomOnly = new boolean[w]; | |
| JSONArray cats = o.getJSONArray("categories"); | |
| for (int i = 0; i < cats.length(); i++) { | |
| categories.add(ModuleCategory.ofName(cats.getString(i))); | |
| } | |
| hp = BonusableValue.intFromJSON(o, "hp", 100); | |
| destroyedHP = BonusableValue.intFromJSON(o, "destroyedHP", -hp.get(BonusSet.empty()) / 2); | |
| destructionLength = BonusableValue.intFromJSON(o, "destructionLength", 0); | |
| instantlyDestroyed = o.optBoolean("instantlyDestroyed", false); | |
| destroyEntireShipOnDestruction = o.optBoolean("destroyEntireShipOnDestruction", false); | |
| fireHP = BonusableValue.intFromJSON(o, "fireHP", 0); | |
| explodeHP = BonusableValue.intFromJSON(o, "explodeHP", -1); | |
| explodeDmg = BonusableValue.intFromJSON(o, "explodeDmg", 0); | |
| explodeRadius = BonusableValue.derive(explodeDmg, new BonusableValue.Derive<Integer, Integer>() { | |
| @Override | |
| public Integer derive(Integer from) { | |
| return from == 0 ? 0 : (int) StrictMath.floor(30 + StrictMath.sqrt(from * 2.5)); | |
| } | |
| }); | |
| explodeFuzeLength = BonusableValue.intFromJSON(o, "explodeFuzeLength", 1500); | |
| hasGenericDestructionFragments = o.optBoolean("hasGenericDestructionFragments", true); | |
| destructionParticle = BonusableValue.loadableFromJSON(o, "destructionParticle", ParticleType.ofName("big_smoke"), ParticleType.class); | |
| destructionParticleDensity = BonusableValue.doubleFromJSON(o, "destructionParticleDensity", 0.3); | |
| aiMaxY = o.optInt("aiMaxY", 10000); | |
| canGivePlaneCommands = BonusableValue.booleanFromJSON(o, "canGivePlaneCommands", false); | |
| if (o.has("destructionSound")) { | |
| try { | |
| destructionSound = BonusableValue.of(new SoundEffect(o.getString("destructionSound"), o.optInt("numDestructionSounds", 1), o.optDouble("destructionSoundVolume", 1.0))); | |
| } catch (Exception e) { | |
| destructionSound = BonusableValue.objectFromJSON(o, "destructionSound", null, new SoundEffect.FromJSON(false)); | |
| } | |
| } | |
| hitParticle = BonusableValue.loadableFromJSON(o, "hitParticle", null, ParticleType.class); | |
| fragmentsSpeedMult = o.optDouble("fragmentsSpeedMult", 1.0); | |
| fragmentsFireMult = o.optDouble("fragmentsFireMult", 1.0); | |
| fragmentsDensity = o.optDouble("fragmentsDensity", 0.5); | |
| runningLoop = BonusableValue.objectFromJSON(o, "runningLoop", null, new SoundEffect.FromJSON(true)); | |
| msUntilPlayLoop = BonusableValue.intFromJSON(o, "msUntilPlayLoop", 80); | |
| moveDelay = BonusableValue.intFromJSONWithDivAndMinAndMax(o, "moveDelay", 800, 1, 10, 10000); | |
| weight = BonusableValue.intFromJSON(o, "weight", 100); | |
| firedWeightDecrease = BonusableValue.intFromJSON(o, "firedWeightDecrease", 0); | |
| coal = BonusableValue.intFromJSON(o, "coal", 0); | |
| ammo = BonusableValue.intFromJSON(o, "ammo", 0); | |
| sickbay = BonusableValue.intFromJSON(o, "sickbay", 0); | |
| necromancy = BonusableValue.booleanFromJSON(o, "necromancy", false); | |
| repair = BonusableValue.intFromJSON(o, "repair", 0); | |
| water = BonusableValue.intFromJSON(o, "water", 0); | |
| quarters = isOccupable() ? BonusableValue.intFromJSON(o, "quarters", 0) : BonusableValue.of(0); | |
| countsAsActiveCrew = o.optBoolean("countsAsActiveCrew", false); | |
| preventsBoarding = o.optBoolean("preventsBoarding", false); | |
| preventsSurrender = o.optBoolean("preventsSurrender", false); | |
| if (isOccupable()) { | |
| quartersType = BonusableValue.loadableFromJSON(o, "quartersType", null, CrewType.class); | |
| } else { | |
| quartersType = BonusableValue.of(null); | |
| quarters = BonusableValue.of(0); | |
| } | |
| command = BonusableValue.intFromJSON(o, "command", 0); | |
| extraCommandPointsRequired = BonusableValue.intFromJSON(o, "extraCommandPointsRequired", 0); | |
| shipwideModifiers.put("fleetCommandBonus", new ShipwideModifier("fleetCommandBonus", o, "fleetCommandBonus", 0)); | |
| lift = BonusableValue.intFromJSON(o, "lift", 0); | |
| propulsion = BonusableValue.doubleFromJSON(o, "propulsion", 0); | |
| coalReload = BonusableValue.intFromJSON(o, "coalReload", 0); | |
| crew = isOccupable() ? BonusableValue.intFromJSON(o, "crew", 0) : BonusableValue.of(0); | |
| optionalCrew = isOccupable() ? BonusableValue.intFromJSON(o, "optionalCrew", 0) : BonusableValue.of(0); | |
| recommendedCrew = isOccupable() ? BonusableValue.intFromJSON(o, "recommendedCrew", 0) : BonusableValue.of(0); | |
| recommendedGuards = isOccupable() ? BonusableValue.intFromJSON(o, "recommendedGuards", 0) : BonusableValue.of(0); | |
| fixedGuards = isOccupable() ? BonusableValue.intFromJSON(o, "fixedGuards", 0) : BonusableValue.of(0); | |
| cost = BonusableValue.intFromJSON(o, "cost", 0); | |
| maintenanceCost = BonusableValue.intFromJSON(o, "maintenanceCost", 0); | |
| shipHPBonus = BonusableValue.intFromJSON(o, "shipHPBonus", 0); | |
| shipwideModifiers.put("accuracyBonus", new ShipwideModifier("accuracyBonus", o, "accuracyBonus", 0)); | |
| shipwideModifiers.put("planeRepairBonus", new ShipwideModifier("planeRepairBonus", o, "planeRepairBonus", 0)); | |
| shipwideModifiers.put("planeRearmBonus", new ShipwideModifier("planeRearmBonus", o, "planeRearmBonus", 0)); | |
| shipwideModifiers.put("planeLaunchSpeedBonus", new ShipwideModifier("planeLaunchSpeedBonus", o, "planeLaunchSpeedBonus", 0)); | |
| isWeapon = o.optBoolean("isWeapon", false); | |
| isRam = o.optBoolean("isRam", false); | |
| isSail = o.optBoolean("isSail", false); | |
| framesAreVariants = o.optBoolean("framesAreVariants", false); | |
| doesCreak = o.optBoolean("doesCreak", true); | |
| adjacencyBonusStrength = BonusableValue.doubleFromJSON(o, "adjacencyBonusStrength", 1.0); | |
| structuralStressAmount = o.has("structuralStressAmount") ? BonusableValue.intFromJSON(o, "structuralStressAmount", 0) : weight; | |
| hardness = BonusableValue.doubleFromJSON(o, "hardness", 1.0); | |
| collisionDamageReceivedMult = BonusableValue.doubleFromJSON(o, "collisionDamageReceivedMult", 1.0); | |
| canParticlesStick = o.optBoolean("canParticlesStick", true); | |
| createsExceptionalCombatEventAfterMs = o.optInt("createsExceptionalCombatEventAfterMs", 0); | |
| producesHorizontalDrag = o.optBoolean("producesHorizontalDrag", true); | |
| playDestructionSoundAtStartOfDestruction = o.optBoolean("playDestructionSoundAtStartOfDestruction", false); | |
| runsWhenDestroyed = o.optBoolean("runsWhenDestroyed", false); | |
| extraVerticalAirFriction = o.optDouble("extraVerticalAirFriction", 0); | |
| if (o.has("providesBonus")) { | |
| providesBonus = Bonus.ofName(o.getString("providesBonus")); | |
| } | |
| providesBonusWhenDestroyed = o.optBoolean("providesBonusWhenDestroyed", false); | |
| if (o.has("availableFor")) { | |
| availableFor.clear(); | |
| JSONArray af = o.getJSONArray("availableFor"); | |
| for (int i = 0; i < af.length(); i++) { | |
| availableFor.add(ShipType.valueOf(af.getString(i))); | |
| } | |
| } | |
| if (o.has("windows")) { | |
| JSONArray ws = o.getJSONArray("windows"); | |
| for (int i = 0; i < ws.length(); i++) { | |
| windows.add(new Pair<Integer, Integer>( | |
| ws.getJSONObject(i).getInt("x"), ws.getJSONObject(i).getInt("y"))); | |
| } | |
| } | |
| if (o.has("hangarPositions")) { | |
| JSONArray ws = o.getJSONArray("hangarPositions"); | |
| for (int i = 0; i < ws.length(); i++) { | |
| hangarPositions.add(new Pair<Integer, Integer>( | |
| ws.getJSONObject(i).getInt("x"), ws.getJSONObject(i).getInt("y"))); | |
| } | |
| } | |
| emitters = BonusableValue.listFromJSON(o, "emitters", new ArrayList<ModuleParticleEmitter>(), new ModuleParticleEmitter.FromJSON()); | |
| damagedEmitters = BonusableValue.listFromJSON(o, "damagedEmitters", new ArrayList<ModuleParticleEmitter>(), new ModuleParticleEmitter.FromJSON()); | |
| destroyedEmitters = BonusableValue.listFromJSON(o, "destroyedEmitters", new ArrayList<ModuleParticleEmitter>(), new ModuleParticleEmitter.FromJSON()); | |
| externalApps = BonusableValue.listFromJSON(o, "externalAppearances", new ArrayList<ExternalApp>(), new ExternalApp.FromJSON()); | |
| damagedExternalApps = o.has("damagedExternalAppearances") ? BonusableValue.listFromJSON(o, "damagedExternalAppearances", new ArrayList<ExternalApp>(), new ExternalApp.FromJSON()) : null; | |
| destroyedExternalApps = o.has("destroyedExternalAppearances") ? BonusableValue.listFromJSON(o, "destroyedExternalAppearances", new ArrayList<ExternalApp>(), new ExternalApp.FromJSON()) : null; | |
| depletedResourceApps = BonusableValue.listFromJSON(o, "depletedResourceAppearances", new ArrayList<Appearance>(), new Appearance.FromJSON()); | |
| externalFragments = BonusableValue.derive(externalApps, new BonusableValue.Derive<ArrayList<ExternalApp>, ArrayList<ArrayList<ArrayList<FragmentImg>>>>() { | |
| @Override | |
| public ArrayList<ArrayList<ArrayList<FragmentImg>>> derive(ArrayList<ExternalApp> from) { | |
| return new ArrayList<ArrayList<ArrayList<FragmentImg>>>(); | |
| } | |
| }); | |
| if (o.has("externalSubColor")) { | |
| JSONObject co = o.getJSONObject("externalSubColor"); | |
| this.externalSubColor = new Clr(co.getInt("r"), co.getInt("g"), co.getInt("b")); | |
| if (o.has("externalSubBaseColor")) { | |
| JSONObject bco = o.getJSONObject("externalSubBaseColor"); | |
| this.externalSubBaseColor = new Clr(bco.getInt("r"), bco.getInt("g"), bco.getInt("b")); | |
| } else { | |
| this.externalSubBaseColor = externalSubColor; | |
| } | |
| ArrayList<PaintType> ps = PaintType.values(); | |
| externalSubColorByPaintIndex = new Clr[ps.size()]; | |
| for (int i = 0; i < ps.size(); i++) { | |
| Clr tc = ps.get(i).getBaseTint(); | |
| externalSubColorByPaintIndex[i] = new Clr( | |
| externalSubBaseColor.r * (255 - tc.a) / 255 + tc.r * tc.a / 255, | |
| externalSubBaseColor.g * (255 - tc.a) / 255 + tc.g * tc.a / 255, | |
| externalSubBaseColor.b * (255 - tc.a) / 255 + tc.b * tc.a / 255 | |
| ); | |
| } | |
| } | |
| if (o.has("leftDoors")) { | |
| if (o.optBoolean("leftDoors")) { | |
| for (int y = 0; y < h; y++) { | |
| leftDoors[y] = canOccupy(0, y); | |
| } | |
| } else { | |
| JSONArray ds = o.getJSONArray("leftDoors"); | |
| leftDoors[h - 1] = false; | |
| for (int i = 0; i < ds.length(); i++) { | |
| leftDoors[ds.getInt(i)] = true; | |
| } | |
| } | |
| } | |
| if (o.has("rightDoors")) { | |
| if (o.optBoolean("rightDoors")) { | |
| for (int y = 0; y < h; y++) { | |
| rightDoors[y] = canOccupy(w - 1, y); | |
| } | |
| } else { | |
| JSONArray ds = o.getJSONArray("rightDoors"); | |
| rightDoors[h - 1] = false; | |
| for (int i = 0; i < ds.length(); i++) { | |
| rightDoors[ds.getInt(i)] = true; | |
| } | |
| } | |
| } | |
| if (o.has("upDoors")) { | |
| if (o.optBoolean("upDoors")) { | |
| for (int x = 0; x < w; x++) { | |
| upDoors[x] = canOccupy(x, 0); | |
| } | |
| } else { | |
| JSONArray ds = o.getJSONArray("upDoors"); | |
| for (int i = 0; i < ds.length(); i++) { | |
| upDoors[ds.getInt(i)] = true; | |
| } | |
| } | |
| } | |
| if (o.optBoolean("frontOnly", false)) { | |
| for (int i = 0; i < rightDoors.length; i++) { | |
| rightDoors[i] = false; | |
| frontOnly[i] = true; | |
| } | |
| } | |
| if (o.optBoolean("backOnly", false)) { | |
| for (int i = 0; i < leftDoors.length; i++) { | |
| leftDoors[i] = false; | |
| backOnly[i] = true; | |
| } | |
| } | |
| if (o.optBoolean("bottomOnly", false)) { | |
| for (int i = 0; i < bottomOnly.length; i++) { | |
| bottomOnly[i] = true; | |
| } | |
| } | |
| if (o.optBoolean("topOnly", false)) { | |
| for (int i = 0; i < upDoors.length; i++) { | |
| upDoors[i] = false; | |
| topOnly[i] = true; | |
| } | |
| } | |
| if (o.has("frontOnlyList")) { | |
| JSONArray l = o.getJSONArray("frontOnlyList"); | |
| for (int i = 0; i < l.length(); i++) { | |
| frontOnly[l.getInt(i)] = true; | |
| } | |
| } | |
| if (o.has("backOnlyList")) { | |
| JSONArray l = o.getJSONArray("backOnlyList"); | |
| for (int i = 0; i < l.length(); i++) { | |
| backOnly[l.getInt(i)] = true; | |
| } | |
| } | |
| if (o.has("bottomOnlyList")) { | |
| JSONArray l = o.getJSONArray("bottomOnlyList"); | |
| for (int i = 0; i < l.length(); i++) { | |
| bottomOnly[l.getInt(i)] = true; | |
| } | |
| } | |
| if (o.has("topOnlyList")) { | |
| JSONArray l = o.getJSONArray("topOnlyList"); | |
| for (int i = 0; i < l.length(); i++) { | |
| topOnly[l.getInt(i)] = true; | |
| } | |
| } | |
| if (o.has("required")) { | |
| required = Bonus.ofNameOrNull(o.getString("required")); | |
| } | |
| external = o.optBoolean("external", false); | |
| if (o.has("armourType")) { | |
| armourType = ArmourType.ofName(o.getString("armourType")); | |
| } | |
| drawDoors = o.optBoolean("drawDoors", true); | |
| if (o.optBoolean("externalDrawPriority", false)) { | |
| externalDrawPriority = 2; | |
| } | |
| if (o.optBoolean("drawExternalsBelowDecals", false)) { | |
| externalDrawPriority = 0; | |
| } | |
| drawExternalsWhenInside = o.optBoolean("drawExternalsWhenInside", false); | |
| supplyProvided = BonusableValue.intFromJSON(o, "supplyProvided", 0); | |
| if (o.has("springs")) { | |
| JSONArray ss = o.getJSONArray("springs"); | |
| for (int i = 0; i < ss.length(); i++) { | |
| JSONObject s = ss.getJSONObject(i); | |
| springs.add(new Spring( | |
| s.getDouble("xOffset"), | |
| s.getInt("length"), | |
| s.getInt("minCompressedLength"), | |
| s.getDouble("k"), | |
| s.optDouble("xFriction", 0.002), | |
| s.optDouble("yFriction", 0.003) | |
| )); | |
| } | |
| } | |
| if (o.has("wheels")) { | |
| JSONArray ws = o.getJSONArray("wheels"); | |
| for (int i = 0; i < ws.length(); i++) { | |
| JSONObject wh = ws.getJSONObject(i); | |
| wheelSpecs.add(new Wheel.Spec( | |
| wh.getDouble("xOffset"), | |
| wh.getDouble("maxYOffset"), | |
| wh.getDouble("radius"), | |
| img(wh.getJSONObject("wheel")), | |
| img(wh.getJSONObject("lowerLink")), | |
| img(wh.getJSONObject("upperLink")), | |
| wh.getDouble("segmentStride") | |
| )); | |
| } | |
| } | |
| if (o.has("legs")) { | |
| JSONArray ls = o.getJSONArray("legs"); | |
| for (int i = 0; i < ls.length(); i++) { | |
| JSONObject l = ls.getJSONObject(i); | |
| JSONObject s = l.getJSONObject("spring"); | |
| Spring spr = new Spring( | |
| s.getDouble("xOffset"), | |
| s.getInt("length"), | |
| s.getInt("minCompressedLength"), | |
| s.getDouble("k"), | |
| s.optDouble("xFriction", 0.004), | |
| s.optDouble("yFriction", 0.005) | |
| ); | |
| SoundEffect beginStepSoundEffect = null; | |
| if (l.has("beginStepSound")) { | |
| try { | |
| beginStepSoundEffect = new SoundEffect(l.getString("beginStepSound"), l.optInt("numBeginStepSounds", 1), l.optDouble("beginStepSoundVolume", 1.0)); | |
| } catch (Exception e) { | |
| beginStepSoundEffect = new SoundEffect(l.getJSONObject("beginStepSound")); | |
| } | |
| } | |
| SoundEffect footDownSoundEffect = null; | |
| if (l.has("footDownSound")) { | |
| footDownSoundEffect = new SoundEffect(l.getJSONObject("footDownSound")); | |
| } | |
| legSpecs.add(new Leg.Spec( | |
| l.getBoolean("back"), | |
| l.getDouble("xOffset"), | |
| l.getDouble("yOffset"), | |
| l.optDouble("upperLimbLength", l.optDouble("limbLength", 0)), | |
| l.optDouble("middleLimbLength", 0), | |
| l.optDouble("lowerLimbLength", l.optDouble("limbLength", 0)), | |
| l.getDouble("footWidth"), | |
| l.getDouble("footHeight"), | |
| l.getInt("stepLength"), | |
| l.getInt("maxStepTime"), | |
| l.getBoolean("bendForwards"), | |
| spr, | |
| img(l.getJSONObject("upperLeg")), | |
| l.has("middleLeg") ? img(l.getJSONObject("middleLeg")) : null, | |
| img(l.getJSONObject("lowerLeg")), | |
| img(l.getJSONObject("foot")), | |
| beginStepSoundEffect, | |
| footDownSoundEffect, | |
| l.optDouble("minFootY", -10000) | |
| )); | |
| } | |
| } | |
| if (o.has("tentacles")) { | |
| JSONArray ts = o.getJSONArray("tentacles"); | |
| for (int i = 0; i < ts.length(); i++) { | |
| tentacleSpecs.add(new TentacleSpec(ts.getJSONObject(i))); | |
| } | |
| tentacleDeathSpasms = o.optBoolean("tentacleDeathSpasms", false); | |
| } | |
| if (o.has(/*only*/"tentacleFans")) { | |
| JSONArray fs = o.getJSONArray("tentacleFans"); | |
| for (int i = 0; i < fs.length(); i++) { | |
| JSONObject fan = fs.getJSONObject(i); | |
| int number = fan.getInt("number"); | |
| Random r = new Random(fan.getInt("seed")); | |
| double startRadians = fan.getInt("startDegrees") * Math.PI / 180; | |
| double endRadians = fan.getInt("endDegrees") * Math.PI / 180; | |
| int centerX = fan.getInt("centerX"); | |
| int centerY = fan.getInt("centerY"); | |
| int jitterX = fan.getInt("jitterX"); | |
| int jitterY = fan.getInt("jitterY"); | |
| double tentacleAngleJitterRadians = fan.getInt("tentacleAngleJitterDegrees") * Math.PI / 180; | |
| double sizeMultMin = fan.getDouble("sizeMultMin"); | |
| double sizeMultMax = fan.getDouble("sizeMultMax"); | |
| int distMin = fan.getInt("distMin"); | |
| int distMax = fan.getInt("distMax"); | |
| ArrayList<Pair<Integer, Double>> ordering = new ArrayList<Pair<Integer, Double>>(); | |
| for (int j = 0; j < number; j++) { | |
| ordering.add(new Pair(j, r.nextDouble())); | |
| } | |
| Collections.sort(ordering, new Comparator<Pair<Integer, Double>>() { | |
| @Override | |
| public int compare(Pair<Integer, Double> o1, Pair<Integer, Double> o2) { | |
| return Double.compare(o2.b, o1.b); | |
| } | |
| }); | |
| for (int j = 0; j < number; j++) { | |
| double angle = startRadians + (endRadians - startRadians) / (number - 1) * ordering.get(j).a; | |
| double dist = distMin + ordering.get(j).b * (distMax - distMin); | |
| double x = (centerX + Math.cos(angle) * dist + jitterX * (r.nextDouble() - 0.5)) / AGame.SGS; | |
| double y = (centerY + Math.sin(angle) * dist + jitterY * (r.nextDouble() - 0.5)) / AGame.SGS; | |
| double tAngle = angle + tentacleAngleJitterRadians * (r.nextDouble() - 0.5); | |
| double sizeMult = sizeMultMin + r.nextDouble() * (sizeMultMax - sizeMultMin); | |
| TentacleSpec ts = new TentacleSpec(fan.getJSONObject("tentacle")); | |
| ts.baseAngle = tAngle; | |
| ts.baseXOffset = x; | |
| ts.baseYOffset = y; | |
| ts.baseLength *= sizeMult; | |
| ts.tipLength *= sizeMult; | |
| ts.baseWidth *= sizeMult; | |
| ts.tipWidth *= sizeMult; | |
| tentacleSpecs.add(ts); | |
| } | |
| } | |
| } | |
| lights = BonusableValue.listFromJSON(o, "lights", new ArrayList<ModuleLightSource>(), new BonusableValue.FromJSON<ModuleLightSource>() { | |
| @Override | |
| public ModuleLightSource construct(JSONObject l, BonusSet bs) { | |
| return new ModuleLightSource( | |
| new Clr(l.getInt("r"), l.getInt("g"), l.getInt("b")), | |
| l.getInt("radius"), | |
| l.getDouble("x"), | |
| l.getDouble("y"), | |
| l.optBoolean("outside") | |
| ); | |
| } | |
| }); | |
| soundEvery = BonusableValue.intFromJSON(o, "soundEvery", 1); | |
| targetAttractivenessMult = BonusableValue.doubleFromJSON(o, "targetAttractivenessMult", 1); | |
| hasResources = !BonusableValue.isAlways(coal, 0) || !BonusableValue.isAlways(ammo, 0) || !BonusableValue.isAlways(water, 0) || !BonusableValue.isAlways(repair, 0); | |
| canResupplyInCombat = BonusableValue.booleanFromJSON(o, "canResupplyInCombat", true); | |
| gunPortsCreateDrag = o.optBoolean("gunPortsCreateDrag", isWeapon); | |
| if (isWeapon) { | |
| reload = BonusableValue.intFromJSONWithDivAndMinAndMax(o, "reload", 1000, 1, 1, 100000); | |
| obeysFireMode = o.optBoolean("obeysFireMode", true); | |
| inaccuracyFromWeather = o.optBoolean("inaccuracyFromWeather", true); | |
| clip = BonusableValue.intFromJSON(o, "clip", 1); | |
| ammoPerClip = BonusableValue.intFromJSON(o, "ammoPerClip", 1); | |
| clipReloadTime = BonusableValue.intFromJSON(o, "clipReloadTime", 0); | |
| inaccuracy = BonusableValue.doubleFromJSON(o, "inaccuracy", 0); | |
| fixedInaccuracyVsTroops = BonusableValue.doubleFromJSON(o, "fixedInaccuracyVsTroops", 5); | |
| if (o.has("blastSplashRadius")) { | |
| blastDmg = BonusableValue.intFromJSON(o, "blastDmg", 0); | |
| blastSplashRadius = BonusableValue.intFromJSON(o, "blastSplashRadius", 0); | |
| splashFriendlyFire = BonusableValue.booleanFromJSON(o, "splashFriendlyFire", true); | |
| } else { | |
| blastDmg = BonusableValue.intFromJSON(o, "blastDmg", 0); | |
| blastSplashRadius = BonusableValue.of(blastDmg.get(BonusSet.empty()) > 9 ? (int) StrictMath.floor(13 + StrictMath.sqrt(blastDmg.get(BonusSet.empty()) * 5)) : 0); | |
| if (blastDmg.get(BonusSet.empty()) > 9) { | |
| blastDmg = BonusableValue.intFromJSONWithDivAndMinAndMax(o, "blastDmg", 0, 4, 0, 100000); | |
| } | |
| } | |
| penDmg = BonusableValue.intFromJSON(o, "penDmg", 0); | |
| directDmg = BonusableValue.intFromJSON(o, "directDmg", 0); | |
| numShots = BonusableValue.intFromJSON(o, "numShots", 1); | |
| multiShotJitter = BonusableValue.doubleFromJSON(o, "multiShotJitter", 0); | |
| shotSpeedVariation = BonusableValue.doubleFromJSON(o, "shotSpeedVariation", 0.25); | |
| recoilForce = BonusableValue.doubleFromJSON(o, "recoilForce", 0); | |
| if (o.has("impactForce")) { | |
| impactForce = BonusableValue.doubleFromJSON(o, "impactForce", 0); | |
| } else { | |
| impactForce = BonusableValue.derive(recoilForce, new BonusableValue.Derive<Double, Double>() { | |
| @Override | |
| public Double derive(Double from) { | |
| return from / 2; | |
| } | |
| }); | |
| } | |
| fireArc = BonusableValue.objectFromJSONRequired(o, "fireArc", new Arc.FromJSON()); | |
| innerTwoThirdsFireArc = BonusableValue.derive(fireArc, new Arc.InnerTwoThirds()); | |
| muzzleCenterX = BonusableValue.doubleFromJSON(o, "muzzleCenterX", w * 0.5); | |
| muzzleCenterY = BonusableValue.doubleFromJSON(o, "muzzleCenterY", h * 0.5); | |
| muzzleLength = BonusableValue.doubleFromJSON(o, "muzzleLength", 1); | |
| muzzleFlash = BonusableValue.booleanFromJSON(o, "muzzleFlash", true); | |
| weaponAppearance = BonusableValue.objectFromJSONRequired(o, "weaponAppearance", new WeaponAppearance.FromJSON(w)); | |
| guidanceSystem = BonusableValue.objectFromJSON(o, "guidanceSystem", null, new GuidanceSystemInfo.FromJSON()); | |
| beamSpec = BonusableValue.objectFromJSON(o, "beamSpec", null, new BeamSpec.FromJSON()); | |
| maxRange = BonusableValue.intFromJSON(o, "maxRange", 0); | |
| maxXRange = BonusableValue.intFromJSON(o, "maxXRange", 0); | |
| minXRange = BonusableValue.intFromJSON(o, "minXRange", 0); | |
| maxUpRange = BonusableValue.intFromJSON(o, "maxUpRange", 0); | |
| if (o.has("fireSound")) { | |
| try { | |
| fireSound = BonusableValue.of(new SoundEffect( | |
| o.getString("fireSound"), | |
| o.optInt("fireSoundCount", 1))); | |
| } catch (Exception e) { | |
| fireSound = BonusableValue.objectFromJSON(o, "fireSound", null, new SoundEffect.FromJSON(false)); | |
| } | |
| } | |
| if (o.has("hitSound")) { | |
| try { | |
| hitSound = BonusableValue.of(new SoundEffect(o.getString("hitSound"))); | |
| } catch (Exception e) { | |
| hitSound = BonusableValue.objectFromJSON(o, "hitSound", null, new SoundEffect.FromJSON(false)); | |
| } | |
| } | |
| optimumRange = BonusableValue.intFromJSON(o, "optimumRange", 500); | |
| jitterMerge = BonusableValue.doubleFromJSON(o, "jitterMerge", 0); | |
| shotSpeed = BonusableValue.doubleFromJSON(o, "shotSpeed", 1.6); | |
| tetherSpec = BonusableValue.objectFromJSON(o, "tetherSpec", null, new Tether.Spec.FromJSON()); | |
| int defaultSTR = 0; | |
| if (penDmg.get(BonusSet.empty()) + blastDmg.get(BonusSet.empty()) + directDmg.get(BonusSet.empty()) <= 20 && fireArc.get(BonusSet.empty()).sizeRadians >= StrictMath.PI / 2 && reload.get(BonusSet.empty()) <= 2000 && minXRange.get(BonusSet.empty()) == 0) { | |
| defaultSTR = 400; | |
| if (maxRange.get(BonusSet.empty()) > 0) { | |
| defaultSTR = StrictMath.min(defaultSTR, maxRange.get(BonusSet.empty()) / 2); | |
| } | |
| if (maxXRange.get(BonusSet.empty()) > 0) { | |
| defaultSTR = StrictMath.min(defaultSTR, maxXRange.get(BonusSet.empty()) / 2); | |
| } | |
| } | |
| shootTroopsRange = BonusableValue.intFromJSON(o, "shootTroopsRange", defaultSTR); | |
| } | |
| } | |
| // Referencing a bunch of things: | |
| public WeaponAppearance(JSONObject o, int moduleW) { | |
| if (o.has("back")) { | |
| back = new Appearance(o.getJSONObject("back")); | |
| } | |
| if (o.has("shot")) { | |
| shot = new Img[] { img(o.getJSONObject("shot")) }; | |
| } | |
| if (o.has("shotFrames")) { | |
| JSONArray a = o.getJSONArray("shotFrames"); | |
| shot = new Img[a.length()]; | |
| for (int i = 0; i < a.length(); i++) { | |
| shot[i] = img(a.getJSONObject(i)); | |
| } | |
| } | |
| onlyShowBarrelIfLoaded = o.optBoolean("onlyShowBarrelIfLoaded", false); | |
| shotAnimationInterval = o.optInt("shotAnimationInterval", 150); | |
| hitExplosionSize = o.optDouble("hitExplosionSize", 0); | |
| missExplosionSize = o.optDouble("missExplosionSize", 0); | |
| fireVibrate = o.optDouble("fireVibrate", 0); | |
| fireFlash = o.optDouble("fireFlash", 0); | |
| fireVibrateDecay = o.optDouble("fireVibrateDecay", 0.8); | |
| if (o.has("barrelLoadStages")) { | |
| JSONArray a = o.getJSONArray("barrelLoadStages"); | |
| barrelLoadStages = new Img[a.length()]; | |
| flippedBarrelLoadStages = new Img[a.length()]; | |
| for (int i = 0; i < a.length(); i++) { | |
| barrelLoadStages[i] = img(a.getJSONObject(i)); | |
| flippedBarrelLoadStages[i] = barrelLoadStages[i].flip(); | |
| } | |
| } | |
| if (o.has("barrel")) { | |
| barrel = img(o.getJSONObject("barrel")); | |
| flippedbarrel = barrel.flip(); | |
| } else if (o.has("barrelAnimation")) { | |
| JSONObject bao = o.getJSONObject("barrelAnimation"); | |
| JSONArray framesA = bao.getJSONArray("frames"); | |
| ArrayList<Img> frames = new ArrayList<Img>(); | |
| for (int i = 0; i < framesA.length(); i++) { | |
| frames.add(img(framesA.getJSONObject(i))); | |
| } | |
| barrelAnimation = new BarrelAnimation( | |
| bao.getInt("interval"), | |
| bao.optInt("msPerShot", -1), | |
| bao.optBoolean("loop", false), | |
| bao.optBoolean("loopConstantly", false), | |
| bao.optBoolean("finishLoopCycle", false), | |
| frames); | |
| flippedBarrelAnimation = barrelAnimation.flip(); | |
| } | |
| if (o.has("externalBarrel")) { | |
| externalBarrel = img(o.getJSONObject("externalBarrel")); | |
| externalFlippedbarrel = externalBarrel.flip(); | |
| } else if (o.has("externalBarrelAnimation")) { | |
| JSONObject bao = o.getJSONObject("externalBarrelAnimation"); | |
| JSONArray framesA = bao.getJSONArray("frames"); | |
| ArrayList<Img> frames = new ArrayList<Img>(); | |
| for (int i = 0; i < framesA.length(); i++) { | |
| frames.add(img(framesA.getJSONObject(i))); | |
| } | |
| externalBarrelAnimation = new BarrelAnimation( | |
| bao.getInt("interval"), | |
| bao.optInt("msPerShot", -1), | |
| bao.optBoolean("loop", false), | |
| bao.optBoolean("loopConstantly", false), | |
| bao.optBoolean("finishLoopCycle", false), | |
| frames); | |
| externalFlippedBarrelAnimation = externalBarrelAnimation.flip(); | |
| } | |
| if (o.has("barrelX")) { | |
| barrelOffset = new Pt(o.getDouble("barrelX"), o.getDouble("barrelY")); | |
| Img b = barrel != null ? barrel : barrelAnimation.frames.get(0); | |
| flippedBarrelOffset = new Pt(moduleW * AGame.SGS - barrelOffset.x - b.srcWidth, barrelOffset.y); | |
| } | |
| recoil = o.optDouble("recoil", 0); | |
| if (o.has("shotEmitter")) { | |
| JSONObject em = o.getJSONObject("shotEmitter"); | |
| SoundEffect ef = null; | |
| if (em.has("sound")) { | |
| try { | |
| String sound = em.getString("sound"); | |
| ef = new SoundEffect(sound, em.optDouble("volume")); | |
| } catch (Exception e) { | |
| ef = new SoundEffect(em.getJSONObject("sound")); | |
| } | |
| } | |
| shotEmitter = new Particle.Emitter( | |
| ParticleType.ofName(em.getString("type")), | |
| em.getDouble("emitProbability"), | |
| em.optInt("numParticles", 1), | |
| ef); | |
| } | |
| if (o.has("exhaust")) { | |
| JSONObject e = o.getJSONObject("exhaust"); | |
| exhaust = new ShotExhaustEmitter( | |
| ParticleType.ofName(e.getString("type")), | |
| e.getDouble("p"), | |
| e.getDouble("backOffset"), | |
| e.getDouble("angleRange"), | |
| e.getDouble("randomOffset"), | |
| e.getDouble("speedMin"), | |
| e.getDouble("speedMax") | |
| ); | |
| } | |
| impactParticle = ParticleType.ofName(o.optString("impactParticle", "impact")); | |
| numImpactParticles = o.optInt("numImpactParticles", 0); | |
| if (o.has("shells")) { | |
| JSONArray a = o.getJSONArray("shells"); | |
| for (int i = 0; i < a.length(); i++) { | |
| shells.add(new Shell(a.getJSONObject(i))); | |
| } | |
| } | |
| } | |
| public Shell(JSONObject o) { | |
| img = img(o.getJSONObject("img")); | |
| internalImg = o.has("internalImg") ? img(o.getJSONObject("internalImg")) : null; | |
| x = o.getInt("x"); | |
| y = o.getInt("y"); | |
| pivotX = o.optInt("pivotX", 0); | |
| pivotY = o.optInt("pivotY", 0); | |
| openShiftX = o.optDouble("openShiftX", 0); | |
| openShiftY = o.optDouble("openShiftY", 0); | |
| openAngle = o.optDouble("openAngle", 0); | |
| startOpenTimeBeforeFiring = o.getInt("startOpenTimeBeforeFiring"); | |
| endOpenTimeBeforeFiring = o.getInt("endOpenTimeBeforeFiring"); | |
| startCloseTimeAfterFiring = o.getInt("startCloseTimeAfterFiring"); | |
| endCloseTimeAfterFiring = o.getInt("endCloseTimeAfterFiring"); | |
| shellClosedPenAbsorb = o.optInt("shellClosedPenAbsorb", 0); | |
| shellClosedBlastAbsorb = o.optInt("shellClosedBlastAbsorb", 0); | |
| if (o.has("openEmitters")) { | |
| JSONArray a = o.getJSONArray("openEmitters"); | |
| for (int i = 0; i < a.length(); i++) { | |
| openEmitters.add(new ShellEmitter(a.getJSONObject(i))); | |
| } | |
| } | |
| if (o.has("closeEmitters")) { | |
| JSONArray a = o.getJSONArray("closeEmitters"); | |
| for (int i = 0; i < a.length(); i++) { | |
| closeEmitters.add(new ShellEmitter(a.getJSONObject(i))); | |
| } | |
| } | |
| if (o.has("openSound")) { | |
| openSound = new SoundEffect(o.getJSONObject("openSound")); | |
| } | |
| if (o.has("closeSound")) { | |
| closeSound = new SoundEffect(o.getJSONObject("closeSound")); | |
| } | |
| } | |
| public ShellEmitter(JSONObject o) { | |
| type = ParticleType.ofName(o.getString("type")); | |
| JSONArray a = o.getJSONArray("emitPoints"); | |
| for (int i = 0; i < a.length(); i += 2) { | |
| emitPoints.add(new Pt(a.getDouble(i), a.getDouble(i + 1))); | |
| } | |
| } | |
| public TentacleSpec(JSONObject o) { | |
| numSegments = o.getInt("numSegments"); | |
| baseAngle = o.getDouble("baseAngle"); | |
| baseXOffset = o.getDouble("baseXOffset"); | |
| baseYOffset = o.getDouble("baseYOffset"); | |
| baseStiffness = o.getDouble("baseStiffness"); | |
| tipStiffness = o.getDouble("tipStiffness"); | |
| baseLength = o.getDouble("baseLength"); | |
| tipLength = o.getDouble("tipLength"); | |
| baseWidth = o.getDouble("baseWidth"); | |
| tipWidth = o.getDouble("tipWidth"); | |
| speed = o.getDouble("speed"); | |
| snatchesCrew = o.getBoolean("snatchesCrew"); | |
| if (snatchesCrew) { | |
| mouthXOffset = o.getDouble("mouthXOffset"); | |
| mouthYOffset = o.getDouble("mouthYOffset"); | |
| } else { | |
| mouthXOffset = 0; | |
| mouthYOffset = 0; | |
| } | |
| SoundEffect ss = null; | |
| if (o.has("snatchSound")) { | |
| try { | |
| ss = new SoundEffect(o.getString("snatchSound"), o.optInt("numSnatchSounds", 1)); | |
| } catch (Exception e) { | |
| ss = new SoundEffect(o.getJSONObject("snatchSound")); | |
| } | |
| } | |
| snatchSound = ss; | |
| attacksHull = o.getBoolean("attacksHull"); | |
| if (attacksHull) { | |
| attackPenDmg = o.getInt("attackPenDmg"); | |
| attackBlastDmg = o.getInt("attackBlastDmg"); | |
| attackDirectDmg = o.optInt("attackDirectDmg"); | |
| if (o.has("attackSprayParticle")) { | |
| attackSprayParticle = ParticleType.ofName(o.getString("attackSprayParticle")); | |
| } else { | |
| attackSprayParticle = null; | |
| } | |
| attackSprayP = o.optDouble("attackSprayP", 1.0); | |
| if (o.has("attackImpactParticle")) { | |
| attackImpactParticle = ParticleType.ofName(o.getString("attackImpactParticle")); | |
| } else { | |
| attackImpactParticle = null; | |
| } | |
| numAttackImpactParticles = o.optInt("numAttackImpactParticles", 1); | |
| } else { | |
| attackPenDmg = 0; | |
| attackBlastDmg = 0; | |
| attackDirectDmg = 0; | |
| attackSprayParticle = null; | |
| attackSprayP = 0; | |
| attackImpactParticle = null; | |
| numAttackImpactParticles = 0; | |
| } | |
| SoundEffect as = null; | |
| if (o.has("attackSound")) { | |
| try { | |
| as = new SoundEffect(o.getString("attackSound"), o.optInt("numAttackSounds", 1)); | |
| } catch (Exception e) { | |
| as = new SoundEffect(o.getJSONObject("attackSound")); | |
| } | |
| } | |
| attackSound = as; | |
| minNextTargetPause = o.optInt("minNextTargetPause", 500); | |
| maxNextTargetPause = StrictMath.max(minNextTargetPause + 1, o.optInt("maxNextTargetPause", 1000)); | |
| wavesAround = o.getBoolean("wavesAround"); | |
| suckerDirection = o.getBoolean("suckerDirection"); | |
| segmentImg = new Img( | |
| o.getJSONObject("segmentImg").getString("src"), | |
| o.getJSONObject("segmentImg").getInt("x"), | |
| o.getJSONObject("segmentImg").getInt("y"), | |
| o.getJSONObject("segmentImg").getInt("w"), | |
| o.getJSONObject("segmentImg").getInt("h"), | |
| o.getJSONObject("segmentImg").optBoolean("flipped", false) | |
| ); | |
| segmentImgVerticallyFlipped = new Img( | |
| o.getJSONObject("segmentImgVerticallyFlipped").getString("src"), | |
| o.getJSONObject("segmentImgVerticallyFlipped").getInt("x"), | |
| o.getJSONObject("segmentImgVerticallyFlipped").getInt("y"), | |
| o.getJSONObject("segmentImgVerticallyFlipped").getInt("w"), | |
| o.getJSONObject("segmentImgVerticallyFlipped").getInt("h"), | |
| o.getJSONObject("segmentImgVerticallyFlipped").optBoolean("flipped", false) | |
| ); | |
| segmentImgOverride = new Img[numSegments]; | |
| segmentImgOverrideVerticallyFlipped = new Img[numSegments]; | |
| if (o.has("segmentImgOverrides")) { | |
| JSONArray a = o.getJSONArray("segmentImgOverrides"); | |
| for (int i = 0; i < a.length(); i++) { | |
| JSONObject ov = a.getJSONObject(i); | |
| int index = ov.getInt("index"); | |
| JSONObject img = ov.getJSONObject("img"); | |
| segmentImgOverride[index] = new Img( | |
| img.getString("src"), | |
| img.getInt("x"), | |
| img.getInt("y"), | |
| img.getInt("w"), | |
| img.getInt("h"), | |
| img.optBoolean("flipped", false)); | |
| img = ov.getJSONObject("imgVerticallyFlipped"); | |
| segmentImgOverrideVerticallyFlipped[index] = new Img( | |
| img.getString("src"), | |
| img.getInt("x"), | |
| img.getInt("y"), | |
| img.getInt("w"), | |
| img.getInt("h"), | |
| img.optBoolean("flipped", false)); | |
| } | |
| } | |
| imgLength = o.getDouble("imgLength"); | |
| if (o.has("tipEmitter")) { | |
| JSONObject pe = o.getJSONObject("tipEmitter"); | |
| SoundEffect ef = null; | |
| if (pe.has("sound")) { | |
| try { | |
| String sound = pe.getString("sound"); | |
| ef = new SoundEffect(sound, pe.optDouble("volume")); | |
| } catch (Exception e) { | |
| ef = new SoundEffect(pe.getJSONObject("sound")); | |
| } | |
| } | |
| tipEmitter = new Particle.Emitter( | |
| ParticleType.ofName(pe.getString("type")), | |
| pe.getDouble("emitProbability"), | |
| pe.optInt("numParticles", 1), | |
| ef); | |
| } else { | |
| tipEmitter = null; | |
| } | |
| } | |
| // Wheel Spec | |
| public static strictfp class Spec { | |
| public final double xOffset; | |
| public final double maxYOffset; | |
| public final double radius; | |
| public final Img wheel; | |
| public final Img lowerLink; | |
| public final Img upperLink; | |
| public final double segmentStride; | |
| public ArrayList<ModuleType.FragmentImg> wheelFrag = new ArrayList<ModuleType.FragmentImg>(); | |
| public ArrayList<ModuleType.FragmentImg> lowerLinkFrag = new ArrayList<ModuleType.FragmentImg>(); | |
| public ArrayList<ModuleType.FragmentImg> upperLinkFrag = new ArrayList<ModuleType.FragmentImg>(); | |
| public Spec(double xOffset, double maxYOffset, double radius, Img wheel, Img lowerLink, Img upperLink, double segmentStride) { | |
| this.xOffset = xOffset; | |
| this.maxYOffset = maxYOffset; | |
| this.radius = radius; | |
| this.wheel = wheel; | |
| this.lowerLink = lowerLink; | |
| this.upperLink = upperLink; | |
| this.segmentStride = segmentStride; | |
| } | |
| } | |
| // End of things referenced by moduletype | |
| public Substitution(JSONObject o) { | |
| super(o.getString("name")); | |
| if (o.has("forTypes")) { | |
| forTypes = EnumSet.noneOf(ShipType.class); | |
| JSONArray a = o.getJSONArray("forTypes"); | |
| for (int i = 0; i < a.length(); i++) { | |
| forTypes.add(ShipType.valueOf(a.getString(i))); | |
| } | |
| } else { | |
| forTypes = EnumSet.allOf(ShipType.class); | |
| } | |
| fromModule = o.optString("fromModule", null); | |
| toModule = o.optString("toModule", null); | |
| fromCrew = o.optString("fromCrew", null); | |
| toCrew = o.optString("toCrew", null); | |
| fromArmour = o.optString("fromArmour", null); | |
| toArmour = o.optString("toArmour", null); | |
| setNoWindowForArmour = o.optBoolean("setNoWindowForArmour", false); | |
| } | |
| public Tech(JSONObject o) { | |
| super(o.getString("name"), o.optInt("sort", 0)); | |
| tier = o.getInt("tier"); | |
| if (o.has("choices")) { | |
| JSONArray a = o.getJSONArray("choices"); | |
| for (int i = 0; i < a.length(); i++) { | |
| choices.add(new Choice(a.getJSONObject(i), this)); | |
| } | |
| } else { | |
| choices.add(new Choice(o, this)); | |
| } | |
| if (o.has("dependencies")) { | |
| JSONArray a = o.getJSONArray("dependencies"); | |
| for (int i = 0; i < a.length(); i++) { | |
| dependencyNames.add(a.getString(i)); | |
| } | |
| } | |
| if (o.has("requiresBonus")) { | |
| requiresBonus = Bonus.ofName(o.getString("requiresBonus")); | |
| } else { | |
| requiresBonus = null; | |
| } | |
| } | |
| // Containing | |
| public Choice(JSONObject o, Tech tech) { | |
| this.tech = tech; | |
| name = o.getString("name"); | |
| bonuses = new BonusSet(); | |
| JSONArray a = o.getJSONArray("bonuses"); | |
| for (int i = 0; i < a.length(); i++) { | |
| bonuses.add(Bonus.ofNameOrNone(a.getString(i))); | |
| } | |
| bonusList = bonuses.list(); | |
| JSONObject imgO = o.getJSONObject("img"); | |
| img = new Img(imgO.getString("src"), imgO.getInt("x"), imgO.getInt("y"), imgO.getInt("w"), imgO.getInt("h"), imgO.optBoolean("flipped", false)); | |
| } | |
| public ResearchSpeed(JSONObject o) { | |
| super(o.getString("name"), o.getInt("sort")); | |
| baseCost = o.getInt("baseCost"); | |
| cityCost = o.getInt("cityCost"); | |
| baseResearch = o.getInt("baseResearch"); | |
| cityResearch = o.getInt("cityResearch"); | |
| isDefault = o.optBoolean("isDefault", false); | |
| } | |
| public Charge(JSONObject o) { | |
| super(o.getString("name")); | |
| app = new Appearance(o.getJSONObject("appearance")); | |
| unlitApp = new Appearance(o.getJSONObject("unlitAppearance")); | |
| bonus = Bonus.ofName(o.getString("bonus")); | |
| this.leftApp = app.leftSide(); | |
| this.rightApp = app.rightSide(); | |
| this.unlitLeftApp = unlitApp.leftSide(); | |
| this.unlitRightApp = unlitApp.rightSide(); | |
| if (o.has("tech")) { | |
| Tech t = Tech.ofName(o.getString("tech")); | |
| if (t.choices.size() > 1) { | |
| tech = t.getChoice(o.getString("techChoice")); | |
| } else { | |
| tech = t.choices.get(0); | |
| } | |
| } else { | |
| tech = null; | |
| } | |
| if (o.has("overrides")) { | |
| JSONObject o2 = o.getJSONObject("overrides"); | |
| for (Object o2k : o2.keySet()) { | |
| String k2 = (String) o2k; | |
| ArmsLayout al = ArmsLayout.valueOf(k2); | |
| HashMap<Integer, ArmsLayout.TincturedApp> ovs = new HashMap<Integer, ArmsLayout.TincturedApp>(); | |
| overrides.put(al, ovs); | |
| JSONObject o3 = o2.getJSONObject(k2); | |
| for (Object o3k : o3.keySet()) { | |
| ovs.put(Integer.parseInt((String) o3k), new ArmsLayout.TincturedApp(o3.getJSONObject((String) o3k))); | |
| } | |
| } | |
| } | |
| if (o.has("unlitOverrides")) { | |
| JSONObject o2 = o.getJSONObject("unlitOverrides"); | |
| for (Object o2k : o2.keySet()) { | |
| String k2 = (String) o2k; | |
| ArmsLayout al = ArmsLayout.valueOf(k2); | |
| HashMap<Integer, ArmsLayout.TincturedApp> ovs = new HashMap<Integer, ArmsLayout.TincturedApp>(); | |
| unlitOverrides.put(al, ovs); | |
| JSONObject o3 = o2.getJSONObject(k2); | |
| for (Object o3k : o3.keySet()) { | |
| ovs.put(Integer.parseInt((String) o3k), new ArmsLayout.TincturedApp(o3.getJSONObject((String) o3k))); | |
| } | |
| } | |
| } | |
| if (o.has("shieldOverrides")) { | |
| JSONObject o2 = o.getJSONObject("shieldOverrides"); | |
| for (Object o2k : o2.keySet()) { | |
| String k2 = (String) o2k; | |
| ArmsLayout al = ArmsLayout.valueOf(k2); | |
| HashMap<Integer, ArmsLayout.TincturedImg> ovs = new HashMap<Integer, ArmsLayout.TincturedImg>(); | |
| shieldOverrides.put(al, ovs); | |
| JSONObject o3 = o2.getJSONObject(k2); | |
| for (Object o3k : o3.keySet()) { | |
| ovs.put(Integer.parseInt((String) o3k), new ArmsLayout.TincturedImg(o3.getJSONObject((String) o3k))); | |
| } | |
| } | |
| } | |
| if (o.has("addToHeraldicStyles")) { | |
| JSONArray a = o.getJSONArray("addToHeraldicStyles"); | |
| for (int i = 0; i < a.length(); i++) { | |
| addToHeraldicStyles.add(a.getString(i)); | |
| } | |
| } | |
| } | |
| public HeraldicStyle(JSONObject o) { | |
| super(o.getString("name")); | |
| ruleOfTincture = o.getBoolean("ruleOfTincture"); | |
| firstChargeShouldHaveBonus = o.optBoolean("firstChargeShouldHaveBonus", false); | |
| JSONArray a; | |
| if (o.has("layouts")) { | |
| a = o.getJSONArray("layouts"); | |
| for (int i = 0; i < a.length(); i++) { | |
| layouts.add(ArmsLayout.valueOf(a.getString(i))); | |
| } | |
| for (ArmsLayout l : Loadable.all(ArmsLayout.class)) { | |
| if (l.addToHeraldicStyles.contains(name)) { | |
| layouts.add(l); | |
| } | |
| } | |
| } else { | |
| layouts.addAll(Loadable.all(ArmsLayout.class)); | |
| } | |
| if (o.has("charges")) { | |
| a = o.getJSONArray("charges"); | |
| for (int i = 0; i < a.length(); i++) { | |
| charges.add(Charge.ofName(a.getString(i))); | |
| } | |
| for (Charge c : Loadable.all(Charge.class)) { | |
| if (c.addToHeraldicStyles.contains(name)) { | |
| charges.add(c); | |
| } | |
| } | |
| } else { | |
| charges.addAll(Loadable.all(Charge.class)); | |
| } | |
| for (Charge c : charges) { | |
| if (c.bonus != Bonus.ofName("NO_BONUS") || c.tech != null) { | |
| chargesWithBonusOrTech.add(c); | |
| } | |
| } | |
| if (o.has("layoutTinctures")) { | |
| a = o.getJSONArray("layoutTinctures"); | |
| for (int i = 0; i < a.length(); i++) { | |
| layoutTinctures.add(Tincture.valueOf(a.getString(i))); | |
| } | |
| for (Tincture t : Tincture.values()) { | |
| if (t.addToHeraldicStylesAsLayoutTincture.contains(name)) { | |
| layoutTinctures.add(t); | |
| } | |
| } | |
| } else { | |
| layoutTinctures.addAll(Tincture.values()); | |
| } | |
| if (o.has("chargeTinctures")) { | |
| a = o.getJSONArray("chargeTinctures"); | |
| for (int i = 0; i < a.length(); i++) { | |
| chargeTinctures.add(Tincture.valueOf(a.getString(i))); | |
| } | |
| for (Tincture t : Tincture.values()) { | |
| if (t.addToHeraldicStylesAsChargeTincture.contains(name)) { | |
| chargeTinctures.add(t); | |
| } | |
| } | |
| } else { | |
| chargeTinctures.addAll(Tincture.values()); | |
| } | |
| } | |
| public ConstructionStrategy(JSONObject o) { | |
| super(o.getString("name")); | |
| loadTier(o, "shipTiers", shipNames); | |
| loadTier(o, "landshipTiers", landshipNames); | |
| loadTier(o, "buildingTiers", buildingNames); | |
| loadTier(o, "shipUpgradeSequences", shipUpgradeSequences); | |
| loadTier(o, "landshipUpgradeSequences", landshipUpgradeSequences); | |
| loadTier(o, "buildingUpgradeSequences", buildingUpgradeSequences); | |
| if (o.has("techs")) { | |
| JSONArray a = o.getJSONArray("techs"); | |
| for (int i = 0; i < a.length(); i++) { | |
| Tech.Choice c = Tech.choiceOfName(a.getString(i)); | |
| if (c == null) { | |
| System.out.println("Unknown tech choice " + a.getString(i)); | |
| } | |
| if (c != null) { | |
| techs.add(c); | |
| } | |
| } | |
| } | |
| if (o.has("charges")) { | |
| JSONArray a = o.getJSONArray("charges"); | |
| for (int i = 0; i < a.length(); i++) { | |
| if (Loadable.hasOfName(Charge.class, a.getString(i))) { | |
| charges.add(Charge.ofName(a.getString(i))); | |
| } | |
| } | |
| } | |
| if (o.has("requiredCharge")) { | |
| requiredCharge = Charge.ofName(o.getString("requiredCharge")); | |
| } | |
| if (o.has("minDifficultyLevel")) { | |
| minDifficultyLevel = DifficultyLevel.ofName(o.getString("minDifficultyLevel")); | |
| } else { | |
| minDifficultyLevel = null; | |
| } | |
| } | |
| public PortraitMessageType(JSONObject o) { | |
| super(o.getString("name"), o.getString("eventInfoPrefix").length()); | |
| eventInfoPrefix = o.getString("eventInfoPrefix"); | |
| JSONArray a = o.getJSONArray("messageImages"); | |
| messageImages = new Img[a.length()]; | |
| for (int i = 0; i < a.length(); i++) { | |
| messageImages[i] = new Img(a.getString(i)); | |
| } | |
| if (o.has("victimCrewType")) { | |
| victimCrewType = CrewType.ofName(o.getString("victimCrewType")); | |
| } | |
| if (o.has("observingCrewType")) { | |
| observingCrewType = CrewType.ofName(o.getString("observingCrewType")); | |
| } | |
| observerInSameShip = o.optBoolean("observerInSameShip", false); | |
| maxDistanceSq = o.optInt("maxDistance", 0) * o.optInt("maxDistance", 0); | |
| numberOfMessages = messageImages.length; | |
| minZoom = o.optDouble("minZoom", 0.0001); | |
| maxZoom = o.optDouble("maxZoom", 10000); | |
| } | |
| public MonsterNestType(JSONObject o) { | |
| super(o.getString("name")); | |
| img = new Img(o.optString("img", o.getString("name"))); | |
| needsRoad = o.getBoolean("needsRoad"); | |
| mapImage = o.has("mapImage") ? img(o.getJSONObject("mapImage")) : null; | |
| mapFleetImage = o.has("mapFleetImage") ? img(o.getJSONObject("mapFleetImage")) : null; | |
| mapBackground = o.has("mapImage") ? img(o.getJSONObject("mapBackground")) : null; | |
| mapFleetBackground = o.has("mapFleetImage") ? img(o.getJSONObject("mapFleetBackground")) : null; | |
| income = o.getInt("income"); | |
| spawnWeight = o.optInt("spawnWeight", 1); | |
| incomeModifierPercentage = o.optInt("incomeModifierPercentage", 0); | |
| incomeModifier = o.optInt("incomeModifier", 0); | |
| aiQuality = AIQuality.valueOf(o.optString("aiQuality", AIQuality.NORMAL.name())); | |
| minAttackFleetStrength = o.optInt("minAttackFleetStrength", 0); | |
| attackRadius = o.optInt("attackRadius", 0); | |
| oneOnly = o.optBoolean("oneOnly", false); | |
| respawns = o.optBoolean("respawns", true); | |
| isBiological = o.optBoolean("isBiological", false); | |
| if (o.has("heraldicStyle")) { | |
| heraldicStyle = HeraldicStyle.ofName(o.getString("heraldicStyle")); | |
| } else { | |
| heraldicStyle = null; | |
| } | |
| baseConstructions = new ArrayList<Airship>(); | |
| baseConstructionNames = new ArrayList<String>(); | |
| JSONArray a = o.getJSONArray("baseConstructions"); | |
| for (int i = 0; i < a.length(); i++) { | |
| baseConstructionNames.add(a.getString(i)); | |
| } | |
| additionalConstructions = new ArrayList<Airship>(); | |
| additionalConstructionNames = new ArrayList<String>(); | |
| a = o.getJSONArray("additionalConstructions"); | |
| for (int i = 0; i < a.length(); i++) { | |
| additionalConstructionNames.add(a.getString(i)); | |
| } | |
| a = o.getJSONArray("rewards"); | |
| rewards = new ArrayList<Reward>(); | |
| for (int i = 0; i < a.length(); i++) { | |
| rewards.add(new Reward(a.getJSONObject(i), img, this)); | |
| } | |
| homeFleet = new ArrayList<String>(); | |
| if (o.has("homeFleet")) { | |
| a = o.getJSONArray("homeFleet"); | |
| for (int i = 0; i < a.length(); i++) { | |
| homeFleet.add(a.getString(i)); | |
| } | |
| } | |
| if (o.has("specialTextWithBonuses")) { | |
| a = o.getJSONArray("specialTextWithBonuses"); | |
| for (int i = 0; i < a.length(); i++) { | |
| specialTextWithBonuses.add(Bonus.ofName(a.getString(i))); | |
| } | |
| } | |
| msUntilUpgrade = o.optInt("msUntilUpgrade", 240000); | |
| upgradeMsPerRaidSuccess = o.optInt("upgradeMsPerRaidSuccess", 30000); | |
| msForUpgrade = o.optInt("msForUpgrade", 60000); | |
| upgradeToName = o.optString("upgradeTo", null); | |
| upgradeNearingCompletionMessage = o.optBoolean("upgradeNearingCompletionMessage", false); | |
| minTimeBetweenRaids = o.optInt("minTimeBetweenRaids", 120000); | |
| minTimeBetweenCityRaids = o.optInt("minTimeBetweenCityRaids", 240000); | |
| if (o.has("landscapeTypes")) { | |
| landscapeTypes = new ArrayList<Utils.Pair<Integer, LandscapeType>>(); | |
| a = o.getJSONArray("landscapeTypes"); | |
| for (int i = 0; i < a.length(); i++) { | |
| landscapeTypes.add(new Pair<Integer, LandscapeType>(a.getJSONObject(i).getInt("spawnWeight"), LandscapeType.ofName(a.getJSONObject(i).getString("name")))); | |
| } | |
| } else { | |
| landscapeTypes = null; | |
| } | |
| } | |
| // Reward from nests | |
| public static class Reward { | |
| public final String name; | |
| public final int spawnWeight; | |
| private final int money; | |
| private final int research; | |
| public final Bonus bonus; | |
| public final Tech.Choice tech; | |
| public final int rep; | |
| public final Img img; | |
| public final MonsterNestType nestType; | |
| public Reward(JSONObject o, Img img, MonsterNestType nestType) { | |
| name = o.getString("name"); | |
| spawnWeight = o.optInt("spawnWeight", 1); | |
| money = o.optInt("money", 0); | |
| bonus = o.has("bonus") ? Bonus.ofNameOrNull(o.getString("bonus")) : null; | |
| tech = o.has("tech") ? Tech.choiceOfName(o.getString("tech")) : null; | |
| rep = o.optInt("rep", 0); | |
| research = o.optInt("research", 0); | |
| this.nestType = nestType; | |
| this.img = img; | |
| } | |
| public int getMoney(Empire e) { | |
| if (nestType.isBiological) { | |
| return (int) (money * EmpireStat.BIO_MONSTER_MONEY_MULT.get(e.bonuses())); | |
| } | |
| return money; | |
| } | |
| public int getResearch(Empire e) { | |
| if (nestType.isBiological) { | |
| return (int) (research * EmpireStat.BIO_MONSTER_RESEARCH_MULT.get(e.bonuses())); | |
| } | |
| return research; | |
| } | |
| } | |
| public MusicAffinity(JSONObject o) { | |
| super(o.getString("name"), o.optInt("sort", 0)); | |
| module = ModuleType.ofName(o.getString("module")); | |
| music = o.getString("music"); | |
| musicL.add(music); | |
| } | |
| public MiscCombatSound(JSONObject o) { | |
| super(o.getString("name")); | |
| if (name.equals("CREAK")) { | |
| CREAK = new SoundEffect(o.getJSONObject("sound")); | |
| } | |
| if (name.equals("LARGE_CRASH")) { | |
| LARGE_CRASH = new SoundEffect(o.getJSONObject("sound")); | |
| } | |
| if (name.equals("MEDIUM_CRASH")) { | |
| MEDIUM_CRASH = new SoundEffect(o.getJSONObject("sound")); | |
| } | |
| if (name.equals("SMALL_CRASH")) { | |
| SMALL_CRASH = new SoundEffect(o.getJSONObject("sound")); | |
| } | |
| if (name.equals("LIGHTNING")) { | |
| LIGHTNING = new SoundEffect(o.getJSONObject("sound")); | |
| } | |
| if (name.equals("BELL")) { | |
| BELL = new SoundEffect(o.getJSONObject("sound")); | |
| } | |
| if (name.equals("FRAGMENT_EXPLOSION")) { | |
| FRAGMENT_EXPLOSION = new SoundEffect(o.getJSONObject("sound")); | |
| } | |
| if (name.equals("SAIL")) { | |
| SAIL = new SoundEffect(o.getJSONObject("sound")); | |
| } | |
| if (name.equals("QUENCH")) { | |
| QUENCH = new SoundEffect(o.getJSONObject("sound")); | |
| } | |
| if (name.equals("FIRE_LOOP")) { | |
| FIRE_LOOP = new SoundEffect(o.getJSONObject("loop"), true); | |
| } | |
| if (name.equals("MODULE_EXPLOSION")) { | |
| MODULE_EXPLOSION = new SoundEffect(o.getJSONObject("sound")); | |
| } | |
| if (name.equals("REPAIR")) { | |
| REPAIR = new SoundEffect(o.getJSONObject("sound")); | |
| } | |
| if (name.equals("SMALL_HIT")) { | |
| SMALL_HIT = new SoundEffect(o.getJSONObject("sound")); | |
| } | |
| if (name.equals("MEDIUM_HIT")) { | |
| MEDIUM_HIT = new SoundEffect(o.getJSONObject("sound")); | |
| } | |
| if (name.equals("LARGE_HIT")) { | |
| LARGE_HIT = new SoundEffect(o.getJSONObject("sound")); | |
| } | |
| if (name.equals("THUNDER")) { | |
| THUNDER = new SoundEffect(o.getJSONObject("sound")); | |
| } | |
| if (name.equals("SHOT_EXPLOSION")) { | |
| SHOT_EXPLOSION = new SoundEffect(o.getJSONObject("sound")); | |
| } | |
| if (name.equals("SMALL_SHOT_EXPLOSION")) { | |
| SMALL_SHOT_EXPLOSION = new SoundEffect(o.getJSONObject("sound")); | |
| } | |
| } | |
| public GUISetting(JSONObject o) { | |
| super(o.getString("name")); | |
| this.o = o; | |
| if (name.equals("SLIDER_KNOB")) { | |
| MyDraw.SMALL_SLIDER_KNOB = v_img(); | |
| } | |
| if (name.equals("SELECTED")) { | |
| MyDraw.SELECTED = v_clr(); | |
| MyDraw.SELECTED_C = "[" + v_clr().toString() + "]"; | |
| } | |
| if (name.equals("DARK_BG")) { | |
| MyDraw.DARK_BG = v_clr(); | |
| } | |
| if (name.equals("TITLE")) { | |
| MyDraw.TITLE = v_clr(); | |
| MyDraw.TITLE_C = "[" + v_clr().toString() + "]"; | |
| } | |
| if (name.equals("ERROR")) { | |
| MyDraw.ERROR_C = "[" + v_clr().toString() + "]"; | |
| } | |
| if (name.equals("BUTTON_SPACING")) { | |
| MyDraw.SMALL_BUTTON_SPACING = v_int(); | |
| } | |
| if (name.equals("UI_SPACING")) { | |
| MyDraw.SMALL_UI_SPACING = v_int(); | |
| } | |
| if (name.equals("TRIANGLE_CLOSED")) { | |
| MyDraw.SMALL_TRIANGLE_CLOSED = v_img(); | |
| } | |
| if (name.equals("TRIANGLE_OPEN")) { | |
| MyDraw.SMALL_TRIANGLE_OPEN = v_img(); | |
| } | |
| if (name.equals("PROGRESS_BAR_H")) { | |
| MyDraw.SMALL_PROGRESS_BAR_H = v_int(); | |
| } | |
| if (name.equals("PROGRESS_BAR_INSIDE")) { | |
| MyDraw.PROGRESS_BAR_INSIDE = v_clr(); | |
| } | |
| if (name.equals("PROGRESS_BAR_DEEP_INSIDE")) { | |
| MyDraw.PROGRESS_BAR_DEEP_INSIDE = v_clr(); | |
| } | |
| if (name.equals("SCROLL_EL_SPACING")) { | |
| MyDraw.SMALL_SCROLL_EL_SPACING = v_int(); | |
| } | |
| if (name.equals("SIDE_CLEARANCE")) { | |
| MyDraw.SMALL_SIDE_CLEARANCE = v_int(); | |
| } | |
| if (name.equals("TOP_BAR_H")) { | |
| MyDraw.SMALL_TOP_BAR_H = v_int(); | |
| } | |
| if (name.equals("TOP_BAR_INSET")) { | |
| MyDraw.SMALL_TOP_BAR_INSET = v_int(); | |
| } | |
| if (name.equals("TOP_BAR_TOP_SEGMENT")) { | |
| MyDraw.SMALL_TOP_BAR_TOP_SEGMENT = v_img(); | |
| } | |
| if (name.equals("TOP_BAR_BOTTOM_SEGMENT")) { | |
| MyDraw.SMALL_TOP_BAR_BOTTOM_SEGMENT = v_img(); | |
| } | |
| if (name.equals("RHS_WINDOW_SIDE_SEGMENT")) { | |
| MyDraw.SMALL_RHS_WINDOW_SIDE_SEGMENT = v_img(); | |
| } | |
| if (name.equals("LHS_WINDOW_SIDE_SEGMENT")) { | |
| MyDraw.SMALL_LHS_WINDOW_SIDE_SEGMENT = v_img(); | |
| } | |
| if (name.equals("PANEL_INSET")) { | |
| MyDraw.SMALL_PANEL_INSET = v_int(); | |
| } | |
| if (name.equals("PANEL_TL")) { | |
| MyDraw.SMALL_PANEL_TL = v_img(); | |
| } | |
| if (name.equals("PANEL_BL")) { | |
| MyDraw.SMALL_PANEL_BL = v_img(); | |
| } | |
| if (name.equals("PANEL_TR")) { | |
| MyDraw.SMALL_PANEL_TR = v_img(); | |
| } | |
| if (name.equals("PANEL_BR")) { | |
| MyDraw.SMALL_PANEL_BR = v_img(); | |
| } | |
| if (name.equals("PANEL_T")) { | |
| MyDraw.SMALL_PANEL_T = v_img(); | |
| } | |
| if (name.equals("PANEL_L")) { | |
| MyDraw.SMALL_PANEL_L = v_img(); | |
| } | |
| if (name.equals("PANEL_R")) { | |
| MyDraw.SMALL_PANEL_R = v_img(); | |
| } | |
| if (name.equals("PANEL_B")) { | |
| MyDraw.SMALL_PANEL_B = v_img(); | |
| } | |
| if (name.equals("S_PANEL_TL")) { | |
| MyDraw.SMALL_S_PANEL_TL = v_img(); | |
| } | |
| if (name.equals("S_PANEL_BL")) { | |
| MyDraw.SMALL_S_PANEL_BL = v_img(); | |
| } | |
| if (name.equals("S_PANEL_TR")) { | |
| MyDraw.SMALL_S_PANEL_TR = v_img(); | |
| } | |
| if (name.equals("S_PANEL_BR")) { | |
| MyDraw.SMALL_S_PANEL_BR = v_img(); | |
| } | |
| if (name.equals("S_PANEL_T")) { | |
| MyDraw.SMALL_S_PANEL_T = v_img(); | |
| } | |
| if (name.equals("S_PANEL_L")) { | |
| MyDraw.SMALL_S_PANEL_L = v_img(); | |
| } | |
| if (name.equals("S_PANEL_R")) { | |
| MyDraw.SMALL_S_PANEL_R = v_img(); | |
| } | |
| if (name.equals("S_PANEL_B")) { | |
| MyDraw.SMALL_S_PANEL_B = v_img(); | |
| } | |
| if (name.equals("WINDOW_INSET")) { | |
| MyDraw.SMALL_WINDOW_INSET = v_int(); | |
| } | |
| if (name.equals("WIN_SHADOW")) { | |
| MyDraw.WIN_SHADOW = v_clr(); | |
| } | |
| if (name.equals("WIN_TL")) { | |
| MyDraw.SMALL_WIN_TL = v_img(); | |
| } | |
| if (name.equals("WIN_BL")) { | |
| MyDraw.SMALL_WIN_BL = v_img(); | |
| } | |
| if (name.equals("WIN_TR")) { | |
| MyDraw.SMALL_WIN_TR = v_img(); | |
| } | |
| if (name.equals("WIN_BR")) { | |
| MyDraw.SMALL_WIN_BR = v_img(); | |
| } | |
| if (name.equals("WIN_T")) { | |
| MyDraw.SMALL_WIN_T = v_img(); | |
| } | |
| if (name.equals("WIN_L")) { | |
| MyDraw.SMALL_WIN_L = v_img(); | |
| } | |
| if (name.equals("WIN_R")) { | |
| MyDraw.SMALL_WIN_R = v_img(); | |
| } | |
| if (name.equals("WIN_B")) { | |
| MyDraw.SMALL_WIN_B = v_img(); | |
| } | |
| if (name.equals("S_WIN_TL")) { | |
| MyDraw.SMALL_S_WIN_TL = v_img(); | |
| } | |
| if (name.equals("S_WIN_BL")) { | |
| MyDraw.SMALL_S_WIN_BL = v_img(); | |
| } | |
| if (name.equals("S_WIN_TR")) { | |
| MyDraw.SMALL_S_WIN_TR = v_img(); | |
| } | |
| if (name.equals("S_WIN_BR")) { | |
| MyDraw.SMALL_S_WIN_BR = v_img(); | |
| } | |
| if (name.equals("S_WIN_T")) { | |
| MyDraw.SMALL_S_WIN_T = v_img(); | |
| } | |
| if (name.equals("S_WIN_L")) { | |
| MyDraw.SMALL_S_WIN_L = v_img(); | |
| } | |
| if (name.equals("S_WIN_R")) { | |
| MyDraw.SMALL_S_WIN_R = v_img(); | |
| } | |
| if (name.equals("S_WIN_B")) { | |
| MyDraw.SMALL_S_WIN_B = v_img(); | |
| } | |
| if (name.equals("BUTTON_H")) { | |
| MyDraw.SMALL_BUTTON_H = v_int(); | |
| } | |
| if (name.equals("BUTTON_DIS_START")) { | |
| MyDraw.SMALL_BUTTON_DIS_START = v_img(); | |
| } | |
| if (name.equals("BUTTON_DIS_MIDDLE")) { | |
| MyDraw.SMALL_BUTTON_DIS_MIDDLE = v_img(); | |
| } | |
| if (name.equals("BUTTON_DIS_END")) { | |
| MyDraw.SMALL_BUTTON_DIS_END = v_img(); | |
| } | |
| if (name.equals("BUTTON_START")) { | |
| MyDraw.SMALL_BUTTON_START = v_img(); | |
| } | |
| if (name.equals("BUTTON_MIDDLE")) { | |
| MyDraw.SMALL_BUTTON_MIDDLE = v_img(); | |
| } | |
| if (name.equals("BUTTON_END")) { | |
| MyDraw.SMALL_BUTTON_END = v_img(); | |
| } | |
| if (name.equals("BUTTON_LIT_START")) { | |
| MyDraw.SMALL_BUTTON_LIT_START = v_img(); | |
| } | |
| if (name.equals("BUTTON_LIT_MIDDLE")) { | |
| MyDraw.SMALL_BUTTON_LIT_MIDDLE = v_img(); | |
| } | |
| if (name.equals("BUTTON_LIT_END")) { | |
| MyDraw.SMALL_BUTTON_LIT_END = v_img(); | |
| } | |
| if (name.equals("TOGGLE_OFF_START")) { | |
| MyDraw.SMALL_TOGGLE_OFF_START = v_img(); | |
| } | |
| if (name.equals("TOGGLE_OFF_MIDDLE")) { | |
| MyDraw.SMALL_TOGGLE_OFF_MIDDLE = v_img(); | |
| } | |
| if (name.equals("TOGGLE_OFF_END")) { | |
| MyDraw.SMALL_TOGGLE_OFF_END = v_img(); | |
| } | |
| if (name.equals("TOGGLE_ON_START")) { | |
| MyDraw.SMALL_TOGGLE_ON_START = v_img(); | |
| } | |
| if (name.equals("TOGGLE_ON_MIDDLE")) { | |
| MyDraw.SMALL_TOGGLE_ON_MIDDLE = v_img(); | |
| } | |
| if (name.equals("TOGGLE_ON_END")) { | |
| MyDraw.SMALL_TOGGLE_ON_END = v_img(); | |
| } | |
| if (name.equals("TOGGLE_OFF_LIT_START")) { | |
| MyDraw.SMALL_TOGGLE_OFF_LIT_START = v_img(); | |
| } | |
| if (name.equals("TOGGLE_OFF_LIT_MIDDLE")) { | |
| MyDraw.SMALL_TOGGLE_OFF_LIT_MIDDLE = v_img(); | |
| } | |
| if (name.equals("TOGGLE_OFF_LIT_END")) { | |
| MyDraw.SMALL_TOGGLE_OFF_LIT_END = v_img(); | |
| } | |
| if (name.equals("TOGGLE_ON_LIT_START")) { | |
| MyDraw.SMALL_TOGGLE_ON_LIT_START = v_img(); | |
| } | |
| if (name.equals("TOGGLE_ON_LIT_MIDDLE")) { | |
| MyDraw.SMALL_TOGGLE_ON_LIT_MIDDLE = v_img(); | |
| } | |
| if (name.equals("TOGGLE_ON_LIT_END")) { | |
| MyDraw.SMALL_TOGGLE_ON_LIT_END = v_img(); | |
| } | |
| if (name.equals("BIG_BUTTON_H")) { | |
| MyDraw.SMALL_BIG_BUTTON_H = v_int(); | |
| } | |
| if (name.equals("BUTTON_EXTRA_W")) { | |
| MyDraw.SMALL_BUTTON_EXTRA_W = v_int(); | |
| } | |
| if (name.equals("TOGGLE_EXTRA_W")) { | |
| MyDraw.SMALL_TOGGLE_EXTRA_W = v_int(); | |
| } | |
| if (name.equals("BB_TL")) { | |
| MyDraw.SMALL_BB_TL = v_img(); | |
| } | |
| if (name.equals("BB_T")) { | |
| MyDraw.SMALL_BB_T = v_img(); | |
| } | |
| if (name.equals("BB_TR")) { | |
| MyDraw.SMALL_BB_TR = v_img(); | |
| } | |
| if (name.equals("BB_R")) { | |
| MyDraw.SMALL_BB_R = v_img(); | |
| } | |
| if (name.equals("BB_BR")) { | |
| MyDraw.SMALL_BB_BR = v_img(); | |
| } | |
| if (name.equals("BB_B")) { | |
| MyDraw.SMALL_BB_B = v_img(); | |
| } | |
| if (name.equals("BB_BL")) { | |
| MyDraw.SMALL_BB_BL = v_img(); | |
| } | |
| if (name.equals("BB_L")) { | |
| MyDraw.SMALL_BB_L = v_img(); | |
| } | |
| if (name.equals("BB_CENTER")) { | |
| MyDraw.BB_CENTER = v_clr(); | |
| } | |
| if (name.equals("HBB_TL")) { | |
| MyDraw.SMALL_HBB_TL = v_img(); | |
| } | |
| if (name.equals("HBB_T")) { | |
| MyDraw.SMALL_HBB_T = v_img(); | |
| } | |
| if (name.equals("HBB_TR")) { | |
| MyDraw.SMALL_HBB_TR = v_img(); | |
| } | |
| if (name.equals("HBB_R")) { | |
| MyDraw.SMALL_HBB_R = v_img(); | |
| } | |
| if (name.equals("HBB_BR")) { | |
| MyDraw.SMALL_HBB_BR = v_img(); | |
| } | |
| if (name.equals("HBB_B")) { | |
| MyDraw.SMALL_HBB_B = v_img(); | |
| } | |
| if (name.equals("HBB_BL")) { | |
| MyDraw.SMALL_HBB_BL = v_img(); | |
| } | |
| if (name.equals("HBB_L")) { | |
| MyDraw.SMALL_HBB_L = v_img(); | |
| } | |
| if (name.equals("HBB_CENTER")) { | |
| MyDraw.HBB_CENTER = v_clr(); | |
| } | |
| if (name.equals("TOGGLE_OFF_INSIDE")) { | |
| MyDraw.TOGGLE_OFF_INSIDE = v_clr(); | |
| } | |
| if (name.equals("ICON_BUTTON_SZ")) { | |
| MyDraw.SMALL_ICON_BUTTON_SZ = v_int(); | |
| } | |
| if (name.equals("ICON_BUTTON")) { | |
| MyDraw.SMALL_ICON_BUTTON = v_img(); | |
| } | |
| if (name.equals("ICON_BUTTON_LIT")) { | |
| MyDraw.SMALL_ICON_BUTTON_LIT = v_img(); | |
| } | |
| if (name.equals("ICON_BUTTON_DISABLED")) { | |
| MyDraw.SMALL_ICON_BUTTON_DISABLED = v_img(); | |
| } | |
| if (name.equals("ICON_TOGGLE_OFF")) { | |
| MyDraw.SMALL_ICON_TOGGLE_OFF = v_img(); | |
| } | |
| if (name.equals("ICON_TOGGLE_ON")) { | |
| MyDraw.SMALL_ICON_TOGGLE_ON = v_img(); | |
| } | |
| if (name.equals("ICON_TINT")) { | |
| MyDraw.ICON_TINT = v_clr(); | |
| } | |
| if (name.equals("LIT_ICON_TINT")) { | |
| MyDraw.LIT_ICON_TINT = v_clr(); | |
| } | |
| if (name.equals("WIN_BG")) { | |
| MyDraw.WIN_BG = v_img(); | |
| } | |
| if (name.equals("DARK_WIN_BG")) { | |
| MyDraw.DARK_WIN_BG = v_img(); | |
| } | |
| if (name.equals("SCREEN_BG")) { | |
| MyDraw.SCREEN_BG = v_img(); | |
| } | |
| if (name.equals("SKY")) { | |
| AGame.SKY = v_clr(); | |
| } | |
| if (name.equals("LOADING_LOGO")) { | |
| LoadingScreen.LOADING_LOGO = v_img(); | |
| } | |
| if (name.equals("FOUNT")) { | |
| AGame.SMALL_FOUNT = v_fount(); | |
| } | |
| if (name.equals("FOUNT_OUTLINE")) { | |
| AGame.SMALL_FOUNT_OUTLINE = v_fount(); | |
| } | |
| if (name.equals("BIG_FOUNT")) { | |
| AGame.SMALL_BIG_FOUNT = v_fount(); | |
| } | |
| if (name.equals("BIG_FOUNT_OUTLINE")) { | |
| AGame.SMALL_BIG_FOUNT_OUTLINE = v_fount(); | |
| } | |
| if (name.equals("BIGGER_FOUNT")) { | |
| AGame.SMALL_BIGGER_FOUNT = v_fount(); | |
| } | |
| if (name.equals("MAP")) { | |
| AGame.SMALL_MAP = v_fount(); | |
| } | |
| if (name.equals("MAP_OUTLINE")) { | |
| AGame.SMALL_MAP_OUTLINE = v_fount(); | |
| } | |
| if (name.equals("HUGE_FOUNT")) { | |
| AGame.HUGE_FOUNTS = v_fount(); | |
| } | |
| if (name.equals("STENCIL")) { | |
| AGame.STENCILS = v_fount(); | |
| } | |
| if (name.equals("BUTTON_TEXT_Y_OFFSET")) { | |
| MyDraw.SMALL_BUTTON_TEXT_Y_OFFSET = v_int(); | |
| } | |
| if (name.equals("BIG_BUTTON_TEXT_Y_OFFSET")) { | |
| MyDraw.SMALL_BIG_BUTTON_TEXT_Y_OFFSET = v_int(); | |
| } | |
| if (name.equals("BUTTON_TEXT_COLOR")) { | |
| MyDraw.BUTTON_TEXT_COLOR = "[" + v_clr().toString() + "]"; | |
| } | |
| if (name.equals("BUTTON_HOTKEY_COLOR")) { | |
| MyDraw.BUTTON_HOTKEY_COLOR = "[" + v_clr().toString() + "]"; | |
| } | |
| if (name.equals("UI_GLOW_COLOR")) { | |
| MyDraw.UI_GLOW_COLOR = v_clr(); | |
| } | |
| if (name.equals("GOLD_BUTTON_GLOW")) { | |
| MyDraw.GOLD_BUTTON_GLOW = v_clr(); | |
| } | |
| if (name.equals("SCROLL_BAR_W")) { | |
| ScrollBar.SMALL_SCROLL_BAR_W = v_int(); | |
| } | |
| if (name.equals("UP_BUTTON")) { | |
| ScrollBar.SMALL_UP_BUTTON = v_img(); | |
| } | |
| if (name.equals("DOWN_BUTTON")) { | |
| ScrollBar.SMALL_DOWN_BUTTON = v_img(); | |
| } | |
| if (name.equals("UP_BUTTON_LIT")) { | |
| ScrollBar.SMALL_UP_BUTTON_LIT = v_img(); | |
| } | |
| if (name.equals("DOWN_BUTTON_LIT")) { | |
| ScrollBar.SMALL_DOWN_BUTTON_LIT = v_img(); | |
| } | |
| if (name.equals("SMALL_UP_BUTTON_DISABLED")) { | |
| ScrollBar.SMALL_UP_BUTTON_DISABLED = v_img(); | |
| } | |
| if (name.equals("SMALL_DOWN_BUTTON_DISABLED")) { | |
| ScrollBar.SMALL_DOWN_BUTTON_DISABLED = v_img(); | |
| } | |
| if (name.equals("SCROLL_THUMB_TOP")) { | |
| ScrollBar.SMALL_SCROLL_THUMB_TOP = v_img(); | |
| } | |
| if (name.equals("SCROLL_THUMB_MIDDLE")) { | |
| ScrollBar.SMALL_SCROLL_THUMB_MIDDLE = v_img(); | |
| } | |
| if (name.equals("SCROLL_THUMB_BOTTOM")) { | |
| ScrollBar.SMALL_SCROLL_THUMB_BOTTOM = v_img(); | |
| } | |
| if (name.equals("LEFT_BORDER")) { | |
| ScrollBar.SMALL_LEFT_BORDER = v_img(); | |
| } | |
| if (name.equals("RIGHT_BORDER")) { | |
| ScrollBar.SMALL_RIGHT_BORDER = v_img(); | |
| } | |
| if (name.equals("BAR_BG")) { | |
| ScrollBar.BAR_BG = v_clr(); | |
| } | |
| if (name.equals("SHIP_SELECT")) { | |
| SelectionVisualLayer.SHIP_SELECT = v_clr(); | |
| } | |
| if (name.equals("SHIP_SELECT2")) { | |
| SelectionVisualLayer.SHIP_SELECT2 = v_clr(); | |
| } | |
| if (name.equals("SHIP_TARGET")) { | |
| SelectionVisualLayer.SHIP_TARGET = v_clr(); | |
| } | |
| if (name.equals("SHIP_TARGET2")) { | |
| SelectionVisualLayer.SHIP_TARGET2 = v_clr(); | |
| } | |
| if (name.equals("TROOPS_MOVE")) { | |
| SelectionVisualLayer.TROOPS_MOVE = v_clr(); | |
| } | |
| if (name.equals("TROOPS_MOVE2")) { | |
| SelectionVisualLayer.TROOPS_MOVE2 = v_clr(); | |
| } | |
| if (name.equals("TROOPS_MOVE")) { | |
| SelectionVisualLayer.TROOPS_BOARD = v_clr(); | |
| } | |
| if (name.equals("TROOPS_MOVE2")) { | |
| SelectionVisualLayer.TROOPS_BOARD2 = v_clr(); | |
| } | |
| if (name.equals("SHOUT_BUBBLE_LEFT")) { | |
| ShoutOverlay.SMALL_SHOUT_BUBBLE_LEFT = v_img(); | |
| } | |
| if (name.equals("SHOUT_BUBBLE_RIGHT")) { | |
| ShoutOverlay.SMALL_SHOUT_BUBBLE_RIGHT = v_img(); | |
| } | |
| if (name.equals("SHOUT_BUBBLE_C")) { | |
| ShoutOverlay.SHOUT_BUBBLE_C = v_clr(); | |
| } | |
| if (name.equals("SHOUT_TEXT_C")) { | |
| ShoutOverlay.SHOUT_TEXT_C = "[" + v_clr().toString() + "]"; | |
| } | |
| if (name.equals("STRATEGIC_MUSIC")) { | |
| AGame.STRATEGIC_MUSIC = v_StringList(); | |
| } | |
| if (name.equals("COMBAT_MUSIC")) { | |
| AGame.COMBAT_MUSIC = v_StringList(); | |
| } | |
| if (name.equals("EDITOR_MUSIC")) { | |
| AGame.EDITOR_MUSIC = v_StringList(); | |
| } | |
| if (name.equals("CITY_MUSIC")) { | |
| AGame.CITY_MUSIC = v_StringList(); | |
| } | |
| if (name.equals("LOADING_MUSIC")) { | |
| AGame.LOADING_MUSIC = v_StringList(); | |
| } | |
| if (name.equals("FIRE_ARC_ARC")) { | |
| Airship.FIRE_ARC_ARC = v_color(); | |
| } | |
| if (name.equals("FIRE_ARC_LINE")) { | |
| Airship.FIRE_ARC_LINE = v_color(); | |
| } | |
| if (name.equals("FIRE_ARC_DISABLED_ARC")) { | |
| Airship.FIRE_ARC_DISABLED_ARC = v_color(); | |
| } | |
| if (name.equals("FIRE_ARC_DISABLED_LINE")) { | |
| Airship.FIRE_ARC_DISABLED_LINE = v_color(); | |
| } | |
| // Medium GUI | |
| if (name.equals("MEDIUM_SLIDER_KNOB")) { | |
| MyDraw.MEDIUM_SLIDER_KNOB = v_img(); | |
| } | |
| if (name.equals("MEDIUM_BUTTON_SPACING")) { | |
| MyDraw.MEDIUM_BUTTON_SPACING = v_int(); | |
| } | |
| if (name.equals("MEDIUM_UI_SPACING")) { | |
| MyDraw.MEDIUM_UI_SPACING = v_int(); | |
| } | |
| if (name.equals("MEDIUM_TRIANGLE_CLOSED")) { | |
| MyDraw.MEDIUM_TRIANGLE_CLOSED = v_img(); | |
| } | |
| if (name.equals("MEDIUM_TRIANGLE_OPEN")) { | |
| MyDraw.MEDIUM_TRIANGLE_OPEN = v_img(); | |
| } | |
| if (name.equals("MEDIUM_PROGRESS_BAR_H")) { | |
| MyDraw.MEDIUM_PROGRESS_BAR_H = v_int(); | |
| } | |
| if (name.equals("MEDIUM_SCROLL_EL_SPACING")) { | |
| MyDraw.MEDIUM_SCROLL_EL_SPACING = v_int(); | |
| } | |
| if (name.equals("MEDIUM_SIDE_CLEARANCE")) { | |
| MyDraw.MEDIUM_SIDE_CLEARANCE = v_int(); | |
| } | |
| if (name.equals("MEDIUM_TOP_BAR_H")) { | |
| MyDraw.MEDIUM_TOP_BAR_H = v_int(); | |
| } | |
| if (name.equals("MEDIUM_TOP_BAR_INSET")) { | |
| MyDraw.MEDIUM_TOP_BAR_INSET = v_int(); | |
| } | |
| if (name.equals("MEDIUM_TOP_BAR_TOP_SEGMENT")) { | |
| MyDraw.MEDIUM_TOP_BAR_TOP_SEGMENT = v_img(); | |
| } | |
| if (name.equals("MEDIUM_TOP_BAR_BOTTOM_SEGMENT")) { | |
| MyDraw.MEDIUM_TOP_BAR_BOTTOM_SEGMENT = v_img(); | |
| } | |
| if (name.equals("MEDIUM_RHS_WINDOW_SIDE_SEGMENT")) { | |
| MyDraw.MEDIUM_RHS_WINDOW_SIDE_SEGMENT = v_img(); | |
| } | |
| if (name.equals("MEDIUM_LHS_WINDOW_SIDE_SEGMENT")) { | |
| MyDraw.MEDIUM_LHS_WINDOW_SIDE_SEGMENT = v_img(); | |
| } | |
| if (name.equals("MEDIUM_PANEL_INSET")) { | |
| MyDraw.MEDIUM_PANEL_INSET = v_int(); | |
| } | |
| if (name.equals("MEDIUM_PANEL_TL")) { | |
| MyDraw.MEDIUM_PANEL_TL = v_img(); | |
| } | |
| if (name.equals("MEDIUM_PANEL_BL")) { | |
| MyDraw.MEDIUM_PANEL_BL = v_img(); | |
| } | |
| if (name.equals("MEDIUM_PANEL_TR")) { | |
| MyDraw.MEDIUM_PANEL_TR = v_img(); | |
| } | |
| if (name.equals("MEDIUM_PANEL_BR")) { | |
| MyDraw.MEDIUM_PANEL_BR = v_img(); | |
| } | |
| if (name.equals("MEDIUM_PANEL_T")) { | |
| MyDraw.MEDIUM_PANEL_T = v_img(); | |
| } | |
| if (name.equals("MEDIUM_PANEL_L")) { | |
| MyDraw.MEDIUM_PANEL_L = v_img(); | |
| } | |
| if (name.equals("MEDIUM_PANEL_R")) { | |
| MyDraw.MEDIUM_PANEL_R = v_img(); | |
| } | |
| if (name.equals("MEDIUM_PANEL_B")) { | |
| MyDraw.MEDIUM_PANEL_B = v_img(); | |
| } | |
| if (name.equals("MEDIUM_S_PANEL_TL")) { | |
| MyDraw.MEDIUM_S_PANEL_TL = v_img(); | |
| } | |
| if (name.equals("MEDIUM_S_PANEL_BL")) { | |
| MyDraw.MEDIUM_S_PANEL_BL = v_img(); | |
| } | |
| if (name.equals("MEDIUM_S_PANEL_TR")) { | |
| MyDraw.MEDIUM_S_PANEL_TR = v_img(); | |
| } | |
| if (name.equals("MEDIUM_S_PANEL_BR")) { | |
| MyDraw.MEDIUM_S_PANEL_BR = v_img(); | |
| } | |
| if (name.equals("MEDIUM_S_PANEL_T")) { | |
| MyDraw.MEDIUM_S_PANEL_T = v_img(); | |
| } | |
| if (name.equals("MEDIUM_S_PANEL_L")) { | |
| MyDraw.MEDIUM_S_PANEL_L = v_img(); | |
| } | |
| if (name.equals("MEDIUM_S_PANEL_R")) { | |
| MyDraw.MEDIUM_S_PANEL_R = v_img(); | |
| } | |
| if (name.equals("MEDIUM_S_PANEL_B")) { | |
| MyDraw.MEDIUM_S_PANEL_B = v_img(); | |
| } | |
| if (name.equals("MEDIUM_WINDOW_INSET")) { | |
| MyDraw.MEDIUM_WINDOW_INSET = v_int(); | |
| } | |
| if (name.equals("MEDIUM_WIN_TL")) { | |
| MyDraw.MEDIUM_WIN_TL = v_img(); | |
| } | |
| if (name.equals("MEDIUM_WIN_BL")) { | |
| MyDraw.MEDIUM_WIN_BL = v_img(); | |
| } | |
| if (name.equals("MEDIUM_WIN_TR")) { | |
| MyDraw.MEDIUM_WIN_TR = v_img(); | |
| } | |
| if (name.equals("MEDIUM_WIN_BR")) { | |
| MyDraw.MEDIUM_WIN_BR = v_img(); | |
| } | |
| if (name.equals("MEDIUM_WIN_T")) { | |
| MyDraw.MEDIUM_WIN_T = v_img(); | |
| } | |
| if (name.equals("MEDIUM_WIN_L")) { | |
| MyDraw.MEDIUM_WIN_L = v_img(); | |
| } | |
| if (name.equals("MEDIUM_WIN_R")) { | |
| MyDraw.MEDIUM_WIN_R = v_img(); | |
| } | |
| if (name.equals("MEDIUM_WIN_B")) { | |
| MyDraw.MEDIUM_WIN_B = v_img(); | |
| } | |
| if (name.equals("MEDIUM_S_WIN_TL")) { | |
| MyDraw.MEDIUM_S_WIN_TL = v_img(); | |
| } | |
| if (name.equals("MEDIUM_S_WIN_BL")) { | |
| MyDraw.MEDIUM_S_WIN_BL = v_img(); | |
| } | |
| if (name.equals("MEDIUM_S_WIN_TR")) { | |
| MyDraw.MEDIUM_S_WIN_TR = v_img(); | |
| } | |
| if (name.equals("MEDIUM_S_WIN_BR")) { | |
| MyDraw.MEDIUM_S_WIN_BR = v_img(); | |
| } | |
| if (name.equals("MEDIUM_S_WIN_T")) { | |
| MyDraw.MEDIUM_S_WIN_T = v_img(); | |
| } | |
| if (name.equals("MEDIUM_S_WIN_L")) { | |
| MyDraw.MEDIUM_S_WIN_L = v_img(); | |
| } | |
| if (name.equals("MEDIUM_S_WIN_R")) { | |
| MyDraw.MEDIUM_S_WIN_R = v_img(); | |
| } | |
| if (name.equals("MEDIUM_S_WIN_B")) { | |
| MyDraw.MEDIUM_S_WIN_B = v_img(); | |
| } | |
| if (name.equals("MEDIUM_BUTTON_H")) { | |
| MyDraw.MEDIUM_BUTTON_H = v_int(); | |
| } | |
| if (name.equals("MEDIUM_BUTTON_DIS_START")) { | |
| MyDraw.MEDIUM_BUTTON_DIS_START = v_img(); | |
| } | |
| if (name.equals("MEDIUM_BUTTON_DIS_MIDDLE")) { | |
| MyDraw.MEDIUM_BUTTON_DIS_MIDDLE = v_img(); | |
| } | |
| if (name.equals("MEDIUM_BUTTON_DIS_END")) { | |
| MyDraw.MEDIUM_BUTTON_DIS_END = v_img(); | |
| } | |
| if (name.equals("MEDIUM_BUTTON_START")) { | |
| MyDraw.MEDIUM_BUTTON_START = v_img(); | |
| } | |
| if (name.equals("MEDIUM_BUTTON_MIDDLE")) { | |
| MyDraw.MEDIUM_BUTTON_MIDDLE = v_img(); | |
| } | |
| if (name.equals("MEDIUM_BUTTON_END")) { | |
| MyDraw.MEDIUM_BUTTON_END = v_img(); | |
| } | |
| if (name.equals("MEDIUM_BUTTON_LIT_START")) { | |
| MyDraw.MEDIUM_BUTTON_LIT_START = v_img(); | |
| } | |
| if (name.equals("MEDIUM_BUTTON_LIT_MIDDLE")) { | |
| MyDraw.MEDIUM_BUTTON_LIT_MIDDLE = v_img(); | |
| } | |
| if (name.equals("MEDIUM_BUTTON_LIT_END")) { | |
| MyDraw.MEDIUM_BUTTON_LIT_END = v_img(); | |
| } | |
| if (name.equals("MEDIUM_TOGGLE_OFF_START")) { | |
| MyDraw.MEDIUM_TOGGLE_OFF_START = v_img(); | |
| } | |
| if (name.equals("MEDIUM_TOGGLE_OFF_MIDDLE")) { | |
| MyDraw.MEDIUM_TOGGLE_OFF_MIDDLE = v_img(); | |
| } | |
| if (name.equals("MEDIUM_TOGGLE_OFF_END")) { | |
| MyDraw.MEDIUM_TOGGLE_OFF_END = v_img(); | |
| } | |
| if (name.equals("MEDIUM_TOGGLE_ON_START")) { | |
| MyDraw.MEDIUM_TOGGLE_ON_START = v_img(); | |
| } | |
| if (name.equals("MEDIUM_TOGGLE_ON_MIDDLE")) { | |
| MyDraw.MEDIUM_TOGGLE_ON_MIDDLE = v_img(); | |
| } | |
| if (name.equals("MEDIUM_TOGGLE_ON_END")) { | |
| MyDraw.MEDIUM_TOGGLE_ON_END = v_img(); | |
| } | |
| if (name.equals("MEDIUM_TOGGLE_OFF_LIT_START")) { | |
| MyDraw.MEDIUM_TOGGLE_OFF_LIT_START = v_img(); | |
| } | |
| if (name.equals("MEDIUM_TOGGLE_OFF_LIT_MIDDLE")) { | |
| MyDraw.MEDIUM_TOGGLE_OFF_LIT_MIDDLE = v_img(); | |
| } | |
| if (name.equals("MEDIUM_TOGGLE_OFF_LIT_END")) { | |
| MyDraw.MEDIUM_TOGGLE_OFF_LIT_END = v_img(); | |
| } | |
| if (name.equals("MEDIUM_TOGGLE_ON_LIT_START")) { | |
| MyDraw.MEDIUM_TOGGLE_ON_LIT_START = v_img(); | |
| } | |
| if (name.equals("MEDIUM_TOGGLE_ON_LIT_MIDDLE")) { | |
| MyDraw.MEDIUM_TOGGLE_ON_LIT_MIDDLE = v_img(); | |
| } | |
| if (name.equals("MEDIUM_TOGGLE_ON_LIT_END")) { | |
| MyDraw.MEDIUM_TOGGLE_ON_LIT_END = v_img(); | |
| } | |
| if (name.equals("MEDIUM_BIG_BUTTON_H")) { | |
| MyDraw.MEDIUM_BIG_BUTTON_H = v_int(); | |
| } | |
| if (name.equals("MEDIUM_BUTTON_EXTRA_W")) { | |
| MyDraw.MEDIUM_BUTTON_EXTRA_W = v_int(); | |
| } | |
| if (name.equals("MEDIUM_TOGGLE_EXTRA_W")) { | |
| MyDraw.MEDIUM_TOGGLE_EXTRA_W = v_int(); | |
| } | |
| if (name.equals("MEDIUM_BB_TL")) { | |
| MyDraw.MEDIUM_BB_TL = v_img(); | |
| } | |
| if (name.equals("MEDIUM_BB_T")) { | |
| MyDraw.MEDIUM_BB_T = v_img(); | |
| } | |
| if (name.equals("MEDIUM_BB_TR")) { | |
| MyDraw.MEDIUM_BB_TR = v_img(); | |
| } | |
| if (name.equals("MEDIUM_BB_R")) { | |
| MyDraw.MEDIUM_BB_R = v_img(); | |
| } | |
| if (name.equals("MEDIUM_BB_BR")) { | |
| MyDraw.MEDIUM_BB_BR = v_img(); | |
| } | |
| if (name.equals("MEDIUM_BB_B")) { | |
| MyDraw.MEDIUM_BB_B = v_img(); | |
| } | |
| if (name.equals("MEDIUM_BB_BL")) { | |
| MyDraw.MEDIUM_BB_BL = v_img(); | |
| } | |
| if (name.equals("MEDIUM_BB_L")) { | |
| MyDraw.MEDIUM_BB_L = v_img(); | |
| } | |
| if (name.equals("MEDIUM_HBB_TL")) { | |
| MyDraw.MEDIUM_HBB_TL = v_img(); | |
| } | |
| if (name.equals("MEDIUM_HBB_T")) { | |
| MyDraw.MEDIUM_HBB_T = v_img(); | |
| } | |
| if (name.equals("MEDIUM_HBB_TR")) { | |
| MyDraw.MEDIUM_HBB_TR = v_img(); | |
| } | |
| if (name.equals("MEDIUM_HBB_R")) { | |
| MyDraw.MEDIUM_HBB_R = v_img(); | |
| } | |
| if (name.equals("MEDIUM_HBB_BR")) { | |
| MyDraw.MEDIUM_HBB_BR = v_img(); | |
| } | |
| if (name.equals("MEDIUM_HBB_B")) { | |
| MyDraw.MEDIUM_HBB_B = v_img(); | |
| } | |
| if (name.equals("MEDIUM_HBB_BL")) { | |
| MyDraw.MEDIUM_HBB_BL = v_img(); | |
| } | |
| if (name.equals("MEDIUM_HBB_L")) { | |
| MyDraw.MEDIUM_HBB_L = v_img(); | |
| } | |
| if (name.equals("MEDIUM_ICON_BUTTON_SZ")) { | |
| MyDraw.MEDIUM_ICON_BUTTON_SZ = v_int(); | |
| } | |
| if (name.equals("MEDIUM_ICON_BUTTON")) { | |
| MyDraw.MEDIUM_ICON_BUTTON = v_img(); | |
| } | |
| if (name.equals("MEDIUM_ICON_BUTTON_LIT")) { | |
| MyDraw.MEDIUM_ICON_BUTTON_LIT = v_img(); | |
| } | |
| if (name.equals("MEDIUM_ICON_BUTTON_DISABLED")) { | |
| MyDraw.MEDIUM_ICON_BUTTON_DISABLED = v_img(); | |
| } | |
| if (name.equals("MEDIUM_ICON_TOGGLE_OFF")) { | |
| MyDraw.MEDIUM_ICON_TOGGLE_OFF = v_img(); | |
| } | |
| if (name.equals("MEDIUM_ICON_TOGGLE_ON")) { | |
| MyDraw.MEDIUM_ICON_TOGGLE_ON = v_img(); | |
| } | |
| if (name.equals("MEDIUM_FOUNT")) { | |
| AGame.MEDIUM_FOUNT = v_fount(); | |
| } | |
| if (name.equals("MEDIUM_FOUNT_OUTLINE")) { | |
| AGame.MEDIUM_FOUNT_OUTLINE = v_fount(); | |
| } | |
| if (name.equals("MEDIUM_BIG_FOUNT")) { | |
| AGame.MEDIUM_BIG_FOUNT = v_fount(); | |
| } | |
| if (name.equals("MEDIUM_BIG_FOUNT_OUTLINE")) { | |
| AGame.MEDIUM_BIG_FOUNT_OUTLINE = v_fount(); | |
| } | |
| if (name.equals("MEDIUM_BIGGER_FOUNT")) { | |
| AGame.MEDIUM_BIGGER_FOUNT = v_fount(); | |
| } | |
| if (name.equals("MEDIUM_MAP")) { | |
| AGame.MEDIUM_MAP = v_fount(); | |
| } | |
| if (name.equals("MEDIUM_MAP_OUTLINE")) { | |
| AGame.MEDIUM_MAP_OUTLINE = v_fount(); | |
| } | |
| if (name.equals("MEDIUM_BUTTON_TEXT_Y_OFFSET")) { | |
| MyDraw.MEDIUM_BUTTON_TEXT_Y_OFFSET = v_int(); | |
| } | |
| if (name.equals("MEDIUM_BIG_BUTTON_TEXT_Y_OFFSET")) { | |
| MyDraw.MEDIUM_BIG_BUTTON_TEXT_Y_OFFSET = v_int(); | |
| } | |
| if (name.equals("MEDIUM_SCROLL_BAR_W")) { | |
| ScrollBar.MEDIUM_SCROLL_BAR_W = v_int(); | |
| } | |
| if (name.equals("MEDIUM_UP_BUTTON")) { | |
| ScrollBar.MEDIUM_UP_BUTTON = v_img(); | |
| } | |
| if (name.equals("MEDIUM_DOWN_BUTTON")) { | |
| ScrollBar.MEDIUM_DOWN_BUTTON = v_img(); | |
| } | |
| if (name.equals("MEDIUM_UP_BUTTON_LIT")) { | |
| ScrollBar.MEDIUM_UP_BUTTON_LIT = v_img(); | |
| } | |
| if (name.equals("MEDIUM_DOWN_BUTTON_LIT")) { | |
| ScrollBar.MEDIUM_DOWN_BUTTON_LIT = v_img(); | |
| } | |
| if (name.equals("MEDIUM_UP_BUTTON_DISABLED")) { | |
| ScrollBar.MEDIUM_UP_BUTTON_DISABLED = v_img(); | |
| } | |
| if (name.equals("MEDIUM_DOWN_BUTTON_DISABLED")) { | |
| ScrollBar.MEDIUM_DOWN_BUTTON_DISABLED = v_img(); | |
| } | |
| if (name.equals("MEDIUM_SCROLL_THUMB_TOP")) { | |
| ScrollBar.MEDIUM_SCROLL_THUMB_TOP = v_img(); | |
| } | |
| if (name.equals("MEDIUM_SCROLL_THUMB_MIDDLE")) { | |
| ScrollBar.MEDIUM_SCROLL_THUMB_MIDDLE = v_img(); | |
| } | |
| if (name.equals("MEDIUM_SCROLL_THUMB_BOTTOM")) { | |
| ScrollBar.MEDIUM_SCROLL_THUMB_BOTTOM = v_img(); | |
| } | |
| if (name.equals("MEDIUM_LEFT_BORDER")) { | |
| ScrollBar.MEDIUM_LEFT_BORDER = v_img(); | |
| } | |
| if (name.equals("MEDIUM_RIGHT_BORDER")) { | |
| ScrollBar.MEDIUM_RIGHT_BORDER = v_img(); | |
| } | |
| if (name.equals("MEDIUM_SHOUT_BUBBLE_LEFT")) { | |
| ShoutOverlay.MEDIUM_SHOUT_BUBBLE_LEFT = v_img(); | |
| } | |
| if (name.equals("MEDIUM_SHOUT_BUBBLE_RIGHT")) { | |
| ShoutOverlay.MEDIUM_SHOUT_BUBBLE_RIGHT = v_img(); | |
| } | |
| // Large GUI | |
| if (name.equals("LARGE_SLIDER_KNOB")) { | |
| MyDraw.LARGE_SLIDER_KNOB = v_img(); | |
| } | |
| if (name.equals("LARGE_BUTTON_SPACING")) { | |
| MyDraw.LARGE_BUTTON_SPACING = v_int(); | |
| } | |
| if (name.equals("LARGE_UI_SPACING")) { | |
| MyDraw.LARGE_UI_SPACING = v_int(); | |
| } | |
| if (name.equals("LARGE_TRIANGLE_CLOSED")) { | |
| MyDraw.LARGE_TRIANGLE_CLOSED = v_img(); | |
| } | |
| if (name.equals("LARGE_TRIANGLE_OPEN")) { | |
| MyDraw.LARGE_TRIANGLE_OPEN = v_img(); | |
| } | |
| if (name.equals("LARGE_PROGRESS_BAR_H")) { | |
| MyDraw.LARGE_PROGRESS_BAR_H = v_int(); | |
| } | |
| if (name.equals("LARGE_SCROLL_EL_SPACING")) { | |
| MyDraw.LARGE_SCROLL_EL_SPACING = v_int(); | |
| } | |
| if (name.equals("LARGE_SIDE_CLEARANCE")) { | |
| MyDraw.LARGE_SIDE_CLEARANCE = v_int(); | |
| } | |
| if (name.equals("LARGE_TOP_BAR_H")) { | |
| MyDraw.LARGE_TOP_BAR_H = v_int(); | |
| } | |
| if (name.equals("LARGE_TOP_BAR_INSET")) { | |
| MyDraw.LARGE_TOP_BAR_INSET = v_int(); | |
| } | |
| if (name.equals("LARGE_TOP_BAR_TOP_SEGMENT")) { | |
| MyDraw.LARGE_TOP_BAR_TOP_SEGMENT = v_img(); | |
| } | |
| if (name.equals("LARGE_TOP_BAR_BOTTOM_SEGMENT")) { | |
| MyDraw.LARGE_TOP_BAR_BOTTOM_SEGMENT = v_img(); | |
| } | |
| if (name.equals("LARGE_RHS_WINDOW_SIDE_SEGMENT")) { | |
| MyDraw.LARGE_RHS_WINDOW_SIDE_SEGMENT = v_img(); | |
| } | |
| if (name.equals("LARGE_LHS_WINDOW_SIDE_SEGMENT")) { | |
| MyDraw.LARGE_LHS_WINDOW_SIDE_SEGMENT = v_img(); | |
| } | |
| if (name.equals("LARGE_PANEL_INSET")) { | |
| MyDraw.LARGE_PANEL_INSET = v_int(); | |
| } | |
| if (name.equals("LARGE_PANEL_TL")) { | |
| MyDraw.LARGE_PANEL_TL = v_img(); | |
| } | |
| if (name.equals("LARGE_PANEL_BL")) { | |
| MyDraw.LARGE_PANEL_BL = v_img(); | |
| } | |
| if (name.equals("LARGE_PANEL_TR")) { | |
| MyDraw.LARGE_PANEL_TR = v_img(); | |
| } | |
| if (name.equals("LARGE_PANEL_BR")) { | |
| MyDraw.LARGE_PANEL_BR = v_img(); | |
| } | |
| if (name.equals("LARGE_PANEL_T")) { | |
| MyDraw.LARGE_PANEL_T = v_img(); | |
| } | |
| if (name.equals("LARGE_PANEL_L")) { | |
| MyDraw.LARGE_PANEL_L = v_img(); | |
| } | |
| if (name.equals("LARGE_PANEL_R")) { | |
| MyDraw.LARGE_PANEL_R = v_img(); | |
| } | |
| if (name.equals("LARGE_PANEL_B")) { | |
| MyDraw.LARGE_PANEL_B = v_img(); | |
| } | |
| if (name.equals("LARGE_S_PANEL_TL")) { | |
| MyDraw.LARGE_S_PANEL_TL = v_img(); | |
| } | |
| if (name.equals("LARGE_S_PANEL_BL")) { | |
| MyDraw.LARGE_S_PANEL_BL = v_img(); | |
| } | |
| if (name.equals("LARGE_S_PANEL_TR")) { | |
| MyDraw.LARGE_S_PANEL_TR = v_img(); | |
| } | |
| if (name.equals("LARGE_S_PANEL_BR")) { | |
| MyDraw.LARGE_S_PANEL_BR = v_img(); | |
| } | |
| if (name.equals("LARGE_S_PANEL_T")) { | |
| MyDraw.LARGE_S_PANEL_T = v_img(); | |
| } | |
| if (name.equals("LARGE_S_PANEL_L")) { | |
| MyDraw.LARGE_S_PANEL_L = v_img(); | |
| } | |
| if (name.equals("LARGE_S_PANEL_R")) { | |
| MyDraw.LARGE_S_PANEL_R = v_img(); | |
| } | |
| if (name.equals("LARGE_S_PANEL_B")) { | |
| MyDraw.LARGE_S_PANEL_B = v_img(); | |
| } | |
| if (name.equals("LARGE_WINDOW_INSET")) { | |
| MyDraw.LARGE_WINDOW_INSET = v_int(); | |
| } | |
| if (name.equals("LARGE_WIN_TL")) { | |
| MyDraw.LARGE_WIN_TL = v_img(); | |
| } | |
| if (name.equals("LARGE_WIN_BL")) { | |
| MyDraw.LARGE_WIN_BL = v_img(); | |
| } | |
| if (name.equals("LARGE_WIN_TR")) { | |
| MyDraw.LARGE_WIN_TR = v_img(); | |
| } | |
| if (name.equals("LARGE_WIN_BR")) { | |
| MyDraw.LARGE_WIN_BR = v_img(); | |
| } | |
| if (name.equals("LARGE_WIN_T")) { | |
| MyDraw.LARGE_WIN_T = v_img(); | |
| } | |
| if (name.equals("LARGE_WIN_L")) { | |
| MyDraw.LARGE_WIN_L = v_img(); | |
| } | |
| if (name.equals("LARGE_WIN_R")) { | |
| MyDraw.LARGE_WIN_R = v_img(); | |
| } | |
| if (name.equals("LARGE_WIN_B")) { | |
| MyDraw.LARGE_WIN_B = v_img(); | |
| } | |
| if (name.equals("LARGE_S_WIN_TL")) { | |
| MyDraw.LARGE_S_WIN_TL = v_img(); | |
| } | |
| if (name.equals("LARGE_S_WIN_BL")) { | |
| MyDraw.LARGE_S_WIN_BL = v_img(); | |
| } | |
| if (name.equals("LARGE_S_WIN_TR")) { | |
| MyDraw.LARGE_S_WIN_TR = v_img(); | |
| } | |
| if (name.equals("LARGE_S_WIN_BR")) { | |
| MyDraw.LARGE_S_WIN_BR = v_img(); | |
| } | |
| if (name.equals("LARGE_S_WIN_T")) { | |
| MyDraw.LARGE_S_WIN_T = v_img(); | |
| } | |
| if (name.equals("LARGE_S_WIN_L")) { | |
| MyDraw.LARGE_S_WIN_L = v_img(); | |
| } | |
| if (name.equals("LARGE_S_WIN_R")) { | |
| MyDraw.LARGE_S_WIN_R = v_img(); | |
| } | |
| if (name.equals("LARGE_S_WIN_B")) { | |
| MyDraw.LARGE_S_WIN_B = v_img(); | |
| } | |
| if (name.equals("LARGE_BUTTON_H")) { | |
| MyDraw.LARGE_BUTTON_H = v_int(); | |
| } | |
| if (name.equals("LARGE_BUTTON_DIS_START")) { | |
| MyDraw.LARGE_BUTTON_DIS_START = v_img(); | |
| } | |
| if (name.equals("LARGE_BUTTON_DIS_MIDDLE")) { | |
| MyDraw.LARGE_BUTTON_DIS_MIDDLE = v_img(); | |
| } | |
| if (name.equals("LARGE_BUTTON_DIS_END")) { | |
| MyDraw.LARGE_BUTTON_DIS_END = v_img(); | |
| } | |
| if (name.equals("LARGE_BUTTON_START")) { | |
| MyDraw.LARGE_BUTTON_START = v_img(); | |
| } | |
| if (name.equals("LARGE_BUTTON_MIDDLE")) { | |
| MyDraw.LARGE_BUTTON_MIDDLE = v_img(); | |
| } | |
| if (name.equals("LARGE_BUTTON_END")) { | |
| MyDraw.LARGE_BUTTON_END = v_img(); | |
| } | |
| if (name.equals("LARGE_BUTTON_LIT_START")) { | |
| MyDraw.LARGE_BUTTON_LIT_START = v_img(); | |
| } | |
| if (name.equals("LARGE_BUTTON_LIT_MIDDLE")) { | |
| MyDraw.LARGE_BUTTON_LIT_MIDDLE = v_img(); | |
| } | |
| if (name.equals("LARGE_BUTTON_LIT_END")) { | |
| MyDraw.LARGE_BUTTON_LIT_END = v_img(); | |
| } | |
| if (name.equals("LARGE_TOGGLE_OFF_START")) { | |
| MyDraw.LARGE_TOGGLE_OFF_START = v_img(); | |
| } | |
| if (name.equals("LARGE_TOGGLE_OFF_MIDDLE")) { | |
| MyDraw.LARGE_TOGGLE_OFF_MIDDLE = v_img(); | |
| } | |
| if (name.equals("LARGE_TOGGLE_OFF_END")) { | |
| MyDraw.LARGE_TOGGLE_OFF_END = v_img(); | |
| } | |
| if (name.equals("LARGE_TOGGLE_ON_START")) { | |
| MyDraw.LARGE_TOGGLE_ON_START = v_img(); | |
| } | |
| if (name.equals("LARGE_TOGGLE_ON_MIDDLE")) { | |
| MyDraw.LARGE_TOGGLE_ON_MIDDLE = v_img(); | |
| } | |
| if (name.equals("LARGE_TOGGLE_ON_END")) { | |
| MyDraw.LARGE_TOGGLE_ON_END = v_img(); | |
| } | |
| if (name.equals("LARGE_TOGGLE_OFF_LIT_START")) { | |
| MyDraw.LARGE_TOGGLE_OFF_LIT_START = v_img(); | |
| } | |
| if (name.equals("LARGE_TOGGLE_OFF_LIT_MIDDLE")) { | |
| MyDraw.LARGE_TOGGLE_OFF_LIT_MIDDLE = v_img(); | |
| } | |
| if (name.equals("LARGE_TOGGLE_OFF_LIT_END")) { | |
| MyDraw.LARGE_TOGGLE_OFF_LIT_END = v_img(); | |
| } | |
| if (name.equals("LARGE_TOGGLE_ON_LIT_START")) { | |
| MyDraw.LARGE_TOGGLE_ON_LIT_START = v_img(); | |
| } | |
| if (name.equals("LARGE_TOGGLE_ON_LIT_MIDDLE")) { | |
| MyDraw.LARGE_TOGGLE_ON_LIT_MIDDLE = v_img(); | |
| } | |
| if (name.equals("LARGE_TOGGLE_ON_LIT_END")) { | |
| MyDraw.LARGE_TOGGLE_ON_LIT_END = v_img(); | |
| } | |
| if (name.equals("LARGE_BIG_BUTTON_H")) { | |
| MyDraw.LARGE_BIG_BUTTON_H = v_int(); | |
| } | |
| if (name.equals("LARGE_BUTTON_EXTRA_W")) { | |
| MyDraw.LARGE_BUTTON_EXTRA_W = v_int(); | |
| } | |
| if (name.equals("LARGE_TOGGLE_EXTRA_W")) { | |
| MyDraw.LARGE_TOGGLE_EXTRA_W = v_int(); | |
| } | |
| if (name.equals("LARGE_BB_TL")) { | |
| MyDraw.LARGE_BB_TL = v_img(); | |
| } | |
| if (name.equals("LARGE_BB_T")) { | |
| MyDraw.LARGE_BB_T = v_img(); | |
| } | |
| if (name.equals("LARGE_BB_TR")) { | |
| MyDraw.LARGE_BB_TR = v_img(); | |
| } | |
| if (name.equals("LARGE_BB_R")) { | |
| MyDraw.LARGE_BB_R = v_img(); | |
| } | |
| if (name.equals("LARGE_BB_BR")) { | |
| MyDraw.LARGE_BB_BR = v_img(); | |
| } | |
| if (name.equals("LARGE_BB_B")) { | |
| MyDraw.LARGE_BB_B = v_img(); | |
| } | |
| if (name.equals("LARGE_BB_BL")) { | |
| MyDraw.LARGE_BB_BL = v_img(); | |
| } | |
| if (name.equals("LARGE_BB_L")) { | |
| MyDraw.LARGE_BB_L = v_img(); | |
| } | |
| if (name.equals("LARGE_HBB_TL")) { | |
| MyDraw.LARGE_HBB_TL = v_img(); | |
| } | |
| if (name.equals("LARGE_HBB_T")) { | |
| MyDraw.LARGE_HBB_T = v_img(); | |
| } | |
| if (name.equals("LARGE_HBB_TR")) { | |
| MyDraw.LARGE_HBB_TR = v_img(); | |
| } | |
| if (name.equals("LARGE_HBB_R")) { | |
| MyDraw.LARGE_HBB_R = v_img(); | |
| } | |
| if (name.equals("LARGE_HBB_BR")) { | |
| MyDraw.LARGE_HBB_BR = v_img(); | |
| } | |
| if (name.equals("LARGE_HBB_B")) { | |
| MyDraw.LARGE_HBB_B = v_img(); | |
| } | |
| if (name.equals("LARGE_HBB_BL")) { | |
| MyDraw.LARGE_HBB_BL = v_img(); | |
| } | |
| if (name.equals("LARGE_HBB_L")) { | |
| MyDraw.LARGE_HBB_L = v_img(); | |
| } | |
| if (name.equals("LARGE_ICON_BUTTON_SZ")) { | |
| MyDraw.LARGE_ICON_BUTTON_SZ = v_int(); | |
| } | |
| if (name.equals("LARGE_ICON_BUTTON")) { | |
| MyDraw.LARGE_ICON_BUTTON = v_img(); | |
| } | |
| if (name.equals("LARGE_ICON_BUTTON_LIT")) { | |
| MyDraw.LARGE_ICON_BUTTON_LIT = v_img(); | |
| } | |
| if (name.equals("LARGE_ICON_BUTTON_DISABLED")) { | |
| MyDraw.LARGE_ICON_BUTTON_DISABLED = v_img(); | |
| } | |
| if (name.equals("LARGE_ICON_TOGGLE_OFF")) { | |
| MyDraw.LARGE_ICON_TOGGLE_OFF = v_img(); | |
| } | |
| if (name.equals("LARGE_ICON_TOGGLE_ON")) { | |
| MyDraw.LARGE_ICON_TOGGLE_ON = v_img(); | |
| } | |
| if (name.equals("LARGE_FOUNT")) { | |
| AGame.LARGE_FOUNT = v_fount(); | |
| } | |
| if (name.equals("LARGE_FOUNT_OUTLINE")) { | |
| AGame.LARGE_FOUNT_OUTLINE = v_fount(); | |
| } | |
| if (name.equals("LARGE_BIG_FOUNT")) { | |
| AGame.LARGE_BIG_FOUNT = v_fount(); | |
| } | |
| if (name.equals("LARGE_BIG_FOUNT_OUTLINE")) { | |
| AGame.LARGE_BIG_FOUNT_OUTLINE = v_fount(); | |
| } | |
| if (name.equals("LARGE_BIGGER_FOUNT")) { | |
| AGame.LARGE_BIGGER_FOUNT = v_fount(); | |
| } | |
| if (name.equals("LARGE_MAP")) { | |
| AGame.LARGE_MAP = v_fount(); | |
| } | |
| if (name.equals("LARGE_MAP_OUTLINE")) { | |
| AGame.LARGE_MAP_OUTLINE = v_fount(); | |
| } | |
| if (name.equals("LARGE_BUTTON_TEXT_Y_OFFSET")) { | |
| MyDraw.LARGE_BUTTON_TEXT_Y_OFFSET = v_int(); | |
| } | |
| if (name.equals("LARGE_BIG_BUTTON_TEXT_Y_OFFSET")) { | |
| MyDraw.LARGE_BIG_BUTTON_TEXT_Y_OFFSET = v_int(); | |
| } | |
| if (name.equals("LARGE_SCROLL_BAR_W")) { | |
| ScrollBar.LARGE_SCROLL_BAR_W = v_int(); | |
| } | |
| if (name.equals("LARGE_UP_BUTTON")) { | |
| ScrollBar.LARGE_UP_BUTTON = v_img(); | |
| } | |
| if (name.equals("LARGE_DOWN_BUTTON")) { | |
| ScrollBar.LARGE_DOWN_BUTTON = v_img(); | |
| } | |
| if (name.equals("LARGE_UP_BUTTON_LIT")) { | |
| ScrollBar.LARGE_UP_BUTTON_LIT = v_img(); | |
| } | |
| if (name.equals("LARGE_DOWN_BUTTON_LIT")) { | |
| ScrollBar.LARGE_DOWN_BUTTON_LIT = v_img(); | |
| } | |
| if (name.equals("LARGE_UP_BUTTON_DISABLED")) { | |
| ScrollBar.LARGE_UP_BUTTON_DISABLED = v_img(); | |
| } | |
| if (name.equals("LARGE_DOWN_BUTTON_DISABLED")) { | |
| ScrollBar.LARGE_DOWN_BUTTON_DISABLED = v_img(); | |
| } | |
| if (name.equals("LARGE_SCROLL_THUMB_TOP")) { | |
| ScrollBar.LARGE_SCROLL_THUMB_TOP = v_img(); | |
| } | |
| if (name.equals("LARGE_SCROLL_THUMB_MIDDLE")) { | |
| ScrollBar.LARGE_SCROLL_THUMB_MIDDLE = v_img(); | |
| } | |
| if (name.equals("LARGE_SCROLL_THUMB_BOTTOM")) { | |
| ScrollBar.LARGE_SCROLL_THUMB_BOTTOM = v_img(); | |
| } | |
| if (name.equals("LARGE_LEFT_BORDER")) { | |
| ScrollBar.LARGE_LEFT_BORDER = v_img(); | |
| } | |
| if (name.equals("LARGE_RIGHT_BORDER")) { | |
| ScrollBar.LARGE_RIGHT_BORDER = v_img(); | |
| } | |
| if (name.equals("LARGE_SHOUT_BUBBLE_LEFT")) { | |
| ShoutOverlay.LARGE_SHOUT_BUBBLE_LEFT = v_img(); | |
| } | |
| if (name.equals("LARGE_SHOUT_BUBBLE_RIGHT")) { | |
| ShoutOverlay.LARGE_SHOUT_BUBBLE_RIGHT = v_img(); | |
| } | |
| if (name.equals("PAN_STRENGTH")) { | |
| CombatSoundEffects.PAN_STRENGTH = v_double(); | |
| } | |
| if (name.equals("LISTENER_Z_DIST_RELATIVE_TO_SCREEN_WIDTH")) { | |
| CombatSoundEffects.LISTENER_Z_DIST_RELATIVE_TO_SCREEN_WIDTH = v_double(); | |
| } | |
| if (name.equals("LOOP_SUM_EXPONENT")) { | |
| CombatSoundEffects.LOOP_SUM_EXPONENT = v_double(); | |
| } | |
| if (name.equals("ZOOM_VOLUME_EXPONENT")) { | |
| CombatSoundEffects.ZOOM_VOLUME_EXPONENT = v_double(); | |
| } | |
| if (name.equals("BOARDING_FRIENDLY")) { | |
| BoardingStatusChrome.BOARDING_FRIENDLY = v_clr(); | |
| } | |
| if (name.equals("BOARDING_ENEMY")) { | |
| BoardingStatusChrome.BOARDING_ENEMY = v_clr(); | |
| } | |
| if (name.equals("BOARDING_FRIENDLY_OUTLINE")) { | |
| BoardingStatusChrome.BOARDING_FRIENDLY_OUTLINE = v_clr(); | |
| } | |
| if (name.equals("BOARDING_ENEMY_OUTLINE")) { | |
| BoardingStatusChrome.BOARDING_ENEMY_OUTLINE = v_clr(); | |
| } | |
| if (name.equals("BOARDER_ICON")) { | |
| BoardingStatusChrome.BOARDER_ICON = v_img(); | |
| } | |
| if (name.equals("BOARDER_ICON_OUTLINE")) { | |
| BoardingStatusChrome.BOARDER_ICON_OUTLINE = v_img(); | |
| } | |
| if (name.equals("DEFENDER_ICON")) { | |
| BoardingStatusChrome.DEFENDER_ICON = v_img(); | |
| } | |
| if (name.equals("DEFENDER_ICON_OUTLINE")) { | |
| BoardingStatusChrome.DEFENDER_ICON_OUTLINE = v_img(); | |
| } | |
| if (name.equals("FOLDER")) { | |
| FileScreen.SMALL_FOLDER = v_img(); | |
| } | |
| if (name.equals("MEDIUM_FOLDER")) { | |
| FileScreen.MEDIUM_FOLDER = v_img(); | |
| } | |
| if (name.equals("LARGE_FOLDER")) { | |
| FileScreen.LARGE_FOLDER = v_img(); | |
| } | |
| if (name.equals("TECH_ICON_SIZE")) { | |
| TechScreen.TECH_ICON_SIZE = v_int(); | |
| } | |
| if (name.equals("TECH_TIER_GAP")) { | |
| TechScreen.SMALL_TECH_TIER_GAP = v_int(); | |
| } | |
| if (name.equals("MEDIUM_TECH_TIER_GAP")) { | |
| TechScreen.MEDIUM_TECH_TIER_GAP = v_int(); | |
| } | |
| if (name.equals("LARGE_TECH_TIER_GAP")) { | |
| TechScreen.LARGE_TECH_TIER_GAP = v_int(); | |
| } | |
| if (name.equals("TECH_ROW_GAP")) { | |
| TechScreen.SMALL_TECH_ROW_GAP = v_int(); | |
| } | |
| if (name.equals("TECH_TIER_GAP_ZOOMED_OUT")) { | |
| TechScreen.SMALL_TECH_TIER_GAP_ZOOMED_OUT = v_int(); | |
| } | |
| if (name.equals("MEDIUM_TECH_TIER_GAP_ZOOMED_OUT")) { | |
| TechScreen.MEDIUM_TECH_TIER_GAP_ZOOMED_OUT = v_int(); | |
| } | |
| if (name.equals("LARGE_TECH_TIER_GAP_ZOOMED_OUT")) { | |
| TechScreen.LARGE_TECH_TIER_GAP_ZOOMED_OUT = v_int(); | |
| } | |
| if (name.equals("TECH_ROW_GAP")) { | |
| TechScreen.SMALL_TECH_ROW_GAP = v_int(); | |
| } | |
| if (name.equals("MEDIUM_TECH_ROW_GAP")) { | |
| TechScreen.MEDIUM_TECH_ROW_GAP = v_int(); | |
| } | |
| if (name.equals("LARGE_TECH_ROW_GAP")) { | |
| TechScreen.LARGE_TECH_ROW_GAP = v_int(); | |
| } | |
| if (name.equals("TECH_LANE_DIST")) { | |
| TechScreen.SMALL_TECH_LANE_DIST = v_int(); | |
| } | |
| if (name.equals("MEDIUM_TECH_LANE_DIST")) { | |
| TechScreen.MEDIUM_TECH_LANE_DIST = v_int(); | |
| } | |
| if (name.equals("LARGE_TECH_LANE_DIST")) { | |
| TechScreen.LARGE_TECH_LANE_DIST = v_int(); | |
| } | |
| if (name.equals("TECH_ICON")) { | |
| TechScreen.TECH_ICON = v_img(); | |
| } | |
| if (name.equals("TECH_ICON_ACTIVE")) { | |
| TechScreen.TECH_ICON_ACTIVE = v_img(); | |
| } | |
| if (name.equals("SELECTED_TECH")) { | |
| TechScreen.SELECTED_TECH = v_clr(); | |
| TechScreen.SELECTED_TECH_C = "[" + v_clr().toString() + "]"; | |
| } | |
| if (name.equals("AVAILABLE_TECH")) { | |
| TechScreen.AVAILABLE_TECH = v_clr(); | |
| } | |
| if (name.equals("UNAVAILABLE_TECH")) { | |
| TechScreen.UNAVAILABLE_TECH = v_clr(); | |
| TechScreen.UNAVAILABLE_TECH_C = "[" + v_clr().toString() + "]"; | |
| } | |
| } | |
| public Splinter(JSONObject o) { | |
| super(o.getString("name")); | |
| img = new Img(o.getString("src"), o.getInt("x"), o.getInt("y"), o.getInt("w"), o.getInt("h"), o.optBoolean("flipped", false)); | |
| } | |
| public MonsterSetting(JSONObject o) { | |
| super(o.getString("name"), o.getInt("sort")); | |
| useDifficultyLevelSetting = o.getBoolean("useDifficultyLevelSetting"); | |
| monsterNestDensity = o.getDouble("monsterNestDensity"); | |
| monsterNestIncomeMult = o.getDouble("monsterNestIncomeMult"); | |
| } | |
| public SeaLevelSetting(JSONObject o) { | |
| super(o.getString("name"), o.optInt("sort")); | |
| boundary = o.getDouble("boundary"); | |
| tilt = o.getDouble("tilt"); | |
| empireLandshipFocusChance = o.optDouble("empireLandshipFocusChance", 0.2); | |
| } | |
| public TechSpeedSetting(JSONObject o) { | |
| super(o.getString("name"), o.optInt("sort")); | |
| speedMultiplier = o.getDouble("speedMultiplier"); | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment