Jump to content
  • 0

Pre-renewal server with renewal defense system.


GiftBox

Question


  • Group:  Members
  • Topic Count:  3
  • Topics Per Day:  0.00
  • Content Count:  9
  • Reputation:   0
  • Joined:  01/19/21
  • Last Seen:  

Hi, I am currently running a pre-renewal server with renewal items, and since the main problem is with defense,
Once I go over 99 it goes to minus, and even so getting 99 def would be so easy,
Since changing all single renewal's equip defense and item descriptions etc,
Would be unrealistic, I would like to just change the defense system only to Renewal.

Can someone please help me with this please...?

Edited by GiftBox
Link to comment
Share on other sites

8 answers to this question

Recommended Posts

  • 0

  • Group:  Members
  • Topic Count:  9
  • Topics Per Day:  0.00
  • Content Count:  51
  • Reputation:   3
  • Joined:  11/29/13
  • Last Seen:  

I don't see there is any other way except changing it manually one by one for each item you copied from renewal item_db.

I'm not sure even if disabling the renewal system from /src/config/renewal.h will change the defense on each renewal equips. Same thing goes for the item description. I've experienced similiar thing like this before where i want to use some renewal items, the only solution i came up with was duplicate the item from renewal item_db, put it on import/item_db and then create the item description for those items one by one. It took a lot of time but it'll be cleaner for your db, good to prevent bugs/error and easier to debug in the future.

Link to comment
Share on other sites

  • 0

  • Group:  Members
  • Topic Count:  3
  • Topics Per Day:  0.00
  • Content Count:  9
  • Reputation:   0
  • Joined:  01/19/21
  • Last Seen:  

38 minutes ago, Jesky said:

I don't see there is any other way except changing it manually one by one for each item you copied from renewal item_db.

I'm not sure even if disabling the renewal system from /src/config/renewal.h will change the defense on each renewal equips. Same thing goes for the item description. I've experienced similiar thing like this before where i want to use some renewal items, the only solution i came up with was duplicate the item from renewal item_db, put it on import/item_db and then create the item description for those items one by one. It took a lot of time but it'll be cleaner for your db, good to prevent bugs/error and easier to debug in the future.

Oufh... Or maybe is there any way to change the formula ?

Like not x/100 = def%

but for example = x/300 = def% ?

Link to comment
Share on other sites

  • 0

  • Group:  Members
  • Topic Count:  9
  • Topics Per Day:  0.00
  • Content Count:  51
  • Reputation:   3
  • Joined:  11/29/13
  • Last Seen:  

I'm not sure if this would work but you can try to change the source code in /src/config/const.h

find this code:

#ifdef RENEWAL
	typedef short defType;
	#define DEFTYPE_MIN SHRT_MIN
	#define DEFTYPE_MAX SHRT_MAX
#else
	typedef signed char defType;
	#define DEFTYPE_MIN CHAR_MIN
	#define DEFTYPE_MAX CHAR_MAX
#endif

change it to this one

#ifdef RENEWAL
	typedef signed char defType;
	#define DEFTYPE_MIN CHAR_MIN
	#define DEFTYPE_MAX CHAR_MAX
#else
	typedef signed char defType;
	#define DEFTYPE_MIN CHAR_MIN
	#define DEFTYPE_MAX CHAR_MAX
#endif

basically it just ignore the conditional statement and think of it as a pre-renewal mode, don't forget to recompile your server after changed the codes. if you want to change the server to renewal again or if it doesn't work, simply just revert it. I hope it works. As for the item description, if the item is already available from pre-renewal, i think you can just use the pre-renewal iteminfo.lua and overwrite it to your current iteminfo in your client/System folder.

 

Link to comment
Share on other sites

  • 0

  • Group:  Members
  • Topic Count:  3
  • Topics Per Day:  0.00
  • Content Count:  9
  • Reputation:   0
  • Joined:  01/19/21
  • Last Seen:  

18 minutes ago, Jesky said:

I'm not sure if this would work but you can try to change the source code in /src/config/const.h


