From ebfc7864ee6833445e56df70918232ebe7444a91 Mon Sep 17 00:00:00 2001 From: MobiusDevelopment <8391001+MobiusDevelopment@users.noreply.github.com> Date: Wed, 20 Oct 2021 17:26:31 +0000 Subject: [PATCH] Addition of StatSet integer map methods. --- .../l2jmobius/gameserver/model/StatSet.java | 48 +++++++++++++++++++ .../l2jmobius/gameserver/model/StatSet.java | 48 +++++++++++++++++++ .../l2jmobius/gameserver/model/StatSet.java | 48 +++++++++++++++++++ .../l2jmobius/gameserver/model/StatSet.java | 48 +++++++++++++++++++ .../l2jmobius/gameserver/model/StatSet.java | 48 +++++++++++++++++++ .../l2jmobius/gameserver/model/StatSet.java | 48 +++++++++++++++++++ .../l2jmobius/gameserver/model/StatSet.java | 48 +++++++++++++++++++ .../l2jmobius/gameserver/model/StatSet.java | 48 +++++++++++++++++++ .../l2jmobius/gameserver/model/StatSet.java | 48 +++++++++++++++++++ .../l2jmobius/gameserver/model/StatSet.java | 48 +++++++++++++++++++ .../l2jmobius/gameserver/model/StatSet.java | 48 +++++++++++++++++++ .../l2jmobius/gameserver/model/StatSet.java | 48 +++++++++++++++++++ .../l2jmobius/gameserver/model/StatSet.java | 48 +++++++++++++++++++ .../l2jmobius/gameserver/model/StatSet.java | 48 +++++++++++++++++++ .../l2jmobius/gameserver/model/StatSet.java | 48 +++++++++++++++++++ .../l2jmobius/gameserver/model/StatSet.java | 48 +++++++++++++++++++ .../l2jmobius/gameserver/model/StatSet.java | 48 +++++++++++++++++++ .../l2jmobius/gameserver/model/StatSet.java | 48 +++++++++++++++++++ .../l2jmobius/gameserver/model/StatSet.java | 48 +++++++++++++++++++ .../l2jmobius/gameserver/model/StatSet.java | 48 +++++++++++++++++++ .../l2jmobius/gameserver/model/StatSet.java | 48 +++++++++++++++++++ .../l2jmobius/gameserver/model/StatSet.java | 48 +++++++++++++++++++ .../l2jmobius/gameserver/model/StatSet.java | 48 +++++++++++++++++++ 23 files changed, 1104 insertions(+) diff --git a/L2J_Mobius_01.0_Ertheia/java/org/l2jmobius/gameserver/model/StatSet.java b/L2J_Mobius_01.0_Ertheia/java/org/l2jmobius/gameserver/model/StatSet.java index 17fa5f31b8..af83f67c49 100644 --- a/L2J_Mobius_01.0_Ertheia/java/org/l2jmobius/gameserver/model/StatSet.java +++ b/L2J_Mobius_01.0_Ertheia/java/org/l2jmobius/gameserver/model/StatSet.java @@ -22,6 +22,7 @@ import java.util.Collections; import java.util.HashMap; import java.util.List; import java.util.Map; +import java.util.Map.Entry; import java.util.function.Supplier; import java.util.logging.Level; import java.util.logging.Logger; @@ -436,6 +437,53 @@ public class StatSet implements IParserAdvUtils set(key, sb.toString()); } + public Map getIntegerMap(String key) + { + final String val = getString(key, null); + final Map result; + if (val != null) + { + final String[] splitVal = val.split(","); + result = new HashMap<>(splitVal.length + 1); + for (String split : splitVal) + { + final String[] entry = split.split("-"); + result.put(Integer.parseInt(entry[0]), Integer.parseInt(entry[1])); + } + } + else + { + result = new HashMap<>(1); + } + return result; + } + + public void setIntegerMap(String key, Map map) + { + if (key == null) + { + return; + } + + if ((map == null) || map.isEmpty()) + { + remove(key); + return; + } + + final StringBuilder sb = new StringBuilder(); + for (Entry entry : map.entrySet()) + { + sb.append(entry.getKey()); + sb.append("-"); + sb.append(entry.getValue()); + sb.append(","); + } + sb.deleteCharAt(sb.length() - 1); // Prettify value. + + set(key, sb.toString()); + } + @Override public long getLong(String key) { diff --git a/L2J_Mobius_02.5_Underground/java/org/l2jmobius/gameserver/model/StatSet.java b/L2J_Mobius_02.5_Underground/java/org/l2jmobius/gameserver/model/StatSet.java index 17fa5f31b8..af83f67c49 100644 --- a/L2J_Mobius_02.5_Underground/java/org/l2jmobius/gameserver/model/StatSet.java +++ b/L2J_Mobius_02.5_Underground/java/org/l2jmobius/gameserver/model/StatSet.java @@ -22,6 +22,7 @@ import java.util.Collections; import java.util.HashMap; import java.util.List; import java.util.Map; +import java.util.Map.Entry; import java.util.function.Supplier; import java.util.logging.Level; import java.util.logging.Logger; @@ -436,6 +437,53 @@ public class StatSet implements IParserAdvUtils set(key, sb.toString()); } + public Map getIntegerMap(String key) + { + final String val = getString(key, null); + final Map result; + if (val != null) + { + final String[] splitVal = val.split(","); + result = new HashMap<>(splitVal.length + 1); + for (String split : splitVal) + { + final String[] entry = split.split("-"); + result.put(Integer.parseInt(entry[0]), Integer.parseInt(entry[1])); + } + } + else + { + result = new HashMap<>(1); + } + return result; + } + + public void setIntegerMap(String key, Map map) + { + if (key == null) + { + return; + } + + if ((map == null) || map.isEmpty()) + { + remove(key); + return; + } + + final StringBuilder sb = new StringBuilder(); + for (Entry entry : map.entrySet()) + { + sb.append(entry.getKey()); + sb.append("-"); + sb.append(entry.getValue()); + sb.append(","); + } + sb.deleteCharAt(sb.length() - 1); // Prettify value. + + set(key, sb.toString()); + } + @Override public long getLong(String key) { diff --git a/L2J_Mobius_03.0_Helios/java/org/l2jmobius/gameserver/model/StatSet.java b/L2J_Mobius_03.0_Helios/java/org/l2jmobius/gameserver/model/StatSet.java index 17fa5f31b8..af83f67c49 100644 --- a/L2J_Mobius_03.0_Helios/java/org/l2jmobius/gameserver/model/StatSet.java +++ b/L2J_Mobius_03.0_Helios/java/org/l2jmobius/gameserver/model/StatSet.java @@ -22,6 +22,7 @@ import java.util.Collections; import java.util.HashMap; import java.util.List; import java.util.Map; +import java.util.Map.Entry; import java.util.function.Supplier; import java.util.logging.Level; import java.util.logging.Logger; @@ -436,6 +437,53 @@ public class StatSet implements IParserAdvUtils set(key, sb.toString()); } + public Map getIntegerMap(String key) + { + final String val = getString(key, null); + final Map result; + if (val != null) + { + final String[] splitVal = val.split(","); + result = new HashMap<>(splitVal.length + 1); + for (String split : splitVal) + { + final String[] entry = split.split("-"); + result.put(Integer.parseInt(entry[0]), Integer.parseInt(entry[1])); + } + } + else + { + result = new HashMap<>(1); + } + return result; + } + + public void setIntegerMap(String key, Map map) + { + if (key == null) + { + return; + } + + if ((map == null) || map.isEmpty()) + { + remove(key); + return; + } + + final StringBuilder sb = new StringBuilder(); + for (Entry entry : map.entrySet()) + { + sb.append(entry.getKey()); + sb.append("-"); + sb.append(entry.getValue()); + sb.append(","); + } + sb.deleteCharAt(sb.length() - 1); // Prettify value. + + set(key, sb.toString()); + } + @Override public long getLong(String key) { diff --git a/L2J_Mobius_04.0_GrandCrusade/java/org/l2jmobius/gameserver/model/StatSet.java b/L2J_Mobius_04.0_GrandCrusade/java/org/l2jmobius/gameserver/model/StatSet.java index 17fa5f31b8..af83f67c49 100644 --- a/L2J_Mobius_04.0_GrandCrusade/java/org/l2jmobius/gameserver/model/StatSet.java +++ b/L2J_Mobius_04.0_GrandCrusade/java/org/l2jmobius/gameserver/model/StatSet.java @@ -22,6 +22,7 @@ import java.util.Collections; import java.util.HashMap; import java.util.List; import java.util.Map; +import java.util.Map.Entry; import java.util.function.Supplier; import java.util.logging.Level; import java.util.logging.Logger; @@ -436,6 +437,53 @@ public class StatSet implements IParserAdvUtils set(key, sb.toString()); } + public Map getIntegerMap(String key) + { + final String val = getString(key, null); + final Map result; + if (val != null) + { + final String[] splitVal = val.split(","); + result = new HashMap<>(splitVal.length + 1); + for (String split : splitVal) + { + final String[] entry = split.split("-"); + result.put(Integer.parseInt(entry[0]), Integer.parseInt(entry[1])); + } + } + else + { + result = new HashMap<>(1); + } + return result; + } + + public void setIntegerMap(String key, Map map) + { + if (key == null) + { + return; + } + + if ((map == null) || map.isEmpty()) + { + remove(key); + return; + } + + final StringBuilder sb = new StringBuilder(); + for (Entry entry : map.entrySet()) + { + sb.append(entry.getKey()); + sb.append("-"); + sb.append(entry.getValue()); + sb.append(","); + } + sb.deleteCharAt(sb.length() - 1); // Prettify value. + + set(key, sb.toString()); + } + @Override public long getLong(String key) { diff --git a/L2J_Mobius_05.0_Salvation/java/org/l2jmobius/gameserver/model/StatSet.java b/L2J_Mobius_05.0_Salvation/java/org/l2jmobius/gameserver/model/StatSet.java index 17fa5f31b8..af83f67c49 100644 --- a/L2J_Mobius_05.0_Salvation/java/org/l2jmobius/gameserver/model/StatSet.java +++ b/L2J_Mobius_05.0_Salvation/java/org/l2jmobius/gameserver/model/StatSet.java @@ -22,6 +22,7 @@ import java.util.Collections; import java.util.HashMap; import java.util.List; import java.util.Map; +import java.util.Map.Entry; import java.util.function.Supplier; import java.util.logging.Level; import java.util.logging.Logger; @@ -436,6 +437,53 @@ public class StatSet implements IParserAdvUtils set(key, sb.toString()); } + public Map getIntegerMap(String key) + { + final String val = getString(key, null); + final Map result; + if (val != null) + { + final String[] splitVal = val.split(","); + result = new HashMap<>(splitVal.length + 1); + for (String split : splitVal) + { + final String[] entry = split.split("-"); + result.put(Integer.parseInt(entry[0]), Integer.parseInt(entry[1])); + } + } + else + { + result = new HashMap<>(1); + } + return result; + } + + public void setIntegerMap(String key, Map map) + { + if (key == null) + { + return; + } + + if ((map == null) || map.isEmpty()) + { + remove(key); + return; + } + + final StringBuilder sb = new StringBuilder(); + for (Entry entry : map.entrySet()) + { + sb.append(entry.getKey()); + sb.append("-"); + sb.append(entry.getValue()); + sb.append(","); + } + sb.deleteCharAt(sb.length() - 1); // Prettify value. + + set(key, sb.toString()); + } + @Override public long getLong(String key) { diff --git a/L2J_Mobius_05.5_EtinasFate/java/org/l2jmobius/gameserver/model/StatSet.java b/L2J_Mobius_05.5_EtinasFate/java/org/l2jmobius/gameserver/model/StatSet.java index 17fa5f31b8..af83f67c49 100644 --- a/L2J_Mobius_05.5_EtinasFate/java/org/l2jmobius/gameserver/model/StatSet.java +++ b/L2J_Mobius_05.5_EtinasFate/java/org/l2jmobius/gameserver/model/StatSet.java @@ -22,6 +22,7 @@ import java.util.Collections; import java.util.HashMap; import java.util.List; import java.util.Map; +import java.util.Map.Entry; import java.util.function.Supplier; import java.util.logging.Level; import java.util.logging.Logger; @@ -436,6 +437,53 @@ public class StatSet implements IParserAdvUtils set(key, sb.toString()); } + public Map getIntegerMap(String key) + { + final String val = getString(key, null); + final Map result; + if (val != null) + { + final String[] splitVal = val.split(","); + result = new HashMap<>(splitVal.length + 1); + for (String split : splitVal) + { + final String[] entry = split.split("-"); + result.put(Integer.parseInt(entry[0]), Integer.parseInt(entry[1])); + } + } + else + { + result = new HashMap<>(1); + } + return result; + } + + public void setIntegerMap(String key, Map map) + { + if (key == null) + { + return; + } + + if ((map == null) || map.isEmpty()) + { + remove(key); + return; + } + + final StringBuilder sb = new StringBuilder(); + for (Entry entry : map.entrySet()) + { + sb.append(entry.getKey()); + sb.append("-"); + sb.append(entry.getValue()); + sb.append(","); + } + sb.deleteCharAt(sb.length() - 1); // Prettify value. + + set(key, sb.toString()); + } + @Override public long getLong(String key) { diff --git a/L2J_Mobius_06.0_Fafurion/java/org/l2jmobius/gameserver/model/StatSet.java b/L2J_Mobius_06.0_Fafurion/java/org/l2jmobius/gameserver/model/StatSet.java index 17fa5f31b8..af83f67c49 100644 --- a/L2J_Mobius_06.0_Fafurion/java/org/l2jmobius/gameserver/model/StatSet.java +++ b/L2J_Mobius_06.0_Fafurion/java/org/l2jmobius/gameserver/model/StatSet.java @@ -22,6 +22,7 @@ import java.util.Collections; import java.util.HashMap; import java.util.List; import java.util.Map; +import java.util.Map.Entry; import java.util.function.Supplier; import java.util.logging.Level; import java.util.logging.Logger; @@ -436,6 +437,53 @@ public class StatSet implements IParserAdvUtils set(key, sb.toString()); } + public Map getIntegerMap(String key) + { + final String val = getString(key, null); + final Map result; + if (val != null) + { + final String[] splitVal = val.split(","); + result = new HashMap<>(splitVal.length + 1); + for (String split : splitVal) + { + final String[] entry = split.split("-"); + result.put(Integer.parseInt(entry[0]), Integer.parseInt(entry[1])); + } + } + else + { + result = new HashMap<>(1); + } + return result; + } + + public void setIntegerMap(String key, Map map) + { + if (key == null) + { + return; + } + + if ((map == null) || map.isEmpty()) + { + remove(key); + return; + } + + final StringBuilder sb = new StringBuilder(); + for (Entry entry : map.entrySet()) + { + sb.append(entry.getKey()); + sb.append("-"); + sb.append(entry.getValue()); + sb.append(","); + } + sb.deleteCharAt(sb.length() - 1); // Prettify value. + + set(key, sb.toString()); + } + @Override public long getLong(String key) { diff --git a/L2J_Mobius_07.0_PreludeOfWar/java/org/l2jmobius/gameserver/model/StatSet.java b/L2J_Mobius_07.0_PreludeOfWar/java/org/l2jmobius/gameserver/model/StatSet.java index 17fa5f31b8..af83f67c49 100644 --- a/L2J_Mobius_07.0_PreludeOfWar/java/org/l2jmobius/gameserver/model/StatSet.java +++ b/L2J_Mobius_07.0_PreludeOfWar/java/org/l2jmobius/gameserver/model/StatSet.java @@ -22,6 +22,7 @@ import java.util.Collections; import java.util.HashMap; import java.util.List; import java.util.Map; +import java.util.Map.Entry; import java.util.function.Supplier; import java.util.logging.Level; import java.util.logging.Logger; @@ -436,6 +437,53 @@ public class StatSet implements IParserAdvUtils set(key, sb.toString()); } + public Map getIntegerMap(String key) + { + final String val = getString(key, null); + final Map result; + if (val != null) + { + final String[] splitVal = val.split(","); + result = new HashMap<>(splitVal.length + 1); + for (String split : splitVal) + { + final String[] entry = split.split("-"); + result.put(Integer.parseInt(entry[0]), Integer.parseInt(entry[1])); + } + } + else + { + result = new HashMap<>(1); + } + return result; + } + + public void setIntegerMap(String key, Map map) + { + if (key == null) + { + return; + } + + if ((map == null) || map.isEmpty()) + { + remove(key); + return; + } + + final StringBuilder sb = new StringBuilder(); + for (Entry entry : map.entrySet()) + { + sb.append(entry.getKey()); + sb.append("-"); + sb.append(entry.getValue()); + sb.append(","); + } + sb.deleteCharAt(sb.length() - 1); // Prettify value. + + set(key, sb.toString()); + } + @Override public long getLong(String key) { diff --git a/L2J_Mobius_08.2_Homunculus/java/org/l2jmobius/gameserver/model/StatSet.java b/L2J_Mobius_08.2_Homunculus/java/org/l2jmobius/gameserver/model/StatSet.java index 17fa5f31b8..af83f67c49 100644 --- a/L2J_Mobius_08.2_Homunculus/java/org/l2jmobius/gameserver/model/StatSet.java +++ b/L2J_Mobius_08.2_Homunculus/java/org/l2jmobius/gameserver/model/StatSet.java @@ -22,6 +22,7 @@ import java.util.Collections; import java.util.HashMap; import java.util.List; import java.util.Map; +import java.util.Map.Entry; import java.util.function.Supplier; import java.util.logging.Level; import java.util.logging.Logger; @@ -436,6 +437,53 @@ public class StatSet implements IParserAdvUtils set(key, sb.toString()); } + public Map getIntegerMap(String key) + { + final String val = getString(key, null); + final Map result; + if (val != null) + { + final String[] splitVal = val.split(","); + result = new HashMap<>(splitVal.length + 1); + for (String split : splitVal) + { + final String[] entry = split.split("-"); + result.put(Integer.parseInt(entry[0]), Integer.parseInt(entry[1])); + } + } + else + { + result = new HashMap<>(1); + } + return result; + } + + public void setIntegerMap(String key, Map map) + { + if (key == null) + { + return; + } + + if ((map == null) || map.isEmpty()) + { + remove(key); + return; + } + + final StringBuilder sb = new StringBuilder(); + for (Entry entry : map.entrySet()) + { + sb.append(entry.getKey()); + sb.append("-"); + sb.append(entry.getValue()); + sb.append(","); + } + sb.deleteCharAt(sb.length() - 1); // Prettify value. + + set(key, sb.toString()); + } + @Override public long getLong(String key) { diff --git a/L2J_Mobius_09.2_ReturnOfTheQueenAnt/java/org/l2jmobius/gameserver/model/StatSet.java b/L2J_Mobius_09.2_ReturnOfTheQueenAnt/java/org/l2jmobius/gameserver/model/StatSet.java index 17fa5f31b8..af83f67c49 100644 --- a/L2J_Mobius_09.2_ReturnOfTheQueenAnt/java/org/l2jmobius/gameserver/model/StatSet.java +++ b/L2J_Mobius_09.2_ReturnOfTheQueenAnt/java/org/l2jmobius/gameserver/model/StatSet.java @@ -22,6 +22,7 @@ import java.util.Collections; import java.util.HashMap; import java.util.List; import java.util.Map; +import java.util.Map.Entry; import java.util.function.Supplier; import java.util.logging.Level; import java.util.logging.Logger; @@ -436,6 +437,53 @@ public class StatSet implements IParserAdvUtils set(key, sb.toString()); } + public Map getIntegerMap(String key) + { + final String val = getString(key, null); + final Map result; + if (val != null) + { + final String[] splitVal = val.split(","); + result = new HashMap<>(splitVal.length + 1); + for (String split : splitVal) + { + final String[] entry = split.split("-"); + result.put(Integer.parseInt(entry[0]), Integer.parseInt(entry[1])); + } + } + else + { + result = new HashMap<>(1); + } + return result; + } + + public void setIntegerMap(String key, Map map) + { + if (key == null) + { + return; + } + + if ((map == null) || map.isEmpty()) + { + remove(key); + return; + } + + final StringBuilder sb = new StringBuilder(); + for (Entry entry : map.entrySet()) + { + sb.append(entry.getKey()); + sb.append("-"); + sb.append(entry.getValue()); + sb.append(","); + } + sb.deleteCharAt(sb.length() - 1); // Prettify value. + + set(key, sb.toString()); + } + @Override public long getLong(String key) { diff --git a/L2J_Mobius_C4_ScionsOfDestiny/java/org/l2jmobius/gameserver/model/StatSet.java b/L2J_Mobius_C4_ScionsOfDestiny/java/org/l2jmobius/gameserver/model/StatSet.java index db8b324ff6..4946e7e3af 100644 --- a/L2J_Mobius_C4_ScionsOfDestiny/java/org/l2jmobius/gameserver/model/StatSet.java +++ b/L2J_Mobius_C4_ScionsOfDestiny/java/org/l2jmobius/gameserver/model/StatSet.java @@ -22,6 +22,7 @@ import java.util.Collections; import java.util.HashMap; import java.util.List; import java.util.Map; +import java.util.Map.Entry; import java.util.function.Supplier; import java.util.logging.Level; import java.util.logging.Logger; @@ -435,6 +436,53 @@ public class StatSet implements IParserAdvUtils set(key, sb.toString()); } + public Map getIntegerMap(String key) + { + final String val = getString(key, null); + final Map result; + if (val != null) + { + final String[] splitVal = val.split(","); + result = new HashMap<>(splitVal.length + 1); + for (String split : splitVal) + { + final String[] entry = split.split("-"); + result.put(Integer.parseInt(entry[0]), Integer.parseInt(entry[1])); + } + } + else + { + result = new HashMap<>(1); + } + return result; + } + + public void setIntegerMap(String key, Map map) + { + if (key == null) + { + return; + } + + if ((map == null) || map.isEmpty()) + { + remove(key); + return; + } + + final StringBuilder sb = new StringBuilder(); + for (Entry entry : map.entrySet()) + { + sb.append(entry.getKey()); + sb.append("-"); + sb.append(entry.getValue()); + sb.append(","); + } + sb.deleteCharAt(sb.length() - 1); // Prettify value. + + set(key, sb.toString()); + } + @Override public long getLong(String key) { diff --git a/L2J_Mobius_C6_Interlude/java/org/l2jmobius/gameserver/model/StatSet.java b/L2J_Mobius_C6_Interlude/java/org/l2jmobius/gameserver/model/StatSet.java index db8b324ff6..4946e7e3af 100644 --- a/L2J_Mobius_C6_Interlude/java/org/l2jmobius/gameserver/model/StatSet.java +++ b/L2J_Mobius_C6_Interlude/java/org/l2jmobius/gameserver/model/StatSet.java @@ -22,6 +22,7 @@ import java.util.Collections; import java.util.HashMap; import java.util.List; import java.util.Map; +import java.util.Map.Entry; import java.util.function.Supplier; import java.util.logging.Level; import java.util.logging.Logger; @@ -435,6 +436,53 @@ public class StatSet implements IParserAdvUtils set(key, sb.toString()); } + public Map getIntegerMap(String key) + { + final String val = getString(key, null); + final Map result; + if (val != null) + { + final String[] splitVal = val.split(","); + result = new HashMap<>(splitVal.length + 1); + for (String split : splitVal) + { + final String[] entry = split.split("-"); + result.put(Integer.parseInt(entry[0]), Integer.parseInt(entry[1])); + } + } + else + { + result = new HashMap<>(1); + } + return result; + } + + public void setIntegerMap(String key, Map map) + { + if (key == null) + { + return; + } + + if ((map == null) || map.isEmpty()) + { + remove(key); + return; + } + + final StringBuilder sb = new StringBuilder(); + for (Entry entry : map.entrySet()) + { + sb.append(entry.getKey()); + sb.append("-"); + sb.append(entry.getValue()); + sb.append(","); + } + sb.deleteCharAt(sb.length() - 1); // Prettify value. + + set(key, sb.toString()); + } + @Override public long getLong(String key) { diff --git a/L2J_Mobius_CT_2.4_Epilogue/java/org/l2jmobius/gameserver/model/StatSet.java b/L2J_Mobius_CT_2.4_Epilogue/java/org/l2jmobius/gameserver/model/StatSet.java index 17fa5f31b8..af83f67c49 100644 --- a/L2J_Mobius_CT_2.4_Epilogue/java/org/l2jmobius/gameserver/model/StatSet.java +++ b/L2J_Mobius_CT_2.4_Epilogue/java/org/l2jmobius/gameserver/model/StatSet.java @@ -22,6 +22,7 @@ import java.util.Collections; import java.util.HashMap; import java.util.List; import java.util.Map; +import java.util.Map.Entry; import java.util.function.Supplier; import java.util.logging.Level; import java.util.logging.Logger; @@ -436,6 +437,53 @@ public class StatSet implements IParserAdvUtils set(key, sb.toString()); } + public Map getIntegerMap(String key) + { + final String val = getString(key, null); + final Map result; + if (val != null) + { + final String[] splitVal = val.split(","); + result = new HashMap<>(splitVal.length + 1); + for (String split : splitVal) + { + final String[] entry = split.split("-"); + result.put(Integer.parseInt(entry[0]), Integer.parseInt(entry[1])); + } + } + else + { + result = new HashMap<>(1); + } + return result; + } + + public void setIntegerMap(String key, Map map) + { + if (key == null) + { + return; + } + + if ((map == null) || map.isEmpty()) + { + remove(key); + return; + } + + final StringBuilder sb = new StringBuilder(); + for (Entry entry : map.entrySet()) + { + sb.append(entry.getKey()); + sb.append("-"); + sb.append(entry.getValue()); + sb.append(","); + } + sb.deleteCharAt(sb.length() - 1); // Prettify value. + + set(key, sb.toString()); + } + @Override public long getLong(String key) { diff --git a/L2J_Mobius_CT_2.6_HighFive/java/org/l2jmobius/gameserver/model/StatSet.java b/L2J_Mobius_CT_2.6_HighFive/java/org/l2jmobius/gameserver/model/StatSet.java index 17fa5f31b8..af83f67c49 100644 --- a/L2J_Mobius_CT_2.6_HighFive/java/org/l2jmobius/gameserver/model/StatSet.java +++ b/L2J_Mobius_CT_2.6_HighFive/java/org/l2jmobius/gameserver/model/StatSet.java @@ -22,6 +22,7 @@ import java.util.Collections; import java.util.HashMap; import java.util.List; import java.util.Map; +import java.util.Map.Entry; import java.util.function.Supplier; import java.util.logging.Level; import java.util.logging.Logger; @@ -436,6 +437,53 @@ public class StatSet implements IParserAdvUtils set(key, sb.toString()); } + public Map getIntegerMap(String key) + { + final String val = getString(key, null); + final Map result; + if (val != null) + { + final String[] splitVal = val.split(","); + result = new HashMap<>(splitVal.length + 1); + for (String split : splitVal) + { + final String[] entry = split.split("-"); + result.put(Integer.parseInt(entry[0]), Integer.parseInt(entry[1])); + } + } + else + { + result = new HashMap<>(1); + } + return result; + } + + public void setIntegerMap(String key, Map map) + { + if (key == null) + { + return; + } + + if ((map == null) || map.isEmpty()) + { + remove(key); + return; + } + + final StringBuilder sb = new StringBuilder(); + for (Entry entry : map.entrySet()) + { + sb.append(entry.getKey()); + sb.append("-"); + sb.append(entry.getValue()); + sb.append(","); + } + sb.deleteCharAt(sb.length() - 1); // Prettify value. + + set(key, sb.toString()); + } + @Override public long getLong(String key) { diff --git a/L2J_Mobius_Classic_2.0_Saviors/java/org/l2jmobius/gameserver/model/StatSet.java b/L2J_Mobius_Classic_2.0_Saviors/java/org/l2jmobius/gameserver/model/StatSet.java index 17fa5f31b8..af83f67c49 100644 --- a/L2J_Mobius_Classic_2.0_Saviors/java/org/l2jmobius/gameserver/model/StatSet.java +++ b/L2J_Mobius_Classic_2.0_Saviors/java/org/l2jmobius/gameserver/model/StatSet.java @@ -22,6 +22,7 @@ import java.util.Collections; import java.util.HashMap; import java.util.List; import java.util.Map; +import java.util.Map.Entry; import java.util.function.Supplier; import java.util.logging.Level; import java.util.logging.Logger; @@ -436,6 +437,53 @@ public class StatSet implements IParserAdvUtils set(key, sb.toString()); } + public Map getIntegerMap(String key) + { + final String val = getString(key, null); + final Map result; + if (val != null) + { + final String[] splitVal = val.split(","); + result = new HashMap<>(splitVal.length + 1); + for (String split : splitVal) + { + final String[] entry = split.split("-"); + result.put(Integer.parseInt(entry[0]), Integer.parseInt(entry[1])); + } + } + else + { + result = new HashMap<>(1); + } + return result; + } + + public void setIntegerMap(String key, Map map) + { + if (key == null) + { + return; + } + + if ((map == null) || map.isEmpty()) + { + remove(key); + return; + } + + final StringBuilder sb = new StringBuilder(); + for (Entry entry : map.entrySet()) + { + sb.append(entry.getKey()); + sb.append("-"); + sb.append(entry.getValue()); + sb.append(","); + } + sb.deleteCharAt(sb.length() - 1); // Prettify value. + + set(key, sb.toString()); + } + @Override public long getLong(String key) { diff --git a/L2J_Mobius_Classic_2.1_Zaken/java/org/l2jmobius/gameserver/model/StatSet.java b/L2J_Mobius_Classic_2.1_Zaken/java/org/l2jmobius/gameserver/model/StatSet.java index 17fa5f31b8..af83f67c49 100644 --- a/L2J_Mobius_Classic_2.1_Zaken/java/org/l2jmobius/gameserver/model/StatSet.java +++ b/L2J_Mobius_Classic_2.1_Zaken/java/org/l2jmobius/gameserver/model/StatSet.java @@ -22,6 +22,7 @@ import java.util.Collections; import java.util.HashMap; import java.util.List; import java.util.Map; +import java.util.Map.Entry; import java.util.function.Supplier; import java.util.logging.Level; import java.util.logging.Logger; @@ -436,6 +437,53 @@ public class StatSet implements IParserAdvUtils set(key, sb.toString()); } + public Map getIntegerMap(String key) + { + final String val = getString(key, null); + final Map result; + if (val != null) + { + final String[] splitVal = val.split(","); + result = new HashMap<>(splitVal.length + 1); + for (String split : splitVal) + { + final String[] entry = split.split("-"); + result.put(Integer.parseInt(entry[0]), Integer.parseInt(entry[1])); + } + } + else + { + result = new HashMap<>(1); + } + return result; + } + + public void setIntegerMap(String key, Map map) + { + if (key == null) + { + return; + } + + if ((map == null) || map.isEmpty()) + { + remove(key); + return; + } + + final StringBuilder sb = new StringBuilder(); + for (Entry entry : map.entrySet()) + { + sb.append(entry.getKey()); + sb.append("-"); + sb.append(entry.getValue()); + sb.append(","); + } + sb.deleteCharAt(sb.length() - 1); // Prettify value. + + set(key, sb.toString()); + } + @Override public long getLong(String key) { diff --git a/L2J_Mobius_Classic_2.2_Antharas/java/org/l2jmobius/gameserver/model/StatSet.java b/L2J_Mobius_Classic_2.2_Antharas/java/org/l2jmobius/gameserver/model/StatSet.java index 17fa5f31b8..af83f67c49 100644 --- a/L2J_Mobius_Classic_2.2_Antharas/java/org/l2jmobius/gameserver/model/StatSet.java +++ b/L2J_Mobius_Classic_2.2_Antharas/java/org/l2jmobius/gameserver/model/StatSet.java @@ -22,6 +22,7 @@ import java.util.Collections; import java.util.HashMap; import java.util.List; import java.util.Map; +import java.util.Map.Entry; import java.util.function.Supplier; import java.util.logging.Level; import java.util.logging.Logger; @@ -436,6 +437,53 @@ public class StatSet implements IParserAdvUtils set(key, sb.toString()); } + public Map getIntegerMap(String key) + { + final String val = getString(key, null); + final Map result; + if (val != null) + { + final String[] splitVal = val.split(","); + result = new HashMap<>(splitVal.length + 1); + for (String split : splitVal) + { + final String[] entry = split.split("-"); + result.put(Integer.parseInt(entry[0]), Integer.parseInt(entry[1])); + } + } + else + { + result = new HashMap<>(1); + } + return result; + } + + public void setIntegerMap(String key, Map map) + { + if (key == null) + { + return; + } + + if ((map == null) || map.isEmpty()) + { + remove(key); + return; + } + + final StringBuilder sb = new StringBuilder(); + for (Entry entry : map.entrySet()) + { + sb.append(entry.getKey()); + sb.append("-"); + sb.append(entry.getValue()); + sb.append(","); + } + sb.deleteCharAt(sb.length() - 1); // Prettify value. + + set(key, sb.toString()); + } + @Override public long getLong(String key) { diff --git a/L2J_Mobius_Classic_2.3_SevenSigns/java/org/l2jmobius/gameserver/model/StatSet.java b/L2J_Mobius_Classic_2.3_SevenSigns/java/org/l2jmobius/gameserver/model/StatSet.java index 17fa5f31b8..af83f67c49 100644 --- a/L2J_Mobius_Classic_2.3_SevenSigns/java/org/l2jmobius/gameserver/model/StatSet.java +++ b/L2J_Mobius_Classic_2.3_SevenSigns/java/org/l2jmobius/gameserver/model/StatSet.java @@ -22,6 +22,7 @@ import java.util.Collections; import java.util.HashMap; import java.util.List; import java.util.Map; +import java.util.Map.Entry; import java.util.function.Supplier; import java.util.logging.Level; import java.util.logging.Logger; @@ -436,6 +437,53 @@ public class StatSet implements IParserAdvUtils set(key, sb.toString()); } + public Map getIntegerMap(String key) + { + final String val = getString(key, null); + final Map result; + if (val != null) + { + final String[] splitVal = val.split(","); + result = new HashMap<>(splitVal.length + 1); + for (String split : splitVal) + { + final String[] entry = split.split("-"); + result.put(Integer.parseInt(entry[0]), Integer.parseInt(entry[1])); + } + } + else + { + result = new HashMap<>(1); + } + return result; + } + + public void setIntegerMap(String key, Map map) + { + if (key == null) + { + return; + } + + if ((map == null) || map.isEmpty()) + { + remove(key); + return; + } + + final StringBuilder sb = new StringBuilder(); + for (Entry entry : map.entrySet()) + { + sb.append(entry.getKey()); + sb.append("-"); + sb.append(entry.getValue()); + sb.append(","); + } + sb.deleteCharAt(sb.length() - 1); // Prettify value. + + set(key, sb.toString()); + } + @Override public long getLong(String key) { diff --git a/L2J_Mobius_Classic_2.4_SecretOfEmpire/java/org/l2jmobius/gameserver/model/StatSet.java b/L2J_Mobius_Classic_2.4_SecretOfEmpire/java/org/l2jmobius/gameserver/model/StatSet.java index 17fa5f31b8..af83f67c49 100644 --- a/L2J_Mobius_Classic_2.4_SecretOfEmpire/java/org/l2jmobius/gameserver/model/StatSet.java +++ b/L2J_Mobius_Classic_2.4_SecretOfEmpire/java/org/l2jmobius/gameserver/model/StatSet.java @@ -22,6 +22,7 @@ import java.util.Collections; import java.util.HashMap; import java.util.List; import java.util.Map; +import java.util.Map.Entry; import java.util.function.Supplier; import java.util.logging.Level; import java.util.logging.Logger; @@ -436,6 +437,53 @@ public class StatSet implements IParserAdvUtils set(key, sb.toString()); } + public Map getIntegerMap(String key) + { + final String val = getString(key, null); + final Map result; + if (val != null) + { + final String[] splitVal = val.split(","); + result = new HashMap<>(splitVal.length + 1); + for (String split : splitVal) + { + final String[] entry = split.split("-"); + result.put(Integer.parseInt(entry[0]), Integer.parseInt(entry[1])); + } + } + else + { + result = new HashMap<>(1); + } + return result; + } + + public void setIntegerMap(String key, Map map) + { + if (key == null) + { + return; + } + + if ((map == null) || map.isEmpty()) + { + remove(key); + return; + } + + final StringBuilder sb = new StringBuilder(); + for (Entry entry : map.entrySet()) + { + sb.append(entry.getKey()); + sb.append("-"); + sb.append(entry.getValue()); + sb.append(","); + } + sb.deleteCharAt(sb.length() - 1); // Prettify value. + + set(key, sb.toString()); + } + @Override public long getLong(String key) { diff --git a/L2J_Mobius_Classic_3.0_TheKamael/java/org/l2jmobius/gameserver/model/StatSet.java b/L2J_Mobius_Classic_3.0_TheKamael/java/org/l2jmobius/gameserver/model/StatSet.java index 17fa5f31b8..af83f67c49 100644 --- a/L2J_Mobius_Classic_3.0_TheKamael/java/org/l2jmobius/gameserver/model/StatSet.java +++ b/L2J_Mobius_Classic_3.0_TheKamael/java/org/l2jmobius/gameserver/model/StatSet.java @@ -22,6 +22,7 @@ import java.util.Collections; import java.util.HashMap; import java.util.List; import java.util.Map; +import java.util.Map.Entry; import java.util.function.Supplier; import java.util.logging.Level; import java.util.logging.Logger; @@ -436,6 +437,53 @@ public class StatSet implements IParserAdvUtils set(key, sb.toString()); } + public Map getIntegerMap(String key) + { + final String val = getString(key, null); + final Map result; + if (val != null) + { + final String[] splitVal = val.split(","); + result = new HashMap<>(splitVal.length + 1); + for (String split : splitVal) + { + final String[] entry = split.split("-"); + result.put(Integer.parseInt(entry[0]), Integer.parseInt(entry[1])); + } + } + else + { + result = new HashMap<>(1); + } + return result; + } + + public void setIntegerMap(String key, Map map) + { + if (key == null) + { + return; + } + + if ((map == null) || map.isEmpty()) + { + remove(key); + return; + } + + final StringBuilder sb = new StringBuilder(); + for (Entry entry : map.entrySet()) + { + sb.append(entry.getKey()); + sb.append("-"); + sb.append(entry.getValue()); + sb.append(","); + } + sb.deleteCharAt(sb.length() - 1); // Prettify value. + + set(key, sb.toString()); + } + @Override public long getLong(String key) { diff --git a/L2J_Mobius_Classic_Interlude/java/org/l2jmobius/gameserver/model/StatSet.java b/L2J_Mobius_Classic_Interlude/java/org/l2jmobius/gameserver/model/StatSet.java index 17fa5f31b8..af83f67c49 100644 --- a/L2J_Mobius_Classic_Interlude/java/org/l2jmobius/gameserver/model/StatSet.java +++ b/L2J_Mobius_Classic_Interlude/java/org/l2jmobius/gameserver/model/StatSet.java @@ -22,6 +22,7 @@ import java.util.Collections; import java.util.HashMap; import java.util.List; import java.util.Map; +import java.util.Map.Entry; import java.util.function.Supplier; import java.util.logging.Level; import java.util.logging.Logger; @@ -436,6 +437,53 @@ public class StatSet implements IParserAdvUtils set(key, sb.toString()); } + public Map getIntegerMap(String key) + { + final String val = getString(key, null); + final Map result; + if (val != null) + { + final String[] splitVal = val.split(","); + result = new HashMap<>(splitVal.length + 1); + for (String split : splitVal) + { + final String[] entry = split.split("-"); + result.put(Integer.parseInt(entry[0]), Integer.parseInt(entry[1])); + } + } + else + { + result = new HashMap<>(1); + } + return result; + } + + public void setIntegerMap(String key, Map map) + { + if (key == null) + { + return; + } + + if ((map == null) || map.isEmpty()) + { + remove(key); + return; + } + + final StringBuilder sb = new StringBuilder(); + for (Entry entry : map.entrySet()) + { + sb.append(entry.getKey()); + sb.append("-"); + sb.append(entry.getValue()); + sb.append(","); + } + sb.deleteCharAt(sb.length() - 1); // Prettify value. + + set(key, sb.toString()); + } + @Override public long getLong(String key) { diff --git a/L2J_Mobius_Essence_4.2_DwellingOfSpirits/java/org/l2jmobius/gameserver/model/StatSet.java b/L2J_Mobius_Essence_4.2_DwellingOfSpirits/java/org/l2jmobius/gameserver/model/StatSet.java index 17fa5f31b8..af83f67c49 100644 --- a/L2J_Mobius_Essence_4.2_DwellingOfSpirits/java/org/l2jmobius/gameserver/model/StatSet.java +++ b/L2J_Mobius_Essence_4.2_DwellingOfSpirits/java/org/l2jmobius/gameserver/model/StatSet.java @@ -22,6 +22,7 @@ import java.util.Collections; import java.util.HashMap; import java.util.List; import java.util.Map; +import java.util.Map.Entry; import java.util.function.Supplier; import java.util.logging.Level; import java.util.logging.Logger; @@ -436,6 +437,53 @@ public class StatSet implements IParserAdvUtils set(key, sb.toString()); } + public Map getIntegerMap(String key) + { + final String val = getString(key, null); + final Map result; + if (val != null) + { + final String[] splitVal = val.split(","); + result = new HashMap<>(splitVal.length + 1); + for (String split : splitVal) + { + final String[] entry = split.split("-"); + result.put(Integer.parseInt(entry[0]), Integer.parseInt(entry[1])); + } + } + else + { + result = new HashMap<>(1); + } + return result; + } + + public void setIntegerMap(String key, Map map) + { + if (key == null) + { + return; + } + + if ((map == null) || map.isEmpty()) + { + remove(key); + return; + } + + final StringBuilder sb = new StringBuilder(); + for (Entry entry : map.entrySet()) + { + sb.append(entry.getKey()); + sb.append("-"); + sb.append(entry.getValue()); + sb.append(","); + } + sb.deleteCharAt(sb.length() - 1); // Prettify value. + + set(key, sb.toString()); + } + @Override public long getLong(String key) { diff --git a/L2J_Mobius_Essence_5.2_FrostLord/java/org/l2jmobius/gameserver/model/StatSet.java b/L2J_Mobius_Essence_5.2_FrostLord/java/org/l2jmobius/gameserver/model/StatSet.java index 17fa5f31b8..af83f67c49 100644 --- a/L2J_Mobius_Essence_5.2_FrostLord/java/org/l2jmobius/gameserver/model/StatSet.java +++ b/L2J_Mobius_Essence_5.2_FrostLord/java/org/l2jmobius/gameserver/model/StatSet.java @@ -22,6 +22,7 @@ import java.util.Collections; import java.util.HashMap; import java.util.List; import java.util.Map; +import java.util.Map.Entry; import java.util.function.Supplier; import java.util.logging.Level; import java.util.logging.Logger; @@ -436,6 +437,53 @@ public class StatSet implements IParserAdvUtils set(key, sb.toString()); } + public Map getIntegerMap(String key) + { + final String val = getString(key, null); + final Map result; + if (val != null) + { + final String[] splitVal = val.split(","); + result = new HashMap<>(splitVal.length + 1); + for (String split : splitVal) + { + final String[] entry = split.split("-"); + result.put(Integer.parseInt(entry[0]), Integer.parseInt(entry[1])); + } + } + else + { + result = new HashMap<>(1); + } + return result; + } + + public void setIntegerMap(String key, Map map) + { + if (key == null) + { + return; + } + + if ((map == null) || map.isEmpty()) + { + remove(key); + return; + } + + final StringBuilder sb = new StringBuilder(); + for (Entry entry : map.entrySet()) + { + sb.append(entry.getKey()); + sb.append("-"); + sb.append(entry.getValue()); + sb.append(","); + } + sb.deleteCharAt(sb.length() - 1); // Prettify value. + + set(key, sb.toString()); + } + @Override public long getLong(String key) {