開啟 src/l1j/server/config.java
搜尋
public static double RATE_SHOP_PURCHASING_PRICE;
複製代碼
修改為
public static double RATE_SHOP_PURCHASING_PRICE;
// 新增遊戲管理員 .rates 線上調整機率、倍率
public static double RATE_XP_ORG;
public static double RATE_LA_ORG;
public static double RATE_KARMA_ORG;
public static double RATE_DROP_ADENA_ORG;
public static double RATE_DROP_ITEMS_ORG;
public static double RATE_WEIGHT_LIMIT_ORG;
// 新增遊戲管理員 .rates 線上調整機率、倍率
複製代碼
再搜尋
CREATE_CHANCE_HISTORY_BOOK = Integer.parseInt(rateSettings
.getProperty("CreateChanceHistoryBook", "50"));
複製代碼
修改為
CREATE_CHANCE_HISTORY_BOOK = Integer.parseInt(rateSettings
.getProperty("CreateChanceHistoryBook", "50"));
// 新增遊戲管理員 .rates 線上調整機率、倍率
RATE_XP_ORG = RATE_XP;
RATE_LA_ORG = RATE_LA;
RATE_KARMA_ORG = RATE_KARMA;
RATE_DROP_ADENA_ORG = RATE_DROP_ADENA;
RATE_DROP_ITEMS_ORG = RATE_DROP_ITEMS;
RATE_WEIGHT_LIMIT_ORG = RATE_WEIGHT_LIMIT;
// 新增遊戲管理員 .rates 線上調整機率、倍率
複製代碼
再搜尋
private Config() {
}
複製代碼
修改為
// 新增遊戲管理員 .rates 線上調整機率、倍率
public static void reset() {
_log.info("正在重新讀取機率配置.");
try {
RATE_XP = RATE_XP_ORG;
RATE_DROP_ADENA = RATE_DROP_ADENA_ORG;
RATE_DROP_ITEMS = RATE_DROP_ITEMS_ORG;
RATE_LA = RATE_LA_ORG;
RATE_KARMA = RATE_KARMA_ORG;
RATE_WEIGHT_LIMIT = RATE_WEIGHT_LIMIT_ORG;
} catch (Exception e) {
_log.severe(e.toString());
}
}
// 新增遊戲管理員 .rates 線上調整機率、倍率
private Config() {
}
複製代碼
新增檔案 src/l1j/server/server/command/executor/L1Rates.java (ANSI as UTF-8)
package l1j.server.server.command.executor;
import java.util.StringTokenizer;
import java.util.Collection;
import java.util.logging.Logger;
import l1j.server.Config;
import l1j.server.server.model.L1World;
import l1j.server.server.model.Instance.L1PcInstance;
import l1j.server.server.serverpackets.S_SystemMessage;
import l1j.server.server.serverpackets.S_WhoAmount;
public class L1Rates implements L1CommandExecutor {
private static Logger _log = Logger.getLogger(L1Rates.class.getName());
private L1Rates() {
}
public static L1CommandExecutor getInstance() {
return new L1Rates();
}
@Override
public void execute(L1PcInstance pc, String cmdName, String arg) {
String changed = "Error";
double data = 0;
try {
StringTokenizer stringtokenizer = new StringTokenizer(arg);
String param = stringtokenizer.nextToken();
if (param.equalsIgnoreCase("RESET")) {
Config.reset();
changed = "RESET";
} else {
String value = stringtokenizer.nextToken();
data = Double.parseDouble(value);
if (param.equalsIgnoreCase("XP")) {
Config.setParameterValue("RateXp", "" + (Config.RATE_XP_ORG * data));
changed = "XP";
} else if (param.equalsIgnoreCase("ADENA")) {
Config.setParameterValue("RateDropAdena", "" + (Config.RATE_DROP_ADENA_ORG * data));
changed = "ADENA";
} else if (param.equalsIgnoreCase("DROP")) {
Config.setParameterValue("RateDropItems", "" + (Config.RATE_DROP_ITEMS_ORG * data));
changed = "DROP";
} else if (param.equalsIgnoreCase("LAW")) {
Config.setParameterValue("RateLawful", "" + (Config.RATE_LA_ORG * data));
changed = "LAW";
} else if (param.equalsIgnoreCase("KARMA")) {
Config.setParameterValue("RateKarma", "" + (Integer.valueOf(value) * Config.RATE_KARMA_ORG));
changed = "KARMA";
} else if (param.equalsIgnoreCase("WEIGHT")) {
int rate = (int)(data * Config.RATE_WEIGHT_LIMIT_ORG);
Config.setParameterValue("Weightrate", "" + rate);
changed = "WEIGHT";
} else if (param.equalsIgnoreCase("ALL")) {
Config.setParameterValue("RateXp", "" + (Config.RATE_XP_ORG * data));
Config.setParameterValue("RateDropAdena", "" + (Config.RATE_DROP_ADENA_ORG * data));
Config.setParameterValue("RateDropItems", "" + (Config.RATE_DROP_ITEMS_ORG * data));
Config.setParameterValue("RateLawful", "" + (Config.RATE_LA_ORG * data));
Config.setParameterValue("RateKarma", "" + (Config.RATE_KARMA_ORG * data));
int rate = (int)(data * Config.RATE_WEIGHT_LIMIT_ORG);
Config.setParameterValue("Weightrate", "" + rate);
changed = "ALL";
} else {
pc.sendPackets(new S_SystemMessage("請輸入 .rates [XP,ADENA,DROP,LAW,KARMA,WEIGHT,ALL] [數值,RESET]"));
pc.sendPackets(new S_SystemMessage("經驗值: " + (int)Config.RATE_XP) + " 倍");
pc.sendPackets(new S_SystemMessage("金幣掉落: " + (int)Config.RATE_DROP_ADENA) + " 倍");
pc.sendPackets(new S_SystemMessage("物品掉落: " + (int)Config.RATE_DROP_ITEMS) + " 倍");
pc.sendPackets(new S_SystemMessage("正義值: " + (int)Config.RATE_LA) + " 倍");
pc.sendPackets(new S_SystemMessage("友好度: " + (int)Config.RATE_KARMA) + " 倍");
pc.sendPackets(new S_SystemMessage("負重率: " + (int)Config.RATE_WEIGHT_LIMIT) + " 倍");
}
}
} catch(Exception e) {
pc.sendPackets(new S_SystemMessage("請輸入 .rates [XP,ADENA,DROP,LAW,KARMA,WEIGHT,ALL] [數值,RESET]"));
pc.sendPackets(new S_SystemMessage("經驗值: " + (int)Config.RATE_XP) + " 倍");
pc.sendPackets(new S_SystemMessage("金幣掉落: " + (int)Config.RATE_DROP_ADENA) + " 倍");
pc.sendPackets(new S_SystemMessage("物品掉落: " + (int)Config.RATE_DROP_ITEMS) + " 倍");
pc.sendPackets(new S_SystemMessage("正義值: " + (int)Config.RATE_LA) + " 倍");
pc.sendPackets(new S_SystemMessage("友好度: " + (int)Config.RATE_KARMA) + " 倍");
pc.sendPackets(new S_SystemMessage("負重率: " + (int)Config.RATE_WEIGHT_LIMIT) + " 倍");
}
if (!changed.equals("Error")) {
if (changed.equals("RESET")) {
broadcastToAll("遊戲管理員將" + changed + "的倍率重新設定為 1.0 倍");
} else {
broadcastToAll("遊戲管理員將" + changed + "的倍率更改為 " + data + " 倍");
}
}
}
private void broadcastToAll(String s) {
L1World.getInstance().broadcastPacketToAll(new S_SystemMessage(s));
}
}
複製代碼
增加資料庫數據
INSERT INTO `commands` VALUES ('rates', '200', 'L1Rates');
複製代碼
遊戲中使用指令 .rates [XP,ADENA,DROP,LAW,KARMA,WEIGHT,ALL] [數值,RESET]
|