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


Categories

  • Lineage II Server Packs [Java]
  • Lineage II Server Packs [PTS]
  • Lineage II Server Scripts
  • Lineage II Client Scripts
  • Lineage II Items & Chars
  • Website Templates
  • DenArt Designs's Demo Updater

Forums

  • General Zone
    • Announcements and News
    • Newbies Introduce Urself
    • Maxcheaters Competitions & Events
    • Votes/Polls Area
    • Report Section
    • Downloads Section
  • Lineage II General Section
    • General Discussion [English]
    • Request Support [English]
  • Lineage II Hacks,Cheats and Bots
    • Hacks & Cheats [English]
    • Request Hacks & Cheats [English]
    • Botting [English]
    • Request Botting [English]
  • Lineage II Private Servers
    • The Final High Five by L2Tales.com [x12] - Launches 2nd November at 21:00 GMT+2
    • Private Servers
    • Buy Advertising Link #2
    • [Previews] L2 Private Servers
    • Clans and Alliances
  • Lineage II Marketplace
    • Marketplace [Items & Chars]
    • Marketplace [L2Packs & Files]
    • Marketplace [Powerlvl & Support]
  • Lineage II OFF Server Development
    • Server Development Discussion [L2OFF]
    • Request Server Development Help [L2OFF]
    • Server Shares & Files [L2OFF]
  • Lineage II Java Server Development
    • Server Development Discussion [L2J]
    • Request Server Development Help [L2J]
    • Server Shares & Files [L2J]
    • Private Projects [L2J]
  • Lineage II Client Development
    • Client Development Discussion
  • MMO Games
    • League of Legends
    • World Of Warcraft Area
    • Other Multiplayer Games
  • General Section
    • General Marketplace
    • Consoles/Mobiles/PDA Gaming Zone
    • Webmasters Zone
    • Hacking/Coding Zone
  • Graphics/GFX Zone
    • Graphics/GFX General Discussion
    • Graphics/GFX Showcase
    • Graphics/GFX Resources/Tools
  • VIP/SVIP/Donators Zone
    • VIPs/Donators Discussion
    • VIPs Lineage II
    • VIPs [GFX] Zone
    • VIPs Download Area
  • MaxCheaters Corner
    • Tech/World News
    • Off-Topics
    • Spam Topics
  • TEST's Topics
  • L2Classic Club's Just trying this thing out
  • Lineage 2 Revolution Club's Discussions
  • Lineage 2 Revolution Club's Tutorials
  • Lineage 2 Revolution Club's Request Help
  • DenArt Designs's Hello and welcome to my club!
  • DenArt Designs's News

Product Groups

  • Advertisements
  • Special Groups

Find results in...

Find results that contain...


Date Created

  • Start

    End


Last Updated

  • Start

    End


Filter by number of...

Joined

  • Start

    End


Group


AIM


MSN


Website URL


ICQ


Yahoo


Jabber


Skype


Location


Interests

