Jump to content

Help The Noobs[Noob System,another Way]


Fanky

Recommended Posts

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

Link to comment
Share on other sites

Guest Elfocrash

+		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.

Link to comment
Share on other sites

+       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 -.-...

Link to comment
Share on other sites

+		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.

Link to comment
Share on other sites

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; 

Link to comment
Share on other sites

Guest Elfocrash

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

Link to comment
Share on other sites

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 :)

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
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

    • Welcome to my store :  https://topestore.mysellix.io/fr/ 2015-2022 Aged Discord Account 2015 Discord Account : 50.99 $ 2016 Discord Account : 10$ 2017 Discord Account :3.99 $ 2018 Discord Account : 3.50$ 2019 Discord Account : 2.70 $ 2020 Discord Account :1.50$ 2021 Discord Account :0.99$ 2022 Discord Account :0.70$ Warranty :Lifetime Payment Methods : Crypto/ PayPal Contact Me On Discord Or Telegram Discord : @ultrasstore11 Telegram : https://t.me/ultrastore1 Welcome to my store :  https://topestore.mysellix.io/fr/ 2015-2022 Aged Discord Account 2015 Discord Account : 50.99 $ 2016 Discord Account : 10$ 2017 Discord Account :3.99 $ 2018 Discord Account : 3.50$ 2019 Discord Account : 2.70 $ 2020 Discord Account :1.50$ 2021 Discord Account :0.99$ 2022 Discord Account :0.70$ Warranty :Lifetime Payment Methods : Crypto/ PayPal Contact Me On Discord Or Telegram Discord : @ultrasstore11
    • L2 ArenaWar: Low Rate PvP Server with Free Buffs & Autofarm [PVP]⚔️ [Free]🆓 Classic Interlude with  3x XP rates! Free starter pack(no grade) to kickstart your adventure! Autofarm for convenient grinding! Free buffs to keep you fighting fit! (2 job buffs) No experience loss on death! (Except with Karma) Clear Karma system to keep things fair! ⚖️ Active community of 800-1k players! Join our Discord to learn more! >> Discord <<     Server website: https://l2arenawar.com/en/    
    • This is dedication! 2 years working on a problem. Congratulations!
    • You indeed have to save player position over Enterworld to properly clean it up later (if you don't, even trying to delete packet content would eventually keep it up), that's what we do with debug packet (which is a reusable Map of ExServerPrimitive packets) on aCis.   It doesn't solve the FPS stuttering - more you draw/delete lines, more your client becomes laggy. It's like if client wasn't deleting drawn points/lines properly, but instead simply hide them and redrawn content above.   If you got a solution, I would happy to integrate it.   You should check aCis#Player _debug packet integration, it allows very big amount of lines/points to be drawn, it is also reusable.   https://gitlab.com/Tryskell/acis_public/-/blob/master/aCis_gameserver/java/net/sf/l2j/gameserver/model/actor/Player.java?ref_type=heads https://gitlab.com/Tryskell/acis_public/-/blob/master/aCis_gameserver/java/net/sf/l2j/gameserver/network/clientpackets/EnterWorld.java?ref_type=heads  
    • we sell website templates, make websites to order. Great selection at very good prices. My contacts discord : advert1231 telegram : https://t.me/ggwpins  
  • Topics

×
×
  • Create New...