diff options
Diffstat (limited to 'src/map')
-rw-r--r-- | src/map/atcommand.c | 20 | ||||
-rw-r--r-- | src/map/battle.c | 36 | ||||
-rw-r--r-- | src/map/battle.h | 3 | ||||
-rw-r--r-- | src/map/clif.c | 224 | ||||
-rw-r--r-- | src/map/clif.h | 4 | ||||
-rw-r--r-- | src/map/guild.c | 3 | ||||
-rw-r--r-- | src/map/guild.h | 2 | ||||
-rw-r--r-- | src/map/intif.c | 6 | ||||
-rw-r--r-- | src/map/map.c | 7 | ||||
-rw-r--r-- | src/map/map.h | 3 | ||||
-rw-r--r-- | src/map/mob.c | 5 | ||||
-rw-r--r-- | src/map/mob.h | 8 | ||||
-rw-r--r-- | src/map/npc.c | 28 | ||||
-rw-r--r-- | src/map/npc.h | 3 | ||||
-rw-r--r-- | src/map/packets.h | 220 | ||||
-rw-r--r-- | src/map/packets_keys.h | 35 | ||||
-rw-r--r-- | src/map/packets_struct.h | 23 | ||||
-rw-r--r-- | src/map/party.c | 5 | ||||
-rw-r--r-- | src/map/pc.c | 104 | ||||
-rw-r--r-- | src/map/pc.h | 14 | ||||
-rw-r--r-- | src/map/rodex.c | 11 | ||||
-rw-r--r-- | src/map/rodex.h | 2 | ||||
-rw-r--r-- | src/map/script.c | 315 | ||||
-rw-r--r-- | src/map/script.h | 3 | ||||
-rw-r--r-- | src/map/skill.c | 7 | ||||
-rw-r--r-- | src/map/status.c | 12 | ||||
-rw-r--r-- | src/map/status.h | 6 | ||||
-rw-r--r-- | src/map/unit.c | 2 |
28 files changed, 885 insertions, 226 deletions
diff --git a/src/map/atcommand.c b/src/map/atcommand.c index 7b2c0f8b2..d9f4810ee 100644 --- a/src/map/atcommand.c +++ b/src/map/atcommand.c @@ -3908,6 +3908,8 @@ ACMD(mapinfo) strcat(atcmd_output, msg_fd(fd,1096)); // PartyLock | if (map->list[m_id].flag.guildlock) strcat(atcmd_output, msg_fd(fd,1097)); // GuildLock | + if (map->list[m_id].flag.noautoloot) + strcat(atcmd_output, msg_fd(fd, 1063)); // NoAutoloot | if (map->list[m_id].flag.noviewid != EQP_NONE) strcat(atcmd_output, msg_fd(fd,1079)); // NoViewID | clif->message(fd, atcmd_output); @@ -4866,21 +4868,19 @@ ACMD(undisguiseguild) *------------------------------------------*/ ACMD(exp) { - char output[CHAT_SIZE_MAX]; - double nextb, nextj; - - memset(output, '\0', sizeof(output)); + double percentb = 0.0, percentj = 0.0; + uint64 nextb, nextj; nextb = pc->nextbaseexp(sd); - if (nextb) - nextb = sd->status.base_exp*100.0/nextb; + if (nextb != 0) + percentb = sd->status.base_exp * 100.0 / nextb; nextj = pc->nextjobexp(sd); - if (nextj) - nextj = sd->status.job_exp*100.0/nextj; + if (nextj != 0) + percentj = sd->status.job_exp * 100.0 / nextj; - sprintf(output, msg_fd(fd,1148), sd->status.base_level, nextb, sd->status.job_level, nextj); // Base Level: %d (%.3f%%) | Job Level: %d (%.3f%%) - clif->message(fd, output); + sprintf(atcmd_output, msg_fd(fd,1148), sd->status.base_level, percentb, sd->status.job_level, percentj); // Base Level: %d (%.3f%%) | Job Level: %d (%.3f%%) + clif->message(fd, atcmd_output); return true; } diff --git a/src/map/battle.c b/src/map/battle.c index 2861599b8..8983e93c9 100644 --- a/src/map/battle.c +++ b/src/map/battle.c @@ -993,11 +993,7 @@ int64 battle_calc_cardfix2(struct block_list *src, struct block_list *bl, int64 // FIXME: wflag is undocumented int64 battle_calc_cardfix(int attack_type, struct block_list *src, struct block_list *target, int nk, int s_ele, int s_ele_, int64 damage, int cflag, int wflag){ struct map_session_data *sd, *tsd; -#ifdef RENEWAL - short cardfix = 100; -#else - short cardfix = 1000; -#endif + int cardfix = 1000; short t_class, s_class, s_race2, t_race2; struct status_data *sstatus, *tstatus; int i; @@ -1073,24 +1069,14 @@ int64 battle_calc_cardfix(int attack_type, struct block_list *src, struct block_ if( tsd->sc.data[SC_PROTECT_MDEF] ) cardfix = cardfix * ( 100 - tsd->sc.data[SC_PROTECT_MDEF]->val1 ) / 100; } -#ifdef RENEWAL - if ( cardfix != 100 ) - damage += damage * (cardfix - 100) / 100; -#else if ( cardfix != 1000 ) damage = damage * cardfix / 1000; -#endif break; case BF_WEAPON: t_race2 = status->get_race2(target); if( cflag&2 ){ if( sd && !(nk&NK_NO_CARDFIX_ATK) ){ - short cardfix_ = -#ifdef RENEWAL - 100; -#else - 1000; -#endif + int cardfix_ = 1000; if( sd->state.arrow_atk ){ cardfix = cardfix * (100 + sd->right_weapon.addrace[tstatus->race] + sd->arrow_addrace[tstatus->race]) / 100; if( !(nk&NK_NO_ELEFIX) ){ @@ -1190,16 +1176,11 @@ int64 battle_calc_cardfix(int attack_type, struct block_list *src, struct block_ #ifndef RENEWAL if( wflag&BF_LONG ) cardfix = cardfix * (100 + sd->bonus.long_attack_atk_rate) / 100; +#endif if( (cflag&1) && cardfix_ != 1000 ) damage = damage * cardfix_ / 1000; else if( cardfix != 1000 ) damage = damage * cardfix / 1000; -#else - if ((cflag & 1) && cardfix_ != 100) - damage += damage * (cardfix_ - 100) / 100; - else if (cardfix != 100) - damage += damage * (cardfix - 100) / 100; -#endif } }else{ // Target side @@ -1249,13 +1230,8 @@ int64 battle_calc_cardfix(int attack_type, struct block_list *src, struct block_ #endif if( tsd->sc.data[SC_PROTECT_DEF] ) cardfix = cardfix * (100 - tsd->sc.data[SC_PROTECT_DEF]->val1) / 100; -#ifdef RENEWAL - if ( cardfix != 100 ) - damage += damage * (cardfix - 100) / 100; -#else if( cardfix != 1000 ) damage = damage * cardfix / 1000; -#endif } } break; @@ -1287,13 +1263,8 @@ int64 battle_calc_cardfix(int attack_type, struct block_list *src, struct block_ cardfix = cardfix*(100 - tsd->subsize[sstatus->size]) / 100; cardfix = cardfix*(100 - tsd->subrace2[s_race2]) / 100; cardfix = cardfix * (100 - tsd->bonus.misc_def_rate) / 100; -#ifdef RENEWAL - if ( cardfix != 100 ) - damage += damage * (cardfix - 100) / 100; -#else if ( cardfix != 1000 ) damage = damage * cardfix / 1000; -#endif } break; } @@ -7096,6 +7067,7 @@ static const struct battle_data { { "vending_over_max", &battle_config.vending_over_max, 1, 0, 1, }, { "show_steal_in_same_party", &battle_config.show_steal_in_same_party, 0, 0, 1, }, { "party_hp_mode", &battle_config.party_hp_mode, 0, 0, 1, }, + { "party_change_leader_same_map", &battle_config.party_change_leader_same_map, 0, 0, 1, }, { "show_party_share_picker", &battle_config.party_show_share_picker, 1, 0, 1, }, { "show_picker_item_type", &battle_config.show_picker_item_type, 112, 0, INT_MAX, }, { "party_update_interval", &battle_config.party_update_interval, 1000, 100, INT_MAX, }, diff --git a/src/map/battle.h b/src/map/battle.h index e6129ca7c..4a63887c4 100644 --- a/src/map/battle.h +++ b/src/map/battle.h @@ -298,6 +298,7 @@ struct Battle_Config { int show_steal_in_same_party; int party_share_type; int party_hp_mode; + int party_change_leader_same_map; int party_show_share_picker; int show_picker_item_type; int attack_attr_none; @@ -545,7 +546,7 @@ 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 diff --git a/src/map/clif.c b/src/map/clif.c index de0f0573f..4dc36be6d 100644 --- a/src/map/clif.c +++ b/src/map/clif.c @@ -293,7 +293,11 @@ unsigned char clif_bl_type(struct block_list *bl) case BL_NPC: vd = status->get_viewdata(bl); nullpo_retr(CLUT_NPC, vd); +#if PACKETVER >= 20170726 + return CLUT_EVENT; +#else return pc->db_checkid(vd->class) ? CLUT_PC : CLUT_EVENT; +#endif case BL_PET: vd = status->get_viewdata(bl); nullpo_retr(CLUT_NPC, vd); @@ -1067,14 +1071,17 @@ void clif_set_unit_idle(struct block_list* bl, struct map_session_data *tsd, enu #endif #if PACKETVER >= 20120221 if (battle_config.show_monster_hp_bar && bl->type == BL_MOB && status_get_hp(bl) < status_get_max_hp(bl)) { - const struct mob_data *md = BL_UCCAST(BL_MOB, bl); p.maxHP = status_get_max_hp(bl); p.HP = status_get_hp(bl); - p.isBoss = (md->spawn != NULL && md->spawn->state.boss) ? 1 : 0; } else { p.maxHP = -1; p.HP = -1; - p.isBoss = 0; + } + if (bl->type == BL_MOB) { + const struct mob_data *md = BL_UCCAST(BL_MOB, bl); + p.isBoss = (md->spawn != NULL) ? md->spawn->state.boss : BTYPE_NONE; + } else { + p.isBoss = BTYPE_NONE; } #endif #if PACKETVER >= 20150513 @@ -1216,14 +1223,17 @@ void clif_spawn_unit(struct block_list* bl, enum send_target target) { #endif #if PACKETVER >= 20120221 if (battle_config.show_monster_hp_bar && bl->type == BL_MOB && status_get_hp(bl) < status_get_max_hp(bl)) { - const struct mob_data *md = BL_UCCAST(BL_MOB, bl); p.maxHP = status_get_max_hp(bl); p.HP = status_get_hp(bl); - p.isBoss = (md->spawn != NULL && md->spawn->state.boss) ? 1 : 0; } else { p.maxHP = -1; p.HP = -1; - p.isBoss = 0; + } + if (bl->type == BL_MOB) { + const struct mob_data *md = BL_UCCAST(BL_MOB, bl); + p.isBoss = (md->spawn != NULL) ? md->spawn->state.boss : BTYPE_NONE; + } else { + p.isBoss = BTYPE_NONE; } #endif #if PACKETVER >= 20150513 @@ -1315,14 +1325,17 @@ void clif_set_unit_walking(struct block_list* bl, struct map_session_data *tsd, #endif #if PACKETVER >= 20120221 if (battle_config.show_monster_hp_bar && bl->type == BL_MOB && status_get_hp(bl) < status_get_max_hp(bl)) { - const struct mob_data *md = BL_UCCAST(BL_MOB, bl); p.maxHP = status_get_max_hp(bl); p.HP = status_get_hp(bl); - p.isBoss = (md->spawn != NULL && md->spawn->state.boss) ? 1 : 0; } else { p.maxHP = -1; p.HP = -1; - p.isBoss = 0; + } + if (bl->type == BL_MOB) { + const struct mob_data *md = BL_UCCAST(BL_MOB, bl); + p.isBoss = (md->spawn != NULL) ? md->spawn->state.boss : BTYPE_NONE; + } else { + p.isBoss = BTYPE_NONE; } #endif #if PACKETVER >= 20150513 @@ -3033,27 +3046,50 @@ void clif_updatestatus(struct map_session_data *sd,int type) WFIFOL(fd,4)=sd->status.zeny; len = packet_len(0xb1); break; +// [4144] unconfirment exact version can be from 20170405 to 20170913 +#if PACKETVER >= 20170830 case SP_BASEEXP: - WFIFOW(fd,0)=0xb1; - WFIFOL(fd,4)=(uint32)(sd->status.base_exp); + WFIFOW(fd, 0) = 0xacb; + WFIFOQ(fd, 4) = sd->status.base_exp; + len = packet_len(0xacb); + break; + case SP_JOBEXP: + WFIFOW(fd, 0) = 0xacb; + WFIFOQ(fd, 4) = sd->status.job_exp; + len = packet_len(0xacb); + break; + case SP_NEXTBASEEXP: + WFIFOW(fd, 0) = 0xacb; + WFIFOQ(fd, 4) = pc->nextbaseexp(sd); + len = packet_len(0xacb); + break; + case SP_NEXTJOBEXP: + WFIFOW(fd, 0) = 0xacb; + WFIFOQ(fd, 4) = pc->nextjobexp(sd); + len = packet_len(0xacb); + break; +#else + case SP_BASEEXP: + WFIFOW(fd, 0) = 0xb1; + WFIFOL(fd, 4) = (uint32)(sd->status.base_exp); len = packet_len(0xb1); break; case SP_JOBEXP: - WFIFOW(fd,0)=0xb1; - WFIFOL(fd,4)=(uint32)(sd->status.job_exp); + WFIFOW(fd, 0) = 0xb1; + WFIFOL(fd, 4) = (uint32)(sd->status.job_exp); len = packet_len(0xb1); break; case SP_NEXTBASEEXP: - WFIFOW(fd,0)=0xb1; - WFIFOL(fd,4)=pc->nextbaseexp(sd); + WFIFOW(fd, 0) = 0xb1; + WFIFOL(fd, 4) = (uint32)pc->nextbaseexp(sd); len = packet_len(0xb1); break; case SP_NEXTJOBEXP: - WFIFOW(fd,0)=0xb1; - WFIFOL(fd,4)=pc->nextjobexp(sd); + WFIFOW(fd, 0) = 0xb1; + WFIFOL(fd, 4) = (uint32)pc->nextjobexp(sd); len = packet_len(0xb1); break; - +#endif /** * SP_U<STAT> are used to update the amount of points necessary to increase that stat **/ @@ -3309,17 +3345,22 @@ void clif_changelook(struct block_list *bl,int type,int val) #if PACKETVER < 4 clif->sendlook(bl, bl->id, type, val, 0, target); #else - if(type == LOOK_WEAPON || type == LOOK_SHIELD) { - nullpo_retv(vd); - type = LOOK_WEAPON; - val = vd->weapon; - val2 = vd->shield; - } - if (clif->isdisguised(bl)) { - clif->sendlook(bl, bl->id, type, val, val2, AREA_WOS); - clif->sendlook(bl, -bl->id, type, val, val2, SELF); + if (bl->type != BL_NPC) { + if(type == LOOK_WEAPON || type == LOOK_SHIELD) { + nullpo_retv(vd); + type = LOOK_WEAPON; + val = vd->weapon; + val2 = vd->shield; + } + if (clif->isdisguised(bl)) { + clif->sendlook(bl, bl->id, type, val, val2, AREA_WOS); + clif->sendlook(bl, -bl->id, type, val, val2, SELF); + } else { + clif->sendlook(bl, bl->id, type, val, val2, target); + } } else { - clif->sendlook(bl, bl->id, type, val, val2, target); + struct npc_data *nd = BL_UCAST(BL_NPC, bl); + npc->refresh(nd); } #endif } @@ -14027,7 +14068,7 @@ void clif_parse_NoviceExplosionSpirits(int fd, struct map_session_data *sd) /* it sends the request when the criteria doesn't match (and of course we let it fail) */ /* so restoring the old parse_globalmes method. */ if ((sd->job & MAPID_UPPERMASK) == MAPID_SUPER_NOVICE) { - unsigned int next = pc->nextbaseexp(sd); + uint64 next = pc->nextbaseexp(sd); if( next == 0 ) next = pc->thisbaseexp(sd); if( next ) { int percent = (int)( ( (float)sd->status.base_exp/(float)next )*1000. ); @@ -16697,20 +16738,34 @@ void clif_party_show_picker(struct map_session_data * sd, struct item * item_dat /// exp type: /// 0 = normal exp gain/loss /// 1 = quest exp gain/loss -void clif_displayexp(struct map_session_data *sd, unsigned int exp, char type, bool is_quest) { +void clif_displayexp(struct map_session_data *sd, uint64 exp, char type, bool is_quest) +{ int fd; +// [4144] unconfirment exact version can be from 20170405 to 20170913 +#if PACKETVER >= 20170830 + const int cmd = 0xacc; +#else + const int cmd = 0x7f6; +#endif nullpo_retv(sd); fd = sd->fd; - WFIFOHEAD(fd, packet_len(0x7f6)); - WFIFOW(fd,0) = 0x7f6; - WFIFOL(fd,2) = sd->bl.id; - WFIFOL(fd,6) = exp; - WFIFOW(fd,10) = type; - WFIFOW(fd,12) = is_quest?1:0;// Normal exp is shown in yellow, quest exp is shown in purple. - WFIFOSET(fd,packet_len(0x7f6)); + WFIFOHEAD(fd, packet_len(cmd)); + WFIFOW(fd, 0) = cmd; + WFIFOL(fd, 2) = sd->bl.id; +// [4144] unconfirment exact version can be from 20170405 to 20170913 +#if PACKETVER >= 20170830 + WFIFOQ(fd, 6) = exp; + WFIFOW(fd, 14) = type; + WFIFOW(fd, 16) = is_quest ? 1 : 0; // Normal exp is shown in yellow, quest exp is shown in purple. +#else + WFIFOL(fd, 6) = (uint32)exp; + WFIFOW(fd, 10) = type; + WFIFOW(fd, 12) = is_quest ? 1 : 0; // Normal exp is shown in yellow, quest exp is shown in purple. +#endif + WFIFOSET(fd, packet_len(cmd)); } /// Displays digital clock digits on top of the screen (ZC_SHOWDIGIT). @@ -19433,8 +19488,9 @@ void clif_rodex_send_maillist(int fd, struct map_session_data *sd, int8 open_typ WFIFOHEAD(fd, sizeof(*packet) + (sizeof(*inner) + RODEX_TITLE_LENGTH) * RODEX_MAIL_PER_PAGE); packet = WFIFOP(fd, 0); packet->PacketType = ((page_start == (VECTOR_LENGTH(sd->rodex.messages) - 1)) ? rodexmailList : rodexnextpage); +#if PACKETVER < 20170419 packet->opentype = open_type; - +#endif inner = WFIFOP(fd, size); while (page_start >= 0 && count < RODEX_MAIL_PER_PAGE) { @@ -19447,7 +19503,11 @@ void clif_rodex_send_maillist(int fd, struct map_session_data *sd, int8 open_typ inner->MailID = msg->id; inner->Isread = msg->is_read == true ? 1 : 0; inner->type = msg->type; +#if PACKETVER >= 20170419 + inner->openType = msg->opentype; +#else inner->regDateTime = (int)time(NULL) - msg->send_date; +#endif inner->expireDateTime = msg->expire_date - (int)time(NULL); if (open_type == RODEX_OPENTYPE_RETURN) { inner->expireDateTime += RODEX_EXPIRE; @@ -19465,12 +19525,80 @@ void clif_rodex_send_maillist(int fd, struct map_session_data *sd, int8 open_typ } packet->PacketLength = size; +#if PACKETVER < 20170419 packet->cnt = count; +#endif packet->IsEnd = page_start > 0 ? 0 : 1; WFIFOSET(fd, size); #endif } +void clif_rodex_send_mails_all(int fd, struct map_session_data *sd) +{ +#if PACKETVER >= 20170419 + struct PACKET_ZC_MAIL_LIST *packet; + struct maillistinfo *inner; + int16 size = sizeof(*packet); + int packetMailCount = 0; + int mailListCount = 0; + int mailsSize = VECTOR_LENGTH(sd->rodex.messages); + int i; + + nullpo_retv(sd); + + WFIFOHEAD(fd, sizeof(*packet) + (sizeof(*inner) + RODEX_TITLE_LENGTH) * RODEX_MAIL_PER_PAGE); + packet = WFIFOP(fd, 0); + packet->PacketType = rodexmailList; + inner = WFIFOP(fd, size); + + i = mailsSize - 1; + while (i >= 0) { + struct rodex_message *msg = &VECTOR_INDEX(sd->rodex.messages, i); + --i; + + if (msg->is_deleted) + continue; + + inner->MailID = msg->id; + inner->Isread = msg->is_read == true ? 1 : 0; + inner->type = msg->type; + inner->openType = msg->opentype; + inner->expireDateTime = msg->expire_date - (int)time(NULL); + if (msg->opentype == RODEX_OPENTYPE_RETURN) { + inner->expireDateTime += RODEX_EXPIRE; + } + inner->Titlelength = (int16)strlen(msg->title) + 1; + if (msg->opentype != RODEX_OPENTYPE_RETURN) { + strncpy(inner->SenderName, msg->sender_name, sizeof(msg->sender_name)); + } else { + strncpy(inner->SenderName, msg->receiver_name, sizeof(msg->receiver_name)); + } + strncpy(inner->title, msg->title, inner->Titlelength); + size += sizeof(*inner) + inner->Titlelength; + inner = WFIFOP(fd, size); + packetMailCount ++; + mailListCount ++; + if (packetMailCount == RODEX_MAIL_PER_PAGE) { + packet->PacketLength = size; + packet->IsEnd = mailListCount > mailsSize ? 1 : 0; + WFIFOSET(fd, size); + WFIFOHEAD(fd, sizeof(*packet) + (sizeof(*inner) + RODEX_TITLE_LENGTH) * RODEX_MAIL_PER_PAGE); + packet = WFIFOP(fd, 0); + packet->PacketType = rodexmailList; + size = sizeof(*packet); + inner = WFIFOP(fd, size); + packetMailCount = 0; + } + } + + if (packetMailCount > 0 || mailListCount == 0) { + packet->PacketLength = size; + packet->IsEnd = 1; + WFIFOSET(fd, size); + } +#endif +} + void clif_rodex_send_refresh(int fd, struct map_session_data *sd, int8 open_type, int count) { #if PACKETVER >= 20131218 @@ -19484,8 +19612,9 @@ void clif_rodex_send_refresh(int fd, struct map_session_data *sd, int8 open_type WFIFOHEAD(fd, sizeof(*packet) + (sizeof(*inner) + RODEX_TITLE_LENGTH) * RODEX_MAIL_PER_PAGE); packet = WFIFOP(fd, 0); packet->PacketType = rodexmailList; +#if PACKETVER < 20170419 packet->opentype = open_type; - +#endif inner = WFIFOP(fd, size); i = VECTOR_LENGTH(sd->rodex.messages) - 1; @@ -19500,7 +19629,11 @@ void clif_rodex_send_refresh(int fd, struct map_session_data *sd, int8 open_type inner->MailID = msg->id; inner->Isread = msg->is_read == true ? 1 : 0; inner->type = msg->type; +#if PACKETVER >= 20170419 + inner->openType = msg->opentype; +#else inner->regDateTime = (int)time(NULL) - msg->send_date; +#endif inner->expireDateTime = msg->expire_date - (int)time(NULL); if (open_type == RODEX_OPENTYPE_RETURN) { inner->expireDateTime += RODEX_EXPIRE; @@ -19518,7 +19651,9 @@ void clif_rodex_send_refresh(int fd, struct map_session_data *sd, int8 open_type } packet->PacketLength = size; +#if PACKETVER < 20170419 packet->cnt = count; +#endif packet->IsEnd = 1; WFIFOSET(fd, size); #endif @@ -19693,14 +19828,22 @@ void clif_parse_rodex_refresh_maillist(int fd, struct map_session_data *sd) __at void clif_parse_rodex_refresh_maillist(int fd, struct map_session_data *sd) { const struct PACKET_CZ_REQ_REFRESH_MAIL_LIST *packet = RFIFOP(fd, 0); +#if PACKETVER >= 20170419 + rodex->refresh(sd, RODEX_OPENTYPE_UNSET, packet->Upper_MailID); +#else rodex->refresh(sd, packet->opentype, packet->Upper_MailID); +#endif } void clif_parse_rodex_open_mailbox(int fd, struct map_session_data *sd) __attribute__((nonnull(2))); void clif_parse_rodex_open_mailbox(int fd, struct map_session_data *sd) { const struct PACKET_CZ_REQ_OPEN_MAIL *packet = RFIFOP(fd, 0); - rodex->open(sd, packet->opentype); +#if PACKETVER >= 20170419 + rodex->open(sd, RODEX_OPENTYPE_UNSET, packet->Upper_MailID); +#else + rodex->open(sd, packet->opentype, packet->Upper_MailID); +#endif rodex->clean(sd, 1); } @@ -20785,4 +20928,5 @@ void clif_defaults(void) { clif->pRodexRequestItems = clif_parse_rodex_request_items; clif->rodex_request_items = clif_rodex_request_items; clif->rodex_icon = clif_rodex_icon; + clif->rodex_send_mails_all = clif_rodex_send_mails_all; } diff --git a/src/map/clif.h b/src/map/clif.h index ac8cc8d35..851c823ea 100644 --- a/src/map/clif.h +++ b/src/map/clif.h @@ -385,6 +385,7 @@ enum clif_messages { MSG_SECONDS_UNTIL_USE = 0x746, ///< %d seconds left until you can use MSG_NPC_WORK_IN_PROGRESS = 0x783, // FIXME[Haru]: This seems to be 0x784 in the msgstringtable files I found. MSG_REINS_CANT_USE_MOUNTED = 0x78b, // FIXME[Haru]: This seems to be 0x785 in the msgstringtalbe files I found. + MSG_PARTY_LEADER_SAMEMAP = 0x82e, //< It is only possible to change the party leader while on the same map. }; /** @@ -783,7 +784,7 @@ struct clif_interface { void (*equiptickack) (struct map_session_data* sd, int flag); void (*viewequip_ack) (struct map_session_data* sd, struct map_session_data* tsd); void (*equpcheckbox) (struct map_session_data* sd); - void (*displayexp) (struct map_session_data *sd, unsigned int exp, char type, bool is_quest); + void (*displayexp) (struct map_session_data *sd, uint64 exp, char type, bool is_quest); void (*font) (struct map_session_data *sd); void (*progressbar) (struct map_session_data * sd, unsigned int color, unsigned int second); void (*progressbar_abort) (struct map_session_data * sd); @@ -1377,6 +1378,7 @@ struct clif_interface { void (*rodex_send_mail_result) (int fd, struct map_session_data *sd, int8 result); void (*rodex_send_maillist) (int fd, struct map_session_data *sd, int8 open_type, int64 page_start); void (*rodex_send_refresh) (int fd, struct map_session_data *sd, int8 open_type, int count); + void (*rodex_send_mails_all) (int fd, struct map_session_data *sd); void (*pRodexReadMail) (int fd, struct map_session_data *sd); void (*rodex_read_mail) (struct map_session_data *sd, int8 opentype, struct rodex_message *msg); void (*pRodexNextMaillist) (int fd, struct map_session_data *sd); diff --git a/src/map/guild.c b/src/map/guild.c index 092e066c3..bb0484477 100644 --- a/src/map/guild.c +++ b/src/map/guild.c @@ -1282,7 +1282,8 @@ struct DBData create_expcache(union DBKey key, va_list args) /*==================================================== * Return taxed experience from player sd to guild *---------------------------------------------------*/ -unsigned int guild_payexp(struct map_session_data *sd,unsigned int exp) { +uint64 guild_payexp(struct map_session_data *sd, uint64 exp) +{ struct guild *g; struct guild_expcache *c; int per; diff --git a/src/map/guild.h b/src/map/guild.h index 71e989870..9296f9ec0 100644 --- a/src/map/guild.h +++ b/src/map/guild.h @@ -100,7 +100,7 @@ struct guild_interface { struct map_session_data *(*getavailablesd) (struct guild *g); int (*getindex) (const struct guild *g, int account_id, int char_id); int (*getposition) (struct guild *g, struct map_session_data *sd); - unsigned int (*payexp) (struct map_session_data *sd,unsigned int exp); + uint64 (*payexp) (struct map_session_data *sd, uint64 exp); int (*getexp) (struct map_session_data *sd,int exp); // [Celest] /* */ int (*create) (struct map_session_data *sd, const char *name); diff --git a/src/map/intif.c b/src/map/intif.c index 1458fc710..60edc8d8b 100644 --- a/src/map/intif.c +++ b/src/map/intif.c @@ -2433,7 +2433,9 @@ int intif_rodex_requestinbox(int char_id, int account_id, int8 flag, int8 openty void intif_parse_RequestRodexOpenInbox(int fd) { struct map_session_data *sd; +#if PACKETVER < 20170419 int8 opentype = RFIFOB(fd, 8); +#endif int8 flag = RFIFOB(fd, 9); int8 is_end = RFIFOB(fd, 10); int count = RFIFOL(fd, 11); @@ -2461,10 +2463,14 @@ void intif_parse_RequestRodexOpenInbox(int fd) } if (is_end == true) { +#if PACKETVER >= 20170419 + clif->rodex_send_mails_all(sd->fd, sd); +#else if (flag == 0) clif->rodex_send_maillist(sd->fd, sd, opentype, VECTOR_LENGTH(sd->rodex.messages) - 1); else clif->rodex_send_refresh(sd->fd, sd, opentype, count); +#endif } } diff --git a/src/map/map.c b/src/map/map.c index f8aebcfa6..5a647625f 100644 --- a/src/map/map.c +++ b/src/map/map.c @@ -447,6 +447,11 @@ int map_count_oncell(int16 m, int16 x, int16 y, int type, int flag) { struct status_change *sc = status->get_sc(bl); if (sc && (sc->option&OPTION_INVISIBLE)) continue; + if (bl->type == BL_NPC) { + const struct npc_data *nd = BL_UCCAST(BL_NPC, bl); + if (nd->class_ == FAKE_NPC || nd->class_ == HIDDEN_WARP_CLASS) + continue; + } } if (flag&0x1) { struct unit_data *ud = unit->bl2ud(bl); @@ -1835,7 +1840,7 @@ void map_addiddb(struct block_list *bl) struct mob_data *md = BL_UCAST(BL_MOB, bl); idb_put(map->mobid_db,bl->id,bl); - if( md->state.boss ) + if (md->state.boss == BTYPE_MVP) idb_put(map->bossid_db, bl->id, bl); } diff --git a/src/map/map.h b/src/map/map.h index d4284b3f7..5835b5abc 100644 --- a/src/map/map.h +++ b/src/map/map.h @@ -519,7 +519,7 @@ struct spawn_data { //0: Normal mob | 1: Standard summon, attacks mobs //2: Alchemist Marine Sphere | 3: Alchemist Summon Flora | 4: Summon Zanzou unsigned int dynamic : 1; ///< Whether this data is indexed by a map's dynamic mob list - unsigned int boss : 1; ///< 0: Non-boss monster | 1: Boss monster + uint8 boss; ///< 0: Non-boss monster | 1: Boss monster | 2: MVP } state; char name[NAME_LENGTH], eventname[EVENT_NAME_LENGTH]; //Name/event }; @@ -852,6 +852,7 @@ struct map_data { unsigned noknockback : 1; unsigned notomb : 1; unsigned nocashshop : 1; + unsigned noautoloot : 1; uint32 noviewid; ///< noviewid (bitmask - @see enum equip_pos) } flag; struct point save; diff --git a/src/map/mob.c b/src/map/mob.c index 98f8865a9..208617b5d 100644 --- a/src/map/mob.c +++ b/src/map/mob.c @@ -1354,7 +1354,7 @@ int mob_unlocktarget(struct mob_data *md, int64 tick) { md->ud.target_to = 0; unit->set_target(&md->ud, 0); } - if(battle_config.official_cell_stack_limit && map->count_oncell(md->bl.m, md->bl.x, md->bl.y, BL_CHAR|BL_NPC, 1) > battle_config.official_cell_stack_limit) { + if(battle_config.official_cell_stack_limit && map->count_oncell(md->bl.m, md->bl.x, md->bl.y, BL_CHAR|BL_NPC, 0x1 | 0x2) > battle_config.official_cell_stack_limit) { unit->walktoxy(&md->bl, md->bl.x, md->bl.y, 8); } @@ -1904,6 +1904,7 @@ void mob_item_drop(struct mob_data *md, struct item_drop_list *dlist, struct ite if( sd && (drop_rate <= sd->state.autoloot || pc->isautolooting(sd, ditem->item_data.nameid)) + && (!map->list[sd->bl.m].flag.noautoloot) && (battle_config.idle_no_autoloot == 0 || DIFF_TICK(sockt->last_tick, sd->idletime) < battle_config.idle_no_autoloot) && (battle_config.homunculus_autoloot?1:!flag) #ifdef AUTOLOOT_DISTANCE @@ -2685,7 +2686,7 @@ int mob_dead(struct mob_data *md, struct block_list *src, int type) { return 5; // Note: Actually, it's 4. Oh well... // MvP tomb [GreenBox] - if (battle_config.mvp_tomb_enabled && md->spawn->state.boss && map->list[md->bl.m].flag.notomb != 1) + if (battle_config.mvp_tomb_enabled && md->spawn->state.boss == BTYPE_MVP && map->list[md->bl.m].flag.notomb != 1) mob->mvptomb_create(md, mvp_sd ? mvp_sd->status.name : NULL, time(NULL)); if( !rebirth ) { diff --git a/src/map/mob.h b/src/map/mob.h index 7f2accedf..83e022899 100644 --- a/src/map/mob.h +++ b/src/map/mob.h @@ -69,6 +69,12 @@ struct hplugin_data_store; // Disable this to make monsters not do any path search when looking for a target (old behavior). #define ACTIVEPATHSEARCH +enum e_bosstype { + BTYPE_NONE = 0, + BTYPE_BOSS = 1, + BTYPE_MVP = 2, +}; + //Mob skill states. enum MobSkillState { MSS_ANY = -1, @@ -181,10 +187,10 @@ struct mob_data { unsigned int spotted: 1; unsigned int npc_killmonster: 1; //for new killmonster behavior unsigned int rebirth: 1; // NPC_Rebirth used - unsigned int boss : 1; enum MobSkillState skillstate; unsigned char steal_flag; //number of steal tries (to prevent steal exploit on mobs with few items) [Lupus] unsigned char attacked_count; //For rude attacked. + uint8 boss; int provoke_flag; // Celest } state; struct guardian_data* guardian_data; diff --git a/src/map/npc.c b/src/map/npc.c index 6beff2b77..0702b2525 100644 --- a/src/map/npc.c +++ b/src/map/npc.c @@ -114,6 +114,8 @@ bool npc_db_checkid(int id) return true; if (id >= MAX_NPC_CLASS2_START && id < MAX_NPC_CLASS2_END) // Second range return true; + if (pc->db_checkid(id)) + return true; // Anything else is invalid return false; } @@ -2706,6 +2708,7 @@ struct npc_data *npc_create_npc(enum npc_subtype subtype, int m, int x, int y, u nd->area_size = AREA_SIZE + 1; nd->class_ = class_; nd->speed = 200; + nd->vd.class = 0; return nd; } @@ -3656,6 +3659,18 @@ void npc_setclass(struct npc_data* nd, short class_) { clif->spawn(&nd->bl);// fade in } +void npc_refresh(struct npc_data* nd) +{ + nullpo_retv(nd); + + if (map->list[nd->bl.m].users) { + // using here CLR_TRICKDEAD because other flags show effects. + // probably need use other flag or other way to refresh npc. + clif->clearunit_area(&nd->bl, CLR_TRICKDEAD); // fade out + clif->spawn(&nd->bl); // fade in + } +} + // @commands (script based) int npc_do_atcmd_event(struct map_session_data* sd, const char* command, const char* message, const char* eventname) { @@ -3843,7 +3858,12 @@ const char *npc_parse_mob(const char *w1, const char *w2, const char *w3, const memset(&mobspawn, 0, sizeof(struct spawn_data)); - mobspawn.state.boss = (strcmp(w2,"boss_monster") == 0 ? 1 : 0); + if (strcmp(w2, "boss_monster") == 0) + mobspawn.state.boss = BTYPE_MVP; + else if (strcmp(w2, "miniboss_monster") == 0) + mobspawn.state.boss = BTYPE_BOSS; + else + mobspawn.state.boss = BTYPE_NONE; // w1=<map name>,<x>,<y>,<xs>,<ys> // w3=<mob name>{,<mob level>} @@ -4300,6 +4320,8 @@ const char *npc_parse_mapflag(const char *w1, const char *w2, const char *w3, co map->list[m].flag.reset=state; else if (!strcmpi(w3,"notomb")) map->list[m].flag.notomb=state; + else if (!strcmpi(w3, "noautoloot")) + map->list[m].flag.noautoloot = state; else if (!strcmpi(w3,"adjust_unit_duration")) { int skill_id, k; char skill_name[MAP_ZONE_MAPFLAG_LENGTH], modifier[MAP_ZONE_MAPFLAG_LENGTH]; @@ -4660,7 +4682,7 @@ int npc_parsesrcfile(const char* filepath, bool runOnInit) { { p = npc->parse_duplicate(w1,w2,w3,w4, p, buffer, filepath, (runOnInit?NPO_ONINIT:NPO_NONE), &success); } - else if( (strcmp(w2,"monster") == 0 || strcmp(w2,"boss_monster") == 0) ) + else if (strcmp(w2,"monster") == 0 || strcmp(w2,"boss_monster") == 0 || strcmp(w2,"miniboss_monster") == 0) { p = npc->parse_mob(w1, w2, w3, w4, p, buffer, filepath, &success); } @@ -4992,7 +5014,6 @@ int do_init_npc(bool minimal) { npc_viewdb[i].class = i; for( i = MAX_NPC_CLASS2_START; i < MAX_NPC_CLASS2_END; i++ ) npc_viewdb2[i - MAX_NPC_CLASS2_START].class = i; - npc->ev_db = strdb_alloc(DB_OPT_DUP_KEY|DB_OPT_RELEASE_DATA, EVENT_NAME_LENGTH); npc->ev_label_db = strdb_alloc(DB_OPT_DUP_KEY|DB_OPT_RELEASE_DATA, NAME_LENGTH); npc->name_db = strdb_alloc(DB_OPT_BASE, NAME_LENGTH); @@ -5187,4 +5208,5 @@ void npc_defaults(void) { npc->market_delfromsql = npc_market_delfromsql; npc->market_delfromsql_sub = npc_market_delfromsql_sub; npc->db_checkid = npc_db_checkid; + npc->refresh = npc_refresh; } diff --git a/src/map/npc.h b/src/map/npc.h index 3bd11d536..8bb38f252 100644 --- a/src/map/npc.h +++ b/src/map/npc.h @@ -70,7 +70,7 @@ struct npc_parse; struct npc_data { struct block_list bl; struct unit_data *ud; - struct view_data *vd; + struct view_data vd; unsigned int option; struct npc_data *master_nd; short class_; @@ -309,6 +309,7 @@ struct npc_interface { void (*market_delfromsql) (struct npc_data *nd, unsigned short index); void (*market_delfromsql_sub) (const char *npcname, unsigned short index); bool (*db_checkid) (const int id); + void (*refresh) (struct npc_data* nd); /** * For the Secure NPC Timeout option (check config/Secure.h) [RR] **/ diff --git a/src/map/packets.h b/src/map/packets.h index afa986346..3fcf1648a 100644 --- a/src/map/packets.h +++ b/src/map/packets.h @@ -9476,8 +9476,8 @@ packet(0x96e,-1,clif->ackmergeitems); // 2017-02-28aRagexeRE #if PACKETVER >= 20170228 // new packets - packet(0x0ac0,26); - packet(0x0ac1,26); + packet(0x0ac0,26,clif->pRodexOpenMailbox); // CZ_OPEN_RODEXBOX + packet(0x0ac1,26,clif->pRodexRefreshMaillist); // CZ_REQ_REFRESH_RODEX packet(0x0ac2,-1); packet(0x0ac3,2); packet(0x0ac4,-1); @@ -10527,4 +10527,220 @@ packet(0x96e,-1,clif->ackmergeitems); packet(0x0adf,58); #endif +// 2017-09-27bRagexeRE +#if PACKETVER == 20170927 +// shuffle packets + packet(0x02c4,5,clif->pHomMenu,2,4); // CZ_COMMAND_MER + packet(0x035f,6,clif->pGetCharNameRequest,2); // CZ_REQNAME + packet(0x0361,4,clif->pDull/*,XXX*/); // CZ_GANGSI_RANK + packet(0x0362,-1,clif->pReqOpenBuyingStore,2,4,8,9,89); // CZ_REQ_OPEN_BUYING_STORE + packet(0x0366,19,clif->pWantToConnection,2,6,10,14,18); // CZ_ENTER + packet(0x085c,10,clif->pUseSkillToId,2,4,6); // CZ_USE_SKILL + packet(0x0873,6,clif->pSolveCharName,2); // CZ_REQNAME_BYGID + packet(0x0875,12,clif->pSearchStoreInfoListItemClick,2,6,10); // CZ_SSILIST_ITEM_CLICK + packet(0x087d,-1,clif->pReqTradeBuyingStore,2,4,8,12); // CZ_REQ_TRADE_BUYING_STORE + packet(0x087e,5,clif->pChangeDir,2,4); // CZ_CHANGE_DIRECTION + packet(0x088b,2,clif->pSearchStoreInfoNextPage,0); // CZ_SEARCH_STORE_INFO_NEXT_PAGE + packet(0x0899,7,clif->pActionRequest,2,6); // CZ_REQUEST_ACT + packet(0x089a,36,clif->pStoragePassword,0); // CZ_ACK_STORE_PASSWORD + packet(0x089b,8,clif->pMoveFromKafra,2,4); // CZ_MOVE_ITEM_FROM_STORE_TO_BODY + packet(0x08a3,2,clif->pReqCloseBuyingStore,0); // CZ_REQ_CLOSE_BUYING_STORE + packet(0x08a5,-1,clif->pItemListWindowSelected,2,4,8); // CZ_ITEMLISTWIN_RES + packet(0x08a6,8,clif->pDull/*,XXX*/); // CZ_JOIN_BATTLE_FIELD + packet(0x08ad,-1,clif->pSearchStoreInfo,2,4,5,9,13,14,15); // CZ_SEARCH_STORE_INFO + packet(0x091e,6,clif->pReqClickBuyingStore,2); // CZ_REQ_CLICK_TO_BUYING_STORE + packet(0x0922,26,clif->pPartyInvite2,2); // CZ_PARTY_JOIN_REQ + packet(0x0923,6,clif->pDropItem,2,4); // CZ_ITEM_THROW + packet(0x0927,5,clif->pWalkToXY,2); // CZ_REQUEST_MOVE + packet(0x093b,90,clif->pUseSkillToPosMoreInfo,2,4,6,8,10); // CZ_USE_SKILL_TOGROUND_WITHTALKBOX + packet(0x0942,18,clif->pPartyBookingRegisterReq,2,4); // CZ_PARTY_BOOKING_REQ_REGISTER + packet(0x0945,6,clif->pTickSend,2); // CZ_REQUEST_TIME + packet(0x094b,26,clif->pFriendsListAdd,2); // CZ_ADD_FRIENDS + packet(0x094d,6,clif->pTakeItem,2); // CZ_ITEM_PICKUP + packet(0x0959,8,clif->pMoveToKafra,2,4); // CZ_MOVE_ITEM_FROM_BODY_TO_STORE + packet(0x095a,10,clif->pUseSkillToPos,2,4,6,8); // CZ_USE_SKILL_TOGROUND +#endif + +#if PACKETVER >= 20170927 +// new packets + packet(0x0ae0,30); +// changed packet sizes +#endif + +// 2017-10-02cRagexeRE +#if PACKETVER == 20171002 +// shuffle packets + packet(0x022d,6,clif->pDropItem,2,4); // CZ_ITEM_THROW + packet(0x035f,6,clif->pTickSend,2); // CZ_REQUEST_TIME + packet(0x0360,6,clif->pReqClickBuyingStore,2); // CZ_REQ_CLICK_TO_BUYING_STORE + packet(0x0363,10,clif->pUseSkillToPos,2,4,6,8); // CZ_USE_SKILL_TOGROUND + packet(0x0366,90,clif->pUseSkillToPosMoreInfo,2,4,6,8,10); // CZ_USE_SKILL_TOGROUND_WITHTALKBOX + packet(0x0368,6,clif->pSolveCharName,2); // CZ_REQNAME_BYGID + packet(0x0369,7,clif->pActionRequest,2,6); // CZ_REQUEST_ACT + packet(0x0437,5,clif->pWalkToXY,2); // CZ_REQUEST_MOVE + packet(0x0438,5,clif->pHomMenu,2,4); // CZ_COMMAND_MER + packet(0x0811,-1,clif->pReqTradeBuyingStore,2,4,8,12); // CZ_REQ_TRADE_BUYING_STORE + packet(0x0815,-1,clif->pReqOpenBuyingStore,2,4,8,9,89); // CZ_REQ_OPEN_BUYING_STORE + packet(0x0817,2,clif->pReqCloseBuyingStore,0); // CZ_REQ_CLOSE_BUYING_STORE + packet(0x0819,-1,clif->pSearchStoreInfo,2,4,5,9,13,14,15); // CZ_SEARCH_STORE_INFO + packet(0x0835,2,clif->pSearchStoreInfoNextPage,0); // CZ_SEARCH_STORE_INFO_NEXT_PAGE + packet(0x0838,12,clif->pSearchStoreInfoListItemClick,2,6,10); // CZ_SSILIST_ITEM_CLICK + packet(0x083c,10,clif->pUseSkillToId,2,4,6); // CZ_USE_SKILL + packet(0x0885,8,clif->pMoveToKafra,2,4); // CZ_MOVE_ITEM_FROM_BODY_TO_STORE + packet(0x0897,5,clif->pChangeDir,2,4); // CZ_CHANGE_DIRECTION + packet(0x0899,26,clif->pFriendsListAdd,2); // CZ_ADD_FRIENDS + packet(0x089d,19,clif->pWantToConnection,2,6,10,14,18); // CZ_ENTER + packet(0x0928,-1,clif->pItemListWindowSelected,2,4,8); // CZ_ITEMLISTWIN_RES + packet(0x092d,18,clif->pPartyBookingRegisterReq,2,4); // CZ_PARTY_BOOKING_REQ_REGISTER + packet(0x0934,36,clif->pStoragePassword,0); // CZ_ACK_STORE_PASSWORD + packet(0x093b,8,clif->pMoveFromKafra,2,4); // CZ_MOVE_ITEM_FROM_STORE_TO_BODY + packet(0x093d,6,clif->pTakeItem,2); // CZ_ITEM_PICKUP + packet(0x093e,8,clif->pDull/*,XXX*/); // CZ_JOIN_BATTLE_FIELD + packet(0x0943,26,clif->pPartyInvite2,2); // CZ_PARTY_JOIN_REQ + packet(0x095f,4,clif->pDull/*,XXX*/); // CZ_GANGSI_RANK + packet(0x096a,6,clif->pGetCharNameRequest,2); // CZ_REQNAME +#endif + +// 2017-10-11bRagexeRE +#if PACKETVER == 20171011 +// shuffle packets + packet(0x023b,5,clif->pWalkToXY,2); // CZ_REQUEST_MOVE + packet(0x0281,-1,clif->pItemListWindowSelected,2,4,8); // CZ_ITEMLISTWIN_RES + packet(0x035f,6,clif->pTickSend,2); // CZ_REQUEST_TIME + packet(0x0360,6,clif->pReqClickBuyingStore,2); // CZ_REQ_CLICK_TO_BUYING_STORE + packet(0x0362,6,clif->pDropItem,2,4); // CZ_ITEM_THROW + packet(0x0363,8,clif->pDull/*,XXX*/); // CZ_JOIN_BATTLE_FIELD + packet(0x0364,8,clif->pMoveFromKafra,2,4); // CZ_MOVE_ITEM_FROM_STORE_TO_BODY + packet(0x0365,18,clif->pPartyBookingRegisterReq,2,4); // CZ_PARTY_BOOKING_REQ_REGISTER + packet(0x0366,90,clif->pUseSkillToPosMoreInfo,2,4,6,8,10); // CZ_USE_SKILL_TOGROUND_WITHTALKBOX + packet(0x0368,6,clif->pSolveCharName,2); // CZ_REQNAME_BYGID + packet(0x0369,7,clif->pActionRequest,2,6); // CZ_REQUEST_ACT + packet(0x0436,4,clif->pDull/*,XXX*/); // CZ_GANGSI_RANK + packet(0x0437,36,clif->pStoragePassword,0); // CZ_ACK_STORE_PASSWORD + packet(0x0438,10,clif->pUseSkillToPos,2,4,6,8); // CZ_USE_SKILL_TOGROUND + packet(0x07e4,6,clif->pTakeItem,2); // CZ_ITEM_PICKUP + packet(0x07ec,8,clif->pMoveToKafra,2,4); // CZ_MOVE_ITEM_FROM_BODY_TO_STORE + packet(0x0802,26,clif->pPartyInvite2,2); // CZ_PARTY_JOIN_REQ + packet(0x0811,-1,clif->pReqTradeBuyingStore,2,4,8,12); // CZ_REQ_TRADE_BUYING_STORE + packet(0x0815,-1,clif->pReqOpenBuyingStore,2,4,8,9,89); // CZ_REQ_OPEN_BUYING_STORE + packet(0x0817,2,clif->pReqCloseBuyingStore,0); // CZ_REQ_CLOSE_BUYING_STORE + packet(0x0819,-1,clif->pSearchStoreInfo,2,4,5,9,13,14,15); // CZ_SEARCH_STORE_INFO + packet(0x0835,2,clif->pSearchStoreInfoNextPage,0); // CZ_SEARCH_STORE_INFO_NEXT_PAGE + packet(0x0838,12,clif->pSearchStoreInfoListItemClick,2,6,10); // CZ_SSILIST_ITEM_CLICK + packet(0x083c,10,clif->pUseSkillToId,2,4,6); // CZ_USE_SKILL + packet(0x087b,26,clif->pFriendsListAdd,2); // CZ_ADD_FRIENDS + packet(0x0882,5,clif->pHomMenu,2,4); // CZ_COMMAND_MER + packet(0x0950,19,clif->pWantToConnection,2,6,10,14,18); // CZ_ENTER + packet(0x0954,5,clif->pChangeDir,2,4); // CZ_CHANGE_DIRECTION + packet(0x096a,6,clif->pGetCharNameRequest,2); // CZ_REQNAME +#endif + +// 2017-10-18aRagexeRE +#if PACKETVER == 20171018 +// shuffle packets + packet(0x035f,6,clif->pTickSend,2); // CZ_REQUEST_TIME + packet(0x0360,6,clif->pReqClickBuyingStore,2); // CZ_REQ_CLICK_TO_BUYING_STORE + packet(0x0363,19,clif->pWantToConnection,2,6,10,14,18); // CZ_ENTER + packet(0x0364,8,clif->pMoveToKafra,2,4); // CZ_MOVE_ITEM_FROM_BODY_TO_STORE + packet(0x0366,90,clif->pUseSkillToPosMoreInfo,2,4,6,8,10); // CZ_USE_SKILL_TOGROUND_WITHTALKBOX + packet(0x0368,6,clif->pSolveCharName,2); // CZ_REQNAME_BYGID + packet(0x0369,7,clif->pActionRequest,2,6); // CZ_REQUEST_ACT + packet(0x0436,6,clif->pTakeItem,2); // CZ_ITEM_PICKUP + packet(0x0437,5,clif->pWalkToXY,2); // CZ_REQUEST_MOVE + packet(0x0438,10,clif->pUseSkillToPos,2,4,6,8); // CZ_USE_SKILL_TOGROUND + packet(0x0811,-1,clif->pReqTradeBuyingStore,2,4,8,12); // CZ_REQ_TRADE_BUYING_STORE + packet(0x0815,-1,clif->pReqOpenBuyingStore,2,4,8,9,89); // CZ_REQ_OPEN_BUYING_STORE + packet(0x0817,2,clif->pReqCloseBuyingStore,0); // CZ_REQ_CLOSE_BUYING_STORE + packet(0x0819,-1,clif->pSearchStoreInfo,2,4,5,9,13,14,15); // CZ_SEARCH_STORE_INFO + packet(0x0835,2,clif->pSearchStoreInfoNextPage,0); // CZ_SEARCH_STORE_INFO_NEXT_PAGE + packet(0x0838,12,clif->pSearchStoreInfoListItemClick,2,6,10); // CZ_SSILIST_ITEM_CLICK + packet(0x083c,10,clif->pUseSkillToId,2,4,6); // CZ_USE_SKILL + packet(0x086a,4,clif->pDull/*,XXX*/); // CZ_GANGSI_RANK + packet(0x087a,8,clif->pDull/*,XXX*/); // CZ_JOIN_BATTLE_FIELD + packet(0x087e,5,clif->pHomMenu,2,4); // CZ_COMMAND_MER + packet(0x0889,8,clif->pMoveFromKafra,2,4); // CZ_MOVE_ITEM_FROM_STORE_TO_BODY + packet(0x089a,6,clif->pDropItem,2,4); // CZ_ITEM_THROW + packet(0x089f,26,clif->pPartyInvite2,2); // CZ_PARTY_JOIN_REQ + packet(0x08a6,5,clif->pChangeDir,2,4); // CZ_CHANGE_DIRECTION + packet(0x0938,-1,clif->pItemListWindowSelected,2,4,8); // CZ_ITEMLISTWIN_RES + packet(0x0944,36,clif->pStoragePassword,0); // CZ_ACK_STORE_PASSWORD + packet(0x094a,26,clif->pFriendsListAdd,2); // CZ_ADD_FRIENDS + packet(0x094f,18,clif->pPartyBookingRegisterReq,2,4); // CZ_PARTY_BOOKING_REQ_REGISTER + packet(0x096a,6,clif->pGetCharNameRequest,2); // CZ_REQNAME +#endif + +// 2017-10-25eRagexeRE +#if PACKETVER == 20171025 +// shuffle packets + packet(0x0202,5,clif->pChangeDir,2,4); // CZ_CHANGE_DIRECTION + packet(0x022d,19,clif->pWantToConnection,2,6,10,14,18); // CZ_ENTER + packet(0x023b,26,clif->pFriendsListAdd,2); // CZ_ADD_FRIENDS + packet(0x0281,-1,clif->pItemListWindowSelected,2,4,8); // CZ_ITEMLISTWIN_RES + packet(0x035f,6,clif->pTickSend,2); // CZ_REQUEST_TIME + packet(0x0360,6,clif->pReqClickBuyingStore,2); // CZ_REQ_CLICK_TO_BUYING_STORE + packet(0x0361,5,clif->pHomMenu,2,4); // CZ_COMMAND_MER + packet(0x0362,6,clif->pDropItem,2,4); // CZ_ITEM_THROW + packet(0x0363,8,clif->pDull/*,XXX*/); // CZ_JOIN_BATTLE_FIELD + packet(0x0364,8,clif->pMoveFromKafra,2,4); // CZ_MOVE_ITEM_FROM_STORE_TO_BODY + packet(0x0365,18,clif->pPartyBookingRegisterReq,2,4); // CZ_PARTY_BOOKING_REQ_REGISTER + packet(0x0366,90,clif->pUseSkillToPosMoreInfo,2,4,6,8,10); // CZ_USE_SKILL_TOGROUND_WITHTALKBOX + packet(0x0368,6,clif->pSolveCharName,2); // CZ_REQNAME_BYGID + packet(0x0369,7,clif->pActionRequest,2,6); // CZ_REQUEST_ACT + packet(0x0436,4,clif->pDull/*,XXX*/); // CZ_GANGSI_RANK + packet(0x0437,5,clif->pWalkToXY,2); // CZ_REQUEST_MOVE + packet(0x0438,10,clif->pUseSkillToPos,2,4,6,8); // CZ_USE_SKILL_TOGROUND + packet(0x07e4,6,clif->pTakeItem,2); // CZ_ITEM_PICKUP + packet(0x07ec,8,clif->pMoveToKafra,2,4); // CZ_MOVE_ITEM_FROM_BODY_TO_STORE + packet(0x0802,26,clif->pPartyInvite2,2); // CZ_PARTY_JOIN_REQ + packet(0x0811,-1,clif->pReqTradeBuyingStore,2,4,8,12); // CZ_REQ_TRADE_BUYING_STORE + packet(0x0815,-1,clif->pReqOpenBuyingStore,2,4,8,9,89); // CZ_REQ_OPEN_BUYING_STORE + packet(0x0817,2,clif->pReqCloseBuyingStore,0); // CZ_REQ_CLOSE_BUYING_STORE + packet(0x0819,-1,clif->pSearchStoreInfo,2,4,5,9,13,14,15); // CZ_SEARCH_STORE_INFO + packet(0x0835,2,clif->pSearchStoreInfoNextPage,0); // CZ_SEARCH_STORE_INFO_NEXT_PAGE + packet(0x0838,12,clif->pSearchStoreInfoListItemClick,2,6,10); // CZ_SSILIST_ITEM_CLICK + packet(0x083c,10,clif->pUseSkillToId,2,4,6); // CZ_USE_SKILL + packet(0x08a2,36,clif->pStoragePassword,0); // CZ_ACK_STORE_PASSWORD + packet(0x096a,6,clif->pGetCharNameRequest,2); // CZ_REQNAME +#endif + +// 2017-11-01bRagexeRE +#if PACKETVER == 20171101 +// shuffle packets + packet(0x022d,36,clif->pStoragePassword,0); // CZ_ACK_STORE_PASSWORD + packet(0x0368,19,clif->pWantToConnection,2,6,10,14,18); // CZ_ENTER + packet(0x0369,-1,clif->pSearchStoreInfo,2,4,5,9,13,14,15); // CZ_SEARCH_STORE_INFO + packet(0x0438,6,clif->pTickSend,2); // CZ_REQUEST_TIME + packet(0x0835,6,clif->pDropItem,2,4); // CZ_ITEM_THROW + packet(0x085b,5,clif->pHomMenu,2,4); // CZ_COMMAND_MER + packet(0x0860,6,clif->pGetCharNameRequest,2); // CZ_REQNAME + packet(0x086c,10,clif->pUseSkillToId,2,4,6); // CZ_USE_SKILL + packet(0x0872,26,clif->pFriendsListAdd,2); // CZ_ADD_FRIENDS + packet(0x0876,5,clif->pChangeDir,2,4); // CZ_CHANGE_DIRECTION + packet(0x0886,8,clif->pDull/*,XXX*/); // CZ_JOIN_BATTLE_FIELD + packet(0x088e,6,clif->pReqClickBuyingStore,2); // CZ_REQ_CLICK_TO_BUYING_STORE + packet(0x0890,2,clif->pSearchStoreInfoNextPage,0); // CZ_SEARCH_STORE_INFO_NEXT_PAGE + packet(0x0895,4,clif->pDull/*,XXX*/); // CZ_GANGSI_RANK + packet(0x0899,26,clif->pPartyInvite2,2); // CZ_PARTY_JOIN_REQ + packet(0x089b,-1,clif->pReqOpenBuyingStore,2,4,8,9,89); // CZ_REQ_OPEN_BUYING_STORE + packet(0x089c,18,clif->pPartyBookingRegisterReq,2,4); // CZ_PARTY_BOOKING_REQ_REGISTER + packet(0x08a0,8,clif->pMoveFromKafra,2,4); // CZ_MOVE_ITEM_FROM_STORE_TO_BODY + packet(0x08ab,-1,clif->pItemListWindowSelected,2,4,8); // CZ_ITEMLISTWIN_RES + packet(0x08ad,12,clif->pSearchStoreInfoListItemClick,2,6,10); // CZ_SSILIST_ITEM_CLICK + packet(0x091b,8,clif->pMoveToKafra,2,4); // CZ_MOVE_ITEM_FROM_BODY_TO_STORE + packet(0x0939,5,clif->pWalkToXY,2); // CZ_REQUEST_MOVE + packet(0x094a,2,clif->pReqCloseBuyingStore,0); // CZ_REQ_CLOSE_BUYING_STORE + packet(0x094d,6,clif->pSolveCharName,2); // CZ_REQNAME_BYGID + packet(0x0952,90,clif->pUseSkillToPosMoreInfo,2,4,6,8,10); // CZ_USE_SKILL_TOGROUND_WITHTALKBOX + packet(0x0957,7,clif->pActionRequest,2,6); // CZ_REQUEST_ACT + packet(0x095a,-1,clif->pReqTradeBuyingStore,2,4,8,12); // CZ_REQ_TRADE_BUYING_STORE + packet(0x0962,6,clif->pTakeItem,2); // CZ_ITEM_PICKUP + packet(0x0966,10,clif->pUseSkillToPos,2,4,6,8); // CZ_USE_SKILL_TOGROUND +#endif + +// 2017-11-01bRagexeRE +#if PACKETVER >= 20171101 +// new packets + packet(0x0ae1,28); +#endif + #endif /* MAP_PACKETS_H */ diff --git a/src/map/packets_keys.h b/src/map/packets_keys.h index 424956bc9..005c3790b 100644 --- a/src/map/packets_keys.h +++ b/src/map/packets_keys.h @@ -2,7 +2,7 @@ * This file is part of Hercules. * http://herc.ws - http://github.com/HerculesWS/Hercules * - * Copyright (C) 2013-2015 Hercules Dev Team + * Copyright (C) 2013-2017 Hercules Dev Team * * Hercules is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -2057,7 +2057,7 @@ packetKeys(0x03FA5A97,0x20B802D5,0x339F1977); #endif -// 2017-06-07bRagexeRE +// 2017-06-07bRagexeRE, 2017-06-07cRagexeRE #if PACKETVER == 20170607 packetKeys(0x50564ACD,0x79CA4E15,0x405F4894); #endif @@ -2132,6 +2132,37 @@ packetKeys(0x53024DA5,0x04EC212D,0x0BF87CD4); #endif +// 2017-09-27bRagexeRE, 2017-09-27dRagexeRE +#if PACKETVER == 20170927 + packetKeys(0x15624100,0x0CE1463E,0x0E5D6534); +#endif + +// 2017-10-02cRagexeRE +#if PACKETVER == 20171002 + packetKeys(0x15E1716C,0x4E765B63,0x357D2370); +#endif + +// 2017-10-11aRagexeRE, 2017-10-11bRagexeRE +#if PACKETVER == 20171011 + packetKeys(0x4F121B3E,0x12670E17,0x19896C11); +#endif + +// 2017-10-18aRagexeRE +#if PACKETVER == 20171018 + packetKeys(0x2CAA109C,0x158C1EC2,0x7A5E58F3); +#endif + +// 2017-10-25bRagexeRE, 2017-10-25cRagexeRE, 2017-10-25dRagexeRE, 2017-10-25eRagexeRE +#if PACKETVER == 20171025 + packetKeys(0x165C565C,0x565C565C,0x565C565C); +#endif + +// 2017-11-01bRagexeRE +#if PACKETVER == 20171101 + packetKeys(0x7056317F,0x7EEE0589,0x02672373); +#endif + + #if defined(OBFUSCATIONKEY1) && defined(OBFUSCATIONKEY2) && defined(OBFUSCATIONKEY3) packetKeys(OBFUSCATIONKEY1,OBFUSCATIONKEY2,OBFUSCATIONKEY3); #endif diff --git a/src/map/packets_struct.h b/src/map/packets_struct.h index 207c345da..03b555e2b 100644 --- a/src/map/packets_struct.h +++ b/src/map/packets_struct.h @@ -318,10 +318,12 @@ enum packet_headers { rodexadditem = 0x0A05, rodexremoveitem = 0x0A07, rodexopenwrite = 0x0A12, -#if PACKETVER < 20160600 +#if PACKETVER < 20160601 rodexmailList = 0x09F0, -#else // PACKETVER >= 20160600 +#elif PACKETVER < 20170419 rodexmailList = 0x0A7D, +#else // PACKETVER >= 20170419 + rodexmailList = 0x0Ac2, #endif #if PACKETVER < 20160316 rodexcheckplayer = 0x0A14, @@ -1369,11 +1371,16 @@ struct PACKET_ZC_NOTIFY_UNREADMAIL { } __attribute__((packed)); struct maillistinfo { +#if PACKETVER >= 20170419 + uint8 openType; +#endif int64 MailID; int8 Isread; uint8 type; char SenderName[24]; +#if PACKETVER < 20170419 int32 regDateTime; +#endif int32 expireDateTime; int16 Titlelength; char title[]; @@ -1382,8 +1389,10 @@ struct maillistinfo { struct PACKET_ZC_MAIL_LIST { int16 PacketType; int16 PacketLength; +#if PACKETVER < 20170419 int8 opentype; int8 cnt; +#endif int8 IsEnd; } __attribute__((packed)); @@ -1395,8 +1404,13 @@ struct PACKET_CZ_REQ_NEXT_MAIL_LIST { struct PACKET_CZ_REQ_OPEN_MAIL { int16 PacketType; +#if PACKETVER >= 20170419 + int64 Upper_MailID; + int8 unknown[16]; +#else int8 opentype; int64 Upper_MailID; +#endif } __attribute__((packed)); struct PACKET_CZ_REQ_READ_MAIL { @@ -1429,8 +1443,13 @@ struct PACKET_ZC_ACK_DELETE_MAIL { struct PACKET_CZ_REQ_REFRESH_MAIL_LIST { int16 PacketType; +#if PACKETVER >= 20170419 + int64 Upper_MailID; + int8 unknown[16]; +#else int8 opentype; int64 Upper_MailID; +#endif } __attribute__((packed)); struct PACKET_CZ_REQ_ZENY_FROM_MAIL { diff --git a/src/map/party.c b/src/map/party.c index 26b4bae8b..a4a7e6dca 100644 --- a/src/map/party.c +++ b/src/map/party.c @@ -731,6 +731,11 @@ bool party_changeleader(struct map_session_data *sd, struct map_session_data *ts return false; } + if (battle_config.party_change_leader_same_map && sd->bl.m != tsd->bl.m) { + clif->msgtable(sd, MSG_PARTY_LEADER_SAMEMAP); // It is only possible to change the party leader while on the same map. + return false; + } + if( map->list[sd->bl.m].flag.partylock ) { clif->message(sd->fd, msg_sd(sd,287)); // You cannot change party leaders in this map. return false; diff --git a/src/map/pc.c b/src/map/pc.c index a4a32545b..0636ebafa 100644 --- a/src/map/pc.c +++ b/src/map/pc.c @@ -6698,8 +6698,9 @@ int pc_follow(struct map_session_data *sd,int target_id) { return 0; } -int pc_checkbaselevelup(struct map_session_data *sd) { - unsigned int next = pc->nextbaseexp(sd); +int pc_checkbaselevelup(struct map_session_data *sd) +{ + uint64 next = pc->nextbaseexp(sd); nullpo_ret(sd); if (!next || sd->status.base_exp < next) @@ -6763,7 +6764,7 @@ void pc_baselevelchanged(struct map_session_data *sd) { int pc_checkjoblevelup(struct map_session_data *sd) { - unsigned int next = pc->nextjobexp(sd); + uint64 next = pc->nextjobexp(sd); nullpo_ret(sd); if(!next || sd->status.job_exp < next) @@ -6796,7 +6797,7 @@ int pc_checkjoblevelup(struct map_session_data *sd) /** * Alters EXP based on self bonuses that do not get shared with the party **/ -void pc_calcexp(struct map_session_data *sd, unsigned int *base_exp, unsigned int *job_exp, struct block_list *src) { +void pc_calcexp(struct map_session_data *sd, uint64 *base_exp, uint64 *job_exp, struct block_list *src) { int buff_ratio = 0, buff_job_ratio = 0, race_ratio = 0, pk_ratio = 0; int64 jexp, bexp; @@ -6861,8 +6862,8 @@ void pc_calcexp(struct map_session_data *sd, unsigned int *base_exp, unsigned in bexp += apply_percentrate64(bexp, buff_ratio, 100); jexp += apply_percentrate64(jexp, buff_ratio + buff_job_ratio, 100); - *job_exp = (unsigned int)cap_value(jexp, 1, UINT_MAX); - *base_exp = (unsigned int)cap_value(bexp, 1, UINT_MAX); + *job_exp = cap_value(jexp, 1, UINT64_MAX); + *base_exp = cap_value(bexp, 1, UINT64_MAX); } /** @@ -6871,9 +6872,10 @@ void pc_calcexp(struct map_session_data *sd, unsigned int *base_exp, unsigned in * @param is_quest Used to let client know that the EXP was from a quest (clif->displayexp) PACKETVER >= 20091027 * @retval true success **/ -bool pc_gainexp(struct map_session_data *sd, struct block_list *src, unsigned int base_exp,unsigned int job_exp,bool is_quest) { - float nextbp=0, nextjp=0; - unsigned int nextb=0, nextj=0; +bool pc_gainexp(struct map_session_data *sd, struct block_list *src, uint64 base_exp, uint64 job_exp, bool is_quest) +{ + float nextbp = 0, nextjp = 0; + uint64 nextb = 0, nextj = 0; nullpo_ret(sd); if (sd->bl.prev == NULL || pc_isdead(sd)) @@ -6889,7 +6891,7 @@ bool pc_gainexp(struct map_session_data *sd, struct block_list *src, unsigned in pc->calcexp(sd, &base_exp, &job_exp, src); if (sd->status.guild_id > 0) - base_exp -= guild->payexp(sd,base_exp); + base_exp -= guild->payexp(sd, base_exp); nextb = pc->nextbaseexp(sd); nextj = pc->nextjobexp(sd); @@ -6900,16 +6902,16 @@ bool pc_gainexp(struct map_session_data *sd, struct block_list *src, unsigned in if (nextj > 0) nextjp = (float) job_exp / (float) nextj; - if(battle_config.max_exp_gain_rate) { + if (battle_config.max_exp_gain_rate) { if (nextbp > battle_config.max_exp_gain_rate/1000.) { //Note that this value should never be greater than the original //base_exp, therefore no overflow checks are needed. [Skotlex] - base_exp = (unsigned int)(battle_config.max_exp_gain_rate/1000.*nextb); + base_exp = (uint64)(battle_config.max_exp_gain_rate / 1000. * nextb); if (sd->state.showexp) nextbp = (float) base_exp / (float) nextb; } if (nextjp > battle_config.max_exp_gain_rate/1000.) { - job_exp = (unsigned int)(battle_config.max_exp_gain_rate/1000.*nextj); + job_exp = (uint64)(battle_config.max_exp_gain_rate / 1000. * nextj); if (sd->state.showexp) nextjp = (float) job_exp / (float) nextj; } @@ -6919,23 +6921,23 @@ bool pc_gainexp(struct map_session_data *sd, struct block_list *src, unsigned in // Cap exp to the level up requirement of the previous level when you are at max level, // otherwise cap at UINT_MAX (this is required for some S. Novice bonuses). [Skotlex] if (base_exp) { - nextb = nextb?UINT_MAX:pc->thisbaseexp(sd); - if(sd->status.base_exp > nextb - base_exp) + nextb = nextb ? UINT64_MAX : pc->thisbaseexp(sd); + if (sd->status.base_exp > nextb - base_exp) sd->status.base_exp = nextb; else sd->status.base_exp += base_exp; pc->checkbaselevelup(sd); - clif->updatestatus(sd,SP_BASEEXP); + clif->updatestatus(sd, SP_BASEEXP); } if (job_exp) { - nextj = nextj?UINT_MAX:pc->thisjobexp(sd); - if(sd->status.job_exp > nextj - job_exp) + nextj = nextj ? UINT64_MAX : pc->thisjobexp(sd); + if (sd->status.job_exp > nextj - job_exp) sd->status.job_exp = nextj; else sd->status.job_exp += job_exp; pc->checkjoblevelup(sd); - clif->updatestatus(sd,SP_JOBEXP); + clif->updatestatus(sd, SP_JOBEXP); } #if PACKETVER >= 20091027 @@ -6948,7 +6950,8 @@ bool pc_gainexp(struct map_session_data *sd, struct block_list *src, unsigned in if(sd->state.showexp) { char output[256]; sprintf(output, - "Experience Gained Base:%u (%.2f%%) Job:%u (%.2f%%)",base_exp,nextbp*(float)100,job_exp,nextjp*(float)100); + "Experience Gained Base:%"PRIu64" (%.2f%%) Job:%"PRIu64" (%.2f%%)", + base_exp, nextbp * (float)100, job_exp, nextjp * (float)100); clif_disp_onlyself(sd, output); } @@ -6973,7 +6976,7 @@ int pc_maxjoblv(const struct map_session_data *sd) *------------------------------------------*/ //Base exp needed for next level. -unsigned int pc_nextbaseexp(const struct map_session_data *sd) +uint64 pc_nextbaseexp(const struct map_session_data *sd) { nullpo_ret(sd); @@ -6984,7 +6987,7 @@ unsigned int pc_nextbaseexp(const struct map_session_data *sd) } //Base exp needed for this level. -unsigned int pc_thisbaseexp(const struct map_session_data *sd) +uint64 pc_thisbaseexp(const struct map_session_data *sd) { if (sd->status.base_level > pc->maxbaselv(sd) || sd->status.base_level <= 1) return 0; @@ -7000,7 +7003,7 @@ unsigned int pc_thisbaseexp(const struct map_session_data *sd) *------------------------------------------*/ //Job exp needed for next level. -unsigned int pc_nextjobexp(const struct map_session_data *sd) +uint64 pc_nextjobexp(const struct map_session_data *sd) { nullpo_ret(sd); @@ -7010,7 +7013,7 @@ unsigned int pc_nextjobexp(const struct map_session_data *sd) } //Job exp needed for this level. -unsigned int pc_thisjobexp(const struct map_session_data *sd) +uint64 pc_thisjobexp(const struct map_session_data *sd) { if (sd->status.job_level > pc->maxjoblv(sd) || sd->status.job_level <= 1) return 0; @@ -7958,7 +7961,7 @@ int pc_dead(struct map_session_data *sd,struct block_list *src) { // activate Steel body if a super novice dies at 99+% exp [celest] if ((sd->job & MAPID_UPPERMASK) == MAPID_SUPER_NOVICE && !sd->state.snovice_dead_flag) { - unsigned int next = pc->nextbaseexp(sd); + uint64 next = pc->nextbaseexp(sd); if( next == 0 ) next = pc->thisbaseexp(sd); if (get_percentage64(sd->status.base_exp, next) >= 99) { sd->state.snovice_dead_flag = 1; @@ -8329,7 +8332,7 @@ int pc_setparam(struct map_session_data *sd, int type, int64 val) if (val >= sd->status.job_level) { if (val > pc->maxjoblv(sd)) val = pc->maxjoblv(sd); - sd->status.skill_point += val - sd->status.job_level; + sd->status.skill_point += (int)val - sd->status.job_level; clif->updatestatus(sd, SP_SKILLPOINT); } sd->status.job_level = (int32)val; @@ -8410,28 +8413,28 @@ int pc_setparam(struct map_session_data *sd, int type, int64 val) } break; case SP_STR: - sd->status.str = cap_value(val, 1, pc_maxparameter(sd)); + sd->status.str = cap_value((int)val, 1, pc_maxparameter(sd)); break; case SP_AGI: - sd->status.agi = cap_value(val, 1, pc_maxparameter(sd)); + sd->status.agi = cap_value((int)val, 1, pc_maxparameter(sd)); break; case SP_VIT: - sd->status.vit = cap_value(val, 1, pc_maxparameter(sd)); + sd->status.vit = cap_value((int)val, 1, pc_maxparameter(sd)); break; case SP_INT: - sd->status.int_ = cap_value(val, 1, pc_maxparameter(sd)); + sd->status.int_ = cap_value((int)val, 1, pc_maxparameter(sd)); break; case SP_DEX: - sd->status.dex = cap_value(val, 1, pc_maxparameter(sd)); + sd->status.dex = cap_value((int)val, 1, pc_maxparameter(sd)); break; case SP_LUK: - sd->status.luk = cap_value(val, 1, pc_maxparameter(sd)); + sd->status.luk = cap_value((int)val, 1, pc_maxparameter(sd)); break; case SP_KARMA: - sd->status.karma = val; + sd->status.karma = (int)val; break; case SP_MANNER: - sd->status.manner = val; + sd->status.manner = (int)val; if( val < 0 ) sc_start(NULL, &sd->bl, SC_NOCHAT, 100, 0, 0); else { @@ -10988,6 +10991,35 @@ int pc_split_atoui(char* str, unsigned int* val, char sep, int max) return i; } +int pc_split_atoui64(char* str, uint64* val, char sep, int max) +{ + static int warning=0; + int i,j; + nullpo_ret(val); + for (i=0; i<max; i++) { + double f; + if (!str) break; + f = atof(str); + if (f < 0) + val[i] = 0; + else if (f > UINT64_MAX) { + val[i] = UINT64_MAX; + if (!warning) { + warning = 1; + ShowWarning("pc_readdb (exp.txt): Required exp per level is capped to %"PRIu64"\n", UINT64_MAX); + } + } else + val[i] = (uint64)f; + str = strchr(str,sep); + if (str) + *str++=0; + } + //Zero up the remaining. + for(j=i; j < max; j++) + val[j] = 0; + return i; +} + /** * Parses the skill tree config file. * @@ -11295,7 +11327,7 @@ int pc_readdb(void) { count++; job = jobs[0] = pc->class2idx(job_id); //We send one less and then one more because the last entry in the exp array should hold 0. - pc->max_level[job][type] = pc_split_atoui(split[3], pc->exp_table[job][type],',',maxlv-1)+1; + pc->max_level[job][type] = pc_split_atoui64(split[3], pc->exp_table[job][type], ',', maxlv - 1) + 1; //Reverse check in case the array has a bunch of trailing zeros... [Skotlex] //The reasoning behind the -2 is this... if the max level is 5, then the array //should look like this: @@ -11932,7 +11964,7 @@ bool pc_process_chat_message(struct map_session_data *sd, const char *message) */ void pc_check_supernovice_call(struct map_session_data *sd, const char *message) { - unsigned int next = pc->nextbaseexp(sd); + uint64 next = pc->nextbaseexp(sd); int percent = 0; nullpo_retv(sd); diff --git a/src/map/pc.h b/src/map/pc.h index 46aafa5e5..50cb1b68e 100644 --- a/src/map/pc.h +++ b/src/map/pc.h @@ -829,7 +829,7 @@ struct pc_interface { /* */ BEGIN_ZEROED_BLOCK; /* Everything within this block will be memset to 0 when status_defaults() is executed */ - unsigned int exp_table[CLASS_COUNT][2][MAX_LEVEL]; + uint64 exp_table[CLASS_COUNT][2][MAX_LEVEL]; int max_level[CLASS_COUNT][2]; unsigned int statp[MAX_LEVEL+1]; unsigned int level_penalty[3][RC_MAX][MAX_LEVEL*2+1]; @@ -949,11 +949,11 @@ END_ZEROED_BLOCK; /* End */ int (*maxjoblv) (const struct map_session_data *sd); int (*checkbaselevelup) (struct map_session_data *sd); int (*checkjoblevelup) (struct map_session_data *sd); - bool (*gainexp) (struct map_session_data *sd, struct block_list *src, unsigned int base_exp, unsigned int job_exp, bool is_quest); - unsigned int (*nextbaseexp) (const struct map_session_data *sd); - unsigned int (*thisbaseexp) (const struct map_session_data *sd); - unsigned int (*nextjobexp) (const struct map_session_data *sd); - unsigned int (*thisjobexp) (const struct map_session_data *sd); + bool (*gainexp) (struct map_session_data *sd, struct block_list *src, uint64 base_exp, uint64 job_exp, bool is_quest); + uint64 (*nextbaseexp) (const struct map_session_data *sd); + uint64 (*thisbaseexp) (const struct map_session_data *sd); + uint64 (*nextjobexp) (const struct map_session_data *sd); + uint64 (*thisjobexp) (const struct map_session_data *sd); int (*gets_status_point) (int level); int (*need_status_point) (struct map_session_data *sd,int type,int val); int (*maxparameterincrease) (struct map_session_data* sd, int type); @@ -1079,7 +1079,7 @@ END_ZEROED_BLOCK; /* End */ int (*bonus_addeff) (struct s_addeffect* effect, int max, enum sc_type id, int16 rate, int16 arrow_rate, uint8 flag, uint16 duration); int (*bonus_addeff_onskill) (struct s_addeffectonskill* effect, int max, enum sc_type id, short rate, short skill_id, unsigned char target); int (*bonus_item_drop) (struct s_add_drop *drop, const short max, short id, short group, int race, int rate); - void (*calcexp) (struct map_session_data *sd, unsigned int *base_exp, unsigned int *job_exp, struct block_list *src); + void (*calcexp) (struct map_session_data *sd, uint64 *base_exp, uint64 *job_exp, struct block_list *src); int (*respawn_timer) (int tid, int64 tick, int id, intptr_t data); int (*jobchange_killclone) (struct block_list *bl, va_list ap); int (*getstat) (struct map_session_data* sd, int type); diff --git a/src/map/rodex.c b/src/map/rodex.c index 63d7242db..dcecb6b8f 100644 --- a/src/map/rodex.c +++ b/src/map/rodex.c @@ -547,13 +547,18 @@ void rodex_clean(struct map_session_data *sd, int8 flag) /// User request to open rodex, load mails from char-server /// @param sd : Who's requesting /// @param open_type : Box Type (see RODEX_OPENTYPE) -void rodex_open(struct map_session_data *sd, int8 open_type) +void rodex_open(struct map_session_data *sd, int8 open_type, int64 first_mail_id) { +#if PACKETVER >= 20170419 + const int type = 1; +#else + const int type = 0; +#endif nullpo_retv(sd); if (open_type == RODEX_OPENTYPE_ACCOUNT && battle_config.feature_rodex_use_accountmail == false) open_type = RODEX_OPENTYPE_MAIL; - intif->rodex_requestinbox(sd->status.char_id, sd->status.account_id, 0, open_type, 0); + intif->rodex_requestinbox(sd->status.char_id, sd->status.account_id, type, open_type, first_mail_id); } /// User request to read next page of mails @@ -568,7 +573,7 @@ void rodex_next_page(struct map_session_data *sd, int8 open_type, int64 last_mai if (open_type == RODEX_OPENTYPE_ACCOUNT && battle_config.feature_rodex_use_accountmail == false) { // Should not happen open_type = RODEX_OPENTYPE_MAIL; - rodex->open(sd, open_type); + rodex->open(sd, open_type, 0); return; } diff --git a/src/map/rodex.h b/src/map/rodex.h index 18ecd91d6..ddf7cb32b 100644 --- a/src/map/rodex.h +++ b/src/map/rodex.h @@ -60,7 +60,7 @@ struct rodex_interface { void (*final) (void); bool (*isenabled) (void); - void (*open) (struct map_session_data *sd, int8 open_type); + void (*open) (struct map_session_data *sd, int8 open_type, int64 first_mail_id); void (*next_page) (struct map_session_data *sd, int8 open_type, int64 last_mail_id); void (*refresh) (struct map_session_data *sd, int8 open_type, int64 first_mail_id); void (*add_item) (struct map_session_data *sd, int16 idx, int16 amount); diff --git a/src/map/script.c b/src/map/script.c index 367c9927d..1dc02bf82 100644 --- a/src/map/script.c +++ b/src/map/script.c @@ -12779,6 +12779,76 @@ BUILDIN(setmapflagnosave) { return true; } +enum mapinfo_info { + MAPINFO_NAME, + MAPINFO_ID, + MAPINFO_SIZE_X, + MAPINFO_SIZE_Y, + MAPINFO_ZONE +}; + +BUILDIN(getmapinfo) +{ + enum mapinfo_info mode = script_getnum(st, 2); + int16 m; + + if (script_hasdata(st, 3)) { + if (script_isstringtype(st, 3)) { + const char *str = script_getstr(st, 3); + m = map->mapname2mapid(str); + } else { + m = script_getnum(st, 3); + } + } else { + struct block_list *bl = NULL; + + if (st->oid) { + bl = map->id2bl(st->oid); + } else if (st->rid) { + bl = map->id2bl(st->rid); + } + + if (bl == NULL) { + ShowError("script:getmapinfo: map not supplied and NPC/PC not attached!\n"); + script_pushint(st, -3); + return false; + } + + m = bl->m; + } + + if (m < 0) { + // here we don't throw an error, so the command can be used + // to detect whether or not a map exists + script_pushint(st, -1); + return true; + } + + switch (mode) { + case MAPINFO_NAME: + script_pushconststr(st, map->list[m].name); + break; + case MAPINFO_ID: + script_pushint(st, m); + break; + case MAPINFO_SIZE_X: + script_pushint(st, map->list[m].xs); + break; + case MAPINFO_SIZE_Y: + script_pushint(st, map->list[m].ys); + break; + case MAPINFO_ZONE: + script_pushstrcopy(st, map->list[m].zone->name); + break; + default: + ShowError("script:getmapinfo: unknown option in second argument (%u).\n", mode); + script_pushint(st, -2); + return false; + } + + return true; +} + BUILDIN(getmapflag) { int16 m,i; @@ -12841,6 +12911,7 @@ BUILDIN(getmapflag) case MF_RESET: script_pushint(st,map->list[m].flag.reset); break; case MF_NOTOMB: script_pushint(st,map->list[m].flag.notomb); break; case MF_NOCASHSHOP: script_pushint(st,map->list[m].flag.nocashshop); break; + case MF_NOAUTOLOOT: script_pushint(st, map->list[m].flag.noautoloot); break; case MF_NOVIEWID: script_pushint(st,map->list[m].flag.noviewid); break; } } @@ -12965,6 +13036,7 @@ BUILDIN(setmapflag) { case MF_RESET: map->list[m].flag.reset = 1; break; case MF_NOTOMB: map->list[m].flag.notomb = 1; break; case MF_NOCASHSHOP: map->list[m].flag.nocashshop = 1; break; + case MF_NOAUTOLOOT: map->list[m].flag.noautoloot = 1; break; case MF_NOVIEWID: map->list[m].flag.noviewid = (val <= 0) ? EQP_NONE : val; break; } } @@ -13052,6 +13124,7 @@ BUILDIN(removemapflag) { case MF_RESET: map->list[m].flag.reset = 0; break; case MF_NOTOMB: map->list[m].flag.notomb = 0; break; case MF_NOCASHSHOP: map->list[m].flag.nocashshop = 0; break; + case MF_NOAUTOLOOT: map->list[m].flag.noautoloot = 0; break; case MF_NOVIEWID: map->list[m].flag.noviewid = EQP_NONE; break; } } @@ -14197,31 +14270,36 @@ BUILDIN(setequipoption) if (equip_index > 0 && equip_index <= ARRAYLENGTH(script->equip)) { if ((i = pc->checkequip(sd, script->equip[equip_index - 1])) == -1) { - ShowError("buildin_setequipoptioninfo: No equipment is equipped in the given index %d.\n", equip_index); + ShowError("buildin_setequipoption: No equipment is equipped in the given index %d.\n", equip_index); script_pushint(st, 0); return false; } } else { - ShowError("buildin_setequipoptioninfo: Invalid equipment index %d provided.\n", equip_index); + ShowError("buildin_setequipoption: Invalid equipment index %d provided.\n", equip_index); script_pushint(st, 0); return false; } if (sd->status.inventory[i].nameid != 0) { - - if ((ito = itemdb->option_exists(opt_index)) == NULL) { - script_pushint(st, 0); - ShowError("buildin_setequipotion: Option index %d does not exist!\n", opt_index); - return false; - } else if (value < -INT16_MAX || value > INT16_MAX) { - script_pushint(st, 0); - ShowError("buildin_setequipotion: Option value %d exceeds maximum limit (%d to %d) for type!\n", value, -INT16_MAX, INT16_MAX); - return false; + if (opt_index == 0) { + // Remove the option + sd->status.inventory[i].option[slot-1].index = 0; + sd->status.inventory[i].option[slot-1].value = 0; + } else { + if ((ito = itemdb->option_exists(opt_index)) == NULL) { + script_pushint(st, 0); + ShowError("buildin_setequipotion: Option index %d does not exist!\n", opt_index); + return false; + } else if (value < -INT16_MAX || value > INT16_MAX) { + script_pushint(st, 0); + ShowError("buildin_setequipotion: Option value %d exceeds maximum limit (%d to %d) for type!\n", value, -INT16_MAX, INT16_MAX); + return false; + } + /* Add Option Index */ + sd->status.inventory[i].option[slot-1].index = ito->index; + /* Add Option Value */ + sd->status.inventory[i].option[slot-1].value = value; } - /* Add Option Index */ - sd->status.inventory[i].option[slot-1].index = ito->index; - /* Add Option Value */ - sd->status.inventory[i].option[slot-1].value = value; /* Unequip and simulate deletion of the item. */ pc->unequipitem(sd, i, PCUNEQUIPITEM_FORCE); // status calc will happen in pc->equipitem() below @@ -15785,19 +15863,38 @@ BUILDIN(getmapxy) return true; } +enum logmes_type { + LOGMES_NPC, + LOGMES_ATCOMMAND +}; + /*========================================== - * Allows player to write NPC logs (i.e. Bank NPC, etc) [Lupus] + * Allows player to write logs (i.e. Bank NPC, etc) [Lupus] *------------------------------------------*/ BUILDIN(logmes) { - const char *str; + const char *str = script_getstr(st, 2); struct map_session_data *sd = script->rid2sd(st); + enum logmes_type type = LOGMES_NPC; + nullpo_retr(false, sd); - if (sd == NULL) - return true; + if (script_hasdata(st, 3)) { + type = script_getnum(st, 3); + } + + switch (type) { + case LOGMES_ATCOMMAND: + logs->atcommand(sd, str); + break; + case LOGMES_NPC: + logs->npc(sd, str); + break; + default: + ShowError("script:logmes: Unknown log type!\n"); + st->state = END; + return false; + } - str = script_getstr(st,2); - logs->npc(sd,str); return true; } @@ -18120,6 +18217,8 @@ BUILDIN(setunitdata) case UDT_INTIMACY: case UDT_LIFETIME: case UDT_MERC_KILLCOUNT: + case UDT_ROBE: + case UDT_BODY2: setunitdata_check_min(4, 0); break; case UDT_MASTERAID: @@ -19058,6 +19157,40 @@ BUILDIN(setunitdata) case UDT_DMOTION: nd->status.dmotion = (unsigned short) val; break; + case UDT_SEX: + nd->vd.sex = (char)val; + npc->refresh(nd); + break; + case UDT_HAIRSTYLE: + clif->changelook(bl, LOOK_HAIR, val); + break; + case UDT_HAIRCOLOR: + clif->changelook(bl, LOOK_HAIR_COLOR, val); + break; + case UDT_HEADBOTTOM: + clif->changelook(bl, LOOK_HEAD_BOTTOM, val); + break; + case UDT_HEADMIDDLE: + clif->changelook(bl, LOOK_HEAD_MID, val); + break; + case UDT_HEADTOP: + clif->changelook(bl, LOOK_HEAD_TOP, val); + break; + case UDT_CLOTHCOLOR: + clif->changelook(bl, LOOK_CLOTHES_COLOR, val); + break; + case UDT_SHIELD: + clif->changelook(bl, LOOK_SHIELD, val); + break; + case UDT_WEAPON: + clif->changelook(bl, LOOK_WEAPON, val); + break; + case UDT_ROBE: + clif->changelook(bl, LOOK_ROBE, val); + break; + case UDT_BODY2: + clif->changelook(bl, LOOK_BODY2, val); + break; default: ShowWarning("buildin_setunitdata: Invalid data type '%s' for NPC unit.\n", udtype); script_pushint(st, 0); @@ -19468,6 +19601,18 @@ BUILDIN(getunitdata) case UDT_AMOTION: script_pushint(st, nd->status.amotion); break; case UDT_ADELAY: script_pushint(st, nd->status.adelay); break; case UDT_DMOTION: script_pushint(st, nd->status.dmotion); break; + case UDT_SEX: script_pushint(st, nd->vd.sex); break; + case UDT_CLASS: script_pushint(st, nd->vd.class); break; + case UDT_HAIRSTYLE: script_pushint(st, nd->vd.hair_style); break; + case UDT_HAIRCOLOR: script_pushint(st, nd->vd.hair_color); break; + case UDT_HEADBOTTOM: script_pushint(st, nd->vd.head_bottom); break; + case UDT_HEADMIDDLE: script_pushint(st, nd->vd.head_mid); break; + case UDT_HEADTOP: script_pushint(st, nd->vd.head_top); break; + case UDT_CLOTHCOLOR: script_pushint(st, nd->vd.cloth_color); break; + case UDT_SHIELD: script_pushint(st, nd->vd.shield); break; + case UDT_WEAPON: script_pushint(st, nd->vd.weapon); break; + case UDT_ROBE: script_pushint(st, nd->vd.robe); break; + case UDT_BODY2: script_pushint(st, nd->vd.body_style); break; default: ShowWarning("buildin_getunitdata: Invalid data type '%s' for NPC unit.\n", udtype); script_pushint(st, 0); @@ -20355,15 +20500,18 @@ BUILDIN(questinfo) quest_id = script_getnum(st, 2); icon = script_getnum(st, 3); - #if PACKETVER >= 20120410 - if(icon < 0 || (icon > 8 && icon != 9999) || icon == 7) - icon = 9999; // Default to nothing if icon id is invalid. - #else - if(icon < 0 || icon > 7) - icon = 0; - else - icon = icon + 1; - #endif +#if PACKETVER >= 20170315 + if (icon < 0 || (icon > 10 && icon != 9999)) + icon = 9999; +#elif PACKETVER >= 20120410 + if (icon < 0 || (icon > 8 && icon != 9999) || icon == 7) + icon = 9999; // Default to nothing if icon id is invalid. +#else + if (icon < 0 || icon > 7) + icon = 0; + else + icon = icon + 1; +#endif qi.quest_id = quest_id; qi.icon = (unsigned char)icon; @@ -20557,15 +20705,18 @@ BUILDIN(showevent) } } - #if PACKETVER >= 20120410 - if(icon < 0 || (icon > 8 && icon != 9999) || icon == 7) - icon = 9999; // Default to nothing if icon id is invalid. - #else - if(icon < 0 || icon > 7) - icon = 0; - else - icon = icon + 1; - #endif +#if PACKETVER >= 20170315 + if (icon < 0 || (icon > 10 && icon != 9999)) + icon = 9999; +#elif PACKETVER >= 20120410 + if (icon < 0 || (icon > 8 && icon != 9999) || icon == 7) + icon = 9999; // Default to nothing if icon id is invalid. +#else + if (icon < 0 || icon > 7) + icon = 0; + else + icon = icon + 1; +#endif clif->quest_show_event(sd, &nd->bl, icon, color); return true; @@ -21037,72 +21188,90 @@ BUILDIN(has_instance) const char *str; int16 m; int instance_id = -1; + int i = 0, j = 0; bool type = strcmp(script->getfuncname(st),"has_instance2") == 0 ? true : false; str = script_getstr(st, 2); - if( (m = map->mapname2mapid(str)) < 0 ) { - if( type ) + if ((m = map->mapname2mapid(str)) < 0) { + if (type) { script_pushint(st, -1); - else + } else { script_pushconststr(st, ""); + } return true; } - if( script_hasdata(st, 3) ) + if (script_hasdata(st, 3)) instance_id = script_getnum(st, 3); - else if( st->instance_id >= 0 ) + else if (st->instance_id >= 0) instance_id = st->instance_id; - else if( (sd = script->rid2sd(st)) != NULL ) { + else if ((sd = script->rid2sd(st)) != NULL) { struct party_data *p; - int i = 0, j = 0; - if( sd->instances ) { - for( i = 0; i < sd->instances; i++ ) { - if( sd->instance[i] >= 0 ) { + if (sd->instances) { + for (i = 0; i < sd->instances; i++) { + if (sd->instance[i] >= 0) { ARR_FIND(0, instance->list[sd->instance[i]].num_map, j, map->list[instance->list[sd->instance[i]].map[j]].instance_src_map == m); - if( j != instance->list[sd->instance[i]].num_map ) + if (j != instance->list[sd->instance[i]].num_map) break; } } - if( i != sd->instances ) + if (i != sd->instances) { instance_id = sd->instance[i]; + } } if (instance_id == -1 && sd->status.party_id && (p = party->search(sd->status.party_id)) != NULL && p->instances) { - for( i = 0; i < p->instances; i++ ) { - if( p->instance[i] >= 0 ) { + for (i = 0; i < p->instances; i++) { + if (p->instance[i] >= 0) { ARR_FIND(0, instance->list[p->instance[i]].num_map, j, map->list[instance->list[p->instance[i]].map[j]].instance_src_map == m); - if( j != instance->list[p->instance[i]].num_map ) + if (j != instance->list[p->instance[i]].num_map) break; } } - if( i != p->instances ) + if (i != p->instances) { instance_id = p->instance[i]; + } } - if( instance_id == -1 && sd->guild && sd->guild->instances ) { - for( i = 0; i < sd->guild->instances; i++ ) { - if( sd->guild->instance[i] >= 0 ) { + if (instance_id == -1 && sd->guild && sd->guild->instances) { + for (i = 0; i < sd->guild->instances; i++) { + if (sd->guild->instance[i] >= 0) { ARR_FIND(0, instance->list[sd->guild->instance[i]].num_map, j, map->list[instance->list[sd->guild->instance[i]].map[j]].instance_src_map == m); - if( j != instance->list[sd->guild->instance[i]].num_map ) + if (j != instance->list[sd->guild->instance[i]].num_map) break; } } - if( i != sd->guild->instances ) + if (i != sd->guild->instances) instance_id = sd->guild->instance[i]; } } - if( !instance->valid(instance_id) || (m = instance->map2imap(m, instance_id)) < 0 ) { - if( type ) + if (instance_id == -1) { + for (i = 0; i < instance->instances; i++) { + if (instance->list[i].state != INSTANCE_FREE && instance->list[i].owner_type == IOT_NONE && instance->list[i].num_map > 0) { + ARR_FIND(0, instance->list[i].num_map, j, map->list[instance->list[i].map[j]].instance_src_map == m); + if (j != instance->list[i].num_map) + break; + } + } + if (i != instance->instances) { + instance_id = instance->list[i].id; + } + } + + if (!instance->valid(instance_id) || (m = instance->map2imap(m, instance_id)) < 0) { + if (type) { script_pushint(st, -1); - else + } else { script_pushconststr(st, ""); + } return true; } - if( type ) + if (type) { script_pushint(st, instance_id); - else + } else { script_pushconststr(st, map->list[m].name); + } return true; } @@ -23414,7 +23583,7 @@ BUILDIN(dressroom) clif->dressroom_open(sd, 0); break; default: - ShowWarning("script:dressroom: unknown mode (%i).\n", mode); + ShowWarning("script:dressroom: unknown mode (%u).\n", mode); script_pushint(st, 0); return false; } @@ -23994,6 +24163,7 @@ void script_parse_builtin(void) { BUILDIN_DEF(isloggedin,"i?"), BUILDIN_DEF(setmapflagnosave,"ssii"), BUILDIN_DEF(getmapflag,"si"), + BUILDIN_DEF(getmapinfo,"i?"), BUILDIN_DEF(setmapflag,"si?"), BUILDIN_DEF(removemapflag,"si"), BUILDIN_DEF(pvpon,"s"), @@ -24070,7 +24240,7 @@ void script_parse_builtin(void) { BUILDIN_DEF(checkoption2,"i?"), BUILDIN_DEF(guildgetexp,"i"), BUILDIN_DEF(guildchangegm,"is"), - BUILDIN_DEF(logmes,"s"), //this command actls as MES but rints info into LOG file either SQL/TXT [Lupus] + BUILDIN_DEF(logmes,"s?"), //this command actls as MES but rints info into LOG file either SQL/TXT [Lupus] BUILDIN_DEF(summon,"si??"), // summons a slave monster [Celest] BUILDIN_DEF(isnight,""), // check whether it is night time [Celest] BUILDIN_DEF(isequipped,"i*"), // check whether another item/card has been equipped [Celest] @@ -24597,6 +24767,10 @@ void script_hardcoded_constants(void) script->set_constant("DATATYPE_VAR", DATATYPE_VAR, false, false); script->set_constant("DATATYPE_LABEL", DATATYPE_LABEL, false, false); + script->constdb_comment("Logmes types"); + script->set_constant("LOGMES_NPC", LOGMES_NPC, false, false); + script->set_constant("LOGMES_ATCOMMAND", LOGMES_ATCOMMAND, false, false); + script->constdb_comment("Item Subtypes (Weapon types)"); script->set_constant("W_FIST", W_FIST, false, false); script->set_constant("W_DAGGER", W_DAGGER, false, false); @@ -24648,6 +24822,13 @@ void script_hardcoded_constants(void) script->set_constant("DRESSROOM_OPEN", DRESSROOM_OPEN, false, false); script->set_constant("DRESSROOM_CLOSE", DRESSROOM_CLOSE, false, false); + script->constdb_comment("getmapinfo options"); + script->set_constant("MAPINFO_NAME", MAPINFO_NAME, false, false); + script->set_constant("MAPINFO_ID", MAPINFO_ID, false, false); + script->set_constant("MAPINFO_SIZE_X", MAPINFO_SIZE_X, false, false); + script->set_constant("MAPINFO_SIZE_Y", MAPINFO_SIZE_Y, false, false); + script->set_constant("MAPINFO_ZONE", MAPINFO_ZONE, false, false); + script->constdb_comment("Renewal"); #ifdef RENEWAL script->set_constant("RENEWAL", 1, false, false); diff --git a/src/map/script.h b/src/map/script.h index 189122230..b2ab7510c 100644 --- a/src/map/script.h +++ b/src/map/script.h @@ -336,6 +336,7 @@ enum { MF_RESET, MF_NOTOMB, MF_NOCASHSHOP, + MF_NOAUTOLOOT, MF_NOVIEWID }; @@ -422,6 +423,8 @@ enum script_unit_data_types { UDT_LIFETIME, UDT_MERC_KILLCOUNT, UDT_STATPOINT, + UDT_ROBE, + UDT_BODY2, UDT_MAX }; diff --git a/src/map/skill.c b/src/map/skill.c index a84955377..726deaa9a 100644 --- a/src/map/skill.c +++ b/src/map/skill.c @@ -13832,8 +13832,8 @@ int skill_check_condition_castbegin(struct map_session_data* sd, uint16 skill_id break; case PR_REDEMPTIO: { - int exp; - if( ((exp = pc->nextbaseexp(sd)) > 0 && get_percentage64(sd->status.base_exp, exp) < 1) || + int64 exp; + if (((exp = pc->nextbaseexp(sd)) > 0 && get_percentage64(sd->status.base_exp, exp) < 1) || ((exp = pc->nextjobexp(sd)) > 0 && get_percentage64(sd->status.job_exp, exp) < 1)) { clif->skill_fail(sd,skill_id,USESKILL_FAIL_LEVEL,0); //Not enough exp. return 0; @@ -18984,7 +18984,8 @@ void skill_init_unit_layout (void) void skill_init_unit_layout_unknown(int skill_idx) { - ShowError("unknown unit layout at skill %d\n", skill_idx); + Assert_retv(skill_idx >= 0 && skill_idx < MAX_SKILL_DB); + ShowError("unknown unit layout at skill %d\n", skill->dbs->db[skill_idx].nameid); } int skill_block_check(struct block_list *bl, sc_type type , uint16 skill_id) diff --git a/src/map/status.c b/src/map/status.c index e0893aa36..ccd1e6b11 100644 --- a/src/map/status.c +++ b/src/map/status.c @@ -6809,7 +6809,7 @@ struct view_data *status_get_viewdata(struct block_list *bl) case BL_PC: return &BL_UCAST(BL_PC, bl)->vd; case BL_MOB: return BL_UCAST(BL_MOB, bl)->vd; case BL_PET: return &BL_UCAST(BL_PET, bl)->vd; - case BL_NPC: return BL_UCAST(BL_NPC, bl)->vd; + case BL_NPC: return &BL_UCAST(BL_NPC, bl)->vd; case BL_HOM: return BL_UCAST(BL_HOM, bl)->vd; case BL_MER: return BL_UCAST(BL_MER, bl)->vd; case BL_ELEM: return BL_UCAST(BL_ELEM, bl)->vd; @@ -6927,10 +6927,14 @@ void status_set_viewdata(struct block_list *bl, int class_) case BL_NPC: { struct npc_data *nd = BL_UCAST(BL_NPC, bl); - if (vd != NULL) - nd->vd = vd; - else + if (vd != NULL) { + memcpy(&nd->vd, vd, sizeof(struct view_data)); + } else if (pc->db_checkid(class_)) { + memset(&nd->vd, 0, sizeof(struct view_data)); + nd->vd.class = class_; + } else { ShowError("status_set_viewdata (NPC): No view data for class %d (name=%s)\n", class_, nd->name); + } } break; case BL_HOM: //[blackhole89] diff --git a/src/map/status.h b/src/map/status.h index eb3cf491b..a104c66ab 100644 --- a/src/map/status.h +++ b/src/map/status.h @@ -1927,7 +1927,7 @@ enum e_mode //who were not on your field of sight when it happened) //opt1: Non stackable status changes. -enum { +enum e_opt1 { OPT1_STONE = 1, //Petrified OPT1_FREEZE, OPT1_STUN, @@ -1940,7 +1940,7 @@ enum { }; //opt2: Stackable status changes. -enum { +enum e_opt2 { OPT2_POISON = 0x0001, OPT2_CURSE = 0x0002, OPT2_SILENCE = 0x0004, @@ -1953,7 +1953,7 @@ enum { }; //opt3: (SHOW_EFST_*) -enum { +enum e_opt3 { OPT3_NORMAL = 0x00000000, OPT3_QUICKEN = 0x00000001, OPT3_OVERTHRUST = 0x00000002, diff --git a/src/map/unit.c b/src/map/unit.c index 00c78054b..0b5b21caf 100644 --- a/src/map/unit.c +++ b/src/map/unit.c @@ -474,7 +474,7 @@ int unit_walktoxy_timer(int tid, int64 tick, int id, intptr_t data) ud->to_x = bl->x; ud->to_y = bl->y; - if(battle_config.official_cell_stack_limit && map->count_oncell(bl->m, x, y, BL_CHAR|BL_NPC, 1) > battle_config.official_cell_stack_limit) { + if (battle_config.official_cell_stack_limit && map->count_oncell(bl->m, x, y, BL_CHAR|BL_NPC, 0x1 | 0x2) > battle_config.official_cell_stack_limit) { //Walked on occupied cell, call unit_walktoxy again if(ud->steptimer != INVALID_TIMER) { //Execute step timer on next step instead |