Openkore.com

OpenKore Forums
It is currently 17 Feb 2020, 06:22

All times are UTC - 5 hours [ DST ]





Post new topic Reply to topic  [ 17 posts ]  Go to page 1, 2  Next
Author Message
 Post subject: ExperienceRO scratch pad
PostPosted: 08 Aug 2009, 12:57 
Offline
OpenKore Monk
OpenKore Monk

Joined: 04 Apr 2008, 10:10
Posts: 474
Code:
      String unpackString = "v2 x20 V4 v x22 x2 v x2 v x2 v2 x2 v2 x2 v x2 v x2 v4 Z24 C6 v x2";
      unpack(
            true,
            unpackString,
            charInfo,
            qw("header length charID exp zeny jobExp jobLevel hp maxHp sp maxSp jobId hairstyle level headLow headTop headMid hairColor clothesColor name str agi vit intel dex luk slot"));
   }

Difference with old 006B:
20 bytes skipped from length field to first charID
2 bytes skipped after hp
2 bytes skipped after maxHp

_________________
Got your topic trashed by a mod?

Trashing topics is one click, and moving a topic to its proper forum is a lot harder. You expend the least effort in deciding where to post, mods expend the least effort by trashing.

Have a nice day.


Top
 Profile  
 
 Post subject: Re: ExperienceRO scratch pad
PostPosted: 09 Aug 2009, 21:02 
Offline
OpenKore Monk
OpenKore Monk

Joined: 04 Apr 2008, 10:10
Posts: 474
Andy12345, if you're reading this, could you paste here the servers.txt entry for ExperienceRO? So I can test my patches too :)

_________________
Got your topic trashed by a mod?

Trashing topics is one click, and moving a topic to its proper forum is a lot harder. You expend the least effort in deciding where to post, mods expend the least effort by trashing.

Have a nice day.


Top
 Profile  
 
 Post subject: Re: ExperienceRO scratch pad
PostPosted: 10 Aug 2009, 01:55 
Offline
Moderators
Moderators

Joined: 04 Apr 2008, 10:21
Posts: 176
Location: In your dreams...
kali wrote:
Andy12345, if you're reading this, could you paste here the servers.txt entry for ExperienceRO? So I can test my patches too :)

Sure
Code:
[ExpRO]
ip 66.160.197.121
port 6900
version 20
master_version 16
serverType 8_4 #Already experimented with#
private 1
serverEncoding Western
charBlocksize 132  #this one to experimented with.#
recvpackets recvpackets.txt


Top
 Profile  
 
 Post subject: Re: ExperienceRO scratch pad
PostPosted: 10 Aug 2009, 02:27 
Offline
OpenKore Monk
OpenKore Monk

Joined: 04 Apr 2008, 10:10
Posts: 474
Note to self:
charBlockSize must be set to 112

_________________
Got your topic trashed by a mod?

Trashing topics is one click, and moving a topic to its proper forum is a lot harder. You expend the least effort in deciding where to post, mods expend the least effort by trashing.

Have a nice day.


Top
 Profile  
 
 Post subject: Re: ExperienceRO scratch pad
PostPosted: 10 Aug 2009, 03:06 
Offline
OpenKore Monk
OpenKore Monk

Joined: 04 Apr 2008, 10:10
Posts: 474
Andy, could you try patching this in as a test?
Code:
Index: Receive.pm
===================================================================
--- Receive.pm   (revision 6835)
+++ Receive.pm   (working copy)
@@ -4917,21 +4917,22 @@
   my $blockSize = $self->received_characters_blockSize();
   for (my $i = $args->{RAW_MSG_SIZE} % $blockSize; $i < $args->{RAW_MSG_SIZE}; $i += $blockSize) {
      #exp display bugfix - chobit andy 20030129
-      $num = unpack("C1", substr($args->{RAW_MSG}, $i + 104, 1));
+      $num = unpack("C1", substr($args->{RAW_MSG}, $i + 104+4, 1));
      $chars[$num] = new Actor::You;
      $chars[$num]{ID} = $accountID;
-      $chars[$num]{charID} = substr($args->{RAW_MSG}, $i, 4);
+      $chars[$num]{charID} = substr($args->{RAW_MSG}, $i-4, 4);
      $chars[$num]{nameID} = unpack("V", $chars[$num]{ID});
+        message $chars[$num]{nameID};
      $chars[$num]{exp} = unpack("V", substr($args->{RAW_MSG}, $i + 4, 4));
-      $chars[$num]{zenny} = unpack("V", substr($args->{RAW_MSG}, $i + 8, 4));
-      $chars[$num]{exp_job} = unpack("V", substr($args->{RAW_MSG}, $i + 12, 4));
-      $chars[$num]{lv_job} = unpack("v", substr($args->{RAW_MSG}, $i + 16, 2));
-      $chars[$num]{hp} = unpack("v", substr($args->{RAW_MSG}, $i + 42, 2));
-      $chars[$num]{hp_max} = unpack("v", substr($args->{RAW_MSG}, $i + 44, 2));
-      $chars[$num]{sp} = unpack("v", substr($args->{RAW_MSG}, $i + 46, 2));
-      $chars[$num]{sp_max} = unpack("v", substr($args->{RAW_MSG}, $i + 48, 2));
-      $chars[$num]{jobID} = unpack("v", substr($args->{RAW_MSG}, $i + 52, 2));
-      $chars[$num]{hair_style} = unpack("v", substr($args->{RAW_MSG}, $i + 54, 2));
+      $chars[$num]{zenny} = unpack("V", substr($args->{RAW_MSG}, $i + 8-4, 4));
+      $chars[$num]{exp_job} = unpack("V", substr($args->{RAW_MSG}, $i + 12-4, 4));
+      $chars[$num]{lv_job} = unpack("v", substr($args->{RAW_MSG}, $i + 16-4, 2));
+      $chars[$num]{hp} = unpack("V", substr($args->{RAW_MSG}, $i + 42, 2+2));
+      $chars[$num]{hp_max} = unpack("V", substr($args->{RAW_MSG}, $i + 44+2, 2+2));
+      $chars[$num]{sp} = unpack("v", substr($args->{RAW_MSG}, $i + 46+4, 2));
+      $chars[$num]{sp_max} = unpack("v", substr($args->{RAW_MSG}, $i + 48+4, 2));
+      $chars[$num]{jobID} = unpack("v", substr($args->{RAW_MSG}, $i + 52+4, 2));
+      $chars[$num]{hair_style} = unpack("v", substr($args->{RAW_MSG}, $i + 54+4, 2));
      $chars[$num]{lv} = unpack("v", substr($args->{RAW_MSG}, $i + 58, 2));
      $chars[$num]{headgear}{low} = unpack("v", substr($args->{RAW_MSG}, $i + 62, 2));
      $chars[$num]{headgear}{top} = unpack("v", substr($args->{RAW_MSG}, $i + 66, 2));

_________________
Got your topic trashed by a mod?

Trashing topics is one click, and moving a topic to its proper forum is a lot harder. You expend the least effort in deciding where to post, mods expend the least effort by trashing.

Have a nice day.


Top
 Profile  
 
 Post subject: Re: ExperienceRO scratch pad
PostPosted: 10 Aug 2009, 03:26 
Offline
Moderators
Moderators

Joined: 04 Apr 2008, 10:21
Posts: 176
Location: In your dreams...
Recv Packets got from the exe


Attachments:
File comment: From Packet extractor,
Experience RO recvpackets.txt

recvpackets.txt [8.21 KiB]
Downloaded 564 times
Top
 Profile  
 
 Post subject: Re: ExperienceRO scratch pad
PostPosted: 10 Aug 2009, 04:46 
Offline
Moderators
Moderators
User avatar

Joined: 04 Apr 2008, 09:30
Posts: 235
Location: My House
it's using RagnarokRenewal client ?

here's a sneaky eA code that could help ;p : https://opensvn.csie.org/traccgi/RE/changeset/21

_________________
Image
Follow The template in Asking Question or Be Trashed


Top
 Profile  
 
 Post subject: Re: ExperienceRO scratch pad
PostPosted: 10 Aug 2009, 05:39 
Offline
Administrator
Administrator
User avatar

Joined: 24 Apr 2008, 12:02
Posts: 1301
Please Commit us ServerType 8_6.
Don't forget the new packets 07xx that eA supports and we not.

Changes:
https://opensvn.csie.org/traccgi/RE/changeset/21

_________________
Join our Team. Click here.
Image


Image


Top
 Profile  
 
 Post subject: Re: ExperienceRO scratch pad
PostPosted: 10 Aug 2009, 05:54 
Offline
OpenKore Monk
OpenKore Monk

Joined: 04 Apr 2008, 10:10
Posts: 474
Does not work yet, it's just a workaround for the first character. I'll code a proper fix later (at least I know my parsing works).

_________________
Got your topic trashed by a mod?

Trashing topics is one click, and moving a topic to its proper forum is a lot harder. You expend the least effort in deciding where to post, mods expend the least effort by trashing.

Have a nice day.


Top
 Profile  
 
 Post subject: Re: ExperienceRO scratch pad
PostPosted: 10 Aug 2009, 22:19 
Offline
OpenKore Monk
OpenKore Monk

Joined: 04 Apr 2008, 10:10
Posts: 474
Here is the working patch (specific to ExperienceRO)
Code:
Index: src/Network/Receive.pm
===================================================================
--- src/Network/Receive.pm   (revision 6835)
+++ src/Network/Receive.pm   (working copy)
@@ -4914,38 +4914,45 @@
   }

   my $num;
-   my $blockSize = $self->received_characters_blockSize();
+   my $blockSize = 112;
+   #$self->received_characters_blockSize(); <-- doesn't work?
   for (my $i = $args->{RAW_MSG_SIZE} % $blockSize; $i < $args->{RAW_MSG_SIZE}; $i += $blockSize) {
      #exp display bugfix - chobit andy 20030129
-      $num = unpack("C1", substr($args->{RAW_MSG}, $i + 104, 1));
+        my $unpack_string = "V4 v x22 x2 v x2 v x2 v2 x2 v2 x2 v x2 v x2 v4 Z24 C6 v x2";
+      my ($cID,$exp,$zeny,$jobExp,$jobLevel,$hp,$maxHp,$sp,$maxSp,$jobId,
+          $hairstyle,$level,$headLow,$headTop,$headMid,$hairColor,
+          $clothesColor,$name,$str,$agi,$vit,$intel,$dex,$luk,$num) =
+          unpack($unpack_string, substr($args->{RAW_MSG}, $i));
+         
      $chars[$num] = new Actor::You;
      $chars[$num]{ID} = $accountID;
-      $chars[$num]{charID} = substr($args->{RAW_MSG}, $i, 4);
+      $chars[$num]{charID} = $cID;
+      $chars[$num]{exp} = $exp;
+      $chars[$num]{zenny} = $zeny;
+      $chars[$num]{exp_job} = $jobExp;
+      $chars[$num]{lv_job} = $jobLevel;
+      $chars[$num]{hp} = $hp;
+      $chars[$num]{hp_max} = $maxHp;
+      $chars[$num]{sp} = $sp;
+      $chars[$num]{sp_max} = $maxSp;
+      $chars[$num]{jobID} = $jobId;
+      $chars[$num]{hair_style} = $hairstyle;
+      $chars[$num]{lv} = $level;
+      $chars[$num]{headgear}{low} = $headLow;
+      $chars[$num]{headgear}{top} = $headTop;
+      $chars[$num]{headgear}{mid} = $headMid;
+      $chars[$num]{hair_color} = $hairColor;
+      $chars[$num]{clothes_color} = $clothesColor;
+      $chars[$num]{name} = $name;
+      $chars[$num]{str} = $str;
+      $chars[$num]{agi} = $agi;
+      $chars[$num]{vit} = $vit;
+      $chars[$num]{int} = $intel;
+      $chars[$num]{dex} = $dex;
+      $chars[$num]{luk} = $luk;
+      $chars[$num]{sex} = $accountSex2;
+
      $chars[$num]{nameID} = unpack("V", $chars[$num]{ID});
-      $chars[$num]{exp} = unpack("V", substr($args->{RAW_MSG}, $i + 4, 4));
-      $chars[$num]{zenny} = unpack("V", substr($args->{RAW_MSG}, $i + 8, 4));
-      $chars[$num]{exp_job} = unpack("V", substr($args->{RAW_MSG}, $i + 12, 4));
-      $chars[$num]{lv_job} = unpack("v", substr($args->{RAW_MSG}, $i + 16, 2));
-      $chars[$num]{hp} = unpack("v", substr($args->{RAW_MSG}, $i + 42, 2));
-      $chars[$num]{hp_max} = unpack("v", substr($args->{RAW_MSG}, $i + 44, 2));
-      $chars[$num]{sp} = unpack("v", substr($args->{RAW_MSG}, $i + 46, 2));
-      $chars[$num]{sp_max} = unpack("v", substr($args->{RAW_MSG}, $i + 48, 2));
-      $chars[$num]{jobID} = unpack("v", substr($args->{RAW_MSG}, $i + 52, 2));
-      $chars[$num]{hair_style} = unpack("v", substr($args->{RAW_MSG}, $i + 54, 2));
-      $chars[$num]{lv} = unpack("v", substr($args->{RAW_MSG}, $i + 58, 2));
-      $chars[$num]{headgear}{low} = unpack("v", substr($args->{RAW_MSG}, $i + 62, 2));
-      $chars[$num]{headgear}{top} = unpack("v", substr($args->{RAW_MSG}, $i + 66, 2));
-      $chars[$num]{headgear}{mid} = unpack("v", substr($args->{RAW_MSG}, $i + 68, 2));
-      $chars[$num]{hair_color} = unpack("v", substr($args->{RAW_MSG}, $i + 70, 2));
-      $chars[$num]{clothes_color} = unpack("v", substr($args->{RAW_MSG}, $i + 72, 2));
-      ($chars[$num]{name}) = unpack("Z*", substr($args->{RAW_MSG}, $i + 74, 24));
-      $chars[$num]{str} = unpack("C1", substr($args->{RAW_MSG}, $i + 98, 1));
-      $chars[$num]{agi} = unpack("C1", substr($args->{RAW_MSG}, $i + 99, 1));
-      $chars[$num]{vit} = unpack("C1", substr($args->{RAW_MSG}, $i + 100, 1));
-      $chars[$num]{int} = unpack("C1", substr($args->{RAW_MSG}, $i + 101, 1));
-      $chars[$num]{dex} = unpack("C1", substr($args->{RAW_MSG}, $i + 102, 1));
-      $chars[$num]{luk} = unpack("C1", substr($args->{RAW_MSG}, $i + 103, 1));
-      $chars[$num]{sex} = $accountSex2;
      $chars[$num]{name} = bytesToString($chars[$num]{name});
   }


