Advertisement
Sarada-L2

Balanced Classes Acis 398 Adpt Yo: Sarada

May 25th, 2021
1,365
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 34.10 KB | None | 0 0
  1. diff --git a/config/CustomMods/Classes/ClassesDamages.ini b/config/CustomMods/Classes/ClassesDamages.ini
  2. new file mode 100644
  3. index 0000000..e284c65
  4. --- /dev/null
  5. +++ b/config/CustomMods/Classes/ClassesDamages.ini
  6. @@ -0,0 +1,180 @@
  7. +#====================================================
  8. +#[PT] 3° JOB DANOS CAUSADOS EM TODOS OS FIGHTERS
  9. +#[EN] 3° JOB Damages to Fighters
  10. +#====================================================
  11. +Duelist__ToFighter=1.0
  12. +DreadNought__ToFighter=1.0
  13. +Phoenix_Knight__ToFighter=1.0
  14. +Hell_Knight__ToFighter=1.0
  15. +Sagittarius__ToFighter=1.0
  16. +Adventurer__ToFighter=1.0
  17. +Archmage__ToFighter=1.0
  18. +Soultaker__ToFighter=1.0
  19. +Arcana_Lord__ToFighter=1.0
  20. +Cardinal__ToFighter=1.0
  21. +Hierophant__ToFighter=1.0
  22. +Eva_Templar__ToFighter=1.0
  23. +Sword_Muse__ToFighter=1.0
  24. +Wind_Rider__ToFighter=1.0
  25. +Moonlight_Sentinel__ToFighter=1.0
  26. +Mystic_Muse__ToFighter=1.0
  27. +Elemental_Master__ToFighter=1.0
  28. +Eva_s_Saint__ToFighter=1.0
  29. +Shillien_Templar__ToFighter=1.0
  30. +Spectral_Dancer__ToFighter=1.0
  31. +Ghost_Hunter__ToFighter=1.0
  32. +Ghost_Sentinel__ToFighter=1.0
  33. +Storm_Screamer__ToFighter=1.0
  34. +Spectral_Master__ToFighter=1.0
  35. +Shillien_Saint__ToFighter=1.0
  36. +Titan__ToFighter=1.0
  37. +Grand_Khauatari__ToFighter=1.0
  38. +Dominator__ToFighter=1.0
  39. +Doomcryer__ToFighter=1.0
  40. +Fortune_Seeker__ToFighter=1.0
  41. +Maestro__ToFighter=1.0
  42. +#====================================================
  43. +#[PT]3° JOB DANOS CAUSADOS EM TODOS OS MAGOS
  44. +#[EN]3° JOB Damages to Mage
  45. +#====================================================
  46. +Duelist__ToMage=1.1
  47. +DreadNought__ToMage=1.0
  48. +Phoenix_Knight__ToMage=1.0
  49. +Hell_Knight__ToMage=1.0
  50. +Sagittarius__ToMage=1.0
  51. +Adventurer__ToMage=1.0
  52. +Archmage__ToMage=1.0
  53. +Soultaker__ToMage=1.0
  54. +Arcana_Lord__ToMage=1.0
  55. +Cardinal__ToMage=1.0
  56. +Hierophant__ToMage=1.0
  57. +Eva_Templar__ToMage=1.0
  58. +Sword_Muse__ToMage=1.0
  59. +Wind_Rider__ToMage=1.0
  60. +Moonlight_Sentinel__ToMage=1.0
  61. +Mystic_Muse__ToMage=1.0
  62. +Elemental_Master__ToMage=1.0
  63. +Eva_s_Saint__ToMage=1.0
  64. +Shillien_Templar__ToMage=1.0
  65. +Spectral_Dancer__ToMage=1.0
  66. +Ghost_Hunter__ToMage=1.0
  67. +Ghost_Sentinel__ToMage=1.0
  68. +Storm_Screamer__ToMage=1.0
  69. +Spectral_Master__ToMage=1.0
  70. +Shillien_Saint__ToMage=1.0
  71. +Titan__ToMage=1.0
  72. +Grand_Khauatari__ToMage=1.0
  73. +Dominator__ToMage=0.95
  74. +Doomcryer__ToMage=0.95
  75. +Fortune_Seeker__ToMage=1.0
  76. +Maestro__ToMage=1.0
  77. +#====================================================
  78. +#[PT]3° JOB DANOS DOS FIGHTERS EM DETERMINADA CLASSE
  79. +#[EN]3° JOB Damages Fighter per class
  80. +#====================================================
  81. +Duelist__ByFighter=1.0
  82. +DreadNought__ByFighter=1.0
  83. +Phoenix_Knight__ByFighter=1.0
  84. +Hell_Knight__ByFighter=1.0
  85. +Sagittarius__ByFighter1.0
  86. +Adventurer__ByFighter=1.0
  87. +Archmage__ByFighter=1.0
  88. +Soultaker__ByFighter=1.0
  89. +Arcana_Lord__ByFighter=1.0
  90. +Cardinal__ByFighter=1.0
  91. +Hierophant__ByFighter=1.0
  92. +Eva_Templar__ByFighter=1.0
  93. +Sword_Muse__ByFighter=1.0
  94. +Wind_Rider__ByFighter=1.0
  95. +Moonlight_Sentinel__ByFighter=1.0
  96. +Mystic_Muse__ByFighter=1.0
  97. +Elemental_Master__ByFighter=1.0
  98. +Eva_s_Saint__ByFighter=1.0
  99. +Shillien_Templar__ByFighter=1.0
  100. +Spectral_Dancer__ByFighter=1.0
  101. +Ghost_Hunter__ByFighter=1.0
  102. +Ghost_Sentinel__ByFighter=1.0
  103. +Storm_Screamer__ByFighter=1.0
  104. +Spectral_Master__ByFighter=1.0
  105. +Shillien_Saint__ByFighter=1.0
  106. +Titan__ByFighter=1.0
  107. +Grand_Khauatari__ByFighter=1.0
  108. +Dominator__ByFighter=1.0
  109. +Doomcryer__ByFighter=1.0
  110. +Fortune_Seeker__ByFighter=1.0
  111. +Maestro__ByFighter=1.0
  112. +#====================================================
  113. +#[PT]3° JOB DANOS DOS MAGOS EM DETERMINADA CLASSE
  114. +#[EN]3° JOB Damages Fighter per class
  115. +#====================================================
  116. +Duelist__ByMage=1.0
  117. +DreadNought__ByMage=1.0
  118. +Phoenix_Knight__ByMage=1.0
  119. +Hell_Knight__ByMage=1.0
  120. +Sagittarius__ByMage=1.0
  121. +Adventurer__ByMage=1.0
  122. +Archmage__ByMage=1.0
  123. +Soultaker__ByMage=1.0
  124. +Arcana_Lord__ByMage=1.0
  125. +Cardinal__ByMage=1.0
  126. +Hierophant__ByMage=1.0
  127. +Eva_Templar__ByMage=1.0
  128. +Sword_Muse__ByMage=1.0
  129. +Wind_Rider__ByMage=1.0
  130. +Moonlight_Sentinel__ByMage=1.0
  131. +Mystic_Muse__ByMage=1.0
  132. +Elemental_Master__ByMage=1.0
  133. +Eva_s_Saint__ByMage=1.0
  134. +Shillien_Templar__ByMage=1.0
  135. +Spectral_Dancer__ByMage=1.0
  136. +Ghost_Hunter__ByMage=1.0
  137. +Ghost_Sentinel__ByMage=1.0
  138. +Storm_Screamer__ByMage=1.0
  139. +Spectral_Master__ByMage=1.0
  140. +Shillien_Saint__ByMage=1.0
  141. +Titan__ByMage=1.0
  142. +Grand_Khauatari__ByMage=1.0
  143. +Dominator__ByMage=1.0
  144. +Doomcryer__ByMage=1.0
  145. +Fortune_Seeker__ByMage=1.0
  146. +Maestro__ByMage=1.0
  147. +#====================================================
  148. +#[PT]1° e 2° Job DANOS CAUSADOS EM TODOS OS MAGOS
  149. +#[EN]1° and 2° Job Damages to Mages
  150. +#====================================================
  151. +Human_Mystic__ToMage=1.0
  152. +Human_Wizard__ToMage=1.0
  153. +Sorceror__ToMage=1.0
  154. +Necromancer__ToMage=1.0
  155. +Warlock__ToMage=1.0
  156. +Elven_Mystic__ToMage=1.0
  157. +Elven_Wizard__ToMage=1.0
  158. +Spellsinger__ToMage=1.0
  159. +Dark_Elven_Mystic__ToMage=1.0
  160. +Dark_Elven_Wizard__ToMage=1.0
  161. +Spellhowler__ToMage=1.0
  162. +Phantom_Summoner__ToMage=1.0
  163. +Orc_Figther__ToMage=1.0
  164. +Orc_Mystic__ToMage=1.0
  165. +Orc_Shaman__ToMage=1.0
  166. +Ovelord__ToMage=1.0
  167. +#====================================================
  168. +#[PT]1° e 2° Job DANOS CAUSADOS EM TODOS OS FIGHTERS
  169. +#[EN]1° and 2° Job Damages to Fighters
  170. +#====================================================
  171. +Human_Mystic__ToFighter=1.0
  172. +Human_Wizard__ToFighter=1.0
  173. +Sorceror__ToFighter=1.0
  174. +Necromancer__ToFighter=1.0
  175. +Warlock__ToFighter=1.0
  176. +Elven_Mystic__ToFighter=1.0
  177. +Elven_Wizard__ToFighter=1.0
  178. +Spellsinger__ToFighter=1.0
  179. +Dark_Elven_Mystic__ToFighter=1.0
  180. +Dark_Elven_Wizard__ToFighter=1.0
  181. +Spellhowler__ToFighter=1.0
  182. +Phantom_Summoner__ToFighter=1.0
  183. +Orc_Figther__ToFighter=1.0
  184. +Orc_Mystic__ToFighter=1.0
  185. +Orc_Shaman__ToFighter=1.0
  186. +Ovelord__ToFighter=1.0
  187. diff --git a/config/CustomMods/Classes/ClassesDamagesOly.ini b/config/CustomMods/Classes/ClassesDamagesOly.ini
  188. new file mode 100644
  189. index 0000000..5ca94ba
  190. --- /dev/null
  191. +++ b/config/CustomMods/Classes/ClassesDamagesOly.ini
  192. @@ -0,0 +1,70 @@
  193. +#====================================================
  194. +#[PT] 3° Job DANOS CAUSADOS EM TODOS OS FIGHTERS
  195. +#[EN] 3° Job Damages to Fighters
  196. +#====================================================
  197. +Duelist__ToFighter=1.4
  198. +DreadNought__ToFighter=1.1
  199. +Phoenix_Knight__ToFighter=2.2
  200. +Hell_Knight__ToFighter=2.3
  201. +Sagittarius__ToFighter=1.2
  202. +Adventurer__ToFighter=1.3
  203. +Archmage__ToFighter=0.55
  204. +Soultaker__ToFighter=0.3
  205. +Arcana_Lord__ToFighter=1.3
  206. +Cardinal__ToFighter=1.4
  207. +Hierophant__ToFighter=1.4
  208. +Eva_Templar__ToFighter=1.2
  209. +Sword_Muse__ToFighter=1.4
  210. +Wind_Rider__ToFighter=1.35
  211. +Moonlight_Sentinel__ToFighter=1.2
  212. +Mystic_Muse__ToFighter=0.55
  213. +Elemental_Master__ToFighter=1.4
  214. +Eva_s_Saint__ToFighter=1.4
  215. +Shillien_Templar__ToFighter=1.4
  216. +Spectral_Dancer__ToFighter=1.4
  217. +Ghost_Hunter__ToFighter=1.35
  218. +Ghost_Sentinel__ToFighter=1.2
  219. +Storm_Screamer__ToFighter=0.3
  220. +Spectral_Master__ToFighter=1.4
  221. +Shillien_Saint__ToFighter=1.4
  222. +Titan__ToFighter=1.5
  223. +Grand_Khauatari__ToFighter=0.7
  224. +Dominator__ToFighter=0.35
  225. +Doomcryer__ToFighter=0.35
  226. +Fortune_Seeker__ToFighter=2.0
  227. +Maestro__ToFighter=2.0
  228. +#====================================================
  229. +#[PT]3° JOB DANOS CAUSADOS EM TODOS OS MAGOS
  230. +#[EN]3° JOB Damages to Mage
  231. +#====================================================
  232. +Duelist__ToMage=1.4
  233. +DreadNought__ToMage=1.1
  234. +Phoenix_Knight__ToMage=2.2
  235. +Hell_Knight__ToMage=2.3
  236. +Sagittarius__ToMage=1.2
  237. +Adventurer__ToMage=1.3
  238. +Archmage__ToMage=0.55
  239. +Soultaker__ToMage=0.3
  240. +Arcana_Lord__ToMage=1.3
  241. +Cardinal__ToMage=1.4
  242. +Hierophant__ToMage=1.4
  243. +Eva_Templar__ToMage=1.2
  244. +Sword_Muse__ToMage=1.4
  245. +Wind_Rider__ToMage=1.35
  246. +Moonlight_Sentinel__ToMage=1.2
  247. +Mystic_Muse__ToMage=0.55
  248. +Elemental_Master__ToMage=1.4
  249. +Eva_s_Saint__ToMage=1.4
  250. +Shillien_Templar__ToMage=1.4
  251. +Spectral_Dancer__ToMage=1.4
  252. +Ghost_Hunter__ToMage=1.35
  253. +Ghost_Sentinel__ToMage=1.2
  254. +Storm_Screamer__ToMage=0.3
  255. +Spectral_Master__ToMage=1.4
  256. +Shillien_Saint__ToMage=1.4
  257. +Titan__ToMage=1.5
  258. +Grand_Khauatari__ToMage=0.7
  259. +Dominator__ToMage=0.35
  260. +Doomcryer__ToMage=0.35
  261. +Fortune_Seeker__ToMage=2.0
  262. +Maestro__ToMage=2.0
  263. diff --git a/config/CustomMods/SpecialMods.ini b/config/CustomMods/SpecialMods.ini
  264. index 3110294..e9c2e61 100644
  265. --- a/config/CustomMods/SpecialMods.ini
  266. +++ b/config/CustomMods/SpecialMods.ini
  267. @@ -54,3 +54,11 @@
  268. # Arrows IDS = 1341,1342,1343,1344,1345
  269. AutoLootExcludeItems = 1341,1342,1343,1344,1345,57
  270.  
  271. +#====================================================
  272. +# OLLY SETTINGS
  273. +#====================================================
  274. +# Enable Class Damages Settings
  275. +EnableClassDamagesSettings = True
  276. +EnableClassDamagesLogger = False
  277. +EnableClassDamagesSettingsInOly = True
  278. +
  279. diff --git a/java/net/sf/l2j/Config.java b/java/net/sf/l2j/Config.java
  280. index 39cb5b7..94de39e 100644
  281. --- a/java/net/sf/l2j/Config.java
  282. +++ b/java/net/sf/l2j/Config.java
  283. @@ -55,6 +55,9 @@
  284. // Clans settings
  285. // --------------------------------------------------
  286. /** Clans */
  287. + public static boolean ENABLE_CLASS_DAMAGES;
  288. + public static boolean ENABLE_CLASS_DAMAGES_IN_OLY;
  289. + public static boolean ENABLE_CLASS_DAMAGES_LOGGER;
  290. public static boolean ENABLE_ENCHANT_ANNOUNCE;
  291. public static int ENCHANT_ANNOUNCE_LEVEL;
  292. public static boolean ALT_GAME_VIEWNPC;
  293. @@ -1510,6 +1513,9 @@
  294. private static final void loadSpecial()
  295. {
  296. final ExProperties Special = initProperties(SPECIAL_MODS);
  297. + ENABLE_CLASS_DAMAGES = Special.getProperty("EnableClassDamagesSettings", true);
  298. + ENABLE_CLASS_DAMAGES_IN_OLY = Special.getProperty("EnableClassDamagesSettingsInOly", true);
  299. + ENABLE_CLASS_DAMAGES_LOGGER = Special.getProperty("EnableClassDamagesLogger", true);
  300. ENABLE_ENCHANT_ANNOUNCE = Boolean.parseBoolean(Special.getProperty("EnableEnchantAnnounce", "False"));
  301. ENCHANT_ANNOUNCE_LEVEL = Integer.parseInt(Special.getProperty("EnchantAnnounceLevel", "16"));
  302. ALT_GAME_VIEWNPC = Boolean.parseBoolean(Special.getProperty("AltGameViewNpc", "False"));
  303. diff --git a/java/net/sf/l2j/gameserver/GameServer.java b/java/net/sf/l2j/gameserver/GameServer.java
  304. index 3cfc5b7..22b0419 100644
  305. --- a/java/net/sf/l2j/gameserver/GameServer.java
  306. +++ b/java/net/sf/l2j/gameserver/GameServer.java
  307. @@ -27,6 +27,7 @@
  308. import net.sf.l2j.gameserver.data.manager.CastleManager;
  309. import net.sf.l2j.gameserver.data.manager.CastleManorManager;
  310. import net.sf.l2j.gameserver.data.manager.ClanHallManager;
  311. +import net.sf.l2j.gameserver.data.manager.ClassDamageManager;
  312. import net.sf.l2j.gameserver.data.manager.CoupleManager;
  313. import net.sf.l2j.gameserver.data.manager.CursedWeaponManager;
  314. import net.sf.l2j.gameserver.data.manager.DayNightManager;
  315. @@ -38,6 +39,7 @@
  316. import net.sf.l2j.gameserver.data.manager.GrandBossManager;
  317. import net.sf.l2j.gameserver.data.manager.HeroManager;
  318. import net.sf.l2j.gameserver.data.manager.LotteryManager;
  319. +import net.sf.l2j.gameserver.data.manager.OlympiadDamageManager;
  320. import net.sf.l2j.gameserver.data.manager.PartyMatchRoomManager;
  321. import net.sf.l2j.gameserver.data.manager.PartyZoneReward;
  322. import net.sf.l2j.gameserver.data.manager.PetitionManager;
  323. @@ -171,6 +173,15 @@
  324. AnnouncementData.getInstance();
  325. ServerMemoTable.getInstance();
  326.  
  327. + StringUtil.printSection("Classes Damages");
  328. + if (Config.ENABLE_CLASS_DAMAGES)
  329. + ClassDamageManager.loadConfig();
  330. +
  331. + if (Config.ENABLE_CLASS_DAMAGES_IN_OLY)
  332. + OlympiadDamageManager.loadConfig();
  333. + else
  334. + LOGGER.info("Game Server Info is disabled.");
  335. +
  336. StringUtil.printSection("Skills");
  337. SkillTable.getInstance();
  338. SkillTreeData.getInstance();
  339. diff --git a/java/net/sf/l2j/gameserver/data/manager/ClassDamageManager.java b/java/net/sf/l2j/gameserver/data/manager/ClassDamageManager.java
  340. new file mode 100644
  341. index 0000000..fa2966d
  342. --- /dev/null
  343. +++ b/java/net/sf/l2j/gameserver/data/manager/ClassDamageManager.java
  344. @@ -0,0 +1,191 @@
  345. +package net.sf.l2j.gameserver.data.manager;
  346. +
  347. +import java.io.File;
  348. +import java.io.FileInputStream;
  349. +import java.io.IOException;
  350. +import java.io.InputStream;
  351. +import java.util.Hashtable;
  352. +import java.util.Properties;
  353. +import java.util.Set;
  354. +import java.util.logging.Logger;
  355. +
  356. +import net.sf.l2j.Config;
  357. +import net.sf.l2j.gameserver.data.xml.PlayerData;
  358. +import net.sf.l2j.gameserver.model.actor.Player;
  359. +
  360. +public class ClassDamageManager
  361. +{
  362. + private static final Logger _log = Logger.getLogger(ClassDamageManager.class.getName());
  363. + private static Hashtable<Integer, Double> damage_to_mage = new Hashtable<>();
  364. + private static Hashtable<Integer, Double> damage_to_fighter = new Hashtable<>();
  365. + private static Hashtable<Integer, Double> damage_by_mage = new Hashtable<>();
  366. + private static Hashtable<Integer, Double> damage_by_fighter = new Hashtable<>();
  367. + private static Hashtable<Integer, String> id_to_name = new Hashtable<>();
  368. + private static Hashtable<String, Integer> name_to_id = new Hashtable<>();
  369. + public static void loadConfig()
  370. + {
  371. + String STATUS_FILE = "./config/CustomMods/Classes/ClassesDamages.ini";
  372. + @SuppressWarnings("resource")
  373. + InputStream is = null;
  374. + File file = null;
  375. + try
  376. + {
  377. + Properties scriptSetting = new Properties();
  378. + file = new File(STATUS_FILE);
  379. + is = new FileInputStream(file);
  380. + scriptSetting.load(is);
  381. +
  382. + Set<Object> key_set = scriptSetting.keySet();
  383. + for (Object key : key_set)
  384. + {
  385. + String key_string = (String) key;
  386. +
  387. + String[] class_and_type = key_string.split("__");
  388. +
  389. + String class_name = class_and_type[0].replace("_", " ");
  390. + if (class_name.equals("Eva s Saint"))
  391. + {
  392. + class_name = "Eva's Saint";
  393. + }
  394. + String type = class_and_type[1];
  395. +
  396. + Integer class_id = Integer.valueOf(PlayerData.getClassIdByName(class_name) - 1);
  397. +
  398. + id_to_name.put(class_id, class_name);
  399. + name_to_id.put(class_name, class_id);
  400. + if (type.equals("ToFighter"))
  401. + {
  402. + damage_to_fighter.put(class_id, Double.valueOf(Double.parseDouble(scriptSetting.getProperty(key_string))));
  403. + }
  404. + else if (type.equals("ToMage"))
  405. + {
  406. + damage_to_mage.put(class_id, Double.valueOf(Double.parseDouble(scriptSetting.getProperty(key_string))));
  407. + }
  408. + else if (type.equals("ByFighter"))
  409. + {
  410. + damage_by_fighter.put(class_id, Double.valueOf(Double.parseDouble(scriptSetting.getProperty(key_string))));
  411. + }
  412. + else if (type.equals("ByMage"))
  413. + {
  414. + damage_by_mage.put(class_id, Double.valueOf(Double.parseDouble(scriptSetting.getProperty(key_string))));
  415. + }
  416. + }
  417. + _log.info("Loaded " + id_to_name.size() + " classes Damages configurations");
  418. + return;
  419. + }
  420. + catch (Exception e)
  421. + {
  422. + e.printStackTrace();
  423. + }
  424. + finally
  425. + {
  426. + if (is != null)
  427. + {
  428. + try
  429. + {
  430. + is.close();
  431. + }
  432. + catch (IOException e)
  433. + {
  434. + e.printStackTrace();
  435. + }
  436. + }
  437. + }
  438. + }
  439. +
  440. + public static double getClassDamageToMage(int id)
  441. + {
  442. + Double multiplier = damage_to_mage.get(Integer.valueOf(id));
  443. + if (multiplier != null)
  444. + {
  445. + return multiplier.doubleValue();
  446. + }
  447. + return 1.0D;
  448. + }
  449. +
  450. + public static double getClassDamageToFighter(int id)
  451. + {
  452. + Double multiplier = damage_to_fighter.get(Integer.valueOf(id));
  453. + if (multiplier != null)
  454. + {
  455. + return multiplier.doubleValue();
  456. + }
  457. + return 1.0D;
  458. + }
  459. +
  460. + public static double getClassDamageByMage(int id)
  461. + {
  462. + Double multiplier = damage_by_mage.get(Integer.valueOf(id));
  463. + if (multiplier != null)
  464. + {
  465. + return multiplier.doubleValue();
  466. + }
  467. + return 1.0D;
  468. + }
  469. +
  470. + public static double getClassDamageByFighter(int id)
  471. + {
  472. + Double multiplier = damage_by_fighter.get(Integer.valueOf(id));
  473. + if (multiplier != null)
  474. + {
  475. + return multiplier.doubleValue();
  476. + }
  477. + return 1.0D;
  478. + }
  479. +
  480. + public static int getIdByName(String name)
  481. + {
  482. + Integer id = name_to_id.get(name);
  483. + if (id != null)
  484. + {
  485. + return id.intValue();
  486. + }
  487. + return 0;
  488. + }
  489. +
  490. + public static String getNameById(int id)
  491. + {
  492. + String name = id_to_name.get(Integer.valueOf(id));
  493. + if (name != null)
  494. + {
  495. + return name;
  496. + }
  497. + return "";
  498. + }
  499. +
  500. + public static double getDamageMultiplier(Player attacker, Player attacked)
  501. + {
  502. + if ((attacker == null) || (attacked == null))
  503. + {
  504. + return 1.0D;
  505. + }
  506. + double attackerMulti = 1.0D;
  507. + if (attacked.isMageClass())
  508. + {
  509. + attackerMulti = getClassDamageToMage(attacker.getClassId().getId());
  510. + }
  511. + else
  512. + {
  513. + attackerMulti = getClassDamageToFighter(attacker.getClassId().getId());
  514. + }
  515. + double attackedMulti = 1.0D;
  516. + if (attacker.isMageClass())
  517. + {
  518. + attackedMulti = getClassDamageByMage(attacked.getClassId().getId());
  519. + }
  520. + else
  521. + {
  522. + attackedMulti = getClassDamageByFighter(attacked.getClassId().getId());
  523. + }
  524. + double output = attackerMulti * attackedMulti;
  525. + if (Config.ENABLE_CLASS_DAMAGES_LOGGER)
  526. + {
  527. + _log.info("ClassDamageManager -");
  528. + _log.info("ClassDamageManager - Attacker: " + attacker.getName() + " Class: " + getNameById(attacker.getClassId().getId()) + " ClassId: " + attacker.getClassId().getId() + " isMage: " + attacker.isMageClass() + " mult: " + attackerMulti);
  529. + _log.info("ClassDamageManager - Attacked: " + attacked.getName() + " Class: " + getNameById(attacked.getClassId().getId()) + " ClassId: " + attacked.getClassId().getId() + " isMage: " + attacked.isMageClass() + " mult: " + attackedMulti);
  530. + _log.info("ClassDamageManager - FinalMultiplier: " + output);
  531. + _log.info("ClassDamageManager -");
  532. + }
  533. + return output;
  534. + }
  535. +}
  536. diff --git a/java/net/sf/l2j/gameserver/data/manager/OlympiadDamageManager.java b/java/net/sf/l2j/gameserver/data/manager/OlympiadDamageManager.java
  537. new file mode 100644
  538. index 0000000..274e5cf
  539. --- /dev/null
  540. +++ b/java/net/sf/l2j/gameserver/data/manager/OlympiadDamageManager.java
  541. @@ -0,0 +1,192 @@
  542. +package net.sf.l2j.gameserver.data.manager;
  543. +
  544. +import java.io.File;
  545. +import java.io.FileInputStream;
  546. +import java.io.IOException;
  547. +import java.io.InputStream;
  548. +import java.util.Hashtable;
  549. +import java.util.Properties;
  550. +import java.util.Set;
  551. +import java.util.logging.Logger;
  552. +
  553. +import net.sf.l2j.Config;
  554. +import net.sf.l2j.gameserver.data.xml.PlayerData;
  555. +import net.sf.l2j.gameserver.model.actor.Player;
  556. +
  557. +public class OlympiadDamageManager
  558. +{
  559. + private static final Logger _log = Logger.getLogger(OlympiadDamageManager.class.getName());
  560. + private static Hashtable<Integer, Double> damage_to_mage = new Hashtable<>();
  561. + private static Hashtable<Integer, Double> damage_to_fighter = new Hashtable<>();
  562. + private static Hashtable<Integer, Double> damage_by_mage = new Hashtable<>();
  563. + private static Hashtable<Integer, Double> damage_by_fighter = new Hashtable<>();
  564. + private static Hashtable<Integer, String> id_to_name = new Hashtable<>();
  565. + private static Hashtable<String, Integer> name_to_id = new Hashtable<>();
  566. +
  567. + public static void loadConfig()
  568. + {
  569. + String STATUS_FILE = "./config/CustomMods/Classes/ClassesDamagesOly.ini";
  570. + @SuppressWarnings("resource")
  571. + InputStream is = null;
  572. + File file = null;
  573. + try
  574. + {
  575. + Properties scriptSetting = new Properties();
  576. + file = new File(STATUS_FILE);
  577. + is = new FileInputStream(file);
  578. + scriptSetting.load(is);
  579. +
  580. + Set<Object> key_set = scriptSetting.keySet();
  581. + for (Object key : key_set)
  582. + {
  583. + String key_string = (String) key;
  584. +
  585. + String[] class_and_type = key_string.split("__");
  586. +
  587. + String class_name = class_and_type[0].replace("_", " ");
  588. + if (class_name.equals("Eva s Saint"))
  589. + {
  590. + class_name = "Eva's Saint";
  591. + }
  592. + String type = class_and_type[1];
  593. +
  594. + Integer class_id = Integer.valueOf(PlayerData.getClassIdByName(class_name) - 1);
  595. +
  596. + id_to_name.put(class_id, class_name);
  597. + name_to_id.put(class_name, class_id);
  598. + if (type.equals("ToFighter"))
  599. + {
  600. + damage_to_fighter.put(class_id, Double.valueOf(Double.parseDouble(scriptSetting.getProperty(key_string))));
  601. + }
  602. + else if (type.equals("ToMage"))
  603. + {
  604. + damage_to_mage.put(class_id, Double.valueOf(Double.parseDouble(scriptSetting.getProperty(key_string))));
  605. + }
  606. + else if (type.equals("ByFighter"))
  607. + {
  608. + damage_by_fighter.put(class_id, Double.valueOf(Double.parseDouble(scriptSetting.getProperty(key_string))));
  609. + }
  610. + else if (type.equals("ByMage"))
  611. + {
  612. + damage_by_mage.put(class_id, Double.valueOf(Double.parseDouble(scriptSetting.getProperty(key_string))));
  613. + }
  614. + }
  615. + _log.info("Loaded " + id_to_name.size() + " Olympiad Damages configurations");
  616. + return;
  617. + }
  618. + catch (Exception e)
  619. + {
  620. + e.printStackTrace();
  621. + }
  622. + finally
  623. + {
  624. + if (is != null)
  625. + {
  626. + try
  627. + {
  628. + is.close();
  629. + }
  630. + catch (IOException e)
  631. + {
  632. + e.printStackTrace();
  633. + }
  634. + }
  635. + }
  636. + }
  637. +
  638. + public static double getClassDamageToMage(int id)
  639. + {
  640. + Double multiplier = damage_to_mage.get(Integer.valueOf(id));
  641. + if (multiplier != null)
  642. + {
  643. + return multiplier.doubleValue();
  644. + }
  645. + return 1.0D;
  646. + }
  647. +
  648. + public static double getClassDamageToFighter(int id)
  649. + {
  650. + Double multiplier = damage_to_fighter.get(Integer.valueOf(id));
  651. + if (multiplier != null)
  652. + {
  653. + return multiplier.doubleValue();
  654. + }
  655. + return 1.0D;
  656. + }
  657. +
  658. + public static double getClassDamageByMage(int id)
  659. + {
  660. + Double multiplier = damage_by_mage.get(Integer.valueOf(id));
  661. + if (multiplier != null)
  662. + {
  663. + return multiplier.doubleValue();
  664. + }
  665. + return 1.0D;
  666. + }
  667. +
  668. + public static double getClassDamageByFighter(int id)
  669. + {
  670. + Double multiplier = damage_by_fighter.get(Integer.valueOf(id));
  671. + if (multiplier != null)
  672. + {
  673. + return multiplier.doubleValue();
  674. + }
  675. + return 1.0D;
  676. + }
  677. +
  678. + public static int getIdByName(String name)
  679. + {
  680. + Integer id = name_to_id.get(name);
  681. + if (id != null)
  682. + {
  683. + return id.intValue();
  684. + }
  685. + return 0;
  686. + }
  687. +
  688. + public static String getNameById(int id)
  689. + {
  690. + String name = id_to_name.get(Integer.valueOf(id));
  691. + if (name != null)
  692. + {
  693. + return name;
  694. + }
  695. + return "";
  696. + }
  697. +
  698. + public static double getDamageMultiplier(Player attacker, Player attacked)
  699. + {
  700. + if ((attacker == null) || (attacked == null))
  701. + {
  702. + return 1.0D;
  703. + }
  704. + double attackerMulti = 1.0D;
  705. + if (attacked.isMageClass())
  706. + {
  707. + attackerMulti = getClassDamageToMage(attacker.getClassId().getId());
  708. + }
  709. + else
  710. + {
  711. + attackerMulti = getClassDamageToFighter(attacker.getClassId().getId());
  712. + }
  713. + double attackedMulti = 1.0D;
  714. + if (attacker.isMageClass())
  715. + {
  716. + attackedMulti = getClassDamageByMage(attacked.getClassId().getId());
  717. + }
  718. + else
  719. + {
  720. + attackedMulti = getClassDamageByFighter(attacked.getClassId().getId());
  721. + }
  722. + double output = attackerMulti * attackedMulti;
  723. + if (Config.ENABLE_CLASS_DAMAGES_LOGGER)
  724. + {
  725. + _log.info("ClassDamageManager -");
  726. + _log.info("ClassDamageManager - Attacker: " + attacker.getName() + " Class: " + getNameById(attacker.getClassId().getId()) + " ClassId: " + attacker.getClassId().getId() + " isMage: " + attacker.isMageClass() + " mult: " + attackerMulti);
  727. + _log.info("ClassDamageManager - Attacked: " + attacked.getName() + " Class: " + getNameById(attacked.getClassId().getId()) + " ClassId: " + attacked.getClassId().getId() + " isMage: " + attacked.isMageClass() + " mult: " + attackedMulti);
  728. + _log.info("ClassDamageManager - FinalMultiplier: " + output);
  729. + _log.info("ClassDamageManager -");
  730. + }
  731. + return output;
  732. + }
  733. +}
  734. diff --git a/java/net/sf/l2j/gameserver/data/xml/PlayerData.java b/java/net/sf/l2j/gameserver/data/xml/PlayerData.java
  735. index ef70a32..5d7a71a 100644
  736. --- a/java/net/sf/l2j/gameserver/data/xml/PlayerData.java
  737. +++ b/java/net/sf/l2j/gameserver/data/xml/PlayerData.java
  738. @@ -93,7 +93,141 @@
  739. {
  740. return SingletonHolder.INSTANCE;
  741. }
  742. -
  743. + private static final String[] CHAR_CLASSES =
  744. + {
  745. + "Human Fighter",
  746. + "Warrior",
  747. + "Gladiator",
  748. + "Warlord",
  749. + "Human Knight",
  750. + "Paladin",
  751. + "Dark Avenger",
  752. + "Rogue",
  753. + "Treasure Hunter",
  754. + "Hawkeye",
  755. + "Human Mystic",
  756. + "Human Wizard",
  757. + "Sorceror",
  758. + "Necromancer",
  759. + "Warlock",
  760. + "Cleric",
  761. + "Bishop",
  762. + "Prophet",
  763. + "Elven Fighter",
  764. + "Elven Knight",
  765. + "Temple Knight",
  766. + "Swordsinger",
  767. + "Elven Scout",
  768. + "Plainswalker",
  769. + "Silver Ranger",
  770. + "Elven Mystic",
  771. + "Elven Wizard",
  772. + "Spellsinger",
  773. + "Elemental Summoner",
  774. + "Elven Oracle",
  775. + "Elven Elder",
  776. + "Dark Fighter",
  777. + "Palus Knight",
  778. + "Shillien Knight",
  779. + "Bladedancer",
  780. + "Assassin",
  781. + "Abyss Walker",
  782. + "Phantom Ranger",
  783. + "Dark Elven Mystic",
  784. + "Dark Elven Wizard",
  785. + "Spellhowler",
  786. + "Phantom Summoner",
  787. + "Shillien Oracle",
  788. + "Shillien Elder",
  789. + "Orc Fighter",
  790. + "Orc Raider",
  791. + "Destroyer",
  792. + "Orc Monk",
  793. + "Tyrant",
  794. + "Orc Mystic",
  795. + "Orc Shaman",
  796. + "Overlord",
  797. + "Warcryer",
  798. + "Dwarven Fighter",
  799. + "Dwarven Scavenger",
  800. + "Bounty Hunter",
  801. + "Dwarven Artisan",
  802. + "Warsmith",
  803. + "dummyEntry1",
  804. + "dummyEntry2",
  805. + "dummyEntry3",
  806. + "dummyEntry4",
  807. + "dummyEntry5",
  808. + "dummyEntry6",
  809. + "dummyEntry7",
  810. + "dummyEntry8",
  811. + "dummyEntry9",
  812. + "dummyEntry10",
  813. + "dummyEntry11",
  814. + "dummyEntry12",
  815. + "dummyEntry13",
  816. + "dummyEntry14",
  817. + "dummyEntry15",
  818. + "dummyEntry16",
  819. + "dummyEntry17",
  820. + "dummyEntry18",
  821. + "dummyEntry19",
  822. + "dummyEntry20",
  823. + "dummyEntry21",
  824. + "dummyEntry22",
  825. + "dummyEntry23",
  826. + "dummyEntry24",
  827. + "dummyEntry25",
  828. + "dummyEntry26",
  829. + "dummyEntry27",
  830. + "dummyEntry28",
  831. + "dummyEntry29",
  832. + "dummyEntry30",
  833. + "Duelist",
  834. + "DreadNought",
  835. + "Phoenix Knight",
  836. + "Hell Knight",
  837. + "Sagittarius",
  838. + "Adventurer",
  839. + "Archmage",
  840. + "Soultaker",
  841. + "Arcana Lord",
  842. + "Cardinal",
  843. + "Hierophant",
  844. + "Eva Templar",
  845. + "Sword Muse",
  846. + "Wind Rider",
  847. + "Moonlight Sentinel",
  848. + "Mystic Muse",
  849. + "Elemental Master",
  850. + "Eva's Saint",
  851. + "Shillien Templar",
  852. + "Spectral Dancer",
  853. + "Ghost Hunter",
  854. + "Ghost Sentinel",
  855. + "Storm Screamer",
  856. + "Spectral Master",
  857. + "Shillien Saint",
  858. + "Titan",
  859. + "Grand Khauatari",
  860. + "Dominator",
  861. + "Doomcryer",
  862. + "Fortune Seeker",
  863. + "Maestro"
  864. + };
  865. + public static final int getClassIdByName(String className)
  866. + {
  867. + int currId = 1;
  868. + for (String name : CHAR_CLASSES)
  869. + {
  870. + if (name.equalsIgnoreCase(className))
  871. + {
  872. + break;
  873. + }
  874. + currId++;
  875. + }
  876. + return currId;
  877. + }
  878. private static class SingletonHolder
  879. {
  880. protected static final PlayerData INSTANCE = new PlayerData();
  881. diff --git a/java/net/sf/l2j/gameserver/skills/Formulas.java b/java/net/sf/l2j/gameserver/skills/Formulas.java
  882. index 82b3d77..1599ec6 100644
  883. --- a/java/net/sf/l2j/gameserver/skills/Formulas.java
  884. +++ b/java/net/sf/l2j/gameserver/skills/Formulas.java
  885. @@ -8,6 +8,7 @@
  886. import net.sf.l2j.Config;
  887. import net.sf.l2j.gameserver.data.manager.CastleManager;
  888. import net.sf.l2j.gameserver.data.manager.ClanHallManager;
  889. +import net.sf.l2j.gameserver.data.manager.ClassDamageManager;
  890. import net.sf.l2j.gameserver.data.manager.ZoneManager;
  891. import net.sf.l2j.gameserver.data.xml.PlayerLevelData;
  892. import net.sf.l2j.gameserver.enums.SiegeSide;
  893. @@ -480,7 +481,7 @@
  894. final double critVuln = target.getStatus().calcStat(Stats.CRIT_VULN, 1, target, skill);
  895. final double daggerVuln = target.getStatus().calcStat(Stats.DAGGER_WPN_VULN, 1, target, null);
  896.  
  897. - final double damage = ((attackPower + skillPower) * critDamMul * rndMul * critDamPosMul * posMul * pvpMul * critVuln * daggerVuln + addCritPower) * ((isPvP) ? 70. : 77.) / defence;
  898. + double damage = ((attackPower + skillPower) * critDamMul * rndMul * critDamPosMul * posMul * pvpMul * critVuln * daggerVuln + addCritPower) * ((isPvP) ? 70. : 77.) / defence;
  899.  
  900. if (Config.DEVELOPER)
  901. {
  902. @@ -491,6 +492,25 @@
  903. LOGGER.info("Vulnerabilities: criticalVuln: {}, daggerVuln: {}", critVuln, daggerVuln);
  904. LOGGER.info("Final blow damage: {}", damage);
  905. }
  906. + if (Config.ENABLE_CLASS_DAMAGES && attacker instanceof Player && target instanceof Player)
  907. + {
  908. +
  909. + if (((Player) attacker).isInOlympiadMode() && ((Player) target).isInOlympiadMode())
  910. + {
  911. +
  912. + if (Config.ENABLE_CLASS_DAMAGES_IN_OLY)
  913. + {
  914. + damage = damage * ClassDamageManager.getDamageMultiplier((Player) attacker, (Player) target);
  915. + }
  916. +
  917. + }
  918. + else
  919. + {
  920. +
  921. + damage = damage * ClassDamageManager.getDamageMultiplier((Player) attacker, (Player) target);
  922. +
  923. + }
  924. + }
  925. return Math.max(1, damage);
  926. }
  927.  
  928. @@ -586,7 +606,25 @@
  929. else
  930. damage *= attacker.getStatus().calcStat(Stats.PVP_PHYS_SKILL_DMG, 1, null, null);
  931. }
  932. -
  933. + if (Config.ENABLE_CLASS_DAMAGES && attacker instanceof Player && target instanceof Player)
  934. + {
  935. +
  936. + if (((Player) attacker).isInOlympiadMode() && ((Player) target).isInOlympiadMode())
  937. + {
  938. +
  939. + if (Config.ENABLE_CLASS_DAMAGES_IN_OLY)
  940. + {
  941. + damage = damage * ClassDamageManager.getDamageMultiplier((Player) attacker, (Player) target);
  942. + }
  943. +
  944. + }
  945. + else
  946. + {
  947. +
  948. + damage = damage * ClassDamageManager.getDamageMultiplier((Player) attacker, (Player) target);
  949. +
  950. + }
  951. + }
  952. // Weapon elemental damages
  953. damage += calcElemental(attacker, target, null);
  954.  
  955. @@ -662,7 +700,25 @@
  956. else
  957. damage *= attacker.getStatus().calcStat(Stats.PVP_PHYS_SKILL_DMG, 1, null, null);
  958. }
  959. -
  960. + if (Config.ENABLE_CLASS_DAMAGES && attacker instanceof Player && target instanceof Player)
  961. + {
  962. +
  963. + if (((Player) attacker).isInOlympiadMode() && ((Player) target).isInOlympiadMode())
  964. + {
  965. +
  966. + if (Config.ENABLE_CLASS_DAMAGES_IN_OLY)
  967. + {
  968. + damage = damage * ClassDamageManager.getDamageMultiplier((Player) attacker, (Player) target);
  969. + }
  970. +
  971. + }
  972. + else
  973. + {
  974. +
  975. + damage = damage * ClassDamageManager.getDamageMultiplier((Player) attacker, (Player) target);
  976. +
  977. + }
  978. + }
  979. damage *= calcElemental(attacker, target, skill);
  980.  
  981. return damage;
  982.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement