Quest condition is now cached in a separate QuestState variable.
This commit is contained in:
@@ -39,7 +39,7 @@ public class IdManager
|
||||
{
|
||||
private static final Logger LOGGER = Logger.getLogger(IdManager.class.getName());
|
||||
|
||||
//@formatter:off
|
||||
// @formatter:off
|
||||
private static final String[][] ID_EXTRACTS =
|
||||
{
|
||||
{"characters","charId"},
|
||||
@@ -47,7 +47,7 @@ public class IdManager
|
||||
{"clan_data","clan_id"},
|
||||
{"itemsonground","object_id"}
|
||||
};
|
||||
//@formatter:on
|
||||
// @formatter:on
|
||||
|
||||
private static final String[] TIMESTAMPS_CLEAN =
|
||||
{
|
||||
|
@@ -1601,7 +1601,7 @@ public class NpcInstance extends Creature
|
||||
final QuestState qs = player.getQuestState(q.getName());
|
||||
if (qs != null)
|
||||
{
|
||||
if (qs.isStarted() && (qs.getInt("cond") > 0))
|
||||
if (qs.getCond() > 0)
|
||||
{
|
||||
state = " (In Progress)";
|
||||
}
|
||||
|
@@ -1242,11 +1242,10 @@ public class Quest extends ManagedScript
|
||||
* Auxiliary function for party quests. Checks the player's condition. Player member must be within Config.PARTY_RANGE distance from the npc. If npc is null, distance condition is ignored.
|
||||
* @param player : the instance of a player whose party is to be searched
|
||||
* @param npc : the instance of a Npc to compare distance
|
||||
* @param var : a tuple specifying a quest condition that must be satisfied for a party member to be considered.
|
||||
* @param value : a tuple specifying a quest condition that must be satisfied for a party member to be considered.
|
||||
* @param cond : an integer specifying a quest condition that must be satisfied for a party member to be considered.
|
||||
* @return QuestState : The QuestState of that player.
|
||||
*/
|
||||
public QuestState checkPlayerCondition(PlayerInstance player, NpcInstance npc, String var, String value)
|
||||
public QuestState checkPlayerCondition(PlayerInstance player, NpcInstance npc, int cond)
|
||||
{
|
||||
// No valid player or npc instance is passed, there is nothing to check.
|
||||
if ((player == null) || (npc == null))
|
||||
@@ -1261,8 +1260,8 @@ public class Quest extends ManagedScript
|
||||
return null;
|
||||
}
|
||||
|
||||
// Condition exists? Condition has correct value?
|
||||
if ((qs.get(var) == null) || !value.equalsIgnoreCase(qs.get(var).toString()))
|
||||
// Condition has correct value?
|
||||
if (!qs.isCond(cond))
|
||||
{
|
||||
return null;
|
||||
}
|
||||
@@ -1347,12 +1346,11 @@ public class Quest extends ManagedScript
|
||||
* Auxiliary function for party quests. Note: This function is only here because of how commonly it may be used by quest developers. For any variations on this function, the quest script can always handle things on its own
|
||||
* @param player : the instance of a player whose party is to be searched
|
||||
* @param npc : the instance of a Npc to compare distance
|
||||
* @param var : a tuple specifying a quest condition that must be satisfied for a party member to be considered.
|
||||
* @param value : a tuple specifying a quest condition that must be satisfied for a party member to be considered.
|
||||
* @param cond : an integer specifying a quest condition that must be satisfied for a party member to be considered.
|
||||
* @return List<Player> : List of party members that matches the specified condition, empty list if none matches. If the var is null, empty list is returned (i.e. no condition is applied). The party member must be within Config.PARTY_RANGE distance from the npc. If npc is null, distance
|
||||
* condition is ignored.
|
||||
*/
|
||||
public List<PlayerInstance> getPartyMembers(PlayerInstance player, NpcInstance npc, String var, String value)
|
||||
public List<PlayerInstance> getPartyMembers(PlayerInstance player, NpcInstance npc, int cond)
|
||||
{
|
||||
if (player == null)
|
||||
{
|
||||
@@ -1362,13 +1360,13 @@ public class Quest extends ManagedScript
|
||||
final Party party = player.getParty();
|
||||
if (party == null)
|
||||
{
|
||||
return (checkPlayerCondition(player, npc, var, value) != null) ? Arrays.asList(player) : Collections.emptyList();
|
||||
return (checkPlayerCondition(player, npc, cond) != null) ? Arrays.asList(player) : Collections.emptyList();
|
||||
}
|
||||
|
||||
final List<PlayerInstance> result = new ArrayList<>();
|
||||
for (PlayerInstance member : party.getPartyMembers())
|
||||
{
|
||||
if (checkPlayerCondition(member, npc, var, value) != null)
|
||||
if (checkPlayerCondition(member, npc, cond) != null)
|
||||
{
|
||||
result.add(member);
|
||||
}
|
||||
@@ -1381,11 +1379,10 @@ public class Quest extends ManagedScript
|
||||
* Auxiliary function for party quests. Note: This function is only here because of how commonly it may be used by quest developers. For any variations on this function, the quest script can always handle things on its own
|
||||
* @param player : the instance of a player whose party is to be searched
|
||||
* @param npc : the instance of a Npc to compare distance
|
||||
* @param var : a tuple specifying a quest condition that must be satisfied for a party member to be considered.
|
||||
* @param value : a tuple specifying a quest condition that must be satisfied for a party member to be considered.
|
||||
* @return Player : Player for a random party member that matches the specified condition, or null if no match. If the var is null, null is returned (i.e. no condition is applied). The party member must be within 1500 distance from the npc. If npc is null, distance condition is ignored.
|
||||
* @param cond : an integer specifying a quest condition that must be satisfied for a party member to be considered.
|
||||
* @return Player : Player for a random party member that matches the specified condition, or null if no match. If the cond is null, null is returned (i.e. no condition is applied). The party member must be within 1500 distance from the npc. If npc is null, distance condition is ignored.
|
||||
*/
|
||||
public PlayerInstance getRandomPartyMember(PlayerInstance player, NpcInstance npc, String var, String value)
|
||||
public PlayerInstance getRandomPartyMember(PlayerInstance player, NpcInstance npc, int cond)
|
||||
{
|
||||
// No valid player instance is passed, there is nothing to check.
|
||||
if (player == null)
|
||||
@@ -1394,44 +1391,28 @@ public class Quest extends ManagedScript
|
||||
}
|
||||
|
||||
// Return random candidate.
|
||||
final List<PlayerInstance> members = getPartyMembers(player, npc, var, value);
|
||||
final List<PlayerInstance> members = getPartyMembers(player, npc, cond);
|
||||
if (members.isEmpty())
|
||||
{
|
||||
final QuestState qs = player.getQuestState(getName());
|
||||
if (qs != null)
|
||||
if ((qs != null) && qs.isCond(cond))
|
||||
{
|
||||
final Object sVar = qs.get(var);
|
||||
if ((sVar != null) && ((String) sVar).equalsIgnoreCase(value))
|
||||
{
|
||||
return player; // match
|
||||
}
|
||||
return player; // match
|
||||
}
|
||||
return null; // no match
|
||||
}
|
||||
return members.get(Rnd.get(members.size()));
|
||||
}
|
||||
|
||||
/**
|
||||
* Auxiliary function for party quests. Note: This function is only here because of how commonly it may be used by quest developers. For any variations on this function, the quest script can always handle things on its own.
|
||||
* @param player : the instance of a player whose party is to be searched
|
||||
* @param npc : the instance of a Npc to compare distance
|
||||
* @param value : the value of the "cond" variable that must be matched
|
||||
* @return Player : Player for a random party member that matches the specified condition, or null if no match.
|
||||
*/
|
||||
public PlayerInstance getRandomPartyMember(PlayerInstance player, NpcInstance npc, String value)
|
||||
{
|
||||
return getRandomPartyMember(player, npc, "cond", value);
|
||||
}
|
||||
|
||||
/**
|
||||
* Auxiliary function for party quests. Note: This function is only here because of how commonly it may be used by quest developers. For any variations on this function, the quest script can always handle things on its own
|
||||
* @param player the instance of a player whose party is to be searched
|
||||
* @param var a tuple specifying a quest condition that must be satisfied for a party member to be considered.
|
||||
* @param variable a tuple specifying a quest condition that must be satisfied for a party member to be considered.
|
||||
* @param value
|
||||
* @return PlayerInstance: PlayerInstance for a random party member that matches the specified condition, or null if no match. If the var is null, any random party member is returned (i.e. no condition is applied). The party member must be within 1500 distance from the target of the reference
|
||||
* player, or if no target exists, 1500 distance from the player itself.
|
||||
*/
|
||||
public PlayerInstance getRandomPartyMember(PlayerInstance player, String var, String value)
|
||||
public PlayerInstance getRandomPartyMember(PlayerInstance player, String variable, String value)
|
||||
{
|
||||
// if no valid player instance is passed, there is nothing to check...
|
||||
if (player == null)
|
||||
@@ -1440,7 +1421,7 @@ public class Quest extends ManagedScript
|
||||
}
|
||||
|
||||
// for null var condition, return any random party member.
|
||||
if (var == null)
|
||||
if (variable == null)
|
||||
{
|
||||
return getRandomPartyMember(player);
|
||||
}
|
||||
@@ -1454,7 +1435,7 @@ public class Quest extends ManagedScript
|
||||
final QuestState qs = player.getQuestState(getName());
|
||||
if (qs != null)
|
||||
{
|
||||
final Object sVar = qs.get(var);
|
||||
final Object sVar = qs.get(variable);
|
||||
if ((sVar != null) && ((String) sVar).equalsIgnoreCase(value))
|
||||
{
|
||||
return player; // match
|
||||
@@ -1478,7 +1459,7 @@ public class Quest extends ManagedScript
|
||||
final QuestState qs = partyMember.getQuestState(getName());
|
||||
if (qs != null)
|
||||
{
|
||||
final Object sVar = qs.get(var);
|
||||
final Object sVar = qs.get(variable);
|
||||
if ((sVar != null) && ((String) sVar).equalsIgnoreCase(value) && partyMember.isInsideRadius3D(target, Config.ALT_PARTY_RANGE))
|
||||
{
|
||||
candidates.add(partyMember);
|
||||
|
@@ -19,6 +19,7 @@ package org.l2jmobius.gameserver.model.quest;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
import java.util.logging.Level;
|
||||
import java.util.logging.Logger;
|
||||
|
||||
import org.l2jmobius.Config;
|
||||
@@ -49,6 +50,9 @@ public class QuestState
|
||||
{
|
||||
protected static final Logger LOGGER = Logger.getLogger(QuestState.class.getName());
|
||||
|
||||
// Constants
|
||||
private static final String COND_VAR = "cond";
|
||||
|
||||
public static final String SOUND_ACCEPT = "ItemSound.quest_accept";
|
||||
public static final String SOUND_ITEMGET = "ItemSound.quest_itemget";
|
||||
public static final String SOUND_MIDDLE = "ItemSound.quest_middle";
|
||||
@@ -72,16 +76,14 @@ public class QuestState
|
||||
/** The current state of the quest */
|
||||
private byte _state;
|
||||
|
||||
/** The current condition of the quest */
|
||||
private int _cond = 0;
|
||||
|
||||
/** A map of key->value pairs containing the quest state variables and their values */
|
||||
private Map<String, String> _vars;
|
||||
|
||||
/**
|
||||
* Constructor of the QuestState : save the quest in the list of quests of the player.<BR/>
|
||||
* <BR/>
|
||||
* <u><i>Actions :</u></i><BR/>
|
||||
* <li>Save informations in the object QuestState created (Quest, Player, Completion, State)</li>
|
||||
* <li>Add the QuestState in the player's list of quests by using setQuestState()</li>
|
||||
* <li>Add drops gotten by the quest</li> <BR/>
|
||||
* Constructor of the QuestState. Creates the QuestState object and sets the player's progress of the quest to this QuestState.
|
||||
* @param quest the {@link Quest} object associated with the QuestState
|
||||
* @param player the owner of this {@link QuestState} object
|
||||
* @param state the initial state of the quest
|
||||
@@ -210,9 +212,9 @@ public class QuestState
|
||||
// Otherwise, delete variables for quest and update database (quest CANNOT be created again => not repeatable)
|
||||
if (_vars != null)
|
||||
{
|
||||
for (String var : _vars.keySet())
|
||||
for (String variable : _vars.keySet())
|
||||
{
|
||||
Quest.deleteQuestVarInDb(this, var);
|
||||
Quest.deleteQuestVarInDb(this, variable);
|
||||
}
|
||||
_vars.clear();
|
||||
}
|
||||
@@ -222,60 +224,74 @@ public class QuestState
|
||||
|
||||
/**
|
||||
* Add parameter used in quests.
|
||||
* @param var String pointing out the name of the variable for quest
|
||||
* @param val String pointing out the value 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 val)
|
||||
public void setInternal(String variable, String value)
|
||||
{
|
||||
if (_vars == null)
|
||||
{
|
||||
_vars = new HashMap<>();
|
||||
}
|
||||
|
||||
String value = val;
|
||||
if (value == null)
|
||||
{
|
||||
value = "";
|
||||
_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);
|
||||
}
|
||||
|
||||
/**
|
||||
* Return value of parameter "value" after adding the couple (var,value) in class variable "vars".<br>
|
||||
* <u><i>Actions :</i></u><br>
|
||||
* <li>Initialize class variable "vars" if is null</li>
|
||||
* Actions:<br>
|
||||
* <ul>
|
||||
* <li>Initialize class variable "vars" if is null.</li>
|
||||
* <li>Initialize parameter "value" if is null</li>
|
||||
* <li>Add/Update couple (var,value) in class variable Map "vars"</li>
|
||||
* <li>If the key represented by "var" exists in Map "vars", the couple (var,value) is updated in the database. 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><br>
|
||||
* @param var : String indicating the name of the variable for quest
|
||||
* @param val : String indicating the value of the variable for quest
|
||||
* <li>If the key represented by "var" exists in Map "vars", the couple (var,value) is updated in the database.<br>
|
||||
* The key is known as existing if the preceding value of the key (given as result of function put()) is not null.<br>
|
||||
* If the key doesn't exist, the couple is added/created in the database</li>
|
||||
* <ul>
|
||||
* @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 (_vars == null)
|
||||
{
|
||||
_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 (var.equals("cond"))
|
||||
if (COND_VAR.equals(variable))
|
||||
{
|
||||
try
|
||||
{
|
||||
@@ -284,29 +300,40 @@ 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);
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
LOGGER.finer(_player.getName() + ", " + _questName + " cond [" + value + "] is not an integer. Value stored, but no packet was sent: " + e);
|
||||
LOGGER.log(Level.WARNING, _player.getName() + ", " + _questName + " cond [" + newValue + "] is not an integer. Value stored, but no packet was sent: " + e.getMessage(), e);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Internally handles the progression of the quest so that it is ready for sending appropriate packets to the client<br>
|
||||
* Internally handles the progression of the quest so that it is ready for sending appropriate packets to the client.<br>
|
||||
* <u><i>Actions :</i></u><br>
|
||||
* <li>Check if the new progress number resets the quest to a previous (smaller) step</li>
|
||||
* <li>If not, check if quest progress steps have been skipped</li>
|
||||
* <li>If skipped, prepare the variable completedStateFlags appropriately to be ready for sending to clients</li>
|
||||
* <ul>
|
||||
* <li>Check if the new progress number resets the quest to a previous (smaller) step.</li>
|
||||
* <li>If not, check if quest progress steps have been skipped.</li>
|
||||
* <li>If skipped, prepare the variable completedStateFlags appropriately to be ready for sending to clients.</li>
|
||||
* <li>If no steps were skipped, flags do not need to be prepared...</li>
|
||||
* <li>If the passed step resets the quest to a previous step, reset such that steps after the parameter are not considered, while skipped steps before the parameter, if any, maintain their info</li><br>
|
||||
* @param cond : int indicating the step number for the current quest progress (as will be shown to the client)
|
||||
* @param old : int indicating the previously noted step For more info on the variable communicating the progress steps to the client, please see
|
||||
* <li>If the passed step resets the quest to a previous step, reset such that steps after the parameter are not considered, while skipped steps before the parameter, if any, maintain their info.</li>
|
||||
* </ul>
|
||||
* @param cond the current quest progress condition (0 - 31 including)
|
||||
* @param old the previous quest progress condition to check against
|
||||
*/
|
||||
private void setCond(int cond, int old)
|
||||
{
|
||||
@@ -386,75 +413,120 @@ 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 (_vars == null)
|
||||
{
|
||||
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);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Return the value of the variable of quest represented by "var"
|
||||
* @param var : name of the variable of quest
|
||||
* @return Object
|
||||
* @param variable the name of the variable to get
|
||||
* @return the value of the variable from the list of quest variables
|
||||
*/
|
||||
public Object get(String var)
|
||||
public String get(String variable)
|
||||
{
|
||||
if (_vars == null)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
return _vars.get(var);
|
||||
|
||||
return _vars.get(variable);
|
||||
}
|
||||
|
||||
/**
|
||||
* @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 variable)
|
||||
{
|
||||
int varInt = 0;
|
||||
if (_vars != null)
|
||||
{
|
||||
final String value = _vars.get(variable);
|
||||
if (value != null)
|
||||
{
|
||||
try
|
||||
{
|
||||
varInt = Integer.parseInt(value);
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
LOGGER.info(_player.getName() + ": variable " + variable + " isn't an integer: returned value will be " + varInt + e);
|
||||
if (Config.AUTODELETE_INVALID_QUEST_DATA)
|
||||
{
|
||||
exitQuest(true);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return varInt;
|
||||
}
|
||||
|
||||
/**
|
||||
* Return the value of the variable of quest represented by "var"
|
||||
* @param var : name of the variable of quest
|
||||
* @param variable : name of the variable of quest
|
||||
* @return String
|
||||
*/
|
||||
public String getString(String var)
|
||||
public String getString(String variable)
|
||||
{
|
||||
if (_vars == null)
|
||||
{
|
||||
return "";
|
||||
}
|
||||
return _vars.get(var);
|
||||
|
||||
return _vars.get(variable);
|
||||
}
|
||||
|
||||
/**
|
||||
* Return the value of the variable of quest represented by "var"
|
||||
* @param var : String designating the variable for the quest
|
||||
* @return int
|
||||
* Checks if the quest state progress ({@code cond}) is at the specified step.
|
||||
* @param condition the condition to check against
|
||||
* @return {@code true} if the quest condition is equal to {@code condition}, {@code false} otherwise
|
||||
* @see #getInt(String var)
|
||||
*/
|
||||
public int getInt(String var)
|
||||
public boolean isCond(int condition)
|
||||
{
|
||||
int varint = 0;
|
||||
String value = "";
|
||||
if ((_vars != null) && ((value = _vars.get(var)) != null))
|
||||
return _cond == condition;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the quest state progress ({@code cond}) to the specified step.
|
||||
* @param value the new value of the quest state progress
|
||||
* @see #set(String var, String value)
|
||||
*/
|
||||
public void setCond(int value)
|
||||
{
|
||||
if (isStarted())
|
||||
{
|
||||
try
|
||||
{
|
||||
varint = Integer.parseInt(value);
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
LOGGER.info(_player.getName() + ": variable " + var + " isn't an integer: returned value will be " + varint + e);
|
||||
if (Config.AUTODELETE_INVALID_QUEST_DATA)
|
||||
{
|
||||
exitQuest(true);
|
||||
}
|
||||
}
|
||||
set(COND_VAR, Integer.toString(value));
|
||||
}
|
||||
return varint;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the current quest progress ({@code cond})
|
||||
*/
|
||||
public int getCond()
|
||||
{
|
||||
if (isStarted())
|
||||
{
|
||||
return _cond;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -879,14 +951,14 @@ public class QuestState
|
||||
*/
|
||||
public void rewardItems(int itemId, int itemCount)
|
||||
{
|
||||
if (itemId == 57)
|
||||
{
|
||||
giveItems(itemId, (int) (itemCount * Config.RATE_QUESTS_REWARD), 0); // TODO: RATE_QUEST_REWARD_ADENA
|
||||
}
|
||||
else
|
||||
{
|
||||
giveItems(itemId, (int) (itemCount * Config.RATE_QUESTS_REWARD), 0);
|
||||
}
|
||||
// if (itemId == 57)
|
||||
// {
|
||||
// giveItems(itemId, (int) (itemCount * Config.RATE_QUEST_REWARD_ADENA), 0); // TODO: RATE_QUEST_REWARD_ADENA
|
||||
// }
|
||||
// else
|
||||
// {
|
||||
giveItems(itemId, (int) (itemCount * Config.RATE_QUESTS_REWARD), 0);
|
||||
// }
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -1068,6 +1140,20 @@ public class QuestState
|
||||
return getQuest().addSpawn(npcId, x, y, z, heading, randomOffset, despawnDelay);
|
||||
}
|
||||
|
||||
/**
|
||||
* Set condition to 1, state to STARTED and play the "ItemSound.quest_accept".<br>
|
||||
* Works only if state is CREATED and the quest is not a custom quest.
|
||||
*/
|
||||
public void startQuest()
|
||||
{
|
||||
if (isCreated())
|
||||
{
|
||||
set(COND_VAR, "1");
|
||||
setState(State.STARTED);
|
||||
_player.sendPacket(new PlaySound(QuestState.SOUND_ACCEPT));
|
||||
}
|
||||
}
|
||||
|
||||
public void showQuestionMark(int number)
|
||||
{
|
||||
_player.sendPacket(new TutorialShowQuestionMark(number));
|
||||
|
@@ -28,7 +28,7 @@ public class ExCaptureOrc implements IClientOutgoingPacket
|
||||
static
|
||||
{
|
||||
// TODO: Verify the data
|
||||
//@formatter:off
|
||||
// @formatter:off
|
||||
_test = new byte[]
|
||||
{
|
||||
(byte) 0xE4 ,(byte) 0xAB ,(byte) 0x8E ,(byte) 0xC5 ,(byte) 0xE9 ,(byte) 0xF9 ,(byte) 0x86 ,(byte) 0x7B,
|
||||
@@ -40,7 +40,7 @@ public class ExCaptureOrc implements IClientOutgoingPacket
|
||||
(byte) 0x5E ,(byte) 0x1C ,(byte) 0x59 ,(byte) 0x8E ,(byte) 0x74 ,(byte) 0x01 ,(byte) 0x9E ,(byte) 0xC2,
|
||||
(byte) 0x00 ,(byte) 0x95 ,(byte) 0xB0 ,(byte) 0x1D ,(byte) 0x87 ,(byte) 0xED ,(byte) 0x9C ,(byte) 0x8A
|
||||
};
|
||||
//@formatter:on
|
||||
// @formatter:on
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@@ -55,7 +55,7 @@ public class GMViewQuestList implements IClientOutgoingPacket
|
||||
continue;
|
||||
}
|
||||
|
||||
packet.writeD(qs.getInt("cond")); // stage of quest progress
|
||||
packet.writeD(qs.getCond()); // stage of quest progress
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
@@ -48,7 +48,7 @@ public class QuestList implements IClientOutgoingPacket
|
||||
}
|
||||
else
|
||||
{
|
||||
packet.writeD(qs.getInt("cond"));
|
||||
packet.writeD(qs.getCond());
|
||||
}
|
||||
}
|
||||
return true;
|
||||
|
@@ -145,7 +145,7 @@ public class LoginServer
|
||||
InputStreamReader is = new InputStreamReader(fis);
|
||||
LineNumberReader lnr = new LineNumberReader(is))
|
||||
{
|
||||
//@formatter:off
|
||||
// @formatter:off
|
||||
lnr.lines()
|
||||
.map(String::trim)
|
||||
.filter(l -> !l.isEmpty() && (l.charAt(0) != '#'))
|
||||
@@ -179,7 +179,7 @@ public class LoginServer
|
||||
LOGGER.warning("Skipped: Invalid address (" + address + ") on (" + bannedFile.getName() + "). Line: " + lnr.getLineNumber());
|
||||
}
|
||||
});
|
||||
//@formatter:on
|
||||
// @formatter:on
|
||||
}
|
||||
catch (IOException e)
|
||||
{
|
||||
|
Reference in New Issue
Block a user