Skip to content

Commit

Permalink
Scenario loader refactor & bugfix
Browse files Browse the repository at this point in the history
Fixing scenario loader and making sure all supplied scenarios load
  • Loading branch information
Akjosch committed Apr 2, 2016
1 parent af040b0 commit 8b12995
Show file tree
Hide file tree
Showing 12 changed files with 987 additions and 694 deletions.
Expand Up @@ -23,4 +23,4 @@ Unit_1stSomersetStrikers_2_DamageSpecific=N0:5,N1:14,R1:5,N2:13,R2:5,N3:13,R3:5,
Unit_1stSomersetStrikers_3_DamageSpecific=N0:5,N1:9,R1:4,N2:7,R2:3,N3:7,R3:3,N4:8,N5:8,N6:8,N7:8
Unit_1stSomersetStrikers_1_SetAmmoTo=3:6-4,3:7-4
Unit_1stSomersetStrikers_2_SetAmmoTo=2:8-4,2:9-4,2:10-22,3:8-4,3:9-4,3:10-22
Unit_1stSomersetStrikers_3_SetAmmoTo=2:3-0,2:5-6,2:6-6
Unit_1stSomersetStrikers_3_SetAmmoTo=2:4-0,2:6-6,2:7-6
Expand Up @@ -25,7 +25,7 @@ Unit_FalconsClaws_10=Elemental Battle Armor [MG],Point 5,4,4,N,10,33
Unit_1stSomersetStrikers_1=Awesome AWS-9Ma,Major Adam Steiner,1,1,N,17,08
Unit_1stSomersetStrikers_2=Mauler MAL-1R,Captain Zachary Miles Hawkins,3,4,N,08,12
Unit_1stSomersetStrikers_3=Bushwacker BSW-X1,Captain Valten Ryder,4,3,N,17,09
Unit_1stSomersetStrikers_4=Sloth Battle Armor, Franklin Sakamoto,5,5,N,17,10
Unit_1stSomersetStrikers_4=Sloth Battle Armor (Standard), Franklin Sakamoto,5,5,N,17,10
# Somerset Cadet Corps:
Unit_1stSomersetStrikers_5=Axman AXM-2N,Commander Andrew Steiner,3,4,N,07,06
Unit_1stSomersetStrikers_6=Foot Platoon (Laser),A1,5,5,N,07,12
Expand Down
18 changes: 18 additions & 0 deletions megamek/data/scenarios/Example.mms
Expand Up @@ -177,6 +177,24 @@ Unit_Kurita_6_CritHit=2:10
#
Unit_Kurita_6_SetAmmoTo=2:11-1

# Set Ammo type (works only for 'Mechs, too)
#
# Loc and Slots work the same as for critical locations and ammo ammout
#
# Ammo name is the unique string used in the 'Mech files themselves.
# Errors will be logged to the normal log file and the ammo replaced
# by the standard defined for the 'Mech. The same will happen for ammo
# which is illegal according to the specified game rules.
Unit_PlayerA_2_SetAmmoType=3:1-ISAC20 Flak Ammo

# Set Altitude (works only for aerospace fighters, conventional fighters,
# small craft and dropships)
#
# You can set the altitude of a flying unit at the start of the scenario
# to be anything between 0 and 10. Altitude 0 means the unit deploys landed.
#
# Unit_Kurita_666_Altitude=3