#ifdef RENEWAL
	typedef signed char defType;
	#define DEFTYPE_MIN CHAR_MIN
	#define DEFTYPE_MAX CHAR_MAX
#else
	typedef signed char defType;
	#define DEFTYPE_MIN CHAR_MIN
	#define DEFTYPE_MAX CHAR_MAX
#endif

 

I actually already did try that, but the defense still goes to minus... And I tried when the def is 99 its still 99%

And btw my server is pre-renewal, and I just want to take the renewal system, so I guess the one below is okay ..?

Quote

#ifdef RENEWAL
    typedef short defType;
    #define DEFTYPE_MIN SHRT_MIN
    #define DEFTYPE_MAX SHRT_MAX
#else
    typedef signed char defType;
    #define DEFTYPE_MIN SHRT_MIN
    #define DEFTYPE_MAX SHRT_MAX
//    #define DEFTYPE_MIN CHAR_MIN
//    #define DEFTYPE_MAX CHAR_MAX
#endif

Changing this also doesnt work either...
 

Quote

// Max armor def/mdef
// NOTE: This setting have no effect if server is run on Renewal Mode (RENEWAL) 
// NOTE: does not affects skills and status effects like Mental Strength
// If weapon_defense_type is non-zero, it won't apply to max def.
// If magic_defense_type is non-zero, it won't apply to max mdef.
max_def: 500

// Def to Def2 conversion bonus. If the armor def/mdef exceeds max_def,
// the remaining is converted to vit def/int mdef using this multiplier
// (eg: if set to 10, every armor point above the max becomes 10 vit defense points)
over_def_bonus: 1

 

Edited by GiftBox
Link to comment
Share on other sites

  • 0

  • Group:  Members
  • Topic Count:  3
  • Topics Per Day:  0.00
  • Content Count:  9
  • Reputation:   0
  • Joined:  01/19/21
  • Last Seen:  

Btw I found this, do you understand these? I was thinking to edit this but idk im afraid it will make the system error.
Like for example copy all the Renewal scripts to the pre-renewal scripts....?

 

Quote

/*====================================
 * Calc defense damage reduction
 *------------------------------------
 * Credits:
 *    Original coder Skotlex
 *    Initial refactoring by Baalberith
 *    Refined and optimized by helvetica
 */
