Jump to content
  • 0

[help] adding java codes


claww

Question

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

Link to comment
Share on other sites

Recommended Posts

  • 0

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]

Link to comment
Share on other sites

  • 0

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);
	}
}
}

Link to comment
Share on other sites

  • 0

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);

}

Link to comment
Share on other sites

  • 0

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

Link to comment
Share on other sites

  • 0

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

Link to comment
Share on other sites

  • 0

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

 

Link to comment
Share on other sites

  • 0

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

Link to comment
Share on other sites

  • 0

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

Link to comment
Share on other sites

  • 0

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

Link to comment
Share on other sites

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.



  • Posts

    • 2 Factor Authentication Code for 100% secure login. Account provided with full information (email, password, dob, gender, etc).
    • ready server for sale, also available for testing with ready and beautiful npc zone pvp with custom 2 epic core orfen lvl2 with all maps ready all quests work at 100% ready comm  board with buffer teleport gm shop service anyone interested send me a pm many more that I forget  Exp/Sp : x30 (Premium: x40)    Adena : x7 (Premium: x10)   Drop : x7 (Premium: 10)   Spoil : x7 (Premium: 10)   Seal Stones : x7 (Premium: 10)   Raid Boss EXP/SP : x10   Raid Boss Drop : x3 (Premium: x5)   Epic Boss Drop : x1 Enchants   Safe Enchant : +3   Max Enchant : +16   Normal Scroll of Enchant Chance : 55%   Blessed Scroll of Enchant Chance : 60% Game Features   GMShop (Max. B-Grade)   Mana Potions (1000 MP, 10 sec Cooldown)   NPC Buffer (Include all buffs, 2h duration)   Auto-learn skills (Except Divine Inspiration)   Global Gatekeeper   Skill Escape: 15 seconds or /unstuck   1st Class Transfer (Free)   2nd Class Transfer (Free)   3rd Class Transfer (700 halisha mark)   Subclass (Items required from Cabrio / Hallate / Kernon / Golkonda + Top B Weapon + 984 Cry B)   Subclass 5 Subclasses + Main (Previous subclasses to level 75 to add new one)   Noblesse (Full Retail Quest)   Buff Slots: 24 (28 with Divine Inspiration LVL 4)   Skill Sweeper Festival added (Scavenger level 36)   Skill Block Buff added   Maximum delevel to keep Skills: 10 Levels   Shift + Click to see Droplist   Global Shout & Trade Chat   Retail Geodata and Pathnodes   Seven Signs Retail   Merchant and Blacksmith of Mammon at towns   Dimensional Rift (Min. 3 people in party to enter - Instance)   Tyrannosaurus drop Top LS with fixed 50% chance   Fast Augmentation System (Using Life Stones from Inventory)   Chance of getting skills (Normal 1%, Mid 3%, High 5%, Top 10%)   Wedding System with 30 seconds teleport to husband/wife Olympiad & Siege   Olympiad circle 14 days. (Maximum Enchant +6)   Olympiads time 18:00 - 00:00 (GMT +3)   Non-class 5 minimum participants to begin   Class based disabled   Siege every week.   To gain the reward you need to keep the Castle 2 times. Clans, Alliances & Limits   Max Clients/PC: 2   Max Clan Members: 36   Alliances allowed (Max 1 Clans)   24H Clan Penalties   Alliance penalty reset at daily restart (3-5 AM)   To bid for a Clan Hall required Clan Level 6 Quests x3   Alliance with the Ketra Orcs   Alliance with the Varka Silenos   War with Ketra Orcs   War with the Varka Silenos   The Finest Food   A Powerful Primeval Creature   Legacy of Insolence   Exploration of Giants Cave Part 1   Exploration of Giants Cave Part 2   Seekers of the Holy Grail   Guardians of the Holy Grail   Hunt of the Golden Ram Mercenary Force   The Zero Hour   Delicious Top Choice Meat   Heart in Search of Power   Rise and Fall of the Elroki Tribe   Yoke of the Past     Renegade Boss (Monday to Friday 20:00)   All Raid Boss 18+1 hours random respawn   Core (Jewel +1 STR +1 DEX) Monday, Wednesday and Friday 20:00 - 21:00 (Maximum level allowed to enter Cruma Tower: 80)   Orfen (Jewel +1 INT +1 WIT) Monday to Friday, 20:00 - 21:00 (Maximum level allowed to enter Sea of Spores: 80)   Ant Queen Monday and Friday 21:00 - 22:00 (Maximum level allowed to enter Ant Nest: 80)   Zaken Monday,Wednesday,Friday 22:00 - 23:00 (Maximum level allowed to enter Devil's Isle: 80)   Frintezza Tuesday, Thursday and Sunday 22:00 – 23:00 (Need CC of 4 party and 7 people in each party min to join the lair, max is 8 party of 9 people each)   Baium (lvl80) Saturday 22:00 – 23:00   Antharas Every 2 Saturdays 22:00 - 23:00 Every 2 Sundays (alternating with Valakas) 22:00 – 23:00   Valakas Every 2 Saturdays 22:00 - 23:00 Every 2 Sundays (alternating with Antharas) 22:00 – 23:00   Subclass Raids (Cabrio, Kernon, Hallate, Golkonda) 18hours + 1 random   Noblesse Raid (Barakiel) 6 hours + 15min random   Varka’s Hero Shadith 8 hours + 30 mins random (4th lvl of alliance with Ketra)   Ketra’s Hero Hekaton 8 hours + 30 mins random (4th lvl of alliance with Varka)   Varka’s Commander Mos 8 hours + 30 mins random (5th lvl of alliance with Ketra)   Ketra’s Commander Tayr 8 hours + 30 mins random (5th lvl of alliance with Varka)
    • Have a great day! Unfortunately, we can not give you the codes at the moment, but they will be distributed as soon as trial is back online, thanks for understanding! Other users also can reply there for codes, we will send them out some time after.
    • Ok mates i would like to play a pridestyle server (interluide, gracie w/ever) Is there any such server online and worth playing?
  • Topics

×
×
  • Create New...

AdBlock Extension Detected!

Our website is made possible by displaying online advertisements to our members.

Please disable AdBlock browser extension first, to be able to use our community.

I've Disabled AdBlock