Adjusting the subjob level to be different than the main job level

From DSP Wiki
Jump to: navigation, search

If you would prefer the subjob to be different from retail, example, same level as main job, or 3/4 level of main, etc, then find the following code in battleentity.cpp:

   void CBattleEntity::SetSLevel(uint8 slvl)
   {
       m_slvl = (slvl > (m_mlvl >> 1) ? (m_mlvl == 1 ? 1 : (m_mlvl >> 1)) : slvl); <-- Replace this line with
       if (this->objtype & TYPE_PC)
           Sql_Query(SqlHandle, "UPDATE char_stats SET slvl = %u WHERE charid = %u LIMIT 1;", m_slvl, this->id);
   }

Replace the line above (with the handy note by the side "<-- Replace this line with) this code:

   if (this->objtype == TYPE_MOB && this->objtype != TYPE_PET)
   {
       m_slvl = (slvl > (m_mlvl >> 1) ? (m_mlvl == 1 ? 1 : (m_mlvl >> 1)) : slvl);
   }
   else
   {
       // REPLACE THIS LINE - example of new math to place here can be found in the original patch text, quoted below
   }


Then replace what is in the REPLACE THIS LINE with one of the following:

   m_slvl = (slvl > (m_mlvl >> 1) ? (m_mlvl == 1 ? 1 : (m_mlvl >> 1)) : slvl); // Sub is 1/2 of main of main, same as retail
   m_slvl = (slvl > (m_mlvl / 3) ? (m_mlvl == 1 ? 1 : (m_mlvl / 3)) : slvl); // Sub is 1/3 of main
   m_slvl = (slvl > ((m_mlvl * 2) / 3) ? (m_mlvl == 1 ? 1 : ((m_mlvl * 2) / 3)) : slvl); // Sub is 2/3 of main
   m_slvl = (slvl > (m_mlvl) ? (m_mlvl == 1 ? 1 : (m_mlvl)) : slvl); // Sub caps to main.
   m_slvl = 0; / / No SJ at all...Where is your Altana now?

Example, if you want the subjob to be the same as the main job, your final will look like:

   void CBattleEntity::SetSLevel(uint8 slvl)
   {
       if (this->objtype == TYPE_MOB && this->objtype != TYPE_PET)
       {
           m_slvl = (slvl > (m_mlvl >> 1) ? (m_mlvl == 1 ? 1 : (m_mlvl >> 1)) : slvl);
       }
       else
       {
           m_slvl = (slvl > (m_mlvl) ? (m_mlvl == 1 ? 1 : (m_mlvl)) : slvl); // Sub caps to main.
       }
       if (this->objtype & TYPE_PC)
           Sql_Query(SqlHandle, "UPDATE char_stats SET slvl = %u WHERE charid = %u LIMIT 1;", m_slvl, this->id);
   }