Jump to content
  • 0

Question

Posted (edited)

hello guys im trying to install one remote class master on acis and i had one problem maybe u guys can help me

http://prnt.sc/bnij8r

 

 

all the code

### Eclipse Workspace Patch 1.0
#P L2jFanatic
Index: dist/data/html/classmaster/tutorialtemplate.htm
===================================================================
--- dist/data/html/classmaster/tutorialtemplate.htm	(revision 0)
+++ dist/data/html/classmaster/tutorialtemplate.htm	(working copy)
@@ -0,0 +1,13 @@
+<html>
+	<body>
+		<center>%name% Class Master:</center><br>
+		%menu%
+		<br><br>
+		Item(s) required for class change:
+		<table width=270>
+			%req_items%
+		</table>
+		<br><br>
+		<a action="link COXX">Ask me next time.</a>
+	</body>
+</html>
Index: java/net/sf/l2j/gameserver/model/actor/instance/L2ClassMasterInstance.java
===================================================================
--- java/net/sf/l2j/gameserver/model/actor/instance/L2ClassMasterInstance.java	(revision 5)
+++ java/net/sf/l2j/gameserver/model/actor/instance/L2ClassMasterInstance.java	(working copy)
@@ -17,6 +17,7 @@
 import java.util.List;
 
 import net.sf.l2j.Config;
+import net.sf.l2j.gameserver.cache.HtmCache;
 import net.sf.l2j.gameserver.datatables.CharTemplateTable;
 import net.sf.l2j.gameserver.datatables.ItemTable;
 import net.sf.l2j.gameserver.model.actor.template.NpcTemplate;
@@ -25,6 +26,9 @@
 import net.sf.l2j.gameserver.network.SystemMessageId;
 import net.sf.l2j.gameserver.network.serverpackets.ActionFailed;
 import net.sf.l2j.gameserver.network.serverpackets.NpcHtmlMessage;
+import net.sf.l2j.gameserver.network.serverpackets.TutorialCloseHtml;
+import net.sf.l2j.gameserver.network.serverpackets.TutorialShowHtml;
+import net.sf.l2j.gameserver.network.serverpackets.TutorialShowQuestionMark;
 import net.sf.l2j.gameserver.network.serverpackets.UserInfo;
 import net.sf.l2j.util.StringUtil;
 
@@ -114,6 +118,53 @@
 			super.onBypassFeedback(player, command);
 	}
 	
+	public static final void onTutorialLink(L2PcInstance player, String request)
+	{
+		if (!Config.ALTERNATE_CLASS_MASTER || request == null || !request.startsWith("CO"))
+			return;
+		
+		if (!player.getFloodProtectors().getServerBypass().tryPerformAction("changeclass"))
+			return;
+		
+		try
+		{
+			int val = Integer.parseInt(request.substring(2));
+			checkAndChangeClass(player, val);
+		}
+		catch (NumberFormatException e)
+		{
+		}
+		player.sendPacket(TutorialCloseHtml.STATIC_PACKET);
+	}
+	
+	public static final void onTutorialQuestionMark(L2PcInstance player, int number)
+	{
+		if (!Config.ALTERNATE_CLASS_MASTER || number != 1001)
+			return;
+		
+		showTutorialHtml(player);
+	}
+	
+	public static final void showQuestionMark(L2PcInstance player)
+	{
+		if (!Config.ALLOW_CLASS_MASTERS)
+			return;
+		
+		if (!Config.ALTERNATE_CLASS_MASTER)
+			return;
+		
+		final ClassId classId = player.getClassId();
+		if (getMinLevel(classId.level()) > player.getLevel())
+			return;
+		
+		if (!Config.CLASS_MASTER_SETTINGS.isAllowed(classId.level() + 1))
+		{
+			return;
+		}
+		
+		player.sendPacket(new TutorialShowQuestionMark(1001));
+	}
+	
 	private static final void showHtmlMenu(L2PcInstance player, int objectId, int level)
 	{
 		NpcHtmlMessage html = new NpcHtmlMessage(objectId);
@@ -203,6 +254,29 @@
 		player.sendPacket(html);
 	}
 	
+	private static final void showTutorialHtml(L2PcInstance player)
+	{
+		final ClassId currentClassId = player.getClassId();
+		if (getMinLevel(currentClassId.level()) > player.getLevel() && !Config.ALLOW_ENTIRE_TREE)
+			return;
+		
+		String msg = HtmCache.getInstance().getHtm("data/html/classmaster/tutorialtemplate.htm");
+		msg = msg.replaceAll("%name%", CharTemplateTable.getInstance().getClassNameById(currentClassId.getId()));
+		
+		final StringBuilder menu = new StringBuilder(100);
+		for (ClassId cid : ClassId.values())
+		{
+			if (validateClassId(currentClassId, cid))
+			{
+				StringUtil.append(menu, "<a action=\"link CO", String.valueOf(cid.getId()), "\">", CharTemplateTable.getInstance().getClassNameById(cid.getId()), "</a><br>");
+			}
+		}
+		
+		msg = msg.replaceAll("%menu%", menu.toString());
+		msg = msg.replace("%req_items%", getRequiredItems(currentClassId.level() + 1));
+		player.sendPacket(new TutorialShowHtml(msg));
+	}
+	
 	private static final boolean checkAndChangeClass(L2PcInstance player, int val)
 	{
 		final ClassId currentClassId = player.getClassId();
@@ -255,6 +329,11 @@
 			player.setBaseClass(player.getActiveClass());
 		
 		player.broadcastUserInfo();
+		
+		if (Config.CLASS_MASTER_SETTINGS.isAllowed(player.getClassId().level() + 1) && Config.ALTERNATE_CLASS_MASTER && (((player.getClassId().level() == 1) && (player.getLevel() >= 40)) || ((player.getClassId().level() == 2) && (player.getLevel() >= 76))))
+		{
+			showQuestionMark(player);
+		}
 		return true;
 	}
 	
Index: dist/config/npcs.properties
===================================================================
--- dist/config/npcs.properties	(revision 5)
+++ dist/config/npcs.properties	(working copy)
@@ -78,6 +78,13 @@
 # Default = False
 AllowEntireTree = False
 
+# Then character reach levels 20,40,76 he will receive tutorial page
+# with list of the all possible variants, and can select and immediately
+# change to the new occupation, or decide to choose later (on next login).
+# Can be used with or without classic Class Masters.
+# Default = False 
+AlternateClassMaster = False
+
 # Allow free teleportation around the world.
 AltFreeTeleporting = False
 
Index: java/net/sf/l2j/Config.java
===================================================================
--- java/net/sf/l2j/Config.java	(revision 6)
+++ java/net/sf/l2j/Config.java	(working copy)
@@ -306,6 +306,7 @@
 	public static boolean ALLOW_CLASS_MASTERS;
 	public static ClassMasterSettings CLASS_MASTER_SETTINGS;
 	public static boolean ALLOW_ENTIRE_TREE;
+	public static boolean ALTERNATE_CLASS_MASTER;
 	public static boolean ANNOUNCE_MAMMON_SPAWN;
 	public static boolean ALT_MOB_AGRO_IN_PEACEZONE;
 	public static boolean ALT_GAME_FREE_TELEPORT;
@@ -931,6 +932,7 @@
 			ALLOW_ENTIRE_TREE = npcs.getProperty("AllowEntireTree", false);
 			if (ALLOW_CLASS_MASTERS)
 				CLASS_MASTER_SETTINGS = new ClassMasterSettings(npcs.getProperty("ConfigClassMaster"));
+			ALTERNATE_CLASS_MASTER = npcs.getProperty("AlternateClassMaster", false);
 			
 			ALT_GAME_FREE_TELEPORT = npcs.getProperty("AltFreeTeleporting", false);
 			ANNOUNCE_MAMMON_SPAWN = npcs.getProperty("AnnounceMammonSpawn", true);
Index: java/net/sf/l2j/gameserver/network/clientpackets/EnterWorld.java
===================================================================
--- java/net/sf/l2j/gameserver/network/clientpackets/EnterWorld.java	(revision 5)
+++ java/net/sf/l2j/gameserver/network/clientpackets/EnterWorld.java	(working copy)
@@ -32,6 +32,7 @@
 import net.sf.l2j.gameserver.model.L2Clan;
 import net.sf.l2j.gameserver.model.L2Clan.SubPledge;
 import net.sf.l2j.gameserver.model.L2World;
