diff options
author | codemaster <codemaster@54d463be-8e91-2dee-dedb-b68131a5f0ec> | 2004-11-24 22:23:56 +0000 |
---|---|---|
committer | codemaster <codemaster@54d463be-8e91-2dee-dedb-b68131a5f0ec> | 2004-11-24 22:23:56 +0000 |
commit | f622539b5865e948eff27f7dd5bc84dbe1d088d6 (patch) | |
tree | f08b2b5379679c82cde622d20bbd61b00a892c93 /src | |
parent | 7f7c0c4e31a17c9ae854f9460ccd34b4b5698f90 (diff) | |
download | hercules-f622539b5865e948eff27f7dd5bc84dbe1d088d6.tar.gz hercules-f622539b5865e948eff27f7dd5bc84dbe1d088d6.tar.bz2 hercules-f622539b5865e948eff27f7dd5bc84dbe1d088d6.tar.xz hercules-f622539b5865e948eff27f7dd5bc84dbe1d088d6.zip |
- Updated to most of jA's 1067
git-svn-id: https://rathena.svn.sourceforge.net/svnroot/rathena/athena@352 54d463be-8e91-2dee-dedb-b68131a5f0ec
Diffstat (limited to 'src')
-rw-r--r-- | src/char/char.c | 26 | ||||
-rw-r--r-- | src/char/int_guild.c | 21 |
2 files changed, 37 insertions, 10 deletions
diff --git a/src/char/char.c b/src/char/char.c index 5a3995be8..7ad959bd8 100644 --- a/src/char/char.c +++ b/src/char/char.c @@ -2498,6 +2498,7 @@ int lan_ip_check(unsigned char *p){ int parse_char(int fd) { int i, ch; + unsigned short cmd; char email[40]; struct char_session_data *sd; unsigned char *p = (unsigned char *) &session[fd]->client_addr.sin_addr; @@ -2515,10 +2516,29 @@ int parse_char(int fd) { sd = session[fd]->session_data; while (RFIFOREST(fd) >= 2) { -// if (RFIFOW(fd,0) < 30000) -// printf("parse_char: connection #%d, packet: 0x%x (with being read: %d bytes).\n", fd, RFIFOW(fd,0), RFIFOREST(fd)); + cmd = RFIFOW(fd,0); + // crc32のスキップ用 + if( sd==NULL && // 未ログインor管理パケット + RFIFOREST(fd)>=4 && // 最低バイト数制限 & 0x7530,0x7532管理パケ除去 + RFIFOREST(fd)<=21 && // 最大バイト数制限 & サーバーログイン除去 + cmd!=0x20b && // md5通知パケット除去 + (RFIFOREST(fd)<6 || RFIFOW(fd,4)==0x65) ){ // 次に何かパケットが来てるなら、接続でないとだめ + RFIFOSKIP(fd,4); + cmd = RFIFOW(fd,0); + printf("parse_char : %d crc32 skipped\n",fd); + if(RFIFOREST(fd)==0) + return 0; + } - switch(RFIFOW(fd,0)) { +// if(cmd<30000 && cmd!=0x187) +// printf("parse_char : %d %d %d\n",fd,RFIFOREST(fd),cmd); + + // 不正パケットの処理 +// if (sd == NULL && cmd != 0x65 && cmd != 0x20b && cmd != 0x187 && +// cmd != 0x2af8 && cmd != 0x7530 && cmd != 0x7532) +// cmd = 0xffff; // パケットダンプを表示させる + + switch(cmd){ case 0x20b: //20040622暗号化ragexe対応 if (RFIFOREST(fd) < 19) return 0; diff --git a/src/char/int_guild.c b/src/char/int_guild.c index 586b42f55..eb03dd335 100644 --- a/src/char/int_guild.c +++ b/src/char/int_guild.c @@ -619,8 +619,15 @@ int guild_nextexp(int level) { } // ギルドスキルがあるか確認 -int guild_checkskill(struct guild *g, int id){ - return g->skill[id-10000].lv; +int guild_checkskill(struct guild *g, int id) { + int idx = id - GD_SKILLBASE; + + + if(idx < 0 || idx >= MAX_GUILDSKILL) + + return 0; + + return g->skill[idx].lv; } // ギルドの情報の再計算 @@ -630,7 +637,7 @@ int guild_calcinfo(struct guild *g) { // スキルIDの設定 for(i = 0; i < MAX_GUILDSKILL; i++) - g->skill[i].id = i + 10000; + g->skill[i].id=i+GD_SKILLBASE; // ギルドレベル if (g->guild_lv <= 0) @@ -649,7 +656,7 @@ int guild_calcinfo(struct guild *g) { g->next_exp = guild_nextexp(g->guild_lv); // メンバ上限(ギルド拡張適用) - g->max_member = 16 + guild_checkskill(g, 10004) * 2; + g->max_member = 16 + guild_checkskill(g, GD_EXTENSION) * 2; // 平均レベルとオンライン人数 g->average_lv = 0; @@ -980,7 +987,7 @@ int mapif_parse_CreateGuild(int fd, int account_id, char *name, struct guild_mem g->max_member = 16; g->average_lv = master->lv; for(i = 0; i < MAX_GUILDSKILL; i++) - g->skill[i].id = i + 10000; + g->skill[i].id=i + GD_SKILLBASE; numdb_insert(guild_db, g->guild_id, g); @@ -1230,9 +1237,9 @@ int mapif_parse_GuildPosition(int fd, int guild_id, int idx, struct guild_positi // ギルドスキルアップ要求 int mapif_parse_GuildSkillUp(int fd, int guild_id, int skill_num, int account_id) { struct guild *g = numdb_search(guild_db, guild_id); - int idx = skill_num - 10000; + int idx = skill_num - GD_SKILLBASE; - if (g == NULL || skill_num < 10000) + if (g == NULL || idx < 0 || idx >= MAX_GUILDSKILL) return 0; if (g->skill_point > 0 && g->skill[idx].id > 0 && g->skill[idx].lv < 10) { |