Compare commits

...

13 Commits

Author SHA1 Message Date
Aleos
10e1b3a7fe
Merge branch 'master' into hotfix/issue2173 2020-07-31 08:39:01 -04:00
Aleos
23d1183927
Merge branch 'master' into hotfix/issue2173 2018-09-27 12:34:06 -04:00
Lemongrass3110
15f28f1f9d Merge branch 'master' into hotfix/issue2173 2018-06-14 22:28:23 +02:00
aleos89
6d9b175a21 Merge branch 'master' into hotfix/issue2173 2017-11-03 13:25:26 -04:00
aleos89
8796135124 Merge branch 'master' into hotfix/issue2173 2017-10-19 14:48:42 -04:00
aleos89
d3764754e8 Merge branch 'master' into hotfix/issue2173 2017-09-21 13:53:07 -04:00
Aleos
3b31b31605 Merge branch 'master' into hotfix/issue2173 2017-07-27 13:47:02 -04:00
Aleos
293eef94a8 Merge branch 'master' into hotfix/issue2173 2017-07-13 10:00:04 -04:00
Lemongrass3110
f7486e71c1 areawarp cleanup 2017-06-22 15:54:18 +02:00
Lemongrass3110
7cd69f40e8 mapwarp cleanup 2017-06-22 14:52:22 +02:00
aleos
04dab1e9aa Follow up to e248246
* Resolved some compile warnings.
2017-06-21 19:00:13 -04:00
aleos
e248246257 Follow up to 22812b4
* Created a define for maximum warp attempts.
* Added SETPOS_MAX_ATTEMPTS for pc_setpos.
* Adjusted buildin_warp_sub to return enum e_setpos.
* Removed pc_randomwarp since it was just duplicate code and pc_setpos already contained the same exact functions.
* Fixed a few locations where a destination point would fail when searching for the map index.
* Added clan type to script command mapwarp.
* Adjusted various variable types to match.
Thanks to @Lemongrass3110's suggestions!
2017-06-21 18:37:31 -04:00
aleos
22812b4de3 Cleaned up the warp functions
* Fixes #2173.
* Created a central warp function to check for Random, SavePoint, and Save arguments.
* Script commands areawarp, warppartner, warpwaitingpc, and areawarp now support Random, SavePoint and Save as destinations.
Thanks to @jezznar!
2017-06-20 19:27:14 -04:00
8 changed files with 243 additions and 189 deletions

View File

@ -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
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
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".
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
random place within the defined x3/y3-x4/y4 square.
Like 'warp', areawarp will also explicitly warp characters randomly into the
current map if you give the 'to map name' as "Random".
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.
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'.
@ -4189,10 +4195,15 @@ warpguild "prontera",x,y,Guild_ID;
*warppartner("<map name>",<x>,<y>);
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
0 if the partner is not online, the character is not married, or if there's no
warp them to the map and coordinates given. It will return true upon success and
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.
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>};
@ -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
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>";
@ -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
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
will mean randomly shuffling everyone on the same map.
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
the coordinates are zero or left out.
Optionally, a type and ID can be specified. Available types are:
Optionally, a <type> and <ID> can be specified. Available types are:
0 - Everyone
1 - Guild
2 - Party
MAPWARP_ALL - Everyone
MAPWARP_GUILD - Guild
MAPWARP_PARTY - Party
MAPWARP_CLAN - Clan
Example:
// 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.
---------------------------------------
\\

View File

@ -161,6 +161,8 @@
#define MAX_ACHIEVEMENT_DEPENDENTS 20 /// Maximum different dependents in achievement_db.yml
#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 {
IT_HEALING = 0,
IT_UNKNOWN, //1

View File

