summaryrefslogtreecommitdiff
path: root/src/map
diff options
context:
space:
mode:
Diffstat (limited to 'src/map')
-rw-r--r--src/map/atcommand.c2
-rw-r--r--src/map/clif.c13
-rw-r--r--src/map/packets.h4
-rw-r--r--src/map/packets_struct.h3
-rw-r--r--src/map/pc.c10
-rw-r--r--src/map/pc.h1
-rw-r--r--src/map/pet.c14
-rw-r--r--src/map/script.c12
-rw-r--r--src/map/script.h2
-rw-r--r--src/map/skill.c3
10 files changed, 52 insertions, 12 deletions
diff --git a/src/map/atcommand.c b/src/map/atcommand.c
index 79bd92213..3ec709b57 100644
--- a/src/map/atcommand.c
+++ b/src/map/atcommand.c
@@ -4222,6 +4222,8 @@ ACMD(repairall)
count = 0;
for (i = 0; i < MAX_INVENTORY; i++) {
+ if (sd->status.inventory[i].card[0] == CARD0_PET)
+ continue;
if (sd->status.inventory[i].nameid && (sd->status.inventory[i].attribute & ATTR_BROKEN) != 0) {
sd->status.inventory[i].attribute |= ATTR_BROKEN;
sd->status.inventory[i].attribute ^= ATTR_BROKEN;
diff --git a/src/map/clif.c b/src/map/clif.c
index 2a2d87ccc..82507a84a 100644
--- a/src/map/clif.c
+++ b/src/map/clif.c
@@ -7244,6 +7244,7 @@ static void clif_sendegg(struct map_session_data *sd)
/// 3 = accessory
/// 4 = performance (data = 1~3: normal, 4: special)
/// 5 = hairstyle
+/// 6 = close egg selection ui and update egg in inventory (PACKETVER >= 20180704)
///
/// If sd is null, the update is sent to nearby objects, otherwise it is sent only to that player.
static void clif_send_petdata(struct map_session_data *sd, struct pet_data *pd, int type, int param)
@@ -21198,7 +21199,7 @@ static bool clif_stylist_read_db_libconfig_sub(struct config_setting_t *it, int
ShowWarning("clif_stylist_read_db_libconfig_sub: Invalid or missing Type (%d) in \"%s\", entry #%d, skipping.\n", type, source, idx);
return false;
}
- if (!itemdb->lookup_const(it, "Id", &i32) || i32 <= 0) {
+ if (!itemdb->lookup_const(it, "Id", &i32) || i32 < 0) {
ShowWarning("clif_stylist_read_db_libconfig_sub: Invalid or missing Id (%d) in \"%s\", entry #%d, skipping.\n", i32, source, idx);
return false;
}
@@ -21235,7 +21236,7 @@ static bool clif_style_change_validate_requirements(struct map_session_data *sd,
entry = &VECTOR_INDEX(stylist_data[type], idx);
- if (entry->id != 0) {
+ if (entry->id >= 0) {
if (entry->zeny != 0) {
if (sd->status.zeny < entry->zeny)
return false;
@@ -21293,7 +21294,13 @@ static void clif_parse_cz_req_style_change(int fd, struct map_session_data *sd)
clif->cz_req_style_change_sub(sd, LOOK_HEAD_MID, p->MidAccessory, true);
if (p->BottomAccessory > 0)
clif->cz_req_style_change_sub(sd, LOOK_HEAD_BOTTOM, p->BottomAccessory, true);
-
+#if PACKETVER_RE_NUM >= 20180718
+ if (p->BodyStyle > 0) {
+ if (pc->has_second_costume(sd)) {
+ clif->cz_req_style_change_sub(sd, LOOK_BODY2, p->BodyStyle, false);
+ }
+ }
+#endif
clif->style_change_response(sd, STYLIST_SHOP_SUCCESS);
return;
}
diff --git a/src/map/packets.h b/src/map/packets.h
index d4f87f5a0..8ef011d08 100644
--- a/src/map/packets.h
+++ b/src/map/packets.h
@@ -4121,7 +4121,7 @@ packet(0x96e,-1,clif->ackmergeitems);
// 2018-05-16cRagexe, 2018-05-16cRagexeRE
#if PACKETVER >= 20180516
// new packets
- packet(0x0afc,16,clif->pDull/*,XXX*/);
+ packet(0x0afc,16,clif->pReqStyleChange);
// changed packet sizes
#endif
#endif // PACKETVER_ZERO
@@ -4130,7 +4130,7 @@ packet(0x96e,-1,clif->ackmergeitems);
// 2018-05-23aRagexe_zero
#if PACKETVER >= 20180523
// new packets
- packet(0x0afc,16,clif->pDull/*,XXX*/);
+ packet(0x0afc,16,clif->pReqStyleChange);
// changed packet sizes
#endif
#endif // PACKETVER_ZERO
diff --git a/src/map/packets_struct.h b/src/map/packets_struct.h
index 9ae99afda..e8207d29c 100644
--- a/src/map/packets_struct.h
+++ b/src/map/packets_struct.h
@@ -1864,6 +1864,9 @@ struct PACKET_CZ_REQ_STYLE_CHANGE {
int16 TopAccessory;
int16 MidAccessory;
int16 BottomAccessory;
+#if PACKETVER_RE_NUM >= 20180718
+ int16 BodyStyle;
+#endif
} __attribute__((packed));
struct PACKET_ZC_STYLE_CHANGE_RES {
diff --git a/src/map/pc.c b/src/map/pc.c
index f2cff8ab3..d89abcca8 100644
--- a/src/map/pc.c
+++ b/src/map/pc.c
@@ -12277,6 +12277,15 @@ static void pc_init_exp_groups(void)
}
}
+static bool pc_has_second_costume(struct map_session_data *sd)
+{
+ nullpo_retr(false, sd);
+
+ if ((sd->job & JOBL_THIRD) != 0)
+ return true;
+ return false;
+}
+
static void do_final_pc(void)
{
@@ -12678,4 +12687,5 @@ void pc_defaults(void)
pc->check_basicskill = pc_check_basicskill;
pc->isDeathPenaltyJob = pc_isDeathPenaltyJob;
+ pc->has_second_costume = pc_has_second_costume;
}
diff --git a/src/map/pc.h b/src/map/pc.h
index 622dcf3f7..0781fe801 100644
--- a/src/map/pc.h
+++ b/src/map/pc.h
@@ -1179,6 +1179,7 @@ END_ZEROED_BLOCK; /* End */
void (*check_supernovice_call) (struct map_session_data *sd, const char *message);
bool (*check_basicskill) (struct map_session_data *sd, int level);
bool (*isDeathPenaltyJob) (uint16 job);
+ bool (*has_second_costume) (struct map_session_data *sd);
};
#ifdef HERCULES_CORE
diff --git a/src/map/pet.c b/src/map/pet.c
index e544905c0..d1d8a5a33 100644
--- a/src/map/pet.c
+++ b/src/map/pet.c
@@ -345,10 +345,13 @@ static int pet_return_egg(struct map_session_data *sd, struct pet_data *pd)
pd->pet.pet_id == MakeDWord(sd->status.inventory[i].card[1], sd->status.inventory[i].card[2]));
if (i != MAX_INVENTORY) {
- sd->status.inventory[i].identify = 1;
+ sd->status.inventory[i].attribute &= ~ATTR_BROKEN;
sd->status.inventory[i].bound = IBT_NONE;
}
-
+#if PACKETVER >= 20180704
+ clif->inventorylist(sd);
+ clif->send_petdata(sd, pd, 6, 0);
+#endif
pd->pet.incubate = 1;
unit->free(&pd->bl,CLR_OUTSIGHT);
@@ -462,6 +465,9 @@ static int pet_birth_process(struct map_session_data *sd, struct s_pet *petinfo)
clif->spawn(&sd->pd->bl);
clif->send_petdata(sd,sd->pd, 0,0);
clif->send_petdata(sd,sd->pd, 5,battle_config.pet_hair_style);
+#if PACKETVER >= 20180704
+ clif->send_petdata(sd, sd->pd, 6, 1);
+#endif
clif->send_petdata(NULL, sd->pd, 3, sd->pd->vd.head_bottom);
clif->send_petstatus(sd);
}
@@ -496,8 +502,8 @@ static int pet_recv_petdata(int account_id, struct s_pet *p, int flag)
if (!pet->birth_process(sd,p)) {
- // Pet Evolution, Hide the egg by setting identify to 0 [Dastgir/Hercules]
- sd->status.inventory[i].identify = 0;
+ // Pet Evolution, Hide the egg by setting broken attribute (0x2) [Asheraf]
+ sd->status.inventory[i].attribute |= ATTR_BROKEN;
// bind the egg to the character to avoid moving it via forged packets [Asheraf]
sd->status.inventory[i].bound = IBT_CHARACTER;
}
diff --git a/src/map/script.c b/src/map/script.c
index 9a5d33604..24d03bbe2 100644
--- a/src/map/script.c
+++ b/src/map/script.c
@@ -4929,7 +4929,7 @@ static void script_setarray_pc(struct map_session_data *sd, const char *varname,
{
int key;
- if( idx >= SCRIPT_MAX_ARRAYSIZE ) {
+ if (idx > SCRIPT_MAX_ARRAYSIZE) {
ShowError("script_setarray_pc: Variable '%s' has invalid index '%u' (char_id=%d).\n", varname, idx, sd->status.char_id);
return;
}
@@ -7540,7 +7540,7 @@ static BUILDIN(getelementofarray)
id = reference_getid(data);
i = script_getnum(st, 3);
- if (i < 0 || i >= SCRIPT_MAX_ARRAYSIZE) {
+ if (i < 0 || i > SCRIPT_MAX_ARRAYSIZE) {
ShowWarning("script:getelementofarray: index out of range (%"PRId64")\n", i);
script->reportdata(data);
script_pushnil(st);
@@ -9245,6 +9245,8 @@ static BUILDIN(getbrokenid)
num=script_getnum(st,2);
for(i=0; i<MAX_INVENTORY; i++) {
+ if (sd->status.inventory[i].card[0] == CARD0_PET)
+ continue;
if ((sd->status.inventory[i].attribute & ATTR_BROKEN) != 0) {
brokencounter++;
if(num==brokencounter) {
@@ -9270,6 +9272,8 @@ static BUILDIN(getbrokencount)
return true;
for (i = 0; i < MAX_INVENTORY; i++) {
+ if (sd->status.inventory[i].card[0] == CARD0_PET)
+ continue;
if ((sd->status.inventory[i].attribute & ATTR_BROKEN) != 0)
counter++;
}
@@ -9292,6 +9296,8 @@ static BUILDIN(repair)
num=script_getnum(st,2);
for(i=0; i<MAX_INVENTORY; i++) {
+ if (sd->status.inventory[i].card[0] == CARD0_PET)
+ continue;
if ((sd->status.inventory[i].attribute & ATTR_BROKEN) != 0) {
repaircounter++;
if(num==repaircounter) {
@@ -9320,6 +9326,8 @@ static BUILDIN(repairall)
for(i = 0; i < MAX_INVENTORY; i++)
{
+ if (sd->status.inventory[i].card[0] == CARD0_PET)
+ continue;
if (sd->status.inventory[i].nameid && (sd->status.inventory[i].attribute & ATTR_BROKEN) != 0)
{
sd->status.inventory[i].attribute |= ATTR_BROKEN;
diff --git a/src/map/script.h b/src/map/script.h
index fe8bcf00b..9a8425ed2 100644
--- a/src/map/script.h
+++ b/src/map/script.h
@@ -50,7 +50,7 @@ struct item_data;
#define NUM_WHISPER_VAR 10
/// Maximum amount of elements in script arrays
-#define SCRIPT_MAX_ARRAYSIZE (UINT_MAX - 1)
+#define SCRIPT_MAX_ARRAYSIZE (INT_MAX - 1)
#define SCRIPT_BLOCK_SIZE 512
diff --git a/src/map/skill.c b/src/map/skill.c
index 70cffdda4..745cdb7bc 100644
--- a/src/map/skill.c
+++ b/src/map/skill.c
@@ -16106,6 +16106,9 @@ static void skill_repairweapon(struct map_session_data *sd, int idx)
if( item->nameid <= 0 || (item->attribute & ATTR_BROKEN) == 0 )
return; //Again invalid item....
+ if (item->card[0] == CARD0_PET)
+ return;
+
if( sd != target_sd && !battle->check_range(&sd->bl,&target_sd->bl, skill->get_range2(&sd->bl, sd->menuskill_id,sd->menuskill_val2) ) ){
clif->item_repaireffect(sd,idx,1);
return;