Jump to content

hemagx

Core Developers
  • Content Count

    248
  • Joined

  • Days Won

    10

Reputation Activity

  1. Upvote
    hemagx got a reaction from MikZ in Max connection (failed to connect)   
    Then probably it's just your server can't handle this connections amount
  2. Upvote
    hemagx got a reaction from evilpuncker in Odin Server side manner   
    got few issue, gonna delay it...(hears someone crying in the corner)..
  3. Upvote
    hemagx got a reaction from evilpuncker in Odin Server side manner   
    You're lucky that i'm facing serious issue right now and i can't continue what i'm working on.
    Gonna work on this plugin now
  4. Upvote
    hemagx got a reaction from Easycore in [Bug / Help] Aura Visibility   
    While I'm not sure of solution for this issue, but you deserve a thump up for most Clean and Informed Help topic I've ever seen in eA/rA/Hercules.
  5. Upvote
    hemagx reacted to Chuu in [Release] [Fix] BGM folder correction   
    Hello herc community  

    This piece of work will fix the following problem:

    (.../client/BGM) some .mp3 files have the wrong title number since 2002!

      Downloads:
    All files work and are tested individually by me
    BGM official fixed  - (no extra files, just a up to date BGM folder with corrected orders)
    BGM custom fixed - (includes 33 extra BGMs of my choice. RO-suitable, mostly remixed)
    BGM extra only - (custom BGMs only)
     
    As you can see, the File Names are not matching with the Title Numbers. It looks chaotic.

    BGM No#32 is intentionally missing. Gravity might removed it belated.

    Tidy up you BGM folder, and enjoy the correct order.   
  6. Upvote
    hemagx got a reaction from Chuu in [Bug / Help] Aura Visibility   
    While I'm not sure of solution for this issue, but you deserve a thump up for most Clean and Informed Help topic I've ever seen in eA/rA/Hercules.
  7. Upvote
    hemagx got a reaction from Ridley in [Bug / Help] Aura Visibility   
    While I'm not sure of solution for this issue, but you deserve a thump up for most Clean and Informed Help topic I've ever seen in eA/rA/Hercules.
  8. Upvote
    hemagx reacted to Chuu in [Bug / Help] Aura Visibility   
    I would like to refer to this issue  
     
     
    Client date: 2015-05-13aRagexe
    Diffed with: NEMO Patcher
    The diffs I chose: Click
     
    I am using hercules
     
    Problem description

    I've tried to enable the aura above Lvl99 and the Max Lvl I've adjusted is 150.

    I have tried countless configurations with the client.conf and subsequent I've also tried it with a battle.c entry change.
     
    This should be the right server side adjustment (conf/client.conf), that I've tried many times:
    max_lv: 99 aura_lv: 150    
    While diffing, I did not use the diff:
    CustomAuraLimits    
    Reason
     
    It always caused a client crash after the char selection.
     
    Questions 
     
    When I want to use the diff above, I have to make some changes (at the diff process) in the auraSpec.txt, right?

    But how do I have to adjust the auraSpec.txt to make the aura appear?

    Could somebody explain, how the auraSpec.txt has to be configured?
     
     
    The regular auraSpec.txt looks like this:
     
    ############################################################################## # # Format # --------- # <jobid ranges>: # <level_l>-<level_h> => index, # # jobid ranges is a comma seperated list of id ranges and/or single ids. # ############################################################################# 0-30,4001-4052,4114-4119,4121-4126,4128,4130,4131,4133-4139,4141,4142,4144-4147,4149,4150,4152-4172,4181,4183-4196,4199,4200,4203,4204,4207,4210-4217: 99-255 => 1, 4053-4113,4120,4127,4129,4132,4133,4140,4143,4148,4151,4173-4180,4182,4197,4198,4201,4202,4205,4206,4208,4209: 99-149 => 1, 150-159 => 2, 160-255 => 3,  
    Thank you in advance!  
  9. Upvote
    hemagx got a reaction from evilpuncker in Odin Server side manner   
    Meow, sure
  10. Upvote
    hemagx reacted to CarlosHenrq in brACP   
    Hello guys, i'm brAthena Project Developer (not core, of course) and for a few months i've worked on control panel for us (brAthena Community).
     
    I'm still working and i really have little time to develop, it causes lots commits (216 commits right now) and few features. But i'm happy to say it's almost released.
     
    So the features for the brACP are:
     
    ** Instalation (Need improve)
    ** reCAPTCHA (https://www.google.com/recaptcha/intro/index.html)

    ** Themes system
    **** Default theme has mobile support with CSS3

    ** Language system
    **** We have only pt_BR translation file right now, but we are working on it.

    ** Cache control (memcache)
    **** Rankings (Yes, cache sql result prevent MySQL to many request [shiraz, brAthena, hint]), translation and translated files.

    ** Account management
    **** Login, Create, Recover
    **** Administration panel (Still working on it)
    **** Change pass and e-mail
    **** Reset appear, position and equipment,
    **** Donations system (PagSeguro, https://pagseguro.uol.com.br)

    ** User notification (e-mail) when:
    **** Create account, changes password or e-mail, for e-mail changes we create log.
    **** When donation changes status
     
    For this control panel, we've used:

    ** PHP 5.4+ (PHP 7+ not tested)

    ** Apache 2.4 (IIS not tested)
    **** mod_rewrite must be enabled

    ** MySQL 5.5+ (MySQL 7+ not tested)

    ** PHP Composer
    **** To install our dependences of course!

    And the frameworks or extensions we've used to make it works:

    ** Slim Framework v3.1.0
    ** Smarty v3.1.29
    ** Guzzle v6.1.1
    ** Doctrine v2.4.2
    ** SwiftMailer v5.4.1
    ** PECL::MEMCACHE v3.0.8 (Optional, https://pecl.php.net/package/memcache)
     
    Live version?
    Here is: http://carloshenrq.com/brACP/
    Note¹.: The current live version is 0.2.1-alpha
    Note².: Once a week i update the live version, so some features you won't find right now there...
     
    Beta version?
    https://github.com/carloshenrq/brACP/releases/tag/0.1.1-beta
    Note¹.: This portuguese version only and the version is 0.1.1-beta, the newer is not ready for beta test.
     
    GitHub Repository?
    Here is: https://github.com/carloshenrq/brACP
     
    Suggestions, Reviews or Contribute? Please, let me know!
    If you can post here https://github.com/carloshenrq/brACP/issues will be more easy for us all.
  11. Upvote
    hemagx got a reaction from Mystery in [2016-04-17] The Redesign of Client Interface and Private Headers   
    Rationale:
    For ages we got awful looking code when it come to work with socket and packet, also this code was totally manually handled.
    so many possible mistake could happen and lot of hardcoded numbers, now with this update this will not happen anymore and compiler will take care of all of this.
    also with this update we introduce first Private header, the lclif ( Login Client Interface ) header, the private headers meant for functions should not be accessed from outside the source file, however this still accessible by plugins.
    this also will prevent a long not needed re-compile time for whole project when the changes only happens in private headers.
     
    Contents:
    A total new client interface for login server (lclif.c/lclif.h).
    The first private header which meant for client interface in login server (lclif.p.h).
     
    Impact:
    The impact of this changes can be huge if you have heavy modified login server as many functions removed, moved or rewrote.
    please be careful merging this update.
     
    Details:
    Before we were dealing with packets in so ugly way and unsafe with hardcoded numbers and easy mistakes that were hard to be spoted, also we mixed code to parse packets with code to process them.
    With this update we separate packet parse and packet processing, and also we started to use structs instead of manual (offset-based) packet parsing and creation!
     
    an example of how we were writing a packet to client before, and now.
     
    Before:
    Here's an example of the server-list packet being sent to the player upon successful login
    WFIFOHEAD(fd,47+32*server_num); WFIFOW(fd,0) = 0x69; WFIFOW(fd,2) = 47+32*server_num; WFIFOL(fd,4) = sd->login_id1; WFIFOL(fd,8) = sd->account_id; WFIFOL(fd,12) = sd->login_id2; WFIFOL(fd,16) = 0; // in old version, that was for ip (not more used) //memcpy(WFIFOP(fd,20), sd->lastlogin, 24); // in old version, that was for name (not more used) memset(WFIFOP(fd,20), 0, 24); WFIFOW(fd,44) = 0; // unknown WFIFOB(fd,46) = sex_str2num(sd->sex); for (i = 0, n = 0; i < ARRAYLENGTH(server); ++i) { uint32 subnet_char_ip; if (!sockt->session_is_valid(server[i].fd)) continue; subnet_char_ip = login->lan_subnet_check(ip); WFIFOL(fd,47+n*32) = htonl((subnet_char_ip) ? subnet_char_ip : server[i].ip); WFIFOW(fd,47+n*32+4) = sockt->ntows(htons(server[i].port)); // [!] LE byte order here [!] memcpy(WFIFOP(fd,47+n*32+6), server[i].name, 20); WFIFOW(fd,47+n*32+26) = server[i].users; if( server[i].type == CST_PAYING && sd->expiration_time > time(NULL) ) WFIFOW(fd,47+n*32+28) = CST_NORMAL; else WFIFOW(fd,47+n*32+28) = server[i].type; WFIFOW(fd,47+n*32+30) = server[i].new_; n++; } WFIFOSET(fd,47+32*server_num);  
    So many numbers! And a real mess, imagine the harm that one wrong number can cause! even crash for client or server !
    And the code is barely readable or meaningful.
     
    After the update:
     
    length = sizeof(*packet) + sizeof(packet->ServerList[0]) * server_num; ip = sockt->session[sd->fd]->client_addr; //Allocate the packet WFIFOHEAD(sd->fd, length); packet = WP2PTR(sd->fd); packet->PacketType = PACKET_ID_AC_ACCEPT_LOGIN; packet->PacketLength = length; packet->AuthCode = sd->login_id1; packet->AID = sd->account_id; packet->userLevel = sd->login_id2; packet->lastLoginIP = 0x0; memset(packet->lastLoginTime, '\0', sizeof(packet->lastLoginTime)); packet->Sex = sex_str2num(sd->sex); for (i = 0, n = 0; i < ARRAYLENGTH(server); ++i) { uint32 subnet_char_ip; if (!sockt->session_is_valid(server[i].fd)) continue; subnet_char_ip = login->lan_subnet_check(ip); packet->ServerList[n].ip = htonl((subnet_char_ip) ? subnet_char_ip : server[i].ip); packet->ServerList[n].port = sockt->ntows(htons(server[i].port)); // [!] LE byte order here [!] safestrncpy(packet->ServerList[n].name, server[i].name, 20); packet->ServerList[n].usercount = server[i].users; if( server[i].type == CST_PAYING && sd->expiration_time > time(NULL) ) packet->ServerList[n].property = CST_NORMAL; else packet->ServerList[n].property = server[i].type; packet->ServerList[n].state = server[i].new_; ++n; } WFIFOSET(sd->fd, length);  
    I bet now you can place everything and know what you're dealing with, with no numbers to mistake with at all!
     
    This is how we build a packet, parsing a packet became easier too.
     
    Before:
    version = RFIFOL(fd,2); safestrncpy(username, (const char*)RFIFOP(fd,6), NAME_LENGTH); safestrncpy(password, (const char*)RFIFOP(fd,30), NAME_LENGTH); clienttype = RFIFOB(fd,54);  
    After:
    DEFPACKET(CA_LOGIN) { const struct PACKET_CA_LOGIN *packet = RP2PTR(fd); sd->version = packet->Version; sd->clienttype = packet->clienttype; safestrncpy(sd->userid, packet->ID, NAME_LENGTH); safestrncpy(sd->passwd, packet->Passwd, PASSWD_LEN); if (login->config->use_md5_passwds) MD5_String(sd->passwd, sd->passwd); sd->passwdenc = PWENC_NONE; login->client_login(fd, sd); return PACKET_VALID; }  
    we just took care of parse packet and give it to login server to process it, just as it should be, the code is cleaner and easier to read and understand.
     
    Merge Date:
    Sat, 16 Apr 2016 15:37:47 +0200
     
    Related Pull Requests:
    - #1255 - https://github.com/H...cules/pull/1255 - Login clif rewrite [hemagx]

    Related Commits:
    - bbcb040 - https://github.com/HerculesWS/Hercules/commit/bbcb040 - Sat, 16 Apr 2016 15:37:47 +0200 Merge pull request #1255 from HerculesWS/login-clif_rewrite [ibrahem Hossam]
    - 8448e3f - https://github.com/HerculesWS/Hercules/commit/8448e3f - Sat, 16 Apr 2016 15:22:21 +0200 HPM Hooks Update [Haru]
    - 15c9710 - https://github.com/HerculesWS/Hercules/commit/15c9710 - Sat, 16 Apr 2016 15:21:18 +0200 Moved packet_db to the private interface of lclif [Haru]
    - 45bbb3d - https://github.com/HerculesWS/Hercules/commit/45bbb3d - Sat, 16 Apr 2016 03:33:31 +0200 Added missing documentation [Haru]
    - 6de2242 - https://github.com/HerculesWS/Hercules/commit/6de2242 - Sat, 16 Apr 2016 03:33:20 +0200 HPM Hooks Update [Haru]
    - fb26278 - https://github.com/HerculesWS/Hercules/commit/fb26278 - Fri, 15 Apr 2016 20:14:43 +0200 Added lclif packet handlers to the lclif interface [Haru]
    - 37cc46c - https://github.com/HerculesWS/Hercules/commit/37cc46c - Thu, 31 Mar 2016 00:16:48 +0200 HPM Hooks Update [Haru]
    - 7555700 - https://github.com/HerculesWS/Hercules/commit/7555700 - Mon, 28 Mar 2016 21:54:46 +0200 Rewrite client interface for login server (part 7) [hemagx]
    - ceef84e - https://github.com/HerculesWS/Hercules/commit/ceef84e - Thu, 14 Apr 2016 13:38:12 +0200 HPM Hooks Update [Haru]
    - c8ff1e7 - https://github.com/HerculesWS/Hercules/commit/c8ff1e7 - Tue, 12 Apr 2016 14:35:21 +0200 Rewrite client interface for login server (part 6) [hemagx]
    - d8da35d - https://github.com/HerculesWS/Hercules/commit/d8da35d - Tue, 12 Apr 2016 15:25:50 +0200 Rewrite client interface for login server (part 5) [hemagx]
    - c765365 - https://github.com/HerculesWS/Hercules/commit/c765365 - Tue, 12 Apr 2016 15:24:30 +0200 Rewrite client interface for login server (part 4) [hemagx]
    - d60ef91 - https://github.com/HerculesWS/Hercules/commit/d60ef91 - Mon, 28 Mar 2016 21:54:46 +0200 Rewrite client interface for login server (part 3) [hemagx]
    - 9defcee - https://github.com/HerculesWS/Hercules/commit/9defcee - Mon, 28 Mar 2016 21:54:46 +0200 Rewrite client interface for login server (part 2) [hemagx]
    - 480e959 - https://github.com/HerculesWS/Hercules/commit/480e959 - Mon, 28 Mar 2016 21:54:46 +0200 Rewrite client interface for login server (part 1) [hemagx]
  12. Upvote
    hemagx reacted to Haru in [2016-04-16] introduction of private headers   
    Opinions like these are what drove the project to the situation it is in right now. Through the years we have accumulated a level of technical debt that I'm not confident we'll ever be able to fill.
    If we keep implementing new features the way we did until now, the project will turn into a big ball of mud (or rather, it already is). Architectural changes are very needed.
     
    Now, the change the broke compatibility with your patches, isn't this one (the change in order to implement the private headers is almost irrelevant in terms of changed lines of code). What you should blame is, instead, the redesign of the client interface in the login server.
     
     
    In my optinion, both changes were necessary in order for the project to go forward. I'll point out some of the reasons why I want changes like these:
     
    - The private interfaces: the change may seem pointless if the only reason is compile time (in fact, they aren't pointless - even if server owners don't recompile it often, we developers do -- and by shortening the compilation time, you increase the amount of tests we're likely to do on a patch before submitting it, or reduce the time we take to fully implement and test something). There are, though, other more important reasons. By making some methods private, we're ensuring that they aren't called by other modules, reducing the chance that new features will be implemented in a half-assed way like it happened in the past (resulting in a cleaner and more manageable codebase overall).
    Once again, keep in mind that the changes to the lclif.c file that were necessary in order to implement this were almost zero (just some lclif->xxxx or lclif_xxxx replaced by lclif->p->xxx), so this is very unlikely to break any of your patches.
     
    - The clif changes: This is important for at least three different reasons.
    Firstly, right now we're mixing login logic with packet sending logic, and that's just plain wrong (login code should be independent from the client, and clif code should be client-specific, just like it's important to separate logic from presentation in any well designed application).
    Secondly, implementing new packets, or editing old ones has become much easier and less prone to very subtle errors (think of 'WFIFOW(fd, 13 + 7 * i + 4) = foo;' versus 'packet->item[7].nameid = foo;').
    Finally, it addressed some long standing issues that made it very hard for HPM plugins to hook into packet handling. Writing a plugin that performs additional actions on a specific packet (or that completely overrides the handling of a packet) is much easier now.
     
    I already merged these changes into my own (private) codebase, where I have very large changes to the login interface, and the merge wasn't as painful as you describe it (you should consider doing it commit by commit rather than all at once - that's what I did when I merged it, and that's the reason why I refused to merge this as one mega-commit).
    On a side note, have you considered implementing your changes as a HPM plugin? If not, we'd like to hear the reasons, so that we can improve the HPM so that it's flexible enough for most use cases.
  13. Upvote
    hemagx got a reaction from bWolfie in [2016-04-16] introduction of private headers   
    Hello ~
     
    Rationale:
     
    For long time we had many functions or variables that were supposed to be kept privately used, but because of the design of our header files were kept a public access. This caused, on one hand, poor design choices (too much binding between separate components), and on the other hand, excessively long long re-compile for the whole project if anything changed in this headers (because cause any or all files can be affected). Now with private headers only the file meant to use this header will be recompiled resulting in less compile times, waaay less!
     
    Contents:
     
    The login server client interface (lclif) was chosen as a working prototype of this, and now has a private interface (lclif.p.h) alongside its public interface (lclif.h).
     
    Details:
     
    Currently we will start limit the private function/variable/databases to a private interface under a private header only meant to be used by the module itself. This will stop other modules from accessing the private function/variable/databases (lclif.p.h should only be included by lclif.c, but never included by other .c files), however plugins will still be able to access it if they need to (the private interface is fully HPM and HPMHooking compliant).
     
    The private interface is exposed through an opaque pointer inside the public interface.
     
    the private data can be accessed through the interface through the private interface pointer
    interface->p->private_function(); //General example lclif->p->parse_sub(fd, sd); // Example for login client interface  to be able to use the private interface into your plugin please make sure to include the private header !
    It's recommended to still include the public interface as well.
     
    //General example #include "project/file.h" #include "project/file.p.h" // Example to include Login Client Interface Private header #include "login/lclif.h" #include "login/lclif.p.h" Merge Date:Sat, 16 Apr 2016 15:37:47 +0200
     
    Related Pull Requests:
    - #1255 - https://github.com/HerculesWS/Hercules/pull/1255 - Login clif rewrite [hemagx]
     
    Related Commits:
    - 79d9ace - https://github.com/HerculesWS/Hercules/commit/79d9ace - Wed, 30 Mar 2016 23:58:17 +0200 Added support for private headers to the HPMDataCheck/HPMHooking generators [Haru]
    - c0178d2 - https://github.com/HerculesWS/Hercules/commit/c0178d2 - Thu, 31 Mar 2016 00:16:02 +0200 HPM Hooks Update [Haru]
    - ab42483 - https://github.com/HerculesWS/Hercules/commit/ab42483 - Thu, 31 Mar 2016 14:42:56 +0200 Updated GNU Make build system to support private headers [Haru]
    - 7555700 - https://github.com/HerculesWS/Hercules/commit/7555700 - Mon, 28 Mar 2016 21:54:46 +0200 Rewrite client interface for login server (part 7) [hemagx]
    - 37cc46c - https://github.com/HerculesWS/Hercules/commit/37cc46c - Thu, 31 Mar 2016 00:16:48 +0200 HPM Hooks Update [Haru]
    - 15c9710 - https://github.com/HerculesWS/Hercules/commit/15c9710 - Sat, 16 Apr 2016 15:21:18 +0200 Moved packet_db to the private interface of lclif [Haru]
    - 8448e3f - https://github.com/HerculesWS/Hercules/commit/8448e3f - Sat, 16 Apr 2016 15:22:21 +0200 HPM Hooks Update [Haru]
    - bbcb040 - https://github.com/HerculesWS/Hercules/commit/bbcb040 - Sat, 16 Apr 2016 15:37:47 +0200 Merge pull request #1255 from HerculesWS/login-clif_rewrite [ibrahem Hossam]
  14. Upvote
    hemagx got a reaction from Sephus in [2016-04-16] introduction of private headers   
    Hello ~
     
    Rationale:
     
    For long time we had many functions or variables that were supposed to be kept privately used, but because of the design of our header files were kept a public access. This caused, on one hand, poor design choices (too much binding between separate components), and on the other hand, excessively long long re-compile for the whole project if anything changed in this headers (because cause any or all files can be affected). Now with private headers only the file meant to use this header will be recompiled resulting in less compile times, waaay less!
     
    Contents:
     
    The login server client interface (lclif) was chosen as a working prototype of this, and now has a private interface (lclif.p.h) alongside its public interface (lclif.h).
     
    Details:
     
    Currently we will start limit the private function/variable/databases to a private interface under a private header only meant to be used by the module itself. This will stop other modules from accessing the private function/variable/databases (lclif.p.h should only be included by lclif.c, but never included by other .c files), however plugins will still be able to access it if they need to (the private interface is fully HPM and HPMHooking compliant).
     
    The private interface is exposed through an opaque pointer inside the public interface.
     
    the private data can be accessed through the interface through the private interface pointer
    interface->p->private_function(); //General example lclif->p->parse_sub(fd, sd); // Example for login client interface  to be able to use the private interface into your plugin please make sure to include the private header !
    It's recommended to still include the public interface as well.
     
    //General example #include "project/file.h" #include "project/file.p.h" // Example to include Login Client Interface Private header #include "login/lclif.h" #include "login/lclif.p.h" Merge Date:Sat, 16 Apr 2016 15:37:47 +0200
     
    Related Pull Requests:
    - #1255 - https://github.com/HerculesWS/Hercules/pull/1255 - Login clif rewrite [hemagx]
     
    Related Commits:
    - 79d9ace - https://github.com/HerculesWS/Hercules/commit/79d9ace - Wed, 30 Mar 2016 23:58:17 +0200 Added support for private headers to the HPMDataCheck/HPMHooking generators [Haru]
    - c0178d2 - https://github.com/HerculesWS/Hercules/commit/c0178d2 - Thu, 31 Mar 2016 00:16:02 +0200 HPM Hooks Update [Haru]
    - ab42483 - https://github.com/HerculesWS/Hercules/commit/ab42483 - Thu, 31 Mar 2016 14:42:56 +0200 Updated GNU Make build system to support private headers [Haru]
    - 7555700 - https://github.com/HerculesWS/Hercules/commit/7555700 - Mon, 28 Mar 2016 21:54:46 +0200 Rewrite client interface for login server (part 7) [hemagx]
    - 37cc46c - https://github.com/HerculesWS/Hercules/commit/37cc46c - Thu, 31 Mar 2016 00:16:48 +0200 HPM Hooks Update [Haru]
    - 15c9710 - https://github.com/HerculesWS/Hercules/commit/15c9710 - Sat, 16 Apr 2016 15:21:18 +0200 Moved packet_db to the private interface of lclif [Haru]
    - 8448e3f - https://github.com/HerculesWS/Hercules/commit/8448e3f - Sat, 16 Apr 2016 15:22:21 +0200 HPM Hooks Update [Haru]
    - bbcb040 - https://github.com/HerculesWS/Hercules/commit/bbcb040 - Sat, 16 Apr 2016 15:37:47 +0200 Merge pull request #1255 from HerculesWS/login-clif_rewrite [ibrahem Hossam]
  15. Upvote
    hemagx got a reaction from Nebraskka in [2016-04-17] The Redesign of Client Interface and Private Headers   
    Rationale:
    For ages we got awful looking code when it come to work with socket and packet, also this code was totally manually handled.
    so many possible mistake could happen and lot of hardcoded numbers, now with this update this will not happen anymore and compiler will take care of all of this.
    also with this update we introduce first Private header, the lclif ( Login Client Interface ) header, the private headers meant for functions should not be accessed from outside the source file, however this still accessible by plugins.
    this also will prevent a long not needed re-compile time for whole project when the changes only happens in private headers.
     
    Contents:
    A total new client interface for login server (lclif.c/lclif.h).
    The first private header which meant for client interface in login server (lclif.p.h).
     
    Impact:
    The impact of this changes can be huge if you have heavy modified login server as many functions removed, moved or rewrote.
    please be careful merging this update.
     
    Details:
    Before we were dealing with packets in so ugly way and unsafe with hardcoded numbers and easy mistakes that were hard to be spoted, also we mixed code to parse packets with code to process them.
    With this update we separate packet parse and packet processing, and also we started to use structs instead of manual (offset-based) packet parsing and creation!
     
    an example of how we were writing a packet to client before, and now.
     
    Before:
    Here's an example of the server-list packet being sent to the player upon successful login
    WFIFOHEAD(fd,47+32*server_num); WFIFOW(fd,0) = 0x69; WFIFOW(fd,2) = 47+32*server_num; WFIFOL(fd,4) = sd->login_id1; WFIFOL(fd,8) = sd->account_id; WFIFOL(fd,12) = sd->login_id2; WFIFOL(fd,16) = 0; // in old version, that was for ip (not more used) //memcpy(WFIFOP(fd,20), sd->lastlogin, 24); // in old version, that was for name (not more used) memset(WFIFOP(fd,20), 0, 24); WFIFOW(fd,44) = 0; // unknown WFIFOB(fd,46) = sex_str2num(sd->sex); for (i = 0, n = 0; i < ARRAYLENGTH(server); ++i) { uint32 subnet_char_ip; if (!sockt->session_is_valid(server[i].fd)) continue; subnet_char_ip = login->lan_subnet_check(ip); WFIFOL(fd,47+n*32) = htonl((subnet_char_ip) ? subnet_char_ip : server[i].ip); WFIFOW(fd,47+n*32+4) = sockt->ntows(htons(server[i].port)); // [!] LE byte order here [!] memcpy(WFIFOP(fd,47+n*32+6), server[i].name, 20); WFIFOW(fd,47+n*32+26) = server[i].users; if( server[i].type == CST_PAYING && sd->expiration_time > time(NULL) ) WFIFOW(fd,47+n*32+28) = CST_NORMAL; else WFIFOW(fd,47+n*32+28) = server[i].type; WFIFOW(fd,47+n*32+30) = server[i].new_; n++; } WFIFOSET(fd,47+32*server_num);  
    So many numbers! And a real mess, imagine the harm that one wrong number can cause! even crash for client or server !
    And the code is barely readable or meaningful.
     
    After the update:
     
    length = sizeof(*packet) + sizeof(packet->ServerList[0]) * server_num; ip = sockt->session[sd->fd]->client_addr; //Allocate the packet WFIFOHEAD(sd->fd, length); packet = WP2PTR(sd->fd); packet->PacketType = PACKET_ID_AC_ACCEPT_LOGIN; packet->PacketLength = length; packet->AuthCode = sd->login_id1; packet->AID = sd->account_id; packet->userLevel = sd->login_id2; packet->lastLoginIP = 0x0; memset(packet->lastLoginTime, '\0', sizeof(packet->lastLoginTime)); packet->Sex = sex_str2num(sd->sex); for (i = 0, n = 0; i < ARRAYLENGTH(server); ++i) { uint32 subnet_char_ip; if (!sockt->session_is_valid(server[i].fd)) continue; subnet_char_ip = login->lan_subnet_check(ip); packet->ServerList[n].ip = htonl((subnet_char_ip) ? subnet_char_ip : server[i].ip); packet->ServerList[n].port = sockt->ntows(htons(server[i].port)); // [!] LE byte order here [!] safestrncpy(packet->ServerList[n].name, server[i].name, 20); packet->ServerList[n].usercount = server[i].users; if( server[i].type == CST_PAYING && sd->expiration_time > time(NULL) ) packet->ServerList[n].property = CST_NORMAL; else packet->ServerList[n].property = server[i].type; packet->ServerList[n].state = server[i].new_; ++n; } WFIFOSET(sd->fd, length);  
    I bet now you can place everything and know what you're dealing with, with no numbers to mistake with at all!
     
    This is how we build a packet, parsing a packet became easier too.
     
    Before:
    version = RFIFOL(fd,2); safestrncpy(username, (const char*)RFIFOP(fd,6), NAME_LENGTH); safestrncpy(password, (const char*)RFIFOP(fd,30), NAME_LENGTH); clienttype = RFIFOB(fd,54);  
    After:
    DEFPACKET(CA_LOGIN) { const struct PACKET_CA_LOGIN *packet = RP2PTR(fd); sd->version = packet->Version; sd->clienttype = packet->clienttype; safestrncpy(sd->userid, packet->ID, NAME_LENGTH); safestrncpy(sd->passwd, packet->Passwd, PASSWD_LEN); if (login->config->use_md5_passwds) MD5_String(sd->passwd, sd->passwd); sd->passwdenc = PWENC_NONE; login->client_login(fd, sd); return PACKET_VALID; }  
    we just took care of parse packet and give it to login server to process it, just as it should be, the code is cleaner and easier to read and understand.
     
    Merge Date:
    Sat, 16 Apr 2016 15:37:47 +0200
     
    Related Pull Requests:
    - #1255 - https://github.com/H...cules/pull/1255 - Login clif rewrite [hemagx]

    Related Commits:
    - bbcb040 - https://github.com/HerculesWS/Hercules/commit/bbcb040 - Sat, 16 Apr 2016 15:37:47 +0200 Merge pull request #1255 from HerculesWS/login-clif_rewrite [ibrahem Hossam]
    - 8448e3f - https://github.com/HerculesWS/Hercules/commit/8448e3f - Sat, 16 Apr 2016 15:22:21 +0200 HPM Hooks Update [Haru]
    - 15c9710 - https://github.com/HerculesWS/Hercules/commit/15c9710 - Sat, 16 Apr 2016 15:21:18 +0200 Moved packet_db to the private interface of lclif [Haru]
    - 45bbb3d - https://github.com/HerculesWS/Hercules/commit/45bbb3d - Sat, 16 Apr 2016 03:33:31 +0200 Added missing documentation [Haru]
    - 6de2242 - https://github.com/HerculesWS/Hercules/commit/6de2242 - Sat, 16 Apr 2016 03:33:20 +0200 HPM Hooks Update [Haru]
    - fb26278 - https://github.com/HerculesWS/Hercules/commit/fb26278 - Fri, 15 Apr 2016 20:14:43 +0200 Added lclif packet handlers to the lclif interface [Haru]
    - 37cc46c - https://github.com/HerculesWS/Hercules/commit/37cc46c - Thu, 31 Mar 2016 00:16:48 +0200 HPM Hooks Update [Haru]
    - 7555700 - https://github.com/HerculesWS/Hercules/commit/7555700 - Mon, 28 Mar 2016 21:54:46 +0200 Rewrite client interface for login server (part 7) [hemagx]
    - ceef84e - https://github.com/HerculesWS/Hercules/commit/ceef84e - Thu, 14 Apr 2016 13:38:12 +0200 HPM Hooks Update [Haru]
    - c8ff1e7 - https://github.com/HerculesWS/Hercules/commit/c8ff1e7 - Tue, 12 Apr 2016 14:35:21 +0200 Rewrite client interface for login server (part 6) [hemagx]
    - d8da35d - https://github.com/HerculesWS/Hercules/commit/d8da35d - Tue, 12 Apr 2016 15:25:50 +0200 Rewrite client interface for login server (part 5) [hemagx]
    - c765365 - https://github.com/HerculesWS/Hercules/commit/c765365 - Tue, 12 Apr 2016 15:24:30 +0200 Rewrite client interface for login server (part 4) [hemagx]
    - d60ef91 - https://github.com/HerculesWS/Hercules/commit/d60ef91 - Mon, 28 Mar 2016 21:54:46 +0200 Rewrite client interface for login server (part 3) [hemagx]
    - 9defcee - https://github.com/HerculesWS/Hercules/commit/9defcee - Mon, 28 Mar 2016 21:54:46 +0200 Rewrite client interface for login server (part 2) [hemagx]
    - 480e959 - https://github.com/HerculesWS/Hercules/commit/480e959 - Mon, 28 Mar 2016 21:54:46 +0200 Rewrite client interface for login server (part 1) [hemagx]
  16. Upvote
    hemagx got a reaction from Legend in [2016-04-16] introduction of private headers   
    Hello ~
     
    Rationale:
     
    For long time we had many functions or variables that were supposed to be kept privately used, but because of the design of our header files were kept a public access. This caused, on one hand, poor design choices (too much binding between separate components), and on the other hand, excessively long long re-compile for the whole project if anything changed in this headers (because cause any or all files can be affected). Now with private headers only the file meant to use this header will be recompiled resulting in less compile times, waaay less!
     
    Contents:
     
    The login server client interface (lclif) was chosen as a working prototype of this, and now has a private interface (lclif.p.h) alongside its public interface (lclif.h).
     
    Details:
     
    Currently we will start limit the private function/variable/databases to a private interface under a private header only meant to be used by the module itself. This will stop other modules from accessing the private function/variable/databases (lclif.p.h should only be included by lclif.c, but never included by other .c files), however plugins will still be able to access it if they need to (the private interface is fully HPM and HPMHooking compliant).
     
    The private interface is exposed through an opaque pointer inside the public interface.
     
    the private data can be accessed through the interface through the private interface pointer
    interface->p->private_function(); //General example lclif->p->parse_sub(fd, sd); // Example for login client interface  to be able to use the private interface into your plugin please make sure to include the private header !
    It's recommended to still include the public interface as well.
     
    //General example #include "project/file.h" #include "project/file.p.h" // Example to include Login Client Interface Private header #include "login/lclif.h" #include "login/lclif.p.h" Merge Date:Sat, 16 Apr 2016 15:37:47 +0200
     
    Related Pull Requests:
    - #1255 - https://github.com/HerculesWS/Hercules/pull/1255 - Login clif rewrite [hemagx]
     
    Related Commits:
    - 79d9ace - https://github.com/HerculesWS/Hercules/commit/79d9ace - Wed, 30 Mar 2016 23:58:17 +0200 Added support for private headers to the HPMDataCheck/HPMHooking generators [Haru]
    - c0178d2 - https://github.com/HerculesWS/Hercules/commit/c0178d2 - Thu, 31 Mar 2016 00:16:02 +0200 HPM Hooks Update [Haru]
    - ab42483 - https://github.com/HerculesWS/Hercules/commit/ab42483 - Thu, 31 Mar 2016 14:42:56 +0200 Updated GNU Make build system to support private headers [Haru]
    - 7555700 - https://github.com/HerculesWS/Hercules/commit/7555700 - Mon, 28 Mar 2016 21:54:46 +0200 Rewrite client interface for login server (part 7) [hemagx]
    - 37cc46c - https://github.com/HerculesWS/Hercules/commit/37cc46c - Thu, 31 Mar 2016 00:16:48 +0200 HPM Hooks Update [Haru]
    - 15c9710 - https://github.com/HerculesWS/Hercules/commit/15c9710 - Sat, 16 Apr 2016 15:21:18 +0200 Moved packet_db to the private interface of lclif [Haru]
    - 8448e3f - https://github.com/HerculesWS/Hercules/commit/8448e3f - Sat, 16 Apr 2016 15:22:21 +0200 HPM Hooks Update [Haru]
    - bbcb040 - https://github.com/HerculesWS/Hercules/commit/bbcb040 - Sat, 16 Apr 2016 15:37:47 +0200 Merge pull request #1255 from HerculesWS/login-clif_rewrite [ibrahem Hossam]
  17. Upvote
    hemagx got a reaction from evilpuncker in [2016-04-16] introduction of private headers   
    Hello ~
     
    Rationale:
     
    For long time we had many functions or variables that were supposed to be kept privately used, but because of the design of our header files were kept a public access. This caused, on one hand, poor design choices (too much binding between separate components), and on the other hand, excessively long long re-compile for the whole project if anything changed in this headers (because cause any or all files can be affected). Now with private headers only the file meant to use this header will be recompiled resulting in less compile times, waaay less!
     
    Contents:
     
    The login server client interface (lclif) was chosen as a working prototype of this, and now has a private interface (lclif.p.h) alongside its public interface (lclif.h).
     
    Details:
     
    Currently we will start limit the private function/variable/databases to a private interface under a private header only meant to be used by the module itself. This will stop other modules from accessing the private function/variable/databases (lclif.p.h should only be included by lclif.c, but never included by other .c files), however plugins will still be able to access it if they need to (the private interface is fully HPM and HPMHooking compliant).
     
    The private interface is exposed through an opaque pointer inside the public interface.
     
    the private data can be accessed through the interface through the private interface pointer
    interface->p->private_function(); //General example lclif->p->parse_sub(fd, sd); // Example for login client interface  to be able to use the private interface into your plugin please make sure to include the private header !
    It's recommended to still include the public interface as well.
     
    //General example #include "project/file.h" #include "project/file.p.h" // Example to include Login Client Interface Private header #include "login/lclif.h" #include "login/lclif.p.h" Merge Date:Sat, 16 Apr 2016 15:37:47 +0200
     
    Related Pull Requests:
    - #1255 - https://github.com/HerculesWS/Hercules/pull/1255 - Login clif rewrite [hemagx]
     
    Related Commits:
    - 79d9ace - https://github.com/HerculesWS/Hercules/commit/79d9ace - Wed, 30 Mar 2016 23:58:17 +0200 Added support for private headers to the HPMDataCheck/HPMHooking generators [Haru]
    - c0178d2 - https://github.com/HerculesWS/Hercules/commit/c0178d2 - Thu, 31 Mar 2016 00:16:02 +0200 HPM Hooks Update [Haru]
    - ab42483 - https://github.com/HerculesWS/Hercules/commit/ab42483 - Thu, 31 Mar 2016 14:42:56 +0200 Updated GNU Make build system to support private headers [Haru]
    - 7555700 - https://github.com/HerculesWS/Hercules/commit/7555700 - Mon, 28 Mar 2016 21:54:46 +0200 Rewrite client interface for login server (part 7) [hemagx]
    - 37cc46c - https://github.com/HerculesWS/Hercules/commit/37cc46c - Thu, 31 Mar 2016 00:16:48 +0200 HPM Hooks Update [Haru]
    - 15c9710 - https://github.com/HerculesWS/Hercules/commit/15c9710 - Sat, 16 Apr 2016 15:21:18 +0200 Moved packet_db to the private interface of lclif [Haru]
    - 8448e3f - https://github.com/HerculesWS/Hercules/commit/8448e3f - Sat, 16 Apr 2016 15:22:21 +0200 HPM Hooks Update [Haru]
    - bbcb040 - https://github.com/HerculesWS/Hercules/commit/bbcb040 - Sat, 16 Apr 2016 15:37:47 +0200 Merge pull request #1255 from HerculesWS/login-clif_rewrite [ibrahem Hossam]
  18. Upvote
    hemagx got a reaction from Nebraskka in [2016-04-16] introduction of private headers   
    Hello ~
     
    Rationale:
     
    For long time we had many functions or variables that were supposed to be kept privately used, but because of the design of our header files were kept a public access. This caused, on one hand, poor design choices (too much binding between separate components), and on the other hand, excessively long long re-compile for the whole project if anything changed in this headers (because cause any or all files can be affected). Now with private headers only the file meant to use this header will be recompiled resulting in less compile times, waaay less!
     
    Contents:
     
    The login server client interface (lclif) was chosen as a working prototype of this, and now has a private interface (lclif.p.h) alongside its public interface (lclif.h).
     
    Details:
     
    Currently we will start limit the private function/variable/databases to a private interface under a private header only meant to be used by the module itself. This will stop other modules from accessing the private function/variable/databases (lclif.p.h should only be included by lclif.c, but never included by other .c files), however plugins will still be able to access it if they need to (the private interface is fully HPM and HPMHooking compliant).
     
    The private interface is exposed through an opaque pointer inside the public interface.
     
    the private data can be accessed through the interface through the private interface pointer
    interface->p->private_function(); //General example lclif->p->parse_sub(fd, sd); // Example for login client interface  to be able to use the private interface into your plugin please make sure to include the private header !
    It's recommended to still include the public interface as well.
     
    //General example #include "project/file.h" #include "project/file.p.h" // Example to include Login Client Interface Private header #include "login/lclif.h" #include "login/lclif.p.h" Merge Date:Sat, 16 Apr 2016 15:37:47 +0200
     
    Related Pull Requests:
    - #1255 - https://github.com/HerculesWS/Hercules/pull/1255 - Login clif rewrite [hemagx]
     
    Related Commits:
    - 79d9ace - https://github.com/HerculesWS/Hercules/commit/79d9ace - Wed, 30 Mar 2016 23:58:17 +0200 Added support for private headers to the HPMDataCheck/HPMHooking generators [Haru]
    - c0178d2 - https://github.com/HerculesWS/Hercules/commit/c0178d2 - Thu, 31 Mar 2016 00:16:02 +0200 HPM Hooks Update [Haru]
    - ab42483 - https://github.com/HerculesWS/Hercules/commit/ab42483 - Thu, 31 Mar 2016 14:42:56 +0200 Updated GNU Make build system to support private headers [Haru]
    - 7555700 - https://github.com/HerculesWS/Hercules/commit/7555700 - Mon, 28 Mar 2016 21:54:46 +0200 Rewrite client interface for login server (part 7) [hemagx]
    - 37cc46c - https://github.com/HerculesWS/Hercules/commit/37cc46c - Thu, 31 Mar 2016 00:16:48 +0200 HPM Hooks Update [Haru]
    - 15c9710 - https://github.com/HerculesWS/Hercules/commit/15c9710 - Sat, 16 Apr 2016 15:21:18 +0200 Moved packet_db to the private interface of lclif [Haru]
    - 8448e3f - https://github.com/HerculesWS/Hercules/commit/8448e3f - Sat, 16 Apr 2016 15:22:21 +0200 HPM Hooks Update [Haru]
    - bbcb040 - https://github.com/HerculesWS/Hercules/commit/bbcb040 - Sat, 16 Apr 2016 15:37:47 +0200 Merge pull request #1255 from HerculesWS/login-clif_rewrite [ibrahem Hossam]
  19. Upvote
    hemagx got a reaction from Legend in Playing in Official Server ? we need your help!   
    Hello ~
     
    Want your name to be in the glorious history of ragnarok online servers emulators ?
    here's your chance if you have an high-end or many characters in any official server that can perform tests and such to help us implement new systems.
     
    currently we're having many unfinished system or open bug-reports waiting to be confirmed and tested on official servers or so, unfortunately we don't have enough testers usually and so it delay many systems to be added or bugs to be resolved, however we now ask YOU to help us and bring your name to the glorious history of ragnarok servers emulators.
     
    Requirements ~
     
    to have an account on any official servers (preferred iRO, fRO, kRO).
    this accounts can be high end or not, all kind of characters or classes we may need also the more access to different places the easier for you and us to do tasks.
     
    How to apply ~
     
    You can send me a Private message on forums with server name and available characters to perform tasks, please explain job and level and builds if possible, i will be making lists to make it easy for us to chose the one who should do the task or so.
     
    or you can join our IRC Channel for Hercules Official server testers #Hercules-Testers on Rizon network, and have little discussion with me there!
     
    How it will work ? ~
     
    whenever we face bug or new system need to be tested we will be sending an private message to all testers who can perform the task, as soon as you get it you will have to answer if you can take it or not, then all testers who will do the task and give us results will be thanked and credited of helping in this bug/feature!
     
     
    Don't miss the chance !
     
    Thank you.


    Here we go!
  20. Upvote
    hemagx got a reaction from Nebraskka in What this means?   
    it's the settings the server compiled with, it help us developers if you report core bugs to include it !
  21. Upvote
    hemagx got a reaction from evilpuncker in Playing in Official Server ? we need your help!   
    Hello ~
     
    Want your name to be in the glorious history of ragnarok online servers emulators ?
    here's your chance if you have an high-end or many characters in any official server that can perform tests and such to help us implement new systems.
     
    currently we're having many unfinished system or open bug-reports waiting to be confirmed and tested on official servers or so, unfortunately we don't have enough testers usually and so it delay many systems to be added or bugs to be resolved, however we now ask YOU to help us and bring your name to the glorious history of ragnarok servers emulators.
     
    Requirements ~
     
    to have an account on any official servers (preferred iRO, fRO, kRO).
    this accounts can be high end or not, all kind of characters or classes we may need also the more access to different places the easier for you and us to do tasks.
     
    How to apply ~
     
    You can send me a Private message on forums with server name and available characters to perform tasks, please explain job and level and builds if possible, i will be making lists to make it easy for us to chose the one who should do the task or so.
     
    or you can join our IRC Channel for Hercules Official server testers #Hercules-Testers on Rizon network, and have little discussion with me there!
     
    How it will work ? ~
     
    whenever we face bug or new system need to be tested we will be sending an private message to all testers who can perform the task, as soon as you get it you will have to answer if you can take it or not, then all testers who will do the task and give us results will be thanked and credited of helping in this bug/feature!
     
     
    Don't miss the chance !
     
    Thank you.


    Here we go!
  22. Upvote
    hemagx got a reaction from REKT in Playing in Official Server ? we need your help!   
    Hello ~
     
    Want your name to be in the glorious history of ragnarok online servers emulators ?
    here's your chance if you have an high-end or many characters in any official server that can perform tests and such to help us implement new systems.
     
    currently we're having many unfinished system or open bug-reports waiting to be confirmed and tested on official servers or so, unfortunately we don't have enough testers usually and so it delay many systems to be added or bugs to be resolved, however we now ask YOU to help us and bring your name to the glorious history of ragnarok servers emulators.
     
    Requirements ~
     
    to have an account on any official servers (preferred iRO, fRO, kRO).
    this accounts can be high end or not, all kind of characters or classes we may need also the more access to different places the easier for you and us to do tasks.
     
    How to apply ~
     
    You can send me a Private message on forums with server name and available characters to perform tasks, please explain job and level and builds if possible, i will be making lists to make it easy for us to chose the one who should do the task or so.
     
    or you can join our IRC Channel for Hercules Official server testers #Hercules-Testers on Rizon network, and have little discussion with me there!
     
    How it will work ? ~
     
    whenever we face bug or new system need to be tested we will be sending an private message to all testers who can perform the task, as soon as you get it you will have to answer if you can take it or not, then all testers who will do the task and give us results will be thanked and credited of helping in this bug/feature!
     
     
    Don't miss the chance !
     
    Thank you.


    Here we go!
  23. Upvote
    hemagx got a reaction from Nebraskka in Playing in Official Server ? we need your help!   
    Hello ~
     
    Want your name to be in the glorious history of ragnarok online servers emulators ?
    here's your chance if you have an high-end or many characters in any official server that can perform tests and such to help us implement new systems.
     
    currently we're having many unfinished system or open bug-reports waiting to be confirmed and tested on official servers or so, unfortunately we don't have enough testers usually and so it delay many systems to be added or bugs to be resolved, however we now ask YOU to help us and bring your name to the glorious history of ragnarok servers emulators.
     
    Requirements ~
     
    to have an account on any official servers (preferred iRO, fRO, kRO).
    this accounts can be high end or not, all kind of characters or classes we may need also the more access to different places the easier for you and us to do tasks.
     
    How to apply ~
     
    You can send me a Private message on forums with server name and available characters to perform tasks, please explain job and level and builds if possible, i will be making lists to make it easy for us to chose the one who should do the task or so.
     
    or you can join our IRC Channel for Hercules Official server testers #Hercules-Testers on Rizon network, and have little discussion with me there!
     
    How it will work ? ~
     
    whenever we face bug or new system need to be tested we will be sending an private message to all testers who can perform the task, as soon as you get it you will have to answer if you can take it or not, then all testers who will do the task and give us results will be thanked and credited of helping in this bug/feature!
     
     
    Don't miss the chance !
     
    Thank you.


    Here we go!
  24. Upvote
    hemagx got a reaction from Nebraskka in Name and source changes [2016 April Fool]   
    Interesting changes, i like it.
  25. Upvote
    hemagx got a reaction from Cretino in Name and source changes [2016 April Fool]   
    you actually won a free source modification from me
×
×
  • Create New...

Important Information

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