cai1996 发表于 2019-8-9 22:45:52

在線一段時間後給予道具

L1SkillId

加入

/** 在線一段時間後給予一個狀態(自訂) */
public static final int LOGIN_TIME_GET_ITEM = 9000;


L1SkillTimer



料理関係

在上面加入

else if (skillId == LOGIN_TIME_GET_ITEM) { // 在線一段時間後給予道具 by 丫傑
if (Config.OnLine_Accumulate_Time) {
if (cha instanceof L1PcInstance) {
L1PcInstance pc = (L1PcInstance) cha;
L1ItemInstance item = ItemTable.getInstance().createItem(
Config.O_L_A_T_Item);
item.setCount(1);
if (item != null) {
if (pc.getInventory().checkAddItem(item, 1) == L1Inventory.OK) {
pc.getInventory().storeItem(item);
} else { // 持てない場合は地面に落とす 處理のキャンセルはしない(不正防止)
L1World.getInstance()
.getInventory(pc.getX(), pc.getY(),
pc.getMapId()).storeItem(item);
}
pc.sendPackets(new S_ServerMessage(403, item
.getLogName())); // %0を手に入
}
}
cha.setSkillEffect(L1SkillId.LOGIN_TIME_GET_ITEM,
Config.O_L_A_T_Time * 1000); // N分鐘
}
}

C_LoginToServer
宣告

import static l1j.server.server.model.skill.L1SkillId.LOGIN_TIME_GET_ITEM; // 在線一段時間後給予一個狀態



public static void items(L1PcInstance pc) {

在上面加入

// 在線一段時間後給予道具 by 丫傑
if (Config.OnLine_Accumulate_Time) {
if (!pc.hasSkillEffect(LOGIN_TIME_GET_ITEM)) {
pc.setSkillEffect(LOGIN_TIME_GET_ITEM,
Config.O_L_A_T_Time * 1000); // N分鐘
}
}
// end



Config
位置我放在(//othersettings.properties)

加入1

public static boolean OnLine_Accumulate_Time; // 設定在線一段時間後是否給予道具
public static short O_L_A_T_Time; // 累積時間
public static int O_L_A_T_Item; // 發送道具編號

加入2

OnLine_Accumulate_Time = Boolean.parseBoolean(otherSettings
.getProperty("OnLineAccumulateTime", "false")); // 設定在線一段時間後是否給予道具
O_L_A_T_Time = Short.parseShort(otherSettings.getProperty(
"OLATTime", "3600")); // 累積時間
O_L_A_T_Item = Integer.parseInt(otherSettings.getProperty(
"OLATItem", "60000")); // 發送道具編號

加入3

} else if (pName.equalsIgnoreCase("OnLineAccumulateTime")) {
OnLine_Accumulate_Time = Boolean.valueOf(pValue); // 設定在線一段時間後是否給予道具
} else if (pName.equalsIgnoreCase("OLATTime")) {
O_L_A_T_Time = Short.valueOf(pValue); // 累積時間
} else if (pName.equalsIgnoreCase("OLATItem")) {
O_L_A_T_Item = Short.valueOf(pValue); // 發送道具編號

最後

模擬器開啟

config資料夾



othersettings.properties檔

加入

#a-設定在線一段時間後是否給予道具? True=是, False=否
OnLineAccumulateTime = True
#b-累積時間 (單位:秒)
OLATTime = 900
#c-發送道具編號 (item_id)
OLATItem = 40733


完成!!!

mao188166 发表于 2019-11-11 09:21:59

謝謝大大的分享,

mao188166 发表于 2019-11-17 12:22:27

再次表示谢谢了。

mao188166 发表于 2019-11-17 15:26:41

再次表示谢谢了。

tw520 发表于 2019-11-18 21:28:40

謝謝大大的分享

sunlong99 发表于 2019-12-7 14:06:50

   可能没有用了吧

a133030303 发表于 2020-3-6 14:09:39

再次表示谢谢了。

天堂男 发表于 2020-6-25 00:14:03

感覺很不錯:):)

nudy 发表于 2020-6-28 20:23:47

謝謝分享,謝謝

lobster33 发表于 2020-7-18 04:35:12


謝謝大大的分享
页: [1] 2 3 4 5
查看完整版本: 在線一段時間後給予道具