@ -5887,19 +5887,20 @@ int pc_steal_coin(struct map_session_data *sd,struct block_list *target)
return 0;
}
/*==========================================
/**
* Set's a player position.
* @param sd
* @param mapindex
* @param x
* @param y
* @param clrtype
* @param sd: Player's data
* @param mapindex: Map index of destination
* @param x: X location
* @param y: Y location
* @param clrtype: Warp type
* @return SETPOS_OK Success
* SETPOS_MAPINDEX Invalid map index
* SETPOS_NO_MAPSERVER Map not in this map-server, and failed to locate alternate map-server.
* SETPOS_AUTOTRADE Player is in autotrade state
*------------------------------------------*/
enum e_setpos pc_setpos(struct map_session_data* sd, unsigned short mapindex, int x, int y, clr_type clrtype)
* SETPOS_MAX_ATTEMPTS Maximum number of warp attempts met
*/
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);
@ -6038,17 +6039,16 @@ enum e_setpos pc_setpos(struct map_session_data* sd, unsigned short mapindex, in
if( x == 0 && y == 0 ) { // pick a random walkable cell
int c = 0;
do {
x = rnd()%(mapdata->xs-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
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));
return SETPOS_OK; //preventing warp
//break; //allow warp anyway
if (c == MAX_WARP_ATTEMPTS) {
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_MAX_ATTEMPTS;
}
} 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)) {
@ -6117,35 +6117,6 @@ enum e_setpos pc_setpos(struct map_session_data* sd, unsigned short mapindex, in
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
* pos - entry to replace, (-1: shift oldest entry out)

View File

@ -1120,14 +1120,14 @@ void pc_clean_skilltree(struct map_session_data *sd);
enum e_setpos{
SETPOS_OK = 0,
SETPOS_MAPINDEX = 1,
SETPOS_NO_MAPSERVER = 2,
SETPOS_AUTOTRADE = 3
SETPOS_MAPINDEX,
SETPOS_NO_MAPSERVER,
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);
char pc_randomwarp(struct map_session_data *sd,clr_type type);
bool pc_memo(struct map_session_data* sd, int pos);
char pc_checkadditem(struct map_session_data *sd, unsigned short nameid, int amount);

View File

@ -5564,13 +5564,38 @@ BUILDIN_FUNC(rand)
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)
{
int ret;
int x,y;
int16 x, y;
const char* str;
struct map_session_data* sd;
@ -5581,75 +5606,88 @@ BUILDIN_FUNC(warp)
x = script_getnum(st,3);
y = script_getnum(st,4);
if(strcmp(str,"Random")==0)
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);
if (buildin_warp_sub(sd, str, x, y))
return SCRIPT_CMD_FAILURE;
}
return SCRIPT_CMD_SUCCESS;
}
/*==========================================
/**
* 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)
{
int x2,y2,x3,y3;
unsigned int index;
int16 x2,y2,x3,y3;
const char *mapname;
index = va_arg(ap,unsigned int);
x2 = va_arg(ap,int);
y2 = va_arg(ap,int);
x3 = va_arg(ap,int);
y3 = va_arg(ap,int);
x2 = (int16)va_arg(ap,int);
y2 = (int16)va_arg(ap,int);
x3 = (int16)va_arg(ap,int);
y3 = (int16)va_arg(ap,int);
mapname = va_arg(ap, char *);
if(index == 0)
pc_randomwarp((TBL_PC *)bl,CLR_TELEPORT);
else if(x3 && y3) {
int max, tx, ty, j = 0;
int16 m;
if (x3 && y3) { // Warp within given area
int16 max, tx, ty, j = 0, m;
m = map_mapindex2mapid(index);
m = map_mapname2mapid(mapname);
// choose a suitable max number of attempts
if( (max = (y3-y2+1)*(x3-x2+1)*3) > 1000 )
max = 1000;
if( (max = (y3-y2+1)*(x3-x2+1)*3) > MAX_WARP_ATTEMPTS )
max = MAX_WARP_ATTEMPTS;
// find a suitable map cell
do {
tx = rnd()%(x3-x2+1)+x2;
ty = rnd()%(y3-y2+1)+y2;
j++;
} while( map_getcell(m,tx,ty,CELL_CHKNOPASS) && j < max );
} while ((map_getcell(m, tx, ty, CELL_CHKNOPASS) || (!battle_config.teleport_on_portal && npc_check_areanpc(1, m, tx, ty, 1))) && (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;
}
/**
* 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)
{
int16 m, x0,y0,x1,y1, x2,y2,x3=0,y3=0;
unsigned int index;
int16 m, x0,y0,x1,y1, x2,y2,x3,y3;
const char *str;
const char *mapname;
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);
y0 = script_getnum(st,4);
x1 = script_getnum(st,5);
y1 = script_getnum(st,6);
str = script_getstr(st,7);
if (script_hasdata(st,9)){
x2 = script_getnum(st,8);
y2 = script_getnum(st,9);
}else{
x2 = 0;
y2 = 0;
}
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 ){
@ -5660,17 +5698,12 @@ BUILDIN_FUNC(areawarp)
if( x3 < x2 ) SWAP(x3,x2);
if( y3 < y2 ) SWAP(y3,y2);
}
}else{
x3 = 0;
y3 = 0;
}
if( (m = map_mapname2mapid(mapname)) < 0 )
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);
map_foreachinallarea(buildin_areawarp_sub, m, x0, y0, x1, y1, BL_PC, x2, y2, x3, y3, str);
return SCRIPT_CMD_SUCCESS;
}
@ -5782,7 +5815,7 @@ BUILDIN_FUNC(warpparty)
{
case 0: // Random
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;
case 1: // SavePointAll
if(!map_getmapflag(pl_sd->bl.m, MF_NORETURN))
@ -5866,7 +5899,7 @@ BUILDIN_FUNC(warpguild)
{
case 0: // Random
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;
case 1: // SavePointAll
if(!map_getmapflag(pl_sd->bl.m, MF_NORETURN))
@ -12447,10 +12480,7 @@ BUILDIN_FUNC(getwaitingroomstate)
/// warpwaitingpc "<map name>",<x>,<y>;
BUILDIN_FUNC(warpwaitingpc)
{
int x;
int y;
int i;
int n;
int16 x, y, i, n;
const char* map_name;
struct npc_data* nd;
struct chat_data* cd;
@ -12471,10 +12501,8 @@ BUILDIN_FUNC(warpwaitingpc)
{
TBL_PC* sd = cd->usersd[0];
if( strcmp(map_name,"SavePoint") == 0 && map_getmapflag(sd->bl.m, MF_NOTELEPORT) )
{// can't teleport on this map
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
break;
}
if( cd->zeny )
{// fee set
@ -12487,12 +12515,7 @@ BUILDIN_FUNC(warpwaitingpc)
mapreg_setreg(reference_uid(add_str("$@warpwaitingpc"), i), sd->bl.id);
if( strcmp(map_name,"Random") == 0 )
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);
buildin_warp_sub(sd, map_name, x, y);
}
mapreg_setreg(add_str("$@warpwaitingpcnum"), i);
return SCRIPT_CMD_SUCCESS;
@ -13429,59 +13452,78 @@ BUILDIN_FUNC(failedremovecards) {
return SCRIPT_CMD_SUCCESS;
}
/* ================================================================
* mapwarp "<from map>","<to map>",<x>,<y>,<type>,<ID for Type>;
* type: 0=everyone, 1=guild, 2=party; [Reddozen]
* improved by [Lance]
* ================================================================*/
BUILDIN_FUNC(mapwarp) // Added by RoVeRT
/**
* Warp a given map
* mapwarp "<from map>","<to map>",{<x>,<y>,<type>,<ID>};
* @author [Reddozen], [RoVeRT]; improved by [Lance]
*/
BUILDIN_FUNC(mapwarp)
{
int x,y,m,check_val=0,check_ID=0,i=0;
struct guild *g = NULL;
struct party_data *p = NULL;
const char *str;
const char *mapname;
unsigned int index;
int16 x, y, m, i;
int type, type_id;
struct guild *g;
struct party_data *p;
struct clan *c;
const char *str, *mapname;
mapname = script_getstr(st, 2);
str = script_getstr(st, 3);
if (script_hasdata(st, 5)){
x = script_getnum(st, 4);
y = script_getnum(st, 5);
}else{
x = 0;
y = 0;
}
if (script_hasdata(st, 7)){
check_val=script_getnum(st,6);
check_ID=script_getnum(st,7);
type = script_getnum(st, 6);
type_id = script_getnum(st, 7);
}else{
type = MAPWARP_ALL;
type_id = 0;
}
if((m=map_mapname2mapid(mapname))< 0)
return SCRIPT_CMD_SUCCESS;
if ((m = map_mapname2mapid(mapname)) < 0){
ShowError("buildin_mapwarp: Unknown source map \"%s\"\n", mapname);
return SCRIPT_CMD_FAILURE;
}
if(!(index=mapindex_name2id(str)))
return SCRIPT_CMD_SUCCESS;
switch(check_val){
case 1:
g = guild_search(check_ID);
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){
pc_setpos(g->member[i].sd,index,x,y,CLR_TELEPORT);
}
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;
case 2:
p = party_search(check_ID);
case MAPWARP_PARTY:
p = party_search(type_id);
if (p) {
for (i = 0; i < MAX_PARTY; i++) {
if(p->data[i].sd && p->data[i].sd->bl.m == m){
pc_setpos(p->data[i].sd,index,x,y,CLR_TELEPORT);
if (p->data[i].sd && p->data[i].sd->bl.m == m)
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;
default:
map_foreachinmap(buildin_areawarp_sub,m,BL_PC,index,x,y,0,0);
break;
ShowError("buildin_mapwarp: Unknown type '%d'\n", type);
return SCRIPT_CMD_FAILURE;
}
return SCRIPT_CMD_SUCCESS;
}
@ -13648,13 +13690,15 @@ BUILDIN_FUNC(getfatherid)
return SCRIPT_CMD_SUCCESS;
}
/**
* Warp a marriage partner
* warppartner("<map name>",<x>,<y>);
*/
BUILDIN_FUNC(warppartner)
{
int x,y;
unsigned short mapindex;
int16 x, y;
const char *str;
TBL_PC *sd;
TBL_PC *p_sd;
TBL_PC *sd, *p_sd;
if(!script_rid2sd(sd) || !pc_ismarried(sd) ||
(p_sd=map_charid2sd(sd->status.partner_id)) == NULL) {
@ -13666,13 +13710,13 @@ BUILDIN_FUNC(warppartner)
x=script_getnum(st,3);
y=script_getnum(st,4);
mapindex = mapindex_name2id(str);
if (mapindex) {
pc_setpos(p_sd,mapindex,x,y,CLR_OUTSIGHT);
script_pushint(st,1);
} else
script_pushint(st,0);
if (buildin_warp_sub(p_sd, str, x, y) == SETPOS_OK) {
script_pushint(st, true);
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(warp,"sii?"),
BUILDIN_DEF2(warp, "warpchar", "sii?"),
BUILDIN_DEF(areawarp,"siiiisii??"),
BUILDIN_DEF(areawarp,"siiiis????"),
BUILDIN_DEF(warpparty,"siii???"), // [Fredzilla] [Paradox924X]
BUILDIN_DEF(warpguild,"siii"), // [Fredzilla]
BUILDIN_DEF(setlook,"ii?"),
@ -25070,7 +25114,7 @@ struct script_function buildin_func[] = {
BUILDIN_DEF(specialeffect,"i??"), // npc skill effect [Valaris]
BUILDIN_DEF(specialeffect2,"i??"), // skill effect on players[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_DEF2(atcommand,"charcommand","s"), // [MouseJstr]
BUILDIN_DEF(movenpc,"sii?"), // [MouseJstr]

View File

@ -2006,6 +2006,13 @@ enum e_pcblock_action_flag : uint16 {
PCBLOCK_ALL = 0x3FF,
};
enum e_mapwarp_type : uint8 {
MAPWARP_ALL = 0,
MAPWARP_GUILD,
MAPWARP_PARTY,
MAPWARP_CLAN
};
/**
* used to generate quick script_array entries
**/

View File

@ -4620,6 +4620,12 @@
export_constant(VIP_STATUS_EXPIRE);
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 */
export_constant(IG_BLUEBOX);
export_constant(IG_VIOLETBOX);

View File

@ -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( skill_lv == 1 )
pc_randomwarp(sd,CLR_TELEPORT);
pc_setpos(sd, sd->bl.m, 0, 0, CLR_TELEPORT);
else
pc_setpos(sd,sd->status.save_point.map,sd->status.save_point.x,sd->status.save_point.y,CLR_TELEPORT);
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
//bugreport:8027
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.
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:
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 )
unit_warp(bl,-1,-1,-1,CLR_TELEPORT);
break;