Jump to content

Recommended Posts

Posted

The following codes are just some tools i made years ago on the go to help me deal with time consuming shits faster. Code is not perfect, its crap and stupid but still will help you work faster instead of wasting time doing things by hand.

 

1. Add new zones while in game. Just hit //addzone (ID) and put the first zone_id which is going to be put in ur zone_vertice in DB. Once you u hit the command, all the next calls will continue adding routes for the previous ID. If you wanna go for another ID just call the first command again.

 

public class AdminZone implements IAdminCommandHandler
{
	static int _zoneId = -1;
  private static final String[] ADMIN_COMMANDS =
	{
		.
        .
		"admin_addzone"
	};
    .
    .
    .
    
    @Override
	public boolean useAdminCommand(String command, L2PcInstance activeChar)
	{
      	.
        .
        .
          else if (actualCommand.equalsIgnoreCase("admin_addzone"))
		{
			if (st.hasMoreTokens())
			{
				try
				{
					int zoneId = Integer.parseInt(st.nextToken());
					if (!checkIfZoneExists(zoneId))
					{
						// add new field in db
						addNewZone(zoneId, activeChar.getLoc());
						activeChar.sendMessage("New zoneId added!! new zoneId: " + zoneId + ".");
						activeChar.sendMessage("Added new route point. zoneId: " + zoneId + " X: " + activeChar.getLoc().getX() + " Y: " + activeChar.getLoc().getY());
						_zoneId = zoneId;
					}
					else
					{
						// already exists, find last route and add next with route ++
						addNextRoute(zoneId, activeChar.getLoc());
						_zoneId = zoneId;
						activeChar.sendMessage("Next route added for zoneId: " + zoneId + " X: " + activeChar.getLoc().getX() + " Y: " + activeChar.getLoc().getY());
					}
				}
				catch (Exception e)
				{
					activeChar.sendMessage("Incorrect zoneId specified");
					e.printStackTrace();
				}
			}
			else
			{
				try
				{
					if (_zoneId < 0)
					{
						activeChar.sendMessage("ZoneId is negative.");
						return false;
					}
					// already exists, find last route and add next with route ++
					addNextRoute(_zoneId, activeChar.getLoc());
					activeChar.sendMessage("Next route added for zoneId: " + _zoneId + " X: " + activeChar.getLoc().getX() + " Y: " + activeChar.getLoc().getY());
				}
				catch (Exception e)
				{
					activeChar.sendMessage("Incorrect zoneId specified");
					e.printStackTrace();
				}
			}
		}

 

 

2. Add automatically drops to more than 1 monster. (same droplist). Edit the first sql u can select all the monsters/raids you wanna add the same droplists, fill the drops void method with the drops and THE STRUCTURE that ur droplist table follows. Execute the file and get the output(sql code which u can call from an sql query to apply those changes in ur table.

 

package test;

import java.io.File;
import java.io.FileNotFoundException;
import java.io.PrintStream;
import java.sql.Connection;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.util.ArrayList;

import net.sf.l2j.L2DatabaseFactory;
import net.sf.l2j.gameserver.datatables.FakePcsTable;

class AddDropRaids
{
	
	public static void main(String args[])
	{
		ArrayList<Integer> raids = new ArrayList<>();
		String RAIDBOSSES = "SELECT boss_id FROM raidboss_spawnlist WHERE `boss_id` IN (SELECT id from npc where `type`='L2RaidBoss' AND `level`>84 AND `level`<90);";
		try (Connection con = L2DatabaseFactory.getInstance().getConnection();
			PreparedStatement st = con.prepareStatement(RAIDBOSSES);
			ResultSet rs = st.executeQuery();)
		{
			if (rs.next())
			{
				raids.add(rs.getInt("id"));
			}
		}
		catch (Exception e)
		{
			e.printStackTrace();
		}
		
		droplist89(raids);
		
	}
	
	public static void droplist89(ArrayList<Integer> raids)
	{
		for (int raid : raids)
		{
			try
			{
				if (FakePcsTable.getInstance().getFakePc(raid) == null)
				{
					PrintStream myconsole = new PrintStream(new File("E://output.txt"));
					System.setOut(myconsole);
					myconsole.println("INSERT INTO `droplist` VALUES ('" + raid + "', '1000002', '1', '1', '17', '100000', '9', '0');");
					myconsole.println("INSERT INTO `droplist` VALUES ('" + raid + "', '1000075', '1', '1', '18', '5000', '0', '0');");
					myconsole.println("INSERT INTO `droplist` VALUES ('" + raid + "', '1000031', '1', '1', '19', '1000', '0', '0');");
					myconsole.println("INSERT INTO `droplist` VALUES ('" + raid + "', '60081', '1', '1', '20', '5000', '0', '0');");
					myconsole.println("INSERT INTO `droplist` VALUES ('" + raid + "', '1000076', '1', '1', '21', '80000', '0', '0');");
					myconsole.println("INSERT INTO `droplist` VALUES ('" + raid + "', '1000070', '1', '1', '22', '150000', '0', '0');");
					myconsole.println("INSERT INTO `droplist` VALUES ('" + raid + "', '98020', '25', '25', '23', '1000000', '10', '0');");
				}
			}
			catch (FileNotFoundException e)
			{
				// TODO Auto-generated catch block
				e.printStackTrace();
			}
			
		}
	}
}

 

 

Im sure i got more of such tools. Gunna share with u more in case i discover them.

  • Thanks 3
  • 3 years later...

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

    • 🎉 L2Mid is back! After a 3-year pause, we’re launching a new Interlude server based on the original Interlude client (old school 😉).   What to expect • The classic Interlude spirit • Old friends, rival clans, and returning legends • A season focused on pure nostalgia   This may be our final Interlude server. (maybe 😉) 🗓️ Opening: December 5, 2025 at 20:00 (GMT+2)   https://l2mid.com
    • Hello, i was wondering if there's a guide on how to add the enchanting armor glow system from  Ertheia or Lindvior to hi5?
    • I imported this file using Unreal Engine 2 Runtime, modified it, saved it back, and then placed it on the client. When I run the game and wear this back accessory, the client crashes!     2025.10.28 03:52:59 OS : Windows XP 5.1 (Build: 2600) CPU : GenuineIntel  Intel(R) Core(TM) i3-6100 CPU @ 3.70GHz @ 3697 MHz 1023MB RAM Video : NVIDIA GeForce GT 730 (3064) PosCode : TS4(273) -119:-62:-1474 4/1 [0] SkeletalMesh MFighter_Fuckl2jangel.MFighter_Fuckl2jangel: Serial size mismatch: Got 383399, Expected 383403 History: LoadObject <- (SkeletalMesh MFighter_Fuckl2jangel.MFighter_Fuckl2jangel 8376427==8376427/8376498 7993028 383403) <- ULinkerLoad::Preload <- PreLoadObjects <- UObject::EndLoad <- UObject::StaticLoadObject <- (Engine.Mesh MFighter_Fuckl2jangel.MFighter_Fuckl2jangel NULL) <- UMeshComponent::LoadMeshComponent <- UMeshContainer::UpdateMeshComponents <- APawn::UpdateMeshComponents <- User::UpdatePawnMeshContainerByItem <- User::UpdatePawnMeshContainer <- User::SetPawnResource <- NCPawnView_InvenItemWnd::OnRButtonDown <- NCVirtualWndMain::SetFocusingWindow <- NCVirtualWndMain::DispatchWndMsg <- NConsoleWnd::DispatchWndMsg <- NConsoleWnd::MasterConsoleEventProcess <- UEngine::InputEvent <- UWindowsViewport::CauseInputEvent <- UWindowsViewport::UpdateInput <- UViewport::ReadInput <- APlayerController::Tick <- ALineagePlayerController::Tick <- TickAllActors <- ULevel::Tick <- (NetMode=0) <- UMasterLevel::Tick <- TickLevel <- UGameEngine::Tick <- UpdateWorld <- MainLoop   I don't know what the reason is. Can you help me?
    • Good day, Sorry if I am posting in wrong category. Just wanted to ask if it is possbile to get this ->  For interlude server with classic client? I don't want any fancy interfaces, just this simple thing. Thank you for your answers.
  • 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