Jump to content

Recommended Posts

Posted (edited)
package mods.LevelUpReward;

import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

import org.w3c.dom.Node;

import com.l2jserver.gameserver.engines.DocumentParser;
import com.l2jserver.gameserver.model.PlayerVariables;
import com.l2jserver.gameserver.model.actor.instance.L2PcInstance;
import com.l2jserver.gameserver.model.holders.ItemHolder;
import com.l2jserver.gameserver.network.serverpackets.NpcHtmlMessage;
import com.l2jserver.gameserver.scripting.scriptengine.events.PlayerLevelChangeEvent;
import com.l2jserver.gameserver.scripting.scriptengine.impl.L2Script;

public final class LevelUpReward extends L2Script
{
	// Misc
	private static final String HTML_PATH = "data/scripts/mods/LevelUpReward/";
	protected static boolean rewardAll = false;
	protected static final Map<Integer, LevelData> REWARDS = new HashMap<>();
	
	private LevelUpReward(String name, String descr)
	{
		super(name, descr);
		addPlayerLevelNotify(null);
		new LevelUpRewardData();
	}
	
	@Override
	public void onPlayerLevelChange(PlayerLevelChangeEvent event)
	{
		final L2PcInstance player = event.getPlayer();
		if (player == null)
		{
			return;
		}
		final int newLevel = event.getNewLevel();
		for (int oldLevel = (rewardAll) ? 1 : (event.getOldLevel() + 1); oldLevel <= newLevel; oldLevel++)
		{
			if (!REWARDS.containsKey(oldLevel))
			{
				continue;
			}
			final PlayerVariables vars = player.getVariables();
			if (vars.getBool("LEVEL_UP_REWARD_" + oldLevel, false))
			{
				continue;
			}
			final LevelData rewards = REWARDS.get(oldLevel);
			for (ItemHolder item : rewards.getItems())
			{
				player.addItem("Quest", item, player, true);
			}
			vars.set("LEVEL_UP_REWARD_" + oldLevel, true);
			if (rewards.getMessage() != "")
			{
				player.sendMessage(rewards.getMessage());
			}
			if (rewards.getHtmlFile() != "")
			{
				final NpcHtmlMessage html = new NpcHtmlMessage(player.getObjectId());
				html.setFile(player.getHtmlPrefix(), HTML_PATH + rewards.getHtmlFile());
				player.sendPacket(html);
			}	
		}
	}
	
	protected final class LevelUpRewardData extends DocumentParser
	{
		public LevelUpRewardData()
		{
			load();
		}
		
		@Override
		public void load()
		{
			parseDatapackFile("data/xml/LevelReward/LevelReward.xml");
		}
		
		@Override
		protected void parseDocument()
		{
			for (Node n = getCurrentDocument().getFirstChild(); n != null; n = n.getNextSibling())
			{
				if ("list".equals(n.getNodeName()))
				{
					for (Node d = n.getFirstChild(); d != null; d = d.getNextSibling())
					{
						if ("rewards".equals(d.getNodeName()))
						{
							LevelData data = new LevelData();
							for (Node e = d.getFirstChild(); e != null; e = e.getNextSibling())
							{
								if ("item".equals(e.getNodeName()))
								{
									data.addItem(parseInteger(e.getAttributes(), "id"), parseLong(e.getAttributes(), "count"));
								}
							}
							data.setMessage(parseString(d.getAttributes(), "message"));
							data.setHtmlFile(parseString(d.getAttributes(), "htmlFile"));
							REWARDS.put(parseInteger(d.getAttributes(), "level"), data);
						}
					}
					rewardAll = parseBoolean(n.getAttributes(), "rewardAll");
				}
			}
		}
	}
	
	protected final class LevelData
	{
		private String html;
		private final List<ItemHolder> items;
		private String message;
		
		public LevelData()
		{
			html = "";
			items = new ArrayList<>();
			message = "";
		}
		
