Jump to content
  • 0

Adapt (Chance Class Without go te Cat) for l2joff IT


Question

Posted

this is the code

i need help to adapt this for l2joff interlude

anyone help me?

 

Index: /java/net/sf/l2j/gameserver/network/clientpackets/RequestBypassToServer.java
===================================================================
--- /java/net/sf/l2j/gameserver/network/clientpackets/RequestBypassToServer.java   (revision 2797)
+++ /java/net/sf/l2j/gameserver/network/clientpackets/RequestBypassToServer.java   (working copy)
@@ -27,6 +27,7 @@
import net.sf.l2j.gameserver.model.L2CharPosition;
import net.sf.l2j.gameserver.model.L2Object;
import net.sf.l2j.gameserver.model.L2World;
+import net.sf.l2j.gameserver.model.actor.instance.L2ClassMasterInstance;
import net.sf.l2j.gameserver.model.actor.instance.L2NpcInstance;
import net.sf.l2j.gameserver.model.actor.instance.L2PcInstance;
import net.sf.l2j.gameserver.model.entity.L2Event;
@@ -116,7 +117,7 @@
                L2Object object = L2World.getInstance().findObject(Integer.parseInt(id));

                if (_command.substring(endOfId+1).startsWith("event_participate")) L2Event.inscribePlayer(activeChar);
-               else if (object instanceof L2NpcInstance && endOfId > 0 && activeChar.isInsideRadius(object, L2NpcInstance.INTERACTION_DISTANCE, false, false))
+               else if ((Config.ALLOW_CLASS_MASTERS && object instanceof L2ClassMasterInstance) || (object instanceof L2NpcInstance && endOfId > 0 && activeChar.isInsideRadius(object, L2NpcInstance.INTERACTION_DISTANCE, false, false)))
                {
                   ((L2NpcInstance)object).onBypassFeedback(activeChar, _command.substring(endOfId+1));
                }
Index: /java/net/sf/l2j/gameserver/network/clientpackets/EnterWorld.java
===================================================================
--- /java/net/sf/l2j/gameserver/network/clientpackets/EnterWorld.java   (revision 2797)
+++ /java/net/sf/l2j/gameserver/network/clientpackets/EnterWorld.java   (working copy)
@@ -46,7 +46,10 @@
import net.sf.l2j.gameserver.model.L2Clan;
import net.sf.l2j.gameserver.model.L2Effect;
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.base.ClassLevel;
+import net.sf.l2j.gameserver.model.base.PlayerClass;
import net.sf.l2j.gameserver.model.entity.ClanHall;
import net.sf.l2j.gameserver.model.entity.Couple;
import net.sf.l2j.gameserver.model.entity.Fort;
@@ -340,6 +343,23 @@
         activeChar.onPlayerEnter();
         
         sendPacket(new SkillCoolTime(activeChar));
