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
This commit is contained in:
akinari1087 2013-06-13 15:31:35 +00:00
parent 0bb0640f33
commit c6018f4ef8
16 changed files with 49 additions and 14 deletions

View File

@ -316,7 +316,7 @@
295: Please enter an item name or ID (usage: @item <item name/ID> <quantity> <bound_type>). 295: Please enter an item name or ID (usage: @item <item name/ID> <quantity> <bound_type>).
296: Please enter all parameters (usage: @item2 <item name/ID> <quantity> 296: Please enter all parameters (usage: @item2 <item name/ID> <quantity>
297: <identify_flag> <refine> <attribute> <card1> <card2> <card3> <card4> <bound_type>). 297: <identify_flag> <refine> <attribute> <card1> <card2> <card3> <card4> <bound_type>).
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 // Guild Castles Number
// -------------------- // --------------------
//299: ?? Castles //299: ?? Castles

View File

@ -647,7 +647,7 @@ attribute: 0 = not broken, 1 = broken
@itembound <item name/ID> <amount> <bound_type> @itembound <item name/ID> <amount> <bound_type>
Creates the specified item and bounds it to the account. 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. 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 identify_flag: 0 = unidentified, 1 = identified
attribute: 0 = not broken, 1 = broken attribute: 0 = not broken, 1 = broken
bound_type: 1 = Account, 2 = Guild, 3 = Party bound_type: 1 = Account, 2 = Guild, 3 = Party, 4 = Character
--------------------------------------- ---------------------------------------

View File

@ -4268,6 +4268,7 @@ Bound Types:
1 - Account Bound 1 - Account Bound
2 - Guild Bound 2 - Guild Bound
3 - Party Bound 3 - Party Bound
4 - Character Bound
--------------------------------------- ---------------------------------------
@ -4288,6 +4289,7 @@ Bound Types:
1 - Account Bound 1 - Account Bound
2 - Guild Bound 2 - Guild Bound
3 - Party Bound 3 - Party Bound
4 - Character Bound
--------------------------------------- ---------------------------------------
@ -4442,6 +4444,7 @@ Available types are:
1 - Account Bound 1 - Account Bound
2 - Guild Bound 2 - Guild Bound
3 - Party Bound 3 - Party Bound
4 - Character Bound
Example: Example:
mes "[Bound Counter]"; mes "[Bound Counter]";

View File

