Jump to content
  • 0

HighRate Event



Greetings to all, I moved the HighRate event, the mobs spawn, but the mobs do not appear after death

 * 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 net.sf.l2j.highrate.event;

import java.sql.Connection;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.util.ArrayList;
import java.util.Calendar;
import java.util.Properties;
import java.util.concurrent.Future;
import java.util.logging.Logger;

import net.sf.l2j.L2DatabaseFactory;
import net.sf.l2j.gameserver.ThreadPoolManager;
import net.sf.l2j.gameserver.datatables.NpcTable;
import net.sf.l2j.gameserver.model.L2Spawn;
import net.sf.l2j.gameserver.model.Location;
import net.sf.l2j.gameserver.model.actor.L2Npc;
import net.sf.l2j.gameserver.model.actor.instance.L2MonsterInstance;
import net.sf.l2j.gameserver.templates.chars.L2NpcTemplate;
import net.sf.l2j.gameserver.util.Broadcast;
import net.sf.l2j.highrate.config.ConfigExtender;
import net.sf.l2j.highrate.instance.Instance;
import net.sf.l2j.highrate.instance.InstanceManager;
import net.sf.l2j.highrate.instance.InstanceMap;

 * @author Trance
 * @skype chr.trance
public class HighRate
	private static final Logger log = Logger.getLogger(HighRate.class.getName());
	private boolean active;
	private String start, end;
	private Calendar scheduledStart, scheduledEnd;
	private Future<?> startAt, endAt;
	private Instance world;
//	private Period _state;
	public static boolean Enabled;
	private static final HighRate instance = new HighRate();
	private final ArrayList<HighRateNpcInfo> npcs = new ArrayList<>();
//	private static enum Period
//	{
//		BEGIN,
//		END,
//	}
	public static HighRate getInstance()
		return instance;
	public static void startUp()
		if (Enabled)
			log.info("HighRate event has been loaded.");
	protected void onLoad()
		ThreadPoolManager tp = ThreadPoolManager.getInstance();
		startAt = tp.scheduleGeneral(new Runnable()
			public void run()
		}, scheduledStart.getTimeInMillis() - System.currentTimeMillis());
		endAt = tp.scheduleGeneral(new Runnable()
			public void run()
		}, scheduledEnd.getTimeInMillis() - System.currentTimeMillis());
	protected void onStart()
//		_state = Period.BEGIN;
//		announceHighRate();
		Broadcast.announceToOnlinePlayers("HighRate: The event has began.", true);
		world = InstanceManager.getInstance().create(InstanceMap.HighRateInstanceId);
		// when this hits, npcs get spawned
		for (HighRateNpcInfo info : npcs)
		NpcTable table = NpcTable.getInstance();
		try (Connection con = L2DatabaseFactory.getInstance().getConnection())
			PreparedStatement st = con.prepareStatement("SELECT npc_templateid, locx, locy, locz, heading, respawn_delay FROM spawnlist_highrate");
			ResultSet rs = st.executeQuery();
			while (rs.next())
				int pointer = 1;
				int npcId = rs.getInt(pointer++);
				int locX = rs.getInt(pointer++);
				int locY = rs.getInt(pointer++);
				int locZ = rs.getInt(pointer++);
				int heading = rs.getInt("heading");
				int respawn_delay = rs.getInt("respawn_delay");
				L2NpcTemplate tp = table.getTemplate(npcId);
				//L2NpcTemplate tp = NpcTable.getInstance().getTemplate(npcId);
					L2Spawn spawn = new L2Spawn(tp);
					L2Npc npc = spawn.doSpawn();
					if (npc instanceof L2MonsterInstance)
						npc.setInstanceId(world.getInstanceId(), false);
						log.warning("Not work Spawn");
					log.warning("Notwork all spawn");
		catch (Exception e)
		// flag it true, so we know its running
		active = true;

	protected void onEnd()
//		_state = Period.END;
//		announceHighRate();
		Broadcast.announceToOnlinePlayers("HighRate: The event has ended.", true);
		// unspawn everything
		if (active)
			for (HighRateNpcInfo info : npcs)
			active = false;
			// teleport players back, cleanup everything else
			world = null;
		// reschedule

	public void reload()
		// reload the event, stop it if active
	public void stopEvent()
//		_state = Period.CANCELLED;
//		announceHighRate();
		Broadcast.announceToOnlinePlayers("HighRate: The event has been cancelled.", true);
		if (active)
	protected void reschedule()
		String[] data = start.split("\\:");
		Calendar nc = Calendar.getInstance();
		nc.set(Calendar.HOUR_OF_DAY, Integer.parseInt(data[0]));
		nc.set(Calendar.MINUTE, Integer.parseInt(data[1]));
		data = end.split("\\:");
		Calendar ncEnd = Calendar.getInstance();
		ncEnd.set(Calendar.HOUR_OF_DAY, Integer.parseInt(data[0]));
		ncEnd.set(Calendar.MINUTE, Integer.parseInt(data[1]));
		if (nc.getTimeInMillis() < System.currentTimeMillis())
			nc.set(Calendar.DAY_OF_MONTH, nc.get(Calendar.DAY_OF_MONTH) + 1);
			ncEnd.set(Calendar.DAY_OF_MONTH, nc.get(Calendar.DAY_OF_MONTH) + 1);
		scheduledStart = nc;
		scheduledEnd = ncEnd;
		// If startAt is not set, that means the startup function has not been invoked yet.
		if (startAt != null)
			if (!startAt.isDone())
			if (!endAt.isDone())
	public static void parseConfig(Properties prop)
		Enabled = Boolean.parseBoolean(prop.getProperty("HighRate", "false"));
		if (!Enabled)
		String start = prop.getProperty("HighRateLaunch");
		String end = prop.getProperty("HighRateEnd");
		if (start == null)
			Enabled = false;
			log.warning("Failed configurating HighRate event, start time is invalid!");
		instance.start = start;
		instance.end = end;
		// Spawns.
		String p = prop.getProperty("HighRateSpawns");
		p = p.trim();
		String[] hash = p.split("];");
		for (String string : hash)
			string = string.replace('[', ' ');
			string = string.trim();
			String[] h = string.split("\\,");
			for (int i = 0; i < h.length; i++)
				h[i] = h[i].trim();
			int npcId = Integer.parseInt(h[0]);
			int x = Integer.parseInt(h[1]);
			int y = Integer.parseInt(h[2]);
			int z = Integer.parseInt(h[3]);
			int heading = Integer.parseInt(h[4]);
			L2NpcTemplate template = NpcTable.getInstance().getTemplate(npcId);
			if (template != null)
				HighRateNpcInfo ni = new HighRateNpcInfo(template, new Location(x, y, z, heading));
				log.warning("Cannot find npc template with id[" + npcId + "]. Skippng spawn!");
//	public final void announceHighRate()
//	{
//		switch (_state)
//		{
//			case BEGIN:
//				Broadcast.announceToOnlinePlayers("HighRate: The event has began.", true);
//				break;
//			case END:
//				Broadcast.announceToOnlinePlayers("HighRate: The event has ended.", true);
//				break;
//			case CANCELLED:
//				Broadcast.announceToOnlinePlayers("HighRate: The event has been cancelled.", true);
//				break;
//			default:
//				log.warning("Something wrong with announceHighRate.");
//				break;
//		}
//	}
	public boolean isActive()
		return active;


Edited by xfx4Mighty
Link to comment
Share on other sites

0 answers to this question

Recommended Posts

There have been no answers to this question yet

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

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

    • I've made over 200 euro just by fixing Kara codes, this guy was actually pathetic saying stuff like: 'I can't work today I'm sad because I broke up'.
    • Hello everyone, I am excited to announce the launch of my new Lineage 2 High Five server! If you're a fan of Lineage 2, you won't want to miss out on the action that my server has to offer. With a High Five chronicle, you can expect a truly unique and immersive gaming experience. My server offers a variety of exciting features, including a balanced economy, custom NPCs, and a friendly and active community. One of the standout features of my server is the focus on PvP. Whether you're a seasoned veteran or a newcomer to the world of Lineage 2, you'll find plenty of opportunities to engage in thrilling battles with other players. With our custom PvP system and unique events, you'll never run out of challenges to overcome. But that's not all - my server also offers a range of custom content and quests that will keep you engaged and entertained for hours on end. With regular updates and a dedicated team of developers, you can expect a high-quality and enjoyable gaming experience every time you log in. So what are you waiting for? Join the action on my Lineage 2 High Five server today and experience the thrill of a truly epic adventure!     Cronica High Five Rates: XP x30 SP x30 Adena x10 Drop x10 Spoil x 10 Seal Stone  x10 RateQuestsReward x5 RateQuestsAdenaReward x 5 RateRaidBoss x5 RateQuestsDrop x5 RateSiegeGuard x 1 RateSiegeGuardPA x1 RateManor x 5 Features Server: Free subb class Free class transfer Gm shop grade S Gk global Quest certification :on Siegue castle  monthly :on Olympiad  monthly :on Seven sings free :on 2 HOUR buffs Olympiad max enchant +6 Safe enchant normal 50% Safe enchant blessed 50% EnchantAttributeChance  50% EnchantAttributeCrystalChance =30% EPIC RAID BOSS CONFIG ANTHARAS_RESPAWN_TIME_PATTERN  17DAYS +-120 MINT #Time in minutes, at the end of which, Antharas spawned at the entrance to the lair: ANTHARAS_SPAWN_DELAY = 20 MIN. # Time in minutes, after which, if Antharas is not attacked, he falls asleep ANTHARAS_SLEEP_TIME = 30 # Valakas settings VALAKAS_RESPAWN_TIME_PATTERN  27 DAYS +- 120 M,IN # Time in minutes, at the end of which, Valakas spawned at the entrance to the lair: VALAKAS_SPAWN_DELAY = 10 # Time in minutes, after which, if Valakas is not attacked, he falls asleep: VALAKAS_SLEEP_TIME = 20 # Baium settings BAIUM_RESPAWN_TIME_PATTERN =  8 DAYS +-120 MIN # Time in minutes, after which, if Baium is not attacked, he falls asleep BAIUM_SLEEP_TIME = 30   "We are in beta phase."   L2EUROLATIN HIGH FIVE X30
    • Does anybody found the way to solve problems with precice calculation on drop? i found the same formula of drop in l2jsunrise en l2jserver. https://bitbucket.org/l2jserver/l2j-server-game/src/develop/src/main/java/com/l2jserver/gameserver/model/drops/strategy/IGroupedItemDropCalculationStrategy.java yesterday i check that the problem is with drop group, because for example Celtus npc drops holys on 100% configurated like datapack is comming. but if i creat a drop of holys or an item outside of a group drop. it is droped well.
    • Well, i have to agree with you here, as a community we should respect each other and respect each others interests and not damage them, they unbanned the idiot kara for no reason like 5 times like he will bring something to the community but all he did was to damage it over and over again and i still cant explain why that had to happen, i swear whoever contact me says that he've been scammed by him for atleast 50-100e and some for even much more.   p.s. its a community to provide/share cheats for games not share someone's work.
    • I dont see the unfairness here, I provided free sources to everyone for free, as a Cheater would do, isnt this what MAXCHEATERS were meant to be? Hell YES! As Im aware, the poor subscriber I took over to get your files, had PAID for them. Nobody is scamming anyone, not from my part, since I offered those files for FREE and they are virus free which anyone who have downloaded them can scan and provide full report they're clean as a fresh shaved pussy!   Maxcheaters once was MaxBastards, which i Liked more. It shall rise again for the old memories sake and not become a den full of pussies who are afraid to do what this forum is ALL about.   my 2 cents
  • 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