Jump to content
  • 0

[HELP] 1 question about Code


Question

Posted

Index: com/l2jfrozen/gameserver/model/L2Character.java
===================================================================
--- com/l2jfrozen/gameserver/model/L2Character.java	(revision 948)
+++ com/l2jfrozen/gameserver/model/L2Character.java	(working copy)
@@ -340,6 +340,9 @@
	/** The Constant ZONE_DANGERAREA. */
	public static final int ZONE_DANGERAREA = 16384;

+	/** The Constant ZONE_NEWBIE. */
+	public static final int ZONE_NEWBIE = 16385;	
+
	/** The _current zones. */
	private int _currentZones = 0;

Index: com/l2jfrozen/gameserver/model/zone/type/L2NewbieZone.java
===================================================================
--- com/l2jfrozen/gameserver/model/zone/type/L2NewbieZone.java	(revision 0)
+++ com/l2jfrozen/gameserver/model/zone/type/L2NewbieZone.java	(revision 0)
@@ -0,0 +1,83 @@
+/* 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 2, 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, write to the Free Software
+ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
+ * 02111-1307, USA.
+ *
+ * http://www.gnu.org/copyleft/gpl.html
+ */
+package com.l2jfrozen.gameserver.model.zone.type;
+
+import com.l2jfrozen.gameserver.datatables.csv.MapRegionTable;
+import com.l2jfrozen.gameserver.model.L2Character;
+import com.l2jfrozen.gameserver.model.actor.instance.L2ItemInstance;
+import com.l2jfrozen.gameserver.model.actor.instance.L2PcInstance;
+import com.l2jfrozen.gameserver.model.zone.L2ZoneType;
+
+/**
+ * 
+ * @author Leki
+ */
+public class L2NewbieZone extends L2ZoneType
+{
+	public L2NewbieZone(int id)
+	{
+		super(id);
+	}
+
+	@Override
+	protected void onEnter(L2Character character)
+	{
+		if(character instanceof L2PcInstance)
+		{
+			L2PcInstance player = (L2PcInstance) character;
+			for (L2ItemInstance i : player.getInventory().getItems())
+			{
+				if (!player.isGM())
+				{	
+					if (i.isEquipable())
+					{	
+						if (i.getEnchantLevel() > 3)
+						{  
+							player.sendMessage("You can enter to this zone if your items aren't enchant more than 3");
+							player.teleToLocation(MapRegionTable.TeleportWhereType.Town);
+							return;
+						}
+					}
+				}
+			}	
+			if(!player.isGM() && player.isFlying())
+			{
+				player.teleToLocation(MapRegionTable.TeleportWhereType.Town);
+				return;
+			}
+			character.setInsideZone(L2Character.ZONE_NEWBIE, true);					
+		}
+	}
+
+	@Override
+	protected void onExit(L2Character character)
+	{
+		if(character instanceof L2PcInstance)
+		{
+			character.setInsideZone(L2Character.ZONE_NEWBIE, false);
+		}
+	}
+
+	@Override
+	public void onDieInside(L2Character character)
+	{}
+
+	@Override
+	public void onReviveInside(L2Character character)
+	{}
+}
\ No newline at end of file
Index: com/l2jfrozen/gameserver/network/clientpackets/RequestEnchantItem.java
===================================================================
--- com/l2jfrozen/gameserver/network/clientpackets/RequestEnchantItem.java	(revision 948)
+++ com/l2jfrozen/gameserver/network/clientpackets/RequestEnchantItem.java	(working copy)
@@ -21,6 +21,7 @@

import com.l2jfrozen.Config;
import com.l2jfrozen.gameserver.model.Inventory;
+import com.l2jfrozen.gameserver.model.L2Character;
import com.l2jfrozen.gameserver.model.L2World;
import com.l2jfrozen.gameserver.model.actor.instance.L2ItemInstance;
import com.l2jfrozen.gameserver.model.actor.instance.L2PcInstance;
@@ -135,7 +136,13 @@
			activeChar.setActiveEnchantItem(null);
			return;
		}
+		if(activeChar.isInsideZone(L2Character.ZONE_NEWBIE))
+		{
+			activeChar.sendMessage("You can't enchant in newbie zone!");
+			return;
+		}	

+		
		/*
		if(!FloodProtector.getInstance().tryPerformAction(activeChar.getObjectId(), FloodProtector.PROTECTED_ENCHANT))
		{

 

I Wanna change this code from echant check to Grade check  can some1 help me with that?

Recommended Posts

  • 0
Posted
i join without items and kick me also kick me with ALL grades no grade /D/C/B/A/S i will try to test this one  lets see 

You join without items? put first code and try to go inside the zone with only d grade items! all other items should not be in you INVENTORY!

  • 0
Posted

adding of grade check is not so easy(for me) but ofcourse it is possible, if you know java enough, waste some time and you'll create. Otherwise, no one will write a whole code for you(for free)

 

I would do anything for free to anyone... I don't need money, just her/his soul.

  • 0
Posted

I would do anything for free to anyone... I don't need money, just her/his soul.

 

He Fix it For Free Dont Worry xd    Thanks Lekino  LOCK IT please !!!

Guest
This topic is now closed to further replies.


×
×
  • Create New...