Jump to content

Kenpachi

Members
  • Posts

    764
  • Joined

  • Last visited

  • Days Won

    4

Posts posted by Kenpachi

  1. I don't know if there is a method to make tables versioned, but a primitive way to implement something like that is:

    have a version table with a version field, one integer.

    On each database change, the upgrade file bump the version, and of course we also bump te version in main.sql, and in the server there could be a #define that also needs to be bumped, and we can check if those versions are the same.

    Probably there are some better methods, I'm not experienced with SQL.

    AFAIK there is no good solution to version tables. Actually it's not required since the map server will throw an error if the DB layout doesn't match with what he tries to do.

    I think all the SQL upgrades pre-rAthena should be removed.

    +1
  2. Your application should manage the data and the processes, not the SQL server.

    From a guy that puts in a UNIQUE constraint for a 3rd party tool, that should handle the business logic. :)

    Well, that's something our application can't control so there was no other choice. ;)

    Do not get me wrong here, I do know that redundancy can be used to boost performance, but I do not think that the logs for example do need that much of performance.

    I also use redundancy when I optimize performance on some databases and I also work with huge companies and their databases, not everyday though.

    I do appreciate your opinion to this topic, but even if we do not use foreign keys or something like that, could you please set up some naming standards for the database and remove unneeded redundant columns?

    Sure, I'll work on it in next days.
  3. Dude, school knowledge is one thing, experience another...

    Redundancy isn't always a bad thing. It can boost the performance and useablity.

    I'm working with SQL databases everyday and know many companies which do so. Neither me nor one of those campanies uses the foreign key enigine which is shipped with the SQL server. Why this? Pretty simple...

    Your application should manage the data and the processes, not the SQL server.

    The SQL server is just a stupid data holding backend which should be replaceable in no time. When you pack it with tons of business logic that's nearly impossible...

    • Upvote 4
  4. In ../src/char/char.c find:

    //Insert the new char entry to the database
    if( SQL_ERROR == Sql_Query(sql_handle, "INSERT INTO `%s` (`account_id`, `char_num`, `name`, `zeny`, `str`, `agi`, `vit`, `int`, `dex`, `luk`, `max_hp`, `hp`,"
    	  "`max_sp`, `sp`, `hair`, `hair_color`, `last_map`, `last_x`, `last_y`, `save_map`, `save_x`, `save_y`) VALUES ("
    	  "'%d', '%d', '%s', '%d',  '%d', '%d', '%d', '%d', '%d', '%d', '%d', '%d','%d', '%d','%d', '%d', '%s', '%d', '%d', '%s', '%d', '%d')",
    	  char_db, sd->account_id , slot, esc_name, start_zeny, str, agi, vit, int_, dex, luk,
    	  (40 * (100 + vit)/100) , (40 * (100 + vit)/100 ),  (11 * (100 + int_)/100), (11 * (100 + int_)/100), hair_style, hair_color,
    	  mapindex_id2name(start_point.map), start_point.x, start_point.y, mapindex_id2name(start_point.map), start_point.x, start_point.y) )
    {
     Sql_ShowDebug(sql_handle);
     return -2; //No, stop the procedure!
    }
    

    and replace with:

    //Insert the new char entry to the database
    if( SQL_ERROR == Sql_Query(sql_handle, "INSERT INTO `%s` (`account_id`, `char_num`, `name`, `zeny`, `str`, `agi`, `vit`, `int`, `dex`, `luk`, `max_hp`, `hp`,"
    	  "`max_sp`, `sp`, `hair`, `hair_color`, `last_map`, `last_x`, `last_y`, `save_map`, `save_x`, `save_y`, `class`) VALUES ("
    	  "'%d', '%d', '%s', '%d',  '%d', '%d', '%d', '%d', '%d', '%d', '%d', '%d','%d', '%d','%d', '%d', '%s', '%d', '%d', '%s', '%d', '%d', 4001)",
    	  char_db, sd->account_id , slot, esc_name, start_zeny, str, agi, vit, int_, dex, luk,
    	  (40 * (100 + vit)/100) , (40 * (100 + vit)/100 ),  (11 * (100 + int_)/100), (11 * (100 + int_)/100), hair_style, hair_color,
    	  mapindex_id2name(start_point.map), start_point.x, start_point.y, mapindex_id2name(start_point.map), start_point.x, start_point.y) )
    {
     Sql_ShowDebug(sql_handle);
     return -2; //No, stop the procedure!
    }
    

    and recompile.

    (untested)

  5. I am not certain how to read the "short class_;" part,

    does this indicate a group altogether? Or is this an individual object?

    short class_; declares a variable calles class_ with data type short.

    short is alike int but with a smaller range. (CLICK)

    And about the problem itself:

    Maybe I misunderstood you. Are you talking about the stat points that are used to raise stats or about the amount of STR/AGI/VIT/etc?

  6. Open your skill_require_db.txt (../db/pre-re and/or ../db/re) and find this line:

    356,0,0,50,0,0,0,3,0,0,none,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 //LK_PARRYING#ƒpƒŠƒCƒ“ƒO#
    

    Field #8 (the 3) contains the allowed weapon types. Allowing two-handed and one-handed swords would look lke:

    356,0,0,50,0,0,0,2:3,0,0,none,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 //LK_PARRYING#ƒpƒŠƒCƒ“ƒO#
    

    *Note: Only Allowed to use Parrying if the user is buffed with a Soul Link.
    When using a one handed sword? Always? Please give details...
  7. In src/common/mmo.h The is a struct called mmo_charstatus which hold the stats of a character.

    The variables are signed short, so a maximum of 32767 is just fine.

    I did a SVN blame from revision 15000 up to head revision. Those variables weren't touched....

×
×
  • Create New...