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.setState(State.STARTED);
qs.set("cond", "1");
qs.setCond(1);
target.sendPacket(new QuestList(target));
target.sendPacket(new ExShowQuestMark(qs.getQuest().getId(), qs.getCond()));
val[0] = qs.getQuest().getName();

View File

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

View File

@@ -40,6 +40,12 @@ public class QuestState
{
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 */
private final String _questName;
@@ -49,6 +55,9 @@ public class QuestState
/** The current state of the quest */
private byte _state;
/** The current condition of the quest */
private int _cond = 0;
/** Used for simulating Quest onTalk */
private boolean _simulated = false;
@@ -156,10 +165,12 @@ public class QuestState
{
return;
}
if (_state == state)
{
return;
}
final boolean newQuest = isCreated();
_state = state;
if (saveInDb)
@@ -179,10 +190,10 @@ public class QuestState
/**
* 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
*/
public void setInternal(String var, String value)
public void setInternal(String variable, String value)
{
if (_simulated)
{
@@ -196,20 +207,32 @@ public class QuestState
if (value == null)
{
_vars.put(var, "");
_vars.put(variable, "");
return;
}
_vars.put(var, value);
if (COND_VAR.equals(variable))
{
try
{
_cond = Integer.parseInt(value);
}
catch (Exception ignored)
{
}
}
_vars.put(variable, value);
}
public void set(String var, int value)
public void set(String variable, int value)
{
if (_simulated)
{
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>
* If the key doesn't exist, the couple is added/created in the database</li>
* <ul>
* @param var String indicating the name of the variable for quest
* @param val String indicating the value of the variable for quest
* @param variable String indicating the name 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)
{
@@ -238,23 +261,23 @@ public class QuestState
_vars = new HashMap<>();
}
String value = val;
if (value == null)
String newValue = value;
if (newValue == null)
{
value = "";
newValue = "";
}
final String old = _vars.put(var, value);
final String old = _vars.put(variable, newValue);
if (old != null)
{
Quest.updateQuestVarInDb(this, var, value);
Quest.updateQuestVarInDb(this, variable, newValue);
}
else
{
Quest.createQuestVarInDb(this, var, value);
Quest.createQuestVarInDb(this, variable, newValue);
}
if ("cond".equals(var))
if (COND_VAR.equals(variable))
{
try
{
@@ -263,16 +286,25 @@ public class QuestState
{
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());
}
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.
* @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)
{
@@ -387,54 +419,60 @@ public class QuestState
return;
}
final String old = _vars.remove(var);
final String old = _vars.remove(variable);
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
*/
public String get(String var)
public String get(String variable)
{
if (_vars == 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
*/
public int getInt(String var)
public int getInt(String variable)
{
if (_vars == null)
{
return 0;
}
final String variable = _vars.get(var);
if ((variable == null) || variable.isEmpty())
final String varStr = _vars.get(variable);
if ((varStr == null) || varStr.isEmpty())
{
return 0;
}
int varint = 0;
int varInt = 0;
try
{
varint = Integer.parseInt(variable);
varInt = Integer.parseInt(varStr);
}
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)
{
return getInt("cond") == condition;
return _cond == condition;
}
/**
@@ -463,7 +501,7 @@ public class QuestState
if (isStarted())
{
set("cond", Integer.toString(value));
set(COND_VAR, Integer.toString(value));
}
}
@@ -474,7 +512,21 @@ public class QuestState
{
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)
{
val &= 0x7fffffff;
@@ -524,7 +576,8 @@ public class QuestState
{
return;
}
set("cond", String.valueOf(value));
set(COND_VAR, String.valueOf(value));
if (playQuestMiddle)
{
_player.sendPacket(QuestSound.ITEMSOUND_QUEST_MIDDLE.getPacket());
@@ -537,7 +590,8 @@ public class QuestState
{
return;
}
set("memoState", String.valueOf(value));
set(MEMO_VAR, String.valueOf(value));
}
/**
@@ -547,14 +601,15 @@ public class QuestState
{
if (isStarted())
{
return getInt("memoState");
return getInt(MEMO_VAR);
}
return 0;
}
public boolean isMemoState(int memoState)
{
return getInt("memoState") == memoState;
return getInt(MEMO_VAR) == memoState;
}
/**
@@ -566,8 +621,9 @@ public class QuestState
{
if (isStarted())
{
return getInt("memoStateEx" + slot);
return getInt(MEMO_EX_VAR + slot);
}
return 0;
}
@@ -582,7 +638,8 @@ public class QuestState
{
return;
}
set("memoStateEx" + slot, String.valueOf(value));
set(MEMO_EX_VAR + slot, String.valueOf(value));
}
/**
@@ -613,6 +670,7 @@ public class QuestState
{
return;
}
_isExitQuestOnCleanUp = isExitQuestOnCleanUp;
}
@@ -626,9 +684,10 @@ public class QuestState
{
return;
}
if (isCreated() && !getQuest().isCustomQuest())
{
set("cond", "1");
set(COND_VAR, "1");
setState(State.STARTED);
_player.sendPacket(QuestSound.ITEMSOUND_QUEST_ACCEPT.getPacket());
getQuest().sendNpcLogList(getPlayer());
@@ -686,6 +745,7 @@ public class QuestState
{
return;
}
exitQuest(type);
if (playExitQuest)
{
@@ -776,7 +836,7 @@ public class QuestState
}
reDo.set(Calendar.HOUR_OF_DAY, getQuest().getResetHour());
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()
{
final String val = get("restartTime");
final String val = get(RESTART_VAR);
return (val != null) && (Long.parseLong(val) <= Chronos.currentTimeMillis());
}

View File

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

View File

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

View File

@@ -40,6 +40,12 @@ public class QuestState
{
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 */
private final String _questName;
@@ -49,6 +55,9 @@ public class QuestState
/** The current state of the quest */
private byte _state;
/** The current condition of the quest */
private int _cond = 0;
/** Used for simulating Quest onTalk */
private boolean _simulated = false;
@@ -156,10 +165,12 @@ public class QuestState
{
return;
}
if (_state == state)
{
return;
}
final boolean newQuest = isCreated();
_state = state;
if (saveInDb)
@@ -179,10 +190,10 @@ public class QuestState
/**
* 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
*/
public void setInternal(String var, String value)
public void setInternal(String variable, String value)
{
if (_simulated)
{
@@ -196,20 +207,32 @@ public class QuestState
if (value == null)
{
_vars.put(var, "");
_vars.put(variable, "");
return;
}
_vars.put(var, value);
if (COND_VAR.equals(variable))
{
try
{
_cond = Integer.parseInt(value);
}
catch (Exception ignored)
{
}
}
_vars.put(variable, value);
}
public void set(String var, int value)
public void set(String variable, int value)
{
if (_simulated)
{
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>
* If the key doesn't exist, the couple is added/created in the database</li>
* <ul>
* @param var String indicating the name of the variable for quest
* @param val String indicating the value of the variable for quest
* @param variable String indicating the name 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)
{
@@ -238,23 +261,23 @@ public class QuestState
_vars = new HashMap<>();
}
String value = val;
if (value == null)
String newValue = value;
if (newValue == null)
{
value = "";
newValue = "";
}
final String old = _vars.put(var, value);
final String old = _vars.put(variable, newValue);
if (old != null)
{
Quest.updateQuestVarInDb(this, var, value);
Quest.updateQuestVarInDb(this, variable, newValue);
}
else
{
Quest.createQuestVarInDb(this, var, value);
Quest.createQuestVarInDb(this, variable, newValue);
}
if ("cond".equals(var))
if (COND_VAR.equals(variable))
{
try
{
@@ -263,16 +286,25 @@ public class QuestState
{
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());
}
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.
* @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)
{
@@ -387,54 +419,60 @@ public class QuestState
return;
}
final String old = _vars.remove(var);
final String old = _vars.remove(variable);
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
*/
public String get(String var)
public String get(String variable)
{
if (_vars == 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
*/
public int getInt(String var)
public int getInt(String variable)
{
if (_vars == null)
{
return 0;
}
final String variable = _vars.get(var);
if ((variable == null) || variable.isEmpty())
final String varStr = _vars.get(variable);
if ((varStr == null) || varStr.isEmpty())
{
return 0;
}
int varint = 0;
int varInt = 0;
try
{
varint = Integer.parseInt(variable);
varInt = Integer.parseInt(varStr);
}
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)
{
return getInt("cond") == condition;
return _cond == condition;
}
/**
@@ -463,7 +501,7 @@ public class QuestState
if (isStarted())
{
set("cond", Integer.toString(value));
set(COND_VAR, Integer.toString(value));
}
}
@@ -474,7 +512,21 @@ public class QuestState
{
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)
{
val &= 0x7fffffff;
@@ -524,7 +576,8 @@ public class QuestState
{
return;
}
set("cond", String.valueOf(value));
set(COND_VAR, String.valueOf(value));
if (playQuestMiddle)
{
_player.sendPacket(QuestSound.ITEMSOUND_QUEST_MIDDLE.getPacket());
@@ -537,7 +590,8 @@ public class QuestState
{
return;
}
set("memoState", String.valueOf(value));
set(MEMO_VAR, String.valueOf(value));
}
/**
@@ -547,14 +601,15 @@ public class QuestState
{
if (isStarted())
{
return getInt("memoState");
return getInt(MEMO_VAR);
}
return 0;
}
public boolean isMemoState(int memoState)
{
return getInt("memoState") == memoState;
return getInt(MEMO_VAR) == memoState;
}
/**
@@ -566,8 +621,9 @@ public class QuestState
{
if (isStarted())
{
return getInt("memoStateEx" + slot);
return getInt(MEMO_EX_VAR + slot);
}
return 0;
}
@@ -582,7 +638,8 @@ public class QuestState
{
return;
}
set("memoStateEx" + slot, String.valueOf(value));
set(MEMO_EX_VAR + slot, String.valueOf(value));
}
/**
@@ -613,6 +670,7 @@ public class QuestState
{
return;
}
_isExitQuestOnCleanUp = isExitQuestOnCleanUp;
}
@@ -626,9 +684,10 @@ public class QuestState
{
return;
}
if (isCreated() && !getQuest().isCustomQuest())
{
set("cond", "1");
set(COND_VAR, "1");
setState(State.STARTED);
_player.sendPacket(QuestSound.ITEMSOUND_QUEST_ACCEPT.getPacket());
getQuest().sendNpcLogList(getPlayer());
@@ -686,6 +745,7 @@ public class QuestState
{
return;
}
exitQuest(type);
if (playExitQuest)
{
@@ -776,7 +836,7 @@ public class QuestState
}
reDo.set(Calendar.HOUR_OF_DAY, getQuest().getResetHour());
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()
{
final String val = get("restartTime");
final String val = get(RESTART_VAR);
return (val != null) && (Long.parseLong(val) <= Chronos.currentTimeMillis());
}

View File

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

View File

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

View File

@@ -40,6 +40,12 @@ public class QuestState
{
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 */
private final String _questName;
@@ -49,6 +55,9 @@ public class QuestState
/** The current state of the quest */
private byte _state;
/** The current condition of the quest */
private int _cond = 0;
/** Used for simulating Quest onTalk */
private boolean _simulated = false;
@@ -156,10 +165,12 @@ public class QuestState
{
return;
}
if (_state == state)
{
return;
}
final boolean newQuest = isCreated();
_state = state;
if (saveInDb)
@@ -179,10 +190,10 @@ public class QuestState
/**
* 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
*/
public void setInternal(String var, String value)
public void setInternal(String variable, String value)
{
if (_simulated)
{
@@ -196,20 +207,32 @@ public class QuestState
if (value == null)
{
_vars.put(var, "");
_vars.put(variable, "");
return;
}
_vars.put(var, value);
if (COND_VAR.equals(variable))
{
try
{
_cond = Integer.parseInt(value);
}
catch (Exception ignored)
{
}
}
_vars.put(variable, value);
}
public void set(String var, int value)
public void set(String variable, int value)
{
if (_simulated)
{
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>
* If the key doesn't exist, the couple is added/created in the database</li>
* <ul>
* @param var String indicating the name of the variable for quest
* @param val String indicating the value of the variable for quest
* @param variable String indicating the name 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)
{
@@ -238,23 +261,23 @@ public class QuestState
_vars = new HashMap<>();
}
String value = val;
if (value == null)
String newValue = value;
if (newValue == null)
{
value = "";
newValue = "";
}
final String old = _vars.put(var, value);
final String old = _vars.put(variable, newValue);
if (old != null)
{
Quest.updateQuestVarInDb(this, var, value);
Quest.updateQuestVarInDb(this, variable, newValue);
}
else
{
Quest.createQuestVarInDb(this, var, value);
Quest.createQuestVarInDb(this, variable, newValue);
}
if ("cond".equals(var))
if (COND_VAR.equals(variable))
{
try
{
@@ -263,16 +286,25 @@ public class QuestState
{
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());
}
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.
* @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)
{
@@ -387,54 +419,60 @@ public class QuestState
return;
}
final String old = _vars.remove(var);
final String old = _vars.remove(variable);
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
*/
public String get(String var)
public String get(String variable)
{
if (_vars == 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
*/
public int getInt(String var)
public int getInt(String variable)
{
if (_vars == null)
{
return 0;
}
final String variable = _vars.get(var);
if ((variable == null) || variable.isEmpty())
final String varStr = _vars.get(variable);
if ((varStr == null) || varStr.isEmpty())
{
return 0;
}
int varint = 0;
int varInt = 0;
try
{
varint = Integer.parseInt(variable);
varInt = Integer.parseInt(varStr);
}
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)
{
return getInt("cond") == condition;
return _cond == condition;
}
/**
@@ -463,7 +501,7 @@ public class QuestState
if (isStarted())
{
set("cond", Integer.toString(value));
set(COND_VAR, Integer.toString(value));
}
}
@@ -474,7 +512,21 @@ public class QuestState
{
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)
{
val &= 0x7fffffff;
@@ -524,7 +576,8 @@ public class QuestState
{
return;
}
set("cond", String.valueOf(value));
set(COND_VAR, String.valueOf(value));
if (playQuestMiddle)
{
_player.sendPacket(QuestSound.ITEMSOUND_QUEST_MIDDLE.getPacket());
@@ -537,7 +590,8 @@ public class QuestState
{
return;
}
set("memoState", String.valueOf(value));
set(MEMO_VAR, String.valueOf(value));
}
/**
@@ -547,14 +601,15 @@ public class QuestState
{
if (isStarted())
{
return getInt("memoState");
return getInt(MEMO_VAR);
}
return 0;
}
public boolean isMemoState(int memoState)
{
return getInt("memoState") == memoState;
return getInt(MEMO_VAR) == memoState;
}
/**
@@ -566,8 +621,9 @@ public class QuestState
{
if (isStarted())
{
return getInt("memoStateEx" + slot);
return getInt(MEMO_EX_VAR + slot);
}
return 0;
}
@@ -582,7 +638,8 @@ public class QuestState
{
return;
}
set("memoStateEx" + slot, String.valueOf(value));
set(MEMO_EX_VAR + slot, String.valueOf(value));
}
/**
@@ -613,6 +670,7 @@ public class QuestState
{
return;
}
_isExitQuestOnCleanUp = isExitQuestOnCleanUp;
}
@@ -626,9 +684,10 @@ public class QuestState
{
return;
}
if (isCreated() && !getQuest().isCustomQuest())
{
set("cond", "1");
set(COND_VAR, "1");
setState(State.STARTED);
_player.sendPacket(QuestSound.ITEMSOUND_QUEST_ACCEPT.getPacket());
getQuest().sendNpcLogList(getPlayer());
@@ -686,6 +745,7 @@ public class QuestState
{
return;
}
exitQuest(type);
if (playExitQuest)
{
@@ -776,7 +836,7 @@ public class QuestState
}
reDo.set(Calendar.HOUR_OF_DAY, getQuest().getResetHour());
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()
{
final String val = get("restartTime");
final String val = get(RESTART_VAR);
return (val != null) && (Long.parseLong(val) <= Chronos.currentTimeMillis());
}

View File

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

View File

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

View File

@@ -40,6 +40,12 @@ public class QuestState
{
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 */
private final String _questName;
@@ -49,6 +55,9 @@ public class QuestState
/** The current state of the quest */
private byte _state;
/** The current condition of the quest */
private int _cond = 0;
/** Used for simulating Quest onTalk */
private boolean _simulated = false;
@@ -156,10 +165,12 @@ public class QuestState
{
return;
}
if (_state == state)
{
return;
}
final boolean newQuest = isCreated();
_state = state;
if (saveInDb)
@@ -179,10 +190,10 @@ public class QuestState
/**
* 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
*/
public void setInternal(String var, String value)
public void setInternal(String variable, String value)
{
if (_simulated)
{
@@ -196,20 +207,32 @@ public class QuestState
if (value == null)
{
_vars.put(var, "");
_vars.put(variable, "");
return;
}
_vars.put(var, value);
if (COND_VAR.equals(variable))
{
try
{
_cond = Integer.parseInt(value);
}
catch (Exception ignored)
{
}
}
_vars.put(variable, value);
}
public void set(String var, int value)
public void set(String variable, int value)
{
if (_simulated)
{
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>
* If the key doesn't exist, the couple is added/created in the database</li>
* <ul>
* @param var String indicating the name of the variable for quest
* @param val String indicating the value of the variable for quest
* @param variable String indicating the name 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)
{
@@ -238,23 +261,23 @@ public class QuestState
_vars = new HashMap<>();
}
String value = val;
if (value == null)
String newValue = value;
if (newValue == null)
{
value = "";
newValue = "";
}
final String old = _vars.put(var, value);
final String old = _vars.put(variable, newValue);
if (old != null)
{
Quest.updateQuestVarInDb(this, var, value);
Quest.updateQuestVarInDb(this, variable, newValue);
}
else
{
Quest.createQuestVarInDb(this, var, value);
Quest.createQuestVarInDb(this, variable, newValue);
}
if ("cond".equals(var))
if (COND_VAR.equals(variable))
{
try
{
@@ -263,16 +286,25 @@ public class QuestState
{
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());
}
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.
* @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)
{
@@ -387,54 +419,60 @@ public class QuestState
return;
}
final String old = _vars.remove(var);
final String old = _vars.remove(variable);
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
*/
public String get(String var)
public String get(String variable)
{
if (_vars == 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
*/
public int getInt(String var)
public int getInt(String variable)
{
if (_vars == null)
{
return 0;
}
final String variable = _vars.get(var);
if ((variable == null) || variable.isEmpty())
final String varStr = _vars.get(variable);
if ((varStr == null) || varStr.isEmpty())
{
return 0;
}
int varint = 0;
int varInt = 0;
try
{
varint = Integer.parseInt(variable);
varInt = Integer.parseInt(varStr);
}
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)
{
return getInt("cond") == condition;
return _cond == condition;
}
/**
@@ -463,7 +501,7 @@ public class QuestState
if (isStarted())
{
set("cond", Integer.toString(value));
set(COND_VAR, Integer.toString(value));
}
}
@@ -474,7 +512,21 @@ public class QuestState
{
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)
{
val &= 0x7fffffff;
@@ -524,7 +576,8 @@ public class QuestState
{
return;
}
set("cond", String.valueOf(value));
set(COND_VAR, String.valueOf(value));
if (playQuestMiddle)
{
_player.sendPacket(QuestSound.ITEMSOUND_QUEST_MIDDLE.getPacket());
@@ -537,7 +590,8 @@ public class QuestState
{
return;
}
set("memoState", String.valueOf(value));
set(MEMO_VAR, String.valueOf(value));
}
/**
@@ -547,14 +601,15 @@ public class QuestState
{
if (isStarted())
{
return getInt("memoState");
return getInt(MEMO_VAR);
}
return 0;
}
public boolean isMemoState(int memoState)
{
return getInt("memoState") == memoState;
return getInt(MEMO_VAR) == memoState;
}
/**
@@ -566,8 +621,9 @@ public class QuestState
{
if (isStarted())
{
return getInt("memoStateEx" + slot);
return getInt(MEMO_EX_VAR + slot);
}
return 0;
}
@@ -582,7 +638,8 @@ public class QuestState
{
return;
}
set("memoStateEx" + slot, String.valueOf(value));
set(MEMO_EX_VAR + slot, String.valueOf(value));
}
/**
@@ -613,6 +670,7 @@ public class QuestState
{
return;
}
_isExitQuestOnCleanUp = isExitQuestOnCleanUp;
}
@@ -626,9 +684,10 @@ public class QuestState
{
return;
}
if (isCreated() && !getQuest().isCustomQuest())
{
set("cond", "1");
set(COND_VAR, "1");
setState(State.STARTED);
_player.sendPacket(QuestSound.ITEMSOUND_QUEST_ACCEPT.getPacket());
getQuest().sendNpcLogList(getPlayer());
@@ -686,6 +745,7 @@ public class QuestState
{
return;
}
exitQuest(type);
if (playExitQuest)
{
@@ -776,7 +836,7 @@ public class QuestState
}
reDo.set(Calendar.HOUR_OF_DAY, getQuest().getResetHour());
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()
{
final String val = get("restartTime");
final String val = get(RESTART_VAR);
return (val != null) && (Long.parseLong(val) <= Chronos.currentTimeMillis());
}

View File

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

View File

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

View File

@@ -40,6 +40,12 @@ public class QuestState
{
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 */
private final String _questName;
@@ -49,6 +55,9 @@ public class QuestState
/** The current state of the quest */
private byte _state;
/** The current condition of the quest */
private int _cond = 0;
/** Used for simulating Quest onTalk */
private boolean _simulated = false;
@@ -156,10 +165,12 @@ public class QuestState
{
return;
}
if (_state == state)
{
return;
}
final boolean newQuest = isCreated();
_state = state;
if (saveInDb)
@@ -179,10 +190,10 @@ public class QuestState
/**
* 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
*/
public void setInternal(String var, String value)
public void setInternal(String variable, String value)
{
if (_simulated)
{
@@ -196,20 +207,32 @@ public class QuestState
if (value == null)
{
_vars.put(var, "");
_vars.put(variable, "");
return;
}
_vars.put(var, value);
if (COND_VAR.equals(variable))
{
try
{
_cond = Integer.parseInt(value);
}
catch (Exception ignored)
{
}
}
_vars.put(variable, value);
}
public void set(String var, int value)
public void set(String variable, int value)
{
if (_simulated)
{
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>
* If the key doesn't exist, the couple is added/created in the database</li>
* <ul>
* @param var String indicating the name of the variable for quest
* @param val String indicating the value of the variable for quest
* @param variable String indicating the name 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)
{
@@ -238,23 +261,23 @@ public class QuestState
_vars = new HashMap<>();
}
String value = val;
if (value == null)
String newValue = value;
if (newValue == null)
{
value = "";
newValue = "";
}
final String old = _vars.put(var, value);
final String old = _vars.put(variable, newValue);
if (old != null)
{
Quest.updateQuestVarInDb(this, var, value);
Quest.updateQuestVarInDb(this, variable, newValue);
}
else
{
Quest.createQuestVarInDb(this, var, value);
Quest.createQuestVarInDb(this, variable, newValue);
}
if ("cond".equals(var))
if (COND_VAR.equals(variable))
{
try
{
@@ -263,16 +286,25 @@ public class QuestState
{
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());
}
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.
* @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)
{
@@ -387,54 +419,60 @@ public class QuestState
return;
}
final String old = _vars.remove(var);
final String old = _vars.remove(variable);
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
*/
public String get(String var)
public String get(String variable)
{
if (_vars == 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
*/
public int getInt(String var)
public int getInt(String variable)
{
if (_vars == null)
{
return 0;
}
final String variable = _vars.get(var);
if ((variable == null) || variable.isEmpty())
final String varStr = _vars.get(variable);
if ((varStr == null) || varStr.isEmpty())
{
return 0;
}
int varint = 0;
int varInt = 0;
try
{
varint = Integer.parseInt(variable);
varInt = Integer.parseInt(varStr);
}
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)
{
return getInt("cond") == condition;
return _cond == condition;
}
/**
@@ -463,7 +501,7 @@ public class QuestState
if (isStarted())
{
set("cond", Integer.toString(value));
set(COND_VAR, Integer.toString(value));
}
}
@@ -474,7 +512,21 @@ public class QuestState
{
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)
{
val &= 0x7fffffff;
@@ -524,7 +576,8 @@ public class QuestState
{
return;
}
set("cond", String.valueOf(value));
set(COND_VAR, String.valueOf(value));
if (playQuestMiddle)
{
_player.sendPacket(QuestSound.ITEMSOUND_QUEST_MIDDLE.getPacket());
@@ -537,7 +590,8 @@ public class QuestState
{
return;
}
set("memoState", String.valueOf(value));
set(MEMO_VAR, String.valueOf(value));
}
/**
@@ -547,14 +601,15 @@ public class QuestState
{
if (isStarted())
{
return getInt("memoState");
return getInt(MEMO_VAR);
}
return 0;
}
public boolean isMemoState(int memoState)
{
return getInt("memoState") == memoState;
return getInt(MEMO_VAR) == memoState;
}
/**
@@ -566,8 +621,9 @@ public class QuestState
{
if (isStarted())
{
return getInt("memoStateEx" + slot);
return getInt(MEMO_EX_VAR + slot);
}
return 0;
}
@@ -582,7 +638,8 @@ public class QuestState
{
return;
}
set("memoStateEx" + slot, String.valueOf(value));
set(MEMO_EX_VAR + slot, String.valueOf(value));
}
/**
@@ -613,6 +670,7 @@ public class QuestState
{
return;
}
_isExitQuestOnCleanUp = isExitQuestOnCleanUp;
}
@@ -626,9 +684,10 @@ public class QuestState
{
return;
}
if (isCreated() && !getQuest().isCustomQuest())
{
set("cond", "1");
set(COND_VAR, "1");
setState(State.STARTED);
_player.sendPacket(QuestSound.ITEMSOUND_QUEST_ACCEPT.getPacket());
getQuest().sendNpcLogList(getPlayer());
@@ -686,6 +745,7 @@ public class QuestState
{
return;
}
exitQuest(type);
if (playExitQuest)
{
@@ -776,7 +836,7 @@ public class QuestState
}
reDo.set(Calendar.HOUR_OF_DAY, getQuest().getResetHour());
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()
{
final String val = get("restartTime");
final String val = get(RESTART_VAR);
return (val != null) && (Long.parseLong(val) <= Chronos.currentTimeMillis());
}

View File

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

View File

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

View File

@@ -40,6 +40,12 @@ public class QuestState
{
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 */
private final String _questName;
@@ -49,6 +55,9 @@ public class QuestState
/** The current state of the quest */
private byte _state;
/** The current condition of the quest */
private int _cond = 0;
/** Used for simulating Quest onTalk */
private boolean _simulated = false;
@@ -156,10 +165,12 @@ public class QuestState
{
return;
}
if (_state == state)
{
return;
}
final boolean newQuest = isCreated();
_state = state;
if (saveInDb)
@@ -179,10 +190,10 @@ public class QuestState
/**
* 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
*/
public void setInternal(String var, String value)
public void setInternal(String variable, String value)
{
if (_simulated)
{
@@ -196,20 +207,32 @@ public class QuestState
if (value == null)
{
_vars.put(var, "");
_vars.put(variable, "");
return;
}
_vars.put(var, value);
if (COND_VAR.equals(variable))
{
try
{
_cond = Integer.parseInt(value);
}
catch (Exception ignored)
{
}
}
_vars.put(variable, value);
}
public void set(String var, int value)
public void set(String variable, int value)
{
if (_simulated)
{
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>
* If the key doesn't exist, the couple is added/created in the database</li>
* <ul>
* @param var String indicating the name of the variable for quest
* @param val String indicating the value of the variable for quest
* @param variable String indicating the name 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)
{
@@ -238,23 +261,23 @@ public class QuestState
_vars = new HashMap<>();
}
String value = val;
if (value == null)
String newValue = value;
if (newValue == null)
{
value = "";
newValue = "";
}
final String old = _vars.put(var, value);
final String old = _vars.put(variable, newValue);
if (old != null)
{
Quest.updateQuestVarInDb(this, var, value);
Quest.updateQuestVarInDb(this, variable, newValue);
}
else
{
Quest.createQuestVarInDb(this, var, value);
Quest.createQuestVarInDb(this, variable, newValue);
}
if ("cond".equals(var))
if (COND_VAR.equals(variable))
{
try
{
@@ -263,16 +286,25 @@ public class QuestState
{
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());
}
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.
* @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)
{
@@ -387,54 +419,60 @@ public class QuestState
return;
}
final String old = _vars.remove(var);
final String old = _vars.remove(variable);
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
*/
public String get(String var)
public String get(String variable)
{
if (_vars == 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
*/
public int getInt(String var)
public int getInt(String variable)
{
if (_vars == null)
{
return 0;
}
final String variable = _vars.get(var);
if ((variable == null) || variable.isEmpty())
final String varStr = _vars.get(variable);
if ((varStr == null) || varStr.isEmpty())
{
return 0;
}
int varint = 0;
int varInt = 0;
try
{
varint = Integer.parseInt(variable);
varInt = Integer.parseInt(varStr);
}
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)
{
return getInt("cond") == condition;
return _cond == condition;
}
/**
@@ -463,7 +501,7 @@ public class QuestState
if (isStarted())
{
set("cond", Integer.toString(value));
set(COND_VAR, Integer.toString(value));
}
}
@@ -474,7 +512,21 @@ public class QuestState
{
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)
{
val &= 0x7fffffff;
@@ -524,7 +576,8 @@ public class QuestState
{
return;
}
set("cond", String.valueOf(value));
set(COND_VAR, String.valueOf(value));
if (playQuestMiddle)
{
_player.sendPacket(QuestSound.ITEMSOUND_QUEST_MIDDLE.getPacket());
@@ -537,7 +590,8 @@ public class QuestState
{
return;
}
set("memoState", String.valueOf(value));
set(MEMO_VAR, String.valueOf(value));
}
/**
@@ -547,14 +601,15 @@ public class QuestState
{
if (isStarted())
{
return getInt("memoState");
return getInt(MEMO_VAR);
}
return 0;
}
public boolean isMemoState(int memoState)
{
return getInt("memoState") == memoState;
return getInt(MEMO_VAR) == memoState;
}
/**
@@ -566,8 +621,9 @@ public class QuestState
{
if (isStarted())
{
return getInt("memoStateEx" + slot);
return getInt(MEMO_EX_VAR + slot);
}
return 0;
}
@@ -582,7 +638,8 @@ public class QuestState
{
return;
}
set("memoStateEx" + slot, String.valueOf(value));
set(MEMO_EX_VAR + slot, String.valueOf(value));
}
/**
@@ -613,6 +670,7 @@ public class QuestState
{
return;
}
_isExitQuestOnCleanUp = isExitQuestOnCleanUp;
}
@@ -626,9 +684,10 @@ public class QuestState
{
return;
}
if (isCreated() && !getQuest().isCustomQuest())
{
set("cond", "1");
set(COND_VAR, "1");
setState(State.STARTED);
_player.sendPacket(QuestSound.ITEMSOUND_QUEST_ACCEPT.getPacket());
getQuest().sendNpcLogList(getPlayer());
@@ -686,6 +745,7 @@ public class QuestState
{
return;
}
exitQuest(type);
if (playExitQuest)
{
@@ -776,7 +836,7 @@ public class QuestState
}
reDo.set(Calendar.HOUR_OF_DAY, getQuest().getResetHour());
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()
{
final String val = get("restartTime");
final String val = get(RESTART_VAR);
return (val != null) && (Long.parseLong(val) <= Chronos.currentTimeMillis());
}

View File

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

View File

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

View File

@@ -40,6 +40,12 @@ public class QuestState
{
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 */
private final String _questName;
@@ -49,6 +55,9 @@ public class QuestState
/** The current state of the quest */
private byte _state;
/** The current condition of the quest */
private int _cond = 0;
/** Used for simulating Quest onTalk */
private boolean _simulated = false;
@@ -156,10 +165,12 @@ public class QuestState
{
return;
}
if (_state == state)
{
return;
}
final boolean newQuest = isCreated();
_state = state;
if (saveInDb)
@@ -179,10 +190,10 @@ public class QuestState
/**
* 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
*/
public void setInternal(String var, String value)
public void setInternal(String variable, String value)
{
if (_simulated)
{
@@ -196,20 +207,32 @@ public class QuestState
if (value == null)
{
_vars.put(var, "");
_vars.put(variable, "");
return;
}
_vars.put(var, value);
if (COND_VAR.equals(variable))
{
try
{
_cond = Integer.parseInt(value);
}
catch (Exception ignored)
{
}
}
_vars.put(variable, value);
}
public void set(String var, int value)
public void set(String variable, int value)
{
if (_simulated)
{
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>
* If the key doesn't exist, the couple is added/created in the database</li>
* <ul>
* @param var String indicating the name of the variable for quest
* @param val String indicating the value of the variable for quest
* @param variable String indicating the name 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)
{
@@ -238,23 +261,23 @@ public class QuestState
_vars = new HashMap<>();
}
String value = val;
if (value == null)
String newValue = value;
if (newValue == null)
{
value = "";
newValue = "";
}
final String old = _vars.put(var, value);
final String old = _vars.put(variable, newValue);
if (old != null)
{
Quest.updateQuestVarInDb(this, var, value);
Quest.updateQuestVarInDb(this, variable, newValue);
}
else
{
Quest.createQuestVarInDb(this, var, value);
Quest.createQuestVarInDb(this, variable, newValue);
}
if ("cond".equals(var))
if (COND_VAR.equals(variable))
{
try
{
@@ -263,16 +286,25 @@ public class QuestState
{
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());
}
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.
* @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)
{
@@ -387,54 +419,60 @@ public class QuestState
return;
}
final String old = _vars.remove(var);
final String old = _vars.remove(variable);
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
*/
public String get(String var)
public String get(String variable)
{
if (_vars == 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
*/
public int getInt(String var)
public int getInt(String variable)
{
if (_vars == null)
{
return 0;
}
final String variable = _vars.get(var);
if ((variable == null) || variable.isEmpty())
final String varStr = _vars.get(variable);
if ((varStr == null) || varStr.isEmpty())
{
return 0;
}
int varint = 0;
int varInt = 0;
try
{
varint = Integer.parseInt(variable);
varInt = Integer.parseInt(varStr);
}
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)
{
return getInt("cond") == condition;
return _cond == condition;
}
/**
@@ -463,7 +501,7 @@ public class QuestState
if (isStarted())
{
set("cond", Integer.toString(value));
set(COND_VAR, Integer.toString(value));
}
}
@@ -474,7 +512,21 @@ public class QuestState
{
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)
{
val &= 0x7fffffff;
@@ -524,7 +576,8 @@ public class QuestState
{
return;
}
set("cond", String.valueOf(value));
set(COND_VAR, String.valueOf(value));
if (playQuestMiddle)
{
_player.sendPacket(QuestSound.ITEMSOUND_QUEST_MIDDLE.getPacket());
@@ -537,7 +590,8 @@ public class QuestState
{
return;
}
set("memoState", String.valueOf(value));
set(MEMO_VAR, String.valueOf(value));
}
/**
@@ -547,14 +601,15 @@ public class QuestState
{
if (isStarted())
{
return getInt("memoState");
return getInt(MEMO_VAR);
}
return 0;
}
public boolean isMemoState(int memoState)
{
return getInt("memoState") == memoState;
return getInt(MEMO_VAR) == memoState;
}
/**
@@ -566,8 +621,9 @@ public class QuestState
{
if (isStarted())
{
return getInt("memoStateEx" + slot);
return getInt(MEMO_EX_VAR + slot);
}
return 0;
}
@@ -582,7 +638,8 @@ public class QuestState
{
return;
}
set("memoStateEx" + slot, String.valueOf(value));
set(MEMO_EX_VAR + slot, String.valueOf(value));
}
/**
@@ -613,6 +670,7 @@ public class QuestState
{
return;
}
_isExitQuestOnCleanUp = isExitQuestOnCleanUp;
}
@@ -626,9 +684,10 @@ public class QuestState
{
return;
}
if (isCreated() && !getQuest().isCustomQuest())
{
set("cond", "1");
set(COND_VAR, "1");
setState(State.STARTED);
_player.sendPacket(QuestSound.ITEMSOUND_QUEST_ACCEPT.getPacket());
getQuest().sendNpcLogList(getPlayer());
@@ -686,6 +745,7 @@ public class QuestState
{
return;
}
exitQuest(type);
if (playExitQuest)
{
@@ -776,7 +836,7 @@ public class QuestState
}
reDo.set(Calendar.HOUR_OF_DAY, getQuest().getResetHour());
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()
{
final String val = get("restartTime");
final String val = get(RESTART_VAR);
return (val != null) && (Long.parseLong(val) <= Chronos.currentTimeMillis());
}

View File

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

View File

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

View File

@@ -40,6 +40,12 @@ public class QuestState
{
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 */
private final String _questName;
@@ -49,6 +55,9 @@ public class QuestState
/** The current state of the quest */
private byte _state;
/** The current condition of the quest */
private int _cond = 0;
/** Used for simulating Quest onTalk */
private boolean _simulated = false;
@@ -156,10 +165,12 @@ public class QuestState
{
return;
}
if (_state == state)
{
return;
}
final boolean newQuest = isCreated();
_state = state;
if (saveInDb)
@@ -179,10 +190,10 @@ public class QuestState
/**
* 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
*/
public void setInternal(String var, String value)
public void setInternal(String variable, String value)
{
if (_simulated)
{
@@ -196,20 +207,32 @@ public class QuestState
if (value == null)
{
_vars.put(var, "");
_vars.put(variable, "");
return;
}
_vars.put(var, value);
if (COND_VAR.equals(variable))
{
try
{
_cond = Integer.parseInt(value);
}
catch (Exception ignored)
{
}
}
_vars.put(variable, value);
}
public void set(String var, int value)
public void set(String variable, int value)
{
if (_simulated)
{
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>
* If the key doesn't exist, the couple is added/created in the database</li>
* <ul>
* @param var String indicating the name of the variable for quest
* @param val String indicating the value of the variable for quest
* @param variable String indicating the name 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)
{
@@ -238,23 +261,23 @@ public class QuestState
_vars = new HashMap<>();
}
String value = val;
if (value == null)
String newValue = value;
if (newValue == null)
{
value = "";
newValue = "";
}
final String old = _vars.put(var, value);
final String old = _vars.put(variable, newValue);
if (old != null)
{
Quest.updateQuestVarInDb(this, var, value);
Quest.updateQuestVarInDb(this, variable, newValue);
}
else
{
Quest.createQuestVarInDb(this, var, value);
Quest.createQuestVarInDb(this, variable, newValue);
}
if ("cond".equals(var))
if (COND_VAR.equals(variable))
{
try
{
@@ -263,16 +286,25 @@ public class QuestState
{
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());
}
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.
* @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)
{
@@ -387,54 +419,60 @@ public class QuestState
return;
}
final String old = _vars.remove(var);
final String old = _vars.remove(variable);
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
*/
public String get(String var)
public String get(String variable)
{
if (_vars == 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
*/
public int getInt(String var)
public int getInt(String variable)
{
if (_vars == null)
{
return 0;
}
final String variable = _vars.get(var);
if ((variable == null) || variable.isEmpty())
final String varStr = _vars.get(variable);
if ((varStr == null) || varStr.isEmpty())
{
return 0;
}
int varint = 0;
int varInt = 0;
try
{
varint = Integer.parseInt(variable);
varInt = Integer.parseInt(varStr);
}
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)
{
return getInt("cond") == condition;
return _cond == condition;
}
/**
@@ -463,7 +501,7 @@ public class QuestState
if (isStarted())
{
set("cond", Integer.toString(value));
set(COND_VAR, Integer.toString(value));
}
}
@@ -474,7 +512,21 @@ public class QuestState
{
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)
{
val &= 0x7fffffff;
@@ -524,7 +576,8 @@ public class QuestState
{
return;
}
set("cond", String.valueOf(value));
set(COND_VAR, String.valueOf(value));
if (playQuestMiddle)
{
_player.sendPacket(QuestSound.ITEMSOUND_QUEST_MIDDLE.getPacket());
@@ -537,7 +590,8 @@ public class QuestState
{
return;
}
set("memoState", String.valueOf(value));
set(MEMO_VAR, String.valueOf(value));
}
/**
@@ -547,14 +601,15 @@ public class QuestState
{
if (isStarted())
{
return getInt("memoState");
return getInt(MEMO_VAR);
}
return 0;
}
public boolean isMemoState(int memoState)
{
return getInt("memoState") == memoState;
return getInt(MEMO_VAR) == memoState;
}
/**
@@ -566,8 +621,9 @@ public class QuestState
{
if (isStarted())
{
return getInt("memoStateEx" + slot);
return getInt(MEMO_EX_VAR + slot);
}
return 0;
}
@@ -582,7 +638,8 @@ public class QuestState
{
return;
}
set("memoStateEx" + slot, String.valueOf(value));
set(MEMO_EX_VAR + slot, String.valueOf(value));
}
/**
@@ -613,6 +670,7 @@ public class QuestState
{
return;
}
_isExitQuestOnCleanUp = isExitQuestOnCleanUp;
}
@@ -626,9 +684,10 @@ public class QuestState
{
return;
}
if (isCreated() && !getQuest().isCustomQuest())
{
set("cond", "1");
set(COND_VAR, "1");
setState(State.STARTED);
_player.sendPacket(QuestSound.ITEMSOUND_QUEST_ACCEPT.getPacket());
getQuest().sendNpcLogList(getPlayer());
@@ -686,6 +745,7 @@ public class QuestState
{
return;
}
exitQuest(type);
if (playExitQuest)
{
@@ -776,7 +836,7 @@ public class QuestState
}
reDo.set(Calendar.HOUR_OF_DAY, getQuest().getResetHour());
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()
{
final String val = get("restartTime");
final String val = get(RESTART_VAR);
return (val != null) && (Long.parseLong(val) <= Chronos.currentTimeMillis());
}

View File

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

View File

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

View File

@@ -40,6 +40,12 @@ public class QuestState
{
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 */
private final String _questName;
@@ -49,6 +55,9 @@ public class QuestState
/** The current state of the quest */
private byte _state;
/** The current condition of the quest */
private int _cond = 0;
/** Used for simulating Quest onTalk */
private boolean _simulated = false;
@@ -156,10 +165,12 @@ public class QuestState
{
return;
}
if (_state == state)
{
return;
}
final boolean newQuest = isCreated();
_state = state;
if (saveInDb)
@@ -179,10 +190,10 @@ public class QuestState
/**
* 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
*/
public void setInternal(String var, String value)
public void setInternal(String variable, String value)
{
if (_simulated)
{
@@ -196,20 +207,32 @@ public class QuestState
if (value == null)
{
_vars.put(var, "");
_vars.put(variable, "");
return;
}
_vars.put(var, value);
if (COND_VAR.equals(variable))
{
try
{
_cond = Integer.parseInt(value);
}
catch (Exception ignored)
{
}
}
_vars.put(variable, value);
}
public void set(String var, int value)
public void set(String variable, int value)
{
if (_simulated)
{
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>
* If the key doesn't exist, the couple is added/created in the database</li>
* <ul>
* @param var String indicating the name of the variable for quest
* @param val String indicating the value of the variable for quest
* @param variable String indicating the name 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)
{
@@ -238,23 +261,23 @@ public class QuestState
_vars = new HashMap<>();
}
String value = val;
if (value == null)
String newValue = value;
if (newValue == null)
{
value = "";
newValue = "";
}
final String old = _vars.put(var, value);
final String old = _vars.put(variable, newValue);
if (old != null)
{
Quest.updateQuestVarInDb(this, var, value);
Quest.updateQuestVarInDb(this, variable, newValue);
}
else
{
Quest.createQuestVarInDb(this, var, value);
Quest.createQuestVarInDb(this, variable, newValue);
}
if ("cond".equals(var))
if (COND_VAR.equals(variable))
{
try
{
@@ -263,16 +286,25 @@ public class QuestState
{
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());
}
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.
* @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)
{
@@ -387,54 +419,60 @@ public class QuestState
return;
}
final String old = _vars.remove(var);
final String old = _vars.remove(variable);
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
*/
public String get(String var)
public String get(String variable)
{
if (_vars == 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
*/
public int getInt(String var)
public int getInt(String variable)
{
if (_vars == null)
{
return 0;
}
final String variable = _vars.get(var);
if ((variable == null) || variable.isEmpty())
final String varStr = _vars.get(variable);
if ((varStr == null) || varStr.isEmpty())
{
return 0;
}
int varint = 0;
int varInt = 0;
try
{
varint = Integer.parseInt(variable);
varInt = Integer.parseInt(varStr);
}
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)
{
return getInt("cond") == condition;
return _cond == condition;
}
/**
@@ -463,7 +501,7 @@ public class QuestState
if (isStarted())
{
set("cond", Integer.toString(value));
set(COND_VAR, Integer.toString(value));
}
}
@@ -474,7 +512,21 @@ public class QuestState
{
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)
{
val &= 0x7fffffff;
@@ -524,7 +576,8 @@ public class QuestState
{
return;
}
set("cond", String.valueOf(value));
set(COND_VAR, String.valueOf(value));
if (playQuestMiddle)
{
_player.sendPacket(QuestSound.ITEMSOUND_QUEST_MIDDLE.getPacket());
@@ -537,7 +590,8 @@ public class QuestState
{
return;
}
set("memoState", String.valueOf(value));
set(MEMO_VAR, String.valueOf(value));
}
/**
@@ -547,14 +601,15 @@ public class QuestState
{
if (isStarted())
{
return getInt("memoState");
return getInt(MEMO_VAR);
}
return 0;
}
public boolean isMemoState(int memoState)
{
return getInt("memoState") == memoState;
return getInt(MEMO_VAR) == memoState;
}
/**
@@ -566,8 +621,9 @@ public class QuestState
{
if (isStarted())
{
return getInt("memoStateEx" + slot);
return getInt(MEMO_EX_VAR + slot);
}
return 0;
}
@@ -582,7 +638,8 @@ public class QuestState
{
return;
}
set("memoStateEx" + slot, String.valueOf(value));
set(MEMO_EX_VAR + slot, String.valueOf(value));
}
/**
@@ -613,6 +670,7 @@ public class QuestState
{
return;
}
_isExitQuestOnCleanUp = isExitQuestOnCleanUp;
}
@@ -626,9 +684,10 @@ public class QuestState
{
return;
}
if (isCreated() && !getQuest().isCustomQuest())
{
set("cond", "1");
set(COND_VAR, "1");
setState(State.STARTED);
_player.sendPacket(QuestSound.ITEMSOUND_QUEST_ACCEPT.getPacket());
getQuest().sendNpcLogList(getPlayer());
@@ -686,6 +745,7 @@ public class QuestState
{
return;
}
exitQuest(type);
if (playExitQuest)
{
@@ -776,7 +836,7 @@ public class QuestState
}
reDo.set(Calendar.HOUR_OF_DAY, getQuest().getResetHour());
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()
{
final String val = get("restartTime");
final String val = get(RESTART_VAR);
return (val != null) && (Long.parseLong(val) <= Chronos.currentTimeMillis());
}

View File

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

View File

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

View File

@@ -40,6 +40,12 @@ public class QuestState
{
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 */
private final String _questName;
@@ -49,6 +55,9 @@ public class QuestState
/** The current state of the quest */
private byte _state;
/** The current condition of the quest */
private int _cond = 0;
/** Used for simulating Quest onTalk */
private boolean _simulated = false;
@@ -156,10 +165,12 @@ public class QuestState
{
return;
}
if (_state == state)
{
return;
}
final boolean newQuest = isCreated();
_state = state;
if (saveInDb)
@@ -179,10 +190,10 @@ public class QuestState
/**
* 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
*/
public void setInternal(String var, String value)
public void setInternal(String variable, String value)
{
if (_simulated)
{
@@ -196,20 +207,32 @@ public class QuestState
if (value == null)
{
_vars.put(var, "");
_vars.put(variable, "");
return;
}
_vars.put(var, value);
if (COND_VAR.equals(variable))
{
try
{
_cond = Integer.parseInt(value);
}
catch (Exception ignored)
{
}
}
_vars.put(variable, value);
}
public void set(String var, int value)
public void set(String variable, int value)
{
if (_simulated)
{
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>
* If the key doesn't exist, the couple is added/created in the database</li>
* <ul>
* @param var String indicating the name of the variable for quest
* @param val String indicating the value of the variable for quest
* @param variable String indicating the name 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)
{
@@ -238,23 +261,23 @@ public class QuestState
_vars = new HashMap<>();
}
String value = val;
if (value == null)
String newValue = value;
if (newValue == null)
{
value = "";
newValue = "";
}
final String old = _vars.put(var, value);
final String old = _vars.put(variable, newValue);
if (old != null)
{
Quest.updateQuestVarInDb(this, var, value);
Quest.updateQuestVarInDb(this, variable, newValue);
}
else
{
Quest.createQuestVarInDb(this, var, value);
Quest.createQuestVarInDb(this, variable, newValue);
}
if ("cond".equals(var))
if (COND_VAR.equals(variable))
{
try
{
@@ -263,16 +286,25 @@ public class QuestState
{
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());
}
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.
* @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)
{
@@ -387,54 +419,60 @@ public class QuestState
return;
}
final String old = _vars.remove(var);
final String old = _vars.remove(variable);
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
*/
public String get(String var)
public String get(String variable)
{
if (_vars == 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
*/
public int getInt(String var)
public int getInt(String variable)
{
if (_vars == null)
{
return 0;
}
final String variable = _vars.get(var);
if ((variable == null) || variable.isEmpty())
final String varStr = _vars.get(variable);
if ((varStr == null) || varStr.isEmpty())
{
return 0;
}
int varint = 0;
int varInt = 0;
try
{
varint = Integer.parseInt(variable);
varInt = Integer.parseInt(varStr);
}
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)
{
return getInt("cond") == condition;
return _cond == condition;
}
/**
@@ -463,7 +501,7 @@ public class QuestState
if (isStarted())
{
set("cond", Integer.toString(value));
set(COND_VAR, Integer.toString(value));
}
}
@@ -474,7 +512,21 @@ public class QuestState
{
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)
{
val &= 0x7fffffff;
@@ -524,7 +576,8 @@ public class QuestState
{
return;
}
set("cond", String.valueOf(value));
set(COND_VAR, String.valueOf(value));
if (playQuestMiddle)
{
_player.sendPacket(QuestSound.ITEMSOUND_QUEST_MIDDLE.getPacket());
@@ -537,7 +590,8 @@ public class QuestState
{
return;
}
set("memoState", String.valueOf(value));
set(MEMO_VAR, String.valueOf(value));
}
/**
@@ -547,14 +601,15 @@ public class QuestState
{
if (isStarted())
{
return getInt("memoState");
return getInt(MEMO_VAR);
}
return 0;
}
public boolean isMemoState(int memoState)
{
return getInt("memoState") == memoState;
return getInt(MEMO_VAR) == memoState;
}
/**
@@ -566,8 +621,9 @@ public class QuestState
{
if (isStarted())
{
return getInt("memoStateEx" + slot);
return getInt(MEMO_EX_VAR + slot);
}
return 0;
}
@@ -582,7 +638,8 @@ public class QuestState
{
return;
}
set("memoStateEx" + slot, String.valueOf(value));
set(MEMO_EX_VAR + slot, String.valueOf(value));
}
/**
@@ -613,6 +670,7 @@ public class QuestState
{
return;
}
_isExitQuestOnCleanUp = isExitQuestOnCleanUp;
}
@@ -626,9 +684,10 @@ public class QuestState
{
return;
}
if (isCreated() && !getQuest().isCustomQuest())
{
set("cond", "1");
set(COND_VAR, "1");
setState(State.STARTED);
_player.sendPacket(QuestSound.ITEMSOUND_QUEST_ACCEPT.getPacket());
getQuest().sendNpcLogList(getPlayer());
@@ -686,6 +745,7 @@ public class QuestState
{
return;
}
exitQuest(type);
if (playExitQuest)
{
@@ -776,7 +836,7 @@ public class QuestState
}
reDo.set(Calendar.HOUR_OF_DAY, getQuest().getResetHour());
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()
{
final String val = get("restartTime");
final String val = get(RESTART_VAR);
return (val != null) && (Long.parseLong(val) <= Chronos.currentTimeMillis());
}

View File

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

View File

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

View File

@@ -40,6 +40,12 @@ public class QuestState
{
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 */
private final String _questName;
@@ -49,6 +55,9 @@ public class QuestState
/** The current state of the quest */
private byte _state;
/** The current condition of the quest */
private int _cond = 0;
/** Used for simulating Quest onTalk */
private boolean _simulated = false;
@@ -156,10 +165,12 @@ public class QuestState
{
return;
}
if (_state == state)
{
return;
}
final boolean newQuest = isCreated();
_state = state;
if (saveInDb)
@@ -179,10 +190,10 @@ public class QuestState
/**
* 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
*/
public void setInternal(String var, String value)
public void setInternal(String variable, String value)
{
if (_simulated)
{
@@ -196,20 +207,32 @@ public class QuestState
if (value == null)
{
_vars.put(var, "");
_vars.put(variable, "");
return;
}
_vars.put(var, value);
if (COND_VAR.equals(variable))
{
try
{
_cond = Integer.parseInt(value);
}
catch (Exception ignored)
{
}
}
_vars.put(variable, value);
}
public void set(String var, int value)
public void set(String variable, int value)
{
if (_simulated)
{
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>
* If the key doesn't exist, the couple is added/created in the database</li>
* <ul>
* @param var String indicating the name of the variable for quest
* @param val String indicating the value of the variable for quest
* @param variable String indicating the name 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)
{
@@ -238,23 +261,23 @@ public class QuestState
_vars = new HashMap<>();
}
String value = val;
if (value == null)
String newValue = value;
if (newValue == null)
{
value = "";
newValue = "";
}
final String old = _vars.put(var, value);
final String old = _vars.put(variable, newValue);
if (old != null)
{
Quest.updateQuestVarInDb(this, var, value);
Quest.updateQuestVarInDb(this, variable, newValue);
}
else
{
Quest.createQuestVarInDb(this, var, value);
Quest.createQuestVarInDb(this, variable, newValue);
}
if ("cond".equals(var))
if (COND_VAR.equals(variable))
{
try
{
@@ -263,16 +286,25 @@ public class QuestState
{
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());
}
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.
* @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)
{
@@ -387,54 +419,60 @@ public class QuestState
return;
}
final String old = _vars.remove(var);
final String old = _vars.remove(variable);
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
*/
public String get(String var)
public String get(String variable)
{
if (_vars == 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
*/
public int getInt(String var)
public int getInt(String variable)
{
if (_vars == null)
{
return 0;
}
final String variable = _vars.get(var);
if ((variable == null) || variable.isEmpty())
final String varStr = _vars.get(variable);
if ((varStr == null) || varStr.isEmpty())
{
return 0;
}
int varint = 0;
int varInt = 0;
try
{
varint = Integer.parseInt(variable);
varInt = Integer.parseInt(varStr);
}
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)
{
return getInt("cond") == condition;
return _cond == condition;
}
/**
@@ -463,7 +501,7 @@ public class QuestState
if (isStarted())
{
set("cond", Integer.toString(value));
set(COND_VAR, Integer.toString(value));
}
}
@@ -474,7 +512,21 @@ public class QuestState
{
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)
{
val &= 0x7fffffff;
@@ -524,7 +576,8 @@ public class QuestState
{
return;
}
set("cond", String.valueOf(value));
set(COND_VAR, String.valueOf(value));
if (playQuestMiddle)
{
_player.sendPacket(QuestSound.ITEMSOUND_QUEST_MIDDLE.getPacket());
@@ -537,7 +590,8 @@ public class QuestState
{
return;
}
set("memoState", String.valueOf(value));
set(MEMO_VAR, String.valueOf(value));
}
/**
@@ -547,14 +601,15 @@ public class QuestState
{
if (isStarted())
{
return getInt("memoState");
return getInt(MEMO_VAR);
}
return 0;
}
public boolean isMemoState(int memoState)
{
return getInt("memoState") == memoState;
return getInt(MEMO_VAR) == memoState;
}
/**
@@ -566,8 +621,9 @@ public class QuestState
{
if (isStarted())
{
return getInt("memoStateEx" + slot);
return getInt(MEMO_EX_VAR + slot);
}
return 0;
}
@@ -582,7 +638,8 @@ public class QuestState
{
return;
}
set("memoStateEx" + slot, String.valueOf(value));
set(MEMO_EX_VAR + slot, String.valueOf(value));
}
/**
@@ -613,6 +670,7 @@ public class QuestState
{
return;
}
_isExitQuestOnCleanUp = isExitQuestOnCleanUp;
}
@@ -626,9 +684,10 @@ public class QuestState
{
return;
}
if (isCreated() && !getQuest().isCustomQuest())
{
set("cond", "1");
set(COND_VAR, "1");
setState(State.STARTED);
_player.sendPacket(QuestSound.ITEMSOUND_QUEST_ACCEPT.getPacket());
getQuest().sendNpcLogList(getPlayer());
@@ -686,6 +745,7 @@ public class QuestState
{
return;
}
exitQuest(type);
if (playExitQuest)
{
@@ -776,7 +836,7 @@ public class QuestState
}
reDo.set(Calendar.HOUR_OF_DAY, getQuest().getResetHour());
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()
{
final String val = get("restartTime");
final String val = get(RESTART_VAR);
return (val != null) && (Long.parseLong(val) <= Chronos.currentTimeMillis());
}

View File

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

View File

@@ -174,7 +174,7 @@ public class FeedableBeasts extends Quest
// TODO: no grendels?
GrowthCapableMob temp;
//@formatter:off
// @formatter:off
final int[][] Kookabura_0_Gold = {{ 21452, 21453, 21454, 21455 }};
final int[][] Kookabura_0_Crystal = {{ 21456, 21457, 21458, 21459 }};
final int[][] Kookabura_1_Gold_1= {{ 21460, 21462 }};
@@ -199,7 +199,7 @@ public class FeedableBeasts extends Quest
final int[][] Cougar_1_Crystal_2 = {{ 21503,21505 }};
final int[][] Cougar_2_1 = {{ 21506, 21828 }, { 16015,16016 }};
final int[][] Cougar_2_2 = {{ 21507, 21829 }, { 16015,16016 }};
//@formatter:on
// @formatter:on
// Alpen Kookabura
temp = new GrowthCapableMob(0, 100);
@@ -412,7 +412,7 @@ public class FeedableBeasts extends Quest
if ((st != null) && (Rnd.get(100) < 5) && !st.hasQuestItems(7185))
{
st.giveItems(7185, 1);
st.set("cond", "2");
st.setCond(2);
}
// 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;
// Orc
private static final int VOUCHER_OF_FLAME = 1496;
// Items Reward
private static final int SOULSHOT_NOVICE = 5789;
private static final int SPIRITSHOT_NOVICE = 5790;
private static final int BLUE_GEM = 6353;
private static final Map<String, Event> _events = new HashMap<>();
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("30573_02", new Event("30573-03.htm", -45067, -113549, -235, VOUCHER_OF_FLAME, 0x31, SOULSHOT_NOVICE, 200, 0x2c, SOULSHOT_NOVICE, 200));
}
// @formatter:off
private static final Map<Integer, Talk> _talks = new HashMap<>();
static
@@ -89,11 +86,8 @@ public class NewbieHelper extends Quest
public NewbieHelper()
{
super(-1, "ai/others");
addStartNpc(30009, 30019, 30131, 30400, 30530, 30575);
addTalkId(30009, 30019, 30131, 30400, 30530, 30575, 30008, 30017, 30129, 30370, 30528, 30573);
addFirstTalkId(new int[]
{
30009, // Newbie Helper - Human
@@ -116,7 +110,6 @@ public class NewbieHelper extends Quest
30528, // Foreman - Dwarf
30573 // Flame Guardian - Orc
});
addKillId(18342);
}
@@ -248,12 +241,12 @@ public class NewbieHelper extends Quest
{
String htmltext = "";
QuestState qs1 = player.getQuestState(getName());
final QuestState qs2 = player.getQuestState(Tutorial.class.getSimpleName());
if (qs1 == null)
{
qs1 = newQuestState(player);
}
final QuestState qs2 = player.getQuestState(Tutorial.class.getSimpleName());
if ((qs2 == null) || Config.DISABLE_TUTORIAL)
{
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 JUMARA = 31375; // Trader
private static final int KURFA = 31376; // Gate Keeper
private static final int HORN = 7186;
private static final int[] KETRAS =
{
21324,
@@ -77,44 +75,19 @@ public class KetraOrcSupport extends Quest
21348,
21349
};
private static final int[][] BUFF =
{
{
4359,
2
}, // Focus: Requires 2 Buffalo Horns
{
4360,
2
}, // Death Whisper: Requires 2 Buffalo Horns
{
4345,
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
// @formatter:off
{4359, 2}, // Focus: Requires 2 Buffalo Horns
{4360, 2}, // Death Whisper: Requires 2 Buffalo Horns
{4345, 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
// @formatter:on
};
private static final Skill VARKA_KETRA_PETRIFICATION = SkillTable.getInstance().getSkill(4578, 1);
/**
@@ -185,11 +158,15 @@ public class KetraOrcSupport extends Quest
switch (player.getAllianceWithVarkaKetra())
{
case 4:
{
htmltext = "31376-4.htm";
break;
}
case 5:
{
htmltext = "31376-5.htm";
break;
}
}
}
@@ -211,6 +188,7 @@ public class KetraOrcSupport extends Quest
switch (npc.getNpcId())
{
case KADUN:
{
if (allianceLevel > 0)
{
htmltext = "31370-friend.htm";
@@ -220,8 +198,9 @@ public class KetraOrcSupport extends Quest
htmltext = "31370-no.htm";
}
break;
}
case WAHKAN:
{
if (allianceLevel > 0)
{
htmltext = "31371-friend.htm";
@@ -231,8 +210,9 @@ public class KetraOrcSupport extends Quest
htmltext = "31371-no.htm";
}
break;
}
case ASEFA:
{
st.setState(State.STARTED);
if (allianceLevel < 1)
{
@@ -254,8 +234,9 @@ public class KetraOrcSupport extends Quest
}
}
break;
}
case ATAN:
{
if (player.getKarma() >= 1)
{
htmltext = "31373-pk.htm";
@@ -273,18 +254,24 @@ public class KetraOrcSupport extends Quest
htmltext = "31373-2.htm";
}
break;
}
case JAFF:
{
switch (allianceLevel)
{
case 1:
{
htmltext = "31374-1.htm";
break;
}
case 2:
case 3:
{
htmltext = "31374-2.htm";
break;
}
default:
{
if (allianceLevel <= 0)
{
htmltext = "31374-no.htm";
@@ -298,29 +285,40 @@ public class KetraOrcSupport extends Quest
htmltext = "31374-4.htm";
}
break;
}
}
break;
}
case JUMARA:
{
switch (allianceLevel)
{
case 2:
{
htmltext = "31375-1.htm";
break;
}
case 3:
case 4:
{
htmltext = "31375-2.htm";
break;
}
case 5:
{
htmltext = "31375-3.htm";
break;
}
default:
{
htmltext = "31375-no.htm";
break;
}
}
break;
}
case KURFA:
{
if (allianceLevel <= 0)
{
htmltext = "31376-no.htm";
@@ -338,6 +336,7 @@ public class KetraOrcSupport extends Quest
htmltext = "31376-3.htm";
}
break;
}
}
return htmltext;
@@ -376,6 +375,7 @@ public class KetraOrcSupport extends Quest
case HEAL_STATIC:
case BALANCE_LIFE:
case HOT:
{
for (WorldObject target : skill.getTargetList(caster))
{
// Character isn't existing, or is current caster, we drop check.
@@ -419,6 +419,7 @@ public class KetraOrcSupport extends Quest
}
}
break;
}
}
}

View File

@@ -49,9 +49,7 @@ public class VarkaSilenosSupport extends Quest
private static final int HAGOS = 31381; // Warehouse Keeper
private static final int SHIKON = 31382; // Trader
private static final int TERANU = 31383; // Teleporter
private static final int SEED = 7187;
private static final int[] VARKAS =
{
21350,
@@ -76,44 +74,19 @@ public class VarkaSilenosSupport extends Quest
21374,
21375
};
private static final int[][] BUFF =
{
{
4359,
2
}, // Focus: Requires 2 Nepenthese Seeds
{
4360,
2
}, // Death Whisper: Requires 2 Nepenthese Seeds
{
4345,
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
// @formatter:off
{4359, 2}, // Focus: Requires 2 Nepenthese Seeds
{4360, 2}, // Death Whisper: Requires 2 Nepenthese Seeds
{4345, 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
// @formatter:on
};
private static final Skill VARKA_KETRA_PETRIFICATION = SkillTable.getInstance().getSkill(4578, 1);
/**
@@ -184,11 +157,15 @@ public class VarkaSilenosSupport extends Quest
switch (player.getAllianceWithVarkaKetra())
{
case -4:
{
htmltext = "31383-4.htm";
break;
}
case -5:
{
htmltext = "31383-5.htm";
break;
}
}
}
@@ -210,6 +187,7 @@ public class VarkaSilenosSupport extends Quest
switch (npc.getNpcId())
{
case ASHAS:
{
if (allianceLevel < 0)
{
htmltext = "31377-friend.htm";
@@ -219,8 +197,9 @@ public class VarkaSilenosSupport extends Quest
htmltext = "31377-no.htm";
}
break;
}
case NARAN:
{
if (allianceLevel < 0)
{
htmltext = "31378-friend.htm";
@@ -230,8 +209,9 @@ public class VarkaSilenosSupport extends Quest
htmltext = "31378-no.htm";
}
break;
}
case UDAN:
{
st.setState(State.STARTED);
if (allianceLevel > -1)
{
@@ -253,8 +233,9 @@ public class VarkaSilenosSupport extends Quest
}
}
break;
}
case DIYABU:
{
if (player.getKarma() >= 1)
{
htmltext = "31380-pk.htm";
@@ -272,18 +253,24 @@ public class VarkaSilenosSupport extends Quest
htmltext = "31380-2.htm";
}
break;
}
case HAGOS:
{
switch (allianceLevel)
{
case -1:
{
htmltext = "31381-1.htm";
break;
}
case -2:
case -3:
{
htmltext = "31381-2.htm";
break;
}
default:
{
if (allianceLevel >= 0)
{
htmltext = "31381-no.htm";
@@ -297,29 +284,40 @@ public class VarkaSilenosSupport extends Quest
htmltext = "31381-4.htm";
}
break;
}
}
break;
}
case SHIKON:
{
switch (allianceLevel)
{
case -2:
{
htmltext = "31382-1.htm";
break;
}
case -3:
case -4:
{
htmltext = "31382-2.htm";
break;
}
case -5:
{
htmltext = "31382-3.htm";
break;
}
default:
{
htmltext = "31382-no.htm";
break;
}
}
break;
}
case TERANU:
{
if (allianceLevel >= 0)
{
htmltext = "31383-no.htm";
@@ -337,6 +335,7 @@ public class VarkaSilenosSupport extends Quest
htmltext = "31383-3.htm";
}
break;
}
}
return htmltext;
@@ -375,6 +374,7 @@ public class VarkaSilenosSupport extends Quest
case HEAL_STATIC:
case BALANCE_LIFE:
case HOT:
{
for (WorldObject target : skill.getTargetList(caster))
{
// Character isn't existing, or is current caster, we drop check.
@@ -418,6 +418,7 @@ public class VarkaSilenosSupport extends Quest
}
}
break;
}
}
}

View File

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

View File

@@ -30,23 +30,19 @@ public class Q002_WhatWomenWant extends Quest
private static final int MIRABEL = 30146;
private static final int HERBIEL = 30150;
private static final int GREENIS = 30157;
// Items
private static final int ARUJIEN_LETTER_1 = 1092;
private static final int ARUJIEN_LETTER_2 = 1093;
private static final int ARUJIEN_LETTER_3 = 1094;
private static final int POETRY_BOOK = 689;
private static final int GREENIS_LETTER = 693;
// Rewards
private static final int MYSTICS_EARRING = 113;
public Q002_WhatWomenWant()
{
super(2, "What Women Want");
registerQuestItems(ARUJIEN_LETTER_1, ARUJIEN_LETTER_2, ARUJIEN_LETTER_3, POETRY_BOOK, GREENIS_LETTER);
addStartNpc(ARUJIEN);
addTalkId(ARUJIEN, MIRABEL, HERBIEL, GREENIS);
}
@@ -61,26 +57,30 @@ public class Q002_WhatWomenWant extends Quest
return htmltext;
}
if (event.equals("30223-04.htm"))
switch (event)
{
st.setState(State.STARTED);
st.set("cond", "1");
st.playSound(QuestState.SOUND_ACCEPT);
st.giveItems(ARUJIEN_LETTER_1, 1);
}
else if (event.equals("30223-08.htm"))
{
st.set("cond", "4");
st.playSound(QuestState.SOUND_MIDDLE);
st.takeItems(ARUJIEN_LETTER_3, 1);
st.giveItems(POETRY_BOOK, 1);
}
else if (event.equals("30223-09.htm"))
{
st.takeItems(ARUJIEN_LETTER_3, 1);
st.rewardItems(57, 450);
st.playSound(QuestState.SOUND_FINISH);
st.exitQuest(false);
case "30223-04.htm":
{
st.startQuest();
st.giveItems(ARUJIEN_LETTER_1, 1);
break;
}
case "30223-08.htm":
{
st.setCond(4);
st.playSound(QuestState.SOUND_MIDDLE);
st.takeItems(ARUJIEN_LETTER_3, 1);
st.giveItems(POETRY_BOOK, 1);
break;
}
case "30223-09.htm":
{
st.takeItems(ARUJIEN_LETTER_3, 1);
st.rewardItems(57, 450);
st.playSound(QuestState.SOUND_FINISH);
st.exitQuest(false);
break;
}
}
return htmltext;
@@ -99,6 +99,7 @@ public class Q002_WhatWomenWant extends Quest
switch (st.getState())
{
case State.CREATED:
{
if ((player.getRace() != Race.ELF) && (player.getRace() != Race.HUMAN))
{
htmltext = "30223-00.htm";
@@ -112,12 +113,14 @@ public class Q002_WhatWomenWant extends Quest
htmltext = "30223-02.htm";
}
break;
}
case State.STARTED:
final int cond = st.getInt("cond");
{
final int cond = st.getCond();
switch (npc.getNpcId())
{
case ARUJIEN:
{
if (st.hasQuestItems(ARUJIEN_LETTER_1))
{
htmltext = "30223-05.htm";
@@ -143,12 +146,13 @@ public class Q002_WhatWomenWant extends Quest
st.exitQuest(false);
}
break;
}
case MIRABEL:
{
if (cond == 1)
{
htmltext = "30146-01.htm";
st.set("cond", "2");
st.setCond(2);
st.playSound(QuestState.SOUND_MIDDLE);
st.takeItems(ARUJIEN_LETTER_1, 1);
st.giveItems(ARUJIEN_LETTER_2, 1);
@@ -158,12 +162,13 @@ public class Q002_WhatWomenWant extends Quest
htmltext = "30146-02.htm";
}
break;
}
case HERBIEL:
{
if (cond == 2)
{
htmltext = "30150-01.htm";
st.set("cond", "3");
st.setCond(3);
st.playSound(QuestState.SOUND_MIDDLE);
st.takeItems(ARUJIEN_LETTER_2, 1);
st.giveItems(ARUJIEN_LETTER_3, 1);
@@ -173,8 +178,9 @@ public class Q002_WhatWomenWant extends Quest
htmltext = "30150-02.htm";
}
break;
}
case GREENIS:
{
if (cond < 4)
{
htmltext = "30157-01.htm";
@@ -182,7 +188,7 @@ public class Q002_WhatWomenWant extends Quest
else if (cond == 4)
{
htmltext = "30157-02.htm";
st.set("cond", "5");
st.setCond(5);
st.playSound(QuestState.SOUND_MIDDLE);
st.takeItems(POETRY_BOOK, 1);
st.giveItems(GREENIS_LETTER, 1);
@@ -192,12 +198,15 @@ public class Q002_WhatWomenWant extends Quest
htmltext = "30157-03.htm";
}
break;
}
}
break;
}
case State.COMPLETED:
{
htmltext = getAlreadyCompletedMsg();
break;
}
}
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 TAINT_STONE = 1082;
private static final int SUCCUBUS_BLOOD = 1083;
// Reward
private static final int SCROLL_ENCHANT_ARMOR_D = 956;
public Q003_WillTheSealBeBroken()
{
super(3, "Will the Seal be Broken?");
registerQuestItems(ONYX_BEAST_EYE, TAINT_STONE, SUCCUBUS_BLOOD);
addStartNpc(30141); // Talloth
addTalkId(30141);
addKillId(20031, 20041, 20046, 20048, 20052, 20057);
}
@@ -57,9 +53,7 @@ public class Q003_WillTheSealBeBroken extends Quest
if (event.equals("30141-03.htm"))
{
st.setState(State.STARTED);
st.set("cond", "1");
st.playSound(QuestState.SOUND_ACCEPT);
st.startQuest();
}
return htmltext;
@@ -78,6 +72,7 @@ public class Q003_WillTheSealBeBroken extends Quest
switch (st.getState())
{
case State.CREATED:
{
if (player.getRace() != Race.DARK_ELF)
{
htmltext = "30141-00.htm";
@@ -91,9 +86,10 @@ public class Q003_WillTheSealBeBroken extends Quest
htmltext = "30141-02.htm";
}
break;
}
case State.STARTED:
final int cond = st.getInt("cond");
{
final int cond = st.getCond();
if (cond == 1)
{
htmltext = "30141-04.htm";
@@ -109,10 +105,12 @@ public class Q003_WillTheSealBeBroken extends Quest
st.exitQuest(false);
}
break;
}
case State.COMPLETED:
{
htmltext = getAlreadyCompletedMsg();
break;
}
}
return htmltext;
@@ -121,7 +119,7 @@ public class Q003_WillTheSealBeBroken extends Quest
@Override
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)
{
return null;
@@ -130,28 +128,32 @@ public class Q003_WillTheSealBeBroken extends Quest
switch (npc.getNpcId())
{
case 20031:
{
if (st.dropItemsAlways(ONYX_BEAST_EYE, 1, 1) && st.hasQuestItems(TAINT_STONE, SUCCUBUS_BLOOD))
{
st.set("cond", "2");
st.setCond(2);
}
break;
}
case 20041:
case 20046:
{
if (st.dropItemsAlways(TAINT_STONE, 1, 1) && st.hasQuestItems(ONYX_BEAST_EYE, SUCCUBUS_BLOOD))
{
st.set("cond", "2");
st.setCond(2);
}
break;
}
case 20048:
case 20052:
case 20057:
{
if (st.dropItemsAlways(SUCCUBUS_BLOOD, 1, 1) && st.hasQuestItems(ONYX_BEAST_EYE, TAINT_STONE))
{
st.set("cond", "2");
st.setCond(2);
}
break;
}
}
return null;

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@@ -36,7 +36,6 @@ public class Q021_HiddenTruth extends Quest
private static final int DOMINIC = 31350;
private static final int BENEDICT = 31349;
private static final int INNOCENTIN = 31328;
// Items
private static final int CROSS_OF_EINHASAD = 7140;
private static final int CROSS_OF_EINHASAD_NEXT_QUEST = 7141;
@@ -54,9 +53,7 @@ public class Q021_HiddenTruth extends Quest
public Q021_HiddenTruth()
{
super(21, "Hidden Truth");
registerQuestItems(CROSS_OF_EINHASAD);
addStartNpc(MYSTERIOUS_WIZARD);
addTalkId(MYSTERIOUS_WIZARD, TOMBSTONE, VON_HELLMAN_DUKE, VON_HELLMAN_PAGE, BROKEN_BOOKSHELF, AGRIPEL, DOMINIC, BENEDICT, INNOCENTIN);
}
@@ -71,87 +68,94 @@ public class Q021_HiddenTruth extends Quest
return htmltext;
}
if (event.equals("31522-02.htm"))
switch (event)
{
st.setState(State.STARTED);
st.set("cond", "1");
st.playSound(QuestState.SOUND_ACCEPT);
}
else if (event.equals("31523-03.htm"))
{
st.set("cond", "2");
st.playSound(QuestState.SOUND_MIDDLE);
spawnTheDuke(player);
}
else if (event.equals("31524-06.htm"))
{
st.set("cond", "3");
st.playSound(QuestState.SOUND_MIDDLE);
spawnThePage(player);
}
else if (event.equals("31526-08.htm"))
{
st.set("cond", "5");
st.playSound(QuestState.SOUND_MIDDLE);
}
else if (event.equals("31526-14.htm"))
{
st.set("cond", "6");
st.playSound(QuestState.SOUND_MIDDLE);
st.giveItems(CROSS_OF_EINHASAD, 1);
}
else if (event.equals("1"))
{
_page.getAI().setIntention(CtrlIntention.AI_INTENTION_MOVE_TO, PAGE_LOCS[0]);
_page.broadcastNpcSay("Follow me...");
startQuestTimer("2", 5000, _page, player, false);
return null;
}
else if (event.equals("2"))
{
_page.getAI().setIntention(CtrlIntention.AI_INTENTION_MOVE_TO, PAGE_LOCS[1]);
startQuestTimer("3", 12000, _page, player, false);
return null;
}
else if (event.equals("3"))
{
_page.getAI().setIntention(CtrlIntention.AI_INTENTION_MOVE_TO, PAGE_LOCS[2]);
startQuestTimer("4", 18000, _page, player, false);
return null;
}
else if (event.equals("4"))
{
st.set("end_walk", "1");
_page.broadcastNpcSay("Please check this bookcase, " + player.getName() + ".");
startQuestTimer("5", 47000, _page, player, false);
return null;
}
else if (event.equals("5"))
{
_page.broadcastNpcSay("I'm confused! Maybe it's time to go back.");
return null;
}
else if (event.equals("31328-05.htm"))
{
if (st.hasQuestItems(CROSS_OF_EINHASAD))
case "31522-02.htm":
{
st.takeItems(CROSS_OF_EINHASAD, 1);
st.giveItems(CROSS_OF_EINHASAD_NEXT_QUEST, 1);
st.playSound(QuestState.SOUND_FINISH);
st.exitQuest(false);
st.startQuest();
break;
}
case "31523-03.htm":
{
st.setCond(2);
st.playSound(QuestState.SOUND_MIDDLE);
spawnTheDuke(player);
break;
}
case "31524-06.htm":
{
st.setCond(3);
st.playSound(QuestState.SOUND_MIDDLE);
spawnThePage(player);
break;
}
case "31526-08.htm":
{
st.setCond(5);
st.playSound(QuestState.SOUND_MIDDLE);
break;
}
case "31526-14.htm":
{
st.setCond(6);
st.playSound(QuestState.SOUND_MIDDLE);
st.giveItems(CROSS_OF_EINHASAD, 1);
break;
}
case "1":
{
_page.getAI().setIntention(CtrlIntention.AI_INTENTION_MOVE_TO, PAGE_LOCS[0]);
_page.broadcastNpcSay("Follow me...");
startQuestTimer("2", 5000, _page, player, false);
return null;
}
case "2":
{
_page.getAI().setIntention(CtrlIntention.AI_INTENTION_MOVE_TO, PAGE_LOCS[1]);
startQuestTimer("3", 12000, _page, player, false);
return null;
}
case "3":
{
_page.getAI().setIntention(CtrlIntention.AI_INTENTION_MOVE_TO, PAGE_LOCS[2]);
startQuestTimer("4", 18000, _page, player, false);
return null;
}
case "4":
{
st.set("end_walk", "1");
_page.broadcastNpcSay("Please check this bookcase, " + player.getName() + ".");
startQuestTimer("5", 47000, _page, player, false);
return null;
}
case "5":
{
_page.broadcastNpcSay("I'm confused! Maybe it's time to go back.");
return null;
}
case "31328-05.htm":
{
if (st.hasQuestItems(CROSS_OF_EINHASAD))
{
st.takeItems(CROSS_OF_EINHASAD, 1);
st.giveItems(CROSS_OF_EINHASAD_NEXT_QUEST, 1);
st.playSound(QuestState.SOUND_FINISH);
st.exitQuest(false);
}
break;
}
case "dukeDespawn":
{
_duke.deleteMe();
_duke = null;
return null;
}
case "pageDespawn":
{
_page.deleteMe();
_page = null;
return null;
}
}
else if (event.equals("dukeDespawn"))
{
_duke.deleteMe();
_duke = null;
return null;
}
else if (event.equals("pageDespawn"))
{
_page.deleteMe();
_page = null;
return null;
}
return htmltext;
@@ -170,18 +174,22 @@ public class Q021_HiddenTruth extends Quest
switch (st.getState())
{
case State.CREATED:
{
htmltext = (player.getLevel() < 63) ? "31522-03.htm" : "31522-01.htm";
break;
}
case State.STARTED:
final int cond = st.getInt("cond");
{
final int cond = st.getCond();
switch (npc.getNpcId())
{
case MYSTERIOUS_WIZARD:
{
htmltext = "31522-05.htm";
break;
}
case TOMBSTONE:
{
if (cond == 1)
{
htmltext = "31523-01.htm";
@@ -196,8 +204,9 @@ public class Q021_HiddenTruth extends Quest
htmltext = "31523-04.htm";
}
break;
}
case VON_HELLMAN_DUKE:
{
if (cond == 2)
{
htmltext = "31524-01.htm";
@@ -212,14 +221,15 @@ public class Q021_HiddenTruth extends Quest
htmltext = "31524-07a.htm";
}
break;
}
case VON_HELLMAN_PAGE:
{
if (cond == 3)
{
if (st.getInt("end_walk") == 1)
{
htmltext = "31525-02.htm";
st.set("cond", "4");
st.setCond(4);
st.playSound(QuestState.SOUND_MIDDLE);
}
else
@@ -232,12 +242,13 @@ public class Q021_HiddenTruth extends Quest
htmltext = "31525-02.htm";
}
break;
}
case BROKEN_BOOKSHELF:
{
if (((cond == 3) && (st.getInt("end_walk") == 1)) || (cond == 4))
{
htmltext = "31526-01.htm";
st.set("cond", "5");
st.setCond(5);
st.playSound(QuestState.SOUND_MIDDLE);
if (_page != null)
@@ -264,10 +275,11 @@ public class Q021_HiddenTruth extends Quest
htmltext = "31526-15.htm";
}
break;
}
case AGRIPEL:
case BENEDICT:
case DOMINIC:
{
if (((cond == 6) || (cond == 7)) && st.hasQuestItems(CROSS_OF_EINHASAD))
{
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))
{
st.set("cond", "7");
st.setCond(7);
st.playSound(QuestState.SOUND_MIDDLE);
}
else
@@ -307,17 +319,20 @@ public class Q021_HiddenTruth extends Quest
htmltext = npcId + "-01.htm";
}
break;
}
case INNOCENTIN:
{
if ((cond == 7) && st.hasQuestItems(CROSS_OF_EINHASAD))
{
htmltext = "31328-01.htm";
}
break;
}
}
break;
}
case State.COMPLETED:
{
if (npc.getNpcId() == INNOCENTIN)
{
htmltext = "31328-06.htm";
@@ -327,6 +342,7 @@ public class Q021_HiddenTruth extends Quest
htmltext = getAlreadyCompletedMsg();
}
break;
}
}
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.QuestState;
import org.l2jmobius.gameserver.model.quest.QuestTimer;
import org.l2jmobius.gameserver.model.quest.State;
import org.l2jmobius.gameserver.util.Util;
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 GHOST_OF_PRIEST = 31528;
private static final int GHOST_OF_ADVENTURER = 31529;
// Mobs
// Monsters
private static final int[] MOBS =
{
21553, // Trampled Man
@@ -66,7 +65,6 @@ public class Q022_TragedyInVonHellmannForest extends Quest
public Q022_TragedyInVonHellmannForest()
{
super(22, "Tragedy in von Hellmann Forest");
addKillId(MOBS);
addKillId(SOUL_OF_WELL);
addAttackId(SOUL_OF_WELL);
@@ -135,9 +133,7 @@ public class Q022_TragedyInVonHellmannForest extends Quest
{
if (qs.isCreated())
{
qs.setState(State.STARTED);
qs.set("cond", "1");
qs.playSound(QuestState.SOUND_ACCEPT);
qs.startQuest();
htmltext = event;
}
break;
@@ -146,21 +142,21 @@ public class Q022_TragedyInVonHellmannForest extends Quest
{
if (!qs.hasQuestItems(CROSS_OF_EINHASAD))
{
qs.set("cond", "2");
qs.setCond(2);
htmltext = event;
}
else
{
htmltext = "31334-06.htm";
qs.set("cond", "3");
qs.setCond(3);
}
break;
}
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);
htmltext = event;
}
@@ -168,7 +164,7 @@ public class Q022_TragedyInVonHellmannForest extends Quest
}
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 (_tifarenOwner == 0)
@@ -181,14 +177,14 @@ public class Q022_TragedyInVonHellmannForest extends Quest
if (((cond == 5) || (cond == 6)) && qs.hasQuestItems(LOST_SKULL_OF_ELF))
{
qs.takeItems(LOST_SKULL_OF_ELF, -1);
qs.set("cond", "7");
qs.setCond(7);
qs.playSound(QuestState.SOUND_MIDDLE);
}
htmltext = event;
}
else
{
qs.set("cond", "6");
qs.setCond(6);
htmltext = "31334-14.htm";
}
}
@@ -211,7 +207,7 @@ public class Q022_TragedyInVonHellmannForest extends Quest
qt.cancel();
npc.setScriptValue(0);
startQuestTimer("DESPAWN_GHOST2", 1000 * 3, npc, player);
qs.set("cond", "8");
qs.setCond(8);
qs.playSound(QuestState.SOUND_MIDDLE);
htmltext = event;
}
@@ -229,7 +225,7 @@ public class Q022_TragedyInVonHellmannForest extends Quest
}
case "31328-03.htm":
{
if (qs.getInt("cond") == 8)
if (qs.isCond(8))
{
qs.takeItems(CROSS_OF_EINHASAD, -1);
@@ -239,10 +235,10 @@ public class Q022_TragedyInVonHellmannForest extends Quest
}
case "31328-09.htm":
{
if (qs.getInt("cond") == 8)
if (qs.isCond(8))
{
qs.giveItems(LETTER_OF_INNOCENTIN, 1);
qs.set("cond", "9");
qs.setCond(9);
qs.playSound(QuestState.SOUND_MIDDLE);
htmltext = event;
}
@@ -250,10 +246,10 @@ public class Q022_TragedyInVonHellmannForest extends Quest
}
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.set("cond", "15");
qs.setCond(15);
qs.playSound(QuestState.SOUND_MIDDLE);
htmltext = event;
}
@@ -261,9 +257,9 @@ public class Q022_TragedyInVonHellmannForest extends Quest
}
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);
htmltext = event;
}
@@ -271,7 +267,7 @@ public class Q022_TragedyInVonHellmannForest extends Quest
}
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);
startQuestTimer("activateSoulOfWell", 90000, _soulWellNpc, player);
@@ -304,7 +300,7 @@ public class Q022_TragedyInVonHellmannForest extends Quest
}
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");
htmltext = event;
@@ -325,7 +321,7 @@ public class Q022_TragedyInVonHellmannForest extends Quest
if (qs.getInt("memoState") == 9)
{
qs.giveItems(JEWEL_OF_ADVENTURER_1, 1);
qs.set("cond", "10");
qs.setCond(10);
qs.playSound(QuestState.SOUND_MIDDLE);
qs.set("memoState", "10");
htmltext = event;
@@ -345,7 +341,7 @@ public class Q022_TragedyInVonHellmannForest extends Quest
{
case TIFAREN:
{
switch (qs.getInt("cond"))
switch (qs.getCond())
{
case 0:
{
@@ -401,7 +397,7 @@ public class Q022_TragedyInVonHellmannForest extends Quest
else
{
htmltext = "31334-16.htm";
qs.set("cond", "6");
qs.setCond(6);
}
}
break;
@@ -431,14 +427,14 @@ public class Q022_TragedyInVonHellmannForest extends Quest
}
case INNOCENTIN:
{
switch (qs.getInt("cond"))
switch (qs.getCond())
{
case 2:
{
if (!qs.hasQuestItems(CROSS_OF_EINHASAD))
{
qs.giveItems(CROSS_OF_EINHASAD, 1);
qs.set("cond", "3");
qs.setCond(3);
htmltext = "31328-01.htm";
}
break;
@@ -500,7 +496,7 @@ public class Q022_TragedyInVonHellmannForest extends Quest
}
case WELL:
{
switch (qs.getInt("cond"))
switch (qs.getCond())
{
case 10:
{
@@ -516,7 +512,7 @@ public class Q022_TragedyInVonHellmannForest extends Quest
if (qs.hasQuestItems(JEWEL_OF_ADVENTURER_2) && !qs.hasQuestItems(SEALED_REPORT_BOX))
{
qs.giveItems(SEALED_REPORT_BOX, 1);
qs.set("cond", "13");
qs.setCond(13);
htmltext = "31527-04.htm";
}
break;
@@ -534,7 +530,7 @@ public class Q022_TragedyInVonHellmannForest extends Quest
}
case GHOST_OF_ADVENTURER:
{
switch (qs.getInt("cond"))
switch (qs.getCond())
{
case 9:
{
@@ -586,7 +582,7 @@ public class Q022_TragedyInVonHellmannForest extends Quest
if (qs.hasQuestItems(JEWEL_OF_ADVENTURER_2) && !qs.hasQuestItems(SEALED_REPORT_BOX))
{
htmltext = "31529-15.htm";
qs.set("cond", "12");
qs.setCond(12);
}
break;
}
@@ -597,7 +593,7 @@ public class Q022_TragedyInVonHellmannForest extends Quest
qs.giveItems(REPORT_BOX, 1);
qs.takeItems(SEALED_REPORT_BOX, -1);
qs.takeItems(JEWEL_OF_ADVENTURER_2, -1);
qs.set("cond", "14");
qs.setCond(14);
htmltext = "31529-16.htm";
}
break;
@@ -621,7 +617,7 @@ public class Q022_TragedyInVonHellmannForest extends Quest
public String onAttack(NpcInstance npc, PlayerInstance attacker, int damage, boolean isSummon)
{
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)
{
@@ -631,7 +627,7 @@ public class Q022_TragedyInVonHellmannForest extends Quest
{
qs.takeItems(JEWEL_OF_ADVENTURER_1, -1);
qs.giveItems(JEWEL_OF_ADVENTURER_2, 1);
qs.set("cond", "11");
qs.setCond(11);
}
}
return super.onAttack(npc, attacker, damage, isSummon);
@@ -649,10 +645,10 @@ public class Q022_TragedyInVonHellmannForest extends Quest
else
{
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.set("cond", "5");
qs.setCond(5);
}
}
}

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@@ -24,32 +24,27 @@ import org.l2jmobius.gameserver.model.quest.State;
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
private static final int SUEDE = 1866;
private static final int THREAD = 1868;
private static final int SPIRIT_ORE = 3031;
private static final int MAP = 7165;
private static final int MEDICINAL_HERB = 7166;
// Rewards
private static final int CAT_EARS = 6843;
private static final int RACOON_EARS = 7680;
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()
{
super(32, "An Obvious Lie");
registerQuestItems(MAP, MEDICINAL_HERB);
addStartNpc(MAXIMILIAN);
addTalkId(MAXIMILIAN, GENTLER, MIKI_THE_CAT);
addKillId(20135); // Alligator
}
@@ -63,103 +58,115 @@ public class Q032_AnObviousLie extends Quest
return htmltext;
}
if (event.equals("30120-1.htm"))
switch (event)
{
st.setState(State.STARTED);
st.set("cond", "1");
st.playSound(QuestState.SOUND_ACCEPT);
}
else if (event.equals("30094-1.htm"))
{
st.set("cond", "2");
st.playSound(QuestState.SOUND_MIDDLE);
st.giveItems(MAP, 1);
}
else if (event.equals("31706-1.htm"))
{
st.set("cond", "3");
st.playSound(QuestState.SOUND_MIDDLE);
st.takeItems(MAP, 1);
}
else if (event.equals("30094-4.htm"))
{
st.set("cond", "5");
st.playSound(QuestState.SOUND_MIDDLE);
st.takeItems(MEDICINAL_HERB, 20);
}
else if (event.equals("30094-7.htm"))
{
if (st.getQuestItemsCount(SPIRIT_ORE) < 500)
case "30120-1.htm":
{
htmltext = "30094-5.htm";
st.startQuest();
break;
}
else
case "30094-1.htm":
{
st.set("cond", "6");
st.setCond(2);
st.playSound(QuestState.SOUND_MIDDLE);
st.takeItems(SPIRIT_ORE, 500);
st.giveItems(MAP, 1);
break;
}
}
else if (event.equals("31706-4.htm"))
{
st.set("cond", "7");
st.playSound(QuestState.SOUND_MIDDLE);
}
else if (event.equals("30094-10.htm"))
{
st.set("cond", "8");
st.playSound(QuestState.SOUND_MIDDLE);
}
else if (event.equals("30094-13.htm"))
{
st.playSound(QuestState.SOUND_MIDDLE);
}
else if (event.equals("cat"))
{
if ((st.getQuestItemsCount(THREAD) < 1000) || (st.getQuestItemsCount(SUEDE) < 500))
case "31706-1.htm":
{
htmltext = "30094-11.htm";
st.setCond(3);
st.playSound(QuestState.SOUND_MIDDLE);
st.takeItems(MAP, 1);
break;
}
else
case "30094-4.htm":
{
htmltext = "30094-14.htm";
st.takeItems(SUEDE, 500);
st.takeItems(THREAD, 1000);
st.giveItems(CAT_EARS, 1);
st.playSound(QuestState.SOUND_FINISH);
st.exitQuest(false);
st.setCond(5);
st.playSound(QuestState.SOUND_MIDDLE);
st.takeItems(MEDICINAL_HERB, 20);
break;
}
}
else if (event.equals("racoon"))
{
if ((st.getQuestItemsCount(THREAD) < 1000) || (st.getQuestItemsCount(SUEDE) < 500))
case "30094-7.htm":
{
htmltext = "30094-11.htm";
if (st.getQuestItemsCount(SPIRIT_ORE) < 500)
{
htmltext = "30094-5.htm";
}
else
{
st.setCond(6);
st.playSound(QuestState.SOUND_MIDDLE);
st.takeItems(SPIRIT_ORE, 500);
}
break;
}
else
case "31706-4.htm":
{
htmltext = "30094-14.htm";
st.takeItems(SUEDE, 500);
st.takeItems(THREAD, 1000);
st.giveItems(RACOON_EARS, 1);
st.playSound(QuestState.SOUND_FINISH);
st.exitQuest(false);
st.setCond(7);
st.playSound(QuestState.SOUND_MIDDLE);
break;
}
}
else if (event.equals("rabbit"))
{
if ((st.getQuestItemsCount(THREAD) < 1000) || (st.getQuestItemsCount(SUEDE) < 500))
case "30094-10.htm":
{
htmltext = "30094-11.htm";
st.setCond(8);
st.playSound(QuestState.SOUND_MIDDLE);
break;
}
else
case "30094-13.htm":
{
htmltext = "30094-14.htm";
st.takeItems(SUEDE, 500);
st.takeItems(THREAD, 1000);
st.giveItems(RABBIT_EARS, 1);
st.playSound(QuestState.SOUND_FINISH);
st.exitQuest(false);
st.playSound(QuestState.SOUND_MIDDLE);
break;
}
case "cat":
{
if ((st.getQuestItemsCount(THREAD) < 1000) || (st.getQuestItemsCount(SUEDE) < 500))
{
htmltext = "30094-11.htm";
}
else
{
htmltext = "30094-14.htm";
st.takeItems(SUEDE, 500);
st.takeItems(THREAD, 1000);
st.giveItems(CAT_EARS, 1);
st.playSound(QuestState.SOUND_FINISH);
st.exitQuest(false);
}
break;
}
case "racoon":
{
if ((st.getQuestItemsCount(THREAD) < 1000) || (st.getQuestItemsCount(SUEDE) < 500))
{
htmltext = "30094-11.htm";
}
else
{
htmltext = "30094-14.htm";
st.takeItems(SUEDE, 500);
st.takeItems(THREAD, 1000);
st.giveItems(RACOON_EARS, 1);
st.playSound(QuestState.SOUND_FINISH);
st.exitQuest(false);
}
break;
}
case "rabbit":
{
if ((st.getQuestItemsCount(THREAD) < 1000) || (st.getQuestItemsCount(SUEDE) < 500))
{
htmltext = "30094-11.htm";
}
else
{
htmltext = "30094-14.htm";
st.takeItems(SUEDE, 500);
st.takeItems(THREAD, 1000);
st.giveItems(RABBIT_EARS, 1);
st.playSound(QuestState.SOUND_FINISH);
st.exitQuest(false);
}
break;
}
}
@@ -179,18 +186,22 @@ public class Q032_AnObviousLie extends Quest
switch (st.getState())
{
case State.CREATED:
{
htmltext = (player.getLevel() < 45) ? "30120-0a.htm" : "30120-0.htm";
break;
}
case State.STARTED:
final int cond = st.getInt("cond");
{
final int cond = st.getCond();
switch (npc.getNpcId())
{
case MAXIMILIAN:
{
htmltext = "30120-2.htm";
break;
}
case GENTLER:
{
if (cond == 1)
{
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";
}
break;
}
case MIKI_THE_CAT:
{
if (cond == 2)
{
htmltext = "31706-0.htm";
@@ -239,12 +251,15 @@ public class Q032_AnObviousLie extends Quest
htmltext = "31706-5.htm";
}
break;
}
}
break;
}
case State.COMPLETED:
{
htmltext = getAlreadyCompletedMsg();
break;
}
}
return htmltext;
@@ -253,7 +268,7 @@ public class Q032_AnObviousLie extends Quest
@Override
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)
{
return null;
@@ -261,7 +276,7 @@ public class Q032_AnObviousLie extends Quest
if (st.dropItemsAlways(MEDICINAL_HERB, 1, 20))
{
st.set("cond", "4");
st.setCond(4);
}
return null;

View File

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

View File

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

View File

@@ -29,25 +29,20 @@ public class Q035_FindGlitteringJewelry extends Quest
// NPCs
private static final int ELLIE = 30091;
private static final int FELTON = 30879;
// Items
private static final int ROUGH_JEWEL = 7162;
private static final int ORIHARUKON = 1893;
private static final int SILVER_NUGGET = 1873;
private static final int THONS = 4044;
// Reward
private static final int JEWEL_BOX = 7077;
public Q035_FindGlitteringJewelry()
{
super(35, "Find Glittering Jewelry");
registerQuestItems(ROUGH_JEWEL);
addStartNpc(ELLIE);
addTalkId(ELLIE, FELTON);
addKillId(20135); // Alligator
}
@@ -61,37 +56,42 @@ public class Q035_FindGlitteringJewelry extends Quest
return htmltext;
}
if (event.equals("30091-1.htm"))
switch (event)
{
st.setState(State.STARTED);
st.set("cond", "1");
st.playSound(QuestState.SOUND_ACCEPT);
}
else if (event.equals("30879-1.htm"))
{
st.set("cond", "2");
st.playSound(QuestState.SOUND_MIDDLE);
}
else if (event.equals("30091-3.htm"))
{
st.set("cond", "4");
st.playSound(QuestState.SOUND_MIDDLE);
st.takeItems(ROUGH_JEWEL, 10);
}
else if (event.equals("30091-5.htm"))
{
if ((st.getQuestItemsCount(ORIHARUKON) >= 5) && (st.getQuestItemsCount(SILVER_NUGGET) >= 500) && (st.getQuestItemsCount(THONS) >= 150))
case "30091-1.htm":
{
st.takeItems(ORIHARUKON, 5);
st.takeItems(SILVER_NUGGET, 500);
st.takeItems(THONS, 150);
st.giveItems(JEWEL_BOX, 1);
st.playSound(QuestState.SOUND_FINISH);
st.exitQuest(false);
st.startQuest();
break;
}
else
case "30879-1.htm":
{
htmltext = "30091-4a.htm";
st.setCond(2);
st.playSound(QuestState.SOUND_MIDDLE);
break;
}
case "30091-3.htm":
{
st.setCond(4);
st.playSound(QuestState.SOUND_MIDDLE);
st.takeItems(ROUGH_JEWEL, 10);
break;
}
case "30091-5.htm":
{
if ((st.getQuestItemsCount(ORIHARUKON) >= 5) && (st.getQuestItemsCount(SILVER_NUGGET) >= 500) && (st.getQuestItemsCount(THONS) >= 150))
{
st.takeItems(ORIHARUKON, 5);
st.takeItems(SILVER_NUGGET, 500);
st.takeItems(THONS, 150);
st.giveItems(JEWEL_BOX, 1);
st.playSound(QuestState.SOUND_FINISH);
st.exitQuest(false);
}
else
{
htmltext = "30091-4a.htm";
}
break;
}
}
@@ -111,10 +111,11 @@ public class Q035_FindGlitteringJewelry extends Quest
switch (st.getState())
{
case State.CREATED:
{
if (player.getLevel() >= 60)
{
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";
}
@@ -128,12 +129,14 @@ public class Q035_FindGlitteringJewelry extends Quest
htmltext = "30091-0b.htm";
}
break;
}
case State.STARTED:
final int cond = st.getInt("cond");
{
final int cond = st.getCond();
switch (npc.getNpcId())
{
case ELLIE:
{
if ((cond == 1) || (cond == 2))
{
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";
}
break;
}
case FELTON:
{
if (cond == 1)
{
htmltext = "30879-0.htm";
@@ -158,12 +162,15 @@ public class Q035_FindGlitteringJewelry extends Quest
htmltext = "30879-1a.htm";
}
break;
}
}
break;
}
case State.COMPLETED:
{
htmltext = getAlreadyCompletedMsg();
break;
}
}
return htmltext;
@@ -172,7 +179,7 @@ public class Q035_FindGlitteringJewelry extends Quest
@Override
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)
{
return null;
@@ -180,7 +187,7 @@ public class Q035_FindGlitteringJewelry extends Quest
if (st.dropItems(ROUGH_JEWEL, 1, 10, 500000))
{
st.set("cond", "3");
st.setCond(3);
}
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 ARTISANS_FRAME = 1891;
private static final int ORIHARUKON = 1893;
// Reward
private static final int SEWING_KIT = 7078;
public Q036_MakeASewingKit()
{
super(36, "Make a Sewing Kit");
registerQuestItems(REINFORCED_STEEL);
addStartNpc(30847); // Ferris
addTalkId(30847);
addKillId(20566); // Iron Golem
}
@@ -56,31 +52,35 @@ public class Q036_MakeASewingKit extends Quest
return htmltext;
}
if (event.equals("30847-1.htm"))
switch (event)
{
st.setState(State.STARTED);
st.set("cond", "1");
st.playSound(QuestState.SOUND_ACCEPT);
}
else if (event.equals("30847-3.htm"))
{
st.set("cond", "3");
st.playSound(QuestState.SOUND_MIDDLE);
st.takeItems(REINFORCED_STEEL, 5);
}
else if (event.equals("30847-5.htm"))
{
if ((st.getQuestItemsCount(ORIHARUKON) >= 10) && (st.getQuestItemsCount(ARTISANS_FRAME) >= 10))
case "30847-1.htm":
{
st.takeItems(ARTISANS_FRAME, 10);
st.takeItems(ORIHARUKON, 10);
st.giveItems(SEWING_KIT, 1);
st.playSound(QuestState.SOUND_FINISH);
st.exitQuest(false);
st.startQuest();
break;
}
else
case "30847-3.htm":
{
htmltext = "30847-4a.htm";
st.setCond(3);
st.playSound(QuestState.SOUND_MIDDLE);
st.takeItems(REINFORCED_STEEL, 5);
break;
}
case "30847-5.htm":
{
if ((st.getQuestItemsCount(ORIHARUKON) >= 10) && (st.getQuestItemsCount(ARTISANS_FRAME) >= 10))
{
st.takeItems(ARTISANS_FRAME, 10);
st.takeItems(ORIHARUKON, 10);
st.giveItems(SEWING_KIT, 1);
st.playSound(QuestState.SOUND_FINISH);
st.exitQuest(false);
}
else
{
htmltext = "30847-4a.htm";
}
break;
}
}
@@ -100,10 +100,11 @@ public class Q036_MakeASewingKit extends Quest
switch (st.getState())
{
case State.CREATED:
{
if (player.getLevel() >= 60)
{
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";
}
@@ -117,9 +118,10 @@ public class Q036_MakeASewingKit extends Quest
htmltext = "30847-0b.htm";
}
break;
}
case State.STARTED:
final int cond = st.getInt("cond");
{
final int cond = st.getCond();
if (cond == 1)
{
htmltext = "30847-1a.htm";
@@ -133,10 +135,12 @@ public class Q036_MakeASewingKit extends Quest
htmltext = ((st.getQuestItemsCount(ORIHARUKON) < 10) || (st.getQuestItemsCount(ARTISANS_FRAME) < 10)) ? "30847-4a.htm" : "30847-4.htm";
}
break;
}
case State.COMPLETED:
{
htmltext = getAlreadyCompletedMsg();
break;
}
}
return htmltext;
@@ -145,7 +149,7 @@ public class Q036_MakeASewingKit extends Quest
@Override
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)
{
return null;
@@ -153,7 +157,7 @@ public class Q036_MakeASewingKit extends Quest
if (st.dropItems(REINFORCED_STEEL, 1, 5, 500000))
{
st.set("cond", "2");
st.setCond(2);
}
return null;

View File

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

View File

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

View File

@@ -30,64 +30,34 @@ public class Q039_RedEyedInvaders extends Quest
// NPCs
private static final int BABENCO = 30334;
private static final int BATHIS = 30332;
// Mobs
// Monsters
private static final int MAILLE_LIZARDMAN = 20919;
private static final int MAILLE_LIZARDMAN_SCOUT = 20920;
private static final int MAILLE_LIZARDMAN_GUARD = 20921;
private static final int ARANEID = 20925;
// Items
private static final int BLACK_BONE_NECKLACE = 7178;
private static final int RED_BONE_NECKLACE = 7179;
private static final int INCENSE_POUCH = 7180;
private static final int GEM_OF_MAILLE = 7181;
// @formatter:off
// First droplist
private static final Map<Integer, int[]> FIRST_DP = new HashMap<>();
static
{
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
});
FIRST_DP.put(MAILLE_LIZARDMAN_SCOUT, new int[]
{
BLACK_BONE_NECKLACE,
RED_BONE_NECKLACE
});
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});
FIRST_DP.put(MAILLE_LIZARDMAN_SCOUT, new int[]{BLACK_BONE_NECKLACE, RED_BONE_NECKLACE});
}
// Second droplist
private static final Map<Integer, int[]> SECOND_DP = new HashMap<>();
static
{
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
});
SECOND_DP.put(MAILLE_LIZARDMAN_SCOUT, new int[]
{
INCENSE_POUCH,
GEM_OF_MAILLE,
250000
});
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});
SECOND_DP.put(MAILLE_LIZARDMAN_SCOUT, new int[]{INCENSE_POUCH, GEM_OF_MAILLE, 250000});
}
// @formatter:on
// Rewards
private static final int GREEN_COLORED_LURE_HG = 6521;
private static final int BABY_DUCK_RODE = 6529;
@@ -96,12 +66,9 @@ public class Q039_RedEyedInvaders extends Quest
public Q039_RedEyedInvaders()
{
super(39, "Red-Eyed Invaders");
registerQuestItems(BLACK_BONE_NECKLACE, RED_BONE_NECKLACE, INCENSE_POUCH, GEM_OF_MAILLE);
addStartNpc(BABENCO);
addTalkId(BABENCO, BATHIS);
addKillId(MAILLE_LIZARDMAN, MAILLE_LIZARDMAN_SCOUT, MAILLE_LIZARDMAN_GUARD, ARANEID);
}
@@ -115,33 +82,38 @@ public class Q039_RedEyedInvaders extends Quest
return htmltext;
}
if (event.equals("30334-1.htm"))
switch (event)
{
st.setState(State.STARTED);
st.set("cond", "1");
st.playSound(QuestState.SOUND_ACCEPT);
}
else if (event.equals("30332-1.htm"))
{
st.set("cond", "2");
st.playSound(QuestState.SOUND_MIDDLE);
}
else if (event.equals("30332-3.htm"))
{
st.set("cond", "4");
st.takeItems(BLACK_BONE_NECKLACE, -1);
st.takeItems(RED_BONE_NECKLACE, -1);
st.playSound(QuestState.SOUND_MIDDLE);
}
else if (event.equals("30332-5.htm"))
{
st.takeItems(INCENSE_POUCH, -1);
st.takeItems(GEM_OF_MAILLE, -1);
st.giveItems(GREEN_COLORED_LURE_HG, 60);
st.giveItems(BABY_DUCK_RODE, 1);
st.giveItems(FISHING_SHOT_NG, 500);
st.playSound(QuestState.SOUND_FINISH);
st.exitQuest(false);
case "30334-1.htm":
{
st.startQuest();
break;
}
case "30332-1.htm":
{
st.setCond(2);
st.playSound(QuestState.SOUND_MIDDLE);
break;
}
case "30332-3.htm":
{
st.setCond(4);
st.takeItems(BLACK_BONE_NECKLACE, -1);
st.takeItems(RED_BONE_NECKLACE, -1);
st.playSound(QuestState.SOUND_MIDDLE);
break;
}
case "30332-5.htm":
{
st.takeItems(INCENSE_POUCH, -1);
st.takeItems(GEM_OF_MAILLE, -1);
st.giveItems(GREEN_COLORED_LURE_HG, 60);
st.giveItems(BABY_DUCK_RODE, 1);
st.giveItems(FISHING_SHOT_NG, 500);
st.playSound(QuestState.SOUND_FINISH);
st.exitQuest(false);
break;
}
}
return htmltext;
@@ -160,18 +132,22 @@ public class Q039_RedEyedInvaders extends Quest
switch (st.getState())
{
case State.CREATED:
{
htmltext = (player.getLevel() < 20) ? "30334-2.htm" : "30334-0.htm";
break;
}
case State.STARTED:
final int cond = st.getInt("cond");
{
final int cond = st.getCond();
switch (npc.getNpcId())
{
case BABENCO:
{
htmltext = "30334-3.htm";
break;
}
case BATHIS:
{
if (cond == 1)
{
htmltext = "30332-0.htm";
@@ -193,12 +169,15 @@ public class Q039_RedEyedInvaders extends Quest
htmltext = "30332-4.htm";
}
break;
}
}
break;
}
case State.COMPLETED:
{
htmltext = getAlreadyCompletedMsg();
break;
}
}
return htmltext;
@@ -208,7 +187,7 @@ public class Q039_RedEyedInvaders extends Quest
public String onKill(NpcInstance npc, PlayerInstance player, boolean isPet)
{
final int npcId = npc.getNpcId();
PlayerInstance partyMember = getRandomPartyMember(player, npc, "2");
PlayerInstance partyMember = getRandomPartyMember(player, npc, 2);
if ((partyMember != null) && (npcId != ARANEID))
{
final QuestState st = partyMember.getQuestState(getName());
@@ -220,12 +199,12 @@ public class Q039_RedEyedInvaders extends Quest
final int[] list = FIRST_DP.get(npcId);
if (st.dropItems(list[0], 1, 100, 500000) && (st.getQuestItemsCount(list[1]) == 100))
{
st.set("cond", "3");
st.setCond(3);
}
}
else
{
partyMember = getRandomPartyMember(player, npc, "4");
partyMember = getRandomPartyMember(player, npc, 4);
if ((partyMember != null) && (npcId != MAILLE_LIZARDMAN))
{
final QuestState st = partyMember.getQuestState(getName());
@@ -237,7 +216,7 @@ public class Q039_RedEyedInvaders extends Quest
final int[] list = SECOND_DP.get(npcId);
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
private static final int WATERS = 30828;
private static final int SOPHYA = 30735;
// Monsters
private static final int MONSTER_EYE_DESTROYER = 20068;
private static final int MONSTER_EYE_GAZER = 20266;
// Items
private static final int TRIDENT = 291;
private static final int MAP_PIECE = 7548;
private static final int MAP = 7549;
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()
{
super(42, "Help the Uncle!");
registerQuestItems(MAP_PIECE, MAP);
addStartNpc(WATERS);
addTalkId(WATERS, SOPHYA);
addKillId(MONSTER_EYE_DESTROYER, MONSTER_EYE_GAZER);
}
@@ -60,36 +55,45 @@ public class Q042_HelpTheUncle extends Quest
return htmltext;
}
if (event.equals("30828-01.htm"))
switch (event)
{
st.setState(State.STARTED);
st.set("cond", "1");
st.playSound(QuestState.SOUND_ACCEPT);
}
else if (event.equals("30828-03.htm") && st.hasQuestItems(TRIDENT))
{
st.set("cond", "2");
st.playSound(QuestState.SOUND_MIDDLE);
st.takeItems(TRIDENT, 1);
}
else if (event.equals("30828-05.htm"))
{
st.set("cond", "4");
st.playSound(QuestState.SOUND_MIDDLE);
st.takeItems(MAP_PIECE, 30);
st.giveItems(MAP, 1);
}
else if (event.equals("30735-06.htm"))
{
st.set("cond", "5");
st.playSound(QuestState.SOUND_MIDDLE);
st.takeItems(MAP, 1);
}
else if (event.equals("30828-07.htm"))
{
st.giveItems(PET_TICKET, 1);
st.playSound(QuestState.SOUND_FINISH);
st.exitQuest(false);
case "30828-01.htm":
{
st.startQuest();
break;
}
case "30828-03.htm":
{
if (st.hasQuestItems(TRIDENT))
{
st.setCond(2);
st.playSound(QuestState.SOUND_MIDDLE);
st.takeItems(TRIDENT, 1);
}
break;
}
case "30828-05.htm":
{
st.setCond(4);
st.playSound(QuestState.SOUND_MIDDLE);
st.takeItems(MAP_PIECE, 30);
st.giveItems(MAP, 1);
break;
}
case "30735-06.htm":
{
st.setCond(5);
st.playSound(QuestState.SOUND_MIDDLE);
st.takeItems(MAP, 1);
break;
}
case "30828-07.htm":
{
st.giveItems(PET_TICKET, 1);
st.playSound(QuestState.SOUND_FINISH);
st.exitQuest(false);
break;
}
}
return htmltext;
@@ -108,14 +112,17 @@ public class Q042_HelpTheUncle extends Quest
switch (st.getState())
{
case State.CREATED:
{
htmltext = (player.getLevel() < 25) ? "30828-00a.htm" : "30828-00.htm";
break;
}
case State.STARTED:
final int cond = st.getInt("cond");
{
final int cond = st.getCond();
switch (npc.getNpcId())
{
case WATERS:
{
if (cond == 1)
{
htmltext = (!st.hasQuestItems(TRIDENT)) ? "30828-01a.htm" : "30828-02.htm";
@@ -137,8 +144,9 @@ public class Q042_HelpTheUncle extends Quest
htmltext = "30828-06.htm";
}
break;
}
case SOPHYA:
{
if (cond == 4)
{
htmltext = "30735-05.htm";
@@ -148,12 +156,15 @@ public class Q042_HelpTheUncle extends Quest
htmltext = "30735-06a.htm";
}
break;
}
}
break;
}
case State.COMPLETED:
{
htmltext = getAlreadyCompletedMsg();
break;
}
}
return htmltext;
@@ -162,7 +173,7 @@ public class Q042_HelpTheUncle extends Quest
@Override
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)
{
return null;
@@ -170,7 +181,7 @@ public class Q042_HelpTheUncle extends Quest
if (st.dropItemsAlways(MAP_PIECE, 1, 30))
{
st.set("cond", "3");
st.setCond(3);
}
return null;

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@@ -26,6 +26,13 @@ import org.l2jmobius.gameserver.network.serverpackets.SocialAction;
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
private static final int ALBERIUS_LETTER = 964;
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_4 = 1133;
private static final int COBENDELL_MEDICINE_5 = 1134;
// Rewards
private static final int SPIRITSHOT_NO_GRADE = 2509;
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_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()
{
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);
addStartNpc(ALBERIUS);
addTalkId(ALBERIUS, COBENDELL, BERROS, RAYEN, GARTRANDELL, VELTRESS);
addKillId(20013, 20019);
}
@@ -81,9 +76,7 @@ public class Q102_SeaOfSporesFever extends Quest
if (event.equals("30284-02.htm"))
{
st.setState(State.STARTED);
st.set("cond", "1");
st.playSound(QuestState.SOUND_ACCEPT);
st.startQuest();
st.giveItems(ALBERIUS_LETTER, 1);
}
@@ -103,6 +96,7 @@ public class Q102_SeaOfSporesFever extends Quest
switch (st.getState())
{
case State.CREATED:
{
if (player.getRace() != Race.ELF)
{
htmltext = "30284-00.htm";
@@ -116,12 +110,14 @@ public class Q102_SeaOfSporesFever extends Quest
htmltext = "30284-07.htm";
}
break;
}
case State.STARTED:
final int cond = st.getInt("cond");
{
final int cond = st.getCond();
switch (npc.getNpcId())
{
case ALBERIUS:
{
if (cond == 1)
{
htmltext = "30284-03.htm";
@@ -133,7 +129,7 @@ public class Q102_SeaOfSporesFever extends Quest
else if (cond == 4)
{
htmltext = "30284-04.htm";
st.set("cond", "5");
st.setCond(5);
st.set("medicines", "4");
st.playSound(QuestState.SOUND_MIDDLE);
st.takeItems(COBENDELL_MEDICINE_1, 1);
@@ -170,12 +166,13 @@ public class Q102_SeaOfSporesFever extends Quest
st.exitQuest(false);
}
break;
}
case COBENDELL:
{
if (cond == 1)
{
htmltext = "30156-03.htm";
st.set("cond", "2");
st.setCond(2);
st.playSound(QuestState.SOUND_MIDDLE);
st.takeItems(ALBERIUS_LETTER, 1);
st.giveItems(EVERGREEN_AMULET, 1);
@@ -191,7 +188,7 @@ public class Q102_SeaOfSporesFever extends Quest
else if (cond == 3)
{
htmltext = "30156-05.htm";
st.set("cond", "4");
st.setCond(4);
st.playSound(QuestState.SOUND_MIDDLE);
st.takeItems(DRYAD_TEARS, -1);
st.takeItems(EVERGREEN_AMULET, 1);
@@ -206,44 +203,51 @@ public class Q102_SeaOfSporesFever extends Quest
htmltext = "30156-06.htm";
}
break;
}
case BERROS:
{
if (cond == 5)
{
htmltext = "30217-01.htm";
checkItem(st, COBENDELL_MEDICINE_2);
}
break;
}
case VELTRESS:
{
if (cond == 5)
{
htmltext = "30219-01.htm";
checkItem(st, COBENDELL_MEDICINE_3);
}
break;
}
case RAYEN:
{
if (cond == 5)
{
htmltext = "30221-01.htm";
checkItem(st, COBENDELL_MEDICINE_4);
}
break;
}
case GARTRANDELL:
{
if (cond == 5)
{
htmltext = "30285-01.htm";
checkItem(st, COBENDELL_MEDICINE_5);
}
break;
}
}
break;
}
case State.COMPLETED:
{
htmltext = getAlreadyCompletedMsg();
break;
}
}
return htmltext;
@@ -252,7 +256,7 @@ public class Q102_SeaOfSporesFever extends Quest
@Override
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)
{
return null;
@@ -260,7 +264,7 @@ public class Q102_SeaOfSporesFever extends Quest
if (st.dropItems(DRYAD_TEARS, 1, 10, 300000))
{
st.set("cond", "3");
st.setCond(3);
}
return null;
@@ -275,7 +279,7 @@ public class Q102_SeaOfSporesFever extends Quest
final int medicinesLeft = st.getInt("medicines") - 1;
if (medicinesLeft == 0)
{
st.set("cond", "6");
st.setCond(6);
st.playSound(QuestState.SOUND_MIDDLE);
}
else

View File

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

View File

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

View File

@@ -27,6 +27,15 @@ import org.l2jmobius.gameserver.network.serverpackets.SocialAction;
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
private static final int KENDELL_ORDER_1 = 1836;
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 KABOO_CHIEF_TORC_1 = 1844;
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
private static final int SPIRITSHOT_FOR_BEGINNERS = 5790;
private static final int SOULSHOT_FOR_BEGINNERS = 5789;
@@ -63,12 +61,9 @@ public class Q105_SkirmishWithTheOrcs extends Quest
public Q105_SkirmishWithTheOrcs()
{
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);
addStartNpc(30218); // Kendell
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);
}
@@ -84,11 +79,10 @@ public class Q105_SkirmishWithTheOrcs extends Quest
if (event.equals("30218-03.htm"))
{
st.setState(State.STARTED);
st.set("cond", "1");
st.playSound(QuestState.SOUND_ACCEPT);
st.startQuest();
st.giveItems(Rnd.get(1836, 1839), 1); // Kendell's orders 1 to 4.
}
return htmltext;
}
@@ -105,6 +99,7 @@ public class Q105_SkirmishWithTheOrcs extends Quest
switch (st.getState())
{
case State.CREATED:
{
if (player.getRace() != Race.ELF)
{
htmltext = "30218-00.htm";
@@ -118,9 +113,10 @@ public class Q105_SkirmishWithTheOrcs extends Quest
htmltext = "30218-02.htm";
}
break;
}
case State.STARTED:
final int cond = st.getInt("cond");
{
final int cond = st.getCond();
if (cond == 1)
{
htmltext = "30218-05.htm";
@@ -128,7 +124,7 @@ public class Q105_SkirmishWithTheOrcs extends Quest
else if (cond == 2)
{
htmltext = "30218-06.htm";
st.set("cond", "3");
st.setCond(3);
st.playSound(QuestState.SOUND_MIDDLE);
st.takeItems(KABOO_CHIEF_TORC_1, 1);
st.takeItems(KENDELL_ORDER_1, 1);
@@ -184,10 +180,12 @@ public class Q105_SkirmishWithTheOrcs extends Quest
st.exitQuest(false);
}
break;
}
case State.COMPLETED:
{
htmltext = getAlreadyCompletedMsg();
break;
}
}
return htmltext;
}
@@ -207,33 +205,37 @@ public class Q105_SkirmishWithTheOrcs extends Quest
case KABOO_CHIEF_KRACHA:
case KABOO_CHIEF_BATOH:
case KABOO_CHIEF_TANUKIA:
if ((st.getInt("cond") == 1) && st.hasQuestItems(npc.getNpcId() - 25223)) // npcId - 25223 = itemId to verify.
{
if (st.isCond(1) && st.hasQuestItems(npc.getNpcId() - 25223)) // npcId - 25223 = itemId to verify.
{
st.set("cond", "2");
st.setCond(2);
st.playSound(QuestState.SOUND_MIDDLE);
st.giveItems(KABOO_CHIEF_TORC_1, 1);
}
break;
}
case KABOO_CHIEF_TUREL:
case KABOO_CHIEF_ROKO:
if ((st.getInt("cond") == 3) && st.hasQuestItems(npc.getNpcId() - 25224)) // npcId - 25224 = itemId to verify.
{
if (st.isCond(3) && st.hasQuestItems(npc.getNpcId() - 25224)) // npcId - 25224 = itemId to verify.
{
st.set("cond", "4");
st.setCond(4);
st.playSound(QuestState.SOUND_MIDDLE);
st.giveItems(KABOO_CHIEF_TORC_2, 1);
}
break;
}
case KABOO_CHIEF_KAMUT:
case KABOO_CHIEF_MURTIKA:
if ((st.getInt("cond") == 3) && st.hasQuestItems(npc.getNpcId() - 25225)) // npcId - 25225 = itemId to verify.
{
if (st.isCond(3) && st.hasQuestItems(npc.getNpcId() - 25225)) // npcId - 25225 = itemId to verify.
{
st.set("cond", "4");
st.setCond(4);
st.playSound(QuestState.SOUND_MIDDLE);
st.giveItems(KABOO_CHIEF_TORC_2, 1);
}
break;
}
}
return null;

View File

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

View File

@@ -29,7 +29,6 @@ public class Q107_MercilessPunishment extends Quest
// NPCs
private static final int HATOS = 30568;
private static final int PARUGON = 30580;
// Items
private static final int HATOS_ORDER_1 = 1553;
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_DARKELF = 1556;
private static final int LETTER_TO_ELF = 1558;
// Rewards
private static final int BUTCHER_SWORD = 1510;
private static final int SPIRITSHOT_FOR_BEGINNERS = 5790;
@@ -52,12 +50,9 @@ public class Q107_MercilessPunishment extends Quest
public Q107_MercilessPunishment()
{
super(107, "Merciless Punishment");
registerQuestItems(HATOS_ORDER_1, HATOS_ORDER_2, HATOS_ORDER_3, LETTER_TO_HUMAN, LETTER_TO_DARKELF, LETTER_TO_ELF);
addStartNpc(HATOS);
addTalkId(HATOS, PARUGON);
addKillId(27041); // Baranka's Messenger
}
@@ -71,31 +66,36 @@ public class Q107_MercilessPunishment extends Quest
return htmltext;
}
if (event.equals("30568-03.htm"))
switch (event)
{
st.setState(State.STARTED);
st.set("cond", "1");
st.playSound(QuestState.SOUND_ACCEPT);
st.giveItems(HATOS_ORDER_1, 1);
}
else if (event.equals("30568-06.htm"))
{
st.playSound(QuestState.SOUND_GIVEUP);
st.exitQuest(true);
}
else if (event.equals("30568-07.htm"))
{
st.set("cond", "4");
st.playSound(QuestState.SOUND_MIDDLE);
st.takeItems(HATOS_ORDER_1, 1);
st.giveItems(HATOS_ORDER_2, 1);
}
else if (event.equals("30568-09.htm"))
{
st.set("cond", "6");
st.playSound(QuestState.SOUND_MIDDLE);
st.takeItems(HATOS_ORDER_2, 1);
st.giveItems(HATOS_ORDER_3, 1);
case "30568-03.htm":
{
st.startQuest();
st.giveItems(HATOS_ORDER_1, 1);
break;
}
case "30568-06.htm":
{
st.playSound(QuestState.SOUND_GIVEUP);
st.exitQuest(true);
break;
}
case "30568-07.htm":
{
st.setCond(4);
st.playSound(QuestState.SOUND_MIDDLE);
st.takeItems(HATOS_ORDER_1, 1);
st.giveItems(HATOS_ORDER_2, 1);
break;
}
case "30568-09.htm":
{
st.setCond(6);
st.playSound(QuestState.SOUND_MIDDLE);
st.takeItems(HATOS_ORDER_2, 1);
st.giveItems(HATOS_ORDER_3, 1);
break;
}
}
return htmltext;
@@ -114,6 +114,7 @@ public class Q107_MercilessPunishment extends Quest
switch (st.getState())
{
case State.CREATED:
{
if (player.getRace() != Race.ORC)
{
htmltext = "30568-00.htm";
@@ -127,12 +128,14 @@ public class Q107_MercilessPunishment extends Quest
htmltext = "30568-02.htm";
}
break;
}
case State.STARTED:
final int cond = st.getInt("cond");
{
final int cond = st.getCond();
switch (npc.getNpcId())
{
case HATOS:
{
if ((cond == 1) || (cond == 2))
{
htmltext = "30568-04.htm";
@@ -185,21 +188,25 @@ public class Q107_MercilessPunishment extends Quest
st.exitQuest(false);
}
break;
}
case PARUGON:
{
htmltext = "30580-01.htm";
if (cond == 1)
{
st.set("cond", "2");
st.setCond(2);
st.playSound(QuestState.SOUND_MIDDLE);
}
break;
}
}
break;
}
case State.COMPLETED:
{
htmltext = getAlreadyCompletedMsg();
break;
}
}
return htmltext;
@@ -214,22 +221,22 @@ public class Q107_MercilessPunishment extends Quest
return null;
}
final int cond = st.getInt("cond");
final int cond = st.getCond();
if (cond == 2)
{
st.set("cond", "3");
st.setCond(3);
st.playSound(QuestState.SOUND_MIDDLE);
st.giveItems(LETTER_TO_HUMAN, 1);
}
else if (cond == 4)
{
st.set("cond", "5");
st.setCond(5);
st.playSound(QuestState.SOUND_MIDDLE);
st.giveItems(LETTER_TO_DARKELF, 1);
}
else if (cond == 6)
{
st.set("cond", "7");
st.setCond(7);
st.playSound(QuestState.SOUND_MIDDLE);
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 MARON = 30529;
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
private static final int GOUPH_CONTRACT = 1559;
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 BAT_DIAGRAM = 1570;
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
private static final int SILVERSMITH_HAMMER = 1511;
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_CELEBRATION = 4416;
private static final int LESSER_HEALING_POTION = 1060;
// @formatter:off
private static final int[][] LEADER_DROPLIST =
{
{
AQUAMARINE,
1,
10,
800000
},
{
CHRYSOBERYL,
1,
10,
800000
}
{AQUAMARINE, 1, 10, 800000},
{CHRYSOBERYL, 1, 10, 800000}
};
private static final int[][] LIEUTENANT_DROPLIST =
{
{
AQUAMARINE,
1,
10,
600000
},
{
CHRYSOBERYL,
1,
10,
600000
}
{AQUAMARINE, 1, 10, 600000},
{CHRYSOBERYL, 1, 10, 600000}
};
// @formatter:on
public Q108_JumbleTumbleDiamondFuss()
{
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);
addStartNpc(GOUPH);
addTalkId(GOUPH, REEP, MURDOC, AIRY, BRUNON, MARON, TOROCCO);
addKillId(GOBLIN_BRIGAND_LEADER, GOBLIN_BRIGAND_LIEUTENANT, BLADE_BAT);
}
@@ -121,26 +95,30 @@ public class Q108_JumbleTumbleDiamondFuss extends Quest
return htmltext;
}
if (event.equals("30523-03.htm"))
switch (event)
{
st.setState(State.STARTED);
st.set("cond", "1");
st.playSound(QuestState.SOUND_ACCEPT);
st.giveItems(GOUPH_CONTRACT, 1);
}
else if (event.equals("30555-02.htm"))
{
st.set("cond", "3");
st.playSound(QuestState.SOUND_MIDDLE);
st.takeItems(REEP_CONTRACT, 1);
st.giveItems(ELVEN_WINE, 1);
}
else if (event.equals("30526-02.htm"))
{
st.set("cond", "5");
st.playSound(QuestState.SOUND_MIDDLE);
st.takeItems(BRUNON_DICE, 1);
st.giveItems(BRUNON_CONTRACT, 1);
case "30523-03.htm":
{
st.startQuest();
st.giveItems(GOUPH_CONTRACT, 1);
break;
}
case "30555-02.htm":
{
st.setCond(3);
st.playSound(QuestState.SOUND_MIDDLE);
st.takeItems(REEP_CONTRACT, 1);
st.giveItems(ELVEN_WINE, 1);
break;
}
case "30526-02.htm":
{
st.setCond(5);
st.playSound(QuestState.SOUND_MIDDLE);
st.takeItems(BRUNON_DICE, 1);
st.giveItems(BRUNON_CONTRACT, 1);
break;
}
}
return htmltext;
@@ -159,6 +137,7 @@ public class Q108_JumbleTumbleDiamondFuss extends Quest
switch (st.getState())
{
case State.CREATED:
{
if (player.getRace() != Race.DWARF)
{
htmltext = "30523-00.htm";
@@ -172,12 +151,14 @@ public class Q108_JumbleTumbleDiamondFuss extends Quest
htmltext = "30523-02.htm";
}
break;
}
case State.STARTED:
final int cond = st.getInt("cond");
{
final int cond = st.getCond();
switch (npc.getNpcId())
{
case GOUPH:
{
if (cond == 1)
{
htmltext = "30523-04.htm";
@@ -189,7 +170,7 @@ public class Q108_JumbleTumbleDiamondFuss extends Quest
else if (cond == 7)
{
htmltext = "30523-06.htm";
st.set("cond", "8");
st.setCond(8);
st.playSound(QuestState.SOUND_MIDDLE);
st.takeItems(GEM_BOX, 1);
st.giveItems(COAL_PIECE, 1);
@@ -230,12 +211,13 @@ public class Q108_JumbleTumbleDiamondFuss extends Quest
st.exitQuest(false);
}
break;
}
case REEP:
{
if (cond == 1)
{
htmltext = "30516-01.htm";
st.set("cond", "2");
st.setCond(2);
st.playSound(QuestState.SOUND_MIDDLE);
st.takeItems(GOUPH_CONTRACT, 1);
st.giveItems(REEP_CONTRACT, 1);
@@ -245,8 +227,9 @@ public class Q108_JumbleTumbleDiamondFuss extends Quest
htmltext = "30516-02.htm";
}
break;
}
case TOROCCO:
{
if (cond == 2)
{
htmltext = "30555-01.htm";
@@ -264,12 +247,13 @@ public class Q108_JumbleTumbleDiamondFuss extends Quest
htmltext = "30555-05.htm";
}
break;
}
case MARON:
{
if (cond == 3)
{
htmltext = "30529-01.htm";
st.set("cond", "4");
st.setCond(4);
st.playSound(QuestState.SOUND_MIDDLE);
st.takeItems(ELVEN_WINE, 1);
st.giveItems(BRUNON_DICE, 1);
@@ -283,8 +267,9 @@ public class Q108_JumbleTumbleDiamondFuss extends Quest
htmltext = "30529-03.htm";
}
break;
}
case BRUNON:
{
if (cond == 4)
{
htmltext = "30526-01.htm";
@@ -296,7 +281,7 @@ public class Q108_JumbleTumbleDiamondFuss extends Quest
else if (cond == 6)
{
htmltext = "30526-04.htm";
st.set("cond", "7");
st.setCond(7);
st.playSound(QuestState.SOUND_MIDDLE);
st.takeItems(BRUNON_CONTRACT, 1);
st.takeItems(AQUAMARINE, -1);
@@ -310,7 +295,7 @@ public class Q108_JumbleTumbleDiamondFuss extends Quest
else if (cond == 8)
{
htmltext = "30526-06.htm";
st.set("cond", "9");
st.setCond(9);
st.playSound(QuestState.SOUND_MIDDLE);
st.takeItems(COAL_PIECE, 1);
st.giveItems(BRUNON_LETTER, 1);
@@ -324,12 +309,13 @@ public class Q108_JumbleTumbleDiamondFuss extends Quest
htmltext = "30526-08.htm";
}
break;
}
case MURDOC:
{
if (cond == 9)
{
htmltext = "30521-01.htm";
st.set("cond", "10");
st.setCond(10);
st.playSound(QuestState.SOUND_MIDDLE);
st.takeItems(BRUNON_LETTER, 1);
st.giveItems(BERRY_TART, 1);
@@ -343,12 +329,13 @@ public class Q108_JumbleTumbleDiamondFuss extends Quest
htmltext = "30521-03.htm";
}
break;
}
case AIRY:
{
if (cond == 10)
{
htmltext = "30522-01.htm";
st.set("cond", "11");
st.setCond(11);
st.playSound(QuestState.SOUND_MIDDLE);
st.takeItems(BERRY_TART, 1);
st.giveItems(BAT_DIAGRAM, 1);
@@ -362,12 +349,15 @@ public class Q108_JumbleTumbleDiamondFuss extends Quest
htmltext = "30522-03.htm";
}
break;
}
}
break;
}
case State.COMPLETED:
{
htmltext = getAlreadyCompletedMsg();
break;
}
}
return htmltext;
}
@@ -384,26 +374,30 @@ public class Q108_JumbleTumbleDiamondFuss extends Quest
switch (npc.getNpcId())
{
case GOBLIN_BRIGAND_LEADER:
if ((st.getInt("cond") == 5) && st.dropMultipleItems(LEADER_DROPLIST))
{
if (st.isCond(5) && st.dropMultipleItems(LEADER_DROPLIST))
{
st.set("cond", "6");
st.setCond(6);
}
break;
}
case GOBLIN_BRIGAND_LIEUTENANT:
if ((st.getInt("cond") == 5) && st.dropMultipleItems(LIEUTENANT_DROPLIST))
{
if (st.isCond(5) && st.dropMultipleItems(LIEUTENANT_DROPLIST))
{
st.set("cond", "6");
st.setCond(6);
}
break;
}
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.set("cond", "12");
st.setCond(12);
}
break;
}
}
return null;
}

View File

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

View File

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

View File

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

View File

@@ -28,24 +28,19 @@ public class Q154_SacrificeToTheSea extends Quest
private static final int ROCKSWELL = 30312;
private static final int CRISTEL = 30051;
private static final int ROLFE = 30055;
// Items
private static final int FOX_FUR = 1032;
private static final int FOX_FUR_YARN = 1033;
private static final int MAIDEN_DOLL = 1034;
// Reward
private static final int EARING = 113;
public Q154_SacrificeToTheSea()
{
super(154, "Sacrifice to the Sea");
registerQuestItems(FOX_FUR, FOX_FUR_YARN, MAIDEN_DOLL);
addStartNpc(ROCKSWELL);
addTalkId(ROCKSWELL, CRISTEL, ROLFE);
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"))
{
st.setState(State.STARTED);
st.set("cond", "1");
st.playSound(QuestState.SOUND_ACCEPT);
st.startQuest();
}
return htmltext;
@@ -82,14 +75,17 @@ public class Q154_SacrificeToTheSea extends Quest
switch (st.getState())
{
case State.CREATED:
{
htmltext = (player.getLevel() < 2) ? "30312-02.htm" : "30312-03.htm";
break;
}
case State.STARTED:
final int cond = st.getInt("cond");
{
final int cond = st.getCond();
switch (npc.getNpcId())
{
case ROCKSWELL:
{
if (cond == 1)
{
htmltext = "30312-05.htm";
@@ -112,8 +108,9 @@ public class Q154_SacrificeToTheSea extends Quest
st.exitQuest(false);
}
break;
}
case CRISTEL:
{
if (cond == 1)
{
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)
{
htmltext = "30051-02.htm";
st.set("cond", "3");
st.setCond(3);
st.playSound(QuestState.SOUND_MIDDLE);
st.takeItems(FOX_FUR, -1);
st.giveItems(FOX_FUR_YARN, 1);
@@ -135,8 +132,9 @@ public class Q154_SacrificeToTheSea extends Quest
htmltext = "30051-04.htm";
}
break;
}
case ROLFE:
{
if (cond < 3)
{
htmltext = "30055-03.htm";
@@ -144,7 +142,7 @@ public class Q154_SacrificeToTheSea extends Quest
else if (cond == 3)
{
htmltext = "30055-01.htm";
st.set("cond", "4");
st.setCond(4);
st.playSound(QuestState.SOUND_MIDDLE);
st.takeItems(FOX_FUR_YARN, 1);
st.giveItems(MAIDEN_DOLL, 1);
@@ -154,12 +152,15 @@ public class Q154_SacrificeToTheSea extends Quest
htmltext = "30055-02.htm";
}
break;
}
}
break;
}
case State.COMPLETED:
{
htmltext = getAlreadyCompletedMsg();
break;
}
}
return htmltext;
@@ -168,7 +169,7 @@ public class Q154_SacrificeToTheSea extends Quest
@Override
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)
{
return null;
@@ -176,7 +177,7 @@ public class Q154_SacrificeToTheSea extends Quest
if (st.dropItems(FOX_FUR, 1, 10, 400000))
{
st.set("cond", "2");
st.setCond(2);
}
return null;

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