StatSet getIntegerList rework and addition of setIntegerList.
This commit is contained in:
@@ -392,16 +392,50 @@ public class StatSet implements IParserAdvUtils
|
|||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
public List<Integer> getIntegerList(String key, String splitOn)
|
public List<Integer> getIntegerList(String key)
|
||||||
{
|
{
|
||||||
final List<Integer> result = new ArrayList<>();
|
final String val = getString(key, null);
|
||||||
for (int i : getIntArray(key, splitOn))
|
final List<Integer> result;
|
||||||
|
if (val != null)
|
||||||
{
|
{
|
||||||
result.add(i);
|
final String[] splitVal = val.split(",");
|
||||||
|
result = new ArrayList<>(splitVal.length + 1);
|
||||||
|
for (String split : splitVal)
|
||||||
|
{
|
||||||
|
result.add(Integer.parseInt(split));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
result = new ArrayList<>(1);
|
||||||
}
|
}
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void setIntegerList(String key, List<Integer> list)
|
||||||
|
{
|
||||||
|
if (key == null)
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if ((list == null) || list.isEmpty())
|
||||||
|
{
|
||||||
|
remove(key);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
final StringBuilder sb = new StringBuilder();
|
||||||
|
for (int element : list)
|
||||||
|
{
|
||||||
|
sb.append(element);
|
||||||
|
sb.append(",");
|
||||||
|
}
|
||||||
|
sb.deleteCharAt(sb.length() - 1); // Prettify value.
|
||||||
|
|
||||||
|
set(key, sb.toString());
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public long getLong(String key)
|
public long getLong(String key)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -392,16 +392,50 @@ public class StatSet implements IParserAdvUtils
|
|||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
public List<Integer> getIntegerList(String key, String splitOn)
|
public List<Integer> getIntegerList(String key)
|
||||||
{
|
{
|
||||||
final List<Integer> result = new ArrayList<>();
|
final String val = getString(key, null);
|
||||||
for (int i : getIntArray(key, splitOn))
|
final List<Integer> result;
|
||||||
|
if (val != null)
|
||||||
{
|
{
|
||||||
result.add(i);
|
final String[] splitVal = val.split(",");
|
||||||
|
result = new ArrayList<>(splitVal.length + 1);
|
||||||
|
for (String split : splitVal)
|
||||||
|
{
|
||||||
|
result.add(Integer.parseInt(split));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
result = new ArrayList<>(1);
|
||||||
}
|
}
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void setIntegerList(String key, List<Integer> list)
|
||||||
|
{
|
||||||
|
if (key == null)
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if ((list == null) || list.isEmpty())
|
||||||
|
{
|
||||||
|
remove(key);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
final StringBuilder sb = new StringBuilder();
|
||||||
|
for (int element : list)
|
||||||
|
{
|
||||||
|
sb.append(element);
|
||||||
|
sb.append(",");
|
||||||
|
}
|
||||||
|
sb.deleteCharAt(sb.length() - 1); // Prettify value.
|
||||||
|
|
||||||
|
set(key, sb.toString());
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public long getLong(String key)
|
public long getLong(String key)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -392,16 +392,50 @@ public class StatSet implements IParserAdvUtils
|
|||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
public List<Integer> getIntegerList(String key, String splitOn)
|
public List<Integer> getIntegerList(String key)
|
||||||
{
|
{
|
||||||
final List<Integer> result = new ArrayList<>();
|
final String val = getString(key, null);
|
||||||
for (int i : getIntArray(key, splitOn))
|
final List<Integer> result;
|
||||||
|
if (val != null)
|
||||||
{
|
{
|
||||||
result.add(i);
|
final String[] splitVal = val.split(",");
|
||||||
|
result = new ArrayList<>(splitVal.length + 1);
|
||||||
|
for (String split : splitVal)
|
||||||
|
{
|
||||||
|
result.add(Integer.parseInt(split));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
result = new ArrayList<>(1);
|
||||||
}
|
}
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void setIntegerList(String key, List<Integer> list)
|
||||||
|
{
|
||||||
|
if (key == null)
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if ((list == null) || list.isEmpty())
|
||||||
|
{
|
||||||
|
remove(key);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
final StringBuilder sb = new StringBuilder();
|
||||||
|
for (int element : list)
|
||||||
|
{
|
||||||
|
sb.append(element);
|
||||||
|
sb.append(",");
|
||||||
|
}
|
||||||
|
sb.deleteCharAt(sb.length() - 1); // Prettify value.
|
||||||
|
|
||||||
|
set(key, sb.toString());
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public long getLong(String key)
|
public long getLong(String key)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -392,16 +392,50 @@ public class StatSet implements IParserAdvUtils
|
|||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
public List<Integer> getIntegerList(String key, String splitOn)
|
public List<Integer> getIntegerList(String key)
|
||||||
{
|
{
|
||||||
final List<Integer> result = new ArrayList<>();
|
final String val = getString(key, null);
|
||||||
for (int i : getIntArray(key, splitOn))
|
final List<Integer> result;
|
||||||
|
if (val != null)
|
||||||
{
|
{
|
||||||
result.add(i);
|
final String[] splitVal = val.split(",");
|
||||||
|
result = new ArrayList<>(splitVal.length + 1);
|
||||||
|
for (String split : splitVal)
|
||||||
|
{
|
||||||
|
result.add(Integer.parseInt(split));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
result = new ArrayList<>(1);
|
||||||
}
|
}
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void setIntegerList(String key, List<Integer> list)
|
||||||
|
{
|
||||||
|
if (key == null)
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if ((list == null) || list.isEmpty())
|
||||||
|
{
|
||||||
|
remove(key);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
final StringBuilder sb = new StringBuilder();
|
||||||
|
for (int element : list)
|
||||||
|
{
|
||||||
|
sb.append(element);
|
||||||
|
sb.append(",");
|
||||||
|
}
|
||||||
|
sb.deleteCharAt(sb.length() - 1); // Prettify value.
|
||||||
|
|
||||||
|
set(key, sb.toString());
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public long getLong(String key)
|
public long getLong(String key)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -392,16 +392,50 @@ public class StatSet implements IParserAdvUtils
|
|||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
public List<Integer> getIntegerList(String key, String splitOn)
|
public List<Integer> getIntegerList(String key)
|
||||||
{
|
{
|
||||||
final List<Integer> result = new ArrayList<>();
|
final String val = getString(key, null);
|
||||||
for (int i : getIntArray(key, splitOn))
|
final List<Integer> result;
|
||||||
|
if (val != null)
|
||||||
{
|
{
|
||||||
result.add(i);
|
final String[] splitVal = val.split(",");
|
||||||
|
result = new ArrayList<>(splitVal.length + 1);
|
||||||
|
for (String split : splitVal)
|
||||||
|
{
|
||||||
|
result.add(Integer.parseInt(split));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
result = new ArrayList<>(1);
|
||||||
}
|
}
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void setIntegerList(String key, List<Integer> list)
|
||||||
|
{
|
||||||
|
if (key == null)
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if ((list == null) || list.isEmpty())
|
||||||
|
{
|
||||||
|
remove(key);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
final StringBuilder sb = new StringBuilder();
|
||||||
|
for (int element : list)
|
||||||
|
{
|
||||||
|
sb.append(element);
|
||||||
|
sb.append(",");
|
||||||
|
}
|
||||||
|
sb.deleteCharAt(sb.length() - 1); // Prettify value.
|
||||||
|
|
||||||
|
set(key, sb.toString());
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public long getLong(String key)
|
public long getLong(String key)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -392,16 +392,50 @@ public class StatSet implements IParserAdvUtils
|
|||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
public List<Integer> getIntegerList(String key, String splitOn)
|
public List<Integer> getIntegerList(String key)
|
||||||
{
|
{
|
||||||
final List<Integer> result = new ArrayList<>();
|
final String val = getString(key, null);
|
||||||
for (int i : getIntArray(key, splitOn))
|
final List<Integer> result;
|
||||||
|
if (val != null)
|
||||||
{
|
{
|
||||||
result.add(i);
|
final String[] splitVal = val.split(",");
|
||||||
|
result = new ArrayList<>(splitVal.length + 1);
|
||||||
|
for (String split : splitVal)
|
||||||
|
{
|
||||||
|
result.add(Integer.parseInt(split));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
result = new ArrayList<>(1);
|
||||||
}
|
}
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void setIntegerList(String key, List<Integer> list)
|
||||||
|
{
|
||||||
|
if (key == null)
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if ((list == null) || list.isEmpty())
|
||||||
|
{
|
||||||
|
remove(key);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
final StringBuilder sb = new StringBuilder();
|
||||||
|
for (int element : list)
|
||||||
|
{
|
||||||
|
sb.append(element);
|
||||||
|
sb.append(",");
|
||||||
|
}
|
||||||
|
sb.deleteCharAt(sb.length() - 1); // Prettify value.
|
||||||
|
|
||||||
|
set(key, sb.toString());
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public long getLong(String key)
|
public long getLong(String key)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -392,16 +392,50 @@ public class StatSet implements IParserAdvUtils
|
|||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
public List<Integer> getIntegerList(String key, String splitOn)
|
public List<Integer> getIntegerList(String key)
|
||||||
{
|
{
|
||||||
final List<Integer> result = new ArrayList<>();
|
final String val = getString(key, null);
|
||||||
for (int i : getIntArray(key, splitOn))
|
final List<Integer> result;
|
||||||
|
if (val != null)
|
||||||
{
|
{
|
||||||
result.add(i);
|
final String[] splitVal = val.split(",");
|
||||||
|
result = new ArrayList<>(splitVal.length + 1);
|
||||||
|
for (String split : splitVal)
|
||||||
|
{
|
||||||
|
result.add(Integer.parseInt(split));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
result = new ArrayList<>(1);
|
||||||
}
|
}
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void setIntegerList(String key, List<Integer> list)
|
||||||
|
{
|
||||||
|
if (key == null)
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if ((list == null) || list.isEmpty())
|
||||||
|
{
|
||||||
|
remove(key);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
final StringBuilder sb = new StringBuilder();
|
||||||
|
for (int element : list)
|
||||||
|
{
|
||||||
|
sb.append(element);
|
||||||
|
sb.append(",");
|
||||||
|
}
|
||||||
|
sb.deleteCharAt(sb.length() - 1); // Prettify value.
|
||||||
|
|
||||||
|
set(key, sb.toString());
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public long getLong(String key)
|
public long getLong(String key)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -392,16 +392,50 @@ public class StatSet implements IParserAdvUtils
|
|||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
public List<Integer> getIntegerList(String key, String splitOn)
|
public List<Integer> getIntegerList(String key)
|
||||||
{
|
{
|
||||||
final List<Integer> result = new ArrayList<>();
|
final String val = getString(key, null);
|
||||||
for (int i : getIntArray(key, splitOn))
|
final List<Integer> result;
|
||||||
|
if (val != null)
|
||||||
{
|
{
|
||||||
result.add(i);
|
final String[] splitVal = val.split(",");
|
||||||
|
result = new ArrayList<>(splitVal.length + 1);
|
||||||
|
for (String split : splitVal)
|
||||||
|
{
|
||||||
|
result.add(Integer.parseInt(split));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
result = new ArrayList<>(1);
|
||||||
}
|
}
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void setIntegerList(String key, List<Integer> list)
|
||||||
|
{
|
||||||
|
if (key == null)
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if ((list == null) || list.isEmpty())
|
||||||
|
{
|
||||||
|
remove(key);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
final StringBuilder sb = new StringBuilder();
|
||||||
|
for (int element : list)
|
||||||
|
{
|
||||||
|
sb.append(element);
|
||||||
|
sb.append(",");
|
||||||
|
}
|
||||||
|
sb.deleteCharAt(sb.length() - 1); // Prettify value.
|
||||||
|
|
||||||
|
set(key, sb.toString());
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public long getLong(String key)
|
public long getLong(String key)
|
||||||
{
|
{
|
||||||
|
|||||||
+5
-40
@@ -14336,7 +14336,7 @@ public class PlayerInstance extends Playable
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
final List<Integer> positions = getVariables().getIntegerList(PlayerVariables.AUTO_USE_SHORTCUTS, ",");
|
final List<Integer> positions = getVariables().getIntegerList(PlayerVariables.AUTO_USE_SHORTCUTS);
|
||||||
for (Shortcut shortcut : getAllShortCuts())
|
for (Shortcut shortcut : getAllShortCuts())
|
||||||
{
|
{
|
||||||
final Integer position = shortcut.getSlot() + (shortcut.getPage() * ShortCuts.MAX_SHORTCUTS_PER_BAR);
|
final Integer position = shortcut.getSlot() + (shortcut.getPage() * ShortCuts.MAX_SHORTCUTS_PER_BAR);
|
||||||
@@ -14366,16 +14366,7 @@ public class PlayerInstance extends Playable
|
|||||||
|
|
||||||
public synchronized void addAutoShortcut(int slot, int page)
|
public synchronized void addAutoShortcut(int slot, int page)
|
||||||
{
|
{
|
||||||
final List<Integer> positions;
|
final List<Integer> positions = getVariables().getIntegerList(PlayerVariables.AUTO_USE_SHORTCUTS);
|
||||||
if (getVariables().contains(PlayerVariables.AUTO_USE_SHORTCUTS))
|
|
||||||
{
|
|
||||||
positions = getVariables().getIntegerList(PlayerVariables.AUTO_USE_SHORTCUTS, ",");
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
positions = new ArrayList<>();
|
|
||||||
}
|
|
||||||
|
|
||||||
final Shortcut usedShortcut = getShortCut(slot, page);
|
final Shortcut usedShortcut = getShortCut(slot, page);
|
||||||
if (usedShortcut == null)
|
if (usedShortcut == null)
|
||||||
{
|
{
|
||||||
@@ -14399,20 +14390,7 @@ public class PlayerInstance extends Playable
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
final StringBuilder variable = new StringBuilder();
|
getVariables().setIntegerList(PlayerVariables.AUTO_USE_SHORTCUTS, positions);
|
||||||
for (int id : positions)
|
|
||||||
{
|
|
||||||
variable.append(id);
|
|
||||||
variable.append(",");
|
|
||||||
}
|
|
||||||
if (variable.isEmpty())
|
|
||||||
{
|
|
||||||
getVariables().remove(PlayerVariables.AUTO_USE_SHORTCUTS);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
getVariables().set(PlayerVariables.AUTO_USE_SHORTCUTS, variable.toString());
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public synchronized void removeAutoShortcut(int slot, int page)
|
public synchronized void removeAutoShortcut(int slot, int page)
|
||||||
@@ -14422,7 +14400,7 @@ public class PlayerInstance extends Playable
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
final List<Integer> positions = getVariables().getIntegerList(PlayerVariables.AUTO_USE_SHORTCUTS, ",");
|
final List<Integer> positions = getVariables().getIntegerList(PlayerVariables.AUTO_USE_SHORTCUTS);
|
||||||
final Shortcut usedShortcut = getShortCut(slot, page);
|
final Shortcut usedShortcut = getShortCut(slot, page);
|
||||||
if (usedShortcut == null)
|
if (usedShortcut == null)
|
||||||
{
|
{
|
||||||
@@ -14443,20 +14421,7 @@ public class PlayerInstance extends Playable
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
final StringBuilder variable = new StringBuilder();
|
getVariables().setIntegerList(PlayerVariables.AUTO_USE_SHORTCUTS, positions);
|
||||||
for (int id : positions)
|
|
||||||
{
|
|
||||||
variable.append(id);
|
|
||||||
variable.append(",");
|
|
||||||
}
|
|
||||||
if (variable.isEmpty())
|
|
||||||
{
|
|
||||||
getVariables().remove(PlayerVariables.AUTO_USE_SHORTCUTS);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
getVariables().set(PlayerVariables.AUTO_USE_SHORTCUTS, variable.toString());
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean isInTimedHuntingZone(int zoneId)
|
public boolean isInTimedHuntingZone(int zoneId)
|
||||||
|
|||||||
+3
-17
@@ -76,9 +76,9 @@ public class RequestShortCutReg implements IClientIncomingPacket
|
|||||||
player.sendPacket(new ExActivateAutoShortcut(sc, _active));
|
player.sendPacket(new ExActivateAutoShortcut(sc, _active));
|
||||||
|
|
||||||
// When id is not auto used, deactivate auto shortcuts.
|
// When id is not auto used, deactivate auto shortcuts.
|
||||||
if (player.getVariables().contains(PlayerVariables.AUTO_USE_SHORTCUTS) && !player.getAutoUseSettings().getAutoSkills().contains(_id) && !player.getAutoUseSettings().getAutoSupplyItems().contains(_id))
|
if (!player.getAutoUseSettings().getAutoSkills().contains(_id) && !player.getAutoUseSettings().getAutoSupplyItems().contains(_id))
|
||||||
{
|
{
|
||||||
final List<Integer> positions = player.getVariables().getIntegerList(PlayerVariables.AUTO_USE_SHORTCUTS, ",");
|
final List<Integer> positions = player.getVariables().getIntegerList(PlayerVariables.AUTO_USE_SHORTCUTS);
|
||||||
final Integer position = _slot + (_page * ShortCuts.MAX_SHORTCUTS_PER_BAR);
|
final Integer position = _slot + (_page * ShortCuts.MAX_SHORTCUTS_PER_BAR);
|
||||||
if (!positions.contains(position))
|
if (!positions.contains(position))
|
||||||
{
|
{
|
||||||
@@ -86,21 +86,7 @@ public class RequestShortCutReg implements IClientIncomingPacket
|
|||||||
}
|
}
|
||||||
|
|
||||||
positions.remove(position);
|
positions.remove(position);
|
||||||
|
player.getVariables().setIntegerList(PlayerVariables.AUTO_USE_SHORTCUTS, positions);
|
||||||
final StringBuilder variable = new StringBuilder();
|
|
||||||
for (int id : positions)
|
|
||||||
{
|
|
||||||
variable.append(id);
|
|
||||||
variable.append(",");
|
|
||||||
}
|
|
||||||
if (variable.isEmpty())
|
|
||||||
{
|
|
||||||
player.getVariables().remove(PlayerVariables.AUTO_USE_SHORTCUTS);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
player.getVariables().set(PlayerVariables.AUTO_USE_SHORTCUTS, variable.toString());
|
|
||||||
}
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -392,16 +392,50 @@ public class StatSet implements IParserAdvUtils
|
|||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
public List<Integer> getIntegerList(String key, String splitOn)
|
public List<Integer> getIntegerList(String key)
|
||||||
{
|
{
|
||||||
final List<Integer> result = new ArrayList<>();
|
final String val = getString(key, null);
|
||||||
for (int i : getIntArray(key, splitOn))
|
final List<Integer> result;
|
||||||
|
if (val != null)
|
||||||
{
|
{
|
||||||
result.add(i);
|
final String[] splitVal = val.split(",");
|
||||||
|
result = new ArrayList<>(splitVal.length + 1);
|
||||||
|
for (String split : splitVal)
|
||||||
|
{
|
||||||
|
result.add(Integer.parseInt(split));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
result = new ArrayList<>(1);
|
||||||
}
|
}
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void setIntegerList(String key, List<Integer> list)
|
||||||
|
{
|
||||||
|
if (key == null)
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if ((list == null) || list.isEmpty())
|
||||||
|
{
|
||||||
|
remove(key);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
final StringBuilder sb = new StringBuilder();
|
||||||
|
for (int element : list)
|
||||||
|
{
|
||||||
|
sb.append(element);
|
||||||
|
sb.append(",");
|
||||||
|
}
|
||||||
|
sb.deleteCharAt(sb.length() - 1); // Prettify value.
|
||||||
|
|
||||||
|
set(key, sb.toString());
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public long getLong(String key)
|
public long getLong(String key)
|
||||||
{
|
{
|
||||||
|
|||||||
+5
-40
@@ -14406,7 +14406,7 @@ public class PlayerInstance extends Playable
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
final List<Integer> positions = getVariables().getIntegerList(PlayerVariables.AUTO_USE_SHORTCUTS, ",");
|
final List<Integer> positions = getVariables().getIntegerList(PlayerVariables.AUTO_USE_SHORTCUTS);
|
||||||
for (Shortcut shortcut : getAllShortCuts())
|
for (Shortcut shortcut : getAllShortCuts())
|
||||||
{
|
{
|
||||||
final Integer position = shortcut.getSlot() + (shortcut.getPage() * ShortCuts.MAX_SHORTCUTS_PER_BAR);
|
final Integer position = shortcut.getSlot() + (shortcut.getPage() * ShortCuts.MAX_SHORTCUTS_PER_BAR);
|
||||||
@@ -14436,16 +14436,7 @@ public class PlayerInstance extends Playable
|
|||||||
|
|
||||||
public synchronized void addAutoShortcut(int slot, int page)
|
public synchronized void addAutoShortcut(int slot, int page)
|
||||||
{
|
{
|
||||||
final List<Integer> positions;
|
final List<Integer> positions = getVariables().getIntegerList(PlayerVariables.AUTO_USE_SHORTCUTS);
|
||||||
if (getVariables().contains(PlayerVariables.AUTO_USE_SHORTCUTS))
|
|
||||||
{
|
|
||||||
positions = getVariables().getIntegerList(PlayerVariables.AUTO_USE_SHORTCUTS, ",");
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
positions = new ArrayList<>();
|
|
||||||
}
|
|
||||||
|
|
||||||
final Shortcut usedShortcut = getShortCut(slot, page);
|
final Shortcut usedShortcut = getShortCut(slot, page);
|
||||||
if (usedShortcut == null)
|
if (usedShortcut == null)
|
||||||
{
|
{
|
||||||
@@ -14469,20 +14460,7 @@ public class PlayerInstance extends Playable
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
final StringBuilder variable = new StringBuilder();
|
getVariables().setIntegerList(PlayerVariables.AUTO_USE_SHORTCUTS, positions);
|
||||||
for (int id : positions)
|
|
||||||
{
|
|
||||||
variable.append(id);
|
|
||||||
variable.append(",");
|
|
||||||
}
|
|
||||||
if (variable.isEmpty())
|
|
||||||
{
|
|
||||||
getVariables().remove(PlayerVariables.AUTO_USE_SHORTCUTS);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
getVariables().set(PlayerVariables.AUTO_USE_SHORTCUTS, variable.toString());
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public synchronized void removeAutoShortcut(int slot, int page)
|
public synchronized void removeAutoShortcut(int slot, int page)
|
||||||
@@ -14492,7 +14470,7 @@ public class PlayerInstance extends Playable
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
final List<Integer> positions = getVariables().getIntegerList(PlayerVariables.AUTO_USE_SHORTCUTS, ",");
|
final List<Integer> positions = getVariables().getIntegerList(PlayerVariables.AUTO_USE_SHORTCUTS);
|
||||||
final Shortcut usedShortcut = getShortCut(slot, page);
|
final Shortcut usedShortcut = getShortCut(slot, page);
|
||||||
if (usedShortcut == null)
|
if (usedShortcut == null)
|
||||||
{
|
{
|
||||||
@@ -14513,20 +14491,7 @@ public class PlayerInstance extends Playable
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
final StringBuilder variable = new StringBuilder();
|
getVariables().setIntegerList(PlayerVariables.AUTO_USE_SHORTCUTS, positions);
|
||||||
for (int id : positions)
|
|
||||||
{
|
|
||||||
variable.append(id);
|
|
||||||
variable.append(",");
|
|
||||||
}
|
|
||||||
if (variable.isEmpty())
|
|
||||||
{
|
|
||||||
getVariables().remove(PlayerVariables.AUTO_USE_SHORTCUTS);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
getVariables().set(PlayerVariables.AUTO_USE_SHORTCUTS, variable.toString());
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean isInTimedHuntingZone(int zoneId)
|
public boolean isInTimedHuntingZone(int zoneId)
|
||||||
|
|||||||
+3
-17
@@ -76,9 +76,9 @@ public class RequestShortCutReg implements IClientIncomingPacket
|
|||||||
player.sendPacket(new ExActivateAutoShortcut(sc, _active));
|
player.sendPacket(new ExActivateAutoShortcut(sc, _active));
|
||||||
|
|
||||||
// When id is not auto used, deactivate auto shortcuts.
|
// When id is not auto used, deactivate auto shortcuts.
|
||||||
if (player.getVariables().contains(PlayerVariables.AUTO_USE_SHORTCUTS) && !player.getAutoUseSettings().getAutoSkills().contains(_id) && !player.getAutoUseSettings().getAutoSupplyItems().contains(_id))
|
if (!player.getAutoUseSettings().getAutoSkills().contains(_id) && !player.getAutoUseSettings().getAutoSupplyItems().contains(_id))
|
||||||
{
|
{
|
||||||
final List<Integer> positions = player.getVariables().getIntegerList(PlayerVariables.AUTO_USE_SHORTCUTS, ",");
|
final List<Integer> positions = player.getVariables().getIntegerList(PlayerVariables.AUTO_USE_SHORTCUTS);
|
||||||
final Integer position = _slot + (_page * ShortCuts.MAX_SHORTCUTS_PER_BAR);
|
final Integer position = _slot + (_page * ShortCuts.MAX_SHORTCUTS_PER_BAR);
|
||||||
if (!positions.contains(position))
|
if (!positions.contains(position))
|
||||||
{
|
{
|
||||||
@@ -86,21 +86,7 @@ public class RequestShortCutReg implements IClientIncomingPacket
|
|||||||
}
|
}
|
||||||
|
|
||||||
positions.remove(position);
|
positions.remove(position);
|
||||||
|
player.getVariables().setIntegerList(PlayerVariables.AUTO_USE_SHORTCUTS, positions);
|
||||||
final StringBuilder variable = new StringBuilder();
|
|
||||||
for (int id : positions)
|
|
||||||
{
|
|
||||||
variable.append(id);
|
|
||||||
variable.append(",");
|
|
||||||
}
|
|
||||||
if (variable.isEmpty())
|
|
||||||
{
|
|
||||||
player.getVariables().remove(PlayerVariables.AUTO_USE_SHORTCUTS);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
player.getVariables().set(PlayerVariables.AUTO_USE_SHORTCUTS, variable.toString());
|
|
||||||
}
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
+2
-17
@@ -58,9 +58,7 @@ public class ExRequestTeleportFavoritesAddDel implements IClientIncomingPacket
|
|||||||
}
|
}
|
||||||
|
|
||||||
final List<Integer> favorites = new ArrayList<>();
|
final List<Integer> favorites = new ArrayList<>();
|
||||||
if (player.getVariables().contains(PlayerVariables.FAVORITE_TELEPORTS))
|
for (int id : player.getVariables().getIntegerList(PlayerVariables.FAVORITE_TELEPORTS))
|
||||||
{
|
|
||||||
for (int id : player.getVariables().getIntArray(PlayerVariables.FAVORITE_TELEPORTS, ","))
|
|
||||||
{
|
{
|
||||||
if (TeleportListData.getInstance().getTeleport(_teleportId) == null)
|
if (TeleportListData.getInstance().getTeleport(_teleportId) == null)
|
||||||
{
|
{
|
||||||
@@ -71,7 +69,6 @@ public class ExRequestTeleportFavoritesAddDel implements IClientIncomingPacket
|
|||||||
favorites.add(id);
|
favorites.add(id);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
if (_enable)
|
if (_enable)
|
||||||
{
|
{
|
||||||
@@ -85,18 +82,6 @@ public class ExRequestTeleportFavoritesAddDel implements IClientIncomingPacket
|
|||||||
favorites.remove((Integer) _teleportId);
|
favorites.remove((Integer) _teleportId);
|
||||||
}
|
}
|
||||||
|
|
||||||
String variable = "";
|
player.getVariables().setIntegerList(PlayerVariables.FAVORITE_TELEPORTS, favorites);
|
||||||
for (int id : favorites)
|
|
||||||
{
|
|
||||||
variable += id + ",";
|
|
||||||
}
|
|
||||||
if (variable.isEmpty())
|
|
||||||
{
|
|
||||||
player.getVariables().remove(PlayerVariables.FAVORITE_TELEPORTS);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
player.getVariables().set(PlayerVariables.FAVORITE_TELEPORTS, variable);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
+5
-10
@@ -16,6 +16,8 @@
|
|||||||
*/
|
*/
|
||||||
package org.l2jmobius.gameserver.network.serverpackets.teleports;
|
package org.l2jmobius.gameserver.network.serverpackets.teleports;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
import org.l2jmobius.commons.network.PacketWriter;
|
import org.l2jmobius.commons.network.PacketWriter;
|
||||||
import org.l2jmobius.gameserver.model.actor.instance.PlayerInstance;
|
import org.l2jmobius.gameserver.model.actor.instance.PlayerInstance;
|
||||||
import org.l2jmobius.gameserver.model.variables.PlayerVariables;
|
import org.l2jmobius.gameserver.model.variables.PlayerVariables;
|
||||||
@@ -27,19 +29,12 @@ import org.l2jmobius.gameserver.network.serverpackets.IClientOutgoingPacket;
|
|||||||
*/
|
*/
|
||||||
public class ExTeleportFavoritesList implements IClientOutgoingPacket
|
public class ExTeleportFavoritesList implements IClientOutgoingPacket
|
||||||
{
|
{
|
||||||
private final int[] _teleports;
|
private final List<Integer> _teleports;
|
||||||
private final boolean _enable;
|
private final boolean _enable;
|
||||||
|
|
||||||
public ExTeleportFavoritesList(PlayerInstance player, boolean enable)
|
public ExTeleportFavoritesList(PlayerInstance player, boolean enable)
|
||||||
{
|
{
|
||||||
if (player.getVariables().contains(PlayerVariables.FAVORITE_TELEPORTS))
|
_teleports = player.getVariables().getIntegerList(PlayerVariables.FAVORITE_TELEPORTS);
|
||||||
{
|
|
||||||
_teleports = player.getVariables().getIntArray(PlayerVariables.FAVORITE_TELEPORTS, ",");
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
_teleports = new int[0];
|
|
||||||
}
|
|
||||||
_enable = enable;
|
_enable = enable;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -49,7 +44,7 @@ public class ExTeleportFavoritesList implements IClientOutgoingPacket
|
|||||||
OutgoingPackets.EX_TELEPORT_FAVORITES_LIST.writeId(packet);
|
OutgoingPackets.EX_TELEPORT_FAVORITES_LIST.writeId(packet);
|
||||||
|
|
||||||
packet.writeC(_enable ? 0x01 : 0x00);
|
packet.writeC(_enable ? 0x01 : 0x00);
|
||||||
packet.writeD(_teleports.length);
|
packet.writeD(_teleports.size());
|
||||||
for (int id : _teleports)
|
for (int id : _teleports)
|
||||||
{
|
{
|
||||||
packet.writeD(id);
|
packet.writeD(id);
|
||||||
|
|||||||
+38
-4
@@ -392,16 +392,50 @@ public class StatSet implements IParserAdvUtils
|
|||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
public List<Integer> getIntegerList(String key, String splitOn)
|
public List<Integer> getIntegerList(String key)
|
||||||
{
|
{
|
||||||
final List<Integer> result = new ArrayList<>();
|
final String val = getString(key, null);
|
||||||
for (int i : getIntArray(key, splitOn))
|
final List<Integer> result;
|
||||||
|
if (val != null)
|
||||||
{
|
{
|
||||||
result.add(i);
|
final String[] splitVal = val.split(",");
|
||||||
|
result = new ArrayList<>(splitVal.length + 1);
|
||||||
|
for (String split : splitVal)
|
||||||
|
{
|
||||||
|
result.add(Integer.parseInt(split));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
result = new ArrayList<>(1);
|
||||||
}
|
}
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void setIntegerList(String key, List<Integer> list)
|
||||||
|
{
|
||||||
|
if (key == null)
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if ((list == null) || list.isEmpty())
|
||||||
|
{
|
||||||
|
remove(key);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
final StringBuilder sb = new StringBuilder();
|
||||||
|
for (int element : list)
|
||||||
|
{
|
||||||
|
sb.append(element);
|
||||||
|
sb.append(",");
|
||||||
|
}
|
||||||
|
sb.deleteCharAt(sb.length() - 1); // Prettify value.
|
||||||
|
|
||||||
|
set(key, sb.toString());
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public long getLong(String key)
|
public long getLong(String key)
|
||||||
{
|
{
|
||||||
|
|||||||
+5
-40
@@ -14443,7 +14443,7 @@ public class PlayerInstance extends Playable
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
final List<Integer> positions = getVariables().getIntegerList(PlayerVariables.AUTO_USE_SHORTCUTS, ",");
|
final List<Integer> positions = getVariables().getIntegerList(PlayerVariables.AUTO_USE_SHORTCUTS);
|
||||||
for (Shortcut shortcut : getAllShortCuts())
|
for (Shortcut shortcut : getAllShortCuts())
|
||||||
{
|
{
|
||||||
final Integer position = shortcut.getSlot() + (shortcut.getPage() * ShortCuts.MAX_SHORTCUTS_PER_BAR);
|
final Integer position = shortcut.getSlot() + (shortcut.getPage() * ShortCuts.MAX_SHORTCUTS_PER_BAR);
|
||||||
@@ -14473,16 +14473,7 @@ public class PlayerInstance extends Playable
|
|||||||
|
|
||||||
public synchronized void addAutoShortcut(int slot, int page)
|
public synchronized void addAutoShortcut(int slot, int page)
|
||||||
{
|
{
|
||||||
final List<Integer> positions;
|
final List<Integer> positions = getVariables().getIntegerList(PlayerVariables.AUTO_USE_SHORTCUTS);
|
||||||
if (getVariables().contains(PlayerVariables.AUTO_USE_SHORTCUTS))
|
|
||||||
{
|
|
||||||
positions = getVariables().getIntegerList(PlayerVariables.AUTO_USE_SHORTCUTS, ",");
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
positions = new ArrayList<>();
|
|
||||||
}
|
|
||||||
|
|
||||||
final Shortcut usedShortcut = getShortCut(slot, page);
|
final Shortcut usedShortcut = getShortCut(slot, page);
|
||||||
if (usedShortcut == null)
|
if (usedShortcut == null)
|
||||||
{
|
{
|
||||||
@@ -14506,20 +14497,7 @@ public class PlayerInstance extends Playable
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
final StringBuilder variable = new StringBuilder();
|
getVariables().setIntegerList(PlayerVariables.AUTO_USE_SHORTCUTS, positions);
|
||||||
for (int id : positions)
|
|
||||||
{
|
|
||||||
variable.append(id);
|
|
||||||
variable.append(",");
|
|
||||||
}
|
|
||||||
if (variable.isEmpty())
|
|
||||||
{
|
|
||||||
getVariables().remove(PlayerVariables.AUTO_USE_SHORTCUTS);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
getVariables().set(PlayerVariables.AUTO_USE_SHORTCUTS, variable.toString());
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public synchronized void removeAutoShortcut(int slot, int page)
|
public synchronized void removeAutoShortcut(int slot, int page)
|
||||||
@@ -14529,7 +14507,7 @@ public class PlayerInstance extends Playable
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
final List<Integer> positions = getVariables().getIntegerList(PlayerVariables.AUTO_USE_SHORTCUTS, ",");
|
final List<Integer> positions = getVariables().getIntegerList(PlayerVariables.AUTO_USE_SHORTCUTS);
|
||||||
final Shortcut usedShortcut = getShortCut(slot, page);
|
final Shortcut usedShortcut = getShortCut(slot, page);
|
||||||
if (usedShortcut == null)
|
if (usedShortcut == null)
|
||||||
{
|
{
|
||||||
@@ -14550,20 +14528,7 @@ public class PlayerInstance extends Playable
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
final StringBuilder variable = new StringBuilder();
|
getVariables().setIntegerList(PlayerVariables.AUTO_USE_SHORTCUTS, positions);
|
||||||
for (int id : positions)
|
|
||||||
{
|
|
||||||
variable.append(id);
|
|
||||||
variable.append(",");
|
|
||||||
}
|
|
||||||
if (variable.isEmpty())
|
|
||||||
{
|
|
||||||
getVariables().remove(PlayerVariables.AUTO_USE_SHORTCUTS);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
getVariables().set(PlayerVariables.AUTO_USE_SHORTCUTS, variable.toString());
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean isInTimedHuntingZone(int zoneId)
|
public boolean isInTimedHuntingZone(int zoneId)
|
||||||
|
|||||||
+3
-17
@@ -76,9 +76,9 @@ public class RequestShortCutReg implements IClientIncomingPacket
|
|||||||
player.sendPacket(new ExActivateAutoShortcut(sc, _active));
|
player.sendPacket(new ExActivateAutoShortcut(sc, _active));
|
||||||
|
|
||||||
// When id is not auto used, deactivate auto shortcuts.
|
// When id is not auto used, deactivate auto shortcuts.
|
||||||
if (player.getVariables().contains(PlayerVariables.AUTO_USE_SHORTCUTS) && !player.getAutoUseSettings().getAutoSkills().contains(_id) && !player.getAutoUseSettings().getAutoSupplyItems().contains(_id))
|
if (!player.getAutoUseSettings().getAutoSkills().contains(_id) && !player.getAutoUseSettings().getAutoSupplyItems().contains(_id))
|
||||||
{
|
{
|
||||||
final List<Integer> positions = player.getVariables().getIntegerList(PlayerVariables.AUTO_USE_SHORTCUTS, ",");
|
final List<Integer> positions = player.getVariables().getIntegerList(PlayerVariables.AUTO_USE_SHORTCUTS);
|
||||||
final Integer position = _slot + (_page * ShortCuts.MAX_SHORTCUTS_PER_BAR);
|
final Integer position = _slot + (_page * ShortCuts.MAX_SHORTCUTS_PER_BAR);
|
||||||
if (!positions.contains(position))
|
if (!positions.contains(position))
|
||||||
{
|
{
|
||||||
@@ -86,21 +86,7 @@ public class RequestShortCutReg implements IClientIncomingPacket
|
|||||||
}
|
}
|
||||||
|
|
||||||
positions.remove(position);
|
positions.remove(position);
|
||||||
|
player.getVariables().setIntegerList(PlayerVariables.AUTO_USE_SHORTCUTS, positions);
|
||||||
final StringBuilder variable = new StringBuilder();
|
|
||||||
for (int id : positions)
|
|
||||||
{
|
|
||||||
variable.append(id);
|
|
||||||
variable.append(",");
|
|
||||||
}
|
|
||||||
if (variable.isEmpty())
|
|
||||||
{
|
|
||||||
player.getVariables().remove(PlayerVariables.AUTO_USE_SHORTCUTS);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
player.getVariables().set(PlayerVariables.AUTO_USE_SHORTCUTS, variable.toString());
|
|
||||||
}
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
+2
-17
@@ -58,9 +58,7 @@ public class ExRequestTeleportFavoritesAddDel implements IClientIncomingPacket
|
|||||||
}
|
}
|
||||||
|
|
||||||
final List<Integer> favorites = new ArrayList<>();
|
final List<Integer> favorites = new ArrayList<>();
|
||||||
if (player.getVariables().contains(PlayerVariables.FAVORITE_TELEPORTS))
|
for (int id : player.getVariables().getIntegerList(PlayerVariables.FAVORITE_TELEPORTS))
|
||||||
{
|
|
||||||
for (int id : player.getVariables().getIntArray(PlayerVariables.FAVORITE_TELEPORTS, ","))
|
|
||||||
{
|
{
|
||||||
if (TeleportListData.getInstance().getTeleport(_teleportId) == null)
|
if (TeleportListData.getInstance().getTeleport(_teleportId) == null)
|
||||||
{
|
{
|
||||||
@@ -71,7 +69,6 @@ public class ExRequestTeleportFavoritesAddDel implements IClientIncomingPacket
|
|||||||
favorites.add(id);
|
favorites.add(id);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
if (_enable)
|
if (_enable)
|
||||||
{
|
{
|
||||||
@@ -85,18 +82,6 @@ public class ExRequestTeleportFavoritesAddDel implements IClientIncomingPacket
|
|||||||
favorites.remove((Integer) _teleportId);
|
favorites.remove((Integer) _teleportId);
|
||||||
}
|
}
|
||||||
|
|
||||||
String variable = "";
|
player.getVariables().setIntegerList(PlayerVariables.FAVORITE_TELEPORTS, favorites);
|
||||||
for (int id : favorites)
|
|
||||||
{
|
|
||||||
variable += id + ",";
|
|
||||||
}
|
|
||||||
if (variable.isEmpty())
|
|
||||||
{
|
|
||||||
player.getVariables().remove(PlayerVariables.FAVORITE_TELEPORTS);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
player.getVariables().set(PlayerVariables.FAVORITE_TELEPORTS, variable);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
+5
-10
@@ -16,6 +16,8 @@
|
|||||||
*/
|
*/
|
||||||
package org.l2jmobius.gameserver.network.serverpackets.teleports;
|
package org.l2jmobius.gameserver.network.serverpackets.teleports;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
import org.l2jmobius.commons.network.PacketWriter;
|
import org.l2jmobius.commons.network.PacketWriter;
|
||||||
import org.l2jmobius.gameserver.model.actor.instance.PlayerInstance;
|
import org.l2jmobius.gameserver.model.actor.instance.PlayerInstance;
|
||||||
import org.l2jmobius.gameserver.model.variables.PlayerVariables;
|
import org.l2jmobius.gameserver.model.variables.PlayerVariables;
|
||||||
@@ -27,19 +29,12 @@ import org.l2jmobius.gameserver.network.serverpackets.IClientOutgoingPacket;
|
|||||||
*/
|
*/
|
||||||
public class ExTeleportFavoritesList implements IClientOutgoingPacket
|
public class ExTeleportFavoritesList implements IClientOutgoingPacket
|
||||||
{
|
{
|
||||||
private final int[] _teleports;
|
private final List<Integer> _teleports;
|
||||||
private final boolean _enable;
|
private final boolean _enable;
|
||||||
|
|
||||||
public ExTeleportFavoritesList(PlayerInstance player, boolean enable)
|
public ExTeleportFavoritesList(PlayerInstance player, boolean enable)
|
||||||
{
|
{
|
||||||
if (player.getVariables().contains(PlayerVariables.FAVORITE_TELEPORTS))
|
_teleports = player.getVariables().getIntegerList(PlayerVariables.FAVORITE_TELEPORTS);
|
||||||
{
|
|
||||||
_teleports = player.getVariables().getIntArray(PlayerVariables.FAVORITE_TELEPORTS, ",");
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
_teleports = new int[0];
|
|
||||||
}
|
|
||||||
_enable = enable;
|
_enable = enable;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -49,7 +44,7 @@ public class ExTeleportFavoritesList implements IClientOutgoingPacket
|
|||||||
OutgoingPackets.EX_TELEPORT_FAVORITES_LIST.writeId(packet);
|
OutgoingPackets.EX_TELEPORT_FAVORITES_LIST.writeId(packet);
|
||||||
|
|
||||||
packet.writeC(_enable ? 0x01 : 0x00);
|
packet.writeC(_enable ? 0x01 : 0x00);
|
||||||
packet.writeD(_teleports.length);
|
packet.writeD(_teleports.size());
|
||||||
for (int id : _teleports)
|
for (int id : _teleports)
|
||||||
{
|
{
|
||||||
packet.writeD(id);
|
packet.writeD(id);
|
||||||
|
|||||||
@@ -391,16 +391,50 @@ public class StatSet implements IParserAdvUtils
|
|||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
public List<Integer> getIntegerList(String key, String splitOn)
|
public List<Integer> getIntegerList(String key)
|
||||||
{
|
{
|
||||||
final List<Integer> result = new ArrayList<>();
|
final String val = getString(key, null);
|
||||||
for (int i : getIntArray(key, splitOn))
|
final List<Integer> result;
|
||||||
|
if (val != null)
|
||||||
{
|
{
|
||||||
result.add(i);
|
final String[] splitVal = val.split(",");
|
||||||
|
result = new ArrayList<>(splitVal.length + 1);
|
||||||
|
for (String split : splitVal)
|
||||||
|
{
|
||||||
|
result.add(Integer.parseInt(split));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
result = new ArrayList<>(1);
|
||||||
}
|
}
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void setIntegerList(String key, List<Integer> list)
|
||||||
|
{
|
||||||
|
if (key == null)
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if ((list == null) || list.isEmpty())
|
||||||
|
{
|
||||||
|
remove(key);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
final StringBuilder sb = new StringBuilder();
|
||||||
|
for (int element : list)
|
||||||
|
{
|
||||||
|
sb.append(element);
|
||||||
|
sb.append(",");
|
||||||
|
}
|
||||||
|
sb.deleteCharAt(sb.length() - 1); // Prettify value.
|
||||||
|
|
||||||
|
set(key, sb.toString());
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public long getLong(String key)
|
public long getLong(String key)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -391,16 +391,50 @@ public class StatSet implements IParserAdvUtils
|
|||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
public List<Integer> getIntegerList(String key, String splitOn)
|
public List<Integer> getIntegerList(String key)
|
||||||
{
|
{
|
||||||
final List<Integer> result = new ArrayList<>();
|
final String val = getString(key, null);
|
||||||
for (int i : getIntArray(key, splitOn))
|
final List<Integer> result;
|
||||||
|
if (val != null)
|
||||||
{
|
{
|
||||||
result.add(i);
|
final String[] splitVal = val.split(",");
|
||||||
|
result = new ArrayList<>(splitVal.length + 1);
|
||||||
|
for (String split : splitVal)
|
||||||
|
{
|
||||||
|
result.add(Integer.parseInt(split));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
result = new ArrayList<>(1);
|
||||||
}
|
}
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void setIntegerList(String key, List<Integer> list)
|
||||||
|
{
|
||||||
|
if (key == null)
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if ((list == null) || list.isEmpty())
|
||||||
|
{
|
||||||
|
remove(key);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
final StringBuilder sb = new StringBuilder();
|
||||||
|
for (int element : list)
|
||||||
|
{
|
||||||
|
sb.append(element);
|
||||||
|
sb.append(",");
|
||||||
|
}
|
||||||
|
sb.deleteCharAt(sb.length() - 1); // Prettify value.
|
||||||
|
|
||||||
|
set(key, sb.toString());
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public long getLong(String key)
|
public long getLong(String key)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -392,16 +392,50 @@ public class StatSet implements IParserAdvUtils
|
|||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
public List<Integer> getIntegerList(String key, String splitOn)
|
public List<Integer> getIntegerList(String key)
|
||||||
{
|
{
|
||||||
final List<Integer> result = new ArrayList<>();
|
final String val = getString(key, null);
|
||||||
for (int i : getIntArray(key, splitOn))
|
final List<Integer> result;
|
||||||
|
if (val != null)
|
||||||
{
|
{
|
||||||
result.add(i);
|
final String[] splitVal = val.split(",");
|
||||||
|
result = new ArrayList<>(splitVal.length + 1);
|
||||||
|
for (String split : splitVal)
|
||||||
|
{
|
||||||
|
result.add(Integer.parseInt(split));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
result = new ArrayList<>(1);
|
||||||
}
|
}
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void setIntegerList(String key, List<Integer> list)
|
||||||
|
{
|
||||||
|
if (key == null)
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if ((list == null) || list.isEmpty())
|
||||||
|
{
|
||||||
|
remove(key);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
final StringBuilder sb = new StringBuilder();
|
||||||
|
for (int element : list)
|
||||||
|
{
|
||||||
|
sb.append(element);
|
||||||
|
sb.append(",");
|
||||||
|
}
|
||||||
|
sb.deleteCharAt(sb.length() - 1); // Prettify value.
|
||||||
|
|
||||||
|
set(key, sb.toString());
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public long getLong(String key)
|
public long getLong(String key)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -392,16 +392,50 @@ public class StatSet implements IParserAdvUtils
|
|||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
public List<Integer> getIntegerList(String key, String splitOn)
|
public List<Integer> getIntegerList(String key)
|
||||||
{
|
{
|
||||||
final List<Integer> result = new ArrayList<>();
|
final String val = getString(key, null);
|
||||||
for (int i : getIntArray(key, splitOn))
|
final List<Integer> result;
|
||||||
|
if (val != null)
|
||||||
{
|
{
|
||||||
result.add(i);
|
final String[] splitVal = val.split(",");
|
||||||
|
result = new ArrayList<>(splitVal.length + 1);
|
||||||
|
for (String split : splitVal)
|
||||||
|
{
|
||||||
|
result.add(Integer.parseInt(split));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
result = new ArrayList<>(1);
|
||||||
}
|
}
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void setIntegerList(String key, List<Integer> list)
|
||||||
|
{
|
||||||
|
if (key == null)
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if ((list == null) || list.isEmpty())
|
||||||
|
{
|
||||||
|
remove(key);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
final StringBuilder sb = new StringBuilder();
|
||||||
|
for (int element : list)
|
||||||
|
{
|
||||||
|
sb.append(element);
|
||||||
|
sb.append(",");
|
||||||
|
}
|
||||||
|
sb.deleteCharAt(sb.length() - 1); // Prettify value.
|
||||||
|
|
||||||
|
set(key, sb.toString());
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public long getLong(String key)
|
public long getLong(String key)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -392,16 +392,50 @@ public class StatSet implements IParserAdvUtils
|
|||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
public List<Integer> getIntegerList(String key, String splitOn)
|
public List<Integer> getIntegerList(String key)
|
||||||
{
|
{
|
||||||
final List<Integer> result = new ArrayList<>();
|
final String val = getString(key, null);
|
||||||
for (int i : getIntArray(key, splitOn))
|
final List<Integer> result;
|
||||||
|
if (val != null)
|
||||||
{
|
{
|
||||||
result.add(i);
|
final String[] splitVal = val.split(",");
|
||||||
|
result = new ArrayList<>(splitVal.length + 1);
|
||||||
|
for (String split : splitVal)
|
||||||
|
{
|
||||||
|
result.add(Integer.parseInt(split));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
result = new ArrayList<>(1);
|
||||||
}
|
}
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void setIntegerList(String key, List<Integer> list)
|
||||||
|
{
|
||||||
|
if (key == null)
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if ((list == null) || list.isEmpty())
|
||||||
|
{
|
||||||
|
remove(key);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
final StringBuilder sb = new StringBuilder();
|
||||||
|
for (int element : list)
|
||||||
|
{
|
||||||
|
sb.append(element);
|
||||||
|
sb.append(",");
|
||||||
|
}
|
||||||
|
sb.deleteCharAt(sb.length() - 1); // Prettify value.
|
||||||
|
|
||||||
|
set(key, sb.toString());
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public long getLong(String key)
|
public long getLong(String key)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -392,16 +392,50 @@ public class StatSet implements IParserAdvUtils
|
|||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
public List<Integer> getIntegerList(String key, String splitOn)
|
public List<Integer> getIntegerList(String key)
|
||||||
{
|
{
|
||||||
final List<Integer> result = new ArrayList<>();
|
final String val = getString(key, null);
|
||||||
for (int i : getIntArray(key, splitOn))
|
final List<Integer> result;
|
||||||
|
if (val != null)
|
||||||
{
|
{
|
||||||
result.add(i);
|
final String[] splitVal = val.split(",");
|
||||||
|
result = new ArrayList<>(splitVal.length + 1);
|
||||||
|
for (String split : splitVal)
|
||||||
|
{
|
||||||
|
result.add(Integer.parseInt(split));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
result = new ArrayList<>(1);
|
||||||
}
|
}
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void setIntegerList(String key, List<Integer> list)
|
||||||
|
{
|
||||||
|
if (key == null)
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if ((list == null) || list.isEmpty())
|
||||||
|
{
|
||||||
|
remove(key);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
final StringBuilder sb = new StringBuilder();
|
||||||
|
for (int element : list)
|
||||||
|
{
|
||||||
|
sb.append(element);
|
||||||
|
sb.append(",");
|
||||||
|
}
|
||||||
|
sb.deleteCharAt(sb.length() - 1); // Prettify value.
|
||||||
|
|
||||||
|
set(key, sb.toString());
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public long getLong(String key)
|
public long getLong(String key)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -392,16 +392,50 @@ public class StatSet implements IParserAdvUtils
|
|||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
public List<Integer> getIntegerList(String key, String splitOn)
|
public List<Integer> getIntegerList(String key)
|
||||||
{
|
{
|
||||||
final List<Integer> result = new ArrayList<>();
|
final String val = getString(key, null);
|
||||||
for (int i : getIntArray(key, splitOn))
|
final List<Integer> result;
|
||||||
|
if (val != null)
|
||||||
{
|
{
|
||||||
result.add(i);
|
final String[] splitVal = val.split(",");
|
||||||
|
result = new ArrayList<>(splitVal.length + 1);
|
||||||
|
for (String split : splitVal)
|
||||||
|
{
|
||||||
|
result.add(Integer.parseInt(split));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
result = new ArrayList<>(1);
|
||||||
}
|
}
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void setIntegerList(String key, List<Integer> list)
|
||||||
|
{
|
||||||
|
if (key == null)
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if ((list == null) || list.isEmpty())
|
||||||
|
{
|
||||||
|
remove(key);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
final StringBuilder sb = new StringBuilder();
|
||||||
|
for (int element : list)
|
||||||
|
{
|
||||||
|
sb.append(element);
|
||||||
|
sb.append(",");
|
||||||
|
}
|
||||||
|
sb.deleteCharAt(sb.length() - 1); // Prettify value.
|
||||||
|
|
||||||
|
set(key, sb.toString());
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public long getLong(String key)
|
public long getLong(String key)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -392,16 +392,50 @@ public class StatSet implements IParserAdvUtils
|
|||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
public List<Integer> getIntegerList(String key, String splitOn)
|
public List<Integer> getIntegerList(String key)
|
||||||
{
|
{
|
||||||
final List<Integer> result = new ArrayList<>();
|
final String val = getString(key, null);
|
||||||
for (int i : getIntArray(key, splitOn))
|
final List<Integer> result;
|
||||||
|
if (val != null)
|
||||||
{
|
{
|
||||||
result.add(i);
|
final String[] splitVal = val.split(",");
|
||||||
|
result = new ArrayList<>(splitVal.length + 1);
|
||||||
|
for (String split : splitVal)
|
||||||
|
{
|
||||||
|
result.add(Integer.parseInt(split));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
result = new ArrayList<>(1);
|
||||||
}
|
}
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void setIntegerList(String key, List<Integer> list)
|
||||||
|
{
|
||||||
|
if (key == null)
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if ((list == null) || list.isEmpty())
|
||||||
|
{
|
||||||
|
remove(key);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
final StringBuilder sb = new StringBuilder();
|
||||||
|
for (int element : list)
|
||||||
|
{
|
||||||
|
sb.append(element);
|
||||||
|
sb.append(",");
|
||||||
|
}
|
||||||
|
sb.deleteCharAt(sb.length() - 1); // Prettify value.
|
||||||
|
|
||||||
|
set(key, sb.toString());
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public long getLong(String key)
|
public long getLong(String key)
|
||||||
{
|
{
|
||||||
|
|||||||
+38
-4
@@ -392,16 +392,50 @@ public class StatSet implements IParserAdvUtils
|
|||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
public List<Integer> getIntegerList(String key, String splitOn)
|
public List<Integer> getIntegerList(String key)
|
||||||
{
|
{
|
||||||
final List<Integer> result = new ArrayList<>();
|
final String val = getString(key, null);
|
||||||
for (int i : getIntArray(key, splitOn))
|
final List<Integer> result;
|
||||||
|
if (val != null)
|
||||||
{
|
{
|
||||||
result.add(i);
|
final String[] splitVal = val.split(",");
|
||||||
|
result = new ArrayList<>(splitVal.length + 1);
|
||||||
|
for (String split : splitVal)
|
||||||
|
{
|
||||||
|
result.add(Integer.parseInt(split));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
result = new ArrayList<>(1);
|
||||||
}
|
}
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void setIntegerList(String key, List<Integer> list)
|
||||||
|
{
|
||||||
|
if (key == null)
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if ((list == null) || list.isEmpty())
|
||||||
|
{
|
||||||
|
remove(key);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
final StringBuilder sb = new StringBuilder();
|
||||||
|
for (int element : list)
|
||||||
|
{
|
||||||
|
sb.append(element);
|
||||||
|
sb.append(",");
|
||||||
|
}
|
||||||
|
sb.deleteCharAt(sb.length() - 1); // Prettify value.
|
||||||
|
|
||||||
|
set(key, sb.toString());
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public long getLong(String key)
|
public long getLong(String key)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -392,16 +392,50 @@ public class StatSet implements IParserAdvUtils
|
|||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
public List<Integer> getIntegerList(String key, String splitOn)
|
public List<Integer> getIntegerList(String key)
|
||||||
{
|
{
|
||||||
final List<Integer> result = new ArrayList<>();
|
final String val = getString(key, null);
|
||||||
for (int i : getIntArray(key, splitOn))
|
final List<Integer> result;
|
||||||
|
if (val != null)
|
||||||
{
|
{
|
||||||
result.add(i);
|
final String[] splitVal = val.split(",");
|
||||||
|
result = new ArrayList<>(splitVal.length + 1);
|
||||||
|
for (String split : splitVal)
|
||||||
|
{
|
||||||
|
result.add(Integer.parseInt(split));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
result = new ArrayList<>(1);
|
||||||
}
|
}
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void setIntegerList(String key, List<Integer> list)
|
||||||
|
{
|
||||||
|
if (key == null)
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if ((list == null) || list.isEmpty())
|
||||||
|
{
|
||||||
|
remove(key);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
final StringBuilder sb = new StringBuilder();
|
||||||
|
for (int element : list)
|
||||||
|
{
|
||||||
|
sb.append(element);
|
||||||
|
sb.append(",");
|
||||||
|
}
|
||||||
|
sb.deleteCharAt(sb.length() - 1); // Prettify value.
|
||||||
|
|
||||||
|
set(key, sb.toString());
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public long getLong(String key)
|
public long getLong(String key)
|
||||||
{
|
{
|
||||||
|
|||||||
+5
-40
@@ -14316,7 +14316,7 @@ public class PlayerInstance extends Playable
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
final List<Integer> positions = getVariables().getIntegerList(PlayerVariables.AUTO_USE_SHORTCUTS, ",");
|
final List<Integer> positions = getVariables().getIntegerList(PlayerVariables.AUTO_USE_SHORTCUTS);
|
||||||
for (Shortcut shortcut : getAllShortCuts())
|
for (Shortcut shortcut : getAllShortCuts())
|
||||||
{
|
{
|
||||||
final Integer position = shortcut.getSlot() + (shortcut.getPage() * ShortCuts.MAX_SHORTCUTS_PER_BAR);
|
final Integer position = shortcut.getSlot() + (shortcut.getPage() * ShortCuts.MAX_SHORTCUTS_PER_BAR);
|
||||||
@@ -14346,16 +14346,7 @@ public class PlayerInstance extends Playable
|
|||||||
|
|
||||||
public synchronized void addAutoShortcut(int slot, int page)
|
public synchronized void addAutoShortcut(int slot, int page)
|
||||||
{
|
{
|
||||||
final List<Integer> positions;
|
final List<Integer> positions = getVariables().getIntegerList(PlayerVariables.AUTO_USE_SHORTCUTS);
|
||||||
if (getVariables().contains(PlayerVariables.AUTO_USE_SHORTCUTS))
|
|
||||||
{
|
|
||||||
positions = getVariables().getIntegerList(PlayerVariables.AUTO_USE_SHORTCUTS, ",");
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
positions = new ArrayList<>();
|
|
||||||
}
|
|
||||||
|
|
||||||
final Shortcut usedShortcut = getShortCut(slot, page);
|
final Shortcut usedShortcut = getShortCut(slot, page);
|
||||||
if (usedShortcut == null)
|
if (usedShortcut == null)
|
||||||
{
|
{
|
||||||
@@ -14379,20 +14370,7 @@ public class PlayerInstance extends Playable
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
final StringBuilder variable = new StringBuilder();
|
getVariables().setIntegerList(PlayerVariables.AUTO_USE_SHORTCUTS, positions);
|
||||||
for (int id : positions)
|
|
||||||
{
|
|
||||||
variable.append(id);
|
|
||||||
variable.append(",");
|
|
||||||
}
|
|
||||||
if (variable.isEmpty())
|
|
||||||
{
|
|
||||||
getVariables().remove(PlayerVariables.AUTO_USE_SHORTCUTS);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
getVariables().set(PlayerVariables.AUTO_USE_SHORTCUTS, variable.toString());
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public synchronized void removeAutoShortcut(int slot, int page)
|
public synchronized void removeAutoShortcut(int slot, int page)
|
||||||
@@ -14402,7 +14380,7 @@ public class PlayerInstance extends Playable
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
final List<Integer> positions = getVariables().getIntegerList(PlayerVariables.AUTO_USE_SHORTCUTS, ",");
|
final List<Integer> positions = getVariables().getIntegerList(PlayerVariables.AUTO_USE_SHORTCUTS);
|
||||||
final Shortcut usedShortcut = getShortCut(slot, page);
|
final Shortcut usedShortcut = getShortCut(slot, page);
|
||||||
if (usedShortcut == null)
|
if (usedShortcut == null)
|
||||||
{
|
{
|
||||||
@@ -14423,20 +14401,7 @@ public class PlayerInstance extends Playable
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
final StringBuilder variable = new StringBuilder();
|
getVariables().setIntegerList(PlayerVariables.AUTO_USE_SHORTCUTS, positions);
|
||||||
for (int id : positions)
|
|
||||||
{
|
|
||||||
variable.append(id);
|
|
||||||
variable.append(",");
|
|
||||||
}
|
|
||||||
if (variable.isEmpty())
|
|
||||||
{
|
|
||||||
getVariables().remove(PlayerVariables.AUTO_USE_SHORTCUTS);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
getVariables().set(PlayerVariables.AUTO_USE_SHORTCUTS, variable.toString());
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean isInTimedHuntingZone(int zoneId)
|
public boolean isInTimedHuntingZone(int zoneId)
|
||||||
|
|||||||
+3
-17
@@ -76,9 +76,9 @@ public class RequestShortCutReg implements IClientIncomingPacket
|
|||||||
player.sendPacket(new ExActivateAutoShortcut(sc, _active));
|
player.sendPacket(new ExActivateAutoShortcut(sc, _active));
|
||||||
|
|
||||||
// When id is not auto used, deactivate auto shortcuts.
|
// When id is not auto used, deactivate auto shortcuts.
|
||||||
if (player.getVariables().contains(PlayerVariables.AUTO_USE_SHORTCUTS) && !player.getAutoUseSettings().getAutoSkills().contains(_id) && !player.getAutoUseSettings().getAutoSupplyItems().contains(_id))
|
if (!player.getAutoUseSettings().getAutoSkills().contains(_id) && !player.getAutoUseSettings().getAutoSupplyItems().contains(_id))
|
||||||
{
|
{
|
||||||
final List<Integer> positions = player.getVariables().getIntegerList(PlayerVariables.AUTO_USE_SHORTCUTS, ",");
|
final List<Integer> positions = player.getVariables().getIntegerList(PlayerVariables.AUTO_USE_SHORTCUTS);
|
||||||
final Integer position = _slot + (_page * ShortCuts.MAX_SHORTCUTS_PER_BAR);
|
final Integer position = _slot + (_page * ShortCuts.MAX_SHORTCUTS_PER_BAR);
|
||||||
if (!positions.contains(position))
|
if (!positions.contains(position))
|
||||||
{
|
{
|
||||||
@@ -86,21 +86,7 @@ public class RequestShortCutReg implements IClientIncomingPacket
|
|||||||
}
|
}
|
||||||
|
|
||||||
positions.remove(position);
|
positions.remove(position);
|
||||||
|
player.getVariables().setIntegerList(PlayerVariables.AUTO_USE_SHORTCUTS, positions);
|
||||||
final StringBuilder variable = new StringBuilder();
|
|
||||||
for (int id : positions)
|
|
||||||
{
|
|
||||||
variable.append(id);
|
|
||||||
variable.append(",");
|
|
||||||
}
|
|
||||||
if (variable.isEmpty())
|
|
||||||
{
|
|
||||||
player.getVariables().remove(PlayerVariables.AUTO_USE_SHORTCUTS);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
player.getVariables().set(PlayerVariables.AUTO_USE_SHORTCUTS, variable.toString());
|
|
||||||
}
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -392,16 +392,50 @@ public class StatSet implements IParserAdvUtils
|
|||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
public List<Integer> getIntegerList(String key, String splitOn)
|
public List<Integer> getIntegerList(String key)
|
||||||
{
|
{
|
||||||
final List<Integer> result = new ArrayList<>();
|
final String val = getString(key, null);
|
||||||
for (int i : getIntArray(key, splitOn))
|
final List<Integer> result;
|
||||||
|
if (val != null)
|
||||||
{
|
{
|
||||||
result.add(i);
|
final String[] splitVal = val.split(",");
|
||||||
|
result = new ArrayList<>(splitVal.length + 1);
|
||||||
|
for (String split : splitVal)
|
||||||
|
{
|
||||||
|
result.add(Integer.parseInt(split));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
result = new ArrayList<>(1);
|
||||||
}
|
}
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void setIntegerList(String key, List<Integer> list)
|
||||||
|
{
|
||||||
|
if (key == null)
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if ((list == null) || list.isEmpty())
|
||||||
|
{
|
||||||
|
remove(key);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
final StringBuilder sb = new StringBuilder();
|
||||||
|
for (int element : list)
|
||||||
|
{
|
||||||
|
sb.append(element);
|
||||||
|
sb.append(",");
|
||||||
|
}
|
||||||
|
sb.deleteCharAt(sb.length() - 1); // Prettify value.
|
||||||
|
|
||||||
|
set(key, sb.toString());
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public long getLong(String key)
|
public long getLong(String key)
|
||||||
{
|
{
|
||||||
|
|||||||
+38
-4
@@ -392,16 +392,50 @@ public class StatSet implements IParserAdvUtils
|
|||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
public List<Integer> getIntegerList(String key, String splitOn)
|
public List<Integer> getIntegerList(String key)
|
||||||
{
|
{
|
||||||
final List<Integer> result = new ArrayList<>();
|
final String val = getString(key, null);
|
||||||
for (int i : getIntArray(key, splitOn))
|
final List<Integer> result;
|
||||||
|
if (val != null)
|
||||||
{
|
{
|
||||||
result.add(i);
|
final String[] splitVal = val.split(",");
|
||||||
|
result = new ArrayList<>(splitVal.length + 1);
|
||||||
|
for (String split : splitVal)
|
||||||
|
{
|
||||||
|
result.add(Integer.parseInt(split));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
result = new ArrayList<>(1);
|
||||||
}
|
}
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void setIntegerList(String key, List<Integer> list)
|
||||||
|
{
|
||||||
|
if (key == null)
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if ((list == null) || list.isEmpty())
|
||||||
|
{
|
||||||
|
remove(key);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
final StringBuilder sb = new StringBuilder();
|
||||||
|
for (int element : list)
|
||||||
|
{
|
||||||
|
sb.append(element);
|
||||||
|
sb.append(",");
|
||||||
|
}
|
||||||
|
sb.deleteCharAt(sb.length() - 1); // Prettify value.
|
||||||
|
|
||||||
|
set(key, sb.toString());
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public long getLong(String key)
|
public long getLong(String key)
|
||||||
{
|
{
|
||||||
|
|||||||
+5
-40
@@ -14576,7 +14576,7 @@ public class PlayerInstance extends Playable
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
final List<Integer> positions = getVariables().getIntegerList(PlayerVariables.AUTO_USE_SHORTCUTS, ",");
|
final List<Integer> positions = getVariables().getIntegerList(PlayerVariables.AUTO_USE_SHORTCUTS);
|
||||||
for (Shortcut shortcut : getAllShortCuts())
|
for (Shortcut shortcut : getAllShortCuts())
|
||||||
{
|
{
|
||||||
final Integer position = shortcut.getSlot() + (shortcut.getPage() * ShortCuts.MAX_SHORTCUTS_PER_BAR);
|
final Integer position = shortcut.getSlot() + (shortcut.getPage() * ShortCuts.MAX_SHORTCUTS_PER_BAR);
|
||||||
@@ -14606,16 +14606,7 @@ public class PlayerInstance extends Playable
|
|||||||
|
|
||||||
public synchronized void addAutoShortcut(int slot, int page)
|
public synchronized void addAutoShortcut(int slot, int page)
|
||||||
{
|
{
|
||||||
final List<Integer> positions;
|
final List<Integer> positions = getVariables().getIntegerList(PlayerVariables.AUTO_USE_SHORTCUTS);
|
||||||
if (getVariables().contains(PlayerVariables.AUTO_USE_SHORTCUTS))
|
|
||||||
{
|
|
||||||
positions = getVariables().getIntegerList(PlayerVariables.AUTO_USE_SHORTCUTS, ",");
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
positions = new ArrayList<>();
|
|
||||||
}
|
|
||||||
|
|
||||||
final Shortcut usedShortcut = getShortCut(slot, page);
|
final Shortcut usedShortcut = getShortCut(slot, page);
|
||||||
if (usedShortcut == null)
|
if (usedShortcut == null)
|
||||||
{
|
{
|
||||||
@@ -14639,20 +14630,7 @@ public class PlayerInstance extends Playable
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
final StringBuilder variable = new StringBuilder();
|
getVariables().setIntegerList(PlayerVariables.AUTO_USE_SHORTCUTS, positions);
|
||||||
for (int id : positions)
|
|
||||||
{
|
|
||||||
variable.append(id);
|
|
||||||
variable.append(",");
|
|
||||||
}
|
|
||||||
if (variable.isEmpty())
|
|
||||||
{
|
|
||||||
getVariables().remove(PlayerVariables.AUTO_USE_SHORTCUTS);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
getVariables().set(PlayerVariables.AUTO_USE_SHORTCUTS, variable.toString());
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public synchronized void removeAutoShortcut(int slot, int page)
|
public synchronized void removeAutoShortcut(int slot, int page)
|
||||||
@@ -14662,7 +14640,7 @@ public class PlayerInstance extends Playable
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
final List<Integer> positions = getVariables().getIntegerList(PlayerVariables.AUTO_USE_SHORTCUTS, ",");
|
final List<Integer> positions = getVariables().getIntegerList(PlayerVariables.AUTO_USE_SHORTCUTS);
|
||||||
final Shortcut usedShortcut = getShortCut(slot, page);
|
final Shortcut usedShortcut = getShortCut(slot, page);
|
||||||
if (usedShortcut == null)
|
if (usedShortcut == null)
|
||||||
{
|
{
|
||||||
@@ -14683,20 +14661,7 @@ public class PlayerInstance extends Playable
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
final StringBuilder variable = new StringBuilder();
|
getVariables().setIntegerList(PlayerVariables.AUTO_USE_SHORTCUTS, positions);
|
||||||
for (int id : positions)
|
|
||||||
{
|
|
||||||
variable.append(id);
|
|
||||||
variable.append(",");
|
|
||||||
}
|
|
||||||
if (variable.isEmpty())
|
|
||||||
{
|
|
||||||
getVariables().remove(PlayerVariables.AUTO_USE_SHORTCUTS);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
getVariables().set(PlayerVariables.AUTO_USE_SHORTCUTS, variable.toString());
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean isInTimedHuntingZone(int zoneId)
|
public boolean isInTimedHuntingZone(int zoneId)
|
||||||
|
|||||||
+3
-17
@@ -76,9 +76,9 @@ public class RequestShortCutReg implements IClientIncomingPacket
|
|||||||
player.sendPacket(new ExActivateAutoShortcut(sc, _active));
|
player.sendPacket(new ExActivateAutoShortcut(sc, _active));
|
||||||
|
|
||||||
// When id is not auto used, deactivate auto shortcuts.
|
// When id is not auto used, deactivate auto shortcuts.
|
||||||
if (player.getVariables().contains(PlayerVariables.AUTO_USE_SHORTCUTS) && !player.getAutoUseSettings().getAutoSkills().contains(_id) && !player.getAutoUseSettings().getAutoSupplyItems().contains(_id))
|
if (!player.getAutoUseSettings().getAutoSkills().contains(_id) && !player.getAutoUseSettings().getAutoSupplyItems().contains(_id))
|
||||||
{
|
{
|
||||||
final List<Integer> positions = player.getVariables().getIntegerList(PlayerVariables.AUTO_USE_SHORTCUTS, ",");
|
final List<Integer> positions = player.getVariables().getIntegerList(PlayerVariables.AUTO_USE_SHORTCUTS);
|
||||||
final Integer position = _slot + (_page * ShortCuts.MAX_SHORTCUTS_PER_BAR);
|
final Integer position = _slot + (_page * ShortCuts.MAX_SHORTCUTS_PER_BAR);
|
||||||
if (!positions.contains(position))
|
if (!positions.contains(position))
|
||||||
{
|
{
|
||||||
@@ -86,21 +86,7 @@ public class RequestShortCutReg implements IClientIncomingPacket
|
|||||||
}
|
}
|
||||||
|
|
||||||
positions.remove(position);
|
positions.remove(position);
|
||||||
|
player.getVariables().setIntegerList(PlayerVariables.AUTO_USE_SHORTCUTS, positions);
|
||||||
final StringBuilder variable = new StringBuilder();
|
|
||||||
for (int id : positions)
|
|
||||||
{
|
|
||||||
variable.append(id);
|
|
||||||
variable.append(",");
|
|
||||||
}
|
|
||||||
if (variable.isEmpty())
|
|
||||||
{
|
|
||||||
player.getVariables().remove(PlayerVariables.AUTO_USE_SHORTCUTS);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
player.getVariables().set(PlayerVariables.AUTO_USE_SHORTCUTS, variable.toString());
|
|
||||||
}
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
+2
-17
@@ -58,9 +58,7 @@ public class ExRequestTeleportFavoritesAddDel implements IClientIncomingPacket
|
|||||||
}
|
}
|
||||||
|
|
||||||
final List<Integer> favorites = new ArrayList<>();
|
final List<Integer> favorites = new ArrayList<>();
|
||||||
if (player.getVariables().contains(PlayerVariables.FAVORITE_TELEPORTS))
|
for (int id : player.getVariables().getIntegerList(PlayerVariables.FAVORITE_TELEPORTS))
|
||||||
{
|
|
||||||
for (int id : player.getVariables().getIntArray(PlayerVariables.FAVORITE_TELEPORTS, ","))
|
|
||||||
{
|
{
|
||||||
if (TeleportListData.getInstance().getTeleport(_teleportId) == null)
|
if (TeleportListData.getInstance().getTeleport(_teleportId) == null)
|
||||||
{
|
{
|
||||||
@@ -71,7 +69,6 @@ public class ExRequestTeleportFavoritesAddDel implements IClientIncomingPacket
|
|||||||
favorites.add(id);
|
favorites.add(id);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
if (_enable)
|
if (_enable)
|
||||||
{
|
{
|
||||||
@@ -85,18 +82,6 @@ public class ExRequestTeleportFavoritesAddDel implements IClientIncomingPacket
|
|||||||
favorites.remove((Integer) _teleportId);
|
favorites.remove((Integer) _teleportId);
|
||||||
}
|
}
|
||||||
|
|
||||||
String variable = "";
|
player.getVariables().setIntegerList(PlayerVariables.FAVORITE_TELEPORTS, favorites);
|
||||||
for (int id : favorites)
|
|
||||||
{
|
|
||||||
variable += id + ",";
|
|
||||||
}
|
|
||||||
if (variable.isEmpty())
|
|
||||||
{
|
|
||||||
player.getVariables().remove(PlayerVariables.FAVORITE_TELEPORTS);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
player.getVariables().set(PlayerVariables.FAVORITE_TELEPORTS, variable);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
+5
-10
@@ -16,6 +16,8 @@
|
|||||||
*/
|
*/
|
||||||
package org.l2jmobius.gameserver.network.serverpackets.teleports;
|
package org.l2jmobius.gameserver.network.serverpackets.teleports;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
import org.l2jmobius.commons.network.PacketWriter;
|
import org.l2jmobius.commons.network.PacketWriter;
|
||||||
import org.l2jmobius.gameserver.model.actor.instance.PlayerInstance;
|
import org.l2jmobius.gameserver.model.actor.instance.PlayerInstance;
|
||||||
import org.l2jmobius.gameserver.model.variables.PlayerVariables;
|
import org.l2jmobius.gameserver.model.variables.PlayerVariables;
|
||||||
@@ -27,19 +29,12 @@ import org.l2jmobius.gameserver.network.serverpackets.IClientOutgoingPacket;
|
|||||||
*/
|
*/
|
||||||
public class ExTeleportFavoritesList implements IClientOutgoingPacket
|
public class ExTeleportFavoritesList implements IClientOutgoingPacket
|
||||||
{
|
{
|
||||||
private final int[] _teleports;
|
private final List<Integer> _teleports;
|
||||||
private final boolean _enable;
|
private final boolean _enable;
|
||||||
|
|
||||||
public ExTeleportFavoritesList(PlayerInstance player, boolean enable)
|
public ExTeleportFavoritesList(PlayerInstance player, boolean enable)
|
||||||
{
|
{
|
||||||
if (player.getVariables().contains(PlayerVariables.FAVORITE_TELEPORTS))
|
_teleports = player.getVariables().getIntegerList(PlayerVariables.FAVORITE_TELEPORTS);
|
||||||
{
|
|
||||||
_teleports = player.getVariables().getIntArray(PlayerVariables.FAVORITE_TELEPORTS, ",");
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
_teleports = new int[0];
|
|
||||||
}
|
|
||||||
_enable = enable;
|
_enable = enable;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -49,7 +44,7 @@ public class ExTeleportFavoritesList implements IClientOutgoingPacket
|
|||||||
OutgoingPackets.EX_TELEPORT_FAVORITES_LIST.writeId(packet);
|
OutgoingPackets.EX_TELEPORT_FAVORITES_LIST.writeId(packet);
|
||||||
|
|
||||||
packet.writeC(_enable ? 0x01 : 0x00);
|
packet.writeC(_enable ? 0x01 : 0x00);
|
||||||
packet.writeD(_teleports.length);
|
packet.writeD(_teleports.size());
|
||||||
for (int id : _teleports)
|
for (int id : _teleports)
|
||||||
{
|
{
|
||||||
packet.writeD(id);
|
packet.writeD(id);
|
||||||
|
|||||||
@@ -392,16 +392,50 @@ public class StatSet implements IParserAdvUtils
|
|||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
public List<Integer> getIntegerList(String key, String splitOn)
|
public List<Integer> getIntegerList(String key)
|
||||||
{
|
{
|
||||||
final List<Integer> result = new ArrayList<>();
|
final String val = getString(key, null);
|
||||||
for (int i : getIntArray(key, splitOn))
|
final List<Integer> result;
|
||||||
|
if (val != null)
|
||||||
{
|
{
|
||||||
result.add(i);
|
final String[] splitVal = val.split(",");
|
||||||
|
result = new ArrayList<>(splitVal.length + 1);
|
||||||
|
for (String split : splitVal)
|
||||||
|
{
|
||||||
|
result.add(Integer.parseInt(split));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
result = new ArrayList<>(1);
|
||||||
}
|
}
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void setIntegerList(String key, List<Integer> list)
|
||||||
|
{
|
||||||
|
if (key == null)
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if ((list == null) || list.isEmpty())
|
||||||
|
{
|
||||||
|
remove(key);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
final StringBuilder sb = new StringBuilder();
|
||||||
|
for (int element : list)
|
||||||
|
{
|
||||||
|
sb.append(element);
|
||||||
|
sb.append(",");
|
||||||
|
}
|
||||||
|
sb.deleteCharAt(sb.length() - 1); // Prettify value.
|
||||||
|
|
||||||
|
set(key, sb.toString());
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public long getLong(String key)
|
public long getLong(String key)
|
||||||
{
|
{
|
||||||
|
|||||||
+5
-40
@@ -14653,7 +14653,7 @@ public class PlayerInstance extends Playable
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
final List<Integer> positions = getVariables().getIntegerList(PlayerVariables.AUTO_USE_SHORTCUTS, ",");
|
final List<Integer> positions = getVariables().getIntegerList(PlayerVariables.AUTO_USE_SHORTCUTS);
|
||||||
for (Shortcut shortcut : getAllShortCuts())
|
for (Shortcut shortcut : getAllShortCuts())
|
||||||
{
|
{
|
||||||
final Integer position = shortcut.getSlot() + (shortcut.getPage() * ShortCuts.MAX_SHORTCUTS_PER_BAR);
|
final Integer position = shortcut.getSlot() + (shortcut.getPage() * ShortCuts.MAX_SHORTCUTS_PER_BAR);
|
||||||
@@ -14683,16 +14683,7 @@ public class PlayerInstance extends Playable
|
|||||||
|
|
||||||
public synchronized void addAutoShortcut(int slot, int page)
|
public synchronized void addAutoShortcut(int slot, int page)
|
||||||
{
|
{
|
||||||
final List<Integer> positions;
|
final List<Integer> positions = getVariables().getIntegerList(PlayerVariables.AUTO_USE_SHORTCUTS);
|
||||||
if (getVariables().contains(PlayerVariables.AUTO_USE_SHORTCUTS))
|
|
||||||
{
|
|
||||||
positions = getVariables().getIntegerList(PlayerVariables.AUTO_USE_SHORTCUTS, ",");
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
positions = new ArrayList<>();
|
|
||||||
}
|
|
||||||
|
|
||||||
final Shortcut usedShortcut = getShortCut(slot, page);
|
final Shortcut usedShortcut = getShortCut(slot, page);
|
||||||
if (usedShortcut == null)
|
if (usedShortcut == null)
|
||||||
{
|
{
|
||||||
@@ -14716,20 +14707,7 @@ public class PlayerInstance extends Playable
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
final StringBuilder variable = new StringBuilder();
|
getVariables().setIntegerList(PlayerVariables.AUTO_USE_SHORTCUTS, positions);
|
||||||
for (int id : positions)
|
|
||||||
{
|
|
||||||
variable.append(id);
|
|
||||||
variable.append(",");
|
|
||||||
}
|
|
||||||
if (variable.isEmpty())
|
|
||||||
{
|
|
||||||
getVariables().remove(PlayerVariables.AUTO_USE_SHORTCUTS);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
getVariables().set(PlayerVariables.AUTO_USE_SHORTCUTS, variable.toString());
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public synchronized void removeAutoShortcut(int slot, int page)
|
public synchronized void removeAutoShortcut(int slot, int page)
|
||||||
@@ -14739,7 +14717,7 @@ public class PlayerInstance extends Playable
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
final List<Integer> positions = getVariables().getIntegerList(PlayerVariables.AUTO_USE_SHORTCUTS, ",");
|
final List<Integer> positions = getVariables().getIntegerList(PlayerVariables.AUTO_USE_SHORTCUTS);
|
||||||
final Shortcut usedShortcut = getShortCut(slot, page);
|
final Shortcut usedShortcut = getShortCut(slot, page);
|
||||||
if (usedShortcut == null)
|
if (usedShortcut == null)
|
||||||
{
|
{
|
||||||
@@ -14760,20 +14738,7 @@ public class PlayerInstance extends Playable
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
final StringBuilder variable = new StringBuilder();
|
getVariables().setIntegerList(PlayerVariables.AUTO_USE_SHORTCUTS, positions);
|
||||||
for (int id : positions)
|
|
||||||
{
|
|
||||||
variable.append(id);
|
|
||||||
variable.append(",");
|
|
||||||
}
|
|
||||||
if (variable.isEmpty())
|
|
||||||
{
|
|
||||||
getVariables().remove(PlayerVariables.AUTO_USE_SHORTCUTS);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
getVariables().set(PlayerVariables.AUTO_USE_SHORTCUTS, variable.toString());
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean isInTimedHuntingZone(int zoneId)
|
public boolean isInTimedHuntingZone(int zoneId)
|
||||||
|
|||||||
+3
-17
@@ -76,9 +76,9 @@ public class RequestShortCutReg implements IClientIncomingPacket
|
|||||||
player.sendPacket(new ExActivateAutoShortcut(sc, _active));
|
player.sendPacket(new ExActivateAutoShortcut(sc, _active));
|
||||||
|
|
||||||
// When id is not auto used, deactivate auto shortcuts.
|
// When id is not auto used, deactivate auto shortcuts.
|
||||||
if (player.getVariables().contains(PlayerVariables.AUTO_USE_SHORTCUTS) && !player.getAutoUseSettings().getAutoSkills().contains(_id) && !player.getAutoUseSettings().getAutoSupplyItems().contains(_id))
|
if (!player.getAutoUseSettings().getAutoSkills().contains(_id) && !player.getAutoUseSettings().getAutoSupplyItems().contains(_id))
|
||||||
{
|
{
|
||||||
final List<Integer> positions = player.getVariables().getIntegerList(PlayerVariables.AUTO_USE_SHORTCUTS, ",");
|
final List<Integer> positions = player.getVariables().getIntegerList(PlayerVariables.AUTO_USE_SHORTCUTS);
|
||||||
final Integer position = _slot + (_page * ShortCuts.MAX_SHORTCUTS_PER_BAR);
|
final Integer position = _slot + (_page * ShortCuts.MAX_SHORTCUTS_PER_BAR);
|
||||||
if (!positions.contains(position))
|
if (!positions.contains(position))
|
||||||
{
|
{
|
||||||
@@ -86,21 +86,7 @@ public class RequestShortCutReg implements IClientIncomingPacket
|
|||||||
}
|
}
|
||||||
|
|
||||||
positions.remove(position);
|
positions.remove(position);
|
||||||
|
player.getVariables().setIntegerList(PlayerVariables.AUTO_USE_SHORTCUTS, positions);
|
||||||
final StringBuilder variable = new StringBuilder();
|
|
||||||
for (int id : positions)
|
|
||||||
{
|
|
||||||
variable.append(id);
|
|
||||||
variable.append(",");
|
|
||||||
}
|
|
||||||
if (variable.isEmpty())
|
|
||||||
{
|
|
||||||
player.getVariables().remove(PlayerVariables.AUTO_USE_SHORTCUTS);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
player.getVariables().set(PlayerVariables.AUTO_USE_SHORTCUTS, variable.toString());
|
|
||||||
}
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
+2
-17
@@ -58,9 +58,7 @@ public class ExRequestTeleportFavoritesAddDel implements IClientIncomingPacket
|
|||||||
}
|
}
|
||||||
|
|
||||||
final List<Integer> favorites = new ArrayList<>();
|
final List<Integer> favorites = new ArrayList<>();
|
||||||
if (player.getVariables().contains(PlayerVariables.FAVORITE_TELEPORTS))
|
for (int id : player.getVariables().getIntegerList(PlayerVariables.FAVORITE_TELEPORTS))
|
||||||
{
|
|
||||||
for (int id : player.getVariables().getIntArray(PlayerVariables.FAVORITE_TELEPORTS, ","))
|
|
||||||
{
|
{
|
||||||
if (TeleportListData.getInstance().getTeleport(_teleportId) == null)
|
if (TeleportListData.getInstance().getTeleport(_teleportId) == null)
|
||||||
{
|
{
|
||||||
@@ -71,7 +69,6 @@ public class ExRequestTeleportFavoritesAddDel implements IClientIncomingPacket
|
|||||||
favorites.add(id);
|
favorites.add(id);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
if (_enable)
|
if (_enable)
|
||||||
{
|
{
|
||||||
@@ -85,18 +82,6 @@ public class ExRequestTeleportFavoritesAddDel implements IClientIncomingPacket
|
|||||||
favorites.remove((Integer) _teleportId);
|
favorites.remove((Integer) _teleportId);
|
||||||
}
|
}
|
||||||
|
|
||||||
String variable = "";
|
player.getVariables().setIntegerList(PlayerVariables.FAVORITE_TELEPORTS, favorites);
|
||||||
for (int id : favorites)
|
|
||||||
{
|
|
||||||
variable += id + ",";
|
|
||||||
}
|
|
||||||
if (variable.isEmpty())
|
|
||||||
{
|
|
||||||
player.getVariables().remove(PlayerVariables.FAVORITE_TELEPORTS);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
player.getVariables().set(PlayerVariables.FAVORITE_TELEPORTS, variable);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
+5
-10
@@ -16,6 +16,8 @@
|
|||||||
*/
|
*/
|
||||||
package org.l2jmobius.gameserver.network.serverpackets.teleports;
|
package org.l2jmobius.gameserver.network.serverpackets.teleports;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
import org.l2jmobius.commons.network.PacketWriter;
|
import org.l2jmobius.commons.network.PacketWriter;
|
||||||
import org.l2jmobius.gameserver.model.actor.instance.PlayerInstance;
|
import org.l2jmobius.gameserver.model.actor.instance.PlayerInstance;
|
||||||
import org.l2jmobius.gameserver.model.variables.PlayerVariables;
|
import org.l2jmobius.gameserver.model.variables.PlayerVariables;
|
||||||
@@ -27,19 +29,12 @@ import org.l2jmobius.gameserver.network.serverpackets.IClientOutgoingPacket;
|
|||||||
*/
|
*/
|
||||||
public class ExTeleportFavoritesList implements IClientOutgoingPacket
|
public class ExTeleportFavoritesList implements IClientOutgoingPacket
|
||||||
{
|
{
|
||||||
private final int[] _teleports;
|
private final List<Integer> _teleports;
|
||||||
private final boolean _enable;
|
private final boolean _enable;
|
||||||
|
|
||||||
public ExTeleportFavoritesList(PlayerInstance player, boolean enable)
|
public ExTeleportFavoritesList(PlayerInstance player, boolean enable)
|
||||||
{
|
{
|
||||||
if (player.getVariables().contains(PlayerVariables.FAVORITE_TELEPORTS))
|
_teleports = player.getVariables().getIntegerList(PlayerVariables.FAVORITE_TELEPORTS);
|
||||||
{
|
|
||||||
_teleports = player.getVariables().getIntArray(PlayerVariables.FAVORITE_TELEPORTS, ",");
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
_teleports = new int[0];
|
|
||||||
}
|
|
||||||
_enable = enable;
|
_enable = enable;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -49,7 +44,7 @@ public class ExTeleportFavoritesList implements IClientOutgoingPacket
|
|||||||
OutgoingPackets.EX_TELEPORT_FAVORITES_LIST.writeId(packet);
|
OutgoingPackets.EX_TELEPORT_FAVORITES_LIST.writeId(packet);
|
||||||
|
|
||||||
packet.writeC(_enable ? 0x01 : 0x00);
|
packet.writeC(_enable ? 0x01 : 0x00);
|
||||||
packet.writeD(_teleports.length);
|
packet.writeD(_teleports.size());
|
||||||
for (int id : _teleports)
|
for (int id : _teleports)
|
||||||
{
|
{
|
||||||
packet.writeD(id);
|
packet.writeD(id);
|
||||||
|
|||||||
Reference in New Issue
Block a user