From c6018f4ef8a0bb80b2734e14467be9bd928bdcd1 Mon Sep 17 00:00:00 2001 From: akinari1087 Date: Thu, 13 Jun 2013 15:31:35 +0000 Subject: [PATCH] Added configuration option BOUND_ITEMS in core.h to disable Guild/Party bound items system Added Character Bound item option suggestion - Updated documentation on changes git-svn-id: https://svn.code.sf.net/p/rathena/svn/trunk@17361 54d463be-8e91-2dee-dedb-b68131a5f0ec --- conf/msg_conf/map_msg.conf | 2 +- doc/atcommands.txt | 4 ++-- doc/script_commands.txt | 3 +++ src/char/int_storage.c | 5 ++++- src/config/core.h | 4 ++++ src/map/atcommand.c | 2 +- src/map/guild.c | 11 ++++++++++- src/map/guild.h | 2 ++ src/map/intif.c | 5 ++++- src/map/intif.h | 2 ++ src/map/party.c | 2 ++ src/map/pc.c | 10 ++++++++-- src/map/script.c | 3 ++- src/map/skill.c | 2 +- src/map/storage.c | 4 ++-- src/map/trade.c | 2 +- 16 files changed, 49 insertions(+), 14 deletions(-) diff --git a/conf/msg_conf/map_msg.conf b/conf/msg_conf/map_msg.conf index 822d6daa61..e1a3c448e8 100644 --- a/conf/msg_conf/map_msg.conf +++ b/conf/msg_conf/map_msg.conf @@ -316,7 +316,7 @@ 295: Please enter an item name or ID (usage: @item ). 296: Please enter all parameters (usage: @item2 297: ). -298: Invalid bound type. Valid types are - 1:Account 2:Guild 3:Party +298: Invalid bound type. Valid types are - 1:Account 2:Guild 3:Party 4:Character // Guild Castles Number // -------------------- //299: ?? Castles diff --git a/doc/atcommands.txt b/doc/atcommands.txt index 64f5ac837f..b8c8821f6a 100644 --- a/doc/atcommands.txt +++ b/doc/atcommands.txt @@ -647,7 +647,7 @@ attribute: 0 = not broken, 1 = broken @itembound Creates the specified item and bounds it to the account. -bound_type: 1 = Account, 2 = Guild, 3 = Party +bound_type: 1 = Account, 2 = Guild, 3 = Party, 4 = Character --------------------------------------- @@ -656,7 +656,7 @@ bound_type: 1 = Account, 2 = Guild, 3 = Party Creates an item with the given parameters (the 'cards' can be any item) and bounds it to the account. identify_flag: 0 = unidentified, 1 = identified attribute: 0 = not broken, 1 = broken -bound_type: 1 = Account, 2 = Guild, 3 = Party +bound_type: 1 = Account, 2 = Guild, 3 = Party, 4 = Character --------------------------------------- diff --git a/doc/script_commands.txt b/doc/script_commands.txt index a221211b41..a594b55338 100644 --- a/doc/script_commands.txt +++ b/doc/script_commands.txt @@ -4268,6 +4268,7 @@ Bound Types: 1 - Account Bound 2 - Guild Bound 3 - Party Bound + 4 - Character Bound --------------------------------------- @@ -4288,6 +4289,7 @@ Bound Types: 1 - Account Bound 2 - Guild Bound 3 - Party Bound + 4 - Character Bound --------------------------------------- @@ -4442,6 +4444,7 @@ Available types are: 1 - Account Bound 2 - Guild Bound 3 - Party Bound + 4 - Character Bound Example: mes "[Bound Counter]"; diff --git a/src/char/int_storage.c b/src/char/int_storage.c index f3cb5bb14a..8058ede589 100644 --- a/src/char/int_storage.c +++ b/src/char/int_storage.c @@ -236,7 +236,7 @@ int mapif_parse_SaveGuildStorage(int fd) mapif_save_guild_storage_ack(fd, RFIFOL(fd,4), guild_id, 1); return 0; } - +#ifdef BOUND_ITEMS int mapif_itembound_ack(int fd, int aid, int guild_id) { WFIFOHEAD(fd,8); @@ -357,6 +357,7 @@ int mapif_parse_itembound_retrieve(int fd) mapif_itembound_ack(fd,aid,guild_id); return 0; } +#endif int inter_storage_parse_frommap(int fd) { @@ -364,7 +365,9 @@ int inter_storage_parse_frommap(int fd) switch(RFIFOW(fd,0)){ case 0x3018: mapif_parse_LoadGuildStorage(fd); break; case 0x3019: mapif_parse_SaveGuildStorage(fd); break; +#ifdef BOUND_ITEMS case 0x3056: mapif_parse_itembound_retrieve(fd); break; +#endif default: return 0; } diff --git a/src/config/core.h b/src/config/core.h index 1e8ce9992a..e17abf90b4 100644 --- a/src/config/core.h +++ b/src/config/core.h @@ -52,6 +52,10 @@ /// By enabling it, the system will create an unique id for each new non stackable item created //#define NSI_UNIQUE_ID +/// Comment to disable Guild/Party Bound item system +/// By default, we recover/remove Guild/Party Bound items automatically +#define BOUND_ITEMS + /** * No settings past this point **/ diff --git a/src/map/atcommand.c b/src/map/atcommand.c index b2524bdeab..29ae933f1c 100644 --- a/src/map/atcommand.c +++ b/src/map/atcommand.c @@ -1211,7 +1211,7 @@ ACMD_FUNC(item2) if (number <= 0) number = 1; - if( bound < 0 || bound > 3 ) { + if( bound < 0 || bound > 4 ) { clif_displaymessage(fd, msg_txt(sd,298)); // Invalid bound type return -1; } diff --git a/src/map/guild.c b/src/map/guild.c index 0d6892f19a..890fdbff38 100644 --- a/src/map/guild.c +++ b/src/map/guild.c @@ -860,8 +860,10 @@ int guild_member_withdraw(int guild_id, int account_id, int char_id, int flag, c if(online_member_sd == NULL) return 0; // noone online to inform +#ifdef BOUND_ITEMS //Guild bound item check guild_retrieveitembound(char_id,account_id,guild_id); +#endif if(!flag) clif_guild_leave(online_member_sd, name, mes); @@ -890,6 +892,7 @@ int guild_member_withdraw(int guild_id, int account_id, int char_id, int flag, c return 0; } +#ifdef BOUND_ITEMS void guild_retrieveitembound(int char_id,int aid,int guild_id) { TBL_PC *sd = map_id2sd(aid); @@ -922,6 +925,7 @@ void guild_retrieveitembound(int char_id,int aid,int guild_id) intif_itembound_req(char_id,aid,guild_id); } } +#endif int guild_send_memberinfoshort(struct map_session_data *sd,int online) { // cleaned up [LuzZza] @@ -1837,8 +1841,11 @@ int guild_gm_changed(int guild_id, int account_id, int char_id) int guild_break(struct map_session_data *sd,char *name) { struct guild *g; - int i, j; + int i; +#ifdef BOUND_ITEMS + int j; int idxlist[MAX_INVENTORY]; +#endif nullpo_ret(sd); @@ -1859,10 +1866,12 @@ int guild_break(struct map_session_data *sd,char *name) return 0; } +#ifdef BOUND_ITEMS //Guild bound item check - Removes the bound flag j = pc_bound_chk(sd,2,idxlist); for(i=0;istatus.inventory[idxlist[i]].bound = 0; +#endif intif_guild_break(g->guild_id); return 1; diff --git a/src/map/guild.h b/src/map/guild.h index 5306aac3ed..7eea1212d2 100644 --- a/src/map/guild.h +++ b/src/map/guild.h @@ -106,7 +106,9 @@ void guild_flag_remove(struct npc_data *nd); void guild_flags_clear(void); void guild_guildaura_refresh(struct map_session_data *sd, uint16 skill_id, uint16 skill_lv); +#ifdef BOUND_ITEMS void guild_retrieveitembound(int char_id,int aid,int guild_id); +#endif void do_final_guild(void); diff --git a/src/map/intif.c b/src/map/intif.c index 6b354a0096..dca1aee115 100644 --- a/src/map/intif.c +++ b/src/map/intif.c @@ -2173,7 +2173,7 @@ void intif_parse_MessageToFD(int fd) { /*========================================== * Item Bound System *------------------------------------------*/ - +#ifdef BOUND_ITEMS void intif_itembound_req(int char_id,int aid,int guild_id) { struct guild_storage *gstor = guild2storage2(guild_id); WFIFOHEAD(inter_fd,12); @@ -2194,6 +2194,7 @@ void intif_parse_itembound_ack(int fd) { gstor = guild2storage2(guild_id); if(gstor) gstor->lock = 0; //Unlock now that operation is completed } +#endif //----------------------------------------------------------------- // Communication from the inter server @@ -2279,7 +2280,9 @@ int intif_parse(int fd) case 0x3855: intif_parse_Auction_bid(fd); break; //Bound items +#ifdef BOUND_ITEMS case 0x3856: intif_parse_itembound_ack(fd); break; +#endif // Mercenary System case 0x3870: intif_parse_mercenary_received(fd); break; diff --git a/src/map/intif.h b/src/map/intif.h index 87888b50eb..848c92f668 100644 --- a/src/map/intif.h +++ b/src/map/intif.h @@ -61,7 +61,9 @@ int intif_guild_notice(int guild_id, const char *mes1, const char *mes2); int intif_guild_emblem(int guild_id, int len, const char *data); int intif_guild_castle_dataload(int num, int *castle_ids); int intif_guild_castle_datasave(int castle_id, int index, int value); +#ifdef GUILD_BOUND_ITEMS void intif_itembound_req(int char_id, int aid, int guild_id); +#endif int intif_create_pet(int account_id, int char_id, short pet_type, short pet_lv, short pet_egg_id, short pet_equip, short intimate, short hungry, char rename_flag, char incuvate, char *pet_name); diff --git a/src/map/party.c b/src/map/party.c index 12b912d3a7..7dfd44c282 100644 --- a/src/map/party.c +++ b/src/map/party.c @@ -565,11 +565,13 @@ int party_member_withdraw(int party_id, int account_id, int char_id) } if( sd && sd->status.party_id == party_id && sd->status.char_id == char_id ) { +#ifdef BOUND_ITEMS int idxlist[MAX_INVENTORY]; //or malloc to reduce consumtion int j,i; j = pc_bound_chk(sd,3,idxlist); for(i=0;istatus.inventory[idxlist[i]].amount,0,1,LOG_TYPE_OTHER); +#endif sd->status.party_id = 0; clif_charnameupdate(sd); //Update name display [Skotlex] //TODO: hp bars should be cleared too diff --git a/src/map/pc.c b/src/map/pc.c index d7653fd298..9a1249d7b9 100644 --- a/src/map/pc.c +++ b/src/map/pc.c @@ -922,8 +922,11 @@ int pc_isequip(struct map_session_data *sd,int n) *------------------------------------------*/ bool pc_authok(struct map_session_data *sd, int login_id2, time_t expiration_time, int group_id, struct mmo_charstatus *st, bool changing_mapservers) { - int i, j; + int i; +#ifdef BOUND_ITEMS + int j; int idxlist[MAX_INVENTORY]; +#endif unsigned long tick = gettick(); uint32 ip = session[sd->fd]->client_addr; @@ -1100,11 +1103,13 @@ bool pc_authok(struct map_session_data *sd, int login_id2, time_t expiration_tim **/ pc_itemcd_do(sd,true); +#ifdef BOUND_ITEMS // Party bound item check if(sd->status.party_id == 0 && (j = pc_bound_chk(sd,3,idxlist))) { // Party was deleted while character offline for(i=0;istatus.inventory[idxlist[i]].amount,0,1,LOG_TYPE_OTHER); } +#endif // Request all registries (auth is considered completed whence they arrive) intif_request_registry(sd,7); @@ -4436,7 +4441,7 @@ int pc_cart_additem(struct map_session_data *sd,struct item *item_data,int amoun return 1; } - if( !itemdb_cancartstore(item_data, pc_get_group_level(sd)) || ((item_data->bound == 2 || item_data->bound == 3) && !pc_can_give_bounded_items(sd))) + if( !itemdb_cancartstore(item_data, pc_get_group_level(sd)) || (item_data->bound > 1 && !pc_can_give_bounded_items(sd))) { // Check item trade restrictions [Skotlex] clif_displaymessage (sd->fd, msg_txt(sd,264)); return 1; @@ -4590,6 +4595,7 @@ int pc_getitemfromcart(struct map_session_data *sd,int idx,int amount) * 1 Account Bound * 2 Guild Bound * 3 Party Bound + * 4 Character Bound *------------------------------------------*/ int pc_bound_chk(TBL_PC *sd,int type,int *idxlist) { diff --git a/src/map/script.c b/src/map/script.c index e730df9ef9..ba709277d4 100644 --- a/src/map/script.c +++ b/src/map/script.c @@ -6260,6 +6260,7 @@ BUILDIN_FUNC(checkweight2){ * 1 - Account Bound * 2 - Guild Bound * 3 - Party Bound + * 4 - Character Bound *------------------------------------------*/ BUILDIN_FUNC(getitem) { @@ -6307,7 +6308,7 @@ BUILDIN_FUNC(getitem) if( !strcmp(script_getfuncname(st),"getitembound") ) { char bound = script_getnum(st,4); - if( bound < 1 || bound > 3) { //Not a correct bound type + if( bound < 1 || bound > 4) { //Not a correct bound type ShowError("script_getitembound: Not a correct bound type! Type=%d\n",bound); return 1; } diff --git a/src/map/skill.c b/src/map/skill.c index ee56050a95..496603ab83 100644 --- a/src/map/skill.c +++ b/src/map/skill.c @@ -4391,7 +4391,7 @@ int skill_castend_damage_id (struct block_list* src, struct block_list *bl, uint swap(spheres[i],spheres[k]); } - if(j == 5) { // If 5 spheres, remove last one and only do 4 actions + if(j == 5) { // If 5 spheres, remove last one and only do 4 actions (Official behavior) status_change_end(src, spheres[4], INVALID_TIMER); j = 4; } diff --git a/src/map/storage.c b/src/map/storage.c index 1dfccc6767..b3eb3ea11d 100644 --- a/src/map/storage.c +++ b/src/map/storage.c @@ -155,7 +155,7 @@ static int storage_additem(struct map_session_data* sd, struct item* item_data, return 1; } - if( (item_data->bound == 2 || item_data->bound == 3) && !pc_can_give_bounded_items(sd) ) { + if( (item_data->bound > 1) && !pc_can_give_bounded_items(sd) ) { clif_displaymessage(sd->fd, msg_txt(sd,294)); return 1; } @@ -454,7 +454,7 @@ int guild_storage_additem(struct map_session_data* sd, struct guild_storage* sto return 1; } - if( (item_data->bound == 1 || item_data->bound == 3) && !pc_can_give_bounded_items(sd) ) { + if( (item_data->bound == 1 || item_data->bound > 2) && !pc_can_give_bounded_items(sd) ) { clif_displaymessage(sd->fd, msg_txt(sd,294)); return 1; } diff --git a/src/map/trade.c b/src/map/trade.c index 7ea3761281..7346a3d7d9 100644 --- a/src/map/trade.c +++ b/src/map/trade.c @@ -368,7 +368,7 @@ void trade_tradeadditem(struct map_session_data *sd, short index, short amount) return; } - if( ((item->bound == 1 || item->bound == 3) || (item->bound == 2 && sd->status.guild_id != target_sd->status.guild_id)) && !pc_can_give_bounded_items(sd) ) { // Item Bound + if( ((item->bound == 1 || item->bound > 2) || (item->bound == 2 && sd->status.guild_id != target_sd->status.guild_id)) && !pc_can_give_bounded_items(sd) ) { // Item Bound clif_displaymessage(sd->fd, msg_txt(sd,293)); clif_tradeitemok(sd, index+2, 1); return;