Renamed 'storage_' to 'items' in the storage_data structure.
git-svn-id: https://svn.code.sf.net/p/rathena/svn/trunk@12933 54d463be-8e91-2dee-dedb-b68131a5f0ec
This commit is contained in:
parent
a35279667d
commit
bfd5397913
@ -35,12 +35,12 @@ int storage_tostr(char *str,struct storage_data *p)
|
|||||||
str_p += sprintf(str_p,"%d,%d\t",p->account_id,p->storage_amount);
|
str_p += sprintf(str_p,"%d,%d\t",p->account_id,p->storage_amount);
|
||||||
|
|
||||||
for(i=0;i<MAX_STORAGE;i++)
|
for(i=0;i<MAX_STORAGE;i++)
|
||||||
if( (p->storage_[i].nameid) && (p->storage_[i].amount) ){
|
if( (p->items[i].nameid) && (p->items[i].amount) ){
|
||||||
str_p += sprintf(str_p,"%d,%d,%d,%d,%d,%d,%d",
|
str_p += sprintf(str_p,"%d,%d,%d,%d,%d,%d,%d",
|
||||||
p->storage_[i].id,p->storage_[i].nameid,p->storage_[i].amount,p->storage_[i].equip,
|
p->items[i].id,p->items[i].nameid,p->items[i].amount,p->items[i].equip,
|
||||||
p->storage_[i].identify,p->storage_[i].refine,p->storage_[i].attribute);
|
p->items[i].identify,p->items[i].refine,p->items[i].attribute);
|
||||||
for(j=0; j<MAX_SLOTS; j++)
|
for(j=0; j<MAX_SLOTS; j++)
|
||||||
str_p += sprintf(str_p,",%d",p->storage_[i].card[j]);
|
str_p += sprintf(str_p,",%d",p->items[i].card[j]);
|
||||||
str_p += sprintf(str_p," ");
|
str_p += sprintf(str_p," ");
|
||||||
f++;
|
f++;
|
||||||
}
|
}
|
||||||
@ -72,16 +72,16 @@ int storage_fromstr(char *str,struct storage_data *p)
|
|||||||
if(sscanf(str + next, "%d,%d,%d,%d,%d,%d,%d%[0-9,-]%n",
|
if(sscanf(str + next, "%d,%d,%d,%d,%d,%d,%d%[0-9,-]%n",
|
||||||
&tmp_int[0], &tmp_int[1], &tmp_int[2], &tmp_int[3],
|
&tmp_int[0], &tmp_int[1], &tmp_int[2], &tmp_int[3],
|
||||||
&tmp_int[4], &tmp_int[5], &tmp_int[6], tmp_str, &len) == 8) {
|
&tmp_int[4], &tmp_int[5], &tmp_int[6], tmp_str, &len) == 8) {
|
||||||
p->storage_[i].id = tmp_int[0];
|
p->items[i].id = tmp_int[0];
|
||||||
p->storage_[i].nameid = tmp_int[1];
|
p->items[i].nameid = tmp_int[1];
|
||||||
p->storage_[i].amount = tmp_int[2];
|
p->items[i].amount = tmp_int[2];
|
||||||
p->storage_[i].equip = tmp_int[3];
|
p->items[i].equip = tmp_int[3];
|
||||||
p->storage_[i].identify = tmp_int[4];
|
p->items[i].identify = tmp_int[4];
|
||||||
p->storage_[i].refine = tmp_int[5];
|
p->items[i].refine = tmp_int[5];
|
||||||
p->storage_[i].attribute = tmp_int[6];
|
p->items[i].attribute = tmp_int[6];
|
||||||
|
|
||||||
for(j = 0; j < MAX_SLOTS && tmp_str && sscanf(tmp_str, ",%d%[0-9,-]",&tmp_int[0], tmp_str) > 0; j++)
|
for(j = 0; j < MAX_SLOTS && tmp_str && sscanf(tmp_str, ",%d%[0-9,-]",&tmp_int[0], tmp_str) > 0; j++)
|
||||||
p->storage_[i].card[j] = tmp_int[0];
|
p->items[i].card[j] = tmp_int[0];
|
||||||
|
|
||||||
next += len;
|
next += len;
|
||||||
if (str[next] == ' ')
|
if (str[next] == ' ')
|
||||||
@ -323,8 +323,8 @@ int inter_storage_delete(int account_id)
|
|||||||
if(s) {
|
if(s) {
|
||||||
int i;
|
int i;
|
||||||
for(i=0;i<s->storage_amount;i++){
|
for(i=0;i<s->storage_amount;i++){
|
||||||
if(s->storage_[i].card[0] == (short)0xff00)
|
if(s->items[i].card[0] == (short)0xff00)
|
||||||
inter_pet_delete( MakeDWord(s->storage_[i].card[1],s->storage_[i].card[2]) );
|
inter_pet_delete( MakeDWord(s->items[i].card[1],s->items[i].card[2]) );
|
||||||
}
|
}
|
||||||
idb_remove(storage_db,account_id);
|
idb_remove(storage_db,account_id);
|
||||||
}
|
}
|
||||||
|
@ -20,7 +20,7 @@
|
|||||||
/// Save guild_storage data to sql
|
/// Save guild_storage data to sql
|
||||||
int storage_tosql(int account_id, struct storage_data* p)
|
int storage_tosql(int account_id, struct storage_data* p)
|
||||||
{
|
{
|
||||||
memitemdata_to_sql(p->storage_, MAX_STORAGE, account_id, TABLE_STORAGE);
|
memitemdata_to_sql(p->items, MAX_STORAGE, account_id, TABLE_STORAGE);
|
||||||
//ShowInfo ("storage save to DB - account: %d\n", account_id);
|
//ShowInfo ("storage save to DB - account: %d\n", account_id);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
@ -53,7 +53,7 @@ int storage_fromsql(int account_id, struct storage_data* p)
|
|||||||
|
|
||||||
for( i = 0; i < MAX_STORAGE && SQL_SUCCESS == Sql_NextRow(sql_handle); ++i )
|
for( i = 0; i < MAX_STORAGE && SQL_SUCCESS == Sql_NextRow(sql_handle); ++i )
|
||||||
{
|
{
|
||||||
item = &p->storage_[i];
|
item = &p->items[i];
|
||||||
Sql_GetData(sql_handle, 0, &data, NULL); item->id = atoi(data);
|
Sql_GetData(sql_handle, 0, &data, NULL); item->id = atoi(data);
|
||||||
Sql_GetData(sql_handle, 1, &data, NULL); item->nameid = atoi(data);
|
Sql_GetData(sql_handle, 1, &data, NULL); item->nameid = atoi(data);
|
||||||
Sql_GetData(sql_handle, 2, &data, NULL); item->amount = atoi(data);
|
Sql_GetData(sql_handle, 2, &data, NULL); item->amount = atoi(data);
|
||||||
|
@ -334,7 +334,7 @@ struct storage_data {
|
|||||||
int account_id;
|
int account_id;
|
||||||
short storage_status;
|
short storage_status;
|
||||||
short storage_amount;
|
short storage_amount;
|
||||||
struct item storage_[MAX_STORAGE];
|
struct item items[MAX_STORAGE];
|
||||||
};
|
};
|
||||||
|
|
||||||
struct guild_storage {
|
struct guild_storage {
|
||||||
|
@ -638,23 +638,23 @@ int charcommand_storagelist(const int fd, struct map_session_data* sd, const cha
|
|||||||
counter = 0;
|
counter = 0;
|
||||||
count = 0;
|
count = 0;
|
||||||
for (i = 0; i < MAX_STORAGE; i++) {
|
for (i = 0; i < MAX_STORAGE; i++) {
|
||||||
if (stor->storage_[i].nameid > 0 && (item_data = itemdb_search(stor->storage_[i].nameid)) != NULL) {
|
if (stor->items[i].nameid > 0 && (item_data = itemdb_search(stor->items[i].nameid)) != NULL) {
|
||||||
counter = counter + stor->storage_[i].amount;
|
counter = counter + stor->items[i].amount;
|
||||||
count++;
|
count++;
|
||||||
if (count == 1) {
|
if (count == 1) {
|
||||||
sprintf(output, "------ Storage items list of '%s' ------", pl_sd->status.name);
|
sprintf(output, "------ Storage items list of '%s' ------", pl_sd->status.name);
|
||||||
clif_displaymessage(fd, output);
|
clif_displaymessage(fd, output);
|
||||||
}
|
}
|
||||||
if (stor->storage_[i].refine)
|
if (stor->items[i].refine)
|
||||||
sprintf(output, "%d %s %+d (%s %+d, id: %d)", stor->storage_[i].amount, item_data->name, stor->storage_[i].refine, item_data->jname, stor->storage_[i].refine, stor->storage_[i].nameid);
|
sprintf(output, "%d %s %+d (%s %+d, id: %d)", stor->items[i].amount, item_data->name, stor->items[i].refine, item_data->jname, stor->items[i].refine, stor->items[i].nameid);
|
||||||
else
|
else
|
||||||
sprintf(output, "%d %s (%s, id: %d)", stor->storage_[i].amount, item_data->name, item_data->jname, stor->storage_[i].nameid);
|
sprintf(output, "%d %s (%s, id: %d)", stor->items[i].amount, item_data->name, item_data->jname, stor->items[i].nameid);
|
||||||
clif_displaymessage(fd, output);
|
clif_displaymessage(fd, output);
|
||||||
memset(output, '\0', sizeof(output));
|
memset(output, '\0', sizeof(output));
|
||||||
counter2 = 0;
|
counter2 = 0;
|
||||||
for (j = 0; j < item_data->slot; j++) {
|
for (j = 0; j < item_data->slot; j++) {
|
||||||
if (stor->storage_[i].card[j]) {
|
if (stor->items[i].card[j]) {
|
||||||
if ((item_temp = itemdb_search(stor->storage_[i].card[j])) != NULL) {
|
if ((item_temp = itemdb_search(stor->items[i].card[j])) != NULL) {
|
||||||
if (output[0] == '\0')
|
if (output[0] == '\0')
|
||||||
sprintf(outputtmp, " -> (card(s): #%d %s (%s), ", ++counter2, item_temp->name, item_temp->jname);
|
sprintf(outputtmp, " -> (card(s): #%d %s (%s), ", ++counter2, item_temp->name, item_temp->jname);
|
||||||
else
|
else
|
||||||
|
@ -1883,20 +1883,20 @@ void clif_storagelist(struct map_session_data *sd,struct storage_data *stor)
|
|||||||
buf = WFIFOP(fd,0);
|
buf = WFIFOP(fd,0);
|
||||||
|
|
||||||
for(i=0,n=0,ne=0;i<MAX_STORAGE;i++){
|
for(i=0,n=0,ne=0;i<MAX_STORAGE;i++){
|
||||||
if(stor->storage_[i].nameid<=0)
|
if(stor->items[i].nameid<=0)
|
||||||
continue;
|
continue;
|
||||||
id = itemdb_search(stor->storage_[i].nameid);
|
id = itemdb_search(stor->items[i].nameid);
|
||||||
if(!itemdb_isstackable2(id))
|
if(!itemdb_isstackable2(id))
|
||||||
{ //Equippable
|
{ //Equippable
|
||||||
WBUFW(bufe,ne*20+4)=i+1;
|
WBUFW(bufe,ne*20+4)=i+1;
|
||||||
clif_item_sub(bufe, ne*20+6, &stor->storage_[i], id, id->equip);
|
clif_item_sub(bufe, ne*20+6, &stor->items[i], id, id->equip);
|
||||||
clif_addcards(WBUFP(bufe, ne*20+16), &stor->storage_[i]);
|
clif_addcards(WBUFP(bufe, ne*20+16), &stor->items[i]);
|
||||||
ne++;
|
ne++;
|
||||||
} else { //Stackable
|
} else { //Stackable
|
||||||
WBUFW(buf,n*s+4)=i+1;
|
WBUFW(buf,n*s+4)=i+1;
|
||||||
clif_item_sub(buf, n*s+6, &stor->storage_[i], id,-1);
|
clif_item_sub(buf, n*s+6, &stor->items[i], id,-1);
|
||||||
#if PACKETVER >= 5
|
#if PACKETVER >= 5
|
||||||
clif_addcards(WBUFP(buf,n*s+14), &stor->storage_[i]);
|
clif_addcards(WBUFP(buf,n*s+14), &stor->items[i]);
|
||||||
#endif
|
#endif
|
||||||
n++;
|
n++;
|
||||||
}
|
}
|
||||||
@ -3217,29 +3217,29 @@ int clif_storageitemadded(struct map_session_data *sd,struct storage_data *stor,
|
|||||||
WFIFOW(fd,0) =0xf4; // Storage item added
|
WFIFOW(fd,0) =0xf4; // Storage item added
|
||||||
WFIFOW(fd,2) =index+1; // index
|
WFIFOW(fd,2) =index+1; // index
|
||||||
WFIFOL(fd,4) =amount; // amount
|
WFIFOL(fd,4) =amount; // amount
|
||||||
if((view = itemdb_viewid(stor->storage_[index].nameid)) > 0)
|
if((view = itemdb_viewid(stor->items[index].nameid)) > 0)
|
||||||
WFIFOW(fd,8) =view;
|
WFIFOW(fd,8) =view;
|
||||||
else
|
else
|
||||||
WFIFOW(fd,8) =stor->storage_[index].nameid; // id
|
WFIFOW(fd,8) =stor->items[index].nameid; // id
|
||||||
WFIFOB(fd,10)=stor->storage_[index].identify; //identify flag
|
WFIFOB(fd,10)=stor->storage_[index].identify; //identify flag
|
||||||
WFIFOB(fd,11)=stor->storage_[index].attribute; // attribute
|
WFIFOB(fd,11)=stor->storage_[index].attribute; // attribute
|
||||||
WFIFOB(fd,12)=stor->storage_[index].refine; //refine
|
WFIFOB(fd,12)=stor->storage_[index].refine; //refine
|
||||||
clif_addcards(WFIFOP(fd,13), &stor->storage_[index]);
|
clif_addcards(WFIFOP(fd,13), &stor->items[index]);
|
||||||
WFIFOSET(fd,packet_len(0xf4));
|
WFIFOSET(fd,packet_len(0xf4));
|
||||||
#else
|
#else
|
||||||
WFIFOHEAD(fd,packet_len(0x1c4));
|
WFIFOHEAD(fd,packet_len(0x1c4));
|
||||||
WFIFOW(fd,0) =0x1c4; // Storage item added
|
WFIFOW(fd,0) =0x1c4; // Storage item added
|
||||||
WFIFOW(fd,2) =index+1; // index
|
WFIFOW(fd,2) =index+1; // index
|
||||||
WFIFOL(fd,4) =amount; // amount
|
WFIFOL(fd,4) =amount; // amount
|
||||||
if((view = itemdb_viewid(stor->storage_[index].nameid)) > 0)
|
if((view = itemdb_viewid(stor->items[index].nameid)) > 0)
|
||||||
WFIFOW(fd,8) =view;
|
WFIFOW(fd,8) =view;
|
||||||
else
|
else
|
||||||
WFIFOW(fd,8) =stor->storage_[index].nameid; // id
|
WFIFOW(fd,8) =stor->items[index].nameid; // id
|
||||||
WFIFOB(fd,10)=itemdb_type(stor->storage_[index].nameid); //type
|
WFIFOB(fd,10)=itemdb_type(stor->items[index].nameid); //type
|
||||||
WFIFOB(fd,11)=stor->storage_[index].identify; //identify flag
|
WFIFOB(fd,11)=stor->items[index].identify; //identify flag
|
||||||
WFIFOB(fd,12)=stor->storage_[index].attribute; // attribute
|
WFIFOB(fd,12)=stor->items[index].attribute; // attribute
|
||||||
WFIFOB(fd,13)=stor->storage_[index].refine; //refine
|
WFIFOB(fd,13)=stor->items[index].refine; //refine
|
||||||
clif_addcards(WFIFOP(fd,14), &stor->storage_[index]);
|
clif_addcards(WFIFOP(fd,14), &stor->items[index]);
|
||||||
WFIFOSET(fd,packet_len(0x1c4));
|
WFIFOSET(fd,packet_len(0x1c4));
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
@ -47,7 +47,7 @@ int storage_comp_item(const void *_i1, const void *_i2)
|
|||||||
void storage_sortitem (struct storage_data *stor)
|
void storage_sortitem (struct storage_data *stor)
|
||||||
{
|
{
|
||||||
nullpo_retv(stor);
|
nullpo_retv(stor);
|
||||||
qsort(stor->storage_, MAX_STORAGE, sizeof(struct item), storage_comp_item);
|
qsort(stor->items, MAX_STORAGE, sizeof(struct item), storage_comp_item);
|
||||||
}
|
}
|
||||||
|
|
||||||
void storage_gsortitem (struct guild_storage* gstor)
|
void storage_gsortitem (struct guild_storage* gstor)
|
||||||
@ -193,10 +193,10 @@ static int storage_additem(struct map_session_data *sd,struct storage_data *stor
|
|||||||
|
|
||||||
if(itemdb_isstackable2(data)){ //Stackable
|
if(itemdb_isstackable2(data)){ //Stackable
|
||||||
for(i=0;i<MAX_STORAGE;i++){
|
for(i=0;i<MAX_STORAGE;i++){
|
||||||
if( compare_item (&stor->storage_[i], item_data)) {
|
if( compare_item (&stor->items[i], item_data)) {
|
||||||
if(amount > MAX_AMOUNT - stor->storage_[i].amount)
|
if(amount > MAX_AMOUNT - stor->items[i].amount)
|
||||||
return 1;
|
return 1;
|
||||||
stor->storage_[i].amount+=amount;
|
stor->items[i].amount+=amount;
|
||||||
clif_storageitemadded(sd,stor,i,amount);
|
clif_storageitemadded(sd,stor,i,amount);
|
||||||
stor->dirty = 1;
|
stor->dirty = 1;
|
||||||
if(log_config.enable_logs&0x800)
|
if(log_config.enable_logs&0x800)
|
||||||
@ -206,13 +206,13 @@ static int storage_additem(struct map_session_data *sd,struct storage_data *stor
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
//Add item
|
//Add item
|
||||||
for(i=0;i<MAX_STORAGE && stor->storage_[i].nameid;i++);
|
for(i=0;i<MAX_STORAGE && stor->items[i].nameid;i++);
|
||||||
|
|
||||||
if(i>=MAX_STORAGE)
|
if(i>=MAX_STORAGE)
|
||||||
return 1;
|
return 1;
|
||||||
|
|
||||||
memcpy(&stor->storage_[i],item_data,sizeof(stor->storage_[0]));
|
memcpy(&stor->items[i],item_data,sizeof(stor->items[0]));
|
||||||
stor->storage_[i].amount=amount;
|
stor->items[i].amount=amount;
|
||||||
stor->storage_amount++;
|
stor->storage_amount++;
|
||||||
clif_storageitemadded(sd,stor,i,amount);
|
clif_storageitemadded(sd,stor,i,amount);
|
||||||
clif_updatestorageamount(sd,stor);
|
clif_updatestorageamount(sd,stor);
|
||||||
@ -227,14 +227,14 @@ static int storage_additem(struct map_session_data *sd,struct storage_data *stor
|
|||||||
static int storage_delitem(struct map_session_data *sd,struct storage_data *stor,int n,int amount)
|
static int storage_delitem(struct map_session_data *sd,struct storage_data *stor,int n,int amount)
|
||||||
{
|
{
|
||||||
|
|
||||||
if(stor->storage_[n].nameid==0 || stor->storage_[n].amount<amount)
|
if(stor->items[n].nameid==0 || stor->items[n].amount<amount)
|
||||||
return 1;
|
return 1;
|
||||||
|
|
||||||
stor->storage_[n].amount-=amount;
|
stor->items[n].amount-=amount;
|
||||||
if(log_config.enable_logs&0x800)
|
if(log_config.enable_logs&0x800)
|
||||||
log_pick_pc(sd, "R", stor->storage_[n].nameid, amount, &stor->storage_[n]);
|
log_pick_pc(sd, "R", stor->items[n].nameid, amount, &stor->items[n]);
|
||||||
if(stor->storage_[n].amount==0){
|
if(stor->items[n].amount==0){
|
||||||
memset(&stor->storage_[n],0,sizeof(stor->storage_[0]));
|
memset(&stor->items[n],0,sizeof(stor->items[0]));
|
||||||
stor->storage_amount--;
|
stor->storage_amount--;
|
||||||
clif_updatestorageamount(sd,stor);
|
clif_updatestorageamount(sd,stor);
|
||||||
}
|
}
|
||||||
@ -288,13 +288,13 @@ int storage_storageget(struct map_session_data *sd,int index,int amount)
|
|||||||
if(index<0 || index>=MAX_STORAGE)
|
if(index<0 || index>=MAX_STORAGE)
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
if(stor->storage_[index].nameid <= 0)
|
if(stor->items[index].nameid <= 0)
|
||||||
return 0; //Nothing there
|
return 0; //Nothing there
|
||||||
|
|
||||||
if(amount < 1 || amount > stor->storage_[index].amount)
|
if(amount < 1 || amount > stor->items[index].amount)
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
if((flag = pc_additem(sd,&stor->storage_[index],amount)) == 0)
|
if((flag = pc_additem(sd,&stor->items[index],amount)) == 0)
|
||||||
storage_delitem(sd,stor,index,amount);
|
storage_delitem(sd,stor,index,amount);
|
||||||
else
|
else
|
||||||
clif_additem(sd,0,0,flag);
|
clif_additem(sd,0,0,flag);
|
||||||
@ -345,13 +345,13 @@ int storage_storagegettocart(struct map_session_data *sd,int index,int amount)
|
|||||||
if(index< 0 || index>=MAX_STORAGE)
|
if(index< 0 || index>=MAX_STORAGE)
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
if(stor->storage_[index].nameid <= 0)
|
if(stor->items[index].nameid <= 0)
|
||||||
return 0; //Nothing there.
|
return 0; //Nothing there.
|
||||||
|
|
||||||
if(amount < 1 || amount > stor->storage_[index].amount)
|
if(amount < 1 || amount > stor->items[index].amount)
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
if(pc_cart_additem(sd,&stor->storage_[index],amount)==0)
|
if(pc_cart_additem(sd,&stor->items[index],amount)==0)
|
||||||
storage_delitem(sd,stor,index,amount);
|
storage_delitem(sd,stor,index,amount);
|
||||||
|
|
||||||
return 1;
|
return 1;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user