Hello guys i'm looking for method that i would be able to use one id with a few ids inside for example if i put in droplist id 9999 it will generate random item and will drop it . like it wont be necessary to add the items one by one in the drop list , i have found a code for gracia final but when i tried to put it on interlude (acis) its not working its . In the database its saying Droplist data for undefined itemId: 9999. Also there is no error on the Gameserver----> its saying . Loaded 63 item lists from the database.
....and loaded 3 combined item lists from the database. I'm using Acis 368 rev http://prntscr.com/fdluip thats the database
package net.sf.l2j.gameserver.datatables;
import java.sql.Connection;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.util.StringTokenizer;
import java.util.logging.Level;
import java.util.logging.Logger;
import javolution.util.FastList;
import javolution.util.FastMap;
import net.sf.l2j.L2DatabaseFactory;
import net.sf.l2j.commons.random.Rnd;
public class ItemLists
{
protected static final Logger _log = Logger.getLogger(ItemLists.class.getName());
private FastMap<String, FastList<Integer>> _itemLists;
public static ItemLists getInstance()
{
return SingletonHolder._instance;
}
private ItemLists()
{
loadLists();
}
public void loadLists()
{
_itemLists = new FastMap<String, FastList<Integer>>();
Connection con = null;
try
{
con = L2DatabaseFactory.getInstance().getConnection();
PreparedStatement statement = con.prepareStatement("SELECT * FROM itemlists");
ResultSet result = statement.executeQuery();
int count = 0;
while (result.next())
{
String list = result.getString("list");
if (list == null)
continue;
if (list.equalsIgnoreCase(""))
list = "0";
final StringTokenizer st = new StringTokenizer(list, ";");
FastList<Integer> fastlist = new FastList<Integer>();
while (st.hasMoreTokens())
{
int itemId = 0;
try
{
itemId = Integer.parseInt(st.nextToken());
}
catch (Exception e)
{
e.printStackTrace();
itemId = 0;
}
if (itemId != 0)
fastlist.addLast(itemId);
}
final String name = result.getString("name");
if (!_itemLists.containsKey(name))
{
_itemLists.put(name, fastlist);
count++;
}
}
result.close();
statement.close();
_log.config("Loaded " + count + " item lists from the database.");
statement = con.prepareStatement("SELECT name, include FROM itemlists");
result = statement.executeQuery();
count = 0;
while (result.next())
{
String include = result.getString("include");
if (include == null || include.equalsIgnoreCase("0"))
continue;
final StringTokenizer st = new StringTokenizer(include, ";");
FastList<Integer> fastlist = new FastList<Integer>();
while (st.hasMoreTokens())
{
int listId = 0;
try
{
listId = Integer.parseInt(st.nextToken());
}
catch (Exception e)
{
e.printStackTrace();
listId = 0;
}
if (listId != 0)
{
fastlist.addAll(_itemLists.get(getListName(listId)));
}
}
_itemLists.get(result.getString("name")).addAll(fastlist);
count++;
}
_log.config("....and loaded " + count + " combined item lists from the database.");
}
catch (Exception e)
{
_log.log(Level.SEVERE, "Error loading item lists.", e);
}
finally
{
try
{
con.close();
}
catch (Exception e)
{
}
}
}
public String getListName(int listId)
{
int count = 1;
if (listId > 1000000)
listId -= 1000000;
for (String val : _itemLists.keySet())
{
if (count == listId)
return val;
count++;
}
_log.warning("getListName() of ItemLists returned null!!!!!!!!!!!");
return null;
}
public int generateRandomItemFromList(int listId)
{
final String name = getListName(listId);
if (name != null)
{
FastList<Integer> val = _itemLists.get(name);
if (val != null && !val.isEmpty())
return val.get(Rnd.get(val.size()));
}
_log.warning("generateRandomItemFromList() of ItemLists returned 0!!!!!!!!!!! list id: " + listId);
return 0;
}
public FastList<Integer> getFirstListByItemId(int itemId)
{
for (FastList<Integer> list : _itemLists.values())
{
if (list != null && list.size() > 0)
{
if (list.contains(itemId))
return list;
}
}
return null;
}
public void debug()
{
System.out.println(_itemLists.toString());
}
@SuppressWarnings("synthetic-access")
private static class SingletonHolder
{
protected static final ItemLists _instance = new ItemLists();
}
}
You can post now and register later.
If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.
🤖 Old Telegram bots with 2024 year old
⭐️ Good for search optimization TG
⭐️ Bots without subscribers
⭐️ Bots clean, no bans, blocking and complaints
💵 Price list:
From 3 bots - 3$ for 1pc.
From 20 bots - 2.5$ for 1pc.
From 60 bots - 2.3$ for 1pc.
From 100 bots - 2.2$ for 1pc.
From 400 bots - 1.9$ for 1pc.
📌 To contact Us - t.me/smmtg6
⚡️ Fast SEO optimization in Telegram for your channel/chat/bot. TOP OF SEARCH TG🔝
✨ Effective solution for your business or blog.
🔥 Fast results within few days.
➡️ Contact us on Telegram for more details - t.me/smmtg6
🤖⭐️ TELEGRAM PREMIUM BOT START:
1201ID - Ukraine 🇺🇦 + MIX | 7 Days Premium 🤖 - 3.4$ per 1000
1198 ID - Israel 🇮🇱 + Uzbekistan 🇺🇿 | Mix Days Premium 🤖 - 3.5$ per 1000
574 ID - Uzbekistan 🇺🇿 + Russia 🇷🇺 20% | 30-90 Days Premium 🤖 - 3.8$ per 1000
1210 ID - Ukraine 🇺🇦 + MIX | 7-30 Days Premium 🤖 | 4$ per 1000
1203 ID - Uzbekistan 🇺🇿 + MIX | 20-30 Days Premium 🤖 | 4$ per 1000
1195 ID - USA 🇺🇸 + Ukraine🇺🇦 + Canada 🇨🇦 | 15 Days Premium🤖 | 4.3$ per 1000
1213 ID - Uzbekistan 🇺🇿 + USA 🇺🇸 + Canada 🇨🇦 | 30 Days Premium 🤖 | 4.4$ per 1000
1202 ID - Uzbekistan 🇺🇿 + MIX | 30 Days Premium 🤖 | 4.4$ per 1000
752 ID - USA 🇺🇸 + China 🇨🇳 + Canada 🇨🇦 | 30 Days Premium 🤖 | 5.4$ per 1000
756 ID - Uzbekistan 🇺🇿 + Israel 🇮🇱 + Austria 🇦🇹 | 14-30 Days Premium 🤖 | 5.6$ per 1000
758 ID - Canada 🇨🇦 + USA 🇺🇸 + Turkey 🇹🇷 | 30 Days Premium 🤖 | 5.6$ per 1000
755 ID - Turkey 🇹🇷 + Egypt 🇪🇬 | 30-90 Days Premium 🤖 | 6$ per 1000
374 ID - Russia 🇷🇺 + USA 🇺🇸 + Canada 🇨🇦 | Mix Days Premium 🤖 | 6.8$ per 1000
741 ID - Ukraine 🇺🇦 + USA 🇺🇸 + Canada 🇨🇦 | 15-30 Days Premium 🤖 | 6.8$ per 1000
575 ID - USA 🇺🇸 + Russia 🇷🇺 + Canada 🇨🇦 | Mix Days Premium 🤖 | 7.2$ per 1000
372 ID - USA 🇺🇸 + Canada 🇨🇦 + Russia 🇷🇺 + EU 🇪🇺 | Mix Days Premium | 7.5$ per 1000
1204 ID - Ukraine 🇺🇦 + MIX | 60-90 Days Premium | 7.6$ per 1000
Question
BaM4yYy
Hello guys i'm looking for method that i would be able to use one id with a few ids inside for example if i put in droplist id 9999 it will generate random item and will drop it . like it wont be necessary to add the items one by one in the drop list , i have found a code for gracia final but when i tried to put it on interlude (acis) its not working its . In the database its saying Droplist data for undefined itemId: 9999. Also there is no error on the Gameserver----> its saying . Loaded 63 item lists from the database.
2 answers to this question
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.