Jump to content

Recommended Posts

Posted (edited)

hello all, tonight I decided to share l2 supermonster code adapted acis, 100% tested !

 

so let's start.

 

package net.sf.l2j;

 

config.java

/** Events */  public static final String SMALLEVENTS_FILE = "./config/Events/SmallEvents.properties";
  public static final String OLYMPIAD_FILE = "./config/Events/Olympiad.properties";
  public static final String STRIDER_FILE = "./config/Events/Strider.properties";
  public static final String RANDOMFIGHT_FILE = "./config/Events/RandomFight.properties";
+public static final String SUPERMONSTER_FILE = "./config/Events/SuperMonster.properties";

at line 2599 

aCis_gameserver/java/net/sf/l2j/Config.java

// Super Monster
ExProperties SuperMonster = load(SUPERMONSTER_FILE);
ENABLE_SUPER_MONSTER = SuperMonster.getProperty("EnableSuperMonster", false);
SUPER_MONSTERS = SuperMonster.getProperty("SuperMonsters");


SUPER_MONSTERS_IDS = new ArrayList<>();
String[] arrayOfString1 = SUPER_MONSTERS.split(",");
int i = arrayOfString1.length;
int str1;
for (str1 = 0; str1 < i; str1++)
{
String id = arrayOfString1[str1];
SUPER_MONSTERS_IDS.add(Integer.valueOf(Integer.parseInt(id)));
}
SM_REWARD_PARTY = SuperMonster.getProperty("RewardParty", false);
SM_REWARD_PARTY_NOBLE = SuperMonster.getProperty("GiveNoblesseFullParty", false);
SM_REWARD_PARTY_HERO = SuperMonster.getProperty("GiveHeroFullParty", false);
SM_GIVE_NOBLE = SuperMonster.getProperty("GiveNoblesse", false);
SM_GIVE_HERO = SuperMonster.getProperty("GiveHero", false);
SM_GIVE_ITEM = SuperMonster.getProperty("GiveItemReward", false);


String[] smReward = SuperMonster.getProperty("ItemRewards", "57,100000").split(";");
SM_ITEM_REWARD = new ArrayList<>();
String[] arrayOfString2 = smReward;
str1 = arrayOfString2.length;
for (int id = 0; id < str1; id++)
{
String reward = arrayOfString2[id];


String[] rewardSplit = reward.split(",");
if (rewardSplit.length != 2)
{
_log.warning(StringUtil.concat(new String[]
{
"[Config.load()]: invalid config property -> ItemRewards \"",
reward,
"\""
}));
}
else
{
try
{
SM_ITEM_REWARD.add(new int[]
{


Integer.parseInt(rewardSplit[0]),
Integer.parseInt(rewardSplit[1])
});
}
catch (NumberFormatException nfe)
{
if (!reward.isEmpty())
{
_log.warning(StringUtil.concat(new String[]
{
"[Config.load()]: invalid config property -> ItemRewards \"",
reward,
"\""
}));
}
}
}
}
config file:
 
#=============================================================
# Super Monster
#=============================================================
# This are special monsters that are having special reward features when get killed.
# The list can contain L2Monster, L2Raid, L2GrandBoss instances!
# The script can be edited from data/scripts/events/SuperMonster/SuperMonster.java
# Enable The Super Monster ?
EnableSuperMonster = False

# Monsters ids.
# WARNING all the features will be available for the configured monsters!
# Format monsterId,monsterId,monsterId
SuperMonsters = 0

# Give reward for the full party?
RewardParty = False

# Give noblesse to the full party?
GiveNoblesseFullParty = False

# Give hero status to the full party? (Untill logout)
GiveHeroFullParty = False

# Give noblesse status for the killer?
GiveNoblesse = False

# Give hero status to the killer? (Untill logout)
GiveHero = False

# Give item reward?
# This is for both full party (if enabled) and killer.
GiveItemReward = False

