summaryrefslogtreecommitdiff
path: root/src/map/clif.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/map/clif.c')
-rw-r--r--src/map/clif.c62
1 files changed, 36 insertions, 26 deletions
diff --git a/src/map/clif.c b/src/map/clif.c
index 5d8e84a74..82507a84a 100644
--- a/src/map/clif.c
+++ b/src/map/clif.c
@@ -434,6 +434,7 @@ static bool clif_send(const void *buf, int len, struct block_list *bl, enum send
struct battleground_data *bgd = NULL;
int x0 = 0, x1 = 0, y0 = 0, y1 = 0, fd;
struct s_mapiterator* iter;
+ int area_size;
if( type != ALL_CLIENT )
nullpo_ret(bl);
@@ -472,13 +473,18 @@ static bool clif_send(const void *buf, int len, struct block_list *bl, enum send
case AREA:
case AREA_WOSC:
+ case AREA_DEAD:
if (sd && bl->prev == NULL) //Otherwise source misses the packet.[Skotlex]
clif->send (buf, len, bl, SELF);
/* Fall through */
case AREA_WOC:
case AREA_WOS:
+ if (type == AREA_DEAD)
+ area_size = DEAD_AREA_SIZE;
+ else
+ area_size = AREA_SIZE;
nullpo_retr(true, bl);
- map->foreachinarea(clif->send_sub, bl->m, bl->x-AREA_SIZE, bl->y-AREA_SIZE, bl->x+AREA_SIZE, bl->y+AREA_SIZE,
+ map->foreachinarea(clif->send_sub, bl->m, bl->x - area_size, bl->y - area_size, bl->x + area_size, bl->y + area_size,
BL_PC, buf, len, bl, type);
break;
case AREA_CHAT_WOC:
@@ -909,7 +915,12 @@ static void clif_clearunit_area(struct block_list *bl, clr_type type)
WBUFL(buf,2) = bl->id;
WBUFB(buf,6) = type;
- clif->send(buf, packet_len(0x80), bl, type == CLR_DEAD ? AREA : AREA_WOS);
+ /**
+ * When monster dies, there's a delay before the packet is sent,
+ * so we send it to a bigger area to avoid clients at the edge
+ * walking out of the area and missing it [KirieZ]
+ */
+ clif->send(buf, packet_len(0x80), bl, type == CLR_DEAD ? AREA_DEAD : AREA_WOS);
if (clif->isdisguised(bl)) {
WBUFL(buf,2) = -bl->id;
@@ -939,7 +950,7 @@ static void clif_clearunit_delayed(struct block_list *bl, clr_type type, int64 t
}
/// Gets weapon view info from sd's inventory_data and points (*rhand,*lhand)
-static void clif_get_weapon_view(struct map_session_data *sd, unsigned short *rhand, unsigned short *lhand)
+static void clif_get_weapon_view(struct map_session_data *sd, int *rhand, int *lhand)
{
nullpo_retv(sd);
nullpo_retv(rhand);
@@ -7233,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)
@@ -10055,16 +10067,11 @@ static void clif_parse_LoadEndAck(int fd, struct map_session_data *sd)
#if PACKETVER >= 20090218
{
int i;
- for(i = 0; i < map->list[sd->bl.m].qi_count; i++) {
- struct questinfo *qi = &map->list[sd->bl.m].qi_data[i];
- if( quest->check(sd, qi->quest_id, HAVEQUEST) == -1 ) {// Check if quest is not started
- if( qi->hasJob ) { // Check if quest is job-specific, check is user is said job class.
- if (sd->status.class == qi->job)
- clif->quest_show_event(sd, &qi->nd->bl, qi->icon, qi->color);
- } else {
- clif->quest_show_event(sd, &qi->nd->bl, qi->icon, qi->color);
- }
- }
+ for (i = 0; i < VECTOR_LENGTH(map->list[sd->bl.m].qi_data); i++) {
+ struct questinfo *qi = &VECTOR_INDEX(map->list[sd->bl.m].qi_data, i);
+
+ if (quest->questinfo_validate(sd, qi))
+ clif->quest_show_event(sd, &qi->nd->bl, qi->icon, qi->color);
}
}
#endif
@@ -14022,7 +14029,7 @@ static void clif_parse_pet_evolution(int fd, struct map_session_data *sd)
intif->create_pet(
sd->status.account_id, sd->status.char_id,
(short)pet->db[pet_id].class_, (short)mob->db(pet->db[pet_id].class_)->lv,
- (short)pet->db[pet_id].EggID, 0, (short)pet->db[pet_id].intimate,
+ pet->db[pet_id].EggID, 0, (short)pet->db[pet_id].intimate,
100, 0, 1, pet->db[pet_id].jname);
clif->petEvolutionResult(fd, PET_EVOL_SUCCESS);
} else {
@@ -17862,7 +17869,7 @@ static void clif_buyingstore_trade_failed_buyer(struct map_session_data *sd, sho
/// Updates the zeny limit and an item in the buying store item list (ZC_UPDATE_ITEM_FROM_BUYING_STORE).
/// 081b <name id>.W <amount>.W <limit zeny>.L
-static void clif_buyingstore_update_item(struct map_session_data *sd, unsigned short nameid, unsigned short amount, uint32 char_id, int zeny)
+static void clif_buyingstore_update_item(struct map_session_data *sd, int nameid, unsigned short amount, uint32 char_id, int zeny)
{
int fd;
struct PACKET_ZC_UPDATE_ITEM_FROM_BUYING_STORE p;
@@ -17913,7 +17920,7 @@ static void clif_buyingstore_delete_item(struct map_session_data *sd, short inde
/// 6 = "The trade failed, because the entered amount of item %s is higher, than the buyer is willing to buy." (0x6d3, MSI_BUYINGSTORE_TRADE_OVERCOUNT)
/// 7 = "The trade failed, because the buyer is lacking required balance." (0x6d1, MSI_BUYINGSTORE_TRADE_LACKBUYERZENY)
/// ? = nothing
-static void clif_buyingstore_trade_failed_seller(struct map_session_data *sd, short result, unsigned short nameid)
+static void clif_buyingstore_trade_failed_seller(struct map_session_data *sd, short result, int nameid)
{
#if PACKETVER >= 20100420
int fd;
@@ -18509,7 +18516,7 @@ static void clif_cashshop_db(void)
continue;
}
- if( name[0] == 'I' && name[1] == 'D' && strlen(name) <= 7 ) {
+ if (name[0] == 'I' && name[1] == 'D' && strlen(name) <= 12) {
if( !( data = itemdb->exists(atoi(name+2))) ) {
ShowWarning("cashshop_db: unknown item id '%s' in category '%s'\n", name+2, entry_name);
continue;
@@ -19038,7 +19045,7 @@ static void clif_scriptclear(struct map_session_data *sd, int npcid)
}
/* Made Possible Thanks to Yommy! */
-static void clif_package_item_announce(struct map_session_data *sd, unsigned short nameid, unsigned short containerid)
+static void clif_package_item_announce(struct map_session_data *sd, int nameid, int containerid)
{
struct packet_package_item_announce p;
@@ -19056,7 +19063,7 @@ static void clif_package_item_announce(struct map_session_data *sd, unsigned sho
}
/* Made Possible Thanks to Yommy! */
-static void clif_item_drop_announce(struct map_session_data *sd, unsigned short nameid, char *monsterName)
+static void clif_item_drop_announce(struct map_session_data *sd, int nameid, char *monsterName)
{
struct packet_item_drop_announce p;
@@ -19700,7 +19707,7 @@ static bool clif_parse_roulette_db(void)
continue;
}
- if( name[0] == 'I' && name[1] == 'D' && strlen(name) <= 7 ) {
+ if (name[0] == 'I' && name[1] == 'D' && strlen(name) <= 12) {
if( !( data = itemdb->exists(atoi(name+2))) ) {
ShowWarning("roulette_db: unknown item id '%s' in category '%s'\n", name+2, entry_name);
continue;
@@ -19757,7 +19764,7 @@ static bool clif_parse_roulette_db(void)
/**
*
**/
-static void clif_roulette_generate_ack(struct map_session_data *sd, unsigned char result, short stage, short prizeIdx, short bonusItemID)
+static void clif_roulette_generate_ack(struct map_session_data *sd, unsigned char result, short stage, short prizeIdx, int bonusItemID)
{
#if PACKETVER >= 20140612
struct packet_roulette_generate_ack p;
@@ -19843,7 +19850,8 @@ static void clif_ackmergeitems(int fd, struct map_session_data *sd)
{
#if PACKETVER > 20120228
int i = 0, n = 0, length = 0, count = 0;
- int16 nameid = 0, indexes[MAX_INVENTORY] = {0}, amounts[MAX_INVENTORY] = {0};
+ int nameid = 0;
+ int16 indexes[MAX_INVENTORY] = {0}, amounts[MAX_INVENTORY] = {0};
struct item item_data;
nullpo_retv(sd);
@@ -20642,12 +20650,14 @@ static void clif_rodex_read_mail(struct map_session_data *sd, int8 opentype, str
size += body_len;
for (i = 0; i < RODEX_MAX_ITEM; ++i) {
struct item *it = &msg->items[i].item;
- struct item_data* data = itemdb->search(it->nameid);
+ struct item_data *data;
int j, k;
- if (it->nameid == 0 || data == NULL) {
+ if (it->nameid == 0)
+ continue;
+ data = itemdb->search(it->nameid);
+ if (data == NULL)
continue;
- }
item = WFIFOP(fd, size);
memset(item, 0x0, sizeof(*item));
@@ -21246,7 +21256,7 @@ static bool clif_style_change_validate_requirements(struct map_session_data *sd,
}
return false;
}
-static void clif_stylist_send_rodexitem(struct map_session_data *sd, int16 itemid)
+static void clif_stylist_send_rodexitem(struct map_session_data *sd, int itemid)
{
struct rodex_message msg = { 0 };