Jump to content

Recommended Posts

Posted

Hello ive made a code for my srv and i thought to share it so. What does the code do? When you kill the mob with party or alone only the killer  (the one with the agro) will take Noblesse Statues with skills for ever. Also there will be an announce for the kills.

Create a class L2NBInstance in com.l2jserver.gameserver.model.actor.instance;

and add this code:

/*
 * Copyright (C) 2004-2014 L2J Server
 * 
 * This file is part of L2J Server.
 * 
 * L2J Server 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.
 * 
 * L2J Server 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.Announcements;
import com.l2jserver.gameserver.ThreadPoolManager;
import com.l2jserver.gameserver.enums.InstanceType;
import com.l2jserver.gameserver.instancemanager.RaidBossPointsManager;
import com.l2jserver.gameserver.instancemanager.RaidBossSpawnManager;
import com.l2jserver.gameserver.model.L2Spawn;
import com.l2jserver.gameserver.model.actor.L2Character;
import com.l2jserver.gameserver.model.actor.templates.L2NpcTemplate;
import com.l2jserver.gameserver.model.entity.Hero;
import com.l2jserver.gameserver.network.SystemMessageId;
import com.l2jserver.gameserver.network.serverpackets.SystemMessage;
import com.l2jserver.util.Rnd;

/**
 * This class manages all RaidBoss.<br>
 * In a group mob, there are one master called RaidBoss and several slaves called Minions.
 */
