diff options
author | zephyrus <zephyrus@54d463be-8e91-2dee-dedb-b68131a5f0ec> | 2008-06-29 15:16:51 +0000 |
---|---|---|
committer | zephyrus <zephyrus@54d463be-8e91-2dee-dedb-b68131a5f0ec> | 2008-06-29 15:16:51 +0000 |
commit | 386b2af17167e5dafcbbc892dba2866c22b0934b (patch) | |
tree | e0285c471d73eec77bfed84bcf3ec61d6ea643d2 /src/map | |
parent | bf559662f0d0c0d9cbdd3c3f65990b6032472e33 (diff) | |
download | hercules-386b2af17167e5dafcbbc892dba2866c22b0934b.tar.gz hercules-386b2af17167e5dafcbbc892dba2866c22b0934b.tar.bz2 hercules-386b2af17167e5dafcbbc892dba2866c22b0934b.tar.xz hercules-386b2af17167e5dafcbbc892dba2866c22b0934b.zip |
- Added support to Cash Shop for script command callshop
- Fixed a bug in OnTouchNPC
- Cleanup in barricade code.
git-svn-id: https://rathena.svn.sourceforge.net/svnroot/rathena/trunk@12896 54d463be-8e91-2dee-dedb-b68131a5f0ec
Diffstat (limited to 'src/map')
-rw-r--r-- | src/map/mob.c | 29 | ||||
-rw-r--r-- | src/map/npc.c | 4 | ||||
-rw-r--r-- | src/map/script.c | 26 | ||||
-rw-r--r-- | src/map/status.c | 2 |
4 files changed, 39 insertions, 22 deletions
diff --git a/src/map/mob.c b/src/map/mob.c index adc8d8c83..5ff325ad1 100644 --- a/src/map/mob.c +++ b/src/map/mob.c @@ -545,8 +545,12 @@ short mob_barricade_build(short m, short x, short y, const char* mobname, short safestrncpy(barricade->npc_event, event, sizeof(barricade->npc_event)); barricade->amount = 0; barricade->killable = killable; - barricade->shootable = shootable; - barricade->walkable = walkable; + + // A protection just in case setting a walkable - non shootable + if( (barricade->walkable = walkable) == true ) + barricade->shootable = true; + else + barricade->shootable = shootable; for( i = 0; i < count; i++ ) { @@ -567,8 +571,11 @@ short mob_barricade_build(short m, short x, short y, const char* mobname, short md->barricade = barricade; } - if( !barricade->walkable ) map_setcell(m, x1, y1, CELL_WALKABLE, false); - map_setcell(m, x1, y1, CELL_SHOOTABLE, barricade->shootable); + if( !barricade->walkable ) + { + map_setcell(m, x1, y1, CELL_WALKABLE, false); + map_setcell(m, x1, y1, CELL_SHOOTABLE, barricade->shootable); + } clif_changemapcell(0, m, x1, y1, map_getcell(barricade->m, x1, y1, CELL_GETTYPE), ALL_SAMEMAP); } @@ -623,8 +630,11 @@ static void mob_barricade_break(struct barricade_data *barricade, struct block_l { mob_barricade_nextxy(barricade->x, barricade->y, barricade->dir, i, &x1, &y1); - if( !barricade->walkable ) map_setcell(barricade->m, x1, y1, CELL_WALKABLE, true); - map_setcell(barricade->m, x1, y1, CELL_SHOOTABLE, !barricade->shootable); + if( !barricade->shootable ) + map_setcell(barricade->m, x1, y1, CELL_SHOOTABLE, true); + if( !barricade->walkable ) + map_setcell(barricade->m, x1, y1, CELL_WALKABLE, true); + clif_changemapcell(0, barricade->m, x1, y1, map_getcell(barricade->m, x1, y1, CELL_GETTYPE), ALL_SAMEMAP); } @@ -685,8 +695,11 @@ void mod_barricade_clearall(void) { mob_barricade_nextxy(barricade->x, barricade->y, barricade->dir, i, &x1, &y1); - if( !barricade->walkable ) map_setcell(barricade->m, x1, y1, CELL_WALKABLE, true); - map_setcell(barricade->m, x1, y1, CELL_SHOOTABLE, !barricade->shootable); + if( !barricade->shootable ) + map_setcell(barricade->m, x1, y1, CELL_SHOOTABLE, true); + if( !barricade->walkable ) + map_setcell(barricade->m, x1, y1, CELL_WALKABLE, true); + clif_changemapcell(0, barricade->m, x1, y1, map_getcell(barricade->m, x1, y1, CELL_GETTYPE), ALL_SAMEMAP); } } diff --git a/src/map/npc.c b/src/map/npc.c index 8ec20c487..c987bd5b8 100644 --- a/src/map/npc.c +++ b/src/map/npc.c @@ -781,7 +781,7 @@ int npc_touch_areanpc(struct map_session_data* sd, int m, int x, int y) // Return 1 if Warped int npc_touch_areanpc2(struct mob_data *md) { - int i, m = md->bl.m, x = md->bl.x, y = md->bl.y; + int i, m = md->bl.m, x = md->bl.x, y = md->bl.y, id; char eventname[NAME_LENGTH*2+3]; struct event_data* ev; int xs, ys; @@ -825,7 +825,9 @@ int npc_touch_areanpc2(struct mob_data *md) if( (ev = (struct event_data*)strdb_get(ev_db, eventname)) == NULL || ev->nd == NULL ) break; // No OnTouchNPC Event md->areanpc_id = map[m].npc[i]->bl.id; + id = md->bl.id; // Stores Unique ID run_script(ev->nd->u.scr.script, ev->pos, md->bl.id, ev->nd->bl.id); + if( map_id2md(id) == NULL ) return 1; // Not Warped, but killed break; } diff --git a/src/map/script.c b/src/map/script.c index 8781aaa92..0f3018ec8 100644 --- a/src/map/script.c +++ b/src/map/script.c @@ -12132,23 +12132,25 @@ BUILDIN_FUNC(callshop) if( script_hasdata(st,3) ) flag = script_getnum(st,3); nd = npc_name2id(shopname); - if (!nd || nd->bl.type!=BL_NPC || nd->subtype!=SHOP) { + if( !nd || nd->bl.type != BL_NPC || (nd->subtype != SHOP && nd->subtype != CASHSHOP) ) + { ShowError("buildin_callshop: Shop [%s] not found (or NPC is not shop type)\n", shopname); script_pushint(st,0); return 1; } - switch (flag) { - case 1: //Buy window - npc_buysellsel(sd,nd->bl.id,0); - break; - case 2: //Sell window - npc_buysellsel(sd,nd->bl.id,1); - break; - default: //Show menu - clif_npcbuysell(sd,nd->bl.id); - break; + if( nd->subtype == SHOP ) + { + switch( flag ) + { + case 1: npc_buysellsel(sd,nd->bl.id,0); break; //Buy window + case 2: npc_buysellsel(sd,nd->bl.id,1); break; //Sell window + default: clif_npcbuysell(sd,nd->bl.id); break; //Show menu + } } + else + clif_cashshop_show(sd, nd); + sd->npc_shopid = nd->bl.id; script_pushint(st,1); return 0; @@ -13636,7 +13638,7 @@ struct script_function buildin_func[] = { BUILDIN_DEF(unequip,"i"), // unequip command [Spectre] BUILDIN_DEF(getstrlen,"s"), //strlen [Valaris] BUILDIN_DEF(charisalpha,"si"), //isalpha [Valaris] - BUILDIN_DEF(setnpcdisplay,"sv?"), + BUILDIN_DEF(setnpcdisplay,"sv??"), BUILDIN_DEF(compare,"ss"), // Lordalfa - To bring strstr to scripting Engine. BUILDIN_DEF(getiteminfo,"ii"), //[Lupus] returns Items Buy / sell Price, etc info BUILDIN_DEF(setiteminfo,"iii"), //[Lupus] set Items Buy / sell Price, etc info diff --git a/src/map/status.c b/src/map/status.c index c1532c64f..02714d82c 100644 --- a/src/map/status.c +++ b/src/map/status.c @@ -6394,7 +6394,7 @@ int status_change_end(struct block_list* bl, enum sc_type type, int tid) if ((sce->val1&0xFFFF) == CG_MOONLIT) clif_status_change(bl,SI_MOONLIT,0); - status_change_end(bl,SC_LONGING,-1); + status_change_end(bl,SC_LONGING,-1); break; case SC_NOCHAT: if (sd && sd->status.manner < 0 && tid != -1) |