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

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.

Guest
Answer this question...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.



×
×
  • Create New...