Jump to content
  • 0

//sethero


stayros

Question

14 answers to this question

Recommended Posts

  • 0

//sethero.dont.work.at.none?/or.just.at.1.player?

/or.just.at.1.player~do.//repair.at.characters

pffff, l2j intetlude doesnt have these commands sethero and setnoble. You must install them

Esi prepei na tous peraseis.mila elinika

Link to comment
Share on other sites

  • 0

nai kai rwtaw...mporei kapoios an tou einai eukolo na ftiaksei auto to command kai na m to dosei h akoma afou dn uparxei na to kanei share tha htan xrishmo.....!

Link to comment
Share on other sites

  • 0

Ορίστε ο κώδικας που θέλεις,

 

Index: /trunk/L2J_Gameserver/java/net/sf/l2j/gameserver/handler/admincommandhandlers/AdminAdmin.java
===================================================================
--- /trunk/L2J_Gameserver/java/net/sf/l2j/gameserver/handler/admincommandhandlers/AdminAdmin.java	(revision 40)
+++ /trunk/L2J_Gameserver/java/net/sf/l2j/gameserver/handler/admincommandhandlers/AdminAdmin.java	(revision 45)
@@ -55,5 +55,5 @@
	private static final String[] ADMIN_COMMANDS = {"admin_admin", "admin_admin1", "admin_admin2", "admin_admin3", "admin_admin4", "admin_admin5",
		"admin_gmliston", "admin_gmlistoff", "admin_silence", "admin_diet", "admin_tradeoff", "admin_reload", "admin_set", "admin_set_menu", "admin_set_mod",
-		"admin_saveolymp", "admin_sethero", "admin_manualhero"};
+		"admin_saveolymp", "admin_manualhero"};

	private static final int REQUIRED_LEVEL = Config.GM_MENU;
@@ -102,18 +102,4 @@
			catch(Exception e){e.printStackTrace();}
			activeChar.sendMessage("olympiad stuff saved!!");
-		}
-		else if(command.startsWith("admin_sethero")){
-				L2PcInstance target = null;
-	            
-				if (activeChar.getTarget() != null && activeChar.getTarget() instanceof L2PcInstance)
-				{
-					target = (L2PcInstance)activeChar.getTarget();
-					target.setHero(target.isHero()? false : true);
-				}
-				else
-				{
-					target = activeChar;
-					target.setHero(target.isHero()? false : true);
-				}
		}
		else if(command.startsWith("admin_manualhero"))