static void battle_calc_defense_reduction(struct Damage* wd, struct block_list *src,struct block_list *target, uint16 skill_id, uint16 skill_lv)
{
    struct map_session_data *sd = BL_CAST(BL_PC, src);
    struct map_session_data *tsd = BL_CAST(BL_PC, target);
    struct status_change *sc = status_get_sc(src);
    struct status_change *tsc = status_get_sc(target);
    struct status_data *sstatus = status_get_status_data(src);
    struct status_data *tstatus = status_get_status_data(target);

    //Defense reduction
    short vit_def;
    defType def1 = status_get_def(target); //Don't use tstatus->def1 due to skill timer reductions.
    short def2 = tstatus->def2;

    if (sd) {
        int i = sd->indexed_bonus.ignore_def_by_race[tstatus->race] + sd->indexed_bonus.ignore_def_by_race[RC_ALL];
        i += sd->indexed_bonus.ignore_def_by_class[tstatus->class_] + sd->indexed_bonus.ignore_def_by_class[CLASS_ALL];
        if (i) {
            i = min(i,100); //cap it to 100 for 0 def min
            def1 -= def1 * i / 100;
            def2 -= def2 * i / 100;
        }

        //Kagerou/Oboro Earth Charm effect +10% eDEF
        if(sd->spiritcharm_type == CHARM_TYPE_LAND && sd->spiritcharm > 0) {
            short si = 10 * sd->spiritcharm;
            def1 = (def1 * (100 + si)) / 100;
        }
    }

    if (sc && sc->data[SC_EXPIATIO]) {
        short i = 5 * sc->data[SC_EXPIATIO]->val1; // 5% per level

        i = min(i,100); //cap it to 100 for 0 def min
        def1 = (def1*(100-i))/100;
        def2 = (def2*(100-i))/100;
    }

    if (tsc) {
        if (tsc->data[SC_FORCEOFVANGUARD]) {
            short i = 2 * tsc->data[SC_FORCEOFVANGUARD]->val1;

            def1 = (def1 * (100 + i)) / 100;
        }

        if( tsc->data[SC_CAMOUFLAGE] ){
            short i = 5 * tsc->data[SC_CAMOUFLAGE]->val3; //5% per second

            i = min(i,100); //cap it to 100 for 0 def min
            def1 = (def1*(100-i))/100;
            def2 = (def2*(100-i))/100;
        }

        if (tsc->data[SC_GT_REVITALIZE])
            def1 += tsc->data[SC_GT_REVITALIZE]->val4;

        if (tsc->data[SC_OVERED_BOOST] && target->type == BL_PC)
            def1 = (def1 * tsc->data[SC_OVERED_BOOST]->val4) / 100;
    }

    if( battle_config.vit_penalty_type && battle_config.vit_penalty_target&target->type ) {
        unsigned char target_count; //256 max targets should be a sane max

        //Official servers limit the count to 22 targets
        target_count = min(unit_counttargeted(target), (100 / battle_config.vit_penalty_num) + (battle_config.vit_penalty_count - 1));
        if(target_count >= battle_config.vit_penalty_count) {
            if(battle_config.vit_penalty_type == 1) {
                if( !tsc || !tsc->data[SC_STEELBODY] )
                    def1 = (def1 * (100 - (target_count - (battle_config.vit_penalty_count - 1))*battle_config.vit_penalty_num))/100;
                def2 = (def2 * (100 - (target_count - (battle_config.vit_penalty_count - 1))*battle_config.vit_penalty_num))/100;
            } else { //Assume type 2
                if( !tsc || !tsc->data[SC_STEELBODY] )
                    def1 -= (target_count - (battle_config.vit_penalty_count - 1))*battle_config.vit_penalty_num;
                def2 -= (target_count - (battle_config.vit_penalty_count - 1))*battle_config.vit_penalty_num;
            }
        }
        if (skill_id == AM_ACIDTERROR)
#ifdef RENEWAL
            def2 = 0; //Ignore only status defense. [FatalEror]
#else
            def1 = 0; //Ignores only armor defense. [Skotlex]
#endif
        if(def2 < 1)
            def2 = 1;
    }

    //Vitality reduction from rodatazone: http://rodatazone.simgaming.net/mechanics/substats.php#def
    if (tsd) {    //Sd vit-eq
        int skill;
#ifndef RENEWAL
        //[VIT*0.5] + rnd([VIT*0.3], max([VIT*0.3],[VIT^2/150]-1))
        vit_def = def2*(def2-15)/150;
        vit_def = def2/2 + (vit_def>0?rnd()%vit_def:0);
#else
        vit_def = def2;
#endif
        if( src->type == BL_MOB && (battle_check_undead(sstatus->race,sstatus->def_ele) || sstatus->race==RC_DEMON) && //This bonus already doesn't work vs players
            (skill=pc_checkskill(tsd,AL_DP)) > 0 )
            vit_def += skill*(int)(3 +(tsd->status.base_level+1)*0.04);   // submitted by orn
        if( src->type == BL_MOB && (skill=pc_checkskill(tsd,RA_RANGERMAIN))>0 &&
            (sstatus->race == RC_BRUTE || sstatus->race == RC_PLAYER_DORAM || sstatus->race == RC_FISH || sstatus->race == RC_PLANT) )
            vit_def += skill*5;
        if( src->type == BL_MOB && (skill = pc_checkskill(tsd, NC_RESEARCHFE)) > 0 &&
            (sstatus->def_ele == ELE_FIRE || sstatus->def_ele == ELE_EARTH) )
            vit_def += skill * 10;
    } else { //Mob-Pet vit-eq
#ifndef RENEWAL
        //VIT + rnd(0,[VIT/20]^2-1)
        vit_def = (def2/20)*(def2/20);
        if (tsc && tsc->data[SC_SKA])
            vit_def += 100; //Eska increases the random part of the formula by 100
        vit_def = def2 + (vit_def>0?rnd()%vit_def:0);
#else
        //SoftDEF of monsters is floor((BaseLevel+Vit)/2)
        vit_def = def2;
#endif
    }

    if (battle_config.weapon_defense_type) {
        vit_def += def1*battle_config.weapon_defense_type;
        def1 = 0;
    }

#ifdef RENEWAL
    /**
     * RE DEF Reduction
     * Damage = Attack * (4000+eDEF)/(4000+eDEF*10) - sDEF
     * Pierce defence gains 1 atk per def/2
     */
    if( def1 == -400 ) /* -400 creates a division by 0 and subsequently crashes */
        def1 = -399;
    ATK_ADD2(wd->damage, wd->damage2,
        is_attack_piercing(wd, src, target, skill_id, skill_lv, EQI_HAND_R) ? (def1*battle_calc_attack_skill_ratio(wd, src, target, skill_id, skill_lv))/200 : 0,
        is_attack_piercing(wd, src, target, skill_id, skill_lv, EQI_HAND_L) ? (def1*battle_calc_attack_skill_ratio(wd, src, target, skill_id, skill_lv))/200 : 0
    );
    if( !attack_ignores_def(wd, src, target, skill_id, skill_lv, EQI_HAND_R) && !is_attack_piercing(wd, src, target, skill_id, skill_lv, EQI_HAND_R) )
        wd->damage = wd->damage * (4000+def1) / (4000+10*def1) - vit_def;
    if( is_attack_left_handed(src, skill_id) && !attack_ignores_def(wd, src, target, skill_id, skill_lv, EQI_HAND_L) && !is_attack_piercing(wd, src, target, skill_id, skill_lv, EQI_HAND_L) )
        wd->damage2 = wd->damage2 * (4000+def1) / (4000+10*def1) - vit_def;

#else
        if (def1 > 100) def1 = 100;
        ATK_RATE2(wd->damage, wd->damage2,
            attack_ignores_def(wd, src, target, skill_id, skill_lv, EQI_HAND_R) ?100:(is_attack_piercing(wd, src, target, skill_id, skill_lv, EQI_HAND_R) ? (int64)is_attack_piercing(wd, src, target, skill_id, skill_lv, EQI_HAND_R)*(def1+vit_def) : (100-def1)),
            attack_ignores_def(wd, src, target, skill_id, skill_lv, EQI_HAND_L) ?100:(is_attack_piercing(wd, src, target, skill_id, skill_lv, EQI_HAND_L) ? (int64)is_attack_piercing(wd, src, target, skill_id, skill_lv, EQI_HAND_L)*(def1+vit_def) : (100-def1))
        );
        ATK_ADD2(wd->damage, wd->damage2,
            attack_ignores_def(wd, src, target, skill_id, skill_lv, EQI_HAND_R) || is_attack_piercing(wd, src, target, skill_id, skill_lv, EQI_HAND_R) ?0:-vit_def,
            attack_ignores_def(wd, src, target, skill_id, skill_lv, EQI_HAND_L) || is_attack_piercing(wd, src, target, skill_id, skill_lv, EQI_HAND_L) ?0:-vit_def
        );
#endif
 

 

Edited by GiftBox
Link to comment
Share on other sites

  • 0

  • Group:  Members
  • Topic Count:  9
  • Topics Per Day:  0.00
  • Content Count:  51
  • Reputation:   3
  • Joined:  11/29/13
  • Last Seen:  

2 hours ago, GiftBox said:

I actually already did try that, but the defense still goes to minus... And I tried when the def is 99 its still 99%

And btw my server is pre-renewal, and I just want to take the renewal system, so I guess the one below is okay ..?

Changing this also doesnt work either...
 

 

Hi again, sorry for late reply was working.

// Max armor def/mdef
// NOTE: This setting have no effect if server is run on Renewal Mode (RENEWAL) 
// NOTE: does not affects skills and status effects like Mental Strength
// If weapon_defense_type is non-zero, it won't apply to max def.
// If magic_defense_type is non-zero, it won't apply to max mdef.
max_def: 500

// Def to Def2 conversion bonus. If the armor def/mdef exceeds max_def,
// the remaining is converted to vit def/int mdef using this multiplier
// (eg: if set to 10, every armor point above the max becomes 10 vit defense points)
over_def_bonus: 1

I've tried this one and it was working flawlessly on my server, all i did was exactly same; change the max_def to 500 from 99, change the over_def_bonus to 1 from 0 and change cotton shirt def from 1 to 200 (it's shown 100 + 28, i think this is happened because the calculation from my server, not sure tho but at least it's not minus and i can exceed max 99 def). Then in game, i reload the itemdb using `@reload itemdb` and also reload the conf using `@reload battleconf`.

It's not a good idea to directly change the formula, for example if you change the formula for def, you might need to change the def gained for refine from pre-re stats to renewal stats as well for example and so on, it would be like a domino effect. But if you are on pre-renewal server and wants to use the renewal system, why don't you just change your server to renewal?

screenValkyrie000.jpg

 

Edit:

After tested it a few times, i noticed that even if i change the max_def to any values greater than 99, it would always show 100 def at max even when im not using the over_def_bonus (over_def_bonus: 0). Not sure if recompile will do but im too tired waiting for my server to recompile, so i haven't try it.

Edited by Jesky
Link to comment
Share on other sites

  • 0

  • Group:  Members
  • Topic Count:  3
  • Topics Per Day:  0.00
  • Content Count:  9
  • Reputation:   0
  • Joined:  01/19/21
  • Last Seen:  

3 hours ago, Jesky said:

Hi again, sorry for late reply was working.

I've tried this one and it was working flawlessly on my server, all i did was exactly same; change the max_def to 500 from 99, change the over_def_bonus to 1 from 0 and change cotton shirt def from 1 to 200 (it's shown 100 + 28, i think this is happened because the calculation from my server, not sure tho but at least it's not minus and i can exceed max 99 def). Then in game, i reload the itemdb using `@reload itemdb` and also reload the conf using `@reload battleconf`.

It's not a good idea to directly change the formula, for example if you change the formula for def, you might need to change the def gained for refine from pre-re stats to renewal stats as well for example and so on, it would be like a domino effect. But if you are on pre-renewal server and wants to use the renewal system, why don't you just change your server to renewal?

Edit:

After tested it a few times, i noticed that even if i change the max_def to any values greater than 99, it would always show 100 def at max even when im not using the over_def_bonus (over_def_bonus: 0). Not sure if recompile will do but im too tired waiting for my server to recompile, so i haven't try it.

Thank you taking the time to try!!! <-- This alone is very helpful

The reason I dont change it to renewal is, I only want to take the item and change the def system..
other than that I don't really like the system, like the attack etc the way the stats affect the status and delay system etc.

I actually tried to change the pre-re formula to renewal formula but when I recompile an error comes out...

So your best suggestion is to change the equip manually...?

Link to comment
Share on other sites

  • 0

  • Group:  Members
  • Topic Count:  9
  • Topics Per Day:  0.00
  • Content Count:  51
  • Reputation:   3
  • Joined:  11/29/13
  • Last Seen:  

Hey, no problem, i've seen similiar issue like this and it's also happened to me before.

I'm on pre-renewal server as well but just want to take costumes from renewal database. I spent almost a week just to import, edit the item_db_equip and fix every item description. It took a lot of time and dedication, but believe me, just like i said before, it's more cleaner and easier to debug if there is any error because of the sprite, effect, script, etc for example.

Personally, i think this is the only way to do it right, so yes, my best suggestion is to change the equip manually one by one. I'm sorry that i can't help much but i hope you could solve it somehow, if you did, please share it here how. Goodluck!

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

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