Jump to content
  • 0

[help] adding java codes


Question

Posted

hello,

 

i'm using l2jserver and i try to add some  java codes from this forum which i think are usefull for my server but... i dont know

 

as example this http://www.maxcheaters.com/forum/index.php?topic=124847.0

 

but when i compile i get error - i create other file with name "L2PVPInstance.java" adding code from above

 

 

and other codes which i have to add but in files which exist - i dont understand smth here from guides which i read....   to which lines i have to add codes if i add to end file these codes i get error....

 

example this : http://www.maxcheaters.com/forum/index.php?topic=160623.0

 

i know its smth what i dont understand can anyone explain me a bit .....  Thanks :P

Recommended Posts

  • 0
Posted

this one is with nobless if you kill barakiel

 

i add code with barakiel at middle ...

 

 

/*
* 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.l2jserver.gameserver.model.actor.instance;

import com.l2jserver.Config;
import com.l2jserver.gameserver.ThreadPoolManager;
import com.l2jserver.gameserver.instancemanager.RaidBossPointsManager;
import com.l2jserver.gameserver.instancemanager.RaidBossSpawnManager;
import com.l2jserver.gameserver.model.L2Skill;
import com.l2jserver.gameserver.model.L2Spawn;
import com.l2jserver.gameserver.model.actor.L2Character;
import com.l2jserver.gameserver.model.actor.L2Summon;
import com.l2jserver.gameserver.model.entity.Hero;
import com.l2jserver.gameserver.network.SystemMessageId;
import com.l2jserver.gameserver.network.serverpackets.SystemMessage;
import com.l2jserver.gameserver.templates.chars.L2NpcTemplate;
import com.l2jserver.util.Rnd;

/**
* This class manages all RaidBoss.
* In a group mob, there are one master called RaidBoss and several slaves called Minions.
*
* @version $Revision: 1.20.4.6 $ $Date: 2005/04/06 16:13:39 $
*/
public class L2RaidBossInstance extends L2MonsterInstance
{
private static final int RAIDBOSS_MAINTENANCE_INTERVAL = 30000; // 30 sec

private RaidBossSpawnManager.StatusEnum _raidStatus;

/**
 * Constructor of L2RaidBossInstance (use L2Character and L2NpcInstance constructor).<BR><BR>
 *
 * <B><U> Actions</U> :</B><BR><BR>
 * <li>Call the L2Character constructor to set the _template of the L2RaidBossInstance (copy skills from template to object and link _calculators to NPC_STD_CALCULATOR) </li>
 * <li>Set the name of the L2RaidBossInstance</li>
 * <li>Create a RandomAnimation Task that will be launched after the calculated delay if the server allow it </li><BR><BR>
 *
 * @param objectId Identifier of the object to initialized
 * @param L2NpcTemplate Template to apply to the NPC
 */
public L2RaidBossInstance(int objectId, L2NpcTemplate template)
{
	super(objectId, template);
	setInstanceType(InstanceType.L2RaidBossInstance);
	setIsRaid(true);
}

@Override
public void onSpawn()
{
	setIsNoRndWalk(true);
	super.onSpawn();
}

@Override
protected int getMaintenanceInterval()
{
	return RAIDBOSS_MAINTENANCE_INTERVAL;
}

@Override
public boolean doDie(L2Character killer)
{
	if (!super.doDie(killer))
		return false;

	L2PcInstance player = null;
	if (killer instanceof L2PcInstance)
		player = (L2PcInstance) killer;
	else if (killer instanceof L2Summon)
		player = ((L2Summon) killer).getOwner();



	if (player != null)
	{
		broadcastPacket(new SystemMessage(SystemMessageId.RAID_WAS_SUCCESSFUL));
		if (player.getParty() != null)
		{
			for (L2PcInstance member : player.getParty().getPartyMembers())
			{
				RaidBossPointsManager.addPoints(member, this.getNpcId(), (this.getLevel() / 2) + Rnd.get(-5, 5));
				if(member.isNoble())
					Hero.getInstance().setRBkilled(member.getObjectId(), this.getNpcId());
			}
		}
		else
		{
			RaidBossPointsManager.addPoints(player, this.getNpcId(), (this.getLevel() / 2) + Rnd.get(-5, 5));
			if(player.isNoble())
				Hero.getInstance().setRBkilled(player.getObjectId(), this.getNpcId());
		}
	}

	RaidBossSpawnManager.getInstance().updateStatus(this, true);
	return true;
}

