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

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

    • https://jumpshare.com/share/kIdeKALOhgtMKpBKqxpg Test Equip Armors-> FullPlate, Gloves, Legs, Chest , Boots
    • 黑色星期五 — 为您的流量提供高级福利 仅在11月28日,我们的特别促销码可为您提供13%的商店折扣。 促销码: BLACKFRIDAY (13% 折扣) 您可以通过我们的网站或 Telegram 机器人在商店购物! 有效链接: 数字商品商店(网站): 前往 商店 Telegram 机器人: 前往 – 通过 Telegram Messenger 方便访问商店。 其他服务: 虚拟号码服务: 前往 用于购买 Telegram Stars 的机器人: 前往 – 快速且优惠地在 Telegram 中购买 Stars。 SMM 面板: 前往 – 推广您的社交媒体账户。 我们向您呈现当前的 促销和特惠活动 列表,用于购买我们服务的产品和服务: 1. 您可以在首次购买时使用促销码:SOCNET(15% 折扣) 2. 获取 $1 商店余额或 10–20% 折扣 — 只需在我们网站注册后发送您的用户名,格式如下:“SEND ME BONUS, MY USERNAME IS...” — 您需要在我们的论坛帖子中写下这句话! 3. SMM 面板首次试用可获得 $1:只需在我们的网站(支持)提交主题为“Get Trial Bonus”的工单。 4. 我们的 Telegram 频道和 Stars 购买机器人每周都会举办 Telegram Stars 抽奖活动! 新闻: ➡ Telegram 频道: https://t.me/accsforyou_shop ➡ WhatsApp 频道: https://chat.whatsapp.com/K8rBy500nA73z27PxgaJUw?mode=ems_copy_t ➡ Discord 服务器: https://discord.gg/y9AStFFsrh 联系方式与支持: ➡ Telegram: https://t.me/socnet_support ➡ WhatsApp: https://wa.me/79051904467 ➡ Discord: socnet_support ➡ ✉ 邮箱: solomonbog@socnet.store
    • BLACK FRIDAY — PREMIUM BENEFITS FOR YOUR TRAFFIC Only on November 28 our special promo code gives you a 13% discount in the store. PROMO CODE: BLACKFRIDAY (13% Discount) Shop in our store on the website or via the Telegram bot! Active links: Digital goods store (Website): Go Store Telegram bot: Go – convenient access to the store via Telegram messenger. Other services: Virtual numbers service: Go Telegram bot for purchasing Telegram Stars: Go – fast and profitable purchase of stars in Telegram. SMM Panel: Go – promotion of your social media accounts. We want to present you the current list of promotions and special offers for purchasing our service's products and services: 1. You can use a promo code for your first purchase: SOCNET (15% discount) 2. Get $1 to your store balance or a 10–20% discount — just send your username after registering on our website using the following template: "SEND ME BONUS, MY USERNAME IS..." — you need to write this in our forum thread! 3. Get $1 for the first trial start of the SMM Panel: just open a ticket with the subject "Get Trial Bonus" on our website (Support). 4. Weekly Telegram Stars giveaways in our Telegram channel and in our bot for purchasing stars! News: ➡ Telegram channel: https://t.me/accsforyou_shop ➡ WhatsApp channel: https://chat.whatsapp.com/K8rBy500nA73z27PxgaJUw?mode=ems_copy_t ➡ Discord server: https://discord.gg/y9AStFFsrh Contacts and Support: ➡ Telegram: https://t.me/socnet_support ➡ WhatsApp: https://wa.me/79051904467 ➡ Discord: socnet_support ➡ ✉ Email: solomonbog@socnet.store
    • Usually, I work alone on my projects, but sometimes the work is much more than I've expected. Could you provide a price list? It would be good if we knew your price before contacting you. 
    • BLACK FRIDAY — PREMIUM BENEFITS FOR YOUR TRAFFIC Only on November 28 our special promo code gives you a 13% discount in the store. PROMO CODE: BLACKFRIDAY (13% Discount) Shop in our store on the website or via the Telegram bot! Active links: Digital goods store (Website): Go Store Telegram bot: Go – convenient access to the store via Telegram messenger. Other services: Virtual numbers service: Go Telegram bot for purchasing Telegram Stars: Go – fast and profitable purchase of stars in Telegram. SMM Panel: Go – promotion of your social media accounts. We want to present you the current list of promotions and special offers for purchasing our service's products and services: 1. You can use a promo code for your first purchase: SOCNET (15% discount) 2. Get $1 to your store balance or a 10–20% discount — just send your username after registering on our website using the following template: "SEND ME BONUS, MY USERNAME IS..." — you need to write this in our forum thread! 3. Get $1 for the first trial start of the SMM Panel: just open a ticket with the subject "Get Trial Bonus" on our website (Support). 4. Weekly Telegram Stars giveaways in our Telegram channel and in our bot for purchasing stars! News: ➡ Telegram channel: https://t.me/accsforyou_shop ➡ WhatsApp channel: https://chat.whatsapp.com/K8rBy500nA73z27PxgaJUw?mode=ems_copy_t ➡ Discord server: https://discord.gg/y9AStFFsrh Contacts and Support: ➡ Telegram: https://t.me/socnet_support ➡ WhatsApp: https://wa.me/79051904467 ➡ Discord: socnet_support ➡ ✉ Email: solomonbog@socnet.store
  • 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