- Added support to Cash Shop for script command callshop
- Fixed a bug in OnTouchNPC - Cleanup in barricade code. git-svn-id: https://svn.code.sf.net/p/rathena/svn/trunk@12896 54d463be-8e91-2dee-dedb-b68131a5f0ec
This commit is contained in:
parent
59d67d996b
commit
fc312a5088
@ -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));
|
safestrncpy(barricade->npc_event, event, sizeof(barricade->npc_event));
|
||||||
barricade->amount = 0;
|
barricade->amount = 0;
|
||||||
barricade->killable = killable;
|
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++ )
|
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;
|
md->barricade = barricade;
|
||||||
}
|
}
|
||||||
|
|
||||||
if( !barricade->walkable ) map_setcell(m, x1, y1, CELL_WALKABLE, false);
|
if( !barricade->walkable )
|
||||||
map_setcell(m, x1, y1, CELL_SHOOTABLE, barricade->shootable);
|
{
|
||||||
|
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);
|
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);
|
mob_barricade_nextxy(barricade->x, barricade->y, barricade->dir, i, &x1, &y1);
|
||||||
|
|
||||||
if( !barricade->walkable ) map_setcell(barricade->m, x1, y1, CELL_WALKABLE, true);
|
if( !barricade->shootable )
|
||||||
map_setcell(barricade->m, x1, y1, CELL_SHOOTABLE, !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);
|
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);
|
mob_barricade_nextxy(barricade->x, barricade->y, barricade->dir, i, &x1, &y1);
|
||||||
|
|
||||||
if( !barricade->walkable ) map_setcell(barricade->m, x1, y1, CELL_WALKABLE, true);
|
if( !barricade->shootable )
|
||||||
map_setcell(barricade->m, x1, y1, CELL_SHOOTABLE, !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);
|
clif_changemapcell(0, barricade->m, x1, y1, map_getcell(barricade->m, x1, y1, CELL_GETTYPE), ALL_SAMEMAP);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -781,7 +781,7 @@ int npc_touch_areanpc(struct map_session_data* sd, int m, int x, int y)
|
|||||||
// Return 1 if Warped
|
// Return 1 if Warped
|
||||||
int npc_touch_areanpc2(struct mob_data *md)
|
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];
|
char eventname[NAME_LENGTH*2+3];
|
||||||
struct event_data* ev;
|
struct event_data* ev;
|
||||||
int xs, ys;
|
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 )
|
if( (ev = (struct event_data*)strdb_get(ev_db, eventname)) == NULL || ev->nd == NULL )
|
||||||
break; // No OnTouchNPC Event
|
break; // No OnTouchNPC Event
|
||||||
md->areanpc_id = map[m].npc[i]->bl.id;
|
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);
|
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;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -12132,23 +12132,25 @@ BUILDIN_FUNC(callshop)
|
|||||||
if( script_hasdata(st,3) )
|
if( script_hasdata(st,3) )
|
||||||
flag = script_getnum(st,3);
|
flag = script_getnum(st,3);
|
||||||
nd = npc_name2id(shopname);
|
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);
|
ShowError("buildin_callshop: Shop [%s] not found (or NPC is not shop type)\n", shopname);
|
||||||
script_pushint(st,0);
|
script_pushint(st,0);
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
switch (flag) {
|
if( nd->subtype == SHOP )
|
||||||
case 1: //Buy window
|
{
|
||||||
npc_buysellsel(sd,nd->bl.id,0);
|
switch( flag )
|
||||||
break;
|
{
|
||||||
case 2: //Sell window
|
case 1: npc_buysellsel(sd,nd->bl.id,0); break; //Buy window
|
||||||
npc_buysellsel(sd,nd->bl.id,1);
|
case 2: npc_buysellsel(sd,nd->bl.id,1); break; //Sell window
|
||||||
break;
|
default: clif_npcbuysell(sd,nd->bl.id); break; //Show menu
|
||||||
default: //Show menu
|
}
|
||||||
clif_npcbuysell(sd,nd->bl.id);
|
|
||||||
break;
|
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
clif_cashshop_show(sd, nd);
|
||||||
|
|
||||||
sd->npc_shopid = nd->bl.id;
|
sd->npc_shopid = nd->bl.id;
|
||||||
script_pushint(st,1);
|
script_pushint(st,1);
|
||||||
return 0;
|
return 0;
|
||||||
@ -13636,7 +13638,7 @@ struct script_function buildin_func[] = {
|
|||||||
BUILDIN_DEF(unequip,"i"), // unequip command [Spectre]
|
BUILDIN_DEF(unequip,"i"), // unequip command [Spectre]
|
||||||
BUILDIN_DEF(getstrlen,"s"), //strlen [Valaris]
|
BUILDIN_DEF(getstrlen,"s"), //strlen [Valaris]
|
||||||
BUILDIN_DEF(charisalpha,"si"), //isalpha [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(compare,"ss"), // Lordalfa - To bring strstr to scripting Engine.
|
||||||
BUILDIN_DEF(getiteminfo,"ii"), //[Lupus] returns Items Buy / sell Price, etc info
|
BUILDIN_DEF(getiteminfo,"ii"), //[Lupus] returns Items Buy / sell Price, etc info
|
||||||
BUILDIN_DEF(setiteminfo,"iii"), //[Lupus] set Items Buy / sell Price, etc info
|
BUILDIN_DEF(setiteminfo,"iii"), //[Lupus] set Items Buy / sell Price, etc info
|
||||||
|
@ -6394,7 +6394,7 @@ int status_change_end(struct block_list* bl, enum sc_type type, int tid)
|
|||||||
if ((sce->val1&0xFFFF) == CG_MOONLIT)
|
if ((sce->val1&0xFFFF) == CG_MOONLIT)
|
||||||
clif_status_change(bl,SI_MOONLIT,0);
|
clif_status_change(bl,SI_MOONLIT,0);
|
||||||
|
|
||||||
status_change_end(bl,SC_LONGING,-1);
|
status_change_end(bl,SC_LONGING,-1);
|
||||||
break;
|
break;
|
||||||
case SC_NOCHAT:
|
case SC_NOCHAT:
|
||||||
if (sd && sd->status.manner < 0 && tid != -1)
|
if (sd && sd->status.manner < 0 && tid != -1)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user