- Add instance_enter2 script command
This commit is contained in:
parent
6bf1c27023
commit
1f426bcb07
@ -7497,6 +7497,18 @@ The command returns 0 upon success, and these values upon failure:
|
||||
|
||||
---------------------------------------
|
||||
|
||||
*instance_enter2("<instance name>",<x>,<y>);
|
||||
|
||||
Warps player to the specified instance after the script terminates. The map
|
||||
are located in 'db/(pre-)re/instance_db.txt'. Coordinates is <x> and <y>.
|
||||
|
||||
The command returns 0 upon success, and these values upon failure:
|
||||
1: Party not found.
|
||||
2: Party does not have an instance.
|
||||
3: Other errors (invalid instance name, instance doesn't match with party).
|
||||
|
||||
---------------------------------------
|
||||
|
||||
*instance_npcname("<npc name>"{,<instance id>})
|
||||
|
||||
Returns the unique name of the instanced script. If no ID is specified,
|
||||
|
@ -484,6 +484,19 @@ int instance_destroy(short instance_id)
|
||||
* Allows a user to enter an instance
|
||||
*------------------------------------------*/
|
||||
int instance_enter(struct map_session_data *sd, const char *name)
|
||||
{
|
||||
struct instance_db *db = instance_searchname_db(name);
|
||||
|
||||
if(db == NULL)
|
||||
return 3;
|
||||
|
||||
return instance_enter_position(sd, name, db->enter.x, db->enter.y);
|
||||
}
|
||||
|
||||
/*==========================================
|
||||
* Warp a user into instance
|
||||
*------------------------------------------*/
|
||||
int instance_enter_position(struct map_session_data *sd, const char *name, short x, short y)
|
||||
{
|
||||
struct instance_data *im;
|
||||
struct instance_db *db = instance_searchname_db(name);
|
||||
@ -517,7 +530,7 @@ int instance_enter(struct map_session_data *sd, const char *name)
|
||||
if((m = instance_mapname2mapid(db->enter.mapname, p->instance_id)) < 0)
|
||||
return 3;
|
||||
|
||||
if(pc_setpos(sd, map_id2index(m), db->enter.x, db->enter.y, 0))
|
||||
if(pc_setpos(sd, map_id2index(m), x, y, 0))
|
||||
return 3;
|
||||
|
||||
// If there was an idle timer, let's stop it
|
||||
|
@ -33,6 +33,7 @@ extern struct instance_data instance_data[MAX_INSTANCE_DATA];
|
||||
int instance_create(int party_id, const char *name);
|
||||
int instance_destroy(short instance_id);
|
||||
int instance_enter(struct map_session_data *sd, const char *name);
|
||||
int instance_enter_position(struct map_session_data *sd, const char *name, short x, short y);
|
||||
int instance_reqinfo(struct map_session_data *sd, short instance_id);
|
||||
int instance_addusers(short instance_id);
|
||||
int instance_delusers(short instance_id);
|
||||
|
@ -16909,6 +16909,27 @@ BUILDIN_FUNC(instance_enter)
|
||||
|
||||
}
|
||||
|
||||
/*==========================================
|
||||
* Warps player to instance at the specified coordinates [CairoLee]
|
||||
* Results:
|
||||
* 0: Success
|
||||
* 1: Character not in party
|
||||
* 2: Party doesn't have instance
|
||||
* 3: Other errors (instance not in DB, instance doesn't match with party, etc.)
|
||||
*------------------------------------------*/
|
||||
BUILDIN_FUNC(instance_enter2)
|
||||
{
|
||||
struct map_session_data *sd;
|
||||
|
||||
if((sd = script_rid2sd(st)) != NULL){
|
||||
script_pushint(st,instance_enter_position(sd,script_getstr(st, 2),script_getnum(st, 3),script_getnum(st, 4)));
|
||||
}
|
||||
else
|
||||
return 1;
|
||||
return SCRIPT_CMD_SUCCESS;
|
||||
|
||||
}
|
||||
|
||||
/*==========================================
|
||||
* Returns the name of a duplicated NPC
|
||||
*
|
||||
@ -19085,6 +19106,7 @@ struct script_function buildin_func[] = {
|
||||
BUILDIN_DEF(instance_destroy,"?"),
|
||||
BUILDIN_DEF(instance_id,""),
|
||||
BUILDIN_DEF(instance_enter,"s"),
|
||||
BUILDIN_DEF(instance_enter2,"sii"),
|
||||
BUILDIN_DEF(instance_npcname,"s?"),
|
||||
BUILDIN_DEF(instance_mapname,"s?"),
|
||||
BUILDIN_DEF(instance_warpall,"sii?"),
|
||||
|
Loading…
x
Reference in New Issue
Block a user