Jump to content

Yudax

Members
  • Posts

    248
  • Joined

  • Last visited

Everything posted by Yudax

  1. 17324
  2. Yudax

    REMOVED

    A script from sir Emistry just change the item#, replace your getitem with this if( checkweight( 7037,.@num ) ){ getitem 7037,.@num; delitem 607,.@num*500; }else{ mes "You are Overweight"; }
  3. http://rathena.org/board/topic/81994-help-how-to-edit-my-homunculus-s-level/ http://rathena.org/board/topic/80057-homunculus-max-level/
  4. The error is in that one, either of the two gives an error for pc_payzeny(sd, (int)z); d:\ragnarok\17294\src\map\vending.c(146): error C2198: 'pc_payzeny' : too few arguments for call
  5. I will try it right now sir, Anyway may I know what are the things you edit and why? -------------- I will try it right now sir, Anyway may I know what are the things you edit and why? Theres an error and i think its in this line pc_payzeny(sd, (int)z); When i try to change it to; pc_payzeny(sd, (int)z, LOG_TYPE_VENDING, vsd); Thats the error that it shows 1>d:\ragnarok\17294\src\map\vending.c(146): error C2065: 'vsd' : undeclared identifier 1>d:\ragnarok\17294\src\map\vending.c(146): warning C4047: 'function' : 'map_session_data *' differs in levels of indirection from 'int' 1>d:\ragnarok\17294\src\map\vending.c(146): warning C4024: 'pc_payzeny' : different types for formal and actual parameter 4
  6. Just show what you did and many of us can help.
  7. Try to follow the guide of our fellow Filipino; http://rathena.org/board/topic/53291-guidehow-to-setup-a-ragnarok-onlineserver-side-only/
  8. And I guess you should use this link; http://svn.code.sf.net/p/rathena/svn/
  9. still error
  10. this one pops out 1>d:\ragnarok\17294\src\map\vending.c(146): error C2065: 'z' : undeclared identifier 1>d:\ragnarok\17294\src\map\vending.c(146): error C2065: 'vsd' : undeclared identifier 1>d:\ragnarok\17294\src\map\vending.c(146): warning C4047: 'function' : 'map_session_data *' differs in levels of indirection from 'int' 1>d:\ragnarok\17294\src\map\vending.c(146): warning C4024: 'pc_payzeny' : different types for formal and actual parameter 4 1>d:\ragnarok\17294\src\map\vending.c(176): error C2084: function 'void vending_purchasereq_script(map_session_data *,npc_data *,int,const uint8 *,int)' already has a body 1> d:\ragnarok\17294\src\map\vending.c(73) : see previous definition of 'vending_purchasereq_script' 1>d:\ragnarok\17294\src\map\vending.c(182): error C2065: 'aid' : undeclared identifier 1>d:\ragnarok\17294\src\map\vending.c(205): error C2065: 'aid' : undeclared identifier 1>d:\ragnarok\17294\src\map\vending.c(216): error C2065: 'vending' : undeclared identifier 1>d:\ragnarok\17294\src\map\vending.c(220): error C2065: 'w' : undeclared identifier 1>d:\ragnarok\17294\src\map\vending.c(234): error C2065: 'j' : undeclared identifier 1>d:\ragnarok\17294\src\map\vending.c(234): error C2065: 'j' : undeclared identifier 1>d:\ragnarok\17294\src\map\vending.c(234): error C2065: 'j' : undeclared identifier 1>d:\ragnarok\17294\src\map\vending.c(234): error C2065: 'j' : undeclared identifier 1>d:\ragnarok\17294\src\map\vending.c(235): error C2065: 'j' : undeclared identifier 1>d:\ragnarok\17294\src\map\vending.c(238): error C2065: 'vend_list' : undeclared identifier 1>d:\ragnarok\17294\src\map\vending.c(238): error C2109: subscript requires array or pointer type 1>d:\ragnarok\17294\src\map\vending.c(238): error C2065: 'j' : undeclared identifier 1>d:\ragnarok\17294\src\map\vending.c(240): error C2065: 'j' : undeclared identifier 1>d:\ragnarok\17294\src\map\vending.c(248): error C2065: 'j' : undeclared identifier 1>d:\ragnarok\17294\src\map\vending.c(252): error C2065: 'w' : undeclared identifier 1>d:\ragnarok\17294\src\map\vending.c(253): error C2065: 'w' : undeclared identifier 1>d:\ragnarok\17294\src\map\vending.c(260): error C2065: 'vending' : undeclared identifier 1>d:\ragnarok\17294\src\map\vending.c(260): error C2065: 'j' : undeclared identifier 1>d:\ragnarok\17294\src\map\vending.c(260): error C2109: subscript requires array or pointer type 1>d:\ragnarok\17294\src\map\vending.c(261): error C2065: 'vending' : undeclared identifier 1>d:\ragnarok\17294\src\map\vending.c(261): error C2065: 'j' : undeclared identifier 1>d:\ragnarok\17294\src\map\vending.c(261): error C2109: subscript requires array or pointer type 1>d:\ragnarok\17294\src\map\vending.c(265): error C2065: 'vending' : undeclared identifier 1>d:\ragnarok\17294\src\map\vending.c(265): error C2065: 'j' : undeclared identifier 1>d:\ragnarok\17294\src\map\vending.c(265): error C2109: subscript requires array or pointer type 1>d:\ragnarok\17294\src\map\vending.c(268): error C2065: 'j' : undeclared identifier 1>d:\ragnarok\17294\src\map\vending.c(272): error C2065: 'vending' : undeclared identifier 1>d:\ragnarok\17294\src\map\vending.c(272): error C2065: 'j' : undeclared identifier 1>d:\ragnarok\17294\src\map\vending.c(272): error C2109: subscript requires array or pointer type 1>d:\ragnarok\17294\src\map\vending.c(278): error C2065: 'new_' : undeclared identifier 1>d:\ragnarok\17294\src\map\vending.c(279): error C2065: 'new_' : undeclared identifier 1>d:\ragnarok\17294\src\map\vending.c(300): error C2065: 'vend_list' : undeclared identifier 1>d:\ragnarok\17294\src\map\vending.c(300): error C2109: subscript requires array or pointer type 1>d:\ragnarok\17294\src\map\vending.c(314): error C2065: 'cursor' : undeclared identifier 1>d:\ragnarok\17294\src\map\vending.c(319): error C2065: 'cursor' : undeclared identifier 1>d:\ragnarok\17294\src\map\vending.c(321): error C2065: 'cursor' : undeclared identifier 1>d:\ragnarok\17294\src\map\vending.c(322): error C2065: 'cursor' : undeclared identifier 1>d:\ragnarok\17294\src\map\vending.c(323): error C2065: 'cursor' : undeclared identifier 1>d:\ragnarok\17294\src\map\vending.c(326): error C2065: 'cursor' : undeclared identifier 1>d:\ragnarok\17294\src\map\vending.c(328): error C2065: 'cursor' : undeclared identifier
  11. I take the credit from this post: http://rathena.org/board/topic/71796-callshop-npc-using-vending/#entry142562 I edited some of the errors in this .diff But I still cant make it work. like pc_payzeny(sd, (int)zeny); to: pc_payzeny(sd, (int)z, LOG_TYPE_VENDING, vsd); and case ADDITEM_NEW: to: case CHKADDITEM_NEW: ------------- But after compiling I got this error 1>d:\ragnarok\17294\src\map\vending.c(146): error C2065: 'z' : undeclared identifier 1>d:\ragnarok\17294\src\map\vending.c(146): error C2065: 'vsd' : undeclared identifier 1>d:\ragnarok\17294\src\map\vending.c(146): warning C4047: 'function' : 'map_session_data *' differs in levels of indirection from 'int' 1>d:\ragnarok\17294\src\map\vending.c(146): warning C4024: 'pc_payzeny' : different types for formal and actual parameter 4 ========== Rebuild All: 3 succeeded, 1 failed, 0 skipped ========== new patch here; vending.patch
  12. Yudax

    Auto Vend

    I already fixed them, thanks for the help guys. What about the NPC that uses Extended Vending System? Is that possible?
  13. Thank you, So we just neglect the @@ -17032,6 +17032,79 @@ So other problem is that when there is an error, how do you usually fix it? Try to patch that .diff its actually from http://rathena.org/board/topic/82555-auto-vend/#entry198691.
  14. login_ip: on what part in char_athena map_athena should i need to edit clieninfo.xml ?
  15. Thanks for the reply, What do you mean by going to close them? I mean just adding them manually in a different locations
  16. 3820 <3 <3 <3
  17. I really got confused on adding patch manually; we take for example; this patch Index: src/map/clif.c =================================================================== --- src/map/clif.c (revision 16809) +++ src/map/clif.c (working copy) @@ -17032,6 +17032,79 @@ return 0; } + /*========================================== + * Custom vending list (script based) + *------------------------------------------*/ +int clif_vending_script(struct map_session_data* sd, struct npc_data* nd) +{ + int i, j, fd, len; +#if PACKETVER < 20100105 + const int cmd = 0x133; + const int offset = 8; +#else + const int cmd = 0x800; + const int offset = 12; +#endif + + nullpo_retr(0, sd); + nullpo_retr(0, nd); + + ARR_FIND( 0, MAX_VENDING, i, nd->vending[i].nameid > 0 ); + + if( i == MAX_VENDING ) + return 0; + + fd = sd->fd; + len = offset; + + WFIFOHEAD(fd, offset+MAX_VENDING*22); + WFIFOW(fd,0) = cmd; + WFIFOL(fd,4) = sd->bl.id; +#if PACKETVER >= 20100105 + WFIFOL(fd,8) = nd->bl.id; +#endif + + for( i = 0; MAX_VENDING > i; i++ ) + { + int k; + struct item_data* data; + struct npc_item_vend* v; + + if( nd->vending[i].nameid == 0 ) + continue; + + v = &nd->vending[i]; + + data = itemdb_search(v->nameid); + + WFIFOL(fd,offset+ 0+i*22) = v->value; + WFIFOW(fd,offset+ 4+i*22) = 1; + WFIFOW(fd,offset+ 6+i*22) = i + 2; + WFIFOB(fd,offset+ 8+i*22) = itemtype(data->type); + WFIFOW(fd,offset+ 9+i*22) = ( data->view_id > 0 ) ? data->view_id : data->nameid; + WFIFOB(fd,offset+11+i*22) = 1; + WFIFOB(fd,offset+12+i*22) = v->attribute; + WFIFOB(fd,offset+13+i*22) = v->refine; + + for( j = 0; MAX_SLOTS > j; j++ ) + { + if( v->card[j] > 0 && ( k = itemdb_viewid(v->card[j]) ) > 0 ) + WFIFOW(fd,offset+14+(j*2)+i*22) = k; + else + WFIFOW(fd,offset+14+(j*2)+i*22) = v->card[j]; + } + + len += 22; + } + + WFIFOW(fd,2) = len; + WFIFOSET(fd,WFIFOW(fd,2)); + + sd->state.npc_vending = nd->bl.id; + + return 0; +} + void do_final_clif(void) { ers_destroy(delay_clearunit_ers); } Index: src/map/clif.h =================================================================== --- src/map/clif.h (revision 16809) +++ src/map/clif.h (working copy) @@ -308,6 +308,7 @@ uint32 clif_refresh_ip(void); uint16 clif_getport(void); +int clif_vending_script(struct map_session_data* sd, struct npc_data* nd); void clif_authok(struct map_session_data *sd); void clif_authrefuse(int fd, uint8 error_code); void clif_authfail_fd(int fd, int type); Index: src/map/npc.h =================================================================== --- src/map/npc.h (revision 16809) +++ src/map/npc.h (working copy) @@ -23,6 +23,14 @@ unsigned int nameid,value; }; +struct npc_item_vend { + short nameid; + char refine; + char attribute; + short card[MAX_SLOTS]; + unsigned int value; +}; + struct npc_data { struct block_list bl; struct unit_data ud; //Because they need to be able to move.... @@ -36,6 +44,7 @@ int chat_id; int touching_id; unsigned int next_walktime; + struct npc_item_vend vending[MAX_VENDING]; unsigned size : 2; Index: src/map/pc.h =================================================================== --- src/map/pc.h (revision 16809) +++ src/map/pc.h (working copy) @@ -135,6 +135,7 @@ unsigned int vending : 1; unsigned int noks : 3; // [Zeph Kill Steal Protection] unsigned int changemap : 1; + unsigned int npc_vending; // Player has a vending open from a script unsigned int callshop : 1; // flag to indicate that a script used callshop; on a shop short pmap; // Previous map on Map Change unsigned short autoloot; Index: src/map/script.c =================================================================== --- src/map/script.c (revision 16809) +++ src/map/script.c (working copy) @@ -14614,6 +14614,137 @@ return 0; } +/*==================================================* + * vending_add <item id>, <price>{, <refine>{, <attribute>{, <card1>, <card2>, <card3>, <card4>{, "<name>"}}}}; + *--------------------------------------------------*/ +BUILDIN_FUNC(vending_add) +{ + int i; + struct npc_data* nd; + struct npc_item_vend* vend; + + nd = script_hasdata(st, 10) ? npc_name2id(script_getstr(st, 10)) : map_id2nd(st->oid); + + if( nd == NULL ) + { + ShowWarning("script:vending_add: no script attached\n"); + return 0; + } + + ARR_FIND( 0, MAX_VENDING, i, nd->vending[i].nameid == 0 ); + + if( i == MAX_VENDING ) + { + ShowWarning("script:vending_add: reached maximum vending capacity (%d)\n", MAX_VENDING); + return 0; + } + + vend = &nd->vending[i]; + + if( itemdb_exists(script_getnum(st, 2)) == NULL ) + { + ShowWarning("script:vending_add: unknown item id %d\n", script_getnum(st, 2)); + return 0; + } + + memset( vend, 0, sizeof (struct npc_item_vend) ); + + vend->nameid = script_getnum(st, 2); + vend->value = script_getnum(st, 3); + + FETCH(4, vend->refine); + FETCH(5, vend->attribute); + + for( i = 0; MAX_SLOTS > i; i++ ) + FETCH(6 + i, vend->card[i]); + + script_pushint(st, i + 1); + + return 0; +} + +/*==================================================* + * vending_remove <item id>{, "<name>"}; + *--------------------------------------------------*/ +BUILDIN_FUNC(vending_remove) +{ + int i; + struct npc_data* nd; + + nd = script_hasdata(st, 3) ? npc_name2id(script_getstr(st, 3)) : map_id2nd(st->oid); + + if( nd == NULL ) + { + ShowWarning("script:vending_remove: no script attached\n"); + return 0; + } + + i = script_getnum(st, 2); + + if( i > 0 && i <= MAX_VENDING ) + i--; + else + { + ARR_FIND( 0, MAX_VENDING, i, nd->vending[i].nameid == script_getnum(st, 2) ); + + if( i == MAX_VENDING ) + { + ShowWarning("script:vending_remove: couldn't find item %d to remove\n", script_getnum(st, 2)); + return 0; + } + } + + memset( &nd->vending[i], 0, sizeof (struct npc_item_vend) ); + + return 0; +} + +/*==================================================* + * vending_open {"<name>"}; + *--------------------------------------------------*/ +BUILDIN_FUNC(vending_open) +{ + struct npc_data* nd; + struct map_session_data* sd = script_rid2sd(st); + + nullpo_retr(0, sd); + + nd = script_hasdata(st, 2) ? npc_name2id(script_getstr(st, 2)) : map_id2nd(st->oid); + + if( nd == NULL ) + { + ShowWarning("script:vending_open: no script attached\n"); + return 0; + } + + clif_vending_script(sd, nd); + + return 0; +} + +/*==================================================* + * vending_reset {"<name>"}; + *--------------------------------------------------*/ +BUILDIN_FUNC(vending_reset) +{ + struct npc_data* nd; + struct map_session_data* sd = script_rid2sd(st); + + nullpo_retr(0, sd); + + nd = script_hasdata(st, 2) ? npc_name2id(script_getstr(st, 2)) : map_id2nd(st->oid); + + if( nd == NULL ) + { + ShowWarning("script:vending_reset: no script attached\n"); + return 0; + } + + memset( nd->vending, 0, sizeof (nd->vending) ); + + return 0; +} + /*========================================== * Returns some values of an item [Lupus] * Price, Weight, etc... @@ -17433,5 +17564,9 @@ BUILDIN_DEF(checkquest, "i?"), BUILDIN_DEF(changequest, "ii"), BUILDIN_DEF(showevent, "ii"), + BUILDIN_DEF(vending_add, "ii*"), + BUILDIN_DEF(vending_remove, "i*"), + BUILDIN_DEF(vending_open, "*"), + BUILDIN_DEF(vending_reset, "*"), {NULL,NULL,NULL}, }; Index: src/map/vending.c =================================================================== --- src/map/vending.c (revision 16809) +++ src/map/vending.c (working copy) @@ -16,6 +16,7 @@ #include "skill.h" #include "battle.h" #include "log.h" +#include "npc.h" #include <stdio.h> #include <string.h> @@ -66,6 +67,108 @@ clif_vendinglist(sd, id, vsd->vending); } + /*========================================== + * Purchase item(s) from a script + *------------------------------------------*/ +void vending_purchasereq_script(struct map_session_data* sd, struct npc_data* nd, int uid, const uint8* data, int count) +{ + int i; + int add; + int blank; + int weight; + double zeny; + + nullpo_retv(sd); + nullpo_retv(nd); + + if( sd->state.npc_vending != nd->bl.id || uid != nd->bl.id ) + { + clif_buyvending(sd, 0, 0, 6); + return; + } + + if( count < 1 || count > MAX_VENDING ) + return; + + blank = pc_inventoryblank(sd); + + add = 0; + zeny = 0; + weight = 0; + + for( i = 0; count > i; i++ ) + { + short amount = *(uint16*)(data + 4*i + 0); + short index = *(uint16*)(data + 4*i + 2); + struct item_data* data; + + if( amount <= 0 ) + continue; + + index -= 2; + + if( index < 0 || index >= MAX_VENDING || nd->vending[index].nameid == 0 ) + continue; + + data = itemdb_exists(nd->vending[index].nameid); + + if( data == NULL ) + continue; + + zeny += (double)( nd->vending[index].value * amount ); + + if( zeny > (double)sd->status.zeny || zeny < 0.0 || zeny > (double)MAX_ZENY ) + { + clif_buyvending(sd, index, amount, 1); + return; + } + + weight += data->weight * amount; + + if( weight + sd->weight > sd->max_weight ) + { + clif_buyvending(sd, index, amount, 2); + return; + } + + switch( pc_checkadditem(sd, nd->vending[index].nameid, amount) ) + { + case ADDITEM_OVERAMOUNT: + return; + case ADDITEM_NEW: + add++; + } + } + + if( add > blank ) + return; + + pc_payzeny(sd, (int)zeny); + + for( i = 0; count > i; i++ ) + { + short amount = *(uint16*)(data + 4*i + 0); + short index = *(uint16*)(data + 4*i + 2); + struct item add_item; + + index -= 2; + + memset( &add_item, 0, sizeof(struct item) ); + + add_item.nameid = nd->vending[index].nameid; + add_item.refine = nd->vending[index].refine; + add_item.identify = 1; + add_item.attribute = nd->vending[index].attribute; + + memcpy( add_item.card, nd->vending[index].card, sizeof(nd->vending[index].card) ); + + pc_additem(sd, &add_item, amount, LOG_TYPE_BUYING_STORE); + } + + if( save_settings&2 ) + chrif_save(sd, 0); +} + /*========================================== * Purchase item(s) from a shop *------------------------------------------*/ @@ -76,6 +179,17 @@ struct s_vending vending[MAX_VENDING]; // against duplicate packets struct map_session_data* vsd = map_id2sd(aid); + if( sd->state.npc_vending == uid ) + {// a script vend has been requests + struct npc_data* nd = map_id2nd(uid); + + if( nd == NULL ) + return; + + vending_purchasereq_script(sd, nd, uid, data, count); + return; + } + nullpo_retv(sd); if( vsd == NULL || !vsd->state.vending || vsd->bl.id == sd->bl.id ) return; // invalid shop About this; @@ -17032,6 +17032,79 @@ I've read in the wiki but I cant understand the @@ -17032,6 +17032,79 @@ Other than that; Is it possible to put these lines on a different location while not following the @@ -17032,6 +17032,79 @@ itself? + /*========================================== + * Custom vending list (script based) + *------------------------------------------*/ +int clif_vending_script(struct map_session_data* sd, struct npc_data* nd) +{ + int i, j, fd, len; +#if PACKETVER < 20100105 + const int cmd = 0x133; + const int offset = 8; +#else + const int cmd = 0x800; + const int offset = 12; +#endif + + nullpo_retr(0, sd); + nullpo_retr(0, nd); + + ARR_FIND( 0, MAX_VENDING, i, nd->vending[i].nameid > 0 ); + + if( i == MAX_VENDING ) + return 0; + + fd = sd->fd; + len = offset; + + WFIFOHEAD(fd, offset+MAX_VENDING*22); + WFIFOW(fd,0) = cmd; + WFIFOL(fd,4) = sd->bl.id; +#if PACKETVER >= 20100105 + WFIFOL(fd,8) = nd->bl.id; +#endif + + for( i = 0; MAX_VENDING > i; i++ ) + { + int k; + struct item_data* data; + struct npc_item_vend* v; + + if( nd->vending[i].nameid == 0 ) + continue; + + v = &nd->vending[i]; + + data = itemdb_search(v->nameid); + + WFIFOL(fd,offset+ 0+i*22) = v->value; + WFIFOW(fd,offset+ 4+i*22) = 1; + WFIFOW(fd,offset+ 6+i*22) = i + 2; + WFIFOB(fd,offset+ 8+i*22) = itemtype(data->type); + WFIFOW(fd,offset+ 9+i*22) = ( data->view_id > 0 ) ? data->view_id : data->nameid; + WFIFOB(fd,offset+11+i*22) = 1; + WFIFOB(fd,offset+12+i*22) = v->attribute; + WFIFOB(fd,offset+13+i*22) = v->refine; + + for( j = 0; MAX_SLOTS > j; j++ ) + { + if( v->card[j] > 0 && ( k = itemdb_viewid(v->card[j]) ) > 0 ) + WFIFOW(fd,offset+14+(j*2)+i*22) = k; + else + WFIFOW(fd,offset+14+(j*2)+i*22) = v->card[j]; + } + + len += 22; + } + + WFIFOW(fd,2) = len; + WFIFOSET(fd,WFIFOW(fd,2)); + + sd->state.npc_vending = nd->bl.id; + + return 0; +} + void do_final_clif(void) { ers_destroy(delay_clearunit_ers); } Index: src/map/clif.h =================================================================== --- src/map/clif.h (revision 16809) +++ src/map/clif.h (working copy) @@ -308,6 +308,7 @@ uint32 clif_refresh_ip(void); uint16 clif_getport(void); +int clif_vending_script(struct map_session_data* sd, struct npc_data* nd); void clif_authok(struct map_session_data *sd); void clif_authrefuse(int fd, uint8 error_code); void clif_authfail_
  18. Yudax

    Hi

    welcome to the community
  19. Try to change your 127.0.0.1 to your LAN - IP.
  20. Not quite sure, What is your internet provider?
  21. Yudax

    Auto Vend

    I tried to search regarding about this but I cant find and I dont know what it is called An NPC that vends, it looks like a 'whitesmith' and it sells items / cards regarding what it cost ( zeny, coins, tcg ). When the server starts, the vendor will also start and when all the items are already bought, the NPC will disappear.
  22. this is kind'a fun, lol
  23. Im using rAthena, Cant update to 17323, stuck at 17321. solved now, sorry mods. better to read previous posts
  24. how did you fix this?
  25. Cool ba ng skill? Like the length of time you can use the skill again?
×
×
  • Create New...