最新公告
★ 歡迎來到天堂私服123 | 天天更新最新私服資訊
天堂私服123|每日開服情報
首頁 › 文章看板 › 🖥️ 私服架設 › 為天堂私服GM的指令加上線上調整掉寶~
🖥️ 私服架設

為天堂私服GM的指令加上線上調整掉寶~

🧙
匿名

將下列原碼新增加到srcl1jserverservercommandexecutor裡面

/*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2, or (at your option)
* any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
* 02111-1307, USA.
*
* 請點此開啟連結或下載檔案
*/
package l1j.server.server.command.executor;

import java.util.StringTokenizer;
import java.util.logging.Logger;

import l1j.server.Config;
import l1j.server.server.model.L1World;
import l1j.server.server.model.Instance.L1ItemInstance;
import l1j.server.server.model.Instance.L1PcInstance;
import l1j.server.server.model.item.L1ItemId;
import l1j.server.server.serverpackets.S_SystemMessage;

public class L1ChangeDrop implements L1CommandExecutor {
private static Logger _log = Logger.getLogger(L1ChangeDrop.class.getName());

private L1ChangeDrop() {
}

public static L1CommandExecutor getInstance() {
return new L1ChangeDrop();
}

//TODO 線上調整掉寶率 by 710410
private Thread changeExpThread = null;

//@Override
public void execute(L1PcInstance pc, String cmdName, String arg) {
try {
StringTokenizer st = new StringTokenizer(arg);
int index = Integer.parseInt(st.nextToken());

String arg1 = null;
String arg2 = null;

if (index >= 0) {
StringTokenizer token = new StringTokenizer(arg, " ");

if (token.hasMoreTokens()) {
arg1 = token.nextToken().trim();
}
if (token.hasMoreTokens()) {
arg2 = token.nextToken().trim();
}
}

if (arg1 != null && !arg1.equals("")) {
final double rateDrop = Double.parseDouble(arg1);
final double oldrateDrop = Config.RATE_DROP_ITEMS;
if (arg2 != null && !arg2.equals("")) {
final int interval = Integer.parseInt(arg2) * 60 * 1000;
if (this.changeExpThread == null) {
this.changeExpThread = new Thread() {
public void run() {
Config.RATE_DROP_ITEMS = rateDrop;
try {
sleep(interval);
} catch (Exception e) {
System.out.println(e);
}
Config.RATE_DROP_ITEMS = oldrateDrop;
}
};
this.changeExpThread.start();
} else {
this.changeExpThread.interrupt();

this.changeExpThread = new Thread() {
public void run() {
Config.RATE_DROP_ITEMS = rateDrop;
try {
sleep(interval);
} catch (Exception e) {
System.out.println(e);
}
Config.RATE_DROP_ITEMS = oldrateDrop;
}
};
this.changeExpThread.start();
}
} else {
Config.RATE_DROP_ITEMS = rateDrop;
}
try {
Thread.sleep(400);
} catch (Exception e) {
System.out.println(e);
}
L1World.getInstance().broadcastServerMessage(
"系統公告" + ": " +
"掉寶率已調整為" + "【" + Config.RATE_DROP_ITEMS + " 】" +
"倍" + "。");
pc.sendPackets(new S_SystemMessage(
"掉寶率已調整為" + "【" + Config.RATE_DROP_ITEMS + " 】" +
"倍" + "。"));
} else {
pc.sendPackets(new S_SystemMessage(
"目前的掉寶率為" + "【" + Config.RATE_DROP_ITEMS + " 】" +
"倍" + "。"));
}
} catch (Exception e) {
pc.sendPackets(new S_SystemMessage("請輸入『.drop 倍率』。"));
}
}
}


記得DB內要新增掉保指令!!就大功告成囉!!趕快上線測試看看吧!!^^

❤️ 0 💬 0 🔄 0 🔖 0
分享 f L 𝕏 已複製

💬 留言

還沒有留言,來搶頭香吧!

LINE 諮詢
比較:
開始比較
PlaySF

ui.pwa_install

ui.install_prompt