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

    • 寒冷的冬天 — 火热的折扣。使用促销代码 WINTER 即可在我们商店的所有购买中获得 10% 折扣! 有效链接: 数字商品商店(网站): 前往 其他服务和产品: 商店 Telegram 机器人: 前往 – 通过 Telegram 信使方便访问商店。 虚拟号码服务: 前往 用于购买 Telegram Stars 的 Telegram 机器人: 前往 – 在 Telegram 中快速且优惠地购买 Stars。 SMM 面板: 前往 – 推广您的社交媒体账户。 我们想向您展示当前的 促销和特别优惠列表 ,用于购买我们服务的产品和服务: 1. 您可以在首次购买时使用促销代码:SOCNET(15% 折扣) 2. 获取 $1 商店余额或 10–20% 折扣——只需在我们的网站注册后按以下模板填写您的用户名:"SEND ME BONUS, MY USERNAME IS..." ——您需要在我们的论坛主题中发布! 3. SMM 面板首次试用可获得 $1:只需在我们的网站(Support)提交主题为 “Get Trial Bonus” 的工单。 4. 我们的 Telegram 频道和 Stars 购买机器人中每周都会赠送 Telegram Stars! 新闻: ➡ Telegram 频道: https://t.me/accsforyou_shop ➡ WhatsApp 频道: https://chat.whatsapp.com/K8rBy500nA73z27PxgaJUw?mode=ems_copy_t ➡ Discord 服务器: https://discord.gg/y9AStFFsrh 联系方式和支持: ➡ Telegram: https://t.me/socnet_support ➡ WhatsApp: https://wa.me/79051904467 ➡ Discord: socnet_support ➡ ✉ Email: solomonbog@socnet.store
    • Cold winter — hot discounts. Use promo code WINTER and get 10% off on all purchases in our store! Active links: Digital goods store (Website): Go to Other services and products: 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. We want to present to you the current list of promotions and special offers for purchasing products and services of our service: 1. You can use a promo code for your first purchase: SOCNET (15% discount) 2. Get $1 on your store balance or a 10–20% discount — just write your username after registering on our website using the following template: "SEND ME BONUS, MY USERNAME IS..." – you need to post this in our forum thread! 3. Get $1 for the first trial launch of the SMM Panel: just open a ticket with the subject “Get Trial Bonus” on our website (Support). 4. Weekly Telegram Stars giveaways in our Telegram channel and in our bot for purchasing stars! News: ➡ Telegram channel: https://t.me/accsforyou_shop ➡ WhatsApp channel: https://chat.whatsapp.com/K8rBy500nA73z27PxgaJUw?mode=ems_copy_t ➡ Discord server: https://discord.gg/y9AStFFsrh Contacts and support: ➡ Telegram: https://t.me/socnet_support ➡ WhatsApp: https://wa.me/79051904467 ➡ Discord: socnet_support ➡ ✉ Email: solomonbog@socnet.store
    • Cold winter — hot discounts. Use promo code WINTER and get 10% off on all purchases in our store! Active links: Digital goods store (Website): Go to Other services and products: 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. We want to present to you the current list of promotions and special offers for purchasing products and services of our service: 1. You can use a promo code for your first purchase: SOCNET (15% discount) 2. Get $1 on your store balance or a 10–20% discount — just write your username after registering on our website using the following template: "SEND ME BONUS, MY USERNAME IS..." – you need to post this in our forum thread! 3. Get $1 for the first trial launch of the SMM Panel: just open a ticket with the subject “Get Trial Bonus” on our website (Support). 4. Weekly Telegram Stars giveaways in our Telegram channel and in our bot for purchasing stars! News: ➡ Telegram channel: https://t.me/accsforyou_shop ➡ WhatsApp channel: https://chat.whatsapp.com/K8rBy500nA73z27PxgaJUw?mode=ems_copy_t ➡ Discord server: https://discord.gg/y9AStFFsrh Contacts and support: ➡ Telegram: https://t.me/socnet_support ➡ WhatsApp: https://wa.me/79051904467 ➡ Discord: socnet_support ➡ ✉ Email: solomonbog@socnet.store
    • Telegram Stars — a new digital currency inside Telegram. And right now, the best opportunities are opening for profitable purchases and participation in exclusive events. And you can purchase Telegram Stars safely and at the best price in our bot. Active links: Telegram bot for purchasing Telegram Stars: Go to – fast and profitable purchase of Stars in Telegram. Other services and products: 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 SMM Panel: Go to – promotion of your social media accounts. We want to present to you the current list of promotions and special offers for purchasing products and services of our service: 1. You can use a promo code for your first purchase: SOCNET (15% discount) 2. Get $1 on your store balance or a 10–20% discount — just write your username after registering on our website using the following template: "SEND ME BONUS, MY USERNAME IS..." — you need to post this in our forum thread! 3. Get $1 for the first trial launch of the SMM Panel: just open a ticket with the subject “Get Trial Bonus” on our website (Support). 4. Weekly Telegram Stars giveaways in our Telegram channel and in our bot for purchasing stars! News: ➡ Telegram channel: https://t.me/accsforyou_shop ➡ WhatsApp channel: https://chat.whatsapp.com/K8rBy500nA73z27PxgaJUw?mode=ems_copy_t ➡ Discord server: https://discord.gg/y9AStFFsrh Contacts and support: ➡ Telegram: https://t.me/socnet_support ➡ WhatsApp: https://wa.me/79051904467 ➡ Discord: socnet_support ➡ ✉ Email: solomonbog@socnet.store
  • 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