summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authoreathenabot <eathenabot@54d463be-8e91-2dee-dedb-b68131a5f0ec>2012-01-17 06:44:35 +0000
committereathenabot <eathenabot@54d463be-8e91-2dee-dedb-b68131a5f0ec>2012-01-17 06:44:35 +0000
commitb965f8dd85d0b0ea5e3fb512fc7b81d5b0a5eeea (patch)
treee7ff5ed861ac7c6d660527d172b1731095d88128
parent98add4b57c4f0d4fdf21ec34ebfd3ea05c640fbf (diff)
downloadhercules-b965f8dd85d0b0ea5e3fb512fc7b81d5b0a5eeea.tar.gz
hercules-b965f8dd85d0b0ea5e3fb512fc7b81d5b0a5eeea.tar.bz2
hercules-b965f8dd85d0b0ea5e3fb512fc7b81d5b0a5eeea.tar.xz
hercules-b965f8dd85d0b0ea5e3fb512fc7b81d5b0a5eeea.zip
* Merged changes up to eAthena 15057.
git-svn-id: https://rathena.svn.sourceforge.net/svnroot/rathena/trunk@15475 54d463be-8e91-2dee-dedb-b68131a5f0ec
-rw-r--r--src/map/clif.c86
-rw-r--r--src/map/clif.h9
-rw-r--r--src/map/storage.c12
3 files changed, 43 insertions, 64 deletions
diff --git a/src/map/clif.c b/src/map/clif.c
index 83f5c8435..5e7635f40 100644
--- a/src/map/clif.c
+++ b/src/map/clif.c
@@ -3631,7 +3631,7 @@ void clif_tradecompleted(struct map_session_data* sd, int fail)
/*==========================================
* Server tells client it's quantity of items in storage changed
*------------------------------------------*/
-void clif_updatestorageamount(struct map_session_data* sd, int amount)
+void clif_updatestorageamount(struct map_session_data* sd, int amount, int max_amount)
{
int fd;
@@ -3641,7 +3641,7 @@ void clif_updatestorageamount(struct map_session_data* sd, int amount)
WFIFOHEAD(fd,packet_len(0xf2));
WFIFOW(fd,0) = 0xf2; // update storage amount
WFIFOW(fd,2) = amount; //items
- WFIFOW(fd,4) = MAX_STORAGE; //items max
+ WFIFOW(fd,4) = max_amount; //items max
WFIFOSET(fd,packet_len(0xf2));
}
@@ -3684,23 +3684,6 @@ void clif_storageitemadded(struct map_session_data* sd, struct item* i, int inde
}
/*==========================================
- *
- *------------------------------------------*/
-void clif_updateguildstorageamount(struct map_session_data* sd, int amount)
-{
- int fd;
-
- nullpo_retv(sd);
-
- fd=sd->fd;
- WFIFOHEAD(fd,packet_len(0xf2));
- WFIFOW(fd,0) = 0xf2; // update storage amount
- WFIFOW(fd,2) = amount; //items
- WFIFOW(fd,4) = MAX_GUILD_STORAGE; //items max
- WFIFOSET(fd,packet_len(0xf2));
-}
-
-/*==========================================
* Server tells client its status on his request to remove a item from storage
*------------------------------------------*/
void clif_storageitemremoved(struct map_session_data* sd, int index, int amount)
@@ -13978,61 +13961,58 @@ void clif_readbook(int fd, int book_id, int page)
/*------------------------------------------
* BattleGround Packets
*------------------------------------------*/
-int clif_bg_hp(struct map_session_data *sd)
+void clif_bg_hp(struct map_session_data *sd)
{
- unsigned char buf[16];
-#if PACKETVER < 20100126
- const int cmd = 0x106;
-#else
- const int cmd = 0x80e;
-#endif
+ unsigned char buf[34];
+ const int cmd = 0x2e0;
nullpo_ret(sd);
- WBUFW(buf,0)=cmd;
+ WBUFW(buf,0) = cmd;
WBUFL(buf,2) = sd->status.account_id;
-#if PACKETVER < 20100126
+ memcpy(WBUFP(buf,6), sd->status.name, NAME_LENGTH);
+
if( sd->battle_status.max_hp > INT16_MAX )
{ // To correctly display the %hp bar. [Skotlex]
- WBUFW(buf,6) = sd->battle_status.hp/(sd->battle_status.max_hp/100);
- WBUFW(buf,8) = 100;
+ WBUFW(buf,30) = sd->battle_status.hp/(sd->battle_status.max_hp/100);
+ WBUFW(buf,32) = 100;
}
else
{
- WBUFW(buf,6) = sd->battle_status.hp;
- WBUFW(buf,8) = sd->battle_status.max_hp;
+ WBUFW(buf,30) = sd->battle_status.hp;
+ WBUFW(buf,32) = sd->battle_status.max_hp;
}
-#else
- WBUFL(buf,6) = sd->battle_status.hp;
- WBUFL(buf,10) = sd->battle_status.max_hp;
-#endif
+
clif_send(buf, packet_len(cmd), &sd->bl, BG_AREA_WOS);
- return 0;
}
-int clif_bg_xy(struct map_session_data *sd)
+void clif_bg_xy(struct map_session_data *sd)
{
- unsigned char buf[10];
+ unsigned char buf[36];
nullpo_ret(sd);
- WBUFW(buf,0)=0x1eb;
+ WBUFW(buf,0)=0x2df;
WBUFL(buf,2)=sd->status.account_id;
- WBUFW(buf,6)=sd->bl.x;
- WBUFW(buf,8)=sd->bl.y;
- clif_send(buf, packet_len(0x1eb), &sd->bl, BG_SAMEMAP_WOS);
- return 0;
+ memcpy(WBUFP(buf,6), sd->status.name, NAME_LENGTH);
+ WBUFW(buf,30)=sd->status.class_;
+ WBUFW(buf,32)=sd->bl.x;
+ WBUFW(buf,34)=sd->bl.y;
+
+ clif_send(buf, packet_len(0x2df), &sd->bl, BG_SAMEMAP_WOS);
}
-int clif_bg_xy_remove(struct map_session_data *sd)
+void clif_bg_xy_remove(struct map_session_data *sd)
{
- unsigned char buf[10];
+ unsigned char buf[36];
nullpo_ret(sd);
- WBUFW(buf,0)=0x1eb;
+ WBUFW(buf,0)=0x2df;
WBUFL(buf,2)=sd->status.account_id;
- WBUFW(buf,6)=-1;
- WBUFW(buf,8)=-1;
- clif_send(buf,packet_len(0x1eb),&sd->bl,BG_SAMEMAP_WOS);
- return 0;
+ memset(WBUFP(buf,6), 0, NAME_LENGTH);
+ WBUFW(buf,30)=0;
+ WBUFW(buf,32)=-1;
+ WBUFW(buf,34)=-1;
+
+ clif_send(buf, packet_len(0x2df), &sd->bl, BG_SAMEMAP_WOS);
}
@@ -15336,8 +15316,8 @@ static int packetdb_readdb(void)
85, -1, -1,107, 6, -1, 7, 7, 22,191, 0, 0, 0, 0, 0, 0,
//#0x02C0
0, 0, 0, 0, 0, 30, 30, 0, 0, 3, 0, 65, 4, 71, 10, 0,
- 0, 0, 0, 0, 29, 0, 6, -1, 10, 10, 3, 0, -1, 32, 6, 0,
- 0, 33, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 67, 59, 60, 8,
+ 0, 0, 0, 0, 29, 0, 6, -1, 10, 10, 3, 0, -1, 32, 6, 36,
+ 34, 33, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 67, 59, 60, 8,
10, 2, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
//#0x0300
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
diff --git a/src/map/clif.h b/src/map/clif.h
index 29e870185..039a66116 100644
--- a/src/map/clif.h
+++ b/src/map/clif.h
@@ -396,11 +396,10 @@ void clif_tradecompleted(struct map_session_data* sd, int fail);
// storage
void clif_storagelist(struct map_session_data* sd, struct item* items, int items_length);
-void clif_updatestorageamount(struct map_session_data* sd, int amount);
+void clif_updatestorageamount(struct map_session_data* sd, int amount, int max_amount);
void clif_storageitemadded(struct map_session_data* sd, struct item* i, int index, int amount);
void clif_storageitemremoved(struct map_session_data* sd, int index, int amount);
void clif_storageclose(struct map_session_data* sd);
-void clif_updateguildstorageamount(struct map_session_data* sd, int amount);
int clif_insight(struct block_list *bl,va_list ap); // map_forallinmovearea callback
int clif_outsight(struct block_list *bl,va_list ap); // map_forallinmovearea callback
@@ -536,9 +535,9 @@ void clif_guild_xy_single(int fd, struct map_session_data *sd);
void clif_guild_xy_remove(struct map_session_data *sd);
// Battleground
-int clif_bg_hp(struct map_session_data *sd);
-int clif_bg_xy(struct map_session_data *sd);
-int clif_bg_xy_remove(struct map_session_data *sd);
+void clif_bg_hp(struct map_session_data *sd);
+void clif_bg_xy(struct map_session_data *sd);
+void clif_bg_xy_remove(struct map_session_data *sd);
void clif_bg_message(struct battleground_data *bg, int src_id, const char *name, const char *mes, int len);
void clif_bg_updatescore(int m);
void clif_bg_updatescore_single(struct map_session_data *sd);
diff --git a/src/map/storage.c b/src/map/storage.c
index a7aab8d79..f802dabe4 100644
--- a/src/map/storage.c
+++ b/src/map/storage.c
@@ -104,7 +104,7 @@ int storage_storageopen(struct map_session_data *sd)
sd->state.storage_flag = 1;
storage_sortitem(sd->status.storage.items, ARRAYLENGTH(sd->status.storage.items));
clif_storagelist(sd, sd->status.storage.items, ARRAYLENGTH(sd->status.storage.items));
- clif_updatestorageamount(sd,sd->status.storage.storage_amount);
+ clif_updatestorageamount(sd, sd->status.storage.storage_amount, MAX_STORAGE);
return 0;
}
@@ -169,7 +169,7 @@ static int storage_additem(struct map_session_data* sd, struct item* item_data,
stor->storage_amount++;
stor->items[i].amount = amount;
clif_storageitemadded(sd,&stor->items[i],i,amount);
- clif_updatestorageamount(sd,stor->storage_amount);
+ clif_updatestorageamount(sd, stor->storage_amount, MAX_STORAGE);
return 0;
}
@@ -187,7 +187,7 @@ int storage_delitem(struct map_session_data* sd, int n, int amount)
{
memset(&sd->status.storage.items[n],0,sizeof(sd->status.storage.items[0]));
sd->status.storage.storage_amount--;
- if( sd->state.storage_flag == 1 ) clif_updatestorageamount(sd,sd->status.storage.storage_amount);
+ if( sd->state.storage_flag == 1 ) clif_updatestorageamount(sd, sd->status.storage.storage_amount, MAX_STORAGE);
}
if( sd->state.storage_flag == 1 ) clif_storageitemremoved(sd,n,amount);
return 0;
@@ -373,7 +373,7 @@ int storage_guild_storageopen(struct map_session_data* sd)
sd->state.storage_flag = 2;
storage_sortitem(gstor->items, ARRAYLENGTH(gstor->items));
clif_storagelist(sd, gstor->items, ARRAYLENGTH(gstor->items));
- clif_updateguildstorageamount(sd,gstor->storage_amount);
+ clif_updatestorageamount(sd, gstor->storage_amount, MAX_GUILD_STORAGE);
return 0;
}
@@ -419,7 +419,7 @@ int guild_storage_additem(struct map_session_data* sd, struct guild_storage* sto
stor->items[i].amount=amount;
stor->storage_amount++;
clif_storageitemadded(sd,&stor->items[i],i,amount);
- clif_updateguildstorageamount(sd,stor->storage_amount);
+ clif_updatestorageamount(sd, stor->storage_amount, MAX_GUILD_STORAGE);
stor->dirty = 1;
return 0;
}
@@ -436,7 +436,7 @@ int guild_storage_delitem(struct map_session_data* sd, struct guild_storage* sto
if(stor->items[n].amount==0){
memset(&stor->items[n],0,sizeof(stor->items[0]));
stor->storage_amount--;
- clif_updateguildstorageamount(sd,stor->storage_amount);
+ clif_updatestorageamount(sd, stor->storage_amount, MAX_GUILD_STORAGE);
}
clif_storageitemremoved(sd,n,amount);
stor->dirty = 1;