summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorshennetsind <ind@henn.et>2013-11-27 14:27:41 -0200
committershennetsind <ind@henn.et>2013-11-27 14:27:41 -0200
commit2761bb0af9ddfa8bd14cefa9b6e1b33b2940e7be (patch)
tree35a6708b798a3baf5b7c75f06613ee5170c1d4d0
parent2c6d8fdc747d1699af513d5fe7336a7f33dc716b (diff)
downloadhercules-2761bb0af9ddfa8bd14cefa9b6e1b33b2940e7be.tar.gz
hercules-2761bb0af9ddfa8bd14cefa9b6e1b33b2940e7be.tar.bz2
hercules-2761bb0af9ddfa8bd14cefa9b6e1b33b2940e7be.tar.xz
hercules-2761bb0af9ddfa8bd14cefa9b6e1b33b2940e7be.zip
Fixed Bug 7858
Official item drop announce support, currently hardcoded list -- we'll be following up shortly with a decent way of storing it. Special Thanks to Yommy, Beret, kyeme. http://hercules.ws/board/tracker/issue-7858-monster-rare-drop-announcement/ Signed-off-by: shennetsind <ind@henn.et>
-rw-r--r--src/map/clif.c16
-rw-r--r--src/map/clif.h1
-rw-r--r--src/map/mob.c8
-rw-r--r--src/map/packets_struct.h13
4 files changed, 38 insertions, 0 deletions
diff --git a/src/map/clif.c b/src/map/clif.c
index 2135adff8..6550af5b9 100644
--- a/src/map/clif.c
+++ b/src/map/clif.c
@@ -17776,6 +17776,21 @@ void clif_package_item_announce(struct map_session_data *sd, unsigned short name
clif->send(&p,sizeof(p), &sd->bl, ALL_CLIENT);
}
+/* Made Possible Thanks to Yommy! */
+void clif_item_drop_announce(struct map_session_data *sd, unsigned short nameid, char *monsterName) {
+ struct packet_item_drop_announce p;
+
+ p.PacketType = item_drop_announceType;
+ p.PacketLength = sizeof(p);
+ p.type = 0x1;
+ p.ItemID = nameid;
+ p.len = NAME_LENGTH;
+ safestrncpy(p.Name, sd->status.name, sizeof(p.Name));
+ p.monsterNameLen = NAME_LENGTH;
+ safestrncpy(p.monsterName, monsterName, sizeof(p.monsterName));
+
+ clif->send(&p,sizeof(p), &sd->bl, ALL_CLIENT);
+}
/* [Ind/Hercules] special thanks to Yommy~! */
void clif_skill_cooldown_list(int fd, struct skill_cd* cd) {
#if PACKETVER >= 20120604
@@ -18291,6 +18306,7 @@ void clif_defaults(void) {
clif->cart_additem_ack = clif_cart_additem_ack;
clif->cashshop_load = clif_cashshop_db;
clif->package_announce = clif_package_item_announce;
+ clif->item_drop_announce = clif_item_drop_announce;
/* unit-related */
clif->clearunit_single = clif_clearunit_single;
clif->clearunit_area = clif_clearunit_area;
diff --git a/src/map/clif.h b/src/map/clif.h
index 47ee383e3..890f2d4c2 100644
--- a/src/map/clif.h
+++ b/src/map/clif.h
@@ -572,6 +572,7 @@ struct clif_interface {
void (*cart_additem_ack) (struct map_session_data *sd, int flag);
void (*cashshop_load) (void);
void (*package_announce) (struct map_session_data *sd, unsigned short nameid, unsigned short containerid);
+ void (*item_drop_announce) (struct map_session_data *sd, unsigned short nameid, char *monsterName);
/* unit-related */
void (*clearunit_single) (int id, clr_type type, int fd);
void (*clearunit_area) (struct block_list* bl, clr_type type);
diff --git a/src/map/mob.c b/src/map/mob.c
index 2cd82e4d1..777518d87 100644
--- a/src/map/mob.c
+++ b/src/map/mob.c
@@ -2362,6 +2362,14 @@ int mob_dead(struct mob_data *md, struct block_list *src, int type) {
//MSG: "'%s' won %s's %s (chance: %0.02f%%)"
intif->broadcast(message, strlen(message)+1, BC_DEFAULT);
}
+
+ /* heres the thing we got the feature set up however we're still discussing how to best define the ids,
+ * so while we discuss, for a small period of time, the list is hardcoded (yes officially only those 2 use it,
+ * thus why we're unsure on how to best place the setting) */
+ /* temp, will not be hardcoded for long thudu. */
+ if( it->nameid == 7782 || it->nameid == 7783 ) /* for when not hardcoded: add a check on mvp bonus drop as well */
+ clif->item_drop_announce(mvp_sd, it->nameid, md->name);
+
// Announce first, or else ditem will be freed. [Lance]
// By popular demand, use base drop rate for autoloot code. [Skotlex]
mob->item_drop(md, dlist, ditem, 0, md->db->dropitem[i].p, homkillonly);
diff --git a/src/map/packets_struct.h b/src/map/packets_struct.h
index 882c2fe24..7e7f8bd87 100644
--- a/src/map/packets_struct.h
+++ b/src/map/packets_struct.h
@@ -76,6 +76,7 @@ enum packet_headers {
#endif
script_clearType = 0x8d6,
package_item_announceType = 0x7fd,
+ item_drop_announceType = 0x7fd,
#if PACKETVER < 4
unit_walkingType = 0x7b,
#elif PACKETVER < 7
@@ -696,6 +697,18 @@ struct packet_package_item_announce {
unsigned short BoxItemID;
} __attribute__((packed));
+/* made possible thanks to Yommy!! */
+struct packet_item_drop_announce {
+ short PacketType;
+ short PacketLength;
+ unsigned char type;
+ unsigned short ItemID;
+ char len;
+ char Name[NAME_LENGTH];
+ char monsterNameLen;
+ char monsterName[NAME_LENGTH];
+} __attribute__((packed));
+
struct packet_cart_additem_ack {
short PacketType;
char result;