iRO 21.12.2012 server merge

International

Moderator: Moderators

EternalHarvest
Developers
Developers
Posts: 1798
Joined: 05 Dec 2008, 05:42
Noob?: Yes

Re: iRO 21.12.2012 server merge

#41 Post by EternalHarvest »

Useless, repetitive and otherwise unrelated posts were split to http://forums.openkore.com/viewtopic.php?t=18563.
styuwono
Noob
Noob
Posts: 13
Joined: 23 Dec 2012, 04:54
Noob?: Yes

Re: iRO 21.12.2012 server merge

#42 Post by styuwono »

latest ServerType0.pm works for me, my inventory is back, but still can't auto open storage with "c r1 r0 n"
Works when I open storage manually but it gives

Packet Parser: Unknown switch: 0975
Packet Parser: Unknown switch: 0976

anyone can help?
Sorry for my bad english grammar.
support
Noob
Noob
Posts: 11
Joined: 21 Dec 2012, 05:07
Noob?: No

Re: iRO 21.12.2012 server merge

#43 Post by support »

Here's what I've got for cart. I'll do storage once I get back (need to go card shopping real quick...long live procrastination!)

Code: Select all

sub cart_items_nonstackable {
        my ($self, $args) = @_;

        my $newmsg;
        $self->decrypt(\$newmsg, substr($args->{RAW_MSG}, 4));
        my $msg = substr($args->{RAW_MSG}, 0, 4).$newmsg;

        my @itemKeys = $self->parse_items_nonstackable($args, substr $msg, 4);

        for my $item (@itemKeys) {
                my ($local_item, $add);

                $local_item = $cart{inventory}[$item->{index}] ||= Actor::Item->new;
                for (keys %$item) {
                        $local_item->{$_} = $item->{$_};
                }
                $local_item->{name} = itemName($local_item);
                $local_item->{amount} = 1;

                debug "Non-Stackable Cart Item: $local_item->{name} ($local_item->{index}) x 1\n", "parseMsg";
                Plugins::callHook('packet_cart', {index => $local_item->{index}});
        }

        $ai_v{'inventory_time'} = time + 1;
        $ai_v{'cart_time'} = time + 1;
}

sub cart_items_stackable {
        my ($self, $args) = @_;

        my $newmsg;
        $self->decrypt(\$newmsg, substr($args->{RAW_MSG}, 4));
        my $msg = substr($args->{RAW_MSG}, 0, 4).$newmsg;

        my @itemKeys = $self->parse_items_stackable($args, substr $msg, 4);

        for my $item (@itemKeys) {
                my ($local_item, $add);

                $local_item = $cart{inventory}[$item->{index}] ||= Actor::Item->new;
                if($local_item->{amount}) {
                        $local_item->{amount} += $item->{amount};
                } else {
                        for (keys %$item) {
                                $local_item->{$_} = $item->{$_};
                        }
                }
                $local_item->{name} = itemName($local_item);

                debug "Stackable Cart Item: $local_item->{name} ($local_item->{index}) x $local_item->{amount}\n", "parseMsg";
                Plugins::callHook('packet_cart', {index => $local_item->{index}});
        }
        $ai_v{'inventory_time'} = time + 1;
        $ai_v{'cart_time'} = time + 1;
}

Code: Select all

# Override this function if you need to.
sub items_nonstackable {
        my ($self, $args) = @_;

        my $items = $self->{nested}->{items_nonstackable};

        if($args->{switch} eq '00A4' || # inventory
           $args->{switch} eq '00A6' || # storage
           $args->{switch} eq '0122'    # cart
        ) {
                return $items->{type1};

        } elsif ($args->{switch} eq '0295' || # inventory
                 $args->{switch} eq '0296' || # storage
                 $args->{switch} eq '0297'    # cart
        ) {
                return $items->{type2};

        } elsif ($args->{switch} eq '02D0' || # inventory
                 $args->{switch} eq '02D1' || # storage
                 $args->{switch} eq '02D2'    # cart
        ) {
                return $items->{$rpackets{'00AA'} == 7 ? 'type3' : 'type4'};
        } elsif ($args->{switch} eq '0901' || # inventory
                 $args->{switch} eq '0903'    # cart
        ) {
                return $items->{type5};
        } else {
                warning "items_nonstackable: unsupported packet ($args->{switch})!\n";
        }
}

