Addition of TeleporterQuestRecommendationHolder.
This commit is contained in:
parent
bc61b48a56
commit
5c14df03a9
@ -68,7 +68,7 @@ public class AdminMissingHtmls implements IAdminCommandHandler
|
||||
&& !results.contains(obj.getId()))
|
||||
{
|
||||
final Npc npc = (Npc) obj;
|
||||
if ((npc.getLocation().getX() > topLeftX) && (npc.getLocation().getX() < bottomRightX) && (npc.getLocation().getY() > topLeftY) && (npc.getLocation().getY() < bottomRightY) && npc.isTalkable() && !npc.hasListener(EventType.ON_NPC_FIRST_TALK) && (npc.getHtmlPath(npc.getId(), 0) == "data/html/npcdefault.htm"))
|
||||
if ((npc.getLocation().getX() > topLeftX) && (npc.getLocation().getX() < bottomRightX) && (npc.getLocation().getY() > topLeftY) && (npc.getLocation().getY() < bottomRightY) && npc.isTalkable() && !npc.hasListener(EventType.ON_NPC_FIRST_TALK) && (npc.getHtmlPath(npc.getId(), 0, null) == "data/html/npcdefault.htm"))
|
||||
{
|
||||
results.add(npc.getId());
|
||||
}
|
||||
@ -95,7 +95,7 @@ public class AdminMissingHtmls implements IAdminCommandHandler
|
||||
&& !results.contains(obj.getId()))
|
||||
{
|
||||
final Npc npc = (Npc) obj;
|
||||
if (npc.isTalkable() && !npc.hasListener(EventType.ON_NPC_FIRST_TALK) && (npc.getHtmlPath(npc.getId(), 0) == "data/html/npcdefault.htm"))
|
||||
if (npc.isTalkable() && !npc.hasListener(EventType.ON_NPC_FIRST_TALK) && (npc.getHtmlPath(npc.getId(), 0, null) == "data/html/npcdefault.htm"))
|
||||
{
|
||||
results.add(npc.getId());
|
||||
}
|
||||
|
@ -681,9 +681,10 @@ public class Npc extends Creature
|
||||
* </ul>
|
||||
* @param npcId The Identifier of the NpcInstance whose text must be display
|
||||
* @param val The number of the page to display
|
||||
* @param player The player that speaks to this NPC
|
||||
* @return the pathfile of the selected HTML file in function of the npcId and of the page number.
|
||||
*/
|
||||
public String getHtmlPath(int npcId, int val)
|
||||
public String getHtmlPath(int npcId, int val, PlayerInstance player)
|
||||
{
|
||||
String pom = "";
|
||||
|
||||
@ -808,7 +809,7 @@ public class Npc extends Creature
|
||||
}
|
||||
else
|
||||
{
|
||||
filename = (getHtmlPath(npcId, val));
|
||||
filename = (getHtmlPath(npcId, val, player));
|
||||
}
|
||||
break;
|
||||
}
|
||||
@ -824,7 +825,7 @@ public class Npc extends Creature
|
||||
}
|
||||
else
|
||||
{
|
||||
filename = (getHtmlPath(npcId, val));
|
||||
filename = (getHtmlPath(npcId, val, player));
|
||||
}
|
||||
break;
|
||||
}
|
||||
@ -832,11 +833,11 @@ public class Npc extends Creature
|
||||
{
|
||||
if (player.isAcademyMember())
|
||||
{
|
||||
filename = (getHtmlPath(npcId, 1));
|
||||
filename = (getHtmlPath(npcId, 1, player));
|
||||
}
|
||||
else
|
||||
{
|
||||
filename = (getHtmlPath(npcId, val));
|
||||
filename = (getHtmlPath(npcId, val, player));
|
||||
}
|
||||
break;
|
||||
}
|
||||
@ -847,7 +848,7 @@ public class Npc extends Creature
|
||||
return;
|
||||
}
|
||||
// Get the text of the selected HTML file in function of the npcId and of the page number
|
||||
filename = (getHtmlPath(npcId, val));
|
||||
filename = (getHtmlPath(npcId, val, player));
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
@ -36,7 +36,7 @@ public final class FishermanInstance extends MerchantInstance
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getHtmlPath(int npcId, int val)
|
||||
public String getHtmlPath(int npcId, int val, PlayerInstance player)
|
||||
{
|
||||
String pom = "";
|
||||
|
||||
|
@ -213,7 +213,7 @@ public class FortLogisticsInstance extends MerchantInstance
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getHtmlPath(int npcId, int val)
|
||||
public String getHtmlPath(int npcId, int val, PlayerInstance player)
|
||||
{
|
||||
String pom = "";
|
||||
|
||||
|
@ -149,7 +149,7 @@ public class FriendlyNpcInstance extends Attackable
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getHtmlPath(int npcId, int val)
|
||||
public String getHtmlPath(int npcId, int val, PlayerInstance player)
|
||||
{
|
||||
String pom = "";
|
||||
if (val == 0)
|
||||
|
@ -109,7 +109,7 @@ public class GuardInstance extends Attackable
|
||||
* @param val The number of the page to display
|
||||
*/
|
||||
@Override
|
||||
public String getHtmlPath(int npcId, int val)
|
||||
public String getHtmlPath(int npcId, int val, PlayerInstance player)
|
||||
{
|
||||
String pom = "";
|
||||
if (val == 0)
|
||||
|
@ -49,7 +49,7 @@ public class MerchantInstance extends NpcInstance
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getHtmlPath(int npcId, int val)
|
||||
public String getHtmlPath(int npcId, int val, PlayerInstance player)
|
||||
{
|
||||
String pom;
|
||||
if (val == 0)
|
||||
|
@ -30,7 +30,7 @@ public class PetManagerInstance extends MerchantInstance
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getHtmlPath(int npcId, int val)
|
||||
public String getHtmlPath(int npcId, int val, PlayerInstance player)
|
||||
{
|
||||
String pom = "";
|
||||
|
||||
|
@ -355,7 +355,7 @@ public class RaceManagerInstance extends Npc
|
||||
String filename;
|
||||
String search;
|
||||
final NpcHtmlMessage html = new NpcHtmlMessage(getObjectId());
|
||||
filename = getHtmlPath(npcId, 5);
|
||||
filename = getHtmlPath(npcId, 5, player);
|
||||
html.setFile(player, filename);
|
||||
for (int i = 0; i < 8; i++)
|
||||
{
|
||||
@ -375,7 +375,7 @@ public class RaceManagerInstance extends Npc
|
||||
String filename;
|
||||
String search;
|
||||
final NpcHtmlMessage html = new NpcHtmlMessage(getObjectId());
|
||||
filename = getHtmlPath(npcId, 6);
|
||||
filename = getHtmlPath(npcId, 6, player);
|
||||
html.setFile(player, filename);
|
||||
for (int i = 0; i < 8; i++)
|
||||
{
|
||||
@ -402,7 +402,7 @@ public class RaceManagerInstance extends Npc
|
||||
final NpcHtmlMessage html = new NpcHtmlMessage(getObjectId());
|
||||
if (val < 10)
|
||||
{
|
||||
filename = getHtmlPath(npcId, 2);
|
||||
filename = getHtmlPath(npcId, 2, player);
|
||||
html.setFile(player, filename);
|
||||
for (int i = 0; i < 8; i++)
|
||||
{
|
||||
@ -427,7 +427,7 @@ public class RaceManagerInstance extends Npc
|
||||
{
|
||||
return;
|
||||
}
|
||||
filename = getHtmlPath(npcId, 3);
|
||||
filename = getHtmlPath(npcId, 3, player);
|
||||
html.setFile(player, filename);
|
||||
html.replace("0place", Integer.toString(player.getRace(0)));
|
||||
search = "Mob1";
|
||||
@ -450,7 +450,7 @@ public class RaceManagerInstance extends Npc
|
||||
{
|
||||
return;
|
||||
}
|
||||
filename = getHtmlPath(npcId, 4);
|
||||
filename = getHtmlPath(npcId, 4, player);
|
||||
html.setFile(player, filename);
|
||||
html.replace("0place", Integer.toString(player.getRace(0)));
|
||||
search = "Mob1";
|
||||
|
@ -16,6 +16,9 @@
|
||||
*/
|
||||
package com.l2jmobius.gameserver.model.actor.instance;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.StringTokenizer;
|
||||
import java.util.logging.Logger;
|
||||
|
||||
@ -26,6 +29,8 @@ import com.l2jmobius.gameserver.instancemanager.CastleManager;
|
||||
import com.l2jmobius.gameserver.model.actor.Creature;
|
||||
import com.l2jmobius.gameserver.model.actor.Npc;
|
||||
import com.l2jmobius.gameserver.model.actor.templates.NpcTemplate;
|
||||
import com.l2jmobius.gameserver.model.holders.TeleporterQuestRecommendationHolder;
|
||||
import com.l2jmobius.gameserver.model.quest.QuestState;
|
||||
import com.l2jmobius.gameserver.model.skills.CommonSkill;
|
||||
import com.l2jmobius.gameserver.model.teleporter.TeleportHolder;
|
||||
import com.l2jmobius.gameserver.network.serverpackets.NpcHtmlMessage;
|
||||
@ -45,6 +50,14 @@ public final class TeleporterInstance extends Npc
|
||||
CommonSkill.NATIVE_TRANSFORM
|
||||
};
|
||||
|
||||
private static final Map<Integer, List<TeleporterQuestRecommendationHolder>> QUEST_RECOMENDATIONS = new HashMap<>();
|
||||
// static
|
||||
// {
|
||||
// QUEST_RECOMENDATIONS.put(30848, new ArrayList<>());
|
||||
// QUEST_RECOMENDATIONS.get(30848).add(new TeleporterQuestRecommendationHolder(30848, "Q00561_BasicMissionHarnakUndergroundRuins", -1, "30848-Q561-Q562"));
|
||||
// QUEST_RECOMENDATIONS.get(30848).add(new TeleporterQuestRecommendationHolder(30848, "Q00562_BasicMissionAltarOfEvil", -1, "30848-561-562"));
|
||||
// }
|
||||
|
||||
public TeleporterInstance(NpcTemplate template)
|
||||
{
|
||||
super(template);
|
||||
@ -156,9 +169,33 @@ public final class TeleporterInstance extends Npc
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getHtmlPath(int npcId, int val)
|
||||
public String getHtmlPath(int npcId, int val, PlayerInstance player)
|
||||
{
|
||||
final String pom = (val == 0) ? String.valueOf(npcId) : (npcId + "-" + val);
|
||||
String pom;
|
||||
if (val == 0)
|
||||
{
|
||||
pom = String.valueOf(npcId);
|
||||
if ((player != null) && QUEST_RECOMENDATIONS.containsKey(npcId))
|
||||
{
|
||||
for (TeleporterQuestRecommendationHolder rec : QUEST_RECOMENDATIONS.get(npcId))
|
||||
{
|
||||
final QuestState qs = player.getQuestState(rec.getQuestName());
|
||||
if (qs != null)
|
||||
{
|
||||
final int cond = rec.getCond();
|
||||
if ((cond == -1) || qs.isCond(cond))
|
||||
{
|
||||
pom = rec.getHtml();
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
pom = (npcId + "-" + val);
|
||||
}
|
||||
return "data/html/teleporter/" + pom + ".htm";
|
||||
}
|
||||
|
||||
@ -176,7 +213,7 @@ public final class TeleporterInstance extends Npc
|
||||
String filename = "data/html/teleporter/castleteleporter-no.htm";
|
||||
if ((player.getClan() != null) && (getCastle().getOwnerId() == player.getClanId())) // Clan owns castle
|
||||
{
|
||||
filename = getHtmlPath(getId(), 0); // Owner message window
|
||||
filename = getHtmlPath(getId(), 0, player); // Owner message window
|
||||
}
|
||||
else if (getCastle().getSiege().isInProgress()) // Teleporter is busy due siege
|
||||
{
|
||||
|
@ -74,7 +74,7 @@ public class VillageMasterInstance extends NpcInstance
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getHtmlPath(int npcId, int val)
|
||||
public String getHtmlPath(int npcId, int val, PlayerInstance player)
|
||||
{
|
||||
String pom = "";
|
||||
|
||||
|
@ -46,7 +46,7 @@ public class WarehouseInstance extends NpcInstance
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getHtmlPath(int npcId, int val)
|
||||
public String getHtmlPath(int npcId, int val, PlayerInstance player)
|
||||
{
|
||||
String pom = "";
|
||||
|
||||
|
@ -0,0 +1,56 @@
|
||||
/*
|
||||
* This file is part of the L2J Mobius project.
|
||||
*
|
||||
* 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 3 of the License, 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, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package com.l2jmobius.gameserver.model.holders;
|
||||
|
||||
/**
|
||||
* @author Mobius
|
||||
*/
|
||||
public class TeleporterQuestRecommendationHolder
|
||||
{
|
||||
private final int _npcId;
|
||||
private final String _questName;
|
||||
private final int _cond; // -1 = all conditions
|
||||
private final String _html;
|
||||
|
||||
public TeleporterQuestRecommendationHolder(int npcId, String questName, int cond, String html)
|
||||
{
|
||||
_npcId = npcId;
|
||||
_questName = questName;
|
||||
_cond = cond;
|
||||
_html = html;
|
||||
}
|
||||
|
||||
public int getNpcId()
|
||||
{
|
||||
return _npcId;
|
||||
}
|
||||
|
||||
public String getQuestName()
|
||||
{
|
||||
return _questName;
|
||||
}
|
||||
|
||||
public int getCond()
|
||||
{
|
||||
return _cond;
|
||||
}
|
||||
|
||||
public String getHtml()
|
||||
{
|
||||
return _html;
|
||||
}
|
||||
}
|
@ -68,7 +68,7 @@ public class AdminMissingHtmls implements IAdminCommandHandler
|
||||
&& !results.contains(obj.getId()))
|
||||
{
|
||||
final Npc npc = (Npc) obj;
|
||||
if ((npc.getLocation().getX() > topLeftX) && (npc.getLocation().getX() < bottomRightX) && (npc.getLocation().getY() > topLeftY) && (npc.getLocation().getY() < bottomRightY) && npc.isTalkable() && !npc.hasListener(EventType.ON_NPC_FIRST_TALK) && (npc.getHtmlPath(npc.getId(), 0) == "data/html/npcdefault.htm"))
|
||||
if ((npc.getLocation().getX() > topLeftX) && (npc.getLocation().getX() < bottomRightX) && (npc.getLocation().getY() > topLeftY) && (npc.getLocation().getY() < bottomRightY) && npc.isTalkable() && !npc.hasListener(EventType.ON_NPC_FIRST_TALK) && (npc.getHtmlPath(npc.getId(), 0, null) == "data/html/npcdefault.htm"))
|
||||
{
|
||||
results.add(npc.getId());
|
||||
}
|
||||
@ -95,7 +95,7 @@ public class AdminMissingHtmls implements IAdminCommandHandler
|
||||
&& !results.contains(obj.getId()))
|
||||
{
|
||||
final Npc npc = (Npc) obj;
|
||||
if (npc.isTalkable() && !npc.hasListener(EventType.ON_NPC_FIRST_TALK) && (npc.getHtmlPath(npc.getId(), 0) == "data/html/npcdefault.htm"))
|
||||
if (npc.isTalkable() && !npc.hasListener(EventType.ON_NPC_FIRST_TALK) && (npc.getHtmlPath(npc.getId(), 0, null) == "data/html/npcdefault.htm"))
|
||||
{
|
||||
results.add(npc.getId());
|
||||
}
|
||||
|
@ -681,9 +681,10 @@ public class Npc extends Creature
|
||||
* </ul>
|
||||
* @param npcId The Identifier of the NpcInstance whose text must be display
|
||||
* @param val The number of the page to display
|
||||
* @param player The player that speaks to this NPC
|
||||
* @return the pathfile of the selected HTML file in function of the npcId and of the page number.
|
||||
*/
|
||||
public String getHtmlPath(int npcId, int val)
|
||||
public String getHtmlPath(int npcId, int val, PlayerInstance player)
|
||||
{
|
||||
String pom = "";
|
||||
|
||||
@ -808,7 +809,7 @@ public class Npc extends Creature
|
||||
}
|
||||
else
|
||||
{
|
||||
filename = (getHtmlPath(npcId, val));
|
||||
filename = (getHtmlPath(npcId, val, player));
|
||||
}
|
||||
break;
|
||||
}
|
||||
@ -824,7 +825,7 @@ public class Npc extends Creature
|
||||
}
|
||||
else
|
||||
{
|
||||
filename = (getHtmlPath(npcId, val));
|
||||
filename = (getHtmlPath(npcId, val, player));
|
||||
}
|
||||
break;
|
||||
}
|
||||
@ -832,11 +833,11 @@ public class Npc extends Creature
|
||||
{
|
||||
if (player.isAcademyMember())
|
||||
{
|
||||
filename = (getHtmlPath(npcId, 1));
|
||||
filename = (getHtmlPath(npcId, 1, player));
|
||||
}
|
||||
else
|
||||
{
|
||||
filename = (getHtmlPath(npcId, val));
|
||||
filename = (getHtmlPath(npcId, val, player));
|
||||
}
|
||||
break;
|
||||
}
|
||||
@ -847,7 +848,7 @@ public class Npc extends Creature
|
||||
return;
|
||||
}
|
||||
// Get the text of the selected HTML file in function of the npcId and of the page number
|
||||
filename = (getHtmlPath(npcId, val));
|
||||
filename = (getHtmlPath(npcId, val, player));
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
@ -36,7 +36,7 @@ public final class FishermanInstance extends MerchantInstance
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getHtmlPath(int npcId, int val)
|
||||
public String getHtmlPath(int npcId, int val, PlayerInstance player)
|
||||
{
|
||||
String pom = "";
|
||||
|
||||
|
@ -213,7 +213,7 @@ public class FortLogisticsInstance extends MerchantInstance
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getHtmlPath(int npcId, int val)
|
||||
public String getHtmlPath(int npcId, int val, PlayerInstance player)
|
||||
{
|
||||
String pom = "";
|
||||
|
||||
|
@ -149,7 +149,7 @@ public class FriendlyNpcInstance extends Attackable
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getHtmlPath(int npcId, int val)
|
||||
public String getHtmlPath(int npcId, int val, PlayerInstance player)
|
||||
{
|
||||
String pom = "";
|
||||
if (val == 0)
|
||||
|
@ -109,7 +109,7 @@ public class GuardInstance extends Attackable
|
||||
* @param val The number of the page to display
|
||||
*/
|
||||
@Override
|
||||
public String getHtmlPath(int npcId, int val)
|
||||
public String getHtmlPath(int npcId, int val, PlayerInstance player)
|
||||
{
|
||||
String pom = "";
|
||||
if (val == 0)
|
||||
|
@ -49,7 +49,7 @@ public class MerchantInstance extends NpcInstance
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getHtmlPath(int npcId, int val)
|
||||
public String getHtmlPath(int npcId, int val, PlayerInstance player)
|
||||
{
|
||||
String pom;
|
||||
if (val == 0)
|
||||
|
@ -30,7 +30,7 @@ public class PetManagerInstance extends MerchantInstance
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getHtmlPath(int npcId, int val)
|
||||
public String getHtmlPath(int npcId, int val, PlayerInstance player)
|
||||
{
|
||||
String pom = "";
|
||||
|
||||
|
@ -355,7 +355,7 @@ public class RaceManagerInstance extends Npc
|
||||
String filename;
|
||||
String search;
|
||||
final NpcHtmlMessage html = new NpcHtmlMessage(getObjectId());
|
||||
filename = getHtmlPath(npcId, 5);
|
||||
filename = getHtmlPath(npcId, 5, player);
|
||||
html.setFile(player, filename);
|
||||
for (int i = 0; i < 8; i++)
|
||||
{
|
||||
@ -375,7 +375,7 @@ public class RaceManagerInstance extends Npc
|
||||
String filename;
|
||||
String search;
|
||||
final NpcHtmlMessage html = new NpcHtmlMessage(getObjectId());
|
||||
filename = getHtmlPath(npcId, 6);
|
||||
filename = getHtmlPath(npcId, 6, player);
|
||||
html.setFile(player, filename);
|
||||
for (int i = 0; i < 8; i++)
|
||||
{
|
||||
@ -402,7 +402,7 @@ public class RaceManagerInstance extends Npc
|
||||
final NpcHtmlMessage html = new NpcHtmlMessage(getObjectId());
|
||||
if (val < 10)
|
||||
{
|
||||
filename = getHtmlPath(npcId, 2);
|
||||
filename = getHtmlPath(npcId, 2, player);
|
||||
html.setFile(player, filename);
|
||||
for (int i = 0; i < 8; i++)
|
||||
{
|
||||
@ -427,7 +427,7 @@ public class RaceManagerInstance extends Npc
|
||||
{
|
||||
return;
|
||||
}
|
||||
filename = getHtmlPath(npcId, 3);
|
||||
filename = getHtmlPath(npcId, 3, player);
|
||||
html.setFile(player, filename);
|
||||
html.replace("0place", Integer.toString(player.getRace(0)));
|
||||
search = "Mob1";
|
||||
@ -450,7 +450,7 @@ public class RaceManagerInstance extends Npc
|
||||
{
|
||||
return;
|
||||
}
|
||||
filename = getHtmlPath(npcId, 4);
|
||||
filename = getHtmlPath(npcId, 4, player);
|
||||
html.setFile(player, filename);
|
||||
html.replace("0place", Integer.toString(player.getRace(0)));
|
||||
search = "Mob1";
|
||||
|
@ -16,6 +16,9 @@
|
||||
*/
|
||||
package com.l2jmobius.gameserver.model.actor.instance;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.StringTokenizer;
|
||||
import java.util.logging.Logger;
|
||||
|
||||
@ -26,6 +29,8 @@ import com.l2jmobius.gameserver.instancemanager.CastleManager;
|
||||
import com.l2jmobius.gameserver.model.actor.Creature;
|
||||
import com.l2jmobius.gameserver.model.actor.Npc;
|
||||
import com.l2jmobius.gameserver.model.actor.templates.NpcTemplate;
|
||||
import com.l2jmobius.gameserver.model.holders.TeleporterQuestRecommendationHolder;
|
||||
import com.l2jmobius.gameserver.model.quest.QuestState;
|
||||
import com.l2jmobius.gameserver.model.skills.CommonSkill;
|
||||
import com.l2jmobius.gameserver.model.teleporter.TeleportHolder;
|
||||
import com.l2jmobius.gameserver.network.serverpackets.NpcHtmlMessage;
|
||||
@ -45,6 +50,14 @@ public final class TeleporterInstance extends Npc
|
||||
CommonSkill.NATIVE_TRANSFORM
|
||||
};
|
||||
|
||||
private static final Map<Integer, List<TeleporterQuestRecommendationHolder>> QUEST_RECOMENDATIONS = new HashMap<>();
|
||||
// static
|
||||
// {
|
||||
// QUEST_RECOMENDATIONS.put(30848, new ArrayList<>());
|
||||
// QUEST_RECOMENDATIONS.get(30848).add(new TeleporterQuestRecommendationHolder(30848, "Q00561_BasicMissionHarnakUndergroundRuins", -1, "30848-Q561-Q562"));
|
||||
// QUEST_RECOMENDATIONS.get(30848).add(new TeleporterQuestRecommendationHolder(30848, "Q00562_BasicMissionAltarOfEvil", -1, "30848-561-562"));
|
||||
// }
|
||||
|
||||
public TeleporterInstance(NpcTemplate template)
|
||||
{
|
||||
super(template);
|
||||
@ -156,9 +169,33 @@ public final class TeleporterInstance extends Npc
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getHtmlPath(int npcId, int val)
|
||||
public String getHtmlPath(int npcId, int val, PlayerInstance player)
|
||||
{
|
||||
final String pom = (val == 0) ? String.valueOf(npcId) : (npcId + "-" + val);
|
||||
String pom;
|
||||
if (val == 0)
|
||||
{
|
||||
pom = String.valueOf(npcId);
|
||||
if ((player != null) && QUEST_RECOMENDATIONS.containsKey(npcId))
|
||||
{
|
||||
for (TeleporterQuestRecommendationHolder rec : QUEST_RECOMENDATIONS.get(npcId))
|
||||
{
|
||||
final QuestState qs = player.getQuestState(rec.getQuestName());
|
||||
if (qs != null)
|
||||
{
|
||||
final int cond = rec.getCond();
|
||||
if ((cond == -1) || qs.isCond(cond))
|
||||
{
|
||||
pom = rec.getHtml();
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
pom = (npcId + "-" + val);
|
||||
}
|
||||
return "data/html/teleporter/" + pom + ".htm";
|
||||
}
|
||||
|
||||
@ -176,7 +213,7 @@ public final class TeleporterInstance extends Npc
|
||||
String filename = "data/html/teleporter/castleteleporter-no.htm";
|
||||
if ((player.getClan() != null) && (getCastle().getOwnerId() == player.getClanId())) // Clan owns castle
|
||||
{
|
||||
filename = getHtmlPath(getId(), 0); // Owner message window
|
||||
filename = getHtmlPath(getId(), 0, player); // Owner message window
|
||||
}
|
||||
else if (getCastle().getSiege().isInProgress()) // Teleporter is busy due siege
|
||||
{
|
||||
|
@ -74,7 +74,7 @@ public class VillageMasterInstance extends NpcInstance
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getHtmlPath(int npcId, int val)
|
||||
public String getHtmlPath(int npcId, int val, PlayerInstance player)
|
||||
{
|
||||
String pom = "";
|
||||
|
||||
|
@ -46,7 +46,7 @@ public class WarehouseInstance extends NpcInstance
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getHtmlPath(int npcId, int val)
|
||||
public String getHtmlPath(int npcId, int val, PlayerInstance player)
|
||||
{
|
||||
String pom = "";
|
||||
|
||||
|
@ -0,0 +1,56 @@
|
||||
/*
|
||||
* This file is part of the L2J Mobius project.
|
||||
*
|
||||
* 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 3 of the License, 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, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package com.l2jmobius.gameserver.model.holders;
|
||||
|
||||
/**
|
||||
* @author Mobius
|
||||
*/
|
||||
public class TeleporterQuestRecommendationHolder
|
||||
{
|
||||
private final int _npcId;
|
||||
private final String _questName;
|
||||
private final int _cond; // -1 = all conditions
|
||||
private final String _html;
|
||||
|
||||
public TeleporterQuestRecommendationHolder(int npcId, String questName, int cond, String html)
|
||||
{
|
||||
_npcId = npcId;
|
||||
_questName = questName;
|
||||
_cond = cond;
|
||||
_html = html;
|
||||
}
|
||||
|
||||
public int getNpcId()
|
||||
{
|
||||
return _npcId;
|
||||
}
|
||||
|
||||
public String getQuestName()
|
||||
{
|
||||
return _questName;
|
||||
}
|
||||
|
||||
public int getCond()
|
||||
{
|
||||
return _cond;
|
||||
}
|
||||
|
||||
public String getHtml()
|
||||
{
|
||||
return _html;
|
||||
}
|
||||
}
|
@ -68,7 +68,7 @@ public class AdminMissingHtmls implements IAdminCommandHandler
|
||||
&& !results.contains(obj.getId()))
|
||||
{
|
||||
final Npc npc = (Npc) obj;
|
||||
if ((npc.getLocation().getX() > topLeftX) && (npc.getLocation().getX() < bottomRightX) && (npc.getLocation().getY() > topLeftY) && (npc.getLocation().getY() < bottomRightY) && npc.isTalkable() && !npc.hasListener(EventType.ON_NPC_FIRST_TALK) && (npc.getHtmlPath(npc.getId(), 0) == "data/html/npcdefault.htm"))
|
||||
if ((npc.getLocation().getX() > topLeftX) && (npc.getLocation().getX() < bottomRightX) && (npc.getLocation().getY() > topLeftY) && (npc.getLocation().getY() < bottomRightY) && npc.isTalkable() && !npc.hasListener(EventType.ON_NPC_FIRST_TALK) && (npc.getHtmlPath(npc.getId(), 0, null) == "data/html/npcdefault.htm"))
|
||||
{
|
||||
results.add(npc.getId());
|
||||
}
|
||||
@ -95,7 +95,7 @@ public class AdminMissingHtmls implements IAdminCommandHandler
|
||||
&& !results.contains(obj.getId()))
|
||||
{
|
||||
final Npc npc = (Npc) obj;
|
||||
if (npc.isTalkable() && !npc.hasListener(EventType.ON_NPC_FIRST_TALK) && (npc.getHtmlPath(npc.getId(), 0) == "data/html/npcdefault.htm"))
|
||||
if (npc.isTalkable() && !npc.hasListener(EventType.ON_NPC_FIRST_TALK) && (npc.getHtmlPath(npc.getId(), 0, null) == "data/html/npcdefault.htm"))
|
||||
{
|
||||
results.add(npc.getId());
|
||||
}
|
||||
|
@ -681,9 +681,10 @@ public class Npc extends Creature
|
||||
* </ul>
|
||||
* @param npcId The Identifier of the NpcInstance whose text must be display
|
||||
* @param val The number of the page to display
|
||||
* @param player The player that speaks to this NPC
|
||||
* @return the pathfile of the selected HTML file in function of the npcId and of the page number.
|
||||
*/
|
||||
public String getHtmlPath(int npcId, int val)
|
||||
public String getHtmlPath(int npcId, int val, PlayerInstance player)
|
||||
{
|
||||
String pom = "";
|
||||
|
||||
@ -808,7 +809,7 @@ public class Npc extends Creature
|
||||
}
|
||||
else
|
||||
{
|
||||
filename = (getHtmlPath(npcId, val));
|
||||
filename = (getHtmlPath(npcId, val, player));
|
||||
}
|
||||
break;
|
||||
}
|
||||
@ -824,7 +825,7 @@ public class Npc extends Creature
|
||||
}
|
||||
else
|
||||
{
|
||||
filename = (getHtmlPath(npcId, val));
|
||||
filename = (getHtmlPath(npcId, val, player));
|
||||
}
|
||||
break;
|
||||
}
|
||||
@ -832,11 +833,11 @@ public class Npc extends Creature
|
||||
{
|
||||
if (player.isAcademyMember())
|
||||
{
|
||||
filename = (getHtmlPath(npcId, 1));
|
||||
filename = (getHtmlPath(npcId, 1, player));
|
||||
}
|
||||
else
|
||||
{
|
||||
filename = (getHtmlPath(npcId, val));
|
||||
filename = (getHtmlPath(npcId, val, player));
|
||||
}
|
||||
break;
|
||||
}
|
||||
@ -847,7 +848,7 @@ public class Npc extends Creature
|
||||
return;
|
||||
}
|
||||
// Get the text of the selected HTML file in function of the npcId and of the page number
|
||||
filename = (getHtmlPath(npcId, val));
|
||||
filename = (getHtmlPath(npcId, val, player));
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
@ -36,7 +36,7 @@ public final class FishermanInstance extends MerchantInstance
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getHtmlPath(int npcId, int val)
|
||||
public String getHtmlPath(int npcId, int val, PlayerInstance player)
|
||||
{
|
||||
String pom = "";
|
||||
|
||||
|
@ -213,7 +213,7 @@ public class FortLogisticsInstance extends MerchantInstance
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getHtmlPath(int npcId, int val)
|
||||
public String getHtmlPath(int npcId, int val, PlayerInstance player)
|
||||
{
|
||||
String pom = "";
|
||||
|
||||
|
@ -149,7 +149,7 @@ public class FriendlyNpcInstance extends Attackable
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getHtmlPath(int npcId, int val)
|
||||
public String getHtmlPath(int npcId, int val, PlayerInstance player)
|
||||
{
|
||||
String pom = "";
|
||||
if (val == 0)
|
||||
|
@ -109,7 +109,7 @@ public class GuardInstance extends Attackable
|
||||
* @param val The number of the page to display
|
||||
*/
|
||||
@Override
|
||||
public String getHtmlPath(int npcId, int val)
|
||||
public String getHtmlPath(int npcId, int val, PlayerInstance player)
|
||||
{
|
||||
String pom = "";
|
||||
if (val == 0)
|
||||
|
@ -49,7 +49,7 @@ public class MerchantInstance extends NpcInstance
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getHtmlPath(int npcId, int val)
|
||||
public String getHtmlPath(int npcId, int val, PlayerInstance player)
|
||||
{
|
||||
String pom;
|
||||
if (val == 0)
|
||||
|
@ -30,7 +30,7 @@ public class PetManagerInstance extends MerchantInstance
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getHtmlPath(int npcId, int val)
|
||||
public String getHtmlPath(int npcId, int val, PlayerInstance player)
|
||||
{
|
||||
String pom = "";
|
||||
|
||||
|
@ -355,7 +355,7 @@ public class RaceManagerInstance extends Npc
|
||||
String filename;
|
||||
String search;
|
||||
final NpcHtmlMessage html = new NpcHtmlMessage(getObjectId());
|
||||
filename = getHtmlPath(npcId, 5);
|
||||
filename = getHtmlPath(npcId, 5, player);
|
||||
html.setFile(player, filename);
|
||||
for (int i = 0; i < 8; i++)
|
||||
{
|
||||
@ -375,7 +375,7 @@ public class RaceManagerInstance extends Npc
|
||||
String filename;
|
||||
String search;
|
||||
final NpcHtmlMessage html = new NpcHtmlMessage(getObjectId());
|
||||
filename = getHtmlPath(npcId, 6);
|
||||
filename = getHtmlPath(npcId, 6, player);
|
||||
html.setFile(player, filename);
|
||||
for (int i = 0; i < 8; i++)
|
||||
{
|
||||
@ -402,7 +402,7 @@ public class RaceManagerInstance extends Npc
|
||||
final NpcHtmlMessage html = new NpcHtmlMessage(getObjectId());
|
||||
if (val < 10)
|
||||
{
|
||||
filename = getHtmlPath(npcId, 2);
|
||||
filename = getHtmlPath(npcId, 2, player);
|
||||
html.setFile(player, filename);
|
||||
for (int i = 0; i < 8; i++)
|
||||
{
|
||||
@ -427,7 +427,7 @@ public class RaceManagerInstance extends Npc
|
||||
{
|
||||
return;
|
||||
}
|
||||
filename = getHtmlPath(npcId, 3);
|
||||
filename = getHtmlPath(npcId, 3, player);
|
||||
html.setFile(player, filename);
|
||||
html.replace("0place", Integer.toString(player.getRace(0)));
|
||||
search = "Mob1";
|
||||
@ -450,7 +450,7 @@ public class RaceManagerInstance extends Npc
|
||||
{
|
||||
return;
|
||||
}
|
||||
filename = getHtmlPath(npcId, 4);
|
||||
filename = getHtmlPath(npcId, 4, player);
|
||||
html.setFile(player, filename);
|
||||
html.replace("0place", Integer.toString(player.getRace(0)));
|
||||
search = "Mob1";
|
||||
|
@ -16,6 +16,9 @@
|
||||
*/
|
||||
package com.l2jmobius.gameserver.model.actor.instance;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.StringTokenizer;
|
||||
import java.util.logging.Logger;
|
||||
|
||||
@ -26,6 +29,8 @@ import com.l2jmobius.gameserver.instancemanager.CastleManager;
|
||||
import com.l2jmobius.gameserver.model.actor.Creature;
|
||||
import com.l2jmobius.gameserver.model.actor.Npc;
|
||||
import com.l2jmobius.gameserver.model.actor.templates.NpcTemplate;
|
||||
import com.l2jmobius.gameserver.model.holders.TeleporterQuestRecommendationHolder;
|
||||
import com.l2jmobius.gameserver.model.quest.QuestState;
|
||||
import com.l2jmobius.gameserver.model.skills.CommonSkill;
|
||||
import com.l2jmobius.gameserver.model.teleporter.TeleportHolder;
|
||||
import com.l2jmobius.gameserver.network.serverpackets.NpcHtmlMessage;
|
||||
@ -45,6 +50,14 @@ public final class TeleporterInstance extends Npc
|
||||
CommonSkill.NATIVE_TRANSFORM
|
||||
};
|
||||
|
||||
private static final Map<Integer, List<TeleporterQuestRecommendationHolder>> QUEST_RECOMENDATIONS = new HashMap<>();
|
||||
// static
|
||||
// {
|
||||
// QUEST_RECOMENDATIONS.put(30848, new ArrayList<>());
|
||||
// QUEST_RECOMENDATIONS.get(30848).add(new TeleporterQuestRecommendationHolder(30848, "Q00561_BasicMissionHarnakUndergroundRuins", -1, "30848-Q561-Q562"));
|
||||
// QUEST_RECOMENDATIONS.get(30848).add(new TeleporterQuestRecommendationHolder(30848, "Q00562_BasicMissionAltarOfEvil", -1, "30848-561-562"));
|
||||
// }
|
||||
|
||||
public TeleporterInstance(NpcTemplate template)
|
||||
{
|
||||
super(template);
|
||||
@ -156,9 +169,33 @@ public final class TeleporterInstance extends Npc
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getHtmlPath(int npcId, int val)
|
||||
public String getHtmlPath(int npcId, int val, PlayerInstance player)
|
||||
{
|
||||
final String pom = (val == 0) ? String.valueOf(npcId) : (npcId + "-" + val);
|
||||
String pom;
|
||||
if (val == 0)
|
||||
{
|
||||
pom = String.valueOf(npcId);
|
||||
if ((player != null) && QUEST_RECOMENDATIONS.containsKey(npcId))
|
||||
{
|
||||
for (TeleporterQuestRecommendationHolder rec : QUEST_RECOMENDATIONS.get(npcId))
|
||||
{
|
||||
final QuestState qs = player.getQuestState(rec.getQuestName());
|
||||
if (qs != null)
|
||||
{
|
||||
final int cond = rec.getCond();
|
||||
if ((cond == -1) || qs.isCond(cond))
|
||||
{
|
||||
pom = rec.getHtml();
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
pom = (npcId + "-" + val);
|
||||
}
|
||||
return "data/html/teleporter/" + pom + ".htm";
|
||||
}
|
||||
|
||||
@ -176,7 +213,7 @@ public final class TeleporterInstance extends Npc
|
||||
String filename = "data/html/teleporter/castleteleporter-no.htm";
|
||||
if ((player.getClan() != null) && (getCastle().getOwnerId() == player.getClanId())) // Clan owns castle
|
||||
{
|
||||
filename = getHtmlPath(getId(), 0); // Owner message window
|
||||
filename = getHtmlPath(getId(), 0, player); // Owner message window
|
||||
}
|
||||
else if (getCastle().getSiege().isInProgress()) // Teleporter is busy due siege
|
||||
{
|
||||
|
@ -74,7 +74,7 @@ public class VillageMasterInstance extends NpcInstance
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getHtmlPath(int npcId, int val)
|
||||
public String getHtmlPath(int npcId, int val, PlayerInstance player)
|
||||
{
|
||||
String pom = "";
|
||||
|
||||
|
@ -46,7 +46,7 @@ public class WarehouseInstance extends NpcInstance
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getHtmlPath(int npcId, int val)
|
||||
public String getHtmlPath(int npcId, int val, PlayerInstance player)
|
||||
{
|
||||
String pom = "";
|
||||
|
||||
|
@ -0,0 +1,56 @@
|
||||
/*
|
||||
* This file is part of the L2J Mobius project.
|
||||
*
|
||||
* 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 3 of the License, 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, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package com.l2jmobius.gameserver.model.holders;
|
||||
|
||||
/**
|
||||
* @author Mobius
|
||||
*/
|
||||
public class TeleporterQuestRecommendationHolder
|
||||
{
|
||||
private final int _npcId;
|
||||
private final String _questName;
|
||||
private final int _cond; // -1 = all conditions
|
||||
private final String _html;
|
||||
|
||||
public TeleporterQuestRecommendationHolder(int npcId, String questName, int cond, String html)
|
||||
{
|
||||
_npcId = npcId;
|
||||
_questName = questName;
|
||||
_cond = cond;
|
||||
_html = html;
|
||||
}
|
||||
|
||||
public int getNpcId()
|
||||
{
|
||||
return _npcId;
|
||||
}
|
||||
|
||||
public String getQuestName()
|
||||
{
|
||||
return _questName;
|
||||
}
|
||||
|
||||
public int getCond()
|
||||
{
|
||||
return _cond;
|
||||
}
|
||||
|
||||
public String getHtml()
|
||||
{
|
||||
return _html;
|
||||
}
|
||||
}
|
@ -68,7 +68,7 @@ public class AdminMissingHtmls implements IAdminCommandHandler
|
||||
&& !results.contains(obj.getId()))
|
||||
{
|
||||
final Npc npc = (Npc) obj;
|
||||
if ((npc.getLocation().getX() > topLeftX) && (npc.getLocation().getX() < bottomRightX) && (npc.getLocation().getY() > topLeftY) && (npc.getLocation().getY() < bottomRightY) && npc.isTalkable() && !npc.hasListener(EventType.ON_NPC_FIRST_TALK) && (npc.getHtmlPath(npc.getId(), 0) == "data/html/npcdefault.htm"))
|
||||
if ((npc.getLocation().getX() > topLeftX) && (npc.getLocation().getX() < bottomRightX) && (npc.getLocation().getY() > topLeftY) && (npc.getLocation().getY() < bottomRightY) && npc.isTalkable() && !npc.hasListener(EventType.ON_NPC_FIRST_TALK) && (npc.getHtmlPath(npc.getId(), 0, null) == "data/html/npcdefault.htm"))
|
||||
{
|
||||
results.add(npc.getId());
|
||||
}
|
||||
@ -95,7 +95,7 @@ public class AdminMissingHtmls implements IAdminCommandHandler
|
||||
&& !results.contains(obj.getId()))
|
||||
{
|
||||
final Npc npc = (Npc) obj;
|
||||
if (npc.isTalkable() && !npc.hasListener(EventType.ON_NPC_FIRST_TALK) && (npc.getHtmlPath(npc.getId(), 0) == "data/html/npcdefault.htm"))
|
||||
if (npc.isTalkable() && !npc.hasListener(EventType.ON_NPC_FIRST_TALK) && (npc.getHtmlPath(npc.getId(), 0, null) == "data/html/npcdefault.htm"))
|
||||
{
|
||||
results.add(npc.getId());
|
||||
}
|
||||
|
@ -681,9 +681,10 @@ public class Npc extends Creature
|
||||
* </ul>
|
||||
* @param npcId The Identifier of the NpcInstance whose text must be display
|
||||
* @param val The number of the page to display
|
||||
* @param player The player that speaks to this NPC
|
||||
* @return the pathfile of the selected HTML file in function of the npcId and of the page number.
|
||||
*/
|
||||
public String getHtmlPath(int npcId, int val)
|
||||
public String getHtmlPath(int npcId, int val, PlayerInstance player)
|
||||
{
|
||||
String pom = "";
|
||||
|
||||
@ -808,7 +809,7 @@ public class Npc extends Creature
|
||||
}
|
||||
else
|
||||
{
|
||||
filename = (getHtmlPath(npcId, val));
|
||||
filename = (getHtmlPath(npcId, val, player));
|
||||
}
|
||||
break;
|
||||
}
|
||||
@ -824,7 +825,7 @@ public class Npc extends Creature
|
||||
}
|
||||
else
|
||||
{
|
||||
filename = (getHtmlPath(npcId, val));
|
||||
filename = (getHtmlPath(npcId, val, player));
|
||||
}
|
||||
break;
|
||||
}
|
||||
@ -832,11 +833,11 @@ public class Npc extends Creature
|
||||
{
|
||||
if (player.isAcademyMember())
|
||||
{
|
||||
filename = (getHtmlPath(npcId, 1));
|
||||
filename = (getHtmlPath(npcId, 1, player));
|
||||
}
|
||||
else
|
||||
{
|
||||
filename = (getHtmlPath(npcId, val));
|
||||
filename = (getHtmlPath(npcId, val, player));
|
||||
}
|
||||
break;
|
||||
}
|
||||
@ -847,7 +848,7 @@ public class Npc extends Creature
|
||||
return;
|
||||
}
|
||||
// Get the text of the selected HTML file in function of the npcId and of the page number
|
||||
filename = (getHtmlPath(npcId, val));
|
||||
filename = (getHtmlPath(npcId, val, player));
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
@ -36,7 +36,7 @@ public final class FishermanInstance extends MerchantInstance
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getHtmlPath(int npcId, int val)
|
||||
public String getHtmlPath(int npcId, int val, PlayerInstance player)
|
||||
{
|
||||
String pom = "";
|
||||
|
||||
|
@ -213,7 +213,7 @@ public class FortLogisticsInstance extends MerchantInstance
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getHtmlPath(int npcId, int val)
|
||||
public String getHtmlPath(int npcId, int val, PlayerInstance player)
|
||||
{
|
||||
String pom = "";
|
||||
|
||||
|
@ -149,7 +149,7 @@ public class FriendlyNpcInstance extends Attackable
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getHtmlPath(int npcId, int val)
|
||||
public String getHtmlPath(int npcId, int val, PlayerInstance player)
|
||||
{
|
||||
String pom = "";
|
||||
if (val == 0)
|
||||
|
@ -109,7 +109,7 @@ public class GuardInstance extends Attackable
|
||||
* @param val The number of the page to display
|
||||
*/
|
||||
@Override
|
||||
public String getHtmlPath(int npcId, int val)
|
||||
public String getHtmlPath(int npcId, int val, PlayerInstance player)
|
||||
{
|
||||
String pom = "";
|
||||
if (val == 0)
|
||||
|
@ -49,7 +49,7 @@ public class MerchantInstance extends NpcInstance
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getHtmlPath(int npcId, int val)
|
||||
public String getHtmlPath(int npcId, int val, PlayerInstance player)
|
||||
{
|
||||
String pom;
|
||||
if (val == 0)
|
||||
|
@ -30,7 +30,7 @@ public class PetManagerInstance extends MerchantInstance
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getHtmlPath(int npcId, int val)
|
||||
public String getHtmlPath(int npcId, int val, PlayerInstance player)
|
||||
{
|
||||
String pom = "";
|
||||
|
||||
|
@ -355,7 +355,7 @@ public class RaceManagerInstance extends Npc
|
||||
String filename;
|
||||
String search;
|
||||
final NpcHtmlMessage html = new NpcHtmlMessage(getObjectId());
|
||||
filename = getHtmlPath(npcId, 5);
|
||||
filename = getHtmlPath(npcId, 5, player);
|
||||
html.setFile(player, filename);
|
||||
for (int i = 0; i < 8; i++)
|
||||
{
|
||||
@ -375,7 +375,7 @@ public class RaceManagerInstance extends Npc
|
||||
String filename;
|
||||
String search;
|
||||
final NpcHtmlMessage html = new NpcHtmlMessage(getObjectId());
|
||||
filename = getHtmlPath(npcId, 6);
|
||||
filename = getHtmlPath(npcId, 6, player);
|
||||
html.setFile(player, filename);
|
||||
for (int i = 0; i < 8; i++)
|
||||
{
|
||||
@ -402,7 +402,7 @@ public class RaceManagerInstance extends Npc
|
||||
final NpcHtmlMessage html = new NpcHtmlMessage(getObjectId());
|
||||
if (val < 10)
|
||||
{
|
||||
filename = getHtmlPath(npcId, 2);
|
||||
filename = getHtmlPath(npcId, 2, player);
|
||||
html.setFile(player, filename);
|
||||
for (int i = 0; i < 8; i++)
|
||||
{
|
||||
@ -427,7 +427,7 @@ public class RaceManagerInstance extends Npc
|
||||
{
|
||||
return;
|
||||
}
|
||||
filename = getHtmlPath(npcId, 3);
|
||||
filename = getHtmlPath(npcId, 3, player);
|
||||
html.setFile(player, filename);
|
||||
html.replace("0place", Integer.toString(player.getRace(0)));
|
||||
search = "Mob1";
|
||||
@ -450,7 +450,7 @@ public class RaceManagerInstance extends Npc
|
||||
{
|
||||
return;
|
||||
}
|
||||
filename = getHtmlPath(npcId, 4);
|
||||
filename = getHtmlPath(npcId, 4, player);
|
||||
html.setFile(player, filename);
|
||||
html.replace("0place", Integer.toString(player.getRace(0)));
|
||||
search = "Mob1";
|
||||
|
@ -16,6 +16,9 @@
|
||||
*/
|
||||
package com.l2jmobius.gameserver.model.actor.instance;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.StringTokenizer;
|
||||
import java.util.logging.Logger;
|
||||
|
||||
@ -26,6 +29,8 @@ import com.l2jmobius.gameserver.instancemanager.CastleManager;
|
||||
import com.l2jmobius.gameserver.model.actor.Creature;
|
||||
import com.l2jmobius.gameserver.model.actor.Npc;
|
||||
import com.l2jmobius.gameserver.model.actor.templates.NpcTemplate;
|
||||
import com.l2jmobius.gameserver.model.holders.TeleporterQuestRecommendationHolder;
|
||||
import com.l2jmobius.gameserver.model.quest.QuestState;
|
||||
import com.l2jmobius.gameserver.model.skills.CommonSkill;
|
||||
import com.l2jmobius.gameserver.model.teleporter.TeleportHolder;
|
||||
import com.l2jmobius.gameserver.network.serverpackets.NpcHtmlMessage;
|
||||
@ -45,6 +50,14 @@ public final class TeleporterInstance extends Npc
|
||||
CommonSkill.NATIVE_TRANSFORM
|
||||
};
|
||||
|
||||
private static final Map<Integer, List<TeleporterQuestRecommendationHolder>> QUEST_RECOMENDATIONS = new HashMap<>();
|
||||
// static
|
||||
// {
|
||||
// QUEST_RECOMENDATIONS.put(30848, new ArrayList<>());
|
||||
// QUEST_RECOMENDATIONS.get(30848).add(new TeleporterQuestRecommendationHolder(30848, "Q00561_BasicMissionHarnakUndergroundRuins", -1, "30848-Q561-Q562"));
|
||||
// QUEST_RECOMENDATIONS.get(30848).add(new TeleporterQuestRecommendationHolder(30848, "Q00562_BasicMissionAltarOfEvil", -1, "30848-561-562"));
|
||||
// }
|
||||
|
||||
public TeleporterInstance(NpcTemplate template)
|
||||
{
|
||||
super(template);
|
||||
@ -156,9 +169,33 @@ public final class TeleporterInstance extends Npc
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getHtmlPath(int npcId, int val)
|
||||
public String getHtmlPath(int npcId, int val, PlayerInstance player)
|
||||
{
|
||||
final String pom = (val == 0) ? String.valueOf(npcId) : (npcId + "-" + val);
|
||||
String pom;
|
||||
if (val == 0)
|
||||
{
|
||||
pom = String.valueOf(npcId);
|
||||
if ((player != null) && QUEST_RECOMENDATIONS.containsKey(npcId))
|
||||
{
|
||||
for (TeleporterQuestRecommendationHolder rec : QUEST_RECOMENDATIONS.get(npcId))
|
||||
{
|
||||
final QuestState qs = player.getQuestState(rec.getQuestName());
|
||||
if (qs != null)
|
||||
{
|
||||
final int cond = rec.getCond();
|
||||
if ((cond == -1) || qs.isCond(cond))
|
||||
{
|
||||
pom = rec.getHtml();
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
pom = (npcId + "-" + val);
|
||||
}
|
||||
return "data/html/teleporter/" + pom + ".htm";
|
||||
}
|
||||
|
||||
@ -176,7 +213,7 @@ public final class TeleporterInstance extends Npc
|
||||
String filename = "data/html/teleporter/castleteleporter-no.htm";
|
||||
if ((player.getClan() != null) && (getCastle().getOwnerId() == player.getClanId())) // Clan owns castle
|
||||
{
|
||||
filename = getHtmlPath(getId(), 0); // Owner message window
|
||||
filename = getHtmlPath(getId(), 0, player); // Owner message window
|
||||
}
|
||||
else if (getCastle().getSiege().isInProgress()) // Teleporter is busy due siege
|
||||
{
|
||||
|
@ -74,7 +74,7 @@ public class VillageMasterInstance extends NpcInstance
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getHtmlPath(int npcId, int val)
|
||||
public String getHtmlPath(int npcId, int val, PlayerInstance player)
|
||||
{
|
||||
String pom = "";
|
||||
|
||||
|
@ -46,7 +46,7 @@ public class WarehouseInstance extends NpcInstance
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getHtmlPath(int npcId, int val)
|
||||
public String getHtmlPath(int npcId, int val, PlayerInstance player)
|
||||
{
|
||||
String pom = "";
|
||||
|
||||
|
@ -0,0 +1,56 @@
|
||||
/*
|
||||
* This file is part of the L2J Mobius project.
|
||||
*
|
||||
* 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 3 of the License, 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, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package com.l2jmobius.gameserver.model.holders;
|
||||
|
||||
/**
|
||||
* @author Mobius
|
||||
*/
|
||||
public class TeleporterQuestRecommendationHolder
|
||||
{
|
||||
private final int _npcId;
|
||||
private final String _questName;
|
||||
private final int _cond; // -1 = all conditions
|
||||
private final String _html;
|
||||
|
||||
public TeleporterQuestRecommendationHolder(int npcId, String questName, int cond, String html)
|
||||
{
|
||||
_npcId = npcId;
|
||||
_questName = questName;
|
||||
_cond = cond;
|
||||
_html = html;
|
||||
}
|
||||
|
||||
public int getNpcId()
|
||||
{
|
||||
return _npcId;
|
||||
}
|
||||
|
||||
public String getQuestName()
|
||||
{
|
||||
return _questName;
|
||||
}
|
||||
|
||||
public int getCond()
|
||||
{
|
||||
return _cond;
|
||||
}
|
||||
|
||||
public String getHtml()
|
||||
{
|
||||
return _html;
|
||||
}
|
||||
}
|
@ -68,7 +68,7 @@ public class AdminMissingHtmls implements IAdminCommandHandler
|
||||
&& !results.contains(obj.getId()))
|
||||
{
|
||||
final Npc npc = (Npc) obj;
|
||||
if ((npc.getLocation().getX() > topLeftX) && (npc.getLocation().getX() < bottomRightX) && (npc.getLocation().getY() > topLeftY) && (npc.getLocation().getY() < bottomRightY) && npc.isTalkable() && !npc.hasListener(EventType.ON_NPC_FIRST_TALK) && (npc.getHtmlPath(npc.getId(), 0) == "data/html/npcdefault.htm"))
|
||||
if ((npc.getLocation().getX() > topLeftX) && (npc.getLocation().getX() < bottomRightX) && (npc.getLocation().getY() > topLeftY) && (npc.getLocation().getY() < bottomRightY) && npc.isTalkable() && !npc.hasListener(EventType.ON_NPC_FIRST_TALK) && (npc.getHtmlPath(npc.getId(), 0, null) == "data/html/npcdefault.htm"))
|
||||
{
|
||||
results.add(npc.getId());
|
||||
}
|
||||
@ -95,7 +95,7 @@ public class AdminMissingHtmls implements IAdminCommandHandler
|
||||
&& !results.contains(obj.getId()))
|
||||
{
|
||||
final Npc npc = (Npc) obj;
|
||||
if (npc.isTalkable() && !npc.hasListener(EventType.ON_NPC_FIRST_TALK) && (npc.getHtmlPath(npc.getId(), 0) == "data/html/npcdefault.htm"))
|
||||
if (npc.isTalkable() && !npc.hasListener(EventType.ON_NPC_FIRST_TALK) && (npc.getHtmlPath(npc.getId(), 0, null) == "data/html/npcdefault.htm"))
|
||||
{
|
||||
results.add(npc.getId());
|
||||
}
|
||||
|
@ -681,9 +681,10 @@ public class Npc extends Creature
|
||||
* </ul>
|
||||
* @param npcId The Identifier of the NpcInstance whose text must be display
|
||||
* @param val The number of the page to display
|
||||
* @param player The player that speaks to this NPC
|
||||
* @return the pathfile of the selected HTML file in function of the npcId and of the page number.
|
||||
*/
|
||||
public String getHtmlPath(int npcId, int val)
|
||||
public String getHtmlPath(int npcId, int val, PlayerInstance player)
|
||||
{
|
||||
String pom = "";
|
||||
|
||||
@ -808,7 +809,7 @@ public class Npc extends Creature
|
||||
}
|
||||
else
|
||||
{
|
||||
filename = (getHtmlPath(npcId, val));
|
||||
filename = (getHtmlPath(npcId, val, player));
|
||||
}
|
||||
break;
|
||||
}
|
||||
@ -824,7 +825,7 @@ public class Npc extends Creature
|
||||
}
|
||||
else
|
||||
{
|
||||
filename = (getHtmlPath(npcId, val));
|
||||
filename = (getHtmlPath(npcId, val, player));
|
||||
}
|
||||
break;
|
||||
}
|
||||
@ -832,11 +833,11 @@ public class Npc extends Creature
|
||||
{
|
||||
if (player.isAcademyMember())
|
||||
{
|
||||
filename = (getHtmlPath(npcId, 1));
|
||||
filename = (getHtmlPath(npcId, 1, player));
|
||||
}
|
||||
else
|
||||
{
|
||||
filename = (getHtmlPath(npcId, val));
|
||||
filename = (getHtmlPath(npcId, val, player));
|
||||
}
|
||||
break;
|
||||
}
|
||||
@ -847,7 +848,7 @@ public class Npc extends Creature
|
||||
return;
|
||||
}
|
||||
// Get the text of the selected HTML file in function of the npcId and of the page number
|
||||
filename = (getHtmlPath(npcId, val));
|
||||
filename = (getHtmlPath(npcId, val, player));
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
@ -36,7 +36,7 @@ public final class FishermanInstance extends MerchantInstance
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getHtmlPath(int npcId, int val)
|
||||
public String getHtmlPath(int npcId, int val, PlayerInstance player)
|
||||
{
|
||||
String pom = "";
|
||||
|
||||
|
@ -213,7 +213,7 @@ public class FortLogisticsInstance extends MerchantInstance
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getHtmlPath(int npcId, int val)
|
||||
public String getHtmlPath(int npcId, int val, PlayerInstance player)
|
||||
{
|
||||
String pom = "";
|
||||
|
||||
|
@ -149,7 +149,7 @@ public class FriendlyNpcInstance extends Attackable
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getHtmlPath(int npcId, int val)
|
||||
public String getHtmlPath(int npcId, int val, PlayerInstance player)
|
||||
{
|
||||
String pom = "";
|
||||
if (val == 0)
|
||||
|
@ -109,7 +109,7 @@ public class GuardInstance extends Attackable
|
||||
* @param val The number of the page to display
|
||||
*/
|
||||
@Override
|
||||
public String getHtmlPath(int npcId, int val)
|
||||
public String getHtmlPath(int npcId, int val, PlayerInstance player)
|
||||
{
|
||||
String pom = "";
|
||||
if (val == 0)
|
||||
|
@ -49,7 +49,7 @@ public class MerchantInstance extends NpcInstance
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getHtmlPath(int npcId, int val)
|
||||
public String getHtmlPath(int npcId, int val, PlayerInstance player)
|
||||
{
|
||||
String pom;
|
||||
if (val == 0)
|
||||
|
@ -30,7 +30,7 @@ public class PetManagerInstance extends MerchantInstance
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getHtmlPath(int npcId, int val)
|
||||
public String getHtmlPath(int npcId, int val, PlayerInstance player)
|
||||
{
|
||||
String pom = "";
|
||||
|
||||
|
@ -355,7 +355,7 @@ public class RaceManagerInstance extends Npc
|
||||
String filename;
|
||||
String search;
|
||||
final NpcHtmlMessage html = new NpcHtmlMessage(getObjectId());
|
||||
filename = getHtmlPath(npcId, 5);
|
||||
filename = getHtmlPath(npcId, 5, player);
|
||||
html.setFile(player, filename);
|
||||
for (int i = 0; i < 8; i++)
|
||||
{
|
||||
@ -375,7 +375,7 @@ public class RaceManagerInstance extends Npc
|
||||
String filename;
|
||||
String search;
|
||||
final NpcHtmlMessage html = new NpcHtmlMessage(getObjectId());
|
||||
filename = getHtmlPath(npcId, 6);
|
||||
filename = getHtmlPath(npcId, 6, player);
|
||||
html.setFile(player, filename);
|
||||
for (int i = 0; i < 8; i++)
|
||||
{
|
||||
@ -402,7 +402,7 @@ public class RaceManagerInstance extends Npc
|
||||
final NpcHtmlMessage html = new NpcHtmlMessage(getObjectId());
|
||||
if (val < 10)
|
||||
{
|
||||
filename = getHtmlPath(npcId, 2);
|
||||
filename = getHtmlPath(npcId, 2, player);
|
||||
html.setFile(player, filename);
|
||||
for (int i = 0; i < 8; i++)
|
||||
{
|
||||
@ -427,7 +427,7 @@ public class RaceManagerInstance extends Npc
|
||||
{
|
||||
return;
|
||||
}
|
||||
filename = getHtmlPath(npcId, 3);
|
||||
filename = getHtmlPath(npcId, 3, player);
|
||||
html.setFile(player, filename);
|
||||
html.replace("0place", Integer.toString(player.getRace(0)));
|
||||
search = "Mob1";
|
||||
@ -450,7 +450,7 @@ public class RaceManagerInstance extends Npc
|
||||
{
|
||||
return;
|
||||
}
|
||||
filename = getHtmlPath(npcId, 4);
|
||||
filename = getHtmlPath(npcId, 4, player);
|
||||
html.setFile(player, filename);
|
||||
html.replace("0place", Integer.toString(player.getRace(0)));
|
||||
search = "Mob1";
|
||||
|
@ -16,6 +16,9 @@
|
||||
*/
|
||||
package com.l2jmobius.gameserver.model.actor.instance;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.StringTokenizer;
|
||||
import java.util.logging.Logger;
|
||||
|
||||
@ -26,6 +29,8 @@ import com.l2jmobius.gameserver.instancemanager.CastleManager;
|
||||
import com.l2jmobius.gameserver.model.actor.Creature;
|
||||
import com.l2jmobius.gameserver.model.actor.Npc;
|
||||
import com.l2jmobius.gameserver.model.actor.templates.NpcTemplate;
|
||||
import com.l2jmobius.gameserver.model.holders.TeleporterQuestRecommendationHolder;
|
||||
import com.l2jmobius.gameserver.model.quest.QuestState;
|
||||
import com.l2jmobius.gameserver.model.skills.CommonSkill;
|
||||
import com.l2jmobius.gameserver.model.teleporter.TeleportHolder;
|
||||
import com.l2jmobius.gameserver.network.serverpackets.NpcHtmlMessage;
|
||||
@ -45,6 +50,14 @@ public final class TeleporterInstance extends Npc
|
||||
CommonSkill.NATIVE_TRANSFORM
|
||||
};
|
||||
|
||||
private static final Map<Integer, List<TeleporterQuestRecommendationHolder>> QUEST_RECOMENDATIONS = new HashMap<>();
|
||||
// static
|
||||
// {
|
||||
// QUEST_RECOMENDATIONS.put(30848, new ArrayList<>());
|
||||
// QUEST_RECOMENDATIONS.get(30848).add(new TeleporterQuestRecommendationHolder(30848, "Q00561_BasicMissionHarnakUndergroundRuins", -1, "30848-Q561-Q562"));
|
||||
// QUEST_RECOMENDATIONS.get(30848).add(new TeleporterQuestRecommendationHolder(30848, "Q00562_BasicMissionAltarOfEvil", -1, "30848-561-562"));
|
||||
// }
|
||||
|
||||
public TeleporterInstance(NpcTemplate template)
|
||||
{
|
||||
super(template);
|
||||
@ -156,9 +169,33 @@ public final class TeleporterInstance extends Npc
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getHtmlPath(int npcId, int val)
|
||||
public String getHtmlPath(int npcId, int val, PlayerInstance player)
|
||||
{
|
||||
final String pom = (val == 0) ? String.valueOf(npcId) : (npcId + "-" + val);
|
||||
String pom;
|
||||
if (val == 0)
|
||||
{
|
||||
pom = String.valueOf(npcId);
|
||||
if ((player != null) && QUEST_RECOMENDATIONS.containsKey(npcId))
|
||||
{
|
||||
for (TeleporterQuestRecommendationHolder rec : QUEST_RECOMENDATIONS.get(npcId))
|
||||
{
|
||||
final QuestState qs = player.getQuestState(rec.getQuestName());
|
||||
if (qs != null)
|
||||
{
|
||||
final int cond = rec.getCond();
|
||||
if ((cond == -1) || qs.isCond(cond))
|
||||
{
|
||||
pom = rec.getHtml();
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
pom = (npcId + "-" + val);
|
||||
}
|
||||
return "data/html/teleporter/" + pom + ".htm";
|
||||
}
|
||||
|
||||
@ -176,7 +213,7 @@ public final class TeleporterInstance extends Npc
|
||||
String filename = "data/html/teleporter/castleteleporter-no.htm";
|
||||
if ((player.getClan() != null) && (getCastle().getOwnerId() == player.getClanId())) // Clan owns castle
|
||||
{
|
||||
filename = getHtmlPath(getId(), 0); // Owner message window
|
||||
filename = getHtmlPath(getId(), 0, player); // Owner message window
|
||||
}
|
||||
else if (getCastle().getSiege().isInProgress()) // Teleporter is busy due siege
|
||||
{
|
||||
|
@ -71,7 +71,7 @@ public class VillageMasterInstance extends NpcInstance
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getHtmlPath(int npcId, int val)
|
||||
public String getHtmlPath(int npcId, int val, PlayerInstance player)
|
||||
{
|
||||
String pom = "";
|
||||
|
||||
|
@ -46,7 +46,7 @@ public class WarehouseInstance extends NpcInstance
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getHtmlPath(int npcId, int val)
|
||||
public String getHtmlPath(int npcId, int val, PlayerInstance player)
|
||||
{
|
||||
String pom = "";
|
||||
|
||||
|
@ -0,0 +1,56 @@
|
||||
/*
|
||||
* This file is part of the L2J Mobius project.
|
||||
*
|
||||
* 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 3 of the License, 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, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package com.l2jmobius.gameserver.model.holders;
|
||||
|
||||
/**
|
||||
* @author Mobius
|
||||
*/
|
||||
public class TeleporterQuestRecommendationHolder
|
||||
{
|
||||
private final int _npcId;
|
||||
private final String _questName;
|
||||
private final int _cond; // -1 = all conditions
|
||||
private final String _html;
|
||||
|
||||
public TeleporterQuestRecommendationHolder(int npcId, String questName, int cond, String html)
|
||||
{
|
||||
_npcId = npcId;
|
||||
_questName = questName;
|
||||
_cond = cond;
|
||||
_html = html;
|
||||
}
|
||||
|
||||
public int getNpcId()
|
||||
{
|
||||
return _npcId;
|
||||
}
|
||||
|
||||
public String getQuestName()
|
||||
{
|
||||
return _questName;
|
||||
}
|
||||
|
||||
public int getCond()
|
||||
{
|
||||
return _cond;
|
||||
}
|
||||
|
||||
public String getHtml()
|
||||
{
|
||||
return _html;
|
||||
}
|
||||
}
|
@ -68,7 +68,7 @@ public class AdminMissingHtmls implements IAdminCommandHandler
|
||||
&& !results.contains(obj.getId()))
|
||||
{
|
||||
final Npc npc = (Npc) obj;
|
||||
if ((npc.getLocation().getX() > topLeftX) && (npc.getLocation().getX() < bottomRightX) && (npc.getLocation().getY() > topLeftY) && (npc.getLocation().getY() < bottomRightY) && npc.isTalkable() && !npc.hasListener(EventType.ON_NPC_FIRST_TALK) && (npc.getHtmlPath(npc.getId(), 0) == "data/html/npcdefault.htm"))
|
||||
if ((npc.getLocation().getX() > topLeftX) && (npc.getLocation().getX() < bottomRightX) && (npc.getLocation().getY() > topLeftY) && (npc.getLocation().getY() < bottomRightY) && npc.isTalkable() && !npc.hasListener(EventType.ON_NPC_FIRST_TALK) && (npc.getHtmlPath(npc.getId(), 0, null) == "data/html/npcdefault.htm"))
|
||||
{
|
||||
results.add(npc.getId());
|
||||
}
|
||||
@ -95,7 +95,7 @@ public class AdminMissingHtmls implements IAdminCommandHandler
|
||||
&& !results.contains(obj.getId()))
|
||||
{
|
||||
final Npc npc = (Npc) obj;
|
||||
if (npc.isTalkable() && !npc.hasListener(EventType.ON_NPC_FIRST_TALK) && (npc.getHtmlPath(npc.getId(), 0) == "data/html/npcdefault.htm"))
|
||||
if (npc.isTalkable() && !npc.hasListener(EventType.ON_NPC_FIRST_TALK) && (npc.getHtmlPath(npc.getId(), 0, null) == "data/html/npcdefault.htm"))
|
||||
{
|
||||
results.add(npc.getId());
|
||||
}
|
||||
|
@ -681,9 +681,10 @@ public class Npc extends Creature
|
||||
* </ul>
|
||||
* @param npcId The Identifier of the NpcInstance whose text must be display
|
||||
* @param val The number of the page to display
|
||||
* @param player The player that speaks to this NPC
|
||||
* @return the pathfile of the selected HTML file in function of the npcId and of the page number.
|
||||
*/
|
||||
public String getHtmlPath(int npcId, int val)
|
||||
public String getHtmlPath(int npcId, int val, PlayerInstance player)
|
||||
{
|
||||
String pom = "";
|
||||
|
||||
@ -808,7 +809,7 @@ public class Npc extends Creature
|
||||
}
|
||||
else
|
||||
{
|
||||
filename = (getHtmlPath(npcId, val));
|
||||
filename = (getHtmlPath(npcId, val, player));
|
||||
}
|
||||
break;
|
||||
}
|
||||
@ -824,7 +825,7 @@ public class Npc extends Creature
|
||||
}
|
||||
else
|
||||
{
|
||||
filename = (getHtmlPath(npcId, val));
|
||||
filename = (getHtmlPath(npcId, val, player));
|
||||
}
|
||||
break;
|
||||
}
|
||||
@ -832,11 +833,11 @@ public class Npc extends Creature
|
||||
{
|
||||
if (player.isAcademyMember())
|
||||
{
|
||||
filename = (getHtmlPath(npcId, 1));
|
||||
filename = (getHtmlPath(npcId, 1, player));
|
||||
}
|
||||
else
|
||||
{
|
||||
filename = (getHtmlPath(npcId, val));
|
||||
filename = (getHtmlPath(npcId, val, player));
|
||||
}
|
||||
break;
|
||||
}
|
||||
@ -847,7 +848,7 @@ public class Npc extends Creature
|
||||
return;
|
||||
}
|
||||
// Get the text of the selected HTML file in function of the npcId and of the page number
|
||||
filename = (getHtmlPath(npcId, val));
|
||||
filename = (getHtmlPath(npcId, val, player));
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
@ -36,7 +36,7 @@ public final class FishermanInstance extends MerchantInstance
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getHtmlPath(int npcId, int val)
|
||||
public String getHtmlPath(int npcId, int val, PlayerInstance player)
|
||||
{
|
||||
String pom = "";
|
||||
|
||||
|
@ -213,7 +213,7 @@ public class FortLogisticsInstance extends MerchantInstance
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getHtmlPath(int npcId, int val)
|
||||
public String getHtmlPath(int npcId, int val, PlayerInstance player)
|
||||
{
|
||||
String pom = "";
|
||||
|
||||
|
@ -149,7 +149,7 @@ public class FriendlyNpcInstance extends Attackable
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getHtmlPath(int npcId, int val)
|
||||
public String getHtmlPath(int npcId, int val, PlayerInstance player)
|
||||
{
|
||||
String pom = "";
|
||||
if (val == 0)
|
||||
|
@ -109,7 +109,7 @@ public class GuardInstance extends Attackable
|
||||
* @param val The number of the page to display
|
||||
*/
|
||||
@Override
|
||||
public String getHtmlPath(int npcId, int val)
|
||||
public String getHtmlPath(int npcId, int val, PlayerInstance player)
|
||||
{
|
||||
String pom = "";
|
||||
if (val == 0)
|
||||
|
@ -49,7 +49,7 @@ public class MerchantInstance extends NpcInstance
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getHtmlPath(int npcId, int val)
|
||||
public String getHtmlPath(int npcId, int val, PlayerInstance player)
|
||||
{
|
||||
String pom;
|
||||
if (val == 0)
|
||||
|
@ -30,7 +30,7 @@ public class PetManagerInstance extends MerchantInstance
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getHtmlPath(int npcId, int val)
|
||||
public String getHtmlPath(int npcId, int val, PlayerInstance player)
|
||||
{
|
||||
String pom = "";
|
||||
|
||||
|
@ -355,7 +355,7 @@ public class RaceManagerInstance extends Npc
|
||||
String filename;
|
||||
String search;
|
||||
final NpcHtmlMessage html = new NpcHtmlMessage(getObjectId());
|
||||
filename = getHtmlPath(npcId, 5);
|
||||
filename = getHtmlPath(npcId, 5, player);
|
||||
html.setFile(player, filename);
|
||||
for (int i = 0; i < 8; i++)
|
||||
{
|
||||
@ -375,7 +375,7 @@ public class RaceManagerInstance extends Npc
|
||||
String filename;
|
||||
String search;
|
||||
final NpcHtmlMessage html = new NpcHtmlMessage(getObjectId());
|
||||
filename = getHtmlPath(npcId, 6);
|
||||
filename = getHtmlPath(npcId, 6, player);
|
||||
html.setFile(player, filename);
|
||||
for (int i = 0; i < 8; i++)
|
||||
{
|
||||
@ -402,7 +402,7 @@ public class RaceManagerInstance extends Npc
|
||||
final NpcHtmlMessage html = new NpcHtmlMessage(getObjectId());
|
||||
if (val < 10)
|
||||
{
|
||||
filename = getHtmlPath(npcId, 2);
|
||||
filename = getHtmlPath(npcId, 2, player);
|
||||
html.setFile(player, filename);
|
||||
for (int i = 0; i < 8; i++)
|
||||
{
|
||||
@ -427,7 +427,7 @@ public class RaceManagerInstance extends Npc
|
||||
{
|
||||
return;
|
||||
}
|
||||
filename = getHtmlPath(npcId, 3);
|
||||
filename = getHtmlPath(npcId, 3, player);
|
||||
html.setFile(player, filename);
|
||||
html.replace("0place", Integer.toString(player.getRace(0)));
|
||||
search = "Mob1";
|
||||
@ -450,7 +450,7 @@ public class RaceManagerInstance extends Npc
|
||||
{
|
||||
return;
|
||||
}
|
||||
filename = getHtmlPath(npcId, 4);
|
||||
filename = getHtmlPath(npcId, 4, player);
|
||||
html.setFile(player, filename);
|
||||
html.replace("0place", Integer.toString(player.getRace(0)));
|
||||
search = "Mob1";
|
||||
|
@ -16,6 +16,9 @@
|
||||
*/
|
||||
package com.l2jmobius.gameserver.model.actor.instance;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.StringTokenizer;
|
||||
import java.util.logging.Logger;
|
||||
|
||||
@ -26,6 +29,8 @@ import com.l2jmobius.gameserver.instancemanager.CastleManager;
|
||||
import com.l2jmobius.gameserver.model.actor.Creature;
|
||||
import com.l2jmobius.gameserver.model.actor.Npc;
|
||||
import com.l2jmobius.gameserver.model.actor.templates.NpcTemplate;
|
||||
import com.l2jmobius.gameserver.model.holders.TeleporterQuestRecommendationHolder;
|
||||
import com.l2jmobius.gameserver.model.quest.QuestState;
|
||||
import com.l2jmobius.gameserver.model.skills.CommonSkill;
|
||||
import com.l2jmobius.gameserver.model.teleporter.TeleportHolder;
|
||||
import com.l2jmobius.gameserver.network.serverpackets.NpcHtmlMessage;
|
||||
@ -45,6 +50,14 @@ public final class TeleporterInstance extends Npc
|
||||
CommonSkill.NATIVE_TRANSFORM
|
||||
};
|
||||
|
||||
private static final Map<Integer, List<TeleporterQuestRecommendationHolder>> QUEST_RECOMENDATIONS = new HashMap<>();
|
||||
// static
|
||||
// {
|
||||
// QUEST_RECOMENDATIONS.put(30848, new ArrayList<>());
|
||||
// QUEST_RECOMENDATIONS.get(30848).add(new TeleporterQuestRecommendationHolder(30848, "Q00561_BasicMissionHarnakUndergroundRuins", -1, "30848-Q561-Q562"));
|
||||
// QUEST_RECOMENDATIONS.get(30848).add(new TeleporterQuestRecommendationHolder(30848, "Q00562_BasicMissionAltarOfEvil", -1, "30848-561-562"));
|
||||
// }
|
||||
|
||||
public TeleporterInstance(NpcTemplate template)
|
||||
{
|
||||
super(template);
|
||||
@ -156,9 +169,33 @@ public final class TeleporterInstance extends Npc
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getHtmlPath(int npcId, int val)
|
||||
public String getHtmlPath(int npcId, int val, PlayerInstance player)
|
||||
{
|
||||
final String pom = (val == 0) ? String.valueOf(npcId) : (npcId + "-" + val);
|
||||
String pom;
|
||||
if (val == 0)
|
||||
{
|
||||
pom = String.valueOf(npcId);
|
||||
if ((player != null) && QUEST_RECOMENDATIONS.containsKey(npcId))
|
||||
{
|
||||
for (TeleporterQuestRecommendationHolder rec : QUEST_RECOMENDATIONS.get(npcId))
|
||||
{
|
||||
final QuestState qs = player.getQuestState(rec.getQuestName());
|
||||
if (qs != null)
|
||||
{
|
||||
final int cond = rec.getCond();
|
||||
if ((cond == -1) || qs.isCond(cond))
|
||||
{
|
||||
pom = rec.getHtml();
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
pom = (npcId + "-" + val);
|
||||
}
|
||||
return "data/html/teleporter/" + pom + ".htm";
|
||||
}
|
||||
|
||||
@ -176,7 +213,7 @@ public final class TeleporterInstance extends Npc
|
||||
String filename = "data/html/teleporter/castleteleporter-no.htm";
|
||||
if ((player.getClan() != null) && (getCastle().getOwnerId() == player.getClanId())) // Clan owns castle
|
||||
{
|
||||
filename = getHtmlPath(getId(), 0); // Owner message window
|
||||
filename = getHtmlPath(getId(), 0, player); // Owner message window
|
||||
}
|
||||
else if (getCastle().getSiege().isInProgress()) // Teleporter is busy due siege
|
||||
{
|
||||
|
@ -71,7 +71,7 @@ public class VillageMasterInstance extends NpcInstance
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getHtmlPath(int npcId, int val)
|
||||
public String getHtmlPath(int npcId, int val, PlayerInstance player)
|
||||
{
|
||||
String pom = "";
|
||||
|
||||
|
@ -46,7 +46,7 @@ public class WarehouseInstance extends NpcInstance
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getHtmlPath(int npcId, int val)
|
||||
public String getHtmlPath(int npcId, int val, PlayerInstance player)
|
||||
{
|
||||
String pom = "";
|
||||
|
||||
|
@ -0,0 +1,56 @@
|
||||
/*
|
||||
* This file is part of the L2J Mobius project.
|
||||
*
|
||||
* 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 3 of the License, 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, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package com.l2jmobius.gameserver.model.holders;
|
||||
|
||||
/**
|
||||
* @author Mobius
|
||||
*/
|
||||
public class TeleporterQuestRecommendationHolder
|
||||
{
|
||||
private final int _npcId;
|
||||
private final String _questName;
|
||||
private final int _cond; // -1 = all conditions
|
||||
private final String _html;
|
||||
|
||||
public TeleporterQuestRecommendationHolder(int npcId, String questName, int cond, String html)
|
||||
{
|
||||
_npcId = npcId;
|
||||
_questName = questName;
|
||||
_cond = cond;
|
||||
_html = html;
|
||||
}
|
||||
|
||||
public int getNpcId()
|
||||
{
|
||||
return _npcId;
|
||||
}
|
||||
|
||||
public String getQuestName()
|
||||
{
|
||||
return _questName;
|
||||
}
|
||||
|
||||
public int getCond()
|
||||
{
|
||||
return _cond;
|
||||
}
|
||||
|
||||
public String getHtml()
|
||||
{
|
||||
return _html;
|
||||
}
|
||||
}
|
@ -68,7 +68,7 @@ public class AdminMissingHtmls implements IAdminCommandHandler
|
||||
&& !results.contains(obj.getId()))
|
||||
{
|
||||
final Npc npc = (Npc) obj;
|
||||
if ((npc.getLocation().getX() > topLeftX) && (npc.getLocation().getX() < bottomRightX) && (npc.getLocation().getY() > topLeftY) && (npc.getLocation().getY() < bottomRightY) && npc.isTalkable() && !npc.hasListener(EventType.ON_NPC_FIRST_TALK) && (npc.getHtmlPath(npc.getId(), 0) == "data/html/npcdefault.htm"))
|
||||
if ((npc.getLocation().getX() > topLeftX) && (npc.getLocation().getX() < bottomRightX) && (npc.getLocation().getY() > topLeftY) && (npc.getLocation().getY() < bottomRightY) && npc.isTalkable() && !npc.hasListener(EventType.ON_NPC_FIRST_TALK) && (npc.getHtmlPath(npc.getId(), 0, null) == "data/html/npcdefault.htm"))
|
||||
{
|
||||
results.add(npc.getId());
|
||||
}
|
||||
@ -95,7 +95,7 @@ public class AdminMissingHtmls implements IAdminCommandHandler
|
||||
&& !results.contains(obj.getId()))
|
||||
{
|
||||
final Npc npc = (Npc) obj;
|
||||
if (npc.isTalkable() && !npc.hasListener(EventType.ON_NPC_FIRST_TALK) && (npc.getHtmlPath(npc.getId(), 0) == "data/html/npcdefault.htm"))
|
||||
if (npc.isTalkable() && !npc.hasListener(EventType.ON_NPC_FIRST_TALK) && (npc.getHtmlPath(npc.getId(), 0, null) == "data/html/npcdefault.htm"))
|
||||
{
|
||||
results.add(npc.getId());
|
||||
}
|
||||
|
@ -681,9 +681,10 @@ public class Npc extends Creature
|
||||
* </ul>
|
||||
* @param npcId The Identifier of the NpcInstance whose text must be display
|
||||
* @param val The number of the page to display
|
||||
* @param player The player that speaks to this NPC
|
||||
* @return the pathfile of the selected HTML file in function of the npcId and of the page number.
|
||||
*/
|
||||
public String getHtmlPath(int npcId, int val)
|
||||
public String getHtmlPath(int npcId, int val, PlayerInstance player)
|
||||
{
|
||||
String pom = "";
|
||||
|
||||
@ -808,7 +809,7 @@ public class Npc extends Creature
|
||||
}
|
||||
else
|
||||
{
|
||||
filename = (getHtmlPath(npcId, val));
|
||||
filename = (getHtmlPath(npcId, val, player));
|
||||
}
|
||||
break;
|
||||
}
|
||||
@ -824,7 +825,7 @@ public class Npc extends Creature
|
||||
}
|
||||
else
|
||||
{
|
||||
filename = (getHtmlPath(npcId, val));
|
||||
filename = (getHtmlPath(npcId, val, player));
|
||||
}
|
||||
break;
|
||||
}
|
||||
@ -832,11 +833,11 @@ public class Npc extends Creature
|
||||
{
|
||||
if (player.isAcademyMember())
|
||||
{
|
||||
filename = (getHtmlPath(npcId, 1));
|
||||
filename = (getHtmlPath(npcId, 1, player));
|
||||
}
|
||||
else
|
||||
{
|
||||
filename = (getHtmlPath(npcId, val));
|
||||
filename = (getHtmlPath(npcId, val, player));
|
||||
}
|
||||
break;
|
||||
}
|
||||
@ -847,7 +848,7 @@ public class Npc extends Creature
|
||||
return;
|
||||
}
|
||||
// Get the text of the selected HTML file in function of the npcId and of the page number
|
||||
filename = (getHtmlPath(npcId, val));
|
||||
filename = (getHtmlPath(npcId, val, player));
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
@ -36,7 +36,7 @@ public final class FishermanInstance extends MerchantInstance
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getHtmlPath(int npcId, int val)
|
||||
public String getHtmlPath(int npcId, int val, PlayerInstance player)
|
||||
{
|
||||
String pom = "";
|
||||
|
||||
|
@ -213,7 +213,7 @@ public class FortLogisticsInstance extends MerchantInstance
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getHtmlPath(int npcId, int val)
|
||||
public String getHtmlPath(int npcId, int val, PlayerInstance player)
|
||||
{
|
||||
String pom = "";
|
||||
|
||||
|
@ -149,7 +149,7 @@ public class FriendlyNpcInstance extends Attackable
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getHtmlPath(int npcId, int val)
|
||||
public String getHtmlPath(int npcId, int val, PlayerInstance player)
|
||||
{
|
||||
String pom = "";
|
||||
if (val == 0)
|
||||
|
@ -109,7 +109,7 @@ public class GuardInstance extends Attackable
|
||||
* @param val The number of the page to display
|
||||
*/
|
||||
@Override
|
||||
public String getHtmlPath(int npcId, int val)
|
||||
public String getHtmlPath(int npcId, int val, PlayerInstance player)
|
||||
{
|
||||
String pom = "";
|
||||
if (val == 0)
|
||||
|
@ -49,7 +49,7 @@ public class MerchantInstance extends NpcInstance
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getHtmlPath(int npcId, int val)
|
||||
public String getHtmlPath(int npcId, int val, PlayerInstance player)
|
||||
{
|
||||
String pom;
|
||||
if (val == 0)
|
||||
|
@ -30,7 +30,7 @@ public class PetManagerInstance extends MerchantInstance
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getHtmlPath(int npcId, int val)
|
||||
public String getHtmlPath(int npcId, int val, PlayerInstance player)
|
||||
{
|
||||
String pom = "";
|
||||
|
||||
|
@ -355,7 +355,7 @@ public class RaceManagerInstance extends Npc
|
||||
String filename;
|
||||
String search;
|
||||
final NpcHtmlMessage html = new NpcHtmlMessage(getObjectId());
|
||||
filename = getHtmlPath(npcId, 5);
|
||||
filename = getHtmlPath(npcId, 5, player);
|
||||
html.setFile(player, filename);
|
||||
for (int i = 0; i < 8; i++)
|
||||
{
|
||||
@ -375,7 +375,7 @@ public class RaceManagerInstance extends Npc
|
||||
String filename;
|
||||
String search;
|
||||
final NpcHtmlMessage html = new NpcHtmlMessage(getObjectId());
|
||||
filename = getHtmlPath(npcId, 6);
|
||||
filename = getHtmlPath(npcId, 6, player);
|
||||
html.setFile(player, filename);
|
||||
for (int i = 0; i < 8; i++)
|
||||
{
|
||||
@ -402,7 +402,7 @@ public class RaceManagerInstance extends Npc
|
||||
final NpcHtmlMessage html = new NpcHtmlMessage(getObjectId());
|
||||
if (val < 10)
|
||||
{
|
||||
filename = getHtmlPath(npcId, 2);
|
||||
filename = getHtmlPath(npcId, 2, player);
|
||||
html.setFile(player, filename);
|
||||
for (int i = 0; i < 8; i++)
|
||||
{
|
||||
@ -427,7 +427,7 @@ public class RaceManagerInstance extends Npc
|
||||
{
|
||||
return;
|
||||
}
|
||||
filename = getHtmlPath(npcId, 3);
|
||||
filename = getHtmlPath(npcId, 3, player);
|
||||
html.setFile(player, filename);
|
||||
html.replace("0place", Integer.toString(player.getRace(0)));
|
||||
search = "Mob1";
|
||||
@ -450,7 +450,7 @@ public class RaceManagerInstance extends Npc
|
||||
{
|
||||
return;
|
||||
}
|
||||
filename = getHtmlPath(npcId, 4);
|
||||
filename = getHtmlPath(npcId, 4, player);
|
||||
html.setFile(player, filename);
|
||||
html.replace("0place", Integer.toString(player.getRace(0)));
|
||||
search = "Mob1";
|
||||
|
@ -16,6 +16,9 @@
|
||||
*/
|
||||
package com.l2jmobius.gameserver.model.actor.instance;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.StringTokenizer;
|
||||
import java.util.logging.Logger;
|
||||
|
||||
@ -26,6 +29,8 @@ import com.l2jmobius.gameserver.instancemanager.CastleManager;
|
||||
import com.l2jmobius.gameserver.model.actor.Creature;
|
||||
import com.l2jmobius.gameserver.model.actor.Npc;
|
||||
import com.l2jmobius.gameserver.model.actor.templates.NpcTemplate;
|
||||
import com.l2jmobius.gameserver.model.holders.TeleporterQuestRecommendationHolder;
|
||||
import com.l2jmobius.gameserver.model.quest.QuestState;
|
||||
import com.l2jmobius.gameserver.model.skills.CommonSkill;
|
||||
import com.l2jmobius.gameserver.model.teleporter.TeleportHolder;
|
||||
import com.l2jmobius.gameserver.network.serverpackets.NpcHtmlMessage;
|
||||
@ -45,6 +50,14 @@ public final class TeleporterInstance extends Npc
|
||||
CommonSkill.NATIVE_TRANSFORM
|
||||
};
|
||||
|
||||
private static final Map<Integer, List<TeleporterQuestRecommendationHolder>> QUEST_RECOMENDATIONS = new HashMap<>();
|
||||
// static
|
||||
// {
|
||||
// QUEST_RECOMENDATIONS.put(30848, new ArrayList<>());
|
||||
// QUEST_RECOMENDATIONS.get(30848).add(new TeleporterQuestRecommendationHolder(30848, "Q00561_BasicMissionHarnakUndergroundRuins", -1, "30848-Q561-Q562"));
|
||||
// QUEST_RECOMENDATIONS.get(30848).add(new TeleporterQuestRecommendationHolder(30848, "Q00562_BasicMissionAltarOfEvil", -1, "30848-561-562"));
|
||||
// }
|
||||
|
||||
public TeleporterInstance(NpcTemplate template)
|
||||
{
|
||||
super(template);
|
||||
@ -156,9 +169,33 @@ public final class TeleporterInstance extends Npc
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getHtmlPath(int npcId, int val)
|
||||
public String getHtmlPath(int npcId, int val, PlayerInstance player)
|
||||
{
|
||||
final String pom = (val == 0) ? String.valueOf(npcId) : (npcId + "-" + val);
|
||||
String pom;
|
||||
if (val == 0)
|
||||
{
|
||||
pom = String.valueOf(npcId);
|
||||
if ((player != null) && QUEST_RECOMENDATIONS.containsKey(npcId))
|
||||
{
|
||||
for (TeleporterQuestRecommendationHolder rec : QUEST_RECOMENDATIONS.get(npcId))
|
||||
{
|
||||
final QuestState qs = player.getQuestState(rec.getQuestName());
|
||||
if (qs != null)
|
||||
{
|
||||
final int cond = rec.getCond();
|
||||
if ((cond == -1) || qs.isCond(cond))
|
||||
{
|
||||
pom = rec.getHtml();
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
pom = (npcId + "-" + val);
|
||||
}
|
||||
return "data/html/teleporter/" + pom + ".htm";
|
||||
}
|
||||
|
||||
@ -176,7 +213,7 @@ public final class TeleporterInstance extends Npc
|
||||
String filename = "data/html/teleporter/castleteleporter-no.htm";
|
||||
if ((player.getClan() != null) && (getCastle().getOwnerId() == player.getClanId())) // Clan owns castle
|
||||
{
|
||||
filename = getHtmlPath(getId(), 0); // Owner message window
|
||||
filename = getHtmlPath(getId(), 0, player); // Owner message window
|
||||
}
|
||||
else if (getCastle().getSiege().isInProgress()) // Teleporter is busy due siege
|
||||
{
|
||||
|
@ -71,7 +71,7 @@ public class VillageMasterInstance extends NpcInstance
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getHtmlPath(int npcId, int val)
|
||||
public String getHtmlPath(int npcId, int val, PlayerInstance player)
|
||||
{
|
||||
String pom = "";
|
||||
|
||||
|
@ -46,7 +46,7 @@ public class WarehouseInstance extends NpcInstance
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getHtmlPath(int npcId, int val)
|
||||
public String getHtmlPath(int npcId, int val, PlayerInstance player)
|
||||
{
|
||||
String pom = "";
|
||||
|
||||
|
@ -0,0 +1,56 @@
|
||||
/*
|
||||
* This file is part of the L2J Mobius project.
|
||||
*
|
||||
* 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 3 of the License, 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, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package com.l2jmobius.gameserver.model.holders;
|
||||
|
||||
/**
|
||||
* @author Mobius
|
||||
*/
|
||||
public class TeleporterQuestRecommendationHolder
|
||||
{
|
||||
private final int _npcId;
|
||||
private final String _questName;
|
||||
private final int _cond; // -1 = all conditions
|
||||
private final String _html;
|
||||
|
||||
public TeleporterQuestRecommendationHolder(int npcId, String questName, int cond, String html)
|
||||
{
|
||||
_npcId = npcId;
|
||||
_questName = questName;
|
||||
_cond = cond;
|
||||
_html = html;
|
||||
}
|
||||
|
||||
public int getNpcId()
|
||||
{
|
||||
return _npcId;
|
||||
}
|
||||
|
||||
public String getQuestName()
|
||||
{
|
||||
return _questName;
|
||||
}
|
||||
|
||||
public int getCond()
|
||||
{
|
||||
return _cond;
|
||||
}
|
||||
|
||||
public String getHtml()
|
||||
{
|
||||
return _html;
|
||||
}
|
||||
}
|
@ -68,7 +68,7 @@ public class AdminMissingHtmls implements IAdminCommandHandler
|
||||
&& !results.contains(obj.getId()))
|
||||
{
|
||||
final Npc npc = (Npc) obj;
|
||||
if ((npc.getLocation().getX() > topLeftX) && (npc.getLocation().getX() < bottomRightX) && (npc.getLocation().getY() > topLeftY) && (npc.getLocation().getY() < bottomRightY) && npc.isTalkable() && !npc.hasListener(EventType.ON_NPC_FIRST_TALK) && (npc.getHtmlPath(npc.getId(), 0) == "data/html/npcdefault.htm"))
|
||||
if ((npc.getLocation().getX() > topLeftX) && (npc.getLocation().getX() < bottomRightX) && (npc.getLocation().getY() > topLeftY) && (npc.getLocation().getY() < bottomRightY) && npc.isTalkable() && !npc.hasListener(EventType.ON_NPC_FIRST_TALK) && (npc.getHtmlPath(npc.getId(), 0, null) == "data/html/npcdefault.htm"))
|
||||
{
|
||||
results.add(npc.getId());
|
||||
}
|
||||
@ -95,7 +95,7 @@ public class AdminMissingHtmls implements IAdminCommandHandler
|
||||
&& !results.contains(obj.getId()))
|
||||
{
|
||||
final Npc npc = (Npc) obj;
|
||||
if (npc.isTalkable() && !npc.hasListener(EventType.ON_NPC_FIRST_TALK) && (npc.getHtmlPath(npc.getId(), 0) == "data/html/npcdefault.htm"))
|
||||
if (npc.isTalkable() && !npc.hasListener(EventType.ON_NPC_FIRST_TALK) && (npc.getHtmlPath(npc.getId(), 0, null) == "data/html/npcdefault.htm"))
|
||||
{
|
||||
results.add(npc.getId());
|
||||
}
|
||||
|
@ -681,9 +681,10 @@ public class Npc extends Creature
|
||||
* </ul>
|
||||
* @param npcId The Identifier of the NpcInstance whose text must be display
|
||||
* @param val The number of the page to display
|
||||
* @param player The player that speaks to this NPC
|
||||
* @return the pathfile of the selected HTML file in function of the npcId and of the page number.
|
||||
*/
|
||||
public String getHtmlPath(int npcId, int val)
|
||||
public String getHtmlPath(int npcId, int val, PlayerInstance player)
|
||||
{
|
||||
String pom = "";
|
||||
|
||||
@ -808,7 +809,7 @@ public class Npc extends Creature
|
||||
}
|
||||
else
|
||||
{
|
||||
filename = (getHtmlPath(npcId, val));
|
||||
filename = (getHtmlPath(npcId, val, player));
|
||||
}
|
||||
break;
|
||||
}
|
||||
@ -824,7 +825,7 @@ public class Npc extends Creature
|
||||
}
|
||||
else
|
||||
{
|
||||
filename = (getHtmlPath(npcId, val));
|
||||
filename = (getHtmlPath(npcId, val, player));
|
||||
}
|
||||
break;
|
||||
}
|
||||
@ -832,11 +833,11 @@ public class Npc extends Creature
|
||||
{
|
||||
if (player.isAcademyMember())
|
||||
{
|
||||
filename = (getHtmlPath(npcId, 1));
|
||||
filename = (getHtmlPath(npcId, 1, player));
|
||||
}
|
||||
else
|
||||
{
|
||||
filename = (getHtmlPath(npcId, val));
|
||||
filename = (getHtmlPath(npcId, val, player));
|
||||
}
|
||||
break;
|
||||
}
|
||||
@ -847,7 +848,7 @@ public class Npc extends Creature
|
||||
return;
|
||||
}
|
||||
// Get the text of the selected HTML file in function of the npcId and of the page number
|
||||
filename = (getHtmlPath(npcId, val));
|
||||
filename = (getHtmlPath(npcId, val, player));
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
@ -36,7 +36,7 @@ public final class FishermanInstance extends MerchantInstance
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getHtmlPath(int npcId, int val)
|
||||
public String getHtmlPath(int npcId, int val, PlayerInstance player)
|
||||
{
|
||||
String pom = "";
|
||||
|
||||
|
@ -213,7 +213,7 @@ public class FortLogisticsInstance extends MerchantInstance
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getHtmlPath(int npcId, int val)
|
||||
public String getHtmlPath(int npcId, int val, PlayerInstance player)
|
||||
{
|
||||
String pom = "";
|
||||
|
||||
|
@ -149,7 +149,7 @@ public class FriendlyNpcInstance extends Attackable
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getHtmlPath(int npcId, int val)
|
||||
public String getHtmlPath(int npcId, int val, PlayerInstance player)
|
||||
{
|
||||
String pom = "";
|
||||
if (val == 0)
|
||||
|
@ -109,7 +109,7 @@ public class GuardInstance extends Attackable
|
||||
* @param val The number of the page to display
|
||||
*/
|
||||
@Override
|
||||
public String getHtmlPath(int npcId, int val)
|
||||
public String getHtmlPath(int npcId, int val, PlayerInstance player)
|
||||
{
|
||||
String pom = "";
|
||||
if (val == 0)
|
||||
|
@ -49,7 +49,7 @@ public class MerchantInstance extends NpcInstance
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getHtmlPath(int npcId, int val)
|
||||
public String getHtmlPath(int npcId, int val, PlayerInstance player)
|
||||
{
|
||||
String pom;
|
||||
if (val == 0)
|
||||
|
@ -30,7 +30,7 @@ public class PetManagerInstance extends MerchantInstance
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getHtmlPath(int npcId, int val)
|
||||
public String getHtmlPath(int npcId, int val, PlayerInstance player)
|
||||
{
|
||||
String pom = "";
|
||||
|
||||
|
@ -51,7 +51,7 @@ public class SchemeBufferInstance extends Npc
|
||||
if (currentCommand.startsWith("menu"))
|
||||
{
|
||||
final NpcHtmlMessage html = new NpcHtmlMessage(getObjectId());
|
||||
html.setFile(player, getHtmlPath(getId(), 0));
|
||||
html.setFile(player, getHtmlPath(getId(), 0, player));
|
||||
html.replace("%objectId%", getObjectId());
|
||||
player.sendPacket(html);
|
||||
}
|
||||
@ -66,7 +66,7 @@ public class SchemeBufferInstance extends Npc
|
||||
}
|
||||
|
||||
final NpcHtmlMessage html = new NpcHtmlMessage(getObjectId());
|
||||
html.setFile(player, getHtmlPath(getId(), 0));
|
||||
html.setFile(player, getHtmlPath(getId(), 0, player));
|
||||
html.replace("%objectId%", getObjectId());
|
||||
player.sendPacket(html);
|
||||
}
|
||||
@ -82,7 +82,7 @@ public class SchemeBufferInstance extends Npc
|
||||
}
|
||||
|
||||
final NpcHtmlMessage html = new NpcHtmlMessage(getObjectId());
|
||||
html.setFile(player, getHtmlPath(getId(), 0));
|
||||
html.setFile(player, getHtmlPath(getId(), 0, player));
|
||||
html.replace("%objectId%", getObjectId());
|
||||
player.sendPacket(html);
|
||||
}
|
||||
@ -224,7 +224,7 @@ public class SchemeBufferInstance extends Npc
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getHtmlPath(int npcId, int val)
|
||||
public String getHtmlPath(int npcId, int val, PlayerInstance player)
|
||||
{
|
||||
String filename = "";
|
||||
if (val == 0)
|
||||
@ -266,7 +266,7 @@ public class SchemeBufferInstance extends Npc
|
||||
}
|
||||
|
||||
final NpcHtmlMessage html = new NpcHtmlMessage(getObjectId());
|
||||
html.setFile(player, getHtmlPath(getId(), 1));
|
||||
html.setFile(player, getHtmlPath(getId(), 1, player));
|
||||
html.replace("%schemes%", sb.toString());
|
||||
html.replace("%max_schemes%", Config.BUFFER_MAX_SCHEMES);
|
||||
html.replace("%objectId%", getObjectId());
|
||||
@ -285,7 +285,7 @@ public class SchemeBufferInstance extends Npc
|
||||
final NpcHtmlMessage html = new NpcHtmlMessage(getObjectId());
|
||||
final List<Integer> schemeSkills = SchemeBufferTable.getInstance().getScheme(player.getObjectId(), schemeName);
|
||||
|
||||
html.setFile(player, getHtmlPath(getId(), 2));
|
||||
html.setFile(player, getHtmlPath(getId(), 2, player));
|
||||
html.replace("%schemename%", schemeName);
|
||||
html.replace("%count%", getCountOf(schemeSkills, false) + " / " + player.getStat().getMaxBuffCount() + " buffs, " + getCountOf(schemeSkills, true) + " / " + Config.DANCES_MAX_AMOUNT + " dances/songs");
|
||||
html.replace("%typesframe%", getTypesFrame(groupType, schemeName));
|
||||
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user