SHOW:
|
|
- or go back to the newest paste.
| 1 | ### Eclipse Workspace Patch 1.0 | |
| 2 | #P aCis_datapack | |
| 3 | Index: data/html/admin/server_menu.htm | |
| 4 | =================================================================== | |
| 5 | --- data/html/admin/server_menu.htm (revision 16) | |
| 6 | +++ data/html/admin/server_menu.htm (working copy) | |
| 7 | @@ -18,7 +18,7 @@ | |
| 8 | Reload | |
| 9 | <table width=240> | |
| 10 | <tr> | |
| 11 | - <td><combobox width=120 height=21 var="cb" list=admin;announcement;config;crest;cw;door;htm;item;merchant;multisell;npc;npcwalker;skill;teleport;zone;></td> | |
| 12 | + <td><combobox width=120 height=21 var="cb" list=admin;announcement;balance;config;crest;cw;door;htm;item;merchant;multisell;npc;npcwalker;skill;teleport;zone;></td> | |
| 13 | <td><button value="Reload" action="bypass -h admin_reload $cb" width=75 height=21 back="L2UI_ch3.Btn1_normalOn" fore="L2UI_ch3.Btn1_normal"></td> | |
| 14 | </tr> | |
| 15 | </table><br> | |
| 16 | Index: data/xml/classBalance.xml | |
| 17 | =================================================================== | |
| 18 | --- data/xml/classBalance.xml (revision 0) | |
| 19 | +++ data/xml/classBalance.xml (working copy) | |
| 20 | @@ -0,0 +1,5 @@ | |
| 21 | +<?xml version='1.0' encoding='utf-8'?> | |
| 22 | +<list> | |
| 23 | + <!-- Type List : NORMAL, MAGIC, CRITICAL, M_CRITICAL, BLOW, PHYSICAL_SKILL_DAMAGE, PHYSICAL_SKILL_CRITICAL --> | |
| 24 | + <balance type="NORMAL" class="SHILLIEN_TEMPLAR" target="CARDINAL" value="1.0"/> | |
| 25 | +</list> | |
| 26 | \ No newline at end of file | |
| 27 | #P aCis_gameserver | |
| 28 | Index: java/net/sf/l2j/gameserver/GameServer.java | |
| 29 | =================================================================== | |
| 30 | --- java/net/sf/l2j/gameserver/GameServer.java (revision 20) | |
| 31 | +++ java/net/sf/l2j/gameserver/GameServer.java (working copy) | |
| 32 | @@ -25,6 +25,7 @@ | |
| 33 | import net.sf.l2j.gameserver.data.manager.CastleManager; | |
| 34 | import net.sf.l2j.gameserver.data.manager.CastleManorManager; | |
| 35 | import net.sf.l2j.gameserver.data.manager.ClanHallManager; | |
| 36 | +import net.sf.l2j.gameserver.data.manager.ClassBalanceManager; | |
| 37 | import net.sf.l2j.gameserver.data.manager.CoupleManager; | |
| 38 | import net.sf.l2j.gameserver.data.manager.CursedWeaponManager; | |
| 39 | import net.sf.l2j.gameserver.data.manager.DayNightManager; | |
| 40 | @@ -179,6 +180,7 @@ | |
| 41 | PlayerData.getInstance(); | |
| 42 | PlayerInfoTable.getInstance(); | |
| 43 | PlayerLevelData.getInstance(); | |
| 44 | + ClassBalanceManager.getInstance(); | |
| 45 | OfflineTradersTable.getInstance(); | |
| 46 | NewbieBuffData.getInstance(); | |
| 47 | TeleportLocationData.getInstance(); | |
| 48 | Index: java/net/sf/l2j/gameserver/data/manager/ClassBalanceManager.java | |
| 49 | =================================================================== | |
| 50 | --- java/net/sf/l2j/gameserver/data/manager/ClassBalanceManager.java (revision 0) | |
| 51 | +++ java/net/sf/l2j/gameserver/data/manager/ClassBalanceManager.java (working copy) | |
| 52 | @@ -0,0 +1,113 @@ | |
| 53 | +package net.sf.l2j.gameserver.data.manager; | |
| 54 | + | |
| 55 | +import java.nio.file.Path; | |
| 56 | +import java.util.List; | |
| 57 | +import java.util.concurrent.CopyOnWriteArrayList; | |
| 58 | + | |
| 59 | +import net.sf.l2j.commons.data.xml.IXmlReader; | |
| 60 | +import net.sf.l2j.commons.util.StatsSet; | |
| 61 | + | |
| 62 | +import net.sf.l2j.gameserver.enums.actors.ClassId; | |
| 63 | +import net.sf.l2j.gameserver.model.actor.Creature; | |
| 64 | + | |
| 65 | +import org.w3c.dom.Document; | |
| 66 | + | |
| 67 | +/** | |
| 68 | + * @author StinkyMadness | |
| 69 | + */ | |
| 70 | +public class ClassBalanceManager implements IXmlReader | |
| 71 | +{
| |
| 72 | + private final List<ClassBalanceHolder> _data = new CopyOnWriteArrayList<>(); | |
| 73 | + | |
| 74 | + public enum ClassBalanceType | |
| 75 | + {
| |
| 76 | + NORMAL, | |
| 77 | + MAGIC, | |
| 78 | + CRITICAL, | |
| 79 | + M_CRITICAL, | |
| 80 | + BLOW, | |
| 81 | + PHYSICAL_SKILL_DAMAGE, | |
| 82 | + PHYSICAL_SKILL_CRITICAL; | |
| 83 | + } | |
| 84 | + | |
| 85 | + public ClassBalanceManager() | |
| 86 | + {
| |
| 87 | + load(); | |
| 88 | + } | |
| 89 | + | |
| 90 | + @Override | |
| 91 | + public void load() | |
| 92 | + {
| |
| 93 | + parseFile("./data/xml/classBalance.xml");
| |
| 94 | + LOGGER.info("Loaded {} class balance data.", _data.size());
| |
| 95 | + } | |
| 96 | + | |
| 97 | + public void reload() | |
| 98 | + {
| |
| 99 | + _data.clear(); | |
| 100 | + load(); | |
| 101 | + } | |
| 102 | + | |
| 103 | + @Override | |
| 104 | + public void parseDocument(Document doc, Path path) | |
| 105 | + {
| |
| 106 | + forEach(doc, "list", listNode -> forEach(listNode, "balance", balanceNode -> _data.add(new ClassBalanceHolder(parseAttributes(balanceNode))))); | |
| 107 | + } | |
| 108 | + | |
| 109 | + public double getValueFor(ClassBalanceType type, Creature attacker, Creature target) | |
| 110 | + {
| |
| 111 | + ClassBalanceHolder holder = _data.stream().filter(data -> data.getType() == type && data.getClassId().getId() == attacker.getActingPlayer().getClassId().getId() && data.getTargetId().getId() == target.getActingPlayer().getClassId().getId()).findFirst().orElse(null); | |
| 112 | + return holder == null ? 1.0 : holder.getValue(); | |
| 113 | + } | |
| 114 | + | |
| 115 | + public List<ClassBalanceHolder> getData() | |
| 116 | + {
| |
| 117 | + return _data; | |
| 118 | + } | |
| 119 | + | |
| 120 | + public class ClassBalanceHolder | |
| 121 | + {
| |
| 122 | + private ClassBalanceType _type; | |
| 123 | + private ClassId _classId; | |
| 124 | + private ClassId _targetId; | |
| 125 | + private double _value; | |
| 126 | + | |
| 127 | + public ClassBalanceHolder(StatsSet set) | |
| 128 | + {
| |
| 129 | + _type = ClassBalanceType.valueOf(set.getString("type", "NORMAL"));
| |
| 130 | + _classId = ClassId.valueOf(set.getString("class"));
| |
| 131 | + _targetId = ClassId.valueOf(set.getString("target"));
| |
| 132 | + _value = set.getDouble("value", 1.0);
| |
| 133 | + } | |
| 134 | + | |
| 135 | + public ClassBalanceType getType() | |
| 136 | + {
| |
| 137 | + return _type; | |
| 138 | + } | |
| 139 | + | |
| 140 | + public ClassId getClassId() | |
| 141 | + {
| |
| 142 | + return _classId; | |
| 143 | + } | |
| 144 | + | |
| 145 | + public ClassId getTargetId() | |
| 146 | + {
| |
| 147 | + return _targetId; | |
| 148 | + } | |
| 149 | + | |
| 150 | + public double getValue() | |
| 151 | + {
| |
| 152 | + return _value; | |
| 153 | + } | |
| 154 | + } | |
| 155 | + | |
| 156 | + public static ClassBalanceManager getInstance() | |
| 157 | + {
| |
| 158 | + return SingletonHolder.INSTANCE; | |
| 159 | + } | |
| 160 | + | |
| 161 | + private static class SingletonHolder | |
| 162 | + {
| |
| 163 | + protected static final ClassBalanceManager INSTANCE = new ClassBalanceManager(); | |
| 164 | + } | |
| 165 | +} | |
| 166 | \ No newline at end of file | |
| 167 | Index: java/net/sf/l2j/gameserver/handler/admincommandhandlers/AdminAdmin.java | |
| 168 | =================================================================== | |
| 169 | --- java/net/sf/l2j/gameserver/handler/admincommandhandlers/AdminAdmin.java (revision 20) | |
| 170 | +++ java/net/sf/l2j/gameserver/handler/admincommandhandlers/AdminAdmin.java (working copy) | |
| 171 | @@ -9,6 +9,7 @@ | |
| 172 | import net.sf.l2j.gameserver.data.cache.CrestCache; | |
| 173 | import net.sf.l2j.gameserver.data.cache.HtmCache; | |
| 174 | import net.sf.l2j.gameserver.data.manager.BuyListManager; | |
| 175 | +import net.sf.l2j.gameserver.data.manager.ClassBalanceManager; | |
| 176 | import net.sf.l2j.gameserver.data.manager.CursedWeaponManager; | |
| 177 | import net.sf.l2j.gameserver.data.manager.ZoneManager; | |
| 178 | import net.sf.l2j.gameserver.data.xml.AdminData; | |
| 179 | @@ -168,6 +169,11 @@ | |
| 180 | AnnouncementData.getInstance().reload(); | |
| 181 | activeChar.sendMessage("The content of announcements.xml has been reloaded.");
| |
| 182 | } | |
| 183 | + else if (type.startsWith("balance"))
| |
| 184 | + {
| |
| 185 | + ClassBalanceManager.getInstance().reload(); | |
| 186 | + activeChar.sendMessage("The content of classBalance.xml has been reloaded.");
| |
| 187 | + } | |
| 188 | else if (type.startsWith("config"))
| |
| 189 | {
| |
| 190 | Config.loadGameServer(); | |
| 191 | Index: java/net/sf/l2j/gameserver/skills/Formulas.java | |
| 192 | =================================================================== | |
| 193 | --- java/net/sf/l2j/gameserver/skills/Formulas.java (revision 20) | |
| 194 | +++ java/net/sf/l2j/gameserver/skills/Formulas.java (working copy) | |
| 195 | @@ -7,6 +7,8 @@ | |
| 196 | import net.sf.l2j.Config; | |
| 197 | import net.sf.l2j.gameserver.data.manager.CastleManager; | |
| 198 | import net.sf.l2j.gameserver.data.manager.ClanHallManager; | |
| 199 | +import net.sf.l2j.gameserver.data.manager.ClassBalanceManager; | |
| 200 | +import net.sf.l2j.gameserver.data.manager.ClassBalanceManager.ClassBalanceType; | |
| 201 | import net.sf.l2j.gameserver.data.manager.ZoneManager; | |
| 202 | import net.sf.l2j.gameserver.data.xml.PlayerLevelData; | |
| 203 | import net.sf.l2j.gameserver.enums.SiegeSide; | |
| 204 | @@ -338,6 +340,9 @@ | |
| 205 | // Random weapon damage | |
| 206 | damage *= attacker.getRandomDamageMultiplier(); | |
| 207 | ||
| 208 | + if (attacker instanceof Player && target instanceof Player) | |
| 209 | + damage *= ClassBalanceManager.getInstance().getValueFor(ClassBalanceType.BLOW, attacker, target); | |
| 210 | + | |
| 211 | // Dmg bonusses in PvP fight | |
| 212 | if (isPvP) | |
| 213 | damage *= attacker.calcStat(Stats.PVP_PHYS_SKILL_DMG, 1, null, null); | |
| 214 | @@ -456,6 +461,24 @@ | |
| 215 | if (skill == null || skill.getEffectType() != L2SkillType.CHARGEDAM) | |
| 216 | damage *= attacker.getRandomDamageMultiplier(); | |
| 217 | ||
| 218 | + if (attacker instanceof Player && target instanceof Player) | |
| 219 | + {
| |
| 220 | + if (crit) | |
| 221 | + {
| |
| 222 | + if (skill != null && skill.getSkillType() == L2SkillType.PDAM) | |
| 223 | + damage *= ClassBalanceManager.getInstance().getValueFor(ClassBalanceType.PHYSICAL_SKILL_CRITICAL, attacker, target); | |
| 224 | + else | |
| 225 | + damage *= ClassBalanceManager.getInstance().getValueFor(ClassBalanceType.CRITICAL, attacker, target); | |
| 226 | + } | |
| 227 | + else | |
| 228 | + {
| |
| 229 | + if (skill != null && skill.getSkillType() == L2SkillType.PDAM) | |
| 230 | + damage *= ClassBalanceManager.getInstance().getValueFor(ClassBalanceType.PHYSICAL_SKILL_DAMAGE, attacker, target); | |
| 231 | + else | |
| 232 | + damage *= ClassBalanceManager.getInstance().getValueFor(ClassBalanceType.NORMAL, attacker, target); | |
| 233 | + } | |
| 234 | + } | |
| 235 | + | |
| 236 | if (target instanceof Npc) | |
| 237 | {
| |
| 238 | double multiplier; | |
| 239 | @@ -579,6 +602,14 @@ | |
| 240 | else if (mcrit) | |
| 241 | damage *= 4; | |
| 242 | ||
| 243 | + if (attacker instanceof Player && target instanceof Player) | |
| 244 | + {
| |
| 245 | + if (mcrit) | |
| 246 | + damage *= ClassBalanceManager.getInstance().getValueFor(ClassBalanceType.M_CRITICAL, attacker, target); | |
| 247 | + else | |
| 248 | + damage *= ClassBalanceManager.getInstance().getValueFor(ClassBalanceType.MAGIC, attacker, target); | |
| 249 | + } | |
| 250 | + | |
| 251 | // Pvp bonuses for dmg | |
| 252 | if (attacker instanceof Playable && target instanceof Playable) | |
| 253 | { |