|
@@ -3700,10 +3700,9 @@ void run_script(struct script_code *rootscript,int pos,int rid,int oid)
|
|
|
|
|
|
void script_stop_sleeptimers(int id)
|
|
|
{
|
|
|
- struct script_state* st;
|
|
|
for(;;)
|
|
|
{
|
|
|
- st = (struct script_state*)linkdb_erase(&sleep_db,(void*)__64BPRTSIZE(id));
|
|
|
+ struct script_state* st = (struct script_state*)linkdb_erase(&sleep_db,(void*)__64BPRTSIZE(id));
|
|
|
if( st == NULL )
|
|
|
break; // no more sleep timers
|
|
|
script_free_state(st);
|
|
@@ -4662,7 +4661,6 @@ BUILDIN_FUNC(menu)
|
|
|
if( sd->state.menu_or_input == 0 )
|
|
|
{
|
|
|
struct StringBuf buf;
|
|
|
- struct script_data* data;
|
|
|
|
|
|
if( script_lastdata(st) % 2 == 0 )
|
|
|
{// argument count is not even (1st argument is at index 2)
|
|
@@ -4675,6 +4673,7 @@ BUILDIN_FUNC(menu)
|
|
|
sd->npc_menu = 0;
|
|
|
for( i = 2; i < script_lastdata(st); i += 2 )
|
|
|
{
|
|
|
+ struct script_data* data;
|
|
|
// menu options
|
|
|
text = script_getstr(st, i);
|
|
|
|
|
@@ -5128,12 +5127,11 @@ BUILDIN_FUNC(rand)
|
|
|
{
|
|
|
int range;
|
|
|
int min;
|
|
|
- int max;
|
|
|
|
|
|
if( script_hasdata(st,3) )
|
|
|
{// min,max
|
|
|
+ int max = script_getnum(st,3);
|
|
|
min = script_getnum(st,2);
|
|
|
- max = script_getnum(st,3);
|
|
|
if( max < min )
|
|
|
swap(min, max);
|
|
|
range = max - min + 1;
|
|
@@ -6360,7 +6358,6 @@ int checkweight_sub(TBL_PC *sd, int nbargs, unsigned short *eitemid, int32 *eamo
|
|
|
BUILDIN_FUNC(checkweight)
|
|
|
{
|
|
|
struct map_session_data* sd;
|
|
|
- struct script_data* data;
|
|
|
struct item_data* id = NULL;
|
|
|
unsigned short nameid[SCRIPT_MAX_ARRAYSIZE];
|
|
|
int32 amount[SCRIPT_MAX_ARRAYSIZE];
|
|
@@ -6377,7 +6374,7 @@ BUILDIN_FUNC(checkweight)
|
|
|
}
|
|
|
|
|
|
for(i=2; i<nbargs; i=i+2) {
|
|
|
- data = script_getdata(st,i);
|
|
|
+ struct script_data* data = script_getdata(st,i);
|
|
|
get_val(st, data); // Convert into value in case of a variable
|
|
|
if( data_isstring(data) ) // item name
|
|
|
id = itemdb_searchname(conv_str(st, data));
|
|
@@ -6568,14 +6565,13 @@ BUILDIN_FUNC(getitem)
|
|
|
*------------------------------------------*/
|
|
|
BUILDIN_FUNC(getitem2)
|
|
|
{
|
|
|
- int amount, get_count, i;
|
|
|
+ int amount;
|
|
|
unsigned short nameid;
|
|
|
int iden, ref, attr;
|
|
|
unsigned short c1, c2, c3, c4;
|
|
|
char bound = BOUND_NONE;
|
|
|
struct item_data *item_data = NULL;
|
|
|
struct item item_tmp;
|
|
|
- unsigned char flag = 0;
|
|
|
TBL_PC *sd;
|
|
|
struct script_data *data;
|
|
|
const char* command = script_getfuncname(st);
|
|
@@ -6625,6 +6621,7 @@ BUILDIN_FUNC(getitem2)
|
|
|
c4 = (unsigned short)script_getnum(st,10);
|
|
|
|
|
|
if( item_data ) {
|
|
|
+ int get_count = 0, i;
|
|
|
memset(&item_tmp,0,sizeof(item_tmp));
|
|
|
if( item_data->type == IT_WEAPON || item_data->type == IT_ARMOR || item_data->type == IT_SHADOWGEAR ) {
|
|
|
if(ref > MAX_REFINE)
|
|
@@ -6660,6 +6657,7 @@ BUILDIN_FUNC(getitem2)
|
|
|
// if not pet egg
|
|
|
if (!pet_create_egg(sd, nameid))
|
|
|
{
|
|
|
+ unsigned char flag = 0;
|
|
|
if ((flag = pc_additem(sd, &item_tmp, get_count, LOG_TYPE_SCRIPT)))
|
|
|
{
|
|
|
clif_additem(sd, 0, 0, flag);
|
|
@@ -7079,7 +7077,7 @@ static void buildin_delitem_delete(struct map_session_data* sd, int idx, int* am
|
|
|
static bool buildin_delitem_search(struct map_session_data* sd, struct item* it, bool exact_match, uint8 loc)
|
|
|
{
|
|
|
bool delete_items = false;
|
|
|
- int i, amount, important, size;
|
|
|
+ int i, amount, size;
|
|
|
struct item *items;
|
|
|
|
|
|
// prefer always non-equipped items
|
|
@@ -7111,8 +7109,8 @@ static bool buildin_delitem_search(struct map_session_data* sd, struct item* it,
|
|
|
|
|
|
for(;;)
|
|
|
{
|
|
|
+ unsigned short important = 0;
|
|
|
amount = it->amount;
|
|
|
- important = 0;
|
|
|
|
|
|
// 1st pass -- less important items / exact match
|
|
|
for( i = 0; amount && i < size; i++ )
|
|
@@ -7532,25 +7530,29 @@ BUILDIN_FUNC(getpartyname)
|
|
|
BUILDIN_FUNC(getpartymember)
|
|
|
{
|
|
|
struct party_data *p;
|
|
|
- int i,j=0,type=0;
|
|
|
+ int type = 0;
|
|
|
+ unsigned char j = 0;
|
|
|
|
|
|
- p=party_search(script_getnum(st,2));
|
|
|
+ p = party_search(script_getnum(st,2));
|
|
|
|
|
|
- if( script_hasdata(st,3) )
|
|
|
- type=script_getnum(st,3);
|
|
|
+ if (p != NULL){
|
|
|
+ unsigned char i;
|
|
|
|
|
|
- if(p!=NULL){
|
|
|
- for(i=0;i<MAX_PARTY;i++){
|
|
|
- if(p->party.member[i].account_id){
|
|
|
+ if (script_hasdata(st,3))
|
|
|
+ type = script_getnum(st,3);
|
|
|
+
|
|
|
+ for (i = 0;i<MAX_PARTY;i++) {
|
|
|
+ if (p->party.member[i].account_id) {
|
|
|
switch (type) {
|
|
|
- case 2:
|
|
|
- mapreg_setreg(reference_uid(add_str("$@partymemberaid"), j),p->party.member[i].account_id);
|
|
|
- break;
|
|
|
- case 1:
|
|
|
- mapreg_setreg(reference_uid(add_str("$@partymembercid"), j),p->party.member[i].char_id);
|
|
|
- break;
|
|
|
- default:
|
|
|
- mapreg_setregstr(reference_uid(add_str("$@partymembername$"), j),p->party.member[i].name);
|
|
|
+ case 2:
|
|
|
+ mapreg_setreg(reference_uid(add_str("$@partymemberaid"), j),p->party.member[i].account_id);
|
|
|
+ break;
|
|
|
+ case 1:
|
|
|
+ mapreg_setreg(reference_uid(add_str("$@partymembercid"), j),p->party.member[i].char_id);
|
|
|
+ break;
|
|
|
+ default:
|
|
|
+ mapreg_setregstr(reference_uid(add_str("$@partymembername$"), j),p->party.member[i].name);
|
|
|
+ break;
|
|
|
}
|
|
|
j++;
|
|
|
}
|
|
@@ -8038,9 +8040,9 @@ BUILDIN_FUNC(getequippercentrefinery)
|
|
|
return 0;
|
|
|
|
|
|
if (num > 0 && num <= ARRAYLENGTH(equip))
|
|
|
- i=pc_checkequip(sd,equip[num-1]);
|
|
|
+ i = pc_checkequip(sd,equip[num-1]);
|
|
|
if(i >= 0 && sd->status.inventory[i].nameid && sd->status.inventory[i].refine < MAX_REFINE)
|
|
|
- script_pushint(st,status_get_refine_chance(itemdb_wlv(sd->status.inventory[i].nameid), (int)sd->status.inventory[i].refine));
|
|
|
+ script_pushint(st,status_get_refine_chance((enum refine_type)itemdb_wlv(sd->status.inventory[i].nameid), (int)sd->status.inventory[i].refine));
|
|
|
else
|
|
|
script_pushint(st,0);
|
|
|
|
|
@@ -8052,7 +8054,7 @@ BUILDIN_FUNC(getequippercentrefinery)
|
|
|
*------------------------------------------*/
|
|
|
BUILDIN_FUNC(successrefitem)
|
|
|
{
|
|
|
- int i = -1, num, ep, up = 1;
|
|
|
+ int i = -1, num, up = 1;
|
|
|
TBL_PC *sd;
|
|
|
|
|
|
num = script_getnum(st,2);
|
|
@@ -8064,9 +8066,9 @@ BUILDIN_FUNC(successrefitem)
|
|
|
up = script_getnum(st, 3);
|
|
|
|
|
|
if (num > 0 && num <= ARRAYLENGTH(equip))
|
|
|
- i=pc_checkequip(sd,equip[num-1]);
|
|
|
+ i = pc_checkequip(sd,equip[num-1]);
|
|
|
if(i >= 0) {
|
|
|
- ep=sd->status.inventory[i].equip;
|
|
|
+ unsigned int ep = sd->status.inventory[i].equip;
|
|
|
|
|
|
//Logs items, got from (N)PC scripts [Lupus]
|
|
|
log_pick_pc(sd, LOG_TYPE_SCRIPT, -1, &sd->status.inventory[i]);
|
|
@@ -8141,7 +8143,7 @@ BUILDIN_FUNC(failedrefitem)
|
|
|
*------------------------------------------*/
|
|
|
BUILDIN_FUNC(downrefitem)
|
|
|
{
|
|
|
- int i = -1, num, ep, down = 1;
|
|
|
+ int i = -1, num, down = 1;
|
|
|
TBL_PC *sd;
|
|
|
|
|
|
sd = script_rid2sd(st);
|
|
@@ -8154,7 +8156,7 @@ BUILDIN_FUNC(downrefitem)
|
|
|
if (num > 0 && num <= ARRAYLENGTH(equip))
|
|
|
i = pc_checkequip(sd,equip[num-1]);
|
|
|
if(i >= 0) {
|
|
|
- ep = sd->status.inventory[i].equip;
|
|
|
+ unsigned int ep = sd->status.inventory[i].equip;
|
|
|
|
|
|
//Logs items, got from (N)PC scripts [Lupus]
|
|
|
log_pick_pc(sd, LOG_TYPE_SCRIPT, -1, &sd->status.inventory[i]);
|
|
@@ -10136,7 +10138,7 @@ BUILDIN_FUNC(getmapguildusers)
|
|
|
const char *str;
|
|
|
int16 m;
|
|
|
int gid;
|
|
|
- int i=0,c=0;
|
|
|
+ int c=0;
|
|
|
struct guild *g = NULL;
|
|
|
str=script_getstr(st,2);
|
|
|
gid=script_getnum(st,3);
|
|
@@ -10147,6 +10149,7 @@ BUILDIN_FUNC(getmapguildusers)
|
|
|
g = guild_search(gid);
|
|
|
|
|
|
if (g){
|
|
|
+ unsigned short i;
|
|
|
for(i = 0; i < g->max_member; i++)
|
|
|
{
|
|
|
if (g->member[i].sd && g->member[i].sd->bl.m == m)
|
|
@@ -10539,7 +10542,7 @@ BUILDIN_FUNC(homunculus_evolution)
|
|
|
*------------------------------------------*/
|
|
|
BUILDIN_FUNC(homunculus_mutate)
|
|
|
{
|
|
|
- int homun_id, m_class, m_id, i;
|
|
|
+ int homun_id;
|
|
|
TBL_PC *sd;
|
|
|
|
|
|
sd = script_rid2sd(st);
|
|
@@ -10552,10 +10555,9 @@ BUILDIN_FUNC(homunculus_mutate)
|
|
|
homun_id = 6048 + (rnd() % 4);
|
|
|
|
|
|
if( sd->hd->homunculus.vaporize == HOM_ST_MORPH ) {
|
|
|
- m_class = hom_class2mapid(sd->hd->homunculus.class_);
|
|
|
- m_id = hom_class2mapid(homun_id);
|
|
|
-
|
|
|
- i = pc_search_inventory(sd, ITEMID_STRANGE_EMBRYO);
|
|
|
+ int m_class = hom_class2mapid(sd->hd->homunculus.class_);
|
|
|
+ int m_id = hom_class2mapid(homun_id);
|
|
|
+ short i = pc_search_inventory(sd, ITEMID_STRANGE_EMBRYO);
|
|
|
|
|
|
if ( m_class != -1 && m_id != -1 && m_class&HOM_EVO && m_id&HOM_S && sd->hd->homunculus.level >= 99 && i >= 0 ) {
|
|
|
sd->hd->homunculus.vaporize = HOM_ST_REST; // Remove morph state.
|
|
@@ -10581,7 +10583,6 @@ BUILDIN_FUNC(homunculus_mutate)
|
|
|
BUILDIN_FUNC(morphembryo)
|
|
|
{
|
|
|
struct item item_tmp;
|
|
|
- int m_class, i=0;
|
|
|
TBL_PC *sd;
|
|
|
|
|
|
sd = script_rid2sd(st);
|
|
@@ -10589,9 +10590,10 @@ BUILDIN_FUNC(morphembryo)
|
|
|
return 0;
|
|
|
|
|
|
if( hom_is_active(sd->hd) ) {
|
|
|
- m_class = hom_class2mapid(sd->hd->homunculus.class_);
|
|
|
+ int m_class = hom_class2mapid(sd->hd->homunculus.class_);
|
|
|
|
|
|
if ( m_class != -1 && m_class&HOM_EVO && sd->hd->homunculus.level >= 99 ) {
|
|
|
+ char i;
|
|
|
memset(&item_tmp, 0, sizeof(item_tmp));
|
|
|
item_tmp.nameid = ITEMID_STRANGE_EMBRYO;
|
|
|
item_tmp.identify = 1;
|
|
@@ -10849,7 +10851,6 @@ BUILDIN_FUNC(globalmes)
|
|
|
BUILDIN_FUNC(waitingroom)
|
|
|
{
|
|
|
struct npc_data* nd;
|
|
|
- int pub = 1;
|
|
|
const char* title = script_getstr(st, 2);
|
|
|
int limit = script_getnum(st, 3);
|
|
|
const char* ev = script_hasdata(st,4) ? script_getstr(st,4) : "";
|
|
@@ -10860,7 +10861,7 @@ BUILDIN_FUNC(waitingroom)
|
|
|
|
|
|
nd = (struct npc_data *)map_id2bl(st->oid);
|
|
|
if( nd != NULL )
|
|
|
- chat_createnpcchat(nd, title, limit, pub, trigger, ev, zeny, minLvl, maxLvl);
|
|
|
+ chat_createnpcchat(nd, title, limit, 1, trigger, ev, zeny, minLvl, maxLvl);
|
|
|
|
|
|
return SCRIPT_CMD_SUCCESS;
|
|
|
}
|
|
@@ -11007,7 +11008,6 @@ BUILDIN_FUNC(warpwaitingpc)
|
|
|
const char* map_name;
|
|
|
struct npc_data* nd;
|
|
|
struct chat_data* cd;
|
|
|
- TBL_PC* sd;
|
|
|
|
|
|
nd = (struct npc_data *)map_id2bl(st->oid);
|
|
|
if( nd == NULL || (cd=(struct chat_data *)map_id2bl(nd->chat_id)) == NULL )
|
|
@@ -11023,7 +11023,7 @@ BUILDIN_FUNC(warpwaitingpc)
|
|
|
|
|
|
for( i = 0; i < n && cd->users > 0; i++ )
|
|
|
{
|
|
|
- sd = cd->usersd[0];
|
|
|
+ TBL_PC* sd = cd->usersd[0];
|
|
|
|
|
|
if( strcmp(map_name,"SavePoint") == 0 && map[sd->bl.m].flag.noteleport )
|
|
|
{// can't teleport on this map
|
|
@@ -11956,7 +11956,7 @@ BUILDIN_FUNC(getequipcardcnt)
|
|
|
/// and give them to the character. If any cards were removed in this manner, it will also show a success effect.
|
|
|
/// successremovecards <slot>;
|
|
|
BUILDIN_FUNC(successremovecards) {
|
|
|
- int i=-1,j,c,cardflag=0;
|
|
|
+ int i=-1,c,cardflag=0;
|
|
|
|
|
|
TBL_PC* sd = script_rid2sd(st);
|
|
|
int num = script_getnum(st,2);
|
|
@@ -11988,7 +11988,7 @@ BUILDIN_FUNC(successremovecards) {
|
|
|
}
|
|
|
|
|
|
if(cardflag == 1) {//if card was remove remplace item with no card
|
|
|
- unsigned char flag = 0;
|
|
|
+ unsigned char flag = 0, j;
|
|
|
struct item item_tmp;
|
|
|
memset(&item_tmp,0,sizeof(item_tmp));
|
|
|
|
|
@@ -12020,7 +12020,7 @@ BUILDIN_FUNC(successremovecards) {
|
|
|
/// <type>=2 : will keep the cards, but destroy the item.
|
|
|
/// <type>=? : will just display the failure effect.
|
|
|
BUILDIN_FUNC(failedremovecards) {
|
|
|
- int i=-1,j,c,cardflag=0;
|
|
|
+ int i=-1,c,cardflag=0;
|
|
|
|
|
|
TBL_PC* sd = script_rid2sd(st);
|
|
|
int num = script_getnum(st,2);
|
|
@@ -12061,7 +12061,7 @@ BUILDIN_FUNC(failedremovecards) {
|
|
|
pc_delitem(sd,i,1,0,2,LOG_TYPE_SCRIPT);
|
|
|
}
|
|
|
if(typefail == 1){ // destroy the card
|
|
|
- unsigned char flag = 0;
|
|
|
+ unsigned char flag = 0, j;
|
|
|
struct item item_tmp;
|
|
|
|
|
|
memset(&item_tmp,0,sizeof(item_tmp));
|
|
@@ -12352,7 +12352,6 @@ BUILDIN_FUNC(guardian)
|
|
|
{
|
|
|
int class_=0,x=0,y=0,guardian=0;
|
|
|
const char *str,*mapname,*evt="";
|
|
|
- struct script_data *data;
|
|
|
bool has_index = false;
|
|
|
|
|
|
mapname =script_getstr(st,2);
|
|
@@ -12367,7 +12366,7 @@ BUILDIN_FUNC(guardian)
|
|
|
guardian=script_getnum(st,8);
|
|
|
has_index = true;
|
|
|
} else if( script_hasdata(st,7) ){
|
|
|
- data=script_getdata(st,7);
|
|
|
+ struct script_data *data = script_getdata(st,7);
|
|
|
get_val(st,data);
|
|
|
if( data_isstring(data) )
|
|
|
{// "<event label>"
|
|
@@ -12539,7 +12538,6 @@ BUILDIN_FUNC(getitemslots)
|
|
|
BUILDIN_FUNC(getiteminfo)
|
|
|
{
|
|
|
unsigned short item_id,n;
|
|
|
- int *item_arr;
|
|
|
struct item_data *i_data;
|
|
|
|
|
|
item_id = script_getnum(st,2);
|
|
@@ -12547,7 +12545,7 @@ BUILDIN_FUNC(getiteminfo)
|
|
|
i_data = itemdb_exists(item_id);
|
|
|
|
|
|
if (i_data && n <= 14) {
|
|
|
- item_arr = (int*)&i_data->value_buy;
|
|
|
+ int *item_arr = (int*)&i_data->value_buy;
|
|
|
script_pushint(st,item_arr[n]);
|
|
|
} else
|
|
|
script_pushint(st,-1);
|
|
@@ -12581,7 +12579,6 @@ BUILDIN_FUNC(setiteminfo)
|
|
|
{
|
|
|
unsigned short item_id;
|
|
|
int n,value;
|
|
|
- int *item_arr;
|
|
|
struct item_data *i_data;
|
|
|
|
|
|
item_id = script_getnum(st,2);
|
|
@@ -12590,7 +12587,7 @@ BUILDIN_FUNC(setiteminfo)
|
|
|
i_data = itemdb_exists(item_id);
|
|
|
|
|
|
if (i_data && n>=0 && n<=14) {
|
|
|
- item_arr = (int*)&i_data->value_buy;
|
|
|
+ int *item_arr = (int*)&i_data->value_buy;
|
|
|
item_arr[n] = value;
|
|
|
script_pushint(st,value);
|
|
|
} else
|
|
@@ -12841,12 +12838,10 @@ BUILDIN_FUNC(misceffect)
|
|
|
*------------------------------------------*/
|
|
|
BUILDIN_FUNC(playBGM)
|
|
|
{
|
|
|
- const char* name;
|
|
|
struct map_session_data* sd;
|
|
|
|
|
|
if( ( sd = script_rid2sd(st) ) != NULL ) {
|
|
|
- name = script_getstr(st,2);
|
|
|
- clif_playBGM(sd, name);
|
|
|
+ clif_playBGM(sd, script_getstr(st,2));
|
|
|
}
|
|
|
return SCRIPT_CMD_SUCCESS;
|
|
|
}
|
|
@@ -13352,7 +13347,6 @@ BUILDIN_FUNC(recovery)
|
|
|
case 1:
|
|
|
{
|
|
|
struct party_data* p;
|
|
|
- struct map_session_data* pl_sd;
|
|
|
//When no party given, we use invoker party
|
|
|
int p_id = 0, i;
|
|
|
if(script_hasdata(st,5)) {//Bad maps shouldn't cause issues
|
|
@@ -13370,6 +13364,7 @@ BUILDIN_FUNC(recovery)
|
|
|
if(p == NULL)
|
|
|
return 0;
|
|
|
for (i = 0; i < MAX_PARTY; i++) {
|
|
|
+ struct map_session_data* pl_sd;
|
|
|
if((!(pl_sd = p->data[i].sd) || pl_sd->status.party_id != p_id)
|
|
|
|| (map_idx && pl_sd->bl.m != map_idx))
|
|
|
continue;
|
|
@@ -13380,7 +13375,6 @@ BUILDIN_FUNC(recovery)
|
|
|
case 2:
|
|
|
{
|
|
|
struct guild* g;
|
|
|
- struct map_session_data* pl_sd;
|
|
|
//When no guild given, we use invoker guild
|
|
|
int g_id = 0, i;
|
|
|
if(script_hasdata(st,5)) {//Bad maps shouldn't cause issues
|
|
@@ -13398,6 +13392,7 @@ BUILDIN_FUNC(recovery)
|
|
|
if(g == NULL)
|
|
|
return 0;
|
|
|
for (i = 0; i < MAX_GUILD; i++) {
|
|
|
+ struct map_session_data* pl_sd;
|
|
|
if((!(pl_sd = g->member[i].sd) || pl_sd->status.guild_id != g_id)
|
|
|
|| (map_idx && pl_sd->bl.m != map_idx))
|
|
|
continue;
|
|
@@ -13511,7 +13506,7 @@ BUILDIN_FUNC(gethominfo)
|
|
|
/// getmercinfo <type>[,<char id>];
|
|
|
BUILDIN_FUNC(getmercinfo)
|
|
|
{
|
|
|
- int type, char_id;
|
|
|
+ int type;
|
|
|
struct map_session_data* sd;
|
|
|
struct mercenary_data* md;
|
|
|
|
|
@@ -13519,7 +13514,7 @@ BUILDIN_FUNC(getmercinfo)
|
|
|
|
|
|
if( script_hasdata(st,3) )
|
|
|
{
|
|
|
- char_id = script_getnum(st,3);
|
|
|
+ int char_id = script_getnum(st,3);
|
|
|
|
|
|
if( ( sd = map_charid2sd(char_id) ) == NULL )
|
|
|
{
|
|
@@ -13658,13 +13653,13 @@ BUILDIN_FUNC(message)
|
|
|
BUILDIN_FUNC(npctalk)
|
|
|
{
|
|
|
const char* str;
|
|
|
- char name[NAME_LENGTH], message[256];
|
|
|
|
|
|
struct npc_data* nd = (struct npc_data *)map_id2bl(st->oid);
|
|
|
str = script_getstr(st,2);
|
|
|
|
|
|
if(nd)
|
|
|
{
|
|
|
+ char name[NAME_LENGTH], message[256];
|
|
|
safestrncpy(name, nd->name, sizeof(name));
|
|
|
strtok(name, "#"); // discard extra name identifier if present
|
|
|
safesnprintf(message, sizeof(message), "%s : %s", name, str);
|
|
@@ -14218,7 +14213,6 @@ BUILDIN_FUNC(day)
|
|
|
//-------------------------------------------------------
|
|
|
BUILDIN_FUNC(unequip)
|
|
|
{
|
|
|
- int i;
|
|
|
size_t num;
|
|
|
TBL_PC *sd;
|
|
|
|
|
@@ -14226,7 +14220,7 @@ BUILDIN_FUNC(unequip)
|
|
|
sd = script_rid2sd(st);
|
|
|
if( sd != NULL && num >= 1 && num <= ARRAYLENGTH(equip) )
|
|
|
{
|
|
|
- i = pc_checkequip(sd,equip[num-1]);
|
|
|
+ short i = pc_checkequip(sd,equip[num-1]);
|
|
|
if (i >= 0)
|
|
|
pc_unequipitem(sd,i,1|2);
|
|
|
}
|
|
@@ -14587,10 +14581,8 @@ BUILDIN_FUNC(explode)
|
|
|
BUILDIN_FUNC(implode)
|
|
|
{
|
|
|
struct script_data* data = script_getdata(st, 2);
|
|
|
- const char *glue = NULL, *name, *temp;
|
|
|
+ const char *name;
|
|
|
int32 glue_len = 0, array_size, id;
|
|
|
- size_t len = 0;
|
|
|
- int i, k = 0;
|
|
|
|
|
|
TBL_PC* sd = NULL;
|
|
|
|
|
@@ -14639,6 +14631,10 @@ BUILDIN_FUNC(implode)
|
|
|
output = (char*)aMalloc(sizeof(char)*5);
|
|
|
sprintf(output,"%s","NULL");
|
|
|
} else {
|
|
|
+ const char *glue = NULL, *temp;
|
|
|
+ size_t len = 0;
|
|
|
+ int i, k = 0;
|
|
|
+
|
|
|
for(i = 0; i <= array_size; ++i) {
|
|
|
temp = (char*) get_val2(st, reference_uid(id, i), reference_getref(data));
|
|
|
len += strlen(temp);
|
|
@@ -15453,7 +15449,7 @@ BUILDIN_FUNC(getd)
|
|
|
|
|
|
buffer = script_getstr(st, 2);
|
|
|
|
|
|
- if(sscanf(buffer, "%[^[][%d]", varname, &elem) < 2)
|
|
|
+ if(sscanf(buffer, "%99[^[][%d]", varname, &elem) < 2)
|
|
|
elem = 0;
|
|
|
|
|
|
// Push the 'pointer' so it's more flexible [Lance]
|
|
@@ -15686,7 +15682,7 @@ BUILDIN_FUNC(addmonsterdrop)
|
|
|
struct mob_db *mob;
|
|
|
struct script_data *data;
|
|
|
unsigned short item_id;
|
|
|
- int rate,i,c = 0;
|
|
|
+ int rate;
|
|
|
|
|
|
data = script_getdata(st, 2);
|
|
|
get_val(st, data); // Convert into value in case of a variable
|
|
@@ -15704,6 +15700,7 @@ BUILDIN_FUNC(addmonsterdrop)
|
|
|
}
|
|
|
|
|
|
if(mob) { //We got a valid monster, check for available drop slot
|
|
|
+ unsigned char i, c = 0;
|
|
|
for(i = 0; i < MAX_MOB_DROP; i++) {
|
|
|
if(mob->dropitem[i].nameid) {
|
|
|
if(mob->dropitem[i].nameid == item_id) { //If it equals item_id we update that drop
|
|
@@ -15742,7 +15739,6 @@ BUILDIN_FUNC(delmonsterdrop)
|
|
|
struct mob_db *mob;
|
|
|
struct script_data *data;
|
|
|
unsigned short item_id;
|
|
|
- int i;
|
|
|
|
|
|
data = script_getdata(st, 2);
|
|
|
get_val(st, data); // Convert into value in case of a variable
|
|
@@ -15759,6 +15755,7 @@ BUILDIN_FUNC(delmonsterdrop)
|
|
|
}
|
|
|
|
|
|
if(mob) { //We got a valid monster, check for item drop on monster
|
|
|
+ unsigned char i;
|
|
|
for(i = 0; i < MAX_MOB_DROP; i++) {
|
|
|
if(mob->dropitem[i].nameid == item_id) {
|
|
|
mob->dropitem[i].nameid = 0;
|
|
@@ -16754,7 +16751,7 @@ Questlog script commands
|
|
|
BUILDIN_FUNC(questinfo)
|
|
|
{
|
|
|
TBL_NPC* nd = map_id2nd(st->oid);
|
|
|
- int quest_id, icon, job, color = 0;
|
|
|
+ int quest_id, icon;
|
|
|
struct questinfo qi;
|
|
|
|
|
|
if( nd == NULL || nd->bl.m == -1 )
|
|
@@ -16778,7 +16775,7 @@ BUILDIN_FUNC(questinfo)
|
|
|
qi.nd = nd;
|
|
|
|
|
|
if( script_hasdata(st, 4) ) {
|
|
|
- color = script_getnum(st, 4);
|
|
|
+ int color = script_getnum(st, 4);
|
|
|
if( color < 0 || color > 3 ) {
|
|
|
ShowWarning("buildin_questinfo: invalid color '%d', changing to 0\n",color);
|
|
|
script_reportfunc(st);
|
|
@@ -16790,7 +16787,7 @@ BUILDIN_FUNC(questinfo)
|
|
|
qi.hasJob = false;
|
|
|
|
|
|
if(script_hasdata(st, 5)) {
|
|
|
- job = script_getnum(st, 5);
|
|
|
+ int job = script_getnum(st, 5);
|
|
|
|
|
|
if (!pcdb_checkid(job))
|
|
|
ShowError("buildin_questinfo: Nonexistant Job Class.\n");
|
|
@@ -16927,8 +16924,8 @@ BUILDIN_FUNC(waitingroom2bg)
|
|
|
struct npc_data *nd;
|
|
|
struct chat_data *cd;
|
|
|
const char *map_name, *ev = "", *dev = "";
|
|
|
- int x, y, i, mapindex = 0, bg_id, n;
|
|
|
- struct map_session_data *sd;
|
|
|
+ int x, y, mapindex = 0, bg_id, n;
|
|
|
+ unsigned char i;
|
|
|
|
|
|
if( script_hasdata(st,7) )
|
|
|
nd = npc_name2id(script_getstr(st,7));
|
|
@@ -16966,6 +16963,7 @@ BUILDIN_FUNC(waitingroom2bg)
|
|
|
n = cd->users;
|
|
|
for( i = 0; i < n && i < MAX_BG_MEMBERS; i++ )
|
|
|
{
|
|
|
+ struct map_session_data *sd;
|
|
|
if( (sd = cd->usersd[i]) != NULL && bg_team_join(bg_id, sd) )
|
|
|
mapreg_setreg(reference_uid(add_str("$@arenamembers"), i), sd->bl.id);
|
|
|
else
|
|
@@ -17101,7 +17099,6 @@ BUILDIN_FUNC(bg_getareausers)
|
|
|
int bg_id;
|
|
|
int i = 0, c = 0;
|
|
|
struct battleground_data *bg = NULL;
|
|
|
- struct map_session_data *sd;
|
|
|
|
|
|
bg_id = script_getnum(st,2);
|
|
|
str = script_getstr(st,3);
|
|
@@ -17119,6 +17116,7 @@ BUILDIN_FUNC(bg_getareausers)
|
|
|
|
|
|
for( i = 0; i < MAX_BG_MEMBERS; i++ )
|
|
|
{
|
|
|
+ struct map_session_data *sd;
|
|
|
if( (sd = bg->members[i].sd) == NULL )
|
|
|
continue;
|
|
|
if( sd->bl.m != m || sd->bl.x < x0 || sd->bl.y < y0 || sd->bl.x > x1 || sd->bl.y > y1 )
|
|
@@ -17339,7 +17337,6 @@ BUILDIN_FUNC(instance_id)
|
|
|
BUILDIN_FUNC(instance_warpall)
|
|
|
{
|
|
|
struct party_data *p;
|
|
|
- struct map_session_data *pl_sd;
|
|
|
int16 m, i;
|
|
|
short instance_id;
|
|
|
const char *mapn;
|
|
@@ -17359,8 +17356,10 @@ BUILDIN_FUNC(instance_warpall)
|
|
|
if( !(p = party_search(instance_data[instance_id].party_id)) )
|
|
|
return 0;
|
|
|
|
|
|
- for( i = 0; i < MAX_PARTY; i++ )
|
|
|
+ for( i = 0; i < MAX_PARTY; i++ ) {
|
|
|
+ struct map_session_data *pl_sd;
|
|
|
if( (pl_sd = p->data[i].sd) && map[pl_sd->bl.m].instance_id == instance_id ) pc_setpos(pl_sd,map_id2index(m),x,y,CLR_TELEPORT);
|
|
|
+ }
|
|
|
|
|
|
return SCRIPT_CMD_SUCCESS;
|
|
|
}
|
|
@@ -17409,7 +17408,6 @@ BUILDIN_FUNC(instance_announce) {
|
|
|
*------------------------------------------*/
|
|
|
BUILDIN_FUNC(instance_check_party)
|
|
|
{
|
|
|
- struct map_session_data *pl_sd;
|
|
|
int amount, min, max, i, party_id, c = 0;
|
|
|
struct party_data *p = NULL;
|
|
|
|
|
@@ -17434,7 +17432,8 @@ BUILDIN_FUNC(instance_check_party)
|
|
|
return 0;
|
|
|
}
|
|
|
|
|
|
- for( i = 0; i < MAX_PARTY; i++ )
|
|
|
+ for( i = 0; i < MAX_PARTY; i++ ) {
|
|
|
+ struct map_session_data *pl_sd;
|
|
|
if( (pl_sd = p->data[i].sd) )
|
|
|
if(map_id2bl(pl_sd->bl.id)) {
|
|
|
if(pl_sd->status.base_level < min) {
|
|
@@ -17446,6 +17445,7 @@ BUILDIN_FUNC(instance_check_party)
|
|
|
}
|
|
|
c++;
|
|
|
}
|
|
|
+ }
|
|
|
|
|
|
if(c < amount)
|
|
|
script_pushint(st, 0); // Not enough Members in the Party to join Instance.
|
|
@@ -18665,7 +18665,6 @@ BUILDIN_FUNC(montransform) {
|
|
|
|
|
|
TBL_PC *sd;
|
|
|
enum sc_type type;
|
|
|
- char msg[CHAT_SIZE_MAX];
|
|
|
int tick, mob_id, val1, val2, val3, val4;
|
|
|
struct script_data *data;
|
|
|
|
|
@@ -18714,6 +18713,7 @@ BUILDIN_FUNC(montransform) {
|
|
|
val4 = script_getnum(st, 8);
|
|
|
|
|
|
if (tick != 0) {
|
|
|
+ char msg[CHAT_SIZE_MAX];
|
|
|
struct mob_db *monster = mob_db(mob_id);
|
|
|
|
|
|
if (battle_config.mon_trans_disable_in_gvg && map_flag_gvg2(sd->bl.m)) {
|
|
@@ -18867,15 +18867,17 @@ BUILDIN_FUNC(disable_command) {
|
|
|
*/
|
|
|
BUILDIN_FUNC(getguildmember)
|
|
|
{
|
|
|
- int i, j = 0, type = 0;
|
|
|
+ unsigned char j = 0;
|
|
|
struct guild *g = NULL;
|
|
|
|
|
|
g = guild_search(script_getnum(st,2));
|
|
|
|
|
|
- if (script_hasdata(st,3))
|
|
|
- type = script_getnum(st,3);
|
|
|
-
|
|
|
if (g) {
|
|
|
+ unsigned char i, type = 0;
|
|
|
+
|
|
|
+ if (script_hasdata(st,3))
|
|
|
+ type = (unsigned char)script_getnum(st,3);
|
|
|
+
|
|
|
for (i = 0; i < MAX_GUILD; i++) {
|
|
|
if (g->member[i].account_id) {
|
|
|
switch (type) {
|