I suggest we create a separate function to specify the unpack string, so that other servertypes can just override that instead of overriding the whole function. So for example (pseudo code):
Code:
sub received_characters_unpack_string {
    return "unpack string goes here";
}
sub received_characters {
    my $unpack_string = received_characters_unpack_string();
    my ($charID,$exp ...) = unpack($unpack_string, $raw_data);
}

Other servertypes will just override sub received_characters_unpack_string if they want to specify a different unpacking algorithm (just like with expro).

AFAIK this is the first time OpenKore will support a server with a unique character info packing. The previous one was a simple change of character block size, this time the change is more drastic. I suggest we adapt our code so it becomes more maintainable n the future in case Gravity decides to change this packing format.

This is also the reason why I am not yet creating a separate servertype for expro - I believe we first need to refactor the function involved before extending it; otherwise we'll be stuck with a tangled mess.

And btw, it seems that whatever I do to change the charBlockSize doesn't work. Changing it in servers.txt or in config.txt doesn't seem to stick (I checked with placing trace messages and logs). Maybe it's just me, but it seems that the function broke somehow, or the specific config.txt entryis not being loaded.

_________________
Got your topic trashed by a mod?

Trashing topics is one click, and moving a topic to its proper forum is a lot harder. You expend the least effort in deciding where to post, mods expend the least effort by trashing.

Have a nice day.


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 17 posts ]  Go to page 1, 2  Next

All times are UTC - 5 hours [ DST ]


Who is online

Users browsing this forum: No registered users and 1 guest


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group