Jump to content

Recommended Posts

Posted

Greetings!

 

 

I coded this small but rly,rly useful code for a pvp server.

 

No exaplanations need,read the configs & code and you'll understand.

 

### Eclipse Workspace Patch 1.0
#P L2_GameServer_It
Index: java/net/sf/l2j/gameserver/model/actor/instance/L2PcInstance.java
===================================================================
--- java/net/sf/l2j/gameserver/model/actor/instance/L2PcInstance.java	(revision 5603)
+++ java/net/sf/l2j/gameserver/model/actor/instance/L2PcInstance.java	(working copy)
@@ -204,6 +204,23 @@
  */
public final class L2PcInstance extends L2PlayableInstance
{
+	
+	//noob system
+   
+    private boolean _noob;
+    private int noobdeaths = 0;
+                   
+    public boolean isNoob()
+    {
+    return _noob;
+    }
+    public void setNoob(boolean isNoob)
+    {
+                   _noob = isNoob;
+    }
+    
+	
+	
	private static final String RESTORE_SKILLS_FOR_CHAR = "SELECT skill_id,skill_level FROM character_skills WHERE char_obj_id=? AND class_index=?";
	private static final String ADD_NEW_SKILL = "INSERT INTO character_skills (char_obj_id,skill_id,skill_level,skill_name,class_index) VALUES (?,?,?,?,?)";
	private static final String UPDATE_CHARACTER_SKILL_LEVEL = "UPDATE character_skills SET skill_level=? WHERE skill_id=? AND char_obj_id=? AND class_index=?";
@@ -5150,7 +5167,15 @@
		{
			return false;
		}
+		noobdeaths++;

+		 if (noobdeaths == Config.HOW_MANY_DEATHS_FOR_NOOB)
+			                {
+			                sendMessage("You gain Noob status,you can press .noob for more informations");
+			                setNoob(true);
+			                noobdeaths = 0;
+			                 }
+		
		if (killer != null)
		{
			L2PcInstance pk = null;
Index: java/net/sf/l2j/gameserver/handler/voicedcommandhandlers/Noob.java
===================================================================
--- java/net/sf/l2j/gameserver/handler/voicedcommandhandlers/Noob.java	(revision 0)
+++ java/net/sf/l2j/gameserver/handler/voicedcommandhandlers/Noob.java	(revision 0)
@@ -0,0 +1,60 @@
+/*
+ * 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.voicedcommandhandlers;
+
+import net.sf.l2j.Config;
+import net.sf.l2j.gameserver.handler.IVoicedCommandHandler;
+import net.sf.l2j.gameserver.model.actor.instance.L2PcInstance;
+import net.sf.l2j.util.Rnd;
+
+/**
+ * @author fanky
+ *
+ */
+public class Noob implements IVoicedCommandHandler
+{
+
+
+	private static final String[] VOICED_COMMANDS = { "noob" };
+	
+	@Override
+	public String[] getVoicedCommandList()
+	{
+		return VOICED_COMMANDS;
+	}
+
+	@Override
+	public boolean useVoicedCommand(String command, L2PcInstance activeChar, String target)
+	{	
+		if(command.equalsIgnoreCase("noob"))
+		{
+			if (activeChar.isNoob())
+			{
+
+				int[][] items = { {Config.ITEM_ID_1, Config.ITEM_A-beep-T_1}, {Config.ITEM_ID_2, Config.ITEM_A-beep-T_2}, { Config.ITEM_ID_3, Config.ITEM_A-beep-T_3}, { Config.ITEM_ID_4, Config.ITEM_A-beep-T_4}, { Config.ITEM_ID_5, Config.ITEM_A-beep-T_5} };
+				int[] ar = items[Rnd.get(5)];
+				activeChar.addItem(command,  ar[0], ar[1], activeChar, true);
+				activeChar.sendMessage("You've recieved a random gift from server in order to help you");
+				activeChar.setNoob(false);
+			}
+			else
+			{
+				activeChar.sendMessage("You can't use this command because you are not noob!");
+				return false;
+			}
+		}
+		
+		return false; 
+	}
+	
+}
Index: java/net/sf/l2j/Config.java
===================================================================
--- java/net/sf/l2j/Config.java	(revision 5603)
+++ java/net/sf/l2j/Config.java	(working copy)
@@ -882,6 +882,19 @@
     public static boolean L2JMOD_WEDDING_SAMESEX;
     public static boolean L2JMOD_WEDDING_FORMALWEAR;
     public static int L2JMOD_WEDDING_DIVORCE_COSTS;
+    
+    // noob system
+   public static int HOW_MANY_DEATHS_FOR_NOOB;
+   public static int ITEM_ID_1;
+   public static int ITEM_ID_2;
+   public static int ITEM_ID_3;
+   public static int ITEM_ID_4;
+   public static int ITEM_ID_5;
+   public static int ITEM_A-beep-T_1;
+   public static int ITEM_A-beep-T_2;
+   public static int ITEM_A-beep-T_3;
+   public static int ITEM_A-beep-T_4;
+   public static int ITEM_A-beep-T_5;

     // Packet information
     /** Count the a-beep-t of packets per minute ? */
@@ -1859,7 +1872,20 @@
                 L2JMOD_WEDDING_SAMESEX                  = Boolean.parseBoolean(L2JModSettings.getProperty("WeddingAllowSameSex", "False"));
                 L2JMOD_WEDDING_FORMALWEAR               = Boolean.parseBoolean(L2JModSettings.getProperty("WeddingFormalWear", "True"));
                 L2JMOD_WEDDING_DIVORCE_COSTS            = Integer.parseInt(L2JModSettings.getProperty("WeddingDivorceCosts", "20"));
-
+                
+                //noob system
+                HOW_MANY_DEATHS_FOR_NOOB                = Integer.parseInt(L2JModSettings.getProperty("HowManyDeaths","12"));
+                ITEM_ID_1                               = Integer.parseInt(L2JModSettings.getProperty("RandomItemId1","10"));
+                ITEM_ID_2                               = Integer.parseInt(L2JModSettings.getProperty("RandomItemId2","11"));
+                ITEM_ID_3                               = Integer.parseInt(L2JModSettings.getProperty("RandomItemId3","12"));
+                ITEM_ID_4                               = Integer.parseInt(L2JModSettings.getProperty("RandomItemId4","13"));
+                ITEM_ID_5                               = Integer.parseInt(L2JModSettings.getProperty("RandomItemId5","14"));
+                ITEM_A-beep-T_1                           = Integer.parseInt(L2JModSettings.getProperty("RandomItemA-beep-t1","1"));
+                ITEM_A-beep-T_2                           = Integer.parseInt(L2JModSettings.getProperty("RandomItemA-beep-t2","1"));
+                ITEM_A-beep-T_3                           = Integer.parseInt(L2JModSettings.getProperty("RandomItemA-beep-t3","1"));
+                ITEM_A-beep-T_4                           = Integer.parseInt(L2JModSettings.getProperty("RandomItemA-beep-t4","1"));
+                ITEM_A-beep-T_5                           = Integer.parseInt(L2JModSettings.getProperty("RandomItemA-beep-t5","1"));
+                
                 if (TVT_EVENT_PARTICIPATION_NPC_ID == 0)
                 {
                     TVT_EVENT_ENABLED = false;
Index: java/config/l2jmods.properties
===================================================================
--- java/config/l2jmods.properties	(revision 5603)
+++ java/config/l2jmods.properties	(working copy)
@@ -132,3 +132,27 @@
# ex.: 1;2;3;4;5;6
# no ";" at the start or end
TvTEventDoorsCloseOpenOnStartEnd =
+
+
+
+#---------------------------------------------------------------
+# Noob system by fanky                     -
+#---------------------------------------------------------------
+# In order to be noob a char has to die X times in a row
+# When he 'achieved'(lol) to die X times in a row he 'll be able to press
+# .noob,after that server will give him a gift(random item between five(5) items) and remove his noob status
+# How many deaths in a row in order to be noob?
+# by default 12
+HowManyDeaths = 12
+# IDs of random items which will be given as gift
+RandomItemId1 = 10
+RandomItemId2 = 11
+RandomItemId3 = 12
+RandomItemId4 = 13
+RandomItemId5 = 14
+# A-beep-ts of random items which will be given as gift
+RandomItemA-beep-t1 = 1
+RandomItemA-beep-t2 = 1
+RandomItemA-beep-t3 = 1
+RandomItemA-beep-t4 = 1
+RandomItemA-beep-t5 = 1
\ No newline at end of file

 

 

kkthnxbb

Guest Elfocrash
Posted

coded this small but rly,rly useless code for a pvp server.

useful maybe?

Guest Elfocrash
Posted

+		if (activeChar.isNoob())
+		{
+			if(command.equalsIgnoreCase("noob"))
+			{
+				int[][] items = { {Config.ITEM_ID_1, Config.ITEM_A-beep-T_1}, {Config.ITEM_ID_2, Config.ITEM_A-beep-T_2}, { Config.ITEM_ID_3, Config.ITEM_A-beep-T_3}, { Config.ITEM_ID_4, Config.ITEM_A-beep-T_4}, { Config.ITEM_ID_5, Config.ITEM_A-beep-T_5} };
+				int[] ar = items[Rnd.get(5)];
+				activeChar.addItem(command,  ar[0], ar[1], activeChar, true);
+				activeChar.sendMessage("You've recieved a random gift from server in order to help you");
+				activeChar.setNoob(false);
+			}
+			else
+			{
+				activeChar.sendMessage("You can't use this command because you are not noob!");
+				return false;
+			}
+		}
+		return false;

 

to

 

+		if(command.equalsIgnoreCase("noob"))
+		{
+			if (activeChar.isNoob())
+			{

+				int[][] items = { {Config.ITEM_ID_1, Config.ITEM_A-beep-T_1}, {Config.ITEM_ID_2, Config.ITEM_A-beep-T_2}, { Config.ITEM_ID_3, Config.ITEM_A-beep-T_3}, { Config.ITEM_ID_4, Config.ITEM_A-beep-T_4}, { Config.ITEM_ID_5, Config.ITEM_A-beep-T_5} };
+				int[] ar = items[Rnd.get(5)];
+				activeChar.addItem(command,  ar[0], ar[1], activeChar, true);
+				activeChar.sendMessage("You've recieved a random gift from server in order to help you");
+				activeChar.setNoob(false);
+			}
+			else
+			{
+				activeChar.sendMessage("You can't use this command because you are not noob!");
+				return false;
+			}
+		}
+		return false;

 

you also don't need the this in pcinstance as long as you are already talking about pcinstance without it.

Posted

+       if (this.noobdeaths == Config.HOW_MANY_DEATHS_FOR_NOOB)
+                         {
+                         this.sendMessage("You gain Noob status,you can press .noob for more informations");
+                         this.setNoob(true);
+                         noobdeaths = 0;
+                          }

this. not needed

  
+     if (noobdeaths == Config.HOW_MANY_DEATHS_FOR_NOOB)
+                         {
+                         sendMessage("You gain Noob status,you can press .noob for more informations");
+                         setNoob(true);
+                         noobdeaths = 0;
+                          }
+    

Good share.

edit: dafuk elfocrash corrected all what I was posting so fast -.-...

Posted

+		if (activeChar.isNoob())
+		{
+			if(command.equalsIgnoreCase("noob"))
+			{
+				int[][] items = { {Config.ITEM_ID_1, Config.ITEM_A-beep-T_1}, {Config.ITEM_ID_2, Config.ITEM_A-beep-T_2}, { Config.ITEM_ID_3, Config.ITEM_A-beep-T_3}, { Config.ITEM_ID_4, Config.ITEM_A-beep-T_4}, { Config.ITEM_ID_5, Config.ITEM_A-beep-T_5} };
+				int[] ar = items[Rnd.get(5)];
+				activeChar.addItem(command,  ar[0], ar[1], activeChar, true);
+				activeChar.sendMessage("You've recieved a random gift from server in order to help you");
+				activeChar.setNoob(false);
+			}
+			else
+			{
+				activeChar.sendMessage("You can't use this command because you are not noob!");
+				return false;
+			}
+		}
+		return false;

 

to

 

+		if(command.equalsIgnoreCase("noob"))
+		{
+			if (activeChar.isNoob())
+			{

+				int[][] items = { {Config.ITEM_ID_1, Config.ITEM_A-beep-T_1}, {Config.ITEM_ID_2, Config.ITEM_A-beep-T_2}, { Config.ITEM_ID_3, Config.ITEM_A-beep-T_3}, { Config.ITEM_ID_4, Config.ITEM_A-beep-T_4}, { Config.ITEM_ID_5, Config.ITEM_A-beep-T_5} };
+				int[] ar = items[Rnd.get(5)];
+				activeChar.addItem(command,  ar[0], ar[1], activeChar, true);
+				activeChar.sendMessage("You've recieved a random gift from server in order to help you");
+				activeChar.setNoob(false);
+			}
+		}
+		else
+		{
+			activeChar.sendMessage("You can't use this command because you are not noob!");
+			return false;
+		}
+		return false;

 

you also don't need the this in pcinstance as long as you are already talking about pcinstance without it.

fixed dat typo.

 

k,ty.

Posted

Hm... you had it correct Fanky... the first one is correct, not the second one...

edit: both are incorrect.

 

+		if(command.equalsIgnoreCase("noob"))
		+		{
		+			if (activeChar.isNoob())
		+			{
		+
		+				int[][] items = { {Config.ITEM_ID_1, Config.ITEM_A-beep-T_1}, {Config.ITEM_ID_2, Config.ITEM_A-beep-T_2}, { Config.ITEM_ID_3, Config.ITEM_A-beep-T_3}, { Config.ITEM_ID_4, Config.ITEM_A-beep-T_4}, { Config.ITEM_ID_5, Config.ITEM_A-beep-T_5} };
		+				int[] ar = items[Rnd.get(5)];
		+				activeChar.addItem(command,  ar[0], ar[1], activeChar, true);
		+				activeChar.sendMessage("You've recieved a random gift from server in order to help you");
		+				activeChar.setNoob(false);
		+			}
		+			else
		+			{
		+				activeChar.sendMessage("You can't use this command because you are not noob!");
		+				return false;
		+			}
		+		}
		+		
		+		return false; 

Guest Elfocrash
Posted

Hm... you had it correct Fanky... the first one is correct, not the second one...

edit: both are incorrect.

 

+		if(command.equalsIgnoreCase("noob"))
		+		{
		+			if (activeChar.isNoob())
		+			{
		+
		+				int[][] items = { {Config.ITEM_ID_1, Config.ITEM_A-beep-T_1}, {Config.ITEM_ID_2, Config.ITEM_A-beep-T_2}, { Config.ITEM_ID_3, Config.ITEM_A-beep-T_3}, { Config.ITEM_ID_4, Config.ITEM_A-beep-T_4}, { Config.ITEM_ID_5, Config.ITEM_A-beep-T_5} };
		+				int[] ar = items[Rnd.get(5)];
		+				activeChar.addItem(command,  ar[0], ar[1], activeChar, true);
		+				activeChar.sendMessage("You've recieved a random gift from server in order to help you");
		+				activeChar.setNoob(false);
		+			}
		+			else
		+			{
		+				activeChar.sendMessage("You can't use this command because you are not noob!");
		+				return false;
		+			}
		+		}
		+		
		+		return false; 

this is what i did too lol :P i edited it before you post

Posted

Well, cool share... But maybe we still need to add more protections, becouse now I can simply call my friend (or just use dual box) and kill my self X times, write ".noob" and take the reward.... So this is usefull, but need some fixes. :)

Good luck and keep sharing :)

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
Reply to this topic...

×   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

