Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Index: src/map/clif.c
- ===================================================================
- --- src/map/clif.c (revision 1177)
- +++ src/map/clif.c (working copy)
- @@ -3947,6 +3947,8 @@
- clif_specialeffect_single(bl,423,sd->fd);
- else if( nd->size == 1 )
- clif_specialeffect_single(bl,421,sd->fd);
- + if( nd->vend.vends == true )
- + clif_showvendingboard( &nd->bl, nd->vend.vending, sd->fd );
- }
- break;
- case BL_MOB:
- Index: src/map/npc.h
- ===================================================================
- --- src/map/npc.h (revision 1177)
- +++ src/map/npc.h (working copy)
- @@ -63,6 +63,12 @@
- unsigned short mapindex; // destination map
- } warp;
- } u;
- +
- + struct {
- + char vending[NAME_LENGTH+1]; //vending name
- + bool vends; //does he vend?
- + } vend;
- +
- };
- Index: src/map/script.c
- ===================================================================
- --- src/map/script.c (revision 1177)
- +++ src/map/script.c (working copy)
- @@ -15527,6 +15527,50 @@
- return 0;
- }
- + BUILDIN_FUNC( showvend ) {
- + struct npc_data *nd;
- + const char * message;
- + const char * name;
- + unsigned char buf[NAME_LENGTH+1];
- + int flag;
- +
- + name = script_getstr( st, 2 );
- + flag = script_getnum( st, 3 );
- +
- + if( flag && !script_hasdata( st, 4 ) ) {
- + ShowError( "showvend: want to create vendingboard without name.\n" );
- + script_reportsrc( st );
- + st->state = END; //Script stops
- + return -1;
- + }
- + else if( flag )
- + message = script_getstr( st, 4 );
- +
- + nd = npc_name2id( name );
- +
- + if( nd == NULL ) {
- + ShowError( "showvend: no npc found!\n" );
- + script_pushint( st, 0 ); //Fail return 0
- + return 0;
- + }
- +
- + switch( flag ) {
- + case 0:
- + clif_closevendingboard( &nd->bl, 0 );
- + nd->vend.vends = false;
- + break;
- + default:
- + memcpy( buf, message, NAME_LENGTH + 1 );
- + clif_showvendingboard( &nd->bl, buf, 0 );
- + nd->vend.vends = true;
- + memcpy( nd->vend.vending, message, NAME_LENGTH + 1 );
- + break;
- + }
- +
- + script_pushint( st, 1 ); //Success return 1
- + return 0;
- + }
- +
- /*==========================================
- * Custom Fonts
- *------------------------------------------*/
- @@ -16283,5 +16401,6 @@
- //brAthena Modificações
- BUILDIN_DEF(sc_check,"i"),
- BUILDIN_DEF(makerune,"i"),
- + BUILDIN_DEF(showvend, "si?" ),
- {NULL,NULL,NULL},
- };
- Index: src/map/vending.c
- ===================================================================
- --- src/map/vending.c (revision 1177)
- +++ src/map/vending.c (working copy)
- @@ -15,6 +15,7 @@
- #include "skill.h"
- #include "battle.h"
- #include "log.h"
- +#include "npc.h"
- #include <stdio.h>
- #include <string.h>
- @@ -47,7 +48,24 @@
- void vending_vendinglistreq(struct map_session_data* sd, int id)
- {
- struct map_session_data* vsd;
- + struct npc_data *nd_sd;
- nullpo_retv(sd);
- +
- +if( nd_sd = (TBL_NPC*) map_id2bl( id ) ) { //It's an NPC
- + if( nd_sd->vend.vends == true ) {
- + char event_name[64 + 23 + 1];
- + if( nd_sd->subtype == CASHSHOP ) //Act as if it was clicked
- + npc_click( sd, nd_sd );
- +if( nd_sd->subtype == SHOP ) //Open Buy-Windows directly
- + npc_buysellsel( sd, nd_sd->bl.id, 0 );
- +if( nd_sd->subtype == SCRIPT ) { //Trigger OnVendingClick event
- + sprintf( event_name, "%s::OnVendingClick", &nd_sd->name );
- + npc_event( sd, event_name, 0 );
- + return;
- + }
- + }
- + return; //WARP will just return
- + }
- if( (vsd = map_id2sd(id)) == NULL )
- return;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement