Welcome!

Join our community of MMO enthusiasts and game developers! By registering, you'll gain access to discussions on the latest developments in MMO server files and collaborate with like-minded individuals. Join us today and unlock the potential of MMO server development!

Join Today!

Packets: PHP to NodeJS

Joined
Jul 17, 2007
Messages
665
Reaction score
104
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)


 

Attachments

You must be registered for see attachments list
Last edited:
Junior Spellweaver
Joined
May 18, 2014
Messages
151
Reaction score
57
Don't you need to sum the value in CUint function, like in PHP
PHP:
($value | 0x8000) for example?
Like so: 
[PHP]return this.WriteUByte(value + 0x80000, method);
And what about the ReadPacket? Looks more easier then Write. Anyway, amazing job! I like to see how Node is powerful :eek:tt:
 
Joined
Jul 17, 2007
Messages
665
Reaction score
104
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


 
Last edited:
Junior Spellweaver
Joined
May 18, 2014
Messages
151
Reaction score
57
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



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
 
Joined
Jul 17, 2007
Messages
665
Reaction score
104
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)
 
Junior Spellweaver
Joined
May 18, 2014
Messages
151
Reaction score
57
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.
 
Joined
Jul 17, 2007
Messages
665
Reaction score
104
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)


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)


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:
Junior Spellweaver
Joined
May 18, 2014
Messages
151
Reaction score
57
it is similiar now too except scheme have:
- octets,
- array,
- string,
- uint32,
- uint16,
- int8,
- byte,
- float
example for role data (included unit16 - storesize)


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)


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.
 
Back
Top