Jump to content

Search the Community

Showing results for tags 'code'.



More search options

  • Search By Tags

    Type tags separated by commas.
  • Search By Author

Content Type


Forums

  • News and Announcements
    • News
  • General
    • Suggestions & Feedback
    • General Chat
    • GFX
    • VFX
  • MMO Hub
    • Gamer's Lounge
    • Member's Lounge
    • Developer Lounge
  • MMO Corner
    • World of Warcraft
    • Lineage 2
    • Minecraft
    • Host Listing
    • Server Listing
    • Server Recruitment
    • Server Reviews
    • The Underground
  • User Hub
    • Support
    • Report
    • Contact Staff
  • Merchant Corner
    • Marketplace
  • General Development Releases
    • Applications
  • Tutorials
    • Programming
    • Web Development
  • Wasteland

Categories

  • Creative Corner
    • GFX Releases
    • VFX Releases
    • Resources
  • MMO and MMORPG
    • World of Warcraft
    • Lineage 2
    • Minecraft
  • Webmasters
    • Content Management Systems
    • Addons
    • Scripts
    • Designs
    • Proxies
    • HTML
  • Applications
  • Gaming
    • World of Warcraft
    • Lineage 2
    • Minecraft
    • Emulation
    • Nulled Distributions
  • Marketplace
    • Marsh Designs
    • iDarts

Product Groups

  • Membership
  • Advertise
  • Promote

Find results in...

Find results that contain...


Date Created

  • Start

    End


Last Updated

  • Start

    End


Filter by number of...

Joined

  • Start

    End


Group


Interests


How Did You Find Us?


Contributor


Discord

