Jump to content

Recommended Posts

Posted

i havent shared anything lately so heres another small thing.

 

Index: /trunk/Interlude_C6_GameServer/java/net/ins/gameserver/model/actor/instance/L2PcInstance.java
===================================================================
--- /trunk/Interlude_C6_GameServer/java/net/ins/gameserver/model/actor/instance/L2PcInstance.java (revision 8)
+++ /trunk/Interlude_C6_GameServer/java/net/ins/gameserver/model/actor/instance/L2PcInstance.java (revision 18)
@@ -216,6 +216,6 @@
	private static final String RESTORE_SKILL_SAVE = "SELECT skill_id,skill_level,effect_count,effect_cur_time, reuse_delay FROM character_skills_save WHERE char_obj_id=? AND class_index=? AND restore_type=? ORDER BY buff_index ASC";
	private static final String DELETE_SKILL_SAVE = "DELETE FROM character_skills_save WHERE char_obj_id=? AND class_index=?";
-    private static final String UPDATE_CHARACTER = "UPDATE characters SET level=?,maxHp=?,curHp=?,maxCp=?,curCp=?,maxMp=?,curMp=?,str=?,con=?,dex=?,_int=?,men=?,wit=?,face=?,hairStyle=?,hairColor=?,heading=?,x=?,y=?,z=?,exp=?,expBeforeDeath=?,sp=?,karma=?,pvpkills=?,pkkills=?,rec_have=?,rec_left=?,clanid=?,maxload=?,race=?,classid=?,deletetime=?,title=?,accesslevel=?,online=?,isin7sdungeon=?,clan_privs=?,wantspeace=?,base_class=?,onlinetime=?,punish_level=?,punish_timer=?,newbie=?,nobless=?,power_grade=?,subpledge=?,last_recom_date=?,lvl_joined_academy=?,apprentice=?,sponsor=?,varka_ketra_ally=?,clan_join_expiry_time=?,clan_create_expiry_time=?,char_name=?,death_penalty_level=? WHERE obj_id=?";
-    private static final String RESTORE_CHARACTER = "SELECT account_name, obj_Id, char_name, level, maxHp, curHp, maxCp, curCp, maxMp, curMp, acc, crit, evasion, mAtk, mDef, mSpd, pAtk, pDef, pSpd, runSpd, walkSpd, str, con, dex, _int, men, wit, face, hairStyle, hairColor, sex, heading, x, y, z, movement_multiplier, attack_speed_multiplier, colRad, colHeight, exp, expBeforeDeath, sp, karma, pvpkills, pkkills, clanid, maxload, race, classid, deletetime, cancraft, title, rec_have, rec_left, accesslevel, online, char_slot, lastAccess, clan_privs, wantspeace, base_class, onlinetime, isin7sdungeon, punish_level, punish_timer, newbie, nobless, power_grade, subpledge, last_recom_date, lvl_joined_academy, apprentice, sponsor, varka_ketra_ally,clan_join_expiry_time,clan_create_expiry_time,death_penalty_level FROM characters WHERE obj_id=?";
+    private static final String UPDATE_CHARACTER = "UPDATE characters SET level=?,maxHp=?,curHp=?,maxCp=?,curCp=?,maxMp=?,curMp=?,str=?,con=?,dex=?,_int=?,men=?,wit=?,face=?,hairStyle=?,hairColor=?,heading=?,x=?,y=?,z=?,exp=?,expBeforeDeath=?,sp=?,karma=?,pvpkills=?,pkkills=?,rec_have=?,rec_left=?,clanid=?,maxload=?,race=?,classid=?,deletetime=?,title=?,accesslevel=?,online=?,isin7sdungeon=?,clan_privs=?,wantspeace=?,base_class=?,onlinetime=?,punish_level=?,punish_timer=?,newbie=?,nobless=?,power_grade=?,subpledge=?,last_recom_date=?,lvl_joined_academy=?,apprentice=?,sponsor=?,varka_ketra_ally=?,clan_join_expiry_time=?,clan_create_expiry_time=?,char_name=?,death_penalty_level=?,donator=? WHERE obj_id=?";
+    private static final String RESTORE_CHARACTER = "SELECT account_name, obj_Id, char_name, level, maxHp, curHp, maxCp, curCp, maxMp, curMp, acc, crit, evasion, mAtk, mDef, mSpd, pAtk, pDef, pSpd, runSpd, walkSpd, str, con, dex, _int, men, wit, face, hairStyle, hairColor, sex, heading, x, y, z, movement_multiplier, attack_speed_multiplier, colRad, colHeight, exp, expBeforeDeath, sp, karma, pvpkills, pkkills, clanid, maxload, race, classid, deletetime, cancraft, title, rec_have, rec_left, accesslevel, online, char_slot, lastAccess, clan_privs, wantspeace, base_class, onlinetime, isin7sdungeon, punish_level, punish_timer, newbie, nobless, power_grade, subpledge, last_recom_date, lvl_joined_academy, apprentice, sponsor, varka_ketra_ally,clan_join_expiry_time,clan_create_expiry_time,death_penalty_level,donator FROM characters WHERE obj_id=?";
	private static final String RESTORE_CHAR_SUBCLASSES = "SELECT class_id,exp,sp,level,class_index FROM character_subclasses WHERE char_obj_id=? ORDER BY class_index ASC";
	private static final String ADD_CHAR_SUBCLASS = "INSERT INTO character_subclasses (char_obj_id,class_id,exp,sp,level,class_index) VALUES (?,?,?,?,?,?)";
