diff options
Diffstat (limited to 'src/map')
-rw-r--r-- | src/map/clif.c | 26 | ||||
-rw-r--r-- | src/map/clif.h | 1 | ||||
-rw-r--r-- | src/map/intif.c | 22 | ||||
-rw-r--r-- | src/map/packets_struct.h | 10 | ||||
-rw-r--r-- | src/map/script.c | 23 | ||||
-rw-r--r-- | src/map/skill.c | 25 | ||||
-rw-r--r-- | src/map/skill.h | 3 |
7 files changed, 83 insertions, 27 deletions
diff --git a/src/map/clif.c b/src/map/clif.c index 6629eb500..c79a4a1c6 100644 --- a/src/map/clif.c +++ b/src/map/clif.c @@ -9923,7 +9923,6 @@ void clif_parse_Hotkey(int fd, struct map_session_data *sd) { /// Displays cast-like progress bar (ZC_PROGRESS). /// 02f0 <color>.L <time>.L -/* TODO ZC_PROGRESS_ACTOR <account_id>.L */ void clif_progressbar(struct map_session_data * sd, unsigned int color, unsigned int second) { int fd; @@ -9952,6 +9951,30 @@ void clif_progressbar_abort(struct map_session_data * sd) WFIFOSET(fd,packet_len(0x2f2)); } +/** +* Displays cast-like progress bar on a unit. +* 09d1 <id>.L <color>.L <time>.L +* +* @param bl Source block list. +* @param color Message color (RGB format: 0xRRGGBB). +* @param time Time in seconds. +*/ +void clif_progressbar_unit(struct block_list *bl, uint32 color, uint32 time) +{ +#if PACKETVER >= 20130821 + struct ZC_PROGRESS_ACTOR p; + nullpo_retv(bl); + + p.PacketType = progressbarunit; + p.GID = bl->id; + p.color = color; + p.time = time; + clif->send(&p, sizeof(p), bl, AREA); +#else + ShowWarning("clif_progressbar_unit: Using progressbar with units available for PACKETVER >= 20130821 only."); +#endif +} + void clif_parse_progressbar(int fd, struct map_session_data * sd) __attribute__((nonnull (2))); /// Notification from the client, that the progress bar has reached 100% (CZ_PROGRESS). /// 02f1 @@ -20375,6 +20398,7 @@ void clif_defaults(void) { clif->font = clif_font; clif->progressbar = clif_progressbar; clif->progressbar_abort = clif_progressbar_abort; + clif->progressbar_unit = clif_progressbar_unit; clif->showdigit = clif_showdigit; clif->elementalconverter_list = clif_elementalconverter_list; clif->spellbook_list = clif_spellbook_list; diff --git a/src/map/clif.h b/src/map/clif.h index e348bbb08..69567cc2c 100644 --- a/src/map/clif.h +++ b/src/map/clif.h @@ -796,6 +796,7 @@ struct clif_interface { 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); + void (*progressbar_unit) (struct block_list *bl, uint32 color, uint32 time); void (*showdigit) (struct map_session_data* sd, unsigned char type, int value); int (*elementalconverter_list) (struct map_session_data *sd); int (*spellbook_list) (struct map_session_data *sd); diff --git a/src/map/intif.c b/src/map/intif.c index 60edc8d8b..be6b75d96 100644 --- a/src/map/intif.c +++ b/src/map/intif.c @@ -2438,7 +2438,8 @@ void intif_parse_RequestRodexOpenInbox(int fd) #endif int8 flag = RFIFOB(fd, 9); int8 is_end = RFIFOB(fd, 10); - int count = RFIFOL(fd, 11); + int is_first = RFIFOB(fd, 11); + int count = RFIFOL(fd, 12); int i, j; sd = map->charid2sd(RFIFOL(fd, 4)); @@ -2446,16 +2447,25 @@ void intif_parse_RequestRodexOpenInbox(int fd) if (sd == NULL) // user is not online anymore return; - sd->rodex.total = count; - if (RFIFOW(fd, 2) - 15 != sd->rodex.total * sizeof(struct rodex_message)) { - ShowError("intif_parse_RodexInboxOpenReceived: data size mismatch %d != %"PRIuS"\n", RFIFOW(fd, 2) - 15, sd->rodex.total * sizeof(struct rodex_message)); + if (is_first == false && sd->rodex.total == 0) { + ShowError("intif_parse_RodexInboxOpenReceived: mail list received in wrong order.\n"); return; } - if (flag == 0) + if (is_first) + sd->rodex.total = count; + else + sd->rodex.total += count; + + if (RFIFOW(fd, 2) - 16 != count * sizeof(struct rodex_message)) { + ShowError("intif_parse_RodexInboxOpenReceived: data size mismatch %d != %"PRIuS"\n", RFIFOW(fd, 2) - 16, count * sizeof(struct rodex_message)); + return; + } + + if (flag == 0 && is_first) VECTOR_CLEAR(sd->rodex.messages); - for (i = 0, j = 15; i < count; ++i, j += sizeof(struct rodex_message)) { + for (i = 0, j = 16; i < count; ++i, j += sizeof(struct rodex_message)) { struct rodex_message msg = { 0 }; VECTOR_ENSURE(sd->rodex.messages, 1, 1); memcpy(&msg, RFIFOP(fd, j), sizeof(struct rodex_message)); diff --git a/src/map/packets_struct.h b/src/map/packets_struct.h index f253b8906..cfeb3a67d 100644 --- a/src/map/packets_struct.h +++ b/src/map/packets_struct.h @@ -335,6 +335,9 @@ enum packet_headers { #if PACKETVER >= 20151223 skillscale = 0xA41, #endif +#if PACKETVER >= 20130821 + progressbarunit = 0x09D1, +#endif }; #if !defined(sun) && (!defined(__NETBSD__) || __NetBSD_Version__ >= 600000000) // NetBSD 5 and Solaris don't like pragma pack but accept the packed attribute @@ -1497,6 +1500,13 @@ struct PACKET_ZC_SKILL_SCALE { uint32 casttime; } __attribute__((packed)); +struct ZC_PROGRESS_ACTOR { + int16 PacketType; + int32 GID; + int32 color; + uint32 time; +} __attribute__((packed)); + #if !defined(sun) && (!defined(__NETBSD__) || __NetBSD_Version__ >= 600000000) // NetBSD 5 and Solaris don't like pragma pack but accept the packed attribute #pragma pack(pop) #endif // not NetBSD < 6 / Solaris diff --git a/src/map/script.c b/src/map/script.c index d5a0e4864..d7a65f554 100644 --- a/src/map/script.c +++ b/src/map/script.c @@ -21570,7 +21570,29 @@ BUILDIN(progressbar) clif->progressbar(sd, (unsigned int)strtoul(color, (char **)NULL, 0), second); return true; } +BUILDIN(progressbar_unit) +{ + const char *color = script_getstr(st, 2); + uint32 second = script_getnum(st, 3); + + if (script_hasdata(st, 4)) { + struct block_list *bl = map->id2bl(script_getnum(st, 4)); + if (bl == NULL) { + ShowWarning("buildin_progressbar_unit: Error in finding object with given GID %d!\n", script_getnum(st, 4)); + return true; + } + clif->progressbar_unit(bl, (unsigned int)strtoul(color, (char **)NULL, 0), second); + } else { + struct map_session_data *sd = script->rid2sd(st); + + if (sd == NULL) + return false; + + clif->progressbar_unit(&sd->bl, (unsigned int)strtoul(color, (char **)NULL, 0), second); + } + return true; +} BUILDIN(pushpc) { uint8 dir; @@ -24405,6 +24427,7 @@ void script_parse_builtin(void) { BUILDIN_DEF(setfont,"i"), BUILDIN_DEF(areamobuseskill,"siiiiviiiii"), BUILDIN_DEF(progressbar,"si"), + BUILDIN_DEF(progressbar_unit,"si?"), BUILDIN_DEF(pushpc,"ii"), BUILDIN_DEF(buyingstore,"i"), BUILDIN_DEF(searchstores,"ii"), diff --git a/src/map/skill.c b/src/map/skill.c index 25ea0a8ba..4c9e83579 100644 --- a/src/map/skill.c +++ b/src/map/skill.c @@ -987,7 +987,7 @@ int can_copy (struct map_session_data *sd, uint16 skill_id, struct block_list* b (skill_id >= GC_DARKCROW && skill_id <= SU_FRESHSHRIMP))) return 0; // Reproduce will only copy skills according on the list. [Jobbie] - else if( sd->sc.data[SC__REPRODUCE] && !skill->dbs->reproduce_db[skill->get_index(skill_id)] ) + else if (sd->sc.data[SC__REPRODUCE] && (skill->get_inf2(skill_id) & INF2_ALLOW_REPRODUCE) == 0) return 0; return 1; @@ -19849,21 +19849,6 @@ bool skill_parse_row_magicmushroomdb(char* split[], int column, int current) return true; } -bool skill_parse_row_reproducedb(char* split[], int column, int current) -{ - uint16 skill_id; - uint16 idx; - nullpo_retr(false, split); - skill_id = atoi(split[0]); - idx = skill->get_index(skill_id); - if( !idx ) - return false; - - skill->dbs->reproduce_db[idx] = true; - - return true; -} - bool skill_parse_row_abradb(char* split[], int columns, int current) { // skill_id,DummyName,RequiredHocusPocusLevel,Rate @@ -20168,6 +20153,12 @@ void skill_validate_skillinfo(struct config_setting_t *conf, struct s_skill_db * } else { sk->inf2 &= ~INF2_SHOW_SKILL_SCALE; } + } else if (strcmpi(type, "AllowReproduce") == 0) { + if (on) { + sk->inf2 |= INF2_ALLOW_REPRODUCE; + } else { + sk->inf2 &= ~INF2_ALLOW_REPRODUCE; + } } else if (strcmpi(type, "None") != 0) { skilldb_invalid_error(type, config_setting_name(t), sk->nameid); } @@ -21280,7 +21271,6 @@ void skill_readdb(bool minimal) sv->readdb(map->db_path, "spellbook_db.txt", ',', 3, 3, MAX_SKILL_SPELLBOOK_DB, skill->parse_row_spellbookdb); //Guillotine Cross sv->readdb(map->db_path, "magicmushroom_db.txt", ',', 1, 1, MAX_SKILL_MAGICMUSHROOM_DB, skill->parse_row_magicmushroomdb); - sv->readdb(map->db_path, "skill_reproduce_db.txt", ',', 1, 1, MAX_SKILL_DB, skill->parse_row_reproducedb); sv->readdb(map->db_path, "skill_improvise_db.txt", ',', 2, 2, MAX_SKILL_IMPROVISE_DB, skill->parse_row_improvisedb); sv->readdb(map->db_path, "skill_changematerial_db.txt", ',', 4, 4+2*5, MAX_SKILL_PRODUCE_DB, skill->parse_row_changematerialdb); } @@ -21594,7 +21584,6 @@ void skill_defaults(void) skill->parse_row_abradb = skill_parse_row_abradb; skill->parse_row_spellbookdb = skill_parse_row_spellbookdb; skill->parse_row_magicmushroomdb = skill_parse_row_magicmushroomdb; - skill->parse_row_reproducedb = skill_parse_row_reproducedb; skill->parse_row_improvisedb = skill_parse_row_improvisedb; skill->parse_row_changematerialdb = skill_parse_row_changematerialdb; skill->usave_add = skill_usave_add; diff --git a/src/map/skill.h b/src/map/skill.h index 1e00e488f..c494c0e83 100644 --- a/src/map/skill.h +++ b/src/map/skill.h @@ -123,6 +123,7 @@ enum e_skill_inf2 { INF2_FREE_CAST_NORMAL = 0x08000, INF2_FREE_CAST_REDUCED = 0x10000, INF2_SHOW_SKILL_SCALE = 0x20000, + INF2_ALLOW_REPRODUCE = 0x40000, }; @@ -1897,7 +1898,6 @@ BEGIN_ZEROED_BLOCK; // This block will be zeroed in skill_defaults() as well as struct s_skill_improvise_db improvise_db[MAX_SKILL_IMPROVISE_DB]; struct s_skill_changematerial_db changematerial_db[MAX_SKILL_PRODUCE_DB]; struct s_skill_spellbook_db spellbook_db[MAX_SKILL_SPELLBOOK_DB]; - bool reproduce_db[MAX_SKILL_DB]; END_ZEROED_BLOCK; struct s_skill_unit_layout unit_layout[MAX_SKILL_UNIT_LAYOUT]; }; @@ -2121,7 +2121,6 @@ struct skill_interface { bool (*parse_row_abradb) (char* split[], int columns, int current); bool (*parse_row_spellbookdb) (char* split[], int columns, int current); bool (*parse_row_magicmushroomdb) (char* split[], int column, int current); - bool (*parse_row_reproducedb) (char* split[], int column, int current); bool (*parse_row_improvisedb) (char* split[], int columns, int current); bool (*parse_row_changematerialdb) (char* split[], int columns, int current); /* save new unit skill */ |