Quest condition is now cached in a separate QuestState variable.

This commit is contained in:
MobiusDevelopment
2021-11-13 15:21:57 +00:00
parent 2988292540
commit e9f27b365e
700 changed files with 35311 additions and 33501 deletions

View File

@@ -336,7 +336,7 @@ public class AdminShowQuests implements IAdminCommandHandler
{ {
qs = QuestManager.getInstance().getQuest(Integer.parseInt(val[0])).newQuestState(target); qs = QuestManager.getInstance().getQuest(Integer.parseInt(val[0])).newQuestState(target);
qs.setState(State.STARTED); qs.setState(State.STARTED);
qs.set("cond", "1"); qs.setCond(1);
target.sendPacket(new QuestList(target)); target.sendPacket(new QuestList(target));
target.sendPacket(new ExShowQuestMark(qs.getQuest().getId(), qs.getCond())); target.sendPacket(new ExShowQuestMark(qs.getQuest().getId(), qs.getCond()));
val[0] = qs.getQuest().getName(); val[0] = qs.getQuest().getName();

View File

@@ -219,10 +219,6 @@ public class Q00350_EnhanceYourWeapon extends Quest
String htmltext = getNoQuestMsg(player); String htmltext = getNoQuestMsg(player);
final QuestState qs = getQuestState(player, true); final QuestState qs = getQuestState(player, true);
if (qs.getState() == State.CREATED) if (qs.getState() == State.CREATED)
{
qs.set("cond", "0");
}
if (qs.getInt("cond") == 0)
{ {
htmltext = npc.getId() + "-01.htm"; htmltext = npc.getId() + "-01.htm";
} }

View File

@@ -40,6 +40,12 @@ public class QuestState
{ {
protected static final Logger LOGGER = Logger.getLogger(QuestState.class.getName()); protected static final Logger LOGGER = Logger.getLogger(QuestState.class.getName());
// Constants
private static final String COND_VAR = "cond";
private static final String RESTART_VAR = "restartTime";
private static final String MEMO_VAR = "memoState";
private static final String MEMO_EX_VAR = "memoStateEx";
/** The name of the quest of this QuestState */ /** The name of the quest of this QuestState */
private final String _questName; private final String _questName;
@@ -49,6 +55,9 @@ public class QuestState
/** The current state of the quest */ /** The current state of the quest */
private byte _state; private byte _state;
/** The current condition of the quest */
private int _cond = 0;
/** Used for simulating Quest onTalk */ /** Used for simulating Quest onTalk */
private boolean _simulated = false; private boolean _simulated = false;
@@ -156,10 +165,12 @@ public class QuestState
{ {
return; return;
} }
if (_state == state) if (_state == state)
{ {
return; return;
} }
final boolean newQuest = isCreated(); final boolean newQuest = isCreated();
_state = state; _state = state;
if (saveInDb) if (saveInDb)
@@ -179,10 +190,10 @@ public class QuestState
/** /**
* Add parameter used in quests. * Add parameter used in quests.
* @param var String pointing out the name of the variable for quest * @param variable String pointing out the name of the variable for quest
* @param value String pointing out the value of the variable for quest * @param value String pointing out the value of the variable for quest
*/ */
public void setInternal(String var, String value) public void setInternal(String variable, String value)
{ {
if (_simulated) if (_simulated)
{ {
@@ -196,20 +207,32 @@ public class QuestState
if (value == null) if (value == null)
{ {
_vars.put(var, ""); _vars.put(variable, "");
return; return;
} }
_vars.put(var, value); if (COND_VAR.equals(variable))
{
try
{
_cond = Integer.parseInt(value);
}
catch (Exception ignored)
{
}
} }
public void set(String var, int value) _vars.put(variable, value);
}
public void set(String variable, int value)
{ {
if (_simulated) if (_simulated)
{ {
return; return;
} }
set(var, Integer.toString(value));
set(variable, Integer.toString(value));
} }
/** /**
@@ -223,10 +246,10 @@ public class QuestState
* The key is known as existing if the preceding value of the key (given as result of function put()) is not null.<br> * The key is known as existing if the preceding value of the key (given as result of function put()) is not null.<br>
* If the key doesn't exist, the couple is added/created in the database</li> * If the key doesn't exist, the couple is added/created in the database</li>
* <ul> * <ul>
* @param var String indicating the name of the variable for quest * @param variable String indicating the name of the variable for quest
* @param val String indicating the value of the variable for quest * @param value String indicating the value of the variable for quest
*/ */
public void set(String var, String val) public void set(String variable, String value)
{ {
if (_simulated) if (_simulated)
{ {
@@ -238,23 +261,23 @@ public class QuestState
_vars = new HashMap<>(); _vars = new HashMap<>();
} }
String value = val; String newValue = value;
if (value == null) if (newValue == null)
{ {
value = ""; newValue = "";
} }
final String old = _vars.put(var, value); final String old = _vars.put(variable, newValue);
if (old != null) if (old != null)
{ {
Quest.updateQuestVarInDb(this, var, value); Quest.updateQuestVarInDb(this, variable, newValue);
} }
else else
{ {
Quest.createQuestVarInDb(this, var, value); Quest.createQuestVarInDb(this, variable, newValue);
} }
if ("cond".equals(var)) if (COND_VAR.equals(variable))
{ {
try try
{ {
@@ -263,16 +286,25 @@ public class QuestState
{ {
previousVal = Integer.parseInt(old); previousVal = Integer.parseInt(old);
} }
catch (Exception ex) catch (Exception ignored)
{ {
previousVal = 0;
} }
setCond(Integer.parseInt(value), previousVal); int newCond = 0;
try
{
newCond = Integer.parseInt(newValue);
}
catch (Exception ignored)
{
}
_cond = newCond;
setCond(newCond, previousVal);
getQuest().sendNpcLogList(getPlayer()); getQuest().sendNpcLogList(getPlayer());
} }
catch (Exception e) catch (Exception e)
{ {
LOGGER.log(Level.WARNING, _player.getName() + ", " + _questName + " cond [" + value + "] is not an integer. Value stored, but no packet was sent: " + e.getMessage(), e); LOGGER.log(Level.WARNING, _player.getName() + ", " + _questName + " cond [" + newValue + "] is not an integer. Value stored, but no packet was sent: " + e.getMessage(), e);
} }
} }
} }
@@ -373,9 +405,9 @@ public class QuestState
/** /**
* Removes a quest variable from the list of existing quest variables. * Removes a quest variable from the list of existing quest variables.
* @param var the name of the variable to remove * @param variable the name of the variable to remove
*/ */
public void unset(String var) public void unset(String variable)
{ {
if (_simulated) if (_simulated)
{ {
@@ -387,54 +419,60 @@ public class QuestState
return; return;
} }
final String old = _vars.remove(var); final String old = _vars.remove(variable);
if (old != null) if (old != null)
{ {
Quest.deleteQuestVarInDb(this, var); if (COND_VAR.equals(variable))
{
_cond = 0;
}
Quest.deleteQuestVarInDb(this, variable);
} }
} }
/** /**
* @param var the name of the variable to get * @param variable the name of the variable to get
* @return the value of the variable from the list of quest variables * @return the value of the variable from the list of quest variables
*/ */
public String get(String var) public String get(String variable)
{ {
if (_vars == null) if (_vars == null)
{ {
return null; return null;
} }
return _vars.get(var);
return _vars.get(variable);
} }
/** /**
* @param var the name of the variable to get * @param variable the name of the variable to get
* @return the integer value of the variable or 0 if the variable does not exist or its value is not an integer * @return the integer value of the variable or 0 if the variable does not exist or its value is not an integer
*/ */
public int getInt(String var) public int getInt(String variable)
{ {
if (_vars == null) if (_vars == null)
{ {
return 0; return 0;
} }
final String variable = _vars.get(var); final String varStr = _vars.get(variable);
if ((variable == null) || variable.isEmpty()) if ((varStr == null) || varStr.isEmpty())
{ {
return 0; return 0;
} }
int varint = 0; int varInt = 0;
try try
{ {
varint = Integer.parseInt(variable); varInt = Integer.parseInt(varStr);
} }
catch (NumberFormatException nfe) catch (NumberFormatException nfe)
{ {
LOGGER.log(Level.INFO, "Quest " + _questName + ", method getInt(" + var + "), tried to parse a non-integer value (" + variable + "). Char Id: " + _player.getObjectId(), nfe); LOGGER.log(Level.INFO, "Quest " + _questName + ", method getInt(" + variable + "), tried to parse a non-integer value (" + varStr + "). Char Id: " + _player.getObjectId(), nfe);
} }
return varint; return varInt;
} }
/** /**
@@ -445,7 +483,7 @@ public class QuestState
*/ */
public boolean isCond(int condition) public boolean isCond(int condition)
{ {
return getInt("cond") == condition; return _cond == condition;
} }
/** /**
@@ -463,7 +501,7 @@ public class QuestState
if (isStarted()) if (isStarted())
{ {
set("cond", Integer.toString(value)); set(COND_VAR, Integer.toString(value));
} }
} }
@@ -474,7 +512,21 @@ public class QuestState
{ {
if (isStarted()) if (isStarted())
{ {
int val = getInt("cond"); return _cond;
}
return 0;
}
/**
* Get bit set representing completed conds.
* @return if none cond is set {@code 0}, otherwise cond bit set.
*/
public int getCondBitSet()
{
if (isStarted())
{
int val = getInt(COND_VAR);
if ((val & 0x80000000) != 0) if ((val & 0x80000000) != 0)
{ {
val &= 0x7fffffff; val &= 0x7fffffff;
@@ -524,7 +576,8 @@ public class QuestState
{ {
return; return;
} }
set("cond", String.valueOf(value));
set(COND_VAR, String.valueOf(value));
if (playQuestMiddle) if (playQuestMiddle)
{ {
_player.sendPacket(QuestSound.ITEMSOUND_QUEST_MIDDLE.getPacket()); _player.sendPacket(QuestSound.ITEMSOUND_QUEST_MIDDLE.getPacket());
@@ -537,7 +590,8 @@ public class QuestState
{ {
return; return;
} }
set("memoState", String.valueOf(value));
set(MEMO_VAR, String.valueOf(value));
} }
/** /**
@@ -547,14 +601,15 @@ public class QuestState
{ {
if (isStarted()) if (isStarted())
{ {
return getInt("memoState"); return getInt(MEMO_VAR);
} }
return 0; return 0;
} }
public boolean isMemoState(int memoState) public boolean isMemoState(int memoState)
{ {
return getInt("memoState") == memoState; return getInt(MEMO_VAR) == memoState;
} }
/** /**
@@ -566,8 +621,9 @@ public class QuestState
{ {
if (isStarted()) if (isStarted())
{ {
return getInt("memoStateEx" + slot); return getInt(MEMO_EX_VAR + slot);
} }
return 0; return 0;
} }
@@ -582,7 +638,8 @@ public class QuestState
{ {
return; return;
} }
set("memoStateEx" + slot, String.valueOf(value));
set(MEMO_EX_VAR + slot, String.valueOf(value));
} }
/** /**
@@ -613,6 +670,7 @@ public class QuestState
{ {
return; return;
} }
_isExitQuestOnCleanUp = isExitQuestOnCleanUp; _isExitQuestOnCleanUp = isExitQuestOnCleanUp;
} }
@@ -626,9 +684,10 @@ public class QuestState
{ {
return; return;
} }
if (isCreated() && !getQuest().isCustomQuest()) if (isCreated() && !getQuest().isCustomQuest())
{ {
set("cond", "1"); set(COND_VAR, "1");
setState(State.STARTED); setState(State.STARTED);
_player.sendPacket(QuestSound.ITEMSOUND_QUEST_ACCEPT.getPacket()); _player.sendPacket(QuestSound.ITEMSOUND_QUEST_ACCEPT.getPacket());
getQuest().sendNpcLogList(getPlayer()); getQuest().sendNpcLogList(getPlayer());
@@ -686,6 +745,7 @@ public class QuestState
{ {
return; return;
} }
exitQuest(type); exitQuest(type);
if (playExitQuest) if (playExitQuest)
{ {
@@ -776,7 +836,7 @@ public class QuestState
} }
reDo.set(Calendar.HOUR_OF_DAY, getQuest().getResetHour()); reDo.set(Calendar.HOUR_OF_DAY, getQuest().getResetHour());
reDo.set(Calendar.MINUTE, getQuest().getResetMinutes()); reDo.set(Calendar.MINUTE, getQuest().getResetMinutes());
set("restartTime", String.valueOf(reDo.getTimeInMillis())); set(RESTART_VAR, String.valueOf(reDo.getTimeInMillis()));
} }
/** /**
@@ -785,7 +845,7 @@ public class QuestState
*/ */
public boolean isNowAvailable() public boolean isNowAvailable()
{ {
final String val = get("restartTime"); final String val = get(RESTART_VAR);
return (val != null) && (Long.parseLong(val) <= Chronos.currentTimeMillis()); return (val != null) && (Long.parseLong(val) <= Chronos.currentTimeMillis());
} }

View File

@@ -58,7 +58,7 @@ public class QuestList implements IClientOutgoingPacket
for (QuestState qs : _activeQuests) for (QuestState qs : _activeQuests)
{ {
packet.writeD(qs.getQuest().getId()); packet.writeD(qs.getQuest().getId());
packet.writeD(qs.getCond()); packet.writeD(qs.getCondBitSet());
} }
packet.writeB(_oneTimeQuestMask); packet.writeB(_oneTimeQuestMask);
return true; return true;

View File

@@ -336,7 +336,7 @@ public class AdminShowQuests implements IAdminCommandHandler
{ {
qs = QuestManager.getInstance().getQuest(Integer.parseInt(val[0])).newQuestState(target); qs = QuestManager.getInstance().getQuest(Integer.parseInt(val[0])).newQuestState(target);
qs.setState(State.STARTED); qs.setState(State.STARTED);
qs.set("cond", "1"); qs.setCond(1);
target.sendPacket(new QuestList(target)); target.sendPacket(new QuestList(target));
target.sendPacket(new ExShowQuestMark(qs.getQuest().getId(), qs.getCond())); target.sendPacket(new ExShowQuestMark(qs.getQuest().getId(), qs.getCond()));
val[0] = qs.getQuest().getName(); val[0] = qs.getQuest().getName();

View File

@@ -40,6 +40,12 @@ public class QuestState
{ {
protected static final Logger LOGGER = Logger.getLogger(QuestState.class.getName()); protected static final Logger LOGGER = Logger.getLogger(QuestState.class.getName());
// Constants
private static final String COND_VAR = "cond";
private static final String RESTART_VAR = "restartTime";
private static final String MEMO_VAR = "memoState";
private static final String MEMO_EX_VAR = "memoStateEx";
/** The name of the quest of this QuestState */ /** The name of the quest of this QuestState */
private final String _questName; private final String _questName;
@@ -49,6 +55,9 @@ public class QuestState
/** The current state of the quest */ /** The current state of the quest */
private byte _state; private byte _state;
/** The current condition of the quest */
private int _cond = 0;
/** Used for simulating Quest onTalk */ /** Used for simulating Quest onTalk */
private boolean _simulated = false; private boolean _simulated = false;
@@ -156,10 +165,12 @@ public class QuestState
{ {
return; return;
} }
if (_state == state) if (_state == state)
{ {
return; return;
} }
final boolean newQuest = isCreated(); final boolean newQuest = isCreated();
_state = state; _state = state;
if (saveInDb) if (saveInDb)
@@ -179,10 +190,10 @@ public class QuestState
/** /**
* Add parameter used in quests. * Add parameter used in quests.
* @param var String pointing out the name of the variable for quest * @param variable String pointing out the name of the variable for quest
* @param value String pointing out the value of the variable for quest * @param value String pointing out the value of the variable for quest
*/ */
public void setInternal(String var, String value) public void setInternal(String variable, String value)
{ {
if (_simulated) if (_simulated)
{ {
@@ -196,20 +207,32 @@ public class QuestState
if (value == null) if (value == null)
{ {
_vars.put(var, ""); _vars.put(variable, "");
return; return;
} }
_vars.put(var, value); if (COND_VAR.equals(variable))
{
try
{
_cond = Integer.parseInt(value);
}
catch (Exception ignored)
{
}
} }
public void set(String var, int value) _vars.put(variable, value);
}
public void set(String variable, int value)
{ {
if (_simulated) if (_simulated)
{ {
return; return;
} }
set(var, Integer.toString(value));
set(variable, Integer.toString(value));
} }
/** /**
@@ -223,10 +246,10 @@ public class QuestState
* The key is known as existing if the preceding value of the key (given as result of function put()) is not null.<br> * The key is known as existing if the preceding value of the key (given as result of function put()) is not null.<br>
* If the key doesn't exist, the couple is added/created in the database</li> * If the key doesn't exist, the couple is added/created in the database</li>
* <ul> * <ul>
* @param var String indicating the name of the variable for quest * @param variable String indicating the name of the variable for quest
* @param val String indicating the value of the variable for quest * @param value String indicating the value of the variable for quest
*/ */
public void set(String var, String val) public void set(String variable, String value)
{ {
if (_simulated) if (_simulated)
{ {
@@ -238,23 +261,23 @@ public class QuestState
_vars = new HashMap<>(); _vars = new HashMap<>();
} }
String value = val; String newValue = value;
if (value == null) if (newValue == null)
{ {
value = ""; newValue = "";
} }
final String old = _vars.put(var, value); final String old = _vars.put(variable, newValue);
if (old != null) if (old != null)
{ {
Quest.updateQuestVarInDb(this, var, value); Quest.updateQuestVarInDb(this, variable, newValue);
} }
else else
{ {
Quest.createQuestVarInDb(this, var, value); Quest.createQuestVarInDb(this, variable, newValue);
} }
if ("cond".equals(var)) if (COND_VAR.equals(variable))
{ {
try try
{ {
@@ -263,16 +286,25 @@ public class QuestState
{ {
previousVal = Integer.parseInt(old); previousVal = Integer.parseInt(old);
} }
catch (Exception ex) catch (Exception ignored)
{ {
previousVal = 0;
} }
setCond(Integer.parseInt(value), previousVal); int newCond = 0;
try
{
newCond = Integer.parseInt(newValue);
}
catch (Exception ignored)
{
}
_cond = newCond;
setCond(newCond, previousVal);
getQuest().sendNpcLogList(getPlayer()); getQuest().sendNpcLogList(getPlayer());
} }
catch (Exception e) catch (Exception e)
{ {
LOGGER.log(Level.WARNING, _player.getName() + ", " + _questName + " cond [" + value + "] is not an integer. Value stored, but no packet was sent: " + e.getMessage(), e); LOGGER.log(Level.WARNING, _player.getName() + ", " + _questName + " cond [" + newValue + "] is not an integer. Value stored, but no packet was sent: " + e.getMessage(), e);
} }
} }
} }
@@ -373,9 +405,9 @@ public class QuestState
/** /**
* Removes a quest variable from the list of existing quest variables. * Removes a quest variable from the list of existing quest variables.
* @param var the name of the variable to remove * @param variable the name of the variable to remove
*/ */
public void unset(String var) public void unset(String variable)
{ {
if (_simulated) if (_simulated)
{ {
@@ -387,54 +419,60 @@ public class QuestState
return; return;
} }
final String old = _vars.remove(var); final String old = _vars.remove(variable);
if (old != null) if (old != null)
{ {
Quest.deleteQuestVarInDb(this, var); if (COND_VAR.equals(variable))
{
_cond = 0;
}
Quest.deleteQuestVarInDb(this, variable);
} }
} }
/** /**
* @param var the name of the variable to get * @param variable the name of the variable to get
* @return the value of the variable from the list of quest variables * @return the value of the variable from the list of quest variables
*/ */
public String get(String var) public String get(String variable)
{ {
if (_vars == null) if (_vars == null)
{ {
return null; return null;
} }
return _vars.get(var);
return _vars.get(variable);
} }
/** /**
* @param var the name of the variable to get * @param variable the name of the variable to get
* @return the integer value of the variable or 0 if the variable does not exist or its value is not an integer * @return the integer value of the variable or 0 if the variable does not exist or its value is not an integer
*/ */
public int getInt(String var) public int getInt(String variable)
{ {
if (_vars == null) if (_vars == null)
{ {
return 0; return 0;
} }
final String variable = _vars.get(var); final String varStr = _vars.get(variable);
if ((variable == null) || variable.isEmpty()) if ((varStr == null) || varStr.isEmpty())
{ {
return 0; return 0;
} }
int varint = 0; int varInt = 0;
try try
{ {
varint = Integer.parseInt(variable); varInt = Integer.parseInt(varStr);
} }
catch (NumberFormatException nfe) catch (NumberFormatException nfe)
{ {
LOGGER.log(Level.INFO, "Quest " + _questName + ", method getInt(" + var + "), tried to parse a non-integer value (" + variable + "). Char Id: " + _player.getObjectId(), nfe); LOGGER.log(Level.INFO, "Quest " + _questName + ", method getInt(" + variable + "), tried to parse a non-integer value (" + varStr + "). Char Id: " + _player.getObjectId(), nfe);
} }
return varint; return varInt;
} }
/** /**
@@ -445,7 +483,7 @@ public class QuestState
*/ */
public boolean isCond(int condition) public boolean isCond(int condition)
{ {
return getInt("cond") == condition; return _cond == condition;
} }
/** /**
@@ -463,7 +501,7 @@ public class QuestState
if (isStarted()) if (isStarted())
{ {
set("cond", Integer.toString(value)); set(COND_VAR, Integer.toString(value));
} }
} }
@@ -474,7 +512,21 @@ public class QuestState
{ {
if (isStarted()) if (isStarted())
{ {
int val = getInt("cond"); return _cond;
}
return 0;
}
/**
* Get bit set representing completed conds.
* @return if none cond is set {@code 0}, otherwise cond bit set.
*/
public int getCondBitSet()
{
if (isStarted())
{
int val = getInt(COND_VAR);
if ((val & 0x80000000) != 0) if ((val & 0x80000000) != 0)
{ {
val &= 0x7fffffff; val &= 0x7fffffff;
@@ -524,7 +576,8 @@ public class QuestState
{ {
return; return;
} }
set("cond", String.valueOf(value));
set(COND_VAR, String.valueOf(value));
if (playQuestMiddle) if (playQuestMiddle)
{ {
_player.sendPacket(QuestSound.ITEMSOUND_QUEST_MIDDLE.getPacket()); _player.sendPacket(QuestSound.ITEMSOUND_QUEST_MIDDLE.getPacket());
@@ -537,7 +590,8 @@ public class QuestState
{ {
return; return;
} }
set("memoState", String.valueOf(value));
set(MEMO_VAR, String.valueOf(value));
} }
/** /**
@@ -547,14 +601,15 @@ public class QuestState
{ {
if (isStarted()) if (isStarted())
{ {
return getInt("memoState"); return getInt(MEMO_VAR);
} }
return 0; return 0;
} }
public boolean isMemoState(int memoState) public boolean isMemoState(int memoState)
{ {
return getInt("memoState") == memoState; return getInt(MEMO_VAR) == memoState;
} }
/** /**
@@ -566,8 +621,9 @@ public class QuestState
{ {
if (isStarted()) if (isStarted())
{ {
return getInt("memoStateEx" + slot); return getInt(MEMO_EX_VAR + slot);
} }
return 0; return 0;
} }
@@ -582,7 +638,8 @@ public class QuestState
{ {
return; return;
} }
set("memoStateEx" + slot, String.valueOf(value));
set(MEMO_EX_VAR + slot, String.valueOf(value));
} }
/** /**
@@ -613,6 +670,7 @@ public class QuestState
{ {
return; return;
} }
_isExitQuestOnCleanUp = isExitQuestOnCleanUp; _isExitQuestOnCleanUp = isExitQuestOnCleanUp;
} }
@@ -626,9 +684,10 @@ public class QuestState
{ {
return; return;
} }
if (isCreated() && !getQuest().isCustomQuest()) if (isCreated() && !getQuest().isCustomQuest())
{ {
set("cond", "1"); set(COND_VAR, "1");
setState(State.STARTED); setState(State.STARTED);
_player.sendPacket(QuestSound.ITEMSOUND_QUEST_ACCEPT.getPacket()); _player.sendPacket(QuestSound.ITEMSOUND_QUEST_ACCEPT.getPacket());
getQuest().sendNpcLogList(getPlayer()); getQuest().sendNpcLogList(getPlayer());
@@ -686,6 +745,7 @@ public class QuestState
{ {
return; return;
} }
exitQuest(type); exitQuest(type);
if (playExitQuest) if (playExitQuest)
{ {
@@ -776,7 +836,7 @@ public class QuestState
} }
reDo.set(Calendar.HOUR_OF_DAY, getQuest().getResetHour()); reDo.set(Calendar.HOUR_OF_DAY, getQuest().getResetHour());
reDo.set(Calendar.MINUTE, getQuest().getResetMinutes()); reDo.set(Calendar.MINUTE, getQuest().getResetMinutes());
set("restartTime", String.valueOf(reDo.getTimeInMillis())); set(RESTART_VAR, String.valueOf(reDo.getTimeInMillis()));
} }
/** /**
@@ -785,7 +845,7 @@ public class QuestState
*/ */
public boolean isNowAvailable() public boolean isNowAvailable()
{ {
final String val = get("restartTime"); final String val = get(RESTART_VAR);
return (val != null) && (Long.parseLong(val) <= Chronos.currentTimeMillis()); return (val != null) && (Long.parseLong(val) <= Chronos.currentTimeMillis());
} }

View File

@@ -58,7 +58,7 @@ public class QuestList implements IClientOutgoingPacket
for (QuestState qs : _activeQuests) for (QuestState qs : _activeQuests)
{ {
packet.writeD(qs.getQuest().getId()); packet.writeD(qs.getQuest().getId());
packet.writeD(qs.getCond()); packet.writeD(qs.getCondBitSet());
} }
packet.writeB(_oneTimeQuestMask); packet.writeB(_oneTimeQuestMask);
return true; return true;

View File

@@ -336,7 +336,7 @@ public class AdminShowQuests implements IAdminCommandHandler
{ {
qs = QuestManager.getInstance().getQuest(Integer.parseInt(val[0])).newQuestState(target); qs = QuestManager.getInstance().getQuest(Integer.parseInt(val[0])).newQuestState(target);
qs.setState(State.STARTED); qs.setState(State.STARTED);
qs.set("cond", "1"); qs.setCond(1);
target.sendPacket(new QuestList(target)); target.sendPacket(new QuestList(target));
target.sendPacket(new ExShowQuestMark(qs.getQuest().getId(), qs.getCond())); target.sendPacket(new ExShowQuestMark(qs.getQuest().getId(), qs.getCond()));
val[0] = qs.getQuest().getName(); val[0] = qs.getQuest().getName();

View File

@@ -40,6 +40,12 @@ public class QuestState
{ {
protected static final Logger LOGGER = Logger.getLogger(QuestState.class.getName()); protected static final Logger LOGGER = Logger.getLogger(QuestState.class.getName());
// Constants
private static final String COND_VAR = "cond";
private static final String RESTART_VAR = "restartTime";
private static final String MEMO_VAR = "memoState";
private static final String MEMO_EX_VAR = "memoStateEx";
/** The name of the quest of this QuestState */ /** The name of the quest of this QuestState */
private final String _questName; private final String _questName;
@@ -49,6 +55,9 @@ public class QuestState
/** The current state of the quest */ /** The current state of the quest */
private byte _state; private byte _state;
/** The current condition of the quest */
private int _cond = 0;
/** Used for simulating Quest onTalk */ /** Used for simulating Quest onTalk */
private boolean _simulated = false; private boolean _simulated = false;
@@ -156,10 +165,12 @@ public class QuestState
{ {
return; return;
} }
if (_state == state) if (_state == state)
{ {
return; return;
} }
final boolean newQuest = isCreated(); final boolean newQuest = isCreated();
_state = state; _state = state;
if (saveInDb) if (saveInDb)
@@ -179,10 +190,10 @@ public class QuestState
/** /**
* Add parameter used in quests. * Add parameter used in quests.
* @param var String pointing out the name of the variable for quest * @param variable String pointing out the name of the variable for quest
* @param value String pointing out the value of the variable for quest * @param value String pointing out the value of the variable for quest
*/ */
public void setInternal(String var, String value) public void setInternal(String variable, String value)
{ {
if (_simulated) if (_simulated)
{ {
@@ -196,20 +207,32 @@ public class QuestState
if (value == null) if (value == null)
{ {
_vars.put(var, ""); _vars.put(variable, "");
return; return;
} }
_vars.put(var, value); if (COND_VAR.equals(variable))
{
try
{
_cond = Integer.parseInt(value);
}
catch (Exception ignored)
{
}
} }
public void set(String var, int value) _vars.put(variable, value);
}
public void set(String variable, int value)
{ {
if (_simulated) if (_simulated)
{ {
return; return;
} }
set(var, Integer.toString(value));
set(variable, Integer.toString(value));
} }
/** /**
@@ -223,10 +246,10 @@ public class QuestState
* The key is known as existing if the preceding value of the key (given as result of function put()) is not null.<br> * The key is known as existing if the preceding value of the key (given as result of function put()) is not null.<br>
* If the key doesn't exist, the couple is added/created in the database</li> * If the key doesn't exist, the couple is added/created in the database</li>
* <ul> * <ul>
* @param var String indicating the name of the variable for quest * @param variable String indicating the name of the variable for quest
* @param val String indicating the value of the variable for quest * @param value String indicating the value of the variable for quest
*/ */
public void set(String var, String val) public void set(String variable, String value)
{ {
if (_simulated) if (_simulated)
{ {
@@ -238,23 +261,23 @@ public class QuestState
_vars = new HashMap<>(); _vars = new HashMap<>();
} }
String value = val; String newValue = value;
if (value == null) if (newValue == null)
{ {
value = ""; newValue = "";
} }
final String old = _vars.put(var, value); final String old = _vars.put(variable, newValue);
if (old != null) if (old != null)
{ {
Quest.updateQuestVarInDb(this, var, value); Quest.updateQuestVarInDb(this, variable, newValue);
} }
else else
{ {
Quest.createQuestVarInDb(this, var, value); Quest.createQuestVarInDb(this, variable, newValue);
} }
if ("cond".equals(var)) if (COND_VAR.equals(variable))
{ {
try try
{ {
@@ -263,16 +286,25 @@ public class QuestState
{ {
previousVal = Integer.parseInt(old); previousVal = Integer.parseInt(old);
} }
catch (Exception ex) catch (Exception ignored)
{ {
previousVal = 0;
} }
setCond(Integer.parseInt(value), previousVal); int newCond = 0;
try
{
newCond = Integer.parseInt(newValue);
}
catch (Exception ignored)
{
}
_cond = newCond;
setCond(newCond, previousVal);
getQuest().sendNpcLogList(getPlayer()); getQuest().sendNpcLogList(getPlayer());
} }
catch (Exception e) catch (Exception e)
{ {
LOGGER.log(Level.WARNING, _player.getName() + ", " + _questName + " cond [" + value + "] is not an integer. Value stored, but no packet was sent: " + e.getMessage(), e); LOGGER.log(Level.WARNING, _player.getName() + ", " + _questName + " cond [" + newValue + "] is not an integer. Value stored, but no packet was sent: " + e.getMessage(), e);
} }
} }
} }
@@ -373,9 +405,9 @@ public class QuestState
/** /**
* Removes a quest variable from the list of existing quest variables. * Removes a quest variable from the list of existing quest variables.
* @param var the name of the variable to remove * @param variable the name of the variable to remove
*/ */
public void unset(String var) public void unset(String variable)
{ {
if (_simulated) if (_simulated)
{ {
@@ -387,54 +419,60 @@ public class QuestState
return; return;
} }
final String old = _vars.remove(var); final String old = _vars.remove(variable);
if (old != null) if (old != null)
{ {
Quest.deleteQuestVarInDb(this, var); if (COND_VAR.equals(variable))
{
_cond = 0;
}
Quest.deleteQuestVarInDb(this, variable);
} }
} }
/** /**
* @param var the name of the variable to get * @param variable the name of the variable to get
* @return the value of the variable from the list of quest variables * @return the value of the variable from the list of quest variables
*/ */
public String get(String var) public String get(String variable)
{ {
if (_vars == null) if (_vars == null)
{ {
return null; return null;
} }
return _vars.get(var);
return _vars.get(variable);
} }
/** /**
* @param var the name of the variable to get * @param variable the name of the variable to get
* @return the integer value of the variable or 0 if the variable does not exist or its value is not an integer * @return the integer value of the variable or 0 if the variable does not exist or its value is not an integer
*/ */
public int getInt(String var) public int getInt(String variable)
{ {
if (_vars == null) if (_vars == null)
{ {
return 0; return 0;
} }
final String variable = _vars.get(var); final String varStr = _vars.get(variable);
if ((variable == null) || variable.isEmpty()) if ((varStr == null) || varStr.isEmpty())
{ {
return 0; return 0;
} }
int varint = 0; int varInt = 0;
try try
{ {
varint = Integer.parseInt(variable); varInt = Integer.parseInt(varStr);
} }
catch (NumberFormatException nfe) catch (NumberFormatException nfe)
{ {
LOGGER.log(Level.INFO, "Quest " + _questName + ", method getInt(" + var + "), tried to parse a non-integer value (" + variable + "). Char Id: " + _player.getObjectId(), nfe); LOGGER.log(Level.INFO, "Quest " + _questName + ", method getInt(" + variable + "), tried to parse a non-integer value (" + varStr + "). Char Id: " + _player.getObjectId(), nfe);
} }
return varint; return varInt;
} }
/** /**
@@ -445,7 +483,7 @@ public class QuestState
*/ */
public boolean isCond(int condition) public boolean isCond(int condition)
{ {
return getInt("cond") == condition; return _cond == condition;
} }
/** /**
@@ -463,7 +501,7 @@ public class QuestState
if (isStarted()) if (isStarted())
{ {
set("cond", Integer.toString(value)); set(COND_VAR, Integer.toString(value));
} }
} }
@@ -474,7 +512,21 @@ public class QuestState
{ {
if (isStarted()) if (isStarted())
{ {
int val = getInt("cond"); return _cond;
}
return 0;
}
/**
* Get bit set representing completed conds.
* @return if none cond is set {@code 0}, otherwise cond bit set.
*/
public int getCondBitSet()
{
if (isStarted())
{
int val = getInt(COND_VAR);
if ((val & 0x80000000) != 0) if ((val & 0x80000000) != 0)
{ {
val &= 0x7fffffff; val &= 0x7fffffff;
@@ -524,7 +576,8 @@ public class QuestState
{ {
return; return;
} }
set("cond", String.valueOf(value));
set(COND_VAR, String.valueOf(value));
if (playQuestMiddle) if (playQuestMiddle)
{ {
_player.sendPacket(QuestSound.ITEMSOUND_QUEST_MIDDLE.getPacket()); _player.sendPacket(QuestSound.ITEMSOUND_QUEST_MIDDLE.getPacket());
@@ -537,7 +590,8 @@ public class QuestState
{ {
return; return;
} }
set("memoState", String.valueOf(value));
set(MEMO_VAR, String.valueOf(value));
} }
/** /**
@@ -547,14 +601,15 @@ public class QuestState
{ {
if (isStarted()) if (isStarted())
{ {
return getInt("memoState"); return getInt(MEMO_VAR);
} }
return 0; return 0;
} }
public boolean isMemoState(int memoState) public boolean isMemoState(int memoState)
{ {
return getInt("memoState") == memoState; return getInt(MEMO_VAR) == memoState;
} }
/** /**
@@ -566,8 +621,9 @@ public class QuestState
{ {
if (isStarted()) if (isStarted())
{ {
return getInt("memoStateEx" + slot); return getInt(MEMO_EX_VAR + slot);
} }
return 0; return 0;
} }
@@ -582,7 +638,8 @@ public class QuestState
{ {
return; return;
} }
set("memoStateEx" + slot, String.valueOf(value));
set(MEMO_EX_VAR + slot, String.valueOf(value));
} }
/** /**
@@ -613,6 +670,7 @@ public class QuestState
{ {
return; return;
} }
_isExitQuestOnCleanUp = isExitQuestOnCleanUp; _isExitQuestOnCleanUp = isExitQuestOnCleanUp;
} }
@@ -626,9 +684,10 @@ public class QuestState
{ {
return; return;
} }
if (isCreated() && !getQuest().isCustomQuest()) if (isCreated() && !getQuest().isCustomQuest())
{ {
set("cond", "1"); set(COND_VAR, "1");
setState(State.STARTED); setState(State.STARTED);
_player.sendPacket(QuestSound.ITEMSOUND_QUEST_ACCEPT.getPacket()); _player.sendPacket(QuestSound.ITEMSOUND_QUEST_ACCEPT.getPacket());
getQuest().sendNpcLogList(getPlayer()); getQuest().sendNpcLogList(getPlayer());
@@ -686,6 +745,7 @@ public class QuestState
{ {
return; return;
} }
exitQuest(type); exitQuest(type);
if (playExitQuest) if (playExitQuest)
{ {
@@ -776,7 +836,7 @@ public class QuestState
} }
reDo.set(Calendar.HOUR_OF_DAY, getQuest().getResetHour()); reDo.set(Calendar.HOUR_OF_DAY, getQuest().getResetHour());
reDo.set(Calendar.MINUTE, getQuest().getResetMinutes()); reDo.set(Calendar.MINUTE, getQuest().getResetMinutes());
set("restartTime", String.valueOf(reDo.getTimeInMillis())); set(RESTART_VAR, String.valueOf(reDo.getTimeInMillis()));
} }
/** /**
@@ -785,7 +845,7 @@ public class QuestState
*/ */
public boolean isNowAvailable() public boolean isNowAvailable()
{ {
final String val = get("restartTime"); final String val = get(RESTART_VAR);
return (val != null) && (Long.parseLong(val) <= Chronos.currentTimeMillis()); return (val != null) && (Long.parseLong(val) <= Chronos.currentTimeMillis());
} }

View File

@@ -58,7 +58,7 @@ public class QuestList implements IClientOutgoingPacket
for (QuestState qs : _activeQuests) for (QuestState qs : _activeQuests)
{ {
packet.writeD(qs.getQuest().getId()); packet.writeD(qs.getQuest().getId());
packet.writeD(qs.getCond()); packet.writeD(qs.getCondBitSet());
} }
packet.writeB(_oneTimeQuestMask); packet.writeB(_oneTimeQuestMask);
return true; return true;

View File

@@ -336,7 +336,7 @@ public class AdminShowQuests implements IAdminCommandHandler
{ {
qs = QuestManager.getInstance().getQuest(Integer.parseInt(val[0])).newQuestState(target); qs = QuestManager.getInstance().getQuest(Integer.parseInt(val[0])).newQuestState(target);
qs.setState(State.STARTED); qs.setState(State.STARTED);
qs.set("cond", "1"); qs.setCond(1);
target.sendPacket(new QuestList(target)); target.sendPacket(new QuestList(target));
target.sendPacket(new ExShowQuestMark(qs.getQuest().getId(), qs.getCond())); target.sendPacket(new ExShowQuestMark(qs.getQuest().getId(), qs.getCond()));
val[0] = qs.getQuest().getName(); val[0] = qs.getQuest().getName();

View File

@@ -40,6 +40,12 @@ public class QuestState
{ {
protected static final Logger LOGGER = Logger.getLogger(QuestState.class.getName()); protected static final Logger LOGGER = Logger.getLogger(QuestState.class.getName());
// Constants
private static final String COND_VAR = "cond";
private static final String RESTART_VAR = "restartTime";
private static final String MEMO_VAR = "memoState";
private static final String MEMO_EX_VAR = "memoStateEx";
/** The name of the quest of this QuestState */ /** The name of the quest of this QuestState */
private final String _questName; private final String _questName;
@@ -49,6 +55,9 @@ public class QuestState
/** The current state of the quest */ /** The current state of the quest */
private byte _state; private byte _state;
/** The current condition of the quest */
private int _cond = 0;
/** Used for simulating Quest onTalk */ /** Used for simulating Quest onTalk */
private boolean _simulated = false; private boolean _simulated = false;
@@ -156,10 +165,12 @@ public class QuestState
{ {
return; return;
} }
if (_state == state) if (_state == state)
{ {
return; return;
} }
final boolean newQuest = isCreated(); final boolean newQuest = isCreated();
_state = state; _state = state;
if (saveInDb) if (saveInDb)
@@ -179,10 +190,10 @@ public class QuestState
/** /**
* Add parameter used in quests. * Add parameter used in quests.
* @param var String pointing out the name of the variable for quest * @param variable String pointing out the name of the variable for quest
* @param value String pointing out the value of the variable for quest * @param value String pointing out the value of the variable for quest
*/ */
public void setInternal(String var, String value) public void setInternal(String variable, String value)
{ {
if (_simulated) if (_simulated)
{ {
@@ -196,20 +207,32 @@ public class QuestState
if (value == null) if (value == null)
{ {
_vars.put(var, ""); _vars.put(variable, "");
return; return;
} }
_vars.put(var, value); if (COND_VAR.equals(variable))
{
try
{
_cond = Integer.parseInt(value);
}
catch (Exception ignored)
{
}
} }
public void set(String var, int value) _vars.put(variable, value);
}
public void set(String variable, int value)
{ {
if (_simulated) if (_simulated)
{ {
return; return;
} }
set(var, Integer.toString(value));
set(variable, Integer.toString(value));
} }
/** /**
@@ -223,10 +246,10 @@ public class QuestState
* The key is known as existing if the preceding value of the key (given as result of function put()) is not null.<br> * The key is known as existing if the preceding value of the key (given as result of function put()) is not null.<br>
* If the key doesn't exist, the couple is added/created in the database</li> * If the key doesn't exist, the couple is added/created in the database</li>
* <ul> * <ul>
* @param var String indicating the name of the variable for quest * @param variable String indicating the name of the variable for quest
* @param val String indicating the value of the variable for quest * @param value String indicating the value of the variable for quest
*/ */
public void set(String var, String val) public void set(String variable, String value)
{ {
if (_simulated) if (_simulated)
{ {
@@ -238,23 +261,23 @@ public class QuestState
_vars = new HashMap<>(); _vars = new HashMap<>();
} }
String value = val; String newValue = value;
if (value == null) if (newValue == null)
{ {
value = ""; newValue = "";
} }
final String old = _vars.put(var, value); final String old = _vars.put(variable, newValue);
if (old != null) if (old != null)
{ {
Quest.updateQuestVarInDb(this, var, value); Quest.updateQuestVarInDb(this, variable, newValue);
} }
else else
{ {
Quest.createQuestVarInDb(this, var, value); Quest.createQuestVarInDb(this, variable, newValue);
} }
if ("cond".equals(var)) if (COND_VAR.equals(variable))
{ {
try try
{ {
@@ -263,16 +286,25 @@ public class QuestState
{ {
previousVal = Integer.parseInt(old); previousVal = Integer.parseInt(old);
} }
catch (Exception ex) catch (Exception ignored)
{ {
previousVal = 0;
} }
setCond(Integer.parseInt(value), previousVal); int newCond = 0;
try
{
newCond = Integer.parseInt(newValue);
}
catch (Exception ignored)
{
}
_cond = newCond;
setCond(newCond, previousVal);
getQuest().sendNpcLogList(getPlayer()); getQuest().sendNpcLogList(getPlayer());
} }
catch (Exception e) catch (Exception e)
{ {
LOGGER.log(Level.WARNING, _player.getName() + ", " + _questName + " cond [" + value + "] is not an integer. Value stored, but no packet was sent: " + e.getMessage(), e); LOGGER.log(Level.WARNING, _player.getName() + ", " + _questName + " cond [" + newValue + "] is not an integer. Value stored, but no packet was sent: " + e.getMessage(), e);
} }
} }
} }
@@ -373,9 +405,9 @@ public class QuestState
/** /**
* Removes a quest variable from the list of existing quest variables. * Removes a quest variable from the list of existing quest variables.
* @param var the name of the variable to remove * @param variable the name of the variable to remove
*/ */
public void unset(String var) public void unset(String variable)
{ {
if (_simulated) if (_simulated)
{ {
@@ -387,54 +419,60 @@ public class QuestState
return; return;
} }
final String old = _vars.remove(var); final String old = _vars.remove(variable);
if (old != null) if (old != null)
{ {
Quest.deleteQuestVarInDb(this, var); if (COND_VAR.equals(variable))
{
_cond = 0;
}
Quest.deleteQuestVarInDb(this, variable);
} }
} }
/** /**
* @param var the name of the variable to get * @param variable the name of the variable to get
* @return the value of the variable from the list of quest variables * @return the value of the variable from the list of quest variables
*/ */
public String get(String var) public String get(String variable)
{ {
if (_vars == null) if (_vars == null)
{ {
return null; return null;
} }
return _vars.get(var);
return _vars.get(variable);
} }
/** /**
* @param var the name of the variable to get * @param variable the name of the variable to get
* @return the integer value of the variable or 0 if the variable does not exist or its value is not an integer * @return the integer value of the variable or 0 if the variable does not exist or its value is not an integer
*/ */
public int getInt(String var) public int getInt(String variable)
{ {
if (_vars == null) if (_vars == null)
{ {
return 0; return 0;
} }
final String variable = _vars.get(var); final String varStr = _vars.get(variable);
if ((variable == null) || variable.isEmpty()) if ((varStr == null) || varStr.isEmpty())
{ {
return 0; return 0;
} }
int varint = 0; int varInt = 0;
try try
{ {
varint = Integer.parseInt(variable); varInt = Integer.parseInt(varStr);
} }
catch (NumberFormatException nfe) catch (NumberFormatException nfe)
{ {
LOGGER.log(Level.INFO, "Quest " + _questName + ", method getInt(" + var + "), tried to parse a non-integer value (" + variable + "). Char Id: " + _player.getObjectId(), nfe); LOGGER.log(Level.INFO, "Quest " + _questName + ", method getInt(" + variable + "), tried to parse a non-integer value (" + varStr + "). Char Id: " + _player.getObjectId(), nfe);
} }
return varint; return varInt;
} }
/** /**
@@ -445,7 +483,7 @@ public class QuestState
*/ */
public boolean isCond(int condition) public boolean isCond(int condition)
{ {
return getInt("cond") == condition; return _cond == condition;
} }
/** /**
@@ -463,7 +501,7 @@ public class QuestState
if (isStarted()) if (isStarted())
{ {
set("cond", Integer.toString(value)); set(COND_VAR, Integer.toString(value));
} }
} }
@@ -474,7 +512,21 @@ public class QuestState
{ {
if (isStarted()) if (isStarted())
{ {
int val = getInt("cond"); return _cond;
}
return 0;
}
/**
* Get bit set representing completed conds.
* @return if none cond is set {@code 0}, otherwise cond bit set.
*/
public int getCondBitSet()
{
if (isStarted())
{
int val = getInt(COND_VAR);
if ((val & 0x80000000) != 0) if ((val & 0x80000000) != 0)
{ {
val &= 0x7fffffff; val &= 0x7fffffff;
@@ -524,7 +576,8 @@ public class QuestState
{ {
return; return;
} }
set("cond", String.valueOf(value));
set(COND_VAR, String.valueOf(value));
if (playQuestMiddle) if (playQuestMiddle)
{ {
_player.sendPacket(QuestSound.ITEMSOUND_QUEST_MIDDLE.getPacket()); _player.sendPacket(QuestSound.ITEMSOUND_QUEST_MIDDLE.getPacket());
@@ -537,7 +590,8 @@ public class QuestState
{ {
return; return;
} }
set("memoState", String.valueOf(value));
set(MEMO_VAR, String.valueOf(value));
} }
/** /**
@@ -547,14 +601,15 @@ public class QuestState
{ {
if (isStarted()) if (isStarted())
{ {
return getInt("memoState"); return getInt(MEMO_VAR);
} }
return 0; return 0;
} }
public boolean isMemoState(int memoState) public boolean isMemoState(int memoState)
{ {
return getInt("memoState") == memoState; return getInt(MEMO_VAR) == memoState;
} }
/** /**
@@ -566,8 +621,9 @@ public class QuestState
{ {
if (isStarted()) if (isStarted())
{ {
return getInt("memoStateEx" + slot); return getInt(MEMO_EX_VAR + slot);
} }
return 0; return 0;
} }
@@ -582,7 +638,8 @@ public class QuestState
{ {
return; return;
} }
set("memoStateEx" + slot, String.valueOf(value));
set(MEMO_EX_VAR + slot, String.valueOf(value));
} }
/** /**
@@ -613,6 +670,7 @@ public class QuestState
{ {
return; return;
} }
_isExitQuestOnCleanUp = isExitQuestOnCleanUp; _isExitQuestOnCleanUp = isExitQuestOnCleanUp;
} }
@@ -626,9 +684,10 @@ public class QuestState
{ {
return; return;
} }
if (isCreated() && !getQuest().isCustomQuest()) if (isCreated() && !getQuest().isCustomQuest())
{ {
set("cond", "1"); set(COND_VAR, "1");
setState(State.STARTED); setState(State.STARTED);
_player.sendPacket(QuestSound.ITEMSOUND_QUEST_ACCEPT.getPacket()); _player.sendPacket(QuestSound.ITEMSOUND_QUEST_ACCEPT.getPacket());
getQuest().sendNpcLogList(getPlayer()); getQuest().sendNpcLogList(getPlayer());
@@ -686,6 +745,7 @@ public class QuestState
{ {
return; return;
} }
exitQuest(type); exitQuest(type);
if (playExitQuest) if (playExitQuest)
{ {
@@ -776,7 +836,7 @@ public class QuestState
} }
reDo.set(Calendar.HOUR_OF_DAY, getQuest().getResetHour()); reDo.set(Calendar.HOUR_OF_DAY, getQuest().getResetHour());
reDo.set(Calendar.MINUTE, getQuest().getResetMinutes()); reDo.set(Calendar.MINUTE, getQuest().getResetMinutes());
set("restartTime", String.valueOf(reDo.getTimeInMillis())); set(RESTART_VAR, String.valueOf(reDo.getTimeInMillis()));
} }
/** /**
@@ -785,7 +845,7 @@ public class QuestState
*/ */
public boolean isNowAvailable() public boolean isNowAvailable()
{ {
final String val = get("restartTime"); final String val = get(RESTART_VAR);
return (val != null) && (Long.parseLong(val) <= Chronos.currentTimeMillis()); return (val != null) && (Long.parseLong(val) <= Chronos.currentTimeMillis());
} }

View File

@@ -58,7 +58,7 @@ public class QuestList implements IClientOutgoingPacket
for (QuestState qs : _activeQuests) for (QuestState qs : _activeQuests)
{ {
packet.writeD(qs.getQuest().getId()); packet.writeD(qs.getQuest().getId());
packet.writeD(qs.getCond()); packet.writeD(qs.getCondBitSet());
} }
packet.writeB(_oneTimeQuestMask); packet.writeB(_oneTimeQuestMask);
return true; return true;

View File

@@ -336,7 +336,7 @@ public class AdminShowQuests implements IAdminCommandHandler
{ {
qs = QuestManager.getInstance().getQuest(Integer.parseInt(val[0])).newQuestState(target); qs = QuestManager.getInstance().getQuest(Integer.parseInt(val[0])).newQuestState(target);
qs.setState(State.STARTED); qs.setState(State.STARTED);
qs.set("cond", "1"); qs.setCond(1);
target.sendPacket(new QuestList(target)); target.sendPacket(new QuestList(target));
target.sendPacket(new ExShowQuestMark(qs.getQuest().getId(), qs.getCond())); target.sendPacket(new ExShowQuestMark(qs.getQuest().getId(), qs.getCond()));
val[0] = qs.getQuest().getName(); val[0] = qs.getQuest().getName();

View File

@@ -40,6 +40,12 @@ public class QuestState
{ {
protected static final Logger LOGGER = Logger.getLogger(QuestState.class.getName()); protected static final Logger LOGGER = Logger.getLogger(QuestState.class.getName());
// Constants
private static final String COND_VAR = "cond";
private static final String RESTART_VAR = "restartTime";
private static final String MEMO_VAR = "memoState";
private static final String MEMO_EX_VAR = "memoStateEx";
/** The name of the quest of this QuestState */ /** The name of the quest of this QuestState */
private final String _questName; private final String _questName;
@@ -49,6 +55,9 @@ public class QuestState
/** The current state of the quest */ /** The current state of the quest */
private byte _state; private byte _state;
/** The current condition of the quest */
private int _cond = 0;
/** Used for simulating Quest onTalk */ /** Used for simulating Quest onTalk */
private boolean _simulated = false; private boolean _simulated = false;
@@ -156,10 +165,12 @@ public class QuestState
{ {
return; return;
} }
if (_state == state) if (_state == state)
{ {
return; return;
} }
final boolean newQuest = isCreated(); final boolean newQuest = isCreated();
_state = state; _state = state;
if (saveInDb) if (saveInDb)
@@ -179,10 +190,10 @@ public class QuestState
/** /**
* Add parameter used in quests. * Add parameter used in quests.
* @param var String pointing out the name of the variable for quest * @param variable String pointing out the name of the variable for quest
* @param value String pointing out the value of the variable for quest * @param value String pointing out the value of the variable for quest
*/ */
public void setInternal(String var, String value) public void setInternal(String variable, String value)
{ {
if (_simulated) if (_simulated)
{ {
@@ -196,20 +207,32 @@ public class QuestState
if (value == null) if (value == null)
{ {
_vars.put(var, ""); _vars.put(variable, "");
return; return;
} }
_vars.put(var, value); if (COND_VAR.equals(variable))
{
try
{
_cond = Integer.parseInt(value);
}
catch (Exception ignored)
{
}
} }
public void set(String var, int value) _vars.put(variable, value);
}
public void set(String variable, int value)
{ {
if (_simulated) if (_simulated)
{ {
return; return;
} }
set(var, Integer.toString(value));
set(variable, Integer.toString(value));
} }
/** /**
@@ -223,10 +246,10 @@ public class QuestState
* The key is known as existing if the preceding value of the key (given as result of function put()) is not null.<br> * The key is known as existing if the preceding value of the key (given as result of function put()) is not null.<br>
* If the key doesn't exist, the couple is added/created in the database</li> * If the key doesn't exist, the couple is added/created in the database</li>
* <ul> * <ul>
* @param var String indicating the name of the variable for quest * @param variable String indicating the name of the variable for quest
* @param val String indicating the value of the variable for quest * @param value String indicating the value of the variable for quest
*/ */
public void set(String var, String val) public void set(String variable, String value)
{ {
if (_simulated) if (_simulated)
{ {
@@ -238,23 +261,23 @@ public class QuestState
_vars = new HashMap<>(); _vars = new HashMap<>();
} }
String value = val; String newValue = value;
if (value == null) if (newValue == null)
{ {
value = ""; newValue = "";
} }
final String old = _vars.put(var, value); final String old = _vars.put(variable, newValue);
if (old != null) if (old != null)
{ {
Quest.updateQuestVarInDb(this, var, value); Quest.updateQuestVarInDb(this, variable, newValue);
} }
else else
{ {
Quest.createQuestVarInDb(this, var, value); Quest.createQuestVarInDb(this, variable, newValue);
} }
if ("cond".equals(var)) if (COND_VAR.equals(variable))
{ {
try try
{ {
@@ -263,16 +286,25 @@ public class QuestState
{ {
previousVal = Integer.parseInt(old); previousVal = Integer.parseInt(old);
} }
catch (Exception ex) catch (Exception ignored)
{ {
previousVal = 0;
} }
setCond(Integer.parseInt(value), previousVal); int newCond = 0;
try
{
newCond = Integer.parseInt(newValue);
}
catch (Exception ignored)
{
}
_cond = newCond;
setCond(newCond, previousVal);
getQuest().sendNpcLogList(getPlayer()); getQuest().sendNpcLogList(getPlayer());
} }
catch (Exception e) catch (Exception e)
{ {
LOGGER.log(Level.WARNING, _player.getName() + ", " + _questName + " cond [" + value + "] is not an integer. Value stored, but no packet was sent: " + e.getMessage(), e); LOGGER.log(Level.WARNING, _player.getName() + ", " + _questName + " cond [" + newValue + "] is not an integer. Value stored, but no packet was sent: " + e.getMessage(), e);
} }
} }
} }
@@ -373,9 +405,9 @@ public class QuestState
/** /**
* Removes a quest variable from the list of existing quest variables. * Removes a quest variable from the list of existing quest variables.
* @param var the name of the variable to remove * @param variable the name of the variable to remove
*/ */
public void unset(String var) public void unset(String variable)
{ {
if (_simulated) if (_simulated)
{ {
@@ -387,54 +419,60 @@ public class QuestState
return; return;
} }
final String old = _vars.remove(var); final String old = _vars.remove(variable);
if (old != null) if (old != null)
{ {
Quest.deleteQuestVarInDb(this, var); if (COND_VAR.equals(variable))
{
_cond = 0;
}
Quest.deleteQuestVarInDb(this, variable);
} }
} }
/** /**
* @param var the name of the variable to get * @param variable the name of the variable to get
* @return the value of the variable from the list of quest variables * @return the value of the variable from the list of quest variables
*/ */
public String get(String var) public String get(String variable)
{ {
if (_vars == null) if (_vars == null)
{ {
return null; return null;
} }
return _vars.get(var);
return _vars.get(variable);
} }
/** /**
* @param var the name of the variable to get * @param variable the name of the variable to get
* @return the integer value of the variable or 0 if the variable does not exist or its value is not an integer * @return the integer value of the variable or 0 if the variable does not exist or its value is not an integer
*/ */
public int getInt(String var) public int getInt(String variable)
{ {
if (_vars == null) if (_vars == null)
{ {
return 0; return 0;
} }
final String variable = _vars.get(var); final String varStr = _vars.get(variable);
if ((variable == null) || variable.isEmpty()) if ((varStr == null) || varStr.isEmpty())
{ {
return 0; return 0;
} }
int varint = 0; int varInt = 0;
try try
{ {
varint = Integer.parseInt(variable); varInt = Integer.parseInt(varStr);
} }
catch (NumberFormatException nfe) catch (NumberFormatException nfe)
{ {
LOGGER.log(Level.INFO, "Quest " + _questName + ", method getInt(" + var + "), tried to parse a non-integer value (" + variable + "). Char Id: " + _player.getObjectId(), nfe); LOGGER.log(Level.INFO, "Quest " + _questName + ", method getInt(" + variable + "), tried to parse a non-integer value (" + varStr + "). Char Id: " + _player.getObjectId(), nfe);
} }
return varint; return varInt;
} }
/** /**
@@ -445,7 +483,7 @@ public class QuestState
*/ */
public boolean isCond(int condition) public boolean isCond(int condition)
{ {
return getInt("cond") == condition; return _cond == condition;
} }
/** /**
@@ -463,7 +501,7 @@ public class QuestState
if (isStarted()) if (isStarted())
{ {
set("cond", Integer.toString(value)); set(COND_VAR, Integer.toString(value));
} }
} }
@@ -474,7 +512,21 @@ public class QuestState
{ {
if (isStarted()) if (isStarted())
{ {
int val = getInt("cond"); return _cond;
}
return 0;
}
/**
* Get bit set representing completed conds.
* @return if none cond is set {@code 0}, otherwise cond bit set.
*/
public int getCondBitSet()
{
if (isStarted())
{
int val = getInt(COND_VAR);
if ((val & 0x80000000) != 0) if ((val & 0x80000000) != 0)
{ {
val &= 0x7fffffff; val &= 0x7fffffff;
@@ -524,7 +576,8 @@ public class QuestState
{ {
return; return;
} }
set("cond", String.valueOf(value));
set(COND_VAR, String.valueOf(value));
if (playQuestMiddle) if (playQuestMiddle)
{ {
_player.sendPacket(QuestSound.ITEMSOUND_QUEST_MIDDLE.getPacket()); _player.sendPacket(QuestSound.ITEMSOUND_QUEST_MIDDLE.getPacket());
@@ -537,7 +590,8 @@ public class QuestState
{ {
return; return;
} }
set("memoState", String.valueOf(value));
set(MEMO_VAR, String.valueOf(value));
} }
/** /**
@@ -547,14 +601,15 @@ public class QuestState
{ {
if (isStarted()) if (isStarted())
{ {
return getInt("memoState"); return getInt(MEMO_VAR);
} }
return 0; return 0;
} }
public boolean isMemoState(int memoState) public boolean isMemoState(int memoState)
{ {
return getInt("memoState") == memoState; return getInt(MEMO_VAR) == memoState;
} }
/** /**
@@ -566,8 +621,9 @@ public class QuestState
{ {
if (isStarted()) if (isStarted())
{ {
return getInt("memoStateEx" + slot); return getInt(MEMO_EX_VAR + slot);
} }
return 0; return 0;
} }
@@ -582,7 +638,8 @@ public class QuestState
{ {
return; return;
} }
set("memoStateEx" + slot, String.valueOf(value));
set(MEMO_EX_VAR + slot, String.valueOf(value));
} }
/** /**
@@ -613,6 +670,7 @@ public class QuestState
{ {
return; return;
} }
_isExitQuestOnCleanUp = isExitQuestOnCleanUp; _isExitQuestOnCleanUp = isExitQuestOnCleanUp;
} }
@@ -626,9 +684,10 @@ public class QuestState
{ {
return; return;
} }
if (isCreated() && !getQuest().isCustomQuest()) if (isCreated() && !getQuest().isCustomQuest())
{ {
set("cond", "1"); set(COND_VAR, "1");
setState(State.STARTED); setState(State.STARTED);
_player.sendPacket(QuestSound.ITEMSOUND_QUEST_ACCEPT.getPacket()); _player.sendPacket(QuestSound.ITEMSOUND_QUEST_ACCEPT.getPacket());
getQuest().sendNpcLogList(getPlayer()); getQuest().sendNpcLogList(getPlayer());
@@ -686,6 +745,7 @@ public class QuestState
{ {
return; return;
} }
exitQuest(type); exitQuest(type);
if (playExitQuest) if (playExitQuest)
{ {
@@ -776,7 +836,7 @@ public class QuestState
} }
reDo.set(Calendar.HOUR_OF_DAY, getQuest().getResetHour()); reDo.set(Calendar.HOUR_OF_DAY, getQuest().getResetHour());
reDo.set(Calendar.MINUTE, getQuest().getResetMinutes()); reDo.set(Calendar.MINUTE, getQuest().getResetMinutes());
set("restartTime", String.valueOf(reDo.getTimeInMillis())); set(RESTART_VAR, String.valueOf(reDo.getTimeInMillis()));
} }
/** /**
@@ -785,7 +845,7 @@ public class QuestState
*/ */
public boolean isNowAvailable() public boolean isNowAvailable()
{ {
final String val = get("restartTime"); final String val = get(RESTART_VAR);
return (val != null) && (Long.parseLong(val) <= Chronos.currentTimeMillis()); return (val != null) && (Long.parseLong(val) <= Chronos.currentTimeMillis());
} }

View File

@@ -58,7 +58,7 @@ public class QuestList implements IClientOutgoingPacket
for (QuestState qs : _activeQuests) for (QuestState qs : _activeQuests)
{ {
packet.writeD(qs.getQuest().getId()); packet.writeD(qs.getQuest().getId());
packet.writeD(qs.getCond()); packet.writeD(qs.getCondBitSet());
} }
packet.writeB(_oneTimeQuestMask); packet.writeB(_oneTimeQuestMask);
return true; return true;

View File

@@ -336,7 +336,7 @@ public class AdminShowQuests implements IAdminCommandHandler
{ {
qs = QuestManager.getInstance().getQuest(Integer.parseInt(val[0])).newQuestState(target); qs = QuestManager.getInstance().getQuest(Integer.parseInt(val[0])).newQuestState(target);
qs.setState(State.STARTED); qs.setState(State.STARTED);
qs.set("cond", "1"); qs.setCond(1);
target.sendPacket(new QuestList(target)); target.sendPacket(new QuestList(target));
target.sendPacket(new ExShowQuestMark(qs.getQuest().getId(), qs.getCond())); target.sendPacket(new ExShowQuestMark(qs.getQuest().getId(), qs.getCond()));
val[0] = qs.getQuest().getName(); val[0] = qs.getQuest().getName();

View File

@@ -40,6 +40,12 @@ public class QuestState
{ {
protected static final Logger LOGGER = Logger.getLogger(QuestState.class.getName()); protected static final Logger LOGGER = Logger.getLogger(QuestState.class.getName());
// Constants
private static final String COND_VAR = "cond";
private static final String RESTART_VAR = "restartTime";
private static final String MEMO_VAR = "memoState";
private static final String MEMO_EX_VAR = "memoStateEx";
/** The name of the quest of this QuestState */ /** The name of the quest of this QuestState */
private final String _questName; private final String _questName;
@@ -49,6 +55,9 @@ public class QuestState
/** The current state of the quest */ /** The current state of the quest */
private byte _state; private byte _state;
/** The current condition of the quest */
private int _cond = 0;
/** Used for simulating Quest onTalk */ /** Used for simulating Quest onTalk */
private boolean _simulated = false; private boolean _simulated = false;
@@ -156,10 +165,12 @@ public class QuestState
{ {
return; return;
} }
if (_state == state) if (_state == state)
{ {
return; return;
} }
final boolean newQuest = isCreated(); final boolean newQuest = isCreated();
_state = state; _state = state;
if (saveInDb) if (saveInDb)
@@ -179,10 +190,10 @@ public class QuestState
/** /**
* Add parameter used in quests. * Add parameter used in quests.
* @param var String pointing out the name of the variable for quest * @param variable String pointing out the name of the variable for quest
* @param value String pointing out the value of the variable for quest * @param value String pointing out the value of the variable for quest
*/ */
public void setInternal(String var, String value) public void setInternal(String variable, String value)
{ {
if (_simulated) if (_simulated)
{ {
@@ -196,20 +207,32 @@ public class QuestState
if (value == null) if (value == null)
{ {
_vars.put(var, ""); _vars.put(variable, "");
return; return;
} }
_vars.put(var, value); if (COND_VAR.equals(variable))
{
try
{
_cond = Integer.parseInt(value);
}
catch (Exception ignored)
{
}
} }
public void set(String var, int value) _vars.put(variable, value);
}
public void set(String variable, int value)
{ {
if (_simulated) if (_simulated)
{ {
return; return;
} }
set(var, Integer.toString(value));
set(variable, Integer.toString(value));
} }
/** /**
@@ -223,10 +246,10 @@ public class QuestState
* The key is known as existing if the preceding value of the key (given as result of function put()) is not null.<br> * The key is known as existing if the preceding value of the key (given as result of function put()) is not null.<br>
* If the key doesn't exist, the couple is added/created in the database</li> * If the key doesn't exist, the couple is added/created in the database</li>
* <ul> * <ul>
* @param var String indicating the name of the variable for quest * @param variable String indicating the name of the variable for quest
* @param val String indicating the value of the variable for quest * @param value String indicating the value of the variable for quest
*/ */
public void set(String var, String val) public void set(String variable, String value)
{ {
if (_simulated) if (_simulated)
{ {
@@ -238,23 +261,23 @@ public class QuestState
_vars = new HashMap<>(); _vars = new HashMap<>();
} }
String value = val; String newValue = value;
if (value == null) if (newValue == null)
{ {
value = ""; newValue = "";
} }
final String old = _vars.put(var, value); final String old = _vars.put(variable, newValue);
if (old != null) if (old != null)
{ {
Quest.updateQuestVarInDb(this, var, value); Quest.updateQuestVarInDb(this, variable, newValue);
} }
else else
{ {
Quest.createQuestVarInDb(this, var, value); Quest.createQuestVarInDb(this, variable, newValue);
} }
if ("cond".equals(var)) if (COND_VAR.equals(variable))
{ {
try try
{ {
@@ -263,16 +286,25 @@ public class QuestState
{ {
previousVal = Integer.parseInt(old); previousVal = Integer.parseInt(old);
} }
catch (Exception ex) catch (Exception ignored)
{ {
previousVal = 0;
} }
setCond(Integer.parseInt(value), previousVal); int newCond = 0;
try
{
newCond = Integer.parseInt(newValue);
}
catch (Exception ignored)
{
}
_cond = newCond;
setCond(newCond, previousVal);
getQuest().sendNpcLogList(getPlayer()); getQuest().sendNpcLogList(getPlayer());
} }
catch (Exception e) catch (Exception e)
{ {
LOGGER.log(Level.WARNING, _player.getName() + ", " + _questName + " cond [" + value + "] is not an integer. Value stored, but no packet was sent: " + e.getMessage(), e); LOGGER.log(Level.WARNING, _player.getName() + ", " + _questName + " cond [" + newValue + "] is not an integer. Value stored, but no packet was sent: " + e.getMessage(), e);
} }
} }
} }
@@ -373,9 +405,9 @@ public class QuestState
/** /**
* Removes a quest variable from the list of existing quest variables. * Removes a quest variable from the list of existing quest variables.
* @param var the name of the variable to remove * @param variable the name of the variable to remove
*/ */
public void unset(String var) public void unset(String variable)
{ {
if (_simulated) if (_simulated)
{ {
@@ -387,54 +419,60 @@ public class QuestState
return; return;
} }
final String old = _vars.remove(var); final String old = _vars.remove(variable);
if (old != null) if (old != null)
{ {
Quest.deleteQuestVarInDb(this, var); if (COND_VAR.equals(variable))
{
_cond = 0;
}
Quest.deleteQuestVarInDb(this, variable);
} }
} }
/** /**
* @param var the name of the variable to get * @param variable the name of the variable to get
* @return the value of the variable from the list of quest variables * @return the value of the variable from the list of quest variables
*/ */
public String get(String var) public String get(String variable)
{ {
if (_vars == null) if (_vars == null)
{ {
return null; return null;
} }
return _vars.get(var);
return _vars.get(variable);
} }
/** /**
* @param var the name of the variable to get * @param variable the name of the variable to get
* @return the integer value of the variable or 0 if the variable does not exist or its value is not an integer * @return the integer value of the variable or 0 if the variable does not exist or its value is not an integer
*/ */
public int getInt(String var) public int getInt(String variable)
{ {
if (_vars == null) if (_vars == null)
{ {
return 0; return 0;
} }
final String variable = _vars.get(var); final String varStr = _vars.get(variable);
if ((variable == null) || variable.isEmpty()) if ((varStr == null) || varStr.isEmpty())
{ {
return 0; return 0;
} }
int varint = 0; int varInt = 0;
try try
{ {
varint = Integer.parseInt(variable); varInt = Integer.parseInt(varStr);
} }
catch (NumberFormatException nfe) catch (NumberFormatException nfe)
{ {
LOGGER.log(Level.INFO, "Quest " + _questName + ", method getInt(" + var + "), tried to parse a non-integer value (" + variable + "). Char Id: " + _player.getObjectId(), nfe); LOGGER.log(Level.INFO, "Quest " + _questName + ", method getInt(" + variable + "), tried to parse a non-integer value (" + varStr + "). Char Id: " + _player.getObjectId(), nfe);
} }
return varint; return varInt;
} }
/** /**
@@ -445,7 +483,7 @@ public class QuestState
*/ */
public boolean isCond(int condition) public boolean isCond(int condition)
{ {
return getInt("cond") == condition; return _cond == condition;
} }
/** /**
@@ -463,7 +501,7 @@ public class QuestState
if (isStarted()) if (isStarted())
{ {
set("cond", Integer.toString(value)); set(COND_VAR, Integer.toString(value));
} }
} }
@@ -474,7 +512,21 @@ public class QuestState
{ {
if (isStarted()) if (isStarted())
{ {
int val = getInt("cond"); return _cond;
}
return 0;
}
/**
* Get bit set representing completed conds.
* @return if none cond is set {@code 0}, otherwise cond bit set.
*/
public int getCondBitSet()
{
if (isStarted())
{
int val = getInt(COND_VAR);
if ((val & 0x80000000) != 0) if ((val & 0x80000000) != 0)
{ {
val &= 0x7fffffff; val &= 0x7fffffff;
@@ -524,7 +576,8 @@ public class QuestState
{ {
return; return;
} }
set("cond", String.valueOf(value));
set(COND_VAR, String.valueOf(value));
if (playQuestMiddle) if (playQuestMiddle)
{ {
_player.sendPacket(QuestSound.ITEMSOUND_QUEST_MIDDLE.getPacket()); _player.sendPacket(QuestSound.ITEMSOUND_QUEST_MIDDLE.getPacket());
@@ -537,7 +590,8 @@ public class QuestState
{ {
return; return;
} }
set("memoState", String.valueOf(value));
set(MEMO_VAR, String.valueOf(value));
} }
/** /**
@@ -547,14 +601,15 @@ public class QuestState
{ {
if (isStarted()) if (isStarted())
{ {
return getInt("memoState"); return getInt(MEMO_VAR);
} }
return 0; return 0;
} }
public boolean isMemoState(int memoState) public boolean isMemoState(int memoState)
{ {
return getInt("memoState") == memoState; return getInt(MEMO_VAR) == memoState;
} }
/** /**
@@ -566,8 +621,9 @@ public class QuestState
{ {
if (isStarted()) if (isStarted())
{ {
return getInt("memoStateEx" + slot); return getInt(MEMO_EX_VAR + slot);
} }
return 0; return 0;
} }
@@ -582,7 +638,8 @@ public class QuestState
{ {
return; return;
} }
set("memoStateEx" + slot, String.valueOf(value));
set(MEMO_EX_VAR + slot, String.valueOf(value));
} }
/** /**
@@ -613,6 +670,7 @@ public class QuestState
{ {
return; return;
} }
_isExitQuestOnCleanUp = isExitQuestOnCleanUp; _isExitQuestOnCleanUp = isExitQuestOnCleanUp;
} }
@@ -626,9 +684,10 @@ public class QuestState
{ {
return; return;
} }
if (isCreated() && !getQuest().isCustomQuest()) if (isCreated() && !getQuest().isCustomQuest())
{ {
set("cond", "1"); set(COND_VAR, "1");
setState(State.STARTED); setState(State.STARTED);
_player.sendPacket(QuestSound.ITEMSOUND_QUEST_ACCEPT.getPacket()); _player.sendPacket(QuestSound.ITEMSOUND_QUEST_ACCEPT.getPacket());
getQuest().sendNpcLogList(getPlayer()); getQuest().sendNpcLogList(getPlayer());
@@ -686,6 +745,7 @@ public class QuestState
{ {
return; return;
} }
exitQuest(type); exitQuest(type);
if (playExitQuest) if (playExitQuest)
{ {
@@ -776,7 +836,7 @@ public class QuestState
} }
reDo.set(Calendar.HOUR_OF_DAY, getQuest().getResetHour()); reDo.set(Calendar.HOUR_OF_DAY, getQuest().getResetHour());
reDo.set(Calendar.MINUTE, getQuest().getResetMinutes()); reDo.set(Calendar.MINUTE, getQuest().getResetMinutes());
set("restartTime", String.valueOf(reDo.getTimeInMillis())); set(RESTART_VAR, String.valueOf(reDo.getTimeInMillis()));
} }
/** /**
@@ -785,7 +845,7 @@ public class QuestState
*/ */
public boolean isNowAvailable() public boolean isNowAvailable()
{ {
final String val = get("restartTime"); final String val = get(RESTART_VAR);
return (val != null) && (Long.parseLong(val) <= Chronos.currentTimeMillis()); return (val != null) && (Long.parseLong(val) <= Chronos.currentTimeMillis());
} }

View File

@@ -58,7 +58,7 @@ public class QuestList implements IClientOutgoingPacket
for (QuestState qs : _activeQuests) for (QuestState qs : _activeQuests)
{ {
packet.writeD(qs.getQuest().getId()); packet.writeD(qs.getQuest().getId());
packet.writeD(qs.getCond()); packet.writeD(qs.getCondBitSet());
} }
packet.writeB(_oneTimeQuestMask); packet.writeB(_oneTimeQuestMask);
return true; return true;

View File

@@ -336,7 +336,7 @@ public class AdminShowQuests implements IAdminCommandHandler
{ {
qs = QuestManager.getInstance().getQuest(Integer.parseInt(val[0])).newQuestState(target); qs = QuestManager.getInstance().getQuest(Integer.parseInt(val[0])).newQuestState(target);
qs.setState(State.STARTED); qs.setState(State.STARTED);
qs.set("cond", "1"); qs.setCond(1);
target.sendPacket(new QuestList(target)); target.sendPacket(new QuestList(target));
target.sendPacket(new ExShowQuestMark(qs.getQuest().getId(), qs.getCond())); target.sendPacket(new ExShowQuestMark(qs.getQuest().getId(), qs.getCond()));
val[0] = qs.getQuest().getName(); val[0] = qs.getQuest().getName();

View File

@@ -40,6 +40,12 @@ public class QuestState
{ {
protected static final Logger LOGGER = Logger.getLogger(QuestState.class.getName()); protected static final Logger LOGGER = Logger.getLogger(QuestState.class.getName());
// Constants
private static final String COND_VAR = "cond";
private static final String RESTART_VAR = "restartTime";
private static final String MEMO_VAR = "memoState";
private static final String MEMO_EX_VAR = "memoStateEx";
/** The name of the quest of this QuestState */ /** The name of the quest of this QuestState */
private final String _questName; private final String _questName;
@@ -49,6 +55,9 @@ public class QuestState
/** The current state of the quest */ /** The current state of the quest */
private byte _state; private byte _state;
/** The current condition of the quest */
private int _cond = 0;
/** Used for simulating Quest onTalk */ /** Used for simulating Quest onTalk */
private boolean _simulated = false; private boolean _simulated = false;
@@ -156,10 +165,12 @@ public class QuestState
{ {
return; return;
} }
if (_state == state) if (_state == state)
{ {
return; return;
} }
final boolean newQuest = isCreated(); final boolean newQuest = isCreated();
_state = state; _state = state;
if (saveInDb) if (saveInDb)
@@ -179,10 +190,10 @@ public class QuestState
/** /**
* Add parameter used in quests. * Add parameter used in quests.
* @param var String pointing out the name of the variable for quest * @param variable String pointing out the name of the variable for quest
* @param value String pointing out the value of the variable for quest * @param value String pointing out the value of the variable for quest
*/ */
public void setInternal(String var, String value) public void setInternal(String variable, String value)
{ {
if (_simulated) if (_simulated)
{ {
@@ -196,20 +207,32 @@ public class QuestState
if (value == null) if (value == null)
{ {
_vars.put(var, ""); _vars.put(variable, "");
return; return;
} }
_vars.put(var, value); if (COND_VAR.equals(variable))
{
try
{
_cond = Integer.parseInt(value);
}
catch (Exception ignored)
{
}
} }
public void set(String var, int value) _vars.put(variable, value);
}
public void set(String variable, int value)
{ {
if (_simulated) if (_simulated)
{ {
return; return;
} }
set(var, Integer.toString(value));
set(variable, Integer.toString(value));
} }
/** /**
@@ -223,10 +246,10 @@ public class QuestState
* The key is known as existing if the preceding value of the key (given as result of function put()) is not null.<br> * The key is known as existing if the preceding value of the key (given as result of function put()) is not null.<br>
* If the key doesn't exist, the couple is added/created in the database</li> * If the key doesn't exist, the couple is added/created in the database</li>
* <ul> * <ul>
* @param var String indicating the name of the variable for quest * @param variable String indicating the name of the variable for quest
* @param val String indicating the value of the variable for quest * @param value String indicating the value of the variable for quest
*/ */
public void set(String var, String val) public void set(String variable, String value)
{ {
if (_simulated) if (_simulated)
{ {
@@ -238,23 +261,23 @@ public class QuestState
_vars = new HashMap<>(); _vars = new HashMap<>();
} }
String value = val; String newValue = value;
if (value == null) if (newValue == null)
{ {
value = ""; newValue = "";
} }
final String old = _vars.put(var, value); final String old = _vars.put(variable, newValue);
if (old != null) if (old != null)
{ {
Quest.updateQuestVarInDb(this, var, value); Quest.updateQuestVarInDb(this, variable, newValue);
} }
else else
{ {
Quest.createQuestVarInDb(this, var, value); Quest.createQuestVarInDb(this, variable, newValue);
} }
if ("cond".equals(var)) if (COND_VAR.equals(variable))
{ {
try try
{ {
@@ -263,16 +286,25 @@ public class QuestState
{ {
previousVal = Integer.parseInt(old); previousVal = Integer.parseInt(old);
} }
catch (Exception ex) catch (Exception ignored)
{ {
previousVal = 0;
} }
setCond(Integer.parseInt(value), previousVal); int newCond = 0;
try
{
newCond = Integer.parseInt(newValue);
}
catch (Exception ignored)
{
}
_cond = newCond;
setCond(newCond, previousVal);
getQuest().sendNpcLogList(getPlayer()); getQuest().sendNpcLogList(getPlayer());
} }
catch (Exception e) catch (Exception e)
{ {
LOGGER.log(Level.WARNING, _player.getName() + ", " + _questName + " cond [" + value + "] is not an integer. Value stored, but no packet was sent: " + e.getMessage(), e); LOGGER.log(Level.WARNING, _player.getName() + ", " + _questName + " cond [" + newValue + "] is not an integer. Value stored, but no packet was sent: " + e.getMessage(), e);
} }
} }
} }
@@ -373,9 +405,9 @@ public class QuestState
/** /**
* Removes a quest variable from the list of existing quest variables. * Removes a quest variable from the list of existing quest variables.
* @param var the name of the variable to remove * @param variable the name of the variable to remove
*/ */
public void unset(String var) public void unset(String variable)
{ {
if (_simulated) if (_simulated)
{ {
@@ -387,54 +419,60 @@ public class QuestState
return; return;
} }
final String old = _vars.remove(var); final String old = _vars.remove(variable);
if (old != null) if (old != null)
{ {
Quest.deleteQuestVarInDb(this, var); if (COND_VAR.equals(variable))
{
_cond = 0;
}
Quest.deleteQuestVarInDb(this, variable);
} }
} }
/** /**
* @param var the name of the variable to get * @param variable the name of the variable to get
* @return the value of the variable from the list of quest variables * @return the value of the variable from the list of quest variables
*/ */
public String get(String var) public String get(String variable)
{ {
if (_vars == null) if (_vars == null)
{ {
return null; return null;
} }
return _vars.get(var);
return _vars.get(variable);
} }
/** /**
* @param var the name of the variable to get * @param variable the name of the variable to get
* @return the integer value of the variable or 0 if the variable does not exist or its value is not an integer * @return the integer value of the variable or 0 if the variable does not exist or its value is not an integer
*/ */
public int getInt(String var) public int getInt(String variable)
{ {
if (_vars == null) if (_vars == null)
{ {
return 0; return 0;
} }
final String variable = _vars.get(var); final String varStr = _vars.get(variable);
if ((variable == null) || variable.isEmpty()) if ((varStr == null) || varStr.isEmpty())
{ {
return 0; return 0;
} }
int varint = 0; int varInt = 0;
try try
{ {
varint = Integer.parseInt(variable); varInt = Integer.parseInt(varStr);
} }
catch (NumberFormatException nfe) catch (NumberFormatException nfe)
{ {
LOGGER.log(Level.INFO, "Quest " + _questName + ", method getInt(" + var + "), tried to parse a non-integer value (" + variable + "). Char Id: " + _player.getObjectId(), nfe); LOGGER.log(Level.INFO, "Quest " + _questName + ", method getInt(" + variable + "), tried to parse a non-integer value (" + varStr + "). Char Id: " + _player.getObjectId(), nfe);
} }
return varint; return varInt;
} }
/** /**
@@ -445,7 +483,7 @@ public class QuestState
*/ */
public boolean isCond(int condition) public boolean isCond(int condition)
{ {
return getInt("cond") == condition; return _cond == condition;
} }
/** /**
@@ -463,7 +501,7 @@ public class QuestState
if (isStarted()) if (isStarted())
{ {
set("cond", Integer.toString(value)); set(COND_VAR, Integer.toString(value));
} }
} }
@@ -474,7 +512,21 @@ public class QuestState
{ {
if (isStarted()) if (isStarted())
{ {
int val = getInt("cond"); return _cond;
}
return 0;
}
/**
* Get bit set representing completed conds.
* @return if none cond is set {@code 0}, otherwise cond bit set.
*/
public int getCondBitSet()
{
if (isStarted())
{
int val = getInt(COND_VAR);
if ((val & 0x80000000) != 0) if ((val & 0x80000000) != 0)
{ {
val &= 0x7fffffff; val &= 0x7fffffff;
@@ -524,7 +576,8 @@ public class QuestState
{ {
return; return;
} }
set("cond", String.valueOf(value));
set(COND_VAR, String.valueOf(value));
if (playQuestMiddle) if (playQuestMiddle)
{ {
_player.sendPacket(QuestSound.ITEMSOUND_QUEST_MIDDLE.getPacket()); _player.sendPacket(QuestSound.ITEMSOUND_QUEST_MIDDLE.getPacket());
@@ -537,7 +590,8 @@ public class QuestState
{ {
return; return;
} }
set("memoState", String.valueOf(value));
set(MEMO_VAR, String.valueOf(value));
} }
/** /**
@@ -547,14 +601,15 @@ public class QuestState
{ {
if (isStarted()) if (isStarted())
{ {
return getInt("memoState"); return getInt(MEMO_VAR);
} }
return 0; return 0;
} }
public boolean isMemoState(int memoState) public boolean isMemoState(int memoState)
{ {
return getInt("memoState") == memoState; return getInt(MEMO_VAR) == memoState;
} }
/** /**
@@ -566,8 +621,9 @@ public class QuestState
{ {
if (isStarted()) if (isStarted())
{ {
return getInt("memoStateEx" + slot); return getInt(MEMO_EX_VAR + slot);
} }
return 0; return 0;
} }
@@ -582,7 +638,8 @@ public class QuestState
{ {
return; return;
} }
set("memoStateEx" + slot, String.valueOf(value));
set(MEMO_EX_VAR + slot, String.valueOf(value));
} }
/** /**
@@ -613,6 +670,7 @@ public class QuestState
{ {
return; return;
} }
_isExitQuestOnCleanUp = isExitQuestOnCleanUp; _isExitQuestOnCleanUp = isExitQuestOnCleanUp;
} }
@@ -626,9 +684,10 @@ public class QuestState
{ {
return; return;
} }
if (isCreated() && !getQuest().isCustomQuest()) if (isCreated() && !getQuest().isCustomQuest())
{ {
set("cond", "1"); set(COND_VAR, "1");
setState(State.STARTED); setState(State.STARTED);
_player.sendPacket(QuestSound.ITEMSOUND_QUEST_ACCEPT.getPacket()); _player.sendPacket(QuestSound.ITEMSOUND_QUEST_ACCEPT.getPacket());
getQuest().sendNpcLogList(getPlayer()); getQuest().sendNpcLogList(getPlayer());
@@ -686,6 +745,7 @@ public class QuestState
{ {
return; return;
} }
exitQuest(type); exitQuest(type);
if (playExitQuest) if (playExitQuest)
{ {
@@ -776,7 +836,7 @@ public class QuestState
} }
reDo.set(Calendar.HOUR_OF_DAY, getQuest().getResetHour()); reDo.set(Calendar.HOUR_OF_DAY, getQuest().getResetHour());
reDo.set(Calendar.MINUTE, getQuest().getResetMinutes()); reDo.set(Calendar.MINUTE, getQuest().getResetMinutes());
set("restartTime", String.valueOf(reDo.getTimeInMillis())); set(RESTART_VAR, String.valueOf(reDo.getTimeInMillis()));
} }
/** /**
@@ -785,7 +845,7 @@ public class QuestState
*/ */
public boolean isNowAvailable() public boolean isNowAvailable()
{ {
final String val = get("restartTime"); final String val = get(RESTART_VAR);
return (val != null) && (Long.parseLong(val) <= Chronos.currentTimeMillis()); return (val != null) && (Long.parseLong(val) <= Chronos.currentTimeMillis());
} }

View File

@@ -58,7 +58,7 @@ public class QuestList implements IClientOutgoingPacket
for (QuestState qs : _activeQuests) for (QuestState qs : _activeQuests)
{ {
packet.writeD(qs.getQuest().getId()); packet.writeD(qs.getQuest().getId());
packet.writeD(qs.getCond()); packet.writeD(qs.getCondBitSet());
} }
packet.writeB(_oneTimeQuestMask); packet.writeB(_oneTimeQuestMask);
return true; return true;

View File

@@ -336,7 +336,7 @@ public class AdminShowQuests implements IAdminCommandHandler
{ {
qs = QuestManager.getInstance().getQuest(Integer.parseInt(val[0])).newQuestState(target); qs = QuestManager.getInstance().getQuest(Integer.parseInt(val[0])).newQuestState(target);
qs.setState(State.STARTED); qs.setState(State.STARTED);
qs.set("cond", "1"); qs.setCond(1);
target.sendPacket(new QuestList(target)); target.sendPacket(new QuestList(target));
target.sendPacket(new ExShowQuestMark(qs.getQuest().getId(), qs.getCond())); target.sendPacket(new ExShowQuestMark(qs.getQuest().getId(), qs.getCond()));
val[0] = qs.getQuest().getName(); val[0] = qs.getQuest().getName();

View File

@@ -40,6 +40,12 @@ public class QuestState
{ {
protected static final Logger LOGGER = Logger.getLogger(QuestState.class.getName()); protected static final Logger LOGGER = Logger.getLogger(QuestState.class.getName());
// Constants
private static final String COND_VAR = "cond";
private static final String RESTART_VAR = "restartTime";
private static final String MEMO_VAR = "memoState";
private static final String MEMO_EX_VAR = "memoStateEx";
/** The name of the quest of this QuestState */ /** The name of the quest of this QuestState */
private final String _questName; private final String _questName;
@@ -49,6 +55,9 @@ public class QuestState
/** The current state of the quest */ /** The current state of the quest */
private byte _state; private byte _state;
/** The current condition of the quest */
private int _cond = 0;
/** Used for simulating Quest onTalk */ /** Used for simulating Quest onTalk */
private boolean _simulated = false; private boolean _simulated = false;
@@ -156,10 +165,12 @@ public class QuestState
{ {
return; return;
} }
if (_state == state) if (_state == state)
{ {
return; return;
} }
final boolean newQuest = isCreated(); final boolean newQuest = isCreated();
_state = state; _state = state;
if (saveInDb) if (saveInDb)
@@ -179,10 +190,10 @@ public class QuestState
/** /**
* Add parameter used in quests. * Add parameter used in quests.
* @param var String pointing out the name of the variable for quest * @param variable String pointing out the name of the variable for quest
* @param value String pointing out the value of the variable for quest * @param value String pointing out the value of the variable for quest
*/ */
public void setInternal(String var, String value) public void setInternal(String variable, String value)
{ {
if (_simulated) if (_simulated)
{ {
@@ -196,20 +207,32 @@ public class QuestState
if (value == null) if (value == null)
{ {
_vars.put(var, ""); _vars.put(variable, "");
return; return;
} }
_vars.put(var, value); if (COND_VAR.equals(variable))
{
try
{
_cond = Integer.parseInt(value);
}
catch (Exception ignored)
{
}
} }
public void set(String var, int value) _vars.put(variable, value);
}
public void set(String variable, int value)
{ {
if (_simulated) if (_simulated)
{ {
return; return;
} }
set(var, Integer.toString(value));
set(variable, Integer.toString(value));
} }
/** /**
@@ -223,10 +246,10 @@ public class QuestState
* The key is known as existing if the preceding value of the key (given as result of function put()) is not null.<br> * The key is known as existing if the preceding value of the key (given as result of function put()) is not null.<br>
* If the key doesn't exist, the couple is added/created in the database</li> * If the key doesn't exist, the couple is added/created in the database</li>
* <ul> * <ul>
* @param var String indicating the name of the variable for quest * @param variable String indicating the name of the variable for quest
* @param val String indicating the value of the variable for quest * @param value String indicating the value of the variable for quest
*/ */
public void set(String var, String val) public void set(String variable, String value)
{ {
if (_simulated) if (_simulated)
{ {
@@ -238,23 +261,23 @@ public class QuestState
_vars = new HashMap<>(); _vars = new HashMap<>();
} }
String value = val; String newValue = value;
if (value == null) if (newValue == null)
{ {
value = ""; newValue = "";
} }
final String old = _vars.put(var, value); final String old = _vars.put(variable, newValue);
if (old != null) if (old != null)
{ {
Quest.updateQuestVarInDb(this, var, value); Quest.updateQuestVarInDb(this, variable, newValue);
} }
else else
{ {
Quest.createQuestVarInDb(this, var, value); Quest.createQuestVarInDb(this, variable, newValue);
} }
if ("cond".equals(var)) if (COND_VAR.equals(variable))
{ {
try try
{ {
@@ -263,16 +286,25 @@ public class QuestState
{ {
previousVal = Integer.parseInt(old); previousVal = Integer.parseInt(old);
} }
catch (Exception ex) catch (Exception ignored)
{ {
previousVal = 0;
} }
setCond(Integer.parseInt(value), previousVal); int newCond = 0;
try
{
newCond = Integer.parseInt(newValue);
}
catch (Exception ignored)
{
}
_cond = newCond;
setCond(newCond, previousVal);
getQuest().sendNpcLogList(getPlayer()); getQuest().sendNpcLogList(getPlayer());
} }
catch (Exception e) catch (Exception e)
{ {
LOGGER.log(Level.WARNING, _player.getName() + ", " + _questName + " cond [" + value + "] is not an integer. Value stored, but no packet was sent: " + e.getMessage(), e); LOGGER.log(Level.WARNING, _player.getName() + ", " + _questName + " cond [" + newValue + "] is not an integer. Value stored, but no packet was sent: " + e.getMessage(), e);
} }
} }
} }
@@ -373,9 +405,9 @@ public class QuestState
/** /**
* Removes a quest variable from the list of existing quest variables. * Removes a quest variable from the list of existing quest variables.
* @param var the name of the variable to remove * @param variable the name of the variable to remove
*/ */
public void unset(String var) public void unset(String variable)
{ {
if (_simulated) if (_simulated)
{ {
@@ -387,54 +419,60 @@ public class QuestState
return; return;
} }
final String old = _vars.remove(var); final String old = _vars.remove(variable);
if (old != null) if (old != null)
{ {
Quest.deleteQuestVarInDb(this, var); if (COND_VAR.equals(variable))
{
_cond = 0;
}
Quest.deleteQuestVarInDb(this, variable);
} }
} }
/** /**
* @param var the name of the variable to get * @param variable the name of the variable to get
* @return the value of the variable from the list of quest variables * @return the value of the variable from the list of quest variables
*/ */
public String get(String var) public String get(String variable)
{ {
if (_vars == null) if (_vars == null)
{ {
return null; return null;
} }
return _vars.get(var);
return _vars.get(variable);
} }
/** /**
* @param var the name of the variable to get * @param variable the name of the variable to get
* @return the integer value of the variable or 0 if the variable does not exist or its value is not an integer * @return the integer value of the variable or 0 if the variable does not exist or its value is not an integer
*/ */
public int getInt(String var) public int getInt(String variable)
{ {
if (_vars == null) if (_vars == null)
{ {
return 0; return 0;
} }
final String variable = _vars.get(var); final String varStr = _vars.get(variable);
if ((variable == null) || variable.isEmpty()) if ((varStr == null) || varStr.isEmpty())
{ {
return 0; return 0;
} }
int varint = 0; int varInt = 0;
try try
{ {
varint = Integer.parseInt(variable); varInt = Integer.parseInt(varStr);
} }
catch (NumberFormatException nfe) catch (NumberFormatException nfe)
{ {
LOGGER.log(Level.INFO, "Quest " + _questName + ", method getInt(" + var + "), tried to parse a non-integer value (" + variable + "). Char Id: " + _player.getObjectId(), nfe); LOGGER.log(Level.INFO, "Quest " + _questName + ", method getInt(" + variable + "), tried to parse a non-integer value (" + varStr + "). Char Id: " + _player.getObjectId(), nfe);
} }
return varint; return varInt;
} }
/** /**
@@ -445,7 +483,7 @@ public class QuestState
*/ */
public boolean isCond(int condition) public boolean isCond(int condition)
{ {
return getInt("cond") == condition; return _cond == condition;
} }
/** /**
@@ -463,7 +501,7 @@ public class QuestState
if (isStarted()) if (isStarted())
{ {
set("cond", Integer.toString(value)); set(COND_VAR, Integer.toString(value));
} }
} }
@@ -474,7 +512,21 @@ public class QuestState
{ {
if (isStarted()) if (isStarted())
{ {
int val = getInt("cond"); return _cond;
}
return 0;
}
/**
* Get bit set representing completed conds.
* @return if none cond is set {@code 0}, otherwise cond bit set.
*/
public int getCondBitSet()
{
if (isStarted())
{
int val = getInt(COND_VAR);
if ((val & 0x80000000) != 0) if ((val & 0x80000000) != 0)
{ {
val &= 0x7fffffff; val &= 0x7fffffff;
@@ -524,7 +576,8 @@ public class QuestState
{ {
return; return;
} }
set("cond", String.valueOf(value));
set(COND_VAR, String.valueOf(value));
if (playQuestMiddle) if (playQuestMiddle)
{ {
_player.sendPacket(QuestSound.ITEMSOUND_QUEST_MIDDLE.getPacket()); _player.sendPacket(QuestSound.ITEMSOUND_QUEST_MIDDLE.getPacket());
@@ -537,7 +590,8 @@ public class QuestState
{ {
return; return;
} }
set("memoState", String.valueOf(value));
set(MEMO_VAR, String.valueOf(value));
} }
/** /**
@@ -547,14 +601,15 @@ public class QuestState
{ {
if (isStarted()) if (isStarted())
{ {
return getInt("memoState"); return getInt(MEMO_VAR);
} }
return 0; return 0;
} }
public boolean isMemoState(int memoState) public boolean isMemoState(int memoState)
{ {
return getInt("memoState") == memoState; return getInt(MEMO_VAR) == memoState;
} }
/** /**
@@ -566,8 +621,9 @@ public class QuestState
{ {
if (isStarted()) if (isStarted())
{ {
return getInt("memoStateEx" + slot); return getInt(MEMO_EX_VAR + slot);
} }
return 0; return 0;
} }
@@ -582,7 +638,8 @@ public class QuestState
{ {
return; return;
} }
set("memoStateEx" + slot, String.valueOf(value));
set(MEMO_EX_VAR + slot, String.valueOf(value));
} }
/** /**
@@ -613,6 +670,7 @@ public class QuestState
{ {
return; return;
} }
_isExitQuestOnCleanUp = isExitQuestOnCleanUp; _isExitQuestOnCleanUp = isExitQuestOnCleanUp;
} }
@@ -626,9 +684,10 @@ public class QuestState
{ {
return; return;
} }
if (isCreated() && !getQuest().isCustomQuest()) if (isCreated() && !getQuest().isCustomQuest())
{ {
set("cond", "1"); set(COND_VAR, "1");
setState(State.STARTED); setState(State.STARTED);
_player.sendPacket(QuestSound.ITEMSOUND_QUEST_ACCEPT.getPacket()); _player.sendPacket(QuestSound.ITEMSOUND_QUEST_ACCEPT.getPacket());
getQuest().sendNpcLogList(getPlayer()); getQuest().sendNpcLogList(getPlayer());
@@ -686,6 +745,7 @@ public class QuestState
{ {
return; return;
} }
exitQuest(type); exitQuest(type);
if (playExitQuest) if (playExitQuest)
{ {
@@ -776,7 +836,7 @@ public class QuestState
} }
reDo.set(Calendar.HOUR_OF_DAY, getQuest().getResetHour()); reDo.set(Calendar.HOUR_OF_DAY, getQuest().getResetHour());
reDo.set(Calendar.MINUTE, getQuest().getResetMinutes()); reDo.set(Calendar.MINUTE, getQuest().getResetMinutes());
set("restartTime", String.valueOf(reDo.getTimeInMillis())); set(RESTART_VAR, String.valueOf(reDo.getTimeInMillis()));
} }
/** /**
@@ -785,7 +845,7 @@ public class QuestState
*/ */
public boolean isNowAvailable() public boolean isNowAvailable()
{ {
final String val = get("restartTime"); final String val = get(RESTART_VAR);
return (val != null) && (Long.parseLong(val) <= Chronos.currentTimeMillis()); return (val != null) && (Long.parseLong(val) <= Chronos.currentTimeMillis());
} }

View File

@@ -58,7 +58,7 @@ public class QuestList implements IClientOutgoingPacket
for (QuestState qs : _activeQuests) for (QuestState qs : _activeQuests)
{ {
packet.writeD(qs.getQuest().getId()); packet.writeD(qs.getQuest().getId());
packet.writeD(qs.getCond()); packet.writeD(qs.getCondBitSet());
} }
packet.writeB(_oneTimeQuestMask); packet.writeB(_oneTimeQuestMask);
return true; return true;

View File

@@ -336,7 +336,7 @@ public class AdminShowQuests implements IAdminCommandHandler
{ {
qs = QuestManager.getInstance().getQuest(Integer.parseInt(val[0])).newQuestState(target); qs = QuestManager.getInstance().getQuest(Integer.parseInt(val[0])).newQuestState(target);
qs.setState(State.STARTED); qs.setState(State.STARTED);
qs.set("cond", "1"); qs.setCond(1);
target.sendPacket(new QuestList(target)); target.sendPacket(new QuestList(target));
target.sendPacket(new ExShowQuestMark(qs.getQuest().getId(), qs.getCond())); target.sendPacket(new ExShowQuestMark(qs.getQuest().getId(), qs.getCond()));
val[0] = qs.getQuest().getName(); val[0] = qs.getQuest().getName();

View File

@@ -40,6 +40,12 @@ public class QuestState
{ {
protected static final Logger LOGGER = Logger.getLogger(QuestState.class.getName()); protected static final Logger LOGGER = Logger.getLogger(QuestState.class.getName());
// Constants
private static final String COND_VAR = "cond";
private static final String RESTART_VAR = "restartTime";
private static final String MEMO_VAR = "memoState";
private static final String MEMO_EX_VAR = "memoStateEx";
/** The name of the quest of this QuestState */ /** The name of the quest of this QuestState */
private final String _questName; private final String _questName;
@@ -49,6 +55,9 @@ public class QuestState
/** The current state of the quest */ /** The current state of the quest */
private byte _state; private byte _state;
/** The current condition of the quest */
private int _cond = 0;
/** Used for simulating Quest onTalk */ /** Used for simulating Quest onTalk */
private boolean _simulated = false; private boolean _simulated = false;
@@ -156,10 +165,12 @@ public class QuestState
{ {
return; return;
} }
if (_state == state) if (_state == state)
{ {
return; return;
} }
final boolean newQuest = isCreated(); final boolean newQuest = isCreated();
_state = state; _state = state;
if (saveInDb) if (saveInDb)
@@ -179,10 +190,10 @@ public class QuestState
/** /**
* Add parameter used in quests. * Add parameter used in quests.
* @param var String pointing out the name of the variable for quest * @param variable String pointing out the name of the variable for quest
* @param value String pointing out the value of the variable for quest * @param value String pointing out the value of the variable for quest
*/ */
public void setInternal(String var, String value) public void setInternal(String variable, String value)
{ {
if (_simulated) if (_simulated)
{ {
@@ -196,20 +207,32 @@ public class QuestState
if (value == null) if (value == null)
{ {
_vars.put(var, ""); _vars.put(variable, "");
return; return;
} }
_vars.put(var, value); if (COND_VAR.equals(variable))
{
try
{
_cond = Integer.parseInt(value);
}
catch (Exception ignored)
{
}
} }
public void set(String var, int value) _vars.put(variable, value);
}
public void set(String variable, int value)
{ {
if (_simulated) if (_simulated)
{ {
return; return;
} }
set(var, Integer.toString(value));
set(variable, Integer.toString(value));
} }
/** /**
@@ -223,10 +246,10 @@ public class QuestState
* The key is known as existing if the preceding value of the key (given as result of function put()) is not null.<br> * The key is known as existing if the preceding value of the key (given as result of function put()) is not null.<br>
* If the key doesn't exist, the couple is added/created in the database</li> * If the key doesn't exist, the couple is added/created in the database</li>
* <ul> * <ul>
* @param var String indicating the name of the variable for quest * @param variable String indicating the name of the variable for quest
* @param val String indicating the value of the variable for quest * @param value String indicating the value of the variable for quest
*/ */
public void set(String var, String val) public void set(String variable, String value)
{ {
if (_simulated) if (_simulated)
{ {
@@ -238,23 +261,23 @@ public class QuestState
_vars = new HashMap<>(); _vars = new HashMap<>();
} }
String value = val; String newValue = value;
if (value == null) if (newValue == null)
{ {
value = ""; newValue = "";
} }
final String old = _vars.put(var, value); final String old = _vars.put(variable, newValue);
if (old != null) if (old != null)
{ {
Quest.updateQuestVarInDb(this, var, value); Quest.updateQuestVarInDb(this, variable, newValue);
} }
else else
{ {
Quest.createQuestVarInDb(this, var, value); Quest.createQuestVarInDb(this, variable, newValue);
} }
if ("cond".equals(var)) if (COND_VAR.equals(variable))
{ {
try try
{ {
@@ -263,16 +286,25 @@ public class QuestState
{ {
previousVal = Integer.parseInt(old); previousVal = Integer.parseInt(old);
} }
catch (Exception ex) catch (Exception ignored)
{ {
previousVal = 0;
} }
setCond(Integer.parseInt(value), previousVal); int newCond = 0;
try
{
newCond = Integer.parseInt(newValue);
}
catch (Exception ignored)
{
}
_cond = newCond;
setCond(newCond, previousVal);
getQuest().sendNpcLogList(getPlayer()); getQuest().sendNpcLogList(getPlayer());
} }
catch (Exception e) catch (Exception e)
{ {
LOGGER.log(Level.WARNING, _player.getName() + ", " + _questName + " cond [" + value + "] is not an integer. Value stored, but no packet was sent: " + e.getMessage(), e); LOGGER.log(Level.WARNING, _player.getName() + ", " + _questName + " cond [" + newValue + "] is not an integer. Value stored, but no packet was sent: " + e.getMessage(), e);
} }
} }
} }
@@ -373,9 +405,9 @@ public class QuestState
/** /**
* Removes a quest variable from the list of existing quest variables. * Removes a quest variable from the list of existing quest variables.
* @param var the name of the variable to remove * @param variable the name of the variable to remove
*/ */
public void unset(String var) public void unset(String variable)
{ {
if (_simulated) if (_simulated)
{ {
@@ -387,54 +419,60 @@ public class QuestState
return; return;
} }
final String old = _vars.remove(var); final String old = _vars.remove(variable);
if (old != null) if (old != null)
{ {
Quest.deleteQuestVarInDb(this, var); if (COND_VAR.equals(variable))
{
_cond = 0;
}
Quest.deleteQuestVarInDb(this, variable);
} }
} }
/** /**
* @param var the name of the variable to get * @param variable the name of the variable to get
* @return the value of the variable from the list of quest variables * @return the value of the variable from the list of quest variables
*/ */
public String get(String var) public String get(String variable)
{ {
if (_vars == null) if (_vars == null)
{ {
return null; return null;
} }
return _vars.get(var);
return _vars.get(variable);
} }
/** /**
* @param var the name of the variable to get * @param variable the name of the variable to get
* @return the integer value of the variable or 0 if the variable does not exist or its value is not an integer * @return the integer value of the variable or 0 if the variable does not exist or its value is not an integer
*/ */
public int getInt(String var) public int getInt(String variable)
{ {
if (_vars == null) if (_vars == null)
{ {
return 0; return 0;
} }
final String variable = _vars.get(var); final String varStr = _vars.get(variable);
if ((variable == null) || variable.isEmpty()) if ((varStr == null) || varStr.isEmpty())
{ {
return 0; return 0;
} }
int varint = 0; int varInt = 0;
try try
{ {
varint = Integer.parseInt(variable); varInt = Integer.parseInt(varStr);
} }
catch (NumberFormatException nfe) catch (NumberFormatException nfe)
{ {
LOGGER.log(Level.INFO, "Quest " + _questName + ", method getInt(" + var + "), tried to parse a non-integer value (" + variable + "). Char Id: " + _player.getObjectId(), nfe); LOGGER.log(Level.INFO, "Quest " + _questName + ", method getInt(" + variable + "), tried to parse a non-integer value (" + varStr + "). Char Id: " + _player.getObjectId(), nfe);
} }
return varint; return varInt;
} }
/** /**
@@ -445,7 +483,7 @@ public class QuestState
*/ */
public boolean isCond(int condition) public boolean isCond(int condition)
{ {
return getInt("cond") == condition; return _cond == condition;
} }
/** /**
@@ -463,7 +501,7 @@ public class QuestState
if (isStarted()) if (isStarted())
{ {
set("cond", Integer.toString(value)); set(COND_VAR, Integer.toString(value));
} }
} }
@@ -474,7 +512,21 @@ public class QuestState
{ {
if (isStarted()) if (isStarted())
{ {
int val = getInt("cond"); return _cond;
}
return 0;
}
/**
* Get bit set representing completed conds.
* @return if none cond is set {@code 0}, otherwise cond bit set.
*/
public int getCondBitSet()
{
if (isStarted())
{
int val = getInt(COND_VAR);
if ((val & 0x80000000) != 0) if ((val & 0x80000000) != 0)
{ {
val &= 0x7fffffff; val &= 0x7fffffff;
@@ -524,7 +576,8 @@ public class QuestState
{ {
return; return;
} }
set("cond", String.valueOf(value));
set(COND_VAR, String.valueOf(value));
if (playQuestMiddle) if (playQuestMiddle)
{ {
_player.sendPacket(QuestSound.ITEMSOUND_QUEST_MIDDLE.getPacket()); _player.sendPacket(QuestSound.ITEMSOUND_QUEST_MIDDLE.getPacket());
@@ -537,7 +590,8 @@ public class QuestState
{ {
return; return;
} }
set("memoState", String.valueOf(value));
set(MEMO_VAR, String.valueOf(value));
} }
/** /**
@@ -547,14 +601,15 @@ public class QuestState
{ {
if (isStarted()) if (isStarted())
{ {
return getInt("memoState"); return getInt(MEMO_VAR);
} }
return 0; return 0;
} }
public boolean isMemoState(int memoState) public boolean isMemoState(int memoState)
{ {
return getInt("memoState") == memoState; return getInt(MEMO_VAR) == memoState;
} }
/** /**
@@ -566,8 +621,9 @@ public class QuestState
{ {
if (isStarted()) if (isStarted())
{ {
return getInt("memoStateEx" + slot); return getInt(MEMO_EX_VAR + slot);
} }
return 0; return 0;
} }
@@ -582,7 +638,8 @@ public class QuestState
{ {
return; return;
} }
set("memoStateEx" + slot, String.valueOf(value));
set(MEMO_EX_VAR + slot, String.valueOf(value));
} }
/** /**
@@ -613,6 +670,7 @@ public class QuestState
{ {
return; return;
} }
_isExitQuestOnCleanUp = isExitQuestOnCleanUp; _isExitQuestOnCleanUp = isExitQuestOnCleanUp;
} }
@@ -626,9 +684,10 @@ public class QuestState
{ {
return; return;
} }
if (isCreated() && !getQuest().isCustomQuest()) if (isCreated() && !getQuest().isCustomQuest())
{ {
set("cond", "1"); set(COND_VAR, "1");
setState(State.STARTED); setState(State.STARTED);
_player.sendPacket(QuestSound.ITEMSOUND_QUEST_ACCEPT.getPacket()); _player.sendPacket(QuestSound.ITEMSOUND_QUEST_ACCEPT.getPacket());
getQuest().sendNpcLogList(getPlayer()); getQuest().sendNpcLogList(getPlayer());
@@ -686,6 +745,7 @@ public class QuestState
{ {
return; return;
} }
exitQuest(type); exitQuest(type);
if (playExitQuest) if (playExitQuest)
{ {
@@ -776,7 +836,7 @@ public class QuestState
} }
reDo.set(Calendar.HOUR_OF_DAY, getQuest().getResetHour()); reDo.set(Calendar.HOUR_OF_DAY, getQuest().getResetHour());
reDo.set(Calendar.MINUTE, getQuest().getResetMinutes()); reDo.set(Calendar.MINUTE, getQuest().getResetMinutes());
set("restartTime", String.valueOf(reDo.getTimeInMillis())); set(RESTART_VAR, String.valueOf(reDo.getTimeInMillis()));
} }
/** /**
@@ -785,7 +845,7 @@ public class QuestState
*/ */
public boolean isNowAvailable() public boolean isNowAvailable()
{ {
final String val = get("restartTime"); final String val = get(RESTART_VAR);
return (val != null) && (Long.parseLong(val) <= Chronos.currentTimeMillis()); return (val != null) && (Long.parseLong(val) <= Chronos.currentTimeMillis());
} }

View File

@@ -58,7 +58,7 @@ public class QuestList implements IClientOutgoingPacket
for (QuestState qs : _activeQuests) for (QuestState qs : _activeQuests)
{ {
packet.writeD(qs.getQuest().getId()); packet.writeD(qs.getQuest().getId());
packet.writeD(qs.getCond()); packet.writeD(qs.getCondBitSet());
} }
packet.writeB(_oneTimeQuestMask); packet.writeB(_oneTimeQuestMask);
return true; return true;

View File

@@ -336,7 +336,7 @@ public class AdminShowQuests implements IAdminCommandHandler
{ {
qs = QuestManager.getInstance().getQuest(Integer.parseInt(val[0])).newQuestState(target); qs = QuestManager.getInstance().getQuest(Integer.parseInt(val[0])).newQuestState(target);
qs.setState(State.STARTED); qs.setState(State.STARTED);
qs.set("cond", "1"); qs.setCond(1);
target.sendPacket(new QuestList(target)); target.sendPacket(new QuestList(target));
target.sendPacket(new ExShowQuestMark(qs.getQuest().getId(), qs.getCond())); target.sendPacket(new ExShowQuestMark(qs.getQuest().getId(), qs.getCond()));
val[0] = qs.getQuest().getName(); val[0] = qs.getQuest().getName();

View File

@@ -40,6 +40,12 @@ public class QuestState
{ {
protected static final Logger LOGGER = Logger.getLogger(QuestState.class.getName()); protected static final Logger LOGGER = Logger.getLogger(QuestState.class.getName());
// Constants
private static final String COND_VAR = "cond";
private static final String RESTART_VAR = "restartTime";
private static final String MEMO_VAR = "memoState";
private static final String MEMO_EX_VAR = "memoStateEx";
/** The name of the quest of this QuestState */ /** The name of the quest of this QuestState */
private final String _questName; private final String _questName;
@@ -49,6 +55,9 @@ public class QuestState
/** The current state of the quest */ /** The current state of the quest */
private byte _state; private byte _state;
/** The current condition of the quest */
private int _cond = 0;
/** Used for simulating Quest onTalk */ /** Used for simulating Quest onTalk */
private boolean _simulated = false; private boolean _simulated = false;
@@ -156,10 +165,12 @@ public class QuestState
{ {
return; return;
} }
if (_state == state) if (_state == state)
{ {
return; return;
} }
final boolean newQuest = isCreated(); final boolean newQuest = isCreated();
_state = state; _state = state;
if (saveInDb) if (saveInDb)
@@ -179,10 +190,10 @@ public class QuestState
/** /**
* Add parameter used in quests. * Add parameter used in quests.
* @param var String pointing out the name of the variable for quest * @param variable String pointing out the name of the variable for quest
* @param value String pointing out the value of the variable for quest * @param value String pointing out the value of the variable for quest
*/ */
public void setInternal(String var, String value) public void setInternal(String variable, String value)
{ {
if (_simulated) if (_simulated)
{ {
@@ -196,20 +207,32 @@ public class QuestState
if (value == null) if (value == null)
{ {
_vars.put(var, ""); _vars.put(variable, "");
return; return;
} }
_vars.put(var, value); if (COND_VAR.equals(variable))
{
try
{
_cond = Integer.parseInt(value);
}
catch (Exception ignored)
{
}
} }
public void set(String var, int value) _vars.put(variable, value);
}
public void set(String variable, int value)
{ {
if (_simulated) if (_simulated)
{ {
return; return;
} }
set(var, Integer.toString(value));
set(variable, Integer.toString(value));
} }
/** /**
@@ -223,10 +246,10 @@ public class QuestState
* The key is known as existing if the preceding value of the key (given as result of function put()) is not null.<br> * The key is known as existing if the preceding value of the key (given as result of function put()) is not null.<br>
* If the key doesn't exist, the couple is added/created in the database</li> * If the key doesn't exist, the couple is added/created in the database</li>
* <ul> * <ul>
* @param var String indicating the name of the variable for quest * @param variable String indicating the name of the variable for quest
* @param val String indicating the value of the variable for quest * @param value String indicating the value of the variable for quest
*/ */
public void set(String var, String val) public void set(String variable, String value)
{ {
if (_simulated) if (_simulated)
{ {
@@ -238,23 +261,23 @@ public class QuestState
_vars = new HashMap<>(); _vars = new HashMap<>();
} }
String value = val; String newValue = value;
if (value == null) if (newValue == null)
{ {
value = ""; newValue = "";
} }
final String old = _vars.put(var, value); final String old = _vars.put(variable, newValue);
if (old != null) if (old != null)
{ {
Quest.updateQuestVarInDb(this, var, value); Quest.updateQuestVarInDb(this, variable, newValue);
} }
else else
{ {
Quest.createQuestVarInDb(this, var, value); Quest.createQuestVarInDb(this, variable, newValue);
} }
if ("cond".equals(var)) if (COND_VAR.equals(variable))
{ {
try try
{ {
@@ -263,16 +286,25 @@ public class QuestState
{ {
previousVal = Integer.parseInt(old); previousVal = Integer.parseInt(old);
} }
catch (Exception ex) catch (Exception ignored)
{ {
previousVal = 0;
} }
setCond(Integer.parseInt(value), previousVal); int newCond = 0;
try
{
newCond = Integer.parseInt(newValue);
}
catch (Exception ignored)
{
}
_cond = newCond;
setCond(newCond, previousVal);
getQuest().sendNpcLogList(getPlayer()); getQuest().sendNpcLogList(getPlayer());
} }
catch (Exception e) catch (Exception e)
{ {
LOGGER.log(Level.WARNING, _player.getName() + ", " + _questName + " cond [" + value + "] is not an integer. Value stored, but no packet was sent: " + e.getMessage(), e); LOGGER.log(Level.WARNING, _player.getName() + ", " + _questName + " cond [" + newValue + "] is not an integer. Value stored, but no packet was sent: " + e.getMessage(), e);
} }
} }
} }
@@ -373,9 +405,9 @@ public class QuestState
/** /**
* Removes a quest variable from the list of existing quest variables. * Removes a quest variable from the list of existing quest variables.
* @param var the name of the variable to remove * @param variable the name of the variable to remove
*/ */
public void unset(String var) public void unset(String variable)
{ {
if (_simulated) if (_simulated)
{ {
@@ -387,54 +419,60 @@ public class QuestState
return; return;
} }
final String old = _vars.remove(var); final String old = _vars.remove(variable);
if (old != null) if (old != null)
{ {
Quest.deleteQuestVarInDb(this, var); if (COND_VAR.equals(variable))
{
_cond = 0;
}
Quest.deleteQuestVarInDb(this, variable);
} }
} }
/** /**
* @param var the name of the variable to get * @param variable the name of the variable to get
* @return the value of the variable from the list of quest variables * @return the value of the variable from the list of quest variables
*/ */
public String get(String var) public String get(String variable)
{ {
if (_vars == null) if (_vars == null)
{ {
return null; return null;
} }
return _vars.get(var);
return _vars.get(variable);
} }
/** /**
* @param var the name of the variable to get * @param variable the name of the variable to get
* @return the integer value of the variable or 0 if the variable does not exist or its value is not an integer * @return the integer value of the variable or 0 if the variable does not exist or its value is not an integer
*/ */
public int getInt(String var) public int getInt(String variable)
{ {
if (_vars == null) if (_vars == null)
{ {
return 0; return 0;
} }
final String variable = _vars.get(var); final String varStr = _vars.get(variable);
if ((variable == null) || variable.isEmpty()) if ((varStr == null) || varStr.isEmpty())
{ {
return 0; return 0;
} }
int varint = 0; int varInt = 0;
try try
{ {
varint = Integer.parseInt(variable); varInt = Integer.parseInt(varStr);
} }
catch (NumberFormatException nfe) catch (NumberFormatException nfe)
{ {
LOGGER.log(Level.INFO, "Quest " + _questName + ", method getInt(" + var + "), tried to parse a non-integer value (" + variable + "). Char Id: " + _player.getObjectId(), nfe); LOGGER.log(Level.INFO, "Quest " + _questName + ", method getInt(" + variable + "), tried to parse a non-integer value (" + varStr + "). Char Id: " + _player.getObjectId(), nfe);
} }
return varint; return varInt;
} }
/** /**
@@ -445,7 +483,7 @@ public class QuestState
*/ */
public boolean isCond(int condition) public boolean isCond(int condition)
{ {
return getInt("cond") == condition; return _cond == condition;
} }
/** /**
@@ -463,7 +501,7 @@ public class QuestState
if (isStarted()) if (isStarted())
{ {
set("cond", Integer.toString(value)); set(COND_VAR, Integer.toString(value));
} }
} }
@@ -474,7 +512,21 @@ public class QuestState
{ {
if (isStarted()) if (isStarted())
{ {
int val = getInt("cond"); return _cond;
}
return 0;
}
/**
* Get bit set representing completed conds.
* @return if none cond is set {@code 0}, otherwise cond bit set.
*/
public int getCondBitSet()
{
if (isStarted())
{
int val = getInt(COND_VAR);
if ((val & 0x80000000) != 0) if ((val & 0x80000000) != 0)
{ {
val &= 0x7fffffff; val &= 0x7fffffff;
@@ -524,7 +576,8 @@ public class QuestState
{ {
return; return;
} }
set("cond", String.valueOf(value));
set(COND_VAR, String.valueOf(value));
if (playQuestMiddle) if (playQuestMiddle)
{ {
_player.sendPacket(QuestSound.ITEMSOUND_QUEST_MIDDLE.getPacket()); _player.sendPacket(QuestSound.ITEMSOUND_QUEST_MIDDLE.getPacket());
@@ -537,7 +590,8 @@ public class QuestState
{ {
return; return;
} }
set("memoState", String.valueOf(value));
set(MEMO_VAR, String.valueOf(value));
} }
/** /**
@@ -547,14 +601,15 @@ public class QuestState
{ {
if (isStarted()) if (isStarted())
{ {
return getInt("memoState"); return getInt(MEMO_VAR);
} }
return 0; return 0;
} }
public boolean isMemoState(int memoState) public boolean isMemoState(int memoState)
{ {
return getInt("memoState") == memoState; return getInt(MEMO_VAR) == memoState;
} }
/** /**
@@ -566,8 +621,9 @@ public class QuestState
{ {
if (isStarted()) if (isStarted())
{ {
return getInt("memoStateEx" + slot); return getInt(MEMO_EX_VAR + slot);
} }
return 0; return 0;
} }
@@ -582,7 +638,8 @@ public class QuestState
{ {
return; return;
} }
set("memoStateEx" + slot, String.valueOf(value));
set(MEMO_EX_VAR + slot, String.valueOf(value));
} }
/** /**
@@ -613,6 +670,7 @@ public class QuestState
{ {
return; return;
} }
_isExitQuestOnCleanUp = isExitQuestOnCleanUp; _isExitQuestOnCleanUp = isExitQuestOnCleanUp;
} }
@@ -626,9 +684,10 @@ public class QuestState
{ {
return; return;
} }
if (isCreated() && !getQuest().isCustomQuest()) if (isCreated() && !getQuest().isCustomQuest())
{ {
set("cond", "1"); set(COND_VAR, "1");
setState(State.STARTED); setState(State.STARTED);
_player.sendPacket(QuestSound.ITEMSOUND_QUEST_ACCEPT.getPacket()); _player.sendPacket(QuestSound.ITEMSOUND_QUEST_ACCEPT.getPacket());
getQuest().sendNpcLogList(getPlayer()); getQuest().sendNpcLogList(getPlayer());
@@ -686,6 +745,7 @@ public class QuestState
{ {
return; return;
} }
exitQuest(type); exitQuest(type);
if (playExitQuest) if (playExitQuest)
{ {
@@ -776,7 +836,7 @@ public class QuestState
} }
reDo.set(Calendar.HOUR_OF_DAY, getQuest().getResetHour()); reDo.set(Calendar.HOUR_OF_DAY, getQuest().getResetHour());
reDo.set(Calendar.MINUTE, getQuest().getResetMinutes()); reDo.set(Calendar.MINUTE, getQuest().getResetMinutes());
set("restartTime", String.valueOf(reDo.getTimeInMillis())); set(RESTART_VAR, String.valueOf(reDo.getTimeInMillis()));
} }
/** /**
@@ -785,7 +845,7 @@ public class QuestState
*/ */
public boolean isNowAvailable() public boolean isNowAvailable()
{ {
final String val = get("restartTime"); final String val = get(RESTART_VAR);
return (val != null) && (Long.parseLong(val) <= Chronos.currentTimeMillis()); return (val != null) && (Long.parseLong(val) <= Chronos.currentTimeMillis());
} }

View File

@@ -58,7 +58,7 @@ public class QuestList implements IClientOutgoingPacket
for (QuestState qs : _activeQuests) for (QuestState qs : _activeQuests)
{ {
packet.writeD(qs.getQuest().getId()); packet.writeD(qs.getQuest().getId());
packet.writeD(qs.getCond()); packet.writeD(qs.getCondBitSet());
} }
packet.writeB(_oneTimeQuestMask); packet.writeB(_oneTimeQuestMask);
return true; return true;

View File

@@ -336,7 +336,7 @@ public class AdminShowQuests implements IAdminCommandHandler
{ {
qs = QuestManager.getInstance().getQuest(Integer.parseInt(val[0])).newQuestState(target); qs = QuestManager.getInstance().getQuest(Integer.parseInt(val[0])).newQuestState(target);
qs.setState(State.STARTED); qs.setState(State.STARTED);
qs.set("cond", "1"); qs.setCond(1);
target.sendPacket(new QuestList(target)); target.sendPacket(new QuestList(target));
target.sendPacket(new ExShowQuestMark(qs.getQuest().getId(), qs.getCond())); target.sendPacket(new ExShowQuestMark(qs.getQuest().getId(), qs.getCond()));
val[0] = qs.getQuest().getName(); val[0] = qs.getQuest().getName();

View File

@@ -40,6 +40,12 @@ public class QuestState
{ {
protected static final Logger LOGGER = Logger.getLogger(QuestState.class.getName()); protected static final Logger LOGGER = Logger.getLogger(QuestState.class.getName());
// Constants
private static final String COND_VAR = "cond";
private static final String RESTART_VAR = "restartTime";
private static final String MEMO_VAR = "memoState";
private static final String MEMO_EX_VAR = "memoStateEx";
/** The name of the quest of this QuestState */ /** The name of the quest of this QuestState */
private final String _questName; private final String _questName;
@@ -49,6 +55,9 @@ public class QuestState
/** The current state of the quest */ /** The current state of the quest */
private byte _state; private byte _state;
/** The current condition of the quest */
private int _cond = 0;
/** Used for simulating Quest onTalk */ /** Used for simulating Quest onTalk */
private boolean _simulated = false; private boolean _simulated = false;
@@ -156,10 +165,12 @@ public class QuestState
{ {
return; return;
} }
if (_state == state) if (_state == state)
{ {
return; return;
} }
final boolean newQuest = isCreated(); final boolean newQuest = isCreated();
_state = state; _state = state;
if (saveInDb) if (saveInDb)
@@ -179,10 +190,10 @@ public class QuestState
/** /**
* Add parameter used in quests. * Add parameter used in quests.
* @param var String pointing out the name of the variable for quest * @param variable String pointing out the name of the variable for quest
* @param value String pointing out the value of the variable for quest * @param value String pointing out the value of the variable for quest
*/ */
public void setInternal(String var, String value) public void setInternal(String variable, String value)
{ {
if (_simulated) if (_simulated)
{ {
@@ -196,20 +207,32 @@ public class QuestState
if (value == null) if (value == null)
{ {
_vars.put(var, ""); _vars.put(variable, "");
return; return;
} }
_vars.put(var, value); if (COND_VAR.equals(variable))
{
try
{
_cond = Integer.parseInt(value);
}
catch (Exception ignored)
{
}
} }
public void set(String var, int value) _vars.put(variable, value);
}
public void set(String variable, int value)
{ {
if (_simulated) if (_simulated)
{ {
return; return;
} }
set(var, Integer.toString(value));
set(variable, Integer.toString(value));
} }
/** /**
@@ -223,10 +246,10 @@ public class QuestState
* The key is known as existing if the preceding value of the key (given as result of function put()) is not null.<br> * The key is known as existing if the preceding value of the key (given as result of function put()) is not null.<br>
* If the key doesn't exist, the couple is added/created in the database</li> * If the key doesn't exist, the couple is added/created in the database</li>
* <ul> * <ul>
* @param var String indicating the name of the variable for quest * @param variable String indicating the name of the variable for quest
* @param val String indicating the value of the variable for quest * @param value String indicating the value of the variable for quest
*/ */
public void set(String var, String val) public void set(String variable, String value)
{ {
if (_simulated) if (_simulated)
{ {
@@ -238,23 +261,23 @@ public class QuestState
_vars = new HashMap<>(); _vars = new HashMap<>();
} }
String value = val; String newValue = value;
if (value == null) if (newValue == null)
{ {
value = ""; newValue = "";
} }
final String old = _vars.put(var, value); final String old = _vars.put(variable, newValue);
if (old != null) if (old != null)
{ {
Quest.updateQuestVarInDb(this, var, value); Quest.updateQuestVarInDb(this, variable, newValue);
} }
else else
{ {
Quest.createQuestVarInDb(this, var, value); Quest.createQuestVarInDb(this, variable, newValue);
} }
if ("cond".equals(var)) if (COND_VAR.equals(variable))
{ {
try try
{ {
@@ -263,16 +286,25 @@ public class QuestState
{ {
previousVal = Integer.parseInt(old); previousVal = Integer.parseInt(old);
} }
catch (Exception ex) catch (Exception ignored)
{ {
previousVal = 0;
} }
setCond(Integer.parseInt(value), previousVal); int newCond = 0;
try
{
newCond = Integer.parseInt(newValue);
}
catch (Exception ignored)
{
}
_cond = newCond;
setCond(newCond, previousVal);
getQuest().sendNpcLogList(getPlayer()); getQuest().sendNpcLogList(getPlayer());
} }
catch (Exception e) catch (Exception e)
{ {
LOGGER.log(Level.WARNING, _player.getName() + ", " + _questName + " cond [" + value + "] is not an integer. Value stored, but no packet was sent: " + e.getMessage(), e); LOGGER.log(Level.WARNING, _player.getName() + ", " + _questName + " cond [" + newValue + "] is not an integer. Value stored, but no packet was sent: " + e.getMessage(), e);
} }
} }
} }
@@ -373,9 +405,9 @@ public class QuestState
/** /**
* Removes a quest variable from the list of existing quest variables. * Removes a quest variable from the list of existing quest variables.
* @param var the name of the variable to remove * @param variable the name of the variable to remove
*/ */
public void unset(String var) public void unset(String variable)
{ {
if (_simulated) if (_simulated)
{ {
@@ -387,54 +419,60 @@ public class QuestState
return; return;
} }
final String old = _vars.remove(var); final String old = _vars.remove(variable);
if (old != null) if (old != null)
{ {
Quest.deleteQuestVarInDb(this, var); if (COND_VAR.equals(variable))
{
_cond = 0;
}
Quest.deleteQuestVarInDb(this, variable);
} }
} }
/** /**
* @param var the name of the variable to get * @param variable the name of the variable to get
* @return the value of the variable from the list of quest variables * @return the value of the variable from the list of quest variables
*/ */
public String get(String var) public String get(String variable)
{ {
if (_vars == null) if (_vars == null)
{ {
return null; return null;
} }
return _vars.get(var);
return _vars.get(variable);
} }
/** /**
* @param var the name of the variable to get * @param variable the name of the variable to get
* @return the integer value of the variable or 0 if the variable does not exist or its value is not an integer * @return the integer value of the variable or 0 if the variable does not exist or its value is not an integer
*/ */
public int getInt(String var) public int getInt(String variable)
{ {
if (_vars == null) if (_vars == null)
{ {
return 0; return 0;
} }
final String variable = _vars.get(var); final String varStr = _vars.get(variable);
if ((variable == null) || variable.isEmpty()) if ((varStr == null) || varStr.isEmpty())
{ {
return 0; return 0;
} }
int varint = 0; int varInt = 0;
try try
{ {
varint = Integer.parseInt(variable); varInt = Integer.parseInt(varStr);
} }
catch (NumberFormatException nfe) catch (NumberFormatException nfe)
{ {
LOGGER.log(Level.INFO, "Quest " + _questName + ", method getInt(" + var + "), tried to parse a non-integer value (" + variable + "). Char Id: " + _player.getObjectId(), nfe); LOGGER.log(Level.INFO, "Quest " + _questName + ", method getInt(" + variable + "), tried to parse a non-integer value (" + varStr + "). Char Id: " + _player.getObjectId(), nfe);
} }
return varint; return varInt;
} }
/** /**
@@ -445,7 +483,7 @@ public class QuestState
*/ */
public boolean isCond(int condition) public boolean isCond(int condition)
{ {
return getInt("cond") == condition; return _cond == condition;
} }
/** /**
@@ -463,7 +501,7 @@ public class QuestState
if (isStarted()) if (isStarted())
{ {
set("cond", Integer.toString(value)); set(COND_VAR, Integer.toString(value));
} }
} }
@@ -474,7 +512,21 @@ public class QuestState
{ {
if (isStarted()) if (isStarted())
{ {
int val = getInt("cond"); return _cond;
}
return 0;
}
/**
* Get bit set representing completed conds.
* @return if none cond is set {@code 0}, otherwise cond bit set.
*/
public int getCondBitSet()
{
if (isStarted())
{
int val = getInt(COND_VAR);
if ((val & 0x80000000) != 0) if ((val & 0x80000000) != 0)
{ {
val &= 0x7fffffff; val &= 0x7fffffff;
@@ -524,7 +576,8 @@ public class QuestState
{ {
return; return;
} }
set("cond", String.valueOf(value));
set(COND_VAR, String.valueOf(value));
if (playQuestMiddle) if (playQuestMiddle)
{ {
_player.sendPacket(QuestSound.ITEMSOUND_QUEST_MIDDLE.getPacket()); _player.sendPacket(QuestSound.ITEMSOUND_QUEST_MIDDLE.getPacket());
@@ -537,7 +590,8 @@ public class QuestState
{ {
return; return;
} }
set("memoState", String.valueOf(value));
set(MEMO_VAR, String.valueOf(value));
} }
/** /**
@@ -547,14 +601,15 @@ public class QuestState
{ {
if (isStarted()) if (isStarted())
{ {
return getInt("memoState"); return getInt(MEMO_VAR);
} }
return 0; return 0;
} }
public boolean isMemoState(int memoState) public boolean isMemoState(int memoState)
{ {
return getInt("memoState") == memoState; return getInt(MEMO_VAR) == memoState;
} }
/** /**
@@ -566,8 +621,9 @@ public class QuestState
{ {
if (isStarted()) if (isStarted())
{ {
return getInt("memoStateEx" + slot); return getInt(MEMO_EX_VAR + slot);
} }
return 0; return 0;
} }
@@ -582,7 +638,8 @@ public class QuestState
{ {
return; return;
} }
set("memoStateEx" + slot, String.valueOf(value));
set(MEMO_EX_VAR + slot, String.valueOf(value));
} }
/** /**
@@ -613,6 +670,7 @@ public class QuestState
{ {
return; return;
} }
_isExitQuestOnCleanUp = isExitQuestOnCleanUp; _isExitQuestOnCleanUp = isExitQuestOnCleanUp;
} }
@@ -626,9 +684,10 @@ public class QuestState
{ {
return; return;
} }
if (isCreated() && !getQuest().isCustomQuest()) if (isCreated() && !getQuest().isCustomQuest())
{ {
set("cond", "1"); set(COND_VAR, "1");
setState(State.STARTED); setState(State.STARTED);
_player.sendPacket(QuestSound.ITEMSOUND_QUEST_ACCEPT.getPacket()); _player.sendPacket(QuestSound.ITEMSOUND_QUEST_ACCEPT.getPacket());
getQuest().sendNpcLogList(getPlayer()); getQuest().sendNpcLogList(getPlayer());
@@ -686,6 +745,7 @@ public class QuestState
{ {
return; return;
} }
exitQuest(type); exitQuest(type);
if (playExitQuest) if (playExitQuest)
{ {
@@ -776,7 +836,7 @@ public class QuestState
} }
reDo.set(Calendar.HOUR_OF_DAY, getQuest().getResetHour()); reDo.set(Calendar.HOUR_OF_DAY, getQuest().getResetHour());
reDo.set(Calendar.MINUTE, getQuest().getResetMinutes()); reDo.set(Calendar.MINUTE, getQuest().getResetMinutes());
set("restartTime", String.valueOf(reDo.getTimeInMillis())); set(RESTART_VAR, String.valueOf(reDo.getTimeInMillis()));
} }
/** /**
@@ -785,7 +845,7 @@ public class QuestState
*/ */
public boolean isNowAvailable() public boolean isNowAvailable()
{ {
final String val = get("restartTime"); final String val = get(RESTART_VAR);
return (val != null) && (Long.parseLong(val) <= Chronos.currentTimeMillis()); return (val != null) && (Long.parseLong(val) <= Chronos.currentTimeMillis());
} }

View File

@@ -58,7 +58,7 @@ public class QuestList implements IClientOutgoingPacket
for (QuestState qs : _activeQuests) for (QuestState qs : _activeQuests)
{ {
packet.writeD(qs.getQuest().getId()); packet.writeD(qs.getQuest().getId());
packet.writeD(qs.getCond()); packet.writeD(qs.getCondBitSet());
} }
packet.writeB(_oneTimeQuestMask); packet.writeB(_oneTimeQuestMask);
return true; return true;

View File

@@ -412,7 +412,7 @@ public class FeedableBeasts extends Quest
if ((st != null) && (Rnd.get(100) < 5) && !st.hasQuestItems(7185)) if ((st != null) && (Rnd.get(100) < 5) && !st.hasQuestItems(7185))
{ {
st.giveItems(7185, 1); st.giveItems(7185, 1);
st.set("cond", "2"); st.setCond(2);
} }
// Also, perform a rare random chat // Also, perform a rare random chat

View File

@@ -44,12 +44,10 @@ public class NewbieHelper extends Quest
private static final int LICENSE_OF_MINER = 1498; private static final int LICENSE_OF_MINER = 1498;
// Orc // Orc
private static final int VOUCHER_OF_FLAME = 1496; private static final int VOUCHER_OF_FLAME = 1496;
// Items Reward // Items Reward
private static final int SOULSHOT_NOVICE = 5789; private static final int SOULSHOT_NOVICE = 5789;
private static final int SPIRITSHOT_NOVICE = 5790; private static final int SPIRITSHOT_NOVICE = 5790;
private static final int BLUE_GEM = 6353; private static final int BLUE_GEM = 6353;
private static final Map<String, Event> _events = new HashMap<>(); private static final Map<String, Event> _events = new HashMap<>();
static static
{ {
@@ -60,7 +58,6 @@ public class NewbieHelper extends Quest
_events.put("30528_02", new Event("30528-03.htm", 115642, -178046, -941, LICENSE_OF_MINER, 0x35, SOULSHOT_NOVICE, 200, 0x00, 0, 0)); _events.put("30528_02", new Event("30528-03.htm", 115642, -178046, -941, LICENSE_OF_MINER, 0x35, SOULSHOT_NOVICE, 200, 0x00, 0, 0));
_events.put("30573_02", new Event("30573-03.htm", -45067, -113549, -235, VOUCHER_OF_FLAME, 0x31, SOULSHOT_NOVICE, 200, 0x2c, SOULSHOT_NOVICE, 200)); _events.put("30573_02", new Event("30573-03.htm", -45067, -113549, -235, VOUCHER_OF_FLAME, 0x31, SOULSHOT_NOVICE, 200, 0x2c, SOULSHOT_NOVICE, 200));
} }
// @formatter:off // @formatter:off
private static final Map<Integer, Talk> _talks = new HashMap<>(); private static final Map<Integer, Talk> _talks = new HashMap<>();
static static
@@ -89,11 +86,8 @@ public class NewbieHelper extends Quest
public NewbieHelper() public NewbieHelper()
{ {
super(-1, "ai/others"); super(-1, "ai/others");
addStartNpc(30009, 30019, 30131, 30400, 30530, 30575); addStartNpc(30009, 30019, 30131, 30400, 30530, 30575);
addTalkId(30009, 30019, 30131, 30400, 30530, 30575, 30008, 30017, 30129, 30370, 30528, 30573); addTalkId(30009, 30019, 30131, 30400, 30530, 30575, 30008, 30017, 30129, 30370, 30528, 30573);
addFirstTalkId(new int[] addFirstTalkId(new int[]
{ {
30009, // Newbie Helper - Human 30009, // Newbie Helper - Human
@@ -116,7 +110,6 @@ public class NewbieHelper extends Quest
30528, // Foreman - Dwarf 30528, // Foreman - Dwarf
30573 // Flame Guardian - Orc 30573 // Flame Guardian - Orc
}); });
addKillId(18342); addKillId(18342);
} }
@@ -248,12 +241,12 @@ public class NewbieHelper extends Quest
{ {
String htmltext = ""; String htmltext = "";
QuestState qs1 = player.getQuestState(getName()); QuestState qs1 = player.getQuestState(getName());
final QuestState qs2 = player.getQuestState(Tutorial.class.getSimpleName());
if (qs1 == null) if (qs1 == null)
{ {
qs1 = newQuestState(player); qs1 = newQuestState(player);
} }
final QuestState qs2 = player.getQuestState(Tutorial.class.getSimpleName());
if ((qs2 == null) || Config.DISABLE_TUTORIAL) if ((qs2 == null) || Config.DISABLE_TUTORIAL)
{ {
npc.showChatWindow(player); npc.showChatWindow(player);

View File

@@ -50,9 +50,7 @@ public class KetraOrcSupport extends Quest
private static final int JAFF = 31374; // Warehouse Keeper private static final int JAFF = 31374; // Warehouse Keeper
private static final int JUMARA = 31375; // Trader private static final int JUMARA = 31375; // Trader
private static final int KURFA = 31376; // Gate Keeper private static final int KURFA = 31376; // Gate Keeper
private static final int HORN = 7186; private static final int HORN = 7186;
private static final int[] KETRAS = private static final int[] KETRAS =
{ {
21324, 21324,
@@ -77,44 +75,19 @@ public class KetraOrcSupport extends Quest
21348, 21348,
21349 21349
}; };
private static final int[][] BUFF = private static final int[][] BUFF =
{ {
{ // @formatter:off
4359, {4359, 2}, // Focus: Requires 2 Buffalo Horns
2 {4360, 2}, // Death Whisper: Requires 2 Buffalo Horns
}, // Focus: Requires 2 Buffalo Horns {4345, 3}, // Might: Requires 3 Buffalo Horns
{ {4355, 3}, // Acumen: Requires 3 Buffalo Horns
4360, {4352, 3}, // Berserker: Requires 3 Buffalo Horns
2 {4354, 3}, // Vampiric Rage: Requires 3 Buffalo Horns
}, // Death Whisper: Requires 2 Buffalo Horns {4356, 6}, // Empower: Requires 6 Buffalo Horns
{ {4357, 6}, // Haste: Requires 6 Buffalo Horns
4345, // @formatter:on
3
}, // Might: Requires 3 Buffalo Horns
{
4355,
3
}, // Acumen: Requires 3 Buffalo Horns
{
4352,
3
}, // Berserker: Requires 3 Buffalo Horns
{
4354,
3
}, // Vampiric Rage: Requires 3 Buffalo Horns
{
4356,
6
}, // Empower: Requires 6 Buffalo Horns
{
4357,
6
}
// Haste: Requires 6 Buffalo Horns
}; };
private static final Skill VARKA_KETRA_PETRIFICATION = SkillTable.getInstance().getSkill(4578, 1); private static final Skill VARKA_KETRA_PETRIFICATION = SkillTable.getInstance().getSkill(4578, 1);
/** /**
@@ -185,13 +158,17 @@ public class KetraOrcSupport extends Quest
switch (player.getAllianceWithVarkaKetra()) switch (player.getAllianceWithVarkaKetra())
{ {
case 4: case 4:
{
htmltext = "31376-4.htm"; htmltext = "31376-4.htm";
break; break;
}
case 5: case 5:
{
htmltext = "31376-5.htm"; htmltext = "31376-5.htm";
break; break;
} }
} }
}
return htmltext; return htmltext;
} }
@@ -211,6 +188,7 @@ public class KetraOrcSupport extends Quest
switch (npc.getNpcId()) switch (npc.getNpcId())
{ {
case KADUN: case KADUN:
{
if (allianceLevel > 0) if (allianceLevel > 0)
{ {
htmltext = "31370-friend.htm"; htmltext = "31370-friend.htm";
@@ -220,8 +198,9 @@ public class KetraOrcSupport extends Quest
htmltext = "31370-no.htm"; htmltext = "31370-no.htm";
} }
break; break;
}
case WAHKAN: case WAHKAN:
{
if (allianceLevel > 0) if (allianceLevel > 0)
{ {
htmltext = "31371-friend.htm"; htmltext = "31371-friend.htm";
@@ -231,8 +210,9 @@ public class KetraOrcSupport extends Quest
htmltext = "31371-no.htm"; htmltext = "31371-no.htm";
} }
break; break;
}
case ASEFA: case ASEFA:
{
st.setState(State.STARTED); st.setState(State.STARTED);
if (allianceLevel < 1) if (allianceLevel < 1)
{ {
@@ -254,8 +234,9 @@ public class KetraOrcSupport extends Quest
} }
} }
break; break;
}
case ATAN: case ATAN:
{
if (player.getKarma() >= 1) if (player.getKarma() >= 1)
{ {
htmltext = "31373-pk.htm"; htmltext = "31373-pk.htm";
@@ -273,18 +254,24 @@ public class KetraOrcSupport extends Quest
htmltext = "31373-2.htm"; htmltext = "31373-2.htm";
} }
break; break;
}
case JAFF: case JAFF:
{
switch (allianceLevel) switch (allianceLevel)
{ {
case 1: case 1:
{
htmltext = "31374-1.htm"; htmltext = "31374-1.htm";
break; break;
}
case 2: case 2:
case 3: case 3:
{
htmltext = "31374-2.htm"; htmltext = "31374-2.htm";
break; break;
}
default: default:
{
if (allianceLevel <= 0) if (allianceLevel <= 0)
{ {
htmltext = "31374-no.htm"; htmltext = "31374-no.htm";
@@ -299,28 +286,39 @@ public class KetraOrcSupport extends Quest
} }
break; break;
} }
}
break; break;
}
case JUMARA: case JUMARA:
{
switch (allianceLevel) switch (allianceLevel)
{ {
case 2: case 2:
{
htmltext = "31375-1.htm"; htmltext = "31375-1.htm";
break; break;
}
case 3: case 3:
case 4: case 4:
{
htmltext = "31375-2.htm"; htmltext = "31375-2.htm";
break; break;
}
case 5: case 5:
{
htmltext = "31375-3.htm"; htmltext = "31375-3.htm";
break; break;
}
default: default:
{
htmltext = "31375-no.htm"; htmltext = "31375-no.htm";
break; break;
} }
}
break; break;
}
case KURFA: case KURFA:
{
if (allianceLevel <= 0) if (allianceLevel <= 0)
{ {
htmltext = "31376-no.htm"; htmltext = "31376-no.htm";
@@ -339,6 +337,7 @@ public class KetraOrcSupport extends Quest
} }
break; break;
} }
}
return htmltext; return htmltext;
} }
@@ -376,6 +375,7 @@ public class KetraOrcSupport extends Quest
case HEAL_STATIC: case HEAL_STATIC:
case BALANCE_LIFE: case BALANCE_LIFE:
case HOT: case HOT:
{
for (WorldObject target : skill.getTargetList(caster)) for (WorldObject target : skill.getTargetList(caster))
{ {
// Character isn't existing, or is current caster, we drop check. // Character isn't existing, or is current caster, we drop check.
@@ -421,6 +421,7 @@ public class KetraOrcSupport extends Quest
break; break;
} }
} }
}
// Continue normal behavior. // Continue normal behavior.
return null; return null;

View File

@@ -49,9 +49,7 @@ public class VarkaSilenosSupport extends Quest
private static final int HAGOS = 31381; // Warehouse Keeper private static final int HAGOS = 31381; // Warehouse Keeper
private static final int SHIKON = 31382; // Trader private static final int SHIKON = 31382; // Trader
private static final int TERANU = 31383; // Teleporter private static final int TERANU = 31383; // Teleporter
private static final int SEED = 7187; private static final int SEED = 7187;
private static final int[] VARKAS = private static final int[] VARKAS =
{ {
21350, 21350,
@@ -76,44 +74,19 @@ public class VarkaSilenosSupport extends Quest
21374, 21374,
21375 21375
}; };
private static final int[][] BUFF = private static final int[][] BUFF =
{ {
{ // @formatter:off
4359, {4359, 2}, // Focus: Requires 2 Nepenthese Seeds
2 {4360, 2}, // Death Whisper: Requires 2 Nepenthese Seeds
}, // Focus: Requires 2 Nepenthese Seeds {4345, 3}, // Might: Requires 3 Nepenthese Seeds
{ {4355, 3}, // Acumen: Requires 3 Nepenthese Seeds
4360, {4352, 3}, // Berserker: Requires 3 Nepenthese Seeds
2 {4354, 3}, // Vampiric Rage: Requires 3 Nepenthese Seeds
}, // Death Whisper: Requires 2 Nepenthese Seeds {4356, 6}, // Empower: Requires 6 Nepenthese Seeds
{ {4357, 6}, // Haste: Requires 6 Nepenthese Seeds
4345, // @formatter:on
3
}, // Might: Requires 3 Nepenthese Seeds
{
4355,
3
}, // Acumen: Requires 3 Nepenthese Seeds
{
4352,
3
}, // Berserker: Requires 3 Nepenthese Seeds
{
4354,
3
}, // Vampiric Rage: Requires 3 Nepenthese Seeds
{
4356,
6
}, // Empower: Requires 6 Nepenthese Seeds
{
4357,
6
}
// Haste: Requires 6 Nepenthese Seeds
}; };
private static final Skill VARKA_KETRA_PETRIFICATION = SkillTable.getInstance().getSkill(4578, 1); private static final Skill VARKA_KETRA_PETRIFICATION = SkillTable.getInstance().getSkill(4578, 1);
/** /**
@@ -184,13 +157,17 @@ public class VarkaSilenosSupport extends Quest
switch (player.getAllianceWithVarkaKetra()) switch (player.getAllianceWithVarkaKetra())
{ {
case -4: case -4:
{
htmltext = "31383-4.htm"; htmltext = "31383-4.htm";
break; break;
}
case -5: case -5:
{
htmltext = "31383-5.htm"; htmltext = "31383-5.htm";
break; break;
} }
} }
}
return htmltext; return htmltext;
} }
@@ -210,6 +187,7 @@ public class VarkaSilenosSupport extends Quest
switch (npc.getNpcId()) switch (npc.getNpcId())
{ {
case ASHAS: case ASHAS:
{
if (allianceLevel < 0) if (allianceLevel < 0)
{ {
htmltext = "31377-friend.htm"; htmltext = "31377-friend.htm";
@@ -219,8 +197,9 @@ public class VarkaSilenosSupport extends Quest
htmltext = "31377-no.htm"; htmltext = "31377-no.htm";
} }
break; break;
}
case NARAN: case NARAN:
{
if (allianceLevel < 0) if (allianceLevel < 0)
{ {
htmltext = "31378-friend.htm"; htmltext = "31378-friend.htm";
@@ -230,8 +209,9 @@ public class VarkaSilenosSupport extends Quest
htmltext = "31378-no.htm"; htmltext = "31378-no.htm";
} }
break; break;
}
case UDAN: case UDAN:
{
st.setState(State.STARTED); st.setState(State.STARTED);
if (allianceLevel > -1) if (allianceLevel > -1)
{ {
@@ -253,8 +233,9 @@ public class VarkaSilenosSupport extends Quest
} }
} }
break; break;
}
case DIYABU: case DIYABU:
{
if (player.getKarma() >= 1) if (player.getKarma() >= 1)
{ {
htmltext = "31380-pk.htm"; htmltext = "31380-pk.htm";
@@ -272,18 +253,24 @@ public class VarkaSilenosSupport extends Quest
htmltext = "31380-2.htm"; htmltext = "31380-2.htm";
} }
break; break;
}
case HAGOS: case HAGOS:
{
switch (allianceLevel) switch (allianceLevel)
{ {
case -1: case -1:
{
htmltext = "31381-1.htm"; htmltext = "31381-1.htm";
break; break;
}
case -2: case -2:
case -3: case -3:
{
htmltext = "31381-2.htm"; htmltext = "31381-2.htm";
break; break;
}
default: default:
{
if (allianceLevel >= 0) if (allianceLevel >= 0)
{ {
htmltext = "31381-no.htm"; htmltext = "31381-no.htm";
@@ -298,28 +285,39 @@ public class VarkaSilenosSupport extends Quest
} }
break; break;
} }
}
break; break;
}
case SHIKON: case SHIKON:
{
switch (allianceLevel) switch (allianceLevel)
{ {
case -2: case -2:
{
htmltext = "31382-1.htm"; htmltext = "31382-1.htm";
break; break;
}
case -3: case -3:
case -4: case -4:
{
htmltext = "31382-2.htm"; htmltext = "31382-2.htm";
break; break;
}
case -5: case -5:
{
htmltext = "31382-3.htm"; htmltext = "31382-3.htm";
break; break;
}
default: default:
{
htmltext = "31382-no.htm"; htmltext = "31382-no.htm";
break; break;
} }
}
break; break;
}
case TERANU: case TERANU:
{
if (allianceLevel >= 0) if (allianceLevel >= 0)
{ {
htmltext = "31383-no.htm"; htmltext = "31383-no.htm";
@@ -338,6 +336,7 @@ public class VarkaSilenosSupport extends Quest
} }
break; break;
} }
}
return htmltext; return htmltext;
} }
@@ -375,6 +374,7 @@ public class VarkaSilenosSupport extends Quest
case HEAL_STATIC: case HEAL_STATIC:
case BALANCE_LIFE: case BALANCE_LIFE:
case HOT: case HOT:
{
for (WorldObject target : skill.getTargetList(caster)) for (WorldObject target : skill.getTargetList(caster))
{ {
// Character isn't existing, or is current caster, we drop check. // Character isn't existing, or is current caster, we drop check.
@@ -420,6 +420,7 @@ public class VarkaSilenosSupport extends Quest
break; break;
} }
} }
}
// Continue normal behavior. // Continue normal behavior.
return null; return null;

View File

@@ -24,26 +24,22 @@ import org.l2jmobius.gameserver.model.quest.State;
public class Q001_LettersOfLove extends Quest public class Q001_LettersOfLove extends Quest
{ {
// Npcs // NPCs
private static final int DARIN = 30048; private static final int DARIN = 30048;
private static final int ROXXY = 30006; private static final int ROXXY = 30006;
private static final int BAULRO = 30033; private static final int BAULRO = 30033;
// Items // Items
private static final int DARIN_LETTER = 687; private static final int DARIN_LETTER = 687;
private static final int ROXXY_KERCHIEF = 688; private static final int ROXXY_KERCHIEF = 688;
private static final int DARIN_RECEIPT = 1079; private static final int DARIN_RECEIPT = 1079;
private static final int BAULRO_POTION = 1080; private static final int BAULRO_POTION = 1080;
// Reward // Reward
private static final int NECKLACE = 906; private static final int NECKLACE = 906;
public Q001_LettersOfLove() public Q001_LettersOfLove()
{ {
super(1, "Letters of Love"); super(1, "Letters of Love");
registerQuestItems(DARIN_LETTER, ROXXY_KERCHIEF, DARIN_RECEIPT, BAULRO_POTION); registerQuestItems(DARIN_LETTER, ROXXY_KERCHIEF, DARIN_RECEIPT, BAULRO_POTION);
addStartNpc(DARIN); addStartNpc(DARIN);
addTalkId(DARIN, ROXXY, BAULRO); addTalkId(DARIN, ROXXY, BAULRO);
} }
@@ -60,9 +56,7 @@ public class Q001_LettersOfLove extends Quest
if (event.equals("30048-06.htm")) if (event.equals("30048-06.htm"))
{ {
st.setState(State.STARTED); st.startQuest();
st.set("cond", "1");
st.playSound(QuestState.SOUND_ACCEPT);
st.giveItems(DARIN_LETTER, 1); st.giveItems(DARIN_LETTER, 1);
} }
@@ -82,14 +76,17 @@ public class Q001_LettersOfLove extends Quest
switch (st.getState()) switch (st.getState())
{ {
case State.CREATED: case State.CREATED:
{
htmltext = (player.getLevel() < 2) ? "30048-01.htm" : "30048-02.htm"; htmltext = (player.getLevel() < 2) ? "30048-01.htm" : "30048-02.htm";
break; break;
}
case State.STARTED: case State.STARTED:
final int cond = st.getInt("cond"); {
final int cond = st.getCond();
switch (npc.getNpcId()) switch (npc.getNpcId())
{ {
case DARIN: case DARIN:
{
if (cond == 1) if (cond == 1)
{ {
htmltext = "30048-07.htm"; htmltext = "30048-07.htm";
@@ -97,7 +94,7 @@ public class Q001_LettersOfLove extends Quest
else if (cond == 2) else if (cond == 2)
{ {
htmltext = "30048-08.htm"; htmltext = "30048-08.htm";
st.set("cond", "3"); st.setCond(3);
st.playSound(QuestState.SOUND_MIDDLE); st.playSound(QuestState.SOUND_MIDDLE);
st.takeItems(ROXXY_KERCHIEF, 1); st.takeItems(ROXXY_KERCHIEF, 1);
st.giveItems(DARIN_RECEIPT, 1); st.giveItems(DARIN_RECEIPT, 1);
@@ -115,12 +112,13 @@ public class Q001_LettersOfLove extends Quest
st.exitQuest(false); st.exitQuest(false);
} }
break; break;
}
case ROXXY: case ROXXY:
{
if (cond == 1) if (cond == 1)
{ {
htmltext = "30006-01.htm"; htmltext = "30006-01.htm";
st.set("cond", "2"); st.setCond(2);
st.playSound(QuestState.SOUND_MIDDLE); st.playSound(QuestState.SOUND_MIDDLE);
st.takeItems(DARIN_LETTER, 1); st.takeItems(DARIN_LETTER, 1);
st.giveItems(ROXXY_KERCHIEF, 1); st.giveItems(ROXXY_KERCHIEF, 1);
@@ -134,12 +132,13 @@ public class Q001_LettersOfLove extends Quest
htmltext = "30006-03.htm"; htmltext = "30006-03.htm";
} }
break; break;
}
case BAULRO: case BAULRO:
{
if (cond == 3) if (cond == 3)
{ {
htmltext = "30033-01.htm"; htmltext = "30033-01.htm";
st.set("cond", "4"); st.setCond(4);
st.playSound(QuestState.SOUND_MIDDLE); st.playSound(QuestState.SOUND_MIDDLE);
st.takeItems(DARIN_RECEIPT, 1); st.takeItems(DARIN_RECEIPT, 1);
st.giveItems(BAULRO_POTION, 1); st.giveItems(BAULRO_POTION, 1);
@@ -150,12 +149,15 @@ public class Q001_LettersOfLove extends Quest
} }
break; break;
} }
}
break; break;
}
case State.COMPLETED: case State.COMPLETED:
{
htmltext = getAlreadyCompletedMsg(); htmltext = getAlreadyCompletedMsg();
break; break;
} }
}
return htmltext; return htmltext;
} }

View File

@@ -30,23 +30,19 @@ public class Q002_WhatWomenWant extends Quest
private static final int MIRABEL = 30146; private static final int MIRABEL = 30146;
private static final int HERBIEL = 30150; private static final int HERBIEL = 30150;
private static final int GREENIS = 30157; private static final int GREENIS = 30157;
// Items // Items
private static final int ARUJIEN_LETTER_1 = 1092; private static final int ARUJIEN_LETTER_1 = 1092;
private static final int ARUJIEN_LETTER_2 = 1093; private static final int ARUJIEN_LETTER_2 = 1093;
private static final int ARUJIEN_LETTER_3 = 1094; private static final int ARUJIEN_LETTER_3 = 1094;
private static final int POETRY_BOOK = 689; private static final int POETRY_BOOK = 689;
private static final int GREENIS_LETTER = 693; private static final int GREENIS_LETTER = 693;
// Rewards // Rewards
private static final int MYSTICS_EARRING = 113; private static final int MYSTICS_EARRING = 113;
public Q002_WhatWomenWant() public Q002_WhatWomenWant()
{ {
super(2, "What Women Want"); super(2, "What Women Want");
registerQuestItems(ARUJIEN_LETTER_1, ARUJIEN_LETTER_2, ARUJIEN_LETTER_3, POETRY_BOOK, GREENIS_LETTER); registerQuestItems(ARUJIEN_LETTER_1, ARUJIEN_LETTER_2, ARUJIEN_LETTER_3, POETRY_BOOK, GREENIS_LETTER);
addStartNpc(ARUJIEN); addStartNpc(ARUJIEN);
addTalkId(ARUJIEN, MIRABEL, HERBIEL, GREENIS); addTalkId(ARUJIEN, MIRABEL, HERBIEL, GREENIS);
} }
@@ -61,26 +57,30 @@ public class Q002_WhatWomenWant extends Quest
return htmltext; return htmltext;
} }
if (event.equals("30223-04.htm")) switch (event)
{ {
st.setState(State.STARTED); case "30223-04.htm":
st.set("cond", "1"); {
st.playSound(QuestState.SOUND_ACCEPT); st.startQuest();
st.giveItems(ARUJIEN_LETTER_1, 1); st.giveItems(ARUJIEN_LETTER_1, 1);
break;
} }
else if (event.equals("30223-08.htm")) case "30223-08.htm":
{ {
st.set("cond", "4"); st.setCond(4);
st.playSound(QuestState.SOUND_MIDDLE); st.playSound(QuestState.SOUND_MIDDLE);
st.takeItems(ARUJIEN_LETTER_3, 1); st.takeItems(ARUJIEN_LETTER_3, 1);
st.giveItems(POETRY_BOOK, 1); st.giveItems(POETRY_BOOK, 1);
break;
} }
else if (event.equals("30223-09.htm")) case "30223-09.htm":
{ {
st.takeItems(ARUJIEN_LETTER_3, 1); st.takeItems(ARUJIEN_LETTER_3, 1);
st.rewardItems(57, 450); st.rewardItems(57, 450);
st.playSound(QuestState.SOUND_FINISH); st.playSound(QuestState.SOUND_FINISH);
st.exitQuest(false); st.exitQuest(false);
break;
}
} }
return htmltext; return htmltext;
@@ -99,6 +99,7 @@ public class Q002_WhatWomenWant extends Quest
switch (st.getState()) switch (st.getState())
{ {
case State.CREATED: case State.CREATED:
{
if ((player.getRace() != Race.ELF) && (player.getRace() != Race.HUMAN)) if ((player.getRace() != Race.ELF) && (player.getRace() != Race.HUMAN))
{ {
htmltext = "30223-00.htm"; htmltext = "30223-00.htm";
@@ -112,12 +113,14 @@ public class Q002_WhatWomenWant extends Quest
htmltext = "30223-02.htm"; htmltext = "30223-02.htm";
} }
break; break;
}
case State.STARTED: case State.STARTED:
final int cond = st.getInt("cond"); {
final int cond = st.getCond();
switch (npc.getNpcId()) switch (npc.getNpcId())
{ {
case ARUJIEN: case ARUJIEN:
{
if (st.hasQuestItems(ARUJIEN_LETTER_1)) if (st.hasQuestItems(ARUJIEN_LETTER_1))
{ {
htmltext = "30223-05.htm"; htmltext = "30223-05.htm";
@@ -143,12 +146,13 @@ public class Q002_WhatWomenWant extends Quest
st.exitQuest(false); st.exitQuest(false);
} }
break; break;
}
case MIRABEL: case MIRABEL:
{
if (cond == 1) if (cond == 1)
{ {
htmltext = "30146-01.htm"; htmltext = "30146-01.htm";
st.set("cond", "2"); st.setCond(2);
st.playSound(QuestState.SOUND_MIDDLE); st.playSound(QuestState.SOUND_MIDDLE);
st.takeItems(ARUJIEN_LETTER_1, 1); st.takeItems(ARUJIEN_LETTER_1, 1);
st.giveItems(ARUJIEN_LETTER_2, 1); st.giveItems(ARUJIEN_LETTER_2, 1);
@@ -158,12 +162,13 @@ public class Q002_WhatWomenWant extends Quest
htmltext = "30146-02.htm"; htmltext = "30146-02.htm";
} }
break; break;
}
case HERBIEL: case HERBIEL:
{
if (cond == 2) if (cond == 2)
{ {
htmltext = "30150-01.htm"; htmltext = "30150-01.htm";
st.set("cond", "3"); st.setCond(3);
st.playSound(QuestState.SOUND_MIDDLE); st.playSound(QuestState.SOUND_MIDDLE);
st.takeItems(ARUJIEN_LETTER_2, 1); st.takeItems(ARUJIEN_LETTER_2, 1);
st.giveItems(ARUJIEN_LETTER_3, 1); st.giveItems(ARUJIEN_LETTER_3, 1);
@@ -173,8 +178,9 @@ public class Q002_WhatWomenWant extends Quest
htmltext = "30150-02.htm"; htmltext = "30150-02.htm";
} }
break; break;
}
case GREENIS: case GREENIS:
{
if (cond < 4) if (cond < 4)
{ {
htmltext = "30157-01.htm"; htmltext = "30157-01.htm";
@@ -182,7 +188,7 @@ public class Q002_WhatWomenWant extends Quest
else if (cond == 4) else if (cond == 4)
{ {
htmltext = "30157-02.htm"; htmltext = "30157-02.htm";
st.set("cond", "5"); st.setCond(5);
st.playSound(QuestState.SOUND_MIDDLE); st.playSound(QuestState.SOUND_MIDDLE);
st.takeItems(POETRY_BOOK, 1); st.takeItems(POETRY_BOOK, 1);
st.giveItems(GREENIS_LETTER, 1); st.giveItems(GREENIS_LETTER, 1);
@@ -193,12 +199,15 @@ public class Q002_WhatWomenWant extends Quest
} }
break; break;
} }
}
break; break;
}
case State.COMPLETED: case State.COMPLETED:
{
htmltext = getAlreadyCompletedMsg(); htmltext = getAlreadyCompletedMsg();
break; break;
} }
}
return htmltext; return htmltext;
} }

View File

@@ -29,19 +29,15 @@ public class Q003_WillTheSealBeBroken extends Quest
private static final int ONYX_BEAST_EYE = 1081; private static final int ONYX_BEAST_EYE = 1081;
private static final int TAINT_STONE = 1082; private static final int TAINT_STONE = 1082;
private static final int SUCCUBUS_BLOOD = 1083; private static final int SUCCUBUS_BLOOD = 1083;
// Reward // Reward
private static final int SCROLL_ENCHANT_ARMOR_D = 956; private static final int SCROLL_ENCHANT_ARMOR_D = 956;
public Q003_WillTheSealBeBroken() public Q003_WillTheSealBeBroken()
{ {
super(3, "Will the Seal be Broken?"); super(3, "Will the Seal be Broken?");
registerQuestItems(ONYX_BEAST_EYE, TAINT_STONE, SUCCUBUS_BLOOD); registerQuestItems(ONYX_BEAST_EYE, TAINT_STONE, SUCCUBUS_BLOOD);
addStartNpc(30141); // Talloth addStartNpc(30141); // Talloth
addTalkId(30141); addTalkId(30141);
addKillId(20031, 20041, 20046, 20048, 20052, 20057); addKillId(20031, 20041, 20046, 20048, 20052, 20057);
} }
@@ -57,9 +53,7 @@ public class Q003_WillTheSealBeBroken extends Quest
if (event.equals("30141-03.htm")) if (event.equals("30141-03.htm"))
{ {
st.setState(State.STARTED); st.startQuest();
st.set("cond", "1");
st.playSound(QuestState.SOUND_ACCEPT);
} }
return htmltext; return htmltext;
@@ -78,6 +72,7 @@ public class Q003_WillTheSealBeBroken extends Quest
switch (st.getState()) switch (st.getState())
{ {
case State.CREATED: case State.CREATED:
{
if (player.getRace() != Race.DARK_ELF) if (player.getRace() != Race.DARK_ELF)
{ {
htmltext = "30141-00.htm"; htmltext = "30141-00.htm";
@@ -91,9 +86,10 @@ public class Q003_WillTheSealBeBroken extends Quest
htmltext = "30141-02.htm"; htmltext = "30141-02.htm";
} }
break; break;
}
case State.STARTED: case State.STARTED:
final int cond = st.getInt("cond"); {
final int cond = st.getCond();
if (cond == 1) if (cond == 1)
{ {
htmltext = "30141-04.htm"; htmltext = "30141-04.htm";
@@ -109,11 +105,13 @@ public class Q003_WillTheSealBeBroken extends Quest
st.exitQuest(false); st.exitQuest(false);
} }
break; break;
}
case State.COMPLETED: case State.COMPLETED:
{
htmltext = getAlreadyCompletedMsg(); htmltext = getAlreadyCompletedMsg();
break; break;
} }
}
return htmltext; return htmltext;
} }
@@ -121,7 +119,7 @@ public class Q003_WillTheSealBeBroken extends Quest
@Override @Override
public String onKill(NpcInstance npc, PlayerInstance player, boolean isPet) public String onKill(NpcInstance npc, PlayerInstance player, boolean isPet)
{ {
final QuestState st = checkPlayerCondition(player, npc, "cond", "1"); final QuestState st = checkPlayerCondition(player, npc, 1);
if (st == null) if (st == null)
{ {
return null; return null;
@@ -130,29 +128,33 @@ public class Q003_WillTheSealBeBroken extends Quest
switch (npc.getNpcId()) switch (npc.getNpcId())
{ {
case 20031: case 20031:
{
if (st.dropItemsAlways(ONYX_BEAST_EYE, 1, 1) && st.hasQuestItems(TAINT_STONE, SUCCUBUS_BLOOD)) if (st.dropItemsAlways(ONYX_BEAST_EYE, 1, 1) && st.hasQuestItems(TAINT_STONE, SUCCUBUS_BLOOD))
{ {
st.set("cond", "2"); st.setCond(2);
} }
break; break;
}
case 20041: case 20041:
case 20046: case 20046:
{
if (st.dropItemsAlways(TAINT_STONE, 1, 1) && st.hasQuestItems(ONYX_BEAST_EYE, SUCCUBUS_BLOOD)) if (st.dropItemsAlways(TAINT_STONE, 1, 1) && st.hasQuestItems(ONYX_BEAST_EYE, SUCCUBUS_BLOOD))
{ {
st.set("cond", "2"); st.setCond(2);
} }
break; break;
}
case 20048: case 20048:
case 20052: case 20052:
case 20057: case 20057:
{
if (st.dropItemsAlways(SUCCUBUS_BLOOD, 1, 1) && st.hasQuestItems(ONYX_BEAST_EYE, TAINT_STONE)) if (st.dropItemsAlways(SUCCUBUS_BLOOD, 1, 1) && st.hasQuestItems(ONYX_BEAST_EYE, TAINT_STONE))
{ {
st.set("cond", "2"); st.setCond(2);
} }
break; break;
} }
}
return null; return null;
} }

View File

@@ -43,9 +43,7 @@ public class Q004_LongliveThePaagrioLord extends Quest
public Q004_LongliveThePaagrioLord() public Q004_LongliveThePaagrioLord()
{ {
super(4, "Long live the Pa'agrio Lord!"); super(4, "Long live the Pa'agrio Lord!");
registerQuestItems(1541, 1542, 1543, 1544, 1545, 1546); registerQuestItems(1541, 1542, 1543, 1544, 1545, 1546);
addStartNpc(30578); // Nakusin addStartNpc(30578); // Nakusin
addTalkId(30578, 30585, 30566, 30562, 30560, 30559, 30587); addTalkId(30578, 30585, 30566, 30562, 30560, 30559, 30587);
} }
@@ -62,9 +60,7 @@ public class Q004_LongliveThePaagrioLord extends Quest
if (event.equals("30578-03.htm")) if (event.equals("30578-03.htm"))
{ {
st.setState(State.STARTED); st.startQuest();
st.set("cond", "1");
st.playSound(QuestState.SOUND_ACCEPT);
} }
return htmltext; return htmltext;
@@ -83,6 +79,7 @@ public class Q004_LongliveThePaagrioLord extends Quest
switch (st.getState()) switch (st.getState())
{ {
case State.CREATED: case State.CREATED:
{
if (player.getRace() != Race.ORC) if (player.getRace() != Race.ORC)
{ {
htmltext = "30578-00.htm"; htmltext = "30578-00.htm";
@@ -96,11 +93,11 @@ public class Q004_LongliveThePaagrioLord extends Quest
htmltext = "30578-02.htm"; htmltext = "30578-02.htm";
} }
break; break;
}
case State.STARTED: case State.STARTED:
final int cond = st.getInt("cond"); {
final int cond = st.getCond();
final int npcId = npc.getNpcId(); final int npcId = npc.getNpcId();
if (npcId == NAKUSIN) if (npcId == NAKUSIN)
{ {
if (cond == 1) if (cond == 1)
@@ -140,7 +137,7 @@ public class Q004_LongliveThePaagrioLord extends Quest
if (count == 6) if (count == 6)
{ {
st.set("cond", "2"); st.setCond(2);
st.playSound(QuestState.SOUND_MIDDLE); st.playSound(QuestState.SOUND_MIDDLE);
} }
else else
@@ -150,11 +147,13 @@ public class Q004_LongliveThePaagrioLord extends Quest
} }
} }
break; break;
}
case State.COMPLETED: case State.COMPLETED:
{
htmltext = getAlreadyCompletedMsg(); htmltext = getAlreadyCompletedMsg();
break; break;
} }
}
return htmltext; return htmltext;
} }

View File

@@ -30,7 +30,6 @@ public class Q005_MinersFavor extends Quest
private static final int GARITA = 30518; private static final int GARITA = 30518;
private static final int REED = 30520; private static final int REED = 30520;
private static final int BRUNON = 30526; private static final int BRUNON = 30526;
// Items // Items
private static final int BOLTERS_LIST = 1547; private static final int BOLTERS_LIST = 1547;
private static final int MINING_BOOTS = 1548; private static final int MINING_BOOTS = 1548;
@@ -38,16 +37,13 @@ public class Q005_MinersFavor extends Quest
private static final int BOOMBOOM_POWDER = 1550; private static final int BOOMBOOM_POWDER = 1550;
private static final int REDSTONE_BEER = 1551; private static final int REDSTONE_BEER = 1551;
private static final int BOLTERS_SMELLY_SOCKS = 1552; private static final int BOLTERS_SMELLY_SOCKS = 1552;
// Reward // Reward
private static final int NECKLACE = 906; private static final int NECKLACE = 906;
public Q005_MinersFavor() public Q005_MinersFavor()
{ {
super(5, "Miner's Favor"); super(5, "Miner's Favor");
registerQuestItems(BOLTERS_LIST, MINING_BOOTS, MINERS_PICK, BOOMBOOM_POWDER, REDSTONE_BEER, BOLTERS_SMELLY_SOCKS); registerQuestItems(BOLTERS_LIST, MINING_BOOTS, MINERS_PICK, BOOMBOOM_POWDER, REDSTONE_BEER, BOLTERS_SMELLY_SOCKS);
addStartNpc(BOLTER); addStartNpc(BOLTER);
addTalkId(BOLTER, SHARI, GARITA, REED, BRUNON); addTalkId(BOLTER, SHARI, GARITA, REED, BRUNON);
} }
@@ -64,9 +60,7 @@ public class Q005_MinersFavor extends Quest
if (event.equals("30554-03.htm")) if (event.equals("30554-03.htm"))
{ {
st.setState(State.STARTED); st.startQuest();
st.set("cond", "1");
st.playSound(QuestState.SOUND_ACCEPT);
st.giveItems(BOLTERS_LIST, 1); st.giveItems(BOLTERS_LIST, 1);
st.giveItems(BOLTERS_SMELLY_SOCKS, 1); st.giveItems(BOLTERS_SMELLY_SOCKS, 1);
} }
@@ -76,7 +70,7 @@ public class Q005_MinersFavor extends Quest
st.giveItems(MINERS_PICK, 1); st.giveItems(MINERS_PICK, 1);
if (st.hasQuestItems(MINING_BOOTS, BOOMBOOM_POWDER, REDSTONE_BEER)) if (st.hasQuestItems(MINING_BOOTS, BOOMBOOM_POWDER, REDSTONE_BEER))
{ {
st.set("cond", "2"); st.setCond(2);
st.playSound(QuestState.SOUND_MIDDLE); st.playSound(QuestState.SOUND_MIDDLE);
} }
else else
@@ -101,14 +95,17 @@ public class Q005_MinersFavor extends Quest
switch (st.getState()) switch (st.getState())
{ {
case State.CREATED: case State.CREATED:
{
htmltext = (player.getLevel() < 2) ? "30554-01.htm" : "30554-02.htm"; htmltext = (player.getLevel() < 2) ? "30554-01.htm" : "30554-02.htm";
break; break;
}
case State.STARTED: case State.STARTED:
final int cond = st.getInt("cond"); {
final int cond = st.getCond();
switch (npc.getNpcId()) switch (npc.getNpcId())
{ {
case BOLTER: case BOLTER:
{
if (cond == 1) if (cond == 1)
{ {
htmltext = "30554-04.htm"; htmltext = "30554-04.htm";
@@ -126,15 +123,16 @@ public class Q005_MinersFavor extends Quest
st.exitQuest(false); st.exitQuest(false);
} }
break; break;
}
case SHARI: case SHARI:
{
if ((cond == 1) && !st.hasQuestItems(BOOMBOOM_POWDER)) if ((cond == 1) && !st.hasQuestItems(BOOMBOOM_POWDER))
{ {
htmltext = "30517-01.htm"; htmltext = "30517-01.htm";
st.giveItems(BOOMBOOM_POWDER, 1); st.giveItems(BOOMBOOM_POWDER, 1);
if (st.hasQuestItems(MINING_BOOTS, MINERS_PICK, REDSTONE_BEER)) if (st.hasQuestItems(MINING_BOOTS, MINERS_PICK, REDSTONE_BEER))
{ {
st.set("cond", "2"); st.setCond(2);
st.playSound(QuestState.SOUND_MIDDLE); st.playSound(QuestState.SOUND_MIDDLE);
} }
else else
@@ -147,15 +145,16 @@ public class Q005_MinersFavor extends Quest
htmltext = "30517-02.htm"; htmltext = "30517-02.htm";
} }
break; break;
}
case GARITA: case GARITA:
{
if ((cond == 1) && !st.hasQuestItems(MINING_BOOTS)) if ((cond == 1) && !st.hasQuestItems(MINING_BOOTS))
{ {
htmltext = "30518-01.htm"; htmltext = "30518-01.htm";
st.giveItems(MINING_BOOTS, 1); st.giveItems(MINING_BOOTS, 1);
if (st.hasQuestItems(MINERS_PICK, BOOMBOOM_POWDER, REDSTONE_BEER)) if (st.hasQuestItems(MINERS_PICK, BOOMBOOM_POWDER, REDSTONE_BEER))
{ {
st.set("cond", "2"); st.setCond(2);
st.playSound(QuestState.SOUND_MIDDLE); st.playSound(QuestState.SOUND_MIDDLE);
} }
else else
@@ -168,15 +167,16 @@ public class Q005_MinersFavor extends Quest
htmltext = "30518-02.htm"; htmltext = "30518-02.htm";
} }
break; break;
}
case REED: case REED:
{
if ((cond == 1) && !st.hasQuestItems(REDSTONE_BEER)) if ((cond == 1) && !st.hasQuestItems(REDSTONE_BEER))
{ {
htmltext = "30520-01.htm"; htmltext = "30520-01.htm";
st.giveItems(REDSTONE_BEER, 1); st.giveItems(REDSTONE_BEER, 1);
if (st.hasQuestItems(MINING_BOOTS, MINERS_PICK, BOOMBOOM_POWDER)) if (st.hasQuestItems(MINING_BOOTS, MINERS_PICK, BOOMBOOM_POWDER))
{ {
st.set("cond", "2"); st.setCond(2);
st.playSound(QuestState.SOUND_MIDDLE); st.playSound(QuestState.SOUND_MIDDLE);
} }
else else
@@ -189,8 +189,9 @@ public class Q005_MinersFavor extends Quest
htmltext = "30520-02.htm"; htmltext = "30520-02.htm";
} }
break; break;
}
case BRUNON: case BRUNON:
{
if ((cond == 1) && !st.hasQuestItems(MINERS_PICK)) if ((cond == 1) && !st.hasQuestItems(MINERS_PICK))
{ {
htmltext = "30526-01.htm"; htmltext = "30526-01.htm";
@@ -201,12 +202,15 @@ public class Q005_MinersFavor extends Quest
} }
break; break;
} }
}
break; break;
}
case State.COMPLETED: case State.COMPLETED:
{
htmltext = getAlreadyCompletedMsg(); htmltext = getAlreadyCompletedMsg();
break; break;
} }
}
return htmltext; return htmltext;
} }

View File

@@ -29,10 +29,8 @@ public class Q006_StepIntoTheFuture extends Quest
private static final int ROXXY = 30006; private static final int ROXXY = 30006;
private static final int BAULRO = 30033; private static final int BAULRO = 30033;
private static final int SIR_COLLIN = 30311; private static final int SIR_COLLIN = 30311;
// Items // Items
private static final int BAULRO_LETTER = 7571; private static final int BAULRO_LETTER = 7571;
// Rewards // Rewards
private static final int MARK_TRAVELER = 7570; private static final int MARK_TRAVELER = 7570;
private static final int SOE_GIRAN = 7559; private static final int SOE_GIRAN = 7559;
@@ -40,9 +38,7 @@ public class Q006_StepIntoTheFuture extends Quest
public Q006_StepIntoTheFuture() public Q006_StepIntoTheFuture()
{ {
super(6, "Step into the Future"); super(6, "Step into the Future");
registerQuestItems(BAULRO_LETTER); registerQuestItems(BAULRO_LETTER);
addStartNpc(ROXXY); addStartNpc(ROXXY);
addTalkId(ROXXY, BAULRO, SIR_COLLIN); addTalkId(ROXXY, BAULRO, SIR_COLLIN);
} }
@@ -57,23 +53,25 @@ public class Q006_StepIntoTheFuture extends Quest
return htmltext; return htmltext;
} }
if (event.equals("30006-03.htm")) switch (event)
{ {
st.setState(State.STARTED); case "30006-03.htm":
st.set("cond", "1"); {
st.playSound(QuestState.SOUND_ACCEPT); st.startQuest();
break;
} }
else if (event.equals("30033-02.htm")) case "30033-02.htm":
{ {
st.set("cond", "2"); st.setCond(2);
st.playSound(QuestState.SOUND_MIDDLE); st.playSound(QuestState.SOUND_MIDDLE);
st.giveItems(BAULRO_LETTER, 1); st.giveItems(BAULRO_LETTER, 1);
break;
} }
else if (event.equals("30311-02.htm")) case "30311-02.htm":
{ {
if (st.hasQuestItems(BAULRO_LETTER)) if (st.hasQuestItems(BAULRO_LETTER))
{ {
st.set("cond", "3"); st.setCond(3);
st.playSound(QuestState.SOUND_MIDDLE); st.playSound(QuestState.SOUND_MIDDLE);
st.takeItems(BAULRO_LETTER, 1); st.takeItems(BAULRO_LETTER, 1);
} }
@@ -81,13 +79,16 @@ public class Q006_StepIntoTheFuture extends Quest
{ {
htmltext = "30311-03.htm"; htmltext = "30311-03.htm";
} }
break;
} }
else if (event.equals("30006-06.htm")) case "30006-06.htm":
{ {
st.giveItems(MARK_TRAVELER, 1); st.giveItems(MARK_TRAVELER, 1);
st.rewardItems(SOE_GIRAN, 1); st.rewardItems(SOE_GIRAN, 1);
st.playSound(QuestState.SOUND_FINISH); st.playSound(QuestState.SOUND_FINISH);
st.exitQuest(false); st.exitQuest(false);
break;
}
} }
return htmltext; return htmltext;
@@ -106,6 +107,7 @@ public class Q006_StepIntoTheFuture extends Quest
switch (st.getState()) switch (st.getState())
{ {
case State.CREATED: case State.CREATED:
{
if ((player.getRace() != Race.HUMAN) || (player.getLevel() < 3)) if ((player.getRace() != Race.HUMAN) || (player.getLevel() < 3))
{ {
htmltext = "30006-01.htm"; htmltext = "30006-01.htm";
@@ -115,12 +117,14 @@ public class Q006_StepIntoTheFuture extends Quest
htmltext = "30006-02.htm"; htmltext = "30006-02.htm";
} }
break; break;
}
case State.STARTED: case State.STARTED:
final int cond = st.getInt("cond"); {
final int cond = st.getCond();
switch (npc.getNpcId()) switch (npc.getNpcId())
{ {
case ROXXY: case ROXXY:
{
if ((cond == 1) || (cond == 2)) if ((cond == 1) || (cond == 2))
{ {
htmltext = "30006-04.htm"; htmltext = "30006-04.htm";
@@ -130,8 +134,9 @@ public class Q006_StepIntoTheFuture extends Quest
htmltext = "30006-05.htm"; htmltext = "30006-05.htm";
} }
break; break;
}
case BAULRO: case BAULRO:
{
if (cond == 1) if (cond == 1)
{ {
htmltext = "30033-01.htm"; htmltext = "30033-01.htm";
@@ -145,8 +150,9 @@ public class Q006_StepIntoTheFuture extends Quest
htmltext = "30033-04.htm"; htmltext = "30033-04.htm";
} }
break; break;
}
case SIR_COLLIN: case SIR_COLLIN:
{
if (cond == 2) if (cond == 2)
{ {
htmltext = "30311-01.htm"; htmltext = "30311-01.htm";
@@ -157,12 +163,15 @@ public class Q006_StepIntoTheFuture extends Quest
} }
break; break;
} }
}
break; break;
}
case State.COMPLETED: case State.COMPLETED:
{
htmltext = getAlreadyCompletedMsg(); htmltext = getAlreadyCompletedMsg();
break; break;
} }
}
return htmltext; return htmltext;
} }

View File

@@ -29,10 +29,8 @@ public class Q007_ATripBegins extends Quest
private static final int MIRABEL = 30146; private static final int MIRABEL = 30146;
private static final int ARIEL = 30148; private static final int ARIEL = 30148;
private static final int ASTERIOS = 30154; private static final int ASTERIOS = 30154;
// Items // Items
private static final int ARIEL_RECO = 7572; private static final int ARIEL_RECO = 7572;
// Rewards // Rewards
private static final int MARK_TRAVELER = 7570; private static final int MARK_TRAVELER = 7570;
private static final int SOE_GIRAN = 7559; private static final int SOE_GIRAN = 7559;
@@ -40,9 +38,7 @@ public class Q007_ATripBegins extends Quest
public Q007_ATripBegins() public Q007_ATripBegins()
{ {
super(7, "A Trip Begins"); super(7, "A Trip Begins");
registerQuestItems(ARIEL_RECO); registerQuestItems(ARIEL_RECO);
addStartNpc(MIRABEL); addStartNpc(MIRABEL);
addTalkId(MIRABEL, ARIEL, ASTERIOS); addTalkId(MIRABEL, ARIEL, ASTERIOS);
} }
@@ -57,30 +53,35 @@ public class Q007_ATripBegins extends Quest
return htmltext; return htmltext;
} }
if (event.equals("30146-03.htm")) switch (event)
{ {
st.setState(State.STARTED); case "30146-03.htm":
st.set("cond", "1"); {
st.playSound(QuestState.SOUND_ACCEPT); st.startQuest();
break;
} }
else if (event.equals("30148-02.htm")) case "30148-02.htm":
{ {
st.set("cond", "2"); st.setCond(2);
st.playSound(QuestState.SOUND_MIDDLE); st.playSound(QuestState.SOUND_MIDDLE);
st.giveItems(ARIEL_RECO, 1); st.giveItems(ARIEL_RECO, 1);
break;
} }
else if (event.equals("30154-02.htm")) case "30154-02.htm":
{ {
st.set("cond", "3"); st.setCond(3);
st.playSound(QuestState.SOUND_MIDDLE); st.playSound(QuestState.SOUND_MIDDLE);
st.takeItems(ARIEL_RECO, 1); st.takeItems(ARIEL_RECO, 1);
break;
} }
else if (event.equals("30146-06.htm")) case "30146-06.htm":
{ {
st.giveItems(MARK_TRAVELER, 1); st.giveItems(MARK_TRAVELER, 1);
st.rewardItems(SOE_GIRAN, 1); st.rewardItems(SOE_GIRAN, 1);
st.playSound(QuestState.SOUND_FINISH); st.playSound(QuestState.SOUND_FINISH);
st.exitQuest(false); st.exitQuest(false);
break;
}
} }
return htmltext; return htmltext;
@@ -99,6 +100,7 @@ public class Q007_ATripBegins extends Quest
switch (st.getState()) switch (st.getState())
{ {
case State.CREATED: case State.CREATED:
{
if (player.getRace() != Race.ELF) if (player.getRace() != Race.ELF)
{ {
htmltext = "30146-01.htm"; htmltext = "30146-01.htm";
@@ -112,12 +114,14 @@ public class Q007_ATripBegins extends Quest
htmltext = "30146-02.htm"; htmltext = "30146-02.htm";
} }
break; break;
}
case State.STARTED: case State.STARTED:
final int cond = st.getInt("cond"); {
final int cond = st.getCond();
switch (npc.getNpcId()) switch (npc.getNpcId())
{ {
case MIRABEL: case MIRABEL:
{
if ((cond == 1) || (cond == 2)) if ((cond == 1) || (cond == 2))
{ {
htmltext = "30146-04.htm"; htmltext = "30146-04.htm";
@@ -127,8 +131,9 @@ public class Q007_ATripBegins extends Quest
htmltext = "30146-05.htm"; htmltext = "30146-05.htm";
} }
break; break;
}
case ARIEL: case ARIEL:
{
if (cond == 1) if (cond == 1)
{ {
htmltext = "30148-01.htm"; htmltext = "30148-01.htm";
@@ -138,8 +143,9 @@ public class Q007_ATripBegins extends Quest
htmltext = "30148-03.htm"; htmltext = "30148-03.htm";
} }
break; break;
}
case ASTERIOS: case ASTERIOS:
{
if (cond == 2) if (cond == 2)
{ {
htmltext = "30154-01.htm"; htmltext = "30154-01.htm";
@@ -150,12 +156,15 @@ public class Q007_ATripBegins extends Quest
} }
break; break;
} }
}
break; break;
}
case State.COMPLETED: case State.COMPLETED:
{
htmltext = getAlreadyCompletedMsg(); htmltext = getAlreadyCompletedMsg();
break; break;
} }
}
return htmltext; return htmltext;
} }

View File

@@ -29,10 +29,8 @@ public class Q008_AnAdventureBegins extends Quest
private static final int JASMINE = 30134; private static final int JASMINE = 30134;
private static final int ROSELYN = 30355; private static final int ROSELYN = 30355;
private static final int HARNE = 30144; private static final int HARNE = 30144;
// Items // Items
private static final int ROSELYN_NOTE = 7573; private static final int ROSELYN_NOTE = 7573;
// Rewards // Rewards
private static final int SOE_GIRAN = 7559; private static final int SOE_GIRAN = 7559;
private static final int MARK_TRAVELER = 7570; private static final int MARK_TRAVELER = 7570;
@@ -40,9 +38,7 @@ public class Q008_AnAdventureBegins extends Quest
public Q008_AnAdventureBegins() public Q008_AnAdventureBegins()
{ {
super(8, "An Adventure Begins"); super(8, "An Adventure Begins");
registerQuestItems(ROSELYN_NOTE); registerQuestItems(ROSELYN_NOTE);
addStartNpc(JASMINE); addStartNpc(JASMINE);
addTalkId(JASMINE, ROSELYN, HARNE); addTalkId(JASMINE, ROSELYN, HARNE);
} }
@@ -57,30 +53,35 @@ public class Q008_AnAdventureBegins extends Quest
return htmltext; return htmltext;
} }
if (event.equals("30134-03.htm")) switch (event)
{ {
st.setState(State.STARTED); case "30134-03.htm":
st.set("cond", "1"); {
st.playSound(QuestState.SOUND_ACCEPT); st.startQuest();
break;
} }
else if (event.equals("30355-02.htm")) case "30355-02.htm":
{ {
st.set("cond", "2"); st.setCond(2);
st.playSound(QuestState.SOUND_MIDDLE); st.playSound(QuestState.SOUND_MIDDLE);
st.giveItems(ROSELYN_NOTE, 1); st.giveItems(ROSELYN_NOTE, 1);
break;
} }
else if (event.equals("30144-02.htm")) case "30144-02.htm":
{ {
st.set("cond", "3"); st.setCond(3);
st.playSound(QuestState.SOUND_MIDDLE); st.playSound(QuestState.SOUND_MIDDLE);
st.takeItems(ROSELYN_NOTE, 1); st.takeItems(ROSELYN_NOTE, 1);
break;
} }
else if (event.equals("30134-06.htm")) case "30134-06.htm":
{ {
st.giveItems(MARK_TRAVELER, 1); st.giveItems(MARK_TRAVELER, 1);
st.rewardItems(SOE_GIRAN, 1); st.rewardItems(SOE_GIRAN, 1);
st.playSound(QuestState.SOUND_FINISH); st.playSound(QuestState.SOUND_FINISH);
st.exitQuest(false); st.exitQuest(false);
break;
}
} }
return htmltext; return htmltext;
@@ -99,6 +100,7 @@ public class Q008_AnAdventureBegins extends Quest
switch (st.getState()) switch (st.getState())
{ {
case State.CREATED: case State.CREATED:
{
if ((player.getLevel() >= 3) && (player.getRace() == Race.DARK_ELF)) if ((player.getLevel() >= 3) && (player.getRace() == Race.DARK_ELF))
{ {
htmltext = "30134-02.htm"; htmltext = "30134-02.htm";
@@ -108,12 +110,14 @@ public class Q008_AnAdventureBegins extends Quest
htmltext = "30134-01.htm"; htmltext = "30134-01.htm";
} }
break; break;
}
case State.STARTED: case State.STARTED:
final int cond = st.getInt("cond"); {
final int cond = st.getCond();
switch (npc.getNpcId()) switch (npc.getNpcId())
{ {
case JASMINE: case JASMINE:
{
if ((cond == 1) || (cond == 2)) if ((cond == 1) || (cond == 2))
{ {
htmltext = "30134-04.htm"; htmltext = "30134-04.htm";
@@ -123,8 +127,9 @@ public class Q008_AnAdventureBegins extends Quest
htmltext = "30134-05.htm"; htmltext = "30134-05.htm";
} }
break; break;
}
case ROSELYN: case ROSELYN:
{
if (cond == 1) if (cond == 1)
{ {
htmltext = "30355-01.htm"; htmltext = "30355-01.htm";
@@ -134,8 +139,9 @@ public class Q008_AnAdventureBegins extends Quest
htmltext = "30355-03.htm"; htmltext = "30355-03.htm";
} }
break; break;
}
case HARNE: case HARNE:
{
if (cond == 2) if (cond == 2)
{ {
htmltext = "30144-01.htm"; htmltext = "30144-01.htm";
@@ -146,12 +152,15 @@ public class Q008_AnAdventureBegins extends Quest
} }
break; break;
} }
}
break; break;
}
case State.COMPLETED: case State.COMPLETED:
{
htmltext = getAlreadyCompletedMsg(); htmltext = getAlreadyCompletedMsg();
break; break;
} }
}
return htmltext; return htmltext;
} }

View File

@@ -29,7 +29,6 @@ public class Q009_IntoTheCityOfHumans extends Quest
private static final int PETUKAI = 30583; private static final int PETUKAI = 30583;
private static final int TANAPI = 30571; private static final int TANAPI = 30571;
private static final int TAMIL = 30576; private static final int TAMIL = 30576;
// Rewards // Rewards
private static final int MARK_OF_TRAVELER = 7570; private static final int MARK_OF_TRAVELER = 7570;
private static final int SOE_GIRAN = 7126; private static final int SOE_GIRAN = 7126;
@@ -37,7 +36,6 @@ public class Q009_IntoTheCityOfHumans extends Quest
public Q009_IntoTheCityOfHumans() public Q009_IntoTheCityOfHumans()
{ {
super(9, "Into the City of Humans"); super(9, "Into the City of Humans");
addStartNpc(PETUKAI); addStartNpc(PETUKAI);
addTalkId(PETUKAI, TANAPI, TAMIL); addTalkId(PETUKAI, TANAPI, TAMIL);
} }
@@ -52,23 +50,27 @@ public class Q009_IntoTheCityOfHumans extends Quest
return htmltext; return htmltext;
} }
if (event.equals("30583-01.htm")) switch (event)
{ {
st.setState(State.STARTED); case "30583-01.htm":
st.set("cond", "1"); {
st.playSound(QuestState.SOUND_ACCEPT); st.startQuest();
break;
} }
else if (event.equals("30571-01.htm")) case "30571-01.htm":
{ {
st.set("cond", "2"); st.setCond(2);
st.playSound(QuestState.SOUND_MIDDLE); st.playSound(QuestState.SOUND_MIDDLE);
break;
} }
else if (event.equals("30576-01.htm")) case "30576-01.htm":
{ {
st.giveItems(MARK_OF_TRAVELER, 1); st.giveItems(MARK_OF_TRAVELER, 1);
st.rewardItems(SOE_GIRAN, 1); st.rewardItems(SOE_GIRAN, 1);
st.playSound(QuestState.SOUND_FINISH); st.playSound(QuestState.SOUND_FINISH);
st.exitQuest(false); st.exitQuest(false);
break;
}
} }
return htmltext; return htmltext;
@@ -87,6 +89,7 @@ public class Q009_IntoTheCityOfHumans extends Quest
switch (st.getState()) switch (st.getState())
{ {
case State.CREATED: case State.CREATED:
{
if ((player.getLevel() >= 3) && (player.getRace() == Race.ORC)) if ((player.getLevel() >= 3) && (player.getRace() == Race.ORC))
{ {
htmltext = "30583-00.htm"; htmltext = "30583-00.htm";
@@ -96,19 +99,22 @@ public class Q009_IntoTheCityOfHumans extends Quest
htmltext = "30583-00a.htm"; htmltext = "30583-00a.htm";
} }
break; break;
}
case State.STARTED: case State.STARTED:
final int cond = st.getInt("cond"); {
final int cond = st.getCond();
switch (npc.getNpcId()) switch (npc.getNpcId())
{ {
case PETUKAI: case PETUKAI:
{
if (cond == 1) if (cond == 1)
{ {
htmltext = "30583-01a.htm"; htmltext = "30583-01a.htm";
} }
break; break;
}
case TANAPI: case TANAPI:
{
if (cond == 1) if (cond == 1)
{ {
htmltext = "30571-00.htm"; htmltext = "30571-00.htm";
@@ -118,20 +124,24 @@ public class Q009_IntoTheCityOfHumans extends Quest
htmltext = "30571-01a.htm"; htmltext = "30571-01a.htm";
} }
break; break;
}
case TAMIL: case TAMIL:
{
if (cond == 2) if (cond == 2)
{ {
htmltext = "30576-00.htm"; htmltext = "30576-00.htm";
} }
break; break;
} }
}
break; break;
}
case State.COMPLETED: case State.COMPLETED:
{
htmltext = getAlreadyCompletedMsg(); htmltext = getAlreadyCompletedMsg();
break; break;
} }
}
return htmltext; return htmltext;
} }

View File

@@ -27,11 +27,9 @@ public class Q010_IntoTheWorld extends Quest
{ {
// Items // Items
private static final int VERY_EXPENSIVE_NECKLACE = 7574; private static final int VERY_EXPENSIVE_NECKLACE = 7574;
// Rewards // Rewards
private static final int SOE_GIRAN = 7559; private static final int SOE_GIRAN = 7559;
private static final int MARK_OF_TRAVELER = 7570; private static final int MARK_OF_TRAVELER = 7570;
// NPCs // NPCs
private static final int REED = 30520; private static final int REED = 30520;
private static final int BALANKI = 30533; private static final int BALANKI = 30533;
@@ -40,9 +38,7 @@ public class Q010_IntoTheWorld extends Quest
public Q010_IntoTheWorld() public Q010_IntoTheWorld()
{ {
super(10, "Into the World"); super(10, "Into the World");
registerQuestItems(VERY_EXPENSIVE_NECKLACE); registerQuestItems(VERY_EXPENSIVE_NECKLACE);
addStartNpc(BALANKI); addStartNpc(BALANKI);
addTalkId(BALANKI, REED, GERALD); addTalkId(BALANKI, REED, GERALD);
} }
@@ -57,35 +53,41 @@ public class Q010_IntoTheWorld extends Quest
return htmltext; return htmltext;
} }
if (event.equals("30533-02.htm")) switch (event)
{ {
st.setState(State.STARTED); case "30533-02.htm":
st.set("cond", "1"); {
st.playSound(QuestState.SOUND_ACCEPT); st.startQuest();
break;
} }
else if (event.equals("30520-02.htm")) case "30520-02.htm":
{ {
st.set("cond", "2"); st.setCond(2);
st.playSound(QuestState.SOUND_MIDDLE); st.playSound(QuestState.SOUND_MIDDLE);
st.giveItems(VERY_EXPENSIVE_NECKLACE, 1); st.giveItems(VERY_EXPENSIVE_NECKLACE, 1);
break;
} }
else if (event.equals("30650-02.htm")) case "30650-02.htm":
{ {
st.set("cond", "3"); st.setCond(3);
st.playSound(QuestState.SOUND_MIDDLE); st.playSound(QuestState.SOUND_MIDDLE);
st.takeItems(VERY_EXPENSIVE_NECKLACE, 1); st.takeItems(VERY_EXPENSIVE_NECKLACE, 1);
break;
} }
else if (event.equals("30520-04.htm")) case "30520-04.htm":
{ {
st.set("cond", "4"); st.setCond(4);
st.playSound(QuestState.SOUND_MIDDLE); st.playSound(QuestState.SOUND_MIDDLE);
break;
} }
else if (event.equals("30533-05.htm")) case "30533-05.htm":
{ {
st.giveItems(SOE_GIRAN, 1); st.giveItems(SOE_GIRAN, 1);
st.rewardItems(MARK_OF_TRAVELER, 1); st.rewardItems(MARK_OF_TRAVELER, 1);
st.playSound(QuestState.SOUND_FINISH); st.playSound(QuestState.SOUND_FINISH);
st.exitQuest(false); st.exitQuest(false);
break;
}
} }
return htmltext; return htmltext;
@@ -104,6 +106,7 @@ public class Q010_IntoTheWorld extends Quest
switch (st.getState()) switch (st.getState())
{ {
case State.CREATED: case State.CREATED:
{
if ((player.getLevel() >= 3) && (player.getRace() == Race.DWARF)) if ((player.getLevel() >= 3) && (player.getRace() == Race.DWARF))
{ {
htmltext = "30533-01.htm"; htmltext = "30533-01.htm";
@@ -113,12 +116,14 @@ public class Q010_IntoTheWorld extends Quest
htmltext = "30533-01a.htm"; htmltext = "30533-01a.htm";
} }
break; break;
}
case State.STARTED: case State.STARTED:
final int cond = st.getInt("cond"); {
final int cond = st.getCond();
switch (npc.getNpcId()) switch (npc.getNpcId())
{ {
case BALANKI: case BALANKI:
{
if (cond < 4) if (cond < 4)
{ {
htmltext = "30533-03.htm"; htmltext = "30533-03.htm";
@@ -128,8 +133,9 @@ public class Q010_IntoTheWorld extends Quest
htmltext = "30533-04.htm"; htmltext = "30533-04.htm";
} }
break; break;
}
case REED: case REED:
{
if (cond == 1) if (cond == 1)
{ {
htmltext = "30520-01.htm"; htmltext = "30520-01.htm";
@@ -147,8 +153,9 @@ public class Q010_IntoTheWorld extends Quest
htmltext = "30520-04a.htm"; htmltext = "30520-04a.htm";
} }
break; break;
}
case GERALD: case GERALD:
{
if (cond == 2) if (cond == 2)
{ {
htmltext = "30650-01.htm"; htmltext = "30650-01.htm";
@@ -159,12 +166,15 @@ public class Q010_IntoTheWorld extends Quest
} }
break; break;
} }
}
break; break;
}
case State.COMPLETED: case State.COMPLETED:
{
htmltext = getAlreadyCompletedMsg(); htmltext = getAlreadyCompletedMsg();
break; break;
} }
}
return htmltext; return htmltext;
} }

View File

@@ -24,20 +24,17 @@ import org.l2jmobius.gameserver.model.quest.State;
public class Q011_SecretMeetingWithKetraOrcs extends Quest public class Q011_SecretMeetingWithKetraOrcs extends Quest
{ {
// Npcs // NPCs
private static final int CADMON = 31296; private static final int CADMON = 31296;
private static final int LEON = 31256; private static final int LEON = 31256;
private static final int WAHKAN = 31371; private static final int WAHKAN = 31371;
// Items // Items
private static final int MUNITIONS_BOX = 7231; private static final int MUNITIONS_BOX = 7231;
public Q011_SecretMeetingWithKetraOrcs() public Q011_SecretMeetingWithKetraOrcs()
{ {
super(11, "Secret Meeting With Ketra Orcs"); super(11, "Secret Meeting With Ketra Orcs");
registerQuestItems(MUNITIONS_BOX); registerQuestItems(MUNITIONS_BOX);
addStartNpc(CADMON); addStartNpc(CADMON);
addTalkId(CADMON, LEON, WAHKAN); addTalkId(CADMON, LEON, WAHKAN);
} }
@@ -52,24 +49,28 @@ public class Q011_SecretMeetingWithKetraOrcs extends Quest
return htmltext; return htmltext;
} }
if (event.equals("31296-03.htm")) switch (event)
{ {
st.setState(State.STARTED); case "31296-03.htm":
st.set("cond", "1"); {
st.playSound(QuestState.SOUND_ACCEPT); st.startQuest();
break;
} }
else if (event.equals("31256-02.htm")) case "31256-02.htm":
{ {
st.giveItems(MUNITIONS_BOX, 1); st.giveItems(MUNITIONS_BOX, 1);
st.set("cond", "2"); st.setCond(2);
st.playSound(QuestState.SOUND_MIDDLE); st.playSound(QuestState.SOUND_MIDDLE);
break;
} }
else if (event.equals("31371-02.htm")) case "31371-02.htm":
{ {
st.takeItems(MUNITIONS_BOX, 1); st.takeItems(MUNITIONS_BOX, 1);
st.rewardExpAndSp(79787, 0); st.rewardExpAndSp(79787, 0);
st.playSound(QuestState.SOUND_FINISH); st.playSound(QuestState.SOUND_FINISH);
st.exitQuest(false); st.exitQuest(false);
break;
}
} }
return htmltext; return htmltext;
@@ -88,21 +89,25 @@ public class Q011_SecretMeetingWithKetraOrcs extends Quest
switch (st.getState()) switch (st.getState())
{ {
case State.CREATED: case State.CREATED:
{
htmltext = (player.getLevel() < 74) ? "31296-02.htm" : "31296-01.htm"; htmltext = (player.getLevel() < 74) ? "31296-02.htm" : "31296-01.htm";
break; break;
}
case State.STARTED: case State.STARTED:
final int cond = st.getInt("cond"); {
final int cond = st.getCond();
switch (npc.getNpcId()) switch (npc.getNpcId())
{ {
case CADMON: case CADMON:
{
if (cond == 1) if (cond == 1)
{ {
htmltext = "31296-04.htm"; htmltext = "31296-04.htm";
} }
break; break;
}
case LEON: case LEON:
{
if (cond == 1) if (cond == 1)
{ {
htmltext = "31256-01.htm"; htmltext = "31256-01.htm";
@@ -112,20 +117,24 @@ public class Q011_SecretMeetingWithKetraOrcs extends Quest
htmltext = "31256-03.htm"; htmltext = "31256-03.htm";
} }
break; break;
}
case WAHKAN: case WAHKAN:
{
if (cond == 2) if (cond == 2)
{ {
htmltext = "31371-01.htm"; htmltext = "31371-01.htm";
} }
break; break;
} }
}
break; break;
}
case State.COMPLETED: case State.COMPLETED:
{
htmltext = getAlreadyCompletedMsg(); htmltext = getAlreadyCompletedMsg();
break; break;
} }
}
return htmltext; return htmltext;
} }

View File

@@ -28,16 +28,13 @@ public class Q012_SecretMeetingWithVarkaSilenos extends Quest
private static final int CADMON = 31296; private static final int CADMON = 31296;
private static final int HELMUT = 31258; private static final int HELMUT = 31258;
private static final int NARAN_ASHANUK = 31378; private static final int NARAN_ASHANUK = 31378;
// Items // Items
private static final int MUNITIONS_BOX = 7232; private static final int MUNITIONS_BOX = 7232;
public Q012_SecretMeetingWithVarkaSilenos() public Q012_SecretMeetingWithVarkaSilenos()
{ {
super(12, "Secret Meeting With Varka Silenos"); super(12, "Secret Meeting With Varka Silenos");
registerQuestItems(MUNITIONS_BOX); registerQuestItems(MUNITIONS_BOX);
addStartNpc(CADMON); addStartNpc(CADMON);
addTalkId(CADMON, HELMUT, NARAN_ASHANUK); addTalkId(CADMON, HELMUT, NARAN_ASHANUK);
} }
@@ -52,24 +49,28 @@ public class Q012_SecretMeetingWithVarkaSilenos extends Quest
return htmltext; return htmltext;
} }
if (event.equals("31296-03.htm")) switch (event)
{ {
st.setState(State.STARTED); case "31296-03.htm":
st.set("cond", "1"); {
st.playSound(QuestState.SOUND_ACCEPT); st.startQuest();
break;
} }
else if (event.equals("31258-02.htm")) case "31258-02.htm":
{ {
st.giveItems(MUNITIONS_BOX, 1); st.giveItems(MUNITIONS_BOX, 1);
st.set("cond", "2"); st.setCond(2);
st.playSound(QuestState.SOUND_MIDDLE); st.playSound(QuestState.SOUND_MIDDLE);
break;
} }
else if (event.equals("31378-02.htm")) case "31378-02.htm":
{ {
st.takeItems(MUNITIONS_BOX, 1); st.takeItems(MUNITIONS_BOX, 1);
st.rewardExpAndSp(79761, 0); st.rewardExpAndSp(79761, 0);
st.playSound(QuestState.SOUND_FINISH); st.playSound(QuestState.SOUND_FINISH);
st.exitQuest(false); st.exitQuest(false);
break;
}
} }
return htmltext; return htmltext;
@@ -88,21 +89,25 @@ public class Q012_SecretMeetingWithVarkaSilenos extends Quest
switch (st.getState()) switch (st.getState())
{ {
case State.CREATED: case State.CREATED:
{
htmltext = (player.getLevel() < 74) ? "31296-02.htm" : "31296-01.htm"; htmltext = (player.getLevel() < 74) ? "31296-02.htm" : "31296-01.htm";
break; break;
}
case State.STARTED: case State.STARTED:
final int cond = st.getInt("cond"); {
final int cond = st.getCond();
switch (npc.getNpcId()) switch (npc.getNpcId())
{ {
case CADMON: case CADMON:
{
if (cond == 1) if (cond == 1)
{ {
htmltext = "31296-04.htm"; htmltext = "31296-04.htm";
} }
break; break;
}
case HELMUT: case HELMUT:
{
if (cond == 1) if (cond == 1)
{ {
htmltext = "31258-01.htm"; htmltext = "31258-01.htm";
@@ -112,20 +117,24 @@ public class Q012_SecretMeetingWithVarkaSilenos extends Quest
htmltext = "31258-03.htm"; htmltext = "31258-03.htm";
} }
break; break;
}
case NARAN_ASHANUK: case NARAN_ASHANUK:
{
if (cond == 2) if (cond == 2)
{ {
htmltext = "31378-01.htm"; htmltext = "31378-01.htm";
} }
break; break;
} }
}
break; break;
}
case State.COMPLETED: case State.COMPLETED:
{
htmltext = getAlreadyCompletedMsg(); htmltext = getAlreadyCompletedMsg();
break; break;
} }
}
return htmltext; return htmltext;
} }

View File

@@ -27,16 +27,13 @@ public class Q013_ParcelDelivery extends Quest
// NPCs // NPCs
private static final int FUNDIN = 31274; private static final int FUNDIN = 31274;
private static final int VULCAN = 31539; private static final int VULCAN = 31539;
// Item // Item
private static final int PACKAGE = 7263; private static final int PACKAGE = 7263;
public Q013_ParcelDelivery() public Q013_ParcelDelivery()
{ {
super(13, "Parcel Delivery"); super(13, "Parcel Delivery");
registerQuestItems(PACKAGE); registerQuestItems(PACKAGE);
addStartNpc(FUNDIN); addStartNpc(FUNDIN);
addTalkId(FUNDIN, VULCAN); addTalkId(FUNDIN, VULCAN);
} }
@@ -53,9 +50,7 @@ public class Q013_ParcelDelivery extends Quest
if (event.equals("31274-2.htm")) if (event.equals("31274-2.htm"))
{ {
st.setState(State.STARTED); st.startQuest();
st.set("cond", "1");
st.playSound(QuestState.SOUND_ACCEPT);
st.giveItems(PACKAGE, 1); st.giveItems(PACKAGE, 1);
} }
else if (event.equals("31539-1.htm")) else if (event.equals("31539-1.htm"))
@@ -82,26 +77,33 @@ public class Q013_ParcelDelivery extends Quest
switch (st.getState()) switch (st.getState())
{ {
case State.CREATED: case State.CREATED:
{
htmltext = (player.getLevel() < 74) ? "31274-1.htm" : "31274-0.htm"; htmltext = (player.getLevel() < 74) ? "31274-1.htm" : "31274-0.htm";
break; break;
}
case State.STARTED: case State.STARTED:
{
switch (npc.getNpcId()) switch (npc.getNpcId())
{ {
case FUNDIN: case FUNDIN:
{
htmltext = "31274-2.htm"; htmltext = "31274-2.htm";
break; break;
}
case VULCAN: case VULCAN:
{
htmltext = "31539-0.htm"; htmltext = "31539-0.htm";
break; break;
} }
}
break; break;
}
case State.COMPLETED: case State.COMPLETED:
{
htmltext = getAlreadyCompletedMsg(); htmltext = getAlreadyCompletedMsg();
break; break;
} }
}
return htmltext; return htmltext;
} }

View File

@@ -27,16 +27,13 @@ public class Q014_WhereaboutsOfTheArchaeologist extends Quest
// NPCs // NPCs
private static final int LIESEL = 31263; private static final int LIESEL = 31263;
private static final int GHOST_OF_ADVENTURER = 31538; private static final int GHOST_OF_ADVENTURER = 31538;
// Items // Items
private static final int LETTER = 7253; private static final int LETTER = 7253;
public Q014_WhereaboutsOfTheArchaeologist() public Q014_WhereaboutsOfTheArchaeologist()
{ {
super(14, "Whereabouts of the Archaeologist"); super(14, "Whereabouts of the Archaeologist");
registerQuestItems(LETTER); registerQuestItems(LETTER);
addStartNpc(LIESEL); addStartNpc(LIESEL);
addTalkId(LIESEL, GHOST_OF_ADVENTURER); addTalkId(LIESEL, GHOST_OF_ADVENTURER);
} }
@@ -53,9 +50,7 @@ public class Q014_WhereaboutsOfTheArchaeologist extends Quest
if (event.equals("31263-2.htm")) if (event.equals("31263-2.htm"))
{ {
st.setState(State.STARTED); st.startQuest();
st.set("cond", "1");
st.playSound(QuestState.SOUND_ACCEPT);
st.giveItems(LETTER, 1); st.giveItems(LETTER, 1);
} }
else if (event.equals("31538-1.htm")) else if (event.equals("31538-1.htm"))
@@ -82,26 +77,33 @@ public class Q014_WhereaboutsOfTheArchaeologist extends Quest
switch (st.getState()) switch (st.getState())
{ {
case State.CREATED: case State.CREATED:
{
htmltext = (player.getLevel() < 74) ? "31263-1.htm" : "31263-0.htm"; htmltext = (player.getLevel() < 74) ? "31263-1.htm" : "31263-0.htm";
break; break;
}
case State.STARTED: case State.STARTED:
{
switch (npc.getNpcId()) switch (npc.getNpcId())
{ {
case LIESEL: case LIESEL:
{
htmltext = "31263-2.htm"; htmltext = "31263-2.htm";
break; break;
}
case GHOST_OF_ADVENTURER: case GHOST_OF_ADVENTURER:
{
htmltext = "31538-0.htm"; htmltext = "31538-0.htm";
break; break;
} }
}
break; break;
}
case State.COMPLETED: case State.COMPLETED:
{
htmltext = getAlreadyCompletedMsg(); htmltext = getAlreadyCompletedMsg();
break; break;
} }
}
return htmltext; return htmltext;
} }

View File

@@ -32,7 +32,6 @@ public class Q015_SweetWhispers extends Quest
public Q015_SweetWhispers() public Q015_SweetWhispers()
{ {
super(15, "Sweet Whispers"); super(15, "Sweet Whispers");
addStartNpc(VLADIMIR); addStartNpc(VLADIMIR);
addTalkId(VLADIMIR, HIERARCH, MYSTERIOUS_NECRO); addTalkId(VLADIMIR, HIERARCH, MYSTERIOUS_NECRO);
} }
@@ -47,22 +46,26 @@ public class Q015_SweetWhispers extends Quest
return htmltext; return htmltext;
} }
if (event.equals("31302-01.htm")) switch (event)
{ {
st.setState(State.STARTED); case "31302-01.htm":
st.set("cond", "1"); {
st.playSound(QuestState.SOUND_ACCEPT); st.startQuest();
break;
} }
else if (event.equals("31518-01.htm")) case "31518-01.htm":
{ {
st.set("cond", "2"); st.setCond(2);
st.playSound(QuestState.SOUND_MIDDLE); st.playSound(QuestState.SOUND_MIDDLE);
break;
} }
else if (event.equals("31517-01.htm")) case "31517-01.htm":
{ {
st.rewardExpAndSp(60217, 0); st.rewardExpAndSp(60217, 0);
st.playSound(QuestState.SOUND_FINISH); st.playSound(QuestState.SOUND_FINISH);
st.exitQuest(false); st.exitQuest(false);
break;
}
} }
return htmltext; return htmltext;
@@ -81,18 +84,22 @@ public class Q015_SweetWhispers extends Quest
switch (st.getState()) switch (st.getState())
{ {
case State.CREATED: case State.CREATED:
{
htmltext = (player.getLevel() < 60) ? "31302-00a.htm" : "31302-00.htm"; htmltext = (player.getLevel() < 60) ? "31302-00a.htm" : "31302-00.htm";
break; break;
}
case State.STARTED: case State.STARTED:
final int cond = st.getInt("cond"); {
final int cond = st.getCond();
switch (npc.getNpcId()) switch (npc.getNpcId())
{ {
case VLADIMIR: case VLADIMIR:
{
htmltext = "31302-01a.htm"; htmltext = "31302-01a.htm";
break; break;
}
case MYSTERIOUS_NECRO: case MYSTERIOUS_NECRO:
{
if (cond == 1) if (cond == 1)
{ {
htmltext = "31518-00.htm"; htmltext = "31518-00.htm";
@@ -102,20 +109,24 @@ public class Q015_SweetWhispers extends Quest
htmltext = "31518-01a.htm"; htmltext = "31518-01a.htm";
} }
break; break;
}
case HIERARCH: case HIERARCH:
{
if (cond == 2) if (cond == 2)
{ {
htmltext = "31517-00.htm"; htmltext = "31517-00.htm";
} }
break; break;
} }
}
break; break;
}
case State.COMPLETED: case State.COMPLETED:
{
htmltext = getAlreadyCompletedMsg(); htmltext = getAlreadyCompletedMsg();
break; break;
} }
}
return htmltext; return htmltext;
} }

View File

@@ -38,9 +38,7 @@ public class Q016_TheComingDarkness extends Quest
public Q016_TheComingDarkness() public Q016_TheComingDarkness()
{ {
super(16, "The Coming Darkness"); super(16, "The Coming Darkness");
registerQuestItems(CRYSTAL_OF_SEAL); registerQuestItems(CRYSTAL_OF_SEAL);
addStartNpc(HIERARCH); addStartNpc(HIERARCH);
addTalkId(HIERARCH, EVIL_ALTAR_1, EVIL_ALTAR_2, EVIL_ALTAR_3, EVIL_ALTAR_4, EVIL_ALTAR_5); addTalkId(HIERARCH, EVIL_ALTAR_1, EVIL_ALTAR_2, EVIL_ALTAR_3, EVIL_ALTAR_4, EVIL_ALTAR_5);
} }
@@ -55,42 +53,49 @@ public class Q016_TheComingDarkness extends Quest
return htmltext; return htmltext;
} }
if (event.equals("31517-2.htm")) switch (event)
{ {
st.setState(State.STARTED); case "31517-2.htm":
st.set("cond", "1"); {
st.playSound(QuestState.SOUND_ACCEPT); st.startQuest();
st.giveItems(CRYSTAL_OF_SEAL, 5); st.giveItems(CRYSTAL_OF_SEAL, 5);
break;
} }
else if (event.equals("31512-1.htm")) case "31512-1.htm":
{ {
st.set("cond", "2"); st.setCond(2);
st.playSound(QuestState.SOUND_MIDDLE); st.playSound(QuestState.SOUND_MIDDLE);
st.takeItems(CRYSTAL_OF_SEAL, 1); st.takeItems(CRYSTAL_OF_SEAL, 1);
break;
} }
else if (event.equals("31513-1.htm")) case "31513-1.htm":
{ {
st.set("cond", "3"); st.setCond(3);
st.playSound(QuestState.SOUND_MIDDLE); st.playSound(QuestState.SOUND_MIDDLE);
st.takeItems(CRYSTAL_OF_SEAL, 1); st.takeItems(CRYSTAL_OF_SEAL, 1);
break;
} }
else if (event.equals("31514-1.htm")) case "31514-1.htm":
{ {
st.set("cond", "4"); st.setCond(4);
st.playSound(QuestState.SOUND_MIDDLE); st.playSound(QuestState.SOUND_MIDDLE);
st.takeItems(CRYSTAL_OF_SEAL, 1); st.takeItems(CRYSTAL_OF_SEAL, 1);
break;
} }
else if (event.equals("31515-1.htm")) case "31515-1.htm":
{ {
st.set("cond", "5"); st.setCond(5);
st.playSound(QuestState.SOUND_MIDDLE); st.playSound(QuestState.SOUND_MIDDLE);
st.takeItems(CRYSTAL_OF_SEAL, 1); st.takeItems(CRYSTAL_OF_SEAL, 1);
break;
} }
else if (event.equals("31516-1.htm")) case "31516-1.htm":
{ {
st.set("cond", "6"); st.setCond(6);
st.playSound(QuestState.SOUND_MIDDLE); st.playSound(QuestState.SOUND_MIDDLE);
st.takeItems(CRYSTAL_OF_SEAL, 1); st.takeItems(CRYSTAL_OF_SEAL, 1);
break;
}
} }
return htmltext; return htmltext;
@@ -109,16 +114,19 @@ public class Q016_TheComingDarkness extends Quest
switch (st.getState()) switch (st.getState())
{ {
case State.CREATED: case State.CREATED:
{
htmltext = (player.getLevel() < 62) ? "31517-0a.htm" : "31517-0.htm"; htmltext = (player.getLevel() < 62) ? "31517-0a.htm" : "31517-0.htm";
break; break;
}
case State.STARTED: case State.STARTED:
final int cond = st.getInt("cond"); {
final int cond = st.getCond();
final int npcId = npc.getNpcId(); final int npcId = npc.getNpcId();
switch (npcId) switch (npcId)
{ {
case HIERARCH: case HIERARCH:
{
if (cond == 6) if (cond == 6)
{ {
htmltext = "31517-4.htm"; htmltext = "31517-4.htm";
@@ -139,12 +147,13 @@ public class Q016_TheComingDarkness extends Quest
} }
} }
break; break;
}
case EVIL_ALTAR_1: case EVIL_ALTAR_1:
case EVIL_ALTAR_2: case EVIL_ALTAR_2:
case EVIL_ALTAR_3: case EVIL_ALTAR_3:
case EVIL_ALTAR_4: case EVIL_ALTAR_4:
case EVIL_ALTAR_5: case EVIL_ALTAR_5:
{
final int condAltar = npcId - 31511; final int condAltar = npcId - 31511;
if (cond == condAltar) if (cond == condAltar)
{ {
@@ -163,12 +172,15 @@ public class Q016_TheComingDarkness extends Quest
} }
break; break;
} }
}
break; break;
}
case State.COMPLETED: case State.COMPLETED:
{
htmltext = getAlreadyCompletedMsg(); htmltext = getAlreadyCompletedMsg();
break; break;
} }
}
return htmltext; return htmltext;
} }

View File

@@ -24,22 +24,19 @@ import org.l2jmobius.gameserver.model.quest.State;
public class Q017_LightAndDarkness extends Quest public class Q017_LightAndDarkness extends Quest
{ {
// Items
private static final int BLOOD_OF_SAINT = 7168;
// NPCs // NPCs
private static final int HIERARCH = 31517; private static final int HIERARCH = 31517;
private static final int SAINT_ALTAR_1 = 31508; private static final int SAINT_ALTAR_1 = 31508;
private static final int SAINT_ALTAR_2 = 31509; private static final int SAINT_ALTAR_2 = 31509;
private static final int SAINT_ALTAR_3 = 31510; private static final int SAINT_ALTAR_3 = 31510;
private static final int SAINT_ALTAR_4 = 31511; private static final int SAINT_ALTAR_4 = 31511;
// Items
private static final int BLOOD_OF_SAINT = 7168;
public Q017_LightAndDarkness() public Q017_LightAndDarkness()
{ {
super(17, "Light and Darkness"); super(17, "Light and Darkness");
registerQuestItems(BLOOD_OF_SAINT); registerQuestItems(BLOOD_OF_SAINT);
addStartNpc(HIERARCH); addStartNpc(HIERARCH);
addTalkId(HIERARCH, SAINT_ALTAR_1, SAINT_ALTAR_2, SAINT_ALTAR_3, SAINT_ALTAR_4); addTalkId(HIERARCH, SAINT_ALTAR_1, SAINT_ALTAR_2, SAINT_ALTAR_3, SAINT_ALTAR_4);
} }
@@ -54,18 +51,19 @@ public class Q017_LightAndDarkness extends Quest
return htmltext; return htmltext;
} }
if (event.equals("31517-04.htm")) switch (event)
{ {
st.setState(State.STARTED); case "31517-04.htm":
st.set("cond", "1"); {
st.playSound(QuestState.SOUND_ACCEPT); st.startQuest();
st.giveItems(BLOOD_OF_SAINT, 4); st.giveItems(BLOOD_OF_SAINT, 4);
break;
} }
else if (event.equals("31508-02.htm")) case "31508-02.htm":
{ {
if (st.hasQuestItems(BLOOD_OF_SAINT)) if (st.hasQuestItems(BLOOD_OF_SAINT))
{ {
st.set("cond", "2"); st.setCond(2);
st.playSound(QuestState.SOUND_MIDDLE); st.playSound(QuestState.SOUND_MIDDLE);
st.takeItems(BLOOD_OF_SAINT, 1); st.takeItems(BLOOD_OF_SAINT, 1);
} }
@@ -73,12 +71,13 @@ public class Q017_LightAndDarkness extends Quest
{ {
htmltext = "31508-03.htm"; htmltext = "31508-03.htm";
} }
break;
} }
else if (event.equals("31509-02.htm")) case "31509-02.htm":
{ {
if (st.hasQuestItems(BLOOD_OF_SAINT)) if (st.hasQuestItems(BLOOD_OF_SAINT))
{ {
st.set("cond", "3"); st.setCond(3);
st.playSound(QuestState.SOUND_MIDDLE); st.playSound(QuestState.SOUND_MIDDLE);
st.takeItems(BLOOD_OF_SAINT, 1); st.takeItems(BLOOD_OF_SAINT, 1);
} }
@@ -86,12 +85,13 @@ public class Q017_LightAndDarkness extends Quest
{ {
htmltext = "31509-03.htm"; htmltext = "31509-03.htm";
} }
break;
} }
else if (event.equals("31510-02.htm")) case "31510-02.htm":
{ {
if (st.hasQuestItems(BLOOD_OF_SAINT)) if (st.hasQuestItems(BLOOD_OF_SAINT))
{ {
st.set("cond", "4"); st.setCond(4);
st.playSound(QuestState.SOUND_MIDDLE); st.playSound(QuestState.SOUND_MIDDLE);
st.takeItems(BLOOD_OF_SAINT, 1); st.takeItems(BLOOD_OF_SAINT, 1);
} }
@@ -99,12 +99,13 @@ public class Q017_LightAndDarkness extends Quest
{ {
htmltext = "31510-03.htm"; htmltext = "31510-03.htm";
} }
break;
} }
else if (event.equals("31511-02.htm")) case "31511-02.htm":
{ {
if (st.hasQuestItems(BLOOD_OF_SAINT)) if (st.hasQuestItems(BLOOD_OF_SAINT))
{ {
st.set("cond", "5"); st.setCond(5);
st.playSound(QuestState.SOUND_MIDDLE); st.playSound(QuestState.SOUND_MIDDLE);
st.takeItems(BLOOD_OF_SAINT, 1); st.takeItems(BLOOD_OF_SAINT, 1);
} }
@@ -112,6 +113,8 @@ public class Q017_LightAndDarkness extends Quest
{ {
htmltext = "31511-03.htm"; htmltext = "31511-03.htm";
} }
break;
}
} }
return htmltext; return htmltext;
@@ -130,14 +133,17 @@ public class Q017_LightAndDarkness extends Quest
switch (st.getState()) switch (st.getState())
{ {
case State.CREATED: case State.CREATED:
{
htmltext = (player.getLevel() < 61) ? "31517-03.htm" : "31517-01.htm"; htmltext = (player.getLevel() < 61) ? "31517-03.htm" : "31517-01.htm";
break; break;
}
case State.STARTED: case State.STARTED:
final int cond = st.getInt("cond"); {
final int cond = st.getCond();
switch (npc.getNpcId()) switch (npc.getNpcId())
{ {
case HIERARCH: case HIERARCH:
{
if (cond == 5) if (cond == 5)
{ {
htmltext = "31517-07.htm"; htmltext = "31517-07.htm";
@@ -158,8 +164,9 @@ public class Q017_LightAndDarkness extends Quest
} }
} }
break; break;
}
case SAINT_ALTAR_1: case SAINT_ALTAR_1:
{
if (cond == 1) if (cond == 1)
{ {
htmltext = "31508-01.htm"; htmltext = "31508-01.htm";
@@ -169,8 +176,9 @@ public class Q017_LightAndDarkness extends Quest
htmltext = "31508-04.htm"; htmltext = "31508-04.htm";
} }
break; break;
}
case SAINT_ALTAR_2: case SAINT_ALTAR_2:
{
if (cond == 2) if (cond == 2)
{ {
htmltext = "31509-01.htm"; htmltext = "31509-01.htm";
@@ -180,8 +188,9 @@ public class Q017_LightAndDarkness extends Quest
htmltext = "31509-04.htm"; htmltext = "31509-04.htm";
} }
break; break;
}
case SAINT_ALTAR_3: case SAINT_ALTAR_3:
{
if (cond == 3) if (cond == 3)
{ {
htmltext = "31510-01.htm"; htmltext = "31510-01.htm";
@@ -191,8 +200,9 @@ public class Q017_LightAndDarkness extends Quest
htmltext = "31510-04.htm"; htmltext = "31510-04.htm";
} }
break; break;
}
case SAINT_ALTAR_4: case SAINT_ALTAR_4:
{
if (cond == 4) if (cond == 4)
{ {
htmltext = "31511-01.htm"; htmltext = "31511-01.htm";
@@ -203,12 +213,15 @@ public class Q017_LightAndDarkness extends Quest
} }
break; break;
} }
}
break; break;
}
case State.COMPLETED: case State.COMPLETED:
{
htmltext = getAlreadyCompletedMsg(); htmltext = getAlreadyCompletedMsg();
break; break;
} }
}
return htmltext; return htmltext;
} }

View File

@@ -24,20 +24,18 @@ import org.l2jmobius.gameserver.model.quest.State;
public class Q018_MeetingWithTheGoldenRam extends Quest public class Q018_MeetingWithTheGoldenRam extends Quest
{ {
// Items
private static final int SUPPLY_BOX = 7245;
// NPCs // NPCs
private static final int DONAL = 31314; private static final int DONAL = 31314;
private static final int DAISY = 31315; private static final int DAISY = 31315;
private static final int ABERCROMBIE = 31555; private static final int ABERCROMBIE = 31555;
// Items
private static final int SUPPLY_BOX = 7245;
public Q018_MeetingWithTheGoldenRam() public Q018_MeetingWithTheGoldenRam()
{ {
super(18, "Meeting with the Golden Ram"); super(18, "Meeting with the Golden Ram");
registerQuestItems(SUPPLY_BOX); registerQuestItems(SUPPLY_BOX);
addStartNpc(DONAL); addStartNpc(DONAL);
addTalkId(DONAL, DAISY, ABERCROMBIE); addTalkId(DONAL, DAISY, ABERCROMBIE);
} }
@@ -52,25 +50,29 @@ public class Q018_MeetingWithTheGoldenRam extends Quest
return htmltext; return htmltext;
} }
if (event.equals("31314-03.htm")) switch (event)
{ {
st.setState(State.STARTED); case "31314-03.htm":
st.set("cond", "1"); {
st.playSound(QuestState.SOUND_ACCEPT); st.startQuest();
break;
} }
else if (event.equals("31315-02.htm")) case "31315-02.htm":
{ {
st.set("cond", "2"); st.setCond(2);
st.playSound(QuestState.SOUND_MIDDLE); st.playSound(QuestState.SOUND_MIDDLE);
st.giveItems(SUPPLY_BOX, 1); st.giveItems(SUPPLY_BOX, 1);
break;
} }
else if (event.equals("31555-02.htm")) case "31555-02.htm":
{ {
st.takeItems(SUPPLY_BOX, 1); st.takeItems(SUPPLY_BOX, 1);
st.rewardItems(57, 15000); st.rewardItems(57, 15000);
st.rewardExpAndSp(50000, 0); st.rewardExpAndSp(50000, 0);
st.playSound(QuestState.SOUND_FINISH); st.playSound(QuestState.SOUND_FINISH);
st.exitQuest(false); st.exitQuest(false);
break;
}
} }
return htmltext; return htmltext;
@@ -89,18 +91,22 @@ public class Q018_MeetingWithTheGoldenRam extends Quest
switch (st.getState()) switch (st.getState())
{ {
case State.CREATED: case State.CREATED:
{
htmltext = (player.getLevel() < 66) ? "31314-02.htm" : "31314-01.htm"; htmltext = (player.getLevel() < 66) ? "31314-02.htm" : "31314-01.htm";
break; break;
}
case State.STARTED: case State.STARTED:
final int cond = st.getInt("cond"); {
final int cond = st.getCond();
switch (npc.getNpcId()) switch (npc.getNpcId())
{ {
case DONAL: case DONAL:
{
htmltext = "31314-04.htm"; htmltext = "31314-04.htm";
break; break;
}
case DAISY: case DAISY:
{
if (cond == 1) if (cond == 1)
{ {
htmltext = "31315-01.htm"; htmltext = "31315-01.htm";
@@ -110,20 +116,24 @@ public class Q018_MeetingWithTheGoldenRam extends Quest
htmltext = "31315-03.htm"; htmltext = "31315-03.htm";
} }
break; break;
}
case ABERCROMBIE: case ABERCROMBIE:
{
if (cond == 2) if (cond == 2)
{ {
htmltext = "31555-01.htm"; htmltext = "31555-01.htm";
} }
break; break;
} }
}
break; break;
}
case State.COMPLETED: case State.COMPLETED:
{
htmltext = getAlreadyCompletedMsg(); htmltext = getAlreadyCompletedMsg();
break; break;
} }
}
return htmltext; return htmltext;
} }

View File

@@ -24,19 +24,16 @@ import org.l2jmobius.gameserver.model.quest.State;
public class Q019_GoToThePastureland extends Quest public class Q019_GoToThePastureland extends Quest
{ {
// Items
private static final int YOUNG_WILD_BEAST_MEAT = 7547;
// NPCs // NPCs
private static final int VLADIMIR = 31302; private static final int VLADIMIR = 31302;
private static final int TUNATUN = 31537; private static final int TUNATUN = 31537;
// Items
private static final int YOUNG_WILD_BEAST_MEAT = 7547;
public Q019_GoToThePastureland() public Q019_GoToThePastureland()
{ {
super(19, "Go to the Pastureland!"); super(19, "Go to the Pastureland!");
registerQuestItems(YOUNG_WILD_BEAST_MEAT); registerQuestItems(YOUNG_WILD_BEAST_MEAT);
addStartNpc(VLADIMIR); addStartNpc(VLADIMIR);
addTalkId(VLADIMIR, TUNATUN); addTalkId(VLADIMIR, TUNATUN);
} }
@@ -53,9 +50,7 @@ public class Q019_GoToThePastureland extends Quest
if (event.equals("31302-01.htm")) if (event.equals("31302-01.htm"))
{ {
st.setState(State.STARTED); st.startQuest();
st.set("cond", "1");
st.playSound(QuestState.SOUND_ACCEPT);
st.giveItems(YOUNG_WILD_BEAST_MEAT, 1); st.giveItems(YOUNG_WILD_BEAST_MEAT, 1);
} }
else if (event.equals("019_finish")) else if (event.equals("019_finish"))
@@ -89,10 +84,12 @@ public class Q019_GoToThePastureland extends Quest
switch (st.getState()) switch (st.getState())
{ {
case State.CREATED: case State.CREATED:
{
htmltext = (player.getLevel() < 63) ? "31302-03.htm" : "31302-00.htm"; htmltext = (player.getLevel() < 63) ? "31302-03.htm" : "31302-00.htm";
break; break;
}
case State.STARTED: case State.STARTED:
{
switch (npc.getNpcId()) switch (npc.getNpcId())
{ {
case VLADIMIR: case VLADIMIR:
@@ -104,11 +101,13 @@ public class Q019_GoToThePastureland extends Quest
break; break;
} }
break; break;
}
case State.COMPLETED: case State.COMPLETED:
{
htmltext = getAlreadyCompletedMsg(); htmltext = getAlreadyCompletedMsg();
break; break;
} }
}
return htmltext; return htmltext;
} }

View File

@@ -30,9 +30,7 @@ public class Q020_BringUpWithLove extends Quest
public Q020_BringUpWithLove() public Q020_BringUpWithLove()
{ {
super(20, "Bring Up With Love"); super(20, "Bring Up With Love");
registerQuestItems(JEWEL_OF_INNOCENCE); registerQuestItems(JEWEL_OF_INNOCENCE);
addStartNpc(31537); // Tunatun addStartNpc(31537); // Tunatun
addTalkId(31537); addTalkId(31537);
} }
@@ -49,9 +47,7 @@ public class Q020_BringUpWithLove extends Quest
if (event.equals("31537-09.htm")) if (event.equals("31537-09.htm"))
{ {
st.setState(State.STARTED); st.startQuest();
st.set("cond", "1");
st.playSound(QuestState.SOUND_ACCEPT);
} }
else if (event.equals("31537-12.htm")) else if (event.equals("31537-12.htm"))
{ {
@@ -77,11 +73,13 @@ public class Q020_BringUpWithLove extends Quest
switch (st.getState()) switch (st.getState())
{ {
case State.CREATED: case State.CREATED:
{
htmltext = (player.getLevel() < 65) ? "31537-02.htm" : "31537-01.htm"; htmltext = (player.getLevel() < 65) ? "31537-02.htm" : "31537-01.htm";
break; break;
}
case State.STARTED: case State.STARTED:
if (st.getInt("cond") == 2) {
if (st.isCond(2))
{ {
htmltext = "31537-11.htm"; htmltext = "31537-11.htm";
} }
@@ -90,11 +88,13 @@ public class Q020_BringUpWithLove extends Quest
htmltext = "31537-10.htm"; htmltext = "31537-10.htm";
} }
break; break;
}
case State.COMPLETED: case State.COMPLETED:
{
htmltext = getAlreadyCompletedMsg(); htmltext = getAlreadyCompletedMsg();
break; break;
} }
}
return htmltext; return htmltext;
} }

View File

@@ -36,7 +36,6 @@ public class Q021_HiddenTruth extends Quest
private static final int DOMINIC = 31350; private static final int DOMINIC = 31350;
private static final int BENEDICT = 31349; private static final int BENEDICT = 31349;
private static final int INNOCENTIN = 31328; private static final int INNOCENTIN = 31328;
// Items // Items
private static final int CROSS_OF_EINHASAD = 7140; private static final int CROSS_OF_EINHASAD = 7140;
private static final int CROSS_OF_EINHASAD_NEXT_QUEST = 7141; private static final int CROSS_OF_EINHASAD_NEXT_QUEST = 7141;
@@ -54,9 +53,7 @@ public class Q021_HiddenTruth extends Quest
public Q021_HiddenTruth() public Q021_HiddenTruth()
{ {
super(21, "Hidden Truth"); super(21, "Hidden Truth");
registerQuestItems(CROSS_OF_EINHASAD); registerQuestItems(CROSS_OF_EINHASAD);
addStartNpc(MYSTERIOUS_WIZARD); addStartNpc(MYSTERIOUS_WIZARD);
addTalkId(MYSTERIOUS_WIZARD, TOMBSTONE, VON_HELLMAN_DUKE, VON_HELLMAN_PAGE, BROKEN_BOOKSHELF, AGRIPEL, DOMINIC, BENEDICT, INNOCENTIN); addTalkId(MYSTERIOUS_WIZARD, TOMBSTONE, VON_HELLMAN_DUKE, VON_HELLMAN_PAGE, BROKEN_BOOKSHELF, AGRIPEL, DOMINIC, BENEDICT, INNOCENTIN);
} }
@@ -71,67 +68,72 @@ public class Q021_HiddenTruth extends Quest
return htmltext; return htmltext;
} }
if (event.equals("31522-02.htm")) switch (event)
{ {
st.setState(State.STARTED); case "31522-02.htm":
st.set("cond", "1"); {
st.playSound(QuestState.SOUND_ACCEPT); st.startQuest();
break;
} }
else if (event.equals("31523-03.htm")) case "31523-03.htm":
{ {
st.set("cond", "2"); st.setCond(2);
st.playSound(QuestState.SOUND_MIDDLE); st.playSound(QuestState.SOUND_MIDDLE);
spawnTheDuke(player); spawnTheDuke(player);
break;
} }
else if (event.equals("31524-06.htm")) case "31524-06.htm":
{ {
st.set("cond", "3"); st.setCond(3);
st.playSound(QuestState.SOUND_MIDDLE); st.playSound(QuestState.SOUND_MIDDLE);
spawnThePage(player); spawnThePage(player);
break;
} }
else if (event.equals("31526-08.htm")) case "31526-08.htm":
{ {
st.set("cond", "5"); st.setCond(5);
st.playSound(QuestState.SOUND_MIDDLE); st.playSound(QuestState.SOUND_MIDDLE);
break;
} }
else if (event.equals("31526-14.htm")) case "31526-14.htm":
{ {
st.set("cond", "6"); st.setCond(6);
st.playSound(QuestState.SOUND_MIDDLE); st.playSound(QuestState.SOUND_MIDDLE);
st.giveItems(CROSS_OF_EINHASAD, 1); st.giveItems(CROSS_OF_EINHASAD, 1);
break;
} }
else if (event.equals("1")) case "1":
{ {
_page.getAI().setIntention(CtrlIntention.AI_INTENTION_MOVE_TO, PAGE_LOCS[0]); _page.getAI().setIntention(CtrlIntention.AI_INTENTION_MOVE_TO, PAGE_LOCS[0]);
_page.broadcastNpcSay("Follow me..."); _page.broadcastNpcSay("Follow me...");
startQuestTimer("2", 5000, _page, player, false); startQuestTimer("2", 5000, _page, player, false);
return null; return null;
} }
else if (event.equals("2")) case "2":
{ {
_page.getAI().setIntention(CtrlIntention.AI_INTENTION_MOVE_TO, PAGE_LOCS[1]); _page.getAI().setIntention(CtrlIntention.AI_INTENTION_MOVE_TO, PAGE_LOCS[1]);
startQuestTimer("3", 12000, _page, player, false); startQuestTimer("3", 12000, _page, player, false);
return null; return null;
} }
else if (event.equals("3")) case "3":
{ {
_page.getAI().setIntention(CtrlIntention.AI_INTENTION_MOVE_TO, PAGE_LOCS[2]); _page.getAI().setIntention(CtrlIntention.AI_INTENTION_MOVE_TO, PAGE_LOCS[2]);
startQuestTimer("4", 18000, _page, player, false); startQuestTimer("4", 18000, _page, player, false);
return null; return null;
} }
else if (event.equals("4")) case "4":
{ {
st.set("end_walk", "1"); st.set("end_walk", "1");
_page.broadcastNpcSay("Please check this bookcase, " + player.getName() + "."); _page.broadcastNpcSay("Please check this bookcase, " + player.getName() + ".");
startQuestTimer("5", 47000, _page, player, false); startQuestTimer("5", 47000, _page, player, false);
return null; return null;
} }
else if (event.equals("5")) case "5":
{ {
_page.broadcastNpcSay("I'm confused! Maybe it's time to go back."); _page.broadcastNpcSay("I'm confused! Maybe it's time to go back.");
return null; return null;
} }
else if (event.equals("31328-05.htm")) case "31328-05.htm":
{ {
if (st.hasQuestItems(CROSS_OF_EINHASAD)) if (st.hasQuestItems(CROSS_OF_EINHASAD))
{ {
@@ -140,19 +142,21 @@ public class Q021_HiddenTruth extends Quest
st.playSound(QuestState.SOUND_FINISH); st.playSound(QuestState.SOUND_FINISH);
st.exitQuest(false); st.exitQuest(false);
} }
break;
} }
else if (event.equals("dukeDespawn")) case "dukeDespawn":
{ {
_duke.deleteMe(); _duke.deleteMe();
_duke = null; _duke = null;
return null; return null;
} }
else if (event.equals("pageDespawn")) case "pageDespawn":
{ {
_page.deleteMe(); _page.deleteMe();
_page = null; _page = null;
return null; return null;
} }
}
return htmltext; return htmltext;
} }
@@ -170,18 +174,22 @@ public class Q021_HiddenTruth extends Quest
switch (st.getState()) switch (st.getState())
{ {
case State.CREATED: case State.CREATED:
{
htmltext = (player.getLevel() < 63) ? "31522-03.htm" : "31522-01.htm"; htmltext = (player.getLevel() < 63) ? "31522-03.htm" : "31522-01.htm";
break; break;
}
case State.STARTED: case State.STARTED:
final int cond = st.getInt("cond"); {
final int cond = st.getCond();
switch (npc.getNpcId()) switch (npc.getNpcId())
{ {
case MYSTERIOUS_WIZARD: case MYSTERIOUS_WIZARD:
{
htmltext = "31522-05.htm"; htmltext = "31522-05.htm";
break; break;
}
case TOMBSTONE: case TOMBSTONE:
{
if (cond == 1) if (cond == 1)
{ {
htmltext = "31523-01.htm"; htmltext = "31523-01.htm";
@@ -196,8 +204,9 @@ public class Q021_HiddenTruth extends Quest
htmltext = "31523-04.htm"; htmltext = "31523-04.htm";
} }
break; break;
}
case VON_HELLMAN_DUKE: case VON_HELLMAN_DUKE:
{
if (cond == 2) if (cond == 2)
{ {
htmltext = "31524-01.htm"; htmltext = "31524-01.htm";
@@ -212,14 +221,15 @@ public class Q021_HiddenTruth extends Quest
htmltext = "31524-07a.htm"; htmltext = "31524-07a.htm";
} }
break; break;
}
case VON_HELLMAN_PAGE: case VON_HELLMAN_PAGE:
{
if (cond == 3) if (cond == 3)
{ {
if (st.getInt("end_walk") == 1) if (st.getInt("end_walk") == 1)
{ {
htmltext = "31525-02.htm"; htmltext = "31525-02.htm";
st.set("cond", "4"); st.setCond(4);
st.playSound(QuestState.SOUND_MIDDLE); st.playSound(QuestState.SOUND_MIDDLE);
} }
else else
@@ -232,12 +242,13 @@ public class Q021_HiddenTruth extends Quest
htmltext = "31525-02.htm"; htmltext = "31525-02.htm";
} }
break; break;
}
case BROKEN_BOOKSHELF: case BROKEN_BOOKSHELF:
{
if (((cond == 3) && (st.getInt("end_walk") == 1)) || (cond == 4)) if (((cond == 3) && (st.getInt("end_walk") == 1)) || (cond == 4))
{ {
htmltext = "31526-01.htm"; htmltext = "31526-01.htm";
st.set("cond", "5"); st.setCond(5);
st.playSound(QuestState.SOUND_MIDDLE); st.playSound(QuestState.SOUND_MIDDLE);
if (_page != null) if (_page != null)
@@ -264,10 +275,11 @@ public class Q021_HiddenTruth extends Quest
htmltext = "31526-15.htm"; htmltext = "31526-15.htm";
} }
break; break;
}
case AGRIPEL: case AGRIPEL:
case BENEDICT: case BENEDICT:
case DOMINIC: case DOMINIC:
{
if (((cond == 6) || (cond == 7)) && st.hasQuestItems(CROSS_OF_EINHASAD)) if (((cond == 6) || (cond == 7)) && st.hasQuestItems(CROSS_OF_EINHASAD))
{ {
final int npcId = npc.getNpcId(); final int npcId = npc.getNpcId();
@@ -295,7 +307,7 @@ public class Q021_HiddenTruth extends Quest
if ((st.getInt(String.valueOf(npcId1)) == 1) && (st.getInt(String.valueOf(npcId2)) == 1)) if ((st.getInt(String.valueOf(npcId1)) == 1) && (st.getInt(String.valueOf(npcId2)) == 1))
{ {
st.set("cond", "7"); st.setCond(7);
st.playSound(QuestState.SOUND_MIDDLE); st.playSound(QuestState.SOUND_MIDDLE);
} }
else else
@@ -307,17 +319,20 @@ public class Q021_HiddenTruth extends Quest
htmltext = npcId + "-01.htm"; htmltext = npcId + "-01.htm";
} }
break; break;
}
case INNOCENTIN: case INNOCENTIN:
{
if ((cond == 7) && st.hasQuestItems(CROSS_OF_EINHASAD)) if ((cond == 7) && st.hasQuestItems(CROSS_OF_EINHASAD))
{ {
htmltext = "31328-01.htm"; htmltext = "31328-01.htm";
} }
break; break;
} }
}
break; break;
}
case State.COMPLETED: case State.COMPLETED:
{
if (npc.getNpcId() == INNOCENTIN) if (npc.getNpcId() == INNOCENTIN)
{ {
htmltext = "31328-06.htm"; htmltext = "31328-06.htm";
@@ -328,6 +343,7 @@ public class Q021_HiddenTruth extends Quest
} }
break; break;
} }
}
return htmltext; return htmltext;
} }

View File

@@ -25,7 +25,6 @@ import org.l2jmobius.gameserver.model.actor.instance.PlayerInstance;
import org.l2jmobius.gameserver.model.quest.Quest; import org.l2jmobius.gameserver.model.quest.Quest;
import org.l2jmobius.gameserver.model.quest.QuestState; import org.l2jmobius.gameserver.model.quest.QuestState;
import org.l2jmobius.gameserver.model.quest.QuestTimer; import org.l2jmobius.gameserver.model.quest.QuestTimer;
import org.l2jmobius.gameserver.model.quest.State;
import org.l2jmobius.gameserver.util.Util; import org.l2jmobius.gameserver.util.Util;
import quests.Q021_HiddenTruth.Q021_HiddenTruth; import quests.Q021_HiddenTruth.Q021_HiddenTruth;
@@ -38,7 +37,7 @@ public class Q022_TragedyInVonHellmannForest extends Quest
private static final int WELL = 31527; private static final int WELL = 31527;
private static final int GHOST_OF_PRIEST = 31528; private static final int GHOST_OF_PRIEST = 31528;
private static final int GHOST_OF_ADVENTURER = 31529; private static final int GHOST_OF_ADVENTURER = 31529;
// Mobs // Monsters
private static final int[] MOBS = private static final int[] MOBS =
{ {
21553, // Trampled Man 21553, // Trampled Man
@@ -66,7 +65,6 @@ public class Q022_TragedyInVonHellmannForest extends Quest
public Q022_TragedyInVonHellmannForest() public Q022_TragedyInVonHellmannForest()
{ {
super(22, "Tragedy in von Hellmann Forest"); super(22, "Tragedy in von Hellmann Forest");
addKillId(MOBS); addKillId(MOBS);
addKillId(SOUL_OF_WELL); addKillId(SOUL_OF_WELL);
addAttackId(SOUL_OF_WELL); addAttackId(SOUL_OF_WELL);
@@ -135,9 +133,7 @@ public class Q022_TragedyInVonHellmannForest extends Quest
{ {
if (qs.isCreated()) if (qs.isCreated())
{ {
qs.setState(State.STARTED); qs.startQuest();
qs.set("cond", "1");
qs.playSound(QuestState.SOUND_ACCEPT);
htmltext = event; htmltext = event;
} }
break; break;
@@ -146,21 +142,21 @@ public class Q022_TragedyInVonHellmannForest extends Quest
{ {
if (!qs.hasQuestItems(CROSS_OF_EINHASAD)) if (!qs.hasQuestItems(CROSS_OF_EINHASAD))
{ {
qs.set("cond", "2"); qs.setCond(2);
htmltext = event; htmltext = event;
} }
else else
{ {
htmltext = "31334-06.htm"; htmltext = "31334-06.htm";
qs.set("cond", "3"); qs.setCond(3);
} }
break; break;
} }
case "31334-08.htm": case "31334-08.htm":
{ {
if (qs.getInt("cond") == 3) if (qs.isCond(3))
{ {
qs.set("cond", "4"); qs.setCond(4);
qs.playSound(QuestState.SOUND_MIDDLE); qs.playSound(QuestState.SOUND_MIDDLE);
htmltext = event; htmltext = event;
} }
@@ -168,7 +164,7 @@ public class Q022_TragedyInVonHellmannForest extends Quest
} }
case "31334-13.htm": case "31334-13.htm":
{ {
final int cond = qs.getInt("cond"); final int cond = qs.getCond();
if (((5 <= cond) && (cond <= 7)) && qs.hasQuestItems(CROSS_OF_EINHASAD)) if (((5 <= cond) && (cond <= 7)) && qs.hasQuestItems(CROSS_OF_EINHASAD))
{ {
if (_tifarenOwner == 0) if (_tifarenOwner == 0)
@@ -181,14 +177,14 @@ public class Q022_TragedyInVonHellmannForest extends Quest
if (((cond == 5) || (cond == 6)) && qs.hasQuestItems(LOST_SKULL_OF_ELF)) if (((cond == 5) || (cond == 6)) && qs.hasQuestItems(LOST_SKULL_OF_ELF))
{ {
qs.takeItems(LOST_SKULL_OF_ELF, -1); qs.takeItems(LOST_SKULL_OF_ELF, -1);
qs.set("cond", "7"); qs.setCond(7);
qs.playSound(QuestState.SOUND_MIDDLE); qs.playSound(QuestState.SOUND_MIDDLE);
} }
htmltext = event; htmltext = event;
} }
else else
{ {
qs.set("cond", "6"); qs.setCond(6);
htmltext = "31334-14.htm"; htmltext = "31334-14.htm";
} }
} }
@@ -211,7 +207,7 @@ public class Q022_TragedyInVonHellmannForest extends Quest
qt.cancel(); qt.cancel();
npc.setScriptValue(0); npc.setScriptValue(0);
startQuestTimer("DESPAWN_GHOST2", 1000 * 3, npc, player); startQuestTimer("DESPAWN_GHOST2", 1000 * 3, npc, player);
qs.set("cond", "8"); qs.setCond(8);
qs.playSound(QuestState.SOUND_MIDDLE); qs.playSound(QuestState.SOUND_MIDDLE);
htmltext = event; htmltext = event;
} }
@@ -229,7 +225,7 @@ public class Q022_TragedyInVonHellmannForest extends Quest
} }
case "31328-03.htm": case "31328-03.htm":
{ {
if (qs.getInt("cond") == 8) if (qs.isCond(8))
{ {
qs.takeItems(CROSS_OF_EINHASAD, -1); qs.takeItems(CROSS_OF_EINHASAD, -1);
@@ -239,10 +235,10 @@ public class Q022_TragedyInVonHellmannForest extends Quest
} }
case "31328-09.htm": case "31328-09.htm":
{ {
if (qs.getInt("cond") == 8) if (qs.isCond(8))
{ {
qs.giveItems(LETTER_OF_INNOCENTIN, 1); qs.giveItems(LETTER_OF_INNOCENTIN, 1);
qs.set("cond", "9"); qs.setCond(9);
qs.playSound(QuestState.SOUND_MIDDLE); qs.playSound(QuestState.SOUND_MIDDLE);
htmltext = event; htmltext = event;
} }
@@ -250,10 +246,10 @@ public class Q022_TragedyInVonHellmannForest extends Quest
} }
case "31328-11.htm": case "31328-11.htm":
{ {
if ((qs.getInt("cond") == 14) && qs.hasQuestItems(REPORT_BOX)) if (qs.isCond(14) && qs.hasQuestItems(REPORT_BOX))
{ {
qs.takeItems(REPORT_BOX, -1); qs.takeItems(REPORT_BOX, -1);
qs.set("cond", "15"); qs.setCond(15);
qs.playSound(QuestState.SOUND_MIDDLE); qs.playSound(QuestState.SOUND_MIDDLE);
htmltext = event; htmltext = event;
} }
@@ -261,9 +257,9 @@ public class Q022_TragedyInVonHellmannForest extends Quest
} }
case "31328-19.htm": case "31328-19.htm":
{ {
if (qs.getInt("cond") == 15) if (qs.isCond(15))
{ {
qs.set("cond", "16"); qs.setCond(16);
qs.playSound(QuestState.SOUND_MIDDLE); qs.playSound(QuestState.SOUND_MIDDLE);
htmltext = event; htmltext = event;
} }
@@ -271,7 +267,7 @@ public class Q022_TragedyInVonHellmannForest extends Quest
} }
case "31527-02.htm": case "31527-02.htm":
{ {
if ((qs.getInt("cond") == 10) && (_soulWellNpc == null)) if (qs.isCond(10) && (_soulWellNpc == null))
{ {
_soulWellNpc = addSpawn(SOUL_OF_WELL, SOUL_WELL_LOC, true, 0); _soulWellNpc = addSpawn(SOUL_OF_WELL, SOUL_WELL_LOC, true, 0);
startQuestTimer("activateSoulOfWell", 90000, _soulWellNpc, player); startQuestTimer("activateSoulOfWell", 90000, _soulWellNpc, player);
@@ -304,7 +300,7 @@ public class Q022_TragedyInVonHellmannForest extends Quest
} }
case "31529-03.htm": case "31529-03.htm":
{ {
if ((qs.getInt("cond") == 9) && qs.hasQuestItems(LETTER_OF_INNOCENTIN)) if (qs.isCond(9) && qs.hasQuestItems(LETTER_OF_INNOCENTIN))
{ {
qs.set("memoState", "8"); qs.set("memoState", "8");
htmltext = event; htmltext = event;
@@ -325,7 +321,7 @@ public class Q022_TragedyInVonHellmannForest extends Quest
if (qs.getInt("memoState") == 9) if (qs.getInt("memoState") == 9)
{ {
qs.giveItems(JEWEL_OF_ADVENTURER_1, 1); qs.giveItems(JEWEL_OF_ADVENTURER_1, 1);
qs.set("cond", "10"); qs.setCond(10);
qs.playSound(QuestState.SOUND_MIDDLE); qs.playSound(QuestState.SOUND_MIDDLE);
qs.set("memoState", "10"); qs.set("memoState", "10");
htmltext = event; htmltext = event;
@@ -345,7 +341,7 @@ public class Q022_TragedyInVonHellmannForest extends Quest
{ {
case TIFAREN: case TIFAREN:
{ {
switch (qs.getInt("cond")) switch (qs.getCond())
{ {
case 0: case 0:
{ {
@@ -401,7 +397,7 @@ public class Q022_TragedyInVonHellmannForest extends Quest
else else
{ {
htmltext = "31334-16.htm"; htmltext = "31334-16.htm";
qs.set("cond", "6"); qs.setCond(6);
} }
} }
break; break;
@@ -431,14 +427,14 @@ public class Q022_TragedyInVonHellmannForest extends Quest
} }
case INNOCENTIN: case INNOCENTIN:
{ {
switch (qs.getInt("cond")) switch (qs.getCond())
{ {
case 2: case 2:
{ {
if (!qs.hasQuestItems(CROSS_OF_EINHASAD)) if (!qs.hasQuestItems(CROSS_OF_EINHASAD))
{ {
qs.giveItems(CROSS_OF_EINHASAD, 1); qs.giveItems(CROSS_OF_EINHASAD, 1);
qs.set("cond", "3"); qs.setCond(3);
htmltext = "31328-01.htm"; htmltext = "31328-01.htm";
} }
break; break;
@@ -500,7 +496,7 @@ public class Q022_TragedyInVonHellmannForest extends Quest
} }
case WELL: case WELL:
{ {
switch (qs.getInt("cond")) switch (qs.getCond())
{ {
case 10: case 10:
{ {
@@ -516,7 +512,7 @@ public class Q022_TragedyInVonHellmannForest extends Quest
if (qs.hasQuestItems(JEWEL_OF_ADVENTURER_2) && !qs.hasQuestItems(SEALED_REPORT_BOX)) if (qs.hasQuestItems(JEWEL_OF_ADVENTURER_2) && !qs.hasQuestItems(SEALED_REPORT_BOX))
{ {
qs.giveItems(SEALED_REPORT_BOX, 1); qs.giveItems(SEALED_REPORT_BOX, 1);
qs.set("cond", "13"); qs.setCond(13);
htmltext = "31527-04.htm"; htmltext = "31527-04.htm";
} }
break; break;
@@ -534,7 +530,7 @@ public class Q022_TragedyInVonHellmannForest extends Quest
} }
case GHOST_OF_ADVENTURER: case GHOST_OF_ADVENTURER:
{ {
switch (qs.getInt("cond")) switch (qs.getCond())
{ {
case 9: case 9:
{ {
@@ -586,7 +582,7 @@ public class Q022_TragedyInVonHellmannForest extends Quest
if (qs.hasQuestItems(JEWEL_OF_ADVENTURER_2) && !qs.hasQuestItems(SEALED_REPORT_BOX)) if (qs.hasQuestItems(JEWEL_OF_ADVENTURER_2) && !qs.hasQuestItems(SEALED_REPORT_BOX))
{ {
htmltext = "31529-15.htm"; htmltext = "31529-15.htm";
qs.set("cond", "12"); qs.setCond(12);
} }
break; break;
} }
@@ -597,7 +593,7 @@ public class Q022_TragedyInVonHellmannForest extends Quest
qs.giveItems(REPORT_BOX, 1); qs.giveItems(REPORT_BOX, 1);
qs.takeItems(SEALED_REPORT_BOX, -1); qs.takeItems(SEALED_REPORT_BOX, -1);
qs.takeItems(JEWEL_OF_ADVENTURER_2, -1); qs.takeItems(JEWEL_OF_ADVENTURER_2, -1);
qs.set("cond", "14"); qs.setCond(14);
htmltext = "31529-16.htm"; htmltext = "31529-16.htm";
} }
break; break;
@@ -621,7 +617,7 @@ public class Q022_TragedyInVonHellmannForest extends Quest
public String onAttack(NpcInstance npc, PlayerInstance attacker, int damage, boolean isSummon) public String onAttack(NpcInstance npc, PlayerInstance attacker, int damage, boolean isSummon)
{ {
final QuestState qs = attacker.getQuestState(getName()); final QuestState qs = attacker.getQuestState(getName());
if ((qs != null) && (qs.getInt("cond") == 10) && qs.hasQuestItems(JEWEL_OF_ADVENTURER_1)) if ((qs != null) && qs.isCond(10) && qs.hasQuestItems(JEWEL_OF_ADVENTURER_1))
{ {
if (qs.getInt("memoState") == 10) if (qs.getInt("memoState") == 10)
{ {
@@ -631,7 +627,7 @@ public class Q022_TragedyInVonHellmannForest extends Quest
{ {
qs.takeItems(JEWEL_OF_ADVENTURER_1, -1); qs.takeItems(JEWEL_OF_ADVENTURER_1, -1);
qs.giveItems(JEWEL_OF_ADVENTURER_2, 1); qs.giveItems(JEWEL_OF_ADVENTURER_2, 1);
qs.set("cond", "11"); qs.setCond(11);
} }
} }
return super.onAttack(npc, attacker, damage, isSummon); return super.onAttack(npc, attacker, damage, isSummon);
@@ -649,10 +645,10 @@ public class Q022_TragedyInVonHellmannForest extends Quest
else else
{ {
final QuestState qs = killer.getQuestState(getName()); final QuestState qs = killer.getQuestState(getName());
if ((qs != null) && (qs.getInt("cond") == 4) && qs.hasQuestItems(CROSS_OF_EINHASAD) && !qs.hasQuestItems(LOST_SKULL_OF_ELF) && (Rnd.get(100) < 10)) if ((qs != null) && qs.isCond(4) && qs.hasQuestItems(CROSS_OF_EINHASAD) && !qs.hasQuestItems(LOST_SKULL_OF_ELF) && (Rnd.get(100) < 10))
{ {
qs.giveItems(LOST_SKULL_OF_ELF, 1); qs.giveItems(LOST_SKULL_OF_ELF, 1);
qs.set("cond", "5"); qs.setCond(5);
} }
} }
} }

View File

@@ -64,27 +64,29 @@ public class Q023_LidiasHeart extends Quest
return htmltext; return htmltext;
} }
if (event.equals("31328-02.htm")) switch (event)
{ {
st.setState(State.STARTED); case "31328-02.htm":
st.set("cond", "1"); {
st.playSound(QuestState.SOUND_ACCEPT); st.startQuest();
st.giveItems(FOREST_OF_DEADMAN_MAP, 1); st.giveItems(FOREST_OF_DEADMAN_MAP, 1);
st.giveItems(SILVER_KEY, 1); st.giveItems(SILVER_KEY, 1);
break;
} }
else if (event.equals("31328-06.htm")) case "31328-06.htm":
{ {
st.set("cond", "2"); st.setCond(2);
st.playSound(QuestState.SOUND_MIDDLE); st.playSound(QuestState.SOUND_MIDDLE);
break;
} }
else if (event.equals("31526-05.htm")) case "31526-05.htm":
{ {
if (!st.hasQuestItems(LIDIA_HAIRPIN)) if (!st.hasQuestItems(LIDIA_HAIRPIN))
{ {
st.giveItems(LIDIA_HAIRPIN, 1); st.giveItems(LIDIA_HAIRPIN, 1);
if (st.hasQuestItems(LIDIA_DIARY)) if (st.hasQuestItems(LIDIA_DIARY))
{ {
st.set("cond", "4"); st.setCond(4);
st.playSound(QuestState.SOUND_MIDDLE); st.playSound(QuestState.SOUND_MIDDLE);
} }
else else
@@ -92,15 +94,16 @@ public class Q023_LidiasHeart extends Quest
st.playSound(QuestState.SOUND_ITEMGET); st.playSound(QuestState.SOUND_ITEMGET);
} }
} }
break;
} }
else if (event.equals("31526-11.htm")) case "31526-11.htm":
{ {
if (!st.hasQuestItems(LIDIA_DIARY)) if (!st.hasQuestItems(LIDIA_DIARY))
{ {
st.giveItems(LIDIA_DIARY, 1); st.giveItems(LIDIA_DIARY, 1);
if (st.hasQuestItems(LIDIA_HAIRPIN)) if (st.hasQuestItems(LIDIA_HAIRPIN))
{ {
st.set("cond", "4"); st.setCond(4);
st.playSound(QuestState.SOUND_MIDDLE); st.playSound(QuestState.SOUND_MIDDLE);
} }
else else
@@ -108,27 +111,31 @@ public class Q023_LidiasHeart extends Quest
st.playSound(QuestState.SOUND_ITEMGET); st.playSound(QuestState.SOUND_ITEMGET);
} }
} }
break;
} }
else if (event.equals("31328-11.htm")) case "31328-11.htm":
{ {
if (st.getInt("cond") < 5) if (st.getCond() < 5)
{ {
st.set("cond", "5"); st.setCond(5);
st.playSound(QuestState.SOUND_MIDDLE); st.playSound(QuestState.SOUND_MIDDLE);
} }
break;
} }
else if (event.equals("31328-19.htm")) case "31328-19.htm":
{ {
st.set("cond", "6"); st.setCond(6);
st.playSound(QuestState.SOUND_MIDDLE); st.playSound(QuestState.SOUND_MIDDLE);
break;
} }
else if (event.equals("31524-04.htm")) case "31524-04.htm":
{ {
st.set("cond", "7"); st.setCond(7);
st.playSound(QuestState.SOUND_MIDDLE); st.playSound(QuestState.SOUND_MIDDLE);
st.takeItems(LIDIA_DIARY, 1); st.takeItems(LIDIA_DIARY, 1);
break;
} }
else if (event.equals("31523-02.htm")) case "31523-02.htm":
{ {
if (_ghost == null) if (_ghost == null)
{ {
@@ -136,34 +143,39 @@ public class Q023_LidiasHeart extends Quest
_ghost.broadcastNpcSay("Who awoke me?"); _ghost.broadcastNpcSay("Who awoke me?");
startQuestTimer("ghost_cleanup", 58000, null, player, false); startQuestTimer("ghost_cleanup", 58000, null, player, false);
} }
break;
} }
else if (event.equals("31523-05.htm")) case "31523-05.htm":
{ {
// Don't launch twice the same task... // Don't launch twice the same task...
if (getQuestTimer("tomb_digger", null, player) == null) if (getQuestTimer("tomb_digger", null, player) == null)
{ {
startQuestTimer("tomb_digger", 10000, null, player, false); startQuestTimer("tomb_digger", 10000, null, player, false);
} }
break;
} }
else if (event.equals("tomb_digger")) case "tomb_digger":
{ {
htmltext = "31523-06.htm"; htmltext = "31523-06.htm";
st.set("cond", "8"); st.setCond(8);
st.playSound(QuestState.SOUND_MIDDLE); st.playSound(QuestState.SOUND_MIDDLE);
st.giveItems(SILVER_KEY, 1); st.giveItems(SILVER_KEY, 1);
break;
} }
else if (event.equals("31530-02.htm")) case "31530-02.htm":
{ {
st.set("cond", "10"); st.setCond(10);
st.playSound(QuestState.SOUND_MIDDLE); st.playSound(QuestState.SOUND_MIDDLE);
st.takeItems(SILVER_KEY, 1); st.takeItems(SILVER_KEY, 1);
st.giveItems(SILVER_SPEAR, 1); st.giveItems(SILVER_SPEAR, 1);
break;
} }
else if (event.equals("ghost_cleanup")) case "ghost_cleanup":
{ {
_ghost = null; _ghost = null;
return null; return null;
} }
}
return htmltext; return htmltext;
} }
@@ -180,6 +192,7 @@ public class Q023_LidiasHeart extends Quest
switch (st.getState()) switch (st.getState())
{ {
case State.CREATED: case State.CREATED:
{
final QuestState st2 = player.getQuestState(Q022_TragedyInVonHellmannForest.class.getSimpleName()); final QuestState st2 = player.getQuestState(Q022_TragedyInVonHellmannForest.class.getSimpleName());
if ((st2 != null) && st2.isCompleted()) if ((st2 != null) && st2.isCompleted())
{ {
@@ -197,12 +210,14 @@ public class Q023_LidiasHeart extends Quest
htmltext = "31328-00.htm"; htmltext = "31328-00.htm";
} }
break; break;
}
case State.STARTED: case State.STARTED:
final int cond = st.getInt("cond"); {
final int cond = st.getCond();
switch (npc.getNpcId()) switch (npc.getNpcId())
{ {
case INNOCENTIN: case INNOCENTIN:
{
if (cond == 1) if (cond == 1)
{ {
htmltext = "31328-03.htm"; htmltext = "31328-03.htm";
@@ -224,12 +239,13 @@ public class Q023_LidiasHeart extends Quest
htmltext = "31328-21.htm"; htmltext = "31328-21.htm";
} }
break; break;
}
case BROKEN_BOOKSHELF: case BROKEN_BOOKSHELF:
{
if (cond == 2) if (cond == 2)
{ {
htmltext = "31526-00.htm"; htmltext = "31526-00.htm";
st.set("cond", "3"); st.setCond(3);
st.playSound(QuestState.SOUND_MIDDLE); st.playSound(QuestState.SOUND_MIDDLE);
} }
else if (cond == 3) else if (cond == 3)
@@ -248,8 +264,9 @@ public class Q023_LidiasHeart extends Quest
htmltext = "31526-13.htm"; htmltext = "31526-13.htm";
} }
break; break;
}
case GHOST_OF_VON_HELLMANN: case GHOST_OF_VON_HELLMANN:
{
if (cond == 6) if (cond == 6)
{ {
htmltext = "31524-01.htm"; htmltext = "31524-01.htm";
@@ -259,8 +276,9 @@ public class Q023_LidiasHeart extends Quest
htmltext = "31524-05.htm"; htmltext = "31524-05.htm";
} }
break; break;
}
case TOMBSTONE: case TOMBSTONE:
{
if (cond == 6) if (cond == 6)
{ {
htmltext = (_ghost == null) ? "31523-01.htm" : "31523-03.htm"; htmltext = (_ghost == null) ? "31523-01.htm" : "31523-03.htm";
@@ -274,12 +292,13 @@ public class Q023_LidiasHeart extends Quest
htmltext = "31523-06.htm"; htmltext = "31523-06.htm";
} }
break; break;
}
case VIOLET: case VIOLET:
{
if (cond == 8) if (cond == 8)
{ {
htmltext = "31386-01.htm"; htmltext = "31386-01.htm";
st.set("cond", "9"); st.setCond(9);
st.playSound(QuestState.SOUND_MIDDLE); st.playSound(QuestState.SOUND_MIDDLE);
} }
else if (cond == 9) else if (cond == 9)
@@ -299,12 +318,13 @@ public class Q023_LidiasHeart extends Quest
else else
{ {
htmltext = "31386-02.htm"; htmltext = "31386-02.htm";
st.set("cond", "9"); st.setCond(9);
} }
} }
break; break;
}
case BOX: case BOX:
{
if (cond == 9) if (cond == 9)
{ {
htmltext = "31530-01.htm"; htmltext = "31530-01.htm";
@@ -315,9 +335,11 @@ public class Q023_LidiasHeart extends Quest
} }
break; break;
} }
}
break; break;
}
case State.COMPLETED: case State.COMPLETED:
{
if (npc.getNpcId() == VIOLET) if (npc.getNpcId() == VIOLET)
{ {
htmltext = "31386-04.htm"; htmltext = "31386-04.htm";
@@ -328,6 +350,7 @@ public class Q023_LidiasHeart extends Quest
} }
break; break;
} }
}
return htmltext; return htmltext;
} }

View File

@@ -67,71 +67,82 @@ public class Q024_InhabitantsOfTheForestOfTheDead extends Quest
@Override @Override
public String onAdvEvent(String event, NpcInstance npc, PlayerInstance player) public String onAdvEvent(String event, NpcInstance npc, PlayerInstance player)
{ {
String htmltext = event;
QuestState st = player.getQuestState(getName()); QuestState st = player.getQuestState(getName());
if (st == null) if (st == null)
{ {
return event; return event;
} }
if (event.equals("31389-03.htm"))
String htmltext = event;
switch (event)
{ {
st.setState(State.STARTED); case "31389-03.htm":
st.set("cond", "1"); {
st.startQuest();
st.set("state", "1"); st.set("state", "1");
st.playSound("ItemSound.quest_accept");
st.giveItems(FLOWER, 1); st.giveItems(FLOWER, 1);
break;
} }
else if (event.equals("31389-08.htm")) case "31389-08.htm":
{ {
st.set("state", "3"); st.set("state", "3");
break;
} }
else if (event.equals("31389-13.htm")) case "31389-13.htm":
{ {
st.set("cond", "3"); st.setCond(3);
st.set("state", "4"); st.set("state", "4");
st.playSound("ItemSound.quest_middle"); st.playSound(QuestState.SOUND_MIDDLE);
st.giveItems(SILVER_CROSS, 1); st.giveItems(SILVER_CROSS, 1);
break;
} }
else if (event.equals("31389-18.htm")) case "31389-18.htm":
{ {
st.playSound("InterfaceSound.charstat_open_01"); st.playSound("InterfaceSound.charstat_open_01");
break;
} }
else if (event.equals("31389-19.htm")) case "31389-19.htm":
{ {
st.set("cond", "5"); st.setCond(5);
st.set("state", "5"); st.set("state", "5");
st.takeItems(BROKEN_SILVER_CROSS, -1); st.takeItems(BROKEN_SILVER_CROSS, -1);
st.playSound("ItemSound.quest_middle"); st.playSound(QuestState.SOUND_MIDDLE);
break;
} }
else if (event.equals("31522-03.htm")) case "31522-03.htm":
{ {
st.set("state", "12"); st.set("state", "12");
st.takeItems(TOTEM, -1); st.takeItems(TOTEM, -1);
break;
} }
else if (event.equals("31522-08.htm")) case "31522-08.htm":
{ {
st.set("cond", "11"); st.setCond(11);
st.set("state", "13"); st.set("state", "13");
st.playSound("ItemSound.quest_middle"); st.playSound(QuestState.SOUND_MIDDLE);
break;
} }
else if (event.equals("31522-17.htm")) case "31522-17.htm":
{ {
st.set("state", "14"); st.set("state", "14");
break;
} }
else if (event.equals("31522-21.htm")) case "31522-21.htm":
{ {
st.giveItems(SUSPICIOUS_TOTEM, 1); st.giveItems(SUSPICIOUS_TOTEM, 1);
st.playSound("ItemSound.quest_finish"); st.playSound(QuestState.SOUND_FINISH);
st.exitQuest(false); st.exitQuest(false);
break;
} }
else if (event.equals("31532-04.htm")) case "31532-04.htm":
{ {
st.set("cond", "6"); st.setCond(6);
st.set("state", "6"); st.set("state", "6");
st.giveItems(LETTER, 1); st.giveItems(LETTER, 1);
st.playSound("ItemSound.quest_middle"); st.playSound(QuestState.SOUND_MIDDLE);
break;
} }
else if (event.equals("31532-06.htm")) case "31532-06.htm":
{ {
if (st.hasQuestItems(HAIRPIN)) if (st.hasQuestItems(HAIRPIN))
{ {
@@ -141,31 +152,37 @@ public class Q024_InhabitantsOfTheForestOfTheDead extends Quest
} }
else else
{ {
st.set("cond", "7"); st.setCond(7);
st.set("state", "7"); st.set("state", "7");
htmltext = "31532-07.htm"; htmltext = "31532-07.htm";
} }
break;
} }
else if (event.equals("31532-10.htm")) case "31532-10.htm":
{ {
st.set("state", "9"); st.set("state", "9");
break;
} }
else if (event.equals("31532-14.htm")) case "31532-14.htm":
{ {
st.set("state", "10"); st.set("state", "10");
break;
} }
else if (event.equals("31532-19.htm")) case "31532-19.htm":
{ {
st.set("cond", "9"); st.setCond(9);
st.set("state", "11"); st.set("state", "11");
st.playSound("ItemSound.quest_middle"); st.playSound(QuestState.SOUND_MIDDLE);
break;
} }
else if (event.equals("31531-02.htm")) case "31531-02.htm":
{ {
st.set("cond", "2"); st.setCond(2);
st.set("state", "2"); st.set("state", "2");
st.takeItems(FLOWER, -1); st.takeItems(FLOWER, -1);
st.playSound("ItemSound.quest_middle"); st.playSound(QuestState.SOUND_MIDDLE);
break;
}
} }
return htmltext; return htmltext;
@@ -175,15 +192,17 @@ public class Q024_InhabitantsOfTheForestOfTheDead extends Quest
public String onTalk(NpcInstance npc, PlayerInstance player) public String onTalk(NpcInstance npc, PlayerInstance player)
{ {
String htmltext = getNoQuestMsg(); String htmltext = getNoQuestMsg();
QuestState st = player.getQuestState(getName()); final QuestState st = player.getQuestState(getName());
if (st == null) if (st == null)
{ {
return htmltext; return htmltext;
} }
switch (st.getState()) switch (st.getState())
{ {
case State.CREATED: case State.CREATED:
QuestState st2 = player.getQuestState(Q023_LidiasHeart.class.getSimpleName()); {
final QuestState st2 = player.getQuestState(Q023_LidiasHeart.class.getSimpleName());
if ((st2 != null) && st2.isCompleted() && (player.getLevel() >= 65)) if ((st2 != null) && st2.isCompleted() && (player.getLevel() >= 65))
{ {
htmltext = "31389-01.htm"; htmltext = "31389-01.htm";
@@ -193,11 +212,14 @@ public class Q024_InhabitantsOfTheForestOfTheDead extends Quest
htmltext = "31389-02.htm"; htmltext = "31389-02.htm";
} }
break; break;
}
case State.STARTED: case State.STARTED:
{
int state = st.getInt("state"); int state = st.getInt("state");
switch (npc.getNpcId()) switch (npc.getNpcId())
{ {
case 31389: case 31389:
{
if (state == 1) if (state == 1)
{ {
htmltext = "31389-04.htm"; htmltext = "31389-04.htm";
@@ -237,9 +259,9 @@ public class Q024_InhabitantsOfTheForestOfTheDead extends Quest
if ((state == 7) && !st.hasQuestItems(HAIRPIN)) if ((state == 7) && !st.hasQuestItems(HAIRPIN))
{ {
htmltext = "31389-21.htm"; htmltext = "31389-21.htm";
st.set("cond", "8"); st.setCond(8);
st.giveItems(HAIRPIN, 1); st.giveItems(HAIRPIN, 1);
st.playSound("ItemSound.quest_middle"); st.playSound(QuestState.SOUND_MIDDLE);
} }
else if (((state == 7) && st.hasQuestItems(HAIRPIN)) || (state == 6)) else if (((state == 7) && st.hasQuestItems(HAIRPIN)) || (state == 6))
{ {
@@ -249,7 +271,9 @@ public class Q024_InhabitantsOfTheForestOfTheDead extends Quest
return htmltext; return htmltext;
} }
}
case 31522: case 31522:
{
if ((state == 11) && st.hasQuestItems(TOTEM)) if ((state == 11) && st.hasQuestItems(TOTEM))
{ {
htmltext = "31522-01.htm"; htmltext = "31522-01.htm";
@@ -274,7 +298,9 @@ public class Q024_InhabitantsOfTheForestOfTheDead extends Quest
return htmltext; return htmltext;
} }
}
case 31531: case 31531:
{
if ((state == 1) && st.hasQuestItems(FLOWER)) if ((state == 1) && st.hasQuestItems(FLOWER))
{ {
htmltext = "31531-01.htm"; htmltext = "31531-01.htm";
@@ -287,7 +313,9 @@ public class Q024_InhabitantsOfTheForestOfTheDead extends Quest
} }
return htmltext; return htmltext;
}
case 31532: case 31532:
{
if (state == 5) if (state == 5)
{ {
htmltext = "31532-01.htm"; htmltext = "31532-01.htm";
@@ -327,10 +355,15 @@ public class Q024_InhabitantsOfTheForestOfTheDead extends Quest
return htmltext; return htmltext;
} }
}
default: default:
{
return htmltext; return htmltext;
} }
}
}
case State.COMPLETED: case State.COMPLETED:
{
if (npc.getNpcId() == 31522) if (npc.getNpcId() == 31522)
{ {
htmltext = "31522-22.htm"; htmltext = "31522-22.htm";
@@ -340,6 +373,7 @@ public class Q024_InhabitantsOfTheForestOfTheDead extends Quest
htmltext = getAlreadyCompletedMsg(); htmltext = getAlreadyCompletedMsg();
} }
} }
}
return htmltext; return htmltext;
} }
@@ -359,7 +393,7 @@ public class Q024_InhabitantsOfTheForestOfTheDead extends Quest
{ {
qs.takeItems(SILVER_CROSS, -1); qs.takeItems(SILVER_CROSS, -1);
qs.giveItems(BROKEN_SILVER_CROSS, 1); qs.giveItems(BROKEN_SILVER_CROSS, 1);
qs.set("cond", "4"); qs.setCond(4);
for (PlayerInstance nearby : npc.getKnownList().getKnownPlayers().values()) for (PlayerInstance nearby : npc.getKnownList().getKnownPlayers().values())
{ {
nearby.sendPacket(new CreatureSay(npc.getObjectId(), ChatType.GENERAL, npc.getName(), "That sign!")); nearby.sendPacket(new CreatureSay(npc.getObjectId(), ChatType.GENERAL, npc.getName(), "That sign!"));
@@ -372,7 +406,7 @@ public class Q024_InhabitantsOfTheForestOfTheDead extends Quest
@Override @Override
public String onKill(NpcInstance npc, PlayerInstance player, boolean isSummon) public String onKill(NpcInstance npc, PlayerInstance player, boolean isSummon)
{ {
final PlayerInstance partyMember = getRandomPartyMember(player, npc, "9"); final PlayerInstance partyMember = getRandomPartyMember(player, npc, 9);
if (partyMember == null) if (partyMember == null)
{ {
return null; return null;
@@ -385,7 +419,7 @@ public class Q024_InhabitantsOfTheForestOfTheDead extends Quest
} }
if (st.dropItems(TOTEM, 1, 1, 100000)) if (st.dropItems(TOTEM, 1, 1, 100000))
{ {
st.set("cond", "10"); st.setCond(10);
} }
return null; return null;

View File

@@ -55,7 +55,6 @@ public class Q025_HidingBehindTheTruth extends Quest
public Q025_HidingBehindTheTruth() public Q025_HidingBehindTheTruth()
{ {
super(25, "Hiding Behind the Truth"); super(25, "Hiding Behind the Truth");
addStartNpc(BENEDICT); addStartNpc(BENEDICT);
addTalkId(AGRIPEL, BENEDICT, BOOKSHELF, BOOKSHELF2, BOOKSHELF3, WIZARD, LIDIA, TOMBSTONE, COFFIN); addTalkId(AGRIPEL, BENEDICT, BOOKSHELF, BOOKSHELF2, BOOKSHELF3, WIZARD, LIDIA, TOMBSTONE, COFFIN);
addKillId(TRIOL); addKillId(TRIOL);
@@ -76,9 +75,7 @@ public class Q025_HidingBehindTheTruth extends Quest
{ {
case "31349-02.htm": case "31349-02.htm":
{ {
qs.playSound("ItemSound.quest_accept"); qs.startQuest();
qs.set("cond", "1");
qs.setState(State.STARTED);
break; break;
} }
case "31349-03.htm": case "31349-03.htm":
@@ -89,15 +86,15 @@ public class Q025_HidingBehindTheTruth extends Quest
} }
else else
{ {
qs.playSound("ItemSound.quest_middle"); qs.playSound(QuestState.SOUND_MIDDLE);
qs.set("cond", "2"); qs.setCond(2);
} }
break; break;
} }
case "31349-10.htm": case "31349-10.htm":
{ {
qs.playSound("ItemSound.quest_middle"); qs.playSound(QuestState.SOUND_MIDDLE);
qs.set("cond", "4"); qs.setCond(4);
break; break;
} }
case "31348-02.htm": case "31348-02.htm":
@@ -107,15 +104,15 @@ public class Q025_HidingBehindTheTruth extends Quest
} }
case "31348-07.htm": case "31348-07.htm":
{ {
qs.playSound("ItemSound.quest_middle"); qs.playSound(QuestState.SOUND_MIDDLE);
qs.set("cond", "5"); qs.setCond(5);
qs.giveItems(GEMSTONE_KEY, 1); qs.giveItems(GEMSTONE_KEY, 1);
break; break;
} }
case "31522-04.htm": case "31522-04.htm":
{ {
qs.playSound("ItemSound.quest_middle"); qs.playSound(QuestState.SOUND_MIDDLE);
qs.set("cond", "6"); qs.setCond(6);
break; break;
} }
case "31535-03.htm": case "31535-03.htm":
@@ -128,8 +125,8 @@ public class Q025_HidingBehindTheTruth extends Quest
triol.setRunning(); triol.setRunning();
((Attackable) triol).addDamageHate(player, 0, 999); ((Attackable) triol).addDamageHate(player, 0, 999);
triol.getAI().setIntention(CtrlIntention.AI_INTENTION_ATTACK, player); triol.getAI().setIntention(CtrlIntention.AI_INTENTION_ATTACK, player);
qs.playSound("ItemSound.quest_middle"); qs.playSound(QuestState.SOUND_MIDDLE);
qs.set("cond", "7"); qs.setCond(7);
} }
else if (qs.getInt("step") == 2) else if (qs.getInt("step") == 2)
{ {
@@ -141,8 +138,8 @@ public class Q025_HidingBehindTheTruth extends Quest
{ {
qs.giveItems(CONTRACT, 1); qs.giveItems(CONTRACT, 1);
qs.takeItems(GEMSTONE_KEY, -1); qs.takeItems(GEMSTONE_KEY, -1);
qs.playSound("ItemSound.quest_middle"); qs.playSound(QuestState.SOUND_MIDDLE);
qs.set("cond", "9"); qs.setCond(9);
break; break;
} }
case "31532-02.htm": case "31532-02.htm":
@@ -152,27 +149,27 @@ public class Q025_HidingBehindTheTruth extends Quest
} }
case "31532-06.htm": case "31532-06.htm":
{ {
qs.playSound("ItemSound.quest_middle"); qs.playSound(QuestState.SOUND_MIDDLE);
qs.set("cond", "11"); qs.setCond(11);
break; break;
} }
case "31531-02.htm": case "31531-02.htm":
{ {
qs.playSound("ItemSound.quest_middle"); qs.playSound(QuestState.SOUND_MIDDLE);
qs.set("cond", "12"); qs.setCond(12);
qs.addSpawn(COFFIN, 60104, -35820, -664, 20000); qs.addSpawn(COFFIN, 60104, -35820, -664, 20000);
break; break;
} }
case "31532-18.htm": case "31532-18.htm":
{ {
qs.playSound("ItemSound.quest_middle"); qs.playSound(QuestState.SOUND_MIDDLE);
qs.set("cond", "15"); qs.setCond(15);
break; break;
} }
case "31522-12.htm": case "31522-12.htm":
{ {
qs.playSound("ItemSound.quest_middle"); qs.playSound(QuestState.SOUND_MIDDLE);
qs.set("cond", "16"); qs.setCond(16);
} }
break; break;
case "31348-10.htm": case "31348-10.htm":
@@ -182,14 +179,14 @@ public class Q025_HidingBehindTheTruth extends Quest
} }
case "31348-15.htm": case "31348-15.htm":
{ {
qs.playSound("ItemSound.quest_middle"); qs.playSound(QuestState.SOUND_MIDDLE);
qs.set("cond", "17"); qs.setCond(17);
break; break;
} }
case "31348-16.htm": case "31348-16.htm":
{ {
qs.playSound("ItemSound.quest_middle"); qs.playSound(QuestState.SOUND_MIDDLE);
qs.set("cond", "18"); qs.setCond(18);
break; break;
} }
case "31532-20.htm": case "31532-20.htm":
@@ -200,7 +197,7 @@ public class Q025_HidingBehindTheTruth extends Quest
qs.rewardExpAndSp(572277, 53750); qs.rewardExpAndSp(572277, 53750);
qs.unset("cond"); qs.unset("cond");
qs.exitQuest(true); qs.exitQuest(true);
qs.playSound("ItemSound.quest_finish"); qs.playSound(QuestState.SOUND_FINISH);
break; break;
} }
case "31522-15.htm": case "31522-15.htm":
@@ -211,7 +208,7 @@ public class Q025_HidingBehindTheTruth extends Quest
qs.rewardExpAndSp(572277, 53750); qs.rewardExpAndSp(572277, 53750);
qs.unset("cond"); qs.unset("cond");
qs.exitQuest(true); qs.exitQuest(true);
qs.playSound("ItemSound.quest_finish"); qs.playSound(QuestState.SOUND_FINISH);
break; break;
} }
} }
@@ -231,7 +228,7 @@ public class Q025_HidingBehindTheTruth extends Quest
final int npcId = npc.getNpcId(); final int npcId = npc.getNpcId();
final int id = qs.getState(); final int id = qs.getState();
final int cond = qs.getInt("cond"); final int cond = qs.getCond();
if (id == State.COMPLETED) if (id == State.COMPLETED)
{ {
htmltext = getAlreadyCompletedMsg(); htmltext = getAlreadyCompletedMsg();
@@ -276,8 +273,8 @@ public class Q025_HidingBehindTheTruth extends Quest
if (cond == 2) if (cond == 2)
{ {
htmltext = "31522-01.htm"; htmltext = "31522-01.htm";
qs.playSound("ItemSound.quest_middle"); qs.playSound(QuestState.SOUND_MIDDLE);
qs.set("cond", "3"); qs.setCond(3);
qs.giveItems(SUSPICIOUS_TOTEM, 1); qs.giveItems(SUSPICIOUS_TOTEM, 1);
} }
else if (cond == 3) else if (cond == 3)
@@ -295,8 +292,8 @@ public class Q025_HidingBehindTheTruth extends Quest
else if (cond == 9) else if (cond == 9)
{ {
htmltext = "31522-05.htm"; htmltext = "31522-05.htm";
qs.playSound("ItemSound.quest_middle"); qs.playSound(QuestState.SOUND_MIDDLE);
qs.set("cond", "10"); qs.setCond(10);
} }
else if (cond == 10) else if (cond == 10)
{ {
@@ -380,7 +377,7 @@ public class Q025_HidingBehindTheTruth extends Quest
else if (cond == 13) else if (cond == 13)
{ {
htmltext = "31532-07.htm"; htmltext = "31532-07.htm";
qs.set("cond", "14"); qs.setCond(14);
qs.takeItems(DRESS, -1); qs.takeItems(DRESS, -1);
} }
else if (cond == 14) else if (cond == 14)
@@ -417,8 +414,8 @@ public class Q025_HidingBehindTheTruth extends Quest
{ {
htmltext = "31536-01.htm"; htmltext = "31536-01.htm";
qs.giveItems(DRESS, 1); qs.giveItems(DRESS, 1);
qs.playSound("ItemSound.quest_middle"); qs.playSound(QuestState.SOUND_MIDDLE);
qs.set("cond", "13"); qs.setCond(13);
npc.deleteMe(); npc.deleteMe();
} }
} }
@@ -435,10 +432,10 @@ public class Q025_HidingBehindTheTruth extends Quest
return null; return null;
} }
if ((qs.getState() == State.STARTED) && (qs.getInt("cond") == 7)) if ((qs.getState() == State.STARTED) && qs.isCond(7))
{ {
qs.playSound("ItemSound.quest_itemget"); qs.playSound(QuestState.SOUND_ITEMGET);
qs.set("cond", "8"); qs.setCond(8);
npc.broadcastPacket(new CreatureSay(npc.getObjectId(), ChatType.GENERAL, npc.getName(), "You've ended my immortal life! You've protected by the feudal lord, aren't you?")); npc.broadcastPacket(new CreatureSay(npc.getObjectId(), ChatType.GENERAL, npc.getName(), "You've ended my immortal life! You've protected by the feudal lord, aren't you?"));
qs.giveItems(TOTEM_DOLL, 1); qs.giveItems(TOTEM_DOLL, 1);
qs.set("step", "2"); qs.set("step", "2");

View File

@@ -55,17 +55,18 @@ public class Q027_ChestCaughtWithABaitOfWind extends Quest
return htmltext; return htmltext;
} }
if (event.equals("31570-04.htm")) switch (event)
{ {
st.setState(State.STARTED); case "31570-04.htm":
st.set("cond", "1"); {
st.playSound(QuestState.SOUND_ACCEPT); st.startQuest();
break;
} }
else if (event.equals("31570-07.htm")) case "31570-07.htm":
{ {
if (st.hasQuestItems(LARGE_BLUE_TREASURE_CHEST)) if (st.hasQuestItems(LARGE_BLUE_TREASURE_CHEST))
{ {
st.set("cond", "2"); st.setCond(2);
st.takeItems(LARGE_BLUE_TREASURE_CHEST, 1); st.takeItems(LARGE_BLUE_TREASURE_CHEST, 1);
st.giveItems(STRANGE_BLUEPRINT, 1); st.giveItems(STRANGE_BLUEPRINT, 1);
} }
@@ -73,8 +74,9 @@ public class Q027_ChestCaughtWithABaitOfWind extends Quest
{ {
htmltext = "31570-08.htm"; htmltext = "31570-08.htm";
} }
break;
} }
else if (event.equals("31434-02.htm")) case "31434-02.htm":
{ {
if (st.hasQuestItems(STRANGE_BLUEPRINT)) if (st.hasQuestItems(STRANGE_BLUEPRINT))
{ {
@@ -88,6 +90,8 @@ public class Q027_ChestCaughtWithABaitOfWind extends Quest
{ {
htmltext = "31434-03.htm"; htmltext = "31434-03.htm";
} }
break;
}
} }
return htmltext; return htmltext;
@@ -106,6 +110,7 @@ public class Q027_ChestCaughtWithABaitOfWind extends Quest
switch (st.getState()) switch (st.getState())
{ {
case State.CREATED: case State.CREATED:
{
if (player.getLevel() < 27) if (player.getLevel() < 27)
{ {
htmltext = "31570-02.htm"; htmltext = "31570-02.htm";
@@ -123,12 +128,14 @@ public class Q027_ChestCaughtWithABaitOfWind extends Quest
} }
} }
break; break;
}
case State.STARTED: case State.STARTED:
final int cond = st.getInt("cond"); {
final int cond = st.getCond();
switch (npc.getNpcId()) switch (npc.getNpcId())
{ {
case LANOSCO: case LANOSCO:
{
if (cond == 1) if (cond == 1)
{ {
htmltext = (!st.hasQuestItems(LARGE_BLUE_TREASURE_CHEST)) ? "31570-06.htm" : "31570-05.htm"; htmltext = (!st.hasQuestItems(LARGE_BLUE_TREASURE_CHEST)) ? "31570-06.htm" : "31570-05.htm";
@@ -138,20 +145,24 @@ public class Q027_ChestCaughtWithABaitOfWind extends Quest
htmltext = "31570-09.htm"; htmltext = "31570-09.htm";
} }
break; break;
}
case SHALING: case SHALING:
{
if (cond == 2) if (cond == 2)
{ {
htmltext = "31434-01.htm"; htmltext = "31434-01.htm";
} }
break; break;
} }
}
break; break;
}
case State.COMPLETED: case State.COMPLETED:
{
htmltext = getAlreadyCompletedMsg(); htmltext = getAlreadyCompletedMsg();
break; break;
} }
}
return htmltext; return htmltext;
} }

View File

@@ -29,7 +29,6 @@ public class Q028_ChestCaughtWithABaitOfIcyAir extends Quest
// NPCs // NPCs
private static final int OFULLE = 31572; private static final int OFULLE = 31572;
private static final int KIKI = 31442; private static final int KIKI = 31442;
// Items // Items
private static final int BIG_YELLOW_TREASURE_CHEST = 6503; private static final int BIG_YELLOW_TREASURE_CHEST = 6503;
private static final int KIKI_LETTER = 7626; private static final int KIKI_LETTER = 7626;
@@ -38,9 +37,7 @@ public class Q028_ChestCaughtWithABaitOfIcyAir extends Quest
public Q028_ChestCaughtWithABaitOfIcyAir() public Q028_ChestCaughtWithABaitOfIcyAir()
{ {
super(28, "Chest caught with a bait of icy air"); super(28, "Chest caught with a bait of icy air");
registerQuestItems(KIKI_LETTER); registerQuestItems(KIKI_LETTER);
addStartNpc(OFULLE); addStartNpc(OFULLE);
addTalkId(OFULLE, KIKI); addTalkId(OFULLE, KIKI);
} }
@@ -55,17 +52,18 @@ public class Q028_ChestCaughtWithABaitOfIcyAir extends Quest
return htmltext; return htmltext;
} }
if (event.equals("31572-04.htm")) switch (event)
{ {
st.setState(State.STARTED); case "31572-04.htm":
st.set("cond", "1"); {
st.playSound(QuestState.SOUND_ACCEPT); st.startQuest();
break;
} }
else if (event.equals("31572-07.htm")) case "31572-07.htm":
{ {
if (st.hasQuestItems(BIG_YELLOW_TREASURE_CHEST)) if (st.hasQuestItems(BIG_YELLOW_TREASURE_CHEST))
{ {
st.set("cond", "2"); st.setCond(2);
st.takeItems(BIG_YELLOW_TREASURE_CHEST, 1); st.takeItems(BIG_YELLOW_TREASURE_CHEST, 1);
st.giveItems(KIKI_LETTER, 1); st.giveItems(KIKI_LETTER, 1);
} }
@@ -73,8 +71,9 @@ public class Q028_ChestCaughtWithABaitOfIcyAir extends Quest
{ {
htmltext = "31572-08.htm"; htmltext = "31572-08.htm";
} }
break;
} }
else if (event.equals("31442-02.htm")) case "31442-02.htm":
{ {
if (st.hasQuestItems(KIKI_LETTER)) if (st.hasQuestItems(KIKI_LETTER))
{ {
@@ -88,6 +87,8 @@ public class Q028_ChestCaughtWithABaitOfIcyAir extends Quest
{ {
htmltext = "31442-03.htm"; htmltext = "31442-03.htm";
} }
break;
}
} }
return htmltext; return htmltext;
@@ -106,6 +107,7 @@ public class Q028_ChestCaughtWithABaitOfIcyAir extends Quest
switch (st.getState()) switch (st.getState())
{ {
case State.CREATED: case State.CREATED:
{
if (player.getLevel() < 36) if (player.getLevel() < 36)
{ {
htmltext = "31572-02.htm"; htmltext = "31572-02.htm";
@@ -123,12 +125,14 @@ public class Q028_ChestCaughtWithABaitOfIcyAir extends Quest
} }
} }
break; break;
}
case State.STARTED: case State.STARTED:
final int cond = st.getInt("cond"); {
final int cond = st.getCond();
switch (npc.getNpcId()) switch (npc.getNpcId())
{ {
case OFULLE: case OFULLE:
{
if (cond == 1) if (cond == 1)
{ {
htmltext = (!st.hasQuestItems(BIG_YELLOW_TREASURE_CHEST)) ? "31572-06.htm" : "31572-05.htm"; htmltext = (!st.hasQuestItems(BIG_YELLOW_TREASURE_CHEST)) ? "31572-06.htm" : "31572-05.htm";
@@ -138,20 +142,24 @@ public class Q028_ChestCaughtWithABaitOfIcyAir extends Quest
htmltext = "31572-09.htm"; htmltext = "31572-09.htm";
} }
break; break;
}
case KIKI: case KIKI:
{
if (cond == 2) if (cond == 2)
{ {
htmltext = "31442-01.htm"; htmltext = "31442-01.htm";
} }
break; break;
} }
}
break; break;
}
case State.COMPLETED: case State.COMPLETED:
{
htmltext = getAlreadyCompletedMsg(); htmltext = getAlreadyCompletedMsg();
break; break;
} }
}
return htmltext; return htmltext;
} }

View File

@@ -29,7 +29,6 @@ public class Q029_ChestCaughtWithABaitOfEarth extends Quest
// NPCs // NPCs
private static final int WILLIE = 31574; private static final int WILLIE = 31574;
private static final int ANABEL = 30909; private static final int ANABEL = 30909;
// Items // Items
private static final int SMALL_PURPLE_TREASURE_CHEST = 6507; private static final int SMALL_PURPLE_TREASURE_CHEST = 6507;
private static final int SMALL_GLASS_BOX = 7627; private static final int SMALL_GLASS_BOX = 7627;
@@ -38,9 +37,7 @@ public class Q029_ChestCaughtWithABaitOfEarth extends Quest
public Q029_ChestCaughtWithABaitOfEarth() public Q029_ChestCaughtWithABaitOfEarth()
{ {
super(29, "Chest caught with a bait of earth"); super(29, "Chest caught with a bait of earth");
registerQuestItems(SMALL_GLASS_BOX); registerQuestItems(SMALL_GLASS_BOX);
addStartNpc(WILLIE); addStartNpc(WILLIE);
addTalkId(WILLIE, ANABEL); addTalkId(WILLIE, ANABEL);
} }
@@ -55,17 +52,18 @@ public class Q029_ChestCaughtWithABaitOfEarth extends Quest
return htmltext; return htmltext;
} }
if (event.equals("31574-04.htm")) switch (event)
{ {
st.setState(State.STARTED); case "31574-04.htm":
st.set("cond", "1"); {
st.playSound(QuestState.SOUND_ACCEPT); st.startQuest();
break;
} }
else if (event.equals("31574-07.htm")) case "31574-07.htm":
{ {
if (st.hasQuestItems(SMALL_PURPLE_TREASURE_CHEST)) if (st.hasQuestItems(SMALL_PURPLE_TREASURE_CHEST))
{ {
st.set("cond", "2"); st.setCond(2);
st.takeItems(SMALL_PURPLE_TREASURE_CHEST, 1); st.takeItems(SMALL_PURPLE_TREASURE_CHEST, 1);
st.giveItems(SMALL_GLASS_BOX, 1); st.giveItems(SMALL_GLASS_BOX, 1);
} }
@@ -73,8 +71,9 @@ public class Q029_ChestCaughtWithABaitOfEarth extends Quest
{ {
htmltext = "31574-08.htm"; htmltext = "31574-08.htm";
} }
break;
} }
else if (event.equals("30909-02.htm")) case "30909-02.htm":
{ {
if (st.hasQuestItems(SMALL_GLASS_BOX)) if (st.hasQuestItems(SMALL_GLASS_BOX))
{ {
@@ -88,6 +87,8 @@ public class Q029_ChestCaughtWithABaitOfEarth extends Quest
{ {
htmltext = "30909-03.htm"; htmltext = "30909-03.htm";
} }
break;
}
} }
return htmltext; return htmltext;
@@ -106,6 +107,7 @@ public class Q029_ChestCaughtWithABaitOfEarth extends Quest
switch (st.getState()) switch (st.getState())
{ {
case State.CREATED: case State.CREATED:
{
if (player.getLevel() < 48) if (player.getLevel() < 48)
{ {
htmltext = "31574-02.htm"; htmltext = "31574-02.htm";
@@ -123,12 +125,14 @@ public class Q029_ChestCaughtWithABaitOfEarth extends Quest
} }
} }
break; break;
}
case State.STARTED: case State.STARTED:
final int cond = st.getInt("cond"); {
final int cond = st.getCond();
switch (npc.getNpcId()) switch (npc.getNpcId())
{ {
case WILLIE: case WILLIE:
{
if (cond == 1) if (cond == 1)
{ {
htmltext = (!st.hasQuestItems(SMALL_PURPLE_TREASURE_CHEST)) ? "31574-06.htm" : "31574-05.htm"; htmltext = (!st.hasQuestItems(SMALL_PURPLE_TREASURE_CHEST)) ? "31574-06.htm" : "31574-05.htm";
@@ -138,20 +142,24 @@ public class Q029_ChestCaughtWithABaitOfEarth extends Quest
htmltext = "31574-09.htm"; htmltext = "31574-09.htm";
} }
break; break;
}
case ANABEL: case ANABEL:
{
if (cond == 2) if (cond == 2)
{ {
htmltext = "30909-01.htm"; htmltext = "30909-01.htm";
} }
break; break;
} }
}
break; break;
}
case State.COMPLETED: case State.COMPLETED:
{
htmltext = getAlreadyCompletedMsg(); htmltext = getAlreadyCompletedMsg();
break; break;
} }
}
return htmltext; return htmltext;
} }

View File

@@ -29,7 +29,6 @@ public class Q030_ChestCaughtWithABaitOfFire extends Quest
// NPCs // NPCs
private static final int LINNAEUS = 31577; private static final int LINNAEUS = 31577;
private static final int RUKAL = 30629; private static final int RUKAL = 30629;
// Items // Items
private static final int RED_TREASURE_BOX = 6511; private static final int RED_TREASURE_BOX = 6511;
private static final int MUSICAL_SCORE = 7628; private static final int MUSICAL_SCORE = 7628;
@@ -38,9 +37,7 @@ public class Q030_ChestCaughtWithABaitOfFire extends Quest
public Q030_ChestCaughtWithABaitOfFire() public Q030_ChestCaughtWithABaitOfFire()
{ {
super(30, "Chest caught with a bait of fire"); super(30, "Chest caught with a bait of fire");
registerQuestItems(MUSICAL_SCORE); registerQuestItems(MUSICAL_SCORE);
addStartNpc(LINNAEUS); addStartNpc(LINNAEUS);
addTalkId(LINNAEUS, RUKAL); addTalkId(LINNAEUS, RUKAL);
} }
@@ -55,17 +52,18 @@ public class Q030_ChestCaughtWithABaitOfFire extends Quest
return htmltext; return htmltext;
} }
if (event.equals("31577-04.htm")) switch (event)
{ {
st.setState(State.STARTED); case "31577-04.htm":
st.set("cond", "1"); {
st.playSound(QuestState.SOUND_ACCEPT); st.startQuest();
break;
} }
else if (event.equals("31577-07.htm")) case "31577-07.htm":
{ {
if (st.hasQuestItems(RED_TREASURE_BOX)) if (st.hasQuestItems(RED_TREASURE_BOX))
{ {
st.set("cond", "2"); st.setCond(2);
st.takeItems(RED_TREASURE_BOX, 1); st.takeItems(RED_TREASURE_BOX, 1);
st.giveItems(MUSICAL_SCORE, 1); st.giveItems(MUSICAL_SCORE, 1);
} }
@@ -73,8 +71,9 @@ public class Q030_ChestCaughtWithABaitOfFire extends Quest
{ {
htmltext = "31577-08.htm"; htmltext = "31577-08.htm";
} }
break;
} }
else if (event.equals("30629-02.htm")) case "30629-02.htm":
{ {
if (st.hasQuestItems(MUSICAL_SCORE)) if (st.hasQuestItems(MUSICAL_SCORE))
{ {
@@ -88,6 +87,8 @@ public class Q030_ChestCaughtWithABaitOfFire extends Quest
{ {
htmltext = "30629-03.htm"; htmltext = "30629-03.htm";
} }
break;
}
} }
return htmltext; return htmltext;
@@ -106,6 +107,7 @@ public class Q030_ChestCaughtWithABaitOfFire extends Quest
switch (st.getState()) switch (st.getState())
{ {
case State.CREATED: case State.CREATED:
{
if (player.getLevel() < 60) if (player.getLevel() < 60)
{ {
htmltext = "31577-02.htm"; htmltext = "31577-02.htm";
@@ -123,12 +125,14 @@ public class Q030_ChestCaughtWithABaitOfFire extends Quest
} }
} }
break; break;
}
case State.STARTED: case State.STARTED:
final int cond = st.getInt("cond"); {
final int cond = st.getCond();
switch (npc.getNpcId()) switch (npc.getNpcId())
{ {
case LINNAEUS: case LINNAEUS:
{
if (cond == 1) if (cond == 1)
{ {
htmltext = (!st.hasQuestItems(RED_TREASURE_BOX)) ? "31577-06.htm" : "31577-05.htm"; htmltext = (!st.hasQuestItems(RED_TREASURE_BOX)) ? "31577-06.htm" : "31577-05.htm";
@@ -138,20 +142,24 @@ public class Q030_ChestCaughtWithABaitOfFire extends Quest
htmltext = "31577-09.htm"; htmltext = "31577-09.htm";
} }
break; break;
}
case RUKAL: case RUKAL:
{
if (cond == 2) if (cond == 2)
{ {
htmltext = "30629-01.htm"; htmltext = "30629-01.htm";
} }
break; break;
} }
}
break; break;
}
case State.COMPLETED: case State.COMPLETED:
{
htmltext = getAlreadyCompletedMsg(); htmltext = getAlreadyCompletedMsg();
break; break;
} }
}
return htmltext; return htmltext;
} }

View File

@@ -24,9 +24,6 @@ import org.l2jmobius.gameserver.model.quest.State;
public class Q031_SecretBuriedInTheSwamp extends Quest public class Q031_SecretBuriedInTheSwamp extends Quest
{ {
// Item
private static final int KRORIN_JOURNAL = 7252;
// NPCs // NPCs
private static final int ABERCROMBIE = 31555; private static final int ABERCROMBIE = 31555;
private static final int FORGOTTEN_MONUMENT_1 = 31661; private static final int FORGOTTEN_MONUMENT_1 = 31661;
@@ -34,13 +31,13 @@ public class Q031_SecretBuriedInTheSwamp extends Quest
private static final int FORGOTTEN_MONUMENT_3 = 31663; private static final int FORGOTTEN_MONUMENT_3 = 31663;
private static final int FORGOTTEN_MONUMENT_4 = 31664; private static final int FORGOTTEN_MONUMENT_4 = 31664;
private static final int CORPSE_OF_DWARF = 31665; private static final int CORPSE_OF_DWARF = 31665;
// Item
private static final int KRORIN_JOURNAL = 7252;
public Q031_SecretBuriedInTheSwamp() public Q031_SecretBuriedInTheSwamp()
{ {
super(31, "Secret Buried in the Swamp"); super(31, "Secret Buried in the Swamp");
registerQuestItems(KRORIN_JOURNAL); registerQuestItems(KRORIN_JOURNAL);
addStartNpc(ABERCROMBIE); addStartNpc(ABERCROMBIE);
addTalkId(ABERCROMBIE, CORPSE_OF_DWARF, FORGOTTEN_MONUMENT_1, FORGOTTEN_MONUMENT_2, FORGOTTEN_MONUMENT_3, FORGOTTEN_MONUMENT_4); addTalkId(ABERCROMBIE, CORPSE_OF_DWARF, FORGOTTEN_MONUMENT_1, FORGOTTEN_MONUMENT_2, FORGOTTEN_MONUMENT_3, FORGOTTEN_MONUMENT_4);
} }
@@ -55,50 +52,59 @@ public class Q031_SecretBuriedInTheSwamp extends Quest
return htmltext; return htmltext;
} }
if (event.equals("31555-01.htm")) switch (event)
{ {
st.setState(State.STARTED); case "31555-01.htm":
st.set("cond", "1"); {
st.playSound(QuestState.SOUND_ACCEPT); st.startQuest();
break;
} }
else if (event.equals("31665-01.htm")) case "31665-01.htm":
{ {
st.set("cond", "2"); st.setCond(2);
st.playSound(QuestState.SOUND_MIDDLE); st.playSound(QuestState.SOUND_MIDDLE);
st.giveItems(KRORIN_JOURNAL, 1); st.giveItems(KRORIN_JOURNAL, 1);
break;
} }
else if (event.equals("31555-04.htm")) case "31555-04.htm":
{ {
st.set("cond", "3"); st.setCond(3);
st.playSound(QuestState.SOUND_MIDDLE); st.playSound(QuestState.SOUND_MIDDLE);
break;
} }
else if (event.equals("31661-01.htm")) case "31661-01.htm":
{ {
st.set("cond", "4"); st.setCond(4);
st.playSound(QuestState.SOUND_MIDDLE); st.playSound(QuestState.SOUND_MIDDLE);
break;
} }
else if (event.equals("31662-01.htm")) case "31662-01.htm":
{ {
st.set("cond", "5"); st.setCond(5);
st.playSound(QuestState.SOUND_MIDDLE); st.playSound(QuestState.SOUND_MIDDLE);
break;
} }
else if (event.equals("31663-01.htm")) case "31663-01.htm":
{ {
st.set("cond", "6"); st.setCond(6);
st.playSound(QuestState.SOUND_MIDDLE); st.playSound(QuestState.SOUND_MIDDLE);
break;
} }
else if (event.equals("31664-01.htm")) case "31664-01.htm":
{ {
st.set("cond", "7"); st.setCond(7);
st.playSound(QuestState.SOUND_MIDDLE); st.playSound(QuestState.SOUND_MIDDLE);
break;
} }
else if (event.equals("31555-07.htm")) case "31555-07.htm":
{ {
st.takeItems(KRORIN_JOURNAL, 1); st.takeItems(KRORIN_JOURNAL, 1);
st.rewardItems(57, 40000); st.rewardItems(57, 40000);
st.rewardExpAndSp(130000, 0); st.rewardExpAndSp(130000, 0);
st.playSound(QuestState.SOUND_FINISH); st.playSound(QuestState.SOUND_FINISH);
st.exitQuest(false); st.exitQuest(false);
break;
}
} }
return htmltext; return htmltext;
@@ -117,14 +123,17 @@ public class Q031_SecretBuriedInTheSwamp extends Quest
switch (st.getState()) switch (st.getState())
{ {
case State.CREATED: case State.CREATED:
{
htmltext = (player.getLevel() < 66) ? "31555-00a.htm" : "31555-00.htm"; htmltext = (player.getLevel() < 66) ? "31555-00a.htm" : "31555-00.htm";
break; break;
}
case State.STARTED: case State.STARTED:
final int cond = st.getInt("cond"); {
final int cond = st.getCond();
switch (npc.getNpcId()) switch (npc.getNpcId())
{ {
case ABERCROMBIE: case ABERCROMBIE:
{
if (cond == 1) if (cond == 1)
{ {
htmltext = "31555-02.htm"; htmltext = "31555-02.htm";
@@ -142,8 +151,9 @@ public class Q031_SecretBuriedInTheSwamp extends Quest
htmltext = "31555-06.htm"; htmltext = "31555-06.htm";
} }
break; break;
}
case CORPSE_OF_DWARF: case CORPSE_OF_DWARF:
{
if (cond == 1) if (cond == 1)
{ {
htmltext = "31665-00.htm"; htmltext = "31665-00.htm";
@@ -153,8 +163,9 @@ public class Q031_SecretBuriedInTheSwamp extends Quest
htmltext = "31665-02.htm"; htmltext = "31665-02.htm";
} }
break; break;
}
case FORGOTTEN_MONUMENT_1: case FORGOTTEN_MONUMENT_1:
{
if (cond == 3) if (cond == 3)
{ {
htmltext = "31661-00.htm"; htmltext = "31661-00.htm";
@@ -164,8 +175,9 @@ public class Q031_SecretBuriedInTheSwamp extends Quest
htmltext = "31661-02.htm"; htmltext = "31661-02.htm";
} }
break; break;
}
case FORGOTTEN_MONUMENT_2: case FORGOTTEN_MONUMENT_2:
{
if (cond == 4) if (cond == 4)
{ {
htmltext = "31662-00.htm"; htmltext = "31662-00.htm";
@@ -175,8 +187,9 @@ public class Q031_SecretBuriedInTheSwamp extends Quest
htmltext = "31662-02.htm"; htmltext = "31662-02.htm";
} }
break; break;
}
case FORGOTTEN_MONUMENT_3: case FORGOTTEN_MONUMENT_3:
{
if (cond == 5) if (cond == 5)
{ {
htmltext = "31663-00.htm"; htmltext = "31663-00.htm";
@@ -186,8 +199,9 @@ public class Q031_SecretBuriedInTheSwamp extends Quest
htmltext = "31663-02.htm"; htmltext = "31663-02.htm";
} }
break; break;
}
case FORGOTTEN_MONUMENT_4: case FORGOTTEN_MONUMENT_4:
{
if (cond == 6) if (cond == 6)
{ {
htmltext = "31664-00.htm"; htmltext = "31664-00.htm";
@@ -198,12 +212,15 @@ public class Q031_SecretBuriedInTheSwamp extends Quest
} }
break; break;
} }
}
break; break;
}
case State.COMPLETED: case State.COMPLETED:
{
htmltext = getAlreadyCompletedMsg(); htmltext = getAlreadyCompletedMsg();
break; break;
} }
}
return htmltext; return htmltext;
} }

View File

@@ -24,32 +24,27 @@ import org.l2jmobius.gameserver.model.quest.State;
public class Q032_AnObviousLie extends Quest public class Q032_AnObviousLie extends Quest
{ {
// NPCs
private static final int GENTLER = 30094;
private static final int MAXIMILIAN = 30120;
private static final int MIKI_THE_CAT = 31706;
// Items // Items
private static final int SUEDE = 1866; private static final int SUEDE = 1866;
private static final int THREAD = 1868; private static final int THREAD = 1868;
private static final int SPIRIT_ORE = 3031; private static final int SPIRIT_ORE = 3031;
private static final int MAP = 7165; private static final int MAP = 7165;
private static final int MEDICINAL_HERB = 7166; private static final int MEDICINAL_HERB = 7166;
// Rewards // Rewards
private static final int CAT_EARS = 6843; private static final int CAT_EARS = 6843;
private static final int RACOON_EARS = 7680; private static final int RACOON_EARS = 7680;
private static final int RABBIT_EARS = 7683; private static final int RABBIT_EARS = 7683;
// NPCs
private static final int GENTLER = 30094;
private static final int MAXIMILIAN = 30120;
private static final int MIKI_THE_CAT = 31706;
public Q032_AnObviousLie() public Q032_AnObviousLie()
{ {
super(32, "An Obvious Lie"); super(32, "An Obvious Lie");
registerQuestItems(MAP, MEDICINAL_HERB); registerQuestItems(MAP, MEDICINAL_HERB);
addStartNpc(MAXIMILIAN); addStartNpc(MAXIMILIAN);
addTalkId(MAXIMILIAN, GENTLER, MIKI_THE_CAT); addTalkId(MAXIMILIAN, GENTLER, MIKI_THE_CAT);
addKillId(20135); // Alligator addKillId(20135); // Alligator
} }
@@ -63,31 +58,35 @@ public class Q032_AnObviousLie extends Quest
return htmltext; return htmltext;
} }
if (event.equals("30120-1.htm")) switch (event)
{ {
st.setState(State.STARTED); case "30120-1.htm":
st.set("cond", "1"); {
st.playSound(QuestState.SOUND_ACCEPT); st.startQuest();
break;
} }
else if (event.equals("30094-1.htm")) case "30094-1.htm":
{ {
st.set("cond", "2"); st.setCond(2);
st.playSound(QuestState.SOUND_MIDDLE); st.playSound(QuestState.SOUND_MIDDLE);
st.giveItems(MAP, 1); st.giveItems(MAP, 1);
break;
} }
else if (event.equals("31706-1.htm")) case "31706-1.htm":
{ {
st.set("cond", "3"); st.setCond(3);
st.playSound(QuestState.SOUND_MIDDLE); st.playSound(QuestState.SOUND_MIDDLE);
st.takeItems(MAP, 1); st.takeItems(MAP, 1);
break;
} }
else if (event.equals("30094-4.htm")) case "30094-4.htm":
{ {
st.set("cond", "5"); st.setCond(5);
st.playSound(QuestState.SOUND_MIDDLE); st.playSound(QuestState.SOUND_MIDDLE);
st.takeItems(MEDICINAL_HERB, 20); st.takeItems(MEDICINAL_HERB, 20);
break;
} }
else if (event.equals("30094-7.htm")) case "30094-7.htm":
{ {
if (st.getQuestItemsCount(SPIRIT_ORE) < 500) if (st.getQuestItemsCount(SPIRIT_ORE) < 500)
{ {
@@ -95,26 +94,30 @@ public class Q032_AnObviousLie extends Quest
} }
else else
{ {
st.set("cond", "6"); st.setCond(6);
st.playSound(QuestState.SOUND_MIDDLE); st.playSound(QuestState.SOUND_MIDDLE);
st.takeItems(SPIRIT_ORE, 500); st.takeItems(SPIRIT_ORE, 500);
} }
break;
} }
else if (event.equals("31706-4.htm")) case "31706-4.htm":
{ {
st.set("cond", "7"); st.setCond(7);
st.playSound(QuestState.SOUND_MIDDLE); st.playSound(QuestState.SOUND_MIDDLE);
break;
} }
else if (event.equals("30094-10.htm")) case "30094-10.htm":
{ {
st.set("cond", "8"); st.setCond(8);
st.playSound(QuestState.SOUND_MIDDLE); st.playSound(QuestState.SOUND_MIDDLE);
break;
} }
else if (event.equals("30094-13.htm")) case "30094-13.htm":
{ {
st.playSound(QuestState.SOUND_MIDDLE); st.playSound(QuestState.SOUND_MIDDLE);
break;
} }
else if (event.equals("cat")) case "cat":
{ {
if ((st.getQuestItemsCount(THREAD) < 1000) || (st.getQuestItemsCount(SUEDE) < 500)) if ((st.getQuestItemsCount(THREAD) < 1000) || (st.getQuestItemsCount(SUEDE) < 500))
{ {
@@ -129,8 +132,9 @@ public class Q032_AnObviousLie extends Quest
st.playSound(QuestState.SOUND_FINISH); st.playSound(QuestState.SOUND_FINISH);
st.exitQuest(false); st.exitQuest(false);
} }
break;
} }
else if (event.equals("racoon")) case "racoon":
{ {
if ((st.getQuestItemsCount(THREAD) < 1000) || (st.getQuestItemsCount(SUEDE) < 500)) if ((st.getQuestItemsCount(THREAD) < 1000) || (st.getQuestItemsCount(SUEDE) < 500))
{ {
@@ -145,8 +149,9 @@ public class Q032_AnObviousLie extends Quest
st.playSound(QuestState.SOUND_FINISH); st.playSound(QuestState.SOUND_FINISH);
st.exitQuest(false); st.exitQuest(false);
} }
break;
} }
else if (event.equals("rabbit")) case "rabbit":
{ {
if ((st.getQuestItemsCount(THREAD) < 1000) || (st.getQuestItemsCount(SUEDE) < 500)) if ((st.getQuestItemsCount(THREAD) < 1000) || (st.getQuestItemsCount(SUEDE) < 500))
{ {
@@ -161,6 +166,8 @@ public class Q032_AnObviousLie extends Quest
st.playSound(QuestState.SOUND_FINISH); st.playSound(QuestState.SOUND_FINISH);
st.exitQuest(false); st.exitQuest(false);
} }
break;
}
} }
return htmltext; return htmltext;
@@ -179,18 +186,22 @@ public class Q032_AnObviousLie extends Quest
switch (st.getState()) switch (st.getState())
{ {
case State.CREATED: case State.CREATED:
{
htmltext = (player.getLevel() < 45) ? "30120-0a.htm" : "30120-0.htm"; htmltext = (player.getLevel() < 45) ? "30120-0a.htm" : "30120-0.htm";
break; break;
}
case State.STARTED: case State.STARTED:
final int cond = st.getInt("cond"); {
final int cond = st.getCond();
switch (npc.getNpcId()) switch (npc.getNpcId())
{ {
case MAXIMILIAN: case MAXIMILIAN:
{
htmltext = "30120-2.htm"; htmltext = "30120-2.htm";
break; break;
}
case GENTLER: case GENTLER:
{
if (cond == 1) if (cond == 1)
{ {
htmltext = "30094-0.htm"; htmltext = "30094-0.htm";
@@ -220,8 +231,9 @@ public class Q032_AnObviousLie extends Quest
htmltext = ((st.getQuestItemsCount(THREAD) < 1000) || (st.getQuestItemsCount(SUEDE) < 500)) ? "30094-11.htm" : "30094-12.htm"; htmltext = ((st.getQuestItemsCount(THREAD) < 1000) || (st.getQuestItemsCount(SUEDE) < 500)) ? "30094-11.htm" : "30094-12.htm";
} }
break; break;
}
case MIKI_THE_CAT: case MIKI_THE_CAT:
{
if (cond == 2) if (cond == 2)
{ {
htmltext = "31706-0.htm"; htmltext = "31706-0.htm";
@@ -240,12 +252,15 @@ public class Q032_AnObviousLie extends Quest
} }
break; break;
} }
}
break; break;
}
case State.COMPLETED: case State.COMPLETED:
{
htmltext = getAlreadyCompletedMsg(); htmltext = getAlreadyCompletedMsg();
break; break;
} }
}
return htmltext; return htmltext;
} }
@@ -253,7 +268,7 @@ public class Q032_AnObviousLie extends Quest
@Override @Override
public String onKill(NpcInstance npc, PlayerInstance player, boolean isPet) public String onKill(NpcInstance npc, PlayerInstance player, boolean isPet)
{ {
final QuestState st = checkPlayerCondition(player, npc, "cond", "3"); final QuestState st = checkPlayerCondition(player, npc, 3);
if (st == null) if (st == null)
{ {
return null; return null;
@@ -261,7 +276,7 @@ public class Q032_AnObviousLie extends Quest
if (st.dropItemsAlways(MEDICINAL_HERB, 1, 20)) if (st.dropItemsAlways(MEDICINAL_HERB, 1, 20))
{ {
st.set("cond", "4"); st.setCond(4);
} }
return null; return null;

View File

@@ -30,19 +30,16 @@ public class Q033_MakeAPairOfDressShoes extends Quest
private static final int WOODLEY = 30838; private static final int WOODLEY = 30838;
private static final int IAN = 30164; private static final int IAN = 30164;
private static final int LEIKAR = 31520; private static final int LEIKAR = 31520;
// Items // Items
private static final int LEATHER = 1882; private static final int LEATHER = 1882;
private static final int THREAD = 1868; private static final int THREAD = 1868;
private static final int ADENA = 57; private static final int ADENA = 57;
// Rewards // Rewards
public static final int DRESS_SHOES_BOX = 7113; public static final int DRESS_SHOES_BOX = 7113;
public Q033_MakeAPairOfDressShoes() public Q033_MakeAPairOfDressShoes()
{ {
super(33, "Make a Pair of Dress Shoes"); super(33, "Make a Pair of Dress Shoes");
addStartNpc(WOODLEY); addStartNpc(WOODLEY);
addTalkId(WOODLEY, IAN, LEIKAR); addTalkId(WOODLEY, IAN, LEIKAR);
} }
@@ -57,27 +54,30 @@ public class Q033_MakeAPairOfDressShoes extends Quest
return htmltext; return htmltext;
} }
if (event.equals("30838-1.htm")) switch (event)
{ {
st.setState(State.STARTED); case "30838-1.htm":
st.set("cond", "1"); {
st.playSound(QuestState.SOUND_ACCEPT); st.startQuest();
break;
} }
else if (event.equals("31520-1.htm")) case "31520-1.htm":
{ {
st.set("cond", "2"); st.setCond(2);
st.playSound(QuestState.SOUND_MIDDLE); st.playSound(QuestState.SOUND_MIDDLE);
break;
} }
else if (event.equals("30838-3.htm")) case "30838-3.htm":
{ {
st.set("cond", "3"); st.setCond(3);
st.playSound(QuestState.SOUND_MIDDLE); st.playSound(QuestState.SOUND_MIDDLE);
break;
} }
else if (event.equals("30838-5.htm")) case "30838-5.htm":
{ {
if ((st.getQuestItemsCount(LEATHER) >= 200) && (st.getQuestItemsCount(THREAD) >= 600) && (st.getQuestItemsCount(ADENA) >= 200000)) if ((st.getQuestItemsCount(LEATHER) >= 200) && (st.getQuestItemsCount(THREAD) >= 600) && (st.getQuestItemsCount(ADENA) >= 200000))
{ {
st.set("cond", "4"); st.setCond(4);
st.playSound(QuestState.SOUND_MIDDLE); st.playSound(QuestState.SOUND_MIDDLE);
st.takeItems(ADENA, 200000); st.takeItems(ADENA, 200000);
st.takeItems(LEATHER, 200); st.takeItems(LEATHER, 200);
@@ -87,12 +87,13 @@ public class Q033_MakeAPairOfDressShoes extends Quest
{ {
htmltext = "30838-4a.htm"; htmltext = "30838-4a.htm";
} }
break;
} }
else if (event.equals("30164-1.htm")) case "30164-1.htm":
{ {
if (st.getQuestItemsCount(ADENA) >= 300000) if (st.getQuestItemsCount(ADENA) >= 300000)
{ {
st.set("cond", "5"); st.setCond(5);
st.playSound(QuestState.SOUND_MIDDLE); st.playSound(QuestState.SOUND_MIDDLE);
st.takeItems(ADENA, 300000); st.takeItems(ADENA, 300000);
} }
@@ -100,12 +101,15 @@ public class Q033_MakeAPairOfDressShoes extends Quest
{ {
htmltext = "30164-1a.htm"; htmltext = "30164-1a.htm";
} }
break;
} }
else if (event.equals("30838-7.htm")) case "30838-7.htm":
{ {
st.giveItems(DRESS_SHOES_BOX, 1); st.giveItems(DRESS_SHOES_BOX, 1);
st.playSound(QuestState.SOUND_FINISH); st.playSound(QuestState.SOUND_FINISH);
st.exitQuest(false); st.exitQuest(false);
break;
}
} }
return htmltext; return htmltext;
@@ -124,10 +128,11 @@ public class Q033_MakeAPairOfDressShoes extends Quest
switch (st.getState()) switch (st.getState())
{ {
case State.CREATED: case State.CREATED:
{
if (player.getLevel() >= 60) if (player.getLevel() >= 60)
{ {
final QuestState fwear = player.getQuestState(Q037_MakeFormalWear.class.getSimpleName()); final QuestState fwear = player.getQuestState(Q037_MakeFormalWear.class.getSimpleName());
if ((fwear != null) && (fwear.getInt("cond") == 7)) if ((fwear != null) && fwear.isCond(7))
{ {
htmltext = "30838-0.htm"; htmltext = "30838-0.htm";
} }
@@ -141,12 +146,14 @@ public class Q033_MakeAPairOfDressShoes extends Quest
htmltext = "30838-0b.htm"; htmltext = "30838-0b.htm";
} }
break; break;
}
case State.STARTED: case State.STARTED:
final int cond = st.getInt("cond"); {
final int cond = st.getCond();
switch (npc.getNpcId()) switch (npc.getNpcId())
{ {
case WOODLEY: case WOODLEY:
{
if (cond == 1) if (cond == 1)
{ {
htmltext = "30838-1.htm"; htmltext = "30838-1.htm";
@@ -175,8 +182,9 @@ public class Q033_MakeAPairOfDressShoes extends Quest
htmltext = "30838-6.htm"; htmltext = "30838-6.htm";
} }
break; break;
}
case LEIKAR: case LEIKAR:
{
if (cond == 1) if (cond == 1)
{ {
htmltext = "31520-0.htm"; htmltext = "31520-0.htm";
@@ -186,8 +194,9 @@ public class Q033_MakeAPairOfDressShoes extends Quest
htmltext = "31520-1a.htm"; htmltext = "31520-1a.htm";
} }
break; break;
}
case IAN: case IAN:
{
if (cond == 4) if (cond == 4)
{ {
htmltext = "30164-0.htm"; htmltext = "30164-0.htm";
@@ -198,12 +207,15 @@ public class Q033_MakeAPairOfDressShoes extends Quest
} }
break; break;
} }
}
break; break;
}
case State.COMPLETED: case State.COMPLETED:
{
htmltext = getAlreadyCompletedMsg(); htmltext = getAlreadyCompletedMsg();
break; break;
} }
}
return htmltext; return htmltext;
} }

View File

@@ -30,29 +30,23 @@ public class Q034_InSearchOfCloth extends Quest
private static final int RADIA = 30088; private static final int RADIA = 30088;
private static final int RALFORD = 30165; private static final int RALFORD = 30165;
private static final int VARAN = 30294; private static final int VARAN = 30294;
// Monsters // Monsters
private static final int TRISALIM_SPIDER = 20560; private static final int TRISALIM_SPIDER = 20560;
private static final int TRISALIM_TARANTULA = 20561; private static final int TRISALIM_TARANTULA = 20561;
// Items // Items
private static final int SPINNERET = 7528; private static final int SPINNERET = 7528;
private static final int SUEDE = 1866; private static final int SUEDE = 1866;
private static final int THREAD = 1868; private static final int THREAD = 1868;
private static final int SPIDERSILK = 7161; private static final int SPIDERSILK = 7161;
// Rewards // Rewards
private static final int MYSTERIOUS_CLOTH = 7076; private static final int MYSTERIOUS_CLOTH = 7076;
public Q034_InSearchOfCloth() public Q034_InSearchOfCloth()
{ {
super(34, "In Search of Cloth"); super(34, "In Search of Cloth");
registerQuestItems(SPINNERET, SPIDERSILK); registerQuestItems(SPINNERET, SPIDERSILK);
addStartNpc(RADIA); addStartNpc(RADIA);
addTalkId(RADIA, RALFORD, VARAN); addTalkId(RADIA, RALFORD, VARAN);
addKillId(TRISALIM_SPIDER, TRISALIM_TARANTULA); addKillId(TRISALIM_SPIDER, TRISALIM_TARANTULA);
} }
@@ -66,35 +60,40 @@ public class Q034_InSearchOfCloth extends Quest
return htmltext; return htmltext;
} }
if (event.equals("30088-1.htm")) switch (event)
{ {
st.setState(State.STARTED); case "30088-1.htm":
st.set("cond", "1"); {
st.playSound(QuestState.SOUND_ACCEPT); st.startQuest();
break;
} }
else if (event.equals("30294-1.htm")) case "30294-1.htm":
{ {
st.set("cond", "2"); st.setCond(2);
st.playSound(QuestState.SOUND_MIDDLE); st.playSound(QuestState.SOUND_MIDDLE);
break;
} }
else if (event.equals("30088-3.htm")) case "30088-3.htm":
{ {
st.set("cond", "3"); st.setCond(3);
st.playSound(QuestState.SOUND_MIDDLE); st.playSound(QuestState.SOUND_MIDDLE);
break;
} }
else if (event.equals("30165-1.htm")) case "30165-1.htm":
{ {
st.set("cond", "4"); st.setCond(4);
st.playSound(QuestState.SOUND_MIDDLE); st.playSound(QuestState.SOUND_MIDDLE);
break;
} }
else if (event.equals("30165-3.htm")) case "30165-3.htm":
{ {
st.set("cond", "6"); st.setCond(6);
st.playSound(QuestState.SOUND_MIDDLE); st.playSound(QuestState.SOUND_MIDDLE);
st.takeItems(SPINNERET, 10); st.takeItems(SPINNERET, 10);
st.giveItems(SPIDERSILK, 1); st.giveItems(SPIDERSILK, 1);
break;
} }
else if (event.equals("30088-5.htm")) case "30088-5.htm":
{ {
if ((st.getQuestItemsCount(SUEDE) >= 3000) && (st.getQuestItemsCount(THREAD) >= 5000) && st.hasQuestItems(SPIDERSILK)) if ((st.getQuestItemsCount(SUEDE) >= 3000) && (st.getQuestItemsCount(THREAD) >= 5000) && st.hasQuestItems(SPIDERSILK))
{ {
@@ -109,6 +108,8 @@ public class Q034_InSearchOfCloth extends Quest
{ {
htmltext = "30088-4a.htm"; htmltext = "30088-4a.htm";
} }
break;
}
} }
return htmltext; return htmltext;
@@ -127,10 +128,11 @@ public class Q034_InSearchOfCloth extends Quest
switch (st.getState()) switch (st.getState())
{ {
case State.CREATED: case State.CREATED:
{
if (player.getLevel() >= 60) if (player.getLevel() >= 60)
{ {
final QuestState fwear = player.getQuestState(Q037_MakeFormalWear.class.getSimpleName()); final QuestState fwear = player.getQuestState(Q037_MakeFormalWear.class.getSimpleName());
if ((fwear != null) && (fwear.getInt("cond") == 6)) if ((fwear != null) && fwear.isCond(6))
{ {
htmltext = "30088-0.htm"; htmltext = "30088-0.htm";
} }
@@ -144,12 +146,14 @@ public class Q034_InSearchOfCloth extends Quest
htmltext = "30088-0b.htm"; htmltext = "30088-0b.htm";
} }
break; break;
}
case State.STARTED: case State.STARTED:
final int cond = st.getInt("cond"); {
final int cond = st.getCond();
switch (npc.getNpcId()) switch (npc.getNpcId())
{ {
case RADIA: case RADIA:
{
if (cond == 1) if (cond == 1)
{ {
htmltext = "30088-1a.htm"; htmltext = "30088-1a.htm";
@@ -174,8 +178,9 @@ public class Q034_InSearchOfCloth extends Quest
} }
} }
break; break;
}
case VARAN: case VARAN:
{
if (cond == 1) if (cond == 1)
{ {
htmltext = "30294-0.htm"; htmltext = "30294-0.htm";
@@ -185,8 +190,9 @@ public class Q034_InSearchOfCloth extends Quest
htmltext = "30294-1a.htm"; htmltext = "30294-1a.htm";
} }
break; break;
}
case RALFORD: case RALFORD:
{
if (cond == 3) if (cond == 3)
{ {
htmltext = "30165-0.htm"; htmltext = "30165-0.htm";
@@ -205,12 +211,15 @@ public class Q034_InSearchOfCloth extends Quest
} }
break; break;
} }
}
break; break;
}
case State.COMPLETED: case State.COMPLETED:
{
htmltext = getAlreadyCompletedMsg(); htmltext = getAlreadyCompletedMsg();
break; break;
} }
}
return htmltext; return htmltext;
} }
@@ -218,7 +227,7 @@ public class Q034_InSearchOfCloth extends Quest
@Override @Override
public String onKill(NpcInstance npc, PlayerInstance player, boolean isPet) public String onKill(NpcInstance npc, PlayerInstance player, boolean isPet)
{ {
final QuestState st = checkPlayerCondition(player, npc, "cond", "4"); final QuestState st = checkPlayerCondition(player, npc, 4);
if (st == null) if (st == null)
{ {
return null; return null;
@@ -226,7 +235,7 @@ public class Q034_InSearchOfCloth extends Quest
if (st.dropItems(SPINNERET, 1, 10, 500000)) if (st.dropItems(SPINNERET, 1, 10, 500000))
{ {
st.set("cond", "5"); st.setCond(5);
} }
return null; return null;

View File

@@ -29,25 +29,20 @@ public class Q035_FindGlitteringJewelry extends Quest
// NPCs // NPCs
private static final int ELLIE = 30091; private static final int ELLIE = 30091;
private static final int FELTON = 30879; private static final int FELTON = 30879;
// Items // Items
private static final int ROUGH_JEWEL = 7162; private static final int ROUGH_JEWEL = 7162;
private static final int ORIHARUKON = 1893; private static final int ORIHARUKON = 1893;
private static final int SILVER_NUGGET = 1873; private static final int SILVER_NUGGET = 1873;
private static final int THONS = 4044; private static final int THONS = 4044;
// Reward // Reward
private static final int JEWEL_BOX = 7077; private static final int JEWEL_BOX = 7077;
public Q035_FindGlitteringJewelry() public Q035_FindGlitteringJewelry()
{ {
super(35, "Find Glittering Jewelry"); super(35, "Find Glittering Jewelry");
registerQuestItems(ROUGH_JEWEL); registerQuestItems(ROUGH_JEWEL);
addStartNpc(ELLIE); addStartNpc(ELLIE);
addTalkId(ELLIE, FELTON); addTalkId(ELLIE, FELTON);
addKillId(20135); // Alligator addKillId(20135); // Alligator
} }
@@ -61,24 +56,27 @@ public class Q035_FindGlitteringJewelry extends Quest
return htmltext; return htmltext;
} }
if (event.equals("30091-1.htm")) switch (event)
{ {
st.setState(State.STARTED); case "30091-1.htm":
st.set("cond", "1"); {
st.playSound(QuestState.SOUND_ACCEPT); st.startQuest();
break;
} }
else if (event.equals("30879-1.htm")) case "30879-1.htm":
{ {
st.set("cond", "2"); st.setCond(2);
st.playSound(QuestState.SOUND_MIDDLE); st.playSound(QuestState.SOUND_MIDDLE);
break;
} }
else if (event.equals("30091-3.htm")) case "30091-3.htm":
{ {
st.set("cond", "4"); st.setCond(4);
st.playSound(QuestState.SOUND_MIDDLE); st.playSound(QuestState.SOUND_MIDDLE);
st.takeItems(ROUGH_JEWEL, 10); st.takeItems(ROUGH_JEWEL, 10);
break;
} }
else if (event.equals("30091-5.htm")) case "30091-5.htm":
{ {
if ((st.getQuestItemsCount(ORIHARUKON) >= 5) && (st.getQuestItemsCount(SILVER_NUGGET) >= 500) && (st.getQuestItemsCount(THONS) >= 150)) if ((st.getQuestItemsCount(ORIHARUKON) >= 5) && (st.getQuestItemsCount(SILVER_NUGGET) >= 500) && (st.getQuestItemsCount(THONS) >= 150))
{ {
@@ -93,6 +91,8 @@ public class Q035_FindGlitteringJewelry extends Quest
{ {
htmltext = "30091-4a.htm"; htmltext = "30091-4a.htm";
} }
break;
}
} }
return htmltext; return htmltext;
@@ -111,10 +111,11 @@ public class Q035_FindGlitteringJewelry extends Quest
switch (st.getState()) switch (st.getState())
{ {
case State.CREATED: case State.CREATED:
{
if (player.getLevel() >= 60) if (player.getLevel() >= 60)
{ {
final QuestState fwear = player.getQuestState(Q037_MakeFormalWear.class.getSimpleName()); final QuestState fwear = player.getQuestState(Q037_MakeFormalWear.class.getSimpleName());
if ((fwear != null) && (fwear.getInt("cond") == 6)) if ((fwear != null) && fwear.isCond(6))
{ {
htmltext = "30091-0.htm"; htmltext = "30091-0.htm";
} }
@@ -128,12 +129,14 @@ public class Q035_FindGlitteringJewelry extends Quest
htmltext = "30091-0b.htm"; htmltext = "30091-0b.htm";
} }
break; break;
}
case State.STARTED: case State.STARTED:
final int cond = st.getInt("cond"); {
final int cond = st.getCond();
switch (npc.getNpcId()) switch (npc.getNpcId())
{ {
case ELLIE: case ELLIE:
{
if ((cond == 1) || (cond == 2)) if ((cond == 1) || (cond == 2))
{ {
htmltext = "30091-1a.htm"; htmltext = "30091-1a.htm";
@@ -147,8 +150,9 @@ public class Q035_FindGlitteringJewelry extends Quest
htmltext = ((st.getQuestItemsCount(ORIHARUKON) >= 5) && (st.getQuestItemsCount(SILVER_NUGGET) >= 500) && (st.getQuestItemsCount(THONS) >= 150)) ? "30091-4.htm" : "30091-4a.htm"; htmltext = ((st.getQuestItemsCount(ORIHARUKON) >= 5) && (st.getQuestItemsCount(SILVER_NUGGET) >= 500) && (st.getQuestItemsCount(THONS) >= 150)) ? "30091-4.htm" : "30091-4a.htm";
} }
break; break;
}
case FELTON: case FELTON:
{
if (cond == 1) if (cond == 1)
{ {
htmltext = "30879-0.htm"; htmltext = "30879-0.htm";
@@ -159,12 +163,15 @@ public class Q035_FindGlitteringJewelry extends Quest
} }
break; break;
} }
}
break; break;
}
case State.COMPLETED: case State.COMPLETED:
{
htmltext = getAlreadyCompletedMsg(); htmltext = getAlreadyCompletedMsg();
break; break;
} }
}
return htmltext; return htmltext;
} }
@@ -172,7 +179,7 @@ public class Q035_FindGlitteringJewelry extends Quest
@Override @Override
public String onKill(NpcInstance npc, PlayerInstance player, boolean isPet) public String onKill(NpcInstance npc, PlayerInstance player, boolean isPet)
{ {
final QuestState st = checkPlayerCondition(player, npc, "cond", "2"); final QuestState st = checkPlayerCondition(player, npc, 2);
if (st == null) if (st == null)
{ {
return null; return null;
@@ -180,7 +187,7 @@ public class Q035_FindGlitteringJewelry extends Quest
if (st.dropItems(ROUGH_JEWEL, 1, 10, 500000)) if (st.dropItems(ROUGH_JEWEL, 1, 10, 500000))
{ {
st.set("cond", "3"); st.setCond(3);
} }
return null; return null;

View File

@@ -30,19 +30,15 @@ public class Q036_MakeASewingKit extends Quest
private static final int REINFORCED_STEEL = 7163; private static final int REINFORCED_STEEL = 7163;
private static final int ARTISANS_FRAME = 1891; private static final int ARTISANS_FRAME = 1891;
private static final int ORIHARUKON = 1893; private static final int ORIHARUKON = 1893;
// Reward // Reward
private static final int SEWING_KIT = 7078; private static final int SEWING_KIT = 7078;
public Q036_MakeASewingKit() public Q036_MakeASewingKit()
{ {
super(36, "Make a Sewing Kit"); super(36, "Make a Sewing Kit");
registerQuestItems(REINFORCED_STEEL); registerQuestItems(REINFORCED_STEEL);
addStartNpc(30847); // Ferris addStartNpc(30847); // Ferris
addTalkId(30847); addTalkId(30847);
addKillId(20566); // Iron Golem addKillId(20566); // Iron Golem
} }
@@ -56,19 +52,21 @@ public class Q036_MakeASewingKit extends Quest
return htmltext; return htmltext;
} }
if (event.equals("30847-1.htm")) switch (event)
{ {
st.setState(State.STARTED); case "30847-1.htm":
st.set("cond", "1"); {
st.playSound(QuestState.SOUND_ACCEPT); st.startQuest();
break;
} }
else if (event.equals("30847-3.htm")) case "30847-3.htm":
{ {
st.set("cond", "3"); st.setCond(3);
st.playSound(QuestState.SOUND_MIDDLE); st.playSound(QuestState.SOUND_MIDDLE);
st.takeItems(REINFORCED_STEEL, 5); st.takeItems(REINFORCED_STEEL, 5);
break;
} }
else if (event.equals("30847-5.htm")) case "30847-5.htm":
{ {
if ((st.getQuestItemsCount(ORIHARUKON) >= 10) && (st.getQuestItemsCount(ARTISANS_FRAME) >= 10)) if ((st.getQuestItemsCount(ORIHARUKON) >= 10) && (st.getQuestItemsCount(ARTISANS_FRAME) >= 10))
{ {
@@ -82,6 +80,8 @@ public class Q036_MakeASewingKit extends Quest
{ {
htmltext = "30847-4a.htm"; htmltext = "30847-4a.htm";
} }
break;
}
} }
return htmltext; return htmltext;
@@ -100,10 +100,11 @@ public class Q036_MakeASewingKit extends Quest
switch (st.getState()) switch (st.getState())
{ {
case State.CREATED: case State.CREATED:
{
if (player.getLevel() >= 60) if (player.getLevel() >= 60)
{ {
final QuestState fwear = player.getQuestState(Q037_MakeFormalWear.class.getSimpleName()); final QuestState fwear = player.getQuestState(Q037_MakeFormalWear.class.getSimpleName());
if ((fwear != null) && (fwear.getInt("cond") == 6)) if ((fwear != null) && fwear.isCond(6))
{ {
htmltext = "30847-0.htm"; htmltext = "30847-0.htm";
} }
@@ -117,9 +118,10 @@ public class Q036_MakeASewingKit extends Quest
htmltext = "30847-0b.htm"; htmltext = "30847-0b.htm";
} }
break; break;
}
case State.STARTED: case State.STARTED:
final int cond = st.getInt("cond"); {
final int cond = st.getCond();
if (cond == 1) if (cond == 1)
{ {
htmltext = "30847-1a.htm"; htmltext = "30847-1a.htm";
@@ -133,11 +135,13 @@ public class Q036_MakeASewingKit extends Quest
htmltext = ((st.getQuestItemsCount(ORIHARUKON) < 10) || (st.getQuestItemsCount(ARTISANS_FRAME) < 10)) ? "30847-4a.htm" : "30847-4.htm"; htmltext = ((st.getQuestItemsCount(ORIHARUKON) < 10) || (st.getQuestItemsCount(ARTISANS_FRAME) < 10)) ? "30847-4a.htm" : "30847-4.htm";
} }
break; break;
}
case State.COMPLETED: case State.COMPLETED:
{
htmltext = getAlreadyCompletedMsg(); htmltext = getAlreadyCompletedMsg();
break; break;
} }
}
return htmltext; return htmltext;
} }
@@ -145,7 +149,7 @@ public class Q036_MakeASewingKit extends Quest
@Override @Override
public String onKill(NpcInstance npc, PlayerInstance player, boolean isPet) public String onKill(NpcInstance npc, PlayerInstance player, boolean isPet)
{ {
final QuestState st = checkPlayerCondition(player, npc, "cond", "1"); final QuestState st = checkPlayerCondition(player, npc, 1);
if (st == null) if (st == null)
{ {
return null; return null;
@@ -153,7 +157,7 @@ public class Q036_MakeASewingKit extends Quest
if (st.dropItems(REINFORCED_STEEL, 1, 5, 500000)) if (st.dropItems(REINFORCED_STEEL, 1, 5, 500000))
{ {
st.set("cond", "2"); st.setCond(2);
} }
return null; return null;

View File

@@ -29,7 +29,6 @@ public class Q037_MakeFormalWear extends Quest
private static final int LEIKAR = 31520; private static final int LEIKAR = 31520;
private static final int JEREMY = 31521; private static final int JEREMY = 31521;
private static final int MIST = 31627; private static final int MIST = 31627;
// Items // Items
private static final int MYSTERIOUS_CLOTH = 7076; private static final int MYSTERIOUS_CLOTH = 7076;
private static final int JEWEL_BOX = 7077; private static final int JEWEL_BOX = 7077;
@@ -38,16 +37,13 @@ public class Q037_MakeFormalWear extends Quest
private static final int SIGNET_RING = 7164; private static final int SIGNET_RING = 7164;
private static final int ICE_WINE = 7160; private static final int ICE_WINE = 7160;
private static final int BOX_OF_COOKIES = 7159; private static final int BOX_OF_COOKIES = 7159;
// Reward // Reward
private static final int FORMAL_WEAR = 6408; private static final int FORMAL_WEAR = 6408;
public Q037_MakeFormalWear() public Q037_MakeFormalWear()
{ {
super(37, "Make Formal Wear"); super(37, "Make Formal Wear");
registerQuestItems(SIGNET_RING, ICE_WINE, BOX_OF_COOKIES); registerQuestItems(SIGNET_RING, ICE_WINE, BOX_OF_COOKIES);
addStartNpc(ALEXIS); addStartNpc(ALEXIS);
addTalkId(ALEXIS, LEIKAR, JEREMY, MIST); addTalkId(ALEXIS, LEIKAR, JEREMY, MIST);
} }
@@ -62,57 +58,66 @@ public class Q037_MakeFormalWear extends Quest
return htmltext; return htmltext;
} }
if (event.equals("30842-1.htm")) switch (event)
{ {
st.setState(State.STARTED); case "30842-1.htm":
st.set("cond", "1"); {
st.playSound(QuestState.SOUND_ACCEPT); st.startQuest();
break;
} }
else if (event.equals("31520-1.htm")) case "31520-1.htm":
{ {
st.set("cond", "2"); st.setCond(2);
st.playSound(QuestState.SOUND_MIDDLE); st.playSound(QuestState.SOUND_MIDDLE);
st.giveItems(SIGNET_RING, 1); st.giveItems(SIGNET_RING, 1);
break;
} }
else if (event.equals("31521-1.htm")) case "31521-1.htm":
{ {
st.set("cond", "3"); st.setCond(3);
st.playSound(QuestState.SOUND_MIDDLE); st.playSound(QuestState.SOUND_MIDDLE);
st.takeItems(SIGNET_RING, 1); st.takeItems(SIGNET_RING, 1);
st.giveItems(ICE_WINE, 1); st.giveItems(ICE_WINE, 1);
break;
} }
else if (event.equals("31627-1.htm")) case "31627-1.htm":
{ {
st.set("cond", "4"); st.setCond(4);
st.playSound(QuestState.SOUND_MIDDLE); st.playSound(QuestState.SOUND_MIDDLE);
st.takeItems(ICE_WINE, 1); st.takeItems(ICE_WINE, 1);
break;
} }
else if (event.equals("31521-3.htm")) case "31521-3.htm":
{ {
st.set("cond", "5"); st.setCond(5);
st.playSound(QuestState.SOUND_MIDDLE); st.playSound(QuestState.SOUND_MIDDLE);
st.giveItems(BOX_OF_COOKIES, 1); st.giveItems(BOX_OF_COOKIES, 1);
break;
} }
else if (event.equals("31520-3.htm")) case "31520-3.htm":
{ {
st.set("cond", "6"); st.setCond(6);
st.playSound(QuestState.SOUND_MIDDLE); st.playSound(QuestState.SOUND_MIDDLE);
st.takeItems(BOX_OF_COOKIES, 1); st.takeItems(BOX_OF_COOKIES, 1);
break;
} }
else if (event.equals("31520-5.htm")) case "31520-5.htm":
{ {
st.set("cond", "7"); st.setCond(7);
st.playSound(QuestState.SOUND_MIDDLE); st.playSound(QuestState.SOUND_MIDDLE);
st.takeItems(JEWEL_BOX, 1); st.takeItems(JEWEL_BOX, 1);
st.takeItems(MYSTERIOUS_CLOTH, 1); st.takeItems(MYSTERIOUS_CLOTH, 1);
st.takeItems(SEWING_KIT, 1); st.takeItems(SEWING_KIT, 1);
break;
} }
else if (event.equals("31520-7.htm")) case "31520-7.htm":
{ {
st.takeItems(DRESS_SHOES_BOX, 1); st.takeItems(DRESS_SHOES_BOX, 1);
st.giveItems(FORMAL_WEAR, 1); st.giveItems(FORMAL_WEAR, 1);
st.playSound(QuestState.SOUND_FINISH); st.playSound(QuestState.SOUND_FINISH);
st.exitQuest(false); st.exitQuest(false);
break;
}
} }
return htmltext; return htmltext;
@@ -131,21 +136,25 @@ public class Q037_MakeFormalWear extends Quest
switch (st.getState()) switch (st.getState())
{ {
case State.CREATED: case State.CREATED:
{
htmltext = (player.getLevel() < 60) ? "30842-0a.htm" : "30842-0.htm"; htmltext = (player.getLevel() < 60) ? "30842-0a.htm" : "30842-0.htm";
break; break;
}
case State.STARTED: case State.STARTED:
final int cond = st.getInt("cond"); {
final int cond = st.getCond();
switch (npc.getNpcId()) switch (npc.getNpcId())
{ {
case ALEXIS: case ALEXIS:
{
if (cond == 1) if (cond == 1)
{ {
htmltext = "30842-2.htm"; htmltext = "30842-2.htm";
} }
break; break;
}
case LEIKAR: case LEIKAR:
{
if (cond == 1) if (cond == 1)
{ {
htmltext = "31520-0.htm"; htmltext = "31520-0.htm";
@@ -174,8 +183,9 @@ public class Q037_MakeFormalWear extends Quest
htmltext = (st.hasQuestItems(DRESS_SHOES_BOX)) ? "31520-6.htm" : "31520-5a.htm"; htmltext = (st.hasQuestItems(DRESS_SHOES_BOX)) ? "31520-6.htm" : "31520-5a.htm";
} }
break; break;
}
case JEREMY: case JEREMY:
{
if (st.hasQuestItems(SIGNET_RING)) if (st.hasQuestItems(SIGNET_RING))
{ {
htmltext = "31521-0.htm"; htmltext = "31521-0.htm";
@@ -193,8 +203,9 @@ public class Q037_MakeFormalWear extends Quest
htmltext = "31521-3a.htm"; htmltext = "31521-3a.htm";
} }
break; break;
}
case MIST: case MIST:
{
if (cond == 3) if (cond == 3)
{ {
htmltext = "31627-0.htm"; htmltext = "31627-0.htm";
@@ -205,12 +216,15 @@ public class Q037_MakeFormalWear extends Quest
} }
break; break;
} }
}
break; break;
}
case State.COMPLETED: case State.COMPLETED:
{
htmltext = getAlreadyCompletedMsg(); htmltext = getAlreadyCompletedMsg();
break; break;
} }
}
return htmltext; return htmltext;
} }

View File

@@ -28,86 +28,45 @@ import org.l2jmobius.gameserver.model.quest.State;
public class Q038_DragonFangs extends Quest public class Q038_DragonFangs extends Quest
{ {
// NPCs
private static final int LUIS = 30386;
private static final int IRIS = 30034;
private static final int ROHMER = 30344;
// Items // Items
private static final int FEATHER_ORNAMENT = 7173; private static final int FEATHER_ORNAMENT = 7173;
private static final int TOOTH_OF_TOTEM = 7174; private static final int TOOTH_OF_TOTEM = 7174;
private static final int TOOTH_OF_DRAGON = 7175; private static final int TOOTH_OF_DRAGON = 7175;
private static final int LETTER_OF_IRIS = 7176; private static final int LETTER_OF_IRIS = 7176;
private static final int LETTER_OF_ROHMER = 7177; private static final int LETTER_OF_ROHMER = 7177;
// NPCs
private static final int LUIS = 30386;
private static final int IRIS = 30034;
private static final int ROHMER = 30344;
// Reward { item, adena } // Reward { item, adena }
private static final int[][] REWARD = private static final int[][] REWARD =
{ {
{ // @formatter:off
45, {45, 5200},
5200 {627, 1500},
}, {1123, 3200},
{ {605, 3200}
627, // @formatter:on
1500
},
{
1123,
3200
},
{
605,
3200
}
}; };
// Droplist // Droplist
private static final Map<Integer, int[]> DROPLIST = new HashMap<>(); private static final Map<Integer, int[]> DROPLIST = new HashMap<>();
static static
{ {
DROPLIST.put(21100, new int[] // @formatter:off
{ DROPLIST.put(21100, new int[]{1, FEATHER_ORNAMENT, 100, 1000000});
1, DROPLIST.put(20357, new int[]{1, FEATHER_ORNAMENT, 100, 1000000});
FEATHER_ORNAMENT, DROPLIST.put(21101, new int[]{6, TOOTH_OF_DRAGON, 50, 500000});
100, DROPLIST.put(20356, new int[]{6, TOOTH_OF_DRAGON, 50, 500000});
1000000 // @formatter:on
});
DROPLIST.put(20357, new int[]
{
1,
FEATHER_ORNAMENT,
100,
1000000
});
DROPLIST.put(21101, new int[]
{
6,
TOOTH_OF_DRAGON,
50,
500000
});
DROPLIST.put(20356, new int[]
{
6,
TOOTH_OF_DRAGON,
50,
500000
});
} }
public Q038_DragonFangs() public Q038_DragonFangs()
{ {
super(38, "Dragon Fangs"); super(38, "Dragon Fangs");
registerQuestItems(FEATHER_ORNAMENT, TOOTH_OF_TOTEM, TOOTH_OF_DRAGON, LETTER_OF_IRIS, LETTER_OF_ROHMER); registerQuestItems(FEATHER_ORNAMENT, TOOTH_OF_TOTEM, TOOTH_OF_DRAGON, LETTER_OF_IRIS, LETTER_OF_ROHMER);
addStartNpc(LUIS); addStartNpc(LUIS);
addTalkId(LUIS, IRIS, ROHMER); addTalkId(LUIS, IRIS, ROHMER);
addKillId(DROPLIST.keySet());
for (int mob : DROPLIST.keySet())
{
addKillId(mob);
}
} }
@Override @Override
@@ -120,52 +79,57 @@ public class Q038_DragonFangs extends Quest
return htmltext; return htmltext;
} }
if (event.equals("30386-02.htm")) switch (event)
{ {
st.setState(State.STARTED); case "30386-02.htm":
st.set("cond", "1"); {
st.playSound(QuestState.SOUND_ACCEPT); st.startQuest();
break;
} }
else if (event.equals("30386-04.htm")) case "30386-04.htm":
{ {
st.set("cond", "3"); st.setCond(3);
st.playSound(QuestState.SOUND_MIDDLE); st.playSound(QuestState.SOUND_MIDDLE);
st.takeItems(FEATHER_ORNAMENT, 100); st.takeItems(FEATHER_ORNAMENT, 100);
st.giveItems(TOOTH_OF_TOTEM, 1); st.giveItems(TOOTH_OF_TOTEM, 1);
break;
} }
else if (event.equals("30034-02a.htm")) case "30034-02a.htm":
{ {
if (st.hasQuestItems(TOOTH_OF_TOTEM)) if (st.hasQuestItems(TOOTH_OF_TOTEM))
{ {
htmltext = "30034-02.htm"; htmltext = "30034-02.htm";
st.set("cond", "4"); st.setCond(4);
st.playSound(QuestState.SOUND_MIDDLE); st.playSound(QuestState.SOUND_MIDDLE);
st.takeItems(TOOTH_OF_TOTEM, 1); st.takeItems(TOOTH_OF_TOTEM, 1);
st.giveItems(LETTER_OF_IRIS, 1); st.giveItems(LETTER_OF_IRIS, 1);
} }
break;
} }
else if (event.equals("30344-02a.htm")) case "30344-02a.htm":
{ {
if (st.hasQuestItems(LETTER_OF_IRIS)) if (st.hasQuestItems(LETTER_OF_IRIS))
{ {
htmltext = "30344-02.htm"; htmltext = "30344-02.htm";
st.set("cond", "5"); st.setCond(5);
st.playSound(QuestState.SOUND_MIDDLE); st.playSound(QuestState.SOUND_MIDDLE);
st.takeItems(LETTER_OF_IRIS, 1); st.takeItems(LETTER_OF_IRIS, 1);
st.giveItems(LETTER_OF_ROHMER, 1); st.giveItems(LETTER_OF_ROHMER, 1);
} }
break;
} }
else if (event.equals("30034-04a.htm")) case "30034-04a.htm":
{ {
if (st.hasQuestItems(LETTER_OF_ROHMER)) if (st.hasQuestItems(LETTER_OF_ROHMER))
{ {
htmltext = "30034-04.htm"; htmltext = "30034-04.htm";
st.set("cond", "6"); st.setCond(6);
st.playSound(QuestState.SOUND_MIDDLE); st.playSound(QuestState.SOUND_MIDDLE);
st.takeItems(LETTER_OF_ROHMER, 1); st.takeItems(LETTER_OF_ROHMER, 1);
} }
break;
} }
else if (event.equals("30034-06a.htm")) case "30034-06a.htm":
{ {
if (st.getQuestItemsCount(TOOTH_OF_DRAGON) >= 50) if (st.getQuestItemsCount(TOOTH_OF_DRAGON) >= 50)
{ {
@@ -177,6 +141,8 @@ public class Q038_DragonFangs extends Quest
st.playSound(QuestState.SOUND_FINISH); st.playSound(QuestState.SOUND_FINISH);
st.exitQuest(false); st.exitQuest(false);
} }
break;
}
} }
return htmltext; return htmltext;
@@ -199,7 +165,7 @@ public class Q038_DragonFangs extends Quest
break; break;
case State.STARTED: case State.STARTED:
final int cond = st.getInt("cond"); final int cond = st.getCond();
switch (npc.getNpcId()) switch (npc.getNpcId())
{ {
case LUIS: case LUIS:
@@ -271,9 +237,9 @@ public class Q038_DragonFangs extends Quest
} }
final int[] droplist = DROPLIST.get(npc.getNpcId()); final int[] droplist = DROPLIST.get(npc.getNpcId());
if ((st.getInt("cond") == droplist[0]) && st.dropItems(droplist[1], 1, droplist[2], droplist[3])) if (st.isCond(droplist[0]) && st.dropItems(droplist[1], 1, droplist[2], droplist[3]))
{ {
st.set("cond", String.valueOf(droplist[0] + 1)); st.setCond(droplist[0] + 1);
} }
return null; return null;

View File

@@ -30,64 +30,34 @@ public class Q039_RedEyedInvaders extends Quest
// NPCs // NPCs
private static final int BABENCO = 30334; private static final int BABENCO = 30334;
private static final int BATHIS = 30332; private static final int BATHIS = 30332;
// Monsters
// Mobs
private static final int MAILLE_LIZARDMAN = 20919; private static final int MAILLE_LIZARDMAN = 20919;
private static final int MAILLE_LIZARDMAN_SCOUT = 20920; private static final int MAILLE_LIZARDMAN_SCOUT = 20920;
private static final int MAILLE_LIZARDMAN_GUARD = 20921; private static final int MAILLE_LIZARDMAN_GUARD = 20921;
private static final int ARANEID = 20925; private static final int ARANEID = 20925;
// Items // Items
private static final int BLACK_BONE_NECKLACE = 7178; private static final int BLACK_BONE_NECKLACE = 7178;
private static final int RED_BONE_NECKLACE = 7179; private static final int RED_BONE_NECKLACE = 7179;
private static final int INCENSE_POUCH = 7180; private static final int INCENSE_POUCH = 7180;
private static final int GEM_OF_MAILLE = 7181; private static final int GEM_OF_MAILLE = 7181;
// @formatter:off
// First droplist // First droplist
private static final Map<Integer, int[]> FIRST_DP = new HashMap<>(); private static final Map<Integer, int[]> FIRST_DP = new HashMap<>();
static static
{ {
FIRST_DP.put(MAILLE_LIZARDMAN_GUARD, new int[] FIRST_DP.put(MAILLE_LIZARDMAN_GUARD, new int[]{RED_BONE_NECKLACE, BLACK_BONE_NECKLACE});
{ FIRST_DP.put(MAILLE_LIZARDMAN, new int[]{BLACK_BONE_NECKLACE, RED_BONE_NECKLACE});
RED_BONE_NECKLACE, FIRST_DP.put(MAILLE_LIZARDMAN_SCOUT, new int[]{BLACK_BONE_NECKLACE, RED_BONE_NECKLACE});
BLACK_BONE_NECKLACE
});
FIRST_DP.put(MAILLE_LIZARDMAN, new int[]
{
BLACK_BONE_NECKLACE,
RED_BONE_NECKLACE
});
FIRST_DP.put(MAILLE_LIZARDMAN_SCOUT, new int[]
{
BLACK_BONE_NECKLACE,
RED_BONE_NECKLACE
});
} }
// Second droplist // Second droplist
private static final Map<Integer, int[]> SECOND_DP = new HashMap<>(); private static final Map<Integer, int[]> SECOND_DP = new HashMap<>();
static static
{ {
SECOND_DP.put(ARANEID, new int[] SECOND_DP.put(ARANEID, new int[]{GEM_OF_MAILLE, INCENSE_POUCH, 500000});
{ SECOND_DP.put(MAILLE_LIZARDMAN_GUARD, new int[]{INCENSE_POUCH, GEM_OF_MAILLE, 300000});
GEM_OF_MAILLE, SECOND_DP.put(MAILLE_LIZARDMAN_SCOUT, new int[]{INCENSE_POUCH, GEM_OF_MAILLE, 250000});
INCENSE_POUCH,
500000
});
SECOND_DP.put(MAILLE_LIZARDMAN_GUARD, new int[]
{
INCENSE_POUCH,
GEM_OF_MAILLE,
300000
});
SECOND_DP.put(MAILLE_LIZARDMAN_SCOUT, new int[]
{
INCENSE_POUCH,
GEM_OF_MAILLE,
250000
});
} }
// @formatter:on
// Rewards // Rewards
private static final int GREEN_COLORED_LURE_HG = 6521; private static final int GREEN_COLORED_LURE_HG = 6521;
private static final int BABY_DUCK_RODE = 6529; private static final int BABY_DUCK_RODE = 6529;
@@ -96,12 +66,9 @@ public class Q039_RedEyedInvaders extends Quest
public Q039_RedEyedInvaders() public Q039_RedEyedInvaders()
{ {
super(39, "Red-Eyed Invaders"); super(39, "Red-Eyed Invaders");
registerQuestItems(BLACK_BONE_NECKLACE, RED_BONE_NECKLACE, INCENSE_POUCH, GEM_OF_MAILLE); registerQuestItems(BLACK_BONE_NECKLACE, RED_BONE_NECKLACE, INCENSE_POUCH, GEM_OF_MAILLE);
addStartNpc(BABENCO); addStartNpc(BABENCO);
addTalkId(BABENCO, BATHIS); addTalkId(BABENCO, BATHIS);
addKillId(MAILLE_LIZARDMAN, MAILLE_LIZARDMAN_SCOUT, MAILLE_LIZARDMAN_GUARD, ARANEID); addKillId(MAILLE_LIZARDMAN, MAILLE_LIZARDMAN_SCOUT, MAILLE_LIZARDMAN_GUARD, ARANEID);
} }
@@ -115,25 +82,28 @@ public class Q039_RedEyedInvaders extends Quest
return htmltext; return htmltext;
} }
if (event.equals("30334-1.htm")) switch (event)
{ {
st.setState(State.STARTED); case "30334-1.htm":
st.set("cond", "1"); {
st.playSound(QuestState.SOUND_ACCEPT); st.startQuest();
break;
} }
else if (event.equals("30332-1.htm")) case "30332-1.htm":
{ {
st.set("cond", "2"); st.setCond(2);
st.playSound(QuestState.SOUND_MIDDLE); st.playSound(QuestState.SOUND_MIDDLE);
break;
} }
else if (event.equals("30332-3.htm")) case "30332-3.htm":
{ {
st.set("cond", "4"); st.setCond(4);
st.takeItems(BLACK_BONE_NECKLACE, -1); st.takeItems(BLACK_BONE_NECKLACE, -1);
st.takeItems(RED_BONE_NECKLACE, -1); st.takeItems(RED_BONE_NECKLACE, -1);
st.playSound(QuestState.SOUND_MIDDLE); st.playSound(QuestState.SOUND_MIDDLE);
break;
} }
else if (event.equals("30332-5.htm")) case "30332-5.htm":
{ {
st.takeItems(INCENSE_POUCH, -1); st.takeItems(INCENSE_POUCH, -1);
st.takeItems(GEM_OF_MAILLE, -1); st.takeItems(GEM_OF_MAILLE, -1);
@@ -142,6 +112,8 @@ public class Q039_RedEyedInvaders extends Quest
st.giveItems(FISHING_SHOT_NG, 500); st.giveItems(FISHING_SHOT_NG, 500);
st.playSound(QuestState.SOUND_FINISH); st.playSound(QuestState.SOUND_FINISH);
st.exitQuest(false); st.exitQuest(false);
break;
}
} }
return htmltext; return htmltext;
@@ -160,18 +132,22 @@ public class Q039_RedEyedInvaders extends Quest
switch (st.getState()) switch (st.getState())
{ {
case State.CREATED: case State.CREATED:
{
htmltext = (player.getLevel() < 20) ? "30334-2.htm" : "30334-0.htm"; htmltext = (player.getLevel() < 20) ? "30334-2.htm" : "30334-0.htm";
break; break;
}
case State.STARTED: case State.STARTED:
final int cond = st.getInt("cond"); {
final int cond = st.getCond();
switch (npc.getNpcId()) switch (npc.getNpcId())
{ {
case BABENCO: case BABENCO:
{
htmltext = "30334-3.htm"; htmltext = "30334-3.htm";
break; break;
}
case BATHIS: case BATHIS:
{
if (cond == 1) if (cond == 1)
{ {
htmltext = "30332-0.htm"; htmltext = "30332-0.htm";
@@ -194,12 +170,15 @@ public class Q039_RedEyedInvaders extends Quest
} }
break; break;
} }
}
break; break;
}
case State.COMPLETED: case State.COMPLETED:
{
htmltext = getAlreadyCompletedMsg(); htmltext = getAlreadyCompletedMsg();
break; break;
} }
}
return htmltext; return htmltext;
} }
@@ -208,7 +187,7 @@ public class Q039_RedEyedInvaders extends Quest
public String onKill(NpcInstance npc, PlayerInstance player, boolean isPet) public String onKill(NpcInstance npc, PlayerInstance player, boolean isPet)
{ {
final int npcId = npc.getNpcId(); final int npcId = npc.getNpcId();
PlayerInstance partyMember = getRandomPartyMember(player, npc, "2"); PlayerInstance partyMember = getRandomPartyMember(player, npc, 2);
if ((partyMember != null) && (npcId != ARANEID)) if ((partyMember != null) && (npcId != ARANEID))
{ {
final QuestState st = partyMember.getQuestState(getName()); final QuestState st = partyMember.getQuestState(getName());
@@ -220,12 +199,12 @@ public class Q039_RedEyedInvaders extends Quest
final int[] list = FIRST_DP.get(npcId); final int[] list = FIRST_DP.get(npcId);
if (st.dropItems(list[0], 1, 100, 500000) && (st.getQuestItemsCount(list[1]) == 100)) if (st.dropItems(list[0], 1, 100, 500000) && (st.getQuestItemsCount(list[1]) == 100))
{ {
st.set("cond", "3"); st.setCond(3);
} }
} }
else else
{ {
partyMember = getRandomPartyMember(player, npc, "4"); partyMember = getRandomPartyMember(player, npc, 4);
if ((partyMember != null) && (npcId != MAILLE_LIZARDMAN)) if ((partyMember != null) && (npcId != MAILLE_LIZARDMAN))
{ {
final QuestState st = partyMember.getQuestState(getName()); final QuestState st = partyMember.getQuestState(getName());
@@ -237,7 +216,7 @@ public class Q039_RedEyedInvaders extends Quest
final int[] list = SECOND_DP.get(npcId); final int[] list = SECOND_DP.get(npcId);
if (st.dropItems(list[0], 1, 30, list[2]) && (st.getQuestItemsCount(list[1]) == 30)) if (st.dropItems(list[0], 1, 30, list[2]) && (st.getQuestItemsCount(list[1]) == 30))
{ {
st.set("cond", "5"); st.setCond(5);
} }
} }
} }

View File

@@ -27,26 +27,21 @@ public class Q042_HelpTheUncle extends Quest
// NPCs // NPCs
private static final int WATERS = 30828; private static final int WATERS = 30828;
private static final int SOPHYA = 30735; private static final int SOPHYA = 30735;
// Monsters
private static final int MONSTER_EYE_DESTROYER = 20068;
private static final int MONSTER_EYE_GAZER = 20266;
// Items // Items
private static final int TRIDENT = 291; private static final int TRIDENT = 291;
private static final int MAP_PIECE = 7548; private static final int MAP_PIECE = 7548;
private static final int MAP = 7549; private static final int MAP = 7549;
private static final int PET_TICKET = 7583; private static final int PET_TICKET = 7583;
// Monsters
private static final int MONSTER_EYE_DESTROYER = 20068;
private static final int MONSTER_EYE_GAZER = 20266;
public Q042_HelpTheUncle() public Q042_HelpTheUncle()
{ {
super(42, "Help the Uncle!"); super(42, "Help the Uncle!");
registerQuestItems(MAP_PIECE, MAP); registerQuestItems(MAP_PIECE, MAP);
addStartNpc(WATERS); addStartNpc(WATERS);
addTalkId(WATERS, SOPHYA); addTalkId(WATERS, SOPHYA);
addKillId(MONSTER_EYE_DESTROYER, MONSTER_EYE_GAZER); addKillId(MONSTER_EYE_DESTROYER, MONSTER_EYE_GAZER);
} }
@@ -60,36 +55,45 @@ public class Q042_HelpTheUncle extends Quest
return htmltext; return htmltext;
} }
if (event.equals("30828-01.htm")) switch (event)
{ {
st.setState(State.STARTED); case "30828-01.htm":
st.set("cond", "1"); {
st.playSound(QuestState.SOUND_ACCEPT); st.startQuest();
break;
} }
else if (event.equals("30828-03.htm") && st.hasQuestItems(TRIDENT)) case "30828-03.htm":
{ {
st.set("cond", "2"); if (st.hasQuestItems(TRIDENT))
{
st.setCond(2);
st.playSound(QuestState.SOUND_MIDDLE); st.playSound(QuestState.SOUND_MIDDLE);
st.takeItems(TRIDENT, 1); st.takeItems(TRIDENT, 1);
} }
else if (event.equals("30828-05.htm")) break;
}
case "30828-05.htm":
{ {
st.set("cond", "4"); st.setCond(4);
st.playSound(QuestState.SOUND_MIDDLE); st.playSound(QuestState.SOUND_MIDDLE);
st.takeItems(MAP_PIECE, 30); st.takeItems(MAP_PIECE, 30);
st.giveItems(MAP, 1); st.giveItems(MAP, 1);
break;
} }
else if (event.equals("30735-06.htm")) case "30735-06.htm":
{ {
st.set("cond", "5"); st.setCond(5);
st.playSound(QuestState.SOUND_MIDDLE); st.playSound(QuestState.SOUND_MIDDLE);
st.takeItems(MAP, 1); st.takeItems(MAP, 1);
break;
} }
else if (event.equals("30828-07.htm")) case "30828-07.htm":
{ {
st.giveItems(PET_TICKET, 1); st.giveItems(PET_TICKET, 1);
st.playSound(QuestState.SOUND_FINISH); st.playSound(QuestState.SOUND_FINISH);
st.exitQuest(false); st.exitQuest(false);
break;
}
} }
return htmltext; return htmltext;
@@ -108,14 +112,17 @@ public class Q042_HelpTheUncle extends Quest
switch (st.getState()) switch (st.getState())
{ {
case State.CREATED: case State.CREATED:
{
htmltext = (player.getLevel() < 25) ? "30828-00a.htm" : "30828-00.htm"; htmltext = (player.getLevel() < 25) ? "30828-00a.htm" : "30828-00.htm";
break; break;
}
case State.STARTED: case State.STARTED:
final int cond = st.getInt("cond"); {
final int cond = st.getCond();
switch (npc.getNpcId()) switch (npc.getNpcId())
{ {
case WATERS: case WATERS:
{
if (cond == 1) if (cond == 1)
{ {
htmltext = (!st.hasQuestItems(TRIDENT)) ? "30828-01a.htm" : "30828-02.htm"; htmltext = (!st.hasQuestItems(TRIDENT)) ? "30828-01a.htm" : "30828-02.htm";
@@ -137,8 +144,9 @@ public class Q042_HelpTheUncle extends Quest
htmltext = "30828-06.htm"; htmltext = "30828-06.htm";
} }
break; break;
}
case SOPHYA: case SOPHYA:
{
if (cond == 4) if (cond == 4)
{ {
htmltext = "30735-05.htm"; htmltext = "30735-05.htm";
@@ -149,12 +157,15 @@ public class Q042_HelpTheUncle extends Quest
} }
break; break;
} }
}
break; break;
}
case State.COMPLETED: case State.COMPLETED:
{
htmltext = getAlreadyCompletedMsg(); htmltext = getAlreadyCompletedMsg();
break; break;
} }
}
return htmltext; return htmltext;
} }
@@ -162,7 +173,7 @@ public class Q042_HelpTheUncle extends Quest
@Override @Override
public String onKill(NpcInstance npc, PlayerInstance player, boolean isPet) public String onKill(NpcInstance npc, PlayerInstance player, boolean isPet)
{ {
final QuestState st = checkPlayerCondition(player, npc, "cond", "2"); final QuestState st = checkPlayerCondition(player, npc, 2);
if (st == null) if (st == null)
{ {
return null; return null;
@@ -170,7 +181,7 @@ public class Q042_HelpTheUncle extends Quest
if (st.dropItemsAlways(MAP_PIECE, 1, 30)) if (st.dropItemsAlways(MAP_PIECE, 1, 30))
{ {
st.set("cond", "3"); st.setCond(3);
} }
return null; return null;

View File

@@ -27,26 +27,21 @@ public class Q043_HelpTheSister extends Quest
// NPCs // NPCs
private static final int COOPER = 30829; private static final int COOPER = 30829;
private static final int GALLADUCCI = 30097; private static final int GALLADUCCI = 30097;
// Monsters
private static final int SPECTER = 20171;
private static final int SORROW_MAIDEN = 20197;
// Items // Items
private static final int CRAFTED_DAGGER = 220; private static final int CRAFTED_DAGGER = 220;
private static final int MAP_PIECE = 7550; private static final int MAP_PIECE = 7550;
private static final int MAP = 7551; private static final int MAP = 7551;
private static final int PET_TICKET = 7584; private static final int PET_TICKET = 7584;
// Monsters
private static final int SPECTER = 20171;
private static final int SORROW_MAIDEN = 20197;
public Q043_HelpTheSister() public Q043_HelpTheSister()
{ {
super(43, "Help the Sister!"); super(43, "Help the Sister!");
registerQuestItems(MAP_PIECE, MAP); registerQuestItems(MAP_PIECE, MAP);
addStartNpc(COOPER); addStartNpc(COOPER);
addTalkId(COOPER, GALLADUCCI); addTalkId(COOPER, GALLADUCCI);
addKillId(SPECTER, SORROW_MAIDEN); addKillId(SPECTER, SORROW_MAIDEN);
} }
@@ -60,36 +55,45 @@ public class Q043_HelpTheSister extends Quest
return htmltext; return htmltext;
} }
if (event.equals("30829-01.htm")) switch (event)
{ {
st.setState(State.STARTED); case "30829-01.htm":
st.set("cond", "1"); {
st.playSound(QuestState.SOUND_ACCEPT); st.startQuest();
break;
} }
else if (event.equals("30829-03.htm") && st.hasQuestItems(CRAFTED_DAGGER)) case "30829-03.htm":
{ {
st.set("cond", "2"); if (st.hasQuestItems(CRAFTED_DAGGER))
{
st.setCond(2);
st.playSound(QuestState.SOUND_MIDDLE); st.playSound(QuestState.SOUND_MIDDLE);
st.takeItems(CRAFTED_DAGGER, 1); st.takeItems(CRAFTED_DAGGER, 1);
} }
else if (event.equals("30829-05.htm")) break;
}
case "30829-05.htm":
{ {
st.set("cond", "4"); st.setCond(4);
st.playSound(QuestState.SOUND_MIDDLE); st.playSound(QuestState.SOUND_MIDDLE);
st.takeItems(MAP_PIECE, 30); st.takeItems(MAP_PIECE, 30);
st.giveItems(MAP, 1); st.giveItems(MAP, 1);
break;
} }
else if (event.equals("30097-06.htm")) case "30097-06.htm":
{ {
st.set("cond", "5"); st.setCond(5);
st.playSound(QuestState.SOUND_MIDDLE); st.playSound(QuestState.SOUND_MIDDLE);
st.takeItems(MAP, 1); st.takeItems(MAP, 1);
break;
} }
else if (event.equals("30829-07.htm")) case "30829-07.htm":
{ {
st.giveItems(PET_TICKET, 1); st.giveItems(PET_TICKET, 1);
st.playSound(QuestState.SOUND_FINISH); st.playSound(QuestState.SOUND_FINISH);
st.exitQuest(false); st.exitQuest(false);
break;
}
} }
return htmltext; return htmltext;
@@ -108,14 +112,17 @@ public class Q043_HelpTheSister extends Quest
switch (st.getState()) switch (st.getState())
{ {
case State.CREATED: case State.CREATED:
{
htmltext = (player.getLevel() < 26) ? "30829-00a.htm" : "30829-00.htm"; htmltext = (player.getLevel() < 26) ? "30829-00a.htm" : "30829-00.htm";
break; break;
}
case State.STARTED: case State.STARTED:
final int cond = st.getInt("cond"); {
final int cond = st.getCond();
switch (npc.getNpcId()) switch (npc.getNpcId())
{ {
case COOPER: case COOPER:
{
if (cond == 1) if (cond == 1)
{ {
htmltext = (!st.hasQuestItems(CRAFTED_DAGGER)) ? "30829-01a.htm" : "30829-02.htm"; htmltext = (!st.hasQuestItems(CRAFTED_DAGGER)) ? "30829-01a.htm" : "30829-02.htm";
@@ -137,8 +144,9 @@ public class Q043_HelpTheSister extends Quest
htmltext = "30829-06.htm"; htmltext = "30829-06.htm";
} }
break; break;
}
case GALLADUCCI: case GALLADUCCI:
{
if (cond == 4) if (cond == 4)
{ {
htmltext = "30097-05.htm"; htmltext = "30097-05.htm";
@@ -149,12 +157,15 @@ public class Q043_HelpTheSister extends Quest
} }
break; break;
} }
}
break; break;
}
case State.COMPLETED: case State.COMPLETED:
{
htmltext = getAlreadyCompletedMsg(); htmltext = getAlreadyCompletedMsg();
break; break;
} }
}
return htmltext; return htmltext;
} }
@@ -162,7 +173,7 @@ public class Q043_HelpTheSister extends Quest
@Override @Override
public String onKill(NpcInstance npc, PlayerInstance player, boolean isPet) public String onKill(NpcInstance npc, PlayerInstance player, boolean isPet)
{ {
final QuestState st = checkPlayerCondition(player, npc, "cond", "2"); final QuestState st = checkPlayerCondition(player, npc, 2);
if (st == null) if (st == null)
{ {
return null; return null;
@@ -170,7 +181,7 @@ public class Q043_HelpTheSister extends Quest
if (st.dropItemsAlways(MAP_PIECE, 1, 30)) if (st.dropItemsAlways(MAP_PIECE, 1, 30))
{ {
st.set("cond", "3"); st.setCond(3);
} }
return null; return null;

View File

@@ -24,30 +24,25 @@ import org.l2jmobius.gameserver.model.quest.State;
public class Q044_HelpTheSon extends Quest public class Q044_HelpTheSon extends Quest
{ {
// Npcs // NPCs
private static final int LUNDY = 30827; private static final int LUNDY = 30827;
private static final int DRIKUS = 30505; private static final int DRIKUS = 30505;
// Monsters
private static final int MAILLE = 20919;
private static final int MAILLE_SCOUT = 20920;
private static final int MAILLE_GUARD = 20921;
// Items // Items
private static final int WORK_HAMMER = 168; private static final int WORK_HAMMER = 168;
private static final int GEMSTONE_FRAGMENT = 7552; private static final int GEMSTONE_FRAGMENT = 7552;
private static final int GEMSTONE = 7553; private static final int GEMSTONE = 7553;
private static final int PET_TICKET = 7585; private static final int PET_TICKET = 7585;
// Monsters
private static final int MAILLE = 20919;
private static final int MAILLE_SCOUT = 20920;
private static final int MAILLE_GUARD = 20921;
public Q044_HelpTheSon() public Q044_HelpTheSon()
{ {
super(44, "Help the Son!"); super(44, "Help the Son!");
registerQuestItems(GEMSTONE_FRAGMENT, GEMSTONE); registerQuestItems(GEMSTONE_FRAGMENT, GEMSTONE);
addStartNpc(LUNDY); addStartNpc(LUNDY);
addTalkId(LUNDY, DRIKUS); addTalkId(LUNDY, DRIKUS);
addKillId(MAILLE, MAILLE_SCOUT, MAILLE_GUARD); addKillId(MAILLE, MAILLE_SCOUT, MAILLE_GUARD);
} }
@@ -61,36 +56,45 @@ public class Q044_HelpTheSon extends Quest
return htmltext; return htmltext;
} }
if (event.equals("30827-01.htm")) switch (event)
{ {
st.setState(State.STARTED); case "30827-01.htm":
st.set("cond", "1"); {
st.playSound(QuestState.SOUND_ACCEPT); st.startQuest();
break;
} }
else if (event.equals("30827-03.htm") && st.hasQuestItems(WORK_HAMMER)) case "30827-03.htm":
{ {
st.set("cond", "2"); if (st.hasQuestItems(WORK_HAMMER))
{
st.setCond(2);
st.playSound(QuestState.SOUND_MIDDLE); st.playSound(QuestState.SOUND_MIDDLE);
st.takeItems(WORK_HAMMER, 1); st.takeItems(WORK_HAMMER, 1);
} }
else if (event.equals("30827-05.htm")) break;
}
case "30827-05.htm":
{ {
st.set("cond", "4"); st.setCond(4);
st.playSound(QuestState.SOUND_MIDDLE); st.playSound(QuestState.SOUND_MIDDLE);
st.takeItems(GEMSTONE_FRAGMENT, 30); st.takeItems(GEMSTONE_FRAGMENT, 30);
st.giveItems(GEMSTONE, 1); st.giveItems(GEMSTONE, 1);
break;
} }
else if (event.equals("30505-06.htm")) case "30505-06.htm":
{ {
st.set("cond", "5"); st.setCond(5);
st.playSound(QuestState.SOUND_MIDDLE); st.playSound(QuestState.SOUND_MIDDLE);
st.takeItems(GEMSTONE, 1); st.takeItems(GEMSTONE, 1);
break;
} }
else if (event.equals("30827-07.htm")) case "30827-07.htm":
{ {
st.giveItems(PET_TICKET, 1); st.giveItems(PET_TICKET, 1);
st.playSound(QuestState.SOUND_FINISH); st.playSound(QuestState.SOUND_FINISH);
st.exitQuest(false); st.exitQuest(false);
break;
}
} }
return htmltext; return htmltext;
@@ -109,14 +113,17 @@ public class Q044_HelpTheSon extends Quest
switch (st.getState()) switch (st.getState())
{ {
case State.CREATED: case State.CREATED:
{
htmltext = (player.getLevel() < 24) ? "30827-00a.htm" : "30827-00.htm"; htmltext = (player.getLevel() < 24) ? "30827-00a.htm" : "30827-00.htm";
break; break;
}
case State.STARTED: case State.STARTED:
final int cond = st.getInt("cond"); {
final int cond = st.getCond();
switch (npc.getNpcId()) switch (npc.getNpcId())
{ {
case LUNDY: case LUNDY:
{
if (cond == 1) if (cond == 1)
{ {
htmltext = (!st.hasQuestItems(WORK_HAMMER)) ? "30827-01a.htm" : "30827-02.htm"; htmltext = (!st.hasQuestItems(WORK_HAMMER)) ? "30827-01a.htm" : "30827-02.htm";
@@ -138,8 +145,9 @@ public class Q044_HelpTheSon extends Quest
htmltext = "30827-06.htm"; htmltext = "30827-06.htm";
} }
break; break;
}
case DRIKUS: case DRIKUS:
{
if (cond == 4) if (cond == 4)
{ {
htmltext = "30505-05.htm"; htmltext = "30505-05.htm";
@@ -150,12 +158,15 @@ public class Q044_HelpTheSon extends Quest
} }
break; break;
} }
}
break; break;
}
case State.COMPLETED: case State.COMPLETED:
{
htmltext = getAlreadyCompletedMsg(); htmltext = getAlreadyCompletedMsg();
break; break;
} }
}
return htmltext; return htmltext;
} }
@@ -163,7 +174,7 @@ public class Q044_HelpTheSon extends Quest
@Override @Override
public String onKill(NpcInstance npc, PlayerInstance player, boolean isPet) public String onKill(NpcInstance npc, PlayerInstance player, boolean isPet)
{ {
final QuestState st = checkPlayerCondition(player, npc, "cond", "2"); final QuestState st = checkPlayerCondition(player, npc, 2);
if (st == null) if (st == null)
{ {
return null; return null;
@@ -171,7 +182,7 @@ public class Q044_HelpTheSon extends Quest
if (st.dropItemsAlways(GEMSTONE_FRAGMENT, 1, 30)) if (st.dropItemsAlways(GEMSTONE_FRAGMENT, 1, 30))
{ {
st.set("cond", "3"); st.setCond(3);
} }
return null; return null;

View File

@@ -21,12 +21,11 @@ import org.l2jmobius.gameserver.model.quest.State;
public class Q045_ToTalkingIsland extends Quest public class Q045_ToTalkingIsland extends Quest
{ {
// Npcs // NPCs
private static final int GALLADUCCI = 30097; private static final int GALLADUCCI = 30097;
private static final int GENTLER = 30094; private static final int GENTLER = 30094;
private static final int SANDRA = 30090; private static final int SANDRA = 30090;
private static final int DUSTIN = 30116; private static final int DUSTIN = 30116;
// Items // Items
private static final int ORDER_DOCUMENT_1 = 7563; private static final int ORDER_DOCUMENT_1 = 7563;
private static final int ORDER_DOCUMENT_2 = 7564; private static final int ORDER_DOCUMENT_2 = 7564;
@@ -40,9 +39,7 @@ public class Q045_ToTalkingIsland extends Quest
public Q045_ToTalkingIsland() public Q045_ToTalkingIsland()
{ {
super(45, "To Talking Island"); super(45, "To Talking Island");
registerQuestItems(ORDER_DOCUMENT_1, ORDER_DOCUMENT_2, ORDER_DOCUMENT_3, MAGIC_SWORD_HILT, GEMSTONE_POWDER, PURIFIED_MAGIC_NECKLACE); registerQuestItems(ORDER_DOCUMENT_1, ORDER_DOCUMENT_2, ORDER_DOCUMENT_3, MAGIC_SWORD_HILT, GEMSTONE_POWDER, PURIFIED_MAGIC_NECKLACE);
addStartNpc(GALLADUCCI); addStartNpc(GALLADUCCI);
addTalkId(GALLADUCCI, GENTLER, SANDRA, DUSTIN); addTalkId(GALLADUCCI, GENTLER, SANDRA, DUSTIN);
} }
@@ -57,55 +54,63 @@ public class Q045_ToTalkingIsland extends Quest
return htmltext; return htmltext;
} }
if (event.equals("30097-03.htm")) switch (event)
{ {
st.setState(State.STARTED); case "30097-03.htm":
st.set("cond", "1"); {
st.playSound(QuestState.SOUND_ACCEPT); st.startQuest();
st.giveItems(ORDER_DOCUMENT_1, 1); st.giveItems(ORDER_DOCUMENT_1, 1);
break;
} }
else if (event.equals("30094-02.htm")) case "30094-02.htm":
{ {
st.set("cond", "2"); st.setCond(2);
st.playSound(QuestState.SOUND_MIDDLE); st.playSound(QuestState.SOUND_MIDDLE);
st.takeItems(ORDER_DOCUMENT_1, 1); st.takeItems(ORDER_DOCUMENT_1, 1);
st.giveItems(MAGIC_SWORD_HILT, 1); st.giveItems(MAGIC_SWORD_HILT, 1);
break;
} }
else if (event.equals("30097-06.htm")) case "30097-06.htm":
{ {
st.set("cond", "3"); st.setCond(3);
st.playSound(QuestState.SOUND_MIDDLE); st.playSound(QuestState.SOUND_MIDDLE);
st.takeItems(MAGIC_SWORD_HILT, 1); st.takeItems(MAGIC_SWORD_HILT, 1);
st.giveItems(ORDER_DOCUMENT_2, 1); st.giveItems(ORDER_DOCUMENT_2, 1);
break;
} }
else if (event.equals("30090-02.htm")) case "30090-02.htm":
{ {
st.set("cond", "4"); st.setCond(4);
st.playSound(QuestState.SOUND_MIDDLE); st.playSound(QuestState.SOUND_MIDDLE);
st.takeItems(ORDER_DOCUMENT_2, 1); st.takeItems(ORDER_DOCUMENT_2, 1);
st.giveItems(GEMSTONE_POWDER, 1); st.giveItems(GEMSTONE_POWDER, 1);
break;
} }
else if (event.equals("30097-09.htm")) case "30097-09.htm":
{ {
st.set("cond", "5"); st.setCond(5);
st.playSound(QuestState.SOUND_MIDDLE); st.playSound(QuestState.SOUND_MIDDLE);
st.takeItems(GEMSTONE_POWDER, 1); st.takeItems(GEMSTONE_POWDER, 1);
st.giveItems(ORDER_DOCUMENT_3, 1); st.giveItems(ORDER_DOCUMENT_3, 1);
break;
} }
else if (event.equals("30116-02.htm")) case "30116-02.htm":
{ {
st.set("cond", "6"); st.setCond(6);
st.playSound(QuestState.SOUND_MIDDLE); st.playSound(QuestState.SOUND_MIDDLE);
st.takeItems(ORDER_DOCUMENT_3, 1); st.takeItems(ORDER_DOCUMENT_3, 1);
st.giveItems(PURIFIED_MAGIC_NECKLACE, 1); st.giveItems(PURIFIED_MAGIC_NECKLACE, 1);
break;
} }
else if (event.equals("30097-12.htm")) case "30097-12.htm":
{ {
st.takeItems(MARK_OF_TRAVELER, -1); st.takeItems(MARK_OF_TRAVELER, -1);
st.takeItems(PURIFIED_MAGIC_NECKLACE, 1); st.takeItems(PURIFIED_MAGIC_NECKLACE, 1);
st.rewardItems(SCROLL_OF_ESCAPE_SPECIAL, 1); st.rewardItems(SCROLL_OF_ESCAPE_SPECIAL, 1);
st.playSound(QuestState.SOUND_FINISH); st.playSound(QuestState.SOUND_FINISH);
st.exitQuest(false); st.exitQuest(false);
break;
}
} }
return htmltext; return htmltext;
@@ -124,6 +129,7 @@ public class Q045_ToTalkingIsland extends Quest
switch (st.getState()) switch (st.getState())
{ {
case State.CREATED: case State.CREATED:
{
if ((player.getRace() == Race.HUMAN) && (player.getLevel() >= 3)) if ((player.getRace() == Race.HUMAN) && (player.getLevel() >= 3))
{ {
if (st.hasQuestItems(MARK_OF_TRAVELER)) if (st.hasQuestItems(MARK_OF_TRAVELER))
@@ -140,12 +146,14 @@ public class Q045_ToTalkingIsland extends Quest
htmltext = "30097-01a.htm"; htmltext = "30097-01a.htm";
} }
break; break;
}
case State.STARTED: case State.STARTED:
final int cond = st.getInt("cond"); {
final int cond = st.getCond();
switch (npc.getNpcId()) switch (npc.getNpcId())
{ {
case GALLADUCCI: case GALLADUCCI:
{
if (cond == 1) if (cond == 1)
{ {
htmltext = "30097-04.htm"; htmltext = "30097-04.htm";
@@ -171,8 +179,9 @@ public class Q045_ToTalkingIsland extends Quest
htmltext = "30097-11.htm"; htmltext = "30097-11.htm";
} }
break; break;
}
case GENTLER: case GENTLER:
{
if (cond == 1) if (cond == 1)
{ {
htmltext = "30094-01.htm"; htmltext = "30094-01.htm";
@@ -182,8 +191,9 @@ public class Q045_ToTalkingIsland extends Quest
htmltext = "30094-03.htm"; htmltext = "30094-03.htm";
} }
break; break;
}
case SANDRA: case SANDRA:
{
if (cond == 3) if (cond == 3)
{ {
htmltext = "30090-01.htm"; htmltext = "30090-01.htm";
@@ -193,8 +203,9 @@ public class Q045_ToTalkingIsland extends Quest
htmltext = "30090-03.htm"; htmltext = "30090-03.htm";
} }
break; break;
}
case DUSTIN: case DUSTIN:
{
if (cond == 5) if (cond == 5)
{ {
htmltext = "30116-01.htm"; htmltext = "30116-01.htm";
@@ -205,12 +216,15 @@ public class Q045_ToTalkingIsland extends Quest
} }
break; break;
} }
}
break; break;
}
case State.COMPLETED: case State.COMPLETED:
{
htmltext = getAlreadyCompletedMsg(); htmltext = getAlreadyCompletedMsg();
break; break;
} }
}
return htmltext; return htmltext;
} }

View File

@@ -30,7 +30,6 @@ public class Q046_OnceMoreInTheArmsOfTheMotherTree extends Quest
private static final int GENTLER = 30094; private static final int GENTLER = 30094;
private static final int SANDRA = 30090; private static final int SANDRA = 30090;
private static final int DUSTIN = 30116; private static final int DUSTIN = 30116;
// Items // Items
private static final int ORDER_DOCUMENT_1 = 7563; private static final int ORDER_DOCUMENT_1 = 7563;
private static final int ORDER_DOCUMENT_2 = 7564; private static final int ORDER_DOCUMENT_2 = 7564;
@@ -44,9 +43,7 @@ public class Q046_OnceMoreInTheArmsOfTheMotherTree extends Quest
public Q046_OnceMoreInTheArmsOfTheMotherTree() public Q046_OnceMoreInTheArmsOfTheMotherTree()
{ {
super(46, "Once More In the Arms of the Mother Tree"); super(46, "Once More In the Arms of the Mother Tree");
registerQuestItems(ORDER_DOCUMENT_1, ORDER_DOCUMENT_2, ORDER_DOCUMENT_3, MAGIC_SWORD_HILT, GEMSTONE_POWDER, PURIFIED_MAGIC_NECKLACE); registerQuestItems(ORDER_DOCUMENT_1, ORDER_DOCUMENT_2, ORDER_DOCUMENT_3, MAGIC_SWORD_HILT, GEMSTONE_POWDER, PURIFIED_MAGIC_NECKLACE);
addStartNpc(GALLADUCCI); addStartNpc(GALLADUCCI);
addTalkId(GALLADUCCI, GENTLER, SANDRA, DUSTIN); addTalkId(GALLADUCCI, GENTLER, SANDRA, DUSTIN);
} }
@@ -61,55 +58,63 @@ public class Q046_OnceMoreInTheArmsOfTheMotherTree extends Quest
return htmltext; return htmltext;
} }
if (event.equals("30097-03.htm")) switch (event)
{ {
st.setState(State.STARTED); case "30097-03.htm":
st.set("cond", "1"); {
st.playSound(QuestState.SOUND_ACCEPT); st.startQuest();
st.giveItems(ORDER_DOCUMENT_1, 1); st.giveItems(ORDER_DOCUMENT_1, 1);
break;
} }
else if (event.equals("30094-02.htm")) case "30094-02.htm":
{ {
st.set("cond", "2"); st.setCond(2);
st.playSound(QuestState.SOUND_MIDDLE); st.playSound(QuestState.SOUND_MIDDLE);
st.takeItems(ORDER_DOCUMENT_1, 1); st.takeItems(ORDER_DOCUMENT_1, 1);
st.giveItems(MAGIC_SWORD_HILT, 1); st.giveItems(MAGIC_SWORD_HILT, 1);
break;
} }
else if (event.equals("30097-06.htm")) case "30097-06.htm":
{ {
st.set("cond", "3"); st.setCond(3);
st.playSound(QuestState.SOUND_MIDDLE); st.playSound(QuestState.SOUND_MIDDLE);
st.takeItems(MAGIC_SWORD_HILT, 1); st.takeItems(MAGIC_SWORD_HILT, 1);
st.giveItems(ORDER_DOCUMENT_2, 1); st.giveItems(ORDER_DOCUMENT_2, 1);
break;
} }
else if (event.equals("30090-02.htm")) case "30090-02.htm":
{ {
st.set("cond", "4"); st.setCond(4);
st.playSound(QuestState.SOUND_MIDDLE); st.playSound(QuestState.SOUND_MIDDLE);
st.takeItems(ORDER_DOCUMENT_2, 1); st.takeItems(ORDER_DOCUMENT_2, 1);
st.giveItems(GEMSTONE_POWDER, 1); st.giveItems(GEMSTONE_POWDER, 1);
break;
} }
else if (event.equals("30097-09.htm")) case "30097-09.htm":
{ {
st.set("cond", "5"); st.setCond(5);
st.playSound(QuestState.SOUND_MIDDLE); st.playSound(QuestState.SOUND_MIDDLE);
st.takeItems(GEMSTONE_POWDER, 1); st.takeItems(GEMSTONE_POWDER, 1);
st.giveItems(ORDER_DOCUMENT_3, 1); st.giveItems(ORDER_DOCUMENT_3, 1);
break;
} }
else if (event.equals("30116-02.htm")) case "30116-02.htm":
{ {
st.set("cond", "6"); st.setCond(6);
st.playSound(QuestState.SOUND_MIDDLE); st.playSound(QuestState.SOUND_MIDDLE);
st.takeItems(ORDER_DOCUMENT_3, 1); st.takeItems(ORDER_DOCUMENT_3, 1);
st.giveItems(PURIFIED_MAGIC_NECKLACE, 1); st.giveItems(PURIFIED_MAGIC_NECKLACE, 1);
break;
} }
else if (event.equals("30097-12.htm")) case "30097-12.htm":
{ {
st.takeItems(MARK_OF_TRAVELER, -1); st.takeItems(MARK_OF_TRAVELER, -1);
st.takeItems(PURIFIED_MAGIC_NECKLACE, 1); st.takeItems(PURIFIED_MAGIC_NECKLACE, 1);
st.rewardItems(SCROLL_OF_ESCAPE_SPECIAL, 1); st.rewardItems(SCROLL_OF_ESCAPE_SPECIAL, 1);
st.playSound(QuestState.SOUND_FINISH); st.playSound(QuestState.SOUND_FINISH);
st.exitQuest(false); st.exitQuest(false);
break;
}
} }
return htmltext; return htmltext;
@@ -128,6 +133,7 @@ public class Q046_OnceMoreInTheArmsOfTheMotherTree extends Quest
switch (st.getState()) switch (st.getState())
{ {
case State.CREATED: case State.CREATED:
{
if ((player.getRace() == Race.ELF) && (player.getLevel() >= 3)) if ((player.getRace() == Race.ELF) && (player.getLevel() >= 3))
{ {
if (st.hasQuestItems(MARK_OF_TRAVELER)) if (st.hasQuestItems(MARK_OF_TRAVELER))
@@ -144,12 +150,14 @@ public class Q046_OnceMoreInTheArmsOfTheMotherTree extends Quest
htmltext = "30097-01a.htm"; htmltext = "30097-01a.htm";
} }
break; break;
}
case State.STARTED: case State.STARTED:
final int cond = st.getInt("cond"); {
final int cond = st.getCond();
switch (npc.getNpcId()) switch (npc.getNpcId())
{ {
case GALLADUCCI: case GALLADUCCI:
{
if (cond == 1) if (cond == 1)
{ {
htmltext = "30097-04.htm"; htmltext = "30097-04.htm";
@@ -175,8 +183,9 @@ public class Q046_OnceMoreInTheArmsOfTheMotherTree extends Quest
htmltext = "30097-11.htm"; htmltext = "30097-11.htm";
} }
break; break;
}
case GENTLER: case GENTLER:
{
if (cond == 1) if (cond == 1)
{ {
htmltext = "30094-01.htm"; htmltext = "30094-01.htm";
@@ -186,8 +195,9 @@ public class Q046_OnceMoreInTheArmsOfTheMotherTree extends Quest
htmltext = "30094-03.htm"; htmltext = "30094-03.htm";
} }
break; break;
}
case SANDRA: case SANDRA:
{
if (cond == 3) if (cond == 3)
{ {
htmltext = "30090-01.htm"; htmltext = "30090-01.htm";
@@ -197,8 +207,9 @@ public class Q046_OnceMoreInTheArmsOfTheMotherTree extends Quest
htmltext = "30090-03.htm"; htmltext = "30090-03.htm";
} }
break; break;
}
case DUSTIN: case DUSTIN:
{
if (cond == 5) if (cond == 5)
{ {
htmltext = "30116-01.htm"; htmltext = "30116-01.htm";
@@ -209,12 +220,15 @@ public class Q046_OnceMoreInTheArmsOfTheMotherTree extends Quest
} }
break; break;
} }
}
break; break;
}
case State.COMPLETED: case State.COMPLETED:
{
htmltext = getAlreadyCompletedMsg(); htmltext = getAlreadyCompletedMsg();
break; break;
} }
}
return htmltext; return htmltext;
} }

View File

@@ -30,7 +30,6 @@ public class Q047_IntoTheDarkForest extends Quest
private static final int GENTLER = 30094; private static final int GENTLER = 30094;
private static final int SANDRA = 30090; private static final int SANDRA = 30090;
private static final int DUSTIN = 30116; private static final int DUSTIN = 30116;
// Items // Items
private static final int ORDER_DOCUMENT_1 = 7563; private static final int ORDER_DOCUMENT_1 = 7563;
private static final int ORDER_DOCUMENT_2 = 7564; private static final int ORDER_DOCUMENT_2 = 7564;
@@ -44,9 +43,7 @@ public class Q047_IntoTheDarkForest extends Quest
public Q047_IntoTheDarkForest() public Q047_IntoTheDarkForest()
{ {
super(47, "Into the Dark Forest"); super(47, "Into the Dark Forest");
registerQuestItems(ORDER_DOCUMENT_1, ORDER_DOCUMENT_2, ORDER_DOCUMENT_3, MAGIC_SWORD_HILT, GEMSTONE_POWDER, PURIFIED_MAGIC_NECKLACE); registerQuestItems(ORDER_DOCUMENT_1, ORDER_DOCUMENT_2, ORDER_DOCUMENT_3, MAGIC_SWORD_HILT, GEMSTONE_POWDER, PURIFIED_MAGIC_NECKLACE);
addStartNpc(GALLADUCCI); addStartNpc(GALLADUCCI);
addTalkId(GALLADUCCI, SANDRA, DUSTIN, GENTLER); addTalkId(GALLADUCCI, SANDRA, DUSTIN, GENTLER);
} }
@@ -61,55 +58,63 @@ public class Q047_IntoTheDarkForest extends Quest
return htmltext; return htmltext;
} }
if (event.equals("30097-03.htm")) switch (event)
{ {
st.setState(State.STARTED); case "30097-03.htm":
st.set("cond", "1"); {
st.playSound(QuestState.SOUND_ACCEPT); st.startQuest();
st.giveItems(ORDER_DOCUMENT_1, 1); st.giveItems(ORDER_DOCUMENT_1, 1);
break;
} }
else if (event.equals("30094-02.htm")) case "30094-02.htm":
{ {
st.set("cond", "2"); st.setCond(2);
st.playSound(QuestState.SOUND_MIDDLE); st.playSound(QuestState.SOUND_MIDDLE);
st.takeItems(ORDER_DOCUMENT_1, 1); st.takeItems(ORDER_DOCUMENT_1, 1);
st.giveItems(MAGIC_SWORD_HILT, 1); st.giveItems(MAGIC_SWORD_HILT, 1);
break;
} }
else if (event.equals("30097-06.htm")) case "30097-06.htm":
{ {
st.set("cond", "3"); st.setCond(3);
st.playSound(QuestState.SOUND_MIDDLE); st.playSound(QuestState.SOUND_MIDDLE);
st.takeItems(MAGIC_SWORD_HILT, 1); st.takeItems(MAGIC_SWORD_HILT, 1);
st.giveItems(ORDER_DOCUMENT_2, 1); st.giveItems(ORDER_DOCUMENT_2, 1);
break;
} }
else if (event.equals("30090-02.htm")) case "30090-02.htm":
{ {
st.set("cond", "4"); st.setCond(4);
st.playSound(QuestState.SOUND_MIDDLE); st.playSound(QuestState.SOUND_MIDDLE);
st.takeItems(ORDER_DOCUMENT_2, 1); st.takeItems(ORDER_DOCUMENT_2, 1);
st.giveItems(GEMSTONE_POWDER, 1); st.giveItems(GEMSTONE_POWDER, 1);
break;
} }
else if (event.equals("30097-09.htm")) case "30097-09.htm":
{ {
st.set("cond", "5"); st.setCond(5);
st.playSound(QuestState.SOUND_MIDDLE); st.playSound(QuestState.SOUND_MIDDLE);
st.takeItems(GEMSTONE_POWDER, 1); st.takeItems(GEMSTONE_POWDER, 1);
st.giveItems(ORDER_DOCUMENT_3, 1); st.giveItems(ORDER_DOCUMENT_3, 1);
break;
} }
else if (event.equals("30116-02.htm")) case "30116-02.htm":
{ {
st.set("cond", "6"); st.setCond(6);
st.playSound(QuestState.SOUND_MIDDLE); st.playSound(QuestState.SOUND_MIDDLE);
st.takeItems(ORDER_DOCUMENT_3, 1); st.takeItems(ORDER_DOCUMENT_3, 1);
st.giveItems(PURIFIED_MAGIC_NECKLACE, 1); st.giveItems(PURIFIED_MAGIC_NECKLACE, 1);
break;
} }
else if (event.equals("30097-12.htm")) case "30097-12.htm":
{ {
st.takeItems(MARK_OF_TRAVELER, -1); st.takeItems(MARK_OF_TRAVELER, -1);
st.takeItems(PURIFIED_MAGIC_NECKLACE, 1); st.takeItems(PURIFIED_MAGIC_NECKLACE, 1);
st.rewardItems(SCROLL_OF_ESCAPE_SPECIAL, 1); st.rewardItems(SCROLL_OF_ESCAPE_SPECIAL, 1);
st.playSound(QuestState.SOUND_FINISH); st.playSound(QuestState.SOUND_FINISH);
st.exitQuest(false); st.exitQuest(false);
break;
}
} }
return htmltext; return htmltext;
@@ -128,6 +133,7 @@ public class Q047_IntoTheDarkForest extends Quest
switch (st.getState()) switch (st.getState())
{ {
case State.CREATED: case State.CREATED:
{
if ((player.getRace() == Race.DARK_ELF) && (player.getLevel() >= 3)) if ((player.getRace() == Race.DARK_ELF) && (player.getLevel() >= 3))
{ {
if (st.hasQuestItems(MARK_OF_TRAVELER)) if (st.hasQuestItems(MARK_OF_TRAVELER))
@@ -144,12 +150,14 @@ public class Q047_IntoTheDarkForest extends Quest
htmltext = "30097-01a.htm"; htmltext = "30097-01a.htm";
} }
break; break;
}
case State.STARTED: case State.STARTED:
final int cond = st.getInt("cond"); {
final int cond = st.getCond();
switch (npc.getNpcId()) switch (npc.getNpcId())
{ {
case GALLADUCCI: case GALLADUCCI:
{
if (cond == 1) if (cond == 1)
{ {
htmltext = "30097-04.htm"; htmltext = "30097-04.htm";
@@ -175,8 +183,9 @@ public class Q047_IntoTheDarkForest extends Quest
htmltext = "30097-11.htm"; htmltext = "30097-11.htm";
} }
break; break;
}
case GENTLER: case GENTLER:
{
if (cond == 1) if (cond == 1)
{ {
htmltext = "30094-01.htm"; htmltext = "30094-01.htm";
@@ -186,8 +195,9 @@ public class Q047_IntoTheDarkForest extends Quest
htmltext = "30094-03.htm"; htmltext = "30094-03.htm";
} }
break; break;
}
case SANDRA: case SANDRA:
{
if (cond == 3) if (cond == 3)
{ {
htmltext = "30090-01.htm"; htmltext = "30090-01.htm";
@@ -197,8 +207,9 @@ public class Q047_IntoTheDarkForest extends Quest
htmltext = "30090-03.htm"; htmltext = "30090-03.htm";
} }
break; break;
}
case DUSTIN: case DUSTIN:
{
if (cond == 5) if (cond == 5)
{ {
htmltext = "30116-01.htm"; htmltext = "30116-01.htm";
@@ -209,12 +220,15 @@ public class Q047_IntoTheDarkForest extends Quest
} }
break; break;
} }
}
break; break;
}
case State.COMPLETED: case State.COMPLETED:
{
htmltext = getAlreadyCompletedMsg(); htmltext = getAlreadyCompletedMsg();
break; break;
} }
}
return htmltext; return htmltext;
} }

View File

@@ -30,7 +30,6 @@ public class Q048_ToTheImmortalPlateau extends Quest
private static final int GENTLER = 30094; private static final int GENTLER = 30094;
private static final int SANDRA = 30090; private static final int SANDRA = 30090;
private static final int DUSTIN = 30116; private static final int DUSTIN = 30116;
// Items // Items
private static final int ORDER_DOCUMENT_1 = 7563; private static final int ORDER_DOCUMENT_1 = 7563;
private static final int ORDER_DOCUMENT_2 = 7564; private static final int ORDER_DOCUMENT_2 = 7564;
@@ -44,9 +43,7 @@ public class Q048_ToTheImmortalPlateau extends Quest
public Q048_ToTheImmortalPlateau() public Q048_ToTheImmortalPlateau()
{ {
super(48, "To the Immortal Plateau"); super(48, "To the Immortal Plateau");
registerQuestItems(ORDER_DOCUMENT_1, ORDER_DOCUMENT_2, ORDER_DOCUMENT_3, MAGIC_SWORD_HILT, GEMSTONE_POWDER, PURIFIED_MAGIC_NECKLACE); registerQuestItems(ORDER_DOCUMENT_1, ORDER_DOCUMENT_2, ORDER_DOCUMENT_3, MAGIC_SWORD_HILT, GEMSTONE_POWDER, PURIFIED_MAGIC_NECKLACE);
addStartNpc(GALLADUCCI); addStartNpc(GALLADUCCI);
addTalkId(GALLADUCCI, SANDRA, DUSTIN, GENTLER); addTalkId(GALLADUCCI, SANDRA, DUSTIN, GENTLER);
} }
@@ -61,55 +58,63 @@ public class Q048_ToTheImmortalPlateau extends Quest
return htmltext; return htmltext;
} }
if (event.equals("30097-03.htm")) switch (event)
{ {
st.setState(State.STARTED); case "30097-03.htm":
st.set("cond", "1"); {
st.playSound(QuestState.SOUND_ACCEPT); st.startQuest();
st.giveItems(ORDER_DOCUMENT_1, 1); st.giveItems(ORDER_DOCUMENT_1, 1);
break;
} }
else if (event.equals("30094-02.htm")) case "30094-02.htm":
{ {
st.set("cond", "2"); st.setCond(2);
st.playSound(QuestState.SOUND_MIDDLE); st.playSound(QuestState.SOUND_MIDDLE);
st.takeItems(ORDER_DOCUMENT_1, 1); st.takeItems(ORDER_DOCUMENT_1, 1);
st.giveItems(MAGIC_SWORD_HILT, 1); st.giveItems(MAGIC_SWORD_HILT, 1);
break;
} }
else if (event.equals("30097-06.htm")) case "30097-06.htm":
{ {
st.set("cond", "3"); st.setCond(3);
st.playSound(QuestState.SOUND_MIDDLE); st.playSound(QuestState.SOUND_MIDDLE);
st.takeItems(MAGIC_SWORD_HILT, 1); st.takeItems(MAGIC_SWORD_HILT, 1);
st.giveItems(ORDER_DOCUMENT_2, 1); st.giveItems(ORDER_DOCUMENT_2, 1);
break;
} }
else if (event.equals("30090-02.htm")) case "30090-02.htm":
{ {
st.set("cond", "4"); st.setCond(4);
st.playSound(QuestState.SOUND_MIDDLE); st.playSound(QuestState.SOUND_MIDDLE);
st.takeItems(ORDER_DOCUMENT_2, 1); st.takeItems(ORDER_DOCUMENT_2, 1);
st.giveItems(GEMSTONE_POWDER, 1); st.giveItems(GEMSTONE_POWDER, 1);
break;
} }
else if (event.equals("30097-09.htm")) case "30097-09.htm":
{ {
st.set("cond", "5"); st.setCond(5);
st.playSound(QuestState.SOUND_MIDDLE); st.playSound(QuestState.SOUND_MIDDLE);
st.takeItems(GEMSTONE_POWDER, 1); st.takeItems(GEMSTONE_POWDER, 1);
st.giveItems(ORDER_DOCUMENT_3, 1); st.giveItems(ORDER_DOCUMENT_3, 1);
break;
} }
else if (event.equals("30116-02.htm")) case "30116-02.htm":
{ {
st.set("cond", "6"); st.setCond(6);
st.playSound(QuestState.SOUND_MIDDLE); st.playSound(QuestState.SOUND_MIDDLE);
st.takeItems(ORDER_DOCUMENT_3, 1); st.takeItems(ORDER_DOCUMENT_3, 1);
st.giveItems(PURIFIED_MAGIC_NECKLACE, 1); st.giveItems(PURIFIED_MAGIC_NECKLACE, 1);
break;
} }
else if (event.equals("30097-12.htm")) case "30097-12.htm":
{ {
st.takeItems(MARK_OF_TRAVELER, -1); st.takeItems(MARK_OF_TRAVELER, -1);
st.takeItems(PURIFIED_MAGIC_NECKLACE, 1); st.takeItems(PURIFIED_MAGIC_NECKLACE, 1);
st.rewardItems(SCROLL_OF_ESCAPE_SPECIAL, 1); st.rewardItems(SCROLL_OF_ESCAPE_SPECIAL, 1);
st.playSound(QuestState.SOUND_FINISH); st.playSound(QuestState.SOUND_FINISH);
st.exitQuest(false); st.exitQuest(false);
break;
}
} }
return htmltext; return htmltext;
@@ -128,6 +133,7 @@ public class Q048_ToTheImmortalPlateau extends Quest
switch (st.getState()) switch (st.getState())
{ {
case State.CREATED: case State.CREATED:
{
if ((player.getRace() == Race.ORC) && (player.getLevel() >= 3)) if ((player.getRace() == Race.ORC) && (player.getLevel() >= 3))
{ {
if (st.hasQuestItems(MARK_OF_TRAVELER)) if (st.hasQuestItems(MARK_OF_TRAVELER))
@@ -144,12 +150,14 @@ public class Q048_ToTheImmortalPlateau extends Quest
htmltext = "30097-01a.htm"; htmltext = "30097-01a.htm";
} }
break; break;
}
case State.STARTED: case State.STARTED:
final int cond = st.getInt("cond"); {
final int cond = st.getCond();
switch (npc.getNpcId()) switch (npc.getNpcId())
{ {
case GALLADUCCI: case GALLADUCCI:
{
if (cond == 1) if (cond == 1)
{ {
htmltext = "30097-04.htm"; htmltext = "30097-04.htm";
@@ -175,8 +183,9 @@ public class Q048_ToTheImmortalPlateau extends Quest
htmltext = "30097-11.htm"; htmltext = "30097-11.htm";
} }
break; break;
}
case GENTLER: case GENTLER:
{
if (cond == 1) if (cond == 1)
{ {
htmltext = "30094-01.htm"; htmltext = "30094-01.htm";
@@ -186,8 +195,9 @@ public class Q048_ToTheImmortalPlateau extends Quest
htmltext = "30094-03.htm"; htmltext = "30094-03.htm";
} }
break; break;
}
case SANDRA: case SANDRA:
{
if (cond == 3) if (cond == 3)
{ {
htmltext = "30090-01.htm"; htmltext = "30090-01.htm";
@@ -197,8 +207,9 @@ public class Q048_ToTheImmortalPlateau extends Quest
htmltext = "30090-03.htm"; htmltext = "30090-03.htm";
} }
break; break;
}
case DUSTIN: case DUSTIN:
{
if (cond == 5) if (cond == 5)
{ {
htmltext = "30116-01.htm"; htmltext = "30116-01.htm";
@@ -209,12 +220,15 @@ public class Q048_ToTheImmortalPlateau extends Quest
} }
break; break;
} }
}
break; break;
}
case State.COMPLETED: case State.COMPLETED:
{
htmltext = getAlreadyCompletedMsg(); htmltext = getAlreadyCompletedMsg();
break; break;
} }
}
return htmltext; return htmltext;
} }

View File

@@ -30,7 +30,6 @@ public class Q049_TheRoadHome extends Quest
private static final int GENTLER = 30094; private static final int GENTLER = 30094;
private static final int SANDRA = 30090; private static final int SANDRA = 30090;
private static final int DUSTIN = 30116; private static final int DUSTIN = 30116;
// Items // Items
private static final int ORDER_DOCUMENT_1 = 7563; private static final int ORDER_DOCUMENT_1 = 7563;
private static final int ORDER_DOCUMENT_2 = 7564; private static final int ORDER_DOCUMENT_2 = 7564;
@@ -44,9 +43,7 @@ public class Q049_TheRoadHome extends Quest
public Q049_TheRoadHome() public Q049_TheRoadHome()
{ {
super(49, "The Road Home"); super(49, "The Road Home");
registerQuestItems(ORDER_DOCUMENT_1, ORDER_DOCUMENT_2, ORDER_DOCUMENT_3, MAGIC_SWORD_HILT, GEMSTONE_POWDER, PURIFIED_MAGIC_NECKLACE); registerQuestItems(ORDER_DOCUMENT_1, ORDER_DOCUMENT_2, ORDER_DOCUMENT_3, MAGIC_SWORD_HILT, GEMSTONE_POWDER, PURIFIED_MAGIC_NECKLACE);
addStartNpc(GALLADUCCI); addStartNpc(GALLADUCCI);
addTalkId(GALLADUCCI, GENTLER, SANDRA, DUSTIN); addTalkId(GALLADUCCI, GENTLER, SANDRA, DUSTIN);
} }
@@ -61,55 +58,63 @@ public class Q049_TheRoadHome extends Quest
return htmltext; return htmltext;
} }
if (event.equals("30097-03.htm")) switch (event)
{ {
st.setState(State.STARTED); case "30097-03.htm":
st.set("cond", "1"); {
st.playSound(QuestState.SOUND_ACCEPT); st.startQuest();
st.giveItems(ORDER_DOCUMENT_1, 1); st.giveItems(ORDER_DOCUMENT_1, 1);
break;
} }
else if (event.equals("30094-02.htm")) case "30094-02.htm":
{ {
st.set("cond", "2"); st.setCond(2);
st.playSound(QuestState.SOUND_MIDDLE); st.playSound(QuestState.SOUND_MIDDLE);
st.takeItems(ORDER_DOCUMENT_1, 1); st.takeItems(ORDER_DOCUMENT_1, 1);
st.giveItems(MAGIC_SWORD_HILT, 1); st.giveItems(MAGIC_SWORD_HILT, 1);
break;
} }
else if (event.equals("30097-06.htm")) case "30097-06.htm":
{ {
st.set("cond", "3"); st.setCond(3);
st.playSound(QuestState.SOUND_MIDDLE); st.playSound(QuestState.SOUND_MIDDLE);
st.takeItems(MAGIC_SWORD_HILT, 1); st.takeItems(MAGIC_SWORD_HILT, 1);
st.giveItems(ORDER_DOCUMENT_2, 1); st.giveItems(ORDER_DOCUMENT_2, 1);
break;
} }
else if (event.equals("30090-02.htm")) case "30090-02.htm":
{ {
st.set("cond", "4"); st.setCond(4);
st.playSound(QuestState.SOUND_MIDDLE); st.playSound(QuestState.SOUND_MIDDLE);
st.takeItems(ORDER_DOCUMENT_2, 1); st.takeItems(ORDER_DOCUMENT_2, 1);
st.giveItems(GEMSTONE_POWDER, 1); st.giveItems(GEMSTONE_POWDER, 1);
break;
} }
else if (event.equals("30097-09.htm")) case "30097-09.htm":
{ {
st.set("cond", "5"); st.setCond(5);
st.playSound(QuestState.SOUND_MIDDLE); st.playSound(QuestState.SOUND_MIDDLE);
st.takeItems(GEMSTONE_POWDER, 1); st.takeItems(GEMSTONE_POWDER, 1);
st.giveItems(ORDER_DOCUMENT_3, 1); st.giveItems(ORDER_DOCUMENT_3, 1);
break;
} }
else if (event.equals("30116-02.htm")) case "30116-02.htm":
{ {
st.set("cond", "6"); st.setCond(6);
st.playSound(QuestState.SOUND_MIDDLE); st.playSound(QuestState.SOUND_MIDDLE);
st.takeItems(ORDER_DOCUMENT_3, 1); st.takeItems(ORDER_DOCUMENT_3, 1);
st.giveItems(PURIFIED_MAGIC_NECKLACE, 1); st.giveItems(PURIFIED_MAGIC_NECKLACE, 1);
break;
} }
else if (event.equals("30097-12.htm")) case "30097-12.htm":
{ {
st.takeItems(MARK_OF_TRAVELER, -1); st.takeItems(MARK_OF_TRAVELER, -1);
st.takeItems(PURIFIED_MAGIC_NECKLACE, 1); st.takeItems(PURIFIED_MAGIC_NECKLACE, 1);
st.rewardItems(SCROLL_OF_ESCAPE_SPECIAL, 1); st.rewardItems(SCROLL_OF_ESCAPE_SPECIAL, 1);
st.playSound(QuestState.SOUND_FINISH); st.playSound(QuestState.SOUND_FINISH);
st.exitQuest(false); st.exitQuest(false);
break;
}
} }
return htmltext; return htmltext;
@@ -128,6 +133,7 @@ public class Q049_TheRoadHome extends Quest
switch (st.getState()) switch (st.getState())
{ {
case State.CREATED: case State.CREATED:
{
if ((player.getRace() == Race.DWARF) && (player.getLevel() >= 3)) if ((player.getRace() == Race.DWARF) && (player.getLevel() >= 3))
{ {
if (st.hasQuestItems(MARK_OF_TRAVELER)) if (st.hasQuestItems(MARK_OF_TRAVELER))
@@ -144,12 +150,14 @@ public class Q049_TheRoadHome extends Quest
htmltext = "30097-01a.htm"; htmltext = "30097-01a.htm";
} }
break; break;
}
case State.STARTED: case State.STARTED:
final int cond = st.getInt("cond"); {
final int cond = st.getCond();
switch (npc.getNpcId()) switch (npc.getNpcId())
{ {
case GALLADUCCI: case GALLADUCCI:
{
if (cond == 1) if (cond == 1)
{ {
htmltext = "30097-04.htm"; htmltext = "30097-04.htm";
@@ -175,8 +183,9 @@ public class Q049_TheRoadHome extends Quest
htmltext = "30097-11.htm"; htmltext = "30097-11.htm";
} }
break; break;
}
case GENTLER: case GENTLER:
{
if (cond == 1) if (cond == 1)
{ {
htmltext = "30094-01.htm"; htmltext = "30094-01.htm";
@@ -186,8 +195,9 @@ public class Q049_TheRoadHome extends Quest
htmltext = "30094-03.htm"; htmltext = "30094-03.htm";
} }
break; break;
}
case SANDRA: case SANDRA:
{
if (cond == 3) if (cond == 3)
{ {
htmltext = "30090-01.htm"; htmltext = "30090-01.htm";
@@ -197,8 +207,9 @@ public class Q049_TheRoadHome extends Quest
htmltext = "30090-03.htm"; htmltext = "30090-03.htm";
} }
break; break;
}
case DUSTIN: case DUSTIN:
{
if (cond == 5) if (cond == 5)
{ {
htmltext = "30116-01.htm"; htmltext = "30116-01.htm";
@@ -209,12 +220,15 @@ public class Q049_TheRoadHome extends Quest
} }
break; break;
} }
}
break; break;
}
case State.COMPLETED: case State.COMPLETED:
{
htmltext = getAlreadyCompletedMsg(); htmltext = getAlreadyCompletedMsg();
break; break;
} }
}
return htmltext; return htmltext;
} }

View File

@@ -26,19 +26,15 @@ public class Q050_LanoscosSpecialBait extends Quest
{ {
// Item // Item
private static final int ESSENCE_OF_WIND = 7621; private static final int ESSENCE_OF_WIND = 7621;
// Reward // Reward
private static final int WIND_FISHING_LURE = 7610; private static final int WIND_FISHING_LURE = 7610;
public Q050_LanoscosSpecialBait() public Q050_LanoscosSpecialBait()
{ {
super(50, "Lanosco's Special Bait"); super(50, "Lanosco's Special Bait");
registerQuestItems(ESSENCE_OF_WIND); registerQuestItems(ESSENCE_OF_WIND);
addStartNpc(31570); // Lanosco addStartNpc(31570); // Lanosco
addTalkId(31570); addTalkId(31570);
addKillId(21026); // Singing wind addKillId(21026); // Singing wind
} }
@@ -54,9 +50,7 @@ public class Q050_LanoscosSpecialBait extends Quest
if (event.equals("31570-03.htm")) if (event.equals("31570-03.htm"))
{ {
st.setState(State.STARTED); st.startQuest();
st.set("cond", "1");
st.playSound(QuestState.SOUND_ACCEPT);
} }
else if (event.equals("31570-07.htm")) else if (event.equals("31570-07.htm"))
{ {
@@ -83,17 +77,21 @@ public class Q050_LanoscosSpecialBait extends Quest
switch (st.getState()) switch (st.getState())
{ {
case State.CREATED: case State.CREATED:
{
htmltext = (player.getLevel() < 27) ? "31570-02.htm" : "31570-01.htm"; htmltext = (player.getLevel() < 27) ? "31570-02.htm" : "31570-01.htm";
break; break;
}
case State.STARTED: case State.STARTED:
{
htmltext = (st.getQuestItemsCount(ESSENCE_OF_WIND) == 100) ? "31570-04.htm" : "31570-05.htm"; htmltext = (st.getQuestItemsCount(ESSENCE_OF_WIND) == 100) ? "31570-04.htm" : "31570-05.htm";
break; break;
}
case State.COMPLETED: case State.COMPLETED:
{
htmltext = getAlreadyCompletedMsg(); htmltext = getAlreadyCompletedMsg();
break; break;
} }
}
return htmltext; return htmltext;
} }
@@ -101,7 +99,7 @@ public class Q050_LanoscosSpecialBait extends Quest
@Override @Override
public String onKill(NpcInstance npc, PlayerInstance player, boolean isPet) public String onKill(NpcInstance npc, PlayerInstance player, boolean isPet)
{ {
final QuestState st = checkPlayerCondition(player, npc, "cond", "1"); final QuestState st = checkPlayerCondition(player, npc, 1);
if (st == null) if (st == null)
{ {
return null; return null;
@@ -109,7 +107,7 @@ public class Q050_LanoscosSpecialBait extends Quest
if (st.dropItems(ESSENCE_OF_WIND, 1, 100, 500000)) if (st.dropItems(ESSENCE_OF_WIND, 1, 100, 500000))
{ {
st.set("cond", "2"); st.setCond(2);
} }
return null; return null;

View File

@@ -26,19 +26,15 @@ public class Q051_OFullesSpecialBait extends Quest
{ {
// Item // Item
private static final int LOST_BAIT = 7622; private static final int LOST_BAIT = 7622;
// Reward // Reward
private static final int ICY_AIR_LURE = 7611; private static final int ICY_AIR_LURE = 7611;
public Q051_OFullesSpecialBait() public Q051_OFullesSpecialBait()
{ {
super(51, "O'Fulle's Special Bait"); super(51, "O'Fulle's Special Bait");
registerQuestItems(LOST_BAIT); registerQuestItems(LOST_BAIT);
addStartNpc(31572); // O'Fulle addStartNpc(31572); // O'Fulle
addTalkId(31572); addTalkId(31572);
addKillId(20552); // Fettered Soul addKillId(20552); // Fettered Soul
} }
@@ -54,9 +50,7 @@ public class Q051_OFullesSpecialBait extends Quest
if (event.equals("31572-03.htm")) if (event.equals("31572-03.htm"))
{ {
st.setState(State.STARTED); st.startQuest();
st.set("cond", "1");
st.playSound(QuestState.SOUND_ACCEPT);
} }
else if (event.equals("31572-07.htm")) else if (event.equals("31572-07.htm"))
{ {
@@ -83,17 +77,21 @@ public class Q051_OFullesSpecialBait extends Quest
switch (st.getState()) switch (st.getState())
{ {
case State.CREATED: case State.CREATED:
{
htmltext = (player.getLevel() < 36) ? "31572-02.htm" : "31572-01.htm"; htmltext = (player.getLevel() < 36) ? "31572-02.htm" : "31572-01.htm";
break; break;
}
case State.STARTED: case State.STARTED:
{
htmltext = (st.getQuestItemsCount(LOST_BAIT) == 100) ? "31572-04.htm" : "31572-05.htm"; htmltext = (st.getQuestItemsCount(LOST_BAIT) == 100) ? "31572-04.htm" : "31572-05.htm";
break; break;
}
case State.COMPLETED: case State.COMPLETED:
{
htmltext = getAlreadyCompletedMsg(); htmltext = getAlreadyCompletedMsg();
break; break;
} }
}
return htmltext; return htmltext;
} }
@@ -101,7 +99,7 @@ public class Q051_OFullesSpecialBait extends Quest
@Override @Override
public String onKill(NpcInstance npc, PlayerInstance player, boolean isPet) public String onKill(NpcInstance npc, PlayerInstance player, boolean isPet)
{ {
final QuestState st = checkPlayerCondition(player, npc, "cond", "1"); final QuestState st = checkPlayerCondition(player, npc, 1);
if (st == null) if (st == null)
{ {
return null; return null;
@@ -109,7 +107,7 @@ public class Q051_OFullesSpecialBait extends Quest
if (st.dropItemsAlways(LOST_BAIT, 1, 100)) if (st.dropItemsAlways(LOST_BAIT, 1, 100))
{ {
st.set("cond", "2"); st.setCond(2);
} }
return null; return null;

View File

@@ -26,19 +26,15 @@ public class Q052_WilliesSpecialBait extends Quest
{ {
// Item // Item
private static final int TARLK_EYE = 7623; private static final int TARLK_EYE = 7623;
// Reward // Reward
private static final int EARTH_FISHING_LURE = 7612; private static final int EARTH_FISHING_LURE = 7612;
public Q052_WilliesSpecialBait() public Q052_WilliesSpecialBait()
{ {
super(52, "Willie's Special Bait"); super(52, "Willie's Special Bait");
registerQuestItems(TARLK_EYE); registerQuestItems(TARLK_EYE);
addStartNpc(31574); // Willie addStartNpc(31574); // Willie
addTalkId(31574); addTalkId(31574);
addKillId(20573); // Tarlk Basilik addKillId(20573); // Tarlk Basilik
} }
@@ -54,9 +50,7 @@ public class Q052_WilliesSpecialBait extends Quest
if (event.equals("31574-03.htm")) if (event.equals("31574-03.htm"))
{ {
st.setState(State.STARTED); st.startQuest();
st.set("cond", "1");
st.playSound(QuestState.SOUND_ACCEPT);
} }
else if (event.equals("31574-07.htm")) else if (event.equals("31574-07.htm"))
{ {
@@ -83,17 +77,21 @@ public class Q052_WilliesSpecialBait extends Quest
switch (st.getState()) switch (st.getState())
{ {
case State.CREATED: case State.CREATED:
{
htmltext = (player.getLevel() < 48) ? "31574-02.htm" : "31574-01.htm"; htmltext = (player.getLevel() < 48) ? "31574-02.htm" : "31574-01.htm";
break; break;
}
case State.STARTED: case State.STARTED:
{
htmltext = (st.getQuestItemsCount(TARLK_EYE) == 100) ? "31574-04.htm" : "31574-05.htm"; htmltext = (st.getQuestItemsCount(TARLK_EYE) == 100) ? "31574-04.htm" : "31574-05.htm";
break; break;
}
case State.COMPLETED: case State.COMPLETED:
{
htmltext = getAlreadyCompletedMsg(); htmltext = getAlreadyCompletedMsg();
break; break;
} }
}
return htmltext; return htmltext;
} }
@@ -101,7 +99,7 @@ public class Q052_WilliesSpecialBait extends Quest
@Override @Override
public String onKill(NpcInstance npc, PlayerInstance player, boolean isPet) public String onKill(NpcInstance npc, PlayerInstance player, boolean isPet)
{ {
final QuestState st = checkPlayerCondition(player, npc, "cond", "1"); final QuestState st = checkPlayerCondition(player, npc, 1);
if (st == null) if (st == null)
{ {
return null; return null;
@@ -109,7 +107,7 @@ public class Q052_WilliesSpecialBait extends Quest
if (st.dropItems(TARLK_EYE, 1, 100, 500000)) if (st.dropItems(TARLK_EYE, 1, 100, 500000))
{ {
st.set("cond", "2"); st.setCond(2);
} }
return null; return null;

View File

@@ -26,19 +26,15 @@ public class Q053_LinnaeusSpecialBait extends Quest
{ {
// Item // Item
private static final int CRIMSON_DRAKE_HEART = 7624; private static final int CRIMSON_DRAKE_HEART = 7624;
// Reward // Reward
private static final int FLAMING_FISHING_LURE = 7613; private static final int FLAMING_FISHING_LURE = 7613;
public Q053_LinnaeusSpecialBait() public Q053_LinnaeusSpecialBait()
{ {
super(53, "Linnaeus' Special Bait"); super(53, "Linnaeus' Special Bait");
registerQuestItems(CRIMSON_DRAKE_HEART); registerQuestItems(CRIMSON_DRAKE_HEART);
addStartNpc(31577); // Linnaeus addStartNpc(31577); // Linnaeus
addTalkId(31577); addTalkId(31577);
addKillId(20670); // Crimson Drake addKillId(20670); // Crimson Drake
} }
@@ -54,9 +50,7 @@ public class Q053_LinnaeusSpecialBait extends Quest
if (event.equals("31577-03.htm")) if (event.equals("31577-03.htm"))
{ {
st.setState(State.STARTED); st.startQuest();
st.set("cond", "1");
st.playSound(QuestState.SOUND_ACCEPT);
} }
else if (event.equals("31577-07.htm")) else if (event.equals("31577-07.htm"))
{ {
@@ -83,17 +77,21 @@ public class Q053_LinnaeusSpecialBait extends Quest
switch (st.getState()) switch (st.getState())
{ {
case State.CREATED: case State.CREATED:
{
htmltext = (player.getLevel() < 60) ? "31577-02.htm" : "31577-01.htm"; htmltext = (player.getLevel() < 60) ? "31577-02.htm" : "31577-01.htm";
break; break;
}
case State.STARTED: case State.STARTED:
{
htmltext = (st.getQuestItemsCount(CRIMSON_DRAKE_HEART) == 100) ? "31577-04.htm" : "31577-05.htm"; htmltext = (st.getQuestItemsCount(CRIMSON_DRAKE_HEART) == 100) ? "31577-04.htm" : "31577-05.htm";
break; break;
}
case State.COMPLETED: case State.COMPLETED:
{
htmltext = getAlreadyCompletedMsg(); htmltext = getAlreadyCompletedMsg();
break; break;
} }
}
return htmltext; return htmltext;
} }
@@ -101,7 +99,7 @@ public class Q053_LinnaeusSpecialBait extends Quest
@Override @Override
public String onKill(NpcInstance npc, PlayerInstance player, boolean isPet) public String onKill(NpcInstance npc, PlayerInstance player, boolean isPet)
{ {
final QuestState st = checkPlayerCondition(player, npc, "cond", "1"); final QuestState st = checkPlayerCondition(player, npc, 1);
if (st == null) if (st == null)
{ {
return null; return null;
@@ -109,7 +107,7 @@ public class Q053_LinnaeusSpecialBait extends Quest
if (st.dropItems(CRIMSON_DRAKE_HEART, 1, 100, 500000)) if (st.dropItems(CRIMSON_DRAKE_HEART, 1, 100, 500000))
{ {
st.set("cond", "2"); st.setCond(2);
} }
return null; return null;

View File

@@ -29,7 +29,6 @@ public class Q101_SwordOfSolidarity extends Quest
// NPCs // NPCs
private static final int ROIEN = 30008; private static final int ROIEN = 30008;
private static final int ALTRAN = 30283; private static final int ALTRAN = 30283;
// Items // Items
private static final int BROKEN_SWORD_HANDLE = 739; private static final int BROKEN_SWORD_HANDLE = 739;
private static final int BROKEN_BLADE_BOTTOM = 740; private static final int BROKEN_BLADE_BOTTOM = 740;
@@ -37,7 +36,6 @@ public class Q101_SwordOfSolidarity extends Quest
private static final int ROIENS_LETTER = 796; private static final int ROIENS_LETTER = 796;
private static final int DIR_TO_RUINS = 937; private static final int DIR_TO_RUINS = 937;
private static final int ALTRANS_NOTE = 742; private static final int ALTRANS_NOTE = 742;
private static final int SWORD_OF_SOLIDARITY = 738; private static final int SWORD_OF_SOLIDARITY = 738;
private static final int SPIRITSHOT_FOR_BEGINNERS = 5790; private static final int SPIRITSHOT_FOR_BEGINNERS = 5790;
private static final int SOULSHOT_FOR_BEGINNERS = 5789; private static final int SOULSHOT_FOR_BEGINNERS = 5789;
@@ -51,12 +49,9 @@ public class Q101_SwordOfSolidarity extends Quest
public Q101_SwordOfSolidarity() public Q101_SwordOfSolidarity()
{ {
super(101, "Sword of Solidarity"); super(101, "Sword of Solidarity");
registerQuestItems(BROKEN_SWORD_HANDLE, BROKEN_BLADE_BOTTOM, BROKEN_BLADE_TOP); registerQuestItems(BROKEN_SWORD_HANDLE, BROKEN_BLADE_BOTTOM, BROKEN_BLADE_TOP);
addStartNpc(ROIEN); addStartNpc(ROIEN);
addTalkId(ROIEN, ALTRAN); addTalkId(ROIEN, ALTRAN);
addKillId(20361, 20362); addKillId(20361, 20362);
} }
@@ -70,26 +65,27 @@ public class Q101_SwordOfSolidarity extends Quest
return htmltext; return htmltext;
} }
if (event.equals("30008-03.htm")) switch (event)
{ {
st.setState(State.STARTED); case "30008-03.htm":
st.set("cond", "1"); {
st.playSound(QuestState.SOUND_ACCEPT); st.startQuest();
st.giveItems(ROIENS_LETTER, 1); st.giveItems(ROIENS_LETTER, 1);
break;
} }
else if (event.equals("30283-02.htm")) case "30283-02.htm":
{ {
st.set("cond", "2"); st.setCond(2);
st.playSound(QuestState.SOUND_MIDDLE); st.playSound(QuestState.SOUND_MIDDLE);
st.takeItems(ROIENS_LETTER, 1); st.takeItems(ROIENS_LETTER, 1);
st.giveItems(DIR_TO_RUINS, 1); st.giveItems(DIR_TO_RUINS, 1);
break;
} }
else if (event.equals("30283-06.htm")) case "30283-06.htm":
{ {
st.takeItems(BROKEN_SWORD_HANDLE, 1); st.takeItems(BROKEN_SWORD_HANDLE, 1);
st.giveItems(SWORD_OF_SOLIDARITY, 1); st.giveItems(SWORD_OF_SOLIDARITY, 1);
st.giveItems(LESSER_HEALING_POT, 100); st.giveItems(LESSER_HEALING_POT, 100);
if (player.isNewbie()) if (player.isNewbie())
{ {
st.showQuestionMark(26); st.showQuestionMark(26);
@@ -104,7 +100,6 @@ public class Q101_SwordOfSolidarity extends Quest
st.giveItems(SOULSHOT_FOR_BEGINNERS, 7000); st.giveItems(SOULSHOT_FOR_BEGINNERS, 7000);
} }
} }
st.giveItems(ECHO_BATTLE, 10); st.giveItems(ECHO_BATTLE, 10);
st.giveItems(ECHO_LOVE, 10); st.giveItems(ECHO_LOVE, 10);
st.giveItems(ECHO_SOLITUDE, 10); st.giveItems(ECHO_SOLITUDE, 10);
@@ -113,6 +108,8 @@ public class Q101_SwordOfSolidarity extends Quest
player.broadcastPacket(new SocialAction(player.getObjectId(), 3)); player.broadcastPacket(new SocialAction(player.getObjectId(), 3));
st.playSound(QuestState.SOUND_FINISH); st.playSound(QuestState.SOUND_FINISH);
st.exitQuest(false); st.exitQuest(false);
break;
}
} }
return htmltext; return htmltext;
@@ -131,6 +128,7 @@ public class Q101_SwordOfSolidarity extends Quest
switch (st.getState()) switch (st.getState())
{ {
case State.CREATED: case State.CREATED:
{
if (player.getRace() != Race.HUMAN) if (player.getRace() != Race.HUMAN)
{ {
htmltext = "30008-01a.htm"; htmltext = "30008-01a.htm";
@@ -144,12 +142,14 @@ public class Q101_SwordOfSolidarity extends Quest
htmltext = "30008-02.htm"; htmltext = "30008-02.htm";
} }
break; break;
}
case State.STARTED: case State.STARTED:
final int cond = (st.getInt("cond")); {
final int cond = (st.getCond());
switch (npc.getNpcId()) switch (npc.getNpcId())
{ {
case ROIEN: case ROIEN:
{
if (cond == 1) if (cond == 1)
{ {
htmltext = "30008-04.htm"; htmltext = "30008-04.htm";
@@ -165,7 +165,7 @@ public class Q101_SwordOfSolidarity extends Quest
else if (cond == 4) else if (cond == 4)
{ {
htmltext = "30008-05.htm"; htmltext = "30008-05.htm";
st.set("cond", "5"); st.setCond(5);
st.playSound(QuestState.SOUND_MIDDLE); st.playSound(QuestState.SOUND_MIDDLE);
st.takeItems(ALTRANS_NOTE, 1); st.takeItems(ALTRANS_NOTE, 1);
st.giveItems(BROKEN_SWORD_HANDLE, 1); st.giveItems(BROKEN_SWORD_HANDLE, 1);
@@ -175,8 +175,9 @@ public class Q101_SwordOfSolidarity extends Quest
htmltext = "30008-05a.htm"; htmltext = "30008-05a.htm";
} }
break; break;
}
case ALTRAN: case ALTRAN:
{
if (cond == 1) if (cond == 1)
{ {
htmltext = "30283-01.htm"; htmltext = "30283-01.htm";
@@ -188,7 +189,7 @@ public class Q101_SwordOfSolidarity extends Quest
else if (cond == 3) else if (cond == 3)
{ {
htmltext = "30283-04.htm"; htmltext = "30283-04.htm";
st.set("cond", "4"); st.setCond(4);
st.playSound(QuestState.SOUND_MIDDLE); st.playSound(QuestState.SOUND_MIDDLE);
st.takeItems(DIR_TO_RUINS, 1); st.takeItems(DIR_TO_RUINS, 1);
st.takeItems(BROKEN_BLADE_TOP, 1); st.takeItems(BROKEN_BLADE_TOP, 1);
@@ -205,12 +206,15 @@ public class Q101_SwordOfSolidarity extends Quest
} }
break; break;
} }
}
break; break;
}
case State.COMPLETED: case State.COMPLETED:
{
htmltext = getAlreadyCompletedMsg(); htmltext = getAlreadyCompletedMsg();
break; break;
} }
}
return htmltext; return htmltext;
} }
@@ -218,7 +222,7 @@ public class Q101_SwordOfSolidarity extends Quest
@Override @Override
public String onKill(NpcInstance npc, PlayerInstance player, boolean isPet) public String onKill(NpcInstance npc, PlayerInstance player, boolean isPet)
{ {
final QuestState st = checkPlayerCondition(player, npc, "cond", "2"); final QuestState st = checkPlayerCondition(player, npc, 2);
if (st == null) if (st == null)
{ {
return null; return null;
@@ -230,7 +234,7 @@ public class Q101_SwordOfSolidarity extends Quest
} }
else if (st.dropItems(BROKEN_BLADE_BOTTOM, 1, 1, 200000)) else if (st.dropItems(BROKEN_BLADE_BOTTOM, 1, 1, 200000))
{ {
st.set("cond", "3"); st.setCond(3);
} }
return null; return null;

View File

@@ -26,6 +26,13 @@ import org.l2jmobius.gameserver.network.serverpackets.SocialAction;
public class Q102_SeaOfSporesFever extends Quest public class Q102_SeaOfSporesFever extends Quest
{ {
// NPCs
private static final int ALBERIUS = 30284;
private static final int COBENDELL = 30156;
private static final int BERROS = 30217;
private static final int VELTRESS = 30219;
private static final int RAYEN = 30221;
private static final int GARTRANDELL = 30285;
// Items // Items
private static final int ALBERIUS_LETTER = 964; private static final int ALBERIUS_LETTER = 964;
private static final int EVERGREEN_AMULET = 965; private static final int EVERGREEN_AMULET = 965;
@@ -36,7 +43,6 @@ public class Q102_SeaOfSporesFever extends Quest
private static final int COBENDELL_MEDICINE_3 = 1132; private static final int COBENDELL_MEDICINE_3 = 1132;
private static final int COBENDELL_MEDICINE_4 = 1133; private static final int COBENDELL_MEDICINE_4 = 1133;
private static final int COBENDELL_MEDICINE_5 = 1134; private static final int COBENDELL_MEDICINE_5 = 1134;
// Rewards // Rewards
private static final int SPIRITSHOT_NO_GRADE = 2509; private static final int SPIRITSHOT_NO_GRADE = 2509;
private static final int SOULSHOT_NO_GRADE = 1835; private static final int SOULSHOT_NO_GRADE = 1835;
@@ -49,23 +55,12 @@ public class Q102_SeaOfSporesFever extends Quest
private static final int ECHO_FEAST = 4415; private static final int ECHO_FEAST = 4415;
private static final int ECHO_CELEBRATION = 4416; private static final int ECHO_CELEBRATION = 4416;
// NPCs
private static final int ALBERIUS = 30284;
private static final int COBENDELL = 30156;
private static final int BERROS = 30217;
private static final int VELTRESS = 30219;
private static final int RAYEN = 30221;
private static final int GARTRANDELL = 30285;
public Q102_SeaOfSporesFever() public Q102_SeaOfSporesFever()
{ {
super(102, "Sea of Spores Fever"); super(102, "Sea of Spores Fever");
registerQuestItems(ALBERIUS_LETTER, EVERGREEN_AMULET, DRYAD_TEARS, COBENDELL_MEDICINE_1, COBENDELL_MEDICINE_2, COBENDELL_MEDICINE_3, COBENDELL_MEDICINE_4, COBENDELL_MEDICINE_5, ALBERIUS_LIST); registerQuestItems(ALBERIUS_LETTER, EVERGREEN_AMULET, DRYAD_TEARS, COBENDELL_MEDICINE_1, COBENDELL_MEDICINE_2, COBENDELL_MEDICINE_3, COBENDELL_MEDICINE_4, COBENDELL_MEDICINE_5, ALBERIUS_LIST);
addStartNpc(ALBERIUS); addStartNpc(ALBERIUS);
addTalkId(ALBERIUS, COBENDELL, BERROS, RAYEN, GARTRANDELL, VELTRESS); addTalkId(ALBERIUS, COBENDELL, BERROS, RAYEN, GARTRANDELL, VELTRESS);
addKillId(20013, 20019); addKillId(20013, 20019);
} }
@@ -81,9 +76,7 @@ public class Q102_SeaOfSporesFever extends Quest
if (event.equals("30284-02.htm")) if (event.equals("30284-02.htm"))
{ {
st.setState(State.STARTED); st.startQuest();
st.set("cond", "1");
st.playSound(QuestState.SOUND_ACCEPT);
st.giveItems(ALBERIUS_LETTER, 1); st.giveItems(ALBERIUS_LETTER, 1);
} }
@@ -103,6 +96,7 @@ public class Q102_SeaOfSporesFever extends Quest
switch (st.getState()) switch (st.getState())
{ {
case State.CREATED: case State.CREATED:
{
if (player.getRace() != Race.ELF) if (player.getRace() != Race.ELF)
{ {
htmltext = "30284-00.htm"; htmltext = "30284-00.htm";
@@ -116,12 +110,14 @@ public class Q102_SeaOfSporesFever extends Quest
htmltext = "30284-07.htm"; htmltext = "30284-07.htm";
} }
break; break;
}
case State.STARTED: case State.STARTED:
final int cond = st.getInt("cond"); {
final int cond = st.getCond();
switch (npc.getNpcId()) switch (npc.getNpcId())
{ {
case ALBERIUS: case ALBERIUS:
{
if (cond == 1) if (cond == 1)
{ {
htmltext = "30284-03.htm"; htmltext = "30284-03.htm";
@@ -133,7 +129,7 @@ public class Q102_SeaOfSporesFever extends Quest
else if (cond == 4) else if (cond == 4)
{ {
htmltext = "30284-04.htm"; htmltext = "30284-04.htm";
st.set("cond", "5"); st.setCond(5);
st.set("medicines", "4"); st.set("medicines", "4");
st.playSound(QuestState.SOUND_MIDDLE); st.playSound(QuestState.SOUND_MIDDLE);
st.takeItems(COBENDELL_MEDICINE_1, 1); st.takeItems(COBENDELL_MEDICINE_1, 1);
@@ -170,12 +166,13 @@ public class Q102_SeaOfSporesFever extends Quest
st.exitQuest(false); st.exitQuest(false);
} }
break; break;
}
case COBENDELL: case COBENDELL:
{
if (cond == 1) if (cond == 1)
{ {
htmltext = "30156-03.htm"; htmltext = "30156-03.htm";
st.set("cond", "2"); st.setCond(2);
st.playSound(QuestState.SOUND_MIDDLE); st.playSound(QuestState.SOUND_MIDDLE);
st.takeItems(ALBERIUS_LETTER, 1); st.takeItems(ALBERIUS_LETTER, 1);
st.giveItems(EVERGREEN_AMULET, 1); st.giveItems(EVERGREEN_AMULET, 1);
@@ -191,7 +188,7 @@ public class Q102_SeaOfSporesFever extends Quest
else if (cond == 3) else if (cond == 3)
{ {
htmltext = "30156-05.htm"; htmltext = "30156-05.htm";
st.set("cond", "4"); st.setCond(4);
st.playSound(QuestState.SOUND_MIDDLE); st.playSound(QuestState.SOUND_MIDDLE);
st.takeItems(DRYAD_TEARS, -1); st.takeItems(DRYAD_TEARS, -1);
st.takeItems(EVERGREEN_AMULET, 1); st.takeItems(EVERGREEN_AMULET, 1);
@@ -206,32 +203,36 @@ public class Q102_SeaOfSporesFever extends Quest
htmltext = "30156-06.htm"; htmltext = "30156-06.htm";
} }
break; break;
}
case BERROS: case BERROS:
{
if (cond == 5) if (cond == 5)
{ {
htmltext = "30217-01.htm"; htmltext = "30217-01.htm";
checkItem(st, COBENDELL_MEDICINE_2); checkItem(st, COBENDELL_MEDICINE_2);
} }
break; break;
}
case VELTRESS: case VELTRESS:
{
if (cond == 5) if (cond == 5)
{ {
htmltext = "30219-01.htm"; htmltext = "30219-01.htm";
checkItem(st, COBENDELL_MEDICINE_3); checkItem(st, COBENDELL_MEDICINE_3);
} }
break; break;
}
case RAYEN: case RAYEN:
{
if (cond == 5) if (cond == 5)
{ {
htmltext = "30221-01.htm"; htmltext = "30221-01.htm";
checkItem(st, COBENDELL_MEDICINE_4); checkItem(st, COBENDELL_MEDICINE_4);
} }
break; break;
}
case GARTRANDELL: case GARTRANDELL:
{
if (cond == 5) if (cond == 5)
{ {
htmltext = "30285-01.htm"; htmltext = "30285-01.htm";
@@ -239,12 +240,15 @@ public class Q102_SeaOfSporesFever extends Quest
} }
break; break;
} }
}
break; break;
}
case State.COMPLETED: case State.COMPLETED:
{
htmltext = getAlreadyCompletedMsg(); htmltext = getAlreadyCompletedMsg();
break; break;
} }
}
return htmltext; return htmltext;
} }
@@ -252,7 +256,7 @@ public class Q102_SeaOfSporesFever extends Quest
@Override @Override
public String onKill(NpcInstance npc, PlayerInstance player, boolean isPet) public String onKill(NpcInstance npc, PlayerInstance player, boolean isPet)
{ {
final QuestState st = checkPlayerCondition(player, npc, "cond", "2"); final QuestState st = checkPlayerCondition(player, npc, 2);
if (st == null) if (st == null)
{ {
return null; return null;
@@ -260,7 +264,7 @@ public class Q102_SeaOfSporesFever extends Quest
if (st.dropItems(DRYAD_TEARS, 1, 10, 300000)) if (st.dropItems(DRYAD_TEARS, 1, 10, 300000))
{ {
st.set("cond", "3"); st.setCond(3);
} }
return null; return null;
@@ -275,7 +279,7 @@ public class Q102_SeaOfSporesFever extends Quest
final int medicinesLeft = st.getInt("medicines") - 1; final int medicinesLeft = st.getInt("medicines") - 1;
if (medicinesLeft == 0) if (medicinesLeft == 0)
{ {
st.set("cond", "6"); st.setCond(6);
st.playSound(QuestState.SOUND_MIDDLE); st.playSound(QuestState.SOUND_MIDDLE);
} }
else else

View File

@@ -26,6 +26,10 @@ import org.l2jmobius.gameserver.network.serverpackets.SocialAction;
public class Q103_SpiritOfCraftsman extends Quest public class Q103_SpiritOfCraftsman extends Quest
{ {
// NPCs
private static final int KARROD = 30307;
private static final int CECKTINON = 30132;
private static final int HARNE = 30144;
// Items // Items
private static final int KARROD_LETTER = 968; private static final int KARROD_LETTER = 968;
private static final int CECKTINON_VOUCHER_1 = 969; private static final int CECKTINON_VOUCHER_1 = 969;
@@ -35,7 +39,6 @@ public class Q103_SpiritOfCraftsman extends Quest
private static final int ZOMBIE_HEAD = 973; private static final int ZOMBIE_HEAD = 973;
private static final int STEELBENDER_HEAD = 974; private static final int STEELBENDER_HEAD = 974;
private static final int BONE_FRAGMENT = 1107; private static final int BONE_FRAGMENT = 1107;
// Rewards // Rewards
private static final int SPIRITSHOT_NO_GRADE = 2509; private static final int SPIRITSHOT_NO_GRADE = 2509;
private static final int SOULSHOT_NO_GRADE = 1835; private static final int SOULSHOT_NO_GRADE = 1835;
@@ -49,20 +52,12 @@ public class Q103_SpiritOfCraftsman extends Quest
private static final int ECHO_FEAST = 4415; private static final int ECHO_FEAST = 4415;
private static final int ECHO_CELEBRATION = 4416; private static final int ECHO_CELEBRATION = 4416;
// NPCs
private static final int KARROD = 30307;
private static final int CECKTINON = 30132;
private static final int HARNE = 30144;
public Q103_SpiritOfCraftsman() public Q103_SpiritOfCraftsman()
{ {
super(103, "Spirit of Craftsman"); super(103, "Spirit of Craftsman");
registerQuestItems(KARROD_LETTER, CECKTINON_VOUCHER_1, CECKTINON_VOUCHER_2, BONE_FRAGMENT, SOUL_CATCHER, PRESERVING_OIL, ZOMBIE_HEAD, STEELBENDER_HEAD); registerQuestItems(KARROD_LETTER, CECKTINON_VOUCHER_1, CECKTINON_VOUCHER_2, BONE_FRAGMENT, SOUL_CATCHER, PRESERVING_OIL, ZOMBIE_HEAD, STEELBENDER_HEAD);
addStartNpc(KARROD); addStartNpc(KARROD);
addTalkId(KARROD, CECKTINON, HARNE); addTalkId(KARROD, CECKTINON, HARNE);
addKillId(20015, 20020, 20455, 20517, 20518); addKillId(20015, 20020, 20455, 20517, 20518);
} }
@@ -78,9 +73,7 @@ public class Q103_SpiritOfCraftsman extends Quest
if (event.equals("30307-05.htm")) if (event.equals("30307-05.htm"))
{ {
st.setState(State.STARTED); st.startQuest();
st.set("cond", "1");
st.playSound(QuestState.SOUND_ACCEPT);
st.giveItems(KARROD_LETTER, 1); st.giveItems(KARROD_LETTER, 1);
} }
@@ -100,6 +93,7 @@ public class Q103_SpiritOfCraftsman extends Quest
switch (st.getState()) switch (st.getState())
{ {
case State.CREATED: case State.CREATED:
{
if (player.getRace() != Race.DARK_ELF) if (player.getRace() != Race.DARK_ELF)
{ {
htmltext = "30307-00.htm"; htmltext = "30307-00.htm";
@@ -113,12 +107,14 @@ public class Q103_SpiritOfCraftsman extends Quest
htmltext = "30307-03.htm"; htmltext = "30307-03.htm";
} }
break; break;
}
case State.STARTED: case State.STARTED:
final int cond = st.getInt("cond"); {
final int cond = st.getCond();
switch (npc.getNpcId()) switch (npc.getNpcId())
{ {
case KARROD: case KARROD:
{
if (cond < 8) if (cond < 8)
{ {
htmltext = "30307-06.htm"; htmltext = "30307-06.htm";
@@ -164,12 +160,13 @@ public class Q103_SpiritOfCraftsman extends Quest
st.exitQuest(false); st.exitQuest(false);
} }
break; break;
}
case CECKTINON: case CECKTINON:
{
if (cond == 1) if (cond == 1)
{ {
htmltext = "30132-01.htm"; htmltext = "30132-01.htm";
st.set("cond", "2"); st.setCond(2);
st.playSound(QuestState.SOUND_MIDDLE); st.playSound(QuestState.SOUND_MIDDLE);
st.takeItems(KARROD_LETTER, 1); st.takeItems(KARROD_LETTER, 1);
st.giveItems(CECKTINON_VOUCHER_1, 1); st.giveItems(CECKTINON_VOUCHER_1, 1);
@@ -181,7 +178,7 @@ public class Q103_SpiritOfCraftsman extends Quest
else if (cond == 5) else if (cond == 5)
{ {
htmltext = "30132-03.htm"; htmltext = "30132-03.htm";
st.set("cond", "6"); st.setCond(6);
st.playSound(QuestState.SOUND_MIDDLE); st.playSound(QuestState.SOUND_MIDDLE);
st.takeItems(SOUL_CATCHER, 1); st.takeItems(SOUL_CATCHER, 1);
st.giveItems(PRESERVING_OIL, 1); st.giveItems(PRESERVING_OIL, 1);
@@ -193,7 +190,7 @@ public class Q103_SpiritOfCraftsman extends Quest
else if (cond == 7) else if (cond == 7)
{ {
htmltext = "30132-05.htm"; htmltext = "30132-05.htm";
st.set("cond", "8"); st.setCond(8);
st.playSound(QuestState.SOUND_MIDDLE); st.playSound(QuestState.SOUND_MIDDLE);
st.takeItems(ZOMBIE_HEAD, 1); st.takeItems(ZOMBIE_HEAD, 1);
st.giveItems(STEELBENDER_HEAD, 1); st.giveItems(STEELBENDER_HEAD, 1);
@@ -203,12 +200,13 @@ public class Q103_SpiritOfCraftsman extends Quest
htmltext = "30132-06.htm"; htmltext = "30132-06.htm";
} }
break; break;
}
case HARNE: case HARNE:
{
if (cond == 2) if (cond == 2)
{ {
htmltext = "30144-01.htm"; htmltext = "30144-01.htm";
st.set("cond", "3"); st.setCond(3);
st.playSound(QuestState.SOUND_MIDDLE); st.playSound(QuestState.SOUND_MIDDLE);
st.takeItems(CECKTINON_VOUCHER_1, 1); st.takeItems(CECKTINON_VOUCHER_1, 1);
st.giveItems(CECKTINON_VOUCHER_2, 1); st.giveItems(CECKTINON_VOUCHER_2, 1);
@@ -220,7 +218,7 @@ public class Q103_SpiritOfCraftsman extends Quest
else if (cond == 4) else if (cond == 4)
{ {
htmltext = "30144-03.htm"; htmltext = "30144-03.htm";
st.set("cond", "5"); st.setCond(5);
st.playSound(QuestState.SOUND_MIDDLE); st.playSound(QuestState.SOUND_MIDDLE);
st.takeItems(CECKTINON_VOUCHER_2, 1); st.takeItems(CECKTINON_VOUCHER_2, 1);
st.takeItems(BONE_FRAGMENT, 10); st.takeItems(BONE_FRAGMENT, 10);
@@ -232,12 +230,15 @@ public class Q103_SpiritOfCraftsman extends Quest
} }
break; break;
} }
}
break; break;
}
case State.COMPLETED: case State.COMPLETED:
{
htmltext = getAlreadyCompletedMsg(); htmltext = getAlreadyCompletedMsg();
break; break;
} }
}
return htmltext; return htmltext;
} }
@@ -256,21 +257,24 @@ public class Q103_SpiritOfCraftsman extends Quest
case 20517: case 20517:
case 20518: case 20518:
case 20455: case 20455:
if ((st.getInt("cond") == 3) && st.dropItems(BONE_FRAGMENT, 1, 10, 300000))
{ {
st.set("cond", "4"); if (st.isCond(3) && st.dropItems(BONE_FRAGMENT, 1, 10, 300000))
{
st.setCond(4);
} }
break; break;
}
case 20015: case 20015:
case 20020: case 20020:
if ((st.getInt("cond") == 6) && st.dropItems(ZOMBIE_HEAD, 1, 1, 300000))
{ {
st.set("cond", "7"); if (st.isCond(6) && st.dropItems(ZOMBIE_HEAD, 1, 1, 300000))
{
st.setCond(7);
st.takeItems(PRESERVING_OIL, 1); st.takeItems(PRESERVING_OIL, 1);
} }
break; break;
} }
}
return null; return null;
} }

View File

@@ -27,12 +27,16 @@ import org.l2jmobius.gameserver.network.serverpackets.SocialAction;
public class Q104_SpiritOfMirrors extends Quest public class Q104_SpiritOfMirrors extends Quest
{ {
// NPCs
private static final int GALLINT = 30017;
private static final int ARNOLD = 30041;
private static final int JOHNSTONE = 30043;
private static final int KENYOS = 30045;
// Items // Items
private static final int GALLINS_OAK_WAND = 748; private static final int GALLINS_OAK_WAND = 748;
private static final int WAND_SPIRITBOUND_1 = 1135; private static final int WAND_SPIRITBOUND_1 = 1135;
private static final int WAND_SPIRITBOUND_2 = 1136; private static final int WAND_SPIRITBOUND_2 = 1136;
private static final int WAND_SPIRITBOUND_3 = 1137; private static final int WAND_SPIRITBOUND_3 = 1137;
// Rewards // Rewards
private static final int SPIRITSHOT_NO_GRADE = 2509; private static final int SPIRITSHOT_NO_GRADE = 2509;
private static final int SOULSHOT_NO_GRADE = 1835; private static final int SOULSHOT_NO_GRADE = 1835;
@@ -46,18 +50,10 @@ public class Q104_SpiritOfMirrors extends Quest
private static final int ECHO_FEAST = 4415; private static final int ECHO_FEAST = 4415;
private static final int ECHO_CELEBRATION = 4416; private static final int ECHO_CELEBRATION = 4416;
// NPCs
private static final int GALLINT = 30017;
private static final int ARNOLD = 30041;
private static final int JOHNSTONE = 30043;
private static final int KENYOS = 30045;
public Q104_SpiritOfMirrors() public Q104_SpiritOfMirrors()
{ {
super(104, "Spirit of Mirrors"); super(104, "Spirit of Mirrors");
registerQuestItems(GALLINS_OAK_WAND, WAND_SPIRITBOUND_1, WAND_SPIRITBOUND_2, WAND_SPIRITBOUND_3); registerQuestItems(GALLINS_OAK_WAND, WAND_SPIRITBOUND_1, WAND_SPIRITBOUND_2, WAND_SPIRITBOUND_3);
addStartNpc(GALLINT); addStartNpc(GALLINT);
addTalkId(GALLINT, ARNOLD, JOHNSTONE, KENYOS); addTalkId(GALLINT, ARNOLD, JOHNSTONE, KENYOS);
@@ -76,9 +72,7 @@ public class Q104_SpiritOfMirrors extends Quest
if (event.equals("30017-03.htm")) if (event.equals("30017-03.htm"))
{ {
st.setState(State.STARTED); st.startQuest();
st.set("cond", "1");
st.playSound(QuestState.SOUND_ACCEPT);
st.giveItems(GALLINS_OAK_WAND, 1); st.giveItems(GALLINS_OAK_WAND, 1);
st.giveItems(GALLINS_OAK_WAND, 1); st.giveItems(GALLINS_OAK_WAND, 1);
st.giveItems(GALLINS_OAK_WAND, 1); st.giveItems(GALLINS_OAK_WAND, 1);
@@ -100,6 +94,7 @@ public class Q104_SpiritOfMirrors extends Quest
switch (st.getState()) switch (st.getState())
{ {
case State.CREATED: case State.CREATED:
{
if (player.getRace() != Race.HUMAN) if (player.getRace() != Race.HUMAN)
{ {
htmltext = "30017-00.htm"; htmltext = "30017-00.htm";
@@ -113,12 +108,14 @@ public class Q104_SpiritOfMirrors extends Quest
htmltext = "30017-02.htm"; htmltext = "30017-02.htm";
} }
break; break;
}
case State.STARTED: case State.STARTED:
final int cond = st.getInt("cond"); {
final int cond = st.getCond();
switch (npc.getNpcId()) switch (npc.getNpcId())
{ {
case GALLINT: case GALLINT:
{
if ((cond == 1) || (cond == 2)) if ((cond == 1) || (cond == 2))
{ {
htmltext = "30017-04.htm"; htmltext = "30017-04.htm";
@@ -168,24 +165,28 @@ public class Q104_SpiritOfMirrors extends Quest
st.exitQuest(false); st.exitQuest(false);
} }
break; break;
}
case KENYOS: case KENYOS:
case JOHNSTONE: case JOHNSTONE:
case ARNOLD: case ARNOLD:
{
htmltext = npc.getNpcId() + "-01.htm"; htmltext = npc.getNpcId() + "-01.htm";
if (cond == 1) if (cond == 1)
{ {
st.set("cond", "2"); st.setCond(2);
st.playSound(QuestState.SOUND_MIDDLE); st.playSound(QuestState.SOUND_MIDDLE);
} }
break; break;
} }
}
break; break;
}
case State.COMPLETED: case State.COMPLETED:
{
htmltext = getAlreadyCompletedMsg(); htmltext = getAlreadyCompletedMsg();
break; break;
} }
}
return htmltext; return htmltext;
} }
@@ -210,7 +211,7 @@ public class Q104_SpiritOfMirrors extends Quest
st.giveItems(WAND_SPIRITBOUND_1, 1); st.giveItems(WAND_SPIRITBOUND_1, 1);
if (st.hasQuestItems(WAND_SPIRITBOUND_2, WAND_SPIRITBOUND_3)) if (st.hasQuestItems(WAND_SPIRITBOUND_2, WAND_SPIRITBOUND_3))
{ {
st.set("cond", "3"); st.setCond(3);
st.playSound(QuestState.SOUND_MIDDLE); st.playSound(QuestState.SOUND_MIDDLE);
} }
else else
@@ -227,7 +228,7 @@ public class Q104_SpiritOfMirrors extends Quest
st.giveItems(WAND_SPIRITBOUND_2, 1); st.giveItems(WAND_SPIRITBOUND_2, 1);
if (st.hasQuestItems(WAND_SPIRITBOUND_1, WAND_SPIRITBOUND_3)) if (st.hasQuestItems(WAND_SPIRITBOUND_1, WAND_SPIRITBOUND_3))
{ {
st.set("cond", "3"); st.setCond(3);
st.playSound(QuestState.SOUND_MIDDLE); st.playSound(QuestState.SOUND_MIDDLE);
} }
else else
@@ -244,7 +245,7 @@ public class Q104_SpiritOfMirrors extends Quest
st.giveItems(WAND_SPIRITBOUND_3, 1); st.giveItems(WAND_SPIRITBOUND_3, 1);
if (st.hasQuestItems(WAND_SPIRITBOUND_1, WAND_SPIRITBOUND_2)) if (st.hasQuestItems(WAND_SPIRITBOUND_1, WAND_SPIRITBOUND_2))
{ {
st.set("cond", "3"); st.setCond(3);
st.playSound(QuestState.SOUND_MIDDLE); st.playSound(QuestState.SOUND_MIDDLE);
} }
else else

View File

@@ -27,6 +27,15 @@ import org.l2jmobius.gameserver.network.serverpackets.SocialAction;
public class Q105_SkirmishWithTheOrcs extends Quest public class Q105_SkirmishWithTheOrcs extends Quest
{ {
// Monster
private static final int KABOO_CHIEF_UOPH = 27059;
private static final int KABOO_CHIEF_KRACHA = 27060;
private static final int KABOO_CHIEF_BATOH = 27061;
private static final int KABOO_CHIEF_TANUKIA = 27062;
private static final int KABOO_CHIEF_TUREL = 27064;
private static final int KABOO_CHIEF_ROKO = 27065;
private static final int KABOO_CHIEF_KAMUT = 27067;
private static final int KABOO_CHIEF_MURTIKA = 27068;
// Item // Item
private static final int KENDELL_ORDER_1 = 1836; private static final int KENDELL_ORDER_1 = 1836;
private static final int KENDELL_ORDER_2 = 1837; private static final int KENDELL_ORDER_2 = 1837;
@@ -38,17 +47,6 @@ public class Q105_SkirmishWithTheOrcs extends Quest
private static final int KENDELL_ORDER_8 = 1843; private static final int KENDELL_ORDER_8 = 1843;
private static final int KABOO_CHIEF_TORC_1 = 1844; private static final int KABOO_CHIEF_TORC_1 = 1844;
private static final int KABOO_CHIEF_TORC_2 = 1845; private static final int KABOO_CHIEF_TORC_2 = 1845;
// Monster
private static final int KABOO_CHIEF_UOPH = 27059;
private static final int KABOO_CHIEF_KRACHA = 27060;
private static final int KABOO_CHIEF_BATOH = 27061;
private static final int KABOO_CHIEF_TANUKIA = 27062;
private static final int KABOO_CHIEF_TUREL = 27064;
private static final int KABOO_CHIEF_ROKO = 27065;
private static final int KABOO_CHIEF_KAMUT = 27067;
private static final int KABOO_CHIEF_MURTIKA = 27068;
// Rewards // Rewards
private static final int SPIRITSHOT_FOR_BEGINNERS = 5790; private static final int SPIRITSHOT_FOR_BEGINNERS = 5790;
private static final int SOULSHOT_FOR_BEGINNERS = 5789; private static final int SOULSHOT_FOR_BEGINNERS = 5789;
@@ -63,12 +61,9 @@ public class Q105_SkirmishWithTheOrcs extends Quest
public Q105_SkirmishWithTheOrcs() public Q105_SkirmishWithTheOrcs()
{ {
super(105, "Skirmish with the Orcs"); super(105, "Skirmish with the Orcs");
registerQuestItems(KENDELL_ORDER_1, KENDELL_ORDER_2, KENDELL_ORDER_3, KENDELL_ORDER_4, KENDELL_ORDER_5, KENDELL_ORDER_6, KENDELL_ORDER_7, KENDELL_ORDER_8, KABOO_CHIEF_TORC_1, KABOO_CHIEF_TORC_2); registerQuestItems(KENDELL_ORDER_1, KENDELL_ORDER_2, KENDELL_ORDER_3, KENDELL_ORDER_4, KENDELL_ORDER_5, KENDELL_ORDER_6, KENDELL_ORDER_7, KENDELL_ORDER_8, KABOO_CHIEF_TORC_1, KABOO_CHIEF_TORC_2);
addStartNpc(30218); // Kendell addStartNpc(30218); // Kendell
addTalkId(30218); addTalkId(30218);
addKillId(KABOO_CHIEF_UOPH, KABOO_CHIEF_KRACHA, KABOO_CHIEF_BATOH, KABOO_CHIEF_TANUKIA, KABOO_CHIEF_TUREL, KABOO_CHIEF_ROKO, KABOO_CHIEF_KAMUT, KABOO_CHIEF_MURTIKA); addKillId(KABOO_CHIEF_UOPH, KABOO_CHIEF_KRACHA, KABOO_CHIEF_BATOH, KABOO_CHIEF_TANUKIA, KABOO_CHIEF_TUREL, KABOO_CHIEF_ROKO, KABOO_CHIEF_KAMUT, KABOO_CHIEF_MURTIKA);
} }
@@ -84,11 +79,10 @@ public class Q105_SkirmishWithTheOrcs extends Quest
if (event.equals("30218-03.htm")) if (event.equals("30218-03.htm"))
{ {
st.setState(State.STARTED); st.startQuest();
st.set("cond", "1");
st.playSound(QuestState.SOUND_ACCEPT);
st.giveItems(Rnd.get(1836, 1839), 1); // Kendell's orders 1 to 4. st.giveItems(Rnd.get(1836, 1839), 1); // Kendell's orders 1 to 4.
} }
return htmltext; return htmltext;
} }
@@ -105,6 +99,7 @@ public class Q105_SkirmishWithTheOrcs extends Quest
switch (st.getState()) switch (st.getState())
{ {
case State.CREATED: case State.CREATED:
{
if (player.getRace() != Race.ELF) if (player.getRace() != Race.ELF)
{ {
htmltext = "30218-00.htm"; htmltext = "30218-00.htm";
@@ -118,9 +113,10 @@ public class Q105_SkirmishWithTheOrcs extends Quest
htmltext = "30218-02.htm"; htmltext = "30218-02.htm";
} }
break; break;
}
case State.STARTED: case State.STARTED:
final int cond = st.getInt("cond"); {
final int cond = st.getCond();
if (cond == 1) if (cond == 1)
{ {
htmltext = "30218-05.htm"; htmltext = "30218-05.htm";
@@ -128,7 +124,7 @@ public class Q105_SkirmishWithTheOrcs extends Quest
else if (cond == 2) else if (cond == 2)
{ {
htmltext = "30218-06.htm"; htmltext = "30218-06.htm";
st.set("cond", "3"); st.setCond(3);
st.playSound(QuestState.SOUND_MIDDLE); st.playSound(QuestState.SOUND_MIDDLE);
st.takeItems(KABOO_CHIEF_TORC_1, 1); st.takeItems(KABOO_CHIEF_TORC_1, 1);
st.takeItems(KENDELL_ORDER_1, 1); st.takeItems(KENDELL_ORDER_1, 1);
@@ -184,11 +180,13 @@ public class Q105_SkirmishWithTheOrcs extends Quest
st.exitQuest(false); st.exitQuest(false);
} }
break; break;
}
case State.COMPLETED: case State.COMPLETED:
{
htmltext = getAlreadyCompletedMsg(); htmltext = getAlreadyCompletedMsg();
break; break;
} }
}
return htmltext; return htmltext;
} }
@@ -207,34 +205,38 @@ public class Q105_SkirmishWithTheOrcs extends Quest
case KABOO_CHIEF_KRACHA: case KABOO_CHIEF_KRACHA:
case KABOO_CHIEF_BATOH: case KABOO_CHIEF_BATOH:
case KABOO_CHIEF_TANUKIA: case KABOO_CHIEF_TANUKIA:
if ((st.getInt("cond") == 1) && st.hasQuestItems(npc.getNpcId() - 25223)) // npcId - 25223 = itemId to verify.
{ {
st.set("cond", "2"); if (st.isCond(1) && st.hasQuestItems(npc.getNpcId() - 25223)) // npcId - 25223 = itemId to verify.
{
st.setCond(2);
st.playSound(QuestState.SOUND_MIDDLE); st.playSound(QuestState.SOUND_MIDDLE);
st.giveItems(KABOO_CHIEF_TORC_1, 1); st.giveItems(KABOO_CHIEF_TORC_1, 1);
} }
break; break;
}
case KABOO_CHIEF_TUREL: case KABOO_CHIEF_TUREL:
case KABOO_CHIEF_ROKO: case KABOO_CHIEF_ROKO:
if ((st.getInt("cond") == 3) && st.hasQuestItems(npc.getNpcId() - 25224)) // npcId - 25224 = itemId to verify.
{ {
st.set("cond", "4"); if (st.isCond(3) && st.hasQuestItems(npc.getNpcId() - 25224)) // npcId - 25224 = itemId to verify.
{
st.setCond(4);
st.playSound(QuestState.SOUND_MIDDLE); st.playSound(QuestState.SOUND_MIDDLE);
st.giveItems(KABOO_CHIEF_TORC_2, 1); st.giveItems(KABOO_CHIEF_TORC_2, 1);
} }
break; break;
}
case KABOO_CHIEF_KAMUT: case KABOO_CHIEF_KAMUT:
case KABOO_CHIEF_MURTIKA: case KABOO_CHIEF_MURTIKA:
if ((st.getInt("cond") == 3) && st.hasQuestItems(npc.getNpcId() - 25225)) // npcId - 25225 = itemId to verify.
{ {
st.set("cond", "4"); if (st.isCond(3) && st.hasQuestItems(npc.getNpcId() - 25225)) // npcId - 25225 = itemId to verify.
{
st.setCond(4);
st.playSound(QuestState.SOUND_MIDDLE); st.playSound(QuestState.SOUND_MIDDLE);
st.giveItems(KABOO_CHIEF_TORC_2, 1); st.giveItems(KABOO_CHIEF_TORC_2, 1);
} }
break; break;
} }
}
return null; return null;
} }

View File

@@ -29,14 +29,12 @@ public class Q106_ForgottenTruth extends Quest
// NPCs // NPCs
private static final int THIFIELL = 30358; private static final int THIFIELL = 30358;
private static final int KARTIA = 30133; private static final int KARTIA = 30133;
// Items // Items
private static final int ONYX_TALISMAN_1 = 984; private static final int ONYX_TALISMAN_1 = 984;
private static final int ONYX_TALISMAN_2 = 985; private static final int ONYX_TALISMAN_2 = 985;
private static final int ANCIENT_SCROLL = 986; private static final int ANCIENT_SCROLL = 986;
private static final int ANCIENT_CLAY_TABLET = 987; private static final int ANCIENT_CLAY_TABLET = 987;
private static final int KARTIA_TRANSLATION = 988; private static final int KARTIA_TRANSLATION = 988;
// Rewards // Rewards
private static final int SPIRITSHOT_NO_GRADE = 2509; private static final int SPIRITSHOT_NO_GRADE = 2509;
private static final int SOULSHOT_NO_GRADE = 1835; private static final int SOULSHOT_NO_GRADE = 1835;
@@ -53,12 +51,9 @@ public class Q106_ForgottenTruth extends Quest
public Q106_ForgottenTruth() public Q106_ForgottenTruth()
{ {
super(106, "Forgotten Truth"); super(106, "Forgotten Truth");
registerQuestItems(ONYX_TALISMAN_1, ONYX_TALISMAN_2, ANCIENT_SCROLL, ANCIENT_CLAY_TABLET, KARTIA_TRANSLATION); registerQuestItems(ONYX_TALISMAN_1, ONYX_TALISMAN_2, ANCIENT_SCROLL, ANCIENT_CLAY_TABLET, KARTIA_TRANSLATION);
addStartNpc(THIFIELL); addStartNpc(THIFIELL);
addTalkId(THIFIELL, KARTIA); addTalkId(THIFIELL, KARTIA);
addKillId(27070); // Tumran Orc Brigand addKillId(27070); // Tumran Orc Brigand
} }
@@ -74,11 +69,10 @@ public class Q106_ForgottenTruth extends Quest
if (event.equals("30358-05.htm")) if (event.equals("30358-05.htm"))
{ {
st.setState(State.STARTED); st.startQuest();
st.set("cond", "1");
st.playSound(QuestState.SOUND_ACCEPT);
st.giveItems(ONYX_TALISMAN_1, 1); st.giveItems(ONYX_TALISMAN_1, 1);
} }
return htmltext; return htmltext;
} }
@@ -95,6 +89,7 @@ public class Q106_ForgottenTruth extends Quest
switch (st.getState()) switch (st.getState())
{ {
case State.CREATED: case State.CREATED:
{
if (player.getRace() != Race.DARK_ELF) if (player.getRace() != Race.DARK_ELF)
{ {
htmltext = "30358-00.htm"; htmltext = "30358-00.htm";
@@ -108,12 +103,14 @@ public class Q106_ForgottenTruth extends Quest
htmltext = "30358-03.htm"; htmltext = "30358-03.htm";
} }
break; break;
}
case State.STARTED: case State.STARTED:
final int cond = st.getInt("cond"); {
final int cond = st.getCond();
switch (npc.getNpcId()) switch (npc.getNpcId())
{ {
case THIFIELL: case THIFIELL:
{
if (cond == 1) if (cond == 1)
{ {
htmltext = "30358-06.htm"; htmltext = "30358-06.htm";
@@ -167,12 +164,13 @@ public class Q106_ForgottenTruth extends Quest
st.exitQuest(false); st.exitQuest(false);
} }
break; break;
}
case KARTIA: case KARTIA:
{
if (cond == 1) if (cond == 1)
{ {
htmltext = "30133-01.htm"; htmltext = "30133-01.htm";
st.set("cond", "2"); st.setCond(2);
st.playSound(QuestState.SOUND_MIDDLE); st.playSound(QuestState.SOUND_MIDDLE);
st.takeItems(ONYX_TALISMAN_1, 1); st.takeItems(ONYX_TALISMAN_1, 1);
st.giveItems(ONYX_TALISMAN_2, 1); st.giveItems(ONYX_TALISMAN_2, 1);
@@ -184,7 +182,7 @@ public class Q106_ForgottenTruth extends Quest
else if (cond == 3) else if (cond == 3)
{ {
htmltext = "30133-03.htm"; htmltext = "30133-03.htm";
st.set("cond", "4"); st.setCond(4);
st.playSound(QuestState.SOUND_MIDDLE); st.playSound(QuestState.SOUND_MIDDLE);
st.takeItems(ONYX_TALISMAN_2, 1); st.takeItems(ONYX_TALISMAN_2, 1);
st.takeItems(ANCIENT_SCROLL, 1); st.takeItems(ANCIENT_SCROLL, 1);
@@ -197,19 +195,22 @@ public class Q106_ForgottenTruth extends Quest
} }
break; break;
} }
}
break; break;
}
case State.COMPLETED: case State.COMPLETED:
{
htmltext = getAlreadyCompletedMsg(); htmltext = getAlreadyCompletedMsg();
break; break;
} }
}
return htmltext; return htmltext;
} }
@Override @Override
public String onKill(NpcInstance npc, PlayerInstance player, boolean isPet) public String onKill(NpcInstance npc, PlayerInstance player, boolean isPet)
{ {
final QuestState st = checkPlayerCondition(player, npc, "cond", "2"); final QuestState st = checkPlayerCondition(player, npc, 2);
if (st == null) if (st == null)
{ {
return null; return null;
@@ -221,7 +222,7 @@ public class Q106_ForgottenTruth extends Quest
} }
else if (st.dropItems(ANCIENT_CLAY_TABLET, 1, 1, 200000)) else if (st.dropItems(ANCIENT_CLAY_TABLET, 1, 1, 200000))
{ {
st.set("cond", "3"); st.setCond(3);
} }
return null; return null;

View File

@@ -29,7 +29,6 @@ public class Q107_MercilessPunishment extends Quest
// NPCs // NPCs
private static final int HATOS = 30568; private static final int HATOS = 30568;
private static final int PARUGON = 30580; private static final int PARUGON = 30580;
// Items // Items
private static final int HATOS_ORDER_1 = 1553; private static final int HATOS_ORDER_1 = 1553;
private static final int HATOS_ORDER_2 = 1554; private static final int HATOS_ORDER_2 = 1554;
@@ -37,7 +36,6 @@ public class Q107_MercilessPunishment extends Quest
private static final int LETTER_TO_HUMAN = 1557; private static final int LETTER_TO_HUMAN = 1557;
private static final int LETTER_TO_DARKELF = 1556; private static final int LETTER_TO_DARKELF = 1556;
private static final int LETTER_TO_ELF = 1558; private static final int LETTER_TO_ELF = 1558;
// Rewards // Rewards
private static final int BUTCHER_SWORD = 1510; private static final int BUTCHER_SWORD = 1510;
private static final int SPIRITSHOT_FOR_BEGINNERS = 5790; private static final int SPIRITSHOT_FOR_BEGINNERS = 5790;
@@ -52,12 +50,9 @@ public class Q107_MercilessPunishment extends Quest
public Q107_MercilessPunishment() public Q107_MercilessPunishment()
{ {
super(107, "Merciless Punishment"); super(107, "Merciless Punishment");
registerQuestItems(HATOS_ORDER_1, HATOS_ORDER_2, HATOS_ORDER_3, LETTER_TO_HUMAN, LETTER_TO_DARKELF, LETTER_TO_ELF); registerQuestItems(HATOS_ORDER_1, HATOS_ORDER_2, HATOS_ORDER_3, LETTER_TO_HUMAN, LETTER_TO_DARKELF, LETTER_TO_ELF);
addStartNpc(HATOS); addStartNpc(HATOS);
addTalkId(HATOS, PARUGON); addTalkId(HATOS, PARUGON);
addKillId(27041); // Baranka's Messenger addKillId(27041); // Baranka's Messenger
} }
@@ -71,31 +66,36 @@ public class Q107_MercilessPunishment extends Quest
return htmltext; return htmltext;
} }
if (event.equals("30568-03.htm")) switch (event)
{ {
st.setState(State.STARTED); case "30568-03.htm":
st.set("cond", "1"); {
st.playSound(QuestState.SOUND_ACCEPT); st.startQuest();
st.giveItems(HATOS_ORDER_1, 1); st.giveItems(HATOS_ORDER_1, 1);
break;
} }
else if (event.equals("30568-06.htm")) case "30568-06.htm":
{ {
st.playSound(QuestState.SOUND_GIVEUP); st.playSound(QuestState.SOUND_GIVEUP);
st.exitQuest(true); st.exitQuest(true);
break;
} }
else if (event.equals("30568-07.htm")) case "30568-07.htm":
{ {
st.set("cond", "4"); st.setCond(4);
st.playSound(QuestState.SOUND_MIDDLE); st.playSound(QuestState.SOUND_MIDDLE);
st.takeItems(HATOS_ORDER_1, 1); st.takeItems(HATOS_ORDER_1, 1);
st.giveItems(HATOS_ORDER_2, 1); st.giveItems(HATOS_ORDER_2, 1);
break;
} }
else if (event.equals("30568-09.htm")) case "30568-09.htm":
{ {
st.set("cond", "6"); st.setCond(6);
st.playSound(QuestState.SOUND_MIDDLE); st.playSound(QuestState.SOUND_MIDDLE);
st.takeItems(HATOS_ORDER_2, 1); st.takeItems(HATOS_ORDER_2, 1);
st.giveItems(HATOS_ORDER_3, 1); st.giveItems(HATOS_ORDER_3, 1);
break;
}
} }
return htmltext; return htmltext;
@@ -114,6 +114,7 @@ public class Q107_MercilessPunishment extends Quest
switch (st.getState()) switch (st.getState())
{ {
case State.CREATED: case State.CREATED:
{
if (player.getRace() != Race.ORC) if (player.getRace() != Race.ORC)
{ {
htmltext = "30568-00.htm"; htmltext = "30568-00.htm";
@@ -127,12 +128,14 @@ public class Q107_MercilessPunishment extends Quest
htmltext = "30568-02.htm"; htmltext = "30568-02.htm";
} }
break; break;
}
case State.STARTED: case State.STARTED:
final int cond = st.getInt("cond"); {
final int cond = st.getCond();
switch (npc.getNpcId()) switch (npc.getNpcId())
{ {
case HATOS: case HATOS:
{
if ((cond == 1) || (cond == 2)) if ((cond == 1) || (cond == 2))
{ {
htmltext = "30568-04.htm"; htmltext = "30568-04.htm";
@@ -185,22 +188,26 @@ public class Q107_MercilessPunishment extends Quest
st.exitQuest(false); st.exitQuest(false);
} }
break; break;
}
case PARUGON: case PARUGON:
{
htmltext = "30580-01.htm"; htmltext = "30580-01.htm";
if (cond == 1) if (cond == 1)
{ {
st.set("cond", "2"); st.setCond(2);
st.playSound(QuestState.SOUND_MIDDLE); st.playSound(QuestState.SOUND_MIDDLE);
} }
break; break;
} }
}
break; break;
}
case State.COMPLETED: case State.COMPLETED:
{
htmltext = getAlreadyCompletedMsg(); htmltext = getAlreadyCompletedMsg();
break; break;
} }
}
return htmltext; return htmltext;
} }
@@ -214,22 +221,22 @@ public class Q107_MercilessPunishment extends Quest
return null; return null;
} }
final int cond = st.getInt("cond"); final int cond = st.getCond();
if (cond == 2) if (cond == 2)
{ {
st.set("cond", "3"); st.setCond(3);
st.playSound(QuestState.SOUND_MIDDLE); st.playSound(QuestState.SOUND_MIDDLE);
st.giveItems(LETTER_TO_HUMAN, 1); st.giveItems(LETTER_TO_HUMAN, 1);
} }
else if (cond == 4) else if (cond == 4)
{ {
st.set("cond", "5"); st.setCond(5);
st.playSound(QuestState.SOUND_MIDDLE); st.playSound(QuestState.SOUND_MIDDLE);
st.giveItems(LETTER_TO_DARKELF, 1); st.giveItems(LETTER_TO_DARKELF, 1);
} }
else if (cond == 6) else if (cond == 6)
{ {
st.set("cond", "7"); st.setCond(7);
st.playSound(QuestState.SOUND_MIDDLE); st.playSound(QuestState.SOUND_MIDDLE);
st.giveItems(LETTER_TO_ELF, 1); st.giveItems(LETTER_TO_ELF, 1);
} }

View File

@@ -35,7 +35,10 @@ public class Q108_JumbleTumbleDiamondFuss extends Quest
private static final int BRUNON = 30526; private static final int BRUNON = 30526;
private static final int MARON = 30529; private static final int MARON = 30529;
private static final int TOROCCO = 30555; private static final int TOROCCO = 30555;
// Monsters
private static final int GOBLIN_BRIGAND_LEADER = 20323;
private static final int GOBLIN_BRIGAND_LIEUTENANT = 20324;
private static final int BLADE_BAT = 20480;
// Items // Items
private static final int GOUPH_CONTRACT = 1559; private static final int GOUPH_CONTRACT = 1559;
private static final int REEP_CONTRACT = 1560; private static final int REEP_CONTRACT = 1560;
@@ -50,12 +53,6 @@ public class Q108_JumbleTumbleDiamondFuss extends Quest
private static final int BERRY_TART = 1569; private static final int BERRY_TART = 1569;
private static final int BAT_DIAGRAM = 1570; private static final int BAT_DIAGRAM = 1570;
private static final int STAR_DIAMOND = 1571; private static final int STAR_DIAMOND = 1571;
// Monsters
private static final int GOBLIN_BRIGAND_LEADER = 20323;
private static final int GOBLIN_BRIGAND_LIEUTENANT = 20324;
private static final int BLADE_BAT = 20480;
// Rewards // Rewards
private static final int SILVERSMITH_HAMMER = 1511; private static final int SILVERSMITH_HAMMER = 1511;
private static final int SPIRITSHOT_FOR_BEGINNERS = 5790; private static final int SPIRITSHOT_FOR_BEGINNERS = 5790;
@@ -66,48 +63,25 @@ public class Q108_JumbleTumbleDiamondFuss extends Quest
private static final int ECHO_FEAST = 4415; private static final int ECHO_FEAST = 4415;
private static final int ECHO_CELEBRATION = 4416; private static final int ECHO_CELEBRATION = 4416;
private static final int LESSER_HEALING_POTION = 1060; private static final int LESSER_HEALING_POTION = 1060;
// @formatter:off
private static final int[][] LEADER_DROPLIST = private static final int[][] LEADER_DROPLIST =
{ {
{ {AQUAMARINE, 1, 10, 800000},
AQUAMARINE, {CHRYSOBERYL, 1, 10, 800000}
1,
10,
800000
},
{
CHRYSOBERYL,
1,
10,
800000
}
}; };
private static final int[][] LIEUTENANT_DROPLIST = private static final int[][] LIEUTENANT_DROPLIST =
{ {
{ {AQUAMARINE, 1, 10, 600000},
AQUAMARINE, {CHRYSOBERYL, 1, 10, 600000}
1,
10,
600000
},
{
CHRYSOBERYL,
1,
10,
600000
}
}; };
// @formatter:on
public Q108_JumbleTumbleDiamondFuss() public Q108_JumbleTumbleDiamondFuss()
{ {
super(108, "Jumble, Tumble, Diamond Fuss"); super(108, "Jumble, Tumble, Diamond Fuss");
registerQuestItems(GOUPH_CONTRACT, REEP_CONTRACT, ELVEN_WINE, BRUNON_DICE, BRUNON_CONTRACT, AQUAMARINE, CHRYSOBERYL, GEM_BOX, COAL_PIECE, BRUNON_LETTER, BERRY_TART, BAT_DIAGRAM, STAR_DIAMOND); registerQuestItems(GOUPH_CONTRACT, REEP_CONTRACT, ELVEN_WINE, BRUNON_DICE, BRUNON_CONTRACT, AQUAMARINE, CHRYSOBERYL, GEM_BOX, COAL_PIECE, BRUNON_LETTER, BERRY_TART, BAT_DIAGRAM, STAR_DIAMOND);
addStartNpc(GOUPH); addStartNpc(GOUPH);
addTalkId(GOUPH, REEP, MURDOC, AIRY, BRUNON, MARON, TOROCCO); addTalkId(GOUPH, REEP, MURDOC, AIRY, BRUNON, MARON, TOROCCO);
addKillId(GOBLIN_BRIGAND_LEADER, GOBLIN_BRIGAND_LIEUTENANT, BLADE_BAT); addKillId(GOBLIN_BRIGAND_LEADER, GOBLIN_BRIGAND_LIEUTENANT, BLADE_BAT);
} }
@@ -121,26 +95,30 @@ public class Q108_JumbleTumbleDiamondFuss extends Quest
return htmltext; return htmltext;
} }
if (event.equals("30523-03.htm")) switch (event)
{ {
st.setState(State.STARTED); case "30523-03.htm":
st.set("cond", "1"); {
st.playSound(QuestState.SOUND_ACCEPT); st.startQuest();
st.giveItems(GOUPH_CONTRACT, 1); st.giveItems(GOUPH_CONTRACT, 1);
break;
} }
else if (event.equals("30555-02.htm")) case "30555-02.htm":
{ {
st.set("cond", "3"); st.setCond(3);
st.playSound(QuestState.SOUND_MIDDLE); st.playSound(QuestState.SOUND_MIDDLE);
st.takeItems(REEP_CONTRACT, 1); st.takeItems(REEP_CONTRACT, 1);
st.giveItems(ELVEN_WINE, 1); st.giveItems(ELVEN_WINE, 1);
break;
} }
else if (event.equals("30526-02.htm")) case "30526-02.htm":
{ {
st.set("cond", "5"); st.setCond(5);
st.playSound(QuestState.SOUND_MIDDLE); st.playSound(QuestState.SOUND_MIDDLE);
st.takeItems(BRUNON_DICE, 1); st.takeItems(BRUNON_DICE, 1);
st.giveItems(BRUNON_CONTRACT, 1); st.giveItems(BRUNON_CONTRACT, 1);
break;
}
} }
return htmltext; return htmltext;
@@ -159,6 +137,7 @@ public class Q108_JumbleTumbleDiamondFuss extends Quest
switch (st.getState()) switch (st.getState())
{ {
case State.CREATED: case State.CREATED:
{
if (player.getRace() != Race.DWARF) if (player.getRace() != Race.DWARF)
{ {
htmltext = "30523-00.htm"; htmltext = "30523-00.htm";
@@ -172,12 +151,14 @@ public class Q108_JumbleTumbleDiamondFuss extends Quest
htmltext = "30523-02.htm"; htmltext = "30523-02.htm";
} }
break; break;
}
case State.STARTED: case State.STARTED:
final int cond = st.getInt("cond"); {
final int cond = st.getCond();
switch (npc.getNpcId()) switch (npc.getNpcId())
{ {
case GOUPH: case GOUPH:
{
if (cond == 1) if (cond == 1)
{ {
htmltext = "30523-04.htm"; htmltext = "30523-04.htm";
@@ -189,7 +170,7 @@ public class Q108_JumbleTumbleDiamondFuss extends Quest
else if (cond == 7) else if (cond == 7)
{ {
htmltext = "30523-06.htm"; htmltext = "30523-06.htm";
st.set("cond", "8"); st.setCond(8);
st.playSound(QuestState.SOUND_MIDDLE); st.playSound(QuestState.SOUND_MIDDLE);
st.takeItems(GEM_BOX, 1); st.takeItems(GEM_BOX, 1);
st.giveItems(COAL_PIECE, 1); st.giveItems(COAL_PIECE, 1);
@@ -230,12 +211,13 @@ public class Q108_JumbleTumbleDiamondFuss extends Quest
st.exitQuest(false); st.exitQuest(false);
} }
break; break;
}
case REEP: case REEP:
{
if (cond == 1) if (cond == 1)
{ {
htmltext = "30516-01.htm"; htmltext = "30516-01.htm";
st.set("cond", "2"); st.setCond(2);
st.playSound(QuestState.SOUND_MIDDLE); st.playSound(QuestState.SOUND_MIDDLE);
st.takeItems(GOUPH_CONTRACT, 1); st.takeItems(GOUPH_CONTRACT, 1);
st.giveItems(REEP_CONTRACT, 1); st.giveItems(REEP_CONTRACT, 1);
@@ -245,8 +227,9 @@ public class Q108_JumbleTumbleDiamondFuss extends Quest
htmltext = "30516-02.htm"; htmltext = "30516-02.htm";
} }
break; break;
}
case TOROCCO: case TOROCCO:
{
if (cond == 2) if (cond == 2)
{ {
htmltext = "30555-01.htm"; htmltext = "30555-01.htm";
@@ -264,12 +247,13 @@ public class Q108_JumbleTumbleDiamondFuss extends Quest
htmltext = "30555-05.htm"; htmltext = "30555-05.htm";
} }
break; break;
}
case MARON: case MARON:
{
if (cond == 3) if (cond == 3)
{ {
htmltext = "30529-01.htm"; htmltext = "30529-01.htm";
st.set("cond", "4"); st.setCond(4);
st.playSound(QuestState.SOUND_MIDDLE); st.playSound(QuestState.SOUND_MIDDLE);
st.takeItems(ELVEN_WINE, 1); st.takeItems(ELVEN_WINE, 1);
st.giveItems(BRUNON_DICE, 1); st.giveItems(BRUNON_DICE, 1);
@@ -283,8 +267,9 @@ public class Q108_JumbleTumbleDiamondFuss extends Quest
htmltext = "30529-03.htm"; htmltext = "30529-03.htm";
} }
break; break;
}
case BRUNON: case BRUNON:
{
if (cond == 4) if (cond == 4)
{ {
htmltext = "30526-01.htm"; htmltext = "30526-01.htm";
@@ -296,7 +281,7 @@ public class Q108_JumbleTumbleDiamondFuss extends Quest
else if (cond == 6) else if (cond == 6)
{ {
htmltext = "30526-04.htm"; htmltext = "30526-04.htm";
st.set("cond", "7"); st.setCond(7);
st.playSound(QuestState.SOUND_MIDDLE); st.playSound(QuestState.SOUND_MIDDLE);
st.takeItems(BRUNON_CONTRACT, 1); st.takeItems(BRUNON_CONTRACT, 1);
st.takeItems(AQUAMARINE, -1); st.takeItems(AQUAMARINE, -1);
@@ -310,7 +295,7 @@ public class Q108_JumbleTumbleDiamondFuss extends Quest
else if (cond == 8) else if (cond == 8)
{ {
htmltext = "30526-06.htm"; htmltext = "30526-06.htm";
st.set("cond", "9"); st.setCond(9);
st.playSound(QuestState.SOUND_MIDDLE); st.playSound(QuestState.SOUND_MIDDLE);
st.takeItems(COAL_PIECE, 1); st.takeItems(COAL_PIECE, 1);
st.giveItems(BRUNON_LETTER, 1); st.giveItems(BRUNON_LETTER, 1);
@@ -324,12 +309,13 @@ public class Q108_JumbleTumbleDiamondFuss extends Quest
htmltext = "30526-08.htm"; htmltext = "30526-08.htm";
} }
break; break;
}
case MURDOC: case MURDOC:
{
if (cond == 9) if (cond == 9)
{ {
htmltext = "30521-01.htm"; htmltext = "30521-01.htm";
st.set("cond", "10"); st.setCond(10);
st.playSound(QuestState.SOUND_MIDDLE); st.playSound(QuestState.SOUND_MIDDLE);
st.takeItems(BRUNON_LETTER, 1); st.takeItems(BRUNON_LETTER, 1);
st.giveItems(BERRY_TART, 1); st.giveItems(BERRY_TART, 1);
@@ -343,12 +329,13 @@ public class Q108_JumbleTumbleDiamondFuss extends Quest
htmltext = "30521-03.htm"; htmltext = "30521-03.htm";
} }
break; break;
}
case AIRY: case AIRY:
{
if (cond == 10) if (cond == 10)
{ {
htmltext = "30522-01.htm"; htmltext = "30522-01.htm";
st.set("cond", "11"); st.setCond(11);
st.playSound(QuestState.SOUND_MIDDLE); st.playSound(QuestState.SOUND_MIDDLE);
st.takeItems(BERRY_TART, 1); st.takeItems(BERRY_TART, 1);
st.giveItems(BAT_DIAGRAM, 1); st.giveItems(BAT_DIAGRAM, 1);
@@ -363,12 +350,15 @@ public class Q108_JumbleTumbleDiamondFuss extends Quest
} }
break; break;
} }
}
break; break;
}
case State.COMPLETED: case State.COMPLETED:
{
htmltext = getAlreadyCompletedMsg(); htmltext = getAlreadyCompletedMsg();
break; break;
} }
}
return htmltext; return htmltext;
} }
@@ -384,27 +374,31 @@ public class Q108_JumbleTumbleDiamondFuss extends Quest
switch (npc.getNpcId()) switch (npc.getNpcId())
{ {
case GOBLIN_BRIGAND_LEADER: case GOBLIN_BRIGAND_LEADER:
if ((st.getInt("cond") == 5) && st.dropMultipleItems(LEADER_DROPLIST))
{ {
st.set("cond", "6"); if (st.isCond(5) && st.dropMultipleItems(LEADER_DROPLIST))
{
st.setCond(6);
} }
break; break;
}
case GOBLIN_BRIGAND_LIEUTENANT: case GOBLIN_BRIGAND_LIEUTENANT:
if ((st.getInt("cond") == 5) && st.dropMultipleItems(LIEUTENANT_DROPLIST))
{ {
st.set("cond", "6"); if (st.isCond(5) && st.dropMultipleItems(LIEUTENANT_DROPLIST))
{
st.setCond(6);
} }
break; break;
}
case BLADE_BAT: case BLADE_BAT:
if ((st.getInt("cond") == 11) && st.dropItems(STAR_DIAMOND, 1, 1, 200000)) {
if (st.isCond(11) && st.dropItems(STAR_DIAMOND, 1, 1, 200000))
{ {
st.takeItems(BAT_DIAGRAM, 1); st.takeItems(BAT_DIAGRAM, 1);
st.set("cond", "12"); st.setCond(12);
} }
break; break;
} }
}
return null; return null;
} }
} }

View File

@@ -24,23 +24,19 @@ import org.l2jmobius.gameserver.model.quest.State;
public class Q151_CureForFeverDisease extends Quest public class Q151_CureForFeverDisease extends Quest
{ {
// NPCs
private static final int ELIAS = 30050;
private static final int YOHANES = 30032;
// Items // Items
private static final int POISON_SAC = 703; private static final int POISON_SAC = 703;
private static final int FEVER_MEDICINE = 704; private static final int FEVER_MEDICINE = 704;
// NPCs
private static final int ELIAS = 30050;
private static final int YOHANES = 30032;
public Q151_CureForFeverDisease() public Q151_CureForFeverDisease()
{ {
super(151, "Cure for Fever Disease"); super(151, "Cure for Fever Disease");
registerQuestItems(FEVER_MEDICINE, POISON_SAC); registerQuestItems(FEVER_MEDICINE, POISON_SAC);
addStartNpc(ELIAS); addStartNpc(ELIAS);
addTalkId(ELIAS, YOHANES); addTalkId(ELIAS, YOHANES);
addKillId(20103, 20106, 20108); addKillId(20103, 20106, 20108);
} }
@@ -56,9 +52,7 @@ public class Q151_CureForFeverDisease extends Quest
if (event.equals("30050-03.htm")) if (event.equals("30050-03.htm"))
{ {
st.setState(State.STARTED); st.startQuest();
st.set("cond", "1");
st.playSound(QuestState.SOUND_ACCEPT);
} }
return htmltext; return htmltext;
@@ -77,14 +71,17 @@ public class Q151_CureForFeverDisease extends Quest
switch (st.getState()) switch (st.getState())
{ {
case State.CREATED: case State.CREATED:
{
htmltext = (player.getLevel() < 15) ? "30050-01.htm" : "30050-02.htm"; htmltext = (player.getLevel() < 15) ? "30050-01.htm" : "30050-02.htm";
break; break;
}
case State.STARTED: case State.STARTED:
final int cond = st.getInt("cond"); {
final int cond = st.getCond();
switch (npc.getNpcId()) switch (npc.getNpcId())
{ {
case ELIAS: case ELIAS:
{
if (cond == 1) if (cond == 1)
{ {
htmltext = "30050-04.htm"; htmltext = "30050-04.htm";
@@ -102,12 +99,13 @@ public class Q151_CureForFeverDisease extends Quest
st.exitQuest(false); st.exitQuest(false);
} }
break; break;
}
case YOHANES: case YOHANES:
{
if (cond == 2) if (cond == 2)
{ {
htmltext = "30032-01.htm"; htmltext = "30032-01.htm";
st.set("cond", "3"); st.setCond(3);
st.playSound(QuestState.SOUND_MIDDLE); st.playSound(QuestState.SOUND_MIDDLE);
st.takeItems(POISON_SAC, 1); st.takeItems(POISON_SAC, 1);
st.giveItems(FEVER_MEDICINE, 1); st.giveItems(FEVER_MEDICINE, 1);
@@ -118,12 +116,15 @@ public class Q151_CureForFeverDisease extends Quest
} }
break; break;
} }
}
break; break;
}
case State.COMPLETED: case State.COMPLETED:
{
htmltext = getAlreadyCompletedMsg(); htmltext = getAlreadyCompletedMsg();
break; break;
} }
}
return htmltext; return htmltext;
} }
@@ -131,7 +132,7 @@ public class Q151_CureForFeverDisease extends Quest
@Override @Override
public String onKill(NpcInstance npc, PlayerInstance player, boolean isPet) public String onKill(NpcInstance npc, PlayerInstance player, boolean isPet)
{ {
final QuestState st = checkPlayerCondition(player, npc, "cond", "1"); final QuestState st = checkPlayerCondition(player, npc, 1);
if (st == null) if (st == null)
{ {
return null; return null;
@@ -139,7 +140,7 @@ public class Q151_CureForFeverDisease extends Quest
if (st.dropItems(POISON_SAC, 1, 1, 200000)) if (st.dropItems(POISON_SAC, 1, 1, 200000))
{ {
st.set("cond", "2"); st.setCond(2);
} }
return null; return null;

View File

@@ -24,31 +24,25 @@ import org.l2jmobius.gameserver.model.quest.State;
public class Q152_ShardsOfGolem extends Quest public class Q152_ShardsOfGolem extends Quest
{ {
// NPCs
private static final int HARRIS = 30035;
private static final int ALTRAN = 30283;
// Monster
private static final int STONE_GOLEM = 20016;
// Items // Items
private static final int HARRIS_RECEIPT_1 = 1008; private static final int HARRIS_RECEIPT_1 = 1008;
private static final int HARRIS_RECEIPT_2 = 1009; private static final int HARRIS_RECEIPT_2 = 1009;
private static final int GOLEM_SHARD = 1010; private static final int GOLEM_SHARD = 1010;
private static final int TOOL_BOX = 1011; private static final int TOOL_BOX = 1011;
// Reward // Reward
private static final int WOODEN_BREASTPLATE = 23; private static final int WOODEN_BREASTPLATE = 23;
// NPCs
private static final int HARRIS = 30035;
private static final int ALTRAN = 30283;
// Mob
private static final int STONE_GOLEM = 20016;
public Q152_ShardsOfGolem() public Q152_ShardsOfGolem()
{ {
super(152, "Shards of Golem"); super(152, "Shards of Golem");
registerQuestItems(HARRIS_RECEIPT_1, HARRIS_RECEIPT_2, GOLEM_SHARD, TOOL_BOX); registerQuestItems(HARRIS_RECEIPT_1, HARRIS_RECEIPT_2, GOLEM_SHARD, TOOL_BOX);
addStartNpc(HARRIS); addStartNpc(HARRIS);
addTalkId(HARRIS, ALTRAN); addTalkId(HARRIS, ALTRAN);
addKillId(STONE_GOLEM); addKillId(STONE_GOLEM);
} }
@@ -64,14 +58,12 @@ public class Q152_ShardsOfGolem extends Quest
if (event.equals("30035-02.htm")) if (event.equals("30035-02.htm"))
{ {
st.setState(State.STARTED); st.startQuest();
st.set("cond", "1");
st.playSound(QuestState.SOUND_ACCEPT);
st.giveItems(HARRIS_RECEIPT_1, 1); st.giveItems(HARRIS_RECEIPT_1, 1);
} }
else if (event.equals("30283-02.htm")) else if (event.equals("30283-02.htm"))
{ {
st.set("cond", "2"); st.setCond(2);
st.playSound(QuestState.SOUND_MIDDLE); st.playSound(QuestState.SOUND_MIDDLE);
st.takeItems(HARRIS_RECEIPT_1, 1); st.takeItems(HARRIS_RECEIPT_1, 1);
st.giveItems(HARRIS_RECEIPT_2, 1); st.giveItems(HARRIS_RECEIPT_2, 1);
@@ -93,14 +85,17 @@ public class Q152_ShardsOfGolem extends Quest
switch (st.getState()) switch (st.getState())
{ {
case State.CREATED: case State.CREATED:
{
htmltext = (player.getLevel() < 10) ? "30035-01a.htm" : "30035-01.htm"; htmltext = (player.getLevel() < 10) ? "30035-01a.htm" : "30035-01.htm";
break; break;
}
case State.STARTED: case State.STARTED:
final int cond = st.getInt("cond"); {
final int cond = st.getCond();
switch (npc.getNpcId()) switch (npc.getNpcId())
{ {
case HARRIS: case HARRIS:
{
if (cond < 4) if (cond < 4)
{ {
htmltext = "30035-03.htm"; htmltext = "30035-03.htm";
@@ -116,8 +111,9 @@ public class Q152_ShardsOfGolem extends Quest
st.exitQuest(false); st.exitQuest(false);
} }
break; break;
}
case ALTRAN: case ALTRAN:
{
if (cond == 1) if (cond == 1)
{ {
htmltext = "30283-01.htm"; htmltext = "30283-01.htm";
@@ -129,7 +125,7 @@ public class Q152_ShardsOfGolem extends Quest
else if (cond == 3) else if (cond == 3)
{ {
htmltext = "30283-04.htm"; htmltext = "30283-04.htm";
st.set("cond", "4"); st.setCond(4);
st.playSound(QuestState.SOUND_MIDDLE); st.playSound(QuestState.SOUND_MIDDLE);
st.takeItems(GOLEM_SHARD, -1); st.takeItems(GOLEM_SHARD, -1);
st.giveItems(TOOL_BOX, 1); st.giveItems(TOOL_BOX, 1);
@@ -140,12 +136,15 @@ public class Q152_ShardsOfGolem extends Quest
} }
break; break;
} }
}
break; break;
}
case State.COMPLETED: case State.COMPLETED:
{
htmltext = getAlreadyCompletedMsg(); htmltext = getAlreadyCompletedMsg();
break; break;
} }
}
return htmltext; return htmltext;
} }
@@ -153,7 +152,7 @@ public class Q152_ShardsOfGolem extends Quest
@Override @Override
public String onKill(NpcInstance npc, PlayerInstance player, boolean isPet) public String onKill(NpcInstance npc, PlayerInstance player, boolean isPet)
{ {
final QuestState st = checkPlayerCondition(player, npc, "cond", "2"); final QuestState st = checkPlayerCondition(player, npc, 2);
if (st == null) if (st == null)
{ {
return null; return null;
@@ -161,7 +160,7 @@ public class Q152_ShardsOfGolem extends Quest
if (st.dropItems(GOLEM_SHARD, 1, 5, 300000)) if (st.dropItems(GOLEM_SHARD, 1, 5, 300000))
{ {
st.set("cond", "3"); st.setCond(3);
} }
return null; return null;

View File

@@ -29,7 +29,6 @@ public class Q153_DeliverGoods extends Quest
private static final int SILVIA = 30003; private static final int SILVIA = 30003;
private static final int ARNOLD = 30041; private static final int ARNOLD = 30041;
private static final int RANT = 30054; private static final int RANT = 30054;
// Items // Items
private static final int DELIVERY_LIST = 1012; private static final int DELIVERY_LIST = 1012;
private static final int HEAVY_WOOD_BOX = 1013; private static final int HEAVY_WOOD_BOX = 1013;
@@ -38,7 +37,6 @@ public class Q153_DeliverGoods extends Quest
private static final int JACKSON_RECEIPT = 1016; private static final int JACKSON_RECEIPT = 1016;
private static final int SILVIA_RECEIPT = 1017; private static final int SILVIA_RECEIPT = 1017;
private static final int RANT_RECEIPT = 1018; private static final int RANT_RECEIPT = 1018;
// Rewards // Rewards
private static final int SOULSHOT_NO_GRADE = 1835; private static final int SOULSHOT_NO_GRADE = 1835;
private static final int RING_OF_KNOWLEDGE = 875; private static final int RING_OF_KNOWLEDGE = 875;
@@ -46,9 +44,7 @@ public class Q153_DeliverGoods extends Quest
public Q153_DeliverGoods() public Q153_DeliverGoods()
{ {
super(153, "Deliver Goods"); super(153, "Deliver Goods");
registerQuestItems(DELIVERY_LIST, HEAVY_WOOD_BOX, CLOTH_BUNDLE, CLAY_POT, JACKSON_RECEIPT, SILVIA_RECEIPT, RANT_RECEIPT); registerQuestItems(DELIVERY_LIST, HEAVY_WOOD_BOX, CLOTH_BUNDLE, CLAY_POT, JACKSON_RECEIPT, SILVIA_RECEIPT, RANT_RECEIPT);
addStartNpc(ARNOLD); addStartNpc(ARNOLD);
addTalkId(JACKSON, SILVIA, ARNOLD, RANT); addTalkId(JACKSON, SILVIA, ARNOLD, RANT);
} }
@@ -65,9 +61,7 @@ public class Q153_DeliverGoods extends Quest
if (event.equals("30041-02.htm")) if (event.equals("30041-02.htm"))
{ {
st.setState(State.STARTED); st.startQuest();
st.set("cond", "1");
st.playSound(QuestState.SOUND_ACCEPT);
st.giveItems(DELIVERY_LIST, 1); st.giveItems(DELIVERY_LIST, 1);
st.giveItems(CLAY_POT, 1); st.giveItems(CLAY_POT, 1);
st.giveItems(CLOTH_BUNDLE, 1); st.giveItems(CLOTH_BUNDLE, 1);
@@ -90,18 +84,21 @@ public class Q153_DeliverGoods extends Quest
switch (st.getState()) switch (st.getState())
{ {
case State.CREATED: case State.CREATED:
{
htmltext = (player.getLevel() < 2) ? "30041-00.htm" : "30041-01.htm"; htmltext = (player.getLevel() < 2) ? "30041-00.htm" : "30041-01.htm";
break; break;
}
case State.STARTED: case State.STARTED:
{
switch (npc.getNpcId()) switch (npc.getNpcId())
{ {
case ARNOLD: case ARNOLD:
if (st.getInt("cond") == 1) {
if (st.isCond(1))
{ {
htmltext = "30041-03.htm"; htmltext = "30041-03.htm";
} }
else if (st.getInt("cond") == 2) else if (st.isCond(2))
{ {
htmltext = "30041-04.htm"; htmltext = "30041-04.htm";
st.takeItems(DELIVERY_LIST, 1); st.takeItems(DELIVERY_LIST, 1);
@@ -115,8 +112,9 @@ public class Q153_DeliverGoods extends Quest
st.exitQuest(false); st.exitQuest(false);
} }
break; break;
}
case JACKSON: case JACKSON:
{
if (st.hasQuestItems(HEAVY_WOOD_BOX)) if (st.hasQuestItems(HEAVY_WOOD_BOX))
{ {
htmltext = "30002-01.htm"; htmltext = "30002-01.htm";
@@ -124,7 +122,7 @@ public class Q153_DeliverGoods extends Quest
st.giveItems(JACKSON_RECEIPT, 1); st.giveItems(JACKSON_RECEIPT, 1);
if (st.hasQuestItems(SILVIA_RECEIPT, RANT_RECEIPT)) if (st.hasQuestItems(SILVIA_RECEIPT, RANT_RECEIPT))
{ {
st.set("cond", "2"); st.setCond(2);
st.playSound(QuestState.SOUND_MIDDLE); st.playSound(QuestState.SOUND_MIDDLE);
} }
else else
@@ -137,8 +135,9 @@ public class Q153_DeliverGoods extends Quest
htmltext = "30002-02.htm"; htmltext = "30002-02.htm";
} }
break; break;
}
case SILVIA: case SILVIA:
{
if (st.hasQuestItems(CLOTH_BUNDLE)) if (st.hasQuestItems(CLOTH_BUNDLE))
{ {
htmltext = "30003-01.htm"; htmltext = "30003-01.htm";
@@ -147,7 +146,7 @@ public class Q153_DeliverGoods extends Quest
st.giveItems(SOULSHOT_NO_GRADE, 3); st.giveItems(SOULSHOT_NO_GRADE, 3);
if (st.hasQuestItems(JACKSON_RECEIPT, RANT_RECEIPT)) if (st.hasQuestItems(JACKSON_RECEIPT, RANT_RECEIPT))
{ {
st.set("cond", "2"); st.setCond(2);
st.playSound(QuestState.SOUND_MIDDLE); st.playSound(QuestState.SOUND_MIDDLE);
} }
else else
@@ -160,8 +159,9 @@ public class Q153_DeliverGoods extends Quest
htmltext = "30003-02.htm"; htmltext = "30003-02.htm";
} }
break; break;
}
case RANT: case RANT:
{
if (st.hasQuestItems(CLAY_POT)) if (st.hasQuestItems(CLAY_POT))
{ {
htmltext = "30054-01.htm"; htmltext = "30054-01.htm";
@@ -169,7 +169,7 @@ public class Q153_DeliverGoods extends Quest
st.giveItems(RANT_RECEIPT, 1); st.giveItems(RANT_RECEIPT, 1);
if (st.hasQuestItems(JACKSON_RECEIPT, SILVIA_RECEIPT)) if (st.hasQuestItems(JACKSON_RECEIPT, SILVIA_RECEIPT))
{ {
st.set("cond", "2"); st.setCond(2);
st.playSound(QuestState.SOUND_MIDDLE); st.playSound(QuestState.SOUND_MIDDLE);
} }
else else
@@ -183,12 +183,15 @@ public class Q153_DeliverGoods extends Quest
} }
break; break;
} }
}
break; break;
}
case State.COMPLETED: case State.COMPLETED:
{
htmltext = getAlreadyCompletedMsg(); htmltext = getAlreadyCompletedMsg();
break; break;
} }
}
return htmltext; return htmltext;
} }

View File

@@ -28,24 +28,19 @@ public class Q154_SacrificeToTheSea extends Quest
private static final int ROCKSWELL = 30312; private static final int ROCKSWELL = 30312;
private static final int CRISTEL = 30051; private static final int CRISTEL = 30051;
private static final int ROLFE = 30055; private static final int ROLFE = 30055;
// Items // Items
private static final int FOX_FUR = 1032; private static final int FOX_FUR = 1032;
private static final int FOX_FUR_YARN = 1033; private static final int FOX_FUR_YARN = 1033;
private static final int MAIDEN_DOLL = 1034; private static final int MAIDEN_DOLL = 1034;
// Reward // Reward
private static final int EARING = 113; private static final int EARING = 113;
public Q154_SacrificeToTheSea() public Q154_SacrificeToTheSea()
{ {
super(154, "Sacrifice to the Sea"); super(154, "Sacrifice to the Sea");
registerQuestItems(FOX_FUR, FOX_FUR_YARN, MAIDEN_DOLL); registerQuestItems(FOX_FUR, FOX_FUR_YARN, MAIDEN_DOLL);
addStartNpc(ROCKSWELL); addStartNpc(ROCKSWELL);
addTalkId(ROCKSWELL, CRISTEL, ROLFE); addTalkId(ROCKSWELL, CRISTEL, ROLFE);
addKillId(20481, 20544, 20545); // Following Keltirs can be found near Talking Island. addKillId(20481, 20544, 20545); // Following Keltirs can be found near Talking Island.
} }
@@ -61,9 +56,7 @@ public class Q154_SacrificeToTheSea extends Quest
if (event.equals("30312-04.htm")) if (event.equals("30312-04.htm"))
{ {
st.setState(State.STARTED); st.startQuest();
st.set("cond", "1");
st.playSound(QuestState.SOUND_ACCEPT);
} }
return htmltext; return htmltext;
@@ -82,14 +75,17 @@ public class Q154_SacrificeToTheSea extends Quest
switch (st.getState()) switch (st.getState())
{ {
case State.CREATED: case State.CREATED:
{
htmltext = (player.getLevel() < 2) ? "30312-02.htm" : "30312-03.htm"; htmltext = (player.getLevel() < 2) ? "30312-02.htm" : "30312-03.htm";
break; break;
}
case State.STARTED: case State.STARTED:
final int cond = st.getInt("cond"); {
final int cond = st.getCond();
switch (npc.getNpcId()) switch (npc.getNpcId())
{ {
case ROCKSWELL: case ROCKSWELL:
{
if (cond == 1) if (cond == 1)
{ {
htmltext = "30312-05.htm"; htmltext = "30312-05.htm";
@@ -112,8 +108,9 @@ public class Q154_SacrificeToTheSea extends Quest
st.exitQuest(false); st.exitQuest(false);
} }
break; break;
}
case CRISTEL: case CRISTEL:
{
if (cond == 1) if (cond == 1)
{ {
htmltext = (st.hasQuestItems(FOX_FUR)) ? "30051-01.htm" : "30051-01a.htm"; htmltext = (st.hasQuestItems(FOX_FUR)) ? "30051-01.htm" : "30051-01a.htm";
@@ -121,7 +118,7 @@ public class Q154_SacrificeToTheSea extends Quest
else if (cond == 2) else if (cond == 2)
{ {
htmltext = "30051-02.htm"; htmltext = "30051-02.htm";
st.set("cond", "3"); st.setCond(3);
st.playSound(QuestState.SOUND_MIDDLE); st.playSound(QuestState.SOUND_MIDDLE);
st.takeItems(FOX_FUR, -1); st.takeItems(FOX_FUR, -1);
st.giveItems(FOX_FUR_YARN, 1); st.giveItems(FOX_FUR_YARN, 1);
@@ -135,8 +132,9 @@ public class Q154_SacrificeToTheSea extends Quest
htmltext = "30051-04.htm"; htmltext = "30051-04.htm";
} }
break; break;
}
case ROLFE: case ROLFE:
{
if (cond < 3) if (cond < 3)
{ {
htmltext = "30055-03.htm"; htmltext = "30055-03.htm";
@@ -144,7 +142,7 @@ public class Q154_SacrificeToTheSea extends Quest
else if (cond == 3) else if (cond == 3)
{ {
htmltext = "30055-01.htm"; htmltext = "30055-01.htm";
st.set("cond", "4"); st.setCond(4);
st.playSound(QuestState.SOUND_MIDDLE); st.playSound(QuestState.SOUND_MIDDLE);
st.takeItems(FOX_FUR_YARN, 1); st.takeItems(FOX_FUR_YARN, 1);
st.giveItems(MAIDEN_DOLL, 1); st.giveItems(MAIDEN_DOLL, 1);
@@ -155,12 +153,15 @@ public class Q154_SacrificeToTheSea extends Quest
} }
break; break;
} }
}
break; break;
}
case State.COMPLETED: case State.COMPLETED:
{
htmltext = getAlreadyCompletedMsg(); htmltext = getAlreadyCompletedMsg();
break; break;
} }
}
return htmltext; return htmltext;
} }
@@ -168,7 +169,7 @@ public class Q154_SacrificeToTheSea extends Quest
@Override @Override
public String onKill(NpcInstance npc, PlayerInstance player, boolean isPet) public String onKill(NpcInstance npc, PlayerInstance player, boolean isPet)
{ {
final QuestState st = checkPlayerCondition(player, npc, "cond", "1"); final QuestState st = checkPlayerCondition(player, npc, 1);
if (st == null) if (st == null)
{ {
return null; return null;
@@ -176,7 +177,7 @@ public class Q154_SacrificeToTheSea extends Quest
if (st.dropItems(FOX_FUR, 1, 10, 400000)) if (st.dropItems(FOX_FUR, 1, 10, 400000))
{ {
st.set("cond", "2"); st.setCond(2);
} }
return null; return null;

Some files were not shown because too many files have changed in this diff Show More