345 Commits

Author SHA1 Message Date
wish
7eef02061a fix nil pointer issue 2024-10-28 23:49:18 +11:00
wish
db4120bb85 reimplement lazy packets 2024-10-28 23:48:49 +11:00
wish
67a5dc412c rename db to database 2024-10-28 23:05:14 +11:00
stratic-dev
d5bb0ac337 character service to /internal 2024-10-18 00:14:16 +01:00
stratic-dev
094855b984 stage as a /internal/system 2024-10-17 20:22:53 +01:00
stratic-dev
674ac9bd47 guild_member service created in /internal/service 2024-10-17 19:23:47 +01:00
stratic-dev
5baff56517 refactored guild and guild alliance into internal/service 2024-10-17 19:16:09 +01:00
stratic-dev
fa35141f97 Add more constants to central place 2024-10-17 02:55:46 +01:00
stratic-dev
6075e9c756 make mail a service 2024-10-17 02:39:40 +01:00
stratic-dev
b6f24ae22d move models into model folder. Some models not moved due to local type. 2024-10-17 02:09:32 +01:00
stratic-dev
e9ae953993 added db to handlerTable 2024-10-15 04:46:11 +01:00
stratic-dev
0fa7f37743 revert broadcast package refactor in prep for session interface refactor 2024-10-15 04:11:58 +01:00
stratic-dev
f6efbb39a6 Remove overhang from semaphoreindex removal 2024-10-14 21:37:38 +01:00
wish
35a0c910af remove semaphoreIndex 2024-10-14 23:27:55 +11:00
wish
89c364065f use lowercase logger name 2024-10-14 23:26:15 +11:00
wish
c46d8dea3f rewrite command processor and i18n 2024-10-14 23:23:14 +11:00
stratic-dev
0af565a766 Abracted away broadcast utils 2024-10-13 18:23:04 +01:00
stratic-dev
5f975c97b5 Config / DB now its own package 2024-10-12 22:37:42 +01:00
stratic-dev
44692e986e Added logger singleton 2024-10-11 00:15:11 +01:00
stratic-dev
32dbfa7514 made it clearer when session object and server object was being used by renaming s to session and server. Split out ravi,broadcast and discord into sys_* 2024-10-10 21:38:12 +01:00
wish
830834c5b5 refactor packet sending functions 2024-10-10 22:27:12 +11:00
stratic-dev
62fe5cf277 moved bin 8 out and removed clientctx
moved crypto bin8 out of entrance server

removed unused clientctx

missed import

