summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/map/clif.c31
-rw-r--r--src/map/clif.h1
-rw-r--r--src/map/packets_struct.h13
-rw-r--r--src/map/script.c96
-rw-r--r--src/map/script.h25
-rw-r--r--src/map/skill.c6
-rw-r--r--src/map/skill.h1
7 files changed, 142 insertions, 31 deletions
diff --git a/src/map/clif.c b/src/map/clif.c
index 4bf3cdf94..95a2d8f5d 100644
--- a/src/map/clif.c
+++ b/src/map/clif.c
@@ -5068,6 +5068,10 @@ void clif_useskill(struct block_list* bl, int src_id, int dst_id, int dst_x, int
} else {
clif->send(buf,packet_len(cmd), bl, AREA);
}
+#if PACKETVER >= 20151223
+ if ((skill->get_inf2(skill_id) & INF2_SHOW_SKILL_SCALE) != 0)
+ clif->skill_scale(bl, src_id, bl->x, bl->y, skill_id, skill_lv, casttime);
+#endif
}
/// Notifies clients in area, that an object canceled casting (ZC_DISPEL).
@@ -19860,6 +19864,32 @@ void clif_parse_rodex_cancel_write_mail(int fd, struct map_session_data *sd)
rodex->clean(sd, 1);
}
+void clif_skill_scale(struct block_list *bl, int src_id, int x, int y, uint16 skill_id, uint16 skill_lv, int casttime)
+{
+#if PACKETVER >= 20151223
+ struct PACKET_ZC_SKILL_SCALE p;
+
+ p.PacketType = skillscale;
+ p.AID = src_id;
+ p.skill_id = skill_id;
+ p.skill_lv = skill_lv;
+ p.x = x;
+ p.y = y;
+ p.casttime = casttime;
+
+ if (clif->isdisguised(bl)) {
+ clif->send(&p, sizeof(p), bl, AREA_WOS);
+ p.AID = -src_id;
+ clif->send(&p, sizeof(p), bl, SELF);
+ } else {
+ clif->send(&p, sizeof(p), bl, AREA);
+ }
+#else
+ ShowWarning("clif_skill_scale: showing skill scale available only for clients >= 20151223.");
+ return;
+#endif
+}
+
/*==========================================
* Main client packet processing function
*------------------------------------------*/
@@ -20929,4 +20959,5 @@ void clif_defaults(void) {
clif->rodex_request_items = clif_rodex_request_items;
clif->rodex_icon = clif_rodex_icon;
clif->rodex_send_mails_all = clif_rodex_send_mails_all;
+ clif->skill_scale = clif_skill_scale;
}
diff --git a/src/map/clif.h b/src/map/clif.h
index 851c823ea..112db3dec 100644
--- a/src/map/clif.h
+++ b/src/map/clif.h
@@ -1395,6 +1395,7 @@ struct clif_interface {
void (*pRodexRequestItems) (int fd, struct map_session_data *sd);
void (*rodex_request_items) (struct map_session_data *sd, int8 opentype, int64 mail_id, int8 result);
void (*rodex_icon) (int fd, bool show);
+ void (*skill_scale) (struct block_list *bl, int src_id, int x, int y, uint16 skill_id, uint16 skill_lv, int casttime);
};
#ifdef HERCULES_CORE
diff --git a/src/map/packets_struct.h b/src/map/packets_struct.h
index 03b555e2b..e1395e949 100644
--- a/src/map/packets_struct.h
+++ b/src/map/packets_struct.h
@@ -330,6 +330,9 @@ enum packet_headers {
#else // PACKETVER >= 20160316
rodexcheckplayer = 0x0A51,
#endif
+#if PACKETVER >= 20151223
+ skillscale = 0xA41,
+#endif
};
#if !defined(sun) && (!defined(__NETBSD__) || __NetBSD_Version__ >= 600000000) // NetBSD 5 and Solaris don't like pragma pack but accept the packed attribute
@@ -1478,6 +1481,16 @@ struct PACKET_ZC_ACK_ITEM_FROM_MAIL {
int8 result;
} __attribute__((packed));
+struct PACKET_ZC_SKILL_SCALE {
+ int16 PacketType;
+ uint32 AID;
+ int16 skill_id;
+ int16 skill_lv;
+ int16 x;
+ int16 y;
+ uint32 casttime;
+} __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 4dcfa5687..7f7aba183 100644
--- a/src/map/script.c
+++ b/src/map/script.c
@@ -14081,53 +14081,61 @@ BUILDIN(getiteminfo)
}
switch (n) {
- case 0:
+ case ITEMINFO_BUYPRICE:
script_pushint(st, it->value_buy);
break;
- case 1:
+ case ITEMINFO_SELLPRICE:
script_pushint(st, it->value_sell);
break;
- case 2:
+ case ITEMINFO_TYPE:
script_pushint(st, it->type);
break;
- case 3:
+ case ITEMINFO_MAXCHANCE:
script_pushint(st, it->maxchance);
break;
- case 4:
+ case ITEMINFO_SEX:
script_pushint(st, it->sex);
break;
- case 5:
+ case ITEMINFO_LOC:
script_pushint(st, it->equip);
break;
- case 6:
+ case ITEMINFO_WEIGHT:
script_pushint(st, it->weight);
break;
- case 7:
+ case ITEMINFO_ATK:
script_pushint(st, it->atk);
break;
- case 8:
+ case ITEMINFO_DEF:
script_pushint(st, it->def);
break;
- case 9:
+ case ITEMINFO_RANGE:
script_pushint(st, it->range);
break;
- case 10:
+ case ITEMINFO_SLOTS:
script_pushint(st, it->slot);
break;
- case 11:
+ case ITEMINFO_SUBTYPE:
script_pushint(st, it->subtype);
break;
- case 12:
+ case ITEMINFO_ELV:
script_pushint(st, it->elv);
break;
- case 13:
+ case ITEMINFO_WLV:
script_pushint(st, it->wlv);
break;
- case 14:
+ case ITEMINFO_VIEWID:
script_pushint(st, it->view_id);
break;
+ case ITEMINFO_MATK:
+ script_pushint(st, it->matk);
+ break;
+ case ITEMINFO_VIEWSPRITE:
+ script_pushint(st, it->view_sprite);
+ break;
default:
+ ShowError("buildin_getiteminfo: Invalid item type %d.\n", n);
script_pushint(st,-1);
+ return false;
}
return true;
}
@@ -14339,54 +14347,61 @@ BUILDIN(setiteminfo)
}
switch (n) {
- case 0:
+ case ITEMINFO_BUYPRICE:
it->value_buy = value;
break;
- case 1:
+ case ITEMINFO_SELLPRICE:
it->value_sell = value;
break;
- case 2:
+ case ITEMINFO_TYPE:
it->type = value;
break;
- case 3:
+ case ITEMINFO_MAXCHANCE:
it->maxchance = value;
break;
- case 4:
+ case ITEMINFO_SEX:
it->sex = value;
break;
- case 5:
+ case ITEMINFO_LOC:
it->equip = value;
break;
- case 6:
+ case ITEMINFO_WEIGHT:
it->weight = value;
break;
- case 7:
+ case ITEMINFO_ATK:
it->atk = value;
break;
- case 8:
+ case ITEMINFO_DEF:
it->def = value;
break;
- case 9:
+ case ITEMINFO_RANGE:
it->range = value;
break;
- case 10:
+ case ITEMINFO_SLOTS:
it->slot = value;
break;
- case 11:
+ case ITEMINFO_SUBTYPE:
it->subtype = value;
break;
- case 12:
+ case ITEMINFO_ELV:
it->elv = value;
break;
- case 13:
+ case ITEMINFO_WLV:
it->wlv = value;
break;
- case 14:
+ case ITEMINFO_VIEWID:
it->view_id = value;
break;
+ case ITEMINFO_MATK:
+ it->matk = value;
+ break;
+ case ITEMINFO_VIEWSPRITE:
+ it->view_sprite = value;
+ break;
default:
+ ShowError("buildin_setiteminfo: invalid type %d.\n", n);
script_pushint(st,-1);
- return true;
+ return false;
}
script_pushint(st,value);
return true;
@@ -24829,6 +24844,25 @@ void script_hardcoded_constants(void)
script->set_constant("MAPINFO_SIZE_Y", MAPINFO_SIZE_Y, false, false);
script->set_constant("MAPINFO_ZONE", MAPINFO_ZONE, false, false);
+ script->constdb_comment("set/getiteminfo options");
+ script->set_constant("ITEMINFO_BUYPRICE", ITEMINFO_BUYPRICE, false, false);
+ script->set_constant("ITEMINFO_SELLPRICE", ITEMINFO_SELLPRICE, false, false);
+ script->set_constant("ITEMINFO_TYPE", ITEMINFO_TYPE, false, false);
+ script->set_constant("ITEMINFO_MAXCHANCE", ITEMINFO_MAXCHANCE, false, false);
+ script->set_constant("ITEMINFO_SEX", ITEMINFO_SEX, false, false);
+ script->set_constant("ITEMINFO_LOC", ITEMINFO_LOC, false, false);
+ script->set_constant("ITEMINFO_WEIGHT", ITEMINFO_WEIGHT, false, false);
+ script->set_constant("ITEMINFO_ATK", ITEMINFO_ATK, false, false);
+ script->set_constant("ITEMINFO_DEF", ITEMINFO_DEF, false, false);
+ script->set_constant("ITEMINFO_RANGE", ITEMINFO_RANGE, false, false);
+ script->set_constant("ITEMINFO_SLOTS", ITEMINFO_SLOTS, false, false);
+ script->set_constant("ITEMINFO_SUBTYPE", ITEMINFO_SUBTYPE, false, false);
+ script->set_constant("ITEMINFO_ELV", ITEMINFO_ELV, false, false);
+ script->set_constant("ITEMINFO_WLV", ITEMINFO_WLV, false, false);
+ script->set_constant("ITEMINFO_VIEWID", ITEMINFO_VIEWID, false, false);
+ script->set_constant("ITEMINFO_MATK", ITEMINFO_MATK, false, false);
+ script->set_constant("ITEMINFO_VIEWSPRITE", ITEMINFO_VIEWSPRITE, 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 b2ab7510c..14d20838d 100644
--- a/src/map/script.h
+++ b/src/map/script.h
@@ -429,6 +429,31 @@ enum script_unit_data_types {
};
/**
+ * Item Info types.
+ */
+enum script_iteminfo_types {
+ ITEMINFO_BUYPRICE = 0,
+ ITEMINFO_SELLPRICE,
+ ITEMINFO_TYPE,
+ ITEMINFO_MAXCHANCE,
+ ITEMINFO_SEX,
+ ITEMINFO_LOC,
+ ITEMINFO_WEIGHT,
+ ITEMINFO_ATK,
+ ITEMINFO_DEF,
+ ITEMINFO_RANGE,
+ ITEMINFO_SLOTS,
+ ITEMINFO_SUBTYPE,
+ ITEMINFO_ELV,
+ ITEMINFO_WLV,
+ ITEMINFO_VIEWID,
+ ITEMINFO_MATK,
+ ITEMINFO_VIEWSPRITE,
+
+ ITEMINFO_MAX
+};
+
+/**
* Structures
**/
diff --git a/src/map/skill.c b/src/map/skill.c
index 1b7d40e83..d20178a34 100644
--- a/src/map/skill.c
+++ b/src/map/skill.c
@@ -20030,6 +20030,12 @@ void skill_validate_skillinfo(struct config_setting_t *conf, struct s_skill_db *
} else {
sk->inf2 &= ~INF2_FREE_CAST_REDUCED;
}
+ } else if (strcmpi(type, "ShowSkillScale") == 0) {
+ if (on) {
+ sk->inf2 |= INF2_SHOW_SKILL_SCALE;
+ } else {
+ sk->inf2 &= ~INF2_SHOW_SKILL_SCALE;
+ }
} else if (strcmpi(type, "None") != 0) {
skilldb_invalid_error(type, config_setting_name(t), sk->nameid);
}
diff --git a/src/map/skill.h b/src/map/skill.h
index fa95a1a99..a0591de74 100644
--- a/src/map/skill.h
+++ b/src/map/skill.h
@@ -119,6 +119,7 @@ enum e_skill_inf2 {
INF2_CHORUS_SKILL = 0x04000, // Chorus skill
INF2_FREE_CAST_NORMAL = 0x08000,
INF2_FREE_CAST_REDUCED = 0x10000,
+ INF2_SHOW_SKILL_SCALE = 0x20000,
};