    • From Salvation onwards I think you need a patched nwindow.dll that allows such modifications, try to see if you get what you need here: https://drive.google.com/drive/u/1/folders/1LLbQFGf8KlR-O0Iv5umfF-pwZgrDh9bd
    • hello everyone! I am wanting to save the files (Ini. - Data - ) of the EP5 Client: Salvation... But they generate the error "corrupt files"... I tried several versions of L2FileEditor without good results. I need help! Thank you!
    • Opening December 6th at 19:00 (GMT +3)! Open Beta Test from November 30th!   https://l2soe.com/   🌟 Introducing L2 Saga of Eternia: A Revolution in Lineage 2 High Five! 🌟   Dear Lineage 2 enthusiasts, Prepare to witness the future of private servers! L2 Saga of Eternia is not just another High Five project—it’s a game-changing experience designed to compete with the giants of the Lineage 2 private server scene. Built for the community, by the community, we’re here to raise the bar in quality, innovation, and longevity. What Sets Us Apart? 💎 No Wipes, Ever Say goodbye to the fear of losing your progress. Our server is built to last and will never close. Stability and consistency are our promises to you. ⚔️ Weekly New Content Our dedicated development team ensures fresh challenges, events, and updates every week. From custom quests to exclusive features, there will always be something exciting to explore. 💰 No Pay-to-Win Skill and strategy matter most here. Enjoy a balanced gameplay environment where your achievements come from effort, not your wallet. 🌍 A Massive Community With 2000+ players expected, join a vibrant and active community of like-minded adventurers ready to conquer the world of Aden. 🏆 Fair and Competitive Gameplay Our systems are designed to promote healthy competition while avoiding abusive mechanics and exploits. 🔧 Professional Development From advanced bug fixes to carefully curated content, we pride ourselves on smooth performance, no lag, and unparalleled server quality. Key Features Chronicle: High Five with unique interface Rate: Dynamic x10 rates Class Balance: Carefully fine-tuned for a fair experience PvP Focused: PvP Ranking & aura display effect for 3 Top PvPers every week Custom Events: Seasonal and permanent events to keep you engaged Additional Features:   Custom Endgame Content: Introduce unique dungeons, raids, or zones unavailable in other servers. Player-Driven Economy: Implement a strong market system and avoid overinflated drops or rewards. Epic Siege Battles: Announce special large-scale sieges and PvP events. Incentives for Streamers and Clans: Attract influencers and big clans to boost server publicity. Roadmap Transparency: Share a public roadmap of planned updates to build trust and excitemen   Here you can read all the features: https://l2soe.com/features   Video preview: Join the Revolution! This is your chance to be part of something legendary. L2 Saga of Eternia is not just a server; it’s a movement to redefine what Lineage 2 can be. Whether you’re a seasoned veteran or a newcomer to the world of Aden, we invite you to experience Lineage 2 at its finest.   Official Launch Date: December 6th 2024 Website: https://l2soe.com/ Facebook: https://www.facebook.com/l2soe Discord: https://discord.com/invite/l2eternia   Let’s build the ultimate Lineage 2 experience together. See you in-game! 🎮
    • That's like a tutorial on how to run l2 on MacOS Xd but good job for the investigation. 
    • small update: dc robe set sold   wts adena 1kk = 1.5$ 
  • Topics

×
×
  • Create New...