Found 40 results

  1. Long time since i shared something. I made this code in 10 minute. It's a Procedural PvP reward system which you can extend and add anything you like. Basically each time a player get a PvP, system check if he can get any reward (Item, Color, Skill) and reward him. It has protection to avoid duplicated rewards in case he reduce his PvP and repeat the procedure. Index: java/kara/PvPData.java =================================================================== --- java/kara/PvPData.java (revision 0) +++ java/kara/PvPData.java (revision 0) @@ -0,0 +1,140 @@ +/* + * Copyright (C) 2004-2018 L2J Server + * + * This file is part of L2J Server. + * + * L2J Server 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. + * + * L2J Server 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 kara; + +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +import org.w3c.dom.Document; +import org.w3c.dom.NamedNodeMap; +import org.w3c.dom.Node; + +import com.l2jserver.Config; +import com.l2jserver.gameserver.model.actor.instance.L2PcInstance; +import com.l2jserver.gameserver.model.variables.PlayerVariables; +import com.l2jserver.util.data.xml.IXmlReader; + +import kara.model.PEvent; +import kara.model.events.PvPColor; +import kara.model.events.PvPReward; + +/** + * @author Kara` + */ +public class PvPData implements IXmlReader +{ + final Map<Integer, List<PEvent>> HOLDER = new HashMap<>(); + + public PvPData() + { + load(); + } + + @Override + public void load() + { + HOLDER.clear(); + parseDatapackFile(Config.DATAPACK_ROOT + "data/pvpData"); + LOGGER.info("[" + PvPData.class.getName() + "] Loaded " + HOLDER.size() + " holders."); + } + + @Override + public void parseDocument(Document doc) + { + for (Node d = doc.getFirstChild(); d != null; d = d.getNextSibling()) + { + if (d.getNodeName().equals("list")) + { + for (Node holder = d.getFirstChild(); holder != null; holder = holder.getNextSibling()) + { + if (holder.getNodeName().equals("holder")) + { + List<PEvent> list = new ArrayList<>(); + + for (Node pevent = holder.getFirstChild(); pevent != null; pevent = pevent.getNextSibling()) + { + NamedNodeMap attr = pevent.getAttributes(); + + try + { + if (pevent.getNodeName().equals("color")) + { + list.add(new PvPColor(Integer.parseInt(attr.getNamedItem("r").getNodeValue()), Integer.parseInt(attr.getNamedItem("g").getNodeValue()), Integer.parseInt(attr.getNamedItem("b").getNodeValue()))); + } + if (pevent.getNodeName().equals("item")) + { + list.add(new PvPReward(Integer.parseInt(attr.getNamedItem("id").getNodeValue()), Integer.parseInt(attr.getNamedItem("count").getNodeValue()))); + } + if (pevent.getNodeName().equals("skill")) + { + list.add(new PvPReward(Integer.parseInt(attr.getNamedItem("id").getNodeValue()), Integer.parseInt(attr.getNamedItem("level").getNodeValue()))); + } + } + catch (Exception e) + { + e.printStackTrace(); + continue; + } + } + + HOLDER.put(Integer.parseInt(holder.getAttributes().getNamedItem("require").getNodeValue()), list); + } + } + } + } + } + + /** + * Check if player has any given rewards. <br> + * Info: if player decreased pvp somehow he <b> wont </b> receive. + * @param player + */ + public void executeEvent(L2PcInstance player) + { + PlayerVariables variables = player.getVariables(); + + if (variables.getInt("lastPvP", 0) >= player.getPvpKills()) + { + return; + } + + List<PEvent> list = HOLDER.get(player.getPvpKills()); + + if (list == null) + { + return; + } + + variables.set("lastPvP", player.getPvpKills()); + + list.forEach(s -> s.getEffect(player)); + } + + public static PvPData getInstance() + { + return SingletonHolder._instance; + } + + private static class SingletonHolder + { + protected static final PvPData _instance = new PvPData(); + } +} \ No newline at end of file Index: java/kara/model/PEvent.java =================================================================== --- java/kara/model/PEvent.java (revision 0) +++ java/kara/model/PEvent.java (revision 0) @@ -0,0 +1,31 @@ +/* + * Copyright (C) 2004-2018 L2J Server + * + * This file is part of L2J Server. + * + * L2J Server 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. + * + * L2J Server 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 kara.model; + +import com.l2jserver.gameserver.model.actor.instance.L2PcInstance; + +/** + * @author Kara` + */ +public abstract class PEvent +{ + protected Object[] values; + + public abstract void getEffect(L2PcInstance player); +} Index: java/kara/model/events/PvPColor.java =================================================================== --- java/kara/model/events/PvPColor.java (revision 0) +++ java/kara/model/events/PvPColor.java (revision 0) @@ -0,0 +1,48 @@ +/* + * Copyright (C) 2004-2018 L2J Server + * + * This file is part of L2J Server. + * + * L2J Server 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. + * + * L2J Server 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 kara.model.events; + +import com.l2jserver.gameserver.model.actor.instance.L2PcInstance; + +import kara.model.PEvent; + +/** + * @author Kara` + */ +public class PvPColor extends PEvent +{ + public PvPColor(int r, int g, int b) + { + values = new Object[] + { + 3 + }; + + values[0] = r; + values[1] = g; + values[2] = b; + } + + @Override + public void getEffect(L2PcInstance player) + { + player.getAppearance().setNameColor((int) values[0], (int) values[1], (int) values[2]); + player.broadcastUserInfo(); + } +} Index: java/kara/model/events/PvPReward.java =================================================================== --- java/kara/model/events/PvPReward.java (revision 0) +++ java/kara/model/events/PvPReward.java (revision 0) @@ -0,0 +1,46 @@ +/* + * Copyright (C) 2004-2018 L2J Server + * + * This file is part of L2J Server. + * + * L2J Server 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. + * + * L2J Server 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 kara.model.events; + +import com.l2jserver.gameserver.model.actor.instance.L2PcInstance; + +import kara.model.PEvent; + +/** + * @author Kara` + */ +public class PvPReward extends PEvent +{ + public PvPReward(int id, int count) + { + values = new Object[] + { + 2 + }; + + values[0] = id; + values[1] = count; + } + + @Override + public void getEffect(L2PcInstance player) + { + player.addItem("Reward", (int) values[0], (int) values[1], player, true); + } +} Index: java/kara/model/events/PvPSkill.java =================================================================== --- java/kara/model/events/PvPSkill.java (revision 0) +++ java/kara/model/events/PvPSkill.java (revision 0) @@ -0,0 +1,44 @@ +/* + * Copyright (C) 2004-2018 L2J Server + * + * This file is part of L2J Server. + * + * L2J Server 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. + * + * L2J Server 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 kara.model.events; + +import com.l2jserver.gameserver.datatables.SkillData; +import com.l2jserver.gameserver.model.actor.instance.L2PcInstance; +import com.l2jserver.gameserver.model.skills.Skill; + +import kara.model.PEvent; + +/** + * @author Kara` + */ +public class PvPSkill extends PEvent +{ + public PvPSkill(int id, int level) + { + values = new Object[] + { + 2 + }; + + values[0] = id; + values[1] = level; + } + @Override + public void getEffect(L2PcInstance player) + { + Skill skill = SkillData.getInstance().getSkill((int) values[0], (int) values[1]); + + if (skill == null) + { + return; + } + + player.addSkill(skill); + } +} Xml: <!-- TODO : That minions need to be moved in spawn system when is done! --> <list xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="xsd/pvpData.xsd"> <!-- Created by Kara` --> <holder require="10"> <color r="80" g="212" b="168" /> <item id="57" count="100000000" /> <skill id="6393" level="1" /> </holder> <holder require="30"> <color r="120" g="120" b="168" /> <item id="6393" count="100" /> <skill id="6393" level="1" /> </holder> </list> How to use it? It's pretty simple: In GameServer.java somewhere add the following line: To use it just go in the L2PcInstance.java and find the method that increasePvpKills and somewhere inside add the Hope you like it. PS. Coded for L2J-H5
  2. Kalhspera. edw pera ine 1 donate manager. apo ton l2sayn to exw vgalei kai to dinw se esas. parakalw mhn krazete. :D Code: http://pastebin.com/tuWcQAXQ EDIT: 3exasa na valw to name sto Instance. valte L2DonateShopInstance (ADAPTED FOR L2JACIS http://pastebin.com/6d9P4wm1 ) by member l2jkain SCREENSHOTS Download: Gia na doulepsi to code prepei na valete auta ta arxia. Click Me Diavaste to ReadMe.txt To sql uparxi sto arxio. To Donate Coin exei id 1704 Ean vgalei kapoio provlima kalo einai na kanete 1 post se auto to topic gia na to checkarw. :) Doulevei sto l2jfrozen last rev. twra gia prohgoumena den 3erw. :D UPDATED** //augment command http://www.maxcheaters.com/topic/207755-l2jfrozen-augment-command/ CREDITS: fofas
  3. Hello guys, nothing special but it's not shared here this code for IL and a lot of people don't know how to do it since i added it on my project yesterday i decided to share it here with you. Here is preview images: Go to net.sf.l2j.gameserver.model.actor.L2Npc.java find: @Override public void onActionShift(L2PcInstance player) { // Check if the L2PcInstance is a GM if (player.isGM()) { final NpcHtmlMessage html = new NpcHtmlMessage(getObjectId()); html.setFile("data/html/admin/npcinfo.htm"); html.replace("%class%", getClass().getSimpleName()); html.replace("%id%", getTemplate().getNpcId()); html.replace("%lvl%", getTemplate().getLevel()); html.replace("%name%", getTemplate().getName()); html.replace("%race%", getTemplate().getRace().toString()); html.replace("%tmplid%", getTemplate().getIdTemplate()); html.replace("%aggro%", (this instanceof L2Attackable) ? ((L2Attackable) this).getAggroRange() : 0); html.replace("%corpse%", getTemplate().getCorpseTime()); html.replace("%enchant%", getTemplate().getEnchantEffect()); html.replace("%hp%", (int) getCurrentHp()); html.replace("%hpmax%", getMaxHp()); html.replace("%mp%", (int) getCurrentMp()); html.replace("%mpmax%", getMaxMp()); html.replace("%patk%", getPAtk(null)); html.replace("%matk%", getMAtk(null, null)); html.replace("%pdef%", getPDef(null)); html.replace("%mdef%", getMDef(null, null)); html.replace("%accu%", getAccuracy()); html.replace("%evas%", getEvasionRate(null)); html.replace("%crit%", getCriticalHit(null, null)); html.replace("%rspd%", getRunSpeed()); html.replace("%aspd%", getPAtkSpd()); html.replace("%cspd%", getMAtkSpd()); html.replace("%str%", getSTR()); html.replace("%dex%", getDEX()); html.replace("%con%", getCON()); html.replace("%int%", getINT()); html.replace("%wit%", getWIT()); html.replace("%men%", getMEN()); html.replace("%loc%", getX() + " " + getY() + " " + getZ()); html.replace("%dist%", (int) Math.sqrt(player.getDistanceSq(this))); html.replace("%ele_fire%", getDefenseElementValue((byte) 2)); html.replace("%ele_water%", getDefenseElementValue((byte) 3)); html.replace("%ele_wind%", getDefenseElementValue((byte) 1)); html.replace("%ele_earth%", getDefenseElementValue((byte) 4)); html.replace("%ele_holy%", getDefenseElementValue((byte) 5)); html.replace("%ele_dark%", getDefenseElementValue((byte) 6)); if (getSpawn() != null) { html.replace("%spawn%", getSpawn().getLocx() + " " + getSpawn().getLocy() + " " + getSpawn().getLocz()); html.replace("%loc2d%", (int) Math.sqrt(getPlanDistanceSq(getSpawn().getLocx(), getSpawn().getLocy()))); html.replace("%loc3d%", (int) Math.sqrt(getDistanceSq(getSpawn().getLocx(), getSpawn().getLocy(), getSpawn().getLocz()))); html.replace("%resp%", getSpawn().getRespawnDelay() / 1000); html.replace("%rand_resp%", getSpawn().getRandomRespawnDelay()); } else { html.replace("%spawn%", "<font color=FF0000>null</font>"); html.replace("%loc2d%", "<font color=FF0000>--</font>"); html.replace("%loc3d%", "<font color=FF0000>--</font>"); html.replace("%resp%", "<font color=FF0000>--</font>"); html.replace("%rand_resp%", "<font color=FF0000>--</font>"); } if (hasAI()) { html.replace("%ai_intention%", "<font color=\"LEVEL\">Intention</font><table width=\"100%\"><tr><td><font color=\"LEVEL\">Intention:</font></td><td>" + getAI().getIntention().name() + "</td></tr>"); html.replace("%ai%", "<tr><td><font color=\"LEVEL\">AI:</font></td><td>" + getAI().getClass().getSimpleName() + "</td></tr></table><br>"); } else { html.replace("%ai_intention%", ""); html.replace("%ai%", ""); } html.replace("%ai_type%", getAiType().name()); html.replace("%ai_clan%", (getClans() != null) ? "<tr><td width=100><font color=\"LEVEL\">Clan:</font></td><td align=right width=170>" + Arrays.toString(getClans()) + " " + getClanRange() + "</td></tr>" + ((getIgnoredIds() != null) ? "<tr><td width=100><font color=\"LEVEL\">Ignored ids:</font></td><td align=right width=170>" + Arrays.toString(getIgnoredIds()) + "</td></tr>" : "") : ""); html.replace("%ai_move%", String.valueOf(canMove())); html.replace("%ai_seed%", String.valueOf(isSeedable())); html.replace("%ai_ssinfo%", _currentSsCount + "[" + getSsCount() + "] - " + getSsRate() + "%"); html.replace("%ai_spsinfo%", _currentSpsCount + "[" + getSpsCount() + "] - " + getSpsRate() + "%"); html.replace("%butt%", ((this instanceof L2MerchantInstance) ? "<button value=\"Shop\" action=\"bypass -h admin_show_shop " + getNpcId() + "\" width=65 height=19 back=\"L2UI_ch3.smallbutton2_over\" fore=\"L2UI_ch3.smallbutton2\">" : "")); player.sendPacket(html); player.sendPacket(ActionFailed.STATIC_PACKET); } Below add: else if (Config.ENABLE_SHIFT_CLICK_TO_NPCS) { final NpcHtmlMessage html = new NpcHtmlMessage(getObjectId()); html.setFile("data/html/mods/npcinfo.htm"); html.replace("%class%", getClass().getSimpleName()); html.replace("%id%", getTemplate().getNpcId()); html.replace("%lvl%", getTemplate().getLevel()); html.replace("%name%", getTemplate().getName()); html.replace("%race%", getTemplate().getRace().toString()); html.replace("%tmplid%", getTemplate().getIdTemplate()); html.replace("%aggro%", getTemplate().getAggroRange()); html.replace("%corpse%", StringUtil.getTimeStamp(getTemplate().getCorpseTime())); html.replace("%enchant%", getTemplate().getEnchantEffect()); html.replace("%hp%", (int) getCurrentHp()); html.replace("%hpmax%", getMaxHp()); html.replace("%mp%", (int) getCurrentMp()); html.replace("%mpmax%", getMaxMp()); html.replace("%patk%", getPAtk(null)); html.replace("%matk%", getMAtk(null, null)); html.replace("%pdef%", getPDef(null)); html.replace("%mdef%", getMDef(null, null)); html.replace("%accu%", getAccuracy()); html.replace("%evas%", getEvasionRate(null)); html.replace("%crit%", getCriticalHit(null, null)); html.replace("%rspd%", getWalkSpeed()); html.replace("%aspd%", getPAtkSpd()); html.replace("%cspd%", getMAtkSpd()); player.sendPacket(html); } Now the Configs public static boolean ENABLE_SHIFT_CLICK_TO_NPCS; ENABLE_SHIFT_CLICK_TO_NPCS = npcs.getProperty("EnableShiftClickToNpcs", false); # ============================================= # Shift + Click to NPC(s) # ============================================= # Enable showing NPC(s) info by Shift + Click # on NPC(s)? # Default: False EnableShiftClickToNpcs = True The voicedcommand Create new class called ShiftClickToNpc inside paste /* * 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.voicedcommandhandlers; import java.util.StringTokenizer; import net.sf.l2j.commons.lang.StringUtil; import net.sf.l2j.gameserver.datatables.ItemTable; import net.sf.l2j.gameserver.datatables.NpcTable; import net.sf.l2j.gameserver.handler.IVoicedCommandHandler; import net.sf.l2j.gameserver.model.actor.instance.L2PcInstance; import net.sf.l2j.gameserver.model.actor.template.NpcTemplate; import net.sf.l2j.gameserver.model.item.DropCategory; import net.sf.l2j.gameserver.model.item.DropData; import net.sf.l2j.gameserver.network.serverpackets.NpcHtmlMessage; /** * @author Designatix * */ public class ShiftClickToNpc implements IVoicedCommandHandler { private static final int PAGE_LIMIT = 20; private static String[] _voicedCommands = { "show_droplist" }; @Override public boolean useVoicedCommand(String command, L2PcInstance activeChar, String target) { final StringTokenizer st = new StringTokenizer(command, " "); st.nextToken(); if (command.startsWith("show_droplist")) { try { int npcId = Integer.parseInt(st.nextToken()); int page = (st.hasMoreTokens()) ? Integer.parseInt(st.nextToken()) : 1; showNpcDropList(activeChar, npcId, page); } catch (Exception e) { activeChar.sendMessage("Usage: .show_droplist <npc_id> [<page>]"); } } return true; } private static void showNpcDropList(L2PcInstance activeChar, int npcId, int page) { final NpcTemplate npcData = NpcTable.getInstance().getTemplate(npcId); if (npcData == null) { activeChar.sendMessage("Npc template is unknown for id: " + npcId + "."); return; } final StringBuilder sb = new StringBuilder(2000); StringUtil.append(sb, "<html><title>Show droplist page ", page, "</title><body><center><font color=\"LEVEL\">", npcData.getName(), " (", npcId, ")</font></center><br>"); if (!npcData.getDropData().isEmpty()) { sb.append("Drop type legend: <font color=\"3BB9FF\">Drop</font> | <font color=\"00ff00\">Sweep</font><br><table><tr><td width=25>cat.</td><td width=45>item</td><td width=45>drop count</td></tr>"); int myPage = 1; int i = 0; int shown = 0; boolean hasMore = false; for (DropCategory cat : npcData.getDropData()) { if (shown == PAGE_LIMIT) { hasMore = true; break; } for (DropData drop : cat.getAllDrops()) { if (myPage != page) { i++; if (i == PAGE_LIMIT) { myPage++; i = 0; } continue; } if (shown == PAGE_LIMIT) { hasMore = true; break; } StringUtil.append(sb, "<tr><td><font color=\"", ((cat.isSweep()) ? "00FF00" : "3BB9FF"), "\">", cat.getCategoryType(), "</td><td>", ItemTable.getInstance().getTemplate(drop.getItemId()).getName(), " (", drop.getMinDrop(), ", ", drop.getMaxDrop(), ")</td></tr>"); shown++; } } sb.append("</table><table width=\"100%\" bgcolor=666666><tr>"); if (page > 1) { StringUtil.append(sb, "<td width=120><a action=\"bypass -h voiced_show_droplist ", npcId, " ", page - 1, "\">Prev Page</a></td>"); if (!hasMore) StringUtil.append(sb, "<td width=100>Page ", page, "</td><td width=70></td></tr>"); } if (hasMore) { if (page <= 1) sb.append("<td width=120></td>"); StringUtil.append(sb, "<td width=100>Page ", page, "</td><td width=70><a action=\"bypass -h voiced_show_droplist ", npcId, " ", page + 1, "\">Next Page</a></td></tr>"); } sb.append("</table>"); } else sb.append("This NPC has no drops."); sb.append("</body></html>"); final NpcHtmlMessage html = new NpcHtmlMessage(0); html.setHtml(sb.toString()); activeChar.sendPacket(html); } @Override public String[] getVoicedCommandList() { return _voicedCommands; } } Import the voicedcommand on net.sf.l2j.gameserver.handler.VoicedCommandHandler.java import net.sf.l2j.gameserver.handler.voicedcommandhandlers.ShiftClickToNpc; if (Config.ENABLE_SHIFT_CLICK_TO_NPCS) { registerHandler(new ShiftClickToNpc()); } And now go to your dp > data/html/mods and create new file called npcinfo.htm and inside paste <html><title>NPC Info</title><body> <center> <table width="100%"> <tr> <td align=center> <button value="Show Droplist" action="bypass -h voiced_show_droplist %id%" width=134 height=21 back="L2UI_ch3.BigButton3_over" fore="L2UI_ch3.BigButton3"> </td> </tr> </table> <br><img src="L2UI.SquareWhite" width=260 height=1><br> <font color="LEVEL">General Informations</font> <table width="100%"> <tr><td><font color="LEVEL">Name:</font></td><td>%name%</td></tr> <tr><td><font color="LEVEL">Level:</font></td><td>%lvl%</td></tr> <tr><td><font color="LEVEL">Type:</font></td><td>%class%</td></tr> <tr><td><font color="LEVEL">Race:</font></td><td>%race%</td></tr> </table><br> <font color="LEVEL">Aggro Informations</font> <table width="100%"> <tr><td width=100><font color="LEVEL">Aggro:</font></td><td align=right width=170>%aggro%</td></tr> </table><br> <font color="LEVEL">Combat Informations</font> <table width="100%"> <tr><td><font color="LEVEL">HP:</font></td><td><font color=FF4040>%hp%/%hpmax%</font></td><td><font color="LEVEL">MP:</font></td><td><font color=6161FF>%mp%/%mpmax%</font></td></tr> <tr><td>P.Atk.</td><td>%patk%</td><td>M.Atk.</td><td>%matk%</td></tr> <tr><td>P.Def.</td><td>%pdef%</td><td>M.Def.</td><td>%mdef%</td></tr> <tr><td>Accuracy</td><td>%accu%</td><td>Evasion</td><td>%evas%</td></tr> <tr><td>Critical</td><td>%crit%</td><td>Speed</td><td>%rspd%</td></tr> <tr><td>Atk.Spd</td><td>%aspd%</td><td>Cast.Spd</td><td>%cspd%</td></tr> </table><br> <br><img src="L2UI.SquareWhite" width=260 height=1><br> </center> </body></html> Have Fun!
  4. Hello there.. Here is my buffer from my old server.. (Main html made by prwtoftw) What's inside? Mage | Fighter set [config] Buffs/Dance/Song/Extra etc one by one Special buffs + Malaria Vote buff [If you want it, you can enable it, config] Scheme Buffer Code Preview > [Hidden Content] Code/HTML/XML > [Hidden Content]
  5. Hello there.. Here is my Epic Boss Manager from my old server. Nothing special, but some of you may need it. What's inside? Works only with retail Grandbosses. [No retail zaken id] Inform you about the status of Grandboss. Inform you about respawn time. Date/Time. Enable/Disable it on configs. # Announce Grandboss status. # Ex: If status for Antharas/Valakas/Frintezza change to 2 player get announce: # Grandboss>name is engaged in battle. # If status changed to 3: Grandbossname has been killed. Type .epic for details! # For Baium if status change to 1 - Baium is awake and fighting. # All Grandboses respawned - Grandbossname is spawned in the world! AnnounceGrandBossStatus = True [Hidden Content]
  6. Hello people! Heres the code for automatic starting items equip on character 1rst login. Into java/net/sf/l2j/gameserver/network/clientpackets/CharacterCreate.java Find these lines: if (item.isEquipable()) { if (player.getActiveWeaponItem() == null || !(item.getItem().getType2() != Item.TYPE2_WEAPON)) player.getInventory().equipItemAndRecord(item); } and change them like this: if (item.isEquipable()) { if (item.isWeapon()) { if (player.getActiveWeaponItem() == null || !(item.getItem().getType2() != Item.TYPE2_WEAPON)) player.getInventory().equipItemAndRecord(item); } else player.getInventory().equipItemAndRecord(item); } The starting items are selected by the .xml files for player classes. Hope thats is usefull for someone. Cheers! Credits: @Tryskell
  7. Hello guys, Before 4-5 months i created a script for a new raid in order to avoid all classic raids that are really boring... It isn't something special, but i always like different and unusual things... Plagueseeker Raid Starting with some special cameras while all players are paralyzed. When the broadcast end, the following features stands there: action task every 2 seconds: There is 20% chance to 'debuff' a random player if is healer class Debuffs: 20% chance for 15% chance for 10% chance for 50% chance for There is 5% chance to 1) Spawn some minions when the hp of the raid is lower than 40% in order to protect the raid boss (can be happened unlimited times with chance 5%). Minions will suicide after 10 seconds after the spawn time if not get killed. 2) Pick a random target and kill him instant. When the hp of the raid is lower than 50% Broadcast again some special cameras (while players are paralyzed again), an earthquake for 5 seconds and instant kill 10 random players around the raid in 700 radius (can be happened only 1 time). inactivity task If the raid boss not attacked for more than 15 minutes, all players are going back and raid will be deleted. * All the above features are meant to be used in a boss zone ( i used 150000 as a custom one in my pack). Any feature wont work outside of the zone, I wont share any thing like that since its just c/p. * Its your responsibility to use the necessary checks in order to avoid bugs like move the raid out of zone. I coded for me at coliseum with doors closed. Also you have to set by urself how the raid will be spawned (i was about to code the spawn thing but i dont remember why i didnt). I used //spawn just for the video . Code: [Hidden Content] Coded (if i remember well) in acis 370. Note: If you want to expand it or understand how a script can be coded, check this topic (if any other post is related to scripts and have informations post it)
  8. This is the balancer that exists on L2JHellas adapted for aCis ;p I saw a guy that was looking for this some hours ago and i give a try on this :) create a new package Extensions.Balancer inside create this 3 files /* * 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 Extensions.Balancer; import java.sql.Connection; import java.sql.PreparedStatement; import java.sql.ResultSet; import net.sf.l2j.L2DatabaseFactory; /** * @author Anarchy */ public class BalanceLoad { public static int[] Evasion = new int[31], Accuracy = new int[31], Speed = new int[31], PAtk = new int[31], MAtk = new int[31], PDef = new int[31], MDef = new int[31], HP = new int[31], CP = new int[31], MP = new int[31], MAtkSpd = new int[31], PAtkSpd = new int[31]; public static void LoadEm() { int z; for (z = 0; z < 31; z++) { Evasion[z] = loadEvasion(88 + z); Speed[z] = loadSpeed(z + 88); MAtk[z] = loadMAtk(z + 88); PAtk[z] = loadPAtk(z + 88); PDef[z] = loadPDef(z + 88); MDef[z] = loadMDef(z + 88); HP[z] = loadHP(z + 88); CP[z] = loadCP(z + 88); MP[z] = loadMP(z + 88); MAtkSpd[z] = loadMAtkSpd(z + 88); PAtkSpd[z] = loadPAtkSpd(z + 88); } } public static int loadEvasion(int classId) { int i = 0; try (Connection con = L2DatabaseFactory.getInstance().getConnection()) { PreparedStatement stm = con.prepareStatement("SELECT ev FROM balance WHERE class_id=" + classId); ResultSet rset = stm.executeQuery(); if (rset.next()) { i = rset.getInt("ev"); } stm.close(); } catch (Exception e) { System.err.println("Error while loading balance stats from database."); e.printStackTrace(); } return i; } public static int loadAccuracy(int classId) { int i = 0; try (Connection con = L2DatabaseFactory.getInstance().getConnection()) { PreparedStatement stm = con.prepareStatement("SELECT acc FROM balance WHERE class_id=" + classId); ResultSet rset = stm.executeQuery(); if (rset.next()) { i = rset.getInt("acc"); } stm.close(); } catch (Exception e) { System.err.println("Error while loading balance stats from database."); e.printStackTrace(); } return i; } public static int loadSpeed(int classId) { int i = 0; try (Connection con = L2DatabaseFactory.getInstance().getConnection()) { PreparedStatement stm = con.prepareStatement("SELECT walk FROM balance WHERE class_id=" + classId); ResultSet rset = stm.executeQuery(); if (rset.next()) { i = rset.getInt("walk"); } stm.close(); } catch (Exception e) { System.err.println("Error while loading balance stats from database."); e.printStackTrace(); } return i; } public static int loadPAtk(int classId) { int i = 0; try (Connection con = L2DatabaseFactory.getInstance().getConnection()) { PreparedStatement stm = con.prepareStatement("SELECT patk FROM balance WHERE class_id=" + classId); ResultSet rset = stm.executeQuery(); if (rset.next()) { i = rset.getInt("patk"); } stm.close(); } catch (Exception e) { System.err.println("Error while loading balance stats from database."); e.printStackTrace(); } return i; } public static int loadMAtk(int classId) { int i = 0; try (Connection con = L2DatabaseFactory.getInstance().getConnection()) { PreparedStatement stm = con.prepareStatement("SELECT matk FROM balance WHERE class_id=" + classId); ResultSet rset = stm.executeQuery(); if (rset.next()) { i = rset.getInt("matk"); } stm.close(); } catch (Exception e) { System.err.println("Error while loading balance stats from database."); e.printStackTrace(); } return i; } public static int loadPDef(int classId) { int i = 0; try (Connection con = L2DatabaseFactory.getInstance().getConnection()) { PreparedStatement stm = con.prepareStatement("SELECT pdef FROM balance WHERE class_id=" + classId); ResultSet rset = stm.executeQuery(); if (rset.next()) { i = rset.getInt("pdef"); } stm.close(); } catch (Exception e) { System.err.println("Error while loading balance stats from database."); e.printStackTrace(); } return i; } public static int loadMDef(int classId) { int i = 0; try (Connection con = L2DatabaseFactory.getInstance().getConnection()) { PreparedStatement stm = con.prepareStatement("SELECT mdef FROM balance WHERE class_id=" + classId); ResultSet rset = stm.executeQuery(); if (rset.next()) { i = rset.getInt("mdef"); } stm.close(); } catch (Exception e) { System.err.println("Error while loading balance stats from database."); e.printStackTrace(); } return i; } public static int loadHP(int classId) { int i = 0; try (Connection con = L2DatabaseFactory.getInstance().getConnection()) { PreparedStatement stm = con.prepareStatement("SELECT hp FROM balance WHERE class_id=" + classId); ResultSet rset = stm.executeQuery(); if (rset.next()) { i = rset.getInt("hp"); } stm.close(); } catch (Exception e) { System.err.println("Error while loading balance stats from database."); e.printStackTrace(); } return i; } public static int loadCP(int classId) { int i = 0; try (Connection con = L2DatabaseFactory.getInstance().getConnection()) { PreparedStatement stm = con.prepareStatement("SELECT cp FROM balance WHERE class_id=" + classId); ResultSet rset = stm.executeQuery(); if (rset.next()) { i = rset.getInt("cp"); } stm.close(); } catch (Exception e) { System.err.println("Error while loading balance stats from database."); e.printStackTrace(); } return i; } public static int loadMP(int classId) { int i = 0; try (Connection con = L2DatabaseFactory.getInstance().getConnection()) { PreparedStatement stm = con.prepareStatement("SELECT mp FROM balance WHERE class_id=" + classId); ResultSet rset = stm.executeQuery(); if (rset.next()) { i = rset.getInt("mp"); } stm.close(); } catch (Exception e) { System.err.println("Error while loading balance stats from database."); e.printStackTrace(); } return i; } public static int loadMAtkSpd(int classId) { int i = 0; try (Connection con = L2DatabaseFactory.getInstance().getConnection()) { PreparedStatement stm = con.prepareStatement("SELECT matksp FROM balance WHERE class_id=" + classId); ResultSet rset = stm.executeQuery(); if (rset.next()) { i = rset.getInt("matksp"); } stm.close(); } catch (Exception e) { System.err.println("Error while loading balance stats from database."); e.printStackTrace(); } return i; } public static int loadPAtkSpd(int classId) { int i = 0; try (Connection con = L2DatabaseFactory.getInstance().getConnection()) { PreparedStatement stm = con.prepareStatement("SELECT patksp FROM balance WHERE class_id=" + classId); ResultSet rset = stm.executeQuery(); if (rset.next()) { i = rset.getInt("patksp"); } stm.close(); } catch (Exception e) { System.err.println("Error while loading balance stats from database."); e.printStackTrace(); } return i; } } /* * 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 Extensions.Balancer; import net.sf.l2j.gameserver.handler.IAdminCommandHandler; import net.sf.l2j.gameserver.model.actor.instance.L2PcInstance; import net.sf.l2j.gameserver.network.serverpackets.NpcHtmlMessage; public class Balancer implements IAdminCommandHandler { private static final String[] ADMIN_COMMANDS = { "admin_balance" }; @Override public boolean useAdminCommand(String command, L2PcInstance activeChar) { if (command.equals("admin_balance") && activeChar.isGM()) { NpcHtmlMessage htm = new NpcHtmlMessage(0); htm.setFile("./data/html/admin/balance/main.htm"); activeChar.sendPacket(htm); } return true; } public static void sendBalanceWindow(int classId, L2PcInstance p) { NpcHtmlMessage htm = new NpcHtmlMessage(0); htm.setFile("./data/html/admin/balance/balance.htm"); htm.replace("%classId%", classId + ""); htm.replace("%Patk%", BalanceLoad.loadPAtk(classId) + ""); htm.replace("%Matk%", BalanceLoad.loadMAtk(classId) + ""); htm.replace("%Pdef%", BalanceLoad.loadPDef(classId) + ""); htm.replace("%Mdef%", BalanceLoad.loadMDef(classId) + ""); htm.replace("%Acc%", BalanceLoad.loadAccuracy(classId) + ""); htm.replace("%Eva%", BalanceLoad.loadEvasion(classId) + ""); htm.replace("%AtkSp%", BalanceLoad.loadPAtkSpd(classId) + ""); htm.replace("%CastSp%", BalanceLoad.loadMAtkSpd(classId) + ""); htm.replace("%Cp%", BalanceLoad.loadCP(classId) + ""); htm.replace("%Hp%", BalanceLoad.loadHP(classId) + ""); htm.replace("%Mp%", BalanceLoad.loadMP(classId) + ""); htm.replace("%Speed%", BalanceLoad.loadSpeed(classId) + ""); p.sendPacket(htm); } @Override public String[] getAdminCommandList() { return ADMIN_COMMANDS; } } /* * 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 Extensions.Balancer; import java.sql.Connection; import java.sql.PreparedStatement; import java.sql.ResultSet; import net.sf.l2j.L2DatabaseFactory; import net.sf.l2j.gameserver.model.L2World; import net.sf.l2j.gameserver.model.actor.instance.L2PcInstance; import net.sf.l2j.gameserver.network.serverpackets.NpcHtmlMessage; import net.sf.l2j.gameserver.network.serverpackets.UserInfo; public class BalancerEdit { public static void editStat(String stat, int classId, int value, boolean add) { switch (stat) { case "patk": { try (Connection con = L2DatabaseFactory.getInstance().getConnection()) { PreparedStatement stm = con.prepareStatement("UPDATE balance SET patk=? WHERE class_id=?"); PreparedStatement stm2 = con.prepareStatement("SELECT patk FROM balance WHERE class_id=" + classId); ResultSet rset = stm2.executeQuery(); if (rset.next()) { if (add) { stm.setInt(1, rset.getInt("patk") + value); BalanceLoad.PAtk[classId - 88] = BalanceLoad.PAtk[classId - 88] + value; } else { stm.setInt(1, rset.getInt("patk") - value); BalanceLoad.PAtk[classId - 88] = BalanceLoad.PAtk[classId - 88] - value; } stm.setInt(2, classId); } stm.execute(); stm.close(); stm2.close(); } catch (Exception e) { System.err.println("Error while saving balance stats to database."); e.printStackTrace(); } for (L2PcInstance p : L2World.getInstance().getAllPlayers().values()) { if (p.getClassId().getId() == classId) { p.sendPacket(new UserInfo(p)); } } break; } case "matk": { try (Connection con = L2DatabaseFactory.getInstance().getConnection()) { PreparedStatement stm = con.prepareStatement("UPDATE balance SET matk=? WHERE class_id=?"); PreparedStatement stm2 = con.prepareStatement("SELECT matk FROM balance WHERE class_id=" + classId); ResultSet rset = stm2.executeQuery(); if (rset.next()) { if (add) { stm.setInt(1, rset.getInt("matk") + value); BalanceLoad.MAtk[classId - 88] = BalanceLoad.MAtk[classId - 88] + value; } else { stm.setInt(1, rset.getInt("matk") - value); BalanceLoad.MAtk[classId - 88] = BalanceLoad.MAtk[classId - 88] - value; } stm.setInt(2, classId); } stm.execute(); stm.close(); stm2.close(); } catch (Exception e) { System.err.println("Error while saving balance stats to database."); e.printStackTrace(); } for (L2PcInstance p : L2World.getInstance().getAllPlayers().values()) { if (p.getClassId().getId() == classId) { p.sendPacket(new UserInfo(p)); } } break; } case "pdef": { try (Connection con = L2DatabaseFactory.getInstance().getConnection()) { PreparedStatement stm = con.prepareStatement("UPDATE balance SET pdef=? WHERE class_id=?"); PreparedStatement stm2 = con.prepareStatement("SELECT pdef FROM balance WHERE class_id=" + classId); ResultSet rset = stm2.executeQuery(); if (rset.next()) { if (add) { stm.setInt(1, rset.getInt("pdef") + value); BalanceLoad.PDef[classId - 88] = BalanceLoad.PDef[classId - 88] + value; } else { stm.setInt(1, rset.getInt("pdef") - value); BalanceLoad.PDef[classId - 88] = BalanceLoad.PDef[classId - 88] - value; } stm.setInt(2, classId); } stm.execute(); stm.close(); stm2.close(); } catch (Exception e) { System.err.println("Error while saving balance stats to database."); e.printStackTrace(); } for (L2PcInstance p : L2World.getInstance().getAllPlayers().values()) { if (p.getClassId().getId() == classId) { p.sendPacket(new UserInfo(p)); } } break; } case "mdef": { try (Connection con = L2DatabaseFactory.getInstance().getConnection()) { PreparedStatement stm = con.prepareStatement("UPDATE balance SET mdef=? WHERE class_id=?"); PreparedStatement stm2 = con.prepareStatement("SELECT mdef FROM balance WHERE class_id=" + classId); ResultSet rset = stm2.executeQuery(); if (rset.next()) { if (add) { stm.setInt(1, rset.getInt("mdef") + value); BalanceLoad.MDef[classId - 88] = BalanceLoad.MDef[classId - 88] + value; } else { stm.setInt(1, rset.getInt("mdef") - value); BalanceLoad.MDef[classId - 88] = BalanceLoad.MDef[classId - 88] - value; } stm.setInt(2, classId); } stm.execute(); stm.close(); stm2.close(); } catch (Exception e) { System.err.println("Error while saving balance stats to database."); e.printStackTrace(); } for (L2PcInstance p : L2World.getInstance().getAllPlayers().values()) { if (p.getClassId().getId() == classId) { p.sendPacket(new UserInfo(p)); } } break; } case "acc": { try (Connection con = L2DatabaseFactory.getInstance().getConnection()) { PreparedStatement stm = con.prepareStatement("UPDATE balance SET acc=? WHERE class_id=?"); PreparedStatement stm2 = con.prepareStatement("SELECT acc FROM balance WHERE class_id=" + classId); ResultSet rset = stm2.executeQuery(); if (rset.next()) { if (add) { stm.setInt(1, rset.getInt("acc") + value); BalanceLoad.Accuracy[classId - 88] = BalanceLoad.Accuracy[classId - 88] + value; } else { stm.setInt(1, rset.getInt("acc") - value); BalanceLoad.Accuracy[classId - 88] = BalanceLoad.Accuracy[classId - 88] - value; } stm.setInt(2, classId); } stm.execute(); stm.close(); stm2.close(); } catch (Exception e) { System.err.println("Error while saving balance stats to database."); e.printStackTrace(); } for (L2PcInstance p : L2World.getInstance().getAllPlayers().values()) { if (p.getClassId().getId() == classId) { p.sendPacket(new UserInfo(p)); } } break; } case "ev": { try (Connection con = L2DatabaseFactory.getInstance().getConnection()) { PreparedStatement stm = con.prepareStatement("UPDATE balance SET ev=? WHERE class_id=?"); PreparedStatement stm2 = con.prepareStatement("SELECT ev FROM balance WHERE class_id=" + classId); ResultSet rset = stm2.executeQuery(); if (rset.next()) { if (add) { stm.setInt(1, rset.getInt("ev") + value); BalanceLoad.Evasion[classId - 88] = BalanceLoad.Evasion[classId - 88] + value; } else { stm.setInt(1, rset.getInt("ev") - value); BalanceLoad.Evasion[classId - 88] = BalanceLoad.Evasion[classId - 88] - value; } stm.setInt(2, classId); } stm.execute(); stm.close(); stm2.close(); } catch (Exception e) { System.err.println("Error while saving balance stats to database."); e.printStackTrace(); } for (L2PcInstance p : L2World.getInstance().getAllPlayers().values()) { if (p.getClassId().getId() == classId) { p.sendPacket(new UserInfo(p)); } } break; } case "patksp": { try (Connection con = L2DatabaseFactory.getInstance().getConnection()) { PreparedStatement stm = con.prepareStatement("UPDATE balance SET patksp=? WHERE class_id=?"); PreparedStatement stm2 = con.prepareStatement("SELECT patksp FROM balance WHERE class_id=" + classId); ResultSet rset = stm2.executeQuery(); if (rset.next()) { if (add) { stm.setInt(1, rset.getInt("patksp") + value); BalanceLoad.PAtkSpd[classId - 88] = BalanceLoad.PAtkSpd[classId - 88] + value; } else { stm.setInt(1, rset.getInt("patksp") - value); BalanceLoad.PAtkSpd[classId - 88] = BalanceLoad.PAtkSpd[classId - 88] - value; } stm.setInt(2, classId); } stm.execute(); stm.close(); stm2.close(); } catch (Exception e) { System.err.println("Error while saving balance stats to database."); e.printStackTrace(); } for (L2PcInstance p : L2World.getInstance().getAllPlayers().values()) { if (p.getClassId().getId() == classId) { p.sendPacket(new UserInfo(p)); } } break; } case "matksp": { try (Connection con = L2DatabaseFactory.getInstance().getConnection()) { PreparedStatement stm = con.prepareStatement("UPDATE balance SET matksp=? WHERE class_id=?"); PreparedStatement stm2 = con.prepareStatement("SELECT matksp FROM balance WHERE class_id=" + classId); ResultSet rset = stm2.executeQuery(); if (rset.next()) { if (add) { stm.setInt(1, rset.getInt("matksp") + value); BalanceLoad.MAtkSpd[classId - 88] = BalanceLoad.MAtkSpd[classId - 88] + value; } else { stm.setInt(1, rset.getInt("matksp") - value); BalanceLoad.MAtkSpd[classId - 88] = BalanceLoad.MAtkSpd[classId - 88] - value; } stm.setInt(2, classId); } stm.execute(); stm.close(); stm2.close(); } catch (Exception e) { System.err.println("Error while saving balance stats to database."); e.printStackTrace(); } for (L2PcInstance p : L2World.getInstance().getAllPlayers().values()) { if (p.getClassId().getId() == classId) { p.sendPacket(new UserInfo(p)); } } break; } case "cp": { try (Connection con = L2DatabaseFactory.getInstance().getConnection()) { PreparedStatement stm = con.prepareStatement("UPDATE balance SET cp=? WHERE class_id=?"); PreparedStatement stm2 = con.prepareStatement("SELECT cp FROM balance WHERE class_id=" + classId); ResultSet rset = stm2.executeQuery(); if (rset.next()) { if (add) { stm.setInt(1, rset.getInt("cp") + value); BalanceLoad.CP[classId - 88] = BalanceLoad.CP[classId - 88] + value; } else { stm.setInt(1, rset.getInt("cp") - value); BalanceLoad.CP[classId - 88] = BalanceLoad.CP[classId - 88] - value; } stm.setInt(2, classId); } stm.execute(); stm.close(); stm2.close(); } catch (Exception e) { System.err.println("Error while saving balance stats to database."); e.printStackTrace(); } for (L2PcInstance p : L2World.getInstance().getAllPlayers().values()) { if (p.getClassId().getId() == classId) { p.sendPacket(new UserInfo(p)); } } break; } case "hp": { try (Connection con = L2DatabaseFactory.getInstance().getConnection()) { PreparedStatement stm = con.prepareStatement("UPDATE balance SET hp=? WHERE class_id=?"); PreparedStatement stm2 = con.prepareStatement("SELECT hp FROM balance WHERE class_id=" + classId); ResultSet rset = stm2.executeQuery(); if (rset.next()) { if (add) { stm.setInt(1, rset.getInt("hp") + value); BalanceLoad.HP[classId - 88] = BalanceLoad.HP[classId - 88] + value; } else { stm.setInt(1, rset.getInt("hp") - value); BalanceLoad.HP[classId - 88] = BalanceLoad.HP[classId - 88] - value; } stm.setInt(2, classId); } stm.execute(); stm.close(); stm2.close(); } catch (Exception e) { System.err.println("Error while saving balance stats to database."); e.printStackTrace(); } for (L2PcInstance p : L2World.getInstance().getAllPlayers().values()) { if (p.getClassId().getId() == classId) { p.sendPacket(new UserInfo(p)); } } break; } case "mp": { try (Connection con = L2DatabaseFactory.getInstance().getConnection()) { PreparedStatement stm = con.prepareStatement("UPDATE balance SET mp=? WHERE class_id=?"); PreparedStatement stm2 = con.prepareStatement("SELECT mp FROM balance WHERE class_id=" + classId); ResultSet rset = stm2.executeQuery(); if (rset.next()) { if (add) { stm.setInt(1, rset.getInt("mp") + value); BalanceLoad.MP[classId - 88] = BalanceLoad.MP[classId - 88] + value; } else { stm.setInt(1, rset.getInt("mp") - value); BalanceLoad.MP[classId - 88] = BalanceLoad.MP[classId - 88] - value; } stm.setInt(2, classId); } stm.execute(); stm.close(); stm2.close(); } catch (Exception e) { System.err.println("Error while saving balance stats to database."); e.printStackTrace(); } for (L2PcInstance p : L2World.getInstance().getAllPlayers().values()) { if (p.getClassId().getId() == classId) { p.sendPacket(new UserInfo(p)); } } break; } case "walk": { try (Connection con = L2DatabaseFactory.getInstance().getConnection()) { PreparedStatement stm = con.prepareStatement("UPDATE balance SET walk=? WHERE class_id=?"); PreparedStatement stm2 = con.prepareStatement("SELECT walk FROM balance WHERE class_id=" + classId); ResultSet rset = stm2.executeQuery(); if (rset.next()) { if (add) { stm.setInt(1, rset.getInt("walk") + value); BalanceLoad.Speed[classId - 88] = BalanceLoad.Speed[classId - 88] + value; } else { stm.setInt(1, rset.getInt("walk") - value); BalanceLoad.Speed[classId - 88] = BalanceLoad.Speed[classId - 88] - value; } stm.setInt(2, classId); } stm.execute(); stm.close(); stm2.close(); } catch (Exception e) { System.err.println("Error while saving balance stats to database."); e.printStackTrace(); } for (L2PcInstance p : L2World.getInstance().getAllPlayers().values()) { if (p.getClassId().getId() == classId) { p.sendPacket(new UserInfo(p)); } } break; } } } public void sendBalanceWindow(int classId, L2PcInstance p) { NpcHtmlMessage htm = new NpcHtmlMessage(0); htm.setFile("./data/html/admin/balance/balance.htm"); htm.replace("%classId%", classId + ""); p.sendPacket(htm); } } now in the CharStat.java - public int getEvasionRate(L2Character target) - { - if (_activeChar == null) - return 1; - - return (int) calcStat(Stats.EVASION_RATE, 0, target, null); - } + public int getEvasionRate(L2Character target) + { + if (_activeChar == null) + return 1; + + double val = (calcStat(Stats.EVASION_RATE, 0, target, null)); + if (_activeChar instanceof L2PcInstance && ((L2PcInstance) _activeChar).getClassId().getId() >= 88) + { + val += BalanceLoad.Evasion[((L2PcInstance) _activeChar).getClassId().getId() - 88]; + } + if (val >= 0) + return (int) val; + else + return 0; + } - public int getAccuracy() - { - if (_activeChar == null) - return 0; - - return (int) calcStat(Stats.ACCURACY_COMBAT, 0, null, null); - } + public int getAccuracy() + { + if (_activeChar == null) + return 0; + + double val = (calcStat(Stats.ACCURACY_COMBAT, 0, null, null)); + if (_activeChar instanceof L2PcInstance && ((L2PcInstance) _activeChar).getClassId().getId() >= 88) + { + val += BalanceLoad.Accuracy[((L2PcInstance) _activeChar).getClassId().getId() - 88]; + } + if (val > 0) + return (int) val; + else + return 0; + } - public int getMaxHp() - { - if (_activeChar == null) - return 1; - - return (int) calcStat(Stats.MAX_HP, _activeChar.getTemplate().getBaseHpMax(), null, null); - } - - public int getMaxCp() - { - if (_activeChar == null) - return 1; - - return (int) calcStat(Stats.MAX_CP, _activeChar.getTemplate().getBaseCpMax(), null, null); - } - - public int getMaxMp() - { - if (_activeChar == null) - return 1; - - return (int) calcStat(Stats.MAX_MP, _activeChar.getTemplate().getBaseMpMax(), null, null); - } + public int getMaxHp() + { + if (_activeChar == null) + return 1; + + double val = calcStat(Stats.MAX_HP, _activeChar.getTemplate().getBaseHpMax(), null, null); + if (_activeChar instanceof L2PcInstance && ((L2PcInstance) _activeChar).getClassId().getId() >= 88) + { + val += BalanceLoad.HP[((L2PcInstance) _activeChar).getClassId().getId() - 88]; + } + if (val > 0) + return (int) val; + else + return 0; + } + + public int getMaxCp() + { + if (_activeChar == null) + return 1; + + double val = calcStat(Stats.MAX_CP, _activeChar.getTemplate().getBaseCpMax(), null, null); + if (_activeChar instanceof L2PcInstance && ((L2PcInstance) _activeChar).getClassId().getId() >= 88) + { + val += BalanceLoad.CP[((L2PcInstance) _activeChar).getClassId().getId() - 88]; + } + if (val >= 0) + return (int) val; + else + return 0; + } + + public int getMaxMp() + { + if (_activeChar == null) + return 1; + + double val = calcStat(Stats.MAX_MP, _activeChar.getTemplate().getBaseMpMax(), null, null); + if (_activeChar instanceof L2PcInstance && ((L2PcInstance) _activeChar).getClassId().getId() >= 88) + { + val += BalanceLoad.MP[((L2PcInstance) _activeChar).getClassId().getId() - 88]; + } + if (val >= 0) + return (int) val; + else + return 0; + } - public int getMAtk(L2Character target, L2Skill skill) - { - if (_activeChar == null) - return 1; - - double attack = _activeChar.getTemplate().getBaseMAtk() * ((_activeChar.isChampion()) ? Config.CHAMPION_ATK : 1); - - // Add the power of the skill to the attack effect - if (skill != null) - attack += skill.getPower(); - - // Calculate modifiers Magic Attack - return (int) calcStat(Stats.MAGIC_ATTACK, attack, target, skill); - } + public int getMAtk(L2Character target, L2Skill skill) + { + if (_activeChar == null) + return 1; + + double attack = _activeChar.getTemplate().getBaseMAtk() * ((_activeChar.isChampion()) ? Config.CHAMPION_ATK : 1); + + // Add the power of the skill to the attack effect + if (skill != null) + attack += skill.getPower(); + + // Calculate modifiers Magic Attack + double val = calcStat(Stats.MAGIC_ATTACK, attack, target, skill); + if (_activeChar instanceof L2PcInstance && ((L2PcInstance) _activeChar).getClassId().getId() >= 88) + { + val += BalanceLoad.MAtk[((L2PcInstance) _activeChar).getClassId().getId() - 88]; + + } + if (val > 0) + return (int) val; + else + return 0; + } - public int getMAtkSpd() - { - if (_activeChar == null) - return 1; - - return (int) calcStat(Stats.MAGIC_ATTACK_SPEED, 333.0 * ((_activeChar.isChampion()) ? Config.CHAMPION_SPD_ATK : 1), null, null); - } + public int getMAtkSpd() + { + if (_activeChar == null) + return 1; + float bonusSpdAtk = 1; + if (_activeChar.isChampion()) + { + bonusSpdAtk = (float) Config.CHAMPION_SPD_ATK; + } + double val = calcStat(Stats.MAGIC_ATTACK_SPEED, 330.0 * bonusSpdAtk, null, null); + if (_activeChar instanceof L2PcInstance && ((L2PcInstance) _activeChar).getClassId().getId() >= 88) + { + val += BalanceLoad.MAtkSpd[((L2PcInstance) _activeChar).getClassId().getId() - 88]; + } + if (val >= 0) + return (int) val; + else + return 0; + } - public int getMDef(L2Character target, L2Skill skill) - { - if (_activeChar == null) - return 1; - - // Calculate modifiers Magic Attack - return (int) calcStat(Stats.MAGIC_DEFENCE, _activeChar.getTemplate().getBaseMDef() * ((_activeChar.isRaid()) ? Config.RAID_DEFENCE_MULTIPLIER : 1), target, skill); - } + public int getMDef(L2Character target, L2Skill skill) + { + if (_activeChar == null) + return 1; + + // Get the base MDef of the L2Character + double defence = _activeChar.getTemplate().getBaseMDef(); + + // Calculate modifier for Raid Bosses + if (_activeChar.isRaid()) + { + defence *= Config.RAID_DEFENCE_MULTIPLIER; + } + + // Calculate modifiers Magic Attack + double val = calcStat(Stats.MAGIC_DEFENCE, defence, target, skill); + if (_activeChar instanceof L2PcInstance && ((L2PcInstance) _activeChar).getClassId().getId() >= 88) + { + val += BalanceLoad.MDef[((L2PcInstance) _activeChar).getClassId().getId() - 88]; + } + if (val >= 0) + return (int) val; + else + return 0; + } - public int getPAtk(L2Character target) - { - if (_activeChar == null) - return 1; - - return (int) calcStat(Stats.POWER_ATTACK, _activeChar.getTemplate().getBasePAtk() * ((_activeChar.isChampion()) ? Config.CHAMPION_ATK : 1), target, null); - } + public int getPAtk(L2Character target) + { + if (_activeChar == null) + return 1; + float bonusAtk = 1; + if (_activeChar.isChampion()) + { + bonusAtk = (float) Config.CHAMPION_ATK; + } + double val = calcStat(Stats.POWER_ATTACK, _activeChar.getTemplate().getBasePAtk() * bonusAtk, target, null); + if (_activeChar instanceof L2PcInstance && ((L2PcInstance) _activeChar).getClassId().getId() >= 88) + { + val += BalanceLoad.PAtk[((L2PcInstance) _activeChar).getClassId().getId() - 88]; + } + if (val >= 0) + return (int) val; + else + return 0; + } - public int getPAtkSpd() - { - if (_activeChar == null) - return 1; - - return (int) calcStat(Stats.POWER_ATTACK_SPEED, _activeChar.getTemplate().getBasePAtkSpd() * ((_activeChar.isChampion()) ? Config.CHAMPION_SPD_ATK : 1), null, null); - } + public int getPAtkSpd() + { + if (_activeChar == null) + return 1; + float bonusAtk = 1; + if (_activeChar.isChampion()) + { + bonusAtk = (float) Config.CHAMPION_SPD_ATK; + } + double val = (calcStat(Stats.POWER_ATTACK_SPEED, _activeChar.getTemplate().getBasePAtkSpd() * bonusAtk, null, null)); + if (_activeChar instanceof L2PcInstance && ((L2PcInstance) _activeChar).getClassId().getId() >= 88) + { + val += BalanceLoad.PAtkSpd[((L2PcInstance) _activeChar).getClassId().getId() - 88]; + } + if (val > 0) + return (int) val; + else + return 0; + } - public int getPDef(L2Character target) - { - if (_activeChar == null) - return 1; - - return (int) calcStat(Stats.POWER_DEFENCE, _activeChar.getTemplate().getBasePDef() * ((_activeChar.isRaid()) ? Config.RAID_DEFENCE_MULTIPLIER : 1), target, null); - } + public int getPDef(L2Character target) + { + if (_activeChar == null) + return 1; + + // Get the base PDef of the L2Character + double defence = _activeChar.getTemplate().getBasePDef(); + + // Calculate modifier for Raid Bosses + if (_activeChar.isRaid()) + { + defence *= Config.RAID_DEFENCE_MULTIPLIER; + } + + // Calculate modifiers Magic Attack + double val = calcStat(Stats.POWER_DEFENCE, defence, target, null); + if (_activeChar instanceof L2PcInstance && ((L2PcInstance) _activeChar).getClassId().getId() >= 88) + { + val += BalanceLoad.PDef[((L2PcInstance) _activeChar).getClassId().getId() - 88]; + } + if (val >= 0) + return (int) val; + else + return 0; + + } - public int getRunSpeed() - { - if (_activeChar == null) - return 1; - - return (int) calcStat(Stats.RUN_SPEED, _activeChar.getTemplate().getBaseRunSpd(), null, null); - } + public int getRunSpeed() + { + if (_activeChar == null) + return 1; + + double val = (calcStat(Stats.RUN_SPEED, _activeChar.getTemplate().getBaseRunSpd(), null, null)); + if (_activeChar instanceof L2PcInstance) + { + if (_activeChar instanceof L2PcInstance && ((L2PcInstance) _activeChar).getClassId().getId() >= 88) + { + val += BalanceLoad.Speed[((L2PcInstance) _activeChar).getClassId().getId() - 88]; + } + if (val > 0) + return (int) val; + else + return 0; + } + return (int) val; + } now in RequestBypassToServer.java else if (_command.startsWith("Quest ")) { if (!activeChar.validateBypass(_command)) return; String[] str = _command.substring(6).trim().split(" ", 2); if (str.length == 1) activeChar.processQuestEvent(str[0], ""); else activeChar.processQuestEvent(str[0], str[1]); } + else if (_command.startsWith("bp_balance")) + { + String bp = _command.substring(11); + StringTokenizer st = new StringTokenizer(bp); + + if (st.countTokens() != 1) + { + return; + } + + int classId = Integer.parseInt(st.nextToken()); + + Balancer.sendBalanceWindow(classId, activeChar); + } + + else if (_command.startsWith("bp_add")) + { + String bp = _command.substring(7); + StringTokenizer st = new StringTokenizer(bp); + + if (st.countTokens() != 3) + { + return; + } + + String stat = st.nextToken(); + int classId = Integer.parseInt(st.nextToken()), + value = Integer.parseInt(st.nextToken()); + + BalancerEdit.editStat(stat, classId, value, true); + + Balancer.sendBalanceWindow(classId, activeChar); + } + + else if (_command.startsWith("bp_rem")) + { + String bp = _command.substring(7); + StringTokenizer st = new StringTokenizer(bp); + + if (st.countTokens() != 3) + { + return; + } + + String stat = st.nextToken(); + int classId = Integer.parseInt(st.nextToken()), + value = Integer.parseInt(st.nextToken()); + + BalancerEdit.editStat(stat, classId, value, false); + + Balancer.sendBalanceWindow(classId, activeChar); + } now in AdminAdmin.java else if (command.startsWith("admin_reload")) { StringTokenizer st = new StringTokenizer(command); st.nextToken(); try { String type = st.nextToken(); if (type.startsWith("acar")) { AdminCommandAccessRights.getInstance().reload(); activeChar.sendMessage("Admin commands rights have been reloaded."); } + else if (type.equals("balancer")) + { + BalanceLoad.LoadEm(); + activeChar.sendMessage("Balance stats for classes has been reloaded."); + } in AdminCommandHandler.java + registerAdminCommandHandler(new Balancer()); GameServer.java +BalanceLoad.LoadEm(); sql part /* Navicat MySQL Data Transfer Source Server : localhost_3306 Source Server Version : 50524 Source Host : localhost:3306 Source Database : acis Target Server Type : MYSQL Target Server Version : 50524 File Encoding : 65001 Date: 2014-10-21 16:57:29 */ SET FOREIGN_KEY_CHECKS=0; -- ---------------------------- -- Table structure for `balance` -- ---------------------------- DROP TABLE IF EXISTS `balance`; CREATE TABLE `balance` ( `class_id` smallint(6) NOT NULL DEFAULT '0', `patk` smallint(6) NOT NULL DEFAULT '0', `matk` smallint(6) NOT NULL DEFAULT '0', `pdef` smallint(6) NOT NULL DEFAULT '0', `mdef` smallint(6) NOT NULL DEFAULT '0', `acc` smallint(6) NOT NULL DEFAULT '0', `ev` smallint(6) NOT NULL DEFAULT '0', `patksp` smallint(6) NOT NULL DEFAULT '0', `matksp` smallint(6) NOT NULL DEFAULT '0', `cp` smallint(6) NOT NULL DEFAULT '0', `hp` smallint(6) NOT NULL DEFAULT '0', `mp` smallint(6) NOT NULL DEFAULT '0', `walk` smallint(6) NOT NULL DEFAULT '0', PRIMARY KEY (`class_id`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci ROW_FORMAT=COMPRESSED COMMENT='L2jHellas Table'; -- ---------------------------- -- Records of balance -- ---------------------------- INSERT INTO `balance` VALUES ('88', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0'); INSERT INTO `balance` VALUES ('89', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0'); INSERT INTO `balance` VALUES ('90', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0'); INSERT INTO `balance` VALUES ('91', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0'); INSERT INTO `balance` VALUES ('92', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0'); INSERT INTO `balance` VALUES ('93', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0'); INSERT INTO `balance` VALUES ('94', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0'); INSERT INTO `balance` VALUES ('95', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0'); INSERT INTO `balance` VALUES ('96', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0'); INSERT INTO `balance` VALUES ('97', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0'); INSERT INTO `balance` VALUES ('98', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0'); INSERT INTO `balance` VALUES ('99', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0'); INSERT INTO `balance` VALUES ('100', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0'); INSERT INTO `balance` VALUES ('101', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0'); INSERT INTO `balance` VALUES ('102', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0'); INSERT INTO `balance` VALUES ('103', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0'); INSERT INTO `balance` VALUES ('104', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0'); INSERT INTO `balance` VALUES ('105', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0'); INSERT INTO `balance` VALUES ('106', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0'); INSERT INTO `balance` VALUES ('107', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0'); INSERT INTO `balance` VALUES ('108', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0'); INSERT INTO `balance` VALUES ('109', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0'); INSERT INTO `balance` VALUES ('110', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0'); INSERT INTO `balance` VALUES ('111', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0'); INSERT INTO `balance` VALUES ('112', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0'); INSERT INTO `balance` VALUES ('113', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0'); INSERT INTO `balance` VALUES ('114', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0'); INSERT INTO `balance` VALUES ('115', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0'); INSERT INTO `balance` VALUES ('116', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0'); INSERT INTO `balance` VALUES ('117', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0'); INSERT INTO `balance` VALUES ('118', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0'); html part. Create a new folder html/admin/balance 2 files inside balance.htm <html><title>Balance Menu</title><body> <center><edit var="value" width=50 height=20 type=number> <br><font color="FF6600">Edit the stats here.</font><br1><br1> <table width="300" height="20"> <tr> <td align="center" width="75">Stat.</td> <td align="center" width="75">Default:0</td> <td align="center" width="75"></td> <td align="center" width="75"></td> </tr> <tr> <td align="center" width="75">Patk</td> <td align="center" width="75">%Patk%</td> <td align="center" width="75"><a action="bypass bp_add patk %classId% $value">Add</a></td> <td align="center" width="75"><a action="bypass bp_rem patk %classId% $value">Remove</a></td> </tr> <tr> <td align="center" width="75">Matk</td> <td align="center" width="75">%Matk%</td> <td align="center" width="75"><a action="bypass bp_add matk %classId% $value">Add</a></td> <td align="center" width="75"><a action="bypass bp_rem matk %classId% $value">Remove</a></td> </tr> <tr> <td align="center" width="75">Pdef</td> <td align="center" width="75">%Pdef%</td> <td align="center" width="75"><a action="bypass bp_add pdef %classId% $value">Add</a></td> <td align="center" width="75"><a action="bypass bp_rem pdef %classId% $value">Remove</a></td> </tr> <tr> <td align="center" width="75">Mdef</td> <td align="center" width="75">%Mdef%</td> <td align="center" width="75"><a action="bypass bp_add mdef %classId% $value">Add</a></td> <td align="center" width="75"><a action="bypass bp_rem mdef %classId% $value">Remove</a></td> </tr> <tr> <td align="center" width="75">Acc</td> <td align="center" width="75">%Acc%</td> <td align="center" width="75"><a action="bypass bp_add acc %classId% $value">Add</a></td> <td align="center" width="75"><a action="bypass bp_rem acc %classId% $value">Remove</a></td> </tr> <tr> <td align="center" width="75">Eva</td> <td align="center" width="75">%Eva%</td> <td align="center" width="75"><a action="bypass bp_add ev %classId% $value">Add</a></td> <td align="center" width="75"><a action="bypass bp_rem ev %classId% $value">Remove</a></td> </tr> <tr> <td align="center" width="75">AtkSp</td> <td align="center" width="75">%AtkSp%</td> <td align="center" width="75"><a action="bypass bp_add patksp %classId% $value">Add</a></td> <td align="center" width="75"><a action="bypass bp_rem patksp %classId% $value">Remove</a></td> </tr> <tr> <td align="center" width="75">CastSp</td> <td align="center" width="75">%CastSp%</td> <td align="center" width="75"><a action="bypass bp_add matksp %classId% $value">Add</a></td> <td align="center" width="75"><a action="bypass bp_rem matksp %classId% $value">Remove</a></td> </tr> <tr> <td align="center" width="75">Cp</td> <td align="center" width="75">%Cp%</td> <td align="center" width="75"><a action="bypass bp_add cp %classId% $value">Add</a></td> <td align="center" width="75"><a action="bypass bp_rem cp %classId% $value">Remove</a></td> </tr> <tr> <td align="center" width="75">Hp</td> <td align="center" width="75">%Hp%</td> <td align="center" width="75"><a action="bypass bp_add hp %classId% $value">Add</a></td> <td align="center" width="75"><a action="bypass bp_rem hp %classId% $value">Remove</a></td> </tr> <tr> <td align="center" width="75">Mp</td> <td align="center" width="75">%Mp%</td> <td align="center" width="75"><a action="bypass bp_add mp %classId% $value">Add</a></td> <td align="center" width="75"><a action="bypass bp_rem mp %classId% $value">Remove</a></td> </tr> <tr> <td align="center" width="75">Speed</td> <td align="center" width="75">%Speed%</td> <td align="center" width="75"><a action="bypass bp_add walk %classId% $value">Add</a></td> <td align="center" width="75"><a action="bypass bp_rem walk %classId% $value">Remove</a></td> </tr> </table><br><a action="bypass -h admin_balance">Back</a> </center> </body></html> main.htm <html><title>Balance class select Menu</title><body> <center><font color="FF6600">Choose the 3rd class stats to edit.</font><br1> <table width="300" height="20"> <tr> <td align="center" width="75"><a action="bypass bp_balance 88">Duelist</a></td> <td align="center" width="75"><a action="bypass bp_balance 89">DreadNought</a></td> </tr> <tr> <td align="center" width="75"><a action="bypass bp_balance 90">Phoenix Knight</a></td> <td align="center" width="75"><a action="bypass bp_balance 91">Hell Knight</a></td> </tr> <tr> <td align="center" width="75"><a action="bypass bp_balance 92">Sagittarius</a></td> <td align="center" width="75"><a action="bypass bp_balance 93">Adventurer</a></td> </tr> <tr> <td align="center" width="75"><a action="bypass bp_balance 94">Archmage</a></td> <td align="center" width="75"><a action="bypass bp_balance 95">Soultaker</a></td> </tr> <tr> <td align="center" width="75"><a action="bypass bp_balance 96">Arcana Lord</a></td> <td align="center" width="75"><a action="bypass bp_balance 97">Cardinal</a></td> </tr> <tr> <td align="center" width="75"><a action="bypass bp_balance 98">Hierophant</a></td> <td align="center" width="75"><a action="bypass bp_balance 99">Eva Templar</a></td> </tr> <tr> <td align="center" width="75"><a action="bypass bp_balance 100">Sword Muse</a></td> <td align="center" width="75"><a action="bypass bp_balance 101">Wind Rider</a></td> </tr> <tr> <td align="center" width="75"><a action="bypass bp_balance 102">Moonlight Sentinel</a></td> <td align="center" width="75"><a action="bypass bp_balance 103">Mystic Muse</a></td> </tr> <tr> <td align="center" width="75"><a action="bypass bp_balance 104">Elemental Master</a></td> <td align="center" width="75"><a action="bypass bp_balance 105">Eva Saint</a></td> </tr> <tr> <td align="center" width="75"><a action="bypass bp_balance 106">Shillien Templar</a></td> <td align="center" width="75"><a action="bypass bp_balance 107">Spectral Dancer</a></td> </tr> <tr> <td align="center" width="75"><a action="bypass bp_balance 108">Ghost Hunter</a></td> <td align="center" width="75"><a action="bypass bp_balance 109">Ghost Sentinel</a></td> </tr> <tr> <td align="center" width="75"><a action="bypass bp_balance 110">Storm Screamer</a></td> <td align="center" width="75"><a action="bypass bp_balance 111">Spectral Master</a></td> </tr> <tr> <td align="center" width="75"><a action="bypass bp_balance 112">Shillen Saint</a></td> <td align="center" width="75"><a action="bypass bp_balance 113">Titan</a></td> </tr> <tr> <td align="center" width="75"><a action="bypass bp_balance 114">Grand Khauatari</a></td> <td align="center" width="75"><a action="bypass bp_balance 115">Dominator</a></td> </tr> <tr> <td align="center" width="75"><a action="bypass bp_balance 116">Doomcryer</a></td> <td align="center" width="75"><a action="bypass bp_balance 117">Fortune Seeker</a></td> </tr> <tr> <td align="center" width="75"><a action="bypass bp_balance 118">Maestro</a></td> </tr> </table> </center> </body></html> and the last register the command in admin_commands_rights.xml <aCar name="admin_balance" accessLevel="1" />
  9. hello..i have made this right now and i will share it..tested and works... but you have to restart to change the sex of the Character Have a nice Day.. ps.add a New item and register you handler and like this <set name="handler" val="ChangeSexItem" /> ### Eclipse Workspace Patch 1.0 #P aCis_gameserver Index: java/net/sf/l2j/gameserver/handler/ItemHandler.java =================================================================== --- java/net/sf/l2j/gameserver/handler/ItemHandler.java (revision 4) +++ java/net/sf/l2j/gameserver/handler/ItemHandler.java (working copy) @@ -24,6 +24,7 @@ import net.sf.l2j.gameserver.handler.itemhandlers.BlessedSpiritShot; import net.sf.l2j.gameserver.handler.itemhandlers.Book; import net.sf.l2j.gameserver.handler.itemhandlers.Calculator; +import net.sf.l2j.gameserver.handler.itemhandlers.ChangeSexItem; import net.sf.l2j.gameserver.handler.itemhandlers.ClanFullSkill; import net.sf.l2j.gameserver.handler.itemhandlers.ClanLevel; import net.sf.l2j.gameserver.handler.itemhandlers.ClanReputation; @@ -96,6 +97,7 @@ registerItemHandler(new NobleItem()); registerItemHandler(new VipItem()); registerItemHandler(new AioItem()); + registerItemHandler(new ChangeSexItem()); } public void registerItemHandler(IItemHandler handler) Index: java/net/sf/l2j/Config.java =================================================================== --- java/net/sf/l2j/Config.java (revision 13) +++ java/net/sf/l2j/Config.java (working copy) @@ -388,6 +388,9 @@ public static int VIP_REWARD_ITEM; public static int VIP_ITEM_AMOUNT; public static int VIP_SET_DAYS; + public static boolean ENABLE_CHANGESEX_COIN; + public static int CHANGESEX_COIN_ID; + public static int CHANGESEX_COIN_AMOUNT; /** Balance Settings */ public static long CLASS_BALANCER_UPDATE_DELAY; @@ -1389,6 +1392,9 @@ VIP_REWARD_ITEM = reborn12.getProperty("VipRewardItem", 0); VIP_ITEM_AMOUNT = reborn12.getProperty("VipItemAmount", 0); VIP_SET_DAYS = reborn12.getProperty("VipSetDays", 1); + ENABLE_CHANGESEX_COIN = reborn12.getProperty("EnableChangeSexItem", false); + CHANGESEX_COIN_ID = reborn12.getProperty("ChangeSexCoinId", 1); + CHANGESEX_COIN_AMOUNT = reborn12.getProperty("ChangeSexCoinAmount", 1); CLASS_BALANCER_UPDATE_DELAY = reborn12.getProperty("ClassBalancerUpdateDelay", 300) * 1000; CLASS_BALANCER_AFFECTS_SECOND_PROFFESION = reborn12.getProperty("ClassBalancerAffectSecondProffesion", false); CLASS_BALANCER_AFFECTS_MONSTERS = reborn12.getProperty("ClassBalancerAffectMonsters", false); Index: java/net/sf/l2j/gameserver/handler/itemhandlers/ChangeSexItem.java =================================================================== --- java/net/sf/l2j/gameserver/handler/itemhandlers/ChangeSexItem.java (revision 0) +++ java/net/sf/l2j/gameserver/handler/itemhandlers/ChangeSexItem.java (working copy) @@ -0,0 +1,62 @@ +/* + * 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.commons.concurrent.ThreadPool; + +import net.sf.l2j.Config; +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.base.Sex; +import net.sf.l2j.gameserver.model.item.instance.ItemInstance; +import net.sf.l2j.gameserver.model.olympiad.OlympiadManager; +import net.sf.l2j.gameserver.network.SystemMessageId; + +/** + * @author Reborn12 + */ +public class ChangeSexItem implements IItemHandler +{ + @Override + public void useItem(L2Playable playable, ItemInstance item, boolean forceUse) + { + if (Config.ENABLE_CHANGESEX_COIN) + { + if (!(playable instanceof L2PcInstance)) + { + L2PcInstance player = (L2PcInstance) playable; + if (player.isInCombat()) + { + player.sendMessage("you Can't Use Item Because You Are in Combat"); + return; + } + else if (player.isInOlympiadMode() || OlympiadManager.getInstance().isRegisteredInComp(player)) + { + player.sendPacket(SystemMessageId.YOU_ARE_NOT_AUTHORIZED_TO_DO_THAT); + return; + } + if (!player.destroyItemByItemId("ChangeSex", Config.CHANGESEX_COIN_ID, Config.CHANGESEX_COIN_AMOUNT, null, true)) + return; + + player.getAppearance().setSex(player.getAppearance().getSex() == Sex.MALE ? Sex.FEMALE : Sex.MALE); + player.sendMessage("Your gender has been changed,You will Be Disconected in 3 Seconds!"); + player.broadcastUserInfo(); + player.decayMe(); + player.spawnMe(); + ThreadPool.schedule(() -> player.logout(false), 3000); + } + } + } + } \ No newline at end of file Index: config/reborn12.properties =================================================================== --- config/reborn12.properties (revision 13) +++ config/reborn12.properties (working copy) @@ -665,6 +665,19 @@ #Set Days For Vip chars From Npc VipSetDays = 15 +# -------------------- +# ChangeSex Settings +# -------------------- + +#Enable/Disable ChangeSex Item +EnableChangeSexItem = True + +#ChangeSex Item ID +ChangeSexCoinId = 57 + +#ChangeSex Item Amount +ChangeSexCoinAmount = 1 + \ No newline at end of file
  10. Hello. I made this instances system because I will be using it on a server and I decided to share it since it's very simple. You just call setInstanceId(id). 0 is the default instance id. Doors and fences are visible to all instances. I tested it and it seemed to work fine with drops/aoe skills etc. If you find any bugs report them and I will fix. http://pastebin.com/R00zF8DP
  11. How does it works? our system automatically pop-up validation window to characters oscillating around specified number of killed monsters, in order to verify possible bots use. player have to match randomly generated colours within <also> randomly chosen patterns (time is limited). forgive me guys, but since now any instant changes or system updates will be available only for acis customers. authors: credits: @Agent @Rootware @Caparso @Hasha @SweeTs @Tryskell our main provisions: does not require to be fluent in a foreign language, as simple as possible. insurmountable by nowadays programs used to inject bots. does not affecting existing source (just few necessary lines), no external libs are needed. punishment selection (move to nearest town, kick from the server, put to the jail or ban character). configurable validation time. code preview? check it out on pastebin. bots_prevention_v1.1.diff html/mods/necessary images How does software see content? <html><title>Bots prevention</title><body><center><br><br><img src="L2UI_CH3.herotower_deco" width="256" height="32"><br><br><font color="a2a0a2">in order to prove you are a human being<br1>you've to</font> <font color="b09979">match colours within generated pattern:</font><br><br><img src="Crest.crest_1_9903795" width="32" height="32"></td></tr><br><br><font color=b09979>click-on pattern of your choice beneath:</font><table><tr><td><button action="bypass -h report_0" width=32 height=32 back="Crest.crest_1_1978" fore="Crest.crest_1_1978"></td><td><button action="bypass -h report_1" width=32 height=32 back="Crest.crest_1_1970" fore="Crest.crest_1_1970"></td><td><button action="bypass -h report_2" width=32 height=32 back="Crest.crest_1_1975" fore="Crest.crest_1_1975"></td><td><button action="bypass -h report_3" width=32 height=32 back="Crest.crest_1_1971" fore="Crest.crest_1_1971"></td></tr></table></center></body></html>
  12. I saw a guy trying to sell this code for 20E.... I thing you get what it is right? You have a chance to craft items with enchant. the only thing you have to do is to add 2 values in recipes.xml. example: <recipe alias="mk_leather_boots" id="69" material="1931-4;1882-8;1885-1;2130-1" product="40-1" itemId="2176" level="2" mpConsume="84" successRate="100" isDwarven="true"/> You can add enchant by adding enchantChance="70" enchant="4-19" (means you have 70% chance to get a random value from 4 - 19 as enchant) in case you want a constant value you can put it like "10-10" <recipe alias="mk_leather_boots" id="69" material="1931-4;1882-8;1885-1;2130-1" enchantChance="70" enchant="4-19" product="40-1" itemId="2176" level="2" mpConsume="84" successRate="100" isDwarven="true"/> rev 375 here is the code: [Hidden Content]
  13. [ES] En la vista de lo popular de Acis y de lo mucho que se complica la gente en adaptar y meter nuevos códigos me dispuse a hacer este engine. Este engine contará con un sistema de listeners y codigos que nos permitirá diseñar de forma sencilla todos nuestros mods prácticamente sin modificar el core de nuestro proyecto, esto hará más fácil actualizar nuestro pack y evitar errores de programación. [EN] In the view of popular Acis and how much people complicate in adapting and putting new codes I was prepared to do this engine. This engine will have a system of listeners and codes that will allow us to easily design all our mods practically without modifying the core of our project, this will make it easier to update our pack and avoid programming errors. REPOSITORIO/ REPOSITORY * https://svn.code.sf.net/p/l2j-engine-mods/code/L2J_EngineMods/ CAMBIOS / TIMELINE * https://sourceforge.net/p/l2j-engine-mods/code/commit_browser SUPPORT * https://l2devsadmins.net/fissban/index.php DESCARGAR E INSTALAR / DOWNLOAD AND INSTALL https://l2devsadmins.net/fissban/index.php?topic=23.0 [ES] Ire agregando mas mods a medida que me lo vayan pidiendo y vea que tenga tiempo en crearlos....el test queda por parte de ustedes ya que esto es para ustedes, or ahora solo cuenta con estos mods. [EN] I will add more mods as they ask me and see that I have time to create them .... the test remains on you as this is for you, for now you only have these mods.. -> MODS -> AnnounceKillBoss -> AntiBot -> ColorAccordingAmountPvPorPk -> EnchantAbnormalEffectArmor -> FakePlayer -> NewCharacterCreated -> OfflineShop -> PvpReward -> SellBuffs -> SpreeKills -> SubClassAcumulatives -> SystemAio -> SystemVip -> VoteReward -> EVENTS -> BonusWeekend -> Champions -> CityElpys -> RandomBossSpawn -> NPC -> NpcBufferScheme. -> NpcClassMaster. -> NpcRanking. -> NpcTeleporter. -> NpcVoteRewardHopzone. -> NpcVoteRewardNetwork. -> NpcVoteRewardTopzone.
  14. Hello i found this website vote system on my files and i would like to share it. You can see how it works here: Code: https://pastebin.com/sKhsKfbh Site: https://www110.zippyshare.com/v/nl2ghgap/file.htm The last time I checked it was working properly. (Ι don't remember who made it i think Atlas or something like that)
  15. ### Eclipse Workspace Patch 1.0 #P aCis_Gameserver Index: java/net/sf/l2j/gameserver/model/multisell/Ingredient.java =================================================================== --- java/net/sf/l2j/gameserver/model/multisell/Ingredient.java (revision 15) +++ java/net/sf/l2j/gameserver/model/multisell/Ingredient.java (working copy) @@ -22,14 +22,14 @@ public Ingredient(StatsSet set) { + this(set.getInteger("id"), set.getInteger("count"), set.getInteger("enchantmentLevel", 0), set.getBool("isTaxIngredient", false), set.getBool("maintainIngredient", false)); - this(set.getInteger("id"), set.getInteger("count"), set.getBool("isTaxIngredient", false), set.getBool("maintainIngredient", false)); } + public Ingredient(int itemId, int itemCount, int enchantmentLevel, boolean isTaxIngredient, boolean maintainIngredient) - public Ingredient(int itemId, int itemCount, boolean isTaxIngredient, boolean maintainIngredient) { _itemId = itemId; _itemCount = itemCount; + _enchantmentLevel = enchantmentLevel; - _isTaxIngredient = isTaxIngredient; _maintainIngredient = maintainIngredient; @@ -42,7 +42,7 @@ */ public Ingredient getCopy() { + return new Ingredient(_itemId, _itemCount, _enchantmentLevel, _isTaxIngredient, _maintainIngredient); - return new Ingredient(_itemId, _itemCount, _isTaxIngredient, _maintainIngredient); } public final int getItemId() Index: java/net/sf/l2j/gameserver/model/multisell/PreparedEntry.java =================================================================== --- java/net/sf/l2j/gameserver/model/multisell/PreparedEntry.java (revision 15) +++ java/net/sf/l2j/gameserver/model/multisell/PreparedEntry.java (working copy) @@ -48,7 +48,7 @@ // now add the adena, if any. adenaAmount += _taxAmount; // do not forget tax if (adenaAmount > 0) + _ingredients.add(new Ingredient(57, adenaAmount, 0, false, false)); - _ingredients.add(new Ingredient(57, adenaAmount, false, false)); // now copy products _products = new ArrayList<>(template.getProducts().size());
  16. Hello there.. Here is a Multi Shop [services/Donate Npc] with a lot of things inside.. Also, inside include VIP System. What's inside? Noblesse Status Level up your clan Add x Reputation score Get full clan skills Augment Skills Lv10. [Active/Passive] Clean x Pk Kills Change your sex Vip 7/15/30 Days Make the player VIP Setlevel [Levelup the player] Change your Main Class Change your password Get full Recomments Siege Register Register your clan for sieges. Change your name color. Green, Blue, Purple, Yellow, Gold Party Teleport Go to your party member. Clan Teleport Go to your Clan member. Teleport Restrictions: Sieges, Olympiad, Events, Party Rift, jail, Duel, ObserverMode(oly), Non-Party members. Change your name. Enchant your items to max enchant. Code preview: https://pastebin.com/GuBQn7yT DOWNLOAD: MultiShop Some(the most) of those checks can be easily bypassed if you know how. I won't give you the way to fix those checks. So, I mentioned this just to have a clue. Good luck. VIDEO PREVIEW
  17. Hello i want to share this ingame balancer its for acis 372 its useless for me now. Files/Code: https://www101.zippyshare.com/v/nMPZpOej/file.html
  18. Good evening MXCers i would like to Request from all of you to test our New vote reward system that works for mostly all l2p/f/s packs ( thanks to L2-Scripts , L2s-Guard Team for that ). Please for any bugs, problems inform us ! Download link here: You can find also our files on Control panel Toplist: https://l2network.eu/ Credits: L2-Scripts Regards, L2Network.EU & L2TopNetwork.com
  19. java/net/sf/l2j/gameserver/model/base/Experience.java public class Experience { public final static long LEVEL[] = { -1L, // level 0 (unreachable) 0L, 68L, 363L, 1168L, 2884L, 6038L, 11287L, 19423L, 31378L, 48229L, // level 10 71201L, 101676L, 141192L, 191452L, 254327L, 331864L, 426284L, 539995L, 675590L, 835854L, // level 20 1023775L, 1242536L, 1495531L, 1786365L, 2118860L, 2497059L, 2925229L, 3407873L, 3949727L, 4555766L, // level 30 5231213L, 5981539L, 6812472L, 7729999L, 8740372L, 9850111L, 11066012L, 12395149L, 13844879L, 15422851L, // level 40 17137002L, 18995573L, 21007103L, 23180442L, 25524751L, 28049509L, 30764519L, 33679907L, 36806133L, 40153995L, // level 50 45524865L, 51262204L, 57383682L, 63907585L, 70852742L, 80700339L, 91162131L, 102265326L, 114038008L, 126509030L, // level 60 146307211L, 167243291L, 189363788L, 212716741L, 237351413L, 271973532L, 308441375L, 346825235L, 387197529L, 429632402L, // level 70 474205751L, 532692055L, 606319094L, 696376867L, 804219972L, 931275828L, 1151275834L, 1511275834L, 2099275834L, 4200000000L, // level 80 6299994999L, 10499905559L, 16800005559L, 27299995559L, 44100005559L, //level 85 71400000000L }; /** * This is the first UNREACHABLE level.<BR> * ex: If you want a max at 85 & 99.99%, you have to put 86.<BR> * <BR> */ public final static byte MAX_LEVEL = 86; public final static byte MIN_NEWBIE_LEVEL = 6; public final static byte MAX_NEWBIE_LEVEL = 25; } com/l2jserver/gameserver/model/base/Experience.java public class Experience { public final static long LEVEL[] = { -1L, // level 0 (unreachable) 0L, 68L, 363L, 1168L, 2884L, 6038L, 11287L, 19423L, 31378L, 48229L, //level 10 71201L, 101676L, 141192L, 191452L, 254327L, 331864L, 426284L, 539995L, 675590L, 835854L, //level 20 1023775L, 1242536L, 1495531L, 1786365L, 2118860L, 2497059L, 2925229L, 3407873L, 3949727L, 4555766L, //level 30 5231213L, 5981539L, 6812472L, 7729999L, 8740372L, 9850111L, 11066012L, 12395149L, 13844879L, 15422851L, //level 40 17137002L, 18995573L, 21007103L, 23180442L, 25524751L, 28049509L, 30764519L, 33679907L, 36806133L, 40153995L, //level 50 45524865L, 51262204L, 57383682L, 63907585L, 70852742L, 80700339L, 91162131L, 102265326L, 114038008L, 126509030L, //level 60 146307211L, 167243291L, 189363788L, 212716741L, 237351413L, 271973532L, 308441375L, 346825235L, 387197529L, 429632402L, //level 70 474205751L, 532692055L, 606319094L, 696376867L, 804219972L, 931275828L, 1151275834L, 1511275834L, 2099275834L, 4200000000L, //level 80 6299994999L, 10499905559L, 16800005559L, 27299995559L, 44100005559L, //level 85 71400000000L }; /** * This is the first UNREACHABLE level.<BR> * ex: If you want a max at 85 & 99.99%, you have to put 86.<BR><BR> */ public final static byte MAX_LEVEL = 86; public final static byte MIN_NEWBIE_LEVEL = 6; public final static byte MAX_NEWBIE_LEVEL = 25; L2JFrozen: data/stats/experience.xml <?xml version="1.0" encoding="UTF-8"?> <table maxLevel="85" maxPetLevel="80" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../xsd/experience.xsd"> <experience level="1" tolevel="0" /> <experience level="2" tolevel="68" /> <experience level="3" tolevel="363" /> <experience level="4" tolevel="1168" /> <experience level="5" tolevel="2884" /> <experience level="6" tolevel="6038" /> <experience level="7" tolevel="11287" /> <experience level="8" tolevel="19423" /> <experience level="9" tolevel="31378" /> <experience level="10" tolevel="48229" /> <experience level="11" tolevel="71201" /> <experience level="12" tolevel="101676" /> <experience level="13" tolevel="141192" /> <experience level="14" tolevel="191452" /> <experience level="15" tolevel="254327" /> <experience level="16" tolevel="331864" /> <experience level="17" tolevel="426284" /> <experience level="18" tolevel="539995" /> <experience level="19" tolevel="675590" /> <experience level="20" tolevel="835854" /> <experience level="21" tolevel="1023775" /> <experience level="22" tolevel="1242536" /> <experience level="23" tolevel="1495531" /> <experience level="24" tolevel="1786365" /> <experience level="25" tolevel="2118860" /> <experience level="26" tolevel="2497059" /> <experience level="27" tolevel="2925229" /> <experience level="28" tolevel="3407873" /> <experience level="29" tolevel="3949727" /> <experience level="30" tolevel="4555766" /> <experience level="31" tolevel="5231213" /> <experience level="32" tolevel="5981539" /> <experience level="33" tolevel="6812472" /> <experience level="34" tolevel="7729999" /> <experience level="35" tolevel="8740372" /> <experience level="36" tolevel="9850111" /> <experience level="37" tolevel="11066012" /> <experience level="38" tolevel="12395149" /> <experience level="39" tolevel="13844879" /> <experience level="40" tolevel="15422851" /> <experience level="41" tolevel="17137002" /> <experience level="42" tolevel="18995573" /> <experience level="43" tolevel="21007103" /> <experience level="44" tolevel="23180442" /> <experience level="45" tolevel="25524751" /> <experience level="46" tolevel="28049509" /> <experience level="47" tolevel="30764519" /> <experience level="48" tolevel="33679907" /> <experience level="49" tolevel="36806133" /> <experience level="50" tolevel="40153995" /> <experience level="51" tolevel="45524865" /> <experience level="52" tolevel="51262204" /> <experience level="53" tolevel="57383682" /> <experience level="54" tolevel="63907585" /> <experience level="55" tolevel="70852742" /> <experience level="56" tolevel="80700339" /> <experience level="57" tolevel="91162131" /> <experience level="58" tolevel="102265326" /> <experience level="59" tolevel="114038008" /> <experience level="60" tolevel="126509030" /> <experience level="61" tolevel="146307211" /> <experience level="62" tolevel="167243291" /> <experience level="63" tolevel="189363788" /> <experience level="64" tolevel="212716741" /> <experience level="65" tolevel="237351413" /> <experience level="66" tolevel="271973532" /> <experience level="67" tolevel="308441375" /> <experience level="68" tolevel="346825235" /> <experience level="69" tolevel="387197529" /> <experience level="70" tolevel="429632402" /> <experience level="71" tolevel="474205751" /> <experience level="72" tolevel="532692055" /> <experience level="73" tolevel="606319094" /> <experience level="74" tolevel="696376867" /> <experience level="75" tolevel="804219972" /> <experience level="76" tolevel="931275828" /> <experience level="77" tolevel="1151275834" /> <experience level="78" tolevel="1511275834" /> <experience level="79" tolevel="2099275834" /> <experience level="80" tolevel="4200000000" /> <experience level="81" tolevel="6299994999" /> <experience level="82" tolevel="10499905559" /> <experience level="83" tolevel="16800005559" /> <experience level="84" tolevel="27299995559" /> <experience level="85" tolevel="44100005559" /> </table> L2JFrozen: data/xsd/experience.xsd <?xml version="1.0" encoding="UTF-8"?> <schema xmlns="http://www.w3.org/2001/XMLSchema"> <element name="table"> <complexType> <sequence minOccurs="1" maxOccurs="1"> <element name="experience" minOccurs="1" maxOccurs="80"> <complexType> <attribute name="level" use="required"> <simpleType> <restriction base="positiveInteger"> <minInclusive value="1" /> <maxInclusive value="85" /> </restriction> </simpleType> </attribute> <attribute name="tolevel" type="nonNegativeInteger" use="required" /> </complexType> </element> </sequence> <attribute name="maxLevel" use="required"> <simpleType> <restriction base="positiveInteger"> <minInclusive value="1" /> <maxInclusive value="85" /> </restriction> </simpleType> </attribute> <attribute name="maxPetLevel" use="required"> <simpleType> <restriction base="positiveInteger"> <minInclusive value="1" /> <maxInclusive value="85" /> </restriction> </simpleType> </attribute> </complexType> </element> </schema> pistevo 8a sas aresi ;)
  20. http://www.4shared.com/img/PnpeKHRNce/s25/157e7930310/image http://www.4shared.com/rar/WiimsNndba/antibot.html Download data files ACIS: ### Eclipse Workspace Patch 1.0 #P aCis_gameserver Index: java/net/sf/l2j/gameserver/datatables/AntiBotTable.java =================================================================== --- java/net/sf/l2j/gameserver/datatables/AntiBotTable.java (revision 0) +++ java/net/sf/l2j/gameserver/datatables/AntiBotTable.java (revision 0) @@ -0,0 +1,183 @@ +/* + * 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.datatables; + +import java.io.ByteArrayOutputStream; +import java.io.File; +import java.io.FileInputStream; +import java.io.IOException; +import java.util.HashMap; +import java.util.Map; +import java.util.Map.Entry; +import java.util.logging.Level; +import java.util.logging.Logger; + +import net.sf.l2j.gameserver.ThreadPoolManager; +import net.sf.l2j.gameserver.model.actor.instance.L2PcInstance; +import net.sf.l2j.gameserver.network.serverpackets.PledgeImage; +import net.sf.l2j.util.Rnd; + +/** + * + * @author Fissban + * + */ +public class AntiBotTable +{ + public static Logger _log = Logger.getLogger(AntiBotTable.class.getName()); + + public static Map<Integer, antiBotData> _imageAntiBotOri = new HashMap<>(); + public static Map<Integer, antiBotData> _imageAntiBotClient = new HashMap<>(); + + public final static int[] img_antibot_id = + { + 7000, 7001, 7002, 7003, 7004, 7005, 7006, 7007, 7008, 7009 + }; + + public void loadImage() + { + LoadImgAntiBot(); + _log.log(Level.INFO, "loading " + _imageAntiBotOri.size() + " images of AntiBot"); + } + + private static void LoadImgAntiBot() + { + _imageAntiBotOri.clear(); + int cont = 0; + + for (int imgId : img_antibot_id) + { + File image = new File("data/images/antibot/" + imgId + ".dds"); + _imageAntiBotOri.put(cont, new antiBotData(cont, ConverterImgBytes(image))); + cont++; + } + + ThreadPoolManager.getInstance().scheduleGeneralAtFixedRate(new startEncriptCaptcha(), 100, 600000); // 10 Minutes + } + + public void sendImage(L2PcInstance player, int imgId) + { + PledgeImage packet = null; + + if ((imgId >= 50000) && (imgId <= 800000)) + { + for (Entry<Integer, antiBotData> entrySet : _imageAntiBotClient.entrySet()) + { + antiBotData imgCoding = entrySet.getValue(); + + if (imgId == imgCoding.getCodificacion()) + { + packet = new PledgeImage(imgId, imgCoding.getImagen()); + } + } + } + + player.sendPacket(packet); + } + + public static class startEncriptCaptcha implements Runnable + { + public startEncriptCaptcha() + { + + } + + @Override + public void run() + { + _imageAntiBotClient.clear(); + + for (Entry<Integer, antiBotData> entrySet : _imageAntiBotOri.entrySet()) + { + entrySet.getValue().getImagen(); + _imageAntiBotClient.put(entrySet.getKey(), new antiBotData(Rnd.get(50000, 800000), entrySet.getValue().getImagen())); + } + } + } + + public int getAntiBotClientID(int pos) + { + int returnCoding = 0; + + for (Entry<Integer, antiBotData> entrySet : _imageAntiBotClient.entrySet()) + { + int numeroImage = entrySet.getKey().intValue(); + + if (pos == numeroImage) + { + antiBotData imgCoding = entrySet.getValue(); + returnCoding = imgCoding.getCodificacion(); + } + + if (pos > 9) + { + _log.log(Level.SEVERE, "error in getAntiBotClientID...number dont exist"); + } + } + return returnCoding; + } + + public static class antiBotData + { + int _codificacion; + byte[] _data; + + public antiBotData(int codificacion, byte[] data) + { + _codificacion = codificacion; + _data = data; + } + + public int getCodificacion() + { + return _codificacion; + } + + public byte[] getImagen() + { + return _data; + } + } + + private static byte[] ConverterImgBytes(File imagen) + { + ByteArrayOutputStream bos = new ByteArrayOutputStream(); + + byte[] buffer = new byte[1024]; + try (FileInputStream fis = new FileInputStream(imagen)) + { + for (int readNum; (readNum = fis.read(buffer)) != -1;) + { + bos.write(buffer, 0, readNum); + } + } + catch (IOException e) + { + _log.log(Level.SEVERE, "Error when converter image to byte[]"); + } + + return bos.toByteArray(); + } + + public static AntiBotTable getInstance() + { + return SingletonHolder._instance; + } + + private static class SingletonHolder + { + protected static final AntiBotTable _instance = new AntiBotTable(); + } +} Index: java/net/sf/l2j/gameserver/GameServer.java =================================================================== --- java/net/sf/l2j/gameserver/GameServer.java (revision 13) +++ java/net/sf/l2j/gameserver/GameServer.java (working copy) @@ -35,6 +35,7 @@ import net.sf.l2j.gameserver.communitybbs.Manager.ForumsBBSManager; import net.sf.l2j.gameserver.datatables.AccessLevels; import net.sf.l2j.gameserver.datatables.AdminCommandAccessRights; +import net.sf.l2j.gameserver.datatables.AntiBotTable; import net.sf.l2j.gameserver.datatables.ArmorSetsTable; import net.sf.l2j.gameserver.datatables.AugmentationData; import net.sf.l2j.gameserver.datatables.BookmarkTable; @@ -309,6 +310,8 @@ MovieMakerManager.getInstance(); + AntiBotTable.getInstance().loadImage(); + if (Config.DEADLOCK_DETECTOR) { _log.info("Deadlock detector is enabled. Timer: " + Config.DEADLOCK_CHECK_INTERVAL + "s."); Index: java/net/sf/l2j/Config.java =================================================================== --- java/net/sf/l2j/Config.java (revision 13) +++ java/net/sf/l2j/Config.java (working copy) @@ -513,6 +513,13 @@ public static boolean STORE_SKILL_COOLTIME; public static int BUFFS_MAX_AMOUNT; + /** AntiBot */ + public static boolean ANTIBOT_ENABLE; + public static int ANTIBOT_TIME_JAIL; + public static int ANTIBOT_TIME_VOTE; + public static int ANTIBOT_KILL_MOBS; + public static int ANTIBOT_MIN_LEVEL; + // -------------------------------------------------- // Server // -------------------------------------------------- @@ -1110,6 +1117,12 @@ BUFFS_MAX_AMOUNT = players.getProperty("MaxBuffsAmount", 20); STORE_SKILL_COOLTIME = players.getProperty("StoreSkillCooltime", true); + ANTIBOT_ENABLE = players.getProperty("AntiBotEnable", true); + ANTIBOT_TIME_JAIL = players.getProperty("AntiBotTimeJail", 1); + ANTIBOT_TIME_VOTE = players.getProperty("AntiBotTimeVote", 30); + ANTIBOT_KILL_MOBS = players.getProperty("AntiBotKillMobs", 1); + ANTIBOT_MIN_LEVEL = players.getProperty("AntiBotMinLevel", 1); + // server ExProperties server = load(SERVER_FILE); Index: java/net/sf/l2j/gameserver/network/clientpackets/RequestBypassToServer.java =================================================================== --- java/net/sf/l2j/gameserver/network/clientpackets/RequestBypassToServer.java (revision 13) +++ java/net/sf/l2j/gameserver/network/clientpackets/RequestBypassToServer.java (working copy) @@ -179,6 +179,18 @@ final int arenaId = Integer.parseInt(_command.substring(12).trim()); activeChar.enterOlympiadObserverMode(arenaId); } + else if (_command.startsWith("antibot")) + { + StringTokenizer st = new StringTokenizer(_command); + st.nextToken(); + + if (st.hasMoreTokens()) + { + activeChar.checkCode(st.nextToken()); + return; + } + activeChar.checkCode("Fail"); + } } catch (Exception e) { Index: java/net/sf/l2j/gameserver/network/clientpackets/Say2.java =================================================================== --- java/net/sf/l2j/gameserver/network/clientpackets/Say2.java (revision 13) +++ java/net/sf/l2j/gameserver/network/clientpackets/Say2.java (working copy) @@ -49,6 +49,7 @@ public final static int PARTYROOM_COMMANDER = 15; // (Yellow) public final static int PARTYROOM_ALL = 16; // (Red) public final static int HERO_VOICE = 17; + public final static int CRITICAL_ANNOUNCE = 18; private final static String[] CHAT_NAMES = { @@ -69,7 +70,8 @@ "PARTYMATCH_ROOM", "PARTYROOM_COMMANDER", "PARTYROOM_ALL", - "HERO_VOICE" + "HERO_VOICE", + "CRITICAL_ANNOUNCE" }; private static final String[] WALKER_COMMAND_LIST = Index: java/net/sf/l2j/gameserver/network/serverpackets/PledgeImage.java =================================================================== --- java/net/sf/l2j/gameserver/network/serverpackets/PledgeImage.java (revision 0) +++ java/net/sf/l2j/gameserver/network/serverpackets/PledgeImage.java (revision 0) @@ -0,0 +1,44 @@ +/* + * 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.network.serverpackets; + +public class PledgeImage extends L2GameServerPacket +{ + private final int _crestId; + private final byte[] _data; + + public PledgeImage(int crestId, byte[] data) + { + _crestId = crestId; + _data = data; + } + + @Override + protected final void writeImpl() + { + writeC(0x6c); + writeD(_crestId); + + if (_data != null) + { + writeD(_data.length); + writeB(_data); + } + else + { + writeD(0); + } + } +} \ 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 13) +++ java/net/sf/l2j/gameserver/model/actor/instance/L2PcInstance.java (working copy) @@ -48,6 +48,7 @@ import net.sf.l2j.gameserver.communitybbs.BB.Forum; import net.sf.l2j.gameserver.communitybbs.Manager.ForumsBBSManager; import net.sf.l2j.gameserver.datatables.AccessLevels; +import net.sf.l2j.gameserver.datatables.AntiBotTable; import net.sf.l2j.gameserver.datatables.CharNameTable; import net.sf.l2j.gameserver.datatables.CharTemplateTable; import net.sf.l2j.gameserver.datatables.ClanTable; @@ -157,12 +158,14 @@ import net.sf.l2j.gameserver.model.zone.type.L2BossZone; import net.sf.l2j.gameserver.network.L2GameClient; import net.sf.l2j.gameserver.network.SystemMessageId; +import net.sf.l2j.gameserver.network.clientpackets.Say2; import net.sf.l2j.gameserver.network.serverpackets.AbstractNpcInfo; import net.sf.l2j.gameserver.network.serverpackets.ActionFailed; import net.sf.l2j.gameserver.network.serverpackets.ChairSit; import net.sf.l2j.gameserver.network.serverpackets.ChangeWaitType; import net.sf.l2j.gameserver.network.serverpackets.CharInfo; import net.sf.l2j.gameserver.network.serverpackets.ConfirmDlg; +import net.sf.l2j.gameserver.network.serverpackets.CreatureSay; import net.sf.l2j.gameserver.network.serverpackets.EtcStatusUpdate; import net.sf.l2j.gameserver.network.serverpackets.ExAutoSoulShot; import net.sf.l2j.gameserver.network.serverpackets.ExDuelUpdateUserInfo; @@ -170,6 +173,7 @@ import net.sf.l2j.gameserver.network.serverpackets.ExFishingStart; import net.sf.l2j.gameserver.network.serverpackets.ExOlympiadMode; import net.sf.l2j.gameserver.network.serverpackets.ExSetCompassZoneCode; +import net.sf.l2j.gameserver.network.serverpackets.ExShowScreenMessage; import net.sf.l2j.gameserver.network.serverpackets.ExStorageMaxCount; import net.sf.l2j.gameserver.network.serverpackets.FriendList; import net.sf.l2j.gameserver.network.serverpackets.GetOnVehicle; @@ -219,6 +223,7 @@ import net.sf.l2j.gameserver.network.serverpackets.TradePressOwnOk; import net.sf.l2j.gameserver.network.serverpackets.TradeStart; import net.sf.l2j.gameserver.network.serverpackets.UserInfo; +import net.sf.l2j.gameserver.skills.AbnormalEffect; import net.sf.l2j.gameserver.skills.Env; import net.sf.l2j.gameserver.skills.Formulas; import net.sf.l2j.gameserver.skills.Stats; @@ -364,6 +369,11 @@ } } + private String _code = ""; + private int _attempt = 0; + private int _mobs_dead = 0; + public static ScheduledFuture<?> _antiBotTask; + private L2GameClient _client; private String _accountName; @@ -10647,4 +10657,183 @@ } } } + + // AntiBoot + public void antibot() + { + increaseMobsDead(); + + if (getMobsDead() >= Config.ANTIBOT_KILL_MOBS) + { + resetMobsDead(); + _antiBotTask = ThreadPoolManager.getInstance().scheduleGeneral(new startAntiBotTask(), Config.ANTIBOT_TIME_VOTE * 1000); + } + } + + private static void stopAntiBotTask() + { + if (_antiBotTask != null) + { + _antiBotTask.cancel(false); + _antiBotTask = null; + } + } + + private class startAntiBotTask implements Runnable + { + public startAntiBotTask() + { + setIsParalyzed(true); + setIsInvul(true); + startAbnormalEffect(AbnormalEffect.FLOATING_ROOT); + sendPacket(new ExShowScreenMessage("[AntiBot]: You have " + Config.ANTIBOT_TIME_VOTE + " to confirm the Captcha!", 10000)); + getActingPlayer().sendPacket(new CreatureSay(0, Say2.CRITICAL_ANNOUNCE, "[AntiBot]:", "You have " + Config.ANTIBOT_TIME_VOTE + " to confirm the Catpcha.")); + showHtml_Start(); + } + + @Override + public void run() + { + if (!isInJail()) + { + sendPacket(new CreatureSay(0, Say2.HERO_VOICE, "[AntiBot]:", "Your time limit has elapsed.")); + increaseAttempt(); + + if (getAttempt() >= 3) + { + setIsParalyzed(false); + setIsInvul(false); + startAbnormalEffect(AbnormalEffect.FLOATING_ROOT); + getActingPlayer().setPunishLevel(L2PcInstance.PunishLevel.JAIL, Config.ANTIBOT_TIME_JAIL); + getActingPlayer().sendPacket(new CreatureSay(0, Say2.HERO_VOICE, "[AntiBot]:", "Character " + getName() + " jailed for " + Config.ANTIBOT_TIME_JAIL + " minutes.")); + _log.warning("[AntiBot]: Character " + getName() + " jailed for " + Config.ANTIBOT_TIME_JAIL + " minutes."); + } + else + { + _antiBotTask = ThreadPoolManager.getInstance().scheduleGeneral(new startAntiBotTask(), Config.ANTIBOT_TIME_VOTE * 1000); + } + } + } + } + + public String num2img(int numero) + { + String num = Integer.toString(numero); + char[] digitos = num.toCharArray(); + + String tmp = ""; + for(int x=0;x<num.length();x++) + { + int dig = Integer.parseInt(Character.toString(digitos[x])); + final int it = AntiBotTable.getInstance().getAntiBotClientID(dig); + AntiBotTable.getInstance().sendImage(this, it); + tmp += "<img src=Crest.crest_" + Config.SERVER_ID + "_" + it + " width=38 height=33 align=left>"; + } + + return tmp; + } + + public void showHtml_Start() + { + NpcHtmlMessage html = new NpcHtmlMessage(0); + html.setFile("data/html/antiBot/start.htm"); + + html.replace("%playerName%", getName()); + html.replace("%attemp%", String.valueOf(3 - getAttempt())); + int maxR = 3; + + String random = new String(); + + for(int x = 0; x<maxR; x++) + random += Integer.toString(Rnd.get(0,9)); + + html.replace("%code1%",num2img(Integer.parseInt(random))); + + this.sendPacket(html); + setCode(String.valueOf(Integer.parseInt(random))); + } + + public void showHtml_End() + { + NpcHtmlMessage html = new NpcHtmlMessage(0); + html.setFile("data/html/antiBot/end.htm"); + html.replace("%playerName%", getName()); + + this.sendPacket(html); + } + + public void checkCode(String code) + { + if (code.equals(getCode())) + { + stopAntiBotTask(); + resetAttempt(); + + sendPacket(new CreatureSay(0, Say2.HERO_VOICE, "[AntiBot]:", "Congratulations, has passed control.")); + setIsParalyzed(false); + setIsInvul(false); + stopAbnormalEffect(AbnormalEffect.FLOATING_ROOT); + } + else + { + stopAntiBotTask(); + increaseAttempt(); + + _antiBotTask = ThreadPoolManager.getInstance().scheduleGeneral(new startAntiBotTask(), Config.ANTIBOT_TIME_VOTE * 1000); + } + + if (getAttempt() >= 3) + { + stopAntiBotTask(); + resetAttempt(); + + setIsParalyzed(false); + setIsInvul(false); + startAbnormalEffect(AbnormalEffect.FLOATING_ROOT); + + setPunishLevel(PunishLevel.JAIL, Config.ANTIBOT_TIME_JAIL); + sendPacket(new CreatureSay(0, Say2.HERO_VOICE, "[AntiBot]:", "Character " + getName() + " jailed for " + Config.ANTIBOT_TIME_JAIL + " minutes.")); + _log.warning("[AntiBot]: Character " + getName() + " jailed for " + Config.ANTIBOT_TIME_JAIL + " minutes."); + } + } + + private int getMobsDead() + { + return _mobs_dead; + } + + private void increaseMobsDead() + { + _mobs_dead++; + } + + private void resetMobsDead() + { + _mobs_dead = 0; + } + + private void setCode(String code) + { + _code = code; + } + + private String getCode() + { + return _code; + } + + public void increaseAttempt() + { + _attempt += 1; + } + + public int getAttempt() + { + return _attempt; + } + + public void resetAttempt() + { + _attempt = 0; + } } \ No newline at end of file Index: java/net/sf/l2j/gameserver/model/actor/L2Attackable.java =================================================================== --- java/net/sf/l2j/gameserver/model/actor/L2Attackable.java (revision 13) +++ java/net/sf/l2j/gameserver/model/actor/L2Attackable.java (working copy) @@ -450,6 +450,12 @@ if (!super.doDie(killer)) return false; + // AntiBot + if (Config.ANTIBOT_ENABLE && (killer != null) && killer instanceof L2PcInstance && (killer.getLevel() >= Config.ANTIBOT_MIN_LEVEL)) + { + killer.getActingPlayer().antibot(); + } + // Notify the Quest Engine of the L2Attackable death if necessary try { Index: config/players.properties =================================================================== --- config/players.properties (revision 13) +++ config/players.properties (working copy) @@ -294,4 +294,23 @@ MaxBuffsAmount = 20 # Store buffs/debuffs on user logout? -StoreSkillCooltime = True \ No newline at end of file +StoreSkillCooltime = True + +#============================================================= +# AntiBot +#============================================================= + +# AntiBot. True to enable, False to disable. +AntiBotEnable = True + +# Time the user will be in jail in minutes. +AntiBotTimeJail = 10 + +# Time that the user will have to control captcha in seconds. +AntiBotTimeVote = 40 + +# Dead mobs needed for captcha. +AntiBotKillMobs = 100 + +# Level min need for captcha. +AntiBotMinLevel = 1 \ No newline at end of file Frozen: ### Eclipse Workspace Patch 1.0 #P L2jFrozen_GameServer Index: head-src/com/l2jfrozen/gameserver/model/L2Attackable.java =================================================================== --- head-src/com/l2jfrozen/gameserver/model/L2Attackable.java (revision 1118) +++ head-src/com/l2jfrozen/gameserver/model/L2Attackable.java (working copy) @@ -542,6 +542,12 @@ LOGGER.error("", e); } + // AntiBot + if (Config.ANTIBOT_ENABLE && (killer != null) && killer instanceof L2PcInstance && (killer.getLevel() >= Config.ANTIBOT_MIN_LEVEL)) + { + killer.getActingPlayer().antibot(); + } + // Notify the Quest Engine of the L2Attackable death if necessary try { Index: head-src/com/l2jfrozen/gameserver/datatables/AntiBotTable.java =================================================================== --- head-src/com/l2jfrozen/gameserver/datatables/AntiBotTable.java (revision 0) +++ head-src/com/l2jfrozen/gameserver/datatables/AntiBotTable.java (revision 0) @@ -0,0 +1,183 @@ +/* + * 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 com.l2jfrozen.gameserver.datatables; + +import java.io.ByteArrayOutputStream; +import java.io.File; +import java.io.FileInputStream; +import java.io.IOException; +import java.util.HashMap; +import java.util.Map; +import java.util.Map.Entry; +import java.util.logging.Level; +import java.util.logging.Logger; + +import com.l2jfrozen.gameserver.model.actor.instance.L2PcInstance; +import com.l2jfrozen.gameserver.network.serverpackets.PledgeImage; +import com.l2jfrozen.gameserver.thread.ThreadPoolManager; +import com.l2jfrozen.util.random.Rnd; + +/** + * + * @author Fissban + * + */ +public class AntiBotTable +{ + public static Logger _log = Logger.getLogger(AntiBotTable.class.getName()); + + public static Map<Integer, antiBotData> _imageAntiBotOri = new HashMap<>(); + public static Map<Integer, antiBotData> _imageAntiBotClient = new HashMap<>(); + + public final static int[] img_antibot_id = + { + 7000, 7001, 7002, 7003, 7004, 7005, 7006, 7007, 7008, 7009 + }; + + public void loadImage() + { + LoadImgAntiBot(); + _log.log(Level.INFO, "loading " + _imageAntiBotOri.size() + " images of AntiBot"); + } + + private static void LoadImgAntiBot() + { + _imageAntiBotOri.clear(); + int cont = 0; + + for (int imgId : img_antibot_id) + { + File image = new File("data/images/antibot/" + imgId + ".dds"); + _imageAntiBotOri.put(cont, new antiBotData(cont, ConverterImgBytes(image))); + cont++; + } + + ThreadPoolManager.getInstance().scheduleGeneralAtFixedRate(new startEncriptCaptcha(), 100, 600000); // 10 Minutes + } + + public void sendImage(L2PcInstance player, int imgId) + { + PledgeImage packet = null; + + if ((imgId >= 50000) && (imgId <= 800000)) + { + for (Entry<Integer, antiBotData> entrySet : _imageAntiBotClient.entrySet()) + { + antiBotData imgCoding = entrySet.getValue(); + + if (imgId == imgCoding.getCodificacion()) + { + packet = new PledgeImage(imgId, imgCoding.getImagen()); + } + } + } + + player.sendPacket(packet); + } + + public static class startEncriptCaptcha implements Runnable + { + public startEncriptCaptcha() + { + + } + + @Override + public void run() + { + _imageAntiBotClient.clear(); + + for (Entry<Integer, antiBotData> entrySet : _imageAntiBotOri.entrySet()) + { + entrySet.getValue().getImagen(); + _imageAntiBotClient.put(entrySet.getKey(), new antiBotData(Rnd.get(50000, 800000), entrySet.getValue().getImagen())); + } + } + } + + public int getAntiBotClientID(int pos) + { + int returnCoding = 0; + + for (Entry<Integer, antiBotData> entrySet : _imageAntiBotClient.entrySet()) + { + int numeroImage = entrySet.getKey().intValue(); + + if (pos == numeroImage) + { + antiBotData imgCoding = entrySet.getValue(); + returnCoding = imgCoding.getCodificacion(); + } + + if (pos > 9) + { + _log.log(Level.SEVERE, "error in getAntiBotClientID...number dont exist"); + } + } + return returnCoding; + } + + public static class antiBotData + { + int _codificacion; + byte[] _data; + + public antiBotData(int codificacion, byte[] data) + { + _codificacion = codificacion; + _data = data; + } + + public int getCodificacion() + { + return _codificacion; + } + + public byte[] getImagen() + { + return _data; + } + } + + private static byte[] ConverterImgBytes(File imagen) + { + ByteArrayOutputStream bos = new ByteArrayOutputStream(); + + byte[] buffer = new byte[1024]; + try (FileInputStream fis = new FileInputStream(imagen)) + { + for (int readNum; (readNum = fis.read(buffer)) != -1;) + { + bos.write(buffer, 0, readNum); + } + } + catch (IOException e) + { + _log.log(Level.SEVERE, "Error when converter image to byte[]"); + } + + return bos.toByteArray(); + } + + public static AntiBotTable getInstance() + { + return SingletonHolder._instance; + } + + private static class SingletonHolder + { + protected static final AntiBotTable _instance = new AntiBotTable(); + } +} \ No newline at end of file Index: head-src/com/l2jfrozen/gameserver/network/serverpackets/PledgeImage.java =================================================================== --- head-src/com/l2jfrozen/gameserver/network/serverpackets/PledgeImage.java (revision 0) +++ head-src/com/l2jfrozen/gameserver/network/serverpackets/PledgeImage.java (revision 0) @@ -0,0 +1,50 @@ +/* + * 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 com.l2jfrozen.gameserver.network.serverpackets; + +public class PledgeImage extends L2GameServerPacket +{ + private final int _crestId; + private final byte[] _data; + + public PledgeImage(int crestId, byte[] data) + { + _crestId = crestId; + _data = data; + } + + @Override + protected final void writeImpl() + { + writeC(0x6c); + writeD(_crestId); + + if (_data != null) + { + writeD(_data.length); + writeB(_data); + } + else + { + writeD(0); + } + } + + @Override + public String getType() + { + return null; + } +} Index: head-src/com/l2jfrozen/gameserver/GameServer.java =================================================================== --- head-src/com/l2jfrozen/gameserver/GameServer.java (revision 1118) +++ head-src/com/l2jfrozen/gameserver/GameServer.java (working copy) @@ -44,6 +44,7 @@ import com.l2jfrozen.gameserver.controllers.GameTimeController; import com.l2jfrozen.gameserver.controllers.RecipeController; import com.l2jfrozen.gameserver.controllers.TradeController; +import com.l2jfrozen.gameserver.datatables.AntiBotTable; import com.l2jfrozen.gameserver.datatables.GmListTable; import com.l2jfrozen.gameserver.datatables.HeroSkillTable; import com.l2jfrozen.gameserver.datatables.NobleSkillTable; @@ -423,6 +424,9 @@ AdminCommandAccessRights.getInstance(); GmListTable.getInstance(); + Util.printSection("AntiBot"); + AntiBotTable.getInstance().loadImage(); + Util.printSection("Handlers"); ItemHandler.getInstance(); SkillHandler.getInstance(); Index: config/head/other.properties =================================================================== --- config/head/other.properties (revision 1118) +++ config/head/other.properties (working copy) @@ -239,4 +239,23 @@ ClickTask = 50 # Crit announce -GMShowCritAnnouncerName = False \ No newline at end of file +GMShowCritAnnouncerName = False + +#============================================================= +# AntiBot +#============================================================= + +# AntiBot. True to enable, False to disable. +AntiBotEnable = True + +# Time the user will be in jail in minutes. +AntiBotTimeJail = 10 + +# Time that the user will have to control captcha in seconds. +AntiBotTimeVote = 40 + +# Dead mobs needed for captcha. +AntiBotKillMobs = 100 + +# Level min need for captcha. +AntiBotMinLevel = 1 \ No newline at end of file Index: head-src/com/l2jfrozen/gameserver/model/actor/instance/L2PcInstance.java =================================================================== --- head-src/com/l2jfrozen/gameserver/model/actor/instance/L2PcInstance.java (revision 1118) +++ head-src/com/l2jfrozen/gameserver/model/actor/instance/L2PcInstance.java (working copy) @@ -61,6 +61,7 @@ import com.l2jfrozen.gameserver.controllers.GameTimeController; import com.l2jfrozen.gameserver.controllers.RecipeController; import com.l2jfrozen.gameserver.datatables.AccessLevel; +import com.l2jfrozen.gameserver.datatables.AntiBotTable; import com.l2jfrozen.gameserver.datatables.GmListTable; import com.l2jfrozen.gameserver.datatables.HeroSkillTable; import com.l2jfrozen.gameserver.datatables.NobleSkillTable; @@ -175,6 +176,7 @@ import com.l2jfrozen.gameserver.network.serverpackets.ExOlympiadUserInfo; import com.l2jfrozen.gameserver.network.serverpackets.ExPCCafePointInfo; import com.l2jfrozen.gameserver.network.serverpackets.ExSetCompassZoneCode; +import com.l2jfrozen.gameserver.network.serverpackets.ExShowScreenMessage; import com.l2jfrozen.gameserver.network.serverpackets.FriendList; import com.l2jfrozen.gameserver.network.serverpackets.HennaInfo; import com.l2jfrozen.gameserver.network.serverpackets.InventoryUpdate; @@ -712,6 +714,12 @@ } } + /** AntiBot. */ + private String _code = ""; + private int _attempt = 0; + private int _mobs_dead = 0; + public static ScheduledFuture<?> _antiBotTask; + /** The _client. */ private L2GameClient _client; @@ -18740,6 +18748,8 @@ // during fall validations will be disabled for 10 ms. /** The Constant FALLING_VALIDATION_DELAY. */ private static final int FALLING_VALIDATION_DELAY = 10000; + + public static final String Say2 = null; /** The _falling timestamp. */ private long _fallingTimestamp = 0; @@ -19644,4 +19654,182 @@ _currentPetSkill = new SkillDat(currentSkill, ctrlPressed, shiftPressed); } + // AntiBot + public void antibot() + { + increaseMobsDead(); + + if (getMobsDead() >= Config.ANTIBOT_KILL_MOBS) + { + resetMobsDead(); + _antiBotTask = ThreadPoolManager.getInstance().scheduleGeneral(new startAntiBotTask(), Config.ANTIBOT_TIME_VOTE * 1000); + } + } + + private static void stopAntiBotTask() + { + if (_antiBotTask != null) + { + _antiBotTask.cancel(false); + _antiBotTask = null; + } + } + + private class startAntiBotTask implements Runnable + { + public startAntiBotTask() + { + setIsParalyzed(true); + setIsInvul(true); + startAbnormalEffect(L2Character.ABNORMAL_EFFECT_FLOATING_ROOT); + sendPacket(new ExShowScreenMessage("[AntiBot]: You have " + Config.ANTIBOT_TIME_VOTE + " to confirm the Captcha!", 10000)); + getActingPlayer().sendPacket(new CreatureSay(0, Say2.CRITICAL_ANNOUNCE, "[AntiBot]:", "You have " + Config.ANTIBOT_TIME_VOTE + " to confirm the Catpcha.")); + showHtml_Start(); + } + + @Override + public void run() + { + if (!isInJail()) + { + sendPacket(new CreatureSay(0, Say2.HERO_VOICE, "[AntiBot]:", "Your time limit has elapsed.")); + increaseAttempt(); + + if (getAttempt() >= 3) + { + setIsParalyzed(false); + setIsInvul(false); + startAbnormalEffect(L2Character.ABNORMAL_EFFECT_FLOATING_ROOT); + getActingPlayer().setPunishLevel(L2PcInstance.PunishLevel.JAIL, Config.ANTIBOT_TIME_JAIL); + getActingPlayer().sendPacket(new CreatureSay(0, Say2.HERO_VOICE, "[AntiBot]:", "Character " + getName() + " jailed for " + Config.ANTIBOT_TIME_JAIL + " minutes.")); + LOGGER.warn("[AntiBot]: Character " + getName() + " jailed for " + Config.ANTIBOT_TIME_JAIL + " minutes."); + } + else + { + _antiBotTask = ThreadPoolManager.getInstance().scheduleGeneral(new startAntiBotTask(), Config.ANTIBOT_TIME_VOTE * 1000); + } + } + } + } + + public String num2img(int numero) + { + String num = Integer.toString(numero); + char[] digitos = num.toCharArray(); + + String tmp = ""; + for(int x=0;x<num.length();x++) + { + int dig = Integer.parseInt(Character.toString(digitos[x])); + final int it = AntiBotTable.getInstance().getAntiBotClientID(dig); + AntiBotTable.getInstance().sendImage(this, it); + tmp += "<img src=Crest.crest_" + Config.SERVER_ID + "_" + it + " width=38 height=33 align=left>"; + } + + return tmp; + } + + public void showHtml_Start() + { + NpcHtmlMessage html = new NpcHtmlMessage(0); + html.setFile("data/html/antiBot/start.htm"); + + html.replace("%playerName%", getName()); + html.replace("%attemp%", String.valueOf(3 - getAttempt())); + int maxR = 3; + + String random = new String(); + + for(int x = 0; x<maxR; x++) + random += Integer.toString(Rnd.get(0,9)); + + html.replace("%code1%",num2img(Integer.parseInt(random))); + + this.sendPacket(html); + setCode(String.valueOf(Integer.parseInt(random))); + } + + public void showHtml_End() + { + NpcHtmlMessage html = new NpcHtmlMessage(0); + html.setFile("data/html/antiBot/end.htm"); + html.replace("%playerName%", getName()); + + this.sendPacket(html); + } + + public void checkCode(String code) + { + if (code.equals(getCode())) + { + stopAntiBotTask(); + resetAttempt(); + + sendPacket(new CreatureSay(0, Say2.HERO_VOICE, "[AntiBot]:", "Congratulations, has passed control.")); + setIsParalyzed(false); + setIsInvul(false); + stopAbnormalEffect(L2Character.ABNORMAL_EFFECT_FLOATING_ROOT); + } + else + { + stopAntiBotTask(); + increaseAttempt(); + + _antiBotTask = ThreadPoolManager.getInstance().scheduleGeneral(new startAntiBotTask(), Config.ANTIBOT_TIME_VOTE * 1000); + } + + if (getAttempt() >= 3) + { + stopAntiBotTask(); + resetAttempt(); + + setIsParalyzed(false); + setIsInvul(false); + startAbnormalEffect(L2Character.ABNORMAL_EFFECT_FLOATING_ROOT); + + setPunishLevel(PunishLevel.JAIL, Config.ANTIBOT_TIME_JAIL); + sendPacket(new CreatureSay(0, Say2.HERO_VOICE, "[AntiBot]:", "Character " + getName() + " jailed for " + Config.ANTIBOT_TIME_JAIL + " minutes.")); + LOGGER.warn("[AntiBot]: Character " + getName() + " jailed for " + Config.ANTIBOT_TIME_JAIL + " minutes."); + } + } + + private int getMobsDead() + { + return _mobs_dead; + } + + private void increaseMobsDead() + { + _mobs_dead++; + } + + private void resetMobsDead() + { + _mobs_dead = 0; + } + + private void setCode(String code) + { + _code = code; + } + + private String getCode() + { + return _code; + } + + public void increaseAttempt() + { + _attempt += 1; + } + + public int getAttempt() + { + return _attempt; + } + + public void resetAttempt() + { + _attempt = 0; + } } \ No newline at end of file Index: head-src/com/l2jfrozen/Config.java =================================================================== --- head-src/com/l2jfrozen/Config.java (revision 1118) +++ head-src/com/l2jfrozen/Config.java (working copy) @@ -579,6 +579,13 @@ public static boolean ALLOW_AIO_IN_EVENTS; public static boolean ANNOUNCE_CASTLE_LORDS; + /** AntiBot */ + public static boolean ANTIBOT_ENABLE; + public static int ANTIBOT_TIME_JAIL; + public static int ANTIBOT_TIME_VOTE; + public static int ANTIBOT_KILL_MOBS; + public static int ANTIBOT_MIN_LEVEL; + /** Configuration to allow custom items to be given on character creation */ public static boolean CUSTOM_STARTER_ITEMS_ENABLED; public static List<int[]> STARTING_CUSTOM_ITEMS_F = new ArrayList<>(); @@ -683,6 +690,11 @@ ALLOW_AIO_USE_CM = Boolean.parseBoolean(otherSettings.getProperty("AllowAioUseClassMaster", "False")); ALLOW_AIO_IN_EVENTS = Boolean.parseBoolean(otherSettings.getProperty("AllowAioInEvents", "False")); ANNOUNCE_CASTLE_LORDS = Boolean.parseBoolean(otherSettings.getProperty("AnnounceCastleLords", "False")); + ANTIBOT_ENABLE = Boolean.parseBoolean(otherSettings.getProperty("AntiBotEnable", "true")); + ANTIBOT_TIME_JAIL = Integer.parseInt(otherSettings.getProperty("AntiBotTimeJail", "1")); + ANTIBOT_TIME_VOTE = Integer.parseInt(otherSettings.getProperty("AntiBotTimeVote", "30")); + ANTIBOT_KILL_MOBS = Integer.parseInt(otherSettings.getProperty("AntiBotKillMobs", "1")); + ANTIBOT_MIN_LEVEL = Integer.parseInt(otherSettings.getProperty("AntiBotMinLevel", "1")); if (ENABLE_AIO_SYSTEM) // create map if system is enabled { final String[] AioSkillsSplit = otherSettings.getProperty("AioSkills", "").split(";"); Index: head-src/com/l2jfrozen/gameserver/network/clientpackets/RequestBypassToServer.java =================================================================== --- head-src/com/l2jfrozen/gameserver/network/clientpackets/RequestBypassToServer.java (revision 1118) +++ head-src/com/l2jfrozen/gameserver/network/clientpackets/RequestBypassToServer.java (working copy) @@ -20,6 +20,8 @@ */ package com.l2jfrozen.gameserver.network.clientpackets; +import java.util.StringTokenizer; + import org.apache.log4j.Logger; import com.l2jfrozen.Config; @@ -317,6 +319,18 @@ else if (_command.startsWith("OlympiadArenaChange")) { Olympiad.bypassChangeArena(_command, activeChar); + } + else if (_command.startsWith("antibot")) + { + StringTokenizer st = new StringTokenizer(_command); + st.nextToken(); + + if (st.hasMoreTokens()) + { + activeChar.checkCode(st.nextToken()); + return; + } + activeChar.checkCode("Fail"); } } catch (final Exception e)
  21. one more smile code i make l2jroboto eflocrash code the fake players play pvp.. but the problem is for have all time pvp you need make a zone with respawn teleport like primeval isle i think you like it. enjoy com/elfocrash/roboto/ai/FakePlayerAI.java find this - protected void tryTargetRandomCreatureByTypeInRadius(Class<? extends Creature> creatureClass, int radius) - { - if(_fakePlayer.getTarget() == null) { - List<Creature> targets = _fakePlayer.getKnownTypeInRadius(creatureClass, radius).stream().filter(x->!x.isDead()).collect(Collectors.toList()); - if(!targets.isEmpty()) { - Creature target = targets.get(Rnd.get(0, targets.size() -1 )); - _fakePlayer.setTarget(target); - } - }else { - if(((Creature)_fakePlayer.getTarget()).isDead()) - _fakePlayer.setTarget(null); - } - } change wtih this + protected void tryTargetRandomCreatureByTypeInRadius(Class<? extends L2Character> creatureClass, int radius) + { + if (_fakePlayer.getTarget() == null) + { + if(_fakePlayer.isInsideZone(ZoneId.PEACE) || _fakePlayer.isInsideZone(ZoneId.TOWN)) + return; + + List<L2Character> targets = _fakePlayer.getKnownTypeInRadius(creatureClass, radius).stream().filter(x -> !x.isDead()).collect(Collectors.toList()); + if (!targets.isEmpty()) + { + L2Character target = targets.get(Rnd.get(0, targets.size() - 1)); + + if (_fakePlayer.getPvpFlag() == 0 && target.getActingPlayer().getPvpFlag() == 0 || _fakePlayer.getPvpFlag() != 0 && target.getActingPlayer().getPvpFlag() == 0 || _fakePlayer.getPvpFlag() == 0 && target.getActingPlayer().getPvpFlag() != 0 || _fakePlayer.getPvpFlag() != 0 && target.getActingPlayer().getPvpFlag() != 0) + _fakePlayer.setTarget(target); + + else if (_fakePlayer.getKarma() > 0 && target.getActingPlayer().getKarma() == 0 || _fakePlayer.getPvpFlag() == 0 && target.getActingPlayer().getKarma() > 0 || _fakePlayer.getPvpFlag() > 0 && target.getActingPlayer().getKarma() > 0) + _fakePlayer.setTarget(target); + + } + } + else + { + if (((L2Character) _fakePlayer.getTarget()).isDead()) + _fakePlayer.setTarget(null); + } + } and from all class name AI with name this *** public void thinkAndAct() *** find all this - tryTargetRandomCreatureByTypeInRadius(FakeHelpers.getTestTargetClass(), FakeHelpers.getTestTargetRange()); and change with this + if (_fakePlayer.getKnownTypeInRadius(FakePlayer.class, FakeHelpers.getTestTargetRange()) != null) + { + tryTargetRandomCreatureByTypeInRadius(FakeHelpers.getTargetPvPClass(), FakeHelpers.getTestTargetRange()); + } + + else if (_fakePlayer.getKnownTypeInRadius(Monster.class, FakeHelpers.getTestTargetRange()) != null) + { + tryTargetRandomCreatureByTypeInRadius(FakeHelpers.getTargetMobClass(), FakeHelpers.getTestTargetRange()); + } on FakeHelpers.java after this public static Class<? extends L2Character> getTargetMobClass() { return Monster.class; } put this + //target fakeplayers instance only... + public static Class<? extends L2Character> getTargetPvPClass() + { + return FakePlayer.class; + } if any have problem post error only... tnx.
  22. Hello, i was searching for this command but i didnt found it in our forum so i decided to share it, below you can preview the html's How to install it? EASY: 1. GameServer\data\html\mods (add here the repair FOLDER not only the files) 2. GameServer\data\scripts\handlers\voicedcommandhandlers (only the file Repair.java) (dont forget to edit your masterhandler.java script) [Hidden Content] Credits: Szponiasty
  23. .makeaa / .aa These commands convert all your seal stones ( green, red, blue ) in Ancient Adena. Nothing special at all, but it might be useful for someone. Tested and working in L2J High Five Chronicle.
  24. A code i wrote for healers to receive pvp upon heal. https://pastebin.com/Ewgb6uv8 2 Things to adjust: 1. The method that calculate if healer has heal enough ( hasHealEnough ). I did the "calculate" randomly. Make it as you want base on levels or fixed heal value 2. Add the addHeal method to your Heal.java or whatever file your project has. And add the healerId of the healer who healed you.
  25. Hello i am re-sharing PSC donation instant npc (not because it not shared anymore) but because i "fix" the target problem. The original post i think is this(credits in the end of post) click me So.. 1)Create a new instant in head-src/com/l2jfrozen/gameserver/more/actor/instance with name L2PscDonateInstance.java and then paste the code inside (tip:you can edit your text just find in code the examples "text" "text1" "text2") (tip2:you can edit the location of the .txt file for example String fname = "data/donates/"+player.getName()+".txt";) * * 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 com.l2jfrozen.gameserver.model.actor.instance; import java.io.BufferedWriter; import java.io.File; import java.io.FileWriter; import java.util.Collection; import java.util.StringTokenizer; import com.l2jfrozen.gameserver.model.L2World; import com.l2jfrozen.gameserver.network.serverpackets.ActionFailed; import com.l2jfrozen.gameserver.ai.CtrlIntention; import com.l2jfrozen.gameserver.network.serverpackets.MyTargetSelected; import com.l2jfrozen.gameserver.network.serverpackets.ValidateLocation; import com.l2jfrozen.gameserver.network.serverpackets.NpcHtmlMessage; import com.l2jfrozen.gameserver.templates.L2NpcTemplate; import javolution.text.TextBuilder; /** * @author Autos! 1-0 * */ public class L2PscDonateInstance extends L2FolkInstance { public L2PscDonateInstance(int objectId, L2NpcTemplate template) { super(objectId, template); } @Override public void onBypassFeedback(final L2PcInstance player, String command) { if(player == null) { return; } if(command.startsWith("donate")) { StringTokenizer st = new StringTokenizer(command); st.nextToken(); String amount = null; int pin1 = 0; int pin2 = 0; int pin3 = 0; int pin4 = 0; String message = ""; try { amount = st.nextToken(); pin1 = Integer.parseInt(st.nextToken()); pin2 = Integer.parseInt(st.nextToken()); pin3 = Integer.parseInt(st.nextToken()); pin4 = Integer.parseInt(st.nextToken()); while(st.hasMoreTokens()) message = message + st.nextToken() + " "; String fname = "data/donates/"+player.getName()+".txt"; File file = new File(fname); boolean exist = file.createNewFile(); if(!exist) { player.sendMessage("This is the text which when a player have allready send a donation try to do again without admin check the first one"); return; } FileWriter fstream = new FileWriter(fname); BufferedWriter out = new BufferedWriter(fstream); out.write("Character Info: [Character: "+ player.getName() +"["+ player.getObjectId()+"] - Account: "+ player.getAccountName()+" - IP: "+player.getClient().getConnection().getInetAddress().getHostAddress()+"]\nMessage : donate "+ amount +" "+ message + " "+ pin1+ " "+ pin2+ " "+ pin3+ " "+ pin4); out.close(); player.sendMessage("Thank you for the donation<-This is while a player send a donation"); Collection<L2PcInstance> pls = L2World.getInstance().getAllPlayers(); for (L2PcInstance gms : pls) { if(gms.isGM()) gms.sendMessage(player.getName() +" sent a donation.<-This is when a player send a donation admin get a pm . "); } } catch(Exception e) { e.printStackTrace(); } } } @Override public void onAction(final L2PcInstance player) { if (!canTarget(player)) player.setLastFolkNPC(this); // Check if the L2PcInstance already target the L2NpcInstance if (this != player.getTarget()) { // Set the target of the L2PcInstance player player.setTarget(this); // Send a Server->Client packet MyTargetSelected to the L2PcInstance player MyTargetSelected my = new MyTargetSelected(getObjectId(), 0); player.sendPacket(my); my = null; // Send a Server->Client packet ValidateLocation to correct the L2NpcInstance position and heading on the client player.sendPacket(new ValidateLocation(this)); } else { // Calculate the distance between the L2PcInstance and the L2NpcInstance if (!canInteract(player)) { // Notify the L2PcInstance AI with AI_INTENTION_INTERACT player.getAI().setIntention(CtrlIntention.AI_INTENTION_INTERACT, this); showHtmlWindow(player); } showHtmlWindow(player); } // Send a Server->Client ActionFailed to the L2PcInstance in order to avoid that the client wait another packet player.sendPacket(ActionFailed.STATIC_PACKET); } private void showHtmlWindow(L2PcInstance activeChar) { TextBuilder tb = new TextBuilder(); NpcHtmlMessage html = new NpcHtmlMessage(1); tb.append("<html><head><title>Instant Donation</title></head><body><center><table width=\"250\" bgcolor=\"000000\"><tr><td align=center><font color=\"6fd3d1\">Donate now online</font></td></tr></table>_______________________________________<br><br><table width=\"250\"><tr><td><font color=\"ddc16d\">Select Donation Amount:</font></td><td><combobox width=80 height=17 var=amount list=10-Euro;25-Euro;50-Euro;100-Euro;></td></tr></table><br><br><font color=\"ddc16d\">Paysafe Card Pin:</font><table width=\"250\"><tr><td><edit var=\"pin1\" width=50 height=12 type=number></td><td><edit var=\"pin2\" width=50 height=12 type=number></td><td><edit var=\"pin3\" width=50 height=12 type=number></td><td><edit var=\"pin4\" width=50 height=12 type=number></td></table><br><br><multiedit var=\"message\" width=240 height=40><br><br><button value=\"Donate!\" action=\"bypass -h npc_"+getObjectId()+"_donate $amount $pin1 $pin2 $pin3 $pin4 $message\" width=95 height=21 back=\"bigbutton_over\" fore=\"bigbutton\"><br></center></body></html>"); html.setHtml(tb.toString()); activeChar.sendPacket(html); } } Then go to your database,open custom_npc table create new line,put the npc_id who you prefer (but make sure to be type:L2PscDonate) Enjoy :D ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ Credits:Ponyrides as the friend said below ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
×