diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/common/db.c | 2 | ||||
-rw-r--r-- | src/map/clif.c | 42 | ||||
-rw-r--r-- | src/map/map.c | 5 | ||||
-rw-r--r-- | src/map/pc.c | 1 | ||||
-rw-r--r-- | src/map/script.c | 2 |
5 files changed, 40 insertions, 12 deletions
diff --git a/src/common/db.c b/src/common/db.c index 4dcf1d0b0..550bfd382 100644 --- a/src/common/db.c +++ b/src/common/db.c @@ -1976,13 +1976,13 @@ static int db_obj_vclear(DBMap* self, DBApply func, va_list args) node->deleted = 1; } DB_COUNTSTAT(db_node_free); - ers_free(db->nodes, node); if (parent) { if (parent->left == node) parent->left = NULL; else parent->right = NULL; } + ers_free(db->nodes, node); node = parent; } db->ht[i] = NULL; diff --git a/src/map/clif.c b/src/map/clif.c index c5796555a..b640780a9 100644 --- a/src/map/clif.c +++ b/src/map/clif.c @@ -9562,9 +9562,11 @@ void clif_parse_NpcBuyListSend(int fd, struct map_session_data* sd) WFIFOSET(fd,packet_len(0xca)); } -/*========================================== - * - *------------------------------------------*/ +/// Request to sell chosen items to npc shop +/// R 00c9 <packet len>.W {<index>.W <amount>.W}.4B* +/// S 00cb <result>.B +/// result = 00 -> "The deal has successfully completed." +/// result = 01 -> "The deal has failed." void clif_parse_NpcSellListSend(int fd,struct map_session_data *sd) { int fail=0,n; @@ -11674,7 +11676,7 @@ void clif_parse_GMReqAccountName(int fd, struct map_session_data *sd) * S 0198 <x>.W <y>.W <gat>.W *------------------------------------------*/ void clif_parse_GMChangeMapType(int fd, struct map_session_data *sd) -{// FIXME: type sent by client is 0 or 1 (even if you enter 2+); that suggests, that it is walkable gat attribute +{ int x,y,type; if( battle_config.atc_gmonly && !pc_isGM(sd) ) @@ -13139,6 +13141,31 @@ void clif_cashshop_show(struct map_session_data *sd, struct npc_data *nd) WFIFOSET(fd,WFIFOW(fd,2)); } +/// Cashshop Buy Ack (ZC_PC_CASH_POINT_UPDATE) +/// S 0289 <cash point>.L <kafra point>.L <error>.W +/// +/// @param error +/// 0: The deal has successfully completed. (ERROR_TYPE_NONE) +/// 1: The Purchase has failed because the NPC does not exist. (ERROR_TYPE_NPC) +/// 2: The Purchase has failed because the Kafra Shop System is not working correctly. (ERROR_TYPE_SYSTEM) +/// 3: You are over your Weight Limit. (ERROR_TYPE_INVENTORY_WEIGHT) +/// 4: You cannot purchase items while you are in a trade. (ERROR_TYPE_EXCHANGE) +/// 5: The Purchase has failed because the Item Information was incorrect. (ERROR_TYPE_ITEM_ID) +/// 6: You do not have enough Kafra Credit Points. (ERROR_TYPE_MONEY) +/// 7: You can purchase up to 10 items. +/// 8: Some items could not be purchased. +void clif_cashshop_ack(struct map_session_data* sd, int error) +{ + int fd = sd->fd; + + WFIFOHEAD(fd, packet_len(0x289)); + WFIFOW(fd,0) = 0x289; + WFIFOL(fd,2) = sd->cashPoints; + WFIFOL(fd,6) = sd->kafraPoints; + WFIFOW(fd,10) = TOW(error); + WFIFOSET(fd, packet_len(0x289)); +} + void clif_parse_cashshop_buy(int fd, struct map_session_data *sd) { int fail = 0, amount, points; @@ -13154,12 +13181,7 @@ void clif_parse_cashshop_buy(int fd, struct map_session_data *sd) else fail = npc_cashshop_buy(sd, nameid, amount, points); - WFIFOHEAD(fd,12); - WFIFOW(fd,0) = 0x289; - WFIFOL(fd,2) = sd->cashPoints; - WFIFOL(fd,6) = sd->kafraPoints; - WFIFOW(fd,10) = fail; - WFIFOSET(fd,12); + clif_cashshop_ack(sd, fail); } /*========================================== diff --git a/src/map/map.c b/src/map/map.c index b052cd7bc..f10c92f32 100644 --- a/src/map/map.c +++ b/src/map/map.c @@ -3412,9 +3412,14 @@ void do_final(void) ShowStatus("Terminating...\n"); + // remove all objects on maps for (i = 0; i < map_num; i++) + { + ShowStatus("Cleaning up maps [%d/%d]: %s..."CL_CLL"\r", i+1, map_num, map[i].name); if (map[i].m >= 0) map_foreachinmap(cleanup_sub, i, BL_ALL); + } + ShowStatus("Cleaned up %d maps."CL_CLL"\n", map_num); //Scan any remaining players (between maps?) to kick them out. [Skotlex] iter = mapit_getallusers(); diff --git a/src/map/pc.c b/src/map/pc.c index bb703a208..42f8b07c8 100644 --- a/src/map/pc.c +++ b/src/map/pc.c @@ -3210,6 +3210,7 @@ int pc_checkadditem(struct map_session_data *sd,int nameid,int amount) return ADDITEM_NEW; for(i=0;i<MAX_INVENTORY;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(sd->status.inventory[i].amount+amount > MAX_AMOUNT) return ADDITEM_OVERAMOUNT; diff --git a/src/map/script.c b/src/map/script.c index 59a9b5448..516bcee5a 100644 --- a/src/map/script.c +++ b/src/map/script.c @@ -6191,7 +6191,7 @@ BUILDIN_FUNC(readparam) if( script_hasdata(st,3) ) sd=map_nick2sd(script_getstr(st,3)); else - sd=script_rid2sd(st); + sd=script_rid2sd(st); if(sd==NULL){ script_pushint(st,-1); |