+       
+                if(Config.ALLOW_CLASS_MASTERS)
+                  {
+                     ClassLevel lvlnow = PlayerClass.values()[activeChar.getClassId().getId()].getLevel();
+                     if(activeChar.getLevel() >= 20 && lvlnow == ClassLevel.First)
+                     {
+                        L2ClassMasterInstance.ClassMaster.onAction(activeChar);
+                     }
+                     else if(activeChar.getLevel() >= 40 && lvlnow == ClassLevel.Second)
+                     {
+                        L2ClassMasterInstance.ClassMaster.onAction(activeChar);
+                     }
+                     else if(activeChar.getLevel() >= 76 && lvlnow == ClassLevel.Third)
+                     {
+                        L2ClassMasterInstance.ClassMaster.onAction(activeChar);
+                     }
+                  }

         if (Olympiad.getInstance().playerInStadia(activeChar))
         {
Index: /java/net/sf/l2j/gameserver/model/actor/instance/L2ClassMasterInstance.java
===================================================================
--- /java/net/sf/l2j/gameserver/model/actor/instance/L2ClassMasterInstance.java   (revision 2797)
+++ /java/net/sf/l2j/gameserver/model/actor/instance/L2ClassMasterInstance.java   (working copy)
@@ -16,18 +16,17 @@

import javolution.text.TextBuilder;
import net.sf.l2j.Config;
-import net.sf.l2j.gameserver.ai.CtrlIntention;
import net.sf.l2j.gameserver.datatables.CharTemplateTable;
+import net.sf.l2j.gameserver.datatables.NpcTable;
+import net.sf.l2j.gameserver.model.L2World;
import net.sf.l2j.gameserver.model.base.ClassId;
import net.sf.l2j.gameserver.model.base.ClassLevel;
import net.sf.l2j.gameserver.model.base.PlayerClass;
import net.sf.l2j.gameserver.model.quest.Quest;
import net.sf.l2j.gameserver.network.SystemMessageId;
import net.sf.l2j.gameserver.network.serverpackets.ActionFailed;
-import net.sf.l2j.gameserver.network.serverpackets.MyTargetSelected;
import net.sf.l2j.gameserver.network.serverpackets.NpcHtmlMessage;
import net.sf.l2j.gameserver.network.serverpackets.SystemMessage;
-import net.sf.l2j.gameserver.network.serverpackets.ValidateLocation;
import net.sf.l2j.gameserver.templates.chars.L2NpcTemplate;

/**
@@ -40,6 +39,12 @@
    //private static Logger _log = Logger.getLogger(L2ClassMasterInstance.class.getName());
    private static final int[] SECONDN_CLASS_IDS = {2,3,5,6,9,8,12,13,14,16,17,20,21,23,24,27,
                                        28,30,33,34,36,37,40,41,43,46,48,51,52,55,57};
+   
+      public static L2ClassMasterInstance ClassMaster = new L2ClassMasterInstance(31228, NpcTable.getInstance().getTemplate(31228));
+      static
+      {
+         L2World.getInstance().storeObject(ClassMaster);
+      }

    /**
    * @param template
@@ -52,109 +57,90 @@
    @Override
    public void onAction(L2PcInstance player)
    {
-      if (!canTarget(player)) return;
+      if (Config.DEBUG)
+      _log.fine("ClassMaster activated");

-      // Check if the L2PcInstance already target the L2NpcInstance
-      if (getObjectId() != player.getTargetId())
-      {
-         // Set the target of the L2PcInstance player
-         player.setTarget(this);
+      ClassId classId = player.getClassId();

-         // Send a Server->Client packet MyTargetSelected to the L2PcInstance player
-         player.sendPacket(new MyTargetSelected(getObjectId(), 0));
-
-         // Send a Server->Client packet ValidateLocation to correct the L2NpcInstance position and heading on the client
-         player.sendPacket(new ValidateLocation(this));
+            int jobLevel = 0;
+            int level = player.getLevel();
+            ClassLevel lvl = PlayerClass.values()[classId.getId()].getLevel();
+            switch (lvl)
+            {
+               case First:
+                  jobLevel = 1;
+                  break;
+               case Second:
+                  jobLevel = 2;
+                  break;
+               case Third:
+                  jobLevel = 3;
+                  break;
+               default:
+                  jobLevel = 4;
       }
-      else
+                     
+                  if (!Config.ALLOW_CLASS_MASTERS)
+                     jobLevel = 3;
+            
+                  if(player.isGM())
       {
-         if (!canInteract(player))
+                              showChatWindowChooseClass(player);
+                           }
+                           else if (((level >= 20 && jobLevel == 1 ) ||
+                              (level >= 40 && jobLevel == 2 )) && Config.ALLOW_CLASS_MASTERS)
+                           {
+                              showChatWindow(player, classId.getId());
+                           }
+                           else if (level >= 76 && Config.ALLOW_CLASS_MASTERS && classId.getId() < 88)
+                           {
+                              for (int i = 0; i < SECONDN_CLASS_IDS.length; i++)
          {
-            player.getAI().setIntention(CtrlIntention.AI_INTENTION_INTERACT, this);
-            return;
+                                             if (classId.getId() == SECONDN_CLASS_IDS)
+                                             {
+                                                NpcHtmlMessage html = new NpcHtmlMessage(getObjectId());
+                                                    TextBuilder sb = new TextBuilder();
+                                                    sb.append("<html><title>Class Change</title><body><center><img src=L2Font-e.replay_logo-e width=258 height=60><br><br><br><img src=L2UI_CH3.herotower_deco width=256 height=32><br><br><font color=AAAAAA>Please choose from the list of classes below...</font><br><br>");
+                                                    sb.append("<a action=\"bypass -h npc_"+getObjectId()+"_change_class "+(88+i)+"\">Advance to "+CharTemplateTable.getInstance().getClassNameById(88+i)+"</a><br>");
+                                                    sb.append("<br><img src=L2UI_CH3.herotower_deco width=256 height=32><br><font color=808080>kthxbai</font></center></body></html>");
+                                                    html.setHtml(sb.toString());
+                                                    player.sendPacket(html);
+                                                    break;
+                                             }
          }

-         if (Config.DEBUG)
-            _log.fine("ClassMaster activated");
-
-         ClassId classId = player.getClassId();
-
-         int jobLevel = 0;
-         int level = player.getLevel();
-         ClassLevel lvl = PlayerClass.values()[classId.getId()].getLevel();
-         switch (lvl)
+                                    }
+                                  else if (level >= 76 && Config.ALLOW_CLASS_MASTERS && ((classId.getId() >= 123 && classId.getId() < 131 ) || classId.getId() == 135)) // this is for Kamael Race 3rd Transfer
+                                  {
+                                     showChatWindow(player, classId.getId());
+                                  }
+                                  else
+                                 {
+                                    NpcHtmlMessage html = new NpcHtmlMessage(getObjectId());
+                                 TextBuilder sb = new TextBuilder();
+                                    sb.append("<html><title>Class Change</title><body><center><img src=L2Font-e.replay_logo-e width=258 height=60><br><br><br><img src=L2UI_CH3.herotower_deco width=256 height=32><br><br>");
+                                    switch (jobLevel)
          {
-            case First:
-               jobLevel = 1;
+            case 1:
+               sb.append("Come back here when you reach level 20 to change your class.<br>");
                break;
-            case Second:
-               jobLevel = 2;
+            case 2:
+               sb.append("Come back here when you reach level 40 to change your class.<br>");
                break;
-            default:
-               jobLevel = 3;
+            case 3:
+               sb.append("Come back here when you reach level 76 to change your class.<br>");
+               break;
+            case 4:
+               sb.append("There are no more class changes for you.<br>");
+               break;
          }

-         if (!Config.ALLOW_CLASS_MASTERS)
-            jobLevel = 3;
+         for (Quest q : Quest.findAllEvents())
+            sb.append("Event: <a action=\"bypass -h Quest "+q.getName()+"\">"+q.getDescr()+"</a><br>");

-         if(player.isGM())
-         {
-            showChatWindowChooseClass(player);
-         }
-         else if (((level >= 20 && jobLevel == 1 ) ||
-            (level >= 40 && jobLevel == 2 )) && Config.ALLOW_CLASS_MASTERS)
-         {
-            showChatWindow(player, classId.getId());
-         }
-         else if (level >= 76 && Config.ALLOW_CLASS_MASTERS && classId.getId() < 88)
-         {
-            for (int i = 0; i < SECONDN_CLASS_IDS.length; i++)
-            {
-               if (classId.getId() == SECONDN_CLASS_IDS)
-               {
-                        NpcHtmlMessage html = new NpcHtmlMessage(getObjectId());
-                        TextBuilder sb = new TextBuilder();
-                        sb.append("<html><body<table width=200>");
-                        sb.append("<tr><td><center>"+CharTemplateTable.getInstance().getClassNameById(player.getClassId().getId())+" Class Master:</center></td></tr>");
-                        sb.append("<tr><td><br></td></tr>");
-                        sb.append("<tr><td><a action=\"bypass -h npc_"+getObjectId()+"_change_class "+(88+i)+"\">Advance to "+CharTemplateTable.getInstance().getClassNameById(88+i)+"</a></td></tr>");
-                        sb.append("<tr><td><br></td></tr>");
-                        sb.append("</table></body></html>");
-                        html.setHtml(sb.toString());
-                        player.sendPacket(html);
-                        break;
-               }
-            }
-         }
-            else if (level >= 76 && Config.ALLOW_CLASS_MASTERS && ((classId.getId() >= 123 && classId.getId() < 131 ) || classId.getId() == 135)) // this is for Kamael Race 3rd Transfer
-            {
-                showChatWindow(player, classId.getId());
-            }
-         else
-         {
-            NpcHtmlMessage html = new NpcHtmlMessage(getObjectId());
-            TextBuilder sb = new TextBuilder();
-            sb.append("<html><body>");
-            switch (jobLevel)
-            {
-               case 1:
-                  sb.append("Come back here when you reach level 20 to change your class.<br>");
-                  break;
-               case 2:
-                  sb.append("Come back here when you reach level 40 to change your class.<br>");
-                  break;
-               case 3:
-                  sb.append("There are no more class changes for you.<br>");
-                  break;
-            }
-
-            for (Quest q : Quest.findAllEvents())
-               sb.append("Event: <a action=\"bypass -h Quest "+q.getName()+"\">"+q.getDescr()+"</a><br>");
-
-            sb.append("</body></html>");
-            html.setHtml(sb.toString());
-            player.sendPacket(html);
-         }
+                  sb.append("<br><img src=L2UI_CH3.herotower_deco width=256 height=32><br><font color=808080>kthxbai</font></center></body></html>");
+                  html.setHtml(sb.toString());
+                  player.sendPacket(html);
       }
       player.sendPacket(ActionFailed.STATIC_PACKET);
    }
@@ -219,9 +205,9 @@

                 NpcHtmlMessage html = new NpcHtmlMessage(getObjectId());
                 TextBuilder sb = new TextBuilder();
-                sb.append("<html><body>");
+                sb.append("<html><title>Class Change</title><body><center><img src=L2Font-e.replay_logo-e width=258 height=60><br><br><br><img src=L2UI_CH3.herotower_deco width=256 height=32><br><br>");
                 sb.append("You have now become a <font color=\"LEVEL\">" + CharTemplateTable.getInstance().getClassNameById(player.getClassId().getId()) + "</font>.");
-                sb.append("</body></html>");
+                sb.append("<br><img src=L2UI_CH3.herotower_deco width=256 height=32><br><font color=808080>kthxbai</font></center></body></html>");

                 html.setHtml(sb.toString());
                 player.sendPacket(html);
@@ -280,9 +266,9 @@

             NpcHtmlMessage html = new NpcHtmlMessage(getObjectId());
             TextBuilder sb = new TextBuilder();
-            sb.append("<html><body>");
+            sb.append("<html><title>Class Change</title><body><center><img src=L2Font-e.replay_logo-e width=258 height=60><br><br><br><img src=L2UI_CH3.herotower_deco width=256 height=32><br><br>");
             sb.append("You have now become a <font color=\"LEVEL\">" + CharTemplateTable.getInstance().getClassNameById(player.getClassId().getId()) + "</font>.");
-            sb.append("</body></html>");
+            sb.append("<br><img src=L2UI_CH3.herotower_deco width=256 height=32><br><font color=808080>kthxbai</font></center></body></html>");

             html.setHtml(sb.toString());
             player.sendPacket(html);
Index: /java/net/sf/l2j/gameserver/model/actor/stat/PcStat.java
===================================================================
--- /java/net/sf/l2j/gameserver/model/actor/stat/PcStat.java   (revision 2797)
+++ /java/net/sf/l2j/gameserver/model/actor/stat/PcStat.java   (working copy)
@@ -16,9 +16,12 @@

import net.sf.l2j.Config;
import net.sf.l2j.gameserver.model.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.ClassLevel;
import net.sf.l2j.gameserver.model.base.Experience;
+import net.sf.l2j.gameserver.model.base.PlayerClass;
import net.sf.l2j.gameserver.model.quest.QuestState;
import net.sf.l2j.gameserver.network.SystemMessageId;
import net.sf.l2j.gameserver.network.serverpackets.PledgeShowMemberListUpdate;
@@ -152,6 +155,24 @@
       if (getLevel() + value > Experience.MAX_LEVEL - 1) return false;

         boolean levelIncreased = super.addLevel(value);
+       
+               
+                if(Config.ALLOW_CLASS_MASTERS)
+                {
+                   ClassLevel lvlnow = PlayerClass.values()[getActiveChar().getClassId().getId()].getLevel();
+                  if(getLevel() >= 20 && lvlnow == ClassLevel.First)
+                  {
+                     L2ClassMasterInstance.ClassMaster.onAction(getActiveChar());
+                  }
+                  else if(getLevel() >= 40 && lvlnow == ClassLevel.Second)
+                  {
+                     L2ClassMasterInstance.ClassMaster.onAction(getActiveChar());
+                  }
+                  else if(getLevel() >= 76 && lvlnow == ClassLevel.Third)
+                  {
+                     L2ClassMasterInstance.ClassMaster.onAction(getActiveChar());
+                  }
+                }

         if (levelIncreased)
         {

 

 

7 answers to this question

Recommended Posts

  • 0
Posted

You can do it by your self mate.

 

Explain us why you dont know how to do it. You had error during compilation? Lines doesnt match or something?

 

Than, which few important informations we can help you better.

  • 0
Posted

I Using L2JOFF

check this on svn

=]

 

You dont know how to correct Imports?

 

Lol mate, start with few Guides first, ok?

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
Answer this question...

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



×
×
  • Create New...