		//barakiel give noblesse status
if (player != null)



                {



                                              int _barakielId = 25325;



                                             if (getNpcId() == _barakielId)



                                                       player.setNoble(true);



                                                   player.sendMessage("You have gained Noblesse status by killing Barakiel!");



                        broadcastPacket(new SystemMessage(SystemMessageId.RAID_WAS_SUCCESSFUL));



                        if (player.getParty() != null)
//here end script


/**
 * Spawn all minions at a regular interval Also if boss is too far from home
 * location at the time of this check, teleport it home
 * 
 */
@Override
protected void startMaintenanceTask()
{
	if (_minionList != null)
		_minionList.spawnMinions();

	_maintenanceTask = ThreadPoolManager.getInstance().scheduleGeneralAtFixedRate(new Runnable() {
		public void run()
		{
			checkAndReturnToSpawn();

			if (_minionList != null)
				_minionList.maintainMinions();
		}
	}, 60000, getMaintenanceInterval()+Rnd.get(5000));
}

protected void checkAndReturnToSpawn()
{
	if (isDead() || isMovementDisabled())
		return;

	// Gordon does not have permanent spawn
	if (getNpcId() == 29095)
		return;

	final L2Spawn spawn = getSpawn();
	if (spawn == null)
		return;

	final int spawnX = spawn.getLocx();
	final int spawnY = spawn.getLocy();
	final int spawnZ = spawn.getLocz();

	if (!isInCombat() && !isMovementDisabled())
	{
		if (!isInsideRadius(spawnX, spawnY, spawnZ, Math.max(Config.MAX_DRIFT_RANGE, 200), true, false))
			teleToLocation(spawnX, spawnY, spawnZ, false);
	}
}

/**
     * Reduce the current HP of the L2Attackable, update its _aggroList and launch the doDie Task if necessary.<BR><BR>
     *
     */
@Override
    public void reduceCurrentHp(double damage, L2Character attacker, boolean awake, boolean isDOT, L2Skill skill)
    {
    	super.reduceCurrentHp(damage, attacker, awake, isDOT, skill);
    }

    public void setRaidStatus (RaidBossSpawnManager.StatusEnum status)
{
	_raidStatus = status;
}

public RaidBossSpawnManager.StatusEnum getRaidStatus()
{
	return _raidStatus;
}

@Override
public float getVitalityPoints(int damage)
{
	return - super.getVitalityPoints(damage) / 100;
}

@Override
public boolean useVitalityRate()
{
	return false;
}
}
[code]

[/code]

