Jump to content

hemagx

Core Developers
  • Content Count

    248
  • Joined

  • Days Won

    10

Reputation Activity

  1. Like
    hemagx got a reaction from IndieRO in Hemagx's paid service   
    Available once more
  2. Upvote
    hemagx got a reaction from AnnieRuru in How to make MATK = 1 in status_calc_pc_ ?   
    Well I've done few changes to this, I used same method as @AnnieRuru but as a plugin, first hercules provides us with the amazing status->pc_calc_additional which is meant for plugins, it's placed right after Equipment parse so it would not overwrite the value the plugin set, and then the plugin set the matk rate to 0, and tada!
    I've also changed map check to check the id of the map instead, this is simpler, faster and also allowed a run time check for if you accidentally put a wrong map name (check server_online function), and it's tested :3 works as charm!
    /** * This file is part of Hercules. * http://herc.ws - http://github.com/HerculesWS/Hercules * * Copyright (C) 2013-2019 Hercules Dev Team * Copyright (C) Hemagx <[email protected]> * * Hercules is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program. If not, see <http://www.gnu.org/licenses/>. */ /// Zero Matk Hercules Plugin #include "common/hercules.h" /* Should always be the first Hercules file included! (if you don't make it first, you won't be able to use interfaces) */ #include "common/core.h" #include "common/mapindex.h" #include "map/map.h" #include "map/pc.h" #include "map/status.h" #include "plugins/HPMHooking.h" #include "common/HPMDataCheck.h" /* should always be the last Hercules file included! (if you don't make it last, it'll intentionally break compile time) */ HPExport struct hplugin_info pinfo = { "Zero MATK", // Plugin name SERVER_TYPE_MAP,// Which server types this plugin works with? "0.1", // Plugin version HPM_VERSION, // HPM Version (don't change, macro is automatically updated) }; const char *map_name = "prontera"; int16 map_id = -1; // init it with invalid value to make sure on failure it would always cause our check to fail. static void status_calc_pc_additional_post(struct map_session_data *sd, enum e_status_calc_opt opt) { if (sd == NULL) // I don'r prefer usage of nullpo in hooks, unless we're replacing a function multiaple nullpo reports can turn confusing. return; if (sd->bl.m != map_id) return; sd->matk_rate = 0; return; } /* run when server starts */ HPExport void plugin_init (void) { addHookPost(status, calc_pc_additional, status_calc_pc_additional_post); } HPExport void server_online (void) { unsigned short map_index; if ((map_index = mapindex->name2id(map_name)) == 0) { ShowError("%s:plugin_init: Failed to get map index for map %s the plugin would now fail to start\n", pinfo.name, map_name); core->runflag = CORE_ST_STOP; } if ((map_id = map->mapindex2mapid(map_index)) == -1) { ShowError("%s:plugin_init: Failed to get map id for map %s the plugin would now fail to start\n", pinfo.name, map_name); core->runflag = CORE_ST_STOP; } }  
  3. Upvote
    hemagx got a reaction from Asheraf in How to make MATK = 1 in status_calc_pc_ ?   
    Well I've done few changes to this, I used same method as @AnnieRuru but as a plugin, first hercules provides us with the amazing status->pc_calc_additional which is meant for plugins, it's placed right after Equipment parse so it would not overwrite the value the plugin set, and then the plugin set the matk rate to 0, and tada!
    I've also changed map check to check the id of the map instead, this is simpler, faster and also allowed a run time check for if you accidentally put a wrong map name (check server_online function), and it's tested :3 works as charm!
    /** * This file is part of Hercules. * http://herc.ws - http://github.com/HerculesWS/Hercules * * Copyright (C) 2013-2019 Hercules Dev Team * Copyright (C) Hemagx <[email protected]> * * Hercules is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program. If not, see <http://www.gnu.org/licenses/>. */ /// Zero Matk Hercules Plugin #include "common/hercules.h" /* Should always be the first Hercules file included! (if you don't make it first, you won't be able to use interfaces) */ #include "common/core.h" #include "common/mapindex.h" #include "map/map.h" #include "map/pc.h" #include "map/status.h" #include "plugins/HPMHooking.h" #include "common/HPMDataCheck.h" /* should always be the last Hercules file included! (if you don't make it last, it'll intentionally break compile time) */ HPExport struct hplugin_info pinfo = { "Zero MATK", // Plugin name SERVER_TYPE_MAP,// Which server types this plugin works with? "0.1", // Plugin version HPM_VERSION, // HPM Version (don't change, macro is automatically updated) }; const char *map_name = "prontera"; int16 map_id = -1; // init it with invalid value to make sure on failure it would always cause our check to fail. static void status_calc_pc_additional_post(struct map_session_data *sd, enum e_status_calc_opt opt) { if (sd == NULL) // I don'r prefer usage of nullpo in hooks, unless we're replacing a function multiaple nullpo reports can turn confusing. return; if (sd->bl.m != map_id) return; sd->matk_rate = 0; return; } /* run when server starts */ HPExport void plugin_init (void) { addHookPost(status, calc_pc_additional, status_calc_pc_additional_post); } HPExport void server_online (void) { unsigned short map_index; if ((map_index = mapindex->name2id(map_name)) == 0) { ShowError("%s:plugin_init: Failed to get map index for map %s the plugin would now fail to start\n", pinfo.name, map_name); core->runflag = CORE_ST_STOP; } if ((map_id = map->mapindex2mapid(map_index)) == -1) { ShowError("%s:plugin_init: Failed to get map id for map %s the plugin would now fail to start\n", pinfo.name, map_name); core->runflag = CORE_ST_STOP; } }  
  4. Upvote
    hemagx reacted to vBrenth in Hemagx's paid service   
    His code always 10/10 works for me
    Glad your back
  5. Upvote
    hemagx got a reaction from Ridley in Hemagx's paid service   
    Greetings,
    After a long break I'm returning back to the freelancing scene, I've been in the RO private servers scene since 2012, with over 9 years of programming experience and 6 years of software development choosing me will ensure you would be getting an excellent quality of code/changes.
     
    Status: Available
     
    What do i work on?
    Core Development (Source, C) Scripting and database editing Database Management System Administration (Linux only) I can also work on applications written in PHP, Node.js, Python, C++.  
    Pricing
    Hercules source editing starting from 10$ per request. Hercules scripting starting from 10$ per request. Hercules database editing from 5$ per request. Any other requests pricing would be calculated with 8$ per hour of work. For rush requests you will be charged a flat fee of 8USD per hour of work, a detailed bill of how many hours will be spent, the final sum and expected delivery date will be given before payment for any rush requests, and all rush requests are prepaid and can never be post paid.  
    Contact methods
    Discord: Ema#8360  
    Payment methods
    Paypal Crypto (BTC/Ether only) Western Union/Money Gram Bank Wire  
    Terms of Service
    With every requests you get a guaranteed Hercules compatibility for 1 year, In-case any of Hercules update during this period breaks my code you will be given an update upon request free of charge. After first year of the guaranteed compatibility period you will be charged a small fee for any updates, very simple updated may be still done for free and it's up to my judgement. In-case of paying with any other services than Crypto currency you're sole responsible of any fees the used service asks for, and that the net amount is at least equivalent to what i asked for. For medium/large projects a 50% deposit shall be paid, and it's nonrefundable as soon as i start working on it, rest being paid after project is done and delivered.  
    Pre-made (Coming soon)
    Client web settings saving/emblem/adventurer agency support (Soon)
  6. Upvote
    hemagx got a reaction from Functor in Hemagx's paid service   
    Greetings,
    After a long break I'm returning back to the freelancing scene, I've been in the RO private servers scene since 2012, with over 9 years of programming experience and 6 years of software development choosing me will ensure you would be getting an excellent quality of code/changes.
     
    Status: Available
     
    What do i work on?
    Core Development (Source, C) Scripting and database editing Database Management System Administration (Linux only) I can also work on applications written in PHP, Node.js, Python, C++.  
    Pricing
    Hercules source editing starting from 10$ per request. Hercules scripting starting from 10$ per request. Hercules database editing from 5$ per request. Any other requests pricing would be calculated with 8$ per hour of work. For rush requests you will be charged a flat fee of 8USD per hour of work, a detailed bill of how many hours will be spent, the final sum and expected delivery date will be given before payment for any rush requests, and all rush requests are prepaid and can never be post paid.  
    Contact methods
    Discord: Ema#8360  
    Payment methods
    Paypal Crypto (BTC/Ether only) Western Union/Money Gram Bank Wire  
    Terms of Service
    With every requests you get a guaranteed Hercules compatibility for 1 year, In-case any of Hercules update during this period breaks my code you will be given an update upon request free of charge. After first year of the guaranteed compatibility period you will be charged a small fee for any updates, very simple updated may be still done for free and it's up to my judgement. In-case of paying with any other services than Crypto currency you're sole responsible of any fees the used service asks for, and that the net amount is at least equivalent to what i asked for. For medium/large projects a 50% deposit shall be paid, and it's nonrefundable as soon as i start working on it, rest being paid after project is done and delivered.  
    Pre-made (Coming soon)
    Client web settings saving/emblem/adventurer agency support (Soon)
  7. Upvote
    hemagx got a reaction from JulioCF in [RELEASED] RO Hooks, a nice set of modifications for your client   
    Hello! ~
    * Introduction
    RO Hooks is a paid project, which will allow a set of custom abilities to your client, such as player name coloring, server side GM sprite and such; It is is meant to be a way to edit this old dead game client to add things either improving player's experience or giving the ability to have new of content or to give your players something special.
     
    * What do we have currently
    GM Clothes and Robot Clothes controller server side (Robot Clothes is a Special Event Sprite) Player Name coloring (Server-side) Item Name Coloring (Client-Side) Messages Timestamp "inspired by Project Chaos RO (nachtwolke.ai4rei.com)" More to come  
    * Pictures
    - GM and Robot Clothes


    - Name Coloring




    - Colorizing Item Names (Configure client side, could be applied to any kind of items)

    - Messages Timestamp

    * Which Clients are supported?
    Pretty much anything 2012-04 and onward, older clients are also supported upon request.
    * Is there anything more? when is this supposed to be release? And can we suggest something?
    There's still other futures which will be announced soon, I'm pretty much working everyday to find something newer.
    It will be released as soon as we have enough set of custom futures, also any suggestions for features is more than welcome, as soon as anything new finished i will announce it here. Also as soon as it's ready for sell I will get a Paid Service topic.
     
  8. Upvote
    hemagx got a reaction from Easycore in [RELEASED] RO Hooks, a nice set of modifications for your client   
    Hello! ~
    * Introduction
    RO Hooks is a paid project, which will allow a set of custom abilities to your client, such as player name coloring, server side GM sprite and such; It is is meant to be a way to edit this old dead game client to add things either improving player's experience or giving the ability to have new of content or to give your players something special.
     
    * What do we have currently
    GM Clothes and Robot Clothes controller server side (Robot Clothes is a Special Event Sprite) Player Name coloring (Server-side) Item Name Coloring (Client-Side) Messages Timestamp "inspired by Project Chaos RO (nachtwolke.ai4rei.com)" More to come  
    * Pictures
    - GM and Robot Clothes


    - Name Coloring




    - Colorizing Item Names (Configure client side, could be applied to any kind of items)

    - Messages Timestamp

    * Which Clients are supported?
    Pretty much anything 2012-04 and onward, older clients are also supported upon request.
    * Is there anything more? when is this supposed to be release? And can we suggest something?
    There's still other futures which will be announced soon, I'm pretty much working everyday to find something newer.
    It will be released as soon as we have enough set of custom futures, also any suggestions for features is more than welcome, as soon as anything new finished i will announce it here. Also as soon as it's ready for sell I will get a Paid Service topic.
     
  9. Upvote
    hemagx got a reaction from Maple in [RELEASED] RO Hooks, a nice set of modifications for your client   
    Hello! ~
    * Introduction
    RO Hooks is a paid project, which will allow a set of custom abilities to your client, such as player name coloring, server side GM sprite and such; It is is meant to be a way to edit this old dead game client to add things either improving player's experience or giving the ability to have new of content or to give your players something special.
     
    * What do we have currently
    GM Clothes and Robot Clothes controller server side (Robot Clothes is a Special Event Sprite) Player Name coloring (Server-side) Item Name Coloring (Client-Side) Messages Timestamp "inspired by Project Chaos RO (nachtwolke.ai4rei.com)" More to come  
    * Pictures
    - GM and Robot Clothes


    - Name Coloring




    - Colorizing Item Names (Configure client side, could be applied to any kind of items)

    - Messages Timestamp

    * Which Clients are supported?
    Pretty much anything 2012-04 and onward, older clients are also supported upon request.
    * Is there anything more? when is this supposed to be release? And can we suggest something?
    There's still other futures which will be announced soon, I'm pretty much working everyday to find something newer.
    It will be released as soon as we have enough set of custom futures, also any suggestions for features is more than welcome, as soon as anything new finished i will announce it here. Also as soon as it's ready for sell I will get a Paid Service topic.
     
  10. Upvote
    hemagx got a reaction from Maple in [RELEASED] RO Hooks, a nice set of modifications for your client   
    Keep watching the topic to know when It's available.
    I was kinda busy, but I kinda "made my own" messy version of this command. will update the topic after i finish re-write the whole thing.
  11. Upvote
    hemagx got a reaction from Legend in [RELEASED] RO Hooks, a nice set of modifications for your client   
    Hello! ~
    * Introduction
    RO Hooks is a paid project, which will allow a set of custom abilities to your client, such as player name coloring, server side GM sprite and such; It is is meant to be a way to edit this old dead game client to add things either improving player's experience or giving the ability to have new of content or to give your players something special.
     
    * What do we have currently
    GM Clothes and Robot Clothes controller server side (Robot Clothes is a Special Event Sprite) Player Name coloring (Server-side) Item Name Coloring (Client-Side) Messages Timestamp "inspired by Project Chaos RO (nachtwolke.ai4rei.com)" More to come  
    * Pictures
    - GM and Robot Clothes


    - Name Coloring




    - Colorizing Item Names (Configure client side, could be applied to any kind of items)

    - Messages Timestamp

    * Which Clients are supported?
    Pretty much anything 2012-04 and onward, older clients are also supported upon request.
    * Is there anything more? when is this supposed to be release? And can we suggest something?
    There's still other futures which will be announced soon, I'm pretty much working everyday to find something newer.
    It will be released as soon as we have enough set of custom futures, also any suggestions for features is more than welcome, as soon as anything new finished i will announce it here. Also as soon as it's ready for sell I will get a Paid Service topic.
     
  12. Upvote
    hemagx got a reaction from natural in [RELEASED] RO Hooks, a nice set of modifications for your client   
    Hello! ~
    * Introduction
    RO Hooks is a paid project, which will allow a set of custom abilities to your client, such as player name coloring, server side GM sprite and such; It is is meant to be a way to edit this old dead game client to add things either improving player's experience or giving the ability to have new of content or to give your players something special.
     
    * What do we have currently
    GM Clothes and Robot Clothes controller server side (Robot Clothes is a Special Event Sprite) Player Name coloring (Server-side) Item Name Coloring (Client-Side) Messages Timestamp "inspired by Project Chaos RO (nachtwolke.ai4rei.com)" More to come  
    * Pictures
    - GM and Robot Clothes


    - Name Coloring




    - Colorizing Item Names (Configure client side, could be applied to any kind of items)

    - Messages Timestamp

    * Which Clients are supported?
    Pretty much anything 2012-04 and onward, older clients are also supported upon request.
    * Is there anything more? when is this supposed to be release? And can we suggest something?
    There's still other futures which will be announced soon, I'm pretty much working everyday to find something newer.
    It will be released as soon as we have enough set of custom futures, also any suggestions for features is more than welcome, as soon as anything new finished i will announce it here. Also as soon as it's ready for sell I will get a Paid Service topic.
     
  13. Upvote
    hemagx got a reaction from caspe in [RELEASED] RO Hooks, a nice set of modifications for your client   
    Hello! ~
    * Introduction
    RO Hooks is a paid project, which will allow a set of custom abilities to your client, such as player name coloring, server side GM sprite and such; It is is meant to be a way to edit this old dead game client to add things either improving player's experience or giving the ability to have new of content or to give your players something special.
     
    * What do we have currently
    GM Clothes and Robot Clothes controller server side (Robot Clothes is a Special Event Sprite) Player Name coloring (Server-side) Item Name Coloring (Client-Side) Messages Timestamp "inspired by Project Chaos RO (nachtwolke.ai4rei.com)" More to come  
    * Pictures
    - GM and Robot Clothes


    - Name Coloring




    - Colorizing Item Names (Configure client side, could be applied to any kind of items)

    - Messages Timestamp

    * Which Clients are supported?
    Pretty much anything 2012-04 and onward, older clients are also supported upon request.
    * Is there anything more? when is this supposed to be release? And can we suggest something?
    There's still other futures which will be announced soon, I'm pretty much working everyday to find something newer.
    It will be released as soon as we have enough set of custom futures, also any suggestions for features is more than welcome, as soon as anything new finished i will announce it here. Also as soon as it's ready for sell I will get a Paid Service topic.
     
  14. Upvote
    hemagx got a reaction from KirieZ in [RELEASED] RO Hooks, a nice set of modifications for your client   
    Hello! ~
    * Introduction
    RO Hooks is a paid project, which will allow a set of custom abilities to your client, such as player name coloring, server side GM sprite and such; It is is meant to be a way to edit this old dead game client to add things either improving player's experience or giving the ability to have new of content or to give your players something special.
     
    * What do we have currently
    GM Clothes and Robot Clothes controller server side (Robot Clothes is a Special Event Sprite) Player Name coloring (Server-side) Item Name Coloring (Client-Side) Messages Timestamp "inspired by Project Chaos RO (nachtwolke.ai4rei.com)" More to come  
    * Pictures
    - GM and Robot Clothes


    - Name Coloring




    - Colorizing Item Names (Configure client side, could be applied to any kind of items)

    - Messages Timestamp

    * Which Clients are supported?
    Pretty much anything 2012-04 and onward, older clients are also supported upon request.
    * Is there anything more? when is this supposed to be release? And can we suggest something?
    There's still other futures which will be announced soon, I'm pretty much working everyday to find something newer.
    It will be released as soon as we have enough set of custom futures, also any suggestions for features is more than welcome, as soon as anything new finished i will announce it here. Also as soon as it's ready for sell I will get a Paid Service topic.
     
  15. Upvote
    hemagx got a reaction from bWolfie in [RELEASED] RO Hooks, a nice set of modifications for your client   
    Hello! ~
    * Introduction
    RO Hooks is a paid project, which will allow a set of custom abilities to your client, such as player name coloring, server side GM sprite and such; It is is meant to be a way to edit this old dead game client to add things either improving player's experience or giving the ability to have new of content or to give your players something special.
     
    * What do we have currently
    GM Clothes and Robot Clothes controller server side (Robot Clothes is a Special Event Sprite) Player Name coloring (Server-side) Item Name Coloring (Client-Side) Messages Timestamp "inspired by Project Chaos RO (nachtwolke.ai4rei.com)" More to come  
    * Pictures
    - GM and Robot Clothes


    - Name Coloring




    - Colorizing Item Names (Configure client side, could be applied to any kind of items)

    - Messages Timestamp

    * Which Clients are supported?
    Pretty much anything 2012-04 and onward, older clients are also supported upon request.
    * Is there anything more? when is this supposed to be release? And can we suggest something?
    There's still other futures which will be announced soon, I'm pretty much working everyday to find something newer.
    It will be released as soon as we have enough set of custom futures, also any suggestions for features is more than welcome, as soon as anything new finished i will announce it here. Also as soon as it's ready for sell I will get a Paid Service topic.
     
  16. Upvote
    hemagx got a reaction from tedexx in [RELEASED] RO Hooks, a nice set of modifications for your client   
    Hello! ~
    * Introduction
    RO Hooks is a paid project, which will allow a set of custom abilities to your client, such as player name coloring, server side GM sprite and such; It is is meant to be a way to edit this old dead game client to add things either improving player's experience or giving the ability to have new of content or to give your players something special.
     
    * What do we have currently
    GM Clothes and Robot Clothes controller server side (Robot Clothes is a Special Event Sprite) Player Name coloring (Server-side) Item Name Coloring (Client-Side) Messages Timestamp "inspired by Project Chaos RO (nachtwolke.ai4rei.com)" More to come  
    * Pictures
    - GM and Robot Clothes


    - Name Coloring




    - Colorizing Item Names (Configure client side, could be applied to any kind of items)

    - Messages Timestamp

    * Which Clients are supported?
    Pretty much anything 2012-04 and onward, older clients are also supported upon request.
    * Is there anything more? when is this supposed to be release? And can we suggest something?
    There's still other futures which will be announced soon, I'm pretty much working everyday to find something newer.
    It will be released as soon as we have enough set of custom futures, also any suggestions for features is more than welcome, as soon as anything new finished i will announce it here. Also as soon as it's ready for sell I will get a Paid Service topic.
     
  17. Upvote
    hemagx got a reaction from lucasavilez in Gold Times   
    Pst this may help too: http://web.archive.org/web/20080827220329/http://ro.doddlercon.com/wiki/
  18. 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]
  19. 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.
  20. Upvote
    hemagx got a reaction from evilpuncker in Clan System   
    Small update, i actually delayed it and not fully dropped
    i should be working on it again as soon as my next PR is ready (in 2 ~ 3 day)
  21. Upvote
    hemagx got a reaction from Legend in Clan System   
    Small update, i actually delayed it and not fully dropped
    i should be working on it again as soon as my next PR is ready (in 2 ~ 3 day)
  22. Upvote
    hemagx got a reaction from Nebraskka in [Collection] Sakura's Sprites 2016/9/21 Update,add 200+ headwear   
    that most perfect animation (and maybe even sprites) i've ever seen for RO
  23. Upvote
    hemagx reacted to a85771416 in [Collection] Sakura's Sprites 2016/9/21 Update,add 200+ headwear   
    Now you can see all sprite equiped preview in our website
     
     
     
    ────────────────9/21 Update   Headwear ────────────────
     

     
     
    ────────────────9/5 Update    Fairy walk ────────────────
     
     
     
     
    ────────────────9/3 Update    Fairy Fly────────────────
     

     
    ────────────────Before sprites,Wings────────────────
     
     
  24. Upvote
    hemagx reacted to Haru in Official VIP System   
    The reason why no one works on this "feature" is that, while being an official feature, it has nothing to do with the game. Its sole purpose is to monetize (which certainly isn't what players are looking for). If a private server owner wants to monetize (from a game they don't even own the rights for), they can invest some time, and develop a VIP system (and why not, make a pull request, we'd likely merge it, as long as it wouldn't impair the Hercules performance for those who want a vanilla Ragnarok experience).
     
    Hercules development is progressing (see the number of branches that are being worked on -- it's not only the feature that make it into master), but no one, including Ind, would want to spend their free time on something whose sole purpose is to make leechers earn money more easily. And I believe Ind was especially bitter about that aspect of the community, when he left.
  25. Upvote
    hemagx got a reaction from evilpuncker in [Guide] Create your server & Client (2016/08)   
    I would suggest to make MariaDB as the database softwear here instead of regular mysql, it proved to have greater performance.
×
×
  • Create New...

Important Information

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