+import net.sf.l2j.gameserver.model.actor.instance.L2ClassMasterInstance;
 import net.sf.l2j.gameserver.model.actor.instance.L2PcInstance;
 import net.sf.l2j.gameserver.model.entity.ClanHall;
 import net.sf.l2j.gameserver.model.entity.Couple;
@@ -256,6 +257,8 @@
 		// Attacker or spectator logging into a siege zone will be ported at town.
 		if (!activeChar.isGM() && (!activeChar.isInSiege() || activeChar.getSiegeState() < 2) && activeChar.isInsideZone(ZoneId.SIEGE))
 			activeChar.teleToLocation(MapRegionTable.TeleportWhereType.Town);
+		
+		L2ClassMasterInstance.showQuestionMark(activeChar);
 	}
 	
 	private static void engage(L2PcInstance cha)
Index: java/net/sf/l2j/gameserver/network/clientpackets/RequestTutorialQuestionMark.java
===================================================================
--- java/net/sf/l2j/gameserver/network/clientpackets/RequestTutorialQuestionMark.java	(revision 5)
+++ java/net/sf/l2j/gameserver/network/clientpackets/RequestTutorialQuestionMark.java	(working copy)
@@ -14,6 +14,7 @@
  */
 package net.sf.l2j.gameserver.network.clientpackets;
 
+import net.sf.l2j.gameserver.model.actor.instance.L2ClassMasterInstance;
 import net.sf.l2j.gameserver.model.actor.instance.L2PcInstance;
 import net.sf.l2j.gameserver.model.quest.QuestState;
 
@@ -34,6 +35,8 @@
 		if (player == null)
 			return;
 		
+		L2ClassMasterInstance.onTutorialQuestionMark(player, _number);
+		
 		QuestState qs = player.getQuestState("Tutorial");
 		if (qs != null)
 			qs.getQuest().notifyEvent("QM" + _number + "", null, player);
Index: java/net/sf/l2j/gameserver/network/clientpackets/RequestTutorialLinkHtml.java
===================================================================
--- java/net/sf/l2j/gameserver/network/clientpackets/RequestTutorialLinkHtml.java	(revision 5)
+++ java/net/sf/l2j/gameserver/network/clientpackets/RequestTutorialLinkHtml.java	(working copy)
@@ -14,6 +14,7 @@
  */
 package net.sf.l2j.gameserver.network.clientpackets;
 
+import net.sf.l2j.gameserver.model.actor.instance.L2ClassMasterInstance;
 import net.sf.l2j.gameserver.model.actor.instance.L2PcInstance;
 import net.sf.l2j.gameserver.model.quest.QuestState;
 
@@ -34,6 +35,8 @@
 		if (player == null)
 			return;
 		
+		L2ClassMasterInstance.onTutorialLink(player, _bypass);
+		
 		QuestState qs = player.getQuestState("Tutorial");
 		if (qs != null)
 			qs.getQuest().notifyEvent(_bypass, null, player);
Index: java/net/sf/l2j/gameserver/model/actor/stat/PcStat.java
===================================================================
--- java/net/sf/l2j/gameserver/model/actor/stat/PcStat.java	(revision 5)
+++ java/net/sf/l2j/gameserver/model/actor/stat/PcStat.java	(working copy)
@@ -18,6 +18,7 @@
 import net.sf.l2j.gameserver.datatables.NpcTable;
 import net.sf.l2j.gameserver.datatables.PetDataTable;
 import net.sf.l2j.gameserver.model.actor.L2Character;
+import net.sf.l2j.gameserver.model.actor.instance.L2ClassMasterInstance;
 import net.sf.l2j.gameserver.model.actor.instance.L2PcInstance;
 import net.sf.l2j.gameserver.model.actor.instance.L2PetInstance;
 import net.sf.l2j.gameserver.model.base.Experience;
