mirror of
https://github.com/CPunch/gopenfusion.git
synced 2024-12-04 22:46:32 +00:00
Compare commits
2 Commits
5c7b9bf9fb
...
52f0c4b1c7
Author | SHA1 | Date | |
---|---|---|---|
52f0c4b1c7 | |||
bf1e9d1350 |
@ -2,6 +2,10 @@
|
|||||||
|
|
||||||
A toy implementation of the [Fusionfall Packet Protocol](https://openpunk.com/pages/fusionfall-openfusion/) written in Go.
|
A toy implementation of the [Fusionfall Packet Protocol](https://openpunk.com/pages/fusionfall-openfusion/) written in Go.
|
||||||
|
|
||||||
|
## Login Sever
|
||||||
|
|
||||||
|
An example login server implementation exists in `server/`. This implementation should be compatible with existing OpenFusion databases, however this only exists as an example and doesn't direct clients to a shard server (they're softlocked after the tutorial, or during character selection).
|
||||||
|
|
||||||
## Generating structures
|
## Generating structures
|
||||||
|
|
||||||
Dump and decompile the `Assembly - CSharp.dll` assembly from the fusionfall main.unity3d, using a tool like [ilspycmd](https://www.nuget.org/packages/ilspycmd/). The full output source can then be passed to `genstructs.py` script located in `tools/`, which will handle scraping constants and calculating structure padding. See the script for details on usage.
|
Dump and decompile the `Assembly - CSharp.dll` assembly from the fusionfall main.unity3d, using a tool like [ilspycmd](https://www.nuget.org/packages/ilspycmd/). The full output source can then be passed to `genstructs.py` script located in `tools/`, which will handle scraping constants and calculating structure padding. See the script for details on usage.
|
@ -5,7 +5,7 @@ import (
|
|||||||
|
|
||||||
"golang.org/x/crypto/bcrypt"
|
"golang.org/x/crypto/bcrypt"
|
||||||
|
|
||||||
"github.com/CPunch/GopenFusion/protocol"
|
"github.com/CPunch/gopenfusion/protocol"
|
||||||
"github.com/blockloop/scan"
|
"github.com/blockloop/scan"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@ -3,7 +3,7 @@ package db
|
|||||||
import (
|
import (
|
||||||
"database/sql"
|
"database/sql"
|
||||||
|
|
||||||
"github.com/CPunch/GopenFusion/protocol"
|
"github.com/CPunch/gopenfusion/protocol"
|
||||||
)
|
)
|
||||||
|
|
||||||
type Inventory struct {
|
type Inventory struct {
|
||||||
|
@ -3,8 +3,8 @@ package db
|
|||||||
import (
|
import (
|
||||||
"database/sql"
|
"database/sql"
|
||||||
|
|
||||||
"github.com/CPunch/GopenFusion/config"
|
"github.com/CPunch/gopenfusion/config"
|
||||||
"github.com/CPunch/GopenFusion/protocol"
|
"github.com/CPunch/gopenfusion/protocol"
|
||||||
"github.com/blockloop/scan"
|
"github.com/blockloop/scan"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
2
go.mod
2
go.mod
@ -1,4 +1,4 @@
|
|||||||
module github.com/CPunch/GopenFusion
|
module github.com/CPunch/gopenfusion
|
||||||
|
|
||||||
go 1.19
|
go 1.19
|
||||||
|
|
||||||
|
4
main.go
4
main.go
@ -1,8 +1,8 @@
|
|||||||
package main
|
package main
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"github.com/CPunch/GopenFusion/db"
|
"github.com/CPunch/gopenfusion/db"
|
||||||
"github.com/CPunch/GopenFusion/server"
|
"github.com/CPunch/gopenfusion/server"
|
||||||
)
|
)
|
||||||
|
|
||||||
func main() {
|
func main() {
|
||||||
|
@ -5,10 +5,10 @@ import (
|
|||||||
"fmt"
|
"fmt"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
"github.com/CPunch/GopenFusion/config"
|
"github.com/CPunch/gopenfusion/config"
|
||||||
"github.com/CPunch/GopenFusion/db"
|
"github.com/CPunch/gopenfusion/db"
|
||||||
"github.com/CPunch/GopenFusion/protocol"
|
"github.com/CPunch/gopenfusion/protocol"
|
||||||
"github.com/CPunch/GopenFusion/util"
|
"github.com/CPunch/gopenfusion/util"
|
||||||
)
|
)
|
||||||
|
|
||||||
const (
|
const (
|
||||||
@ -211,7 +211,7 @@ func (server *LoginServer) CharacterCreate(peer *Peer, pkt *protocol.Packet) {
|
|||||||
ILevel: int16(plr.Level),
|
ILevel: int16(plr.Level),
|
||||||
SPC_Style: PCStyle,
|
SPC_Style: PCStyle,
|
||||||
SPC_Style2: PCStyle2,
|
SPC_Style2: PCStyle2,
|
||||||
SOn_Item: charPkt.SOn_Item, // if the items were faked, we don't really care since the db only stores the sanitized fields
|
SOn_Item: charPkt.SOn_Item, // if items were faked, we don't really care since the db only stores the sanitized fields
|
||||||
}, protocol.P_LS2CL_REP_CHAR_CREATE_SUCC)
|
}, protocol.P_LS2CL_REP_CHAR_CREATE_SUCC)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -5,13 +5,13 @@ import (
|
|||||||
"net"
|
"net"
|
||||||
"sync"
|
"sync"
|
||||||
|
|
||||||
"github.com/CPunch/GopenFusion/protocol"
|
"github.com/CPunch/gopenfusion/protocol"
|
||||||
)
|
)
|
||||||
|
|
||||||
type LoginServer struct {
|
type LoginServer struct {
|
||||||
listener net.Listener
|
listener net.Listener
|
||||||
peers map[*Peer]bool
|
peers map[*Peer]bool
|
||||||
lock sync.Mutex
|
peersLock sync.Mutex
|
||||||
}
|
}
|
||||||
|
|
||||||
func NewLoginServer() *LoginServer {
|
func NewLoginServer() *LoginServer {
|
||||||
@ -78,13 +78,13 @@ func (server *LoginServer) HandlePacket(peer *Peer, typeID uint32, pkt *protocol
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (server *LoginServer) Disconnect(peer *Peer) {
|
func (server *LoginServer) Disconnect(peer *Peer) {
|
||||||
server.lock.Lock()
|
server.peersLock.Lock()
|
||||||
delete(server.peers, peer)
|
delete(server.peers, peer)
|
||||||
server.lock.Unlock()
|
server.peersLock.Unlock()
|
||||||
}
|
}
|
||||||
|
|
||||||
func (server *LoginServer) Connect(peer *Peer) {
|
func (server *LoginServer) Connect(peer *Peer) {
|
||||||
server.lock.Lock()
|
server.peersLock.Lock()
|
||||||
server.peers[peer] = true
|
server.peers[peer] = true
|
||||||
server.lock.Unlock()
|
server.peersLock.Unlock()
|
||||||
}
|
}
|
||||||
|
@ -6,8 +6,8 @@ import (
|
|||||||
"log"
|
"log"
|
||||||
"net"
|
"net"
|
||||||
|
|
||||||
"github.com/CPunch/GopenFusion/db"
|
"github.com/CPunch/gopenfusion/db"
|
||||||
"github.com/CPunch/GopenFusion/protocol"
|
"github.com/CPunch/gopenfusion/protocol"
|
||||||
)
|
)
|
||||||
|
|
||||||
const (
|
const (
|
||||||
|
@ -1,8 +1,8 @@
|
|||||||
package util
|
package util
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"github.com/CPunch/GopenFusion/db"
|
"github.com/CPunch/gopenfusion/db"
|
||||||
"github.com/CPunch/GopenFusion/protocol"
|
"github.com/CPunch/gopenfusion/protocol"
|
||||||
)
|
)
|
||||||
|
|
||||||
func Player2PCStyle(plr *db.Player) (protocol.SPCStyle, protocol.SPCStyle2) {
|
func Player2PCStyle(plr *db.Player) (protocol.SPCStyle, protocol.SPCStyle2) {
|
||||||
|
Loading…
Reference in New Issue
Block a user