- Added support for NPC with different sizes (setnpcdisplay).
git-svn-id: https://svn.code.sf.net/p/rathena/svn/trunk@12744 54d463be-8e91-2dee-dedb-b68131a5f0ec
This commit is contained in:
parent
4ced695e7e
commit
2da8086509
@ -4931,12 +4931,14 @@ complete the effect.
|
|||||||
|
|
||||||
---------------------------------------
|
---------------------------------------
|
||||||
|
|
||||||
|
*setnpcdisplay("<npc name>", "<display name>", <class id>, <size>)
|
||||||
*setnpcdisplay("<npc name>", "<display name>", <class id>)
|
*setnpcdisplay("<npc name>", "<display name>", <class id>)
|
||||||
*setnpcdisplay("<npc name>", "<display name>")
|
*setnpcdisplay("<npc name>", "<display name>")
|
||||||
*setnpcdisplay("<npc name>", <class id>)
|
*setnpcdisplay("<npc name>", <class id>)
|
||||||
|
|
||||||
Changes the display name and/or display class of the target npc.
|
Changes the display name and/or display class of the target npc.
|
||||||
Returns 0 is successful, 1 if the npc does not exist.
|
Returns 0 is successful, 1 if the npc does not exist.
|
||||||
|
Size is 0 = norma 1 = small 2 = big.
|
||||||
|
|
||||||
Since trunk r11779
|
Since trunk r11779
|
||||||
|
|
||||||
|
@ -1017,7 +1017,7 @@ int clif_spawn(struct block_list *bl)
|
|||||||
else if(sd->state.size==1)
|
else if(sd->state.size==1)
|
||||||
clif_specialeffect(bl,421,AREA);
|
clif_specialeffect(bl,421,AREA);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case BL_MOB:
|
case BL_MOB:
|
||||||
{
|
{
|
||||||
TBL_MOB *md = ((TBL_MOB*)bl);
|
TBL_MOB *md = ((TBL_MOB*)bl);
|
||||||
@ -1026,7 +1026,16 @@ int clif_spawn(struct block_list *bl)
|
|||||||
else if(md->special_state.size==1)
|
else if(md->special_state.size==1)
|
||||||
clif_specialeffect(&md->bl,421,AREA);
|
clif_specialeffect(&md->bl,421,AREA);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
case BL_NPC:
|
||||||
|
{
|
||||||
|
TBL_NPC *nd = ((TBL_NPC*)bl);
|
||||||
|
if( nd->size == 2 )
|
||||||
|
clif_specialeffect(&nd->bl,423,AREA);
|
||||||
|
else if( nd->size == 1 )
|
||||||
|
clif_specialeffect(&nd->bl,421,AREA);
|
||||||
|
}
|
||||||
|
break;
|
||||||
case BL_PET:
|
case BL_PET:
|
||||||
if (vd->head_bottom)
|
if (vd->head_bottom)
|
||||||
clif_pet_equip_area((TBL_PET*)bl); // needed to display pet equip properly
|
clif_pet_equip_area((TBL_PET*)bl); // needed to display pet equip properly
|
||||||
@ -3402,6 +3411,10 @@ void clif_getareachar_unit(struct map_session_data* sd,struct block_list *bl)
|
|||||||
TBL_NPC* nd = (TBL_NPC*)bl;
|
TBL_NPC* nd = (TBL_NPC*)bl;
|
||||||
if( nd->chat_id )
|
if( nd->chat_id )
|
||||||
clif_dispchat((struct chat_data*)map_id2bl(nd->chat_id),sd->fd);
|
clif_dispchat((struct chat_data*)map_id2bl(nd->chat_id),sd->fd);
|
||||||
|
if( nd->size == 2 )
|
||||||
|
clif_specialeffect_single(bl,423,sd->fd);
|
||||||
|
else if( nd->size == 1 )
|
||||||
|
clif_specialeffect_single(bl,421,sd->fd);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case BL_MOB:
|
case BL_MOB:
|
||||||
@ -9200,8 +9213,6 @@ void clif_parse_UseSkillToId(int fd, struct map_session_data *sd)
|
|||||||
|
|
||||||
if (skilllv < 1) skilllv = 1; //No clue, I have seen the client do this with guild skills :/ [Skotlex]
|
if (skilllv < 1) skilllv = 1; //No clue, I have seen the client do this with guild skills :/ [Skotlex]
|
||||||
|
|
||||||
//Whether skill fails or not is irrelevant, the char ain't idle. [Skotlex]
|
|
||||||
sd->idletime = last_tick;
|
|
||||||
|
|
||||||
tmp = skill_get_inf(skillnum);
|
tmp = skill_get_inf(skillnum);
|
||||||
if (tmp&INF_GROUND_SKILL || !tmp)
|
if (tmp&INF_GROUND_SKILL || !tmp)
|
||||||
@ -9212,6 +9223,9 @@ void clif_parse_UseSkillToId(int fd, struct map_session_data *sd)
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Whether skill fails or not is irrelevant, the char ain't idle. [Skotlex]
|
||||||
|
sd->idletime = last_tick;
|
||||||
|
|
||||||
if (pc_cant_act(sd))
|
if (pc_cant_act(sd))
|
||||||
return;
|
return;
|
||||||
if (pc_issit(sd))
|
if (pc_issit(sd))
|
||||||
|
@ -36,6 +36,8 @@ struct npc_data {
|
|||||||
int chat_id;
|
int chat_id;
|
||||||
unsigned int next_walktime;
|
unsigned int next_walktime;
|
||||||
|
|
||||||
|
unsigned size : 2;
|
||||||
|
|
||||||
void* chatdb; // pointer to a npc_parse struct (see npc_chat.c)
|
void* chatdb; // pointer to a npc_parse struct (see npc_chat.c)
|
||||||
enum npc_subtype subtype;
|
enum npc_subtype subtype;
|
||||||
union {
|
union {
|
||||||
|
@ -11648,6 +11648,7 @@ BUILDIN_FUNC(charisalpha)
|
|||||||
/// Changes the display name and/or display class of the npc.
|
/// Changes the display name and/or display class of the npc.
|
||||||
/// Returns 0 is successful, 1 if the npc does not exist.
|
/// Returns 0 is successful, 1 if the npc does not exist.
|
||||||
///
|
///
|
||||||
|
/// setnpcdisplay("<npc name>", "<new display name>", <new class id>, <new size>) -> <int>
|
||||||
/// setnpcdisplay("<npc name>", "<new display name>", <new class id>) -> <int>
|
/// setnpcdisplay("<npc name>", "<new display name>", <new class id>) -> <int>
|
||||||
/// setnpcdisplay("<npc name>", "<new display name>") -> <int>
|
/// setnpcdisplay("<npc name>", "<new display name>") -> <int>
|
||||||
/// setnpcdisplay("<npc name>", <new class id>) -> <int>
|
/// setnpcdisplay("<npc name>", <new class id>) -> <int>
|
||||||
@ -11655,13 +11656,19 @@ BUILDIN_FUNC(setnpcdisplay)
|
|||||||
{
|
{
|
||||||
const char* name;
|
const char* name;
|
||||||
const char* newname = NULL;
|
const char* newname = NULL;
|
||||||
int class_ = -1;
|
int class_ = -1, size = -1;
|
||||||
struct script_data* data;
|
struct script_data* data;
|
||||||
struct npc_data* nd;
|
struct npc_data* nd;
|
||||||
|
|
||||||
name = script_getstr(st,2);
|
name = script_getstr(st,2);
|
||||||
data = script_getdata(st,3);
|
data = script_getdata(st,3);
|
||||||
get_val(st, data);
|
get_val(st, data);
|
||||||
|
if( script_hasdata(st,5) )
|
||||||
|
{
|
||||||
|
newname = conv_str(st,data);
|
||||||
|
class_ = script_getnum(st,4);
|
||||||
|
size = script_getnum(st,5);
|
||||||
|
}
|
||||||
if( script_hasdata(st,4) )
|
if( script_hasdata(st,4) )
|
||||||
{
|
{
|
||||||
newname = conv_str(st,data);
|
newname = conv_str(st,data);
|
||||||
@ -11692,8 +11699,20 @@ BUILDIN_FUNC(setnpcdisplay)
|
|||||||
// update npc
|
// update npc
|
||||||
if( newname )
|
if( newname )
|
||||||
npc_setdisplayname(nd, newname);
|
npc_setdisplayname(nd, newname);
|
||||||
if( class_ != -1 )
|
|
||||||
|
if( size != -1 && size != nd->size )
|
||||||
|
nd->size = size;
|
||||||
|
else
|
||||||
|
size = -1;
|
||||||
|
|
||||||
|
if( class_ != -1 && nd->class_ == class_ )
|
||||||
npc_setclass(nd, class_);
|
npc_setclass(nd, class_);
|
||||||
|
else if( size != -1 )
|
||||||
|
{ // Required to update the visual size
|
||||||
|
clif_clearunit_area(&nd->bl, 0);
|
||||||
|
clif_spawn(&nd->bl);
|
||||||
|
}
|
||||||
|
|
||||||
script_pushint(st,0);
|
script_pushint(st,0);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user