Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- ### Eclipse Workspace Patch 1.0
- #P L2JHellasC
- Index: java/com/l2jhellas/gameserver/model/actor/L2Character.java
- ===================================================================
- --- java/com/l2jhellas/gameserver/model/actor/L2Character.java (revision 515)
- +++ java/com/l2jhellas/gameserver/model/actor/L2Character.java (working copy)
- @@ -6663,7 +6663,17 @@
- {
- return getStat().getPDefUndead(target);
- }
- +
- + public double getPDefAngels(final L2Character target)
- + {
- + return getStat().getPDefAngels(target);
- + }
- + public double getPAtkAngels(final L2Character target)
- + {
- + return getStat().getPAtkAngels(target);
- + }
- +
- public int getPDef(L2Character target)
- {
- return getStat().getPDef(target);
- Index: java/com/l2jhellas/gameserver/skills/Formulas.java
- ===================================================================
- --- java/com/l2jhellas/gameserver/skills/Formulas.java (revision 515)
- +++ java/com/l2jhellas/gameserver/skills/Formulas.java (working copy)
- @@ -19,6 +19,8 @@
- import com.l2jhellas.Config;
- import com.l2jhellas.gameserver.SevenSigns;
- import com.l2jhellas.gameserver.SevenSignsFestival;
- +import com.l2jhellas.gameserver.custom.ClassDamageManager;
- import com.l2jhellas.gameserver.instancemanager.ClanHallManager;
- import com.l2jhellas.gameserver.instancemanager.SiegeManager;
- import com.l2jhellas.gameserver.model.Inventory;
- @@ -1180,6 +1182,21 @@
- // damage /= 1; // 1.3
- }
- }
- +
- + if (Config.ENABLE_CLASS_DAMAGES && attacker instanceof L2PcInstance && target instanceof L2PcInstance)
- + {
- + damage = damage * ClassDamageManager.getDamageMultiplier((L2PcInstance) attacker, (L2PcInstance) target);
- + }
- return damage < 1 ? 1. : damage;
- }
- @@ -1368,6 +1385,21 @@
- else
- damage *= attacker.calcStat(Stats.PVP_PHYS_SKILL_DMG, 1, null, null);
- }
- +
- + if (Config.ENABLE_CLASS_DAMAGES && attacker instanceof L2PcInstance && target instanceof L2PcInstance)
- + {
- + damage = damage * ClassDamageManager.getDamageMultiplier((L2PcInstance) attacker, (L2PcInstance) target);
- + }
- return damage;
- }
- @@ -1448,6 +1480,21 @@
- else
- damage *= attacker.calcStat(Stats.PVP_PHYS_SKILL_DMG, 1, null, null);
- }
- +
- + if (Config.ENABLE_CLASS_DAMAGES && attacker instanceof L2PcInstance && target instanceof L2PcInstance)
- + {
- + damage = damage * ClassDamageManager.getDamageMultiplier((L2PcInstance) attacker, (L2PcInstance) target);
- + }
- return damage;
- }
- Index: java/com/l2jhellas/gameserver/custom/ClassDamageManager.java
- ===================================================================
- --- java/com/l2jhellas/gameserver/custom/ClassDamageManager.java (revision 0)
- +++ java/com/l2jhellas/gameserver/custom/ClassDamageManager.java (working copy)
- @@ -0,0 +1,229 @@
- +/*
- + * L2jFrozen Project - www.l2jfrozen.com
- + *
- + * This program is free software; you can redistribute it and/or modify
- + * it under the terms of the GNU General Public License as published by
- + * the Free Software Foundation; either version 2, or (at your option)
- + * any later version.
- + *
- + * This program is distributed in the hope that it will be useful,
- + * but WITHOUT ANY WARRANTY; without even the implied warranty of
- + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- + * GNU General Public License for more details.
- + *
- + * You should have received a copy of the GNU General Public License
- + * along with this program; if not, write to the Free Software
- + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
- + * 02111-1307, USA.
- + *
- + * http://www.gnu.org/copyleft/gpl.html
- + */
- +package com.l2jhellas.gameserver.custom;
- +
- +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 com.l2jhellas.Config;
- +import com.l2jhellas.gameserver.datatables.xml.CharTemplateData;
- +import com.l2jhellas.gameserver.model.actor.instance.L2PcInstance;
- +
- +/**
- + * @author Shyla
- + */
- +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()
- + {
- + final String SCRIPT = Config.MOD_CLASS_DAMAGES_FILE;
- + InputStream is = null;
- + File file = null;
- + try
- + {
- + final Properties scriptSetting = new Properties();
- + file = new File(SCRIPT);
- + is = new FileInputStream(file);
- + scriptSetting.load(is);
- +
- + final Set<Object> key_set = scriptSetting.keySet();
- +
- + for (final Object key : key_set)
- + {
- +
- + final String key_string = (String) key;
- +
- + final 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";
- +
- + final String type = class_and_type[1];
- +
- + final Integer class_id = CharTemplateData.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.parseDouble(scriptSetting.getProperty(key_string)));
- + }
- + else if (type.equals("ToMage"))
- + {
- + damage_to_mage.put(class_id, Double.parseDouble(scriptSetting.getProperty(key_string)));
- + }
- + else if (type.equals("ByFighter"))
- + {
- + damage_by_fighter.put(class_id, Double.parseDouble(scriptSetting.getProperty(key_string)));
- + }
- + else if (type.equals("ByMage"))
- + {
- + damage_by_mage.put(class_id, Double.parseDouble(scriptSetting.getProperty(key_string)));
- + }
- + // LOGGER.info("class: "+class_name+" key: "+key_string+" classid: "+class_id);
- + // LOGGER.info("multiplier: "+Double.parseDouble(scriptSetting.getProperty(key_string)));
- +
- + }
- +
- + _log.info("Loaded " + id_to_name.size() + " classes Damages configurations");
- +
- + /*
- + * int class_id = 114; LOGGER.info("class: "+id_to_name.get(class_id)+" classid: "+class_id); LOGGER.info("multiplier to fighter: "+damage_to_fighter.get(class_id)); LOGGER.info("multiplier to mage: "+damage_to_mage.get(class_id));
- + * LOGGER.info("multiplier by fighter: "+damage_by_fighter.get(class_id)); LOGGER.info("multiplier by mage: "+damage_by_mage.get(class_id));
- + */
- + }
- + catch (final Exception e)
- + {
- + e.printStackTrace();
- +
- + }
- + finally
- + {
- +
- + if (is != null)
- + {
- + try
- + {
- + is.close();
- + }
- + catch (final IOException e)
- + {
- + e.printStackTrace();
- + }
- + }
- + }
- +
- + }
- +
- + public static double getClassDamageToMage(final int id)
- + {
- +
- + final Double multiplier = damage_to_mage.get(id);
- +
- + if (multiplier != null)
- + return multiplier;
- + return 1;
- + }
- +
- + public static double getClassDamageToFighter(final int id)
- + {
- + final Double multiplier = damage_to_fighter.get(id);
- + if (multiplier != null)
- + return multiplier;
- + return 1;
- + }
- +
- + public static double getClassDamageByMage(final int id)
- + {
- + final Double multiplier = damage_by_mage.get(id);
- + if (multiplier != null)
- + return multiplier;
- + return 1;
- + }
- +
- + public static double getClassDamageByFighter(final int id)
- + {
- + final Double multiplier = damage_by_fighter.get(id);
- + if (multiplier != null)
- + return multiplier;
- + return 1;
- + }
- +
- + public static int getIdByName(final String name)
- + {
- +
- + final Integer id = name_to_id.get(name);
- + if (id != null)
- + return id;
- + return 0;
- + }
- +
- + public static String getNameById(final int id)
- + {
- +
- + final String name = id_to_name.get(id);
- + if (name != null)
- + return name;
- + return "";
- + }
- +
- + /**
- + * return the product between the attackerMultiplier and attackedMultiplier configured into the classDamages.properties
- + * @param attacker
- + * @param attacked
- + * @return output = attackerMulti*attackedMulti
- + */
- + public static double getDamageMultiplier(final L2PcInstance attacker, final L2PcInstance attacked)
- + {
- +
- + if (attacker == null || attacked == null)
- + return 1;
- +
- + double attackerMulti = 1;
- +
- + if (attacked.isMageClass())
- + attackerMulti = getClassDamageToMage(attacker.getClassId().getId());
- + else
- + attackerMulti = getClassDamageToFighter(attacker.getClassId().getId());
- +
- + double attackedMulti = 1;
- +
- + if (attacker.isMageClass())
- + attackedMulti = getClassDamageByMage(attacked.getClassId().getId());
- + else
- + attackedMulti = getClassDamageByFighter(attacked.getClassId().getId());
- +
- + final 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;
- +
- + }
- +
- +}
- Index: java/com/l2jhellas/Config.java
- ===================================================================
- --- java/com/l2jhellas/Config.java (revision 515)
- +++ java/com/l2jhellas/Config.java (working copy)
- @@ -81,12 +82,16 @@
- private static final String EVENT_RAID_CONFIG_FILE = "./config/Events/Raid.ini";
- private static final String EVENT_WEDDING_CONFIG_FILE = "./config/Events/Wedding.ini";
- // Mods Folder
- + private static final String MOD_OTHERS_CONFIG_FILE = "./config/Mods/Others.ini";
- private static final String MOD_CHAMPIONS_CONFIG_FILE = "./config/Mods/Champions.ini";
- private static final String MOD_L2JHellas_CONFIG_FILE = "./config/Mods/L2JHellas.ini";
- private static final String MOD_RANK_CONFIG_FILE = "./config/Mods/Rank PvP System.ini";
- private static final String MOD_AUTOMATION_CONFIG_FILE = "./config/Mods/Automatation.ini";
- private static final String MOD_SMART_CB_CONFIG_FILE = "./config/Mods/Smart Community Board.ini";
- private static final String MOD_CUSTOM_NPC_CONFIG_FILE = "./config/Mods/Custom Npcs.ini";
- + public static final String MOD_CLASS_DAMAGES_FILE = "./config/Mods/ClassDamages.ini";
- +
- // Olympiad Folder
- private static final String OLYMPIAD_FILE = "./config/Olympiad/OlySettings.ini";
- // Others
- @@ -347,6 +352,29 @@
- public static boolean CHAMPION_ENABLE;
- /**
- + * Others Mods Config File
- + */
- + // Class Damages
- + public static boolean ENABLE_CLASS_DAMAGES;
- + public static boolean ENABLE_CLASS_DAMAGES_LOGGER;
- +
- + /**
- * PvP Config File
- */
- public static boolean REMOVE_BUFFS_ON_DIE;
- @@ -1592,6 +1620,66 @@
- CHAMPION_SPCL_LVL_DIFF = Integer.parseInt(ChampionSettings.getProperty("ChampionSpecialItemLevelDiff", "0"));
- /**
- + * Others Mods
- + */
- + /** Class Damage */
- + ENABLE_CLASS_DAMAGES = Boolean.parseBoolean(OthersSettings.getProperty("EnableClassDamagesSettings", "False"));
- + ENABLE_CLASS_DAMAGES_LOGGER = Boolean.parseBoolean(OthersSettings.getProperty("EnableClassDamagesLogger", "False"));
- +
- + /**
- * PvP
- */
- Properties PvPSettings = new Properties();
- Index: config/Mods/Others.ini
- ===================================================================
- --- config/Mods/Others.ini (revision 0)
- +++ config/Mods/Others.ini (working copy)
- @@ -0,0 +1,48 @@
- +#=============================================================
- +# Class Damages
- +#=============================================================
- +# Enable Class Damages Settings
- +EnableClassDamagesSettings = True
- +EnableClassDamagesLogger = True
- \ No newline at end of file
- Index: java/com/l2jhellas/gameserver/model/actor/stat/CharStat.java
- ===================================================================
- --- java/com/l2jhellas/gameserver/model/actor/stat/CharStat.java (revision 515)
- +++ java/com/l2jhellas/gameserver/model/actor/stat/CharStat.java (working copy)
- @@ -437,6 +437,16 @@
- {
- return calcStat(Stats.PATK_DRAGONS, 1, target, null);
- }
- + /** Return the PAtk Modifier against Angels. */
- + public final double getPAtkAngels(final L2Character target)
- + {
- + return calcStat(Stats.PATK_ANGELS, 1, target, null);
- + }
- + /** Return the Pdef Modifier against Angels. */
- + public final double getPDefAngels(final L2Character target)
- + {
- + return calcStat(Stats.PDEF_ANGELS, 1, target, null);
- + }
- /** Return the PAtk Modifier against insects. */
- public final double getPAtkInsects(L2Character target)
- {
- Index: config/Mods/classDamages.ini
- ===================================================================
- --- config/Mods/classDamages.ini (revision 0)
- +++ config/Mods/classDamages.ini (working copy)
- @@ -0,0 +1,134 @@
- +#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
- +
- +
- +#Damages to Mage
- +Duelist__ToMage=1.0
- +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=1.0
- +Doomcryer__ToMage=1.0
- +Fortune_Seeker__ToMage=1.0
- +Maestro__ToMage=1.0
- +
- +
- +#Damages By Fighters
- +Duelist__ByFighter=1.0
- +DreadNought__ByFighter=1.0
- +Phoenix_Knight__ByFighter=1.0
- +Hell_Knight__ByFighter=1.0
- +Sagittarius__ByFighter=1.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
- +
- +
- +#Damages By Mages
- +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
- \ No newline at end of file
- Index: java/com/l2jhellas/gameserver/GameServer.java
- ===================================================================
- --- java/com/l2jhellas/gameserver/GameServer.java (revision 515)
- +++ java/com/l2jhellas/gameserver/GameServer.java (working copy)
- @@ -42,6 +42,8 @@
- import com.l2jhellas.gameserver.controllers.GameTimeController;
- import com.l2jhellas.gameserver.controllers.RecipeController;
- import com.l2jhellas.gameserver.controllers.TradeController;
- +import com.l2jhellas.gameserver.custom.ClassDamageManager;
- import com.l2jhellas.gameserver.datatables.EventDroplist;
- import com.l2jhellas.gameserver.datatables.csv.ExtractableItemsData;
- import com.l2jhellas.gameserver.datatables.sql.BuffTemplateTable;
- @@ -369,6 +371,12 @@
- {
- CoupleManager.getInstance();
- }
- +
- + // Class Damages
- + if (Config.ENABLE_CLASS_DAMAGES) {
- + ClassDamageManager.loadConfig();
- + }
- IpCatcher.ipsLoad();
- // run garbage collector
- Index: java/com/l2jhellas/gameserver/skills/Stats.java
- ===================================================================
- --- java/com/l2jhellas/gameserver/skills/Stats.java (revision 515)
- +++ java/com/l2jhellas/gameserver/skills/Stats.java (working copy)
- @@ -150,6 +150,7 @@
- PATK_DRAGONS("pAtk-dragon"),
- PATK_UNDEAD("pAtk-undead"),
- PATK_MAGIC("pAtk-magic"),
- + PATK_ANGELS("pAtk-angels"),
- // PDEF
- PDEF_PLANTS("pDef-plants"),
- @@ -160,6 +161,7 @@
- PDEF_UNDEAD("pDef-undead"),
- PDEF_GIANTS("pDef-giants"),
- PDEF_MAGIC("pDef-magic"),
- + PDEF_ANGELS("pDef-angels"),
- // VALAKAS
- PATK_VALAKAS("pAtk-valakas"),
Advertisement
Add Comment
Please, Sign In to add comment