Found 17 results

  1. Description: If you click on the rebirth manager and choose to rebirth then your character will be reset to level 1, with this you will also lose your normal skills (not your gained rebirth skills). When you have done a rebirth, you will receive a Book of Rebirth. To gain a rebirth skill you must visit your skill trainer witch can be found in most towns. The skill trainer will take 1 Rebirth Book per chosen skill. Be careful when choosing your rebirth skills because once chosen they cannot be changed! You can only rebirth 3 times! Downloads: [hide] Core Patch via pastebin Datapack patch via pastebin Client Side via zippyshare [/hide] All credits goes to: Trance
  2. Hello members of LordCraft, here is a custom code for spawn item. Code: [hide] package ru.catssoftware.gameserver.handler.itemhandler; import org.apache.log4j.Logger; import ru.catssoftware.gameserver.ThreadPoolManager; import ru.catssoftware.gameserver.datatables.NpcTable; import ru.catssoftware.gameserver.handler.IItemHandler; import ru.catssoftware.gameserver.idfactory.IdFactory; import ru.catssoftware.gameserver.model.L2ItemInstance; import ru.catssoftware.gameserver.model.actor.instance.L2NpcInstance; import ru.catssoftware.gameserver.model.actor.instance.L2PcInstance; import ru.catssoftware.gameserver.model.actor.instance.L2PlayableInstance; import ru.catssoftware.gameserver.network.SystemMessageId; import ru.catssoftware.gameserver.templates.chars.L2NpcTemplate; /** * Created by IntelliJ IDEA. * User: masone * Date: 02.07.15 * Time: 20:07 * To change this template use File | Settings | File Templates. */ public class spawnitem implements IItemHandler { protected static Logger _log = Logger.getLogger(spawnitem.class.getName()); private static final int[] ITEM_IDS = { 6673 }; public void useItem(L2PlayableInstance playable, L2ItemInstance item, boolean par){} public int[] getItemIds() { return ITEM_IDS; } public void useItem(L2PlayableInstance playable, L2ItemInstance item) { _log.info("use item" +item); L2PcInstance activeChar; activeChar = (L2PcInstance) playable; L2NpcTemplate template; template = NpcTable.getInstance().getTemplate(60000); if (activeChar.isInOlympiadMode()) { activeChar.sendPacket(SystemMessageId.THIS_ITEM_IS_NOT_AVAILABLE_FOR_THE_OLYMPIAD_EVENT); return; } //TODO flood protector L2NpcInstance npc = new L2NpcInstance(IdFactory.getInstance().getNextId(), template); npc.setInstanceId(activeChar.getInstanceId()); npc.setIsInvul(true); npc.setTitle(activeChar.getName()); npc.setName("masone"); npc.updateAbnormalEffect(); npc.spawnMe(activeChar.getX(), activeChar.getY(), activeChar.getZ()); ThreadPoolManager.getInstance().scheduleGeneral(new deleteNPC(npc), 60000); // activeChar.destroyItem("Summon", item.getObjectId(), 1, null, true); } public class deleteNPC implements Runnable { protected L2NpcInstance _npc; public void run() { _npc.deleteMe(); } deleteNPC(L2NpcInstance npc) { _npc = npc; } } } [/hide] Credtis: masone
  3. Hello members of LordCraft, here is a code for automatic potions for all L2J packs. Images Preview: Code: [hide] Index: data/xml/items/0700-0799.xml =================================================================== --- data/xml/items/0700-0799.xml (revision 112) +++ data/xml/items/0700-0799.xml (working copy) @@ -329,7 +329,7 @@ <set name="price" val="2000" /> <set name="is_stackable" val="true" /> <set name="is_oly_restricted" val="true" /> - <set name="handler" val="ItemSkills" /> + <set name="handler" val="SoulShots" /> <set name="item_skill" val="2279-2" /> <set name="use_condition" val="{{uc_transmode_exclude;{tt_flying}}}" /> </item> Index: data/xml/items/1500-1599.xml =================================================================== --- data/xml/items/1500-1599.xml (revision 112) +++ data/xml/items/1500-1599.xml (working copy) @@ -265,7 +265,7 @@ <set name="reuse_delay" val="10000" /> <set name="is_stackable" val="true" /> <set name="is_oly_restricted" val="true" /> - <set name="handler" val="ItemSkills" /> + <set name="handler" val="SoulShots" /> <set name="item_skill" val="2037-1" /> <set name="use_condition" val="{{uc_transmode_exclude;{tt_flying}}}" /> <set name="shared_reuse_group" val="10" /> Index: data/xml/items/5500-5599.xml =================================================================== --- data/xml/items/5500-5599.xml (revision 112) +++ data/xml/items/5500-5599.xml (working copy) @@ -673,7 +673,7 @@ <set name="reuse_delay" val="500" /> <set name="is_stackable" val="true" /> <set name="is_oly_restricted" val="true" /> - <set name="handler" val="ItemSkills" /> + <set name="handler" val="SoulShots" /> <set name="item_skill" val="2166-2" /> </item> <item id="5593" type="EtcItem" name="SP Scroll: Low Grade"> Index: java/net/sf/l2j/gameserver/handler/itemhandlers/SoulShots.java =================================================================== --- java/net/sf/l2j/gameserver/handler/itemhandlers/SoulShots.java (revision 112) +++ java/net/sf/l2j/gameserver/handler/itemhandlers/SoulShots.java (working copy) @@ -14,18 +14,24 @@ */ package net.sf.l2j.gameserver.handler.itemhandlers; +import net.sf.l2j.gameserver.ThreadPoolManager; import net.sf.l2j.gameserver.handler.IItemHandler; import net.sf.l2j.gameserver.model.L2ItemInstance; import net.sf.l2j.gameserver.model.ShotType; import net.sf.l2j.gameserver.model.actor.L2Playable; import net.sf.l2j.gameserver.model.actor.instance.L2PcInstance; import net.sf.l2j.gameserver.network.SystemMessageId; +import net.sf.l2j.gameserver.network.serverpackets.ExAutoSoulShot; import net.sf.l2j.gameserver.network.serverpackets.MagicSkillUse; import net.sf.l2j.gameserver.templates.item.L2Weapon; import net.sf.l2j.gameserver.util.Broadcast; public class SoulShots implements IItemHandler { + private static final int MANA_POT_CD = 2, + HEALING_POT_CD = 11, // DO NOT PUT LESS THAN 10 + CP_POT_CD = 2; + private static final int[] SKILL_IDS = { 2039, @@ -47,6 +53,108 @@ final L2Weapon weaponItem = activeChar.getActiveWeaponItem(); final int itemId = item.getItemId(); + if (itemId == 728 || itemId == 1539 || itemId == 5592) + { + switch (itemId) + { + case 728: // mana potion + { + if (activeChar.isAutoPot(728)) + { + activeChar.sendPacket(new ExAutoSoulShot(728, 0)); + activeChar.sendMessage("Deactivated auto mana potions."); + activeChar.setAutoPot(728, null, false); + } + else + { + if (activeChar.getInventory().getItemByItemId(728) != null) + { + if (activeChar.getInventory().getItemByItemId(728).getCount() > 1) + { + activeChar.sendPacket(new ExAutoSoulShot(728, 1)); + activeChar.sendMessage("Activated auto mana potions."); + activeChar.setAutoPot(728, ThreadPoolManager.getInstance().scheduleGeneralAtFixedRate(new AutoPot(728, activeChar), 1000, MANA_POT_CD*1000), true); + } + else + { + MagicSkillUse msu = new MagicSkillUse(activeChar, activeChar, 2279, 2, 0, 100); + activeChar.broadcastPacket(msu); + + ItemSkills is = new ItemSkills(); + is.useItem(activeChar, activeChar.getInventory().getItemByItemId(728), true); + } + } + } + + break; + } + case 1539: // greater healing potion + { + if (activeChar.isAutoPot(1539)) + { + activeChar.sendPacket(new ExAutoSoulShot(1539, 0)); + activeChar.sendMessage("Deactivated auto healing potions."); + activeChar.setAutoPot(1539, null, false); + } + else + { + if (activeChar.getInventory().getItemByItemId(1539) != null) + { + if (activeChar.getInventory().getItemByItemId(1539).getCount() > 1) + { + activeChar.sendPacket(new ExAutoSoulShot(1539, 1)); + activeChar.sendMessage("Activated auto healing potions."); + activeChar.setAutoPot(1539, ThreadPoolManager.getInstance().scheduleGeneralAtFixedRate(new AutoPot(1539, activeChar), 1000, HEALING_POT_CD*1000), true); + } + else + { + MagicSkillUse msu = new MagicSkillUse(activeChar, activeChar, 2037, 1, 0, 100); + activeChar.broadcastPacket(msu); + + ItemSkills is = new ItemSkills(); + is.useItem(activeChar, activeChar.getInventory().getItemByItemId(1539), true); + } + } + } + + break; + } + case 5592: // greater cp potion + { + if (activeChar.isAutoPot(5592)) + { + activeChar.sendPacket(new ExAutoSoulShot(5592, 0)); + activeChar.sendMessage("Deactivated auto cp potions."); + activeChar.setAutoPot(5592, null, false); + } + else + { + if (activeChar.getInventory().getItemByItemId(5592) != null) + { + if (activeChar.getInventory().getItemByItemId(5592).getCount() > 1) + { + activeChar.sendPacket(new ExAutoSoulShot(5592, 1)); + activeChar.sendMessage("Activated auto cp potions."); + activeChar.setAutoPot(5592, ThreadPoolManager.getInstance().scheduleGeneralAtFixedRate(new AutoPot(5592, activeChar), 1000, CP_POT_CD*1000), true); + } + else + { + MagicSkillUse msu = new MagicSkillUse(activeChar, activeChar, 2166, 2, 0, 100); + activeChar.broadcastPacket(msu); + + ItemSkills is = new ItemSkills(); + is.useItem(activeChar, activeChar.getInventory().getItemByItemId(5592), true); + } + } + } + + break; + } + } + + return; + } + // Check if soulshot can be used if (weaponInst == null || weaponItem.getSoulShotCount() == 0) { @@ -87,4 +195,76 @@ activeChar.sendPacket(SystemMessageId.ENABLED_SOULSHOT); Broadcast.toSelfAndKnownPlayersInRadiusSq(activeChar, new MagicSkillUse(activeChar, activeChar, SKILL_IDS[grade], 1, 0, 0), 360000); } + + private class AutoPot implements Runnable + { + private int id; + private L2PcInstance activeChar; + + public AutoPot(int id, L2PcInstance activeChar) + { + this.id = id; + this.activeChar = activeChar; + } + + @Override + public void run() + { + if (activeChar.getInventory().getItemByItemId(id) == null) + { + activeChar.sendPacket(new ExAutoSoulShot(id, 0)); + activeChar.setAutoPot(id, null, false); + return; + } + + switch (id) + { + case 728: + { + if (activeChar.getCurrentMp() < 0.70*activeChar.getMaxMp()) + { + MagicSkillUse msu = new MagicSkillUse(activeChar, activeChar, 2279, 2, 0, 100); + activeChar.broadcastPacket(msu); + + ItemSkills is = new ItemSkills(); + is.useItem(activeChar, activeChar.getInventory().getItemByItemId(728), true); + } + + break; + } + case 1539: + { + if (activeChar.getCurrentHp() < 0.95*activeChar.getMaxHp()) + { + MagicSkillUse msu = new MagicSkillUse(activeChar, activeChar, 2037, 1, 0, 100); + activeChar.broadcastPacket(msu); + + ItemSkills is = new ItemSkills(); + is.useItem(activeChar, activeChar.getInventory().getItemByItemId(1539), true); + } + + break; + } + case 5592: + { + if (activeChar.getCurrentCp() < 0.95*activeChar.getMaxCp()) + { + MagicSkillUse msu = new MagicSkillUse(activeChar, activeChar, 2166, 2, 0, 100); + activeChar.broadcastPacket(msu); + + ItemSkills is = new ItemSkills(); + is.useItem(activeChar, activeChar.getInventory().getItemByItemId(5592), true); + } + + break; + } + } + + if (activeChar.getInventory().getItemByItemId(id) == null) + { + activeChar.sendPacket(new ExAutoSoulShot(id, 0)); + activeChar.setAutoPot(id, null, false); + } + } + } } \ No newline at end of file Index: java/net/sf/l2j/gameserver/model/actor/instance/L2PcInstance.java =================================================================== --- java/net/sf/l2j/gameserver/model/actor/instance/L2PcInstance.java (revision 112) +++ java/net/sf/l2j/gameserver/model/actor/instance/L2PcInstance.java (working copy) @@ -251,6 +251,24 @@ */ public final class L2PcInstance extends L2Playable { + private Map<Integer, Future<?>> _autoPotTasks = new HashMap<>(); + + public boolean isAutoPot(int id) + { + return _autoPotTasks.keySet().contains(id); + } + + public void setAutoPot(int id, Future<?> task, boolean add) + { + if (add) + _autoPotTasks.put(id, task); + else + { + _autoPotTasks.get(id).cancel(true); + _autoPotTasks.remove(id); + } + } + private BuffShop buffShop = null; public void setBuffShop(BuffShop val) @@ -4321,6 +4339,22 @@ teleToLocation(184351, 20318, -3174, 0); } + if (isAutoPot(728)) + { + sendPacket(new ExAutoSoulShot(728, 0)); + setAutoPot(728, null, false); + } + if (isAutoPot(1539)) + { + sendPacket(new ExAutoSoulShot(1539, 0)); + setAutoPot(1539, null, false); + } + if (isAutoPot(5592)) + { + sendPacket(new ExAutoSoulShot(5592, 0)); + setAutoPot(5592, null, false); + } + return true; } [/hide] Credits: Devlin
  4. Hello members of LordCraft, here is a custom code for L2JFrozen. Image Preview: Code: Credits for Adaption to L2JFrozen from L2JDX: Tayran.Cannabis
  5. Code: [hide] Index: /trunk/L2_GameServer/java/config/General.properties =================================================================== --- /trunk/L2_GameServer/java/config/General.properties (revision 3516) +++ /trunk/L2_GameServer/java/config/General.properties (revision 3540) @@ -515,4 +515,8 @@ AltOlyRank5Points = 20 +# Maximum points that player can gain/lose on a match. +# Default: 10 +AltOlyMaxPoints = 10 + # Hero tables show last month's winners or current status. # Default: True Index: /trunk/L2_GameServer/java/net/sf/l2j/gameserver/model/olympiad/OlympiadGame.java =================================================================== --- /trunk/L2_GameServer/java/net/sf/l2j/gameserver/model/olympiad/OlympiadGame.java (revision 3490) +++ /trunk/L2_GameServer/java/net/sf/l2j/gameserver/model/olympiad/OlympiadGame.java (revision 3540) @@ -504,5 +504,5 @@ final int playerOnePoints = playerOneStat.getInteger(POINTS); final int playerTwoPoints = playerTwoStat.getInteger(POINTS); - final int pointDiff = Math.min(playerOnePoints, playerTwoPoints) / _div; + final int pointDiff = Math.min(Math.min(playerOnePoints, playerTwoPoints) / _div, Config.ALT_OLY_MAX_POINTS); // Check for if a player defaulted before battle started @@ -511,5 +511,5 @@ if (_playerOneDefaulted) { - final int lostPoints = playerOnePoints / 3; + final int lostPoints = Math.min(playerOnePoints / 3, Config.ALT_OLY_MAX_POINTS); playerOneStat.set(POINTS, playerOnePoints - lostPoints); Olympiad.updateNobleStats(_playerOneID, playerOneStat); @@ -531,5 +531,5 @@ if (_playerTwoDefaulted) { - final int lostPoints = playerTwoPoints / 3; + final int lostPoints = Math.min(playerTwoPoints / 3, Config.ALT_OLY_MAX_POINTS); playerTwoStat.set(POINTS, playerTwoPoints - lostPoints); Olympiad.updateNobleStats(_playerTwoID, playerTwoStat); @@ -784,6 +784,6 @@ _sm = new SystemMessage(SystemMessageId.THE_GAME_ENDED_IN_A_TIE); broadcastMessage(_sm, true); - int pointOneDiff = playerOnePoints / 5; - int pointTwoDiff = playerTwoPoints / 5; + final int pointOneDiff = Math.min(playerOnePoints / 5, Config.ALT_OLY_MAX_POINTS); + final int pointTwoDiff = Math.min(playerTwoPoints / 5, Config.ALT_OLY_MAX_POINTS); playerOneStat.set(POINTS, playerOnePoints - pointOneDiff); playerTwoStat.set(POINTS, playerTwoPoints - pointTwoDiff); Index: /trunk/L2_GameServer/java/net/sf/l2j/Config.java =================================================================== --- /trunk/L2_GameServer/java/net/sf/l2j/Config.java (revision 3516) +++ /trunk/L2_GameServer/java/net/sf/l2j/Config.java (revision 3540) @@ -456,4 +456,5 @@ public static int ALT_OLY_RANK4_POINTS; public static int ALT_OLY_RANK5_POINTS; + public static int ALT_OLY_MAX_POINTS; public static boolean ALT_OLY_LOG_FIGHTS; public static boolean ALT_OLY_SHOW_MONTHLY_WINNERS; @@ -1527,4 +1528,5 @@ ALT_OLY_RANK4_POINTS = Integer.parseInt(General.getProperty("AltOlyRank4Points","35")); ALT_OLY_RANK5_POINTS = Integer.parseInt(General.getProperty("AltOlyRank5Points","20")); + ALT_OLY_MAX_POINTS = Integer.parseInt(General.getProperty("AltOlyMaxPoints","10")); ALT_OLY_LOG_FIGHTS = Boolean.parseBoolean(General.getProperty("AlyOlyLogFights","false")); ALT_OLY_SHOW_MONTHLY_WINNERS = Boolean.parseBoolean(General.getProperty("AltOlyShowMonthlyWinners","true")); [/hide] Credits: Charus
  6. Hello Lordcrafters, Here is a custom enchant skill list. What this list contains? 100% safe enchant till enchant reach the config value If the enchant is higher than this value you have the retail chance If you fail to enchant and character is nobl ( nobl condition was for testing you have to change this with your condition ) the skill enchant will become -1 of the current enchant Its working for both conditions ( < 130 , < 170 ex. power,cost ) 2 configs ( no need more ) Video Preview: Code:[hide] ### Eclipse Workspace Patch 1.0 #P aCis_gameserver Index: java/net/sf/l2j/gameserver/network/clientpackets/RequestExEnchantSkillInfo.java =================================================================== --- java/net/sf/l2j/gameserver/network/clientpackets/RequestExEnchantSkillInfo.java (revision 7) +++ java/net/sf/l2j/gameserver/network/clientpackets/RequestExEnchantSkillInfo.java (working copy) @@ -84,7 +84,9 @@ return; // Send ExEnchantSkillInfo packet. - ExEnchantSkillInfo esi = new ExEnchantSkillInfo(_skillId, _skillLevel, data.getCostSp(), data.getCostExp(), data.getRate(activeChar.getLevel())); + int fElem = 100 + Config.SAFE_ENCHANT; + int sElem = 140 + Config.SAFE_ENCHANT; + ExEnchantSkillInfo esi = new ExEnchantSkillInfo(_skillId, _skillLevel, data.getCostSp(), data.getCostExp(), (activeChar.isNoble() && ((_skillLevel > 130 && _skillLevel <= sElem) || (_skillLevel <= fElem))) ? 100 : data.getRate(activeChar.getLevel())); if (Config.ES_SP_BOOK_NEEDED) if (data.getItemId() != 0 && data.getItemCount() != 0) esi.addRequirement(4, data.getItemId(), data.getItemCount(), 0); Index: java/net/sf/l2j/Config.java =================================================================== --- java/net/sf/l2j/Config.java (revision 7) +++ java/net/sf/l2j/Config.java (working copy) @@ -52,6 +52,7 @@ public static final String SIEGE_FILE = "./config/siege.properties"; public static final String PARTY_EVENT_FILE = "./config/PartyEvent.properties"; public static final String VOTE_MANAGER_FILE = "./config/VoteManager.properties"; + public static final String ENCHANT_SKILL_FILE = "./config/CustomEnchantSkills.properties"; /** VoteManager Settings */ @@ -107,6 +108,10 @@ public static boolean ALT_MEMBERS_CAN_WITHDRAW_FROM_CLANWH; public static boolean REMOVE_CASTLE_CIRCLETS; + /** Enchant Skills */ + public static int SAFE_ENCHANT; + public static boolean REDUCE_BY_ONE; + /** Manor */ public static int ALT_MANOR_REFRESH_TIME; public static int ALT_MANOR_REFRESH_MIN; @@ -1056,6 +1061,12 @@ RED_RAID_MSG = ptEvent.getProperty("RedRaidMessage","And remember!! Your enemies are noobs! Go Go Go!"); } + private static final void loadEnchantSkills() + { + final ExProperties eSkills = initProperties(ENCHANT_SKILL_FILE); + SAFE_ENCHANT = eSkills.getProperty("SkillSafeEnchantMax", 15); + REDUCE_BY_ONE = eSkills.getProperty("ReduceEnchant", false); + } /** * Loads NPC settings.<br> * Such as champion monsters, NPC buffer, class master, wyvern, raid bosses and grand bosses, AI. @@ -1512,6 +1523,9 @@ // server settings loadServer(); + + // Enchant Skills + loadEnchantSkills(); } public static final void loadLoginServer() Index: java/net/sf/l2j/gameserver/network/clientpackets/RequestExEnchantSkill.java =================================================================== --- java/net/sf/l2j/gameserver/network/clientpackets/RequestExEnchantSkill.java (revision 7) +++ java/net/sf/l2j/gameserver/network/clientpackets/RequestExEnchantSkill.java (working copy) @@ -121,7 +121,9 @@ activeChar.removeExpAndSp(data.getCostExp(), data.getCostSp()); // Try to enchant skill. - if (Rnd.get(100) <= data.getRate(activeChar.getLevel())) + int fElem = 100 + Config.SAFE_ENCHANT; + int sElem = 140 + Config.SAFE_ENCHANT; + if ((activeChar.isNoble() && ((_skillLevel > 130 && _skillLevel <= sElem) || (_skillLevel <= fElem))) ? true : Rnd.get(100) <= data.getRate(activeChar.getLevel())) { activeChar.addSkill(skill, true); activeChar.sendPacket(SystemMessage.getSystemMessage(SystemMessageId.YOU_HAVE_SUCCEEDED_IN_ENCHANTING_THE_SKILL_S1).addSkillName(_skillId, _skillLevel)); @@ -131,7 +133,13 @@ activeChar.sendPacket(SystemMessage.getSystemMessage(SystemMessageId.YOU_HAVE_FAILED_TO_ENCHANT_THE_SKILL_S1).addSkillName(_skillId, _skillLevel)); if (_skillLevel > 100) { - _skillLevel = baseLvl; + if (Config.REDUCE_BY_ONE && activeChar.isNoble()) + { + if (_skillLevel > 140 || _skillLevel < 130) + _skillLevel-=2; + } + else + _skillLevel = baseLvl; activeChar.addSkill(SkillTable.getInstance().getInfo(_skillId, _skillLevel), true); } } [/hide] Config: [hide] # ================================================================ # Enchant Skills setting # ================================================================ #If the char meet the conditions will enchant with 100% success rate #Till the this value #default 15 SkillSafeEnchantMax = 10 #If this is true and the enchant will fail , the skill enchantment will lost 1 enchant ReduceEnchant = true [/hide] Credits: melron
  7. Hello members of LordCraft, here is a code for time load like L2OFF for aCis. Code: [hide] ### Eclipse Workspace Patch 1.0 Index: java/net/sf/l2j/Config.java =================================================================== --- java/net/sf/l2j/Config.java (revision 1) +++ java/net/sf/l2j/Config.java (working copy) @@ -650,6 +650,8 @@ public static int ZONE_TOWN; public static boolean DISABLE_TUTORIAL; + public static long NPC_SERVER_DELAY; + // -------------------------------------------------- // Those "hidden" settings haven't configs to avoid admins to **** their server // You still can experiment changing values here. But don't say I didn't warn you. @@ -1258,6 +1260,8 @@ ZONE_TOWN = server.getProperty("ZoneTown", 0); SERVER_NEWS = server.getProperty("ShowServerNews", false); DISABLE_TUTORIAL = server.getProperty("DisableTutorial", false); + + NPC_SERVER_DELAY = npcs.getProperty("npcServerDelay", 1); } else if (Server.serverMode == Server.MODE_LOGINSERVER) { Index: java/net/sf/l2j/gameserver/datatables/SpawnTable.java =================================================================== --- java/net/sf/l2j/gameserver/datatables/SpawnTable.java (revision 1) +++ java/net/sf/l2j/gameserver/datatables/SpawnTable.java (working copy) @@ -23,6 +23,7 @@ import net.sf.l2j.Config; import net.sf.l2j.L2DatabaseFactory; +import net.sf.l2j.gameserver.ThreadPoolManager; import net.sf.l2j.gameserver.instancemanager.DayNightSpawnManager; import net.sf.l2j.gameserver.model.L2Spawn; import net.sf.l2j.gameserver.model.actor.template.NpcTemplate; @@ -44,7 +45,7 @@ protected SpawnTable() { if (!Config.ALT_DEV_NO_SPAWNS) - fillSpawnTable(); + ThreadPoolManager.getInstance().scheduleGeneral(new NPCServerTask(), Config.NPC_SERVER_DELAY * 1000); } public Set<L2Spawn> getSpawnTable() @@ -188,6 +189,17 @@ fillSpawnTable(); } + class NPCServerTask implements Runnable + { + @SuppressWarnings("synthetic-access") + @Override + public void run() + { + fillSpawnTable(); + _log.info("NPC Server: Task initialization..."); + } + } + private static class SingletonHolder { protected static final SpawnTable _instance = new SpawnTable(); +++ config/server.properties (working copy) +# Enable Npc Server Delay +npcServerDelay = 1 [/hide] Credits: masone
  8. Hello members of LordCraft, here is a code for Name Change. How it works? An item that changes the name of the character. Don't worry, we made checks on retail conditions, as 16-character limit, ... Remeber, you have to set an item to be the handler of Name Change. You can do it by adding <set name="handler" val="NameChange" /> on XML of the item. Image Preview: Core part: [hide] Index: java/net/sf/l2j/gameserver/handler/ItemHandler.java =================================================================== --- java/net/sf/l2j/gameserver/handler/ItemHandler.java (revision 21) +++ java/net/sf/l2j/gameserver/handler/ItemHandler.java (working copy) @@ -31,6 +31,7 @@ import net.sf.l2j.gameserver.handler.itemhandlers.Keys; import net.sf.l2j.gameserver.handler.itemhandlers.Maps; import net.sf.l2j.gameserver.handler.itemhandlers.MercTicket; +import net.sf.l2j.gameserver.handler.itemhandlers.NameChange; import net.sf.l2j.gameserver.handler.itemhandlers.PaganKeys; import net.sf.l2j.gameserver.handler.itemhandlers.PetFood; import net.sf.l2j.gameserver.handler.itemhandlers.Recipes; @@ -70,6 +71,7 @@ registerItemHandler(new Keys()); registerItemHandler(new Maps()); registerItemHandler(new MercTicket()); + registerItemHandler(new NameChange()); registerItemHandler(new PaganKeys()); registerItemHandler(new PetFood()); registerItemHandler(new Recipes()); Index: java/net/sf/l2j/gameserver/handler/itemhandlers/NameChange.java =================================================================== --- java/net/sf/l2j/gameserver/handler/itemhandlers/NameChange.java (revision 0) +++ java/net/sf/l2j/gameserver/handler/itemhandlers/NameChange.java (working copy) @@ -0,0 +1,43 @@ +/* + * 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 3 of the License, 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, see <http://www.gnu.org/licenses/>. + */ +package net.sf.l2j.gameserver.handler.itemhandlers; + +import net.sf.l2j.gameserver.handler.IItemHandler; +import net.sf.l2j.gameserver.model.actor.L2Playable; +import net.sf.l2j.gameserver.model.actor.instance.L2PcInstance; +import net.sf.l2j.gameserver.model.item.instance.ItemInstance; +import net.sf.l2j.gameserver.network.serverpackets.ActionFailed; +import net.sf.l2j.gameserver.network.serverpackets.NpcHtmlMessage; + +/** + * @author rapfersan92 + */ +public class NameChange implements IItemHandler +{ + @Override + public void useItem(L2Playable playable, ItemInstance item, boolean forceUse) + { + if (!(playable instanceof L2PcInstance)) + return; + + final L2PcInstance activeChar = (L2PcInstance) playable; + activeChar.setNameChangeItemId(item.getItemId()); + + final NpcHtmlMessage html = new NpcHtmlMessage(0); + html.setFile("data/html/mods/NameChange.htm"); + activeChar.sendPacket(html); + activeChar.sendPacket(ActionFailed.STATIC_PACKET); + } +} \ No newline at end of file Index: java/net/sf/l2j/gameserver/model/actor/instance/L2PcInstance.java =================================================================== --- java/net/sf/l2j/gameserver/model/actor/instance/L2PcInstance.java (revision 21) +++ java/net/sf/l2j/gameserver/model/actor/instance/L2PcInstance.java (working copy) @@ -10705,4 +10705,16 @@ break; } } + + private int _nameChangeItemId = 0; + + public int getNameChangeItemId() + { + return _nameChangeItemId; + } + + public void setNameChangeItemId(int itemId) + { + _nameChangeItemId = itemId; + } } \ No newline at end of file Index: java/net/sf/l2j/gameserver/network/clientpackets/RequestBypassToServer.java =================================================================== --- java/net/sf/l2j/gameserver/network/clientpackets/RequestBypassToServer.java (revision 21) +++ java/net/sf/l2j/gameserver/network/clientpackets/RequestBypassToServer.java (working copy) @@ -18,8 +18,10 @@ import java.util.logging.Level; import net.sf.l2j.Config; +import net.sf.l2j.commons.lang.StringUtil; import net.sf.l2j.gameserver.communitybbs.CommunityBoard; import net.sf.l2j.gameserver.datatables.AdminCommandAccessRights; +import net.sf.l2j.gameserver.datatables.CharNameTable; import net.sf.l2j.gameserver.handler.AdminCommandHandler; import net.sf.l2j.gameserver.handler.IAdminCommandHandler; import net.sf.l2j.gameserver.model.L2Object; @@ -31,7 +33,9 @@ import net.sf.l2j.gameserver.model.olympiad.OlympiadManager; import net.sf.l2j.gameserver.network.SystemMessageId; import net.sf.l2j.gameserver.network.serverpackets.ActionFailed; +import net.sf.l2j.gameserver.network.serverpackets.ExShowScreenMessage; import net.sf.l2j.gameserver.network.serverpackets.NpcHtmlMessage; +import net.sf.l2j.gameserver.network.serverpackets.PlaySound; import net.sf.l2j.gameserver.util.FloodProtectors; import net.sf.l2j.gameserver.util.FloodProtectors.Action; import net.sf.l2j.gameserver.util.GMAudit; @@ -181,6 +185,46 @@ final int arenaId = Integer.parseInt(_command.substring(12).trim()); activeChar.enterOlympiadObserverMode(arenaId); } + else if (_command.startsWith("name_change")) + { + try + { + String name = _command.substring(12); + if (name.length() > 16) + { + activeChar.sendMessage("The chosen name cannot exceed 16 characters in length."); + return; + } + + if (!StringUtil.isValidPlayerName(name)) + { + activeChar.sendMessage("The chosen name does not fit with the regex pattern."); + return; + } + + synchronized (CharNameTable.getInstance()) + { + if (CharNameTable.doesCharNameExist(name)) + { + activeChar.sendMessage("The chosen name already exists."); + return; + } + } + + if (activeChar.destroyItemByItemId("Name Change", activeChar.getNameChangeItemId(), 1, null, true)) + { + activeChar.setName(name); + activeChar.sendPacket(new ExShowScreenMessage("Congratulations. Your name has been changed.", 10000)); + activeChar.sendPacket(new PlaySound("ItemSound.quest_finish")); + activeChar.broadcastUserInfo(); + activeChar.store(); + } + } + catch (Exception e) + { + activeChar.sendMessage("Fill out the field correctly."); + } + } } catch (Exception e) { [/hide] Datapack Part: [hide] Index: data/html/mods/NameChange.htm =================================================================== --- data/html/mods/NameChange.htm (revision 0) +++ data/html/mods/NameChange.htm (working copy) @@ -0,0 +1,26 @@ +<html> + <body> + <center> + <table width="256"> + <tr><td width="256" align="center">Name Change</td></tr> + </table> + <br> + <table width="256"> + <tr><td width="256" align="left">The name change service allows you to change the name of your character as it appears in-game.</td></tr> + </table> + <br> + <table width="160" cellspacing="2"> + <tr><td width="160" align="center">Name</td></tr> + <tr><td width="160" align="center"><edit var="name" width="160" height="12"></td> + </table> + <br> + <table width="95" cellspacing="2"> + <tr><td width="95" align="center"><button action="bypass -h name_change $name" value="Change!" width="95" height="21" back="bigbutton_over" fore="bigbutton"></td></tr> + </table> + <br> + <table width="256"> + <tr><td width="256" align="center">L2jBrasil</td></tr> + </table> + </center> + </body> +</html> \ No newline at end of file [/hide] Credits: Kraker
  9. Hello, I'm a bit new coding PHP, I'm trying to make a page to see the server status (not real servers) I just got a DB with this structure: https://prnt.sc/huch18 And I just want to set flags like a check or X depending on the Disponibility of the server, obtained from the DB using this code: <html> <head> <title>testing php </title> </head> <body> <?php $link = @mysqli_connect( 'localhost', 'root', '12345', 'admin'); if(!$link){ echo '<p>Error al conectar con la base de datos: ' . mysqli_connect_error(); echo '</p>'; exit; } $servers = ("SELECT * FROM servers"); $query = mysqli_query($link, $servers) or trigger_error($link->error."[$servers]"); echo "<table>"; while($row = mysqli_fetch_assoc($query)){ $serverName = $row['nom']; $serverDispo = $row['disponibilitat']; $serverPopu = $row['poblacio']; $serverQue = $row['cua']; echo "<tr><td>".$serverName."</td><td>".$serverDispo."</td><td>".$serverPopu."</td><td>".$serverQue."</td></tr>"; } mysqli_free_result($query); echo "</table>"; } ?> </body> </html> I know I'm not setting the flags, I just want to get the table with results. And this is the result: https://prnt.sc/huckqk Maybe I'm making a noob mistake but I need help ;(
  10. Images Preview: Core Part Code: [hide] Index: head-src/com/l2jfrozen/gameserver/communitybbs/Manager/ClanBBSManager.java =================================================================== --- head-src/com/l2jfrozen/gameserver/communitybbs/Manager/ClanBBSManager.java (revision 758) +++ head-src/com/l2jfrozen/gameserver/communitybbs/Manager/ClanBBSManager.java (working copy) @@ -95,13 +96,96 @@ st = null; } } + else if (command.startsWith("_bbsclan_clannotice_edit;")) + { + clanNotice(activeChar, activeChar.getClan().getClanId()); + } + else if (command.startsWith("_bbsclan_clannotice_enable")) + { + activeChar.getClan().setNoticeEnabled(true); + clanNotice(activeChar, activeChar.getClan().getClanId()); + } + else if (command.startsWith("_bbsclan_clannotice_disable")) + { + activeChar.getClan().setNoticeEnabled(false); + clanNotice(activeChar, activeChar.getClan().getClanId()); + } else { separateAndSend("<html><body><br><br><center>Commande : " + command + " pas encore implante</center><br><br></body></html>", activeChar); } } - + private void clanNotice(L2PcInstance activeChar, int clanId) + { + L2Clan cl = ClanTable.getInstance().getClan(clanId); + if (cl != null) + { + if (cl.getLevel() < 2) + { + activeChar.sendPacket(new SystemMessage(SystemMessageId.NO_CB_IN_MY_CLAN)); + parsecmd("_bbsclan_clanlist", activeChar); + } + else + { + + TextBuilder html = new TextBuilder("<html><body><br><br>" + + "<table border=0 width=610><tr><td width=10></td><td width=600 align=left>" + + "<a action=\"bypass _bbshome\">HOME</a> &gt; " + + "<a action=\"bypass _bbsclan_clanlist\"> CLAN COMMUNITY </a> &gt; " + "<a action=\"bypass _bbsclan_clanhome;"+String.valueOf(clanId)+"\"> &amp;$802; </a>" + + "</td></tr>" + "</table>"); + if (activeChar.isClanLeader()) + { + html.append("<br><br><center>" + + "<table width=610 border=0 cellspacing=0 cellpadding=0>" + + "<tr><td fixwidth=610><font color=\"AAAAAA\">The Clan Notice function allows the clan leader to send messages through a pop-up window to clan members at login.</font> </td></tr>" + + "<tr><td height=20></td></tr>"); + + if (activeChar.getClan().isNoticeEnabled()) + html.append( "<tr><td fixwidth=610> Clan Notice Function:&nbsp;&nbsp;&nbsp;on&nbsp;&nbsp;&nbsp;/&nbsp;&nbsp;&nbsp;<a action=\"bypass _bbsclan_clannotice_disable\">off</a>"); + else + html.append( "<tr><td fixwidth=610> Clan Notice Function:&nbsp;&nbsp;&nbsp;<a action=\"bypass _bbsclan_clannotice_enable\">on</a>&nbsp;&nbsp;&nbsp;/&nbsp;&nbsp;&nbsp;off"); + + html.append( "</td></tr>" + + "</table>" + + "<img src=\"L2UI.Squaregray\" width=\"610\" height=\"1\">" + + "<br> <br>" + + "<table width=610 border=0 cellspacing=2 cellpadding=0>" + + "<tr><td>Edit Notice: </td></tr>" + + "<tr><td height=5></td></tr>" + + "<tr><td>" + + "<MultiEdit var =\"Content\" width=610 height=100>" + + "</td></tr>" + + "</table>" + + "<br>" + + "<table width=610 border=0 cellspacing=0 cellpadding=0>" + + "<tr><td height=5></td></tr>" + + "<tr>" + + "<td align=center FIXWIDTH=65><button value=\"&$140;\" action=\"Write Notice Set _ Content Content Content\" back=\"l2ui_ch3.smallbutton2_down\" width=65 height=20 fore=\"l2ui_ch3.smallbutton2\" ></td>" + + "<td align=center FIXWIDTH=45></td>" + "<td align=center FIXWIDTH=500></td>" + "</tr>" + "</table>" + + "</center>" + "</body>" + "</html>"); + send1001(html.toString(), activeChar); + send1002(activeChar, activeChar.getClan().getNotice(), " ", "0"); + } + else + { + html.append( "<img src=\"L2UI.squareblank\" width=\"1\" height=\"10\">" + "<center>" + + "<table border=0 cellspacing=0 cellpadding=0><tr>" + + "<td>You are not your clan's leader, and therefore cannot change the clan notice</td>" + "</tr></table>"); + if (activeChar.getClan().isNoticeEnabled()) + { + html.append( "<table border=0 cellspacing=0 cellpadding=0>" + "<tr>" + + "<td>The current clan notice:</td>" + "</tr>" + "<tr><td fixwidth=5></td>" + + "<td FIXWIDTH=600 align=left>" + activeChar.getClan().getNotice() + "</td>" + "<td fixqqwidth=5></td>" + + "</tr>" + "</table>"); + } + html.append( "</center>" + "</body>" + "</html>"); + separateAndSend(html.toString(), activeChar); + } + } + } + } + /** * @param activeChar */ @@ -266,7 +350,7 @@ html.append("<td fixwidth=600>"); html.append("<a action=\"bypass _bbsclan_clanhome;" + clanId + ";announce\">[CLAN ANNOUNCEMENT]</a> <a action=\"bypass _bbsclan_clanhome;" + clanId + ";cbb\">[CLAN BULLETIN BOARD]</a>"); html.append("<a action=\"bypass _bbsclan_clanhome;" + clanId + ";cmail\">[CLAN MAIL]</a>&nbsp;&nbsp;"); - html.append("<a action=\"bypass _bbsclan_clanhome;" + clanId + ";cnotice\">[CLAN NOTICE]</a>&nbsp;&nbsp;"); + html.append("<a action=\"bypass _bbsclan_clannotice_edit;" + clanId + ";cnotice\">[CLAN NOTICE]</a>&nbsp;&nbsp;"); html.append("</td>"); html.append("<td fixWIDTH=5></td>"); html.append("</tr>"); @@ -341,7 +425,11 @@ @Override public void parsewrite(String ar1, String ar2, String ar3, String ar4, String ar5, L2PcInstance activeChar) { - //null; + if (ar1.equals("Set")) + { + activeChar.getClan().setNotice(ar4); + parsecmd("_bbsclan_clanhome;" + activeChar.getClan().getClanId(), activeChar); + } } } Index: head-src/com/l2jfrozen/gameserver/communitybbs/CommunityBoard.java =================================================================== --- head-src/com/l2jfrozen/gameserver/communitybbs/CommunityBoard.java (revision 758) +++ head-src/com/l2jfrozen/gameserver/communitybbs/CommunityBoard.java (working copy) @@ -208,6 +224,10 @@ { RegionBBSManager.getInstance().parsewrite(arg1, arg2, arg3, arg4, arg5, activeChar); } + else if (url.equals("Notice")) + { + ClanBBSManager.getInstance().parsewrite(arg1, arg2, arg3, arg4, arg5, activeChar); + } else { ShowBoard sb = new ShowBoard("<html><body><br><br><center>the command: " + url + " is not implemented yet</center><br><br></body></html>", "101"); Index: head-src/com/l2jfrozen/gameserver/model/L2Clan.java =================================================================== --- head-src/com/l2jfrozen/gameserver/model/L2Clan.java (revision 758) +++ head-src/com/l2jfrozen/gameserver/model/L2Clan.java (working copy) @@ -24,6 +24,7 @@ import java.sql.SQLException; import java.util.List; import java.util.Map; +import java.util.logging.Level; import java.util.logging.Logger; import javolution.util.FastList; @@ -164,6 +165,9 @@ private int _reputationScore = 0; private int _rank = 0; + private String _notice; + private boolean _noticeEnabled = false; + private static final int MAX_NOTICE_LENGTH = 8192; /** * Called if a clan is referenced only by id. In this case all other data needs to be fetched from db * @@ -963,6 +967,7 @@ restoreSubPledges(); restoreRankPrivs(); restoreSkills(); + restoreNotice(); member = null; } @@ -976,7 +981,97 @@ con = null; } } - + private void restoreNotice() + { + Connection con = null; + try + { + con = L2DatabaseFactory.getInstance().getConnection(); + PreparedStatement statement = con.prepareStatement("SELECT enabled,notice FROM clan_notices WHERE clan_id=?"); + statement.setInt(1, getClanId()); + ResultSet noticeData = statement.executeQuery(); + + while (noticeData.next()) + { + _noticeEnabled = noticeData.getBoolean("enabled"); + _notice = noticeData.getString("notice"); + } + + noticeData.close(); + statement.close(); + } + catch (Exception e) + { + _log.log(Level.SEVERE, "Error restoring clan notice: " + e.getMessage(), e); + } + finally + { + L2DatabaseFactory.close(con); + } + + } + + private void storeNotice(String notice, boolean enabled) + { + if (notice == null) + notice = ""; + + if (notice.length() > MAX_NOTICE_LENGTH) + notice = notice.substring(0, MAX_NOTICE_LENGTH - 1); + + Connection con = null; + try + { + con = L2DatabaseFactory.getInstance().getConnection(); + PreparedStatement statement = con.prepareStatement("INSERT INTO clan_notices (clan_id,notice,enabled) values (?,?,?) ON DUPLICATE KEY UPDATE notice=?,enabled=?"); + statement.setInt(1, getClanId()); + statement.setString(2, notice); + if (enabled) + statement.setString(3, "true"); + else + statement.setString(3, "false"); + statement.setString(4, notice); + if (enabled) + statement.setString(5, "true"); + else + statement.setString(5, "false"); + statement.execute(); + statement.close(); + } + catch (Exception e) + { + _log.log(Level.WARNING, "Error could not store clan notice: " + e.getMessage(), e); + } + finally + { + L2DatabaseFactory.close(con); + } + + _notice = notice; + _noticeEnabled = enabled; + } + + public void setNoticeEnabled(boolean enabled) + { + storeNotice(_notice, enabled); + } + + public void setNotice(String notice) + { + storeNotice(notice, _noticeEnabled); + } + + public boolean isNoticeEnabled() + { + return _noticeEnabled; + } + + public String getNotice() + { + if (_notice == null) + return ""; + return _notice; + } private void restoreSkills() { Connection con = null; Index: head-src/com/l2jfrozen/gameserver/network/clientpackets/EnterWorld.java =================================================================== --- head-src/com/l2jfrozen/gameserver/network/clientpackets/EnterWorld.java (revision 769) +++ head-src/com/l2jfrozen/gameserver/network/clientpackets/EnterWorld.java (working copy) @@ -553,9 +553,21 @@ activeChar.setFirstLog(false); activeChar.updateFirstLog(); } - - if(Config.WELCOME_HTM) + if (activeChar.getClan().isNoticeEnabled()) { + String clanNotice = "data/html/clanNotice.htm"; + File mainText = new File(Config.DATAPACK_ROOT, clanNotice); + if(mainText.exists()) + { + NpcHtmlMessage html = new NpcHtmlMessage(1); + html.setFile(clanNotice); + html.replace("%clan_name%", activeChar.getClan().getName()); + html.replace("%notice_text%", activeChar.getClan().getNotice().replaceAll("\r\n", "<br>")); + sendPacket(html); + } + } + if(Config.WELCOME_HTM && !activeChar.getClan().isNoticeEnabled()) + { String Welcome_Path = "data/html/welcome.htm"; File mainText = new File(Config.DATAPACK_ROOT, Welcome_Path); if(mainText.exists()) [/hide] HTML: <html><title>Clan Announcements</title> <body><br> <center><font color="CCAA00">%clan_name%</font> <font color="6655FF"> Clan Alert Message</font></center><br> <img src="L2UI.SquareWhite" width=270 height=1><br> %notice_text% </body></html> SQL: ALTER TABLE `clan_notices` CHANGE `clanID` `clan_id` int(32) NOT NULL FIRST, COMMENT='' Credits: Neron
  11. Hello members of LordCraft, here is a code for Enchant Success Announcements. How it works? There are 2 options. Option 1: You can set an enchant level and when the player enchant his item on the value you set or more it will make an announcement. Option 2: You can set 2 or more enchant levels and when the player enchant his item to those values you set it will make an announcement. Image Preview: Option 1 Code: [hide] ### Eclipse Workspace Patch 1.0 #P L2jFrozen_GameServer Index: head-src/com/l2jfrozen/Config.java =================================================================== --- head-src/com/l2jfrozen/Config.java (revision 986) +++ head-src/com/l2jfrozen/Config.java (working copy) @@ -2891,6 +2891,8 @@ public static int GM_OVER_ENCHANT; public static int MAX_ITEM_ENCHANT_KICK; + public static boolean ENABLE_ENCHANT_ANNOUNCE; + public static int ENCHANT_ANNOUNCE_LEVEL; //============================================================ public static void loadEnchantConfig() @@ -3196,6 +3198,8 @@ MAX_ITEM_ENCHANT_KICK = Integer.parseInt(ENCHANTSetting.getProperty("EnchantKick", "0")); GM_OVER_ENCHANT = Integer.parseInt(ENCHANTSetting.getProperty("GMOverEnchant", "0")); + ENABLE_ENCHANT_ANNOUNCE = Boolean.parseBoolean(ENCHANTSetting.getProperty("EnableEnchantAnnounce", "False")); + ENCHANT_ANNOUNCE_LEVEL = Integer.parseInt(ENCHANTSetting.getProperty("EnchantAnnounceLevel", "16")); } catch(Exception e) { Index: head-src/com/l2jfrozen/gameserver/network/clientpackets/RequestEnchantItem.java =================================================================== --- head-src/com/l2jfrozen/gameserver/network/clientpackets/RequestEnchantItem.java (revision 986) +++ head-src/com/l2jfrozen/gameserver/network/clientpackets/RequestEnchantItem.java (working copy) @@ -25,6 +25,7 @@ import com.l2jfrozen.gameserver.model.actor.instance.L2ItemInstance; import com.l2jfrozen.gameserver.model.actor.instance.L2PcInstance; import com.l2jfrozen.gameserver.model.base.Race; +import com.l2jfrozen.gameserver.model.entity.Announcements; import com.l2jfrozen.gameserver.network.SystemMessageId; import com.l2jfrozen.gameserver.network.serverpackets.EnchantResult; import com.l2jfrozen.gameserver.network.serverpackets.InventoryUpdate; @@ -301,6 +302,7 @@ int chance = 0; int maxEnchantLevel = 0; int minEnchantLevel = 0; + int nextEnchantLevel = item.getEnchantLevel() + 1; if(item.getItem().getType2() == L2Item.TYPE2_WEAPON) { @@ -565,6 +567,9 @@ sm = new SystemMessage(SystemMessageId.S1_SUCCESSFULLY_ENCHANTED); sm.addItemName(item.getItemId()); activeChar.sendPacket(sm); + + if(Config.ENABLE_ENCHANT_ANNOUNCE && Config.ENCHANT_ANNOUNCE_LEVEL == 0) + Announcements.getInstance().gameAnnounceToAll("Congratulations to " + activeChar.getName() + "! Your " + item.getItem() + " has been successfully enchanted to +" + nextEnchantLevel); } else { @@ -572,6 +577,9 @@ sm.addNumber(item.getEnchantLevel()); sm.addItemName(item.getItemId()); activeChar.sendPacket(sm); + + if(Config.ENABLE_ENCHANT_ANNOUNCE && Config.ENCHANT_ANNOUNCE_LEVEL <= item.getEnchantLevel()) + Announcements.getInstance().gameAnnounceToAll("Congratulations to " + activeChar.getName() + "! Your " + item.getItem() + " has been successfully enchanted to +" + nextEnchantLevel); } item.setEnchantLevel(item.getEnchantLevel() + Config.CUSTOM_ENCHANT_VALUE); Index: config/head/enchant.properties =================================================================== --- config/head/enchant.properties (revision 986) +++ config/head/enchant.properties (working copy) @@ -131,4 +131,14 @@ # HOW WORKS: if you set it to 20, and player have an item > 20 # he will be kicked and the item will disappear! # Enchant amount at which a player gets punished (0 disabled) -EnchantKick = 0 \ No newline at end of file +EnchantKick = 0 + +# ---------------------- +# Enchant Announce - +# ---------------------- +# Announce when a player successfully enchant an item to x +# Default: False +EnableEnchantAnnounce = False + +# The value of x is... set it here (No have default value) +EnchantAnnounceLevel = 16 [/hide] Option 2 Code: [hide] ### Eclipse Workspace Patch 1.0 #P L2jFrozen_GameServer Index: head-src/com/l2jfrozen/Config.java =================================================================== --- head-src/com/l2jfrozen/Config.java (revision 987) +++ head-src/com/l2jfrozen/Config.java (working copy) @@ -2891,6 +2891,9 @@ public static int GM_OVER_ENCHANT; public static int MAX_ITEM_ENCHANT_KICK; + public static boolean ENABLE_ENCHANT_ANNOUNCE; + public static String ENCHANT_ANNOUNCE_LEVEL; + public static FastList<Integer> LIST_ENCHANT_ANNOUNCE_LEVEL = new FastList<Integer>(); //============================================================ public static void loadEnchantConfig() @@ -3196,6 +3199,13 @@ MAX_ITEM_ENCHANT_KICK = Integer.parseInt(ENCHANTSetting.getProperty("EnchantKick", "0")); GM_OVER_ENCHANT = Integer.parseInt(ENCHANTSetting.getProperty("GMOverEnchant", "0")); + ENABLE_ENCHANT_ANNOUNCE = Boolean.parseBoolean(ENCHANTSetting.getProperty("EnableEnchantAnnounce", "False")); + ENCHANT_ANNOUNCE_LEVEL = ENCHANTSetting.getProperty("EnchantAnnounceLevels", "6,10,16,20"); + LIST_ENCHANT_ANNOUNCE_LEVEL = new FastList<Integer>(); + for (String id : ENCHANT_ANNOUNCE_LEVEL.split(",")) + { + LIST_ENCHANT_ANNOUNCE_LEVEL.add(Integer.parseInt(id)); + } } catch(Exception e) { Index: head-src/com/l2jfrozen/gameserver/model/entity/Announcements.java =================================================================== --- head-src/com/l2jfrozen/gameserver/model/entity/Announcements.java (revision 987) +++ head-src/com/l2jfrozen/gameserver/model/entity/Announcements.java (working copy) @@ -42,6 +42,7 @@ import com.l2jfrozen.gameserver.network.serverpackets.NpcHtmlMessage; import com.l2jfrozen.gameserver.network.serverpackets.SystemMessage; import com.l2jfrozen.gameserver.script.DateRange; +import com.l2jfrozen.gameserver.util.Broadcast; /** * @author ProGramMoS @@ -292,6 +293,12 @@ player.sendPacket(sm); } } + + public static void announceInRegion(L2PcInstance activeChar, String text) + { + CreatureSay cs = new CreatureSay(0, 18, "", text); + Broadcast.toPlayersInSameRegion(activeChar, cs); + } // Method fo handling announcements from admin public void handleAnnounce(String command, int lengthToTrim) Index: head-src/com/l2jfrozen/gameserver/network/clientpackets/RequestEnchantItem.java =================================================================== --- head-src/com/l2jfrozen/gameserver/network/clientpackets/RequestEnchantItem.java (revision 987) +++ head-src/com/l2jfrozen/gameserver/network/clientpackets/RequestEnchantItem.java (working copy) @@ -25,10 +25,12 @@ import com.l2jfrozen.gameserver.model.actor.instance.L2ItemInstance; import com.l2jfrozen.gameserver.model.actor.instance.L2PcInstance; import com.l2jfrozen.gameserver.model.base.Race; +import com.l2jfrozen.gameserver.model.entity.Announcements; import com.l2jfrozen.gameserver.network.SystemMessageId; import com.l2jfrozen.gameserver.network.serverpackets.EnchantResult; import com.l2jfrozen.gameserver.network.serverpackets.InventoryUpdate; import com.l2jfrozen.gameserver.network.serverpackets.ItemList; +import com.l2jfrozen.gameserver.network.serverpackets.MagicSkillUser; import com.l2jfrozen.gameserver.network.serverpackets.StatusUpdate; import com.l2jfrozen.gameserver.network.serverpackets.SystemMessage; import com.l2jfrozen.gameserver.templates.L2Item; @@ -301,6 +303,7 @@ int chance = 0; int maxEnchantLevel = 0; int minEnchantLevel = 0; + int nextEnchantLevel = item.getEnchantLevel() + 1; if(item.getItem().getType2() == L2Item.TYPE2_WEAPON) { @@ -565,6 +568,14 @@ sm = new SystemMessage(SystemMessageId.S1_SUCCESSFULLY_ENCHANTED); sm.addItemName(item.getItemId()); activeChar.sendPacket(sm); + + if (Config.ENABLE_ENCHANT_ANNOUNCE && Config.LIST_ENCHANT_ANNOUNCE_LEVEL.contains(nextEnchantLevel)) + { + Announcements.announceInRegion(activeChar, "Congratulations to " + activeChar.getName() + "! Your " + item.getItem() + " has been successfully enchanted to +" + nextEnchantLevel); + MagicSkillUser MSU = new MagicSkillUser(activeChar, activeChar, 2025, 1, 1, 0); + activeChar.sendPacket(MSU); + activeChar.broadcastPacket(MSU); + } } else { @@ -572,6 +583,14 @@ sm.addNumber(item.getEnchantLevel()); sm.addItemName(item.getItemId()); activeChar.sendPacket(sm); + + if (Config.ENABLE_ENCHANT_ANNOUNCE && Config.LIST_ENCHANT_ANNOUNCE_LEVEL.contains(nextEnchantLevel)) + { + Announcements.announceInRegion(activeChar, "Congratulations to " + activeChar.getName() + "! Your " + item.getItem() + " has been successfully enchanted to +" + nextEnchantLevel); + MagicSkillUser MSU = new MagicSkillUser(activeChar, activeChar, 2025, 1, 1, 0); + activeChar.sendPacket(MSU); + activeChar.broadcastPacket(MSU); + } } item.setEnchantLevel(item.getEnchantLevel() + Config.CUSTOM_ENCHANT_VALUE); Index: head-src/com/l2jfrozen/gameserver/util/Broadcast.java =================================================================== --- head-src/com/l2jfrozen/gameserver/util/Broadcast.java (revision 987) +++ head-src/com/l2jfrozen/gameserver/util/Broadcast.java (working copy) @@ -32,6 +32,7 @@ import java.util.logging.Logger; import com.l2jfrozen.Config; +import com.l2jfrozen.gameserver.datatables.csv.MapRegionTable; import com.l2jfrozen.gameserver.model.L2Character; import com.l2jfrozen.gameserver.model.L2World; import com.l2jfrozen.gameserver.model.actor.instance.L2PcInstance; @@ -243,4 +244,26 @@ onlinePlayer.sendPacket(mov); } } + + public static void toPlayersInSameRegion(L2PcInstance player, L2GameServerPacket mov) + { + int curRegion = MapRegionTable.getInstance().getMapRegion(player.getX(), player.getY()); + if (Config.DEBUG) + { + _log.fine("Players to notify: " + L2World.getAllPlayersCount() + " (with packet " + mov.getType() + ")"); + } + + for (L2PcInstance target : L2World.getInstance().getAllPlayers()) + { + if (target == null) + { + continue; + } + + if (curRegion == MapRegionTable.getInstance().getMapRegion(target.getX(), target.getY())) + { + target.sendPacket(mov); + } + } + } } Index: config/head/enchant.properties =================================================================== --- config/head/enchant.properties (revision 987) +++ config/head/enchant.properties (working copy) @@ -131,4 +131,15 @@ # HOW WORKS: if you set it to 20, and player have an item > 20 # he will be kicked and the item will disappear! # Enchant amount at which a player gets punished (0 disabled) -EnchantKick = 0 \ No newline at end of file +EnchantKick = 0 + +# ---------------------- +# Enchant Announce - +# ---------------------- +# Announce when a player successfully enchant an item to x +# Default: False +EnableEnchantAnnounce = False + +# The value of x is... set it here (separated by comma) e.g: 5,10,20,35,... +# NOTE: Dont have default value! +EnchantAnnounceLevels = 6,10,16,20 [/hide] Credits: RedHoT
  12. Description: Once you have completed 3 rebirths you need to collect various items from the following raid bosses in order to become a Noblesse. Death Lord Hallate Kernon Longhorn Golkonda Shilen's Messenger Cabrio Once you've collected all the items and your character is lvl78, you can go to the Noblesse NPC ''Eddy Wally'' who's located on the stairs in Aden Town, and become a Noblesse. Screenshots: Downloads: [hide] Core Patch via pastebin Datapack Patch via pastebin Client Side via zippyshare [/hide] Notice: You can find Trance's Rebirth Manager here. All credits goes to: Trance
  13. Hello guys, here is a code for Enchant Rates Config for Blessed and Crystal Scrolls for aCis. Go to: gameserver/network/clientpacket/AbstractEnchantPacket.java find this if (enchantItem.isArmor()) chance = Math.pow(Config.ENCHANT_CHANCE_ARMOR, (enchantItem.getEnchantLevel() - 2)); // Weapon formula is 70% for fighter weapon, 40% for mage weapon. Special rates after +14. else if (enchantItem.isWeapon()) { if (((L2Weapon) enchantItem.getItem()).isMagical()) chance = (enchantItem.getEnchantLevel() > 14) ? Config.ENCHANT_CHANCE_WEAPON_MAGIC_15PLUS : Config.ENCHANT_CHANCE_WEAPON_MAGIC; else chance = (enchantItem.getEnchantLevel() > 14) ? Config.ENCHANT_CHANCE_WEAPON_NONMAGIC_15PLUS : Config.ENCHANT_CHANCE_WEAPON_NONMAGIC; } And replace it with this: [hide] if (isBlessed()) { if (enchantItem.isArmor()) chance = Math.pow(Config.ENCHANT_CHANCE_ARMOR_BLESSED, (enchantItem.getEnchantLevel() - 2)); // Weapon formula is 70% for fighter weapon, 40% for mage weapon. Special rates after +14. else if (enchantItem.isWeapon()) { if (((Weapon) enchantItem.getItem()).isMagical()) chance = (enchantItem.getEnchantLevel() > 14) ? Config.ENCHANT_CHANCE_WEAPON_MAGIC_15PLUS_BLESSED : Config.ENCHANT_CHANCE_WEAPON_MAGIC_BLESSED; else chance = (enchantItem.getEnchantLevel() > 14) ? Config.ENCHANT_CHANCE_WEAPON_NONMAGIC_15PLUS_BLESSED : Config.ENCHANT_CHANCE_WEAPON_NONMAGIC_BLESSED; } } else if (isCrystal()) { if (enchantItem.isArmor()) chance = Math.pow(Config.ENCHANT_CHANCE_ARMOR_CRYSTAL, (enchantItem.getEnchantLevel() - 2)); // Weapon formula is 70% for fighter weapon, 40% for mage weapon. Special rates after +14. else if (enchantItem.isWeapon()) { if (((Weapon) enchantItem.getItem()).isMagical()) chance = (enchantItem.getEnchantLevel() > 14) ? Config.ENCHANT_CHANCE_WEAPON_MAGIC_15PLUS_CRYSTAL : Config.ENCHANT_CHANCE_WEAPON_MAGIC_CRYSTAL; else chance = (enchantItem.getEnchantLevel() > 14) ? Config.ENCHANT_CHANCE_WEAPON_NONMAGIC_15PLUS_CRYSTAL : Config.ENCHANT_CHANCE_WEAPON_NONMAGIC_CRYSTAL; } } else { if (enchantItem.isArmor()) chance = Math.pow(Config.ENCHANT_CHANCE_ARMOR, (enchantItem.getEnchantLevel() - 2)); // Weapon formula is 70% for fighter weapon, 40% for mage weapon. Special rates after +14. else if (enchantItem.isWeapon()) { if (((Weapon) enchantItem.getItem()).isMagical()) chance = (enchantItem.getEnchantLevel() > 14) ? Config.ENCHANT_CHANCE_WEAPON_MAGIC_15PLUS : Config.ENCHANT_CHANCE_WEAPON_MAGIC; else chance = (enchantItem.getEnchantLevel() > 14) ? Config.ENCHANT_CHANCE_WEAPON_NONMAGIC_15PLUS : Config.ENCHANT_CHANCE_WEAPON_NONMAGIC; } } [/hide] And now the Configs: public static double ENCHANT_CHANCE_WEAPON_MAGIC; public static double ENCHANT_CHANCE_WEAPON_MAGIC_15PLUS; public static double ENCHANT_CHANCE_WEAPON_NONMAGIC; public static double ENCHANT_CHANCE_WEAPON_NONMAGIC_15PLUS; +public static double ENCHANT_CHANCE_WEAPON_MAGIC_BLESSED; +public static double ENCHANT_CHANCE_WEAPON_MAGIC_15PLUS_BLESSED; +public static double ENCHANT_CHANCE_WEAPON_NONMAGIC_BLESSED; +public static double ENCHANT_CHANCE_WEAPON_NONMAGIC_15PLUS_BLESSED; +public static double ENCHANT_CHANCE_WEAPON_NONMAGIC_CRYSTAL; +public static double ENCHANT_CHANCE_WEAPON_NONMAGIC_15PLUS_CRYSTAL; +public static double ENCHANT_CHANCE_WEAPON_MAGIC_CRYSTAL; +public static double ENCHANT_CHANCE_WEAPON_MAGIC_15PLUS_CRYSTAL; public static double ENCHANT_CHANCE_ARMOR; +public static double ENCHANT_CHANCE_ARMOR_BLESSED; +public static double ENCHANT_CHANCE_ARMOR_CRYSTAL; ENCHANT_CHANCE_WEAPON_MAGIC = players.getProperty("EnchantChanceMagicWeapon", 0.4); ENCHANT_CHANCE_WEAPON_MAGIC_15PLUS = players.getProperty("EnchantChanceMagicWeapon15Plus", 0.2); ENCHANT_CHANCE_WEAPON_NONMAGIC = players.getProperty("EnchantChanceNonMagicWeapon", 0.7); ENCHANT_CHANCE_WEAPON_NONMAGIC_15PLUS = players.getProperty("EnchantChanceNonMagicWeapon15Plus", 0.35); +ENCHANT_CHANCE_WEAPON_MAGIC_BLESSED = players.getProperty("EnchantChangeWeaponMagicBlessed", 0.35); +ENCHANT_CHANCE_WEAPON_MAGIC_15PLUS_BLESSED = players.getProperty("EnchantChangeWeaponMagic15PlusBlessed", 0.35); +ENCHANT_CHANCE_WEAPON_NONMAGIC_BLESSED = players.getProperty("EnchantChangeWeaponNonMagicBlessed", 0.35); +ENCHANT_CHANCE_WEAPON_NONMAGIC_15PLUS_BLESSED = players.getProperty("EnchantChangeWeaponNonMagic15PlusBlessed", 0.35); +ENCHANT_CHANCE_WEAPON_NONMAGIC_CRYSTAL = players.getProperty("EnchantChanceWeaponNonMagicCrystal", 0.35); +ENCHANT_CHANCE_WEAPON_NONMAGIC_15PLUS_CRYSTAL = players.getProperty("EnchantChanceWeaponNonMagic15PlusCrystal", 0.35); +ENCHANT_CHANCE_WEAPON_MAGIC_CRYSTAL = players.getProperty("EnchantChanceWeaponMagicCrystal", 0.35); +ENCHANT_CHANCE_WEAPON_MAGIC_15PLUS_CRYSTAL = players.getProperty("EnchantChanceWeaponMagic15PlusCrystal", 0.35); ENCHANT_CHANCE_ARMOR = players.getProperty("EnchantChanceArmor", 0.66); +ENCHANT_CHANCE_ARMOR_BLESSED = players.getProperty("EnchantChanceArmorBlessed", 0.66); +ENCHANT_CHANCE_ARMOR_CRYSTAL = players.getProperty("EnchantChanceArmorCrystal", 0.66); # % chance of success to enchant a non magic weapon with normal scroll EnchantChanceNonMagicWeapon = 0.55 EnchantChanceNonMagicWeapon15Plus = 0.55 + +# % chance of success to enchant a magic weapon with blessed scroll +EnchantChangeWeaponMagicBlessed = 0.75 +EnchantChangeWeaponMagic15PlusBlessed = 0.75 + +# % chance of success to enchant a non magic weapon with blessed scroll +EnchantChangeWeaponNonMagicBlessed = 0.75 +EnchantChangeWeaponNonMagic15PlusBlessed = 0.75 + +# % chance of success to enchant a magic weapon with crystal scroll +EnchantChanceWeaponMagicCrystal = 0.95 +EnchantChanceWeaponMagic15PlusCrystal = 0.95 + +# % chance of success to enchant a non magic weapon with crystal scroll +EnchantChanceWeaponNonMagicCrystal = 0.95 +EnchantChanceWeaponNonMagic15PlusCrystal = 0.95 + # % chance of success for normal scrolls to enchant an armor part (both jewelry or armor) EnchantChanceArmor = 0.66 + +# % chance of success for blessed scrolls to enchant an armor part (both jewelry or armor) +EnchantChanceArmorBlessed = 0.75 + +# % chance of success for crystal scrolls to enchant an armor part (both jewelry or armor) +EnchantChanceArmorCrystal = 0.95 # Enchant limit [default = 0] EnchantMaxWeapon = 0 EnchantMaxArmor = 0 Credits for the original code: Uknown, Credits for the fixes and update to last rev: Psyancy aka TehNeRD
  14. Images Preview: P.S. Preview Images are from the original code for H5 this code is adapted to aCis, it's tested and working! Core Part: [hide] diff --git config/custom.properties config/custom.properties +++ config/custom.properties @@ -0,0 +1,33 @@ +#============================================================= +# Npc Party Teleporter +#============================================================= +# Enable the Character Killing Monuments +# NPC Id +NpcPtTeleporterId= 36613 + +# Teleport coordinates +PtTeleportX = -56781 +PtTeleportY = 140545 +PtTeleportZ = -2629 + +# ZoneId NpcPtZoneID default: 911 +# Select the id of your zone. +# If you dont know how to find your zone id is simple. +# Go to data/zones/(your zone file).xml and find your zone +# E.g: <zone name="dion_monster_pvp" id="6" type="ArenaZone" shape="NPoly" minZ="-3596" maxZ="0"> +NpcPtZoneID = 255 + +# Min party members +NpcPtMinPartyMembers = 2 + +# Consume Item Id +NpcPtConsumeItemId = 57 + +# Consume Item Quantity +NpcPtConsumeItemQt = 100 + +# Show Inside players in zone +NpcPtShowInsidePlayers = True + +# Show Inside Parties in zone +NpcPtShowInsideParties = True \ No newline at end of file diff --git java/net/sf/l2j/Config.java java/net/sf/l2j/Config.java new file mode 100644 index 0000000..477b1a3 --- /dev/null +++ java/net/sf/l2j/Config.java @@ -0,0 +1,1513 @@ + public static final String CUSTOM_FILE = "./config/custom.properties"; + + // -------------------------------------------------- + // Custom settings + // -------------------------------------------------- + public static int NPC_ID_PT_TELEPORTER; + public static int NPC_PT_TELEPORTER_X; + public static int NPC_PT_TELEPORTER_Y; + public static int NPC_PT_TELEPORTER_Z; + public static int NPC_PT_ZONEID; + public static int NPC_PT_MINPT_MEMBERS; + public static int NPC_PT_ITEMCONSUME_ID; + public static int NPC_PT_ITEMCOMSUME_QT; + public static boolean NPC_PT_SHOWINSIDE_PLAYERS; + public static boolean NPC_PT_SHOWINSIDE_PARTIES; + FLOOD_PROTECTOR_SENDMAIL = new FloodProtectorConfig("SendMailFloodProtector"); FLOOD_PROTECTOR_CHARACTER_SELECT = new FloodProtectorConfig("CharacterSelectFloodProtector"); _log.info("Loading gameserver configuration files."); + // Custom settings + ExProperties custom = load(CUSTOM_FILE); + NPC_ID_PT_TELEPORTER = custom.getProperty("NpcPtTeleporterId", 36614); + NPC_PT_TELEPORTER_X = custom.getProperty("PtTeleportX", -56742); + NPC_PT_TELEPORTER_Y = custom.getProperty("PtTeleportY", 140569); + NPC_PT_TELEPORTER_Z = custom.getProperty("PtTeleportZ", -2625); + NPC_PT_ZONEID = custom.getProperty("NpcPtZoneID", 155); + NPC_PT_MINPT_MEMBERS = custom.getProperty("NpcPtMinPartyMembers", 2); + NPC_PT_ITEMCONSUME_ID = custom.getProperty("NpcPtConsumeItemId", 57); + NPC_PT_ITEMCOMSUME_QT = custom.getProperty("NpcPtConsumeItemQt", 100); + NPC_PT_SHOWINSIDE_PLAYERS = custom.getProperty("NpcPtShowInsidePlayers", true); + NPC_PT_SHOWINSIDE_PARTIES = custom.getProperty("NpcPtShowInsideParties", true); + // Clans settings ExProperties clans = load(CLANS_FILE); diff --git java/net/sf/l2j/gameserver/model/actor/instance/L2PartyTeleporterInstance.java java/net/sf/l2j/gameserver/model/actor/instance/L2PartyTeleporterInstance.java +++ java/net/sf/l2j/gameserver/model/actor/instance/L2PartyTeleporterInstance.java @@ -0,0 +1,234 @@ +package net.sf.l2j.gameserver.model.actor.instance; + +import java.util.StringTokenizer; + +import net.sf.l2j.Config; +import net.sf.l2j.gameserver.datatables.ItemTable; +import net.sf.l2j.gameserver.instancemanager.ZoneManager; +import net.sf.l2j.gameserver.model.L2Party; +import net.sf.l2j.gameserver.model.actor.L2Character; +import net.sf.l2j.gameserver.model.actor.template.NpcTemplate; +import net.sf.l2j.gameserver.model.zone.L2ZoneType; +import net.sf.l2j.gameserver.network.serverpackets.ActionFailed; +import net.sf.l2j.gameserver.network.serverpackets.InventoryUpdate; +import net.sf.l2j.gameserver.network.serverpackets.ItemList; +import net.sf.l2j.gameserver.network.serverpackets.NpcHtmlMessage; +import net.sf.l2j.gameserver.network.serverpackets.StatusUpdate; + + +/** + * @author `Heroin Adapter Gandalf PartyTeleporter, Lucas Fernandes + */ +public class L2PartyTeleporterInstance extends L2NpcInstance +{ + private static final int npcid = Config.NPC_ID_PT_TELEPORTER; // npc id + // ------------------------------------- + // Teleport Location Coordinates X,Y,Z. + // Use /loc command in game to find them. + private static final int locationX = Config.NPC_PT_TELEPORTER_X; // npc id + private static final int locationY = Config.NPC_PT_TELEPORTER_Y; // npc id + private static final int locationZ = Config.NPC_PT_TELEPORTER_Z; // npc id + // ------------------------------------- + // ------------------------------------- + // Select the id of your zone. + // If you dont know how to find your zone id is simple. + // Go to data/zones/(your zone file).xml and find your zone + // E.g: <zone name="dion_monster_pvp" id="6" type="ArenaZone" shape="NPoly" minZ="-3596" maxZ="0"> + /** The id of your zone is id="6" */ + /** --------------------------------------------------------------------------- */ + /** WARNING: If your zone does not have any id or your location is not on any zone in data/zones/ folder, you have to add one by your self */ // required to calculate parties & players + /** --------------------------------------------------------------------------- */ + private static final int ZoneId = Config.NPC_PT_ZONEID; // Here you have to set your zone Id + // ------------------------------------- + private static final int MinPtMembers = Config.NPC_PT_MINPT_MEMBERS; // Minimum Party Members Count For Enter on Zone. + private static final int ItemConsumeId = Config.NPC_PT_ITEMCONSUME_ID; // Item Consume id. + private static final int ItemConsumeNum = Config.NPC_PT_ITEMCOMSUME_QT; // Item Consume Am.ount. + private static final boolean ShowPlayersInside = Config.NPC_PT_SHOWINSIDE_PLAYERS; // If you set it true, NPC will show how many players are inside area. + private static final boolean ShowPartiesInside = Config.NPC_PT_SHOWINSIDE_PARTIES; // If you set it true, NPC will show how many parties are inside area. + private static String ItemName = ItemTable.getInstance().getTemplate(ItemConsumeId).getName(); // Item name, Dont Change this + private String htmContent; + + public L2PartyTeleporterInstance(int objectId, NpcTemplate template) + { + super(objectId, template); + } + + @Override + public void onBypassFeedback(L2PcInstance player, String command) + { + player.sendPacket(ActionFailed.STATIC_PACKET); + + StringTokenizer st = new StringTokenizer(command, " "); + String actualCommand = st.nextToken(); // Get actual command + + if (actualCommand.equalsIgnoreCase("partytp")) + { + TP(player); + } + super.onBypassFeedback(player, command); + } + + public int getPartiesInside(int zoneId)// Calculating parties inside party area. + { + int i = 0; + for (L2ZoneType zone : ZoneManager.getInstance().getZones(locationX, locationY, locationZ)) + { + if (zone.getId() == zoneId) + { + for (L2Character character : zone.getCharactersInside()) + { + if ((character instanceof L2PcInstance) && (!((L2PcInstance) character).getClient().isDetached()) && (((L2PcInstance) character).getParty() != null) && ((L2PcInstance) character).getParty().isLeader((L2PcInstance) character)) + { + i++; + } + } + } + } + return i; + } + + public int getPlayerInside(int zoneId)// Calculating players inside party area. + { + int i = 0; + for (L2ZoneType zone : ZoneManager.getInstance().getZones(locationX, locationY, locationZ)) + { + if (zone.getId() == zoneId) + { + for (L2Character character : zone.getCharactersInside()) + { + if ((character instanceof L2PcInstance) && (!((L2PcInstance) character).getClient().isDetached())) + { + i++; + } + } + } + } + return i; + } + + private static boolean PartyItemsOk(L2PcInstance player) + // Checks if all party members have the item in their inventory. + // If pt member has not enough items, party not allowed to enter. + { + try + { + for (L2PcInstance member : player.getParty().getPartyMembers()) + { + if (member.getInventory().getItemByItemId(ItemConsumeId) == null) + + { + player.sendMessage("Your party member " + member.getName() + " does not have enough items."); + return false; + } + if (member.getInventory().getItemByItemId(ItemConsumeId).getCount() < ItemConsumeNum) + { + player.sendMessage("Your party member " + member.getName() + " does not have enough items."); + return false; + } + } + return true; + + } + catch (Exception e) + { + player.sendMessage("Something went wrong try again."); + return true; + } + } + + private static void proccessTP(L2PcInstance player) // Teleporting party members to zone + { + for (L2PcInstance member : player.getParty().getPartyMembers()) + { + member.teleToLocation(locationX, locationY, locationZ, 1);// Location X, Y ,Z + } + } + + private static void TP(L2PcInstance player) // Teleport player & his party + { + try + { + L2Party pt = player.getParty(); + if (pt == null) + { + player.sendMessage("You are not currently on party."); + return; + } + if (!pt.isLeader(player)) + { + player.sendMessage("You are not party leader."); + return; + } + if (pt.getMemberCount() < MinPtMembers) + { + player.sendMessage("You are going to need a bigger party " + "in order to enter party area."); + return; + } + if (!PartyItemsOk(player)) + { + return; + } + proccessTP(player); + for (L2PcInstance ppl : pt.getPartyMembers()) + { + if (ppl.getObjectId() != player.getObjectId()) // Dont send this message to pt leader. + { + ppl.sendMessage("Your party leader asked to teleport on party area!");// Message only to party members + } + ppl.sendMessage(ItemConsumeNum + " " + ItemName + " have been dissapeared.");// Item delete from inventory message + ppl.getInventory().destroyItemByItemId("Party_Teleporter", ItemConsumeId, ItemConsumeNum, ppl, ppl);// remove item from inventory + ppl.sendPacket(new InventoryUpdate());// Update + ppl.sendPacket(new ItemList(ppl, false));// Update + ppl.sendPacket(new StatusUpdate(ppl));// Update + + } + // Sends message to party leader. + player.sendMessage((ItemConsumeNum * player.getParty().getMemberCount()) + " " + ItemName + " dissapeard from your party."); + + } + catch (Exception e) + { + player.sendMessage("Something went wrong try again."); + } + } + + @Override + public void showChatWindow(L2PcInstance player) + { + final int npcId = Config.NPC_ID_PT_TELEPORTER; + if (npcId == npcid) + { + htmContent = "data/html/mods/PartyTeleporter/PartyTeleporter.htm"; + if (htmContent != null) + { + final NpcHtmlMessage npcHtmlMessage = new NpcHtmlMessage(getObjectId()); + npcHtmlMessage.setHtml(htmContent); + npcHtmlMessage.replace("%objectId%", String.valueOf(getObjectId())); + npcHtmlMessage.replace("%player%", player.getName());// Replaces %player% with player name on html + npcHtmlMessage.replace("%itemname%", ItemName);// Item name replace on html + npcHtmlMessage.replace("%price%", player.getParty() != null ? "" + (ItemConsumeNum * player.getParty().getMemberCount()) + "" : "0");// Price calculate replace + npcHtmlMessage.replace("%minmembers%", "" + MinPtMembers);// Mimum entry party members replace + npcHtmlMessage.replace("%allowed%", isAllowedEnter(player) ? "<font color=00FF00>allowed</font>" : "<font color=FF0000>not allowed</font>");// Condition checker replace on html + npcHtmlMessage.replace("%parties%", ShowPartiesInside ? "<font color=FFA500>Parties Inside: " + getPartiesInside(ZoneId) + "</font><br>" : "");// Parties inside + npcHtmlMessage.replace("%players%", ShowPlayersInside ? "<font color=FFA500>Players Inside: " + getPlayerInside(ZoneId) + "</font><br>" : "");// Players Inside + player.sendPacket(npcHtmlMessage); + } + + player.sendPacket(ActionFailed.STATIC_PACKET); + } + } + + private static boolean isAllowedEnter(L2PcInstance player) // Checks if player & his party is allowed to teleport. + { + if (player.getParty() != null) + { + if ((player.getParty().getMemberCount() >= MinPtMembers) && PartyItemsOk(player)) // Party Length & Item Checker + { + return true; + } + return false; + } + return false; + } + +} \ No newline at end of file [/hide] DP Part: [hide] +++ data/html/mods/PartyTeleporter/PartyTeleporter.htm @@ -0,0 +1,21 @@ +<html> +<title>%player%</title> +<body><center> +<center> +You have to be a party leader in order to ask from me to teleport you and your party inside party area.<br> +Minimum number of members in party: <font color="LEVEL">%minmembers%</font>.<br> +You are currently %allowed% to enter party area with your party.<br> +Party teleport will cost you total: <font color="LEVEL">%price% %itemname%</font><br> +</center> +<center> +%parties% +%players% + +<table><tr> +<td><a action="bypass -h npc_%objectId%_partypt">Teleport me & My party!</td> +</tr></table> + + +<br><br> +<center> +</body></html> \ No newline at end of file diff --git data/xml/npcs/36000-36099.xml data/xml/npcs/36000-36099.xml +++ data/xml/npcs/36000-36099.xml @@ -0,0 +1,39 @@ +<?xml version="1.0" encoding="utf-8"?> +<list> + <npc id="36613" name="Hector" title=""> + <set name="level" val="67"/> + <set name="radius" val="8"/> + <set name="height" val="24"/> + <set name="rHand" val="128"/> + <set name="lHand" val="628"/> + <set name="type" val="L2PartyTeleporter"/> + <set name="exp" val="449"/> + <set name="sp" val="1"/> + <set name="hp" val="2295.48154"/> + <set name="mp" val="1251"/> + <set name="hpRegen" val="7.5"/> + <set name="mpRegen" val="2.7"/> + <set name="pAtk" val="624.93199"/> + <set name="pDef" val="281.55251"/> + <set name="mAtk" val="426.74754"/> + <set name="mDef" val="206.02791"/> + <set name="crit" val="4"/> + <set name="atkSpd" val="253"/> + <set name="str" val="40"/> + <set name="int" val="21"/> + <set name="dex" val="30"/> + <set name="wit" val="20"/> + <set name="con" val="43"/> + <set name="men" val="20"/> + <set name="corpseTime" val="7"/> + <set name="walkSpd" val="50"/> + <set name="runSpd" val="195"/> + <set name="dropHerbGroup" val="0"/> + <set name="attackRange" val="40"/> + <ai type="default" ssCount="0" ssRate="0" spsCount="0" spsRate="0" aggro="0" clan="door_clan;mercenary_siege_clan" clanRange="1200" canMove="true" seedable="false"/> + <skills> + <skill id="4045" level="1"/> + <skill id="4416" level="23"/> + </skills> + </npc> + </list> \ No newline at end of file [hide] Credits for the original code `Heroin Adapter Gandalf PartyTeleporter, Lucas Fernandes Enjoy!
  15. Hello members of LordCraft, here is a fix for L2TopZone Vote Reward since they made some new changes. Since topzone changed again , you need to change the code. Use this one to solve your problem. Just the getTopZoneVotes() method (just changed Frozen's one) [hide] protected int getTopZoneVotes() { int votes = -1; URL url = null; URLConnection con = null; InputStream is = null; InputStreamReader isr = null; BufferedReader in = null; try { url = new URL(PowerPakConfig.VOTES_SITE_TOPZONE_URL); con = url.openConnection(); con.addRequestProperty("User-Agent", "L2TopZone"); is = con.getInputStream(); isr = new InputStreamReader(is); in = new BufferedReader(isr); String inputLine; while ((inputLine = in.readLine()) != null) { if (inputLine.contains("thumbs-up")) { int startPosition = inputLine.indexOf("</i>") + "</i>".length(); int endPosition = inputLine.indexOf("</span>", startPosition); String ss = inputLine.substring(startPosition, endPosition); votes = Integer.valueOf(ss); break; } } } catch (final Exception e) { LOGGER.warn("[AutoVoteReward] Server TOPZONE is offline or something is wrong in link"); Announcements.getInstance().gameAnnounceToAll("[AutoVoteReward] TOPZONE is offline. We will check reward as it will be online again"); // e.printStackTrace(); } finally { if (in != null) try { in.close(); } catch (final IOException e1) { e1.printStackTrace(); } if (isr != null) try { isr.close(); } catch (final IOException e1) { e1.printStackTrace(); } if (is != null) try { is.close(); } catch (final IOException e1) { e1.printStackTrace(); } } return votes; } [/hide]
  16. hi all need Code Ant Dual Box L2JACIS plis
  17. Hello members of LordCraft, here is a code for anti drain mobs. You can edit for mages or fighters (hits or spells). ### Eclipse Workspace Patch 1.0 #P Chr.6GMS Index: java/net/sf/l2j/gameserver/model/actor/instance/L2PcInstance.java =================================================================== --- java/net/sf/l2j/gameserver/model/actor/instance/L2PcInstance.java (revision 5263) +++ java/net/sf/l2j/gameserver/model/actor/instance/L2PcInstance.java (working copy) @@ -238,6 +238,8 @@ public static final int STORE_PRIVATE_BUY = 3; public static final int STORE_PRIVATE_MANUFACTURE = 5; public static final int STORE_PRIVATE_PACKAGE_SELL = 8; + + private int[] drainIds = {0,25,2}; /** The table containing all minimum level needed for each Expertise (None, D, C, B, A, S)*/ private static final int[] EXPERTISE_LEVELS = @@ -284,6 +286,21 @@ public void doCast(L2Skill skill) { super.doCast(skill); + + //--Cannot use drain skills in mobs-- + L2Object target = getTarget(); + L2MonsterInstance m = null; + if(target instanceof L2MonsterInstance) + m = (L2MonsterInstance) target; + if(m != null && getPvpFlag() > 0){ + for(int i=0; i < drainIds.length; i ++) + { + if(skill.getId() == drainIds[i]){ + sendMessage("You can't drain hp from mobs"); + return; + } + } + } // cancel the recent fake-death protection instantly if the player attacks or casts spells getPlayer().setRecentFakeDeath(false); Credits: Zeus
×
×
  • Create New...