From f955bd688d4b9bf3eef8ca90002095e8b15fa58a Mon Sep 17 00:00:00 2001 From: codemaster Date: Tue, 11 Jan 2005 03:32:32 +0000 Subject: [PATCH] * Added a fix to @sound where if you forgot the .wav exention, i'd attempt to play the file without it (it adds the .wav) [Codemaster] [SVN 949] * Added @disguiseall / @undisguiseall [Codemaster] [SVN 949] * Added misc. clif.c fixes (jAthena added alot of close(fd)'s, so i added them, too) [Codemaster] [SVN 949] * Added bug reports - Celest, you might want to check one of those out [Codemaster] [SVN 949] git-svn-id: https://svn.code.sf.net/p/rathena/svn/branches/stable@949 54d463be-8e91-2dee-dedb-b68131a5f0ec --- Changelog.txt | 4 ++ Dev/bugs.txt | 19 +++++--- conf-tmpl/atcommand_athena.conf | 7 +++ src/map/atcommand.c | 77 ++++++++++++++++++++++++++++++++- src/map/atcommand.h | 2 + src/map/clif.c | 8 +++- src/map/clif.h | 7 +++ 7 files changed, 115 insertions(+), 9 deletions(-) diff --git a/Changelog.txt b/Changelog.txt index 2b78f60835..c42ce1f977 100644 --- a/Changelog.txt +++ b/Changelog.txt @@ -1,5 +1,9 @@ Date Added 01/11 + * Added a fix to @sound where if you forgot the .wav exention, i'd attempt to play the file without it (it adds the .wav) [Codemaster] [SVN 949] + * Added @disguiseall / @undisguiseall [Codemaster] [SVN 949] + * Added misc. clif.c fixes (jAthena added alot of close(fd)'s, so i added them, too) [Codemaster] [SVN 949] + * Added bug reports - Celest, you might want to check one of those out [Codemaster] [SVN 949] * Fixed a bug in clif.c which didn't allow to enther the map-server. It worked under win32, but didn't under Linux. [Lupus] 01/10 diff --git a/Dev/bugs.txt b/Dev/bugs.txt index 949034a5fa..a763950931 100644 --- a/Dev/bugs.txt +++ b/Dev/bugs.txt @@ -180,7 +180,7 @@ Progress: 0% Problem: Guilds alliances You can have any number of alliances entried in SQL db. Sometimes it glitches and you get > 4 alliances - Assigned: N/A +Assigned: N/A Progress: 0% Problem: Disguise Stats Bonus bug. @@ -188,24 +188,31 @@ Problem: Disguise Stats Bonus bug. You'll get +255 os ro bonuses for all stats and would kill LOD in one kick. It's a global bug.. comes from those times when WEDDING Class had such ++++bonuses So Wedding Class has been fixed, but not the source of the bug. - Assigned: N/A +Assigned: N/A Progress: 0% Problem: Guilds DB There always appears an empty guild with ID 100000. - Assigned: N/A +Assigned: N/A Progress: 0% Problem: Double Connection Bug still exist. Sometimes people can't re-connect till the server reboot - Assigned: N/A +Assigned: N/A Progress: 0% Problem: You can put in Cart goods more than Cart Max Weight limit allows - Assigned: N/A +Assigned: N/A Progress: 0% Problem: SCRIPT CRASH BUG When you use INN - you instantly disconnects or server crashes - Assigned: N/A +Assigned: N/A Progress: 0% +Problem: Berserk Skill supposedly disappears randomly. +Assigned: N/A +Progress: 0% + +Problem: Lord Kaho Horns supposedly disappear when equipped. +Assigned: N/A +Progress: 0% \ No newline at end of file diff --git a/conf-tmpl/atcommand_athena.conf b/conf-tmpl/atcommand_athena.conf index 5b343c1594..84f7806bd1 100644 --- a/conf-tmpl/atcommand_athena.conf +++ b/conf-tmpl/atcommand_athena.conf @@ -295,6 +295,9 @@ charkillable: 40 charkillableid: 40 charkillableid2: 40 +// Play a Sound! +sound: 40 + //--------------------- // 50: Sub-GM+ commands @@ -609,6 +612,10 @@ setbattleflag: 99 // Refresh only status of players - SQL Only refreshonline: 99 +// [Un]Disguise All Players +disguiseall: 99 +undisguiseall: 99 + //--------------------------------------------------------------- // 99: Weather effects diff --git a/src/map/atcommand.c b/src/map/atcommand.c index 97ba82a31c..4b245fd0b6 100644 --- a/src/map/atcommand.c +++ b/src/map/atcommand.c @@ -217,7 +217,7 @@ ACMD_FUNC(readmail); // [Valaris] ACMD_FUNC(sendmail); // [Valaris] ACMD_FUNC(sendprioritymail); // [Valaris] ACMD_FUNC(deletemail); // [Valaris] -ACMD_FUNC(sound); // [Valaris] +//ACMD_FUNC(sound); // [Valaris] ACMD_FUNC(refreshonline); // [Valaris] #endif /* TXT_ONLY */ @@ -248,6 +248,8 @@ ACMD_FUNC(killid2); // by Dino9021 ACMD_FUNC(charkillableid); // by Dino9021 ACMD_FUNC(charkillableid2); // by Dino9021 ACMD_FUNC(sound); +ACMD_FUNC(undisguiseall); +ACMD_FUNC(disguiseall); /*========================================== *AtCommandInfo atcommand_info[]構造体の定義 @@ -518,6 +520,8 @@ static AtCommandInfo atcommand_info[] = { { AtCommand_CharKillableId, "@charkillableid", 40, atcommand_charkillableid }, // [Dino9021] { AtCommand_CharKillableId2, "@charkillableid2", 40, atcommand_charkillableid2 }, // [Dino9021] { AtCommand_Sound, "@sound", 40, atcommand_sound }, + { AtCommand_UndisguiseAll, "@undisguiseall", 99, atcommand_undisguiseall }, + { AtCommand_DisguiseAll, "@disguiseall", 99, atcommand_disguiseall }, // add new commands before this line { AtCommand_Unknown, NULL, 1, NULL } @@ -6452,6 +6456,50 @@ int atcommand_disguise( return 0; } +/*========================================== + * DisguiseAll + *------------------------------------------ + */ + +int atcommand_disguiseall( + const int fd, struct map_session_data* sd, + const char* command, const char* message) +{ + int mob_id=0, i=0; + struct map_session_data *pl_sd; + nullpo_retr(-1, sd); + + if (!message || !*message) { + clif_displaymessage(fd, "Please, enter a Monster/NPC name/id (usage: @disguiseall )."); + return -1; + } + + if ((mob_id = mobdb_searchname(message)) == 0) // check name first (to avoid possible name begining by a number) + mob_id = atoi(message); + + if ((mob_id >= 46 && mob_id <= 125) || (mob_id >= 700 && mob_id <= 718) || // NPC + (mob_id >= 721 && mob_id <= 755) || (mob_id >= 757 && mob_id <= 811) || // NPC + (mob_id >= 813 && mob_id <= 834) || // NPC + (mob_id > 1000 && mob_id < 1582)) { // monsters + for(i=0; i < fd_max; i++) { + if(session[i] && (pl_sd = session[i]->session_data) && pl_sd->state.auth) { + if(pc_isriding(pl_sd)) { // temporary prevention of crash caused by peco + disguise, will look into a better solution [Valaris] + clif_displaymessage(fd, msg_table[227]); // Cannot wear disguise while riding a Peco. + } else { + pl_sd->disguiseflag = 1; // set to override items with disguise script [Valaris] + pl_sd->disguise = mob_id; + pc_setpos(pl_sd, pl_sd->mapname, pl_sd->bl.x, pl_sd->bl.y, 3); + } + } + } + clif_displaymessage(fd, msg_table[122]); // Disguise applied. + } else { + return -1; + } + + return 0; +} + /*========================================== * @undisguise by [Yor] *------------------------------------------ @@ -6474,6 +6522,30 @@ int atcommand_undisguise( return 0; } +/*========================================== + * UndisguiseAll + *------------------------------------------ + */ +int atcommand_undisguiseall( + const int fd, struct map_session_data* sd, + const char* command, const char* message) +{ + struct map_session_data *pl_sd; + int i; + nullpo_retr(-1, sd); + + for(i=0; i < fd_max; i++) { + if(session[i] && (pl_sd = session[i]->session_data) && pl_sd->state.auth && pl_sd->disguise) { + clif_clearchar(&pl_sd->bl, 9); + pl_sd->disguise = 0; + pc_setpos(pl_sd, pl_sd->mapname, pl_sd->bl.x, pl_sd->bl.y, 3); + } + } + clif_displaymessage(fd, msg_table[124]); // Undisguise applied. + + return 0; +} + /*========================================== * @broadcast by [Valaris] *------------------------------------------ @@ -7579,6 +7651,9 @@ atcommand_sound( if(sscanf(message, "%99[^\n]", sound_file) < 1) return -1; + if(strstr(sound_file, ".wav") == NULL) + strcat(sound_file, ".wav"); + clif_soundeffectall(&sd->bl, sound_file,0); return 0; diff --git a/src/map/atcommand.h b/src/map/atcommand.h index c66bd63aee..f639d8c337 100644 --- a/src/map/atcommand.h +++ b/src/map/atcommand.h @@ -233,6 +233,8 @@ enum AtCommandType { AtCommand_CharKillableId, // by Dino9021 AtCommand_CharKillableId2, // by Dino9021 AtCommand_Sound, + AtCommand_UndisguiseAll, + AtCommand_DisguiseAll, // end AtCommand_Unknown, diff --git a/src/map/clif.c b/src/map/clif.c index ee0d9cf933..f596b30207 100644 --- a/src/map/clif.c +++ b/src/map/clif.c @@ -1527,6 +1527,7 @@ static int clif_waitclose(int tid, unsigned int tick, int id, int data) { if (session[id]) session[id]->eof = 1; + close(id); return 0; } @@ -10347,7 +10348,8 @@ static int clif_parse(int fd) { RFIFOSKIP(fd,2); break; case 0x7532: // 接続の切断 - session[fd]->eof = 1; + close(fd); + session[fd]->eof=1; break; } return 0; @@ -10416,6 +10418,7 @@ static int clif_parse(int fd) { cmd >= MAX_PACKET_DB || packet_size_table[packet_ver-5][cmd] == 0) { if (!fd) return 0; + close(fd); session[fd]->eof = 1; printf("clif_parse: session #%d, packet 0x%x (%d bytes received) -> disconnected.\n", fd, cmd, RFIFOREST(fd)); return 0; @@ -10428,7 +10431,8 @@ static int clif_parse(int fd) { return 0; // 可変長パケットで長さの所までデータが来てない packet_len = RFIFOW(fd,2); if (packet_len < 4 || packet_len > 32768) { - session[fd]->eof = 1; + close(fd); + session[fd]->eof =1; return 0; } } diff --git a/src/map/clif.h b/src/map/clif.h index f0449765b1..d1b24f223e 100644 --- a/src/map/clif.h +++ b/src/map/clif.h @@ -13,7 +13,14 @@ typedef unsigned int in_addr_t; #include "map.h" +#define MAX_PACKET_DB 0x224 + extern int packet_db_ver; +struct packet_db { + short len; + void (*func)(); + short pos[20]; +}; void clif_setip(char*); void clif_setport(int);