Package com.l2jfrozen.gameserver.model.base

Examples of com.l2jfrozen.gameserver.model.base.SubClass


    final L2PcInstance player = getActiveChar();
    if(player!=null && player.isSubClassActive()){
     
      int class_index = player.getClassIndex();
     
      SubClass player_subclass = null;
      if((player_subclass = player.getSubClasses().get(class_index))!=null)
        return player_subclass.getExp();

    }
     
    return super.getExp();
  }
View Full Code Here


   
    if(player.isSubClassActive())
    {
      int class_index = player.getClassIndex();
     
      SubClass player_subclass = null;
      if((player_subclass = player.getSubClasses().get(class_index))!=null)
        player_subclass.setExp(value);
     
      //getActiveChar().getSubClasses().get(getActiveChar().getClassIndex()).setExp(value);
    }
    else
    {
View Full Code Here

        
        if(player.isSubClassActive())
        {
          int class_index = player.getClassIndex();
 
          SubClass player_subclass = null;
          if((player_subclass = player.getSubClasses().get(class_index)) != null)
            return player_subclass.getLevel();
 
          //getActiveChar().getSubClasses().get(getActiveChar().getClassIndex()).setExp(value);
        }

//             if (getActiveChar().isSubClassActive())
View Full Code Here

   
    if(player.isSubClassActive())
    {
      int class_index = player.getClassIndex();
     
      SubClass player_subclass = null;
      if((player_subclass = player.getSubClasses().get(class_index))!=null)
        player_subclass.setLevel(value);
     
//    if(getActiveChar().isSubClassActive())
//    {
//      getActiveChar().getSubClasses().get(getActiveChar().getClassIndex()).setLevel(value);
    }
View Full Code Here

   
    if(player.isSubClassActive())
    {
      int class_index = player.getClassIndex();
     
      SubClass player_subclass = null;
      if((player_subclass = player.getSubClasses().get(class_index))!=null)
        return player_subclass.getSp();
    }
//    if(getActiveChar().isSubClassActive())
//      return getActiveChar().getSubClasses().get(getActiveChar().getClassIndex()).getSp();

    return super.getSp();
View Full Code Here

   
    if(player.isSubClassActive())
    {
      int class_index = player.getClassIndex();
     
      SubClass player_subclass = null;
      if((player_subclass = player.getSubClasses().get(class_index))!=null)
        player_subclass.setSp(value);
    }
   
//    if(getActiveChar().isSubClassActive())
//    {
//      getActiveChar().getSubClasses().get(getActiveChar().getClassIndex()).setSp(value);
View Full Code Here

              content.append("<a action=\"bypass -h npc_" + getObjectId() + "_Subclass 5 0\">" + CharTemplateTable.getClassNameById(baseClassId) + "</a>&nbsp;" + "<font color=\"LEVEL\">(Base Class)</font><br><br>");
            }

            for(Iterator<SubClass> subList = iterSubClasses(player); subList.hasNext();)
            {
              SubClass subClass = subList.next();
              int subClassId = subClass.getClassId();

              if(subClassId == player.getActiveClass())
              {
                content.append(CharTemplateTable.getClassNameById(subClassId) + "<br>");
              }
              else
              {
                content.append("<a action=\"bypass -h npc_" + getObjectId() + "_Subclass 5 " + subClass.getClassIndex() + "\">" + CharTemplateTable.getClassNameById(subClassId) + "</a><br>");
              }
            }
          }         
          break;
        case 3: // Change/Cancel Subclass - Initial
         
          content.append("Change Subclass:<br>Which of the following sub classes would you like to change?<br>");
          int classIndex = 1;

          for(Iterator<SubClass> subList = iterSubClasses(player); subList.hasNext();)
          {
            SubClass subClass = subList.next();

            content.append("Sub-class " + classIndex + "<br1>");
            content.append("<a action=\"bypass -h npc_" + getObjectId() + "_Subclass 6 " + subClass.getClassIndex() + "\">" + CharTemplateTable.getClassNameById(subClass.getClassId()) + "</a><br>");

            classIndex++;
          }
          content.append("<br>If you change a sub class, you'll start at level 40 after the 2nd class transfer.");
          break;
        case 4: // Add Subclass - Action (Subclass 4 x[x])       
          /*
           * If the character is less than level 75 on any of their previously chosen
           * classes then disallow them to change to their most recently added sub-class choice.
           */
         
          // Fix exploit stuck subclass and skills
          if(player.isLearningSkill() || player.isLocked())
                  return;
         
          player.setLocked(true);         
          boolean allowAddition = true;
         
          if (player._inEventRaid)
                    {
            player.sendMessage("Come back later when the Raid Event is over.");
            return;
          }
         
          // Subclass exploit fix during add subclass
          if (!player.getFloodProtectors().getSubclass().tryPerformAction("add subclass"))
          {
            _log.warning("Player "+player.getName()+" has performed a subclass change too fast");
            player.setLocked(false);
            return;
          }
         
          // You can't add Subclass when you are registered in Events (TVT, CTF, DM)
          if(player._inEventTvT || player._inEventCTF || player._inEventDM)
          {
            player.sendMessage("You can't add a subclass while in an event.");
            player.setLocked(false);
            return;
          }
         
          // Check player level
          if(player.getLevel() < 75)
          {
            player.sendMessage("You may not add a new sub class before you are level 75 on your previous class.");
            allowAddition = false;
          }

          // You can't add Subclass when you are registered in Olympiad
          if(Olympiad.getInstance().isRegisteredInComp(player) || player.getOlympiadGameId() > 0)
          {
            player.sendPacket(new SystemMessage(SystemMessageId.YOU_HAVE_ALREADY_BEEN_REGISTERED_IN_A_WAITING_LIST_OF_AN_EVENT));
            player.setLocked(false);
            return;
          }
         
          if(allowAddition)
          {
            if(!player.getSubClasses().isEmpty())
            {
              for(Iterator<SubClass> subList = iterSubClasses(player); subList.hasNext();)
              {
                SubClass subClass = subList.next();

                if(subClass.getLevel() < 75)
                {
                  player.sendMessage("You may not add a new sub class before you are level 75 on your previous sub class.");
                  allowAddition = false;
                  break;
                }
              }
            }
          }

          /*
           * If quest checking is enabled, verify if the character has completed the Mimir's Elixir (Path to Subclass)
           * and Fate's Whisper (A Grade Weapon) quests by checking for instances of their unique reward items.
           *
           * If they both exist, remove both unique items and continue with adding the sub-class.
           */
          if(!Config.ALT_GAME_SUBCLASS_WITHOUT_QUESTS)
          {

            QuestState qs = player.getQuestState("235_MimirsElixir");
            if(qs == null || !qs.isCompleted())
            {
              player.sendMessage("You must have completed the Mimir's Elixir quest to continue adding your sub class.");
              player.setLocked(false);
              return;
            }
            qs = player.getQuestState("234_FatesWhisper");

            if(qs == null || !qs.isCompleted())
            {
              player.sendMessage("You must have completed the Fate's Whisper quest to continue adding your sub class.");
              player.setLocked(false);
              return;
            }
          }

          if(allowAddition)
          {
            String className = CharTemplateTable.getClassNameById(paramOne);

            if(!player.addSubClass(paramOne, player.getTotalSubClasses() + 1))
            {
              player.sendMessage("The sub class could not be added.");
              player.setLocked(false);
              return;
            }

            player.setActiveClass(player.getTotalSubClasses());
           
            if(Config.CHECK_SKILLS_ON_ENTER && !Config.ALT_GAME_SKILL_LEARN)
            {
              player.checkAllowedSkills();
            }

            content.append("Add Subclass:<br>The sub class of <font color=\"LEVEL\">" + className + "</font> has been added.");
            player.sendPacket(new SystemMessage(SystemMessageId.CLASS_TRANSFER)); // Transfer to new class.

            className = null;
           
          }
          else
          {
            html.setFile("data/html/villagemaster/SubClass_Fail.htm");
          }
         
          player.setLocked(false);         
          break;
        case 5: // Change Class - Action
          /*
           * If the character is less than level 75 on any of their previously chosen
           * classes then disallow them to change to their most recently added sub-class choice.
           *
           * Note: paramOne = classIndex
           */
         
          if (player._inEventRaid)
          {
            player.sendMessage("Come back later when the Raid Event is over.");
            return;
          }
         
          // Fix exploit stuck subclass and skills
          if(player.isLearningSkill() || player.isLocked())
                  return;
         
          player.setLocked(true);
         
          // Subclass exploit fix during change subclass
          if (!player.getFloodProtectors().getSubclass().tryPerformAction("change subclass"))
          {
            _log.warning("Player "+player.getName()+" has performed a subclass change too fast");
            player.setLocked(false);
            return;
          }
         
          // You can't change Subclass when you are registered in Events (TVT, CTF, DM)
          if(player._inEventTvT || player._inEventCTF || player._inEventDM)
          {
            player.sendMessage("You can't change subclass while in an event.");
            player.setLocked(false);
            return;
          }
         
          // You can't change Subclass when you are registered in Olympiad
          if(Olympiad.getInstance().isRegisteredInComp(player) || player.getOlympiadGameId() > 0)
          {
            player.sendPacket(new SystemMessage(SystemMessageId.YOU_HAVE_ALREADY_BEEN_REGISTERED_IN_A_WAITING_LIST_OF_AN_EVENT));
            player.setLocked(false);
            return;
          }

          player.setActiveClass(paramOne);

          content.append("Change Subclass:<br>Your active sub class is now a <font color=\"LEVEL\">" + CharTemplateTable.getClassNameById(player.getActiveClass()) + "</font>.");

          player.sendPacket(new SystemMessage(SystemMessageId.SUBCLASS_TRANSFER_COMPLETED)); // Transfer completed.
         
          // check player skills
          if(Config.CHECK_SKILLS_ON_ENTER && !Config.ALT_GAME_SKILL_LEARN)
          {
            player.checkAllowedSkills();
          }
         
          player.setLocked(false);         
          break;
        case 6: // Change/Cancel Subclass - Choice
         
          content.append("Please choose a sub class to change to. If the one you are looking for is not here, " + "please seek out the appropriate master for that class.<br>" + "<font color=\"LEVEL\">Warning!</font> All classes and skills for this class will be removed.<br><br>");

          subsAvailable = getAvailableSubClasses(player);

          if(subsAvailable != null && !subsAvailable.isEmpty())
          {
            for(PlayerClass subClass : subsAvailable)
            {
              content.append("<a action=\"bypass -h npc_" + getObjectId() + "_Subclass 7 " + paramOne + " " + subClass.ordinal() + "\">" + formatClassForDisplay(subClass) + "</a><br>");
            }
          }
          else
          {
            player.sendMessage("There are no sub classes available at this time.");
View Full Code Here

          {
            availSubs.remove(availSub);
          }
        for(Iterator<SubClass> subList = iterSubClasses(player); subList.hasNext();)
        {
          SubClass prevSubClass = subList.next();
          int subClassId = prevSubClass.getClassId();
          if(subClassId >= 88)
          {
            subClassId = ClassId.values()[subClassId].getParent().getId();
          }
View Full Code Here

      ResultSet rset = statement.executeQuery();

      while(rset.next())
      {
        SubClass subClass = new SubClass();
        subClass.setClassId(rset.getInt("class_id"));
        subClass.setLevel(rset.getByte("level"));
        subClass.setExp(rset.getLong("exp"));
        subClass.setSp(rset.getInt("sp"));
        subClass.setClassIndex(rset.getInt("class_index"));

        // Enforce the correct indexing of _subClasses against their class indexes.
        player.getSubClasses().put(subClass.getClassIndex(), subClass);
      }

      statement.close();
      rset.close();
      rset = null;
View Full Code Here

    if(getSubClasses().containsKey(classIndex))
      return false;

    // Note: Never change _classIndex in any method other than setActiveClass().

    SubClass newClass = new SubClass();
    newClass.setClassId(classId);
    newClass.setClassIndex(classIndex);

    boolean output = false;
   
    Connection con = null;

    try
    {
      // Store the basic info about this new sub-class.
      con = L2DatabaseFactory.getInstance().getConnection(false);
      PreparedStatement statement = con.prepareStatement(ADD_CHAR_SUBCLASS);
      statement.setInt(1, getObjectId());
      statement.setInt(2, newClass.getClassId());
      statement.setLong(3, newClass.getExp());
      statement.setInt(4, newClass.getSp());
      statement.setInt(5, newClass.getLevel());
      statement.setInt(6, newClass.getClassIndex()); // <-- Added
      statement.execute();
      statement.close();
      statement = null;
     
      output=true;
    }
    catch(Exception e)
    {
      if(Config.ENABLE_ALL_EXCEPTIONS)
        e.printStackTrace();
     
      _log.warning("WARNING: Could not add character sub class for " + getName() + ": " + e);
    }
    finally
    {
      CloseUtil.close(con);
      con = null;
    }

    if(output){
     
      // Commit after database INSERT incase exception is thrown.
      getSubClasses().put(newClass.getClassIndex(), newClass);

      if(Config.DEBUG)
      {
        _log.info(getName() + " added class ID " + classId + " as a sub class at index " + classIndex + ".");
      }
View Full Code Here

TOP

Related Classes of com.l2jfrozen.gameserver.model.base.SubClass

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.