public class L2NBInstance 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>
	 * <B><U>Actions</U>:</B>
	 * <ul>
	 * <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>
	 * </ul>
	 * @param objectId the identifier of the object to initialized
	 * @param template to apply to the NPC
	 */
	public L2NBInstance(int objectId, L2NpcTemplate template)
	{
		super(objectId, template);
		setInstanceType(InstanceType.L2NBInstance);
		setIsRaid(true);
		setLethalable(false);
	}
	
	@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;
		}
		
		final L2PcInstance player = killer.getActingPlayer();
		if (player != null)
		{
			broadcastPacket(SystemMessage.getSystemMessage(SystemMessageId.RAID_WAS_SUCCESSFUL));
			if (player.getParty() != null)
			{
				for (L2PcInstance member : player.getParty().getMembers())
				{
					player.setNoble(true);
					Announcements.getInstance().announceToAll(getName() + " has been defeated by " + player.getName());
					
					RaidBossPointsManager.getInstance().addPoints(member, getId(), (getLevel() / 2) + Rnd.get(-5, 5));
					
				}
			}
			else
			{
				RaidBossPointsManager.getInstance().addPoints(player, getId(), (getLevel() / 2) + Rnd.get(-5, 5));
				if (player.isNoble())
				{
					Hero.getInstance().setRBkilled(player.getObjectId(), getId());
				}
			}
		}
		
		return true;
	}
	
	/**
	 * 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()
	{
		_maintenanceTask = ThreadPoolManager.getInstance().scheduleGeneralAtFixedRate(() -> checkAndReturnToSpawn(), 60000, getMaintenanceInterval() + Rnd.get(5000));
	}
	
	protected void checkAndReturnToSpawn()
	{
		if (isDead() || isMovementDisabled() || !canReturnToSpawnPoint())
		{
			return;
		}
		
		final L2Spawn spawn = getSpawn();
		if (spawn == null)
		{
			return;
		}
		
		final int spawnX = spawn.getX();
		final int spawnY = spawn.getY();
		final int spawnZ = spawn.getZ();
		
		if (!isInCombat() && !isMovementDisabled())
		{
			if (!isInsideRadius(spawnX, spawnY, spawnZ, Math.max(Config.MAX_DRIFT_RANGE, 200), true, false))
			{
				teleToLocation(spawnX, spawnY, spawnZ, false);
			}
		}
	}
	
	public void setRaidStatus(RaidBossSpawnManager.StatusEnum status)
	{
		_raidStatus = status;
	}
	
	public RaidBossSpawnManager.StatusEnum getRaidStatus()
	{
		return _raidStatus;
	}
	
	@SuppressWarnings("unused")
	protected void taunt()
	{
		L2PcInstance target = getAI().getAttackTarget().getActingPlayer();
		
		if (target == null)
		{
			target = getAI().getFollowTarget().getActingPlayer();
		}
		
		if (target == null)
		{
			target = getTarget().getActingPlayer();
		}
		
		if (target == null)
		{
			return;
		}
		
		if (target.isGM())
		{
			return;
		}
		
		if (getId() == 3425)
		{
			target.setPvpFlag(1);
		}
		
		if (getId() == 25632)
		{
			target.setPvpFlag(1);
		}
		
		if (getId() == 3452234)
		{
			target.setPvpFlag(1);
		}
		
		final String name = target.getName();
		
		final String[] msgs =
		{
			name + "! You think you can defeat me?",
			"Enjoy the hells " + name + "!",
			name + "! I will show you my power, and then you can tremble before my might as I crush your puny bones to bits!",
			"You are really stupid to have challenged me... " + name + "!" + " Get ready!",
			"I really have no items, I swear!",
			name + "! I will destroy you!",
			name + "! I will make you realize what true power is!",
			name + ", You are on the way to destruction.",
			name + "! You have no chance to survive make your time.",
			"So we meet again, " + name + "! This time you die!",
			"Vegeta! What does the scouter say about " + name + "'s powerlevel?",
			"How brave of you to walk straight into death, " + name,
			name + "! I've braved the fires of hell, stood against the attrition of time, and single-handedly unified this region, you think a little scrub like you can defeat me?",
			name + "! How inconsiderate of you, won't your friends miss you after you die?",
			"Start the clock! " + name + ", you will die in 5 minutes!",
			"It's time to sharpen my blade with human flesh!",
			name + "! You will not win! Get out of here while you can!",
			name + "! Even with all this zerg here I will still kill you all by myself!",
			"This one here named " + name + " will be no more soon...",
			name + "! You will die here like the rest before you!",
			name + "! I will show you the punishment that follows folly!",
			"Why do you attempt the futile, " + name + "?" + " Throwing your life away carelessly like this...",
			"Today is a sad day for you! " + name + "!",
			"Today is a good day to die!... for " + name + "!",
			"Haha! The ant is trying to fight the lion!",
			name + " is a fool! Fools die!",
			"Death looms near for " + name,
			"I **** YOUR MOTHER " + name.toUpperCase() + "!",
			name + "! You should be proud that you will die by my hands!",
			name + "! What is the meaning of death? well, I'll show it to you!",
			name + ", I think you need more healers!",
			name + ", You sure the loot is set on finders keepers?",
			name + "! I will kill you with my left hand and your friends with my right! Muhahaha!",
			"Brethren prior to WENCHES!",
			"I hath ninety-nine difficulties, nary a wench among them!",
			"HALT! The hour of the hammer has begun!",
			"Compelling tale, male sibling.",
			"Bare thy bosoms or make hasty egress!",
			"Relocate yourself, hound of the female gender. Be certain not to block the direction of which I am travelling.",
			"Fornicate this excrement!",
			"Cease all activities thou art engaged in - The hour of the hammer is upon us.",
			"Female canine I beg of you!",
			"Allow the carcasses to make contact with the ground!",
			"Advance towards me in an aggressive manner, male sibling!",
			"I so happen to be attracted to large posteriors, and I am inclined to be completely factual on the matter.",
			"Make thy brethren a priority before enjoying the company of loose women.",
			"Fecal matter tends to occur..."
		};
		
		if (target.getName().equalsIgnoreCase("GMREBELGMREBEL"))
		{
			target.sendMessage("You have killed a boss");
		}
		else
		{
			target.sendMessage("You have killed a boss");
		}
	}
	
	@Override
	public float getVitalityPoints(int damage)
	{
		return -super.getVitalityPoints(damage) / 100;
	}
	
	@Override
	public boolean useVitalityRate()
	{
		return false;
	}
	
}

Then, go to: com.l2jserver.gameserver.enums.InstanceType;

Fine:

    L2EventMobInstance(L2Npc);

and delete it, then add

 

    L2EventMobInstance(L2Npc),
    L2NBInstance(L2MonsterInstance);

 

  • Downvote 1
Posted

The main logic setNoble is wrong. Try harder and then open server.

Already shared. Stop sharing already shared things over and over again.

 

Locked.

Guest
This topic is now closed to further replies.


  • Posts

    • WTB Character on Lineage 2 Reborn - Origins 1x Server   Looking for lvl 80+ character (3 subclasses )+ clean email  Classes im mostly intrested about are: Mystic Muse Adventurer Ghost Hunter Soul Hound Grand Khavatari Titan   Im looking forward for your PM's here on Max website or leave a comment down below with your discord or any contact in case you have any of those classes. If you have any other class that are not mentioned drop a PM aswell might be intrested in other classes i haven't mentioned aswell if its high lvl and has good potential.
    • Thanks for showing us this post, it is clearly seen that some user names pulling hate in that post, have the same name here in maxcheaters.... it is very interesting information, as it shows that the same users here at maxcheaters are scouring other forum posts to spew their hate. this does not affect much, as the customers understand, that there are only 4 or 5 people globally trying to harm our project.... the rest are all happy, luckily 🙂   Greetings. PD: You still don't understand that this is going to spread to many servers and it's something you can't avoid... you understand that, don't you? By the way, if you used an extender like ours, maybe you wouldn't have to reopen your server hundreds of times over the years.
    • 🚨 L2MID RETURNS IN 2025! 🚨 After 3 long years… The wait is FINALLY over! One of the most legendary Lineage 2 server is coming back stronger, sharper, and more competitive than ever before. 💎 All users who vote will receive exclusive gifts in the future! 👉 Cast your vote now!  https://l2mid.com/vote/ Let’s make this the most epic comeback ever! Stay tuned for more updates and invite your friends L2Mid is BACK!
    • Yeah I also “heard” you are pretty popular over there 🙂 especially in Ukraine/RU   https://mmo-dev.info/threads/⭐-l2off-h5-gx-ext⭐.33144/
    • I do not disclose information about my clients 🙂 you will see them online for example, in brazil, argentina and chile. Have great sales.   Best regards.
  • 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