@@ -164,6 +165,8 @@
 			getActiveChar().setCurrentCp(getMaxCp());
 			getActiveChar().broadcastPacket(new SocialAction(getActiveChar(), 15));
 			getActiveChar().sendPacket(SystemMessageId.YOU_INCREASED_YOUR_LEVEL);
+
+            L2ClassMasterInstance.showQuestionMark(getActiveChar());
 		}
 		
 		getActiveChar().rewardSkills(); // Give Expertise skill of this level
Edited by haskovo

15 answers to this question

Recommended Posts

  • 0
Posted (edited)

Wrong method use, it's not for player. Check another uses of FloodProtector, for example

if (FloodProtectors.performAction(activeChar.getClient(), Action.RESURRECT))

And your method misses clauses { }. Oh my gosh.. If you copy / paste, at least do it properly.

Edited by SweeTs
  • 0
Posted

Wrong method use, it's not for player. Check another uses of FloodProtector, for example

if (FloodProtectors.performAction(activeChar.getClient(), Action.RESURRECT))

And your method misses clauses { }. Oh my gosh.. If you copy / paste, at least do it properly.

Stop cry all the time >.<

  • 0
Posted (edited)

u are annoying with spaming everywhere without reason just dont enter my topic and u are done with your problem

yes im noob java i copy free codes i try to make to work not everybody perfect to know java as main lang.

 

now please tell me how to make this one to work 

if (!player.getFloodProtectors().getServerBypass().tryPerformAction("changeclass"))
Edited by haskovo
  • 0
Posted (edited)

lol, for fucks sake. I HELPED you many times and so I did now. I gave you READY EXAMPLE. What you want more?  :y u no?:

 

 

Annoying thing is, Eclipse shows you error and explain to "insert a dot (.)" and you create topic / do a post with photo and ask what to do.. That's annoying.

Edited by SweeTs
  • 0
Posted

yep but my brain not working now can u tell me the full code

so i can make it and u do ur job and dont losing ur time with me

i make it like this and error

if (FloodProtectors.performAction(activeChar.getClient(), Action.("changeclass"))
  • 0
Posted (edited)

Bcs, the structure DOESN'T MATCH. Look my example and your, they are different, no? Also, if you are adding new, custom action (changeclass in your case), you have to add it @ Action enum inside FloodProtector. Take a look here, in this code I create new Action enum. http://pastebin.com/GuneGiQA

 

No ready codes. You want to learn after all, no? If you want to learn, just follow tips / examples, change/add one/two letters and you are done.

Edited by SweeTs
  • 0
Posted

http://www.homeandlearn.co.uk/java/java.html if u cant sit some time to understand the basics  then you DONT DESERVE TO DOWNLOAD A SOURCE CODE

its it fking logical? you can even change one rdy value wtf is wrong with you . these guys help you with examples and you dont have a brain to think. you want rdy stuff go fuck yourshelf

you deserve all the above.

  • 0
Posted

http://www.homeandlearn.co.uk/java/java.html if u cant sit some time to understand the basics  then you DONT DESERVE TO DOWNLOAD A SOURCE CODE

its it fking logical? you can even change one rdy value wtf is wrong with you . these guys help you with examples and you dont have a brain to think. you want rdy stuff go fuck yourshelf

you deserve all the above.

yes you are right i really trying but i will learn soon

 

i still need help with this all day waiting for u guys to tell me what to do to fix this one :S

  • 0
Posted (edited)

Bcs, the structure DOESN'T MATCH. Look my example and your, they are different, no? Also, if you are adding new, custom action (changeclass in your case), you have to add it @ Action enum inside FloodProtector. Take a look here, in this code I create new Action enum. http://pastebin.com/GuneGiQA

Edited by SweeTs
  • 0
Posted (edited)

 

Bcs, the structure DOESN'T MATCH. Look my example and your, they are different, no? Also, if you are adding new, custom action (changeclass in your case), you have to add it @ Action enum inside FloodProtector. Take a look here, in this code I create new Action enum. http://pastebin.com/GuneGiQA

 

i made it like u say me and it doest not allows me to press any link to change class the server thinks im hacker.

i just remove it now and its working fine how bad can be without this floodprotect?

Edited by haskovo
Guest
This topic is now closed to further replies.


×
×
  • Create New...