# Set game options file
# This is an xml file which can be created by copying your
# mmconf/gameoptions.xml
Expand Down
25 changes: 21 additions & 4 deletions megamek/data/scenarios/Lucho/Citadel_Blitz_multiplayer.mms
Expand Up @@ -50,10 +50,27 @@ Unit_JadeFalcon2_2=Nobori-nin (Huntsman) B,Francesca,2,3,N,21,99
Unit_JadeFalcon2_3=Shadow Cat A,Jolene,3,3,N,24,99
Unit_JadeFalcon2_4=Hellhound (Conjurer) (Standard),Casad,3,3,N,20,99
Unit_JadeFalcon2_5=Thor (Summoner) A,Gillian,2,3,N,23,99
Unit_AFFC1_AutoEject=false
Unit_AFFC3_AutoEject=false
Unit_JadeFalcon1_AutoEject=false
Unit_JadeFalcon2_AutoEject=false
Unit_AFFC1_1_AutoEject=false
Unit_AFFC1_2_AutoEject=false
Unit_AFFC1_3_AutoEject=false
Unit_AFFC1_4_AutoEject=false
Unit_AFFC1_5_AutoEject=false
Unit_AFFC3_1_AutoEject=false
Unit_AFFC3_2_AutoEject=false
Unit_AFFC3_3_AutoEject=false
Unit_AFFC3_4_AutoEject=false
Unit_AFFC3_5_AutoEject=false
Unit_AFFC3_6_AutoEject=false
Unit_JadeFalcon1_1_AutoEject=false
Unit_JadeFalcon1_2_AutoEject=false
Unit_JadeFalcon1_3_AutoEject=false
Unit_JadeFalcon1_4_AutoEject=false
Unit_JadeFalcon1_5_AutoEject=false
Unit_JadeFalcon2_1_AutoEject=false
Unit_JadeFalcon2_2_AutoEject=false
Unit_JadeFalcon2_3_AutoEject=false
Unit_JadeFalcon2_4_AutoEject=false
Unit_JadeFalcon2_5_AutoEject=false
Unit_AFFC1_1_Commander=true
Unit_AFFC2_5_Commander=true
Unit_AFFC3_5_Commander=true
Expand Down
31 changes: 29 additions & 2 deletions megamek/data/scenarios/Lucho/Citadel_Blitz_oneonone.mms
Expand Up @@ -42,8 +42,35 @@ Unit_JadeFalcon_7=Nobori-nin (Huntsman) B,Francesca,2,3,N,21,99
Unit_JadeFalcon_8=Shadow Cat A,Jolene,3,3,N,24,99
Unit_JadeFalcon_9=Hellhound (Conjurer) (Standard),Casad,3,3,N,20,99
Unit_JadeFalcon_10=Thor (Summoner) A,Gillian,2,3,N,23,99
Unit_AFFC_AutoEject=false
Unit_JadeFalcon_AutoEject=false
Unit_AFFC_1_AutoEject=false
Unit_AFFC_2_AutoEject=false
Unit_AFFC_3_AutoEject=false
Unit_AFFC_4_AutoEject=false
Unit_AFFC_5_AutoEject=false
Unit_AFFC_6_AutoEject=false
Unit_AFFC_7_AutoEject=false
Unit_AFFC_8_AutoEject=false
Unit_AFFC_9_AutoEject=false
Unit_AFFC_10_AutoEject=false
Unit_AFFC_11_AutoEject=false
Unit_AFFC_12_AutoEject=false
Unit_AFFC_13_AutoEject=false
Unit_AFFC_14_AutoEject=false
Unit_AFFC_15_AutoEject=false
Unit_AFFC_16_AutoEject=false
Unit_AFFC_17_AutoEject=false
Unit_AFFC_18_AutoEject=false
Unit_AFFC_19_AutoEject=false
Unit_JadeFalcon_1_AutoEject=false
Unit_JadeFalcon_2_AutoEject=false
Unit_JadeFalcon_3_AutoEject=false
Unit_JadeFalcon_4_AutoEject=false
Unit_JadeFalcon_5_AutoEject=false
Unit_JadeFalcon_6_AutoEject=false
Unit_JadeFalcon_7_AutoEject=false
Unit_JadeFalcon_8_AutoEject=false
Unit_JadeFalcon_9_AutoEject=false
Unit_JadeFalcon_10_AutoEject=false
Unit_AFFC_1_Commander=true
Unit_JadeFalcon_5_Commander=true
GameOptionsFile=Citadel_Defense.xml
38 changes: 35 additions & 3 deletions megamek/data/scenarios/Lucho/Last_Stand_at_Guanabara.mms
Expand Up @@ -46,11 +46,43 @@ Unit_JadeFalcon_4=Night Gyr A,Edee,3,3,N,31,99
Unit_JadeFalcon_5=Thor (Summoner) H,Gillian,2,3,N,32,99
Unit_JadeFalcon_6=Gladiator (Executioner) A,Jeremiah Hazen,2,3,N,38,97
Unit_JadeFalcon_7=Uller (Kit Fox) S,Greer,2,3,N,37,99
Unit_JadeFalcon_8=Pinion,Francesca,3,3,N,39,99
Unit_JadeFalcon_8=Pinion (Standard),Francesca,3,3,N,39,99
Unit_JadeFalcon_9=Cougar H,Sabrina,3,4,N,37,98
Unit_JadeFalcon_10=Hellhound (Conjurer) (Standard),Casad,3,4,N,39,99
Unit_LAAF_AutoEject=true
Unit_JadeFalcon_AutoEject=false
Unit_LAAF_1_AutoEject=true
Unit_LAAF_2_AutoEject=true
Unit_LAAF_3_AutoEject=true
Unit_LAAF_4_AutoEject=true
Unit_LAAF_5_AutoEject=true
Unit_LAAF_6_AutoEject=true
Unit_LAAF_7_AutoEject=true
Unit_LAAF_8_AutoEject=true
Unit_LAAF_9_AutoEject=true
Unit_LAAF_10_AutoEject=true
Unit_LAAF_11_AutoEject=true
Unit_LAAF_12_AutoEject=true
Unit_LAAF_13_AutoEject=true
Unit_LAAF_14_AutoEject=true
Unit_LAAF_15_AutoEject=true
Unit_LAAF_16_AutoEject=true
Unit_LAAF_17_AutoEject=true
Unit_LAAF_18_AutoEject=true
Unit_LAAF_19_AutoEject=true
Unit_LAAF_20_AutoEject=true
Unit_LAAF_21_AutoEject=true
Unit_LAAF_22_AutoEject=true
Unit_LAAF_23_AutoEject=true
Unit_LAAF_24_AutoEject=true
Unit_JadeFalcon_1_AutoEject=false
Unit_JadeFalcon_2_AutoEject=false
Unit_JadeFalcon_3_AutoEject=false
Unit_JadeFalcon_4_AutoEject=false
Unit_JadeFalcon_5_AutoEject=false
Unit_JadeFalcon_6_AutoEject=false
Unit_JadeFalcon_7_AutoEject=false
Unit_JadeFalcon_8_AutoEject=false
Unit_JadeFalcon_9_AutoEject=false
Unit_JadeFalcon_10_AutoEject=false
Unit_LAAF_1_Commander=true
Unit_JadeFalcon_1_Commander=true
GameOptionsFile=Citadel_Defense.xml
Expand Up @@ -6,10 +6,7 @@ MMSVersion=1

