diff options
-rw-r--r-- | src/Makefile.am | 1 | ||||
-rw-r--r-- | src/elogin/parse.c | 4 | ||||
-rw-r--r-- | src/emap/clif.c | 388 | ||||
-rw-r--r-- | src/emap/clif.h | 3 | ||||
-rw-r--r-- | src/emap/packets_struct.h | 249 | ||||
-rw-r--r-- | src/emap/script_buildins.c | 4 |
6 files changed, 15 insertions, 634 deletions
diff --git a/src/Makefile.am b/src/Makefile.am index 54492b3..8315549 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -68,7 +68,6 @@ MAP_SRC = emap/atcommand.c \ emap/mob.h \ emap/npc.c \ emap/npc.h \ - emap/packets_struct.h \ emap/parse.c \ emap/parse.h \ emap/pc.c \ diff --git a/src/elogin/parse.c b/src/elogin/parse.c index 9429673..6ca6043 100644 --- a/src/elogin/parse.c +++ b/src/elogin/parse.c @@ -34,7 +34,7 @@ void login_parse_version(int fd) clientVersion = RFIFOL(fd, 2); - if (clientVersion < 15) + if (clientVersion < 16) { lclif->login_error(fd, 5); return; @@ -58,7 +58,7 @@ bool elogin_client_login_pre(int *fdPtr, char username[NAME_LENGTH]; safestrncpy(username, RFIFOP(fd, 6), NAME_LENGTH); int len = (int)safestrnlen(username, NAME_LENGTH); - if (clientVersion < 15) + if (clientVersion < 16) { lclif->login_error(fd, 5); hookStop(); diff --git a/src/emap/clif.c b/src/emap/clif.c index f3a6173..4f8ac36 100644 --- a/src/emap/clif.c +++ b/src/emap/clif.c @@ -27,7 +27,6 @@ #include "emap/clif.h" #include "emap/lang.h" #include "emap/map.h" -#include "emap/packets_struct.h" #include "emap/send.h" #include "emap/data/itemd.h" #include "emap/data/mapd.h" @@ -488,29 +487,14 @@ bool eclif_send_pre(const void **bufPtr, if (*len >= 2) { const int packet = RBUFW (buf, 0); - if (packet == 0x9dd || packet == 0x9dc || packet == 0x9db || packet == 0x8c8) + if (packet == 0x915 || + packet == 0x90f || + packet == 0x914 || + packet == 0x2e1) { - struct map_session_data *sd = BL_CAST(BL_PC, bl); - struct SessionExt *data = session_get_bysd(sd); - if (!data) - return true; - if (data->clientVersion < 16) - { // not sending new packet to old clients - hookStop(); - return true; - } - } - if (packet == 0x915 || packet == 0x90f || packet == 0x914 || packet == 0x2e1) - { - struct map_session_data *sd = BL_CAST(BL_PC, bl); - struct SessionExt *data = session_get_bysd(sd); - if (!data) - return true; - if (data->clientVersion >= 16) - { // not sending old packet to new clients - hookStop(); - return true; - } + // not sending old packet to new clients + hookStop(); + return true; } if (packet == 0x9cb) { @@ -553,35 +537,17 @@ int eclif_send_actual_pre(int *fd, const int packet = RBUFW (buf, 0); if (packet == 0x1d7 || packet == 0x84b || - packet == 0x2dd) + packet == 0x2dd || + packet == 0x915 || + packet == 0x90f || + packet == 0x914 || + packet == 0x2e1) { // not sending old packets to new clients // probably useless hookStop(); return 0; } - if (packet == 0x9dd || packet == 0x9dc || packet == 0x9db || packet == 0x8c8) - { - struct SessionExt *data = session_get(*fd); - if (!data) - return 0; - if (data->clientVersion < 16) - { // not sending new packets to old clients - hookStop(); - return 0; - } - } - if (packet == 0x915 || packet == 0x90f || packet == 0x914 || packet == 0x2e1) - { - struct SessionExt *data = session_get(*fd); - if (!data) - return 0; - if (data->clientVersion >= 16) - { // not sending old packets to new clients - hookStop(); - return 0; - } - } if (packet == 0xb1e) { struct SessionExt *data = session_get(*fd); @@ -692,25 +658,6 @@ static inline void WBUFPOS2(uint8* p, unsigned short pos, short x0, short y0, sh p[5] = (uint8)((sx0<<4) | (sy0&0x0f)); } -static inline unsigned char clif_bl_type_old(struct block_list *bl) -{ - nullpo_retr(0x1, bl); - switch (bl->type) - { - case BL_PC: return (disguised(bl) && !pc->db_checkid(status->get_viewdata(bl)->class))? 0x1:0x0; //PC_TYPE - case BL_ITEM: return 0x2; //ITEM_TYPE - case BL_SKILL: return 0x3; //SKILL_TYPE - case BL_CHAT: return 0x4; //UNKNOWN_TYPE - case BL_MOB: return pc->db_checkid(status->get_viewdata(bl)->class)?0x0:0x5; //NPC_MOB_TYPE - case BL_NPC: return pc->db_checkid(status->get_viewdata(bl)->class)?0x0:0x6; //NPC_EVT_TYPE - case BL_PET: return pc->db_checkid(status->get_viewdata(bl)->class)?0x0:0x7; //NPC_PET_TYPE - case BL_HOM: return 0x8; //NPC_HOM_TYPE - case BL_MER: return 0x9; //NPC_MERSOL_TYPE - case BL_ELEM: return 0xa; //NPC_ELEMENTAL_TYPE - default: return 0x1; //NPC_TYPE - } -} - //Modifies the type of damage according to status changes [Skotlex] //Aegis data specifies that: 4 endure against single hit sources, 9 against multi-hit. static inline int clif_calc_delay(int type, int div, int damage, int delay) @@ -718,310 +665,6 @@ static inline int clif_calc_delay(int type, int div, int damage, int delay) return (delay == 0 && damage > 0) ? (div > 1 ? 9 : 4) : type; } -// this function must be used only by clients version < 16 -void eclif_set_unit_idle_old(struct block_list* bl, - struct map_session_data *tsd, - enum send_target target) -{ - struct map_session_data* sd; - struct status_change* sc = status->get_sc(bl); - struct view_data* vd = status->get_viewdata(bl); - struct packet_idle_unit_old p; - int g_id = status->get_guild_id(bl); - - nullpo_retv(bl); - - sd = BL_CAST(BL_PC, bl); - - p.PacketType = 0x915; - p.PacketLength = sizeof(p); - p.objecttype = clif_bl_type_old(bl); -// p.AID = bl->id; -// p.GID = (sd) ? sd->status.char_id : 0; // CCODE - p.GID = bl->id; - p.speed = status->get_speed(bl); - p.bodyState = (sc) ? sc->opt1 : 0; - p.healthState = (sc) ? sc->opt2 : 0; - p.effectState = (sc) ? sc->option : bl->type == BL_NPC ? ((TBL_NPC*)bl)->option : 0; - p.job = vd->class; - p.head = vd->hair_style; - p.weapon = vd->weapon; - p.accessory = vd->head_bottom; - p.accessory2 = vd->head_top; - p.accessory3 = vd->head_mid; - if (bl->type == BL_NPC && vd->class == FLAG_CLASS) - { //The hell, why flags work like this? - p.accessory = status->get_emblem_id(bl); - p.accessory2 = GetWord(g_id, 1); - p.accessory3 = GetWord(g_id, 0); - } - p.headpalette = vd->hair_color; - p.bodypalette = vd->cloth_color; - p.headDir = (sd)? sd->head_dir : 0; - p.robe = vd->robe; - p.GUID = g_id; - p.GEmblemVer = status->get_emblem_id(bl); - p.honor = (sd) ? sd->status.manner : 0; - p.virtue = (sc) ? sc->opt3 : 0; - p.isPKModeON = (sd && sd->status.karma) ? 1 : 0; - p.sex = vd->sex; - WBUFPOS(&p.PosDir[0],0,bl->x,bl->y,unit->getdir(bl)); - p.xSize = p.ySize = (sd) ? 5 : 0; - p.state = vd->dead_sit; - p.clevel = clif_setlevel(bl); - p.font = (sd) ? sd->status.font : 0; - if (battle->bc->show_monster_hp_bar && bl->type == BL_MOB && status_get_hp(bl) < status_get_max_hp(bl)) - { - p.maxHP = status_get_max_hp(bl); - p.HP = status_get_hp(bl); - p.isBoss = (((TBL_MOB*)bl)->spawn && ((TBL_MOB*)bl)->spawn->state.boss) ? 1 : 0; - } - else - { - p.maxHP = -1; - p.HP = -1; - p.isBoss = 0; - } - - clif->send(&p,sizeof(p), tsd ? &tsd->bl : bl, target); - - if (disguised(bl)) - { - p.objecttype = pc->db_checkid(status->get_viewdata(bl)->class) ? 0x0 : 0x5; //PC_TYPE : NPC_MOB_TYPE - p.GID = -bl->id; - clif->send(&p,sizeof(p),bl,SELF); - } - -} - -void eclif_spawn_unit_old(struct block_list* bl, enum send_target target) -{ - struct map_session_data* sd; - struct status_change* sc = status->get_sc(bl); - struct view_data* vd = status->get_viewdata(bl); - struct packet_spawn_unit_old p; - int g_id = status->get_guild_id(bl); - - nullpo_retv(bl); - - sd = BL_CAST(BL_PC, bl); - - p.PacketType = 0x90f; - p.PacketLength = sizeof(p); - p.objecttype = clif_bl_type_old(bl); -// p.AID = bl->id; -// p.GID = (sd) ? sd->status.char_id : 0; // CCODE - p.GID = bl->id; - p.speed = status->get_speed(bl); - p.bodyState = (sc) ? sc->opt1 : 0; - p.healthState = (sc) ? sc->opt2 : 0; - p.effectState = (sc) ? sc->option : bl->type == BL_NPC ? ((TBL_NPC*)bl)->option : 0; - p.job = vd->class; - p.head = vd->hair_style; - p.weapon = vd->weapon; - p.accessory = vd->head_bottom; - p.accessory2 = vd->head_top; - p.accessory3 = vd->head_mid; - if (bl->type == BL_NPC && vd->class == FLAG_CLASS) - { //The hell, why flags work like this? - p.accessory = status->get_emblem_id(bl); - p.accessory2 = GetWord(g_id, 1); - p.accessory3 = GetWord(g_id, 0); - } - p.headpalette = vd->hair_color; - p.bodypalette = vd->cloth_color; - p.headDir = (sd)? sd->head_dir : 0; - p.robe = vd->robe; - p.GUID = g_id; - p.GEmblemVer = status->get_emblem_id(bl); - p.honor = (sd) ? sd->status.manner : 0; - p.virtue = (sc) ? sc->opt3 : 0; - p.isPKModeON = (sd && sd->status.karma) ? 1 : 0; - p.sex = vd->sex; - WBUFPOS(&p.PosDir[0],0,bl->x,bl->y,unit->getdir(bl)); - p.xSize = p.ySize = (sd) ? 5 : 0; - p.clevel = clif_setlevel(bl); - p.font = (sd) ? sd->status.font : 0; - if (battle->bc->show_monster_hp_bar && bl->type == BL_MOB && status_get_hp(bl) < status_get_max_hp(bl)) - { - p.maxHP = status_get_max_hp(bl); - p.HP = status_get_hp(bl); - p.isBoss = (((TBL_MOB*)bl)->spawn && ((TBL_MOB*)bl)->spawn->state.boss) ? 1 : 0; - } - else - { - p.maxHP = -1; - p.HP = -1; - p.isBoss = 0; - } - if (disguised(bl)) - { - nullpo_retv(sd); - if (sd->status.class != sd->disguise) - clif->send(&p, sizeof(p), bl, target); - p.objecttype = pc->db_checkid(status->get_viewdata(bl)->class) ? 0x0 : 0x5; //PC_TYPE : NPC_MOB_TYPE - p.GID = -bl->id; - clif->send(&p, sizeof(p), bl, SELF); - } - else - { - clif->send(&p, sizeof(p), bl, target); - } -} - -void eclif_set_unit_walking_old(struct block_list* bl, - struct map_session_data *tsd, - struct unit_data* ud, - enum send_target target) -{ - struct map_session_data* sd; - struct status_change* sc = status->get_sc(bl); - struct view_data* vd = status->get_viewdata(bl); - struct packet_unit_walking_old p; - int g_id = status->get_guild_id(bl); - - nullpo_retv(bl); - nullpo_retv(ud); - - sd = BL_CAST(BL_PC, bl); - - p.PacketType = 0x914; - p.PacketLength = sizeof(p); - p.objecttype = clif_bl_type_old(bl); -// p.AID = bl->id; -// p.GID = (tsd) ? tsd->status.char_id : 0; // CCODE - p.GID = bl->id; - p.speed = status->get_speed(bl); - p.bodyState = (sc) ? sc->opt1 : 0; - p.healthState = (sc) ? sc->opt2 : 0; - p.effectState = (sc) ? sc->option : bl->type == BL_NPC ? ((TBL_NPC*)bl)->option : 0; - p.job = vd->class; - p.head = vd->hair_style; - p.weapon = vd->weapon; - p.accessory = vd->head_bottom; - p.moveStartTime = (unsigned int)timer->gettick(); - p.accessory2 = vd->head_top; - p.accessory3 = vd->head_mid; - p.headpalette = vd->hair_color; - p.bodypalette = vd->cloth_color; - p.headDir = (sd)? sd->head_dir : 0; - p.robe = vd->robe; - p.GUID = g_id; - p.GEmblemVer = status->get_emblem_id(bl); - p.honor = (sd) ? sd->status.manner : 0; - p.virtue = (sc) ? sc->opt3 : 0; - p.isPKModeON = (sd && sd->status.karma) ? 1 : 0; - p.sex = vd->sex; - WBUFPOS2(&p.MoveData[0], 0, bl->x, bl->y, ud->to_x, ud->to_y, 8, 8); - p.xSize = p.ySize = (sd) ? 5 : 0; - p.clevel = clif_setlevel(bl); - p.font = (sd) ? sd->status.font : 0; - if (battle->bc->show_monster_hp_bar && bl->type == BL_MOB && status_get_hp(bl) < status_get_max_hp(bl)) - { - p.maxHP = status_get_max_hp(bl); - p.HP = status_get_hp(bl); - p.isBoss = (((TBL_MOB*)bl)->spawn && ((TBL_MOB*)bl)->spawn->state.boss) ? 1 : 0; - } - else - { - p.maxHP = -1; - p.HP = -1; - p.isBoss = 0; - } - - clif->send(&p, sizeof(p), tsd ? &tsd->bl : bl, target); - - if (disguised(bl)) - { - p.objecttype = pc->db_checkid(status->get_viewdata(bl)->class) ? 0x0 : 0x5; //PC_TYPE : NPC_MOB_TYPE - p.GID = -bl->id; - clif->send(&p, sizeof(p), bl, SELF); - } -} - -void eclif_damage_old(struct block_list* src, - struct block_list* dst, - int sdelay, - int ddelay, - int64 in_damage, - short div, - unsigned char type, - int64 in_damage2) -{ - struct packet_damage_old p; - struct status_change *sc; - int damage,damage2; - - nullpo_retv(src); - nullpo_retv(dst); - - sc = status->get_sc(dst); - - if (sc && sc->count && sc->data[SC_ILLUSION]) - { - if(in_damage) - in_damage = in_damage*(sc->data[SC_ILLUSION]->val2); //+ rnd()%100; - if(in_damage2) - in_damage2 = in_damage2*(sc->data[SC_ILLUSION]->val2); //+ rnd()%100; - } - - damage = (int)min(in_damage,INT_MAX); - damage2 = (int)min(in_damage2,INT_MAX); - - type = clif_calc_delay(type,div,damage+damage2,ddelay); - - p.PacketType = 0x2e1; - p.GID = src->id; - p.targetGID = dst->id; - p.startTime = (uint32)timer->gettick(); - p.attackMT = sdelay; - p.attackedMT = ddelay; - p.count = div; - p.action = type; - - if (battle->bc->hide_woe_damage && map_flag_gvg2(src->m)) - { - p.damage = damage ? div : 0; - p.leftDamage = damage2 ? div : 0; - } - else - { - p.damage = damage; - p.leftDamage = damage2; - } -// p.is_sp_damaged = 0; // [ToDo] IsSPDamage - Displays blue digits. - - if (disguised(dst)) - { - clif->send(&p, sizeof(p), dst, AREA_WOS); - p.targetGID = -dst->id; - clif->send(&p, sizeof(p), dst, SELF); - } - else - { - clif->send(&p, sizeof(p), dst, AREA); - } - - if (disguised(src)) - { - p.GID = -src->id; - if (disguised(dst)) - p.targetGID = dst->id; - - if(damage > 0) - p.damage = -1; - if(damage2 > 0) - p.leftDamage = -1; - - clif->send(&p, sizeof(p), src, SELF); - } - - if (src == dst) - { - unit->setdir(src, unit->getdir(src)); - } -} - void eclif_set_unit_idle_post(struct block_list *bl, TBL_PC *tsd, enum send_target target) @@ -1029,8 +672,6 @@ void eclif_set_unit_idle_post(struct block_list *bl, if (!bl || !tsd) return; - eclif_set_unit_idle_old(bl, tsd, target); - if (bl->type == BL_MOB) send_mob_info(bl, &tsd->bl, target); else if (bl->type == BL_PC) @@ -1044,7 +685,6 @@ void eclif_set_unit_walking_pre(struct block_list **blPtr, struct unit_data **udPtr, enum send_target *target) { - eclif_set_unit_walking_old(*blPtr, *tsdPtr, *udPtr, *target); } void eclif_set_unit_walking_post(struct block_list *bl, @@ -1074,9 +714,6 @@ int eclif_damage_post(int retVal, unsigned char type, int64 in_damage2) { - eclif_damage_old(src, dst, - sdelay, ddelay, in_damage, - div, type, in_damage2); return retVal; } @@ -1092,7 +729,6 @@ void eclif_move_post(struct unit_data *ud) void eclif_spawn_unit_pre(struct block_list **blPtr, enum send_target *target) { - eclif_spawn_unit_old(*blPtr, *target); } bool tempChangeMap; diff --git a/src/emap/clif.h b/src/emap/clif.h index 1353cc7..dba0919 100644 --- a/src/emap/clif.h +++ b/src/emap/clif.h @@ -76,9 +76,6 @@ void eclif_disp_message_pre(struct block_list **srcPtr, const char **mesPtr, enum send_target *targetPtr); -void eclif_set_unit_idle_old(struct block_list* bl, - struct map_session_data *tsd, - enum send_target target); void eclif_spawn_unit_pre(struct block_list **blPtr, enum send_target *target); void eclif_addcards_post(unsigned char *buf, diff --git a/src/emap/packets_struct.h b/src/emap/packets_struct.h deleted file mode 100644 index 1d218b5..0000000 --- a/src/emap/packets_struct.h +++ /dev/null @@ -1,249 +0,0 @@ -/** - * This file is part of Hercules. - * http://herc.ws - http://github.com/HerculesWS/Hercules - * - * Copyright (C) 2013-2015 Hercules Dev Team - * - * Hercules is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see <http://www.gnu.org/licenses/>. - */ - -/* Hercules Renewal: Phase Two http://herc.ws/board/topic/383-hercules-renewal-phase-two/ */ - -#ifndef EVOL_MAP_PACKETS_STRUCT_H -#define EVOL_MAP_PACKETS_STRUCT_H - -#include "common/cbasetypes.h" -#include "common/mmo.h" - -struct packet_idle_unit_old { - short PacketType; -#if PACKETVER >= 20091103 - short PacketLength; - unsigned char objecttype; -#endif -//#if PACKETVER >= 20131223 -// unsigned int AID; -//#endif - unsigned int GID; - short speed; - short bodyState; - short healthState; -#if PACKETVER < 20080102 - short effectState; -#else - int effectState; -#endif - short job; - short head; -#if PACKETVER < 7 - short weapon; -#else - int weapon; -#endif - short accessory; -#if PACKETVER < 7 - short shield; -#endif - short accessory2; - short accessory3; - short headpalette; - short bodypalette; - short headDir; -#if PACKETVER >= 20101124 - short robe; -#endif - unsigned int GUID; - short GEmblemVer; - short honor; -#if PACKETVER > 7 - int virtue; -#else - short virtue; -#endif - uint8 isPKModeON; - unsigned char sex; - unsigned char PosDir[3]; - unsigned char xSize; - unsigned char ySize; - unsigned char state; - short clevel; -#if PACKETVER >= 20080102 - short font; -#endif -#if PACKETVER >= 20120221 - int maxHP; - int HP; - unsigned char isBoss; -#endif -#if PACKETVER >= 20150513 - short body; -#endif -} __attribute__((packed)); - -struct packet_spawn_unit_old { - short PacketType; -#if PACKETVER >= 20091103 - short PacketLength; - unsigned char objecttype; -#endif -//#if PACKETVER >= 20131223 -// unsigned int AID; -//#endif - unsigned int GID; - short speed; - short bodyState; - short healthState; -#if PACKETVER < 20080102 - short effectState; -#else - int effectState; -#endif - short job; - short head; -#if PACKETVER < 7 - short weapon; -#else - int weapon; -#endif - short accessory; -#if PACKETVER < 7 - short shield; -#endif - short accessory2; - short accessory3; - short headpalette; - short bodypalette; - short headDir; -#if PACKETVER >= 20101124 - short robe; -#endif - unsigned int GUID; - short GEmblemVer; - short honor; -#if PACKETVER > 7 - int virtue; -#else - short virtue; -#endif - uint8 isPKModeON; - unsigned char sex; - unsigned char PosDir[3]; - unsigned char xSize; - unsigned char ySize; - short clevel; -#if PACKETVER >= 20080102 - short font; -#endif -#if PACKETVER >= 20120221 - int maxHP; - int HP; - unsigned char isBoss; -#endif -#if PACKETVER >= 20150513 - short body; -#endif -} __attribute__((packed)); - -struct packet_unit_walking_old { - short PacketType; -#if PACKETVER >= 20091103 - short PacketLength; -#endif -#if PACKETVER > 20071106 - unsigned char objecttype; -#endif -//#if PACKETVER >= 20131223 -// unsigned int AID; -//#endif - unsigned int GID; - short speed; - short bodyState; - short healthState; -#if PACKETVER < 7 - short effectState; -#else - int effectState; -#endif - short job; - short head; -#if PACKETVER < 7 - short weapon; -#else - int weapon; -#endif - short accessory; - unsigned int moveStartTime; -#if PACKETVER < 7 - short shield; -#endif - short accessory2; - short accessory3; - short headpalette; - short bodypalette; - short headDir; -#if PACKETVER >= 20101124 - short robe; -#endif - unsigned int GUID; - short GEmblemVer; - short honor; -#if PACKETVER > 7 - int virtue; -#else - short virtue; -#endif - uint8 isPKModeON; - unsigned char sex; - unsigned char MoveData[6]; - unsigned char xSize; - unsigned char ySize; - short clevel; -#if PACKETVER >= 20080102 - short font; -#endif -#if PACKETVER >= 20120221 - int maxHP; - int HP; - unsigned char isBoss; -#endif -#if PACKETVER >= 20150513 - short body; -#endif -} __attribute__((packed)); - -struct packet_damage_old { - short PacketType; - unsigned int GID; - unsigned int targetGID; - unsigned int startTime; - int attackMT; - int attackedMT; -#if PACKETVER < 20071113 - short damage; -#else - int damage; -#endif -//#if PACKETVER >= 20131223 -// unsigned char is_sp_damaged; -//#endif - short count; - unsigned char action; -#if PACKETVER < 20071113 - short leftDamage; -#else - int leftDamage; -#endif -} __attribute__((packed)); - -#endif /* EVOL_MAP_PACKETS_STRUCT_H */ diff --git a/src/emap/script_buildins.c b/src/emap/script_buildins.c index 6acdde0..45444b4 100644 --- a/src/emap/script_buildins.c +++ b/src/emap/script_buildins.c @@ -502,10 +502,8 @@ BUILDIN(requestCraft) st->state = RERUNLINE; // send item request with limit count - if (client && client->clientVersion >= 16) + if (client) send_npccommand2(sd, st->oid, 12, count, 0, 0); - else - clif->scriptinputstr(sd, st->oid); } else { |