Index: /trunk/L2J_Gameserver/java/net/sf/l2j/gameserver/handler/admincommandhandlers/AdminHero.java
===================================================================
--- /trunk/L2J_Gameserver/java/net/sf/l2j/gameserver/handler/admincommandhandlers/AdminHero.java	(revision 45)
+++ /trunk/L2J_Gameserver/java/net/sf/l2j/gameserver/handler/admincommandhandlers/AdminHero.java	(revision 45)
@@ -0,0 +1,132 @@
+/*
+ * 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.gameserver.handler.admincommandhandlers;
+
+import java.sql.Connection;
+import java.sql.PreparedStatement;
+import java.sql.ResultSet;
+
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+
+import net.sf.l2j.Config;
+import net.sf.l2j.L2DatabaseFactory;
+import net.sf.l2j.gameserver.GmListTable;
+import net.sf.l2j.gameserver.handler.IAdminCommandHandler;
+import net.sf.l2j.gameserver.model.L2Object;
+import net.sf.l2j.gameserver.model.actor.instance.L2PcInstance;
+import net.sf.l2j.gameserver.network.SystemMessageId;
+import net.sf.l2j.gameserver.serverpackets.SystemMessage;
+
+public class AdminHero implements IAdminCommandHandler{
+	private static String[] _adminCommands = {"admin_sethero"};
+	private final static Log _log = LogFactory.getLog(AdminHero.class.getName());
+	private static final int REQUIRED_LEVEL = Config.GM_MENU;
+
+	public boolean useAdminCommand(String command, L2PcInstance activeChar){
+		if (!Config.ALT_PRIVILEGES_ADMIN){
+			if (!(checkLevel(activeChar.getAccessLevel()) && activeChar.isGM())){
+				return false;
+			}
+		}
+		if (command.startsWith("admin_sethero")){
+			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.isHero()){
+				player.setHero(false);
+				sm.addString("You are no longer a server hero.");
+				GmListTable.broadcastMessageToGMs("GM "+activeChar.getName()+" removed hero 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 hero=0 WHERE obj_id=?");
+					statement.setInt(1, objId);
+					statement.execute();
+					statement.close();
+					connection.close();
+				}
+				catch (Exception e){
+					_log.warn("could not set Hero stats of char:", e);
+				}
+				finally{
+					try { connection.close(); } catch (Exception e) {}
+				}
+			}else{
+				player.setHero(true);
+				sm.addString("You are now a server Hero, Congratulations!");
+				GmListTable.broadcastMessageToGMs("GM "+activeChar.getName()+" has given Hero status to "+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 hero=1 WHERE obj_id=?");
+					statement.setInt(1, objId);
+					statement.execute();
+					statement.close();
+					connection.close();
+				}
+				catch (Exception e){
+					_log.warn("could not set Hero stats of char:", e);
+				}
+				finally{
+					try { connection.close(); } catch (Exception e) {}
+				}
+
+			}
+			player.sendPacket(sm);
+			player.broadcastUserInfo();
+			if(player.isHero() == true){}
+		}
+		return false;
+	}
+   public String[] getAdminCommandList() {
+		return _adminCommands;
+	}
+	private boolean checkLevel(int level){
+		return (level >= REQUIRED_LEVEL);
+	}
+}
Index: /trunk/L2J_Gameserver/java/net/sf/l2j/gameserver/GameServer.java
===================================================================
--- /trunk/L2J_Gameserver/java/net/sf/l2j/gameserver/GameServer.java	(revision 30)
+++ /trunk/L2J_Gameserver/java/net/sf/l2j/gameserver/GameServer.java	(revision 45)
@@ -92,4 +92,5 @@
import net.sf.l2j.gameserver.handler.admincommandhandlers.AdminHeal;
import net.sf.l2j.gameserver.handler.admincommandhandlers.AdminHelpPage;
+import net.sf.l2j.gameserver.handler.admincommandhandlers.AdminHero;
import net.sf.l2j.gameserver.handler.admincommandhandlers.AdminInvul;
import net.sf.l2j.gameserver.handler.admincommandhandlers.AdminKick;
@@ -529,4 +530,5 @@
         _adminCommandHandler.registerAdminCommandHandler(new AdminHeal());
		_adminCommandHandler.registerAdminCommandHandler(new AdminHelpPage());
+		_adminCommandHandler.registerAdminCommandHandler(new AdminHero());
		_adminCommandHandler.registerAdminCommandHandler(new AdminShutdown());
		_adminCommandHandler.registerAdminCommandHandler(new AdminSpawn());

 

einai duskolo twra kapouios na katsei na s kanei code....

Θεληση να υπαρχει και ολα τα αλλα βρισκονται... :P

Link to comment
Share on other sites

  • 0

mia erotisi file na sou po afta ta - edw na  ta sbiso ( - ) mono i na sbiso oloklira ta line ( - else if(command.startsWith("admin_sethero")){ ) asap mia apantisi

 

catch(Exception e){e.printStackTrace();}

activeChar.sendMessage("olympiad stuff saved!!");

- }

- else if(command.startsWith("admin_sethero")){

- L2PcInstance target = null;

-            

- if (activeChar.getTarget() != null && activeChar.getTarget() instanceof L2PcInstance)

- {

- target = (L2PcInstance)activeChar.getTarget();

- target.setHero(target.isHero()? false : true);

- }

- else

- {

- target = activeChar;

- target.setHero(target.isHero()? false : true);

- }

}

else if(command.startsWith("admin_manualhero"))

Link to comment
Share on other sites

  • 0

mia erotisi file na sou po afta ta - edw na  ta sbiso ( - ) mono i na sbiso oloklira ta line ( - else if(command.startsWith("admin_sethero")){ ) asap mia apantisi

 

catch(Exception e){e.printStackTrace();}

activeChar.sendMessage("olympiad stuff saved!!");

- }

- else if(command.startsWith("admin_sethero")){

- L2PcInstance target = null;

-            

- if (activeChar.getTarget() != null && activeChar.getTarget() instanceof L2PcInstance)

- {

- target = (L2PcInstance)activeChar.getTarget();

- target.setHero(target.isHero()? false : true);

- }

- else

- {

- target = activeChar;

- target.setHero(target.isHero()? false : true);

- }

}

else if(command.startsWith("admin_manualhero"))

olo to line svhneis.

Ορίστε ο κώδικας που θέλεις,

 

Index: /trunk/L2J_Gameserver/java/net/sf/l2j/gameserver/handler/admincommandhandlers/AdminAdmin.java
===================================================================
--- /trunk/L2J_Gameserver/java/net/sf/l2j/gameserver/handler/admincommandhandlers/AdminAdmin.java	(revision 40)
+++ /trunk/L2J_Gameserver/java/net/sf/l2j/gameserver/handler/admincommandhandlers/AdminAdmin.java	(revision 45)
@@ -55,5 +55,5 @@
	private static final String[] ADMIN_COMMANDS = {"admin_admin", "admin_admin1", "admin_admin2", "admin_admin3", "admin_admin4", "admin_admin5",
		"admin_gmliston", "admin_gmlistoff", "admin_silence", "admin_diet", "admin_tradeoff", "admin_reload", "admin_set", "admin_set_menu", "admin_set_mod",
-		"admin_saveolymp", "admin_sethero", "admin_manualhero"};
+		"admin_saveolymp", "admin_manualhero"};

	private static final int REQUIRED_LEVEL = Config.GM_MENU;
@@ -102,18 +102,4 @@
			catch(Exception e){e.printStackTrace();}
			activeChar.sendMessage("olympiad stuff saved!!");
-		}
-		else if(command.startsWith("admin_sethero")){
-				L2PcInstance target = null;
-	            
-				if (activeChar.getTarget() != null && activeChar.getTarget() instanceof L2PcInstance)
-				{
-					target = (L2PcInstance)activeChar.getTarget();
-					target.setHero(target.isHero()? false : true);
-				}
-				else
-				{
-					target = activeChar;
-					target.setHero(target.isHero()? false : true);
-				}
		}
		else if(command.startsWith("admin_manualhero"))
Index: /trunk/L2J_Gameserver/java/net/sf/l2j/gameserver/handler/admincommandhandlers/AdminHero.java
===================================================================
--- /trunk/L2J_Gameserver/java/net/sf/l2j/gameserver/handler/admincommandhandlers/AdminHero.java	(revision 45)
+++ /trunk/L2J_Gameserver/java/net/sf/l2j/gameserver/handler/admincommandhandlers/AdminHero.java	(revision 45)
@@ -0,0 +1,132 @@
+/*
+ * 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.gameserver.handler.admincommandhandlers;
+
+import java.sql.Connection;
+import java.sql.PreparedStatement;
+import java.sql.ResultSet;
+
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+
+import net.sf.l2j.Config;
+import net.sf.l2j.L2DatabaseFactory;
+import net.sf.l2j.gameserver.GmListTable;
+import net.sf.l2j.gameserver.handler.IAdminCommandHandler;
+import net.sf.l2j.gameserver.model.L2Object;
+import net.sf.l2j.gameserver.model.actor.instance.L2PcInstance;
+import net.sf.l2j.gameserver.network.SystemMessageId;
+import net.sf.l2j.gameserver.serverpackets.SystemMessage;
+
+public class AdminHero implements IAdminCommandHandler{
+	private static String[] _adminCommands = {"admin_sethero"};
+	private final static Log _log = LogFactory.getLog(AdminHero.class.getName());
+	private static final int REQUIRED_LEVEL = Config.GM_MENU;
+
+	public boolean useAdminCommand(String command, L2PcInstance activeChar){
+		if (!Config.ALT_PRIVILEGES_ADMIN){
+			if (!(checkLevel(activeChar.getAccessLevel()) && activeChar.isGM())){
+				return false;
+			}
+		}
+		if (command.startsWith("admin_sethero")){
+			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.isHero()){
+				player.setHero(false);
+				sm.addString("You are no longer a server hero.");
+				GmListTable.broadcastMessageToGMs("GM "+activeChar.getName()+" removed hero 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 hero=0 WHERE obj_id=?");
+					statement.setInt(1, objId);
+					statement.execute();
+					statement.close();
+					connection.close();
+				}
+				catch (Exception e){
+					_log.warn("could not set Hero stats of char:", e);
+				}
+				finally{
+					try { connection.close(); } catch (Exception e) {}
+				}
+			}else{
+				player.setHero(true);
+				sm.addString("You are now a server Hero, Congratulations!");
+				GmListTable.broadcastMessageToGMs("GM "+activeChar.getName()+" has given Hero status to "+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 hero=1 WHERE obj_id=?");
+					statement.setInt(1, objId);
+					statement.execute();
+					statement.close();
+					connection.close();
+				}
+				catch (Exception e){
+					_log.warn("could not set Hero stats of char:", e);
+				}
+				finally{
+					try { connection.close(); } catch (Exception e) {}
+				}
+
+			}
+			player.sendPacket(sm);
+			player.broadcastUserInfo();
+			if(player.isHero() == true){}
+		}
+		return false;
+	}
+   public String[] getAdminCommandList() {
+		return _adminCommands;
+	}
+	private boolean checkLevel(int level){
+		return (level >= REQUIRED_LEVEL);
+	}
+}
Index: /trunk/L2J_Gameserver/java/net/sf/l2j/gameserver/GameServer.java
===================================================================
--- /trunk/L2J_Gameserver/java/net/sf/l2j/gameserver/GameServer.java	(revision 30)
+++ /trunk/L2J_Gameserver/java/net/sf/l2j/gameserver/GameServer.java	(revision 45)
@@ -92,4 +92,5 @@
import net.sf.l2j.gameserver.handler.admincommandhandlers.AdminHeal;
import net.sf.l2j.gameserver.handler.admincommandhandlers.AdminHelpPage;
+import net.sf.l2j.gameserver.handler.admincommandhandlers.AdminHero;
import net.sf.l2j.gameserver.handler.admincommandhandlers.AdminInvul;
import net.sf.l2j.gameserver.handler.admincommandhandlers.AdminKick;
@@ -529,4 +530,5 @@
         _adminCommandHandler.registerAdminCommandHandler(new AdminHeal());
		_adminCommandHandler.registerAdminCommandHandler(new AdminHelpPage());
+		_adminCommandHandler.registerAdminCommandHandler(new AdminHero());
		_adminCommandHandler.registerAdminCommandHandler(new AdminShutdown());
		_adminCommandHandler.registerAdminCommandHandler(new AdminSpawn());

Θεληση να υπαρχει και ολα τα αλλα βρισκονται... :P

afou thn exeis wraios ;P

Link to comment
Share on other sites

  • 0

na sou po file ton perasa tora to koment tha  //set_hero kai etc gia na ginome hero

οχι απλα γραφεις //sethero ingame. (φυσικα πρεπει να εχεις ενα target).

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
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

    • Will it work for GOD H5 Client Protocol 140??
    • 6.2K followers growth from 500K DMs campaign for Onlyfan niche 🚀 ⭐️ Instant Instagram followers growth & gain subscribers ⭐️ GO VIRAL easier with reels on IG ⭐️ Scraping & Sending in less than 24 hours For consulting contact us on telegram @igmassdm ✅
    • ANOTHER LOGO DESIGN FOR ANOTHER EPIC PROJECT 😎 Thank You for using my support 🙏    
    • In this guide we will cover how to understand and implement the packages belonging to the Lineage 2 UI. More specifically the Essence version UI. Required UTPT (Unreal Tournament Package Tool) : https://github.com/l2jsourcecode/ut-package-tool File : InterfaceClassic.U   The packages are embedded into the interface, specifically located in the InterfaceClassic.u file. Some key classes include: UIPacket.uc (defines package structure) UIProtocol.uc (defines package opcode)   The packages are split into two main types: Client to Server (prefix: C) Server to Client (prefix: S) For example, in the UIProtocol class:   const C_EX_COSTUME_LOCK = 573; // packet from client to server const S_EX_COSTUME_LOCK = 785; // packet from server to client   We’ll use this package as a case study to delve deeper. Understanding Client to Server Packets Let's examine a packet from the client with an opcode of 573. On the server side, opcodes are converted into hexadecimal values using a formula: opcode - C_MAX   where C_MAX is an opcode defined in UIProtocol. Recently, C_MAX has been set to 209. For instance: 573 - 209 = 364 364 -> hex = 16C This hexadecimal value (16C) corresponds to the opcode for the Java class. Understanding Server to Client Packets For server packets, we also use hexadecimal conversion but with a different opcode: S_MAX = 255 S_MAX is applied to packages with an opcode above 255. For values below this, simply convert the number to hex. For example: const S_EX_COSTUME_LOCK = 785; 785 - 255 = 530 530 -> hex = 212 = 0xFE:0x212 Here, 0xFE represents S_MAX. Packet Structure Finally, let’s look at the packet structure. Open UIPacket.uc and locate the C_EX_COSTUME_LOCK to examine its structure in detail.   struct _C_EX_COSTUME_LOCK { var int nCostumeId; var int nLockState; };   We observe two integer variables, representing the structure of the package transmitted to the server. By continuing our search within this file, we find the following code:   static function bool Encode_C_EX_COSTUME_LOCK(out array<byte> stream, _C_EX_COSTUME_LOCK packet) { if(!EncodeInt(stream, packet.nCostumeId)) { return false; } if(!EncodeChar(stream, packet.nLockState)) { return false; } return true; }   This function encodes the packet structure for transmission. As discussed earlier, the data types within the packet are crucial. Specifically:   EncodeInt corresponds to an integer. EncodeChar is treated as a short in Java, typically read using readC, while readD is used for EncodeInt. Having examined the client-to-server packet structure, let's now explore the structure expected by the client from the server. The process is similar. We locate _S_EX_COSTUME_LOCK within UIPacket:     struct _S_EX_COSTUME_LOCK { var byte bResult; var int nCostumeId; var int nLockState; };   Data Decryption The corresponding decryption function is:   static function bool Decode_S_EX_COSTUME_LOCK(out _S_EX_COSTUME_LOCK packet) { if(!DecodeBool(packet.bResult)) { return false; } if(!DecodeInt(packet.nCostumeId)) { return false; } if(!DecodeChar(packet.nLockState)) { return false; } return true; }   Here, the variables are decoded as follows:   bResult is decoded as a Bool. nCostumeId is decoded as an Int. nLockState is decoded as a Char.   This consistent approach to encoding and decoding ensures reliable data transmission between the client and server. Example usage :  https://imgur.com/a/zVZHVzq Credits : L2j West Coast Custom ( https://discord.gg/n2c8meMN )
  • Topics

×
×
  • Create New...