  • 0
Posted

and this one is with PVPInstance

 

i create the file in com/l2jserver/model/actor/instance

 

package com.l2jserver.gameserver.model.actor.instance;

import java.util.StringTokenizer;

import com.l2jserver.gameserver.TradeController;
import com.l2jserver.gameserver.model.L2Multisell;
import com.l2jserver.gameserver.model.L2TradeList;
import com.l2jserver.gameserver.network.serverpackets.ActionFailed;
import com.l2jserver.gameserver.network.serverpackets.ExBuySellListPacket;
import com.l2jserver.gameserver.network.serverpackets.NpcHtmlMessage;
import com.l2jserver.gameserver.templates.chars.L2NpcTemplate;
import com.l2jserver.gameserver.util.StringUtil;

/**
* 
* @author Mentor
* @version 1.1
* @web www.teamsrv.net
*
*/

public class L2PVPInstance extends L2NpcInstance
{
public L2PVPInstance(int objectId, L2NpcTemplate template)
{
	super(objectId, template);
}

@Override
public String getHtmlPath(int npcId, int val)
{
	String pom = "";

	if (val == 0) pom = "" + npcId;
	else pom = npcId + "-" + val;

	return "data/html/PVPMerchant/" + pom + ".htm";
}

protected final void showBuyWindow(L2PcInstance player, int val)
{
	player.tempInventoryDisable();

	L2TradeList list = TradeController.getInstance().getBuyList(val);

	if (list != null && list.getNpcId().equals(String.valueOf(getNpcId())))
		player.sendPacket(new ExBuySellListPacket(player, list, 0, false));
	else
	{
		_log.warning("buylist id:" + val);
	}

	player.sendPacket(ActionFailed.STATIC_PACKET);
}

@Override
public void onBypassFeedback(L2PcInstance player, String command)
{
	StringTokenizer st = new StringTokenizer(command, " ");
	String actualCommand = st.nextToken(); // Get actual command
	int pvp = Integer.parseInt(st.nextToken());
	if (actualCommand.equalsIgnoreCase("Buy") && player.getPvpKills() >= pvp)
	{
		if (st.countTokens() < 1)
			return;

		int val = Integer.parseInt(st.nextToken());
		showBuyWindow(player, val);
	}
	else if (actualCommand.equalsIgnoreCase("Multisell") && player.getPvpKills() >= pvp)
	{
		if (st.countTokens() < 1)
			return;

		int val = Integer.parseInt(st.nextToken());
		L2Multisell.getInstance().separateAndSend(val, player, getNpcId(), false, getCastle().getTaxRate());
	}
	else if (actualCommand.equalsIgnoreCase("Exc_Multisell") && player.getPvpKills() >= pvp)
	{
		if (st.countTokens() < 1)
			return;

		int val = Integer.parseInt(st.nextToken());
		L2Multisell.getInstance().separateAndSend(val, player, getNpcId(), true, getCastle().getTaxRate());
	}
	else
	{
		NpcHtmlMessage html = new NpcHtmlMessage(getObjectId());
		final StringBuilder html1 = StringUtil.startAppend(2000, 
		"<html><body><font color=\"06ff0a\">PvP Manager:</font><br>	You not enough pvp kills.<br1>You have <font color=\"LEVEL\">",
		String.valueOf(player.getPvpKills()),
		"</font> pvp kills in <font color=\"FF0000\">",
		String.valueOf(pvp),
		"</font> pvp kills.<br><center>Created by <font color=\"06ff0a\">OurWorld</font></center></body></html>");
		html.setHtml(html1.toString());
		player.sendPacket(html);
		super.onBypassFeedback(player, command);
	}
}
}

  • 0
Posted

for barakiel code...jeeez you added it at the end of a method obviously you get error...you cant just put checks all over the core

 

where you see this...

if(player.isNoble())

Hero.getInstance().setRBkilled(player.getObjectId(), this.getNpcId());

 

just add after it

else

{

int npcId = getNpcId();

if (npcId == 25325)

player.setNoble(true);

}

  • 0
Posted

for the pvpshop crap show me your html files too

 

i have to make html before to compile it ??

 

i tought i will can make htmls after i will compile it :P

  • 0
Posted

i have to make html before to compile it ??

 

i tought i will can make htmls after i will compile it :P

 

but you need the htmls to test it xD

  • 0
Posted

but you need the htmls to test it xD

 

yes  but i was thinking to compile the code after to add htmls... but i cannot compile i got error

 

i tought its waste of time if i cannot compile the code... to create html for nothing

  • 0
Posted

here its ok no ?

 

i just want to make  olympiad every week

Announcements.getInstance().announceToAll(sm);

	Calendar currentTime = Calendar.getInstance();
	//currentTime.add(Calendar.MONTH, 1);
	currentTime.add(Calendar.HOUR, 168);
	//currentTime.set(Calendar.DAY_OF_MONTH, 1);
	currentTime.set(Calendar.DAY_OF_WEEK, Calendar.SUNDAY);
	currentTime.set(Calendar.AM_PM, Calendar.AM);
	currentTime.set(Calendar.HOUR, 12);
	currentTime.set(Calendar.MINUTE, 0);
	currentTime.set(Calendar.SECOND, 0);
	_olympiadEnd = currentTime.getTimeInMillis();

