diff options
author | Haruna <haru@dotalux.com> | 2014-12-06 19:07:53 +0100 |
---|---|---|
committer | Haruna <haru@dotalux.com> | 2014-12-06 19:07:53 +0100 |
commit | 17ac03365ce89ad770cc4d7f9e802ad0847a1ebc (patch) | |
tree | 3f6b97440e15b755b8e95f8d775e8eb66967d5e6 /src | |
parent | 738e39d33186a4ff1a620509a7c13d986ff43ecb (diff) | |
parent | 115104e15373eb83f8b7fd2c5681fc1305d5d402 (diff) | |
download | hercules-17ac03365ce89ad770cc4d7f9e802ad0847a1ebc.tar.gz hercules-17ac03365ce89ad770cc4d7f9e802ad0847a1ebc.tar.bz2 hercules-17ac03365ce89ad770cc4d7f9e802ad0847a1ebc.tar.xz hercules-17ac03365ce89ad770cc4d7f9e802ad0847a1ebc.zip |
Merge pull request #405 from 4144/clifext
Extend clif.c
Diffstat (limited to 'src')
-rw-r--r-- | src/map/atcommand.c | 52 | ||||
-rw-r--r-- | src/map/clif.c | 227 | ||||
-rw-r--r-- | src/map/clif.h | 7 | ||||
-rw-r--r-- | src/map/guild.c | 20 | ||||
-rw-r--r-- | src/map/irc-bot.c | 32 | ||||
-rw-r--r-- | src/map/map.c | 6 | ||||
-rw-r--r-- | src/map/pc.c | 2 | ||||
-rw-r--r-- | src/plugins/HPMHooking/HPMHooking_map.HPMHooksCore.inc | 8 | ||||
-rw-r--r-- | src/plugins/HPMHooking/HPMHooking_map.HookingPoints.inc | 2 | ||||
-rw-r--r-- | src/plugins/HPMHooking/HPMHooking_map.Hooks.inc | 53 |
10 files changed, 232 insertions, 177 deletions
diff --git a/src/map/atcommand.c b/src/map/atcommand.c index 254da5c5b..f9cb1a641 100644 --- a/src/map/atcommand.c +++ b/src/map/atcommand.c @@ -8609,14 +8609,14 @@ ACMD(join) { clif->message(fd, atcmd_output); return false; } - if( hChSys.local && strcmpi(name + 1, hChSys.local_name) == 0 ) { + if (clif->hChSys->local && strcmpi(name + 1, clif->hChSys->local_name) == 0) { if( !map->list[sd->bl.m].channel ) { clif->chsys_mjoin(sd); if( map->list[sd->bl.m].channel ) /* join might have refused, map has chatting capabilities disabled */ return true; } else channel = map->list[sd->bl.m].channel; - } else if( hChSys.ally && sd->status.guild_id && strcmpi(name + 1, hChSys.ally_name) == 0 ) { + } else if (clif->hChSys->ally && sd->status.guild_id && strcmpi(name + 1, clif->hChSys->ally_name) == 0) { struct guild *g = sd->guild; if( !g ) return false;/* unlikely, but we wont let it crash anyway. */ channel = g->channel; @@ -8653,7 +8653,7 @@ ACMD(join) { return false; } - if( !( channel->opt & hChSys_OPT_ANNOUNCE_JOIN ) ) { + if (!(channel->opt & hChSys_OPT_ANNOUNCE_JOIN)) { sprintf(atcmd_output, msg_txt(1403),name); // You're now in the '%s' channel clif->message(fd, atcmd_output); } @@ -8730,11 +8730,11 @@ ACMD(channel) { sub1[0] = sub2[0] = sub3[0] = '\0'; if (!message || !*message || sscanf(message, "%19s %19s %19s %19s", subcmd, sub1, sub2, sub3) < 1) { - atcmd_channel_help(fd,command,( hChSys.allow_user_channel_creation || pc_has_permission(sd, PC_PERM_HCHSYS_ADMIN) )); + atcmd_channel_help(fd,command, (clif->hChSys->allow_user_channel_creation || pc_has_permission(sd, PC_PERM_HCHSYS_ADMIN))); return true; } - if (strcmpi(subcmd,"create") == 0 && (hChSys.allow_user_channel_creation || pc_has_permission(sd, PC_PERM_HCHSYS_ADMIN))) { + if (strcmpi(subcmd,"create") == 0 && (clif->hChSys->allow_user_channel_creation || pc_has_permission(sd, PC_PERM_HCHSYS_ADMIN))) { // sub1 = channel name; sub2 = password; sub3 = unused if (sub1[0] != '#') { clif->message(fd, msg_txt(1405));// Channel name must start with a '#' @@ -8747,7 +8747,7 @@ ACMD(channel) { clif->message(fd, msg_txt(1408)); // Channel password may not contain spaces return false; } - if (strcmpi(sub1 + 1,hChSys.local_name) == 0 || strcmpi(sub1 + 1,hChSys.ally_name) == 0 || strdb_exists(clif->channel_db, sub1 + 1)) { + if (strcmpi(sub1 + 1, clif->hChSys->local_name) == 0 || strcmpi(sub1 + 1, clif->hChSys->ally_name) == 0 || strdb_exists(clif->channel_db, sub1 + 1)) { sprintf(atcmd_output, msg_txt(1407), sub1);// Channel '%s' is not available clif->message(fd, atcmd_output); return false; @@ -8769,15 +8769,15 @@ ACMD(channel) { // sub1 = list type; sub2 = unused; sub3 = unused if (sub1[0] != '\0' && strcmpi(sub1,"colors") == 0) { char mout[40]; - for (k = 0; k < hChSys.colors_count; k++) { + for (k = 0; k < clif->hChSys->colors_count; k++) { unsigned short msg_len = 1; - msg_len += sprintf(mout, "[ %s list colors ] : %s",command,hChSys.colors_name[k]); + msg_len += sprintf(mout, "[ %s list colors ] : %s", command, clif->hChSys->colors_name[k]); WFIFOHEAD(fd,msg_len + 12); WFIFOW(fd,0) = 0x2C1; WFIFOW(fd,2) = msg_len + 12; WFIFOL(fd,4) = 0; - WFIFOL(fd,8) = hChSys.colors[k]; + WFIFOL(fd,8) = clif->hChSys->colors[k]; safestrncpy((char*)WFIFOP(fd,12), mout, msg_len); WFIFOSET(fd, msg_len + 12); } @@ -8785,14 +8785,14 @@ ACMD(channel) { DBIterator *iter = db_iterator(clif->channel_db); bool show_all = pc_has_permission(sd, PC_PERM_HCHSYS_ADMIN) ? true : false; clif->message(fd, msg_txt(1410)); // -- Public Channels - if (hChSys.local) { - sprintf(atcmd_output, msg_txt(1409), hChSys.local_name, map->list[sd->bl.m].channel ? db_size(map->list[sd->bl.m].channel->users) : 0);// - #%s ( %d users ) + if (clif->hChSys->local) { + sprintf(atcmd_output, msg_txt(1409), clif->hChSys->local_name, map->list[sd->bl.m].channel ? db_size(map->list[sd->bl.m].channel->users) : 0);// - #%s ( %d users ) clif->message(fd, atcmd_output); } - if (hChSys.ally && sd->status.guild_id) { + if (clif->hChSys->ally && sd->status.guild_id) { struct guild *g = sd->guild; if( !g ) { dbi_destroy(iter); return false; } - sprintf(atcmd_output, msg_txt(1409), hChSys.ally_name, db_size(g->channel->users));// - #%s ( %d users ) + sprintf(atcmd_output, msg_txt(1409), clif->hChSys->ally_name, db_size(g->channel->users));// - #%s ( %d users ) clif->message(fd, atcmd_output); } for (channel = dbi_first(iter); dbi_exists(iter); channel = dbi_next(iter)) { @@ -8822,17 +8822,17 @@ ACMD(channel) { return false; } - for (k = 0; k < hChSys.colors_count; k++) { - if (strcmpi(sub2, hChSys.colors_name[k]) == 0) + for (k = 0; k < clif->hChSys->colors_count; k++) { + if (strcmpi(sub2, clif->hChSys->colors_name[k]) == 0) break; } - if (k == hChSys.colors_count) { + if (k == clif->hChSys->colors_count) { sprintf(atcmd_output, msg_txt(1411), sub2);// Unknown color '%s' clif->message(fd, atcmd_output); return false; } channel->color = k; - sprintf(atcmd_output, msg_txt(1413),sub1,hChSys.colors_name[k]);// '%s' channel color updated to '%s' + sprintf(atcmd_output, msg_txt(1413), sub1, clif->hChSys->colors_name[k]);// '%s' channel color updated to '%s' clif->message(fd, atcmd_output); } else if (strcmpi(subcmd,"leave") == 0) { // sub1 = channel name; sub2 = unused; sub3 = unused @@ -9167,7 +9167,7 @@ ACMD(channel) { } } } else { - atcmd_channel_help(fd,command,( hChSys.allow_user_channel_creation || pc_has_permission(sd, PC_PERM_HCHSYS_ADMIN) )); + atcmd_channel_help(fd, command, (clif->hChSys->allow_user_channel_creation || pc_has_permission(sd, PC_PERM_HCHSYS_ADMIN))); } return true; } @@ -9178,14 +9178,14 @@ ACMD(fontcolor) { char mout[40]; if( !message || !*message ) { - for( k = 0; k < hChSys.colors_count; k++ ) { - msg_len += sprintf(mout, "[ %s ] : %s",command,hChSys.colors_name[k]); + for( k = 0; k < clif->hChSys->colors_count; k++ ) { + msg_len += sprintf(mout, "[ %s ] : %s", command, clif->hChSys->colors_name[k]); WFIFOHEAD(fd,msg_len + 12); WFIFOW(fd,0) = 0x2C1; WFIFOW(fd,2) = msg_len + 12; WFIFOL(fd,4) = 0; - WFIFOL(fd,8) = hChSys.colors[k]; + WFIFOL(fd,8) = clif->hChSys->colors[k]; safestrncpy((char*)WFIFOP(fd,12), mout, msg_len); WFIFOSET(fd, msg_len + 12); } @@ -9197,24 +9197,24 @@ ACMD(fontcolor) { return true; } - for( k = 0; k < hChSys.colors_count; k++ ) { - if( strcmpi(message,hChSys.colors_name[k]) == 0 ) + for( k = 0; k < clif->hChSys->colors_count; k++ ) { + if (strcmpi(message, clif->hChSys->colors_name[k]) == 0) break; } - if( k == hChSys.colors_count ) { + if( k == clif->hChSys->colors_count ) { sprintf(atcmd_output, msg_txt(1411), message);// Unknown color '%s' clif->message(fd, atcmd_output); return false; } sd->fontcolor = k + 1; - msg_len += sprintf(mout, "Color changed to '%s'",hChSys.colors_name[k]); + msg_len += sprintf(mout, "Color changed to '%s'", clif->hChSys->colors_name[k]); WFIFOHEAD(fd,msg_len + 12); WFIFOW(fd,0) = 0x2C1; WFIFOW(fd,2) = msg_len + 12; WFIFOL(fd,4) = 0; - WFIFOL(fd,8) = hChSys.colors[k]; + WFIFOL(fd,8) = clif->hChSys->colors[k]; safestrncpy((char*)WFIFOP(fd,12), mout, msg_len); WFIFOSET(fd, msg_len + 12); return true; diff --git a/src/map/clif.c b/src/map/clif.c index 950898ba5..5e459f6a7 100644 --- a/src/map/clif.c +++ b/src/map/clif.c @@ -72,6 +72,8 @@ static struct packet_npc_market_open npcmarket_open; //#define DUMP_UNKNOWN_PACKET //#define DUMP_INVALID_PACKET +static struct hChSysConfig clif_hChSys; + //Converts item type in case of pet eggs. static inline int itemtype(int type) { switch( type ) { @@ -334,6 +336,11 @@ int clif_send_sub(struct block_list *bl, va_list ap) { if( clif->ally_only && !sd->sc.data[SC_CLAIRVOYANCE] && !sd->special_state.intravision && battle->check_target( src_bl, &sd->bl, BCT_ENEMY ) > 0 ) return 0; + return clif->send_actual(fd, buf, len); +} + +int clif_send_actual(int fd, void *buf, int len) +{ WFIFOHEAD(fd, len); if (WFIFOP(fd,0) == buf) { ShowError("WARNING: Invalid use of clif->send function\n"); @@ -2674,36 +2681,36 @@ void read_channels_config(void) { if( !libconfig->setting_lookup_string(settings, "map_local_channel_name", &local_name) ) local_name = "map"; - safestrncpy(hChSys.local_name, local_name, HCHSYS_NAME_LENGTH); + safestrncpy(clif->hChSys->local_name, local_name, HCHSYS_NAME_LENGTH); if( !libconfig->setting_lookup_string(settings, "ally_channel_name", &ally_name) ) ally_name = "ally"; - safestrncpy(hChSys.ally_name, ally_name, HCHSYS_NAME_LENGTH); + safestrncpy(clif->hChSys->ally_name, ally_name, HCHSYS_NAME_LENGTH); if( !libconfig->setting_lookup_string(settings, "irc_channel_name", &irc_name) ) irc_name = "irc"; - safestrncpy(hChSys.irc_name, irc_name, HCHSYS_NAME_LENGTH); + safestrncpy(clif->hChSys->irc_name, irc_name, HCHSYS_NAME_LENGTH); libconfig->setting_lookup_bool(settings, "map_local_channel", &local_enabled); libconfig->setting_lookup_bool(settings, "ally_channel_enabled", &ally_enabled); libconfig->setting_lookup_bool(settings, "irc_channel_enabled", &irc_enabled); - if( local_enabled ) - hChSys.local = true; - if( ally_enabled ) - hChSys.ally = true; - if( irc_enabled ) - hChSys.irc = true; + if (local_enabled) + clif->hChSys->local = true; + if (ally_enabled) + clif->hChSys->ally = true; + if (irc_enabled) + clif->hChSys->irc = true; - hChSys.irc_server[0] = hChSys.irc_channel[0] = hChSys.irc_nick[0] = hChSys.irc_nick_pw[0] = '\0'; + clif->hChSys->irc_server[0] = clif->hChSys->irc_channel[0] = clif->hChSys->irc_nick[0] = clif->hChSys->irc_nick_pw[0] = '\0'; - if( hChSys.irc ) { + if (clif->hChSys->irc) { const char *irc_server, *irc_channel, *irc_nick, *irc_nick_pw; int irc_use_ghost = 0; if( libconfig->setting_lookup_string(settings, "irc_channel_network", &irc_server) ) { if( !strstr(irc_server,":") ) { - hChSys.irc = false; + clif->hChSys->irc = false; ShowWarning("channels.conf : network port wasn't found in 'irc_channel_network', disabling irc channel...\n"); } else { unsigned char d = 0, dlen = strlen(irc_server); @@ -2715,36 +2722,36 @@ void read_channels_config(void) { for(d = 0; d < dlen; d++) { if(irc_server[d] == ':') { memcpy(server, irc_server, d); - safestrncpy(hChSys.irc_server, server, 40); + safestrncpy(clif->hChSys->irc_server, server, 40); memcpy(server, &irc_server[d+1], dlen - d - 1); - hChSys.irc_server_port = atoi(server); + clif->hChSys->irc_server_port = atoi(server); break; } } } } else { - hChSys.irc = false; + clif->hChSys->irc = false; ShowWarning("channels.conf : irc channel enabled but irc_channel_network wasn't found, disabling irc channel...\n"); } if( libconfig->setting_lookup_string(settings, "irc_channel_channel", &irc_channel) ) - safestrncpy(hChSys.irc_channel, irc_channel, 50); + safestrncpy(clif->hChSys->irc_channel, irc_channel, 50); else { - hChSys.irc = false; + clif->hChSys->irc = false; ShowWarning("channels.conf : irc channel enabled but irc_channel_channel wasn't found, disabling irc channel...\n"); } if( libconfig->setting_lookup_string(settings, "irc_channel_nick", &irc_nick) ) { if( strcmpi(irc_nick,"Hercules_chSysBot") == 0 ) { - sprintf(hChSys.irc_nick, "Hercules_chSysBot%d",rand()%777); + sprintf(clif->hChSys->irc_nick, "Hercules_chSysBot%d",rand()%777); } else - safestrncpy(hChSys.irc_nick, irc_nick, 40); + safestrncpy(clif->hChSys->irc_nick, irc_nick, 40); } else { - hChSys.irc = false; + clif->hChSys->irc = false; ShowWarning("channels.conf : irc channel enabled but irc_channel_nick wasn't found, disabling irc channel...\n"); } if( libconfig->setting_lookup_string(settings, "irc_channel_nick_pw", &irc_nick_pw) ) { - safestrncpy(hChSys.irc_nick_pw, irc_nick_pw, 30); + safestrncpy(clif->hChSys->irc_nick_pw, irc_nick_pw, 30); config_setting_lookup_bool(settings, "irc_channel_use_ghost", &irc_use_ghost); - hChSys.irc_use_ghost = irc_use_ghost; + clif->hChSys->irc_use_ghost = irc_use_ghost; } } @@ -2752,83 +2759,83 @@ void read_channels_config(void) { libconfig->setting_lookup_bool(settings, "map_local_channel_autojoin", &local_autojoin); libconfig->setting_lookup_bool(settings, "ally_channel_autojoin", &ally_autojoin); - if( local_autojoin ) - hChSys.local_autojoin = true; - if( ally_autojoin ) - hChSys.ally_autojoin = true; + if (local_autojoin) + clif->hChSys->local_autojoin = true; + if (ally_autojoin) + clif->hChSys->ally_autojoin = true; libconfig->setting_lookup_bool(settings, "allow_user_channel_creation", &allow_user_channel_creation); if( allow_user_channel_creation ) - hChSys.allow_user_channel_creation = true; + clif->hChSys->allow_user_channel_creation = true; if( (colors = libconfig->setting_get_member(settings, "colors")) != NULL ) { int color_count = libconfig->setting_length(colors); - CREATE( hChSys.colors, unsigned int, color_count ); - CREATE( hChSys.colors_name, char *, color_count ); + CREATE(clif->hChSys->colors, unsigned int, color_count); + CREATE(clif->hChSys->colors_name, char *, color_count); for(i = 0; i < color_count; i++) { config_setting_t *color = libconfig->setting_get_elem(colors, i); - CREATE( hChSys.colors_name[i], char, HCHSYS_NAME_LENGTH ); + CREATE(clif->hChSys->colors_name[i], char, HCHSYS_NAME_LENGTH); - safestrncpy(hChSys.colors_name[i], config_setting_name(color), HCHSYS_NAME_LENGTH); + safestrncpy(clif->hChSys->colors_name[i], config_setting_name(color), HCHSYS_NAME_LENGTH); - hChSys.colors[i] = (unsigned int)strtoul(libconfig->setting_get_string_elem(colors,i),NULL,0); - hChSys.colors[i] = (hChSys.colors[i] & 0x0000FF) << 16 | (hChSys.colors[i] & 0x00FF00) | (hChSys.colors[i] & 0xFF0000) >> 16;//RGB to BGR + clif->hChSys->colors[i] = (unsigned int)strtoul(libconfig->setting_get_string_elem(colors,i),NULL,0); + clif->hChSys->colors[i] = (clif->hChSys->colors[i] & 0x0000FF) << 16 | (clif->hChSys->colors[i] & 0x00FF00) | (clif->hChSys->colors[i] & 0xFF0000) >> 16;//RGB to BGR } - hChSys.colors_count = color_count; + clif->hChSys->colors_count = color_count; } libconfig->setting_lookup_string(settings, "map_local_channel_color", &local_color); - for (k = 0; k < hChSys.colors_count; k++) { - if( strcmpi(hChSys.colors_name[k],local_color) == 0 ) + for (k = 0; k < clif->hChSys->colors_count; k++) { + if (strcmpi(clif->hChSys->colors_name[k], local_color) == 0) break; } - if( k < hChSys.colors_count ) { - hChSys.local_color = k; + if (k < clif->hChSys->colors_count) { + clif->hChSys->local_color = k; } else { ShowError("channels.conf: unknown color '%s' for 'map_local_channel_color', disabling '#%s'...\n",local_color,local_name); - hChSys.local = false; + clif->hChSys->local = false; } libconfig->setting_lookup_string(settings, "ally_channel_color", &ally_color); - for (k = 0; k < hChSys.colors_count; k++) { - if( strcmpi(hChSys.colors_name[k],ally_color) == 0 ) + for (k = 0; k < clif->hChSys->colors_count; k++) { + if (strcmpi(clif->hChSys->colors_name[k], ally_color) == 0) break; } - if( k < hChSys.colors_count ) { - hChSys.ally_color = k; + if( k < clif->hChSys->colors_count ) { + clif->hChSys->ally_color = k; } else { ShowError("channels.conf: unknown color '%s' for 'ally_channel_color', disabling '#%s'...\n",ally_color,ally_name); - hChSys.ally = false; + clif->hChSys->ally = false; } libconfig->setting_lookup_string(settings, "irc_channel_color", &irc_color); - for (k = 0; k < hChSys.colors_count; k++) { - if( strcmpi(hChSys.colors_name[k],irc_color) == 0 ) + for (k = 0; k < clif->hChSys->colors_count; k++) { + if (strcmpi(clif->hChSys->colors_name[k], irc_color) == 0) break; } - if( k < hChSys.colors_count ) { - hChSys.irc_color = k; + if (k < clif->hChSys->colors_count) { + clif->hChSys->irc_color = k; } else { ShowError("channels.conf: unknown color '%s' for 'irc_channel_color', disabling '#%s'...\n",irc_color,irc_name); - hChSys.irc = false; + clif->hChSys->irc = false; } - if( hChSys.irc ) { + if (clif->hChSys->irc) { struct hChSysCh *chd; - CREATE( chd, struct hChSysCh, 1 ); + CREATE(chd, struct hChSysCh, 1); - safestrncpy(chd->name, hChSys.irc_name, HCHSYS_NAME_LENGTH); + safestrncpy(chd->name, clif->hChSys->irc_name, HCHSYS_NAME_LENGTH); chd->type = hChSys_IRC; - clif->chsys_create(chd,NULL,NULL,hChSys.irc_color); + clif->chsys_create(chd, NULL, NULL, clif->hChSys->irc_color); ircbot->channel = chd; } @@ -2841,15 +2848,15 @@ void read_channels_config(void) { const char *color = libconfig->setting_get_string_elem(channels,i); struct hChSysCh *chd; - for (k = 0; k < hChSys.colors_count; k++) { - if( strcmpi(hChSys.colors_name[k],color) == 0 ) + for (k = 0; k < clif->hChSys->colors_count; k++) { + if (strcmpi(clif->hChSys->colors_name[k],color) == 0) break; } - if( k == hChSys.colors_count ) { + if( k == clif->hChSys->colors_count) { ShowError("channels.conf: unknown color '%s' for channel '%s', skipping channel...\n",color,name); continue; } - if( strcmpi(name,hChSys.local_name) == 0 || strcmpi(name,hChSys.ally_name) == 0 || strcmpi(name,hChSys.irc_name) == 0 || strdb_exists(clif->channel_db, name) ) { + if( strcmpi(name, clif->hChSys->local_name) == 0 || strcmpi(name, clif->hChSys->ally_name) == 0 || strcmpi(name, clif->hChSys->irc_name) == 0 || strdb_exists(clif->channel_db, name) ) { ShowError("channels.conf: duplicate channel '%s', skipping channel...\n",name); continue; @@ -3179,17 +3186,14 @@ void clif_changestatus(struct map_session_data* sd,int type,int val) clif->send(buf,packet_len(0x1ab),&sd->bl,AREA_WOS); } - /// Updates sprite/style properties of an object. -/// 00c3 <id>.L <type>.B <value>.B (ZC_SPRITE_CHANGE) -/// 01d7 <id>.L <type>.B <value>.L (ZC_SPRITE_CHANGE2) void clif_changelook(struct block_list *bl,int type,int val) { - unsigned char buf[16]; struct map_session_data* sd; struct status_change* sc; struct view_data* vd; enum send_target target = AREA; + int val2 = 0; nullpo_retv(bl); sd = BL_CAST(BL_PC, bl); @@ -3297,56 +3301,32 @@ void clif_changelook(struct block_list *bl,int type,int val) // prevent leaking the presence of GM-hidden objects if( sc && sc->option&OPTION_INVISIBLE && !disguised(bl) ) target = SELF; - #if PACKETVER < 4 - WBUFW(buf,0)=0xc3; - WBUFL(buf,2)=bl->id; - WBUFB(buf,6)=type; - WBUFB(buf,7)=val; - clif->send(buf,packet_len(0xc3),bl,target); + clif->sendlook(bl, bl->id, type, val, 0, target); #else - WBUFW(buf,0)=0x1d7; - WBUFL(buf,2)=bl->id; if(type == LOOK_WEAPON || type == LOOK_SHIELD) { nullpo_retv(vd); - WBUFB(buf,6)=LOOK_WEAPON; - WBUFW(buf,7)=vd->weapon; - WBUFW(buf,9)=vd->shield; - } else { - WBUFB(buf,6)=type; - WBUFL(buf,7)=val; + type = LOOK_WEAPON; + val = vd->weapon; + val2 = vd->shield; } if( disguised(bl) ) { - clif->send(buf,packet_len(0x1d7),bl,AREA_WOS); - WBUFL(buf,2)=-bl->id; - clif->send(buf,packet_len(0x1d7),bl,SELF); + clif->sendlook(bl, bl->id, type, val, val2, AREA_WOS); + clif->sendlook(bl, -bl->id, type, val, val2, SELF); } else - clif->send(buf,packet_len(0x1d7),bl,target); + clif->sendlook(bl, bl->id, type, val, val2, target); #endif } //Sends a change-base-look packet required for traps as they are triggered. void clif_changetraplook(struct block_list *bl,int val) { - unsigned char buf[32]; -#if PACKETVER < 4 - WBUFW(buf,0)=0xc3; - WBUFL(buf,2)=bl->id; - WBUFB(buf,6)=LOOK_BASE; - WBUFB(buf,7)=val; - clif->send(buf,packet_len(0xc3),bl,AREA); -#else - WBUFW(buf,0)=0x1d7; - WBUFL(buf,2)=bl->id; - WBUFB(buf,6)=LOOK_BASE; - WBUFW(buf,7)=val; - WBUFW(buf,9)=0; - clif->send(buf,packet_len(0x1d7),bl,AREA); -#endif + clif->sendlook(bl, bl->id, LOOK_BASE, val, 0, AREA); } -//For the stupid cloth-dye bug. Resends the given view data to the area specified by bl. -void clif_refreshlook(struct block_list *bl,int id,int type,int val,enum send_target target) +/// 00c3 <id>.L <type>.B <value>.B (ZC_SPRITE_CHANGE) +/// 01d7 <id>.L <type>.B <value>.L (ZC_SPRITE_CHANGE2) +void clif_sendlook(struct block_list *bl, int id, int type, int val, int val2, enum send_target target) { unsigned char buf[32]; #if PACKETVER < 4 @@ -3360,11 +3340,17 @@ void clif_refreshlook(struct block_list *bl,int id,int type,int val,enum send_ta WBUFL(buf,2)=id; WBUFB(buf,6)=type; WBUFW(buf,7)=val; - WBUFW(buf,9)=0; + WBUFW(buf,9)=val2; clif->send(buf,packet_len(0x1d7),bl,target); #endif } +//For the stupid cloth-dye bug. Resends the given view data to the area specified by bl. +void clif_refreshlook(struct block_list *bl,int id,int type,int val,enum send_target target) +{ + clif->sendlook(bl, id, type, val, 0, target); +} + /// Character status (ZC_STATUS). /// 00bd <stpoint>.W <str>.B <need str>.B <agi>.B <need agi>.B <vit>.B <need vit>.B @@ -9140,7 +9126,7 @@ void clif_hercules_chsys_msg(struct hChSysCh *channel, struct map_session_data * WFIFOW(sd->fd,0) = 0x2C1; WFIFOW(sd->fd,2) = msg_len + 12; WFIFOL(sd->fd,4) = 0; - WFIFOL(sd->fd,8) = hChSys.colors[channel->color]; + WFIFOL(sd->fd,8) = clif->hChSys->colors[channel->color]; safestrncpy((char*)WFIFOP(sd->fd,12), msg, msg_len); for( user = dbi_first(iter); dbi_exists(iter); user = dbi_next(iter) ) { @@ -9165,7 +9151,7 @@ void clif_hercules_chsys_msg2(struct hChSysCh *channel, char *msg) { WBUFW(buf,0) = 0x2C1; WBUFW(buf,2) = msg_len + 12; WBUFL(buf,4) = 0; - WBUFL(buf,8) = hChSys.colors[channel->color]; + WBUFL(buf,8) = clif->hChSys->colors[channel->color]; safestrncpy((char*)WBUFP(buf,12), msg, msg_len); for( user = dbi_first(iter); dbi_exists(iter); user = dbi_next(iter) ) { @@ -9266,11 +9252,11 @@ void clif_hercules_chsys_mjoin(struct map_session_data *sd) { return; CREATE(map->list[sd->bl.m].channel, struct hChSysCh , 1); - safestrncpy(map->list[sd->bl.m].channel->name, hChSys.local_name, HCHSYS_NAME_LENGTH); + safestrncpy(map->list[sd->bl.m].channel->name, clif->hChSys->local_name, HCHSYS_NAME_LENGTH); map->list[sd->bl.m].channel->type = hChSys_MAP; map->list[sd->bl.m].channel->m = sd->bl.m; - clif->chsys_create(map->list[sd->bl.m].channel,NULL,NULL,hChSys.local_color); + clif->chsys_create(map->list[sd->bl.m].channel, NULL, NULL, clif->hChSys->local_color); } if( map->list[sd->bl.m].channel->banned && idb_exists(map->list[sd->bl.m].channel->banned, sd->status.account_id) ) { @@ -9281,7 +9267,7 @@ void clif_hercules_chsys_mjoin(struct map_session_data *sd) { if( !( map->list[sd->bl.m].channel->opt & hChSys_OPT_ANNOUNCE_JOIN ) ) { char mout[60]; - sprintf(mout, msg_txt(1435),hChSys.local_name,map->list[sd->bl.m].name); // You're now in the '#%s' channel for '%s' + sprintf(mout, msg_txt(1435), clif->hChSys->local_name, map->list[sd->bl.m].name); // You're now in the '#%s' channel for '%s' clif->colormes(sd->fd, COLOR_DEFAULT, mout); } } @@ -9556,7 +9542,7 @@ void clif_parse_LoadEndAck(int fd,struct map_session_data *sd) { status_calc_pc(sd, SCO_NONE);/* some conditions are map-dependent so we must recalculate */ sd->state.changemap = false; - if( hChSys.local && hChSys.local_autojoin ) { + if (clif->hChSys->local && clif->hChSys->local_autojoin) { clif->chsys_mjoin(sd); } } @@ -9959,7 +9945,7 @@ void clif_parse_GlobalMessage(int fd, struct map_session_data* sd) WFIFOW(fd,0) = 0x2C1; WFIFOW(fd,2) = mylen + 12; WFIFOL(fd,4) = sd->bl.id; - WFIFOL(fd,8) = hChSys.colors[sd->fontcolor - 1]; + WFIFOL(fd,8) = clif->hChSys->colors[sd->fontcolor - 1]; safestrncpy((char*)WFIFOP(fd,12), mout, mylen); clif->send(WFIFOP(fd,0), WFIFOW(fd,2), &sd->bl, AREA_WOS); WFIFOL(fd,4) = -sd->bl.id; @@ -10236,7 +10222,7 @@ void clif_hercules_chsys_left(struct hChSysCh *channel, struct map_session_data if( !db_size(channel->users) && channel->type == hChSys_PRIVATE ) { clif->chsys_delete(channel); - } else if( !hChSys.closing && (channel->opt & hChSys_OPT_ANNOUNCE_JOIN) ) { + } else if( !clif->hChSys->closing && (channel->opt & hChSys_OPT_ANNOUNCE_JOIN) ) { char message[60]; sprintf(message, "#%s '%s' left",channel->name,sd->status.name); clif->chsys_msg(channel,sd,message); @@ -10280,9 +10266,9 @@ void clif_hercules_chsys_quitg(struct map_session_data *sd) { if( channel == sd->gcbind ) sd->gcbind = NULL; - if( !db_size(channel->users) && channel->type == hChSys_PRIVATE ) { + if (!db_size(channel->users) && channel->type == hChSys_PRIVATE) { clif->chsys_delete(channel); - } else if( !hChSys.closing && (channel->opt & hChSys_OPT_ANNOUNCE_JOIN) ) { + } else if (!clif->hChSys->closing && (channel->opt & hChSys_OPT_ANNOUNCE_JOIN)) { char message[60]; sprintf(message, "#%s '%s' left",channel->name,sd->status.name); clif->chsys_msg(channel,sd,message); @@ -10321,9 +10307,9 @@ void clif_hercules_chsys_quit(struct map_session_data *sd) { if( channel == sd->gcbind ) sd->gcbind = NULL; - if( !db_size(channel->users) && channel->type == hChSys_PRIVATE ) { + if (!db_size(channel->users) && channel->type == hChSys_PRIVATE) { clif->chsys_delete(channel); - } else if( !hChSys.closing && (channel->opt & hChSys_OPT_ANNOUNCE_JOIN) ) { + } else if (!clif->hChSys->closing && (channel->opt & hChSys_OPT_ANNOUNCE_JOIN)) { char message[60]; sprintf(message, "#%s '%s' left",channel->name,sd->status.name); clif->chsys_msg(channel,sd,message); @@ -10462,12 +10448,12 @@ void clif_parse_WisMessage(int fd, struct map_session_data* sd) chname++; - if( hChSys.local && strcmpi(chname, hChSys.local_name) == 0 ) { + if (clif->hChSys->local && strcmpi(chname, clif->hChSys->local_name) == 0) { if( !map->list[sd->bl.m].channel ) { clif->chsys_mjoin(sd); } channel = map->list[sd->bl.m].channel; - } else if( hChSys.ally && sd->status.guild_id && strcmpi(chname, hChSys.ally_name) == 0 ) { + } else if (clif->hChSys->ally && sd->status.guild_id && strcmpi(chname, clif->hChSys->ally_name) == 0) { struct guild *g = sd->guild; if( !g ) return; channel = g->channel; @@ -10718,7 +10704,7 @@ void clif_parse_EquipItem(int fd,struct map_session_data *sd) { } void clif_hercules_chsys_delete(struct hChSysCh *channel) { - if( db_size(channel->users) && !hChSys.closing ) { + if (db_size(channel->users) && !clif->hChSys->closing) { DBIterator *iter; struct map_session_data *sd; unsigned char i; @@ -10758,7 +10744,7 @@ void clif_hercules_chsys_delete(struct hChSysCh *channel) { aFree(channel); } else if ( channel->type == hChSys_ALLY ) aFree(channel); - else if( !hChSys.closing ) + else if (!clif->hChSys->closing) strdb_remove(clif->channel_db, channel->name); } void clif_hercules_chsys_gjoin(struct guild *g1,struct guild *g2) { @@ -18865,7 +18851,7 @@ int do_init_clif(bool minimal) { clif->delayed_damage_ers = ers_new(sizeof(struct cdelayed_damage),"clif.c::delayed_damage_ers",ERS_OPT_CLEAR); clif->channel_db = stridb_alloc(DB_OPT_DUP_KEY|DB_OPT_RELEASE_DATA, HCHSYS_NAME_LENGTH); - hChSys.ally = hChSys.local = hChSys.irc = hChSys.ally_autojoin = hChSys.local_autojoin = false; + clif->hChSys->ally = clif->hChSys->local = clif->hChSys->irc = clif->hChSys->ally_autojoin = clif->hChSys->local_autojoin = false; clif->chann_config_read(); return 0; @@ -18882,13 +18868,13 @@ void do_final_clif(void) { dbi_destroy(iter); - for(i = 0; i < hChSys.colors_count; i++) { - aFree(hChSys.colors_name[i]); + for(i = 0; i < clif->hChSys->colors_count; i++) { + aFree(clif->hChSys->colors_name[i]); } - if( hChSys.colors_count ) { - aFree(hChSys.colors_name); - aFree(hChSys.colors); + if (clif->hChSys->colors_count) { + aFree(clif->hChSys->colors_name); + aFree(clif->hChSys->colors); } db_destroy(clif->channel_db); @@ -18927,6 +18913,7 @@ void clif_defaults(void) { clif->refresh_ip = clif_refresh_ip; clif->send = clif_send; clif->send_sub = clif_send_sub; + clif->send_actual = clif_send_actual; clif->parse = clif_parse; clif->parse_cmd = clif_parse_cmd_optional; clif->decrypt_cmd = clif_decrypt_cmd; @@ -18971,6 +18958,7 @@ void clif_defaults(void) { clif->changelook = clif_changelook; clif->changetraplook = clif_changetraplook; clif->refreshlook = clif_refreshlook; + clif->sendlook = clif_sendlook; clif->class_change = clif_class_change; clif->skill_delunit = clif_skill_delunit; clif->skillunit_update = clif_skillunit_update; @@ -19385,6 +19373,7 @@ void clif_defaults(void) { clif->bc_ready = clif_bc_ready; clif->undisguise_timer = clif_undisguise_timer; /* Hercules Channel System */ + clif->hChSys = &clif_hChSys; clif->chsys_create = clif_hercules_chsys_create; clif->chsys_msg = clif_hercules_chsys_msg; clif->chsys_msg2 = clif_hercules_chsys_msg2; diff --git a/src/map/clif.h b/src/map/clif.h index ccaedabcb..a8248bc8a 100644 --- a/src/map/clif.h +++ b/src/map/clif.h @@ -517,7 +517,7 @@ struct s_packet_db { short pos[MAX_PACKET_POS]; }; -struct { +struct hChSysConfig { unsigned int *colors; char **colors_name; unsigned char colors_count; @@ -530,7 +530,7 @@ struct { char irc_server[40], irc_channel[50], irc_nick[40], irc_nick_pw[30]; unsigned short irc_server_port; bool irc_use_ghost; -} hChSys; +}; struct hChSysBanEntry { char name[NAME_LENGTH]; @@ -576,6 +576,7 @@ struct clif_interface { char map_ip_str[128]; int map_fd; DBMap* channel_db; + struct hChSysConfig *hChSys; /* for clif_clearunit_delayed */ struct eri *delay_clearunit_ers; /* Cash Shop [Ind/Hercules] */ @@ -604,6 +605,7 @@ struct clif_interface { uint32 (*refresh_ip) (void); bool (*send) (const void* buf, int len, struct block_list* bl, enum send_target type); int (*send_sub) (struct block_list *bl, va_list ap); + int (*send_actual) (int fd, void *buf, int len); int (*parse) (int fd); unsigned short (*parse_cmd) ( int fd, struct map_session_data *sd ); unsigned short (*decrypt_cmd) ( int cmd, struct map_session_data *sd ); @@ -648,6 +650,7 @@ struct clif_interface { void (*changelook) (struct block_list *bl,int type,int val); void (*changetraplook) (struct block_list *bl,int val); void (*refreshlook) (struct block_list *bl,int id,int type,int val,enum send_target target); + void (*sendlook) (struct block_list *bl, int id, int type, int val, int val2, enum send_target target); void (*class_change) (struct block_list *bl,int class_,int type); void (*skill_delunit) (struct skill_unit *su); void (*skillunit_update) (struct block_list* bl); diff --git a/src/map/guild.c b/src/map/guild.c index e43a5881e..d46da60a3 100644 --- a/src/map/guild.c +++ b/src/map/guild.c @@ -470,15 +470,15 @@ int guild_recv_info(struct guild *sg) { g->instance = NULL; g->instances = 0; idb_put(guild->db,sg->guild_id,g); - if( hChSys.ally ) { + if (clif->hChSys->ally) { struct hChSysCh *channel; - + CREATE(channel, struct hChSysCh , 1); - safestrncpy(channel->name, hChSys.ally_name, HCHSYS_NAME_LENGTH); + safestrncpy(channel->name, clif->hChSys->ally_name, HCHSYS_NAME_LENGTH); channel->type = hChSys_ALLY; - clif->chsys_create(channel,NULL,NULL,hChSys.ally_color); - if( hChSys.ally_autojoin ) { + clif->chsys_create(channel, NULL, NULL, clif->hChSys->ally_color); + if (clif->hChSys->ally_autojoin) { struct s_mapiterator* iter = mapit_getallusers(); struct guild *tg[MAX_GUILDALLIANCE]; @@ -745,7 +745,7 @@ void guild_member_joined(struct map_session_data *sd) g->member[i].sd = sd; sd->guild = g; - if( hChSys.ally && hChSys.ally_autojoin ) { + if (clif->hChSys->ally && clif->hChSys->ally_autojoin) { struct guild* sg = NULL; struct hChSysCh *channel = g->channel; @@ -913,7 +913,7 @@ int guild_member_withdraw(int guild_id, int account_id, int char_id, int flag, c if (sd->state.storage_flag == 2) //Close the guild storage. gstorage->close(sd); guild->send_dot_remove(sd); - if( hChSys.ally ) { + if (clif->hChSys->ally) { clif->chsys_quitg(sd); } sd->status.guild_id = 0; @@ -1646,9 +1646,9 @@ int guild_allianceack(int guild_id1,int guild_id2,int account_id1,int account_id return 0; } - if( g[0] && g[1] && hChSys.ally && ( flag & 1 ) == 0 ) { + if (g[0] && g[1] && clif->hChSys->ally && ( flag & 1 ) == 0) { if( !(flag & 0x08) ) { - if( hChSys.ally_autojoin ) + if (clif->hChSys->ally_autojoin) clif->chsys_gjoin(g[0],g[1]); } else { clif->chsys_gleave(g[0],g[1]); @@ -1777,7 +1777,7 @@ int guild_broken(int guild_id,int flag) guild->db->foreach(guild->db,guild->broken_sub,guild_id); guild->castle_db->foreach(guild->castle_db,guild->castle_broken_sub,guild_id); gstorage->delete(guild_id); - if( hChSys.ally ) { + if (clif->hChSys->ally) { if( g->channel != NULL ) { clif->chsys_delete(g->channel); } diff --git a/src/map/irc-bot.c b/src/map/irc-bot.c index 8a510b969..8b4991c20 100644 --- a/src/map/irc-bot.c +++ b/src/map/irc-bot.c @@ -41,7 +41,7 @@ int irc_connect_timer(int tid, int64 tick, int id, intptr_t data) { ircbot->last_try = timer->gettick(); - if( ( ircbot->fd = make_connection(ircbot->ip,hChSys.irc_server_port,&opt) ) > 0 ){ + if ((ircbot->fd = make_connection(ircbot->ip, clif->hChSys->irc_server_port, &opt)) > 0) { session[ircbot->fd]->func_parse = ircbot->parse; session[ircbot->fd]->flag.server = 1; timer->add(timer->gettick() + 3000, ircbot->identify_timer, 0, 0); @@ -60,7 +60,7 @@ int irc_identify_timer(int tid, int64 tick, int id, intptr_t data) { sprintf(send_string, "USER HerculesWS%d 8 * : Hercules IRC Bridge",rand()%777); ircbot->send(send_string); - sprintf(send_string, "NICK %s", hChSys.irc_nick); + sprintf(send_string, "NICK %s", clif->hChSys->irc_nick); ircbot->send(send_string); timer->add(timer->gettick() + 3000, ircbot->join_timer, 0, 0); @@ -76,15 +76,15 @@ int irc_join_timer(int tid, int64 tick, int id, intptr_t data) { if( !ircbot->isOn ) return 0; - if( hChSys.irc_nick_pw[0] != '\0' ) { - sprintf(send_string, "PRIVMSG NICKSERV : IDENTIFY %s", hChSys.irc_nick_pw); + if (clif->hChSys->irc_nick_pw[0] != '\0') { + sprintf(send_string, "PRIVMSG NICKSERV : IDENTIFY %s", clif->hChSys->irc_nick_pw); ircbot->send(send_string); - if( hChSys.irc_use_ghost ) { - sprintf(send_string, "PRIVMSG NICKSERV : GHOST %s %s", hChSys.irc_nick, hChSys.irc_nick_pw); + if (clif->hChSys->irc_use_ghost) { + sprintf(send_string, "PRIVMSG NICKSERV : GHOST %s %s", clif->hChSys->irc_nick, clif->hChSys->irc_nick_pw); } } - sprintf(send_string, "JOIN %s", hChSys.irc_channel); + sprintf(send_string, "JOIN %s", clif->hChSys->irc_channel); ircbot->send(send_string); ircbot->isIn = true; @@ -120,7 +120,7 @@ int irc_parse(int fd) { ircbot->isOn = false; ircbot->isIn = false; ircbot->fails = 0; - ircbot->ip = host2ip(hChSys.irc_server); + ircbot->ip = host2ip(clif->hChSys->irc_server); timer->add(timer->gettick() + 120000, ircbot->connect_timer, 0, 0); return 0; } @@ -289,10 +289,10 @@ void irc_privmsg(int fd, char *cmd, char *source, char *target, char *msg) { irc_privmsg_ctcp(fd, command, source, target, message); #ifdef IRCBOT_DEBUG - } else if( strcmpi(target,hChSys.irc_nick) == 0 ) { + } else if (strcmpi(target, clif->hChSys->irc_nick) == 0) { ShowDebug("irc_privmsg: Received message from %s: '%s'\n", source ? source : "(null)", msg); #endif // IRCBOT_DEBUG - } else if( msg && strcmpi(target,hChSys.irc_channel) == 0 ) { + } else if (msg && strcmpi(target, clif->hChSys->irc_channel) == 0) { char source_nick[IRC_NICK_LENGTH], source_ident[IRC_IDENT_LENGTH], source_host[IRC_HOST_LENGTH]; source_nick[0] = source_ident[0] = source_host[0] = '\0'; @@ -382,7 +382,7 @@ void irc_usernick(int fd, char *cmd, char *source, char *target, char *msg) { void irc_relay(char *name, const char *msg) { if( !ircbot->isIn ) return; - sprintf(send_string,"PRIVMSG %s :[ %s ] : %s",hChSys.irc_channel,name,msg); + sprintf(send_string,"PRIVMSG %s :[ %s ] : %s", clif->hChSys->irc_channel, name, msg); ircbot->send(send_string); } @@ -405,12 +405,12 @@ void irc_bot_init(bool minimal) { if (minimal) return; - if( !hChSys.irc ) + if (!clif->hChSys->irc) return; - if (!(ircbot->ip = host2ip(hChSys.irc_server))) { - ShowError("Unable to resolve '%s' (irc server), disabling irc channel...\n", hChSys.irc_server); - hChSys.irc = false; + if (!(ircbot->ip = host2ip(clif->hChSys->irc_server))) { + ShowError("Unable to resolve '%s' (irc server), disabling irc channel...\n", clif->hChSys->irc_server); + clif->hChSys->irc = false; return; } @@ -443,7 +443,7 @@ void irc_bot_init(bool minimal) { void irc_bot_final(void) { int i; - if( !hChSys.irc ) + if (!clif->hChSys->irc) return; if( ircbot->isOn ) { ircbot->send("QUIT :Hercules is shutting down"); diff --git a/src/map/map.c b/src/map/map.c index 3cb4de5c8..2c1495f32 100644 --- a/src/map/map.c +++ b/src/map/map.c @@ -1787,7 +1787,7 @@ int map_quit(struct map_session_data *sd) { if( sd->bg_id && !sd->bg_queue.arena ) /* TODO: dump this chunk after bg_queue is fully enabled */ bg->team_leave(sd,BGTL_QUIT); - if( sd->state.autotrade && runflag != MAPSERVER_ST_SHUTDOWN && !hChSys.closing ) + if (sd->state.autotrade && runflag != MAPSERVER_ST_SHUTDOWN && !clif->hChSys->closing) pc->autotrade_update(sd,PAUC_REMOVE); skill->cooldown_save(sd); @@ -1844,7 +1844,7 @@ int map_quit(struct map_session_data *sd) { unit->remove_map(&sd->ed->bl,CLR_TELEPORT,ALC_MARK); } - if( hChSys.local && map->list[sd->bl.m].channel && idb_exists(map->list[sd->bl.m].channel->users, sd->status.char_id) ) { + if (clif->hChSys->local && map->list[sd->bl.m].channel && idb_exists(map->list[sd->bl.m].channel->users, sd->status.char_id)) { clif->chsys_left(map->list[sd->bl.m].channel,sd); } @@ -5340,7 +5340,7 @@ int do_final(void) { ShowStatus("Terminating...\n"); - hChSys.closing = true; + clif->hChSys->closing = true; HPM->event(HPET_FINAL); if (map->cpsd) aFree(map->cpsd); diff --git a/src/map/pc.c b/src/map/pc.c index c5d1eba19..4def231bc 100644 --- a/src/map/pc.c +++ b/src/map/pc.c @@ -5025,7 +5025,7 @@ int pc_setpos(struct map_session_data* sd, unsigned short map_index, int x, int vending->close(sd); } - if( hChSys.local && map->list[sd->bl.m].channel && idb_exists(map->list[sd->bl.m].channel->users, sd->status.char_id) ) { + if (clif->hChSys->local && map->list[sd->bl.m].channel && idb_exists(map->list[sd->bl.m].channel->users, sd->status.char_id)) { clif->chsys_left(map->list[sd->bl.m].channel,sd); } } diff --git a/src/plugins/HPMHooking/HPMHooking_map.HPMHooksCore.inc b/src/plugins/HPMHooking/HPMHooking_map.HPMHooksCore.inc index 5448186d0..74e765cee 100644 --- a/src/plugins/HPMHooking/HPMHooking_map.HPMHooksCore.inc +++ b/src/plugins/HPMHooking/HPMHooking_map.HPMHooksCore.inc @@ -423,6 +423,8 @@ struct { struct HPMHookPoint *HP_clif_send_post; struct HPMHookPoint *HP_clif_send_sub_pre; struct HPMHookPoint *HP_clif_send_sub_post; + struct HPMHookPoint *HP_clif_send_actual_pre; + struct HPMHookPoint *HP_clif_send_actual_post; struct HPMHookPoint *HP_clif_parse_pre; struct HPMHookPoint *HP_clif_parse_post; struct HPMHookPoint *HP_clif_parse_cmd_pre; @@ -505,6 +507,8 @@ struct { struct HPMHookPoint *HP_clif_changetraplook_post; struct HPMHookPoint *HP_clif_refreshlook_pre; struct HPMHookPoint *HP_clif_refreshlook_post; + struct HPMHookPoint *HP_clif_sendlook_pre; + struct HPMHookPoint *HP_clif_sendlook_post; struct HPMHookPoint *HP_clif_class_change_pre; struct HPMHookPoint *HP_clif_class_change_post; struct HPMHookPoint *HP_clif_skill_delunit_pre; @@ -5490,6 +5494,8 @@ struct { int HP_clif_send_post; int HP_clif_send_sub_pre; int HP_clif_send_sub_post; + int HP_clif_send_actual_pre; + int HP_clif_send_actual_post; int HP_clif_parse_pre; int HP_clif_parse_post; int HP_clif_parse_cmd_pre; @@ -5572,6 +5578,8 @@ struct { int HP_clif_changetraplook_post; int HP_clif_refreshlook_pre; int HP_clif_refreshlook_post; + int HP_clif_sendlook_pre; + int HP_clif_sendlook_post; int HP_clif_class_change_pre; int HP_clif_class_change_post; int HP_clif_skill_delunit_pre; diff --git a/src/plugins/HPMHooking/HPMHooking_map.HookingPoints.inc b/src/plugins/HPMHooking/HPMHooking_map.HookingPoints.inc index af376fe05..5d0545f82 100644 --- a/src/plugins/HPMHooking/HPMHooking_map.HookingPoints.inc +++ b/src/plugins/HPMHooking/HPMHooking_map.HookingPoints.inc @@ -221,6 +221,7 @@ struct HookingPointData HookingPoints[] = { { HP_POP(clif->refresh_ip, HP_clif_refresh_ip) }, { HP_POP(clif->send, HP_clif_send) }, { HP_POP(clif->send_sub, HP_clif_send_sub) }, + { HP_POP(clif->send_actual, HP_clif_send_actual) }, { HP_POP(clif->parse, HP_clif_parse) }, { HP_POP(clif->parse_cmd, HP_clif_parse_cmd) }, { HP_POP(clif->decrypt_cmd, HP_clif_decrypt_cmd) }, @@ -262,6 +263,7 @@ struct HookingPointData HookingPoints[] = { { HP_POP(clif->changelook, HP_clif_changelook) }, { HP_POP(clif->changetraplook, HP_clif_changetraplook) }, { HP_POP(clif->refreshlook, HP_clif_refreshlook) }, + { HP_POP(clif->sendlook, HP_clif_sendlook) }, { HP_POP(clif->class_change, HP_clif_class_change) }, { HP_POP(clif->skill_delunit, HP_clif_skill_delunit) }, { HP_POP(clif->skillunit_update, HP_clif_skillunit_update) }, diff --git a/src/plugins/HPMHooking/HPMHooking_map.Hooks.inc b/src/plugins/HPMHooking/HPMHooking_map.Hooks.inc index 954436e94..6531492a3 100644 --- a/src/plugins/HPMHooking/HPMHooking_map.Hooks.inc +++ b/src/plugins/HPMHooking/HPMHooking_map.Hooks.inc @@ -5688,6 +5688,33 @@ int HP_clif_send_sub(struct block_list *bl, va_list ap) { } return retVal___; } +int HP_clif_send_actual(int fd, void *buf, int len) { + int hIndex = 0; + int retVal___ = 0; + if( HPMHooks.count.HP_clif_send_actual_pre ) { + int (*preHookFunc) (int *fd, void *buf, int *len); + *HPMforce_return = false; + for(hIndex = 0; hIndex < HPMHooks.count.HP_clif_send_actual_pre; hIndex++ ) { + preHookFunc = HPMHooks.list.HP_clif_send_actual_pre[hIndex].func; + retVal___ = preHookFunc(&fd, buf, &len); + } + if( *HPMforce_return ) { + *HPMforce_return = false; + return retVal___; + } + } + { + retVal___ = HPMHooks.source.clif.send_actual(fd, buf, len); + } + if( HPMHooks.count.HP_clif_send_actual_post ) { + int (*postHookFunc) (int retVal___, int *fd, void *buf, int *len); + for(hIndex = 0; hIndex < HPMHooks.count.HP_clif_send_actual_post; hIndex++ ) { + postHookFunc = HPMHooks.list.HP_clif_send_actual_post[hIndex].func; + retVal___ = postHookFunc(retVal___, &fd, buf, &len); + } + } + return retVal___; +} int HP_clif_parse(int fd) { int hIndex = 0; int retVal___ = 0; @@ -6757,6 +6784,32 @@ void HP_clif_refreshlook(struct block_list *bl, int id, int type, int val, enum } return; } +void HP_clif_sendlook(struct block_list *bl, int id, int type, int val, int val2, enum send_target target) { + int hIndex = 0; + if( HPMHooks.count.HP_clif_sendlook_pre ) { + void (*preHookFunc) (struct block_list *bl, int *id, int *type, int *val, int *val2, enum send_target *target); + *HPMforce_return = false; + for(hIndex = 0; hIndex < HPMHooks.count.HP_clif_sendlook_pre; hIndex++ ) { + preHookFunc = HPMHooks.list.HP_clif_sendlook_pre[hIndex].func; + preHookFunc(bl, &id, &type, &val, &val2, &target); + } + if( *HPMforce_return ) { + *HPMforce_return = false; + return; + } + } + { + HPMHooks.source.clif.sendlook(bl, id, type, val, val2, target); + } + if( HPMHooks.count.HP_clif_sendlook_post ) { + void (*postHookFunc) (struct block_list *bl, int *id, int *type, int *val, int *val2, enum send_target *target); + for(hIndex = 0; hIndex < HPMHooks.count.HP_clif_sendlook_post; hIndex++ ) { + postHookFunc = HPMHooks.list.HP_clif_sendlook_post[hIndex].func; + postHookFunc(bl, &id, &type, &val, &val2, &target); + } + } + return; +} void HP_clif_class_change(struct block_list *bl, int class_, int type) { int hIndex = 0; if( HPMHooks.count.HP_clif_class_change_pre ) { |