Jump to content

morpheus2399

Members
  • Posts

    5
  • Credits

  • Joined

  • Last visited

  • Feedback

    0%

About morpheus2399

Profile Information

  • Gender
    Not Telling

morpheus2399's Achievements

Newbie

Newbie (1/16)

0

Reputation

  1. That is another verson from enchant the system. here after safe enchant the per cent would decrease finalagain static, dynamic would decrease. the break of the weapons was out switched sorry bad englisch ### Eclipse Workspace Patch 1.0 #P L2_GameServer Index: java/com/l2jserver/gameserver/network/clientpackets/AbstractEnchantPacket.java =================================================================== --- java/com/l2jserver/gameserver/network/clientpackets/AbstractEnchantPacket.java (revision 4477) +++ java/com/l2jserver/gameserver/network/clientpackets/AbstractEnchantPacket.java (working copy) @@ -22,8 +22,9 @@ import com.l2jserver.gameserver.model.L2ItemInstance; import com.l2jserver.gameserver.templates.item.L2Item; import com.l2jserver.gameserver.templates.item.L2WeaponType; +import com.l2jserver.gameserver.model.actor.instance.L2PcInstance; +import com.l2jserver.gameserver.model.base.Race; - public abstract class AbstractEnchantPacket extends L2GameClientPacket { @@ -152,7 +153,7 @@ return isValid(enchantItem); } - public final int getChance(L2ItemInstance enchantItem, EnchantItem supportItem) + public final int getChance(L2ItemInstance enchantItem, EnchantItem supportItem, L2PcInstance activeChar) { if (!isValid(enchantItem, supportItem)) return -1; @@ -181,13 +182,80 @@ else { if (_isWeapon) - chance = Config.ENCHANT_CHANCE_WEAPON; + if (Config.ENCHANT_SYSTEM) + { + if (Config.ENCHANT_STEP_MODE == "static") + chance = Config.ENCHANT_CHANCE_WEAPON-(Config.ENCHANT_STEP_STATIC*(enchantItem.getEnchantLevel()-Config.ENCHANT_SAFE_MAX)); + else if (Config.ENCHANT_STEP_MODE == "dynamic") + chance = (int) Math.round(Config.ENCHANT_CHANCE_WEAPON*Math.pow(Config.ENCHANT_STEP_DYNAMIC,(enchantItem.getEnchantLevel()-Config.ENCHANT_SAFE_MAX))); + } + else + chance = Config.ENCHANT_CHANCE_WEAPON; + else if (isAccessory) - chance = Config.ENCHANT_CHANCE_JEWELRY; + if (Config.ENCHANT_SYSTEM) + { + if (Config.ENCHANT_STEP_MODE == "static") + chance = Config.ENCHANT_CHANCE_JEWELRY-(Config.ENCHANT_STEP_STATIC*(enchantItem.getEnchantLevel()-Config.ENCHANT_SAFE_MAX)); + else if (Config.ENCHANT_STEP_MODE == "dynamic") + chance = (int) Math.round(Config.ENCHANT_CHANCE_JEWELRY*Math.pow(Config.ENCHANT_STEP_DYNAMIC,(enchantItem.getEnchantLevel()-Config.ENCHANT_SAFE_MAX))); + } + else + chance = Config.ENCHANT_CHANCE_JEWELRY; else - chance = Config.ENCHANT_CHANCE_ARMOR; + if (Config.ENCHANT_SYSTEM) + { + if (Config.ENCHANT_STEP_MODE == "static") + chance = Config.ENCHANT_CHANCE_ARMOR-(Config.ENCHANT_STEP_STATIC*(enchantItem.getEnchantLevel()-Config.ENCHANT_SAFE_MAX)); + else if (Config.ENCHANT_STEP_MODE == "dynamic") + chance = (int) Math.round(Config.ENCHANT_CHANCE_ARMOR*Math.pow(Config.ENCHANT_STEP_DYNAMIC,(enchantItem.getEnchantLevel()-Config.ENCHANT_SAFE_MAX))); + } + else + chance = Config.ENCHANT_CHANCE_ARMOR; } + if (activeChar.getRace() == Race.Dwarf && Config.ENCHANT_SYSTEM) + { + int _charlevel = activeChar.getLevel(); + int _itemlevel = enchantItem.getEnchantLevel(); + + if (_charlevel >= 20 && _charlevel <= 39 && _itemlevel >= Config.ENCHANT_DWARF_1_ENCHANTLEVEL && Config.ENCHANT_STEP_MODE == "static") + chance = Config.ENCHANT_DWARF_CHANCE-(Config.ENCHANT_STEP_STATIC*(_itemlevel-Config.ENCHANT_DWARF_1_ENCHANTLEVEL)); + + else if (_charlevel >= 40 && _charlevel <= 75 && _itemlevel >= Config.ENCHANT_DWARF_2_ENCHANTLEVEL && Config.ENCHANT_STEP_MODE == "static") + chance = Config.ENCHANT_DWARF_CHANCE-(Config.ENCHANT_STEP_STATIC*(_itemlevel-Config.ENCHANT_DWARF_2_ENCHANTLEVEL)); + + else if (_charlevel >= 76 && _charlevel <= 83 && _itemlevel >= Config.ENCHANT_DWARF_3_ENCHANTLEVEL && Config.ENCHANT_STEP_MODE == "static") + chance = Config.ENCHANT_DWARF_CHANCE-(Config.ENCHANT_STEP_STATIC*(_itemlevel-Config.ENCHANT_DWARF_3_ENCHANTLEVEL)); + + else if (_charlevel >= 84 && _itemlevel >= Config.ENCHANT_DWARF_4_ENCHANTLEVEL && Config.ENCHANT_STEP_MODE == "static") + chance = Config.ENCHANT_DWARF_CHANCE-(Config.ENCHANT_STEP_STATIC*(_itemlevel-Config.ENCHANT_DWARF_4_ENCHANTLEVEL)); + + else if (_charlevel >= 20 && _charlevel <= 39 && _itemlevel >= Config.ENCHANT_DWARF_1_ENCHANTLEVEL && Config.ENCHANT_STEP_MODE == "dynamic") + chance = (int) Math.round(Config.ENCHANT_DWARF_CHANCE*Math.pow(Config.ENCHANT_STEP_DYNAMIC,(_itemlevel-Config.ENCHANT_DWARF_1_ENCHANTLEVEL))); + + else if (_charlevel >= 40 && _charlevel <= 75 && _itemlevel >= Config.ENCHANT_DWARF_2_ENCHANTLEVEL && Config.ENCHANT_STEP_MODE == "dynamic") + chance = (int) Math.round(Config.ENCHANT_DWARF_CHANCE*Math.pow(Config.ENCHANT_STEP_DYNAMIC,(_itemlevel-Config.ENCHANT_DWARF_2_ENCHANTLEVEL))); + + else if (_charlevel >= 76 && _charlevel <= 83 && _itemlevel >= Config.ENCHANT_DWARF_3_ENCHANTLEVEL && Config.ENCHANT_STEP_MODE == "dynamic") + chance = (int) Math.round(Config.ENCHANT_DWARF_CHANCE*Math.pow(Config.ENCHANT_STEP_DYNAMIC,(_itemlevel-Config.ENCHANT_DWARF_3_ENCHANTLEVEL))); + + else if (_charlevel >= 84 && _itemlevel >= Config.ENCHANT_DWARF_4_ENCHANTLEVEL && Config.ENCHANT_STEP_MODE == "dynamic") + chance = (int) Math.round(Config.ENCHANT_DWARF_CHANCE*Math.pow(Config.ENCHANT_STEP_DYNAMIC,(_itemlevel-Config.ENCHANT_DWARF_4_ENCHANTLEVEL))); + + else if (_charlevel >= 20 && _itemlevel <= Config.ENCHANT_DWARF_1_ENCHANTLEVEL) + chance = Config.ENCHANT_DWARF_1_CHANCE; + + else if (_charlevel >= 40 && _itemlevel <= Config.ENCHANT_DWARF_2_ENCHANTLEVEL) + chance = Config.ENCHANT_DWARF_2_CHANCE; + + else if (_charlevel >= 76 && _itemlevel <= Config.ENCHANT_DWARF_3_ENCHANTLEVEL) + chance = Config.ENCHANT_DWARF_3_CHANCE; + + else if (_charlevel >= 84 && _itemlevel <= Config.ENCHANT_DWARF_4_ENCHANTLEVEL) + chance = Config.ENCHANT_DWARF_4_CHANCE; + } + chance += _chanceAdd; if (supportItem != null) @@ -239,10 +307,11 @@ _scrolls.put(22011, new EnchantScroll(false, false, false, false, L2Item.CRYSTAL_C, 0, 10, null)); _scrolls.put(22012, new EnchantScroll(false, false, false, false, L2Item.CRYSTAL_B, 0, 10, null)); _scrolls.put(22013, new EnchantScroll(false, false, false, false, L2Item.CRYSTAL_A, 0, 10, null)); - _scrolls.put(22014, new EnchantScroll(true, false, false, true, L2Item.CRYSTAL_B, 16, 10, null)); - _scrolls.put(22015, new EnchantScroll(true, false, false, true, L2Item.CRYSTAL_A, 16, 10, null)); - _scrolls.put(22016, new EnchantScroll(false, false, false, true, L2Item.CRYSTAL_B, 16, 10, null)); - _scrolls.put(22017, new EnchantScroll(false, false, false, true, L2Item.CRYSTAL_A, 16, 10, null)); + _scrolls.put(22014, new EnchantScroll(true, false, false, true, L2Item.CRYSTAL_B, 0, 10, null)); + _scrolls.put(22015, new EnchantScroll(true, false, false, true, L2Item.CRYSTAL_A, 0, 10, null)); + _scrolls.put(22016, new EnchantScroll(false, false, false, true, L2Item.CRYSTAL_B, 0, 10, null)); + _scrolls.put(22017, new EnchantScroll(false, false, false, true, L2Item.CRYSTAL_A, 0, 10, null)); + _scrolls.put(20519, new EnchantScroll(true, false, false, true, L2Item.CRYSTAL_S, 0, 10, null)); _scrolls.put(22018, new EnchantScroll(true, false, false, false, L2Item.CRYSTAL_B, 0, 100, null)); _scrolls.put(22019, new EnchantScroll(true, false, false, false, L2Item.CRYSTAL_A, 0, 100, null)); _scrolls.put(22020, new EnchantScroll(false, false, false, false, L2Item.CRYSTAL_B, 0, 100, null)); Index: java/com/l2jserver/gameserver/network/clientpackets/RequestEnchantItem.java =================================================================== --- java/com/l2jserver/gameserver/network/clientpackets/RequestEnchantItem.java (revision 4477) +++ java/com/l2jserver/gameserver/network/clientpackets/RequestEnchantItem.java (working copy) @@ -22,7 +22,6 @@ import com.l2jserver.gameserver.datatables.SkillTable; import com.l2jserver.gameserver.model.L2ItemInstance; import com.l2jserver.gameserver.model.L2Skill; -import com.l2jserver.gameserver.model.L2World; import com.l2jserver.gameserver.model.actor.instance.L2PcInstance; import com.l2jserver.gameserver.network.SystemMessageId; import com.l2jserver.gameserver.network.serverpackets.EnchantResult; @@ -148,7 +147,7 @@ synchronized (item) { - int chance = scrollTemplate.getChance(item, supportTemplate); + int chance = scrollTemplate.getChance(item, supportTemplate, activeChar); L2Skill enchant4Skill = null; L2Item it = item.getItem(); @@ -253,9 +252,9 @@ if (scrollTemplate.isBlessed()) { // blessed enchant - clear enchant value - activeChar.sendPacket(SystemMessage.getSystemMessage(SystemMessageId.BLESSED_ENCHANT_FAILED)); + activeChar.sendMessage("Blessed Enchant Fail on half"); - item.setEnchantLevel(0); + item.setEnchantLevel(item.getEnchantLevel()/2); item.updateDatabase(); activeChar.sendPacket(new EnchantResult(3, 0, 0)); @@ -269,64 +268,13 @@ } else { - // enchant failed, destroy item - int crystalId = item.getItem().getCrystalItemId(); - int count = item.getCrystalCount() - (item.getItem().getCrystalCount() + 1) / 2; - if (count < 1) - count = 1; + // enchant - clear enchant value + activeChar.sendMessage("Enchant Fail up 0"); - L2ItemInstance destroyItem = activeChar.getInventory().destroyItem("Enchant", item, activeChar, null); - if (destroyItem == null) - { - // unable to destroy item, cheater ? - Util.handleIllegalPlayerAction(activeChar, "Unable to delete item on enchant failure from player " + activeChar.getName() + ", possible cheater !", Config.DEFAULT_PUNISH); - activeChar.setActiveEnchantItem(null); - activeChar.sendPacket(new EnchantResult(2, 0, 0)); - - if (Config.LOG_ITEM_ENCHANTS) - { - LogRecord record = new LogRecord(Level.INFO, "Unable to destroy"); - record.setParameters(new Object[]{activeChar, item, scroll, support, chance}); - record.setLoggerName("item"); - _logEnchant.log(record); - } - return; - } + item.setEnchantLevel(0); + item.updateDatabase(); + activeChar.sendPacket(new EnchantResult(3, 0, 0)); - L2ItemInstance crystals = null; - if (crystalId != 0) - { - crystals = activeChar.getInventory().addItem("Enchant", crystalId, count, activeChar, destroyItem); - - SystemMessage sm = SystemMessage.getSystemMessage(SystemMessageId.EARNED_S2_S1_S); - sm.addItemName(crystals); - sm.addItemNumber(count); - activeChar.sendPacket(sm); - } - - if (!Config.FORCE_INVENTORY_UPDATE) - { - InventoryUpdate iu = new InventoryUpdate(); - if (destroyItem.getCount() == 0) - iu.addRemovedItem(destroyItem); - else - iu.addModifiedItem(destroyItem); - - if (crystals != null) - iu.addItem(crystals); - - activeChar.sendPacket(iu); - } - else - activeChar.sendPacket(new ItemList(activeChar, true)); - - L2World world = L2World.getInstance(); - world.removeObject(destroyItem); - if (crystalId == 0) - activeChar.sendPacket(new EnchantResult(4, 0, 0)); - else - activeChar.sendPacket(new EnchantResult(1, crystalId, count)); - if (Config.LOG_ITEM_ENCHANTS) { LogRecord record = new LogRecord(Level.INFO, "Fail"); Index: java/config/Pandora.properties =================================================================== --- java/config/Pandora.properties (revision 0) +++ java/config/Pandora.properties (revision 0) @@ -0,0 +1,58 @@ +#============================================================================# +# Pandora custom Settings # +#============================================================================# +# +# -Dwarfen Enchantsystem + Enchant Step + + +# --------------------------------------------------------------------------- +# Enchant system +# --------------------------------------------------------------------------- + +# Enable/Disable enchanting system (default: false). +EnchantSystemEnabled = False + +# Progressive enchanting mode. Values allowed = static, dynamic (default: static). +EnchantStepMode = static + +#default: 3 +EnchantStepStatic = 3 + +#default: 0,95 +EnchantStepDynamic = 0.95 + +#for Dwarf enchant +# +#Safe with level of the dwarf: +#Dwarf1 20 = default 6 +#Dwarf2 40 = default 8 +#Dwarf3 76 = default 10 +#Dwarf4 84 = default 12 +EnchantDwarf1Enchantlevel = 6 +EnchantDwarf2Enchantlevel = 8 +EnchantDwarf3Enchantlevel = 10 +EnchantDwarf4Enchantlevel = 12 + +# Dwarf Chance Dwarf Safe enchant +EnchantDwarf1Chance = 100 +EnchantDwarf2Chance = 100 +EnchantDwarf3Chance = 100 +EnchantDwarf4Chance = 100 + +# Dwarf Chance after Dwarf Safe enchant +EnchantDwarfChance = 66 + + +# If EnchantStepMode = static: +# Value in percent (%). Reduced from enchant rate on each next enchant. +# Example: +3 safe enchant. EnchantChanceWeapon = 66. EnchantStep = 3 +#+4 = 66%, +5 = 63%, +7 = 60%, +8 = 57% etc. +# If EnchantStepMode = dynamic: +# enchant chance is multiplied by (EnchantStep^(item enchant level)-safe enchant) +# for example, if enchant step is 0.95 +# +10 = 66*(0.95^(10-4)) +# it only starts to make a real difference after +10, +# so it's useful for servers with high max enchant. + + +# --------------------------------------------------------------------------- Index: java/com/l2jserver/Config.java =================================================================== --- java/com/l2jserver/Config.java (revision 4477) +++ java/com/l2jserver/Config.java (working copy) @@ -80,6 +80,7 @@ public static final String COMMUNITY_CONFIGURATION_FILE = "./config/CommunityServer.properties"; public static final String GRANDBOSS_CONFIG_FILE = "./config/Grandboss.properties"; public static final String GRACIASEEDS_CONFIG_FILE = "./config/GraciaSeeds.properties"; + public static final String PANDORA_CUSTOM_FILE = "./config/Pandora.properties"; public static final String CHAT_FILTER_FILE = "./config/chatfilter.txt"; @@ -759,6 +760,23 @@ //-------------------------------------------------- + //Pandora.properties Custom + //-------------------------------------------------- + public static boolean ENCHANT_SYSTEM; + public static String ENCHANT_STEP_MODE; + public static int ENCHANT_STEP_STATIC; + public static double ENCHANT_STEP_DYNAMIC; + public static int ENCHANT_DWARF_1_ENCHANTLEVEL; + public static int ENCHANT_DWARF_2_ENCHANTLEVEL; + public static int ENCHANT_DWARF_3_ENCHANTLEVEL; + public static int ENCHANT_DWARF_4_ENCHANTLEVEL; + public static int ENCHANT_DWARF_1_CHANCE; + public static int ENCHANT_DWARF_2_CHANCE; + public static int ENCHANT_DWARF_3_CHANCE; + public static int ENCHANT_DWARF_4_CHANCE; + public static int ENCHANT_DWARF_CHANCE; + + //-------------------------------------------------- // PvP Settings //-------------------------------------------------- public static int KARMA_MIN_KARMA; @@ -2479,6 +2497,35 @@ throw new Error("Failed to Load "+L2JMOD_CONFIG_FILE+" File."); } + + // Load Pandora Custom Properties file (if exists) + try + { + L2Properties pandoracustomSettings = new L2Properties(); + is = new FileInputStream(new File(PANDORA_CUSTOM_FILE)); + pandoracustomSettings.load(is); + + ENCHANT_SYSTEM = Boolean.parseBoolean(pandoracustomSettings.getProperty("EnchantSystemEnabled", "False")); + ENCHANT_DWARF_1_ENCHANTLEVEL = Integer.parseInt(pandoracustomSettings.getProperty("EnchantDwarf1Enchantlevel", "6")); + ENCHANT_DWARF_2_ENCHANTLEVEL = Integer.parseInt(pandoracustomSettings.getProperty("EnchantDwarf2Enchantlevel", "8")); + ENCHANT_DWARF_3_ENCHANTLEVEL = Integer.parseInt(pandoracustomSettings.getProperty("EnchantDwarf3Enchantlevel", "10")); + ENCHANT_DWARF_4_ENCHANTLEVEL = Integer.parseInt(pandoracustomSettings.getProperty("EnchantDwarf4Enchantlevel", "12")); + ENCHANT_DWARF_1_CHANCE = Integer.parseInt(pandoracustomSettings.getProperty("EnchantDwarf1Chance", "100")); + ENCHANT_DWARF_2_CHANCE = Integer.parseInt(pandoracustomSettings.getProperty("EnchantDwarf2Chance", "100")); + ENCHANT_DWARF_3_CHANCE = Integer.parseInt(pandoracustomSettings.getProperty("EnchantDwarf3Chance", "100")); + ENCHANT_DWARF_4_CHANCE = Integer.parseInt(pandoracustomSettings.getProperty("EnchantDwarf4Chance", "100")); + ENCHANT_DWARF_CHANCE = Integer.parseInt(pandoracustomSettings.getProperty("EnchantDwarfChance", "66")); + ENCHANT_STEP_MODE = pandoracustomSettings.getProperty("EnchantStepMode", "static"); + ENCHANT_STEP_STATIC = Integer.parseInt(pandoracustomSettings.getProperty("EnchantStepStatic", "3")); + ENCHANT_STEP_DYNAMIC = Double.parseDouble(pandoracustomSettings.getProperty("EnchantStepDynamic", "0.95")); + } + catch (Exception e) + { + e.printStackTrace(); + throw new Error("Failed to Load " + PANDORA_CUSTOM_FILE + " File."); + } + + // Load PvP L2Properties file (if exists) try {
  2. after Safe for example 66% with +4 stap of 3% on +5 only 63% chance, on +6 only 60% chance ........... dynamic of 0.95% e.g. if safe is 4 and - item is 5 -> 0.95 - item is 6 -> 0.95 * 0.95 = 0.9025 - item is 7 -> 0.95 * 0.95 * 0.95 = 0.857375 ............ Sorry bad English
  3. New Dwarf enchant system + enchant Step for l2jserver see further below for script
×
×
  • Create New...