		public void addItem(int itemId, long itemCount)
		{
			items.add(new ItemHolder(itemId, itemCount));
		}
		
		public void setHtmlFile(String htmlFile)
		{
			html = htmlFile;
		}
		
		public void setMessage(String message)
		{
			this.message = message;
		}
		
		public String getHtmlFile()
		{
			return html;
		}
		
		public List<ItemHolder> getItems()
		{
			return items;
		}
		
		public String getMessage()
		{
			return message;
		}
	}
	
	public static void main(String[] args)
	{
		new LevelUpReward(LevelUpReward.class.getSimpleName(), "mods");
	}
}

This is the mod i got.
I want it to work this way:
Example: When i get lvl 20 i receive one item. Then if i get lvl 20 again i receive it again.
i Want it to give me itens everytime i get lvl 20.. doent matter if i Delevel or something else
It is only working if i relog.
Can someone help me please? this forum is dead?
 

Edited by Tamira
Fix

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now


  • Posts

    • thank you very much , pleasure to work with clients that are very polite and patient!
    • @Banshee Garnet  Very helpful, with a strong willingness to solve problems. He found several errors that I had no idea existed, and there were indeed many, and even more. He notices everything that is wrong and does an excellent job. The price is very fair. Best of all, he doesn’t do the work as if he’s doing us a favor, as most developers usually do. He truly works seriously and shows great respect for the client.  
    • ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ L2DEVS — Premium L2OFF Extender for Lineage 2 Interlude 100+ Systems | Production Ready | 6+ Years Live Tested https://l2devs.com ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ L2Devs is a premium L2OFF extender built from years of real server experience. It extends the original Interlude core with 100+ configurable systems — PvP mechanics, event engines, economy control, anti-bot protection — without touching the original server source code. Every system is designed for real production: high concurrency, crash-safe routines, reduced DB load, deep configurability through external config files. No bloat. No experimental features. Only what actually works on live servers. ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 🔥 WHAT'S NEW — 2026 RELEASE ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ [NEW] Character Marketplace — Full in-game character trading. List, browse and buy characters directly from the server. Admin controls, price limits and anti-abuse validation included. [NEW] Auto Farm System — 100% functional in-game auto farm with configurable zones, skill usage and item pickup. Fully operator-controlled. [NEW] .bonus Command — Real-time bonus status viewer. Players check active rates, buffs and event bonuses at any moment with a single command. [NEW] Last Man Standing (LMS) — New event mode, last player standing wins. Configurable teams, areas and rewards. [NEW] Kill The Boss (KTB) — Team-based event, eliminate the raid boss. Full config: spawn, rewards and team balance. [NEW] Fake Hero System — Award hero status visually without affecting rankings. Configurable duration and effects. [NEW] Visual Weapons & Armor — Display alternate skins client-side without impacting actual stats. [IMPROVED] Anti-Bot Captcha v4 — Completely rebuilt from scratch. Smarter, lighter, harder to bypass. [IMPROVED] Advanced Balance System — Per-class, per-skill and per-scenario control. Fine-tune damage and healing for any situation. [FIXED] Nick Change Service — Completely reworked. Validation, history logging, edge-case fixes. Production-ready. [REWORKED] PvP Auto Announce — Rebuilt for kills, streaks and milestones. Fully configurable messages and thresholds. [REWORKED] Happy Hour Event — Flexible scheduling, rate multipliers, configurable announces. ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ ⚙️ GENERAL SYSTEMS ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ - Cached Extended IOBuffer (8192kb) - Offline Shops & Buffers (restore after restart with fixed location) - Offline Buffer System - ALT+B Augmentation House - Shift+Click Drop/Spoil List - Auto Learn Skills - Scheme Buffer - Global Trade Chat - Global Vote Reward System (Hopzone, Topzone, custom) - Achievements System - Custom Subclass (Accumulative stats) - Change Name / Title Color - Change Gender / Race (Skin) - VIP System (chat, autoloot, extended features) - .menu Command (fully configurable) - Pet Sales via Multisell - Item Bid Auctioner for Clan Halls - Show Mob Level / NPC Clan Flag - Spawn Protection System - Min Level Trade - Use Any Dyes - No Drop on Death (configurable) - Auto Potion System (by Item ID, HP/MP %, reuse delay) ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ ⚔️ PVP & OLYMPIAD ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ - PvP Auto Announce System (rebuilt) - PvP / PK / War Reward - Epic Items Rank - Raid Boss Points Rank - Global PvP Rankings - Anti Abuse Validations - Olympiad Season Rank Pages - Restore Stats on Fight Start - Olympiad Second Time System - Last 10 Minutes Entry - Third Class Summons Control - Castle Announce & Standby Time - Champion System with Rewards - Damage Cap System - Item % Steal by Zone - Last Hit Announce (Raid/Boss) - Disable SSQ after Castle Siege ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 🎯 EVENT ENGINE ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ - Team vs Team (TvT) - Capture The Flag (CTF) - Death Match (DM) - Last Man Standing (LMS) — NEW - Kill The Boss (KTB) — NEW - Destroy The Base (DTB) - Korean Style Events - Castle Siege Events - Happy Hour Event (reworked) - Win/Loss Rewards - Custom Team Titles & Colors - Kill Counter in Title - Firework Effects - Reset Buffs on Finish - Balance Bishops - Disconnect Recovery - Open Door / Wall System - AFK Time Control ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 💎 DROPS, ENCHANT & ITEMS ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ - Fully Configurable Drop System (min/max level, all mobs, RBs, individual) - Armor Enchant Bonus System (+7/+8/+9 extra bonuses) - Enchant Stats System (full control per enchant level) - Blessed Enchant Rates (armor & weapons) - Enchant Restrictions & Protections - Spellbook Drop Enable/Disable - Custom Cancel Effects (min/max configurable) - Raid Boss HP % Announce - No Sell / No Private Buy Items ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 🔒 SECURITY & PERFORMANCE ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ - Anti-Bot & Captcha v4 (2026) — rebuilt from scratch - Anti-Exploit & Anti-Abuse (multi-layer) - Safe Enchant & Item Handling - Crash-Safe Routines - Optimized Thread Usage - Reduced Database Load - Improved Packet Handling - High Concurrency Design (tested 2000+ connections) - Tested on Live Servers 6+ Years ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 🔄 HOT RELOAD — NO RESTART NEEDED ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ EnterWorld HTML | Donate Shop | Offline Buffer | Champion NPC | AntiBot | VIP System | Auction System | AutoLoot | Castle Siege Manager | Character Lock | Clan PvP Status | Auto Learn | Skill Data | Door Data | Deco Data | Multisell / Drop List | Custom Config Files ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 💰 PRICING — LAUNCH OFFER ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 🔥 FULL PACK — $299 USD only cryptos (regular price $450 — save 33%)    + $30 USD/month (updates & support) Includes: ✔ Compiled extender (L2OFF Interlude) ✔ Full configuration files ✔ All 100+ systems active ✔ Client dashboard access ✔ IP change at no extra cost ✔ Monthly updates & improvements ✔ Priority support via Discord/Telegram ✔ Tested on live servers 6+ years   SOURCE CODE — $1499 USD only cryptos   ⚠️ Launch offer is limited time. Price returns to $450 after offer ends. ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 📬 CONTACT ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ Website: https://l2devs.com Discord & Telegram: available on the website Questions? Open a ticket or contact us on Discord. We respond fast. L2Devs — Built for servers that take quality seriously. Unique features, everything else is just a copy. Regards. The H5 and Classic versions will be available very soon!
  • Topics

×
×
  • Create New...

Important Information

This community uses essential cookies to function properly. Non-essential cookies and third-party services are used only with your consent. Read our Privacy Policy and We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue..