mirror of
https://github.com/skogaby/butterfly.git
synced 2026-04-25 07:59:02 -05:00
New profile creation finally works, name input is skipped unless the total plays returns is ffffffff, and we don't do that unless it's set to -1 in the database. If we send that, update it to 0 afterward so the name is only input once.
This commit is contained in:
parent
731ac21e3e
commit
1fa3070e33
|
|
@ -562,7 +562,7 @@ public class PlayerDataRequestHandler extends BaseRequestHandler {
|
|||
try {
|
||||
totalPlays = Integer.parseInt(common[GAME_COMMON_TOTAL_PLAYS_OFFSET]);
|
||||
} catch(NumberFormatException e) {
|
||||
totalPlays = 0;
|
||||
totalPlays = -1;
|
||||
}
|
||||
|
||||
final int singlePlays = Integer.parseInt(common[GAME_COMMON_SINGLE_PLAYS_OFFSET]);
|
||||
|
|
@ -586,9 +586,9 @@ public class PlayerDataRequestHandler extends BaseRequestHandler {
|
|||
// parse out OPTION values
|
||||
if (option != null &&
|
||||
option.length != 0) {
|
||||
final SpeedOption speedOption = SpeedOption.values()[Integer.parseInt(option[GAME_OPTION_SPEED_OFFSET])];
|
||||
final SpeedOption speedOption = SpeedOption.optionForValue(Integer.parseInt(option[GAME_OPTION_SPEED_OFFSET], 16));
|
||||
final BoostOption boostOption = BoostOption.values()[Integer.parseInt(option[GAME_OPTION_BOOST_OFFSET])];
|
||||
final AppearanceOption appearanceOption = AppearanceOption.values()[Integer.parseInt(option[GAME_OPTION_APPEARANCE_OFFSET])];
|
||||
final AppearanceOption appearanceOption = AppearanceOption.optionForValue(Integer.parseInt(option[GAME_OPTION_APPEARANCE_OFFSET]));
|
||||
final TurnOption turnOption = TurnOption.values()[Integer.parseInt(option[GAME_OPTION_TURN_OFFSET])];
|
||||
final StepZoneOption stepZoneOption = StepZoneOption.values()[Integer.parseInt(option[GAME_OPTION_STEP_ZONE_OFFSET])];
|
||||
final ScrollOption scrollOption = ScrollOption.values()[Integer.parseInt(option[GAME_OPTION_SCROLL_OFFSET])];
|
||||
|
|
|
|||
|
|
@ -1,5 +1,7 @@
|
|||
package com.buttongames.butterfly.model.ddr16.options;
|
||||
|
||||
import java.util.HashMap;
|
||||
|
||||
/**
|
||||
* Enum for the various appearance options in-game for DDR A.
|
||||
* @author skogaby (skogabyskogaby@gmail.com)
|
||||
|
|
@ -11,11 +13,16 @@ public enum AppearanceOption {
|
|||
HIDDEN_AND_SUDDEN_PLUS(5),
|
||||
STEALTH(6);
|
||||
|
||||
/**
|
||||
* The value to put in the profile response for this option.
|
||||
*/
|
||||
private static final HashMap<Integer, AppearanceOption> valueToOptionMap = new HashMap<>();
|
||||
|
||||
private final int val;
|
||||
|
||||
static {
|
||||
for (AppearanceOption opt : AppearanceOption.values()) {
|
||||
valueToOptionMap.put(opt.getVal(), opt);
|
||||
}
|
||||
}
|
||||
|
||||
private AppearanceOption(int val) {
|
||||
this.val = val;
|
||||
}
|
||||
|
|
@ -23,4 +30,12 @@ public enum AppearanceOption {
|
|||
public int getVal() {
|
||||
return this.val;
|
||||
}
|
||||
|
||||
public static AppearanceOption optionForValue(int value) {
|
||||
if (!valueToOptionMap.containsKey(value)) {
|
||||
throw new IllegalArgumentException();
|
||||
}
|
||||
|
||||
return valueToOptionMap.get(value);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,5 +1,7 @@
|
|||
package com.buttongames.butterfly.model.ddr16.options;
|
||||
|
||||
import java.util.HashMap;
|
||||
|
||||
/**
|
||||
* Enum for the various speed options in-game for DDR A.
|
||||
* @author skogaby (skogabyskogaby@gmail.com)
|
||||
|
|
@ -30,11 +32,16 @@ public enum SpeedOption {
|
|||
X_7_50(0x1D),
|
||||
X_8_00(0x1F);
|
||||
|
||||
/**
|
||||
* The value to put in the profile response for this option.
|
||||
*/
|
||||
private static final HashMap<Integer, SpeedOption> valueToOptionMap = new HashMap<>();
|
||||
|
||||
private final int val;
|
||||
|
||||
static {
|
||||
for (SpeedOption opt : SpeedOption.values()) {
|
||||
valueToOptionMap.put(opt.getVal(), opt);
|
||||
}
|
||||
}
|
||||
|
||||
private SpeedOption(int val) {
|
||||
this.val = val;
|
||||
}
|
||||
|
|
@ -42,4 +49,12 @@ public enum SpeedOption {
|
|||
public int getVal() {
|
||||
return this.val;
|
||||
}
|
||||
|
||||
public static SpeedOption optionForValue(int value) {
|
||||
if (!valueToOptionMap.containsKey(value)) {
|
||||
throw new IllegalArgumentException();
|
||||
}
|
||||
|
||||
return valueToOptionMap.get(value);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user