diff --git a/.github/workflows/go.yml b/.github/workflows/go.yml index d8a1ccac2..2f56c0f75 100644 --- a/.github/workflows/go.yml +++ b/.github/workflows/go.yml @@ -1,10 +1,10 @@ -name: Erupe +name: Build on: [push] jobs: build: - runs-on: windows-latest + runs-on: ubuntu-latest steps: - uses: actions/checkout@v3 @@ -14,14 +14,32 @@ jobs: with: go-version: 1.18 - - name: Build - run: cd Erupe && go build -v + - name: Build Linux-amd64 + run: env GOOS=linux GOARCH=amd64 go build -v - - name: Upload artifacts + - name: Upload Linux-amd64 artifacts uses: actions/upload-artifact@v3 with: - name: Erupe + name: Linux-amd64 path: | - ./Erupe/erupe-ce.exe - ./Erupe/config.json - ./Erupe/www/ + ./erupe-ce + ./config.json + ./www/ + ./savedata/ + ./bin/ + ./RoadShopItems.csv + + - name: Build Windows-amd64 + run: env GOOS=windows GOARCH=amd64 go build -v + + - name: Upload Windows-amd64 artifacts + uses: actions/upload-artifact@v3 + with: + name: Windows-amd64 + path: | + ./erupe-ce.exe + ./config.json + ./www/ + ./savedata/ + ./bin/ + ./RoadShopItems.csv diff --git a/.gitignore b/.gitignore index 9f11b755a..38fdf2e18 100644 --- a/.gitignore +++ b/.gitignore @@ -1 +1,14 @@ .idea/ + +www/jp/ +vendor/ +bin/*.bin +bin/*.bak +bin/quests/*.bin +bin/questlists/*.bin +bin/scenarios/*.bin +bin/debug/*.bin +savedata/*/ +*.exe +*.lnk +*.bat \ No newline at end of file diff --git a/Erupe/.gitignore b/Erupe/.gitignore deleted file mode 100644 index 1104dc972..000000000 --- a/Erupe/.gitignore +++ /dev/null @@ -1,14 +0,0 @@ -www/jp/ - -.idea/ -vendor/ -bin/*.bin -bin/*.bak -bin/quests/*.bin -bin/questlists/*.bin -bin/scenarios/*.bin -bin/debug/*.bin -savedata/ -Erupe.exe -*.lnk -*.bat diff --git a/Erupe/Event List.txt b/Erupe/Event List.txt deleted file mode 100644 index 7c6838e8d..000000000 --- a/Erupe/Event List.txt +++ /dev/null @@ -1 +0,0 @@ - 0 is no event, 1 is "Week 1 Timestamp (broken), 2 is "Week 2 Timestamp (broken), 3 is Diva Defense \ No newline at end of file diff --git a/Erupe/Gifts/Cadeaux.bin b/Erupe/Gifts/Cadeaux.bin deleted file mode 100644 index 2d3e24319..000000000 Binary files a/Erupe/Gifts/Cadeaux.bin and /dev/null differ diff --git a/Erupe/Gifts/Description.bin b/Erupe/Gifts/Description.bin deleted file mode 100644 index 957f9e111..000000000 Binary files a/Erupe/Gifts/Description.bin and /dev/null differ diff --git a/Erupe/README.md b/Erupe/README.md deleted file mode 100644 index 15a1fca6c..000000000 --- a/Erupe/README.md +++ /dev/null @@ -1,83 +0,0 @@ -# Erupe -## WARNING -This project is in its infancy and has no reliable active developer, no documentation, and no support. - -# General info -Currently allows a JP MHF client (with GameGuard removed) to: -* Login and register an account (registration is automatic if account doesn't exist) -* Create a character -* Get ingame to the main city -* See other players walk around -* Do quests -* Use chat* - -# Installation -## Server -1. Clone the repo with `git clone https://github.com/Andoryuuta/Erupe.git` -2. Install PostgreSQL -3. Launch psql shell, `CREATE DATABASE erupe;`. -4. Setup database with golang-migrate: - - Windows: - ``` - > go get -tags 'postgres' -u github.com/golang-migrate/migrate/v4/cmd/migrate/ - - > set POSTGRESQL_URL=postgres://postgres:password@localhost:5432/erupe?sslmode=disable - - > cd erupe - - > migrate -database %POSTGRESQL_URL% -path migrations up - ``` - - Linux: - ``` - > go get -tags 'postgres' -u github.com/golang-migrate/migrate/v4/cmd/migrate/ - - > export POSTGRESQL_URL=postgres://postgres:password@localhost:5432/erupe?sslmode=disable - - > cd erupe - - > migrate -database $POSTGRESQL_URL -path migrations up - ``` - - (Replacing `postgres:password` with your postgres username and password) - -5. Edit the config.json - - Namely: - * Update the database username and password - * Update the `host_ip` and `ip` fields (there are multiple) to your external IP if you are hosting for multiple clients. - -6. Place quest/scenario binaries. - - The quest and scenario binary files should be placed in `bin/quests/` and `bin/scenarios` respectively. - -## Launcher -Erupe ships with a rudimentary custom launcher, so you don't need to obtain the original TW/JP files to simply get ingame. However, it does still support using the original files if you choose to. To set this up, place a copy of the original launcher html/js/css in `./www/tw/`, and `/www/jp/` for the TW and JP files respectively. - -Then, modify the the `/launcher/js/launcher.js` file as such: -* Find the call to `startUpdateProcess();` in a case statement and replace it with `finishUpdateProcess();`. (This disables the file check and updating) -* (JP ONLY): replace all uses of "https://" with "http://" in the file. - -Finally, edit the config.json and set `UseOriginalLauncherFiles` to `true` under the launcher settings. - -# Usage -### Note: If you are switching to/from the custom launcher html, you will have to clear your IE cache @ `C:\Users\\AppData\Local\Microsoft\Windows\INetCache`. - -## Server -``` -cd Erupe -go run . -``` - -## Client -Add to hosts: -``` -127.0.0.1 mhfg.capcom.com.tw -127.0.0.1 mhf-n.capcom.com.tw -127.0.0.1 cog-members.mhf-z.jp -127.0.0.1 www.capcom-onlinegames.jp -127.0.0.1 srv-mhf.capcom-networks.jp -``` - -Run mhf.exe normally (with locale emulator or appropriate timezone). diff --git a/Erupe/airouv2.sql b/Erupe/airouv2.sql deleted file mode 100644 index e9573bd43..000000000 --- a/Erupe/airouv2.sql +++ /dev/null @@ -1,5 +0,0 @@ -BEGIN; - -CREATE SEQUENCE IF NOT EXISTS public.airou_id_seq; - -END; diff --git a/Erupe/common/pascalstring/pascalstring.go b/Erupe/common/pascalstring/pascalstring.go deleted file mode 100644 index 8c815b097..000000000 --- a/Erupe/common/pascalstring/pascalstring.go +++ /dev/null @@ -1,46 +0,0 @@ -package pascalstring - -import ( - "erupe-ce/common/byteframe" - "golang.org/x/text/encoding/japanese" - "golang.org/x/text/transform" -) - -func Uint8(bf *byteframe.ByteFrame, x string, t bool) { - if t { - e := japanese.ShiftJIS.NewEncoder() - xt, _, err := transform.String(e, x) - if err != nil { - panic(err) - } - x = xt - } - bf.WriteUint8(uint8(len(x) + 1)) - bf.WriteNullTerminatedBytes([]byte(x)) -} - -func Uint16(bf *byteframe.ByteFrame, x string, t bool) { - if t { - e := japanese.ShiftJIS.NewEncoder() - xt, _, err := transform.String(e, x) - if err != nil { - panic(err) - } - x = xt - } - bf.WriteUint16(uint16(len(x) + 1)) - bf.WriteNullTerminatedBytes([]byte(x)) -} - -func Uint32(bf *byteframe.ByteFrame, x string, t bool) { - if t { - e := japanese.ShiftJIS.NewEncoder() - xt, _, err := transform.String(e, x) - if err != nil { - panic(err) - } - x = xt - } - bf.WriteUint32(uint32(len(x) + 1)) - bf.WriteNullTerminatedBytes([]byte(x)) -} diff --git a/Erupe/distitem.sql b/Erupe/distitem.sql deleted file mode 100644 index a72e26fa8..000000000 --- a/Erupe/distitem.sql +++ /dev/null @@ -1,26 +0,0 @@ -BEGIN; -CREATE TABLE IF NOT EXISTS public.distribution -( - id serial NOT NULL PRIMARY KEY, - character_id int, - type int NOT NULL, - deadline timestamp without time zone, - event_name text NOT NULL DEFAULT 'GM Gift!', - description text NOT NULL DEFAULT '~C05You received a gift!', - times_acceptable int NOT NULL DEFAULT 1, - min_hr int NOT NULL DEFAULT 65535, - max_hr int NOT NULL DEFAULT 65535, - min_sr int NOT NULL DEFAULT 65535, - max_sr int NOT NULL DEFAULT 65535, - min_gr int NOT NULL DEFAULT 65535, - max_gr int NOT NULL DEFAULT 65535, - data bytea NOT NULL -); - -CREATE TABLE IF NOT EXISTS public.distributions_accepted -( - distribution_id int, - character_id int -); - -END; \ No newline at end of file diff --git a/Erupe/gook.sql b/Erupe/gook.sql deleted file mode 100644 index 92364862d..000000000 --- a/Erupe/gook.sql +++ /dev/null @@ -1,26 +0,0 @@ -BEGIN; - -ALTER TABLE IF EXISTS public.gook - DROP COLUMN IF EXISTS gook0status; - -ALTER TABLE IF EXISTS public.gook - DROP COLUMN IF EXISTS gook1status; - -ALTER TABLE IF EXISTS public.gook - DROP COLUMN IF EXISTS gook2status; - -ALTER TABLE IF EXISTS public.gook - DROP COLUMN IF EXISTS gook3status; - -ALTER TABLE IF EXISTS public.gook - DROP COLUMN IF EXISTS gook4status; - -ALTER TABLE IF EXISTS public.gook - DROP COLUMN IF EXISTS gook5status; - -ALTER TABLE IF EXISTS public.gook - DROP COLUMN IF EXISTS gook5; - -UPDATE public.gook SET gook0=NULL, gook1=NULL, gook2=NULL, gook3=NULL, gook4=NULL; - -END; \ No newline at end of file diff --git a/Erupe/guild-additions.sql b/Erupe/guild-additions.sql deleted file mode 100644 index 8d98ccf82..000000000 --- a/Erupe/guild-additions.sql +++ /dev/null @@ -1,56 +0,0 @@ -BEGIN; - -ALTER TABLE IF EXISTS public.guilds - ADD COLUMN IF NOT EXISTS pugi_name_1 varchar(12) DEFAULT ''; -ALTER TABLE IF EXISTS public.guilds - ADD COLUMN IF NOT EXISTS pugi_name_2 varchar(12) DEFAULT ''; -ALTER TABLE IF EXISTS public.guilds - ADD COLUMN IF NOT EXISTS pugi_name_3 varchar(12) DEFAULT ''; - -CREATE TABLE IF NOT EXISTS public.guild_alliances -( - id serial NOT NULL PRIMARY KEY, - name varchar(24) NOT NULL, - created_at timestamp without time zone NOT NULL DEFAULT now(), - parent_id int NOT NULL, - sub1_id int, - sub2_id int -); - -CREATE TABLE IF NOT EXISTS public.guild_adventures -( - id serial NOT NULL PRIMARY KEY, - guild_id int NOT NULL, - destination int NOT NULL, - charge int NOT NULL DEFAULT 0, - depart int NOT NULL, - return int NOT NULL, - collected_by text NOT NULL DEFAULT '' -); - -CREATE TABLE IF NOT EXISTS public.guild_meals -( - id serial NOT NULL PRIMARY KEY, - guild_id int NOT NULL, - meal_id int NOT NULL, - level int NOT NULL, - expires int NOT NULL -); - -CREATE TABLE IF NOT EXISTS public.guild_hunts -( - id serial NOT NULL PRIMARY KEY, - guild_id int NOT NULL, - host_id int NOT NULL, - destination int NOT NULL, - level int NOT NULL, - return int NOT NULL, - acquired bool NOT NULL DEFAULT false, - claimed bool NOT NULL DEFAULT false, - hunters text NOT NULL DEFAULT '', - treasure text NOT NULL DEFAULT '', - hunt_data bytea NOT NULL, - cats_used text NOT NULL -); - -END; \ No newline at end of file diff --git a/Erupe/houseinterior.sql b/Erupe/houseinterior.sql deleted file mode 100644 index ad0687ce7..000000000 --- a/Erupe/houseinterior.sql +++ /dev/null @@ -1,6 +0,0 @@ -BEGIN; - -ALTER TABLE IF EXISTS public.characters - ADD COLUMN IF NOT EXISTS house bytea; - -END; \ No newline at end of file diff --git a/Erupe/road-shop-rotation.sql b/Erupe/road-shop-rotation.sql deleted file mode 100644 index bfd9f9e4e..000000000 --- a/Erupe/road-shop-rotation.sql +++ /dev/null @@ -1,35 +0,0 @@ -BEGIN; -CREATE TABLE IF NOT EXISTS public.normal_shop_items -( - shoptype integer, - shopid integer, - itemhash integer not null, - itemid integer, - points integer, - tradequantity integer, - rankreqlow integer, - rankreqhigh integer, - rankreqg integer, - storelevelreq integer, - maximumquantity integer, - boughtquantity integer, - roadfloorsrequired integer, - weeklyfataliskills integer, - enable_weeks character varying(8) -); - -ALTER TABLE IF EXISTS public.normal_shop_items - ADD COLUMN IF NOT EXISTS enable_weeks character varying(8); - -CREATE TABLE IF NOT EXISTS public.shop_item_state -( - char_id bigint REFERENCES characters (id), - itemhash int UNIQUE NOT NULL, - usedquantity int, - week int -); - -ALTER TABLE IF EXISTS public.shop_item_state - ADD COLUMN IF NOT EXISTS week int; - -END; \ No newline at end of file diff --git a/Erupe/scenariocounter.sql b/Erupe/scenariocounter.sql deleted file mode 100644 index 4b3b99616..000000000 --- a/Erupe/scenariocounter.sql +++ /dev/null @@ -1,9 +0,0 @@ -BEGIN; - -ALTER TABLE IF EXISTS public.characters - ADD COLUMN IF NOT EXISTS scenariodata bytea; - -ALTER TABLE IF EXISTS public.characters - ADD COLUMN IF NOT EXISTS savefavoritequest bytea; - -END; \ No newline at end of file diff --git a/Erupe/server/channelserver/handlers_users.go b/Erupe/server/channelserver/handlers_users.go deleted file mode 100644 index 482d83674..000000000 --- a/Erupe/server/channelserver/handlers_users.go +++ /dev/null @@ -1,122 +0,0 @@ -package channelserver - -import ( - "encoding/base64" - "fmt" - - "erupe-ce/common/byteframe" - "erupe-ce/network/mhfpacket" -) - -func handleMsgSysInsertUser(s *Session, p mhfpacket.MHFPacket) {} - -func handleMsgSysDeleteUser(s *Session, p mhfpacket.MHFPacket) {} - -func broadcastNewUser(s *Session) { - s.logger.Debug(fmt.Sprintf("Broadcasting new user: %s (%d)", s.Name, s.charID)) - - clientNotif := byteframe.NewByteFrame() - var temp mhfpacket.MHFPacket - for _, session := range s.server.sessions { - if session == s || !session.binariesDone { - continue - } - temp = &mhfpacket.MsgSysInsertUser{CharID: session.charID} - clientNotif.WriteUint16(uint16(temp.Opcode())) - temp.Build(clientNotif, s.clientContext) - for i := 0; i < 3; i++ { - temp = &mhfpacket.MsgSysNotifyUserBinary{ - CharID: session.charID, - BinaryType: uint8(i + 1), - } - clientNotif.WriteUint16(uint16(temp.Opcode())) - temp.Build(clientNotif, s.clientContext) - } - } - s.QueueSend(clientNotif.Data()) - - serverNotif := byteframe.NewByteFrame() - temp = &mhfpacket.MsgSysInsertUser{CharID: s.charID} - serverNotif.WriteUint16(uint16(temp.Opcode())) - temp.Build(serverNotif, s.clientContext) - for i := 0; i < 3; i++ { - temp = &mhfpacket.MsgSysNotifyUserBinary{ - CharID: s.charID, - BinaryType: uint8(i + 1), - } - serverNotif.WriteUint16(uint16(temp.Opcode())) - temp.Build(serverNotif, s.clientContext) - } - for _, session := range s.server.sessions { - if session == s || !session.binariesDone { - continue - } - session.QueueSend(serverNotif.Data()) - } -} - -func handleMsgSysSetUserBinary(s *Session, p mhfpacket.MHFPacket) { - pkt := p.(*mhfpacket.MsgSysSetUserBinary) - s.server.userBinaryPartsLock.Lock() - s.server.userBinaryParts[userBinaryPartID{charID: s.charID, index: pkt.BinaryType}] = pkt.RawDataPayload - s.server.userBinaryPartsLock.Unlock() - - // Insert user once all binary parts exist - if !s.binariesDone { - for i := 0; i < 3; i++ { - _, exists := s.server.userBinaryParts[userBinaryPartID{charID: s.charID, index: uint8(i + 1)}] - if !exists { - return - } - } - s.binariesDone = true - broadcastNewUser(s) - return - } - - msg := &mhfpacket.MsgSysNotifyUserBinary{ - CharID: s.charID, - BinaryType: pkt.BinaryType, - } - - s.server.BroadcastMHF(msg, s) -} - -func handleMsgSysGetUserBinary(s *Session, p mhfpacket.MHFPacket) { - pkt := p.(*mhfpacket.MsgSysGetUserBinary) - - // Try to get the data. - s.server.userBinaryPartsLock.RLock() - defer s.server.userBinaryPartsLock.RUnlock() - data, ok := s.server.userBinaryParts[userBinaryPartID{charID: pkt.CharID, index: pkt.BinaryType}] - resp := byteframe.NewByteFrame() - - // If we can't get the real data, use a placeholder. - if !ok { - if pkt.BinaryType == 1 { - // Stub name response with character ID - resp.WriteBytes([]byte(fmt.Sprintf("CID%d", s.charID))) - resp.WriteUint8(0) // NULL terminator. - } else if pkt.BinaryType == 2 { - data, err := base64.StdEncoding.DecodeString("AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABBn8AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAgAAAAAAAAAAAAAAAwAAAAAAAAAAAAAABAAAAAAAAAAAAAAABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA==") - if err != nil { - panic(err) - } - resp.WriteBytes(data) - } else if pkt.BinaryType == 3 { - data, err := base64.StdEncoding.DecodeString("AQAAA2ea5P8ATgEA/wEAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABBn8AAAAAAAAAAAABAKAMAAAAAAAAAAAAACgAAAAAAAAAAAABAsQOAAAAAAAAAAABA6UMAAAAAAAAAAABBKAMAAAAAAAAAAABBToNAAAAAAAAAAAAAAMAAAAAAAAAAAAAAAAAAQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAQAAAgACAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAD/////AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA") - if err != nil { - panic(err) - } - resp.WriteBytes(data) - } - } else { - resp.WriteBytes(data) - } - - doAckBufSucceed(s, pkt.AckHandle, resp.Data()) -} - -func handleMsgSysNotifyUserBinary(s *Session, p mhfpacket.MHFPacket) {} - -func handleMsgMhfGetBbsUserStatus(s *Session, p mhfpacket.MHFPacket) {} diff --git a/Erupe/tokensessions.sql b/Erupe/tokensessions.sql deleted file mode 100644 index bb6b4a1f1..000000000 --- a/Erupe/tokensessions.sql +++ /dev/null @@ -1,32 +0,0 @@ -BEGIN; - -DROP TABLE IF EXISTS public.sign_sessions; -CREATE TABLE IF NOT EXISTS public.sign_sessions -( - user_id int NOT NULL, - char_id int, - token varchar(16) NOT NULL, - server_id integer -); - -DROP TABLE IF EXISTS public.servers; -CREATE TABLE IF NOT EXISTS public.servers -( - server_id int NOT NULL, - season int NOT NULL, - current_players int NOT NULL -); - -ALTER TABLE IF EXISTS public.characters - ADD COLUMN IF NOT EXISTS deleted boolean NOT NULL DEFAULT false; - -ALTER TABLE IF EXISTS public.characters - ADD COLUMN IF NOT EXISTS friends text NOT NULL DEFAULT ''; - -ALTER TABLE IF EXISTS public.characters - ADD COLUMN IF NOT EXISTS blocked text NOT NULL DEFAULT ''; - -ALTER TABLE IF EXISTS public.users - ADD COLUMN IF NOT EXISTS last_character int DEFAULT 0; - -END; diff --git a/Erupe/LICENSE b/LICENSE similarity index 91% rename from Erupe/LICENSE rename to LICENSE index 704115aa4..8803130d6 100644 --- a/Erupe/LICENSE +++ b/LICENSE @@ -1,6 +1,6 @@ The MIT License (MIT) -Copyright (c) 2019 The Erupe Developers from Einherjar Team +Copyright (c) 2019 The Erupe Developers, The Erupe Developers from Einherjar Team, ZeruLight Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal diff --git a/MHFZ_Server_Setup_Guide.pdf b/MHFZ_Server_Setup_Guide.pdf deleted file mode 100644 index 59e5647d3..000000000 Binary files a/MHFZ_Server_Setup_Guide.pdf and /dev/null differ diff --git a/Optional Loading & Title Screens/demo.txb b/Optional Loading & Title Screens/demo.txb deleted file mode 100644 index 409cdadcf..000000000 Binary files a/Optional Loading & Title Screens/demo.txb and /dev/null differ diff --git a/Optional Loading & Title Screens/title.txb b/Optional Loading & Title Screens/title.txb deleted file mode 100644 index 2a7b041cb..000000000 Binary files a/Optional Loading & Title Screens/title.txb and /dev/null differ diff --git a/README.md b/README.md index c312b8a7e..916c6db7a 100644 --- a/README.md +++ b/README.md @@ -1,7 +1,8 @@ # Erupe Community Edition + This is a community upload of a community project. The amount of people who worked on it is innumerous, and hard to keep track of. Credits to Andoryuuta, Fist's Team, the French Team, Mai's Team and many others. No matter the relations, these files will remain public and open source, free for all to use and modify. -A pastebin with various links, tips, and FAQ: https://pastebin.com/QqAwZSTC +[A pastebin with various links, tips, and FAQ](https://pastebin.com/QqAwZSTC) -An upload for the quest and scenario files exists here: https://github.com/xl3lackout/MHFZ-Quest-Files -(Over 300k+ files) \ No newline at end of file +[An upload for the quest and scenario files exists here](https://github.com/xl3lackout/MHFZ-Quest-Files) +(Over 300k+ files) diff --git a/04 - Shoplist_Balanced_1.7.4.csv b/RoadShopItems.csv similarity index 100% rename from 04 - Shoplist_Balanced_1.7.4.csv rename to RoadShopItems.csv diff --git a/autolaunch_EDIT_THIS.bat b/autolaunch_EDIT_THIS.bat deleted file mode 100644 index 12e2f0df5..000000000 --- a/autolaunch_EDIT_THIS.bat +++ /dev/null @@ -1,2 +0,0 @@ -cd PUT ERUPE DIRECTORY HERE - BE SURE TO USE /d IF ITS ON A DRIVE OTHER THAN C -go run . \ No newline at end of file diff --git a/Erupe/savedata/.gitkeep b/bin/.gitkeep similarity index 100% rename from Erupe/savedata/.gitkeep rename to bin/.gitkeep diff --git a/Erupe/bin/questlists/psql.txt b/bin/questlists/psql.txt similarity index 100% rename from Erupe/bin/questlists/psql.txt rename to bin/questlists/psql.txt diff --git a/Erupe/common/bfutil/bfutil.go b/common/bfutil/bfutil.go similarity index 100% rename from Erupe/common/bfutil/bfutil.go rename to common/bfutil/bfutil.go diff --git a/Erupe/common/byteframe/LICENSE b/common/byteframe/LICENSE similarity index 100% rename from Erupe/common/byteframe/LICENSE rename to common/byteframe/LICENSE diff --git a/Erupe/common/byteframe/byteframe.go b/common/byteframe/byteframe.go similarity index 100% rename from Erupe/common/byteframe/byteframe.go rename to common/byteframe/byteframe.go diff --git a/common/pascalstring/pascalstring.go b/common/pascalstring/pascalstring.go new file mode 100644 index 000000000..3640db22d --- /dev/null +++ b/common/pascalstring/pascalstring.go @@ -0,0 +1,46 @@ +package pascalstring + +import ( + "erupe-ce/common/byteframe" + "golang.org/x/text/encoding/japanese" + "golang.org/x/text/transform" +) + +func Uint8(bf *byteframe.ByteFrame, x string, t bool) { + if t { + e := japanese.ShiftJIS.NewEncoder() + xt, _, err := transform.String(e, x) + if err != nil { + panic(err) + } + x = xt + } + bf.WriteUint8(uint8(len(x) + 1)) + bf.WriteNullTerminatedBytes([]byte(x)) +} + +func Uint16(bf *byteframe.ByteFrame, x string, t bool) { + if t { + e := japanese.ShiftJIS.NewEncoder() + xt, _, err := transform.String(e, x) + if err != nil { + panic(err) + } + x = xt + } + bf.WriteUint16(uint16(len(x) + 1)) + bf.WriteNullTerminatedBytes([]byte(x)) +} + +func Uint32(bf *byteframe.ByteFrame, x string, t bool) { + if t { + e := japanese.ShiftJIS.NewEncoder() + xt, _, err := transform.String(e, x) + if err != nil { + panic(err) + } + x = xt + } + bf.WriteUint32(uint32(len(x) + 1)) + bf.WriteNullTerminatedBytes([]byte(x)) +} diff --git a/Erupe/common/stringstack/stringstack.go b/common/stringstack/stringstack.go similarity index 100% rename from Erupe/common/stringstack/stringstack.go rename to common/stringstack/stringstack.go diff --git a/Erupe/common/stringsupport/string_convert.go b/common/stringsupport/string_convert.go similarity index 99% rename from Erupe/common/stringsupport/string_convert.go rename to common/stringsupport/string_convert.go index 0a9f4cb10..84574375b 100644 --- a/Erupe/common/stringsupport/string_convert.go +++ b/common/stringsupport/string_convert.go @@ -106,7 +106,7 @@ func PaddedString(x string, size uint, t bool) []byte { e := japanese.ShiftJIS.NewEncoder() xt, _, err := transform.String(e, x) if err != nil { - panic(err) + return make([]byte, size) } x = xt } diff --git a/Erupe/config.json b/config.json similarity index 60% rename from Erupe/config.json rename to config.json index eb59db613..29af1fb8d 100644 --- a/Erupe/config.json +++ b/config.json @@ -1,11 +1,14 @@ { - "host_ip": "127.0.0.1", - "bin_path": "bin", + "Host": "127.0.0.1", + "BinPath": "bin", + "DisableSoftCrash": false, "devmode": true, "devmodeoptions": { "serverName" : "", + "hideLoginNotice": false, + "loginNotice": "
Welcome to Erupe SU9 (Patch 1)!
Erupe is experimental software, we are not liable for any
issues caused by installing the software!

■Report bugs on Discord!

■Test everything!

■Don't talk to softlocking NPCs!

■Fork the code on GitHub!

Thank you to all of the contributors,

this wouldn't exist without you.", "cleandb": false, - "maxlauncherhr": true, + "maxlauncherhr": false, "LogInboundMessages": false, "LogOutboundMessages": false, "MaxHexdumpLength": 256, @@ -14,6 +17,9 @@ "FestaEvent": 0, "TournamentEvent": 0, "MezFesEvent": true, + "MezFesAlt": false, + "DisableMailItems": true, + "DisableTokenCheck": false, "SaveDumps": { "Enabled": true, "OutputDir": "savedata" @@ -47,34 +53,34 @@ { "name": "Newbie", "description": "", "ip": "", "type": 3, "recommended": 2, "allowedclientflags": 0, "channels": [ - { "port": 54001, "MaxPlayers": 50, "Unk0": 319, "Unk1": 252, "Unk2": 248 }, - { "port": 54002, "MaxPlayers": 50, "Unk0": 319, "Unk1": 252, "Unk2": 248 } + { "port": 54001, "MaxPlayers": 100 }, + { "port": 54002, "MaxPlayers": 100 } ] }, { "name": "Normal", "description": "", "ip": "", "type": 1, "recommended": 0, "allowedclientflags": 0, "channels": [ - { "port": 54003, "MaxPlayers": 50, "Unk0": 319, "Unk1": 252, "Unk2": 248 }, - { "port": 54004, "MaxPlayers": 50, "Unk0": 319, "Unk1": 252, "Unk2": 248 } + { "port": 54003, "MaxPlayers": 100 }, + { "port": 54004, "MaxPlayers": 100 } ] }, { "name": "Cities", "description": "", "ip": "", "type": 2, "recommended": 0, "allowedclientflags": 0, "channels": [ - { "port": 54005, "MaxPlayers": 50, "Unk0": 319, "Unk1": 252, "Unk2": 248 } + { "port": 54005, "MaxPlayers": 100 } ] }, { "name": "Tavern", "description": "", "ip": "", "type": 4, "recommended": 0, "allowedclientflags": 0, "channels": [ - { "port": 54006, "MaxPlayers": 50, "Unk0": 319, "Unk1": 252, "Unk2": 248 } + { "port": 54006, "MaxPlayers": 100 } ] }, { "name": "Return", "description": "", "ip": "", "type": 5, "recommended": 0, "allowedclientflags": 0, "channels": [ - { "port": 54007, "MaxPlayers": 50, "Unk0": 319, "Unk1": 252, "Unk2": 248 } + { "port": 54007, "MaxPlayers": 100 } ] }, { "name": "MezFes", "description": "", "ip": "", "type": 6, "recommended": 6, "allowedclientflags": 0, "channels": [ - { "port": 54008, "MaxPlayers": 50, "Unk0": 319, "Unk1": 252, "Unk2": 248 } + { "port": 54008, "MaxPlayers": 100 } ] } ] diff --git a/Erupe/config/config.go b/config/config.go similarity index 77% rename from Erupe/config/config.go rename to config/config.go index 5f0079fad..b025e7a0a 100644 --- a/Erupe/config/config.go +++ b/config/config.go @@ -9,9 +9,10 @@ import ( // Config holds the global server-wide config. type Config struct { - HostIP string `mapstructure:"host_ip"` - BinPath string `mapstructure:"bin_path"` - DevMode bool + Host string `mapstructure:"Host"` + BinPath string `mapstructure:"BinPath"` + DisableSoftCrash bool // Disables the 'Press Return to exit' dialog allowing scripts to reboot the server automatically + DevMode bool DevModeOptions DevModeOptions Discord Discord @@ -24,6 +25,8 @@ type Config struct { // DevModeOptions holds various debug/temporary options for use while developing Erupe. type DevModeOptions struct { ServerName string // To get specific instance server about (Current Players/Event Week) + HideLoginNotice bool // Hide the Erupe notice on login + LoginNotice string // MHFML string of the login notice displayed CleanDB bool // Automatically wipes the DB on server reset. MaxLauncherHR bool // Sets the HR returned in the launcher to HR9 so that you can join non-beginner worlds. FixedStageID bool // Causes all move_stage to use the ID sl1Ns200p0a0u0 to get you into all stages @@ -34,6 +37,9 @@ type DevModeOptions struct { FestaEvent int // Hunter's Festa event status TournamentEvent int // VS Tournament event status MezFesEvent bool // MezFes status + MezFesAlt bool // Swaps out Volpakkun for Tokotoko + DisableTokenCheck bool // Disables checking login token exists in the DB (security risk!) + DisableMailItems bool // Hack to prevent english versions of MHF from crashing SaveDumps SaveDumpOptions } @@ -44,8 +50,8 @@ type SaveDumpOptions struct { // Discord holds the discord integration config. type Discord struct { - Enabled bool - BotToken string + Enabled bool + BotToken string ServerID string RealtimeChannelID string DevRoles []string @@ -80,11 +86,11 @@ type Entrance struct { // EntranceServerInfo represents an entry in the serverlist. type EntranceServerInfo struct { - IP string - Type uint8 // Server type. 0=?, 1=open, 2=cities, 3=newbie, 4=bar - Season uint8 // Server activity. 0 = green, 1 = orange, 2 = blue + IP string + Type uint8 // Server type. 0=?, 1=open, 2=cities, 3=newbie, 4=bar + Season uint8 // Server activity. 0 = green, 1 = orange, 2 = blue Recommended uint8 // Something to do with server recommendation on 0, 3, and 5. - Name string // Server name, 66 byte null terminated Shift-JIS(JP) or Big5(TW). + Name string // Server name, 66 byte null terminated Shift-JIS(JP) or Big5(TW). Description string // Server description // 4096(PC, PS3/PS4)?, 8258(PC, PS3/PS4)?, 8192 == nothing? // THIS ONLY EXISTS IF Binary8Header.type == "SV2", NOT "SVR"! @@ -98,9 +104,6 @@ type EntranceChannelInfo struct { Port uint16 MaxPlayers uint16 CurrentPlayers uint16 - Unk0 uint16 - Unk1 uint16 - Unk2 uint16 } // getOutboundIP4 gets the preferred outbound ip4 of this machine @@ -138,8 +141,8 @@ func LoadConfig() (*Config, error) { return nil, err } - if c.HostIP == "" { - c.HostIP = getOutboundIP4().To4().String() + if c.Host == "" { + c.Host = getOutboundIP4().To4().String() } return c, nil diff --git a/erupe-bak.sql b/erupe-bak.sql deleted file mode 100644 index 0793203ff..000000000 Binary files a/erupe-bak.sql and /dev/null differ diff --git a/Erupe/go.mod b/go.mod similarity index 100% rename from Erupe/go.mod rename to go.mod diff --git a/Erupe/go.sum b/go.sum similarity index 100% rename from Erupe/go.sum rename to go.sum diff --git a/Erupe/main.go b/main.go similarity index 89% rename from Erupe/main.go rename to main.go index d39f284ea..d0b13d649 100644 --- a/Erupe/main.go +++ b/main.go @@ -2,7 +2,7 @@ package main import ( "fmt" - "math/rand" + "net" "os" "os/signal" "syscall" @@ -19,6 +19,8 @@ import ( "go.uber.org/zap" ) +var erupeConfig *config.Config + // Temporary DB auto clean on startup for quick development & testing. func cleanDB(db *sqlx.DB) { _ = db.MustExec("DELETE FROM guild_characters") @@ -29,6 +31,7 @@ func cleanDB(db *sqlx.DB) { } func main() { + var err error zapLogger, _ := zap.NewDevelopment() defer zapLogger.Sync() logger := zapLogger.Named("main") @@ -36,7 +39,7 @@ func main() { logger.Info("Starting Erupe") // Load the configuration. - erupeConfig, err := config.LoadConfig() + erupeConfig, err = config.LoadConfig() if err != nil { preventClose(fmt.Sprintf("Failed to load config: %s", err.Error())) } @@ -45,6 +48,19 @@ func main() { preventClose("Database password is blank") } + if net.ParseIP(erupeConfig.Host) == nil { + ips, _ := net.LookupIP(erupeConfig.Host) + for _, ip := range ips { + if ip != nil { + erupeConfig.Host = ip.String() + break + } + } + if net.ParseIP(erupeConfig.Host) == nil { + preventClose("Invalid host address") + } + } + // Discord bot var discordBot *discordbot.DiscordBot = nil @@ -151,9 +167,6 @@ func main() { ci := 0 count := 1 for _, ee := range erupeConfig.Entrance.Entries { - rand.Seed(time.Now().UnixNano()) - // Randomly generate a season for the World - season := rand.Intn(3) + 1 for _, ce := range ee.Channels { sid := (4096 + si*256) + (16 + ci) c := *channelserver.NewServer(&channelserver.Config{ @@ -163,11 +176,17 @@ func main() { DB: db, DiscordBot: discordBot, }) - err = c.Start(int(ce.Port)) + if ee.IP == "" { + c.IP = erupeConfig.Host + } else { + c.IP = ee.IP + } + c.Port = ce.Port + err = c.Start() if err != nil { preventClose(fmt.Sprintf("Failed to start channel server: %s", err.Error())) } else { - channelQuery += fmt.Sprintf("INSERT INTO servers (server_id, season, current_players) VALUES (%d, %d, 0);", sid, season) + channelQuery += fmt.Sprintf("INSERT INTO servers (server_id, season, current_players) VALUES (%d, %d, 0);", sid, si%3) channels = append(channels, &c) logger.Info(fmt.Sprintf("Started channel server %d on port %d", count, ce.Port)) ci++ @@ -209,6 +228,9 @@ func wait() { } func preventClose(text string) { + if erupeConfig.DisableSoftCrash { + os.Exit(0) + } fmt.Println("\nFailed to start Erupe:\n" + text) go wait() fmt.Println("\nPress Enter/Return to exit...") diff --git a/migration/README.md b/migration/README.md deleted file mode 100644 index 4fe0bd8d9..000000000 --- a/migration/README.md +++ /dev/null @@ -1,8 +0,0 @@ -To bring up fresh database: -migrate.exe -database postgres://user:password@host:port/dbname?sslmode=disable -path /pathto/migrations up -To tear down database -migrate.exe -database postgres://user:password@host:port/dbname?sslmode=disable -path /pathto/migrations down - - -More info: -https://github.com/golang-migrate/migrate/releases/tag/v4.15.2 \ No newline at end of file diff --git a/migration/migrate.exe b/migration/migrate.exe deleted file mode 100644 index 47514e575..000000000 Binary files a/migration/migrate.exe and /dev/null differ diff --git a/Erupe/migrations/000001_initial_db.down.sql b/migrations/000001_initial_db.down.sql similarity index 100% rename from Erupe/migrations/000001_initial_db.down.sql rename to migrations/000001_initial_db.down.sql diff --git a/Erupe/migrations/000001_initial_db.up.sql b/migrations/000001_initial_db.up.sql similarity index 100% rename from Erupe/migrations/000001_initial_db.up.sql rename to migrations/000001_initial_db.up.sql diff --git a/Erupe/migrations/000002_alter_characters.down.sql b/migrations/000002_alter_characters.down.sql similarity index 100% rename from Erupe/migrations/000002_alter_characters.down.sql rename to migrations/000002_alter_characters.down.sql diff --git a/Erupe/migrations/000002_alter_characters.up.sql b/migrations/000002_alter_characters.up.sql similarity index 100% rename from Erupe/migrations/000002_alter_characters.up.sql rename to migrations/000002_alter_characters.up.sql diff --git a/Erupe/migrations/000003_character_savedata.down.sql b/migrations/000003_character_savedata.down.sql similarity index 100% rename from Erupe/migrations/000003_character_savedata.down.sql rename to migrations/000003_character_savedata.down.sql diff --git a/Erupe/migrations/000003_character_savedata.up.sql b/migrations/000003_character_savedata.up.sql similarity index 100% rename from Erupe/migrations/000003_character_savedata.up.sql rename to migrations/000003_character_savedata.up.sql diff --git a/Erupe/migrations/000004_character_additional.down.sql b/migrations/000004_character_additional.down.sql similarity index 100% rename from Erupe/migrations/000004_character_additional.down.sql rename to migrations/000004_character_additional.down.sql diff --git a/Erupe/migrations/000004_character_additional.up.sql b/migrations/000004_character_additional.up.sql similarity index 100% rename from Erupe/migrations/000004_character_additional.up.sql rename to migrations/000004_character_additional.up.sql diff --git a/Erupe/migrations/000005_quests.down.sql b/migrations/000005_quests.down.sql similarity index 100% rename from Erupe/migrations/000005_quests.down.sql rename to migrations/000005_quests.down.sql diff --git a/Erupe/migrations/000005_quests.up.sql b/migrations/000005_quests.up.sql similarity index 100% rename from Erupe/migrations/000005_quests.up.sql rename to migrations/000005_quests.up.sql diff --git a/Erupe/migrations/000006_mercenary.down.sql b/migrations/000006_mercenary.down.sql similarity index 100% rename from Erupe/migrations/000006_mercenary.down.sql rename to migrations/000006_mercenary.down.sql diff --git a/Erupe/migrations/000006_mercenary.up.sql b/migrations/000006_mercenary.up.sql similarity index 100% rename from Erupe/migrations/000006_mercenary.up.sql rename to migrations/000006_mercenary.up.sql diff --git a/Erupe/migrations/000007_guilds.down.sql b/migrations/000007_guilds.down.sql similarity index 100% rename from Erupe/migrations/000007_guilds.down.sql rename to migrations/000007_guilds.down.sql diff --git a/Erupe/migrations/000007_guilds.up.sql b/migrations/000007_guilds.up.sql similarity index 100% rename from Erupe/migrations/000007_guilds.up.sql rename to migrations/000007_guilds.up.sql diff --git a/Erupe/migrations/000008_guild_additional.down.sql b/migrations/000008_guild_additional.down.sql similarity index 100% rename from Erupe/migrations/000008_guild_additional.down.sql rename to migrations/000008_guild_additional.down.sql diff --git a/Erupe/migrations/000008_guild_additional.up.sql b/migrations/000008_guild_additional.up.sql similarity index 100% rename from Erupe/migrations/000008_guild_additional.up.sql rename to migrations/000008_guild_additional.up.sql diff --git a/Erupe/migrations/000009_character_social.down.sql b/migrations/000009_character_social.down.sql similarity index 100% rename from Erupe/migrations/000009_character_social.down.sql rename to migrations/000009_character_social.down.sql diff --git a/Erupe/migrations/000009_character_social.up.sql b/migrations/000009_character_social.up.sql similarity index 100% rename from Erupe/migrations/000009_character_social.up.sql rename to migrations/000009_character_social.up.sql diff --git a/Erupe/migrations/000010_guild_comments_festival_hall.down.sql b/migrations/000010_guild_comments_festival_hall.down.sql similarity index 100% rename from Erupe/migrations/000010_guild_comments_festival_hall.down.sql rename to migrations/000010_guild_comments_festival_hall.down.sql diff --git a/Erupe/migrations/000010_guild_comments_festival_hall.up.sql b/migrations/000010_guild_comments_festival_hall.up.sql similarity index 100% rename from Erupe/migrations/000010_guild_comments_festival_hall.up.sql rename to migrations/000010_guild_comments_festival_hall.up.sql diff --git a/Erupe/migrations/000011_character_points_minidata.down.sql b/migrations/000011_character_points_minidata.down.sql similarity index 100% rename from Erupe/migrations/000011_character_points_minidata.down.sql rename to migrations/000011_character_points_minidata.down.sql diff --git a/Erupe/migrations/000011_character_points_minidata.up.sql b/migrations/000011_character_points_minidata.up.sql similarity index 100% rename from Erupe/migrations/000011_character_points_minidata.up.sql rename to migrations/000011_character_points_minidata.up.sql diff --git a/Erupe/migrations/000012_loginboost_etc.down.sql b/migrations/000012_loginboost_etc.down.sql similarity index 100% rename from Erupe/migrations/000012_loginboost_etc.down.sql rename to migrations/000012_loginboost_etc.down.sql diff --git a/Erupe/migrations/000012_loginboost_etc.up.sql b/migrations/000012_loginboost_etc.up.sql similarity index 100% rename from Erupe/migrations/000012_loginboost_etc.up.sql rename to migrations/000012_loginboost_etc.up.sql diff --git a/Erupe/migrations/000013_shop_constraints.down.sql b/migrations/000013_shop_constraints.down.sql similarity index 100% rename from Erupe/migrations/000013_shop_constraints.down.sql rename to migrations/000013_shop_constraints.down.sql diff --git a/Erupe/migrations/000013_shop_constraints.up.sql b/migrations/000013_shop_constraints.up.sql similarity index 100% rename from Erupe/migrations/000013_shop_constraints.up.sql rename to migrations/000013_shop_constraints.up.sql diff --git a/Erupe/migrations/000014_guild_flags_applications.down.sql b/migrations/000014_guild_flags_applications.down.sql similarity index 100% rename from Erupe/migrations/000014_guild_flags_applications.down.sql rename to migrations/000014_guild_flags_applications.down.sql diff --git a/Erupe/migrations/000014_guild_flags_applications.up.sql b/migrations/000014_guild_flags_applications.up.sql similarity index 100% rename from Erupe/migrations/000014_guild_flags_applications.up.sql rename to migrations/000014_guild_flags_applications.up.sql diff --git a/Erupe/migrations/000015_mail.down.sql b/migrations/000015_mail.down.sql similarity index 100% rename from Erupe/migrations/000015_mail.down.sql rename to migrations/000015_mail.down.sql diff --git a/Erupe/migrations/000015_mail.up.sql b/migrations/000015_mail.up.sql similarity index 100% rename from Erupe/migrations/000015_mail.up.sql rename to migrations/000015_mail.up.sql diff --git a/Erupe/migrations/000016_server.down.sql b/migrations/000016_server.down.sql similarity index 100% rename from Erupe/migrations/000016_server.down.sql rename to migrations/000016_server.down.sql diff --git a/Erupe/migrations/000016_server.up.sql b/migrations/000016_server.up.sql similarity index 100% rename from Erupe/migrations/000016_server.up.sql rename to migrations/000016_server.up.sql diff --git a/Erupe/migrations/000017_account.down.sql b/migrations/000017_account.down.sql similarity index 100% rename from Erupe/migrations/000017_account.down.sql rename to migrations/000017_account.down.sql diff --git a/Erupe/migrations/000017_account.up.sql b/migrations/000017_account.up.sql similarity index 100% rename from Erupe/migrations/000017_account.up.sql rename to migrations/000017_account.up.sql diff --git a/Erupe/migrations/000018_event_week.down.sql b/migrations/000018_event_week.down.sql similarity index 100% rename from Erupe/migrations/000018_event_week.down.sql rename to migrations/000018_event_week.down.sql diff --git a/Erupe/migrations/000018_event_week.up.sql b/migrations/000018_event_week.up.sql similarity index 100% rename from Erupe/migrations/000018_event_week.up.sql rename to migrations/000018_event_week.up.sql diff --git a/Erupe/migrations/000019_gook.down.sql b/migrations/000019_gook.down.sql similarity index 100% rename from Erupe/migrations/000019_gook.down.sql rename to migrations/000019_gook.down.sql diff --git a/Erupe/migrations/000019_gook.up.sql b/migrations/000019_gook.up.sql similarity index 100% rename from Erupe/migrations/000019_gook.up.sql rename to migrations/000019_gook.up.sql diff --git a/Erupe/migrations/000020_history.down.sql b/migrations/000020_history.down.sql similarity index 100% rename from Erupe/migrations/000020_history.down.sql rename to migrations/000020_history.down.sql diff --git a/Erupe/migrations/000020_history.up.sql b/migrations/000020_history.up.sql similarity index 100% rename from Erupe/migrations/000020_history.up.sql rename to migrations/000020_history.up.sql diff --git a/Erupe/network/binpacket/msg_bin_chat.go b/network/binpacket/msg_bin_chat.go similarity index 100% rename from Erupe/network/binpacket/msg_bin_chat.go rename to network/binpacket/msg_bin_chat.go diff --git a/Erupe/network/binpacket/msg_bin_mail_notify.go b/network/binpacket/msg_bin_mail_notify.go similarity index 100% rename from Erupe/network/binpacket/msg_bin_mail_notify.go rename to network/binpacket/msg_bin_mail_notify.go index a829b9a5e..5e1687512 100644 --- a/Erupe/network/binpacket/msg_bin_mail_notify.go +++ b/network/binpacket/msg_bin_mail_notify.go @@ -1,9 +1,9 @@ package binpacket import ( + "erupe-ce/common/byteframe" "erupe-ce/common/stringsupport" "erupe-ce/network" - "erupe-ce/common/byteframe" ) type MsgBinMailNotify struct { diff --git a/Erupe/network/binpacket/msg_bin_targeted.go b/network/binpacket/msg_bin_targeted.go similarity index 100% rename from Erupe/network/binpacket/msg_bin_targeted.go rename to network/binpacket/msg_bin_targeted.go index 2a27a0d8e..87bfb54ce 100644 --- a/Erupe/network/binpacket/msg_bin_targeted.go +++ b/network/binpacket/msg_bin_targeted.go @@ -1,8 +1,8 @@ package binpacket import ( - "erupe-ce/network" "erupe-ce/common/byteframe" + "erupe-ce/network" ) // MsgBinTargeted is a format used for some broadcast types diff --git a/Erupe/network/clientctx/clientcontext.go b/network/clientctx/clientcontext.go similarity index 100% rename from Erupe/network/clientctx/clientcontext.go rename to network/clientctx/clientcontext.go diff --git a/Erupe/network/crypt_conn.go b/network/crypt_conn.go similarity index 100% rename from Erupe/network/crypt_conn.go rename to network/crypt_conn.go diff --git a/Erupe/network/crypt_packet.go b/network/crypt_packet.go similarity index 99% rename from Erupe/network/crypt_packet.go rename to network/crypt_packet.go index 03ba4a293..ae556d42e 100644 --- a/Erupe/network/crypt_packet.go +++ b/network/crypt_packet.go @@ -87,4 +87,4 @@ func (c *CryptPacketHeader) Encode() ([]byte, error) { } return buf.Bytes(), nil -} \ No newline at end of file +} diff --git a/Erupe/network/crypto/crypto.go b/network/crypto/crypto.go similarity index 100% rename from Erupe/network/crypto/crypto.go rename to network/crypto/crypto.go diff --git a/Erupe/network/crypto/crypto_test.go b/network/crypto/crypto_test.go similarity index 100% rename from Erupe/network/crypto/crypto_test.go rename to network/crypto/crypto_test.go diff --git a/Erupe/network/mhfpacket/mhfpacket.go b/network/mhfpacket/mhfpacket.go similarity index 100% rename from Erupe/network/mhfpacket/mhfpacket.go rename to network/mhfpacket/mhfpacket.go diff --git a/Erupe/network/mhfpacket/msg_ca_exchange_item.go b/network/mhfpacket/msg_ca_exchange_item.go similarity index 100% rename from Erupe/network/mhfpacket/msg_ca_exchange_item.go rename to network/mhfpacket/msg_ca_exchange_item.go diff --git a/Erupe/network/mhfpacket/msg_head.go b/network/mhfpacket/msg_head.go similarity index 100% rename from Erupe/network/mhfpacket/msg_head.go rename to network/mhfpacket/msg_head.go diff --git a/Erupe/network/mhfpacket/msg_mhf_accept_read_reward.go b/network/mhfpacket/msg_mhf_accept_read_reward.go similarity index 100% rename from Erupe/network/mhfpacket/msg_mhf_accept_read_reward.go rename to network/mhfpacket/msg_mhf_accept_read_reward.go diff --git a/Erupe/network/mhfpacket/msg_mhf_acquire_cafe_item.go b/network/mhfpacket/msg_mhf_acquire_cafe_item.go similarity index 100% rename from Erupe/network/mhfpacket/msg_mhf_acquire_cafe_item.go rename to network/mhfpacket/msg_mhf_acquire_cafe_item.go diff --git a/Erupe/network/mhfpacket/msg_mhf_acquire_dist_item.go b/network/mhfpacket/msg_mhf_acquire_dist_item.go similarity index 100% rename from Erupe/network/mhfpacket/msg_mhf_acquire_dist_item.go rename to network/mhfpacket/msg_mhf_acquire_dist_item.go diff --git a/Erupe/network/mhfpacket/msg_mhf_acquire_exchange_shop.go b/network/mhfpacket/msg_mhf_acquire_exchange_shop.go similarity index 100% rename from Erupe/network/mhfpacket/msg_mhf_acquire_exchange_shop.go rename to network/mhfpacket/msg_mhf_acquire_exchange_shop.go diff --git a/Erupe/network/mhfpacket/msg_mhf_acquire_festa.go b/network/mhfpacket/msg_mhf_acquire_festa.go similarity index 100% rename from Erupe/network/mhfpacket/msg_mhf_acquire_festa.go rename to network/mhfpacket/msg_mhf_acquire_festa.go diff --git a/Erupe/network/mhfpacket/msg_mhf_acquire_festa_intermediate_prize.go b/network/mhfpacket/msg_mhf_acquire_festa_intermediate_prize.go similarity index 100% rename from Erupe/network/mhfpacket/msg_mhf_acquire_festa_intermediate_prize.go rename to network/mhfpacket/msg_mhf_acquire_festa_intermediate_prize.go diff --git a/Erupe/network/mhfpacket/msg_mhf_acquire_festa_personal_prize.go b/network/mhfpacket/msg_mhf_acquire_festa_personal_prize.go similarity index 100% rename from Erupe/network/mhfpacket/msg_mhf_acquire_festa_personal_prize.go rename to network/mhfpacket/msg_mhf_acquire_festa_personal_prize.go diff --git a/Erupe/network/mhfpacket/msg_mhf_acquire_guild_adventure.go b/network/mhfpacket/msg_mhf_acquire_guild_adventure.go similarity index 100% rename from Erupe/network/mhfpacket/msg_mhf_acquire_guild_adventure.go rename to network/mhfpacket/msg_mhf_acquire_guild_adventure.go diff --git a/Erupe/network/mhfpacket/msg_mhf_acquire_guild_tresure.go b/network/mhfpacket/msg_mhf_acquire_guild_tresure.go similarity index 100% rename from Erupe/network/mhfpacket/msg_mhf_acquire_guild_tresure.go rename to network/mhfpacket/msg_mhf_acquire_guild_tresure.go diff --git a/Erupe/network/mhfpacket/msg_mhf_acquire_guild_tresure_souvenir.go b/network/mhfpacket/msg_mhf_acquire_guild_tresure_souvenir.go similarity index 100% rename from Erupe/network/mhfpacket/msg_mhf_acquire_guild_tresure_souvenir.go rename to network/mhfpacket/msg_mhf_acquire_guild_tresure_souvenir.go diff --git a/Erupe/network/mhfpacket/msg_mhf_acquire_item.go b/network/mhfpacket/msg_mhf_acquire_item.go similarity index 100% rename from Erupe/network/mhfpacket/msg_mhf_acquire_item.go rename to network/mhfpacket/msg_mhf_acquire_item.go diff --git a/Erupe/network/mhfpacket/msg_mhf_acquire_monthly_item.go b/network/mhfpacket/msg_mhf_acquire_monthly_item.go similarity index 100% rename from Erupe/network/mhfpacket/msg_mhf_acquire_monthly_item.go rename to network/mhfpacket/msg_mhf_acquire_monthly_item.go diff --git a/Erupe/network/mhfpacket/msg_mhf_acquire_monthly_reward.go b/network/mhfpacket/msg_mhf_acquire_monthly_reward.go similarity index 100% rename from Erupe/network/mhfpacket/msg_mhf_acquire_monthly_reward.go rename to network/mhfpacket/msg_mhf_acquire_monthly_reward.go diff --git a/Erupe/network/mhfpacket/msg_mhf_acquire_title.go b/network/mhfpacket/msg_mhf_acquire_title.go similarity index 100% rename from Erupe/network/mhfpacket/msg_mhf_acquire_title.go rename to network/mhfpacket/msg_mhf_acquire_title.go diff --git a/Erupe/network/mhfpacket/msg_mhf_acquire_tournament.go b/network/mhfpacket/msg_mhf_acquire_tournament.go similarity index 100% rename from Erupe/network/mhfpacket/msg_mhf_acquire_tournament.go rename to network/mhfpacket/msg_mhf_acquire_tournament.go diff --git a/Erupe/network/mhfpacket/msg_mhf_acquire_ud_item.go b/network/mhfpacket/msg_mhf_acquire_ud_item.go similarity index 100% rename from Erupe/network/mhfpacket/msg_mhf_acquire_ud_item.go rename to network/mhfpacket/msg_mhf_acquire_ud_item.go diff --git a/Erupe/network/mhfpacket/msg_mhf_add_achievement.go b/network/mhfpacket/msg_mhf_add_achievement.go similarity index 84% rename from Erupe/network/mhfpacket/msg_mhf_add_achievement.go rename to network/mhfpacket/msg_mhf_add_achievement.go index 2ba0a1bdb..c127c3437 100644 --- a/Erupe/network/mhfpacket/msg_mhf_add_achievement.go +++ b/network/mhfpacket/msg_mhf_add_achievement.go @@ -1,16 +1,18 @@ package mhfpacket import ( + "errors" + + "erupe-ce/common/byteframe" "erupe-ce/network" "erupe-ce/network/clientctx" - "erupe-ce/common/byteframe" ) // MsgMhfAddAchievement represents the MSG_MHF_ADD_ACHIEVEMENT type MsgMhfAddAchievement struct { AchievementID uint8 - Unk1 uint16 - Unk2 uint16 + Unk1 uint16 + Unk2 uint16 } // Opcode returns the ID associated with this packet type. @@ -23,14 +25,10 @@ func (m *MsgMhfAddAchievement) Parse(bf *byteframe.ByteFrame, ctx *clientctx.Cli m.AchievementID = bf.ReadUint8() m.Unk1 = bf.ReadUint16() m.Unk2 = bf.ReadUint16() - // doesn't expect a response return nil } // Build builds a binary packet from the current data. func (m *MsgMhfAddAchievement) Build(bf *byteframe.ByteFrame, ctx *clientctx.ClientContext) error { - bf.WriteUint8(m.AchievementID) - bf.WriteUint16(m.Unk1) - bf.WriteUint16(m.Unk2) - return nil + return errors.New("NOT IMPLEMENTED") } diff --git a/Erupe/network/mhfpacket/msg_mhf_add_guild_mission_count.go b/network/mhfpacket/msg_mhf_add_guild_mission_count.go similarity index 100% rename from Erupe/network/mhfpacket/msg_mhf_add_guild_mission_count.go rename to network/mhfpacket/msg_mhf_add_guild_mission_count.go diff --git a/Erupe/network/mhfpacket/msg_mhf_add_guild_weekly_bonus_exceptional_user.go b/network/mhfpacket/msg_mhf_add_guild_weekly_bonus_exceptional_user.go similarity index 100% rename from Erupe/network/mhfpacket/msg_mhf_add_guild_weekly_bonus_exceptional_user.go rename to network/mhfpacket/msg_mhf_add_guild_weekly_bonus_exceptional_user.go diff --git a/Erupe/network/mhfpacket/msg_mhf_add_kouryou_point.go b/network/mhfpacket/msg_mhf_add_kouryou_point.go similarity index 100% rename from Erupe/network/mhfpacket/msg_mhf_add_kouryou_point.go rename to network/mhfpacket/msg_mhf_add_kouryou_point.go diff --git a/Erupe/network/mhfpacket/msg_mhf_add_reward_song_count.go b/network/mhfpacket/msg_mhf_add_reward_song_count.go similarity index 100% rename from Erupe/network/mhfpacket/msg_mhf_add_reward_song_count.go rename to network/mhfpacket/msg_mhf_add_reward_song_count.go diff --git a/Erupe/network/mhfpacket/msg_mhf_add_ud_point.go b/network/mhfpacket/msg_mhf_add_ud_point.go similarity index 100% rename from Erupe/network/mhfpacket/msg_mhf_add_ud_point.go rename to network/mhfpacket/msg_mhf_add_ud_point.go diff --git a/Erupe/network/mhfpacket/msg_mhf_add_ud_tactics_point.go b/network/mhfpacket/msg_mhf_add_ud_tactics_point.go similarity index 100% rename from Erupe/network/mhfpacket/msg_mhf_add_ud_tactics_point.go rename to network/mhfpacket/msg_mhf_add_ud_tactics_point.go diff --git a/Erupe/network/mhfpacket/msg_mhf_announce.go b/network/mhfpacket/msg_mhf_announce.go similarity index 62% rename from Erupe/network/mhfpacket/msg_mhf_announce.go rename to network/mhfpacket/msg_mhf_announce.go index 70d348510..8e3971497 100644 --- a/Erupe/network/mhfpacket/msg_mhf_announce.go +++ b/network/mhfpacket/msg_mhf_announce.go @@ -1,20 +1,20 @@ package mhfpacket import ( - "errors" + "errors" - "erupe-ce/network/clientctx" - "erupe-ce/network" "erupe-ce/common/byteframe" + "erupe-ce/network" + "erupe-ce/network/clientctx" ) // MsgMhfAnnounce represents the MSG_MHF_ANNOUNCE type MsgMhfAnnounce struct { - AckHandle uint32 - IPAddress uint32 - Port uint16 - StageID []byte - Type uint8 + AckHandle uint32 + IPAddress uint32 + Port uint16 + StageID []byte + Type uint8 } // Opcode returns the ID associated with this packet type. @@ -24,18 +24,14 @@ func (m *MsgMhfAnnounce) Opcode() network.PacketID { // Parse parses the packet from binary func (m *MsgMhfAnnounce) Parse(bf *byteframe.ByteFrame, ctx *clientctx.ClientContext) error { - m.AckHandle = bf.ReadUint32() - m.IPAddress = bf.ReadUint32() - m.Port = bf.ReadUint16() - _ = bf.ReadUint8() - _ = bf.ReadUint16() - m.StageID = bf.ReadNullTerminatedBytes() - for { - if bf.ReadUint8() != 0 { - m.Type = bf.ReadUint8() - break - } - } + m.AckHandle = bf.ReadUint32() + m.IPAddress = bf.ReadUint32() + m.Port = bf.ReadUint16() + _ = bf.ReadUint8() + _ = bf.ReadUint16() + m.StageID = bf.ReadBytes(32) + _ = bf.ReadUint32() + m.Type = bf.ReadUint8() return nil } diff --git a/Erupe/network/mhfpacket/msg_mhf_answer_guild_scout.go b/network/mhfpacket/msg_mhf_answer_guild_scout.go similarity index 100% rename from Erupe/network/mhfpacket/msg_mhf_answer_guild_scout.go rename to network/mhfpacket/msg_mhf_answer_guild_scout.go diff --git a/Erupe/network/mhfpacket/msg_mhf_apply_bbs_article.go b/network/mhfpacket/msg_mhf_apply_bbs_article.go similarity index 100% rename from Erupe/network/mhfpacket/msg_mhf_apply_bbs_article.go rename to network/mhfpacket/msg_mhf_apply_bbs_article.go diff --git a/Erupe/network/mhfpacket/msg_mhf_apply_campaign.go b/network/mhfpacket/msg_mhf_apply_campaign.go similarity index 100% rename from Erupe/network/mhfpacket/msg_mhf_apply_campaign.go rename to network/mhfpacket/msg_mhf_apply_campaign.go diff --git a/Erupe/network/mhfpacket/msg_mhf_apply_dist_item.go b/network/mhfpacket/msg_mhf_apply_dist_item.go similarity index 100% rename from Erupe/network/mhfpacket/msg_mhf_apply_dist_item.go rename to network/mhfpacket/msg_mhf_apply_dist_item.go diff --git a/Erupe/network/mhfpacket/msg_mhf_arrange_guild_member.go b/network/mhfpacket/msg_mhf_arrange_guild_member.go similarity index 100% rename from Erupe/network/mhfpacket/msg_mhf_arrange_guild_member.go rename to network/mhfpacket/msg_mhf_arrange_guild_member.go diff --git a/Erupe/network/mhfpacket/msg_mhf_cancel_guild_mission_target.go b/network/mhfpacket/msg_mhf_cancel_guild_mission_target.go similarity index 100% rename from Erupe/network/mhfpacket/msg_mhf_cancel_guild_mission_target.go rename to network/mhfpacket/msg_mhf_cancel_guild_mission_target.go diff --git a/Erupe/network/mhfpacket/msg_mhf_cancel_guild_scout.go b/network/mhfpacket/msg_mhf_cancel_guild_scout.go similarity index 100% rename from Erupe/network/mhfpacket/msg_mhf_cancel_guild_scout.go rename to network/mhfpacket/msg_mhf_cancel_guild_scout.go diff --git a/Erupe/network/mhfpacket/msg_mhf_caravan_my_rank.go b/network/mhfpacket/msg_mhf_caravan_my_rank.go similarity index 100% rename from Erupe/network/mhfpacket/msg_mhf_caravan_my_rank.go rename to network/mhfpacket/msg_mhf_caravan_my_rank.go diff --git a/Erupe/network/mhfpacket/msg_mhf_caravan_my_score.go b/network/mhfpacket/msg_mhf_caravan_my_score.go similarity index 100% rename from Erupe/network/mhfpacket/msg_mhf_caravan_my_score.go rename to network/mhfpacket/msg_mhf_caravan_my_score.go diff --git a/Erupe/network/mhfpacket/msg_mhf_caravan_ranking.go b/network/mhfpacket/msg_mhf_caravan_ranking.go similarity index 100% rename from Erupe/network/mhfpacket/msg_mhf_caravan_ranking.go rename to network/mhfpacket/msg_mhf_caravan_ranking.go diff --git a/Erupe/network/mhfpacket/msg_mhf_charge_festa.go b/network/mhfpacket/msg_mhf_charge_festa.go similarity index 100% rename from Erupe/network/mhfpacket/msg_mhf_charge_festa.go rename to network/mhfpacket/msg_mhf_charge_festa.go diff --git a/Erupe/network/mhfpacket/msg_mhf_charge_guild_adventure.go b/network/mhfpacket/msg_mhf_charge_guild_adventure.go similarity index 100% rename from Erupe/network/mhfpacket/msg_mhf_charge_guild_adventure.go rename to network/mhfpacket/msg_mhf_charge_guild_adventure.go diff --git a/Erupe/network/mhfpacket/msg_mhf_check_daily_cafepoint.go b/network/mhfpacket/msg_mhf_check_daily_cafepoint.go similarity index 100% rename from Erupe/network/mhfpacket/msg_mhf_check_daily_cafepoint.go rename to network/mhfpacket/msg_mhf_check_daily_cafepoint.go diff --git a/Erupe/network/mhfpacket/msg_mhf_check_monthly_item.go b/network/mhfpacket/msg_mhf_check_monthly_item.go similarity index 100% rename from Erupe/network/mhfpacket/msg_mhf_check_monthly_item.go rename to network/mhfpacket/msg_mhf_check_monthly_item.go diff --git a/Erupe/network/mhfpacket/msg_mhf_check_weekly_stamp.go b/network/mhfpacket/msg_mhf_check_weekly_stamp.go similarity index 100% rename from Erupe/network/mhfpacket/msg_mhf_check_weekly_stamp.go rename to network/mhfpacket/msg_mhf_check_weekly_stamp.go diff --git a/Erupe/network/mhfpacket/msg_mhf_contract_mercenary.go b/network/mhfpacket/msg_mhf_contract_mercenary.go similarity index 100% rename from Erupe/network/mhfpacket/msg_mhf_contract_mercenary.go rename to network/mhfpacket/msg_mhf_contract_mercenary.go diff --git a/Erupe/network/mhfpacket/msg_mhf_create_guild.go b/network/mhfpacket/msg_mhf_create_guild.go similarity index 100% rename from Erupe/network/mhfpacket/msg_mhf_create_guild.go rename to network/mhfpacket/msg_mhf_create_guild.go diff --git a/Erupe/network/mhfpacket/msg_mhf_create_joint.go b/network/mhfpacket/msg_mhf_create_joint.go similarity index 100% rename from Erupe/network/mhfpacket/msg_mhf_create_joint.go rename to network/mhfpacket/msg_mhf_create_joint.go diff --git a/Erupe/network/mhfpacket/msg_mhf_create_mercenary.go b/network/mhfpacket/msg_mhf_create_mercenary.go similarity index 100% rename from Erupe/network/mhfpacket/msg_mhf_create_mercenary.go rename to network/mhfpacket/msg_mhf_create_mercenary.go diff --git a/Erupe/network/mhfpacket/msg_mhf_debug_post_value.go b/network/mhfpacket/msg_mhf_debug_post_value.go similarity index 100% rename from Erupe/network/mhfpacket/msg_mhf_debug_post_value.go rename to network/mhfpacket/msg_mhf_debug_post_value.go diff --git a/Erupe/network/mhfpacket/msg_mhf_displayed_achievement.go b/network/mhfpacket/msg_mhf_displayed_achievement.go similarity index 100% rename from Erupe/network/mhfpacket/msg_mhf_displayed_achievement.go rename to network/mhfpacket/msg_mhf_displayed_achievement.go diff --git a/Erupe/network/mhfpacket/msg_mhf_enter_tournament_quest.go b/network/mhfpacket/msg_mhf_enter_tournament_quest.go similarity index 100% rename from Erupe/network/mhfpacket/msg_mhf_enter_tournament_quest.go rename to network/mhfpacket/msg_mhf_enter_tournament_quest.go diff --git a/Erupe/network/mhfpacket/msg_mhf_entry_festa.go b/network/mhfpacket/msg_mhf_entry_festa.go similarity index 100% rename from Erupe/network/mhfpacket/msg_mhf_entry_festa.go rename to network/mhfpacket/msg_mhf_entry_festa.go diff --git a/Erupe/network/mhfpacket/msg_mhf_entry_rookie_guild.go b/network/mhfpacket/msg_mhf_entry_rookie_guild.go similarity index 100% rename from Erupe/network/mhfpacket/msg_mhf_entry_rookie_guild.go rename to network/mhfpacket/msg_mhf_entry_rookie_guild.go diff --git a/Erupe/network/mhfpacket/msg_mhf_entry_tournament.go b/network/mhfpacket/msg_mhf_entry_tournament.go similarity index 100% rename from Erupe/network/mhfpacket/msg_mhf_entry_tournament.go rename to network/mhfpacket/msg_mhf_entry_tournament.go diff --git a/Erupe/network/mhfpacket/msg_mhf_enumerate_airoulist.go b/network/mhfpacket/msg_mhf_enumerate_airoulist.go similarity index 85% rename from Erupe/network/mhfpacket/msg_mhf_enumerate_airoulist.go rename to network/mhfpacket/msg_mhf_enumerate_airoulist.go index 428b014ca..5af0d4c6d 100644 --- a/Erupe/network/mhfpacket/msg_mhf_enumerate_airoulist.go +++ b/network/mhfpacket/msg_mhf_enumerate_airoulist.go @@ -1,18 +1,18 @@ package mhfpacket import ( - "errors" + "errors" - "erupe-ce/network/clientctx" - "erupe-ce/network" "erupe-ce/common/byteframe" + "erupe-ce/network" + "erupe-ce/network/clientctx" ) // MsgMhfEnumerateAiroulist represents the MSG_MHF_ENUMERATE_AIROULIST type MsgMhfEnumerateAiroulist struct { AckHandle uint32 - Unk0 uint16 - Unk1 uint16 + Unk0 uint16 + Unk1 uint16 } // Opcode returns the ID associated with this packet type. @@ -23,8 +23,8 @@ func (m *MsgMhfEnumerateAiroulist) Opcode() network.PacketID { // Parse parses the packet from binary func (m *MsgMhfEnumerateAiroulist) Parse(bf *byteframe.ByteFrame, ctx *clientctx.ClientContext) error { m.AckHandle = bf.ReadUint32() - m.Unk0 = bf.ReadUint16() - m.Unk1 = bf.ReadUint16() + m.Unk0 = bf.ReadUint16() + m.Unk1 = bf.ReadUint16() return nil } diff --git a/Erupe/network/mhfpacket/msg_mhf_enumerate_campaign.go b/network/mhfpacket/msg_mhf_enumerate_campaign.go similarity index 100% rename from Erupe/network/mhfpacket/msg_mhf_enumerate_campaign.go rename to network/mhfpacket/msg_mhf_enumerate_campaign.go diff --git a/Erupe/network/mhfpacket/msg_mhf_enumerate_dist_item.go b/network/mhfpacket/msg_mhf_enumerate_dist_item.go similarity index 100% rename from Erupe/network/mhfpacket/msg_mhf_enumerate_dist_item.go rename to network/mhfpacket/msg_mhf_enumerate_dist_item.go diff --git a/Erupe/network/mhfpacket/msg_mhf_enumerate_event.go b/network/mhfpacket/msg_mhf_enumerate_event.go similarity index 100% rename from Erupe/network/mhfpacket/msg_mhf_enumerate_event.go rename to network/mhfpacket/msg_mhf_enumerate_event.go diff --git a/Erupe/network/mhfpacket/msg_mhf_enumerate_festa_intermediate_prize.go b/network/mhfpacket/msg_mhf_enumerate_festa_intermediate_prize.go similarity index 100% rename from Erupe/network/mhfpacket/msg_mhf_enumerate_festa_intermediate_prize.go rename to network/mhfpacket/msg_mhf_enumerate_festa_intermediate_prize.go diff --git a/Erupe/network/mhfpacket/msg_mhf_enumerate_festa_member.go b/network/mhfpacket/msg_mhf_enumerate_festa_member.go similarity index 100% rename from Erupe/network/mhfpacket/msg_mhf_enumerate_festa_member.go rename to network/mhfpacket/msg_mhf_enumerate_festa_member.go diff --git a/Erupe/network/mhfpacket/msg_mhf_enumerate_festa_personal_prize.go b/network/mhfpacket/msg_mhf_enumerate_festa_personal_prize.go similarity index 100% rename from Erupe/network/mhfpacket/msg_mhf_enumerate_festa_personal_prize.go rename to network/mhfpacket/msg_mhf_enumerate_festa_personal_prize.go diff --git a/Erupe/network/mhfpacket/msg_mhf_enumerate_guacot.go b/network/mhfpacket/msg_mhf_enumerate_guacot.go similarity index 89% rename from Erupe/network/mhfpacket/msg_mhf_enumerate_guacot.go rename to network/mhfpacket/msg_mhf_enumerate_guacot.go index 4abe87e07..4fcdba523 100644 --- a/Erupe/network/mhfpacket/msg_mhf_enumerate_guacot.go +++ b/network/mhfpacket/msg_mhf_enumerate_guacot.go @@ -1,9 +1,11 @@ package mhfpacket import ( + "errors" + + "erupe-ce/common/byteframe" "erupe-ce/network" "erupe-ce/network/clientctx" - "erupe-ce/common/byteframe" ) // MsgMhfEnumerateGuacot represents the MSG_MHF_ENUMERATE_GUACOT @@ -30,9 +32,5 @@ func (m *MsgMhfEnumerateGuacot) Parse(bf *byteframe.ByteFrame, ctx *clientctx.Cl // Build builds a binary packet from the current data. func (m *MsgMhfEnumerateGuacot) Build(bf *byteframe.ByteFrame, ctx *clientctx.ClientContext) error { - bf.WriteUint32(m.AckHandle) - bf.WriteUint16(m.Unk0) - bf.WriteUint16(m.Unk1) - bf.WriteUint16(m.Unk2) - return nil + return errors.New("NOT IMPLEMENTED") } diff --git a/Erupe/network/mhfpacket/msg_mhf_enumerate_guild.go b/network/mhfpacket/msg_mhf_enumerate_guild.go similarity index 54% rename from Erupe/network/mhfpacket/msg_mhf_enumerate_guild.go rename to network/mhfpacket/msg_mhf_enumerate_guild.go index b8f5bd2c8..65edbc555 100644 --- a/Erupe/network/mhfpacket/msg_mhf_enumerate_guild.go +++ b/network/mhfpacket/msg_mhf_enumerate_guild.go @@ -1,35 +1,37 @@ package mhfpacket import ( - "errors" + "errors" + "io" - "erupe-ce/network/clientctx" - "erupe-ce/network" "erupe-ce/common/byteframe" + "erupe-ce/network" + "erupe-ce/network/clientctx" ) type EnumerateGuildType uint8 const ( - ENUMERATE_GUILD_TYPE_GUILD_NAME = 0x01 - ENUMERATE_GUILD_TYPE_LEADER_NAME = 0x02 - ENUMERATE_GUILD_TYPE_LEADER_ID = 0x03 - ENUMERATE_GUILD_TYPE_ORDER_MEMBERS = 0x04 - ENUMERATE_GUILD_TYPE_ORDER_REGISTRATION = 0x05 - ENUMERATE_GUILD_TYPE_ORDER_RANK = 0x06 - ENUMERATE_GUILD_TYPE_MOTTO = 0x07 - ENUMERATE_GUILD_TYPE_RECRUITING = 0x08 - ENUMERATE_ALLIANCE_TYPE_ALLIANCE_NAME = 0x09 - ENUMERATE_ALLIANCE_TYPE_LEADER_NAME = 0x0A - ENUMERATE_ALLIANCE_TYPE_LEADER_ID = 0x0B - ENUMERATE_ALLIANCE_TYPE_ORDER_MEMBERS = 0x0C - ENUMERATE_ALLIANCE_TYPE_ORDER_REGISTRATION = 0x0D + ENUMERATE_GUILD_TYPE_GUILD_NAME = 0x01 + ENUMERATE_GUILD_TYPE_LEADER_NAME = 0x02 + ENUMERATE_GUILD_TYPE_LEADER_ID = 0x03 + ENUMERATE_GUILD_TYPE_ORDER_MEMBERS = 0x04 + ENUMERATE_GUILD_TYPE_ORDER_REGISTRATION = 0x05 + ENUMERATE_GUILD_TYPE_ORDER_RANK = 0x06 + ENUMERATE_GUILD_TYPE_MOTTO = 0x07 + ENUMERATE_GUILD_TYPE_RECRUITING = 0x08 + ENUMERATE_ALLIANCE_TYPE_ALLIANCE_NAME = 0x09 + ENUMERATE_ALLIANCE_TYPE_LEADER_NAME = 0x0A + ENUMERATE_ALLIANCE_TYPE_LEADER_ID = 0x0B + ENUMERATE_ALLIANCE_TYPE_ORDER_MEMBERS = 0x0C + ENUMERATE_ALLIANCE_TYPE_ORDER_REGISTRATION = 0x0D ) // MsgMhfEnumerateGuild represents the MSG_MHF_ENUMERATE_GUILD type MsgMhfEnumerateGuild struct { AckHandle uint32 Type EnumerateGuildType + Page uint8 RawDataPayload []byte } @@ -42,8 +44,9 @@ func (m *MsgMhfEnumerateGuild) Opcode() network.PacketID { func (m *MsgMhfEnumerateGuild) Parse(bf *byteframe.ByteFrame, ctx *clientctx.ClientContext) error { m.AckHandle = bf.ReadUint32() m.Type = EnumerateGuildType(bf.ReadUint8()) + m.Page = bf.ReadUint8() m.RawDataPayload = bf.DataFromCurrent() - bf.Seek(int64(len(bf.Data()) - 2), 0) + bf.Seek(-2, io.SeekEnd) return nil } diff --git a/Erupe/network/mhfpacket/msg_mhf_enumerate_guild_item.go b/network/mhfpacket/msg_mhf_enumerate_guild_item.go similarity index 100% rename from Erupe/network/mhfpacket/msg_mhf_enumerate_guild_item.go rename to network/mhfpacket/msg_mhf_enumerate_guild_item.go diff --git a/Erupe/network/mhfpacket/msg_mhf_enumerate_guild_member.go b/network/mhfpacket/msg_mhf_enumerate_guild_member.go similarity index 100% rename from Erupe/network/mhfpacket/msg_mhf_enumerate_guild_member.go rename to network/mhfpacket/msg_mhf_enumerate_guild_member.go diff --git a/Erupe/network/mhfpacket/msg_mhf_enumerate_guild_message_board.go b/network/mhfpacket/msg_mhf_enumerate_guild_message_board.go similarity index 100% rename from Erupe/network/mhfpacket/msg_mhf_enumerate_guild_message_board.go rename to network/mhfpacket/msg_mhf_enumerate_guild_message_board.go diff --git a/Erupe/network/mhfpacket/msg_mhf_enumerate_guild_tresure.go b/network/mhfpacket/msg_mhf_enumerate_guild_tresure.go similarity index 100% rename from Erupe/network/mhfpacket/msg_mhf_enumerate_guild_tresure.go rename to network/mhfpacket/msg_mhf_enumerate_guild_tresure.go diff --git a/Erupe/network/mhfpacket/msg_mhf_enumerate_house.go b/network/mhfpacket/msg_mhf_enumerate_house.go similarity index 100% rename from Erupe/network/mhfpacket/msg_mhf_enumerate_house.go rename to network/mhfpacket/msg_mhf_enumerate_house.go diff --git a/Erupe/network/mhfpacket/msg_mhf_enumerate_inv_guild.go b/network/mhfpacket/msg_mhf_enumerate_inv_guild.go similarity index 77% rename from Erupe/network/mhfpacket/msg_mhf_enumerate_inv_guild.go rename to network/mhfpacket/msg_mhf_enumerate_inv_guild.go index 5080fffe2..cf2057bed 100644 --- a/Erupe/network/mhfpacket/msg_mhf_enumerate_inv_guild.go +++ b/network/mhfpacket/msg_mhf_enumerate_inv_guild.go @@ -1,15 +1,18 @@ package mhfpacket -import ( - "errors" +import ( + "errors" - "erupe-ce/network/clientctx" - "erupe-ce/network" "erupe-ce/common/byteframe" + "erupe-ce/network" + "erupe-ce/network/clientctx" ) // MsgMhfEnumerateInvGuild represents the MSG_MHF_ENUMERATE_INV_GUILD -type MsgMhfEnumerateInvGuild struct{} +type MsgMhfEnumerateInvGuild struct { + AckHandle uint32 + Unk []byte +} // Opcode returns the ID associated with this packet type. func (m *MsgMhfEnumerateInvGuild) Opcode() network.PacketID { @@ -18,7 +21,9 @@ func (m *MsgMhfEnumerateInvGuild) Opcode() network.PacketID { // Parse parses the packet from binary func (m *MsgMhfEnumerateInvGuild) Parse(bf *byteframe.ByteFrame, ctx *clientctx.ClientContext) error { - return errors.New("NOT IMPLEMENTED") + m.AckHandle = bf.ReadUint32() + m.Unk = bf.ReadBytes(9) + return nil } // Build builds a binary packet from the current data. diff --git a/Erupe/network/mhfpacket/msg_mhf_enumerate_item.go b/network/mhfpacket/msg_mhf_enumerate_item.go similarity index 100% rename from Erupe/network/mhfpacket/msg_mhf_enumerate_item.go rename to network/mhfpacket/msg_mhf_enumerate_item.go diff --git a/Erupe/network/mhfpacket/msg_mhf_enumerate_mercenary_log.go b/network/mhfpacket/msg_mhf_enumerate_mercenary_log.go similarity index 100% rename from Erupe/network/mhfpacket/msg_mhf_enumerate_mercenary_log.go rename to network/mhfpacket/msg_mhf_enumerate_mercenary_log.go diff --git a/Erupe/network/mhfpacket/msg_mhf_enumerate_order.go b/network/mhfpacket/msg_mhf_enumerate_order.go similarity index 100% rename from Erupe/network/mhfpacket/msg_mhf_enumerate_order.go rename to network/mhfpacket/msg_mhf_enumerate_order.go diff --git a/Erupe/network/mhfpacket/msg_mhf_enumerate_price.go b/network/mhfpacket/msg_mhf_enumerate_price.go similarity index 100% rename from Erupe/network/mhfpacket/msg_mhf_enumerate_price.go rename to network/mhfpacket/msg_mhf_enumerate_price.go diff --git a/Erupe/network/mhfpacket/msg_mhf_enumerate_quest.go b/network/mhfpacket/msg_mhf_enumerate_quest.go similarity index 100% rename from Erupe/network/mhfpacket/msg_mhf_enumerate_quest.go rename to network/mhfpacket/msg_mhf_enumerate_quest.go diff --git a/Erupe/network/mhfpacket/msg_mhf_enumerate_ranking.go b/network/mhfpacket/msg_mhf_enumerate_ranking.go similarity index 100% rename from Erupe/network/mhfpacket/msg_mhf_enumerate_ranking.go rename to network/mhfpacket/msg_mhf_enumerate_ranking.go diff --git a/Erupe/network/mhfpacket/msg_mhf_enumerate_rengoku_ranking.go b/network/mhfpacket/msg_mhf_enumerate_rengoku_ranking.go similarity index 100% rename from Erupe/network/mhfpacket/msg_mhf_enumerate_rengoku_ranking.go rename to network/mhfpacket/msg_mhf_enumerate_rengoku_ranking.go diff --git a/Erupe/network/mhfpacket/msg_mhf_enumerate_shop.go b/network/mhfpacket/msg_mhf_enumerate_shop.go similarity index 100% rename from Erupe/network/mhfpacket/msg_mhf_enumerate_shop.go rename to network/mhfpacket/msg_mhf_enumerate_shop.go diff --git a/Erupe/network/mhfpacket/msg_mhf_enumerate_title.go b/network/mhfpacket/msg_mhf_enumerate_title.go similarity index 100% rename from Erupe/network/mhfpacket/msg_mhf_enumerate_title.go rename to network/mhfpacket/msg_mhf_enumerate_title.go diff --git a/Erupe/network/mhfpacket/msg_mhf_enumerate_union_item.go b/network/mhfpacket/msg_mhf_enumerate_union_item.go similarity index 100% rename from Erupe/network/mhfpacket/msg_mhf_enumerate_union_item.go rename to network/mhfpacket/msg_mhf_enumerate_union_item.go diff --git a/Erupe/network/mhfpacket/msg_mhf_enumerate_warehouse.go b/network/mhfpacket/msg_mhf_enumerate_warehouse.go similarity index 100% rename from Erupe/network/mhfpacket/msg_mhf_enumerate_warehouse.go rename to network/mhfpacket/msg_mhf_enumerate_warehouse.go diff --git a/Erupe/network/mhfpacket/msg_mhf_exchange_fpoint_2_item.go b/network/mhfpacket/msg_mhf_exchange_fpoint_2_item.go similarity index 100% rename from Erupe/network/mhfpacket/msg_mhf_exchange_fpoint_2_item.go rename to network/mhfpacket/msg_mhf_exchange_fpoint_2_item.go diff --git a/Erupe/network/mhfpacket/msg_mhf_exchange_item_2_fpoint.go b/network/mhfpacket/msg_mhf_exchange_item_2_fpoint.go similarity index 100% rename from Erupe/network/mhfpacket/msg_mhf_exchange_item_2_fpoint.go rename to network/mhfpacket/msg_mhf_exchange_item_2_fpoint.go diff --git a/Erupe/network/mhfpacket/msg_mhf_exchange_kouryou_point.go b/network/mhfpacket/msg_mhf_exchange_kouryou_point.go similarity index 100% rename from Erupe/network/mhfpacket/msg_mhf_exchange_kouryou_point.go rename to network/mhfpacket/msg_mhf_exchange_kouryou_point.go diff --git a/Erupe/network/mhfpacket/msg_mhf_exchange_weekly_stamp.go b/network/mhfpacket/msg_mhf_exchange_weekly_stamp.go similarity index 100% rename from Erupe/network/mhfpacket/msg_mhf_exchange_weekly_stamp.go rename to network/mhfpacket/msg_mhf_exchange_weekly_stamp.go diff --git a/Erupe/network/mhfpacket/msg_mhf_generate_ud_guild_map.go b/network/mhfpacket/msg_mhf_generate_ud_guild_map.go similarity index 100% rename from Erupe/network/mhfpacket/msg_mhf_generate_ud_guild_map.go rename to network/mhfpacket/msg_mhf_generate_ud_guild_map.go diff --git a/Erupe/network/mhfpacket/msg_mhf_get_achievement.go b/network/mhfpacket/msg_mhf_get_achievement.go similarity index 100% rename from Erupe/network/mhfpacket/msg_mhf_get_achievement.go rename to network/mhfpacket/msg_mhf_get_achievement.go diff --git a/Erupe/network/mhfpacket/msg_mhf_get_additional_beat_reward.go b/network/mhfpacket/msg_mhf_get_additional_beat_reward.go similarity index 100% rename from Erupe/network/mhfpacket/msg_mhf_get_additional_beat_reward.go rename to network/mhfpacket/msg_mhf_get_additional_beat_reward.go diff --git a/Erupe/network/mhfpacket/msg_mhf_get_bbs_sns_status.go b/network/mhfpacket/msg_mhf_get_bbs_sns_status.go similarity index 100% rename from Erupe/network/mhfpacket/msg_mhf_get_bbs_sns_status.go rename to network/mhfpacket/msg_mhf_get_bbs_sns_status.go diff --git a/Erupe/network/mhfpacket/msg_mhf_get_bbs_user_status.go b/network/mhfpacket/msg_mhf_get_bbs_user_status.go similarity index 100% rename from Erupe/network/mhfpacket/msg_mhf_get_bbs_user_status.go rename to network/mhfpacket/msg_mhf_get_bbs_user_status.go diff --git a/Erupe/network/mhfpacket/msg_mhf_get_boost_right.go b/network/mhfpacket/msg_mhf_get_boost_right.go similarity index 100% rename from Erupe/network/mhfpacket/msg_mhf_get_boost_right.go rename to network/mhfpacket/msg_mhf_get_boost_right.go diff --git a/Erupe/network/mhfpacket/msg_mhf_get_boost_time.go b/network/mhfpacket/msg_mhf_get_boost_time.go similarity index 100% rename from Erupe/network/mhfpacket/msg_mhf_get_boost_time.go rename to network/mhfpacket/msg_mhf_get_boost_time.go diff --git a/Erupe/network/mhfpacket/msg_mhf_get_boost_time_limit.go b/network/mhfpacket/msg_mhf_get_boost_time_limit.go similarity index 100% rename from Erupe/network/mhfpacket/msg_mhf_get_boost_time_limit.go rename to network/mhfpacket/msg_mhf_get_boost_time_limit.go diff --git a/Erupe/network/mhfpacket/msg_mhf_get_box_gacha_info.go b/network/mhfpacket/msg_mhf_get_box_gacha_info.go similarity index 100% rename from Erupe/network/mhfpacket/msg_mhf_get_box_gacha_info.go rename to network/mhfpacket/msg_mhf_get_box_gacha_info.go diff --git a/Erupe/network/mhfpacket/msg_mhf_get_break_seibatu_level_reward.go b/network/mhfpacket/msg_mhf_get_break_seibatu_level_reward.go similarity index 100% rename from Erupe/network/mhfpacket/msg_mhf_get_break_seibatu_level_reward.go rename to network/mhfpacket/msg_mhf_get_break_seibatu_level_reward.go diff --git a/Erupe/network/mhfpacket/msg_mhf_get_ca_achievement_hist.go b/network/mhfpacket/msg_mhf_get_ca_achievement_hist.go similarity index 100% rename from Erupe/network/mhfpacket/msg_mhf_get_ca_achievement_hist.go rename to network/mhfpacket/msg_mhf_get_ca_achievement_hist.go diff --git a/Erupe/network/mhfpacket/msg_mhf_get_ca_unique_id.go b/network/mhfpacket/msg_mhf_get_ca_unique_id.go similarity index 100% rename from Erupe/network/mhfpacket/msg_mhf_get_ca_unique_id.go rename to network/mhfpacket/msg_mhf_get_ca_unique_id.go diff --git a/Erupe/network/mhfpacket/msg_mhf_get_cafe_duration.go b/network/mhfpacket/msg_mhf_get_cafe_duration.go similarity index 100% rename from Erupe/network/mhfpacket/msg_mhf_get_cafe_duration.go rename to network/mhfpacket/msg_mhf_get_cafe_duration.go diff --git a/Erupe/network/mhfpacket/msg_mhf_get_cafe_duration_bonus_info.go b/network/mhfpacket/msg_mhf_get_cafe_duration_bonus_info.go similarity index 100% rename from Erupe/network/mhfpacket/msg_mhf_get_cafe_duration_bonus_info.go rename to network/mhfpacket/msg_mhf_get_cafe_duration_bonus_info.go diff --git a/Erupe/network/mhfpacket/msg_mhf_get_cog_info.go b/network/mhfpacket/msg_mhf_get_cog_info.go similarity index 100% rename from Erupe/network/mhfpacket/msg_mhf_get_cog_info.go rename to network/mhfpacket/msg_mhf_get_cog_info.go diff --git a/Erupe/network/mhfpacket/msg_mhf_get_daily_mission_master.go b/network/mhfpacket/msg_mhf_get_daily_mission_master.go similarity index 100% rename from Erupe/network/mhfpacket/msg_mhf_get_daily_mission_master.go rename to network/mhfpacket/msg_mhf_get_daily_mission_master.go diff --git a/Erupe/network/mhfpacket/msg_mhf_get_daily_mission_personal.go b/network/mhfpacket/msg_mhf_get_daily_mission_personal.go similarity index 100% rename from Erupe/network/mhfpacket/msg_mhf_get_daily_mission_personal.go rename to network/mhfpacket/msg_mhf_get_daily_mission_personal.go diff --git a/Erupe/network/mhfpacket/msg_mhf_get_dist_description.go b/network/mhfpacket/msg_mhf_get_dist_description.go similarity index 100% rename from Erupe/network/mhfpacket/msg_mhf_get_dist_description.go rename to network/mhfpacket/msg_mhf_get_dist_description.go diff --git a/Erupe/network/mhfpacket/msg_mhf_get_earth_status.go b/network/mhfpacket/msg_mhf_get_earth_status.go similarity index 100% rename from Erupe/network/mhfpacket/msg_mhf_get_earth_status.go rename to network/mhfpacket/msg_mhf_get_earth_status.go diff --git a/Erupe/network/mhfpacket/msg_mhf_get_earth_value.go b/network/mhfpacket/msg_mhf_get_earth_value.go similarity index 100% rename from Erupe/network/mhfpacket/msg_mhf_get_earth_value.go rename to network/mhfpacket/msg_mhf_get_earth_value.go diff --git a/Erupe/network/mhfpacket/msg_mhf_get_enhanced_minidata.go b/network/mhfpacket/msg_mhf_get_enhanced_minidata.go similarity index 100% rename from Erupe/network/mhfpacket/msg_mhf_get_enhanced_minidata.go rename to network/mhfpacket/msg_mhf_get_enhanced_minidata.go diff --git a/Erupe/network/mhfpacket/msg_mhf_get_equip_skin_hist.go b/network/mhfpacket/msg_mhf_get_equip_skin_hist.go similarity index 100% rename from Erupe/network/mhfpacket/msg_mhf_get_equip_skin_hist.go rename to network/mhfpacket/msg_mhf_get_equip_skin_hist.go diff --git a/Erupe/network/mhfpacket/msg_mhf_get_etc_points.go b/network/mhfpacket/msg_mhf_get_etc_points.go similarity index 100% rename from Erupe/network/mhfpacket/msg_mhf_get_etc_points.go rename to network/mhfpacket/msg_mhf_get_etc_points.go diff --git a/Erupe/network/mhfpacket/msg_mhf_get_extra_info.go b/network/mhfpacket/msg_mhf_get_extra_info.go similarity index 100% rename from Erupe/network/mhfpacket/msg_mhf_get_extra_info.go rename to network/mhfpacket/msg_mhf_get_extra_info.go diff --git a/Erupe/network/mhfpacket/msg_mhf_get_fixed_seibatu_ranking_table.go b/network/mhfpacket/msg_mhf_get_fixed_seibatu_ranking_table.go similarity index 100% rename from Erupe/network/mhfpacket/msg_mhf_get_fixed_seibatu_ranking_table.go rename to network/mhfpacket/msg_mhf_get_fixed_seibatu_ranking_table.go diff --git a/Erupe/network/mhfpacket/msg_mhf_get_fpoint_exchange_list.go b/network/mhfpacket/msg_mhf_get_fpoint_exchange_list.go similarity index 100% rename from Erupe/network/mhfpacket/msg_mhf_get_fpoint_exchange_list.go rename to network/mhfpacket/msg_mhf_get_fpoint_exchange_list.go diff --git a/Erupe/network/mhfpacket/msg_mhf_get_gacha_play_history.go b/network/mhfpacket/msg_mhf_get_gacha_play_history.go similarity index 100% rename from Erupe/network/mhfpacket/msg_mhf_get_gacha_play_history.go rename to network/mhfpacket/msg_mhf_get_gacha_play_history.go diff --git a/Erupe/network/mhfpacket/msg_mhf_get_gacha_point.go b/network/mhfpacket/msg_mhf_get_gacha_point.go similarity index 100% rename from Erupe/network/mhfpacket/msg_mhf_get_gacha_point.go rename to network/mhfpacket/msg_mhf_get_gacha_point.go diff --git a/Erupe/network/mhfpacket/msg_mhf_get_gem_info.go b/network/mhfpacket/msg_mhf_get_gem_info.go similarity index 100% rename from Erupe/network/mhfpacket/msg_mhf_get_gem_info.go rename to network/mhfpacket/msg_mhf_get_gem_info.go diff --git a/Erupe/network/mhfpacket/msg_mhf_get_guild_manage_right.go b/network/mhfpacket/msg_mhf_get_guild_manage_right.go similarity index 100% rename from Erupe/network/mhfpacket/msg_mhf_get_guild_manage_right.go rename to network/mhfpacket/msg_mhf_get_guild_manage_right.go diff --git a/Erupe/network/mhfpacket/msg_mhf_get_guild_mission_list.go b/network/mhfpacket/msg_mhf_get_guild_mission_list.go similarity index 100% rename from Erupe/network/mhfpacket/msg_mhf_get_guild_mission_list.go rename to network/mhfpacket/msg_mhf_get_guild_mission_list.go diff --git a/Erupe/network/mhfpacket/msg_mhf_get_guild_mission_record.go b/network/mhfpacket/msg_mhf_get_guild_mission_record.go similarity index 100% rename from Erupe/network/mhfpacket/msg_mhf_get_guild_mission_record.go rename to network/mhfpacket/msg_mhf_get_guild_mission_record.go diff --git a/Erupe/network/mhfpacket/msg_mhf_get_guild_scout_list.go b/network/mhfpacket/msg_mhf_get_guild_scout_list.go similarity index 100% rename from Erupe/network/mhfpacket/msg_mhf_get_guild_scout_list.go rename to network/mhfpacket/msg_mhf_get_guild_scout_list.go diff --git a/Erupe/network/mhfpacket/msg_mhf_get_guild_target_member_num.go b/network/mhfpacket/msg_mhf_get_guild_target_member_num.go similarity index 100% rename from Erupe/network/mhfpacket/msg_mhf_get_guild_target_member_num.go rename to network/mhfpacket/msg_mhf_get_guild_target_member_num.go diff --git a/Erupe/network/mhfpacket/msg_mhf_get_guild_tresure_souvenir.go b/network/mhfpacket/msg_mhf_get_guild_tresure_souvenir.go similarity index 100% rename from Erupe/network/mhfpacket/msg_mhf_get_guild_tresure_souvenir.go rename to network/mhfpacket/msg_mhf_get_guild_tresure_souvenir.go diff --git a/Erupe/network/mhfpacket/msg_mhf_get_guild_weekly_bonus_active_count.go b/network/mhfpacket/msg_mhf_get_guild_weekly_bonus_active_count.go similarity index 100% rename from Erupe/network/mhfpacket/msg_mhf_get_guild_weekly_bonus_active_count.go rename to network/mhfpacket/msg_mhf_get_guild_weekly_bonus_active_count.go diff --git a/Erupe/network/mhfpacket/msg_mhf_get_guild_weekly_bonus_master.go b/network/mhfpacket/msg_mhf_get_guild_weekly_bonus_master.go similarity index 100% rename from Erupe/network/mhfpacket/msg_mhf_get_guild_weekly_bonus_master.go rename to network/mhfpacket/msg_mhf_get_guild_weekly_bonus_master.go diff --git a/Erupe/network/mhfpacket/msg_mhf_get_keep_login_boost_status.go b/network/mhfpacket/msg_mhf_get_keep_login_boost_status.go similarity index 100% rename from Erupe/network/mhfpacket/msg_mhf_get_keep_login_boost_status.go rename to network/mhfpacket/msg_mhf_get_keep_login_boost_status.go diff --git a/Erupe/network/mhfpacket/msg_mhf_get_kiju_info.go b/network/mhfpacket/msg_mhf_get_kiju_info.go similarity index 100% rename from Erupe/network/mhfpacket/msg_mhf_get_kiju_info.go rename to network/mhfpacket/msg_mhf_get_kiju_info.go diff --git a/Erupe/network/mhfpacket/msg_mhf_get_kouryou_point.go b/network/mhfpacket/msg_mhf_get_kouryou_point.go similarity index 100% rename from Erupe/network/mhfpacket/msg_mhf_get_kouryou_point.go rename to network/mhfpacket/msg_mhf_get_kouryou_point.go diff --git a/Erupe/network/mhfpacket/msg_mhf_get_lobby_crowd.go b/network/mhfpacket/msg_mhf_get_lobby_crowd.go similarity index 100% rename from Erupe/network/mhfpacket/msg_mhf_get_lobby_crowd.go rename to network/mhfpacket/msg_mhf_get_lobby_crowd.go diff --git a/Erupe/network/mhfpacket/msg_mhf_get_myhouse_info.go b/network/mhfpacket/msg_mhf_get_myhouse_info.go similarity index 100% rename from Erupe/network/mhfpacket/msg_mhf_get_myhouse_info.go rename to network/mhfpacket/msg_mhf_get_myhouse_info.go diff --git a/Erupe/network/mhfpacket/msg_mhf_get_notice.go b/network/mhfpacket/msg_mhf_get_notice.go similarity index 100% rename from Erupe/network/mhfpacket/msg_mhf_get_notice.go rename to network/mhfpacket/msg_mhf_get_notice.go diff --git a/Erupe/network/mhfpacket/msg_mhf_get_paper_data.go b/network/mhfpacket/msg_mhf_get_paper_data.go similarity index 100% rename from Erupe/network/mhfpacket/msg_mhf_get_paper_data.go rename to network/mhfpacket/msg_mhf_get_paper_data.go diff --git a/Erupe/network/mhfpacket/msg_mhf_get_rand_from_table.go b/network/mhfpacket/msg_mhf_get_rand_from_table.go similarity index 100% rename from Erupe/network/mhfpacket/msg_mhf_get_rand_from_table.go rename to network/mhfpacket/msg_mhf_get_rand_from_table.go diff --git a/Erupe/network/mhfpacket/msg_mhf_get_reject_guild_scout.go b/network/mhfpacket/msg_mhf_get_reject_guild_scout.go similarity index 100% rename from Erupe/network/mhfpacket/msg_mhf_get_reject_guild_scout.go rename to network/mhfpacket/msg_mhf_get_reject_guild_scout.go diff --git a/Erupe/network/mhfpacket/msg_mhf_get_rengoku_binary.go b/network/mhfpacket/msg_mhf_get_rengoku_binary.go similarity index 100% rename from Erupe/network/mhfpacket/msg_mhf_get_rengoku_binary.go rename to network/mhfpacket/msg_mhf_get_rengoku_binary.go diff --git a/Erupe/network/mhfpacket/msg_mhf_get_rengoku_ranking_rank.go b/network/mhfpacket/msg_mhf_get_rengoku_ranking_rank.go similarity index 100% rename from Erupe/network/mhfpacket/msg_mhf_get_rengoku_ranking_rank.go rename to network/mhfpacket/msg_mhf_get_rengoku_ranking_rank.go diff --git a/Erupe/network/mhfpacket/msg_mhf_get_restriction_event.go b/network/mhfpacket/msg_mhf_get_restriction_event.go similarity index 100% rename from Erupe/network/mhfpacket/msg_mhf_get_restriction_event.go rename to network/mhfpacket/msg_mhf_get_restriction_event.go diff --git a/Erupe/network/mhfpacket/msg_mhf_get_reward_song.go b/network/mhfpacket/msg_mhf_get_reward_song.go similarity index 100% rename from Erupe/network/mhfpacket/msg_mhf_get_reward_song.go rename to network/mhfpacket/msg_mhf_get_reward_song.go diff --git a/Erupe/network/mhfpacket/msg_mhf_get_ryoudama.go b/network/mhfpacket/msg_mhf_get_ryoudama.go similarity index 100% rename from Erupe/network/mhfpacket/msg_mhf_get_ryoudama.go rename to network/mhfpacket/msg_mhf_get_ryoudama.go diff --git a/Erupe/network/mhfpacket/msg_mhf_get_seibattle.go b/network/mhfpacket/msg_mhf_get_seibattle.go similarity index 100% rename from Erupe/network/mhfpacket/msg_mhf_get_seibattle.go rename to network/mhfpacket/msg_mhf_get_seibattle.go diff --git a/Erupe/network/mhfpacket/msg_mhf_get_senyu_daily_count.go b/network/mhfpacket/msg_mhf_get_senyu_daily_count.go similarity index 100% rename from Erupe/network/mhfpacket/msg_mhf_get_senyu_daily_count.go rename to network/mhfpacket/msg_mhf_get_senyu_daily_count.go diff --git a/Erupe/network/mhfpacket/msg_mhf_get_stepup_status.go b/network/mhfpacket/msg_mhf_get_stepup_status.go similarity index 100% rename from Erupe/network/mhfpacket/msg_mhf_get_stepup_status.go rename to network/mhfpacket/msg_mhf_get_stepup_status.go diff --git a/Erupe/network/mhfpacket/msg_mhf_get_tenrouirai.go b/network/mhfpacket/msg_mhf_get_tenrouirai.go similarity index 100% rename from Erupe/network/mhfpacket/msg_mhf_get_tenrouirai.go rename to network/mhfpacket/msg_mhf_get_tenrouirai.go diff --git a/Erupe/network/mhfpacket/msg_mhf_get_tiny_bin.go b/network/mhfpacket/msg_mhf_get_tiny_bin.go similarity index 100% rename from Erupe/network/mhfpacket/msg_mhf_get_tiny_bin.go rename to network/mhfpacket/msg_mhf_get_tiny_bin.go diff --git a/Erupe/network/mhfpacket/msg_mhf_get_tower_info.go b/network/mhfpacket/msg_mhf_get_tower_info.go similarity index 100% rename from Erupe/network/mhfpacket/msg_mhf_get_tower_info.go rename to network/mhfpacket/msg_mhf_get_tower_info.go diff --git a/Erupe/network/mhfpacket/msg_mhf_get_trend_weapon.go b/network/mhfpacket/msg_mhf_get_trend_weapon.go similarity index 100% rename from Erupe/network/mhfpacket/msg_mhf_get_trend_weapon.go rename to network/mhfpacket/msg_mhf_get_trend_weapon.go diff --git a/Erupe/network/mhfpacket/msg_mhf_get_ud_bonus_quest_info.go b/network/mhfpacket/msg_mhf_get_ud_bonus_quest_info.go similarity index 100% rename from Erupe/network/mhfpacket/msg_mhf_get_ud_bonus_quest_info.go rename to network/mhfpacket/msg_mhf_get_ud_bonus_quest_info.go diff --git a/Erupe/network/mhfpacket/msg_mhf_get_ud_daily_present_list.go b/network/mhfpacket/msg_mhf_get_ud_daily_present_list.go similarity index 100% rename from Erupe/network/mhfpacket/msg_mhf_get_ud_daily_present_list.go rename to network/mhfpacket/msg_mhf_get_ud_daily_present_list.go diff --git a/Erupe/network/mhfpacket/msg_mhf_get_ud_guild_map_info.go b/network/mhfpacket/msg_mhf_get_ud_guild_map_info.go similarity index 100% rename from Erupe/network/mhfpacket/msg_mhf_get_ud_guild_map_info.go rename to network/mhfpacket/msg_mhf_get_ud_guild_map_info.go diff --git a/Erupe/network/mhfpacket/msg_mhf_get_ud_info.go b/network/mhfpacket/msg_mhf_get_ud_info.go similarity index 100% rename from Erupe/network/mhfpacket/msg_mhf_get_ud_info.go rename to network/mhfpacket/msg_mhf_get_ud_info.go diff --git a/Erupe/network/mhfpacket/msg_mhf_get_ud_monster_point.go b/network/mhfpacket/msg_mhf_get_ud_monster_point.go similarity index 100% rename from Erupe/network/mhfpacket/msg_mhf_get_ud_monster_point.go rename to network/mhfpacket/msg_mhf_get_ud_monster_point.go diff --git a/Erupe/network/mhfpacket/msg_mhf_get_ud_my_point.go b/network/mhfpacket/msg_mhf_get_ud_my_point.go similarity index 100% rename from Erupe/network/mhfpacket/msg_mhf_get_ud_my_point.go rename to network/mhfpacket/msg_mhf_get_ud_my_point.go diff --git a/Erupe/network/mhfpacket/msg_mhf_get_ud_my_ranking.go b/network/mhfpacket/msg_mhf_get_ud_my_ranking.go similarity index 100% rename from Erupe/network/mhfpacket/msg_mhf_get_ud_my_ranking.go rename to network/mhfpacket/msg_mhf_get_ud_my_ranking.go diff --git a/Erupe/network/mhfpacket/msg_mhf_get_ud_norma_present_list.go b/network/mhfpacket/msg_mhf_get_ud_norma_present_list.go similarity index 100% rename from Erupe/network/mhfpacket/msg_mhf_get_ud_norma_present_list.go rename to network/mhfpacket/msg_mhf_get_ud_norma_present_list.go diff --git a/Erupe/network/mhfpacket/msg_mhf_get_ud_ranking.go b/network/mhfpacket/msg_mhf_get_ud_ranking.go similarity index 100% rename from Erupe/network/mhfpacket/msg_mhf_get_ud_ranking.go rename to network/mhfpacket/msg_mhf_get_ud_ranking.go diff --git a/Erupe/network/mhfpacket/msg_mhf_get_ud_ranking_reward_list.go b/network/mhfpacket/msg_mhf_get_ud_ranking_reward_list.go similarity index 100% rename from Erupe/network/mhfpacket/msg_mhf_get_ud_ranking_reward_list.go rename to network/mhfpacket/msg_mhf_get_ud_ranking_reward_list.go diff --git a/Erupe/network/mhfpacket/msg_mhf_get_ud_schedule.go b/network/mhfpacket/msg_mhf_get_ud_schedule.go similarity index 100% rename from Erupe/network/mhfpacket/msg_mhf_get_ud_schedule.go rename to network/mhfpacket/msg_mhf_get_ud_schedule.go diff --git a/Erupe/network/mhfpacket/msg_mhf_get_ud_selected_color_info.go b/network/mhfpacket/msg_mhf_get_ud_selected_color_info.go similarity index 100% rename from Erupe/network/mhfpacket/msg_mhf_get_ud_selected_color_info.go rename to network/mhfpacket/msg_mhf_get_ud_selected_color_info.go diff --git a/Erupe/network/mhfpacket/msg_mhf_get_ud_shop_coin.go b/network/mhfpacket/msg_mhf_get_ud_shop_coin.go similarity index 100% rename from Erupe/network/mhfpacket/msg_mhf_get_ud_shop_coin.go rename to network/mhfpacket/msg_mhf_get_ud_shop_coin.go diff --git a/Erupe/network/mhfpacket/msg_mhf_get_ud_tactics_bonus_quest.go b/network/mhfpacket/msg_mhf_get_ud_tactics_bonus_quest.go similarity index 100% rename from Erupe/network/mhfpacket/msg_mhf_get_ud_tactics_bonus_quest.go rename to network/mhfpacket/msg_mhf_get_ud_tactics_bonus_quest.go diff --git a/Erupe/network/mhfpacket/msg_mhf_get_ud_tactics_first_quest_bonus.go b/network/mhfpacket/msg_mhf_get_ud_tactics_first_quest_bonus.go similarity index 100% rename from Erupe/network/mhfpacket/msg_mhf_get_ud_tactics_first_quest_bonus.go rename to network/mhfpacket/msg_mhf_get_ud_tactics_first_quest_bonus.go diff --git a/Erupe/network/mhfpacket/msg_mhf_get_ud_tactics_follower.go b/network/mhfpacket/msg_mhf_get_ud_tactics_follower.go similarity index 100% rename from Erupe/network/mhfpacket/msg_mhf_get_ud_tactics_follower.go rename to network/mhfpacket/msg_mhf_get_ud_tactics_follower.go diff --git a/Erupe/network/mhfpacket/msg_mhf_get_ud_tactics_log.go b/network/mhfpacket/msg_mhf_get_ud_tactics_log.go similarity index 100% rename from Erupe/network/mhfpacket/msg_mhf_get_ud_tactics_log.go rename to network/mhfpacket/msg_mhf_get_ud_tactics_log.go diff --git a/Erupe/network/mhfpacket/msg_mhf_get_ud_tactics_point.go b/network/mhfpacket/msg_mhf_get_ud_tactics_point.go similarity index 100% rename from Erupe/network/mhfpacket/msg_mhf_get_ud_tactics_point.go rename to network/mhfpacket/msg_mhf_get_ud_tactics_point.go diff --git a/Erupe/network/mhfpacket/msg_mhf_get_ud_tactics_ranking.go b/network/mhfpacket/msg_mhf_get_ud_tactics_ranking.go similarity index 100% rename from Erupe/network/mhfpacket/msg_mhf_get_ud_tactics_ranking.go rename to network/mhfpacket/msg_mhf_get_ud_tactics_ranking.go diff --git a/Erupe/network/mhfpacket/msg_mhf_get_ud_tactics_remaining_point.go b/network/mhfpacket/msg_mhf_get_ud_tactics_remaining_point.go similarity index 100% rename from Erupe/network/mhfpacket/msg_mhf_get_ud_tactics_remaining_point.go rename to network/mhfpacket/msg_mhf_get_ud_tactics_remaining_point.go diff --git a/Erupe/network/mhfpacket/msg_mhf_get_ud_tactics_reward_list.go b/network/mhfpacket/msg_mhf_get_ud_tactics_reward_list.go similarity index 100% rename from Erupe/network/mhfpacket/msg_mhf_get_ud_tactics_reward_list.go rename to network/mhfpacket/msg_mhf_get_ud_tactics_reward_list.go diff --git a/Erupe/network/mhfpacket/msg_mhf_get_ud_total_point_info.go b/network/mhfpacket/msg_mhf_get_ud_total_point_info.go similarity index 100% rename from Erupe/network/mhfpacket/msg_mhf_get_ud_total_point_info.go rename to network/mhfpacket/msg_mhf_get_ud_total_point_info.go diff --git a/Erupe/network/mhfpacket/msg_mhf_get_weekly_schedule.go b/network/mhfpacket/msg_mhf_get_weekly_schedule.go similarity index 100% rename from Erupe/network/mhfpacket/msg_mhf_get_weekly_schedule.go rename to network/mhfpacket/msg_mhf_get_weekly_schedule.go diff --git a/Erupe/network/mhfpacket/msg_mhf_get_weekly_seibatu_ranking_reward.go b/network/mhfpacket/msg_mhf_get_weekly_seibatu_ranking_reward.go similarity index 100% rename from Erupe/network/mhfpacket/msg_mhf_get_weekly_seibatu_ranking_reward.go rename to network/mhfpacket/msg_mhf_get_weekly_seibatu_ranking_reward.go diff --git a/Erupe/network/mhfpacket/msg_mhf_guild_huntdata.go b/network/mhfpacket/msg_mhf_guild_huntdata.go similarity index 100% rename from Erupe/network/mhfpacket/msg_mhf_guild_huntdata.go rename to network/mhfpacket/msg_mhf_guild_huntdata.go diff --git a/Erupe/network/mhfpacket/msg_mhf_info_festa.go b/network/mhfpacket/msg_mhf_info_festa.go similarity index 100% rename from Erupe/network/mhfpacket/msg_mhf_info_festa.go rename to network/mhfpacket/msg_mhf_info_festa.go diff --git a/Erupe/network/mhfpacket/msg_mhf_info_guild.go b/network/mhfpacket/msg_mhf_info_guild.go similarity index 100% rename from Erupe/network/mhfpacket/msg_mhf_info_guild.go rename to network/mhfpacket/msg_mhf_info_guild.go diff --git a/Erupe/network/mhfpacket/msg_mhf_info_joint.go b/network/mhfpacket/msg_mhf_info_joint.go similarity index 100% rename from Erupe/network/mhfpacket/msg_mhf_info_joint.go rename to network/mhfpacket/msg_mhf_info_joint.go diff --git a/Erupe/network/mhfpacket/msg_mhf_info_scenario_counter.go b/network/mhfpacket/msg_mhf_info_scenario_counter.go similarity index 100% rename from Erupe/network/mhfpacket/msg_mhf_info_scenario_counter.go rename to network/mhfpacket/msg_mhf_info_scenario_counter.go diff --git a/Erupe/network/mhfpacket/msg_mhf_info_tournament.go b/network/mhfpacket/msg_mhf_info_tournament.go similarity index 100% rename from Erupe/network/mhfpacket/msg_mhf_info_tournament.go rename to network/mhfpacket/msg_mhf_info_tournament.go diff --git a/Erupe/network/mhfpacket/msg_mhf_kick_export_force.go b/network/mhfpacket/msg_mhf_kick_export_force.go similarity index 100% rename from Erupe/network/mhfpacket/msg_mhf_kick_export_force.go rename to network/mhfpacket/msg_mhf_kick_export_force.go diff --git a/Erupe/network/mhfpacket/msg_mhf_list_mail.go b/network/mhfpacket/msg_mhf_list_mail.go similarity index 100% rename from Erupe/network/mhfpacket/msg_mhf_list_mail.go rename to network/mhfpacket/msg_mhf_list_mail.go diff --git a/Erupe/network/mhfpacket/msg_mhf_list_member.go b/network/mhfpacket/msg_mhf_list_member.go similarity index 100% rename from Erupe/network/mhfpacket/msg_mhf_list_member.go rename to network/mhfpacket/msg_mhf_list_member.go diff --git a/Erupe/network/mhfpacket/msg_mhf_load_deco_myset.go b/network/mhfpacket/msg_mhf_load_deco_myset.go similarity index 100% rename from Erupe/network/mhfpacket/msg_mhf_load_deco_myset.go rename to network/mhfpacket/msg_mhf_load_deco_myset.go diff --git a/Erupe/network/mhfpacket/msg_mhf_load_favorite_quest.go b/network/mhfpacket/msg_mhf_load_favorite_quest.go similarity index 100% rename from Erupe/network/mhfpacket/msg_mhf_load_favorite_quest.go rename to network/mhfpacket/msg_mhf_load_favorite_quest.go diff --git a/Erupe/network/mhfpacket/msg_mhf_load_guild_adventure.go b/network/mhfpacket/msg_mhf_load_guild_adventure.go similarity index 100% rename from Erupe/network/mhfpacket/msg_mhf_load_guild_adventure.go rename to network/mhfpacket/msg_mhf_load_guild_adventure.go diff --git a/Erupe/network/mhfpacket/msg_mhf_load_guild_cooking.go b/network/mhfpacket/msg_mhf_load_guild_cooking.go similarity index 100% rename from Erupe/network/mhfpacket/msg_mhf_load_guild_cooking.go rename to network/mhfpacket/msg_mhf_load_guild_cooking.go diff --git a/Erupe/network/mhfpacket/msg_mhf_load_house.go b/network/mhfpacket/msg_mhf_load_house.go similarity index 100% rename from Erupe/network/mhfpacket/msg_mhf_load_house.go rename to network/mhfpacket/msg_mhf_load_house.go diff --git a/Erupe/network/mhfpacket/msg_mhf_load_hunter_navi.go b/network/mhfpacket/msg_mhf_load_hunter_navi.go similarity index 100% rename from Erupe/network/mhfpacket/msg_mhf_load_hunter_navi.go rename to network/mhfpacket/msg_mhf_load_hunter_navi.go diff --git a/Erupe/network/mhfpacket/msg_mhf_load_legend_dispatch.go b/network/mhfpacket/msg_mhf_load_legend_dispatch.go similarity index 100% rename from Erupe/network/mhfpacket/msg_mhf_load_legend_dispatch.go rename to network/mhfpacket/msg_mhf_load_legend_dispatch.go diff --git a/Erupe/network/mhfpacket/msg_mhf_load_mezfes_data.go b/network/mhfpacket/msg_mhf_load_mezfes_data.go similarity index 100% rename from Erupe/network/mhfpacket/msg_mhf_load_mezfes_data.go rename to network/mhfpacket/msg_mhf_load_mezfes_data.go diff --git a/Erupe/network/mhfpacket/msg_mhf_load_otomo_airou.go b/network/mhfpacket/msg_mhf_load_otomo_airou.go similarity index 100% rename from Erupe/network/mhfpacket/msg_mhf_load_otomo_airou.go rename to network/mhfpacket/msg_mhf_load_otomo_airou.go diff --git a/Erupe/network/mhfpacket/msg_mhf_load_partner.go b/network/mhfpacket/msg_mhf_load_partner.go similarity index 100% rename from Erupe/network/mhfpacket/msg_mhf_load_partner.go rename to network/mhfpacket/msg_mhf_load_partner.go diff --git a/Erupe/network/mhfpacket/msg_mhf_load_plate_box.go b/network/mhfpacket/msg_mhf_load_plate_box.go similarity index 100% rename from Erupe/network/mhfpacket/msg_mhf_load_plate_box.go rename to network/mhfpacket/msg_mhf_load_plate_box.go diff --git a/Erupe/network/mhfpacket/msg_mhf_load_plate_data.go b/network/mhfpacket/msg_mhf_load_plate_data.go similarity index 100% rename from Erupe/network/mhfpacket/msg_mhf_load_plate_data.go rename to network/mhfpacket/msg_mhf_load_plate_data.go diff --git a/Erupe/network/mhfpacket/msg_mhf_load_plate_myset.go b/network/mhfpacket/msg_mhf_load_plate_myset.go similarity index 100% rename from Erupe/network/mhfpacket/msg_mhf_load_plate_myset.go rename to network/mhfpacket/msg_mhf_load_plate_myset.go diff --git a/Erupe/network/mhfpacket/msg_mhf_load_rengoku_data.go b/network/mhfpacket/msg_mhf_load_rengoku_data.go similarity index 100% rename from Erupe/network/mhfpacket/msg_mhf_load_rengoku_data.go rename to network/mhfpacket/msg_mhf_load_rengoku_data.go diff --git a/Erupe/network/mhfpacket/msg_mhf_load_scenario_data.go b/network/mhfpacket/msg_mhf_load_scenario_data.go similarity index 100% rename from Erupe/network/mhfpacket/msg_mhf_load_scenario_data.go rename to network/mhfpacket/msg_mhf_load_scenario_data.go diff --git a/Erupe/network/mhfpacket/msg_mhf_loaddata.go b/network/mhfpacket/msg_mhf_loaddata.go similarity index 100% rename from Erupe/network/mhfpacket/msg_mhf_loaddata.go rename to network/mhfpacket/msg_mhf_loaddata.go diff --git a/Erupe/network/mhfpacket/msg_mhf_mercenary_huntdata.go b/network/mhfpacket/msg_mhf_mercenary_huntdata.go similarity index 84% rename from Erupe/network/mhfpacket/msg_mhf_mercenary_huntdata.go rename to network/mhfpacket/msg_mhf_mercenary_huntdata.go index e99822f17..bdcdf35a3 100644 --- a/Erupe/network/mhfpacket/msg_mhf_mercenary_huntdata.go +++ b/network/mhfpacket/msg_mhf_mercenary_huntdata.go @@ -1,17 +1,17 @@ package mhfpacket -import ( - "errors" +import ( + "errors" - "erupe-ce/network/clientctx" - "erupe-ce/network" "erupe-ce/common/byteframe" + "erupe-ce/network" + "erupe-ce/network/clientctx" ) // MsgMhfMercenaryHuntdata represents the MSG_MHF_MERCENARY_HUNTDATA -type MsgMhfMercenaryHuntdata struct{ - AckHandle uint32 - Unk0 uint8 +type MsgMhfMercenaryHuntdata struct { + AckHandle uint32 + Unk0 uint8 } // Opcode returns the ID associated with this packet type. diff --git a/Erupe/network/mhfpacket/msg_mhf_operate_guild.go b/network/mhfpacket/msg_mhf_operate_guild.go similarity index 100% rename from Erupe/network/mhfpacket/msg_mhf_operate_guild.go rename to network/mhfpacket/msg_mhf_operate_guild.go diff --git a/Erupe/network/mhfpacket/msg_mhf_operate_guild_member.go b/network/mhfpacket/msg_mhf_operate_guild_member.go similarity index 92% rename from Erupe/network/mhfpacket/msg_mhf_operate_guild_member.go rename to network/mhfpacket/msg_mhf_operate_guild_member.go index 62850f63e..7aed7a21d 100644 --- a/Erupe/network/mhfpacket/msg_mhf_operate_guild_member.go +++ b/network/mhfpacket/msg_mhf_operate_guild_member.go @@ -1,11 +1,11 @@ package mhfpacket -import ( - "errors" +import ( + "errors" - "erupe-ce/network/clientctx" - "erupe-ce/network" "erupe-ce/common/byteframe" + "erupe-ce/network" + "erupe-ce/network/clientctx" ) type OperateGuildMemberAction uint8 @@ -23,6 +23,7 @@ type MsgMhfOperateGuildMember struct { GuildID uint32 CharID uint32 Action uint8 + Unk []byte } // Opcode returns the ID associated with this packet type. @@ -36,7 +37,7 @@ func (m *MsgMhfOperateGuildMember) Parse(bf *byteframe.ByteFrame, ctx *clientctx m.GuildID = bf.ReadUint32() m.CharID = bf.ReadUint32() m.Action = bf.ReadUint8() - + m.Unk = bf.ReadBytes(3) return nil } diff --git a/Erupe/network/mhfpacket/msg_mhf_operate_guild_tresure_report.go b/network/mhfpacket/msg_mhf_operate_guild_tresure_report.go similarity index 100% rename from Erupe/network/mhfpacket/msg_mhf_operate_guild_tresure_report.go rename to network/mhfpacket/msg_mhf_operate_guild_tresure_report.go diff --git a/Erupe/network/mhfpacket/msg_mhf_operate_joint.go b/network/mhfpacket/msg_mhf_operate_joint.go similarity index 100% rename from Erupe/network/mhfpacket/msg_mhf_operate_joint.go rename to network/mhfpacket/msg_mhf_operate_joint.go diff --git a/Erupe/network/mhfpacket/msg_mhf_operate_warehouse.go b/network/mhfpacket/msg_mhf_operate_warehouse.go similarity index 100% rename from Erupe/network/mhfpacket/msg_mhf_operate_warehouse.go rename to network/mhfpacket/msg_mhf_operate_warehouse.go diff --git a/Erupe/network/mhfpacket/msg_mhf_operation_inv_guild.go b/network/mhfpacket/msg_mhf_operation_inv_guild.go similarity index 100% rename from Erupe/network/mhfpacket/msg_mhf_operation_inv_guild.go rename to network/mhfpacket/msg_mhf_operation_inv_guild.go diff --git a/Erupe/network/mhfpacket/msg_mhf_opr_member.go b/network/mhfpacket/msg_mhf_opr_member.go similarity index 100% rename from Erupe/network/mhfpacket/msg_mhf_opr_member.go rename to network/mhfpacket/msg_mhf_opr_member.go diff --git a/Erupe/network/mhfpacket/msg_mhf_oprt_mail.go b/network/mhfpacket/msg_mhf_oprt_mail.go similarity index 70% rename from Erupe/network/mhfpacket/msg_mhf_oprt_mail.go rename to network/mhfpacket/msg_mhf_oprt_mail.go index 5da66f115..2c9e06828 100644 --- a/Erupe/network/mhfpacket/msg_mhf_oprt_mail.go +++ b/network/mhfpacket/msg_mhf_oprt_mail.go @@ -1,20 +1,20 @@ package mhfpacket import ( - "errors" + "errors" - "erupe-ce/network/clientctx" - "erupe-ce/network" "erupe-ce/common/byteframe" + "erupe-ce/network" + "erupe-ce/network/clientctx" ) type OperateMailOperation uint8 const ( - OPERATE_MAIL_DELETE = 0x01 - OPERATE_MAIL_LOCK = 0x02 - OPERATE_MAIL_UNLOCK = 0x03 - OPERATE_MAIL_ACQUIRE_ITEM = 0x05 + OPERATE_MAIL_DELETE = 0x01 + OPERATE_MAIL_LOCK = 0x02 + OPERATE_MAIL_UNLOCK = 0x03 + OPERATE_MAIL_ACQUIRE_ITEM = 0x05 ) // MsgMhfOprtMail represents the MSG_MHF_OPRT_MAIL @@ -23,10 +23,10 @@ type MsgMhfOprtMail struct { AccIndex uint8 Index uint8 Operation OperateMailOperation - Unk0 uint8 - Data []byte - Amount uint16 - ItemID uint16 + Unk0 uint8 + Data []byte + Amount uint16 + ItemID uint16 } // Opcode returns the ID associated with this packet type. @@ -40,12 +40,11 @@ func (m *MsgMhfOprtMail) Parse(bf *byteframe.ByteFrame, ctx *clientctx.ClientCon m.AccIndex = bf.ReadUint8() m.Index = bf.ReadUint8() m.Operation = OperateMailOperation(bf.ReadUint8()) - m.Unk0 = bf.ReadUint8() - switch m.Operation { - case OPERATE_MAIL_ACQUIRE_ITEM: - m.Amount = bf.ReadUint16() - m.ItemID = bf.ReadUint16() - } + m.Unk0 = bf.ReadUint8() + if m.Operation == OPERATE_MAIL_ACQUIRE_ITEM { + m.Amount = bf.ReadUint16() + m.ItemID = bf.ReadUint16() + } return nil } diff --git a/Erupe/network/mhfpacket/msg_mhf_payment_achievement.go b/network/mhfpacket/msg_mhf_payment_achievement.go similarity index 100% rename from Erupe/network/mhfpacket/msg_mhf_payment_achievement.go rename to network/mhfpacket/msg_mhf_payment_achievement.go diff --git a/Erupe/network/mhfpacket/msg_mhf_play_box_gacha.go b/network/mhfpacket/msg_mhf_play_box_gacha.go similarity index 100% rename from Erupe/network/mhfpacket/msg_mhf_play_box_gacha.go rename to network/mhfpacket/msg_mhf_play_box_gacha.go diff --git a/Erupe/network/mhfpacket/msg_mhf_play_free_gacha.go b/network/mhfpacket/msg_mhf_play_free_gacha.go similarity index 100% rename from Erupe/network/mhfpacket/msg_mhf_play_free_gacha.go rename to network/mhfpacket/msg_mhf_play_free_gacha.go diff --git a/Erupe/network/mhfpacket/msg_mhf_play_normal_gacha.go b/network/mhfpacket/msg_mhf_play_normal_gacha.go similarity index 100% rename from Erupe/network/mhfpacket/msg_mhf_play_normal_gacha.go rename to network/mhfpacket/msg_mhf_play_normal_gacha.go diff --git a/Erupe/network/mhfpacket/msg_mhf_play_stepup_gacha.go b/network/mhfpacket/msg_mhf_play_stepup_gacha.go similarity index 100% rename from Erupe/network/mhfpacket/msg_mhf_play_stepup_gacha.go rename to network/mhfpacket/msg_mhf_play_stepup_gacha.go diff --git a/Erupe/network/mhfpacket/msg_mhf_post_boost_time.go b/network/mhfpacket/msg_mhf_post_boost_time.go similarity index 100% rename from Erupe/network/mhfpacket/msg_mhf_post_boost_time.go rename to network/mhfpacket/msg_mhf_post_boost_time.go diff --git a/Erupe/network/mhfpacket/msg_mhf_post_boost_time_limit.go b/network/mhfpacket/msg_mhf_post_boost_time_limit.go similarity index 100% rename from Erupe/network/mhfpacket/msg_mhf_post_boost_time_limit.go rename to network/mhfpacket/msg_mhf_post_boost_time_limit.go diff --git a/Erupe/network/mhfpacket/msg_mhf_post_boost_time_quest_return.go b/network/mhfpacket/msg_mhf_post_boost_time_quest_return.go similarity index 100% rename from Erupe/network/mhfpacket/msg_mhf_post_boost_time_quest_return.go rename to network/mhfpacket/msg_mhf_post_boost_time_quest_return.go diff --git a/Erupe/network/mhfpacket/msg_mhf_post_cafe_duration_bonus_received.go b/network/mhfpacket/msg_mhf_post_cafe_duration_bonus_received.go similarity index 100% rename from Erupe/network/mhfpacket/msg_mhf_post_cafe_duration_bonus_received.go rename to network/mhfpacket/msg_mhf_post_cafe_duration_bonus_received.go diff --git a/Erupe/network/mhfpacket/msg_mhf_post_gem_info.go b/network/mhfpacket/msg_mhf_post_gem_info.go similarity index 100% rename from Erupe/network/mhfpacket/msg_mhf_post_gem_info.go rename to network/mhfpacket/msg_mhf_post_gem_info.go diff --git a/Erupe/network/mhfpacket/msg_mhf_post_guild_scout.go b/network/mhfpacket/msg_mhf_post_guild_scout.go similarity index 100% rename from Erupe/network/mhfpacket/msg_mhf_post_guild_scout.go rename to network/mhfpacket/msg_mhf_post_guild_scout.go diff --git a/Erupe/network/mhfpacket/msg_mhf_post_notice.go b/network/mhfpacket/msg_mhf_post_notice.go similarity index 100% rename from Erupe/network/mhfpacket/msg_mhf_post_notice.go rename to network/mhfpacket/msg_mhf_post_notice.go diff --git a/Erupe/network/mhfpacket/msg_mhf_post_ryoudama.go b/network/mhfpacket/msg_mhf_post_ryoudama.go similarity index 100% rename from Erupe/network/mhfpacket/msg_mhf_post_ryoudama.go rename to network/mhfpacket/msg_mhf_post_ryoudama.go diff --git a/Erupe/network/mhfpacket/msg_mhf_post_seibattle.go b/network/mhfpacket/msg_mhf_post_seibattle.go similarity index 100% rename from Erupe/network/mhfpacket/msg_mhf_post_seibattle.go rename to network/mhfpacket/msg_mhf_post_seibattle.go diff --git a/Erupe/network/mhfpacket/msg_mhf_post_tenrouirai.go b/network/mhfpacket/msg_mhf_post_tenrouirai.go similarity index 100% rename from Erupe/network/mhfpacket/msg_mhf_post_tenrouirai.go rename to network/mhfpacket/msg_mhf_post_tenrouirai.go diff --git a/Erupe/network/mhfpacket/msg_mhf_post_tiny_bin.go b/network/mhfpacket/msg_mhf_post_tiny_bin.go similarity index 100% rename from Erupe/network/mhfpacket/msg_mhf_post_tiny_bin.go rename to network/mhfpacket/msg_mhf_post_tiny_bin.go diff --git a/Erupe/network/mhfpacket/msg_mhf_post_tower_info.go b/network/mhfpacket/msg_mhf_post_tower_info.go similarity index 100% rename from Erupe/network/mhfpacket/msg_mhf_post_tower_info.go rename to network/mhfpacket/msg_mhf_post_tower_info.go diff --git a/Erupe/network/mhfpacket/msg_mhf_present_box.go b/network/mhfpacket/msg_mhf_present_box.go similarity index 100% rename from Erupe/network/mhfpacket/msg_mhf_present_box.go rename to network/mhfpacket/msg_mhf_present_box.go diff --git a/Erupe/network/mhfpacket/msg_mhf_read_beat_level.go b/network/mhfpacket/msg_mhf_read_beat_level.go similarity index 100% rename from Erupe/network/mhfpacket/msg_mhf_read_beat_level.go rename to network/mhfpacket/msg_mhf_read_beat_level.go diff --git a/Erupe/network/mhfpacket/msg_mhf_read_beat_level_all_ranking.go b/network/mhfpacket/msg_mhf_read_beat_level_all_ranking.go similarity index 100% rename from Erupe/network/mhfpacket/msg_mhf_read_beat_level_all_ranking.go rename to network/mhfpacket/msg_mhf_read_beat_level_all_ranking.go diff --git a/Erupe/network/mhfpacket/msg_mhf_read_beat_level_my_ranking.go b/network/mhfpacket/msg_mhf_read_beat_level_my_ranking.go similarity index 100% rename from Erupe/network/mhfpacket/msg_mhf_read_beat_level_my_ranking.go rename to network/mhfpacket/msg_mhf_read_beat_level_my_ranking.go diff --git a/Erupe/network/mhfpacket/msg_mhf_read_guildcard.go b/network/mhfpacket/msg_mhf_read_guildcard.go similarity index 100% rename from Erupe/network/mhfpacket/msg_mhf_read_guildcard.go rename to network/mhfpacket/msg_mhf_read_guildcard.go diff --git a/Erupe/network/mhfpacket/msg_mhf_read_last_week_beat_ranking.go b/network/mhfpacket/msg_mhf_read_last_week_beat_ranking.go similarity index 100% rename from Erupe/network/mhfpacket/msg_mhf_read_last_week_beat_ranking.go rename to network/mhfpacket/msg_mhf_read_last_week_beat_ranking.go diff --git a/Erupe/network/mhfpacket/msg_mhf_read_mail.go b/network/mhfpacket/msg_mhf_read_mail.go similarity index 92% rename from Erupe/network/mhfpacket/msg_mhf_read_mail.go rename to network/mhfpacket/msg_mhf_read_mail.go index 3895438bd..1d2b03cf5 100644 --- a/Erupe/network/mhfpacket/msg_mhf_read_mail.go +++ b/network/mhfpacket/msg_mhf_read_mail.go @@ -1,11 +1,11 @@ package mhfpacket import ( - "errors" + "errors" - "erupe-ce/network/clientctx" - "erupe-ce/network" "erupe-ce/common/byteframe" + "erupe-ce/network" + "erupe-ce/network/clientctx" ) // MsgMhfReadMail represents the MSG_MHF_READ_MAIL @@ -19,7 +19,7 @@ type MsgMhfReadMail struct { // This is the index within the current mail list Index uint8 - Unk0 uint16 + Unk0 uint16 } // Opcode returns the ID associated with this packet type. @@ -32,7 +32,7 @@ func (m *MsgMhfReadMail) Parse(bf *byteframe.ByteFrame, ctx *clientctx.ClientCon m.AckHandle = bf.ReadUint32() m.AccIndex = bf.ReadUint8() m.Index = bf.ReadUint8() - m.Unk0 = bf.ReadUint16() + m.Unk0 = bf.ReadUint16() return nil } diff --git a/Erupe/network/mhfpacket/msg_mhf_read_mercenary_m.go b/network/mhfpacket/msg_mhf_read_mercenary_m.go similarity index 83% rename from Erupe/network/mhfpacket/msg_mhf_read_mercenary_m.go rename to network/mhfpacket/msg_mhf_read_mercenary_m.go index f0e967a3f..75c973a74 100644 --- a/Erupe/network/mhfpacket/msg_mhf_read_mercenary_m.go +++ b/network/mhfpacket/msg_mhf_read_mercenary_m.go @@ -1,18 +1,18 @@ package mhfpacket -import ( - "errors" +import ( + "errors" - "erupe-ce/network/clientctx" - "erupe-ce/network" "erupe-ce/common/byteframe" + "erupe-ce/network" + "erupe-ce/network/clientctx" ) // MsgMhfReadMercenaryM represents the MSG_MHF_READ_MERCENARY_M -type MsgMhfReadMercenaryM struct{ - AckHandle uint32 - CharID uint32 - Unk0 uint32 +type MsgMhfReadMercenaryM struct { + AckHandle uint32 + CharID uint32 + Unk0 uint32 } // Opcode returns the ID associated with this packet type. diff --git a/Erupe/network/mhfpacket/msg_mhf_read_mercenary_w.go b/network/mhfpacket/msg_mhf_read_mercenary_w.go similarity index 100% rename from Erupe/network/mhfpacket/msg_mhf_read_mercenary_w.go rename to network/mhfpacket/msg_mhf_read_mercenary_w.go diff --git a/Erupe/network/mhfpacket/msg_mhf_receive_cafe_duration_bonus.go b/network/mhfpacket/msg_mhf_receive_cafe_duration_bonus.go similarity index 100% rename from Erupe/network/mhfpacket/msg_mhf_receive_cafe_duration_bonus.go rename to network/mhfpacket/msg_mhf_receive_cafe_duration_bonus.go diff --git a/Erupe/network/mhfpacket/msg_mhf_receive_gacha_item.go b/network/mhfpacket/msg_mhf_receive_gacha_item.go similarity index 100% rename from Erupe/network/mhfpacket/msg_mhf_receive_gacha_item.go rename to network/mhfpacket/msg_mhf_receive_gacha_item.go diff --git a/Erupe/network/mhfpacket/msg_mhf_regist_guild_adventure.go b/network/mhfpacket/msg_mhf_regist_guild_adventure.go similarity index 100% rename from Erupe/network/mhfpacket/msg_mhf_regist_guild_adventure.go rename to network/mhfpacket/msg_mhf_regist_guild_adventure.go diff --git a/Erupe/network/mhfpacket/msg_mhf_regist_guild_adventure_diva.go b/network/mhfpacket/msg_mhf_regist_guild_adventure_diva.go similarity index 100% rename from Erupe/network/mhfpacket/msg_mhf_regist_guild_adventure_diva.go rename to network/mhfpacket/msg_mhf_regist_guild_adventure_diva.go diff --git a/Erupe/network/mhfpacket/msg_mhf_regist_guild_cooking.go b/network/mhfpacket/msg_mhf_regist_guild_cooking.go similarity index 100% rename from Erupe/network/mhfpacket/msg_mhf_regist_guild_cooking.go rename to network/mhfpacket/msg_mhf_regist_guild_cooking.go diff --git a/Erupe/network/mhfpacket/msg_mhf_regist_guild_tresure.go b/network/mhfpacket/msg_mhf_regist_guild_tresure.go similarity index 100% rename from Erupe/network/mhfpacket/msg_mhf_regist_guild_tresure.go rename to network/mhfpacket/msg_mhf_regist_guild_tresure.go diff --git a/Erupe/network/mhfpacket/msg_mhf_regist_spabi_time.go b/network/mhfpacket/msg_mhf_regist_spabi_time.go similarity index 100% rename from Erupe/network/mhfpacket/msg_mhf_regist_spabi_time.go rename to network/mhfpacket/msg_mhf_regist_spabi_time.go diff --git a/Erupe/network/mhfpacket/msg_mhf_register_event.go b/network/mhfpacket/msg_mhf_register_event.go similarity index 100% rename from Erupe/network/mhfpacket/msg_mhf_register_event.go rename to network/mhfpacket/msg_mhf_register_event.go diff --git a/Erupe/network/mhfpacket/msg_mhf_release_event.go b/network/mhfpacket/msg_mhf_release_event.go similarity index 100% rename from Erupe/network/mhfpacket/msg_mhf_release_event.go rename to network/mhfpacket/msg_mhf_release_event.go diff --git a/Erupe/network/mhfpacket/msg_mhf_reserve10f.go b/network/mhfpacket/msg_mhf_reserve10f.go similarity index 100% rename from Erupe/network/mhfpacket/msg_mhf_reserve10f.go rename to network/mhfpacket/msg_mhf_reserve10f.go diff --git a/Erupe/network/mhfpacket/msg_mhf_reset_achievement.go b/network/mhfpacket/msg_mhf_reset_achievement.go similarity index 100% rename from Erupe/network/mhfpacket/msg_mhf_reset_achievement.go rename to network/mhfpacket/msg_mhf_reset_achievement.go diff --git a/Erupe/network/mhfpacket/msg_mhf_reset_box_gacha_info.go b/network/mhfpacket/msg_mhf_reset_box_gacha_info.go similarity index 100% rename from Erupe/network/mhfpacket/msg_mhf_reset_box_gacha_info.go rename to network/mhfpacket/msg_mhf_reset_box_gacha_info.go diff --git a/Erupe/network/mhfpacket/msg_mhf_reset_title.go b/network/mhfpacket/msg_mhf_reset_title.go similarity index 100% rename from Erupe/network/mhfpacket/msg_mhf_reset_title.go rename to network/mhfpacket/msg_mhf_reset_title.go diff --git a/Erupe/network/mhfpacket/msg_mhf_save_deco_myset.go b/network/mhfpacket/msg_mhf_save_deco_myset.go similarity index 100% rename from Erupe/network/mhfpacket/msg_mhf_save_deco_myset.go rename to network/mhfpacket/msg_mhf_save_deco_myset.go diff --git a/Erupe/network/mhfpacket/msg_mhf_save_favorite_quest.go b/network/mhfpacket/msg_mhf_save_favorite_quest.go similarity index 100% rename from Erupe/network/mhfpacket/msg_mhf_save_favorite_quest.go rename to network/mhfpacket/msg_mhf_save_favorite_quest.go diff --git a/Erupe/network/mhfpacket/msg_mhf_save_hunter_navi.go b/network/mhfpacket/msg_mhf_save_hunter_navi.go similarity index 100% rename from Erupe/network/mhfpacket/msg_mhf_save_hunter_navi.go rename to network/mhfpacket/msg_mhf_save_hunter_navi.go diff --git a/Erupe/network/mhfpacket/msg_mhf_save_mercenary.go b/network/mhfpacket/msg_mhf_save_mercenary.go similarity index 100% rename from Erupe/network/mhfpacket/msg_mhf_save_mercenary.go rename to network/mhfpacket/msg_mhf_save_mercenary.go diff --git a/Erupe/network/mhfpacket/msg_mhf_save_mezfes_data.go b/network/mhfpacket/msg_mhf_save_mezfes_data.go similarity index 100% rename from Erupe/network/mhfpacket/msg_mhf_save_mezfes_data.go rename to network/mhfpacket/msg_mhf_save_mezfes_data.go diff --git a/Erupe/network/mhfpacket/msg_mhf_save_otomo_airou.go b/network/mhfpacket/msg_mhf_save_otomo_airou.go similarity index 100% rename from Erupe/network/mhfpacket/msg_mhf_save_otomo_airou.go rename to network/mhfpacket/msg_mhf_save_otomo_airou.go diff --git a/Erupe/network/mhfpacket/msg_mhf_save_partner.go b/network/mhfpacket/msg_mhf_save_partner.go similarity index 100% rename from Erupe/network/mhfpacket/msg_mhf_save_partner.go rename to network/mhfpacket/msg_mhf_save_partner.go diff --git a/Erupe/network/mhfpacket/msg_mhf_save_plate_box.go b/network/mhfpacket/msg_mhf_save_plate_box.go similarity index 100% rename from Erupe/network/mhfpacket/msg_mhf_save_plate_box.go rename to network/mhfpacket/msg_mhf_save_plate_box.go diff --git a/Erupe/network/mhfpacket/msg_mhf_save_plate_data.go b/network/mhfpacket/msg_mhf_save_plate_data.go similarity index 100% rename from Erupe/network/mhfpacket/msg_mhf_save_plate_data.go rename to network/mhfpacket/msg_mhf_save_plate_data.go diff --git a/Erupe/network/mhfpacket/msg_mhf_save_plate_myset.go b/network/mhfpacket/msg_mhf_save_plate_myset.go similarity index 100% rename from Erupe/network/mhfpacket/msg_mhf_save_plate_myset.go rename to network/mhfpacket/msg_mhf_save_plate_myset.go diff --git a/Erupe/network/mhfpacket/msg_mhf_save_rengoku_data.go b/network/mhfpacket/msg_mhf_save_rengoku_data.go similarity index 100% rename from Erupe/network/mhfpacket/msg_mhf_save_rengoku_data.go rename to network/mhfpacket/msg_mhf_save_rengoku_data.go diff --git a/Erupe/network/mhfpacket/msg_mhf_save_scenario_data.go b/network/mhfpacket/msg_mhf_save_scenario_data.go similarity index 100% rename from Erupe/network/mhfpacket/msg_mhf_save_scenario_data.go rename to network/mhfpacket/msg_mhf_save_scenario_data.go diff --git a/Erupe/network/mhfpacket/msg_mhf_savedata.go b/network/mhfpacket/msg_mhf_savedata.go similarity index 100% rename from Erupe/network/mhfpacket/msg_mhf_savedata.go rename to network/mhfpacket/msg_mhf_savedata.go diff --git a/Erupe/network/mhfpacket/msg_mhf_send_mail.go b/network/mhfpacket/msg_mhf_send_mail.go similarity index 52% rename from Erupe/network/mhfpacket/msg_mhf_send_mail.go rename to network/mhfpacket/msg_mhf_send_mail.go index f6f7c9460..e0f34ba54 100644 --- a/Erupe/network/mhfpacket/msg_mhf_send_mail.go +++ b/network/mhfpacket/msg_mhf_send_mail.go @@ -1,23 +1,24 @@ package mhfpacket import ( - "errors" + "errors" + "erupe-ce/common/stringsupport" - "erupe-ce/network/clientctx" - "erupe-ce/network" "erupe-ce/common/byteframe" + "erupe-ce/network" + "erupe-ce/network/clientctx" ) // MsgMhfSendMail represents the MSG_MHF_SEND_MAIL type MsgMhfSendMail struct { - AckHandle uint32 - RecipientID uint32 - SubjectLength uint16 - BodyLength uint16 - Quantity uint32 - ItemID uint16 - Subject []byte - Body []byte + AckHandle uint32 + RecipientID uint32 + SubjectLength uint16 + BodyLength uint16 + Quantity uint32 + ItemID uint16 + Subject string + Body string } // Opcode returns the ID associated with this packet type. @@ -27,15 +28,15 @@ func (m *MsgMhfSendMail) Opcode() network.PacketID { // Parse parses the packet from binary func (m *MsgMhfSendMail) Parse(bf *byteframe.ByteFrame, ctx *clientctx.ClientContext) error { - m.AckHandle = bf.ReadUint32() - m.RecipientID = bf.ReadUint32() - m.SubjectLength = bf.ReadUint16() - m.BodyLength = bf.ReadUint16() - m.Quantity = bf.ReadUint32() - m.ItemID = bf.ReadUint16() - m.Subject = bf.ReadNullTerminatedBytes() - m.Body = bf.ReadNullTerminatedBytes() - return nil + m.AckHandle = bf.ReadUint32() + m.RecipientID = bf.ReadUint32() + m.SubjectLength = bf.ReadUint16() + m.BodyLength = bf.ReadUint16() + m.Quantity = bf.ReadUint32() + m.ItemID = bf.ReadUint16() + m.Subject = stringsupport.SJISToUTF8(bf.ReadNullTerminatedBytes()) + m.Body = stringsupport.SJISToUTF8(bf.ReadNullTerminatedBytes()) + return nil } // Build builds a binary packet from the current data. diff --git a/Erupe/network/mhfpacket/msg_mhf_server_command.go b/network/mhfpacket/msg_mhf_server_command.go similarity index 100% rename from Erupe/network/mhfpacket/msg_mhf_server_command.go rename to network/mhfpacket/msg_mhf_server_command.go diff --git a/Erupe/network/mhfpacket/msg_mhf_set_ca_achievement.go b/network/mhfpacket/msg_mhf_set_ca_achievement.go similarity index 100% rename from Erupe/network/mhfpacket/msg_mhf_set_ca_achievement.go rename to network/mhfpacket/msg_mhf_set_ca_achievement.go diff --git a/Erupe/network/mhfpacket/msg_mhf_set_ca_achievement_hist.go b/network/mhfpacket/msg_mhf_set_ca_achievement_hist.go similarity index 100% rename from Erupe/network/mhfpacket/msg_mhf_set_ca_achievement_hist.go rename to network/mhfpacket/msg_mhf_set_ca_achievement_hist.go diff --git a/Erupe/network/mhfpacket/msg_mhf_set_daily_mission_personal.go b/network/mhfpacket/msg_mhf_set_daily_mission_personal.go similarity index 100% rename from Erupe/network/mhfpacket/msg_mhf_set_daily_mission_personal.go rename to network/mhfpacket/msg_mhf_set_daily_mission_personal.go diff --git a/Erupe/network/mhfpacket/msg_mhf_set_enhanced_minidata.go b/network/mhfpacket/msg_mhf_set_enhanced_minidata.go similarity index 100% rename from Erupe/network/mhfpacket/msg_mhf_set_enhanced_minidata.go rename to network/mhfpacket/msg_mhf_set_enhanced_minidata.go diff --git a/Erupe/network/mhfpacket/msg_mhf_set_guild_manage_right.go b/network/mhfpacket/msg_mhf_set_guild_manage_right.go similarity index 70% rename from Erupe/network/mhfpacket/msg_mhf_set_guild_manage_right.go rename to network/mhfpacket/msg_mhf_set_guild_manage_right.go index 5f9b98a2e..3feed2654 100644 --- a/Erupe/network/mhfpacket/msg_mhf_set_guild_manage_right.go +++ b/network/mhfpacket/msg_mhf_set_guild_manage_right.go @@ -1,15 +1,20 @@ package mhfpacket -import ( - "errors" +import ( + "errors" - "erupe-ce/network/clientctx" - "erupe-ce/network" "erupe-ce/common/byteframe" + "erupe-ce/network" + "erupe-ce/network/clientctx" ) // MsgMhfSetGuildManageRight represents the MSG_MHF_SET_GUILD_MANAGE_RIGHT -type MsgMhfSetGuildManageRight struct{} +type MsgMhfSetGuildManageRight struct { + AckHandle uint32 + CharID uint32 + Allowed bool + Unk []byte +} // Opcode returns the ID associated with this packet type. func (m *MsgMhfSetGuildManageRight) Opcode() network.PacketID { @@ -18,7 +23,11 @@ func (m *MsgMhfSetGuildManageRight) Opcode() network.PacketID { // Parse parses the packet from binary func (m *MsgMhfSetGuildManageRight) Parse(bf *byteframe.ByteFrame, ctx *clientctx.ClientContext) error { - return errors.New("NOT IMPLEMENTED") + m.AckHandle = bf.ReadUint32() + m.CharID = bf.ReadUint32() + m.Allowed = bf.ReadBool() + m.Unk = bf.ReadBytes(3) + return nil } // Build builds a binary packet from the current data. diff --git a/Erupe/network/mhfpacket/msg_mhf_set_guild_mission_target.go b/network/mhfpacket/msg_mhf_set_guild_mission_target.go similarity index 100% rename from Erupe/network/mhfpacket/msg_mhf_set_guild_mission_target.go rename to network/mhfpacket/msg_mhf_set_guild_mission_target.go diff --git a/Erupe/network/mhfpacket/msg_mhf_set_kiju.go b/network/mhfpacket/msg_mhf_set_kiju.go similarity index 100% rename from Erupe/network/mhfpacket/msg_mhf_set_kiju.go rename to network/mhfpacket/msg_mhf_set_kiju.go diff --git a/Erupe/network/mhfpacket/msg_mhf_set_loginwindow.go b/network/mhfpacket/msg_mhf_set_loginwindow.go similarity index 100% rename from Erupe/network/mhfpacket/msg_mhf_set_loginwindow.go rename to network/mhfpacket/msg_mhf_set_loginwindow.go diff --git a/Erupe/network/mhfpacket/msg_mhf_set_reject_guild_scout.go b/network/mhfpacket/msg_mhf_set_reject_guild_scout.go similarity index 100% rename from Erupe/network/mhfpacket/msg_mhf_set_reject_guild_scout.go rename to network/mhfpacket/msg_mhf_set_reject_guild_scout.go diff --git a/Erupe/network/mhfpacket/msg_mhf_set_restriction_event.go b/network/mhfpacket/msg_mhf_set_restriction_event.go similarity index 100% rename from Erupe/network/mhfpacket/msg_mhf_set_restriction_event.go rename to network/mhfpacket/msg_mhf_set_restriction_event.go diff --git a/Erupe/network/mhfpacket/msg_mhf_set_ud_tactics_follower.go b/network/mhfpacket/msg_mhf_set_ud_tactics_follower.go similarity index 100% rename from Erupe/network/mhfpacket/msg_mhf_set_ud_tactics_follower.go rename to network/mhfpacket/msg_mhf_set_ud_tactics_follower.go diff --git a/Erupe/network/mhfpacket/msg_mhf_sex_changer.go b/network/mhfpacket/msg_mhf_sex_changer.go similarity index 100% rename from Erupe/network/mhfpacket/msg_mhf_sex_changer.go rename to network/mhfpacket/msg_mhf_sex_changer.go diff --git a/Erupe/network/mhfpacket/msg_mhf_shut_client.go b/network/mhfpacket/msg_mhf_shut_client.go similarity index 100% rename from Erupe/network/mhfpacket/msg_mhf_shut_client.go rename to network/mhfpacket/msg_mhf_shut_client.go diff --git a/Erupe/network/mhfpacket/msg_mhf_stampcard_prize.go b/network/mhfpacket/msg_mhf_stampcard_prize.go similarity index 100% rename from Erupe/network/mhfpacket/msg_mhf_stampcard_prize.go rename to network/mhfpacket/msg_mhf_stampcard_prize.go diff --git a/Erupe/network/mhfpacket/msg_mhf_stampcard_stamp.go b/network/mhfpacket/msg_mhf_stampcard_stamp.go similarity index 100% rename from Erupe/network/mhfpacket/msg_mhf_stampcard_stamp.go rename to network/mhfpacket/msg_mhf_stampcard_stamp.go diff --git a/Erupe/network/mhfpacket/msg_mhf_start_boost_time.go b/network/mhfpacket/msg_mhf_start_boost_time.go similarity index 100% rename from Erupe/network/mhfpacket/msg_mhf_start_boost_time.go rename to network/mhfpacket/msg_mhf_start_boost_time.go diff --git a/Erupe/network/mhfpacket/msg_mhf_state_campaign.go b/network/mhfpacket/msg_mhf_state_campaign.go similarity index 100% rename from Erupe/network/mhfpacket/msg_mhf_state_campaign.go rename to network/mhfpacket/msg_mhf_state_campaign.go diff --git a/Erupe/network/mhfpacket/msg_mhf_state_festa_g.go b/network/mhfpacket/msg_mhf_state_festa_g.go similarity index 100% rename from Erupe/network/mhfpacket/msg_mhf_state_festa_g.go rename to network/mhfpacket/msg_mhf_state_festa_g.go diff --git a/Erupe/network/mhfpacket/msg_mhf_state_festa_u.go b/network/mhfpacket/msg_mhf_state_festa_u.go similarity index 100% rename from Erupe/network/mhfpacket/msg_mhf_state_festa_u.go rename to network/mhfpacket/msg_mhf_state_festa_u.go diff --git a/Erupe/network/mhfpacket/msg_mhf_transfer_item.go b/network/mhfpacket/msg_mhf_transfer_item.go similarity index 100% rename from Erupe/network/mhfpacket/msg_mhf_transfer_item.go rename to network/mhfpacket/msg_mhf_transfer_item.go diff --git a/Erupe/network/mhfpacket/msg_mhf_transit_message.go b/network/mhfpacket/msg_mhf_transit_message.go similarity index 68% rename from Erupe/network/mhfpacket/msg_mhf_transit_message.go rename to network/mhfpacket/msg_mhf_transit_message.go index 32dba46d6..1d15c6d42 100644 --- a/Erupe/network/mhfpacket/msg_mhf_transit_message.go +++ b/network/mhfpacket/msg_mhf_transit_message.go @@ -1,20 +1,20 @@ package mhfpacket import ( - "errors" + "errors" - "erupe-ce/network/clientctx" - "erupe-ce/network" "erupe-ce/common/byteframe" + "erupe-ce/network" + "erupe-ce/network/clientctx" ) // MsgMhfTransitMessage represents the MSG_MHF_TRANSIT_MESSAGE type MsgMhfTransitMessage struct { - AckHandle uint32 - Unk0 uint8 - Unk1 uint8 - Unk2 uint16 - MessageData []byte + AckHandle uint32 + Unk0 uint8 + Unk1 uint8 + SearchType uint16 + MessageData []byte } // Opcode returns the ID associated with this packet type. @@ -24,12 +24,12 @@ func (m *MsgMhfTransitMessage) Opcode() network.PacketID { // Parse parses the packet from binary func (m *MsgMhfTransitMessage) Parse(bf *byteframe.ByteFrame, ctx *clientctx.ClientContext) error { - m.AckHandle = bf.ReadUint32() - m.Unk0 = bf.ReadUint8() - m.Unk1 = bf.ReadUint8() - m.Unk2 = bf.ReadUint16() - m.MessageData = bf.ReadBytes(uint(bf.ReadUint16())) - return nil + m.AckHandle = bf.ReadUint32() + m.Unk0 = bf.ReadUint8() + m.Unk1 = bf.ReadUint8() + m.SearchType = bf.ReadUint16() + m.MessageData = bf.ReadBytes(uint(bf.ReadUint16())) + return nil } // Build builds a binary packet from the current data. diff --git a/Erupe/network/mhfpacket/msg_mhf_unreserve_srg.go b/network/mhfpacket/msg_mhf_unreserve_srg.go similarity index 100% rename from Erupe/network/mhfpacket/msg_mhf_unreserve_srg.go rename to network/mhfpacket/msg_mhf_unreserve_srg.go diff --git a/Erupe/network/mhfpacket/msg_mhf_update_beat_level.go b/network/mhfpacket/msg_mhf_update_beat_level.go similarity index 100% rename from Erupe/network/mhfpacket/msg_mhf_update_beat_level.go rename to network/mhfpacket/msg_mhf_update_beat_level.go diff --git a/Erupe/network/mhfpacket/msg_mhf_update_cafepoint.go b/network/mhfpacket/msg_mhf_update_cafepoint.go similarity index 100% rename from Erupe/network/mhfpacket/msg_mhf_update_cafepoint.go rename to network/mhfpacket/msg_mhf_update_cafepoint.go diff --git a/Erupe/network/mhfpacket/msg_mhf_update_equip_skin_hist.go b/network/mhfpacket/msg_mhf_update_equip_skin_hist.go similarity index 100% rename from Erupe/network/mhfpacket/msg_mhf_update_equip_skin_hist.go rename to network/mhfpacket/msg_mhf_update_equip_skin_hist.go diff --git a/Erupe/network/mhfpacket/msg_mhf_update_etc_point.go b/network/mhfpacket/msg_mhf_update_etc_point.go similarity index 100% rename from Erupe/network/mhfpacket/msg_mhf_update_etc_point.go rename to network/mhfpacket/msg_mhf_update_etc_point.go diff --git a/Erupe/network/mhfpacket/msg_mhf_update_force_guild_rank.go b/network/mhfpacket/msg_mhf_update_force_guild_rank.go similarity index 100% rename from Erupe/network/mhfpacket/msg_mhf_update_force_guild_rank.go rename to network/mhfpacket/msg_mhf_update_force_guild_rank.go diff --git a/Erupe/network/mhfpacket/msg_mhf_update_guacot.go b/network/mhfpacket/msg_mhf_update_guacot.go similarity index 100% rename from Erupe/network/mhfpacket/msg_mhf_update_guacot.go rename to network/mhfpacket/msg_mhf_update_guacot.go diff --git a/Erupe/network/mhfpacket/msg_mhf_update_guild.go b/network/mhfpacket/msg_mhf_update_guild.go similarity index 100% rename from Erupe/network/mhfpacket/msg_mhf_update_guild.go rename to network/mhfpacket/msg_mhf_update_guild.go diff --git a/Erupe/network/mhfpacket/msg_mhf_update_guild_icon.go b/network/mhfpacket/msg_mhf_update_guild_icon.go similarity index 92% rename from Erupe/network/mhfpacket/msg_mhf_update_guild_icon.go rename to network/mhfpacket/msg_mhf_update_guild_icon.go index a6d8f9bd9..6e3a780e5 100644 --- a/Erupe/network/mhfpacket/msg_mhf_update_guild_icon.go +++ b/network/mhfpacket/msg_mhf_update_guild_icon.go @@ -1,11 +1,11 @@ package mhfpacket import ( - "errors" + "errors" - "erupe-ce/network/clientctx" - "erupe-ce/network" "erupe-ce/common/byteframe" + "erupe-ce/network" + "erupe-ce/network/clientctx" ) type GuildIconMsgPart struct { @@ -16,7 +16,7 @@ type GuildIconMsgPart struct { Rotation uint8 Red uint8 Green uint8 - Blue uint8 + Blue uint8 PosX uint16 PosY uint16 } @@ -52,8 +52,8 @@ func (m *MsgMhfUpdateGuildIcon) Parse(bf *byteframe.ByteFrame, ctx *clientctx.Cl Size: bf.ReadUint8(), Rotation: bf.ReadUint8(), Red: bf.ReadUint8(), - Green: bf.ReadUint8(), - Blue: bf.ReadUint8(), + Green: bf.ReadUint8(), + Blue: bf.ReadUint8(), PosX: bf.ReadUint16(), PosY: bf.ReadUint16(), } diff --git a/Erupe/network/mhfpacket/msg_mhf_update_guild_item.go b/network/mhfpacket/msg_mhf_update_guild_item.go similarity index 51% rename from Erupe/network/mhfpacket/msg_mhf_update_guild_item.go rename to network/mhfpacket/msg_mhf_update_guild_item.go index ffe67363a..3eb37a8cb 100644 --- a/Erupe/network/mhfpacket/msg_mhf_update_guild_item.go +++ b/network/mhfpacket/msg_mhf_update_guild_item.go @@ -1,27 +1,27 @@ package mhfpacket import ( - "errors" + "errors" - "erupe-ce/network/clientctx" - "erupe-ce/network" "erupe-ce/common/byteframe" + "erupe-ce/network" + "erupe-ce/network/clientctx" ) -type Item struct{ - Unk0 uint32 - ItemId uint16 - Amount uint16 - Unk1 uint32 +type Item struct { + Unk0 uint32 + ItemId uint16 + Amount uint16 + Unk1 uint32 } // MsgMhfUpdateGuildItem represents the MSG_MHF_UPDATE_GUILD_ITEM -type MsgMhfUpdateGuildItem struct{ - AckHandle uint32 - GuildId uint32 - Amount uint16 - Unk1 uint16 // 0x00 0x00 - Items []Item // Array of updated item IDs +type MsgMhfUpdateGuildItem struct { + AckHandle uint32 + GuildId uint32 + Amount uint16 + Unk1 uint16 // 0x00 0x00 + Items []Item // Array of updated item IDs } // Opcode returns the ID associated with this packet type. @@ -31,18 +31,18 @@ func (m *MsgMhfUpdateGuildItem) Opcode() network.PacketID { // Parse parses the packet from binary func (m *MsgMhfUpdateGuildItem) Parse(bf *byteframe.ByteFrame, ctx *clientctx.ClientContext) error { - m.AckHandle = bf.ReadUint32() - m.GuildId = bf.ReadUint32() - m.Amount = bf.ReadUint16() - m.Unk1 = bf.ReadUint16() - m.Items = make([]Item, int(m.Amount)) + m.AckHandle = bf.ReadUint32() + m.GuildId = bf.ReadUint32() + m.Amount = bf.ReadUint16() + m.Unk1 = bf.ReadUint16() + m.Items = make([]Item, int(m.Amount)) - for i := 0; i < int(m.Amount); i++ { - m.Items[i].Unk0 = bf.ReadUint32() - m.Items[i].ItemId = bf.ReadUint16() - m.Items[i].Amount = bf.ReadUint16() - m.Items[i].Unk1 = bf.ReadUint32() - } + for i := 0; i < int(m.Amount); i++ { + m.Items[i].Unk0 = bf.ReadUint32() + m.Items[i].ItemId = bf.ReadUint16() + m.Items[i].Amount = bf.ReadUint16() + m.Items[i].Unk1 = bf.ReadUint32() + } return nil } diff --git a/Erupe/network/mhfpacket/msg_mhf_update_guild_message_board.go b/network/mhfpacket/msg_mhf_update_guild_message_board.go similarity index 75% rename from Erupe/network/mhfpacket/msg_mhf_update_guild_message_board.go rename to network/mhfpacket/msg_mhf_update_guild_message_board.go index 8a634b4fc..b8c4ee5e0 100644 --- a/Erupe/network/mhfpacket/msg_mhf_update_guild_message_board.go +++ b/network/mhfpacket/msg_mhf_update_guild_message_board.go @@ -1,18 +1,18 @@ package mhfpacket import ( - "errors" + "errors" - "erupe-ce/network/clientctx" - "erupe-ce/network" "erupe-ce/common/byteframe" + "erupe-ce/network" + "erupe-ce/network/clientctx" ) // MsgMhfUpdateGuildMessageBoard represents the MSG_MHF_UPDATE_GUILD_MESSAGE_BOARD type MsgMhfUpdateGuildMessageBoard struct { AckHandle uint32 - MessageOp uint32 - Request []byte + MessageOp uint32 + Request []byte } // Opcode returns the ID associated with this packet type. @@ -22,12 +22,12 @@ func (m *MsgMhfUpdateGuildMessageBoard) Opcode() network.PacketID { // Parse parses the packet from binary func (m *MsgMhfUpdateGuildMessageBoard) Parse(bf *byteframe.ByteFrame, ctx *clientctx.ClientContext) error { - m.AckHandle = bf.ReadUint32() - m.MessageOp = bf.ReadUint32() - if m.MessageOp != 5 { - m.Request = bf.DataFromCurrent() - bf.Seek(int64(len(bf.Data()) - 2), 0) - } + m.AckHandle = bf.ReadUint32() + m.MessageOp = bf.ReadUint32() + if m.MessageOp != 5 { + m.Request = bf.DataFromCurrent() + bf.Seek(int64(len(bf.Data())-2), 0) + } return nil } diff --git a/Erupe/network/mhfpacket/msg_mhf_update_guildcard.go b/network/mhfpacket/msg_mhf_update_guildcard.go similarity index 100% rename from Erupe/network/mhfpacket/msg_mhf_update_guildcard.go rename to network/mhfpacket/msg_mhf_update_guildcard.go diff --git a/Erupe/network/mhfpacket/msg_mhf_update_house.go b/network/mhfpacket/msg_mhf_update_house.go similarity index 100% rename from Erupe/network/mhfpacket/msg_mhf_update_house.go rename to network/mhfpacket/msg_mhf_update_house.go diff --git a/Erupe/network/mhfpacket/msg_mhf_update_interior.go b/network/mhfpacket/msg_mhf_update_interior.go similarity index 80% rename from Erupe/network/mhfpacket/msg_mhf_update_interior.go rename to network/mhfpacket/msg_mhf_update_interior.go index d22bb48ce..21e32d299 100644 --- a/Erupe/network/mhfpacket/msg_mhf_update_interior.go +++ b/network/mhfpacket/msg_mhf_update_interior.go @@ -1,17 +1,17 @@ package mhfpacket import ( - "errors" + "errors" - "erupe-ce/network/clientctx" - "erupe-ce/network" "erupe-ce/common/byteframe" + "erupe-ce/network" + "erupe-ce/network/clientctx" ) // MsgMhfUpdateInterior represents the MSG_MHF_UPDATE_INTERIOR type MsgMhfUpdateInterior struct { - AckHandle uint32 - InteriorData []byte + AckHandle uint32 + InteriorData []byte } // Opcode returns the ID associated with this packet type. @@ -21,9 +21,9 @@ func (m *MsgMhfUpdateInterior) Opcode() network.PacketID { // Parse parses the packet from binary func (m *MsgMhfUpdateInterior) Parse(bf *byteframe.ByteFrame, ctx *clientctx.ClientContext) error { - m.AckHandle = bf.ReadUint32() - m.InteriorData = bf.ReadBytes(20) - return nil + m.AckHandle = bf.ReadUint32() + m.InteriorData = bf.ReadBytes(20) + return nil } // Build builds a binary packet from the current data. diff --git a/Erupe/network/mhfpacket/msg_mhf_update_myhouse_info.go b/network/mhfpacket/msg_mhf_update_myhouse_info.go similarity index 100% rename from Erupe/network/mhfpacket/msg_mhf_update_myhouse_info.go rename to network/mhfpacket/msg_mhf_update_myhouse_info.go diff --git a/Erupe/network/mhfpacket/msg_mhf_update_union_item.go b/network/mhfpacket/msg_mhf_update_union_item.go similarity index 100% rename from Erupe/network/mhfpacket/msg_mhf_update_union_item.go rename to network/mhfpacket/msg_mhf_update_union_item.go diff --git a/Erupe/network/mhfpacket/msg_mhf_update_use_trend_weapon_log.go b/network/mhfpacket/msg_mhf_update_use_trend_weapon_log.go similarity index 100% rename from Erupe/network/mhfpacket/msg_mhf_update_use_trend_weapon_log.go rename to network/mhfpacket/msg_mhf_update_use_trend_weapon_log.go diff --git a/Erupe/network/mhfpacket/msg_mhf_update_warehouse.go b/network/mhfpacket/msg_mhf_update_warehouse.go similarity index 100% rename from Erupe/network/mhfpacket/msg_mhf_update_warehouse.go rename to network/mhfpacket/msg_mhf_update_warehouse.go diff --git a/Erupe/network/mhfpacket/msg_mhf_use_gacha_point.go b/network/mhfpacket/msg_mhf_use_gacha_point.go similarity index 100% rename from Erupe/network/mhfpacket/msg_mhf_use_gacha_point.go rename to network/mhfpacket/msg_mhf_use_gacha_point.go diff --git a/Erupe/network/mhfpacket/msg_mhf_use_keep_login_boost.go b/network/mhfpacket/msg_mhf_use_keep_login_boost.go similarity index 100% rename from Erupe/network/mhfpacket/msg_mhf_use_keep_login_boost.go rename to network/mhfpacket/msg_mhf_use_keep_login_boost.go diff --git a/Erupe/network/mhfpacket/msg_mhf_use_reward_song.go b/network/mhfpacket/msg_mhf_use_reward_song.go similarity index 100% rename from Erupe/network/mhfpacket/msg_mhf_use_reward_song.go rename to network/mhfpacket/msg_mhf_use_reward_song.go diff --git a/Erupe/network/mhfpacket/msg_mhf_use_ud_shop_coin.go b/network/mhfpacket/msg_mhf_use_ud_shop_coin.go similarity index 100% rename from Erupe/network/mhfpacket/msg_mhf_use_ud_shop_coin.go rename to network/mhfpacket/msg_mhf_use_ud_shop_coin.go diff --git a/Erupe/network/mhfpacket/msg_mhf_vote_festa.go b/network/mhfpacket/msg_mhf_vote_festa.go similarity index 73% rename from Erupe/network/mhfpacket/msg_mhf_vote_festa.go rename to network/mhfpacket/msg_mhf_vote_festa.go index 2bbe75b82..b3c05d5fd 100644 --- a/Erupe/network/mhfpacket/msg_mhf_vote_festa.go +++ b/network/mhfpacket/msg_mhf_vote_festa.go @@ -1,19 +1,19 @@ package mhfpacket import ( - "errors" + "errors" - "erupe-ce/network/clientctx" - "erupe-ce/network" "erupe-ce/common/byteframe" + "erupe-ce/network" + "erupe-ce/network/clientctx" ) // MsgMhfVoteFesta represents the MSG_MHF_VOTE_FESTA type MsgMhfVoteFesta struct { - AckHandle uint32 - Unk uint32 - GuildID uint32 - TrialID uint32 + AckHandle uint32 + Unk uint32 + GuildID uint32 + TrialID uint32 } // Opcode returns the ID associated with this packet type. @@ -23,11 +23,11 @@ func (m *MsgMhfVoteFesta) Opcode() network.PacketID { // Parse parses the packet from binary func (m *MsgMhfVoteFesta) Parse(bf *byteframe.ByteFrame, ctx *clientctx.ClientContext) error { - m.AckHandle = bf.ReadUint32() - m.Unk = bf.ReadUint32() - m.GuildID = bf.ReadUint32() - m.TrialID = bf.ReadUint32() - return nil + m.AckHandle = bf.ReadUint32() + m.Unk = bf.ReadUint32() + m.GuildID = bf.ReadUint32() + m.TrialID = bf.ReadUint32() + return nil } // Build builds a binary packet from the current data. diff --git a/Erupe/network/mhfpacket/msg_sys_ack.go b/network/mhfpacket/msg_sys_ack.go similarity index 100% rename from Erupe/network/mhfpacket/msg_sys_ack.go rename to network/mhfpacket/msg_sys_ack.go diff --git a/Erupe/network/mhfpacket/msg_sys_acquire_semaphore.go b/network/mhfpacket/msg_sys_acquire_semaphore.go similarity index 67% rename from Erupe/network/mhfpacket/msg_sys_acquire_semaphore.go rename to network/mhfpacket/msg_sys_acquire_semaphore.go index 89b974ff4..2be7284d9 100644 --- a/Erupe/network/mhfpacket/msg_sys_acquire_semaphore.go +++ b/network/mhfpacket/msg_sys_acquire_semaphore.go @@ -1,15 +1,19 @@ package mhfpacket -import ( - "errors" +import ( + "errors" + "erupe-ce/common/bfutil" - "erupe-ce/network/clientctx" - "erupe-ce/network" "erupe-ce/common/byteframe" + "erupe-ce/network" + "erupe-ce/network/clientctx" ) // MsgSysAcquireSemaphore represents the MSG_SYS_ACQUIRE_SEMAPHORE -type MsgSysAcquireSemaphore struct{} +type MsgSysAcquireSemaphore struct { + AckHandle uint32 + SemaphoreID string +} // Opcode returns the ID associated with this packet type. func (m *MsgSysAcquireSemaphore) Opcode() network.PacketID { @@ -18,7 +22,10 @@ func (m *MsgSysAcquireSemaphore) Opcode() network.PacketID { // Parse parses the packet from binary func (m *MsgSysAcquireSemaphore) Parse(bf *byteframe.ByteFrame, ctx *clientctx.ClientContext) error { - return errors.New("NOT IMPLEMENTED") + m.AckHandle = bf.ReadUint32() + SemaphoreIDLength := bf.ReadUint8() + m.SemaphoreID = string(bfutil.UpToNull(bf.ReadBytes(uint(SemaphoreIDLength)))) + return nil } // Build builds a binary packet from the current data. diff --git a/Erupe/network/mhfpacket/msg_sys_add_object.go b/network/mhfpacket/msg_sys_add_object.go similarity index 100% rename from Erupe/network/mhfpacket/msg_sys_add_object.go rename to network/mhfpacket/msg_sys_add_object.go diff --git a/Erupe/network/mhfpacket/msg_sys_auth_data.go b/network/mhfpacket/msg_sys_auth_data.go similarity index 100% rename from Erupe/network/mhfpacket/msg_sys_auth_data.go rename to network/mhfpacket/msg_sys_auth_data.go diff --git a/Erupe/network/mhfpacket/msg_sys_auth_query.go b/network/mhfpacket/msg_sys_auth_query.go similarity index 100% rename from Erupe/network/mhfpacket/msg_sys_auth_query.go rename to network/mhfpacket/msg_sys_auth_query.go diff --git a/Erupe/network/mhfpacket/msg_sys_auth_terminal.go b/network/mhfpacket/msg_sys_auth_terminal.go similarity index 100% rename from Erupe/network/mhfpacket/msg_sys_auth_terminal.go rename to network/mhfpacket/msg_sys_auth_terminal.go diff --git a/Erupe/network/mhfpacket/msg_sys_back_stage.go b/network/mhfpacket/msg_sys_back_stage.go similarity index 100% rename from Erupe/network/mhfpacket/msg_sys_back_stage.go rename to network/mhfpacket/msg_sys_back_stage.go diff --git a/Erupe/network/mhfpacket/msg_sys_cast_binary.go b/network/mhfpacket/msg_sys_cast_binary.go similarity index 100% rename from Erupe/network/mhfpacket/msg_sys_cast_binary.go rename to network/mhfpacket/msg_sys_cast_binary.go diff --git a/Erupe/network/mhfpacket/msg_sys_casted_binary.go b/network/mhfpacket/msg_sys_casted_binary.go similarity index 100% rename from Erupe/network/mhfpacket/msg_sys_casted_binary.go rename to network/mhfpacket/msg_sys_casted_binary.go diff --git a/Erupe/network/mhfpacket/msg_sys_check_semaphore.go b/network/mhfpacket/msg_sys_check_semaphore.go similarity index 74% rename from Erupe/network/mhfpacket/msg_sys_check_semaphore.go rename to network/mhfpacket/msg_sys_check_semaphore.go index 2dec71930..bea438759 100644 --- a/Erupe/network/mhfpacket/msg_sys_check_semaphore.go +++ b/network/mhfpacket/msg_sys_check_semaphore.go @@ -1,18 +1,18 @@ package mhfpacket -import ( - "errors" - - "erupe-ce/network/clientctx" +import ( + "errors" "erupe-ce/common/bfutil" - "erupe-ce/network" + "erupe-ce/common/byteframe" + "erupe-ce/network" + "erupe-ce/network/clientctx" ) // MsgSysCheckSemaphore represents the MSG_SYS_CHECK_SEMAPHORE -type MsgSysCheckSemaphore struct{ - AckHandle uint32 - StageID string +type MsgSysCheckSemaphore struct { + AckHandle uint32 + SemaphoreID string } // Opcode returns the ID associated with this packet type. @@ -23,12 +23,12 @@ func (m *MsgSysCheckSemaphore) Opcode() network.PacketID { // Parse parses the packet from binary func (m *MsgSysCheckSemaphore) Parse(bf *byteframe.ByteFrame, ctx *clientctx.ClientContext) error { m.AckHandle = bf.ReadUint32() - stageIDLength := bf.ReadUint8() - m.StageID = string(bfutil.UpToNull(bf.ReadBytes(uint(stageIDLength)))) + semaphoreIDLength := bf.ReadUint8() + m.SemaphoreID = string(bfutil.UpToNull(bf.ReadBytes(uint(semaphoreIDLength)))) return nil } // Build builds a binary packet from the current data. func (m *MsgSysCheckSemaphore) Build(bf *byteframe.ByteFrame, ctx *clientctx.ClientContext) error { return errors.New("NOT IMPLEMENTED") -} \ No newline at end of file +} diff --git a/Erupe/network/mhfpacket/msg_sys_cleanup_object.go b/network/mhfpacket/msg_sys_cleanup_object.go similarity index 100% rename from Erupe/network/mhfpacket/msg_sys_cleanup_object.go rename to network/mhfpacket/msg_sys_cleanup_object.go diff --git a/Erupe/network/mhfpacket/msg_sys_close_mutex.go b/network/mhfpacket/msg_sys_close_mutex.go similarity index 100% rename from Erupe/network/mhfpacket/msg_sys_close_mutex.go rename to network/mhfpacket/msg_sys_close_mutex.go diff --git a/Erupe/network/mhfpacket/msg_sys_collect_binary.go b/network/mhfpacket/msg_sys_collect_binary.go similarity index 100% rename from Erupe/network/mhfpacket/msg_sys_collect_binary.go rename to network/mhfpacket/msg_sys_collect_binary.go diff --git a/Erupe/network/mhfpacket/msg_sys_create_acquire_semaphore.go b/network/mhfpacket/msg_sys_create_acquire_semaphore.go similarity index 100% rename from Erupe/network/mhfpacket/msg_sys_create_acquire_semaphore.go rename to network/mhfpacket/msg_sys_create_acquire_semaphore.go diff --git a/Erupe/network/mhfpacket/msg_sys_create_mutex.go b/network/mhfpacket/msg_sys_create_mutex.go similarity index 100% rename from Erupe/network/mhfpacket/msg_sys_create_mutex.go rename to network/mhfpacket/msg_sys_create_mutex.go diff --git a/Erupe/network/mhfpacket/msg_sys_create_object.go b/network/mhfpacket/msg_sys_create_object.go similarity index 100% rename from Erupe/network/mhfpacket/msg_sys_create_object.go rename to network/mhfpacket/msg_sys_create_object.go diff --git a/Erupe/network/mhfpacket/msg_sys_create_open_mutex.go b/network/mhfpacket/msg_sys_create_open_mutex.go similarity index 100% rename from Erupe/network/mhfpacket/msg_sys_create_open_mutex.go rename to network/mhfpacket/msg_sys_create_open_mutex.go diff --git a/Erupe/network/mhfpacket/msg_sys_create_semaphore.go b/network/mhfpacket/msg_sys_create_semaphore.go similarity index 100% rename from Erupe/network/mhfpacket/msg_sys_create_semaphore.go rename to network/mhfpacket/msg_sys_create_semaphore.go diff --git a/Erupe/network/mhfpacket/msg_sys_create_stage.go b/network/mhfpacket/msg_sys_create_stage.go similarity index 100% rename from Erupe/network/mhfpacket/msg_sys_create_stage.go rename to network/mhfpacket/msg_sys_create_stage.go diff --git a/Erupe/network/mhfpacket/msg_sys_del_object.go b/network/mhfpacket/msg_sys_del_object.go similarity index 100% rename from Erupe/network/mhfpacket/msg_sys_del_object.go rename to network/mhfpacket/msg_sys_del_object.go diff --git a/Erupe/network/mhfpacket/msg_sys_delete_mutex.go b/network/mhfpacket/msg_sys_delete_mutex.go similarity index 100% rename from Erupe/network/mhfpacket/msg_sys_delete_mutex.go rename to network/mhfpacket/msg_sys_delete_mutex.go diff --git a/Erupe/network/mhfpacket/msg_sys_delete_object.go b/network/mhfpacket/msg_sys_delete_object.go similarity index 100% rename from Erupe/network/mhfpacket/msg_sys_delete_object.go rename to network/mhfpacket/msg_sys_delete_object.go diff --git a/Erupe/network/mhfpacket/msg_sys_delete_semaphore.go b/network/mhfpacket/msg_sys_delete_semaphore.go similarity index 100% rename from Erupe/network/mhfpacket/msg_sys_delete_semaphore.go rename to network/mhfpacket/msg_sys_delete_semaphore.go diff --git a/Erupe/network/mhfpacket/msg_sys_delete_user.go b/network/mhfpacket/msg_sys_delete_user.go similarity index 100% rename from Erupe/network/mhfpacket/msg_sys_delete_user.go rename to network/mhfpacket/msg_sys_delete_user.go diff --git a/Erupe/network/mhfpacket/msg_sys_disp_object.go b/network/mhfpacket/msg_sys_disp_object.go similarity index 100% rename from Erupe/network/mhfpacket/msg_sys_disp_object.go rename to network/mhfpacket/msg_sys_disp_object.go diff --git a/Erupe/network/mhfpacket/msg_sys_duplicate_object.go b/network/mhfpacket/msg_sys_duplicate_object.go similarity index 100% rename from Erupe/network/mhfpacket/msg_sys_duplicate_object.go rename to network/mhfpacket/msg_sys_duplicate_object.go diff --git a/Erupe/network/mhfpacket/msg_sys_echo.go b/network/mhfpacket/msg_sys_echo.go similarity index 100% rename from Erupe/network/mhfpacket/msg_sys_echo.go rename to network/mhfpacket/msg_sys_echo.go diff --git a/Erupe/network/mhfpacket/msg_sys_end.go b/network/mhfpacket/msg_sys_end.go similarity index 100% rename from Erupe/network/mhfpacket/msg_sys_end.go rename to network/mhfpacket/msg_sys_end.go diff --git a/Erupe/network/mhfpacket/msg_sys_enter_stage.go b/network/mhfpacket/msg_sys_enter_stage.go similarity index 100% rename from Erupe/network/mhfpacket/msg_sys_enter_stage.go rename to network/mhfpacket/msg_sys_enter_stage.go diff --git a/Erupe/network/mhfpacket/msg_sys_enumerate_client.go b/network/mhfpacket/msg_sys_enumerate_client.go similarity index 96% rename from Erupe/network/mhfpacket/msg_sys_enumerate_client.go rename to network/mhfpacket/msg_sys_enumerate_client.go index af67fa173..5318549a6 100644 --- a/Erupe/network/mhfpacket/msg_sys_enumerate_client.go +++ b/network/mhfpacket/msg_sys_enumerate_client.go @@ -3,8 +3,8 @@ package mhfpacket import ( "errors" - "erupe-ce/common/byteframe" "erupe-ce/common/bfutil" + "erupe-ce/common/byteframe" "erupe-ce/network" "erupe-ce/network/clientctx" ) @@ -13,7 +13,7 @@ import ( type MsgSysEnumerateClient struct { AckHandle uint32 Unk0 uint8 // Hardcoded 1 in the client - Unk1 uint8 + Get uint8 StageID string } @@ -26,7 +26,7 @@ func (m *MsgSysEnumerateClient) Opcode() network.PacketID { func (m *MsgSysEnumerateClient) Parse(bf *byteframe.ByteFrame, ctx *clientctx.ClientContext) error { m.AckHandle = bf.ReadUint32() m.Unk0 = bf.ReadUint8() - m.Unk1 = bf.ReadUint8() + m.Get = bf.ReadUint8() stageIDLength := bf.ReadUint8() m.StageID = string(bfutil.UpToNull(bf.ReadBytes(uint(stageIDLength)))) return nil diff --git a/Erupe/network/mhfpacket/msg_sys_enumerate_stage.go b/network/mhfpacket/msg_sys_enumerate_stage.go similarity index 72% rename from Erupe/network/mhfpacket/msg_sys_enumerate_stage.go rename to network/mhfpacket/msg_sys_enumerate_stage.go index 802b385f5..a3f125941 100644 --- a/Erupe/network/mhfpacket/msg_sys_enumerate_stage.go +++ b/network/mhfpacket/msg_sys_enumerate_stage.go @@ -1,19 +1,19 @@ package mhfpacket -import ( - "errors" +import ( + "errors" + "erupe-ce/common/stringsupport" - "erupe-ce/network/clientctx" - "erupe-ce/network" "erupe-ce/common/byteframe" + "erupe-ce/network" + "erupe-ce/network/clientctx" ) // MsgSysEnumerateStage represents the MSG_SYS_ENUMERATE_STAGE type MsgSysEnumerateStage struct { - AckHandle uint32 - Unk0 uint8 // Hardcoded 1 in the binary - StageIDLength uint8 - StageID string // NULL terminated string. + AckHandle uint32 + Unk0 uint8 // Hardcoded 1 in the binary + StagePrefix string // NULL terminated string. } // Opcode returns the ID associated with this packet type. @@ -25,8 +25,8 @@ func (m *MsgSysEnumerateStage) Opcode() network.PacketID { func (m *MsgSysEnumerateStage) Parse(bf *byteframe.ByteFrame, ctx *clientctx.ClientContext) error { m.AckHandle = bf.ReadUint32() m.Unk0 = bf.ReadUint8() - m.StageIDLength = bf.ReadUint8() - m.StageID = string(bf.ReadBytes(uint(m.StageIDLength))) + bf.ReadUint8() + m.StagePrefix = stringsupport.SJISToUTF8(bf.ReadNullTerminatedBytes()) return nil } diff --git a/Erupe/network/mhfpacket/msg_sys_enumlobby.go b/network/mhfpacket/msg_sys_enumlobby.go similarity index 100% rename from Erupe/network/mhfpacket/msg_sys_enumlobby.go rename to network/mhfpacket/msg_sys_enumlobby.go diff --git a/Erupe/network/mhfpacket/msg_sys_enumuser.go b/network/mhfpacket/msg_sys_enumuser.go similarity index 100% rename from Erupe/network/mhfpacket/msg_sys_enumuser.go rename to network/mhfpacket/msg_sys_enumuser.go diff --git a/Erupe/network/mhfpacket/msg_sys_extend_threshold.go b/network/mhfpacket/msg_sys_extend_threshold.go similarity index 100% rename from Erupe/network/mhfpacket/msg_sys_extend_threshold.go rename to network/mhfpacket/msg_sys_extend_threshold.go diff --git a/Erupe/network/mhfpacket/msg_sys_get_file.go b/network/mhfpacket/msg_sys_get_file.go similarity index 100% rename from Erupe/network/mhfpacket/msg_sys_get_file.go rename to network/mhfpacket/msg_sys_get_file.go diff --git a/Erupe/network/mhfpacket/msg_sys_get_object_binary.go b/network/mhfpacket/msg_sys_get_object_binary.go similarity index 100% rename from Erupe/network/mhfpacket/msg_sys_get_object_binary.go rename to network/mhfpacket/msg_sys_get_object_binary.go diff --git a/Erupe/network/mhfpacket/msg_sys_get_object_owner.go b/network/mhfpacket/msg_sys_get_object_owner.go similarity index 100% rename from Erupe/network/mhfpacket/msg_sys_get_object_owner.go rename to network/mhfpacket/msg_sys_get_object_owner.go diff --git a/Erupe/network/mhfpacket/msg_sys_get_stage_binary.go b/network/mhfpacket/msg_sys_get_stage_binary.go similarity index 100% rename from Erupe/network/mhfpacket/msg_sys_get_stage_binary.go rename to network/mhfpacket/msg_sys_get_stage_binary.go diff --git a/Erupe/network/mhfpacket/msg_sys_get_state.go b/network/mhfpacket/msg_sys_get_state.go similarity index 100% rename from Erupe/network/mhfpacket/msg_sys_get_state.go rename to network/mhfpacket/msg_sys_get_state.go diff --git a/Erupe/network/mhfpacket/msg_sys_get_user_binary.go b/network/mhfpacket/msg_sys_get_user_binary.go similarity index 100% rename from Erupe/network/mhfpacket/msg_sys_get_user_binary.go rename to network/mhfpacket/msg_sys_get_user_binary.go diff --git a/Erupe/network/mhfpacket/msg_sys_hide_client.go b/network/mhfpacket/msg_sys_hide_client.go similarity index 100% rename from Erupe/network/mhfpacket/msg_sys_hide_client.go rename to network/mhfpacket/msg_sys_hide_client.go diff --git a/Erupe/network/mhfpacket/msg_sys_hide_object.go b/network/mhfpacket/msg_sys_hide_object.go similarity index 100% rename from Erupe/network/mhfpacket/msg_sys_hide_object.go rename to network/mhfpacket/msg_sys_hide_object.go diff --git a/Erupe/network/mhfpacket/msg_sys_infokyserver.go b/network/mhfpacket/msg_sys_infokyserver.go similarity index 100% rename from Erupe/network/mhfpacket/msg_sys_infokyserver.go rename to network/mhfpacket/msg_sys_infokyserver.go diff --git a/Erupe/network/mhfpacket/msg_sys_insert_user.go b/network/mhfpacket/msg_sys_insert_user.go similarity index 100% rename from Erupe/network/mhfpacket/msg_sys_insert_user.go rename to network/mhfpacket/msg_sys_insert_user.go diff --git a/Erupe/network/mhfpacket/msg_sys_issue_logkey.go b/network/mhfpacket/msg_sys_issue_logkey.go similarity index 100% rename from Erupe/network/mhfpacket/msg_sys_issue_logkey.go rename to network/mhfpacket/msg_sys_issue_logkey.go diff --git a/Erupe/network/mhfpacket/msg_sys_leave_stage.go b/network/mhfpacket/msg_sys_leave_stage.go similarity index 100% rename from Erupe/network/mhfpacket/msg_sys_leave_stage.go rename to network/mhfpacket/msg_sys_leave_stage.go diff --git a/Erupe/network/mhfpacket/msg_sys_load_register.go b/network/mhfpacket/msg_sys_load_register.go similarity index 100% rename from Erupe/network/mhfpacket/msg_sys_load_register.go rename to network/mhfpacket/msg_sys_load_register.go diff --git a/Erupe/network/mhfpacket/msg_sys_lock_global_sema.go b/network/mhfpacket/msg_sys_lock_global_sema.go similarity index 100% rename from Erupe/network/mhfpacket/msg_sys_lock_global_sema.go rename to network/mhfpacket/msg_sys_lock_global_sema.go diff --git a/Erupe/network/mhfpacket/msg_sys_lock_stage.go b/network/mhfpacket/msg_sys_lock_stage.go similarity index 100% rename from Erupe/network/mhfpacket/msg_sys_lock_stage.go rename to network/mhfpacket/msg_sys_lock_stage.go diff --git a/Erupe/network/mhfpacket/msg_sys_login.go b/network/mhfpacket/msg_sys_login.go similarity index 100% rename from Erupe/network/mhfpacket/msg_sys_login.go rename to network/mhfpacket/msg_sys_login.go diff --git a/Erupe/network/mhfpacket/msg_sys_logout.go b/network/mhfpacket/msg_sys_logout.go similarity index 100% rename from Erupe/network/mhfpacket/msg_sys_logout.go rename to network/mhfpacket/msg_sys_logout.go diff --git a/Erupe/network/mhfpacket/msg_sys_move_stage.go b/network/mhfpacket/msg_sys_move_stage.go similarity index 100% rename from Erupe/network/mhfpacket/msg_sys_move_stage.go rename to network/mhfpacket/msg_sys_move_stage.go diff --git a/Erupe/network/mhfpacket/msg_sys_nop.go b/network/mhfpacket/msg_sys_nop.go similarity index 100% rename from Erupe/network/mhfpacket/msg_sys_nop.go rename to network/mhfpacket/msg_sys_nop.go diff --git a/Erupe/network/mhfpacket/msg_sys_notify_register.go b/network/mhfpacket/msg_sys_notify_register.go similarity index 100% rename from Erupe/network/mhfpacket/msg_sys_notify_register.go rename to network/mhfpacket/msg_sys_notify_register.go diff --git a/Erupe/network/mhfpacket/msg_sys_notify_user_binary.go b/network/mhfpacket/msg_sys_notify_user_binary.go similarity index 100% rename from Erupe/network/mhfpacket/msg_sys_notify_user_binary.go rename to network/mhfpacket/msg_sys_notify_user_binary.go diff --git a/Erupe/network/mhfpacket/msg_sys_open_mutex.go b/network/mhfpacket/msg_sys_open_mutex.go similarity index 100% rename from Erupe/network/mhfpacket/msg_sys_open_mutex.go rename to network/mhfpacket/msg_sys_open_mutex.go diff --git a/Erupe/network/mhfpacket/msg_sys_operate_register.go b/network/mhfpacket/msg_sys_operate_register.go similarity index 100% rename from Erupe/network/mhfpacket/msg_sys_operate_register.go rename to network/mhfpacket/msg_sys_operate_register.go diff --git a/Erupe/network/mhfpacket/msg_sys_ping.go b/network/mhfpacket/msg_sys_ping.go similarity index 100% rename from Erupe/network/mhfpacket/msg_sys_ping.go rename to network/mhfpacket/msg_sys_ping.go diff --git a/Erupe/network/mhfpacket/msg_sys_position_object.go b/network/mhfpacket/msg_sys_position_object.go similarity index 100% rename from Erupe/network/mhfpacket/msg_sys_position_object.go rename to network/mhfpacket/msg_sys_position_object.go diff --git a/Erupe/network/mhfpacket/msg_sys_record_log.go b/network/mhfpacket/msg_sys_record_log.go similarity index 100% rename from Erupe/network/mhfpacket/msg_sys_record_log.go rename to network/mhfpacket/msg_sys_record_log.go diff --git a/Erupe/network/mhfpacket/msg_sys_release_semaphore.go b/network/mhfpacket/msg_sys_release_semaphore.go similarity index 100% rename from Erupe/network/mhfpacket/msg_sys_release_semaphore.go rename to network/mhfpacket/msg_sys_release_semaphore.go diff --git a/Erupe/network/mhfpacket/msg_sys_reserve01.go b/network/mhfpacket/msg_sys_reserve01.go similarity index 100% rename from Erupe/network/mhfpacket/msg_sys_reserve01.go rename to network/mhfpacket/msg_sys_reserve01.go diff --git a/Erupe/network/mhfpacket/msg_sys_reserve02.go b/network/mhfpacket/msg_sys_reserve02.go similarity index 100% rename from Erupe/network/mhfpacket/msg_sys_reserve02.go rename to network/mhfpacket/msg_sys_reserve02.go diff --git a/Erupe/network/mhfpacket/msg_sys_reserve03.go b/network/mhfpacket/msg_sys_reserve03.go similarity index 100% rename from Erupe/network/mhfpacket/msg_sys_reserve03.go rename to network/mhfpacket/msg_sys_reserve03.go diff --git a/Erupe/network/mhfpacket/msg_sys_reserve04.go b/network/mhfpacket/msg_sys_reserve04.go similarity index 100% rename from Erupe/network/mhfpacket/msg_sys_reserve04.go rename to network/mhfpacket/msg_sys_reserve04.go diff --git a/Erupe/network/mhfpacket/msg_sys_reserve05.go b/network/mhfpacket/msg_sys_reserve05.go similarity index 100% rename from Erupe/network/mhfpacket/msg_sys_reserve05.go rename to network/mhfpacket/msg_sys_reserve05.go diff --git a/Erupe/network/mhfpacket/msg_sys_reserve06.go b/network/mhfpacket/msg_sys_reserve06.go similarity index 100% rename from Erupe/network/mhfpacket/msg_sys_reserve06.go rename to network/mhfpacket/msg_sys_reserve06.go diff --git a/Erupe/network/mhfpacket/msg_sys_reserve07.go b/network/mhfpacket/msg_sys_reserve07.go similarity index 100% rename from Erupe/network/mhfpacket/msg_sys_reserve07.go rename to network/mhfpacket/msg_sys_reserve07.go diff --git a/Erupe/network/mhfpacket/msg_sys_reserve0c.go b/network/mhfpacket/msg_sys_reserve0c.go similarity index 100% rename from Erupe/network/mhfpacket/msg_sys_reserve0c.go rename to network/mhfpacket/msg_sys_reserve0c.go diff --git a/Erupe/network/mhfpacket/msg_sys_reserve0d.go b/network/mhfpacket/msg_sys_reserve0d.go similarity index 100% rename from Erupe/network/mhfpacket/msg_sys_reserve0d.go rename to network/mhfpacket/msg_sys_reserve0d.go diff --git a/Erupe/network/mhfpacket/msg_sys_reserve0e.go b/network/mhfpacket/msg_sys_reserve0e.go similarity index 100% rename from Erupe/network/mhfpacket/msg_sys_reserve0e.go rename to network/mhfpacket/msg_sys_reserve0e.go diff --git a/Erupe/network/mhfpacket/msg_sys_reserve180.go b/network/mhfpacket/msg_sys_reserve180.go similarity index 100% rename from Erupe/network/mhfpacket/msg_sys_reserve180.go rename to network/mhfpacket/msg_sys_reserve180.go diff --git a/Erupe/network/mhfpacket/msg_sys_reserve188.go b/network/mhfpacket/msg_sys_reserve188.go similarity index 100% rename from Erupe/network/mhfpacket/msg_sys_reserve188.go rename to network/mhfpacket/msg_sys_reserve188.go diff --git a/Erupe/network/mhfpacket/msg_sys_reserve18b.go b/network/mhfpacket/msg_sys_reserve18b.go similarity index 100% rename from Erupe/network/mhfpacket/msg_sys_reserve18b.go rename to network/mhfpacket/msg_sys_reserve18b.go diff --git a/Erupe/network/mhfpacket/msg_sys_reserve18e.go b/network/mhfpacket/msg_sys_reserve18e.go similarity index 100% rename from Erupe/network/mhfpacket/msg_sys_reserve18e.go rename to network/mhfpacket/msg_sys_reserve18e.go diff --git a/Erupe/network/mhfpacket/msg_sys_reserve18f.go b/network/mhfpacket/msg_sys_reserve18f.go similarity index 100% rename from Erupe/network/mhfpacket/msg_sys_reserve18f.go rename to network/mhfpacket/msg_sys_reserve18f.go diff --git a/Erupe/network/mhfpacket/msg_sys_reserve192.go b/network/mhfpacket/msg_sys_reserve192.go similarity index 100% rename from Erupe/network/mhfpacket/msg_sys_reserve192.go rename to network/mhfpacket/msg_sys_reserve192.go diff --git a/Erupe/network/mhfpacket/msg_sys_reserve193.go b/network/mhfpacket/msg_sys_reserve193.go similarity index 100% rename from Erupe/network/mhfpacket/msg_sys_reserve193.go rename to network/mhfpacket/msg_sys_reserve193.go diff --git a/Erupe/network/mhfpacket/msg_sys_reserve194.go b/network/mhfpacket/msg_sys_reserve194.go similarity index 100% rename from Erupe/network/mhfpacket/msg_sys_reserve194.go rename to network/mhfpacket/msg_sys_reserve194.go diff --git a/Erupe/network/mhfpacket/msg_sys_reserve19b.go b/network/mhfpacket/msg_sys_reserve19b.go similarity index 100% rename from Erupe/network/mhfpacket/msg_sys_reserve19b.go rename to network/mhfpacket/msg_sys_reserve19b.go diff --git a/Erupe/network/mhfpacket/msg_sys_reserve19e.go b/network/mhfpacket/msg_sys_reserve19e.go similarity index 100% rename from Erupe/network/mhfpacket/msg_sys_reserve19e.go rename to network/mhfpacket/msg_sys_reserve19e.go diff --git a/Erupe/network/mhfpacket/msg_sys_reserve19f.go b/network/mhfpacket/msg_sys_reserve19f.go similarity index 100% rename from Erupe/network/mhfpacket/msg_sys_reserve19f.go rename to network/mhfpacket/msg_sys_reserve19f.go diff --git a/Erupe/network/mhfpacket/msg_sys_reserve1a4.go b/network/mhfpacket/msg_sys_reserve1a4.go similarity index 100% rename from Erupe/network/mhfpacket/msg_sys_reserve1a4.go rename to network/mhfpacket/msg_sys_reserve1a4.go diff --git a/Erupe/network/mhfpacket/msg_sys_reserve1a6.go b/network/mhfpacket/msg_sys_reserve1a6.go similarity index 100% rename from Erupe/network/mhfpacket/msg_sys_reserve1a6.go rename to network/mhfpacket/msg_sys_reserve1a6.go diff --git a/Erupe/network/mhfpacket/msg_sys_reserve1a7.go b/network/mhfpacket/msg_sys_reserve1a7.go similarity index 100% rename from Erupe/network/mhfpacket/msg_sys_reserve1a7.go rename to network/mhfpacket/msg_sys_reserve1a7.go diff --git a/Erupe/network/mhfpacket/msg_sys_reserve1a8.go b/network/mhfpacket/msg_sys_reserve1a8.go similarity index 100% rename from Erupe/network/mhfpacket/msg_sys_reserve1a8.go rename to network/mhfpacket/msg_sys_reserve1a8.go diff --git a/Erupe/network/mhfpacket/msg_sys_reserve1a9.go b/network/mhfpacket/msg_sys_reserve1a9.go similarity index 100% rename from Erupe/network/mhfpacket/msg_sys_reserve1a9.go rename to network/mhfpacket/msg_sys_reserve1a9.go diff --git a/Erupe/network/mhfpacket/msg_sys_reserve1aa.go b/network/mhfpacket/msg_sys_reserve1aa.go similarity index 100% rename from Erupe/network/mhfpacket/msg_sys_reserve1aa.go rename to network/mhfpacket/msg_sys_reserve1aa.go diff --git a/Erupe/network/mhfpacket/msg_sys_reserve1ab.go b/network/mhfpacket/msg_sys_reserve1ab.go similarity index 100% rename from Erupe/network/mhfpacket/msg_sys_reserve1ab.go rename to network/mhfpacket/msg_sys_reserve1ab.go diff --git a/Erupe/network/mhfpacket/msg_sys_reserve1ac.go b/network/mhfpacket/msg_sys_reserve1ac.go similarity index 100% rename from Erupe/network/mhfpacket/msg_sys_reserve1ac.go rename to network/mhfpacket/msg_sys_reserve1ac.go diff --git a/Erupe/network/mhfpacket/msg_sys_reserve1ad.go b/network/mhfpacket/msg_sys_reserve1ad.go similarity index 100% rename from Erupe/network/mhfpacket/msg_sys_reserve1ad.go rename to network/mhfpacket/msg_sys_reserve1ad.go diff --git a/Erupe/network/mhfpacket/msg_sys_reserve1ae.go b/network/mhfpacket/msg_sys_reserve1ae.go similarity index 100% rename from Erupe/network/mhfpacket/msg_sys_reserve1ae.go rename to network/mhfpacket/msg_sys_reserve1ae.go diff --git a/Erupe/network/mhfpacket/msg_sys_reserve1af.go b/network/mhfpacket/msg_sys_reserve1af.go similarity index 100% rename from Erupe/network/mhfpacket/msg_sys_reserve1af.go rename to network/mhfpacket/msg_sys_reserve1af.go diff --git a/Erupe/network/mhfpacket/msg_sys_reserve4a.go b/network/mhfpacket/msg_sys_reserve4a.go similarity index 100% rename from Erupe/network/mhfpacket/msg_sys_reserve4a.go rename to network/mhfpacket/msg_sys_reserve4a.go diff --git a/Erupe/network/mhfpacket/msg_sys_reserve4b.go b/network/mhfpacket/msg_sys_reserve4b.go similarity index 100% rename from Erupe/network/mhfpacket/msg_sys_reserve4b.go rename to network/mhfpacket/msg_sys_reserve4b.go diff --git a/Erupe/network/mhfpacket/msg_sys_reserve4c.go b/network/mhfpacket/msg_sys_reserve4c.go similarity index 100% rename from Erupe/network/mhfpacket/msg_sys_reserve4c.go rename to network/mhfpacket/msg_sys_reserve4c.go diff --git a/Erupe/network/mhfpacket/msg_sys_reserve4d.go b/network/mhfpacket/msg_sys_reserve4d.go similarity index 100% rename from Erupe/network/mhfpacket/msg_sys_reserve4d.go rename to network/mhfpacket/msg_sys_reserve4d.go diff --git a/Erupe/network/mhfpacket/msg_sys_reserve4e.go b/network/mhfpacket/msg_sys_reserve4e.go similarity index 100% rename from Erupe/network/mhfpacket/msg_sys_reserve4e.go rename to network/mhfpacket/msg_sys_reserve4e.go diff --git a/Erupe/network/mhfpacket/msg_sys_reserve4f.go b/network/mhfpacket/msg_sys_reserve4f.go similarity index 100% rename from Erupe/network/mhfpacket/msg_sys_reserve4f.go rename to network/mhfpacket/msg_sys_reserve4f.go diff --git a/Erupe/network/mhfpacket/msg_sys_reserve55.go b/network/mhfpacket/msg_sys_reserve55.go similarity index 100% rename from Erupe/network/mhfpacket/msg_sys_reserve55.go rename to network/mhfpacket/msg_sys_reserve55.go diff --git a/Erupe/network/mhfpacket/msg_sys_reserve56.go b/network/mhfpacket/msg_sys_reserve56.go similarity index 100% rename from Erupe/network/mhfpacket/msg_sys_reserve56.go rename to network/mhfpacket/msg_sys_reserve56.go diff --git a/Erupe/network/mhfpacket/msg_sys_reserve57.go b/network/mhfpacket/msg_sys_reserve57.go similarity index 100% rename from Erupe/network/mhfpacket/msg_sys_reserve57.go rename to network/mhfpacket/msg_sys_reserve57.go diff --git a/Erupe/network/mhfpacket/msg_sys_reserve5c.go b/network/mhfpacket/msg_sys_reserve5c.go similarity index 100% rename from Erupe/network/mhfpacket/msg_sys_reserve5c.go rename to network/mhfpacket/msg_sys_reserve5c.go diff --git a/Erupe/network/mhfpacket/msg_sys_reserve5e.go b/network/mhfpacket/msg_sys_reserve5e.go similarity index 100% rename from Erupe/network/mhfpacket/msg_sys_reserve5e.go rename to network/mhfpacket/msg_sys_reserve5e.go diff --git a/Erupe/network/mhfpacket/msg_sys_reserve5f.go b/network/mhfpacket/msg_sys_reserve5f.go similarity index 100% rename from Erupe/network/mhfpacket/msg_sys_reserve5f.go rename to network/mhfpacket/msg_sys_reserve5f.go diff --git a/Erupe/network/mhfpacket/msg_sys_reserve71.go b/network/mhfpacket/msg_sys_reserve71.go similarity index 100% rename from Erupe/network/mhfpacket/msg_sys_reserve71.go rename to network/mhfpacket/msg_sys_reserve71.go diff --git a/Erupe/network/mhfpacket/msg_sys_reserve72.go b/network/mhfpacket/msg_sys_reserve72.go similarity index 100% rename from Erupe/network/mhfpacket/msg_sys_reserve72.go rename to network/mhfpacket/msg_sys_reserve72.go diff --git a/Erupe/network/mhfpacket/msg_sys_reserve73.go b/network/mhfpacket/msg_sys_reserve73.go similarity index 100% rename from Erupe/network/mhfpacket/msg_sys_reserve73.go rename to network/mhfpacket/msg_sys_reserve73.go diff --git a/Erupe/network/mhfpacket/msg_sys_reserve74.go b/network/mhfpacket/msg_sys_reserve74.go similarity index 100% rename from Erupe/network/mhfpacket/msg_sys_reserve74.go rename to network/mhfpacket/msg_sys_reserve74.go diff --git a/Erupe/network/mhfpacket/msg_sys_reserve75.go b/network/mhfpacket/msg_sys_reserve75.go similarity index 100% rename from Erupe/network/mhfpacket/msg_sys_reserve75.go rename to network/mhfpacket/msg_sys_reserve75.go diff --git a/Erupe/network/mhfpacket/msg_sys_reserve76.go b/network/mhfpacket/msg_sys_reserve76.go similarity index 100% rename from Erupe/network/mhfpacket/msg_sys_reserve76.go rename to network/mhfpacket/msg_sys_reserve76.go diff --git a/Erupe/network/mhfpacket/msg_sys_reserve77.go b/network/mhfpacket/msg_sys_reserve77.go similarity index 100% rename from Erupe/network/mhfpacket/msg_sys_reserve77.go rename to network/mhfpacket/msg_sys_reserve77.go diff --git a/Erupe/network/mhfpacket/msg_sys_reserve78.go b/network/mhfpacket/msg_sys_reserve78.go similarity index 100% rename from Erupe/network/mhfpacket/msg_sys_reserve78.go rename to network/mhfpacket/msg_sys_reserve78.go diff --git a/Erupe/network/mhfpacket/msg_sys_reserve79.go b/network/mhfpacket/msg_sys_reserve79.go similarity index 100% rename from Erupe/network/mhfpacket/msg_sys_reserve79.go rename to network/mhfpacket/msg_sys_reserve79.go diff --git a/Erupe/network/mhfpacket/msg_sys_reserve7a.go b/network/mhfpacket/msg_sys_reserve7a.go similarity index 100% rename from Erupe/network/mhfpacket/msg_sys_reserve7a.go rename to network/mhfpacket/msg_sys_reserve7a.go diff --git a/Erupe/network/mhfpacket/msg_sys_reserve7b.go b/network/mhfpacket/msg_sys_reserve7b.go similarity index 100% rename from Erupe/network/mhfpacket/msg_sys_reserve7b.go rename to network/mhfpacket/msg_sys_reserve7b.go diff --git a/Erupe/network/mhfpacket/msg_sys_reserve7c.go b/network/mhfpacket/msg_sys_reserve7c.go similarity index 100% rename from Erupe/network/mhfpacket/msg_sys_reserve7c.go rename to network/mhfpacket/msg_sys_reserve7c.go diff --git a/Erupe/network/mhfpacket/msg_sys_reserve7e.go b/network/mhfpacket/msg_sys_reserve7e.go similarity index 100% rename from Erupe/network/mhfpacket/msg_sys_reserve7e.go rename to network/mhfpacket/msg_sys_reserve7e.go diff --git a/Erupe/network/mhfpacket/msg_sys_reserve_stage.go b/network/mhfpacket/msg_sys_reserve_stage.go similarity index 100% rename from Erupe/network/mhfpacket/msg_sys_reserve_stage.go rename to network/mhfpacket/msg_sys_reserve_stage.go diff --git a/Erupe/network/mhfpacket/msg_sys_rights_reload.go b/network/mhfpacket/msg_sys_rights_reload.go similarity index 100% rename from Erupe/network/mhfpacket/msg_sys_rights_reload.go rename to network/mhfpacket/msg_sys_rights_reload.go diff --git a/Erupe/network/mhfpacket/msg_sys_rotate_object.go b/network/mhfpacket/msg_sys_rotate_object.go similarity index 100% rename from Erupe/network/mhfpacket/msg_sys_rotate_object.go rename to network/mhfpacket/msg_sys_rotate_object.go diff --git a/Erupe/network/mhfpacket/msg_sys_serialize.go b/network/mhfpacket/msg_sys_serialize.go similarity index 100% rename from Erupe/network/mhfpacket/msg_sys_serialize.go rename to network/mhfpacket/msg_sys_serialize.go diff --git a/Erupe/network/mhfpacket/msg_sys_set_object_binary.go b/network/mhfpacket/msg_sys_set_object_binary.go similarity index 100% rename from Erupe/network/mhfpacket/msg_sys_set_object_binary.go rename to network/mhfpacket/msg_sys_set_object_binary.go diff --git a/Erupe/network/mhfpacket/msg_sys_set_stage_binary.go b/network/mhfpacket/msg_sys_set_stage_binary.go similarity index 100% rename from Erupe/network/mhfpacket/msg_sys_set_stage_binary.go rename to network/mhfpacket/msg_sys_set_stage_binary.go diff --git a/Erupe/network/mhfpacket/msg_sys_set_stage_pass.go b/network/mhfpacket/msg_sys_set_stage_pass.go similarity index 100% rename from Erupe/network/mhfpacket/msg_sys_set_stage_pass.go rename to network/mhfpacket/msg_sys_set_stage_pass.go diff --git a/Erupe/network/mhfpacket/msg_sys_set_status.go b/network/mhfpacket/msg_sys_set_status.go similarity index 100% rename from Erupe/network/mhfpacket/msg_sys_set_status.go rename to network/mhfpacket/msg_sys_set_status.go diff --git a/Erupe/network/mhfpacket/msg_sys_set_user_binary.go b/network/mhfpacket/msg_sys_set_user_binary.go similarity index 100% rename from Erupe/network/mhfpacket/msg_sys_set_user_binary.go rename to network/mhfpacket/msg_sys_set_user_binary.go diff --git a/Erupe/network/mhfpacket/msg_sys_stage_destruct.go b/network/mhfpacket/msg_sys_stage_destruct.go similarity index 100% rename from Erupe/network/mhfpacket/msg_sys_stage_destruct.go rename to network/mhfpacket/msg_sys_stage_destruct.go diff --git a/Erupe/network/mhfpacket/msg_sys_terminal_log.go b/network/mhfpacket/msg_sys_terminal_log.go similarity index 100% rename from Erupe/network/mhfpacket/msg_sys_terminal_log.go rename to network/mhfpacket/msg_sys_terminal_log.go diff --git a/Erupe/network/mhfpacket/msg_sys_time.go b/network/mhfpacket/msg_sys_time.go similarity index 100% rename from Erupe/network/mhfpacket/msg_sys_time.go rename to network/mhfpacket/msg_sys_time.go diff --git a/Erupe/network/mhfpacket/msg_sys_trans_binary.go b/network/mhfpacket/msg_sys_trans_binary.go similarity index 100% rename from Erupe/network/mhfpacket/msg_sys_trans_binary.go rename to network/mhfpacket/msg_sys_trans_binary.go diff --git a/Erupe/network/mhfpacket/msg_sys_unlock_global_sema.go b/network/mhfpacket/msg_sys_unlock_global_sema.go similarity index 100% rename from Erupe/network/mhfpacket/msg_sys_unlock_global_sema.go rename to network/mhfpacket/msg_sys_unlock_global_sema.go diff --git a/Erupe/network/mhfpacket/msg_sys_unlock_stage.go b/network/mhfpacket/msg_sys_unlock_stage.go similarity index 100% rename from Erupe/network/mhfpacket/msg_sys_unlock_stage.go rename to network/mhfpacket/msg_sys_unlock_stage.go diff --git a/Erupe/network/mhfpacket/msg_sys_unreserve_stage.go b/network/mhfpacket/msg_sys_unreserve_stage.go similarity index 100% rename from Erupe/network/mhfpacket/msg_sys_unreserve_stage.go rename to network/mhfpacket/msg_sys_unreserve_stage.go diff --git a/Erupe/network/mhfpacket/msg_sys_update_object_binary.go b/network/mhfpacket/msg_sys_update_object_binary.go similarity index 100% rename from Erupe/network/mhfpacket/msg_sys_update_object_binary.go rename to network/mhfpacket/msg_sys_update_object_binary.go diff --git a/Erupe/network/mhfpacket/msg_sys_update_right.go b/network/mhfpacket/msg_sys_update_right.go similarity index 100% rename from Erupe/network/mhfpacket/msg_sys_update_right.go rename to network/mhfpacket/msg_sys_update_right.go diff --git a/Erupe/network/mhfpacket/msg_sys_wait_stage_binary.go b/network/mhfpacket/msg_sys_wait_stage_binary.go similarity index 100% rename from Erupe/network/mhfpacket/msg_sys_wait_stage_binary.go rename to network/mhfpacket/msg_sys_wait_stage_binary.go diff --git a/Erupe/network/mhfpacket/opcode_to_packet.go b/network/mhfpacket/opcode_to_packet.go similarity index 100% rename from Erupe/network/mhfpacket/opcode_to_packet.go rename to network/mhfpacket/opcode_to_packet.go diff --git a/Erupe/network/packetid.go b/network/packetid.go similarity index 100% rename from Erupe/network/packetid.go rename to network/packetid.go diff --git a/Erupe/network/packetid_string.go b/network/packetid_string.go similarity index 100% rename from Erupe/network/packetid_string.go rename to network/packetid_string.go diff --git a/Optional Loading & Title Screens/Just drop in your client dat folder and replace b/patch-schema/.gitkeep similarity index 100% rename from Optional Loading & Title Screens/Just drop in your client dat folder and replace rename to patch-schema/.gitkeep diff --git a/Erupe/achievements.sql b/patch-schema/achievements.sql similarity index 100% rename from Erupe/achievements.sql rename to patch-schema/achievements.sql diff --git a/patch-schema/guild-enumeration.sql b/patch-schema/guild-enumeration.sql new file mode 100644 index 000000000..1e7e522a3 --- /dev/null +++ b/patch-schema/guild-enumeration.sql @@ -0,0 +1,9 @@ +BEGIN; + +ALTER TABLE IF EXISTS public.guilds + ADD COLUMN IF NOT EXISTS recruiting bool NOT NULL DEFAULT true; + +ALTER TABLE IF EXISTS public.guild_characters + ADD COLUMN IF NOT EXISTS recruiter bool NOT NULL DEFAULT false; + +END; \ No newline at end of file diff --git a/patch-schema/missing-mail.sql b/patch-schema/missing-mail.sql new file mode 100644 index 000000000..601c77d4f --- /dev/null +++ b/patch-schema/missing-mail.sql @@ -0,0 +1,6 @@ +BEGIN; + +ALTER TABLE IF EXISTS public.mail + ADD COLUMN IF NOT EXISTS locked boolean NOT NULL DEFAULT false; + +END; \ No newline at end of file diff --git a/patch-schema/revert-road-shop.sql b/patch-schema/revert-road-shop.sql new file mode 100644 index 000000000..830f3aa0f --- /dev/null +++ b/patch-schema/revert-road-shop.sql @@ -0,0 +1,9 @@ +BEGIN; + +ALTER TABLE IF EXISTS public.normal_shop_items + DROP COLUMN IF EXISTS enable_weeks; + +ALTER TABLE IF EXISTS public.shop_item_state + DROP COLUMN IF EXISTS week; + +END; \ No newline at end of file diff --git a/savedata/.gitkeep b/savedata/.gitkeep new file mode 100644 index 000000000..e69de29bb diff --git a/Erupe/server/channelserver/compression/deltacomp/deltacomp.go b/server/channelserver/compression/deltacomp/deltacomp.go similarity index 93% rename from Erupe/server/channelserver/compression/deltacomp/deltacomp.go rename to server/channelserver/compression/deltacomp/deltacomp.go index 9760e86a0..0d5aa55be 100644 --- a/Erupe/server/channelserver/compression/deltacomp/deltacomp.go +++ b/server/channelserver/compression/deltacomp/deltacomp.go @@ -2,8 +2,8 @@ package deltacomp import ( "bytes" - "io" "fmt" + "io" ) func checkReadUint8(r *bytes.Reader) (uint8, error) { @@ -76,9 +76,9 @@ func ApplyDataDiff(diff []byte, baseData []byte) []byte { differentCount-- // Grow slice if it's required - if(len(baseCopy) < dataOffset){ + if len(baseCopy) < dataOffset { fmt.Printf("Slice smaller than data offset, growing slice...") - baseCopy = append(baseCopy, make([]byte, (dataOffset + differentCount) - len(baseData))...) + baseCopy = append(baseCopy, make([]byte, (dataOffset+differentCount)-len(baseData))...) } else { length := len(baseCopy[dataOffset:]) if length < differentCount { @@ -87,7 +87,6 @@ func ApplyDataDiff(diff []byte, baseData []byte) []byte { } } - // Apply the patch bytes. for i := 0; i < differentCount; i++ { b, err := checkReadUint8(patch) @@ -95,7 +94,6 @@ func ApplyDataDiff(diff []byte, baseData []byte) []byte { panic("Invalid or misunderstood patch format!") } - baseCopy[dataOffset+i] = b } diff --git a/Erupe/server/channelserver/compression/deltacomp/deltacomp_test.go b/server/channelserver/compression/deltacomp/deltacomp_test.go similarity index 100% rename from Erupe/server/channelserver/compression/deltacomp/deltacomp_test.go rename to server/channelserver/compression/deltacomp/deltacomp_test.go diff --git a/Erupe/server/channelserver/compression/deltacomp/test_data/hunternavi_0_after.bin b/server/channelserver/compression/deltacomp/test_data/hunternavi_0_after.bin similarity index 100% rename from Erupe/server/channelserver/compression/deltacomp/test_data/hunternavi_0_after.bin rename to server/channelserver/compression/deltacomp/test_data/hunternavi_0_after.bin diff --git a/Erupe/server/channelserver/compression/deltacomp/test_data/hunternavi_0_before.bin b/server/channelserver/compression/deltacomp/test_data/hunternavi_0_before.bin similarity index 100% rename from Erupe/server/channelserver/compression/deltacomp/test_data/hunternavi_0_before.bin rename to server/channelserver/compression/deltacomp/test_data/hunternavi_0_before.bin diff --git a/Erupe/server/channelserver/compression/deltacomp/test_data/hunternavi_0_patch_0.bin b/server/channelserver/compression/deltacomp/test_data/hunternavi_0_patch_0.bin similarity index 100% rename from Erupe/server/channelserver/compression/deltacomp/test_data/hunternavi_0_patch_0.bin rename to server/channelserver/compression/deltacomp/test_data/hunternavi_0_patch_0.bin diff --git a/Erupe/server/channelserver/compression/deltacomp/test_data/hunternavi_0_patch_1.bin b/server/channelserver/compression/deltacomp/test_data/hunternavi_0_patch_1.bin similarity index 100% rename from Erupe/server/channelserver/compression/deltacomp/test_data/hunternavi_0_patch_1.bin rename to server/channelserver/compression/deltacomp/test_data/hunternavi_0_patch_1.bin diff --git a/Erupe/server/channelserver/compression/deltacomp/test_data/hunternavi_1_after.bin b/server/channelserver/compression/deltacomp/test_data/hunternavi_1_after.bin similarity index 100% rename from Erupe/server/channelserver/compression/deltacomp/test_data/hunternavi_1_after.bin rename to server/channelserver/compression/deltacomp/test_data/hunternavi_1_after.bin diff --git a/Erupe/server/channelserver/compression/deltacomp/test_data/hunternavi_1_before.bin b/server/channelserver/compression/deltacomp/test_data/hunternavi_1_before.bin similarity index 100% rename from Erupe/server/channelserver/compression/deltacomp/test_data/hunternavi_1_before.bin rename to server/channelserver/compression/deltacomp/test_data/hunternavi_1_before.bin diff --git a/Erupe/server/channelserver/compression/deltacomp/test_data/hunternavi_1_patch_0.bin b/server/channelserver/compression/deltacomp/test_data/hunternavi_1_patch_0.bin similarity index 100% rename from Erupe/server/channelserver/compression/deltacomp/test_data/hunternavi_1_patch_0.bin rename to server/channelserver/compression/deltacomp/test_data/hunternavi_1_patch_0.bin diff --git a/Erupe/server/channelserver/compression/deltacomp/test_data/hunternavi_1_patch_1.bin b/server/channelserver/compression/deltacomp/test_data/hunternavi_1_patch_1.bin similarity index 100% rename from Erupe/server/channelserver/compression/deltacomp/test_data/hunternavi_1_patch_1.bin rename to server/channelserver/compression/deltacomp/test_data/hunternavi_1_patch_1.bin diff --git a/Erupe/server/channelserver/compression/deltacomp/test_data/hunternavi_1_patch_10.bin b/server/channelserver/compression/deltacomp/test_data/hunternavi_1_patch_10.bin similarity index 100% rename from Erupe/server/channelserver/compression/deltacomp/test_data/hunternavi_1_patch_10.bin rename to server/channelserver/compression/deltacomp/test_data/hunternavi_1_patch_10.bin diff --git a/Erupe/server/channelserver/compression/deltacomp/test_data/hunternavi_1_patch_11.bin b/server/channelserver/compression/deltacomp/test_data/hunternavi_1_patch_11.bin similarity index 100% rename from Erupe/server/channelserver/compression/deltacomp/test_data/hunternavi_1_patch_11.bin rename to server/channelserver/compression/deltacomp/test_data/hunternavi_1_patch_11.bin diff --git a/Erupe/server/channelserver/compression/deltacomp/test_data/hunternavi_1_patch_12.bin b/server/channelserver/compression/deltacomp/test_data/hunternavi_1_patch_12.bin similarity index 100% rename from Erupe/server/channelserver/compression/deltacomp/test_data/hunternavi_1_patch_12.bin rename to server/channelserver/compression/deltacomp/test_data/hunternavi_1_patch_12.bin diff --git a/Erupe/server/channelserver/compression/deltacomp/test_data/hunternavi_1_patch_13.bin b/server/channelserver/compression/deltacomp/test_data/hunternavi_1_patch_13.bin similarity index 100% rename from Erupe/server/channelserver/compression/deltacomp/test_data/hunternavi_1_patch_13.bin rename to server/channelserver/compression/deltacomp/test_data/hunternavi_1_patch_13.bin diff --git a/Erupe/server/channelserver/compression/deltacomp/test_data/hunternavi_1_patch_14.bin b/server/channelserver/compression/deltacomp/test_data/hunternavi_1_patch_14.bin similarity index 100% rename from Erupe/server/channelserver/compression/deltacomp/test_data/hunternavi_1_patch_14.bin rename to server/channelserver/compression/deltacomp/test_data/hunternavi_1_patch_14.bin diff --git a/Erupe/server/channelserver/compression/deltacomp/test_data/hunternavi_1_patch_15.bin b/server/channelserver/compression/deltacomp/test_data/hunternavi_1_patch_15.bin similarity index 100% rename from Erupe/server/channelserver/compression/deltacomp/test_data/hunternavi_1_patch_15.bin rename to server/channelserver/compression/deltacomp/test_data/hunternavi_1_patch_15.bin diff --git a/Erupe/server/channelserver/compression/deltacomp/test_data/hunternavi_1_patch_16.bin b/server/channelserver/compression/deltacomp/test_data/hunternavi_1_patch_16.bin similarity index 100% rename from Erupe/server/channelserver/compression/deltacomp/test_data/hunternavi_1_patch_16.bin rename to server/channelserver/compression/deltacomp/test_data/hunternavi_1_patch_16.bin diff --git a/Erupe/server/channelserver/compression/deltacomp/test_data/hunternavi_1_patch_17.bin b/server/channelserver/compression/deltacomp/test_data/hunternavi_1_patch_17.bin similarity index 100% rename from Erupe/server/channelserver/compression/deltacomp/test_data/hunternavi_1_patch_17.bin rename to server/channelserver/compression/deltacomp/test_data/hunternavi_1_patch_17.bin diff --git a/Erupe/server/channelserver/compression/deltacomp/test_data/hunternavi_1_patch_18.bin b/server/channelserver/compression/deltacomp/test_data/hunternavi_1_patch_18.bin similarity index 100% rename from Erupe/server/channelserver/compression/deltacomp/test_data/hunternavi_1_patch_18.bin rename to server/channelserver/compression/deltacomp/test_data/hunternavi_1_patch_18.bin diff --git a/Erupe/server/channelserver/compression/deltacomp/test_data/hunternavi_1_patch_19.bin b/server/channelserver/compression/deltacomp/test_data/hunternavi_1_patch_19.bin similarity index 100% rename from Erupe/server/channelserver/compression/deltacomp/test_data/hunternavi_1_patch_19.bin rename to server/channelserver/compression/deltacomp/test_data/hunternavi_1_patch_19.bin diff --git a/Erupe/server/channelserver/compression/deltacomp/test_data/hunternavi_1_patch_2.bin b/server/channelserver/compression/deltacomp/test_data/hunternavi_1_patch_2.bin similarity index 100% rename from Erupe/server/channelserver/compression/deltacomp/test_data/hunternavi_1_patch_2.bin rename to server/channelserver/compression/deltacomp/test_data/hunternavi_1_patch_2.bin diff --git a/Erupe/server/channelserver/compression/deltacomp/test_data/hunternavi_1_patch_20.bin b/server/channelserver/compression/deltacomp/test_data/hunternavi_1_patch_20.bin similarity index 100% rename from Erupe/server/channelserver/compression/deltacomp/test_data/hunternavi_1_patch_20.bin rename to server/channelserver/compression/deltacomp/test_data/hunternavi_1_patch_20.bin diff --git a/Erupe/server/channelserver/compression/deltacomp/test_data/hunternavi_1_patch_21.bin b/server/channelserver/compression/deltacomp/test_data/hunternavi_1_patch_21.bin similarity index 100% rename from Erupe/server/channelserver/compression/deltacomp/test_data/hunternavi_1_patch_21.bin rename to server/channelserver/compression/deltacomp/test_data/hunternavi_1_patch_21.bin diff --git a/Erupe/server/channelserver/compression/deltacomp/test_data/hunternavi_1_patch_22.bin b/server/channelserver/compression/deltacomp/test_data/hunternavi_1_patch_22.bin similarity index 100% rename from Erupe/server/channelserver/compression/deltacomp/test_data/hunternavi_1_patch_22.bin rename to server/channelserver/compression/deltacomp/test_data/hunternavi_1_patch_22.bin diff --git a/Erupe/server/channelserver/compression/deltacomp/test_data/hunternavi_1_patch_23.bin b/server/channelserver/compression/deltacomp/test_data/hunternavi_1_patch_23.bin similarity index 100% rename from Erupe/server/channelserver/compression/deltacomp/test_data/hunternavi_1_patch_23.bin rename to server/channelserver/compression/deltacomp/test_data/hunternavi_1_patch_23.bin diff --git a/Erupe/server/channelserver/compression/deltacomp/test_data/hunternavi_1_patch_24.bin b/server/channelserver/compression/deltacomp/test_data/hunternavi_1_patch_24.bin similarity index 100% rename from Erupe/server/channelserver/compression/deltacomp/test_data/hunternavi_1_patch_24.bin rename to server/channelserver/compression/deltacomp/test_data/hunternavi_1_patch_24.bin diff --git a/Erupe/server/channelserver/compression/deltacomp/test_data/hunternavi_1_patch_3.bin b/server/channelserver/compression/deltacomp/test_data/hunternavi_1_patch_3.bin similarity index 100% rename from Erupe/server/channelserver/compression/deltacomp/test_data/hunternavi_1_patch_3.bin rename to server/channelserver/compression/deltacomp/test_data/hunternavi_1_patch_3.bin diff --git a/Erupe/server/channelserver/compression/deltacomp/test_data/hunternavi_1_patch_4.bin b/server/channelserver/compression/deltacomp/test_data/hunternavi_1_patch_4.bin similarity index 100% rename from Erupe/server/channelserver/compression/deltacomp/test_data/hunternavi_1_patch_4.bin rename to server/channelserver/compression/deltacomp/test_data/hunternavi_1_patch_4.bin diff --git a/Erupe/server/channelserver/compression/deltacomp/test_data/hunternavi_1_patch_5.bin b/server/channelserver/compression/deltacomp/test_data/hunternavi_1_patch_5.bin similarity index 100% rename from Erupe/server/channelserver/compression/deltacomp/test_data/hunternavi_1_patch_5.bin rename to server/channelserver/compression/deltacomp/test_data/hunternavi_1_patch_5.bin diff --git a/Erupe/server/channelserver/compression/deltacomp/test_data/hunternavi_1_patch_6.bin b/server/channelserver/compression/deltacomp/test_data/hunternavi_1_patch_6.bin similarity index 100% rename from Erupe/server/channelserver/compression/deltacomp/test_data/hunternavi_1_patch_6.bin rename to server/channelserver/compression/deltacomp/test_data/hunternavi_1_patch_6.bin diff --git a/Erupe/server/channelserver/compression/deltacomp/test_data/hunternavi_1_patch_7.bin b/server/channelserver/compression/deltacomp/test_data/hunternavi_1_patch_7.bin similarity index 100% rename from Erupe/server/channelserver/compression/deltacomp/test_data/hunternavi_1_patch_7.bin rename to server/channelserver/compression/deltacomp/test_data/hunternavi_1_patch_7.bin diff --git a/Erupe/server/channelserver/compression/deltacomp/test_data/hunternavi_1_patch_8.bin b/server/channelserver/compression/deltacomp/test_data/hunternavi_1_patch_8.bin similarity index 100% rename from Erupe/server/channelserver/compression/deltacomp/test_data/hunternavi_1_patch_8.bin rename to server/channelserver/compression/deltacomp/test_data/hunternavi_1_patch_8.bin diff --git a/Erupe/server/channelserver/compression/deltacomp/test_data/hunternavi_1_patch_9.bin b/server/channelserver/compression/deltacomp/test_data/hunternavi_1_patch_9.bin similarity index 100% rename from Erupe/server/channelserver/compression/deltacomp/test_data/hunternavi_1_patch_9.bin rename to server/channelserver/compression/deltacomp/test_data/hunternavi_1_patch_9.bin diff --git a/Erupe/server/channelserver/compression/deltacomp/test_data/platedata_0_after.bin b/server/channelserver/compression/deltacomp/test_data/platedata_0_after.bin similarity index 100% rename from Erupe/server/channelserver/compression/deltacomp/test_data/platedata_0_after.bin rename to server/channelserver/compression/deltacomp/test_data/platedata_0_after.bin diff --git a/Erupe/server/channelserver/compression/deltacomp/test_data/platedata_0_before.bin b/server/channelserver/compression/deltacomp/test_data/platedata_0_before.bin similarity index 100% rename from Erupe/server/channelserver/compression/deltacomp/test_data/platedata_0_before.bin rename to server/channelserver/compression/deltacomp/test_data/platedata_0_before.bin diff --git a/Erupe/server/channelserver/compression/deltacomp/test_data/platedata_0_patch_0.bin b/server/channelserver/compression/deltacomp/test_data/platedata_0_patch_0.bin similarity index 100% rename from Erupe/server/channelserver/compression/deltacomp/test_data/platedata_0_patch_0.bin rename to server/channelserver/compression/deltacomp/test_data/platedata_0_patch_0.bin diff --git a/Erupe/server/channelserver/compression/deltacomp/test_data/platedata_0_patch_1.bin b/server/channelserver/compression/deltacomp/test_data/platedata_0_patch_1.bin similarity index 100% rename from Erupe/server/channelserver/compression/deltacomp/test_data/platedata_0_patch_1.bin rename to server/channelserver/compression/deltacomp/test_data/platedata_0_patch_1.bin diff --git a/Erupe/server/channelserver/compression/nullcomp/nullcomp.go b/server/channelserver/compression/nullcomp/nullcomp.go similarity index 99% rename from Erupe/server/channelserver/compression/nullcomp/nullcomp.go rename to server/channelserver/compression/nullcomp/nullcomp.go index 402778e5d..e8b9c952e 100644 --- a/Erupe/server/channelserver/compression/nullcomp/nullcomp.go +++ b/server/channelserver/compression/nullcomp/nullcomp.go @@ -95,4 +95,4 @@ func Compress(rawData []byte) ([]byte, error) { } } return output, nil -} \ No newline at end of file +} diff --git a/Erupe/server/channelserver/handlers.go b/server/channelserver/handlers.go similarity index 64% rename from Erupe/server/channelserver/handlers.go rename to server/channelserver/handlers.go index fcb17cb55..1cfe9e3ff 100644 --- a/Erupe/server/channelserver/handlers.go +++ b/server/channelserver/handlers.go @@ -4,7 +4,11 @@ import ( "bytes" "encoding/binary" "encoding/hex" + "erupe-ce/common/stringsupport" "fmt" + "io" + "net" + "strings" "io/ioutil" "math/bits" @@ -134,25 +138,21 @@ func handleMsgSysTerminalLog(s *Session, p mhfpacket.MHFPacket) { func handleMsgSysLogin(s *Session, p mhfpacket.MHFPacket) { pkt := p.(*mhfpacket.MsgSysLogin) - name := "" - rights := uint32(0x0E) - // 0e with normal sub 4e when having premium - // 01 = Character can take quests at allows - // 02 = Hunter Life, normal quests core sub - // 03 = Extra Course, extra quests, town boxes, QOL course, core sub - // 06 = Premium Course, standard 'premium' which makes ranking etc. faster - // 06 0A 0B = Boost Course, just actually 3 subs combined - // 08 09 1E = N Course, gives you the benefits of being in a netcafe (extra quests, N Points, daily freebies etc.) minimal and pointless - // 0C = N Boost course, ultra luxury course that ruins the game if in use - err := s.server.db.QueryRow("SELECT rights FROM users u INNER JOIN characters c ON u.id = c.user_id WHERE c.id = $1", pkt.CharID0).Scan(&rights) - if err != nil { - panic(err) + if !s.server.erupeConfig.DevModeOptions.DisableTokenCheck { + var token string + err := s.server.db.QueryRow("SELECT token FROM sign_sessions WHERE token=$1", pkt.LoginTokenString).Scan(&token) + if err != nil { + s.rawConn.Close() + s.logger.Warn(fmt.Sprintf("Invalid login token, offending CID: (%d)", pkt.CharID0)) + return + } } - s.server.db.QueryRow("SELECT name FROM characters WHERE id = $1", pkt.CharID0).Scan(&name) + rights := uint32(0x0E) + s.server.db.QueryRow("SELECT rights FROM users u INNER JOIN characters c ON u.id = c.user_id WHERE c.id = $1", pkt.CharID0).Scan(&rights) + s.Lock() - s.Name = name s.charID = pkt.CharID0 s.rights = rights s.token = pkt.LoginTokenString @@ -160,7 +160,7 @@ func handleMsgSysLogin(s *Session, p mhfpacket.MHFPacket) { bf := byteframe.NewByteFrame() bf.WriteUint32(uint32(Time_Current_Adjusted().Unix())) // Unix timestamp - _, err = s.server.db.Exec("UPDATE servers SET current_players=$1 WHERE server_id=$2", len(s.server.sessions), s.server.ID) + _, err := s.server.db.Exec("UPDATE servers SET current_players=$1 WHERE server_id=$2", len(s.server.sessions), s.server.ID) if err != nil { panic(err) } @@ -183,6 +183,8 @@ func handleMsgSysLogin(s *Session, p mhfpacket.MHFPacket) { doAckSimpleSucceed(s, pkt.AckHandle, bf.Data()) updateRights(s) + + s.server.BroadcastMHF(&mhfpacket.MsgSysInsertUser{CharID: s.charID}, s) } func handleMsgSysLogout(s *Session, p mhfpacket.MHFPacket) { @@ -224,18 +226,18 @@ func logoutPlayer(s *Session) { } if s.stage == nil { - return + return } - s.server.BroadcastMHF(&mhfpacket.MsgSysDeleteUser { + s.server.BroadcastMHF(&mhfpacket.MsgSysDeleteUser{ CharID: s.charID, }, s) s.server.Lock() - for _, stage := range s.server.stages { - if _, exists := stage.reservedClientSlots[s.charID]; exists { - delete(stage.reservedClientSlots, s.charID) - } + for _, stage := range s.server.stages { + if _, exists := stage.reservedClientSlots[s.charID]; exists { + delete(stage.reservedClientSlots, s.charID) + } } s.server.Unlock() @@ -273,8 +275,6 @@ func handleMsgSysTime(s *Session, p mhfpacket.MHFPacket) { Timestamp: uint32(Time_Current_Adjusted().Unix()), // JP timezone } s.QueueSendMHF(resp) - - s.notifyticker() } func handleMsgSysIssueLogkey(s *Session, p mhfpacket.MHFPacket) { @@ -345,10 +345,157 @@ func handleMsgSysRightsReload(s *Session, p mhfpacket.MHFPacket) { func handleMsgMhfTransitMessage(s *Session, p mhfpacket.MHFPacket) { pkt := p.(*mhfpacket.MsgMhfTransitMessage) - // TODO: figure out what this is supposed to return - // probably what world+land the targeted character is on? - // stubbed response will just say user not found - doAckBufSucceed(s, pkt.AckHandle, make([]byte, 4)) + resp := byteframe.NewByteFrame() + resp.WriteUint16(0) + var count uint16 + switch pkt.SearchType { + case 1: // CID + bf := byteframe.NewByteFrameFromBytes(pkt.MessageData) + CharID := bf.ReadUint32() + for _, c := range s.server.Channels { + for _, session := range c.sessions { + if session.charID == CharID { + count++ + sessionName := stringsupport.UTF8ToSJIS(session.Name) + sessionStage := stringsupport.UTF8ToSJIS(session.stageID) + resp.WriteUint32(binary.LittleEndian.Uint32(net.ParseIP(c.IP).To4())) + resp.WriteUint16(c.Port) + resp.WriteUint32(session.charID) + resp.WriteBool(true) + resp.WriteUint8(uint8(len(sessionName) + 1)) + resp.WriteUint16(uint16(len(c.userBinaryParts[userBinaryPartID{charID: session.charID, index: 3}]))) + resp.WriteBytes(make([]byte, 40)) + resp.WriteUint8(uint8(len(sessionStage) + 1)) + resp.WriteBytes(make([]byte, 8)) + resp.WriteNullTerminatedBytes(sessionName) + resp.WriteBytes(c.userBinaryParts[userBinaryPartID{session.charID, 3}]) + resp.WriteNullTerminatedBytes(sessionStage) + } + } + } + case 2: // Name + bf := byteframe.NewByteFrameFromBytes(pkt.MessageData) + bf.ReadUint16() // lenSearchTerm + bf.ReadUint16() // maxResults + bf.ReadUint8() // Unk + searchTerm := stringsupport.SJISToUTF8(bf.ReadNullTerminatedBytes()) + for _, c := range s.server.Channels { + for _, session := range c.sessions { + if count == 100 { + break + } + if strings.Contains(session.Name, searchTerm) { + count++ + sessionName := stringsupport.UTF8ToSJIS(session.Name) + sessionStage := stringsupport.UTF8ToSJIS(session.stageID) + resp.WriteUint32(binary.LittleEndian.Uint32(net.ParseIP(c.IP).To4())) + resp.WriteUint16(c.Port) + resp.WriteUint32(session.charID) + resp.WriteBool(true) + resp.WriteUint8(uint8(len(sessionName) + 1)) + resp.WriteUint16(uint16(len(c.userBinaryParts[userBinaryPartID{session.charID, 3}]))) + resp.WriteBytes(make([]byte, 40)) + resp.WriteUint8(uint8(len(sessionStage) + 1)) + resp.WriteBytes(make([]byte, 8)) + resp.WriteNullTerminatedBytes(sessionName) + resp.WriteBytes(c.userBinaryParts[userBinaryPartID{charID: session.charID, index: 3}]) + resp.WriteNullTerminatedBytes(sessionStage) + } + } + } + case 3: // Enumerate Party + bf := byteframe.NewByteFrameFromBytes(pkt.MessageData) + ip := bf.ReadBytes(4) + ipString := fmt.Sprintf("%d.%d.%d.%d", ip[3], ip[2], ip[1], ip[0]) + port := bf.ReadUint16() + bf.ReadUint16() // lenStage + maxResults := bf.ReadUint16() + bf.ReadBytes(1) + stageID := stringsupport.SJISToUTF8(bf.ReadNullTerminatedBytes()) + for _, c := range s.server.Channels { + if c.IP == ipString && c.Port == port { + for _, stage := range c.stages { + if stage.id == stageID { + if count == maxResults { + break + } + for session := range stage.clients { + count++ + sessionStage := stringsupport.UTF8ToSJIS(session.stageID) + sessionName := stringsupport.UTF8ToSJIS(session.Name) + resp.WriteUint32(binary.LittleEndian.Uint32(net.ParseIP(c.IP).To4())) + resp.WriteUint16(c.Port) + resp.WriteUint32(session.charID) + resp.WriteUint8(uint8(len(sessionStage) + 1)) + resp.WriteUint8(uint8(len(sessionName) + 1)) + resp.WriteUint8(0) + resp.WriteUint8(7) // lenBinary + resp.WriteBytes(make([]byte, 48)) + resp.WriteNullTerminatedBytes(sessionStage) + resp.WriteNullTerminatedBytes(sessionName) + resp.WriteUint16(999) // HR + resp.WriteUint16(999) // GR + resp.WriteBytes([]byte{0x06, 0x10, 0x00}) // Unk + } + } + } + } + } + case 4: // Find Party + bf := byteframe.NewByteFrameFromBytes(pkt.MessageData) + bf.ReadUint8() + maxResults := bf.ReadUint16() + bf.ReadUint8() + bf.ReadUint8() + partyType := bf.ReadUint16() + _ = bf.DataFromCurrent() // Restrictions + var stagePrefix string + switch partyType { + case 0: // Public Bar + stagePrefix = "sl2Ls210" + case 1: // Tokotoko Partnya + stagePrefix = "sl2Ls463" + case 2: // Hunting Prowess Match + stagePrefix = "sl2Ls286" + case 3: // Volpakkun Together + stagePrefix = "sl2Ls465" + case 5: // Quick Party + // Unk + } + for _, c := range s.server.Channels { + for _, stage := range c.stages { + if count == maxResults { + break + } + if strings.HasPrefix(stage.id, stagePrefix) { + count++ + sessionStage := stringsupport.UTF8ToSJIS(stage.id) + resp.WriteUint32(binary.LittleEndian.Uint32(net.ParseIP(c.IP).To4())) + resp.WriteUint16(c.Port) + + // TODO: This is half right, could be trimmed + resp.WriteUint16(0) + resp.WriteUint16(uint16(len(stage.clients))) + resp.WriteUint16(uint16(len(stage.clients))) + resp.WriteUint16(stage.maxPlayers) + resp.WriteUint16(0) + resp.WriteUint16(uint16(len(stage.clients))) + // + + resp.WriteUint16(uint16(len(sessionStage) + 1)) + resp.WriteUint8(1) + resp.WriteUint8(uint8(len(stage.rawBinaryData[stageBinaryKey{1, 1}]))) + resp.WriteBytes(make([]byte, 16)) + resp.WriteNullTerminatedBytes(sessionStage) + resp.WriteBytes([]byte{0x00}) + resp.WriteBytes(stage.rawBinaryData[stageBinaryKey{1, 1}]) + } + } + } + } + resp.Seek(0, io.SeekStart) + resp.WriteUint16(count) + doAckBufSucceed(s, pkt.AckHandle, resp.Data()) } func handleMsgCaExchangeItem(s *Session, p mhfpacket.MHFPacket) {} @@ -637,712 +784,712 @@ func handleMsgMhfInfoScenarioCounter(s *Session, p mhfpacket.MHFPacket) { pkt := p.(*mhfpacket.MsgMhfInfoScenarioCounter) scenarioCounter := []struct { MainID uint32 - Unk1 uint8 // Bool item exchange? + Unk1 uint8 // Bool item exchange? // 0 = basic, 1 = veteran, 3 = other, 6 = pallone, 7 = diva CategoryID uint8 }{ - //000000110000 - { - MainID: 0x00000011, Unk1: 0, CategoryID: 0, - }, - // 0000005D0001 - { - MainID: 0x0000005D, Unk1: 0, CategoryID: 1, - }, - // 0000005C0001 - { - MainID: 0x0000005C, Unk1: 0, CategoryID: 1, - }, - // 000000510001 - { - MainID: 0x00000051, Unk1: 0, CategoryID: 1, - }, - // 0000005B0001 - { - MainID: 0x0000005B, Unk1: 0, CategoryID: 1, - }, - // 0000005A0001 - { - MainID: 0x0000005A, Unk1: 0, CategoryID: 1, - }, - // 000000590001 - { - MainID: 0x00000059, Unk1: 0, CategoryID: 1, - }, - // 000000580001 - { - MainID: 0x00000058, Unk1: 0, CategoryID: 1, - }, - // 000000570001 - { - MainID: 0x00000057, Unk1: 0, CategoryID: 1, - }, - // 000000560001 - { - MainID: 0x00000056, Unk1: 0, CategoryID: 1, - }, - // 000000550001 - { - MainID: 0x00000055, Unk1: 0, CategoryID: 1, - }, - // 000000540001 - { - MainID: 0x00000054, Unk1: 0, CategoryID: 1, - }, - // 000000530001 - { - MainID: 0x00000053, Unk1: 0, CategoryID: 1, - }, - // 000000520001 - { - MainID: 0x00000052, Unk1: 0, CategoryID: 1, - }, - // 000000570103 - { - MainID: 0x00000057, Unk1: 1, CategoryID: 3, - }, - // 000000580103 - { - MainID: 0x00000058, Unk1: 1, CategoryID: 3, - }, - // 000000590103 - { - MainID: 0x00000059, Unk1: 1, CategoryID: 3, - }, - // 0000005A0103 - { - MainID: 0x0000005A, Unk1: 1, CategoryID: 3, - }, - // 0000005B0103 - { - MainID: 0x0000005B, Unk1: 1, CategoryID: 3, - }, - // 0000005C0103 - { - MainID: 0x0000005C, Unk1: 1, CategoryID: 3, - }, - // 000000530103 - { - MainID: 0x00000053, Unk1: 1, CategoryID: 3, - }, - // 000000560103 - { - MainID: 0x00000056, Unk1: 1, CategoryID: 3, - }, - // 0000003C0103 - { - MainID: 0x0000003C, Unk1: 1, CategoryID: 3, - }, - // 0000003A0103 - { - MainID: 0x0000003A, Unk1: 1, CategoryID: 3, - }, - // 0000003B0103 - { - MainID: 0x0000003B, Unk1: 1, CategoryID: 3, - }, - // 0000001B0103 - { - MainID: 0x0000001B, Unk1: 1, CategoryID: 3, - }, - // 000000190103 - { - MainID: 0x00000019, Unk1: 1, CategoryID: 3, - }, - // 0000001A0103 - { - MainID: 0x0000001A, Unk1: 1, CategoryID: 3, - }, - // 000000170103 - { - MainID: 0x00000017, Unk1: 1, CategoryID: 3, - }, - // 000000020103 - { - MainID: 0x00000002, Unk1: 1, CategoryID: 3, - }, - // 000000030103 - { - MainID: 0x00000003, Unk1: 1, CategoryID: 3, - }, - // 000000040103 - { - MainID: 0x00000004, Unk1: 1, CategoryID: 3, - }, - // 0000001F0103 - { - MainID: 0x0000001F, Unk1: 1, CategoryID: 3, - }, - // 000000200103 - { - MainID: 0x00000020, Unk1: 1, CategoryID: 3, - }, - // 000000210103 - { - MainID: 0x00000021, Unk1: 1, CategoryID: 3, - }, - // 000000220103 - { - MainID: 0x00000022, Unk1: 1, CategoryID: 3, - }, - // 000000230103 - { - MainID: 0x00000023, Unk1: 1, CategoryID: 3, - }, - // 000000240103 - { - MainID: 0x00000024, Unk1: 1, CategoryID: 3, - }, - // 000000250103 - { - MainID: 0x00000025, Unk1: 1, CategoryID: 3, - }, - // 000000280103 - { - MainID: 0x00000028, Unk1: 1, CategoryID: 3, - }, - // 000000260103 - { - MainID: 0x00000026, Unk1: 1, CategoryID: 3, - }, - // 000000270103 - { - MainID: 0x00000027, Unk1: 1, CategoryID: 3, - }, - // 000000300103 - { - MainID: 0x00000030, Unk1: 1, CategoryID: 3, - }, - // 0000000C0103 - { - MainID: 0x0000000C, Unk1: 1, CategoryID: 3, - }, - // 0000000D0103 - { - MainID: 0x0000000D, Unk1: 1, CategoryID: 3, - }, - // 0000001E0103 - { - MainID: 0x0000001E, Unk1: 1, CategoryID: 3, - }, - // 0000001D0103 - { - MainID: 0x0000001D, Unk1: 1, CategoryID: 3, - }, - // 0000002E0003 - { - MainID: 0x0000002E, Unk1: 0, CategoryID: 3, - }, - // 000000000004 - { - MainID: 0x00000000, Unk1: 0, CategoryID: 4, - }, - // 000000010004 - { - MainID: 0x00000001, Unk1: 0, CategoryID: 4, - }, - // 000000020004 - { - MainID: 0x00000002, Unk1: 0, CategoryID: 4, - }, - // 000000030004 - { - MainID: 0x00000003, Unk1: 0, CategoryID: 4, - }, - // 000000040004 - { - MainID: 0x00000004, Unk1: 0, CategoryID: 4, - }, - // 000000050004 - { - MainID: 0x00000005, Unk1: 0, CategoryID: 4, - }, - // 000000060004 - { - MainID: 0x00000006, Unk1: 0, CategoryID: 4, - }, - // 000000070004 - { - MainID: 0x00000007, Unk1: 0, CategoryID: 4, - }, - // 000000080004 - { - MainID: 0x00000008, Unk1: 0, CategoryID: 4, - }, - // 000000090004 - { - MainID: 0x00000009, Unk1: 0, CategoryID: 4, - }, - // 0000000A0004 - { - MainID: 0x0000000A, Unk1: 0, CategoryID: 4, - }, - // 0000000B0004 - { - MainID: 0x0000000B, Unk1: 0, CategoryID: 4, - }, - // 0000000C0004 - { - MainID: 0x0000000C, Unk1: 0, CategoryID: 4, - }, - // 0000000D0004 - { - MainID: 0x0000000D, Unk1: 0, CategoryID: 4, - }, - // 0000000E0004 - { - MainID: 0x0000000E, Unk1: 0, CategoryID: 4, - }, - // 000000320005 - { - MainID: 0x00000032, Unk1: 0, CategoryID: 5, - }, - // 000000330005 - { - MainID: 0x00000033, Unk1: 0, CategoryID: 5, - }, - // 000000340005 - { - MainID: 0x00000034, Unk1: 0, CategoryID: 5, - }, - // 000000350005 - { - MainID: 0x00000035, Unk1: 0, CategoryID: 5, - }, - // 000000360005 - { - MainID: 0x00000036, Unk1: 0, CategoryID: 5, - }, - // 000000370005 - { - MainID: 0x00000037, Unk1: 0, CategoryID: 5, - }, - // 000000380005 - { - MainID: 0x00000038, Unk1: 0, CategoryID: 5, - }, - // 0000003A0005 - { - MainID: 0x0000003A, Unk1: 0, CategoryID: 5, - }, - // 0000003F0005 - { - MainID: 0x0000003F, Unk1: 0, CategoryID: 5, - }, - // 000000400005 - { - MainID: 0x00000040, Unk1: 0, CategoryID: 5, - }, - // 000000410005 - { - MainID: 0x00000041, Unk1: 0, CategoryID: 5, - }, - // 000000430005 - { - MainID: 0x00000043, Unk1: 0, CategoryID: 5, - }, - // 000000470005 - { - MainID: 0x00000047, Unk1: 0, CategoryID: 5, - }, - // 0000004B0005 - { - MainID: 0x0000004B, Unk1: 0, CategoryID: 5, - }, - // 0000003D0005 - { - MainID: 0x0000003D, Unk1: 0, CategoryID: 5, - }, - // 000000440005 - { - MainID: 0x00000044, Unk1: 0, CategoryID: 5, - }, - // 000000420005 - { - MainID: 0x00000042, Unk1: 0, CategoryID: 5, - }, - // 0000004C0005 - { - MainID: 0x0000004C, Unk1: 0, CategoryID: 5, - }, - // 000000460005 - { - MainID: 0x00000046, Unk1: 0, CategoryID: 5, - }, - // 0000004D0005 - { - MainID: 0x0000004D, Unk1: 0, CategoryID: 5, - }, - // 000000480005 - { - MainID: 0x00000048, Unk1: 0, CategoryID: 5, - }, - // 0000004A0005 - { - MainID: 0x0000004A, Unk1: 0, CategoryID: 5, - }, - // 000000490005 - { - MainID: 0x00000049, Unk1: 0, CategoryID: 5, - }, - // 0000004E0005 - { - MainID: 0x0000004E, Unk1: 0, CategoryID: 5, - }, - // 000000450005 - { - MainID: 0x00000045, Unk1: 0, CategoryID: 5, - }, - // 0000003E0005 - { - MainID: 0x0000003E, Unk1: 0, CategoryID: 5, - }, - // 0000004F0005 - { - MainID: 0x0000004F, Unk1: 0, CategoryID: 5, - }, - // 000000000106 - { - MainID: 0x00000000, Unk1: 1, CategoryID: 6, - }, - // 000000010106 - { - MainID: 0x00000001, Unk1: 1, CategoryID: 6, - }, - // 000000020106 - { - MainID: 0x00000002, Unk1: 1, CategoryID: 6, - }, - // 000000030106 - { - MainID: 0x00000003, Unk1: 1, CategoryID: 6, - }, - // 000000040106 - { - MainID: 0x00000004, Unk1: 1, CategoryID: 6, - }, - // 000000050106 - { - MainID: 0x00000005, Unk1: 1, CategoryID: 6, - }, - // 000000060106 - { - MainID: 0x00000006, Unk1: 1, CategoryID: 6, - }, - // 000000070106 - { - MainID: 0x00000007, Unk1: 1, CategoryID: 6, - }, - // 000000080106 - { - MainID: 0x00000008, Unk1: 1, CategoryID: 6, - }, - // 000000090106 - { - MainID: 0x00000009, Unk1: 1, CategoryID: 6, - }, - // 000000110106 - { - MainID: 0x00000011, Unk1: 1, CategoryID: 6, - }, - // 0000000A0106 - { - MainID: 0x0000000A, Unk1: 1, CategoryID: 6, - }, - // 0000000B0106 - { - MainID: 0x0000000B, Unk1: 1, CategoryID: 6, - }, - // 0000000C0106 - { - MainID: 0x0000000C, Unk1: 1, CategoryID: 6, - }, - // 0000000D0106 - { - MainID: 0x0000000D, Unk1: 1, CategoryID: 6, - }, - // 0000000E0106 - { - MainID: 0x0000000E, Unk1: 1, CategoryID: 6, - }, - // 0000000F0106 - { - MainID: 0x0000000F, Unk1: 1, CategoryID: 6, - }, - // 000000100106 - { - MainID: 0x00000010, Unk1: 1, CategoryID: 6, - }, - // 000000320107 - { - MainID: 0x00000032, Unk1: 1, CategoryID: 7, - }, - // 000000350107 - { - MainID: 0x00000035, Unk1: 1, CategoryID: 7, - }, - // 0000003E0107 - { - MainID: 0x0000003E, Unk1: 1, CategoryID: 7, - }, - // 000000340107 - { - MainID: 0x00000034, Unk1: 1, CategoryID: 7, - }, - // 000000380107 - { - MainID: 0x00000038, Unk1: 1, CategoryID: 7, - }, - // 000000330107 - { - MainID: 0x00000033, Unk1: 1, CategoryID: 7, - }, - // 000000310107 - { - MainID: 0x00000031, Unk1: 1, CategoryID: 7, - }, - // 000000360107 - { - MainID: 0x00000036, Unk1: 1, CategoryID: 7, - }, - // 000000390107 - { - MainID: 0x00000039, Unk1: 1, CategoryID: 7, - }, - // 000000370107 - { - MainID: 0x00000037, Unk1: 1, CategoryID: 7, - }, - // 0000003D0107 - { - MainID: 0x0000003D, Unk1: 1, CategoryID: 7, - }, - // 0000003A0107 - { - MainID: 0x0000003A, Unk1: 1, CategoryID: 7, - }, - // 0000003C0107 - { - MainID: 0x0000003C, Unk1: 1, CategoryID: 7, - }, - // 0000003B0107 - { - MainID: 0x0000003B, Unk1: 1, CategoryID: 7, - }, - // 0000002A0107 - { - MainID: 0x0000002A, Unk1: 1, CategoryID: 7, - }, - // 000000300107 - { - MainID: 0x00000030, Unk1: 1, CategoryID: 7, - }, - // 000000280107 - { - MainID: 0x00000028, Unk1: 1, CategoryID: 7, - }, - // 000000270107 - { - MainID: 0x00000027, Unk1: 1, CategoryID: 7, - }, - // 0000002B0107 - { - MainID: 0x0000002B, Unk1: 1, CategoryID: 7, - }, - // 0000002E0107 - { - MainID: 0x0000002E, Unk1: 1, CategoryID: 7, - }, - // 000000290107 - { - MainID: 0x00000029, Unk1: 1, CategoryID: 7, - }, - // 0000002C0107 - { - MainID: 0x0000002C, Unk1: 1, CategoryID: 7, - }, - // 0000002D0107 - { - MainID: 0x0000002D, Unk1: 1, CategoryID: 7, - }, - // 0000002F0107 - { - MainID: 0x0000002F, Unk1: 1, CategoryID: 7, - }, - // 000000250107 - { - MainID: 0x00000025, Unk1: 1, CategoryID: 7, - }, - // 000000220107 - { - MainID: 0x00000022, Unk1: 1, CategoryID: 7, - }, - // 000000210107 - { - MainID: 0x00000021, Unk1: 1, CategoryID: 7, - }, - // 000000200107 - { - MainID: 0x00000020, Unk1: 1, CategoryID: 7, - }, - // 0000001C0107 - { - MainID: 0x0000001C, Unk1: 1, CategoryID: 7, - }, - // 0000001A0107 - { - MainID: 0x0000001A, Unk1: 1, CategoryID: 7, - }, - // 000000240107 - { - MainID: 0x00000024, Unk1: 1, CategoryID: 7, - }, - // 000000260107 - { - MainID: 0x00000026, Unk1: 1, CategoryID: 7, - }, - // 000000230107 - { - MainID: 0x00000023, Unk1: 1, CategoryID: 7, - }, - // 0000001B0107 - { - MainID: 0x0000001B, Unk1: 1, CategoryID: 7, - }, - // 0000001E0107 - { - MainID: 0x0000001E, Unk1: 1, CategoryID: 7, - }, - // 0000001F0107 - { - MainID: 0x0000001F, Unk1: 1, CategoryID: 7, - }, - // 0000001D0107 - { - MainID: 0x0000001D, Unk1: 1, CategoryID: 7, - }, - // 000000180107 - { - MainID: 0x00000018, Unk1: 1, CategoryID: 7, - }, - // 000000170107 - { - MainID: 0x00000017, Unk1: 1, CategoryID: 7, - }, - // 000000160107 - { - MainID: 0x00000016, Unk1: 1, CategoryID: 7, - }, - // 000000150107 - // Missing file - // { - // MainID: 0x00000015, Unk1: 1, CategoryID: 7, - // }, - // 000000190107 - { - MainID: 0x00000019, Unk1: 1, CategoryID: 7, - }, - // 000000140107 - // Missing file - // { - // MainID: 0x00000014, Unk1: 1, CategoryID: 7, - // }, - // 000000070107 - // Missing file - // { - // MainID: 0x00000007, Unk1: 1, CategoryID: 7, - // }, - // 000000090107 - // Missing file - // { - // MainID: 0x00000009, Unk1: 1, CategoryID: 7, - // }, - // 0000000D0107 - // Missing file - // { - // MainID: 0x0000000D, Unk1: 1, CategoryID: 7, - // }, - // 000000100107 - // Missing file - // { - // MainID: 0x00000010, Unk1: 1, CategoryID: 7, - // }, - // 0000000C0107 - // Missing file - // { - // MainID: 0x0000000C, Unk1: 1, CategoryID: 7, - // }, - // 0000000E0107 - // Missing file - // { - // MainID: 0x0000000E, Unk1: 1, CategoryID: 7, - // }, - // 0000000F0107 - // Missing file - // { - // MainID: 0x0000000F, Unk1: 1, CategoryID: 7, - // }, - // 000000130107 - // Missing file - // { - // MainID: 0x00000013, Unk1: 1, CategoryID: 7, - // }, - // 0000000A0107 - // Missing file - // { - // MainID: 0x0000000A, Unk1: 1, CategoryID: 7, - // }, - // 000000080107 - // Missing file - // { - // MainID: 0x00000008, Unk1: 1, CategoryID: 7, - // }, - // 0000000B0107 - // Missing file - // { - // MainID: 0x0000000B, Unk1: 1, CategoryID: 7, - // }, - // 000000120107 - // Missing file - // { - // MainID: 0x00000012, Unk1: 1, CategoryID: 7, - // }, - // 000000110107 - // Missing file - // { - // MainID: 0x00000011, Unk1: 1, CategoryID: 7, - // }, - // 000000060107 - // Missing file - // { - // MainID: 0x00000006, Unk1: 1, CategoryID: 7, - // }, - // 000000050107 - // Missing file - // { - // MainID: 0x00000005, Unk1: 1, CategoryID: 7, - // }, - // 000000040107 - // Missing file - // { - // MainID: 0x00000004, Unk1: 1, CategoryID: 7, - // }, - // 000000030107 - { - MainID: 0x00000003, Unk1: 1, CategoryID: 7, - }, - // 000000020107 - { - MainID: 0x00000002, Unk1: 1, CategoryID: 7, - }, - // 000000010107 - { - MainID: 0x00000001, Unk1: 1, CategoryID: 7, - }, - // 000000000107 - { - MainID: 0x00000000, Unk1: 1, CategoryID: 7, - }, + //000000110000 + { + MainID: 0x00000011, Unk1: 0, CategoryID: 0, + }, + // 0000005D0001 + { + MainID: 0x0000005D, Unk1: 0, CategoryID: 1, + }, + // 0000005C0001 + { + MainID: 0x0000005C, Unk1: 0, CategoryID: 1, + }, + // 000000510001 + { + MainID: 0x00000051, Unk1: 0, CategoryID: 1, + }, + // 0000005B0001 + { + MainID: 0x0000005B, Unk1: 0, CategoryID: 1, + }, + // 0000005A0001 + { + MainID: 0x0000005A, Unk1: 0, CategoryID: 1, + }, + // 000000590001 + { + MainID: 0x00000059, Unk1: 0, CategoryID: 1, + }, + // 000000580001 + { + MainID: 0x00000058, Unk1: 0, CategoryID: 1, + }, + // 000000570001 + { + MainID: 0x00000057, Unk1: 0, CategoryID: 1, + }, + // 000000560001 + { + MainID: 0x00000056, Unk1: 0, CategoryID: 1, + }, + // 000000550001 + { + MainID: 0x00000055, Unk1: 0, CategoryID: 1, + }, + // 000000540001 + { + MainID: 0x00000054, Unk1: 0, CategoryID: 1, + }, + // 000000530001 + { + MainID: 0x00000053, Unk1: 0, CategoryID: 1, + }, + // 000000520001 + { + MainID: 0x00000052, Unk1: 0, CategoryID: 1, + }, + // 000000570103 + { + MainID: 0x00000057, Unk1: 1, CategoryID: 3, + }, + // 000000580103 + { + MainID: 0x00000058, Unk1: 1, CategoryID: 3, + }, + // 000000590103 + { + MainID: 0x00000059, Unk1: 1, CategoryID: 3, + }, + // 0000005A0103 + { + MainID: 0x0000005A, Unk1: 1, CategoryID: 3, + }, + // 0000005B0103 + { + MainID: 0x0000005B, Unk1: 1, CategoryID: 3, + }, + // 0000005C0103 + { + MainID: 0x0000005C, Unk1: 1, CategoryID: 3, + }, + // 000000530103 + { + MainID: 0x00000053, Unk1: 1, CategoryID: 3, + }, + // 000000560103 + { + MainID: 0x00000056, Unk1: 1, CategoryID: 3, + }, + // 0000003C0103 + { + MainID: 0x0000003C, Unk1: 1, CategoryID: 3, + }, + // 0000003A0103 + { + MainID: 0x0000003A, Unk1: 1, CategoryID: 3, + }, + // 0000003B0103 + { + MainID: 0x0000003B, Unk1: 1, CategoryID: 3, + }, + // 0000001B0103 + { + MainID: 0x0000001B, Unk1: 1, CategoryID: 3, + }, + // 000000190103 + { + MainID: 0x00000019, Unk1: 1, CategoryID: 3, + }, + // 0000001A0103 + { + MainID: 0x0000001A, Unk1: 1, CategoryID: 3, + }, + // 000000170103 + { + MainID: 0x00000017, Unk1: 1, CategoryID: 3, + }, + // 000000020103 + { + MainID: 0x00000002, Unk1: 1, CategoryID: 3, + }, + // 000000030103 + { + MainID: 0x00000003, Unk1: 1, CategoryID: 3, + }, + // 000000040103 + { + MainID: 0x00000004, Unk1: 1, CategoryID: 3, + }, + // 0000001F0103 + { + MainID: 0x0000001F, Unk1: 1, CategoryID: 3, + }, + // 000000200103 + { + MainID: 0x00000020, Unk1: 1, CategoryID: 3, + }, + // 000000210103 + { + MainID: 0x00000021, Unk1: 1, CategoryID: 3, + }, + // 000000220103 + { + MainID: 0x00000022, Unk1: 1, CategoryID: 3, + }, + // 000000230103 + { + MainID: 0x00000023, Unk1: 1, CategoryID: 3, + }, + // 000000240103 + { + MainID: 0x00000024, Unk1: 1, CategoryID: 3, + }, + // 000000250103 + { + MainID: 0x00000025, Unk1: 1, CategoryID: 3, + }, + // 000000280103 + { + MainID: 0x00000028, Unk1: 1, CategoryID: 3, + }, + // 000000260103 + { + MainID: 0x00000026, Unk1: 1, CategoryID: 3, + }, + // 000000270103 + { + MainID: 0x00000027, Unk1: 1, CategoryID: 3, + }, + // 000000300103 + { + MainID: 0x00000030, Unk1: 1, CategoryID: 3, + }, + // 0000000C0103 + { + MainID: 0x0000000C, Unk1: 1, CategoryID: 3, + }, + // 0000000D0103 + { + MainID: 0x0000000D, Unk1: 1, CategoryID: 3, + }, + // 0000001E0103 + { + MainID: 0x0000001E, Unk1: 1, CategoryID: 3, + }, + // 0000001D0103 + { + MainID: 0x0000001D, Unk1: 1, CategoryID: 3, + }, + // 0000002E0003 + { + MainID: 0x0000002E, Unk1: 0, CategoryID: 3, + }, + // 000000000004 + { + MainID: 0x00000000, Unk1: 0, CategoryID: 4, + }, + // 000000010004 + { + MainID: 0x00000001, Unk1: 0, CategoryID: 4, + }, + // 000000020004 + { + MainID: 0x00000002, Unk1: 0, CategoryID: 4, + }, + // 000000030004 + { + MainID: 0x00000003, Unk1: 0, CategoryID: 4, + }, + // 000000040004 + { + MainID: 0x00000004, Unk1: 0, CategoryID: 4, + }, + // 000000050004 + { + MainID: 0x00000005, Unk1: 0, CategoryID: 4, + }, + // 000000060004 + { + MainID: 0x00000006, Unk1: 0, CategoryID: 4, + }, + // 000000070004 + { + MainID: 0x00000007, Unk1: 0, CategoryID: 4, + }, + // 000000080004 + { + MainID: 0x00000008, Unk1: 0, CategoryID: 4, + }, + // 000000090004 + { + MainID: 0x00000009, Unk1: 0, CategoryID: 4, + }, + // 0000000A0004 + { + MainID: 0x0000000A, Unk1: 0, CategoryID: 4, + }, + // 0000000B0004 + { + MainID: 0x0000000B, Unk1: 0, CategoryID: 4, + }, + // 0000000C0004 + { + MainID: 0x0000000C, Unk1: 0, CategoryID: 4, + }, + // 0000000D0004 + { + MainID: 0x0000000D, Unk1: 0, CategoryID: 4, + }, + // 0000000E0004 + { + MainID: 0x0000000E, Unk1: 0, CategoryID: 4, + }, + // 000000320005 + { + MainID: 0x00000032, Unk1: 0, CategoryID: 5, + }, + // 000000330005 + { + MainID: 0x00000033, Unk1: 0, CategoryID: 5, + }, + // 000000340005 + { + MainID: 0x00000034, Unk1: 0, CategoryID: 5, + }, + // 000000350005 + { + MainID: 0x00000035, Unk1: 0, CategoryID: 5, + }, + // 000000360005 + { + MainID: 0x00000036, Unk1: 0, CategoryID: 5, + }, + // 000000370005 + { + MainID: 0x00000037, Unk1: 0, CategoryID: 5, + }, + // 000000380005 + { + MainID: 0x00000038, Unk1: 0, CategoryID: 5, + }, + // 0000003A0005 + { + MainID: 0x0000003A, Unk1: 0, CategoryID: 5, + }, + // 0000003F0005 + { + MainID: 0x0000003F, Unk1: 0, CategoryID: 5, + }, + // 000000400005 + { + MainID: 0x00000040, Unk1: 0, CategoryID: 5, + }, + // 000000410005 + { + MainID: 0x00000041, Unk1: 0, CategoryID: 5, + }, + // 000000430005 + { + MainID: 0x00000043, Unk1: 0, CategoryID: 5, + }, + // 000000470005 + { + MainID: 0x00000047, Unk1: 0, CategoryID: 5, + }, + // 0000004B0005 + { + MainID: 0x0000004B, Unk1: 0, CategoryID: 5, + }, + // 0000003D0005 + { + MainID: 0x0000003D, Unk1: 0, CategoryID: 5, + }, + // 000000440005 + { + MainID: 0x00000044, Unk1: 0, CategoryID: 5, + }, + // 000000420005 + { + MainID: 0x00000042, Unk1: 0, CategoryID: 5, + }, + // 0000004C0005 + { + MainID: 0x0000004C, Unk1: 0, CategoryID: 5, + }, + // 000000460005 + { + MainID: 0x00000046, Unk1: 0, CategoryID: 5, + }, + // 0000004D0005 + { + MainID: 0x0000004D, Unk1: 0, CategoryID: 5, + }, + // 000000480005 + { + MainID: 0x00000048, Unk1: 0, CategoryID: 5, + }, + // 0000004A0005 + { + MainID: 0x0000004A, Unk1: 0, CategoryID: 5, + }, + // 000000490005 + { + MainID: 0x00000049, Unk1: 0, CategoryID: 5, + }, + // 0000004E0005 + { + MainID: 0x0000004E, Unk1: 0, CategoryID: 5, + }, + // 000000450005 + { + MainID: 0x00000045, Unk1: 0, CategoryID: 5, + }, + // 0000003E0005 + { + MainID: 0x0000003E, Unk1: 0, CategoryID: 5, + }, + // 0000004F0005 + { + MainID: 0x0000004F, Unk1: 0, CategoryID: 5, + }, + // 000000000106 + { + MainID: 0x00000000, Unk1: 1, CategoryID: 6, + }, + // 000000010106 + { + MainID: 0x00000001, Unk1: 1, CategoryID: 6, + }, + // 000000020106 + { + MainID: 0x00000002, Unk1: 1, CategoryID: 6, + }, + // 000000030106 + { + MainID: 0x00000003, Unk1: 1, CategoryID: 6, + }, + // 000000040106 + { + MainID: 0x00000004, Unk1: 1, CategoryID: 6, + }, + // 000000050106 + { + MainID: 0x00000005, Unk1: 1, CategoryID: 6, + }, + // 000000060106 + { + MainID: 0x00000006, Unk1: 1, CategoryID: 6, + }, + // 000000070106 + { + MainID: 0x00000007, Unk1: 1, CategoryID: 6, + }, + // 000000080106 + { + MainID: 0x00000008, Unk1: 1, CategoryID: 6, + }, + // 000000090106 + { + MainID: 0x00000009, Unk1: 1, CategoryID: 6, + }, + // 000000110106 + { + MainID: 0x00000011, Unk1: 1, CategoryID: 6, + }, + // 0000000A0106 + { + MainID: 0x0000000A, Unk1: 1, CategoryID: 6, + }, + // 0000000B0106 + { + MainID: 0x0000000B, Unk1: 1, CategoryID: 6, + }, + // 0000000C0106 + { + MainID: 0x0000000C, Unk1: 1, CategoryID: 6, + }, + // 0000000D0106 + { + MainID: 0x0000000D, Unk1: 1, CategoryID: 6, + }, + // 0000000E0106 + { + MainID: 0x0000000E, Unk1: 1, CategoryID: 6, + }, + // 0000000F0106 + { + MainID: 0x0000000F, Unk1: 1, CategoryID: 6, + }, + // 000000100106 + { + MainID: 0x00000010, Unk1: 1, CategoryID: 6, + }, + // 000000320107 + { + MainID: 0x00000032, Unk1: 1, CategoryID: 7, + }, + // 000000350107 + { + MainID: 0x00000035, Unk1: 1, CategoryID: 7, + }, + // 0000003E0107 + { + MainID: 0x0000003E, Unk1: 1, CategoryID: 7, + }, + // 000000340107 + { + MainID: 0x00000034, Unk1: 1, CategoryID: 7, + }, + // 000000380107 + { + MainID: 0x00000038, Unk1: 1, CategoryID: 7, + }, + // 000000330107 + { + MainID: 0x00000033, Unk1: 1, CategoryID: 7, + }, + // 000000310107 + { + MainID: 0x00000031, Unk1: 1, CategoryID: 7, + }, + // 000000360107 + { + MainID: 0x00000036, Unk1: 1, CategoryID: 7, + }, + // 000000390107 + { + MainID: 0x00000039, Unk1: 1, CategoryID: 7, + }, + // 000000370107 + { + MainID: 0x00000037, Unk1: 1, CategoryID: 7, + }, + // 0000003D0107 + { + MainID: 0x0000003D, Unk1: 1, CategoryID: 7, + }, + // 0000003A0107 + { + MainID: 0x0000003A, Unk1: 1, CategoryID: 7, + }, + // 0000003C0107 + { + MainID: 0x0000003C, Unk1: 1, CategoryID: 7, + }, + // 0000003B0107 + { + MainID: 0x0000003B, Unk1: 1, CategoryID: 7, + }, + // 0000002A0107 + { + MainID: 0x0000002A, Unk1: 1, CategoryID: 7, + }, + // 000000300107 + { + MainID: 0x00000030, Unk1: 1, CategoryID: 7, + }, + // 000000280107 + { + MainID: 0x00000028, Unk1: 1, CategoryID: 7, + }, + // 000000270107 + { + MainID: 0x00000027, Unk1: 1, CategoryID: 7, + }, + // 0000002B0107 + { + MainID: 0x0000002B, Unk1: 1, CategoryID: 7, + }, + // 0000002E0107 + { + MainID: 0x0000002E, Unk1: 1, CategoryID: 7, + }, + // 000000290107 + { + MainID: 0x00000029, Unk1: 1, CategoryID: 7, + }, + // 0000002C0107 + { + MainID: 0x0000002C, Unk1: 1, CategoryID: 7, + }, + // 0000002D0107 + { + MainID: 0x0000002D, Unk1: 1, CategoryID: 7, + }, + // 0000002F0107 + { + MainID: 0x0000002F, Unk1: 1, CategoryID: 7, + }, + // 000000250107 + { + MainID: 0x00000025, Unk1: 1, CategoryID: 7, + }, + // 000000220107 + { + MainID: 0x00000022, Unk1: 1, CategoryID: 7, + }, + // 000000210107 + { + MainID: 0x00000021, Unk1: 1, CategoryID: 7, + }, + // 000000200107 + { + MainID: 0x00000020, Unk1: 1, CategoryID: 7, + }, + // 0000001C0107 + { + MainID: 0x0000001C, Unk1: 1, CategoryID: 7, + }, + // 0000001A0107 + { + MainID: 0x0000001A, Unk1: 1, CategoryID: 7, + }, + // 000000240107 + { + MainID: 0x00000024, Unk1: 1, CategoryID: 7, + }, + // 000000260107 + { + MainID: 0x00000026, Unk1: 1, CategoryID: 7, + }, + // 000000230107 + { + MainID: 0x00000023, Unk1: 1, CategoryID: 7, + }, + // 0000001B0107 + { + MainID: 0x0000001B, Unk1: 1, CategoryID: 7, + }, + // 0000001E0107 + { + MainID: 0x0000001E, Unk1: 1, CategoryID: 7, + }, + // 0000001F0107 + { + MainID: 0x0000001F, Unk1: 1, CategoryID: 7, + }, + // 0000001D0107 + { + MainID: 0x0000001D, Unk1: 1, CategoryID: 7, + }, + // 000000180107 + { + MainID: 0x00000018, Unk1: 1, CategoryID: 7, + }, + // 000000170107 + { + MainID: 0x00000017, Unk1: 1, CategoryID: 7, + }, + // 000000160107 + { + MainID: 0x00000016, Unk1: 1, CategoryID: 7, + }, + // 000000150107 + // Missing file + // { + // MainID: 0x00000015, Unk1: 1, CategoryID: 7, + // }, + // 000000190107 + { + MainID: 0x00000019, Unk1: 1, CategoryID: 7, + }, + // 000000140107 + // Missing file + // { + // MainID: 0x00000014, Unk1: 1, CategoryID: 7, + // }, + // 000000070107 + // Missing file + // { + // MainID: 0x00000007, Unk1: 1, CategoryID: 7, + // }, + // 000000090107 + // Missing file + // { + // MainID: 0x00000009, Unk1: 1, CategoryID: 7, + // }, + // 0000000D0107 + // Missing file + // { + // MainID: 0x0000000D, Unk1: 1, CategoryID: 7, + // }, + // 000000100107 + // Missing file + // { + // MainID: 0x00000010, Unk1: 1, CategoryID: 7, + // }, + // 0000000C0107 + // Missing file + // { + // MainID: 0x0000000C, Unk1: 1, CategoryID: 7, + // }, + // 0000000E0107 + // Missing file + // { + // MainID: 0x0000000E, Unk1: 1, CategoryID: 7, + // }, + // 0000000F0107 + // Missing file + // { + // MainID: 0x0000000F, Unk1: 1, CategoryID: 7, + // }, + // 000000130107 + // Missing file + // { + // MainID: 0x00000013, Unk1: 1, CategoryID: 7, + // }, + // 0000000A0107 + // Missing file + // { + // MainID: 0x0000000A, Unk1: 1, CategoryID: 7, + // }, + // 000000080107 + // Missing file + // { + // MainID: 0x00000008, Unk1: 1, CategoryID: 7, + // }, + // 0000000B0107 + // Missing file + // { + // MainID: 0x0000000B, Unk1: 1, CategoryID: 7, + // }, + // 000000120107 + // Missing file + // { + // MainID: 0x00000012, Unk1: 1, CategoryID: 7, + // }, + // 000000110107 + // Missing file + // { + // MainID: 0x00000011, Unk1: 1, CategoryID: 7, + // }, + // 000000060107 + // Missing file + // { + // MainID: 0x00000006, Unk1: 1, CategoryID: 7, + // }, + // 000000050107 + // Missing file + // { + // MainID: 0x00000005, Unk1: 1, CategoryID: 7, + // }, + // 000000040107 + // Missing file + // { + // MainID: 0x00000004, Unk1: 1, CategoryID: 7, + // }, + // 000000030107 + { + MainID: 0x00000003, Unk1: 1, CategoryID: 7, + }, + // 000000020107 + { + MainID: 0x00000002, Unk1: 1, CategoryID: 7, + }, + // 000000010107 + { + MainID: 0x00000001, Unk1: 1, CategoryID: 7, + }, + // 000000000107 + { + MainID: 0x00000000, Unk1: 1, CategoryID: 7, + }, } resp := byteframe.NewByteFrame() diff --git a/Erupe/server/channelserver/handlers_achievement.go b/server/channelserver/handlers_achievement.go similarity index 100% rename from Erupe/server/channelserver/handlers_achievement.go rename to server/channelserver/handlers_achievement.go diff --git a/Erupe/server/channelserver/handlers_campaign.go b/server/channelserver/handlers_campaign.go similarity index 100% rename from Erupe/server/channelserver/handlers_campaign.go rename to server/channelserver/handlers_campaign.go diff --git a/Erupe/server/channelserver/handlers_caravan.go b/server/channelserver/handlers_caravan.go similarity index 100% rename from Erupe/server/channelserver/handlers_caravan.go rename to server/channelserver/handlers_caravan.go diff --git a/Erupe/server/channelserver/handlers_cast_binary.go b/server/channelserver/handlers_cast_binary.go similarity index 88% rename from Erupe/server/channelserver/handlers_cast_binary.go rename to server/channelserver/handlers_cast_binary.go index dd4fd9165..304369295 100644 --- a/Erupe/server/channelserver/handlers_cast_binary.go +++ b/server/channelserver/handlers_cast_binary.go @@ -2,9 +2,9 @@ package channelserver import ( "fmt" - "strings" "math" "math/rand" + "strings" "time" "erupe-ce/common/byteframe" @@ -22,10 +22,10 @@ const ( // MSG_SYS_CAST[ED]_BINARY broadcast types enum const ( - BroadcastTypeTargeted = 0x01 - BroadcastTypeStage = 0x03 - BroadcastTypeSemaphore = 0x06 - BroadcastTypeWorld = 0x0a + BroadcastTypeTargeted = 0x01 + BroadcastTypeStage = 0x03 + BroadcastTypeServer = 0x06 + BroadcastTypeWorld = 0x0a ) func sendServerChatMessage(s *Session, message string) { @@ -56,12 +56,12 @@ func handleMsgSysCastBinary(s *Session, p mhfpacket.MHFPacket) { if pkt.BroadcastType == 0x03 && pkt.MessageType == 0x03 && len(pkt.RawDataPayload) == 0x10 { if tmp.ReadUint16() == 0x0002 && tmp.ReadUint8() == 0x18 { - _ = tmp.ReadBytes(9) - tmp.SetLE() - frame := tmp.ReadUint32() - sendServerChatMessage(s, fmt.Sprintf("TIME : %d'%d.%03d (%dframe)", frame/30/60, frame/30%60, int(math.Round(float64(frame%30*100)/3)), frame)) - } - } + _ = tmp.ReadBytes(9) + tmp.SetLE() + frame := tmp.ReadUint32() + sendServerChatMessage(s, fmt.Sprintf("TIME : %d'%d.%03d (%dframe)", frame/30/60, frame/30%60, int(math.Round(float64(frame%30*100)/3)), frame)) + } + } // Parse out the real casted binary payload var msgBinTargeted *binpacket.MsgBinTargeted @@ -100,7 +100,7 @@ func handleMsgSysCastBinary(s *Session, p mhfpacket.MHFPacket) { roll.WriteUint16(authorLen) rand.Seed(time.Now().UnixNano()) dice := fmt.Sprintf("%d", rand.Intn(100)+1) - roll.WriteUint16(uint16(len(dice)+1)) + roll.WriteUint16(uint16(len(dice) + 1)) roll.WriteNullTerminatedBytes([]byte(dice)) roll.WriteNullTerminatedBytes(tmp.ReadNullTerminatedBytes()) realPayload = roll.Data() @@ -118,30 +118,21 @@ func handleMsgSysCastBinary(s *Session, p mhfpacket.MHFPacket) { // Send to the proper recipients. switch pkt.BroadcastType { case BroadcastTypeWorld: - s.server.WorldcastMHF(resp, s) + s.server.WorldcastMHF(resp, s, nil) case BroadcastTypeStage: if isDiceCommand { s.stage.BroadcastMHF(resp, nil) // send dice result back to caller } else { s.stage.BroadcastMHF(resp, s) } - case BroadcastTypeSemaphore: + case BroadcastTypeServer: if pkt.MessageType == 1 { - var session *Semaphore - if _, exists := s.server.semaphore["hs_l0u3B51J9k3"]; exists { - session = s.server.semaphore["hs_l0u3B51J9k3"] - } else if _, exists := s.server.semaphore["hs_l0u3B5129k3"]; exists { - session = s.server.semaphore["hs_l0u3B5129k3"] - } else if _, exists := s.server.semaphore["hs_l0u3B512Ak3"]; exists { - session = s.server.semaphore["hs_l0u3B512Ak3"] + raviSema := getRaviSemaphore(s) + if raviSema != "" { + s.server.BroadcastMHF(resp, s) } - (*session).BroadcastMHF(resp, s) } else { - s.Lock() - if s.stage != nil { - s.stage.BroadcastMHF(resp, s) - } - s.Unlock() + s.server.BroadcastMHF(resp, s) } case BroadcastTypeTargeted: for _, targetID := range (*msgBinTargeted).TargetCharIDs { @@ -194,7 +185,7 @@ func handleMsgSysCastBinary(s *Session, p mhfpacket.MHFPacket) { // RAVI COMMANDS V2 if strings.HasPrefix(chatMessage.Message, "!ravi") { - if checkRaviSemaphore(s) { + if getRaviSemaphore(s) != "" { s.server.raviente.Lock() if !strings.HasPrefix(chatMessage.Message, "!ravi ") { sendServerChatMessage(s, "No Raviente command specified!") @@ -203,7 +194,7 @@ func handleMsgSysCastBinary(s *Session, p mhfpacket.MHFPacket) { if s.server.raviente.register.startTime == 0 { s.server.raviente.register.startTime = s.server.raviente.register.postTime sendServerChatMessage(s, "The Great Slaying will begin in a moment") - s.notifyall() + s.notifyRavi() } else { sendServerChatMessage(s, "The Great Slaying has already begun!") } @@ -213,9 +204,9 @@ func handleMsgSysCastBinary(s *Session, p mhfpacket.MHFPacket) { if numerr != nil || n != 1 { sendServerChatMessage(s, "Error in command. Format: !ravi sm n") } else if s.server.raviente.state.damageMultiplier == 1 { - if num > 65535 { - sendServerChatMessage(s, "Raviente multiplier too high, defaulting to 20x") - s.server.raviente.state.damageMultiplier = 65535 + if num > 32 { + sendServerChatMessage(s, "Raviente multiplier too high, defaulting to 32x") + s.server.raviente.state.damageMultiplier = 32 } else { sendServerChatMessage(s, fmt.Sprintf("Raviente multiplier set to %dx", num)) s.server.raviente.state.damageMultiplier = uint32(num) @@ -246,10 +237,10 @@ func handleMsgSysCastBinary(s *Session, p mhfpacket.MHFPacket) { sendServerChatMessage(s, "Raviente command not recognised!") } } + s.server.raviente.Unlock() } else { sendServerChatMessage(s, "No one has joined the Great Slaying!") } - s.server.raviente.Unlock() } // END RAVI COMMANDS V2 diff --git a/Erupe/server/channelserver/handlers_character.go b/server/channelserver/handlers_character.go similarity index 100% rename from Erupe/server/channelserver/handlers_character.go rename to server/channelserver/handlers_character.go diff --git a/Erupe/server/channelserver/handlers_clients.go b/server/channelserver/handlers_clients.go similarity index 96% rename from Erupe/server/channelserver/handlers_clients.go rename to server/channelserver/handlers_clients.go index 611cd1239..12e8540b3 100644 --- a/Erupe/server/channelserver/handlers_clients.go +++ b/server/channelserver/handlers_clients.go @@ -24,7 +24,11 @@ func handleMsgSysEnumerateClient(s *Session, p mhfpacket.MHFPacket) { resp := byteframe.NewByteFrame() stage.RLock() var clients []uint32 - switch pkt.Unk1 { + switch pkt.Get { + case 0: // All + for _, cid := range stage.clients { + clients = append(clients, cid) + } case 1: // Not ready for cid, ready := range stage.reservedClientSlots { if !ready { diff --git a/Erupe/server/channelserver/handlers_data.go b/server/channelserver/handlers_data.go similarity index 92% rename from Erupe/server/channelserver/handlers_data.go rename to server/channelserver/handlers_data.go index 9d1bf0c6a..1f18fe262 100644 --- a/Erupe/server/channelserver/handlers_data.go +++ b/server/channelserver/handlers_data.go @@ -3,7 +3,9 @@ package channelserver import ( "encoding/binary" "encoding/hex" + "erupe-ce/common/stringsupport" "fmt" + "io" "io/ioutil" "os" "path/filepath" @@ -131,29 +133,140 @@ func grpToGR(n uint32) uint16 { } } } - gr = uint16(i + 2); break + gr = uint16(i + 2) + break case grp < 593400: // 51-99 - grp -= 208750; i := 51; for { if grp < 7850 {break}; i++; grp -= 7850 }; gr = uint16(i); break + grp -= 208750 + i := 51 + for { + if grp < 7850 { + break + } + i++ + grp -= 7850 + } + gr = uint16(i) + break case grp < 993400: // 100-149 - grp -= 593400; i := 100; for { if grp < 8000 {break}; i++; grp -= 8000 }; gr = uint16(i); break + grp -= 593400 + i := 100 + for { + if grp < 8000 { + break + } + i++ + grp -= 8000 + } + gr = uint16(i) + break case grp < 1400900: // 150-199 - grp -= 993400; i := 150; for { if grp < 8150 {break}; i++; grp -= 8150 }; gr = uint16(i); break + grp -= 993400 + i := 150 + for { + if grp < 8150 { + break + } + i++ + grp -= 8150 + } + gr = uint16(i) + break case grp < 2315900: // 200-299 - grp -= 1400900; i := 200; for { if grp < 9150 {break}; i++; grp -= 9150 }; gr = uint16(i); break + grp -= 1400900 + i := 200 + for { + if grp < 9150 { + break + } + i++ + grp -= 9150 + } + gr = uint16(i) + break case grp < 3340900: // 300-399 - grp -= 2315900; i := 300; for { if grp < 10250 {break}; i++; grp -= 10250 }; gr = uint16(i); break + grp -= 2315900 + i := 300 + for { + if grp < 10250 { + break + } + i++ + grp -= 10250 + } + gr = uint16(i) + break case grp < 4505900: // 400-499 - grp -= 3340900; i := 400; for { if grp < 11650 {break}; i++; grp -= 11650 }; gr = uint16(i); break + grp -= 3340900 + i := 400 + for { + if grp < 11650 { + break + } + i++ + grp -= 11650 + } + gr = uint16(i) + break case grp < 5850900: // 500-599 - grp -= 4505900; i := 500; for { if grp < 13450 {break}; i++; grp -= 13450 }; gr = uint16(i); break + grp -= 4505900 + i := 500 + for { + if grp < 13450 { + break + } + i++ + grp -= 13450 + } + gr = uint16(i) + break case grp < 7415900: // 600-699 - grp -= 5850900; i := 600; for { if grp < 15650 {break}; i++; grp -= 15650 }; gr = uint16(i); break + grp -= 5850900 + i := 600 + for { + if grp < 15650 { + break + } + i++ + grp -= 15650 + } + gr = uint16(i) + break case grp < 9230900: // 700-799 - grp -= 7415900; i := 700; for { if grp < 18150 {break}; i++; grp -= 18150 }; gr = uint16(i); break + grp -= 7415900 + i := 700 + for { + if grp < 18150 { + break + } + i++ + grp -= 18150 + } + gr = uint16(i) + break case grp < 11345900: // 800-899 - grp -= 9230900; i := 800; for { if grp < 21150 {break}; i++; grp -= 21150 }; gr = uint16(i); break + grp -= 9230900 + i := 800 + for { + if grp < 21150 { + break + } + i++ + grp -= 21150 + } + gr = uint16(i) + break default: // 900+ - grp -= 11345900; i := 900; for { if grp < 23950 {break}; i++; grp -= 23950 }; gr = uint16(i); break + grp -= 11345900 + i := 900 + for { + if grp < 23950 { + break + } + i++ + grp -= 23950 + } + gr = uint16(i) + break } return gr } @@ -162,8 +275,8 @@ func dumpSaveData(s *Session, data []byte, suffix string) { if !s.server.erupeConfig.DevModeOptions.SaveDumps.Enabled { return } else { - dir := filepath.Join(s.server.erupeConfig.DevModeOptions.SaveDumps.OutputDir, fmt.Sprintf("%s_",s.Name)) - path := filepath.Join(s.server.erupeConfig.DevModeOptions.SaveDumps.OutputDir, fmt.Sprintf("%s_",s.Name), fmt.Sprintf("%d_%s_%s%s.bin", s.charID, s.Name, Time_Current().Format("2006-01-02_15.04.05"), suffix)) + dir := filepath.Join(s.server.erupeConfig.DevModeOptions.SaveDumps.OutputDir, fmt.Sprintf("%s_", s.Name)) + path := filepath.Join(s.server.erupeConfig.DevModeOptions.SaveDumps.OutputDir, fmt.Sprintf("%s_", s.Name), fmt.Sprintf("%d_%s_%s%s.bin", s.charID, s.Name, Time_Current().Format("2006-01-02_15.04.05"), suffix)) if _, err := os.Stat(dir); os.IsNotExist(err) { os.Mkdir(dir, os.ModeDir) @@ -177,34 +290,39 @@ func dumpSaveData(s *Session, data []byte, suffix string) { func handleMsgMhfLoaddata(s *Session, p mhfpacket.MHFPacket) { pkt := p.(*mhfpacket.MsgMhfLoaddata) - overrideFile := filepath.Join(".", "bin", "save_override.bin") - var data []byte - - if _, err := os.Stat(overrideFile); err == nil { - file, err := os.Open(overrideFile) - if err != nil { - panic(err) - } - data, err := ioutil.ReadAll(file) - if err != nil { - panic(err) - } + if _, err := os.Stat(filepath.Join(s.server.erupeConfig.BinPath, "save_override.bin")); err == nil { + data, _ := ioutil.ReadFile(filepath.Join(s.server.erupeConfig.BinPath, "save_override.bin")) doAckBufSucceed(s, pkt.AckHandle, data) + return } + var data []byte + err := s.server.db.QueryRow("SELECT savedata FROM characters WHERE id = $1", s.charID).Scan(&data) if err != nil { s.logger.Fatal("Failed to get savedata from db", zap.Error(err)) } doAckBufSucceed(s, pkt.AckHandle, data) + + decompSaveData, err := nullcomp.Decompress(data) + if err != nil { + s.logger.Error("Failed to decompress savedata", zap.Error(err)) + } + bf := byteframe.NewByteFrameFromBytes(decompSaveData) + bf.Seek(88, io.SeekStart) + binary1 := bf.ReadNullTerminatedBytes() + s.server.userBinaryPartsLock.Lock() + s.server.userBinaryParts[userBinaryPartID{charID: s.charID, index: 1}] = append(binary1, []byte{0x00}...) + s.server.userBinaryPartsLock.Unlock() + s.Name = stringsupport.SJISToUTF8(binary1) } func handleMsgMhfSaveScenarioData(s *Session, p mhfpacket.MHFPacket) { pkt := p.(*mhfpacket.MsgMhfSaveScenarioData) _, err := s.server.db.Exec("UPDATE characters SET scenariodata = $1 WHERE characters.id = $2", pkt.RawDataPayload, int(s.charID)) - if err != nil { - s.logger.Fatal("Failed to update scenario data in db", zap.Error(err)) - } + if err != nil { + s.logger.Fatal("Failed to update scenario data in db", zap.Error(err)) + } // Do this ack manually because it uses a non-(0|1) error code s.QueueSendMHF(&mhfpacket.MsgSysAck{ AckHandle: pkt.AckHandle, diff --git a/Erupe/server/channelserver/handlers_discord.go b/server/channelserver/handlers_discord.go similarity index 100% rename from Erupe/server/channelserver/handlers_discord.go rename to server/channelserver/handlers_discord.go diff --git a/Erupe/server/channelserver/handlers_distitem.go b/server/channelserver/handlers_distitem.go similarity index 95% rename from Erupe/server/channelserver/handlers_distitem.go rename to server/channelserver/handlers_distitem.go index b6b64f9b2..91c980cff 100644 --- a/Erupe/server/channelserver/handlers_distitem.go +++ b/server/channelserver/handlers_distitem.go @@ -1,9 +1,9 @@ package channelserver import ( - "erupe-ce/network/mhfpacket" - ps "erupe-ce/common/pascalstring" "erupe-ce/common/byteframe" + ps "erupe-ce/common/pascalstring" + "erupe-ce/network/mhfpacket" "go.uber.org/zap" ) @@ -24,7 +24,7 @@ type ItemDist struct { } func handleMsgMhfEnumerateDistItem(s *Session, p mhfpacket.MHFPacket) { - pkt := p.(*mhfpacket.MsgMhfEnumerateDistItem) + pkt := p.(*mhfpacket.MsgMhfEnumerateDistItem) bf := byteframe.NewByteFrame() distCount := 0 dists, err := s.server.db.Queryx(` @@ -82,9 +82,9 @@ func handleMsgMhfEnumerateDistItem(s *Session, p mhfpacket.MHFPacket) { func handleMsgMhfApplyDistItem(s *Session, p mhfpacket.MHFPacket) { pkt := p.(*mhfpacket.MsgMhfApplyDistItem) - if pkt.DistributionID == 0 { - doAckBufSucceed(s, pkt.AckHandle, make([]byte, 6)) - } else { + if pkt.DistributionID == 0 { + doAckBufSucceed(s, pkt.AckHandle, make([]byte, 6)) + } else { row := s.server.db.QueryRowx("SELECT data FROM distribution WHERE id = $1", pkt.DistributionID) dist := &ItemDist{} err := row.StructScan(dist) @@ -97,7 +97,7 @@ func handleMsgMhfApplyDistItem(s *Session, p mhfpacket.MHFPacket) { bf := byteframe.NewByteFrame() bf.WriteUint32(pkt.DistributionID) bf.WriteBytes(dist.Data) - doAckBufSucceed(s, pkt.AckHandle, bf.Data()) + doAckBufSucceed(s, pkt.AckHandle, bf.Data()) _, err = s.server.db.Exec(` INSERT INTO public.distributions_accepted @@ -106,7 +106,7 @@ func handleMsgMhfApplyDistItem(s *Session, p mhfpacket.MHFPacket) { if err != nil { s.logger.Error("Error updating accepted dist count", zap.Error(err)) } - } + } } func handleMsgMhfAcquireDistItem(s *Session, p mhfpacket.MHFPacket) { diff --git a/Erupe/server/channelserver/handlers_diva.go b/server/channelserver/handlers_diva.go similarity index 100% rename from Erupe/server/channelserver/handlers_diva.go rename to server/channelserver/handlers_diva.go index 247653659..8927cd792 100644 --- a/Erupe/server/channelserver/handlers_diva.go +++ b/server/channelserver/handlers_diva.go @@ -3,8 +3,8 @@ package channelserver import ( "encoding/hex" - "erupe-ce/network/mhfpacket" "erupe-ce/common/byteframe" + "erupe-ce/network/mhfpacket" ) func handleMsgMhfGetKijuInfo(s *Session, p mhfpacket.MHFPacket) { diff --git a/Erupe/server/channelserver/handlers_event.go b/server/channelserver/handlers_event.go similarity index 99% rename from Erupe/server/channelserver/handlers_event.go rename to server/channelserver/handlers_event.go index 98bddbe3e..af16799c7 100644 --- a/Erupe/server/channelserver/handlers_event.go +++ b/server/channelserver/handlers_event.go @@ -66,7 +66,7 @@ func handleMsgMhfGetWeeklySchedule(s *Session, p mhfpacket.MHFPacket) { feat := generateActiveWeapons(14) // number of active weapons // TODO: only generate this once per restart (server should be restarted weekly) // then load data from db instead of regenerating - persistentEventSchedule[x+1] = activeFeature { + persistentEventSchedule[x+1] = activeFeature{ StartTime: Time_Current_Midnight().Add(time.Duration(24*x) * time.Hour), ActiveFeatures: uint32(feat), Unk1: 0, diff --git a/Erupe/server/channelserver/handlers_festa.go b/server/channelserver/handlers_festa.go similarity index 100% rename from Erupe/server/channelserver/handlers_festa.go rename to server/channelserver/handlers_festa.go diff --git a/Erupe/server/channelserver/handlers_guild.go b/server/channelserver/handlers_guild.go similarity index 92% rename from Erupe/server/channelserver/handlers_guild.go rename to server/channelserver/handlers_guild.go index 9051e8098..fcaddbaf9 100644 --- a/Erupe/server/channelserver/handlers_guild.go +++ b/server/channelserver/handlers_guild.go @@ -13,9 +13,8 @@ import ( "time" "erupe-ce/common/byteframe" - "erupe-ce/common/bfutil" - "erupe-ce/common/stringsupport" ps "erupe-ce/common/pascalstring" + "erupe-ce/common/stringsupport" "erupe-ce/network/mhfpacket" "github.com/jmoiron/sqlx" "go.uber.org/zap" @@ -55,6 +54,7 @@ type Guild struct { PugiName1 string `db:"pugi_name_1"` PugiName2 string `db:"pugi_name_2"` PugiName3 string `db:"pugi_name_3"` + Recruiting bool `db:"recruiting"` FestivalColour FestivalColour `db:"festival_colour"` Rank uint16 `db:"rank"` AllianceID uint32 `db:"alliance_id"` @@ -124,6 +124,7 @@ SELECT pugi_name_1, pugi_name_2, pugi_name_3, + recruiting, festival_colour, CASE WHEN rank_rp <= 48 THEN rank_rp/24 @@ -220,6 +221,30 @@ func (guild *Guild) Disband(s *Session) error { return err } + _, err = transaction.Exec("DELETE FROM guild_alliances WHERE parent_id=$1", guild.ID) + + if err != nil { + s.logger.Error("failed to remove guild alliance", zap.Error(err), zap.Uint32("guildID", guild.ID)) + rollbackTransaction(s, transaction) + return err + } + + _, err = transaction.Exec("UPDATE guild_alliances SET sub1_id=NULL WHERE sub1_id=$1", guild.ID) + + if err != nil { + s.logger.Error("failed to remove guild from alliance", zap.Error(err), zap.Uint32("guildID", guild.ID)) + rollbackTransaction(s, transaction) + return err + } + + _, err = transaction.Exec("UPDATE guild_alliances SET sub2_id=NULL WHERE sub2_id=$1", guild.ID) + + if err != nil { + s.logger.Error("failed to remove guild from alliance", zap.Error(err), zap.Uint32("guildID", guild.ID)) + rollbackTransaction(s, transaction) + return err + } + err = transaction.Commit() if err != nil { @@ -488,36 +513,6 @@ func rollbackTransaction(s *Session, transaction *sql.Tx) { } } -func FindGuildsByName(s *Session, name string) ([]*Guild, error) { - searchTerm := fmt.Sprintf("%%%s%%", name) - - rows, err := s.server.db.Queryx(fmt.Sprintf(` - %s - WHERE g.name ILIKE $1 - `, guildInfoSelectQuery), searchTerm) - - if err != nil { - s.logger.Error("failed to find guilds for search term", zap.Error(err), zap.String("searchTerm", name)) - return nil, err - } - - defer rows.Close() - - guilds := make([]*Guild, 0) - - for rows.Next() { - guild, err := buildGuildObjectFromDbResult(rows, err, s) - - if err != nil { - return nil, err - } - - guilds = append(guilds, guild) - } - - return guilds, nil -} - func GetGuildInfoByID(s *Session, guildID uint32) (*Guild, error) { rows, err := s.server.db.Queryx(fmt.Sprintf(` %s @@ -646,6 +641,8 @@ func handleMsgMhfOperateGuild(s *Session, p mhfpacket.MHFPacket) { } bf.WriteUint32(uint32(response)) + doAckSimpleSucceed(s, pkt.AckHandle, bf.Data()) + return case mhfpacket.OPERATE_GUILD_APPLY: err = guild.CreateApplication(s, s.charID, GuildApplicationTypeApplied, nil) @@ -655,6 +652,8 @@ func handleMsgMhfOperateGuild(s *Session, p mhfpacket.MHFPacket) { } else { bf.WriteUint32(guild.LeaderCharID) } + doAckSimpleSucceed(s, pkt.AckHandle, bf.Data()) + return case mhfpacket.OPERATE_GUILD_LEAVE: var err error @@ -671,86 +670,58 @@ func handleMsgMhfOperateGuild(s *Session, p mhfpacket.MHFPacket) { } bf.WriteUint32(uint32(response)) + doAckSimpleSucceed(s, pkt.AckHandle, bf.Data()) + return case mhfpacket.OPERATE_GUILD_DONATE_RANK: handleDonateRP(s, pkt, bf, guild, false) case mhfpacket.OPERATE_GUILD_SET_APPLICATION_DENY: - // TODO: close applications for guild - doAckSimpleSucceed(s, pkt.AckHandle, make([]byte, 4)) - return + s.server.db.Exec("UPDATE guilds SET recruiting=false WHERE id=$1", guild.ID) case mhfpacket.OPERATE_GUILD_SET_APPLICATION_ALLOW: - // TODO: open applications for guild - doAckSimpleSucceed(s, pkt.AckHandle, make([]byte, 4)) - return + s.server.db.Exec("UPDATE guilds SET recruiting=true WHERE id=$1", guild.ID) case mhfpacket.OPERATE_GUILD_SET_AVOID_LEADERSHIP_TRUE: handleAvoidLeadershipUpdate(s, pkt, true) case mhfpacket.OPERATE_GUILD_SET_AVOID_LEADERSHIP_FALSE: handleAvoidLeadershipUpdate(s, pkt, false) case mhfpacket.OPERATE_GUILD_UPDATE_COMMENT: pbf := byteframe.NewByteFrameFromBytes(pkt.UnkData) - if !characterGuildInfo.IsLeader && !characterGuildInfo.IsSubLeader() { doAckSimpleFail(s, pkt.AckHandle, make([]byte, 4)) return } - _ = pbf.ReadUint8() // len _ = pbf.ReadUint32() guild.Comment = stringsupport.SJISToUTF8(pbf.ReadNullTerminatedBytes()) - err = guild.Save(s) - if err != nil { - doAckSimpleFail(s, pkt.AckHandle, make([]byte, 4)) - return - } - - bf.WriteUint32(0x00) + guild.Save(s) case mhfpacket.OPERATE_GUILD_UPDATE_MOTTO: if !characterGuildInfo.IsLeader && !characterGuildInfo.IsSubLeader() { doAckSimpleFail(s, pkt.AckHandle, make([]byte, 4)) return } - guild.SubMotto = pkt.UnkData[3] guild.MainMotto = pkt.UnkData[4] - - err := guild.Save(s) - - if err != nil { - doAckSimpleFail(s, pkt.AckHandle, make([]byte, 4)) - return - } + guild.Save(s) case mhfpacket.OPERATE_GUILD_RENAME_PUGI_1: handleRenamePugi(s, pkt.UnkData, guild, 1) - doAckSimpleSucceed(s, pkt.AckHandle, make([]byte, 4)) - return case mhfpacket.OPERATE_GUILD_RENAME_PUGI_2: handleRenamePugi(s, pkt.UnkData, guild, 2) - doAckSimpleSucceed(s, pkt.AckHandle, make([]byte, 4)) - return case mhfpacket.OPERATE_GUILD_RENAME_PUGI_3: handleRenamePugi(s, pkt.UnkData, guild, 3) - doAckSimpleSucceed(s, pkt.AckHandle, make([]byte, 4)) - return case mhfpacket.OPERATE_GUILD_CHANGE_PUGI_1: - doAckSimpleSucceed(s, pkt.AckHandle, make([]byte, 4)) - return + // TODO: decode guild poogie outfits case mhfpacket.OPERATE_GUILD_CHANGE_PUGI_2: - doAckSimpleSucceed(s, pkt.AckHandle, make([]byte, 4)) - return case mhfpacket.OPERATE_GUILD_CHANGE_PUGI_3: - doAckSimpleSucceed(s, pkt.AckHandle, make([]byte, 4)) - return case mhfpacket.OPERATE_GUILD_DONATE_EVENT: handleDonateRP(s, pkt, bf, guild, true) default: panic(fmt.Sprintf("unhandled operate guild action '%d'", pkt.Action)) } - doAckSimpleSucceed(s, pkt.AckHandle, bf.Data()) + doAckSimpleSucceed(s, pkt.AckHandle, make([]byte, 4)) } func handleRenamePugi(s *Session, data []byte, guild *Guild, num int) { bf := byteframe.NewByteFrameFromBytes(data) - _ = bf.ReadUint8() // len + _ = bf.ReadUint8() // len _ = bf.ReadUint32() // unk name := stringsupport.SJISToUTF8(bf.ReadNullTerminatedBytes()) switch num { @@ -830,42 +801,45 @@ func handleMsgMhfOperateGuildMember(s *Session, p mhfpacket.MHFPacket) { return } - if pkt.Action == mhfpacket.OPERATE_GUILD_MEMBER_ACTION_ACCEPT || pkt.Action == mhfpacket.OPERATE_GUILD_MEMBER_ACTION_REJECT { - switch pkt.Action { - case mhfpacket.OPERATE_GUILD_MEMBER_ACTION_ACCEPT: - err = guild.AcceptApplication(s, pkt.CharID) - case mhfpacket.OPERATE_GUILD_MEMBER_ACTION_REJECT: - err = guild.RejectApplication(s, pkt.CharID) - } - - if err != nil { - doAckSimpleFail(s, pkt.AckHandle, nil) - } - - doAckSimpleSucceed(s, pkt.AckHandle, nil) - return - } - - character, err := GetCharacterGuildData(s, pkt.CharID) - - if err != nil || character == nil { - doAckSimpleFail(s, pkt.AckHandle, nil) - return - } - + var mail Mail switch pkt.Action { + case mhfpacket.OPERATE_GUILD_MEMBER_ACTION_ACCEPT: + err = guild.AcceptApplication(s, pkt.CharID) + mail = Mail{ + SenderID: s.charID, + RecipientID: pkt.CharID, + Subject: "Accepted!", + Body: fmt.Sprintf("Your application to join 「%s」 was accepted.", guild.Name), + IsGuildInvite: false, + } + case mhfpacket.OPERATE_GUILD_MEMBER_ACTION_REJECT: + err = guild.RejectApplication(s, pkt.CharID) + mail = Mail{ + SenderID: s.charID, + RecipientID: pkt.CharID, + Subject: "Rejected", + Body: fmt.Sprintf("Your application to join 「%s」 was rejected.", guild.Name), + IsGuildInvite: false, + } case mhfpacket.OPERATE_GUILD_MEMBER_ACTION_KICK: err = guild.RemoveCharacter(s, pkt.CharID) + mail = Mail{ + SenderID: s.charID, + RecipientID: pkt.CharID, + Subject: "Kicked", + Body: fmt.Sprintf("You were kicked from 「%s」.", guild.Name), + IsGuildInvite: false, + } default: doAckSimpleFail(s, pkt.AckHandle, nil) - panic(fmt.Sprintf("unhandled operateGuildMember action '%d'", pkt.Action)) + s.logger.Warn(fmt.Sprintf("unhandled operateGuildMember action '%d'", pkt.Action)) } if err != nil { doAckSimpleFail(s, pkt.AckHandle, nil) - return + } else { + mail.Send(s, nil) } - doAckSimpleSucceed(s, pkt.AckHandle, nil) } @@ -882,6 +856,8 @@ func handleMsgMhfInfoGuild(s *Session, p mhfpacket.MHFPacket) { } if err == nil && guild != nil { + s.prevGuildID = guild.ID + guildName := stringsupport.UTF8ToSJIS(guild.Name) guildComment := stringsupport.UTF8ToSJIS(guild.Comment) guildLeaderName := stringsupport.UTF8ToSJIS(guild.LeaderName) @@ -913,7 +889,9 @@ func handleMsgMhfInfoGuild(s *Session, p mhfpacket.MHFPacket) { bf.WriteUint8(guild.SubMotto) // Unk appears to be static - bf.WriteBytes([]byte{0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}) + bf.WriteBytes([]byte{0x00, 0x00, 0x00, 0x00, 0x00, 0x00}) + + bf.WriteBool(!guild.Recruiting) if characterGuildData == nil || characterGuildData.IsApplicant { bf.WriteUint16(0x00) @@ -1033,35 +1011,38 @@ func handleMsgMhfInfoGuild(s *Session, p mhfpacket.MHFPacket) { if err != nil { resp := byteframe.NewByteFrame() resp.WriteUint32(0) // Count - resp.WriteUint8(5) // Unk, read if count == 0. + resp.WriteUint8(0) // Unk, read if count == 0. doAckBufSucceed(s, pkt.AckHandle, resp.Data()) } - - bf.WriteUint16(uint16(len(applicants))) - - for _, applicant := range applicants { - bf.WriteUint32(applicant.CharID) - bf.WriteUint32(0x05) - bf.WriteUint16(0x0032) - bf.WriteUint8(0x00) - ps.Uint16(bf, applicant.Name, true) + if err != nil { + bf.WriteUint16(0) + } else { + bf.WriteUint16(uint16(len(applicants))) + for _, applicant := range applicants { + bf.WriteUint32(applicant.CharID) + bf.WriteUint16(0) + bf.WriteUint16(0) + bf.WriteUint16(applicant.HRP) + bf.WriteUint16(applicant.GR) + ps.Uint8(bf, applicant.Name, true) + } } bf.WriteUint16(0x0000) /* - alliance application format - uint16 numapplicants (above) + alliance application format + uint16 numapplicants (above) - uint32 guild id - uint32 guild leader id (for mail) - uint32 unk (always null in pcap) - uint16 unk (always 0001 in pcap) - uint16 len guild name - string nullterm guild name - uint16 len guild leader name - string nullterm guild leader name + uint32 guild id + uint32 guild leader id (for mail) + uint32 unk (always null in pcap) + uint16 unk (always 0001 in pcap) + uint16 len guild name + string nullterm guild name + uint16 len guild leader name + string nullterm guild leader name */ if guild.Icon != nil { @@ -1104,107 +1085,94 @@ func handleMsgMhfEnumerateGuild(s *Session, p mhfpacket.MHFPacket) { switch pkt.Type { case mhfpacket.ENUMERATE_GUILD_TYPE_GUILD_NAME: - bf.ReadBytes(8) - searchTermLength := bf.ReadUint16() - bf.ReadBytes(1) - searchTerm := bf.ReadBytes(uint(searchTermLength)) - var searchTermSafe string - searchTermSafe, err = s.clientContext.StrConv.Decode(bfutil.UpToNull(searchTerm)) - if err != nil { - panic(err) + bf.ReadBytes(10) + searchTerm := fmt.Sprintf(`%%%s%%`, stringsupport.SJISToUTF8(bf.ReadNullTerminatedBytes())) + rows, err = s.server.db.Queryx(fmt.Sprintf(`%s WHERE g.name ILIKE $1 OFFSET $2`, guildInfoSelectQuery), searchTerm, pkt.Page*10) + if err == nil { + for rows.Next() { + guild, _ := buildGuildObjectFromDbResult(rows, err, s) + guilds = append(guilds, guild) + } } - guilds, err = FindGuildsByName(s, searchTermSafe) case mhfpacket.ENUMERATE_GUILD_TYPE_LEADER_NAME: - bf.ReadBytes(8) - searchTermLength := bf.ReadUint16() - bf.ReadBytes(1) - searchTerm := bf.ReadBytes(uint(searchTermLength)) - var searchTermSafe string - searchTermSafe, err = s.clientContext.StrConv.Decode(bfutil.UpToNull(searchTerm)) - if err != nil { - panic(err) - } - rows, err = s.server.db.Queryx(fmt.Sprintf(`%s WHERE lc.name ILIKE $1`, guildInfoSelectQuery), searchTermSafe) - if err != nil { - s.logger.Error("Failed to retrieve guild by leader name", zap.Error(err)) - } else { + bf.ReadBytes(10) + searchTerm := fmt.Sprintf(`%%%s%%`, stringsupport.SJISToUTF8(bf.ReadNullTerminatedBytes())) + rows, err = s.server.db.Queryx(fmt.Sprintf(`%s WHERE lc.name ILIKE $1 OFFSET $2`, guildInfoSelectQuery), searchTerm, pkt.Page*10) + if err == nil { for rows.Next() { guild, _ := buildGuildObjectFromDbResult(rows, err, s) guilds = append(guilds, guild) } } case mhfpacket.ENUMERATE_GUILD_TYPE_LEADER_ID: - bf.ReadBytes(3) + bf.ReadBytes(2) ID := bf.ReadUint32() rows, err = s.server.db.Queryx(fmt.Sprintf(`%s WHERE leader_id = $1`, guildInfoSelectQuery), ID) - if err != nil { - s.logger.Error("Failed to retrieve guild by leader ID", zap.Error(err)) - } else { + if err == nil { for rows.Next() { guild, _ := buildGuildObjectFromDbResult(rows, err, s) guilds = append(guilds, guild) } } case mhfpacket.ENUMERATE_GUILD_TYPE_ORDER_MEMBERS: - sorting := bf.ReadUint16() + sorting := bf.ReadUint8() if sorting == 1 { - rows, err = s.server.db.Queryx(fmt.Sprintf(`%s ORDER BY member_count DESC`, guildInfoSelectQuery)) + rows, err = s.server.db.Queryx(fmt.Sprintf(`%s ORDER BY member_count DESC OFFSET $1`, guildInfoSelectQuery), pkt.Page*10) } else { - rows, err = s.server.db.Queryx(fmt.Sprintf(`%s ORDER BY member_count ASC`, guildInfoSelectQuery)) + rows, err = s.server.db.Queryx(fmt.Sprintf(`%s ORDER BY member_count ASC OFFSET $1`, guildInfoSelectQuery), pkt.Page*10) } - if err != nil { - s.logger.Error("Failed to retrieve guild by member count", zap.Error(err)) - } else { + if err == nil { for rows.Next() { guild, _ := buildGuildObjectFromDbResult(rows, err, s) guilds = append(guilds, guild) } } case mhfpacket.ENUMERATE_GUILD_TYPE_ORDER_REGISTRATION: - sorting := bf.ReadUint16() + sorting := bf.ReadUint8() if sorting == 1 { - rows, err = s.server.db.Queryx(fmt.Sprintf(`%s ORDER BY id ASC`, guildInfoSelectQuery)) + rows, err = s.server.db.Queryx(fmt.Sprintf(`%s ORDER BY id ASC OFFSET $1`, guildInfoSelectQuery), pkt.Page*10) } else { - rows, err = s.server.db.Queryx(fmt.Sprintf(`%s ORDER BY id DESC`, guildInfoSelectQuery)) + rows, err = s.server.db.Queryx(fmt.Sprintf(`%s ORDER BY id DESC OFFSET $1`, guildInfoSelectQuery), pkt.Page*10) } - if err != nil { - s.logger.Error("Failed to retrieve guild by registration date", zap.Error(err)) - } else { + if err == nil { for rows.Next() { guild, _ := buildGuildObjectFromDbResult(rows, err, s) guilds = append(guilds, guild) } } case mhfpacket.ENUMERATE_GUILD_TYPE_ORDER_RANK: - sorting := bf.ReadUint16() + sorting := bf.ReadUint8() if sorting == 1 { - rows, err = s.server.db.Queryx(fmt.Sprintf(`%s ORDER BY rank_rp DESC`, guildInfoSelectQuery)) + rows, err = s.server.db.Queryx(fmt.Sprintf(`%s ORDER BY rank_rp DESC OFFSET $1`, guildInfoSelectQuery), pkt.Page*10) } else { - rows, err = s.server.db.Queryx(fmt.Sprintf(`%s ORDER BY rank_rp ASC`, guildInfoSelectQuery)) + rows, err = s.server.db.Queryx(fmt.Sprintf(`%s ORDER BY rank_rp ASC OFFSET $1`, guildInfoSelectQuery), pkt.Page*10) } - if err != nil { - s.logger.Error("Failed to retrieve guild by rank", zap.Error(err)) - } else { + if err == nil { for rows.Next() { guild, _ := buildGuildObjectFromDbResult(rows, err, s) guilds = append(guilds, guild) } } case mhfpacket.ENUMERATE_GUILD_TYPE_MOTTO: - bf.ReadBytes(3) + bf.ReadBytes(2) mainMotto := bf.ReadUint16() subMotto := bf.ReadUint16() - rows, err = s.server.db.Queryx(fmt.Sprintf(`%s WHERE main_motto = $1 AND sub_motto = $2`, guildInfoSelectQuery), mainMotto, subMotto) - if err != nil { - s.logger.Error("Failed to retrieve guild by motto", zap.Error(err)) - } else { + rows, err = s.server.db.Queryx(fmt.Sprintf(`%s WHERE main_motto = $1 AND sub_motto = $2 OFFSET $3`, guildInfoSelectQuery), mainMotto, subMotto, pkt.Page*10) + if err == nil { for rows.Next() { guild, _ := buildGuildObjectFromDbResult(rows, err, s) guilds = append(guilds, guild) } } case mhfpacket.ENUMERATE_GUILD_TYPE_RECRUITING: - // + // Assume the player wants the newest guilds with open recruitment + rows, err = s.server.db.Queryx(fmt.Sprintf(`%s WHERE recruiting=true ORDER BY id DESC OFFSET $1`, guildInfoSelectQuery), pkt.Page*10) + if err == nil { + for rows.Next() { + guild, _ := buildGuildObjectFromDbResult(rows, err, s) + guilds = append(guilds, guild) + } + } case mhfpacket.ENUMERATE_ALLIANCE_TYPE_ALLIANCE_NAME: // case mhfpacket.ENUMERATE_ALLIANCE_TYPE_LEADER_NAME: @@ -1227,23 +1195,21 @@ func handleMsgMhfEnumerateGuild(s *Session, p mhfpacket.MHFPacket) { bf = byteframe.NewByteFrame() bf.WriteUint16(uint16(len(guilds))) + bf.WriteUint8(0x01) // Unk + for _, guild := range guilds { - bf.WriteUint8(0x00) // Unk bf.WriteUint32(guild.ID) bf.WriteUint32(guild.LeaderCharID) bf.WriteUint16(guild.MemberCount) - bf.WriteUint8(0x00) // Unk - bf.WriteUint8(0x00) // Unk - bf.WriteUint16(guild.Rank) + bf.WriteUint16(0x0000) // Unk + bf.WriteUint16(guild.Rank) // OR guilds in alliance bf.WriteUint32(uint32(guild.CreatedAt.Unix())) ps.Uint8(bf, guild.Name, true) ps.Uint8(bf, guild.LeaderName, true) bf.WriteUint8(0x01) // Unk + bf.WriteBool(!guild.Recruiting) } - bf.WriteUint8(0x01) // Unk - bf.WriteUint8(0x00) // Unk - doAckBufSucceed(s, pkt.AckHandle, bf.Data()) } @@ -1294,6 +1260,10 @@ func handleMsgMhfEnumerateGuildMember(s *Session, p mhfpacket.MHFPacket) { guild, err = GetGuildInfoByCharacterId(s, s.charID) } + if guild == nil && s.prevGuildID > 0 { + guild, err = GetGuildInfoByID(s, s.prevGuildID) + } + if err != nil { s.logger.Warn("failed to retrieve guild sending no result message") doAckBufSucceed(s, pkt.AckHandle, make([]byte, 2)) @@ -1387,6 +1357,15 @@ func handleMsgMhfGetGuildManageRight(s *Session, p mhfpacket.MHFPacket) { guild, err := GetGuildInfoByCharacterId(s, s.charID) + if guild == nil && s.prevGuildID != 0 { + guild, err = GetGuildInfoByID(s, s.prevGuildID) + s.prevGuildID = 0 + if guild == nil || err != nil { + doAckBufSucceed(s, pkt.AckHandle, make([]byte, 4)) + return + } + } + if err != nil { s.logger.Warn("failed to respond to manage rights message") return @@ -1408,7 +1387,8 @@ func handleMsgMhfGetGuildManageRight(s *Session, p mhfpacket.MHFPacket) { for _, member := range members { bf.WriteUint32(member.CharID) - bf.WriteUint32(0x0) + bf.WriteBool(member.Recruiter) + bf.WriteBytes(make([]byte, 3)) } doAckBufSucceed(s, pkt.AckHandle, bf.Data()) @@ -1673,7 +1653,7 @@ func handleMsgMhfLoadGuildCooking(s *Session, p mhfpacket.MHFPacket) { if err != nil { s.logger.Fatal("Failed to scan meal data", zap.Error(err)) } - if mealData.Expires > uint32(Time_Current_Adjusted().Add(-60 * time.Minute).Unix()) { + if mealData.Expires > uint32(Time_Current_Adjusted().Add(-60*time.Minute).Unix()) { count++ temp.WriteUint32(mealData.ID) temp.WriteUint32(mealData.MealID) @@ -1696,7 +1676,7 @@ func handleMsgMhfRegistGuildCooking(s *Session, p mhfpacket.MHFPacket) { s.logger.Fatal("Failed to delete meal in db", zap.Error(err)) } } - _, err := s.server.db.Exec("INSERT INTO guild_meals (guild_id, meal_id, level, expires) VALUES ($1, $2, $3, $4)", guild.ID, pkt.MealID, pkt.Success, Time_Current_Adjusted().Add(30 * time.Minute).Unix()) + _, err := s.server.db.Exec("INSERT INTO guild_meals (guild_id, meal_id, level, expires) VALUES ($1, $2, $3, $4)", guild.ID, pkt.MealID, pkt.Success, Time_Current_Adjusted().Add(30*time.Minute).Unix()) if err != nil { s.logger.Fatal("Failed to register meal in db", zap.Error(err)) } @@ -1900,9 +1880,17 @@ func handleMsgMhfGenerateUdGuildMap(s *Session, p mhfpacket.MHFPacket) {} func handleMsgMhfUpdateGuild(s *Session, p mhfpacket.MHFPacket) {} -func handleMsgMhfSetGuildManageRight(s *Session, p mhfpacket.MHFPacket) {} +func handleMsgMhfSetGuildManageRight(s *Session, p mhfpacket.MHFPacket) { + pkt := p.(*mhfpacket.MsgMhfSetGuildManageRight) + s.server.db.Exec("UPDATE guild_characters SET recruiter=$1 WHERE character_id=$2", pkt.Allowed, pkt.CharID) + // TODO: What is this supposed to return? This works for now + doAckBufSucceed(s, pkt.AckHandle, []byte{0x01}) +} -func handleMsgMhfEnumerateInvGuild(s *Session, p mhfpacket.MHFPacket) {} +func handleMsgMhfEnumerateInvGuild(s *Session, p mhfpacket.MHFPacket) { + pkt := p.(*mhfpacket.MsgMhfEnumerateInvGuild) + stubEnumerateNoResults(s, pkt.AckHandle) +} func handleMsgMhfOperationInvGuild(s *Session, p mhfpacket.MHFPacket) {} diff --git a/Erupe/server/channelserver/handlers_guild_adventure.go b/server/channelserver/handlers_guild_adventure.go similarity index 89% rename from Erupe/server/channelserver/handlers_guild_adventure.go rename to server/channelserver/handlers_guild_adventure.go index 90b6c3239..45f836127 100644 --- a/Erupe/server/channelserver/handlers_guild_adventure.go +++ b/server/channelserver/handlers_guild_adventure.go @@ -3,10 +3,10 @@ package channelserver import ( "time" - "erupe-ce/common/stringsupport" - "erupe-ce/common/byteframe" - "erupe-ce/network/mhfpacket" - "go.uber.org/zap" + "erupe-ce/common/byteframe" + "erupe-ce/common/stringsupport" + "erupe-ce/network/mhfpacket" + "go.uber.org/zap" ) type GuildAdventure struct { @@ -39,7 +39,7 @@ func handleMsgMhfLoadGuildAdventure(s *Session, p mhfpacket.MHFPacket) { temp.WriteUint32(adventureData.Charge) temp.WriteUint32(adventureData.Depart) temp.WriteUint32(adventureData.Return) - temp.WriteBool(stringsupport.CSVContains(adventureData.CollectedBy, int(s.charID))) + temp.WriteBool(stringsupport.CSVContains(adventureData.CollectedBy, int(s.charID))) } bf := byteframe.NewByteFrame() bf.WriteUint8(uint8(count)) @@ -50,7 +50,7 @@ func handleMsgMhfLoadGuildAdventure(s *Session, p mhfpacket.MHFPacket) { func handleMsgMhfRegistGuildAdventure(s *Session, p mhfpacket.MHFPacket) { pkt := p.(*mhfpacket.MsgMhfRegistGuildAdventure) guild, _ := GetGuildInfoByCharacterId(s, s.charID) - _, err := s.server.db.Exec("INSERT INTO guild_adventures (guild_id, destination, depart, return) VALUES ($1, $2, $3, $4)", guild.ID, pkt.Destination, Time_Current_Adjusted().Unix(), Time_Current_Adjusted().Add(6 * time.Hour).Unix()) + _, err := s.server.db.Exec("INSERT INTO guild_adventures (guild_id, destination, depart, return) VALUES ($1, $2, $3, $4)", guild.ID, pkt.Destination, Time_Current_Adjusted().Unix(), Time_Current_Adjusted().Add(6*time.Hour).Unix()) if err != nil { s.logger.Fatal("Failed to register guild adventure", zap.Error(err)) } @@ -64,7 +64,7 @@ func handleMsgMhfAcquireGuildAdventure(s *Session, p mhfpacket.MHFPacket) { if err != nil { s.logger.Fatal("Error parsing adventure collected by", zap.Error(err)) } else { - collectedBy = stringsupport.CSVAdd(collectedBy, int(s.charID)) + collectedBy = stringsupport.CSVAdd(collectedBy, int(s.charID)) _, err := s.server.db.Exec("UPDATE guild_adventures SET collected_by = $1 WHERE id = $2", collectedBy, pkt.ID) if err != nil { s.logger.Fatal("Failed to collect adventure in db", zap.Error(err)) @@ -85,7 +85,7 @@ func handleMsgMhfChargeGuildAdventure(s *Session, p mhfpacket.MHFPacket) { func handleMsgMhfRegistGuildAdventureDiva(s *Session, p mhfpacket.MHFPacket) { pkt := p.(*mhfpacket.MsgMhfRegistGuildAdventureDiva) guild, _ := GetGuildInfoByCharacterId(s, s.charID) - _, err := s.server.db.Exec("INSERT INTO guild_adventures (guild_id, destination, charge, depart, return) VALUES ($1, $2, $3, $4, $5)", guild.ID, pkt.Destination, pkt.Charge, Time_Current_Adjusted().Unix(), Time_Current_Adjusted().Add(1 * time.Hour).Unix()) + _, err := s.server.db.Exec("INSERT INTO guild_adventures (guild_id, destination, charge, depart, return) VALUES ($1, $2, $3, $4, $5)", guild.ID, pkt.Destination, pkt.Charge, Time_Current_Adjusted().Unix(), Time_Current_Adjusted().Add(1*time.Hour).Unix()) if err != nil { s.logger.Fatal("Failed to register guild adventure", zap.Error(err)) } diff --git a/Erupe/server/channelserver/handlers_guild_alliance.go b/server/channelserver/handlers_guild_alliance.go similarity index 91% rename from Erupe/server/channelserver/handlers_guild_alliance.go rename to server/channelserver/handlers_guild_alliance.go index accfcc555..77f204adc 100644 --- a/Erupe/server/channelserver/handlers_guild_alliance.go +++ b/server/channelserver/handlers_guild_alliance.go @@ -6,7 +6,7 @@ import ( "erupe-ce/network/mhfpacket" "github.com/jmoiron/sqlx" - "go.uber.org/zap" + "go.uber.org/zap" ) const allianceInfoSelectQuery = ` @@ -27,18 +27,18 @@ FROM guild_alliances ga ` type GuildAlliance struct { - ID uint32 `db:"id"` - Name string `db:"name"` - CreatedAt time.Time `db:"created_at"` - TotalMembers uint16 + ID uint32 `db:"id"` + Name string `db:"name"` + CreatedAt time.Time `db:"created_at"` + TotalMembers uint16 - ParentGuildID uint32 `db:"parent_id"` - SubGuild1ID uint32 `db:"sub1_id"` - SubGuild2ID uint32 `db:"sub2_id"` + ParentGuildID uint32 `db:"parent_id"` + SubGuild1ID uint32 `db:"sub1_id"` + SubGuild2ID uint32 `db:"sub2_id"` - ParentGuild Guild - SubGuild1 Guild - SubGuild2 Guild + ParentGuild Guild + SubGuild1 Guild + SubGuild2 Guild } func GetAllianceData(s *Session, AllianceID uint32) (*GuildAlliance, error) { diff --git a/Erupe/server/channelserver/handlers_guild_member.go b/server/channelserver/handlers_guild_member.go similarity index 72% rename from Erupe/server/channelserver/handlers_guild_member.go rename to server/channelserver/handlers_guild_member.go index db9623b4a..5fa83fb6b 100644 --- a/Erupe/server/channelserver/handlers_guild_member.go +++ b/server/channelserver/handlers_guild_member.go @@ -16,6 +16,7 @@ type GuildMember struct { IsApplicant bool `db:"is_applicant"` OrderIndex uint8 `db:"order_index"` LastLogin uint32 `db:"last_login"` + Recruiter bool `db:"recruiter"` AvoidLeadership bool `db:"avoid_leadership"` IsLeader bool `db:"is_leader"` HRP uint16 `db:"hrp"` @@ -43,36 +44,33 @@ func (gm *GuildMember) Save(s *Session) error { return nil } -//TODO add the recruiter permission to this check when it exists -func (gm *GuildMember) IsRecruiter() bool { - return gm.IsLeader || gm.IsSubLeader() -} - const guildMembersSelectSQL = ` -SELECT g.id as guild_id, - joined_at, - c.name, - character.character_id, - coalesce(gc.order_index, 0) as order_index, - c.last_login, - coalesce(gc.avoid_leadership, false) as avoid_leadership, - c.hrp, - c.gr, - c.weapon_id, - c.weapon_type, - character.is_applicant, - CASE WHEN g.leader_id = c.id THEN 1 ELSE 0 END as is_leader -FROM ( - SELECT character_id, true as is_applicant, guild_id - FROM guild_applications ga - WHERE ga.application_type = 'applied' - UNION - SELECT character_id, false as is_applicant, guild_id - FROM guild_characters gc - ) character - JOIN characters c on character.character_id = c.id - LEFT JOIN guild_characters gc ON gc.character_id = character.character_id - JOIN guilds g ON g.id = character.guild_id +SELECT + g.id as guild_id, + joined_at, + c.name, + character.character_id, + coalesce(gc.order_index, 0) as order_index, + c.last_login, + coalesce(gc.recruiter, false) as recruiter, + coalesce(gc.avoid_leadership, false) as avoid_leadership, + c.hrp, + c.gr, + c.weapon_id, + c.weapon_type, + character.is_applicant, + CASE WHEN g.leader_id = c.id THEN 1 ELSE 0 END as is_leader + FROM ( + SELECT character_id, true as is_applicant, guild_id + FROM guild_applications ga + WHERE ga.application_type = 'applied' + UNION + SELECT character_id, false as is_applicant, guild_id + FROM guild_characters gc + ) character + JOIN characters c on character.character_id = c.id + LEFT JOIN guild_characters gc ON gc.character_id = character.character_id + JOIN guilds g ON g.id = character.guild_id ` func GetGuildMembers(s *Session, guildID uint32, applicants bool) ([]*GuildMember, error) { diff --git a/Erupe/server/channelserver/handlers_guild_scout.go b/server/channelserver/handlers_guild_scout.go similarity index 95% rename from Erupe/server/channelserver/handlers_guild_scout.go rename to server/channelserver/handlers_guild_scout.go index 41e166e91..4bcbb6b91 100644 --- a/Erupe/server/channelserver/handlers_guild_scout.go +++ b/server/channelserver/handlers_guild_scout.go @@ -5,9 +5,9 @@ import ( "io" "time" + "erupe-ce/common/byteframe" "erupe-ce/common/stringsupport" "erupe-ce/network/mhfpacket" - "erupe-ce/common/byteframe" "go.uber.org/zap" ) @@ -21,7 +21,7 @@ func handleMsgMhfPostGuildScout(s *Session, p mhfpacket.MHFPacket) { panic(err) } - if actorCharGuildData == nil || !actorCharGuildData.IsRecruiter() { + if actorCharGuildData == nil || !actorCharGuildData.Recruiter { doAckBufFail(s, pkt.AckHandle, make([]byte, 4)) return } @@ -104,7 +104,7 @@ func handleMsgMhfCancelGuildScout(s *Session, p mhfpacket.MHFPacket) { panic(err) } - if guildCharData == nil || !guildCharData.IsRecruiter() { + if guildCharData == nil || !guildCharData.Recruiter { doAckBufFail(s, pkt.AckHandle, make([]byte, 4)) return } @@ -190,13 +190,15 @@ func handleMsgMhfGetGuildScoutList(s *Session, p mhfpacket.MHFPacket) { guildInfo, err := GetGuildInfoByCharacterId(s, s.charID) - if err != nil { - panic(err) - } - - if guildInfo == nil { + if guildInfo == nil && s.prevGuildID == 0 { doAckSimpleFail(s, pkt.AckHandle, nil) return + } else { + guildInfo, err = GetGuildInfoByID(s, s.prevGuildID) + if guildInfo == nil || err != nil { + doAckSimpleFail(s, pkt.AckHandle, nil) + return + } } rows, err := s.server.db.Queryx(` diff --git a/Erupe/server/channelserver/handlers_guild_tresure.go b/server/channelserver/handlers_guild_tresure.go similarity index 97% rename from Erupe/server/channelserver/handlers_guild_tresure.go rename to server/channelserver/handlers_guild_tresure.go index 92d27f7e9..c5e2fa0dc 100644 --- a/Erupe/server/channelserver/handlers_guild_tresure.go +++ b/server/channelserver/handlers_guild_tresure.go @@ -27,7 +27,7 @@ func handleMsgMhfEnumerateGuildTresure(s *Session, p mhfpacket.MHFPacket) { } bf := byteframe.NewByteFrame() hunts := 0 - rows, _ := s.server.db.Queryx("SELECT id, host_id, destination, level, return, acquired, claimed, hunters, treasure, hunt_data FROM guild_hunts WHERE guild_id=$1", guild.ID) + rows, _ := s.server.db.Queryx("SELECT id, host_id, destination, level, return, acquired, claimed, hunters, treasure, hunt_data FROM guild_hunts WHERE guild_id=$1 AND $2 < return+604800", guild.ID, Time_Current_Adjusted().Unix()) for rows.Next() { hunt := &TreasureHunt{} err = rows.StructScan(&hunt) @@ -51,6 +51,9 @@ func handleMsgMhfEnumerateGuildTresure(s *Session, p mhfpacket.MHFPacket) { bf.WriteBytes(hunt.HuntData) break } else if pkt.MaxHunts == 30 && hunt.Acquired && hunt.Level == 2 { + if hunts == 30 { + break + } hunts++ bf.WriteUint32(hunt.HuntID) bf.WriteUint32(hunt.Destination) diff --git a/Erupe/server/channelserver/handlers_house.go b/server/channelserver/handlers_house.go similarity index 99% rename from Erupe/server/channelserver/handlers_house.go rename to server/channelserver/handlers_house.go index 9af91074e..92d7c853e 100644 --- a/Erupe/server/channelserver/handlers_house.go +++ b/server/channelserver/handlers_house.go @@ -294,7 +294,7 @@ func handleMsgMhfSaveDecoMyset(s *Session, p mhfpacket.MHFPacket) { func handleMsgMhfEnumerateTitle(s *Session, p mhfpacket.MHFPacket) { pkt := p.(*mhfpacket.MsgMhfEnumerateTitle) bf := byteframe.NewByteFrame() - if pkt.CharID == s.charID { + if pkt.CharID == 0 { titleCount := 114 // all titles unlocked bf.WriteUint16(uint16(titleCount)) // title count bf.WriteUint16(0) // unk diff --git a/Erupe/server/channelserver/handlers_kouryou.go b/server/channelserver/handlers_kouryou.go similarity index 100% rename from Erupe/server/channelserver/handlers_kouryou.go rename to server/channelserver/handlers_kouryou.go index 9c76a1b05..57f26ea40 100644 --- a/Erupe/server/channelserver/handlers_kouryou.go +++ b/server/channelserver/handlers_kouryou.go @@ -1,8 +1,8 @@ package channelserver import ( - "erupe-ce/network/mhfpacket" "erupe-ce/common/byteframe" + "erupe-ce/network/mhfpacket" "go.uber.org/zap" ) diff --git a/Erupe/server/channelserver/handlers_mail.go b/server/channelserver/handlers_mail.go similarity index 91% rename from Erupe/server/channelserver/handlers_mail.go rename to server/channelserver/handlers_mail.go index 1b407a515..1e060b245 100644 --- a/Erupe/server/channelserver/handlers_mail.go +++ b/server/channelserver/handlers_mail.go @@ -2,11 +2,12 @@ package channelserver import ( "database/sql" + "erupe-ce/common/stringsupport" "time" + "erupe-ce/common/byteframe" "erupe-ce/network/binpacket" "erupe-ce/network/mhfpacket" - "erupe-ce/common/byteframe" "go.uber.org/zap" ) @@ -275,7 +276,7 @@ func handleMsgMhfReadMail(s *Session, p mhfpacket.MHFPacket) { bf := byteframe.NewByteFrame() - body := s.clientContext.StrConv.MustEncode(mail.Body) + body := stringsupport.UTF8ToSJIS(mail.Body) bf.WriteNullTerminatedBytes(body) doAckBufSucceed(s, pkt.AckHandle, bf.Data()) @@ -306,15 +307,12 @@ func handleMsgMhfListMail(s *Session, p mhfpacket.MHFPacket) { s.mailList[accIndex] = m.ID s.mailAccIndex++ - itemAttached := m.AttachedItemID != 0 - subject := s.clientContext.StrConv.MustEncode(m.Subject) - sender := s.clientContext.StrConv.MustEncode(m.SenderName) msg.WriteUint32(m.SenderID) msg.WriteUint32(uint32(m.CreatedAt.Unix())) - msg.WriteUint8(uint8(accIndex)) + msg.WriteUint8(accIndex) msg.WriteUint8(uint8(i)) flags := uint8(0x00) @@ -330,8 +328,15 @@ func handleMsgMhfListMail(s *Session, p mhfpacket.MHFPacket) { // System message, hides ID // flags |= 0x04 - if m.AttachedItemReceived { - flags |= 0x08 + // Workaround until EN mail items are patched + if s.server.erupeConfig.DevMode && s.server.erupeConfig.DevModeOptions.DisableMailItems { + if itemAttached { + flags |= 0x08 + } + } else { + if m.AttachedItemReceived { + flags |= 0x08 + } } if m.IsGuildInvite { @@ -340,11 +345,10 @@ func handleMsgMhfListMail(s *Session, p mhfpacket.MHFPacket) { msg.WriteUint8(flags) msg.WriteBool(itemAttached) - msg.WriteUint8(uint8(len(subject)+1)) - msg.WriteUint8(uint8(len(sender)+1)) - msg.WriteNullTerminatedBytes(subject) - msg.WriteNullTerminatedBytes(sender) - + msg.WriteUint8(16) + msg.WriteUint8(21) + msg.WriteBytes(stringsupport.PaddedString(m.Subject, 16, true)) + msg.WriteBytes(stringsupport.PaddedString(m.SenderName, 21, true)) if itemAttached { msg.WriteUint16(m.AttachedItemAmount) msg.WriteUint16(m.AttachedItemID) @@ -359,34 +363,22 @@ func handleMsgMhfOprtMail(s *Session, p mhfpacket.MHFPacket) { mail, err := GetMailByID(s, s.mailList[pkt.AccIndex]) if err != nil { - doAckSimpleFail(s, pkt.AckHandle, nil) panic(err) } - switch mhfpacket.OperateMailOperation(pkt.Operation) { + + switch pkt.Operation { case mhfpacket.OPERATE_MAIL_DELETE: err = mail.MarkDeleted(s) - if err != nil { - doAckSimpleFail(s, pkt.AckHandle, nil) - panic(err) - } case mhfpacket.OPERATE_MAIL_LOCK: err = mail.MarkLocked(s, true) - if err != nil { - doAckSimpleFail(s, pkt.AckHandle, nil) - panic(err) - } case mhfpacket.OPERATE_MAIL_UNLOCK: err = mail.MarkLocked(s, false) - if err != nil { - doAckSimpleFail(s, pkt.AckHandle, nil) - panic(err) - } case mhfpacket.OPERATE_MAIL_ACQUIRE_ITEM: err = mail.MarkAcquired(s) - if err != nil { - doAckSimpleFail(s, pkt.AckHandle, nil) - panic(err) - } + } + + if err != nil { + panic(err) } doAckSimpleSucceed(s, pkt.AckHandle, make([]byte, 4)) diff --git a/Erupe/server/channelserver/handlers_mercenary.go b/server/channelserver/handlers_mercenary.go similarity index 99% rename from Erupe/server/channelserver/handlers_mercenary.go rename to server/channelserver/handlers_mercenary.go index af70c55fe..606579fe5 100644 --- a/Erupe/server/channelserver/handlers_mercenary.go +++ b/server/channelserver/handlers_mercenary.go @@ -386,5 +386,4 @@ func GetCatDetails(bf *byteframe.ByteFrame) []CatDefinition { return cats } - /////////////////////////////////////////// diff --git a/Erupe/server/channelserver/handlers_mutex.go b/server/channelserver/handlers_mutex.go similarity index 100% rename from Erupe/server/channelserver/handlers_mutex.go rename to server/channelserver/handlers_mutex.go diff --git a/Erupe/server/channelserver/handlers_object.go b/server/channelserver/handlers_object.go similarity index 77% rename from Erupe/server/channelserver/handlers_object.go rename to server/channelserver/handlers_object.go index 0b24c0f66..8984c21bf 100644 --- a/Erupe/server/channelserver/handlers_object.go +++ b/server/channelserver/handlers_object.go @@ -10,9 +10,25 @@ import ( func handleMsgSysCreateObject(s *Session, p mhfpacket.MHFPacket) { pkt := p.(*mhfpacket.MsgSysCreateObject) + // Prevent reusing an object index + var nextID uint32 + for { + exists := false + nextID = s.stage.NextObjectID() + for _, object := range s.stage.objects { + if object.id == nextID { + exists = true + break + } + } + if exists == false { + break + } + } + s.stage.Lock() newObj := &Object{ - id: s.stage.NextObjectID(), + id: nextID, ownerCharID: s.charID, x: pkt.X, y: pkt.Y, @@ -34,7 +50,7 @@ func handleMsgSysCreateObject(s *Session, p mhfpacket.MHFPacket) { OwnerCharID: newObj.ownerCharID, } - s.logger.Info(fmt.Sprintf("Broadcasting new object: %s (%d)", s.Name, s.charID)) + s.logger.Info(fmt.Sprintf("Broadcasting new object: %s (%d)", s.Name, newObj.id)) s.stage.BroadcastMHF(dupObjUpdate, s) } @@ -63,9 +79,16 @@ func handleMsgSysDuplicateObject(s *Session, p mhfpacket.MHFPacket) {} func handleMsgSysSetObjectBinary(s *Session, p mhfpacket.MHFPacket) { pkt := p.(*mhfpacket.MsgSysSetObjectBinary) - for _, object := range s.stage.objects { - if object.id == pkt.ObjID { - object.binary = pkt.RawDataPayload + for _, session := range s.server.sessions { + if session.charID == s.charID { + s.server.userBinaryPartsLock.Lock() + s.server.userBinaryParts[userBinaryPartID{charID: s.charID, index: 3}] = pkt.RawDataPayload + s.server.userBinaryPartsLock.Unlock() + msg := &mhfpacket.MsgSysNotifyUserBinary{ + CharID: s.charID, + BinaryType: 3, + } + s.server.BroadcastMHF(msg, s) } } } diff --git a/Erupe/server/channelserver/handlers_plate.go b/server/channelserver/handlers_plate.go similarity index 100% rename from Erupe/server/channelserver/handlers_plate.go rename to server/channelserver/handlers_plate.go diff --git a/Erupe/server/channelserver/handlers_quest.go b/server/channelserver/handlers_quest.go similarity index 100% rename from Erupe/server/channelserver/handlers_quest.go rename to server/channelserver/handlers_quest.go diff --git a/Erupe/server/channelserver/handlers_register.go b/server/channelserver/handlers_register.go similarity index 73% rename from Erupe/server/channelserver/handlers_register.go rename to server/channelserver/handlers_register.go index 4da6e9a8c..3dd65cf6a 100644 --- a/Erupe/server/channelserver/handlers_register.go +++ b/server/channelserver/handlers_register.go @@ -3,13 +3,15 @@ package channelserver import ( "erupe-ce/common/byteframe" "erupe-ce/network/mhfpacket" + "strings" ) func handleMsgSysOperateRegister(s *Session, p mhfpacket.MHFPacket) { pkt := p.(*mhfpacket.MsgSysOperateRegister) bf := byteframe.NewByteFrameFromBytes(pkt.RawDataPayload) s.server.raviente.Lock() - if pkt.SemaphoreID == s.server.raviente.state.semaphoreID { + switch pkt.SemaphoreID { + case 3: resp := byteframe.NewByteFrame() size := 6 for i := 0; i < len(bf.Data())-1; i += size { @@ -31,7 +33,7 @@ func handleMsgSysOperateRegister(s *Session, p mhfpacket.MHFPacket) { resp.WriteUint32(*ref + data) *ref += data } else { - resp.WriteUint32(*ref + data) + resp.WriteUint32(*ref) } } else { resp.WriteUint32(*ref + data*damageMultiplier) @@ -47,7 +49,7 @@ func handleMsgSysOperateRegister(s *Session, p mhfpacket.MHFPacket) { } resp.WriteUint8(0) doAckBufSucceed(s, pkt.AckHandle, resp.Data()) - } else if pkt.SemaphoreID == s.server.raviente.support.semaphoreID { + case 4: resp := byteframe.NewByteFrame() size := 6 for i := 0; i < len(bf.Data())-1; i += size { @@ -72,7 +74,7 @@ func handleMsgSysOperateRegister(s *Session, p mhfpacket.MHFPacket) { } resp.WriteUint8(0) doAckBufSucceed(s, pkt.AckHandle, resp.Data()) - } else if pkt.SemaphoreID == s.server.raviente.register.semaphoreID { + case 5: resp := byteframe.NewByteFrame() size := 6 for i := 0; i < len(bf.Data())-1; i += size { @@ -103,7 +105,7 @@ func handleMsgSysOperateRegister(s *Session, p mhfpacket.MHFPacket) { switch op { case 2: resp.WriteUint32(*ref) - resp.WriteUint32(*ref + uint32(data)) + resp.WriteUint32(*ref + data) *ref += data case 13: resp.WriteUint32(0) @@ -122,7 +124,7 @@ func handleMsgSysOperateRegister(s *Session, p mhfpacket.MHFPacket) { switch op { case 2: resp.WriteUint32(*ref) - resp.WriteUint32(*ref + uint32(data)) + resp.WriteUint32(*ref + data) *ref += data case 13: resp.WriteUint32(0) @@ -137,7 +139,7 @@ func handleMsgSysOperateRegister(s *Session, p mhfpacket.MHFPacket) { switch op { case 2: resp.WriteUint32(*ref) - resp.WriteUint32(*ref + uint32(data)) + resp.WriteUint32(*ref + data) *ref += data case 13: resp.WriteUint32(0) @@ -152,7 +154,7 @@ func handleMsgSysOperateRegister(s *Session, p mhfpacket.MHFPacket) { switch op { case 2: resp.WriteUint32(*ref) - resp.WriteUint32(*ref + uint32(data)) + resp.WriteUint32(*ref + data) *ref += data case 13: resp.WriteUint32(0) @@ -175,7 +177,7 @@ func handleMsgSysOperateRegister(s *Session, p mhfpacket.MHFPacket) { switch op { case 2: resp.WriteUint32(*ref) - resp.WriteUint32(*ref + uint32(data)) + resp.WriteUint32(*ref + data) *ref += data case 13: resp.WriteUint32(0) @@ -193,7 +195,7 @@ func handleMsgSysOperateRegister(s *Session, p mhfpacket.MHFPacket) { resp.WriteUint8(0) doAckBufSucceed(s, pkt.AckHandle, resp.Data()) } - s.notifyall() + s.notifyRavi() s.server.raviente.Unlock() } @@ -237,65 +239,36 @@ func handleMsgSysLoadRegister(s *Session, p mhfpacket.MHFPacket) { } } -func (s *Session) notifyall() { +func (s *Session) notifyRavi() { var temp mhfpacket.MHFPacket raviNotif := byteframe.NewByteFrame() - temp = &mhfpacket.MsgSysNotifyRegister{RegisterID: s.server.raviente.support.semaphoreID} + temp = &mhfpacket.MsgSysNotifyRegister{RegisterID: 3} raviNotif.WriteUint16(uint16(temp.Opcode())) temp.Build(raviNotif, s.clientContext) - temp = &mhfpacket.MsgSysNotifyRegister{RegisterID: s.server.raviente.state.semaphoreID} + temp = &mhfpacket.MsgSysNotifyRegister{RegisterID: 4} raviNotif.WriteUint16(uint16(temp.Opcode())) temp.Build(raviNotif, s.clientContext) - temp = &mhfpacket.MsgSysNotifyRegister{RegisterID: s.server.raviente.register.semaphoreID} + temp = &mhfpacket.MsgSysNotifyRegister{RegisterID: 5} raviNotif.WriteUint16(uint16(temp.Opcode())) temp.Build(raviNotif, s.clientContext) raviNotif.WriteUint16(0x0010) // End it. - if _, exists := s.server.semaphore["hs_l0u3B51J9k3"]; exists { - for session := range s.server.semaphore["hs_l0u3B51J9k3"].clients { - session.QueueSend(raviNotif.Data()) - } - } else if _, exists := s.server.semaphore["hs_l0u3B5129k3"]; exists { - for session := range s.server.semaphore["hs_l0u3B5129k3"].clients { - session.QueueSend(raviNotif.Data()) - } - } else if _, exists := s.server.semaphore["hs_l0u3B512Ak3"]; exists { - for session := range s.server.semaphore["hs_l0u3B512Ak3"].clients { + sema := getRaviSemaphore(s) + if sema != "" { + for session := range s.server.semaphore[sema].clients { session.QueueSend(raviNotif.Data()) } } } -func checkRaviSemaphore(s *Session) bool { - if _, exists := s.server.semaphore["hs_l0u3B51J9k3"]; exists { - return true - } else if _, exists := s.server.semaphore["hs_l0u3B5129k3"]; exists { - return true - } else if _, exists := s.server.semaphore["hs_l0u3B512Ak3"]; exists { - return true +func getRaviSemaphore(s *Session) string { + for _, semaphore := range s.server.semaphore { + if strings.HasPrefix(semaphore.id_semaphore, "hs_l0u3B5") && strings.HasSuffix(semaphore.id_semaphore, "3") { + return semaphore.id_semaphore + } } - return false + return "" } -//func releaseRaviSemaphore(s *Session) { -// s.server.raviente.Lock() -// if _, exists := s.server.semaphore["hs_l0u3B51J9k3"]; exists { -// if len(s.server.semaphore["hs_l0u3B51J9k3"].reservedClientSlots) == 0 { -// resetRavi(s) -// } -// } -// if _, exists := s.server.semaphore["hs_l0u3B5129k3"]; exists { -// if len(s.server.semaphore["hs_l0u3B5129k3"].reservedClientSlots) == 0 { -// resetRavi(s) -// } -// } -// if _, exists := s.server.semaphore["hs_l0u3B512Ak3"]; exists { -// if len(s.server.semaphore["hs_l0u3B512Ak3"].reservedClientSlots) == 0 { -// resetRavi(s) -// } -// } -// s.server.raviente.Unlock() -//} - func resetRavi(s *Session) { s.server.raviente.Lock() s.server.raviente.register.nextTime = 0 @@ -312,16 +285,4 @@ func resetRavi(s *Session) { s.server.raviente.Unlock() } -// Unused -func (s *Session) notifyticker() { - if _, exists := s.server.semaphore["hs_l0u3B51J9k3"]; exists { - s.server.semaphoreLock.Lock() - getSemaphore := s.server.semaphore["hs_l0u3B51J9k3"] - s.server.semaphoreLock.Unlock() - if _, exists := getSemaphore.reservedClientSlots[s.charID]; exists { - s.notifyall() - } - } -} - func handleMsgSysNotifyRegister(s *Session, p mhfpacket.MHFPacket) {} diff --git a/Erupe/server/channelserver/handlers_rengoku.go b/server/channelserver/handlers_rengoku.go similarity index 100% rename from Erupe/server/channelserver/handlers_rengoku.go rename to server/channelserver/handlers_rengoku.go index 0c2e95fdc..d7b60686b 100644 --- a/Erupe/server/channelserver/handlers_rengoku.go +++ b/server/channelserver/handlers_rengoku.go @@ -4,8 +4,8 @@ import ( "io/ioutil" "path/filepath" - "erupe-ce/network/mhfpacket" "erupe-ce/common/byteframe" + "erupe-ce/network/mhfpacket" "go.uber.org/zap" ) diff --git a/Erupe/server/channelserver/handlers_reserve.go b/server/channelserver/handlers_reserve.go similarity index 100% rename from Erupe/server/channelserver/handlers_reserve.go rename to server/channelserver/handlers_reserve.go diff --git a/Erupe/server/channelserver/handlers_reward.go b/server/channelserver/handlers_reward.go similarity index 100% rename from Erupe/server/channelserver/handlers_reward.go rename to server/channelserver/handlers_reward.go index 3791d4d89..b4a1abc6d 100644 --- a/Erupe/server/channelserver/handlers_reward.go +++ b/server/channelserver/handlers_reward.go @@ -3,8 +3,8 @@ package channelserver import ( "encoding/hex" - "erupe-ce/network/mhfpacket" "erupe-ce/common/byteframe" + "erupe-ce/network/mhfpacket" ) func handleMsgMhfGetAdditionalBeatReward(s *Session, p mhfpacket.MHFPacket) { diff --git a/Erupe/server/channelserver/handlers_semaphore.go b/server/channelserver/handlers_semaphore.go similarity index 80% rename from Erupe/server/channelserver/handlers_semaphore.go rename to server/channelserver/handlers_semaphore.go index 630105ea3..6659bd2da 100644 --- a/Erupe/server/channelserver/handlers_semaphore.go +++ b/server/channelserver/handlers_semaphore.go @@ -4,6 +4,7 @@ import ( "erupe-ce/common/byteframe" "fmt" "go.uber.org/zap" + "strconv" "strings" "erupe-ce/network/mhfpacket" @@ -34,7 +35,7 @@ func destructEmptySemaphores(s *Session) { s.server.semaphoreLock.Unlock() delete(s.server.semaphore, id) s.server.semaphoreLock.Lock() - if strings.HasPrefix(id, "hs_l0u3B51") { + if strings.HasPrefix(id, "hs_l0u3B5") { releaseRaviSemaphore(s, sema) } s.logger.Debug("Destructed semaphore", zap.String("sema.id_semaphore", id)) @@ -62,7 +63,7 @@ func handleMsgSysDeleteSemaphore(s *Session, p mhfpacket.MHFPacket) { s.server.semaphoreLock.Lock() for id, sema := range s.server.semaphore { if sema.id == sem { - if strings.HasPrefix(id, "hs_l0u3B51") { + if strings.HasPrefix(id, "hs_l0u3B5") { releaseRaviSemaphore(s, sema) s.server.semaphoreLock.Unlock() return @@ -86,14 +87,14 @@ func handleMsgSysCreateAcquireSemaphore(s *Session, p mhfpacket.MHFPacket) { fmt.Printf("Got reserve stage req, StageID: %v\n\n", SemaphoreID) if !exists { s.server.semaphoreLock.Lock() - if strings.HasPrefix(SemaphoreID, "hs_l0u3B51") { - s.server.semaphore[SemaphoreID] = NewSemaphore(s.server, SemaphoreID, 32) - if strings.HasSuffix(SemaphoreID, "3") { - s.server.raviente.state.semaphoreID = s.server.semaphore[SemaphoreID].id - } else if strings.HasSuffix(SemaphoreID, "4") { - s.server.raviente.support.semaphoreID = s.server.semaphore[SemaphoreID].id - } else if strings.HasSuffix(SemaphoreID, "5") { - s.server.raviente.register.semaphoreID = s.server.semaphore[SemaphoreID].id + if strings.HasPrefix(SemaphoreID, "hs_l0u3B5") { + suffix, _ := strconv.ParseUint(pkt.SemaphoreID[len(pkt.SemaphoreID)-1:], 10, 32) + s.server.semaphore[SemaphoreID] = &Semaphore{ + id_semaphore: pkt.SemaphoreID, + id: uint32(suffix), + clients: make(map[*Session]uint32), + reservedClientSlots: make(map[uint32]interface{}), + maxPlayers: 32, } } else { s.server.semaphore[SemaphoreID] = NewSemaphore(s.server, SemaphoreID, 1) @@ -123,7 +124,16 @@ func handleMsgSysCreateAcquireSemaphore(s *Session, p mhfpacket.MHFPacket) { } func handleMsgSysAcquireSemaphore(s *Session, p mhfpacket.MHFPacket) { - //pkt := p.(*mhfpacket.MsgSysAcquireSemaphore) + pkt := p.(*mhfpacket.MsgSysAcquireSemaphore) + if sema, exists := s.server.semaphore[pkt.SemaphoreID]; exists { + sema.clients[s] = s.charID + bf := byteframe.NewByteFrame() + bf.WriteUint32(sema.id) + doAckSimpleSucceed(s, pkt.AckHandle, bf.Data()) + } else { + doAckSimpleFail(s, pkt.AckHandle, make([]byte, 4)) + } + } func handleMsgSysReleaseSemaphore(s *Session, p mhfpacket.MHFPacket) { @@ -134,7 +144,7 @@ func handleMsgSysCheckSemaphore(s *Session, p mhfpacket.MHFPacket) { pkt := p.(*mhfpacket.MsgSysCheckSemaphore) resp := []byte{0x00, 0x00, 0x00, 0x00} s.server.semaphoreLock.Lock() - if _, exists := s.server.semaphore[pkt.StageID]; exists { + if _, exists := s.server.semaphore[pkt.SemaphoreID]; exists { resp = []byte{0x00, 0x00, 0x00, 0x01} } s.server.semaphoreLock.Unlock() diff --git a/Erupe/server/channelserver/handlers_shop_gacha.go b/server/channelserver/handlers_shop_gacha.go similarity index 95% rename from Erupe/server/channelserver/handlers_shop_gacha.go rename to server/channelserver/handlers_shop_gacha.go index 910c73c07..7ee712c1a 100644 --- a/Erupe/server/channelserver/handlers_shop_gacha.go +++ b/server/channelserver/handlers_shop_gacha.go @@ -2,11 +2,8 @@ package channelserver import ( "encoding/hex" - "fmt" - "strings" "time" - //"erupe-ce/common/stringsupport" "erupe-ce/common/byteframe" "erupe-ce/network/mhfpacket" "github.com/lib/pq" @@ -14,16 +11,6 @@ import ( "go.uber.org/zap" ) -func contains(s []string, str string) bool { - for _, v := range s { - if v == str { - return true - } - } - - return false -} - func handleMsgMhfEnumerateShop(s *Session, p mhfpacket.MHFPacket) { pkt := p.(*mhfpacket.MsgMhfEnumerateShop) // SHOP TYPES: @@ -162,27 +149,19 @@ func handleMsgMhfEnumerateShop(s *Session, p mhfpacket.MHFPacket) { doAckBufSucceed(s, pkt.AckHandle, []byte{0x00, 0x00, 0x00, 0x00}) } } else { - _, week := time.Now().ISOWeek() - season := fmt.Sprintf("%d", week%4) - shopEntries, err := s.server.db.Query("SELECT itemhash,itemID,Points,TradeQuantity,rankReqLow,rankReqHigh,rankReqG,storeLevelReq,maximumQuantity,boughtQuantity,roadFloorsRequired,weeklyFatalisKills, COALESCE(enable_weeks, '') FROM normal_shop_items WHERE shoptype=$1 AND shopid=$2", pkt.ShopType, pkt.ShopID) + shopEntries, err := s.server.db.Query("SELECT itemhash,itemID,Points,TradeQuantity,rankReqLow,rankReqHigh,rankReqG,storeLevelReq,maximumQuantity,boughtQuantity,roadFloorsRequired,weeklyFatalisKills FROM normal_shop_items WHERE shoptype=$1 AND shopid=$2", pkt.ShopType, pkt.ShopID) if err != nil { panic(err) } var ItemHash, entryCount int var itemID, Points, TradeQuantity, rankReqLow, rankReqHigh, rankReqG, storeLevelReq, maximumQuantity, boughtQuantity, roadFloorsRequired, weeklyFatalisKills, charQuantity uint16 - var itemWeeks string resp := byteframe.NewByteFrame() resp.WriteUint32(0) // total defs for shopEntries.Next() { - err = shopEntries.Scan(&ItemHash, &itemID, &Points, &TradeQuantity, &rankReqLow, &rankReqHigh, &rankReqG, &storeLevelReq, &maximumQuantity, &boughtQuantity, &roadFloorsRequired, &weeklyFatalisKills, &itemWeeks) + err = shopEntries.Scan(&ItemHash, &itemID, &Points, &TradeQuantity, &rankReqLow, &rankReqHigh, &rankReqG, &storeLevelReq, &maximumQuantity, &boughtQuantity, &roadFloorsRequired, &weeklyFatalisKills) if err != nil { panic(err) } - - if len(itemWeeks) > 0 && !contains(strings.Split(itemWeeks, ","), season) { - continue - } - resp.WriteUint32(uint32(ItemHash)) resp.WriteUint16(0) // unk, always 0 in existing packets resp.WriteUint16(itemID) @@ -195,13 +174,9 @@ func handleMsgMhfEnumerateShop(s *Session, p mhfpacket.MHFPacket) { resp.WriteUint16(storeLevelReq) resp.WriteUint16(maximumQuantity) if maximumQuantity > 0 { - var itemWeek int - err = s.server.db.QueryRow("SELECT COALESCE(usedquantity,0), COALESCE(week,-1) FROM shop_item_state WHERE itemhash=$1 AND char_id=$2", ItemHash, s.charID).Scan(&charQuantity, &itemWeek) + err = s.server.db.QueryRow("SELECT COALESCE(usedquantity,0) FROM shop_item_state WHERE itemhash=$1 AND char_id=$2", ItemHash, s.charID).Scan(&charQuantity) if err != nil { resp.WriteUint16(0) - } else if pkt.ShopID == 7 && itemWeek >= 0 && itemWeek != week { - clearShopItemState(s, s.charID, uint32(ItemHash)) - resp.WriteUint16(0) } else { resp.WriteUint16(charQuantity) } @@ -224,7 +199,6 @@ func handleMsgMhfEnumerateShop(s *Session, p mhfpacket.MHFPacket) { } func handleMsgMhfAcquireExchangeShop(s *Session, p mhfpacket.MHFPacket) { - _, week := time.Now().ISOWeek() // writing out to an editable shop enumeration pkt := p.(*mhfpacket.MsgMhfAcquireExchangeShop) if pkt.DataSize == 10 { @@ -232,10 +206,10 @@ func handleMsgMhfAcquireExchangeShop(s *Session, p mhfpacket.MHFPacket) { _ = bf.ReadUint16() // unk, always 1 in examples itemHash := bf.ReadUint32() buyCount := bf.ReadUint32() - _, err := s.server.db.Exec(`INSERT INTO shop_item_state (char_id, itemhash, usedquantity, week) - VALUES ($1,$2,$3,$4) ON CONFLICT (char_id, itemhash) + _, err := s.server.db.Exec(`INSERT INTO shop_item_state (char_id, itemhash, usedquantity) + VALUES ($1,$2,$3) ON CONFLICT (char_id, itemhash) DO UPDATE SET usedquantity = shop_item_state.usedquantity + $3 - WHERE EXCLUDED.char_id=$1 AND EXCLUDED.itemhash=$2`, s.charID, itemHash, buyCount, week) + WHERE EXCLUDED.char_id=$1 AND EXCLUDED.itemhash=$2`, s.charID, itemHash, buyCount) if err != nil { s.logger.Fatal("Failed to update shop_item_state in db", zap.Error(err)) } @@ -243,13 +217,6 @@ func handleMsgMhfAcquireExchangeShop(s *Session, p mhfpacket.MHFPacket) { doAckSimpleSucceed(s, pkt.AckHandle, []byte{0x00, 0x00, 0x00, 0x00}) } -func clearShopItemState(s *Session, charId uint32, itemHash uint32) { - _, err := s.server.db.Exec(`DELETE FROM shop_item_state WHERE char_id=$1 AND itemhash=$2`, charId, itemHash) - if err != nil { - s.logger.Fatal("Failed to delete shop_item_state in db", zap.Error(err)) - } -} - func handleMsgMhfGetGachaPlayHistory(s *Session, p mhfpacket.MHFPacket) { // returns number of times the gacha was played, will need persistent db stuff pkt := p.(*mhfpacket.MsgMhfGetGachaPlayHistory) @@ -735,4 +702,4 @@ func handleMsgMhfResetBoxGachaInfo(s *Session, p mhfpacket.MHFPacket) { panic(err) } doAckSimpleSucceed(s, pkt.AckHandle, []byte{0x00, 0x00, 0x00, 0x00}) -} \ No newline at end of file +} diff --git a/Erupe/server/channelserver/handlers_stage.go b/server/channelserver/handlers_stage.go similarity index 86% rename from Erupe/server/channelserver/handlers_stage.go rename to server/channelserver/handlers_stage.go index 221a99ce4..4bf19d114 100644 --- a/Erupe/server/channelserver/handlers_stage.go +++ b/server/channelserver/handlers_stage.go @@ -1,6 +1,8 @@ package channelserver import ( + "fmt" + "strings" "time" "erupe-ce/common/byteframe" @@ -51,7 +53,7 @@ func doStageTransfer(s *Session, ackHandle uint32, stageID string) { // Save our new stage ID and pointer to the new stage itself. s.Lock() - s.stageID = string(stageID) + s.stageID = stageID s.stage = s.server.stages[stageID] s.Unlock() @@ -61,13 +63,41 @@ func doStageTransfer(s *Session, ackHandle uint32, stageID string) { // Confirm the stage entry. doAckSimpleSucceed(s, ackHandle, []byte{0x00, 0x00, 0x00, 0x00}) + var temp mhfpacket.MHFPacket + newNotif := byteframe.NewByteFrame() + + // Cast existing user data to new user + if !s.userEnteredStage { + s.userEnteredStage = true + + for _, session := range s.server.sessions { + if s == session { + continue + } + temp = &mhfpacket.MsgSysInsertUser{CharID: session.charID} + newNotif.WriteUint16(uint16(temp.Opcode())) + temp.Build(newNotif, s.clientContext) + for i := 0; i < 3; i++ { + temp = &mhfpacket.MsgSysNotifyUserBinary{ + CharID: session.charID, + BinaryType: uint8(i + 1), + } + newNotif.WriteUint16(uint16(temp.Opcode())) + temp.Build(newNotif, s.clientContext) + } + } + } + if s.stage != nil { // avoids lock up when using bed for dream quests // Notify the client to duplicate the existing objects. - s.logger.Info("Sending existing stage objects") - clientDupObjNotif := byteframe.NewByteFrame() + s.logger.Info(fmt.Sprintf("Sending existing stage objects to %s", s.Name)) s.stage.RLock() + var temp mhfpacket.MHFPacket for _, obj := range s.stage.objects { - cur := &mhfpacket.MsgSysDuplicateObject{ + if obj.ownerCharID == s.charID { + continue + } + temp = &mhfpacket.MsgSysDuplicateObject{ ObjID: obj.id, X: obj.x, Y: obj.y, @@ -75,14 +105,15 @@ func doStageTransfer(s *Session, ackHandle uint32, stageID string) { Unk0: 0, OwnerCharID: obj.ownerCharID, } - clientDupObjNotif.WriteUint16(uint16(cur.Opcode())) - cur.Build(clientDupObjNotif, s.clientContext) + newNotif.WriteUint16(uint16(temp.Opcode())) + temp.Build(newNotif, s.clientContext) } s.stage.RUnlock() - clientDupObjNotif.WriteUint16(0x0010) // End it. - if len(clientDupObjNotif.Data()) > 2 { - s.QueueSend(clientDupObjNotif.Data()) - } + } + + newNotif.WriteUint16(0x0010) // End it. + if len(newNotif.Data()) > 2 { + s.QueueSend(newNotif.Data()) } } @@ -91,7 +122,7 @@ func destructEmptyStages(s *Session) { defer s.server.Unlock() for _, stage := range s.server.stages { // Destroy empty Quest/My series/Guild stages. - if stage.id[3:5] == "Qs" || stage.id[3:5] == "Ms" || stage.id[3:5] == "Gs" { + if stage.id[3:5] == "Qs" || stage.id[3:5] == "Ms" || stage.id[3:5] == "Gs" || stage.id[3:5] == "Ls" { if len(stage.reservedClientSlots) == 0 && len(stage.clients) == 0 { delete(s.server.stages, stage.id) s.logger.Debug("Destructed stage", zap.String("stage.id", stage.id)) @@ -168,22 +199,24 @@ func handleMsgSysLeaveStage(s *Session, p mhfpacket.MHFPacket) {} func handleMsgSysLockStage(s *Session, p mhfpacket.MHFPacket) { pkt := p.(*mhfpacket.MsgSysLockStage) // TODO(Andoryuuta): What does this packet _actually_ do? + // I think this is supposed to mark a stage as no longer able to accept client reservations doAckSimpleSucceed(s, pkt.AckHandle, []byte{0x00, 0x00, 0x00, 0x00}) } func handleMsgSysUnlockStage(s *Session, p mhfpacket.MHFPacket) { - s.reservationStage.RLock() - defer s.reservationStage.RUnlock() + if s.reservationStage != nil { + s.reservationStage.RLock() + defer s.reservationStage.RUnlock() - for charID := range s.reservationStage.reservedClientSlots { - session := s.server.FindSessionByCharID(charID) - session.QueueSendMHF(&mhfpacket.MsgSysStageDestruct{}) + for charID := range s.reservationStage.reservedClientSlots { + session := s.server.FindSessionByCharID(charID) + session.QueueSendMHF(&mhfpacket.MsgSysStageDestruct{}) + } + + delete(s.server.stages, s.reservationStage.id) } - s.server.Lock() - defer s.server.Unlock() - - delete(s.server.stages, s.reservationStage.id) + destructEmptyStages(s) } func handleMsgSysReserveStage(s *Session, p mhfpacket.MHFPacket) { @@ -336,8 +369,7 @@ func handleMsgSysEnumerateStage(s *Session, p mhfpacket.MHFPacket) { continue } - // Check for valid stage type - if sid[3:5] != "Qs" && sid[3:5] != "Ms" { + if !strings.Contains(stage.id, pkt.StagePrefix) { continue } diff --git a/Erupe/server/channelserver/handlers_table.go b/server/channelserver/handlers_table.go similarity index 100% rename from Erupe/server/channelserver/handlers_table.go rename to server/channelserver/handlers_table.go diff --git a/Erupe/server/channelserver/handlers_tactics.go b/server/channelserver/handlers_tactics.go similarity index 100% rename from Erupe/server/channelserver/handlers_tactics.go rename to server/channelserver/handlers_tactics.go diff --git a/Erupe/server/channelserver/handlers_tournament.go b/server/channelserver/handlers_tournament.go similarity index 100% rename from Erupe/server/channelserver/handlers_tournament.go rename to server/channelserver/handlers_tournament.go diff --git a/Erupe/server/channelserver/handlers_tower.go b/server/channelserver/handlers_tower.go similarity index 67% rename from Erupe/server/channelserver/handlers_tower.go rename to server/channelserver/handlers_tower.go index 7dad6c860..49029753f 100644 --- a/Erupe/server/channelserver/handlers_tower.go +++ b/server/channelserver/handlers_tower.go @@ -1,8 +1,8 @@ package channelserver import ( + "encoding/hex" "erupe-ce/network/mhfpacket" - "encoding/hex" ) func handleMsgMhfGetTowerInfo(s *Session, p mhfpacket.MHFPacket) { @@ -33,19 +33,19 @@ func handleMsgMhfGetTowerInfo(s *Session, p mhfpacket.MHFPacket) { 01 1d 01 fc 00 0b [00 00 00 05] 00 00 00 00 00 00 00 00 00 12 01 fc 00 0b 01 00 00 10 0a 21 8e ad 00 00 00 00 00 00 00 00 00 00 00 00 */ - switch pkt.InfoType { - case mhfpacket.TowerInfoTypeTowerRankPoint: - data, err = hex.DecodeString("0A218EAD0000000000000000000000010000000000000000") - case mhfpacket.TowerInfoTypeGetOwnTowerSkill: - //data, err = hex.DecodeString("0A218EAD000000000000000000000001000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000") - data, err = hex.DecodeString("0A218EAD0000000000000000000000010000001C0000000500050000000000020000000000000000000000000000000000030003000000000003000500050000000300030003000300030003000200030001000300020002000300010000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000") - case mhfpacket.TowerInfoTypeUnk3: - panic("No known response values for TowerInfoTypeUnk3") - case mhfpacket.TowerInfoTypeTowerTouhaHistory: - data, err = hex.DecodeString("0A218EAD0000000000000000000000010000000000000000000000000000000000000000") - case mhfpacket.TowerInfoTypeUnk5: - data, err = hex.DecodeString("0A218EAD000000000000000000000000") - } + switch pkt.InfoType { + case mhfpacket.TowerInfoTypeTowerRankPoint: + data, err = hex.DecodeString("0A218EAD0000000000000000000000010000000000000000") + case mhfpacket.TowerInfoTypeGetOwnTowerSkill: + //data, err = hex.DecodeString("0A218EAD000000000000000000000001000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000") + data, err = hex.DecodeString("0A218EAD0000000000000000000000010000001C0000000500050000000000020000000000000000000000000000000000030003000000000003000500050000000300030003000300030003000200030001000300020002000300010000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000") + case mhfpacket.TowerInfoTypeUnk3: + panic("No known response values for TowerInfoTypeUnk3") + case mhfpacket.TowerInfoTypeTowerTouhaHistory: + data, err = hex.DecodeString("0A218EAD0000000000000000000000010000000000000000000000000000000000000000") + case mhfpacket.TowerInfoTypeUnk5: + data, err = hex.DecodeString("0A218EAD000000000000000000000000") + } if err != nil { stubGetNoResults(s, pkt.AckHandle) @@ -60,4 +60,4 @@ func handleMsgMhfPostTowerInfo(s *Session, p mhfpacket.MHFPacket) { func handleMsgMhfGetGemInfo(s *Session, p mhfpacket.MHFPacket) {} -func handleMsgMhfPostGemInfo(s *Session, p mhfpacket.MHFPacket) {} \ No newline at end of file +func handleMsgMhfPostGemInfo(s *Session, p mhfpacket.MHFPacket) {} diff --git a/server/channelserver/handlers_users.go b/server/channelserver/handlers_users.go new file mode 100644 index 000000000..6db6613c0 --- /dev/null +++ b/server/channelserver/handlers_users.go @@ -0,0 +1,65 @@ +package channelserver + +import ( + "fmt" + + "erupe-ce/common/byteframe" + "erupe-ce/network/mhfpacket" +) + +func handleMsgSysInsertUser(s *Session, p mhfpacket.MHFPacket) {} + +func handleMsgSysDeleteUser(s *Session, p mhfpacket.MHFPacket) {} + +func handleMsgSysSetUserBinary(s *Session, p mhfpacket.MHFPacket) { + pkt := p.(*mhfpacket.MsgSysSetUserBinary) + s.server.userBinaryPartsLock.Lock() + s.server.userBinaryParts[userBinaryPartID{charID: s.charID, index: pkt.BinaryType}] = pkt.RawDataPayload + s.server.userBinaryPartsLock.Unlock() + + err := s.server.db.QueryRow("SELECT type2 FROM user_binaries WHERE id=$1", s.charID) + if err != nil { + s.server.db.Exec("INSERT INTO user_binaries (id) VALUES ($1)", s.charID) + } + + s.server.db.Exec(fmt.Sprintf("UPDATE user_binaries SET type%d=$1 WHERE id=$2", pkt.BinaryType), pkt.RawDataPayload, s.charID) + + msg := &mhfpacket.MsgSysNotifyUserBinary{ + CharID: s.charID, + BinaryType: pkt.BinaryType, + } + + s.server.BroadcastMHF(msg, s) +} + +func handleMsgSysGetUserBinary(s *Session, p mhfpacket.MHFPacket) { + pkt := p.(*mhfpacket.MsgSysGetUserBinary) + + // Try to get the data. + s.server.userBinaryPartsLock.RLock() + defer s.server.userBinaryPartsLock.RUnlock() + data, ok := s.server.userBinaryParts[userBinaryPartID{charID: pkt.CharID, index: pkt.BinaryType}] + resp := byteframe.NewByteFrame() + + // If we can't get the real data, try to get it from the database. + if !ok { + var data []byte + rows, _ := s.server.db.Queryx(fmt.Sprintf("SELECT type%d FROM user_binaries WHERE id=$1", pkt.BinaryType), pkt.CharID) + for rows.Next() { + rows.Scan(&data) + resp.WriteBytes(data) + doAckBufSucceed(s, pkt.AckHandle, resp.Data()) + return + } + doAckBufFail(s, pkt.AckHandle, make([]byte, 4)) + return + } else { + resp.WriteBytes(data) + } + + doAckBufSucceed(s, pkt.AckHandle, resp.Data()) +} + +func handleMsgSysNotifyUserBinary(s *Session, p mhfpacket.MHFPacket) {} + +func handleMsgMhfGetBbsUserStatus(s *Session, p mhfpacket.MHFPacket) {} diff --git a/Erupe/server/channelserver/sys_channel_server.go b/server/channelserver/sys_channel_server.go similarity index 85% rename from Erupe/server/channelserver/sys_channel_server.go rename to server/channelserver/sys_channel_server.go index 8b530ee13..a23ec2834 100644 --- a/Erupe/server/channelserver/sys_channel_server.go +++ b/server/channelserver/sys_channel_server.go @@ -5,8 +5,8 @@ import ( "net" "sync" - ps "erupe-ce/common/pascalstring" "erupe-ce/common/byteframe" + ps "erupe-ce/common/pascalstring" "erupe-ce/config" "erupe-ce/network/binpacket" "erupe-ce/network/mhfpacket" @@ -19,17 +19,17 @@ type StageIdType = string const ( // GlobalStage is the stage that is used for all users. - MezeportaStageId StageIdType = "sl1Ns200p0a0u0" - GuildHallLv1StageId StageIdType = "sl1Ns202p0a0u0" - GuildHallLv2StageId StageIdType = "sl1Ns203p0a0u0" - GuildHallLv3StageId StageIdType = "sl1Ns204p0a0u0" - PugiFarmStageId StageIdType = "sl1Ns205p0a0u0" - RastaBarStageId StageIdType = "sl1Ns211p0a0u0" - PalloneCaravanStageId StageIdType = "sl1Ns260p0a0u0" - GookFarmStageId StageIdType = "sl1Ns265p0a0u0" - DivaFountainStageId StageIdType = "sl2Ns379p0a0u0" - DivaHallStageId StageIdType = "sl1Ns445p0a0u0" - MezFesStageId StageIdType = "sl1Ns462p0a0u0" + MezeportaStageId StageIdType = "sl1Ns200p0a0u0" + GuildHallLv1StageId StageIdType = "sl1Ns202p0a0u0" + GuildHallLv2StageId StageIdType = "sl1Ns203p0a0u0" + GuildHallLv3StageId StageIdType = "sl1Ns204p0a0u0" + PugiFarmStageId StageIdType = "sl1Ns205p0a0u0" + RastaBarStageId StageIdType = "sl1Ns211p0a0u0" + PalloneCaravanStageId StageIdType = "sl1Ns260p0a0u0" + GookFarmStageId StageIdType = "sl1Ns265p0a0u0" + DivaFountainStageId StageIdType = "sl2Ns379p0a0u0" + DivaHallStageId StageIdType = "sl1Ns445p0a0u0" + MezFesStageId StageIdType = "sl1Ns462p0a0u0" ) // Config struct allows configuring the server. @@ -54,6 +54,8 @@ type Server struct { sync.Mutex Channels []*Server ID uint16 + IP string + Port uint16 logger *zap.Logger db *sqlx.DB erupeConfig *config.Config @@ -93,7 +95,6 @@ type Raviente struct { } type RavienteRegister struct { - semaphoreID uint32 nextTime uint32 startTime uint32 postTime uint32 @@ -105,13 +106,11 @@ type RavienteRegister struct { } type RavienteState struct { - semaphoreID uint32 damageMultiplier uint32 stateData []uint32 } type RavienteSupport struct { - semaphoreID uint32 supportData []uint32 } @@ -155,7 +154,7 @@ func NewServer(config *Config) *Server { stages: make(map[string]*Stage), userBinaryParts: make(map[userBinaryPartID][]byte), semaphore: make(map[string]*Semaphore), - semaphoreIndex: 0, + semaphoreIndex: 5, discordBot: config.DiscordBot, name: config.Name, enable: config.Enable, @@ -199,8 +198,8 @@ func NewServer(config *Config) *Server { } // Start starts the server in a new goroutine. -func (s *Server) Start(port int) error { - l, err := net.Listen("tcp", fmt.Sprintf(":%d", port)) +func (s *Server) Start() error { + l, err := net.Listen("tcp", fmt.Sprintf(":%d", s.Port)) if err != nil { return err } @@ -282,7 +281,7 @@ func (s *Server) manageSessions() { func (s *Server) BroadcastMHF(pkt mhfpacket.MHFPacket, ignoredSession *Session) { // Broadcast the data. for _, session := range s.sessions { - if session == ignoredSession || !session.binariesDone { + if session == ignoredSession { continue } @@ -298,10 +297,13 @@ func (s *Server) BroadcastMHF(pkt mhfpacket.MHFPacket, ignoredSession *Session) } } -func (s *Server) WorldcastMHF(pkt mhfpacket.MHFPacket, ignoredSession *Session) { +func (s *Server) WorldcastMHF(pkt mhfpacket.MHFPacket, ignoredSession *Session, ignoredChannel *Server) { for _, c := range s.Channels { + if c == ignoredChannel { + continue + } for _, session := range c.sessions { - if session == ignoredSession || !session.binariesDone { + if session == ignoredSession { continue } bf := byteframe.NewByteFrame() @@ -335,9 +337,9 @@ func (s *Server) BroadcastChatMessage(message string) { func (s *Server) BroadcastRaviente(ip uint32, port uint16, stage []byte, _type uint8) { bf := byteframe.NewByteFrame() bf.SetLE() - bf.WriteUint16(0) // Unk + bf.WriteUint16(0) // Unk bf.WriteUint16(0x43) // Data len - bf.WriteUint16(3) // Unk len + bf.WriteUint16(3) // Unk len var text string switch _type { case 2: @@ -351,17 +353,16 @@ func (s *Server) BroadcastRaviente(ip uint32, port uint16, stage []byte, _type u } ps.Uint16(bf, text, false) bf.WriteBytes([]byte{0x5F, 0x53, 0x00}) - bf.WriteUint32(ip) // IP address + bf.WriteUint32(ip) // IP address bf.WriteUint16(port) // Port - bf.WriteUint16(0) // Unk - bf.WriteNullTerminatedBytes(stage) - bf.WriteBytes(make([]byte, 17)) + bf.WriteUint16(0) // Unk + bf.WriteBytes(stage) s.WorldcastMHF(&mhfpacket.MsgSysCastedBinary{ - CharID: 0x00000000, - BroadcastType: BroadcastTypeSemaphore, - MessageType: BinaryMessageTypeChat, + CharID: 0x00000000, + BroadcastType: BroadcastTypeServer, + MessageType: BinaryMessageTypeChat, RawDataPayload: bf.Data(), - }, nil) + }, nil, s) } func (s *Server) DiscordChannelSend(charName string, content string) { @@ -379,6 +380,7 @@ func (s *Server) FindSessionByCharID(charID uint32) *Session { for client := range stage.clients { if client.charID == charID { stage.RUnlock() + c.stagesLock.RUnlock() return client } } @@ -408,6 +410,17 @@ func (s *Server) FindObjectByChar(charID uint32) *Object { } func (s *Server) NextSemaphoreID() uint32 { - s.semaphoreIndex = s.semaphoreIndex + 1 + for { + exists := false + s.semaphoreIndex = s.semaphoreIndex + 1 + for _, semaphore := range s.semaphore { + if semaphore.id == s.semaphoreIndex { + exists = true + } + } + if exists == false { + break + } + } return s.semaphoreIndex } diff --git a/Erupe/server/channelserver/sys_semaphore.go b/server/channelserver/sys_semaphore.go similarity index 100% rename from Erupe/server/channelserver/sys_semaphore.go rename to server/channelserver/sys_semaphore.go diff --git a/Erupe/server/channelserver/sys_session.go b/server/channelserver/sys_session.go similarity index 96% rename from Erupe/server/channelserver/sys_session.go rename to server/channelserver/sys_session.go index b2a591c8d..20fc432f8 100644 --- a/Erupe/server/channelserver/sys_session.go +++ b/server/channelserver/sys_session.go @@ -27,12 +27,13 @@ type Session struct { sendPackets chan []byte clientContext *clientctx.ClientContext + userEnteredStage bool // If the user has entered a stage before myseries MySeries stageID string stage *Stage reservationStage *Stage // Required for the stateful MsgSysUnreserveStage packet. stagePass string // Temporary storage - binariesDone bool + prevGuildID uint32 // Stores the last GuildID used in InfoGuild charID uint32 logKey []byte sessionStart int64 @@ -79,9 +80,9 @@ func NewSession(server *Server, conn net.Conn) *Session { Encoding: japanese.ShiftJIS, }, }, - binariesDone: false, - sessionStart: Time_Current_Adjusted().Unix(), - stageMoveStack: stringstack.New(), + userEnteredStage: false, + sessionStart: Time_Current_Adjusted().Unix(), + stageMoveStack: stringstack.New(), } return s } diff --git a/Erupe/server/channelserver/sys_stage.go b/server/channelserver/sys_stage.go similarity index 87% rename from Erupe/server/channelserver/sys_stage.go rename to server/channelserver/sys_stage.go index 3d0d68d28..9a968bf3f 100644 --- a/Erupe/server/channelserver/sys_stage.go +++ b/server/channelserver/sys_stage.go @@ -15,7 +15,6 @@ type Object struct { id uint32 ownerCharID uint32 x, y, z float32 - binary []byte } // stageBinaryKey is a struct used as a map key for identifying a stage binary part. @@ -33,7 +32,7 @@ type Stage struct { // Objects objects map[uint32]*Object - objectIndex uint32 + objectIndex uint8 // Map of session -> charID. // These are clients that are CURRENTLY in the stage @@ -71,7 +70,7 @@ func NewStage(ID string) *Stage { func (s *Stage) BroadcastMHF(pkt mhfpacket.MHFPacket, ignoredSession *Session) { // Broadcast the data. for session := range s.clients { - if session == ignoredSession || !session.binariesDone { + if session == ignoredSession { continue } @@ -130,5 +129,15 @@ func (s *Stage) GetName() string { func (s *Stage) NextObjectID() uint32 { s.objectIndex = s.objectIndex + 1 - return s.objectIndex + // Objects beyond 127 do not duplicate correctly + // Indexes 0 and 127 does not update position correctly + if s.objectIndex == 127 { + s.objectIndex = 1 + } + bf := byteframe.NewByteFrame() + bf.WriteUint8(0) + bf.WriteUint8(s.objectIndex) + bf.WriteUint16(0) + obj := uint32(bf.Data()[3]) | uint32(bf.Data()[2])<<8 | uint32(bf.Data()[1])<<16 | uint32(bf.Data()[0])<<24 + return obj } diff --git a/Erupe/server/channelserver/sys_timefix.go b/server/channelserver/sys_timefix.go similarity index 100% rename from Erupe/server/channelserver/sys_timefix.go rename to server/channelserver/sys_timefix.go diff --git a/Erupe/server/channelserver/timeserver/time_mode.go b/server/channelserver/timeserver/time_mode.go similarity index 100% rename from Erupe/server/channelserver/timeserver/time_mode.go rename to server/channelserver/timeserver/time_mode.go diff --git a/Erupe/server/discordbot/discord_bot.go b/server/discordbot/discord_bot.go similarity index 100% rename from Erupe/server/discordbot/discord_bot.go rename to server/discordbot/discord_bot.go diff --git a/Erupe/server/entranceserver/crypto.go b/server/entranceserver/crypto.go similarity index 100% rename from Erupe/server/entranceserver/crypto.go rename to server/entranceserver/crypto.go diff --git a/Erupe/server/entranceserver/crypto_test.go b/server/entranceserver/crypto_test.go similarity index 100% rename from Erupe/server/entranceserver/crypto_test.go rename to server/entranceserver/crypto_test.go diff --git a/Erupe/server/entranceserver/entrance_server.go b/server/entranceserver/entrance_server.go similarity index 100% rename from Erupe/server/entranceserver/entrance_server.go rename to server/entranceserver/entrance_server.go diff --git a/Erupe/server/entranceserver/make_resp.go b/server/entranceserver/make_resp.go similarity index 87% rename from Erupe/server/entranceserver/make_resp.go rename to server/entranceserver/make_resp.go index 08f5a87ff..c0358faef 100644 --- a/Erupe/server/entranceserver/make_resp.go +++ b/server/entranceserver/make_resp.go @@ -22,13 +22,13 @@ func encodeServerInfo(config *config.Config, s *Server) []byte { bf := byteframe.NewByteFrame() for serverIdx, si := range serverInfos { - sid := (4096 + serverIdx * 256) + 16 + sid := (4096 + serverIdx*256) + 16 err := s.db.QueryRow("SELECT season FROM servers WHERE server_id=$1", sid).Scan(&season) if err != nil { panic(err) } if si.IP == "" { - si.IP = config.HostIP + si.IP = config.Host } bf.WriteUint32(binary.LittleEndian.Uint32(net.ParseIP(si.IP).To4())) bf.WriteUint16(16 + uint16(serverIdx)) @@ -37,14 +37,14 @@ func encodeServerInfo(config *config.Config, s *Server) []byte { bf.WriteUint8(si.Type) bf.WriteUint8(season) bf.WriteUint8(si.Recommended) - combined := append([]byte{0x00}, stringsupport.UTF8ToSJIS(si.Name)...) - combined = append(combined, []byte{0x00}...) + bf.WriteUint8(0) // Prevents malformed server name + combined := append(stringsupport.UTF8ToSJIS(si.Name), []byte{0x00}...) combined = append(combined, stringsupport.UTF8ToSJIS(si.Description)...) - bf.WriteBytes(stringsupport.PaddedString(string(combined), 66, false)) + bf.WriteBytes(stringsupport.PaddedString(string(combined), 65, false)) bf.WriteUint32(si.AllowedClientFlags) for channelIdx, ci := range si.Channels { - sid = (4096 + serverIdx * 256) + (16 + channelIdx) + sid = (4096 + serverIdx*256) + (16 + channelIdx) bf.WriteUint16(ci.Port) bf.WriteUint16(16 + uint16(channelIdx)) bf.WriteUint16(ci.MaxPlayers) @@ -56,9 +56,9 @@ func encodeServerInfo(config *config.Config, s *Server) []byte { bf.WriteUint32(0) bf.WriteUint32(0) bf.WriteUint32(0) - bf.WriteUint16(ci.Unk0) - bf.WriteUint16(ci.Unk1) - bf.WriteUint16(ci.Unk2) + bf.WriteUint16(319) // Unk + bf.WriteUint16(252) // Unk + bf.WriteUint16(248) // Unk bf.WriteUint16(0x3039) } } diff --git a/Erupe/server/launcherserver/handler.go b/server/launcherserver/handler.go similarity index 100% rename from Erupe/server/launcherserver/handler.go rename to server/launcherserver/handler.go diff --git a/Erupe/server/launcherserver/launcher_server.go b/server/launcherserver/launcher_server.go similarity index 100% rename from Erupe/server/launcherserver/launcher_server.go rename to server/launcherserver/launcher_server.go diff --git a/Erupe/server/launcherserver/routes.go b/server/launcherserver/routes.go similarity index 99% rename from Erupe/server/launcherserver/routes.go rename to server/launcherserver/routes.go index c951bf08a..59c47bba7 100644 --- a/Erupe/server/launcherserver/routes.go +++ b/server/launcherserver/routes.go @@ -12,7 +12,7 @@ import ( func serverList(s *Server, w http.ResponseWriter, r *http.Request) { fmt.Fprintf(w, ``, - s.erupeConfig.HostIP, + s.erupeConfig.Host, s.erupeConfig.Sign.Port, ) } diff --git a/Erupe/server/signserver/dbutils.go b/server/signserver/dbutils.go similarity index 88% rename from Erupe/server/signserver/dbutils.go rename to server/signserver/dbutils.go index 1b5662dc8..8f1b89a01 100644 --- a/Erupe/server/signserver/dbutils.go +++ b/server/signserver/dbutils.go @@ -1,8 +1,8 @@ package signserver import ( - "time" "strings" + "time" "golang.org/x/crypto/bcrypt" ) @@ -75,19 +75,19 @@ func (s *Server) registerDBAccount(username string, password string) error { } type character struct { - ID uint32 `db:"id"` - IsFemale bool `db:"is_female"` - IsNewCharacter bool `db:"is_new_character"` - Name string `db:"name"` - UnkDescString string `db:"unk_desc_string"` - HRP uint16 `db:"hrp"` - GR uint16 `db:"gr"` - WeaponType uint16 `db:"weapon_type"` - LastLogin uint32 `db:"last_login"` + ID uint32 `db:"id"` + IsFemale bool `db:"is_female"` + IsNewCharacter bool `db:"is_new_character"` + Name string `db:"name"` + UnkDescString string `db:"unk_desc_string"` + HRP uint16 `db:"hrp"` + GR uint16 `db:"gr"` + WeaponType uint16 `db:"weapon_type"` + LastLogin uint32 `db:"last_login"` } func (s *Server) getCharactersForUser(uid int) ([]character, error) { - characters := []character{} + characters := make([]character, 0) err := s.db.Select(&characters, "SELECT id, is_female, is_new_character, name, unk_desc_string, hrp, gr, weapon_type, last_login FROM characters WHERE user_id = $1 AND deleted = false", uid) if err != nil { return nil, err @@ -113,7 +113,7 @@ type members struct { Name string `db:"name"` } -func (s *Server) getFriendsForCharacters(chars []character) ([]members) { +func (s *Server) getFriendsForCharacters(chars []character) []members { friends := make([]members, 0) for _, char := range chars { friendsCSV := "" @@ -122,11 +122,11 @@ func (s *Server) getFriendsForCharacters(chars []character) ([]members) { friendQuery := "SELECT id, name FROM characters WHERE id=" for i := 0; i < len(friendsSlice); i++ { friendQuery += friendsSlice[i] - if i + 1 != len(friendsSlice) { + if i+1 != len(friendsSlice) { friendQuery += " OR id=" } } - charFriends := []members{} + charFriends := make([]members, 0) err = s.db.Select(&charFriends, friendQuery) if err != nil { continue @@ -142,7 +142,7 @@ func (s *Server) getFriendsForCharacters(chars []character) ([]members) { return friends } -func (s *Server) getGuildmatesForCharacters(chars []character) ([]members) { +func (s *Server) getGuildmatesForCharacters(chars []character) []members { guildmates := make([]members, 0) for _, char := range chars { var inGuild int @@ -153,7 +153,7 @@ func (s *Server) getGuildmatesForCharacters(chars []character) ([]members) { if err != nil { continue } - charGuildmates := []members{} + charGuildmates := make([]members, 0) err = s.db.Select(&charGuildmates, "SELECT character_id AS id, c.name FROM guild_characters gc JOIN characters c ON c.id = gc.character_id WHERE guild_id=$1 AND character_id!=$2", guildID, char.ID) if err != nil { continue diff --git a/Erupe/server/signserver/dsgn_resp.go b/server/signserver/dsgn_resp.go similarity index 65% rename from Erupe/server/signserver/dsgn_resp.go rename to server/signserver/dsgn_resp.go index 103223dda..650188000 100644 --- a/Erupe/server/signserver/dsgn_resp.go +++ b/server/signserver/dsgn_resp.go @@ -1,13 +1,13 @@ package signserver import ( + "erupe-ce/common/byteframe" + ps "erupe-ce/common/pascalstring" + "erupe-ce/common/stringsupport" + "erupe-ce/server/channelserver" "fmt" "math/rand" "time" - "erupe-ce/server/channelserver" - "erupe-ce/common/stringsupport" - ps "erupe-ce/common/pascalstring" - "erupe-ce/common/byteframe" "go.uber.org/zap" ) @@ -47,7 +47,7 @@ func (s *Session) makeSignInResp(uid int) []byte { bf.WriteUint32(0xFFFFFFFF) // login_token_number bf.WriteBytes([]byte(token)) // login_token bf.WriteUint32(uint32(time.Now().Unix())) // current time - ps.Uint8(bf, fmt.Sprintf("%s:%d", s.server.erupeConfig.HostIP, s.server.erupeConfig.Entrance.Port), false) + ps.Uint8(bf, fmt.Sprintf("%s:%d", s.server.erupeConfig.Host, s.server.erupeConfig.Entrance.Port), false) lastPlayed := uint32(0) for _, char := range chars { @@ -63,13 +63,13 @@ func (s *Session) makeSignInResp(uid int) []byte { bf.WriteUint16(char.HRP) } - bf.WriteUint16(char.WeaponType) // Weapon, 0-13. - bf.WriteUint32(char.LastLogin) // Last login date, unix timestamp in seconds. - bf.WriteBool(char.IsFemale) // Sex, 0=male, 1=female. - bf.WriteBool(char.IsNewCharacter) // Is new character, 1 replaces character name with ?????. - bf.WriteUint8(0) // Old GR - bf.WriteBool(true) // Use uint16 GR, no reason not to - bf.WriteBytes(stringsupport.PaddedString(char.Name, 16, true)) // Character name + bf.WriteUint16(char.WeaponType) // Weapon, 0-13. + bf.WriteUint32(char.LastLogin) // Last login date, unix timestamp in seconds. + bf.WriteBool(char.IsFemale) // Sex, 0=male, 1=female. + bf.WriteBool(char.IsNewCharacter) // Is new character, 1 replaces character name with ?????. + bf.WriteUint8(0) // Old GR + bf.WriteBool(true) // Use uint16 GR, no reason not to + bf.WriteBytes(stringsupport.PaddedString(char.Name, 16, true)) // Character name bf.WriteBytes(stringsupport.PaddedString(char.UnkDescString, 32, false)) // unk str bf.WriteUint16(char.GR) bf.WriteUint16(0) // Unk @@ -99,16 +99,19 @@ func (s *Session) makeSignInResp(uid int) []byte { } } - bf.WriteUint8(0) // notice_count + if s.server.erupeConfig.DevModeOptions.HideLoginNotice { + bf.WriteUint8(0) + } else { + bf.WriteUint8(1) // Notice count + noticeText := s.server.erupeConfig.DevModeOptions.LoginNotice + ps.Uint32(bf, noticeText, true) + } - // noticeText := "
Welcome to Erupe SU9!
Erupe is experimental software, we are not liable for any
issues caused by installing the software!

■Report bugs on Discord!

■Test everything!

■Don't talk to softlocking NPCs!

■Fork the code on GitHub!

Thank you to all of the contributors,

this wouldn't exist without you." - // ps.Uint32(bf, noticeText, true) - - bf.WriteUint32(s.server.getLastCID(uid)) // last played character id - bf.WriteUint32(s.server.getUserRights(uid)) // course bitfield - ps.Uint16(bf, "", false) // filters + bf.WriteUint32(s.server.getLastCID(uid)) + bf.WriteUint32(s.server.getUserRights(uid)) + ps.Uint16(bf, "", false) // filters bf.WriteUint32(0xCA104E20) - ps.Uint16(bf, "", false) // encryption + ps.Uint16(bf, "", false) // encryption bf.WriteUint8(0x00) bf.WriteUint32(0xCA110001) bf.WriteUint32(0x4E200000) @@ -125,14 +128,16 @@ func (s *Session) makeSignInResp(uid int) []byte { bf.WriteUint32(0x0A5197DF) mezfes := s.server.erupeConfig.DevModeOptions.MezFesEvent - alt := false + alt := s.server.erupeConfig.DevModeOptions.MezFesAlt if mezfes { - bf.WriteUint32(uint32(channelserver.Time_Current_Adjusted().Add(-5 * time.Minute).Unix())) // Start time - bf.WriteUint32(uint32(channelserver.Time_Current_Adjusted().Add(24 * time.Hour * 7).Unix())) // End time - bf.WriteUint8(2) // Unk - bf.WriteUint32(0) // Single tickets - bf.WriteUint32(0) // Group tickets - bf.WriteUint8(8) // Stalls open + // Start time + bf.WriteUint32(uint32(channelserver.Time_Current_Adjusted().Add(-5 * time.Minute).Unix())) + // End time + bf.WriteUint32(uint32(channelserver.Time_Current_Adjusted().Add(24 * time.Hour * 7).Unix())) + bf.WriteUint8(2) // Unk + bf.WriteUint32(20) // Single tickets + bf.WriteUint32(10) // Group tickets + bf.WriteUint8(8) // Stalls open bf.WriteUint8(0xA) // Unk bf.WriteUint8(0x3) // Pachinko bf.WriteUint8(0x6) // Nyanrendo @@ -140,7 +145,7 @@ func (s *Session) makeSignInResp(uid int) []byte { if alt { bf.WriteUint8(0x2) // Tokotoko } else { - bf.WriteUint8(0x4) // Volpkun + bf.WriteUint8(0x4) // Volpakkun } bf.WriteUint8(0x8) // Battle cats bf.WriteUint8(0x5) // Gook diff --git a/Erupe/server/signserver/respid.go b/server/signserver/respid.go similarity index 100% rename from Erupe/server/signserver/respid.go rename to server/signserver/respid.go diff --git a/Erupe/server/signserver/session.go b/server/signserver/session.go similarity index 97% rename from Erupe/server/signserver/session.go rename to server/signserver/session.go index af900a84a..aef6508b1 100644 --- a/Erupe/server/signserver/session.go +++ b/server/signserver/session.go @@ -6,8 +6,8 @@ import ( "net" "sync" - "erupe-ce/network" "erupe-ce/common/byteframe" + "erupe-ce/network" "go.uber.org/zap" "golang.org/x/crypto/bcrypt" ) @@ -89,8 +89,8 @@ func (s *Session) handleDSGNRequest(bf *byteframe.ByteFrame) error { newCharaReq := false - if reqUsername[len(reqUsername) - 1] == 43 { // '+' - reqUsername = reqUsername[:len(reqUsername) - 1] + if reqUsername[len(reqUsername)-1] == 43 { // '+' + reqUsername = reqUsername[:len(reqUsername)-1] newCharaReq = true } diff --git a/Erupe/server/signserver/sign_server.go b/server/signserver/sign_server.go similarity index 100% rename from Erupe/server/signserver/sign_server.go rename to server/signserver/sign_server.go diff --git a/Erupe/www/erupe/css/main.css b/www/erupe/css/main.css similarity index 100% rename from Erupe/www/erupe/css/main.css rename to www/erupe/css/main.css diff --git a/Erupe/www/erupe/img/background.png b/www/erupe/img/background.png similarity index 100% rename from Erupe/www/erupe/img/background.png rename to www/erupe/img/background.png diff --git a/Erupe/www/erupe/img/button_charsel.png b/www/erupe/img/button_charsel.png similarity index 100% rename from Erupe/www/erupe/img/button_charsel.png rename to www/erupe/img/button_charsel.png diff --git a/Erupe/www/erupe/img/button_charsel_char.jpg b/www/erupe/img/button_charsel_char.jpg similarity index 100% rename from Erupe/www/erupe/img/button_charsel_char.jpg rename to www/erupe/img/button_charsel_char.jpg diff --git a/Erupe/www/erupe/img/button_charsel_hover.png b/www/erupe/img/button_charsel_hover.png similarity index 100% rename from Erupe/www/erupe/img/button_charsel_hover.png rename to www/erupe/img/button_charsel_hover.png diff --git a/Erupe/www/erupe/img/button_config.png b/www/erupe/img/button_config.png similarity index 100% rename from Erupe/www/erupe/img/button_config.png rename to www/erupe/img/button_config.png diff --git a/Erupe/www/erupe/img/button_config_hover.png b/www/erupe/img/button_config_hover.png similarity index 100% rename from Erupe/www/erupe/img/button_config_hover.png rename to www/erupe/img/button_config_hover.png diff --git a/Erupe/www/erupe/img/button_launch.png b/www/erupe/img/button_launch.png similarity index 100% rename from Erupe/www/erupe/img/button_launch.png rename to www/erupe/img/button_launch.png diff --git a/Erupe/www/erupe/img/button_launch_hover.png b/www/erupe/img/button_launch_hover.png similarity index 100% rename from Erupe/www/erupe/img/button_launch_hover.png rename to www/erupe/img/button_launch_hover.png diff --git a/Erupe/www/erupe/img/button_option.png b/www/erupe/img/button_option.png similarity index 100% rename from Erupe/www/erupe/img/button_option.png rename to www/erupe/img/button_option.png diff --git a/Erupe/www/erupe/img/button_option_hover.png b/www/erupe/img/button_option_hover.png similarity index 100% rename from Erupe/www/erupe/img/button_option_hover.png rename to www/erupe/img/button_option_hover.png diff --git a/Erupe/www/erupe/img/icons/bow.png b/www/erupe/img/icons/bow.png similarity index 100% rename from Erupe/www/erupe/img/icons/bow.png rename to www/erupe/img/icons/bow.png diff --git a/Erupe/www/erupe/img/icons/db.png b/www/erupe/img/icons/db.png similarity index 100% rename from Erupe/www/erupe/img/icons/db.png rename to www/erupe/img/icons/db.png diff --git a/Erupe/www/erupe/img/icons/discord.png b/www/erupe/img/icons/discord.png similarity index 100% rename from Erupe/www/erupe/img/icons/discord.png rename to www/erupe/img/icons/discord.png diff --git a/Erupe/www/erupe/img/icons/github.png b/www/erupe/img/icons/github.png similarity index 100% rename from Erupe/www/erupe/img/icons/github.png rename to www/erupe/img/icons/github.png diff --git a/Erupe/www/erupe/img/icons/gl.png b/www/erupe/img/icons/gl.png similarity index 100% rename from Erupe/www/erupe/img/icons/gl.png rename to www/erupe/img/icons/gl.png diff --git a/Erupe/www/erupe/img/icons/gs.png b/www/erupe/img/icons/gs.png similarity index 100% rename from Erupe/www/erupe/img/icons/gs.png rename to www/erupe/img/icons/gs.png diff --git a/Erupe/www/erupe/img/icons/hbg.png b/www/erupe/img/icons/hbg.png similarity index 100% rename from Erupe/www/erupe/img/icons/hbg.png rename to www/erupe/img/icons/hbg.png diff --git a/Erupe/www/erupe/img/icons/hh.png b/www/erupe/img/icons/hh.png similarity index 100% rename from Erupe/www/erupe/img/icons/hh.png rename to www/erupe/img/icons/hh.png diff --git a/Erupe/www/erupe/img/icons/hm.png b/www/erupe/img/icons/hm.png similarity index 100% rename from Erupe/www/erupe/img/icons/hm.png rename to www/erupe/img/icons/hm.png diff --git a/Erupe/www/erupe/img/icons/ico_title.png b/www/erupe/img/icons/ico_title.png similarity index 100% rename from Erupe/www/erupe/img/icons/ico_title.png rename to www/erupe/img/icons/ico_title.png diff --git a/Erupe/www/erupe/img/icons/lbg.png b/www/erupe/img/icons/lbg.png similarity index 100% rename from Erupe/www/erupe/img/icons/lbg.png rename to www/erupe/img/icons/lbg.png diff --git a/Erupe/www/erupe/img/icons/ln.png b/www/erupe/img/icons/ln.png similarity index 100% rename from Erupe/www/erupe/img/icons/ln.png rename to www/erupe/img/icons/ln.png diff --git a/Erupe/www/erupe/img/icons/ls.png b/www/erupe/img/icons/ls.png similarity index 100% rename from Erupe/www/erupe/img/icons/ls.png rename to www/erupe/img/icons/ls.png diff --git a/Erupe/www/erupe/img/icons/ms.png b/www/erupe/img/icons/ms.png similarity index 100% rename from Erupe/www/erupe/img/icons/ms.png rename to www/erupe/img/icons/ms.png diff --git a/Erupe/www/erupe/img/icons/sa.png b/www/erupe/img/icons/sa.png similarity index 100% rename from Erupe/www/erupe/img/icons/sa.png rename to www/erupe/img/icons/sa.png diff --git a/Erupe/www/erupe/img/icons/ss.png b/www/erupe/img/icons/ss.png similarity index 100% rename from Erupe/www/erupe/img/icons/ss.png rename to www/erupe/img/icons/ss.png diff --git a/Erupe/www/erupe/img/icons/tf.png b/www/erupe/img/icons/tf.png similarity index 100% rename from Erupe/www/erupe/img/icons/tf.png rename to www/erupe/img/icons/tf.png diff --git a/Erupe/www/erupe/img/icons/uk.png b/www/erupe/img/icons/uk.png similarity index 100% rename from Erupe/www/erupe/img/icons/uk.png rename to www/erupe/img/icons/uk.png diff --git a/Erupe/www/erupe/img/load.gif b/www/erupe/img/load.gif similarity index 100% rename from Erupe/www/erupe/img/load.gif rename to www/erupe/img/load.gif diff --git a/Erupe/www/erupe/img/logo.png b/www/erupe/img/logo.png similarity index 100% rename from Erupe/www/erupe/img/logo.png rename to www/erupe/img/logo.png diff --git a/Erupe/www/erupe/img/manual.png b/www/erupe/img/manual.png similarity index 100% rename from Erupe/www/erupe/img/manual.png rename to www/erupe/img/manual.png diff --git a/Erupe/www/erupe/img/modelbg.jpeg b/www/erupe/img/modelbg.jpeg similarity index 100% rename from Erupe/www/erupe/img/modelbg.jpeg rename to www/erupe/img/modelbg.jpeg diff --git a/Erupe/www/erupe/img/moreinfo.png b/www/erupe/img/moreinfo.png similarity index 100% rename from Erupe/www/erupe/img/moreinfo.png rename to www/erupe/img/moreinfo.png diff --git a/Erupe/www/erupe/img/pastebin.png b/www/erupe/img/pastebin.png similarity index 100% rename from Erupe/www/erupe/img/pastebin.png rename to www/erupe/img/pastebin.png diff --git a/Erupe/www/erupe/img/start_now.png b/www/erupe/img/start_now.png similarity index 100% rename from Erupe/www/erupe/img/start_now.png rename to www/erupe/img/start_now.png diff --git a/Erupe/www/erupe/index.html b/www/erupe/index.html similarity index 93% rename from Erupe/www/erupe/index.html rename to www/erupe/index.html index 09047c5e1..57aa1c568 100644 --- a/Erupe/www/erupe/index.html +++ b/www/erupe/index.html @@ -71,6 +71,15 @@

Important Updates

    +
  • +
    2022-08-02
    + +
  • 2022-05-03
    diff --git a/Erupe/www/erupe/js/script.js b/www/erupe/js/script.js similarity index 96% rename from Erupe/www/erupe/js/script.js rename to www/erupe/js/script.js index 5288414fb..5e75c7aad 100644 --- a/Erupe/www/erupe/js/script.js +++ b/www/erupe/js/script.js @@ -1,5 +1,6 @@ var __mhf_launcher = {}; var loginScreen = true; +var loggingIn = false; var doingAuto = false; var uids; var selectedUid; @@ -259,6 +260,11 @@ function switchPrompt() { } function doLogin(option) { + if (loggingIn) { + return; + } else { + loggingIn = true; + } let username = document.getElementById('username').value; let password = document.getElementById('password').value; if (username == '') { @@ -289,6 +295,7 @@ function checkAuth() { setTimeout(checkAuth, 10); return; } else if (loginResult == 'AUTH_SUCCESS') { + loggingIn = false; saveAccount(); addLog('Connected.', 'good'); if (doingAuto) { @@ -300,6 +307,7 @@ function checkAuth() { switchPrompt(); } } else { + loggingIn = false; addLog('Error logging in: '+loginResult+':'+window.external.getSignResult(), 'error'); } document.getElementById('processing').style.display = 'none'; @@ -479,8 +487,26 @@ function doEval() { function init() { document.addEventListener('keypress', function(e) { - if (e.key == '~') { - document.getElementById('dev').style.display = 'block'; + switch (e.key) { + case '~': + document.getElementById('dev').style.display = 'block'; + break; + case 'Enter': + if (loginScreen) { + doLogin() + } else { + soundLogin();launch() + } + break; + case ',': + if (!loginScreen) { + soundOk();charselScrollUp() + } + break; + case '.': + if (!loginScreen) { + soundOk();charselScrollDown() + } } }); let unselectable = document.getElementsByClassName('unselectable');