Fixed int64 support for some exp commands (#5942)
Fixes #5941 Thanks to @Angelic234 and @aleos89
This commit is contained in:
parent
58f2d2173f
commit
7b39ee2f7e
@ -10489,26 +10489,39 @@ BUILDIN_FUNC(makepet)
|
||||
* Give player exp base,job * quest_exp_rate/100
|
||||
* getexp <base xp>,<job xp>{,<char_id>};
|
||||
**/
|
||||
BUILDIN_FUNC(getexp)
|
||||
{
|
||||
TBL_PC* sd;
|
||||
int base=0,job=0;
|
||||
double bonus;
|
||||
BUILDIN_FUNC(getexp){
|
||||
struct map_session_data* sd;
|
||||
|
||||
if (!script_charid2sd(4,sd))
|
||||
if( !script_charid2sd( 4, sd ) ){
|
||||
return SCRIPT_CMD_FAILURE;
|
||||
}
|
||||
|
||||
base=script_getnum(st,2);
|
||||
job =script_getnum(st,3);
|
||||
if(base<0 || job<0)
|
||||
return SCRIPT_CMD_SUCCESS;
|
||||
int64 base = script_getnum64( st, 2 );
|
||||
|
||||
if( base < 0 ){
|
||||
ShowError( "buildin_getexp: Called with negative base exp.\n" );
|
||||
return SCRIPT_CMD_FAILURE;
|
||||
}
|
||||
|
||||
int64 job = script_getnum64( st, 3 );
|
||||
|
||||
if( job < 0 ){
|
||||
ShowError( "buildin_getexp: Called with negative job exp.\n" );
|
||||
return SCRIPT_CMD_FAILURE;
|
||||
}
|
||||
|
||||
if( base == 0 && job == 0 ){
|
||||
ShowError( "buildin_getexp: Called with base and job exp 0.\n" );
|
||||
return SCRIPT_CMD_FAILURE;
|
||||
}
|
||||
|
||||
// bonus for npc-given exp
|
||||
bonus = battle_config.quest_exp_rate / 100.;
|
||||
double bonus = battle_config.quest_exp_rate / 100.;
|
||||
|
||||
if (base)
|
||||
base = (int) cap_value(base * bonus, 0, INT_MAX);
|
||||
base = (int64) cap_value(base * bonus, 0, MAX_EXP);
|
||||
if (job)
|
||||
job = (int) cap_value(job * bonus, 0, INT_MAX);
|
||||
job = (int64) cap_value(job * bonus, 0, MAX_EXP);
|
||||
|
||||
pc_gainexp(sd, NULL, base, job, 1);
|
||||
#ifdef RENEWAL
|
||||
@ -10522,19 +10535,26 @@ BUILDIN_FUNC(getexp)
|
||||
/*==========================================
|
||||
* Gain guild exp [Celest]
|
||||
*------------------------------------------*/
|
||||
BUILDIN_FUNC(guildgetexp)
|
||||
{
|
||||
TBL_PC* sd;
|
||||
int exp;
|
||||
BUILDIN_FUNC(guildgetexp){
|
||||
struct map_session_data* sd;
|
||||
|
||||
if( !script_rid2sd(sd) )
|
||||
return SCRIPT_CMD_SUCCESS;
|
||||
if( !script_rid2sd( sd ) ){
|
||||
return SCRIPT_CMD_FAILURE;
|
||||
}
|
||||
|
||||
exp = script_getnum(st,2);
|
||||
if(exp < 0)
|
||||
return SCRIPT_CMD_SUCCESS;
|
||||
if(sd && sd->status.guild_id > 0)
|
||||
guild_getexp (sd, exp);
|
||||
int64 exp = script_getnum64( st, 2 );
|
||||
|
||||
if( exp <= 0 ){
|
||||
ShowError( "buildin_guildgetexp: Called with exp <= 0.\n" );
|
||||
return SCRIPT_CMD_FAILURE;
|
||||
}
|
||||
|
||||
if( sd->status.guild_id <= 0 ){
|
||||
ShowError( "buildin_guildgetexp: Called for player %s (AID: %u, CID: %u) without a guild.\n", sd->status.name, sd->status.account_id, sd->status.char_id );
|
||||
return SCRIPT_CMD_FAILURE;
|
||||
}
|
||||
|
||||
guild_getexp( sd, exp );
|
||||
|
||||
return SCRIPT_CMD_SUCCESS;
|
||||
}
|
||||
@ -23296,14 +23316,16 @@ BUILDIN_FUNC(minmax){
|
||||
**/
|
||||
BUILDIN_FUNC(getexp2) {
|
||||
TBL_PC *sd = NULL;
|
||||
int base_exp = script_getnum(st, 2);
|
||||
int job_exp = script_getnum(st, 3);
|
||||
int64 base_exp = script_getnum64(st, 2);
|
||||
int64 job_exp = script_getnum64(st, 3);
|
||||
|
||||
if (!script_charid2sd(4, sd))
|
||||
return SCRIPT_CMD_FAILURE;
|
||||
|
||||
if (base_exp == 0 && job_exp == 0)
|
||||
return SCRIPT_CMD_SUCCESS;
|
||||
if( base_exp == 0 && job_exp == 0 ){
|
||||
ShowError( "buildin_getexp2: Called with base and job exp 0.\n" );
|
||||
return SCRIPT_CMD_FAILURE;
|
||||
}
|
||||
|
||||
if (base_exp > 0)
|
||||
pc_gainexp(sd, NULL, base_exp, 0, 2);
|
||||
|
@ -6520,7 +6520,6 @@ int skill_castend_nodamage_id (struct block_list *src, struct block_list *bl, ui
|
||||
case AB_HIGHNESSHEAL:
|
||||
{
|
||||
int heal = skill_calc_heal(src, bl, skill_id, skill_lv, true);
|
||||
int heal_get_jobexp;
|
||||
|
||||
if (status_isimmune(bl) || (dstmd && (status_get_class(bl) == MOBID_EMPERIUM || status_get_class_(bl) == CLASS_BATTLEFIELD)))
|
||||
heal = 0;
|
||||
@ -6544,7 +6543,7 @@ int skill_castend_nodamage_id (struct block_list *src, struct block_list *bl, ui
|
||||
clif_skill_nodamage (src, bl, skill_id, heal, 1);
|
||||
if( tsc && tsc->data[SC_AKAITSUKI] && heal && skill_id != HLIF_HEAL )
|
||||
heal = ~heal + 1;
|
||||
heal_get_jobexp = status_heal(bl,heal,0,0);
|
||||
t_exp heal_get_jobexp = status_heal(bl,heal,0,0);
|
||||
|
||||
if(sd && dstsd && heal > 0 && sd != dstsd && battle_config.heal_exp > 0){
|
||||
heal_get_jobexp = heal_get_jobexp * battle_config.heal_exp / 100;
|
||||
|
Loading…
x
Reference in New Issue
Block a user