	Calendar nextChange = Calendar.getInstance();
	_nextWeeklyChange = nextChange.getTimeInMillis() + WEEKLY_PERIOD;
	scheduleWeeklyChange();
}

 

 

i will show u error from pvpinstance in few sec..  i have just to checkout again cause i compiled it

 

  • 0
Posted

here its ok no ?

 

i just want to make  olympiad every week

Announcements.getInstance().announceToAll(sm);

	Calendar currentTime = Calendar.getInstance();
	//currentTime.add(Calendar.MONTH, 1);
	currentTime.add(Calendar.HOUR, 168);
	//currentTime.set(Calendar.DAY_OF_MONTH, 1);
	currentTime.set(Calendar.DAY_OF_WEEK, Calendar.SUNDAY);
	currentTime.set(Calendar.AM_PM, Calendar.AM);
	currentTime.set(Calendar.HOUR, 12);
	currentTime.set(Calendar.MINUTE, 0);
	currentTime.set(Calendar.SECOND, 0);
	_olympiadEnd = currentTime.getTimeInMillis();

	Calendar nextChange = Calendar.getInstance();
	_nextWeeklyChange = nextChange.getTimeInMillis() + WEEKLY_PERIOD;
	scheduleWeeklyChange();
}

 

 

i will show u error from pvpinstance in few sec..  i have just to checkout again cause i compiled it

 

give a check on this and make it.

http://www.maxcheaters.com/forum/index.php?topic=47248.0

  • 0
Posted

here is the error

 

 


Buildfile: C:\server Source\srv\L2_GameServer\build.xml
clean:
   [delete] Deleting directory C:\server Source\srv\L2_GameServer\build
verifyRequirements:
init:
    [mkdir] Created dir: C:\server Source\srv\L2_GameServer\build
    [mkdir] Created dir: C:\server Source\srv\L2_GameServer\build\classes
    [mkdir] Created dir: C:\server Source\srv\L2_GameServer\build\dist
    [mkdir] Created dir: C:\server Source\srv\L2_GameServer\build\dist\login
    [mkdir] Created dir: C:\server Source\srv\L2_GameServer\build\dist\gameserver
version:
     [exec] Execute failed: java.io.IOException: Cannot run program "svnversion": CreateProcess error=2, The system cannot find the file specified