# Items for reward
# Format itemId,amount;itemId,amount;itemId,amount
ItemRewards = 57,100000

script.cfg import:

events/SuperMonster/SuperMonster.java

datapack:

aCis_datapack/data/scripts/events/SuperMonster/SuperMonster.java

package events.SuperMonster;

import net.sf.l2j.Config;
import net.sf.l2j.gameserver.datatables.ItemTable;
import net.sf.l2j.gameserver.model.actor.L2Npc;
import net.sf.l2j.gameserver.model.actor.instance.L2PcInstance;
import net.sf.l2j.gameserver.model.itemcontainer.PcInventory;
import net.sf.l2j.gameserver.model.quest.Quest;
import net.sf.l2j.gameserver.network.serverpackets.StatusUpdate;

public class SuperMonster extends Quest
{
	public SuperMonster()
	{
		super(-1, "SuperMonster", "custom");
		
		if (Config.ENABLE_SUPER_MONSTER)
		{
			for (int mobs : Config.SUPER_MONSTERS_IDS)
				addKillId(mobs);
		}
	}
	
	@Override
	public String onKill(L2Npc npc, L2PcInstance player, boolean isPet)
	{
		if (Config.SM_REWARD_PARTY && player.getParty() != null)
		{
			for (L2PcInstance members : player.getParty().getPartyMembers())
			{
				members.sendMessage("Congratulations! You killed The SuperMonster!");
				
				if (Config.SM_GIVE_ITEM)
					rewardWinner(members);
				
				if (Config.SM_REWARD_PARTY_HERO && !player.isHero())
				{
					members.setHero(true);
					members.sendMessage("You are now hero untill relogin!");
				}
				
				if (Config.SM_REWARD_PARTY_NOBLE && !members.isNoble())
				{
					members.setNoble(true, true);
					members.sendMessage("You have become noblesse!");
				}
				
				members.broadcastUserInfo();
			}
		}
		else
		{
			player.sendMessage("Congratulations! You killed The SuperMonster!");
			
			if (Config.SM_GIVE_ITEM)
				rewardWinner(player);
			
			if (Config.SM_GIVE_HERO && !player.isHero())
			{
				player.setHero(true);
			}
			
			if (Config.SM_GIVE_NOBLE && !player.isNoble())
			{
				player.setNoble(true, true);
			}
			
			player.broadcastUserInfo();
		}
		
		return null;
	}
	
	static void rewardWinner(L2PcInstance player)
	{
		// Check for nullpointer
		if (player == null)
			return;
		
		// Iterate over all rewards
		for (int[] reward : Config.SM_ITEM_REWARD)
		{
			PcInventory inv = player.getInventory();
			
			// Check for stackable item, non stackabe items need to be added one by one
			if (ItemTable.getInstance().createDummyItem(reward[0]).isStackable())
			{
				inv.addItem("SuperMonster", reward[0], reward[1], player, player);
			}
			else
			{
				for (int i = 0; i < reward[1]; ++i)
				{
					inv.addItem("SuperMonster", reward[0], 1, player, player);
				}
			}
		}
		
		StatusUpdate statusUpdate = new StatusUpdate(player);
		statusUpdate.addAttribute(StatusUpdate.CUR_LOAD, player.getCurrentLoad());
		player.sendPacket(statusUpdate);
	}
	
	public static void main(String args[])
	{
		new SuperMonster();
	}
}
Edited by xAddytzu
Posted (edited)
EnableSuperMonster = False

SuperMonsters = 0

