Merge of Rytech's 4CrAM (#6414)

Merged Rytech2/4CrAM-Open@978d4fc406

Original author is @Rytech2 and all credits belong to him.
Cleanups by @Lemongrass3110, @aleos89 and @Atemo.

Co-authored-by: Rytech2 <rytech16@gmail.com>
Co-authored-by: aleos <aleos89@users.noreply.github.com>
Co-authored-by: Atemo <capucrath@gmail.com>
This commit is contained in:
Lemongrass3110
2021-12-30 20:25:19 +01:00
committed by GitHub
parent 5105a03aec
commit 7556453dfc
78 changed files with 19190 additions and 559 deletions

View File

@@ -9583,6 +9583,50 @@ BUILDIN_FUNC(statusup2)
return SCRIPT_CMD_SUCCESS;
}
/**
* traitstatusup <stat>{,<char_id>};
**/
BUILDIN_FUNC(traitstatusup)
{
struct map_session_data *sd;
if (!script_charid2sd(3, sd))
return SCRIPT_CMD_FAILURE;
int type = script_getnum( st, 2 );
if( type < SP_POW || type > SP_CRT ){
ShowError( "buildin_traitstatusup: Unknown trait type %d\n", type );
return SCRIPT_CMD_FAILURE;
}
pc_traitstatusup( sd, type, 1 );
return SCRIPT_CMD_SUCCESS;
}
/**
* traitstatusup2 <stat>,<amount>{,<char_id>};
**/
BUILDIN_FUNC(traitstatusup2)
{
struct map_session_data *sd;
if (!script_charid2sd(4, sd))
return SCRIPT_CMD_FAILURE;
int type = script_getnum( st, 2 );
if( type < SP_POW || type > SP_CRT ){
ShowError( "buildin_traitstatusup2: Unknown trait type %d\n", type );
return SCRIPT_CMD_FAILURE;
}
pc_traitstatusup2( sd, type, script_getnum( st, 3 ) );
return SCRIPT_CMD_SUCCESS;
}
/// See 'doc/item_bonus.txt'
///
/// bonus <bonus type>,<val1>;
@@ -17842,6 +17886,8 @@ BUILDIN_FUNC(getmonsterinfo)
case MOB_ATK2: script_pushint(st,mob->status.rhw.atk2); break;
case MOB_DEF: script_pushint(st,mob->status.def); break;
case MOB_MDEF: script_pushint(st,mob->status.mdef); break;
case MOB_RES: script_pushint(st, mob->status.res); break;
case MOB_MRES: script_pushint(st, mob->status.mres); break;
case MOB_STR: script_pushint(st,mob->status.str); break;
case MOB_AGI: script_pushint(st,mob->status.agi); break;
case MOB_VIT: script_pushint(st,mob->status.vit); break;
@@ -18267,6 +18313,8 @@ BUILDIN_FUNC(getunitdata)
getunitdata_sub(UMOB_BODY2, md->vd->body_style);
getunitdata_sub(UMOB_GROUP_ID, md->ud.group_id);
getunitdata_sub(UMOB_IGNORE_CELL_STACK_LIMIT, md->ud.state.ignore_cell_stack_limit);
getunitdata_sub(UMOB_RES, md->status.res);
getunitdata_sub(UMOB_MRES, md->status.mres);
break;
case BL_HOM:
@@ -18672,6 +18720,8 @@ BUILDIN_FUNC(setunitdata)
case UMOB_BODY2: clif_changelook(bl, LOOK_BODY2, (unsigned short)value); break;
case UMOB_GROUP_ID: md->ud.group_id = value; unit_refresh(bl); break;
case UMOB_IGNORE_CELL_STACK_LIMIT: md->ud.state.ignore_cell_stack_limit = value > 0; break;
case UMOB_RES: md->base_status->res = (short)value; calc_status = true; break;
case UMOB_MRES: md->base_status->mres = (short)value; calc_status = true; break;
default:
ShowError("buildin_setunitdata: Unknown data identifier %d for BL_MOB.\n", type);
return SCRIPT_CMD_FAILURE;
@@ -23863,6 +23913,28 @@ BUILDIN_FUNC(needed_status_point) {
return SCRIPT_CMD_SUCCESS;
}
/// Returns the number of trait stat points needed to change the specified trait stat by val.
/// If val is negative, returns the number of trait stat points that would be needed to
/// raise the specified trait stat from (current value - val) to current value.
/// *needed_trait_point(<type>,<val>{,<char id>});
BUILDIN_FUNC(needed_trait_point) {
struct map_session_data *sd;
if (!script_charid2sd(4, sd))
return SCRIPT_CMD_FAILURE;
int type = script_getnum( st, 2 );
if( type < SP_POW || type > SP_CRT ){
ShowError( "buildin_needed_trait_point: Unknown trait type %d\n", type );
return SCRIPT_CMD_FAILURE;
}
script_pushint( st, pc_need_trait_point( sd, type, script_getnum( st, 3 ) ) );
return SCRIPT_CMD_SUCCESS;
}
/**
* jobcanentermap("<mapname>"{,<JobID>});
* Check if (player with) JobID can enter the map.
@@ -25664,6 +25736,8 @@ struct script_function buildin_func[] = {
BUILDIN_DEF(downrefitem,"i??"),
BUILDIN_DEF(statusup,"i?"),
BUILDIN_DEF(statusup2,"ii?"),
BUILDIN_DEF(traitstatusup,"i?"),
BUILDIN_DEF(traitstatusup2,"ii?"),
BUILDIN_DEF(bonus,"i?"),
BUILDIN_DEF2(bonus,"bonus2","ivi"),
BUILDIN_DEF2(bonus,"bonus3","ivii"),
@@ -26146,6 +26220,7 @@ struct script_function buildin_func[] = {
BUILDIN_DEF(getequiprandomoption, "iii?"),
BUILDIN_DEF(setrandomoption,"iiiii?"),
BUILDIN_DEF(needed_status_point,"ii?"),
BUILDIN_DEF(needed_trait_point, "ii?"),
BUILDIN_DEF(jobcanentermap,"s?"),
BUILDIN_DEF(openstorage2,"ii?"),
BUILDIN_DEF(unloadnpc, "s"),