Add config values for enable/disable Paseli, and whether or not to force Extra Stage for every session

This commit is contained in:
skogaby
2019-08-27 16:17:07 -05:00
parent 07394c3c17
commit 730b100c80
4 changed files with 22 additions and 2 deletions

View File

@@ -27,6 +27,12 @@ public class PcbTrackerRequestHandler extends BaseRequestHandler {
@Value(PropertyNames.MAINT_MODE)
private String isMaintenance;
/**
* Says whether or not to enable Paseli usage.
*/
@Value(PropertyNames.PASELI_ENABLE)
private String isPaseliEnabled;
/**
* Handles an incoming request for the <code>pcbtracker</code> module.
* @param requestBody The XML document of the incoming request.
@@ -53,9 +59,10 @@ public class PcbTrackerRequestHandler extends BaseRequestHandler {
*/
private Object handleAliveRequest(final Request request, final Response response) {
final boolean isMaint = Boolean.parseBoolean(this.isMaintenance);
final boolean isPaseliEnabled = Boolean.parseBoolean(this.isPaseliEnabled);
KXmlBuilder respBuilder = KXmlBuilder.create("response")
.e("pcbtracker").a("ecenable", "1");
.e("pcbtracker").a("ecenable", isPaseliEnabled ? "1" : "0");
if (isMaint) {
respBuilder = respBuilder.a("eclimit", "0").a("expire", "0").a("limit", "0").a("status", "0");

View File

@@ -32,9 +32,11 @@ import com.buttongames.butterflymodel.model.ddr16.options.TurnOption;
import com.buttongames.butterflycore.util.TimeUtils;
import com.buttongames.butterflycore.xml.kbinxml.KXmlBuilder;
import com.buttongames.butterflycore.xml.XmlUtils;
import com.buttongames.butterflyserver.util.PropertyNames;
import com.google.common.io.ByteStreams;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Component;
import org.w3c.dom.Document;
import org.w3c.dom.Element;
@@ -125,6 +127,12 @@ public class PlayerDataRequestHandler extends BaseRequestHandler {
*/
private final UserSongRecordDao songRecordDao;
/**
* Says whether or not we force every session to have extra stage.
*/
@Value(PropertyNames.FORCE_EXTRA_STAGE)
private String isForceExtraStage;
/**
* Static list of events for the server.
*/
@@ -589,6 +597,7 @@ public class PlayerDataRequestHandler extends BaseRequestHandler {
*/
private String buildCommonCsv(final UserProfile profile) {
final String[] elems = "1,0,fffffff,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,,0000-0000,,,,,,".split(",", -1);
final boolean forceExtraStage = Boolean.parseBoolean(this.isForceExtraStage);
// modify the contents to send back
String dancerCodeStr = String.format("%08d", profile.getDancerCode());
@@ -598,7 +607,7 @@ public class PlayerDataRequestHandler extends BaseRequestHandler {
elems[GAME_COMMON_AREA_OFFSET] = Integer.toHexString(profile.getArea());
elems[GAME_COMMON_WEIGHT_DISPLAY_OFFSET] = profile.isDisplayWeight() ? "1" : "0";
elems[GAME_COMMON_CHARACTER_OFFSET] = Integer.toHexString(profile.getCharacter().ordinal());
elems[GAME_COMMON_EXTRA_CHARGE_OFFSET] = Integer.toHexString(profile.getExtraCharge());
elems[GAME_COMMON_EXTRA_CHARGE_OFFSET] = Integer.toHexString(forceExtraStage ? 10 : profile.getExtraCharge());
elems[GAME_COMMON_TOTAL_PLAYS_OFFSET] = (profile.getTotalPlays() == -1) ? "ffffffffffffffff" : Integer.toHexString(profile.getTotalPlays());
elems[GAME_COMMON_SINGLE_PLAYS_OFFSET] = Integer.toHexString(profile.getSinglesPlays());
elems[GAME_COMMON_DOUBLE_PLAYS_OFFSET] = Integer.toHexString(profile.getDoublesPlays());

View File

@@ -8,4 +8,6 @@ public class PropertyNames {
public static final String PORT = "${server.port}";
public static final String MAINT_MODE = "${server.maintenance}";
public static final String PASELI_ENABLE = "${server.paselienable}";
public static final String FORCE_EXTRA_STAGE = "${server.forceextrastage}";
}

View File

@@ -1,3 +1,5 @@
# Server properties
server.port = 80
server.maintenance = false
server.paselienable = false
server.forceextrastage = false