📄 l1teleporterinstance.java
字号:
/*
* 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.
*
* http://www.gnu.org/copyleft/gpl.html
*/
package l1j.server.server.model.Instance;
import java.util.Random;
import java.util.logging.Logger;
import l1j.server.server.GeneralThreadPool;
import l1j.server.server.datatables.NPCTalkDataTable;
import l1j.server.server.model.L1Attack;
import l1j.server.server.model.L1NpcTalkData;
import l1j.server.server.model.L1Quest;
import l1j.server.server.model.L1Teleport;
import l1j.server.server.model.L1World;
import l1j.server.server.model.npc.L1NpcHtml;
import l1j.server.server.serverpackets.S_NPCTalkReturn;
import l1j.server.server.templates.L1Npc;
// Referenced classes of package l1j.server.server.model:
// L1NpcInstance, L1Teleport, L1NpcTalkData, L1PcInstance,
// L1TeleporterPrices, L1TeleportLocations
public class L1TeleporterInstance extends L1NpcInstance {
/**
*
*/
private static final long serialVersionUID = 1L;
public L1TeleporterInstance(L1Npc template) {
super(template);
}
@Override
public void onAction(L1PcInstance player) {
L1Attack attack = new L1Attack(player, this);
attack.calcHit();
attack.action();
}
@Override
public void onTalkAction(L1PcInstance player) {
int objid = getId();
L1NpcTalkData talking = NPCTalkDataTable.getInstance().getTemplate(
getNpcTemplate().get_npcId());
int npcid = getNpcTemplate().get_npcId();
L1Quest quest = player.getQuest();
String htmlid = null;
if (talking != null) {
if (npcid == 50014) { // ディロン
if (player.isWizard()) { // ウィザード
if (quest.get_step(L1Quest.QUEST_LEVEL30) == 1
&& !player.getInventory().checkItem(40579)) { // アンデッドの骨
htmlid = "dilong1";
} else {
htmlid = "dilong3";
}
}
} else if (npcid == 70779) { // ゲートアント
if (player.getTempCharGfx() == 1037) { // ジャイアントアント変身
htmlid = "ants3";
} else if (player.getTempCharGfx() == 1039) {// ジャイアントアントソルジャー変身
if (player.isCrown()) { // 君主
if (quest.get_step(L1Quest.QUEST_LEVEL30) == 1) {
if (player.getInventory().checkItem(40547)) { // 住民たちの遺品
htmlid = "antsn";
} else {
htmlid = "ants1";
}
} else { // Step1以外
htmlid = "antsn";
}
} else { // 君主以外
htmlid = "antsn";
}
}
} else if (npcid == 70853) { // フェアリープリンセス
if (player.isElf()) { // エルフ
if (quest.get_step(L1Quest.QUEST_LEVEL30) == 1) {
if (!player.getInventory().checkItem(40592)) { // 呪われた精霊書
Random random = new Random();
if (random.nextInt(100) < 50) { // 50%でダークマールダンジョン
htmlid = "fairyp2";
} else { // ダークエルフダンジョン
htmlid = "fairyp1";
}
}
}
}
} else if (npcid == 50031) { // セピア
if (player.isElf()) { // エルフ
if (quest.get_step(L1Quest.QUEST_LEVEL45) == 2) {
if (!player.getInventory().checkItem(40602)) { // ブルーフルート
htmlid = "sepia1";
}
}
}
} else if (npcid == 50043) { // ラムダ
if (quest.get_step(L1Quest.QUEST_LEVEL50) == L1Quest.QUEST_END) {
htmlid = "ramuda2";
} else if (quest.get_step(L1Quest.QUEST_LEVEL50) == 1) { // ディガルディン同意済み
if (player.isCrown()) { // 君主
if (_isNowDely) { // テレポートディレイ中
htmlid = "ramuda4";
} else {
htmlid = "ramudap1";
}
} else { // 君主以外
htmlid = "ramuda1";
}
} else {
htmlid = "ramuda3";
}
}
// 歌う島のテレポーター
else if (npcid == 50082) {
if (player.getLevel() < 13) {
htmlid = "en0221";
} else {
if (player.isElf()) {
htmlid = "en0222e";
} else if (player.isDarkelf()) {
htmlid = "en0222d";
} else {
htmlid = "en0222";
}
}
}
// バルニア
else if (npcid == 50001) {
if (player.isElf()) {
htmlid = "barnia3";
} else if (player.isKnight() || player.isCrown()) {
htmlid = "barnia2";
} else if (player.isWizard() || player.isDarkelf()) {
htmlid = "barnia1";
}
}
// html表示
if (htmlid != null) { // htmlidが指定されている場合
player.sendPackets(new S_NPCTalkReturn(objid, htmlid));
} else {
if (player.getLawful() < -1000) { // プレイヤーがカオティック
player.sendPackets(new S_NPCTalkReturn(talking, objid, 2));
} else {
player.sendPackets(new S_NPCTalkReturn(talking, objid, 1));
}
}
} else {
_log.finest((new StringBuilder())
.append("No actions for npc id : ").append(objid)
.toString());
}
}
@Override
public void onFinalAction(L1PcInstance player, String action) {
int objid = getId();
L1NpcTalkData talking = NPCTalkDataTable.getInstance().getTemplate(
getNpcTemplate().get_npcId());
if (action.equalsIgnoreCase("teleportURL")) {
L1NpcHtml html = new L1NpcHtml(talking.getTeleportURL());
// 刪除player.sendPackets(new S_NPCTalkReturn(objid, html));
//TODO 修正傳送師顯示傳送金額 by 阿傑
String[] price = null;
int npcid = getNpcTemplate().get_npcId();
switch(npcid)
{
case 50015: { // 說話島-魔法師盧卡斯
price = new String[]{"2100"};
}
break;
case 50020: { // 肯特村-魔法師史坦利
price = new String[]{ "75","75","75","180","180","180","180","270","270","300","300","900","10650" };
}
break;
case 50024: { // 古魯丁-魔法師史提夫
price = new String[]{ "70","70","70","168","168","252","252","1000","1000","336","336","280","280","700","9520" };
}
break;
case 50036: { // 奇岩村-魔法師爾瑪
price = new String[]{ "75","75","75","180","180","180","180","270","270","450","450","1050","11100" };
}
break;
case 50039: { // 威頓村-魔法師萊思利
price = new String[]{ "75","75","180","180","270","270","270","360","360","600","600","1200","11550" };
}
break;
case 50044: { // 亞丁城-魔法師西里烏斯
price = new String[]{ "50","120","120","180","180","180","240","240","300","500","500","900","7400" };
}
break;
case 50046: { // 亞丁城-魔法師艾勒里斯
price = new String[]{ "50","120","120","120","180","180","180","240","300","500","500","900","7400" };
}
break;
case 50051: { // 歐瑞村-魔法師吉利烏斯
price = new String[]{ "75","180","270","270","360","360","360","450","450","750","750","1350","12000" };
}
break;
case 50054: { // 風木村-魔法師特萊
price = new String[]{ "75","75","75","180","180","270","270","360","450","300","300","750","9750" };
}
break;
case 50056: { // 銀騎村-魔法師麥特
price = new String[]{"75","75","75","180","180","180","270","270","1000","1000","360","450","450","1050","10200"};
}
break;
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -