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

    • Dear partners! At the moment we are in great need of the following positions: ➡ WhatsApp OLD Accounts ➡ Twitter accounts with followers and posts (old accounts) Contact us via the details below. We will be glad to cooperate! Active links to our projects: Digital goods store (Website): Go to Store Telegram bot: Go to – convenient access to the store via the Telegram messenger. Virtual numbers service: Go to Telegram bot for purchasing Telegram Stars: Go to – fast and profitable purchase of Stars in Telegram. SMM Panel: Go to – promotion of your social media accounts. Contacts and support: ➡ Telegram: https://t.me/socnet_support ➡ WhatsApp: https://wa.me/79051904467 ➡ Discord: socnet_support ➡ ✉ Email: solomonbog@socnet.store
    • Dear partners! At the moment we are in great need of the following positions: ➡ WhatsApp OLD Accounts ➡ Twitter accounts with followers and posts (old accounts) Contact us via the details below. We will be glad to cooperate! Active links to our projects: Digital goods store (Website): Go to Store Telegram bot: Go to – convenient access to the store via the Telegram messenger. Virtual numbers service: Go to Telegram bot for purchasing Telegram Stars: Go to – fast and profitable purchase of Stars in Telegram. SMM Panel: Go to – promotion of your social media accounts. Contacts and support: ➡ Telegram: https://t.me/socnet_support ➡ WhatsApp: https://wa.me/79051904467 ➡ Discord: socnet_support ➡ ✉ Email: solomonbog@socnet.store
    • Dear partners! At the moment we are in great need of the following positions: ➡ WhatsApp OLD Accounts ➡ Twitter accounts with followers and posts (old accounts) Contact us via the details below. We will be glad to cooperate! Active links to our projects: Digital goods store (Website): Go to Store Telegram bot: Go to – convenient access to the store via the Telegram messenger. Virtual numbers service: Go to Telegram bot for purchasing Telegram Stars: Go to – fast and profitable purchase of Stars in Telegram. SMM Panel: Go to – promotion of your social media accounts. Contacts and support: ➡ Telegram: https://t.me/socnet_support ➡ WhatsApp: https://wa.me/79051904467 ➡ Discord: socnet_support ➡ ✉ Email: solomonbog@socnet.store
    • Dear partners! At the moment we are in great need of the following positions: ➡ WhatsApp OLD Accounts ➡ Twitter accounts with followers and posts (old accounts) Contact us via the details below. We will be glad to cooperate! Active links to our projects: Digital goods store (Website): Go to Store Telegram bot: Go to – convenient access to the store via the Telegram messenger. Virtual numbers service: Go to Telegram bot for purchasing Telegram Stars: Go to – fast and profitable purchase of Stars in Telegram. SMM Panel: Go to – promotion of your social media accounts. Contacts and support: ➡ Telegram: https://t.me/socnet_support ➡ WhatsApp: https://wa.me/79051904467 ➡ Discord: socnet_support ➡ ✉ Email: solomonbog@socnet.store
    • looking for someone who has cache cleaner for h5 
  • 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