|
@@ -767,11 +767,11 @@ void npc_timerevent_quit(struct map_session_data* sd)
|
|
char buf[EVENT_NAME_LENGTH];
|
|
char buf[EVENT_NAME_LENGTH];
|
|
struct event_data *ev;
|
|
struct event_data *ev;
|
|
|
|
|
|
- snprintf(buf, ARRAYLENGTH(buf), "%s::OnTimerQuit", nd->exname);
|
|
|
|
|
|
+ snprintf(buf, ARRAYLENGTH(buf), "%s::%s", nd->exname, script_config.timer_quit_event_name);
|
|
ev = (struct event_data*)strdb_get(ev_db, buf);
|
|
ev = (struct event_data*)strdb_get(ev_db, buf);
|
|
if( ev && ev->nd != nd )
|
|
if( ev && ev->nd != nd )
|
|
{
|
|
{
|
|
- ShowWarning("npc_timerevent_quit: Unable to execute \"OnTimerQuit\", two NPCs have the same event name [%s]!\n",buf);
|
|
|
|
|
|
+ ShowWarning("npc_timerevent_quit: Unable to execute \"%s\", two NPCs have the same event name [%s]!\n",script_config.timer_quit_event_name,buf);
|
|
ev = NULL;
|
|
ev = NULL;
|
|
}
|
|
}
|
|
if( ev )
|
|
if( ev )
|
|
@@ -1719,7 +1719,7 @@ static int npc_buylist_sub(struct map_session_data* sd, uint16 n, struct s_npc_b
|
|
}
|
|
}
|
|
|
|
|
|
// invoke event
|
|
// invoke event
|
|
- snprintf(npc_ev, ARRAYLENGTH(npc_ev), "%s::OnBuyItem", nd->exname);
|
|
|
|
|
|
+ snprintf(npc_ev, ARRAYLENGTH(npc_ev), "%s::%s", nd->exname, script_config.onbuy_event_name);
|
|
npc_event(sd, npc_ev, 0);
|
|
npc_event(sd, npc_ev, 0);
|
|
|
|
|
|
return 0;
|
|
return 0;
|
|
@@ -1883,6 +1883,7 @@ static int npc_selllist_sub(struct map_session_data* sd, int n, unsigned short*
|
|
{
|
|
{
|
|
char npc_ev[EVENT_NAME_LENGTH];
|
|
char npc_ev[EVENT_NAME_LENGTH];
|
|
char card_slot[NAME_LENGTH];
|
|
char card_slot[NAME_LENGTH];
|
|
|
|
+ char option_id[NAME_LENGTH], option_val[NAME_LENGTH], option_param[NAME_LENGTH];
|
|
int i, j;
|
|
int i, j;
|
|
int key_nameid = 0;
|
|
int key_nameid = 0;
|
|
int key_amount = 0;
|
|
int key_amount = 0;
|
|
@@ -1890,6 +1891,7 @@ static int npc_selllist_sub(struct map_session_data* sd, int n, unsigned short*
|
|
int key_attribute = 0;
|
|
int key_attribute = 0;
|
|
int key_identify = 0;
|
|
int key_identify = 0;
|
|
int key_card[MAX_SLOTS];
|
|
int key_card[MAX_SLOTS];
|
|
|
|
+ int key_option_id[MAX_ITEM_RDM_OPT], key_option_val[MAX_ITEM_RDM_OPT], key_option_param[MAX_ITEM_RDM_OPT];
|
|
|
|
|
|
// discard old contents
|
|
// discard old contents
|
|
script_cleararray_pc(sd, "@sold_nameid", (void*)0);
|
|
script_cleararray_pc(sd, "@sold_nameid", (void*)0);
|
|
@@ -1905,12 +1907,21 @@ static int npc_selllist_sub(struct map_session_data* sd, int n, unsigned short*
|
|
script_cleararray_pc(sd, card_slot, (void*)0);
|
|
script_cleararray_pc(sd, card_slot, (void*)0);
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+ for (j = 0; j < MAX_ITEM_RDM_OPT; j++) { // Clear each of the item option entries
|
|
|
|
+ key_option_id[j] = key_option_val[j] = key_option_param[j] = 0;
|
|
|
|
+
|
|
|
|
+ snprintf(option_id, sizeof(option_id), "@sold_option_id%d", j + 1);
|
|
|
|
+ script_cleararray_pc(sd, option_id, (void *)0);
|
|
|
|
+ snprintf(option_val, sizeof(option_val), "@sold_option_val%d", j + 1);
|
|
|
|
+ script_cleararray_pc(sd, option_val, (void *)0);
|
|
|
|
+ snprintf(option_param, sizeof(option_param), "@sold_option_param%d", j + 1);
|
|
|
|
+ script_cleararray_pc(sd, option_param, (void *)0);
|
|
|
|
+ }
|
|
|
|
+
|
|
// save list of to be sold items
|
|
// save list of to be sold items
|
|
for( i = 0; i < n; i++ )
|
|
for( i = 0; i < n; i++ )
|
|
{
|
|
{
|
|
- int idx;
|
|
|
|
-
|
|
|
|
- idx = item_list[i*2]-2;
|
|
|
|
|
|
+ int idx = item_list[i * 2] - 2;
|
|
|
|
|
|
script_setarray_pc(sd, "@sold_nameid", i, (void*)(intptr_t)sd->inventory.u.items_inventory[idx].nameid, &key_nameid);
|
|
script_setarray_pc(sd, "@sold_nameid", i, (void*)(intptr_t)sd->inventory.u.items_inventory[idx].nameid, &key_nameid);
|
|
script_setarray_pc(sd, "@sold_quantity", i, (void*)(intptr_t)item_list[i*2+1], &key_amount);
|
|
script_setarray_pc(sd, "@sold_quantity", i, (void*)(intptr_t)item_list[i*2+1], &key_amount);
|
|
@@ -1926,11 +1937,20 @@ static int npc_selllist_sub(struct map_session_data* sd, int n, unsigned short*
|
|
snprintf(card_slot, sizeof(card_slot), "@sold_card%d", j + 1);
|
|
snprintf(card_slot, sizeof(card_slot), "@sold_card%d", j + 1);
|
|
script_setarray_pc(sd, card_slot, i, (void*)(intptr_t)sd->inventory.u.items_inventory[idx].card[j], &key_card[j]);
|
|
script_setarray_pc(sd, card_slot, i, (void*)(intptr_t)sd->inventory.u.items_inventory[idx].card[j], &key_card[j]);
|
|
}
|
|
}
|
|
|
|
+
|
|
|
|
+ for (j = 0; j < MAX_ITEM_RDM_OPT; j++) { // Store each of the item options in the array
|
|
|
|
+ snprintf(option_id, sizeof(option_id), "@sold_option_id%d", j + 1);
|
|
|
|
+ script_setarray_pc(sd, option_id, i, (void*)(intptr_t)sd->inventory.u.items_inventory[idx].option[j].id, &key_option_id[j]);
|
|
|
|
+ snprintf(option_val, sizeof(option_val), "@sold_option_val%d", j + 1);
|
|
|
|
+ script_setarray_pc(sd, option_val, i, (void*)(intptr_t)sd->inventory.u.items_inventory[idx].option[j].value, &key_option_val[j]);
|
|
|
|
+ snprintf(option_param, sizeof(option_param), "@sold_option_param%d", j + 1);
|
|
|
|
+ script_setarray_pc(sd, option_param, i, (void*)(intptr_t)sd->inventory.u.items_inventory[idx].option[j].param, &key_option_param[j]);
|
|
|
|
+ }
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
// invoke event
|
|
// invoke event
|
|
- snprintf(npc_ev, ARRAYLENGTH(npc_ev), "%s::OnSellItem", nd->exname);
|
|
|
|
|
|
+ snprintf(npc_ev, ARRAYLENGTH(npc_ev), "%s::%s", nd->exname, script_config.onsell_event_name);
|
|
npc_event(sd, npc_ev, 0);
|
|
npc_event(sd, npc_ev, 0);
|
|
return 0;
|
|
return 0;
|
|
}
|
|
}
|
|
@@ -3065,7 +3085,7 @@ static const char* npc_parse_script(char* w1, char* w2, char* w3, char* w4, cons
|
|
char evname[EVENT_NAME_LENGTH];
|
|
char evname[EVENT_NAME_LENGTH];
|
|
struct event_data *ev;
|
|
struct event_data *ev;
|
|
|
|
|
|
- snprintf(evname, ARRAYLENGTH(evname), "%s::OnInit", nd->exname);
|
|
|
|
|
|
+ snprintf(evname, ARRAYLENGTH(evname), "%s::%s", nd->exname, script_config.init_event_name);
|
|
|
|
|
|
if( ( ev = (struct event_data*)strdb_get(ev_db, evname) ) ) {
|
|
if( ( ev = (struct event_data*)strdb_get(ev_db, evname) ) ) {
|
|
|
|
|