Jump to content
  • 0
Litro

[Request] Level Config For Damage, Skill & Status Calc (3Ceam Conf)

Question

Hello, Can some one help me ? i have modified my battle.c, skill,c and status,c it was heavily edited for it, but when i update it yesterday all my work in battle.c was crumbled, yes it was my stupidity by i still have the backup file, here i want to ask help for make it into plugin, i think it was good for private server, for more information i have gathered data from 3ceam

 

http://3ceam.googlecode.com/svn/trunk/rewrite/conf/battle/skill.conf

// Set this to the max base level that you would like skills to add extra bonus damage from. // [Pinky] // NOTE: Default level is 150, if you set this to a higher level then you will experience higher/overload damage from many 3rd class skills.// NOTE2: If you set this to a lower level then 100 all skills will suffer penalties higer than 100%, causing damages below the minimun damage.max_highlvl_nerf: 150// Set this to the max job level that you would like 3rd class skills to add extra bonus damage from. // [Pinky] // NOTE: Default 3rd class job_level is 50 (official servers), if you set this to a higher level depending on your server's 3rd classes max job level, then you might experience higher/overload damage/effects from 3rd class skills.// This setting only effects 3rd class skills that uses job level as a bonus multiplicator.// 0 = disabledmax_joblvl_nerf: 50

and this code i have used for my own, taken from 3ceam by @Rytech

	blvl_nerf = status->get_lv(src);	if( sd && ((skill_id >= RK_ENCHANTBLADE && skill_id <= LG_OVERBRAND_PLUSATK) || (skill_id >= RL_GLITTERING_GREED && skill_id <= OB_AKAITSUKI)) &&		battle_config.max_blvl_nerf && blvl_nerf > battle_config.max_blvl_nerf )		blvl_nerf = battle_config.max_blvl_nerf;	t_blvl_nerf = status->get_lv(target);	if( sd && ((skill_id >= RK_ENCHANTBLADE && skill_id <= LG_OVERBRAND_PLUSATK) || (skill_id >= RL_GLITTERING_GREED && skill_id <= OB_AKAITSUKI)) &&		battle_config.max_blvl_nerf && t_blvl_nerf > battle_config.max_blvl_nerf )		t_blvl_nerf = battle_config.max_blvl_nerf;	if( sd && ((skill_id >= RK_ENCHANTBLADE && skill_id <= LG_OVERBRAND_PLUSATK) || (skill_id >= RL_GLITTERING_GREED && skill_id <= OB_AKAITSUKI)) &&		battle_config.max_jlvl_nerf )		jlvl_nerf = min(sd->status.job_level,battle_config.max_jlvl_nerf);	else if( sd )		jlvl_nerf = sd->status.job_level;

Litro

Edited by Litro

Share this post


Link to post
Share on other sites

5 answers to this question

Recommended Posts

  • 0

honestly skill related src is not really my forte

but this one seems to be possible, just... a hunch

and I'm not really doing this

 

like the charms plugin trick

use pre-hook and post-hook on that function, and trick that function into thinking that player is actually lower level than usual

 

like

 

addhookpre battle->calc_weapon_attack ... _pre ...

addhookpost battle->calc_weapon_attack ... _post

 

then battle_calc_weapon_attack_pre

CREATE player_data

ssd->actual_level = sd->status.base_level;

sd->status.base_level = battle->bc->max_blvl_nerf;

 

trick that function into thinking that player has lower level

 

and battle_calc_weapon_attack_post

getfromMSD

sd->status.base_level = ssd->actual_level;

 

return the player level back to original

 

something like that

Share this post


Link to post
Share on other sites
  • 0

@@AnnieRuru mmh hi.. here what I came up* but it didn't work like what I want it, it seem I did wrong in part where you tell me to 'trick that function into thinking that player has lower level' or likely I didn't understand what you said above

 

and after you see the thing i wrote by copy paste-ing other firstly I want to go with what you tell me hooking into 'battle->calc_weapon_attack' but i can't see the example from any of your plugin or even dastgir, so i go with 'battle->calc_skillratio' because it have some same line from your plugins and it have much more the level thing that I want to nerf in skillratio

 

so... hoping you can tell me how to make it right

 

i tested it with RK_SONICWAVE it should be ( 100 + ( 175 - 100 ) / 2 ) but the thing is it failed to do it job  :(

case RK_SONICWAVE:
	skillratio = (skill_lv + 5) * 100;
	skillratio = skillratio * (100 + (status->get_lv(src)-100) / 2) / 100;
	break;

 

#include "common/hercules.h"
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include "map/battle.h"
#include "map/skill.h"
#include "map/pc.h"
#include "common/nullpo.h"
#include "common/memmgr.h"
#include "common/HPMDataCheck.h"

HPExport struct hplugin_info pinfo = {
	"levelnerf",
	SERVER_TYPE_MAP,
	"0.1",
	HPM_VERSION,
};

int max_blvl_nerf = 175;

struct player_data {
    int actual_level;
};

int battle_calc_skillratio_pre (int attack_type, struct block_list *src, struct block_list *target, uint16 skill_id, uint16 skill_lv, int skillratio, int flag) {
	struct map_session_data *sd;
	struct player_data *ssd;
	int s_level;
	
	nullpo_ret(src);
	sd = BL_CAST(BL_PC, src);
	s_level = sd->status.base_level;
	if( skill_id >= RK_ENCHANTBLADE && skill_id <= LG_OVERBRAND_PLUSATK && s_level > max_blvl_nerf ) {
		if ( !(ssd = getFromMSD(sd,0)) ) {
			CREATE( ssd, struct player_data, 1 );
			ssd->actual_level = sd->status.base_level;
			addToMSD( sd, ssd, 0, true );
		}
		sd->status.base_level = max_blvl_nerf;
	}
	return 0;
}

int battle_calc_skillratio_post (int retVal, int attack_type, struct block_list *src, struct block_list *target, uint16 skill_id, uint16 skill_lv, int skillratio, int flag) {
	struct map_session_data *sd;
	struct player_data *ssd;
	
	nullpo_ret(src);
	sd = BL_CAST(BL_PC, src);
	ssd = getFromMSD( sd, 0 );
	if ( ssd && ssd->actual_level )
		sd->status.base_level = ssd->actual_level;
	return retVal;
}

// battle config: all below copied from afk plugins (dastgir plugin's)
void max_blvl_nerf_adjust(const char *key, const char *val) {	//In Seconds
	int value = config_switch(val);
	if (strcmpi(key, "max_blvl_nerf") == 0) {
		if (value < 0 || value > battle->bc->max_lv){
			ShowDebug("Received Invalid Setting for max_blvl_nerf(%d), defaulting to 0\n",value);
			return;
		}
		max_blvl_nerf = value;
	}
	return;
	
}

int max_blvl_nerf_return(const char *key)
{
	if (strcmpi(key, "max_blvl_nerf") == 0)
		return max_blvl_nerf;
	return 0;
}

HPExport void plugin_init (void) {
	addHookPre( "battle->calc_skillratio", battle_calc_skillratio_pre );
	addHookPost( "battle->calc_skillratio", battle_calc_skillratio_post );
}

HPExport void server_preinit (void) {
	addBattleConf("max_blvl_nerf", max_blvl_nerf_adjust, max_blvl_nerf_return);
}

Edited by Litro

Share this post


Link to post
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.   Restore formatting

  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.

Loading...

×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.