From c8ff72c09f9c763912d7c1d953638b5f32cb40aa Mon Sep 17 00:00:00 2001 From: ai4rei Date: Sat, 25 Dec 2010 01:40:35 +0000 Subject: * Added support for new /remove and /recall packets for 2010-08-03aRagexeRE and newer. git-svn-id: https://rathena.svn.sourceforge.net/svnroot/rathena/trunk@14620 54d463be-8e91-2dee-dedb-b68131a5f0ec --- Changelog-Trunk.txt | 1 + db/packet_db.txt | 4 +++ src/map/clif.c | 82 ++++++++++++++++++++++++++++++++++++++++++++++++++--- src/map/pc.c | 39 +++++++++++++++++++++++++ src/map/pc.h | 2 ++ 5 files changed, 124 insertions(+), 4 deletions(-) diff --git a/Changelog-Trunk.txt b/Changelog-Trunk.txt index 284117e1a..c8c737c0c 100644 --- a/Changelog-Trunk.txt +++ b/Changelog-Trunk.txt @@ -1,6 +1,7 @@ Date Added 2010/12/24 + * Added support for new /remove and /recall packets for 2010-08-03aRagexeRE and newer. [Ai4rei] * Synchronized TXT/SQL char-server code a bit. [Ai4rei] * Fixes to char-server. [Ai4rei] - Removed unnecessary #includes from TXT and synchronized them with SQL. diff --git a/db/packet_db.txt b/db/packet_db.txt index 722ccc646..f18eed246 100644 --- a/db/packet_db.txt +++ b/db/packet_db.txt @@ -1582,5 +1582,9 @@ packet_ver: 25 //2010-07-14aRagexeRE //0x841,4 +//2010-08-03aRagexeRE +0x0842,6,recall2,2 +0x0843,6,remove2,2 + //Add new packets here //packet_ver: 26 diff --git a/src/map/clif.c b/src/map/clif.c index 0765b8665..14b7aa16e 100644 --- a/src/map/clif.c +++ b/src/map/clif.c @@ -11391,10 +11391,11 @@ void clif_parse_GMKickAll(int fd, struct map_session_data* sd) } /*========================================== - * /shift + * /remove + * /shift *------------------------------------------*/ void clif_parse_GMShift(int fd, struct map_session_data *sd) -{ +{// FIXME: remove is supposed to receive account name for clients prior 20100803RE char *player_name; int lv; @@ -11413,11 +11414,47 @@ void clif_parse_GMShift(int fd, struct map_session_data *sd) } } + +/// Warps oneself to the location of the character given by account id ( /remove ). +/// R 0843 .L +void clif_parse_GMRemove2(int fd, struct map_session_data* sd) +{ + int account_id, lv; + struct map_session_data* pl_sd; + + if( battle_config.atc_gmonly && !pc_isGM(sd) ) + { + return; + } + + if( pc_isGM(sd) < ( lv = get_atcommand_level(atcommand_jumpto) ) ) + { + return; + } + + account_id = RFIFOL(fd,packet_db[sd->packet_ver][RFIFOW(fd,0)].pos[0]); + + if( ( pl_sd = map_id2sd(account_id) ) != NULL && pc_isGM(sd) >= pc_isGM(pl_sd) ) + { + pc_warpto(sd, pl_sd); + } + + if( log_config.gm && lv >= log_config.gm ) + { + char message[32]; + + sprintf(message, "/remove %d", account_id); + log_atcommand(sd, message); + } +} + + /*========================================== - * /recall + * /recall + * /summon *------------------------------------------*/ void clif_parse_GMRecall(int fd, struct map_session_data *sd) -{ +{// FIXME: recall is supposed to receive account name for clients prior 20100803RE char *player_name; int lv; @@ -11437,6 +11474,41 @@ void clif_parse_GMRecall(int fd, struct map_session_data *sd) } } + +/// Summons a character given by account id to one's own position ( /recall ) +/// R 0842 .L +void clif_parse_GMRecall2(int fd, struct map_session_data* sd) +{ + int account_id, lv; + struct map_session_data* pl_sd; + + if( battle_config.atc_gmonly && !pc_isGM(sd) ) + { + return; + } + + if( pc_isGM(sd) < ( lv = get_atcommand_level(atcommand_recall) ) ) + { + return; + } + + account_id = RFIFOL(fd,packet_db[sd->packet_ver][RFIFOW(fd,0)].pos[0]); + + if( ( pl_sd = map_id2sd(account_id) ) != NULL && pc_isGM(sd) >= pc_isGM(pl_sd) ) + { + pc_recall(sd, pl_sd); + } + + if( log_config.gm && lv >= log_config.gm ) + { + char message[32]; + + sprintf(message, "/recall %d", account_id); + log_atcommand(sd, message); + } +} + + /*========================================== * /monster /item * R 01F3 .24B @@ -14444,6 +14516,8 @@ static int packetdb_readdb(void) {clif_parse_GMShift,"shift"}, {clif_parse_GMChangeMapType,"changemaptype"}, {clif_parse_GMRc,"rc"}, + {clif_parse_GMRecall2,"recall2"}, + {clif_parse_GMRemove2,"remove2"}, {clif_parse_NoviceDoriDori,"sndoridori"}, {clif_parse_NoviceExplosionSpirits,"snexplosionspirits"}, diff --git a/src/map/pc.c b/src/map/pc.c index 45064794b..b22a365e0 100644 --- a/src/map/pc.c +++ b/src/map/pc.c @@ -4239,6 +4239,45 @@ int pc_randomwarp(struct map_session_data *sd, clr_type type) return 0; } + +/// Warps one player to another. +/// @param sd player to warp. +/// @param pl_sd player to warp to. +int pc_warpto(struct map_session_data* sd, struct map_session_data* pl_sd) +{ + if( map[sd->bl.m].flag.nowarp && battle_config.any_warp_GM_min_level > pc_isGM(sd) ) + { + return -2; + } + + if( map[pl_sd->bl.m].flag.nowarpto && battle_config.any_warp_GM_min_level > pc_isGM(sd) ) + { + return -3; + } + + return pc_setpos(sd, pl_sd->mapindex, pl_sd->bl.x, pl_sd->bl.y, CLR_TELEPORT); +} + + +/// Recalls one player to another. +/// @param sd player to warp to. +/// @param pl_sd player to warp. +int pc_recall(struct map_session_data* sd, struct map_session_data* pl_sd) +{ + if( map[pl_sd->bl.m].flag.nowarp && battle_config.any_warp_GM_min_level > pc_isGM(sd) ) + { + return -2; + } + + if( map[sd->bl.m].flag.nowarpto && battle_config.any_warp_GM_min_level > pc_isGM(sd) ) + { + return -3; + } + + return pc_setpos(pl_sd, sd->mapindex, sd->bl.x, sd->bl.y, CLR_RESPAWN); +} + + /*========================================== * Records a memo point at sd's current position * pos - entry to replace, (-1: shift oldest entry out) diff --git a/src/map/pc.h b/src/map/pc.h index 9a28a30ee..2921b4527 100644 --- a/src/map/pc.h +++ b/src/map/pc.h @@ -572,6 +572,8 @@ int pc_clean_skilltree(struct map_session_data *sd); int pc_setpos(struct map_session_data* sd, unsigned short mapindex, int x, int y, clr_type clrtype); int pc_setsavepoint(struct map_session_data*,short,int,int); int pc_randomwarp(struct map_session_data *sd,clr_type type); +int pc_warpto(struct map_session_data* sd, struct map_session_data* pl_sd); +int pc_recall(struct map_session_data* sd, struct map_session_data* pl_sd); int pc_memo(struct map_session_data* sd, int pos); int pc_checkadditem(struct map_session_data*,int,int); -- cgit v1.2.3-70-g09d2