瘋天堂私服發佈網站廣告欄位!
害怕天堂私服倒閉嗎?快使用天堂分析師!
天堂私服抽獎扭蛋物品及機率測試器
天堂私服稱號顏色製造器
瘋天堂私服發佈網站教您註冊推文收藏私服!
天堂私服血量魔力計算器
瘋天堂私服發布網站廣告贊助及爆料私服客服
教您如何不用註冊也可以推文天堂私服!
天堂私服270怪物查詢掉落資料庫
天堂私服盟徽製造器
test0428
2011-12-27 01:53

天堂添加GM指令線上調整掉寶java教學!

將下列原碼新增加到\src\l1j\server\server\command\executor裡面

/*
* 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內要新增掉保指令!!就大功告成囉!!趕快上線測試看看吧!!^^



上一篇文章:天堂添加玩家PK殺人公告java教學!
下一篇文章:天堂基礎核心修改教學!

分享文章:分享到微博! 分享到臉書! 分享到噗浪! 分享到維特! 分享到Google+! 分享到LINE!