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

    • Server is Online – 1,000+ Active Players! We’re excited to announce the addition of a Europe Proxy to improve connectivity for our EU players! Clans can now benefit from VIP Access to help you catch up faster. 🎯 If you're a clan leader with at least 9 active members, join our Discord and open a ticket to claim your VIP rewards!  
    • The Telegram team is rolling out a new batch of Stars-only gifts you’ll be able to mint as NFTs. Don’t miss your chance to join the next Telegram trend and earn from it! Buy Telegram Stars cheap and KYC-free 1 Star from $0.0149 (min. 50 Stars, bulk discounts available) Promo code STARS5 — 5 % off Pay any way you like: bank cards · crypto · other popular methods How to purchase: ➡Online Store — Click ➡ Telegram bot — Click Other services: ➡ SMM panel — Click Regular buyers get extra discounts and promo codes. Support: ➡ Telegram: https://t.me/solomon_bog ➡ Telegram channel: https://t.me/accsforyou_shop ➡ Discord: https://discord.gg/y9AStFFsrh ➡ WhatsApp: https://wa.me/79051904467 ➡ Email: solomonbog@socnet.store Use these contacts to discuss wholesale orders, partnerships (current list: https://socnet.bgng.io/partners) or to become a supplier. SocNet — your shop for digital goods and premium subscriptions
    • The Telegram team is rolling out a new batch of Stars-only gifts you’ll be able to mint as NFTs. Don’t miss your chance to join the next Telegram trend and earn from it! Buy Telegram Stars cheap and KYC-free 1 Star from $0.0149 (min. 50 Stars, bulk discounts available) Promo code STARS5 — 5 % off Pay any way you like: bank cards · crypto · other popular methods How to purchase: ➡Online Store — Click ➡ Telegram bot — Click Other services: ➡ SMM panel — Click Regular buyers get extra discounts and promo codes. Support: ➡ Telegram: https://t.me/solomon_bog ➡ Telegram channel: https://t.me/accsforyou_shop ➡ Discord: https://discord.gg/y9AStFFsrh ➡ WhatsApp: https://wa.me/79051904467 ➡ Email: solomonbog@socnet.store Use these contacts to discuss wholesale orders, partnerships (current list: https://socnet.bgng.io/partners) or to become a supplier. SocNet — your shop for digital goods and premium subscriptions
    • 📜 • Mass PVP – Craft – Progressive Server (ITEMS, ARMOR, WEAPONS, ETC) 🕹️ • Chronicles: Lineage 2 - Interlude (C6) 🛠️ • Retail status 🕒 • Server Time: GMT -3 🏙️ • Main Town: Giran ✨ • Teleportation for all Towns, Gk Global 🛡️ • NPC BUFFER - GMSHOP B-GRADE - DONATION SHOP - AUCTION MANAGER 🐉 • Epic Bosses: Chaotic Zones 🔁 • Protection respawn: 15 seconds ⏰ • Restart Server: 05:00 AM Today 💸 • RTM allowed between players (ask Staff if in doubt) 📊 SERVER RATES: • EXP: x8 • SP: x10 • Adena: x3 • Seal Stone: x3 • Drop: x3 • Spoil: x5 • Raid EXP/SP/Drop: x3 • Premium Rates: x2 🌐 Website: https://www.l2roosters.com 💬 Discord: https://discord.gg/cUyYXrfy 🔥 Join us now and forge your legacy at Roosters Gaming!
    • Hello, lovely people, how are you? I just finished compiling the L2jFrozen project Rev: 1132 (very old). I don't mind it being too old, since the project is for me and my children. (LAN/Offline) it's not meant to be put online. I want to learn and give my children more comfort when playing. And for my part, I also experiment with the game. My problem is that I don't know much about the subject. I was able to make some basic configurations to my liking and that of my children, but it never compiles or anything like that... I would really need help from you, the community... I simply want to remove all subclass restrictions, remove the restriction on "Overlord, Warsmith, and Dark Elf subclasses with White Elves and vice versa." Thank you very much in advance! Greetings, community.
  • 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