Code: Select all

# Override this function if you need to.
sub items_stackable {
        my ($self, $args) = @_;

        my $items = $self->{nested}->{items_stackable};

        if($args->{switch} eq '00A3' || # inventory
           $args->{switch} eq '00A5' || # storage
           $args->{switch} eq '0123'    # cart
        ) {
                return $items->{type1};

        } elsif ($args->{switch} eq '01EE' || # inventory
                 $args->{switch} eq '01F0' || # storage
                 $args->{switch} eq '01EF'    # cart
        ) {
                return $items->{type2};

        } elsif ($args->{switch} eq '02E8' || # inventory
                 $args->{switch} eq '02EA' || # storage
                 $args->{switch} eq '02E9'    # cart
        ) {
                return $items->{type3};

        } elsif ($args->{switch} eq '0900' || # inventory
                 $args->{switch} eq '0902'    #cart
        ) {
                return $items->{type5};

        } else {
                warning "items_stackable: unsupported packet ($args->{switch})!\n";
        }
}
You'll need to uncomment the packet from the packet_list at the top too to enable the cart parsing. Worked fine with the modified parsing Harvest just added. Wanted to clean it up (hope I did ok) since he did a good amount of rework on the inventory stuff (iteration).

(I think I pasted it all...)
guisanthor
Noob
Noob
Posts: 3
Joined: 26 Jul 2012, 08:28
Noob?: No

Re: iRO 21.12.2012 server merge

#44 Post by guisanthor »

styuwono wrote:latest ServerType0.pm works for me, my inventory is back, but still can't auto open storage with "c r1 r0 n"

Try these "storageAuto_npc_steps c r1 c r0 n".Good luck!
support
Noob
Noob
Posts: 11
Joined: 21 Dec 2012, 05:07
Noob?: No

Re: iRO 21.12.2012 server merge

#45 Post by support »

styuwono wrote:latest ServerType0.pm works for me, my inventory is back, but still can't auto open storage with "c r1 r0 n"
Works when I open storage manually but it gives

Packet Parser: Unknown switch: 0975
Packet Parser: Unknown switch: 0976

anyone can help?
Sorry for my bad english grammar.
The ServerType0.pm, assuming you're using one with Harvest's patch applied to it, has the new stackable and unstackable cart and storage packets commented out at the top, so the switch for 0975 and 0976 can't be found. That's why you're getting those unknown switch warnings.

Go into src/Network/Receive/ServerType0.pm and at the end of the packet_list at the top, uncomment the last several lines of it. That'll let it handle the parsing of them.
styuwono
Noob
Noob
Posts: 13
Joined: 23 Dec 2012, 04:54
Noob?: Yes

Re: iRO 21.12.2012 server merge

#46 Post by styuwono »

Storage auto is working with these:

storageAuto_npc_type 3
storageAuto_npc_steps c r1 r0 n


But still can't access cart items.
For Merchant class with cart got error like this when login

Packet Parser: Unknown switch: 0902
whosiwhatsit
Noob
Noob
Posts: 5
Joined: 21 Dec 2012, 03:59
Noob?: No

Re: iRO 21.12.2012 server merge

#47 Post by whosiwhatsit »

Ok eternal harvest's patch has '0903' => ['cart_items_stackable'] but then supports fixes has 0903 handled by items_nonstackable , shouldnt 0903 be handled by items_stackable if eternal harvest's partch is correct? I'm working on a rollup patch consisting of support's fixes and harvest's together (along with storage fixes) and I want to make sure I get all the packets right.
support
Noob
Noob
Posts: 11
Joined: 21 Dec 2012, 05:07
Noob?: No

Re: iRO 21.12.2012 server merge

#48 Post by support »

whosiwhatsit wrote:Ok eternal harvest's patch has '0903' => ['cart_items_stackable'] but then supports fixes has 0903 handled by items_nonstackable , shouldnt 0903 be handled by items_stackable if eternal harvest's partch is correct? I'm working on a rollup patch consisting of support's fixes and harvest's together (along with storage fixes) and I want to make sure I get all the packets right.
I just did some testing. I threw some OCAs in my cart and this is what I got when I printed the Stackable packet interprets:

Stackable Cart Item: switch = 0902, Old Card Album (2) x 200
...
Non-Stackable Cart Item: switch = 0903, Variant Shoes (7) x 1

Pretty sure 0903 is non-stackable.
whosiwhatsit
Noob
Noob
Posts: 5
Joined: 21 Dec 2012, 03:59
Noob?: No

Re: iRO 21.12.2012 server merge

#49 Post by whosiwhatsit »

support wrote:
whosiwhatsit wrote:Ok eternal harvest's patch has '0903' => ['cart_items_stackable'] but then supports fixes has 0903 handled by items_nonstackable , shouldnt 0903 be handled by items_stackable if eternal harvest's partch is correct? I'm working on a rollup patch consisting of support's fixes and harvest's together (along with storage fixes) and I want to make sure I get all the packets right.
I just did some testing. I threw some OCAs in my cart and this is what I got when I printed the Stackable packet interprets:

Stackable Cart Item: switch = 0902, Old Card Album (2) x 200
...
Non-Stackable Cart Item: switch = 0903, Variant Shoes (7) x 1

Pretty sure 0903 is non-stackable.
Well I'm not entirely certain how items_stackable and items_nonstackable need to be written to properly handle things, both 0975 and 0976 are ending up in items_nonstackable so.... not sure what to do there but I went ahead and rewrote sub storage_items_stackable and sub storage_items_nonstackable to use the new collections (is that the perl term for that?) setup

Code: Select all

sub storage_items_nonstackable {
        my ($self, $args) = @_;

        my $newmsg;
        $self->decrypt(\$newmsg, substr($args->{RAW_MSG}, 4));
        my $msg = substr($args->{RAW_MSG}, 0, 4).$newmsg;

        my @itemKeys = $self->parse_items_nonstackable($args, substr $msg, 4);

        for my $item (@itemKeys) {
                my ($local_item, $add);

                binAdd(\@storageID, $item->{index});
                $local_item = $storage{$item->{index}} ||= Actor::Item->new;

                for (keys %$item) {
                        $local_item->{$_} = $item->{$_};
                }
                $local_item->{name} = itemName($local_item);
                $local_item->{amount} = 1;
                $local_item->{binID} = binFind(\@storageID, $item->{index});

                debug "Storage: $local_item->{name} ($local_item->{binID})\n", "parseMsg";
        }
}

Code: Select all

sub storage_items_nonstackable {
        my ($self, $args) = @_;

        my $newmsg;
        $self->decrypt(\$newmsg, substr($args->{RAW_MSG}, 4));
        my $msg = substr($args->{RAW_MSG}, 0, 4).$newmsg;

        my @itemKeys = $self->parse_items_nonstackable($args, substr $msg, 4);

        for my $item (@itemKeys) {
                my ($local_item, $add);

                binAdd(\@storageID, $item->{index});
                $local_item = $storage{$item->{index}} ||= Actor::Item->new;

                for (keys %$item) {
                        $local_item->{$_} = $item->{$_};
                }
                $local_item->{name} = itemName($local_item);
                $local_item->{amount} = 1;
                $local_item->{binID} = binFind(\@storageID, $item->{index});

                debug "Storage: $local_item->{name} ($local_item->{binID})\n", "parseMsg";
        }
}
So hopefully as long as I did them right that's one step closer to getting everything back up.
handspoof
Plain Yogurt
Plain Yogurt
Posts: 59
Joined: 23 Dec 2012, 23:11
Noob?: Yes

Re: iRO 21.12.2012 server merge

#50 Post by handspoof »

styuwono wrote: May be this helps. I've done merging the file with the patch and my bot is now running smooth. Just place in

..\src\Network\Receive\
http://www.4shared.com/file/3bFCXoR8/ServerType0.html
new problem: you can't access character at all if you have more than 15 character in your account... Slot 16 and onward are not detected while my main char is on slot 17+ due to Valkyrie base server...

while I can access all characters before testing this file. I revert back to old version at this moment. Can someone show what the things that restore your character slot? The first problem is about how to restore character slot anyway...