Created
July 3, 2015 13:37
-
-
Save u3games/e04dfb782df2f6f7eeb8 to your computer and use it in GitHub Desktop.
L2J_EventEngine - Config
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Index: Configs.java | |
=================================================================== | |
--- Configs.java (revision 43) | |
+++ Configs.java (working copy) | |
@@ -19,7 +19,10 @@ | |
package net.sf.eventengine.configs; | |
import java.util.ArrayList; | |
+import java.util.HashMap; | |
import java.util.List; | |
+import java.util.Map; | |
+import java.util.logging.Logger; | |
import net.sf.eventengine.util.EventPropertiesParser; | |
@@ -26,6 +29,7 @@ | |
import com.l2jserver.gameserver.model.Location; | |
import com.l2jserver.gameserver.model.holders.ItemHolder; | |
import com.l2jserver.gameserver.model.holders.SkillHolder; | |
+import com.l2jserver.util.StringUtil; | |
/** | |
* Clase encargada de leer todos los configs establecidos en los archivos de tipo "properties" | |
@@ -33,6 +37,7 @@ | |
*/ | |
public class Configs | |
{ | |
+ private static final Logger LOG = Logger.getLogger(Configs.class.getName()); | |
private static final String EVENT_CONFIG = "./config/EventEngine/EventEngine.properties"; | |
private static final String TVT_CONFIG = "./config/EventEngine/TeamVsTeam.properties"; | |
private static final String AVA_CONFIG = "./config/EventEngine/AllVsAll.properties"; | |
@@ -63,11 +68,11 @@ | |
// Configs All Vs All | |
// ------------------------------------------------------------------------------- | |
public static boolean AVA_EVENT_ENABLED; | |
- public static List<ItemHolder> AVA_REWARD_PLAYER_WIN = new ArrayList<>(); | |
- public static List<ItemHolder> AVA_REWARD_KILL_PLAYER = new ArrayList<>(); | |
- public static List<SkillHolder> AVA_BUFF_PLAYER_WARRIOR = new ArrayList<>(); | |
- public static List<SkillHolder> AVA_BUFF_PLAYER_MAGE = new ArrayList<>(); | |
- public static Location AVA_COORDINATES_PLAYER; | |
+ public static List<int[]> AVA_REWARD_PLAYER_WIN; | |
+ public static List<int[]> AVA_REWARD_KILL_PLAYER; | |
+ public static Map<Integer, Integer> AVA_BUFF_PLAYER_WARRIOR; | |
+ public static Map<Integer, Integer> AVA_BUFF_PLAYER_MAGE; | |
+ public static int[] AVA_COORDINATES_PLAYER = new int[3]; | |
// ------------------------------------------------------------------------------- | |
// Configs One Vs One | |
@@ -113,6 +118,7 @@ | |
// ------------------------------------------------------------------------------------- // | |
settings = new EventPropertiesParser(EVENT_CONFIG); | |
NPC_MANAGER_ID = settings.getInt("EventParticipationNpcId", 36600); | |
+ INSTANCE_FILE = settings.getString("EventInstanceFile", "EventEngine.xml"); | |
EVENT_TASK = settings.getInt("EventInterval", 10); | |
EVENT_DURATION = settings.getInt("EventRunningTime", 10); | |
FRIENDLY_FIRE = settings.getBoolean("EventFriendlyFire", false); | |
@@ -119,20 +125,154 @@ | |
MIN_PLAYERS_IN_EVENT = settings.getInt("EventMinPlayers", 2); | |
MAX_PLAYERS_IN_EVENT = settings.getInt("EventMaxPlayers", 20); | |
MIN_LVL_IN_EVENT = settings.getInt("EventMinPlayerLevel", 40); | |
- MAX_LVL_IN_EVENT = settings.getInt("EventMaxPlayerLevel", 78); | |
- INSTANCE_FILE = settings.getString("EventInstanceFile", "EventEngine.xml"); | |
+ MAX_LVL_IN_EVENT = settings.getInt("EventMaxPlayerLevel", 85); | |
// ------------------------------------------------------------------------------------- // | |
// AllVsAll.properties | |
// ------------------------------------------------------------------------------------- // | |
settings = new EventPropertiesParser(AVA_CONFIG); | |
+ // Enabled Event | |
AVA_EVENT_ENABLED = settings.getBoolean("AvAEventEnabled", false); | |
- AVA_REWARD_PLAYER_WIN = settings.getItemHolderList("AvAEventReward"); | |
- AVA_REWARD_KILL_PLAYER = settings.getItemHolderList("AvAEventRewardKill"); | |
- AVA_BUFF_PLAYER_WARRIOR = settings.getSkillHolderList("AvAEventFighterBuffs"); | |
- AVA_BUFF_PLAYER_MAGE = settings.getSkillHolderList("AvAEventMageBuffs"); | |
- AVA_COORDINATES_PLAYER = settings.getLocation("AvAEventCoordinates"); | |
+ // Rewards Player Win | |
+ String[] _rewardsWin = settings.getString("AvAEventReward", "57,10000").split(";"); | |
+ if (!_rewardsWin[0].isEmpty()) | |
+ { | |
+ AVA_REWARD_PLAYER_WIN = new ArrayList<>(); | |
+ for (String reward : _rewardsWin) | |
+ { | |
+ String[] rewardSplit = reward.split(","); | |
+ if (rewardSplit.length != 2) | |
+ { | |
+ LOG.warning(StringUtil.concat("AvaEventEngine[Config.load()]: invalid config property -> AvAEventReward \"", reward, "\"")); | |
+ } | |
+ else | |
+ { | |
+ try | |
+ { | |
+ AVA_REWARD_PLAYER_WIN.add(new int[] | |
+ { | |
+ Integer.parseInt(rewardSplit[0]), | |
+ Integer.parseInt(rewardSplit[1]) | |
+ }); | |
+ } | |
+ catch (NumberFormatException nfe) | |
+ { | |
+ if (!reward.isEmpty()) | |
+ { | |
+ LOG.warning(StringUtil.concat("AvaEventEngine[Config.load()]: invalid config property -> AvAEventReward \"", reward, "\"")); | |
+ } | |
+ } | |
+ } | |
+ } | |
+ } | |
+ | |
+ // Rewards To Kill Player | |
+ String[] _rewardsKill = settings.getString("AvAEventRewardKill", "57,100").split(";"); | |
+ if (!_rewardsKill[0].isEmpty()) | |
+ { | |
+ AVA_REWARD_KILL_PLAYER = new ArrayList<>(); | |
+ for (String reward : _rewardsKill) | |
+ { | |
+ String[] rewardSplit = reward.split(","); | |
+ if (rewardSplit.length != 2) | |
+ { | |
+ LOG.warning(StringUtil.concat("AvaEventEngine[Config.load()]: invalid config property -> AvAEventRewardKill \"", reward, "\"")); | |
+ } | |
+ else | |
+ { | |
+ try | |
+ { | |
+ AVA_REWARD_KILL_PLAYER.add(new int[] | |
+ { | |
+ Integer.parseInt(rewardSplit[0]), | |
+ Integer.parseInt(rewardSplit[1]) | |
+ }); | |
+ } | |
+ catch (NumberFormatException nfe) | |
+ { | |
+ if (!reward.isEmpty()) | |
+ { | |
+ LOG.warning(StringUtil.concat("AvaEventEngine[Config.load()]: invalid config property -> AvAEventRewardKill \"", reward, "\"")); | |
+ } | |
+ } | |
+ } | |
+ } | |
+ } | |
+ | |
+ // Fighter Buffs | |
+ String[] _fighterBuffs = settings.getString("AvAEventFighterBuffs", "").split(";"); | |
+ if (!_fighterBuffs[0].isEmpty()) | |
+ { | |
+ AVA_BUFF_PLAYER_WARRIOR = new HashMap<>(_fighterBuffs.length); | |
+ for (String skill : _fighterBuffs) | |
+ { | |
+ String[] skillSplit = skill.split(","); | |
+ if (skillSplit.length != 2) | |
+ { | |
+ LOG.warning(StringUtil.concat("AvAEventEngine[Config.load()]: invalid config property -> AvAEventFighterBuffs \"", skill, "\"")); | |
+ } | |
+ else | |
+ { | |
+ try | |
+ { | |
+ AVA_BUFF_PLAYER_WARRIOR.put(Integer.parseInt(skillSplit[0]), Integer.parseInt(skillSplit[1])); | |
+ } | |
+ catch (NumberFormatException nfe) | |
+ { | |
+ if (!skill.isEmpty()) | |
+ { | |
+ LOG.warning(StringUtil.concat("AvAEventEngine[Config.load()]: invalid config property -> AvAEventFighterBuffs \"", skill, "\"")); | |
+ } | |
+ } | |
+ } | |
+ } | |
+ } | |
+ | |
+ // Mage Buffs | |
+ String[] _mageBuffs = settings.getString("AvAEventMageBuffs", "").split(";"); | |
+ if (!_mageBuffs[0].isEmpty()) | |
+ { | |
+ AVA_BUFF_PLAYER_MAGE = new HashMap<>(_mageBuffs.length); | |
+ for (String skill : _mageBuffs) | |
+ { | |
+ String[] skillSplit = skill.split(","); | |
+ if (skillSplit.length != 2) | |
+ { | |
+ LOG.warning(StringUtil.concat("AvAEventEngine[Config.load()]: invalid config property -> AvAEventMageBuffs \"", skill, "\"")); | |
+ } | |
+ else | |
+ { | |
+ try | |
+ { | |
+ AVA_BUFF_PLAYER_MAGE.put(Integer.parseInt(skillSplit[0]), Integer.parseInt(skillSplit[1])); | |
+ } | |
+ catch (NumberFormatException nfe) | |
+ { | |
+ if (!skill.isEmpty()) | |
+ { | |
+ LOG.warning(StringUtil.concat("AvAEventEngine[Config.load()]: invalid config property -> AvAEventMageBuffs \"", skill, "\"")); | |
+ } | |
+ } | |
+ } | |
+ } | |
+ } | |
+ | |
+ // Coordinates | |
+ String[] _coordinates = settings.getString("AvAEventCoordinates", "0,0,0").split(","); | |
+ if (_coordinates.length < 3) | |
+ { | |
+ TVT_EVENT_ENABLED = false; | |
+ LOG.warning("AvAEventEngine[Config.load()]: invalid config property -> AvAEventCoordinates"); | |
+ } | |
+ else | |
+ { | |
+ AVA_COORDINATES_PLAYER = new int[3]; | |
+ AVA_COORDINATES_PLAYER[0] = Integer.parseInt(_coordinates[0]); | |
+ AVA_COORDINATES_PLAYER[1] = Integer.parseInt(_coordinates[1]); | |
+ AVA_COORDINATES_PLAYER[2] = Integer.parseInt(_coordinates[2]); | |
+ } | |
+ | |
// ------------------------------------------------------------------------------------- // | |
// OneVsOne.properties | |
// ------------------------------------------------------------------------------------- // |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment