First of all, I want to mention that I am a beginner.
I am trying to modify a java buffer. I want to put an if condition that checks if the player has (for example) item 1234(a permanent item, not a consumable) in inventory.
And if he has that item, he can add in the scheme buffs with option "canUse = 1" and buffs with option "canUse = 0".
Can anyone please help me or try to explain how can I put the condition that checks if the player has the item?
Thank you very much.
private String viewAllSchemeBuffs(String scheme, String page, String action)
{
List<String> buffList = new ArrayList<>();
String HTML_MESSAGE = "<html><head><title>" + TITLE_NAME + "</title></head><body><center><br>";
String[] eventSplit = viewAllSchemeBuffs$getBuffCount(scheme).split(" ");
int TOTAL_BUFF = Integer.parseInt(eventSplit[0]);
int BUFF_COUNT = Integer.parseInt(eventSplit[1]);
int DANCE_SONG = Integer.parseInt(eventSplit[2]);
try (Connection con = L2DatabaseFactory.getInstance().getConnection())
{
if (action.equals("add"))
{
HTML_MESSAGE += "You can add <font color=LEVEL>" + (MAX_SCHEME_BUFFS - BUFF_COUNT) + "</font> Buffs and <font color=LEVEL>" + (MAX_SCHEME_DANCES - DANCE_SONG) + "</font> Dances more!";
String QUERY = "SELECT * FROM npcbuffer_buff_list WHERE buffType IN (" + generateQuery(BUFF_COUNT, DANCE_SONG) + ") AND canUse=1 ORDER BY Buff_Class ASC, id";
PreparedStatement getBuffCount = con.prepareStatement(QUERY);
ResultSet rss = getBuffCount.executeQuery();
while (rss.next())
{
String name = SkillTable.getInstance().getInfo(rss.getInt("buffId"), rss.getInt("buffLevel")).getName();
name = name.replace(" ", "+");
buffList.add(name + "_" + rss.getInt("buffId") + "_" + rss.getInt("buffLevel"));
}
}
else if (action.equals("remove"))
{
HTML_MESSAGE += "You have <font color=LEVEL>" + BUFF_COUNT + "</font> Buffs and <font color=LEVEL>" + DANCE_SONG + "</font> Dances";
String QUERY = "SELECT * FROM npcbuffer_scheme_contents WHERE scheme_id=? ORDER BY Buff_Class ASC, id";
PreparedStatement getBuffCount = con.prepareStatement(QUERY);
getBuffCount.setString(1, scheme);
ResultSet rss = getBuffCount.executeQuery();
while (rss.next())
{
String name = SkillTable.getInstance().getInfo(rss.getInt("skill_id"), rss.getInt("skill_level")).getName();
name = name.replace(" ", "+");
buffList.add(name + "_" + rss.getInt("skill_id") + "_" + rss.getInt("skill_level"));
}
}
else if (DEBUG)
{
throw new RuntimeException();
}
}
catch (SQLException e)
{
print(e);
}
HTML_MESSAGE += "<BR1><table border=0><tr>";
final int buffsPerPage = 16;
final String width, pageName;
int pc = ((buffList.size() - 1) / buffsPerPage) + 1;
if (pc > 5)
{
width = "25";
pageName = "P";
}
else
{
width = "50";
pageName = "Page ";
}
for (int ii = 1; ii <= pc; ++ii)
{
if (ii == Integer.parseInt(page))
{
HTML_MESSAGE += "<td width=" + width + " align=center><font color=LEVEL>" + pageName + ii + "</font></td>";
}
else if (action.equals("add"))
{
HTML_MESSAGE += "<td width=" + width + ">" + "<button value=\"" + pageName + ii + "\" action=\"bypass -h Quest " + QUEST_LOADING_INFO + " manage_scheme_1 " + scheme + " " + ii + " x\" width=" + width + " height=20 back=\"L2UI_ch3.Btn1_normalOn\" fore=\"L2UI_ch3.Btn1_normal\"></td>";
}
else if (action.equals("remove"))
{
HTML_MESSAGE += "<td width=" + width + ">" + "<button value=\"" + pageName + ii + "\" action=\"bypass -h Quest " + QUEST_LOADING_INFO + " manage_scheme_2 " + scheme + " " + ii + " x\" width=" + width + " height=20 back=\"L2UI_ch3.Btn1_normalOn\" fore=\"L2UI_ch3.Btn1_normal\"></td>";
}
else if (DEBUG)
{
throw new RuntimeException();
}
}
HTML_MESSAGE += "</tr></table>";
int limit = buffsPerPage * Integer.parseInt(page);
int start = limit - buffsPerPage;
int end = Math.min(limit, buffList.size());
int k = 0;
for (int i = start; i < end; ++i)
{
String value = buffList.get(i);
value = value.replace("_", " ");
String[] extr = value.split(" ");
String name = extr[0];
name = name.replace("+", " ");
int id = Integer.parseInt(extr[1]);
int level = Integer.parseInt(extr[2]);
/*--String page = extr[3];--*/
if (action.equals("add"))
{
if (!isUsed(scheme, id, level))
{
if ((k % 2) != 0)
{
HTML_MESSAGE += "<BR1><table border=0 bgcolor=333333>";
}
else
{
HTML_MESSAGE += "<BR1><table border=0 bgcolor=000000>";
}
HTML_MESSAGE += "<tr><td width=35>" + getSkillIconHtml(id, level) + "</td><td fixwidth=170>" + name + "</td><td><button value=\"Add\" action=\"bypass -h Quest " + QUEST_LOADING_INFO + " add_buff " + scheme + "_" + id + "_" + level + " " + page + " " + TOTAL_BUFF + "\" width=75 height=21 back=\"L2UI_ch3.Btn1_normalOn\" fore=\"L2UI_ch3.Btn1_normal\"></td>" + "</tr></table>";
k += 1;
}
}
else if (action.equals("remove"))
{
if ((k % 2) != 0)
{
HTML_MESSAGE += "<BR1><table border=0 bgcolor=333333>";
}
else
{
HTML_MESSAGE += "<BR1><table border=0 bgcolor=000000>";
}
HTML_MESSAGE += "<tr><td width=35>" + getSkillIconHtml(id, level) + "</td><td fixwidth=170>" + name + "</td><td><button value=\"Remove\" action=\"bypass -h Quest " + QUEST_LOADING_INFO + " remove_buff " + scheme + "_" + id + "_" + level + " " + page + " " + TOTAL_BUFF + "\" width=75 height=21 back=\"L2UI_ch3.Btn1_normalOn\" fore=\"L2UI_ch3.Btn1_normal\"></td>" + "</table>";
k += 1;
}
}
HTML_MESSAGE += "<br><br><button value=\"Back\" action=\"bypass -h Quest " + QUEST_LOADING_INFO + " manage_scheme_select " + scheme + " x x\" width=75 height=21 back=\"L2UI_ch3.Btn1_normalOn\" fore=\"L2UI_ch3.Btn1_normal\">" + "<button value=\"Home\" action=\"bypass -h Quest " + QUEST_LOADING_INFO + " redirect main 0 0\" width=75 height=21 back=\"L2UI_ch3.Btn1_normalOn\" fore=\"L2UI_ch3.Btn1_normal\">" + "<br><font color=303030>" + TITLE_NAME + "</font></center></body></html>";
return HTML_MESSAGE;
}
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.
My official facebook profile!: https://www.facebook.com/spectrumL2
Specifications:
Revamped L2JACIS revision FROM the core
Private project!!! Revision that has been receiving corrections for over 3 years!!!
Events already installed in the revision:
TVT
CTF
KTB
PARTY FARM
SPOIL EVENT
CRAZY RATES
TOURNAMENT
TIME ZONE (INSTANCE)
All working correctly!!!
SIEGE ESSENTIAL FEATURES:
Walls fix
Gates fix
Flags fix
100% functional:
OLYMPIADS:
Implemented settings
Hero receives enchanted Weapons with equal status PvP Weapons
Optional /true/false
Hero can acquire all Hero Weapons
Optional true/false
OTHER IMPLEMENTATIONS:
Teleport fixed (directly to Giran)
Teleport effect classic
Vip skins vip collor name
Pack NPCs with effect already configured
BOSES already configured
Mobs already configured
CLASS BALANCE SPECIAL SYSTEM
We have a SPECIAL system developed for Class Balance with only 1 digit in XML %tage of configurable debuffs
Player limitation system in BOSES or PvP zones
BS blocking system in FLEG zones or events
Among others dozens of improvements made in the review...
price: 390 USD !
OBS: WE CAN CHANGE THE BANNER AND NAME OF THE SERVICE TO THE ONE OF YOUR PREFERENCE BUT THE SETTINGS MUST BE KEPT ANY CHANGES REQUIRE ADDITION
Server is Online – 1,000+ Active Players!
We’re excited to announce the addition of a Europe Proxy to improve connectivity for our EU players!
Clans can now benefit from VIP Access to help you catch up faster.
🎯 If you're a clan leader with at least 9 active members, join our Discord and open a ticket to claim your VIP rewards!
The Telegram team is rolling out a new batch of Stars-only gifts you’ll be able to mint as NFTs.
Don’t miss your chance to join the next Telegram trend and earn from it!
Buy Telegram Stars cheap and KYC-free
1 Star from $0.0149 (min. 50 Stars, bulk discounts available)
Promo code STARS5 — 5 % off
Pay any way you like: bank cards · crypto · other popular methods
How to purchase:
➡Online Store — Click
➡ Telegram bot — Click
Other services:
➡ SMM panel — Click
Regular buyers get extra discounts and promo codes.
Support:
➡ Telegram: https://t.me/solomon_bog
➡ Telegram channel: https://t.me/accsforyou_shop
➡ Discord: https://discord.gg/y9AStFFsrh
➡ WhatsApp: https://wa.me/79051904467
➡ Email: solomonbog@socnet.store
Use these contacts to discuss wholesale orders, partnerships (current list: https://socnet.bgng.io/partners) or to become a supplier.
SocNet — your shop for digital goods and premium subscriptions
The Telegram team is rolling out a new batch of Stars-only gifts you’ll be able to mint as NFTs.
Don’t miss your chance to join the next Telegram trend and earn from it!
Buy Telegram Stars cheap and KYC-free
1 Star from $0.0149 (min. 50 Stars, bulk discounts available)
Promo code STARS5 — 5 % off
Pay any way you like: bank cards · crypto · other popular methods
How to purchase:
➡Online Store — Click
➡ Telegram bot — Click
Other services:
➡ SMM panel — Click
Regular buyers get extra discounts and promo codes.
Support:
➡ Telegram: https://t.me/solomon_bog
➡ Telegram channel: https://t.me/accsforyou_shop
➡ Discord: https://discord.gg/y9AStFFsrh
➡ WhatsApp: https://wa.me/79051904467
➡ Email: solomonbog@socnet.store
Use these contacts to discuss wholesale orders, partnerships (current list: https://socnet.bgng.io/partners) or to become a supplier.
SocNet — your shop for digital goods and premium subscriptions
Question
orphangirl
First of all, I want to mention that I am a beginner.
I am trying to modify a java buffer. I want to put an if condition that checks if the player has (for example) item 1234(a permanent item, not a consumable) in inventory.
And if he has that item, he can add in the scheme buffs with option "canUse = 1" and buffs with option "canUse = 0".
Can anyone please help me or try to explain how can I put the condition that checks if the player has the item?
Thank you very much.
Edited by orphangirl4 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.