Name=Instant Fame:Northwind Highlanders

Description=The campaign on Bellatrix against Ajax's Avengers brought McCormack's Fusiliers instant fame.
Arriving to find themselves outnumbered three-to-one, the Fusiliers quickly used their superior grasp of tactics and their ferocity to smash the defending
unit. The retreating Avengers tried deperately to shake the Highlanders as they fled east across the southern continent of Bellatrix, but to no avail.
Exhausted and bogged down by bad weather, the Avengers had no choice but to stand and fight.
Description=The campaign on Bellatrix against Ajax's Avengers brought McCormack's Fusiliers instant fame. Arriving to find themselves outnumbered three-to-one, the Fusiliers quickly used their superior grasp of tactics and their ferocity to smash the defending unit. The retreating Avengers tried deperately to shake the Highlanders as they fled east across the southern continent of Bellatrix, but to no avail. Exhausted and bogged down by bad weather, the Avengers had no choice but to stand and fight.

BoardWidth=2
BoardHeight=1
Expand Down
Expand Up @@ -10,5 +10,5 @@ Location_Jaguar=N
Location_FedCom=S
Unit_Jaguar_1=Elemental Battle Armor [Laser],Lincoln Osis,2,3
Unit_Jaguar_2=Masakari (Warhawk) C,Kit Furey,1,2
Unit_FedCom_1=Daishi (Dire Wolf) "Prometheus",Victor Steiner-Davion,2,4
Unit_FedCom_1=Daishi (Dire Wolf) 'Prometheus',Victor Steiner-Davion,2,4
Unit_FedCom_2=Falconer FLC-8R,Danai Centrella,3,4
11 changes: 11 additions & 0 deletions megamek/i18n/megamek/server/messages.properties
@@ -0,0 +1,11 @@
ScenarioLoaderException.exceptionReadingFile=Exception while reading scenario file
ScenarioLoaderException.invalidFactionCamoGroup=Invalid faction camo group '%s' for %s
ScenarioLoaderException.invalidFactionCamoName=Invalid faction camo '%s' in group '%s' for %s
ScenarioLoaderException.invalidIndividualCamoGroup=Invalid individual camo group '%s' for %s
ScenarioLoaderException.invalidIndividualCamoName=Invalid individual camo '%s' in group '%s' for %s
ScenarioLoaderException.missingFactions=Not a valid MMS file. No Factions defined.
ScenarioLoaderException.missingMMSVersion=Not a valid MMS file. No MMSVersion.
ScenarioLoaderException.missingRequiredEntity=Scenario requires missing entity: %s
ScenarioLoaderException.multipleUnitDeclarations=Multiple unit declarations '%s'
ScenarioLoaderException.nonexistantBoard=Couldn't find board '%s'
ScenarioLoaderException.unparsableEntityLine=Unparseable entity line: %s
25 changes: 25 additions & 0 deletions megamek/src/megamek/server/Messages.java
@@ -0,0 +1,25 @@
package megamek.server;

import java.util.MissingResourceException;
import java.util.ResourceBundle;

import megamek.common.preference.PreferenceManager;
import megamek.common.util.EncodeControl;

public class Messages {
private static final String BUNDLE_NAME = "megamek.server.messages"; //$NON-NLS-1$

private static final ResourceBundle RESOURCE_BUNDLE = ResourceBundle.getBundle(BUNDLE_NAME,
PreferenceManager.getClientPreferences().getLocale(), new EncodeControl());

private Messages() {}

public static String getString(String key) {
try {
return RESOURCE_BUNDLE.getString(key);
} catch(MissingResourceException e) {
System.out.println("Missing i18n entry: " + key); //$NON-NLS-1$
return '!' + key + '!';
}
}
}

0 comments on commit 8b12995

Please sign in to comment.