compile:
    [javac] Compiling 1460 source files to C:\server Source\srv\L2_GameServer\build\classes
    [javac] C:\server Source\srv\L2_GameServer\java\com\l2jserver\gameserver\model\actor\instance\L2PVPInstance.java:12: cannot find symbol
    [javac] symbol  : class StringUtil
    [javac] location: package com.l2jserver.gameserver.util
    [javac] import com.l2jserver.gameserver.util.StringUtil;
    [javac]                                     ^
    [javac] C:\server Source\srv\L2_GameServer\java\com\l2jserver\gameserver\model\actor\instance\L2PVPInstance.java:89: cannot find symbol
    [javac] symbol  : variable StringUtil
    [javac] location: class com.l2jserver.gameserver.model.actor.instance.L2PVPInstance
    [javac] 			final StringBuilder html1 = StringUtil.startAppend(2000, 
    [javac] 			                            ^
    [javac] 2 errors

BUILD FAILED
C:\server Source\srv\L2_GameServer\build.xml:62: Compile failed; see the compiler error output for details.

Total time: 9 seconds

  • 0
Posted

here is the error

 

 


Buildfile: C:\server Source\srv\L2_GameServer\build.xml
clean:
   [delete] Deleting directory C:\server Source\srv\L2_GameServer\build
verifyRequirements:
init:
    [mkdir] Created dir: C:\server Source\srv\L2_GameServer\build
    [mkdir] Created dir: C:\server Source\srv\L2_GameServer\build\classes
    [mkdir] Created dir: C:\server Source\srv\L2_GameServer\build\dist
    [mkdir] Created dir: C:\server Source\srv\L2_GameServer\build\dist\login
    [mkdir] Created dir: C:\server Source\srv\L2_GameServer\build\dist\gameserver
version:
     [exec] Execute failed: java.io.IOException: Cannot run program "svnversion": CreateProcess error=2, The system cannot find the file specified
compile:
    [javac] Compiling 1460 source files to C:\server Source\srv\L2_GameServer\build\classes
    [javac] C:\server Source\srv\L2_GameServer\java\com\l2jserver\gameserver\model\actor\instance\L2PVPInstance.java:12: cannot find symbol
    [javac] symbol  : class StringUtil
    [javac] location: package com.l2jserver.gameserver.util
    [javac] import com.l2jserver.gameserver.util.StringUtil;
    [javac]                                     ^
    [javac] C:\server Source\srv\L2_GameServer\java\com\l2jserver\gameserver\model\actor\instance\L2PVPInstance.java:89: cannot find symbol
    [javac] symbol  : variable StringUtil
    [javac] location: class com.l2jserver.gameserver.model.actor.instance.L2PVPInstance
    [javac] 			final StringBuilder html1 = StringUtil.startAppend(2000, 
    [javac] 			                            ^
    [javac] 2 errors

BUILD FAILED
C:\server Source\srv\L2_GameServer\build.xml:62: Compile failed; see the compiler error output for details.

Total time: 9 seconds

 

missing or wrong stringutil import

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

    • I ended up sorting a similar mess by working with a team that handled everything from discovery to launch and kept things super clear. Their business website design approach made it easy for me to get a site that actually fit my goals, plus I kept full ownership of everything. The long-term support and simple pricing structure saved me a ton of headaches down the road.
    • Interface sources for P447 (7s update) for Classic/Essence   NWindow + InterfaceClassic + L2Editor + L2ClientDat Mobius + XDat Editor   Download
    • Hey there, welcome to the community – no worries about being new, we all started exactly where you are. Let me break this down based on what you’re trying to achieve with your Interlude‑Classic idea.   What you’re describing is actually a pretty popular concept: basically Interlude gameplay and balance, but with Classic‑style UI and a cleaner overall user experience. A “hybrid client”, not a full chronicle change.   Projects that have done something similar or are worth studying:   Lucera 2 – You’re right about this one. They use a custom client that blends Interlude gameplay with a more modern/Classic‑like interface. Their UI work (inventory, skill bar, lobby, etc.) is a good reference point.   L2J Mobius – Not exactly your target, but it’s very flexible and has a lot of examples of customizations and adaptations between chronicles.   Smaller custom projects – There are (or were) a few hybrid attempts using Interlude server files with heavily modified clients, but most are private or closed‑source, so you mainly get ideas, not ready‑to-use files.   Where the real challenge is (the client side):   What you want is possible, but the heavy lifting is on the client, not the server. The main pain points usually are:   Making sure interface files are compatible between chronicles (UI textures, layouts, systemmsg, etc.).   L2Font and localization edits: titles, chat, system messages – a small mistake here can break visuals or cause weird text issues.   Character selection / lobby screens: if you take them from another chronicle, you have to adapt them carefully so they don’t conflict with Interlude data.   Inventory, status bars and shortcuts: they must still work with Interlude’s item/skill structure and packet format, or you’ll get visual desyncs and client errors.   About multi‑protocol:   You’re correct that multi‑protocol is often used by projects that want to support different client versions or custom blends. In your case, it can help “talk” properly with a customized client while keeping an Interlude base server. It doesn’t magically fix everything, but it gives you more flexibility on how client and server exchange data.   Quick chronicle breakdown (relevant for your idea):   2.0–2.6: Early, simpler mechanics, good base for old‑school vibes.   2.7: More skills and better balance, often used as a base for custom projects.   2.9.5: A “bridge” between old and new, very common choice for hybrid or heavily modded setups.   3.0+: Adds Kamael and systems you said you don’t want, so you’d mainly use it as a reference, not as a direct base.   My honest recommendation:   Start from a solid Interlude base (files you understand and can actually maintain). Interlude still has the most support, tools and community knowledge.   Focus first on UI/interface modifications instead of trying to change core mechanics. Use Lucera‑style clients and similar projects as visual/technical reference.   Consider a multi‑protocol setup only after you’re comfortable with a normal Interlude client; otherwise you’ll just stack complexity.   Join active L2J / client‑mod Discords and forums. There are specific channels for interface, system edits and client reverse‑engineering where people share tips and tools.   What I would avoid at the beginning:   No intentar mezclar tres o cuatro chronicles a la vez; con uno bien entendido + UI custom ya tienes más que suficiente trabajo.   No subestimar la parte de cliente; muchas veces es más complicada y más frágil que el lado del servidor.   No saltarte el testeo en entorno local; los híbridos rompen cosas pequeñas (tooltips raros, skills que crashean el cliente, UI bugueada) si no pruebas bien.   Resources worth checking:   L2J forums and old MaxCheaters threads about faction/hybrid servers and client mods.   GitHub repos with client tools and interface mods (even si no son exactamente tu chronicle, te sirven como ejemplo).   Discord communities focused on L2 client development; ahí es donde se mueve hoy la parte “seria” del modding.   The good news: what you want is achievable, just not “plug & play”. It will require patience, testing and a bit of learning on both server and client sides. If you share exactly which files/pack you’re planning to use and what you want your UI to look like, people here (me included) can give you more concrete, step‑by‑step advice.
    • I’m done with Lineage 2. Not because I “grew up”, not because I “don’t have time for games” anymore, but because this game has slowly turned into everything it was supposed to be against.   Let’s be honest: most people are not playing Lineage 2 anymore. They are running 5–10 boxes, macros and scripts, setting up their characters and going to watch Netflix. The core loop isn’t PvP, clan wars or raids – it’s AFK grinding and praying your gear upgrades don’t fail.   The game used to be about outplaying your enemy with positioning, timing and coordination. Now it’s about:   Who has more boxes logged in.   Who is willing to swipe the credit card harder.   Who abuses the most broken script, cheat or exploit before it gets “patched”.   And let’s talk about pay‑to‑win. You can pretend it’s “supporting the server” all you want, but when someone can buy power that takes others months (or is literally impossible) to reach, that’s not support, that’s buying victories. When top players are just walking credit cards with epics, donations and event gear, you don’t have competition, you have a spending contest.   The community? It’s just as bad. Most “friends” are temporary party members until they find a better CP, clan or donation package. Drama, backstabbing, ninja looting, clan leaders selling clan resources, spies in Discord – it’s more like a cheap political simulator than an MMO. People talk about “honor” and “fair play”, then log their 10th box, run radar and target through walls.   And private servers… So many promises: “long‑term project”, “no corruption”, “no over‑enchant items”, “balanced gameplay”. Then after a few weeks you see:   Admin friends with full gear “testing”.   Hidden donations or “special offers” for “supporters”.   GMs closing their eyes to obvious abuse because it’s their buddies or biggest donors. Every wipe and every “fresh start” is just another cycle of the same lie, and we all pretend “this time will be different”.   The saddest part? Most of us know all this and still keep coming back because Lineage 2 has an insane core – the world, the classes, the adrenaline of real PvP, the politics, the sieges. But that core is buried under layers of greed, abuse, bots, scripts, egos and fake promises.   So here is the brutal truth: Lineage 2 is not a hardcore competitive MMORPG anymore. It’s a casino disguised as nostalgia, kept alive by whales, box armies and people too addicted or too hopeful to finally let go.   If you’re still playing, ask yourself honestly: Are you having fun, or are you just grinding, coping and praying that “next server” will finally be the one that isn’t corrupt, pay‑to‑win or dead in three months?   For me, I’m out. Flame me, defend the game, call me salty – I don’t care. But deep down, most of you know I’m not lying.
  • 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..