Addition of attribute system configuration file.

Contributed by facab.
This commit is contained in:
MobiusDevelopment
2019-05-09 11:17:02 +00:00
parent b66e9ca517
commit 3d9011a87d
82 changed files with 3543 additions and 1677 deletions

View File

@@ -797,10 +797,6 @@ public final class Config
public static IdFactoryType IDFACTORY_TYPE;
public static boolean BAD_ID_CHECKING;
public static double ENCHANT_CHANCE_ELEMENT_STONE;
public static double ENCHANT_CHANCE_ELEMENT_CRYSTAL;
public static double ENCHANT_CHANCE_ELEMENT_JEWEL;
public static double ENCHANT_CHANCE_ELEMENT_ENERGY;
public static int[] ENCHANT_BLACKLIST;
public static boolean DISABLE_OVER_ENCHANTING;
public static int[] AUGMENTATION_BLACKLIST;
@@ -932,6 +928,77 @@ public final class Config
public static int OBSTACLE_MULTIPLIER;
public static int MAX_ITERATIONS;
/** Attribute System */
public static int S_WEAPON_STONE;
public static int S80_WEAPON_STONE;
public static int S84_WEAPON_STONE;
public static int R_WEAPON_STONE;
public static int R95_WEAPON_STONE;
public static int R99_WEAPON_STONE;
public static int S_ARMOR_STONE;
public static int S80_ARMOR_STONE;
public static int S84_ARMOR_STONE;
public static int R_ARMOR_STONE;
public static int R95_ARMOR_STONE;
public static int R99_ARMOR_STONE;
public static int S_WEAPON_CRYSTAL;
public static int S80_WEAPON_CRYSTAL;
public static int S84_WEAPON_CRYSTAL;
public static int R_WEAPON_CRYSTAL;
public static int R95_WEAPON_CRYSTAL;
public static int R99_WEAPON_CRYSTAL;
public static int S_ARMOR_CRYSTAL;
public static int S80_ARMOR_CRYSTAL;
public static int S84_ARMOR_CRYSTAL;
public static int R_ARMOR_CRYSTAL;
public static int R95_ARMOR_CRYSTAL;
public static int R99_ARMOR_CRYSTAL;
public static int S_WEAPON_STONE_SUPER;
public static int S80_WEAPON_STONE_SUPER;
public static int S84_WEAPON_STONE_SUPER;
public static int R_WEAPON_STONE_SUPER;
public static int R95_WEAPON_STONE_SUPER;
public static int R99_WEAPON_STONE_SUPER;
public static int S_ARMOR_STONE_SUPER;
public static int S80_ARMOR_STONE_SUPER;
public static int S84_ARMOR_STONE_SUPER;
public static int R_ARMOR_STONE_SUPER;
public static int R95_ARMOR_STONE_SUPER;
public static int R99_ARMOR_STONE_SUPER;
public static int S_WEAPON_CRYSTAL_SUPER;
public static int S80_WEAPON_CRYSTAL_SUPER;
public static int S84_WEAPON_CRYSTAL_SUPER;
public static int R_WEAPON_CRYSTAL_SUPER;
public static int R95_WEAPON_CRYSTAL_SUPER;
public static int R99_WEAPON_CRYSTAL_SUPER;
public static int S_ARMOR_CRYSTAL_SUPER;
public static int S80_ARMOR_CRYSTAL_SUPER;
public static int S84_ARMOR_CRYSTAL_SUPER;
public static int R_ARMOR_CRYSTAL_SUPER;
public static int R95_ARMOR_CRYSTAL_SUPER;
public static int R99_ARMOR_CRYSTAL_SUPER;
public static int S_WEAPON_JEWEL;
public static int S80_WEAPON_JEWEL;
public static int S84_WEAPON_JEWEL;
public static int R_WEAPON_JEWEL;
public static int R95_WEAPON_JEWEL;
public static int R99_WEAPON_JEWEL;
public static int S_ARMOR_JEWEL;
public static int S80_ARMOR_JEWEL;
public static int S84_ARMOR_JEWEL;
public static int R_ARMOR_JEWEL;
public static int R95_ARMOR_JEWEL;
public static int R99_ARMOR_JEWEL;
// --------------------------------------------------
// Custom Settings
// --------------------------------------------------
@@ -1582,10 +1649,6 @@ public final class Config
ALT_FREIGHT_PRICE = Character.getInt("FreightPrice", 1000);
MENTOR_PENALTY_FOR_MENTEE_COMPLETE = Character.getInt("MentorPenaltyForMenteeComplete", 1) * 24 * 60 * 60 * 1000;
MENTOR_PENALTY_FOR_MENTEE_COMPLETE = Character.getInt("MentorPenaltyForMenteeLeave", 2) * 24 * 60 * 60 * 1000;
ENCHANT_CHANCE_ELEMENT_STONE = Character.getDouble("EnchantChanceElementStone", 50);
ENCHANT_CHANCE_ELEMENT_CRYSTAL = Character.getDouble("EnchantChanceElementCrystal", 30);
ENCHANT_CHANCE_ELEMENT_JEWEL = Character.getDouble("EnchantChanceElementJewel", 20);
ENCHANT_CHANCE_ELEMENT_ENERGY = Character.getDouble("EnchantChanceElementEnergy", 10);
final String[] notenchantable = Character.getString("EnchantBlackList", "7816,7817,7818,7819,7820,7821,7822,7823,7824,7825,7826,7827,7828,7829,7830,7831,13293,13294,13296").split(",");
ENCHANT_BLACKLIST = new int[notenchantable.length];
for (int i = 0; i < notenchantable.length; i++)

View File

@@ -19,6 +19,7 @@ package org.l2jmobius.gameserver.model;
import java.util.HashMap;
import java.util.Map;
import org.l2jmobius.Config;
import org.l2jmobius.commons.util.Rnd;
import org.l2jmobius.gameserver.model.items.instance.ItemInstance;
@@ -84,6 +85,18 @@ public final class Elementals
// TODO: Higher stones
};
/* @formatter:off */
private static final int[][] CHANCE_TABLE =
{
{Config.S_WEAPON_STONE, Config.S_ARMOR_STONE, Config.S_WEAPON_CRYSTAL, Config.S_ARMOR_CRYSTAL, Config.S_WEAPON_STONE_SUPER, Config.S_ARMOR_STONE_SUPER, Config.S_WEAPON_JEWEL, Config.S_ARMOR_JEWEL},
{Config.S80_WEAPON_STONE, Config.S80_ARMOR_STONE, Config.S80_WEAPON_CRYSTAL, Config.S80_ARMOR_CRYSTAL, Config.S80_WEAPON_STONE_SUPER, Config.S80_ARMOR_STONE_SUPER, Config.S80_WEAPON_JEWEL, Config.S80_ARMOR_JEWEL},
{Config.S84_WEAPON_STONE, Config.S84_ARMOR_STONE, Config.S84_WEAPON_CRYSTAL, Config.S84_ARMOR_CRYSTAL, Config.S84_WEAPON_STONE_SUPER, Config.S84_ARMOR_STONE_SUPER, Config.S84_WEAPON_JEWEL, Config.S84_ARMOR_JEWEL},
{Config.R_WEAPON_STONE, Config.R_ARMOR_STONE, Config.R_WEAPON_CRYSTAL, Config.R_ARMOR_CRYSTAL, Config.R_WEAPON_STONE_SUPER, Config.R_ARMOR_STONE_SUPER, Config.R_WEAPON_JEWEL, Config.R_ARMOR_JEWEL},
{Config.R95_WEAPON_STONE, Config.R95_ARMOR_STONE, Config.R95_WEAPON_CRYSTAL, Config.R95_ARMOR_CRYSTAL, Config.R95_WEAPON_STONE_SUPER, Config.R95_ARMOR_STONE_SUPER, Config.R95_WEAPON_JEWEL, Config.R95_ARMOR_JEWEL},
{Config.R99_WEAPON_STONE, Config.R99_ARMOR_STONE, Config.R99_WEAPON_CRYSTAL, Config.R99_ARMOR_CRYSTAL, Config.R99_WEAPON_STONE_SUPER, Config.R99_ARMOR_STONE_SUPER, Config.R99_WEAPON_JEWEL, Config.R99_ARMOR_JEWEL},
};
/* @formatter:on */
public enum ElementalItemType
{
Stone(3),
@@ -289,128 +302,111 @@ public final class Elementals
return -1;
}
public static boolean isElementableWithStone(ItemInstance targetItem, int stoneId)
{
return targetItem.isElementable();
}
/* @formatter:off */
// +-------+----------------+----------------+----------------+----------------+
// | Grade | Stone | Crystal | Stone-Super | Crystal-Super |
// +-------+----------------+----------------+----------------+----------------+
// | | Weapon | Armor | Weapon | Armor | Weapon | Armor | Weapon | Armor |
// +-------+--------+-------+--------+-------+--------+-------+--------+-------+
// | S | 50% | 60% | 30% | 50% | 100% | 100% | 80% | 100% |
// +-------+--------+-------+--------+-------+--------+-------+--------+-------+
// | S80 | 50% | 80% | 40% | 70% | 100% | 100% | 90% | 100% |
// +-------+--------+-------+--------+-------+--------+-------+--------+-------+
// | S84 | 50% | 80% | 50% | 80% | 100% | 100% | 100% | 100% |
// +-------+--------+-------+--------+-------+--------+-------+--------+-------+
// | R | 50% | 100% | 60% | 80% | 100% | 100% | 100% | 100% |
// +-------+--------+-------+--------+-------+--------+-------+--------+-------+
// | R95 | 50% | 100% | 60% | 100% | 100% | 100% | 100% | 100% |
// +-------+--------+-------+--------+-------+--------+-------+--------+-------+
// | R99 | 50% | 100% | 60% | 100% | 100% | 100% | 100% | 100% |
// +-------+--------+-------+--------+-------+--------+-------+--------+-------+
/* @formatter:on */
public static boolean isSuccess(ItemInstance item, int stoneId)
{
switch (Elementals.getItemElemental(stoneId)._type)
int row = -1;
int column = -1;
switch (item.getItem().getCrystalType())
{
case S:
{
row = 0;
break;
}
case S80:
{
row = 1;
break;
}
case S84:
{
row = 2;
break;
}
case R:
{
row = 3;
break;
}
case R95:
{
row = 4;
break;
}
case R99:
{
row = 5;
break;
}
}
switch (TABLE.get(stoneId)._type)
{
case Stone:
{
if (item.isWeapon())
{
return Rnd.get(100) < 50;
column = 0;
}
switch (item.getItem().getCrystalType())
else // isArmor = true
{
case S:
{
return Rnd.get(100) < 60;
}
case S80:
case S84:
{
return Rnd.get(100) < 80;
}
default:
{
return true;
}
column = 1;
}
break;
}
case Crystal:
{
if (item.isWeapon())
{
switch (item.getItem().getCrystalType())
{
case S:
{
return Rnd.get(100) < 30;
}
case S80:
{
return Rnd.get(100) < 40;
}
case S84:
{
return Rnd.get(100) < 50;
}
default:
{
return Rnd.get(100) < 60;
}
}
column = 2;
}
switch (item.getItem().getCrystalType())
else // isArmor = true
{
case S:
{
return Rnd.get(100) < 50;
}
case S80:
{
return Rnd.get(100) < 70;
}
case S84:
case R:
{
return Rnd.get(100) < 80;
}
default:
{
return true;
}
column = 3;
}
break;
}
case StoneSuper:
{
if (item.isWeapon())
{
column = 4;
}
else // isArmor = true
{
column = 5;
}
break;
}
case CrystalSuper:
{
if (item.isWeapon())
{
switch (item.getItem().getCrystalType())
{
case S:
{
return Rnd.get(100) < 80;
}
case S80:
{
return Rnd.get(100) < 90;
}
default:
{
return true;
}
}
column = 6;
}
return true;
else // isArmor = true
{
column = 7;
}
break;
}
case Jewel:
{
if (item.isWeapon())
{
column = 8;
}
else // isArmor = true
{
column = 9;
}
break;
}
}
// Super stones have 100% so will end here.
// Patch notes do not have info about jewels chance so 100% for now, till l2wiki update, energy are not used.
if ((row != -1) && (column != -1))
{
return Rnd.get(100) < CHANCE_TABLE[row][column];
}
return true;
}
}

View File

@@ -103,7 +103,7 @@ public class RequestExEnchantItemAttribute implements IClientIncomingPacket
return;
}
if (!Elementals.isElementableWithStone(item, stone.getItem().getId()))
if (!item.isElementable())
{
client.sendPacket(SystemMessageId.ELEMENTAL_POWER_ENHANCER_USAGE_REQUIREMENT_IS_NOT_SUFFICIENT);
player.removeRequest(request.getClass());

View File

@@ -51,7 +51,7 @@ public class ExChooseInventoryAttributeItem implements IClientOutgoingPacket
// Register only items that can be put an attribute stone/crystal
for (ItemInstance item : player.getInventory().getItems())
{
if (Elementals.isElementableWithStone(item, stone.getId()))
if (item.isElementable())
{
_items.add(item.getObjectId());
}