Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- diff --git a/config/CustomMods/Classes/ClassesDamages.ini b/config/CustomMods/Classes/ClassesDamages.ini
- new file mode 100644
- index 0000000..e284c65
- --- /dev/null
- +++ b/config/CustomMods/Classes/ClassesDamages.ini
- @@ -0,0 +1,180 @@
- +#====================================================
- +#[PT] 3° JOB DANOS CAUSADOS EM TODOS OS FIGHTERS
- +#[EN] 3° JOB Damages to Fighters
- +#====================================================
- +Duelist__ToFighter=1.0
- +DreadNought__ToFighter=1.0
- +Phoenix_Knight__ToFighter=1.0
- +Hell_Knight__ToFighter=1.0
- +Sagittarius__ToFighter=1.0
- +Adventurer__ToFighter=1.0
- +Archmage__ToFighter=1.0
- +Soultaker__ToFighter=1.0
- +Arcana_Lord__ToFighter=1.0
- +Cardinal__ToFighter=1.0
- +Hierophant__ToFighter=1.0
- +Eva_Templar__ToFighter=1.0
- +Sword_Muse__ToFighter=1.0
- +Wind_Rider__ToFighter=1.0
- +Moonlight_Sentinel__ToFighter=1.0
- +Mystic_Muse__ToFighter=1.0
- +Elemental_Master__ToFighter=1.0
- +Eva_s_Saint__ToFighter=1.0
- +Shillien_Templar__ToFighter=1.0
- +Spectral_Dancer__ToFighter=1.0
- +Ghost_Hunter__ToFighter=1.0
- +Ghost_Sentinel__ToFighter=1.0
- +Storm_Screamer__ToFighter=1.0
- +Spectral_Master__ToFighter=1.0
- +Shillien_Saint__ToFighter=1.0
- +Titan__ToFighter=1.0
- +Grand_Khauatari__ToFighter=1.0
- +Dominator__ToFighter=1.0
- +Doomcryer__ToFighter=1.0
- +Fortune_Seeker__ToFighter=1.0
- +Maestro__ToFighter=1.0
- +#====================================================
- +#[PT]3° JOB DANOS CAUSADOS EM TODOS OS MAGOS
- +#[EN]3° JOB Damages to Mage
- +#====================================================
- +Duelist__ToMage=1.1
- +DreadNought__ToMage=1.0
- +Phoenix_Knight__ToMage=1.0
- +Hell_Knight__ToMage=1.0
- +Sagittarius__ToMage=1.0
- +Adventurer__ToMage=1.0
- +Archmage__ToMage=1.0
- +Soultaker__ToMage=1.0
- +Arcana_Lord__ToMage=1.0
- +Cardinal__ToMage=1.0
- +Hierophant__ToMage=1.0
- +Eva_Templar__ToMage=1.0
- +Sword_Muse__ToMage=1.0
- +Wind_Rider__ToMage=1.0
- +Moonlight_Sentinel__ToMage=1.0
- +Mystic_Muse__ToMage=1.0
- +Elemental_Master__ToMage=1.0
- +Eva_s_Saint__ToMage=1.0
- +Shillien_Templar__ToMage=1.0
- +Spectral_Dancer__ToMage=1.0
- +Ghost_Hunter__ToMage=1.0
- +Ghost_Sentinel__ToMage=1.0
- +Storm_Screamer__ToMage=1.0
- +Spectral_Master__ToMage=1.0
- +Shillien_Saint__ToMage=1.0
- +Titan__ToMage=1.0
- +Grand_Khauatari__ToMage=1.0
- +Dominator__ToMage=0.95
- +Doomcryer__ToMage=0.95
- +Fortune_Seeker__ToMage=1.0
- +Maestro__ToMage=1.0
- +#====================================================
- +#[PT]3° JOB DANOS DOS FIGHTERS EM DETERMINADA CLASSE
- +#[EN]3° JOB Damages Fighter per class
- +#====================================================
- +Duelist__ByFighter=1.0
- +DreadNought__ByFighter=1.0
- +Phoenix_Knight__ByFighter=1.0
- +Hell_Knight__ByFighter=1.0
- +Sagittarius__ByFighter1.0
- +Adventurer__ByFighter=1.0
- +Archmage__ByFighter=1.0
- +Soultaker__ByFighter=1.0
- +Arcana_Lord__ByFighter=1.0
- +Cardinal__ByFighter=1.0
- +Hierophant__ByFighter=1.0
- +Eva_Templar__ByFighter=1.0
- +Sword_Muse__ByFighter=1.0
- +Wind_Rider__ByFighter=1.0
- +Moonlight_Sentinel__ByFighter=1.0
- +Mystic_Muse__ByFighter=1.0
- +Elemental_Master__ByFighter=1.0
- +Eva_s_Saint__ByFighter=1.0
- +Shillien_Templar__ByFighter=1.0
- +Spectral_Dancer__ByFighter=1.0
- +Ghost_Hunter__ByFighter=1.0
- +Ghost_Sentinel__ByFighter=1.0
- +Storm_Screamer__ByFighter=1.0
- +Spectral_Master__ByFighter=1.0
- +Shillien_Saint__ByFighter=1.0
- +Titan__ByFighter=1.0
- +Grand_Khauatari__ByFighter=1.0
- +Dominator__ByFighter=1.0
- +Doomcryer__ByFighter=1.0
- +Fortune_Seeker__ByFighter=1.0
- +Maestro__ByFighter=1.0
- +#====================================================
- +#[PT]3° JOB DANOS DOS MAGOS EM DETERMINADA CLASSE
- +#[EN]3° JOB Damages Fighter per class
- +#====================================================
- +Duelist__ByMage=1.0
- +DreadNought__ByMage=1.0
- +Phoenix_Knight__ByMage=1.0
- +Hell_Knight__ByMage=1.0
- +Sagittarius__ByMage=1.0
- +Adventurer__ByMage=1.0
- +Archmage__ByMage=1.0
- +Soultaker__ByMage=1.0
- +Arcana_Lord__ByMage=1.0
- +Cardinal__ByMage=1.0
- +Hierophant__ByMage=1.0
- +Eva_Templar__ByMage=1.0
- +Sword_Muse__ByMage=1.0
- +Wind_Rider__ByMage=1.0
- +Moonlight_Sentinel__ByMage=1.0
- +Mystic_Muse__ByMage=1.0
- +Elemental_Master__ByMage=1.0
- +Eva_s_Saint__ByMage=1.0
- +Shillien_Templar__ByMage=1.0
- +Spectral_Dancer__ByMage=1.0
- +Ghost_Hunter__ByMage=1.0
- +Ghost_Sentinel__ByMage=1.0
- +Storm_Screamer__ByMage=1.0
- +Spectral_Master__ByMage=1.0
- +Shillien_Saint__ByMage=1.0
- +Titan__ByMage=1.0
- +Grand_Khauatari__ByMage=1.0
- +Dominator__ByMage=1.0
- +Doomcryer__ByMage=1.0
- +Fortune_Seeker__ByMage=1.0
- +Maestro__ByMage=1.0
- +#====================================================
- +#[PT]1° e 2° Job DANOS CAUSADOS EM TODOS OS MAGOS
- +#[EN]1° and 2° Job Damages to Mages
- +#====================================================
- +Human_Mystic__ToMage=1.0
- +Human_Wizard__ToMage=1.0
- +Sorceror__ToMage=1.0
- +Necromancer__ToMage=1.0
- +Warlock__ToMage=1.0
- +Elven_Mystic__ToMage=1.0
- +Elven_Wizard__ToMage=1.0
- +Spellsinger__ToMage=1.0
- +Dark_Elven_Mystic__ToMage=1.0
- +Dark_Elven_Wizard__ToMage=1.0
- +Spellhowler__ToMage=1.0
- +Phantom_Summoner__ToMage=1.0
- +Orc_Figther__ToMage=1.0
- +Orc_Mystic__ToMage=1.0
- +Orc_Shaman__ToMage=1.0
- +Ovelord__ToMage=1.0
- +#====================================================
- +#[PT]1° e 2° Job DANOS CAUSADOS EM TODOS OS FIGHTERS
- +#[EN]1° and 2° Job Damages to Fighters
- +#====================================================
- +Human_Mystic__ToFighter=1.0
- +Human_Wizard__ToFighter=1.0
- +Sorceror__ToFighter=1.0
- +Necromancer__ToFighter=1.0
- +Warlock__ToFighter=1.0
- +Elven_Mystic__ToFighter=1.0
- +Elven_Wizard__ToFighter=1.0
- +Spellsinger__ToFighter=1.0
- +Dark_Elven_Mystic__ToFighter=1.0
- +Dark_Elven_Wizard__ToFighter=1.0
- +Spellhowler__ToFighter=1.0
- +Phantom_Summoner__ToFighter=1.0
- +Orc_Figther__ToFighter=1.0
- +Orc_Mystic__ToFighter=1.0
- +Orc_Shaman__ToFighter=1.0
- +Ovelord__ToFighter=1.0
- diff --git a/config/CustomMods/Classes/ClassesDamagesOly.ini b/config/CustomMods/Classes/ClassesDamagesOly.ini
- new file mode 100644
- index 0000000..5ca94ba
- --- /dev/null
- +++ b/config/CustomMods/Classes/ClassesDamagesOly.ini
- @@ -0,0 +1,70 @@
- +#====================================================
- +#[PT] 3° Job DANOS CAUSADOS EM TODOS OS FIGHTERS
- +#[EN] 3° Job Damages to Fighters
- +#====================================================
- +Duelist__ToFighter=1.4
- +DreadNought__ToFighter=1.1
- +Phoenix_Knight__ToFighter=2.2
- +Hell_Knight__ToFighter=2.3
- +Sagittarius__ToFighter=1.2
- +Adventurer__ToFighter=1.3
- +Archmage__ToFighter=0.55
- +Soultaker__ToFighter=0.3
- +Arcana_Lord__ToFighter=1.3
- +Cardinal__ToFighter=1.4
- +Hierophant__ToFighter=1.4
- +Eva_Templar__ToFighter=1.2
- +Sword_Muse__ToFighter=1.4
- +Wind_Rider__ToFighter=1.35
- +Moonlight_Sentinel__ToFighter=1.2
- +Mystic_Muse__ToFighter=0.55
- +Elemental_Master__ToFighter=1.4
- +Eva_s_Saint__ToFighter=1.4
- +Shillien_Templar__ToFighter=1.4
- +Spectral_Dancer__ToFighter=1.4
- +Ghost_Hunter__ToFighter=1.35
- +Ghost_Sentinel__ToFighter=1.2
- +Storm_Screamer__ToFighter=0.3
- +Spectral_Master__ToFighter=1.4
- +Shillien_Saint__ToFighter=1.4
- +Titan__ToFighter=1.5
- +Grand_Khauatari__ToFighter=0.7
- +Dominator__ToFighter=0.35
- +Doomcryer__ToFighter=0.35
- +Fortune_Seeker__ToFighter=2.0
- +Maestro__ToFighter=2.0
- +#====================================================
- +#[PT]3° JOB DANOS CAUSADOS EM TODOS OS MAGOS
- +#[EN]3° JOB Damages to Mage
- +#====================================================
- +Duelist__ToMage=1.4
- +DreadNought__ToMage=1.1
- +Phoenix_Knight__ToMage=2.2
- +Hell_Knight__ToMage=2.3
- +Sagittarius__ToMage=1.2
- +Adventurer__ToMage=1.3
- +Archmage__ToMage=0.55
- +Soultaker__ToMage=0.3
- +Arcana_Lord__ToMage=1.3
- +Cardinal__ToMage=1.4
- +Hierophant__ToMage=1.4
- +Eva_Templar__ToMage=1.2
- +Sword_Muse__ToMage=1.4
- +Wind_Rider__ToMage=1.35
- +Moonlight_Sentinel__ToMage=1.2
- +Mystic_Muse__ToMage=0.55
- +Elemental_Master__ToMage=1.4
- +Eva_s_Saint__ToMage=1.4
- +Shillien_Templar__ToMage=1.4
- +Spectral_Dancer__ToMage=1.4
- +Ghost_Hunter__ToMage=1.35
- +Ghost_Sentinel__ToMage=1.2
- +Storm_Screamer__ToMage=0.3
- +Spectral_Master__ToMage=1.4
- +Shillien_Saint__ToMage=1.4
- +Titan__ToMage=1.5
- +Grand_Khauatari__ToMage=0.7
- +Dominator__ToMage=0.35
- +Doomcryer__ToMage=0.35
- +Fortune_Seeker__ToMage=2.0
- +Maestro__ToMage=2.0
- diff --git a/config/CustomMods/SpecialMods.ini b/config/CustomMods/SpecialMods.ini
- index 3110294..e9c2e61 100644
- --- a/config/CustomMods/SpecialMods.ini
- +++ b/config/CustomMods/SpecialMods.ini
- @@ -54,3 +54,11 @@
- # Arrows IDS = 1341,1342,1343,1344,1345
- AutoLootExcludeItems = 1341,1342,1343,1344,1345,57
- +#====================================================
- +# OLLY SETTINGS
- +#====================================================
- +# Enable Class Damages Settings
- +EnableClassDamagesSettings = True
- +EnableClassDamagesLogger = False
- +EnableClassDamagesSettingsInOly = True
- +
- diff --git a/java/net/sf/l2j/Config.java b/java/net/sf/l2j/Config.java
- index 39cb5b7..94de39e 100644
- --- a/java/net/sf/l2j/Config.java
- +++ b/java/net/sf/l2j/Config.java
- @@ -55,6 +55,9 @@
- // Clans settings
- // --------------------------------------------------
- /** Clans */
- + public static boolean ENABLE_CLASS_DAMAGES;
- + public static boolean ENABLE_CLASS_DAMAGES_IN_OLY;
- + public static boolean ENABLE_CLASS_DAMAGES_LOGGER;
- public static boolean ENABLE_ENCHANT_ANNOUNCE;
- public static int ENCHANT_ANNOUNCE_LEVEL;
- public static boolean ALT_GAME_VIEWNPC;
- @@ -1510,6 +1513,9 @@
- private static final void loadSpecial()
- {
- final ExProperties Special = initProperties(SPECIAL_MODS);
- + ENABLE_CLASS_DAMAGES = Special.getProperty("EnableClassDamagesSettings", true);
- + ENABLE_CLASS_DAMAGES_IN_OLY = Special.getProperty("EnableClassDamagesSettingsInOly", true);
- + ENABLE_CLASS_DAMAGES_LOGGER = Special.getProperty("EnableClassDamagesLogger", true);
- ENABLE_ENCHANT_ANNOUNCE = Boolean.parseBoolean(Special.getProperty("EnableEnchantAnnounce", "False"));
- ENCHANT_ANNOUNCE_LEVEL = Integer.parseInt(Special.getProperty("EnchantAnnounceLevel", "16"));
- ALT_GAME_VIEWNPC = Boolean.parseBoolean(Special.getProperty("AltGameViewNpc", "False"));
- diff --git a/java/net/sf/l2j/gameserver/GameServer.java b/java/net/sf/l2j/gameserver/GameServer.java
- index 3cfc5b7..22b0419 100644
- --- a/java/net/sf/l2j/gameserver/GameServer.java
- +++ b/java/net/sf/l2j/gameserver/GameServer.java
- @@ -27,6 +27,7 @@
- import net.sf.l2j.gameserver.data.manager.CastleManager;
- import net.sf.l2j.gameserver.data.manager.CastleManorManager;
- import net.sf.l2j.gameserver.data.manager.ClanHallManager;
- +import net.sf.l2j.gameserver.data.manager.ClassDamageManager;
- import net.sf.l2j.gameserver.data.manager.CoupleManager;
- import net.sf.l2j.gameserver.data.manager.CursedWeaponManager;
- import net.sf.l2j.gameserver.data.manager.DayNightManager;
- @@ -38,6 +39,7 @@
- import net.sf.l2j.gameserver.data.manager.GrandBossManager;
- import net.sf.l2j.gameserver.data.manager.HeroManager;
- import net.sf.l2j.gameserver.data.manager.LotteryManager;
- +import net.sf.l2j.gameserver.data.manager.OlympiadDamageManager;
- import net.sf.l2j.gameserver.data.manager.PartyMatchRoomManager;
- import net.sf.l2j.gameserver.data.manager.PartyZoneReward;
- import net.sf.l2j.gameserver.data.manager.PetitionManager;
- @@ -171,6 +173,15 @@
- AnnouncementData.getInstance();
- ServerMemoTable.getInstance();
- + StringUtil.printSection("Classes Damages");
- + if (Config.ENABLE_CLASS_DAMAGES)
- + ClassDamageManager.loadConfig();
- +
- + if (Config.ENABLE_CLASS_DAMAGES_IN_OLY)
- + OlympiadDamageManager.loadConfig();
- + else
- + LOGGER.info("Game Server Info is disabled.");
- +
- StringUtil.printSection("Skills");
- SkillTable.getInstance();
- SkillTreeData.getInstance();
- diff --git a/java/net/sf/l2j/gameserver/data/manager/ClassDamageManager.java b/java/net/sf/l2j/gameserver/data/manager/ClassDamageManager.java
- new file mode 100644
- index 0000000..fa2966d
- --- /dev/null
- +++ b/java/net/sf/l2j/gameserver/data/manager/ClassDamageManager.java
- @@ -0,0 +1,191 @@
- +package net.sf.l2j.gameserver.data.manager;
- +
- +import java.io.File;
- +import java.io.FileInputStream;
- +import java.io.IOException;
- +import java.io.InputStream;
- +import java.util.Hashtable;
- +import java.util.Properties;
- +import java.util.Set;
- +import java.util.logging.Logger;
- +
- +import net.sf.l2j.Config;
- +import net.sf.l2j.gameserver.data.xml.PlayerData;
- +import net.sf.l2j.gameserver.model.actor.Player;
- +
- +public class ClassDamageManager
- +{
- + private static final Logger _log = Logger.getLogger(ClassDamageManager.class.getName());
- + private static Hashtable<Integer, Double> damage_to_mage = new Hashtable<>();
- + private static Hashtable<Integer, Double> damage_to_fighter = new Hashtable<>();
- + private static Hashtable<Integer, Double> damage_by_mage = new Hashtable<>();
- + private static Hashtable<Integer, Double> damage_by_fighter = new Hashtable<>();
- + private static Hashtable<Integer, String> id_to_name = new Hashtable<>();
- + private static Hashtable<String, Integer> name_to_id = new Hashtable<>();
- + public static void loadConfig()
- + {
- + String STATUS_FILE = "./config/CustomMods/Classes/ClassesDamages.ini";
- + @SuppressWarnings("resource")
- + InputStream is = null;
- + File file = null;
- + try
- + {
- + Properties scriptSetting = new Properties();
- + file = new File(STATUS_FILE);
- + is = new FileInputStream(file);
- + scriptSetting.load(is);
- +
- + Set<Object> key_set = scriptSetting.keySet();
- + for (Object key : key_set)
- + {
- + String key_string = (String) key;
- +
- + String[] class_and_type = key_string.split("__");
- +
- + String class_name = class_and_type[0].replace("_", " ");
- + if (class_name.equals("Eva s Saint"))
- + {
- + class_name = "Eva's Saint";
- + }
- + String type = class_and_type[1];
- +
- + Integer class_id = Integer.valueOf(PlayerData.getClassIdByName(class_name) - 1);
- +
- + id_to_name.put(class_id, class_name);
- + name_to_id.put(class_name, class_id);
- + if (type.equals("ToFighter"))
- + {
- + damage_to_fighter.put(class_id, Double.valueOf(Double.parseDouble(scriptSetting.getProperty(key_string))));
- + }
- + else if (type.equals("ToMage"))
- + {
- + damage_to_mage.put(class_id, Double.valueOf(Double.parseDouble(scriptSetting.getProperty(key_string))));
- + }
- + else if (type.equals("ByFighter"))
- + {
- + damage_by_fighter.put(class_id, Double.valueOf(Double.parseDouble(scriptSetting.getProperty(key_string))));
- + }
- + else if (type.equals("ByMage"))
- + {
- + damage_by_mage.put(class_id, Double.valueOf(Double.parseDouble(scriptSetting.getProperty(key_string))));
- + }
- + }
- + _log.info("Loaded " + id_to_name.size() + " classes Damages configurations");
- + return;
- + }
- + catch (Exception e)
- + {
- + e.printStackTrace();
- + }
- + finally
- + {
- + if (is != null)
- + {
- + try
- + {
- + is.close();
- + }
- + catch (IOException e)
- + {
- + e.printStackTrace();
- + }
- + }
- + }
- + }
- +
- + public static double getClassDamageToMage(int id)
- + {
- + Double multiplier = damage_to_mage.get(Integer.valueOf(id));
- + if (multiplier != null)
- + {
- + return multiplier.doubleValue();
- + }
- + return 1.0D;
- + }
- +
- + public static double getClassDamageToFighter(int id)
- + {
- + Double multiplier = damage_to_fighter.get(Integer.valueOf(id));
- + if (multiplier != null)
- + {
- + return multiplier.doubleValue();
- + }
- + return 1.0D;
- + }
- +
- + public static double getClassDamageByMage(int id)
- + {
- + Double multiplier = damage_by_mage.get(Integer.valueOf(id));
- + if (multiplier != null)
- + {
- + return multiplier.doubleValue();
- + }
- + return 1.0D;
- + }
- +
- + public static double getClassDamageByFighter(int id)
- + {
- + Double multiplier = damage_by_fighter.get(Integer.valueOf(id));
- + if (multiplier != null)
- + {
- + return multiplier.doubleValue();
- + }
- + return 1.0D;
- + }
- +
- + public static int getIdByName(String name)
- + {
- + Integer id = name_to_id.get(name);
- + if (id != null)
- + {
- + return id.intValue();
- + }
- + return 0;
- + }
- +
- + public static String getNameById(int id)
- + {
- + String name = id_to_name.get(Integer.valueOf(id));
- + if (name != null)
- + {
- + return name;
- + }
- + return "";
- + }
- +
- + public static double getDamageMultiplier(Player attacker, Player attacked)
- + {
- + if ((attacker == null) || (attacked == null))
- + {
- + return 1.0D;
- + }
- + double attackerMulti = 1.0D;
- + if (attacked.isMageClass())
- + {
- + attackerMulti = getClassDamageToMage(attacker.getClassId().getId());
- + }
- + else
- + {
- + attackerMulti = getClassDamageToFighter(attacker.getClassId().getId());
- + }
- + double attackedMulti = 1.0D;
- + if (attacker.isMageClass())
- + {
- + attackedMulti = getClassDamageByMage(attacked.getClassId().getId());
- + }
- + else
- + {
- + attackedMulti = getClassDamageByFighter(attacked.getClassId().getId());
- + }
- + double output = attackerMulti * attackedMulti;
- + if (Config.ENABLE_CLASS_DAMAGES_LOGGER)
- + {
- + _log.info("ClassDamageManager -");
- + _log.info("ClassDamageManager - Attacker: " + attacker.getName() + " Class: " + getNameById(attacker.getClassId().getId()) + " ClassId: " + attacker.getClassId().getId() + " isMage: " + attacker.isMageClass() + " mult: " + attackerMulti);
- + _log.info("ClassDamageManager - Attacked: " + attacked.getName() + " Class: " + getNameById(attacked.getClassId().getId()) + " ClassId: " + attacked.getClassId().getId() + " isMage: " + attacked.isMageClass() + " mult: " + attackedMulti);
- + _log.info("ClassDamageManager - FinalMultiplier: " + output);
- + _log.info("ClassDamageManager -");
- + }
- + return output;
- + }
- +}
- diff --git a/java/net/sf/l2j/gameserver/data/manager/OlympiadDamageManager.java b/java/net/sf/l2j/gameserver/data/manager/OlympiadDamageManager.java
- new file mode 100644
- index 0000000..274e5cf
- --- /dev/null
- +++ b/java/net/sf/l2j/gameserver/data/manager/OlympiadDamageManager.java
- @@ -0,0 +1,192 @@
- +package net.sf.l2j.gameserver.data.manager;
- +
- +import java.io.File;
- +import java.io.FileInputStream;
- +import java.io.IOException;
- +import java.io.InputStream;
- +import java.util.Hashtable;
- +import java.util.Properties;
- +import java.util.Set;
- +import java.util.logging.Logger;
- +
- +import net.sf.l2j.Config;
- +import net.sf.l2j.gameserver.data.xml.PlayerData;
- +import net.sf.l2j.gameserver.model.actor.Player;
- +
- +public class OlympiadDamageManager
- +{
- + private static final Logger _log = Logger.getLogger(OlympiadDamageManager.class.getName());
- + private static Hashtable<Integer, Double> damage_to_mage = new Hashtable<>();
- + private static Hashtable<Integer, Double> damage_to_fighter = new Hashtable<>();
- + private static Hashtable<Integer, Double> damage_by_mage = new Hashtable<>();
- + private static Hashtable<Integer, Double> damage_by_fighter = new Hashtable<>();
- + private static Hashtable<Integer, String> id_to_name = new Hashtable<>();
- + private static Hashtable<String, Integer> name_to_id = new Hashtable<>();
- +
- + public static void loadConfig()
- + {
- + String STATUS_FILE = "./config/CustomMods/Classes/ClassesDamagesOly.ini";
- + @SuppressWarnings("resource")
- + InputStream is = null;
- + File file = null;
- + try
- + {
- + Properties scriptSetting = new Properties();
- + file = new File(STATUS_FILE);
- + is = new FileInputStream(file);
- + scriptSetting.load(is);
- +
- + Set<Object> key_set = scriptSetting.keySet();
- + for (Object key : key_set)
- + {
- + String key_string = (String) key;
- +
- + String[] class_and_type = key_string.split("__");
- +
- + String class_name = class_and_type[0].replace("_", " ");
- + if (class_name.equals("Eva s Saint"))
- + {
- + class_name = "Eva's Saint";
- + }
- + String type = class_and_type[1];
- +
- + Integer class_id = Integer.valueOf(PlayerData.getClassIdByName(class_name) - 1);
- +
- + id_to_name.put(class_id, class_name);
- + name_to_id.put(class_name, class_id);
- + if (type.equals("ToFighter"))
- + {
- + damage_to_fighter.put(class_id, Double.valueOf(Double.parseDouble(scriptSetting.getProperty(key_string))));
- + }
- + else if (type.equals("ToMage"))
- + {
- + damage_to_mage.put(class_id, Double.valueOf(Double.parseDouble(scriptSetting.getProperty(key_string))));
- + }
- + else if (type.equals("ByFighter"))
- + {
- + damage_by_fighter.put(class_id, Double.valueOf(Double.parseDouble(scriptSetting.getProperty(key_string))));
- + }
- + else if (type.equals("ByMage"))
- + {
- + damage_by_mage.put(class_id, Double.valueOf(Double.parseDouble(scriptSetting.getProperty(key_string))));
- + }
- + }
- + _log.info("Loaded " + id_to_name.size() + " Olympiad Damages configurations");
- + return;
- + }
- + catch (Exception e)
- + {
- + e.printStackTrace();
- + }
- + finally
- + {
- + if (is != null)
- + {
- + try
- + {
- + is.close();
- + }
- + catch (IOException e)
- + {
- + e.printStackTrace();
- + }
- + }
- + }
- + }
- +
- + public static double getClassDamageToMage(int id)
- + {
- + Double multiplier = damage_to_mage.get(Integer.valueOf(id));
- + if (multiplier != null)
- + {
- + return multiplier.doubleValue();
- + }
- + return 1.0D;
- + }
- +
- + public static double getClassDamageToFighter(int id)
- + {
- + Double multiplier = damage_to_fighter.get(Integer.valueOf(id));
- + if (multiplier != null)
- + {
- + return multiplier.doubleValue();
- + }
- + return 1.0D;
- + }
- +
- + public static double getClassDamageByMage(int id)
- + {
- + Double multiplier = damage_by_mage.get(Integer.valueOf(id));
- + if (multiplier != null)
- + {
- + return multiplier.doubleValue();
- + }
- + return 1.0D;
- + }
- +
- + public static double getClassDamageByFighter(int id)
- + {
- + Double multiplier = damage_by_fighter.get(Integer.valueOf(id));
- + if (multiplier != null)
- + {
- + return multiplier.doubleValue();
- + }
- + return 1.0D;
- + }
- +
- + public static int getIdByName(String name)
- + {
- + Integer id = name_to_id.get(name);
- + if (id != null)
- + {
- + return id.intValue();
- + }
- + return 0;
- + }
- +
- + public static String getNameById(int id)
- + {
- + String name = id_to_name.get(Integer.valueOf(id));
- + if (name != null)
- + {
- + return name;
- + }
- + return "";
- + }
- +
- + public static double getDamageMultiplier(Player attacker, Player attacked)
- + {
- + if ((attacker == null) || (attacked == null))
- + {
- + return 1.0D;
- + }
- + double attackerMulti = 1.0D;
- + if (attacked.isMageClass())
- + {
- + attackerMulti = getClassDamageToMage(attacker.getClassId().getId());
- + }
- + else
- + {
- + attackerMulti = getClassDamageToFighter(attacker.getClassId().getId());
- + }
- + double attackedMulti = 1.0D;
- + if (attacker.isMageClass())
- + {
- + attackedMulti = getClassDamageByMage(attacked.getClassId().getId());
- + }
- + else
- + {
- + attackedMulti = getClassDamageByFighter(attacked.getClassId().getId());
- + }
- + double output = attackerMulti * attackedMulti;
- + if (Config.ENABLE_CLASS_DAMAGES_LOGGER)
- + {
- + _log.info("ClassDamageManager -");
- + _log.info("ClassDamageManager - Attacker: " + attacker.getName() + " Class: " + getNameById(attacker.getClassId().getId()) + " ClassId: " + attacker.getClassId().getId() + " isMage: " + attacker.isMageClass() + " mult: " + attackerMulti);
- + _log.info("ClassDamageManager - Attacked: " + attacked.getName() + " Class: " + getNameById(attacked.getClassId().getId()) + " ClassId: " + attacked.getClassId().getId() + " isMage: " + attacked.isMageClass() + " mult: " + attackedMulti);
- + _log.info("ClassDamageManager - FinalMultiplier: " + output);
- + _log.info("ClassDamageManager -");
- + }
- + return output;
- + }
- +}
- diff --git a/java/net/sf/l2j/gameserver/data/xml/PlayerData.java b/java/net/sf/l2j/gameserver/data/xml/PlayerData.java
- index ef70a32..5d7a71a 100644
- --- a/java/net/sf/l2j/gameserver/data/xml/PlayerData.java
- +++ b/java/net/sf/l2j/gameserver/data/xml/PlayerData.java
- @@ -93,7 +93,141 @@
- {
- return SingletonHolder.INSTANCE;
- }
- -
- + private static final String[] CHAR_CLASSES =
- + {
- + "Human Fighter",
- + "Warrior",
- + "Gladiator",
- + "Warlord",
- + "Human Knight",
- + "Paladin",
- + "Dark Avenger",
- + "Rogue",
- + "Treasure Hunter",
- + "Hawkeye",
- + "Human Mystic",
- + "Human Wizard",
- + "Sorceror",
- + "Necromancer",
- + "Warlock",
- + "Cleric",
- + "Bishop",
- + "Prophet",
- + "Elven Fighter",
- + "Elven Knight",
- + "Temple Knight",
- + "Swordsinger",
- + "Elven Scout",
- + "Plainswalker",
- + "Silver Ranger",
- + "Elven Mystic",
- + "Elven Wizard",
- + "Spellsinger",
- + "Elemental Summoner",
- + "Elven Oracle",
- + "Elven Elder",
- + "Dark Fighter",
- + "Palus Knight",
- + "Shillien Knight",
- + "Bladedancer",
- + "Assassin",
- + "Abyss Walker",
- + "Phantom Ranger",
- + "Dark Elven Mystic",
- + "Dark Elven Wizard",
- + "Spellhowler",
- + "Phantom Summoner",
- + "Shillien Oracle",
- + "Shillien Elder",
- + "Orc Fighter",
- + "Orc Raider",
- + "Destroyer",
- + "Orc Monk",
- + "Tyrant",
- + "Orc Mystic",
- + "Orc Shaman",
- + "Overlord",
- + "Warcryer",
- + "Dwarven Fighter",
- + "Dwarven Scavenger",
- + "Bounty Hunter",
- + "Dwarven Artisan",
- + "Warsmith",
- + "dummyEntry1",
- + "dummyEntry2",
- + "dummyEntry3",
- + "dummyEntry4",
- + "dummyEntry5",
- + "dummyEntry6",
- + "dummyEntry7",
- + "dummyEntry8",
- + "dummyEntry9",
- + "dummyEntry10",
- + "dummyEntry11",
- + "dummyEntry12",
- + "dummyEntry13",
- + "dummyEntry14",
- + "dummyEntry15",
- + "dummyEntry16",
- + "dummyEntry17",
- + "dummyEntry18",
- + "dummyEntry19",
- + "dummyEntry20",
- + "dummyEntry21",
- + "dummyEntry22",
- + "dummyEntry23",
- + "dummyEntry24",
- + "dummyEntry25",
- + "dummyEntry26",
- + "dummyEntry27",
- + "dummyEntry28",
- + "dummyEntry29",
- + "dummyEntry30",
- + "Duelist",
- + "DreadNought",
- + "Phoenix Knight",
- + "Hell Knight",
- + "Sagittarius",
- + "Adventurer",
- + "Archmage",
- + "Soultaker",
- + "Arcana Lord",
- + "Cardinal",
- + "Hierophant",
- + "Eva Templar",
- + "Sword Muse",
- + "Wind Rider",
- + "Moonlight Sentinel",
- + "Mystic Muse",
- + "Elemental Master",
- + "Eva's Saint",
- + "Shillien Templar",
- + "Spectral Dancer",
- + "Ghost Hunter",
- + "Ghost Sentinel",
- + "Storm Screamer",
- + "Spectral Master",
- + "Shillien Saint",
- + "Titan",
- + "Grand Khauatari",
- + "Dominator",
- + "Doomcryer",
- + "Fortune Seeker",
- + "Maestro"
- + };
- + public static final int getClassIdByName(String className)
- + {
- + int currId = 1;
- + for (String name : CHAR_CLASSES)
- + {
- + if (name.equalsIgnoreCase(className))
- + {
- + break;
- + }
- + currId++;
- + }
- + return currId;
- + }
- private static class SingletonHolder
- {
- protected static final PlayerData INSTANCE = new PlayerData();
- diff --git a/java/net/sf/l2j/gameserver/skills/Formulas.java b/java/net/sf/l2j/gameserver/skills/Formulas.java
- index 82b3d77..1599ec6 100644
- --- a/java/net/sf/l2j/gameserver/skills/Formulas.java
- +++ b/java/net/sf/l2j/gameserver/skills/Formulas.java
- @@ -8,6 +8,7 @@
- import net.sf.l2j.Config;
- import net.sf.l2j.gameserver.data.manager.CastleManager;
- import net.sf.l2j.gameserver.data.manager.ClanHallManager;
- +import net.sf.l2j.gameserver.data.manager.ClassDamageManager;
- import net.sf.l2j.gameserver.data.manager.ZoneManager;
- import net.sf.l2j.gameserver.data.xml.PlayerLevelData;
- import net.sf.l2j.gameserver.enums.SiegeSide;
- @@ -480,7 +481,7 @@
- final double critVuln = target.getStatus().calcStat(Stats.CRIT_VULN, 1, target, skill);
- final double daggerVuln = target.getStatus().calcStat(Stats.DAGGER_WPN_VULN, 1, target, null);
- - final double damage = ((attackPower + skillPower) * critDamMul * rndMul * critDamPosMul * posMul * pvpMul * critVuln * daggerVuln + addCritPower) * ((isPvP) ? 70. : 77.) / defence;
- + double damage = ((attackPower + skillPower) * critDamMul * rndMul * critDamPosMul * posMul * pvpMul * critVuln * daggerVuln + addCritPower) * ((isPvP) ? 70. : 77.) / defence;
- if (Config.DEVELOPER)
- {
- @@ -491,6 +492,25 @@
- LOGGER.info("Vulnerabilities: criticalVuln: {}, daggerVuln: {}", critVuln, daggerVuln);
- LOGGER.info("Final blow damage: {}", damage);
- }
- + if (Config.ENABLE_CLASS_DAMAGES && attacker instanceof Player && target instanceof Player)
- + {
- +
- + if (((Player) attacker).isInOlympiadMode() && ((Player) target).isInOlympiadMode())
- + {
- +
- + if (Config.ENABLE_CLASS_DAMAGES_IN_OLY)
- + {
- + damage = damage * ClassDamageManager.getDamageMultiplier((Player) attacker, (Player) target);
- + }
- +
- + }
- + else
- + {
- +
- + damage = damage * ClassDamageManager.getDamageMultiplier((Player) attacker, (Player) target);
- +
- + }
- + }
- return Math.max(1, damage);
- }
- @@ -586,7 +606,25 @@
- else
- damage *= attacker.getStatus().calcStat(Stats.PVP_PHYS_SKILL_DMG, 1, null, null);
- }
- -
- + if (Config.ENABLE_CLASS_DAMAGES && attacker instanceof Player && target instanceof Player)
- + {
- +
- + if (((Player) attacker).isInOlympiadMode() && ((Player) target).isInOlympiadMode())
- + {
- +
- + if (Config.ENABLE_CLASS_DAMAGES_IN_OLY)
- + {
- + damage = damage * ClassDamageManager.getDamageMultiplier((Player) attacker, (Player) target);
- + }
- +
- + }
- + else
- + {
- +
- + damage = damage * ClassDamageManager.getDamageMultiplier((Player) attacker, (Player) target);
- +
- + }
- + }
- // Weapon elemental damages
- damage += calcElemental(attacker, target, null);
- @@ -662,7 +700,25 @@
- else
- damage *= attacker.getStatus().calcStat(Stats.PVP_PHYS_SKILL_DMG, 1, null, null);
- }
- -
- + if (Config.ENABLE_CLASS_DAMAGES && attacker instanceof Player && target instanceof Player)
- + {
- +
- + if (((Player) attacker).isInOlympiadMode() && ((Player) target).isInOlympiadMode())
- + {
- +
- + if (Config.ENABLE_CLASS_DAMAGES_IN_OLY)
- + {
- + damage = damage * ClassDamageManager.getDamageMultiplier((Player) attacker, (Player) target);
- + }
- +
- + }
- + else
- + {
- +
- + damage = damage * ClassDamageManager.getDamageMultiplier((Player) attacker, (Player) target);
- +
- + }
- + }
- damage *= calcElemental(attacker, target, skill);
- return damage;
Add Comment
Please, Sign In to add comment