Jump to content

Haru

Administrators
  • Content Count

    382
  • Joined

  • Days Won

    38

Posts posted by Haru


  1. are you sure 2013-08-07 is supported? cu i just checked, wpe is useable even after setting packet obfuscation to 2.

     

    please help!!!

    Yes, the 2012-04 clients (and possibly a few others) have their keys chosen in such a way that makes the client effectively always use the same encryption key for each sent packet (thus allowing you to replay a packet as much as you want in WPE.)

     

    You can either use a newer client, or edit the keys yourself in both client (you'll have to hex-edit it) and server (edit the appropriate packetKeys line for your PACKETVER in src/map/packets.h and recompile.)

    The 2013-08-07 client falls into this category.

  2. There were reasons why signed was chosen instead of unsigned. Most operations we do with tick are tick differences, and that kind of operation with unsigned variables requires extra care that's not required with signed ones. There really isn't any benefit in using unsigned in most cases (especially if it's just to say that the variable should never be negative), and I strongly believe the only place where one should use unsigned is where the value isn't used as a plain number, but a bit field or similar. If the point about using unsigned is to allow larger values, well, the int64 overflow will happen about 292 million years from now. I believe that, whichever intelligent life forms will be alive by then, if any, will be able to use a different 'zero', or a larger variable.

     

    This article on the topic is an interesting read: http://www.soundsoftware.ac.uk/c-pitfall-unsigned


  3. Added:

      [*]Added support for automatic concatenation of adjacent string literals (09dd209)

      [*]Improved scripting operators precedence rules (ac6ae8c)

      [*]Added support for ++x / --x operators and changed the x++ / x-- operators to post-increment (9a802b9)

    (they were authored in September, but actually pushed in November, so they were accidentally skipped in the digest)


  4. item_db and item_db_re are automatically generated by the HerculesWS API bot. For item_db2 (or if you have edited your item_db for any reason), you can build your custom version with the db2sql plugin.

     

     

    (instructions for linux/unix; if you're on windows, YMMV)

     

    - Compile the db2sql plugin (make -C src/plugins db2sql)

    - Enable it in conf/plugins.conf

    - Run the map server with ./map-server --db2sql

    - You can find the updated files in the sql-files folder.


  5. This means your client is not using any obfuscation, because you (or someone for you, if you're not the one who hexed it), disabled it. This means you'll probably be able to connect to the server even if you have packet_obfuscation set to 0.

     

    Hercules doesn't currently have the encryption keys for that client version though (unless they're the same as the 20130703 client, but I doubt so), so even if you enable the obfuscation clientside, you might not be able to connect to the server unless you also add the correct keys.


  6. Well, backward campability should be a big point in a community project like this, but maybe that's just my opinion. And forcing people to completely rewrite their tools, isn't nice, too. Adding a field to an existing converter logic is much easier than rethinking the complete logic. I really don't know if the advatages of this update are bigger than the disadvantages. For me personally there are no advatages, so you maybe understand why I'm grumbling.

    I'm perfectly fine with backwards compatibility, whenever it doesn't slow down development or force developers to use hacks and workarounds to introduce new features.

     

     

     

    Actually, it's been discussed since May 2013.

    Can't find a topic. Please send me a link via. PM. :)

     

     

    Done~

     

     

    There's a reason not to do that. We'd be back to a hard to read file format (the import scripts). I personally find it pointless to have the item db in SQL (other than for control panels and such), because, well, it's an info that gets read once on server startup, and cached in any case. SQL is useful if you only need to look up parts of it (like a control panel does), but quite pointless (and an annoyance to keep up to date) if all you need is to SELECT * on server startup.

    If one of the two formats were to go away, to me it'd be SQL. But it's gonna stay, mostly for Control Panel purposes.

    That's the point. Think of the possibilities of SQL. You would be able to change data while server is running and this not just temporary. You could even create completely new data structures if required for a script. at runtime. (You can do this know, but not when dropping SQL.) Wouldn't whis be an advantage? "Hard to read".. Well, there are many many tools which make it easy to create SQL statements if you don't like typing them, that's not a valid reason in my opinion.

     

     

    You can't really change the data while the server is running (without reloading the database), but then you can reload the txt version in the same exact way (and possibly even faster than the SQL version).

     

    I don't really understand the 'create new data structures' part. If you mean creating other SQL tables, sure, but it has nothing to do with the item database. If you mean adding fields to the database -- no, you can't do that, since the code that reads from the database is compiled to the server (both for the txt and the SQL version), so you have at the very least to recompile and restart the server.

     

    Also, no matter how you format a SQL statement, it can never become as clean and easy to read as the new item database format. It'll always be a bunch of fields next to each others.

     

     

     

     

    I wish there is also overhaul in Mob db file structure :)

    this is next on the hit list :P

     

     

    It indeed is :D

     

    I like the idea how you guys changed the item database file structure just for the sake that us server owner and you guys as a developers wants a readable format. In my point of view I can only see:

    {	// =================== Mandatory fields ===============================	Id: ID                        (int)	AegisName: "Aegis_Name"       (string, optional if Inherit: true)	Name: "Item Name"             (string, optional if Inherit: true)	// =================== Optional fields ================================	Type: Item Type               (int, defaults to 3 = etc item)	Buy: Buy Price                (int, defaults to Sell * 2)	Sell: Sell Price              (int, defaults to Buy / 2)	Weight: Item Weight           (int, defaults to 0)	Atk: Attack                   (int, defaults to 0)	Matk: Magical Attack          (int, defaults to 0, ignored in pre-re)	Def: Defense                  (int, defaults to 0)	Range: Attack Range           (int, defaults to 0)	Slots: Slots                  (int, defaults to 0)	Job: Job mask                 (int, defaults to all jobs = 0xFFFFFFFF)	Upper: Upper mask             (int, defaults to any = 0x3f)	Gender: Gender                (int, defaults to both = 2)	Loc: Equip location           (int, required value for equipment)	WeaponLv: Weapon Level        (int, defaults to 0)	EquipLv: Equip required level (int, defaults to 0)	EquipLv: [min, max]           (alternative syntax with min / max level)	Refine: Refineable            (boolean, defaults to true)	View: View ID                 (int, defaults to 0)	Script: <"		Script		(it can be multi-line)	">	OnEquipScript: <" OnEquip Script (can also be multi-line) ">	OnUnequipScript: <" OnUnequip Script (can also be multi-line) ">	// =================== Optional fields (item_db2 only) ================	Inherit: true/false           (boolean, if true, inherit the values	                              that weren't specified, from item_db.conf,	                              else override it and use default values)}, 
    35 lines of code if it's a complete code, 3 lines of mandatory code excluding braces. In my item_db.txt i have 8.3k lines of code and I'm still using the old format, converting it will increase the line and yes parsing is not that fast.

     

    I agree it's readable. Format is good but line consuming. Parsing is not that fast. Size of file increase.

     

     

    Even if file size increases, I have actually benchmarked it and the parse time decreases. Loading and parsing the old format 1000 times (test done on db/pre_re/item_db.txt) takes 95603ms (average of 93 milliseconds each time), while loading and parsing the new format 1000 times (test done on db/pre_re/item_db.conf) takes 57390ms (so an average of 57 milliseconds).

     

    The tests were done respectively on the latest revision before the item db update appeared (7d0a63b72f93c05b302c08cfb19d5651cef1cdb8) and the latest revision (d1a635a06f5152b51d0879176f011b5c6e45431c), so they are even biased towards the old version, since it had less features back then (BindOnEquip didn't exist, so it was reading one less field.)

     

    Line count isn't relevant to the parse time. The new parser probably uses a more optimized file reading approach (through libconfig), and doesn't need to unnecessarily read fields that are set to their default values (file is bigger, but it actually contains less data.)

     

    If a higher line count disturbs you this much, you can flatten the entire database to ONE line, and it will still work. Make sure you add a semicolon after each value.

    This is a perfectly valid item database, if one is that crazy:

    item_db: ( { Id: 501; AegisName: "Red_Potion"; Name: "Red Potion"; Type: 0; Buy: 50; Weight: 70; Script: <" itemheal rand(45,65),0; ">; },{ Id: 502; AegisName: "Orange_Potion"; Name: "Orange Potion"; Type: 0; Buy: 200; Weight: 100; Script: <" itemheal rand(105,145),0; ">; },)
    (but I refuse to understand why anyone would want that)

     

     

     

    how to use that sir ?

    you didnt even put a single bit of effort into trying to figure it out by yourself o_O

     

     

    Read the first post, it is briefly explained there. You need a perl interpreter and some (very little) ability to run a command from the command-line.

  7.  

     

    im not saying its easy but it doesn't look too difficult

    It isn't difficult but a load of work, which isn't necessary.

     

    Dito, but they did promise us a converter~ so let's see bout that

    I don't think there will be a converter which is compatible with my private projects. :(

     

     

    The provided converter is to transition from the old to the new format. It's already there.

    If you need to use the file for any other purpose I'd recommend you to look at the db2sql plugin code, and modify that to suit your needs. All the item db info is available there (including the default values for the missing fields), and you can change the fprintf format strings to suit your needs.

     

    What actually concerns me most is: Did you think of all the tools in use? Every single tool which reads the item DB must be rewritten because of this update.

    Furthermore RegEx replacements are nearly impossible now, too.

    I am aware of that. But that's not an excuse for being stuck in the past with unreadable file formats. Tools can be easily edited and/or rewritten. Regular expressions are much harder to use (if not impossible), but that doesn't prevent you from writing a tool to convert the file to whatever format you find more suitable, and back to the libconfig format. The file in the repository is fine as it is, at least when it's updated, diffs are easier to read, and nobody can sneak in nasty, subtle changes that would pass unnoticed.

    I wish this would have been discussed before implementing, but now it's too late. :S

    Actually, it's been discussed since May 2013.

     

    My suggestion to please everyone: Provide a converter which is capable of converting the new format into the old format.

    Feel free to release one. I personally won't, as there's no need for it to be in the repository (other than making the Hercules database usable with other server emulators, which is outside our scope.)

     

    On a side note, the format has now new (optional) fields (see BindOnEquip). Those can't be converted to the "old" format, unless you add another field to it (but then it won't be the same old format anymore - that was one of its biggest weaknesses, it was impossible to add fields in a sane way without rewriting the entire file)

    Though I get why some would wanna keep using the txt version as it's more convenient. This adds readability to the db, which has been sorely needed for years. Can't tell you the countless times I've had to 'Page Up' to the top part to remember what row / comma section I was in...

    Yep. Hated the comma separated version (for anything other than machine parsing) since I saw it the first time. And as fields got added to it, it became harder and harder.

     

     

     

     

    it would make sense to just start using full sql

    I suggested this many times. Noone wants it. And as long as there are just a few files available in SQL my tools will use the TXT version, simply because I don't want to implement a logic for SQL an another one for TXT.

     

     

    There's a reason not to do that. We'd be back to a hard to read file format (the import scripts). I personally find it pointless to have the item db in SQL (other than for control panels and such), because, well, it's an info that gets read once on server startup, and cached in any case. SQL is useful if you only need to look up parts of it (like a control panel does), but quite pointless (and an annoyance to keep up to date) if all you need is to SELECT * on server startup.

    If one of the two formats were to go away, to me it'd be SQL. But it's gonna stay, mostly for Control Panel purposes.

     

     

    Can't tell you the countless times I've had to 'Page Up' to the top part to remember what row / comma section I was in...

    Well, now you have to search another item if the item you are editing inherits another item just to see the values. And perhaps this item inherits anotherone and you now have to search this now. Furthermore you don't see all the values with one view...  I my opinion this new format is pretty confusing.

     

     

    You misunderstood the 'Inherit' point. Please re-read how it works.

    Inherit can only be used in the item_db2 to inherit the values defined in item_db for *the same item*. You can't have inheritance chains, as it's only a boolean. If your custom Knife[3] has 'Inherit: true' set, and you only define a script (i.e. because you want it to have 100 Atk instead of its standard value), it means it'll be exactly a Knife[3], with all other standard parameters from the item_db, and only the Atk you have overridden will be changed. This means that, if for some reason the official item is updated to have a different weight, you wouldn't need to edit yours, as the change will be propagated (unless you override it.)


  8. yes, but this packet keys do not work, i can still spam with WPE & other toolz.

    This is because:

    Yes, the 2012-04 clients (and possibly a few others) have their keys chosen in such a way that makes the client effectively always use the same encryption key for each sent packet (thus allowing you to replay a packet as much as you want in WPE.)

     

    You can either use a newer client, or edit the keys yourself in both client (you'll have to hex-edit it) and server (edit the appropriate packetKeys line for your PACKETVER in src/map/packets.h and recompile.)

     

  9. To finish, it's not because you don't know or heard about exploits that they don't exist.

    Lucky admins, RO hackers seems to have a pretty bad level and just know about SQLI, LFI (and DDOS of course) :)

    How would a full rewrite help preventing these attacks? I feel that ditching an old (but maintained) and well tested codebase to rewrite it from scratch, would have the opposite effect and risk creating more security vulnerabilities, other than breaking compatibility with any old addons and themes. As someone once said, if it ain't broke, don't fix it.

  10. Yes, the 2012-04 clients (and possibly a few others) have their keys chosen in such a way that makes the client effectively always use the same encryption key for each sent packet (thus allowing you to replay a packet as much as you want in WPE.)

     

    You can either use a newer client, or edit the keys yourself in both client (you'll have to hex-edit it) and server (edit the appropriate packetKeys line for your PACKETVER in src/map/packets.h and recompile.)

×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.