mapwarp cleanup

This commit is contained in:
Lemongrass3110 2017-06-22 14:52:22 +02:00
parent 04dab1e9aa
commit 7cd69f40e8
4 changed files with 56 additions and 27 deletions

View File

@ -6850,30 +6850,32 @@ 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
3 - Clan
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>.
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.
---------------------------------------
\\
5,2.- Guild-related commands

View File

@ -13127,33 +13127,47 @@ BUILDIN_FUNC(failedremovecards) {
/**
* Warp a given map
* mapwarp "<from map>","<to map>",<x>,<y>{,<type>,<ID>};
* mapwarp "<from map>","<to map>",{<x>,<y>,<type>,<ID>};
* @author [Reddozen], [RoVeRT]; improved by [Lance]
*/
BUILDIN_FUNC(mapwarp)
{
int16 x, y, m, type = 0, i = 0;
int type_id = 0;
struct guild *g = NULL;
struct party_data *p = NULL;
struct clan *c = NULL;
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);
x = script_getnum(st, 4);
y = script_getnum(st, 5);
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)){
type = script_getnum(st, 6);
type_id = script_getnum(st, 7);
}else{
type = MAPWARP_ALL;
type_id = 0;
}
if ((m = map_mapname2mapid(mapname)) < 0)
if ((m = map_mapname2mapid(mapname)) < 0){
ShowError("buildin_mapwarp: Unknown source map \"%s\"\n", mapname);
return SCRIPT_CMD_FAILURE;
}
switch (type) {
case 1:
case MAPWARP_ALL:
map_foreachinmap(buildin_areawarp_sub, m, BL_PC, mapindex_name2id(str), x, y, 0, 0, str);
break;
case MAPWARP_GUILD:
g = guild_search(type_id);
if (g) {
for (i = 0; i < g->max_member; i++) {
@ -13162,7 +13176,7 @@ BUILDIN_FUNC(mapwarp)
}
}
break;
case 2:
case MAPWARP_PARTY:
p = party_search(type_id);
if (p) {
for (i = 0; i < MAX_PARTY; i++) {
@ -13171,7 +13185,7 @@ BUILDIN_FUNC(mapwarp)
}
}
break;
case 3:
case MAPWARP_CLAN:
c = clan_search(type_id);
if (c) {
for (i = 0; i < MAX_CLAN; i++) {
@ -13181,8 +13195,8 @@ BUILDIN_FUNC(mapwarp)
}
break;
default:
map_foreachinmap(buildin_areawarp_sub, m, BL_PC, mapindex_name2id(str), x, y, 0, 0, str);
break;
ShowError("buildin_mapwarp: Unknown type '%d'\n", type);
return SCRIPT_CMD_FAILURE;
}
return SCRIPT_CMD_SUCCESS;
}
@ -23417,7 +23431,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

@ -699,6 +699,13 @@ enum vip_status_type {
VIP_STATUS_REMAINING
};
enum mapwarp_type {
MAPWARP_ALL = 0,
MAPWARP_GUILD,
MAPWARP_PARTY,
MAPWARP_CLAN
};
/**
* used to generate quick script_array entries
**/

View File

@ -3311,6 +3311,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);