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

    • TELEGRAM SEO TRAINING (Bot Ranking in Search) I teach a complete system for ranking Telegram bots at the top of search results by keywords and countries. The method works for services, shops, crypto projects, and any type of Telegram bot. You can also direct the traffic to your groups, channels, websites, or sales funnels. ⸻  Countries I work with USA, Israel, Russia, India, Turkey, China, Ukraine, Uzbekistan. If you need another country — message me, we’ll find a solution. ⸻ ️ Results First search results appear in 2–3 days. ⸻  What’s included in the training • how the Telegram search algorithm works and key ranking factors • keyword research for your country and niche • bot optimization: description, settings, greeting text • fixing and maintaining positions • specific promotion nuances for different countries ⸻  What you will receive • a complete system for ranking bots in search • understanding how to work with keywords, traffic, and positions • a skill you can use to promote your own projects or earn from clients ⸻  Who this training is for • beginners with zero experience — I explain everything from scratch • those who don’t have a bot — I provide a ready one for practice • anyone who wants to learn promotion and earn from this service ⸻  Why learn from me • doing Telegram SEO since 2021 • over 1000 successful orders • my own panel SMMTG.PRO and private databases • experience working with markets of Russia, Uzbekistan, Ukraine, Israel, USA, Turkey, China, India, Vietnam, Europe, and more ⸻  For pricing — message me t.me/smmtg_link
    • Hey everyone, I was wondering if anyone knows where the client loads all the .dat files. Is there some kind of manifest or list you can specify which dat files the client loads?
    • 🔥 Welcome to Lineage 2 Haruna x3 – True Classic Interlude Experience 🔥 At Haruna x3, we’re bringing back the true essence of Interlude – slow, meaningful progression where every level matters, every item has value, and PvP is real. We’re not about fast servers, pay-to-win advantages, or fake populations. Our goal is simple: create a fair, stable, and long-term server where players can enjoy real competition, strategic clan warfare, and the thrill of open-world PvP. 💎 What Makes Haruna x3 Special? x3 Rates – Perfect for steady, rewarding progression Classic Interlude Mechanics – Relive the nostalgia of Interlude Stable & Lag-Free Gameplay – Optimized for thousands of players online Fair & Balanced – No pay-to-win, every victory is earned PvP & Clan Warfare Focused – Every battle counts 🌟 Quality of Life Features to Enhance Your Experience We keep the classic feel while adding features that make the game more convenient and enjoyable, including: Shift + Click to view monster droplists Free item mail and buy/sell via Adena Daily login rewards & Stream Rewards ALT+K Skill Panel & Alt+Click buffs removal Offline shop system Captcha for security Donate Coins currency (cannot be traded, dropped, or destroyed) Classic P110 client – no custom interface 🏰 Our Philosophy We believe Lineage 2 is about the journey, not just the destination. Haruna x3 is designed for months and years of growth, not weeks. We provide a community-driven environment where honest gameplay, fair competition, and strategic teamwork are at the forefront. 🌍 Join Our Community Whether you’re a veteran of Interlude or a returning player seeking a true classic experience, Haruna x3 offers a place to fight, trade, and grow alongside dedicated players. Step into the world of Haruna x3 – where every decision matters, every fight counts, and every victory is yours to earn. Discord: https://discord.gg/7DDC9Dsxnh Website : www.l2haruna.com
    • No, the real purpose is cheating and custom  development for games.  I'm building a custom AI moderator specially for checking illegal activity and flag current topica.
  • 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