summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/char/char.c44
-rw-r--r--src/char/char.h2
-rw-r--r--src/char/int_party.c34
-rw-r--r--src/common/mmo.h10
-rw-r--r--src/common/strlib.c1
-rw-r--r--src/map/atcommand.c30
-rw-r--r--src/map/battle.c31
-rw-r--r--src/map/battle.h1
-rw-r--r--src/map/clif.c50
-rw-r--r--src/map/clif.h3
-rw-r--r--src/map/mob.c2
-rw-r--r--src/map/packets_struct.h17
-rw-r--r--src/map/party.c42
-rw-r--r--src/map/pc.c1
-rw-r--r--src/map/script.c778
-rw-r--r--src/map/skill.c16
-rw-r--r--src/map/unit.c9
-rw-r--r--src/plugins/HPMHooking/HPMHooking.Defs.inc8
-rw-r--r--src/plugins/HPMHooking/HPMHooking_char.Hooks.inc12
-rw-r--r--src/plugins/HPMHooking/HPMHooking_map.Hooks.inc12
20 files changed, 775 insertions, 328 deletions
diff --git a/src/char/char.c b/src/char/char.c
index 9314e8c81..f47a8cc3c 100644
--- a/src/char/char.c
+++ b/src/char/char.c
@@ -1544,7 +1544,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];
@@ -1587,17 +1587,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
@@ -1647,7 +1647,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;
}
@@ -4633,13 +4633,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)
@@ -5042,7 +5054,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..921bf6d9d 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.
diff --git a/src/common/mmo.h b/src/common/mmo.h
index 9c29b8a0e..16bc978bf 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 c2e35842b..827042cce 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);
-
- 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
+ int t_guild = status->get_guild_id(t_bl);
+
+ if (s_party && s_party == status->get_party_id(t_bl)) {
+ if (map_flag_gvg(m) && map->list[m].flag.gvg_noparty && !(s_guild && s_guild == t_guild)) {
+ if (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);
@@ -7322,6 +7331,7 @@ static const struct battle_data {
{ "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
/**
@@ -7600,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 1a9b83111..4665847ff 100644
--- a/src/map/battle.h
+++ b/src/map/battle.h
@@ -549,6 +549,7 @@ struct Battle_Config {
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 c48241898..9e20510ad 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);
diff --git a/src/map/clif.h b/src/map/clif.h
index b27adb5be..c3a42372a 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_struct.h b/src/map/packets_struct.h
index e461eebe9..71a6bfd6e 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,
@@ -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 837438b3d..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.
*
diff --git a/src/map/script.c b/src/map/script.c
index 38931bd11..25f520450 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, "");
@@ -10704,19 +10791,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;
}
/*==========================================
@@ -10727,12 +10824,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;
}
/*==========================================
@@ -10743,14 +10845,113 @@ 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;
}
@@ -11591,14 +11792,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;
}
@@ -13840,15 +14043,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;
}
@@ -15455,6 +15669,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)
@@ -17498,6 +17735,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.
///
@@ -20817,7 +21103,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"),
@@ -20858,8 +21144,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"),
@@ -20922,9 +21208,10 @@ 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(initnpctimer,"??"),
BUILDIN_DEF(stopnpctimer,"??"),
BUILDIN_DEF(startnpctimer,"??"),
@@ -21009,7 +21296,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?????"),
@@ -21075,6 +21362,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"),
@@ -21155,6 +21444,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","?"),
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 57abf25e0..02af6e231 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 654c902d8..800fb8c76 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;