summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndrei Karas <akaras@inbox.ru>2017-08-16 19:40:07 +0300
committerAndrei Karas <akaras@inbox.ru>2017-08-16 19:40:07 +0300
commit8cf0fdba8fa2efca6e09a08f4c17325a7cd10a98 (patch)
tree1bb8a2ac537bd1a2f7d9123ea803a8a9cb383221
parentb4409352f8aae56483133b4086a580e60660f761 (diff)
downloadplugin-8cf0fdba8fa2efca6e09a08f4c17325a7cd10a98.tar.gz
plugin-8cf0fdba8fa2efca6e09a08f4c17325a7cd10a98.tar.bz2
plugin-8cf0fdba8fa2efca6e09a08f4c17325a7cd10a98.tar.xz
plugin-8cf0fdba8fa2efca6e09a08f4c17325a7cd10a98.zip
Add evol packets id offset. For now offset is 0.
This allow to change evol packets id if they start conflicting with hercules packets in future.
-rw-r--r--src/Makefile.am3
-rw-r--r--src/echar/char.c2
-rw-r--r--src/elogin/send.c3
-rw-r--r--src/emap/clif.c28
-rw-r--r--src/emap/init.c24
-rw-r--r--src/emap/send.c44
6 files changed, 53 insertions, 51 deletions
diff --git a/src/Makefile.am b/src/Makefile.am
index 8315549..86cd2a1 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -135,7 +135,8 @@ MAP_SRC = emap/atcommand.c \
# need remove -Wno-unused
SHARED_CFLAGS = ${CFLAGS} -O3 -pipe -ffast-math -std=c99 -Wall -Wextra -Wno-sign-compare -Wno-unused -fno-omit-frame-pointer \
- -DPCRE_SUPPORT -I../../.. -I../../../../3rdparty -DPACKETVER=20150513
+ -DPCRE_SUPPORT -I../../.. -I../../../../3rdparty -DPACKETVER=20150513 \
+ -DevolPacketOffset=0
SHARED_LDFLAGS = -avoid-version -Wl,--no-undefined
if ENABLE_STATIC_BUILD
diff --git a/src/echar/char.c b/src/echar/char.c
index e469ae1..220c28b 100644
--- a/src/echar/char.c
+++ b/src/echar/char.c
@@ -288,7 +288,7 @@ void send_additional_slots(int fd, struct char_session_data* sd)
if (type == 0)
continue;
WFIFOHEAD (fd, 19);
- WFIFOW (fd, 0) = 0xb17;
+ WFIFOW (fd, 0) = 0xb17 + evolPacketOffset;
WFIFOL (fd, 2) = char_id;
WFIFOB (fd, 6) = (unsigned char)type;
WFIFOW (fd, 7) = name_id;
diff --git a/src/elogin/send.c b/src/elogin/send.c
index 2b50b14..f91cd84 100644
--- a/src/elogin/send.c
+++ b/src/elogin/send.c
@@ -22,10 +22,11 @@ void send_server_version(int fd)
{
WFIFOHEAD(fd, 4 + 8);
WFIFOW(fd, 0) = 0x7531;
- WFIFOW(fd, 2) = 16;
+ WFIFOW(fd, 2) = 18;
WFIFOL(fd, 4) = 0; // unused
WFIFOL(fd, 8) = 19; // plugin version
WFIFOL(fd, 12) = serverPacketVersion; // server packet version
+ WFIFOW(fd, 16) = evolPacketOffset; // packet id offset
WFIFOSET(fd, WFIFOW(fd,2));
}
diff --git a/src/emap/clif.c b/src/emap/clif.c
index 6d02284..bc9d77b 100644
--- a/src/emap/clif.c
+++ b/src/emap/clif.c
@@ -113,7 +113,7 @@ void eclif_quest_send_list_pre(TBL_PC **sdPtr)
int info_len = 4 + 1 + 3 * 4 + 4;
int len = sd->avail_quests * info_len + 8;
WFIFOHEAD(fd, len);
- WFIFOW(fd, 0) = 0xb23;
+ WFIFOW(fd, 0) = 0xb23 + evolPacketOffset;
WFIFOW(fd, 2) = len;
WFIFOL(fd, 4) = sd->avail_quests;
for (int i = 0; i < sd->avail_quests; i++ )
@@ -175,7 +175,7 @@ void eclif_quest_add(TBL_PC *sd,
else
{ // data->clientVersion >= 20
WFIFOHEAD(fd, 23);
- WFIFOW(fd, 0) = 0xb24;
+ WFIFOW(fd, 0) = 0xb24 + evolPacketOffset;
WFIFOL(fd, 2) = qd->quest_id;
WFIFOB(fd, 6) = qd->state;
WFIFOL(fd, 7) = qd->count[0];
@@ -213,7 +213,7 @@ void eclif_charnameack_pre(int *fdPtr,
{
char *buf;
CREATE(buf, char, len);
- WBUFW(buf, 0) = 0xB01;
+ WBUFW(buf, 0) = 0xB01 + evolPacketOffset;
WBUFW(buf, 2) = len;
WBUFL(buf, 4) = bl->id;
memcpy(WBUFP(buf, 8), tr, trLen);
@@ -223,7 +223,7 @@ void eclif_charnameack_pre(int *fdPtr,
else
{
WFIFOHEAD(fd, len);
- WFIFOW(fd, 0) = 0xB01;
+ WFIFOW(fd, 0) = 0xB01 + evolPacketOffset;
WFIFOW(fd, 2) = len;
WFIFOL(fd, 4) = bl->id;
memcpy(WFIFOP(fd, 8), tr, trLen);
@@ -277,7 +277,7 @@ void eclif_charnameack_pre(int *fdPtr,
{
char *buf;
CREATE(buf, char, len);
- WBUFW(buf, 0) = 0xB01;
+ WBUFW(buf, 0) = 0xB01 + evolPacketOffset;
WBUFW(buf, 2) = len;
WBUFL(buf, 4) = bl->id;
memcpy(WBUFP(buf, 8), tr, trLen);
@@ -287,7 +287,7 @@ void eclif_charnameack_pre(int *fdPtr,
else
{
WFIFOHEAD(fd, len);
- WFIFOW(fd, 0) = 0xB01;
+ WFIFOW(fd, 0) = 0xB01 + evolPacketOffset;
WFIFOW(fd, 2) = len;
WFIFOL(fd, 4) = bl->id;
memcpy(WFIFOP(fd, 8), tr, trLen);
@@ -534,7 +534,7 @@ int eclif_send_actual_pre(int *fd,
hookStop();
return 0;
}
- if (packet == 0xb1e)
+ if (packet == 0xb1e + evolPacketOffset)
{
struct SessionExt *data = session_get(*fd);
if (!data)
@@ -801,7 +801,7 @@ void eclif_getareachar_item_pre(struct map_session_data **sdPtr,
return;
WFIFOHEAD(fd, 28);
- WFIFOW(fd, 0) = 0xb18;
+ WFIFOW(fd, 0) = 0xb18 + evolPacketOffset;
WFIFOL(fd, 2) = fitem->bl.id;
if((view = itemdb_viewid(fitem->item_data.nameid)) > 0)
WFIFOW(fd, 6) = view;
@@ -845,7 +845,7 @@ void eclif_dropflooritem_pre(struct flooritem_data **fitemPtr)
fitem->suby = 0;
}
- WBUFW(buf, 0) = 0xb19;
+ WBUFW(buf, 0) = 0xb19 + evolPacketOffset;
WBUFL(buf, 2) = fitem->bl.id;
if((view = itemdb_viewid(fitem->item_data.nameid)) > 0)
WBUFW(buf, 6) = view;
@@ -874,7 +874,7 @@ void eclif_sendbgemblem_area_pre(struct map_session_data **sdPtr)
if (!sd || !data)
return;
- WBUFW(buf, 0) = 0xb1a;
+ WBUFW(buf, 0) = 0xb1a + evolPacketOffset;
WBUFL(buf, 2) = sd->bl.id;
safestrncpy(WBUFP(buf,6), sd->status.name, NAME_LENGTH); // name don't show in screen.
WBUFW(buf, 30) = sd->bg_id;
@@ -897,7 +897,7 @@ void eclif_sendbgemblem_single_pre(int *fdPtr,
}
WFIFOHEAD(fd, 34);
- WFIFOW(fd, 0) = 0xb1a;
+ WFIFOW(fd, 0) = 0xb1a + evolPacketOffset;
WFIFOL(fd, 2) = sd->bl.id;
safestrncpy(WFIFOP(fd, 6), sd->status.name, NAME_LENGTH);
WFIFOW(fd, 30) = sd->bg_id;
@@ -999,7 +999,7 @@ void eclif_useskill(struct block_list* bl,
// for client >= 18
const int len = 36;
- WBUFW(buf, 0) = 0xb1e;
+ WBUFW(buf, 0) = 0xb1e + evolPacketOffset;
WBUFW(buf, 2) = len;
WBUFL(buf, 4) = src_id;
WBUFL(buf, 8) = dst_id;
@@ -1122,7 +1122,7 @@ void eclif_addskill_pre(struct map_session_data **sdPtr,
const int sz = 45;
WFIFOHEAD(fd, sz);
- WFIFOW(fd, 0) = 0xb1f;
+ WFIFOW(fd, 0) = 0xb1f + evolPacketOffset;
WFIFOW(fd, 2) = sz;
WFIFOW(fd, 4) = id;
WFIFOL(fd, 6) = skill->get_inf(id);
@@ -1171,7 +1171,7 @@ void eclif_skillinfo_pre(struct map_session_data **sdPtr,
const int sz = 21;
WFIFOHEAD(fd, sz);
- WFIFOW(fd, 0) = 0xb20;
+ WFIFOW(fd, 0) = 0xb20 + evolPacketOffset;
WFIFOW(fd, 2) = sz;
WFIFOW(fd, 4) = skill_id;
WFIFOL(fd, 6) = inf ? inf : skill->get_inf(skill_id);
diff --git a/src/emap/init.c b/src/emap/init.c
index 6b46b0a..8cd7cd4 100644
--- a/src/emap/init.c
+++ b/src/emap/init.c
@@ -196,18 +196,18 @@ HPExport void plugin_init (void)
do_init_langs();
addPacket(0x7530, 22, map_parse_version, hpClif_Parse);
- addPacket(0xb07, 26, map_parse_join_channel, hpClif_Parse);
- addPacket(0xb09, 26, map_parse_part_channel, hpClif_Parse);
- addPacket(0xb0c, -1, map_parse_pet_say, hpClif_Parse);
- addPacket(0xb0d, 3, map_parse_pet_emote, hpClif_Parse);
- addPacket(0xb0e, 4, map_parse_set_status, hpClif_Parse);
- addPacket(0xb0f, 2, map_parse_get_online_list, hpClif_Parse);
- addPacket(0xb11, 10, map_parse_pet_move, hpClif_Parse);
- addPacket(0xb12, 9, map_parse_pet_dir, hpClif_Parse);
- addPacket(0xb13, -1, map_parse_homun_say, hpClif_Parse);
- addPacket(0xb14, 3, map_parse_homun_emote, hpClif_Parse);
- addPacket(0xb15, 9, map_parse_homun_dir, hpClif_Parse);
- addPacket(0xb26, 6, map_clif_parse_useitem2, hpClif_Parse);
+ addPacket(0xb07 + evolPacketOffset, 26, map_parse_join_channel, hpClif_Parse);
+ addPacket(0xb09 + evolPacketOffset, 26, map_parse_part_channel, hpClif_Parse);
+ addPacket(0xb0c + evolPacketOffset, -1, map_parse_pet_say, hpClif_Parse);
+ addPacket(0xb0d + evolPacketOffset, 3, map_parse_pet_emote, hpClif_Parse);
+ addPacket(0xb0e + evolPacketOffset, 4, map_parse_set_status, hpClif_Parse);
+ addPacket(0xb0f + evolPacketOffset, 2, map_parse_get_online_list, hpClif_Parse);
+ addPacket(0xb11 + evolPacketOffset, 10, map_parse_pet_move, hpClif_Parse);
+ addPacket(0xb12 + evolPacketOffset, 9, map_parse_pet_dir, hpClif_Parse);
+ addPacket(0xb13 + evolPacketOffset, -1, map_parse_homun_say, hpClif_Parse);
+ addPacket(0xb14 + evolPacketOffset, 3, map_parse_homun_emote, hpClif_Parse);
+ addPacket(0xb15 + evolPacketOffset, 9, map_parse_homun_dir, hpClif_Parse);
+ addPacket(0xb26 + evolPacketOffset, 6, map_clif_parse_useitem2, hpClif_Parse);
addHookPre(atcommand, msgfd, eatcommand_msgfd_pre);
addHookPre(atcommand, msgsd, eatcommand_msgsd_pre);
diff --git a/src/emap/send.c b/src/emap/send.c
index a42df55..71f7d9e 100644
--- a/src/emap/send.c
+++ b/src/emap/send.c
@@ -34,7 +34,7 @@ void send_npccommand (struct map_session_data *sd, int npcId, int cmd)
int fd = sd->fd;
WFIFOHEAD (fd, 16);
- WFIFOW (fd, 0) = 0xB00;
+ WFIFOW (fd, 0) = 0xB00 + evolPacketOffset;
WFIFOL (fd, 2) = npcId;
WFIFOW (fd, 6) = cmd;
WFIFOL (fd, 8) = 0;
@@ -51,7 +51,7 @@ void send_npccommand2 (struct map_session_data *sd, int npcId, int cmd, int id,
int fd = sd->fd;
WFIFOHEAD (fd, 16);
- WFIFOW (fd, 0) = 0xB00;
+ WFIFOW (fd, 0) = 0xB00 + evolPacketOffset;
WFIFOL (fd, 2) = npcId;
WFIFOW (fd, 6) = cmd;
WFIFOL (fd, 8) = id;
@@ -94,7 +94,7 @@ void send_changelook(struct map_session_data* sd, struct map_session_data* sd2,
if (tdata)
{
WFIFOHEAD (fd, 19);
- WFIFOW (fd, 0) = 0xb17;
+ WFIFOW (fd, 0) = 0xb17 + evolPacketOffset;
WFIFOL (fd, 2) = id;
WFIFOB (fd, 6) = type;
WFIFOW (fd, 7) = val;
@@ -133,7 +133,7 @@ void send_changelook(struct map_session_data* sd, struct map_session_data* sd2,
void send_mapmask(int fd, int mask)
{
WFIFOHEAD (fd, 10);
- WFIFOW (fd, 0) = 0xb02;
+ WFIFOW (fd, 0) = 0xb02 + evolPacketOffset;
WFIFOL (fd, 2) = mask;
WFIFOL (fd, 6) = 0;
WFIFOSET (fd, 10);
@@ -145,7 +145,7 @@ void send_mapmask_brodcast(const int map, const int mask)
char buf[10];
bl.m = map;
- WBUFW (buf, 0) = 0xb02;
+ WBUFW (buf, 0) = 0xb02 + evolPacketOffset;
WBUFL (buf, 2) = mask;
WBUFL (buf, 6) = 0;
clif->send(buf, 10, &bl, ALL_SAMEMAP);
@@ -160,7 +160,7 @@ void send_mob_info(struct block_list* bl1, struct block_list* bl2,
char buf[12];
TBL_MOB *md = (TBL_MOB *)bl1;
- WBUFW (buf, 0) = 0xb03;
+ WBUFW (buf, 0) = 0xb03 + evolPacketOffset;
WBUFW (buf, 2) = 12; // len
WBUFL (buf, 4) = md->bl.id;
WBUFL (buf, 8) = md->status.rhw.range;
@@ -182,7 +182,7 @@ void send_pc_own_flags(struct block_list* bl)
const int fd = sd->fd;
WFIFOHEAD(fd, 8);
- WFIFOW(fd, 0) = 0xb25;
+ WFIFOW(fd, 0) = 0xb25 + evolPacketOffset;
WFIFOW(fd, 2) = 8;
WFIFOL(fd, 4) = sd->group_id;
WFIFOSET(fd, 8);
@@ -211,7 +211,7 @@ void send_pc_info(struct block_list* bl1,
if (bl1 == bl2 || tdata->clientVersion >= 21)
len = 16;
char buf[len];
- WBUFW (buf, 0) = 0xb0a;
+ WBUFW (buf, 0) = 0xb0a + evolPacketOffset;
WBUFW (buf, 2) = len;
WBUFL (buf, 4) = sd->bl.id;
if (pc_has_permission(sd, permission_send_gm_flag))
@@ -243,7 +243,7 @@ void send_npc_info(struct block_list* bl1,
TBL_NPC *const nd = (TBL_NPC*)bl1;
char buf[12];
- WBUFW (buf, 0) = 0xb0b;
+ WBUFW (buf, 0) = 0xb0b + evolPacketOffset;
WBUFW (buf, 2) = 12; // len
WBUFL (buf, 4) = nd->bl.id;
WBUFL (buf, 8) = nd->area_size;
@@ -277,7 +277,7 @@ void send_advmoving(struct unit_data* ud, bool moving, struct block_list *tbl, e
char *buf;
CREATE(buf, char, i);
- WBUFW (buf, 0) = 0xb04;
+ WBUFW (buf, 0) = 0xb04 + evolPacketOffset;
WBUFW (buf, 2) = i;
WBUFL (buf, 4) = bl->id;
WBUFW (buf, 8) = status->get_speed(bl);
@@ -300,7 +300,7 @@ void send_changemusic_brodcast(const int map, const char *music)
CREATE(buf, char, sz);
bl.m = map;
- WBUFW (buf, 0) = 0xb05;
+ WBUFW (buf, 0) = 0xb05 + evolPacketOffset;
WBUFW (buf, 2) = sz;
strcpy (WBUFP (buf, 4), music);
clif->send (buf, sz, &bl, ALL_SAMEMAP);
@@ -316,7 +316,7 @@ void send_changenpc_title (struct map_session_data *sd, const int npcId, const c
const int len = (int)strlen(name);
const int sz = len + 10;
WFIFOHEAD (fd, sz);
- WFIFOW (fd, 0) = 0xb06;
+ WFIFOW (fd, 0) = 0xb06 + evolPacketOffset;
WFIFOW (fd, 2) = sz;
WFIFOL (fd, 4) = npcId;
WFIFOW (fd, 8) = len;
@@ -330,7 +330,7 @@ void send_join_ack(int fd, const char *const name, int flag)
return;
WFIFOHEAD (fd, 27);
- WFIFOW (fd, 0) = 0xb08;
+ WFIFOW (fd, 0) = 0xb08 + evolPacketOffset;
safestrncpy (WFIFOP (fd, 2), name, 24);
WFIFOB (fd, 26) = flag;
WFIFOSET (fd, 27);
@@ -359,7 +359,7 @@ void send_online_list(int fd, const char *buf, unsigned size)
return;
const unsigned int len = size + 4 + 1;
WFIFOHEAD (fd, len);
- WFIFOW (fd, 0) = 0xb10;
+ WFIFOW (fd, 0) = 0xb10 + evolPacketOffset;
WFIFOW (fd, 2) = len;
memcpy (WFIFOP (fd, 4), buf, size);
WFIFOB (fd, size + 4) = 0;
@@ -377,7 +377,7 @@ void send_client_command(struct map_session_data *sd, const char *const command)
const unsigned int len = (unsigned int)strlen(command);
const int fd = sd->fd;
WFIFOHEAD (fd, len);
- WFIFOW (fd, 0) = 0xb16;
+ WFIFOW (fd, 0) = 0xb16 + evolPacketOffset;
WFIFOW (fd, 2) = len + 4;
memcpy (WFIFOP (fd, 4), command, len);
WFIFOSET (fd, len + 4);
@@ -390,7 +390,7 @@ void send_changelook2(struct map_session_data* sd, struct block_list *bl, int id
unsigned char buf[32];
int i;
- WBUFW(buf, 0) = 0xb17;
+ WBUFW(buf, 0) = 0xb17 + evolPacketOffset;
WBUFL(buf, 2) = id;
WBUFB(buf, 6) = type;
WBUFW(buf, 7) = val;
@@ -430,7 +430,7 @@ void send_setwall(int m, int layer, int x1, int y1, int x2, int y2, int mask, en
{
unsigned char buf[50];
- WBUFW(buf, 0) = 0xb1b;
+ WBUFW(buf, 0) = 0xb1b + evolPacketOffset;
WBUFW(buf, 2) = x1;
WBUFW(buf, 4) = y1;
WBUFW(buf, 6) = x2;
@@ -454,7 +454,7 @@ void send_setwall_single(int fd, int m, int layer, int x1, int y1, int x2, int y
return;
WFIFOHEAD (fd, 34);
- WFIFOW(fd, 0) = 0xb1b;
+ WFIFOW(fd, 0) = 0xb1b + evolPacketOffset;
WFIFOW(fd, 2) = x1;
WFIFOW(fd, 4) = y1;
WFIFOW(fd, 6) = x2;
@@ -475,7 +475,7 @@ void send_pc_skin(int fd, int npcId, const char *const skin)
const int sz = (int)strlen(skin) + 9;
WFIFOHEAD (fd, sz);
- WFIFOW(fd, 0) = 0xb1c;
+ WFIFOW(fd, 0) = 0xb1c + evolPacketOffset;
WFIFOW(fd, 2) = sz;
WFIFOL(fd, 4) = npcId;
strcpy(WFIFOP (fd, 8), skin);
@@ -489,7 +489,7 @@ void send_pc_killed(int fd, struct block_list* bl)
return;
WFIFOHEAD (fd, 6);
- WFIFOW(fd, 0) = 0xb1d;
+ WFIFOW(fd, 0) = 0xb1d + evolPacketOffset;
if (bl)
WFIFOL(fd, 2) = bl->id;
else
@@ -500,7 +500,7 @@ void send_pc_killed(int fd, struct block_list* bl)
void send_walk_fail(int fd, int x, int y)
{
WFIFOHEAD(fd, 10);
- WFIFOW(fd,0) = 0xb21;
+ WFIFOW(fd,0) = 0xb21 + evolPacketOffset;
WFIFOL(fd, 2) = (unsigned int)timer->gettick();
WFIFOW(fd, 6) = x;
WFIFOW(fd, 8) = y;
@@ -519,7 +519,7 @@ void send_homun_exp(struct homun_data *hd,
return;
WFIFOHEAD(fd, 10);
- WFIFOW(fd, 0) = 0xb22;
+ WFIFOW(fd, 0) = 0xb22 + evolPacketOffset;
WFIFOL(fd, 2) = exp;
WFIFOL(fd, 6) = 0;
WFIFOSET(fd, 10);