|
@@ -657,7 +657,7 @@ static unsigned int calc_hash(const char* p)
|
|
|
return h % SCRIPT_HASH_SIZE;
|
|
|
}
|
|
|
|
|
|
-bool script_check_RegistryVariableLength(int pType, const char *val, size_t* vlen)
|
|
|
+bool script_check_RegistryVariableLength(int pType, const char *val, size_t* vlen)
|
|
|
{
|
|
|
size_t len = strlen(val);
|
|
|
|
|
@@ -2968,7 +2968,7 @@ unsigned int script_array_highest_key(struct script_state *st, map_session_data
|
|
|
return sa->size ? highest_key + 1 : 0;
|
|
|
}
|
|
|
}
|
|
|
-
|
|
|
+
|
|
|
return SCRIPT_CMD_SUCCESS;
|
|
|
}
|
|
|
|
|
@@ -3572,19 +3572,19 @@ void pop_stack(struct script_state* st, int start, int end)
|
|
|
}else if( st->start > start ){
|
|
|
st->start = start;
|
|
|
}
|
|
|
-
|
|
|
+
|
|
|
if( st->end > end ){
|
|
|
st->end -= end - start;
|
|
|
}else if( st->end > start ){
|
|
|
st->end = start;
|
|
|
}
|
|
|
-
|
|
|
+
|
|
|
if( stack->defsp > end ){
|
|
|
stack->defsp -= end - start;
|
|
|
}else if( stack->defsp > start ){
|
|
|
stack->defsp = start;
|
|
|
}
|
|
|
-
|
|
|
+
|
|
|
stack->sp -= end - start;
|
|
|
}
|
|
|
|
|
@@ -3642,7 +3642,7 @@ struct script_state* script_alloc_state(struct script_code* rootscript, int pos,
|
|
|
st->oid = oid;
|
|
|
st->sleep.timer = INVALID_TIMER;
|
|
|
st->npc_item_flag = battle_config.item_enabled_npc;
|
|
|
-
|
|
|
+
|
|
|
if( st->script->instances != USHRT_MAX )
|
|
|
st->script->instances++;
|
|
|
else {
|
|
@@ -6344,7 +6344,7 @@ BUILDIN_FUNC(cleararray)
|
|
|
set_reg_num( st, sd, reference_uid( id, start ), name, value, script_getref( st,2 ) );
|
|
|
}
|
|
|
}
|
|
|
-
|
|
|
+
|
|
|
return SCRIPT_CMD_SUCCESS;
|
|
|
}
|
|
|
|
|
@@ -6554,14 +6554,14 @@ BUILDIN_FUNC(deletearray)
|
|
|
list = script_array_cpy_list(sa);
|
|
|
size = sa->size;
|
|
|
qsort(list, size, sizeof(unsigned int), script_array_index_cmp);
|
|
|
-
|
|
|
+
|
|
|
ARR_FIND(0, size, i, list[i] >= start);
|
|
|
-
|
|
|
+
|
|
|
for( ; i < size && list[i] < start + count; i++ ) {
|
|
|
// Clear any entries between start and start+count, if they exist
|
|
|
clear_reg( st, sd, reference_uid( id, list[i] ), name, reference_getref( data ) );
|
|
|
}
|
|
|
-
|
|
|
+
|
|
|
for( ; i < size && list[i] < end; i++ ) {
|
|
|
// Move back count positions any entries between start+count to fill the gaps
|
|
|
if( is_string ){
|
|
@@ -6582,7 +6582,7 @@ BUILDIN_FUNC(deletearray)
|
|
|
unsigned int *list = NULL, size = 0;
|
|
|
list = script_array_cpy_list(sa);
|
|
|
size = sa->size;
|
|
|
-
|
|
|
+
|
|
|
for(i = 0; i < size; i++) {
|
|
|
if( list[i] >= start ) // Less expensive than sorting it, most likely
|
|
|
clear_reg( st, sd, reference_uid( id, list[i] ), name, reference_getref( data ) );
|
|
@@ -6692,7 +6692,7 @@ BUILDIN_FUNC(inarray)
|
|
|
if( temp == value ){
|
|
|
script_pushint( st, i );
|
|
|
return SCRIPT_CMD_SUCCESS;
|
|
|
- }
|
|
|
+ }
|
|
|
}
|
|
|
}
|
|
|
|
|
@@ -7010,7 +7010,7 @@ static bool script_getitem_randomoption(struct script_state *st, map_session_dat
|
|
|
opt_id_idx = reference_getindex(opt_id);
|
|
|
opt_val_idx = reference_getindex(opt_val);
|
|
|
opt_param_idx = reference_getindex(opt_param);
|
|
|
-
|
|
|
+
|
|
|
for (i = 0; i < opt_id_n && i < MAX_ITEM_RDM_OPT; i++) {
|
|
|
it->option[i].id = (short)get_val2_num( st, reference_uid( opt_id_id, opt_id_idx + i ), opt_id_ref );
|
|
|
it->option[i].value = (short)get_val2_num( st, reference_uid( opt_val_id, opt_val_idx + i ), opt_val_ref );
|
|
@@ -7456,7 +7456,7 @@ BUILDIN_FUNC(checkweight2)
|
|
|
int nb_it, nb_nb; //array size
|
|
|
|
|
|
TBL_PC *sd;
|
|
|
-
|
|
|
+
|
|
|
if (!script_rid2sd(sd))
|
|
|
return SCRIPT_CMD_FAILURE;
|
|
|
|
|
@@ -7683,7 +7683,7 @@ BUILDIN_FUNC(getitem2)
|
|
|
if (strcmpi(command,"getitem3") == 0) {
|
|
|
offset = 11;
|
|
|
aid_pos = 14;
|
|
|
- }
|
|
|
+ }
|
|
|
if (strcmpi(command,"getitem4") == 0) {
|
|
|
grade_offset = 11;
|
|
|
offset = 12;
|
|
@@ -7770,7 +7770,7 @@ BUILDIN_FUNC(getitem2)
|
|
|
}
|
|
|
|
|
|
int get_count = 0;
|
|
|
-
|
|
|
+
|
|
|
//Check if it's stackable.
|
|
|
if( !itemdb_isstackable2( item_data.get() ) ){
|
|
|
get_count = 1;
|
|
@@ -8148,7 +8148,7 @@ BUILDIN_FUNC(makeitem2) {
|
|
|
}
|
|
|
else
|
|
|
m = map_mapname2mapid(mapname);
|
|
|
-
|
|
|
+
|
|
|
struct item_data *id;
|
|
|
|
|
|
if ((id = itemdb_search(nameid))) {
|
|
@@ -8158,7 +8158,7 @@ BUILDIN_FUNC(makeitem2) {
|
|
|
|
|
|
char iden = (char)script_getnum(st,7);
|
|
|
char ref = (char)script_getnum(st,8);
|
|
|
- char attr = (char)script_getnum(st,9);
|
|
|
+ char attr = (char)script_getnum(st,9);
|
|
|
|
|
|
if (id->type==IT_WEAPON || id->type==IT_ARMOR || id->type==IT_SHADOWGEAR) {
|
|
|
if(ref > MAX_REFINE)
|
|
@@ -8615,7 +8615,7 @@ BUILDIN_FUNC(delitem2)
|
|
|
}
|
|
|
it.enchantgrade = static_cast<e_enchantgrade>(grade);
|
|
|
}
|
|
|
-
|
|
|
+
|
|
|
bool res = script_getitem_randomoption(st, sd, &it, command, offset);
|
|
|
if (!res)
|
|
|
return SCRIPT_CMD_FAILURE;
|
|
@@ -8714,7 +8714,7 @@ BUILDIN_FUNC(readparam)
|
|
|
}else{
|
|
|
script_rid2sd(sd);
|
|
|
}
|
|
|
-
|
|
|
+
|
|
|
if( !sd ){
|
|
|
return SCRIPT_CMD_FAILURE;
|
|
|
}
|
|
@@ -8944,7 +8944,7 @@ BUILDIN_FUNC(getguildname)
|
|
|
guild_id = script_getnum(st,2);
|
|
|
if( ( g = guild_search(guild_id) ) != NULL )
|
|
|
script_pushstrcopy(st,g->name);
|
|
|
- else
|
|
|
+ else
|
|
|
script_pushconststr(st,"null");
|
|
|
return SCRIPT_CMD_SUCCESS;
|
|
|
}
|
|
@@ -8961,7 +8961,7 @@ BUILDIN_FUNC(getguildmaster)
|
|
|
guild_id = script_getnum(st,2);
|
|
|
if( ( g = guild_search(guild_id) ) != NULL )
|
|
|
script_pushstrcopy(st,g->member[0].name);
|
|
|
- else
|
|
|
+ else
|
|
|
script_pushconststr(st,"null");
|
|
|
return SCRIPT_CMD_SUCCESS;
|
|
|
}
|
|
@@ -10269,7 +10269,7 @@ BUILDIN_FUNC(end)
|
|
|
if (sd){
|
|
|
if (sd->state.callshop == 0)
|
|
|
clif_scriptclose(sd, st->oid); // If a menu/select/prompt is active, close it.
|
|
|
- else
|
|
|
+ else
|
|
|
sd->state.callshop = 0;
|
|
|
}
|
|
|
|
|
@@ -10777,13 +10777,13 @@ BUILDIN_FUNC(guild_has_permission){
|
|
|
}
|
|
|
|
|
|
int position = guild_getposition(sd);
|
|
|
-
|
|
|
+
|
|
|
if( position < 0 || ( sd->guild->position[position].mode&permission ) != permission ){
|
|
|
script_pushint( st, false );
|
|
|
|
|
|
return SCRIPT_CMD_SUCCESS;
|
|
|
}
|
|
|
-
|
|
|
+
|
|
|
script_pushint( st, true );
|
|
|
|
|
|
return SCRIPT_CMD_SUCCESS;
|
|
@@ -10910,7 +10910,7 @@ BUILDIN_FUNC(getexp){
|
|
|
ShowError( "buildin_getexp: Called with negative base exp.\n" );
|
|
|
return SCRIPT_CMD_FAILURE;
|
|
|
}
|
|
|
-
|
|
|
+
|
|
|
int64 job = script_getnum64( st, 3 );
|
|
|
|
|
|
if( job < 0 ){
|
|
@@ -11365,9 +11365,8 @@ BUILDIN_FUNC(donpcevent)
|
|
|
if( !npc_event_do(event) ) {
|
|
|
struct npc_data * nd = map_id2nd(st->oid);
|
|
|
ShowDebug("NPCEvent '%s' not found! (source: %s)\n",event,nd?nd->name:"Unknown");
|
|
|
- script_pushint(st, 0);
|
|
|
- } else
|
|
|
- script_pushint(st, 1);
|
|
|
+ return SCRIPT_CMD_FAILURE;
|
|
|
+ }
|
|
|
return SCRIPT_CMD_SUCCESS;
|
|
|
}
|
|
|
|
|
@@ -11382,12 +11381,10 @@ BUILDIN_FUNC(cmdothernpc) // Added by RoVeRT
|
|
|
safesnprintf(event,EVENT_NAME_LENGTH, "%s::%s%s",npc,script_config.oncommand_event_name,command);
|
|
|
check_event(st, event);
|
|
|
|
|
|
- if( npc_event_do(event) ){
|
|
|
- script_pushint(st, true);
|
|
|
- }else{
|
|
|
+ if( !npc_event_do(event) )
|
|
|
struct npc_data * nd = map_id2nd(st->oid);
|
|
|
ShowDebug("NPCEvent '%s' not found! (source: %s)\n", event, nd ? nd->name : "Unknown");
|
|
|
- script_pushint(st, false);
|
|
|
+ return SCRIPT_CMD_FAILURE;
|
|
|
}
|
|
|
|
|
|
return SCRIPT_CMD_SUCCESS;
|
|
@@ -11719,7 +11716,7 @@ BUILDIN_FUNC(announce)
|
|
|
else
|
|
|
bl = nullptr;
|
|
|
}
|
|
|
-
|
|
|
+
|
|
|
if (bl == nullptr)
|
|
|
return SCRIPT_CMD_FAILURE;
|
|
|
|
|
@@ -12840,7 +12837,7 @@ BUILDIN_FUNC(waitingroomkick)
|
|
|
struct npc_data* nd;
|
|
|
struct chat_data* cd;
|
|
|
const char* kickusername;
|
|
|
-
|
|
|
+
|
|
|
nd = npc_name2id(script_getstr(st,2));
|
|
|
kickusername = script_getstr(st,3);
|
|
|
|
|
@@ -12864,7 +12861,7 @@ BUILDIN_FUNC(getwaitingroomusers)
|
|
|
nd = npc_name2id(script_getstr(st, 2));
|
|
|
else
|
|
|
nd = (struct npc_data *)map_id2bl(st->oid);
|
|
|
-
|
|
|
+
|
|
|
if( nd != NULL && (cd=(struct chat_data *)map_id2bl(nd->chat_id)) != NULL ) {
|
|
|
for(i = 0; i < cd->users; ++i) {
|
|
|
setd_sub_num( st, NULL, ".@waitingroom_users", j, cd->usersd[i]->status.account_id, NULL );
|
|
@@ -13514,7 +13511,7 @@ BUILDIN_FUNC(emotion)
|
|
|
|
|
|
if (!bl)
|
|
|
return SCRIPT_CMD_FAILURE;
|
|
|
-
|
|
|
+
|
|
|
clif_emotion(bl, type);
|
|
|
return SCRIPT_CMD_SUCCESS;
|
|
|
}
|
|
@@ -13879,7 +13876,7 @@ BUILDIN_FUNC(successremovecards) {
|
|
|
|
|
|
for (int j = sd->inventory_data[i]->slots; j < MAX_SLOTS; j++)
|
|
|
item_tmp.card[j]=sd->inventory.u.items_inventory[i].card[j];
|
|
|
-
|
|
|
+
|
|
|
for (int j = 0; j < MAX_ITEM_RDM_OPT; j++){
|
|
|
item_tmp.option[j].id=sd->inventory.u.items_inventory[i].option[j].id;
|
|
|
item_tmp.option[j].value=sd->inventory.u.items_inventory[i].option[j].value;
|
|
@@ -13965,7 +13962,7 @@ BUILDIN_FUNC(failedremovecards) {
|
|
|
|
|
|
for (int j = sd->inventory_data[i]->slots; j < MAX_SLOTS; j++)
|
|
|
item_tmp.card[j]=sd->inventory.u.items_inventory[i].card[j];
|
|
|
-
|
|
|
+
|
|
|
for (int j = 0; j < MAX_ITEM_RDM_OPT; j++){
|
|
|
item_tmp.option[j].id=sd->inventory.u.items_inventory[i].option[j].id;
|
|
|
item_tmp.option[j].value=sd->inventory.u.items_inventory[i].option[j].value;
|
|
@@ -14119,10 +14116,9 @@ BUILDIN_FUNC(divorce)
|
|
|
if (!script_charid2sd(2, sd))
|
|
|
return SCRIPT_CMD_FAILURE;
|
|
|
|
|
|
- if (!pc_divorce(sd)) {
|
|
|
+ if (!pc_divorce(sd))
|
|
|
return SCRIPT_CMD_FAILURE;
|
|
|
- }
|
|
|
- script_pushint(st,1);
|
|
|
+
|
|
|
return SCRIPT_CMD_SUCCESS;
|
|
|
}
|
|
|
|
|
@@ -14136,11 +14132,10 @@ BUILDIN_FUNC(ispartneron)
|
|
|
if (!script_charid2sd(2, sd))
|
|
|
return SCRIPT_CMD_FAILURE;
|
|
|
|
|
|
- if (!pc_ismarried(sd) || map_charid2sd(sd->status.partner_id) == NULL) {
|
|
|
- return SCRIPT_CMD_FAILURE;
|
|
|
- }
|
|
|
-
|
|
|
- script_pushint(st,1);
|
|
|
+ if (!pc_ismarried(sd) || map_charid2sd(sd->status.partner_id) == NULL)
|
|
|
+ script_pushint(st,0);
|
|
|
+ else
|
|
|
+ script_pushint(st,1);
|
|
|
return SCRIPT_CMD_SUCCESS;
|
|
|
}
|
|
|
|
|
@@ -15219,10 +15214,10 @@ BUILDIN_FUNC(skilleffect)
|
|
|
{
|
|
|
TBL_PC *sd;
|
|
|
uint16 skill_id, skill_lv;
|
|
|
-
|
|
|
+
|
|
|
if (!script_rid2sd(sd))
|
|
|
return SCRIPT_CMD_FAILURE;
|
|
|
-
|
|
|
+
|
|
|
skill_id = ( script_isstring(st, 2) ? skill_name2id(script_getstr(st,2)) : script_getnum(st,2) );
|
|
|
skill_lv = script_getnum(st,3);
|
|
|
|
|
@@ -15466,7 +15461,7 @@ BUILDIN_FUNC(atcommand) {
|
|
|
|
|
|
/** Displays a message for the player only (like system messages like "you got an apple" )
|
|
|
* dispbottom("<message>"{,<color>{,<char_id>}})
|
|
|
-* @param message
|
|
|
+* @param message
|
|
|
* @param color Hex color default (Green)
|
|
|
*/
|
|
|
BUILDIN_FUNC(dispbottom)
|
|
@@ -15622,7 +15617,6 @@ BUILDIN_FUNC(recovery)
|
|
|
ShowWarning("script: buildin_recovery: Invalid type %d\n", type);
|
|
|
return SCRIPT_CMD_FAILURE;
|
|
|
}
|
|
|
- script_pushint(st,1); //Successfully executed without errors
|
|
|
return SCRIPT_CMD_SUCCESS;
|
|
|
}
|
|
|
|
|
@@ -16905,7 +16899,7 @@ BUILDIN_FUNC(implode)
|
|
|
script_reportdata(data);
|
|
|
return SCRIPT_CMD_FAILURE;// data type mismatch
|
|
|
}
|
|
|
-
|
|
|
+
|
|
|
map_session_data* sd = nullptr;
|
|
|
|
|
|
if( not_server_variable(*name) && !script_rid2sd(sd) ) {
|
|
@@ -18166,12 +18160,12 @@ BUILDIN_FUNC(getrandmobid)
|
|
|
int lv;
|
|
|
if ( script_hasdata(st, 4) ) {
|
|
|
lv = script_getnum(st, 4);
|
|
|
-
|
|
|
+
|
|
|
if (lv <= 0) {
|
|
|
ShowWarning("buildin_getrandmobid: Invalid level %d.\n", lv);
|
|
|
return SCRIPT_CMD_FAILURE;
|
|
|
}
|
|
|
-
|
|
|
+
|
|
|
// If a level is provided, make sure it is respected
|
|
|
flag |= RMF_CHECK_MOB_LV;
|
|
|
} else {
|
|
@@ -19514,7 +19508,7 @@ BUILDIN_FUNC(unitwalk)
|
|
|
struct unit_data *ud = NULL;
|
|
|
const char *cmd = script_getfuncname(st), *done_label = "";
|
|
|
uint8 off = 5;
|
|
|
-
|
|
|
+
|
|
|
if (!script_rid2bl(2, bl))
|
|
|
return SCRIPT_CMD_FAILURE;
|
|
|
|
|
@@ -19884,7 +19878,7 @@ BUILDIN_FUNC(sleep)
|
|
|
st->state = RERUNLINE;
|
|
|
st->sleep.tick = ticks;
|
|
|
// Second call(by timer after sleeping time is over)
|
|
|
- } else {
|
|
|
+ } else {
|
|
|
// Continue the script
|
|
|
st->state = RUN;
|
|
|
st->sleep.tick = 0;
|
|
@@ -19914,12 +19908,12 @@ BUILDIN_FUNC(sleep2)
|
|
|
ShowError( "buildin_sleep2: no unit is attached\n" );
|
|
|
return SCRIPT_CMD_FAILURE;
|
|
|
}
|
|
|
-
|
|
|
+
|
|
|
// sleep for the target amount of time
|
|
|
st->state = RERUNLINE;
|
|
|
st->sleep.tick = ticks;
|
|
|
// Second call(by timer after sleeping time is over)
|
|
|
- } else {
|
|
|
+ } else {
|
|
|
// Check if the unit is still attached
|
|
|
// NOTE: This should never happen, since run_script_timer already checks this
|
|
|
if (map_id2bl(st->rid) == NULL) {
|
|
@@ -20268,7 +20262,7 @@ BUILDIN_FUNC(mercenary_delete)
|
|
|
return SCRIPT_CMD_FAILURE;
|
|
|
}
|
|
|
}
|
|
|
-
|
|
|
+
|
|
|
mercenary_delete(sd->md, type);
|
|
|
|
|
|
return SCRIPT_CMD_SUCCESS;
|
|
@@ -20556,7 +20550,7 @@ BUILDIN_FUNC(questinfo_refresh)
|
|
|
if (!script_charid2sd(2, sd))
|
|
|
return SCRIPT_CMD_FAILURE;
|
|
|
|
|
|
- pc_show_questinfo(sd);
|
|
|
+ pc_show_questinfo(sd);
|
|
|
return SCRIPT_CMD_SUCCESS;
|
|
|
}
|
|
|
|
|
@@ -20579,7 +20573,7 @@ BUILDIN_FUNC(setquest)
|
|
|
}
|
|
|
|
|
|
//20120410 or 20090218 ? no reason that shouldn't work for 2009
|
|
|
- pc_show_questinfo(sd);
|
|
|
+ pc_show_questinfo(sd);
|
|
|
return SCRIPT_CMD_SUCCESS;
|
|
|
}
|
|
|
|
|
@@ -20597,7 +20591,7 @@ BUILDIN_FUNC(erasequest)
|
|
|
script_reportsrc(st);
|
|
|
script_reportfunc(st);
|
|
|
}
|
|
|
- pc_show_questinfo(sd);
|
|
|
+ pc_show_questinfo(sd);
|
|
|
|
|
|
return SCRIPT_CMD_SUCCESS;
|
|
|
}
|
|
@@ -20624,7 +20618,7 @@ BUILDIN_FUNC(completequest)
|
|
|
BUILDIN_FUNC(changequest)
|
|
|
{
|
|
|
map_session_data *sd;
|
|
|
-
|
|
|
+
|
|
|
if (!script_charid2sd(4, sd))
|
|
|
return SCRIPT_CMD_FAILURE;
|
|
|
|
|
@@ -20859,7 +20853,7 @@ BUILDIN_FUNC(bg_create) {
|
|
|
return SCRIPT_CMD_SUCCESS;
|
|
|
}
|
|
|
|
|
|
-/// Adds attached player or <char id> (if specified) to an existing
|
|
|
+/// Adds attached player or <char id> (if specified) to an existing
|
|
|
/// battleground group and warps it to the specified coordinates on
|
|
|
/// the given map.
|
|
|
/// bg_join(<battle group>,{"<map name>",<x>,<y>{,<char id>}});
|
|
@@ -21737,7 +21731,7 @@ BUILDIN_FUNC(instance_info)
|
|
|
ShowError( "buildin_instance_info: Type IIT_MAP requires a numeric index argument.\n" );
|
|
|
return SCRIPT_CMD_FAILURE;
|
|
|
}
|
|
|
-
|
|
|
+
|
|
|
index = script_getnum(st, 4);
|
|
|
|
|
|
if( index < 0 ){
|
|
@@ -22207,7 +22201,7 @@ BUILDIN_FUNC(showdigit)
|
|
|
**/
|
|
|
BUILDIN_FUNC(makerune) {
|
|
|
TBL_PC* sd;
|
|
|
-
|
|
|
+
|
|
|
if (!script_charid2sd(3, sd))
|
|
|
return SCRIPT_CMD_FAILURE;
|
|
|
|
|
@@ -22220,7 +22214,7 @@ BUILDIN_FUNC(makerune) {
|
|
|
**/
|
|
|
BUILDIN_FUNC(checkdragon) {
|
|
|
TBL_PC* sd;
|
|
|
-
|
|
|
+
|
|
|
if (!script_charid2sd(2, sd))
|
|
|
return SCRIPT_CMD_FAILURE;
|
|
|
|
|
@@ -22276,7 +22270,7 @@ BUILDIN_FUNC(setdragon) {
|
|
|
**/
|
|
|
BUILDIN_FUNC(ismounting) {
|
|
|
TBL_PC* sd;
|
|
|
-
|
|
|
+
|
|
|
if (!script_charid2sd(2, sd))
|
|
|
return SCRIPT_CMD_FAILURE;
|
|
|
|
|
@@ -22295,7 +22289,7 @@ BUILDIN_FUNC(ismounting) {
|
|
|
**/
|
|
|
BUILDIN_FUNC(setmounting) {
|
|
|
TBL_PC* sd;
|
|
|
-
|
|
|
+
|
|
|
if (!script_charid2sd(2, sd))
|
|
|
return SCRIPT_CMD_FAILURE;
|
|
|
|
|
@@ -22637,10 +22631,10 @@ BUILDIN_FUNC(getrandgroupitem) {
|
|
|
BUILDIN_FUNC(getgroupitem) {
|
|
|
TBL_PC *sd;
|
|
|
int group_id = script_getnum(st,2);
|
|
|
-
|
|
|
+
|
|
|
if (!script_charid2sd(4, sd))
|
|
|
return SCRIPT_CMD_FAILURE;
|
|
|
-
|
|
|
+
|
|
|
if (itemdb_group.pc_get_itemgroup(group_id, (script_hasdata(st, 3) ? script_getnum(st, 3) != 0 : false), sd)) {
|
|
|
ShowError("buildin_getgroupitem: Invalid group id '%d' specified.\n",group_id);
|
|
|
return SCRIPT_CMD_FAILURE;
|
|
@@ -22700,7 +22694,7 @@ BUILDIN_FUNC(npcskill)
|
|
|
|
|
|
if (!script_rid2sd(sd))
|
|
|
return SCRIPT_CMD_FAILURE;
|
|
|
-
|
|
|
+
|
|
|
if (script_isstring(st, 2)) {
|
|
|
const char *name = script_getstr(st, 2);
|
|
|
|
|
@@ -23122,7 +23116,7 @@ BUILDIN_FUNC(vip_time) {
|
|
|
if (!script_nick2sd(3, sd))
|
|
|
return SCRIPT_CMD_FAILURE;
|
|
|
|
|
|
- chrif_req_login_operation(sd->status.account_id, sd->status.name, CHRIF_OP_LOGIN_VIP, viptime, 7, 0);
|
|
|
+ chrif_req_login_operation(sd->status.account_id, sd->status.name, CHRIF_OP_LOGIN_VIP, viptime, 7, 0);
|
|
|
#endif
|
|
|
return SCRIPT_CMD_SUCCESS;
|
|
|
}
|
|
@@ -23238,7 +23232,7 @@ BUILDIN_FUNC(bonus_script) {
|
|
|
|
|
|
if (!script_charid2sd(7, sd))
|
|
|
return SCRIPT_CMD_FAILURE;
|
|
|
-
|
|
|
+
|
|
|
script_str = script_getstr(st,2);
|
|
|
dur = 1000 * abs(script_getnum(st,3));
|
|
|
FETCH(4, flag);
|
|
@@ -23429,7 +23423,7 @@ BUILDIN_FUNC(addspiritball) {
|
|
|
BUILDIN_FUNC(delspiritball) {
|
|
|
uint8 count;
|
|
|
map_session_data *sd = NULL;
|
|
|
-
|
|
|
+
|
|
|
if (script_hasdata(st,3)) {
|
|
|
if (!script_isstring(st,3))
|
|
|
sd = map_charid2sd(script_getnum(st,3));
|
|
@@ -23591,7 +23585,7 @@ BUILDIN_FUNC(npcshopupdate) {
|
|
|
if( !nd || ( nd->subtype != NPCTYPE_SHOP && nd->subtype != NPCTYPE_CASHSHOP && nd->subtype != NPCTYPE_ITEMSHOP && nd->subtype != NPCTYPE_POINTSHOP && nd->subtype != NPCTYPE_MARKETSHOP ) ) { // Not found.
|
|
|
return SCRIPT_CMD_FAILURE;
|
|
|
}
|
|
|
-
|
|
|
+
|
|
|
if (!nd->u.shop.count) {
|
|
|
ShowError("buildin_npcshopupdate: Attempt to update empty shop from '%s'.\n", nd->exname);
|
|
|
return SCRIPT_CMD_FAILURE;
|
|
@@ -23924,10 +23918,10 @@ BUILDIN_FUNC(minmax){
|
|
|
int64 value;
|
|
|
// Function pointer for our comparison function (either min or max at the moment)
|
|
|
int64 (*func)(int64, int64);
|
|
|
-
|
|
|
+
|
|
|
// Get the real function name
|
|
|
functionname = script_getfuncname(st);
|
|
|
-
|
|
|
+
|
|
|
// Our data should start at offset 2
|
|
|
i = 2;
|
|
|
|
|
@@ -23950,7 +23944,7 @@ BUILDIN_FUNC(minmax){
|
|
|
// As long as we have data on our script stack
|
|
|
while( script_hasdata(st,i) ){
|
|
|
struct script_data *data;
|
|
|
-
|
|
|
+
|
|
|
// Get the next piece of data from the script stack
|
|
|
data = script_getdata( st, i );
|
|
|
|
|
@@ -23995,7 +23989,7 @@ BUILDIN_FUNC(minmax){
|
|
|
// Skip empty arrays
|
|
|
if( start < end ){
|
|
|
int id;
|
|
|
-
|
|
|
+
|
|
|
// For getting the values we need the id of the array
|
|
|
id = reference_getid( data );
|
|
|
|
|
@@ -24841,7 +24835,7 @@ BUILDIN_FUNC(channel_kick) {
|
|
|
case CHAN_TYPE_MAP: res = channel_pcquit(tsd,4); break;
|
|
|
default: res = channel_clean(ch,tsd,0); break;
|
|
|
}
|
|
|
-
|
|
|
+
|
|
|
if (res == 0) {
|
|
|
char output[CHAT_SIZE_MAX+1];
|
|
|
safesnprintf(output, CHAT_SIZE_MAX, msg_txt(tsd,889), ch->alias, tsd->status.name); // "%s %s is kicked"
|
|
@@ -25124,7 +25118,7 @@ BUILDIN_FUNC(achievementcomplete) {
|
|
|
ShowWarning("buildin_achievementcomplete: Achievement '%d' doesn't exist.\n", achievement_id);
|
|
|
return SCRIPT_CMD_FAILURE;
|
|
|
}
|
|
|
-
|
|
|
+
|
|
|
if( !sd->state.pc_loaded ){
|
|
|
// Simply ignore it on the first call, because the status will be recalculated after loading anyway
|
|
|
return SCRIPT_CMD_SUCCESS;
|
|
@@ -25563,7 +25557,7 @@ BUILDIN_FUNC(mail){
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
-
|
|
|
+
|
|
|
// Random Options
|
|
|
if( !script_hasdata(st,11 + MAX_SLOTS) ){
|
|
|
break;
|
|
@@ -25990,7 +25984,7 @@ BUILDIN_FUNC(naviregisterwarp) {
|
|
|
link.hidden = nd->navi.hidden;
|
|
|
|
|
|
nd->links.push_back(link);
|
|
|
-
|
|
|
+
|
|
|
#endif
|
|
|
return SCRIPT_CMD_SUCCESS;
|
|
|
}
|
|
@@ -26511,7 +26505,7 @@ BUILDIN_FUNC(itemlink)
|
|
|
struct item item = {};
|
|
|
|
|
|
item.nameid = script_getnum(st, 2);
|
|
|
-
|
|
|
+
|
|
|
if( !item_db.exists( item.nameid ) ){
|
|
|
ShowError( "buildin_itemlink: Item ID %u does not exists.\n", item.nameid );
|
|
|
return SCRIPT_CMD_FAILURE;
|
|
@@ -26538,7 +26532,7 @@ BUILDIN_FUNC(itemlink)
|
|
|
BUILDIN_FUNC(mesitemlink){
|
|
|
t_itemid nameid = script_getnum( st, 2 );
|
|
|
std::shared_ptr<item_data> data = item_db.find( nameid );
|
|
|
-
|
|
|
+
|
|
|
if( data == nullptr ){
|
|
|
ShowError( "buildin_mesitemlink: Item ID %u does not exists.\n", nameid );
|
|
|
return SCRIPT_CMD_FAILURE;
|
|
@@ -26573,7 +26567,7 @@ BUILDIN_FUNC(addfame) {
|
|
|
|
|
|
if (!pc_addfame(*sd, script_getnum(st, 2)))
|
|
|
return SCRIPT_CMD_FAILURE;
|
|
|
-
|
|
|
+
|
|
|
return SCRIPT_CMD_SUCCESS;
|
|
|
}
|
|
|
|