Issue: autosell does not work properly on iRO Chaos.
This is a hack that Splizes on our IRC channel managed to conjure up to fix the autosell problem experienced on iRO Chaos since the 3-into-1 merge in late December 2012.
Inside: /src/Network/Receive/
Code: Select all
Index: ServerType0.pm
===================================================================
--- ServerType0.pm (revision 8356)
+++ ServerType0.pm (working copy)
@@ -3610,6 +3610,12 @@
for (my $i = 0; $i < length($args->{itemsdata}); $i += 10) {
my ($index, $price, $price_overcharge) = unpack("v L L", substr($args->{itemsdata},$i,($i + 10)));
my $item = $char->inventory->getByServerIndex($index);
+ #FIXME
+ #Dirty, Dirty Hack by Splizes visiting on #openkore Jan 2 2012:
+ if ($item->{amount} == 0) {
+ $item->{amount} = 1;
+ # why that would ever be zero from the server in the first place is beyond me
+ }
$item->{sellable} = 1; # flag this item as sellable
debug "[$item->{amount} x $item->{name}] for $price_overcharge z each. \n", "info";
}
/src/Network/Receive/ServerType0.pm (approximately line 3598 in r8356)
Code: Select all
sub npc_sell_list {
my ($self, $args) = @_;
#sell list, similar to buy list
if (length($args->{RAW_MSG}) > 4) {
my $newmsg;
$self->decrypt(\$newmsg, substr($args->{RAW_MSG}, 4));
my $msg = substr($args->{RAW_MSG}, 0, 4).$newmsg;
}
undef $talk{buyOrSell};
message T("Ready to start selling items\n");
debug "You can sell:\n", "info";
for (my $i = 0; $i < length($args->{itemsdata}); $i += 10) {
my ($index, $price, $price_overcharge) = unpack("v L L", substr($args->{itemsdata},$i,($i + 10)));
my $item = $char->inventory->getByServerIndex($index);
#FIXME
#Dirty, Dirty Hack by Splizes visiting on #openkore Jan 2 2012:
if ($item->{amount} == 0) {
$item->{amount} = 1;
# why that would ever be zero from the server in the first place is beyond me
}
$item->{sellable} = 1; # flag this item as sellable
debug "[$item->{amount} x $item->{name}] for $price_overcharge z each. \n", "info";
}
# continue talk sequence now
$ai_v{npc_talk}{time} = time;
}
Hope that gives other people a chance to test, to confirm a complete fix or not.
Test for multiple amounts being sold, that they're not converted into 1 item sold, etc., etc.
And, for devs, maybe this will help pinpoint the issue, so a more elegant fix can be applied.
Additional data from Splizes digging:
c9 00 08 00 15 00 00 00 - from kore
c9 00 08 00 15 00 01 00 - from iRO client