summaryrefslogtreecommitdiff
path: root/src/map
diff options
context:
space:
mode:
Diffstat (limited to 'src/map')
-rw-r--r--src/map/achievement.c3
-rw-r--r--src/map/atcommand.c24
-rw-r--r--src/map/chrif.c4
-rw-r--r--src/map/clif.c488
-rw-r--r--src/map/clif.h59
-rw-r--r--src/map/itemdb.h6
-rw-r--r--src/map/mail.c4
-rw-r--r--src/map/messages_main.h44
-rw-r--r--src/map/messages_re.h44
-rw-r--r--src/map/messages_zero.h28
-rw-r--r--src/map/npc.c6
-rw-r--r--src/map/packets.h47
-rw-r--r--src/map/packets_keys_main.h8
-rw-r--r--src/map/packets_keys_zero.h7
-rw-r--r--src/map/packets_shuffle_main.h40
-rw-r--r--src/map/packets_shuffle_re.h8
-rw-r--r--src/map/packets_shuffle_zero.h9
-rw-r--r--src/map/packets_struct.h348
-rw-r--r--src/map/pc.c105
-rw-r--r--src/map/pc.h7
-rw-r--r--src/map/pet.c14
-rw-r--r--src/map/quest.c2
-rw-r--r--src/map/rodex.c6
-rw-r--r--src/map/script.c208
-rw-r--r--src/map/skill.c20
-rw-r--r--src/map/status.c2
-rw-r--r--src/map/storage.c4
-rw-r--r--src/map/trade.c28
-rw-r--r--src/map/unit.c8
-rw-r--r--src/map/unit.h8
30 files changed, 1160 insertions, 429 deletions
diff --git a/src/map/achievement.c b/src/map/achievement.c
index 7148acae8..057ea29c3 100644
--- a/src/map/achievement.c
+++ b/src/map/achievement.c
@@ -760,14 +760,13 @@ static void achievement_validate_refine(struct map_session_data *sd, unsigned in
struct item_data *id = NULL;
nullpo_retv(sd);
- Assert_retv(idx < MAX_INVENTORY);
+ Assert_retv(idx < sd->status.inventorySize);
id = itemdb->exists(sd->status.inventory[idx].nameid);
if (sd->achievements_received == false)
return;
- Assert_retv(idx < MAX_INVENTORY);
Assert_retv(id != NULL);
criteria.goal = sd->status.inventory[idx].refine;
diff --git a/src/map/atcommand.c b/src/map/atcommand.c
index 6cfa86163..0a1fd6da3 100644
--- a/src/map/atcommand.c
+++ b/src/map/atcommand.c
@@ -1359,9 +1359,7 @@ ACMD(item2)
*------------------------------------------*/
ACMD(itemreset)
{
- int i;
-
- for (i = 0; i < MAX_INVENTORY; i++) {
+ for (int i = 0; i < sd->status.inventorySize; i++) {
if (sd->status.inventory[i].amount && sd->status.inventory[i].equip == 0) {
pc->delitem(sd, i, sd->status.inventory[i].amount, 0, DELITEM_NORMAL, LOG_TYPE_COMMAND);
}
@@ -4274,10 +4272,8 @@ ACMD(partyspy)
*------------------------------------------*/
ACMD(repairall)
{
- int count, i;
-
- count = 0;
- for (i = 0; i < MAX_INVENTORY; i++) {
+ int count = 0;
+ for (int i = 0; i < sd->status.inventorySize; 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) {
@@ -5286,9 +5282,7 @@ ACMD(follow)
*------------------------------------------*/
ACMD(dropall)
{
- int i;
-
- for (i = 0; i < MAX_INVENTORY; i++) {
+ for (int i = 0; i < sd->status.inventorySize; i++) {
if (sd->status.inventory[i].amount) {
if(sd->status.inventory[i].equip != 0)
pc->unequipitem(sd, i, PCUNEQUIPITEM_RECALC|PCUNEQUIPITEM_FORCE);
@@ -5304,8 +5298,6 @@ ACMD(dropall)
*------------------------------------------*/
ACMD(storeall)
{
- int i;
-
if (sd->state.storage_flag != STORAGE_FLAG_NORMAL) {
//Open storage.
if (storage->open(sd) == 1) {
@@ -5319,7 +5311,7 @@ ACMD(storeall)
return false;
}
- for (i = 0; i < MAX_INVENTORY; i++) {
+ for (int i = 0; i < sd->status.inventorySize; i++) {
if (sd->status.inventory[i].amount) {
if(sd->status.inventory[i].equip != 0)
pc->unequipitem(sd, i, PCUNEQUIPITEM_RECALC|PCUNEQUIPITEM_FORCE);
@@ -6714,9 +6706,9 @@ ACMD(refreshall)
*------------------------------------------*/
ACMD(identify)
{
- int i,num;
+ int num = 0;
- for (i=num=0;i<MAX_INVENTORY;i++) {
+ for (int i = 0; i < sd->status.inventorySize; i++) {
if(sd->status.inventory[i].nameid > 0 && sd->status.inventory[i].identify!=1){
num++;
}
@@ -8256,7 +8248,7 @@ ACMD(itemlist)
} else if( strcmpi(info->command, "itemlist") == 0 ) {
location = "inventory";
items = sd->status.inventory;
- size = MAX_INVENTORY;
+ size = sd->status.inventorySize;
} else
return false;
diff --git a/src/map/chrif.c b/src/map/chrif.c
index af3504ca2..a3277d4c2 100644
--- a/src/map/chrif.c
+++ b/src/map/chrif.c
@@ -975,14 +975,14 @@ static bool chrif_divorceack(int char_id, int partner_id)
if( ( sd = map->charid2sd(char_id) ) != NULL && sd->status.partner_id == partner_id ) {
sd->status.partner_id = 0;
- for(i = 0; i < MAX_INVENTORY; i++)
+ for (i = 0; i < sd->status.inventorySize; i++)
if (sd->status.inventory[i].nameid == WEDDING_RING_M || sd->status.inventory[i].nameid == WEDDING_RING_F)
pc->delitem(sd, i, 1, 0, DELITEM_NORMAL, LOG_TYPE_DIVORCE);
}
if( ( sd = map->charid2sd(partner_id) ) != NULL && sd->status.partner_id == char_id ) {
sd->status.partner_id = 0;
- for(i = 0; i < MAX_INVENTORY; i++)
+ for (i = 0; i < sd->status.inventorySize; i++)
if (sd->status.inventory[i].nameid == WEDDING_RING_M || sd->status.inventory[i].nameid == WEDDING_RING_F)
pc->delitem(sd, i, 1, 0, DELITEM_NORMAL, LOG_TYPE_DIVORCE);
}
diff --git a/src/map/clif.c b/src/map/clif.c
index 7d539b3cd..9166c83ea 100644
--- a/src/map/clif.c
+++ b/src/map/clif.c
@@ -92,8 +92,9 @@ static struct ZC_STORE_ITEMLIST_EQUIP storelist_equip;
static struct packet_viewequip_ack viewequip_list;
#if PACKETVER >= 20131223
static struct packet_npc_market_result_ack npcmarket_result;
-static struct packet_npc_market_open npcmarket_open;
#endif
+// temporart buffer for send big packets
+char packet_buf[0xffff];
//#define DUMP_UNKNOWN_PACKET
//#define DUMP_INVALID_PACKET
@@ -890,7 +891,7 @@ static void clif_clearflooritem(struct flooritem_data *fitem, int fd)
/// 2 = logged out
/// 3 = teleport
/// 4 = trickdead
-static void clif_clearunit_single(int id, clr_type type, int fd)
+static void clif_clearunit_single(int id, enum clr_type type, int fd)
{
WFIFOHEAD(fd, packet_len(0x80));
WFIFOW(fd,0) = 0x80;
@@ -907,7 +908,7 @@ static void clif_clearunit_single(int id, clr_type type, int fd)
/// 2 = logged out
/// 3 = teleport
/// 4 = trickdead
-static void clif_clearunit_area(struct block_list *bl, clr_type type)
+static void clif_clearunit_area(struct block_list *bl, enum clr_type type)
{
unsigned char buf[8];
@@ -936,12 +937,12 @@ static void clif_clearunit_area(struct block_list *bl, clr_type type)
static int clif_clearunit_delayed_sub(int tid, int64 tick, int id, intptr_t data)
{
struct block_list *bl = (struct block_list *)data;
- clif->clearunit_area(bl, (clr_type) id);
+ clif->clearunit_area(bl, (enum clr_type) id);
ers_free(clif->delay_clearunit_ers,bl);
return 0;
}
-static void clif_clearunit_delayed(struct block_list *bl, clr_type type, int64 tick)
+static void clif_clearunit_delayed(struct block_list *bl, enum clr_type type, int64 tick)
{
struct block_list *tbl;
@@ -1116,7 +1117,7 @@ static void clif_set_unit_idle(struct block_list *bl, struct map_session_data *t
p.head = vd->hair_style;
p.weapon = vd->weapon;
p.accessory = vd->head_bottom;
-#if PACKETVER < 7 || PACKETVER_RE_NUM >= 20180704
+#if PACKETVER < 7 || PACKETVER_MAIN_NUM >= 20181121 || PACKETVER_RE_NUM >= 20180704 || PACKETVER_ZERO_NUM >= 20181114
p.shield = vd->shield;
#endif
p.accessory2 = vd->head_top;
@@ -1273,7 +1274,7 @@ static void clif_spawn_unit(struct block_list *bl, enum send_target target)
p.head = vd->hair_style;
p.weapon = vd->weapon;
p.accessory = vd->head_bottom;
-#if PACKETVER < 7 || PACKETVER_RE_NUM >= 20180704
+#if PACKETVER < 7 || PACKETVER_MAIN_NUM >= 20181121 || PACKETVER_RE_NUM >= 20180704 || PACKETVER_ZERO_NUM >= 20181114
p.shield = vd->shield;
#endif
p.accessory2 = vd->head_top;
@@ -1382,7 +1383,7 @@ static void clif_set_unit_walking(struct block_list *bl, struct map_session_data
p.weapon = vd->weapon;
p.accessory = vd->head_bottom;
p.moveStartTime = (unsigned int)timer->gettick();
-#if PACKETVER < 7 || PACKETVER_RE_NUM >= 20180704
+#if PACKETVER < 7 || PACKETVER_MAIN_NUM >= 20181121 || PACKETVER_RE_NUM >= 20180704 || PACKETVER_ZERO_NUM >= 20181114
p.shield = vd->shield;
#endif
p.accessory2 = vd->head_top;
@@ -1627,6 +1628,7 @@ static bool clif_spawn(struct block_list *bl)
/// 022e <name>.24B <modified>.B <level>.W <hunger>.W <intimacy>.W <equip id>.W <atk>.W <matk>.W <hit>.W <crit>.W <def>.W <mdef>.W <flee>.W <aspd>.W <hp>.W <max hp>.W <sp>.W <max sp>.W <exp>.L <max exp>.L <skill points>.W <atk range>.W
static void clif_hominfo(struct map_session_data *sd, struct homun_data *hd, int flag)
{
+#if PACKETVER_MAIN_NUM >= 20101005 || PACKETVER_RE_NUM >= 20080827 || defined(PACKETVER_ZERO_NUM)
struct status_data *hstatus;
enum homun_type htype;
struct PACKET_ZC_PROPERTY_HOMUN p;
@@ -1638,7 +1640,7 @@ static void clif_hominfo(struct map_session_data *sd, struct homun_data *hd, int
htype = homun->class2type(hd->homunculus.class_);
memset(&p, 0, sizeof(p));
- p.packetType = hominfoType;
+ p.packetType = HEADER_ZC_PROPERTY_HOMUN;
memcpy(p.name, hd->homunculus.name, NAME_LENGTH);
// Bit field, bit 0 : rename_flag (1 = already renamed), bit 1 : homunc vaporized (1 = true), bit 2 : homunc dead (1 = true)
p.flags = (!battle_config.hom_rename && hd->homunculus.rename_flag ? 0x1 : 0x0) | (hd->homunculus.vaporize == HOM_ST_REST ? 0x2 : 0) | (hd->homunculus.hp > 0 ? 0x4 : 0);
@@ -1704,6 +1706,7 @@ static void clif_hominfo(struct map_session_data *sd, struct homun_data *hd, int
p.skillPoints = hd->homunculus.skillpts;
p.range = status_get_range(&hd->bl);
clif->send(&p, sizeof(p), &sd->bl, SELF);
+#endif
}
/// Notification about a change in homunuculus' state (ZC_CHANGESTATE_MER).
@@ -2160,14 +2163,14 @@ static void clif_buylist(struct map_session_data *sd, struct npc_data *nd)
/// 00c7 <packet len>.W { <index>.W <price>.L <overcharge price>.L }*
static void clif_selllist(struct map_session_data *sd)
{
- int fd,i,c=0,val;
+ int c = 0, val;
nullpo_retv(sd);
- fd=sd->fd;
- WFIFOHEAD(fd, MAX_INVENTORY * 10 + 4);
+ int fd = sd->fd;
+ WFIFOHEAD(fd, sd->status.inventorySize * 10 + 4);
WFIFOW(fd,0)=0xc7;
- for( i = 0; i < MAX_INVENTORY; i++ )
+ for (int i = 0; i < sd->status.inventorySize; i++)
{
if( sd->status.inventory[i].nameid > 0 && sd->inventory_data[i] )
{
@@ -2582,7 +2585,7 @@ static void clif_additem(struct map_session_data *sd, int n, int amount, int fai
p.count = amount;
if( !fail ) {
- if( n < 0 || n >= MAX_INVENTORY || sd->status.inventory[n].nameid <=0 || sd->inventory_data[n] == NULL )
+ if (n < 0 || n >= sd->status.inventorySize || sd->status.inventory[n].nameid <= 0 || sd->inventory_data[n] == NULL)
return;
if (sd->inventory_data[n]->view_id > 0)
@@ -2804,7 +2807,7 @@ static void clif_inventoryItems(struct map_session_data *sd, enum inventory_type
int i, normal = 0, equip = 0;
nullpo_retv(sd);
- for( i = 0; i < MAX_INVENTORY; i++ ) {
+ for (i = 0; i < sd->status.inventorySize; i++) {
if( sd->status.inventory[i].nameid <= 0 || sd->inventory_data[i] == NULL )
continue;
@@ -2838,7 +2841,7 @@ static void clif_inventoryItems(struct map_session_data *sd, enum inventory_type
}
/* on 20120925 onwards this is a field on clif_item_equip/normal */
#if PACKETVER >= 20111122 && PACKETVER < 20120925
- for( i = 0; i < MAX_INVENTORY; i++ ) {
+ for (i = 0; i < sd->status.inventorySize; i++) {
if( sd->status.inventory[i].nameid <= 0 || sd->inventory_data[i] == NULL )
continue;
@@ -2866,7 +2869,7 @@ static void clif_equipItems(struct map_session_data *sd, enum inventory_type typ
int i, equip = 0;
nullpo_retv(sd);
- for( i = 0; i < MAX_INVENTORY; i++ ) {
+ for (i = 0; i < sd->status.inventorySize; i++) {
if( sd->status.inventory[i].nameid <= 0 || sd->inventory_data[i] == NULL )
continue;
@@ -2886,7 +2889,7 @@ static void clif_equipItems(struct map_session_data *sd, enum inventory_type typ
/* on 20120925 onwards this is a field on clif_item_equip */
#if PACKETVER >= 20111122 && PACKETVER < 20120925
- for( i = 0; i < MAX_INVENTORY; i++ ) {
+ for (i = 0; i < sd->status.inventorySize; i++) {
if( sd->status.inventory[i].nameid <= 0 || sd->inventory_data[i] == NULL )
continue;
@@ -3062,6 +3065,121 @@ static void clif_cartItems(struct map_session_data *sd, enum inventory_type type
}
}
+static void clif_inventoryExpansionInfo(struct map_session_data *sd)
+{
+#if PACKETVER_ZERO_NUM >= 20181212
+ nullpo_retv(sd);
+
+ const int fd = sd->fd;
+ WFIFOHEAD(fd, sizeof(struct PACKET_ZC_INVENTORY_EXPANSION_INFO));
+ struct PACKET_ZC_INVENTORY_EXPANSION_INFO *p = WFIFOP(fd, 0);
+ p->packetType = HEADER_ZC_INVENTORY_EXPANSION_INFO;
+ p->expansionSize = sd->status.inventorySize - FIXED_INVENTORY_SIZE;
+ WFIFOSET(fd, sizeof(struct PACKET_ZC_INVENTORY_EXPANSION_INFO));
+#endif
+}
+
+static void clif_inventoryExpandAck(struct map_session_data *sd, enum expand_inventory result, int itemId)
+{
+#if PACKETVER_ZERO_NUM >= 20181212
+ nullpo_retv(sd);
+
+ const int fd = sd->fd;
+ WFIFOHEAD(fd, sizeof(struct PACKET_ZC_ACK_INVENTORY_EXPAND));
+ struct PACKET_ZC_ACK_INVENTORY_EXPAND *p = WFIFOP(fd, 0);
+ p->packetType = HEADER_ZC_ACK_INVENTORY_EXPAND;
+ p->result = result;
+ p->itemId = itemId;
+ WFIFOSET(fd, sizeof(struct PACKET_ZC_ACK_INVENTORY_EXPAND));
+#endif
+}
+
+static void clif_inventoryExpandResult(struct map_session_data *sd, enum expand_inventory_result result)
+{
+#if PACKETVER_ZERO_NUM >= 20181212
+ nullpo_retv(sd);
+
+ const int fd = sd->fd;
+ WFIFOHEAD(fd, sizeof(struct PACKET_ZC_ACK_INVENTORY_EXPAND_RESULT));
+ struct PACKET_ZC_ACK_INVENTORY_EXPAND_RESULT *p = WFIFOP(fd, 0);
+ p->packetType = HEADER_ZC_ACK_INVENTORY_EXPAND_RESULT;
+ p->result = result;
+ WFIFOSET(fd, sizeof(struct PACKET_ZC_ACK_INVENTORY_EXPAND_RESULT));
+#endif
+}
+
+static void clif_parse_inventoryExpansion(int fd, struct map_session_data *sd) __attribute__((nonnull (2)));
+static void clif_parse_inventoryExpansion(int fd, struct map_session_data *sd)
+{
+#if PACKETVER_MAIN_NUM >= 20181031 || PACKETVER_RE_NUM >= 20181031 || PACKETVER_ZERO_NUM >= 20181114
+ if (pc_isdead(sd) || pc_cant_act(sd)) {
+ clif->inventoryExpandAck(sd, EXPAND_INVENTORY_OTHER_WORK, 0);
+ return;
+ }
+ if (sd->status.inventorySize == MAX_INVENTORY) {
+ clif->inventoryExpandAck(sd, EXPAND_INVENTORY_MAX_SIZE, 0);
+ return;
+ }
+
+ char evname[EVENT_NAME_LENGTH];
+ struct event_data *ev = NULL;
+
+ safestrncpy(evname, "inventory_expansion::OnInvExpandRequest", EVENT_NAME_LENGTH);
+ if ((ev = strdb_get(npc->ev_db, evname))) {
+ script->run_npc(ev->nd->u.scr.script, ev->pos, sd->bl.id, ev->nd->bl.id);
+ } else {
+ ShowError("clif_parse_inventoryExpansion: event '%s' not found, operation failed.\n", evname);
+ }
+#endif
+}
+
+static void clif_parse_inventoryExpansionConfirmed(int fd, struct map_session_data *sd) __attribute__((nonnull (2)));
+static void clif_parse_inventoryExpansionConfirmed(int fd, struct map_session_data *sd)
+{
+#if PACKETVER_MAIN_NUM >= 20181031 || PACKETVER_RE_NUM >= 20181031 || PACKETVER_ZERO_NUM >= 20181114
+ if (pc_isdead(sd) || pc_cant_act(sd)) {
+ clif->inventoryExpandResult(sd, EXPAND_INVENTORY_RESULT_OTHER_WORK);
+ return;
+ }
+ if (sd->status.inventorySize == MAX_INVENTORY) {
+ clif->inventoryExpandResult(sd, EXPAND_INVENTORY_RESULT_MAX_SIZE);
+ return;
+ }
+
+ char evname[EVENT_NAME_LENGTH];
+ struct event_data *ev = NULL;
+
+ safestrncpy(evname, "inventory_expansion::OnInvExpandConfirmed", EVENT_NAME_LENGTH);
+ if ((ev = strdb_get(npc->ev_db, evname))) {
+ script->run_npc(ev->nd->u.scr.script, ev->pos, sd->bl.id, ev->nd->bl.id);
+ } else {
+ ShowError("clif_parse_inventoryExpansionConfirmed: event '%s' not found, operation failed.\n", evname);
+ }
+#endif
+}
+
+static void clif_parse_inventoryExpansionRejected(int fd, struct map_session_data *sd) __attribute__((nonnull (2)));
+static void clif_parse_inventoryExpansionRejected(int fd, struct map_session_data *sd)
+{
+#if PACKETVER_MAIN_NUM >= 20181031 || PACKETVER_RE_NUM >= 20181031 || PACKETVER_ZERO_NUM >= 20181114
+ char evname[EVENT_NAME_LENGTH];
+ struct event_data *ev = NULL;
+
+ safestrncpy(evname, "inventory_expansion::OnInvExpandRejected", EVENT_NAME_LENGTH);
+ if ((ev = strdb_get(npc->ev_db, evname))) {
+ script->run_npc(ev->nd->u.scr.script, ev->pos, sd->bl.id, ev->nd->bl.id);
+ } else {
+ ShowError("clif_parse_inventoryExpansionRejected: event '%s' not found, operation failed.\n", evname);
+ }
+#endif
+}
+
+// CZ_REQ_REMAINTIME
+static void clif_parse_reqRemainTime(int fd, struct map_session_data *sd) __attribute__((nonnull (2)));
+static void clif_parse_reqRemainTime(int fd, struct map_session_data *sd)
+{
+}
+
/// Removes cart (ZC_CARTOFF).
/// 012b
/// Client behavior:
@@ -3824,6 +3942,7 @@ static void clif_equipitemack(struct map_session_data *sd, int n, int pos, enum
p.index = n+2;
p.wearLocation = pos;
#if PACKETVER >= 20100629
+ Assert_retv(n >= 0 && n < sd->status.inventorySize);
if (result == EIA_SUCCESS && sd->inventory_data[n]->equip&EQP_VISIBLE)
p.wItemSpriteNumber = sd->inventory_data[n]->view_sprite;
else
@@ -3965,7 +4084,7 @@ static void clif_useitemack(struct map_session_data *sd, int index, int amount,
nullpo_retv(sd);
- if (index < 0 || index >= MAX_INVENTORY)
+ if (index < 0 || index >= sd->status.inventorySize)
return;
fd = sd->fd;
@@ -4314,7 +4433,7 @@ static void clif_tradeadditem(struct map_session_data *sd, struct map_session_da
if (index != 0)
{
index -= 2; //index fix
- Assert_retv(index >= 0 && index < MAX_INVENTORY);
+ Assert_retv(index >= 0 && index < sd->status.inventorySize);
if(sd->inventory_data[index] && sd->inventory_data[index]->view_id > 0)
p.itemId = sd->inventory_data[index]->view_id;
else
@@ -6377,10 +6496,10 @@ static void clif_use_card(struct map_session_data *sd, int idx)
if (!pc->can_insert_card(sd, idx))
return;
- WFIFOHEAD(fd, MAX_INVENTORY * 2 + 4);
+ WFIFOHEAD(fd, sd->status.inventorySize * 2 + 4);
WFIFOW(fd, 0) = 0x17b;
- for (i = c = 0; i < MAX_INVENTORY; i++) {
+ for (i = c = 0; i < sd->status.inventorySize; i++) {
if (!pc->can_insert_card_into(sd, idx, i))
continue;
WFIFOW(fd, 4 + c * 2) = i + 2;
@@ -6424,9 +6543,9 @@ static void clif_item_identify_list(struct map_session_data *sd)
fd=sd->fd;
- WFIFOHEAD(fd,MAX_INVENTORY * 2 + 4);
+ WFIFOHEAD(fd, sd->status.inventorySize * 2 + 4);
WFIFOW(fd,0)=0x177;
- for(i=c=0;i<MAX_INVENTORY;i++){
+ for (i = c = 0; i < sd->status.inventorySize; i++) {
if(sd->status.inventory[i].nameid > 0 && !sd->status.inventory[i].identify){
WFIFOW(fd,c*2+4)=i+2;
c++;
@@ -6471,11 +6590,11 @@ static void clif_item_repair_list(struct map_session_data *sd, struct map_sessio
fd = sd->fd;
- len = MAX_INVENTORY * sizeof(struct PACKET_ZC_REPAIRITEMLIST_sub) + sizeof(struct PACKET_ZC_REPAIRITEMLIST);
+ len = dstsd->status.inventorySize * sizeof(struct PACKET_ZC_REPAIRITEMLIST_sub) + sizeof(struct PACKET_ZC_REPAIRITEMLIST);
WFIFOHEAD(fd, len);
p = WFIFOP(fd, 0);
p->packetType = 0x1fc;
- for (i = c = 0; i < MAX_INVENTORY; i++) {
+ for (i = c = 0; i < sd->status.inventorySize; i++) {
int nameid = dstsd->status.inventory[i].nameid;
if (nameid > 0 && (dstsd->status.inventory[i].attribute & ATTR_BROKEN) != 0) { // && skill_can_repair(sd,nameid)) {
p->items[c].index = i;
@@ -6551,11 +6670,11 @@ static void clif_item_refine_list(struct map_session_data *sd)
skill_lv = pc->checkskill(sd, WS_WEAPONREFINE);
fd = sd->fd;
- len = MAX_INVENTORY * sizeof(struct PACKET_ZC_NOTIFY_WEAPONITEMLIST_sub) + sizeof(struct PACKET_ZC_NOTIFY_WEAPONITEMLIST);
+ len = sd->status.inventorySize * sizeof(struct PACKET_ZC_NOTIFY_WEAPONITEMLIST_sub) + sizeof(struct PACKET_ZC_NOTIFY_WEAPONITEMLIST);
WFIFOHEAD(fd, len);
p = WFIFOP(fd, 0);
p->packetType = 0x221;
- for (i = c = 0; i < MAX_INVENTORY; i++) {
+ for (i = c = 0; i < sd->status.inventorySize; i++) {
if (sd->status.inventory[i].nameid > 0 && sd->status.inventory[i].identify
&& itemdb_wlv(sd->status.inventory[i].nameid) >= 1
&& !sd->inventory_data[i]->flag.no_refine
@@ -7017,7 +7136,7 @@ static void clif_partyinvitationstate(struct map_session_data *sd)
WFIFOHEAD(fd, packet_len(0x2c9));
WFIFOW(fd, 0) = 0x2c9;
- WFIFOB(fd, 2) = sd->status.allow_party ? 1 : 0;
+ WFIFOB(fd, 2) = sd->status.allow_party ? 0 : 1;
WFIFOSET(fd, packet_len(0x2c9));
}
@@ -7385,9 +7504,9 @@ static void clif_sendegg(struct map_session_data *sd)
return;
}
- WFIFOHEAD(fd, MAX_INVENTORY * 2 + 4);
+ WFIFOHEAD(fd, sd->status.inventorySize * 2 + 4);
WFIFOW(fd,0) = 0x1a6;
- for (i = n = 0; i < MAX_INVENTORY; i++) {
+ for (i = n = 0; i < sd->status.inventorySize; i++) {
if (sd->status.inventory[i].nameid <= 0 || sd->inventory_data[i] == NULL || sd->inventory_data[i]->type!=IT_PETEGG || sd->status.inventory[i].amount <= 0)
continue;
WFIFOW(fd, n * 2 + 4) = i + 2;
@@ -7509,10 +7628,11 @@ static void clif_pet_food(struct map_session_data *sd, int foodid, int fail)
/// 01cd { <skill id>.L }*7
static void clif_autospell(struct map_session_data *sd, uint16 skill_lv)
{
+#if PACKETVER_MAIN_NUM >= 20090406 || defined(PACKETVER_RE) || defined(PACKETVER_ZERO) || PACKETVER_SAK_NUM >= 20080618
nullpo_retv(sd);
int fd = sd->fd;
-#if PACKETVER_RE_NUM >= 20181031
+#if PACKETVER_MAIN_NUM >= 20181128 || PACKETVER_RE_NUM >= 20181031
// reserve space for 7 skills
WFIFOHEAD(fd, sizeof(struct PACKET_ZC_AUTOSPELLLIST) + 4 * 7);
#else
@@ -7520,7 +7640,7 @@ static void clif_autospell(struct map_session_data *sd, uint16 skill_lv)
#endif
struct PACKET_ZC_AUTOSPELLLIST *p = WFIFOP(fd, 0);
memset(p, 0, sizeof(struct PACKET_ZC_AUTOSPELLLIST));
- p->packetType = autoSpellList;
+ p->packetType = HEADER_ZC_AUTOSPELLLIST;
int index = 0;
if (skill_lv > 0 && pc->checkskill(sd, MG_NAPALMBEAT) > 0)
@@ -7538,7 +7658,7 @@ static void clif_autospell(struct map_session_data *sd, uint16 skill_lv)
if (skill_lv > 9 && pc->checkskill(sd, MG_FROSTDIVER) > 0)
p->skills[index++] = MG_FROSTDIVER;
-#if PACKETVER_RE_NUM >= 20181031
+#if PACKETVER_MAIN_NUM >= 20181128 || PACKETVER_RE_NUM >= 20181031
const int len = sizeof(struct PACKET_ZC_AUTOSPELLLIST) + index * 4;
p->packetLength = len;
#else
@@ -7548,6 +7668,7 @@ static void clif_autospell(struct map_session_data *sd, uint16 skill_lv)
sd->menuskill_id = SA_AUTOSPELL;
sd->menuskill_val = skill_lv;
+#endif
}
/// Devotion's visual effect (ZC_DEVOTIONLIST).
@@ -8968,6 +9089,34 @@ static void clif_messagecolor(struct block_list *bl, uint32 color, const char *m
clif->send(buf, WBUFW(buf,2), bl, AREA_CHAT_WOC);
}
+// Message without owner, not logged in chat
+static void clif_serviceMessageColor(struct map_session_data *sd, uint32 color, const char *msg)
+{
+#if PACKETVER_MAIN_NUM >= 20170830 || PACKETVER_RE_NUM >= 20170830 || defined(PACKETVER_ZERO)
+ nullpo_retv(sd);
+ nullpo_retv(msg);
+
+ int msg_len = (int)strlen(msg) + 1;
+
+ if (msg_len > 512) {
+ ShowWarning("clif_serviceMessageColor: Truncating too long message '%s' (len=%d).\n", msg, msg_len);
+ msg_len = 512;
+ }
+
+ const int len = sizeof(struct PACKET_ZC_SERVICE_MESSAGE_COLOR) + msg_len;
+ const int fd = sd->fd;
+ WFIFOHEAD(fd, len);
+ struct PACKET_ZC_SERVICE_MESSAGE_COLOR *p = WFIFOP(fd, 0);
+
+ p->packetType = HEADER_ZC_SERVICE_MESSAGE_COLOR;
+ p->packetLength = len;
+ p->color = RGB2BGR(color);
+ safestrncpy(p->message, msg, msg_len);
+
+ WFIFOSET(fd, len);
+#endif
+}
+
/**
* Notifies the client that the storage window is still open
*
@@ -11270,7 +11419,7 @@ static void clif_parse_UseItem(int fd, struct map_session_data *sd)
pc->update_idle_time(sd, BCIDLE_USEITEM);
n = RFIFOW(fd,packet_db[RFIFOW(fd,0)].pos[0])-2;
- if (n < 0 || n >= MAX_INVENTORY)
+ if (n < 0 || n >= sd->status.inventorySize)
return;
if (!pc->useitem(sd,n))
clif->useitemack(sd,n,0,false); //Send an empty ack packet or the client gets stuck.
@@ -11291,7 +11440,7 @@ static void clif_parse_EquipItem(int fd, struct map_session_data *sd)
}
index = p->index - 2;
- if (index >= MAX_INVENTORY)
+ if (index >= sd->status.inventorySize)
return; //Out of bounds check.
if( sd->npc_id ) {
@@ -11415,6 +11564,8 @@ static void clif_parse_NpcBuySellSelected(int fd, struct map_session_data *sd)
/// 1 = "You do not have enough zeny."
/// 2 = "You are over your Weight Limit."
/// 3 = "Out of the maximum capacity, you have too many items."
+/// 9 = "Amounts are exceeded the possession of the item is not available for purchase."
+/// 10 = "Props open-air store sales will be traded in RODEX"
static void clif_npc_buy_result(struct map_session_data *sd, unsigned char result)
{
int fd;
@@ -11966,33 +12117,24 @@ static void clif_parse_UseSkillToPos_mercenary(struct mercenary_data *md, struct
unit->skilluse_pos(&md->bl, x, y, skill_id, skill_lv);
}
-static void clif_parse_UseSkillToId(int fd, struct map_session_data *sd) __attribute__((nonnull (2)));
-/// Request to use a targeted skill.
-/// 0113 <skill lv>.W <skill id>.W <target id>.L (CZ_USE_SKILL)
-/// 0438 <skill lv>.W <skill id>.W <target id>.L (CZ_USE_SKILL2)
-/// There are various variants of this packet, some of them have padding between fields.
-static void clif_parse_UseSkillToId(int fd, struct map_session_data *sd)
+static void clif_useSkillToIdReal(int fd, struct map_session_data *sd, int skill_id, int skill_lv, int target_id) __attribute__((nonnull (2)));
+static void clif_useSkillToIdReal(int fd, struct map_session_data *sd, int skill_id, int skill_lv, int target_id)
{
- uint16 skill_id, skill_lv;
- int tmp, target_id;
int64 tick = timer->gettick();
- skill_lv = RFIFOW(fd,packet_db[RFIFOW(fd,0)].pos[0]);
- skill_id = RFIFOW(fd,packet_db[RFIFOW(fd,0)].pos[1]);
- target_id = RFIFOL(fd,packet_db[RFIFOW(fd,0)].pos[2]);
-
- if( skill_lv < 1 ) skill_lv = 1; //No clue, I have seen the client do this with guild skills :/ [Skotlex]
+ if (skill_lv < 1)
+ skill_lv = 1; //No clue, I have seen the client do this with guild skills :/ [Skotlex]
- tmp = skill->get_inf(skill_id);
- if (tmp&INF_GROUND_SKILL || !tmp)
+ int tmp = skill->get_inf(skill_id);
+ if (tmp & INF_GROUND_SKILL || !tmp)
return; //Using a ground/passive skill on a target? WRONG.
- if( skill_id >= HM_SKILLBASE && skill_id < HM_SKILLBASE + MAX_HOMUNSKILL ) {
+ if (skill_id >= HM_SKILLBASE && skill_id < HM_SKILLBASE + MAX_HOMUNSKILL) {
clif->pUseSkillToId_homun(sd->hd, sd, tick, skill_id, skill_lv, target_id);
return;
}
- if( skill_id >= MC_SKILLBASE && skill_id < MC_SKILLBASE + MAX_MERCSKILL ) {
+ if (skill_id >= MC_SKILLBASE && skill_id < MC_SKILLBASE + MAX_MERCSKILL) {
clif->pUseSkillToId_mercenary(sd->md, sd, tick, skill_id, skill_lv, target_id);
return;
}
@@ -12009,51 +12151,52 @@ static void clif_parse_UseSkillToId(int fd, struct map_session_data *sd)
return;
}
- if( pc_cant_act(sd)
- && skill_id != RK_REFRESH
- && !(skill_id == SR_GENTLETOUCH_CURE && (sd->sc.opt1 == OPT1_STONE || sd->sc.opt1 == OPT1_FREEZE || sd->sc.opt1 == OPT1_STUN))
- && (sd->state.storage_flag != STORAGE_FLAG_CLOSED && !(tmp&INF_SELF_SKILL)) // SELF skills can be used with the storage open, issue: 8027
- )
+ if (pc_cant_act(sd)
+ && skill_id != RK_REFRESH
+ && !(skill_id == SR_GENTLETOUCH_CURE && (sd->sc.opt1 == OPT1_STONE || sd->sc.opt1 == OPT1_FREEZE || sd->sc.opt1 == OPT1_STUN))
+ && (sd->state.storage_flag != STORAGE_FLAG_CLOSED && !(tmp&INF_SELF_SKILL)) // SELF skills can be used with the storage open, issue: 8027
+ ) {
return;
+ }
- if( pc_issit(sd) )
+ if (pc_issit(sd))
return;
- if( skill->not_ok(skill_id, sd) )
+ if (skill->not_ok(skill_id, sd))
return;
- if( sd->bl.id != target_id && tmp&INF_SELF_SKILL )
+ if (sd->bl.id != target_id && tmp & INF_SELF_SKILL)
target_id = sd->bl.id; // never trust the client
- if( target_id < 0 && -target_id == sd->bl.id ) // for disguises [Valaris]
+ if (target_id < 0 && -target_id == sd->bl.id) // for disguises [Valaris]
target_id = sd->bl.id;
- if( sd->ud.skilltimer != INVALID_TIMER ) {
- if( skill_id != SA_CASTCANCEL && skill_id != SO_SPELLFIST )
+ if (sd->ud.skilltimer != INVALID_TIMER) {
+ if (skill_id != SA_CASTCANCEL && skill_id != SO_SPELLFIST)
return;
- } else if( DIFF_TICK(tick, sd->ud.canact_tick) < 0 ) {
- if( sd->skillitem != skill_id ) {
+ } else if (DIFF_TICK(tick, sd->ud.canact_tick) < 0) {
+ if (sd->skillitem != skill_id) {
clif->skill_fail(sd, skill_id, USESKILL_FAIL_SKILLINTERVAL, 0, 0);
return;
}
}
- if( sd->sc.option&OPTION_COSTUME )
+ if (sd->sc.option & OPTION_COSTUME)
return;
- if( sd->sc.data[SC_BASILICA] && (skill_id != HP_BASILICA || sd->sc.data[SC_BASILICA]->val4 != sd->bl.id) )
+ if (sd->sc.data[SC_BASILICA] && (skill_id != HP_BASILICA || sd->sc.data[SC_BASILICA]->val4 != sd->bl.id))
return; // On basilica only caster can use Basilica again to stop it.
- if( sd->menuskill_id ) {
- if( sd->menuskill_id == SA_TAMINGMONSTER ) {
+ if (sd->menuskill_id) {
+ if (sd->menuskill_id == SA_TAMINGMONSTER) {
clif_menuskill_clear(sd); //Cancel pet capture.
- } else if( sd->menuskill_id != SA_AUTOSPELL )
+ } else if (sd->menuskill_id != SA_AUTOSPELL)
return; //Can't use skills while a menu is open.
}
- if( sd->skillitem == skill_id ) {
- if( skill_lv != sd->skillitemlv )
+ if (sd->skillitem == skill_id) {
+ if (skill_lv != sd->skillitemlv)
skill_lv = sd->skillitemlv;
- if( !(tmp&INF_SELF_SKILL) )
+ if (!(tmp&INF_SELF_SKILL))
pc->delinvincibletimer(sd); // Target skills through items cancel invincibility. [Inkfish]
unit->skilluse_id(&sd->bl, target_id, skill_id, skill_lv);
return;
@@ -12062,22 +12205,56 @@ static void clif_parse_UseSkillToId(int fd, struct map_session_data *sd)
sd->skillitem = sd->skillitemlv = 0;
if (skill_id >= GD_SKILLBASE && skill_id < GD_MAX) {
- if( sd->state.gmaster_flag )
+ if (sd->state.gmaster_flag)
skill_lv = guild->checkskill(sd->guild, skill_id);
else
skill_lv = 0;
} else {
tmp = pc->checkskill(sd, skill_id);
- if( skill_lv > tmp )
+ if (skill_lv > tmp)
skill_lv = tmp;
}
pc->delinvincibletimer(sd);
- if( skill_lv )
+ if (skill_lv)
unit->skilluse_id(&sd->bl, target_id, skill_id, skill_lv);
}
+static void clif_parse_UseSkillToId(int fd, struct map_session_data *sd) __attribute__((nonnull (2)));
+/// Request to use a targeted skill.
+/// 0113 <skill lv>.W <skill id>.W <target id>.L (CZ_USE_SKILL)
+/// 0438 <skill lv>.W <skill id>.W <target id>.L (CZ_USE_SKILL2)
+/// There are various variants of this packet, some of them have padding between fields.
+static void clif_parse_UseSkillToId(int fd, struct map_session_data *sd)
+{
+ clif->useSkillToIdReal(fd,
+ sd,
+ RFIFOW(fd, packet_db[RFIFOW(fd, 0)].pos[1]),
+ RFIFOW(fd, packet_db[RFIFOW(fd, 0)].pos[0]),
+ RFIFOL(fd, packet_db[RFIFOW(fd, 0)].pos[2]));
+}
+
+static void clif_parse_startUseSkillToId(int fd, struct map_session_data *sd) __attribute__((nonnull (2)));
+static void clif_parse_startUseSkillToId(int fd, struct map_session_data *sd)
+{
+#if PACKETVER_MAIN_NUM >= 20181002 || PACKETVER_RE_NUM >= 20181002 || PACKETVER_ZERO_NUM >= 20181010
+ const struct PACKET_CZ_START_USE_SKILL *p = RFIFOP(fd, 0);
+ clif->useSkillToIdReal(fd, sd, p->skillId, p->skillLv, p->targetId);
+#endif
+}
+
+static void clif_parse_stopUseSkillToId(int fd, struct map_session_data *sd) __attribute__((nonnull (2)));
+static void clif_parse_stopUseSkillToId(int fd, struct map_session_data *sd)
+{
+#if PACKETVER_MAIN_NUM >= 20181002 || PACKETVER_RE_NUM >= 20181002 || PACKETVER_ZERO_NUM >= 20181010
+ const struct PACKET_CZ_STOP_USE_SKILL *p = RFIFOP(fd, 0);
+ if (p->skillId != GC_ROLLINGCUTTER) {
+ ShowWarning("Packet CZ_STOP_USE_SKILL usage for unknown skill: %d\n", p->skillId);
+ }
+#endif
+}
+
/*==========================================
* Client tells server he'd like to use AoE skill id 'skill_id' of level 'skill_lv' on 'x','y' location
*------------------------------------------*/
@@ -12454,7 +12631,7 @@ static void clif_parse_OneClick_ItemIdentify(int fd, struct map_session_data *sd
short idx = RFIFOW(fd, packet_db[cmd].pos[0]) - 2;
int n;
- if (idx < 0 || idx >= MAX_INVENTORY || sd->inventory_data[idx] == NULL || sd->status.inventory[idx].nameid <= 0)
+ if (idx < 0 || idx >= sd->status.inventorySize || sd->inventory_data[idx] == NULL || sd->status.inventory[idx].nameid <= 0)
return;
if ((n = pc->have_magnifier(sd) ) != INDEX_NOT_FOUND &&
@@ -12474,7 +12651,7 @@ static void clif_parse_SelectArrow(int fd, struct map_session_data *sd)
clif_menuskill_clear(sd);
return;
}
-#if PACKETVER_RE_NUM >= 20180704
+#if PACKETVER_MAIN_NUM >= 20181121 || PACKETVER_RE_NUM >= 20180704 || PACKETVER_ZERO_NUM >= 20181114
itemId = RFIFOL(fd, 2);
#else
itemId = RFIFOW(fd, 2);
@@ -12604,7 +12781,7 @@ static void clif_parse_MoveToKafra(int fd, struct map_session_data *sd)
item_index = RFIFOW(fd,packet_db[RFIFOW(fd,0)].pos[0])-2;
item_amount = RFIFOL(fd,packet_db[RFIFOW(fd,0)].pos[1]);
- if (item_index < 0 || item_index >= MAX_INVENTORY || item_amount < 1)
+ if (item_index < 0 || item_index >= sd->status.inventorySize || item_amount < 1)
return;
if (sd->state.storage_flag == STORAGE_FLAG_NORMAL)
@@ -14255,10 +14432,10 @@ static void clif_parse_pet_evolution(int fd, struct map_session_data *sd)
return;
}
- ARR_FIND(0, MAX_INVENTORY, idx, sd->status.inventory[idx].card[0] == CARD0_PET &&
+ ARR_FIND(0, sd->status.inventorySize, idx, sd->status.inventory[idx].card[0] == CARD0_PET &&
sd->status.pet_id == MakeDWord(sd->status.inventory[idx].card[1], sd->status.inventory[idx].card[2]));
- if (idx == MAX_INVENTORY) {
+ if (idx == sd->status.inventorySize) {
clif->petEvolutionResult(fd, PET_EVOL_NO_PETEGG);
return;
}
@@ -16243,7 +16420,7 @@ static void clif_parse_Auction_setitem(int fd, struct map_session_data *sd)
if( sd->auction.amount > 0 )
sd->auction.amount = 0;
- if( idx < 0 || idx >= MAX_INVENTORY ) {
+ if (idx < 0 || idx >= sd->status.inventorySize) {
ShowWarning("Character %s trying to set invalid item index in auctions.\n", sd->status.name);
return;
}
@@ -16318,7 +16495,7 @@ static void clif_parse_Auction_register(int fd, struct map_session_data *sd)
if (!battle_config.feature_auction)
return;
- Assert_retv(sd->auction.index >= 0 && sd->auction.index < MAX_INVENTORY);
+ Assert_retv(sd->auction.index >= 0 && sd->auction.index < sd->status.inventorySize);
memset(&auction, 0, sizeof(auction));
auction.price = RFIFOL(fd,2);
@@ -16825,13 +17002,13 @@ static void clif_parse_cz_config(int fd, struct map_session_data *sd)
static void clif_parse_PartyTick(int fd, struct map_session_data *sd) __attribute__((nonnull (2)));
/// Request to change party invitation tick.
/// value:
-/// 0 = disabled
-/// 1 = enabled
+/// 0 = enabled
+/// 1 = disabled
static void clif_parse_PartyTick(int fd, struct map_session_data *sd)
{
- bool flag = RFIFOB(fd,6)?true:false;
- sd->status.allow_party = flag;
- clif->partytickack(sd, flag);
+ const struct PACKET_CZ_PARTY_CONFIG *const p = RFIFOP(fd, 0);
+ sd->status.allow_party = p->refuseInvite ? false : true;
+ clif->partytickack(sd, sd->status.allow_party);
}
/// Questlog System [Kevin] [Inkfish]
@@ -17798,8 +17975,8 @@ static void clif_parse_ItemListWindowSelected(int fd, struct map_session_data *s
return; // Canceled by player.
}
- if (n > MAX_INVENTORY)
- n = MAX_INVENTORY; // It should be impossible to have more than that.
+ if (n > sd->status.inventorySize)
+ n = sd->status.inventorySize; // It should be impossible to have more than that.
if (sd->menuskill_id != SO_EL_ANALYSIS && sd->menuskill_id != GN_CHANGEMATERIAL) {
clif_menuskill_clear(sd);
@@ -18552,7 +18729,7 @@ static int clif_spellbook_list(struct map_session_data *sd)
WFIFOHEAD(fd, 8 * 8 + 8);
WFIFOW(fd,0) = 0x1ad;
- for( i = 0, c = 0; i < MAX_INVENTORY; i ++ )
+ for (i = 0, c = 0; i < sd->status.inventorySize; i ++ )
{
if( itemdb_is_spellbook(sd->status.inventory[i].nameid) )
{
@@ -18592,7 +18769,7 @@ static int clif_magicdecoy_list(struct map_session_data *sd, uint16 skill_lv, sh
WFIFOHEAD(fd, 8 * 8 + 8);
WFIFOW(fd,0) = 0x1ad; // This is the official packet. [pakpil]
- for( i = 0, c = 0; i < MAX_INVENTORY; i ++ ) {
+ for (i = 0, c = 0; i < sd->status.inventorySize; i ++) {
if( itemdb_is_element(sd->status.inventory[i].nameid) ) {
WFIFOW(fd, c * 2 + 4) = sd->status.inventory[i].nameid;
c ++;
@@ -18629,7 +18806,7 @@ static int clif_poison_list(struct map_session_data *sd, uint16 skill_lv)
WFIFOHEAD(fd, 8 * 8 + 8);
WFIFOW(fd,0) = 0x1ad; // This is the official packet. [pakpil]
- for( i = 0, c = 0; i < MAX_INVENTORY; i ++ ) {
+ for (i = 0, c = 0; i < sd->status.inventorySize; i ++) {
if( itemdb_is_poison(sd->status.inventory[i].nameid) ) {
WFIFOW(fd, c * 2 + 4) = sd->status.inventory[i].nameid;
c ++;
@@ -18770,7 +18947,7 @@ static void clif_parse_MoveItem(int fd, struct map_session_data *sd)
index = RFIFOW(fd,2)-2;
- if (index < 0 || index >= MAX_INVENTORY)
+ if (index < 0 || index >= sd->status.inventorySize)
return;
if ( sd->status.inventory[index].favorite && RFIFOB(fd, 4) == 1 )
@@ -19695,31 +19872,31 @@ static void clif_parse_NPCShopClosed(int fd, struct map_session_data *sd)
/* NPC Market (by Ind after an extensive debugging of the packet, only possible thanks to Yommy <3) */
static void clif_npc_market_open(struct map_session_data *sd, struct npc_data *nd)
{
-#if PACKETVER >= 20131223
- struct npc_item_list *shop;
- unsigned short shop_size, i, c;
-
+#if PACKETVER_MAIN_NUM >= 20131120 || PACKETVER_RE_NUM >= 20131106 || defined(PACKETVER_ZERO)
nullpo_retv(sd);
nullpo_retv(nd);
- shop = nd->u.scr.shop->item;
- shop_size = nd->u.scr.shop->items;
- npcmarket_open.PacketType = npcmarketopenType;
+ struct npc_item_list *shop = nd->u.scr.shop->item;
+ const int shop_size = nd->u.scr.shop->items;
+
+ int c = 0;
+ int maxCount = (sizeof(packet_buf) - sizeof(struct PACKET_ZC_NPC_MARKET_OPEN)) / sizeof(struct PACKET_ZC_NPC_MARKET_OPEN_sub);
+ struct PACKET_ZC_NPC_MARKET_OPEN *packet = (struct PACKET_ZC_NPC_MARKET_OPEN*)&packet_buf[0];
+ packet->packetType = HEADER_ZC_NPC_MARKET_OPEN;
- for(i = 0, c = 0; i < shop_size; i++) {
+ for (int i = 0; i < shop_size && c < maxCount; i++) {
struct item_data *id = NULL;
if (shop[i].nameid && (id = itemdb->exists(shop[i].nameid)) != NULL) {
- npcmarket_open.list[c].nameid = shop[i].nameid;
- npcmarket_open.list[c].price = shop[i].value;
- npcmarket_open.list[c].qty = shop[i].qty;
- npcmarket_open.list[c].type = itemtype(id->type);
- npcmarket_open.list[c].view = ( id->view_id > 0 ) ? id->view_id : id->nameid;
+ packet->list[c].nameid = shop[i].nameid;
+ packet->list[c].price = shop[i].value;
+ packet->list[c].qty = shop[i].qty;
+ packet->list[c].type = itemtype(id->type);
+ packet->list[c].weight = id->weight;
c++;
}
}
- npcmarket_open.PacketLength = 4 + ( sizeof(npcmarket_open.list[0]) * c );
-
- clif->send(&npcmarket_open,npcmarket_open.PacketLength,&sd->bl,SELF);
+ packet->packetLength = sizeof(struct PACKET_ZC_NPC_MARKET_OPEN) + sizeof(struct PACKET_ZC_NPC_MARKET_OPEN_sub) * c;
+ clif->send(packet, packet->packetLength, &sd->bl, SELF);
#endif
}
@@ -19776,7 +19953,7 @@ static void clif_parse_NPCMarketPurchase(int fd, struct map_session_data *sd)
int count = (p->PacketLength - 4) / sizeof p->list[0];
struct itemlist item_list;
- Assert_retv(count >= 0 && count <= MAX_INVENTORY);
+ Assert_retv(count >= 0 && count <= sd->status.inventorySize);
VECTOR_INIT(item_list);
VECTOR_ENSURE(item_list, count, 1);
@@ -19823,7 +20000,7 @@ static void clif_parse_RouletteOpen(int fd, struct map_session_data *sd)
}
p.PacketType = 0xa1a;
- p.Result = 0;
+ p.Result = OPEN_ROULETTE_SUCCESS;
p.Serial = 0;
p.Step = sd->roulette.stage - 1;
p.Idx = (char)sd->roulette.prizeIdx;
@@ -20082,7 +20259,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, int bonusItemID)
+static void clif_roulette_generate_ack(struct map_session_data *sd, enum GENERATE_ROULETTE_ACK result, short stage, short prizeIdx, int bonusItemID)
{
#if PACKETVER >= 20140612
struct packet_roulette_generate_ack p;
@@ -20114,7 +20291,7 @@ static void clif_openmergeitem(int fd, struct map_session_data *sd)
nullpo_retv(sd);
memset(&merge_items,'\0',sizeof(merge_items));
- for (i = 0; i < MAX_INVENTORY; i++) {
+ for (i = 0; i < sd->status.inventorySize; i++) {
struct item *item_data = &sd->status.inventory[i];
if (item_data->nameid == 0 || !itemdb->isstackable(item_data->nameid) || item_data->bound != IBT_NONE)
@@ -20175,7 +20352,7 @@ static void clif_ackmergeitems(int fd, struct map_session_data *sd)
nullpo_retv(sd);
length = (RFIFOW(fd,2) - 4)/2;
- if (length >= MAX_INVENTORY || length < 2) {
+ if (length >= sd->status.inventorySize || length < 2) {
WFIFOHEAD(fd,7);
WFIFOW(fd,0) = 0x96f;
WFIFOW(fd,2) = 0;
@@ -20189,7 +20366,7 @@ static void clif_ackmergeitems(int fd, struct map_session_data *sd)
int16 idx = RFIFOW(fd,i*2+4) - 2;
struct item *it = NULL;
- if (idx < 0 || idx >= MAX_INVENTORY)
+ if (idx < 0 || idx >= sd->status.inventorySize)
continue;
it = &sd->status.inventory[idx];
@@ -20239,7 +20416,7 @@ static void clif_ackmergeitems(int fd, struct map_session_data *sd)
item_data.unique_id = itemdb->unique_id(sd);
pc->additem(sd,&item_data,count,LOG_TYPE_NPC);
- ARR_FIND(0,MAX_INVENTORY,i,item_data.unique_id == sd->status.inventory[i].unique_id);
+ ARR_FIND(0, sd->status.inventorySize, i, item_data.unique_id == sd->status.inventory[i].unique_id);
WFIFOHEAD(fd,7);
WFIFOW(fd,0) = 0x96f;
@@ -20358,21 +20535,21 @@ static const char *clif_get_bl_name(const struct block_list *bl)
*/
static void clif_clan_basicinfo(struct map_session_data *sd)
{
-#if PACKETVER >= 20120716
+#if PACKETVER_MAIN_NUM >= 20130626 || PACKETVER_RE_NUM >= 20130605 || defined(PACKETVER_ZERO)
int len, i, fd;
struct clan *c, *ally, *antagonist;
struct PACKET_ZC_CLANINFO *packet = NULL;
-
nullpo_retv(sd);
nullpo_retv(c = sd->clan);
len = sizeof(struct PACKET_ZC_CLANINFO);
fd = sd->fd;
- WFIFOHEAD(fd, len);
+ const int maxEntries = 100; // max entries with clan names
+ WFIFOHEAD(fd, len + maxEntries * 24);
packet = WFIFOP(fd, 0);
- packet->PacketType = clanBasicInfo;
+ packet->PacketType = HEADER_ZC_CLANINFO;
packet->ClanID = c->clan_id;
safestrncpy(packet->ClanName, c->name, NAME_LENGTH);
@@ -20383,24 +20560,27 @@ static void clif_clan_basicinfo(struct map_session_data *sd)
packet->AllyCount = VECTOR_LENGTH(c->allies);
packet->AntagonistCount = VECTOR_LENGTH(c->antagonists);
+ int cnt = 0;
// All allies and antagonists are assumed as valid entries
// since it only gets inside the vector after the validation
// on clan->config_read
- for (i = 0; i < VECTOR_LENGTH(c->allies); i++) {
+ for (i = 0; i < VECTOR_LENGTH(c->allies) && cnt < maxEntries; i++) {
struct clan_relationship *al = &VECTOR_INDEX(c->allies, i);
if ((ally = clan->search(al->clan_id)) != NULL) {
safestrncpy(WFIFOP(fd, len), ally->name, NAME_LENGTH);
len += NAME_LENGTH;
+ cnt ++;
}
}
- for (i = 0; i < VECTOR_LENGTH(c->antagonists); i++) {
+ for (i = 0; i < VECTOR_LENGTH(c->antagonists) && cnt < maxEntries; i++) {
struct clan_relationship *an = &VECTOR_INDEX(c->antagonists, i);
if ((antagonist = clan->search(an->clan_id)) != NULL) {
safestrncpy(WFIFOP(fd, len), antagonist->name, NAME_LENGTH);
len += NAME_LENGTH;
+ cnt ++;
}
}
@@ -20795,7 +20975,7 @@ static void clif_rodex_add_item_result(struct map_session_data *sd, int16 idx, i
int fd, j;
nullpo_retv(sd);
- if (idx < 0 || idx >= MAX_INVENTORY)
+ if (idx < 0 || idx >= sd->status.inventorySize)
return;
fd = sd->fd;
@@ -20848,7 +21028,7 @@ static void clif_rodex_remove_item_result(struct map_session_data *sd, int16 idx
int fd;
nullpo_retv(sd);
- Assert_retv(idx >= 0 && idx < MAX_INVENTORY);
+ Assert_retv(idx >= 0 && idx < sd->status.inventorySize);
fd = sd->fd;
@@ -21631,7 +21811,7 @@ static void clif_ui_action(struct map_session_data *sd, int32 UIType, int32 data
static void clif_parse_private_airship_request(int fd, struct map_session_data *sd) __attribute__((nonnull(2)));
static void clif_parse_private_airship_request(int fd, struct map_session_data *sd)
{
-#if PACKETVER_RE_NUM >= 20180321 || PACKETVER_MAIN_NUM >= 20180620
+#if PACKETVER_RE_NUM >= 20180321 || PACKETVER_MAIN_NUM >= 20180620 || defined(PACKETVER_ZERO)
char evname[EVENT_NAME_LENGTH];
struct event_data *ev = NULL;
const struct PACKET_CZ_PRIVATE_AIRSHIP_REQUEST *p = RP2PTR(fd);
@@ -21651,7 +21831,7 @@ static void clif_parse_private_airship_request(int fd, struct map_session_data *
static void clif_private_airship_response(struct map_session_data *sd, uint32 flag)
{
-#if PACKETVER_RE_NUM >= 20180321 || PACKETVER_MAIN_NUM >= 20180620
+#if PACKETVER_RE_NUM >= 20180321 || PACKETVER_MAIN_NUM >= 20180620 || defined(PACKETVER_ZERO)
struct PACKET_ZC_PRIVATE_AIRSHIP_RESPONSE p;
nullpo_retv(sd);
@@ -21945,7 +22125,7 @@ static void clif_camera_showWindow(struct map_session_data *sd)
#if PACKETVER >= 20160525
nullpo_retv(sd);
struct PACKET_ZC_CAMERA_INFO p;
- p.packetType = 0xa78;
+ p.packetType = HEADER_ZC_CAMERA_INFO;
p.action = 1;
p.range = 0;
p.rotation = 0;
@@ -21959,7 +22139,7 @@ static void clif_camera_change(struct map_session_data *sd, float range, float r
#if PACKETVER >= 20160525
nullpo_retv(sd);
struct PACKET_ZC_CAMERA_INFO p;
- p.packetType = 0xa78;
+ p.packetType = HEADER_ZC_CAMERA_INFO;
p.action = 0;
p.range = range;
p.rotation = rotation;
@@ -21968,12 +22148,27 @@ static void clif_camera_change(struct map_session_data *sd, float range, float r
#endif
}
+static void clif_parse_cameraInfo(int fd, struct map_session_data *sd) __attribute__((nonnull (2)));
+static void clif_parse_cameraInfo(int fd, struct map_session_data *sd)
+{
+#if PACKETVER >= 20160525
+ const struct PACKET_CZ_CAMERA_INFO *const p = RFIFOP(fd, 0);
+ char command[100];
+ if (p->action == 1) {
+ sprintf(command, "%ccamerainfo", atcommand->at_symbol);
+ } else {
+ sprintf(command, "%ccamerainfo %15f %15f %15f", atcommand->at_symbol, p->range, p->rotation, p->latitude);
+ }
+ atcommand->exec(fd, sd, command, true);
+#endif
+}
+
// show item preview in already opened preview window
static void clif_item_preview(struct map_session_data *sd, int n)
{
#if PACKETVER_MAIN_NUM >= 20170726 || PACKETVER_RE_NUM >= 20170621 || defined(PACKETVER_ZERO)
nullpo_retv(sd);
- Assert_retv(n >= 0 && n < MAX_INVENTORY);
+ Assert_retv(n >= 0 && n < sd->status.inventorySize);
struct PACKET_ZC_ITEM_PREVIEW p;
p.packetType = HEADER_ZC_ITEM_PREVIEW;
@@ -21988,6 +22183,24 @@ static void clif_item_preview(struct map_session_data *sd, int n)
#endif
}
+// insert cardId into equipped item in pos equipment slot into slot cardSlot.
+static bool clif_enchant_equipment(struct map_session_data *sd, enum equip_pos pos, int cardSlot, int cardId)
+{
+#if PACKETVER_MAIN_NUM >= 20160831 || PACKETVER_RE_NUM >= 20151118 || defined(PACKETVER_ZERO)
+ nullpo_ret(sd);
+ Assert_ret(cardSlot >= 0 && cardSlot < MAX_SLOTS);
+ struct PACKET_ZC_ENCHANT_EQUIPMENT p;
+ p.packetType = HEADER_ZC_ENCHANT_EQUIPMENT;
+ p.wearState = pos;
+ p.cardSlot = cardSlot;
+ p.itemId = cardId;
+ clif->send(&p, sizeof(p), &sd->bl, SELF);
+ return true;
+#else
+ return false;
+#endif
+}
+
/*==========================================
* Main client packet processing function
*------------------------------------------*/
@@ -22447,6 +22660,12 @@ void clif_defaults(void)
clif->equipItems = clif_equipItems;
clif->cartList = clif_cartList;
clif->cartItems = clif_cartItems;
+ clif->inventoryExpansionInfo = clif_inventoryExpansionInfo;
+ clif->inventoryExpandAck = clif_inventoryExpandAck;
+ clif->inventoryExpandResult = clif_inventoryExpandResult;
+ clif->pInventoryExpansion = clif_parse_inventoryExpansion;
+ clif->pInventoryExpansionConfirmed = clif_parse_inventoryExpansionConfirmed;
+ clif->pInventoryExpansionRejected = clif_parse_inventoryExpansionRejected;
clif->favorite_item = clif_favorite_item;
clif->clearcart = clif_clearcart;
clif->item_identify_list = clif_item_identify_list;
@@ -22568,6 +22787,7 @@ void clif_defaults(void)
clif->broadcast2 = clif_broadcast2;
clif->messagecolor_self = clif_messagecolor_self;
clif->messagecolor = clif_messagecolor;
+ clif->serviceMessageColor = clif_serviceMessageColor;
clif->disp_overhead = clif_disp_overhead;
clif->notify_playerchat = clif_notify_playerchat;
clif->msgtable_skill = clif_msgtable_skill;
@@ -22892,6 +23112,9 @@ void clif_defaults(void)
clif->pUseSkillToId = clif_parse_UseSkillToId;
clif->pUseSkillToId_homun = clif_parse_UseSkillToId_homun;
clif->pUseSkillToId_mercenary = clif_parse_UseSkillToId_mercenary;
+ clif->pStartUseSkillToId = clif_parse_startUseSkillToId;
+ clif->pStopUseSkillToId = clif_parse_stopUseSkillToId;
+ clif->useSkillToIdReal = clif_useSkillToIdReal;
clif->pUseSkillToPos = clif_parse_UseSkillToPos;
clif->pUseSkillToPosSub = clif_parse_UseSkillToPosSub;
clif->pUseSkillToPos_homun = clif_parse_UseSkillToPos_homun;
@@ -23153,11 +23376,14 @@ void clif_defaults(void)
clif->camera_showWindow = clif_camera_showWindow;
clif->camera_change = clif_camera_change;
+ clif->pCameraInfo = clif_parse_cameraInfo;
clif->item_preview = clif_item_preview;
+ clif->enchant_equipment = clif_enchant_equipment;
// -- Pet Evolution
clif->pPetEvolution = clif_parse_pet_evolution;
clif->petEvolutionResult = clif_pet_evolution_result;
clif->pMemorialDungeonCommand = clif_parse_memorial_dungeon_command;
+ clif->pReqRemainTime = clif_parse_reqRemainTime;
}
diff --git a/src/map/clif.h b/src/map/clif.h
index 593dc15c1..91a91b5d3 100644
--- a/src/map/clif.h
+++ b/src/map/clif.h
@@ -237,13 +237,13 @@ typedef enum emotion_type {
E_MAX
} emotion_type;
-typedef enum clr_type {
+enum clr_type {
CLR_OUTSIGHT = 0,
CLR_DEAD,
CLR_RESPAWN,
CLR_TELEPORT,
CLR_TRICKDEAD,
-} clr_type;
+};
enum map_property { // clif_map_property
MAPPROPERTY_NOTHING = 0,
@@ -493,13 +493,17 @@ enum RECV_ROULETTE_ITEM_ACK {
};
enum GENERATE_ROULETTE_ACK {
- GENERATE_ROULETTE_SUCCESS = 0x0,
- GENERATE_ROULETTE_FAILED = 0x1,
- GENERATE_ROULETTE_NO_ENOUGH_POINT = 0x2,
- GENERATE_ROULETTE_LOSING = 0x3,
+ GENERATE_ROULETTE_SUCCESS = 0x0,
+ GENERATE_ROULETTE_FAILED = 0x1,
+ GENERATE_ROULETTE_NO_ENOUGH_POINT = 0x2,
+ GENERATE_ROULETTE_LOSING = 0x3,
+ GENERATE_ROULETTE_NO_ENOUGH_INVENTORY_SPACE = 0x4,
+#if PACKETVER >= 20141001
+ GENERATE_ROULETTE_CANT_PLAY = 0x5,
+#endif
};
-enum OPEN_ROULETTE_ACK{
+enum OPEN_ROULETTE_ACK {
OPEN_ROULETTE_SUCCESS = 0x0,
OPEN_ROULETTE_FAILED = 0x1,
};
@@ -583,8 +587,8 @@ enum zc_ui_types {
**/
enum cz_ui_types {
CZ_STYLIST_UI = 1,
- //unknown = 2,
- //unknown = 3,
+ CZ_MACRO_REGISTER_UI = 2,
+ CZ_MACRO_DETECTOR_UI = 3,
CZ_ATTENDANCE_UI = 5
};
@@ -673,6 +677,22 @@ enum memorial_dungeon_command {
COMMAND_MEMORIALDUNGEON_DESTROY_FORCE = 0x3,
};
+enum expand_inventory {
+ EXPAND_INVENTORY_ASK_CONFIRMATION = 0,
+ EXPAND_INVENTORY_FAILED = 1,
+ EXPAND_INVENTORY_OTHER_WORK = 2,
+ EXPAND_INVENTORY_MISSING_ITEM = 3,
+ EXPAND_INVENTORY_MAX_SIZE = 4
+};
+
+enum expand_inventory_result {
+ EXPAND_INVENTORY_RESULT_SUCCESS = 0,
+ EXPAND_INVENTORY_RESULT_FAILED = 1,
+ EXPAND_INVENTORY_RESULT_OTHER_WORK = 2,
+ EXPAND_INVENTORY_RESULT_MISSING_ITEM = 3,
+ EXPAND_INVENTORY_RESULT_MAX_SIZE = 4
+};
+
/**
* Clif.c Interface
**/
@@ -752,9 +772,9 @@ struct clif_interface {
void (*package_announce) (struct map_session_data *sd, int nameid, int containerid);
void (*item_drop_announce) (struct map_session_data *sd, int 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);
- void (*clearunit_delayed) (struct block_list* bl, clr_type type, int64 tick);
+ void (*clearunit_single) (int id, enum clr_type type, int fd);
+ void (*clearunit_area) (struct block_list* bl, enum clr_type type);
+ void (*clearunit_delayed) (struct block_list* bl, enum clr_type type, int64 tick);
void (*walkok) (struct map_session_data *sd);
void (*move) (struct unit_data *ud);
void (*move2) (struct block_list *bl, struct view_data *vd, struct unit_data *ud);
@@ -847,6 +867,12 @@ struct clif_interface {
void (*equipItems) (struct map_session_data *sd, enum inventory_type type);
void (*cartList) (struct map_session_data *sd);
void (*cartItems) (struct map_session_data *sd, enum inventory_type type);
+ void (*inventoryExpansionInfo) (struct map_session_data *sd);
+ void (*inventoryExpandAck) (struct map_session_data *sd, enum expand_inventory result, int itemId);
+ void (*inventoryExpandResult) (struct map_session_data *sd, enum expand_inventory_result result);
+ void (*pInventoryExpansion) (int fd, struct map_session_data *sd);
+ void (*pInventoryExpansionConfirmed) (int fd, struct map_session_data *sd);
+ void (*pInventoryExpansionRejected) (int fd, struct map_session_data *sd);
void (*favorite_item) (struct map_session_data* sd, unsigned short index);
void (*clearcart) (int fd);
void (*item_identify_list) (struct map_session_data *sd);
@@ -968,6 +994,7 @@ struct clif_interface {
void (*broadcast2) (struct block_list *bl, const char *mes, int len, unsigned int fontColor, short fontType, short fontSize, short fontAlign, short fontY, enum send_target target);
void (*messagecolor_self) (int fd, uint32 color, const char *msg);
void (*messagecolor) (struct block_list* bl, uint32 color, const char* msg);
+ void (*serviceMessageColor) (struct map_session_data *sd, uint32 color, const char *msg);
void (*disp_overhead) (struct block_list *bl, const char *mes, enum send_target target, struct block_list *target_bl);
void (*notify_playerchat) (struct block_list *bl, const char *mes);
void (*msgtable) (struct map_session_data* sd, enum clif_messages msg_id);
@@ -1219,7 +1246,7 @@ struct clif_interface {
void (*npc_market_purchase_ack) (struct map_session_data *sd, const struct itemlist *item_list, unsigned char response);
/* */
bool (*parse_roulette_db) (void);
- void (*roulette_generate_ack) (struct map_session_data *sd, unsigned char result, short stage, short prizeIdx, int bonusItemID);
+ void (*roulette_generate_ack) (struct map_session_data *sd, enum GENERATE_ROULETTE_ACK result, short stage, short prizeIdx, int bonusItemID);
/* Merge Items */
void (*openmergeitem) (int fd, struct map_session_data *sd);
void (*cancelmergeitem) (int fd, struct map_session_data *sd);
@@ -1285,7 +1312,10 @@ struct clif_interface {
void (*pChangeCart) (int fd,struct map_session_data *sd);
void (*pStatusUp) (int fd,struct map_session_data *sd);
void (*pSkillUp) (int fd,struct map_session_data *sd);
+ void (*useSkillToIdReal) (int fd, struct map_session_data *sd, int skill_id, int skill_lv, int target_id);
void (*pUseSkillToId) (int fd, struct map_session_data *sd);
+ void (*pStartUseSkillToId) (int fd, struct map_session_data *sd);
+ void (*pStopUseSkillToId) (int fd, struct map_session_data *sd);
void (*pUseSkillToId_homun) (struct homun_data *hd, struct map_session_data *sd, int64 tick, uint16 skill_id, uint16 skill_lv, int target_id);
void (*pUseSkillToId_mercenary) (struct mercenary_data *md, struct map_session_data *sd, int64 tick, uint16 skill_id, uint16 skill_lv, int target_id);
void (*pUseSkillToPos) (int fd, struct map_session_data *sd);
@@ -1553,7 +1583,10 @@ struct clif_interface {
void (*pMemorialDungeonCommand) (int fd, struct map_session_data *sd);
void (*camera_showWindow) (struct map_session_data *sd);
void (*camera_change) (struct map_session_data *sd, float range, float rotation, float latitude, enum send_target target);
+ void (*pCameraInfo) (int fd, struct map_session_data *sd);
void (*item_preview) (struct map_session_data *sd, int n);
+ bool (*enchant_equipment) (struct map_session_data *sd, enum equip_pos pos, int cardSlot, int cardId);
+ void (*pReqRemainTime) (int fd, struct map_session_data *sd);
};
#ifdef HERCULES_CORE
diff --git a/src/map/itemdb.h b/src/map/itemdb.h
index d92940445..0c08efbeb 100644
--- a/src/map/itemdb.h
+++ b/src/map/itemdb.h
@@ -38,7 +38,7 @@ struct hplugin_data_store;
#endif
#ifndef MAX_ITEM_ID
-#if PACKETVER_RE_NUM >= 20180704
+#if PACKETVER_MAIN_NUM >= 20181121 || PACKETVER_RE_NUM >= 20180704 || PACKETVER_ZERO_NUM >= 20181114
#define MAX_ITEM_ID 0x20000
#else
#define MAX_ITEM_ID 0xFFFF
@@ -72,8 +72,8 @@ struct hplugin_data_store;
#if MAX_ITEM_ID < MAX_ITEMDB
#error "MAX_ITEM_ID must be bigger or same with MAX_ITEMDB"
#endif
-#if MAX_ITEM_ID > 0xFFFF && PACKETVER_RE_NUM < 20180704
-#error "For clients before 20180704 RE, MAX_ITEM_ID must be smaller than 0x10000"
+#if MAX_ITEM_ID > 0xFFFF && PACKETVER_MAIN_NUM < 20181121 && PACKETVER_RE_NUM < 20180704 && PACKETVER_ZERO_NUM < 20181114
+#error "For clients before 20181121 Main and 20180704 RE and 20181114 zero, MAX_ITEM_ID must be smaller than 0x10000"
#endif
enum item_itemid {
diff --git a/src/map/mail.c b/src/map/mail.c
index d67e658fd..0a4b91e34 100644
--- a/src/map/mail.c
+++ b/src/map/mail.c
@@ -100,7 +100,7 @@ static unsigned char mail_setitem(struct map_session_data *sd, int idx, int amou
idx -= 2;
mail->removeitem(sd, 0);
- if( idx < 0 || idx >= MAX_INVENTORY )
+ if (idx < 0 || idx >= sd->status.inventorySize)
return 1;
if( amount <= 0 || amount > sd->status.inventory[idx].amount )
return 1;
@@ -128,7 +128,7 @@ static bool mail_setattachment(struct map_session_data *sd, struct mail_message
return false;
n = sd->mail.index;
- Assert_retr(false, n >= 0 && n < MAX_INVENTORY);
+ Assert_retr(false, n >= 0 && n < sd->status.inventorySize);
if( sd->mail.amount )
{
if( sd->status.inventory[n].nameid != sd->mail.nameid )
diff --git a/src/map/messages_main.h b/src/map/messages_main.h
index 4bef783ec..bb01d24cb 100644
--- a/src/map/messages_main.h
+++ b/src/map/messages_main.h
@@ -24,7 +24,7 @@
/* This file is autogenerated, please do not commit manual changes
-Latest version: 20181107
+Latest version: 20181212
*/
enum clif_messages {
@@ -4630,9 +4630,11 @@ Thief
Knight
*/
MSG_KNIGHT = 0x364,
-/*20040913 to latest
+/*20040913 to 20181128
Prieset
Priest
+20181205 to latest
+Priest
*/
MSG_PRIEST = 0x365,
/*20040913 to latest
@@ -5269,9 +5271,11 @@ WhiteSmith
Sniper
*/
MSG_HUNTER_H = 0x3dc,
-/*20050613 to latest
+/*20050613 to 20181128
Saaassin Cross
Assassin Cross
+20181205 to latest
+Assassin Cross
*/
MSG_ASSASSIN_H = 0x3dd,
/*20050613 to latest
@@ -5299,9 +5303,11 @@ Sniper_W
Sniper
*/
MSG_HUNTER_H_W = 0x3e2,
-/*20050613 to latest
+/*20050613 to 20181128
Saaassin Cross_W
Assassin Cross
+20181205 to latest
+Assassin Cross_W
*/
MSG_ASSASSIN_H_W = 0x3e3,
/*20050613 to latest
@@ -21412,6 +21418,36 @@ PvP
*/
MSG_ID_DEE = 0xdee,
#endif
+#if PACKETVER >= 20181121
+/*20181121 to latest
+같은 아이템을 %d개 이상 가질 수 없습니다.
+*/
+ MSG_ID_DEF = 0xdef,
+/*20181121 to latest
+소지 한계량 초과로 구입이 불가능합니다.
+*/
+ MSG_ID_DF0 = 0xdf0,
+/*20181121 to latest
+해당 아이템은 한 번에 한 개만 살 수 있습니다.
+*/
+ MSG_ID_DF1 = 0xdf1,
+#endif
+#if PACKETVER >= 20181205
+/*20181205 to latest
+성제
+*/
+ MSG_ID_DF2 = 0xdf2,
+/*20181205 to latest
+소울리퍼
+*/
+ MSG_ID_DF3 = 0xdf3,
+#endif
+#if PACKETVER >= 20181212
+/*20181212 to latest
+설정한 내용은 정상 종료 시 서버에 저장됩니다.
+*/
+ MSG_ID_DF4 = 0xdf4,
+#endif
};
#endif /* MAP_MESSAGES_MAIN_H */
diff --git a/src/map/messages_re.h b/src/map/messages_re.h
index ee1a05b93..8b75d608d 100644
--- a/src/map/messages_re.h
+++ b/src/map/messages_re.h
@@ -24,7 +24,7 @@
/* This file is autogenerated, please do not commit manual changes
-Latest version: 20181107
+Latest version: 20181212
*/
enum clif_messages {
@@ -4395,9 +4395,11 @@ Thief
Knight
*/
MSG_KNIGHT = 0x364,
-/*20080827 to latest
+/*20080827 to 20181128
Prieset
Priest
+20181205 to latest
+Priest
*/
MSG_PRIEST = 0x365,
/*20080827 to latest
@@ -4972,9 +4974,11 @@ WhiteSmith
Sniper
*/
MSG_HUNTER_H = 0x3dc,
-/*20080827 to latest
+/*20080827 to 20181128
Saaassin Cross
Assassin Cross
+20181205 to latest
+Assassin Cross
*/
MSG_ASSASSIN_H = 0x3dd,
/*20080827 to latest
@@ -5002,9 +5006,11 @@ Sniper_W
Sniper
*/
MSG_HUNTER_H_W = 0x3e2,
-/*20080827 to latest
+/*20080827 to 20181128
Saaassin Cross_W
Assassin Cross
+20181205 to latest
+Assassin Cross_W
*/
MSG_ASSASSIN_H_W = 0x3e3,
/*20080827 to latest
@@ -20891,6 +20897,36 @@ PvP
*/
MSG_ID_DEE = 0xdee,
#endif
+#if PACKETVER >= 20181121
+/*20181121 to latest
+같은 아이템을 %d개 이상 가질 수 없습니다.
+*/
+ MSG_ID_DEF = 0xdef,
+/*20181121 to latest
+소지 한계량 초과로 구입이 불가능합니다.
+*/
+ MSG_ID_DF0 = 0xdf0,
+/*20181121 to latest
+해당 아이템은 한 번에 한 개만 살 수 있습니다.
+*/
+ MSG_ID_DF1 = 0xdf1,
+#endif
+#if PACKETVER >= 20181205
+/*20181205 to latest
+성제
+*/
+ MSG_ID_DF2 = 0xdf2,
+/*20181205 to latest
+소울리퍼
+*/
+ MSG_ID_DF3 = 0xdf3,
+#endif
+#if PACKETVER >= 20181212
+/*20181212 to latest
+설정한 내용은 정상 종료 시 서버에 저장됩니다.
+*/
+ MSG_ID_DF4 = 0xdf4,
+#endif
};
#endif /* MAP_MESSAGES_RE_H */
diff --git a/src/map/messages_zero.h b/src/map/messages_zero.h
index d814b2305..f7f4cf360 100644
--- a/src/map/messages_zero.h
+++ b/src/map/messages_zero.h
@@ -24,7 +24,7 @@
/* This file is autogenerated, please do not commit manual changes
-Latest version: 20181114
+Latest version: 20181212
*/
enum clif_messages {
@@ -4383,9 +4383,11 @@ Thief
Knight
*/
MSG_KNIGHT = 0x364,
-/*20171018 to latest
+/*20171018 to 20181128
Prieset
Priest
+20181212 to latest
+Priest
*/
MSG_PRIEST = 0x365,
/*20171018 to latest
@@ -4960,9 +4962,11 @@ WhiteSmith
Sniper
*/
MSG_HUNTER_H = 0x3dc,
-/*20171018 to latest
+/*20171018 to 20181128
Saaassin Cross
Assassin Cross
+20181212 to latest
+Assassin Cross
*/
MSG_ASSASSIN_H = 0x3dd,
/*20171018 to latest
@@ -4990,9 +4994,11 @@ Sniper_W
Sniper
*/
MSG_HUNTER_H_W = 0x3e2,
-/*20171018 to latest
+/*20171018 to 20181128
Saaassin Cross_W
Assassin Cross
+20181212 to latest
+Assassin Cross_W
*/
MSG_ASSASSIN_H_W = 0x3e3,
/*20171018 to latest
@@ -17509,6 +17515,20 @@ PvP
*/
MSG_ID_DF1 = 0xdf1,
#endif
+#if PACKETVER >= 20181212
+/*20181212 to latest
+성제
+*/
+ MSG_ID_DF2 = 0xdf2,
+/*20181212 to latest
+소울리퍼
+*/
+ MSG_ID_DF3 = 0xdf3,
+/*20181212 to latest
+설정한 내용은 정상 종료 시 서버에 저장됩니다.
+*/
+ MSG_ID_DF4 = 0xdf4,
+#endif
};
#endif /* MAP_MESSAGES_ZERO_H */
diff --git a/src/map/npc.c b/src/map/npc.c
index 7f57a9c50..fd11b6c5f 100644
--- a/src/map/npc.c
+++ b/src/map/npc.c
@@ -1948,7 +1948,11 @@ static int npc_buylist(struct map_session_data *sd, struct itemlist *item_list)
break;
case ADDITEM_OVERAMOUNT:
+#if PACKETVER >= 20110705
+ return 9;
+#else
return 2;
+#endif
}
value = pc->modifybuyvalue(sd,value);
@@ -2231,7 +2235,7 @@ static int npc_selllist(struct map_session_data *sd, struct itemlist *item_list)
struct itemlist_entry *entry = &VECTOR_INDEX(*item_list, i);
int nameid, value, idx = entry->id;
- if (idx >= MAX_INVENTORY || idx < 0 || entry->amount < 0) {
+ if (idx >= sd->status.inventorySize || idx < 0 || entry->amount < 0) {
return 1;
}
diff --git a/src/map/packets.h b/src/map/packets.h
index 036fd4f2a..81b861f78 100644
--- a/src/map/packets.h
+++ b/src/map/packets.h
@@ -147,6 +147,7 @@ packet(0x01ba,clif->pGMShift,2);
packet(0x01bb,clif->pGMShift,2);
packet(0x01bc,clif->pGMRecall,2);
packet(0x01bd,clif->pGMRecall,2);
+packet(0x01c0,clif->pReqRemainTime);
packet(0x01ce,clif->pAutoSpell,2);
packet(0x01d5,clif->pNpcStringInput,2,4,8);
packet(0x01df,clif->pGMReqAccountName,2);
@@ -1788,6 +1789,11 @@ packet(0x96e,clif->ackmergeitems);
// changed packet sizes
#endif
+// all 2016-05-25
+#if PACKETVER >= 20160525
+ packet(0x0a77,clif->pCameraInfo); // CZ_CAMERA_INFO
+#endif
+
// 2017-02-28aRagexeRE
#if PACKETVER >= 20170228
// new packets
@@ -1875,4 +1881,45 @@ packet(0x96e,clif->ackmergeitems);
packet(0x0a49,clif->pPrivateAirshipRequest); // CZ_PRIVATE_AIRSHIP_REQUEST
#endif
+// 2018-11-14aRagexe_zero
+#if PACKETVER_ZERO_NUM >= 20181114
+// new packets
+// changed packet sizes
+ packet(0x018e,clif->pProduceMix); // CZ_REQMAKINGITEM
+ packet(0x01ae,clif->pSelectArrow,2); // CZ_REQ_MAKINGARROW
+ packet(0x01fd,clif->pRepairItem); // CZ_REQ_ITEMREPAIR
+ packet(0x025b,clif->pCooking); // CZ_REQ_MAKINGITEM
+ packet(0x0445,clif->pDull/*,XXX*/); // CZ_SIMPLE_BUY_CASH_POINT_ITEM
+ packet(0x09ae,clif->pDull/*,XXX*/); // CZ_REQ_APPLY_BARGAIN_SALE_ITEM
+ packet(0x09b0,clif->pDull/*,XXX*/); // CZ_REQ_REMOVE_BARGAIN_SALE_ITEM
+ packet(0x09c3,clif->pDull/*,XXX*/); // CZ_REQ_COUNT_BARGAIN_SALE_ITEM
+ packet(0x0a49,clif->pPrivateAirshipRequest); // CZ_PRIVATE_AIRSHIP_REQUEST
+#endif
+
+// 2018-11-21bRagexe
+#if PACKETVER_ZERO_NUM >= 20181121
+// new packets
+// changed packet sizes
+ packet(0x018e,clif->pProduceMix); // CZ_REQMAKINGITEM
+ packet(0x01ae,clif->pSelectArrow,2); // CZ_REQ_MAKINGARROW
+ packet(0x01fd,clif->pRepairItem); // CZ_REQ_ITEMREPAIR
+ packet(0x025b,clif->pCooking); // CZ_REQ_MAKINGITEM
+ packet(0x0445,clif->pDull/*,XXX*/); // CZ_SIMPLE_BUY_CASH_POINT_ITEM
+ packet(0x09ae,clif->pDull/*,XXX*/); // CZ_REQ_APPLY_BARGAIN_SALE_ITEM
+ packet(0x09b0,clif->pDull/*,XXX*/); // CZ_REQ_REMOVE_BARGAIN_SALE_ITEM
+ packet(0x09c3,clif->pDull/*,XXX*/); // CZ_REQ_COUNT_BARGAIN_SALE_ITEM
+ packet(0x0a49,clif->pPrivateAirshipRequest); // CZ_PRIVATE_AIRSHIP_REQUEST
+#endif
+
+#if PACKETVER_MAIN_NUM >= 20181002 || PACKETVER_RE_NUM >= 20181002 || PACKETVER_ZERO_NUM >= 20181010
+ packet(0x0b10,clif->pStartUseSkillToId);
+ packet(0x0b11,clif->pStopUseSkillToId);
+#endif
+
+#if PACKETVER_MAIN_NUM >= 20181031 || PACKETVER_RE_NUM >= 20181031 || PACKETVER_ZERO_NUM >= 20181114
+ packet(0x0b14,clif->pInventoryExpansion);
+ packet(0x0b16,clif->pInventoryExpansionConfirmed);
+ packet(0x0b19,clif->pInventoryExpansionRejected);
+#endif
+
#endif /* MAP_PACKETS_H */
diff --git a/src/map/packets_keys_main.h b/src/map/packets_keys_main.h
index 129c4eaaa..7a1f84faa 100644
--- a/src/map/packets_keys_main.h
+++ b/src/map/packets_keys_main.h
@@ -37,7 +37,7 @@
packetKeys(0x49357d72,0x22c370a1,0x5f836591);
#endif
-// 2010-11-23aRagexeRE, 2010-11-24aRagexeRE, 2010-11-24bRagexeRE, 2010-11-25aRagexeRE, 2010-11-26aRagexeRE, 2010-11-30aRagexeRE, 2010-12-07aRagexeRE, 2010-12-14aRagexeRE, 2010-12-21aRagexeRE, 2010-12-23aRagexeRE, 2010-12-28aRagexeRE, 2011-01-04aRagexeRE, 2011-01-05aRagexeRE, 2011-01-11aRagexeRE, 2011-01-18aRagexeRE, 2011-01-25aRagexeRE, 2011-01-26aRagexeRE, 2011-01-26bRagexeRE, 2011-01-31aRagexeRE, 2011-01-31bRagexeRE, 2011-01-31cRagexeRE, 2011-02-08aRagexeRE, 2011-02-15aRagexeRE, 2011-02-22aRagexeRE, 2011-02-23aRagexeRE, 2011-02-23bRagexeRE, 2011-02-24aRagexeRE, 2011-02-25aRagexeRE, 2011-02-28aRagexeRE, 2011-03-08aRagexeRE, 2011-03-09aRagexeRE, 2011-03-09bRagexeRE, 2011-03-09cRagexeRE, 2011-03-09dRagexeRE, 2011-03-15aRagexeRE, 2011-03-22aRagexeRE, 2011-03-29aRagexeRE, 2011-03-30aRagexeRE, 2011-03-30cRagexeRE, 2011-04-05aRagexeRE, 2011-04-12aRagexeRE, 2011-04-19aRagexeRE, 2011-04-20aRagexeRE, 2011-04-26aRagexeRE, 2011-04-27aRagexeRE, 2011-05-03aRagexeRE, 2011-05-11aRagexeRE, 2011-05-17bRagexeRE, 2011-05-24aRagexeRE, 2011-05-26aRagexeRE, 2011-05-31aRagexeRE, 2011-06-07aRagexeRE, 2011-06-08aRagexeRE, 2011-06-08bRagexeRE, 2011-06-08cRagexeRE, 2011-06-09aRagexeRE, 2011-06-14bRagexeRE, 2011-06-22aRagexeRE, 2011-06-28aRagexeRE, 2011-07-06aRagexeRE, 2011-07-13aRagexeRE, 2011-07-13bRagexeRE, 2011-07-13cRagexeRE, 2011-07-19aRagexeRE, 2011-07-26aRagexeRE, 2011-08-03aRagexeRE, 2011-08-03bRagexeRE, 2011-08-10aRagexeRE, 2013-12-23aRagexeRE, 2014-05-08aRagexe, 2014-05-08aRagexeRE, 2014-06-11eRagexe, 2015-02-25hRagexe, 2018-03-15aRagexe, 2018-03-21aRagexe, 2018-03-21aRagexeRE, 2018-03-28bRagexe, 2018-03-28bRagexeRE, 2018-04-04bRagexe, 2018-04-04cRagexeRE, 2018-04-18aRagexe, 2018-04-18bRagexeRE, 2018-04-25cRagexe, 2018-04-25cRagexeRE, 2018-05-02bRagexe, 2018-05-02bRagexeRE, 2018-05-02dRagexeRE, 2018-05-09aRagexe, 2018-05-16cRagexe, 2018-05-16cRagexeRE, 2018-05-23aRagexe, 2018-05-23aRagexeRE, 2018-05-30aRagexe, 2018-05-30bRagexeRE, 2018-05-30cRagexeRE, 2018-06-05bRagexe, 2018-06-05bRagexeRE, 2018-06-12aRagexeRE, 2018-06-12bRagexeRE, 2018-06-20cRagexe, 2018-06-20dRagexeRE, 2018-06-20eRagexe, 2018-06-20eRagexeRE, 2018-06-21aRagexe, 2018-06-21aRagexeRE, 2018-07-04aRagexe, 2018-07-04aRagexeRE, 2018-07-11aRagexeRE, 2018-07-18bRagexe, 2018-07-18bRagexeRE, 2018-07-18bRagexeRE1, 2018-07-18cRagexe, 2018-07-18cRagexeRE, 2018-08-01cRagexe, 2018-08-01cRagexeRE, 2018-08-08bRagexe, 2018-08-08bRagexeRE, 2018-08-22cRagexe, 2018-08-22cRagexeRE, 2018-08-29aRagexe, 2018-08-29aRagexeRE, 2018-08-29bRagexeRE, 2018-08-31aRagexe, 2018-09-12dRagexe, 2018-09-12dRagexeRE, 2018-09-19aRagexe, 2018-09-19aRagexeRE, 2018-10-02aRagexe, 2018-10-02aRagexeRE, 2018-10-02bRagexe, 2018-10-02bRagexeRE, 2018-10-17_02aRagexe, 2018-10-17_02aRagexeRE, 2018-10-17_03aRagexe, 2018-10-17_03aRagexeRE, 2018-10-17bRagexe, 2018-10-17bRagexeRE, 2018-10-24bRagexe, 2018-10-31aRagexe, 2018-10-31bRagexe, 2018-10-31cRagexeRE, 2018-11-07aRagexe, 2018-11-07aRagexeRE, 2018-11-14cRagexe, 2018-11-14cRagexeRE
+// 2010-11-23aRagexeRE, 2010-11-24aRagexeRE, 2010-11-24bRagexeRE, 2010-11-25aRagexeRE, 2010-11-26aRagexeRE, 2010-11-30aRagexeRE, 2010-12-07aRagexeRE, 2010-12-14aRagexeRE, 2010-12-21aRagexeRE, 2010-12-23aRagexeRE, 2010-12-28aRagexeRE, 2011-01-04aRagexeRE, 2011-01-05aRagexeRE, 2011-01-11aRagexeRE, 2011-01-18aRagexeRE, 2011-01-25aRagexeRE, 2011-01-26aRagexeRE, 2011-01-26bRagexeRE, 2011-01-31aRagexeRE, 2011-01-31bRagexeRE, 2011-01-31cRagexeRE, 2011-02-08aRagexeRE, 2011-02-15aRagexeRE, 2011-02-22aRagexeRE, 2011-02-23aRagexeRE, 2011-02-23bRagexeRE, 2011-02-24aRagexeRE, 2011-02-25aRagexeRE, 2011-02-28aRagexeRE, 2011-03-08aRagexeRE, 2011-03-09aRagexeRE, 2011-03-09bRagexeRE, 2011-03-09cRagexeRE, 2011-03-09dRagexeRE, 2011-03-15aRagexeRE, 2011-03-22aRagexeRE, 2011-03-29aRagexeRE, 2011-03-30aRagexeRE, 2011-03-30cRagexeRE, 2011-04-05aRagexeRE, 2011-04-12aRagexeRE, 2011-04-19aRagexeRE, 2011-04-20aRagexeRE, 2011-04-26aRagexeRE, 2011-04-27aRagexeRE, 2011-05-03aRagexeRE, 2011-05-11aRagexeRE, 2011-05-17bRagexeRE, 2011-05-24aRagexeRE, 2011-05-26aRagexeRE, 2011-05-31aRagexeRE, 2011-06-07aRagexeRE, 2011-06-08aRagexeRE, 2011-06-08bRagexeRE, 2011-06-08cRagexeRE, 2011-06-09aRagexeRE, 2011-06-14bRagexeRE, 2011-06-22aRagexeRE, 2011-06-28aRagexeRE, 2011-07-06aRagexeRE, 2011-07-13aRagexeRE, 2011-07-13bRagexeRE, 2011-07-13cRagexeRE, 2011-07-19aRagexeRE, 2011-07-26aRagexeRE, 2011-08-03aRagexeRE, 2011-08-03bRagexeRE, 2011-08-10aRagexeRE, 2013-12-23aRagexeRE, 2014-05-08aRagexe, 2014-05-08aRagexeRE, 2014-06-11eRagexe, 2015-02-25hRagexe, 2018-03-15aRagexe, 2018-03-21aRagexe, 2018-03-21aRagexeRE, 2018-03-28bRagexe, 2018-03-28bRagexeRE, 2018-04-04bRagexe, 2018-04-04cRagexeRE, 2018-04-18aRagexe, 2018-04-18bRagexeRE, 2018-04-25cRagexe, 2018-04-25cRagexeRE, 2018-05-02bRagexe, 2018-05-02bRagexeRE, 2018-05-02dRagexeRE, 2018-05-09aRagexe, 2018-05-16cRagexe, 2018-05-16cRagexeRE, 2018-05-23aRagexe, 2018-05-23aRagexeRE, 2018-05-30aRagexe, 2018-05-30bRagexeRE, 2018-05-30cRagexeRE, 2018-06-05bRagexe, 2018-06-05bRagexeRE, 2018-06-12aRagexeRE, 2018-06-12bRagexeRE, 2018-06-20cRagexe, 2018-06-20dRagexeRE, 2018-06-20eRagexe, 2018-06-20eRagexeRE, 2018-06-21aRagexe, 2018-06-21aRagexeRE, 2018-07-04aRagexe, 2018-07-04aRagexeRE, 2018-07-11aRagexeRE, 2018-07-18bRagexe, 2018-07-18bRagexeRE, 2018-07-18bRagexeRE1, 2018-07-18cRagexe, 2018-07-18cRagexeRE, 2018-08-01cRagexe, 2018-08-01cRagexeRE, 2018-08-08bRagexe, 2018-08-08bRagexeRE, 2018-08-22cRagexe, 2018-08-22cRagexeRE, 2018-08-29aRagexe, 2018-08-29aRagexeRE, 2018-08-29bRagexeRE, 2018-08-31aRagexe, 2018-09-12dRagexe, 2018-09-12dRagexeRE, 2018-09-19aRagexe, 2018-09-19aRagexeRE, 2018-10-02aRagexe, 2018-10-02aRagexeRE, 2018-10-02bRagexe, 2018-10-02bRagexeRE, 2018-10-17_02aRagexe, 2018-10-17_02aRagexeRE, 2018-10-17_03aRagexe, 2018-10-17_03aRagexeRE, 2018-10-17bRagexe, 2018-10-17bRagexeRE, 2018-10-24bRagexe, 2018-10-31aRagexe, 2018-10-31bRagexe, 2018-10-31cRagexeRE, 2018-11-07aRagexe, 2018-11-07aRagexeRE, 2018-11-14cRagexe, 2018-11-14cRagexeRE, 2018-11-14dRagexe, 2018-11-14dRagexeRE, 2018-11-21bRagexe, 2018-11-21cRagexeRE, 2018-11-28aRagexe, 2018-11-28aRagexeRE, 2018-11-28bRagexe, 2018-11-28cRagexe, 2018-12-05aRagexe, 2018-12-05bRagexeRE, 2018-12-12aRagexe, 2018-12-12aRagexeRE, 2018-12-12bRagexe, 2018-12-12bRagexeRE
#if PACKETVER == 20101123 || \
PACKETVER == 20101124 || \
PACKETVER == 20101125 || \
@@ -126,7 +126,11 @@
PACKETVER == 20181024 || \
PACKETVER == 20181031 || \
PACKETVER == 20181107 || \
- PACKETVER >= 20181114
+ PACKETVER == 20181114 || \
+ PACKETVER == 20181121 || \
+ PACKETVER == 20181128 || \
+ PACKETVER == 20181205 || \
+ PACKETVER >= 20181212
packetKeys(0x00000000,0x00000000,0x00000000);
#endif
diff --git a/src/map/packets_keys_zero.h b/src/map/packets_keys_zero.h
index d5836bf96..1a592956e 100644
--- a/src/map/packets_keys_zero.h
+++ b/src/map/packets_keys_zero.h
@@ -30,7 +30,7 @@
/* This file is autogenerated, please do not commit manual changes */
-// 2017-10-18aRagexe_zero, 2017-10-19aRagexe_zero, 2017-10-23aRagexe_zero, 2017-10-23bRagexe_zero, 2017-10-23cRagexe_zero, 2017-10-24aRagexe_2_zero, 2017-10-24aRagexe_zero, 2017-10-25bRagexe_zero, 2017-10-27aRagexe_zero, 2017-10-27bRagexe_zero, 2017-10-30aRagexe_zero, 2017-10-31aRagexe_zero, 2017-11-09aRagexe_zero, 2017-11-13aRagexe_zero, 2017-11-13bRagexe_zero, 2018-03-15aRagexe_zero, 2018-03-21aRagexe_zero, 2018-03-21bRagexe_zero, 2018-03-28_1aRagexe_zero, 2018-03-28cRagexe_zero, 2018-04-11aRagexe_zero, 2018-04-25_3aRagexe_zero, 2018-05-09_3aRagexe_zero, 2018-05-23aRagexe_zero, 2018-06-05bRagexe_zero, 2018-06-05cRagexe_zero, 2018-06-27aRagexe_zero, 2018-07-03aRagexe_zero, 2018-07-11_2aRagexe_zero, 2018-07-25_2aRagexe_zero, 2018-08-01aRagexe_zero, 2018-08-08_2aRagexe_zero, 2018-08-22aRagexe_zero, 2018-08-29aRagexe_zero, 2018-09-05aRagexe_zero, 2018-09-12aRagexe_zero, 2018-09-19aRagexe_zero, 2018-09-28aRagexe_zero, 2018-10-10_2aRagexe_zero, 2018-10-24_2aRagexe_zero, 2018-11-14aRagexe_zero
+// 2017-10-18aRagexe_zero, 2017-10-19aRagexe_zero, 2017-10-23aRagexe_zero, 2017-10-23bRagexe_zero, 2017-10-23cRagexe_zero, 2017-10-24aRagexe_2_zero, 2017-10-24aRagexe_zero, 2017-10-25bRagexe_zero, 2017-10-27aRagexe_zero, 2017-10-27bRagexe_zero, 2017-10-30aRagexe_zero, 2017-10-31aRagexe_zero, 2017-11-09aRagexe_zero, 2017-11-13aRagexe_zero, 2017-11-13bRagexe_zero, 2018-03-15aRagexe_zero, 2018-03-21aRagexe_zero, 2018-03-21bRagexe_zero, 2018-03-28_1aRagexe_zero, 2018-03-28cRagexe_zero, 2018-04-11aRagexe_zero, 2018-04-25_3aRagexe_zero, 2018-05-09_3aRagexe_zero, 2018-05-23aRagexe_zero, 2018-06-05bRagexe_zero, 2018-06-05cRagexe_zero, 2018-06-27aRagexe_zero, 2018-07-03aRagexe_zero, 2018-07-11_2aRagexe_zero, 2018-07-25_2aRagexe_zero, 2018-08-01aRagexe_zero, 2018-08-08_2aRagexe_zero, 2018-08-22aRagexe_zero, 2018-08-29aRagexe_zero, 2018-09-05aRagexe_zero, 2018-09-12aRagexe_zero, 2018-09-19aRagexe_zero, 2018-09-28aRagexe_zero, 2018-10-10_2aRagexe_zero, 2018-10-24_2aRagexe_zero, 2018-11-14aRagexe_zero, 2018-11-20aRagexe_zero, 2018-11-28aRagexe_zero, 2018-12-12aRagexe_zero
#if PACKETVER == 20171018 || \
PACKETVER == 20171019 || \
PACKETVER == 20171023 || \
@@ -63,7 +63,10 @@
PACKETVER == 20180928 || \
PACKETVER == 20181010 || \
PACKETVER == 20181024 || \
- PACKETVER >= 20181114
+ PACKETVER == 20181114 || \
+ PACKETVER == 20181120 || \
+ PACKETVER == 20181128 || \
+ PACKETVER >= 20181212
packetKeys(0x00000000,0x00000000,0x00000000);
#endif
diff --git a/src/map/packets_shuffle_main.h b/src/map/packets_shuffle_main.h
index 43be3821f..940dbcf89 100644
--- a/src/map/packets_shuffle_main.h
+++ b/src/map/packets_shuffle_main.h
@@ -3345,7 +3345,7 @@
packet(0x0969,clif->pSearchStoreInfoNextPage,0); // CZ_SEARCH_STORE_INFO_NEXT_PAGE // 2
#endif
-// 2014-06-11eRagexe, 2015-02-25hRagexe, 2018-03-15aRagexe, 2018-03-21aRagexe, 2018-03-28bRagexe, 2018-04-04bRagexe, 2018-04-18aRagexe, 2018-04-25cRagexe, 2018-05-02bRagexe, 2018-05-09aRagexe, 2018-05-16cRagexe, 2018-05-23aRagexe, 2018-05-30aRagexe, 2018-06-05bRagexe, 2018-06-20cRagexe, 2018-06-20eRagexe, 2018-06-21aRagexe, 2018-07-04aRagexe, 2018-07-18bRagexe, 2018-07-18cRagexe, 2018-08-01cRagexe, 2018-08-08bRagexe, 2018-08-22cRagexe, 2018-08-29aRagexe, 2018-08-31aRagexe, 2018-09-12dRagexe, 2018-09-19aRagexe, 2018-10-02aRagexe, 2018-10-02bRagexe, 2018-10-17_02aRagexe, 2018-10-17_03aRagexe, 2018-10-17bRagexe, 2018-10-24bRagexe, 2018-10-31aRagexe, 2018-10-31bRagexe, 2018-11-07aRagexe, 2018-11-14cRagexe
+// 2014-06-11eRagexe, 2015-02-25hRagexe, 2018-03-15aRagexe, 2018-03-21aRagexe, 2018-03-28bRagexe, 2018-04-04bRagexe, 2018-04-18aRagexe, 2018-04-25cRagexe, 2018-05-02bRagexe, 2018-05-09aRagexe, 2018-05-16cRagexe, 2018-05-23aRagexe, 2018-05-30aRagexe, 2018-06-05bRagexe, 2018-06-20cRagexe, 2018-06-20eRagexe, 2018-06-21aRagexe, 2018-07-04aRagexe, 2018-07-18bRagexe, 2018-07-18cRagexe, 2018-08-01cRagexe, 2018-08-08bRagexe, 2018-08-22cRagexe, 2018-08-29aRagexe, 2018-08-31aRagexe, 2018-09-12dRagexe, 2018-09-19aRagexe, 2018-10-02aRagexe, 2018-10-02bRagexe, 2018-10-17_02aRagexe, 2018-10-17_03aRagexe, 2018-10-17bRagexe, 2018-10-24bRagexe, 2018-10-31aRagexe, 2018-10-31bRagexe, 2018-11-07aRagexe, 2018-11-14cRagexe, 2018-11-14dRagexe
#if PACKETVER == 20140611 || \
PACKETVER == 20150225 || \
PACKETVER == 20180315 || \
@@ -3376,7 +3376,7 @@
PACKETVER == 20181024 || \
PACKETVER == 20181031 || \
PACKETVER == 20181107 || \
- PACKETVER >= 20181114
+ PACKETVER == 20181114
packet(0x0202,clif->pFriendsListAdd,2); // CZ_ADD_FRIENDS // 26
packet(0x022d,clif->pHomMenu,2,4); // CZ_COMMAND_MER // 5
packet(0x023b,clif->pStoragePassword,0); // CZ_ACK_STORE_PASSWORD // 36
@@ -9727,5 +9727,41 @@
packet(0x0967,clif->pSolveCharName,2); // CZ_REQNAME_BYGID // 6
#endif
+// 2018-11-21bRagexe, 2018-11-28aRagexe, 2018-11-28bRagexe, 2018-11-28cRagexe, 2018-12-05aRagexe, 2018-12-12aRagexe, 2018-12-12bRagexe
+#if PACKETVER == 20181121 || \
+ PACKETVER == 20181128 || \
+ PACKETVER == 20181205 || \
+ PACKETVER >= 20181212
+ packet(0x0202,clif->pFriendsListAdd,2); // CZ_ADD_FRIENDS // 26
+ packet(0x022d,clif->pHomMenu,2,4); // CZ_COMMAND_MER // 5
+ packet(0x023b,clif->pStoragePassword,0); // CZ_ACK_STORE_PASSWORD // 36
+ packet(0x0281,clif->pDull/*,XXX*/); // CZ_GANGSI_RANK // 4
+ packet(0x02c4,clif->pPartyInvite2,2); // CZ_PARTY_JOIN_REQ // 26
+ packet(0x035f,clif->pWalkToXY,2); // CZ_REQUEST_MOVE // 5
+ packet(0x0360,clif->pTickSend,2); // CZ_REQUEST_TIME // 6
+ packet(0x0361,clif->pChangeDir,2,4); // CZ_CHANGE_DIRECTION // 5
+ packet(0x0362,clif->pTakeItem,2); // CZ_ITEM_PICKUP // 6
+ packet(0x0363,clif->pDropItem,2,4); // CZ_ITEM_THROW // 6
+ packet(0x0364,clif->pMoveToKafra,2,4); // CZ_MOVE_ITEM_FROM_BODY_TO_STORE // 8
+ packet(0x0365,clif->pMoveFromKafra,2,4); // CZ_MOVE_ITEM_FROM_STORE_TO_BODY // 8
+ packet(0x0366,clif->pUseSkillToPos,2,4,6,8); // CZ_USE_SKILL_TOGROUND // 10
+ packet(0x0367,clif->pUseSkillToPosMoreInfo,2,4,6,8,10); // CZ_USE_SKILL_TOGROUND_WITHTALKBOX // 90
+ packet(0x0368,clif->pGetCharNameRequest,2); // CZ_REQNAME // 6
+ packet(0x0369,clif->pSolveCharName,2); // CZ_REQNAME_BYGID // 6
+ packet(0x0436,clif->pWantToConnection,2,6,10,14,18); // CZ_ENTER // 19
+ packet(0x0437,clif->pActionRequest,2,6); // CZ_REQUEST_ACT // 7
+ packet(0x0438,clif->pUseSkillToId,2,4,6); // CZ_USE_SKILL // 10
+ packet(0x07e4,clif->pItemListWindowSelected,2,4,8); // CZ_ITEMLISTWIN_RES // -1
+ packet(0x07ec,clif->pDull/*,XXX*/); // CZ_JOIN_BATTLE_FIELD // 8
+ packet(0x0802,clif->pPartyBookingRegisterReq,2,4); // CZ_PARTY_BOOKING_REQ_REGISTER // 18
+ packet(0x0811,clif->pReqOpenBuyingStore,2,4,8,9,89); // CZ_REQ_OPEN_BUYING_STORE // -1
+ packet(0x0815,clif->pReqCloseBuyingStore,0); // CZ_REQ_CLOSE_BUYING_STORE // 2
+ packet(0x0817,clif->pReqClickBuyingStore,2); // CZ_REQ_CLICK_TO_BUYING_STORE // 6
+ packet(0x0819,clif->pReqTradeBuyingStore,2,4,8,12); // CZ_REQ_TRADE_BUYING_STORE // -1
+ packet(0x0835,clif->pSearchStoreInfo,2,4,5,9,13,14,15); // CZ_SEARCH_STORE_INFO // -1
+ packet(0x0838,clif->pSearchStoreInfoNextPage,0); // CZ_SEARCH_STORE_INFO_NEXT_PAGE // 2
+ packet(0x083c,clif->pSearchStoreInfoListItemClick,2,6,10); // CZ_SSILIST_ITEM_CLICK // 14
+#endif
+
#endif /* MAP_PACKETS_SHUFFLE_MAIN_H */
diff --git a/src/map/packets_shuffle_re.h b/src/map/packets_shuffle_re.h
index 429cf3012..dabc2ce6c 100644
--- a/src/map/packets_shuffle_re.h
+++ b/src/map/packets_shuffle_re.h
@@ -9663,7 +9663,7 @@
packet(0x083c,clif->pSearchStoreInfoListItemClick,2,6,10); // CZ_SSILIST_ITEM_CLICK // 12
#endif
-// 2018-07-04aRagexeRE, 2018-07-11aRagexeRE, 2018-07-18bRagexeRE, 2018-07-18bRagexeRE1, 2018-07-18cRagexeRE, 2018-08-01cRagexeRE, 2018-08-08bRagexeRE, 2018-08-22cRagexeRE, 2018-08-29aRagexeRE, 2018-08-29bRagexeRE, 2018-09-12dRagexeRE, 2018-09-19aRagexeRE, 2018-10-02aRagexeRE, 2018-10-02bRagexeRE, 2018-10-17_02aRagexeRE, 2018-10-17_03aRagexeRE, 2018-10-17bRagexeRE, 2018-10-31cRagexeRE, 2018-11-07aRagexeRE, 2018-11-14cRagexeRE
+// 2018-07-04aRagexeRE, 2018-07-11aRagexeRE, 2018-07-18bRagexeRE, 2018-07-18bRagexeRE1, 2018-07-18cRagexeRE, 2018-08-01cRagexeRE, 2018-08-08bRagexeRE, 2018-08-22cRagexeRE, 2018-08-29aRagexeRE, 2018-08-29bRagexeRE, 2018-09-12dRagexeRE, 2018-09-19aRagexeRE, 2018-10-02aRagexeRE, 2018-10-02bRagexeRE, 2018-10-17_02aRagexeRE, 2018-10-17_03aRagexeRE, 2018-10-17bRagexeRE, 2018-10-31cRagexeRE, 2018-11-07aRagexeRE, 2018-11-14cRagexeRE, 2018-11-14dRagexeRE, 2018-11-21cRagexeRE, 2018-11-28aRagexeRE, 2018-12-05bRagexeRE, 2018-12-12aRagexeRE, 2018-12-12bRagexeRE
#if PACKETVER == 20180704 || \
PACKETVER == 20180711 || \
PACKETVER == 20180718 || \
@@ -9677,7 +9677,11 @@
PACKETVER == 20181017 || \
PACKETVER == 20181031 || \
PACKETVER == 20181107 || \
- PACKETVER >= 20181114
+ PACKETVER == 20181114 || \
+ PACKETVER == 20181121 || \
+ PACKETVER == 20181128 || \
+ PACKETVER == 20181205 || \
+ PACKETVER >= 20181212
packet(0x0202,clif->pFriendsListAdd,2); // CZ_ADD_FRIENDS // 26
packet(0x022d,clif->pHomMenu,2,4); // CZ_COMMAND_MER // 5
packet(0x023b,clif->pStoragePassword,0); // CZ_ACK_STORE_PASSWORD // 36
diff --git a/src/map/packets_shuffle_zero.h b/src/map/packets_shuffle_zero.h
index 7b68ec472..d38ed4008 100644
--- a/src/map/packets_shuffle_zero.h
+++ b/src/map/packets_shuffle_zero.h
@@ -69,7 +69,7 @@
PACKETVER == 20180919 || \
PACKETVER == 20180928 || \
PACKETVER == 20181010 || \
- PACKETVER >= 20181024
+ PACKETVER == 20181024
packet(0x0202,clif->pFriendsListAdd,2); // CZ_ADD_FRIENDS // 26
packet(0x022d,clif->pHomMenu,2,4); // CZ_COMMAND_MER // 5
packet(0x023b,clif->pStoragePassword,0); // CZ_ACK_STORE_PASSWORD // 36
@@ -742,8 +742,11 @@
packet(0x0968,clif->pStoragePassword,0); // CZ_ACK_STORE_PASSWORD // 36
#endif
-// 2018-11-14aRagexe_zero
-#if PACKETVER == 20181114
+// 2018-11-14aRagexe_zero, 2018-11-20aRagexe_zero, 2018-11-28aRagexe_zero, 2018-12-12aRagexe_zero
+#if PACKETVER == 20181114 || \
+ PACKETVER == 20181120 || \
+ PACKETVER == 20181128 || \
+ PACKETVER >= 20181212
packet(0x0202,clif->pFriendsListAdd,2); // CZ_ADD_FRIENDS // 26
packet(0x022d,clif->pHomMenu,2,4); // CZ_COMMAND_MER // 5
packet(0x023b,clif->pStoragePassword,0); // CZ_ACK_STORE_PASSWORD // 36
diff --git a/src/map/packets_struct.h b/src/map/packets_struct.h
index cd3a3b989..f9b5fab0d 100644
--- a/src/map/packets_struct.h
+++ b/src/map/packets_struct.h
@@ -30,10 +30,6 @@
// Packet DB
#define MAX_PACKET_POS 20
-#define DEFINE_PACKET_HEADER(name, id) \
- STATIC_ASSERT(sizeof(struct PACKET_##name) == PACKET_LEN_##id, "Wrong size PACKET_"#name); \
- enum { HEADER_##name = id };
-
/**
*
**/
@@ -375,9 +371,6 @@ enum packet_headers {
partymemberinfo = 0x01e9,
partyinfo = 0x00fb,
#endif
-#if PACKETVER >= 20120702
- clanBasicInfo = 0x098A, ///< ZC_CLANINFO
-#endif
#if PACKETVER >= 20120716
clanOnlineCount = 0x0988, ///< ZC_NOTIFY_CLAN_CONNECTINFO
clanLeave = 0x0989, ///< ZC_ACK_CLAN_LEAVE
@@ -425,12 +418,6 @@ enum packet_headers {
#else
buyingStoreUpdateItemType = 0x81b,
#endif
-// probably can works also for < 20141223, but in 3CeaM packet size defined only for 20150513
-#if PACKETVER >= 20150513
- hominfoType = 0x9f7,
-#else
- hominfoType = 0x22e,
-#endif
reqName = 0x95,
#if PACKETVER >= 20150503 // Confirm this?
reqNameAllType = 0xA30,
@@ -454,11 +441,6 @@ enum packet_headers {
#else
guildLeave = 0x15a,
#endif
-#if PACKETVER_RE_NUM >= 20181031
- autoSpellList = 0xafb,
-#else
- autoSpellList = 0x1cd,
-#endif
};
#if !defined(sun) && (!defined(__NETBSD__) || __NetBSD_Version__ >= 600000000) // NetBSD 5 and Solaris don't like pragma pack but accept the packed attribute
@@ -469,7 +451,7 @@ enum packet_headers {
* structs for data
*/
struct EQUIPSLOTINFO {
-#if PACKETVER_RE_NUM >= 20180704
+#if PACKETVER_MAIN_NUM >= 20181121 || PACKETVER_RE_NUM >= 20180704 || PACKETVER_ZERO_NUM >= 20181114
uint32 card[4];
#else
uint16 card[4];
@@ -478,7 +460,7 @@ struct EQUIPSLOTINFO {
struct NORMALITEM_INFO {
int16 index;
-#if PACKETVER_RE_NUM >= 20180704
+#if PACKETVER_MAIN_NUM >= 20181121 || PACKETVER_RE_NUM >= 20180704 || PACKETVER_ZERO_NUM >= 20181114
uint32 ITID;
#else
uint16 ITID;
@@ -516,7 +498,7 @@ struct ItemOptions {
struct EQUIPITEM_INFO {
int16 index;
-#if PACKETVER_RE_NUM >= 20180704
+#if PACKETVER_MAIN_NUM >= 20181121 || PACKETVER_RE_NUM >= 20180704 || PACKETVER_ZERO_NUM >= 20181114
uint32 ITID;
#else
uint16 ITID;
@@ -593,7 +575,7 @@ struct packet_additem {
int16 PacketType;
uint16 Index;
uint16 count;
-#if PACKETVER_RE_NUM >= 20180704
+#if PACKETVER_MAIN_NUM >= 20181121 || PACKETVER_RE_NUM >= 20180704 || PACKETVER_ZERO_NUM >= 20181114
uint32 nameid;
#else
uint16 nameid;
@@ -627,7 +609,7 @@ struct packet_additem {
struct packet_dropflooritem {
int16 PacketType;
uint32 ITAID;
-#if PACKETVER_RE_NUM >= 20180704
+#if PACKETVER_MAIN_NUM >= 20181121 || PACKETVER_RE_NUM >= 20180704 || PACKETVER_ZERO_NUM >= 20181114
uint32 ITID;
#else
uint16 ITID;
@@ -739,7 +721,7 @@ struct packet_spawn_unit {
#else
uint32 weapon;
#endif
-#if PACKETVER_RE_NUM >= 20180704
+#if PACKETVER_MAIN_NUM >= 20181121 || PACKETVER_RE_NUM >= 20180704 || PACKETVER_ZERO_NUM >= 20181114
uint32 shield;
#endif
uint16 accessory;
@@ -812,7 +794,7 @@ struct packet_unit_walking {
#else
uint32 weapon;
#endif
-#if PACKETVER_RE_NUM >= 20180704
+#if PACKETVER_MAIN_NUM >= 20181121 || PACKETVER_RE_NUM >= 20180704 || PACKETVER_ZERO_NUM >= 20181114
uint32 shield;
#endif
uint16 accessory;
@@ -884,7 +866,7 @@ struct packet_idle_unit {
#else
uint32 weapon;
#endif
-#if PACKETVER_RE_NUM >= 20180704
+#if PACKETVER_MAIN_NUM >= 20181121 || PACKETVER_RE_NUM >= 20180704 || PACKETVER_ZERO_NUM >= 20181114
uint32 shield;
#endif
uint16 accessory;
@@ -1047,7 +1029,7 @@ struct packet_package_item_announce {
int16 PacketType;
int16 PacketLength;
uint8 type;
-#if PACKETVER_RE_NUM >= 20180704
+#if PACKETVER_MAIN_NUM >= 20181121 || PACKETVER_RE_NUM >= 20180704 || PACKETVER_ZERO_NUM >= 20181114
uint32 ItemID;
#else
uint16 ItemID;
@@ -1055,7 +1037,7 @@ struct packet_package_item_announce {
int8 len;
char Name[NAME_LENGTH];
int8 unknown; // probably unused
-#if PACKETVER_RE_NUM >= 20180704
+#if PACKETVER_MAIN_NUM >= 20181121 || PACKETVER_RE_NUM >= 20180704 || PACKETVER_ZERO_NUM >= 20181114
uint32 BoxItemID;
#else
uint16 BoxItemID;
@@ -1067,7 +1049,7 @@ struct packet_item_drop_announce {
int16 PacketType;
int16 PacketLength;
uint8 type;
-#if PACKETVER_RE_NUM >= 20180704
+#if PACKETVER_MAIN_NUM >= 20181121 || PACKETVER_RE_NUM >= 20180704 || PACKETVER_ZERO_NUM >= 20181114
uint32 ItemID;
#else
uint16 ItemID;
@@ -1122,7 +1104,7 @@ struct packet_roulette_open_ack {
int32 Serial;
int8 Step;
int8 Idx;
-#if PACKETVER_RE_NUM >= 20180704
+#if PACKETVER_MAIN_NUM >= 20181121 || PACKETVER_RE_NUM >= 20180704 || PACKETVER_ZERO_NUM >= 20181114
uint32 AdditionItemID;
#else
uint16 AdditionItemID;
@@ -1160,7 +1142,7 @@ struct packet_roulette_generate_ack {
uint8 Result;
uint16 Step;
uint16 Idx;
-#if PACKETVER_RE_NUM >= 20180704
+#if PACKETVER_MAIN_NUM >= 20181121 || PACKETVER_RE_NUM >= 20180704 || PACKETVER_ZERO_NUM >= 20181114
uint32 AdditionItemID;
#else
uint16 AdditionItemID;
@@ -1178,7 +1160,7 @@ struct packet_roulette_itemrecv_req {
struct packet_roulette_itemrecv_ack {
int16 PacketType;
uint8 Result;
-#if PACKETVER_RE_NUM >= 20180704
+#if PACKETVER_MAIN_NUM >= 20181121 || PACKETVER_RE_NUM >= 20180704 || PACKETVER_ZERO_NUM >= 20181114
uint32 AdditionItemID;
#else
uint16 AdditionItemID;
@@ -1303,6 +1285,7 @@ struct packet_viewequip_ack {
int16 body2;
#endif
uint8 sex;
+ // [4144] need remove MAX_INVENTORY from here
struct EQUIPITEM_INFO list[MAX_INVENTORY];
} __attribute__((packed));
@@ -1383,7 +1366,7 @@ struct packet_npc_market_purchase {
int16 PacketType;
int16 PacketLength;
struct {
-#if PACKETVER_RE_NUM >= 20180704
+#if PACKETVER_MAIN_NUM >= 20181121 || PACKETVER_RE_NUM >= 20180704 || PACKETVER_ZERO_NUM >= 20181114
uint32 ITID;
#else
uint16 ITID;
@@ -1397,36 +1380,40 @@ struct packet_npc_market_result_ack {
int16 PacketLength;
uint8 result;
struct {
-#if PACKETVER_RE_NUM >= 20180704
+#if PACKETVER_MAIN_NUM >= 20181121 || PACKETVER_RE_NUM >= 20180704 || PACKETVER_ZERO_NUM >= 20181114
uint32 ITID;
#else
uint16 ITID;
#endif
uint16 qty;
uint32 price;
+ // [4144] need remove MAX_INVENTORY from here
} list[MAX_INVENTORY];/* assuming MAX_INVENTORY is max since you can't hold more than MAX_INVENTORY items thus cant buy that many at once. */
} __attribute__((packed));
-struct packet_npc_market_open {
- int16 PacketType;
- int16 PacketLength;
- /* inner struct figured by Ind after some annoying hour of debugging (data Thanks to Yommy) */
- struct {
-#if PACKETVER_RE_NUM >= 20180704
- uint32 nameid;
+#if PACKETVER_MAIN_NUM >= 20131120 || PACKETVER_RE_NUM >= 20131106 || defined(PACKETVER_ZERO)
+/* inner struct figured by Ind after some annoying hour of debugging (data Thanks to Yommy) */
+struct PACKET_ZC_NPC_MARKET_OPEN_sub {
+#if PACKETVER_MAIN_NUM >= 20181121 || PACKETVER_RE_NUM >= 20180704 || PACKETVER_ZERO_NUM >= 20181114
+ uint32 nameid;
#else
- uint16 nameid;
+ uint16 nameid;
#endif
- uint8 type;
- uint32 price;
- uint32 qty;
- uint16 view;
- // It seems that the client doesn't have any hard-coded limit for this list
- // it's possible to send up to 1890 items without dropping a packet that's
- // too large [Panikon]
- } list[1000];/* TODO: whats the actual max of this? */
+ uint8 type;
+ uint32 price;
+ uint32 qty;
+ uint16 weight;
} __attribute__((packed));
+struct PACKET_ZC_NPC_MARKET_OPEN {
+ int16 packetType;
+ int16 packetLength;
+ struct PACKET_ZC_NPC_MARKET_OPEN_sub list[];
+} __attribute__((packed));
+
+DEFINE_PACKET_HEADER(ZC_NPC_MARKET_OPEN, 0x09d5);
+#endif
+
struct packet_wis_end {
int16 PacketType;
int8 result;
@@ -1537,7 +1524,7 @@ struct PACKET_ZC_ADD_ITEM_TO_MAIL {
int8 result;
int16 index;
int16 count;
-#if PACKETVER_RE_NUM >= 20180704
+#if PACKETVER_MAIN_NUM >= 20181121 || PACKETVER_RE_NUM >= 20180704 || PACKETVER_ZERO_NUM >= 20181114
uint32 itemId;
#else
uint16 itemId;
@@ -1555,7 +1542,7 @@ struct PACKET_ZC_ADD_ITEM_TO_MAIL {
struct mail_item {
int16 count;
-#if PACKETVER_RE_NUM >= 20180704
+#if PACKETVER_MAIN_NUM >= 20181121 || PACKETVER_RE_NUM >= 20180704 || PACKETVER_ZERO_NUM >= 20181114
uint32 ITID;
#else
uint16 ITID;
@@ -1804,6 +1791,7 @@ struct PACKET_ZC_GROUP_LIST {
struct PACKET_ZC_GROUP_LIST_SUB members[];
} __attribute__((packed));
+#if PACKETVER_MAIN_NUM >= 20130626 || PACKETVER_RE_NUM >= 20130605 || defined(PACKETVER_ZERO)
struct PACKET_ZC_CLANINFO {
int16 PacketType;
int16 PacketLength;
@@ -1814,6 +1802,8 @@ struct PACKET_ZC_CLANINFO {
uint8 AllyCount;
uint8 AntagonistCount;
} __attribute__((packed));
+DEFINE_PACKET_HEADER(ZC_CLANINFO, 0x098a);
+#endif
struct PACKET_ZC_NOTIFY_CLAN_CONNECTINFO {
int16 PacketType;
@@ -1965,7 +1955,7 @@ struct PACKET_ZC_UI_ACTION {
struct PACKET_CZ_PRIVATE_AIRSHIP_REQUEST {
int16 PacketType;
char mapName[MAP_NAME_LENGTH_EXT];
-#if PACKETVER_RE_NUM >= 20180704
+#if PACKETVER_MAIN_NUM >= 20181121 || PACKETVER_RE_NUM >= 20180704 || PACKETVER_ZERO_NUM >= 20181114
uint32 ItemID;
#else
uint16 ItemID;
@@ -2011,7 +2001,7 @@ struct pet_evolution_items {
struct PACKET_CZ_PET_EVOLUTION {
int16 PacketType;
uint16 PacketLength;
-#if PACKETVER_RE_NUM >= 20180704
+#if PACKETVER_MAIN_NUM >= 20181121 || PACKETVER_RE_NUM >= 20180704 || PACKETVER_ZERO_NUM >= 20181114
uint32 EvolvedPetEggID;
#else
uint16 EvolvedPetEggID;
@@ -2045,7 +2035,7 @@ struct PACKET_ZC_NOTIFY_PLAYERCHAT {
struct PACKET_ZC_ITEM_ENTRY {
int16 packetType;
uint32 AID;
-#if PACKETVER_RE_NUM >= 20180704
+#if PACKETVER_MAIN_NUM >= 20181121 || PACKETVER_RE_NUM >= 20180704 || PACKETVER_ZERO_NUM >= 20181114
uint32 itemId;
#else
uint16 itemId;
@@ -2062,7 +2052,7 @@ struct PACKET_ZC_ADD_ITEM_TO_STORE {
int16 packetType;
int16 index;
int32 amount;
-#if PACKETVER_RE_NUM >= 20180704
+#if PACKETVER_MAIN_NUM >= 20181121 || PACKETVER_RE_NUM >= 20180704 || PACKETVER_ZERO_NUM >= 20181114
uint32 itemId;
#else
uint16 itemId;
@@ -2081,7 +2071,7 @@ struct PACKET_ZC_ADD_ITEM_TO_STORE {
struct PACKET_ZC_MVP_GETTING_ITEM {
int16 packetType;
-#if PACKETVER_RE_NUM >= 20180704
+#if PACKETVER_MAIN_NUM >= 20181121 || PACKETVER_RE_NUM >= 20180704 || PACKETVER_ZERO_NUM >= 20181114
uint32 itemId;
#else
uint16 itemId;
@@ -2091,7 +2081,7 @@ struct PACKET_ZC_MVP_GETTING_ITEM {
struct PACKET_ZC_ACK_TOUSESKILL {
int16 packetType;
uint16 skillId;
-#if PACKETVER_RE_NUM >= 20180704
+#if PACKETVER_MAIN_NUM >= 20181121 || PACKETVER_RE_NUM >= 20180704 || PACKETVER_ZERO_NUM >= 20181114
int32 btype;
uint32 itemId;
#else
@@ -2106,7 +2096,7 @@ struct PACKET_ZC_ADD_ITEM_TO_CART {
int16 packetType;
int16 index;
int32 amount;
-#if PACKETVER_RE_NUM >= 20180704
+#if PACKETVER_MAIN_NUM >= 20181121 || PACKETVER_RE_NUM >= 20180704 || PACKETVER_ZERO_NUM >= 20181114
uint32 itemId;
#else
uint16 itemId;
@@ -2125,7 +2115,7 @@ struct PACKET_ZC_ADD_ITEM_TO_CART {
struct PACKET_CZ_REQMAKINGITEM {
int16 packetType;
-#if PACKETVER_RE_NUM >= 20180704
+#if PACKETVER_MAIN_NUM >= 20181121 || PACKETVER_RE_NUM >= 20180704 || PACKETVER_ZERO_NUM >= 20181114
uint32 itemId;
uint32 material[3];
#else
@@ -2137,7 +2127,7 @@ struct PACKET_CZ_REQMAKINGITEM {
struct PACKET_ZC_ACK_REQMAKINGITEM {
int16 packetType;
int16 result;
-#if PACKETVER_RE_NUM >= 20180704
+#if PACKETVER_MAIN_NUM >= 20181121 || PACKETVER_RE_NUM >= 20180704 || PACKETVER_ZERO_NUM >= 20181114
uint32 itemId;
#else
uint16 itemId;
@@ -2147,7 +2137,7 @@ struct PACKET_ZC_ACK_REQMAKINGITEM {
struct PACKET_ZC_FEED_PET {
int16 packetType;
uint8 result;
-#if PACKETVER_RE_NUM >= 20180704
+#if PACKETVER_MAIN_NUM >= 20181121 || PACKETVER_RE_NUM >= 20180704 || PACKETVER_ZERO_NUM >= 20181114
uint32 itemId;
#else
uint16 itemId;
@@ -2157,7 +2147,7 @@ struct PACKET_ZC_FEED_PET {
struct PACKET_ZC_FEED_MER {
int16 packetType;
uint8 result;
-#if PACKETVER_RE_NUM >= 20180704
+#if PACKETVER_MAIN_NUM >= 20181121 || PACKETVER_RE_NUM >= 20180704 || PACKETVER_ZERO_NUM >= 20181114
uint32 itemId;
#else
uint16 itemId;
@@ -2167,7 +2157,7 @@ struct PACKET_ZC_FEED_MER {
struct PACKET_ZC_USE_ITEM_ACK {
int16 packetType;
int16 index;
-#if PACKETVER_RE_NUM >= 20180704
+#if PACKETVER_MAIN_NUM >= 20181121 || PACKETVER_RE_NUM >= 20180704 || PACKETVER_ZERO_NUM >= 20181114
uint32 itemId;
uint32 AID;
#elif PACKETVER >= 3
@@ -2182,7 +2172,7 @@ struct PACKET_ZC_SPRITE_CHANGE {
int16 packetType;
uint32 AID;
uint8 type;
-#if PACKETVER_RE_NUM >= 20180704
+#if PACKETVER_MAIN_NUM >= 20181121 || PACKETVER_RE_NUM >= 20180704 || PACKETVER_ZERO_NUM >= 20181114
uint32 val;
uint32 val2;
#elif PACKETVER >= 4
@@ -2195,7 +2185,7 @@ struct PACKET_ZC_SPRITE_CHANGE {
struct PACKET_ZC_ADD_EXCHANGE_ITEM {
int16 packetType;
-#if PACKETVER_RE_NUM >= 20180704
+#if PACKETVER_MAIN_NUM >= 20181121 || PACKETVER_RE_NUM >= 20180704 || PACKETVER_ZERO_NUM >= 20181114
uint32 itemId;
uint8 itemType;
int32 amount;
@@ -2218,7 +2208,7 @@ struct PACKET_ZC_ADD_EXCHANGE_ITEM {
struct PACKET_ZC_CASH_TIME_COUNTER {
int16 packetType;
-#if PACKETVER_RE_NUM >= 20180704
+#if PACKETVER_MAIN_NUM >= 20181121 || PACKETVER_RE_NUM >= 20180704 || PACKETVER_ZERO_NUM >= 20181114
uint32 itemId;
#else
uint16 itemId;
@@ -2229,7 +2219,7 @@ struct PACKET_ZC_CASH_TIME_COUNTER {
struct PACKET_ZC_CASH_ITEM_DELETE {
int16 packetType;
uint16 index;
-#if PACKETVER_RE_NUM >= 20180704
+#if PACKETVER_MAIN_NUM >= 20181121 || PACKETVER_RE_NUM >= 20180704 || PACKETVER_ZERO_NUM >= 20181114
uint32 itemId;
#else
uint16 itemId;
@@ -2239,7 +2229,7 @@ struct PACKET_ZC_CASH_ITEM_DELETE {
struct PACKET_ZC_ITEM_PICKUP_PARTY {
int16 packetType;
uint32 AID;
-#if PACKETVER_RE_NUM >= 20180704
+#if PACKETVER_MAIN_NUM >= 20181121 || PACKETVER_RE_NUM >= 20180704 || PACKETVER_ZERO_NUM >= 20181114
uint32 itemId;
#else
uint16 itemId;
@@ -2254,7 +2244,7 @@ struct PACKET_ZC_ITEM_PICKUP_PARTY {
struct PACKET_ZC_UPDATE_ITEM_FROM_BUYING_STORE {
int16 packetType;
-#if PACKETVER_RE_NUM >= 20180704
+#if PACKETVER_MAIN_NUM >= 20181121 || PACKETVER_RE_NUM >= 20180704 || PACKETVER_ZERO_NUM >= 20181114
uint32 itemId;
#else
uint16 itemId;
@@ -2273,13 +2263,15 @@ struct PACKET_ZC_UPDATE_ITEM_FROM_BUYING_STORE {
struct PACKET_ZC_ACK_WEAPONREFINE {
int16 packetType;
int32 result;
-#if PACKETVER_RE_NUM >= 20180704
+#if PACKETVER_MAIN_NUM >= 20181121 || PACKETVER_RE_NUM >= 20180704 || PACKETVER_ZERO_NUM >= 20181114
uint32 itemId;
#else
uint16 itemId;
#endif
} __attribute__((packed));
+#if PACKETVER_MAIN_NUM >= 20131230 || PACKETVER_RE_NUM >= 20131230 || defined(PACKETVER_ZERO_NUM)
+// PACKET_ZC_PROPERTY_HOMUN2
struct PACKET_ZC_PROPERTY_HOMUN {
int16 packetType;
char name[NAME_LENGTH];
@@ -2288,7 +2280,7 @@ struct PACKET_ZC_PROPERTY_HOMUN {
uint16 level;
uint16 hunger;
uint16 intimacy;
-#if PACKETVER_RE_NUM >= 20180704
+#if PACKETVER_MAIN_NUM >= 20181121 || PACKETVER_RE_NUM >= 20180704 || PACKETVER_ZERO_NUM >= 20181114
uint32 itemId;
#else
uint16 itemId;
@@ -2301,13 +2293,41 @@ struct PACKET_ZC_PROPERTY_HOMUN {
uint16 mdef;
uint16 flee;
uint16 amotion;
-#if PACKETVER < 20150513
- uint16 hp;
- uint16 maxHp;
-#else
uint32 hp;
uint32 maxHp;
+ uint16 sp;
+ uint16 maxSp;
+ uint32 exp;
+ uint32 expNext;
+ uint16 skillPoints;
+ uint16 range;
+} __attribute__((packed));
+DEFINE_PACKET_HEADER(ZC_PROPERTY_HOMUN, 0x09f7);
+#elif PACKETVER_MAIN_NUM >= 20101005 || PACKETVER_RE_NUM >= 20080827 || defined(PACKETVER_ZERO_NUM)
+// PACKET_ZC_PROPERTY_HOMUN1
+struct PACKET_ZC_PROPERTY_HOMUN {
+ int16 packetType;
+ char name[NAME_LENGTH];
+ // Bit field, bit 0 : rename_flag (1 = already renamed), bit 1 : homunc vaporized (1 = true), bit 2 : homunc dead (1 = true)
+ uint8 flags;
+ uint16 level;
+ uint16 hunger;
+ uint16 intimacy;
+#if PACKETVER_MAIN_NUM >= 20181121 || PACKETVER_RE_NUM >= 20180704 || PACKETVER_ZERO_NUM >= 20181114
+ uint32 itemId;
+#else
+ uint16 itemId;
#endif
+ uint16 atk2;
+ uint16 matk;
+ uint16 hit;
+ uint16 crit;
+ uint16 def;
+ uint16 mdef;
+ uint16 flee;
+ uint16 amotion;
+ uint16 hp;
+ uint16 maxHp;
uint16 sp;
uint16 maxSp;
uint32 exp;
@@ -2315,11 +2335,13 @@ struct PACKET_ZC_PROPERTY_HOMUN {
uint16 skillPoints;
uint16 range;
} __attribute__((packed));
+DEFINE_PACKET_HEADER(ZC_PROPERTY_HOMUN, 0x022e);
+#endif
struct PACKET_ZC_FAILED_TRADE_BUYING_STORE_TO_SELLER {
int16 packetType;
uint16 result;
-#if PACKETVER_RE_NUM >= 20180704
+#if PACKETVER_MAIN_NUM >= 20181121 || PACKETVER_RE_NUM >= 20180704 || PACKETVER_ZERO_NUM >= 20181114
uint32 itemId;
#else
uint16 itemId;
@@ -2329,7 +2351,7 @@ struct PACKET_ZC_FAILED_TRADE_BUYING_STORE_TO_SELLER {
struct PACKET_CZ_REQ_ITEMREPAIR {
int16 packetType;
int16 index;
-#if PACKETVER_RE_NUM >= 20180704
+#if PACKETVER_MAIN_NUM >= 20181121 || PACKETVER_RE_NUM >= 20180704 || PACKETVER_ZERO_NUM >= 20181114
uint32 itemId;
#else
uint16 itemId;
@@ -2341,7 +2363,7 @@ struct PACKET_CZ_REQ_ITEMREPAIR {
struct PACKET_CZ_REQ_MAKINGITEM {
int16 packetType;
int16 type;
-#if PACKETVER_RE_NUM >= 20180704
+#if PACKETVER_MAIN_NUM >= 20181121 || PACKETVER_RE_NUM >= 20180704 || PACKETVER_ZERO_NUM >= 20181114
uint32 itemId;
#else
uint16 itemId;
@@ -2352,7 +2374,7 @@ struct PACKET_CZ_SSILIST_ITEM_CLICK {
int16 packetType;
uint32 AID;
uint32 storeId;
-#if PACKETVER_RE_NUM >= 20180704
+#if PACKETVER_MAIN_NUM >= 20181121 || PACKETVER_RE_NUM >= 20180704 || PACKETVER_ZERO_NUM >= 20181114
uint32 itemId;
#else
uint16 itemId;
@@ -2360,7 +2382,7 @@ struct PACKET_CZ_SSILIST_ITEM_CLICK {
} __attribute__((packed));
struct PACKET_ZC_ACK_SCHEDULER_CASHITEM_sub {
-#if PACKETVER_RE_NUM >= 20180704
+#if PACKETVER_MAIN_NUM >= 20181121 || PACKETVER_RE_NUM >= 20180704 || PACKETVER_ZERO_NUM >= 20181114
uint32 itemId;
#else
uint16 itemId;
@@ -2381,7 +2403,7 @@ struct PACKET_ZC_PC_PURCHASE_MYITEMLIST_sub {
int16 index;
int16 amount;
uint8 itemType;
-#if PACKETVER_RE_NUM >= 20180704
+#if PACKETVER_MAIN_NUM >= 20181121 || PACKETVER_RE_NUM >= 20180704 || PACKETVER_ZERO_NUM >= 20181114
uint32 itemId;
#else
uint16 itemId;
@@ -2406,7 +2428,7 @@ struct PACKET_ZC_PC_PURCHASE_ITEMLIST_sub {
uint32 price;
uint32 discountPrice;
uint8 itemType;
-#if PACKETVER_RE_NUM >= 20180704
+#if PACKETVER_MAIN_NUM >= 20181121 || PACKETVER_RE_NUM >= 20180704 || PACKETVER_ZERO_NUM >= 20181114
uint32 itemId;
#else
uint16 itemId;
@@ -2421,7 +2443,7 @@ struct PACKET_ZC_PC_PURCHASE_ITEMLIST {
struct PACKET_CZ_PC_PURCHASE_ITEMLIST_sub {
uint16 amount;
-#if PACKETVER_RE_NUM >= 20180704
+#if PACKETVER_MAIN_NUM >= 20181121 || PACKETVER_RE_NUM >= 20180704 || PACKETVER_ZERO_NUM >= 20181114
uint32 itemId;
#else
uint16 itemId;
@@ -2435,7 +2457,7 @@ struct PACKET_CZ_PC_PURCHASE_ITEMLIST {
} __attribute__((packed));
struct PACKET_CZ_REQ_OPEN_BUYING_STORE_sub {
-#if PACKETVER_RE_NUM >= 20180704
+#if PACKETVER_MAIN_NUM >= 20181121 || PACKETVER_RE_NUM >= 20180704 || PACKETVER_ZERO_NUM >= 20181114
uint32 itemId;
#else
uint16 itemId;
@@ -2457,7 +2479,7 @@ struct PACKET_ZC_MYITEMLIST_BUYING_STORE_sub {
uint32 price;
uint16 amount;
uint8 itemType;
-#if PACKETVER_RE_NUM >= 20180704
+#if PACKETVER_MAIN_NUM >= 20181121 || PACKETVER_RE_NUM >= 20180704 || PACKETVER_ZERO_NUM >= 20181114
uint32 itemId;
#else
uint16 itemId;
@@ -2477,7 +2499,7 @@ struct PACKET_ZC_PC_PURCHASE_ITEMLIST_FROMMC_sub {
uint16 amount;
int16 index;
uint8 itemType;
-#if PACKETVER_RE_NUM >= 20180704
+#if PACKETVER_MAIN_NUM >= 20181121 || PACKETVER_RE_NUM >= 20180704 || PACKETVER_ZERO_NUM >= 20181114
uint32 itemId;
#else
uint16 itemId;
@@ -2510,7 +2532,7 @@ struct PACKET_ZC_ACK_ITEMLIST_BUYING_STORE_sub {
uint32 price;
uint16 amount;
uint8 itemType;
-#if PACKETVER_RE_NUM >= 20180704
+#if PACKETVER_MAIN_NUM >= 20181121 || PACKETVER_RE_NUM >= 20180704 || PACKETVER_ZERO_NUM >= 20181114
uint32 itemId;
#else
uint16 itemId;
@@ -2528,7 +2550,7 @@ struct PACKET_ZC_ACK_ITEMLIST_BUYING_STORE {
struct PACKET_CZ_REQ_TRADE_BUYING_STORE_sub {
int16 index;
-#if PACKETVER_RE_NUM >= 20180704
+#if PACKETVER_MAIN_NUM >= 20181121 || PACKETVER_RE_NUM >= 20180704 || PACKETVER_ZERO_NUM >= 20181114
uint32 itemId;
#else
uint16 itemId;
@@ -2545,7 +2567,7 @@ struct PACKET_CZ_REQ_TRADE_BUYING_STORE {
} __attribute__((packed));
struct PACKET_ZC_MAKABLEITEMLIST_sub {
-#if PACKETVER_RE_NUM >= 20180704
+#if PACKETVER_MAIN_NUM >= 20181121 || PACKETVER_RE_NUM >= 20180704 || PACKETVER_ZERO_NUM >= 20181114
uint32 itemId;
uint32 material[3];
#else
@@ -2561,7 +2583,7 @@ struct PACKET_ZC_MAKABLEITEMLIST {
} __attribute__((packed));
struct PACKET_ZC_MAKINGARROW_LIST_sub {
-#if PACKETVER_RE_NUM >= 20180704
+#if PACKETVER_MAIN_NUM >= 20181121 || PACKETVER_RE_NUM >= 20180704 || PACKETVER_ZERO_NUM >= 20181114
uint32 itemId;
#else
uint16 itemId;
@@ -2576,7 +2598,7 @@ struct PACKET_ZC_MAKINGARROW_LIST {
struct PACKET_ZC_REPAIRITEMLIST_sub {
int16 index;
-#if PACKETVER_RE_NUM >= 20180704
+#if PACKETVER_MAIN_NUM >= 20181121 || PACKETVER_RE_NUM >= 20180704 || PACKETVER_ZERO_NUM >= 20181114
uint32 itemId;
#else
uint16 itemId;
@@ -2593,7 +2615,7 @@ struct PACKET_ZC_REPAIRITEMLIST {
struct PACKET_ZC_NOTIFY_WEAPONITEMLIST_sub {
int16 index;
-#if PACKETVER_RE_NUM >= 20180704
+#if PACKETVER_MAIN_NUM >= 20181121 || PACKETVER_RE_NUM >= 20180704 || PACKETVER_ZERO_NUM >= 20181114
uint32 itemId;
#else
uint16 itemId;
@@ -2609,7 +2631,7 @@ struct PACKET_ZC_NOTIFY_WEAPONITEMLIST {
} __attribute__((packed));
struct PACKET_ZC_MAKINGITEM_LIST_sub {
-#if PACKETVER_RE_NUM >= 20180704
+#if PACKETVER_MAIN_NUM >= 20181121 || PACKETVER_RE_NUM >= 20180704 || PACKETVER_ZERO_NUM >= 20181114
uint32 itemId;
#else
uint16 itemId;
@@ -2619,7 +2641,7 @@ struct PACKET_ZC_MAKINGITEM_LIST_sub {
struct PACKET_ZC_MAKINGITEM_LIST {
int16 packetType;
int16 packetLength;
-#if PACKETVER_RE_NUM >= 20180704
+#if PACKETVER_MAIN_NUM >= 20181121 || PACKETVER_RE_NUM >= 20180704 || PACKETVER_ZERO_NUM >= 20181114
uint32 makeItem;
#else
uint16 makeItem;
@@ -2631,7 +2653,7 @@ struct PACKET_ZC_PC_CASH_POINT_ITEMLIST_sub {
uint32 price;
uint32 discountPrice;
uint8 itemType;
-#if PACKETVER_RE_NUM >= 20180704
+#if PACKETVER_MAIN_NUM >= 20181121 || PACKETVER_RE_NUM >= 20180704 || PACKETVER_ZERO_NUM >= 20181114
uint32 itemId;
#else
uint16 itemId;
@@ -2650,7 +2672,7 @@ struct PACKET_ZC_PC_CASH_POINT_ITEMLIST {
struct PACKET_CZ_PC_BUY_CASH_POINT_ITEM_sub {
uint16 amount;
-#if PACKETVER_RE_NUM >= 20180704
+#if PACKETVER_MAIN_NUM >= 20181121 || PACKETVER_RE_NUM >= 20180704 || PACKETVER_ZERO_NUM >= 20181114
uint32 itemId;
#else
uint16 itemId;
@@ -2674,7 +2696,7 @@ struct PACKET_CZ_PC_BUY_CASH_POINT_ITEM {
} __attribute__((packed));
struct PACKET_CZ_SEARCH_STORE_INFO_item {
-#if PACKETVER_RE_NUM >= 20180704
+#if PACKETVER_MAIN_NUM >= 20181121 || PACKETVER_RE_NUM >= 20180704 || PACKETVER_ZERO_NUM >= 20181114
uint32 itemId;
#else
uint16 itemId;
@@ -2699,7 +2721,7 @@ struct PACKET_ZC_SEARCH_STORE_INFO_ACK_sub {
uint32 storeId;
uint32 AID;
char shopName[MESSAGE_SIZE];
-#if PACKETVER_RE_NUM >= 20180704
+#if PACKETVER_MAIN_NUM >= 20181121 || PACKETVER_RE_NUM >= 20180704 || PACKETVER_ZERO_NUM >= 20181114
uint32 itemId;
#else
uint16 itemId;
@@ -2874,6 +2896,7 @@ struct PACKET_ZC_REMOVE_EFFECT {
uint32 effectId;
} __attribute__((packed));
+#if PACKETVER >= 20160525
struct PACKET_ZC_CAMERA_INFO {
int16 packetType;
int8 action;
@@ -2881,23 +2904,36 @@ struct PACKET_ZC_CAMERA_INFO {
float rotation;
float latitude;
} __attribute__((packed));
-
-#if PACKETVER_RE_NUM >= 20181031
-#define PACKET_ZC_AUTOSPELLLIST PACKET_ZC_AUTOSPELLLIST2
-#else
-#define PACKET_ZC_AUTOSPELLLIST PACKET_ZC_AUTOSPELLLIST1
+DEFINE_PACKET_HEADER(ZC_CAMERA_INFO, 0x0a78);
#endif
-struct PACKET_ZC_AUTOSPELLLIST1 {
+#if PACKETVER >= 20160525
+struct PACKET_CZ_CAMERA_INFO {
int16 packetType;
- int skills[7];
+ int8 action;
+ float range;
+ float rotation;
+ float latitude;
} __attribute__((packed));
+DEFINE_PACKET_HEADER(CZ_CAMERA_INFO, 0x0a77);
+#endif
-struct PACKET_ZC_AUTOSPELLLIST2 {
+#if PACKETVER_MAIN_NUM >= 20181128 || PACKETVER_RE_NUM >= 20181031
+// PACKET_ZC_AUTOSPELLLIST2
+struct PACKET_ZC_AUTOSPELLLIST {
int16 packetType;
int16 packetLength;
int skills[];
} __attribute__((packed));
+DEFINE_PACKET_HEADER(ZC_AUTOSPELLLIST, 0x0afb);
+#elif PACKETVER_MAIN_NUM >= 20090406 || defined(PACKETVER_RE) || defined(PACKETVER_ZERO) || PACKETVER_SAK_NUM >= 20080618
+// PACKET_ZC_AUTOSPELLLIST1
+struct PACKET_ZC_AUTOSPELLLIST {
+ int16 packetType;
+ int skills[7];
+} __attribute__((packed));
+DEFINE_PACKET_HEADER(ZC_AUTOSPELLLIST, 0x01cd);
+#endif
#if PACKETVER_MAIN_NUM >= 20170726 || PACKETVER_RE_NUM >= 20170621 || defined(PACKETVER_ZERO)
#if PACKETVER_MAIN_NUM >= 20181017 || PACKETVER_RE_NUM >= 20181017 || PACKETVER_ZERO_NUM >= 20181024
@@ -2923,6 +2959,104 @@ DEFINE_PACKET_HEADER(ZC_ITEM_PREVIEW, 0x0ab9);
#endif // PACKETVER_MAIN_NUM >= 20181017 || PACKETVER_RE_NUM >= 20181017 || PACKETVER_ZERO_NUM >= 20181024
#endif // PACKETVER_MAIN_NUM >= 20170726 || PACKETVER_RE_NUM >= 20170621 || defined(PACKETVER_ZERO)
+#if PACKETVER_MAIN_NUM >= 20160831 || PACKETVER_RE_NUM >= 20151118 || defined(PACKETVER_ZERO)
+struct PACKET_ZC_ENCHANT_EQUIPMENT {
+ int16 packetType;
+ int16 wearState;
+ int16 cardSlot;
+#if PACKETVER_MAIN_NUM >= 20181121 || PACKETVER_RE_NUM >= 20180704 || PACKETVER_ZERO_NUM >= 20181114
+ int32 itemId;
+#else
+ int16 itemId;
+#endif
+ int8 equipFlag;
+} __attribute__((packed));
+DEFINE_PACKET_HEADER(ZC_ENCHANT_EQUIPMENT, 0x0a3f);
+#endif // PACKETVER_MAIN_NUM >= 20160831 || PACKETVER_RE_NUM >= 20151118 || defined(PACKETVER_ZERO)
+
+#if PACKETVER_MAIN_NUM >= 20170830 || PACKETVER_RE_NUM >= 20170830 || defined(PACKETVER_ZERO)
+struct PACKET_ZC_SERVICE_MESSAGE_COLOR {
+ int16 packetType;
+ int16 packetLength;
+ int32 color;
+ char message[];
+} __attribute__((packed));
+DEFINE_PACKET_HEADER(ZC_SERVICE_MESSAGE_COLOR, 0x0adb);
+#endif
+
+#if PACKETVER_MAIN_NUM >= 20181002 || PACKETVER_RE_NUM >= 20181002 || PACKETVER_ZERO_NUM >= 20181010
+struct PACKET_CZ_START_USE_SKILL {
+ int16 packetType;
+ int16 skillId;
+ int16 skillLv;
+ uint32 targetId;
+} __attribute__((packed));
+DEFINE_PACKET_HEADER(CZ_START_USE_SKILL, 0x0b10);
+
+struct PACKET_CZ_STOP_USE_SKILL {
+ int16 packetType;
+ int16 skillId;
+} __attribute__((packed));
+DEFINE_PACKET_HEADER(CZ_STOP_USE_SKILL, 0x0b11);
+#endif
+
+#if PACKETVER_ZERO_NUM >= 20181212
+struct PACKET_ZC_INVENTORY_EXPANSION_INFO {
+ int16 packetType;
+ int16 expansionSize;
+} __attribute__((packed));
+DEFINE_PACKET_HEADER(ZC_INVENTORY_EXPANSION_INFO, 0x0b18);
+#endif
+
+#if PACKETVER_ZERO_NUM >= 20181212
+struct PACKET_ZC_ACK_INVENTORY_EXPAND {
+ int16 packetType;
+ uint8 result;
+ uint32 itemId;
+} __attribute__((packed));
+DEFINE_PACKET_HEADER(ZC_ACK_INVENTORY_EXPAND, 0x0b15);
+#endif
+
+#if PACKETVER_ZERO_NUM >= 20181212
+struct PACKET_ZC_ACK_INVENTORY_EXPAND_RESULT {
+ int16 packetType;
+ uint8 result;
+} __attribute__((packed));
+DEFINE_PACKET_HEADER(ZC_ACK_INVENTORY_EXPAND_RESULT, 0x0b17);
+#endif
+
+#if PACKETVER_MAIN_NUM >= 20181031 || PACKETVER_RE_NUM >= 20181031 || PACKETVER_ZERO_NUM >= 20181114
+struct PACKET_CZ_INVENTORY_EXPAND {
+ int16 packetType;
+} __attribute__((packed));
+DEFINE_PACKET_HEADER(CZ_INVENTORY_EXPAND, 0x0b14);
+#endif
+
+#if PACKETVER_MAIN_NUM >= 20181031 || PACKETVER_RE_NUM >= 20181031 || PACKETVER_ZERO_NUM >= 20181114
+struct PACKET_CZ_INVENTORY_EXPAND_CONFIRMED {
+ int16 packetType;
+} __attribute__((packed));
+DEFINE_PACKET_HEADER(CZ_INVENTORY_EXPAND_CONFIRMED, 0x0b16);
+#endif
+
+#if PACKETVER_MAIN_NUM >= 20181031 || PACKETVER_RE_NUM >= 20181031 || PACKETVER_ZERO_NUM >= 20181114
+struct PACKET_CZ_INVENTORY_EXPAND_REJECTED {
+ int16 packetType;
+} __attribute__((packed));
+DEFINE_PACKET_HEADER(CZ_INVENTORY_EXPAND_REJECTED, 0x0b19);
+#endif
+
+struct PACKET_CZ_REQ_REMAINTIME {
+ int16 packetType;
+} __attribute__((packed));
+DEFINE_PACKET_HEADER(CZ_REQ_REMAINTIME, 0x01c0);
+
+struct PACKET_CZ_PARTY_CONFIG {
+ int16 packetType;
+ uint8 refuseInvite;
+} __attribute__((packed));
+DEFINE_PACKET_HEADER(CZ_PARTY_CONFIG, 0x02c8);
+
#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/pc.c b/src/map/pc.c
index fcd36a233..94d8cd0c6 100644
--- a/src/map/pc.c
+++ b/src/map/pc.c
@@ -568,7 +568,7 @@ static void pc_rental_expire(struct map_session_data *sd, int i)
int nameid;
nullpo_retv(sd);
- Assert_retv(i >= 0 && i < MAX_INVENTORY);
+ Assert_retv(i >= 0 && i < sd->status.inventorySize);
nameid = sd->status.inventory[i].nameid;
/* Soon to be dropped, we got plans to integrate it with item db */
@@ -637,11 +637,11 @@ static void pc_rental_expire(struct map_session_data *sd, int i)
}
static void pc_inventory_rentals(struct map_session_data *sd)
{
- int i, c = 0;
+ int c = 0;
int64 expire_tick, next_tick = INT64_MAX;
nullpo_retv(sd);
- for( i = 0; i < MAX_INVENTORY; i++ )
+ for (int i = 0; i < sd->status.inventorySize; i++ )
{ // Check for Rentals on Inventory
if( sd->status.inventory[i].nameid == 0 )
continue; // Nothing here
@@ -782,7 +782,7 @@ static int pc_equippoint(struct map_session_data *sd, int n)
int ep = 0;
nullpo_ret(sd);
- Assert_ret(n >= 0 && n < MAX_INVENTORY);
+ Assert_ret(n >= 0 && n < sd->status.inventorySize);
if(!sd->inventory_data[n])
return 0;
@@ -838,11 +838,9 @@ static int pc_item_equippoint(struct map_session_data *sd, struct item_data *id)
static int pc_setinventorydata(struct map_session_data *sd)
{
- int i;
-
nullpo_ret(sd);
- for (i = 0; i < MAX_INVENTORY; i++) {
+ for (int i = 0; i < sd->status.inventorySize; i++) {
int id = sd->status.inventory[i].nameid;
sd->inventory_data[i] = id?itemdb->search(id):NULL;
}
@@ -902,7 +900,7 @@ static int pc_setequipindex(struct map_session_data *sd)
for(i=0;i<EQI_MAX;i++)
sd->equip_index[i] = -1;
- for(i=0;i<MAX_INVENTORY;i++) {
+ for (i = 0; i < sd->status.inventorySize; i++) {
if(sd->status.inventory[i].nameid <= 0)
continue;
if(sd->status.inventory[i].equip) {
@@ -1073,6 +1071,7 @@ static int pc_isequip(struct map_session_data *sd, int n)
struct item_data *item;
nullpo_ret(sd);
+ Assert_ret(n >= 0 && n < sd->status.inventorySize);
item = sd->inventory_data[n];
@@ -1379,6 +1378,7 @@ static bool pc_authok(struct map_session_data *sd, int login_id2, time_t expirat
pc->setpos(sd,sd->status.last_point.map,0,0,CLR_OUTSIGHT);
}
+ clif->inventoryExpansionInfo(sd);
clif->overweight_percent(sd);
clif->authok(sd);
@@ -4308,7 +4308,7 @@ static bool pc_can_insert_card_into(struct map_session_data *sd, int idx_card, i
nullpo_ret(sd);
- if (idx_equip < 0 || idx_equip >= MAX_INVENTORY || sd->inventory_data[idx_equip] == NULL)
+ if (idx_equip < 0 || idx_equip >= sd->status.inventorySize || sd->inventory_data[idx_equip] == NULL)
return false; //Invalid item index.
if (sd->status.inventory[idx_equip].nameid <= 0 || sd->status.inventory[idx_equip].amount < 1)
return false; // target item missing
@@ -4342,7 +4342,7 @@ static bool pc_can_insert_card(struct map_session_data *sd, int idx_card)
{
nullpo_ret(sd);
- if (idx_card < 0 || idx_card >= MAX_INVENTORY || sd->inventory_data[idx_card] == NULL)
+ if (idx_card < 0 || idx_card >= sd->status.inventorySize || sd->inventory_data[idx_card] == NULL)
return false; //Invalid card index.
if (sd->status.inventory[idx_card].nameid <= 0 || sd->status.inventory[idx_card].amount < 1)
return false; // target card missing
@@ -4438,7 +4438,6 @@ static int pc_modifysellvalue(struct map_session_data *sd, int orig_value)
*------------------------------------------*/
static int pc_checkadditem(struct map_session_data *sd, int nameid, int amount)
{
- int i;
struct item_data* data;
nullpo_ret(sd);
@@ -4454,7 +4453,7 @@ static int pc_checkadditem(struct map_session_data *sd, int nameid, int amount)
if( data->stack.inventory && amount > data->stack.amount )
return ADDITEM_OVERAMOUNT;
- for(i=0;i<MAX_INVENTORY;i++){
+ for(int i = 0; i < sd->status.inventorySize; i++) {
// FIXME: This does not consider the checked item's cards, thus could check a wrong slot for stackability.
if(sd->status.inventory[i].nameid==nameid){
if( amount > MAX_AMOUNT - sd->status.inventory[i].amount || ( data->stack.inventory && amount > data->stack.amount - sd->status.inventory[i].amount ) )
@@ -4472,11 +4471,10 @@ static int pc_checkadditem(struct map_session_data *sd, int nameid, int amount)
*------------------------------------------*/
static int pc_inventoryblank(struct map_session_data *sd)
{
- int i,b;
-
nullpo_ret(sd);
+ int b = 0;
- for(i=0,b=0;i<MAX_INVENTORY;i++){
+ for (int i = 0; i < sd->status.inventorySize; i++) {
if(sd->status.inventory[i].nameid==0)
b++;
}
@@ -4673,8 +4671,8 @@ static int pc_search_inventory(struct map_session_data *sd, int item_id)
int i;
nullpo_retr(INDEX_NOT_FOUND, sd);
- ARR_FIND( 0, MAX_INVENTORY, i, sd->status.inventory[i].nameid == item_id && (sd->status.inventory[i].amount > 0 || item_id == 0) );
- return ( i < MAX_INVENTORY ) ? i : INDEX_NOT_FOUND;
+ ARR_FIND(0, sd->status.inventorySize, i, sd->status.inventory[i].nameid == item_id && (sd->status.inventory[i].amount > 0 || item_id == 0));
+ return (i < sd->status.inventorySize) ? i : INDEX_NOT_FOUND;
}
/*==========================================
@@ -4736,11 +4734,11 @@ static int pc_additem(struct map_session_data *sd, const struct item *item_data,
}
}
- i = MAX_INVENTORY;
+ i = sd->status.inventorySize;
// Stackable | Non Rental
if( itemdb->isstackable2(data) && item_data->expire_time == 0 ) {
- for( i = 0; i < MAX_INVENTORY; i++ ) {
+ for (i = 0; i < sd->status.inventorySize; i++) {
if( sd->status.inventory[i].nameid == item_data->nameid &&
sd->status.inventory[i].bound == item_data->bound &&
sd->status.inventory[i].expire_time == 0 &&
@@ -4755,7 +4753,7 @@ static int pc_additem(struct map_session_data *sd, const struct item *item_data,
}
}
- if ( i >= MAX_INVENTORY ) {
+ if (i >= sd->status.inventorySize) {
i = pc->search_inventory(sd,0);
if (i == INDEX_NOT_FOUND)
return 4;
@@ -4815,7 +4813,7 @@ static int pc_additem(struct map_session_data *sd, const struct item *item_data,
static int pc_delitem(struct map_session_data *sd, int n, int amount, int type, short reason, e_log_pick_type log_type)
{
nullpo_retr(1, sd);
- Assert_retr(1, n >= 0 && n < MAX_INVENTORY);
+ Assert_retr(1, n >= 0 && n < sd->status.inventorySize);
if(sd->status.inventory[n].nameid==0 || amount <= 0 || sd->status.inventory[n].amount<amount || sd->inventory_data[n] == NULL)
return 1;
@@ -4849,7 +4847,7 @@ static int pc_dropitem(struct map_session_data *sd, int n, int amount)
{
nullpo_retr(1, sd);
- if(n < 0 || n >= MAX_INVENTORY)
+ if(n < 0 || n >= sd->status.inventorySize)
return 0;
if(amount <= 0)
@@ -4960,7 +4958,7 @@ static int pc_isUseitem(struct map_session_data *sd, int n)
int nameid;
nullpo_ret(sd);
- Assert_ret(n >= 0 && n < MAX_INVENTORY);
+ Assert_ret(n >= 0 && n < sd->status.inventorySize);
item = sd->inventory_data[n];
nameid = sd->status.inventory[n].nameid;
@@ -5196,7 +5194,7 @@ static int pc_useitem(struct map_session_data *sd, int n)
bool removeItem = false;
nullpo_ret(sd);
- Assert_ret(n >= 0 && n < MAX_INVENTORY);
+ Assert_ret(n >= 0 && n < sd->status.inventorySize);
if (sd->npc_id || sd->state.workinprogress & 1) {
#if PACKETVER >= 20110308
@@ -5433,7 +5431,7 @@ static int pc_cart_delitem(struct map_session_data *sd, int n, int amount, int t
{
struct item_data * data;
nullpo_retr(1, sd);
- Assert_retr(1, n >= 0 && n < MAX_INVENTORY);
+ Assert_retr(1, n >= 0 && n < MAX_CART);
if( sd->status.cart[n].nameid == 0 || sd->status.cart[n].amount < amount || !(data = itemdb->exists(sd->status.cart[n].nameid)) )
return 1;
@@ -5467,7 +5465,7 @@ static int pc_putitemtocart(struct map_session_data *sd, int idx, int amount)
nullpo_ret(sd);
- if (idx < 0 || idx >= MAX_INVENTORY) //Invalid index check [Skotlex]
+ if (idx < 0 || idx >= sd->status.inventorySize) //Invalid index check [Skotlex]
return 1;
item_data = &sd->status.inventory[idx];
@@ -5537,7 +5535,7 @@ static void pc_bound_clear(struct map_session_data *sd, enum e_item_bound_type t
/* both restricted to inventory */
case IBT_PARTY:
case IBT_CHARACTER:
- for( i = 0; i < MAX_INVENTORY; i++ ){
+ for (i = 0; i < sd->status.inventorySize; i++ ) {
if( sd->status.inventory[i].bound == type ) {
pc->delitem(sd, i, sd->status.inventory[i].amount, 0, DELITEM_SKILLUSE, LOG_TYPE_OTHER); // FIXME: is this the correct reason flag?
}
@@ -5549,7 +5547,7 @@ static void pc_bound_clear(struct map_session_data *sd, enum e_item_bound_type t
case IBT_GUILD: {
struct guild_storage *gstor = idb_get(gstorage->db,sd->status.guild_id);
- for( i = 0; i < MAX_INVENTORY; i++ ){
+ for (i = 0; i < sd->status.inventorySize; i++ ) {
if(sd->status.inventory[i].bound == type) {
if( gstor )
gstorage->additem(sd,gstor,&sd->status.inventory[i],sd->status.inventory[i].amount);
@@ -5706,7 +5704,7 @@ static int pc_steal_coin(struct map_session_data *sd, struct block_list *target,
* 1 - Invalid map index.
* 2 - Map not in this map-server, and failed to locate alternate map-server.
*------------------------------------------*/
-static int pc_setpos(struct map_session_data *sd, unsigned short map_index, int x, int y, clr_type clrtype)
+static int pc_setpos(struct map_session_data *sd, unsigned short map_index, int x, int y, enum clr_type clrtype)
{
int16 m;
@@ -5946,7 +5944,7 @@ static int pc_setpos(struct map_session_data *sd, unsigned short map_index, int
* 0 = fail or FIXME success (from pc->setpos)
* x(1|2) = fail
*------------------------------------------*/
-static int pc_randomwarp(struct map_session_data *sd, clr_type type)
+static int pc_randomwarp(struct map_session_data *sd, enum clr_type type)
{
int x,y,i=0;
int16 m;
@@ -7945,7 +7943,7 @@ static int pc_skillheal2_bonus(struct map_session_data *sd, uint16 skill_id)
return bonus;
}
-static void pc_respawn(struct map_session_data *sd, clr_type clrtype)
+static void pc_respawn(struct map_session_data *sd, enum clr_type clrtype)
{
if( !pc_isdead(sd) )
return; // not applicable
@@ -8290,15 +8288,15 @@ static int pc_dead(struct map_session_data *sd, struct block_list *src)
if(id == 0)
continue;
if(id == -1){
- int eq_num=0,eq_n[MAX_INVENTORY],k;
+ int eq_num = 0, eq_n[MAX_INVENTORY], k;
memset(eq_n,0,sizeof(eq_n));
- for(i=0;i<MAX_INVENTORY;i++){
+ for(i = 0; i < sd->status.inventorySize; i++) {
if( (type == 1 && !sd->status.inventory[i].equip)
|| (type == 2 && sd->status.inventory[i].equip)
|| type == 3)
{
- ARR_FIND( 0, MAX_INVENTORY, k, eq_n[k] <= 0 );
- if( k < MAX_INVENTORY )
+ ARR_FIND(0, sd->status.inventorySize, k, eq_n[k] <= 0);
+ if (k < sd->status.inventorySize)
eq_n[k] = i;
eq_num++;
@@ -8314,7 +8312,7 @@ static int pc_dead(struct map_session_data *sd, struct block_list *src)
}
}
else if(id > 0){
- for(i=0;i<MAX_INVENTORY;i++){
+ for( i = 0; i < sd->status.inventorySize; i++) {
if(sd->status.inventory[i].nameid == id
&& rnd()%10000 < per
&& ((type == 1 && !sd->status.inventory[i].equip)
@@ -10145,7 +10143,7 @@ static int pc_equipitem(struct map_session_data *sd, int n, int req_pos)
nullpo_ret(sd);
- if( n < 0 || n >= MAX_INVENTORY ) {
+ if (n < 0 || n >= sd->status.inventorySize) {
clif->equipitemack(sd,0,0,EIA_FAIL);
return 0;
}
@@ -10353,7 +10351,7 @@ static int pc_unequipitem(struct map_session_data *sd, int n, int flag)
nullpo_ret(sd);
- if (n < 0 || n >= MAX_INVENTORY) {
+ if (n < 0 || n >= sd->status.inventorySize) {
clif->unequipitemack(sd, 0, 0, UIA_FAIL);
return 0;
}
@@ -10505,7 +10503,7 @@ static int pc_checkitem(struct map_session_data *sd)
int id = 0;
if (sd->itemcheck & PCCHECKITEM_INVENTORY) {
- for (i = 0; i < MAX_INVENTORY; i++) {
+ for (i = 0; i < sd->status.inventorySize; i++) {
if ((id = sd->status.inventory[i].nameid) == 0)
continue;
@@ -10585,7 +10583,7 @@ static int pc_checkitem(struct map_session_data *sd)
}
}
- for (i = 0; i < MAX_INVENTORY; i++) {
+ for (i = 0; i < sd->status.inventorySize; i++) {
if (sd->status.inventory[i].nameid == 0)
continue;
@@ -10759,11 +10757,14 @@ static int pc_divorce(struct map_session_data *sd)
// Both players online, lets do the divorce manually
sd->status.partner_id = 0;
p_sd->status.partner_id = 0;
- for( i = 0; i < MAX_INVENTORY; i++ )
+ for (i = 0; i < sd->status.inventorySize; i++)
{
- if( sd->status.inventory[i].nameid == WEDDING_RING_M || sd->status.inventory[i].nameid == WEDDING_RING_F )
+ if (sd->status.inventory[i].nameid == WEDDING_RING_M || sd->status.inventory[i].nameid == WEDDING_RING_F)
pc->delitem(sd, i, 1, 0, DELITEM_NORMAL, LOG_TYPE_DIVORCE);
- if( p_sd->status.inventory[i].nameid == WEDDING_RING_M || p_sd->status.inventory[i].nameid == WEDDING_RING_F )
+ }
+ for (i = 0; i < p_sd->status.inventorySize; i++)
+ {
+ if (p_sd->status.inventory[i].nameid == WEDDING_RING_M || p_sd->status.inventory[i].nameid == WEDDING_RING_F)
pc->delitem(p_sd, i, 1, 0, DELITEM_NORMAL, LOG_TYPE_DIVORCE);
}
@@ -12337,6 +12338,23 @@ static bool pc_has_second_costume(struct map_session_data *sd)
return false;
}
+static bool pc_expandInventory(struct map_session_data *sd, int adjustSize)
+{
+ nullpo_retr(false, sd);
+ const int invSize = sd->status.inventorySize;
+ if (adjustSize > MAX_INVENTORY || invSize + adjustSize <= FIXED_INVENTORY_SIZE || invSize + adjustSize > MAX_INVENTORY) {
+ clif->inventoryExpandResult(sd, EXPAND_INVENTORY_RESULT_MAX_SIZE);
+ return false;
+ }
+ if (pc_isdead(sd) || sd->state.vending || sd->state.buyingstore || sd->chat_id != 0 || sd->state.trading || sd->state.storage_flag || sd->state.prevend) {
+ clif->inventoryExpandResult(sd, EXPAND_INVENTORY_RESULT_OTHER_WORK);
+ return false;
+ }
+ sd->status.inventorySize += adjustSize;
+ clif->inventoryExpansionInfo(sd);
+ return true;
+}
+
static void do_final_pc(void)
{
@@ -12739,4 +12757,5 @@ void pc_defaults(void)
pc->isDeathPenaltyJob = pc_isDeathPenaltyJob;
pc->has_second_costume = pc_has_second_costume;
+ pc->expandInventory = pc_expandInventory;
}
diff --git a/src/map/pc.h b/src/map/pc.h
index 8302279b1..bc2fd5a62 100644
--- a/src/map/pc.h
+++ b/src/map/pc.h
@@ -905,7 +905,7 @@ END_ZEROED_BLOCK; /* End */
int (*setrestartvalue) (struct map_session_data *sd,int type);
int (*makesavestatus) (struct map_session_data *sd);
- void (*respawn) (struct map_session_data* sd, clr_type clrtype);
+ void (*respawn) (struct map_session_data* sd, enum clr_type clrtype);
int (*setnewpc) (struct map_session_data *sd, int account_id, int char_id, int login_id1, unsigned int client_tick, int sex, int fd);
bool (*authok) (struct map_session_data *sd, int login_id2, time_t expiration_time, int group_id, const struct mmo_charstatus *st, bool changing_mapservers);
void (*authfail) (struct map_session_data *sd);
@@ -927,9 +927,9 @@ END_ZEROED_BLOCK; /* End */
int (*calc_skilltree_normalize_job) (struct map_session_data *sd);
int (*clean_skilltree) (struct map_session_data *sd);
- int (*setpos) (struct map_session_data* sd, unsigned short map_index, int x, int y, clr_type clrtype);
+ int (*setpos) (struct map_session_data* sd, unsigned short map_index, int x, int y, enum clr_type clrtype);
int (*setsavepoint) (struct map_session_data *sd, short map_index, int x, int y);
- int (*randomwarp) (struct map_session_data *sd,clr_type type);
+ int (*randomwarp) (struct map_session_data *sd, enum clr_type type);
int (*memo) (struct map_session_data* sd, int pos);
int (*checkadditem) (struct map_session_data *sd,int nameid,int amount);
@@ -1185,6 +1185,7 @@ END_ZEROED_BLOCK; /* End */
bool (*check_basicskill) (struct map_session_data *sd, int level);
bool (*isDeathPenaltyJob) (uint16 job);
bool (*has_second_costume) (struct map_session_data *sd);
+ bool (*expandInventory) (struct map_session_data *sd, int adjustSize);
};
#ifdef HERCULES_CORE
diff --git a/src/map/pet.c b/src/map/pet.c
index c32a92b78..dd9f1ebbf 100644
--- a/src/map/pet.c
+++ b/src/map/pet.c
@@ -94,10 +94,10 @@ static void pet_set_intimate(struct pet_data *pd, int value)
if (value <= 0) {
int i;
- ARR_FIND(0, MAX_INVENTORY, i, sd->status.inventory[i].card[0] == CARD0_PET &&
+ ARR_FIND(0, sd->status.inventorySize, i, sd->status.inventory[i].card[0] == CARD0_PET &&
pd->pet.pet_id == MakeDWord(sd->status.inventory[i].card[1], sd->status.inventory[i].card[2]));
- if (i != MAX_INVENTORY) {
+ if (i != sd->status.inventorySize) {
pc->delitem(sd, i, 1, 0, DELITEM_NORMAL, LOG_TYPE_EGG);
}
}
@@ -342,10 +342,10 @@ static int pet_return_egg(struct map_session_data *sd, struct pet_data *pd)
pet->lootitem_drop(pd,sd);
// Pet Evolution
- ARR_FIND(0, MAX_INVENTORY, i, sd->status.inventory[i].card[0] == CARD0_PET &&
+ ARR_FIND(0, sd->status.inventorySize, i, sd->status.inventory[i].card[0] == CARD0_PET &&
pd->pet.pet_id == MakeDWord(sd->status.inventory[i].card[1], sd->status.inventory[i].card[2]));
- if (i != MAX_INVENTORY) {
+ if (i != sd->status.inventorySize) {
sd->status.inventory[i].attribute &= ~ATTR_BROKEN;
sd->status.inventory[i].bound = IBT_NONE;
}
@@ -492,10 +492,10 @@ static int pet_recv_petdata(int account_id, struct s_pet *p, int flag)
if(p->incubate == 1) {
int i;
// Get Egg Index
- ARR_FIND(0, MAX_INVENTORY, i, sd->status.inventory[i].card[0] == CARD0_PET &&
+ ARR_FIND(0, sd->status.inventorySize, i, sd->status.inventory[i].card[0] == CARD0_PET &&
p->pet_id == MakeDWord(sd->status.inventory[i].card[1], sd->status.inventory[i].card[2]));
- if(i == MAX_INVENTORY) {
+ if(i == sd->status.inventorySize) {
ShowError("pet_recv_petdata: Hatching pet (%d:%s) aborted, couldn't find egg in inventory for removal!\n",p->pet_id, p->name);
sd->status.pet_id = 0;
return 1;
@@ -527,7 +527,7 @@ static int pet_select_egg(struct map_session_data *sd, int egg_index)
{
nullpo_ret(sd);
- if(egg_index < 0 || egg_index >= MAX_INVENTORY)
+ if (egg_index < 0 || egg_index >= sd->status.inventorySize)
return 0; //Forged packet!
if(sd->status.inventory[egg_index].card[0] == CARD0_PET)
diff --git a/src/map/quest.c b/src/map/quest.c
index f10d6847f..7a216095e 100644
--- a/src/map/quest.c
+++ b/src/map/quest.c
@@ -814,7 +814,7 @@ static bool quest_questinfo_validate_items(struct map_session_data *sd, struct q
for (int i = 0; i < VECTOR_LENGTH(qi->items); i++) {
struct questinfo_itemreq *item = &VECTOR_INDEX(qi->items, i);
int count = 0;
- for (int j = 0; j < MAX_INVENTORY; j++) {
+ for (int j = 0; j < sd->status.inventorySize; j++) {
if (sd->status.inventory[j].nameid == item->nameid)
count += sd->status.inventory[j].amount;
}
diff --git a/src/map/rodex.c b/src/map/rodex.c
index 602754d42..eea27b6d0 100644
--- a/src/map/rodex.c
+++ b/src/map/rodex.c
@@ -83,7 +83,7 @@ static void rodex_add_item(struct map_session_data *sd, int16 idx, int16 amount)
nullpo_retv(sd);
- if (idx < 0 || idx >= MAX_INVENTORY) {
+ if (idx < 0 || idx >= sd->status.inventorySize) {
clif->rodex_add_item_result(sd, idx, amount, RODEX_ADD_ITEM_FATAL_ERROR);
return;
}
@@ -160,7 +160,7 @@ static void rodex_remove_item(struct map_session_data *sd, int16 idx, int16 amou
struct item_data *itd;
nullpo_retv(sd);
- Assert_retv(idx >= 0 && idx < MAX_INVENTORY);
+ Assert_retv(idx >= 0 && idx < sd->status.inventorySize);
for (i = 0; i < RODEX_MAX_ITEM; ++i) {
if (sd->rodex.tmp.items[i].idx == idx)
@@ -504,7 +504,7 @@ static void rodex_get_items(struct map_session_data *sd, int8 opentype, int64 ma
}
required_slots = msg->items_count;
- for (i = 0; i < MAX_INVENTORY; ++i) {
+ for (i = 0; i < sd->status.inventorySize; ++i) {
if (sd->status.inventory[i].nameid == 0) {
empty_slots++;
} else if (itemdb->isstackable(sd->status.inventory[i].nameid) == 1) {
diff --git a/src/map/script.c b/src/map/script.c
index 41f21cd72..3d3fba867 100644
--- a/src/map/script.c
+++ b/src/map/script.c
@@ -7553,7 +7553,6 @@ static BUILDIN(viewpoint)
*------------------------------------------*/
static BUILDIN(countitem)
{
- int nameid, i;
int count = 0;
struct item_data* id = NULL;
@@ -7575,11 +7574,12 @@ static BUILDIN(countitem)
return false;
}
- nameid = id->nameid;
+ int nameid = id->nameid;
- for(i = 0; i < MAX_INVENTORY; i++)
- if(sd->status.inventory[i].nameid == nameid)
+ for (int i = 0; i < sd->status.inventorySize; i++) {
+ if (sd->status.inventory[i].nameid == nameid)
count += sd->status.inventory[i].amount;
+ }
script_pushint(st,count);
return true;
@@ -7593,7 +7593,6 @@ static BUILDIN(countitem2)
{
int nameid, iden, ref, attr, c1, c2, c3, c4;
int count = 0;
- int i;
struct item_data* id = NULL;
struct map_session_data *sd = script->rid2sd(st);
@@ -7623,7 +7622,7 @@ static BUILDIN(countitem2)
c3 = script_getnum(st,8);
c4 = script_getnum(st,9);
- for(i = 0; i < MAX_INVENTORY; i++)
+ for (int i = 0; i < sd->status.inventorySize; i++)
if (sd->status.inventory[i].nameid > 0 && sd->inventory_data[i] != NULL &&
sd->status.inventory[i].amount > 0 && sd->status.inventory[i].nameid == nameid &&
sd->status.inventory[i].identify == iden && sd->status.inventory[i].refine == ref &&
@@ -9148,13 +9147,13 @@ static BUILDIN(getequipname)
*------------------------------------------*/
static BUILDIN(getbrokenid)
{
- int i,num,id=0,brokencounter=0;
+ int num,id=0,brokencounter=0;
struct map_session_data *sd = script->rid2sd(st);
if (sd == NULL)
return true;
num=script_getnum(st,2);
- for(i=0; i<MAX_INVENTORY; i++) {
+ for (int i = 0; i < sd->status.inventorySize; i++) {
if (sd->status.inventory[i].card[0] == CARD0_PET)
continue;
if ((sd->status.inventory[i].attribute & ATTR_BROKEN) != 0) {
@@ -9181,7 +9180,7 @@ static BUILDIN(getbrokencount)
if (sd == NULL)
return true;
- for (i = 0; i < MAX_INVENTORY; i++) {
+ for (i = 0; i < sd->status.inventorySize; i++) {
if (sd->status.inventory[i].card[0] == CARD0_PET)
continue;
if ((sd->status.inventory[i].attribute & ATTR_BROKEN) != 0)
@@ -9198,14 +9197,13 @@ static BUILDIN(getbrokencount)
*------------------------------------------*/
static BUILDIN(repair)
{
- int i,num;
int repaircounter=0;
struct map_session_data *sd = script->rid2sd(st);
if (sd == NULL)
return true;
- num=script_getnum(st,2);
- for(i=0; i<MAX_INVENTORY; i++) {
+ int num = script_getnum(st, 2);
+ for(int i = 0; i < sd->status.inventorySize; i++) {
if (sd->status.inventory[i].card[0] == CARD0_PET)
continue;
if ((sd->status.inventory[i].attribute & ATTR_BROKEN) != 0) {
@@ -9229,12 +9227,12 @@ static BUILDIN(repair)
*------------------------------------------*/
static BUILDIN(repairall)
{
- int i, repaircounter = 0;
+ int repaircounter = 0;
struct map_session_data *sd = script->rid2sd(st);
if (sd == NULL)
return true;
- for(i = 0; i < MAX_INVENTORY; i++)
+ for (int i = 0; i < sd->status.inventorySize; i++)
{
if (sd->status.inventory[i].card[0] == CARD0_PET)
continue;
@@ -14722,10 +14720,10 @@ static BUILDIN(getinventorylist)
struct map_session_data *sd = script->rid2sd(st);
char card_var[SCRIPT_VARNAME_LENGTH];
- int i,j=0,k;
+ int j=0,k;
if(!sd) return true;
- for(i=0;i<MAX_INVENTORY;i++) {
+ for (int i = 0;i < sd->status.inventorySize; i++) {
if(sd->status.inventory[i].nameid > 0 && sd->status.inventory[i].amount > 0) {
pc->setreg(sd,reference_uid(script->add_variable("@inventorylist_id"), j),sd->status.inventory[i].nameid);
pc->setreg(sd,reference_uid(script->add_variable("@inventorylist_amount"), j),sd->status.inventory[i].amount);
@@ -14816,10 +14814,9 @@ static BUILDIN(getskilllist)
static BUILDIN(clearitem)
{
struct map_session_data *sd = script->rid2sd(st);
- int i;
if (sd == NULL)
return true;
- for (i=0; i<MAX_INVENTORY; i++) {
+ for (int i = 0; i < sd->status.inventorySize; i++) {
if (sd->status.inventory[i].amount) {
pc->delitem(sd, i, sd->status.inventory[i].amount, 0, DELITEM_NORMAL, LOG_TYPE_SCRIPT);
}
@@ -15590,19 +15587,18 @@ static BUILDIN(getmercinfo)
*------------------------------------------*/
static BUILDIN(checkequipedcard)
{
- int n,i,c=0;
struct map_session_data *sd = script->rid2sd(st);
if (sd == NULL)
return true;
- c = script_getnum(st,2);
+ int c = script_getnum(st,2);
- for( i=0; i<MAX_INVENTORY; i++) {
+ for (int i = 0; i < sd->status.inventorySize; i++) {
if(sd->status.inventory[i].nameid > 0 && sd->status.inventory[i].amount && sd->inventory_data[i]) {
if (itemdb_isspecial(sd->status.inventory[i].card[0]))
continue;
- for(n=0;n<sd->inventory_data[i]->slot;n++) {
+ for (int n = 0; n < sd->inventory_data[i]->slot; n++) {
if(sd->status.inventory[i].card[n]==c) {
script_pushint(st,1);
return true;
@@ -15678,6 +15674,29 @@ static BUILDIN(message)
return true;
}
+static BUILDIN(servicemessage)
+{
+ struct map_session_data *sd = NULL;
+
+ if (script_hasdata(st, 4)) {
+ if (script_isstringtype(st, 4))
+ sd = script->nick2sd(st, script_getstr(st, 4));
+ else
+ sd = script->id2sd(st, script_getnum(st, 4));
+ } else {
+ sd = script->rid2sd(st);
+ }
+
+ if (sd == NULL)
+ return true;
+
+ const char *message = script_getstr(st, 2);
+ const int color = script_getnum(st, 3);
+ clif->serviceMessageColor(sd, color, message);
+
+ return true;
+}
+
/*==========================================
* npctalk (sends message to surrounding area)
* usage: npctalk("<message>"{, "<npc name>"{, <show_name>}});
@@ -16447,9 +16466,9 @@ static BUILDIN(equip)
ShowError("wrong item ID : equipitem(%d)\n",nameid);
return false;
}
- ARR_FIND( 0, MAX_INVENTORY, i, sd->status.inventory[i].nameid == nameid && sd->status.inventory[i].equip == 0 );
- if( i < MAX_INVENTORY )
- pc->equipitem(sd,i,item_data->equip);
+ ARR_FIND(0, sd->status.inventorySize, i, sd->status.inventory[i].nameid == nameid && sd->status.inventory[i].equip == 0);
+ if (i < sd->status.inventorySize)
+ pc->equipitem(sd, i, item_data->equip);
return true;
}
@@ -16507,21 +16526,21 @@ static BUILDIN(equip2)
c2 = script_getnum(st, 7);
c3 = script_getnum(st, 8);
- ARR_FIND( 0, MAX_INVENTORY, i,( sd->status.inventory[i].equip == 0 &&
+ ARR_FIND(0, sd->status.inventorySize, i, (sd->status.inventory[i].equip == 0 &&
sd->status.inventory[i].nameid == nameid &&
sd->status.inventory[i].refine == ref &&
sd->status.inventory[i].attribute == attr &&
sd->status.inventory[i].card[0] == c0 &&
sd->status.inventory[i].card[1] == c1 &&
sd->status.inventory[i].card[2] == c2 &&
- sd->status.inventory[i].card[3] == c3 ) );
+ sd->status.inventory[i].card[3] == c3));
- if( i < MAX_INVENTORY ) {
+ if (i < sd->status.inventorySize) {
script_pushint(st,1);
pc->equipitem(sd,i,item_data->equip);
- }
- else
+ } else {
script_pushint(st,0);
+ }
return true;
}
@@ -23635,7 +23654,7 @@ static BUILDIN(bg_join_team)
*------------------------------------------*/
static BUILDIN(countbound)
{
- int i, type, j=0, k=0;
+ int type, j=0, k=0;
struct map_session_data *sd = script->rid2sd(st);
if (sd == NULL)
@@ -23643,7 +23662,7 @@ static BUILDIN(countbound)
type = script_hasdata(st,2)?script_getnum(st,2):0;
- for(i=0;i<MAX_INVENTORY;i++) {
+ for (int i = 0; i < sd->status.inventorySize; i++) {
if(sd->status.inventory[i].nameid > 0 && (
(!type && sd->status.inventory[i].bound > 0) ||
(type && sd->status.inventory[i].bound == type)
@@ -23689,20 +23708,21 @@ static BUILDIN(checkbound)
ShowError("script_checkbound: Not a valid bind type! Type=%d\n", bound_type);
}
- ARR_FIND( 0, MAX_INVENTORY, i, (sd->status.inventory[i].nameid == nameid &&
+ ARR_FIND(0, sd->status.inventorySize, i, (sd->status.inventory[i].nameid == nameid &&
( sd->status.inventory[i].refine == (script_hasdata(st,4)? script_getnum(st,4) : sd->status.inventory[i].refine) ) &&
( sd->status.inventory[i].attribute == (script_hasdata(st,5)? script_getnum(st,5) : sd->status.inventory[i].attribute) ) &&
( sd->status.inventory[i].card[0] == (script_hasdata(st,6)? script_getnum(st,6) : sd->status.inventory[i].card[0]) ) &&
( sd->status.inventory[i].card[1] == (script_hasdata(st,7)? script_getnum(st,7) : sd->status.inventory[i].card[1]) ) &&
( sd->status.inventory[i].card[2] == (script_hasdata(st,8)? script_getnum(st,8) : sd->status.inventory[i].card[2]) ) &&
( sd->status.inventory[i].card[3] == (script_hasdata(st,9)? script_getnum(st,9) : sd->status.inventory[i].card[3]) ) &&
- ((sd->status.inventory[i].bound > 0 && !bound_type) || sd->status.inventory[i].bound == bound_type )) );
+ ((sd->status.inventory[i].bound > 0 && !bound_type) || sd->status.inventory[i].bound == bound_type)));
- if( i < MAX_INVENTORY ){
+ if (i < sd->status.inventorySize) {
script_pushint(st, sd->status.inventory[i].bound);
return true;
- } else
+ } else {
script_pushint(st,0);
+ }
return true;
}
@@ -24790,6 +24810,100 @@ static BUILDIN(itempreview)
return true;
}
+// insert or remove card into equipped item
+static BUILDIN(enchantitem)
+{
+ struct map_session_data *sd = script_rid2sd(st);
+ if (sd == NULL)
+ return false;
+ const int pos = script_getnum(st, 2);
+ if ((pos < EQI_ACC_L || pos > EQI_HAND_R) && pos != EQI_AMMO) {
+ ShowError("Wrong equip position: %d\n", pos);
+ script->reportfunc(st);
+ script->reportsrc(st);
+ script_pushint(st, false);
+ return true;
+ }
+ const int cardId = script_getnum(st, 4);
+ struct item_data *it = itemdb->exists(cardId);
+ if (it == NULL || it->type != IT_CARD) {
+ ShowError("Item id is not card or not exists: %d\n", cardId);
+ script->reportfunc(st);
+ script->reportsrc(st);
+ script_pushint(st, false);
+ return true;
+ }
+ const int n = sd->equip_index[pos];
+ if (n < 0) {
+ ShowError("Item in equipment slot %d is not equipped\n", pos);
+ script->reportfunc(st);
+ script->reportsrc(st);
+ script_pushint(st, false);
+ return true;
+ }
+ const int cardSlot = script_getnum(st, 3);
+ if (cardSlot < 0 || cardSlot >= MAX_SLOTS) {
+ ShowError("Wrong card slot %d. Must be in range 0-3.\n", cardSlot);
+ script->reportfunc(st);
+ script->reportsrc(st);
+ script_pushint(st, false);
+ return true;
+ }
+ const bool res = clif->enchant_equipment(sd, pc->equip_pos[pos], cardSlot, cardId);
+ if (res) {
+ logs->pick_pc(sd, LOG_TYPE_CARD, -1, &sd->status.inventory[n],sd->inventory_data[n]);
+ sd->status.inventory[n].card[cardSlot] = cardId;
+ logs->pick_pc(sd, LOG_TYPE_CARD, 1, &sd->status.inventory[n],sd->inventory_data[n]);
+ status_calc_pc(sd, SCO_NONE);
+ }
+ script_pushint(st, res);
+ return true;
+}
+
+// send ack to inventory expand request
+static BUILDIN(expandInventoryAck)
+{
+ struct map_session_data *sd = script_rid2sd(st);
+ if (sd == NULL)
+ return false;
+ int itemId = 0;
+ if (script_hasdata(st, 3)) {
+ itemId = script_getnum(st, 3);
+ }
+ clif->inventoryExpandAck(sd, script_getnum(st, 2), itemId);
+ return true;
+}
+
+// send final ack to inventory expand request
+static BUILDIN(expandInventoryResult)
+{
+ struct map_session_data *sd = script_rid2sd(st);
+ if (sd == NULL)
+ return false;
+ clif->inventoryExpandResult(sd, script_getnum(st, 2));
+ return true;
+}
+
+// adjust player inventory size to given value positive or negative
+static BUILDIN(expandInventory)
+{
+ struct map_session_data *sd = script_rid2sd(st);
+ if (sd == NULL)
+ return false;
+ script_pushint(st, pc->expandInventory(sd, script_getnum(st, 2)));
+ return true;
+}
+
+// return current player inventory size
+static BUILDIN(getInventorySize)
+{
+ struct map_session_data *sd = script_rid2sd(st);
+ if (sd == NULL)
+ return false;
+ script_pushint(st, sd->status.inventorySize);
+ return true;
+}
+
/**
* Adds a built-in script function.
*
@@ -25194,6 +25308,7 @@ static void script_parse_builtin(void)
BUILDIN_DEF2(atcommand,"charcommand","s"), // [MouseJstr]
BUILDIN_DEF(movenpc,"sii?"), // [MouseJstr]
BUILDIN_DEF(message,"vs"), // [MouseJstr]
+ BUILDIN_DEF(servicemessage, "si?"),
BUILDIN_DEF(npctalk,"s??"), // [Valaris][Murilo BiO]
BUILDIN_DEF(mobcount,"ss"),
BUILDIN_DEF(getlook,"i"),
@@ -25528,6 +25643,11 @@ static void script_parse_builtin(void)
BUILDIN_DEF(changecamera, "iii?"),
BUILDIN_DEF(itempreview, "i"),
+ BUILDIN_DEF(enchantitem, "iii"),
+ BUILDIN_DEF(expandInventoryAck, "i?"),
+ BUILDIN_DEF(expandInventoryResult, "i"),
+ BUILDIN_DEF(expandInventory, "i"),
+ BUILDIN_DEF(getInventorySize, ""),
};
int i, len = ARRAYLENGTH(BUILDIN);
RECREATE(script->buildin, char *, script->buildin_count + len); // Pre-alloc to speed up
@@ -25567,8 +25687,9 @@ static void script_hardcoded_constants(void)
script->set_constant("MAX_LEVEL",MAX_LEVEL,false, false);
script->set_constant("MAX_STORAGE",MAX_STORAGE,false, false);
script->set_constant("MAX_GUILD_STORAGE",MAX_GUILD_STORAGE,false, false);
- script->set_constant("MAX_CART",MAX_INVENTORY,false, false);
+ script->set_constant("MAX_CART", MAX_CART, false, false);
script->set_constant("MAX_INVENTORY",MAX_INVENTORY,false, false);
+ script->set_constant("FIXED_INVENTORY_SIZE", FIXED_INVENTORY_SIZE, false, false);
script->set_constant("MAX_ZENY",MAX_ZENY,false, false);
script->set_constant("MAX_BANK_ZENY", MAX_BANK_ZENY, false, false);
script->set_constant("MAX_BG_MEMBERS",MAX_BG_MEMBERS,false, false);
@@ -25950,6 +26071,19 @@ static void script_hardcoded_constants(void)
script->set_constant("ITR_NOAUCTION", ITR_NOAUCTION, false, false);
script->set_constant("ITR_ALL", ITR_ALL, false, false);
+ script->constdb_comment("inventory expand ack responds");
+ script->set_constant("EXPAND_INV_ASK_CONFIRMATION", EXPAND_INVENTORY_ASK_CONFIRMATION, false, false);
+ script->set_constant("EXPAND_INV_FAILED", EXPAND_INVENTORY_FAILED, false, false);
+ script->set_constant("EXPAND_INV_OTHER_WORK", EXPAND_INVENTORY_OTHER_WORK, false, false);
+ script->set_constant("EXPAND_INV_MISSING_ITEM", EXPAND_INVENTORY_MISSING_ITEM, false, false);
+ script->set_constant("EXPAND_INV_MAX_SIZE", EXPAND_INVENTORY_MAX_SIZE, false, false);
+
+ script->constdb_comment("inventory expand final responds");
+ script->set_constant("EXPAND_INV_RESULT_SUCCESS", EXPAND_INVENTORY_RESULT_SUCCESS, false, false);
+ script->set_constant("EXPAND_INV_RESULT_FAILED", EXPAND_INVENTORY_RESULT_FAILED, false, false);
+ script->set_constant("EXPAND_INV_RESULT_OTHER_WORK", EXPAND_INVENTORY_RESULT_OTHER_WORK, false, false);
+ script->set_constant("EXPAND_INV_RESULT_MISSING_ITEM", EXPAND_INVENTORY_RESULT_MISSING_ITEM, false, false);
+ script->set_constant("EXPAND_INV_RESULT_MAX_SIZE", EXPAND_INVENTORY_RESULT_MAX_SIZE, false, false);
script->constdb_comment("Renewal");
#ifdef RENEWAL
diff --git a/src/map/skill.c b/src/map/skill.c
index 8410a77d0..069db55df 100644
--- a/src/map/skill.c
+++ b/src/map/skill.c
@@ -14490,8 +14490,8 @@ static int skill_check_condition_castbegin(struct map_session_data *sd, uint16 s
**/
case AB_ANCILLA:
{
- int count = 0, i;
- for( i = 0; i < MAX_INVENTORY; i ++ )
+ int count = 0;
+ for (int i = 0; i < sd->status.inventorySize; i ++)
if (sd->status.inventory[i].nameid == ITEMID_ANSILA)
count += sd->status.inventory[i].amount;
if( count >= 3 ) {
@@ -16109,7 +16109,7 @@ static void skill_repairweapon(struct map_session_data *sd, int idx)
if (idx == 0xFFFF || idx == -1) // No item selected ('Cancel' clicked)
return;
- if( idx < 0 || idx >= MAX_INVENTORY )
+ if (idx < 0 || idx >= sd->status.inventorySize)
return; //Invalid index??
item = &target_sd->status.inventory[idx];
@@ -16157,7 +16157,7 @@ static void skill_identify(struct map_session_data *sd, int idx)
nullpo_retv(sd);
sd->state.workinprogress = 0;
- if(idx >= 0 && idx < MAX_INVENTORY) {
+ if (idx >= 0 && idx < sd->status.inventorySize) {
if(sd->status.inventory[idx].nameid > 0 && sd->status.inventory[idx].identify == 0 ){
flag=0;
sd->status.inventory[idx].identify=1;
@@ -16173,7 +16173,7 @@ static void skill_weaponrefine(struct map_session_data *sd, int idx)
{
nullpo_retv(sd);
- if (idx >= 0 && idx < MAX_INVENTORY) {
+ if (idx >= 0 && idx < sd->status.inventorySize) {
struct item *item;
struct item_data *ditem = sd->inventory_data[idx];
item = &sd->status.inventory[idx];
@@ -17992,8 +17992,8 @@ static int skill_can_produce_mix(struct map_session_data *sd, int nameid, int tr
if (pc->search_inventory(sd,id) == INDEX_NOT_FOUND)
return 0;
} else {
- int x, y;
- for(y=0,x=0;y<MAX_INVENTORY;y++)
+ int x = 0;
+ for (int y = 0; y < sd->status.inventorySize; y++)
if( sd->status.inventory[y].nameid == id )
x+=sd->status.inventory[y].amount;
if(x<qty*skill->dbs->produce_db[i].mat_amount[j])
@@ -18064,7 +18064,7 @@ static int skill_produce_mix(struct map_session_data *sd, uint16 skill_id, int n
else temp_qty = 1;
if (data->stack.inventory) {
- for( i = 0; i < MAX_INVENTORY; i++ ) {
+ for (i = 0; i < sd->status.inventorySize; i++ ) {
if( sd->status.inventory[i].nameid == nameid ) {
if( sd->status.inventory[i].amount >= data->stack.amount ) {
#if PACKETVER >= 20090729
@@ -18872,7 +18872,7 @@ static int skill_elementalanalysis(struct map_session_data *sd, uint16 skill_lv,
del_amount -= (del_amount % 10);
add_amount = (skill_lv == 1) ? del_amount * (5 + rnd()%5) : del_amount / 10 ;
- if (idx < 0 || idx >= MAX_INVENTORY
+ if (idx < 0 || idx >= sd->status.inventorySize
|| (nameid = sd->status.inventory[idx].nameid) <= 0
|| del_amount < 0 || del_amount > sd->status.inventory[idx].amount) {
clif->skill_fail(sd, SO_EL_ANALYSIS, USESKILL_FAIL_LEVEL, 0, 0);
@@ -18943,7 +18943,7 @@ static int skill_changematerial(struct map_session_data *sd, const struct itemli
for (k = 0; k < VECTOR_LENGTH(*item_list); k++) {
const struct itemlist_entry *entry = &VECTOR_INDEX(*item_list, k);
int idx = entry->id;
- Assert_ret(idx >= 0 && idx < MAX_INVENTORY);
+ Assert_ret(idx >= 0 && idx < sd->status.inventorySize);
amount = entry->amount;
nameid = sd->status.inventory[idx].nameid;
if (nameid > 0 && sd->status.inventory[idx].identify == 0) {
diff --git a/src/map/status.c b/src/map/status.c
index 75744c59b..65b52cbcf 100644
--- a/src/map/status.c
+++ b/src/map/status.c
@@ -2446,7 +2446,7 @@ static int status_calc_pc_(struct map_session_data *sd, enum e_status_calc_opt o
sd->regen.sregen = &sd->sregen;
sd->regen.ssregen = &sd->ssregen;
sd->weight=0;
- for(i=0;i<MAX_INVENTORY;i++){
+ for (i = 0; i < sd->status.inventorySize; i++) {
if(sd->status.inventory[i].nameid==0 || sd->inventory_data[i] == NULL)
continue;
sd->weight += sd->inventory_data[i]->weight*sd->status.inventory[i].amount;
diff --git a/src/map/storage.c b/src/map/storage.c
index a6f0715e7..90b620f63 100644
--- a/src/map/storage.c
+++ b/src/map/storage.c
@@ -285,7 +285,7 @@ static int storage_add_from_inventory(struct map_session_data *sd, int index, in
if (sd->storage.aggregate > MAX_STORAGE)
return 0; // storage full
- if (index < 0 || index >= MAX_INVENTORY)
+ if (index < 0 || index >= sd->status.inventorySize)
return 0;
if (sd->status.inventory[index].nameid <= 0)
@@ -623,7 +623,7 @@ static int storage_guild_storageadd(struct map_session_data *sd, int index, int
if( !stor->storage_status || stor->storage_amount > MAX_GUILD_STORAGE )
return 0;
- if( index<0 || index>=MAX_INVENTORY )
+ if (index < 0 || index >= sd->status.inventorySize)
return 0;
if( sd->status.inventory[index].nameid <= 0 )
diff --git a/src/map/trade.c b/src/map/trade.c
index d4f846d19..9c284ba23 100644
--- a/src/map/trade.c
+++ b/src/map/trade.c
@@ -209,7 +209,7 @@ static int impossible_trade_check(struct map_session_data *sd)
// remove this part: arrows can be trade and equipped
// re-added! [celest]
// remove equipped items (they can not be trade)
- for (i = 0; i < MAX_INVENTORY; i++)
+ for (i = 0; i < sd->status.inventorySize; i++)
if (inventory[i].nameid > 0 && inventory[i].equip && !(inventory[i].equip & EQP_AMMO))
memset(&inventory[i], 0, sizeof(struct item));
@@ -218,7 +218,7 @@ static int impossible_trade_check(struct map_session_data *sd)
if (!sd->deal.item[i].amount)
continue;
index = sd->deal.item[i].index;
- if (index < 0 || index >= MAX_INVENTORY)
+ if (index < 0 || index >= sd->status.inventorySize)
return 1;
if (inventory[index].amount < sd->deal.item[i].amount) {
// if more than the player have -> hack
@@ -281,9 +281,9 @@ static int trade_check(struct map_session_data *sd, struct map_session_data *tsd
return 0; //qty Exploit?
data = itemdb->search(inventory[n].nameid);
- i = MAX_INVENTORY;
+ i = tsd->status.inventorySize;
if (itemdb->isstackable2(data)) { //Stackable item.
- for(i = 0; i < MAX_INVENTORY; i++)
+ for(i = 0; i < tsd->status.inventorySize; i++)
if (inventory2[i].nameid == inventory[n].nameid &&
inventory2[i].card[0] == inventory[n].card[0] && inventory2[i].card[1] == inventory[n].card[1] &&
inventory2[i].card[2] == inventory[n].card[2] && inventory2[i].card[3] == inventory[n].card[3]) {
@@ -295,9 +295,9 @@ static int trade_check(struct map_session_data *sd, struct map_session_data *tsd
}
}
- if (i == MAX_INVENTORY) {// look for an empty slot.
- for(i = 0; i < MAX_INVENTORY && inventory2[i].nameid; i++);
- if (i == MAX_INVENTORY)
+ if (i == tsd->status.inventorySize) {// look for an empty slot.
+ for (i = 0; i < tsd->status.inventorySize && inventory2[i].nameid; i++);
+ if (i == tsd->status.inventorySize)
return 0;
memcpy(&inventory2[i], &inventory[n], sizeof(struct item));
inventory2[i].amount = amount;
@@ -308,15 +308,15 @@ static int trade_check(struct map_session_data *sd, struct map_session_data *tsd
if (!amount)
continue;
n = tsd->deal.item[trade_i].index;
- if (n < 0 || n >= MAX_INVENTORY)
+ if (n < 0 || n >= tsd->status.inventorySize)
return 0;
if (amount > inventory2[n].amount)
return 0;
// search if it's possible to add item (for full inventory)
data = itemdb->search(inventory2[n].nameid);
- i = MAX_INVENTORY;
+ i = sd->status.inventorySize;
if (itemdb->isstackable2(data)) {
- for(i = 0; i < MAX_INVENTORY; i++)
+ for(i = 0; i < sd->status.inventorySize; i++)
if (inventory[i].nameid == inventory2[n].nameid &&
inventory[i].card[0] == inventory2[n].card[0] && inventory[i].card[1] == inventory2[n].card[1] &&
inventory[i].card[2] == inventory2[n].card[2] && inventory[i].card[3] == inventory2[n].card[3]) {
@@ -327,9 +327,9 @@ static int trade_check(struct map_session_data *sd, struct map_session_data *tsd
break;
}
}
- if (i == MAX_INVENTORY) {
- for(i = 0; i < MAX_INVENTORY && inventory[i].nameid; i++);
- if (i == MAX_INVENTORY)
+ if (i == sd->status.inventorySize) {
+ for(i = 0; i < sd->status.inventorySize && inventory[i].nameid; i++);
+ if (i == sd->status.inventorySize)
return 0;
memcpy(&inventory[i], &inventory2[n], sizeof(struct item));
inventory[i].amount = amount;
@@ -369,7 +369,7 @@ static void trade_tradeadditem(struct map_session_data *sd, short index, short a
index -= 2; // 0 is for zeny, 1 is unknown. Gravity, go figure...
//Item checks...
- if( index < 0 || index >= MAX_INVENTORY )
+ if (index < 0 || index >= sd->status.inventorySize)
return;
if( amount < 0 || amount > sd->status.inventory[index].amount )
return;
diff --git a/src/map/unit.c b/src/map/unit.c
index ee856cb76..68e6aeec1 100644
--- a/src/map/unit.c
+++ b/src/map/unit.c
@@ -918,7 +918,7 @@ static int unit_blown(struct block_list *bl, int dx, int dy, int count, int flag
//Warps a unit/ud to a given map/position.
//In the case of players, pc->setpos is used.
//it respects the no warp flags, so it is safe to call this without doing nowarpto/nowarp checks.
-static int unit_warp(struct block_list *bl, short m, short x, short y, clr_type type)
+static int unit_warp(struct block_list *bl, short m, short x, short y, enum clr_type type)
{
struct unit_data *ud;
nullpo_ret(bl);
@@ -2419,7 +2419,7 @@ static int unit_changeviewsize(struct block_list *bl, short size)
* Otherwise it is assumed bl is being warped.
* On-Kill specific stuff is not performed here, look at status->damage for that.
*------------------------------------------*/
-static int unit_remove_map(struct block_list *bl, clr_type clrtype, const char *file, int line, const char *func)
+static int unit_remove_map(struct block_list *bl, enum clr_type clrtype, const char *file, int line, const char *func)
{
struct unit_data *ud = unit->bl2ud(bl);
struct status_change *sc = status->get_sc(bl);
@@ -2665,7 +2665,7 @@ static int unit_remove_map(struct block_list *bl, clr_type clrtype, const char *
return 1;
}
-static void unit_remove_map_pc(struct map_session_data *sd, clr_type clrtype)
+static void unit_remove_map_pc(struct map_session_data *sd, enum clr_type clrtype)
{
nullpo_retv(sd);
unit->remove_map(&sd->bl,clrtype,ALC_MARK);
@@ -2697,7 +2697,7 @@ static void unit_free_pc(struct map_session_data *sd)
* Function to free all related resources to the bl
* if unit is on map, it is removed using the clrtype specified
*------------------------------------------*/
-static int unit_free(struct block_list *bl, clr_type clrtype)
+static int unit_free(struct block_list *bl, enum clr_type clrtype)
{
struct unit_data *ud = unit->bl2ud( bl );
nullpo_ret(bl);
diff --git a/src/map/unit.h b/src/map/unit.h
index 0c1c2405c..5c01cdc2e 100644
--- a/src/map/unit.h
+++ b/src/map/unit.h
@@ -116,7 +116,7 @@ struct unit_interface {
int (*setdir) (struct block_list *bl, unsigned char dir);
uint8 (*getdir) (struct block_list *bl);
int (*blown) (struct block_list *bl, int dx, int dy, int count, int flag);
- int (*warp) (struct block_list *bl, short m, short x, short y, clr_type type);
+ int (*warp) (struct block_list *bl, short m, short x, short y, enum clr_type type);
int (*stop_walking) (struct block_list *bl, int type);
int (*skilluse_id) (struct block_list *src, int target_id, uint16 skill_id, uint16 skill_lv);
int (*step_timer) (int tid, int64 tick, int id, intptr_t data);
@@ -142,10 +142,10 @@ struct unit_interface {
int (*counttargeted) (struct block_list *bl);
int (*fixdamage) (struct block_list *src, struct block_list *target, int sdelay, int ddelay, int64 damage, short div, unsigned char type, int64 damage2);
int (*changeviewsize) (struct block_list *bl, short size);
- int (*remove_map) (struct block_list *bl, clr_type clrtype, const char *file, int line, const char *func);
- void (*remove_map_pc) (struct map_session_data *sd, clr_type clrtype);
+ int (*remove_map) (struct block_list *bl, enum clr_type clrtype, const char *file, int line, const char *func);
+ void (*remove_map_pc) (struct map_session_data *sd, enum clr_type clrtype);
void (*free_pc) (struct map_session_data *sd);
- int (*free) (struct block_list *bl, clr_type clrtype);
+ int (*free) (struct block_list *bl, enum clr_type clrtype);
};
#ifdef HERCULES_CORE