new configuration setting: subjob level cap

Post Reply
User avatar
TeoTwawki
Developer
Posts: 527
Joined: Mon Jul 15, 2013 9:50 pm

new configuration setting: subjob level cap

Post by TeoTwawki » Sun Oct 20, 2013 2:14 pm

This allows non retail behavior for the level of the support job, like other map settings do for other things. It's just for fun for those who want it. Prolly not the sort of thing you want to trunk but thought I'd share anyway.
#Changes fraction of mainjob that subjob caps to.
# 0 No subjob
# 1 Sub is 1/2 of mainjob
# 2 Sub is 1/3 of mainjob
# 3 Sub is 2/3 of mainjob
# 4 caps to mainjob (equal)
#Default is 1 (retail values)
SJ_CAP: 1
Attachments
Search_SJ.patch
(4.96 KiB) Downloaded 845 times
search_server.conf.patch
(535 Bytes) Downloaded 838 times
map_darkstar.conf.patch
(642 Bytes) Downloaded 797 times
SJ_CAP.patch
(2.69 KiB) Downloaded 823 times
Last edited by TeoTwawki on Mon Apr 30, 2018 5:56 pm, edited 1 time in total.
Hi, I run The Demiurge server.


Image
Always code as if the guy who ends up maintaining your code will be a violent psychopath who knows where you live. - Martin Golding
PLS USE [ code ] CODE TAGS [ /code ] WHEN POSTING CODE
DO NOT PRIVATE MESSAGE ME ABOUT BUGS

User avatar
TeoTwawki
Developer
Posts: 527
Joined: Mon Jul 15, 2013 9:50 pm

Re: new configuration setting: subjob level cap

Post by TeoTwawki » Fri Oct 25, 2013 6:17 pm

Search setting patches added to main post.
This lets search server know of the new calculation. Defaults to retail behavior if missing. This had to be done as a separate setting because the search server does its own separate calculation and cannot read the map servers configuration without breaking the ability to be on separate physical machines. Unless I were to write more code than this and store it somewhere both servers can access, like the database.

It does what I want but open to suggestions for any further modification/improvement.
Hi, I run The Demiurge server.


Image
Always code as if the guy who ends up maintaining your code will be a violent psychopath who knows where you live. - Martin Golding
PLS USE [ code ] CODE TAGS [ /code ] WHEN POSTING CODE
DO NOT PRIVATE MESSAGE ME ABOUT BUGS

ClanMcCracken
Posts: 26
Joined: Sun Mar 25, 2018 8:54 am

Re: new configuration setting: subjob level cap

Post by ClanMcCracken » Fri Apr 06, 2018 5:35 pm

Does this functionality still work?

User avatar
TeoTwawki
Developer
Posts: 527
Joined: Mon Jul 15, 2013 9:50 pm

Re: new configuration setting: subjob level cap

Post by TeoTwawki » Sun Apr 08, 2018 8:40 pm

Yeah mostly. You can still find that segment in battleentity.cpp and just set the subjob capping to whatever you wnat your server to use, or use this old post thread as a guide to make it adjustable still. The search server edits are no longer needed. I could turn it into a proper setting in project now but I don't think it'd see that much use, a majority of servers just want to emulate either modern retail or 2004 ish retail.

I wouldn't try to actually apply those outdated patch files though. Just open them in a text editor and look at what I changed.

Original:

Code: Select all

void CBattleEntity::SetSLevel(uint8 slvl)
 {
	m_slvl = (slvl > (m_mlvl >> 1) ? (m_mlvl == 1 ? 1 : (m_mlvl >> 1)) : slvl);
 }
That's what sets sub to cap at half of main. Just replace the math. (understanding how C++ ternary works will help, google it if you don't)
Hi, I run The Demiurge server.


Image
Always code as if the guy who ends up maintaining your code will be a violent psychopath who knows where you live. - Martin Golding
PLS USE [ code ] CODE TAGS [ /code ] WHEN POSTING CODE
DO NOT PRIVATE MESSAGE ME ABOUT BUGS

ClanMcCracken
Posts: 26
Joined: Sun Mar 25, 2018 8:54 am

Re: new configuration setting: subjob level cap

Post by ClanMcCracken » Mon Apr 09, 2018 8:06 am

I have no idea what any of that means, I'll have to flex some google-fu to figure it out.

Mostly my friend and I were thinking about ways to make the game a little more duo/trio friendly, and we thought if we could have a subjob that was either 2/3 or 1/1 of our main job, it would help make killing EP-DC actually possible at higher levels.

User avatar
TeoTwawki
Developer
Posts: 527
Joined: Mon Jul 15, 2013 9:50 pm

Re: new configuration setting: subjob level cap

Post by TeoTwawki » Sat Apr 14, 2018 10:37 pm

If you don't want it to apply to mobs as well you'll need an if/else conditional check for the entity type.

Back when I wrote the setting mobs core code guts were a little diff and now they call the same function to set their sj level. I forgot all about that.

Code: Select all

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
    {
        // REPLACE THIS LINE - example of new math to place here can be found in the original patch text, quoted below
    }

That will use "new math" for players and their pets, but the old math for everything else. Since pets are often also mobs (jug pets) I make sure to explicitly check its NOT a pet using != on that same line. Unfortunately, charmed pets will be whatever they were before you charmed them, so they won't get the boost.
original patch text wrote: 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?
Hi, I run The Demiurge server.


Image
Always code as if the guy who ends up maintaining your code will be a violent psychopath who knows where you live. - Martin Golding
PLS USE [ code ] CODE TAGS [ /code ] WHEN POSTING CODE
DO NOT PRIVATE MESSAGE ME ABOUT BUGS

ClanMcCracken
Posts: 26
Joined: Sun Mar 25, 2018 8:54 am

Re: new configuration setting: subjob level cap

Post by ClanMcCracken » Mon Apr 30, 2018 1:08 pm

Many thanks :D this is exactly what I needed

Post Reply