Issue information

Issue ID
#4144
Status
Fixed
Severity
None
Started
Hercules Elf Bot
Mar 24, 2010 7:31
Last Post
Hercules Elf Bot
Mar 24, 2010 7:31
Confirmation
N/A

Hercules Elf Bot - Mar 24, 2010 7:31

Originally posted by [b]Kazukin[/b]
http://www.eathena.ws/board/index.php?autocom=bugtracker&showbug=4144

There is an issue when your character is 100%+ overweight (this situation arises, for example, when you do a stat reset) and you fail to mail an item (for whatever reason, it doesnt matter). The item, since you are 100%+ overweight cannot be placed back in your inventory, but there is not a condition on mail_deliveryfail() to handle this, so the item gets deleted.

QUOTE
void mail_deliveryfail(struct map_session_data *sd, struct mail_message *msg)
{
+ int flag = 0;
+
nullpo_retv(sd);
nullpo_retv(msg);

// Item recieve (due to failure)
if(log_config.enable_logs&0x2000)
log_pick_pc(sd, "E", msg->item.nameid, msg->item.amount, &msg->item);

- pc_additem(sd, &msg->item, msg->item.amount);
+ if ((flag = pc_additem(sd, &msg->item, msg->item.amount)))
+ {
+ clif_additem(sd, 0, 0, flag);
+ if( pc_candrop(sd,&msg->item) )
+ map_addflooritem(&msg->item,msg->item.amount,sd->bl.m,sd->bl.x,sd->bl.y,0,0,0,0);
+ }

if( msg->zeny > 0 )
{

Also, I would add a check on mail_setattachment() since having your items drop to the floor isn't pretty and this situation should only arise if something goes wrong (since it is not possible to get 100%+ overweight on officials, at least, I don't know any way to do so), so preventing you from sending mails in this situation doesn't seem a bad thing to do, but this is more of a side protection feature to prevent people from lossing items than anything else.
QUOTE
bool mail_setattachment(struct map_session_data *sd, struct mail_message *msg)
{
+ struct item_data *data;
+ unsigned int weight;
int n;

nullpo_retr(false,sd);
@@ -111,6 +113,13 @@
if( sd->mail.zeny < 0 || sd->mail.zeny > sd->status.zeny )
return false;

+ if ((data = itemdb_search(sd->mail.nameid)) == NULL)
+ return false;
+
+ weight = data->weight * sd->mail.amount;
+ if( sd->weight - weight > sd->max_weight )
+ return false;
+
n = sd->mail.index;
if( sd->mail.amount )
{

Finally, it may be smart to add a check on npc/custom/jobs/jobmaster.txt to prevent players from getting a 100%+ overweight High Novice who cannot use skills/nor attack/nor use storage/nor use mail (in case previous fix is applied or in case mail is not available) whose only hope would be to drop items to the floor or get leeched to be able to use storage. Something like:
QUOTE
if(Weight > 2150){
if(Weight > 0) {


This post has been edited by Kazukin: Mar 24 2010, 02:04 AM