@@ -448,4 +448,5 @@
	private boolean _noble = false;
	private boolean _hero = false;
+	private boolean _isDonator = false;
	/** The L2FolkInstance corresponding to the last Folk wich one the player talked. */
	private L2FolkInstance _lastFolkNpc = null;
@@ -5509,4 +5510,5 @@
				player.setNewbie(rset.getInt("newbie") == 1);
				player.setNoble(rset.getInt("nobless") == 1);
+				player.setDonator((rset.getInt("donator")==1)? true : false);
				player.setClanJoinExpiryTime(rset.getLong("clan_join_expiry_time"));
				if (player.getClanJoinExpiryTime() < System.currentTimeMillis())
@@ -5953,5 +5955,6 @@
			statement.setString(55, getName());
			statement.setLong(56, getDeathPenaltyBuffLevel());
-			statement.setInt(57, getObjectId());
+			statement.setInt(57, isDonator() ? 1 : 0);
+			statement.setInt(58, getObjectId());
			statement.execute();
			statement.close();
@@ -10236,3 +10239,13 @@
		return _floodProtectors;
	}
+	
+	public boolean isDonator()
+	{
+	      return _isDonator;
+	}
+	      
+	public void setDonator(boolean value)
+	{
+		_isDonator = value;
+	}
}
Index: /trunk/Interlude_C6_GameServer/java/net/ins/gameserver/handler/DonatorCommandHandler.java
===================================================================
--- /trunk/Interlude_C6_GameServer/java/net/ins/gameserver/handler/DonatorCommandHandler.java (revision 18)
+++ /trunk/Interlude_C6_GameServer/java/net/ins/gameserver/handler/DonatorCommandHandler.java (revision 18)
@@ -0,0 +1,75 @@
+/*
+ * 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 2, 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, write to the Free Software
+ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
+ * 02111-1307, USA.
+ *
+ * http://www.gnu.org/copyleft/gpl.html
+ */
+package net.ins.gameserver.handler;
+
+import java.util.Map;
+import java.util.logging.Logger;
+
+import javolution.util.FastMap;
+import net.ins.Config;
+
+public class DonatorCommandHandler
+{
+	private static Logger _log = Logger.getLogger(ItemHandler.class.getName());
+	private static DonatorCommandHandler _instance;
+	private Map<String, IDonatorCommandHandler> _datatable;
+
+	public static DonatorCommandHandler getInstance()
+	{
+		if (_instance == null)
+			_instance = new DonatorCommandHandler();
+		return _instance;
+	}
+
+	private DonatorCommandHandler()
+	{
+		_datatable = new FastMap<String, IDonatorCommandHandler>();
+
+		_log.config("DonatorCommandHandler: Loaded " + _datatable.size() + " handlers.");
+	}
+
+	public void registerDonatorCommandHandler(IDonatorCommandHandler handler)
+	{
+		String[] ids = handler.getDonatorCommandList();
+		for (int i = 0; i < ids.length; i++)
+		{
+			if (Config.DEBUG)
+				_log.fine("Adding handler for command " + ids[i]);
+			_datatable.put(ids[i], handler);
+		}
+	}
+
+	public IDonatorCommandHandler getDonatorCommandHandler(String DonatorCommand)
+	{
+		String command = DonatorCommand;
+		if (DonatorCommand.indexOf(" ") != -1)
+			command = DonatorCommand.substring(0, DonatorCommand.indexOf(" "));
+		if (Config.DEBUG)
+			_log.fine("getting handler for command: " + command + " -> " + (_datatable.get(command) != null));
+		return _datatable.get(command);
+	}
+
+	/**
+	 * @return
+	 */
+	public int size()
+	{
+		return _datatable.size();
+	}
+}
Index: /trunk/Interlude_C6_GameServer/java/net/ins/gameserver/handler/IDonatorCommandHandler.java
===================================================================
--- /trunk/Interlude_C6_GameServer/java/net/ins/gameserver/handler/IDonatorCommandHandler.java (revision 18)
+++ /trunk/Interlude_C6_GameServer/java/net/ins/gameserver/handler/IDonatorCommandHandler.java (revision 18)
@@ -0,0 +1,45 @@
+/*
+ * 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 2, 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, write to the Free Software
+ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
+ * 02111-1307, USA.
+ *
+ * http://www.gnu.org/copyleft/gpl.html
+ */
+package net.ins.gameserver.handler;
+
+import net.ins.gameserver.model.actor.instance.L2PcInstance;
+
+/**
+ * This class ...
+ * 
+ * @version $Revision: 1.1.4.2 $ $Date: 2005/03/27 15:30:09 $
+ */
+public interface IDonatorCommandHandler
+{
+	/**
+	 * this is the worker method that is called when someone uses an admin command.
+	 * 
+	 * @param activeChar
+	 * @param command
+	 * @return command success
+	 */
+	public boolean useDonatorCommand(String command, L2PcInstance activeChar, String target);
+
+	/**
+	 * this method is called at initialization to register all the item ids automatically
+	 * 
+	 * @return all known itemIds
+	 */
+	public String[] getDonatorCommandList();
+}
Index: /trunk/Interlude_C6_GameServer/java/net/ins/gameserver/handler/chathandlers/ChatAll.java
===================================================================
--- /trunk/Interlude_C6_GameServer/java/net/ins/gameserver/handler/chathandlers/ChatAll.java (revision 2)
+++ /trunk/Interlude_C6_GameServer/java/net/ins/gameserver/handler/chathandlers/ChatAll.java (revision 18)
@@ -19,5 +19,7 @@

