diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/char/char.c | 44 | ||||
-rw-r--r-- | src/char/char.h | 2 | ||||
-rw-r--r-- | src/char/int_party.c | 36 | ||||
-rw-r--r-- | src/common/mmo.h | 10 | ||||
-rw-r--r-- | src/common/strlib.c | 1 | ||||
-rw-r--r-- | src/map/atcommand.c | 30 | ||||
-rw-r--r-- | src/map/battle.c | 30 | ||||
-rw-r--r-- | src/map/battle.h | 3 | ||||
-rw-r--r-- | src/map/clif.c | 52 | ||||
-rw-r--r-- | src/map/clif.h | 3 | ||||
-rw-r--r-- | src/map/mob.c | 2 | ||||
-rw-r--r-- | src/map/packets.h | 428 | ||||
-rw-r--r-- | src/map/packets_struct.h | 19 | ||||
-rw-r--r-- | src/map/party.c | 42 | ||||
-rw-r--r-- | src/map/pc.c | 6 | ||||
-rw-r--r-- | src/map/script.c | 878 | ||||
-rw-r--r-- | src/map/skill.c | 16 | ||||
-rw-r--r-- | src/map/unit.c | 9 | ||||
-rw-r--r-- | src/plugins/HPMHooking/HPMHooking.Defs.inc | 8 | ||||
-rw-r--r-- | src/plugins/HPMHooking/HPMHooking_char.Hooks.inc | 12 | ||||
-rw-r--r-- | src/plugins/HPMHooking/HPMHooking_map.Hooks.inc | 12 |
21 files changed, 1275 insertions, 368 deletions
diff --git a/src/char/char.c b/src/char/char.c index 4395ee9c2..1197e2811 100644 --- a/src/char/char.c +++ b/src/char/char.c @@ -1577,7 +1577,7 @@ int char_check_char_name(char * name, char * esc_name) * -5: 'Symbols in Character Names are forbidden' * char_id: Success **/ -int char_make_new_char_sql(struct char_session_data *sd, const char *name_, int str, int agi, int vit, int int_, int dex, int luk, int slot, int hair_color, int hair_style, int16 starting_class) +int char_make_new_char_sql(struct char_session_data *sd, const char *name_, int str, int agi, int vit, int int_, int dex, int luk, int slot, int hair_color, int hair_style, int16 starting_class, uint8 sex) { char name[NAME_LENGTH]; char esc_name[NAME_LENGTH*2+1]; @@ -1620,17 +1620,17 @@ int char_make_new_char_sql(struct char_session_data *sd, const char *name_, int if( sd->found_char[slot] != -1 ) return -2; /* character account limit exceeded */ + #if PACKETVER >= 20120307 // Insert the new char entry to the database if (SQL_ERROR == SQL->Query(inter->sql_handle, "INSERT INTO `%s` (`account_id`, `char_num`, `name`, `class`, `zeny`, `status_point`,`str`, `agi`, `vit`, `int`, `dex`, `luk`, `max_hp`, `hp`," - "`max_sp`, `sp`, `hair`, `hair_color`, `last_map`, `last_x`, `last_y`, `save_map`, `save_x`, `save_y`) VALUES (" - "'%d', '%d', '%s', '%d', '%d', '%d', '%d', '%d', '%d', '%d', '%d', '%d', '%d', '%d','%d', '%d','%d', '%d', '%s', '%d', '%d', '%s', '%d', '%d')", + "`max_sp`, `sp`, `hair`, `hair_color`, `last_map`, `last_x`, `last_y`, `save_map`, `save_x`, `save_y`, `sex`) VALUES (" + "'%d', '%d', '%s', '%d', '%d', '%d', '%d', '%d', '%d', '%d', '%d', '%d', '%d', '%d','%d', '%d','%d', '%d', '%s', '%d', '%d', '%s', '%d', '%d', '%c')", char_db, sd->account_id , slot, esc_name, starting_class, start_zeny, 48, str, agi, vit, int_, dex, luk, (40 * (100 + vit)/100) , (40 * (100 + vit)/100 ), (11 * (100 + int_)/100), (11 * (100 + int_)/100), hair_style, hair_color, - mapindex_id2name(start_point.map), start_point.x, start_point.y, mapindex_id2name(start_point.map), start_point.x, start_point.y) ) - { - Sql_ShowDebug(inter->sql_handle); - return -2; //No, stop the procedure! + mapindex_id2name(start_point.map), start_point.x, start_point.y, mapindex_id2name(start_point.map), start_point.x, start_point.y, sex)) { + Sql_ShowDebug(inter->sql_handle); + return -2; //No, stop the procedure! } #else //Insert the new char entry to the database @@ -1680,7 +1680,7 @@ int char_make_new_char_sql(struct char_session_data *sd, const char *name_, int } } - ShowInfo("Created char: account: %d, char: %d, slot: %d, name: %s\n", sd->account_id, char_id, slot, name); + ShowInfo("Created char: account: %d, char: %d, slot: %d, name: %s, sex: %c\n", sd->account_id, char_id, slot, name, sex); return char_id; } @@ -4666,13 +4666,25 @@ void char_parse_char_create_new_char(int fd, struct char_session_data* sd) //turn character creation on/off [Kevin] result = -2; } else { - #if PACKETVER >= 20151001 - result = chr->make_new_char_sql(sd, RFIFOP(fd,2), 1, 1, 1, 1, 1, 1, RFIFOB(fd,26), RFIFOW(fd,27), RFIFOW(fd,29), RFIFOW(fd, 31)); - #elif PACKETVER >= 20120307 - result = chr->make_new_char_sql(sd, RFIFOP(fd,2), 1, 1, 1, 1, 1, 1, RFIFOB(fd,26), RFIFOW(fd,27), RFIFOW(fd,29), JOB_NOVICE); - #else - result = chr->make_new_char_sql(sd, RFIFOP(fd,2), RFIFOB(fd,26), RFIFOB(fd,27), RFIFOB(fd,28), RFIFOB(fd,29), RFIFOB(fd,30), RFIFOB(fd,31), RFIFOB(fd,32), RFIFOW(fd,33), RFIFOW(fd,35), JOB_NOVICE); - #endif +#if PACKETVER >= 20151001 + uint8 sex = RFIFOB(fd, 35); + + switch (sex) { + case SEX_FEMALE: + sex = 'F'; + break; + case SEX_MALE: + sex = 'M'; + break; + default: + return -2; // Char Creation Denied + } + result = chr->make_new_char_sql(sd, RFIFOP(fd, 2), 1, 1, 1, 1, 1, 1, RFIFOB(fd, 26), RFIFOW(fd, 27), RFIFOW(fd, 29), RFIFOW(fd, 31), sex); +#elif PACKETVER >= 20120307 + result = chr->make_new_char_sql(sd, RFIFOP(fd, 2), 1, 1, 1, 1, 1, 1, RFIFOB(fd, 26), RFIFOW(fd, 27), RFIFOW(fd, 29), JOB_NOVICE, 'U'); +#else + result = chr->make_new_char_sql(sd, RFIFOP(fd, 2), RFIFOB(fd, 26), RFIFOB(fd, 27), RFIFOB(fd, 28), RFIFOB(fd, 29), RFIFOB(fd, 30), RFIFOB(fd, 31), RFIFOB(fd, 32), RFIFOW(fd, 33), RFIFOW(fd, 35), JOB_NOVICE, 'U'); +#endif } //'Charname already exists' (-1), 'Char creation denied' (-2) and 'You are underaged' (-3) @@ -5075,7 +5087,7 @@ int char_parse_char(int fd) // S 0a39 <name>.24B <slot>.B <hair color>.W <hair style>.W <starting job class ID>.W <Unknown>.(W or 2 B's)??? <sex>.B case 0xa39: { - FIFOSD_CHECK(36); + FIFOSD_CHECK(36); #elif PACKETVER >= 20120307 // S 0970 <name>.24B <slot>.B <hair color>.W <hair style>.W case 0x970: diff --git a/src/char/char.h b/src/char/char.h index d7bc96e13..499b633f7 100644 --- a/src/char/char.h +++ b/src/char/char.h @@ -147,7 +147,7 @@ struct char_interface { bool (*char_slotchange) (struct char_session_data *sd, int fd, unsigned short from, unsigned short to); int (*rename_char_sql) (struct char_session_data *sd, int char_id); int (*check_char_name) (char * name, char * esc_name); - int (*make_new_char_sql) (struct char_session_data *sd, const char *name_, int str, int agi, int vit, int int_, int dex, int luk, int slot, int hair_color, int hair_style, short starting_job); + int (*make_new_char_sql) (struct char_session_data *sd, const char *name_, int str, int agi, int vit, int int_, int dex, int luk, int slot, int hair_color, int hair_style, short starting_job, uint8 sex); int (*divorce_char_sql) (int partner_id1, int partner_id2); int (*count_users) (void); int (*mmo_char_tobuf) (uint8* buffer, struct mmo_charstatus* p); diff --git a/src/char/int_party.c b/src/char/int_party.c index 2fc39c328..4b6800699 100644 --- a/src/char/int_party.c +++ b/src/char/int_party.c @@ -633,31 +633,21 @@ int mapif_parse_PartyLeave(int fd, int party_id, int account_id, int char_id) return 0; //Member not found? mapif->party_withdraw(party_id, account_id, char_id); - - if (p->party.member[i].leader){ - p->party.member[i].account_id = 0; - for (j = 0; j < MAX_PARTY; j++) { - if (!p->party.member[j].account_id) - continue; - mapif->party_withdraw(party_id, p->party.member[j].account_id, p->party.member[j].char_id); - p->party.member[j].account_id = 0; - } - //Party gets deleted on the check_empty call below. - } else { - inter_party->tosql(&p->party,PS_DELMEMBER,i); - j = p->party.member[i].lv; - if(p->party.member[i].online) p->party.count--; - memset(&p->party.member[i], 0, sizeof(struct party_member)); - p->size--; - if (j == p->min_lv || j == p->max_lv || p->family) - { - if(p->family) p->family = 0; //Family state broken. - inter_party->check_lv(p); - } + + j = p->party.member[i].lv; + if (p->party.member[i].online > 0) + p->party.count--; + memset(&p->party.member[i], 0, sizeof(struct party_member)); + p->size--; + if (j == p->min_lv || j == p->max_lv || p->family) { + if(p->family) p->family = 0; //Family state broken. + inter_party->check_lv(p); } - if (inter_party->check_empty(p) == 0) + if (inter_party->check_empty(p) == 0) { + inter_party->tosql(&p->party, PS_DELMEMBER, i); mapif->party_info(-1, &p->party, 0); + } return 0; } // When member goes to other map or levels up. @@ -727,7 +717,7 @@ int mapif_parse_BreakParty(int fd, int party_id) if(!p) return 0; inter_party->tosql(&p->party,PS_BREAK,0); - mapif->party_broken(fd,party_id); + mapif->party_broken(party_id, 1); return 0; } diff --git a/src/common/mmo.h b/src/common/mmo.h index 35e66964c..b3069b27c 100644 --- a/src/common/mmo.h +++ b/src/common/mmo.h @@ -114,7 +114,15 @@ #define MAX_INVENTORY 100 //Max number of characters per account. Note that changing this setting alone is not enough if the client is not hexed to support more characters as well. -#define MAX_CHARS 9 +#if PACKETVER >= 20100413 +#ifndef MAX_CHARS + #define MAX_CHARS 12 +#endif +#else +#ifndef MAX_CHARS + #define MAX_CHARS 9 +#endif +#endif //Number of slots carded equipment can have. Never set to less than 4 as they are also used to keep the data of forged items/equipment. [Skotlex] //Note: The client seems unable to receive data for more than 4 slots due to all related packets having a fixed size. #define MAX_SLOTS 4 diff --git a/src/common/strlib.c b/src/common/strlib.c index 75ce2a272..df8093456 100644 --- a/src/common/strlib.c +++ b/src/common/strlib.c @@ -344,6 +344,7 @@ int strlib_config_switch(const char *str) { } /// strncpy that always null-terminates the string +/// @remark this function will read at most `n` - 1 bytes from `src` (from 0 to `n` - 2) char *strlib_safestrncpy(char *dst, const char *src, size_t n) { if( n > 0 ) diff --git a/src/map/atcommand.c b/src/map/atcommand.c index 2beb6c634..881e50497 100644 --- a/src/map/atcommand.c +++ b/src/map/atcommand.c @@ -8366,6 +8366,36 @@ void atcommand_commands_sub(struct map_session_data* sd, const int fd, AtCommand dbi_destroy(iter); clif->message(fd,line_buff); + if (atcommand->binding_count > 0) { + int i, count_bind = 0; + int gm_lvl = pc_get_group_level(sd); + + for (i = 0; i < atcommand->binding_count; i++) { + if (gm_lvl >= ((type == COMMAND_ATCOMMAND) ? atcommand->binding[i]->group_lv : atcommand->binding[i]->group_lv_char)) { + size_t slen = strlen(atcommand->binding[i]->command); + if (count_bind == 0) { + cur = line_buff; + memset(line_buff, ' ', CHATBOX_SIZE); + line_buff[CHATBOX_SIZE - 1] = 0; + clif->message(fd, "------------------"); + clif->message(fd, "Custom commands:"); + } + if (slen + cur - line_buff >= CHATBOX_SIZE) { + clif->message(fd, line_buff); + cur = line_buff; + memset(line_buff, ' ', CHATBOX_SIZE); + line_buff[CHATBOX_SIZE - 1] = 0; + } + memcpy(cur, atcommand->binding[i]->command, slen); + cur += slen + (10 - slen % 10); + count_bind++; + } + } + if (count_bind > 0) + clif->message(fd, line_buff); // Last Line + count += count_bind; + } + safesnprintf(atcmd_output, sizeof(atcmd_output), msg_fd(fd,274), count); // "%d commands found." clif->message(fd, atcmd_output); diff --git a/src/map/battle.c b/src/map/battle.c index 64fda033f..8a0a71645 100644 --- a/src/map/battle.c +++ b/src/map/battle.c @@ -6814,14 +6814,23 @@ int battle_check_target( struct block_list *src, struct block_list *target,int f if( flag&(BCT_PARTY|BCT_ENEMY) ) { int s_party = status->get_party_id(s_bl); int s_guild = status->get_guild_id(s_bl); + int t_guild = status->get_guild_id(t_bl); - if( s_party && s_party == status->get_party_id(t_bl) - && !(map->list[m].flag.pvp && map->list[m].flag.pvp_noparty) - && !(map_flag_gvg(m) && map->list[m].flag.gvg_noparty && !( s_guild && s_guild == status->get_guild_id(t_bl) )) - && (!map->list[m].flag.battleground || sbg_id == tbg_id) ) - state |= BCT_PARTY; - else + if (s_party != 0 && s_party == status->get_party_id(t_bl)) { + if (map_flag_gvg(m) && map->list[m].flag.gvg_noparty) { + if (s_guild != 0 && t_guild != 0 && (s_guild == t_guild || guild->isallied(s_guild, t_guild))) + state |= BCT_PARTY; + else + state |= flag&BCT_ENEMY ? BCT_ENEMY : BCT_PARTY; + } else if (!(map->list[m].flag.pvp && map->list[m].flag.pvp_noparty) + && (!map->list[m].flag.battleground || sbg_id == tbg_id)) { + state |= BCT_PARTY; + } else { + state |= BCT_ENEMY; + } + } else { state |= BCT_ENEMY; + } } if( flag&(BCT_GUILD|BCT_ENEMY) ) { int s_guild = status->get_guild_id(s_bl); @@ -7320,7 +7329,9 @@ static const struct battle_data { { "save_body_style", &battle_config.save_body_style, 0, 0, 1, }, { "player_warp_keep_direction", &battle_config.player_warp_keep_direction, 0, 0, 1, }, { "atcommand_levelup_events", &battle_config.atcommand_levelup_events, 0, 0, 1, }, + { "bow_unequip_arrow", &battle_config.bow_unequip_arrow, 1, 0, 1, }, { "max_summoner_parameter", &battle_config.max_summoner_parameter, 120, 10, 10000, }, + { "mvp_exp_reward_message", &battle_config.mvp_exp_reward_message, 0, 0, 1, }, }; #ifndef STATS_OPT_OUT /** @@ -7599,6 +7610,13 @@ void battle_adjust_conf(void) { } #endif +#if PACKETVER < 20131223 + if (battle_config.mvp_exp_reward_message) { + ShowWarning("conf/map/battle/client.conf MVP EXP reward message is enabled but it requires PACKETVER 2013-12-23 or newer, disabling...\n"); + battle_config.mvp_exp_reward_message = 0; + } +#endif + #ifndef CELL_NOSTACK if (battle_config.custom_cell_stack_limit != 1) ShowWarning("Battle setting 'custom_cell_stack_limit' takes no effect as this server was compiled without Cell Stack Limit support.\n"); diff --git a/src/map/battle.h b/src/map/battle.h index c55d5ef19..4665847ff 100644 --- a/src/map/battle.h +++ b/src/map/battle.h @@ -545,8 +545,11 @@ struct Battle_Config { int player_warp_keep_direction; int atcommand_levelup_events; // Enable atcommands trigger level up events for NPCs + + int bow_unequip_arrow; int max_summoner_parameter; // Summoner Max Stats + int mvp_exp_reward_message; }; /* criteria for battle_config.idletime_critera */ diff --git a/src/map/clif.c b/src/map/clif.c index 8de18da30..3a0b4d4c7 100644 --- a/src/map/clif.c +++ b/src/map/clif.c @@ -677,7 +677,8 @@ void clif_authok(struct map_session_data *sd) #if PACKETVER >= 20080102 p.font = sd->status.font; #endif -#if PACKETVER >= 20141016 +// Some clients smaller than 20160330 cant be tested [4144] +#if PACKETVER >= 20141016 && PACKETVER < 20160330 p.sex = sd->status.sex; #endif clif->send(&p,sizeof(p),&sd->bl,SELF); @@ -1077,15 +1078,21 @@ void clif_set_unit_idle(struct block_list* bl, struct map_session_data *tsd, enu #endif #if PACKETVER >= 20150513 p.body = vd->body_style; +#endif +/* Might be earlier, this is when the named item bug began */ +#if PACKETVER >= 20131223 safestrncpy(p.name, clif->get_bl_name(bl), NAME_LENGTH); #endif - clif->send(&p,sizeof(p),tsd?&tsd->bl:bl,target); if (clif->isdisguised(bl)) { #if PACKETVER >= 20091103 p.objecttype = pc->db_checkid(status->get_viewdata(bl)->class) ? 0x0 : 0x5; //PC_TYPE : NPC_MOB_TYPE +#if PACKETVER >= 20131223 + p.AID = -bl->id; +#else p.GID = -bl->id; +#endif #else p.GID = -bl->id; #endif @@ -1220,6 +1227,9 @@ void clif_spawn_unit(struct block_list* bl, enum send_target target) { #endif #if PACKETVER >= 20150513 p.body = vd->body_style; +#endif +/* Might be earlier, this is when the named item bug began */ +#if PACKETVER >= 20131223 safestrncpy(p.name, clif->get_bl_name(bl), NAME_LENGTH); #endif if (clif->isdisguised(bl)) { @@ -1228,7 +1238,11 @@ void clif_spawn_unit(struct block_list* bl, enum send_target target) { clif->send(&p,sizeof(p),bl,target); #if PACKETVER >= 20091103 p.objecttype = pc->db_checkid(status->get_viewdata(bl)->class) ? 0x0 : 0x5; //PC_TYPE : NPC_MOB_TYPE +#if PACKETVER >= 20131223 + p.AID = -bl->id; +#else p.GID = -bl->id; +#endif #else p.GID = -bl->id; #endif @@ -1262,7 +1276,7 @@ void clif_set_unit_walking(struct block_list* bl, struct map_session_data *tsd, #endif #if PACKETVER >= 20131223 p.AID = bl->id; - p.GID = (tsd) ? tsd->status.char_id : 0; // CCODE + p.GID = (sd) ? sd->status.char_id : 0; // CCODE #else p.GID = bl->id; #endif @@ -1312,6 +1326,9 @@ void clif_set_unit_walking(struct block_list* bl, struct map_session_data *tsd, #endif #if PACKETVER >= 20150513 p.body = vd->body_style; +#endif +/* Might be earlier, this is when the named item bug began */ +#if PACKETVER >= 20131223 safestrncpy(p.name, clif->get_bl_name(bl), NAME_LENGTH); #endif @@ -1320,7 +1337,11 @@ void clif_set_unit_walking(struct block_list* bl, struct map_session_data *tsd, if (clif->isdisguised(bl)) { #if PACKETVER >= 20091103 p.objecttype = pc->db_checkid(status->get_viewdata(bl)->class) ? 0x0 : 0x5; //PC_TYPE : NPC_MOB_TYPE +#if PACKETVER >= 20131223 + p.AID = -bl->id; +#else p.GID = -bl->id; +#endif #else p.GID = -bl->id; #endif @@ -1332,7 +1353,7 @@ void clif_set_unit_walking(struct block_list* bl, struct map_session_data *tsd, /// 01b0 <id>.L <type>.B <value>.L /// type: /// unused -void clif_class_change(struct block_list *bl, int class_, int type) +void clif_class_change(struct block_list *bl, int class_, int type, struct map_session_data *sd) { nullpo_retv(bl); @@ -1343,7 +1364,11 @@ void clif_class_change(struct block_list *bl, int class_, int type) WBUFL(buf,2)=bl->id; WBUFB(buf,6)=type; WBUFL(buf,7)=class_; - clif->send(buf,packet_len(0x1b0),bl,AREA); + + if (sd == NULL) + clif->send(buf, packet_len(0x1b0), bl, AREA); + else + clif->send(buf, packet_len(0x1b0), &sd->bl, SELF); } } @@ -7232,6 +7257,13 @@ void clif_mvp_item(struct map_session_data *sd,int nameid) /// 010b <exp>.L void clif_mvp_exp(struct map_session_data *sd, unsigned int exp) { +#if PACKETVER >= 20131223 // Kro removed this packet [Napster] + if (battle_config.mvp_exp_reward_message) { + char e_msg[CHAT_SIZE_MAX]; + sprintf(e_msg, msg_txt(855), exp); + clif->messagecolor_self(sd->fd, COLOR_CYAN, e_msg); // Congratulations! You are the MVP! Your reward EXP Points are %u !! + } +#else int fd; nullpo_retv(sd); @@ -7241,6 +7273,7 @@ void clif_mvp_exp(struct map_session_data *sd, unsigned int exp) WFIFOW(fd,0)=0x10b; WFIFOL(fd,2)=cap_value(exp,0,INT32_MAX); WFIFOSET(fd,packet_len(0x10b)); +#endif } /// Dropped MVP item reward message (ZC_THROW_MVPITEM). @@ -11594,7 +11627,12 @@ void clif_parse_NpcStringInput(int fd, struct map_session_data* sd) __attribute_ /// 01d5 <packet len>.W <npc id>.L <string>.?B void clif_parse_NpcStringInput(int fd, struct map_session_data* sd) { - int message_len = RFIFOW(fd,2)-8; +// [4144] can't confirm exact client version. At least >= correct for 20150513 +#if PACKETVER >= 20151029 + int message_len = RFIFOW(fd, 2) - 7; +#else + int message_len = RFIFOW(fd, 2) - 8; +#endif int npcid = RFIFOL(fd,4); const char *message = RFIFOP(fd,8); @@ -16201,7 +16239,7 @@ void clif_bg_hp(struct map_session_data *sd) { unsigned char buf[34]; -// packet version can be wrong, because inconsistend data in other servers. +// packet version can be wrong, because inconsistend data in other servers. From packets table it start from 20140312 [4144] #if PACKETVER < 20140613 const int cmd = 0x2e0; nullpo_retv(sd); diff --git a/src/map/clif.h b/src/map/clif.h index c4cf045c3..e16655c1a 100644 --- a/src/map/clif.h +++ b/src/map/clif.h @@ -65,6 +65,7 @@ struct view_data; #define MAX_ROULETTE_COLUMNS 9 /** client-defined value **/ #define RGB2BGR(c) (((c) & 0x0000FF) << 16 | ((c) & 0x00FF00) | ((c) & 0xFF0000) >> 16) +#define COLOR_CYAN 0x00ffffU #define COLOR_RED 0xff0000U #define COLOR_GREEN 0x00ff00U #define COLOR_WHITE 0xffffffU @@ -671,7 +672,7 @@ struct clif_interface { 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 (*class_change) (struct block_list *bl,int class_,int type, struct map_session_data *sd); void (*skill_delunit) (struct skill_unit *su); void (*skillunit_update) (struct block_list* bl); int (*clearunit_delayed_sub) (int tid, int64 tick, int id, intptr_t data); diff --git a/src/map/mob.c b/src/map/mob.c index d5932f195..74d25b805 100644 --- a/src/map/mob.c +++ b/src/map/mob.c @@ -2832,7 +2832,7 @@ int mob_class_change (struct mob_data *md, int class_) { mob_stop_walking(md, STOPWALKING_FLAG_NONE); unit->skillcastcancel(&md->bl, 0); status->set_viewdata(&md->bl, class_); - clif->class_change(&md->bl, md->vd->class, 1); + clif->class_change(&md->bl, md->vd->class, 1, NULL); status_calc_mob(md, SCO_FIRST); md->ud.state.speed_changed = 1; //Speed change update. diff --git a/src/map/packets.h b/src/map/packets.h index c622cb89d..61289d3b1 100644 --- a/src/map/packets.h +++ b/src/map/packets.h @@ -2617,6 +2617,14 @@ packet(0x96e,-1,clif->ackmergeitems); packet(0x0896,8,clif->pDull); // CZ_JOIN_BATTLE_FIELD #endif +// 2013-10-30aRagexe +#if PACKETVER >= 20131030 +// new packets + packet(0x09de,-1); // ZC_WHISPER02 + packet(0x09df,7); // ZC_ACK_WHISPER02 + packet(0x09e0,-1); // SC_LOGIN_ANSWER_WITH_ID +#endif + // 2013-12-18bRagexe - Yommy #if PACKETVER >= 20131218 packet(0x0369,7,clif->pActionRequest,2,6); @@ -2687,7 +2695,6 @@ packet(0x96e,-1,clif->ackmergeitems); packet(0x08A4,36,clif->pStoragePassword,0); packet(0x0363,8,clif->pDull); // CZ_JOIN_BATTLE_FIELD packet(0x0436,4,clif->pDull); // CZ_GANGSI_RANK - packet(0x09df,7); packet(0x09cb,17); #endif @@ -2760,6 +2767,47 @@ packet(0x96e,-1,clif->ackmergeitems); packet(0x0865,36,clif->pStoragePassword,0); #endif +// 2014-01-15cRagexeRE +#if PACKETVER >= 20140115 +// new packets + packet(0x09f1,10,clif->pDull/*,XXX*/); // CZ_REQ_ZENY_FROM_RODEX + packet(0x09f2,3); // ZC_ACK_ZENY_FROM_RODEX + packet(0x09f3,15,clif->pDull/*,XXX*/); // CZ_REQ_ITEM_FROM_RODEX + packet(0x09f4,12); // ZC_ACK_ITEM_FROM_RODEX + packet(0x09f8,-1); // ZC_ALL_QUEST_LIST3 + packet(0x09f9,131); // ZC_ADD_QUEST_EX + packet(0x09fa,-1); // ZC_UPDATE_MISSION_HUNT_EX +// changed packet sizes + packet(0x09eb,-1); // ZC_ACK_READ_RODEX +#endif + +// 2014-01-22aRagexeRE +#if PACKETVER >= 20140122 +// new packets + packet(0x09fb,-1,clif->pDull/*,XXX*/); // CZ_PET_EVOLUTION + packet(0x09fc,6); // ZC_PET_EVOLUTION_RESULT + packet(0x09fd,-1); // ZC_NOTIFY_MOVEENTRY11 + packet(0x09fe,-1); // ZC_NOTIFY_NEWENTRY11 + packet(0x09ff,-1); // ZC_NOTIFY_STANDENTRY11 +// changed packet sizes + packet(0x09f9,143); // ZC_ADD_QUEST_EX +#endif + +// 2014-01-29bRagexeRE +#if PACKETVER >= 20140129 +// new packets + packet(0x0a00,269); // ZC_SHORTCUT_KEY_LIST_V3 + packet(0x0a01,3,clif->pHotkeyRowShift,2); // CZ_SHORTCUTKEYBAR_ROTATE +// Warning hercules using this packets for items manipulation. In RagexeRE from 20140129 and before 20140305, this actions broken. +#ifdef PACKETVER_RE +// changed packet sizes + packet(0x01c4,43); // ZC_ADD_ITEM_TO_STORE2 + packet(0x01c5,43); // ZC_ADD_ITEM_TO_CART2 + packet(0x080f,41); // ZC_ADD_EXCHANGE_ITEM2 + packet(0x0990,52); // ZC_ITEM_PICKUP_ACK_V5 +#endif // PACKETVER_RE +#endif + // 2014-02-05bRagexe - Themon #if PACKETVER >= 20140205 packet(0x0369,7,clif->pActionRequest,2,6); @@ -2791,7 +2839,36 @@ packet(0x96e,-1,clif->ackmergeitems); packet(0x0938,36,clif->pStoragePassword,0); packet(0x0363,8,clif->pDull); // CZ_JOIN_BATTLE_FIELD packet(0x0436,4,clif->pDull); // CZ_GANGSI_RANK - packet(0x09DF,7); +#endif + +// 2014-02-12aRagexeRE +#if PACKETVER >= 20140212 +// new packets + packet(0x0a02,4); // ZC_DRESSROOM_OPEN +// changed packet sizes + packet(0x09e8,11,clif->pDull/*,XXX*/); // CZ_OPEN_RODEXBOX +#endif + +// 2014-02-19aRagexeRE +#if PACKETVER >= 20140219 +// Warning hercules using this packets for items manipulation. In RagexeRE from 20140129 and before 20140305, this actions broken. +#ifdef PACKETVER_RE +// changed packet sizes + packet(0x01c4,53); // ZC_ADD_ITEM_TO_STORE2 + packet(0x01c5,53); // ZC_ADD_ITEM_TO_CART2 + packet(0x080f,51); // ZC_ADD_EXCHANGE_ITEM2 + packet(0x0990,62); // ZC_ITEM_PICKUP_ACK_V5 +#endif // PACKETVER_RE +#endif + +// 2014-02-26aRagexeRE +#if PACKETVER >= 20140226 +// new packets + packet(0x0a03,14,clif->pDull/*,XXX*/); // CZ_REQ_CANCEL_WRITE_RODEX + packet(0x0a04,11,clif->pDull/*,XXX*/); // CZ_REQ_ADD_ITEM_RODEX + packet(0x0a05,6); // ZC_ACK_ADD_ITEM_RODEX + packet(0x0a06,5,clif->pDull/*,XXX*/); // CZ_REQ_REMOVE_RODEX_ITEM +// changed packet sizes #endif // 2014-03-05bRagexe - Themon @@ -2825,7 +2902,49 @@ packet(0x96e,-1,clif->ackmergeitems); packet(0x095e,36,clif->pStoragePassword,0); packet(0x0363,8,clif->pDull); // CZ_JOIN_BATTLE_FIELD packet(0x0878,4,clif->pDull); // CZ_GANGSI_RANK - packet(0x09DF,7); +#endif + +// 2014-03-05aRagexeRE +#if PACKETVER >= 20140305 +// new packets + packet(0x0a07,4); // ZC_ACK_REMOVE_RODEX_ITEM + packet(0x0a08,5,clif->pDull/*,XXX*/); // CZ_REQ_OPEN_WRITE_RODEX + packet(0x0a09,50); // ZC_ADD_EXCHANGE_ITEM3 + packet(0x0a0a,52); // ZC_ADD_ITEM_TO_STORE3 + packet(0x0a0b,52); // ZC_ADD_ITEM_TO_CART3 + packet(0x0a0c,61); // ZC_ITEM_PICKUP_ACK_V6 + packet(0x0a0d,4); // ZC_INVENTORY_ITEMLIST_EQUIP_V6 +// changed packet sizes + packet(0x01c4,22); // ZC_ADD_ITEM_TO_STORE2 + packet(0x01c5,22); // ZC_ADD_ITEM_TO_CART2 + packet(0x080f,20); // ZC_ADD_EXCHANGE_ITEM2 + packet(0x0990,31); // ZC_ITEM_PICKUP_ACK_V5 + packet(0x09f3,10,clif->pDull/*,XXX*/); // CZ_REQ_ITEM_FROM_RODEX + packet(0x09f4,3); // ZC_ACK_ITEM_FROM_RODEX +#endif + +// 2014-03-12bRagexeRE +#if PACKETVER >= 20140312 +// new packets + packet(0x0a0e,14); // ZC_BATTLEFIELD_NOTIFY_HP2 +// changed packet sizes + packet(0x0a09,45); // ZC_ADD_EXCHANGE_ITEM3 + packet(0x0a0a,47); // ZC_ADD_ITEM_TO_STORE3 + packet(0x0a0b,47); // ZC_ADD_ITEM_TO_CART3 + packet(0x0a0c,56); // ZC_ITEM_PICKUP_ACK_V6 + packet(0x0a0d,-1); // ZC_INVENTORY_ITEMLIST_EQUIP_V6 +#endif + +// 2014-03-26cRagexeRE +#if PACKETVER >= 20140326 +// changed packet sizes + packet(0x09f1,11,clif->pDull/*,XXX*/); // CZ_REQ_ZENY_FROM_RODEX + packet(0x09f2,4); // ZC_ACK_ZENY_FROM_RODEX + packet(0x09f3,11,clif->pDull/*,XXX*/); // CZ_REQ_ITEM_FROM_RODEX + packet(0x09f4,4); // ZC_ACK_ITEM_FROM_RODEX + packet(0x0a03,2,clif->pDull/*,XXX*/); // CZ_REQ_CANCEL_WRITE_RODEX + packet(0x0a07,6); // ZC_ACK_REMOVE_RODEX_ITEM + packet(0x0a08,7,clif->pDull/*,XXX*/); // CZ_REQ_OPEN_WRITE_RODEX #endif // 2014-04-02gRagexe - Themon @@ -2859,7 +2978,22 @@ packet(0x96e,-1,clif->ackmergeitems); packet(0x0926,36,clif->pStoragePassword,0); packet(0x088c,4,clif->pDull); // CZ_GANGSI_RANK packet(0x094c,8,clif->pDull); // CZ_JOIN_BATTLE_FIELD - packet(0x09DF,7); +#endif + +// 2014-04-02eRagexeRE +#if PACKETVER >= 20140402 +// new packets + packet(0x0a0f,-1); // ZC_CART_ITEMLIST_EQUIP_V6 + packet(0x0a10,-1); // ZC_STORE_ITEMLIST_EQUIP_V6 + packet(0x0a11,-1); // ZC_GUILDSTORAGE_ITEMLIST_EQUIP_V6 +// changed packet sizes +#endif + +// 2014-04-09aRagexeRE +#if PACKETVER >= 20140409 +// changed packet sizes + packet(0x09f2,12); // ZC_ACK_ZENY_FROM_RODEX + packet(0x09f4,12); // ZC_ACK_ITEM_FROM_RODEX #endif // 2014-04-16aRagexe - Themon @@ -2893,18 +3027,155 @@ packet(0x96e,-1,clif->ackmergeitems); packet(0x095C,36,clif->pStoragePassword,0); packet(0x0363,8,clif->pDull); // CZ_JOIN_BATTLE_FIELD packet(0x0436,4,clif->pDull); // CZ_GANGSI_RANK - packet(0x09DF,7); #endif -#if PACKETVER >= 20140613 -// no shuffle packets - packet(0x0a0e,14); +// 2014-04-16aRagexeRE +#if PACKETVER >= 20140416 +// new packets + packet(0x0a04,6,clif->pDull/*,XXX*/); // CZ_REQ_ADD_ITEM_RODEX + packet(0x0a12,27); // ZC_ACK_OPEN_WRITE_RODEX + packet(0x0a13,2,clif->pDull/*,XXX*/); // CZ_CHECK_RECEIVE_CHARACTER_NAME +// changed packet sizes + packet(0x0a05,48); // ZC_ACK_ADD_ITEM_RODEX + packet(0x0a06,6,clif->pDull/*,XXX*/); // CZ_REQ_REMOVE_RODEX_ITEM + packet(0x0a07,7); // ZC_ACK_REMOVE_RODEX_ITEM + packet(0x0a08,26,clif->pDull/*,XXX*/); // CZ_REQ_OPEN_WRITE_RODEX +#endif + +// 2014-04-23aRagexeRE +#if PACKETVER >= 20140423 +// new packets + packet(0x0a14,6); // ZC_CHECK_RECEIVE_CHARACTER_NAME +// changed packet sizes + packet(0x0a13,26,clif->pDull/*,XXX*/); // CZ_CHECK_RECEIVE_CHARACTER_NAME +#endif + +// 2014-04-30aRagexeRE +#if PACKETVER >= 20140430 +// new packets + packet(0x0a15,11); // ZC_GOLDPCCAFE_POINT + packet(0x0a16,26,clif->pDull/*,XXX*/); // CZ_DYNAMICNPC_CREATE_REQUEST + packet(0x0a17,6); // ZC_DYNAMICNPC_CREATE_RESULT +#endif + +// 2014-05-08bRagexeRE +#if PACKETVER >= 20140508 +// changed packet sizes + packet(0x0a15,12); // ZC_GOLDPCCAFE_POINT +#endif + +// 2014-05-21aRagexeRE +#if PACKETVER >= 20140521 +// changed packet sizes + packet(0x0a07,9); // ZC_ACK_REMOVE_RODEX_ITEM + packet(0x0a14,10); // ZC_CHECK_RECEIVE_CHARACTER_NAME +#endif + +/* Roulette System [Yommy/Hercules] */ +// 2014-06-05aRagexe +#if PACKETVER >= 20140605 +// new packets + packet(0x0a18,2); // ZC_ACCEPT_ENTER3 + packet(0x0a19,-1,clif->pDull/*,XXX*/); // CZ_REQ_OPEN_ROULETTE + packet(0x0a1a,10); // ZC_ACK_OPEN_ROULETTE + packet(0x0A1B,2,clif->pRouletteInfo,0); // HEADER_CZ_REQ_ROULETTE_INFO + packet(0x0a1c,6); // ZC_ACK_ROULEITTE_INFO + packet(0x0a1d,14,clif->pDull/*,XXX*/); // CZ_REQ_CLOSE_ROULETTE +#endif + +/* Roulette System [Yommy/Hercules] */ +// 2014-06-11bRagexe / RE. moved by 4144 +#if PACKETVER >= 20140611 +// new packets + packet(0x0a1e,3); // ZC_ACK_CLOSE_ROULETTE + packet(0x0a1f,2,clif->pRouletteGenerate,0); // CZ_REQ_GENERATE_ROULETTE + packet(0x0a20,21); // ZC_ACK_GENERATE_ROULETTE + packet(0x0a21,6,clif->pDull/*,XXX*/); // CZ_RECV_ROULETTE_ITEM + packet(0x0a22,3); // ZC_RECV_ROULETTE_ITEM + packet(0x0a23,-1); // ZC_ALL_ACH_LIST + packet(0x0a24,35); // ZC_ACH_UPDATE + packet(0x0a25,6,clif->pDull/*,XXX*/); // CZ_REQ_ACH_REWARD + packet(0x0a26,7); // ZC_REQ_ACH_REWARD_ACK +// changed packet sizes + packet(0x0a18,14); // ZC_ACCEPT_ENTER3 + packet(0x0a19,2,clif->pRouletteOpen,0); // CZ_REQ_OPEN_ROULETTE + packet(0x0a1a,23); // ZC_ACK_OPEN_ROULETTE + packet(0x0a1c,-1); // ZC_ACK_ROULEITTE_INFO + packet(0x0a1d,2,clif->pRouletteClose,0); // CZ_REQ_CLOSE_ROULETTE +#endif + +// 2014-06-18cRagexeRE +#if PACKETVER >= 20140618 +// changed packet sizes + packet(0x0a21,3,clif->pRouletteRecvItem,2); // CZ_RECV_ROULETTE_ITEM + packet(0x0a22,5); // ZC_RECV_ROULETTE_ITEM #endif // 2014-06-25aRagexeRE #if PACKETVER >= 20140625 -// no shuffle packets +// new packets + packet(0x0a27,8); // ZC_RECOVERY2 packet(0x0a28,3); // ZC_ACK_OPENSTORE2 +// changed packet sizes + packet(0x0a24,36); // ZC_ACH_UPDATE +#endif + +// 2014-07-02aRagexeRE +#if PACKETVER >= 20140702 +// new packets + packet(0x0a29,6); // ZC_REQ_AU_BOT + packet(0x0a2a,6,clif->pDull/*,XXX*/); // CZ_ACK_AU_BOT +#endif + +// 2014-07-16aRagexeRE +#if PACKETVER >= 20140716 +// changed packet sizes + packet(0x09e7,3); // ZC_NOTIFY_UNREAD_RODEX +#endif + +// 2014-07-23aRagexeRE +#if PACKETVER >= 20140723 +// new packets + packet(0x0a2b,14); // ZC_SE_CASHSHOP_OPEN2 + packet(0x0a2c,12); // ZC_SE_PC_BUY_TAIWANCASHITEM_RESULT +// changed packet sizes + packet(0x0a24,56); // ZC_ACH_UPDATE +#endif + +// 2014-08-20aRagexeRE +#if PACKETVER >= 20140820 +// new packets + packet(0x0a2d,-1); // ZC_EQUIPWIN_MICROSCOPE_V6 +#endif + +// 2014-09-03aRagexeRE +#if PACKETVER >= 20140903 +// new packets + packet(0x0a2e,6,clif->pDull/*,XXX*/); // CZ_REQ_CHANGE_TITLE + packet(0x0a2f,7); // ZC_ACK_CHANGE_TITLE +// changed packet sizes +#endif + +// 2014-09-24bRagexeRE +#if PACKETVER >= 20140924 +// new packets + packet(0x0a30,106); // ZC_ACK_REQNAMEALL2 + packet(0x0a31,-1); // ZC_RESULT_PACKAGE_ITEM_TEST + packet(0x0a32,2); // ZC_OPEN_RODEX_THROUGH_NPC_ONLY + packet(0x0a33,7); // ZC_UPDATE_ROULETTE_COIN + packet(0x0a34,6); // ZC_UPDATE_TAIWANCASH +#endif + +// 2014-10-01bRagexeRE +#if PACKETVER >= 20141001 +// changed packet sizes + packet(0x0a24,66); // ZC_ACH_UPDATE +#endif + +// 2014-10-08bRagexeRE +#if PACKETVER >= 20141008 +// changed packet sizes + packet(0x0a05,49); // ZC_ACK_ADD_ITEM_RODEX #endif // 2014-10-16aRagexe - YomRawr @@ -2938,26 +3209,10 @@ packet(0x96e,-1,clif->ackmergeitems); packet(0x0936,36,clif->pStoragePassword,0); packet(0x0363,8,clif->pDull); // CZ_JOIN_BATTLE_FIELD packet(0x0922,4,clif->pDull); // CZ_GANGSI_RANK - packet(0x09DF,7); - packet(0x0a00,269); packet(0x09e5,18); // ZC_DELETEITEM_FROM_MCSTORE2 packet(0x09e6,22); // ZC_UPDATE_ITEM_FROM_BUYING_STORE2 #endif -/* Roulette System [Yommy/Hercules] */ -#if PACKETVER >= 20141016 - packet(0x0A19,2,clif->pRouletteOpen,0); // HEADER_CZ_REQ_OPEN_ROULETTE - packet(0x0A1A,23); // HEADER_ZC_ACK_OPEN_ROULETTE - packet(0x0A1B,2,clif->pRouletteInfo,0); // HEADER_CZ_REQ_ROULETTE_INFO - packet(0x0A1C,-1); // HEADER_ZC_ACK_ROULEITTE_INFO - packet(0x0A1D,2,clif->pRouletteClose,0); // HEADER_CZ_REQ_CLOSE_ROULETTE - packet(0x0A1E,3); // HEADER_ZC_ACK_CLOSE_ROULETTE - packet(0x0A1F,2,clif->pRouletteGenerate,0); // HEADER_CZ_REQ_GENERATE_ROULETTE - packet(0x0A20,21); // HEADER_ZC_ACK_GENERATE_ROULETTE - packet(0x0A21,3,clif->pRouletteRecvItem,2); // HEADER_CZ_RECV_ROULETTE_ITEM - packet(0x0A22,5); // HEADER_ZC_RECV_ROULETTE_ITEM -#endif - // 2014-10-22bRagexe - YomRawr #if PACKETVER >= 20141022 packet(0x0369,7,clif->pActionRequest,2,6); @@ -2987,22 +3242,57 @@ packet(0x96e,-1,clif->ackmergeitems); packet(0x091A,26,clif->pFriendsListAdd,2); packet(0x0899,5,clif->pHomMenu,2,4); packet(0x0438,36,clif->pStoragePassword,0); - packet(0x0A01,3,clif->pHotkeyRowShift,2); packet(0x08ab,4,clif->pDull); // CZ_GANGSI_RANK packet(0x092b,8,clif->pDull); // CZ_JOIN_BATTLE_FIELD #endif +// 2014-11-19bRagexeRE +#if PACKETVER >= 20141119 +// new packets + packet(0x0A35,4,clif->pOneClick_ItemIdentify,2); +// changed packet sizes + packet(0x0a05,53); // ZC_ACK_ADD_ITEM_RODEX +#endif + +// 2014-11-26aRagexeRE +#if PACKETVER >= 20141126 +// new packets + packet(0x0a36,7); // ZC_HP_INFO_TINY + packet(0x0a37,57); // ZC_ITEM_PICKUP_ACK_V7 +#endif + +// 2015-01-28aRagexeRE +#if PACKETVER >= 20150128 +// new packets + packet(0x0a38,3); +#endif + #if PACKETVER >= 20150226 // shuffle packets not added - packet(0x0A09,45); - packet(0x0A0A,47); - packet(0x0A0B,47); - packet(0x0A0C,56); - packet(0x0A0D,-1); packet(0x0A0F,-1); packet(0x0A10,-1); #endif +// 2015-03-11aRagexeRE +#if PACKETVER >= 20150311 +// new packets + packet(0x0a3a,12); +// changed packet sizes +#endif + +// 2015-04-15aRagexeRE +#if PACKETVER >= 20150415 +// changed packet sizes + packet(0x0a39,36); // CH_UNKNOWN_MAKE_CHAR // in char server used from 20151001. is this correct? +#endif + +// 2015-04-22aRagexeRE +#if PACKETVER >= 20150422 +// new packets + packet(0x0a3b,-1); +// changed packet sizes +#endif + // 2015-05-13aRagexe #if PACKETVER >= 20150513 packet(0x0369,7,clif->pActionRequest,2,6); @@ -3034,19 +3324,55 @@ packet(0x96e,-1,clif->ackmergeitems); packet(0x08A8,26,clif->pFriendsListAdd,2); packet(0x0817,5,clif->pHomMenu,2,4); packet(0x0923,36,clif->pStoragePassword,0); - packet(0x09E8,11,clif->pDull); // CZ_OPEN_MAILBOX - packet(0x0A2E,6,clif->pDull); // TITLE - packet(0x0A02,4); // ZC_DRESSROOM_OPEN - packet(0x0A35,4,clif->pOneClick_ItemIdentify,2); packet(0x0a27,8); // ZC_RECOVERY2 packet(0x09f7,75); // ZC_PROPERTY_HOMUN_2 #endif +// 2015-05-20aRagexeRE +#if PACKETVER >= 20150520 +// new packets + packet(0x0a3c,-1); + packet(0x0a3d,18,clif->pDull/*,XXX*/); +#endif + +// 2015-06-03bRagexeRE +#if PACKETVER >= 20150603 +// new packets + packet(0x0a3e,-1); +#endif + +// 2015-06-24aRagexeRE +#if PACKETVER >= 20150624 +// new packets + packet(0x0a3f,9); +#endif + +// --- +// this packet was added in 2012-05-02aRagexeRE / 2012-05-03aRagexe probably if should be allowed in this versions? #if PACKETVER >= 20150805 // RagexeRE // shuffle packets not added - packet(0x097f,-1); // ZC_SELECTCART + packet(0x097f,-1); // ZC_SELECTCART packet(0x0980,7,clif->pSelectCart); // CZ_SELECTCART #endif +// --- + +// 2015-08-12aRagexeRE +#if PACKETVER >= 20150812 +// new packets + packet(0x0a40,11); +#endif + +// 2015-09-09aRagexeRE +#if PACKETVER >= 20150909 +// new packets + packet(0x0a41,18); +#endif + +// 2015-09-16aRagexeRE +#if PACKETVER >= 20150916 +// new packets + packet(0x0a42,43); +#endif // 2015-10-01bRagexeRE #if PACKETVER >= 20151001 @@ -3081,6 +3407,19 @@ packet(0x96e,-1,clif->ackmergeitems); packet(0x0436,4,clif->pDull); // CZ_GANGSI_RANK #endif +// 2015-10-07aRagexeRE +#if PACKETVER >= 20151007 +// new packets + packet(0x0a43,85); + packet(0x0a44,-1); +#endif + +// 2015-10-28cRagexeRE +#if PACKETVER >= 20151028 +// new packets + packet(0x0a45,-1); +#endif + // 2015-10-29aRagexe #if PACKETVER >= 20151029 packet(0x0369,7,clif->pActionRequest,2,6); @@ -3112,7 +3451,6 @@ packet(0x96e,-1,clif->ackmergeitems); packet(0x0860,36,clif->pStoragePassword,0); packet(0x0363,8,clif->pDull); // CZ_JOIN_BATTLE_FIELD packet(0x0436,4,clif->pDull); // CZ_GANGSI_RANK - packet(0x0a39,36); #endif // 2015-11-04aRagexe @@ -3146,7 +3484,21 @@ packet(0x96e,-1,clif->ackmergeitems); packet(0x0940,36,clif->pStoragePassword,2,4,20); packet(0x08a3,4,clif->pDull); // CZ_GANGSI_RANK packet(0x0939,8,clif->pDull); // CZ_JOIN_BATTLE_FIELD - packet(0x0a39,36); +// new packets + packet(0x0a46,14,clif->pDull/*,XXX*/); + packet(0x0a47,3); + packet(0x0a48,2,clif->pDull/*,XXX*/); +// changed packet sizes + packet(0x0a45,2); +#endif + +// 2015-11-18aRagexeRE +#if PACKETVER >= 20151118 +// new packets + packet(0x0a49,22); + packet(0x0a4a,6); + packet(0x0a4b,22); + packet(0x0a4c,28); #endif // 2015-12-16aRagexe diff --git a/src/map/packets_struct.h b/src/map/packets_struct.h index 420cf0c4b..0bd85db7f 100644 --- a/src/map/packets_struct.h +++ b/src/map/packets_struct.h @@ -141,8 +141,11 @@ enum packet_headers { authokType = 0x73, #elif PACKETVER < 20141022 authokType = 0x2eb, -#else +// Some clients smaller than 20160330 cant be tested [4144] +#elif PACKETVER < 20160330 authokType = 0xa18, +#else + authokType = 0x2eb, #endif script_clearType = 0x8d6, package_item_announceType = 0x7fd, @@ -286,7 +289,7 @@ enum packet_headers { maptypeproperty2Type = 0x99b, npcmarketresultackType = 0x9d7, npcmarketopenType = 0x9d5, -#if PACKETVER >= 20131223 +#if PACKETVER >= 20131223 // version probably can be 20131030 [4144] wisendType = 0x9df, #else wisendType = 0x98, @@ -400,7 +403,8 @@ struct packet_authok { #if PACKETVER >= 20080102 int16 font; #endif -#if PACKETVER >= 20141022 +// Some clients smaller than 20160330 cant be tested [4144] +#if PACKETVER >= 20141022 && PACKETVER < 20160330 uint8 sex; #endif } __attribute__((packed)); @@ -589,6 +593,9 @@ struct packet_spawn_unit { #endif #if PACKETVER >= 20150513 int16 body; +#endif +/* Might be earlier, this is when the named item bug began */ +#if PACKETVER >= 20131223 char name[NAME_LENGTH]; #endif } __attribute__((packed)); @@ -657,6 +664,9 @@ struct packet_unit_walking { #endif #if PACKETVER >= 20150513 int16 body; +#endif +/* Might be earlier, this is when the named item bug began */ +#if PACKETVER >= 20131223 char name[NAME_LENGTH]; #endif } __attribute__((packed)); @@ -723,6 +733,9 @@ struct packet_idle_unit { #endif #if PACKETVER >= 20150513 int16 body; +#endif +/* Might be earlier, this is when the named item bug began */ +#if PACKETVER >= 20131223 char name[NAME_LENGTH]; #endif } __attribute__((packed)); diff --git a/src/map/party.c b/src/map/party.c index 3bf9542c7..26b4bae8b 100644 --- a/src/map/party.c +++ b/src/map/party.c @@ -274,6 +274,7 @@ int party_recv_info(const struct party *sp, int char_id) int added_count = 0; int j; int member_id; + int leader_account_id = 0, leader_char_id = 0; nullpo_ret(sp); @@ -287,8 +288,12 @@ int party_recv_info(const struct party *sp, int char_id) ARR_FIND(0, MAX_PARTY, i, sp->member[i].account_id == member->account_id && sp->member[i].char_id == member->char_id); - if (i == MAX_PARTY) + if (i == MAX_PARTY) { removed[removed_count++] = member_id; + } else if (member->leader != 0) { + leader_account_id = member->account_id; + leader_char_id = member->char_id; + } } for (member_id = 0; member_id < MAX_PARTY; ++member_id) { member = &sp->member[member_id]; @@ -316,6 +321,7 @@ int party_recv_info(const struct party *sp, int char_id) continue;// not online party->member_withdraw(sp->party_id, sd->status.account_id, sd->status.char_id); } + memcpy(&p->party, sp, sizeof(struct party)); memset(&p->state, 0, sizeof(p->state)); memset(&p->data, 0, sizeof(p->data)); @@ -324,6 +330,8 @@ int party_recv_info(const struct party *sp, int char_id) if ( member->char_id == 0 ) continue;// empty p->data[member_id].sd = party->sd_check(sp->party_id, member->account_id, member->char_id); + if (member->account_id == leader_account_id && member->char_id == leader_char_id) + p->party.member[member_id].leader = 1; } party->check_state(p); while( added_count > 0 ) { // new in party @@ -591,11 +599,43 @@ int party_member_withdraw(int party_id, int account_id, int char_id) int i; ARR_FIND( 0, MAX_PARTY, i, p->party.member[i].account_id == account_id && p->party.member[i].char_id == char_id ); if( i < MAX_PARTY ) { + bool was_leader = false; + int prev_leader_accountId = 0; + if (p->party.member[i].leader != 0) { + was_leader = true; + prev_leader_accountId = p->party.member[i].account_id; + } + clif->party_withdraw(p,sd,account_id,p->party.member[i].name,0x0); memset(&p->party.member[i], 0, sizeof(p->party.member[0])); memset(&p->data[i], 0, sizeof(p->data[0])); p->party.count--; party->check_state(p); + + if (was_leader) { + int k; + // Member was party leader, try to pick a new leader from online members + ARR_FIND(0, MAX_PARTY, k, p->party.member[k].account_id != 0 && p->party.member[k].online == 1); + + if (k == MAX_PARTY) { + // No online members, get an offline one + ARR_FIND(0, MAX_PARTY, k, p->party.member[k].account_id != 0); + } + + if (k < MAX_PARTY) { + // Update party's leader + p->party.member[k].leader = 1; + + if (p->data[k].sd != NULL) { + /** update members **/ + clif->PartyLeaderChanged(p->data[k].sd, prev_leader_accountId, p->data[k].sd->status.account_id); + } + + //Update info. + intif->party_leaderchange(p->party.party_id, p->party.member[k].account_id, p->party.member[k].char_id); + clif->party_info(p, NULL); + } + } } } diff --git a/src/map/pc.c b/src/map/pc.c index 2cf5d75b4..e9855c16d 100644 --- a/src/map/pc.c +++ b/src/map/pc.c @@ -387,7 +387,6 @@ int pc_banding(struct map_session_data *sd, uint16 skill_lv) { return c; } -// Increases a player's fame points and displays a notice to him /** * Increases a player's fame points and displays a notice to them. * @@ -10036,6 +10035,11 @@ int pc_unequipitem(struct map_session_data *sd,int n,int flag) status_change_end(&sd->bl, SC_ARMOR_RESIST, INVALID_TIMER); } +#ifdef RENEWAL + if (battle->bc->bow_unequip_arrow && pos&EQP_ARMS && sd->equip_index[EQI_AMMO] > 0) + pc->unequipitem(sd, sd->equip_index[EQI_AMMO], PCUNEQUIPITEM_FORCE); +#endif + if( sd->state.autobonus&pos ) sd->state.autobonus &= ~sd->status.inventory[n].equip; //Check for activated autobonus [Inkfish] diff --git a/src/map/script.c b/src/map/script.c index e14cd5504..0cc7aeabe 100644 --- a/src/map/script.c +++ b/src/map/script.c @@ -2825,7 +2825,7 @@ struct script_data *get_val(struct script_state* st, struct script_data* data) { char postfix; struct map_session_data *sd = NULL; - if( !data_isreference(data) ) + if (!data_isreference(data)) return data;// not a variable/constant name = reference_getname(data); @@ -2840,10 +2840,10 @@ struct script_data *get_val(struct script_state* st, struct script_data* data) { } //##TODO use reference_tovariable(data) when it's confirmed that it works [FlavioJS] - if( !reference_toconstant(data) && not_server_variable(prefix) ) { + if (!reference_toconstant(data) && not_server_variable(prefix) && reference_getref(data) == NULL) { sd = script->rid2sd(st); - if( sd == NULL ) {// needs player attached - if( postfix == '$' ) {// string variable + if (sd == NULL) {// needs player attached + if (postfix == '$') {// string variable ShowWarning("script_get_val: cannot access player variable '%s', defaulting to \"\"\n", name); data->type = C_CONSTSTR; data->u.str = ""; @@ -2861,32 +2861,44 @@ struct script_data *get_val(struct script_state* st, struct script_data* data) { const char *str = NULL; switch (prefix) { - case '@': + case '@': + if (data->ref) { + str = script->get_val_ref_str(st, data->ref, data); + } else { str = pc->readregstr(sd, data->u.num); - break; - case '$': - str = mapreg->readregstr(data->u.num); - break; - case '#': - if (name[1] == '#') - str = pc_readaccountreg2str(sd, data->u.num);// global - else - str = pc_readaccountregstr(sd, data->u.num);// local - break; - case '.': - if (data->ref) - str = script->get_val_ref_str(st, data->ref, data); - else if (name[1] == '@') - str = script->get_val_scope_str(st, &st->stack->scope, data); - else - str = script->get_val_npc_str(st, &st->script->local, data); - break; - case '\'': - str = script->get_val_instance_str(st, name, data); - break; - default: + } + break; + case '$': + str = mapreg->readregstr(data->u.num); + break; + case '#': + if (data->ref) { + str = script->get_val_ref_str(st, data->ref, data); + } else if (name[1] == '#') { + str = pc_readaccountreg2str(sd, data->u.num);// global + } else { + str = pc_readaccountregstr(sd, data->u.num);// local + } + break; + case '.': + if (data->ref) { + str = script->get_val_ref_str(st, data->ref, data); + } else if (name[1] == '@') { + str = script->get_val_scope_str(st, &st->stack->scope, data); + } else { + str = script->get_val_npc_str(st, &st->script->local, data); + } + break; + case '\'': + str = script->get_val_instance_str(st, name, data); + break; + default: + if (data->ref) { + str = script->get_val_ref_str(st, data->ref, data); + } else { str = pc_readglobalreg_str(sd, data->u.num); - break; + } + break; } if (str == NULL || str[0] == '\0') { @@ -2906,36 +2918,48 @@ struct script_data *get_val(struct script_state* st, struct script_data* data) { data->u.num = reference_getconstant(data); } else if( reference_toparam(data) ) { data->u.num = pc->readparam(sd, reference_getparamtype(data)); - } else - switch( prefix ) { - case '@': + } else { + switch (prefix) { + case '@': + if (data->ref) { + data->u.num = script->get_val_ref_num(st, data->ref, data); + } else { data->u.num = pc->readreg(sd, data->u.num); - break; - case '$': - data->u.num = mapreg->readreg(data->u.num); - break; - case '#': - if( name[1] == '#' ) - data->u.num = pc_readaccountreg2(sd, data->u.num);// global - else - data->u.num = pc_readaccountreg(sd, data->u.num);// local - break; - case '.': - if (data->ref) - data->u.num = script->get_val_ref_num(st, data->ref, data); - else if (name[1] == '@') - data->u.num = script->get_val_scope_num(st, &st->stack->scope, data); - else - data->u.num = script->get_val_npc_num(st, &st->script->local, data); - break; - case '\'': - data->u.num = script->get_val_instance_num(st, name, data); - break; - default: + } + break; + case '$': + data->u.num = mapreg->readreg(data->u.num); + break; + case '#': + if (data->ref) { + data->u.num = script->get_val_ref_num(st, data->ref, data); + } else if (name[1] == '#') { + data->u.num = pc_readaccountreg2(sd, data->u.num);// global + } else { + data->u.num = pc_readaccountreg(sd, data->u.num);// local + } + break; + case '.': + if (data->ref) { + data->u.num = script->get_val_ref_num(st, data->ref, data); + } else if (name[1] == '@') { + data->u.num = script->get_val_scope_num(st, &st->stack->scope, data); + } else { + data->u.num = script->get_val_npc_num(st, &st->script->local, data); + } + break; + case '\'': + data->u.num = script->get_val_instance_num(st, name, data); + break; + default: + if (data->ref) { + data->u.num = script->get_val_ref_num(st, data->ref, data); + } else { data->u.num = pc_readglobalreg(sd, data->u.num); - break; + } + break; } - + } } data->ref = NULL; @@ -3108,38 +3132,43 @@ void script_array_add_member(struct script_array *sa, unsigned int idx) { **/ struct reg_db *script_array_src(struct script_state *st, struct map_session_data *sd, const char *name, struct reg_db *ref) { struct reg_db *src = NULL; - nullpo_retr(NULL, name); - switch( name[0] ) { + + switch (name[0]) { /* from player */ - default: /* char reg */ - case '@':/* temp char reg */ - case '#':/* account reg */ + default: /* char reg */ + case '@':/* temp char reg */ + case '#':/* account reg */ + if (ref != NULL) { + src = ref; + } else { nullpo_retr(NULL, sd); src = &sd->regs; - break; - case '$':/* map reg */ - src = &mapreg->regs; - break; - case '.':/* npc/script */ - if (ref != NULL) { - src = ref; - } else { - nullpo_retr(NULL, st); - src = (name[1] == '@') ? &st->stack->scope : &st->script->local; - } - break; - case '\'':/* instance */ + } + break; + case '$':/* map reg */ + src = &mapreg->regs; + break; + case '.':/* npc/script */ + if (ref != NULL) { + src = ref; + } else { nullpo_retr(NULL, st); - if( st->instance_id >= 0 ) { - src = &instance->list[st->instance_id].regs; - } - break; + src = (name[1] == '@') ? &st->stack->scope : &st->script->local; + } + break; + case '\'':/* instance */ + nullpo_retr(NULL, st); + if (st->instance_id >= 0) { + src = &instance->list[st->instance_id].regs; + } + break; } - if( src ) { - if( !src->arrays ) + if (src) { + if (!src->arrays) { src->arrays = idb_alloc(DB_OPT_BASE); + } return src; } return NULL; @@ -3292,48 +3321,65 @@ int set_reg(struct script_state *st, struct map_session_data *sd, int64 num, con return 0; } - if( is_string_variable(name) ) {// string variable + if (is_string_variable(name)) {// string variable const char *str = (const char*)value; switch (prefix) { - case '@': + case '@': + if (ref) { + script->set_reg_ref_str(st, ref, num, name, str); + } else { pc->setregstr(sd, num, str); - return 1; - case '$': - return mapreg->setregstr(num, str); - case '#': - return (name[1] == '#') ? - pc_setaccountreg2str(sd, num, str) : - pc_setaccountregstr(sd, num, str); - case '.': - if (ref) - script->set_reg_ref_str(st, ref, num, name, str); - else if (name[1] == '@') - script->set_reg_scope_str(st, &st->stack->scope, num, name, str); - else - script->set_reg_npc_str(st, &st->script->local, num, name, str); - return 1; - case '\'': - set_reg_instance_str(st, num, name, str); - return 1; - default: - return pc_setglobalreg_str(sd, num, str); + } + return 1; + case '$': + mapreg->setregstr(num, str); + return 1; + case '#': + if (ref) { + script->set_reg_ref_str(st, ref, num, name, str); + } else if (name[1] == '#') { + pc_setaccountreg2str(sd, num, str); + } else { + pc_setaccountregstr(sd, num, str); + } + return 1; + case '.': + if (ref) { + script->set_reg_ref_str(st, ref, num, name, str); + } else if (name[1] == '@') { + script->set_reg_scope_str(st, &st->stack->scope, num, name, str); + } else { + script->set_reg_npc_str(st, &st->script->local, num, name, str); + } + return 1; + case '\'': + set_reg_instance_str(st, num, name, str); + return 1; + default: + if (ref) { + script->set_reg_ref_str(st, ref, num, name, str); + } else { + pc_setglobalreg_str(sd, num, str); + } + return 1; } } else {// integer variable // FIXME: This isn't safe, in 32bits systems we're converting a 64bit pointer // to a 32bit int, this will lead to overflows! [Panikon] int val = (int)h64BPTRSIZE(value); - if(script->str_data[script_getvarid(num)].type == C_PARAM) { - if( pc->setparam(sd, script->str_data[script_getvarid(num)].val, val) == 0 ) { - if( st != NULL ) { + if (script->str_data[script_getvarid(num)].type == C_PARAM) { + if (pc->setparam(sd, script->str_data[script_getvarid(num)].val, val) == 0) { + if (st != NULL) { ShowError("script:set_reg: failed to set param '%s' to %d.\n", name, val); script->reportsrc(st); // Instead of just stop the script execution we let the character close // the window if it was open. st->state = (sd->state.dialog) ? CLOSE : END; - if( st->state == CLOSE ) + if(st->state == CLOSE) { clif->scriptclose(sd, st->oid); + } } return 0; } @@ -3341,28 +3387,44 @@ int set_reg(struct script_state *st, struct map_session_data *sd, int64 num, con } switch (prefix) { - case '@': + case '@': + if (ref) { + script->set_reg_ref_num(st, ref, num, name, val); + } else { pc->setreg(sd, num, val); - return 1; - case '$': - return mapreg->setreg(num, val); - case '#': - return (name[1] == '#') ? - pc_setaccountreg2(sd, num, val) : - pc_setaccountreg(sd, num, val); - case '.': - if (ref) - script->set_reg_ref_num(st, ref, num, name, val); - else if (name[1] == '@') - script->set_reg_scope_num(st, &st->stack->scope, num, name, val); - else - script->set_reg_npc_num(st, &st->script->local, num, name, val); - return 1; - case '\'': - set_reg_instance_num(st, num, name, val); - return 1; - default: - return pc_setglobalreg(sd, num, val); + } + return 1; + case '$': + mapreg->setreg(num, val); + return 1; + case '#': + if (ref) { + script->set_reg_ref_num(st, ref, num, name, val); + } else if (name[1] == '#') { + pc_setaccountreg2(sd, num, val); + } else { + pc_setaccountreg(sd, num, val); + } + return 1; + case '.': + if (ref) { + script->set_reg_ref_num(st, ref, num, name, val); + } else if (name[1] == '@') { + script->set_reg_scope_num(st, &st->stack->scope, num, name, val); + } else { + script->set_reg_npc_num(st, &st->script->local, num, name, val); + } + return 1; + case '\'': + set_reg_instance_num(st, num, name, val); + return 1; + default: + if (ref) { + script->set_reg_ref_num(st, ref, num, name, val); + } else { + pc_setglobalreg(sd, num, val); + } + return 1; } } } @@ -5197,7 +5259,7 @@ int script_load_translation(const char *file, uint8 lang_id) VECTOR_TRUNCATE(msgstr); continue; } - + if (strncasecmp(line, "msgid \"", 7) == 0) { VECTOR_TRUNCATE(msgid); for (i = 7; i < len - 2; i++) { @@ -6610,61 +6672,67 @@ BUILDIN(warpparty) } /*========================================== * Warpguild - [Fredzilla] - * Syntax: warpguild "mapname",x,y,Guild_ID; + * Syntax: warpguild "mapname",x,y,Guild_ID,{"from_mapname"}; *------------------------------------------*/ BUILDIN(warpguild) { struct map_session_data *sd = NULL; - struct map_session_data *pl_sd; struct guild* g; - struct s_mapiterator* iter; int type; + int i; + int16 map_id = -1; - const char* str = script_getstr(st,2); - int x = script_getnum(st,3); - int y = script_getnum(st,4); - int gid = script_getnum(st,5); + const char *str = script_getstr(st, 2); + int x = script_getnum(st, 3); + int y = script_getnum(st, 4); + int gid = script_getnum(st, 5); + + if (script_hasdata(st, 6)) { + map_id = map->mapname2mapid(script_getstr(st, 6)); + } g = guild->search(gid); - if( g == NULL ) + if (g == NULL) return true; - type = ( strcmp(str,"Random")==0 ) ? 0 - : ( strcmp(str,"SavePointAll")==0 ) ? 1 - : ( strcmp(str,"SavePoint")==0 ) ? 2 + type = (strcmp(str, "Random") == 0) ? 0 + : (strcmp(str, "SavePointAll") == 0) ? 1 + : (strcmp(str, "SavePoint") == 0) ? 2 : 3; - if( type == 2 && ( sd = script->rid2sd(st) ) == NULL ) + if (type == 2 && (sd = script->rid2sd(st)) == NULL) {// "SavePoint" uses save point of the currently attached player return true; } - iter = mapit_getallusers(); - for (pl_sd = BL_UCAST(BL_PC, mapit->first(iter)); mapit->exists(iter); pl_sd = BL_UCAST(BL_PC, mapit->next(iter))) { - if( pl_sd->status.guild_id != gid ) - continue; + for (i = 0; i < MAX_GUILD; i++) { + if (g->member[i].online && g->member[i].sd != NULL) { + struct map_session_data *pl_sd = g->member[i].sd; - switch( type ) - { + if (map_id >= 0 && map_id != pl_sd->bl.m) + continue; + + switch (type) + { case 0: // Random - if(!map->list[pl_sd->bl.m].flag.nowarp) - pc->randomwarp(pl_sd,CLR_TELEPORT); + if (!map->list[pl_sd->bl.m].flag.nowarp) + pc->randomwarp(pl_sd, CLR_TELEPORT); break; case 1: // SavePointAll - if(!map->list[pl_sd->bl.m].flag.noreturn) - pc->setpos(pl_sd,pl_sd->status.save_point.map,pl_sd->status.save_point.x,pl_sd->status.save_point.y,CLR_TELEPORT); + if (!map->list[pl_sd->bl.m].flag.noreturn) + pc->setpos(pl_sd, pl_sd->status.save_point.map, pl_sd->status.save_point.x, pl_sd->status.save_point.y, CLR_TELEPORT); break; case 2: // SavePoint - if(!map->list[pl_sd->bl.m].flag.noreturn) - pc->setpos(pl_sd,sd->status.save_point.map,sd->status.save_point.x,sd->status.save_point.y,CLR_TELEPORT); + if (!map->list[pl_sd->bl.m].flag.noreturn) + pc->setpos(pl_sd, sd->status.save_point.map, sd->status.save_point.x, sd->status.save_point.y, CLR_TELEPORT); break; case 3: // m,x,y - if(!map->list[pl_sd->bl.m].flag.noreturn && !map->list[pl_sd->bl.m].flag.nowarp) - pc->setpos(pl_sd,script->mapindexname2id(st,str),x,y,CLR_TELEPORT); + if (!map->list[pl_sd->bl.m].flag.noreturn && !map->list[pl_sd->bl.m].flag.nowarp) + pc->setpos(pl_sd, script->mapindexname2id(st, str), x, y, CLR_TELEPORT); break; + } } } - mapit->free(iter); return true; } @@ -8685,39 +8753,48 @@ BUILDIN(getguildmember) *------------------------------------------*/ BUILDIN(strcharinfo) { - int num; struct guild* g; struct party_data* p; - struct map_session_data *sd = script->rid2sd(st); - if (sd == NULL) //Avoid crashing.... + struct map_session_data *sd; + + if (script_hasdata(st, 4)) + sd = map->id2sd(script_getnum(st, 4)); + else + sd = script->rid2sd(st); + + if (sd == NULL) { + if(script_hasdata(st, 3)) { + script_pushcopy(st, 3); + } else { + script_pushconststr(st, ""); + } return true; + } - num=script_getnum(st,2); - switch(num) { - case 0: - script_pushstrcopy(st,sd->status.name); - break; - case 1: - if( ( p = party->search(sd->status.party_id) ) != NULL ) { - script_pushstrcopy(st,p->party.name); - } else { - script_pushconststr(st,""); - } - break; - case 2: - if( ( g = sd->guild ) != NULL ) { - script_pushstrcopy(st,g->name); - } else { - script_pushconststr(st,""); - } - break; - case 3: - script_pushconststr(st,map->list[sd->bl.m].name); - break; - default: - ShowWarning("buildin_strcharinfo: unknown parameter.\n"); - script_pushconststr(st,""); - break; + switch (script_getnum(st, 2)) { + case 0: + script_pushstrcopy(st, sd->status.name); + break; + case 1: + if ((p = party->search(sd->status.party_id)) != NULL) { + script_pushstrcopy(st, p->party.name); + } else { + script_pushconststr(st, ""); + } + break; + case 2: + if ((g = sd->guild) != NULL) { + script_pushstrcopy(st, g->name); + } else { + script_pushconststr(st, ""); + } + break; + case 3: + script_pushconststr(st, map->list[sd->bl.m].name); + break; + default: + ShowWarning("script:strcharinfo: unknown parameter.\n"); + script_pushconststr(st, ""); } return true; @@ -8734,41 +8811,51 @@ BUILDIN(strcharinfo) *------------------------------------------*/ BUILDIN(strnpcinfo) { - int num; char *buf,*name=NULL; - struct npc_data *nd = map->id2nd(st->oid); + struct npc_data *nd; + + if (script_hasdata(st, 4)) + nd = map->id2nd(script_getnum(st, 4)); + else + nd = map->id2nd(st->oid); + if (nd == NULL) { - script_pushconststr(st, ""); + if (script_hasdata(st, 3)) { + script_pushcopy(st, 3); + } else { + script_pushconststr(st, ""); + } return true; } - num = script_getnum(st,2); - switch(num) { - case 0: // display name + switch (script_getnum(st,2)) { + case 0: // display name + name = aStrdup(nd->name); + break; + case 1: // visible part of display name + if ((buf = strchr(nd->name,'#')) != NULL) { name = aStrdup(nd->name); - break; - case 1: // visible part of display name - if((buf = strchr(nd->name,'#')) != NULL) - { - name = aStrdup(nd->name); - name[buf - nd->name] = 0; - } else // Return the name, there is no '#' present - name = aStrdup(nd->name); - break; - case 2: // # fragment - if((buf = strchr(nd->name,'#')) != NULL) - name = aStrdup(buf+1); - break; - case 3: // unique name - name = aStrdup(nd->exname); - break; - case 4: // map name - if( nd->bl.m >= 0 ) // Only valid map indexes allowed (issue:8034) - name = aStrdup(map->list[nd->bl.m].name); - break; + name[buf - nd->name] = 0; + } else { // Return the name, there is no '#' present + name = aStrdup(nd->name); + } + break; + case 2: // # fragment + if ((buf = strchr(nd->name,'#')) != NULL) { + name = aStrdup(buf+1); + } + break; + case 3: // unique name + name = aStrdup(nd->exname); + break; + case 4: // map name + if (nd->bl.m >= 0) { // Only valid map indexes allowed (issue:8034) + name = aStrdup(map->list[nd->bl.m].name); + } + break; } - if(name) + if (name) script_pushstr(st, name); else script_pushconststr(st, ""); @@ -10733,19 +10820,29 @@ BUILDIN(donpcevent) *------------------------------------------*/ BUILDIN(addtimer) { - int tick = script_getnum(st,2); + int tick = script_getnum(st, 2); const char* event = script_getstr(st, 3); struct map_session_data *sd; script->check_event(st, event); - sd = script->rid2sd(st); - if( sd == NULL ) - return true; - if (!pc->addeventtimer(sd,tick,event)) { - ShowWarning("buildin_addtimer: Event timer is full, can't add new event timer. (cid:%d timer:%s)\n",sd->status.char_id,event); + if (script_hasdata(st, 4)) + sd = map->id2sd(script_getnum(st, 4)); + else + sd = script->rid2sd(st); + + if (sd == NULL) { + script_pushint(st, 0); + return false; + } + + if (!pc->addeventtimer(sd, tick, event)) { + ShowWarning("script:addtimer: Event timer is full, can't add new event timer. (cid:%d timer:%s)\n", sd->status.char_id, event); + script_pushint(st, 0); return false; } + + script_pushint(st, 1); return true; } /*========================================== @@ -10756,12 +10853,17 @@ BUILDIN(deltimer) struct map_session_data *sd; event=script_getstr(st, 2); - sd = script->rid2sd(st); - if( sd == NULL ) + + if (script_hasdata(st, 3)) + sd = map->id2sd(script_getnum(st, 3)); + else + sd = script->rid2sd(st); + + if (sd == NULL) return true; script->check_event(st, event); - pc->deleventtimer(sd,event); + pc->deleventtimer(sd, event); return true; } /*========================================== @@ -10772,14 +10874,198 @@ BUILDIN(addtimercount) int tick; struct map_session_data *sd; - event=script_getstr(st, 2); - tick=script_getnum(st,3); - sd = script->rid2sd(st); - if( sd == NULL ) + event = script_getstr(st, 2); + tick = script_getnum(st, 3); + + if (script_hasdata(st, 4)) + sd = map->id2sd(script_getnum(st, 4)); + else + sd = script->rid2sd(st); + + if (sd == NULL) return true; script->check_event(st, event); - pc->addeventtimercount(sd,event,tick); + pc->addeventtimercount(sd, event, tick); + return true; +} + +enum gettimer_mode { + GETTIMER_COUNT = 0, + GETTIMER_TICK_NEXT = 1, + GETTIMER_TICK_LAST = 2, +}; + +BUILDIN(gettimer) +{ + struct map_session_data *sd; + const struct TimerData *td; + int i; + int tick; + const char *event = NULL; + int val = 0; + bool first = true; + short mode = script_getnum(st, 2); + + if (script_hasdata(st, 3)) + sd = map->id2sd(script_getnum(st, 3)); + else + sd = script->rid2sd(st); + + if (script_hasdata(st, 4)) { + event = script_getstr(st, 4); + script->check_event(st, event); + } + + if (sd == NULL) { + script_pushint(st, -1); + return true; + } + + switch (mode) { + case GETTIMER_COUNT: + // get number of timers + for (i = 0; i < MAX_EVENTTIMER; i++) { + if (sd->eventtimer[i] != INVALID_TIMER) { + if (event != NULL) { + td = timer->get(sd->eventtimer[i]); + Assert_retr(false, td != NULL); + + if (strcmp((char *)(td->data), event) == 0) { + val++; + } + } else { + val++; + } + } + } + break; + case GETTIMER_TICK_NEXT: + // get the number of tick before the next timer runs + for (i = 0; i < MAX_EVENTTIMER; i++) { + if (sd->eventtimer[i] != INVALID_TIMER) { + td = timer->get(sd->eventtimer[i]); + Assert_retr(false, td != NULL); + tick = max(0, DIFF_TICK32(td->tick, timer->gettick())); + + if (event != NULL) { + if ((first == true || tick < val) && strcmp((char *)(td->data), event) == 0) { + val = tick; + first = false; + } + } else if (first == true || tick < val) { + val = tick; + first = false; + } + } + } + break; + case GETTIMER_TICK_LAST: + // get the number of ticks before the last timer runs + for (i = MAX_EVENTTIMER - 1; i >= 0; i--) { + if (sd->eventtimer[i] != INVALID_TIMER) { + td = timer->get(sd->eventtimer[i]); + Assert_retr(false, td != NULL); + tick = max(0, DIFF_TICK32(td->tick, timer->gettick())); + + if (event != NULL) { + if (strcmp((char *)(td->data), event) == 0) { + val = max(val, tick); + } + } else { + val = max(val, tick); + } + } + } + break; + } + + script_pushint(st, val); + return true; +} + +int buildin_getunits_sub(struct block_list *bl, va_list ap) +{ + struct script_state *st = va_arg(ap, struct script_state *); + struct map_session_data *sd = va_arg(ap, struct map_session_data *); + int32 id = va_arg(ap, int32); + uint32 start = va_arg(ap, uint32); + uint32 *count = va_arg(ap, uint32 *); + uint32 limit = va_arg(ap, uint32); + const char *name = va_arg(ap, const char *); + struct reg_db *ref = va_arg(ap, struct reg_db *); + uint32 index = start + *count; + + if (index >= SCRIPT_MAX_ARRAYSIZE || *count > limit) { + return 1; + } + + script->set_reg(st, sd, reference_uid(id, index), name, + (const void *)h64BPTRSIZE(bl->id), ref); + + (*count)++; + return 0; +} + +BUILDIN(getunits) +{ + const char *mapname, *name; + int16 m, x1, y1, x2, y2; + int32 id; + uint32 start; + struct reg_db *ref; + enum bl_type type = script_getnum(st, 2); + struct script_data *data = script_getdata(st, 3); + uint32 count = 0, limit = script_getnum(st, 4); + struct map_session_data *sd = NULL; + + if (!data_isreference(data) || reference_toconstant(data)) { + ShowError("script:getunits: second argument must be a variable\n"); + script->reportdata(data); + st->state = END; + return false; + } + + id = reference_getid(data); + start = reference_getindex(data); + name = reference_getname(data); + ref = reference_getref(data); + + if (not_server_variable(*name)) { + sd = script->rid2sd(st); + if (sd == NULL) { + return true; // player variable but no player attached + } + } + + if (is_string_variable(name)) { + ShowError("script:getunits: second argument must be an integer variable\n"); + script->reportdata(data); + st->state = END; + return false; + } + + if (limit < 1 || limit > SCRIPT_MAX_ARRAYSIZE) { + limit = SCRIPT_MAX_ARRAYSIZE; + } + + mapname = script_getstr(st, 5); + m = map->mapname2mapid(mapname); + + if (script_hasdata(st, 9)) { + x1 = script_getnum(st, 6); + y1 = script_getnum(st, 7); + x2 = script_getnum(st, 8); + y2 = script_getnum(st, 9); + + map->foreachinarea(buildin_getunits_sub, m, x1, y1, x2, y2, type, + st, sd, id, start, &count, limit, name, ref); + } else { + map->foreachinmap(buildin_getunits_sub, m, type, + st, sd, id, start, &count, limit, name, ref); + } + + script_pushint(st, count); return true; } @@ -11620,14 +11906,16 @@ BUILDIN(getstatus) case 3: script_pushint(st, sd->sc.data[id]->val3); break; case 4: script_pushint(st, sd->sc.data[id]->val4); break; case 5: - { - const struct TimerData *td = timer->get(sd->sc.data[id]->timer); + if (sd->sc.data[id]->infinite_duration) { + script_pushint(st, INFINITE_DURATION); + } else { + const struct TimerData *td = timer->get(sd->sc.data[id]->timer); - if (td != NULL) { - // return the amount of time remaining - script_pushint(st, (int)(td->tick - timer->gettick())); // TODO: change this to int64 when we'll support 64 bit script values + if (td != NULL) { + // return the amount of time remaining + script_pushint(st, (int)(td->tick - timer->gettick())); // TODO: change this to int64 when we'll support 64 bit script values + } } - } break; default: script_pushint(st, 1); break; } @@ -14069,15 +14357,26 @@ BUILDIN(undisguise) * Transform a bl to another class, * @type unused *------------------------------------------*/ -BUILDIN(classchange) { - int class, type; - struct block_list *bl=map->id2bl(st->oid); +BUILDIN(classchange) +{ + int class, type, target; + struct block_list *bl = map->id2bl(st->oid); - if(bl==NULL) return true; + if (bl == NULL) + return true; - class = script_getnum(st,2); - type=script_getnum(st,3); - clif->class_change(bl, class, type); + class = script_getnum(st, 2); + type = script_getnum(st, 3); + target = script_hasdata(st, 4) ? script_getnum(st, 4) : 0; + + if (target > 0) { + struct map_session_data *sd = script->charid2sd(st, target); + if (sd != NULL) { + clif->class_change(bl, class, type, sd); + } + } else { + clif->class_change(bl, class, type, NULL); + } return true; } @@ -15684,6 +15983,29 @@ BUILDIN(charat) { } //======================================================= +// chr <int> +//------------------------------------------------------- +BUILDIN(chr) +{ + char output[2]; + output[0] = script_getnum(st, 2); + output[1] = '\0'; + + script_pushstrcopy(st, output); + return true; +} + +//======================================================= +// ord <chr> +//------------------------------------------------------- +BUILDIN(ord) +{ + const char *chr = script_getstr(st, 2); + script_pushint(st, *chr); + return true; +} + +//======================================================= // setchar <string>, <char>, <index> //------------------------------------------------------- BUILDIN(setchar) @@ -17727,6 +18049,55 @@ BUILDIN(getvariableofnpc) return true; } +BUILDIN(getvariableofpc) +{ + const char* name; + struct script_data* data = script_getdata(st, 2); + struct map_session_data *sd = map->id2sd(script_getnum(st, 3)); + + if (!data_isreference(data)) { + ShowError("script:getvariableofpc: not a variable\n"); + script->reportdata(data); + script_pushnil(st); + st->state = END; + return false; + } + + name = reference_getname(data); + + switch (*name) + { + case '#': + case '$': + case '.': + case '\'': + ShowError("script:getvariableofpc: illegal scope (not pc variable)\n"); + script->reportdata(data); + script_pushnil(st); + st->state = END; + return false; + } + + if (sd == NULL) + { + // player not found, return default value + if (script_hasdata(st, 4)) { + script_pushcopy(st, 4); + } else if (is_string_variable(name)) { + script_pushconststr(st, ""); + } else { + script_pushint(st, 0); + } + return true; + } + + if (!sd->regs.vars) + sd->regs.vars = i64db_alloc(DB_OPT_RELEASE_DATA); + + script->push_val(st->stack, C_NAME, reference_getuid(data), &sd->regs); + return true; +} + /// Opens a warp portal. /// Has no "portal opening" effect/sound, it opens the portal immediately. /// @@ -21046,7 +21417,7 @@ void script_parse_builtin(void) { BUILDIN_DEF(areawarp,"siiiisii??"), BUILDIN_DEF(warpchar,"siii"), // [LuzZza] BUILDIN_DEF(warpparty,"siii?"), // [Fredzilla] [Paradox924X] - BUILDIN_DEF(warpguild,"siii"), // [Fredzilla] + BUILDIN_DEF(warpguild,"siii?"), // [Fredzilla] BUILDIN_DEF(setlook,"ii"), BUILDIN_DEF(changelook,"ii"), // Simulates but don't Store it BUILDIN_DEF2(__setr,"set","rv"), @@ -21087,8 +21458,8 @@ void script_parse_builtin(void) { BUILDIN_DEF(getguildmaster,"i"), BUILDIN_DEF(getguildmasterid,"i"), BUILDIN_DEF(getguildmember,"i?"), - BUILDIN_DEF(strcharinfo,"i"), - BUILDIN_DEF(strnpcinfo,"i"), + BUILDIN_DEF(strcharinfo,"i??"), + BUILDIN_DEF(strnpcinfo,"i??"), BUILDIN_DEF(charid2rid,"i"), BUILDIN_DEF(getequipid,"i"), BUILDIN_DEF(getequipname,"i"), @@ -21151,9 +21522,11 @@ void script_parse_builtin(void) { BUILDIN_DEF(clone,"siisi????"), BUILDIN_DEF(doevent,"s"), BUILDIN_DEF(donpcevent,"s"), - BUILDIN_DEF(addtimer,"is"), - BUILDIN_DEF(deltimer,"s"), - BUILDIN_DEF(addtimercount,"si"), + BUILDIN_DEF(addtimer,"is?"), + BUILDIN_DEF(deltimer,"s?"), + BUILDIN_DEF(addtimercount,"si?"), + BUILDIN_DEF(gettimer,"i??"), + BUILDIN_DEF(getunits,"iris????"), BUILDIN_DEF(initnpctimer,"??"), BUILDIN_DEF(stopnpctimer,"??"), BUILDIN_DEF(startnpctimer,"??"), @@ -21238,7 +21611,7 @@ void script_parse_builtin(void) { BUILDIN_DEF(getcartinventorylist,""), BUILDIN_DEF(getskilllist,""), BUILDIN_DEF(clearitem,""), - BUILDIN_DEF(classchange,"ii"), + BUILDIN_DEF(classchange,"ii?"), BUILDIN_DEF(misceffect,"i"), BUILDIN_DEF(playbgm,"s"), BUILDIN_DEF(playbgmall,"s?????"), @@ -21304,6 +21677,8 @@ void script_parse_builtin(void) { BUILDIN_DEF(getstrlen,"s"), //strlen [Valaris] BUILDIN_DEF(charisalpha,"si"), //isalpha [Valaris] BUILDIN_DEF(charat,"si"), + BUILDIN_DEF(chr,"i"), + BUILDIN_DEF(ord,"s"), BUILDIN_DEF(setchar,"ssi"), BUILDIN_DEF(insertchar,"ssi"), BUILDIN_DEF(delchar,"si"), @@ -21388,6 +21763,7 @@ void script_parse_builtin(void) { BUILDIN_DEF(sleep2,"i"), BUILDIN_DEF(awake,"s"), BUILDIN_DEF(getvariableofnpc,"rs"), + BUILDIN_DEF(getvariableofpc,"ri?"), BUILDIN_DEF(warpportal,"iisii"), BUILDIN_DEF2(homunculus_evolution,"homevolution",""), //[orn] BUILDIN_DEF2(homunculus_mutate,"hommutate","?"), @@ -21714,6 +22090,20 @@ void script_hardcoded_constants(void) script->set_constant("NAV_KAFRA_AND_SCROLL", NAV_KAFRA_AND_SCROLL, false, false); script->set_constant("NAV_ALL", NAV_ALL, false, false); + script->constdb_comment("BL types"); + script->set_constant("BL_PC",BL_PC,false, false); + script->set_constant("BL_MOB",BL_MOB,false, false); + script->set_constant("BL_PET",BL_PET,false, false); + script->set_constant("BL_HOM",BL_HOM,false, false); + script->set_constant("BL_MER",BL_MER,false, false); + script->set_constant("BL_ITEM",BL_ITEM,false, false); + script->set_constant("BL_SKILL",BL_SKILL,false, false); + script->set_constant("BL_NPC",BL_NPC,false, false); + script->set_constant("BL_CHAT",BL_CHAT,false, false); + script->set_constant("BL_ELEM",BL_ELEM,false, false); + script->set_constant("BL_CHAR",BL_CHAR,false, false); + script->set_constant("BL_ALL",BL_ALL,false, false); + script->constdb_comment("Renewal"); #ifdef RENEWAL script->set_constant("RENEWAL", 1, false, false); diff --git a/src/map/skill.c b/src/map/skill.c index 51a8a28e7..70db5b341 100644 --- a/src/map/skill.c +++ b/src/map/skill.c @@ -2,7 +2,7 @@ * This file is part of Hercules. * http://herc.ws - http://github.com/HerculesWS/Hercules * - * Copyright (C) 2012-2016 Hercules Dev Team + * Copyright (C) 2012-2017 Hercules Dev Team * Copyright (C) Athena Dev Teams * * Hercules is free software: you can redistribute it and/or modify @@ -7470,8 +7470,8 @@ int skill_castend_nodamage_id(struct block_list *src, struct block_list *bl, uin case NPC_LICK: status_zap(bl, 0, 100); - clif->skill_nodamage(src,bl,skill_id,skill_lv, - sc_start(src,bl,type,(skill_lv*5),skill_lv,skill->get_time2(skill_id,skill_lv))); + clif->skill_nodamage(src, bl, skill_id, skill_lv, + sc_start(src, bl, type, (skill_lv * 20), skill_lv, skill->get_time2(skill_id, skill_lv))); break; case NPC_SUICIDE: @@ -8181,8 +8181,14 @@ int skill_castend_nodamage_id(struct block_list *src, struct block_list *bl, uin int x,y; x = src->x; y = src->y; - if (hd) - skill->blockhomun_start(hd, skill_id, skill->get_time2(skill_id,skill_lv)); + if (hd) { +#ifdef RENEWAL + skill->blockhomun_start(hd, skill_id, skill->get_cooldown(skill_id, skill_lv)); +#else + skill->blockhomun_start(hd, skill_id, skill->get_time2(skill_id, skill_lv)); +#endif + } + if (unit->movepos(src,bl->x,bl->y,0,0)) { clif->skill_nodamage(src,src,skill_id,skill_lv,1); // Homun diff --git a/src/map/unit.c b/src/map/unit.c index feb11f89e..7d68bef66 100644 --- a/src/map/unit.c +++ b/src/map/unit.c @@ -668,11 +668,12 @@ void unit_run_hit(struct block_list *bl, struct status_change *sc, struct map_se ud->state.running = 0; status_change_end(bl, type, INVALID_TIMER); - if( type == SC_RUN ) { - skill->blown(bl,bl,skill->get_blewcount(TK_RUN,lv),unit->getdir(bl),0); + if (type == SC_RUN) { + if (lv > 0) + skill->blown(bl, bl, skill->get_blewcount(TK_RUN, lv), unit->getdir(bl), 0); clif->fixpos(bl); //Why is a clif->slide (skill->blown) AND a fixpos needed? Ask Aegis. - clif->sc_end(bl,bl->id,AREA,SI_TING); - } else if( sd ) { + clif->sc_end(bl, bl->id, AREA, SI_TING); + } else if (sd) { clif->fixpos(bl); skill->castend_damage_id(bl, &sd->bl, RA_WUGDASH, lv, timer->gettick(), SD_LEVEL); } diff --git a/src/plugins/HPMHooking/HPMHooking.Defs.inc b/src/plugins/HPMHooking/HPMHooking.Defs.inc index 74af2f26d..8f53dbb1e 100644 --- a/src/plugins/HPMHooking/HPMHooking.Defs.inc +++ b/src/plugins/HPMHooking/HPMHooking.Defs.inc @@ -396,8 +396,8 @@ typedef int (*HPMHOOK_pre_chr_rename_char_sql) (struct char_session_data **sd, i typedef int (*HPMHOOK_post_chr_rename_char_sql) (int retVal___, struct char_session_data *sd, int char_id); typedef int (*HPMHOOK_pre_chr_check_char_name) (char **name, char **esc_name); typedef int (*HPMHOOK_post_chr_check_char_name) (int retVal___, char *name, char *esc_name); -typedef int (*HPMHOOK_pre_chr_make_new_char_sql) (struct char_session_data **sd, const char **name_, int *str, int *agi, int *vit, int *int_, int *dex, int *luk, int *slot, int *hair_color, int *hair_style, short *starting_job); -typedef int (*HPMHOOK_post_chr_make_new_char_sql) (int retVal___, struct char_session_data *sd, const char *name_, int str, int agi, int vit, int int_, int dex, int luk, int slot, int hair_color, int hair_style, short starting_job); +typedef int (*HPMHOOK_pre_chr_make_new_char_sql) (struct char_session_data **sd, const char **name_, int *str, int *agi, int *vit, int *int_, int *dex, int *luk, int *slot, int *hair_color, int *hair_style, short *starting_job, uint8 *sex); +typedef int (*HPMHOOK_post_chr_make_new_char_sql) (int retVal___, struct char_session_data *sd, const char *name_, int str, int agi, int vit, int int_, int dex, int luk, int slot, int hair_color, int hair_style, short starting_job, uint8 sex); typedef int (*HPMHOOK_pre_chr_divorce_char_sql) (int *partner_id1, int *partner_id2); typedef int (*HPMHOOK_post_chr_divorce_char_sql) (int retVal___, int partner_id1, int partner_id2); typedef int (*HPMHOOK_pre_chr_count_users) (void); @@ -974,8 +974,8 @@ typedef void (*HPMHOOK_pre_clif_refreshlook) (struct block_list **bl, int *id, i typedef void (*HPMHOOK_post_clif_refreshlook) (struct block_list *bl, int id, int type, int val, enum send_target target); typedef void (*HPMHOOK_pre_clif_sendlook) (struct block_list **bl, int *id, int *type, int *val, int *val2, enum send_target *target); typedef void (*HPMHOOK_post_clif_sendlook) (struct block_list *bl, int id, int type, int val, int val2, enum send_target target); -typedef void (*HPMHOOK_pre_clif_class_change) (struct block_list **bl, int *class_, int *type); -typedef void (*HPMHOOK_post_clif_class_change) (struct block_list *bl, int class_, int type); +typedef void (*HPMHOOK_pre_clif_class_change) (struct block_list **bl, int *class_, int *type, struct map_session_data **sd); +typedef void (*HPMHOOK_post_clif_class_change) (struct block_list *bl, int class_, int type, struct map_session_data *sd); typedef void (*HPMHOOK_pre_clif_skill_delunit) (struct skill_unit **su); typedef void (*HPMHOOK_post_clif_skill_delunit) (struct skill_unit *su); typedef void (*HPMHOOK_pre_clif_skillunit_update) (struct block_list **bl); diff --git a/src/plugins/HPMHooking/HPMHooking_char.Hooks.inc b/src/plugins/HPMHooking/HPMHooking_char.Hooks.inc index e2108c8f8..3942693da 100644 --- a/src/plugins/HPMHooking/HPMHooking_char.Hooks.inc +++ b/src/plugins/HPMHooking/HPMHooking_char.Hooks.inc @@ -744,15 +744,15 @@ int HP_chr_check_char_name(char *name, char *esc_name) { } return retVal___; } -int HP_chr_make_new_char_sql(struct char_session_data *sd, const char *name_, int str, int agi, int vit, int int_, int dex, int luk, int slot, int hair_color, int hair_style, short starting_job) { +int HP_chr_make_new_char_sql(struct char_session_data *sd, const char *name_, int str, int agi, int vit, int int_, int dex, int luk, int slot, int hair_color, int hair_style, short starting_job, uint8 sex) { int hIndex = 0; int retVal___ = 0; if( HPMHooks.count.HP_chr_make_new_char_sql_pre ) { - int (*preHookFunc) (struct char_session_data **sd, const char **name_, int *str, int *agi, int *vit, int *int_, int *dex, int *luk, int *slot, int *hair_color, int *hair_style, short *starting_job); + int (*preHookFunc) (struct char_session_data **sd, const char **name_, int *str, int *agi, int *vit, int *int_, int *dex, int *luk, int *slot, int *hair_color, int *hair_style, short *starting_job, uint8 *sex); *HPMforce_return = false; for(hIndex = 0; hIndex < HPMHooks.count.HP_chr_make_new_char_sql_pre; hIndex++ ) { preHookFunc = HPMHooks.list.HP_chr_make_new_char_sql_pre[hIndex].func; - retVal___ = preHookFunc(&sd, &name_, &str, &agi, &vit, &int_, &dex, &luk, &slot, &hair_color, &hair_style, &starting_job); + retVal___ = preHookFunc(&sd, &name_, &str, &agi, &vit, &int_, &dex, &luk, &slot, &hair_color, &hair_style, &starting_job, &sex); } if( *HPMforce_return ) { *HPMforce_return = false; @@ -760,13 +760,13 @@ int HP_chr_make_new_char_sql(struct char_session_data *sd, const char *name_, in } } { - retVal___ = HPMHooks.source.chr.make_new_char_sql(sd, name_, str, agi, vit, int_, dex, luk, slot, hair_color, hair_style, starting_job); + retVal___ = HPMHooks.source.chr.make_new_char_sql(sd, name_, str, agi, vit, int_, dex, luk, slot, hair_color, hair_style, starting_job, sex); } if( HPMHooks.count.HP_chr_make_new_char_sql_post ) { - int (*postHookFunc) (int retVal___, struct char_session_data *sd, const char *name_, int str, int agi, int vit, int int_, int dex, int luk, int slot, int hair_color, int hair_style, short starting_job); + int (*postHookFunc) (int retVal___, struct char_session_data *sd, const char *name_, int str, int agi, int vit, int int_, int dex, int luk, int slot, int hair_color, int hair_style, short starting_job, uint8 sex); for(hIndex = 0; hIndex < HPMHooks.count.HP_chr_make_new_char_sql_post; hIndex++ ) { postHookFunc = HPMHooks.list.HP_chr_make_new_char_sql_post[hIndex].func; - retVal___ = postHookFunc(retVal___, sd, name_, str, agi, vit, int_, dex, luk, slot, hair_color, hair_style, starting_job); + retVal___ = postHookFunc(retVal___, sd, name_, str, agi, vit, int_, dex, luk, slot, hair_color, hair_style, starting_job, sex); } } return retVal___; diff --git a/src/plugins/HPMHooking/HPMHooking_map.Hooks.inc b/src/plugins/HPMHooking/HPMHooking_map.Hooks.inc index b24c7d315..322d60e46 100644 --- a/src/plugins/HPMHooking/HPMHooking_map.Hooks.inc +++ b/src/plugins/HPMHooking/HPMHooking_map.Hooks.inc @@ -7917,14 +7917,14 @@ void HP_clif_sendlook(struct block_list *bl, int id, int type, int val, int val2 } return; } -void HP_clif_class_change(struct block_list *bl, int class_, int type) { +void HP_clif_class_change(struct block_list *bl, int class_, int type, struct map_session_data *sd) { int hIndex = 0; if( HPMHooks.count.HP_clif_class_change_pre ) { - void (*preHookFunc) (struct block_list **bl, int *class_, int *type); + void (*preHookFunc) (struct block_list **bl, int *class_, int *type, struct map_session_data **sd); *HPMforce_return = false; for(hIndex = 0; hIndex < HPMHooks.count.HP_clif_class_change_pre; hIndex++ ) { preHookFunc = HPMHooks.list.HP_clif_class_change_pre[hIndex].func; - preHookFunc(&bl, &class_, &type); + preHookFunc(&bl, &class_, &type, &sd); } if( *HPMforce_return ) { *HPMforce_return = false; @@ -7932,13 +7932,13 @@ void HP_clif_class_change(struct block_list *bl, int class_, int type) { } } { - HPMHooks.source.clif.class_change(bl, class_, type); + HPMHooks.source.clif.class_change(bl, class_, type, sd); } if( HPMHooks.count.HP_clif_class_change_post ) { - void (*postHookFunc) (struct block_list *bl, int class_, int type); + void (*postHookFunc) (struct block_list *bl, int class_, int type, struct map_session_data *sd); for(hIndex = 0; hIndex < HPMHooks.count.HP_clif_class_change_post; hIndex++ ) { postHookFunc = HPMHooks.list.HP_clif_class_change_post[hIndex].func; - postHookFunc(bl, class_, type); + postHookFunc(bl, class_, type, sd); } } return; |