- Modified script commands atcommand/charcommand to execute even if there isn't a player attached. They'll use a dummy player data with the same position/name as the script's owner (usually an npc)
git-svn-id: https://svn.code.sf.net/p/rathena/svn/trunk@5738 54d463be-8e91-2dee-dedb-b68131a5f0ec
This commit is contained in:
parent
e324977ed8
commit
323a04f86d
@ -5,6 +5,10 @@ IF YOU HAVE A WORKING AND TESTED BUGFIX PUT IT INTO STABLE AS WELL AS TRUNK. EV
|
|||||||
GOES INTO TRUNK AND WILL BE MERGED INTO STABLE BY VALARIS AND WIZPUTER. -- VALARIS
|
GOES INTO TRUNK AND WILL BE MERGED INTO STABLE BY VALARIS AND WIZPUTER. -- VALARIS
|
||||||
|
|
||||||
2006/03/24
|
2006/03/24
|
||||||
|
* Modified script commands atcommand/charcommand to execute even if there
|
||||||
|
isn't a player attached. They'll use a dummy player data with the same
|
||||||
|
position/name as the script's owner (usually an npc). Be careful when using
|
||||||
|
this as the result of some @/# commands may be unexpected! [Skotlex]
|
||||||
* Some cleaning around the return to egg code. Pets should stop duplicating
|
* Some cleaning around the return to egg code. Pets should stop duplicating
|
||||||
now. [Skotlex]
|
now. [Skotlex]
|
||||||
* Some cleaning of the egg hatching routine to prevent spawning the pet if
|
* Some cleaning of the egg hatching routine to prevent spawning the pet if
|
||||||
|
@ -8423,28 +8423,53 @@ int buildin_nude(struct script_state *st)
|
|||||||
|
|
||||||
int buildin_atcommand(struct script_state *st)
|
int buildin_atcommand(struct script_state *st)
|
||||||
{
|
{
|
||||||
struct map_session_data *sd;
|
struct map_session_data *sd=NULL;
|
||||||
char *cmd;
|
char *cmd;
|
||||||
|
|
||||||
sd = script_rid2sd(st);
|
|
||||||
if (!sd)
|
|
||||||
return 0;
|
|
||||||
cmd = conv_str(st,& (st->stack->stack_data[st->start+2]));
|
cmd = conv_str(st,& (st->stack->stack_data[st->start+2]));
|
||||||
is_atcommand(sd->fd, sd, cmd, 99);
|
if (st->rid)
|
||||||
|
sd = script_rid2sd(st);
|
||||||
|
|
||||||
|
if (sd) is_atcommand(sd->fd, sd, cmd, 99);
|
||||||
|
else { //Use a dummy character.
|
||||||
|
struct map_session_data dummy_sd;
|
||||||
|
struct block_list *bl = NULL;
|
||||||
|
memset(&dummy_sd, 0, sizeof(struct map_session_data));
|
||||||
|
if (st->oid) bl = map_id2bl(st->oid);
|
||||||
|
if (bl) {
|
||||||
|
memcpy(&dummy_sd.bl, bl, sizeof(struct block_list));
|
||||||
|
if (bl->type == BL_NPC)
|
||||||
|
strncpy(dummy_sd.status.name, ((TBL_NPC*)bl)->name, NAME_LENGTH);
|
||||||
|
}
|
||||||
|
is_atcommand(0, &dummy_sd, cmd, 99);
|
||||||
|
}
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
int buildin_charcommand(struct script_state *st)
|
int buildin_charcommand(struct script_state *st)
|
||||||
{
|
{
|
||||||
struct map_session_data *sd;
|
struct map_session_data *sd=NULL;
|
||||||
char *cmd;
|
char *cmd;
|
||||||
|
|
||||||
sd = script_rid2sd(st);
|
|
||||||
if (!sd)
|
|
||||||
return 0;
|
|
||||||
cmd = conv_str(st,& (st->stack->stack_data[st->start+2]));
|
cmd = conv_str(st,& (st->stack->stack_data[st->start+2]));
|
||||||
is_charcommand(sd->fd, sd, cmd, 99);
|
|
||||||
|
if (st->rid)
|
||||||
|
sd = script_rid2sd(st);
|
||||||
|
|
||||||
|
if (sd) is_charcommand(sd->fd, sd, cmd, 99);
|
||||||
|
else { //Use a dummy character.
|
||||||
|
struct map_session_data dummy_sd;
|
||||||
|
struct block_list *bl = NULL;
|
||||||
|
memset(&dummy_sd, 0, sizeof(struct map_session_data));
|
||||||
|
if (st->oid) bl = map_id2bl(st->oid);
|
||||||
|
if (bl) {
|
||||||
|
memcpy(&dummy_sd.bl, bl, sizeof(struct block_list));
|
||||||
|
if (bl->type == BL_NPC)
|
||||||
|
strncpy(dummy_sd.status.name, ((TBL_NPC*)bl)->name, NAME_LENGTH);
|
||||||
|
}
|
||||||
|
is_charcommand(0, &dummy_sd, cmd, 99);
|
||||||
|
}
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user