import net.ins.Config;
+import net.ins.gameserver.handler.DonatorCommandHandler;
import net.ins.gameserver.handler.IChatHandler;
+import net.ins.gameserver.handler.IDonatorCommandHandler;
import net.ins.gameserver.handler.IVoicedCommandHandler;
import net.ins.gameserver.handler.VoicedCommandHandler;
@@ -44,4 +46,5 @@
	{
		boolean vcd_used = false;
+		boolean dcd_used = false;
		if (text.startsWith("."))
		{
@@ -79,5 +82,43 @@
			}
		}
-		if (!vcd_used)
+		else if (text.startsWith("-"))
+		{
+			StringTokenizer st = new StringTokenizer(text);
+			IDonatorCommandHandler dch;
+			String command = "";
+			if (activeChar.isDonator())
+			{
+				if (st.countTokens() > 1)
+				{
+					command = st.nextToken().substring(1);
+					target = text.substring(command.length() + 2);
+					dch = DonatorCommandHandler.getInstance().getDonatorCommandHandler(command);
+				}
+				else
+				{
+					command = text.substring(1);
+					if (Config.DEBUG)
+						_log.info("Command: " + command);
+					dch = DonatorCommandHandler.getInstance().getDonatorCommandHandler(command);
+				}
+				if (!activeChar.getFloodProtectors().getVoicedCommands().tryPerformAction("voiced command ." + command))
+				{
+					activeChar.sendMessage("Do not spam voiced commands.");
+					return;
+				}
+				if (dch != null)
+				{
+					dch.useDonatorCommand(command, activeChar, target);
+					dcd_used = true;
+				}
+				else
+				{
+					if (Config.DEBUG)
+						_log.warning("No handler registered for bypass '" + command + "'");
+					dcd_used = false;
+				}
+			}
+		}
+		if (!vcd_used || !dcd_used)
		{
			CreatureSay cs = new CreatureSay(activeChar.getObjectId(), type, activeChar.getAppearance().getVisibleName(), text);
Index: /trunk/Interlude_C6_GameServer/java/net/ins/gameserver/handler/AdminCommandHandler.java
===================================================================
--- /trunk/Interlude_C6_GameServer/java/net/ins/gameserver/handler/AdminCommandHandler.java (revision 2)
+++ /trunk/Interlude_C6_GameServer/java/net/ins/gameserver/handler/AdminCommandHandler.java (revision 18)
@@ -33,4 +33,5 @@
import net.ins.gameserver.handler.admincommandhandlers.AdminCursedWeapons;
import net.ins.gameserver.handler.admincommandhandlers.AdminDelete;
+import net.ins.gameserver.handler.admincommandhandlers.AdminDonator;
import net.ins.gameserver.handler.admincommandhandlers.AdminDoorControl;
import net.ins.gameserver.handler.admincommandhandlers.AdminEditChar;
@@ -94,4 +95,5 @@
		_datatable = new FastMap<String, IAdminCommandHandler>();
		registerAdminCommandHandler(new AdminAdmin());
+		registerAdminCommandHandler(new AdminDonator());
		registerAdminCommandHandler(new AdminInvul());
		registerAdminCommandHandler(new AdminDelete());
Index: /trunk/Interlude_C6_GameServer/java/net/ins/gameserver/handler/admincommandhandlers/AdminDonator.java
===================================================================
--- /trunk/Interlude_C6_GameServer/java/net/ins/gameserver/handler/admincommandhandlers/AdminDonator.java (revision 18)
+++ /trunk/Interlude_C6_GameServer/java/net/ins/gameserver/handler/admincommandhandlers/AdminDonator.java (revision 18)
@@ -0,0 +1,152 @@
+/*
+ * 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 2, 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, write to the Free Software
+ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
+ * 02111-1307, USA.
+ *
+ * http://www.gnu.org/copyleft/gpl.html
+ */
+package net.ins.gameserver.handler.admincommandhandlers;
+
+import java.sql.Connection;
+import java.sql.PreparedStatement;
+import java.sql.ResultSet;
+import java.util.logging.Level;
+import java.util.logging.Logger;
+
+import net.ins.L2DatabaseFactory;
+import net.ins.gameserver.Announcements;
+import net.ins.gameserver.datatables.GmListTable;
+import net.ins.gameserver.handler.IAdminCommandHandler;
+import net.ins.gameserver.model.L2Object;
+import net.ins.gameserver.model.actor.instance.L2PcInstance;
+import net.ins.gameserver.network.SystemMessageId;
+import net.ins.gameserver.network.serverpackets.SystemMessage;
+
+/**
+ *
+ * Author Rayan
+ *
+ */
+public class AdminDonator implements IAdminCommandHandler
+{
+	private static String[] _adminCommands =
+	{
+		"admin_setdonator",};
+	private final static Logger _log = Logger.getLogger(AdminDonator.class.getName());
+
+	public boolean useAdminCommand(String command, L2PcInstance activeChar)
+	{
+		if (command.startsWith("admin_setdonator"))
+		{
+			L2Object target = activeChar.getTarget();
+			L2PcInstance player = null;
+			SystemMessage sm = new SystemMessage(SystemMessageId.S1_S2);
+			if (target instanceof L2PcInstance)
+				player = (L2PcInstance)target;
+			else
+				player = activeChar;
+			
+			if (player.isDonator())
+			{
+				player.setDonator(false);
+				sm.addString("You are no longer a server donator.");
+				GmListTable.broadcastMessageToGMs("GM "+activeChar.getName()+" removed donator stat of player"+ target.getName());
+				Connection connection = null;
+				try
+				{
+					connection = L2DatabaseFactory.getInstance().getConnection();
+
+					PreparedStatement statement = connection.prepareStatement("SELECT obj_id FROM characters where char_name=?");
+					statement.setString(1,target.getName());
+					ResultSet rset = statement.executeQuery();
+					int objId = 0;
+					if (rset.next())
+						objId = rset.getInt(1);
+					rset.close();
+					statement.close();
+
+					if (objId == 0) 
+					{
+						connection.close(); 
+						return false;
+					}
+
+					statement = connection.prepareStatement("UPDATE characters SET donator=0 WHERE obj_id=?");
+					statement.setInt(1, objId);
+					statement.execute();
+					statement.close();
+					connection.close();
+				}
+				catch (Exception e)
+				{
+					_log.log(Level.WARNING,"could not set donator stats of char:", e);
+				}
+				finally
+				{
+					L2DatabaseFactory.close(connection);
+				}
+			}
+			else
+			{
+				player.setDonator(true);
+				sm.addString("You are now a server donator, congratulations!");
+				GmListTable.broadcastMessageToGMs("GM "+activeChar.getName()+" has given donator stat for player "+target.getName()+".");
+				Connection connection = null;
+				try
+				{
+					connection = L2DatabaseFactory.getInstance().getConnection();
+
+					PreparedStatement statement = connection.prepareStatement("SELECT obj_id FROM characters where char_name=?");
+					statement.setString(1,target.getName());
+					ResultSet rset = statement.executeQuery();
+					int objId = 0;
+					if (rset.next())
+						objId = rset.getInt(1);
+					rset.close();
+					statement.close();
+
+					if (objId == 0) 
+					{
+						connection.close(); 
+						return false;
+					}
+
+					statement = connection.prepareStatement("UPDATE characters SET donator=1 WHERE obj_id=?");
+					statement.setInt(1, objId);
+					statement.execute();
+					statement.close();
+					connection.close();
+				}
+				catch (Exception e)
+				{
+					_log.log(Level.WARNING,"could not set donator stats of char:", e);
+				}
+				finally
+				{
+					L2DatabaseFactory.close(connection);
+				}
+
+			}
+			player.sendPacket(sm);
+			player.broadcastUserInfo();
+			if(player.isDonator() == true)
+				Announcements.getInstance().announceToAll(player.getName() + " Has Become a Server Donator!");
+		}
+		return false;
+	}
+   public String[] getAdminCommandList()
+   {
+		return _adminCommands;
+   }
+}

 

this small patch is a donator command handler basically it gives support for a new command handler which starts with - and can be extended with any kind of command example:if you have a .buff command and you want to make it only donator you implement it to the donator command handler than #buff and voila done.

 

credits to me.

 

PS.: edited command letter thanks for report

 

Guest Рrototype
Posted

Great share and very useful !

Thanks for it :)

Posted

hmm looks cool but one question.. isnt # for party ? :/ gonna try it later..

 

ups thanks for that typo i correct it :D

 

PS.: edited to -

Posted

This is usefull for a server with donate ... (80% +) of java servers :D ...anyway is good but i dont like see all time using character table, create new ..example....

donator_manager

- Char Name

- Char Id

- Can PM GM IN REF MOD

 

Like w][e .. donators can pm gm ... :D

 

anyway god job

Posted

This is usefull for a server with donate ... (80% +) of java servers :D ...anyway is good but i dont like see all time using character table, create new ..example....

donator_manager

- Char Name

- Char Id

- Can PM GM IN REF MOD

 

Like w][e .. donators can pm gm ... :D

 

anyway god job

 

true its better i just simple lazy to do it in separated table you know im not that much sharing type

  • 5 months 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

    • Both are in-game bots. I'm looking for an out-of-game bot ((one that doesn’t require the L2 client).     Hmm, never heard about this bot. Will check, thank you
    • 🎉 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?
  • 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