Packets: PHP to NodeJS

Results 1 to 10 of 10
  1. #1
    Account Upgraded | Title Enabled! shadowvzs is offline
    MemberRank
    Jul 2007 Join Date
    RomaniaLocation
    678Posts

    Packets: PHP to NodeJS

    i started the play with nodeJS 10+ and binary/buffer/packet sending, if someone got idea or advice then here the mail sending & chat server (well i tryed on 1.4.2 not on newer pw but nah):

    Features (testing on 1.4.2 v27/29):

    * Chat:
    ---- send

    * GM
    ---- getOnlineList
    ---- ban

    * Guild
    ---- list all guild
    ---- load current guild
    ---- change rank in guild
    ---- create guild

    * Mail
    ---- sendSysMail
    ---- sendGold

    * Role
    ---- load
    ---- save
    ---- reset
    ---- delete
    ---- ban
    ---- rename
    ---- getGuild

    * Territory
    ---- getList

    * User
    ---- roleList
    ---- setGold (instant set shop gold and wipe the gold history)
    ---- getInfo (gold bought, spent, roleid etc)


    https://github.com/shadowvzs/pwTools
    Attached Thumbnails Attached Thumbnails deepinscreenshot_20190112011717.png   deepinscreenshot_20190112011714.png   deepinscreenshot_20190112012334.png  
    Last edited by shadowvzs; 13-01-19 at 08:49 PM.


  2. #2
    Proficient Member w3bm4ster is offline
    MemberRank
    May 2014 Join Date
    CanadaLocation
    154Posts

    Re: Packets: PHP to NodeJS

    Don't you need to sum the value in CUint function, like in PHP [PHP]($value | 0x8000) for example?
    Like so:
    PHP Code:
    return this.WriteUByte(value 0x80000method); 
    And what about the ReadPacket? Looks more easier then Write. Anyway, amazing job! I like to see how Node is powerful

  3. #3
    Account Upgraded | Title Enabled! shadowvzs is offline
    MemberRank
    Jul 2007 Join Date
    RomaniaLocation
    678Posts

    Re: Packets: PHP to NodeJS

    honestly this isn't finished yet, i still working on it

    last mofications:
    - i restructured how role read work
    - changed read packets
    - added async/await for roles because but be useable for api


    https://github.com/shadowvzs/pwTools
    Last edited by shadowvzs; 08-01-19 at 07:40 AM.

  4. #4
    Proficient Member w3bm4ster is offline
    MemberRank
    May 2014 Join Date
    CanadaLocation
    154Posts

    Re: Packets: PHP to NodeJS

    Quote Originally Posted by shadowvzs View Post
    honestly this isn't finished yet, i still working on it

    last mofications:
    - i restructured how role read work
    - changed read packets
    - added async/await for roles because but be useable for api


    https://github.com/shadowvzs/pwTools
    I see the GitHub. Well, even if you haven't finished It's an awesome progress!

    My suggestions:
    - Clean up Promises a little bit and structure of packets (it's completely bind to functions name)
    - Add some checks to the Read Packet
    - Instead of put service IP/port at index, leave directly in Packet File

  5. #5
    Account Upgraded | Title Enabled! shadowvzs is offline
    MemberRank
    Jul 2007 Join Date
    RomaniaLocation
    678Posts

    Re: Packets: PHP to NodeJS

    Quote Originally Posted by w3bm4ster View Post
    I see the GitHub. Well, even if you haven't finished It's an awesome progress!

    My suggestions:
    - Clean up Promises a little bit and structure of packets (it's completely bind to functions name)
    - Add some checks to the Read Packet
    - Instead of put service IP/port at index, leave directly in Packet File
    Thank you for constructive feedback
    - i noticed my silly mistakes at promise, i fixed the promise.all
    - what checks do you mean? i added schemes which extract data based on scheme and i use try catch now
    - host i can add in packet.js but port i can't since at moment i have 3-4 stuff (chat/mail/read user roles/ read role data) and totally 3 different ip (29100, 29300, 29400)

  6. #6
    Account Upgraded | Title Enabled! shadowvzs is offline
    MemberRank
    Jul 2007 Join Date
    RomaniaLocation
    678Posts

    Re: Packets: PHP to NodeJS

    well i updated my list, if you have other idea or suggestion/advice then that is welcome/so tell me :)

  7. #7
    Proficient Member w3bm4ster is offline
    MemberRank
    May 2014 Join Date
    CanadaLocation
    154Posts

    Re: Packets: PHP to NodeJS

    I see. And yes, it's only IP (I don't know why I typed host) >_>

    I believe you can improve the scheme and this is not actually my tip, because it's a pattern from an old panel shared throughout PWPS forums. Just simply use ["int", "cuint", "float"] and then create a function that receives the struct and the data, iterate through them and use a switch case to unpack based on data type. With this approach, I believe will look more cleaner.

  8. #8
    Account Upgraded | Title Enabled! shadowvzs is offline
    MemberRank
    Jul 2007 Join Date
    RomaniaLocation
    678Posts

    Re: Packets: PHP to NodeJS

    Quote Originally Posted by w3bm4ster View Post
    I see. And yes, it's only IP (I don't know why I typed host) >_>

    I believe you can improve the scheme and this is not actually my tip, because it's a pattern from an old panel shared throughout PWPS forums. Just simply use ["int", "cuint", "float"] and then create a function that receives the struct and the data, iterate through them and use a switch case to unpack based on data type. With this approach, I believe will look more cleaner.
    it is similiar now too except scheme have:
    - octets,
    - array,
    - string,
    - uint32,
    - uint16,
    - int8,
    - byte,
    - float
    example for role data (included unit16 - storesize)
    https://github.com/shadowvzs/pwTools.../roleScheme.js

    i need to have array too because its exact a group of data with a simple/signle scheme like items (same pattern if inventory/equipment/fashion/material or storehouse, task items or cards)

    https://github.com/shadowvzs/pwTools...ter/Packets.js
    WritePacket.PackAll(scheme, data, protocol) - use same scheme like
    ReadPacket.UnpackAll(scheme, data) - same scheme

    idk, so you say current system is inefficient?

    [EDIT]
    btw added more function and screenshot from last 2
    Last edited by shadowvzs; 12-01-19 at 12:28 AM.

  9. #9
    Proficient Member w3bm4ster is offline
    MemberRank
    May 2014 Join Date
    CanadaLocation
    154Posts

    Re: Packets: PHP to NodeJS

    Quote Originally Posted by shadowvzs View Post
    it is similiar now too except scheme have:
    - octets,
    - array,
    - string,
    - uint32,
    - uint16,
    - int8,
    - byte,
    - float
    example for role data (included unit16 - storesize)
    https://github.com/shadowvzs/pwTools.../roleScheme.js

    i need to have array too because its exact a group of data with a simple/signle scheme like items (same pattern if inventory/equipment/fashion/material or storehouse, task items or cards)

    https://github.com/shadowvzs/pwTools...ter/Packets.js
    WritePacket.PackAll(scheme, data, protocol) - use same scheme like
    ReadPacket.UnpackAll(scheme, data) - same scheme

    idk, so you say current system is inefficient?

    [EDIT]
    btw added more function and screenshot from last 2
    Nop. My suggestion was merely aesthetic.

  10. #10
    Account Upgraded | Title Enabled! shadowvzs is offline
    MemberRank
    Jul 2007 Join Date
    RomaniaLocation
    678Posts

    Re: Packets: PHP to NodeJS

    updated and added tw land info listing, get role guild etc



Advertisement