@ -236,7 +236,7 @@ int mapif_parse_SaveGuildStorage(int fd)
mapif_save_guild_storage_ack(fd, RFIFOL(fd,4), guild_id, 1); mapif_save_guild_storage_ack(fd, RFIFOL(fd,4), guild_id, 1);
return 0; return 0;
} }
#ifdef BOUND_ITEMS
int mapif_itembound_ack(int fd, int aid, int guild_id) int mapif_itembound_ack(int fd, int aid, int guild_id)
{ {
WFIFOHEAD(fd,8); WFIFOHEAD(fd,8);
@ -357,6 +357,7 @@ int mapif_parse_itembound_retrieve(int fd)
mapif_itembound_ack(fd,aid,guild_id); mapif_itembound_ack(fd,aid,guild_id);
return 0; return 0;
} }
#endif
int inter_storage_parse_frommap(int fd) int inter_storage_parse_frommap(int fd)
{ {
@ -364,7 +365,9 @@ int inter_storage_parse_frommap(int fd)
switch(RFIFOW(fd,0)){ switch(RFIFOW(fd,0)){
case 0x3018: mapif_parse_LoadGuildStorage(fd); break; case 0x3018: mapif_parse_LoadGuildStorage(fd); break;
case 0x3019: mapif_parse_SaveGuildStorage(fd); break; case 0x3019: mapif_parse_SaveGuildStorage(fd); break;
#ifdef BOUND_ITEMS
case 0x3056: mapif_parse_itembound_retrieve(fd); break; case 0x3056: mapif_parse_itembound_retrieve(fd); break;
#endif
default: default:
return 0; return 0;
} }

View File

@ -52,6 +52,10 @@
/// By enabling it, the system will create an unique id for each new non stackable item created /// By enabling it, the system will create an unique id for each new non stackable item created
//#define NSI_UNIQUE_ID //#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 * No settings past this point
**/ **/

View File

@ -1211,7 +1211,7 @@ ACMD_FUNC(item2)
if (number <= 0) if (number <= 0)
number = 1; number = 1;
if( bound < 0 || bound > 3 ) { if( bound < 0 || bound > 4 ) {
clif_displaymessage(fd, msg_txt(sd,298)); // Invalid bound type clif_displaymessage(fd, msg_txt(sd,298)); // Invalid bound type
return -1; return -1;
} }

View File

@ -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) if(online_member_sd == NULL)
return 0; // noone online to inform return 0; // noone online to inform
#ifdef BOUND_ITEMS
//Guild bound item check //Guild bound item check
guild_retrieveitembound(char_id,account_id,guild_id); guild_retrieveitembound(char_id,account_id,guild_id);
#endif
if(!flag) if(!flag)
clif_guild_leave(online_member_sd, name, mes); 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; return 0;
} }
#ifdef BOUND_ITEMS
void guild_retrieveitembound(int char_id,int aid,int guild_id) void guild_retrieveitembound(int char_id,int aid,int guild_id)
{ {
TBL_PC *sd = map_id2sd(aid); 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); intif_itembound_req(char_id,aid,guild_id);
} }
} }
#endif
int guild_send_memberinfoshort(struct map_session_data *sd,int online) int guild_send_memberinfoshort(struct map_session_data *sd,int online)
{ // cleaned up [LuzZza] { // 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) int guild_break(struct map_session_data *sd,char *name)
{ {
struct guild *g; struct guild *g;
int i, j; int i;
#ifdef BOUND_ITEMS
int j;
int idxlist[MAX_INVENTORY]; int idxlist[MAX_INVENTORY];
#endif
nullpo_ret(sd); nullpo_ret(sd);
@ -1859,10 +1866,12 @@ int guild_break(struct map_session_data *sd,char *name)
return 0; return 0;
} }
#ifdef BOUND_ITEMS
//Guild bound item check - Removes the bound flag //Guild bound item check - Removes the bound flag
j = pc_bound_chk(sd,2,idxlist); j = pc_bound_chk(sd,2,idxlist);
for(i=0;i<j;i++) for(i=0;i<j;i++)
sd->status.inventory[idxlist[i]].bound = 0; sd->status.inventory[idxlist[i]].bound = 0;
#endif
intif_guild_break(g->guild_id); intif_guild_break(g->guild_id);
return 1; return 1;

View File

@ -106,7 +106,9 @@ void guild_flag_remove(struct npc_data *nd);
void guild_flags_clear(void); void guild_flags_clear(void);
void guild_guildaura_refresh(struct map_session_data *sd, uint16 skill_id, uint16 skill_lv); 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); void guild_retrieveitembound(int char_id,int aid,int guild_id);
#endif
void do_final_guild(void); void do_final_guild(void);

View File

@ -2173,7 +2173,7 @@ void intif_parse_MessageToFD(int fd) {
/*========================================== /*==========================================
* Item Bound System * Item Bound System
*------------------------------------------*/ *------------------------------------------*/
#ifdef BOUND_ITEMS
void intif_itembound_req(int char_id,int aid,int guild_id) { void intif_itembound_req(int char_id,int aid,int guild_id) {
struct guild_storage *gstor = guild2storage2(guild_id); struct guild_storage *gstor = guild2storage2(guild_id);
WFIFOHEAD(inter_fd,12); WFIFOHEAD(inter_fd,12);
@ -2194,6 +2194,7 @@ void intif_parse_itembound_ack(int fd) {
gstor = guild2storage2(guild_id); gstor = guild2storage2(guild_id);
if(gstor) gstor->lock = 0; //Unlock now that operation is completed if(gstor) gstor->lock = 0; //Unlock now that operation is completed
} }
#endif
//----------------------------------------------------------------- //-----------------------------------------------------------------
// Communication from the inter server // Communication from the inter server
@ -2279,7 +2280,9 @@ int intif_parse(int fd)
case 0x3855: intif_parse_Auction_bid(fd); break; case 0x3855: intif_parse_Auction_bid(fd); break;
//Bound items //Bound items
#ifdef BOUND_ITEMS
case 0x3856: intif_parse_itembound_ack(fd); break; case 0x3856: intif_parse_itembound_ack(fd); break;
#endif
// Mercenary System // Mercenary System
case 0x3870: intif_parse_mercenary_received(fd); break; case 0x3870: intif_parse_mercenary_received(fd); break;

View File

@ -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_emblem(int guild_id, int len, const char *data);
int intif_guild_castle_dataload(int num, int *castle_ids); int intif_guild_castle_dataload(int num, int *castle_ids);
int intif_guild_castle_datasave(int castle_id, int index, int value); 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); 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, 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); short pet_equip, short intimate, short hungry, char rename_flag, char incuvate, char *pet_name);

View File

