📄 l1skilltimer.java
字号:
}
} else if (skillId == COOKING_1_3_N || skillId == COOKING_1_3_S) { // 蟻脚のチーズ焼き
if (cha instanceof L1PcInstance) {
L1PcInstance pc = (L1PcInstance) cha;
pc.addAc(1);
pc.sendPackets(new S_PacketBox(53, 3, 0));
pc.setCookingId(0);
}
} else if (skillId == COOKING_1_4_N || skillId == COOKING_1_4_S) { // フルーツサラダ
if (cha instanceof L1PcInstance) {
L1PcInstance pc = (L1PcInstance) cha;
pc.addMaxMp(-20);
pc.sendPackets(new S_MPUpdate(pc.getCurrentMp(),
pc.getMaxMp()));
pc.sendPackets(new S_PacketBox(53, 4, 0));
pc.setCookingId(0);
}
} else if (skillId == COOKING_1_5_N || skillId == COOKING_1_5_S) { // フルーツ甘酢あんかけ
if (cha instanceof L1PcInstance) {
L1PcInstance pc = (L1PcInstance) cha;
pc.sendPackets(new S_PacketBox(53, 5, 0));
pc.setCookingId(0);
}
} else if (skillId == COOKING_1_6_N || skillId == COOKING_1_6_S) { // 猪肉の串焼き
if (cha instanceof L1PcInstance) {
L1PcInstance pc = (L1PcInstance) cha;
pc.addMr(-5);
pc.sendPackets(new S_SPMR(pc));
pc.sendPackets(new S_PacketBox(53, 6, 0));
pc.setCookingId(0);
}
} else if (skillId == COOKING_1_7_N || skillId == COOKING_1_7_S) { // キノコスープ
if (cha instanceof L1PcInstance) {
L1PcInstance pc = (L1PcInstance) cha;
pc.sendPackets(new S_PacketBox(53, 7, 0));
pc.setDessertId(0);
}
} else if (skillId == COOKING_2_0_N || skillId == COOKING_2_0_S) { // キャビアカナッペ
if (cha instanceof L1PcInstance) {
L1PcInstance pc = (L1PcInstance) cha;
pc.sendPackets(new S_PacketBox(53, 8, 0));
pc.setCookingId(0);
}
} else if (skillId == COOKING_2_1_N || skillId == COOKING_2_1_S) { // アリゲーターステーキ
if (cha instanceof L1PcInstance) {
L1PcInstance pc = (L1PcInstance) cha;
pc.addMaxHp(-30);
pc.sendPackets(new S_HPUpdate(pc.getCurrentHp(),
pc.getMaxHp()));
if (pc.isInParty()) { // パーティー中
pc.getParty().updateMiniHP(pc);
}
pc.addMaxMp(-30);
pc.sendPackets(new S_MPUpdate(pc.getCurrentMp(),
pc.getMaxMp()));
pc.sendPackets(new S_PacketBox(53, 9, 0));
pc.setCookingId(0);
}
} else if (skillId == COOKING_2_2_N || skillId == COOKING_2_2_S) { // タートルドラゴンの菓子
if (cha instanceof L1PcInstance) {
L1PcInstance pc = (L1PcInstance) cha;
pc.addAc(2);
pc.sendPackets(new S_PacketBox(53, 10, 0));
pc.setCookingId(0);
}
} else if (skillId == COOKING_2_3_N || skillId == COOKING_2_3_S) { // キウィパロット焼き
if (cha instanceof L1PcInstance) {
L1PcInstance pc = (L1PcInstance) cha;
pc.sendPackets(new S_PacketBox(53, 11, 0));
pc.setCookingId(0);
}
} else if (skillId == COOKING_2_4_N || skillId == COOKING_2_4_S) { // スコーピオン焼き
if (cha instanceof L1PcInstance) {
L1PcInstance pc = (L1PcInstance) cha;
pc.sendPackets(new S_PacketBox(53, 12, 0));
pc.setCookingId(0);
}
} else if (skillId == COOKING_2_5_N || skillId == COOKING_2_5_S) { // イレッカドムシチュー
if (cha instanceof L1PcInstance) {
L1PcInstance pc = (L1PcInstance) cha;
pc.addMr(-10);
pc.sendPackets(new S_SPMR(pc));
pc.sendPackets(new S_PacketBox(53, 13, 0));
pc.setCookingId(0);
}
} else if (skillId == COOKING_2_6_N || skillId == COOKING_2_6_S) { // クモ脚の串焼き
if (cha instanceof L1PcInstance) {
L1PcInstance pc = (L1PcInstance) cha;
pc.addSp(-1);
pc.sendPackets(new S_SPMR(pc));
pc.sendPackets(new S_PacketBox(53, 14, 0));
pc.setCookingId(0);
}
} else if (skillId == COOKING_2_7_N || skillId == COOKING_2_7_S) { // クラブスープ
if (cha instanceof L1PcInstance) {
L1PcInstance pc = (L1PcInstance) cha;
pc.sendPackets(new S_PacketBox(53, 15, 0));
pc.setDessertId(0);
}
} else if (skillId == COOKING_3_0_N || skillId == COOKING_3_0_S) { // クラスタシアンのハサミ焼き
if (cha instanceof L1PcInstance) {
L1PcInstance pc = (L1PcInstance) cha;
pc.sendPackets(new S_PacketBox(53, 16, 0));
pc.setCookingId(0);
}
} else if (skillId == COOKING_3_1_N || skillId == COOKING_3_1_S) { // グリフォン焼き
if (cha instanceof L1PcInstance) {
L1PcInstance pc = (L1PcInstance) cha;
pc.addMaxHp(-50);
pc.sendPackets(new S_HPUpdate(pc.getCurrentHp(),
pc.getMaxHp()));
if (pc.isInParty()) { // パーティー中
pc.getParty().updateMiniHP(pc);
}
pc.addMaxMp(-50);
pc.sendPackets(new S_MPUpdate(pc.getCurrentMp(),
pc.getMaxMp()));
pc.sendPackets(new S_PacketBox(53, 17, 0));
pc.setCookingId(0);
}
} else if (skillId == COOKING_3_2_N || skillId == COOKING_3_2_S) { // コカトリスステーキ
if (cha instanceof L1PcInstance) {
L1PcInstance pc = (L1PcInstance) cha;
pc.sendPackets(new S_PacketBox(53, 18, 0));
pc.setCookingId(0);
}
} else if (skillId == COOKING_3_3_N || skillId == COOKING_3_3_S) { // タートルドラゴン焼き
if (cha instanceof L1PcInstance) {
L1PcInstance pc = (L1PcInstance) cha;
pc.addAc(3);
pc.sendPackets(new S_PacketBox(53, 19, 0));
pc.setCookingId(0);
}
} else if (skillId == COOKING_3_4_N || skillId == COOKING_3_4_S) { // レッサードラゴンの手羽先
if (cha instanceof L1PcInstance) {
L1PcInstance pc = (L1PcInstance) cha;
pc.addMr(-15);
pc.sendPackets(new S_SPMR(pc));
pc.addWind(-10);
pc.addWater(-10);
pc.addFire(-10);
pc.addEarth(-10);
pc.sendPackets(new S_OwnCharAttrDef(pc));
pc.sendPackets(new S_PacketBox(53, 20, 0));
pc.setCookingId(0);
}
} else if (skillId == COOKING_3_5_N || skillId == COOKING_3_5_S) { // ドレイク焼き
if (cha instanceof L1PcInstance) {
L1PcInstance pc = (L1PcInstance) cha;
pc.addSp(-2);
pc.sendPackets(new S_SPMR(pc));
pc.sendPackets(new S_PacketBox(53, 21, 0));
pc.setCookingId(0);
}
} else if (skillId == COOKING_3_6_N || skillId == COOKING_3_6_S) { // 深海魚のシチュー
if (cha instanceof L1PcInstance) {
L1PcInstance pc = (L1PcInstance) cha;
pc.addMaxHp(-30);
pc.sendPackets(new S_HPUpdate(pc.getCurrentHp(),
pc.getMaxHp()));
if (pc.isInParty()) { // パーティー中
pc.getParty().updateMiniHP(pc);
}
pc.sendPackets(new S_PacketBox(53, 22, 0));
pc.setCookingId(0);
}
} else if (skillId == COOKING_3_7_N || skillId == COOKING_3_7_S) { // バシリスクの卵スープ
if (cha instanceof L1PcInstance) {
L1PcInstance pc = (L1PcInstance) cha;
pc.sendPackets(new S_PacketBox(53, 23, 0));
pc.setDessertId(0);
}
}
if (cha instanceof L1PcInstance) {
L1PcInstance pc = (L1PcInstance) cha;
sendStopMessage(pc, skillId);
pc.sendPackets(new S_OwnCharStatus(pc));
}
}
// メッセージの表示(終了するとき)
private static void sendStopMessage(L1PcInstance charaPc, int skillid) {
L1Skills l1skills = SkillsTable.getInstance().getTemplate(skillid);
if (l1skills == null || charaPc == null) {
return;
}
int msgID = l1skills.getSysmsgIdStop();
if (msgID > 0) {
charaPc.sendPackets(new S_ServerMessage(msgID));
}
}
}
class L1SkillTimerThreadImpl extends Thread implements L1SkillTimer {
public L1SkillTimerThreadImpl(L1Character cha, int skillId, int timeMillis) {
_cha = cha;
_skillId = skillId;
_timeMillis = timeMillis;
}
@Override
public void run() {
for (int timeCount = _timeMillis / 1000; timeCount > 0; timeCount--) {
try {
Thread.sleep(1000);
_remainingTime = timeCount;
} catch (InterruptedException e) {
return;
}
}
_cha.removeSkillEffect(_skillId);
}
public int getRemainingTime() {
return _remainingTime;
}
public void begin() {
GeneralThreadPool.getInstance().execute(this);
}
public void end() {
super.interrupt();
L1SkillStop.stopSkill(_cha, _skillId);
}
public void kill() {
if (Thread.currentThread().getId() == super.getId()) {
return; // 呼び出し元スレッドが自分であれば止めない
}
super.stop();
}
private final L1Character _cha;
private final int _timeMillis;
private final int _skillId;
private int _remainingTime;
}
class L1SkillTimerTimerImpl implements L1SkillTimer, Runnable {
private static l1j.eric.EricLogger _log = l1j.eric.EricLogger.getLogger2(L1SkillTimerTimerImpl.class
.getName());
private ScheduledFuture<?> _future = null;
public L1SkillTimerTimerImpl(L1Character cha, int skillId, int timeMillis) {
_cha = cha;
_skillId = skillId;
_timeMillis = timeMillis;
_remainingTime = _timeMillis / 1000;
}
@Override
public void run() {
_remainingTime--;
if (_remainingTime <= 0) {
_cha.removeSkillEffect(_skillId);
}
}
@Override
public void begin() {
_future = GeneralThreadPool.getInstance().scheduleAtFixedRate(this,
1000, 1000);
}
@Override
public void end() {
kill();
try {
L1SkillStop.stopSkill(_cha, _skillId);
} catch (Throwable e) {
_log.log(Level.SEVERE, e.getLocalizedMessage(), e);
}
}
@Override
public void kill() {
if (_future != null) {
_future.cancel(false);
}
}
@Override
public int getRemainingTime() {
return _remainingTime;
}
private final L1Character _cha;
private final int _timeMillis;
private final int _skillId;
private int _remainingTime;
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -