* Changed the restricting mapflag for @jump from nowarp/nowarpto to noteleport

* Simplified the mapindex code a bit
* Changed clif_skill_warppoint() so that now the '.gat' adding happens inside and doesn't have to be handled by the calling code

git-svn-id: https://svn.code.sf.net/p/rathena/svn/trunk@10901 54d463be-8e91-2dee-dedb-b68131a5f0ec
This commit is contained in:
ultramage 2007-07-23 17:58:54 +00:00
parent e16422f62c
commit 348019358c
9 changed files with 53 additions and 60 deletions

View File

@ -3,6 +3,9 @@ Date Added
AS OF SVN REV. 5091, WE ARE NOW USING TRUNK. ALL UNTESTED BUGFIXES/FEATURES GO INTO TRUNK. AS OF SVN REV. 5091, WE ARE NOW USING TRUNK. ALL UNTESTED BUGFIXES/FEATURES GO INTO TRUNK.
IF YOU HAVE A WORKING AND TESTED BUGFIX PUT IT INTO STABLE AS WELL AS TRUNK. IF YOU HAVE A WORKING AND TESTED BUGFIX PUT IT INTO STABLE AS WELL AS TRUNK.
2007/07/23
* Changed the restricting mapflag for @jump from nowarp/nowarpto
to noteleport. Adjust your scripts if you were using it this way.
2007/07/20 2007/07/20
* Corrected packet_db.txt. See topic:158382 for details. * Corrected packet_db.txt. See topic:158382 for details.
As a side-effect, the latest packet version is now 22 instead of 21. As a side-effect, the latest packet version is now 22 instead of 21.

View File

@ -70,8 +70,9 @@ ban_hack_trade: 5
// default: 60, according to GM definition in atcommand_athena.conf // default: 60, according to GM definition in atcommand_athena.conf
hack_info_GM_level: 60 hack_info_GM_level: 60
// Set here the minimum GM level to disable the nowarp (from) and nowarpto (to) flags. // The minimum GM level to bypass nowarp and nowarpto mapflags.
// This option is mainly used in AT_commands (@memo, @warp, @charwarp, @go, etc...). All GM commands used to move or set a new map check nowarp and nowarpto flags. // This option is mainly used in commands which modify a character's
// map/coordinates (like @memo, @warp, @charwarp, @go, @jump, etc...).
// default: 20 (first level after normal player or super'normal' player) // default: 20 (first level after normal player or super'normal' player)
any_warp_GM_min_level: 20 any_warp_GM_min_level: 20

View File

@ -8,7 +8,7 @@ Date Added
* Added a Missing "close;" in "Bomb Maker" from "quests_hugel". [Samuray22] * Added a Missing "close;" in "Bomb Maker" from "quests_hugel". [Samuray22]
-Thanks to Elfange -Thanks to Elfange
* Correct some typos error like "next;ing". [Samuray22] * Correct some typos error like "next;ing". [Samuray22]
-Thanks to theultradamage -Thanks to theultramage
* Fixed a Little bug on "How does the Airship Works" Quest. [Samuray22] * Fixed a Little bug on "How does the Airship Works" Quest. [Samuray22]
-Thanks to Tantarian -Thanks to Tantarian
2007/07/21 2007/07/21

View File

@ -1,15 +1,16 @@
// Copyright (c) Athena Dev Teams - Licensed under GNU GPL // Copyright (c) Athena Dev Teams - Licensed under GNU GPL
// For more information, see LICENCE in the main folder // For more information, see LICENCE in the main folder
#include "../common/mmo.h"
#include "../common/showmsg.h"
#include "../common/malloc.h"
#include "../common/strlib.h"
#include "mapindex.h"
#include <string.h> #include <string.h>
#include <stdio.h> #include <stdio.h>
#include <stdlib.h> #include <stdlib.h>
#include "mapindex.h"
#include "../common/mmo.h"
#include "../common/showmsg.h"
#include "../common/malloc.h"
#define MAX_MAPINDEX 2000 #define MAX_MAPINDEX 2000
struct _indexes { struct _indexes {
@ -22,22 +23,17 @@ static unsigned short max_index = 0;
char mapindex_cfgfile[80] = "db/map_index.txt"; char mapindex_cfgfile[80] = "db/map_index.txt";
// Removes the extension from a map name // Removes the extension from a map name
char *mapindex_normalize_name(char *mapname) char* mapindex_normalize_name(char* mapname)
{ {
char *ptr, *ptr2; char* ptr = strrchr(mapname, '.');
ptr = strchr(mapname, '.'); if (ptr && stricmp(ptr, ".gat") == 0)
if (ptr) { //Check and remove extension. *ptr = '\0'; // remove extension
while (ptr[1] && (ptr2 = strchr(ptr+1, '.')))
ptr = ptr2; //Skip to the last dot.
if(stricmp(ptr,".gat") == 0)
*ptr = '\0'; //Remove extension.
}
return mapname; return mapname;
} }
/// Adds a map to the specified index /// Adds a map to the specified index
/// Returns 1 if successful, 0 oherwise /// Returns 1 if successful, 0 oherwise
int mapindex_addmap(int index, const char *name) int mapindex_addmap(int index, const char* name)
{ {
char map_name[MAP_NAME_LENGTH_EXT]; char map_name[MAP_NAME_LENGTH_EXT];
@ -46,10 +42,10 @@ int mapindex_addmap(int index, const char *name)
return 0; return 0;
} }
snprintf(map_name, MAP_NAME_LENGTH_EXT, "%s", name); safestrncpy(map_name, name, MAP_NAME_LENGTH_EXT);
mapindex_normalize_name(map_name); mapindex_normalize_name(map_name);
if (strlen(map_name) > MAP_NAME_LENGTH-1) { if (strlen(map_name) >= MAP_NAME_LENGTH) {
ShowError("(mapindex_add) Map name %s is too long. Maps are limited to %d characters.\n", map_name, MAP_NAME_LENGTH); ShowError("(mapindex_add) Map name %s is too long. Maps are limited to %d characters.\n", map_name, MAP_NAME_LENGTH);
return 0; return 0;
} }
@ -57,10 +53,11 @@ int mapindex_addmap(int index, const char *name)
if (indexes[index].exists) if (indexes[index].exists)
ShowWarning("(mapindex_add) Overriding index %d: map \"%s\" -> \"%s\"\n", index, indexes[index].name, map_name); ShowWarning("(mapindex_add) Overriding index %d: map \"%s\" -> \"%s\"\n", index, indexes[index].name, map_name);
snprintf(indexes[index].name, MAP_NAME_LENGTH, "%s", map_name); safestrncpy(indexes[index].name, map_name, MAP_NAME_LENGTH);
indexes[index].exists = true; indexes[index].exists = true;
if (max_index <= index) if (max_index <= index)
max_index = index+1; max_index = index+1;
return 1; return 1;
} }
@ -68,9 +65,9 @@ unsigned short mapindex_name2id(const char* name)
{ {
//TODO: Perhaps use a db to speed this up? [Skotlex] //TODO: Perhaps use a db to speed this up? [Skotlex]
int i; int i;
char map_name[MAP_NAME_LENGTH_EXT];
snprintf(map_name, MAP_NAME_LENGTH_EXT, "%s", name); char map_name[MAP_NAME_LENGTH_EXT];
safestrncpy(map_name, name, MAP_NAME_LENGTH_EXT);
mapindex_normalize_name(map_name); mapindex_normalize_name(map_name);
for (i = 1; i < max_index; i++) for (i = 1; i < max_index; i++)
@ -96,7 +93,7 @@ const char* mapindex_id2name(unsigned short id)
{ {
if (id > MAX_MAPINDEX || !indexes[id].exists) { if (id > MAX_MAPINDEX || !indexes[id].exists) {
ShowDebug("mapindex_id2name: Requested name for non-existant map index [%d] in cache.\n", id); ShowDebug("mapindex_id2name: Requested name for non-existant map index [%d] in cache.\n", id);
return indexes[0].name; //Theorically this should never happen, hence we return this string to prevent null pointer crashes. return indexes[0].name; // dummy empty string so that the callee doesn't crash
} }
return indexes[id].name; return indexes[id].name;
} }
@ -120,7 +117,8 @@ void mapindex_init(void)
if(line[0] == '/' && line[1] == '/') if(line[0] == '/' && line[1] == '/')
continue; continue;
switch (sscanf(line,"%s\t%d",map_name,&index)) { switch (sscanf(line, "%s\t%d", map_name, &index))
{
case 1: //Map with no ID given, auto-assign case 1: //Map with no ID given, auto-assign
index = last_index+1; index = last_index+1;
case 2: //Map with ID given case 2: //Map with ID given

View File

@ -8,7 +8,6 @@
extern char mapindex_cfgfile[80]; extern char mapindex_cfgfile[80];
//whether to enable auto-adding of maps during run. Not so secure as the map indexes will vary! //whether to enable auto-adding of maps during run. Not so secure as the map indexes will vary!
// disabled - since mapindex.h wasn't included in mapindex.c it never got enabled anyway... [FlavioJS]
//#define MAPINDEX_AUTOADD //#define MAPINDEX_AUTOADD
//Some definitions for the mayor city maps. //Some definitions for the mayor city maps.

View File

@ -1357,7 +1357,7 @@ int atcommand_jump(const int fd, struct map_session_data* sd, const char* comman
x = -1; x = -1;
if (y <= 0) if (y <= 0)
y = -1; y = -1;
if (sd->bl.m >= 0 && (map[sd->bl.m].flag.nowarp || map[sd->bl.m].flag.nowarpto) && battle_config.any_warp_GM_min_level > pc_isGM(sd)) { if (sd->bl.m >= 0 && map[sd->bl.m].flag.noteleport && battle_config.any_warp_GM_min_level > pc_isGM(sd)) {
clif_displaymessage(fd, msg_txt(248)); // You are not authorized to warp from your current map. clif_displaymessage(fd, msg_txt(248)); // You are not authorized to warp from your current map.
return -1; return -1;
} }

View File

@ -4656,22 +4656,24 @@ int clif_skill_delunit(struct skill_unit *unit)
/*========================================== /*==========================================
* *
*------------------------------------------*/ *------------------------------------------*/
int clif_skill_warppoint(struct map_session_data *sd,int skill_num,int skill_lv, int clif_skill_warppoint(struct map_session_data* sd, int skill_num, int skill_lv, int map1, int map2, int map3, int map4)
const char *map1,const char *map2,const char *map3,const char *map4)
{ {
int fd; int fd;
nullpo_retr(0, sd); nullpo_retr(0, sd);
fd = sd->fd;
fd=sd->fd;
WFIFOHEAD(fd,packet_len(0x11c)); WFIFOHEAD(fd,packet_len(0x11c));
WFIFOW(fd,0)=0x11c; WFIFOW(fd,0) = 0x11c;
WFIFOW(fd,2)=skill_num; WFIFOW(fd,2) = skill_num;
strncpy((char*)WFIFOP(fd, 4),map1,MAP_NAME_LENGTH_EXT); memset(WFIFOP(fd,4), 0x00, 4*MAP_NAME_LENGTH_EXT);
strncpy((char*)WFIFOP(fd,20),map2,MAP_NAME_LENGTH_EXT); if (map1 == -1) strcpy((char*)WFIFOP(fd, 4), "Random");
strncpy((char*)WFIFOP(fd,36),map3,MAP_NAME_LENGTH_EXT); if (map1 > 0) snprintf((char*)WFIFOP(fd, 4), MAP_NAME_LENGTH_EXT, "%s.gat", mapindex_id2name(map1));
strncpy((char*)WFIFOP(fd,52),map4,MAP_NAME_LENGTH_EXT); if (map2 > 0) snprintf((char*)WFIFOP(fd,20), MAP_NAME_LENGTH_EXT, "%s.gat", mapindex_id2name(map2));
if (map3 > 0) snprintf((char*)WFIFOP(fd,36), MAP_NAME_LENGTH_EXT, "%s.gat", mapindex_id2name(map3));
if (map4 > 0) snprintf((char*)WFIFOP(fd,52), MAP_NAME_LENGTH_EXT, "%s.gat", mapindex_id2name(map4));
WFIFOSET(fd,packet_len(0x11c)); WFIFOSET(fd,packet_len(0x11c));
sd->menuskill_id = skill_num; sd->menuskill_id = skill_num;
if (skill_num == AL_WARP) if (skill_num == AL_WARP)
sd->menuskill_lv = (sd->ud.skillx<<16)|sd->ud.skilly; //Store warp position here. sd->menuskill_lv = (sd->ud.skillx<<16)|sd->ud.skilly; //Store warp position here.

View File

@ -191,8 +191,7 @@ int clif_skill_nodamage(struct block_list *src,struct block_list *dst,
int clif_skill_poseffect(struct block_list *src,int skill_id, int clif_skill_poseffect(struct block_list *src,int skill_id,
int val,int x,int y,int tick); int val,int x,int y,int tick);
int clif_skill_estimation(struct map_session_data *sd,struct block_list *dst); int clif_skill_estimation(struct map_session_data *sd,struct block_list *dst);
int clif_skill_warppoint(struct map_session_data *sd,int skill_num, int skill_lv, int clif_skill_warppoint(struct map_session_data* sd, int skill_num, int skill_lv, int map1, int map2, int map3, int map4);
const char *map1,const char *map2,const char *map3,const char *map4);
int clif_skill_memo(struct map_session_data *sd,int flag); int clif_skill_memo(struct map_session_data *sd,int flag);
int clif_skill_teleportmessage(struct map_session_data *sd,int flag); int clif_skill_teleportmessage(struct map_session_data *sd,int flag);
int clif_skill_produce_mix_list(struct map_session_data *sd, int trigger); int clif_skill_produce_mix_list(struct map_session_data *sd, int trigger);

View File

@ -4436,7 +4436,8 @@ int skill_castend_nodamage_id (struct block_list *src, struct block_list *bl, in
break; break;
case AL_TELEPORT: case AL_TELEPORT:
if(sd) { if(sd)
{
if (map[bl->m].flag.noteleport) { if (map[bl->m].flag.noteleport) {
clif_skill_teleportmessage(sd,0); clif_skill_teleportmessage(sd,0);
break; break;
@ -4448,21 +4449,15 @@ int skill_castend_nodamage_id (struct block_list *src, struct block_list *bl, in
clif_skill_nodamage(src,bl,skillid,skilllv,1); clif_skill_nodamage(src,bl,skillid,skilllv,1);
if(skilllv == 1) { if(skilllv == 1) {
// possibility to skip menu [LuzZza] // possibility to skip menu [LuzZza]
if(!battle_config.skip_teleport_lv1_menu && if(!battle_config.skip_teleport_lv1_menu && sd->skillitem != AL_TELEPORT)
sd->skillitem != AL_TELEPORT) //If skillid is not teleport, this was auto-casted! [Skotlex] clif_skill_warppoint(sd,skillid,skilllv, -1,0,0,0);
clif_skill_warppoint(sd,skillid,skilllv,"Random","","","");
else else
pc_randomwarp(sd,3); pc_randomwarp(sd,3);
} else { } else {
if (sd->skillitem != AL_TELEPORT) if (sd->skillitem != AL_TELEPORT)
{ clif_skill_warppoint(sd,skillid,skilllv, -1,sd->status.save_point.map,0,0);
char save_map[MAP_NAME_LENGTH_EXT];
snprintf(save_map, MAP_NAME_LENGTH_EXT, "%s.gat", mapindex_id2name(sd->status.save_point.map));
clif_skill_warppoint(sd,skillid,skilllv,"Random",save_map,"","");
}
else //Autocasted Teleport level 2?? else //Autocasted Teleport level 2??
pc_setpos(sd,sd->status.save_point.map, pc_setpos(sd,sd->status.save_point.map,sd->status.save_point.x,sd->status.save_point.y,3);
sd->status.save_point.x,sd->status.save_point.y,3);
} }
} else } else
unit_warp(bl,-1,-1,-1,3); unit_warp(bl,-1,-1,-1,3);
@ -6111,17 +6106,13 @@ int skill_castend_pos2 (struct block_list *src, int x, int y, int skillid, int s
break; break;
case AL_WARP: case AL_WARP:
if(sd) { if(sd)
char memo[4][MAP_NAME_LENGTH_EXT] = {"", "", "", ""}; {
snprintf(memo[0], MAP_NAME_LENGTH_EXT, "%s.gat", mapindex_id2name(sd->status.save_point.map)); clif_skill_warppoint(sd, skillid, skilllv, sd->status.save_point.map,
if (skilllv>1 && sd->status.memo_point[0].map) (skilllv >= 2) ? sd->status.memo_point[0].map : 0,
snprintf(memo[1], MAP_NAME_LENGTH_EXT, "%s.gat", mapindex_id2name(sd->status.memo_point[0].map)); (skilllv >= 3) ? sd->status.memo_point[1].map : 0,
if (skilllv>2 && sd->status.memo_point[1].map) (skilllv >= 4) ? sd->status.memo_point[1].map : 0
snprintf(memo[2], MAP_NAME_LENGTH_EXT, "%s.gat", mapindex_id2name(sd->status.memo_point[1].map)); );
if (skilllv>3 && sd->status.memo_point[2].map)
snprintf(memo[3], MAP_NAME_LENGTH_EXT, "%s.gat", mapindex_id2name(sd->status.memo_point[2].map));
clif_skill_warppoint(sd,skillid,skilllv, memo[0],memo[1],memo[2],memo[3]);
} }
break; break;