@ -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 ) { 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 idxlist[MAX_INVENTORY]; //or malloc to reduce consumtion
int j,i; int j,i;
j = pc_bound_chk(sd,3,idxlist); j = pc_bound_chk(sd,3,idxlist);
for(i=0;i<j;i++) for(i=0;i<j;i++)
pc_delitem(sd,idxlist[i],sd->status.inventory[idxlist[i]].amount,0,1,LOG_TYPE_OTHER); pc_delitem(sd,idxlist[i],sd->status.inventory[idxlist[i]].amount,0,1,LOG_TYPE_OTHER);
#endif
sd->status.party_id = 0; sd->status.party_id = 0;
clif_charnameupdate(sd); //Update name display [Skotlex] clif_charnameupdate(sd); //Update name display [Skotlex]
//TODO: hp bars should be cleared too //TODO: hp bars should be cleared too

View File

@ -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) 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]; int idxlist[MAX_INVENTORY];
#endif
unsigned long tick = gettick(); unsigned long tick = gettick();
uint32 ip = session[sd->fd]->client_addr; 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); pc_itemcd_do(sd,true);
#ifdef BOUND_ITEMS
// Party bound item check // Party bound item check
if(sd->status.party_id == 0 && (j = pc_bound_chk(sd,3,idxlist))) { // Party was deleted while character offline if(sd->status.party_id == 0 && (j = pc_bound_chk(sd,3,idxlist))) { // Party was deleted while character offline
for(i=0;i<j;i++) for(i=0;i<j;i++)
pc_delitem(sd,idxlist[i],sd->status.inventory[idxlist[i]].amount,0,1,LOG_TYPE_OTHER); pc_delitem(sd,idxlist[i],sd->status.inventory[idxlist[i]].amount,0,1,LOG_TYPE_OTHER);
} }
#endif
// Request all registries (auth is considered completed whence they arrive) // Request all registries (auth is considered completed whence they arrive)
intif_request_registry(sd,7); 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; 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] { // Check item trade restrictions [Skotlex]
clif_displaymessage (sd->fd, msg_txt(sd,264)); clif_displaymessage (sd->fd, msg_txt(sd,264));
return 1; return 1;
@ -4590,6 +4595,7 @@ int pc_getitemfromcart(struct map_session_data *sd,int idx,int amount)
* 1 Account Bound * 1 Account Bound
* 2 Guild Bound * 2 Guild Bound
* 3 Party Bound * 3 Party Bound
* 4 Character Bound
*------------------------------------------*/ *------------------------------------------*/
int pc_bound_chk(TBL_PC *sd,int type,int *idxlist) int pc_bound_chk(TBL_PC *sd,int type,int *idxlist)
{ {

View File

@ -6260,6 +6260,7 @@ BUILDIN_FUNC(checkweight2){
* 1 - Account Bound * 1 - Account Bound
* 2 - Guild Bound * 2 - Guild Bound
* 3 - Party Bound * 3 - Party Bound
* 4 - Character Bound
*------------------------------------------*/ *------------------------------------------*/
BUILDIN_FUNC(getitem) BUILDIN_FUNC(getitem)
{ {
@ -6307,7 +6308,7 @@ BUILDIN_FUNC(getitem)
if( !strcmp(script_getfuncname(st),"getitembound") ) { if( !strcmp(script_getfuncname(st),"getitembound") ) {
char bound = script_getnum(st,4); 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); ShowError("script_getitembound: Not a correct bound type! Type=%d\n",bound);
return 1; return 1;
} }

View File

@ -4391,7 +4391,7 @@ int skill_castend_damage_id (struct block_list* src, struct block_list *bl, uint
swap(spheres[i],spheres[k]); 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); status_change_end(src, spheres[4], INVALID_TIMER);
j = 4; j = 4;
} }

View File

@ -155,7 +155,7 @@ static int storage_additem(struct map_session_data* sd, struct item* item_data,
return 1; 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)); clif_displaymessage(sd->fd, msg_txt(sd,294));
return 1; return 1;
} }
@ -454,7 +454,7 @@ int guild_storage_additem(struct map_session_data* sd, struct guild_storage* sto
return 1; 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)); clif_displaymessage(sd->fd, msg_txt(sd,294));
return 1; return 1;
} }

View File

@ -368,7 +368,7 @@ void trade_tradeadditem(struct map_session_data *sd, short index, short amount)
return; 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_displaymessage(sd->fd, msg_txt(sd,293));
clif_tradeitemok(sd, index+2, 1); clif_tradeitemok(sd, index+2, 1);
return; return;