configs are redundant, if id is 0 it should be considered as false (otherwise if you put true you register script for id 0 which doesn't exist). Simply check id array length > 0.

 


 

I'm not sure if hero status is saved on database using it that way, for noble it's normally fine.

 


 

It's old writting style, scripts are on core now and main method is dropped.

 


 

Finally you should better put the whole content of

			player.sendMessage("Congratulations! You killed The SuperMonster!");
			
			if (Config.SM_GIVE_ITEM)
				rewardWinner(player);
			
			if (Config.SM_GIVE_HERO && !player.isHero())
			{
				player.setHero(true);
			}
			
			if (Config.SM_GIVE_NOBLE && !player.isNoble())
			{
				player.setNoble(true, true);
			}
			
			player.broadcastUserInfo();

into rewardWinner because it's redundant and you make 0 special check on party more than on single case. So L2PcInstance player is fine in any case. Even worst, you got messages only if the guy is on party not if he is solo because you badly copied paste without verifying if content was 1:1 copy from team case.

 


 

Last and not least you normally don't need to check null case.

Edited by Tryskell

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 recently purchased the account panel from this developer and wanted to leave a positive review.   The transaction was smooth, and the developer demonstrated exceptional professionalism throughout the process.   What truly sets them apart is their outstanding post-sale support. They are responsive, patient, and genuinely helpful when addressing questions or issues. It's clear they care about their customers' experience beyond just the initial sale.   I am thoroughly satisfied and grateful for the service. This is a trustworthy seller who provides real value through both a quality product and reliable support. 100% recommended."
    • Server owners, Top.MaxCheaters.com is now live and accepting Lineage 2 server listings. There is no voting, no rankings manipulation, and no paid advantages. Visibility is clean and equal, and early listings naturally appear at the top while the platform grows. If your server is active, it should already be listed. Submit here https://Top.MaxCheaters.com This platform is part of the MaxCheaters.com network and is being built as a long-term reference point for the Lineage 2 community. — MaxCheaters.com Team
    • ⚙️ General Changed “No Carrier” title to “Disconnected” to avoid confusion after abnormal DC. On-screen Clan War kill notifications will no longer appear during Sieges, Epics, or Events. Bladedancer or SwordSinger classes can now log in even when Max Clients (2) is reached, you cannot have both at the same time. The max is 3 clients. Duels will now be aborted if a monster aggros players during a duel (retail-like behavior). Players can no longer send party requests to blocked players (retail-like). Fixed Researcher Euclie NPC dialogue HTML error. Changed Clan leave/kick penalty from 12 hours to 3 hours. 🧙 Skills Adjusted Decrease Atk. Spd. & Decrease Speed land rates in Varka & FoG. Fixed augmented weapons not getting cooldown when entering Olympiad. 🎉 Events New Team vs Team map added. New Save the King map added (old TvT map). Mounts disabled during Events. Letter Collector Event enabled Monsters drop letters until Feb. 13th Louie the Cat in Giran until Feb. 16th Inventory slots +10 during event period 📜 Quests Fixed “Possessor of a Precious Soul Part 1” rare stuck issue when exceeding max quest items. Fixed Seven Signs applying Strife buff/debuff every Monday until restart. 🏆 Milestones New milestone: “Defeat 700 Monsters in Varka” 🎁 Rewards: 200 Varka’s Mane + Daily Coin 🌍 NEW EXP Bonus Zones Hot Springs added Varka Silenos added (hidden spots excluded) As always, thank you for your support! L2Elixir keeps evolving, improving, and growing every day 💙   Website: https://l2elixir.org/ Discord: https://discord.gg/5ydPHvhbxs
    • https://sms.pro/ — we are an SMS activation platform  seeking partners  mobile number providers  mobile number owners  owners of GSM modems  SIM card owners We process 1,000,000 activations every day.  寻找合作伙伴  手机号码提供商  手机号码持有者  GSM调制解调器持有者  SIM卡持有者 我们每天处理1,000,000次激活。  Ищем партнеров  Владельцы сим карт  провайдеров  владельцев мобильных номеров  владельцев модемов  Обрабатываем от 1 000 000 активаций в день ⚡️ Fast. Reliable.   https://sms.pro/ Support: https://t.me/alismsorg_bot
  • 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..