Compare commits
13 Commits
master
...
hotfix/iss
Author | SHA1 | Date | |
---|---|---|---|
![]() |
10e1b3a7fe | ||
![]() |
23d1183927 | ||
![]() |
15f28f1f9d | ||
![]() |
6d9b175a21 | ||
![]() |
8796135124 | ||
![]() |
d3764754e8 | ||
![]() |
3b31b31605 | ||
![]() |
293eef94a8 | ||
![]() |
f7486e71c1 | ||
![]() |
7cd69f40e8 | ||
![]() |
04dab1e9aa | ||
![]() |
e248246257 | ||
![]() |
22812b4de3 |
@ -4108,7 +4108,7 @@ There are also three special 'map names' you can use.
|
|||||||
|
|
||||||
---------------------------------------
|
---------------------------------------
|
||||||
|
|
||||||
*areawarp "<from map name>",<x1>,<y1>,<x2>,<y2>,"<to map name>",<x3>,<y3>{,<x4>,<y4>};
|
*areawarp "<from map name>",<x1>,<y1>,<x2>,<y2>,"<to map name>"{,<x3>,<y3>,<x4>,<y4>};
|
||||||
|
|
||||||
This command is similar to 'warp', however, it will not refer to the invoking
|
This command is similar to 'warp', however, it will not refer to the invoking
|
||||||
character, but instead, all characters within a specified area, defined by the
|
character, but instead, all characters within a specified area, defined by the
|
||||||
@ -4122,8 +4122,9 @@ shape, on the map called "place", will be affected, and warped to "place2" X 150
|
|||||||
Y 150
|
Y 150
|
||||||
|
|
||||||
areawarp "place",10,10,120,120,"place2",0,0;
|
areawarp "place",10,10,120,120,"place2",0,0;
|
||||||
|
areawarp "place",10,10,120,120,"place2";
|
||||||
|
|
||||||
By using ,0,0; as the destination coordinates it will take all the characters in
|
By using zeroes as the destination coordinates or leaving them out it will take all the characters in
|
||||||
the affected area to a random set of co-ordinates on "place2".
|
the affected area to a random set of co-ordinates on "place2".
|
||||||
|
|
||||||
areawarp "place",10,10,120,120,"place2",150,150,200,200;
|
areawarp "place",10,10,120,120,"place2",150,150,200,200;
|
||||||
@ -4131,8 +4132,13 @@ the affected area to a random set of co-ordinates on "place2".
|
|||||||
By using the optional x4 and y4 parameters, the destination coordinates will be a
|
By using the optional x4 and y4 parameters, the destination coordinates will be a
|
||||||
random place within the defined x3/y3-x4/y4 square.
|
random place within the defined x3/y3-x4/y4 square.
|
||||||
|
|
||||||
Like 'warp', areawarp will also explicitly warp characters randomly into the
|
There are also three special 'map names' you can use:
|
||||||
current map if you give the 'to map name' as "Random".
|
|
||||||
|
"Random" will warp the player randomly on the current map.
|
||||||
|
"Save" and "SavePoint" will warp the player back to their save point.
|
||||||
|
|
||||||
|
It is recommended that you do not supply any target coordinates if you use one of
|
||||||
|
these maps because they will be ignored anyway.
|
||||||
|
|
||||||
See also 'warp'.
|
See also 'warp'.
|
||||||
|
|
||||||
@ -4189,10 +4195,15 @@ warpguild "prontera",x,y,Guild_ID;
|
|||||||
*warppartner("<map name>",<x>,<y>);
|
*warppartner("<map name>",<x>,<y>);
|
||||||
|
|
||||||
This function will find the invoking character's marriage partner, if any, and
|
This function will find the invoking character's marriage partner, if any, and
|
||||||
warp them to the map and coordinates given. It will return 1 upon success and
|
warp them to the map and coordinates given. It will return true upon success and
|
||||||
0 if the partner is not online, the character is not married, or if there's no
|
false if the partner is not online, the character is not married, or if there's no
|
||||||
invoking character (no RID). 0,0 will, as usual, normally translate to random coordinates.
|
invoking character (no RID). 0,0 will, as usual, normally translate to random coordinates.
|
||||||
|
|
||||||
|
There are also three special 'map names' you can use.
|
||||||
|
|
||||||
|
"Random" will warp the player randomly on the current map.
|
||||||
|
"Save" and "SavePoint" will warp the player back to their save point.
|
||||||
|
|
||||||
---------------------------------------
|
---------------------------------------
|
||||||
|
|
||||||
*savepoint "<map name>",<x>,<y>{,{<range x>,<range y>,}<char_id>};
|
*savepoint "<map name>",<x>,<y>{,{<range x>,<range y>,}<char_id>};
|
||||||
@ -7200,6 +7211,11 @@ The obvious way of using this effectively would be to set up a waiting room for
|
|||||||
two characters to be warped onto a random PVP map for a one-on-one duel, for
|
two characters to be warped onto a random PVP map for a one-on-one duel, for
|
||||||
example.
|
example.
|
||||||
|
|
||||||
|
There are also three special 'map names' you can use.
|
||||||
|
|
||||||
|
"Random" will warp the player randomly on the current map.
|
||||||
|
"Save" and "SavePoint" will warp the player back to their save point.
|
||||||
|
|
||||||
---------------------------------------
|
---------------------------------------
|
||||||
|
|
||||||
*waitingroomkick "<NPC object name>" , "<character name>";
|
*waitingroomkick "<NPC object name>" , "<character name>";
|
||||||
@ -7324,23 +7340,31 @@ Examples:
|
|||||||
|
|
||||||
---------------------------------------
|
---------------------------------------
|
||||||
|
|
||||||
*mapwarp "<from map>","<to map>",<x>,<y>{,<type>,<ID>};
|
*mapwarp "<from map>","<to map>",{<x>,<y>,<type>,<ID>};
|
||||||
|
|
||||||
This command will collect all characters located on the From map and warp them
|
This command will collect all characters located on the <from map> and warp them
|
||||||
wholesale to the same point on the To map, or randomly distribute them there if
|
wholesale to the same point on the <to map>, or randomly distribute them there if
|
||||||
the coordinates are zero. "Random" is understood as a special To map name and
|
the coordinates are zero or left out.
|
||||||
will mean randomly shuffling everyone on the same map.
|
|
||||||
|
|
||||||
Optionally, a type and ID can be specified. Available types are:
|
Optionally, a <type> and <ID> can be specified. Available types are:
|
||||||
|
|
||||||
0 - Everyone
|
MAPWARP_ALL - Everyone
|
||||||
1 - Guild
|
MAPWARP_GUILD - Guild
|
||||||
2 - Party
|
MAPWARP_PARTY - Party
|
||||||
|
MAPWARP_CLAN - Clan
|
||||||
|
|
||||||
Example:
|
Example:
|
||||||
|
|
||||||
// Will warp all members of guild with ID 63 on map prontera to map alberta.
|
// Will warp all members of guild with ID 63 on map prontera to map alberta.
|
||||||
mapwarp "prontera","alberta",150,150,1,63;
|
mapwarp "prontera","alberta",150,150,MAPWARP_GUILD,63;
|
||||||
|
|
||||||
|
There are also three special 'map names' you can use for <to map>:
|
||||||
|
|
||||||
|
"Random" will warp the player randomly on the current map.
|
||||||
|
"Save" and "SavePoint" will warp the player back to their save point.
|
||||||
|
|
||||||
|
It is recommended that you do not supply any target coordinates if you use one of
|
||||||
|
these maps because they will be ignored anyway.
|
||||||
|
|
||||||
---------------------------------------
|
---------------------------------------
|
||||||
\\
|
\\
|
||||||
|
@ -161,6 +161,8 @@
|
|||||||
#define MAX_ACHIEVEMENT_DEPENDENTS 20 /// Maximum different dependents in achievement_db.yml
|
#define MAX_ACHIEVEMENT_DEPENDENTS 20 /// Maximum different dependents in achievement_db.yml
|
||||||
#define ACHIEVEMENT_NAME_LENGTH 50 /// Max Achievement Name length
|
#define ACHIEVEMENT_NAME_LENGTH 50 /// Max Achievement Name length
|
||||||
|
|
||||||
|
#define MAX_WARP_ATTEMPTS 1000 /// Max amount of attempts to randomly warp a character onto valid coordinates
|
||||||
|
|
||||||
enum item_types {
|
enum item_types {
|
||||||
IT_HEALING = 0,
|
IT_HEALING = 0,
|
||||||
IT_UNKNOWN, //1
|
IT_UNKNOWN, //1
|
||||||
|
@ -5887,19 +5887,20 @@ int pc_steal_coin(struct map_session_data *sd,struct block_list *target)
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*==========================================
|
/**
|
||||||
* Set's a player position.
|
* Set's a player position.
|
||||||
* @param sd
|
* @param sd: Player's data
|
||||||
* @param mapindex
|
* @param mapindex: Map index of destination
|
||||||
* @param x
|
* @param x: X location
|
||||||
* @param y
|
* @param y: Y location
|
||||||
* @param clrtype
|
* @param clrtype: Warp type
|
||||||
* @return SETPOS_OK Success
|
* @return SETPOS_OK Success
|
||||||
* SETPOS_MAPINDEX Invalid map index
|
* SETPOS_MAPINDEX Invalid map index
|
||||||
* SETPOS_NO_MAPSERVER Map not in this map-server, and failed to locate alternate map-server.
|
* SETPOS_NO_MAPSERVER Map not in this map-server, and failed to locate alternate map-server.
|
||||||
* SETPOS_AUTOTRADE Player is in autotrade state
|
* SETPOS_AUTOTRADE Player is in autotrade state
|
||||||
*------------------------------------------*/
|
* SETPOS_MAX_ATTEMPTS Maximum number of warp attempts met
|
||||||
enum e_setpos pc_setpos(struct map_session_data* sd, unsigned short mapindex, int x, int y, clr_type clrtype)
|
*/
|
||||||
|
enum e_setpos pc_setpos(struct map_session_data* sd, unsigned short mapindex, int16 x, int16 y, clr_type clrtype)
|
||||||
{
|
{
|
||||||
nullpo_retr(SETPOS_OK,sd);
|
nullpo_retr(SETPOS_OK,sd);
|
||||||
|
|
||||||
@ -6037,18 +6038,17 @@ enum e_setpos pc_setpos(struct map_session_data* sd, unsigned short mapindex, in
|
|||||||
}
|
}
|
||||||
|
|
||||||
if( x == 0 && y == 0 ) { // pick a random walkable cell
|
if( x == 0 && y == 0 ) { // pick a random walkable cell
|
||||||
int c=0;
|
int c = 0;
|
||||||
|
|
||||||
do {
|
do {
|
||||||
x = rnd()%(mapdata->xs-2)+1;
|
x = rnd()%(mapdata->xs-2)+1;
|
||||||
y = rnd()%(mapdata->ys-2)+1;
|
y = rnd()%(mapdata->ys-2)+1;
|
||||||
c++;
|
} while((map_getcell(m, x, y, CELL_CHKNOPASS) || (!battle_config.teleport_on_portal && npc_check_areanpc(1, m, x, y, 1))) && (c++) < MAX_WARP_ATTEMPTS);
|
||||||
|
|
||||||
if(c > (mapdata->xs * mapdata->ys)*3){ //force out
|
if (c == MAX_WARP_ATTEMPTS) {
|
||||||
ShowError("pc_setpos: couldn't found a valid coordinates for player '%s' (%d:%d) on (%s), preventing warp\n", sd->status.name, sd->status.account_id, sd->status.char_id, mapindex_id2name(mapindex));
|
ShowError("pc_setpos: Couldn't find valid coordinates for player '%s' (%d:%d) on (%s), preventing warp.\n", sd->status.name, sd->status.account_id, sd->status.char_id, mapindex_id2name(mapindex));
|
||||||
return SETPOS_OK; //preventing warp
|
return SETPOS_MAX_ATTEMPTS;
|
||||||
//break; //allow warp anyway
|
|
||||||
}
|
}
|
||||||
} while(map_getcell(m,x,y,CELL_CHKNOPASS) || (!battle_config.teleport_on_portal && npc_check_areanpc(1,m,x,y,1)));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (sd->state.vending && map_getcell(m,x,y,CELL_CHKNOVENDING)) {
|
if (sd->state.vending && map_getcell(m,x,y,CELL_CHKNOVENDING)) {
|
||||||
@ -6117,35 +6117,6 @@ enum e_setpos pc_setpos(struct map_session_data* sd, unsigned short mapindex, in
|
|||||||
return SETPOS_OK;
|
return SETPOS_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*==========================================
|
|
||||||
* Warp player sd to random location on current map.
|
|
||||||
* May fail if no walkable cell found (1000 attempts).
|
|
||||||
* Return:
|
|
||||||
* 0 = Success
|
|
||||||
* 1,2,3 = Fail
|
|
||||||
*------------------------------------------*/
|
|
||||||
char pc_randomwarp(struct map_session_data *sd, clr_type type)
|
|
||||||
{
|
|
||||||
int x,y,i=0;
|
|
||||||
|
|
||||||
nullpo_ret(sd);
|
|
||||||
|
|
||||||
struct map_data *mapdata = map_getmapdata(sd->bl.m);
|
|
||||||
|
|
||||||
if (mapdata->flag[MF_NOTELEPORT]) //Teleport forbidden
|
|
||||||
return 3;
|
|
||||||
|
|
||||||
do {
|
|
||||||
x = rnd()%(mapdata->xs-2)+1;
|
|
||||||
y = rnd()%(mapdata->ys-2)+1;
|
|
||||||
} while((map_getcell(sd->bl.m,x,y,CELL_CHKNOPASS) || (!battle_config.teleport_on_portal && npc_check_areanpc(1,sd->bl.m,x,y,1))) && (i++) < 1000);
|
|
||||||
|
|
||||||
if (i < 1000)
|
|
||||||
return pc_setpos(sd,mapdata->index,x,y,type);
|
|
||||||
|
|
||||||
return 3;
|
|
||||||
}
|
|
||||||
|
|
||||||
/*==========================================
|
/*==========================================
|
||||||
* Records a memo point at sd's current position
|
* Records a memo point at sd's current position
|
||||||
* pos - entry to replace, (-1: shift oldest entry out)
|
* pos - entry to replace, (-1: shift oldest entry out)
|
||||||
|
@ -1120,14 +1120,14 @@ void pc_clean_skilltree(struct map_session_data *sd);
|
|||||||
|
|
||||||
enum e_setpos{
|
enum e_setpos{
|
||||||
SETPOS_OK = 0,
|
SETPOS_OK = 0,
|
||||||
SETPOS_MAPINDEX = 1,
|
SETPOS_MAPINDEX,
|
||||||
SETPOS_NO_MAPSERVER = 2,
|
SETPOS_NO_MAPSERVER,
|
||||||
SETPOS_AUTOTRADE = 3
|
SETPOS_AUTOTRADE,
|
||||||
|
SETPOS_MAX_ATTEMPTS
|
||||||
};
|
};
|
||||||
|
|
||||||
enum e_setpos pc_setpos(struct map_session_data* sd, unsigned short mapindex, int x, int y, clr_type clrtype);
|
enum e_setpos pc_setpos(struct map_session_data* sd, unsigned short mapindex, int16 x, int16 y, clr_type clrtype);
|
||||||
void pc_setsavepoint(struct map_session_data *sd, short mapindex,int x,int y);
|
void pc_setsavepoint(struct map_session_data *sd, short mapindex,int x,int y);
|
||||||
char pc_randomwarp(struct map_session_data *sd,clr_type type);
|
|
||||||
bool pc_memo(struct map_session_data* sd, int pos);
|
bool pc_memo(struct map_session_data* sd, int pos);
|
||||||
|
|
||||||
char pc_checkadditem(struct map_session_data *sd, unsigned short nameid, int amount);
|
char pc_checkadditem(struct map_session_data *sd, unsigned short nameid, int amount);
|
||||||
|
@ -5564,13 +5564,38 @@ BUILDIN_FUNC(rand)
|
|||||||
return SCRIPT_CMD_SUCCESS;
|
return SCRIPT_CMD_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*==========================================
|
/**
|
||||||
* Warp sd to str,x,y or Random or SavePoint/Save
|
* Warp character based on given parameters
|
||||||
*------------------------------------------*/
|
* @param sd: Player data
|
||||||
|
* @param mapname: Map name/Warp type
|
||||||
|
* @param x: X location
|
||||||
|
* @param y: Y location
|
||||||
|
* @return SETPOS_OK on success and failure otherwise (see pc.h::e_setpos)
|
||||||
|
*/
|
||||||
|
static enum e_setpos buildin_warp_sub(struct map_session_data *sd, const char *mapname, int16 x, int16 y) {
|
||||||
|
nullpo_retr(SETPOS_OK, sd);
|
||||||
|
|
||||||
|
if (strcmp(mapname, "Random") == 0)
|
||||||
|
return pc_setpos(sd, sd->mapindex, 0, 0, CLR_TELEPORT);
|
||||||
|
else if (strcmp(mapname, "SavePoint") == 0 || strcmp(mapname, "Save") == 0)
|
||||||
|
return pc_setpos(sd, sd->status.save_point.map, sd->status.save_point.x, sd->status.save_point.y, CLR_TELEPORT);
|
||||||
|
else {
|
||||||
|
int16 index;
|
||||||
|
|
||||||
|
if (!(index = mapindex_name2id(mapname)))
|
||||||
|
return SETPOS_MAPINDEX;
|
||||||
|
|
||||||
|
return pc_setpos(sd, index, x, y, CLR_OUTSIGHT);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Warp a player
|
||||||
|
* warp "map name",x,y{,char id};
|
||||||
|
*/
|
||||||
BUILDIN_FUNC(warp)
|
BUILDIN_FUNC(warp)
|
||||||
{
|
{
|
||||||
int ret;
|
int16 x, y;
|
||||||
int x,y;
|
|
||||||
const char* str;
|
const char* str;
|
||||||
struct map_session_data* sd;
|
struct map_session_data* sd;
|
||||||
|
|
||||||
@ -5581,75 +5606,88 @@ BUILDIN_FUNC(warp)
|
|||||||
x = script_getnum(st,3);
|
x = script_getnum(st,3);
|
||||||
y = script_getnum(st,4);
|
y = script_getnum(st,4);
|
||||||
|
|
||||||
if(strcmp(str,"Random")==0)
|
if (buildin_warp_sub(sd, str, x, y))
|
||||||
ret = pc_randomwarp(sd,CLR_TELEPORT);
|
|
||||||
else if(strcmp(str,"SavePoint")==0 || strcmp(str,"Save")==0)
|
|
||||||
ret = pc_setpos(sd,sd->status.save_point.map,sd->status.save_point.x,sd->status.save_point.y,CLR_TELEPORT);
|
|
||||||
else
|
|
||||||
ret = pc_setpos(sd,mapindex_name2id(str),x,y,CLR_OUTSIGHT);
|
|
||||||
|
|
||||||
if( ret ) {
|
|
||||||
ShowError("buildin_warp: moving player '%s' to \"%s\",%d,%d failed.\n", sd->status.name, str, x, y);
|
|
||||||
return SCRIPT_CMD_FAILURE;
|
return SCRIPT_CMD_FAILURE;
|
||||||
}
|
|
||||||
|
|
||||||
return SCRIPT_CMD_SUCCESS;
|
return SCRIPT_CMD_SUCCESS;
|
||||||
}
|
}
|
||||||
/*==========================================
|
|
||||||
|
/**
|
||||||
* Warp a specified area
|
* Warp a specified area
|
||||||
*------------------------------------------*/
|
* @param bl: Player to warp
|
||||||
|
* @param va_list: map index, x2, xy2, x3, y3, warp type
|
||||||
|
* @return 0 on success and 1 in case of failure
|
||||||
|
*/
|
||||||
static int buildin_areawarp_sub(struct block_list *bl,va_list ap)
|
static int buildin_areawarp_sub(struct block_list *bl,va_list ap)
|
||||||
{
|
{
|
||||||
int x2,y2,x3,y3;
|
int16 x2,y2,x3,y3;
|
||||||
unsigned int index;
|
const char *mapname;
|
||||||
|
|
||||||
index = va_arg(ap,unsigned int);
|
x2 = (int16)va_arg(ap,int);
|
||||||
x2 = va_arg(ap,int);
|
y2 = (int16)va_arg(ap,int);
|
||||||
y2 = va_arg(ap,int);
|
x3 = (int16)va_arg(ap,int);
|
||||||
x3 = va_arg(ap,int);
|
y3 = (int16)va_arg(ap,int);
|
||||||
y3 = va_arg(ap,int);
|
mapname = va_arg(ap, char *);
|
||||||
|
|
||||||
if(index == 0)
|
if (x3 && y3) { // Warp within given area
|
||||||
pc_randomwarp((TBL_PC *)bl,CLR_TELEPORT);
|
int16 max, tx, ty, j = 0, m;
|
||||||
else if(x3 && y3) {
|
|
||||||
int max, tx, ty, j = 0;
|
|
||||||
int16 m;
|
|
||||||
|
|
||||||
m = map_mapindex2mapid(index);
|
m = map_mapname2mapid(mapname);
|
||||||
|
|
||||||
// choose a suitable max number of attempts
|
// choose a suitable max number of attempts
|
||||||
if( (max = (y3-y2+1)*(x3-x2+1)*3) > 1000 )
|
if( (max = (y3-y2+1)*(x3-x2+1)*3) > MAX_WARP_ATTEMPTS )
|
||||||
max = 1000;
|
max = MAX_WARP_ATTEMPTS;
|
||||||
|
|
||||||
// find a suitable map cell
|
// find a suitable map cell
|
||||||
do {
|
do {
|
||||||
tx = rnd()%(x3-x2+1)+x2;
|
tx = rnd()%(x3-x2+1)+x2;
|
||||||
ty = rnd()%(y3-y2+1)+y2;
|
ty = rnd()%(y3-y2+1)+y2;
|
||||||
j++;
|
} while ((map_getcell(m, tx, ty, CELL_CHKNOPASS) || (!battle_config.teleport_on_portal && npc_check_areanpc(1, m, tx, ty, 1))) && (j++) < max);
|
||||||
} while( map_getcell(m,tx,ty,CELL_CHKNOPASS) && j < max );
|
|
||||||
|
|
||||||
pc_setpos((TBL_PC *)bl,index,tx,ty,CLR_OUTSIGHT);
|
if (j == max){
|
||||||
|
return 1;
|
||||||
}
|
}
|
||||||
else
|
|
||||||
pc_setpos((TBL_PC *)bl,index,x2,y2,CLR_OUTSIGHT);
|
x2 = tx;
|
||||||
|
y2 = ty;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (buildin_warp_sub((TBL_PC *)bl, mapname, x2, y2) != SETPOS_OK)
|
||||||
|
return 1;
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Warp a given area of a map
|
||||||
|
* areawarp "<from map name>",<x1>,<y1>,<x2>,<y2>,"<to map name>",{<x3>,<y3>,<x4>,<y4>};
|
||||||
|
*/
|
||||||
BUILDIN_FUNC(areawarp)
|
BUILDIN_FUNC(areawarp)
|
||||||
{
|
{
|
||||||
int16 m, x0,y0,x1,y1, x2,y2,x3=0,y3=0;
|
int16 m, x0,y0,x1,y1, x2,y2,x3,y3;
|
||||||
unsigned int index;
|
|
||||||
const char *str;
|
const char *str;
|
||||||
const char *mapname;
|
const char *mapname;
|
||||||
|
|
||||||
mapname = script_getstr(st,2);
|
mapname = script_getstr(st,2);
|
||||||
|
|
||||||
|
if ((m = map_mapname2mapid(mapname)) < 0){
|
||||||
|
ShowError( "buildin_areawarp: Unknown source map \"%s\"\n", mapname );
|
||||||
|
return SCRIPT_CMD_FAILURE;
|
||||||
|
}
|
||||||
|
|
||||||
x0 = script_getnum(st,3);
|
x0 = script_getnum(st,3);
|
||||||
y0 = script_getnum(st,4);
|
y0 = script_getnum(st,4);
|
||||||
x1 = script_getnum(st,5);
|
x1 = script_getnum(st,5);
|
||||||
y1 = script_getnum(st,6);
|
y1 = script_getnum(st,6);
|
||||||
str = script_getstr(st,7);
|
str = script_getstr(st,7);
|
||||||
|
|
||||||
|
if (script_hasdata(st,9)){
|
||||||
x2 = script_getnum(st,8);
|
x2 = script_getnum(st,8);
|
||||||
y2 = script_getnum(st,9);
|
y2 = script_getnum(st,9);
|
||||||
|
}else{
|
||||||
|
x2 = 0;
|
||||||
|
y2 = 0;
|
||||||
|
}
|
||||||
|
|
||||||
if( script_hasdata(st,10) && script_hasdata(st,11) ) { // Warp area to area
|
if( script_hasdata(st,10) && script_hasdata(st,11) ) { // Warp area to area
|
||||||
if( (x3 = script_getnum(st,10)) < 0 || (y3 = script_getnum(st,11)) < 0 ){
|
if( (x3 = script_getnum(st,10)) < 0 || (y3 = script_getnum(st,11)) < 0 ){
|
||||||
@ -5660,17 +5698,12 @@ BUILDIN_FUNC(areawarp)
|
|||||||
if( x3 < x2 ) SWAP(x3,x2);
|
if( x3 < x2 ) SWAP(x3,x2);
|
||||||
if( y3 < y2 ) SWAP(y3,y2);
|
if( y3 < y2 ) SWAP(y3,y2);
|
||||||
}
|
}
|
||||||
|
}else{
|
||||||
|
x3 = 0;
|
||||||
|
y3 = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
if( (m = map_mapname2mapid(mapname)) < 0 )
|
map_foreachinallarea(buildin_areawarp_sub, m, x0, y0, x1, y1, BL_PC, x2, y2, x3, y3, str);
|
||||||
return SCRIPT_CMD_FAILURE;
|
|
||||||
|
|
||||||
if( strcmp(str,"Random") == 0 )
|
|
||||||
index = 0;
|
|
||||||
else if( !(index=mapindex_name2id(str)) )
|
|
||||||
return SCRIPT_CMD_FAILURE;
|
|
||||||
|
|
||||||
map_foreachinallarea(buildin_areawarp_sub, m,x0,y0,x1,y1, BL_PC, index,x2,y2,x3,y3);
|
|
||||||
return SCRIPT_CMD_SUCCESS;
|
return SCRIPT_CMD_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -5782,7 +5815,7 @@ BUILDIN_FUNC(warpparty)
|
|||||||
{
|
{
|
||||||
case 0: // Random
|
case 0: // Random
|
||||||
if(!map_getmapflag(pl_sd->bl.m, MF_NOWARP))
|
if(!map_getmapflag(pl_sd->bl.m, MF_NOWARP))
|
||||||
pc_randomwarp(pl_sd,CLR_TELEPORT);
|
pc_setpos(pl_sd, pl_sd->bl.m, 0, 0, CLR_TELEPORT);
|
||||||
break;
|
break;
|
||||||
case 1: // SavePointAll
|
case 1: // SavePointAll
|
||||||
if(!map_getmapflag(pl_sd->bl.m, MF_NORETURN))
|
if(!map_getmapflag(pl_sd->bl.m, MF_NORETURN))
|
||||||
@ -5866,7 +5899,7 @@ BUILDIN_FUNC(warpguild)
|
|||||||
{
|
{
|
||||||
case 0: // Random
|
case 0: // Random
|
||||||
if(!map_getmapflag(pl_sd->bl.m, MF_NOWARP))
|
if(!map_getmapflag(pl_sd->bl.m, MF_NOWARP))
|
||||||
pc_randomwarp(pl_sd,CLR_TELEPORT);
|
pc_setpos(pl_sd, pl_sd->bl.m, 0, 0, CLR_TELEPORT);
|
||||||
break;
|
break;
|
||||||
case 1: // SavePointAll
|
case 1: // SavePointAll
|
||||||
if(!map_getmapflag(pl_sd->bl.m, MF_NORETURN))
|
if(!map_getmapflag(pl_sd->bl.m, MF_NORETURN))
|
||||||
@ -12447,10 +12480,7 @@ BUILDIN_FUNC(getwaitingroomstate)
|
|||||||
/// warpwaitingpc "<map name>",<x>,<y>;
|
/// warpwaitingpc "<map name>",<x>,<y>;
|
||||||
BUILDIN_FUNC(warpwaitingpc)
|
BUILDIN_FUNC(warpwaitingpc)
|
||||||
{
|
{
|
||||||
int x;
|
int16 x, y, i, n;
|
||||||
int y;
|
|
||||||
int i;
|
|
||||||
int n;
|
|
||||||
const char* map_name;
|
const char* map_name;
|
||||||
struct npc_data* nd;
|
struct npc_data* nd;
|
||||||
struct chat_data* cd;
|
struct chat_data* cd;
|
||||||
@ -12471,10 +12501,8 @@ BUILDIN_FUNC(warpwaitingpc)
|
|||||||
{
|
{
|
||||||
TBL_PC* sd = cd->usersd[0];
|
TBL_PC* sd = cd->usersd[0];
|
||||||
|
|
||||||
if( strcmp(map_name,"SavePoint") == 0 && map_getmapflag(sd->bl.m, MF_NOTELEPORT) )
|
if ((strcmp(map_name, "SavePoint") == 0 || strcmp(map_name, "Save") == 0) && map_getmapflag(sd->bl.m, MF_NOTELEPORT)) // Can't teleport on the current map
|
||||||
{// can't teleport on this map
|
|
||||||
break;
|
break;
|
||||||
}
|
|
||||||
|
|
||||||
if( cd->zeny )
|
if( cd->zeny )
|
||||||
{// fee set
|
{// fee set
|
||||||
@ -12487,12 +12515,7 @@ BUILDIN_FUNC(warpwaitingpc)
|
|||||||
|
|
||||||
mapreg_setreg(reference_uid(add_str("$@warpwaitingpc"), i), sd->bl.id);
|
mapreg_setreg(reference_uid(add_str("$@warpwaitingpc"), i), sd->bl.id);
|
||||||
|
|
||||||
if( strcmp(map_name,"Random") == 0 )
|
buildin_warp_sub(sd, map_name, x, y);
|
||||||
pc_randomwarp(sd,CLR_TELEPORT);
|
|
||||||
else if( strcmp(map_name,"SavePoint") == 0 )
|
|
||||||
pc_setpos(sd, sd->status.save_point.map, sd->status.save_point.x, sd->status.save_point.y, CLR_TELEPORT);
|
|
||||||
else
|
|
||||||
pc_setpos(sd, mapindex_name2id(map_name), x, y, CLR_OUTSIGHT);
|
|
||||||
}
|
}
|
||||||
mapreg_setreg(add_str("$@warpwaitingpcnum"), i);
|
mapreg_setreg(add_str("$@warpwaitingpcnum"), i);
|
||||||
return SCRIPT_CMD_SUCCESS;
|
return SCRIPT_CMD_SUCCESS;
|
||||||
@ -13429,59 +13452,78 @@ BUILDIN_FUNC(failedremovecards) {
|
|||||||
return SCRIPT_CMD_SUCCESS;
|
return SCRIPT_CMD_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* ================================================================
|
/**
|
||||||
* mapwarp "<from map>","<to map>",<x>,<y>,<type>,<ID for Type>;
|
* Warp a given map
|
||||||
* type: 0=everyone, 1=guild, 2=party; [Reddozen]
|
* mapwarp "<from map>","<to map>",{<x>,<y>,<type>,<ID>};
|
||||||
* improved by [Lance]
|
* @author [Reddozen], [RoVeRT]; improved by [Lance]
|
||||||
* ================================================================*/
|
*/
|
||||||
BUILDIN_FUNC(mapwarp) // Added by RoVeRT
|
BUILDIN_FUNC(mapwarp)
|
||||||
{
|
{
|
||||||
int x,y,m,check_val=0,check_ID=0,i=0;
|
int16 x, y, m, i;
|
||||||
struct guild *g = NULL;
|
int type, type_id;
|
||||||
struct party_data *p = NULL;
|
struct guild *g;
|
||||||
const char *str;
|
struct party_data *p;
|
||||||
const char *mapname;
|
struct clan *c;
|
||||||
unsigned int index;
|
const char *str, *mapname;
|
||||||
mapname=script_getstr(st,2);
|
|
||||||
str=script_getstr(st,3);
|
mapname = script_getstr(st, 2);
|
||||||
x=script_getnum(st,4);
|
str = script_getstr(st, 3);
|
||||||
y=script_getnum(st,5);
|
|
||||||
if(script_hasdata(st,7)){
|
if (script_hasdata(st, 5)){
|
||||||
check_val=script_getnum(st,6);
|
x = script_getnum(st, 4);
|
||||||
check_ID=script_getnum(st,7);
|
y = script_getnum(st, 5);
|
||||||
|
}else{
|
||||||
|
x = 0;
|
||||||
|
y = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
if((m=map_mapname2mapid(mapname))< 0)
|
if (script_hasdata(st, 7)){
|
||||||
return SCRIPT_CMD_SUCCESS;
|
type = script_getnum(st, 6);
|
||||||
|
type_id = script_getnum(st, 7);
|
||||||
if(!(index=mapindex_name2id(str)))
|
}else{
|
||||||
return SCRIPT_CMD_SUCCESS;
|
type = MAPWARP_ALL;
|
||||||
|
type_id = 0;
|
||||||
switch(check_val){
|
|
||||||
case 1:
|
|
||||||
g = guild_search(check_ID);
|
|
||||||
if (g){
|
|
||||||
for( i=0; i < g->max_member; i++)
|
|
||||||
{
|
|
||||||
if(g->member[i].sd && g->member[i].sd->bl.m==m){
|
|
||||||
pc_setpos(g->member[i].sd,index,x,y,CLR_TELEPORT);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if ((m = map_mapname2mapid(mapname)) < 0){
|
||||||
|
ShowError("buildin_mapwarp: Unknown source map \"%s\"\n", mapname);
|
||||||
|
return SCRIPT_CMD_FAILURE;
|
||||||
|
}
|
||||||
|
|
||||||
|
switch (type) {
|
||||||
|
case MAPWARP_ALL:
|
||||||
|
map_foreachinmap(buildin_areawarp_sub, m, BL_PC, x, y, 0, 0, str);
|
||||||
|
break;
|
||||||
|
case MAPWARP_GUILD:
|
||||||
|
g = guild_search(type_id);
|
||||||
|
if (g) {
|
||||||
|
for (i = 0; i < g->max_member; i++) {
|
||||||
|
if (g->member[i].sd && g->member[i].sd->bl.m == m)
|
||||||
|
buildin_warp_sub(g->member[i].sd, str, x, y);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case 2:
|
case MAPWARP_PARTY:
|
||||||
p = party_search(check_ID);
|
p = party_search(type_id);
|
||||||
if(p){
|
if (p) {
|
||||||
for(i=0;i<MAX_PARTY; i++){
|
for (i = 0; i < MAX_PARTY; i++) {
|
||||||
if(p->data[i].sd && p->data[i].sd->bl.m == m){
|
if (p->data[i].sd && p->data[i].sd->bl.m == m)
|
||||||
pc_setpos(p->data[i].sd,index,x,y,CLR_TELEPORT);
|
buildin_warp_sub(p->data[i].sd, str, x, y);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
break;
|
||||||
|
case MAPWARP_CLAN:
|
||||||
|
c = clan_search(type_id);
|
||||||
|
if (c) {
|
||||||
|
for (i = 0; i < MAX_CLAN; i++) {
|
||||||
|
if (c->members[i] && c->members[i]->bl.m == m)
|
||||||
|
buildin_warp_sub(c->members[i], str, x, y);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
map_foreachinmap(buildin_areawarp_sub,m,BL_PC,index,x,y,0,0);
|
ShowError("buildin_mapwarp: Unknown type '%d'\n", type);
|
||||||
break;
|
return SCRIPT_CMD_FAILURE;
|
||||||
}
|
}
|
||||||
return SCRIPT_CMD_SUCCESS;
|
return SCRIPT_CMD_SUCCESS;
|
||||||
}
|
}
|
||||||
@ -13648,13 +13690,15 @@ BUILDIN_FUNC(getfatherid)
|
|||||||
return SCRIPT_CMD_SUCCESS;
|
return SCRIPT_CMD_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Warp a marriage partner
|
||||||
|
* warppartner("<map name>",<x>,<y>);
|
||||||
|
*/
|
||||||
BUILDIN_FUNC(warppartner)
|
BUILDIN_FUNC(warppartner)
|
||||||
{
|
{
|
||||||
int x,y;
|
int16 x, y;
|
||||||
unsigned short mapindex;
|
|
||||||
const char *str;
|
const char *str;
|
||||||
TBL_PC *sd;
|
TBL_PC *sd, *p_sd;
|
||||||
TBL_PC *p_sd;
|
|
||||||
|
|
||||||
if(!script_rid2sd(sd) || !pc_ismarried(sd) ||
|
if(!script_rid2sd(sd) || !pc_ismarried(sd) ||
|
||||||
(p_sd=map_charid2sd(sd->status.partner_id)) == NULL) {
|
(p_sd=map_charid2sd(sd->status.partner_id)) == NULL) {
|
||||||
@ -13666,13 +13710,13 @@ BUILDIN_FUNC(warppartner)
|
|||||||
x=script_getnum(st,3);
|
x=script_getnum(st,3);
|
||||||
y=script_getnum(st,4);
|
y=script_getnum(st,4);
|
||||||
|
|
||||||
mapindex = mapindex_name2id(str);
|
if (buildin_warp_sub(p_sd, str, x, y) == SETPOS_OK) {
|
||||||
if (mapindex) {
|
script_pushint(st, true);
|
||||||
pc_setpos(p_sd,mapindex,x,y,CLR_OUTSIGHT);
|
|
||||||
script_pushint(st,1);
|
|
||||||
} else
|
|
||||||
script_pushint(st,0);
|
|
||||||
return SCRIPT_CMD_SUCCESS;
|
return SCRIPT_CMD_SUCCESS;
|
||||||
|
} else
|
||||||
|
script_pushint(st, false);
|
||||||
|
|
||||||
|
return SCRIPT_CMD_FAILURE;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*================================================
|
/*================================================
|
||||||
@ -24828,7 +24872,7 @@ struct script_function buildin_func[] = {
|
|||||||
BUILDIN_DEF(input,"r??"),
|
BUILDIN_DEF(input,"r??"),
|
||||||
BUILDIN_DEF(warp,"sii?"),
|
BUILDIN_DEF(warp,"sii?"),
|
||||||
BUILDIN_DEF2(warp, "warpchar", "sii?"),
|
BUILDIN_DEF2(warp, "warpchar", "sii?"),
|
||||||
BUILDIN_DEF(areawarp,"siiiisii??"),
|
BUILDIN_DEF(areawarp,"siiiis????"),
|
||||||
BUILDIN_DEF(warpparty,"siii???"), // [Fredzilla] [Paradox924X]
|
BUILDIN_DEF(warpparty,"siii???"), // [Fredzilla] [Paradox924X]
|
||||||
BUILDIN_DEF(warpguild,"siii"), // [Fredzilla]
|
BUILDIN_DEF(warpguild,"siii"), // [Fredzilla]
|
||||||
BUILDIN_DEF(setlook,"ii?"),
|
BUILDIN_DEF(setlook,"ii?"),
|
||||||
@ -25070,7 +25114,7 @@ struct script_function buildin_func[] = {
|
|||||||
BUILDIN_DEF(specialeffect,"i??"), // npc skill effect [Valaris]
|
BUILDIN_DEF(specialeffect,"i??"), // npc skill effect [Valaris]
|
||||||
BUILDIN_DEF(specialeffect2,"i??"), // skill effect on players[Valaris]
|
BUILDIN_DEF(specialeffect2,"i??"), // skill effect on players[Valaris]
|
||||||
BUILDIN_DEF(nude,"?"), // nude command [Valaris]
|
BUILDIN_DEF(nude,"?"), // nude command [Valaris]
|
||||||
BUILDIN_DEF(mapwarp,"ssii??"), // Added by RoVeRT
|
BUILDIN_DEF(mapwarp,"ss????"), // Added by RoVeRT
|
||||||
BUILDIN_DEF(atcommand,"s"), // [MouseJstr]
|
BUILDIN_DEF(atcommand,"s"), // [MouseJstr]
|
||||||
BUILDIN_DEF2(atcommand,"charcommand","s"), // [MouseJstr]
|
BUILDIN_DEF2(atcommand,"charcommand","s"), // [MouseJstr]
|
||||||
BUILDIN_DEF(movenpc,"sii?"), // [MouseJstr]
|
BUILDIN_DEF(movenpc,"sii?"), // [MouseJstr]
|
||||||
|
@ -2006,6 +2006,13 @@ enum e_pcblock_action_flag : uint16 {
|
|||||||
PCBLOCK_ALL = 0x3FF,
|
PCBLOCK_ALL = 0x3FF,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
enum e_mapwarp_type : uint8 {
|
||||||
|
MAPWARP_ALL = 0,
|
||||||
|
MAPWARP_GUILD,
|
||||||
|
MAPWARP_PARTY,
|
||||||
|
MAPWARP_CLAN
|
||||||
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* used to generate quick script_array entries
|
* used to generate quick script_array entries
|
||||||
**/
|
**/
|
||||||
|
@ -4620,6 +4620,12 @@
|
|||||||
export_constant(VIP_STATUS_EXPIRE);
|
export_constant(VIP_STATUS_EXPIRE);
|
||||||
export_constant(VIP_STATUS_REMAINING);
|
export_constant(VIP_STATUS_REMAINING);
|
||||||
|
|
||||||
|
/* mapwarp types */
|
||||||
|
export_constant(MAPWARP_ALL);
|
||||||
|
export_constant(MAPWARP_GUILD);
|
||||||
|
export_constant(MAPWARP_PARTY);
|
||||||
|
export_constant(MAPWARP_CLAN);
|
||||||
|
|
||||||
/* item groups */
|
/* item groups */
|
||||||
export_constant(IG_BLUEBOX);
|
export_constant(IG_BLUEBOX);
|
||||||
export_constant(IG_VIOLETBOX);
|
export_constant(IG_VIOLETBOX);
|
||||||
|
@ -8140,7 +8140,7 @@ int skill_castend_nodamage_id (struct block_list *src, struct block_list *bl, ui
|
|||||||
if( sd->state.autocast || ( (sd->skillitem == AL_TELEPORT || battle_config.skip_teleport_lv1_menu) && skill_lv == 1 ) || skill_lv == 3 )
|
if( sd->state.autocast || ( (sd->skillitem == AL_TELEPORT || battle_config.skip_teleport_lv1_menu) && skill_lv == 1 ) || skill_lv == 3 )
|
||||||
{
|
{
|
||||||
if( skill_lv == 1 )
|
if( skill_lv == 1 )
|
||||||
pc_randomwarp(sd,CLR_TELEPORT);
|
pc_setpos(sd, sd->bl.m, 0, 0, CLR_TELEPORT);
|
||||||
else
|
else
|
||||||
pc_setpos(sd,sd->status.save_point.map,sd->status.save_point.x,sd->status.save_point.y,CLR_TELEPORT);
|
pc_setpos(sd,sd->status.save_point.map,sd->status.save_point.x,sd->status.save_point.y,CLR_TELEPORT);
|
||||||
break;
|
break;
|
||||||
@ -13104,7 +13104,7 @@ int skill_castend_map (struct map_session_data *sd, uint16 skill_id, const char
|
|||||||
//any kind of map change, so we need to restore it automatically
|
//any kind of map change, so we need to restore it automatically
|
||||||
//bugreport:8027
|
//bugreport:8027
|
||||||
if(strcmp(mapname,"Random") == 0)
|
if(strcmp(mapname,"Random") == 0)
|
||||||
pc_randomwarp(sd,CLR_TELEPORT);
|
pc_setpos(sd, sd->bl.m, 0, 0, CLR_TELEPORT);
|
||||||
else if (sd->menuskill_val > 1 || skill_id == ALL_ODINS_RECALL) //Need lv2 to be able to warp here.
|
else if (sd->menuskill_val > 1 || skill_id == ALL_ODINS_RECALL) //Need lv2 to be able to warp here.
|
||||||
pc_setpos(sd,sd->status.save_point.map,sd->status.save_point.x,sd->status.save_point.y,CLR_TELEPORT);
|
pc_setpos(sd,sd->status.save_point.map,sd->status.save_point.x,sd->status.save_point.y,CLR_TELEPORT);
|
||||||
|
|
||||||
@ -14718,7 +14718,7 @@ int skill_unit_onplace_timer(struct skill_unit *unit, struct block_list *bl, t_t
|
|||||||
|
|
||||||
case UNT_DIMENSIONDOOR:
|
case UNT_DIMENSIONDOOR:
|
||||||
if( tsd && !map_getmapflag(bl->m, MF_NOTELEPORT) )
|
if( tsd && !map_getmapflag(bl->m, MF_NOTELEPORT) )
|
||||||
pc_randomwarp(tsd,CLR_TELEPORT);
|
pc_setpos(tsd, tsd->bl.m, 0, 0, CLR_TELEPORT);
|
||||||
else if( bl->type == BL_MOB && battle_config.mob_warp&8 )
|
else if( bl->type == BL_MOB && battle_config.mob_warp&8 )
|
||||||
unit_warp(bl,-1,-1,-1,CLR_TELEPORT);
|
unit_warp(bl,-1,-1,-1,CLR_TELEPORT);
|
||||||
break;
|
break;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user