Radian Posted December 12, 2014 Group: Members Topic Count: 162 Topics Per Day: 0.04 Content Count: 1546 Reputation: 192 Joined: 07/23/14 Last Seen: June 24, 2024 Share Posted December 12, 2014 Hello Everyone! I am trying to apply the patch of Xantra's @itemmap http://rathena.org/board/topic/56124-package-getitem-map-itemmap/ I got 1 error showing up on script.c 1>..\src\map\script.c(6539): error C2198: 'itemdb_searchrandomid' : too few arguments for call and what's on my script.c is if(nameid < 0) { nameid = itemdb_searchrandomid(-nameid); flag = 1; } can someone tell me if i don't apply this on script.c what will happened? (my guess: only if your gonna use it via script) +/*==================================================================== + [Xantara] + *getitem_map <item id>,<amount>,"<mapname>"{,<type>,<ID for Type>}; + type: 0=everyone, 1=party, 2=guild, 3=bg + =====================================================================*/ +static int buildin_getitem_map_sub(struct block_list *bl,va_list ap) +{ + struct item it; + struct guild *g = NULL; + struct party_data *p = NULL; + + int amt,count; + TBL_PC *sd = (TBL_PC *)bl; + + it = va_arg(ap,struct item); + amt = va_arg(ap,int); + count = va_arg(ap,int); + + pc_getitem_map(sd,it,amt,count,LOG_TYPE_SCRIPT); + + return 0; +} + +BUILDIN_FUNC(getitem_map) +{ + struct item it; + struct guild *g = NULL; + struct party_data *p = NULL; + struct battleground_data *bg = NULL; + struct script_data *data; + + int m,i,get_count,nameid,amount,flag=0,type=0,type_id=0; + const char *mapname; + + data = script_getdata(st,2); + get_val(st,data); + if( data_isstring(data) ) + { + const char *name = conv_str(st,data); + struct item_data *item_data = itemdb_searchname(name); + if( item_data ) + nameid = item_data->nameid; + else + nameid = UNKNOWN_ITEM_ID; + } + else + nameid = conv_num(st,data); + + if( (amount = script_getnum(st,3)) <= 0 ) + return 0; + + mapname = script_getstr(st,4); + if( (m = map_mapname2mapid(mapname)) < 0 ) + return 0; + + if( script_hasdata(st,5) ){ + type = script_getnum(st,5); + type_id = script_getnum(st,6); + } + + if(nameid < 0) { + nameid = itemdb_searchrandomid(-nameid); + flag = 1; + } + + if( nameid <= 0 || !itemdb_exists(nameid) ){ + ShowError("buildin_getitem_map: Nonexistant item %d requested.\n", nameid); + return 1; //No item created. + } + + memset(&it,0,sizeof(it)); + it.nameid = nameid; + if(!flag) + it.identify = 1; + else + it.identify = itemdb_isidentified(nameid); + + if (!itemdb_isstackable(nameid)) + get_count = 1; + else + get_count = amount; + + switch(type) + { + case 1: + if( (p = party_search(type_id)) != NULL ) + { + for( i=0; i < MAX_PARTY; i++ ) + if( p->data[i].sd && m == p->data[i].sd->bl.m ) + pc_getitem_map(p->data[i].sd,it,amount,get_count,LOG_TYPE_SCRIPT); + } + break; + case 2: + if( (g = guild_search(type_id)) != NULL ) + { + for( i=0; i < g->max_member; i++ ) + if( g->member[i].sd && m == g->member[i].sd->bl.m ) + pc_getitem_map(g->member[i].sd,it,amount,get_count,LOG_TYPE_SCRIPT); + } + break; + case 3: + if( (bg = bg_team_search(type_id)) != NULL ) + { + for( i=0; i < MAX_BG_MEMBERS; i++ ) + if( bg->members[i].sd && m == bg->members[i].sd->bl.m ) + pc_getitem_map(bg->members[i].sd,it,amount,get_count,LOG_TYPE_SCRIPT); + } + break; + default: + map_foreachinmap(buildin_getitem_map_sub,m,BL_PC,it,amount,get_count); + break; + } + + return 0; +} + /*========================================== * rentitem <item id>,<seconds> * rentitem "<item name>",<seconds> @@ -17364,6 +17480,7 @@ BUILDIN_DEF(getitem,"vi?"), BUILDIN_DEF(rentitem,"vi"), BUILDIN_DEF(getitem2,"viiiiiiii?"), + BUILDIN_DEF(getitem_map,"iis??"), BUILDIN_DEF(getnameditem,"vv"), BUILDIN_DEF2(grouprandomitem,"groupranditem","i"), BUILDIN_DEF(makeitem,"visii"), Quote Link to comment Share on other sites More sharing options...
Nerfwood Posted December 13, 2014 Group: Members Topic Count: 14 Topics Per Day: 0.00 Content Count: 104 Reputation: 27 Joined: 12/05/13 Last Seen: August 26, 2015 Share Posted December 13, 2014 According to rathena's doxygen, itemdb_searchrandomid needs 2 arguments, and yours only provide one. So... try adding 1 to it? nameid = itemdb_searchrandomid(-nameid, 1); This is untested, and I just want to share the use of doxygen since it helped me at editing the src. 1 Quote Link to comment Share on other sites More sharing options...
Radian Posted December 13, 2014 Group: Members Topic Count: 162 Topics Per Day: 0.04 Content Count: 1546 Reputation: 192 Joined: 07/23/14 Last Seen: June 24, 2024 Author Share Posted December 13, 2014 According to rathena's doxygen, itemdb_searchrandomid needs 2 arguments, and yours only provide one. So... try adding 1 to it? nameid = itemdb_searchrandomid(-nameid, 1); This is untested, and I just want to share the use of doxygen since it helped me at editing the src. Thanks for the response, I will try it Quote Link to comment Share on other sites More sharing options...
Question
Radian
Hello Everyone!I am trying to apply the patch of Xantra's @itemmaphttp://rathena.org/board/topic/56124-package-getitem-map-itemmap/I got 1 error showing up on script.cand what's on my script.c iscan someone tell me if i don't apply this on script.c what will happened? (my guess: only if your gonna use it via script)
Link to comment
Share on other sites
2 answers to this question
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.