im trying to adapt this code :http://maxcheaters.com/forum/index.php?topic=105180.0
on interlude.Its an aio item for freya.
Since im not a good developer,i will ask for your help!
I have aplied the code (only core-side) but i have a problem.I got many errors on ItemBypass.java
I cant find some imports since its different chronicle,so i will post the code bellow and w8 for sb to help me.
package com.l2jfrozen.gameserver.model;
import java.sql.Connection;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.util.Map;
import javolution.text.TextBuilder;
import javolution.util.FastList;
import javolution.util.FastMap;
import com.l2jfrozen.Config;
import com.l2jfrozen.L2DatabaseFactory;
import com.l2jfrozen.gameserver.TradeController;
import com.l2jfrozen.gameserver.datatables.SkillTable;
import com.l2jfrozen.gameserver.model.actor.instance.L2PcInstance;
import com.l2jfrozen.gameserver.model.entity.TvTEvent;
import com.l2jfrozen.gameserver.model.itemcontainer.PcFreight;
import com.l2jfrozen.gameserver.network.SystemMessageId;
import com.l2jfrozen.gameserver.network.serverpackets.ActionFailed;
import com.l2jfrozen.gameserver.network.serverpackets.BuyList;
import com.l2jfrozen.gameserver.network.serverpackets.NpcHtmlMessage;
import com.l2jfrozen.gameserver.network.serverpackets.PackageToList;
import com.l2jfrozen.gameserver.network.serverpackets.SortedWareHouseWithdrawalList;
import com.l2jfrozen.gameserver.network.serverpackets.SystemMessage;
import com.l2jfrozen.gameserver.network.serverpackets.WareHouseDepositList;
import com.l2jfrozen.gameserver.network.serverpackets.WareHouseWithdrawalList;
import com.l2jfrozen.gameserver.network.serverpackets.SortedWareHouseWithdrawalList.WarehouseListType;
/**
*
* @author BiggBoss
*
*/
public class ItemBypass {
/* Constants */
private static final String _headHtml = "<html><title>AIO Item</title><body><center><br>";
private static final String _endHtml = "</center></body></html>";
/* Maps, Lists and Arrays to hold the data */
private static Map<String, FastMap<String, Integer[]>> _teleports = new FastMap<String, FastMap<String, Integer[]>>();
private static Map<String, FastMap<String, Integer[]>> _buffs = new FastMap<String, FastMap<String, Integer[]>>();
private static int _pagesPerTp;
private static int _pagesPerBuffs;
private static final int _coinpertp = Config.AIO_TPCOIN;
private static final int _coinperbuff = Config.AIO_BUFFCOIN;
/* Pice for teleport */
private static final int _tpprice = Config.AIO_PRICE_PERTP;
/* Price per buff */
private static final int _buffprice = Config.AIO_PRICE_PERBUFF;
public static void loadData() {
int counter = 0;
System.out.println("----------------------------------------------");
System.out.println("Loading AIO Item data. Info:");
System.out.println("----------------------------------------------");
try {
Connection con = L2DatabaseFactory.getInstance().getConnection();
PreparedStatement statement = con.prepareStatement("SELECT category FROM aio_teleports");
ResultSet rset = statement.executeQuery();
while(rset.next()) {
String tpcategory = rset.getString("category");
Connection con2 = L2DatabaseFactory.getInstance().getConnection();
PreparedStatement statement2 = con2.prepareStatement("SELECT tpname, x, y, z FROM aio_teleports WHERE category = ?");
statement2.setString(1, tpcategory);
ResultSet rset2 = statement2.executeQuery();
FastMap <String, Integer[]> temptp = new FastMap<String, Integer[]>();
while(rset2.next()) {
String tpname = rset2.getString("tpname");
Integer[] coords = new Integer[3];
coords[0] = rset2.getInt("x");
coords[1] = rset2.getInt("y");
coords[2] = rset2.getInt("z");
temptp.put(tpname, coords);
}
con2.close();
statement2.close();
rset2.close();
_teleports.put(tpcategory, temptp);
}
con.close();
statement.close();
rset.close();
}
catch(SQLException e) {
counter += 1;
e.printStackTrace();
}
int c = 0;
System.out.println("Loaded " + _teleports.keySet().size() + " teleport categories for the AIO Item");
for(String st : _teleports.keySet()) {
c += _teleports.get(st).keySet().size();
}
System.out.println("Loaded " + c + " teleport spawnpoints for the AIO Item");
try {
Connection con3 = L2DatabaseFactory.getInstance().getConnection();
PreparedStatement statement3 = con3.prepareStatement("SELECT category FROM aio_buffs");
ResultSet rset3 = statement3.executeQuery();
while(rset3.next()) {
String bcategory = rset3.getString("category");
Connection con4 = L2DatabaseFactory.getInstance().getConnection();
PreparedStatement statement4 = con4.prepareStatement("SELECT buff_name, buff_id, buff_lvl FROM aio_buffs WHERE category = ?");
statement4.setString(1, bcategory);
ResultSet rset4 = statement4.executeQuery();
FastMap<String, Integer[]> tempbuff = new FastMap<String, Integer[]>();
while(rset4.next()) {
String bname = rset4.getString("buff_name");
Integer[] ar = new Integer[2];
ar[0] = rset4.getInt("buff_id");
ar[1] = rset4.getInt("buff_lvl");
tempbuff.put(bname, ar);
}
con4.close();
statement4.close();
rset4.close();
_buffs.put(bcategory, tempbuff);
}
con3.close();
statement3.close();
rset3.close();
}
catch(SQLException e) {
counter += 2;
e.printStackTrace();
}
int i = 0;
System.out.println("Loaded " + _buffs.keySet().size() + " buffs categories for the AIO Item");
for(String st : _buffs.keySet()) {
i += _buffs.get(st).keySet().size();
}
System.out.println("Loaded " + i + " buffs for the AIO Item");
if(counter == 0)
System.out.println("AIO Item loaded sucesfully!");
else
switch(counter) {
case 1:
System.out.println("There was a problem loading Teleports. Check what did you enter on aio_teleports.");
break;
case 2:
System.out.println("There was a problem loading Buffs. Check what did you enter on aio_buffs.");
break;
default:
System.out.println("Something was wrong during AIO item load. Check the console.");
}
System.out.println("----------------------------------------------");
}
public static void onBypassFeedback(L2PcInstance player, String command) {
//No null pointers or npc interaction
if(player == null) return;
if(player.getTarget() != null) {
player.sendMessage("Remove your current target before use the AIO Item");
return;
}
if(player.isInOlympiadMode() || TvTEvent.isPlayerParticipant(player.getObjectId())
|| player.getKarma() > 0) {
player.sendPacket(new SystemMessage(SystemMessageId.CANNOT_TRY_ON_NOW));
return;
}
long pAdena = player.getAdena();
String[] subCommand = command.split("_");
WarehouseListType itemtype = null;
if(command.startsWith("warehouse"))
showWarehouseWindow(player);
else if(command.startsWith("nwidraw")) {
player.sendPacket(ActionFailed.STATIC_PACKET);
player.setActiveWarehouse(player.getWarehouse());
if(pAdena == 0 || player.getInventory().getItemByItemId(57) == null) {
player.sendMessage("You dont have adena to afford the transaction");
return;
}
if(player.getWarehouse().getSize() == 0) {
player.sendPacket(new SystemMessage(SystemMessageId.NO_ITEM_DEPOSITED_IN_WH));
return;
}
else {
if (itemtype != null)
player.sendPacket(new SortedWareHouseWithdrawalList(player, WareHouseWithdrawalList.PRIVATE, itemtype, (byte) 0));
else
player.sendPacket(new WareHouseWithdrawalList(player, WareHouseWithdrawalList.PRIVATE));
}
}
else if(command.startsWith("ndeposit")) {
player.sendPacket(ActionFailed.STATIC_PACKET);
player.setActiveWarehouse(player.getWarehouse());
if(player.getWarehouse().getSize() == player.getWareHouseLimit()) {
player.sendMessage("The warehouse is full");
return;
}
else {
player.tempInventoryDisable();
player.sendPacket(new WareHouseDepositList(player, WareHouseDepositList.PRIVATE));
}
}
else if(command.startsWith("clanwidraw")) {
player.sendPacket(ActionFailed.STATIC_PACKET);
player.setActiveWarehouse(player.getClan().getWarehouse());
if(!player.isClanLeader() || player.getClan() == null ) {
player.sendMessage("You are not the clan leader");
return;
}
else if(player.getClan().getWarehouse().getSize() == 0) {
player.sendPacket(new SystemMessage(SystemMessageId.NO_ITEM_DEPOSITED_IN_WH));
return;
}
else if ((player.getClanPrivileges() & L2Clan.CP_CL_VIEW_WAREHOUSE) != L2Clan.CP_CL_VIEW_WAREHOUSE) {
player.sendPacket(new SystemMessage(SystemMessageId.YOU_DO_NOT_HAVE_THE_RIGHT_TO_USE_CLAN_WAREHOUSE));
return;
}
else if(player.getClan().getLevel() == 0) {
player.sendMessage("Only clan with lvl 1 or avobe can use clan warehouse");
return;
}
else {
player.setActiveWarehouse(player.getClan().getWarehouse());
if (itemtype != null)
player.sendPacket(new SortedWareHouseWithdrawalList(player, WareHouseWithdrawalList.CLAN, itemtype, (byte) 0));
else
player.sendPacket(new WareHouseWithdrawalList(player, WareHouseWithdrawalList.CLAN));
}
}
else if(command.startsWith("clandeposit")) {
player.sendPacket(ActionFailed.STATIC_PACKET);
player.setActiveWarehouse(player.getClan().getWarehouse());
if(!player.isClanLeader() || player.getClan() == null ) {
player.sendMessage("You are not the clan leader");
return;
}
else {
player.setActiveWarehouse(player.getClan().getWarehouse());
player.tempInventoryDisable();
player.sendPacket(new WareHouseDepositList(player, WareHouseDepositList.CLAN));
}
}
else if(command.startsWith("freightwidraw")) {
player.sendPacket(ActionFailed.STATIC_PACKET);
PcFreight freight = player.getFreight();
if (freight != null)
{
if (freight.getSize() > 0)
{
if (Config.ALT_GAME_FREIGHTS)
freight.setActiveLocation(0);
else
freight.setActiveLocation(player.getWorldRegion().hashCode());
player.setActiveWarehouse(freight);
if (itemtype != null)
player.sendPacket(new SortedWareHouseWithdrawalList(player, WareHouseWithdrawalList.FREIGHT, itemtype, (byte)0));
else
player.sendPacket(new WareHouseWithdrawalList(player, WareHouseWithdrawalList.FREIGHT));
}
else
player.sendPacket(new SystemMessage(SystemMessageId.NO_ITEM_DEPOSITED_IN_WH));
}
}
else if(command.startsWith("freightdeposit")) {
if (player.getAccountChars().isEmpty())
player.sendPacket(new SystemMessage(SystemMessageId.CHARACTER_DOES_NOT_EXIST));
else {
Map<Integer, String> chars = player.getAccountChars();
if (chars.isEmpty()) {
player.sendPacket(ActionFailed.STATIC_PACKET);
return;
}
player.sendPacket(new PackageToList(chars));
}
}
else if(command.startsWith("showTeleportWindow")) {
if(player.getPvpFlag() > 0) {
player.sendMessage("Cannot teleport while in pvp");
return;
}
else
showTeleportWindow(player);
}
else if(command.startsWith("tpcategory"))
showTeleportCategoryWindow(player, subCommand[1], 1);
else if(command.startsWith("teleportTo")) {
if(player.getInventory().getItemByItemId(_coinpertp) == null) {
player.sendMessage("You dont have the necessary items");
return;
}
else if(player.getInventory().getItemByItemId(_coinpertp).getCount() < _tpprice) {
player.sendPacket(new SystemMessage(SystemMessageId.NOT_ENOUGH_ITEMS));
return;
}
int x = Integer.valueOf(subCommand[1]);
int y = Integer.valueOf(subCommand[2]);
int z = Integer.valueOf(subCommand[3]);
player.destroyItemByItemId("AIO Teleport", _coinpertp, _tpprice, player, true);
player.teleToLocation(x, y, z);
}
// For multiples pages on Gm Shop
else if(command.startsWith("Chat")) {
if(subCommand[1].isEmpty() || subCommand[1] == null) return;
String file = "data/html/AIOItem/"+subCommand[1];
NpcHtmlMessage msg = new NpcHtmlMessage(5);
msg.setFile(file);
player.sendPacket(msg);
}
else if(command.startsWith("showShopWindow")) {
if(player.getPvpFlag() > 0 || pAdena == 0) return;
String buyHtml = "data/html/AIOItem/GMShop.htm";
NpcHtmlMessage msg = new NpcHtmlMessage(5);
msg.setFile(buyHtml);
player.sendPacket(msg);
}
else if(command.startsWith("showBuyWindow")){
int val = Integer.valueOf(subCommand[1]);
showBuyWindow(player, val);
}
else if(command.startsWith("ShowBuffWindow"))
showBuffsPage(player);
else if(command.startsWith("showBuffCategory")){
showBuffsPage(player, subCommand[1], Integer.valueOf(subCommand[2]));
}
else if(command.startsWith("buffMe")) {
if(player.getInventory().getItemByItemId(_coinperbuff).getCount() < _buffprice) {
player.sendPacket(new SystemMessage(SystemMessageId.NOT_ENOUGH_REQUIRED_ITEMS));
return;
}
else {
player.destroyItemByItemId("AIO Buffer", _coinperbuff, _buffprice, player, true);
SkillTable.getInstance().getInfo(_buffs.get(subCommand[1]).get(subCommand[2])[0], _buffs.get(subCommand[1]).get(subCommand[2])[1]).getEffects(player, player);
showBuffsPage(player, subCommand[1], 1);
}
}
else if(command.startsWith("tvtinfo")) {
showTvTInfoPage(player);
}
else if(command.startsWith("tvtjoin")) {
if(subCommand[1].equals("reg"))
TvTEvent.onBypass("tvt_event_participation", player);
else if(subCommand[1].equals("unreg"))
TvTEvent.onBypass("tvt_event_remove_participation", player);
else
return;
}
}
private static void showTvTInfoPage(L2PcInstance player) {
TextBuilder tb = new TextBuilder();
tb.append(_headHtml);
if(TvTEvent.isParticipating()) {
tb.append("TvT did not start yet!.<br1>");
if(!TvTEvent.isPlayerParticipant(player.getObjectId())) {
tb.append("Do you want to participate? Click <font color=LEVEL>Ok!</font> to<br1>");
tb.append("join the event!");
tb.append("<button value=\"Ok!\" action=\"bypass -h Aioitem_tvtjoin_reg\" width=120 height=32 back=\"L2UI_CT1.Button_DF_Down\" fore=\"L2UI_ct1.button_df\">");
}
else {
tb.append("You are alredy participating. Do you<br1>");
tb.append("want to unregister? Click the below button<br>");
tb.append("<button value=\"Unregister\" action=\"bypass -h Aioitem_tvtjoin_unreg\" width=120 height=32 back=\"L2UI_CT1.Button_DF_Down\" fore=\"L2UI_ct1.button_df\">");
}
}
else if(TvTEvent.isStarted()) {
tb.append("TvT alredy started. You can not join<br1>");
tb.append("join at this momment. But you can see the<br1>");
tb.append("stats:<br>");
for(String st : TvTEvent.getTeamNames()) {
tb.append("<font color=LEVEL>" + st + ":</font><br1>");
tb.append("- Participants: <font color=\"0000FF\">" + TvTEvent.getTeamsPlayerCounts()[0] +"</font><br1>");
tb.append("- Kills: <font color=\"0000FF\">" + TvTEvent.getTeamsPoints()[0] +"</font><br1>");
tb.append("- Deads: <font color=\"0000FF\">" + TvTEvent.getTeamsPoints()[1] +"</font><br>");
}
}
else {
tb.append("TvT is not avaliable at this momment<br1>");
tb.append("Wait till it starts");
}
tb.append(_endHtml);
NpcHtmlMessage msg = new NpcHtmlMessage(5);
msg.setHtml(tb.toString());
player.sendPacket(msg);
}
private static void showBuffsPage(L2PcInstance player, String string, int val) {
FastMap<String, Integer[]> temp = _buffs.get(string);
FastList<String> buff = new FastList<String>();
buff.addAll(_buffs.get(string).keySet());
_pagesPerBuffs = Math.round((buff.size() / 15));
TextBuilder tb = new TextBuilder();
tb.append(_headHtml);
tb.append("Choose betwen the below buffs:<br>");
tb.append("<table width = 240 height = 32>");
for(String st : buff.subList((val * 15) - 15, getMaxRange(buff, ((val * 15) * 2) - 15))) {
tb.append("<tr>");
if(temp.get(st)[0] < 1000)
tb.append("<td><img src=\"icon.skill0" + temp.get(st)[0] + "\" width=32 height=32></td>");
else
tb.append("<td><img src=\"icon.skill" +temp.get(st)[0] + "\" width=32 height=32></td>");
tb.append("<td><button value=\"" + st + "\" action=\"bypass -h Aioitem_buffMe_" + string + "_" + st + "\" width=176 height=32 back=\"L2UI_CT1.Button_DF_Down\" fore=\"L2UI_ct1.button_df\"></td>");
if(temp.get(st)[0] < 1000)
tb.append("<td><img src=\"icon.skill0" + temp.get(st)[0] + "\" width=32 height=32></td>");
else
tb.append("<td><img src=\"icon.skill" +temp.get(st)[0] + "\" width=32 height=32></td>");
tb.append("</tr>");
}
tb.append("</table>");
for(int i = 1; i<_pagesPerBuffs; i++) {
tb.append("<a action=\"bypass -h Aioitem_showBuffCategory_" + string + "_" + i +"\">" + i + "</a>");
}
tb.append(_endHtml);
NpcHtmlMessage msg = new NpcHtmlMessage(5);
msg.setHtml(tb.toString());
player.sendPacket(msg);
}
private static void showBuffsPage(L2PcInstance player) {
TextBuilder tb = new TextBuilder();
tb.append(_headHtml);
tb.append("Chose betwen the below categories:<br>");
for(String st : _buffs.keySet()) {
tb.append("<button value=\"" + st + "\" action=\"bypass -h Aioitem_showBuffCategory_" + st + "_1\" width=176 height=32 back=\"L2UI_CT1.Button_DF_Down\" fore=\"L2UI_ct1.button_df\">");
}
tb.append(_endHtml);
NpcHtmlMessage msg = new NpcHtmlMessage(5);
msg.setHtml(tb.toString());
player.sendPacket(msg);
}
private static void showTeleportCategoryWindow(L2PcInstance player, String string, int val) {
FastMap<String, Integer[]> temp = _teleports.get(string);
FastList<String> keys = new FastList<String>();
keys.addAll(_teleports.get(string).keySet());
_pagesPerTp = Math.round(keys.size() / 15);
TextBuilder tb = new TextBuilder();
tb.append(_headHtml);
tb.append("Choose a teleport:<br>");
for(String st : keys.subList((val * 15) - 15, getMaxRange(keys, ((val * 15) * 2) - 15)) ) {
tb.append("<button value=\"" + st + "\" action=\"bypass -h Aioitem_teleportTo_" +temp.get(st)[0] + "_" +
temp.get(st)[1] + "_" + temp.get(st)[2] + "\" width=176 height=32 back=\"L2UI_CT1.Button_DF_Down\" " +
"fore=\"L2UI_ct1.button_df\">");
}
for(int i = 1; i<_pagesPerTp; i++) {
tb.append("<a action=\"bypass -h Aioitem_tpcategory_" + string + "_" + i +"\">" + i + "</a>");
}
tb.append(_endHtml);
NpcHtmlMessage msg = new NpcHtmlMessage(5);
msg.setHtml(tb.toString());
player.sendPacket(msg);
}
private static void showTeleportWindow(L2PcInstance player) {
TextBuilder tb = new TextBuilder();
tb.append(_headHtml);
tb.append("Choose one of the below categories:<br>");
for(String st : _teleports.keySet()) {
tb.append("<button value=\"" + st + "\" action=\"bypass -h Aioitem_tpcategory_" + st + "_1\" width=176 height=32 back=\"L2UI_CT1.Button_DF_Down\" fore=\"L2UI_ct1.button_df\">");
}
tb.append(_endHtml);
NpcHtmlMessage msg = new NpcHtmlMessage(5);
msg.setHtml(tb.toString());
player.sendPacket(msg);
}
private static void showWarehouseWindow(L2PcInstance player) {
TextBuilder tb = new TextBuilder();
tb.append(_headHtml);
tb.append("Choose betwen the avobe options:<br>");
tb.append("<button value=\"Withdraw\" action=\"bypass -h Aioitem_nwidraw\" width=176 height=32 back=\"L2UI_CT1.Button_DF_Down\" fore=\"L2UI_ct1.button_df\">");
tb.append("<button value=\"Deposit\" action=\"bypass -h Aioitem_ndeposit\" width=176 height=32 back=\"L2UI_CT1.Button_DF_Down\" fore=\"L2UI_ct1.button_df\">");
tb.append("<button value=\"Clan Withdraw\" action=\"bypass -h Aioitem_clanwidraw\" width=176 height=32 back=\"L2UI_CT1.Button_DF_Down\" fore=\"L2UI_ct1.button_df\">");
tb.append("<button value=\"Clan Deposit\" action=\"bypass -h Aioitem_clandeposit\" width=176 height=32 back=\"L2UI_CT1.Button_DF_Down\" fore=\"L2UI_ct1.button_df\">");
tb.append("<button value=\"Freight Withdraw\" action=\"bypass -h Aioitem_freightwidraw\" width=176 height=32 back=\"L2UI_CT1.Button_DF_Down\" fore=\"L2UI_ct1.button_df\">");
tb.append("<button value=\"Freight Deposit\" action=\"bypass -h Aioitem_freightdeposit\" width=176 height=32 back=\"L2UI_CT1.Button_DF_Down\" fore=\"L2UI_ct1.button_df\">");
tb.append(_endHtml);
NpcHtmlMessage msg = new NpcHtmlMessage(5);
msg.setHtml(tb.toString());
player.sendPacket(msg);
}
private static void showBuyWindow(L2PcInstance player, int val) {
player.tempInventoryDisable();
L2TradeList list = TradeController.getInstance().getBuyList(val);
if (list != null) {
player.sendPacket(new BuyList(list, player.getAdena(), 0));
}
player.sendPacket(ActionFailed.STATIC_PACKET);
}
//Give the max range each 15 units
private static int getMaxRange(FastList<String> list, int lastindex) {
if(list.size() - lastindex > 0)
return lastindex;
else
return list.size();
}
}
So check the imports and tell me the rights.
Also if sb could make a full adaption (couse many ppl ask for this) would be great! :)
P.S
Im here couse i need some help(if i had the skills i could help some ppl too,also i could fix the code by myself).And as long this section is HELP section,i dont want to see ryplies like "read guides,learn java,you have to pay for this"
If you cant help or dont want to just get the f*** out of here!!
DISCORD :
utchiha_market
telegram :
https://t.me/utchiha_market
SELLIX STORE :
https://utchihamkt.mysellix.io/
Join our server for more products :
https://discord.gg/hood-services
https://campsite.bio/utchihaamkt
Check the Player or ManufactureList classes first—there’s usually a hardcoded cap in there, like 20 slots for Interlude. If you spot something like maxSlots = 20, that’s the limit, and you can tweak it.
Question
Zoubis®™
Hi cheaters!
im trying to adapt this code :http://maxcheaters.com/forum/index.php?topic=105180.0
on interlude.Its an aio item for freya.
Since im not a good developer,i will ask for your help!
I have aplied the code (only core-side) but i have a problem.I got many errors on ItemBypass.java
I cant find some imports since its different chronicle,so i will post the code bellow and w8 for sb to help me.
So check the imports and tell me the rights.
Also if sb could make a full adaption (couse many ppl ask for this) would be great! :)
P.S
Im here couse i need some help(if i had the skills i could help some ppl too,also i could fix the code by myself).And as long this section is HELP section,i dont want to see ryplies like "read guides,learn java,you have to pay for this"
If you cant help or dont want to just get the f*** out of here!!
11 answers to this question
Recommended Posts