fix accidental commit and rename ack_helpers
2024-10-09 18:36:34 +01:00
stratic-dev
701d88166f RealClientMode replaced for ClientID 2024-10-09 08:37:52 +01:00
stratic-dev
738a46a01b RealClientMode replaced for ClientID 2024-10-09 08:37:04 +01:00
stratic-dev
e8fc650d49 refactored gametime and utils folder which decouples entrance and sign from channel servers 2024-10-09 08:34:13 +01:00
wish
4348aa02a8 temporarily fix rasta expiration 2024-10-09 00:51:51 +11:00
wish
8191994acb add LoopDelay config option 2024-10-08 22:26:00 +11:00
wish
436e30f83d remove duplicate updateRights call 2024-10-08 21:07:13 +11:00
wish
34e84f31df ignore empty packet buffer 2024-10-08 21:06:52 +11:00
wish
1432e8f2b8 Merge remote-tracking branch 'origin/main' 2024-10-08 20:43:20 +11:00
wish
edd357fe50 concatenate packets during send 2024-10-08 20:42:42 +11:00
stratic-dev
ae32951671 Add troubleshooting for setup on docker and add opcode dec and hex to logger 2024-10-05 22:56:53 +01:00
stratic-dev
2d48d63263 added ./bin to ignore when building dockerfile 2024-10-05 04:36:37 +01:00
wish
b20969ddc6 emulate retail semaphore logic 2024-10-03 21:56:06 +10:00
wish
8f68e10f1d Merge remote-tracking branch 'origin/main' 2024-10-01 23:02:08 +10:00
wish
2c5896814f update ico resources 2024-10-01 23:01:15 +10:00
wish
8a55c5ff89 fix inflated festa rewards 2024-09-27 01:12:16 +10:00
wish
7d760bd3b4 fix EntranceServer clan member list limits 2024-08-08 22:16:39 +10:00
wish
04008fceb8 rewrite ReadMercenaryW handler 2024-08-08 22:16:09 +10:00
wish
1ab6940b01 add extra fields to Distributions 2024-08-08 22:14:35 +10:00
wish
ae759be046 Merge pull request #126 from ZeruLight/fix/quest-stamps
fix/quest-stamps
2024-07-24 23:46:13 +10:00
wish
459f382dd7 simplify 2024-07-24 23:41:05 +10:00
wish
f545576fc9 merge changes 2024-07-24 23:33:04 +10:00
wish
4204ab1ecb Merge branch 'refs/heads/main' into fix/quest-stamps 2024-07-24 23:28:13 +10:00
wish
717d785342 fix possible warehouse error 2024-07-23 21:56:01 +10:00
wish
d29b7d00fc fix retro stamp rewards 2024-07-23 21:26:43 +10:00
wish
b755de269e add retro stamp rewards 2024-07-23 00:11:54 +10:00
wish
0ef3b08e86 Merge pull request #125 from ZeruLight/feature/ngword
feature/ngword
2024-07-22 23:47:49 +10:00
wish
aa5d95e7c5 fix sjis ngwords 2024-07-22 23:44:53 +10:00
wish
5de6570510 ascii working, sjis not working 2024-07-16 01:13:17 +10:00
wish
ca38f5671d ascii working, sjis not working 2024-07-16 01:12:02 +10:00
wish
632aa081b9 decode SMC table 2024-07-16 00:57:59 +10:00
wish
0caaeac3af initial ngword commit 2024-07-15 01:07:50 +10:00
wish
dd13713bc1 fix parsing SysTerminalLog 2024-06-25 22:50:58 +10:00
wish
12c7774cc1 fix GetCafeDuration 2024-06-25 20:35:56 +10:00
wish
e12f444b8d fix GetCafeDuration 2024-06-16 18:16:12 +10:00
wish
100ec30fba fix GetCafeDuration 2024-06-16 17:46:12 +10:00
stratic-dev
b8be6e7aa8 Merge pull request #120 from Nageld/main
docker updates
2024-03-29 14:14:55 +00:00
stratic-dev
853758a951 Merge pull request #119 from ZeruLight/feature/ps4
Feature/ps4
2024-03-24 19:59:19 +00:00
nageld
5342dc4df1 reference the bin and config in the root directory so they don't need to be duplicated in docker folder 2024-03-23 14:19:23 -04:00
nageld
a10ecf2a11 update init path 2024-03-23 14:17:14 -04:00
stratic-dev
449c3e443b Merge pull request #117 from ZeruLight/feature/screenshot-api
Feature/screenshot api
2024-03-20 19:49:10 +00:00
stratic-dev
4d134d0624 Remove reformatting 2024-03-20 19:44:54 +00:00
stratic-dev
7d7fd50ba8 init ps4 support 2024-03-20 19:12:57 +00:00
wish
fc13b1bdd9 Merge pull request #118 from ZeruLight/fix/weekly-stamps
fix/weekly-stamps
2024-03-18 21:33:41 +11:00
wish
843b6a9dff fix quest stampcard 2024-03-17 16:39:06 +11:00
wish
d26ae4563e fix G1 compatibility 2024-03-17 16:35:16 +11:00
wish
76858bb111 bypass full Stage check if reserve slot exists 2024-03-16 21:02:49 +11:00
stratic-dev
295ff6537b Added utils to verify paths 2024-03-15 20:00:39 +00:00
stratic-dev
d123182a2f Renamed signv2 to api and enabled it by default 2024-03-15 19:37:55 +00:00
stratic-dev
62a2fe9f73 Added more regex 2024-03-15 18:43:33 +00:00
stratic-dev
12b3dd1be3 Add regex 2024-03-15 18:33:23 +00:00
stratic-dev
3797438ca2 No database 2024-03-15 00:54:18 +00:00
stratic-dev
def2bc3d2c initial commit 2024-03-12 23:00:01 +00:00
wish
25bb69b6df test weekly stamp fix 2024-03-11 23:31:39 +11:00
wish
19aadc6e10 enforce Stage.maxPlayers on MoveStage & BackStage 2024-03-10 19:50:21 +11:00
wish
5284fe55cd enforce Stage.maxPlayers on EnterStage 2024-03-10 18:33:55 +11:00
wish
b08c41a886 enforce Stage.maxPlayers on EnterStage 2024-03-10 18:26:26 +11:00
wish
bfb22951f2 fix PatchServer response 2024-03-10 11:05:41 +11:00
wish
89c1db4712 remove PS3 Patch Server default 2024-03-09 14:58:12 +11:00
wish
fac68a2b4b fix UpdateGuacot 2024-03-06 22:17:27 +11:00
wish
d9479ea863 move initialization schema 2024-03-02 21:39:23 +11:00
wish
734a982689 proofreading 2024-03-02 21:37:25 +11:00
wish
846f8d6693 retain excess Room RP 2024-02-28 21:24:55 +11:00
wish
e5703617bb add support for Clan Changing Room 2024-02-28 19:29:06 +11:00
wish
76425efd2e squash psn-link patch-schema 2024-02-25 22:26:44 +11:00
wish
f5c772413e rename instances of HRP to HR 2024-02-25 22:20:12 +11:00
wish
a0282bd11e prevent rand.Intn panic 2024-02-25 21:32:07 +11:00
wish
7640195d2b add min and max Feature Weapons 2024-02-25 21:18:14 +11:00
wish
d217ae1a85 Merge pull request #115 from ZeruLight/feature/warehouse-v2
feature/warehouse-v2
2024-02-25 15:38:35 +11:00
wish
ecffe63d6b index schema 2024-02-25 15:37:26 +11:00
wish
c74ce4b07f simplify reused code 2024-02-25 14:22:21 +11:00
wish
40d4aba3c4 convert other Warehouse types to new system 2024-02-25 14:12:37 +11:00
wish
a9b9c94347 fix RNG 2024-02-21 03:46:15 +11:00
wish
b969c53f3a fix Warehouse packet parsing 2024-02-21 02:09:42 +11:00
wish
e80a03dcc7 fix Warehouse Item functions 2024-02-21 02:09:26 +11:00
wish
020f122bb0 use better RNG for Warehouse IDs 2024-02-21 02:08:59 +11:00
wish
caf4deb1a6 fix Warehouse Equipment dereference 2024-02-20 21:16:31 +11:00
wish
9f19358c8b fix Warehouse serialisation across versions 2024-02-20 21:04:29 +11:00
wish
f51d65cf02 Merge branch 'main' into feature/warehouse-v2 2024-02-20 20:46:49 +11:00
wish
d0e727d444 fix remaining Festa queries 2024-02-20 18:52:56 +11:00
wish
db364110eb Merge branch 'main' into feature/warehouse-v2 2024-02-20 17:50:04 +11:00
wish
c3409996ef rollback unknown Festa values 2024-02-20 15:02:10 +11:00
wish
a968f18438 add support for SIGN requests 2024-02-20 14:53:59 +11:00
wish
c5905d74d4 index Patch Schemas 2024-02-20 04:19:43 +11:00
wish
5bcfe25ede implement Festa Bonus Categories & Guild Character optimisations 2024-02-20 04:18:16 +11:00
wish
d22a7c782f changes to FestivalColor 2024-02-20 04:16:26 +11:00
wish
1c4370b929 fix EnumerateFestaMember prior to Z2 2024-02-20 04:12:22 +11:00
wish
df062613eb add Save pointers for S6.0 2024-02-20 03:08:48 +11:00
wish
b73f85ef4a add Quest timer toggle Chat Command 2024-02-20 00:33:38 +11:00
wish
9cfbd92454 add blank Winner entries to InfoFesta 2024-02-19 18:36:03 +11:00
wish
183f88654b fix InfoFesta response on S6.0 2024-02-19 18:12:51 +11:00
wish
864586a40b exclude 0 values on EnumerateQuest 2024-02-19 17:37:40 +11:00
wish
7549fe63e6 conform Event Quest body size & auto change gathering points 2024-02-19 17:35:24 +11:00
wish
0b3e1f520f use Monster enum on GetPaperData 2024-02-19 17:34:08 +11:00
wish
377ff14a22 use Monster enum on GetPaperData 2024-02-19 17:34:01 +11:00
wish
18cabd03f1 add version case to FestaInfo 2024-02-19 17:32:32 +11:00
wish
79cdc28a01 simplify Gem math 2024-02-14 18:36:06 +11:00
wish
685f51ecb3 clean up Tower responses 2024-02-14 18:03:56 +11:00
wish
5f370896df clean up Tower responses 2024-02-14 17:28:01 +11:00
wish
6ec9d9d869 add AutoBackportQuest DebugOption 2024-02-11 23:22:42 +11:00
wish
771f240d13 implement course 31 2024-02-10 17:45:40 +11:00
wish
bbf4fa2472 further tune value configuration 2024-02-10 03:07:13 +11:00
wish
df9e33bdcc fix dirty pr 2024-02-08 18:29:04 +11:00
stratic-dev
86f79e4331 Merge pull request #112 from ZeruLight/docker
Docker support and Authors
2024-02-01 21:59:57 +00:00
stratic-dev
b4639b628b Create AUTHORS.md 2024-02-01 21:56:43 +00:00
stratic-dev
08e6fd2cda Delete 9.2-init.sql 2024-02-01 21:54:40 +00:00
wish
1bbcae395b Merge pull request #113 from sasospanner/Config-mismatch 2024-01-30 15:58:07 +11:00
sasospanner
20cc4c2a9e fix config mismatch 2024-01-29 21:58:36 -05:00
stratic-dev
851301b088 Updated readme and added init schemas to folder 2024-01-26 17:59:34 +00:00
stratic-dev
abe4744587 Added db init script. Combined all schemas under schemas. Persisted
updates and init
2024-01-24 04:35:24 +00:00
stratic-dev
463ceba555 Added github action 2024-01-22 22:45:31 +00:00
stratic-dev
76e62c6af2 Added readme and comments to docker-compose 2024-01-22 22:35:45 +00:00
stratic-dev
4a7f7b8041 Added docker and docker-compose 2024-01-22 20:06:40 +00:00
wish
59eafbe3d5 fix EnumerateQuest rotation 2024-01-16 19:50:41 +11:00
wish
6b54e40cc6 add tuneValue comments 2024-01-14 14:13:11 +11:00
wish
1a6a9da308 add logging to EnumerateQuest 2024-01-14 14:09:51 +11:00
wish
4fbfd569df Merge pull request #111 from ZeruLight/feature/moderation
feature/moderation
2024-01-11 23:04:29 +11:00
wish
af29ee637e minor session optimisations 2024-01-11 23:03:53 +11:00
wish
2685476022 check against unwrapped error 2024-01-11 23:01:53 +11:00
wish
a7bf38388c fix package collision 2024-01-11 23:01:32 +11:00
wish
4ccb3af5ac simplify cryptography 2024-01-11 23:00:44 +11:00
wish
ba7321b535 fix stringstack & MoveStage error 2024-01-10 19:29:51 +11:00
wish
c8e21387c0 rewrite CastBinary payload handling 2024-01-06 17:43:25 +11:00
wish
f73bdd7445 rewrite CastBinary payload handling 2024-01-05 02:39:25 +11:00
wish
2135c443d8 add ban chat command 2024-01-03 19:30:57 +11:00
wish
e0615dcd0c add support for operator accounts & bans 2024-01-03 19:08:45 +11:00
wish
8cd114988d Merge pull request #110 from ZeruLight/feature/i18n
i18n proposal
2024-01-03 15:43:17 +11:00
wish
ca80a98141 i18n proposal 2024-01-03 04:22:25 +11:00
wish
1766b6f2bd rewrite EntranceServer response 2024-01-02 20:04:40 +11:00
wish
ca09c24656 Merge pull request #108 from ZeruLight/dependabot/go_modules/golang.org/x/crypto-0.17.0
Bump golang.org/x/crypto from 0.15.0 to 0.17.0
2024-01-02 19:58:31 +11:00
wish
d6322e2f80 Merge pull request #103 from matthe815/feature/discord-login
feat: Password resetting by Discord integration
2024-01-02 19:58:02 +11:00
wish
63388aa4f7 re-index patch-schema 2024-01-02 19:53:27 +11:00
wish
1ed8b97347 update onInteraction process 2024-01-01 23:39:29 +11:00
wish
0d28637095 support long messages, rename to RelayChannel, move commands out of main 2024-01-01 21:22:51 +11:00
wish
a602bda47b reuse existing token, JP string & command description 2024-01-01 02:10:27 +11:00
wish
4f5eeb1508 add ico resources 2024-01-01 01:03:20 +11:00
wish
b3a265e218 Merge remote-tracking branch 'origin/main' into feature/discord-login 2023-12-31 22:38:08 +11:00
wish
3db6ee7b25 simplify EntranceServer crypto 2023-12-31 19:56:20 +11:00
wish
57bf1ca6e4 simplify EntranceServer crypto 2023-12-31 19:12:33 +11:00
wish
1aa2e36087 simplify World name concatenation 2023-12-31 16:30:11 +11:00
wish
5a8bc3b67a fix EntranceServer response on G5 2023-12-31 15:12:20 +11:00
wish
32dee9039e simplify config 2023-12-31 12:54:18 +11:00
wish
0ea0dc217b simplify config 2023-12-31 12:51:24 +11:00
wish
52082aaf06 use correct GuildMember length 2023-12-31 11:43:10 +11:00
wish
0069a5029f decode Festa stuff 2023-12-31 11:42:44 +11:00
wish
fd02a12ae9 add DefaultCourses DevModeOption 2023-12-31 10:22:27 +11:00
Matthew
293122b9a1 rm: Unintentional file inclusion 2023-12-20 13:47:08 -08:00
dependabot[bot]
c715578519 Bump golang.org/x/crypto from 0.15.0 to 0.17.0
Bumps [golang.org/x/crypto](https://github.com/golang/crypto) from 0.15.0 to 0.17.0.
- [Commits](https://github.com/golang/crypto/compare/v0.15.0...v0.17.0)

---
updated-dependencies:
- dependency-name: golang.org/x/crypto
  dependency-type: direct:production
...

Signed-off-by: dependabot[bot] <support@github.com>
2023-12-18 23:59:56 +00:00
wish
b8f431ae66 parse CapLink responses 2023-12-17 17:47:35 +11:00
wish
345126ffcb fix warehouseGetEquipment 2023-12-13 11:50:29 +11:00
wish
7e34862e25 Merge remote-tracking branch 'origin/main' into feature/warehouse-v2
# Conflicts:
#	server/channelserver/handlers.go
2023-12-13 11:38:05 +11:00
wish
6686d59146 fix UdSchedule debug response 2023-12-08 10:47:34 +11:00
wish
24eed13a7c Merge pull request #107 from ZeruLight/fix/goocoo
fix/goocoo
2023-12-05 23:50:56 +11:00
wish
a7ac2c0672 remove comment 2023-12-05 23:48:47 +11:00
Matthew
526a9504bb Merge branch 'feature/discord-login' of https://github.com/matthe815/Erupe into feature/discord-login 2023-12-04 13:48:32 -05:00
Matthew
26438306c6 fix: Missing closing bracket 2023-12-04 13:48:17 -05:00
Matthew
c1b9c75138 Merge branch 'ZeruLight:main' into feature/discord-login 2023-12-04 10:45:26 -08:00
wish
ef7d46ba2e revert UpdateGuacot parsing 2023-12-04 22:29:58 +11:00
wish
7717f2f12a fix Enumerate/UpdateGuacot 2023-12-04 22:06:43 +11:00
wish
4844acee9c fix UpdateEtcPoint logic 2023-12-04 20:10:14 +11:00
wish
b6e7f019de update mhfmon names 2023-12-03 19:56:18 +11:00
wish
8a485f3120 convert EnumeratePrice to use mhfmon enums 2023-12-03 19:35:24 +11:00
wish
ddcef6570f convert EnumeratePrice to use structs 2023-12-03 19:05:30 +11:00
wish
5662564842 add option to dump raw saves 2023-12-03 17:57:23 +11:00
wish
4ce65e47e6 revert stringstack.go changes 2023-12-03 17:50:01 +11:00
wish
da022d913b refactor TransitMessage handler 2023-12-03 17:40:47 +11:00
wish
d67ad93c63 allow TransitMessage to respond to local requests 2023-12-03 16:36:34 +11:00
wish
3d08e64b07 add comments 2023-12-02 21:18:16 +11:00
wish
af3491b996 add TODO 2023-12-02 21:18:00 +11:00
wish
9d54a9746c remove unused variable 2023-12-02 21:16:26 +11:00
wish
a604836b62 enumerate missing clients 2023-12-02 21:16:07 +11:00
wish
11bac4ecf3 handle UnreserveSrg 2023-12-02 21:10:52 +11:00
wish
df173e9edf refactor TransitMessage handler 2023-12-02 20:15:22 +11:00
wish
622b2efa03 refactor TransitMessage handler 2023-12-02 18:38:33 +11:00
wish
64427fd317 refactor TransitMessage handler 2023-12-02 17:51:20 +11:00
wish
d50eb923ba validate additional SysLogin data 2023-12-01 00:51:05 +11:00
wish
4bae0e5758 add option to alter maximum Clan Members 2023-11-30 23:07:13 +11:00
Matthew
22a02f9291 Merge pull request #105 from rockisch/signv2-user-token-id
Make sure signv2 returns user token ID
2023-11-29 20:36:30 -08:00
rockisch
b14b75ee23 Make sure signv2 returns user token ID
Noticed when refactoring 'mhf-iel' to support F5 that this info was
not mapped correctly.
2023-11-30 01:14:06 -03:00
Matthew
b7c5fe70e7 Merge branch 'main' into feature/discord-login 2023-11-29 10:52:01 -08:00
wish
51e1860a92 add support for multiple Conquest War targets 2023-11-30 00:35:39 +11:00
wish
a108a67522 add support for multiple Conquest War targets 2023-11-30 00:34:51 +11:00
wish
67e791be2b parse & stub PostSeibattle 2023-11-30 00:31:09 +11:00
wish
58708eaaf2 fix GetUdSchedule response 2023-11-30 00:30:32 +11:00
wish
c46a3a78f0 fix GetEarthStatus response 2023-11-30 00:07:36 +11:00
wish
617d600f9a test TSP accumulation 2023-11-30 00:07:09 +11:00
wish
4376ed6678 partial backport EnumerateShop 2023-11-29 23:41:06 +11:00
wish
15739ad0d2 fix PostTowerInfo not incrementing 2023-11-29 23:15:32 +11:00
wish
4a962e2701 fix SaveDecoMyset on first save 2023-11-29 23:14:34 +11:00
wish
c996975bf1 correct EnumerateShop response 2023-11-29 21:38:32 +11:00
wish
e914cf406b limit EnumerateShop responses 2023-11-29 21:37:41 +11:00
wish
ea981ca70f add Koban Shop items to OtherShops.sql 2023-11-29 21:36:50 +11:00
Matthew
1d816a8a6a Merge pull request #104 from matthe815/feature/custom-prefix
feat: Custom prefixes and basic help command
2023-11-28 15:14:58 -08:00
wish
d7b400c812 revise command descriptions 2023-11-28 23:41:54 +11:00
wish
1cd60eb5ae hide disabled commands 2023-11-28 23:41:22 +11:00
wish
8d02c9f907 remove unnecessary dependency change 2023-11-28 23:40:47 +11:00
wish
acf942075c use fallback backStage 2023-11-28 23:13:26 +11:00
wish
2502b47077 simplify SaveDecoMyset 2023-11-28 22:25:36 +11:00
wish
2199e07be8 simplify SaveDecoMyset 2023-11-28 22:07:20 +11:00
Matthew
7b7b2874c5 fix: Fixed description for reload command. 2023-11-27 16:14:32 -05:00
Matthew
eeeb998040 Merge branch 'ZeruLight:main' into feature/discord-login 2023-11-27 12:44:25 -08:00
Matthew
de5c3addd1 fix: Show config prefix instead of just ! 2023-11-27 15:34:28 -05:00
Matthew
88652e1dc0 chore: Change command name to show the prefix instead. 2023-11-27 15:32:52 -05:00
Matthew
325f6bebb9 Merge branch 'ZeruLight:main' into feature/custom-prefix 2023-11-27 12:29:15 -08:00
wish
dcac7b433e update Go dependencies 2023-11-27 23:10:25 +11:00
wish
7d0ef7db23 enable save pointers in legacy versions G1->G2 2023-11-27 22:20:17 +11:00
wish
ce849ef06e enable save pointers in legacy versions G3->G9.1 2023-11-27 22:09:02 +11:00
wish
c152e2d0b9 verify save pointers in legacy versions G3->G9.1 2023-11-27 22:00:47 +11:00
wish
f0744b4040 disable KQF command before G10 2023-11-27 21:59:58 +11:00
wish
bc12f4cd3b fix DecoMyset responses in legacy versions 2023-11-27 21:03:26 +11:00
wish
a846a71ca3 rewrite stringstack.go 2023-11-27 20:45:03 +11:00
Matthew
23bc66eda5 fix: Consider prefix length when slicing. 2023-11-27 04:07:44 -05:00
Matthew
ce773a6c56 feat: Finish help command and add description to commands. 2023-11-27 04:05:15 -05:00
Matthew
76ba7cb942 feat: Custom prefixes and basic help command 2023-11-27 03:41:48 -05:00
Matthew
a77d6d53aa refactor: Remove reverted mutex changes 2023-11-27 03:27:20 -05:00
Matthew
7d630088a4 refactor: Fix code formatting and reset config 2023-11-27 03:23:30 -05:00
Matthew
a4745f05d5 refactor: Clean up random token implementation 2023-11-27 03:03:48 -05:00
Matthew
523266fc68 refactor: Move realtime channels to its own config 2023-11-27 02:18:01 -05:00
Matthew
38b57c6d98 refactor: Change to using rand.Read instead of whatever the hell else was before 2023-11-27 01:08:40 -05:00
Matthew
d2e9e3d1a9 fix: Fix default config (whoops) 2023-11-26 16:49:11 -05:00
Matthew
226adddc43 feat: Generate hashes for Discord and allow password resets 2023-11-26 16:47:54 -05:00
Matthew
50946b9c68 Merge branch 'ZeruLight:main' into feature/discord-login 2023-11-26 09:18:54 -08:00
wish
3c6067c8a6 port partial fix/mutex-rework 2023-11-26 23:22:56 +11:00
wish
fc4476ed8c Merge branch 'main' of github.com:ZeruLight/Erupe 2023-11-26 20:55:00 +11:00
wish
22b1d1b716 Merge pull request #99 from rockisch/dev-proxy
Add dev proxy config
2023-11-26 20:53:55 +11:00
wish
8f8e82b3b4 Merge pull request #99 from rockisch/dev-proxy
Add dev proxy config
2023-11-26 20:50:27 +11:00
wish
a2f488e5e3 move ProxyPort config out of DevMode 2023-11-26 20:50:08 +11:00
wish
662c137467 update MezFes config for SignV2 2023-11-26 20:44:13 +11:00
wish
dfc359f5e2 structure & change config for MezFes 2023-11-26 19:42:27 +11:00
wish
a0fbfc248b fix TimeWeekX inconsistencies & limit MezFes duration 2023-11-26 19:21:31 +11:00
wish
b3af01b803 use seconds for arbitrary durations in config 2023-11-26 18:54:04 +11:00
Matthew
33665130cf feat: Discord basic implementation 2023-11-26 01:22:51 -05:00
wish
7e5fd73496 rename Event Quest cycling 'duration' to 'days' 2023-11-26 13:06:49 +11:00
wish
a0970de48c review pass for Event Quest cycling 2023-11-26 13:02:17 +11:00
stratic-dev
d799932f70 Merge pull request #101 from rockisch/signv2-changes
Implement final changes for custom launcher
2023-11-24 08:33:17 +00:00
Matthew
ae7044c771 Merge pull request #81 from Malckyor/main
Implement auto-cycle event quests
2023-11-24 00:26:27 -08:00
Matthew
b823cbf2ae chore: Rename schema to prevent confusion 2023-11-24 03:25:35 -05:00
rockisch
0481b15b9b Allow signv2 response to be configured 2023-11-23 22:12:36 -03:00
rockisch
2481d4871f Ensure save export can be changed in the future 2023-11-23 20:54:27 -03:00
rockisch
a0b50bdf8d Implement final changes for custom launcher 2023-11-23 20:51:25 -03:00
wish
aa77b52233 add legacy support for Frontier Point exchanges 2023-11-23 00:00:23 +11:00
wish
f9d7f56ccb fix Frontier Point exchanges 2023-11-22 23:54:59 +11:00
wish
0550fb21b5 parse & handle PlayFreeGacha 2023-11-22 22:59:36 +11:00
wish
ab6c86ce8e optimise Gacha code & fix rarity bug 2023-11-22 22:54:18 +11:00
wish
3f9c2e87f1 Merge branch 'main' of github.com:ZeruLight/Erupe 2023-11-22 21:31:19 +11:00
wish
5a6ced5a41 document unknown Festa values 2023-11-22 21:19:07 +11:00
wish
46eb75a866 Merge pull request #100 from ZeruLight/fix/legacy-distitem
fix/legacy-distitem
2023-11-22 20:49:07 +11:00
wish
b32c154fa0 decode EnumerateDistItem over multiple versions 2023-11-22 19:05:57 +11:00
rockisch
e39630564e Add dev proxy config 2023-11-22 00:01:04 -03:00
wish
d4ddf7bc25 initial legacy support for DistItem 2023-11-21 23:46:33 +11:00
wish
43f8cef35d fix server-side messages using wrong CID 2023-11-21 21:48:15 +11:00
Matthew
c86b95fe40 Merge branch 'main' of https://github.com/Malckyor/Erupe into pr/81 2023-11-19 14:35:25 -05:00
Matthew
e141b7980c chore: Fix config 2023-11-19 14:35:20 -05:00
Matthew
524009039c Merge branch 'main' into main 2023-11-19 14:34:30 -05:00
Matthew
46587b8d01 fix: Fix variables 2023-11-19 14:27:53 -05:00
Matthew
3b33c1917c sql: Remove new migration code from old patch-schema 2023-11-19 13:52:03 -05:00
Matthew
8dbc54fa14 config: Fixed config back to default values 2023-11-19 13:49:19 -05:00
Matthew
ffb0d25a43 docs: Fixed and cleaned a bit of the documentation 2023-11-19 13:48:43 -05:00
Matthew
858a9adb17 chore: Removed debug code 2023-11-19 13:45:30 -05:00
Matthew
6bd2b637a7 refactor: Moved quest duration variables to uint8 2023-11-19 13:44:11 -05:00
Matthew
3778d03402 feat: Default to always active if inactive time is not set 2023-11-19 13:39:59 -05:00
wish
405e65346b add LogMessageData DevModeOption & disable Logging by default 2023-11-20 00:58:24 +11:00
wish
e9fa4e5261 fix LogOutboundMessages not working 2023-11-20 00:49:50 +11:00
wish
bcf2ba40e5 fix possible integer bounding issues 2023-11-20 00:13:49 +11:00
wish
b6cc8c3a12 fix incorrect Client Version string 2023-11-20 00:01:22 +11:00
wish
105a118163 filter workflow triggers 2023-11-19 23:13:34 +11:00
wish
e066e9566f remove duplicate CleanupObject 2023-11-19 23:13:12 +11:00
wish
d7d3e7c61f update parsing of CastBinary & EnterStage 2023-11-19 23:12:58 +11:00
wish
e5fa0501b7 add packet time profiling 2023-11-19 20:17:03 +11:00
wish
1e6675b3f5 add support for Festa Trial voting 2023-11-19 04:59:30 +11:00
wish
85fc76edd5 update parsing of many packets 2023-11-19 02:34:02 +11:00
wish
fc57d63689 update parsing of many packets 2023-11-19 00:35:22 +11:00
Matthew
47ca302384 feat: Cycle simulation (simulate cycles if beyond a single set) 2023-11-18 03:18:35 -05:00
wish
734b60bee1 Merge branch 'main' of github.com:ZeruLight/Erupe 2023-11-18 15:54:05 +11:00
wish
c554943140 Merge pull request #96 from matthe815/seasons-fix
Fix: Re-add Seasons & Bug Fixes
2023-11-18 15:45:14 +11:00
wish
490aecd94b rewrite comments & change quest flag code 2023-11-18 15:44:59 +11:00
Matthew
c20380b79d fix: Continue instead of ending event quest parsing if an error occurs on a single quest 2023-11-17 22:27:50 -05:00
Matthew
a34a0e42b2 fix: Commit to database via unique index rather than quest_id 2023-11-17 22:21:48 -05:00
Matthew
50d3ec36b2 chore: Fix formatting 2023-11-17 22:21:15 -05:00
Matthew
233990f452 refactor: Change event quest updating to use transactions rather than directly commiting 2023-11-17 22:18:07 -05:00
Matthew
800e993c1f sql: Added 11-event_quest_cycling migration sql 2023-11-17 21:14:19 -05:00
Matthe815
6384d79a7a fix: Removed unnecessary condition 2023-11-16 11:29:31 -05:00
Matthe815
2e2d129871 docs: Fix annotation for custom quest conditions 2023-11-16 11:10:46 -05:00
Matthe815
34044f72b0 chore: Fix config.json 2023-11-16 11:07:00 -05:00
wish
6c32eae9f2 simplify code 2023-11-16 21:56:48 +11:00
wish
72bda06916 implement Quest caching 2023-11-16 21:51:28 +11:00
wish
15253cdc1f remove useless CIDs 2023-11-16 21:49:43 +11:00
wish
8c69a98c58 remove arbitrary test code 2023-11-16 21:31:31 +11:00
Matthew
a27d15bff1 style: Fixed inconsistent spacing and cleaned up SQL query strings 2023-11-16 02:38:58 -05:00
Matthe815
a9b8bb4c56 fix: Added flags to sql query 2023-11-16 02:00:01 -05:00
Matthe815
f588d47aa1 chore: Reset config files 2023-11-12 16:01:19 -05:00
wish
4a83b68725 Merge pull request #97 from ZeruLight/fix/rework-distributions
fix/rework-distributions
2023-11-11 19:42:08 +11:00
Matthe815
3e4e325675 feat: Implement event quest season/time flag override 2023-11-11 03:42:08 -05:00
Matthew
08a1f352cb Merge branch 'ZeruLight:main' into seasons-fix 2023-11-11 03:35:29 -05:00
Matthe815
611cb2da5b feat: Request custom files based on time of day. 2023-11-08 13:28:05 -05:00
Matthe815
378dfd0372 fix: Fixed issues with improper loading of areas 2023-11-07 21:16:03 -05:00
wish
af519a59cf rewrite EnumerateStage & parse ReserveStage 2023-11-07 21:14:45 -05:00
wish
7eaf37c1ff simplify DistributionDemo script 2023-11-07 22:00:07 +11:00
wish
317daef04b rewrite EnumerateDistItem handler 2023-11-07 21:26:45 +11:00
wish
14e61fd661 fix Distribution typing, accepting & add demo 2023-11-07 21:07:49 +11:00
wish
29904d5b92 fix signing of min/max Rank Distributions 2023-11-07 20:23:02 +11:00
Matthe815
5e760da8bc chore: Removed credentials 2023-11-05 19:21:12 -05:00
Matthe815
cce64d4010 fix: Removed random print from code 2023-11-05 19:19:55 -05:00
Matthe815
68de64a05f fix: Fixed issue with seasons not properly displaying on client 2023-11-05 19:08:02 -05:00
Matthe815
4edeaedea3 fix: Restore seasons functionality into quests 2023-11-05 15:23:34 -05:00
wish
be6f55b5a8 initial distributions rework 2023-11-05 00:31:16 +11:00
wish
a9f280a2ef initial warehouse-v2 concept commit 2023-10-01 03:17:51 +11:00
Ewerton B. S
45e912a8d9 Merge branch 'ZeruLight:main' into main 2023-08-28 05:48:31 +09:00
Ewerton B. S
b74e571beb Update handlers_quest.go 2023-08-23 08:07:15 +09:00
Ewerton B. S
5cd268df23 Update 03-event_quests.sql auto-cycle 2023-08-23 05:31:12 +09:00
Ewerton B. S
43c59da809 Removed auto-cycle option 2023-08-23 05:30:27 +09:00
Ewerton B. S
c4f11721c6 Removed auto-cycle option 2023-08-23 05:30:02 +09:00
Ewerton B. S
d3a6121b2c Reworke auto-cycle code 2023-08-23 05:28:49 +09:00
Ewerton B. S
391e0c9d98 Update default weeklyCycle value
This value cannot be null or the quests won't appear in game.
2023-08-21 08:55:05 +09:00
Ewerton B. S
5d156021dc Update a condition 2023-08-21 08:53:49 +09:00
Ewerton B. S
30a215396b Update 03-event_quests.sql auto-cycle 2023-08-21 03:23:37 +09:00
Ewerton B. S
c0d11bea4b Update config.go auto-cycle 2023-08-21 03:22:45 +09:00
Ewerton B. S
6708c9fc8f Update config.json auto cycle 2023-08-21 03:21:49 +09:00
Ewerton B. S
f7c4a1c925 Update auto-cycle code
Cycle amount can now be set in the config.json.
Instead of making a new database table it's now using the events table.
2023-08-21 03:20:46 +09:00
Ewerton B. S
f643960b62 Cleaning leftover of personal if-else 2023-08-20 08:38:23 +09:00
Ewerton B. S
f5b40b55b9 Update 03-event_quests.sql for auto-cycle 2023-08-20 08:00:39 +09:00
Ewerton B. S
fe465b5de4 Update config.json for auto-cycle 2023-08-20 07:59:45 +09:00
Ewerton B. S
292426bb5d Update config for auto-cycle 2023-08-20 07:58:59 +09:00
Ewerton B. S
f2bf8be1ae Auto-cycle event quests in the database 2023-08-20 07:58:08 +09:00
611 changed files with 13733 additions and 13424 deletions

1
.dockerignore Normal file
View File

@@ -0,0 +1 @@
bin/

48
.github/workflows/docker.yml vendored Normal file
View File

@@ -0,0 +1,48 @@
name: Create and publish a Docker image
# Configures this workflow to run every time a tag is created.
on:
push:
tags:
- '*'
# Defines two custom environment variables for the workflow. These are used for the Container registry domain, and a name for the Docker image that this workflow builds.
env:
REGISTRY: ghcr.io
IMAGE_NAME: ${{ github.repository }}
# There is a single job in this workflow. It's configured to run on the latest available version of Ubuntu.
jobs:
build-and-push-image:
runs-on: ubuntu-latest
# Sets the permissions granted to the `GITHUB_TOKEN` for the actions in this job.
permissions:
contents: read
packages: write
#
steps:
- name: Checkout repository
uses: actions/checkout@v4
# Uses the `docker/login-action` action to log in to the Container registry registry using the account and password that will publish the packages. Once published, the packages are scoped to the account defined here.
- name: Log in to the Container registry
uses: docker/login-action@65b78e6e13532edd9afa3aa52ac7964289d1a9c1
with:
registry: ${{ env.REGISTRY }}
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
# This step uses [docker/metadata-action](https://github.com/docker/metadata-action#about) to extract tags and labels that will be applied to the specified image. The `id` "meta" allows the output of this step to be referenced in a subsequent step. The `images` value provides the base name for the tags and labels.
- name: Extract metadata (tags, labels) for Docker
id: meta
uses: docker/metadata-action@9ec57ed1fcdbf14dcef7dfbe97b2010124a938b7
with:
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
# This step uses the `docker/build-push-action` action to build the image, based on your repository's `Dockerfile`. If the build succeeds, it pushes the image to GitHub Packages.
# It uses the `context` parameter to define the build's context as the set of files located in the specified path. For more information, see "[Usage](https://github.com/docker/build-push-action#usage)" in the README of the `docker/build-push-action` repository.
# It uses the `tags` and `labels` parameters to tag and label the image with the output from the "meta" step.
- name: Build and push Docker image
uses: docker/build-push-action@f2a1d5e99d037542a71f64918e516c093c6f3fc4
with:
context: .
push: true
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}

View File

@@ -1,6 +1,15 @@
name: Build
on: [push]
on:
push:
paths:
- 'common/**'
- 'config/**'
- 'network/**'
- 'server/**'
- 'go.mod'
- 'go.sum'
- 'main.go'
jobs:
build:

5
.gitignore vendored
View File

@@ -6,4 +6,7 @@ vendor/
savedata/*/
*.exe
*.lnk
*.bat
*.bat
/docker/db-data
screenshots/*
/docker/Servers

30
AUTHORS.md Normal file
View File

@@ -0,0 +1,30 @@
# List of authors who contributed to Erupe
## Point of current development
The project is currently developed under https://github.com/ZeruLight/Erupe
## History of development
Development of this project dates back to 2019, and was developed under various umbrellas over time:
* Cappuccino (Fist/Ando/Ellie42) ("The Erupe Developers"), 2019-2020 (https://github.com/Ellie42/Erupe / https://github.com/ricochhet/Erupe-Legacy) (Still active closed source)
* Einherjar Team, ????-2022 Feb (There is no git history for this period, this team's work was taken and used as a foundation for future repositories)
* Community Edition, 2022 (https://github.com/xl3lackout/Erupe)
* sekaiwish Fork, 2022 (https://github.com/sekaiwish/Erupe)
* ZeruLight, 2022-2023 (https://github.com/ZeruLight/Erupe)
## Authorship of the code
Authorship is assigned for each commit within the git history, which is stored in these git repos:
* https://github.com/ZeruLight/Erupe
* https://github.com/Ellie42/Erupe
* https://github.com/ricochhet/Erupe-Legacy
* https://github.com/xl3lackout/Erupe
Note the divergence between Ellie42's branch and xl3lackout's where history has been lost.
Unfortunately, we have no detailed information on the history of Erupe before 2022.
If somebody can provide information, please contact us, so that we can make this history available.
## Exceptions with third-party libraries
The third-party libraries have their own way of addressing authorship and the authorship of commits importing/updating
a third-party library reflects who did the importing instead of who wrote the code within the commit.
The authors of third-party libraries are not explicitly mentioned, and usually is possible to obtain from the files belonging to the third-party libraries.

14
Dockerfile Normal file
View File

@@ -0,0 +1,14 @@
FROM golang:1.21-alpine3.19
ENV GO111MODULE=on
WORKDIR /app/erupe
COPY go.mod .
COPY go.sum .
RUN go mod download
COPY . .
CMD [ "go", "run", "." ]

View File

@@ -1,6 +1,6 @@
# Erupe
## Client Compatiblity
## Client Compatibility
### Platforms
- PC
- PlayStation 3
@@ -32,6 +32,20 @@ If you want to modify or compile Erupe yourself, please read on.
3. Edit [config.json](./config.json) such that the database password matches your PostgreSQL setup.
4. Run `go build` or `go run .` to compile Erupe.
## Docker
Please see [docker/README.md](./docker/README.md). This is intended for quick installs and development, not for production.
## Schemas
We source control the following schemas:
- Initialization Schema: This initializes the application database to a specific version (9.1.0).
- Update Schemas: These are update files that should be ran on top of the initialization schema.
- Patch Schemas: These are for development and should be run after running all initialization and update schema. These get condensed into `Update Schemas` and deleted when updated to a new release.
- Bundled Schemas: These are demo reference files to give servers standard set-ups.
Note: Patch schemas are subject to change! You should only be using them if you are following along with development.
## Resources
- [Quest and Scenario Binary Files](https://files.catbox.moe/xf0l7w.7z)

File diff suppressed because it is too large Load Diff

View File

@@ -1,391 +0,0 @@
BEGIN;
INSERT INTO fpoint_items (item_type, item_id, quantity, fpoints, trade_type) VALUES
(7,8895,1,500,0),
(7,8891,1,300,0),
(7,8892,1,300,0),
(7,8893,1,300,0),
(7,8894,1,300,0),
(7,8890,1,10,0),
(7,10354,1,500,0),
(7,11983,1,300,0),
(7,11984,1,300,0),
(7,11985,1,300,0),
(7,11986,1,300,0),
(7,12524,1,500,0),
(7,12470,1,300,0),
(7,12471,1,300,0),
(7,12472,1,300,0),
(7,12473,1,300,0),
(7,2158,2,1,0),
(7,14548,1,500,0),
(7,9509,1,1,0),
(7,9510,1,1,0),
(7,9511,1,1,0),
(7,9512,1,1,0),
(7,9513,1,1,0),
(7,9514,1,1,0),
(7,9515,1,1,0),
(7,10753,1,1,0),
(7,10754,1,1,0),
(7,10755,1,1,0),
(7,10756,1,1,0),
(7,10757,1,1,0),
(7,10758,1,1,0),
(7,10759,1,1,0),
(7,11296,1,1,0),
(7,11297,1,1,0),
(7,11298,1,1,0),
(7,11299,1,1,0),
(7,11300,1,1,0),
(7,12386,1,1,0),
(7,12387,1,1,0),
(7,12388,1,1,0),
(7,12389,1,1,0),
(7,12390,1,1,0),
(7,13034,1,1,0),
(7,13035,1,1,0),
(7,13036,1,1,0),
(7,13037,1,1,0),
(7,13038,1,1,0),
(7,14179,1,1,0),
(7,14180,1,1,0),
(7,14181,1,1,0),
(7,14182,1,1,0),
(7,14183,1,1,0),
(7,13422,1,1,0),
(7,13423,1,1,0),
(7,13424,1,1,0),
(7,13425,1,1,0),
(7,13426,1,1,0),
(7,13427,1,1,0),
(7,9796,1,3,0),
(7,9700,1,3,0),
(7,10380,1,3,0),
(7,10810,1,3,0),
(7,10811,1,3,0),
(7,11436,1,3,0),
(7,9509,1,1,0),
(7,9510,1,1,0),
(7,9511,1,1,0),
(7,9512,1,1,0),
(7,9513,1,1,0),
(7,9514,1,1,0),
(7,9515,1,1,0),
(7,10753,1,1,0),
(7,10754,1,1,0),
(7,10755,1,1,0),
(7,10756,1,1,0),
(7,10757,1,1,0),
(7,10758,1,1,0),
(7,10759,1,1,0),
(7,11296,1,1,0),
(7,11297,1,1,0),
(7,11298,1,1,0),
(7,11299,1,1,0),
(7,11300,1,1,0),
(7,12509,1,3,0),
(7,12386,1,1,0),
(7,12387,1,1,0),
(7,12388,1,1,0),
(7,12389,1,1,0),
(7,12390,1,1,0),
(7,12872,1,3,0),
(7,12873,1,3,0),
(7,12840,1,1,0),
(7,12841,1,1,0),
(7,12874,1,1,0),
(7,12875,1,1,0),
(7,13191,1,3,0),
(7,13177,1,3,0),
(7,13326,1,3,0),
(7,13034,1,1,0),
(7,13035,1,1,0),
(7,13036,1,1,0),
(7,13037,1,1,0),
(7,13038,1,1,0),
(7,13178,1,3,0),
(7,13453,1,3,0),
(7,13449,1,3,0),
(7,13450,1,3,0),
(7,13404,1,3,0),
(7,13422,1,1,0),
(7,13423,1,1,0),
(7,13424,1,1,0),
(7,13425,1,1,0),
(7,13426,1,1,0),
(7,13427,1,1,0),
(7,13791,1,3,0),
(7,14006,1,3,0),
(7,14031,1,3,0),
(7,14032,1,3,0),
(7,13960,1,3,0),
(7,14029,1,3,0),
(7,13956,1,1,0),
(7,13958,1,1,0),
(7,13957,1,1,0),
(7,13959,1,1,0),
(7,13790,1,3,0),
(7,14005,1,3,0),
(7,14010,1,3,0),
(7,14009,1,3,0),
(7,14008,1,3,0),
(7,13965,1,3,0),
(7,14028,1,3,0),
(7,13963,1,3,0),
(7,14026,1,3,0),
(7,13964,1,3,0),
(7,14027,1,3,0),
(7,14069,1,3,0),
(7,14124,1,3,0),
(7,14065,1,1,0),
(7,14066,1,1,0),
(7,14067,1,1,0),
(7,14068,1,1,0),
(7,13962,1,3,0),
(7,14125,1,3,0),
(7,14089,1,3,0),
(7,14090,1,3,0),
(7,14091,1,3,0),
(7,14092,1,3,0),
(7,14194,1,3,0),
(7,14191,1,3,0),
(7,14198,1,3,0),
(7,14197,1,3,0),
(7,14179,1,1,0),
(7,14180,1,1,0),
(7,14181,1,1,0),
(7,14182,1,1,0),
(7,14183,1,1,0),
(7,14196,1,3,0),
(7,14195,1,3,0),
(7,14193,1,3,0),
(7,14192,1,3,0),
(7,14407,1,3,0),
(7,14414,1,3,0),
(7,14406,1,3,0),
(7,14413,1,3,0),
(7,14416,1,3,0),
(7,14549,1,3,0),
(7,14550,1,3,0),
(7,14502,1,3,0),
(7,14507,1,3,0),
(7,14501,1,3,0),
(7,14506,1,3,0),
(7,14500,1,3,0),
(7,14505,1,3,0),
(7,14498,1,3,0),
(7,14659,1,3,0),
(7,14660,1,3,0),
(7,14657,1,1,0),
(7,14658,1,1,0),
(7,11420,1,3,0),
(7,14704,1,3,0),
(7,11288,1,1,0),
(7,11289,1,1,0),
(7,11290,1,1,0),
(7,11291,1,1,0),
(7,10750,1,3,0),
(7,14705,1,3,0),
(7,10633,1,1,0),
(7,10634,1,1,0),
(7,10635,1,1,0),
(7,10636,1,1,0),
(7,14662,1,3,0),
(7,14663,1,3,0),
(7,14665,1,3,0),
(7,14666,1,3,0),
(7,14667,1,3,0),
(7,14668,1,3,0),
(7,14669,1,3,0),
(7,14670,1,3,0),
(7,14671,1,3,0),
(7,14672,1,3,0),
(7,14673,1,3,0),
(7,14674,1,3,0),
(7,14675,1,3,0),
(7,14676,1,3,0),
(7,14677,1,3,0),
(7,14678,1,3,0),
(7,14679,1,3,0),
(7,14680,1,3,0),
(7,14681,1,3,0),
(7,14682,1,3,0),
(7,14683,1,3,0),
(7,14684,1,3,0),
(7,14685,1,3,0),
(7,14686,1,3,0),
(7,14687,1,3,0),
(7,14688,1,3,0),
(7,14689,1,3,0),
(7,14690,1,3,0),
(7,14691,1,3,0),
(7,14692,1,3,0),
(7,14693,1,3,0),
(7,14694,1,3,0),
(7,14695,1,3,0),
(7,14696,1,3,0),
(7,14697,1,3,0),
(7,14698,1,3,0),
(7,14699,1,3,0),
(7,14700,1,3,0),
(7,14314,1,3,0),
(7,14503,1,3,0),
(7,14510,1,3,0),
(7,14904,1,3,0),
(7,14906,1,3,0),
(7,14910,1,1,0),
(7,14912,1,1,0),
(7,14905,1,3,0),
(7,14907,1,3,0),
(7,14911,1,1,0),
(7,14909,1,1,0),
(7,14855,1,3,0),
(7,14894,1,3,0),
(7,14913,1,3,0),
(7,14914,1,3,0),
(7,14891,1,3,0),
(7,14895,1,3,0),
(7,15027,1,3,0),
(7,15028,1,3,0),
(7,15026,1,1,0),
(7,15025,1,1,0),
(7,15024,1,1,0),
(7,15023,1,1,0),
(7,15064,1,3,0),
(7,15065,1,3,0),
(7,15030,1,3,0),
(7,15031,1,3,0),
(7,15062,1,3,0),
(7,15063,1,3,0),
(7,15066,1,3,0),
(7,15067,1,3,0),
(7,15061,1,3,0),
(7,15060,1,3,0),
(7,1227,1,2,0),
(7,13176,1,2,0),
(7,4360,1,2,0),
(7,4358,1,1,0),
(7,15118,1,3,0),
(7,15119,1,3,0),
(7,15113,1,3,0),
(7,15114,1,3,0),
(7,15115,1,3,0),
(7,15116,1,3,0),
(7,15220,1,3,0),
(7,15221,1,3,0),
(7,14126,1,3,0),
(7,15222,1,3,0),
(7,15223,1,3,0),
(7,15224,1,3,0),
(7,15225,1,3,0),
(7,15524,1,3,0),
(7,15525,1,3,0),
(7,15507,1,3,0),
(7,15508,1,3,0),
(7,15285,1,3,0),
(7,15286,1,3,0),
(7,15281,1,1,0),
(7,15282,1,1,0),
(7,15283,1,1,0),
(7,15284,1,1,0),
(7,15776,1,3,0),
(7,15777,1,3,0),
(7,15774,1,3,0),
(7,15775,1,3,0),
(7,15823,1,3,0),
(7,15824,1,3,0),
(7,15343,1,3,0),
(7,15342,1,3,0),
(7,15341,1,3,0),
(7,15340,1,3,0),
(7,15339,1,3,0),
(7,15338,1,3,0),
(7,15337,1,3,0),
(7,15336,1,3,0),
(7,15335,1,3,0),
(7,15334,1,3,0),
(7,15333,1,3,0),
(7,15332,1,3,0),
(7,15331,1,3,0),
(7,15330,1,3,0),
(7,15329,1,3,0),
(7,15328,1,3,0),
(7,15327,1,3,0),
(7,15326,1,3,0),
(7,15325,1,3,0),
(7,15324,1,3,0),
(7,15323,1,3,0),
(7,15322,1,3,0),
(7,15321,1,3,0),
(7,15314,1,3,0),
(7,15312,1,3,0),
(7,15311,1,3,0),
(7,15306,1,3,0),
(7,15307,1,3,0),
(7,15308,1,3,0),
(7,15309,1,3,0),
(7,15310,1,3,0),
(7,15305,1,3,0),
(7,15304,1,3,0),
(7,15303,1,3,0),
(7,15302,1,3,0),
(7,15301,1,3,0),
(7,15300,1,3,0),
(7,15299,1,3,0),
(7,15298,1,3,0),
(7,15297,1,3,0),
(7,15296,1,3,0),
(7,15295,1,3,0),
(7,15293,1,3,0),
(7,15294,1,3,0),
(7,15292,1,3,0),
(7,15291,1,3,0),
(7,15290,1,3,0),
(7,15289,1,3,0),
(7,15315,1,3,0),
(7,15316,1,3,0),
(7,15317,1,3,0),
(7,15318,1,3,0),
(7,15319,1,3,0),
(7,15320,1,3,0),
(7,15819,1,3,0),
(7,15820,1,3,0),
(7,15821,1,3,0),
(7,15822,1,3,0),
(7,16450,1,3,0),
(7,16451,1,3,0),
(7,16459,1,1,0),
(7,16460,1,1,0),
(7,16461,1,1,0),
(7,16462,1,1,0),
(7,16463,1,1,0),
(7,16464,1,1,0),
(7,16465,1,1,0),
(7,16466,1,1,0),
(7,16467,1,1,0),
(7,16468,1,1,0),
(7,16469,1,1,0),
(7,16470,1,1,0),
(7,16471,1,1,0),
(7,16472,1,1,0),
(7,16454,1,3,0),
(7,16455,1,3,0),
(7,16442,1,3,0),
(7,16443,1,3,0),
(7,16342,1,3,0),
(7,16343,1,3,0),
(7,16444,1,3,0),
(7,16445,1,3,0),
(7,16344,1,3,0),
(7,16345,1,3,0),
(7,16352,1,3,0),
(7,16353,1,3,0),
(7,16446,1,3,0),
(7,16447,1,3,0),
(7,16448,1,3,0),
(7,16449,1,3,0),
(7,16348,1,3,0),
(7,16349,1,3,0);
END;

View File

@@ -1,12 +0,0 @@
BEGIN;
INSERT INTO public.shop_items
(shop_type, shop_id, item_id, cost, quantity, min_hr, min_sr, min_gr, store_level, max_quantity, road_floors, road_fatalis)
VALUES
(5,5,16516,100,1,0,0,1,0,0,0,0),
(5,5,16517,100,1,0,0,1,0,0,0,0),
(7,0,13190,10,1,0,0,0,0,0,0,0),
(7,0,1662,10,1,0,0,0,0,0,0,0),
(7,0,10179,100,1,0,0,0,0,0,0,0);
END;

View File

@@ -9,46 +9,63 @@
],
"PatchServerManifest": "",
"PatchServerFile": "",
"ScreenshotAPIURL": "",
"Screenshots":{
"Enabled":true,
"Host":"127.0.0.1",
"Port":8080,
"OutputDir":"screenshots",
"UploadQuality":100
},
"DeleteOnSaveCorruption": false,
"ClientMode": "ZZ",
"DevMode": true,
"DevModeOptions": {
"AutoCreateAccount": true,
"QuestCacheExpiry": 300,
"CommandPrefix": "!",
"AutoCreateAccount": true,
"LoopDelay": 50,
"DefaultCourses": [1, 23, 24],
"EarthStatus": 0,
"EarthID": 0,
"EarthMonsters": [0, 0, 0, 0],
"SaveDumps": {
"Enabled": true,
"RawEnabled": false,
"OutputDir": "save-backups"
},
"DebugOptions": {
"CleanDB": false,
"MaxLauncherHR": false,
"LogInboundMessages": true,
"LogOutboundMessages": true,
"LogInboundMessages": false,
"LogOutboundMessages": false,
"LogMessageData": false,
"MaxHexdumpLength": 256,
"DivaEvent": 0,
"FestaEvent": -1,
"TournamentEvent": 0,
"MezFesEvent": true,
"MezFesAlt": false,
"DivaOverride": 0,
"FestaOverride": -1,
"TournamentOverride": 0,
"DisableTokenCheck": false,
"QuestDebugTools": false,
"EarthStatusOverride": 0,
"EarthIDOverride": 0,
"EarthMonsterOverride": 0,
"SaveDumps": {
"Enabled": true,
"OutputDir": "save-backups"
"QuestTools": false,
"AutoQuestBackport": true,
"ProxyPort": 0,
"CapLink": {
"Values": [51728, 20000, 51729, 1, 20000],
"Key": "",
"Host": "",
"Port": 80
}
},
"GameplayOptions": {
"FeaturedWeapons": 1,
"MinFeatureWeapons": 0,
"MaxFeatureWeapons": 1,
"MaximumNP": 100000,
"MaximumRP": 50000,
"MaximumFP": 120000,
"TreasureHuntExpiry": 604800,
"DisableLoginBoost": false,
"DisableBoostTime": false,
"BoostTimeDuration": 120,
"GuildMealDuration": 60,
"BoostTimeDuration": 7200,
"ClanMealDuration": 3600,
"ClanMemberLimits": [[0, 30], [3, 40], [7, 50], [10, 60]],
"BonusQuestAllowance": 3,
"DailyQuestAllowance": 1,
"MezfesSoloTickets": 10,
"MezfesGroupTickets": 4,
"LowLatencyRaviente": false,
"RegularRavienteMaxPlayers": 8,
"ViolentRavienteMaxPlayers": 8,
@@ -57,12 +74,31 @@
"SmallBerserkRavienteMaxPlayers": 8,
"GUrgentRate": 0.10,
"GCPMultiplier": 1.00,
"HRPMultiplier": 1.00,
"HRPMultiplierNC": 1.00,
"SRPMultiplier": 1.00,
"SRPMultiplierNC": 1.00,
"GRPMultiplier": 1.00,
"GRPMultiplierNC": 1.00,
"GSRPMultiplier": 1.00,
"GSRPMultiplierNC": 1.00,
"ZennyMultiplier": 1.00,
"ZennyMultiplierNC": 1.00,
"GZennyMultiplier": 1.00,
"GZennyMultiplierNC": 1.00,
"MaterialMultiplier": 1.00,
"MaterialMultiplierNC": 1.00,
"GMaterialMultiplier": 1.00,
"GMaterialMultiplierNC": 1.00,
"ExtraCarves": 0,
"ExtraCarvesNC": 0,
"GExtraCarves": 0,
"GExtraCarvesNC": 0,
"DisableHunterNavi": false,
"MezFesSoloTickets": 5,
"MezFesGroupTickets": 1,
"MezFesDuration": 172800,
"MezFesSwitchMinigame": false,
"EnableKaijiEvent": false,
"EnableHiganjimaEvent": false,
"EnableNierEvent": false,
@@ -72,39 +108,58 @@
"Discord": {
"Enabled": false,
"BotToken": "",
"RealtimeChannelID": ""
},
"Commands": [
{
"Name": "Rights",
"RelayChannel": {
"Enabled": false,
"Prefix": "rights"
}, {
"Name": "Raviente",
"Enabled": true,
"Prefix": "ravi"
}, {
"Name": "Teleport",
"Enabled": false,
"Prefix": "tele"
}, {
"Name": "Reload",
"Enabled": true,
"Prefix": "reload"
}, {
"Name": "KeyQuest",
"Enabled": false,
"Prefix": "kqf"
}, {
"Name": "Course",
"Enabled": true,
"Prefix": "course"
}, {
"Name": "PSN",
"Enabled": true,
"Prefix": "psn"
"MaxMessageLength": 183,
"RelayChannelID": ""
}
],
},
"Commands": {
"help": {
"Enabled": true,
"Description": "Show enabled chat commands"
},
"rights":{
"Enabled": false,
"Description": "Overwrite the Rights value on your account"
},
"ravi": {
"Enabled": true,
"Description": "Various Raviente siege commands"
},
"teleport": {
"Enabled": false,
"Description": "Teleport to specified coordinates"
},
"reload": {
"Enabled": true,
"Description": "Reload all players in your Land"
},
"kqf":{
"Enabled": false,
"Description": "Get or Set your HR Key Quest progress"
},
"course": {
"Enabled": true,
"Description": "Toggle Courses on your account"
},
"psn": {
"Enabled": true,
"Description": "Link a PlayStation Network ID to your account"
},
"discord": {
"Enabled": true,
"Description": "Generate a token to link your Discord account"
},
"ban": {
"Enabled": false,
"Description": "Ban/Temp Ban a user"
},
"timer": {
"Enabled": true,
"Description": "Toggle the Quest timer"
}
},
"Courses": [
{"Name": "HunterLife", "Enabled": true},
{"Name": "Extra", "Enabled": true},
@@ -129,9 +184,13 @@
"Enabled": true,
"Port": 53312
},
"SignV2": {
"Enabled": false,
"Port": 8080
"API": {
"Enabled": true,
"Port": 8080,
"PatchServer": "",
"Banners": [],
"Messages": [],
"Links": []
},
"Channel": {
"Enabled": true

View File

@@ -1,4 +1,4 @@
package _config
package config
import (
"fmt"
@@ -6,6 +6,7 @@ import (
"net"
"os"
"strings"
"sync"
"time"
"github.com/spf13/viper"
@@ -58,7 +59,7 @@ const (
)
var versionStrings = []string{"S1.0", "S1.5", "S2.0", "S2.5", "S3.0", "S3.5", "S4.0", "S5.0", "S5.5", "S6.0", "S7.0",
"S8.0", "S8.5", "S9", "S10", "FW.1", "FW.2", "FW.3", "FW.4", "FW.5", "G1", "G2", "G3", "G3.1", "G3.2", "GG", "G5",
"S8.0", "S8.5", "S9.0", "S10", "FW.1", "FW.2", "FW.3", "FW.4", "FW.5", "G1", "G2", "G3", "G3.1", "G3.2", "GG", "G5",
"G5.1", "G5.2", "G6", "G6.1", "G7", "G8", "G8.1", "G9", "G9.1", "G10", "G10.1", "Z1", "Z2", "ZZ"}
func (m Mode) String() string {
@@ -75,67 +76,88 @@ type Config struct {
LoginNotices []string // MHFML string of the login notices displayed
PatchServerManifest string // Manifest patch server override
PatchServerFile string // File patch server override
ScreenshotAPIURL string // Destination for screenshots uploaded to BBS
DeleteOnSaveCorruption bool // Attempts to save corrupted data will flag the save for deletion
ClientMode string
RealClientMode Mode
DevMode bool
ClientID Mode
QuestCacheExpiry int // Number of seconds to keep quest data cached
CommandPrefix string // The prefix for commands
AutoCreateAccount bool // Automatically create accounts if they don't exist
LoopDelay int // Delay in milliseconds between each loop iteration
DefaultCourses []uint16
EarthStatus int32
EarthID int32
EarthMonsters []int32
SaveDumps SaveDumpOptions
Screenshots ScreenshotsOptions
DevModeOptions DevModeOptions
DebugOptions DebugOptions
GameplayOptions GameplayOptions
Discord Discord
Commands []Command
Commands map[string]Command
Courses []Course
Database Database
Sign Sign
SignV2 SignV2
API API
Channel Channel
Entrance Entrance
}
// DevModeOptions holds various debug/temporary options for use while developing Erupe.
type DevModeOptions struct {
AutoCreateAccount bool // Automatically create accounts if they don't exist
CleanDB bool // Automatically wipes the DB on server reset.
MaxLauncherHR bool // Sets the HR returned in the launcher to HR7 so that you can join non-beginner worlds.
LogInboundMessages bool // Log all messages sent to the server
LogOutboundMessages bool // Log all messages sent to the clients
MaxHexdumpLength int // Maximum number of bytes printed when logs are enabled
DivaEvent int // Diva Defense event status
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!)
QuestDebugTools bool // Enable various quest debug logs
EarthStatusOverride int32
EarthIDOverride int32
EarthMonsterOverride int32
SaveDumps SaveDumpOptions
type SaveDumpOptions struct {
Enabled bool
RawEnabled bool
OutputDir string
}
type SaveDumpOptions struct {
Enabled bool
OutputDir string
type ScreenshotsOptions struct {
Enabled bool
Host string // Destination for screenshots uploaded to BBS
Port uint32 // Port for screenshots API
OutputDir string
UploadQuality int //Determines the upload quality to the server
}
// DebugOptions holds various debug/temporary options for use while developing Erupe.
type DebugOptions struct {
CleanDB bool // Automatically wipes the DB on server reset.
MaxLauncherHR bool // Sets the HR returned in the launcher to HR7 so that you can join non-beginner worlds.
LogInboundMessages bool // Log all messages sent to the server
LogOutboundMessages bool // Log all messages sent to the clients
LogMessageData bool // Log all bytes transferred as a hexdump
MaxHexdumpLength int // Maximum number of bytes printed when logs are enabled
DivaOverride int // Diva Defense event status
FestaOverride int // Hunter's Festa event status
TournamentOverride int // VS Tournament event status
DisableTokenCheck bool // Disables checking login token exists in the DB (security risk!)
QuestTools bool // Enable various quest debug logs
AutoQuestBackport bool // Automatically backport quest files
ProxyPort uint16 // Forces the game to connect to a channel server proxy
CapLink CapLinkOptions
}
type CapLinkOptions struct {
Values []uint16
Key string
Host string
Port int
}
// GameplayOptions has various gameplay modifiers
type GameplayOptions struct {
FeaturedWeapons int // Number of Active Feature weapons to generate daily
MaximumNP int // Maximum number of NP held by a player
MaximumRP uint16 // Maximum number of RP held by a player
MaximumFP uint32 // Maximum number of FP held by a player
TreasureHuntExpiry uint32 // Seconds until a Clan Treasure Hunt will expire
TreasureHuntPartnyaCooldown uint32 // Seconds until a Partnya can be assigned to another Clan Treasure Hunt
DisableLoginBoost bool // Disables the Login Boost system
DisableBoostTime bool // Disables the daily NetCafe Boost Time
BoostTimeDuration int // The number of minutes NetCafe Boost Time lasts for
GuildMealDuration int // The number of minutes a Guild Meal can be activated for after cooking
BonusQuestAllowance uint32 // Number of Bonus Point Quests to allow daily
DailyQuestAllowance uint32 // Number of Daily Quests to allow daily
MezfesSoloTickets uint32 // Number of solo tickets given weekly
MezfesGroupTickets uint32 // Number of group tickets given weekly
LowLatencyRaviente bool // Toggles low latency mode for Raviente, can be network intensive
MinFeatureWeapons int // Minimum number of Active Feature weapons to generate daily
MaxFeatureWeapons int // Maximum number of Active Feature weapons to generate daily
MaximumNP int // Maximum number of NP held by a player
MaximumRP uint16 // Maximum number of RP held by a player
MaximumFP uint32 // Maximum number of FP held by a player
TreasureHuntExpiry uint32 // Seconds until a Clan Treasure Hunt will expire
TreasureHuntPartnyaCooldown uint32 // Seconds until a Partnya can be assigned to another Clan Treasure Hunt
DisableLoginBoost bool // Disables the Login Boost system
DisableBoostTime bool // Disables the daily NetCafe Boost Time
BoostTimeDuration int // Second that the NetCafe Boost Time lasts
ClanMealDuration int // Second that a Clan Meal can be activated for after cooking
ClanMemberLimits [][]uint8 // Array of maximum Clan Members -> [Rank, Members]
BonusQuestAllowance uint32 // Number of Bonus Point Quests to allow daily
DailyQuestAllowance uint32 // Number of Daily Quests to allow daily
LowLatencyRaviente bool // Toggles low latency mode for Raviente, can be network intensive
RegularRavienteMaxPlayers uint8
ViolentRavienteMaxPlayers uint8
BerserkRavienteMaxPlayers uint8
@@ -143,12 +165,31 @@ type GameplayOptions struct {
SmallBerserkRavienteMaxPlayers uint8
GUrgentRate float32 // Adjusts the rate of G Urgent quests spawning
GCPMultiplier float32 // Adjusts the multiplier of GCP rewarded for quest completion
HRPMultiplier float32 // Adjusts the multiplier of Hunter Rank Points rewarded for quest completion
HRPMultiplierNC float32 // Adjusts the multiplier of Hunter Rank Points rewarded for quest completion in a NetCafe
SRPMultiplier float32 // Adjusts the multiplier of Skill Rank Points rewarded for quest completion
SRPMultiplierNC float32 // Adjusts the multiplier of Skill Rank Points rewarded for quest completion in a NetCafe
GRPMultiplier float32 // Adjusts the multiplier of G Rank Points rewarded for quest completion
GRPMultiplierNC float32 // Adjusts the multiplier of G Rank Points rewarded for quest completion in a NetCafe
GSRPMultiplier float32 // Adjusts the multiplier of G Skill Rank Points rewarded for quest completion
GSRPMultiplierNC float32 // Adjusts the multiplier of G Skill Rank Points rewarded for quest completion in a NetCafe
ZennyMultiplier float32 // Adjusts the multiplier of Zenny rewarded for quest completion
ZennyMultiplierNC float32 // Adjusts the multiplier of Zenny rewarded for quest completion in a NetCafe
GZennyMultiplier float32 // Adjusts the multiplier of G Zenny rewarded for quest completion
GZennyMultiplierNC float32 // Adjusts the multiplier of G Zenny rewarded for quest completion in a NetCafe
MaterialMultiplier float32 // Adjusts the multiplier of Monster Materials rewarded for quest completion
MaterialMultiplierNC float32 // Adjusts the multiplier of Monster Materials rewarded for quest completion in a NetCafe
GMaterialMultiplier float32 // Adjusts the multiplier of G Rank Monster Materials rewarded for quest completion
GMaterialMultiplierNC float32 // Adjusts the multiplier of G Rank Monster Materials rewarded for quest completion in a NetCafe
ExtraCarves uint16 // Grant n extra chances to carve ALL carcasses
ExtraCarvesNC uint16 // Grant n extra chances to carve ALL carcasses in a NetCafe
GExtraCarves uint16 // Grant n extra chances to carve ALL G Rank carcasses
GExtraCarvesNC uint16 // Grant n extra chances to carve ALL G Rank carcasses in a NetCafe
DisableHunterNavi bool // Disables the Hunter Navi
MezFesSoloTickets uint32 // Number of solo tickets given weekly
MezFesGroupTickets uint32 // Number of group tickets given weekly
MezFesDuration int // Seconds that MezFes will last for weekly (from 12AM Mon backwards)
MezFesSwitchMinigame bool // Swaps out Volpakkun Together for Tokotoko Partnya
EnableKaijiEvent bool // Enables the Kaiji event in the Rasta Bar
EnableHiganjimaEvent bool // Enables the Higanjima event in the Rasta Bar
EnableNierEvent bool // Enables the Nier event in the Rasta Bar
@@ -158,16 +199,23 @@ type GameplayOptions struct {
// Discord holds the discord integration config.
type Discord struct {
Enabled bool
BotToken string
RealtimeChannelID string
Enabled bool
BotToken string
RelayChannel DiscordRelay
}
type DiscordRelay struct {
Enabled bool
MaxMessageLength int
RelayChannelID string
}
// Command is a channelserver chat command
type Command struct {
Name string
Enabled bool
Prefix string
Name string
Enabled bool
Description string
Prefix string
}
// Course represents a course within MHF
@@ -191,10 +239,32 @@ type Sign struct {
Port int
}
// SignV2 holds the new sign server config
type SignV2 struct {
Enabled bool
Port int
// API holds server config
type API struct {
Enabled bool
Port int
PatchServer string
Banners []APISignBanner
Messages []APISignMessage
Links []APISignLink
}
type APISignBanner struct {
Src string `json:"src"` // Displayed image URL
Link string `json:"link"` // Link accessed on click
}
type APISignMessage struct {
Message string `json:"message"` // Displayed message
Date int64 `json:"date"` // Displayed date
Kind int `json:"kind"` // 0 for 'Default', 1 for 'New'
Link string `json:"link"` // Link accessed on click
}
type APISignLink struct {
Name string `json:"name"` // Displayed name
Icon string `json:"icon"` // Displayed icon. It will be cast as a monochrome color as long as it is transparent.
Link string `json:"link"` // Link accessed on click
}
type Channel struct {
@@ -230,15 +300,10 @@ type EntranceChannelInfo struct {
CurrentPlayers uint16
}
var ErupeConfig *Config
func init() {
var err error
ErupeConfig, err = LoadConfig()
if err != nil {
preventClose(fmt.Sprintf("Failed to load config: %s", err.Error()))
}
}
var (
once sync.Once
ErupeConfig *Config
)
// getOutboundIP4 gets the preferred outbound ip4 of this machine
// From https://stackoverflow.com/a/37382208
@@ -281,21 +346,34 @@ func LoadConfig() (*Config, error) {
for i := range versionStrings {
if strings.ToUpper(c.ClientMode) == versionStrings[i] {
c.RealClientMode = Mode(i + 1)
c.ClientID = Mode(i + 1)
c.ClientMode = strings.ToUpper(c.ClientMode)
if c.RealClientMode <= G101 {
if c.ClientID <= G101 {
c.ClientMode += " (Debug only)"
}
}
}
if c.RealClientMode == 0 {
if c.ClientID == 0 {
c.ClientMode = versionStrings[len(versionStrings)-1]
c.RealClientMode = ZZ
c.ClientID = ZZ
}
if c.GameplayOptions.MinFeatureWeapons > c.GameplayOptions.MaxFeatureWeapons {
c.GameplayOptions.MinFeatureWeapons = c.GameplayOptions.MaxFeatureWeapons
}
return c, nil
}
func GetConfig() *Config {
once.Do(func() {
var err error
ErupeConfig, err = LoadConfig()
if err != nil {
preventClose(fmt.Sprintf("Failed to load config: %s", err.Error()))
}
})
return ErupeConfig
}
func preventClose(text string) {
if ErupeConfig.DisableSoftCrash {
os.Exit(0)

70
docker/README.md Normal file
View File

@@ -0,0 +1,70 @@
# Docker for erupe
## Building the container
Run the following from the route of the soruce folder. In this example we give it the tag of dev to seperate it from any other container verions.
```bash
docker build . -t erupe:dev
```
## Running the container in isolation
This is just running the container. You can do volume mounts into the container for the `config.json` to tell it to communicate to a database. You will need to do this also for other folders such as `bin` and `savedata`
```bash
docker run erupe:dev
```
## Docker compose
Docker compose allows you to run multiple containers at once. The docker compose in this folder has 3 things set up.
- postgres
- pg admin (Admin interface to make db changes)
- erupe
We automatically populate the database to the latest version on start. If you you are updating you will need to apply the new schemas manually.
Before we get started you should make sure the database info matches whats in the docker compose file for the environment variables `POSTGRES_PASSWORD`,`POSTGRES_USER` and `POSTGRES_DB`. You can set the host to be the service name `db`.
Here is a example of what you would put in the config.json if you was to leave the defaults. It is strongly recommended to change the password.
```txt
"Database": {
"Host": "db",
"Port": 5432,
"User": "postgres",
"Password": "password",
"Database": "erupe"
},
```
Place this file within ./docker/config.json
You will need to do the same for your bins place these in ./docker/bin
# Setting up the web hosted materials
Clone the Severs repo into ./docker/Severs
Make sure your hosts are pointing to where this is hosted
## Turning off the server safely
```bash
docker-compose stop
```
## Turning off the server destructive
```bash
docker-compose down
```
Make sure if you want to delete your data you delete the folders that persisted
- ./docker/savedata
- ./docker/db-data
## Turning on the server again
This boots the db pgadmin and the server in a detached state
```bash
docker-compose up -d
```
if you want all the logs and you want it to be in an attached state
```bash
docker-compose up
```
# Troubleshooting
Q: My Postgres will not populate. A: You're setup.sh is maybe saved as CRLF it needs to be saved as LF.

71
docker/docker-compose.yml Normal file
View File

@@ -0,0 +1,71 @@
version: "3.9"
# 1. docker-compose up db pgadmin
# 2. Use pgadmin to restore db and also apply patch-schema
# 3. Configure the config.json example. in docker you can point to the service name for the database i.e db
# 4. In seperate terminal docker-compose up server
# 5. If all went well happy hunting!
services:
db:
image: postgres
environment:
# (Make sure these match config.json)
- POSTGRES_USER=postgres
- POSTGRES_PASSWORD=password
- POSTGRES_DB=erupe
ports:
- "5432:5432"
volumes:
- ./db-data/:/var/lib/postgresql/data/
- ../schemas/:/schemas/
- ./init/setup.sh:/docker-entrypoint-initdb.d/setup.sh
healthcheck:
test: ["CMD-SHELL", "pg_isready -U postgres"]
interval: 5s
timeout: 5s
retries: 5
pgadmin:
image: dpage/pgadmin4
restart: always
environment:
PGADMIN_DEFAULT_EMAIL: user@pgadmin.com
PGADMIN_DEFAULT_PASSWORD: password
ports:
- "5050:80"
depends_on:
db:
condition: service_healthy
server:
depends_on:
db:
condition: service_healthy
# If using prebuilt container change paths and config
build:
context: ../
volumes:
- ../config.json:/app/erupe/config.json
- ../bin:/app/erupe/bin
- ./savedata:/app/erupe/savedata
ports:
# (Make sure these match config.json)
- "53312:53312" #Sign V1
- "8080:8080" #Sign V2
- "53310:53310" #Entrance
# Channels
- "54001:54001"
- "54002:54002"
- "54003:54003"
- "54004:54004"
- "54005:54005"
- "54006:54006"
- "54007:54007"
- "54008:54008"
web:
image: httpd:latest
container_name: my-apache-app
ports:
- '80:80'
volumes:
- ./Servers:/usr/local/apache2/htdocs
depends_on:
db:
condition: service_healthy

22
docker/init/setup.sh Normal file
View File

@@ -0,0 +1,22 @@
#!/bin/bash
set -e
echo "INIT!"
pg_restore --username="$POSTGRES_USER" --dbname="$POSTGRES_DB" --verbose /schemas/init.sql
echo "Updating!"
for file in /schemas/update-schema/*
do
psql -v ON_ERROR_STOP=1 --username "$POSTGRES_USER" --dbname "$POSTGRES_DB" -1 -f $file
done
echo "Patching!"
for file in /schemas/patch-schema/*
do
psql -v ON_ERROR_STOP=1 --username "$POSTGRES_USER" --dbname "$POSTGRES_DB" -1 -f $file
done

BIN
erupe.ico Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 88 KiB

31
go.mod
View File

@@ -4,32 +4,35 @@ go 1.21
require (
github.com/bwmarrin/discordgo v0.27.1
github.com/gorilla/handlers v1.5.1
github.com/gorilla/mux v1.8.0
github.com/gorilla/handlers v1.5.2
github.com/gorilla/mux v1.8.1
github.com/jmoiron/sqlx v1.3.5
github.com/lib/pq v1.10.9
github.com/spf13/viper v1.16.0
go.uber.org/zap v1.25.0
golang.org/x/crypto v0.12.0
golang.org/x/exp v0.0.0-20230817173708-d852ddb80c63
golang.org/x/text v0.12.0
github.com/spf13/viper v1.17.0
go.uber.org/zap v1.26.0
golang.org/x/crypto v0.17.0
golang.org/x/exp v0.0.0-20231110203233-9a3e6036ecaa
golang.org/x/text v0.14.0
)
require (
github.com/felixge/httpsnoop v1.0.3 // indirect
github.com/fsnotify/fsnotify v1.6.0 // indirect
github.com/gorilla/websocket v1.5.0 // indirect
github.com/felixge/httpsnoop v1.0.4 // indirect
github.com/fsnotify/fsnotify v1.7.0 // indirect
github.com/gorilla/websocket v1.5.1 // indirect
github.com/hashicorp/hcl v1.0.0 // indirect
github.com/magiconair/properties v1.8.7 // indirect
github.com/mitchellh/mapstructure v1.5.0 // indirect
github.com/pelletier/go-toml/v2 v2.0.9 // indirect
github.com/spf13/afero v1.9.5 // indirect
github.com/pelletier/go-toml/v2 v2.1.0 // indirect
github.com/sagikazarmark/locafero v0.3.0 // indirect
github.com/sagikazarmark/slog-shim v0.1.0 // indirect
github.com/sourcegraph/conc v0.3.0 // indirect
github.com/spf13/afero v1.10.0 // indirect
github.com/spf13/cast v1.5.1 // indirect
github.com/spf13/jwalterweatherman v1.1.0 // indirect
github.com/spf13/pflag v1.0.5 // indirect
github.com/subosito/gotenv v1.6.0 // indirect
go.uber.org/multierr v1.11.0 // indirect
golang.org/x/sys v0.11.0 // indirect
golang.org/x/net v0.18.0 // indirect
golang.org/x/sys v0.15.0 // indirect
gopkg.in/ini.v1 v1.67.0 // indirect
gopkg.in/yaml.v3 v3.0.1 // indirect
)

76
go.sum
View File

@@ -38,8 +38,6 @@ cloud.google.com/go/storage v1.14.0/go.mod h1:GrKmX003DSIwi9o29oFT7YDnHYwZoctc3f
dmitri.shuralyov.com/gpu/mtl v0.0.0-20190408044501-666a987793e9/go.mod h1:H6x//7gZCb22OMCxBHrMx7a5I7Hp++hsVxbQ4BYO7hU=
github.com/BurntSushi/toml v0.3.1/go.mod h1:xHWCNGjB5oqiDr8zfno3MHue2Ht5sIBksp03qcyfWMU=
github.com/BurntSushi/xgb v0.0.0-20160522181843-27f122750802/go.mod h1:IVnqGOEym/WlBOVXweHU+Q+/VP0lqqI8lqeDx9IjBqo=
github.com/benbjohnson/clock v1.3.0 h1:ip6w0uFQkncKQ979AypyG0ER7mqUSBdKLOgAle/AT8A=
github.com/benbjohnson/clock v1.3.0/go.mod h1:J11/hYXuz8f4ySSvYwY0FKfm+ezbsZBKZxNJlLklBHA=
github.com/bwmarrin/discordgo v0.27.1 h1:ib9AIc/dom1E/fSIulrBwnez0CToJE113ZGt4HoliGY=
github.com/bwmarrin/discordgo v0.27.1/go.mod h1:NJZpH+1AfhIcyQsPeuBKsUtYrRnjkyu0kIVMCHkZtRY=
github.com/census-instrumentation/opencensus-proto v0.2.1/go.mod h1:f6KPmirojxKA12rnyqOA5BBL4O983OfeGPqjHWSTneU=
@@ -51,21 +49,21 @@ github.com/cncf/udpa/go v0.0.0-20191209042840-269d4d468f6f/go.mod h1:M8M6+tZqaGX
github.com/cncf/udpa/go v0.0.0-20200629203442-efcf912fb354/go.mod h1:WmhPx2Nbnhtbo57+VJT5O0JRkEi1Wbu0z5j0R8u5Hbk=
github.com/cncf/udpa/go v0.0.0-20201120205902-5459f2c99403/go.mod h1:WmhPx2Nbnhtbo57+VJT5O0JRkEi1Wbu0z5j0R8u5Hbk=
github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c=
github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc h1:U9qPSI2PIWSS1VwoXQT9A3Wy9MM3WgvqSxFWenqJduM=
github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
github.com/envoyproxy/go-control-plane v0.9.0/go.mod h1:YTl/9mNaCwkRvm6d1a2C3ymFceY/DCBVvsKhRF0iEA4=
github.com/envoyproxy/go-control-plane v0.9.1-0.20191026205805-5f8ba28d4473/go.mod h1:YTl/9mNaCwkRvm6d1a2C3ymFceY/DCBVvsKhRF0iEA4=
github.com/envoyproxy/go-control-plane v0.9.4/go.mod h1:6rpuAdCZL397s3pYoYcLgu1mIlRU8Am5FuJP05cCM98=
github.com/envoyproxy/go-control-plane v0.9.7/go.mod h1:cwu0lG7PUMfa9snN8LXBig5ynNVH9qI8YYLbd1fK2po=
github.com/envoyproxy/go-control-plane v0.9.9-0.20201210154907-fd9021fe5dad/go.mod h1:cXg6YxExXjJnVBQHBLXeUAgxn2UodCpnH306RInaBQk=
github.com/envoyproxy/protoc-gen-validate v0.1.0/go.mod h1:iSmxcyjqTsJpI2R4NaDN7+kN2VEUnK/pcBlmesArF7c=
github.com/felixge/httpsnoop v1.0.1/go.mod h1:m8KPJKqk1gH5J9DgRY2ASl2lWCfGKXixSwevea8zH2U=
github.com/felixge/httpsnoop v1.0.3 h1:s/nj+GCswXYzN5v2DpNMuMQYe+0DDwt5WVCU6CWBdXk=
github.com/felixge/httpsnoop v1.0.3/go.mod h1:m8KPJKqk1gH5J9DgRY2ASl2lWCfGKXixSwevea8zH2U=
github.com/felixge/httpsnoop v1.0.4 h1:NFTV2Zj1bL4mc9sqWACXbQFVBBg2W3GPvqp8/ESS2Wg=
github.com/felixge/httpsnoop v1.0.4/go.mod h1:m8KPJKqk1gH5J9DgRY2ASl2lWCfGKXixSwevea8zH2U=
github.com/frankban/quicktest v1.14.4 h1:g2rn0vABPOOXmZUj+vbmUp0lPoXEMuhTpIluN0XL9UY=
github.com/frankban/quicktest v1.14.4/go.mod h1:4ptaffx2x8+WTWXmUCuVU6aPUX1/Mz7zb5vbUoiM6w0=
github.com/fsnotify/fsnotify v1.6.0 h1:n+5WquG0fcWoWp6xPWfHdbskMCQaFnG6PfBrh1Ky4HY=
github.com/fsnotify/fsnotify v1.6.0/go.mod h1:sl3t1tCWJFWoRz9R8WJCbQihKKwmorjAbSClcnxKAGw=
github.com/fsnotify/fsnotify v1.7.0 h1:8JEhPFa5W2WU7YfeZzPNqzMP6Lwt7L2715Ggo0nosvA=
github.com/fsnotify/fsnotify v1.7.0/go.mod h1:40Bi/Hjc2AVfZrqy+aj+yEI+/bRxZnMJyTJwOpGvigM=
github.com/go-gl/glfw v0.0.0-20190409004039-e6da0acd62b1/go.mod h1:vR7hzQXu2zJy9AVAgeJqvqgH9Q5CA+iKCZ2gyEVpxRU=
github.com/go-gl/glfw/v3.3/glfw v0.0.0-20191125211704-12ad95a8df72/go.mod h1:tQ2UAYgL5IevRw8kRxooKSPJfGvJ9fJQFa0TUsXzTg8=
github.com/go-gl/glfw/v3.3/glfw v0.0.0-20200222043503-6f7a984d4dc4/go.mod h1:tQ2UAYgL5IevRw8kRxooKSPJfGvJ9fJQFa0TUsXzTg8=
@@ -127,13 +125,13 @@ github.com/google/uuid v1.1.2/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+
github.com/googleapis/gax-go/v2 v2.0.4/go.mod h1:0Wqv26UfaUD9n4G6kQubkQ+KchISgw+vpHVxEJEs9eg=
github.com/googleapis/gax-go/v2 v2.0.5/go.mod h1:DWXyrwAJ9X0FpwwEdw+IPEYBICEFu5mhpdKc/us6bOk=
github.com/googleapis/google-cloud-go-testing v0.0.0-20200911160855-bcd43fbb19e8/go.mod h1:dvDLG8qkwmyD9a/MJJN3XJcT3xFxOKAvTZGvuZmac9g=
github.com/gorilla/handlers v1.5.1 h1:9lRY6j8DEeeBT10CvO9hGW0gmky0BprnvDI5vfhUHH4=
github.com/gorilla/handlers v1.5.1/go.mod h1:t8XrUpc4KVXb7HGyJ4/cEnwQiaxrX/hz1Zv/4g96P1Q=
github.com/gorilla/mux v1.8.0 h1:i40aqfkR1h2SlN9hojwV5ZA91wcXFOvkdNIeFDP5koI=
github.com/gorilla/mux v1.8.0/go.mod h1:DVbg23sWSpFRCP0SfiEN6jmj59UnW/n46BH5rLB71So=
github.com/gorilla/handlers v1.5.2 h1:cLTUSsNkgcwhgRqvCNmdbRWG0A3N4F+M2nWKdScwyEE=
github.com/gorilla/handlers v1.5.2/go.mod h1:dX+xVpaxdSw+q0Qek8SSsl3dfMk3jNddUkMzo0GtH0w=
github.com/gorilla/mux v1.8.1 h1:TuBL49tXwgrFYWhqrNgrUNEY92u81SPhu7sTdzQEiWY=
github.com/gorilla/mux v1.8.1/go.mod h1:AKf9I4AEqPTmMytcMc0KkNouC66V3BtZ4qD5fmWSiMQ=
github.com/gorilla/websocket v1.4.2/go.mod h1:YR8l580nyteQvAITg2hZ9XVh4b55+EU/adAjf1fMHhE=
github.com/gorilla/websocket v1.5.0 h1:PPwGk2jz7EePpoHN/+ClbZu8SPxiqlu12wZP/3sWmnc=
github.com/gorilla/websocket v1.5.0/go.mod h1:YR8l580nyteQvAITg2hZ9XVh4b55+EU/adAjf1fMHhE=
github.com/gorilla/websocket v1.5.1 h1:gmztn0JnHVt9JZquRuzLw3g4wouNVzKL15iLr/zn/QY=
github.com/gorilla/websocket v1.5.1/go.mod h1:x3kM2JMyaluk02fnUJpQuwD2dCS5NDG2ZHL0uE0tcaY=
github.com/hashicorp/golang-lru v0.5.0/go.mod h1:/m3WP610KZHVQ1SGc6re/UDhFvYD7pJ4Ao+sR/qLZy8=
github.com/hashicorp/golang-lru v0.5.1/go.mod h1:/m3WP610KZHVQ1SGc6re/UDhFvYD7pJ4Ao+sR/qLZy8=
github.com/hashicorp/hcl v1.0.0 h1:0Anlzjpi4vEasTeNFn2mLJgTSwt0+6sfsiTG8qcWGx4=
@@ -162,30 +160,34 @@ github.com/mattn/go-sqlite3 v1.14.6 h1:dNPt6NO46WmLVt2DLNpwczCmdV5boIZ6g/tlDrlRU
github.com/mattn/go-sqlite3 v1.14.6/go.mod h1:NyWgC/yNuGj7Q9rpYnZvas74GogHl5/Z4A/KQRfk6bU=
github.com/mitchellh/mapstructure v1.5.0 h1:jeMsZIYE/09sWLaz43PL7Gy6RuMjD2eJVyuac5Z2hdY=
github.com/mitchellh/mapstructure v1.5.0/go.mod h1:bFUtVrKA4DC2yAKiSyO/QUcy7e+RRV2QTWOzhPopBRo=
github.com/pelletier/go-toml/v2 v2.0.9 h1:uH2qQXheeefCCkuBBSLi7jCiSmj3VRh2+Goq2N7Xxu0=
github.com/pelletier/go-toml/v2 v2.0.9/go.mod h1:tJU2Z3ZkXwnxa4DPO899bsyIoywizdUvyaeZurnPPDc=
github.com/pelletier/go-toml/v2 v2.1.0 h1:FnwAJ4oYMvbT/34k9zzHuZNrhlz48GB3/s6at6/MHO4=
github.com/pelletier/go-toml/v2 v2.1.0/go.mod h1:tJU2Z3ZkXwnxa4DPO899bsyIoywizdUvyaeZurnPPDc=
github.com/pkg/errors v0.9.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0=
github.com/pkg/sftp v1.13.1/go.mod h1:3HaPG6Dq1ILlpPZRO0HVMrsydcdLt6HRDccSgb87qRg=
github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM=
github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4=
github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2 h1:Jamvg5psRIccs7FGNTlIRMkT8wgtp5eCXdBlqhYGL6U=
github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4=
github.com/prometheus/client_model v0.0.0-20190812154241-14fe0d1b01d4/go.mod h1:xMI15A0UPsDsEKsMN9yxemIoYk6Tm2C1GtYGdfGttqA=
github.com/rogpeppe/go-internal v1.3.0/go.mod h1:M8bDsm7K2OlrFYOpmOWEs/qY81heoFRclV5y23lUDJ4=
github.com/rogpeppe/go-internal v1.9.0 h1:73kH8U+JUqXU8lRuOHeVHaa/SZPifC7BkcraZVejAe8=
github.com/rogpeppe/go-internal v1.9.0/go.mod h1:WtVeX8xhTBvf0smdhujwtBcq4Qrzq/fJaraNFVN+nFs=
github.com/spf13/afero v1.9.5 h1:stMpOSZFs//0Lv29HduCmli3GUfpFoF3Y1Q/aXj/wVM=
github.com/spf13/afero v1.9.5/go.mod h1:UBogFpq8E9Hx+xc5CNTTEpTnuHVmXDwZcZcE1eb/UhQ=
github.com/sagikazarmark/locafero v0.3.0 h1:zT7VEGWC2DTflmccN/5T1etyKvxSxpHsjb9cJvm4SvQ=
github.com/sagikazarmark/locafero v0.3.0/go.mod h1:w+v7UsPNFwzF1cHuOajOOzoq4U7v/ig1mpRjqV+Bu1U=
github.com/sagikazarmark/slog-shim v0.1.0 h1:diDBnUNK9N/354PgrxMywXnAwEr1QZcOr6gto+ugjYE=
github.com/sagikazarmark/slog-shim v0.1.0/go.mod h1:SrcSrq8aKtyuqEI1uvTDTK1arOWRIczQRv+GVI1AkeQ=
github.com/sourcegraph/conc v0.3.0 h1:OQTbbt6P72L20UqAkXXuLOj79LfEanQ+YQFNpLA9ySo=
github.com/sourcegraph/conc v0.3.0/go.mod h1:Sdozi7LEKbFPqYX2/J+iBAM6HpqSLTASQIKqDmF7Mt0=
github.com/spf13/afero v1.10.0 h1:EaGW2JJh15aKOejeuJ+wpFSHnbd7GE6Wvp3TsNhb6LY=
github.com/spf13/afero v1.10.0/go.mod h1:UBogFpq8E9Hx+xc5CNTTEpTnuHVmXDwZcZcE1eb/UhQ=
github.com/spf13/cast v1.5.1 h1:R+kOtfhWQE6TVQzY+4D7wJLBgkdVasCEFxSUBYBYIlA=
github.com/spf13/cast v1.5.1/go.mod h1:b9PdjNptOpzXr7Rq1q9gJML/2cdGQAo69NKzQ10KN48=
github.com/spf13/jwalterweatherman v1.1.0 h1:ue6voC5bR5F8YxI5S67j9i582FU4Qvo2bmqnqMYADFk=
github.com/spf13/jwalterweatherman v1.1.0/go.mod h1:aNWZUN0dPAAO/Ljvb5BEdw96iTZ0EXowPYD95IqWIGo=
github.com/spf13/pflag v1.0.5 h1:iy+VFUOCP1a+8yFto/drg2CJ5u0yRoB7fZw3DKv/JXA=
github.com/spf13/pflag v1.0.5/go.mod h1:McXfInJRrz4CZXVZOBLb0bTZqETkiAhM9Iw0y3An2Bg=
github.com/spf13/viper v1.16.0 h1:rGGH0XDZhdUOryiDWjmIvUSWpbNqisK8Wk0Vyefw8hc=
github.com/spf13/viper v1.16.0/go.mod h1:yg78JgCJcbrQOvV9YLXgkLaZqUidkY9K+Dd1FofRzQg=
github.com/spf13/viper v1.17.0 h1:I5txKw7MJasPL/BrfkbA0Jyo/oELqVmux4pR/UxOMfI=
github.com/spf13/viper v1.17.0/go.mod h1:BmMMMLQXSbcHK6KAOiFLz0l5JHrU89OdIRHvsk0+yVI=
github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME=
github.com/stretchr/objx v0.4.0/go.mod h1:YvHI0jy2hoMjB+UWwv71VJQ9isScKT/TqJzVSSt89Yw=
github.com/stretchr/objx v0.5.0/go.mod h1:Yh+to48EsGEfYuaHDzXPcE3xhTkx73EhmCGUpEOglKo=
github.com/stretchr/testify v1.2.2/go.mod h1:a8OnRcib4nhh0OaRAV+Yts87kKdq0PP7pXfy6kDkUVs=
github.com/stretchr/testify v1.4.0/go.mod h1:j7eGeouHqKxXV5pUuKE4zz7dFj8WfuZ+81PSLYec5m4=
github.com/stretchr/testify v1.5.1/go.mod h1:5W2xD1RspED5o8YsWQXVCued0rvSQ+mT+I5cxcmMvtA=
github.com/stretchr/testify v1.7.0/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg=
@@ -209,8 +211,8 @@ go.uber.org/goleak v1.2.0 h1:xqgm/S+aQvhWFTtR0XK3Jvg7z8kGV8P4X14IzwN3Eqk=
go.uber.org/goleak v1.2.0/go.mod h1:XJYK+MuIchqpmGmUSAzotztawfKvYLUIgg7guXrwVUo=
go.uber.org/multierr v1.11.0 h1:blXXJkSxSSfBVBlC76pxqeO+LN3aDfLQo+309xJstO0=
go.uber.org/multierr v1.11.0/go.mod h1:20+QtiLqy0Nd6FdQB9TLXag12DsQkrbs3htMFfDN80Y=
go.uber.org/zap v1.25.0 h1:4Hvk6GtkucQ790dqmj7l1eEnRdKm3k3ZUrUMS2d5+5c=
go.uber.org/zap v1.25.0/go.mod h1:JIAUzQIH94IC4fOJQm7gMmBJP5k7wQfdcnYdPoEXJYk=
go.uber.org/zap v1.26.0 h1:sI7k6L95XOKS281NhVKOFCUNIvv9e0w4BF8N3u+tCRo=
go.uber.org/zap v1.26.0/go.mod h1:dtElttAiwGvoJ/vj4IwHBS/gXsEu/pZ50mUIRWuG0so=
golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w=
golang.org/x/crypto v0.0.0-20190510104115-cbcb75029529/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI=
golang.org/x/crypto v0.0.0-20190605123033-f99c8df09eb5/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI=
@@ -218,8 +220,8 @@ golang.org/x/crypto v0.0.0-20191011191535-87dc89f01550/go.mod h1:yigFU9vqHzYiE8U
golang.org/x/crypto v0.0.0-20200622213623-75b288015ac9/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto=
golang.org/x/crypto v0.0.0-20210421170649-83a5a9bb288b/go.mod h1:T9bdIzuCu7OtxOm1hfPfRQxPLYneinmdGuTeoZ9dtd4=
golang.org/x/crypto v0.0.0-20220722155217-630584e8d5aa/go.mod h1:IxCIyHEi3zRg3s0A5j5BB6A9Jmi73HwBIUl50j+osU4=
golang.org/x/crypto v0.12.0 h1:tFM/ta59kqch6LlvYnPa0yx5a83cL2nHflFhYKvv9Yk=
golang.org/x/crypto v0.12.0/go.mod h1:NF0Gs7EO5K4qLn+Ylc+fih8BSTeIjAP05siRnAh98yw=
golang.org/x/crypto v0.17.0 h1:r8bRNjWL3GshPW3gkd+RpvzWrZAwPS49OmTGZ/uhM4k=
golang.org/x/crypto v0.17.0/go.mod h1:gCAAfMLgwOJRpTjQ2zCCt2OcSfYMTeZVSRtQlPC7Nq4=
golang.org/x/exp v0.0.0-20190121172915-509febef88a4/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA=
golang.org/x/exp v0.0.0-20190306152737-a1d7652674e8/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA=
golang.org/x/exp v0.0.0-20190510132918-efd6b22b2522/go.mod h1:ZjyILWgesfNpC6sMxTJOJm9Kp84zZh5NQWvqDGG3Qr8=
@@ -230,8 +232,8 @@ golang.org/x/exp v0.0.0-20191227195350-da58074b4299/go.mod h1:2RIsYlXP63K8oxa1u0
golang.org/x/exp v0.0.0-20200119233911-0405dc783f0a/go.mod h1:2RIsYlXP63K8oxa1u096TMicItID8zy7Y6sNkU49FU4=
golang.org/x/exp v0.0.0-20200207192155-f17229e696bd/go.mod h1:J/WKrq2StrnmMY6+EHIKF9dgMWnmCNThgcyBT1FY9mM=
golang.org/x/exp v0.0.0-20200224162631-6cc2880d07d6/go.mod h1:3jZMyOhIsHpP37uCMkUooju7aAi5cS1Q23tOzKc+0MU=
golang.org/x/exp v0.0.0-20230817173708-d852ddb80c63 h1:m64FZMko/V45gv0bNmrNYoDEq8U5YUhetc9cBWKS1TQ=
golang.org/x/exp v0.0.0-20230817173708-d852ddb80c63/go.mod h1:0v4NqG35kSWCMzLaMeX+IQrlSnVE/bqGSyC2cz/9Le8=
golang.org/x/exp v0.0.0-20231110203233-9a3e6036ecaa h1:FRnLl4eNAQl8hwxVVC17teOw8kdjVDVAiFMtgUdTSRQ=
golang.org/x/exp v0.0.0-20231110203233-9a3e6036ecaa/go.mod h1:zk2irFbV9DP96SEBUUAy67IdHUaZuSnrz1n472HUCLE=
golang.org/x/image v0.0.0-20190227222117-0694c2d4d067/go.mod h1:kZ7UVZpmo3dzQBMxlp+ypCbDeSB+sBbTgSJuh5dn5js=
golang.org/x/image v0.0.0-20190802002840-cff245a6509b/go.mod h1:FeLwcggjj3mMvU+oOTbSwawSJRM1uh48EjtB4UJZlP0=
golang.org/x/lint v0.0.0-20181026193005-c67002cb31c3/go.mod h1:UVdnD1Gm6xHRNCYTkRU2/jEulfH38KcIWyp/GAMgvoE=
@@ -287,6 +289,8 @@ golang.org/x/net v0.0.0-20201209123823-ac852fbbde11/go.mod h1:m0MpNAwzfU5UDzcl9v
golang.org/x/net v0.0.0-20201224014010-6772e930b67b/go.mod h1:m0MpNAwzfU5UDzcl9v0D8zg8gWTRqZa9RBIspLL5mdg=
golang.org/x/net v0.0.0-20210226172049-e18ecbb05110/go.mod h1:m0MpNAwzfU5UDzcl9v0D8zg8gWTRqZa9RBIspLL5mdg=
golang.org/x/net v0.0.0-20211112202133-69e39bad7dc2/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y=
golang.org/x/net v0.18.0 h1:mIYleuAkSbHh0tCv7RvjL3F6ZVbLjq4+R7zbOn3Kokg=
golang.org/x/net v0.18.0/go.mod h1:/czyP5RqHAH4odGYxBJ1qz0+CE5WZ+2j1YgoEo8F2jQ=
golang.org/x/oauth2 v0.0.0-20180821212333-d2e6202438be/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U=
golang.org/x/oauth2 v0.0.0-20190226205417-e64efc72b421/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw=
golang.org/x/oauth2 v0.0.0-20190604053449-0f29369cfe45/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw=
@@ -341,9 +345,8 @@ golang.org/x/sys v0.0.0-20210225134936-a50acf3fe073/go.mod h1:h1NjWce9XRLGQEsW7w
golang.org/x/sys v0.0.0-20210423082822-04245dca01da/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20210423185535-09eb48e85fd7/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20210615035016-665e8c7367d1/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.0.0-20220908164124-27713097b956/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.11.0 h1:eG7RXZHdqOJ1i+0lgLgCpSXAp6M3LYlAo6osgSi0xOM=
golang.org/x/sys v0.11.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.15.0 h1:h48lPFYpsTvQJZF4EKyI4aLHaev3CxivZmv7yZig9pc=
golang.org/x/sys v0.15.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA=
golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo=
golang.org/x/text v0.0.0-20170915032832-14c0d48ead0c/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=
golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=
@@ -353,8 +356,8 @@ golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ=
golang.org/x/text v0.3.4/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ=
golang.org/x/text v0.3.6/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ=
golang.org/x/text v0.3.7/go.mod h1:u+2+/6zg+i71rQMx5EYifcz6MCKuco9NR6JIITiCfzQ=
golang.org/x/text v0.12.0 h1:k+n5B8goJNdU7hSvEtMUz3d1Q6D/XW4COJSJR6fN0mc=
golang.org/x/text v0.12.0/go.mod h1:TvPlkZtksWOMsz7fbANvkp4WM8x/WCo/om8BMLbz+aE=
golang.org/x/text v0.14.0 h1:ScX5w1eTa3QqT8oi6+ziP7dTV1S2+ALU0bI+0zXKWiQ=
golang.org/x/text v0.14.0/go.mod h1:18ZOQIKpY8NJVqYksKHtTdi31H5itFRjB5/qKTNYzSU=
golang.org/x/time v0.0.0-20181108054448-85acf8d2951c/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ=
golang.org/x/time v0.0.0-20190308202827-9d24e82272b4/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ=
golang.org/x/time v0.0.0-20191024005414-555d28b269f0/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ=
@@ -498,8 +501,9 @@ google.golang.org/protobuf v1.23.1-0.20200526195155-81db48ad09cc/go.mod h1:EGpAD
google.golang.org/protobuf v1.24.0/go.mod h1:r/3tXBNzIEhYS9I1OUVjXDlt8tc493IdKGjtUeSXeh4=
google.golang.org/protobuf v1.25.0/go.mod h1:9JNX74DMeImyA3h4bdi1ymwjUzf21/xIlbajtzgsN7c=
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127 h1:qIbj1fsPNlZgppZ+VLlY7N33q108Sa+fhmuc+sWQYwY=
gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
gopkg.in/check.v1 v1.0.0-20190902080502-41f04d3bba15 h1:YR8cESwS4TdDjEe65xsg0ogRM/Nc3DYOhEAlW+xobZo=
gopkg.in/check.v1 v1.0.0-20190902080502-41f04d3bba15/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
gopkg.in/errgo.v2 v2.1.0/go.mod h1:hNsd1EY+bozCKY1Ytp96fpM3vjJbqLJn88ws8XvfDNI=
gopkg.in/ini.v1 v1.67.0 h1:Dgnx+6+nfE+IfzjUEISNeydPJh9AXNNsWbGP9KzCsOA=
gopkg.in/ini.v1 v1.67.0/go.mod h1:pNLf8WUiyNEtQjuu5G5vTm06TEv9tsIgeAvK8hOrP4k=

18
internal/constant/cast.go Normal file
View File

@@ -0,0 +1,18 @@
package constant
const (
BinaryMessageTypeState = 0
BinaryMessageTypeChat = 1
BinaryMessageTypeQuest = 2
BinaryMessageTypeData = 3
BinaryMessageTypeMailNotify = 4
BinaryMessageTypeEmote = 6
)
// MSG_SYS_CAST[ED]_BINARY broadcast types enum
const (
BroadcastTypeTargeted = 0x01
BroadcastTypeStage = 0x03
BroadcastTypeServer = 0x06
BroadcastTypeWorld = 0x0a
)

View File

@@ -0,0 +1,15 @@
package constant
import "erupe-ce/internal/model"
const (
FestivalColorNone model.FestivalColor = "none"
FestivalColorBlue model.FestivalColor = "blue"
FestivalColorRed model.FestivalColor = "red"
)
var FestivalColorCodes = map[model.FestivalColor]int16{
FestivalColorNone: -1,
FestivalColorBlue: 0,
FestivalColorRed: 1,
}

View File

@@ -0,0 +1,8 @@
package constant
import "erupe-ce/internal/model"
const (
GuildApplicationTypeApplied model.GuildApplicationType = "applied"
GuildApplicationTypeInvited model.GuildApplicationType = "invited"
)

View File

@@ -0,0 +1,11 @@
package model
type Achievement struct {
Level uint8
Value uint32
NextValue uint16
Required uint32
Updated bool
Progress uint32
Trophy uint8
}

12
internal/model/airou.go Normal file
View File

@@ -0,0 +1,12 @@
package model
type Airou struct {
ID uint32
Name []byte
Task uint8
Personality uint8
Class uint8
Experience uint32
WeaponType uint8
WeaponID uint16
}

10
internal/model/cafe.go Normal file
View File

@@ -0,0 +1,10 @@
package model
type CafeBonus struct {
ID uint32 `db:"id"`
TimeReq uint32 `db:"time_req"`
ItemType uint32 `db:"item_type"`
ItemID uint32 `db:"item_id"`
Quantity uint32 `db:"quantity"`
Claimed bool `db:"claimed"`
}

View File

@@ -0,0 +1,41 @@
package model
import "time"
type CampaignEvent struct {
ID uint32
Unk0 uint32
MinHR int16
MaxHR int16
MinSR int16
MaxSR int16
MinGR int16
MaxGR int16
Unk1 uint16
Unk2 uint8
Unk3 uint8
Unk4 uint16
Unk5 uint16
Start time.Time
End time.Time
Unk6 uint8
String0 string
String1 string
String2 string
String3 string
Link string
Prefix string
Categories []uint16
}
type CampaignCategory struct {
ID uint16
Type uint8
Title string
Description string
}
type CampaignLink struct {
CategoryID uint16
CampaignID uint32
}

View File

@@ -0,0 +1,27 @@
package model
import "time"
type Distribution struct {
ID uint32 `db:"id"`
Deadline time.Time `db:"deadline"`
Rights uint32 `db:"rights"`
TimesAcceptable uint16 `db:"times_acceptable"`
TimesAccepted uint16 `db:"times_accepted"`
MinHR int16 `db:"min_hr"`
MaxHR int16 `db:"max_hr"`
MinSR int16 `db:"min_sr"`
MaxSR int16 `db:"max_sr"`
MinGR int16 `db:"min_gr"`
MaxGR int16 `db:"max_gr"`
EventName string `db:"event_name"`
Description string `db:"description"`
Selection bool `db:"selection"`
}
type DistributionItem struct {
ItemType uint8 `db:"item_type"`
ID uint32 `db:"id"`
ItemID uint32 `db:"item_id"`
Quantity uint32 `db:"quantity"`
}

31
internal/model/event.go Normal file
View File

@@ -0,0 +1,31 @@
package model
import "time"
type Event struct {
EventType uint16
Unk1 uint16
Unk2 uint16
Unk3 uint16
Unk4 uint16
Unk5 uint32
Unk6 uint32
QuestFileIDs []uint16
}
type LoginBoost struct {
WeekReq uint8 `db:"week_req"`
WeekCount uint8
Active bool
Expiration time.Time `db:"expiration"`
Reset time.Time `db:"reset"`
}
type ActiveFeature struct {
StartTime time.Time `db:"start_time"`
ActiveFeatures uint32 `db:"featured"`
}
type TrendWeapon struct {
WeaponType uint8
WeaponID uint16
}

32
internal/model/festa.go Normal file
View File

@@ -0,0 +1,32 @@
package model
type FestaTrial struct {
ID uint32 `db:"id"`
Objective uint16 `db:"objective"`
GoalID uint32 `db:"goal_id"`
TimesReq uint16 `db:"times_req"`
Locale uint16 `db:"locale_req"`
Reward uint16 `db:"reward"`
Monopoly FestivalColor `db:"monopoly"`
Unk uint16
}
type FestaReward struct {
Unk0 uint8
Unk1 uint8
ItemType uint16
Quantity uint16
ItemID uint16
Unk5 uint16
Unk6 uint16
Unk7 uint8
}
type FestaPrize struct {
ID uint32 `db:"id"`
Tier uint32 `db:"tier"`
SoulsReq uint32 `db:"souls_req"`
ItemID uint32 `db:"item_id"`
NumItem uint32 `db:"num_item"`
Claimed int `db:"claimed"`
}

58
internal/model/gacha.go Normal file
View File

@@ -0,0 +1,58 @@
package model
type ShopItem struct {
ID uint32 `db:"id"`
ItemID uint32 `db:"item_id"`
Cost uint32 `db:"cost"`
Quantity uint16 `db:"quantity"`
MinHR uint16 `db:"min_hr"`
MinSR uint16 `db:"min_sr"`
MinGR uint16 `db:"min_gr"`
StoreLevel uint8 `db:"store_level"`
MaxQuantity uint16 `db:"max_quantity"`
UsedQuantity uint16 `db:"used_quantity"`
RoadFloors uint16 `db:"road_floors"`
RoadFatalis uint16 `db:"road_fatalis"`
}
type Gacha struct {
ID uint32 `db:"id"`
MinGR uint32 `db:"min_gr"`
MinHR uint32 `db:"min_hr"`
Name string `db:"name"`
URLBanner string `db:"url_banner"`
URLFeature string `db:"url_feature"`
URLThumbnail string `db:"url_thumbnail"`
Wide bool `db:"wide"`
Recommended bool `db:"recommended"`
GachaType uint8 `db:"gacha_type"`
Hidden bool `db:"hidden"`
}
type GachaEntry struct {
EntryType uint8 `db:"entry_type"`
ID uint32 `db:"id"`
ItemType uint8 `db:"item_type"`
ItemNumber uint32 `db:"item_number"`
ItemQuantity uint16 `db:"item_quantity"`
Weight float64 `db:"weight"`
Rarity uint8 `db:"rarity"`
Rolls uint8 `db:"rolls"`
FrontierPoints uint16 `db:"frontier_points"`
DailyLimit uint8 `db:"daily_limit"`
Name string `db:"name"`
}
type GachaItem struct {
ItemType uint8 `db:"item_type"`
ItemID uint16 `db:"item_id"`
Quantity uint16 `db:"quantity"`
}
type FPointExchange struct {
ID uint32 `db:"id"`
ItemType uint8 `db:"item_type"`
ItemID uint16 `db:"item_id"`
Quantity uint16 `db:"quantity"`
FPoints uint16 `db:"fpoints"`
Buyable bool `db:"buyable"`
}

102
internal/model/guild.go Normal file
View File

@@ -0,0 +1,102 @@
package model
import "time"
type GuildAdventure struct {
ID uint32 `db:"id"`
Destination uint32 `db:"destination"`
Charge uint32 `db:"charge"`
Depart uint32 `db:"depart"`
Return uint32 `db:"return"`
CollectedBy string `db:"collected_by"`
}
type GuildTreasureHunt struct {
HuntID uint32 `db:"id"`
HostID uint32 `db:"host_id"`
Destination uint32 `db:"destination"`
Level uint32 `db:"level"`
Start time.Time `db:"start"`
Acquired bool `db:"acquired"`
Collected bool `db:"collected"`
HuntData []byte `db:"hunt_data"`
Hunters uint32 `db:"hunters"`
Claimed bool `db:"claimed"`
}
type GuildTreasureSouvenir struct {
Destination uint32
Quantity uint32
}
type FestivalColor string
type GuildApplicationType string
type GuildIconPart struct {
Index uint16
ID uint16
Page uint8
Size uint8
Rotation uint8
Red uint8
Green uint8
Blue uint8
PosX uint16
PosY uint16
}
type GuildApplication struct {
ID int `db:"id"`
GuildID uint32 `db:"guild_id"`
CharID uint32 `db:"character_id"`
ActorID uint32 `db:"actor_id"`
ApplicationType GuildApplicationType `db:"application_type"`
CreatedAt time.Time `db:"created_at"`
}
type GuildLeader struct {
LeaderCharID uint32 `db:"leader_id"`
LeaderName string `db:"leader_name"`
}
type MessageBoardPost struct {
ID uint32 `db:"id"`
StampID uint32 `db:"stamp_id"`
Title string `db:"title"`
Body string `db:"body"`
AuthorID uint32 `db:"author_id"`
Timestamp time.Time `db:"created_at"`
LikedBy string `db:"liked_by"`
}
type GuildMeal struct {
ID uint32 `db:"id"`
MealID uint32 `db:"meal_id"`
Level uint32 `db:"level"`
CreatedAt time.Time `db:"created_at"`
}
type GuildMission struct {
ID uint32
Unk uint32
Type uint16
Goal uint16
Quantity uint16
SkipTickets uint16
GR bool
RewardType uint16
RewardLevel uint16
}
type GuildAllianceInvite struct {
GuildID uint32
LeaderID uint32
Unk0 uint16
Unk1 uint16
Members uint16
GuildName string
LeaderName string
}
type UnkGuildInfo struct {
Unk0 uint8
Unk1 uint8
Unk2 uint8
}

17
internal/model/house.go Normal file
View File

@@ -0,0 +1,17 @@
package model
import "time"
type HouseData struct {
CharID uint32 `db:"id"`
HR uint16 `db:"hr"`
GR uint16 `db:"gr"`
Name string `db:"name"`
HouseState uint8 `db:"house_state"`
HousePassword string `db:"house_password"`
}
type Title struct {
ID uint16 `db:"id"`
Acquired time.Time `db:"unlocked_at"`
Updated time.Time `db:"updated_at"`
}

40
internal/model/paper.go Normal file
View File

@@ -0,0 +1,40 @@
package model
import "time"
type PaperMissionTimetable struct {
Start time.Time
End time.Time
}
type PaperMissionData struct {
Unk0 uint8
Unk1 uint8
Unk2 int16
Reward1ID uint16
Reward1Quantity uint8
Reward2ID uint16
Reward2Quantity uint8
}
type PaperMission struct {
Timetables []PaperMissionTimetable
Data []PaperMissionData
}
type PaperData struct {
Unk0 uint16
Unk1 int16
Unk2 int16
Unk3 int16
Unk4 int16
Unk5 int16
Unk6 int16
}
type PaperGift struct {
Unk0 uint16
Unk1 uint8
Unk2 uint8
Unk3 uint16
}

View File

@@ -0,0 +1,36 @@
package model
import "time"
type RyoudamaReward struct {
Unk0 uint8
Unk1 uint8
Unk2 uint16
Unk3 uint16
Unk4 uint16
Unk5 uint16
}
type RyoudamaKeyScore struct {
Unk0 uint8
Unk1 int32
}
type RyoudamaCharInfo struct {
CID uint32
Unk0 int32
Name string
}
type RyoudamaBoostInfo struct {
Start time.Time
End time.Time
}
type Ryoudama struct {
Reward []RyoudamaReward
KeyScore []RyoudamaKeyScore
CharInfo []RyoudamaCharInfo
BoostInfo []RyoudamaBoostInfo
Score []int32
}

View File

@@ -0,0 +1,53 @@
package model
import "time"
type SeibattleTimetable struct {
Start time.Time
End time.Time
}
type SeibattleKeyScore struct {
Unk0 uint8
Unk1 int32
}
type SeibattleCareer struct {
Unk0 uint16
Unk1 uint16
Unk2 uint16
}
type SeibattleOpponent struct {
Unk0 int32
Unk1 int8
}
type SeibattleConventionResult struct {
Unk0 uint32
Unk1 uint16
Unk2 uint16
Unk3 uint16
Unk4 uint16
}
type SeibattleCharScore struct {
Unk0 uint32
}
type SeibattleCurResult struct {
Unk0 uint32
Unk1 uint16
Unk2 uint16
Unk3 uint16
}
type Seibattle struct {
Timetable []SeibattleTimetable
KeyScore []SeibattleKeyScore
Career []SeibattleCareer
Opponent []SeibattleOpponent
ConventionResult []SeibattleConventionResult
CharScore []SeibattleCharScore
CurResult []SeibattleCurResult
}

View File

@@ -0,0 +1,45 @@
package model
import "time"
type TournamentInfo0 struct {
ID uint32
MaxPlayers uint32
CurrentPlayers uint32
Unk1 uint16
TextColor uint16
Unk2 uint32
Time1 time.Time
Time2 time.Time
Time3 time.Time
Time4 time.Time
Time5 time.Time
Time6 time.Time
Unk3 uint8
Unk4 uint8
MinHR uint32
MaxHR uint32
Unk5 string
Unk6 string
}
type TournamentInfo21 struct {
Unk0 uint32
Unk1 uint32
Unk2 uint32
Unk3 uint8
}
type TournamentInfo22 struct {
Unk0 uint32
Unk1 uint32
Unk2 uint32
Unk3 uint8
Unk4 string
}
type TournamentReward struct {
Unk0 uint16
Unk1 uint16
Unk2 uint16
}

99
internal/model/tower.go Normal file
View File

@@ -0,0 +1,99 @@
package model
import "time"
type TowerInfoTRP struct {
TR int32
TRP int32
}
type TowerInfoSkill struct {
TSP int32
Skills []int16 // 64
}
type TowerInfoHistory struct {
Unk0 []int16 // 5
Unk1 []int16 // 5
}
type TowerInfoLevel struct {
Floors int32
Unk1 int32
Unk2 int32
Unk3 int32
}
type GemInfo struct {
Gem uint16
Quantity uint16
}
type GemHistory struct {
Gem uint16
Message uint16
Timestamp time.Time
Sender string
}
type TenrouiraiProgress struct {
Page uint8
Mission1 uint16
Mission2 uint16
Mission3 uint16
}
type TenrouiraiReward struct {
Index uint8
Item []uint16 // 5
Quantity []uint8 // 5
}
type TenrouiraiKeyScore struct {
Unk0 uint8
Unk1 int32
}
type TenrouiraiData struct {
Block uint8
Mission uint8
// 1 = Floors climbed
// 2 = Collect antiques
// 3 = Open chests
// 4 = Cats saved
// 5 = TRP acquisition
// 6 = Monster slays
Goal uint16
Cost uint16
Skill1 uint8 // 80
Skill2 uint8 // 40
Skill3 uint8 // 40
Skill4 uint8 // 20
Skill5 uint8 // 40
Skill6 uint8 // 50
}
type TenrouiraiCharScore struct {
Score int32
Name string
}
type TenrouiraiTicket struct {
Unk0 uint8
RP uint32
Unk2 uint32
}
type Tenrouirai struct {
Progress []TenrouiraiProgress
Reward []TenrouiraiReward
KeyScore []TenrouiraiKeyScore
Data []TenrouiraiData
CharScore []TenrouiraiCharScore
Ticket []TenrouiraiTicket
}
type TowerInfo struct {
TRP []TowerInfoTRP
Skill []TowerInfoSkill
History []TowerInfoHistory
Level []TowerInfoLevel
}

View File

@@ -1,14 +1,16 @@
package channelserver
package service
import (
"encoding/binary"
"errors"
"erupe-ce/common/bfutil"
"erupe-ce/common/stringsupport"
_config "erupe-ce/config"
"erupe-ce/network/mhfpacket"
"erupe-ce/config"
"erupe-ce/server/channelserver/compression/nullcomp"
"erupe-ce/utils/bfutil"
"erupe-ce/utils/database"
"erupe-ce/utils/logger"
"erupe-ce/utils/stringsupport"
"fmt"
"go.uber.org/zap"
)
@@ -25,7 +27,7 @@ const (
pGardenData // +68
pWeaponType // +1
pWeaponID // +2
pHRP // +2
pHR // +2
pGRP // +4
pKQF // +8
lBookshelfData
@@ -47,7 +49,7 @@ type CharacterSaveData struct {
GardenData []byte
WeaponType uint8
WeaponID uint16
HRP uint16
HR uint16
GR uint16
KQF []byte
@@ -57,13 +59,13 @@ type CharacterSaveData struct {
func getPointers() map[SavePointer]int {
pointers := map[SavePointer]int{pGender: 81, lBookshelfData: 5576}
switch _config.ErupeConfig.RealClientMode {
case _config.ZZ:
switch config.GetConfig().ClientID {
case config.ZZ:
pointers[pWeaponID] = 128522
pointers[pWeaponType] = 128789
pointers[pHouseTier] = 129900
pointers[pToreData] = 130228
pointers[pHRP] = 130550
pointers[pHR] = 130550
pointers[pGRP] = 130556
pointers[pHouseData] = 130561
pointers[pBookshelfData] = 139928
@@ -71,49 +73,67 @@ func getPointers() map[SavePointer]int {
pointers[pGardenData] = 142424
pointers[pRP] = 142614
pointers[pKQF] = 146720
case _config.Z2, _config.Z1, _config.G101, _config.G10:
case config.Z2, config.Z1, config.G101, config.G10, config.G91, config.G9, config.G81, config.G8,
config.G7, config.G61, config.G6, config.G52, config.G51, config.G5, config.GG, config.G32, config.G31,
config.G3, config.G2, config.G1:
pointers[pWeaponID] = 92522
pointers[pWeaponType] = 92789
pointers[pHouseTier] = 93900
pointers[pToreData] = 94228
pointers[pHRP] = 94550
pointers[pHR] = 94550
pointers[pGRP] = 94556
pointers[pHouseData] = 94561
pointers[pBookshelfData] = 103928
pointers[pBookshelfData] = 89118 // TODO: fix bookshelf data pointer
pointers[pGalleryData] = 104064
pointers[pGardenData] = 106424
pointers[pRP] = 106614
pointers[pKQF] = 110720
case _config.F5, _config.F4:
case config.F5, config.F4:
pointers[pWeaponID] = 60522
pointers[pWeaponType] = 60789
pointers[pHouseTier] = 61900
pointers[pToreData] = 62228
pointers[pHRP] = 62550
pointers[pHR] = 62550
pointers[pHouseData] = 62561
pointers[pBookshelfData] = 57118 // This pointer only half works
pointers[pBookshelfData] = 57118 // TODO: fix bookshelf data pointer
pointers[pGalleryData] = 72064
pointers[pGardenData] = 74424
pointers[pRP] = 74614
case config.S6:
pointers[pWeaponID] = 12522
pointers[pWeaponType] = 12789
pointers[pHouseTier] = 13900
pointers[pToreData] = 14228
pointers[pHR] = 14550
pointers[pHouseData] = 14561
pointers[pBookshelfData] = 9118 // TODO: fix bookshelf data pointer
pointers[pGalleryData] = 24064
pointers[pGardenData] = 26424
pointers[pRP] = 26614
}
if _config.ErupeConfig.RealClientMode == _config.G5 {
if config.GetConfig().ClientID == config.G5 {
pointers[lBookshelfData] = 5548
} else if _config.ErupeConfig.RealClientMode <= _config.GG {
} else if config.GetConfig().ClientID <= config.GG {
pointers[lBookshelfData] = 4520
}
return pointers
}
func GetCharacterSaveData(s *Session, charID uint32) (*CharacterSaveData, error) {
result, err := s.server.db.Query("SELECT id, savedata, is_new_character, name FROM characters WHERE id = $1", charID)
func GetCharacterSaveData(charID uint32) (*CharacterSaveData, error) {
db, err := database.GetDB()
logger := logger.Get()
if err != nil {
s.logger.Error("Failed to get savedata", zap.Error(err), zap.Uint32("charID", charID))
logger.Fatal(fmt.Sprintf("Failed to get database instance: %s", err))
}
result, err := db.Query("SELECT id, savedata, is_new_character, name FROM characters WHERE id = $1", charID)
if err != nil {
logger.Error("Failed to get savedata", zap.Error(err), zap.Uint32("charID", charID))
return nil, err
}
defer result.Close()
if !result.Next() {
err = errors.New("no savedata found")
s.logger.Error("No savedata found", zap.Uint32("charID", charID))
logger.Error("No savedata found", zap.Uint32("charID", charID))
return nil, err
}
@@ -122,7 +142,7 @@ func GetCharacterSaveData(s *Session, charID uint32) (*CharacterSaveData, error)
}
err = result.Scan(&saveData.CharID, &saveData.compSave, &saveData.IsNewCharacter, &saveData.Name)
if err != nil {
s.logger.Error("Failed to scan savedata", zap.Error(err), zap.Uint32("charID", charID))
logger.Error("Failed to scan savedata", zap.Error(err), zap.Uint32("charID", charID))
return nil, err
}
@@ -132,28 +152,41 @@ func GetCharacterSaveData(s *Session, charID uint32) (*CharacterSaveData, error)
err = saveData.Decompress()
if err != nil {
s.logger.Error("Failed to decompress savedata", zap.Error(err))
logger.Error("Failed to decompress savedata", zap.Error(err))
return nil, err
}
saveData.updateStructWithSaveData()
saveData.UpdateStructWithSaveData()
return saveData, nil
}
func (save *CharacterSaveData) Save(s *Session) {
if !s.kqfOverride {
s.kqf = save.KQF
type SessionCharacter interface {
Setkqf(data []byte)
Getkqf() []byte
GetkqfOverride() bool
GetCharID() uint32
}
func (save *CharacterSaveData) Save(s SessionCharacter) {
db, err := database.GetDB()
logger := logger.Get()
if err != nil {
logger.Fatal(fmt.Sprintf("Failed to get database instance: %s", err))
}
if !s.GetkqfOverride() {
s.Setkqf(save.KQF)
} else {
save.KQF = s.kqf
save.KQF = s.Getkqf()
}
save.updateSaveDataWithStruct()
if _config.ErupeConfig.RealClientMode >= _config.G1 {
if config.GetConfig().ClientID >= config.G1 {
err := save.Compress()
if err != nil {
s.logger.Error("Failed to compress savedata", zap.Error(err))
logger.Error("Failed to compress savedata", zap.Error(err))
return
}
} else {
@@ -161,14 +194,14 @@ func (save *CharacterSaveData) Save(s *Session) {
save.compSave = save.decompSave
}
_, err := s.server.db.Exec(`UPDATE characters SET savedata=$1, is_new_character=false, hrp=$2, gr=$3, is_female=$4, weapon_type=$5, weapon_id=$6 WHERE id=$7
`, save.compSave, save.HRP, save.GR, save.Gender, save.WeaponType, save.WeaponID, save.CharID)
_, err = db.Exec(`UPDATE characters SET savedata=$1, is_new_character=false, hr=$2, gr=$3, is_female=$4, weapon_type=$5, weapon_id=$6 WHERE id=$7
`, save.compSave, save.HR, save.GR, save.Gender, save.WeaponType, save.WeaponID, save.CharID)
if err != nil {
s.logger.Error("Failed to update savedata", zap.Error(err), zap.Uint32("charID", save.CharID))
logger.Error("Failed to update savedata", zap.Error(err), zap.Uint32("charID", save.CharID))
}
s.server.db.Exec(`UPDATE user_binary SET house_tier=$1, house_data=$2, bookshelf=$3, gallery=$4, tore=$5, garden=$6 WHERE id=$7
`, save.HouseTier, save.HouseData, save.BookshelfData, save.GalleryData, save.ToreData, save.GardenData, s.charID)
db.Exec(`UPDATE user_binary SET house_tier=$1, house_data=$2, bookshelf=$3, gallery=$4, tore=$5, garden=$6 WHERE id=$7
`, save.HouseTier, save.HouseData, save.BookshelfData, save.GalleryData, save.ToreData, save.GardenData, s.GetCharID())
}
func (save *CharacterSaveData) Compress() error {
@@ -193,16 +226,16 @@ func (save *CharacterSaveData) Decompress() error {
func (save *CharacterSaveData) updateSaveDataWithStruct() {
rpBytes := make([]byte, 2)
binary.LittleEndian.PutUint16(rpBytes, save.RP)
if _config.ErupeConfig.RealClientMode >= _config.G10 {
if config.GetConfig().ClientID >= config.F4 {
copy(save.decompSave[save.Pointers[pRP]:save.Pointers[pRP]+2], rpBytes)
}
if config.GetConfig().ClientID >= config.G10 {
copy(save.decompSave[save.Pointers[pKQF]:save.Pointers[pKQF]+8], save.KQF)
} else if _config.ErupeConfig.RealClientMode == _config.F5 || _config.ErupeConfig.RealClientMode == _config.F4 {
copy(save.decompSave[save.Pointers[pRP]:save.Pointers[pRP]+2], rpBytes)
}
}
// This will update the save struct with the values stored in the character save
func (save *CharacterSaveData) updateStructWithSaveData() {
func (save *CharacterSaveData) UpdateStructWithSaveData() {
save.Name = stringsupport.SJISToUTF8(bfutil.UpToNull(save.decompSave[88:100]))
if save.decompSave[save.Pointers[pGender]] == 1 {
save.Gender = true
@@ -210,7 +243,7 @@ func (save *CharacterSaveData) updateStructWithSaveData() {
save.Gender = false
}
if !save.IsNewCharacter {
if (_config.ErupeConfig.RealClientMode >= _config.F4 && _config.ErupeConfig.RealClientMode <= _config.F5) || _config.ErupeConfig.RealClientMode >= _config.G10 {
if config.GetConfig().ClientID >= config.S6 {
save.RP = binary.LittleEndian.Uint16(save.decompSave[save.Pointers[pRP] : save.Pointers[pRP]+2])
save.HouseTier = save.decompSave[save.Pointers[pHouseTier] : save.Pointers[pHouseTier]+5]
save.HouseData = save.decompSave[save.Pointers[pHouseData] : save.Pointers[pHouseData]+195]
@@ -220,20 +253,58 @@ func (save *CharacterSaveData) updateStructWithSaveData() {
save.GardenData = save.decompSave[save.Pointers[pGardenData] : save.Pointers[pGardenData]+68]
save.WeaponType = save.decompSave[save.Pointers[pWeaponType]]
save.WeaponID = binary.LittleEndian.Uint16(save.decompSave[save.Pointers[pWeaponID] : save.Pointers[pWeaponID]+2])
save.HRP = binary.LittleEndian.Uint16(save.decompSave[save.Pointers[pHRP] : save.Pointers[pHRP]+2])
}
if _config.ErupeConfig.RealClientMode >= _config.G10 {
save.KQF = save.decompSave[save.Pointers[pKQF] : save.Pointers[pKQF]+8]
if save.HRP == uint16(999) {
save.GR = grpToGR(int(binary.LittleEndian.Uint32(save.decompSave[save.Pointers[pGRP] : save.Pointers[pGRP]+4])))
save.HR = binary.LittleEndian.Uint16(save.decompSave[save.Pointers[pHR] : save.Pointers[pHR]+2])
if config.GetConfig().ClientID >= config.G1 {
if save.HR == uint16(999) {
save.GR = grpToGR(int(binary.LittleEndian.Uint32(save.decompSave[save.Pointers[pGRP] : save.Pointers[pGRP]+4])))
}
}
if config.GetConfig().ClientID >= config.G10 {
save.KQF = save.decompSave[save.Pointers[pKQF] : save.Pointers[pKQF]+8]
}
}
}
return
}
func grpToGR(n int) uint16 {
var gr int
a := []int{208750, 593400, 993400, 1400900, 2315900, 3340900, 4505900, 5850900, 7415900, 9230900, 11345900, 100000000}
b := []int{7850, 8000, 8150, 9150, 10250, 11650, 13450, 15650, 18150, 21150, 23950}
c := []int{51, 100, 150, 200, 300, 400, 500, 600, 700, 800, 900}
func handleMsgMhfSexChanger(s *Session, p mhfpacket.MHFPacket) {
pkt := p.(*mhfpacket.MsgMhfSexChanger)
doAckSimpleSucceed(s, pkt.AckHandle, make([]byte, 4))
for i := 0; i < len(a); i++ {
if n < a[i] {
if i == 0 {
for {
n -= 500
if n <= 500 {
if n < 0 {
i--
}
break
} else {
i++
for j := 0; j < i; j++ {
n -= 150
}
}
}
gr = i + 2
} else {
n -= a[i-1]
gr = c[i-1]
gr += n / b[i-1]
}
break
}
}
return uint16(gr)
}
func (save *CharacterSaveData) GetDecompSave() []byte {
return save.decompSave
}
func (save *CharacterSaveData) SetDecompSave(decompSave []byte) {
save.decompSave = decompSave
}

641
internal/service/guild.go Normal file
View File

@@ -0,0 +1,641 @@
package service
import (
"database/sql"
"database/sql/driver"
"encoding/json"
"errors"
"erupe-ce/config"
"erupe-ce/internal/model"
"erupe-ce/utils/database"
"erupe-ce/utils/logger"
"fmt"
"time"
"github.com/jmoiron/sqlx"
"go.uber.org/zap"
)
type Guild struct {
ID uint32 `db:"id"`
Name string `db:"name"`
MainMotto uint8 `db:"main_motto"`
SubMotto uint8 `db:"sub_motto"`
CreatedAt time.Time `db:"created_at"`
MemberCount uint16 `db:"member_count"`
RankRP uint32 `db:"rank_rp"`
EventRP uint32 `db:"event_rp"`
RoomRP uint16 `db:"room_rp"`
RoomExpiry time.Time `db:"room_expiry"`
Comment string `db:"comment"`
PugiName1 string `db:"pugi_name_1"`
PugiName2 string `db:"pugi_name_2"`
PugiName3 string `db:"pugi_name_3"`
PugiOutfit1 uint8 `db:"pugi_outfit_1"`
PugiOutfit2 uint8 `db:"pugi_outfit_2"`
PugiOutfit3 uint8 `db:"pugi_outfit_3"`
PugiOutfits uint32 `db:"pugi_outfits"`
Recruiting bool `db:"recruiting"`
FestivalColor model.FestivalColor `db:"festival_color"`
Souls uint32 `db:"souls"`
AllianceID uint32 `db:"alliance_id"`
Icon *GuildIcon `db:"icon"`
model.GuildLeader
}
func RollbackTransaction(transaction *sql.Tx) {
err := transaction.Rollback()
logger := logger.Get()
if err != nil {
logger.Error("failed to rollback transaction", zap.Error(err))
}
}
type GuildIcon struct {
Parts []model.GuildIconPart
}
func (gi *GuildIcon) Scan(val interface{}) (err error) {
switch v := val.(type) {
case []byte:
err = json.Unmarshal(v, &gi)
case string:
err = json.Unmarshal([]byte(v), &gi)
}
return
}
func (gi *GuildIcon) Value() (valuer driver.Value, err error) {
return json.Marshal(gi)
}
func (g *Guild) Rank() uint16 {
rpMap := []uint32{
24, 48, 96, 144, 192, 240, 288, 360, 432,
504, 600, 696, 792, 888, 984, 1080, 1200,
}
if config.GetConfig().ClientID <= config.Z2 {
rpMap = []uint32{
3500, 6000, 8500, 11000, 13500, 16000, 20000, 24000, 28000,
33000, 38000, 43000, 48000, 55000, 70000, 90000, 120000,
}
}
for i, u := range rpMap {
if g.RankRP < u {
if config.GetConfig().ClientID <= config.S6 && i >= 12 {
return 12
} else if config.GetConfig().ClientID <= config.F5 && i >= 13 {
return 13
} else if config.GetConfig().ClientID <= config.G32 && i >= 14 {
return 14
}
return uint16(i)
}
}
if config.GetConfig().ClientID <= config.S6 {
return 12
} else if config.GetConfig().ClientID <= config.F5 {
return 13
} else if config.GetConfig().ClientID <= config.G32 {
return 14
}
return 17
}
func (guild *Guild) Save() error {
db, err := database.GetDB()
logger := logger.Get()
if err != nil {
logger.Fatal(fmt.Sprintf("Failed to get database instance: %s", err))
}
_, err = db.Exec(`
UPDATE guilds SET main_motto=$2, sub_motto=$3, comment=$4, pugi_name_1=$5, pugi_name_2=$6, pugi_name_3=$7,
pugi_outfit_1=$8, pugi_outfit_2=$9, pugi_outfit_3=$10, pugi_outfits=$11, icon=$12, leader_id=$13 WHERE id=$1
`, guild.ID, guild.MainMotto, guild.SubMotto, guild.Comment, guild.PugiName1, guild.PugiName2, guild.PugiName3,
guild.PugiOutfit1, guild.PugiOutfit2, guild.PugiOutfit3, guild.PugiOutfits, guild.Icon, guild.GuildLeader.LeaderCharID)
if err != nil {
logger.Error("failed to update guild data", zap.Error(err), zap.Uint32("guildID", guild.ID))
return err
}
return nil
}
func (guild *Guild) CreateApplication(charID uint32, applicationType model.GuildApplicationType, transaction *sql.Tx, actorId uint32) error {
db, err := database.GetDB()
logger := logger.Get()
if err != nil {
logger.Fatal(fmt.Sprintf("Failed to get database instance: %s", err))
}
query := `
INSERT INTO guild_applications (guild_id, character_id, actor_id, application_type)
VALUES ($1, $2, $3, $4)
`
// Actor ID is the s.CharID
if transaction == nil {
_, err = db.Exec(query, guild.ID, charID, actorId, applicationType)
} else {
_, err = transaction.Exec(query, guild.ID, charID, actorId, applicationType)
}
if err != nil {
logger.Error(
"failed to add guild application",
zap.Error(err),
zap.Uint32("guildID", guild.ID),
zap.Uint32("charID", charID),
)
return err
}
return nil
}
func (guild *Guild) Disband(charID uint32) error {
db, err := database.GetDB()
logger := logger.Get()
if err != nil {
logger.Fatal(fmt.Sprintf("Failed to get database instance: %s", err))
}
transaction, err := db.Begin()
if err != nil {
logger.Error("failed to begin transaction", zap.Error(err))
return err
}
_, err = transaction.Exec("DELETE FROM guild_characters WHERE guild_id = $1", guild.ID)
if err != nil {
logger.Error("failed to remove guild characters", zap.Error(err), zap.Uint32("guildId", guild.ID))
RollbackTransaction(transaction)
return err
}
_, err = transaction.Exec("DELETE FROM guilds WHERE id = $1", guild.ID)
if err != nil {
logger.Error("failed to remove guild", zap.Error(err), zap.Uint32("guildID", guild.ID))
RollbackTransaction(transaction)
return err
}
_, err = transaction.Exec("DELETE FROM guild_alliances WHERE parent_id=$1", guild.ID)
if err != nil {
logger.Error("failed to remove guild alliance", zap.Error(err), zap.Uint32("guildID", guild.ID))
RollbackTransaction(transaction)
return err
}
_, err = transaction.Exec("UPDATE guild_alliances SET sub1_id=sub2_id, sub2_id=NULL WHERE sub1_id=$1", guild.ID)
if err != nil {
logger.Error("failed to remove guild from alliance", zap.Error(err), zap.Uint32("guildID", guild.ID))
RollbackTransaction(transaction)
return err
}
_, err = transaction.Exec("UPDATE guild_alliances SET sub2_id=NULL WHERE sub2_id=$1", guild.ID)
if err != nil {
logger.Error("failed to remove guild from alliance", zap.Error(err), zap.Uint32("guildID", guild.ID))
RollbackTransaction(transaction)
return err
}
err = transaction.Commit()
if err != nil {
logger.Error("failed to commit transaction", zap.Error(err))
return err
}
logger.Info("Character disbanded guild", zap.Uint32("charID", charID), zap.Uint32("guildID", guild.ID))
return nil
}
func (guild *Guild) RemoveCharacter(charID uint32) error {
db, err := database.GetDB()
logger := logger.Get()
if err != nil {
logger.Fatal(fmt.Sprintf("Failed to get database instance: %s", err))
}
_, err = db.Exec("DELETE FROM guild_characters WHERE character_id=$1", charID)
if err != nil {
logger.Error(
"failed to remove character from guild",
zap.Error(err),
zap.Uint32("charID", charID),
zap.Uint32("guildID", guild.ID),
)
return err
}
return nil
}
func (guild *Guild) AcceptApplication(charID uint32) error {
db, err := database.GetDB()
logger := logger.Get()
if err != nil {
logger.Fatal(fmt.Sprintf("Failed to get database instance: %s", err))
}
transaction, err := db.Begin()
if err != nil {
logger.Error("failed to start db transaction", zap.Error(err))
return err
}
_, err = transaction.Exec(`DELETE FROM guild_applications WHERE character_id = $1`, charID)
if err != nil {
logger.Error("failed to accept character's guild application", zap.Error(err))
RollbackTransaction(transaction)
return err
}
_, err = transaction.Exec(`
INSERT INTO guild_characters (guild_id, character_id, order_index)
VALUES ($1, $2, (SELECT MAX(order_index) + 1 FROM guild_characters WHERE guild_id = $1))
`, guild.ID, charID)
if err != nil {
logger.Error(
"failed to add applicant to guild",
zap.Error(err),
zap.Uint32("guildID", guild.ID),
zap.Uint32("charID", charID),
)
RollbackTransaction(transaction)
return err
}
err = transaction.Commit()
if err != nil {
logger.Error("failed to commit db transaction", zap.Error(err))
RollbackTransaction(transaction)
return err
}
return nil
}
// This is relying on the fact that invitation ID is also character ID right now
// if invitation ID changes, this will break.
func (guild *Guild) CancelInvitation(charID uint32) error {
db, err := database.GetDB()
logger := logger.Get()
if err != nil {
logger.Fatal(fmt.Sprintf("Failed to get database instance: %s", err))
}
_, err = db.Exec(
`DELETE FROM guild_applications WHERE character_id = $1 AND guild_id = $2 AND application_type = 'invited'`,
charID, guild.ID,
)
if err != nil {
logger.Error(
"failed to cancel guild invitation",
zap.Error(err),
zap.Uint32("guildID", guild.ID),
zap.Uint32("charID", charID),
)
return err
}
return nil
}
func (guild *Guild) RejectApplication(charID uint32) error {
db, err := database.GetDB()
logger := logger.Get()
if err != nil {
logger.Fatal(fmt.Sprintf("Failed to get database instance: %s", err))
}
_, err = db.Exec(
`DELETE FROM guild_applications WHERE character_id = $1 AND guild_id = $2 AND application_type = 'applied'`,
charID, guild.ID,
)
if err != nil {
logger.Error(
"failed to reject guild application",
zap.Error(err),
zap.Uint32("guildID", guild.ID),
zap.Uint32("charID", charID),
)
return err
}
return nil
}
func (guild *Guild) ArrangeCharacters(charIDs []uint32) error {
db, err := database.GetDB()
logger := logger.Get()
if err != nil {
logger.Fatal(fmt.Sprintf("Failed to get database instance: %s", err))
}
transaction, err := db.Begin()
if err != nil {
logger.Error("failed to start db transaction", zap.Error(err))
return err
}
for i, id := range charIDs {
_, err := transaction.Exec("UPDATE guild_characters SET order_index = $1 WHERE character_id = $2", 2+i, id)
if err != nil {
err = transaction.Rollback()
if err != nil {
logger.Error("failed to rollback db transaction", zap.Error(err))
}
return err
}
}
err = transaction.Commit()
if err != nil {
logger.Error("failed to commit db transaction", zap.Error(err))
return err
}
return nil
}
func (guild *Guild) GetApplicationForCharID(charID uint32, applicationType model.GuildApplicationType) (*model.GuildApplication, error) {
db, err := database.GetDB()
logger := logger.Get()
if err != nil {
logger.Fatal(fmt.Sprintf("Failed to get database instance: %s", err))
}
row := db.QueryRowx(`
SELECT * from guild_applications WHERE character_id = $1 AND guild_id = $2 AND application_type = $3
`, charID, guild.ID, applicationType)
application := &model.GuildApplication{}
err = row.StructScan(application)
if errors.Is(err, sql.ErrNoRows) {
return nil, nil
}
if err != nil {
logger.Error(
"failed to retrieve guild application for character",
zap.Error(err),
zap.Uint32("charID", charID),
zap.Uint32("guildID", guild.ID),
)
return nil, err
}
return application, nil
}
func (guild *Guild) HasApplicationForCharID(charID uint32) (bool, error) {
db, err := database.GetDB()
logger := logger.Get()
if err != nil {
logger.Fatal(fmt.Sprintf("Failed to get database instance: %s", err))
}
row := db.QueryRowx(`
SELECT 1 from guild_applications WHERE character_id = $1 AND guild_id = $2
`, charID, guild.ID)
num := 0
err = row.Scan(&num)
if errors.Is(err, sql.ErrNoRows) {
return false, nil
}
if err != nil {
logger.Error(
"failed to retrieve guild applications for character",
zap.Error(err),
zap.Uint32("charID", charID),
zap.Uint32("guildID", guild.ID),
)
return false, err
}
return true, nil
}
const GuildInfoSelectQuery = `
SELECT
g.id,
g.name,
rank_rp,
event_rp,
room_rp,
COALESCE(room_expiry, '1970-01-01') AS room_expiry,
main_motto,
sub_motto,
created_at,
leader_id,
c.name AS leader_name,
comment,
COALESCE(pugi_name_1, '') AS pugi_name_1,
COALESCE(pugi_name_2, '') AS pugi_name_2,
COALESCE(pugi_name_3, '') AS pugi_name_3,
pugi_outfit_1,
pugi_outfit_2,
pugi_outfit_3,
pugi_outfits,
recruiting,
COALESCE((SELECT team FROM festa_registrations fr WHERE fr.guild_id = g.id), 'none') AS festival_color,
COALESCE((SELECT SUM(fs.souls) FROM festa_submissions fs WHERE fs.guild_id=g.id), 0) AS souls,
COALESCE((
SELECT id FROM guild_alliances ga WHERE
ga.parent_id = g.id OR
ga.sub1_id = g.id OR
ga.sub2_id = g.id
), 0) AS alliance_id,
icon,
(SELECT count(1) FROM guild_characters gc WHERE gc.guild_id = g.id) AS member_count
FROM guilds g
JOIN guild_characters gc ON gc.character_id = leader_id
JOIN characters c on leader_id = c.id
`
func CreateGuild(guildName string, charID uint32) (int32, error) {
db, err := database.GetDB()
logger := logger.Get()
if err != nil {
logger.Fatal(fmt.Sprintf("Failed to get database instance: %s", err))
}
transaction, err := db.Begin()
if err != nil {
logger.Error("failed to start db transaction", zap.Error(err))
return 0, err
}
if err != nil {
panic(err)
}
guildResult, err := transaction.Query(
"INSERT INTO guilds (name, leader_id) VALUES ($1, $2) RETURNING id",
guildName, charID,
)
if err != nil {
logger.Error("failed to create guild", zap.Error(err))
RollbackTransaction(transaction)
return 0, err
}
var guildId int32
guildResult.Next()
err = guildResult.Scan(&guildId)
if err != nil {
logger.Error("failed to retrieve guild ID", zap.Error(err))
RollbackTransaction(transaction)
return 0, err
}
err = guildResult.Close()
if err != nil {
logger.Error("failed to finalise query", zap.Error(err))
RollbackTransaction(transaction)
return 0, err
}
_, err = transaction.Exec(`
INSERT INTO guild_characters (guild_id, character_id)
VALUES ($1, $2)
`, guildId, charID)
if err != nil {
logger.Error("failed to add character to guild", zap.Error(err))
RollbackTransaction(transaction)
return 0, err
}
err = transaction.Commit()
if err != nil {
logger.Error("failed to commit guild creation", zap.Error(err))
return 0, err
}
return guildId, nil
}
func GetGuildInfoByID(guildID uint32) (*Guild, error) {
db, err := database.GetDB()
logger := logger.Get()
if err != nil {
logger.Fatal(fmt.Sprintf("Failed to get database instance: %s", err))
}
rows, err := db.Queryx(fmt.Sprintf(`
%s
WHERE g.id = $1
LIMIT 1
`, GuildInfoSelectQuery), guildID)
if err != nil {
logger.Error("failed to retrieve guild", zap.Error(err), zap.Uint32("guildID", guildID))
return nil, err
}
defer rows.Close()
hasRow := rows.Next()
if !hasRow {
return nil, nil
}
return BuildGuildObjectFromDbResult(rows, err)
}
func GetGuildInfoByCharacterId(charID uint32) (*Guild, error) {
db, err := database.GetDB()
logger := logger.Get()
if err != nil {
logger.Fatal(fmt.Sprintf("Failed to get database instance: %s", err))
}
rows, err := db.Queryx(fmt.Sprintf(`
%s
WHERE EXISTS(
SELECT 1
FROM guild_characters gc1
WHERE gc1.character_id = $1
AND gc1.guild_id = g.id
)
OR EXISTS(
SELECT 1
FROM guild_applications ga
WHERE ga.character_id = $1
AND ga.guild_id = g.id
AND ga.application_type = 'applied'
)
LIMIT 1
`, GuildInfoSelectQuery), charID)
if err != nil {
logger.Error("failed to retrieve guild for character", zap.Error(err), zap.Uint32("charID", charID))
return nil, err
}
defer rows.Close()
hasRow := rows.Next()
if !hasRow {
return nil, nil
}
return BuildGuildObjectFromDbResult(rows, err)
}
func BuildGuildObjectFromDbResult(result *sqlx.Rows, err error) (*Guild, error) {
guild := &Guild{}
logger := logger.Get()
err = result.StructScan(guild)
if err != nil {
logger.Error("failed to retrieve guild data from database", zap.Error(err))
return nil, err
}
return guild, nil
}

View File

@@ -0,0 +1,112 @@
package service
import (
"erupe-ce/utils/database"
"erupe-ce/utils/logger"
"fmt"
"time"
"github.com/jmoiron/sqlx"
"go.uber.org/zap"
)
type GuildAlliance struct {
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"`
ParentGuild Guild
SubGuild1 Guild
SubGuild2 Guild
}
const AllianceInfoSelectQuery = `
SELECT
ga.id,
ga.name,
created_at,
parent_id,
CASE
WHEN sub1_id IS NULL THEN 0
ELSE sub1_id
END,
CASE
WHEN sub2_id IS NULL THEN 0
ELSE sub2_id
END
FROM guild_alliances ga
`
func GetAllianceData(AllianceID uint32) (*GuildAlliance, error) {
db, err := database.GetDB()
logger := logger.Get()
if err != nil {
logger.Fatal(fmt.Sprintf("Failed to get database instance: %s", err))
}
rows, err := db.Queryx(fmt.Sprintf(`
%s
WHERE ga.id = $1
`, AllianceInfoSelectQuery), AllianceID)
if err != nil {
logger.Error("Failed to retrieve alliance data from database", zap.Error(err))
return nil, err
}
defer rows.Close()
hasRow := rows.Next()
if !hasRow {
return nil, nil
}
return BuildAllianceObjectFromDbResult(rows, err)
}
func BuildAllianceObjectFromDbResult(result *sqlx.Rows, err error) (*GuildAlliance, error) {
alliance := &GuildAlliance{}
logger := logger.Get()
err = result.StructScan(alliance)
if err != nil {
logger.Error("failed to retrieve alliance from database", zap.Error(err))
return nil, err
}
parentGuild, err := GetGuildInfoByID(alliance.ParentGuildID)
if err != nil {
logger.Error("Failed to get parent guild info", zap.Error(err))
return nil, err
} else {
alliance.ParentGuild = *parentGuild
alliance.TotalMembers += parentGuild.MemberCount
}
if alliance.SubGuild1ID > 0 {
subGuild1, err := GetGuildInfoByID(alliance.SubGuild1ID)
if err != nil {
logger.Error("Failed to get sub guild 1 info", zap.Error(err))
return nil, err
} else {
alliance.SubGuild1 = *subGuild1
alliance.TotalMembers += subGuild1.MemberCount
}
}
if alliance.SubGuild2ID > 0 {
subGuild2, err := GetGuildInfoByID(alliance.SubGuild2ID)
if err != nil {
logger.Error("Failed to get sub guild 2 info", zap.Error(err))
return nil, err
} else {
alliance.SubGuild2 = *subGuild2
alliance.TotalMembers += subGuild2.MemberCount
}
}
return alliance, nil
}

View File

@@ -0,0 +1,169 @@
package service
import (
"erupe-ce/utils/database"
"erupe-ce/utils/logger"
"fmt"
"time"
"github.com/jmoiron/sqlx"
"go.uber.org/zap"
)
type GuildMember struct {
GuildID uint32 `db:"guild_id"`
CharID uint32 `db:"character_id"`
JoinedAt *time.Time `db:"joined_at"`
Souls uint32 `db:"souls"`
RPToday uint16 `db:"rp_today"`
RPYesterday uint16 `db:"rp_yesterday"`
Name string `db:"name"`
IsApplicant bool `db:"is_applicant"`
OrderIndex uint16 `db:"order_index"`
LastLogin uint32 `db:"last_login"`
Recruiter bool `db:"recruiter"`
AvoidLeadership bool `db:"avoid_leadership"`
IsLeader bool `db:"is_leader"`
HR uint16 `db:"hr"`
GR uint16 `db:"gr"`
WeaponID uint16 `db:"weapon_id"`
WeaponType uint8 `db:"weapon_type"`
}
func (gm *GuildMember) CanRecruit() bool {
if gm.Recruiter {
return true
}
if gm.OrderIndex <= 3 {
return true
}
if gm.IsLeader {
return true
}
return false
}
func (gm *GuildMember) IsSubLeader() bool {
return gm.OrderIndex <= 3
}
func (gm *GuildMember) Save() error {
db, err := database.GetDB()
logger := logger.Get()
if err != nil {
logger.Fatal(fmt.Sprintf("Failed to get database instance: %s", err))
}
_, err = db.Exec("UPDATE guild_characters SET avoid_leadership=$1, order_index=$2 WHERE character_id=$3", gm.AvoidLeadership, gm.OrderIndex, gm.CharID)
if err != nil {
logger.Error(
"failed to update guild member data",
zap.Error(err),
zap.Uint32("charID", gm.CharID),
zap.Uint32("guildID", gm.GuildID),
)
return err
}
return nil
}
const guildMembersSelectSQL = `
SELECT * FROM (
SELECT
g.id AS guild_id,
joined_at,
COALESCE((SELECT SUM(souls) FROM festa_submissions fs WHERE fs.character_id=c.id), 0) AS souls,
COALESCE(rp_today, 0) AS rp_today,
COALESCE(rp_yesterday, 0) AS rp_yesterday,
c.name,
c.id AS character_id,
COALESCE(order_index, 0) AS order_index,
c.last_login,
COALESCE(recruiter, false) AS recruiter,
COALESCE(avoid_leadership, false) AS avoid_leadership,
c.hr,
c.gr,
c.weapon_id,
c.weapon_type,
EXISTS(SELECT 1 FROM guild_applications ga WHERE ga.character_id=c.id AND application_type='applied') AS is_applicant,
CASE WHEN g.leader_id = c.id THEN true ELSE false END AS is_leader
FROM guild_characters gc
LEFT JOIN characters c ON c.id = gc.character_id
LEFT JOIN guilds g ON g.id = gc.guild_id
) AS subquery
`
func GetGuildMembers(guildID uint32, applicants bool) ([]*GuildMember, error) {
db, err := database.GetDB()
logger := logger.Get()
if err != nil {
logger.Fatal(fmt.Sprintf("Failed to get database instance: %s", err))
}
rows, err := db.Queryx(fmt.Sprintf(`
%s
WHERE guild_id = $1 AND is_applicant = $2
`, guildMembersSelectSQL), guildID, applicants)
if err != nil {
logger.Error("failed to retrieve membership data for guild", zap.Error(err), zap.Uint32("guildID", guildID))
return nil, err
}
defer rows.Close()
members := make([]*GuildMember, 0)
for rows.Next() {
member, err := buildGuildMemberObjectFromDBResult(rows, err)
if err != nil {
return nil, err
}
members = append(members, member)
}
return members, nil
}
func GetCharacterGuildData(charID uint32) (*GuildMember, error) {
db, err := database.GetDB()
logger := logger.Get()
if err != nil {
logger.Fatal(fmt.Sprintf("Failed to get database instance: %s", err))
}
rows, err := db.Queryx(fmt.Sprintf("%s WHERE character_id=$1", guildMembersSelectSQL), charID)
if err != nil {
logger.Error(fmt.Sprintf("failed to retrieve membership data for character '%d'", charID))
return nil, err
}
defer rows.Close()
hasRow := rows.Next()
if !hasRow {
return nil, nil
}
return buildGuildMemberObjectFromDBResult(rows, err)
}
func buildGuildMemberObjectFromDBResult(rows *sqlx.Rows, err error) (*GuildMember, error) {
logger := logger.Get()
memberData := &GuildMember{}
err = rows.StructScan(&memberData)
if err != nil {
logger.Error("failed to retrieve guild data from database", zap.Error(err))
return nil, err
}
return memberData, nil
}

236
internal/service/mail.go Normal file
View File

@@ -0,0 +1,236 @@
package service
import (
"database/sql"
"erupe-ce/internal/constant"
"erupe-ce/network/binpacket"
"erupe-ce/network/mhfpacket"
"erupe-ce/utils/byteframe"
"erupe-ce/utils/database"
"erupe-ce/utils/logger"
"fmt"
"time"
"go.uber.org/zap"
)
type Mail struct {
ID int `db:"id"`
SenderID uint32 `db:"sender_id"`
RecipientID uint32 `db:"recipient_id"`
Subject string `db:"subject"`
Body string `db:"body"`
Read bool `db:"read"`
Deleted bool `db:"deleted"`
Locked bool `db:"locked"`
AttachedItemReceived bool `db:"attached_item_received"`
AttachedItemID uint16 `db:"attached_item"`
AttachedItemAmount uint16 `db:"attached_item_amount"`
CreatedAt time.Time `db:"created_at"`
IsGuildInvite bool `db:"is_guild_invite"`
IsSystemMessage bool `db:"is_sys_message"`
SenderName string `db:"sender_name"`
}
func (m *Mail) Send(transaction *sql.Tx) error {
db, err := database.GetDB()
logger := logger.Get()
if err != nil {
logger.Fatal(fmt.Sprintf("Failed to get database instance: %s", err))
}
query := `
INSERT INTO mail (sender_id, recipient_id, subject, body, attached_item, attached_item_amount, is_guild_invite, is_sys_message)
VALUES ($1, $2, $3, $4, $5, $6, $7, $8)
`
if transaction == nil {
_, err = db.Exec(query, m.SenderID, m.RecipientID, m.Subject, m.Body, m.AttachedItemID, m.AttachedItemAmount, m.IsGuildInvite, m.IsSystemMessage)
} else {
_, err = transaction.Exec(query, m.SenderID, m.RecipientID, m.Subject, m.Body, m.AttachedItemID, m.AttachedItemAmount, m.IsGuildInvite, m.IsSystemMessage)
}
if err != nil {
logger.Error(
"failed to send mail",
zap.Error(err),
zap.Uint32("senderID", m.SenderID),
zap.Uint32("recipientID", m.RecipientID),
zap.String("subject", m.Subject),
zap.String("body", m.Body),
zap.Uint16("itemID", m.AttachedItemID),
zap.Uint16("itemAmount", m.AttachedItemAmount),
zap.Bool("isGuildInvite", m.IsGuildInvite),
zap.Bool("isSystemMessage", m.IsSystemMessage),
)
return err
}
return nil
}
func (m *Mail) MarkRead() error {
db, err := database.GetDB()
logger := logger.Get()
if err != nil {
logger.Fatal(fmt.Sprintf("Failed to get database instance: %s", err))
}
_, err = db.Exec(`
UPDATE mail SET read = true WHERE id = $1
`, m.ID)
if err != nil {
logger.Error(
"failed to mark mail as read",
zap.Error(err),
zap.Int("mailID", m.ID),
)
return err
}
return nil
}
func GetMailListForCharacter(charID uint32) ([]Mail, error) {
db, err := database.GetDB()
logger := logger.Get()
if err != nil {
logger.Fatal(fmt.Sprintf("Failed to get database instance: %s", err))
}
rows, err := db.Queryx(`
SELECT
m.id,
m.sender_id,
m.recipient_id,
m.subject,
m.read,
m.attached_item_received,
m.attached_item,
m.attached_item_amount,
m.created_at,
m.is_guild_invite,
m.is_sys_message,
m.deleted,
m.locked,
c.name as sender_name
FROM mail m
JOIN characters c ON c.id = m.sender_id
WHERE recipient_id = $1 AND m.deleted = false
ORDER BY m.created_at DESC, id DESC
LIMIT 32
`, charID)
if err != nil {
logger.Error("failed to get mail for character", zap.Error(err), zap.Uint32("charID", charID))
return nil, err
}
defer rows.Close()
allMail := make([]Mail, 0)
for rows.Next() {
mail := Mail{}
err := rows.StructScan(&mail)
if err != nil {
return nil, err
}
allMail = append(allMail, mail)
}
return allMail, nil
}
func GetMailByID(ID int) (*Mail, error) {
db, err := database.GetDB()
logger := logger.Get()
if err != nil {
logger.Fatal(fmt.Sprintf("Failed to get database instance: %s", err))
}
row := db.QueryRowx(`
SELECT
m.id,
m.sender_id,
m.recipient_id,
m.subject,
m.read,
m.body,
m.attached_item_received,
m.attached_item,
m.attached_item_amount,
m.created_at,
m.is_guild_invite,
m.is_sys_message,
m.deleted,
m.locked,
c.name as sender_name
FROM mail m
JOIN characters c ON c.id = m.sender_id
WHERE m.id = $1
LIMIT 1
`, ID)
mail := &Mail{}
err = row.StructScan(mail)
if err != nil {
logger.Error(
"failed to retrieve mail",
zap.Error(err),
zap.Int("mailID", ID),
)
return nil, err
}
return mail, nil
}
type SessionMail interface {
QueueSendMHFLazy(packet mhfpacket.MHFPacket)
}
func SendMailNotification(m *Mail, recipient SessionMail) {
bf := byteframe.NewByteFrame()
notification := &binpacket.MsgBinMailNotify{
SenderName: getCharacterName(m.SenderID),
}
notification.Build(bf)
castedBinary := &mhfpacket.MsgSysCastedBinary{
CharID: m.SenderID,
BroadcastType: 0x00,
MessageType: constant.BinaryMessageTypeMailNotify,
RawDataPayload: bf.Data(),
}
castedBinary.Build(bf)
recipient.QueueSendMHFLazy(castedBinary)
}
func getCharacterName(charID uint32) string {
db, err := database.GetDB()
logger := logger.Get()
if err != nil {
logger.Fatal(fmt.Sprintf("Failed to get database instance: %s", err))
}
row := db.QueryRow("SELECT name FROM characters WHERE id = $1", charID)
charName := ""
err = row.Scan(&charName)
if err != nil {
return ""
}
return charName
}

94
internal/system/stage.go Normal file
View File

@@ -0,0 +1,94 @@
package system
import (
"sync"
"erupe-ce/network/mhfpacket"
)
type SessionStage interface {
QueueSendMHFLazy(packet mhfpacket.MHFPacket)
GetCharID() uint32
GetName() string
}
// Object holds infomation about a specific object.
type Object struct {
sync.RWMutex
Id uint32
OwnerCharID uint32
X, Y, Z float32
}
// stageBinaryKey is a struct used as a map key for identifying a stage binary part.
type StageBinaryKey struct {
Id0 uint8
Id1 uint8
}
// Stage holds stage-specific information
type Stage struct {
sync.RWMutex
// Stage ID string
Id string
// Objects
Objects map[uint32]*Object
objectIndex uint8
// Map of session -> charID.
// These are clients that are CURRENTLY in the stage
Clients map[SessionStage]uint32
// Map of charID -> bool, key represents whether they are ready
// These are clients that aren't in the stage, but have reserved a slot (for quests, etc).
ReservedClientSlots map[uint32]bool
// These are raw binary blobs that the stage owner sets,
// other clients expect the server to echo them back in the exact same format.
RawBinaryData map[StageBinaryKey][]byte
Host SessionStage
MaxPlayers uint16
Password string
Locked bool
}
// NewStage creates a new stage with intialized values.
func NewStage(ID string) *Stage {
s := &Stage{
Id: ID,
Clients: make(map[SessionStage]uint32),
ReservedClientSlots: make(map[uint32]bool),
Objects: make(map[uint32]*Object),
objectIndex: 0,
RawBinaryData: make(map[StageBinaryKey][]byte),
MaxPlayers: 127,
}
return s
}
// BroadcastMHF queues a MHFPacket to be sent to all sessions in the stage.
func (s *Stage) BroadcastMHF(pkt mhfpacket.MHFPacket, ignoredSession SessionStage) {
s.Lock()
defer s.Unlock()
for session := range s.Clients {
if session == ignoredSession {
continue
}
session.QueueSendMHFLazy(pkt)
}
}
func (s *Stage) isCharInQuestByID(charID uint32) bool {
if _, exists := s.ReservedClientSlots[charID]; exists {
return exists
}
return false
}
func (s *Stage) IsQuest() bool {
return len(s.ReservedClientSlots) > 0
}

254
main.go
View File

@@ -1,7 +1,7 @@
package main
import (
_config "erupe-ce/config"
"erupe-ce/config"
"fmt"
"net"
"os"
@@ -10,25 +10,21 @@ import (
"syscall"
"time"
"erupe-ce/server/api"
"erupe-ce/server/channelserver"
"erupe-ce/server/discordbot"
"erupe-ce/server/entranceserver"
"erupe-ce/server/signserver"
"erupe-ce/server/signv2server"
"erupe-ce/server/entrance"
"erupe-ce/server/sign"
"erupe-ce/utils/database"
"erupe-ce/utils/logger"
"erupe-ce/utils/gametime"
"github.com/jmoiron/sqlx"
_ "github.com/lib/pq"
"go.uber.org/zap"
)
// Temporary DB auto clean on startup for quick development & testing.
func cleanDB(db *sqlx.DB) {
_ = db.MustExec("DELETE FROM guild_characters")
_ = db.MustExec("DELETE FROM guilds")
_ = db.MustExec("DELETE FROM characters")
_ = db.MustExec("DELETE FROM sign_sessions")
_ = db.MustExec("DELETE FROM users")
}
var mainLogger logger.Logger
var Commit = func() string {
if info, ok := debug.ReadBuildInfo(); ok {
@@ -41,162 +37,79 @@ var Commit = func() string {
return "unknown"
}
func initLogger() {
var zapLogger *zap.Logger
zapLogger, _ = zap.NewDevelopment(zap.WithCaller(false))
defer zapLogger.Sync()
// Initialize the global logger
logger.Init(zapLogger)
mainLogger = logger.Get().Named("main")
}
func main() {
var err error
var zapLogger *zap.Logger
config := _config.ErupeConfig
if config.DevMode {
zapLogger, _ = zap.NewDevelopment()
} else {
zapLogger, _ = zap.NewProduction()
}
config := config.GetConfig()
initLogger()
mainLogger.Info(fmt.Sprintf("Starting Erupe (9.3b-%s)", Commit()))
mainLogger.Info(fmt.Sprintf("Client Mode: %s (%d)", config.ClientMode, config.ClientID))
defer zapLogger.Sync()
logger := zapLogger.Named("main")
checkAndExitIf(config.Database.Password == "", "Database password is blank")
logger.Info(fmt.Sprintf("Starting Erupe (9.3b-%s)", Commit()))
logger.Info(fmt.Sprintf("Client Mode: %s (%d)", config.ClientMode, config.RealClientMode))
resolveHostIP()
if config.Database.Password == "" {
preventClose("Database password is blank")
}
discordBot := initializeDiscordBot()
if net.ParseIP(config.Host) == nil {
ips, _ := net.LookupIP(config.Host)
for _, ip := range ips {
if ip != nil {
config.Host = ip.String()
break
}
}
if net.ParseIP(config.Host) == nil {
preventClose("Invalid host address")
}
}
// Discord bot
var discordBot *discordbot.DiscordBot = nil
if config.Discord.Enabled {
bot, err := discordbot.NewDiscordBot(discordbot.Options{
Logger: logger,
Config: _config.ErupeConfig,
})
if err != nil {
preventClose(fmt.Sprintf("Discord: Failed to start, %s", err.Error()))
}
// Discord bot
err = bot.Start()
if err != nil {
preventClose(fmt.Sprintf("Discord: Failed to start, %s", err.Error()))
}
discordBot = bot
logger.Info("Discord: Started successfully")
} else {
logger.Info("Discord: Disabled")
}
// Create the postgres DB pool.
connectString := fmt.Sprintf(
"host='%s' port='%d' user='%s' password='%s' dbname='%s' sslmode=disable",
config.Database.Host,
config.Database.Port,
config.Database.User,
config.Database.Password,
config.Database.Database,
)
db, err := sqlx.Open("postgres", connectString)
database, err := database.InitDB(config)
if err != nil {
preventClose(fmt.Sprintf("Database: Failed to open, %s", err.Error()))
mainLogger.Fatal(fmt.Sprintf("Database initialization failed: %s", err))
}
// Test the DB connection.
err = db.Ping()
if err != nil {
preventClose(fmt.Sprintf("Database: Failed to ping, %s", err.Error()))
}
logger.Info("Database: Started successfully")
// Clear stale data
_ = db.MustExec("DELETE FROM sign_sessions")
_ = db.MustExec("DELETE FROM servers")
_ = db.MustExec(`UPDATE guild_characters SET treasure_hunt=NULL`)
// Clean the DB if the option is on.
if config.DevMode && config.DevModeOptions.CleanDB {
logger.Info("Database: Started clearing...")
cleanDB(db)
logger.Info("Database: Finished clearing")
}
logger.Info(fmt.Sprintf("Server Time: %s", channelserver.TimeAdjusted().String()))
mainLogger.Info(fmt.Sprintf("Server Time: %s", gametime.TimeAdjusted().String()))
// Now start our server(s).
// Entrance server.
var entranceServer *entranceserver.Server
var entranceServer *entrance.EntranceServer
if config.Entrance.Enabled {
entranceServer = entranceserver.NewServer(
&entranceserver.Config{
Logger: logger.Named("entrance"),
ErupeConfig: _config.ErupeConfig,
DB: db,
})
entranceServer = entrance.NewServer()
err = entranceServer.Start()
if err != nil {
preventClose(fmt.Sprintf("Entrance: Failed to start, %s", err.Error()))
}
logger.Info("Entrance: Started successfully")
mainLogger.Info("Entrance: Started successfully")
} else {
logger.Info("Entrance: Disabled")
mainLogger.Info("Entrance: Disabled")
}
// Sign server.
var signServer *signserver.Server
var signServer *sign.SignServer
if config.Sign.Enabled {
signServer = signserver.NewServer(
&signserver.Config{
Logger: logger.Named("sign"),
ErupeConfig: _config.ErupeConfig,
DB: db,
})
signServer = sign.NewServer()
err = signServer.Start()
if err != nil {
preventClose(fmt.Sprintf("Sign: Failed to start, %s", err.Error()))
}
logger.Info("Sign: Started successfully")
mainLogger.Info("Sign: Started successfully")
} else {
logger.Info("Sign: Disabled")
mainLogger.Info("Sign: Disabled")
}
// New Sign server
var newSignServer *signv2server.Server
if config.SignV2.Enabled {
newSignServer = signv2server.NewServer(
&signv2server.Config{
Logger: logger.Named("sign"),
ErupeConfig: _config.ErupeConfig,
DB: db,
})
err = newSignServer.Start()
// Api server
var apiServer *api.APIServer
if config.API.Enabled {
apiServer = api.NewAPIServer()
err = apiServer.Start()
if err != nil {
preventClose(fmt.Sprintf("SignV2: Failed to start, %s", err.Error()))
preventClose(fmt.Sprintf("API: Failed to start, %s", err.Error()))
}
logger.Info("SignV2: Started successfully")
mainLogger.Info("API: Started successfully")
} else {
logger.Info("SignV2: Disabled")
mainLogger.Info("API: Disabled")
}
var channels []*channelserver.Server
var channelServers []*channelserver.ChannelServer
if config.Channel.Enabled {
channelQuery := ""
si := 0
@@ -206,11 +119,8 @@ func main() {
for i, ce := range ee.Channels {
sid := (4096 + si*256) + (16 + ci)
c := *channelserver.NewServer(&channelserver.Config{
ID: uint16(sid),
Logger: logger.Named("channel-" + fmt.Sprint(count)),
ErupeConfig: _config.ErupeConfig,
DB: db,
DiscordBot: discordBot,
ID: uint16(sid),
DiscordBot: discordBot,
})
if ee.IP == "" {
c.IP = config.Host
@@ -224,8 +134,8 @@ func main() {
preventClose(fmt.Sprintf("Channel: Failed to start, %s", err.Error()))
} else {
channelQuery += fmt.Sprintf(`INSERT INTO servers (server_id, current_players, world_name, world_description, land) VALUES (%d, 0, '%s', '%s', %d);`, sid, ee.Name, ee.Description, i+1)
channels = append(channels, &c)
logger.Info(fmt.Sprintf("Channel %d (%d): Started successfully", count, ce.Port))
channelServers = append(channelServers, &c)
mainLogger.Info(fmt.Sprintf("Channel %d (%d): Started successfully", count, ce.Port))
ci++
count++
}
@@ -235,14 +145,14 @@ func main() {
}
// Register all servers in DB
_ = db.MustExec(channelQuery)
_ = database.MustExec(channelQuery)
for _, c := range channels {
c.Channels = channels
for _, c := range channelServers {
c.Channels = channelServers
}
}
logger.Info("Finished starting Erupe")
mainLogger.Info("Finished starting Erupe")
// Wait for exit or interrupt with ctrl+C.
c := make(chan os.Signal, 1)
@@ -252,17 +162,17 @@ func main() {
if !config.DisableSoftCrash {
for i := 0; i < 10; i++ {
message := fmt.Sprintf("Shutting down in %d...", 10-i)
for _, c := range channels {
c.BroadcastChatMessage(message)
for _, channelServer := range channelServers {
channelServer.BroadcastChatMessage(message)
}
logger.Info(message)
mainLogger.Warn(message)
time.Sleep(time.Second)
}
}
if config.Channel.Enabled {
for _, c := range channels {
c.Shutdown()
for _, channelServer := range channelServers {
channelServer.Shutdown()
}
}
@@ -270,8 +180,8 @@ func main() {
signServer.Shutdown()
}
if config.SignV2.Enabled {
newSignServer.Shutdown()
if config.API.Enabled {
apiServer.Shutdown()
}
if config.Entrance.Enabled {
@@ -288,12 +198,46 @@ func wait() {
}
func preventClose(text string) {
if _config.ErupeConfig.DisableSoftCrash {
if config.GetConfig().DisableSoftCrash {
os.Exit(0)
}
fmt.Println("\nFailed to start Erupe:\n" + text)
mainLogger.Error(fmt.Sprintf(("\nFailed to start Erupe:\n" + text)))
go wait()
fmt.Println("\nPress Enter/Return to exit...")
fmt.Scanln()
mainLogger.Error(fmt.Sprintf(("\nPress Enter/Return to exit...")))
os.Exit(0)
}
func checkAndExitIf(condition bool, message string) {
if condition {
preventClose(message)
}
}
func resolveHostIP() {
if net.ParseIP(config.GetConfig().Host) == nil {
ips, err := net.LookupIP(config.GetConfig().Host)
if err == nil && len(ips) > 0 {
config.GetConfig().Host = ips[0].String()
}
checkAndExitIf(net.ParseIP(config.GetConfig().Host) == nil, "Invalid host address")
}
}
func initializeDiscordBot() *discordbot.DiscordBot {
if !config.GetConfig().Discord.Enabled {
mainLogger.Info("Discord: Disabled")
return nil
}
bot, err := discordbot.NewDiscordBot()
checkAndExitIf(err != nil, fmt.Sprintf("Discord: Failed to start, %s", err))
err = bot.Start()
checkAndExitIf(err != nil, fmt.Sprintf("Discord: Failed to start, %s", err))
_, err = bot.Session.ApplicationCommandBulkOverwrite(bot.Session.State.User.ID, "", discordbot.Commands)
checkAndExitIf(err != nil, fmt.Sprintf("Discord: Failed to register commands, %s", err))
mainLogger.Info("Discord: Started successfully")
return bot
}

View File

@@ -1,9 +1,9 @@
package binpacket
import (
"erupe-ce/common/byteframe"
"erupe-ce/common/stringsupport"
"erupe-ce/network"
"erupe-ce/utils/byteframe"
"erupe-ce/utils/stringsupport"
)
// ChatType represents the chat message type (Thanks to @Alice on discord for identifying these!)
@@ -11,7 +11,8 @@ type ChatType uint8
// Chat types
const (
ChatTypeLocal ChatType = 1
ChatTypeWorld ChatType = 0
ChatTypeStage = 1
ChatTypeGuild = 2
ChatTypeAlliance = 3
ChatTypeParty = 4

View File

@@ -1,9 +1,9 @@
package binpacket
import (
"erupe-ce/common/byteframe"
"erupe-ce/common/stringsupport"
"erupe-ce/network"
"erupe-ce/utils/byteframe"
"erupe-ce/utils/stringsupport"
)
type MsgBinMailNotify struct {

View File

@@ -1,8 +1,8 @@
package binpacket
import (
"erupe-ce/common/byteframe"
"erupe-ce/network"
"erupe-ce/utils/byteframe"
)
// MsgBinTargeted is a format used for some broadcast types

View File

@@ -1,4 +0,0 @@
package clientctx
// ClientContext holds contextual data required for packet encoding/decoding.
type ClientContext struct{} // Unused

View File

@@ -3,12 +3,11 @@ package network
import (
"encoding/hex"
"errors"
_config "erupe-ce/config"
"erupe-ce/config"
"erupe-ce/network/crypto"
"fmt"
"io"
"net"
"erupe-ce/network/crypto"
)
// CryptConn represents a MHF encrypted two-way connection,
@@ -52,7 +51,7 @@ func (cc *CryptConn) ReadPacket() ([]byte, error) {
var encryptedPacketBody []byte
// Don't know when support for this was added, works in Forward.4, doesn't work in Season 6.0
if _config.ErupeConfig.RealClientMode < _config.F1 {
if config.GetConfig().ClientID < config.F1 {
encryptedPacketBody = make([]byte, cph.DataSize)
} else {
encryptedPacketBody = make([]byte, uint32(cph.DataSize)+(uint32(cph.Pf0-0x03)*0x1000))
@@ -67,7 +66,7 @@ func (cc *CryptConn) ReadPacket() ([]byte, error) {
cc.readKeyRot = uint32(cph.KeyRotDelta) * (cc.readKeyRot + 1)
}
out, combinedCheck, check0, check1, check2 := crypto.Decrypt(encryptedPacketBody, cc.readKeyRot, nil)
out, combinedCheck, check0, check1, check2 := crypto.Crypto(encryptedPacketBody, cc.readKeyRot, false, nil)
if cph.Check0 != check0 || cph.Check1 != check1 || cph.Check2 != check2 {
fmt.Printf("got c0 %X, c1 %X, c2 %X\n", check0, check1, check2)
fmt.Printf("want c0 %X, c1 %X, c2 %X\n", cph.Check0, cph.Check1, cph.Check2)
@@ -77,7 +76,7 @@ func (cc *CryptConn) ReadPacket() ([]byte, error) {
// Attempt to bruteforce it.
fmt.Println("Crypto out of sync? Attempting bruteforce")
for key := byte(0); key < 255; key++ {
out, combinedCheck, check0, check1, check2 = crypto.Decrypt(encryptedPacketBody, 0, &key)
out, combinedCheck, check0, check1, check2 = crypto.Crypto(encryptedPacketBody, 0, false, &key)
//fmt.Printf("Key: 0x%X\n%s\n", key, hex.Dump(out))
if cph.Check0 == check0 && cph.Check1 == check1 && cph.Check2 == check2 {
fmt.Printf("Bruceforce successful, override key: 0x%X\n", key)
@@ -106,7 +105,7 @@ func (cc *CryptConn) SendPacket(data []byte) error {
}
// Encrypt the data
encData, combinedCheck, check0, check1, check2 := crypto.Encrypt(data, cc.sendKeyRot, nil)
encData, combinedCheck, check0, check1, check2 := crypto.Crypto(data, cc.sendKeyRot, true, nil)
header := &CryptPacketHeader{}
header.Pf0 = byte(((uint(len(encData)) >> 12) & 0xF3) | 3)
@@ -123,9 +122,7 @@ func (cc *CryptConn) SendPacket(data []byte) error {
return err
}
cc.conn.Write(headerBytes)
cc.conn.Write(encData)
cc.conn.Write(append(headerBytes, encData...))
cc.sentPackets++
cc.prevSendPacketCombinedCheck = combinedCheck

View File

@@ -1,4 +1,4 @@
package entranceserver
package bin8
import (
"encoding/binary"
@@ -12,45 +12,40 @@ var (
// CalcSum32 calculates the custom MHF "sum32" checksum of the given data.
func CalcSum32(data []byte) uint32 {
tableIdx0 := int(len(data) & 0xFF)
tableIdx1 := int(data[len(data)>>1] & 0xFF)
tableIdx0 := (len(data) + 1) & 0xFF
tableIdx1 := int((data[len(data)>>1] + 1) & 0xFF)
out := make([]byte, 4)
for i := 0; i < len(data); i++ {
tableIdx0++
tableIdx1++
tmp := byte((_sum32Table1[tableIdx1%9] ^ _sum32Table0[tableIdx0%7]) ^ data[i])
out[i&3] = (out[i&3] + tmp) & 0xFF
key := data[i] ^ _sum32Table0[(tableIdx0+i)%7] ^ _sum32Table1[(tableIdx1+i)%9]
out[i&3] = (out[i&3] + key) & 0xFF
}
return binary.BigEndian.Uint32(out)
}
func rotate(k *uint32) {
*k = uint32(((54323 * uint(*k)) + 1) & 0xFFFFFFFF)
}
// EncryptBin8 encrypts the given data using MHF's "binary8" encryption.
func EncryptBin8(data []byte, key byte) []byte {
curKey := uint32(((54323 * uint(key)) + 1) & 0xFFFFFFFF)
_key := uint32(key)
var output []byte
for i := 0; i < len(data); i++ {
tmp := (_bin8Key[i&7] ^ byte((curKey>>13)&0xFF))
rotate(&_key)
tmp := _bin8Key[i&7] ^ byte((_key>>13)&0xFF)
output = append(output, data[i]^tmp)
curKey = uint32(((54323 * uint(curKey)) + 1) & 0xFFFFFFFF)
}
return output
}
// DecryptBin8 decrypts the given MHF "binary8" data.
func DecryptBin8(data []byte, key byte) []byte {
curKey := uint32(((54323 * uint(key)) + 1) & 0xFFFFFFFF)
_key := uint32(key)
var output []byte
for i := 0; i < len(data); i++ {
tmp := (data[i] ^ byte((curKey>>13)&0xFF))
rotate(&_key)
tmp := data[i] ^ byte((_key>>13)&0xFF)
output = append(output, tmp^_bin8Key[i&7])
curKey = uint32(((54323 * uint(curKey)) + 1) & 0xFFFFFFFF)
}
return output
}

View File

@@ -1,4 +1,4 @@
package entranceserver
package bin8
import (
"bytes"

View File

@@ -6,46 +6,30 @@ var (
_sharedCryptKey = []byte{0xDD, 0xA8, 0x5F, 0x1E, 0x57, 0xAF, 0xC0, 0xCC, 0x43, 0x35, 0x8F, 0xBB, 0x6F, 0xE6, 0xA1, 0xD6, 0x60, 0xB9, 0x1A, 0xAE, 0x20, 0x49, 0x24, 0x81, 0x21, 0xFE, 0x86, 0x2B, 0x98, 0xB7, 0xB3, 0xD2, 0x91, 0x01, 0x3A, 0x4C, 0x65, 0x92, 0x1C, 0xF4, 0xBE, 0xDD, 0xD9, 0x08, 0xE6, 0x81, 0x98, 0x1B, 0x8D, 0x60, 0xF3, 0x6F, 0xA1, 0x47, 0x24, 0xF1, 0x53, 0x45, 0xC8, 0x7B, 0x88, 0x80, 0x4E, 0x36, 0xC3, 0x0D, 0xC9, 0xD6, 0x8B, 0x08, 0x19, 0x0B, 0xA5, 0xC1, 0x11, 0x4C, 0x60, 0xF8, 0x5D, 0xFC, 0x15, 0x68, 0x7E, 0x32, 0xC0, 0x50, 0xAB, 0x64, 0x1F, 0x8A, 0xD4, 0x08, 0x39, 0x7F, 0xC2, 0xFB, 0xBA, 0x6C, 0xF0, 0xE6, 0xB0, 0x31, 0x10, 0xC1, 0xBF, 0x75, 0x43, 0xBB, 0x18, 0x04, 0x0D, 0xD1, 0x97, 0xF7, 0x23, 0x21, 0x83, 0x8B, 0xCA, 0x25, 0x2B, 0xA3, 0x03, 0x13, 0xEA, 0xAE, 0xFE, 0xF0, 0xEB, 0xFD, 0x85, 0x57, 0x53, 0x65, 0x41, 0x2A, 0x40, 0x99, 0xC0, 0x94, 0x65, 0x7E, 0x7C, 0x93, 0x82, 0xB0, 0xB3, 0xE5, 0xC0, 0x21, 0x09, 0x84, 0xD5, 0xEF, 0x9F, 0xD1, 0x7E, 0xDC, 0x4D, 0xF5, 0x7E, 0xCD, 0x45, 0x3C, 0x7F, 0xF5, 0x59, 0x98, 0xC6, 0x55, 0xFC, 0x9F, 0xA3, 0xB7, 0x74, 0xEE, 0x31, 0x98, 0xE6, 0xB7, 0xBE, 0x26, 0xF4, 0x3C, 0x76, 0xF1, 0x23, 0x7E, 0x02, 0x4E, 0x3C, 0xD1, 0xC7, 0x28, 0x23, 0x73, 0xC4, 0xD9, 0x5E, 0x0D, 0xA1, 0x80, 0xA5, 0xAA, 0x26, 0x0A, 0xA3, 0x44, 0x82, 0x74, 0xE6, 0x3C, 0x44, 0x27, 0x51, 0x0D, 0x5F, 0xC7, 0x9C, 0xD6, 0x63, 0x67, 0xA5, 0x27, 0x97, 0x38, 0xFB, 0x2D, 0xD3, 0xD6, 0x60, 0x25, 0x83, 0x4D, 0x37, 0x5B, 0x40, 0x59, 0x11, 0x77, 0x51, 0x11, 0x14, 0x18, 0x07, 0x63, 0xB1, 0x34, 0x3D, 0xB8, 0x60, 0x13, 0xC2, 0xE8, 0x13, 0x82}
)
// Encrypt encrypts the given data using MHF's custom encryption+checksum method.
// if a overrideByteKey value is supplied (!= nil), it will be used to override the derived/truncated key byte.
func Encrypt(data []byte, key uint32, overrideByteKey *byte) (outputData []byte, combinedCheck uint16, check0 uint16, check1 uint16, check2 uint16) {
return _generalCrypt(data, key, 0, overrideByteKey)
}
// Decrypt decrypts the given data using MHF's custom decryption+checksum method.
// if a overrideByteKey value is supplied (!= nil), it will be used to override the derived/truncated key byte.
func Decrypt(data []byte, key uint32, overrideByteKey *byte) (outputData []byte, combinedCheck uint16, check0 uint16, check1 uint16, check2 uint16) {
return _generalCrypt(data, key, 1, overrideByteKey)
}
// _generalCrypt is a generalized MHF crypto function that can perform both encryption and decryption,
// Crypto is a generalized MHF crypto function that can perform both encryption and decryption,
// these two crypto operations are combined into a single function because they shared most of their logic.
// encrypt: cryptType==0
// decrypt: cryptType==1
func _generalCrypt(data []byte, rotKey uint32, cryptType int, overrideByteKey *byte) ([]byte, uint16, uint16, uint16, uint16) {
func Crypto(data []byte, rotKey uint32, encrypt bool, overrideByteKey *byte) ([]byte, uint16, uint16, uint16, uint16) {
cryptKeyTruncByte := byte(((rotKey >> 1) % 999983) & 0xFF)
if overrideByteKey != nil {
cryptKeyTruncByte = *overrideByteKey
}
derivedCryptKey := int32((uint32(len(data)) * (uint32(cryptKeyTruncByte) + 1)) & 0xFFFFFFFF)
derivedCryptKey := (uint32(len(data)) * (uint32(cryptKeyTruncByte) + 1)) & 0xFFFFFFFF
sharedBufIdx := byte(1)
accumulator0 := uint32(0)
accumulator1 := uint32(0)
accumulator2 := uint32(0)
var accumulator0, accumulator1, accumulator2 uint32
var outputData []byte
if cryptType == 0 {
if encrypt {
for i := 0; i < len(data); i++ {
// Do the encryption for this iteration
encKeyIdx := int32(((uint32(derivedCryptKey) >> 10) ^ uint32(data[i])) & 0xFF)
derivedCryptKey = (0x4FD * (derivedCryptKey + 1))
encKeyIdx := ((derivedCryptKey >> 10) ^ uint32(data[i])) & 0xFF
derivedCryptKey = 1277*derivedCryptKey + 1277
encKeyByte := _encryptKey[encKeyIdx]
// Update the checksum accumulators.
accumulator2 = uint32((accumulator2 + (uint32(sharedBufIdx) * uint32(data[i]))) & 0xFFFFFFFF)
accumulator1 = uint32((accumulator1 + uint32(encKeyIdx)) & 0xFFFFFFFF)
accumulator0 = uint32((accumulator0 + (uint32(encKeyByte)<<(i&7))&0xFFFFFFFF) & 0xFFFFFFFF)
accumulator2 = accumulator2 + (uint32(sharedBufIdx) * uint32(data[i]))
accumulator1 = accumulator1 + encKeyIdx
accumulator0 = accumulator0 + uint32(encKeyByte)<<(i&7)
// Append the output.
outputData = append(outputData, _sharedCryptKey[sharedBufIdx]^encKeyByte)
@@ -53,32 +37,32 @@ func _generalCrypt(data []byte, rotKey uint32, cryptType int, overrideByteKey *b
// Update the sharedBufIdx for the next iteration.
sharedBufIdx = data[i]
}
} else if cryptType == 1 {
} else {
for i := 0; i < len(data); i++ {
// Do the decryption for this iteration
oldSharedBufIdx := sharedBufIdx
tIdx := data[i] ^ _sharedCryptKey[sharedBufIdx]
decKeyByte := _decryptKey[tIdx]
sharedBufIdx = byte(((uint32(derivedCryptKey) >> 10) ^ uint32(decKeyByte)) & 0xFF)
sharedBufIdx = byte((derivedCryptKey >> 10) ^ uint32(decKeyByte))
// Update the checksum accumulators.
accumulator0 = (accumulator0 + ((uint32(tIdx) << (i & 7)) & 0xFFFFFFFF))
accumulator1 = (accumulator1 + uint32(decKeyByte)) & 0xFFFFFFFF
accumulator2 = (accumulator2 + ((uint32(oldSharedBufIdx) * uint32(sharedBufIdx)) & 0xFFFFFFFF)) & 0xFFFFFFFF
accumulator0 = accumulator0 + uint32(tIdx)<<(i&7)
accumulator1 = accumulator1 + uint32(decKeyByte)
accumulator2 = accumulator2 + uint32(oldSharedBufIdx)*uint32(sharedBufIdx)
// Append the output.
outputData = append(outputData, sharedBufIdx)
// Update the key pos for next iteration.
derivedCryptKey = (0x4FD * (derivedCryptKey + 1))
derivedCryptKey = 1277*derivedCryptKey + 1277
}
}
combinedCheck := uint16((accumulator1 + (accumulator0 >> 1) + (accumulator2 >> 2)) & 0xFFFF)
check0 := uint16((accumulator0 ^ ((accumulator0 & 0xFFFF0000) >> 16)) & 0xFFFF)
check1 := uint16((accumulator1 ^ ((accumulator1 & 0xFFFF0000) >> 16)) & 0xFFFF)
check2 := uint16((accumulator2 ^ ((accumulator2 & 0xFFFF0000) >> 16)) & 0xFFFF)
var check [4]uint16
check[0] = uint16(accumulator1 + (accumulator0 >> 1) + (accumulator2 >> 2))
check[1] = uint16(accumulator0 ^ ((accumulator0 & 0xFFFF0000) >> 16))
check[2] = uint16(accumulator1 ^ ((accumulator1 & 0xFFFF0000) >> 16))
check[3] = uint16(accumulator2 ^ ((accumulator2 & 0xFFFF0000) >> 16))
return outputData, combinedCheck, check0, check1, check2
return outputData, check[0], check[1], check[2], check[3]
}

View File

@@ -65,7 +65,7 @@ func TestEncrypt(t *testing.T) {
for k, tt := range tests {
testname := fmt.Sprintf("encrypt_test_%d", k)
t.Run(testname, func(t *testing.T) {
out, cc, c0, c1, c2 := Encrypt(tt.decryptedData, tt.key, nil)
out, cc, c0, c1, c2 := Crypto(tt.decryptedData, tt.key, true, nil)
if cc != tt.ecc {
t.Errorf("got cc 0x%X, want 0x%X", cc, tt.ecc)
} else if c0 != tt.ec0 {
@@ -86,7 +86,7 @@ func TestDecrypt(t *testing.T) {
for k, tt := range tests {
testname := fmt.Sprintf("decrypt_test_%d", k)
t.Run(testname, func(t *testing.T) {
out, cc, c0, c1, c2 := Decrypt(tt.encryptedData, tt.key, nil)
out, cc, c0, c1, c2 := Crypto(tt.decryptedData, tt.key, false, nil)
if cc != tt.ecc {
t.Errorf("got cc 0x%X, want 0x%X", cc, tt.ecc)
} else if c0 != tt.ec0 {

View File

@@ -1,19 +1,18 @@
package mhfpacket
import (
"erupe-ce/common/byteframe"
"erupe-ce/network"
"erupe-ce/network/clientctx"
"erupe-ce/utils/byteframe"
)
// Parser is the interface that wraps the Parse method.
type Parser interface {
Parse(bf *byteframe.ByteFrame, ctx *clientctx.ClientContext) error
Parse(bf *byteframe.ByteFrame) error
}
// Builder is the interface that wraps the Build method.
type Builder interface {
Build(bf *byteframe.ByteFrame, ctx *clientctx.ClientContext) error
Build(bf *byteframe.ByteFrame) error
}
// Opcoder is the interface that wraps the Opcode method.

View File

@@ -3,9 +3,8 @@ package mhfpacket
import (
"errors"
"erupe-ce/common/byteframe"
"erupe-ce/network"
"erupe-ce/network/clientctx"
"erupe-ce/utils/byteframe"
)
// MsgCaExchangeItem represents the MSG_CA_EXCHANGE_ITEM
@@ -17,11 +16,11 @@ func (m *MsgCaExchangeItem) Opcode() network.PacketID {
}
// Parse parses the packet from binary
func (m *MsgCaExchangeItem) Parse(bf *byteframe.ByteFrame, ctx *clientctx.ClientContext) error {
func (m *MsgCaExchangeItem) Parse(bf *byteframe.ByteFrame) error {
return errors.New("NOT IMPLEMENTED")
}
// Build builds a binary packet from the current data.
func (m *MsgCaExchangeItem) Build(bf *byteframe.ByteFrame, ctx *clientctx.ClientContext) error {
func (m *MsgCaExchangeItem) Build(bf *byteframe.ByteFrame) error {
return errors.New("NOT IMPLEMENTED")
}

View File

@@ -3,10 +3,8 @@ package mhfpacket
import (
"errors"
"erupe-ce/network/clientctx"
"erupe-ce/network"
"erupe-ce/common/byteframe"
"erupe-ce/utils/byteframe"
)
// MsgHead represents the MSG_HEAD
@@ -18,11 +16,11 @@ func (m *MsgHead) Opcode() network.PacketID {
}
// Parse parses the packet from binary
func (m *MsgHead) Parse(bf *byteframe.ByteFrame, ctx *clientctx.ClientContext) error {
func (m *MsgHead) Parse(bf *byteframe.ByteFrame) error {
return errors.New("NOT IMPLEMENTED")
}
// Build builds a binary packet from the current data.
func (m *MsgHead) Build(bf *byteframe.ByteFrame, ctx *clientctx.ClientContext) error {
func (m *MsgHead) Build(bf *byteframe.ByteFrame) error {
return errors.New("NOT IMPLEMENTED")
}

View File

@@ -3,10 +3,8 @@ package mhfpacket
import (
"errors"
"erupe-ce/network/clientctx"
"erupe-ce/network"
"erupe-ce/common/byteframe"
"erupe-ce/utils/byteframe"
)
// MsgMhfAcceptReadReward represents the MSG_MHF_ACCEPT_READ_REWARD
@@ -18,11 +16,11 @@ func (m *MsgMhfAcceptReadReward) Opcode() network.PacketID {
}
// Parse parses the packet from binary
func (m *MsgMhfAcceptReadReward) Parse(bf *byteframe.ByteFrame, ctx *clientctx.ClientContext) error {
func (m *MsgMhfAcceptReadReward) Parse(bf *byteframe.ByteFrame) error {
return errors.New("NOT IMPLEMENTED")
}
// Build builds a binary packet from the current data.
func (m *MsgMhfAcceptReadReward) Build(bf *byteframe.ByteFrame, ctx *clientctx.ClientContext) error {
func (m *MsgMhfAcceptReadReward) Build(bf *byteframe.ByteFrame) error {
return errors.New("NOT IMPLEMENTED")
}

View File

@@ -2,11 +2,10 @@ package mhfpacket
import (
"errors"
_config "erupe-ce/config"
"erupe-ce/config"
"erupe-ce/common/byteframe"
"erupe-ce/network"
"erupe-ce/network/clientctx"
"erupe-ce/utils/byteframe"
)
// MsgMhfAcquireCafeItem represents the MSG_MHF_ACQUIRE_CAFE_ITEM
@@ -26,12 +25,12 @@ func (m *MsgMhfAcquireCafeItem) Opcode() network.PacketID {
}
// Parse parses the packet from binary
func (m *MsgMhfAcquireCafeItem) Parse(bf *byteframe.ByteFrame, ctx *clientctx.ClientContext) error {
func (m *MsgMhfAcquireCafeItem) Parse(bf *byteframe.ByteFrame) error {
m.AckHandle = bf.ReadUint32()
m.ItemType = bf.ReadUint16()
m.ItemID = bf.ReadUint16()
m.Quant = bf.ReadUint16()
if _config.ErupeConfig.RealClientMode >= _config.G1 {
if config.GetConfig().ClientID >= config.G1 {
m.PointCost = bf.ReadUint32()
} else {
m.PointCost = uint32(bf.ReadUint16())
@@ -41,6 +40,6 @@ func (m *MsgMhfAcquireCafeItem) Parse(bf *byteframe.ByteFrame, ctx *clientctx.Cl
}
// Build builds a binary packet from the current data.
func (m *MsgMhfAcquireCafeItem) Build(bf *byteframe.ByteFrame, ctx *clientctx.ClientContext) error {
func (m *MsgMhfAcquireCafeItem) Build(bf *byteframe.ByteFrame) error {
return errors.New("NOT IMPLEMENTED")
}

View File

@@ -4,15 +4,14 @@ import (
"errors"
"erupe-ce/network"
"erupe-ce/network/clientctx"
"erupe-ce/common/byteframe"
"erupe-ce/utils/byteframe"
)
// MsgMhfAcquireDistItem represents the MSG_MHF_ACQUIRE_DIST_ITEM
type MsgMhfAcquireDistItem struct {
AckHandle uint32
AckHandle uint32
DistributionType uint8
DistributionID uint32
DistributionID uint32
}
// Opcode returns the ID associated with this packet type.
@@ -21,7 +20,7 @@ func (m *MsgMhfAcquireDistItem) Opcode() network.PacketID {
}
// Parse parses the packet from binary
func (m *MsgMhfAcquireDistItem) Parse(bf *byteframe.ByteFrame, ctx *clientctx.ClientContext) error {
func (m *MsgMhfAcquireDistItem) Parse(bf *byteframe.ByteFrame) error {
m.AckHandle = bf.ReadUint32()
m.DistributionType = bf.ReadUint8()
m.DistributionID = bf.ReadUint32()
@@ -29,6 +28,6 @@ func (m *MsgMhfAcquireDistItem) Parse(bf *byteframe.ByteFrame, ctx *clientctx.Cl
}
// Build builds a binary packet from the current data.
func (m *MsgMhfAcquireDistItem) Build(bf *byteframe.ByteFrame, ctx *clientctx.ClientContext) error {
func (m *MsgMhfAcquireDistItem) Build(bf *byteframe.ByteFrame) error {
return errors.New("NOT IMPLEMENTED")
}

View File

@@ -2,8 +2,7 @@ package mhfpacket
import (
"erupe-ce/network"
"erupe-ce/network/clientctx"
"erupe-ce/common/byteframe"
"erupe-ce/utils/byteframe"
)
// MsgMhfAcquireExchangeShop represents the MSG_MHF_ACQUIRE_EXCHANGE_SHOP
@@ -19,7 +18,7 @@ func (m *MsgMhfAcquireExchangeShop) Opcode() network.PacketID {
}
// Parse parses the packet from binary
func (m *MsgMhfAcquireExchangeShop) Parse(bf *byteframe.ByteFrame, ctx *clientctx.ClientContext) error {
func (m *MsgMhfAcquireExchangeShop) Parse(bf *byteframe.ByteFrame) error {
m.AckHandle = bf.ReadUint32()
m.DataSize = bf.ReadUint16()
m.RawDataPayload = bf.ReadBytes(uint(m.DataSize))
@@ -27,7 +26,7 @@ func (m *MsgMhfAcquireExchangeShop) Parse(bf *byteframe.ByteFrame, ctx *clientct
}
// Build builds a binary packet from the current data.
func (m *MsgMhfAcquireExchangeShop) Build(bf *byteframe.ByteFrame, ctx *clientctx.ClientContext) error {
func (m *MsgMhfAcquireExchangeShop) Build(bf *byteframe.ByteFrame) error {
bf.WriteUint32(m.AckHandle)
bf.WriteUint16(m.DataSize)
bf.WriteBytes(m.RawDataPayload)

View File

@@ -1,19 +1,18 @@
package mhfpacket
import (
"errors"
"errors"
"erupe-ce/network/clientctx"
"erupe-ce/network"
"erupe-ce/common/byteframe"
"erupe-ce/utils/byteframe"
)
// MsgMhfAcquireFesta represents the MSG_MHF_ACQUIRE_FESTA
type MsgMhfAcquireFesta struct {
AckHandle uint32
FestaID uint32
GuildID uint32
Unk uint16
AckHandle uint32
FestaID uint32
GuildID uint32
Unk uint8
}
// Opcode returns the ID associated with this packet type.
@@ -22,15 +21,16 @@ func (m *MsgMhfAcquireFesta) Opcode() network.PacketID {
}
// Parse parses the packet from binary
func (m *MsgMhfAcquireFesta) Parse(bf *byteframe.ByteFrame, ctx *clientctx.ClientContext) error {
m.AckHandle = bf.ReadUint32()
m.FestaID = bf.ReadUint32()
m.GuildID = bf.ReadUint32()
m.Unk = bf.ReadUint16()
return nil
func (m *MsgMhfAcquireFesta) Parse(bf *byteframe.ByteFrame) error {
m.AckHandle = bf.ReadUint32()
m.FestaID = bf.ReadUint32()
m.GuildID = bf.ReadUint32()
m.Unk = bf.ReadUint8()
bf.ReadUint8() // Zeroed
return nil
}
// Build builds a binary packet from the current data.
func (m *MsgMhfAcquireFesta) Build(bf *byteframe.ByteFrame, ctx *clientctx.ClientContext) error {
func (m *MsgMhfAcquireFesta) Build(bf *byteframe.ByteFrame) error {
return errors.New("NOT IMPLEMENTED")
}

View File

@@ -4,14 +4,13 @@ import (
"errors"
"erupe-ce/network"
"erupe-ce/network/clientctx"
"erupe-ce/common/byteframe"
"erupe-ce/utils/byteframe"
)
// MsgMhfAcquireFestaIntermediatePrize represents the MSG_MHF_ACQUIRE_FESTA_INTERMEDIATE_PRIZE
type MsgMhfAcquireFestaIntermediatePrize struct {
AckHandle uint32
PrizeID uint32
PrizeID uint32
}
// Opcode returns the ID associated with this packet type.
@@ -20,13 +19,13 @@ func (m *MsgMhfAcquireFestaIntermediatePrize) Opcode() network.PacketID {
}
// Parse parses the packet from binary
func (m *MsgMhfAcquireFestaIntermediatePrize) Parse(bf *byteframe.ByteFrame, ctx *clientctx.ClientContext) error {
func (m *MsgMhfAcquireFestaIntermediatePrize) Parse(bf *byteframe.ByteFrame) error {
m.AckHandle = bf.ReadUint32()
m.PrizeID = bf.ReadUint32()
m.PrizeID = bf.ReadUint32()
return nil
}
// Build builds a binary packet from the current data.
func (m *MsgMhfAcquireFestaIntermediatePrize) Build(bf *byteframe.ByteFrame, ctx *clientctx.ClientContext) error {
func (m *MsgMhfAcquireFestaIntermediatePrize) Build(bf *byteframe.ByteFrame) error {
return errors.New("NOT IMPLEMENTED")
}

View File

@@ -1,17 +1,16 @@
package mhfpacket
import (
"errors"
"errors"
"erupe-ce/network/clientctx"
"erupe-ce/network"
"erupe-ce/common/byteframe"
"erupe-ce/utils/byteframe"
)
// MsgMhfAcquireFestaPersonalPrize represents the MSG_MHF_ACQUIRE_FESTA_PERSONAL_PRIZE
type MsgMhfAcquireFestaPersonalPrize struct {
AckHandle uint32
PrizeID uint32
AckHandle uint32
PrizeID uint32
}
// Opcode returns the ID associated with this packet type.
@@ -20,13 +19,13 @@ func (m *MsgMhfAcquireFestaPersonalPrize) Opcode() network.PacketID {
}
// Parse parses the packet from binary
func (m *MsgMhfAcquireFestaPersonalPrize) Parse(bf *byteframe.ByteFrame, ctx *clientctx.ClientContext) error {
m.AckHandle = bf.ReadUint32()
m.PrizeID = bf.ReadUint32()
return nil
func (m *MsgMhfAcquireFestaPersonalPrize) Parse(bf *byteframe.ByteFrame) error {
m.AckHandle = bf.ReadUint32()
m.PrizeID = bf.ReadUint32()
return nil
}
// Build builds a binary packet from the current data.
func (m *MsgMhfAcquireFestaPersonalPrize) Build(bf *byteframe.ByteFrame, ctx *clientctx.ClientContext) error {
func (m *MsgMhfAcquireFestaPersonalPrize) Build(bf *byteframe.ByteFrame) error {
return errors.New("NOT IMPLEMENTED")
}

View File

@@ -1,17 +1,16 @@
package mhfpacket
import (
"errors"
"errors"
"erupe-ce/network/clientctx"
"erupe-ce/network"
"erupe-ce/common/byteframe"
"erupe-ce/utils/byteframe"
)
// MsgMhfAcquireGuildAdventure represents the MSG_MHF_ACQUIRE_GUILD_ADVENTURE
type MsgMhfAcquireGuildAdventure struct {
AckHandle uint32
ID uint32
AckHandle uint32
ID uint32
}
// Opcode returns the ID associated with this packet type.
@@ -20,13 +19,13 @@ func (m *MsgMhfAcquireGuildAdventure) Opcode() network.PacketID {
}
// Parse parses the packet from binary
func (m *MsgMhfAcquireGuildAdventure) Parse(bf *byteframe.ByteFrame, ctx *clientctx.ClientContext) error {
m.AckHandle = bf.ReadUint32()
m.ID = bf.ReadUint32()
return nil
func (m *MsgMhfAcquireGuildAdventure) Parse(bf *byteframe.ByteFrame) error {
m.AckHandle = bf.ReadUint32()
m.ID = bf.ReadUint32()
return nil
}
// Build builds a binary packet from the current data.
func (m *MsgMhfAcquireGuildAdventure) Build(bf *byteframe.ByteFrame, ctx *clientctx.ClientContext) error {
func (m *MsgMhfAcquireGuildAdventure) Build(bf *byteframe.ByteFrame) error {
return errors.New("NOT IMPLEMENTED")
}

View File

@@ -3,16 +3,15 @@ package mhfpacket
import (
"errors"
"erupe-ce/common/byteframe"
"erupe-ce/network"
"erupe-ce/network/clientctx"
"erupe-ce/utils/byteframe"
)
// MsgMhfAcquireGuildTresure represents the MSG_MHF_ACQUIRE_GUILD_TRESURE
type MsgMhfAcquireGuildTresure struct {
AckHandle uint32
HuntID uint32
Unk uint8
Unk bool
}
// Opcode returns the ID associated with this packet type.
@@ -21,14 +20,14 @@ func (m *MsgMhfAcquireGuildTresure) Opcode() network.PacketID {
}
// Parse parses the packet from binary
func (m *MsgMhfAcquireGuildTresure) Parse(bf *byteframe.ByteFrame, ctx *clientctx.ClientContext) error {
func (m *MsgMhfAcquireGuildTresure) Parse(bf *byteframe.ByteFrame) error {
m.AckHandle = bf.ReadUint32()
m.HuntID = bf.ReadUint32()
m.Unk = bf.ReadUint8()
m.Unk = bf.ReadBool()
return nil
}
// Build builds a binary packet from the current data.
func (m *MsgMhfAcquireGuildTresure) Build(bf *byteframe.ByteFrame, ctx *clientctx.ClientContext) error {
func (m *MsgMhfAcquireGuildTresure) Build(bf *byteframe.ByteFrame) error {
return errors.New("NOT IMPLEMENTED")
}

View File

@@ -1,11 +1,10 @@
package mhfpacket
import (
"errors"
import (
"errors"
"erupe-ce/network/clientctx"
"erupe-ce/network"
"erupe-ce/common/byteframe"
"erupe-ce/utils/byteframe"
)
// MsgMhfAcquireGuildTresureSouvenir represents the MSG_MHF_ACQUIRE_GUILD_TRESURE_SOUVENIR
@@ -19,12 +18,12 @@ func (m *MsgMhfAcquireGuildTresureSouvenir) Opcode() network.PacketID {
}
// Parse parses the packet from binary
func (m *MsgMhfAcquireGuildTresureSouvenir) Parse(bf *byteframe.ByteFrame, ctx *clientctx.ClientContext) error {
func (m *MsgMhfAcquireGuildTresureSouvenir) Parse(bf *byteframe.ByteFrame) error {
m.AckHandle = bf.ReadUint32()
return nil
}
// Build builds a binary packet from the current data.
func (m *MsgMhfAcquireGuildTresureSouvenir) Build(bf *byteframe.ByteFrame, ctx *clientctx.ClientContext) error {
func (m *MsgMhfAcquireGuildTresureSouvenir) Build(bf *byteframe.ByteFrame) error {
return errors.New("NOT IMPLEMENTED")
}

View File

@@ -3,9 +3,8 @@ package mhfpacket
import (
"errors"
"erupe-ce/common/byteframe"
"erupe-ce/network"
"erupe-ce/network/clientctx"
"erupe-ce/utils/byteframe"
)
// MsgMhfAcquireItem represents the MSG_MHF_ACQUIRE_ITEM
@@ -22,7 +21,7 @@ func (m *MsgMhfAcquireItem) Opcode() network.PacketID {
}
// Parse parses the packet from binary
func (m *MsgMhfAcquireItem) Parse(bf *byteframe.ByteFrame, ctx *clientctx.ClientContext) error {
func (m *MsgMhfAcquireItem) Parse(bf *byteframe.ByteFrame) error {
m.AckHandle = bf.ReadUint32()
m.Unk0 = bf.ReadUint16()
m.Length = bf.ReadUint16()
@@ -33,6 +32,6 @@ func (m *MsgMhfAcquireItem) Parse(bf *byteframe.ByteFrame, ctx *clientctx.Client
}
// Build builds a binary packet from the current data.
func (m *MsgMhfAcquireItem) Build(bf *byteframe.ByteFrame, ctx *clientctx.ClientContext) error {
func (m *MsgMhfAcquireItem) Build(bf *byteframe.ByteFrame) error {
return errors.New("NOT IMPLEMENTED")
}

View File

@@ -3,17 +3,16 @@ package mhfpacket
import (
"errors"
"erupe-ce/common/byteframe"
"erupe-ce/network"
"erupe-ce/network/clientctx"
"erupe-ce/utils/byteframe"
)
// MsgMhfAcquireMonthlyItem represents the MSG_MHF_ACQUIRE_MONTHLY_ITEM
type MsgMhfAcquireMonthlyItem struct {
AckHandle uint32
Unk0 uint16
Unk1 uint16
Unk2 uint32
Unk0 uint8
Unk1 uint8
Unk2 uint16
Unk3 uint32
}
@@ -23,16 +22,17 @@ func (m *MsgMhfAcquireMonthlyItem) Opcode() network.PacketID {
}
// Parse parses the packet from binary
func (m *MsgMhfAcquireMonthlyItem) Parse(bf *byteframe.ByteFrame, ctx *clientctx.ClientContext) error {
func (m *MsgMhfAcquireMonthlyItem) Parse(bf *byteframe.ByteFrame) error {
m.AckHandle = bf.ReadUint32()
m.Unk0 = bf.ReadUint16()
m.Unk1 = bf.ReadUint16()
m.Unk2 = bf.ReadUint32()
m.Unk0 = bf.ReadUint8()
m.Unk1 = bf.ReadUint8()
m.Unk2 = bf.ReadUint16()
m.Unk3 = bf.ReadUint32()
bf.ReadUint32() // Zeroed
return nil
}
// Build builds a binary packet from the current data.
func (m *MsgMhfAcquireMonthlyItem) Build(bf *byteframe.ByteFrame, ctx *clientctx.ClientContext) error {
func (m *MsgMhfAcquireMonthlyItem) Build(bf *byteframe.ByteFrame) error {
return errors.New("NOT IMPLEMENTED")
}

View File

@@ -1,11 +1,10 @@
package mhfpacket
import (
"errors"
import (
"errors"
"erupe-ce/network/clientctx"
"erupe-ce/network"
"erupe-ce/common/byteframe"
"erupe-ce/utils/byteframe"
)
// MsgMhfAcquireMonthlyReward represents the MSG_MHF_ACQUIRE_MONTHLY_REWARD
@@ -19,12 +18,12 @@ func (m *MsgMhfAcquireMonthlyReward) Opcode() network.PacketID {
}
// Parse parses the packet from binary
func (m *MsgMhfAcquireMonthlyReward) Parse(bf *byteframe.ByteFrame, ctx *clientctx.ClientContext) error {
func (m *MsgMhfAcquireMonthlyReward) Parse(bf *byteframe.ByteFrame) error {
m.AckHandle = bf.ReadUint32()
return nil
}
// Build builds a binary packet from the current data.
func (m *MsgMhfAcquireMonthlyReward) Build(bf *byteframe.ByteFrame, ctx *clientctx.ClientContext) error {
func (m *MsgMhfAcquireMonthlyReward) Build(bf *byteframe.ByteFrame) error {
return errors.New("NOT IMPLEMENTED")
}

View File

@@ -3,17 +3,14 @@ package mhfpacket
import (
"errors"
"erupe-ce/common/byteframe"
"erupe-ce/network"
"erupe-ce/network/clientctx"
"erupe-ce/utils/byteframe"
)
// MsgMhfAcquireTitle represents the MSG_MHF_ACQUIRE_TITLE
type MsgMhfAcquireTitle struct {
AckHandle uint32
Unk0 uint16
Unk1 uint16
TitleID uint16
TitleIDs []uint16
}
// Opcode returns the ID associated with this packet type.
@@ -22,15 +19,17 @@ func (m *MsgMhfAcquireTitle) Opcode() network.PacketID {
}
// Parse parses the packet from binary
func (m *MsgMhfAcquireTitle) Parse(bf *byteframe.ByteFrame, ctx *clientctx.ClientContext) error {
func (m *MsgMhfAcquireTitle) Parse(bf *byteframe.ByteFrame) error {
m.AckHandle = bf.ReadUint32()
m.Unk0 = bf.ReadUint16()
m.Unk1 = bf.ReadUint16()
m.TitleID = bf.ReadUint16()
titles := int(bf.ReadUint16())
bf.ReadUint16() // Zeroed
for i := 0; i < titles; i++ {
m.TitleIDs = append(m.TitleIDs, bf.ReadUint16())
}
return nil
}
// Build builds a binary packet from the current data.
func (m *MsgMhfAcquireTitle) Build(bf *byteframe.ByteFrame, ctx *clientctx.ClientContext) error {
func (m *MsgMhfAcquireTitle) Build(bf *byteframe.ByteFrame) error {
return errors.New("NOT IMPLEMENTED")
}

View File

@@ -3,9 +3,8 @@ package mhfpacket
import (
"errors"
"erupe-ce/common/byteframe"
"erupe-ce/network"
"erupe-ce/network/clientctx"
"erupe-ce/utils/byteframe"
)
// MsgMhfAcquireTournament represents the MSG_MHF_ACQUIRE_TOURNAMENT
@@ -20,13 +19,13 @@ func (m *MsgMhfAcquireTournament) Opcode() network.PacketID {
}
// Parse parses the packet from binary
func (m *MsgMhfAcquireTournament) Parse(bf *byteframe.ByteFrame, ctx *clientctx.ClientContext) error {
func (m *MsgMhfAcquireTournament) Parse(bf *byteframe.ByteFrame) error {
m.AckHandle = bf.ReadUint32()
m.TournamentID = bf.ReadUint32()
return nil
}
// Build builds a binary packet from the current data.
func (m *MsgMhfAcquireTournament) Build(bf *byteframe.ByteFrame, ctx *clientctx.ClientContext) error {
func (m *MsgMhfAcquireTournament) Build(bf *byteframe.ByteFrame) error {
return errors.New("NOT IMPLEMENTED")
}

View File

@@ -1,30 +1,29 @@
package mhfpacket
import (
"errors"
"errors"
"erupe-ce/network/clientctx"
"erupe-ce/network"
"erupe-ce/common/byteframe"
"erupe-ce/utils/byteframe"
)
// MsgMhfAcquireUdItem represents the MSG_MHF_ACQUIRE_UD_ITEM
type MsgMhfAcquireUdItem struct {
AckHandle uint32
Unk0 uint8
// from gal
// daily = 0
// personal = 1
// personal rank = 2
// guild rank = 3
// gcp = 4
// from cat
// treasure achievement = 5
// personal achievement = 6
// guild achievement = 7
RewardType uint8
Unk2 uint8 // Number of uint32s to read?
Unk3 []byte
AckHandle uint32
Unk0 uint8
// from gal
// daily = 0
// personal = 1
// personal rank = 2
// guild rank = 3
// gcp = 4
// from cat
// treasure achievement = 5
// personal achievement = 6
// guild achievement = 7
RewardType uint8
Unk2 uint8 // Number of uint32s to read?
Unk3 []byte
}
// Opcode returns the ID associated with this packet type.
@@ -33,18 +32,18 @@ func (m *MsgMhfAcquireUdItem) Opcode() network.PacketID {
}
// Parse parses the packet from binary
func (m *MsgMhfAcquireUdItem) Parse(bf *byteframe.ByteFrame, ctx *clientctx.ClientContext) error {
m.AckHandle = bf.ReadUint32()
func (m *MsgMhfAcquireUdItem) Parse(bf *byteframe.ByteFrame) error {
m.AckHandle = bf.ReadUint32()
m.Unk0 = bf.ReadUint8()
m.RewardType = bf.ReadUint8()
m.Unk2 = bf.ReadUint8()
for i := uint8(0); i < m.Unk2; i++ {
bf.ReadUint32()
}
m.Unk2 = bf.ReadUint8()
for i := uint8(0); i < m.Unk2; i++ {
bf.ReadUint32()
}
return nil
}
// Build builds a binary packet from the current data.
func (m *MsgMhfAcquireUdItem) Build(bf *byteframe.ByteFrame, ctx *clientctx.ClientContext) error {
func (m *MsgMhfAcquireUdItem) Build(bf *byteframe.ByteFrame) error {
return errors.New("NOT IMPLEMENTED")
}

View File

@@ -3,9 +3,8 @@ package mhfpacket
import (
"errors"
"erupe-ce/common/byteframe"
"erupe-ce/network"
"erupe-ce/network/clientctx"
"erupe-ce/utils/byteframe"
)
// MsgMhfAddAchievement represents the MSG_MHF_ADD_ACHIEVEMENT
@@ -21,7 +20,7 @@ func (m *MsgMhfAddAchievement) Opcode() network.PacketID {
}
// Parse parses the packet from binary
func (m *MsgMhfAddAchievement) Parse(bf *byteframe.ByteFrame, ctx *clientctx.ClientContext) error {
func (m *MsgMhfAddAchievement) Parse(bf *byteframe.ByteFrame) error {
m.AchievementID = bf.ReadUint8()
m.Unk1 = bf.ReadUint16()
m.Unk2 = bf.ReadUint16()
@@ -29,6 +28,6 @@ func (m *MsgMhfAddAchievement) Parse(bf *byteframe.ByteFrame, ctx *clientctx.Cli
}
// Build builds a binary packet from the current data.
func (m *MsgMhfAddAchievement) Build(bf *byteframe.ByteFrame, ctx *clientctx.ClientContext) error {
func (m *MsgMhfAddAchievement) Build(bf *byteframe.ByteFrame) error {
return errors.New("NOT IMPLEMENTED")
}

View File

@@ -1,18 +1,17 @@
package mhfpacket
import (
"errors"
"errors"
"erupe-ce/network/clientctx"
"erupe-ce/network"
"erupe-ce/common/byteframe"
"erupe-ce/utils/byteframe"
)
// MsgMhfAddGuildMissionCount represents the MSG_MHF_ADD_GUILD_MISSION_COUNT
type MsgMhfAddGuildMissionCount struct {
AckHandle uint32
MissionID uint32
Count uint32
AckHandle uint32
MissionID uint32
Count uint32
}
// Opcode returns the ID associated with this packet type.
@@ -21,14 +20,14 @@ func (m *MsgMhfAddGuildMissionCount) Opcode() network.PacketID {
}
// Parse parses the packet from binary
func (m *MsgMhfAddGuildMissionCount) Parse(bf *byteframe.ByteFrame, ctx *clientctx.ClientContext) error {
m.AckHandle = bf.ReadUint32()
m.MissionID = bf.ReadUint32()
m.Count = bf.ReadUint32()
return nil
func (m *MsgMhfAddGuildMissionCount) Parse(bf *byteframe.ByteFrame) error {
m.AckHandle = bf.ReadUint32()
m.MissionID = bf.ReadUint32()
m.Count = bf.ReadUint32()
return nil
}
// Build builds a binary packet from the current data.
func (m *MsgMhfAddGuildMissionCount) Build(bf *byteframe.ByteFrame, ctx *clientctx.ClientContext) error {
func (m *MsgMhfAddGuildMissionCount) Build(bf *byteframe.ByteFrame) error {
return errors.New("NOT IMPLEMENTED")
}

View File

@@ -1,17 +1,16 @@
package mhfpacket
import (
"errors"
"errors"
"erupe-ce/network/clientctx"
"erupe-ce/network"
"erupe-ce/common/byteframe"
"erupe-ce/utils/byteframe"
)
// MsgMhfAddGuildWeeklyBonusExceptionalUser represents the MSG_MHF_ADD_GUILD_WEEKLY_BONUS_EXCEPTIONAL_USER
type MsgMhfAddGuildWeeklyBonusExceptionalUser struct {
AckHandle uint32
NumUsers uint8
AckHandle uint32
NumUsers uint8
}
// Opcode returns the ID associated with this packet type.
@@ -20,13 +19,13 @@ func (m *MsgMhfAddGuildWeeklyBonusExceptionalUser) Opcode() network.PacketID {
}
// Parse parses the packet from binary
func (m *MsgMhfAddGuildWeeklyBonusExceptionalUser) Parse(bf *byteframe.ByteFrame, ctx *clientctx.ClientContext) error {
m.AckHandle = bf.ReadUint32()
m.NumUsers = bf.ReadUint8()
return nil
func (m *MsgMhfAddGuildWeeklyBonusExceptionalUser) Parse(bf *byteframe.ByteFrame) error {
m.AckHandle = bf.ReadUint32()
m.NumUsers = bf.ReadUint8()
return nil
}
// Build builds a binary packet from the current data.
func (m *MsgMhfAddGuildWeeklyBonusExceptionalUser) Build(bf *byteframe.ByteFrame, ctx *clientctx.ClientContext) error {
func (m *MsgMhfAddGuildWeeklyBonusExceptionalUser) Build(bf *byteframe.ByteFrame) error {
return errors.New("NOT IMPLEMENTED")
}

View File

@@ -2,8 +2,7 @@ package mhfpacket
import (
"erupe-ce/network"
"erupe-ce/network/clientctx"
"erupe-ce/common/byteframe"
"erupe-ce/utils/byteframe"
)
// MsgMhfAddKouryouPoint represents the MSG_MHF_ADD_KOURYOU_POINT
@@ -18,14 +17,14 @@ func (m *MsgMhfAddKouryouPoint) Opcode() network.PacketID {
}
// Parse parses the packet from binary
func (m *MsgMhfAddKouryouPoint) Parse(bf *byteframe.ByteFrame, ctx *clientctx.ClientContext) error {
func (m *MsgMhfAddKouryouPoint) Parse(bf *byteframe.ByteFrame) error {
m.AckHandle = bf.ReadUint32()
m.KouryouPoints = bf.ReadUint32()
return nil
}
// Build builds a binary packet from the current data.
func (m *MsgMhfAddKouryouPoint) Build(bf *byteframe.ByteFrame, ctx *clientctx.ClientContext) error {
func (m *MsgMhfAddKouryouPoint) Build(bf *byteframe.ByteFrame) error {
bf.WriteUint32(m.AckHandle)
bf.WriteUint32(m.KouryouPoints)
return nil

View File

@@ -1,11 +1,10 @@
package mhfpacket
import (
"errors"
import (
"errors"
"erupe-ce/network/clientctx"
"erupe-ce/network"
"erupe-ce/common/byteframe"
"erupe-ce/utils/byteframe"
)
// MsgMhfAddRewardSongCount represents the MSG_MHF_ADD_REWARD_SONG_COUNT
@@ -17,11 +16,11 @@ func (m *MsgMhfAddRewardSongCount) Opcode() network.PacketID {
}
// Parse parses the packet from binary
func (m *MsgMhfAddRewardSongCount) Parse(bf *byteframe.ByteFrame, ctx *clientctx.ClientContext) error {
func (m *MsgMhfAddRewardSongCount) Parse(bf *byteframe.ByteFrame) error {
return errors.New("NOT IMPLEMENTED")
}
// Build builds a binary packet from the current data.
func (m *MsgMhfAddRewardSongCount) Build(bf *byteframe.ByteFrame, ctx *clientctx.ClientContext) error {
func (m *MsgMhfAddRewardSongCount) Build(bf *byteframe.ByteFrame) error {
return errors.New("NOT IMPLEMENTED")
}

View File

@@ -1,11 +1,10 @@
package mhfpacket
import (
"errors"
import (
"errors"
"erupe-ce/network/clientctx"
"erupe-ce/network"
"erupe-ce/common/byteframe"
"erupe-ce/utils/byteframe"
)
// MsgMhfAddUdPoint represents the MSG_MHF_ADD_UD_POINT
@@ -21,7 +20,7 @@ func (m *MsgMhfAddUdPoint) Opcode() network.PacketID {
}
// Parse parses the packet from binary
func (m *MsgMhfAddUdPoint) Parse(bf *byteframe.ByteFrame, ctx *clientctx.ClientContext) error {
func (m *MsgMhfAddUdPoint) Parse(bf *byteframe.ByteFrame) error {
m.AckHandle = bf.ReadUint32()
m.Unk1 = bf.ReadUint32()
m.Unk2 = bf.ReadUint32()
@@ -31,6 +30,6 @@ func (m *MsgMhfAddUdPoint) Parse(bf *byteframe.ByteFrame, ctx *clientctx.ClientC
}
// Build builds a binary packet from the current data.
func (m *MsgMhfAddUdPoint) Build(bf *byteframe.ByteFrame, ctx *clientctx.ClientContext) error {
func (m *MsgMhfAddUdPoint) Build(bf *byteframe.ByteFrame) error {
return errors.New("NOT IMPLEMENTED")
}

View File

@@ -2,8 +2,7 @@ package mhfpacket
import (
"erupe-ce/network"
"erupe-ce/network/clientctx"
"erupe-ce/common/byteframe"
"erupe-ce/utils/byteframe"
)
// MsgMhfAddUdTacticsPoint represents the MSG_MHF_ADD_UD_TACTICS_POINT
@@ -19,7 +18,7 @@ func (m *MsgMhfAddUdTacticsPoint) Opcode() network.PacketID {
}
// Parse parses the packet from binary
func (m *MsgMhfAddUdTacticsPoint) Parse(bf *byteframe.ByteFrame, ctx *clientctx.ClientContext) error {
func (m *MsgMhfAddUdTacticsPoint) Parse(bf *byteframe.ByteFrame) error {
m.AckHandle = bf.ReadUint32()
m.Unk0 = bf.ReadUint16()
m.Unk1 = bf.ReadUint32()
@@ -27,7 +26,7 @@ func (m *MsgMhfAddUdTacticsPoint) Parse(bf *byteframe.ByteFrame, ctx *clientctx.
}
// Build builds a binary packet from the current data.
func (m *MsgMhfAddUdTacticsPoint) Build(bf *byteframe.ByteFrame, ctx *clientctx.ClientContext) error {
func (m *MsgMhfAddUdTacticsPoint) Build(bf *byteframe.ByteFrame) error {
bf.WriteUint32(m.AckHandle)
bf.WriteUint16(m.Unk0)
bf.WriteUint32(m.Unk1)

View File

@@ -3,9 +3,8 @@ package mhfpacket
import (
"errors"
"erupe-ce/common/byteframe"
"erupe-ce/network"
"erupe-ce/network/clientctx"
"erupe-ce/utils/byteframe"
)
// MsgMhfAnnounce represents the MSG_MHF_ANNOUNCE
@@ -14,7 +13,7 @@ type MsgMhfAnnounce struct {
IPAddress uint32
Port uint16
StageID []byte
Type uint8
Data *byteframe.ByteFrame
}
// Opcode returns the ID associated with this packet type.
@@ -23,7 +22,7 @@ func (m *MsgMhfAnnounce) Opcode() network.PacketID {
}
// Parse parses the packet from binary
func (m *MsgMhfAnnounce) Parse(bf *byteframe.ByteFrame, ctx *clientctx.ClientContext) error {
func (m *MsgMhfAnnounce) Parse(bf *byteframe.ByteFrame) error {
m.AckHandle = bf.ReadUint32()
m.IPAddress = bf.ReadUint32()
m.Port = bf.ReadUint16()
@@ -31,12 +30,11 @@ func (m *MsgMhfAnnounce) Parse(bf *byteframe.ByteFrame, ctx *clientctx.ClientCon
_ = bf.ReadUint8()
_ = bf.ReadUint8()
m.StageID = bf.ReadBytes(32)
_ = bf.ReadUint32()
m.Type = bf.ReadUint8()
m.Data = byteframe.NewByteFrameFromBytes(bf.ReadBytes(uint(bf.ReadUint32())))
return nil
}
// Build builds a binary packet from the current data.
func (m *MsgMhfAnnounce) Build(bf *byteframe.ByteFrame, ctx *clientctx.ClientContext) error {
func (m *MsgMhfAnnounce) Build(bf *byteframe.ByteFrame) error {
return errors.New("NOT IMPLEMENTED")
}

View File

@@ -1,11 +1,10 @@
package mhfpacket
import (
"errors"
import (
"errors"
"erupe-ce/network/clientctx"
"erupe-ce/network"
"erupe-ce/common/byteframe"
"erupe-ce/utils/byteframe"
)
// MsgMhfAnswerGuildScout represents the MSG_MHF_ANSWER_GUILD_SCOUT
@@ -21,7 +20,7 @@ func (m *MsgMhfAnswerGuildScout) Opcode() network.PacketID {
}
// Parse parses the packet from binary
func (m *MsgMhfAnswerGuildScout) Parse(bf *byteframe.ByteFrame, ctx *clientctx.ClientContext) error {
func (m *MsgMhfAnswerGuildScout) Parse(bf *byteframe.ByteFrame) error {
m.AckHandle = bf.ReadUint32()
m.LeaderID = bf.ReadUint32()
m.Answer = bf.ReadBool()
@@ -29,6 +28,6 @@ func (m *MsgMhfAnswerGuildScout) Parse(bf *byteframe.ByteFrame, ctx *clientctx.C
}
// Build builds a binary packet from the current data.
func (m *MsgMhfAnswerGuildScout) Build(bf *byteframe.ByteFrame, ctx *clientctx.ClientContext) error {
func (m *MsgMhfAnswerGuildScout) Build(bf *byteframe.ByteFrame) error {
return errors.New("NOT IMPLEMENTED")
}

View File

@@ -2,12 +2,11 @@ package mhfpacket
import (
"errors"
"erupe-ce/common/bfutil"
"erupe-ce/common/stringsupport"
"erupe-ce/utils/bfutil"
"erupe-ce/utils/stringsupport"
"erupe-ce/common/byteframe"
"erupe-ce/network"
"erupe-ce/network/clientctx"
"erupe-ce/utils/byteframe"
)
// MsgMhfApplyBbsArticle represents the MSG_MHF_APPLY_BBS_ARTICLE
@@ -26,7 +25,7 @@ func (m *MsgMhfApplyBbsArticle) Opcode() network.PacketID {
}
// Parse parses the packet from binary
func (m *MsgMhfApplyBbsArticle) Parse(bf *byteframe.ByteFrame, ctx *clientctx.ClientContext) error {
func (m *MsgMhfApplyBbsArticle) Parse(bf *byteframe.ByteFrame) error {
m.AckHandle = bf.ReadUint32()
m.Unk0 = bf.ReadUint32()
m.Unk1 = bf.ReadBytes(16)
@@ -37,6 +36,6 @@ func (m *MsgMhfApplyBbsArticle) Parse(bf *byteframe.ByteFrame, ctx *clientctx.Cl
}
// Build builds a binary packet from the current data.
func (m *MsgMhfApplyBbsArticle) Build(bf *byteframe.ByteFrame, ctx *clientctx.ClientContext) error {
func (m *MsgMhfApplyBbsArticle) Build(bf *byteframe.ByteFrame) error {
return errors.New("NOT IMPLEMENTED")
}

View File

@@ -2,9 +2,8 @@ package mhfpacket
import (
"errors"
"erupe-ce/common/byteframe"
"erupe-ce/network"
"erupe-ce/network/clientctx"
"erupe-ce/utils/byteframe"
)
// MsgMhfApplyCampaign represents the MSG_MHF_APPLY_CAMPAIGN
@@ -21,7 +20,7 @@ func (m *MsgMhfApplyCampaign) Opcode() network.PacketID {
}
// Parse parses the packet from binary
func (m *MsgMhfApplyCampaign) Parse(bf *byteframe.ByteFrame, ctx *clientctx.ClientContext) error {
func (m *MsgMhfApplyCampaign) Parse(bf *byteframe.ByteFrame) error {
m.AckHandle = bf.ReadUint32()
m.Unk0 = bf.ReadUint32()
m.Unk1 = bf.ReadUint16()
@@ -30,6 +29,6 @@ func (m *MsgMhfApplyCampaign) Parse(bf *byteframe.ByteFrame, ctx *clientctx.Clie
}
// Build builds a binary packet from the current data.
func (m *MsgMhfApplyCampaign) Build(bf *byteframe.ByteFrame, ctx *clientctx.ClientContext) error {
func (m *MsgMhfApplyCampaign) Build(bf *byteframe.ByteFrame) error {
return errors.New("NOT IMPLEMENTED")
}

View File

@@ -2,9 +2,9 @@ package mhfpacket
import (
"errors"
"erupe-ce/common/byteframe"
"erupe-ce/config"
"erupe-ce/network"
"erupe-ce/network/clientctx"
"erupe-ce/utils/byteframe"
)
// MsgMhfApplyDistItem represents the MSG_MHF_APPLY_DIST_ITEM
@@ -22,16 +22,20 @@ func (m *MsgMhfApplyDistItem) Opcode() network.PacketID {
}
// Parse parses the packet from binary
func (m *MsgMhfApplyDistItem) Parse(bf *byteframe.ByteFrame, ctx *clientctx.ClientContext) error {
func (m *MsgMhfApplyDistItem) Parse(bf *byteframe.ByteFrame) error {
m.AckHandle = bf.ReadUint32()
m.DistributionType = bf.ReadUint8()
m.DistributionID = bf.ReadUint32()
m.Unk2 = bf.ReadUint32()
m.Unk3 = bf.ReadUint32()
if config.GetConfig().ClientID >= config.G8 {
m.Unk2 = bf.ReadUint32()
}
if config.GetConfig().ClientID >= config.G10 {
m.Unk3 = bf.ReadUint32()
}
return nil
}
// Build builds a binary packet from the current data.
func (m *MsgMhfApplyDistItem) Build(bf *byteframe.ByteFrame, ctx *clientctx.ClientContext) error {
func (m *MsgMhfApplyDistItem) Build(bf *byteframe.ByteFrame) error {
return errors.New("NOT IMPLEMENTED")
}

View File

@@ -1,9 +1,9 @@
package mhfpacket
import (
"errors"
"erupe-ce/network"
"erupe-ce/network/clientctx"
"erupe-ce/common/byteframe"
"erupe-ce/utils/byteframe"
)
// MsgMhfArrangeGuildMember represents the MSG_MHF_ARRANGE_GUILD_MEMBER
@@ -19,14 +19,14 @@ func (m *MsgMhfArrangeGuildMember) Opcode() network.PacketID {
}
// Parse parses the packet from binary
func (m *MsgMhfArrangeGuildMember) Parse(bf *byteframe.ByteFrame, ctx *clientctx.ClientContext) error {
func (m *MsgMhfArrangeGuildMember) Parse(bf *byteframe.ByteFrame) error {
m.AckHandle = bf.ReadUint32()
m.GuildID = bf.ReadUint32()
charCount := bf.ReadUint16()
bf.ReadUint8() // Zeroed
charCount := int(bf.ReadUint8())
m.CharIDs = make([]uint32, charCount)
for i := uint16(0); i < charCount; i++ {
for i := 0; i < charCount; i++ {
m.CharIDs[i] = bf.ReadUint32()
}
@@ -34,14 +34,6 @@ func (m *MsgMhfArrangeGuildMember) Parse(bf *byteframe.ByteFrame, ctx *clientctx
}
// Build builds a binary packet from the current data.
func (m *MsgMhfArrangeGuildMember) Build(bf *byteframe.ByteFrame, ctx *clientctx.ClientContext) error {
bf.WriteUint32(m.AckHandle)
bf.WriteUint32(m.GuildID)
bf.WriteUint16(uint16(len(m.CharIDs)))
for _, charID := range m.CharIDs {
bf.WriteUint32(charID)
}
return nil
func (m *MsgMhfArrangeGuildMember) Build(bf *byteframe.ByteFrame) error {
return errors.New("NOT IMPLEMENTED")
}

View File

@@ -1,17 +1,16 @@
package mhfpacket
import (
"errors"
"errors"
"erupe-ce/network/clientctx"
"erupe-ce/network"
"erupe-ce/common/byteframe"
"erupe-ce/utils/byteframe"
)
// MsgMhfCancelGuildMissionTarget represents the MSG_MHF_CANCEL_GUILD_MISSION_TARGET
type MsgMhfCancelGuildMissionTarget struct {
AckHandle uint32
MissionID uint32
AckHandle uint32
MissionID uint32
}
// Opcode returns the ID associated with this packet type.
@@ -20,13 +19,13 @@ func (m *MsgMhfCancelGuildMissionTarget) Opcode() network.PacketID {
}
// Parse parses the packet from binary
func (m *MsgMhfCancelGuildMissionTarget) Parse(bf *byteframe.ByteFrame, ctx *clientctx.ClientContext) error {
m.AckHandle = bf.ReadUint32()
m.MissionID = bf.ReadUint32()
return nil
func (m *MsgMhfCancelGuildMissionTarget) Parse(bf *byteframe.ByteFrame) error {
m.AckHandle = bf.ReadUint32()
m.MissionID = bf.ReadUint32()
return nil
}
// Build builds a binary packet from the current data.
func (m *MsgMhfCancelGuildMissionTarget) Build(bf *byteframe.ByteFrame, ctx *clientctx.ClientContext) error {
func (m *MsgMhfCancelGuildMissionTarget) Build(bf *byteframe.ByteFrame) error {
return errors.New("NOT IMPLEMENTED")
}

View File

@@ -1,11 +1,10 @@
package mhfpacket
import (
"errors"
import (
"errors"
"erupe-ce/network/clientctx"
"erupe-ce/network"
"erupe-ce/common/byteframe"
"erupe-ce/utils/byteframe"
)
// MsgMhfCancelGuildScout represents the MSG_MHF_CANCEL_GUILD_SCOUT
@@ -20,13 +19,13 @@ func (m *MsgMhfCancelGuildScout) Opcode() network.PacketID {
}
// Parse parses the packet from binary
func (m *MsgMhfCancelGuildScout) Parse(bf *byteframe.ByteFrame, ctx *clientctx.ClientContext) error {
func (m *MsgMhfCancelGuildScout) Parse(bf *byteframe.ByteFrame) error {
m.AckHandle = bf.ReadUint32()
m.InvitationID = bf.ReadUint32()
return nil
}
// Build builds a binary packet from the current data.
func (m *MsgMhfCancelGuildScout) Build(bf *byteframe.ByteFrame, ctx *clientctx.ClientContext) error {
func (m *MsgMhfCancelGuildScout) Build(bf *byteframe.ByteFrame) error {
return errors.New("NOT IMPLEMENTED")
}

View File

@@ -3,9 +3,8 @@ package mhfpacket
import (
"errors"
"erupe-ce/common/byteframe"
"erupe-ce/network"
"erupe-ce/network/clientctx"
"erupe-ce/utils/byteframe"
)
// MsgMhfCaravanMyRank represents the MSG_MHF_CARAVAN_MY_RANK
@@ -22,7 +21,7 @@ func (m *MsgMhfCaravanMyRank) Opcode() network.PacketID {
}
// Parse parses the packet from binary
func (m *MsgMhfCaravanMyRank) Parse(bf *byteframe.ByteFrame, ctx *clientctx.ClientContext) error {
func (m *MsgMhfCaravanMyRank) Parse(bf *byteframe.ByteFrame) error {
m.AckHandle = bf.ReadUint32()
m.Unk0 = bf.ReadUint32()
m.Unk1 = bf.ReadUint32()
@@ -31,6 +30,6 @@ func (m *MsgMhfCaravanMyRank) Parse(bf *byteframe.ByteFrame, ctx *clientctx.Clie
}
// Build builds a binary packet from the current data.
func (m *MsgMhfCaravanMyRank) Build(bf *byteframe.ByteFrame, ctx *clientctx.ClientContext) error {
func (m *MsgMhfCaravanMyRank) Build(bf *byteframe.ByteFrame) error {
return errors.New("NOT IMPLEMENTED")
}

View File

@@ -3,9 +3,8 @@ package mhfpacket
import (
"errors"
"erupe-ce/common/byteframe"
"erupe-ce/network"
"erupe-ce/network/clientctx"
"erupe-ce/utils/byteframe"
)
// MsgMhfCaravanMyScore represents the MSG_MHF_CARAVAN_MY_SCORE
@@ -26,7 +25,7 @@ func (m *MsgMhfCaravanMyScore) Opcode() network.PacketID {
}
// Parse parses the packet from binary
func (m *MsgMhfCaravanMyScore) Parse(bf *byteframe.ByteFrame, ctx *clientctx.ClientContext) error {
func (m *MsgMhfCaravanMyScore) Parse(bf *byteframe.ByteFrame) error {
m.AckHandle = bf.ReadUint32()
m.Unk0 = bf.ReadUint32()
m.Unk1 = bf.ReadUint32()
@@ -39,6 +38,6 @@ func (m *MsgMhfCaravanMyScore) Parse(bf *byteframe.ByteFrame, ctx *clientctx.Cli
}
// Build builds a binary packet from the current data.
func (m *MsgMhfCaravanMyScore) Build(bf *byteframe.ByteFrame, ctx *clientctx.ClientContext) error {
func (m *MsgMhfCaravanMyScore) Build(bf *byteframe.ByteFrame) error {
return errors.New("NOT IMPLEMENTED")
}

View File

@@ -3,9 +3,8 @@ package mhfpacket
import (
"errors"
"erupe-ce/common/byteframe"
"erupe-ce/network"
"erupe-ce/network/clientctx"
"erupe-ce/utils/byteframe"
)
// MsgMhfCaravanRanking represents the MSG_MHF_CARAVAN_RANKING
@@ -22,7 +21,7 @@ func (m *MsgMhfCaravanRanking) Opcode() network.PacketID {
}
// Parse parses the packet from binary
func (m *MsgMhfCaravanRanking) Parse(bf *byteframe.ByteFrame, ctx *clientctx.ClientContext) error {
func (m *MsgMhfCaravanRanking) Parse(bf *byteframe.ByteFrame) error {
m.AckHandle = bf.ReadUint32()
m.Unk0 = bf.ReadUint32()
m.Unk1 = bf.ReadUint32()
@@ -31,6 +30,6 @@ func (m *MsgMhfCaravanRanking) Parse(bf *byteframe.ByteFrame, ctx *clientctx.Cli
}
// Build builds a binary packet from the current data.
func (m *MsgMhfCaravanRanking) Build(bf *byteframe.ByteFrame, ctx *clientctx.ClientContext) error {
func (m *MsgMhfCaravanRanking) Build(bf *byteframe.ByteFrame) error {
return errors.New("NOT IMPLEMENTED")
}

View File

@@ -1,19 +1,19 @@
package mhfpacket
import (
"errors"
"errors"
"erupe-ce/network/clientctx"
"erupe-ce/network"
"erupe-ce/common/byteframe"
"erupe-ce/utils/byteframe"
)
// MsgMhfChargeFesta represents the MSG_MHF_CHARGE_FESTA
type MsgMhfChargeFesta struct {
AckHandle uint32
FestaID uint32
GuildID uint32
Souls int
AckHandle uint32
FestaID uint32
GuildID uint32
Souls []uint16
Auto bool
}
// Opcode returns the ID associated with this packet type.
@@ -22,19 +22,18 @@ func (m *MsgMhfChargeFesta) Opcode() network.PacketID {
}
// Parse parses the packet from binary
func (m *MsgMhfChargeFesta) Parse(bf *byteframe.ByteFrame, ctx *clientctx.ClientContext) error {
m.AckHandle = bf.ReadUint32()
m.FestaID = bf.ReadUint32()
m.GuildID = bf.ReadUint32()
m.Souls = 0
for i := bf.ReadUint16(); i > 0; i-- {
m.Souls += int(bf.ReadUint16())
}
_ = bf.ReadUint8() // Unk
return nil
func (m *MsgMhfChargeFesta) Parse(bf *byteframe.ByteFrame) error {
m.AckHandle = bf.ReadUint32()
m.FestaID = bf.ReadUint32()
m.GuildID = bf.ReadUint32()
for i := bf.ReadUint16(); i > 0; i-- {
m.Souls = append(m.Souls, bf.ReadUint16())
}
m.Auto = bf.ReadBool()
return nil
}
// Build builds a binary packet from the current data.
func (m *MsgMhfChargeFesta) Build(bf *byteframe.ByteFrame, ctx *clientctx.ClientContext) error {
func (m *MsgMhfChargeFesta) Build(bf *byteframe.ByteFrame) error {
return errors.New("NOT IMPLEMENTED")
}

View File

@@ -1,18 +1,17 @@
package mhfpacket
import (
"errors"
"errors"
"erupe-ce/network/clientctx"
"erupe-ce/network"
"erupe-ce/common/byteframe"
"erupe-ce/utils/byteframe"
)
// MsgMhfChargeGuildAdventure represents the MSG_MHF_CHARGE_GUILD_ADVENTURE
type MsgMhfChargeGuildAdventure struct {
AckHandle uint32
ID uint32
Amount uint32
AckHandle uint32
ID uint32
Amount uint32
}
// Opcode returns the ID associated with this packet type.
@@ -21,14 +20,14 @@ func (m *MsgMhfChargeGuildAdventure) Opcode() network.PacketID {
}
// Parse parses the packet from binary
func (m *MsgMhfChargeGuildAdventure) Parse(bf *byteframe.ByteFrame, ctx *clientctx.ClientContext) error {
m.AckHandle = bf.ReadUint32()
m.ID = bf.ReadUint32()
m.Amount = bf.ReadUint32()
return nil
func (m *MsgMhfChargeGuildAdventure) Parse(bf *byteframe.ByteFrame) error {
m.AckHandle = bf.ReadUint32()
m.ID = bf.ReadUint32()
m.Amount = bf.ReadUint32()
return nil
}
// Build builds a binary packet from the current data.
func (m *MsgMhfChargeGuildAdventure) Build(bf *byteframe.ByteFrame, ctx *clientctx.ClientContext) error {
func (m *MsgMhfChargeGuildAdventure) Build(bf *byteframe.ByteFrame) error {
return errors.New("NOT IMPLEMENTED")
}

View File

@@ -1,9 +1,9 @@
package mhfpacket
import (
"errors"
"erupe-ce/network"
"erupe-ce/network/clientctx"
"erupe-ce/common/byteframe"
"erupe-ce/utils/byteframe"
)
// MsgMhfCheckDailyCafepoint represents the MSG_MHF_CHECK_DAILY_CAFEPOINT
@@ -18,14 +18,12 @@ func (m *MsgMhfCheckDailyCafepoint) Opcode() network.PacketID {
}
// Parse parses the packet from binary
func (m *MsgMhfCheckDailyCafepoint) Parse(bf *byteframe.ByteFrame, ctx *clientctx.ClientContext) error {
func (m *MsgMhfCheckDailyCafepoint) Parse(bf *byteframe.ByteFrame) error {
m.AckHandle = bf.ReadUint32()
m.Unk = bf.ReadUint32()
return nil
}
func (m *MsgMhfCheckDailyCafepoint) Build(bf *byteframe.ByteFrame, ctx *clientctx.ClientContext) error {
bf.WriteUint32(m.AckHandle)
bf.WriteUint32(m.Unk)
return nil
func (m *MsgMhfCheckDailyCafepoint) Build(bf *byteframe.ByteFrame) error {
return errors.New("NOT IMPLEMENTED")
}

View File

@@ -3,16 +3,14 @@ package mhfpacket
import (
"errors"
"erupe-ce/common/byteframe"
"erupe-ce/network"
"erupe-ce/network/clientctx"
"erupe-ce/utils/byteframe"
)
// MsgMhfCheckMonthlyItem represents the MSG_MHF_CHECK_MONTHLY_ITEM
type MsgMhfCheckMonthlyItem struct {
AckHandle uint32
Type uint8
Unk []byte
}
// Opcode returns the ID associated with this packet type.
@@ -21,14 +19,16 @@ func (m *MsgMhfCheckMonthlyItem) Opcode() network.PacketID {
}
// Parse parses the packet from binary
func (m *MsgMhfCheckMonthlyItem) Parse(bf *byteframe.ByteFrame, ctx *clientctx.ClientContext) error {
func (m *MsgMhfCheckMonthlyItem) Parse(bf *byteframe.ByteFrame) error {
m.AckHandle = bf.ReadUint32()
m.Type = bf.ReadUint8()
m.Unk = bf.ReadBytes(3)
bf.ReadUint8() // Zeroed
bf.ReadUint8() // Zeroed
bf.ReadUint8() // Zeroed
return nil
}
// Build builds a binary packet from the current data.
func (m *MsgMhfCheckMonthlyItem) Build(bf *byteframe.ByteFrame, ctx *clientctx.ClientContext) error {
func (m *MsgMhfCheckMonthlyItem) Build(bf *byteframe.ByteFrame) error {
return errors.New("NOT IMPLEMENTED")
}

View File

@@ -2,9 +2,8 @@ package mhfpacket
import (
"errors"
"erupe-ce/common/byteframe"
"erupe-ce/network"
"erupe-ce/network/clientctx"
"erupe-ce/utils/byteframe"
)
// MsgMhfCheckWeeklyStamp represents the MSG_MHF_CHECK_WEEKLY_STAMP
@@ -12,7 +11,6 @@ type MsgMhfCheckWeeklyStamp struct {
AckHandle uint32
StampType string
Unk1 bool
Unk2 uint16 // Hardcoded 0 in the binary
}
// Opcode returns the ID associated with this packet type.
@@ -21,7 +19,7 @@ func (m *MsgMhfCheckWeeklyStamp) Opcode() network.PacketID {
}
// Parse parses the packet from binary
func (m *MsgMhfCheckWeeklyStamp) Parse(bf *byteframe.ByteFrame, ctx *clientctx.ClientContext) error {
func (m *MsgMhfCheckWeeklyStamp) Parse(bf *byteframe.ByteFrame) error {
m.AckHandle = bf.ReadUint32()
stampType := bf.ReadUint8()
switch stampType {
@@ -31,11 +29,11 @@ func (m *MsgMhfCheckWeeklyStamp) Parse(bf *byteframe.ByteFrame, ctx *clientctx.C
m.StampType = "ex"
}
m.Unk1 = bf.ReadBool()
m.Unk2 = bf.ReadUint16()
bf.ReadUint16() // Zeroed
return nil
}
// Build builds a binary packet from the current data.
func (m *MsgMhfCheckWeeklyStamp) Build(bf *byteframe.ByteFrame, ctx *clientctx.ClientContext) error {
func (m *MsgMhfCheckWeeklyStamp) Build(bf *byteframe.ByteFrame) error {
return errors.New("NOT IMPLEMENTED")
}

View File

@@ -3,9 +3,8 @@ package mhfpacket
import (
"errors"
"erupe-ce/common/byteframe"
"erupe-ce/network"
"erupe-ce/network/clientctx"
"erupe-ce/utils/byteframe"
)
// MsgMhfContractMercenary represents the MSG_MHF_CONTRACT_MERCENARY
@@ -22,7 +21,7 @@ func (m *MsgMhfContractMercenary) Opcode() network.PacketID {
}
// Parse parses the packet from binary
func (m *MsgMhfContractMercenary) Parse(bf *byteframe.ByteFrame, ctx *clientctx.ClientContext) error {
func (m *MsgMhfContractMercenary) Parse(bf *byteframe.ByteFrame) error {
m.AckHandle = bf.ReadUint32()
m.PactMercID = bf.ReadUint32()
m.CID = bf.ReadUint32()
@@ -31,6 +30,6 @@ func (m *MsgMhfContractMercenary) Parse(bf *byteframe.ByteFrame, ctx *clientctx.
}
// Build builds a binary packet from the current data.
func (m *MsgMhfContractMercenary) Build(bf *byteframe.ByteFrame, ctx *clientctx.ClientContext) error {
func (m *MsgMhfContractMercenary) Build(bf *byteframe.ByteFrame) error {
return errors.New("NOT IMPLEMENTED")
}

View File

@@ -3,17 +3,14 @@ package mhfpacket
import (
"errors"
"erupe-ce/common/byteframe"
"erupe-ce/common/stringsupport"
"erupe-ce/network"
"erupe-ce/network/clientctx"
"erupe-ce/utils/byteframe"
"erupe-ce/utils/stringsupport"
)
// MsgMhfCreateGuild represents the MSG_MHF_CREATE_GUILD
type MsgMhfCreateGuild struct {
AckHandle uint32
Unk0 uint8
Unk1 uint8
Name string
}
@@ -23,16 +20,15 @@ func (m *MsgMhfCreateGuild) Opcode() network.PacketID {
}
// Parse parses the packet from binary
func (m *MsgMhfCreateGuild) Parse(bf *byteframe.ByteFrame, ctx *clientctx.ClientContext) error {
func (m *MsgMhfCreateGuild) Parse(bf *byteframe.ByteFrame) error {
m.AckHandle = bf.ReadUint32()
m.Unk0 = bf.ReadUint8()
m.Unk1 = bf.ReadUint8()
_ = bf.ReadUint16() // len
bf.ReadUint16() // Zeroed
bf.ReadUint16() // Name length
m.Name = stringsupport.SJISToUTF8(bf.ReadNullTerminatedBytes())
return nil
}
// Build builds a binary packet from the current data.
func (m *MsgMhfCreateGuild) Build(bf *byteframe.ByteFrame, ctx *clientctx.ClientContext) error {
func (m *MsgMhfCreateGuild) Build(bf *byteframe.ByteFrame) error {
return errors.New("NOT IMPLEMENTED")
}

View File

@@ -1,19 +1,18 @@
package mhfpacket
import (
"errors"
"errors"
"erupe-ce/network/clientctx"
"erupe-ce/common/stringsupport"
"erupe-ce/network"
"erupe-ce/common/byteframe"
"erupe-ce/utils/byteframe"
"erupe-ce/utils/stringsupport"
)
// MsgMhfCreateJoint represents the MSG_MHF_CREATE_JOINT
type MsgMhfCreateJoint struct {
AckHandle uint32
GuildID uint32
Name string
AckHandle uint32
GuildID uint32
Name string
}
// Opcode returns the ID associated with this packet type.
@@ -22,15 +21,16 @@ func (m *MsgMhfCreateJoint) Opcode() network.PacketID {
}
// Parse parses the packet from binary
func (m *MsgMhfCreateJoint) Parse(bf *byteframe.ByteFrame, ctx *clientctx.ClientContext) error {
m.AckHandle = bf.ReadUint32()
m.GuildID = bf.ReadUint32()
_ = bf.ReadUint32() // len
m.Name = stringsupport.SJISToUTF8(bf.ReadNullTerminatedBytes())
return nil
func (m *MsgMhfCreateJoint) Parse(bf *byteframe.ByteFrame) error {
m.AckHandle = bf.ReadUint32()
m.GuildID = bf.ReadUint32()
bf.ReadUint16() // Zeroed
bf.ReadUint16() // Name length
m.Name = stringsupport.SJISToUTF8(bf.ReadNullTerminatedBytes())
return nil
}
// Build builds a binary packet from the current data.
func (m *MsgMhfCreateJoint) Build(bf *byteframe.ByteFrame, ctx *clientctx.ClientContext) error {
func (m *MsgMhfCreateJoint) Build(bf *byteframe.ByteFrame) error {
return errors.New("NOT IMPLEMENTED")
}

View File

@@ -1,11 +1,10 @@
package mhfpacket
import (
"errors"
import (
"errors"
"erupe-ce/network/clientctx"
"erupe-ce/network"
"erupe-ce/common/byteframe"
"erupe-ce/utils/byteframe"
)
// MsgMhfCreateMercenary represents the MSG_MHF_CREATE_MERCENARY
@@ -19,12 +18,12 @@ func (m *MsgMhfCreateMercenary) Opcode() network.PacketID {
}
// Parse parses the packet from binary
func (m *MsgMhfCreateMercenary) Parse(bf *byteframe.ByteFrame, ctx *clientctx.ClientContext) error {
func (m *MsgMhfCreateMercenary) Parse(bf *byteframe.ByteFrame) error {
m.AckHandle = bf.ReadUint32()
return nil
}
// Build builds a binary packet from the current data.
func (m *MsgMhfCreateMercenary) Build(bf *byteframe.ByteFrame, ctx *clientctx.ClientContext) error {
func (m *MsgMhfCreateMercenary) Build(bf *byteframe.ByteFrame) error {
return errors.New("NOT IMPLEMENTED")
}

View File

@@ -1,11 +1,10 @@
package mhfpacket
import (
"errors"
import (
"errors"
"erupe-ce/network/clientctx"
"erupe-ce/network"
"erupe-ce/common/byteframe"
"erupe-ce/utils/byteframe"
)
// MsgMhfDebugPostValue represents the MSG_MHF_DEBUG_POST_VALUE
@@ -17,11 +16,11 @@ func (m *MsgMhfDebugPostValue) Opcode() network.PacketID {
}
// Parse parses the packet from binary
func (m *MsgMhfDebugPostValue) Parse(bf *byteframe.ByteFrame, ctx *clientctx.ClientContext) error {
func (m *MsgMhfDebugPostValue) Parse(bf *byteframe.ByteFrame) error {
return errors.New("NOT IMPLEMENTED")
}
// Build builds a binary packet from the current data.
func (m *MsgMhfDebugPostValue) Build(bf *byteframe.ByteFrame, ctx *clientctx.ClientContext) error {
func (m *MsgMhfDebugPostValue) Build(bf *byteframe.ByteFrame) error {
return errors.New("NOT IMPLEMENTED")
}

View File

@@ -1,15 +1,13 @@
package mhfpacket
import (
"errors"
"erupe-ce/network"
"erupe-ce/network/clientctx"
"erupe-ce/common/byteframe"
"erupe-ce/utils/byteframe"
)
// MsgMhfDisplayedAchievement represents the MSG_MHF_DISPLAYED_ACHIEVEMENT
type MsgMhfDisplayedAchievement struct {
Unk0 uint8
}
type MsgMhfDisplayedAchievement struct{}
// Opcode returns the ID associated with this packet type.
func (m *MsgMhfDisplayedAchievement) Opcode() network.PacketID {
@@ -17,13 +15,12 @@ func (m *MsgMhfDisplayedAchievement) Opcode() network.PacketID {
}
// Parse parses the packet from binary
func (m *MsgMhfDisplayedAchievement) Parse(bf *byteframe.ByteFrame, ctx *clientctx.ClientContext) error {
m.Unk0 = bf.ReadUint8()
func (m *MsgMhfDisplayedAchievement) Parse(bf *byteframe.ByteFrame) error {
bf.ReadUint8() // Zeroed
return nil
}
// Build builds a binary packet from the current data.
func (m *MsgMhfDisplayedAchievement) Build(bf *byteframe.ByteFrame, ctx *clientctx.ClientContext) error {
bf.WriteUint8(m.Unk0)
return nil
func (m *MsgMhfDisplayedAchievement) Build(bf *byteframe.ByteFrame) error {
return errors.New("NOT IMPLEMENTED")
}

Some files were not shown because too many files have changed in this diff Show More