Merge remote-tracking branch 'origin/main' into feature/restore-history

This commit is contained in:
straticspaff
2023-09-27 21:14:24 +01:00
547 changed files with 29511 additions and 6877 deletions

2
.gitattributes vendored Normal file
View File

@@ -0,0 +1,2 @@
# Auto detect text files and perform LF normalization
* text=auto

21
.github/ISSUE_TEMPLATE/bug.md vendored Normal file
View File

@@ -0,0 +1,21 @@
---
name: Bug
about: Bug
title: ''
labels: bug
assignees: ''
---
**Description**:
A clear and concise description of what the bug is.
**Reproduction Steps**:
1.
2.
**Screenshots**
If applicable, add screenshots to help explain your problem.
**Additional context**
Add any other context about the problem here.

17
.github/ISSUE_TEMPLATE/feature.md vendored Normal file
View File

@@ -0,0 +1,17 @@
---
name: Feature
about: Feature
title: ''
labels: enhancement
assignees: ''
---
**Is your feature request related to an existing issue?**
A clear and concise description of what the problem is. Ex. I'm always frustrated when [...]
**Describe the solution you'd like**
A clear and concise description of what you want to happen.
**Additional context**
Add any other context or screenshots about the feature request here.

45
.github/workflows/go.yml vendored Normal file
View File

@@ -0,0 +1,45 @@
name: Build
on: [push]
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Set up Go
uses: actions/setup-go@v3
with:
go-version: '1.21'
- name: Build Linux-amd64
run: env GOOS=linux GOARCH=amd64 go build -v
- name: Upload Linux-amd64 artifacts
uses: actions/upload-artifact@v3
with:
name: Linux-amd64
path: |
./erupe-ce
./config.json
./www/
./savedata/
./bin/
./bundled-schema/
- name: Build Windows-amd64
run: env GOOS=windows GOARCH=amd64 go build -v
- name: Upload Windows-amd64 artifacts
uses: actions/upload-artifact@v3
with:
name: Windows-amd64
path: |
./erupe-ce.exe
./config.json
./www/
./savedata/
./bin/
./bundled-schema/

14
.gitignore vendored
View File

@@ -1,13 +1,9 @@
www/tw/
www/jp/
.idea/
www/jp/
vendor/
bin/*.bin
bin/quests/*.bin
bin/questlists/*.bin
bin/scenarios/*.bin
bin/debug/*.bin
savedata/
Erupe.exe
*.bin
savedata/*/
*.exe
*.lnk
*.bat

View File

@@ -1,6 +1,6 @@
The MIT License (MIT)
Copyright (c) 2019 The Erupe Developers
Copyright (c) 2019 The Erupe Developers, The Erupe Developers from Einherjar Team, ZeruLight
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal

220
README.md
View File

@@ -1,89 +1,147 @@
# Erupe
## WARNING
This project is in its infancy and has no reliable active developer, no documentation, and no support.
This project has been solely developed in my spare time for the educational experience of making a server emulator, which I haven't done before. Expectations regarding functionally and code quality should be set accordingly.
## Client Compatiblity
### Platforms
- PC
- PlayStation 3
- PlayStation Vita
- Wii U (Up to Z2)
### Versions
- ZZ
- Z2
- Z1
# General info
Currently allows a JP MHF client (with GameGuard removed) to:
* Login and register an account (registration is automatic if account doesn't exist)
* Create a character
* Get ingame to the main city
* See other players walk around
* Do quests* (Single player only. Only quests shipped with the game are on the counter. **Requires binary quest files not in the repo**)
* Use (local) chat*
## Setup
\* = Very limited or buggy.
If you are only looking to install Erupe, please use [a pre-compiled binary](https://github.com/ZeruLight/Erupe/releases/latest).
If you want to modify or compile Erupe yourself, please read on.
## Requirements
- [Go](https://go.dev/dl/)
- [PostgreSQL](https://www.postgresql.org/download/)
## Installation
1. Bring up a fresh database by using the [backup file attached with the latest release](https://github.com/ZeruLight/Erupe/releases/latest/download/SCHEMA.sql).
2. Run each script under [patch-schema](./patch-schema) as they introduce newer schema.
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.
## Resources
- [Quest and Scenario Binary Files](https://files.catbox.moe/xf0l7w.7z)
- [PewPewDojo Discord](https://discord.gg/CFnzbhQ)
## Configuration
This portion of the documentation goes over the `config.json` file.
### General Configuration
| Variable | Description | Default | Options |
|------------------------|-------------------------------------------------------------------------------------------------------------------------------------------------------|-----------|---------------------------------|
| Host | The IP or host address the server is running from | 127.0.0.1 | |
| BinPath | The bin path folder is where you place files needed for various parts of the game such as scenario and quest files | bin | |
| Language | This is the language the server will run in. Only English `en` and Japanese `ja` are available, if you wish to contribute to tranlation, get in touch | en | en/jp |
| DisableSoftCrash | | false | |
| HideLoginNotice | This hides the notices that appear on login from `LoginNotices` | true | |
| LoginNotices | This is where you place notices for users, you can have multiple notices | | |
| PatchServerManifest | | | |
| PatchServerFile | | | |
| ScreenshotAPIURL | This is the URL you want user sreenshots to go to | | |
| DeleteOnSaveCorruption | This option deletes a users save from the database if they corrupt it, can be used as punishment for cheaters | false | |
| ClientMode | This tells the server what client version it should target | ZZ | Check compatible versions above |
| DevMode | This enables DevModeOptions to be configured | true | |
### `DevModeOptions` Configuraiton
| Variable | Description | Default | Options |
|----------------------|---------------------------------------------------------------------------------------------|----------|----------------------------------|
| AutoCreateAccount | This allows users that don't exist to auto create there account from initial login | true | |
| CleanDB | This cleans the database down | false | |
| MaxLauncherHR | This sets the launcher value to HR7 to allow you to break World HR requirements | false | |
| LogInboundMessages | This will allow inbound messages to be logged to stdout | false | |
| LogOutboundMessages | This will allow outbound messages to be logged to stdout | false | |
| MaxHexdumpLength | This is the maximum amount of hex bytes that will be dumped to stdout | 0 | |
| DivaEvent | This overrides the Diva event stage in game | 2 | 0/1/2/3/-1 |
| FestaEvent | This overrides the Hunter Festival event stage in game | 2 | 0/1/2/3/-1 |
| TournamentEvent | This overrides the Hunter Tournament event stage in game | 2 | 0/1/2/3/-1 |
| MezFesEvent | Enables whether the MezFes event & World are active | true | |
| MezFesAlt | Switches the multiplayer MezFes event | false | |
| DisableTokenCheck | This disables the random token that is generated at login from being checked, very insecure | false | |
| QuestDebugTools | Enable various quest debug logs | false | |
| EarthStatusOverride | Enables Pallone Fest, Tower and Conquest War events | 0 | 2=Conquest, 11=Pallone, 21=Tower |
| EarthIDOverride | A random event ID | 0 | |
| EarthMonsterOverride | Sets the ID of the monster targeted in the Conquest War | 0 | |
| SaveDumps.Enables | Enables save dumps to a folder that is set at `SaveDumps.OutputDir` | true | |
| SaveDumps.OutputDir | The folder that save dumps are saved to | savedata | |
### `GameplayOptions` Configuraiton
| Variable | Description | Default | Options |
|----------------------|-----------------------------------------------------------------------------|---------|---------|
| FeaturedWeapons | Number of Active Feature weapons to generate daily | 0 | |
| MaximumNP | Maximum number of NP held by a player | 100000 | |
| MaximumRP | Maximum number of RP held by a player | 100000 | |
| DisableLoginBoost | Disables the Login Boost system | false | |
| DisableBoostTime | Disables the daily NetCafe Boost Time | false | |
| BoostTimeDuration | The number of minutes NetCafe Boost Time lasts for | 120 | |
| GuildMealDuration | The number of minutes a Guild Meal can be activated for after cooking | 60 | |
| BonusQuestAllowance | Number of Bonus Point Quests to allow daily | 3 | |
| DailyQuestAllowance | Number of Daily Quests to allow daily | 1 | |
| MezfesSoloTickets | Number of solo tickets given weekly | 10 | |
| MezfesGroupTickets | Number of group tickets given weekly | 4 | |
| GUrgentRate | Adjusts the rate of G Urgent quests spawning | 10 | |
| GCPMultiplier | Adjusts the multiplier of GCP rewarded for quest completion | 1.00 | |
| GRPMultiplier | Adjusts the multiplier of G Rank Points rewarded for quest completion | 1.00 | |
| GSRPMultiplier | Adjusts the multiplier of G Skill Rank Points rewarded for quest completion | 1.00 | |
| GZennyMultiplier | Adjusts the multiplier of G Zenny rewarded for quest completion | 1.00 | |
| MaterialMultiplier | Adjusts the multiplier of Monster Materials rewarded for quest completion | 1.00 | |
| ExtraCarves | Grant n extra chances to carve ALL carcasses | 0 | |
| DisableHunterNavi | Disables the Hunter Navi | false | |
| EnableHiganjimaEvent | Enables the Higanjima event in the Rasta Bar | false | |
| EnableNierEvent | Enables the Nier event in the Rasta Bar | false | |
| DisableRoad | Disables the Hunting Road | false | |
### Discord
There is limited Discord capability in Erupe. The feature allows you to replay messages from your server into a channel.
This may be either be removed or revamped in a future version.
### Commands
There are several chat commands that can be turned on and off. Most of them are really for admins or debugging purposes.
| Name | command | Description | Options |
|----------|----------------|--------------------------------------------|---------------------|
| Rights | !rights VALUE | Sets the rights integer for your account | |
| Teleport | !tele X,Y | Teleports user to specific x,y coordinate | |
| Reload | !reload | Reloads all users and character objects | |
| KeyQuest | !kqf FLAGS | Sets the Key Quest Flag for your character | |
| Course | !course OPTION | Enables/Disables a course for your account | HL,EX,Premium,Boost |
| PSN | !psn USERNAME | Links the specified PSN to your account | |
### Ravi Sub Commands
| Name | command | Description |
|----------|----------------------------------|-------------------------------|
| Raviente | !ravi start | Starts Ravi Event |
| Raviente | !ravi cm / !ravi checkmultiplier | Checks Ravi Damage Multiplier |
| Raviente | !ravi ss | Send Sedation Support |
| Raviente | !ravi sr | Send Resurrection Support |
| Raviente | !ravi rs | Request Sedation Support |
## World `Entries` config
# Installation
## Server
1. Clone the repo with `git clone https://github.com/Andoryuuta/Erupe.git`
2. Install PostgreSQL
3. Launch psql shell, `CREATE DATABASE erupe;`.
4. Setup database with golang-migrate:
| Config Item | Description | Options |
|-------------|------------------|------------------------------------------------------------|
| Type | Server type. | 1=Normal, 2=Cities, 3=Newbie, 4=Tavern, 5=Return, 6=MezFes |
| Season | Server activity. | 0=Green/Breeding, 1=Orange/Warm, 2=Blue/Cold |
Windows:
```
> go get -tags 'postgres' -u github.com/golang-migrate/migrate/v4/cmd/migrate/
> set POSTGRESQL_URL=postgres://postgres:password@localhost:5432/erupe?sslmode=disable
> cd erupe
> migrate -database %POSTGRESQL_URL% -path migrations up
```
Linux:
```
> go get -tags 'postgres' -u github.com/golang-migrate/migrate/v4/cmd/migrate/
> export POSTGRESQL_URL=postgres://postgres:password@localhost:5432/erupe?sslmode=disable
> cd erupe
> migrate -database $POSTGRESQL_URL -path migrations up
```
(Replacing `postgres:password` with your postgres username and password)
5. Edit the config.json
Namely:
* Update the database username and password
* Update the `host_ip` and `ip` fields (there are multiple) to your external IP if you are hosting for multiple clients.
6. Place quest/scenario binaries.
The quest and scenario binary files should be placed in `bin/quests/` and `bin/scenarios` respectively.
## Launcher
Erupe ships with a rudimentary custom launcher, so you don't need to obtain the original TW/JP files to simply get ingame. However, it does still support using the original files if you choose to. To set this up, place a copy of the original launcher html/js/css in `./www/tw/`, and `/www/jp/` for the TW and JP files respectively.
Then, modify the the `/launcher/js/launcher.js` file as such:
* Find the call to `startUpdateProcess();` in a case statement and replace it with `finishUpdateProcess();`. (This disables the file check and updating)
* (JP ONLY): replace all uses of "https://" with "http://" in the file.
Finally, edit the config.json and set `UseOriginalLauncherFiles` to `true` under the launcher settings.
# Usage
### Note: If you are switching to/from the custom launcher html, you will have to clear your IE cache @ `C:\Users\<user>\AppData\Local\Microsoft\Windows\INetCache`.
## Server
```
cd Erupe
go run .
```
## Client
Add to hosts:
```
127.0.0.1 mhfg.capcom.com.tw
127.0.0.1 mhf-n.capcom.com.tw
127.0.0.1 cog-members.mhf-z.jp
127.0.0.1 www.capcom-onlinegames.jp
127.0.0.1 srv-mhf.capcom-networks.jp
```
Run mhf.exe normally (with locale emulator or appropriate timezone).
### `Recommend`
This sets the types of quest that can be ordered from a world.
* 0 = All quests
* 1 = Up to 2 star quests
* 2 = Up to 4 star quests
* 4 = All Quests in HR (Enables G Experience Tab)
* 5 = Only G rank quests
* 6 = Mini games world there is no place to order quests

0
bin/.gitkeep Normal file
View File

0
bin/events/.gitkeep Normal file
View File

0
bin/quests/.gitkeep Normal file
View File

2372
bin/quests/desktop.ini Normal file

File diff suppressed because it is too large Load Diff

0
bin/scenarios/.gitkeep Normal file
View File

View File

@@ -0,0 +1,45 @@
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
(8,5,1,30,10,0,0,0,0,10,0,0),
(8,5,2,60,10,0,0,0,0,10,0,0),
(8,5,3,60,10,0,0,0,0,10,0,0),
(8,5,4,30,10,0,0,0,0,10,0,0),
(8,5,5,60,10,0,0,0,0,10,0,0),
(8,5,6,80,10,0,0,0,1,10,0,0),
(8,5,7,80,10,0,0,0,1,10,0,0),
(8,5,8,80,10,0,0,0,1,10,0,0),
(8,5,9,100,10,0,0,0,2,10,0,0),
(8,5,10,100,10,0,0,0,2,10,0,0),
(8,5,11,100,10,0,0,0,2,10,0,0),
(8,5,12,100,10,0,0,0,2,10,0,0),
(8,5,13,100,10,0,0,0,2,10,0,0),
(8,5,14,200,10,0,0,0,2,10,0,0),
(8,5,15,500,10,0,0,0,3,10,0,0),
(8,5,16,1000,10,0,0,0,3,10,0,0),
(8,5,20,30,10,0,0,0,0,10,0,0),
(8,5,21,30,10,0,0,0,0,10,0,0),
(8,5,22,60,10,0,0,0,0,10,0,0),
(8,5,23,60,10,0,0,0,0,10,0,0),
(8,5,24,60,10,0,0,0,0,10,0,0),
(8,5,25,80,10,0,0,0,1,10,0,0),
(8,5,26,80,10,0,0,0,1,10,0,0),
(8,5,27,500,10,0,0,1,3,10,0,0),
(8,5,28,60,10,0,0,0,0,10,0,0),
(8,5,29,60,10,299,0,0,0,10,0,0),
(8,5,30,100,10,0,0,1,3,10,0,0),
(8,5,31,80,10,299,0,0,1,10,0,0),
(8,5,32,80,10,299,0,0,1,10,0,0),
(8,5,33,80,10,299,0,0,1,10,0,0),
(8,7,2209,400,1,299,0,0,2,5,0,0),
(8,7,2208,400,1,299,0,0,2,5,0,0),
(8,7,5113,400,1,299,0,0,2,5,0,0),
(8,7,3571,400,1,299,0,0,2,5,0,0),
(8,7,3572,400,1,299,0,0,2,5,0,0),
(8,7,3738,400,1,299,0,0,2,5,0,0),
(8,7,3737,400,1,299,0,0,2,5,0,0),
(8,7,4399,400,1,299,0,0,2,5,0,0);
END;

View File

@@ -0,0 +1,292 @@
BEGIN;
-- Ripped quests
INSERT INTO public.event_quests (max_players, quest_type, quest_id, mark) VALUES
(0,9,40060,0),
(0,9,40079,0),
(0,9,40080,0),
(0,9,40081,0),
(0,9,40133,0),
(0,9,40134,0),
(0,9,40135,0),
(0,9,40136,0),
(0,9,40137,0),
(0,9,40138,0),
(0,9,40142,0),
(0,9,40143,0),
(0,9,40161,0),
(0,9,40162,0),
(4,9,40173,0),
(4,9,40174,0),
(0,9,40201,0),
(0,9,40218,0),
(4,43,40236,1),
(4,28,40241,1),
(0,8,50534,0),
(4,18,50852,1),
(4,18,50940,1),
(4,18,51024,1),
(4,18,51025,1),
(4,18,51026,1),
(4,18,51027,1),
(4,38,51052,9),
(4,38,51053,9),
(4,18,51059,1),
(4,38,51107,9),
(4,24,51125,0),
(1,24,51126,0),
(4,24,51127,0),
(4,24,51128,0),
(4,24,51129,0),
(4,26,53034,1),
(4,18,53140,1),
(4,18,53187,1),
(4,18,53201,1),
(1,18,53253,1),
(4,26,53307,1),
(4,24,53314,0),
(4,24,53315,0),
(4,24,53316,0),
(4,24,53317,0),
(4,24,53318,0),
(4,24,53319,0),
(4,24,53320,0),
(4,24,53321,0),
(4,24,53324,0),
(1,18,53326,2),
(4,31,54244,0),
(0,8,54425,0),
(4,28,54449,1),
(4,28,54593,1),
(4,28,54594,1),
(4,28,54603,1),
(4,28,54604,1),
(4,28,54605,1),
(4,28,54606,1),
(1,28,54608,0),
(1,28,54609,0),
(32,40,54751,0),
(32,40,54752,0),
(32,40,54753,0),
(32,40,54754,0),
(32,40,54755,0),
(32,40,54756,0),
(32,40,54757,0),
(32,40,54758,0),
(32,40,54759,0),
(32,40,54760,0),
(32,40,54761,0),
(4,28,54801,0),
(4,28,55002,1),
(4,28,55195,0),
(4,28,55202,0),
(4,28,55203,0),
(4,28,55204,0),
(0,8,55369,0),
(4,28,55464,1),
(4,43,55513,1),
(4,28,55529,0),
(4,28,55532,0),
(1,28,55536,0),
(1,28,55537,0),
(32,50,55596,0),
(32,50,55597,0),
(32,50,55598,0),
(32,50,55599,0),
(32,50,55601,0),
(32,50,55602,0),
(32,50,55603,0),
(32,50,55604,0),
(32,50,55605,0),
(32,50,55606,0),
(32,50,55607,0),
(4,28,55619,0),
(4,28,55670,1),
(4,39,55679,9),
(4,39,55680,9),
(4,43,55691,1),
(4,43,55692,1),
(4,43,55693,1),
(4,43,55694,1),
(4,43,55695,1),
(4,43,55696,1),
(4,43,55697,1),
(4,43,55698,1),
(1,43,55728,1),
(4,43,55738,1),
(0,8,55767,0),
(0,8,55768,0),
(4,28,55771,1),
(4,39,55772,9),
(8,51,55796,0),
(8,51,55797,0),
(8,51,55798,0),
(8,51,55799,0),
(8,51,55801,0),
(8,51,55802,0),
(8,51,55803,0),
(8,51,55804,0),
(8,51,55805,0),
(8,51,55806,0),
(8,51,55807,0),
(1,28,55808,0),
(0,8,55870,0),
(0,8,55872,0),
(0,8,55879,0),
(0,8,55880,0),
(0,8,55881,0),
(0,8,55882,0),
(4,28,55896,1),
(0,8,55897,0),
(0,8,55899,0),
(0,8,55901,0),
(0,8,55902,0),
(0,8,55903,0),
(0,8,55904,0),
(0,8,55905,0),
(0,8,55906,0),
(0,8,55907,0),
(0,8,55908,0),
(0,8,55909,0),
(0,8,55910,0),
(0,8,55911,0),
(0,8,55912,0),
(4,39,55916,9),
(4,39,55917,9),
(4,39,55918,9),
(4,39,55919,9),
(4,28,55920,0),
(4,39,55921,9),
(4,39,55922,9),
(4,43,55923,1),
(4,43,55924,1),
(4,43,55925,1),
(4,43,55926,1),
(4,43,55929,1),
(4,43,55930,1),
(4,43,55931,1),
(4,43,55932,1),
(4,28,55935,0),
(4,28,55936,0),
(4,28,55937,0),
(4,28,55938,0),
(4,28,55939,0),
(4,28,55948,0),
(4,28,55949,0),
(4,28,55950,0),
(4,28,55951,0),
(1,28,55963,0),
(4,28,55964,1),
(4,28,55967,1),
(4,43,56042,1),
(4,43,56056,1),
(4,43,56058,1),
(4,43,56059,1),
(4,43,56063,1),
(4,43,56064,1),
(4,43,56076,4),
(4,43,56077,4),
(4,43,56078,4),
(4,43,56079,4),
(4,43,56080,4),
(4,43,56125,1),
(4,24,56134,0),
(4,24,56135,0),
(4,24,56138,0),
(4,24,56139,0),
(4,24,56141,0),
(4,24,56142,0),
(4,28,56143,1),
(4,43,56144,1),
(4,43,56145,1),
(0,8,56146,0),
(4,28,56147,1),
(4,24,56148,0),
(1,24,56149,0),
(4,43,56150,1),
(4,43,56151,1),
(4,43,56154,1),
(4,43,56155,1),
(4,43,56156,1),
(4,28,56157,1),
(1,28,56158,1),
(4,28,56159,1),
(4,48,58043,1),
(4,46,58050,0),
(4,46,58051,0),
(4,46,58052,0),
(4,46,58053,0),
(4,46,58054,0),
(4,46,58055,0),
(4,46,58056,0),
(4,46,58057,0),
(4,46,58058,0),
(4,46,58059,0),
(4,46,58060,0),
(4,46,58061,0),
(4,46,58062,0),
(4,46,58063,0),
(4,46,58064,0),
(4,46,58065,0),
(4,46,58066,0),
(4,46,58067,0),
(4,46,58068,0),
(4,46,58069,0),
(4,46,58070,0),
(4,46,58071,0),
(4,46,58072,0),
(4,46,58074,0),
(4,46,58075,0),
(4,46,58076,0),
(4,46,58077,0),
(4,46,58078,0),
(4,47,58079,0),
(4,47,58080,0),
(4,47,58081,0),
(4,47,58082,0),
(4,47,58083,0),
(4,46,58088,0),
(4,46,58089,0),
(4,46,58090,0),
(4,46,58091,0),
(4,46,58096,0),
(4,46,58097,0),
(4,46,58098,0),
(4,46,58099,0),
(4,46,58101,0),
(4,46,58102,1),
(4,46,58103,1),
(4,46,58104,1),
(4,46,58105,1),
(4,46,58106,1),
(4,46,58107,1),
(4,46,58108,1),
(4,46,58109,1),
(4,46,58112,1),
(4,46,58113,1),
(4,46,58114,1),
(4,46,58115,1),
(4,46,58118,0),
(4,46,58119,0),
(4,46,58120,0),
(4,46,58121,0),
(4,46,58122,0),
(4,46,58123,0),
(4,46,58125,1),
(4,46,58126,1),
(4,46,58127,1),
(4,46,58128,1),
(4,13,61050,0),
(4,13,61051,0),
(4,13,61053,0),
(4,13,61055,0),
(2,13,61067,0),
(4,13,61068,0),
(2,13,61070,0),
(4,13,61071,0),
(8,22,62101,0),
(8,16,62104,0),
(8,16,62105,0),
(8,16,62108,0),
(1,18,62910,1);
END;

View File

@@ -0,0 +1,391 @@
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

@@ -0,0 +1,260 @@
BEGIN;
-- Ripped prizes
INSERT INTO public.festa_prizes
(type, tier, souls_req, item_id, num_item)
VALUES
('personal', 1, 1, 9647, 7),
('personal', 2, 1, 9647, 7),
('personal', 3, 1, 9647, 7),
('personal', 1, 200, 11284, 4),
('personal', 2, 200, 11284, 4),
('personal', 3, 200, 11284, 4),
('personal', 1, 400, 11381, 3),
('personal', 2, 400, 11381, 3),
('personal', 3, 400, 11381, 3),
('personal', 1, 600, 11284, 8),
('personal', 2, 600, 11284, 8),
('personal', 3, 600, 11284, 8),
('personal', 1, 800, 11384, 3),
('personal', 2, 800, 11384, 3),
('personal', 3, 800, 11384, 3),
('personal', 1, 1000, 11284, 12),
('personal', 2, 1000, 11284, 12),
('personal', 3, 1000, 11284, 12),
('personal', 1, 1200, 11381, 5),
('personal', 2, 1200, 11381, 5),
('personal', 3, 1200, 11381, 5),
('personal', 1, 1400, 11284, 16),
('personal', 2, 1400, 11284, 16),
('personal', 3, 1400, 11284, 16),
('personal', 1, 1700, 11384, 5),
('personal', 2, 1700, 11384, 5),
('personal', 3, 1700, 11384, 5),
('personal', 1, 2000, 11284, 16),
('personal', 2, 2000, 11284, 16),
('personal', 3, 2000, 11284, 16),
('personal', 1, 2500, 11382, 4),
('personal', 2, 2500, 11382, 4),
('personal', 3, 2500, 11382, 4),
('personal', 1, 3000, 11284, 24),
('personal', 2, 3000, 11284, 24),
('personal', 3, 3000, 11284, 24),
('personal', 1, 4000, 11385, 4),
('personal', 2, 4000, 11385, 4),
('personal', 3, 4000, 11385, 4),
('personal', 1, 5000, 11381, 11),
('personal', 2, 5000, 11381, 11),
('personal', 3, 5000, 11381, 11),
('personal', 1, 6000, 5177, 5),
('personal', 2, 6000, 5177, 5),
('personal', 3, 6000, 5177, 5),
('personal', 1, 7000, 11384, 11),
('personal', 2, 7000, 11384, 11),
('personal', 3, 7000, 11384, 11),
('personal', 1, 10000, 11382, 8),
('personal', 2, 10000, 11382, 8),
('personal', 3, 10000, 11382, 8),
('personal', 1, 15000, 11385, 4),
('personal', 2, 15000, 11385, 4),
('personal', 3, 15000, 11385, 4),
('personal', 1, 20000, 11381, 13),
('personal', 2, 20000, 11381, 13),
('personal', 3, 20000, 11381, 13),
('personal', 1, 25000, 11385, 4),
('personal', 2, 25000, 11385, 4),
('personal', 3, 25000, 11385, 4),
('personal', 1, 30000, 11383, 1),
('personal', 2, 30000, 11383, 1),
('personal', 3, 30000, 11383, 1);
INSERT INTO public.festa_prizes
(type, tier, souls_req, item_id, num_item)
VALUES
('guild', 1, 100, 7468, 5),
('guild', 2, 100, 7468, 5),
('guild', 3, 100, 7465, 5),
('guild', 1, 300, 7469, 5),
('guild', 2, 300, 7469, 5),
('guild', 3, 300, 7466, 5),
('guild', 1, 700, 7470, 5),
('guild', 2, 700, 7470, 5),
('guild', 3, 700, 7467, 5),
('guild', 1, 1500, 13405, 14),
('guild', 1, 1500, 1520, 3),
('guild', 2, 1500, 13405, 14),
('guild', 2, 1500, 1520, 3),
('guild', 3, 1500, 7011, 3),
('guild', 3, 1500, 13405, 14),
('guild', 1, 3000, 10201, 10),
('guild', 2, 3000, 10201, 10),
('guild', 3, 3000, 10201, 10),
('guild', 1, 6000, 13895, 14),
('guild', 1, 6000, 1520, 6),
('guild', 2, 6000, 13895, 14),
('guild', 2, 6000, 1520, 6),
('guild', 3, 6000, 13895, 14),
('guild', 3, 6000, 7011, 4),
('guild', 1, 12000, 13406, 14),
('guild', 1, 12000, 1520, 9),
('guild', 2, 12000, 13406, 14),
('guild', 2, 12000, 1520, 9),
('guild', 3, 12000, 13406, 14),
('guild', 3, 12000, 7011, 5),
('guild', 1, 25000, 10207, 10),
('guild', 2, 25000, 10207, 10),
('guild', 3, 25000, 10207, 10),
('guild', 1, 50000, 1520, 12),
('guild', 1, 50000, 13896, 14),
('guild', 2, 50000, 1520, 12),
('guild', 2, 50000, 13896, 14),
('guild', 3, 50000, 7011, 6),
('guild', 3, 50000, 13896, 14),
('guild', 1, 100000, 10201, 10),
('guild', 2, 100000, 10201, 10),
('guild', 3, 100000, 10201, 10),
('guild', 1, 200000, 13406, 16),
('guild', 2, 200000, 13406, 16),
('guild', 3, 200000, 13406, 16),
('guild', 1, 300000, 13896, 16),
('guild', 2, 300000, 13896, 16),
('guild', 3, 300000, 13896, 16),
('guild', 1, 400000, 10207, 10),
('guild', 2, 400000, 10207, 10),
('guild', 3, 400000, 10207, 10),
('guild', 1, 500000, 13407, 6),
('guild', 1, 500000, 13897, 6),
('guild', 2, 500000, 13407, 6),
('guild', 2, 500000, 13897, 6),
('guild', 3, 500000, 13407, 6),
('guild', 3, 500000, 13897, 6);
-- Ripped trials
INSERT INTO public.festa_trials
(objective, goal_id, times_req, locale_req, reward)
VALUES
(1,27,1,0,1),
(5,53034,0,0,400),
(5,22042,0,0,89),
(5,23397,0,0,89),
(1,28,1,0,1),
(1,68,1,0,1),
(1,6,1,0,2),
(1,38,1,0,2),
(1,20,1,0,3),
(1,39,1,0,4),
(1,48,1,0,4),
(1,67,1,0,4),
(1,93,1,0,4),
(1,22,1,0,5),
(1,52,1,0,5),
(1,101,1,0,5),
(1,1,1,0,5),
(1,37,1,0,5),
(1,15,1,0,5),
(1,45,1,0,5),
(1,74,1,0,5),
(1,78,1,0,5),
(1,103,1,0,5),
(1,51,1,0,6),
(1,17,1,0,6),
(1,21,1,0,6),
(1,92,1,0,6),
(1,47,1,0,7),
(1,46,1,0,7),
(1,26,1,0,7),
(1,14,1,0,7),
(1,11,1,0,7),
(1,44,1,0,8),
(1,43,1,0,8),
(1,49,1,0,8),
(1,40,1,0,8),
(1,76,1,0,8),
(1,89,1,0,8),
(1,94,1,0,8),
(1,96,1,0,8),
(1,75,1,0,8),
(1,91,1,0,8),
(1,53,1,0,9),
(1,80,1,0,9),
(1,42,1,0,9),
(1,79,1,0,9),
(1,81,1,0,10),
(1,41,1,0,10),
(1,82,1,0,10),
(1,90,1,0,10),
(1,149,1,0,10),
(1,85,1,0,11),
(1,95,1,0,11),
(1,121,1,0,11),
(1,142,1,0,11),
(1,141,1,0,11),
(1,146,1,0,12),
(1,147,1,0,12),
(1,148,1,0,12),
(1,151,1,0,12),
(1,152,1,0,12),
(1,159,1,0,12),
(1,153,1,0,12),
(1,162,1,0,12),
(1,111,1,0,13),
(1,110,1,0,13),
(1,112,1,0,13),
(1,109,1,0,14),
(1,169,1,0,15),
(2,33,1,0,6),
(2,104,1,0,8),
(2,119,1,0,8),
(2,120,1,0,8),
(2,54,1,0,8),
(2,59,1,0,8),
(2,64,1,0,8),
(2,65,1,0,8),
(2,99,1,0,9),
(2,83,1,0,9),
(2,84,1,0,10),
(2,77,1,0,10),
(2,106,1,0,10),
(2,55,1,0,10),
(2,58,1,0,10),
(2,7,1,0,10),
(2,50,1,0,11),
(2,131,1,0,11),
(2,129,1,0,11),
(2,140,1,0,11),
(2,122,1,0,11),
(2,126,1,0,11),
(2,127,1,0,11),
(2,128,1,0,11),
(2,130,1,0,11),
(2,139,1,0,11),
(2,144,1,0,11),
(2,150,1,0,11),
(2,158,1,0,11),
(2,164,1,0,15),
(2,165,1,0,15),
(2,2,1,7,15),
(2,36,1,0,15),
(2,71,1,0,15),
(2,108,1,0,15),
(2,116,1,0,15),
(2,107,1,0,15),
(2,154,1,0,17),
(2,166,1,0,17),
(2,170,1,0,18),
(3,31,1,0,1),
(3,8,1,0,3),
(3,123,1,0,8),
(3,105,1,0,9),
(3,125,1,0,11),
(3,115,1,0,12),
(3,114,1,0,12),
(3,161,1,0,12),
(4,670,1,0,1),
(4,671,1,0,1),
(4,672,1,0,1),
(4,675,1,0,1),
(4,673,1,0,1),
(4,674,1,0,1);
END;

View File

@@ -0,0 +1,102 @@
BEGIN;
-- Start Normal Demo
INSERT INTO gacha_shop (min_gr, min_hr, name, url_banner, url_feature, url_thumbnail, wide, recommended, gacha_type, hidden)
VALUES (0, 0, 'Normal Demo',
'http://img4.imagetitan.com/img4/QeRWNAviFD8UoTx/26/26_template_innerbanner.png',
'http://img4.imagetitan.com/img4/QeRWNAviFD8UoTx/26/26_template_feature.png',
'http://img4.imagetitan.com/img4/small/26/26_template_outerbanner.png',
false, false, 0, false);
-- Create two different 'rolls', the first rolls once for 1z, the second rolls eleven times for 10z
INSERT INTO gacha_entries (gacha_id, entry_type, item_type, item_number, item_quantity, weight, rarity, rolls, daily_limit, frontier_points)
VALUES
((SELECT id FROM gacha_shop ORDER BY id DESC LIMIT 1), 0, 10, 1, 0, 0, 0, 1, 0, 0),
((SELECT id FROM gacha_shop ORDER BY id DESC LIMIT 1), 1, 10, 10, 0, 0, 0, 11, 0, 0);
-- Creates a prize of 1z with a weighted chance of 100
INSERT INTO gacha_entries (gacha_id, entry_type, item_type, item_number, item_quantity, weight, rarity, rolls, daily_limit, frontier_points)
VALUES ((SELECT id FROM gacha_shop ORDER BY id DESC LIMIT 1), 100, 0, 0, 0, 100, 0, 0, 0, 0);
INSERT INTO gacha_items (entry_id, item_type, item_id, quantity)
VALUES ((SELECT id FROM gacha_entries ORDER BY id DESC LIMIT 1), 10, 1, 0);
-- Creates a prize of 2z with a weighted chance of 70
INSERT INTO gacha_entries (gacha_id, entry_type, item_type, item_number, item_quantity, weight, rarity, rolls, daily_limit, frontier_points)
VALUES ((SELECT id FROM gacha_shop ORDER BY id DESC LIMIT 1), 100, 0, 0, 0, 70, 1, 0, 0, 0);
INSERT INTO gacha_items (entry_id, item_type, item_id, quantity)
VALUES ((SELECT id FROM gacha_entries ORDER BY id DESC LIMIT 1), 10, 2, 0);
-- Creates a prize of 3z with a weighted chance of 10
INSERT INTO gacha_entries (gacha_id, entry_type, item_type, item_number, item_quantity, weight, rarity, rolls, daily_limit, frontier_points)
VALUES ((SELECT id FROM gacha_shop ORDER BY id DESC LIMIT 1), 100, 0, 0, 0, 10, 2, 0, 0, 0);
INSERT INTO gacha_items (entry_id, item_type, item_id, quantity)
VALUES ((SELECT id FROM gacha_entries ORDER BY id DESC LIMIT 1), 10, 3, 0);
-- End Normal Demo
-- Start Step-Up Demo
INSERT INTO gacha_shop (min_gr, min_hr, name, url_banner, url_feature, url_thumbnail, wide, recommended, gacha_type, hidden)
VALUES (0, 0, 'Step-Up Demo', '', '', '', false, false, 1, false);
-- Create two 'steps', the first costs 1z, the second costs 2z
-- The first step has zero rolls so it will only give the prizes directly linked to the entry ID, being 1z
INSERT INTO gacha_entries (gacha_id, entry_type, item_type, item_number, item_quantity, weight, rarity, rolls, daily_limit, frontier_points)
VALUES ((SELECT id FROM gacha_shop ORDER BY id DESC LIMIT 1), 0, 10, 1, 0, 0, 0, 0, 0, 0);
INSERT INTO gacha_items (entry_id, item_type, item_id, quantity)
VALUES ((SELECT id FROM gacha_entries ORDER BY id DESC LIMIT 1), 10, 1, 0);
-- The second step has one roll on the random prize list as will as the direct prize, being 3z
INSERT INTO gacha_entries (gacha_id, entry_type, item_type, item_number, item_quantity, weight, rarity, rolls, daily_limit, frontier_points)
VALUES ((SELECT id FROM gacha_shop ORDER BY id DESC LIMIT 1), 1, 10, 2, 0, 0, 0, 1, 0, 0);
INSERT INTO gacha_items (entry_id, item_type, item_id, quantity)
VALUES ((SELECT id FROM gacha_entries ORDER BY id DESC LIMIT 1), 10, 3, 0);
-- Set up two random prizes, the first gives 1z, the second gives 2z
INSERT INTO gacha_entries (gacha_id, entry_type, item_type, item_number, item_quantity, weight, rarity, rolls, daily_limit, frontier_points)
VALUES ((SELECT id FROM gacha_shop ORDER BY id DESC LIMIT 1), 100, 0, 0, 0, 100, 0, 0, 0, 0);
INSERT INTO gacha_items (entry_id, item_type, item_id, quantity)
VALUES ((SELECT id FROM gacha_entries ORDER BY id DESC LIMIT 1), 10, 1, 0);
INSERT INTO gacha_entries (gacha_id, entry_type, item_type, item_number, item_quantity, weight, rarity, rolls, daily_limit, frontier_points)
VALUES ((SELECT id FROM gacha_shop ORDER BY id DESC LIMIT 1), 100, 0, 0, 0, 90, 1, 0, 0, 0);
INSERT INTO gacha_items (entry_id, item_type, item_id, quantity)
VALUES ((SELECT id FROM gacha_entries ORDER BY id DESC LIMIT 1), 10, 2, 0);
-- End Step-Up Demo
-- Start Box Demo
INSERT INTO gacha_shop (min_gr, min_hr, name, url_banner, url_feature, url_thumbnail, wide, recommended, gacha_type, hidden)
VALUES (0, 0, 'Box Demo', '', '', '', false, false, 4, false);
-- Create two different 'rolls', the first rolls once for 1z, the second rolls twice for 2z
INSERT INTO gacha_entries (gacha_id, entry_type, item_type, item_number, item_quantity, weight, rarity, rolls, daily_limit, frontier_points)
VALUES
((SELECT id FROM gacha_shop ORDER BY id DESC LIMIT 1), 0, 10, 1, 0, 0, 0, 1, 0, 0),
((SELECT id FROM gacha_shop ORDER BY id DESC LIMIT 1), 1, 10, 2, 0, 0, 0, 2, 0, 0);
-- Create five different 'Box' items, weight is always 0 for these
INSERT INTO gacha_entries (gacha_id, entry_type, item_type, item_number, item_quantity, weight, rarity, rolls, daily_limit, frontier_points)
VALUES ((SELECT id FROM gacha_shop ORDER BY id DESC LIMIT 1), 100, 0, 0, 0, 0, 0, 0, 0, 0);
INSERT INTO gacha_items (entry_id, item_type, item_id, quantity)
VALUES ((SELECT id FROM gacha_entries ORDER BY id DESC LIMIT 1), 10, 1, 0);
INSERT INTO gacha_entries (gacha_id, entry_type, item_type, item_number, item_quantity, weight, rarity, rolls, daily_limit, frontier_points)
VALUES ((SELECT id FROM gacha_shop ORDER BY id DESC LIMIT 1), 100, 0, 0, 0, 0, 0, 0, 0, 0);
INSERT INTO gacha_items (entry_id, item_type, item_id, quantity)
VALUES ((SELECT id FROM gacha_entries ORDER BY id DESC LIMIT 1), 10, 1, 0);
INSERT INTO gacha_entries (gacha_id, entry_type, item_type, item_number, item_quantity, weight, rarity, rolls, daily_limit, frontier_points)
VALUES ((SELECT id FROM gacha_shop ORDER BY id DESC LIMIT 1), 100, 0, 0, 0, 0, 0, 0, 0, 0);
INSERT INTO gacha_items (entry_id, item_type, item_id, quantity)
VALUES ((SELECT id FROM gacha_entries ORDER BY id DESC LIMIT 1), 10, 1, 0);
INSERT INTO gacha_entries (gacha_id, entry_type, item_type, item_number, item_quantity, weight, rarity, rolls, daily_limit, frontier_points)
VALUES ((SELECT id FROM gacha_shop ORDER BY id DESC LIMIT 1), 100, 0, 0, 0, 0, 0, 0, 0, 0);
INSERT INTO gacha_items (entry_id, item_type, item_id, quantity)
VALUES ((SELECT id FROM gacha_entries ORDER BY id DESC LIMIT 1), 10, 2, 0);
INSERT INTO gacha_entries (gacha_id, entry_type, item_type, item_number, item_quantity, weight, rarity, rolls, daily_limit, frontier_points)
VALUES ((SELECT id FROM gacha_shop ORDER BY id DESC LIMIT 1), 100, 0, 0, 0, 0, 0, 0, 0, 0);
INSERT INTO gacha_items (entry_id, item_type, item_id, quantity)
VALUES ((SELECT id FROM gacha_entries ORDER BY id DESC LIMIT 1), 10, 3, 0);
-- End Box Demo
END;

View File

@@ -0,0 +1,13 @@
BEGIN;
INSERT INTO public.cafebonus (time_req, item_type, item_id, quantity)
VALUES
(1800, 17, 0, 250),
(3600, 17, 0, 500),
(7200, 17, 0, 1000),
(10800, 17, 0, 1500),
(18000, 17, 0, 1750),
(28800, 17, 0, 3000),
(43200, 17, 0, 4000);
END;

View File

@@ -0,0 +1,12 @@
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

@@ -0,0 +1,868 @@
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
(10,4,11664,20000,1,0,0,1,1,0,0,0),
(10,4,11665,20000,1,0,0,1,1,0,0,0),
(10,4,11666,20000,1,0,0,1,1,0,0,0),
(10,4,11667,20000,1,0,0,1,1,0,0,0),
(10,4,11668,20000,1,0,0,1,1,0,0,0),
(10,4,11669,20000,1,0,0,1,1,0,0,0),
(10,4,11670,20000,1,0,0,1,1,0,0,0),
(10,4,11671,20000,1,0,0,1,1,0,0,0),
(10,4,11672,20000,1,0,0,1,1,0,0,0),
(10,4,11673,20000,1,0,0,1,1,0,0,0),
(10,4,11674,20000,1,0,0,1,1,0,0,0),
(10,4,11675,20000,1,0,0,1,1,0,0,0),
(10,4,11676,20000,1,0,0,1,1,0,0,0),
(10,4,11677,20000,1,0,0,1,1,0,0,0),
(10,4,11678,20000,1,0,0,1,1,0,0,0),
(10,4,11679,20000,1,0,0,1,1,0,0,0),
(10,4,11680,20000,1,0,0,1,1,0,0,0),
(10,4,11681,20000,1,0,0,1,1,0,0,0),
(10,4,11682,20000,1,0,0,1,1,0,0,0),
(10,4,11683,20000,1,0,0,1,1,0,0,0),
(10,4,11684,20000,1,0,0,1,1,0,0,0),
(10,4,11685,20000,1,0,0,1,1,0,0,0),
(10,4,11686,20000,1,0,0,1,1,0,0,0),
(10,4,11687,20000,1,0,0,1,1,0,0,0),
(10,4,11688,20000,1,0,0,1,1,0,0,0),
(10,4,11689,20000,1,0,0,1,1,0,0,0),
(10,4,11690,20000,1,0,0,1,1,0,0,0),
(10,4,11691,20000,1,0,0,1,1,0,0,0),
(10,4,11692,20000,1,0,0,1,1,0,0,0),
(10,4,11693,20000,1,0,0,1,1,0,0,0),
(10,4,11694,20000,1,0,0,1,1,0,0,0),
(10,4,11695,20000,1,0,0,1,1,0,0,0),
(10,4,11696,20000,1,0,0,1,1,0,0,0),
(10,4,11697,20000,1,0,0,1,1,0,0,0),
(10,4,12893,20000,1,0,0,1,1,0,0,0),
(10,4,12894,20000,1,0,0,1,1,0,0,0),
(10,4,12895,20000,1,0,0,1,1,0,0,0),
(10,4,12896,20000,1,0,0,1,1,0,0,0),
(10,4,12897,20000,1,0,0,1,1,0,0,0),
(10,4,12898,20000,1,0,0,1,1,0,0,0),
(10,4,12899,20000,1,0,0,1,1,0,0,0),
(10,4,14337,20000,1,0,0,1,1,0,0,0),
(10,4,14338,20000,1,0,0,1,1,0,0,0),
(10,4,14339,20000,1,0,0,1,1,0,0,0),
(10,4,14340,20000,1,0,0,1,1,0,0,0),
(10,4,14341,20000,1,0,0,1,1,0,0,0),
(10,4,14342,20000,1,0,0,1,1,0,0,0),
(10,4,14343,20000,1,0,0,1,1,0,0,0),
(10,4,14344,20000,1,0,0,1,1,0,0,0),
(10,4,14345,20000,1,0,0,1,1,0,0,0),
(10,4,9254,10000,1,0,0,1,1,0,0,0),
(10,4,9255,10000,1,0,0,1,1,0,0,0),
(10,4,9256,10000,1,0,0,1,1,0,0,0),
(10,4,9257,10000,1,0,0,1,1,0,0,0),
(10,4,9258,10000,1,0,0,1,1,0,0,0),
(10,4,9259,10000,1,0,0,1,1,0,0,0),
(10,4,9260,10000,1,0,0,1,1,0,0,0),
(10,4,9261,10000,1,0,0,1,1,0,0,0),
(10,4,9262,10000,1,0,0,1,1,0,0,0),
(10,4,9263,10000,1,0,0,1,1,0,0,0),
(10,4,9264,10000,1,0,0,1,1,0,0,0),
(10,4,9265,10000,1,0,0,1,1,0,0,0),
(10,4,9266,10000,1,0,0,1,1,0,0,0),
(10,4,9267,10000,1,0,0,1,1,0,0,0),
(10,4,9268,10000,1,0,0,1,1,0,0,0),
(10,4,9269,10000,1,0,0,1,1,0,0,0),
(10,4,9270,10000,1,0,0,1,1,0,0,0),
(10,4,9271,10000,1,0,0,1,1,0,0,0),
(10,4,9272,10000,1,0,0,1,1,0,0,0),
(10,4,9273,10000,1,0,0,1,1,0,0,0),
(10,4,9274,10000,1,0,0,1,1,0,0,0),
(10,4,9275,10000,1,0,0,1,1,0,0,0),
(10,4,9276,10000,1,0,0,1,1,0,0,0),
(10,4,9277,10000,1,0,0,1,1,0,0,0),
(10,4,9278,10000,1,0,0,1,1,0,0,0),
(10,4,9279,10000,1,0,0,1,1,0,0,0),
(10,4,9280,10000,1,0,0,1,1,0,0,0),
(10,4,9281,10000,1,0,0,1,1,0,0,0),
(10,4,9282,10000,1,0,0,1,1,0,0,0),
(10,4,9283,10000,1,0,0,1,1,0,0,0),
(10,4,9284,10000,1,0,0,1,1,0,0,0),
(10,4,9285,10000,1,0,0,1,1,0,0,0),
(10,4,9286,10000,1,0,0,1,1,0,0,0),
(10,4,9287,10000,1,0,0,1,1,0,0,0),
(10,4,9288,10000,1,0,0,1,1,0,0,0),
(10,4,9289,10000,1,0,0,1,1,0,0,0),
(10,4,9290,10000,1,0,0,1,1,0,0,0),
(10,4,9291,10000,1,0,0,1,1,0,0,0),
(10,4,9292,10000,1,0,0,1,1,0,0,0),
(10,4,9293,10000,1,0,0,1,1,0,0,0),
(10,4,9294,10000,1,0,0,1,1,0,0,0),
(10,4,9295,10000,1,0,0,1,1,0,0,0),
(10,4,9296,10000,1,0,0,1,1,0,0,0),
(10,4,9297,10000,1,0,0,1,1,0,0,0),
(10,4,9298,10000,1,0,0,1,1,0,0,0),
(10,4,9299,10000,1,0,0,1,1,0,0,0),
(10,4,9300,10000,1,0,0,1,1,0,0,0),
(10,4,9301,10000,1,0,0,1,1,0,0,0),
(10,4,13196,10000,1,0,0,1,1,0,0,0),
(10,4,13197,10000,1,0,0,1,1,0,0,0),
(10,4,13198,10000,1,0,0,1,1,0,0,0),
(10,4,13199,10000,1,0,0,1,1,0,0,0),
(10,4,15542,10000,1,0,0,1,1,0,0,0),
(10,4,15543,10000,1,0,0,1,1,0,0,0),
(10,4,15544,10000,1,0,0,1,1,0,0,0),
(10,4,15545,10000,1,0,0,1,1,0,0,0),
(10,4,13640,20000,1,0,0,1,1,0,0,0),
(10,4,13641,20000,1,0,0,1,1,0,0,0),
(10,4,13642,20000,1,0,0,1,1,0,0,0),
(10,4,13643,20000,1,0,0,1,1,0,0,0),
(10,4,13644,20000,1,0,0,1,1,0,0,0),
(10,4,13645,20000,1,0,0,1,1,0,0,0),
(10,4,13646,20000,1,0,0,1,1,0,0,0),
(10,4,13647,20000,1,0,0,1,1,0,0,0),
(10,4,13648,20000,1,0,0,1,1,0,0,0),
(10,4,13649,20000,1,0,0,1,1,0,0,0),
(10,4,13650,20000,1,0,0,1,1,0,0,0),
(10,4,13651,20000,1,0,0,1,1,0,0,0),
(10,4,13652,20000,1,0,0,1,1,0,0,0),
(10,4,13653,20000,1,0,0,1,1,0,0,0),
(10,4,13654,20000,1,0,0,1,1,0,0,0),
(10,4,13655,20000,1,0,0,1,1,0,0,0),
(10,4,13656,20000,1,0,0,1,1,0,0,0),
(10,4,13657,20000,1,0,0,1,1,0,0,0),
(10,4,13658,20000,1,0,0,1,1,0,0,0),
(10,4,13659,20000,1,0,0,1,1,0,0,0),
(10,4,13660,20000,1,0,0,1,1,0,0,0),
(10,4,13661,20000,1,0,0,1,1,0,0,0),
(10,4,13662,20000,1,0,0,1,1,0,0,0),
(10,4,13663,20000,1,0,0,1,1,0,0,0),
(10,4,13664,20000,1,0,0,1,1,0,0,0),
(10,4,13665,20000,1,0,0,1,1,0,0,0),
(10,4,13666,20000,1,0,0,1,1,0,0,0),
(10,4,13667,20000,1,0,0,1,1,0,0,0),
(10,4,13668,20000,1,0,0,1,1,0,0,0),
(10,4,13669,20000,1,0,0,1,1,0,0,0),
(10,4,13670,20000,1,0,0,1,1,0,0,0),
(10,4,13671,20000,1,0,0,1,1,0,0,0),
(10,4,13672,20000,1,0,0,1,1,0,0,0),
(10,4,13673,20000,1,0,0,1,1,0,0,0),
(10,4,13674,20000,1,0,0,1,1,0,0,0),
(10,4,13675,20000,1,0,0,1,1,0,0,0),
(10,4,13676,20000,1,0,0,1,1,0,0,0),
(10,4,13677,20000,1,0,0,1,1,0,0,0),
(10,4,13678,20000,1,0,0,1,1,0,0,0),
(10,4,13679,20000,1,0,0,1,1,0,0,0),
(10,4,13680,20000,1,0,0,1,1,0,0,0),
(10,4,13681,20000,1,0,0,1,1,0,0,0),
(10,4,13682,20000,1,0,0,1,1,0,0,0),
(10,4,13683,20000,1,0,0,1,1,0,0,0),
(10,4,13684,20000,1,0,0,1,1,0,0,0),
(10,4,13685,20000,1,0,0,1,1,0,0,0),
(10,4,13686,20000,1,0,0,1,1,0,0,0),
(10,4,13687,20000,1,0,0,1,1,0,0,0),
(10,4,13688,20000,1,0,0,1,1,0,0,0),
(10,4,13689,20000,1,0,0,1,1,0,0,0),
(10,4,13690,20000,1,0,0,1,1,0,0,0),
(10,4,13691,20000,1,0,0,1,1,0,0,0),
(10,4,15546,20000,1,0,0,1,1,0,0,0),
(10,4,15547,20000,1,0,0,1,1,0,0,0),
(10,4,15548,20000,1,0,0,1,1,0,0,0),
(10,4,15549,20000,1,0,0,1,1,0,0,0),
(10,4,16162,35000,1,0,0,1,1,0,0,0),
(10,4,16163,35000,1,0,0,1,1,0,0,0),
(10,4,16164,35000,1,0,0,1,1,0,0,0),
(10,4,16165,35000,1,0,0,1,1,0,0,0),
(10,4,16166,35000,1,0,0,1,1,0,0,0),
(10,4,16167,35000,1,0,0,1,1,0,0,0),
(10,4,16168,35000,1,0,0,1,1,0,0,0),
(10,4,16169,35000,1,0,0,1,1,0,0,0),
(10,4,16172,35000,1,0,0,1,1,0,0,0),
(10,4,16173,35000,1,0,0,1,1,0,0,0),
(10,4,16174,35000,1,0,0,1,1,0,0,0),
(10,4,16175,35000,1,0,0,1,1,0,0,0),
(10,4,16176,35000,1,0,0,1,1,0,0,0),
(10,4,16177,35000,1,0,0,1,1,0,0,0),
(10,4,16178,35000,1,0,0,1,1,0,0,0),
(10,4,16179,35000,1,0,0,1,1,0,0,0),
(10,4,16182,35000,1,0,0,1,1,0,0,0),
(10,4,16183,35000,1,0,0,1,1,0,0,0),
(10,4,16184,35000,1,0,0,1,1,0,0,0),
(10,4,16185,35000,1,0,0,1,1,0,0,0),
(10,4,16186,35000,1,0,0,1,1,0,0,0),
(10,4,16187,35000,1,0,0,1,1,0,0,0),
(10,4,16188,35000,1,0,0,1,1,0,0,0),
(10,4,16189,35000,1,0,0,1,1,0,0,0),
(10,4,16192,35000,1,0,0,1,1,0,0,0),
(10,4,16193,35000,1,0,0,1,1,0,0,0),
(10,4,16194,35000,1,0,0,1,1,0,0,0),
(10,4,16195,35000,1,0,0,1,1,0,0,0),
(10,4,16196,35000,1,0,0,1,1,0,0,0),
(10,4,16197,35000,1,0,0,1,1,0,0,0),
(10,4,16198,35000,1,0,0,1,1,0,0,0),
(10,4,16199,35000,1,0,0,1,1,0,0,0),
(10,4,16202,35000,1,0,0,1,1,0,0,0),
(10,4,16203,35000,1,0,0,1,1,0,0,0),
(10,4,16204,35000,1,0,0,1,1,0,0,0),
(10,4,16205,35000,1,0,0,1,1,0,0,0),
(10,4,16206,35000,1,0,0,1,1,0,0,0),
(10,4,16207,35000,1,0,0,1,1,0,0,0),
(10,4,16208,35000,1,0,0,1,1,0,0,0),
(10,4,16209,35000,1,0,0,1,1,0,0,0),
(10,4,16212,35000,1,0,0,1,1,0,0,0),
(10,4,16213,35000,1,0,0,1,1,0,0,0),
(10,4,16214,35000,1,0,0,1,1,0,0,0),
(10,4,16215,35000,1,0,0,1,1,0,0,0),
(10,4,16216,35000,1,0,0,1,1,0,0,0),
(10,4,16217,35000,1,0,0,1,1,0,0,0),
(10,4,16218,35000,1,0,0,1,1,0,0,0),
(10,4,16219,35000,1,0,0,1,1,0,0,0),
(10,4,16222,35000,1,0,0,1,1,0,0,0),
(10,4,16223,35000,1,0,0,1,1,0,0,0),
(10,4,16224,35000,1,0,0,1,1,0,0,0),
(10,4,16225,35000,1,0,0,1,1,0,0,0),
(10,4,16226,35000,1,0,0,1,1,0,0,0),
(10,4,16227,35000,1,0,0,1,1,0,0,0),
(10,4,16228,35000,1,0,0,1,1,0,0,0),
(10,4,16229,35000,1,0,0,1,1,0,0,0),
(10,4,16232,35000,1,0,0,1,1,0,0,0),
(10,4,16233,35000,1,0,0,1,1,0,0,0),
(10,4,16234,35000,1,0,0,1,1,0,0,0),
(10,4,16235,35000,1,0,0,1,1,0,0,0),
(10,4,16236,35000,1,0,0,1,1,0,0,0),
(10,4,16237,35000,1,0,0,1,1,0,0,0),
(10,4,16238,35000,1,0,0,1,1,0,0,0),
(10,4,16239,35000,1,0,0,1,1,0,0,0),
(10,4,16242,35000,1,0,0,1,1,0,0,0),
(10,4,16243,35000,1,0,0,1,1,0,0,0),
(10,4,16244,35000,1,0,0,1,1,0,0,0),
(10,4,16245,35000,1,0,0,1,1,0,0,0),
(10,4,16246,35000,1,0,0,1,1,0,0,0),
(10,4,16247,35000,1,0,0,1,1,0,0,0),
(10,4,16248,35000,1,0,0,1,1,0,0,0),
(10,4,16249,35000,1,0,0,1,1,0,0,0),
(10,4,16252,35000,1,0,0,1,1,0,0,0),
(10,4,16253,35000,1,0,0,1,1,0,0,0),
(10,4,16254,35000,1,0,0,1,1,0,0,0),
(10,4,16255,35000,1,0,0,1,1,0,0,0),
(10,4,16256,35000,1,0,0,1,1,0,0,0),
(10,4,16257,35000,1,0,0,1,1,0,0,0),
(10,4,16258,35000,1,0,0,1,1,0,0,0),
(10,4,16259,35000,1,0,0,1,1,0,0,0),
(10,4,16262,35000,1,0,0,1,1,0,0,0),
(10,4,16263,35000,1,0,0,1,1,0,0,0),
(10,4,16264,35000,1,0,0,1,1,0,0,0),
(10,4,16265,35000,1,0,0,1,1,0,0,0),
(10,4,16266,35000,1,0,0,1,1,0,0,0),
(10,4,16267,35000,1,0,0,1,1,0,0,0),
(10,4,16268,35000,1,0,0,1,1,0,0,0),
(10,4,16269,35000,1,0,0,1,1,0,0,0),
(10,4,16272,35000,1,0,0,1,1,0,0,0),
(10,4,16273,35000,1,0,0,1,1,0,0,0),
(10,4,16274,35000,1,0,0,1,1,0,0,0),
(10,4,16275,35000,1,0,0,1,1,0,0,0),
(10,4,16276,35000,1,0,0,1,1,0,0,0),
(10,4,16277,35000,1,0,0,1,1,0,0,0),
(10,4,16278,35000,1,0,0,1,1,0,0,0),
(10,4,16279,35000,1,0,0,1,1,0,0,0),
(10,4,16282,35000,1,0,0,1,1,0,0,0),
(10,4,16283,35000,1,0,0,1,1,0,0,0),
(10,4,16284,35000,1,0,0,1,1,0,0,0),
(10,4,16285,35000,1,0,0,1,1,0,0,0),
(10,4,16286,35000,1,0,0,1,1,0,0,0),
(10,4,16287,35000,1,0,0,1,1,0,0,0),
(10,4,16288,35000,1,0,0,1,1,0,0,0),
(10,4,16289,35000,1,0,0,1,1,0,0,0),
(10,4,16292,35000,1,0,0,1,1,0,0,0),
(10,4,16293,35000,1,0,0,1,1,0,0,0),
(10,4,16294,35000,1,0,0,1,1,0,0,0),
(10,4,16295,35000,1,0,0,1,1,0,0,0),
(10,4,16296,35000,1,0,0,1,1,0,0,0),
(10,4,16297,35000,1,0,0,1,1,0,0,0),
(10,4,16298,35000,1,0,0,1,1,0,0,0),
(10,4,16299,35000,1,0,0,1,1,0,0,0),
(10,8,14136,15000,1,0,0,1,1,0,0,0),
(10,8,14137,15000,1,0,0,1,1,0,0,0),
(10,8,14138,15000,1,0,0,1,1,0,0,0),
(10,8,14139,15000,1,0,0,1,1,0,0,0),
(10,8,14140,15000,1,0,0,1,1,0,0,0),
(10,8,14141,15000,1,0,0,1,1,0,0,0),
(10,8,14142,15000,1,0,0,1,1,0,0,0),
(10,8,14143,15000,1,0,0,1,1,0,0,0),
(10,8,14144,15000,1,0,0,1,1,0,0,0),
(10,8,14145,15000,1,0,0,1,1,0,0,0),
(10,8,14454,30000,1,0,0,1,1,0,0,0),
(10,8,14455,30000,1,0,0,1,1,0,0,0),
(10,8,14456,30000,1,0,0,1,1,0,0,0),
(10,8,14457,30000,1,0,0,1,1,0,0,0),
(10,8,14458,30000,1,0,0,1,1,0,0,0),
(10,8,14459,30000,1,0,0,1,1,0,0,0),
(10,8,14460,30000,1,0,0,1,1,0,0,0),
(10,8,14461,30000,1,0,0,1,1,0,0,0),
(10,8,14462,30000,1,0,0,1,1,0,0,0),
(10,8,14463,30000,1,0,0,1,1,0,0,0),
(10,8,12724,50000,1,0,0,1,1,0,0,0),
(10,8,12725,50000,1,0,0,1,1,0,0,0),
(10,8,12726,50000,1,0,0,1,1,0,0,0),
(10,8,12727,50000,1,0,0,1,1,0,0,0),
(10,8,12728,50000,1,0,0,1,1,0,0,0),
(10,8,12729,50000,1,0,0,1,1,0,0,0),
(10,8,12730,50000,1,0,0,1,1,0,0,0),
(10,8,12731,50000,1,0,0,1,1,0,0,0),
(10,8,12732,50000,1,0,0,1,1,0,0,0),
(10,8,12733,50000,1,0,0,1,1,0,0,0),
(10,8,12734,50000,1,0,0,1,1,0,0,0),
(10,8,12735,50000,1,0,0,1,1,0,0,0),
(10,8,12736,50000,1,0,0,1,1,0,0,0),
(10,8,12737,50000,1,0,0,1,1,0,0,0),
(10,8,12738,50000,1,0,0,1,1,0,0,0),
(10,8,12739,50000,1,0,0,1,1,0,0,0),
(10,8,12740,50000,1,0,0,1,1,0,0,0),
(10,8,12741,50000,1,0,0,1,1,0,0,0),
(10,8,12742,50000,1,0,0,1,1,0,0,0),
(10,8,12743,50000,1,0,0,1,1,0,0,0),
(10,8,12744,50000,1,0,0,1,1,0,0,0),
(10,8,12745,50000,1,0,0,1,1,0,0,0),
(10,8,12746,50000,1,0,0,1,1,0,0,0),
(10,8,12747,50000,1,0,0,1,1,0,0,0),
(10,8,12748,50000,1,0,0,1,1,0,0,0),
(10,8,12749,50000,1,0,0,1,1,0,0,0),
(10,8,12750,50000,1,0,0,1,1,0,0,0),
(10,8,12751,50000,1,0,0,1,1,0,0,0),
(10,8,12752,50000,1,0,0,1,1,0,0,0),
(10,8,12753,50000,1,0,0,1,1,0,0,0),
(10,8,15070,50000,1,0,0,1,1,0,0,0),
(10,8,15071,50000,1,0,0,1,1,0,0,0),
(10,8,15072,50000,1,0,0,1,1,0,0,0),
(10,8,15073,50000,1,0,0,1,1,0,0,0),
(10,8,15074,50000,1,0,0,1,1,0,0,0),
(10,8,15075,50000,1,0,0,1,1,0,0,0),
(10,8,15076,50000,1,0,0,1,1,0,0,0),
(10,8,15077,50000,1,0,0,1,1,0,0,0),
(10,8,15078,50000,1,0,0,1,1,0,0,0),
(10,8,15079,50000,1,0,0,1,1,0,0,0),
(10,8,15567,20000,1,0,0,1,1,0,0,0),
(10,8,15568,20000,1,0,0,1,1,0,0,0),
(10,8,15569,20000,1,0,0,1,1,0,0,0),
(10,8,15570,20000,1,0,0,1,1,0,0,0),
(10,8,15571,20000,1,0,0,1,1,0,0,0),
(10,8,15572,20000,1,0,0,1,1,0,0,0),
(10,8,15573,20000,1,0,0,1,1,0,0,0),
(10,8,15574,20000,1,0,0,1,1,0,0,0),
(10,8,15575,20000,1,0,0,1,1,0,0,0),
(10,8,15576,20000,1,0,0,1,1,0,0,0),
(10,8,15577,20000,1,0,0,1,1,0,0,0),
(10,8,15578,20000,1,0,0,1,1,0,0,0),
(10,8,15579,20000,1,0,0,1,1,0,0,0),
(10,8,15580,20000,1,0,0,1,1,0,0,0),
(10,8,15581,20000,1,0,0,1,1,0,0,0),
(10,8,15582,20000,1,0,0,1,1,0,0,0),
(10,8,15583,20000,1,0,0,1,1,0,0,0),
(10,8,15584,20000,1,0,0,1,1,0,0,0),
(10,8,15585,20000,1,0,0,1,1,0,0,0),
(10,8,15586,20000,1,0,0,1,1,0,0,0),
(10,8,15587,20000,1,0,0,1,1,0,0,0),
(10,8,15588,20000,1,0,0,1,1,0,0,0),
(10,8,15589,20000,1,0,0,1,1,0,0,0),
(10,8,15590,20000,1,0,0,1,1,0,0,0),
(10,8,15591,20000,1,0,0,1,1,0,0,0),
(10,8,15592,20000,1,0,0,1,1,0,0,0),
(10,8,15593,20000,1,0,0,1,1,0,0,0),
(10,8,15594,20000,1,0,0,1,1,0,0,0),
(10,8,15595,20000,1,0,0,1,1,0,0,0),
(10,8,15596,20000,1,0,0,1,1,0,0,0),
(10,8,15597,20000,1,0,0,1,1,0,0,0),
(10,8,15598,20000,1,0,0,1,1,0,0,0),
(10,8,15599,20000,1,0,0,1,1,0,0,0),
(10,8,15600,20000,1,0,0,1,1,0,0,0),
(10,8,15601,20000,1,0,0,1,1,0,0,0),
(10,8,15602,20000,1,0,0,1,1,0,0,0),
(10,8,15603,20000,1,0,0,1,1,0,0,0),
(10,8,15604,20000,1,0,0,1,1,0,0,0),
(10,8,15605,20000,1,0,0,1,1,0,0,0),
(10,8,15606,20000,1,0,0,1,1,0,0,0),
(10,8,15607,20000,1,0,0,1,1,0,0,0),
(10,8,15608,20000,1,0,0,1,1,0,0,0),
(10,8,15609,20000,1,0,0,1,1,0,0,0),
(10,8,15610,20000,1,0,0,1,1,0,0,0),
(10,8,15611,20000,1,0,0,1,1,0,0,0),
(10,8,15612,20000,1,0,0,1,1,0,0,0),
(10,8,15613,20000,1,0,0,1,1,0,0,0),
(10,8,15614,20000,1,0,0,1,1,0,0,0),
(10,8,15615,20000,1,0,0,1,1,0,0,0),
(10,8,15616,20000,1,0,0,1,1,0,0,0),
(10,8,15617,20000,1,0,0,1,1,0,0,0),
(10,8,15618,20000,1,0,0,1,1,0,0,0),
(10,8,15619,20000,1,0,0,1,1,0,0,0),
(10,8,15620,20000,1,0,0,1,1,0,0,0),
(10,8,15621,20000,1,0,0,1,1,0,0,0),
(10,8,15622,20000,1,0,0,1,1,0,0,0),
(10,8,15623,20000,1,0,0,1,1,0,0,0),
(10,8,15624,20000,1,0,0,1,1,0,0,0),
(10,8,15625,20000,1,0,0,1,1,0,0,0),
(10,8,15626,20000,1,0,0,1,1,0,0,0),
(10,8,15627,20000,1,0,0,1,1,0,0,0),
(10,8,15628,20000,1,0,0,1,1,0,0,0),
(10,8,15629,20000,1,0,0,1,1,0,0,0),
(10,8,15630,20000,1,0,0,1,1,0,0,0),
(10,8,15631,20000,1,0,0,1,1,0,0,0),
(10,8,15632,20000,1,0,0,1,1,0,0,0),
(10,8,15633,20000,1,0,0,1,1,0,0,0),
(10,8,15634,20000,1,0,0,1,1,0,0,0),
(10,8,15635,20000,1,0,0,1,1,0,0,0),
(10,8,15636,20000,1,0,0,1,1,0,0,0),
(10,8,15637,20000,1,0,0,1,1,0,0,0),
(10,8,15638,20000,1,0,0,1,1,0,0,0),
(10,8,15639,20000,1,0,0,1,1,0,0,0),
(10,8,15640,20000,1,0,0,1,1,0,0,0),
(10,8,15641,20000,1,0,0,1,1,0,0,0),
(10,8,15642,20000,1,0,0,1,1,0,0,0),
(10,8,15643,20000,1,0,0,1,1,0,0,0),
(10,8,15644,20000,1,0,0,1,1,0,0,0),
(10,8,15645,20000,1,0,0,1,1,0,0,0),
(10,8,15646,20000,1,0,0,1,1,0,0,0),
(10,8,15647,20000,1,0,0,1,1,0,0,0),
(10,8,15648,20000,1,0,0,1,1,0,0,0),
(10,8,15649,20000,1,0,0,1,1,0,0,0),
(10,8,15650,20000,1,0,0,1,1,0,0,0),
(10,8,15651,20000,1,0,0,1,1,0,0,0),
(10,8,15652,20000,1,0,0,1,1,0,0,0),
(10,8,15653,20000,1,0,0,1,1,0,0,0),
(10,8,15654,20000,1,0,0,1,1,0,0,0),
(10,8,15655,20000,1,0,0,1,1,0,0,0),
(10,8,15656,20000,1,0,0,1,1,0,0,0),
(10,8,15657,20000,1,0,0,1,1,0,0,0),
(10,8,15658,20000,1,0,0,1,1,0,0,0),
(10,8,15659,20000,1,0,0,1,1,0,0,0),
(10,8,15660,20000,1,0,0,1,1,0,0,0),
(10,8,15661,20000,1,0,0,1,1,0,0,0),
(10,8,15662,20000,1,0,0,1,1,0,0,0),
(10,8,15663,20000,1,0,0,1,1,0,0,0),
(10,8,15664,20000,1,0,0,1,1,0,0,0),
(10,8,15665,20000,1,0,0,1,1,0,0,0),
(10,8,15666,20000,1,0,0,1,1,0,0,0),
(10,8,15667,20000,1,0,0,1,1,0,0,0),
(10,8,15668,20000,1,0,0,1,1,0,0,0),
(10,8,15669,20000,1,0,0,1,1,0,0,0),
(10,8,15670,20000,1,0,0,1,1,0,0,0),
(10,8,15671,20000,1,0,0,1,1,0,0,0),
(10,8,15672,20000,1,0,0,1,1,0,0,0),
(10,8,15673,20000,1,0,0,1,1,0,0,0),
(10,8,15674,20000,1,0,0,1,1,0,0,0),
(10,8,15675,20000,1,0,0,1,1,0,0,0),
(10,8,15676,20000,1,0,0,1,1,0,0,0),
(10,8,15677,20000,1,0,0,1,1,0,0,0),
(10,8,15678,20000,1,0,0,1,1,0,0,0),
(10,8,15679,20000,1,0,0,1,1,0,0,0),
(10,8,15680,20000,1,0,0,1,1,0,0,0),
(10,8,15681,20000,1,0,0,1,1,0,0,0),
(10,8,15682,20000,1,0,0,1,1,0,0,0),
(10,8,15683,20000,1,0,0,1,1,0,0,0),
(10,8,15684,20000,1,0,0,1,1,0,0,0),
(10,8,15685,20000,1,0,0,1,1,0,0,0),
(10,8,15686,20000,1,0,0,1,1,0,0,0),
(10,8,15687,20000,1,0,0,1,1,0,0,0),
(10,8,15688,20000,1,0,0,1,1,0,0,0),
(10,8,15689,20000,1,0,0,1,1,0,0,0),
(10,8,15690,20000,1,0,0,1,1,0,0,0),
(10,8,15691,20000,1,0,0,1,1,0,0,0),
(10,8,15692,20000,1,0,0,1,1,0,0,0),
(10,8,15693,20000,1,0,0,1,1,0,0,0),
(10,8,15694,20000,1,0,0,1,1,0,0,0),
(10,8,15695,20000,1,0,0,1,1,0,0,0),
(10,8,15696,20000,1,0,0,1,1,0,0,0),
(10,8,15697,20000,1,0,0,1,1,0,0,0),
(10,8,15698,20000,1,0,0,1,1,0,0,0),
(10,8,15699,20000,1,0,0,1,1,0,0,0),
(10,8,15700,20000,1,0,0,1,1,0,0,0),
(10,8,15701,20000,1,0,0,1,1,0,0,0),
(10,8,15702,20000,1,0,0,1,1,0,0,0),
(10,8,15703,20000,1,0,0,1,1,0,0,0),
(10,8,15704,20000,1,0,0,1,1,0,0,0),
(10,8,15705,20000,1,0,0,1,1,0,0,0),
(10,8,15706,20000,1,0,0,1,1,0,0,0),
(10,8,15707,20000,1,0,0,1,1,0,0,0),
(10,8,15708,20000,1,0,0,1,1,0,0,0),
(10,8,15709,20000,1,0,0,1,1,0,0,0),
(10,8,15710,20000,1,0,0,1,1,0,0,0),
(10,8,15711,20000,1,0,0,1,1,0,0,0),
(10,8,15712,20000,1,0,0,1,1,0,0,0),
(10,8,15713,20000,1,0,0,1,1,0,0,0),
(10,8,15714,20000,1,0,0,1,1,0,0,0),
(10,8,15715,20000,1,0,0,1,1,0,0,0),
(10,8,15716,20000,1,0,0,1,1,0,0,0),
(10,8,15717,20000,1,0,0,1,1,0,0,0),
(10,8,15718,20000,1,0,0,1,1,0,0,0),
(10,8,15719,20000,1,0,0,1,1,0,0,0),
(10,8,15720,20000,1,0,0,1,1,0,0,0),
(10,8,15721,20000,1,0,0,1,1,0,0,0),
(10,8,15722,20000,1,0,0,1,1,0,0,0),
(10,8,15723,20000,1,0,0,1,1,0,0,0),
(10,8,15724,20000,1,0,0,1,1,0,0,0),
(10,8,15725,20000,1,0,0,1,1,0,0,0),
(10,8,15726,20000,1,0,0,1,1,0,0,0),
(10,8,15727,20000,1,0,0,1,1,0,0,0),
(10,8,15728,20000,1,0,0,1,1,0,0,0),
(10,8,15729,20000,1,0,0,1,1,0,0,0),
(10,8,15730,20000,1,0,0,1,1,0,0,0),
(10,8,15731,20000,1,0,0,1,1,0,0,0),
(10,8,15732,20000,1,0,0,1,1,0,0,0),
(10,8,15733,20000,1,0,0,1,1,0,0,0),
(10,8,15734,20000,1,0,0,1,1,0,0,0),
(10,8,15735,20000,1,0,0,1,1,0,0,0),
(10,8,15736,20000,1,0,0,1,1,0,0,0),
(10,8,15737,20000,1,0,0,1,1,0,0,0),
(10,8,15738,20000,1,0,0,1,1,0,0,0),
(10,8,15739,20000,1,0,0,1,1,0,0,0),
(10,8,15740,20000,1,0,0,1,1,0,0,0),
(10,8,15741,20000,1,0,0,1,1,0,0,0),
(10,8,15742,20000,1,0,0,1,1,0,0,0),
(10,8,15743,20000,1,0,0,1,1,0,0,0),
(10,8,15744,20000,1,0,0,1,1,0,0,0),
(10,8,15745,20000,1,0,0,1,1,0,0,0),
(10,8,15746,20000,1,0,0,1,1,0,0,0),
(10,8,15747,20000,1,0,0,1,1,0,0,0),
(10,8,15748,20000,1,0,0,1,1,0,0,0),
(10,8,15749,20000,1,0,0,1,1,0,0,0),
(10,8,15750,20000,1,0,0,1,1,0,0,0),
(10,8,15751,20000,1,0,0,1,1,0,0,0),
(10,8,15752,20000,1,0,0,1,1,0,0,0),
(10,8,15753,20000,1,0,0,1,1,0,0,0),
(10,8,15754,20000,1,0,0,1,1,0,0,0),
(10,8,15755,20000,1,0,0,1,1,0,0,0),
(10,8,15756,20000,1,0,0,1,1,0,0,0),
(10,8,15757,20000,1,0,0,1,1,0,0,0),
(10,8,15758,20000,1,0,0,1,1,0,0,0),
(10,8,15759,20000,1,0,0,1,1,0,0,0),
(10,8,15760,20000,1,0,0,1,1,0,0,0),
(10,8,15761,20000,1,0,0,1,1,0,0,0),
(10,8,15762,20000,1,0,0,1,1,0,0,0),
(10,8,15763,20000,1,0,0,1,1,0,0,0),
(10,8,15764,20000,1,0,0,1,1,0,0,0),
(10,8,15765,20000,1,0,0,1,1,0,0,0),
(10,8,15766,20000,1,0,0,1,1,0,0,0),
(10,8,15919,20000,1,0,0,1,1,0,0,0),
(10,8,15920,20000,1,0,0,1,1,0,0,0),
(10,8,15921,20000,1,0,0,1,1,0,0,0),
(10,8,15922,20000,1,0,0,1,1,0,0,0),
(10,8,15923,20000,1,0,0,1,1,0,0,0),
(10,8,15924,20000,1,0,0,1,1,0,0,0),
(10,8,15925,20000,1,0,0,1,1,0,0,0),
(10,8,15926,20000,1,0,0,1,1,0,0,0),
(10,8,15927,20000,1,0,0,1,1,0,0,0),
(10,8,15928,20000,1,0,0,1,1,0,0,0),
(10,8,15929,20000,1,0,0,1,1,0,0,0),
(10,8,15930,20000,1,0,0,1,1,0,0,0),
(10,8,15931,20000,1,0,0,1,1,0,0,0),
(10,8,15932,20000,1,0,0,1,1,0,0,0),
(10,8,15933,20000,1,0,0,1,1,0,0,0),
(10,8,15934,20000,1,0,0,1,1,0,0,0),
(10,8,15935,20000,1,0,0,1,1,0,0,0),
(10,8,15936,20000,1,0,0,1,1,0,0,0),
(10,8,15937,20000,1,0,0,1,1,0,0,0),
(10,8,15938,20000,1,0,0,1,1,0,0,0),
(10,8,15939,20000,1,0,0,1,1,0,0,0),
(10,8,15940,20000,1,0,0,1,1,0,0,0),
(10,8,15941,20000,1,0,0,1,1,0,0,0),
(10,8,15942,20000,1,0,0,1,1,0,0,0),
(10,8,15943,20000,1,0,0,1,1,0,0,0),
(10,8,15944,20000,1,0,0,1,1,0,0,0),
(10,8,15945,20000,1,0,0,1,1,0,0,0),
(10,8,15946,20000,1,0,0,1,1,0,0,0),
(10,8,15947,20000,1,0,0,1,1,0,0,0),
(10,8,15948,20000,1,0,0,1,1,0,0,0),
(10,8,15949,20000,1,0,0,1,1,0,0,0),
(10,8,15950,20000,1,0,0,1,1,0,0,0),
(10,8,15951,20000,1,0,0,1,1,0,0,0),
(10,8,15952,20000,1,0,0,1,1,0,0,0),
(10,8,15953,20000,1,0,0,1,1,0,0,0),
(10,8,15954,20000,1,0,0,1,1,0,0,0),
(10,8,15955,20000,1,0,0,1,1,0,0,0),
(10,8,15956,20000,1,0,0,1,1,0,0,0),
(10,8,15957,20000,1,0,0,1,1,0,0,0),
(10,8,15958,20000,1,0,0,1,1,0,0,0),
(10,8,15959,20000,1,0,0,1,1,0,0,0),
(10,8,15960,20000,1,0,0,1,1,0,0,0),
(10,8,15961,20000,1,0,0,1,1,0,0,0),
(10,8,15962,20000,1,0,0,1,1,0,0,0),
(10,8,15963,20000,1,0,0,1,1,0,0,0),
(10,8,15964,20000,1,0,0,1,1,0,0,0),
(10,8,15965,20000,1,0,0,1,1,0,0,0),
(10,8,15966,20000,1,0,0,1,1,0,0,0),
(10,8,15967,20000,1,0,0,1,1,0,0,0),
(10,8,15968,20000,1,0,0,1,1,0,0,0),
(10,7,13506,250,1,0,0,1,1,0,50,0),
(10,7,15011,250,1,0,0,1,1,0,50,0),
(10,7,13636,250,1,0,0,1,1,0,50,0),
(10,7,15022,250,1,0,0,1,1,0,50,0),
(10,8,4407,1000,1,0,0,1,1,0,0,0),
(10,8,4408,1000,1,0,0,1,1,0,0,0),
(10,8,4409,1000,1,0,0,1,1,0,0,0),
(10,8,4410,1000,1,0,0,1,1,0,0,0),
(10,8,4411,1000,1,0,0,1,1,0,0,0),
(10,8,4412,1000,1,0,0,1,1,0,0,0),
(10,8,4413,1000,1,0,0,1,1,0,0,0),
(10,8,4414,1000,1,0,0,1,1,0,0,0),
(10,8,4823,1000,1,0,0,1,1,0,0,0),
(10,8,4824,1000,1,0,0,1,1,0,0,0),
(10,8,4825,1000,1,0,0,1,1,0,0,0),
(10,8,4826,1000,1,0,0,1,1,0,0,0),
(10,8,4827,1000,1,0,0,1,1,0,0,0),
(10,8,4828,1000,1,0,0,1,1,0,0,0),
(10,8,4829,1000,1,0,0,1,1,0,0,0),
(10,8,4830,1000,1,0,0,1,1,0,0,0),
(10,8,5194,1000,1,0,0,1,1,0,0,0),
(10,8,5195,1000,1,0,0,1,1,0,0,0),
(10,8,5196,1000,1,0,0,1,1,0,0,0),
(10,8,5197,1000,1,0,0,1,1,0,0,0),
(10,8,5198,1000,1,0,0,1,1,0,0,0),
(10,8,5199,1000,1,0,0,1,1,0,0,0),
(10,8,5200,1000,1,0,0,1,1,0,0,0),
(10,8,5201,1000,1,0,0,1,1,0,0,0),
(10,8,13630,1000,1,0,0,1,1,0,0,0),
(10,8,13631,1000,1,0,0,1,1,0,0,0),
(10,8,13632,1000,1,0,0,1,1,0,0,0),
(10,8,13633,1000,1,0,0,1,1,0,0,0),
(10,8,13634,1000,1,0,0,1,1,0,0,0),
(10,8,13635,1000,1,0,0,1,1,0,0,0),
(10,8,15103,1000,1,0,0,1,1,0,0,0),
(10,8,15104,1000,1,0,0,1,1,0,0,0),
(10,8,15105,1000,1,0,0,1,1,0,0,0),
(10,8,15106,1000,1,0,0,1,1,0,0,0),
(10,8,15107,1000,1,0,0,1,1,0,0,0),
(10,8,15108,1000,1,0,0,1,1,0,0,0),
(10,8,16459,1000,1,0,0,1,1,0,0,0),
(10,8,16460,1000,1,0,0,1,1,0,0,0),
(10,8,16461,1000,1,0,0,1,1,0,0,0),
(10,8,16462,1000,1,0,0,1,1,0,0,0),
(10,8,16463,1000,1,0,0,1,1,0,0,0),
(10,8,16464,1000,1,0,0,1,1,0,0,0),
(10,8,16465,1000,1,0,0,1,1,0,0,0),
(10,8,16466,1000,1,0,0,1,1,0,0,0),
(10,8,16467,1000,1,0,0,1,1,0,0,0),
(10,8,16468,1000,1,0,0,1,1,0,0,0),
(10,8,16469,1000,1,0,0,1,1,0,0,0),
(10,8,16470,1000,1,0,0,1,1,0,0,0),
(10,8,16471,1000,1,0,0,1,1,0,0,0),
(10,8,16472,1000,1,0,0,1,1,0,0,0),
(10,8,13416,1000,1,0,0,1,1,0,0,0),
(10,8,13417,1000,1,0,0,1,1,0,0,0),
(10,8,13418,1000,1,0,0,1,1,0,0,0),
(10,8,13419,1000,1,0,0,1,1,0,0,0),
(10,8,13420,1000,1,0,0,1,1,0,0,0),
(10,8,14283,1000,1,0,0,1,1,0,0,0),
(10,8,14284,1000,1,0,0,1,1,0,0,0),
(10,8,14285,1000,1,0,0,1,1,0,0,0),
(10,8,14286,1000,1,0,0,1,1,0,0,0),
(10,8,13182,1000,1,0,0,1,1,0,0,0),
(10,8,13507,1000,1,0,0,1,1,0,0,0),
(10,8,13981,1000,1,0,0,1,1,0,0,0),
(10,8,14744,1000,1,0,0,1,1,0,0,0),
(10,8,14893,1000,1,0,0,1,1,0,0,0),
(10,8,15785,1000,1,0,0,1,1,0,0,0),
(10,8,16419,1000,1,0,0,1,1,0,0,0),
(10,8,11470,1000,1,0,0,1,1,0,0,0),
(10,8,12512,1000,1,0,0,1,1,0,0,0),
(10,8,12884,1000,1,0,0,1,1,0,0,0),
(10,8,12513,1000,1,0,0,1,1,0,0,0),
(10,8,12514,1000,1,0,0,1,1,0,0,0),
(10,8,12515,1000,1,0,0,1,1,0,0,0),
(10,8,12516,1000,1,0,0,1,1,0,0,0),
(10,8,12517,1000,1,0,0,1,1,0,0,0),
(10,8,12518,1000,1,0,0,1,1,0,0,0),
(10,8,12519,1000,1,0,0,1,1,0,0,0),
(10,8,12520,1000,1,0,0,1,1,0,0,0),
(10,8,12521,1000,1,0,0,1,1,0,0,0),
(10,8,8179,1000,1,0,0,1,1,0,0,0),
(10,8,9704,1000,1,0,0,1,1,0,0,0),
(10,8,15448,1000,1,0,0,1,1,0,0,0),
(10,8,11162,1000,1,0,0,1,1,0,0,0),
(10,8,11163,1000,1,0,0,1,1,0,0,0),
(10,8,11164,1000,1,0,0,1,1,0,0,0),
(10,8,11165,1000,1,0,0,1,1,0,0,0),
(10,8,11661,1000,1,0,0,1,1,0,0,0),
(10,8,11662,1000,1,0,0,1,1,0,0,0),
(10,8,14639,1000,1,0,0,1,1,0,0,0),
(10,7,15774,3000,1,0,0,1,1,0,100,0),
(10,7,15775,3000,1,0,0,1,1,0,100,0),
(10,7,11420,3000,1,0,0,1,1,0,100,0),
(10,7,14704,3000,1,0,0,1,1,0,100,0),
(10,7,13177,3000,1,0,0,1,1,0,100,0),
(10,7,14191,3000,1,0,0,1,1,0,100,0),
(10,7,13449,3000,1,0,0,1,1,0,100,0),
(10,7,14192,3000,1,0,0,1,1,0,100,0),
(10,7,15772,3000,1,0,0,1,1,0,100,0),
(10,7,13791,3000,1,0,0,1,1,0,100,0),
(10,7,14006,3000,1,0,0,1,1,0,100,0),
(10,7,15768,3000,1,0,0,1,1,0,100,0),
(10,7,14069,3000,1,0,0,1,1,0,100,0),
(10,7,14124,3000,1,0,0,1,1,0,100,0),
(10,7,15507,3000,1,0,0,1,1,0,100,0),
(10,7,15508,3000,1,0,0,1,1,0,100,0),
(10,7,14855,3000,1,0,0,1,1,0,100,0),
(10,7,14894,3000,1,0,0,1,1,0,100,0),
(10,7,16444,3000,1,0,0,1,1,0,100,0),
(10,7,16445,3000,1,0,0,1,1,0,100,0),
(10,7,12509,3000,1,0,0,1,1,0,100,0),
(10,7,14126,3000,1,0,0,1,1,0,100,0),
(10,7,15062,3000,1,0,0,1,1,0,100,0),
(10,7,15063,3000,1,0,0,1,1,0,100,0),
(10,7,14891,3000,1,0,0,1,1,0,100,0),
(10,7,14895,3000,1,0,0,1,1,0,100,0),
(10,7,14091,3000,1,0,0,1,1,0,100,0),
(10,7,14092,3000,1,0,0,1,1,0,100,0),
(10,7,14501,3000,1,0,0,1,1,0,100,0),
(10,7,14506,3000,1,0,0,1,1,0,100,0),
(10,7,15285,3000,1,0,0,1,1,0,100,0),
(10,7,15286,3000,1,0,0,1,1,0,100,0),
(10,7,16442,3000,1,0,0,1,1,0,100,0),
(10,7,16443,3000,1,0,0,1,1,0,100,0),
(10,7,15027,3000,1,0,0,1,1,0,100,0),
(10,7,15028,3000,1,0,0,1,1,0,100,0),
(10,7,13453,3000,1,0,0,1,1,0,100,0),
(10,7,14193,3000,1,0,0,1,1,0,100,0),
(10,7,13178,3000,1,0,0,1,1,0,100,0),
(10,7,14194,3000,1,0,0,1,1,0,100,0),
(10,7,16454,3000,1,0,0,1,1,0,100,0),
(10,7,16455,3000,1,0,0,1,1,0,100,0),
(10,7,15030,3000,1,0,0,1,1,0,100,0),
(10,7,15031,3000,1,0,0,1,1,0,100,0),
(10,7,13790,3000,1,0,0,1,1,0,100,0),
(10,7,14005,3000,1,0,0,1,1,0,100,0),
(10,7,14406,3000,1,0,0,1,1,0,100,0),
(10,7,14413,3000,1,0,0,1,1,0,100,0),
(10,7,16448,3000,1,0,0,1,1,0,100,0),
(10,7,16449,3000,1,0,0,1,1,0,100,0),
(10,7,12872,3000,1,0,0,1,1,0,100,0),
(10,7,14187,3000,1,0,0,1,1,0,100,0),
(10,7,14125,3000,1,0,0,1,1,0,100,0),
(10,7,14500,3000,1,0,0,1,1,0,100,0),
(10,7,14505,3000,1,0,0,1,1,0,100,0),
(10,7,15118,3000,1,0,0,1,1,0,100,0),
(10,7,15119,3000,1,0,0,1,1,0,100,0),
(10,7,14662,3000,1,0,0,1,1,0,100,0),
(10,7,14663,3000,1,0,0,1,1,0,100,0),
(10,7,15771,3000,1,0,0,1,1,0,100,0),
(10,7,9700,3000,1,0,0,1,1,0,100,0),
(10,7,14498,3000,1,0,0,1,1,0,100,0),
(10,7,14913,3000,1,0,0,1,1,0,100,0),
(10,7,14914,3000,1,0,0,1,1,0,100,0),
(10,7,13508,3000,1,0,0,1,1,0,100,0),
(10,7,15115,3000,1,0,0,1,1,0,100,0),
(10,7,15116,3000,1,0,0,1,1,0,100,0),
(10,7,15113,3000,1,0,0,1,1,0,100,0),
(10,7,15114,3000,1,0,0,1,1,0,100,0),
(10,7,15222,3000,1,0,0,1,1,0,100,0),
(10,7,15223,3000,1,0,0,1,1,0,100,0),
(10,7,10750,3000,1,0,0,1,1,0,100,0),
(10,7,14705,3000,1,0,0,1,1,0,100,0),
(10,7,15027,3000,1,0,0,1,1,0,100,0),
(10,7,15028,3000,1,0,0,1,1,0,100,0),
(10,7,10380,3000,1,0,0,1,1,0,100,0),
(10,7,15060,3000,1,0,0,1,1,0,100,0),
(10,7,13963,3000,1,0,0,1,1,0,100,0),
(10,7,14026,3000,1,0,0,1,1,0,100,0),
(10,7,13964,3000,1,0,0,1,1,0,100,0),
(10,7,14027,3000,1,0,0,1,1,0,100,0),
(10,7,15064,3000,1,0,0,1,1,0,100,0),
(10,7,15065,3000,1,0,0,1,1,0,100,0),
(10,7,15524,3000,1,0,0,1,1,0,100,0),
(10,7,15525,3000,1,0,0,1,1,0,100,0),
(10,7,16450,3000,1,0,0,1,1,0,100,0),
(10,7,16451,3000,1,0,0,1,1,0,100,0),
(10,7,16344,3000,1,0,0,1,1,0,100,0),
(10,7,16345,3000,1,0,0,1,1,0,100,0),
(10,7,16342,3000,1,0,0,1,1,0,100,0),
(10,7,16343,3000,1,0,0,1,1,0,100,0),
(10,7,15220,3000,1,0,0,1,1,0,100,0),
(10,7,15221,3000,1,0,0,1,1,0,100,0),
(10,7,15066,3000,1,0,0,1,1,0,100,0),
(10,7,15067,3000,1,0,0,1,1,0,100,0),
(10,7,14089,3000,1,0,0,1,1,0,100,0),
(10,7,14090,3000,1,0,0,1,1,0,100,0),
(10,7,14195,3000,1,0,0,1,1,0,100,0),
(10,7,14196,3000,1,0,0,1,1,0,100,0),
(10,7,13965,3000,1,0,0,1,1,0,100,0),
(10,7,14028,3000,1,0,0,1,1,0,100,0),
(10,7,13508,3000,1,0,0,1,1,0,100,0),
(10,7,13962,3000,1,0,0,1,1,0,100,0),
(10,7,14314,3000,1,0,0,1,1,0,100,0),
(10,7,13404,3000,1,0,0,1,1,0,100,0),
(10,7,14188,3000,1,0,0,1,1,0,100,0),
(10,7,14032,3000,1,0,0,1,1,0,100,0),
(10,7,13960,3000,1,0,0,1,1,0,100,0),
(10,7,15819,3000,1,0,0,1,1,0,100,0),
(10,7,15820,3000,1,0,0,1,1,0,100,0),
(10,7,10750,3000,1,0,0,1,1,0,100,0),
(10,7,14705,3000,1,0,0,1,1,0,100,0),
(10,7,14407,3000,1,0,0,1,1,0,100,0),
(10,7,14414,3000,1,0,0,1,1,0,100,0),
(10,7,16352,3000,1,0,0,1,1,0,100,0),
(10,7,16353,3000,1,0,0,1,1,0,100,0),
(10,7,14502,3000,1,0,0,1,1,0,100,0),
(10,7,14507,3000,1,0,0,1,1,0,100,0),
(10,7,10811,3000,1,0,0,1,1,0,100,0),
(10,7,15061,3000,1,0,0,1,1,0,100,0),
(10,7,15823,3000,1,0,0,1,1,0,100,0),
(10,7,15824,3000,1,0,0,1,1,0,100,0),
(10,7,15224,3000,1,0,0,1,1,0,100,0),
(10,7,15225,3000,1,0,0,1,1,0,100,0),
(10,7,14503,3000,1,0,0,1,1,0,100,0),
(10,7,14510,3000,1,0,0,1,1,0,100,0),
(10,7,15776,3000,1,0,0,1,1,0,100,0),
(10,7,15777,3000,1,0,0,1,1,0,100,0),
(10,7,15821,3000,1,0,0,1,1,0,100,0),
(10,7,15822,3000,1,0,0,1,1,0,100,0),
(10,7,14198,3000,1,0,0,1,1,0,100,0),
(10,7,14197,3000,1,0,0,1,1,0,100,0),
(10,7,16446,3000,1,0,0,1,1,0,100,0),
(10,7,16447,3000,1,0,0,1,1,0,100,0),
(10,7,14905,3000,1,0,0,1,1,0,100,0),
(10,7,14907,3000,1,0,0,1,1,0,100,0),
(10,7,14904,3000,1,0,0,1,1,0,100,0),
(10,7,14906,3000,1,0,0,1,1,0,100,0),
(10,7,14659,3000,1,0,0,1,1,0,100,0),
(10,7,14660,3000,1,0,0,1,1,0,100,0),
(10,7,13326,3000,1,0,0,1,1,0,100,0),
(10,7,14416,3000,1,0,0,1,1,0,100,0),
(10,7,13450,3000,1,0,0,1,1,0,100,0),
(10,7,14031,3000,1,0,0,1,1,0,100,0),
(10,7,16492,3000,1,0,0,1,1,0,100,0),
(10,7,16493,3000,1,0,0,1,1,0,100,0),
(10,7,14299,500,1,0,0,1,1,0,20,0),
(10,7,14389,500,1,0,0,1,1,0,20,0),
(10,7,15177,500,1,0,0,1,1,0,20,0),
(10,7,14537,500,1,0,0,1,1,0,20,0),
(10,7,14758,500,1,0,0,1,1,0,20,0),
(10,7,14854,500,1,0,0,1,1,0,20,0),
(10,7,13974,500,1,0,0,1,1,0,20,0),
(10,7,15021,500,1,0,0,1,1,0,20,0),
(10,7,15111,500,1,0,0,1,1,0,20,0),
(10,7,15226,500,1,0,0,1,1,0,20,0),
(10,7,15773,500,1,0,0,1,1,0,20,0),
(10,7,15825,500,1,0,0,1,1,0,20,0),
(10,7,15827,500,1,0,0,1,1,0,20,0),
(10,7,16340,500,1,0,0,1,1,0,20,0),
(10,7,16341,500,1,0,0,1,1,0,20,0),
(10,7,16457,500,1,0,0,1,1,0,20,0),
(10,7,16458,500,1,0,0,1,1,0,20,0),
(10,7,11698,250,1,0,0,1,1,0,50,0),
(10,7,11700,250,1,0,0,1,1,0,50,0),
(10,8,9958,20,1,0,0,1,1,0,0,999),
(10,8,11284,15,1,0,0,1,1,0,0,0),
(10,8,11285,15,1,0,0,1,1,0,0,0),
(10,8,11286,15,1,0,0,1,1,0,0,0),
(10,8,10356,500,1,0,0,1,1,0,0,0),
(10,8,12511,500,1,0,0,1,1,0,0,0),
(10,8,13238,500,1,0,0,1,1,0,0,0),
(10,8,11383,10,1,0,0,1,1,0,0,0),
(10,8,11382,10,1,0,0,1,1,0,0,0),
(10,8,11381,10,1,0,0,1,1,0,0,0),
(10,7,16348,3000,1,0,0,1,1,0,100,0),
(10,8,11386,10,1,0,0,1,1,0,0,0),
(10,8,14444,10,1,0,0,1,1,0,0,0),
(10,8,14443,10,1,0,0,1,1,0,0,0),
(10,8,14445,10,1,0,0,1,1,0,0,0),
(10,8,15068,500,1,0,0,1,1,0,20,0),
(10,7,16532,1000,1,0,0,1,1,0,0,0),
(10,7,14368,3000,1,0,0,1,1,0,50,0),
(10,7,1622,3000,1,0,0,1,1,0,0,0),
(10,7,16456,500,1,0,0,1,1,0,0,0);
END;

8
common/bfutil/bfutil.go Normal file
View File

@@ -0,0 +1,8 @@
package bfutil
import "bytes"
// UpToNull returns the given byte slice's data, up to (not including) the first null byte.
func UpToNull(data []byte) []byte {
return bytes.SplitN(data, []byte{0x00}, 2)[0]
}

21
common/byteframe/LICENSE Normal file
View File

@@ -0,0 +1,21 @@
The MIT License (MIT)
Copyright (c) 2019 Andrew Gutekanst
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.

View File

@@ -0,0 +1,379 @@
package byteframe
/*
This is HEAVILY based on the code from
https://github.com/sinni800/sgemu/blob/master/Core/Packet.go
*/
import (
"bytes"
"encoding/binary"
"errors"
"io"
"math"
)
// ByteFrame is a struct for reading and writing raw byte data.
type ByteFrame struct {
index uint
usedSize uint
buf []byte
byteOrder binary.ByteOrder
}
// NewByteFrame creates a new ByteFrame with valid default values.
// byteOrder defaults to big endian.
func NewByteFrame() *ByteFrame {
b := &ByteFrame{
index: 0,
usedSize: 0,
buf: make([]byte, 4),
byteOrder: binary.BigEndian,
}
return b
}
// NewByteFrameFromBytes creates a new ByteFrame with valid default values.
// makes a copy of the given buf and initalizes with it.
// byteOrder defaults to big endian.
func NewByteFrameFromBytes(buf []byte) *ByteFrame {
b := &ByteFrame{
index: 0,
usedSize: uint(len(buf)),
buf: make([]byte, len(buf)),
byteOrder: binary.BigEndian,
}
copy(b.buf, buf)
return b
}
// grow either doubles the backing buffer size, or grows it by the size specified, whichever is larger.
func (b *ByteFrame) grow(size uint) {
bytesToAdd := uint(0)
if size > uint(len(b.buf)) {
bytesToAdd = size
} else {
bytesToAdd = uint(len(b.buf))
}
newBuf := make([]byte, uint(len(b.buf))+bytesToAdd)
copy(newBuf, b.buf)
b.buf = newBuf
}
// wcheck checks if we have enough space to write.
func (b *ByteFrame) wcheck(size uint) {
if b.index+size > uint(len(b.buf)) {
b.grow(size)
}
}
// wprologue is a helpler function to update state after a write.
func (b *ByteFrame) wprologue(size uint) {
tmp := int(b.index+size) - int(b.usedSize)
if tmp > 0 {
b.usedSize += uint(tmp)
}
b.index += size
}
// rcheck checks if we have enough data to read.
func (b *ByteFrame) rcheck(size uint) bool {
if b.index+size > uint(len(b.buf)) || b.index+size > b.usedSize+1 {
return false
}
return true
}
func (b *ByteFrame) rprologue(size uint) {
b.index += size
}
func (b *ByteFrame) rerr() {
panic("Error while reading!")
}
// Seek (implements the io.Seeker interface)
func (b *ByteFrame) Seek(offset int64, whence int) (int64, error) {
switch whence {
case io.SeekStart:
if offset > int64(b.usedSize) {
return int64(b.index), errors.New("cannot seek beyond the max index")
}
b.index = uint(offset)
break
case io.SeekCurrent:
newPos := int64(b.index) + offset
if newPos > int64(b.usedSize) {
return int64(b.index), errors.New("cannot seek beyond the max index")
} else if newPos < 0 {
return int64(b.index), errors.New("cannot seek before the buffer start")
}
b.index = uint(newPos)
break
case io.SeekEnd:
newPos := int64(b.usedSize) + offset
if newPos > int64(b.usedSize) {
return int64(b.index), errors.New("cannot seek beyond the max index")
} else if newPos < 0 {
return int64(b.index), errors.New("cannot seek before the buffer start")
}
b.index = uint(newPos)
break
}
return int64(b.index), nil
}
// Data returns the data from the buffer start up to the max index.
func (b *ByteFrame) Data() []byte {
return b.buf[:b.usedSize]
}
// DataFromCurrent returns the data from the current index up to the max index.
func (b *ByteFrame) DataFromCurrent() []byte {
return b.buf[b.index:b.usedSize]
}
func (b *ByteFrame) Index() uint {
return b.index
}
// SetLE sets the byte order to litte endian.
func (b *ByteFrame) SetLE() {
b.byteOrder = binary.LittleEndian
}
// SetBE sets the byte order to big endian.
func (b *ByteFrame) SetBE() {
b.byteOrder = binary.BigEndian
}
// WriteUint8 writes a uint8 at the current index.
func (b *ByteFrame) WriteUint8(x uint8) {
b.wcheck(1)
b.buf[b.index] = x
b.wprologue(1)
}
// WriteBool writes a bool at the current index
// (1 byte. true -> 1, false -> 0)
func (b *ByteFrame) WriteBool(x bool) {
if x {
b.WriteUint8(1)
} else {
b.WriteUint8(0)
}
}
// WriteUint16 writes a uint16 at the current index.
func (b *ByteFrame) WriteUint16(x uint16) {
b.wcheck(2)
b.byteOrder.PutUint16(b.buf[b.index:], x)
b.wprologue(2)
}
// WriteUint32 writes a uint32 at the current index.
func (b *ByteFrame) WriteUint32(x uint32) {
b.wcheck(4)
b.byteOrder.PutUint32(b.buf[b.index:], x)
b.wprologue(4)
}
// WriteUint64 writes a uint64 at the current index.
func (b *ByteFrame) WriteUint64(x uint64) {
b.wcheck(8)
b.byteOrder.PutUint64(b.buf[b.index:], x)
b.wprologue(8)
}
// WriteInt8 writes a int8 at the current index.
func (b *ByteFrame) WriteInt8(x int8) {
b.wcheck(1)
b.buf[b.index] = byte(x)
b.wprologue(1)
}
// WriteInt16 writes a int16 at the current index.
func (b *ByteFrame) WriteInt16(x int16) {
b.wcheck(2)
b.byteOrder.PutUint16(b.buf[b.index:], uint16(x))
b.wprologue(2)
}
// WriteInt32 writes a int32 at the current index.
func (b *ByteFrame) WriteInt32(x int32) {
b.wcheck(4)
b.byteOrder.PutUint32(b.buf[b.index:], uint32(x))
b.wprologue(4)
}
// WriteInt64 writes a int64 at the current index.
func (b *ByteFrame) WriteInt64(x int64) {
b.wcheck(8)
b.byteOrder.PutUint64(b.buf[b.index:], uint64(x))
b.wprologue(8)
}
// WriteFloat32 writes a float32 at the current index.
func (b *ByteFrame) WriteFloat32(x float32) {
b.wcheck(4)
tmp := math.Float32bits(x)
b.byteOrder.PutUint32(b.buf[b.index:], tmp)
b.wprologue(4)
}
// WriteFloat64 writes a float64 at the current index
func (b *ByteFrame) WriteFloat64(x float64) {
b.wcheck(8)
tmp := math.Float64bits(x)
b.byteOrder.PutUint64(b.buf[b.index:], tmp)
b.wprologue(8)
}
// WriteBytes writes a slice of bytes at the current index.
func (b *ByteFrame) WriteBytes(x []byte) {
b.wcheck(uint(len(x)))
copy(b.buf[b.index:], x)
b.wprologue(uint(len(x)))
}
// WriteNullTerminatedBytes write a slice bytes with an additional NULL terminator.
func (b *ByteFrame) WriteNullTerminatedBytes(x []byte) {
b.WriteBytes(x)
b.WriteUint8(0)
}
// ReadUint8 reads a uint8 at the current index.
func (b *ByteFrame) ReadUint8() (x uint8) {
if !b.rcheck(1) {
b.rerr()
}
x = uint8(b.buf[b.index])
b.rprologue(1)
return
}
// ReadBool reads a bool at the current index
// (1 byte. b > 0 -> true, b == 0 -> false)
func (b *ByteFrame) ReadBool() (x bool) {
tmp := b.ReadUint8()
x = tmp > 0
return
}
// ReadUint16 reads a uint16 at the current index.
func (b *ByteFrame) ReadUint16() (x uint16) {
if !b.rcheck(2) {
b.rerr()
}
x = b.byteOrder.Uint16(b.buf[b.index:])
b.rprologue(2)
return
}
// ReadUint32 reads a uint32 at the current index.
func (b *ByteFrame) ReadUint32() (x uint32) {
if !b.rcheck(4) {
b.rerr()
}
x = b.byteOrder.Uint32(b.buf[b.index:])
b.rprologue(4)
return
}
// ReadUint64 reads a uint64 at the current index.
func (b *ByteFrame) ReadUint64() (x uint64) {
if !b.rcheck(8) {
b.rerr()
}
x = b.byteOrder.Uint64(b.buf[b.index:])
b.rprologue(8)
return
}
// ReadInt8 reads a int8 at the current index.
func (b *ByteFrame) ReadInt8() (x int8) {
if !b.rcheck(1) {
b.rerr()
}
x = int8(b.buf[b.index])
b.rprologue(1)
return
}
// ReadInt16 reads a int16 at the current index.
func (b *ByteFrame) ReadInt16() (x int16) {
if !b.rcheck(2) {
b.rerr()
}
x = int16(b.byteOrder.Uint16(b.buf[b.index:]))
b.rprologue(2)
return
}
// ReadInt32 reads a int32 at the current index.
func (b *ByteFrame) ReadInt32() (x int32) {
if !b.rcheck(4) {
b.rerr()
}
x = int32(b.byteOrder.Uint32(b.buf[b.index:]))
b.rprologue(4)
return
}
// ReadInt64 reads a int64 at the current index.
func (b *ByteFrame) ReadInt64() (x int64) {
if !b.rcheck(8) {
b.rerr()
}
x = int64(b.byteOrder.Uint64(b.buf[b.index:]))
b.rprologue(8)
return
}
// ReadFloat32 reads a float32 at the current index.
func (b *ByteFrame) ReadFloat32() (x float32) {
if !b.rcheck(4) {
b.rerr()
}
x = math.Float32frombits(b.byteOrder.Uint32(b.buf[b.index:]))
b.rprologue(4)
return
}
// ReadFloat64 reads a float64 at the current index.
func (b *ByteFrame) ReadFloat64() (x float64) {
if !b.rcheck(8) {
b.rerr()
}
x = math.Float64frombits(b.byteOrder.Uint64(b.buf[b.index:]))
b.rprologue(8)
return
}
// ReadBytes reads `size` many bytes at the current index.
func (b *ByteFrame) ReadBytes(size uint) (x []byte) {
if !b.rcheck(size) {
b.rerr()
}
x = b.buf[b.index : b.index+size]
b.rprologue(size)
return
}
// ReadNullTerminatedBytes reads bytes up to a NULL terminator.
func (b *ByteFrame) ReadNullTerminatedBytes() []byte {
tmpData := b.DataFromCurrent()
tmp := bytes.SplitN(tmpData, []byte{0x00}, 2)[0]
if len(tmp) == len(tmpData) {
return []byte{}
}
b.rprologue(uint(len(tmp)) + 1)
return tmp
}

109
common/decryption/jpk.go Normal file
View File

@@ -0,0 +1,109 @@
package decryption
/*
This code is HEAVILY based from
https://github.com/Chakratos/ReFrontier/blob/master/ReFrontier/Unpack.cs
*/
import (
"erupe-ce/common/byteframe"
"io"
)
var mShiftIndex = 0
var mFlag = byte(0)
func UnpackSimple(data []byte) []byte {
mShiftIndex = 0
mFlag = byte(0)
bf := byteframe.NewByteFrameFromBytes(data)
bf.SetLE()
header := bf.ReadUint32()
if header == 0x1A524B4A {
bf.Seek(0x2, io.SeekCurrent)
jpkType := bf.ReadUint16()
switch jpkType {
case 3:
startOffset := bf.ReadInt32()
outSize := bf.ReadInt32()
outBuffer := make([]byte, outSize)
bf.Seek(int64(startOffset), io.SeekStart)
ProcessDecode(bf, outBuffer)
return outBuffer
}
}
return data
}
func ProcessDecode(data *byteframe.ByteFrame, outBuffer []byte) {
outIndex := 0
for int(data.Index()) < len(data.Data()) && outIndex < len(outBuffer)-1 {
if JPKBitShift(data) == 0 {
outBuffer[outIndex] = ReadByte(data)
outIndex++
continue
} else {
if JPKBitShift(data) == 0 {
length := (JPKBitShift(data) << 1) | JPKBitShift(data)
off := ReadByte(data)
JPKCopy(outBuffer, int(off), int(length)+3, &outIndex)
continue
} else {
hi := ReadByte(data)
lo := ReadByte(data)
length := int(hi&0xE0) >> 5
off := ((int(hi) & 0x1F) << 8) | int(lo)
if length != 0 {
JPKCopy(outBuffer, off, length+2, &outIndex)
continue
} else {
if JPKBitShift(data) == 0 {
length := (JPKBitShift(data) << 3) | (JPKBitShift(data) << 2) | (JPKBitShift(data) << 1) | JPKBitShift(data)
JPKCopy(outBuffer, off, int(length)+2+8, &outIndex)
continue
} else {
temp := ReadByte(data)
if temp == 0xFF {
for i := 0; i < off+0x1B; i++ {
outBuffer[outIndex] = ReadByte(data)
outIndex++
continue
}
} else {
JPKCopy(outBuffer, off, int(temp)+0x1a, &outIndex)
}
}
}
}
}
}
}
func JPKBitShift(data *byteframe.ByteFrame) byte {
mShiftIndex--
if mShiftIndex < 0 {
mShiftIndex = 7
mFlag = ReadByte(data)
}
return (byte)((mFlag >> mShiftIndex) & 1)
}
func JPKCopy(outBuffer []byte, offset int, length int, index *int) {
for i := 0; i < length; i++ {
outBuffer[*index] = outBuffer[*index-offset-1]
*index++
}
}
func ReadByte(bf *byteframe.ByteFrame) byte {
value := bf.ReadUint8()
return value
}

View File

@@ -0,0 +1,102 @@
package mhfcourse
import (
"math"
"sort"
"time"
)
type Course struct {
ID uint16
Expiry time.Time
}
var aliases = map[uint16][]string{
1: {"Trial", "TL"},
2: {"HunterLife", "HL"},
3: {"Extra", "ExtraA", "EX"},
4: {"ExtraB"},
5: {"Mobile"},
6: {"Premium"},
7: {"Pallone", "ExtraC"},
8: {"Assist", "***ist", "Legend", "Rasta"},
9: {"N"},
10: {"Hiden", "Secret"},
11: {"HunterSupport", "HunterAid", "Support", "Aid", "Royal"},
12: {"NBoost", "NetCafeBoost", "Boost"},
// 13-19 show up as (unknown)
20: {"DEBUG"},
21: {"COG_LINK_EXPIRED"},
22: {"360_GOLD"},
23: {"PS3_TROP"},
24: {"COG"},
25: {"CAFE_SP"},
26: {"NetCafe", "Cafe", "OfficialCafe", "Official"},
27: {"HLRenewing", "HLR", "HLRenewal", "HLRenew", "CardHL"},
28: {"EXRenewing", "EXR", "EXRenewal", "EXRenew", "CardEX"},
29: {"Free"},
// 30 = Real NetCafe course
}
func (c Course) Aliases() []string {
return aliases[c.ID]
}
func Courses() []Course {
courses := make([]Course, 32)
for i := range courses {
courses[i].ID = uint16(i)
}
return courses
}
func (c Course) Value() uint32 {
return uint32(math.Pow(2, float64(c.ID)))
}
// CourseExists returns true if the named course exists in the given slice
func CourseExists(ID uint16, c []Course) bool {
for _, course := range c {
if course.ID == ID {
return true
}
}
return false
}
// GetCourseStruct returns a slice of Course(s) from a rights integer
func GetCourseStruct(rights uint32) ([]Course, uint32) {
resp := []Course{{ID: 1}, {ID: 23}, {ID: 24}}
s := Courses()
sort.Slice(s, func(i, j int) bool {
return s[i].ID > s[j].ID
})
var normalCafeCourseSet, netcafeCourseSet bool
for _, course := range s {
if rights-course.Value() < 0x80000000 {
switch course.ID {
case 26:
if normalCafeCourseSet {
break
}
normalCafeCourseSet = true
resp = append(resp, Course{ID: 25})
fallthrough
case 9:
if netcafeCourseSet {
break
}
netcafeCourseSet = true
resp = append(resp, Course{ID: 30})
}
course.Expiry = time.Date(2030, 1, 1, 0, 0, 0, 0, time.FixedZone("UTC+9", 9*60*60))
resp = append(resp, course)
rights -= course.Value()
}
}
rights = 0
for _, course := range resp {
rights += course.Value()
}
return resp, rights
}

View File

@@ -0,0 +1,49 @@
package pascalstring
import (
"erupe-ce/common/byteframe"
"golang.org/x/text/encoding/japanese"
"golang.org/x/text/transform"
)
func Uint8(bf *byteframe.ByteFrame, x string, t bool) {
if t {
e := japanese.ShiftJIS.NewEncoder()
xt, _, err := transform.String(e, x)
if err != nil {
bf.WriteUint8(0)
return
}
x = xt
}
bf.WriteUint8(uint8(len(x) + 1))
bf.WriteNullTerminatedBytes([]byte(x))
}
func Uint16(bf *byteframe.ByteFrame, x string, t bool) {
if t {
e := japanese.ShiftJIS.NewEncoder()
xt, _, err := transform.String(e, x)
if err != nil {
bf.WriteUint16(0)
return
}
x = xt
}
bf.WriteUint16(uint16(len(x) + 1))
bf.WriteNullTerminatedBytes([]byte(x))
}
func Uint32(bf *byteframe.ByteFrame, x string, t bool) {
if t {
e := japanese.ShiftJIS.NewEncoder()
xt, _, err := transform.String(e, x)
if err != nil {
bf.WriteUint32(0)
return
}
x = xt
}
bf.WriteUint32(uint32(len(x) + 1))
bf.WriteNullTerminatedBytes([]byte(x))
}

View File

@@ -2,33 +2,45 @@ package stringstack
import (
"errors"
"sync"
)
// StringStack is a basic LIFO "stack" for storing strings.
type StringStack struct {
sync.Mutex
Locked bool
stack []string
}
// New creates a new instance of StringStack
func New() *StringStack {
return &StringStack{}
return &StringStack{Locked: false}
}
// Set sets up a new StringStack
func (s *StringStack) Set(v string) {
s.stack = []string{v}
}
// Lock freezes the StringStack
func (s *StringStack) Lock() {
if !s.Locked {
s.Locked = true
}
}
// Unlock unfreezes the StringStack
func (s *StringStack) Unlock() {
if s.Locked {
s.Locked = false
}
}
// Push pushes a string onto the stack.
func (s *StringStack) Push(v string) {
s.Lock()
defer s.Unlock()
s.stack = append(s.stack, v)
}
// Pop pops a string from the stack.
func (s *StringStack) Pop() (string, error) {
s.Lock()
defer s.Unlock()
if len(s.stack) == 0 {
return "", errors.New("no items on stack")
}

View File

@@ -0,0 +1,119 @@
package stringsupport
import (
"bytes"
"fmt"
"io"
"strconv"
"strings"
"golang.org/x/text/encoding/japanese"
"golang.org/x/text/transform"
)
func UTF8ToSJIS(x string) []byte {
e := japanese.ShiftJIS.NewEncoder()
xt, _, err := transform.String(e, x)
if err != nil {
panic(err)
}
return []byte(xt)
}
func SJISToUTF8(b []byte) string {
d := japanese.ShiftJIS.NewDecoder()
result, err := io.ReadAll(transform.NewReader(bytes.NewReader(b), d))
if err != nil {
panic(err)
}
return string(result)
}
func PaddedString(x string, size uint, t bool) []byte {
if t {
e := japanese.ShiftJIS.NewEncoder()
xt, _, err := transform.String(e, x)
if err != nil {
return make([]byte, size)
}
x = xt
}
out := make([]byte, size)
copy(out, x)
out[len(out)-1] = 0
return out
}
func CSVAdd(csv string, v int) string {
if len(csv) == 0 {
return strconv.Itoa(v)
}
if CSVContains(csv, v) {
return csv
} else {
return csv + "," + strconv.Itoa(v)
}
}
func CSVRemove(csv string, v int) string {
s := strings.Split(csv, ",")
for i, e := range s {
if e == strconv.Itoa(v) {
s[i] = s[len(s)-1]
s = s[:len(s)-1]
}
}
return strings.Join(s, ",")
}
func CSVContains(csv string, v int) bool {
s := strings.Split(csv, ",")
for i := 0; i < len(s); i++ {
j, _ := strconv.ParseInt(s[i], 10, 64)
if int(j) == v {
return true
}
}
return false
}
func CSVLength(csv string) int {
if csv == "" {
return 0
}
s := strings.Split(csv, ",")
return len(s)
}
func CSVElems(csv string) []int {
var r []int
if csv == "" {
return r
}
s := strings.Split(csv, ",")
for i := 0; i < len(s); i++ {
j, _ := strconv.ParseInt(s[i], 10, 64)
r = append(r, int(j))
}
return r
}
func CSVGetIndex(csv string, i int) int {
s := CSVElems(csv)
if i < len(s) {
return s[i]
}
return 0
}
func CSVSetIndex(csv string, i int, v int) string {
s := CSVElems(csv)
if i < len(s) {
s[i] = v
}
var r []string
for j := 0; j < len(s); j++ {
r = append(r, fmt.Sprintf(`%d`, s[j]))
}
return strings.Join(r, ",")
}

22
common/token/token.go Normal file
View File

@@ -0,0 +1,22 @@
package token
import (
"math/rand"
"time"
)
// Generate returns an alphanumeric token of specified length
func Generate(length int) string {
rng := RNG()
var chars = []rune("abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789")
b := make([]rune, length)
for i := range b {
b[i] = chars[rng.Intn(len(chars))]
}
return string(b)
}
// RNG returns a new RNG generator
func RNG() *rand.Rand {
return rand.New(rand.NewSource(time.Now().UnixNano()))
}

View File

@@ -1,84 +1,175 @@
{
"host_ip": "127.0.0.1",
"bin_path": "bin",
"devmode": true,
"devmodeoptions": {
"cleandb": false,
"maxlauncherhr": true,
"fixedstageid": true
},
"database": {
"host": "localhost",
"port": 5432,
"user": "postgres",
"password": "admin",
"database": "erupe"
},
"launcher": {
"port": 80,
"UseOriginalLauncherFiles": false
},
"sign": {
"port": 53312
},
"channel": {
"port": 54001
},
"entrance": {
"port": 53310,
"entries": [
{
"name": "AErupe server noob",
"ip": "127.0.0.1",
"unk2": 0,
"type": 3,
"season": 0,
"unk6": 0,
"allowedclientflags": "4096",
"channels": [
{
"port": 54001,
"MaxPlayers": 10,
"CurrentPlayers": 0,
"Unk4": 0,
"Unk5": 0,
"Unk6": 0,
"Unk7": 0,
"Unk8": 0,
"Unk9": 0,
"Unk10": 319,
"Unk11": 248,
"Unk12": 159,
"Unk13": 12345
"Host": "127.0.0.1",
"BinPath": "bin",
"Language": "en",
"DisableSoftCrash": false,
"HideLoginNotice": true,
"LoginNotices": [
"<BODY><CENTER><SIZE_3><C_4>Welcome to Erupe SU9.3!<BR><BODY><LEFT><SIZE_2><C_5>Erupe is experimental software<C_7>, we are not liable for any<BR><BODY>issues caused by installing the software!<BR><BODY><BR><BODY><C_4>■Report bugs on Discord!<C_7><BR><BODY><BR><BODY><C_4>■Test everything!<C_7><BR><BODY><BR><BODY><C_4>■Don't talk to softlocking NPCs!<C_7><BR><BODY><BR><BODY><C_4>■Fork the code on GitHub!<C_7><BR><BODY><BR><BODY>Thank you to all of the contributors,<BR><BODY><BR><BODY>this wouldn't exist without you."
],
"PatchServerManifest": "",
"PatchServerFile": "",
"ScreenshotAPIURL": "",
"DeleteOnSaveCorruption": false,
"ClientMode": "ZZ",
"DevMode": true,
"DevModeOptions": {
"AutoCreateAccount": true,
"CleanDB": false,
"MaxLauncherHR": false,
"LogInboundMessages": true,
"LogOutboundMessages": true,
"MaxHexdumpLength": 256,
"DivaEvent": 0,
"FestaEvent": -1,
"TournamentEvent": 0,
"MezFesEvent": true,
"MezFesAlt": false,
"DisableTokenCheck": false,
"QuestDebugTools": false,
"EarthStatusOverride": 0,
"EarthIDOverride": 0,
"EarthMonsterOverride": 0,
"SaveDumps": {
"Enabled": true,
"OutputDir": "save-backups"
}
},
"GameplayOptions": {
"FeaturedWeapons": 1,
"MaximumNP": 100000,
"MaximumRP": 50000,
"MaximumFP": 120000,
"DisableLoginBoost": false,
"DisableBoostTime": false,
"BoostTimeDuration": 120,
"GuildMealDuration": 60,
"BonusQuestAllowance": 3,
"DailyQuestAllowance": 1,
"MezfesSoloTickets": 10,
"MezfesGroupTickets": 4,
"LowLatencyRaviente": false,
"RegularRavienteMaxPlayers": 8,
"ViolentRavienteMaxPlayers": 8,
"BerserkRavienteMaxPlayers": 32,
"ExtremeRavienteMaxPlayers": 32,
"SmallBerserkRavienteMaxPlayers": 8,
"GUrgentRate": 10,
"GCPMultiplier": 1.00,
"GRPMultiplier": 1.00,
"GSRPMultiplier": 1.00,
"GZennyMultiplier": 1.00,
"MaterialMultiplier": 1.00,
"ExtraCarves": 0,
"DisableHunterNavi": false,
"EnableKaijiEvent": false,
"EnableHiganjimaEvent": false,
"EnableNierEvent": false,
"DisableRoad": false,
"SeasonOverride": false
},
"Discord": {
"Enabled": false,
"BotToken": "",
"RealtimeChannelID": ""
},
"Commands": [
{
"Name": "Rights",
"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"
}
],
"Courses": [
{"Name": "HunterLife", "Enabled": true},
{"Name": "Extra", "Enabled": true},
{"Name": "Premium", "Enabled": true},
{"Name": "Assist", "Enabled": false},
{"Name": "N", "Enabled": false},
{"Name": "Hiden", "Enabled": false},
{"Name": "HunterSupport", "Enabled": false},
{"Name": "NBoost", "Enabled": false},
{"Name": "NetCafe", "Enabled": true},
{"Name": "HLRenewing", "Enabled": true},
{"Name": "EXRenewing", "Enabled": true}
],
"Database": {
"Host": "localhost",
"Port": 5432,
"User": "postgres",
"Password": "",
"Database": "erupe"
},
"Sign": {
"Enabled": true,
"Port": 53312
},
"SignV2": {
"Enabled": false,
"Port": 8080
},
"Channel": {
"Enabled": true
},
"Entrance": {
"Enabled": true,
"Port": 53310,
"Entries": [
{
"Name": "Newbie", "Description": "", "IP": "", "Type": 3, "Recommended": 2, "AllowedClientFlags": 0,
"Channels": [
{ "Port": 54001, "MaxPlayers": 100 },
{ "Port": 54002, "MaxPlayers": 100 }
]
},
{
"name": "AErupe server open",
"ip": "127.0.0.1",
"unk2": 0,
"type": 1,
"season": 0,
"unk6": 0,
"allowedclientflags": 0,
"channels": [
{
"port": 54001,
"MaxPlayers": 10,
"CurrentPlayers": 0,
"Unk4": 0,
"Unk5": 0,
"Unk6": 0,
"Unk7": 0,
"Unk8": 0,
"Unk9": 0,
"Unk10": 318,
"Unk11": 251,
"Unk12": 155,
"Unk13": 12345
}
}, {
"Name": "Normal", "Description": "", "IP": "", "Type": 1, "Recommended": 0, "AllowedClientFlags": 0,
"Channels": [
{ "Port": 54003, "MaxPlayers": 100 },
{ "Port": 54004, "MaxPlayers": 100 }
]
}, {
"Name": "Cities", "Description": "", "IP": "", "Type": 2, "Recommended": 0, "AllowedClientFlags": 0,
"Channels": [
{ "Port": 54005, "MaxPlayers": 100 }
]
}, {
"Name": "Tavern", "Description": "", "IP": "", "Type": 4, "Recommended": 0, "AllowedClientFlags": 0,
"Channels": [
{ "Port": 54006, "MaxPlayers": 100 }
]
}, {
"Name": "Return", "Description": "", "IP": "", "Type": 5, "Recommended": 0, "AllowedClientFlags": 0,
"Channels": [
{ "Port": 54007, "MaxPlayers": 100 }
]
}, {
"Name": "MezFes", "Description": "", "IP": "", "Type": 6, "Recommended": 6, "AllowedClientFlags": 0,
"Channels": [
{ "Port": 54008, "MaxPlayers": 100 }
]
}
]

View File

@@ -1,32 +1,177 @@
package config
package _config
import (
"fmt"
"log"
"net"
"os"
"strings"
"time"
"github.com/spf13/viper"
)
type Mode int
const (
S1 Mode = iota + 1
S15
S2
S25
S3
S35
S4
S5
S55
S6
S7
S8
S85
S9
S10
F1
F2
F3
F4
F5
G1
G2
G3
G31
G32
GG
G5
G51
G52
G6
G61
G7
G8
G81
G9
G91
G10
G101
Z1
Z2
ZZ
)
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",
"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 {
return versionStrings[m]
}
// Config holds the global server-wide config.
type Config struct {
HostIP string `mapstructure:"host_ip"`
BinPath string `mapstructure:"bin_path"`
Host string `mapstructure:"Host"`
BinPath string `mapstructure:"BinPath"`
Language string
DisableSoftCrash bool // Disables the 'Press Return to exit' dialog allowing scripts to reboot the server automatically
HideLoginNotice bool // Hide the Erupe notice on login
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
DevModeOptions DevModeOptions
GameplayOptions GameplayOptions
Discord Discord
Commands []Command
Courses []Course
Database Database
Launcher Launcher
Sign Sign
SignV2 SignV2
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 HR9 so that you can join non-beginner worlds.
FixedStageID bool // Causes all move_stage to use the ID sl1Ns200p0a0u0 to get you into all stages
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
OutputDir string
}
// 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
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
RegularRavienteMaxPlayers uint8
ViolentRavienteMaxPlayers uint8
BerserkRavienteMaxPlayers uint8
ExtremeRavienteMaxPlayers uint8
SmallBerserkRavienteMaxPlayers uint8
GUrgentRate uint16 // Adjusts the rate of G Urgent quests spawning
GCPMultiplier float32 // Adjusts the multiplier of GCP rewarded for quest completion
GRPMultiplier float32 // Adjusts the multiplier of G Rank Points rewarded for quest completion
GSRPMultiplier float32 // Adjusts the multiplier of G Skill Rank Points rewarded for quest completion
GZennyMultiplier float32 // Adjusts the multiplier of G Zenny rewarded for quest completion
MaterialMultiplier float32 // Adjusts the multiplier of Monster Materials rewarded for quest completion
ExtraCarves uint16 // Grant n extra chances to carve ALL carcasses
DisableHunterNavi bool // Disables the Hunter Navi
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
DisableRoad bool // Disables the Hunting Road
SeasonOverride bool // Overrides the Quest Season with the current Mezeporta Season
}
// Discord holds the discord integration config.
type Discord struct {
Enabled bool
BotToken string
RealtimeChannelID string
}
// Command is a channelserver chat command
type Command struct {
Name string
Enabled bool
Prefix string
}
// Course represents a course within MHF
type Course struct {
Name string
Enabled bool
}
// Database holds the postgres database config.
@@ -38,24 +183,25 @@ type Database struct {
Database string
}
// Launcher holds the launcher server config.
type Launcher struct {
Port int
UseOriginalLauncherFiles bool
}
// Sign holds the sign server config.
type Sign struct {
Enabled bool
Port int
}
// Channel holds the channel server config.
type Channel struct {
// SignV2 holds the new sign server config
type SignV2 struct {
Enabled bool
Port int
}
type Channel struct {
Enabled bool
}
// Entrance holds the entrance server config.
type Entrance struct {
Enabled bool
Port uint16
Entries []EntranceServerInfo
}
@@ -63,12 +209,11 @@ type Entrance struct {
// EntranceServerInfo represents an entry in the serverlist.
type EntranceServerInfo struct {
IP string
Unk2 uint16
Type uint8 // Server type. 0=?, 1=open, 2=cities, 3=newbie, 4=bar
Season uint8 // Server activity. 0 = green, 1 = orange, 2 = blue
Unk6 uint8 // Something to do with server recommendation on 0, 3, and 5.
Recommended uint8 // Something to do with server recommendation on 0, 3, and 5.
Name string // Server name, 66 byte null terminated Shift-JIS(JP) or Big5(TW).
Description string // Server description
// 4096(PC, PS3/PS4)?, 8258(PC, PS3/PS4)?, 8192 == nothing?
// THIS ONLY EXISTS IF Binary8Header.type == "SV2", NOT "SVR"!
AllowedClientFlags uint32
@@ -81,16 +226,16 @@ type EntranceChannelInfo struct {
Port uint16
MaxPlayers uint16
CurrentPlayers uint16
Unk4 uint16
Unk5 uint16
Unk6 uint16
Unk7 uint16
Unk8 uint16
Unk9 uint16
Unk10 uint16
Unk11 uint16
Unk12 uint16
Unk13 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()))
}
}
// getOutboundIP4 gets the preferred outbound ip4 of this machine
@@ -112,6 +257,11 @@ func LoadConfig() (*Config, error) {
viper.SetConfigName("config")
viper.AddConfigPath(".")
viper.SetDefault("DevModeOptions.SaveDumps", SaveDumpOptions{
Enabled: true,
OutputDir: "save-backups",
})
err := viper.ReadInConfig()
if err != nil {
return nil, err
@@ -123,9 +273,40 @@ func LoadConfig() (*Config, error) {
return nil, err
}
if c.HostIP == "" {
c.HostIP = getOutboundIP4().To4().String()
if c.Host == "" {
c.Host = getOutboundIP4().To4().String()
}
for i := range versionStrings {
if strings.ToUpper(c.ClientMode) == versionStrings[i] {
c.RealClientMode = Mode(i + 1)
c.ClientMode = strings.ToUpper(c.ClientMode)
if c.RealClientMode <= G101 {
c.ClientMode += " (Debug only)"
}
}
}
if c.RealClientMode == 0 {
c.ClientMode = versionStrings[len(versionStrings)-1]
c.RealClientMode = ZZ
}
return c, nil
}
func preventClose(text string) {
if ErupeConfig.DisableSoftCrash {
os.Exit(0)
}
fmt.Println("\nFailed to start Erupe:\n" + text)
go wait()
fmt.Println("\nPress Enter/Return to exit...")
fmt.Scanln()
os.Exit(0)
}
func wait() {
for {
time.Sleep(time.Millisecond * 100)
}
}

68
go.mod
View File

@@ -1,41 +1,35 @@
module github.com/Andoryuuta/Erupe
module erupe-ce
go 1.13
go 1.21
require (
cloud.google.com/go/spanner v1.2.1 // indirect
cloud.google.com/go/storage v1.6.0 // indirect
github.com/Andoryuuta/byteframe v0.0.0-20200114030334-8979c5cc4c4a
github.com/BurntSushi/toml v0.3.1
github.com/ClickHouse/clickhouse-go v1.3.14 // indirect
github.com/aws/aws-sdk-go v1.29.10 // indirect
github.com/cockroachdb/cockroach-go v0.0.0-20190925194419-606b3d062051 // indirect
github.com/denisenkom/go-mssqldb v0.0.0-20200206145737-bbfc9a55622e // indirect
github.com/edsrzf/mmap-go v1.0.0 // indirect
github.com/gocql/gocql v0.0.0-20200221113847-372a19b1a852 // indirect
github.com/golang-migrate/migrate/v4 v4.9.1 // indirect
github.com/gorilla/handlers v1.4.2
github.com/gorilla/mux v1.7.4
github.com/jackc/pgconn v1.3.2 // indirect
github.com/jackc/pgx v3.6.2+incompatible // indirect
github.com/jmoiron/sqlx v1.2.0
github.com/klauspost/compress v1.10.1 // indirect
github.com/lib/pq v1.3.0
github.com/mattn/go-sqlite3 v2.0.3+incompatible // indirect
github.com/nakagami/firebirdsql v0.0.0-20200209020130-035d0abf81c8 // indirect
github.com/shopspring/decimal v0.0.0-20200226005030-a08b92da27ed // indirect
github.com/spf13/viper v1.6.1
github.com/xanzy/go-gitlab v0.26.0 // indirect
go.mongodb.org/mongo-driver v1.3.0 // indirect
go.uber.org/atomic v1.5.1 // indirect
go.uber.org/multierr v1.4.0 // indirect
go.uber.org/zap v1.13.0
golang.org/x/crypto v0.0.0-20200221231518-2aa609cf4a9d // indirect
golang.org/x/net v0.0.0-20200225223329-5d076fcf07a8 // indirect
golang.org/x/text v0.3.2
golang.org/x/tools v0.0.0-20200225230052-807dcd883420 // indirect
google.golang.org/api v0.19.0 // indirect
google.golang.org/genproto v0.0.0-20200225123651-fc8f55426688 // indirect
modernc.org/mathutil v1.1.0 // indirect
modernc.org/ql v1.0.1 // indirect
github.com/bwmarrin/discordgo v0.27.1
github.com/gorilla/handlers v1.5.1
github.com/gorilla/mux v1.8.0
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
)
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/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/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
gopkg.in/ini.v1 v1.67.0 // indirect
gopkg.in/yaml.v3 v3.0.1 // indirect
)

761
go.sum

File diff suppressed because it is too large Load Diff

273
main.go
View File

@@ -1,17 +1,21 @@
package main
import (
_config "erupe-ce/config"
"fmt"
"net"
"os"
"os/signal"
"runtime/debug"
"syscall"
"time"
"github.com/Andoryuuta/Erupe/config"
"github.com/Andoryuuta/Erupe/server/channelserver"
"github.com/Andoryuuta/Erupe/server/entranceserver"
"github.com/Andoryuuta/Erupe/server/launcherserver"
"github.com/Andoryuuta/Erupe/server/signserver"
"erupe-ce/server/channelserver"
"erupe-ce/server/discordbot"
"erupe-ce/server/entranceserver"
"erupe-ce/server/signserver"
"erupe-ce/server/signv2server"
"github.com/jmoiron/sqlx"
_ "github.com/lib/pq"
"go.uber.org/zap"
@@ -19,119 +23,276 @@ import (
// 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 Commit = func() string {
if info, ok := debug.ReadBuildInfo(); ok {
for _, setting := range info.Settings {
if setting.Key == "vcs.revision" {
return setting.Value[:7]
}
}
}
return "unknown"
}
func main() {
zapLogger, _ := zap.NewDevelopment()
var err error
var zapLogger *zap.Logger
config := _config.ErupeConfig
if config.DevMode {
zapLogger, _ = zap.NewDevelopment()
} else {
zapLogger, _ = zap.NewProduction()
}
defer zapLogger.Sync()
logger := zapLogger.Named("main")
logger.Info("Starting Erupe")
logger.Info(fmt.Sprintf("Starting Erupe (9.3b-%s)", Commit()))
logger.Info(fmt.Sprintf("Client Mode: %s (%d)", config.ClientMode, config.RealClientMode))
if config.Database.Password == "" {
preventClose("Database password is blank")
}
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,
})
// Load the configuration.
erupeConfig, err := config.LoadConfig()
if err != nil {
logger.Fatal("Failed to load config", zap.Error(err))
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",
erupeConfig.Database.Host,
erupeConfig.Database.Port,
erupeConfig.Database.User,
erupeConfig.Database.Password,
erupeConfig.Database.Database,
"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)
if err != nil {
logger.Fatal("Failed to open sql database", zap.Error(err))
preventClose(fmt.Sprintf("Database: Failed to open, %s", err.Error()))
}
// Test the DB connection.
err = db.Ping()
if err != nil {
logger.Fatal("Failed to ping database", zap.Error(err))
preventClose(fmt.Sprintf("Database: Failed to ping, %s", err.Error()))
}
logger.Info("Connected to database")
logger.Info("Database: Started successfully")
// Clear stale data
_ = db.MustExec("DELETE FROM sign_sessions")
_ = db.MustExec("DELETE FROM servers")
// Clean the DB if the option is on.
if erupeConfig.DevMode && erupeConfig.DevModeOptions.CleanDB {
logger.Info("Cleaning DB")
if config.DevMode && config.DevModeOptions.CleanDB {
logger.Info("Database: Started clearing...")
cleanDB(db)
logger.Info("Done cleaning DB")
logger.Info("Database: Finished clearing")
}
logger.Info(fmt.Sprintf("Server Time: %s", channelserver.TimeAdjusted().String()))
// Now start our server(s).
// Launcher HTTP server.
launcherServer := launcherserver.NewServer(
&launcherserver.Config{
Logger: logger.Named("launcher"),
ErupeConfig: erupeConfig,
DB: db,
UseOriginalLauncherFiles: erupeConfig.Launcher.UseOriginalLauncherFiles,
})
err = launcherServer.Start()
if err != nil {
logger.Fatal("Failed to start launcher server", zap.Error(err))
}
logger.Info("Started launcher server.")
// Entrance server.
entranceServer := entranceserver.NewServer(
var entranceServer *entranceserver.Server
if config.Entrance.Enabled {
entranceServer = entranceserver.NewServer(
&entranceserver.Config{
Logger: logger.Named("entrance"),
ErupeConfig: erupeConfig,
ErupeConfig: _config.ErupeConfig,
DB: db,
})
err = entranceServer.Start()
if err != nil {
logger.Fatal("Failed to start entrance server", zap.Error(err))
preventClose(fmt.Sprintf("Entrance: Failed to start, %s", err.Error()))
}
logger.Info("Entrance: Started successfully")
} else {
logger.Info("Entrance: Disabled")
}
logger.Info("Started entrance server.")
// Sign server.
signServer := signserver.NewServer(
var signServer *signserver.Server
if config.Sign.Enabled {
signServer = signserver.NewServer(
&signserver.Config{
Logger: logger.Named("sign"),
ErupeConfig: erupeConfig,
ErupeConfig: _config.ErupeConfig,
DB: db,
})
err = signServer.Start()
if err != nil {
logger.Fatal("Failed to start sign server", zap.Error(err))
preventClose(fmt.Sprintf("Sign: Failed to start, %s", err.Error()))
}
logger.Info("Sign: Started successfully")
} else {
logger.Info("Sign: Disabled")
}
logger.Info("Started sign server.")
// Channel Server
channelServer := channelserver.NewServer(
&channelserver.Config{
Logger: logger.Named("channel"),
ErupeConfig: erupeConfig,
// 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 = channelServer.Start()
err = newSignServer.Start()
if err != nil {
logger.Fatal("Failed to start channel server", zap.Error(err))
preventClose(fmt.Sprintf("SignV2: Failed to start, %s", err.Error()))
}
logger.Info("Started channel server.")
logger.Info("SignV2: Started successfully")
} else {
logger.Info("SignV2: Disabled")
}
var channels []*channelserver.Server
if config.Channel.Enabled {
channelQuery := ""
si := 0
ci := 0
count := 1
for j, ee := range config.Entrance.Entries {
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,
})
if ee.IP == "" {
c.IP = config.Host
} else {
c.IP = ee.IP
}
c.Port = ce.Port
c.GlobalID = fmt.Sprintf("%02d%02d", j+1, i+1)
err = c.Start()
if err != nil {
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))
ci++
count++
}
}
ci = 0
si++
}
// Register all servers in DB
_ = db.MustExec(channelQuery)
for _, c := range channels {
c.Channels = channels
}
}
logger.Info("Finished starting Erupe")
// Wait for exit or interrupt with ctrl+C.
c := make(chan os.Signal, 1)
signal.Notify(c, os.Interrupt, syscall.SIGTERM)
<-c
logger.Info("Trying to shutdown gracefully.")
channelServer.Shutdown()
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)
}
logger.Info(message)
time.Sleep(time.Second)
}
}
if config.Channel.Enabled {
for _, c := range channels {
c.Shutdown()
}
}
if config.Sign.Enabled {
signServer.Shutdown()
}
if config.SignV2.Enabled {
newSignServer.Shutdown()
}
if config.Entrance.Enabled {
entranceServer.Shutdown()
launcherServer.Shutdown()
}
time.Sleep(1 * time.Second)
}
func wait() {
for {
time.Sleep(time.Millisecond * 100)
}
}
func preventClose(text string) {
if _config.ErupeConfig.DisableSoftCrash {
os.Exit(0)
}
fmt.Println("\nFailed to start Erupe:\n" + text)
go wait()
fmt.Println("\nPress Enter/Return to exit...")
fmt.Scanln()
os.Exit(0)
}

View File

@@ -0,0 +1,59 @@
package binpacket
import (
"erupe-ce/common/byteframe"
"erupe-ce/common/stringsupport"
"erupe-ce/network"
)
// ChatType represents the chat message type (Thanks to @Alice on discord for identifying these!)
type ChatType uint8
// Chat types
const (
ChatTypeLocal ChatType = 1
ChatTypeGuild = 2
ChatTypeAlliance = 3
ChatTypeParty = 4
ChatTypeWhisper = 5
)
// MsgBinChat is a binpacket for chat messages.
type MsgBinChat struct {
Unk0 uint8
Type ChatType
Flags uint16
Message string
SenderName string
}
// Opcode returns the ID associated with this packet type.
func (m *MsgBinChat) Opcode() network.PacketID {
return network.MSG_SYS_CAST_BINARY
}
// Parse parses the packet from binary
func (m *MsgBinChat) Parse(bf *byteframe.ByteFrame) error {
m.Unk0 = bf.ReadUint8()
m.Type = ChatType(bf.ReadUint8())
m.Flags = bf.ReadUint16()
_ = bf.ReadUint16() // lenSenderName
_ = bf.ReadUint16() // lenMessage
m.Message = stringsupport.SJISToUTF8(bf.ReadNullTerminatedBytes())
m.SenderName = stringsupport.SJISToUTF8(bf.ReadNullTerminatedBytes())
return nil
}
// Build builds a binary packet from the current data.
func (m *MsgBinChat) Build(bf *byteframe.ByteFrame) error {
bf.WriteUint8(m.Unk0)
bf.WriteUint8(uint8(m.Type))
bf.WriteUint16(m.Flags)
cMessage := stringsupport.UTF8ToSJIS(m.Message)
cSenderName := stringsupport.UTF8ToSJIS(m.SenderName)
bf.WriteUint16(uint16(len(cSenderName) + 1))
bf.WriteUint16(uint16(len(cMessage) + 1))
bf.WriteNullTerminatedBytes(cMessage)
bf.WriteNullTerminatedBytes(cSenderName)
return nil
}

View File

@@ -0,0 +1,25 @@
package binpacket
import (
"erupe-ce/common/byteframe"
"erupe-ce/common/stringsupport"
"erupe-ce/network"
)
type MsgBinMailNotify struct {
SenderName string
}
func (m MsgBinMailNotify) Parse(bf *byteframe.ByteFrame) error {
panic("implement me")
}
func (m MsgBinMailNotify) Build(bf *byteframe.ByteFrame) error {
bf.WriteUint8(0x01) // Unk
bf.WriteBytes(stringsupport.PaddedString(m.SenderName, 21, true))
return nil
}
func (m MsgBinMailNotify) Opcode() network.PacketID {
return network.MSG_SYS_CASTED_BINARY
}

View File

@@ -0,0 +1,46 @@
package binpacket
import (
"erupe-ce/common/byteframe"
"erupe-ce/network"
)
// MsgBinTargeted is a format used for some broadcast types
// to target specific players, instead of groups (world, stage, etc).
// It forwards a normal binpacket in it's RawDataPayload
type MsgBinTargeted struct {
TargetCount uint16
TargetCharIDs []uint32
RawDataPayload []byte // The regular binary payload to be forwarded to the targets.
}
// Opcode returns the ID associated with this packet type.
func (m *MsgBinTargeted) Opcode() network.PacketID {
return network.MSG_SYS_CAST_BINARY
}
// Parse parses the packet from binary
func (m *MsgBinTargeted) Parse(bf *byteframe.ByteFrame) error {
m.TargetCount = bf.ReadUint16()
m.TargetCharIDs = make([]uint32, m.TargetCount)
for i := uint16(0); i < m.TargetCount; i++ {
m.TargetCharIDs[i] = bf.ReadUint32()
}
m.RawDataPayload = bf.DataFromCurrent()
return nil
}
// Build builds a binary packet from the current data.
func (m *MsgBinTargeted) Build(bf *byteframe.ByteFrame) error {
bf.WriteUint16(m.TargetCount)
for i := 0; i < int(m.TargetCount); i++ {
bf.WriteUint32(m.TargetCharIDs[i])
}
bf.WriteBytes(m.RawDataPayload)
return nil
}

View File

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

View File

@@ -3,11 +3,12 @@ package network
import (
"encoding/hex"
"errors"
_config "erupe-ce/config"
"fmt"
"io"
"net"
"github.com/Andoryuuta/Erupe/network/crypto"
"erupe-ce/network/crypto"
)
// CryptConn represents a MHF encrypted two-way connection,
@@ -48,7 +49,14 @@ func (cc *CryptConn) ReadPacket() ([]byte, error) {
}
// Now read the encrypted packet body after getting its size from the header.
encryptedPacketBody := make([]byte, cph.DataSize)
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 {
encryptedPacketBody = make([]byte, cph.DataSize)
} else {
encryptedPacketBody = make([]byte, uint32(cph.DataSize)+(uint32(cph.Pf0-0x03)*0x1000))
}
_, err = io.ReadFull(cc.conn, encryptedPacketBody)
if err != nil {
return nil, err
@@ -56,7 +64,7 @@ func (cc *CryptConn) ReadPacket() ([]byte, error) {
// Update the key rotation before decrypting.
if cph.KeyRotDelta != 0 {
cc.readKeyRot = (uint32(cph.KeyRotDelta) * (cc.readKeyRot + 1))
cc.readKeyRot = uint32(cph.KeyRotDelta) * (cc.readKeyRot + 1)
}
out, combinedCheck, check0, check1, check2 := crypto.Decrypt(encryptedPacketBody, cc.readKeyRot, nil)
@@ -94,7 +102,7 @@ func (cc *CryptConn) SendPacket(data []byte) error {
keyRotDelta := byte(3)
if keyRotDelta != 0 {
cc.sendKeyRot = (uint32(keyRotDelta) * (cc.sendKeyRot + 1))
cc.sendKeyRot = uint32(keyRotDelta) * (cc.sendKeyRot + 1)
}
// Encrypt the data

View File

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

View File

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

View File

@@ -1,8 +1,12 @@
package mhfpacket
import (
"github.com/Andoryuuta/Erupe/network"
"github.com/Andoryuuta/byteframe"
"errors"
"erupe-ce/network/clientctx"
"erupe-ce/common/byteframe"
"erupe-ce/network"
)
// MsgHead represents the MSG_HEAD
@@ -14,11 +18,11 @@ func (m *MsgHead) Opcode() network.PacketID {
}
// Parse parses the packet from binary
func (m *MsgHead) Parse(bf *byteframe.ByteFrame) error {
panic("Not implemented")
func (m *MsgHead) Parse(bf *byteframe.ByteFrame, ctx *clientctx.ClientContext) error {
return errors.New("NOT IMPLEMENTED")
}
// Build builds a binary packet from the current data.
func (m *MsgHead) Build(bf *byteframe.ByteFrame) error {
panic("Not implemented")
func (m *MsgHead) Build(bf *byteframe.ByteFrame, ctx *clientctx.ClientContext) error {
return errors.New("NOT IMPLEMENTED")
}

View File

@@ -1,8 +1,12 @@
package mhfpacket
import (
"github.com/Andoryuuta/Erupe/network"
"github.com/Andoryuuta/byteframe"
"errors"
"erupe-ce/network/clientctx"
"erupe-ce/common/byteframe"
"erupe-ce/network"
)
// MsgMhfAcceptReadReward represents the MSG_MHF_ACCEPT_READ_REWARD
@@ -14,11 +18,11 @@ func (m *MsgMhfAcceptReadReward) Opcode() network.PacketID {
}
// Parse parses the packet from binary
func (m *MsgMhfAcceptReadReward) Parse(bf *byteframe.ByteFrame) error {
panic("Not implemented")
func (m *MsgMhfAcceptReadReward) Parse(bf *byteframe.ByteFrame, ctx *clientctx.ClientContext) error {
return errors.New("NOT IMPLEMENTED")
}
// Build builds a binary packet from the current data.
func (m *MsgMhfAcceptReadReward) Build(bf *byteframe.ByteFrame) error {
panic("Not implemented")
func (m *MsgMhfAcceptReadReward) Build(bf *byteframe.ByteFrame, ctx *clientctx.ClientContext) error {
return errors.New("NOT IMPLEMENTED")
}

View File

@@ -1,20 +1,23 @@
package mhfpacket
import (
"github.com/Andoryuuta/Erupe/network"
"github.com/Andoryuuta/byteframe"
"errors"
_config "erupe-ce/config"
"erupe-ce/common/byteframe"
"erupe-ce/network"
"erupe-ce/network/clientctx"
)
// MsgMhfAcquireCafeItem represents the MSG_MHF_ACQUIRE_CAFE_ITEM
type MsgMhfAcquireCafeItem struct {
AckHandle uint32
// Valid sizes, not sure if [un]signed.
ItemType uint16
ItemID uint16
Quant uint16
PointCost uint32
Unk0 uint16
Unk1 uint16
Unk2 uint16
Unk3 uint32
Unk4 uint16
}
// Opcode returns the ID associated with this packet type.
@@ -23,17 +26,21 @@ func (m *MsgMhfAcquireCafeItem) Opcode() network.PacketID {
}
// Parse parses the packet from binary
func (m *MsgMhfAcquireCafeItem) Parse(bf *byteframe.ByteFrame) error {
func (m *MsgMhfAcquireCafeItem) Parse(bf *byteframe.ByteFrame, ctx *clientctx.ClientContext) error {
m.AckHandle = bf.ReadUint32()
m.ItemType = bf.ReadUint16()
m.ItemID = bf.ReadUint16()
m.Quant = bf.ReadUint16()
if _config.ErupeConfig.RealClientMode >= _config.G1 {
m.PointCost = bf.ReadUint32()
} else {
m.PointCost = uint32(bf.ReadUint16())
}
m.Unk0 = bf.ReadUint16()
m.Unk1 = bf.ReadUint16()
m.Unk2 = bf.ReadUint16()
m.Unk3 = bf.ReadUint32()
m.Unk4 = bf.ReadUint16()
return nil
}
// Build builds a binary packet from the current data.
func (m *MsgMhfAcquireCafeItem) Build(bf *byteframe.ByteFrame) error {
panic("Not implemented")
func (m *MsgMhfAcquireCafeItem) Build(bf *byteframe.ByteFrame, ctx *clientctx.ClientContext) error {
return errors.New("NOT IMPLEMENTED")
}

View File

@@ -1,16 +1,18 @@
package mhfpacket
import (
"github.com/Andoryuuta/Erupe/network"
"github.com/Andoryuuta/byteframe"
"errors"
"erupe-ce/common/byteframe"
"erupe-ce/network"
"erupe-ce/network/clientctx"
)
// MsgMhfAcquireDistItem represents the MSG_MHF_ACQUIRE_DIST_ITEM
type MsgMhfAcquireDistItem struct {
AckHandle uint32
// Valid field size(s), not sure about the types.
Unk0 uint32
DistributionType uint8
DistributionID uint32
}
// Opcode returns the ID associated with this packet type.
@@ -19,13 +21,14 @@ func (m *MsgMhfAcquireDistItem) Opcode() network.PacketID {
}
// Parse parses the packet from binary
func (m *MsgMhfAcquireDistItem) Parse(bf *byteframe.ByteFrame) error {
func (m *MsgMhfAcquireDistItem) Parse(bf *byteframe.ByteFrame, ctx *clientctx.ClientContext) error {
m.AckHandle = bf.ReadUint32()
m.Unk0 = bf.ReadUint32()
m.DistributionType = bf.ReadUint8()
m.DistributionID = bf.ReadUint32()
return nil
}
// Build builds a binary packet from the current data.
func (m *MsgMhfAcquireDistItem) Build(bf *byteframe.ByteFrame) error {
panic("Not implemented")
func (m *MsgMhfAcquireDistItem) Build(bf *byteframe.ByteFrame, ctx *clientctx.ClientContext) error {
return errors.New("NOT IMPLEMENTED")
}

View File

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

View File

@@ -1,12 +1,20 @@
package mhfpacket
import (
"github.com/Andoryuuta/Erupe/network"
"github.com/Andoryuuta/byteframe"
"errors"
"erupe-ce/common/byteframe"
"erupe-ce/network"
"erupe-ce/network/clientctx"
)
// MsgMhfAcquireFesta represents the MSG_MHF_ACQUIRE_FESTA
type MsgMhfAcquireFesta struct{}
type MsgMhfAcquireFesta struct {
AckHandle uint32
FestaID uint32
GuildID uint32
Unk uint16
}
// Opcode returns the ID associated with this packet type.
func (m *MsgMhfAcquireFesta) Opcode() network.PacketID {
@@ -14,11 +22,15 @@ func (m *MsgMhfAcquireFesta) Opcode() network.PacketID {
}
// Parse parses the packet from binary
func (m *MsgMhfAcquireFesta) Parse(bf *byteframe.ByteFrame) error {
panic("Not implemented")
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
}
// Build builds a binary packet from the current data.
func (m *MsgMhfAcquireFesta) Build(bf *byteframe.ByteFrame) error {
panic("Not implemented")
func (m *MsgMhfAcquireFesta) Build(bf *byteframe.ByteFrame, ctx *clientctx.ClientContext) error {
return errors.New("NOT IMPLEMENTED")
}

View File

@@ -1,12 +1,18 @@
package mhfpacket
import (
"github.com/Andoryuuta/Erupe/network"
"github.com/Andoryuuta/byteframe"
"errors"
"erupe-ce/common/byteframe"
"erupe-ce/network"
"erupe-ce/network/clientctx"
)
// MsgMhfAcquireFestaIntermediatePrize represents the MSG_MHF_ACQUIRE_FESTA_INTERMEDIATE_PRIZE
type MsgMhfAcquireFestaIntermediatePrize struct{}
type MsgMhfAcquireFestaIntermediatePrize struct {
AckHandle uint32
PrizeID uint32
}
// Opcode returns the ID associated with this packet type.
func (m *MsgMhfAcquireFestaIntermediatePrize) Opcode() network.PacketID {
@@ -14,11 +20,13 @@ func (m *MsgMhfAcquireFestaIntermediatePrize) Opcode() network.PacketID {
}
// Parse parses the packet from binary
func (m *MsgMhfAcquireFestaIntermediatePrize) Parse(bf *byteframe.ByteFrame) error {
panic("Not implemented")
func (m *MsgMhfAcquireFestaIntermediatePrize) Parse(bf *byteframe.ByteFrame, ctx *clientctx.ClientContext) error {
m.AckHandle = bf.ReadUint32()
m.PrizeID = bf.ReadUint32()
return nil
}
// Build builds a binary packet from the current data.
func (m *MsgMhfAcquireFestaIntermediatePrize) Build(bf *byteframe.ByteFrame) error {
panic("Not implemented")
func (m *MsgMhfAcquireFestaIntermediatePrize) Build(bf *byteframe.ByteFrame, ctx *clientctx.ClientContext) error {
return errors.New("NOT IMPLEMENTED")
}

View File

@@ -1,12 +1,18 @@
package mhfpacket
import (
"github.com/Andoryuuta/Erupe/network"
"github.com/Andoryuuta/byteframe"
"errors"
"erupe-ce/common/byteframe"
"erupe-ce/network"
"erupe-ce/network/clientctx"
)
// MsgMhfAcquireFestaPersonalPrize represents the MSG_MHF_ACQUIRE_FESTA_PERSONAL_PRIZE
type MsgMhfAcquireFestaPersonalPrize struct{}
type MsgMhfAcquireFestaPersonalPrize struct {
AckHandle uint32
PrizeID uint32
}
// Opcode returns the ID associated with this packet type.
func (m *MsgMhfAcquireFestaPersonalPrize) Opcode() network.PacketID {
@@ -14,11 +20,13 @@ func (m *MsgMhfAcquireFestaPersonalPrize) Opcode() network.PacketID {
}
// Parse parses the packet from binary
func (m *MsgMhfAcquireFestaPersonalPrize) Parse(bf *byteframe.ByteFrame) error {
panic("Not implemented")
func (m *MsgMhfAcquireFestaPersonalPrize) Parse(bf *byteframe.ByteFrame, ctx *clientctx.ClientContext) 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) error {
panic("Not implemented")
func (m *MsgMhfAcquireFestaPersonalPrize) Build(bf *byteframe.ByteFrame, ctx *clientctx.ClientContext) error {
return errors.New("NOT IMPLEMENTED")
}

View File

@@ -1,12 +1,18 @@
package mhfpacket
import (
"github.com/Andoryuuta/Erupe/network"
"github.com/Andoryuuta/byteframe"
"errors"
"erupe-ce/common/byteframe"
"erupe-ce/network"
"erupe-ce/network/clientctx"
)
// MsgMhfAcquireGuildAdventure represents the MSG_MHF_ACQUIRE_GUILD_ADVENTURE
type MsgMhfAcquireGuildAdventure struct{}
type MsgMhfAcquireGuildAdventure struct {
AckHandle uint32
ID uint32
}
// Opcode returns the ID associated with this packet type.
func (m *MsgMhfAcquireGuildAdventure) Opcode() network.PacketID {
@@ -14,11 +20,13 @@ func (m *MsgMhfAcquireGuildAdventure) Opcode() network.PacketID {
}
// Parse parses the packet from binary
func (m *MsgMhfAcquireGuildAdventure) Parse(bf *byteframe.ByteFrame) error {
panic("Not implemented")
func (m *MsgMhfAcquireGuildAdventure) Parse(bf *byteframe.ByteFrame, ctx *clientctx.ClientContext) 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) error {
panic("Not implemented")
func (m *MsgMhfAcquireGuildAdventure) Build(bf *byteframe.ByteFrame, ctx *clientctx.ClientContext) error {
return errors.New("NOT IMPLEMENTED")
}

View File

@@ -1,12 +1,19 @@
package mhfpacket
import (
"github.com/Andoryuuta/Erupe/network"
"github.com/Andoryuuta/byteframe"
"errors"
"erupe-ce/common/byteframe"
"erupe-ce/network"
"erupe-ce/network/clientctx"
)
// MsgMhfAcquireGuildTresure represents the MSG_MHF_ACQUIRE_GUILD_TRESURE
type MsgMhfAcquireGuildTresure struct{}
type MsgMhfAcquireGuildTresure struct {
AckHandle uint32
HuntID uint32
Unk uint8
}
// Opcode returns the ID associated with this packet type.
func (m *MsgMhfAcquireGuildTresure) Opcode() network.PacketID {
@@ -14,11 +21,14 @@ func (m *MsgMhfAcquireGuildTresure) Opcode() network.PacketID {
}
// Parse parses the packet from binary
func (m *MsgMhfAcquireGuildTresure) Parse(bf *byteframe.ByteFrame) error {
panic("Not implemented")
func (m *MsgMhfAcquireGuildTresure) Parse(bf *byteframe.ByteFrame, ctx *clientctx.ClientContext) error {
m.AckHandle = bf.ReadUint32()
m.HuntID = bf.ReadUint32()
m.Unk = bf.ReadUint8()
return nil
}
// Build builds a binary packet from the current data.
func (m *MsgMhfAcquireGuildTresure) Build(bf *byteframe.ByteFrame) error {
panic("Not implemented")
func (m *MsgMhfAcquireGuildTresure) Build(bf *byteframe.ByteFrame, ctx *clientctx.ClientContext) error {
return errors.New("NOT IMPLEMENTED")
}

View File

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

View File

@@ -1,12 +1,20 @@
package mhfpacket
import (
"github.com/Andoryuuta/Erupe/network"
"github.com/Andoryuuta/byteframe"
"errors"
"erupe-ce/common/byteframe"
"erupe-ce/network"
"erupe-ce/network/clientctx"
)
// MsgMhfAcquireItem represents the MSG_MHF_ACQUIRE_ITEM
type MsgMhfAcquireItem struct{}
type MsgMhfAcquireItem struct {
AckHandle uint32
Unk0 uint16
Length uint16
Unk1 []uint32
}
// Opcode returns the ID associated with this packet type.
func (m *MsgMhfAcquireItem) Opcode() network.PacketID {
@@ -14,11 +22,17 @@ func (m *MsgMhfAcquireItem) Opcode() network.PacketID {
}
// Parse parses the packet from binary
func (m *MsgMhfAcquireItem) Parse(bf *byteframe.ByteFrame) error {
panic("Not implemented")
func (m *MsgMhfAcquireItem) Parse(bf *byteframe.ByteFrame, ctx *clientctx.ClientContext) error {
m.AckHandle = bf.ReadUint32()
m.Unk0 = bf.ReadUint16()
m.Length = bf.ReadUint16()
for i := 0; i < int(m.Length); i++ {
m.Unk1 = append(m.Unk1, bf.ReadUint32())
}
return nil
}
// Build builds a binary packet from the current data.
func (m *MsgMhfAcquireItem) Build(bf *byteframe.ByteFrame) error {
panic("Not implemented")
func (m *MsgMhfAcquireItem) Build(bf *byteframe.ByteFrame, ctx *clientctx.ClientContext) error {
return errors.New("NOT IMPLEMENTED")
}

View File

@@ -1,12 +1,21 @@
package mhfpacket
import (
"github.com/Andoryuuta/Erupe/network"
"github.com/Andoryuuta/byteframe"
"errors"
"erupe-ce/common/byteframe"
"erupe-ce/network"
"erupe-ce/network/clientctx"
)
// MsgMhfAcquireMonthlyItem represents the MSG_MHF_ACQUIRE_MONTHLY_ITEM
type MsgMhfAcquireMonthlyItem struct{}
type MsgMhfAcquireMonthlyItem struct {
AckHandle uint32
Unk0 uint16
Unk1 uint16
Unk2 uint32
Unk3 uint32
}
// Opcode returns the ID associated with this packet type.
func (m *MsgMhfAcquireMonthlyItem) Opcode() network.PacketID {
@@ -14,11 +23,16 @@ func (m *MsgMhfAcquireMonthlyItem) Opcode() network.PacketID {
}
// Parse parses the packet from binary
func (m *MsgMhfAcquireMonthlyItem) Parse(bf *byteframe.ByteFrame) error {
panic("Not implemented")
func (m *MsgMhfAcquireMonthlyItem) Parse(bf *byteframe.ByteFrame, ctx *clientctx.ClientContext) error {
m.AckHandle = bf.ReadUint32()
m.Unk0 = bf.ReadUint16()
m.Unk1 = bf.ReadUint16()
m.Unk2 = bf.ReadUint32()
m.Unk3 = bf.ReadUint32()
return nil
}
// Build builds a binary packet from the current data.
func (m *MsgMhfAcquireMonthlyItem) Build(bf *byteframe.ByteFrame) error {
panic("Not implemented")
func (m *MsgMhfAcquireMonthlyItem) Build(bf *byteframe.ByteFrame, ctx *clientctx.ClientContext) error {
return errors.New("NOT IMPLEMENTED")
}

View File

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

View File

@@ -1,12 +1,20 @@
package mhfpacket
import (
"github.com/Andoryuuta/Erupe/network"
"github.com/Andoryuuta/byteframe"
"errors"
"erupe-ce/common/byteframe"
"erupe-ce/network"
"erupe-ce/network/clientctx"
)
// MsgMhfAcquireTitle represents the MSG_MHF_ACQUIRE_TITLE
type MsgMhfAcquireTitle struct{}
type MsgMhfAcquireTitle struct {
AckHandle uint32
Unk0 uint16
Unk1 uint16
TitleID uint16
}
// Opcode returns the ID associated with this packet type.
func (m *MsgMhfAcquireTitle) Opcode() network.PacketID {
@@ -14,11 +22,15 @@ func (m *MsgMhfAcquireTitle) Opcode() network.PacketID {
}
// Parse parses the packet from binary
func (m *MsgMhfAcquireTitle) Parse(bf *byteframe.ByteFrame) error {
panic("Not implemented")
func (m *MsgMhfAcquireTitle) Parse(bf *byteframe.ByteFrame, ctx *clientctx.ClientContext) error {
m.AckHandle = bf.ReadUint32()
m.Unk0 = bf.ReadUint16()
m.Unk1 = bf.ReadUint16()
m.TitleID = bf.ReadUint16()
return nil
}
// Build builds a binary packet from the current data.
func (m *MsgMhfAcquireTitle) Build(bf *byteframe.ByteFrame) error {
panic("Not implemented")
func (m *MsgMhfAcquireTitle) Build(bf *byteframe.ByteFrame, ctx *clientctx.ClientContext) error {
return errors.New("NOT IMPLEMENTED")
}

View File

@@ -1,12 +1,18 @@
package mhfpacket
import (
"github.com/Andoryuuta/Erupe/network"
"github.com/Andoryuuta/byteframe"
"errors"
"erupe-ce/common/byteframe"
"erupe-ce/network"
"erupe-ce/network/clientctx"
)
// MsgMhfAcquireTournament represents the MSG_MHF_ACQUIRE_TOURNAMENT
type MsgMhfAcquireTournament struct{}
type MsgMhfAcquireTournament struct {
AckHandle uint32
TournamentID uint32
}
// Opcode returns the ID associated with this packet type.
func (m *MsgMhfAcquireTournament) Opcode() network.PacketID {
@@ -14,11 +20,13 @@ func (m *MsgMhfAcquireTournament) Opcode() network.PacketID {
}
// Parse parses the packet from binary
func (m *MsgMhfAcquireTournament) Parse(bf *byteframe.ByteFrame) error {
panic("Not implemented")
func (m *MsgMhfAcquireTournament) Parse(bf *byteframe.ByteFrame, ctx *clientctx.ClientContext) 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) error {
panic("Not implemented")
func (m *MsgMhfAcquireTournament) Build(bf *byteframe.ByteFrame, ctx *clientctx.ClientContext) error {
return errors.New("NOT IMPLEMENTED")
}

View File

@@ -1,12 +1,31 @@
package mhfpacket
import (
"github.com/Andoryuuta/Erupe/network"
"github.com/Andoryuuta/byteframe"
"errors"
"erupe-ce/common/byteframe"
"erupe-ce/network"
"erupe-ce/network/clientctx"
)
// MsgMhfAcquireUdItem represents the MSG_MHF_ACQUIRE_UD_ITEM
type MsgMhfAcquireUdItem struct{}
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
}
// Opcode returns the ID associated with this packet type.
func (m *MsgMhfAcquireUdItem) Opcode() network.PacketID {
@@ -14,11 +33,18 @@ func (m *MsgMhfAcquireUdItem) Opcode() network.PacketID {
}
// Parse parses the packet from binary
func (m *MsgMhfAcquireUdItem) Parse(bf *byteframe.ByteFrame) error {
panic("Not implemented")
func (m *MsgMhfAcquireUdItem) Parse(bf *byteframe.ByteFrame, ctx *clientctx.ClientContext) 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()
}
return nil
}
// Build builds a binary packet from the current data.
func (m *MsgMhfAcquireUdItem) Build(bf *byteframe.ByteFrame) error {
panic("Not implemented")
func (m *MsgMhfAcquireUdItem) Build(bf *byteframe.ByteFrame, ctx *clientctx.ClientContext) error {
return errors.New("NOT IMPLEMENTED")
}

View File

@@ -1,13 +1,16 @@
package mhfpacket
import (
"github.com/Andoryuuta/Erupe/network"
"github.com/Andoryuuta/byteframe"
"errors"
"erupe-ce/common/byteframe"
"erupe-ce/network"
"erupe-ce/network/clientctx"
)
// MsgMhfAddAchievement represents the MSG_MHF_ADD_ACHIEVEMENT
type MsgMhfAddAchievement struct {
Unk0 uint8
AchievementID uint8
Unk1 uint16
Unk2 uint16
}
@@ -18,15 +21,14 @@ func (m *MsgMhfAddAchievement) Opcode() network.PacketID {
}
// Parse parses the packet from binary
func (m *MsgMhfAddAchievement) Parse(bf *byteframe.ByteFrame) error {
m.Unk0 = bf.ReadUint8()
func (m *MsgMhfAddAchievement) Parse(bf *byteframe.ByteFrame, ctx *clientctx.ClientContext) error {
m.AchievementID = bf.ReadUint8()
m.Unk1 = bf.ReadUint16()
m.Unk2 = bf.ReadUint16()
// doesn't expect a response
return nil
}
// Build builds a binary packet from the current data.
func (m *MsgMhfAddAchievement) Build(bf *byteframe.ByteFrame) error {
panic("Not implemented")
func (m *MsgMhfAddAchievement) Build(bf *byteframe.ByteFrame, ctx *clientctx.ClientContext) error {
return errors.New("NOT IMPLEMENTED")
}

View File

@@ -1,12 +1,19 @@
package mhfpacket
import (
"github.com/Andoryuuta/Erupe/network"
"github.com/Andoryuuta/byteframe"
"errors"
"erupe-ce/common/byteframe"
"erupe-ce/network"
"erupe-ce/network/clientctx"
)
// MsgMhfAddGuildMissionCount represents the MSG_MHF_ADD_GUILD_MISSION_COUNT
type MsgMhfAddGuildMissionCount struct{}
type MsgMhfAddGuildMissionCount struct {
AckHandle uint32
MissionID uint32
Count uint32
}
// Opcode returns the ID associated with this packet type.
func (m *MsgMhfAddGuildMissionCount) Opcode() network.PacketID {
@@ -14,11 +21,14 @@ func (m *MsgMhfAddGuildMissionCount) Opcode() network.PacketID {
}
// Parse parses the packet from binary
func (m *MsgMhfAddGuildMissionCount) Parse(bf *byteframe.ByteFrame) error {
panic("Not implemented")
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
}
// Build builds a binary packet from the current data.
func (m *MsgMhfAddGuildMissionCount) Build(bf *byteframe.ByteFrame) error {
panic("Not implemented")
func (m *MsgMhfAddGuildMissionCount) Build(bf *byteframe.ByteFrame, ctx *clientctx.ClientContext) error {
return errors.New("NOT IMPLEMENTED")
}

View File

@@ -1,12 +1,18 @@
package mhfpacket
import (
"github.com/Andoryuuta/Erupe/network"
"github.com/Andoryuuta/byteframe"
"errors"
"erupe-ce/common/byteframe"
"erupe-ce/network"
"erupe-ce/network/clientctx"
)
// MsgMhfAddGuildWeeklyBonusExceptionalUser represents the MSG_MHF_ADD_GUILD_WEEKLY_BONUS_EXCEPTIONAL_USER
type MsgMhfAddGuildWeeklyBonusExceptionalUser struct{}
type MsgMhfAddGuildWeeklyBonusExceptionalUser struct {
AckHandle uint32
NumUsers uint8
}
// Opcode returns the ID associated with this packet type.
func (m *MsgMhfAddGuildWeeklyBonusExceptionalUser) Opcode() network.PacketID {
@@ -14,11 +20,13 @@ func (m *MsgMhfAddGuildWeeklyBonusExceptionalUser) Opcode() network.PacketID {
}
// Parse parses the packet from binary
func (m *MsgMhfAddGuildWeeklyBonusExceptionalUser) Parse(bf *byteframe.ByteFrame) error {
panic("Not implemented")
func (m *MsgMhfAddGuildWeeklyBonusExceptionalUser) Parse(bf *byteframe.ByteFrame, ctx *clientctx.ClientContext) 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) error {
panic("Not implemented")
func (m *MsgMhfAddGuildWeeklyBonusExceptionalUser) Build(bf *byteframe.ByteFrame, ctx *clientctx.ClientContext) error {
return errors.New("NOT IMPLEMENTED")
}

View File

@@ -1,8 +1,9 @@
package mhfpacket
import (
"github.com/Andoryuuta/Erupe/network"
"github.com/Andoryuuta/byteframe"
"erupe-ce/common/byteframe"
"erupe-ce/network"
"erupe-ce/network/clientctx"
)
// MsgMhfAddKouryouPoint represents the MSG_MHF_ADD_KOURYOU_POINT
@@ -17,13 +18,15 @@ func (m *MsgMhfAddKouryouPoint) Opcode() network.PacketID {
}
// Parse parses the packet from binary
func (m *MsgMhfAddKouryouPoint) Parse(bf *byteframe.ByteFrame) error {
func (m *MsgMhfAddKouryouPoint) Parse(bf *byteframe.ByteFrame, ctx *clientctx.ClientContext) 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) error {
panic("Not implemented")
func (m *MsgMhfAddKouryouPoint) Build(bf *byteframe.ByteFrame, ctx *clientctx.ClientContext) error {
bf.WriteUint32(m.AckHandle)
bf.WriteUint32(m.KouryouPoints)
return nil
}

View File

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

View File

@@ -1,12 +1,19 @@
package mhfpacket
import (
"github.com/Andoryuuta/Erupe/network"
"github.com/Andoryuuta/byteframe"
"errors"
"erupe-ce/common/byteframe"
"erupe-ce/network"
"erupe-ce/network/clientctx"
)
// MsgMhfAddUdPoint represents the MSG_MHF_ADD_UD_POINT
type MsgMhfAddUdPoint struct{}
type MsgMhfAddUdPoint struct {
AckHandle uint32
Unk1 uint32
Unk2 uint32
}
// Opcode returns the ID associated with this packet type.
func (m *MsgMhfAddUdPoint) Opcode() network.PacketID {
@@ -14,11 +21,16 @@ func (m *MsgMhfAddUdPoint) Opcode() network.PacketID {
}
// Parse parses the packet from binary
func (m *MsgMhfAddUdPoint) Parse(bf *byteframe.ByteFrame) error {
panic("Not implemented")
func (m *MsgMhfAddUdPoint) Parse(bf *byteframe.ByteFrame, ctx *clientctx.ClientContext) error {
m.AckHandle = bf.ReadUint32()
m.Unk1 = bf.ReadUint32()
m.Unk2 = bf.ReadUint32()
return nil
//panic("Not implemented")
}
// Build builds a binary packet from the current data.
func (m *MsgMhfAddUdPoint) Build(bf *byteframe.ByteFrame) error {
panic("Not implemented")
func (m *MsgMhfAddUdPoint) Build(bf *byteframe.ByteFrame, ctx *clientctx.ClientContext) error {
return errors.New("NOT IMPLEMENTED")
}

View File

@@ -1,12 +1,13 @@
package mhfpacket
import (
"github.com/Andoryuuta/Erupe/network"
"github.com/Andoryuuta/byteframe"
"erupe-ce/common/byteframe"
"erupe-ce/network"
"erupe-ce/network/clientctx"
)
// MsgMhfAddUdTacticsPoint represents the MSG_MHF_ADD_UD_TACTICS_POINT
type MsgMhfAddUdTacticsPoint struct{
type MsgMhfAddUdTacticsPoint struct {
AckHandle uint32
Unk0 uint16
Unk1 uint32
@@ -18,7 +19,7 @@ func (m *MsgMhfAddUdTacticsPoint) Opcode() network.PacketID {
}
// Parse parses the packet from binary
func (m *MsgMhfAddUdTacticsPoint) Parse(bf *byteframe.ByteFrame) error {
func (m *MsgMhfAddUdTacticsPoint) Parse(bf *byteframe.ByteFrame, ctx *clientctx.ClientContext) error {
m.AckHandle = bf.ReadUint32()
m.Unk0 = bf.ReadUint16()
m.Unk1 = bf.ReadUint32()
@@ -26,6 +27,9 @@ func (m *MsgMhfAddUdTacticsPoint) Parse(bf *byteframe.ByteFrame) error {
}
// Build builds a binary packet from the current data.
func (m *MsgMhfAddUdTacticsPoint) Build(bf *byteframe.ByteFrame) error {
panic("Not implemented")
func (m *MsgMhfAddUdTacticsPoint) Build(bf *byteframe.ByteFrame, ctx *clientctx.ClientContext) error {
bf.WriteUint32(m.AckHandle)
bf.WriteUint16(m.Unk0)
bf.WriteUint32(m.Unk1)
return nil
}

View File

@@ -1,12 +1,21 @@
package mhfpacket
import (
"github.com/Andoryuuta/Erupe/network"
"github.com/Andoryuuta/byteframe"
"errors"
"erupe-ce/common/byteframe"
"erupe-ce/network"
"erupe-ce/network/clientctx"
)
// MsgMhfAnnounce represents the MSG_MHF_ANNOUNCE
type MsgMhfAnnounce struct{}
type MsgMhfAnnounce struct {
AckHandle uint32
IPAddress uint32
Port uint16
StageID []byte
Type uint8
}
// Opcode returns the ID associated with this packet type.
func (m *MsgMhfAnnounce) Opcode() network.PacketID {
@@ -14,11 +23,20 @@ func (m *MsgMhfAnnounce) Opcode() network.PacketID {
}
// Parse parses the packet from binary
func (m *MsgMhfAnnounce) Parse(bf *byteframe.ByteFrame) error {
panic("Not implemented")
func (m *MsgMhfAnnounce) Parse(bf *byteframe.ByteFrame, ctx *clientctx.ClientContext) error {
m.AckHandle = bf.ReadUint32()
m.IPAddress = bf.ReadUint32()
m.Port = bf.ReadUint16()
_ = bf.ReadUint8()
_ = bf.ReadUint8()
_ = bf.ReadUint8()
m.StageID = bf.ReadBytes(32)
_ = bf.ReadUint32()
m.Type = bf.ReadUint8()
return nil
}
// Build builds a binary packet from the current data.
func (m *MsgMhfAnnounce) Build(bf *byteframe.ByteFrame) error {
panic("Not implemented")
func (m *MsgMhfAnnounce) Build(bf *byteframe.ByteFrame, ctx *clientctx.ClientContext) error {
return errors.New("NOT IMPLEMENTED")
}

View File

@@ -1,12 +1,19 @@
package mhfpacket
import (
"github.com/Andoryuuta/Erupe/network"
"github.com/Andoryuuta/byteframe"
"errors"
"erupe-ce/common/byteframe"
"erupe-ce/network"
"erupe-ce/network/clientctx"
)
// MsgMhfAnswerGuildScout represents the MSG_MHF_ANSWER_GUILD_SCOUT
type MsgMhfAnswerGuildScout struct{}
type MsgMhfAnswerGuildScout struct {
AckHandle uint32
LeaderID uint32
Answer bool
}
// Opcode returns the ID associated with this packet type.
func (m *MsgMhfAnswerGuildScout) Opcode() network.PacketID {
@@ -14,11 +21,14 @@ func (m *MsgMhfAnswerGuildScout) Opcode() network.PacketID {
}
// Parse parses the packet from binary
func (m *MsgMhfAnswerGuildScout) Parse(bf *byteframe.ByteFrame) error {
panic("Not implemented")
func (m *MsgMhfAnswerGuildScout) Parse(bf *byteframe.ByteFrame, ctx *clientctx.ClientContext) error {
m.AckHandle = bf.ReadUint32()
m.LeaderID = bf.ReadUint32()
m.Answer = bf.ReadBool()
return nil
}
// Build builds a binary packet from the current data.
func (m *MsgMhfAnswerGuildScout) Build(bf *byteframe.ByteFrame) error {
panic("Not implemented")
func (m *MsgMhfAnswerGuildScout) Build(bf *byteframe.ByteFrame, ctx *clientctx.ClientContext) error {
return errors.New("NOT IMPLEMENTED")
}

View File

@@ -1,12 +1,24 @@
package mhfpacket
import (
"github.com/Andoryuuta/Erupe/network"
"github.com/Andoryuuta/byteframe"
"errors"
"erupe-ce/common/bfutil"
"erupe-ce/common/stringsupport"
"erupe-ce/common/byteframe"
"erupe-ce/network"
"erupe-ce/network/clientctx"
)
// MsgMhfApplyBbsArticle represents the MSG_MHF_APPLY_BBS_ARTICLE
type MsgMhfApplyBbsArticle struct{}
type MsgMhfApplyBbsArticle struct {
AckHandle uint32
Unk0 uint32
Unk1 []byte
Name string
Title string
Description string
}
// Opcode returns the ID associated with this packet type.
func (m *MsgMhfApplyBbsArticle) Opcode() network.PacketID {
@@ -14,11 +26,17 @@ func (m *MsgMhfApplyBbsArticle) Opcode() network.PacketID {
}
// Parse parses the packet from binary
func (m *MsgMhfApplyBbsArticle) Parse(bf *byteframe.ByteFrame) error {
panic("Not implemented")
func (m *MsgMhfApplyBbsArticle) Parse(bf *byteframe.ByteFrame, ctx *clientctx.ClientContext) error {
m.AckHandle = bf.ReadUint32()
m.Unk0 = bf.ReadUint32()
m.Unk1 = bf.ReadBytes(16)
m.Name = stringsupport.SJISToUTF8(bfutil.UpToNull(bf.ReadBytes(32)))
m.Title = stringsupport.SJISToUTF8(bfutil.UpToNull(bf.ReadBytes(128)))
m.Description = stringsupport.SJISToUTF8(bfutil.UpToNull(bf.ReadBytes(256)))
return nil
}
// Build builds a binary packet from the current data.
func (m *MsgMhfApplyBbsArticle) Build(bf *byteframe.ByteFrame) error {
panic("Not implemented")
func (m *MsgMhfApplyBbsArticle) Build(bf *byteframe.ByteFrame, ctx *clientctx.ClientContext) error {
return errors.New("NOT IMPLEMENTED")
}

View File

@@ -1,12 +1,19 @@
package mhfpacket
import (
"github.com/Andoryuuta/Erupe/network"
"github.com/Andoryuuta/byteframe"
"errors"
"erupe-ce/common/byteframe"
"erupe-ce/network"
"erupe-ce/network/clientctx"
)
// MsgMhfApplyCampaign represents the MSG_MHF_APPLY_CAMPAIGN
type MsgMhfApplyCampaign struct{}
type MsgMhfApplyCampaign struct {
AckHandle uint32
Unk0 uint32
Unk1 uint16
Unk2 []byte
}
// Opcode returns the ID associated with this packet type.
func (m *MsgMhfApplyCampaign) Opcode() network.PacketID {
@@ -14,11 +21,15 @@ func (m *MsgMhfApplyCampaign) Opcode() network.PacketID {
}
// Parse parses the packet from binary
func (m *MsgMhfApplyCampaign) Parse(bf *byteframe.ByteFrame) error {
panic("Not implemented")
func (m *MsgMhfApplyCampaign) Parse(bf *byteframe.ByteFrame, ctx *clientctx.ClientContext) error {
m.AckHandle = bf.ReadUint32()
m.Unk0 = bf.ReadUint32()
m.Unk1 = bf.ReadUint16()
m.Unk2 = bf.ReadBytes(16)
return nil
}
// Build builds a binary packet from the current data.
func (m *MsgMhfApplyCampaign) Build(bf *byteframe.ByteFrame) error {
panic("Not implemented")
func (m *MsgMhfApplyCampaign) Build(bf *byteframe.ByteFrame, ctx *clientctx.ClientContext) error {
return errors.New("NOT IMPLEMENTED")
}

View File

@@ -1,12 +1,19 @@
package mhfpacket
import (
"github.com/Andoryuuta/Erupe/network"
"github.com/Andoryuuta/byteframe"
"erupe-ce/common/byteframe"
"erupe-ce/network"
"erupe-ce/network/clientctx"
)
// MsgMhfApplyDistItem represents the MSG_MHF_APPLY_DIST_ITEM
type MsgMhfApplyDistItem struct{}
type MsgMhfApplyDistItem struct {
AckHandle uint32
DistributionType uint8
DistributionID uint32
Unk2 uint32
Unk3 uint32
}
// Opcode returns the ID associated with this packet type.
func (m *MsgMhfApplyDistItem) Opcode() network.PacketID {
@@ -14,11 +21,21 @@ func (m *MsgMhfApplyDistItem) Opcode() network.PacketID {
}
// Parse parses the packet from binary
func (m *MsgMhfApplyDistItem) Parse(bf *byteframe.ByteFrame) error {
panic("Not implemented")
func (m *MsgMhfApplyDistItem) Parse(bf *byteframe.ByteFrame, ctx *clientctx.ClientContext) error {
m.AckHandle = bf.ReadUint32()
m.DistributionType = bf.ReadUint8()
m.DistributionID = bf.ReadUint32()
m.Unk2 = bf.ReadUint32()
m.Unk3 = bf.ReadUint32()
return nil
}
// Build builds a binary packet from the current data.
func (m *MsgMhfApplyDistItem) Build(bf *byteframe.ByteFrame) error {
panic("Not implemented")
func (m *MsgMhfApplyDistItem) Build(bf *byteframe.ByteFrame, ctx *clientctx.ClientContext) error {
bf.WriteUint32(m.AckHandle)
bf.WriteUint8(m.DistributionType)
bf.WriteUint32(m.DistributionID)
bf.WriteUint32(m.Unk2)
bf.WriteUint32(m.Unk3)
return nil
}

View File

@@ -1,12 +1,17 @@
package mhfpacket
import (
"github.com/Andoryuuta/Erupe/network"
"github.com/Andoryuuta/byteframe"
"erupe-ce/common/byteframe"
"erupe-ce/network"
"erupe-ce/network/clientctx"
)
// MsgMhfArrangeGuildMember represents the MSG_MHF_ARRANGE_GUILD_MEMBER
type MsgMhfArrangeGuildMember struct{}
type MsgMhfArrangeGuildMember struct {
AckHandle uint32
GuildID uint32
CharIDs []uint32
}
// Opcode returns the ID associated with this packet type.
func (m *MsgMhfArrangeGuildMember) Opcode() network.PacketID {
@@ -14,11 +19,29 @@ func (m *MsgMhfArrangeGuildMember) Opcode() network.PacketID {
}
// Parse parses the packet from binary
func (m *MsgMhfArrangeGuildMember) Parse(bf *byteframe.ByteFrame) error {
panic("Not implemented")
func (m *MsgMhfArrangeGuildMember) Parse(bf *byteframe.ByteFrame, ctx *clientctx.ClientContext) error {
m.AckHandle = bf.ReadUint32()
m.GuildID = bf.ReadUint32()
charCount := bf.ReadUint16()
m.CharIDs = make([]uint32, charCount)
for i := uint16(0); i < charCount; i++ {
m.CharIDs[i] = bf.ReadUint32()
}
return nil
}
// Build builds a binary packet from the current data.
func (m *MsgMhfArrangeGuildMember) Build(bf *byteframe.ByteFrame) error {
panic("Not implemented")
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
}

View File

@@ -1,12 +1,18 @@
package mhfpacket
import (
"github.com/Andoryuuta/Erupe/network"
"github.com/Andoryuuta/byteframe"
"errors"
"erupe-ce/common/byteframe"
"erupe-ce/network"
"erupe-ce/network/clientctx"
)
// MsgMhfCancelGuildMissionTarget represents the MSG_MHF_CANCEL_GUILD_MISSION_TARGET
type MsgMhfCancelGuildMissionTarget struct{}
type MsgMhfCancelGuildMissionTarget struct {
AckHandle uint32
MissionID uint32
}
// Opcode returns the ID associated with this packet type.
func (m *MsgMhfCancelGuildMissionTarget) Opcode() network.PacketID {
@@ -14,11 +20,13 @@ func (m *MsgMhfCancelGuildMissionTarget) Opcode() network.PacketID {
}
// Parse parses the packet from binary
func (m *MsgMhfCancelGuildMissionTarget) Parse(bf *byteframe.ByteFrame) error {
panic("Not implemented")
func (m *MsgMhfCancelGuildMissionTarget) Parse(bf *byteframe.ByteFrame, ctx *clientctx.ClientContext) 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) error {
panic("Not implemented")
func (m *MsgMhfCancelGuildMissionTarget) Build(bf *byteframe.ByteFrame, ctx *clientctx.ClientContext) error {
return errors.New("NOT IMPLEMENTED")
}

View File

@@ -1,12 +1,18 @@
package mhfpacket
import (
"github.com/Andoryuuta/Erupe/network"
"github.com/Andoryuuta/byteframe"
"errors"
"erupe-ce/common/byteframe"
"erupe-ce/network"
"erupe-ce/network/clientctx"
)
// MsgMhfCancelGuildScout represents the MSG_MHF_CANCEL_GUILD_SCOUT
type MsgMhfCancelGuildScout struct{}
type MsgMhfCancelGuildScout struct {
AckHandle uint32
InvitationID uint32
}
// Opcode returns the ID associated with this packet type.
func (m *MsgMhfCancelGuildScout) Opcode() network.PacketID {
@@ -14,11 +20,13 @@ func (m *MsgMhfCancelGuildScout) Opcode() network.PacketID {
}
// Parse parses the packet from binary
func (m *MsgMhfCancelGuildScout) Parse(bf *byteframe.ByteFrame) error {
panic("Not implemented")
func (m *MsgMhfCancelGuildScout) Parse(bf *byteframe.ByteFrame, ctx *clientctx.ClientContext) 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) error {
panic("Not implemented")
func (m *MsgMhfCancelGuildScout) Build(bf *byteframe.ByteFrame, ctx *clientctx.ClientContext) error {
return errors.New("NOT IMPLEMENTED")
}

View File

@@ -1,12 +1,20 @@
package mhfpacket
import (
"github.com/Andoryuuta/Erupe/network"
"github.com/Andoryuuta/byteframe"
"errors"
"erupe-ce/common/byteframe"
"erupe-ce/network"
"erupe-ce/network/clientctx"
)
// MsgMhfCaravanMyRank represents the MSG_MHF_CARAVAN_MY_RANK
type MsgMhfCaravanMyRank struct{}
type MsgMhfCaravanMyRank struct {
AckHandle uint32
Unk0 uint32
Unk1 uint32
Unk2 uint32
}
// Opcode returns the ID associated with this packet type.
func (m *MsgMhfCaravanMyRank) Opcode() network.PacketID {
@@ -14,11 +22,15 @@ func (m *MsgMhfCaravanMyRank) Opcode() network.PacketID {
}
// Parse parses the packet from binary
func (m *MsgMhfCaravanMyRank) Parse(bf *byteframe.ByteFrame) error {
panic("Not implemented")
func (m *MsgMhfCaravanMyRank) Parse(bf *byteframe.ByteFrame, ctx *clientctx.ClientContext) error {
m.AckHandle = bf.ReadUint32()
m.Unk0 = bf.ReadUint32()
m.Unk1 = bf.ReadUint32()
m.Unk2 = bf.ReadUint32()
return nil
}
// Build builds a binary packet from the current data.
func (m *MsgMhfCaravanMyRank) Build(bf *byteframe.ByteFrame) error {
panic("Not implemented")
func (m *MsgMhfCaravanMyRank) Build(bf *byteframe.ByteFrame, ctx *clientctx.ClientContext) error {
return errors.New("NOT IMPLEMENTED")
}

View File

@@ -1,12 +1,24 @@
package mhfpacket
import (
"github.com/Andoryuuta/Erupe/network"
"github.com/Andoryuuta/byteframe"
"errors"
"erupe-ce/common/byteframe"
"erupe-ce/network"
"erupe-ce/network/clientctx"
)
// MsgMhfCaravanMyScore represents the MSG_MHF_CARAVAN_MY_SCORE
type MsgMhfCaravanMyScore struct{}
type MsgMhfCaravanMyScore struct {
AckHandle uint32
Unk0 uint32
Unk1 uint32
Unk2 int32
Unk3 int32
Unk4 uint32
Unk5 int32
Unk6 int32
}
// Opcode returns the ID associated with this packet type.
func (m *MsgMhfCaravanMyScore) Opcode() network.PacketID {
@@ -14,11 +26,19 @@ func (m *MsgMhfCaravanMyScore) Opcode() network.PacketID {
}
// Parse parses the packet from binary
func (m *MsgMhfCaravanMyScore) Parse(bf *byteframe.ByteFrame) error {
panic("Not implemented")
func (m *MsgMhfCaravanMyScore) Parse(bf *byteframe.ByteFrame, ctx *clientctx.ClientContext) error {
m.AckHandle = bf.ReadUint32()
m.Unk0 = bf.ReadUint32()
m.Unk1 = bf.ReadUint32()
m.Unk2 = bf.ReadInt32()
m.Unk3 = bf.ReadInt32()
m.Unk4 = bf.ReadUint32()
m.Unk5 = bf.ReadInt32()
m.Unk6 = bf.ReadInt32()
return nil
}
// Build builds a binary packet from the current data.
func (m *MsgMhfCaravanMyScore) Build(bf *byteframe.ByteFrame) error {
panic("Not implemented")
func (m *MsgMhfCaravanMyScore) Build(bf *byteframe.ByteFrame, ctx *clientctx.ClientContext) error {
return errors.New("NOT IMPLEMENTED")
}

View File

@@ -1,12 +1,20 @@
package mhfpacket
import (
"github.com/Andoryuuta/Erupe/network"
"github.com/Andoryuuta/byteframe"
"errors"
"erupe-ce/common/byteframe"
"erupe-ce/network"
"erupe-ce/network/clientctx"
)
// MsgMhfCaravanRanking represents the MSG_MHF_CARAVAN_RANKING
type MsgMhfCaravanRanking struct{}
type MsgMhfCaravanRanking struct {
AckHandle uint32
Unk0 uint32
Unk1 uint32
Unk2 int32
}
// Opcode returns the ID associated with this packet type.
func (m *MsgMhfCaravanRanking) Opcode() network.PacketID {
@@ -14,11 +22,15 @@ func (m *MsgMhfCaravanRanking) Opcode() network.PacketID {
}
// Parse parses the packet from binary
func (m *MsgMhfCaravanRanking) Parse(bf *byteframe.ByteFrame) error {
panic("Not implemented")
func (m *MsgMhfCaravanRanking) Parse(bf *byteframe.ByteFrame, ctx *clientctx.ClientContext) error {
m.AckHandle = bf.ReadUint32()
m.Unk0 = bf.ReadUint32()
m.Unk1 = bf.ReadUint32()
m.Unk2 = bf.ReadInt32()
return nil
}
// Build builds a binary packet from the current data.
func (m *MsgMhfCaravanRanking) Build(bf *byteframe.ByteFrame) error {
panic("Not implemented")
func (m *MsgMhfCaravanRanking) Build(bf *byteframe.ByteFrame, ctx *clientctx.ClientContext) error {
return errors.New("NOT IMPLEMENTED")
}

View File

@@ -1,12 +1,20 @@
package mhfpacket
import (
"github.com/Andoryuuta/Erupe/network"
"github.com/Andoryuuta/byteframe"
"errors"
"erupe-ce/common/byteframe"
"erupe-ce/network"
"erupe-ce/network/clientctx"
)
// MsgMhfChargeFesta represents the MSG_MHF_CHARGE_FESTA
type MsgMhfChargeFesta struct{}
type MsgMhfChargeFesta struct {
AckHandle uint32
FestaID uint32
GuildID uint32
Souls int
}
// Opcode returns the ID associated with this packet type.
func (m *MsgMhfChargeFesta) Opcode() network.PacketID {
@@ -14,11 +22,19 @@ func (m *MsgMhfChargeFesta) Opcode() network.PacketID {
}
// Parse parses the packet from binary
func (m *MsgMhfChargeFesta) Parse(bf *byteframe.ByteFrame) error {
panic("Not implemented")
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
}
// Build builds a binary packet from the current data.
func (m *MsgMhfChargeFesta) Build(bf *byteframe.ByteFrame) error {
panic("Not implemented")
func (m *MsgMhfChargeFesta) Build(bf *byteframe.ByteFrame, ctx *clientctx.ClientContext) error {
return errors.New("NOT IMPLEMENTED")
}

View File

@@ -1,12 +1,19 @@
package mhfpacket
import (
"github.com/Andoryuuta/Erupe/network"
"github.com/Andoryuuta/byteframe"
"errors"
"erupe-ce/common/byteframe"
"erupe-ce/network"
"erupe-ce/network/clientctx"
)
// MsgMhfChargeGuildAdventure represents the MSG_MHF_CHARGE_GUILD_ADVENTURE
type MsgMhfChargeGuildAdventure struct{}
type MsgMhfChargeGuildAdventure struct {
AckHandle uint32
ID uint32
Amount uint32
}
// Opcode returns the ID associated with this packet type.
func (m *MsgMhfChargeGuildAdventure) Opcode() network.PacketID {
@@ -14,11 +21,14 @@ func (m *MsgMhfChargeGuildAdventure) Opcode() network.PacketID {
}
// Parse parses the packet from binary
func (m *MsgMhfChargeGuildAdventure) Parse(bf *byteframe.ByteFrame) error {
panic("Not implemented")
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
}
// Build builds a binary packet from the current data.
func (m *MsgMhfChargeGuildAdventure) Build(bf *byteframe.ByteFrame) error {
panic("Not implemented")
func (m *MsgMhfChargeGuildAdventure) Build(bf *byteframe.ByteFrame, ctx *clientctx.ClientContext) error {
return errors.New("NOT IMPLEMENTED")
}

View File

@@ -1,12 +1,16 @@
package mhfpacket
import (
"github.com/Andoryuuta/Erupe/network"
"github.com/Andoryuuta/byteframe"
"erupe-ce/common/byteframe"
"erupe-ce/network"
"erupe-ce/network/clientctx"
)
// MsgMhfCheckDailyCafepoint represents the MSG_MHF_CHECK_DAILY_CAFEPOINT
type MsgMhfCheckDailyCafepoint struct{}
type MsgMhfCheckDailyCafepoint struct {
AckHandle uint32
Unk uint32
}
// Opcode returns the ID associated with this packet type.
func (m *MsgMhfCheckDailyCafepoint) Opcode() network.PacketID {
@@ -14,11 +18,14 @@ func (m *MsgMhfCheckDailyCafepoint) Opcode() network.PacketID {
}
// Parse parses the packet from binary
func (m *MsgMhfCheckDailyCafepoint) Parse(bf *byteframe.ByteFrame) error {
panic("Not implemented")
func (m *MsgMhfCheckDailyCafepoint) Parse(bf *byteframe.ByteFrame, ctx *clientctx.ClientContext) error {
m.AckHandle = bf.ReadUint32()
m.Unk = bf.ReadUint32()
return nil
}
// Build builds a binary packet from the current data.
func (m *MsgMhfCheckDailyCafepoint) Build(bf *byteframe.ByteFrame) error {
panic("Not implemented")
func (m *MsgMhfCheckDailyCafepoint) Build(bf *byteframe.ByteFrame, ctx *clientctx.ClientContext) error {
bf.WriteUint32(m.AckHandle)
bf.WriteUint32(m.Unk)
return nil
}

View File

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

View File

@@ -1,14 +1,16 @@
package mhfpacket
import (
"github.com/Andoryuuta/Erupe/network"
"github.com/Andoryuuta/byteframe"
"errors"
"erupe-ce/common/byteframe"
"erupe-ce/network"
"erupe-ce/network/clientctx"
)
// MsgMhfCheckWeeklyStamp represents the MSG_MHF_CHECK_WEEKLY_STAMP
type MsgMhfCheckWeeklyStamp struct {
AckHandle uint32
Unk0 uint8
StampType string
Unk1 bool
Unk2 uint16 // Hardcoded 0 in the binary
}
@@ -19,15 +21,21 @@ func (m *MsgMhfCheckWeeklyStamp) Opcode() network.PacketID {
}
// Parse parses the packet from binary
func (m *MsgMhfCheckWeeklyStamp) Parse(bf *byteframe.ByteFrame) error {
func (m *MsgMhfCheckWeeklyStamp) Parse(bf *byteframe.ByteFrame, ctx *clientctx.ClientContext) error {
m.AckHandle = bf.ReadUint32()
m.Unk0 = bf.ReadUint8()
stampType := bf.ReadUint8()
switch stampType {
case 1:
m.StampType = "hl"
case 2:
m.StampType = "ex"
}
m.Unk1 = bf.ReadBool()
m.Unk2 = bf.ReadUint16()
return nil
}
// Build builds a binary packet from the current data.
func (m *MsgMhfCheckWeeklyStamp) Build(bf *byteframe.ByteFrame) error {
panic("Not implemented")
func (m *MsgMhfCheckWeeklyStamp) Build(bf *byteframe.ByteFrame, ctx *clientctx.ClientContext) error {
return errors.New("NOT IMPLEMENTED")
}

View File

@@ -1,12 +1,20 @@
package mhfpacket
import (
"github.com/Andoryuuta/Erupe/network"
"github.com/Andoryuuta/byteframe"
"errors"
"erupe-ce/common/byteframe"
"erupe-ce/network"
"erupe-ce/network/clientctx"
)
// MsgMhfContractMercenary represents the MSG_MHF_CONTRACT_MERCENARY
type MsgMhfContractMercenary struct{}
type MsgMhfContractMercenary struct {
AckHandle uint32
PactMercID uint32
CID uint32
Op uint8
}
// Opcode returns the ID associated with this packet type.
func (m *MsgMhfContractMercenary) Opcode() network.PacketID {
@@ -14,11 +22,15 @@ func (m *MsgMhfContractMercenary) Opcode() network.PacketID {
}
// Parse parses the packet from binary
func (m *MsgMhfContractMercenary) Parse(bf *byteframe.ByteFrame) error {
panic("Not implemented")
func (m *MsgMhfContractMercenary) Parse(bf *byteframe.ByteFrame, ctx *clientctx.ClientContext) error {
m.AckHandle = bf.ReadUint32()
m.PactMercID = bf.ReadUint32()
m.CID = bf.ReadUint32()
m.Op = bf.ReadUint8()
return nil
}
// Build builds a binary packet from the current data.
func (m *MsgMhfContractMercenary) Build(bf *byteframe.ByteFrame) error {
panic("Not implemented")
func (m *MsgMhfContractMercenary) Build(bf *byteframe.ByteFrame, ctx *clientctx.ClientContext) error {
return errors.New("NOT IMPLEMENTED")
}

View File

@@ -1,12 +1,21 @@
package mhfpacket
import (
"github.com/Andoryuuta/Erupe/network"
"github.com/Andoryuuta/byteframe"
"errors"
"erupe-ce/common/byteframe"
"erupe-ce/common/stringsupport"
"erupe-ce/network"
"erupe-ce/network/clientctx"
)
// MsgMhfCreateGuild represents the MSG_MHF_CREATE_GUILD
type MsgMhfCreateGuild struct{}
type MsgMhfCreateGuild struct {
AckHandle uint32
Unk0 uint8
Unk1 uint8
Name string
}
// Opcode returns the ID associated with this packet type.
func (m *MsgMhfCreateGuild) Opcode() network.PacketID {
@@ -14,11 +23,16 @@ func (m *MsgMhfCreateGuild) Opcode() network.PacketID {
}
// Parse parses the packet from binary
func (m *MsgMhfCreateGuild) Parse(bf *byteframe.ByteFrame) error {
panic("Not implemented")
func (m *MsgMhfCreateGuild) Parse(bf *byteframe.ByteFrame, ctx *clientctx.ClientContext) error {
m.AckHandle = bf.ReadUint32()
m.Unk0 = bf.ReadUint8()
m.Unk1 = bf.ReadUint8()
_ = bf.ReadUint16() // len
m.Name = stringsupport.SJISToUTF8(bf.ReadNullTerminatedBytes())
return nil
}
// Build builds a binary packet from the current data.
func (m *MsgMhfCreateGuild) Build(bf *byteframe.ByteFrame) error {
panic("Not implemented")
func (m *MsgMhfCreateGuild) Build(bf *byteframe.ByteFrame, ctx *clientctx.ClientContext) error {
return errors.New("NOT IMPLEMENTED")
}

View File

@@ -1,12 +1,20 @@
package mhfpacket
import (
"github.com/Andoryuuta/Erupe/network"
"github.com/Andoryuuta/byteframe"
"errors"
"erupe-ce/common/byteframe"
"erupe-ce/common/stringsupport"
"erupe-ce/network"
"erupe-ce/network/clientctx"
)
// MsgMhfCreateJoint represents the MSG_MHF_CREATE_JOINT
type MsgMhfCreateJoint struct{}
type MsgMhfCreateJoint struct {
AckHandle uint32
GuildID uint32
Name string
}
// Opcode returns the ID associated with this packet type.
func (m *MsgMhfCreateJoint) Opcode() network.PacketID {
@@ -14,11 +22,15 @@ func (m *MsgMhfCreateJoint) Opcode() network.PacketID {
}
// Parse parses the packet from binary
func (m *MsgMhfCreateJoint) Parse(bf *byteframe.ByteFrame) error {
panic("Not implemented")
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
}
// Build builds a binary packet from the current data.
func (m *MsgMhfCreateJoint) Build(bf *byteframe.ByteFrame) error {
panic("Not implemented")
func (m *MsgMhfCreateJoint) Build(bf *byteframe.ByteFrame, ctx *clientctx.ClientContext) error {
return errors.New("NOT IMPLEMENTED")
}

View File

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

View File

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

View File

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

View File

@@ -1,8 +1,11 @@
package mhfpacket
import (
"github.com/Andoryuuta/Erupe/network"
"github.com/Andoryuuta/byteframe"
"errors"
"erupe-ce/common/byteframe"
"erupe-ce/network"
"erupe-ce/network/clientctx"
)
// MsgMhfEnterTournamentQuest represents the MSG_MHF_ENTER_TOURNAMENT_QUEST
@@ -14,11 +17,11 @@ func (m *MsgMhfEnterTournamentQuest) Opcode() network.PacketID {
}
// Parse parses the packet from binary
func (m *MsgMhfEnterTournamentQuest) Parse(bf *byteframe.ByteFrame) error {
panic("Not implemented")
func (m *MsgMhfEnterTournamentQuest) Parse(bf *byteframe.ByteFrame, ctx *clientctx.ClientContext) error {
return errors.New("NOT IMPLEMENTED")
}
// Build builds a binary packet from the current data.
func (m *MsgMhfEnterTournamentQuest) Build(bf *byteframe.ByteFrame) error {
panic("Not implemented")
func (m *MsgMhfEnterTournamentQuest) Build(bf *byteframe.ByteFrame, ctx *clientctx.ClientContext) error {
return errors.New("NOT IMPLEMENTED")
}

View File

@@ -1,12 +1,19 @@
package mhfpacket
import (
"github.com/Andoryuuta/Erupe/network"
"github.com/Andoryuuta/byteframe"
"errors"
"erupe-ce/common/byteframe"
"erupe-ce/network"
"erupe-ce/network/clientctx"
)
// MsgMhfEntryFesta represents the MSG_MHF_ENTRY_FESTA
type MsgMhfEntryFesta struct{}
type MsgMhfEntryFesta struct {
AckHandle uint32
FestaID uint32
GuildID uint32
}
// Opcode returns the ID associated with this packet type.
func (m *MsgMhfEntryFesta) Opcode() network.PacketID {
@@ -14,11 +21,15 @@ func (m *MsgMhfEntryFesta) Opcode() network.PacketID {
}
// Parse parses the packet from binary
func (m *MsgMhfEntryFesta) Parse(bf *byteframe.ByteFrame) error {
panic("Not implemented")
func (m *MsgMhfEntryFesta) Parse(bf *byteframe.ByteFrame, ctx *clientctx.ClientContext) error {
m.AckHandle = bf.ReadUint32()
m.FestaID = bf.ReadUint32()
m.GuildID = bf.ReadUint32()
_ = bf.ReadUint16() // Always 0
return nil
}
// Build builds a binary packet from the current data.
func (m *MsgMhfEntryFesta) Build(bf *byteframe.ByteFrame) error {
panic("Not implemented")
func (m *MsgMhfEntryFesta) Build(bf *byteframe.ByteFrame, ctx *clientctx.ClientContext) error {
return errors.New("NOT IMPLEMENTED")
}

View File

@@ -1,12 +1,18 @@
package mhfpacket
import (
"github.com/Andoryuuta/Erupe/network"
"github.com/Andoryuuta/byteframe"
"errors"
"erupe-ce/common/byteframe"
"erupe-ce/network"
"erupe-ce/network/clientctx"
)
// MsgMhfEntryRookieGuild represents the MSG_MHF_ENTRY_ROOKIE_GUILD
type MsgMhfEntryRookieGuild struct{}
type MsgMhfEntryRookieGuild struct {
AckHandle uint32
Unk uint32
}
// Opcode returns the ID associated with this packet type.
func (m *MsgMhfEntryRookieGuild) Opcode() network.PacketID {
@@ -14,11 +20,13 @@ func (m *MsgMhfEntryRookieGuild) Opcode() network.PacketID {
}
// Parse parses the packet from binary
func (m *MsgMhfEntryRookieGuild) Parse(bf *byteframe.ByteFrame) error {
panic("Not implemented")
func (m *MsgMhfEntryRookieGuild) Parse(bf *byteframe.ByteFrame, ctx *clientctx.ClientContext) error {
m.AckHandle = bf.ReadUint32()
m.Unk = bf.ReadUint32()
return nil
}
// Build builds a binary packet from the current data.
func (m *MsgMhfEntryRookieGuild) Build(bf *byteframe.ByteFrame) error {
panic("Not implemented")
func (m *MsgMhfEntryRookieGuild) Build(bf *byteframe.ByteFrame, ctx *clientctx.ClientContext) error {
return errors.New("NOT IMPLEMENTED")
}

View File

@@ -1,12 +1,19 @@
package mhfpacket
import (
"github.com/Andoryuuta/Erupe/network"
"github.com/Andoryuuta/byteframe"
"errors"
"erupe-ce/common/byteframe"
"erupe-ce/network"
"erupe-ce/network/clientctx"
)
// MsgMhfEntryTournament represents the MSG_MHF_ENTRY_TOURNAMENT
type MsgMhfEntryTournament struct{}
type MsgMhfEntryTournament struct {
AckHandle uint32
TournamentID uint32
Unk0 uint8
}
// Opcode returns the ID associated with this packet type.
func (m *MsgMhfEntryTournament) Opcode() network.PacketID {
@@ -14,11 +21,14 @@ func (m *MsgMhfEntryTournament) Opcode() network.PacketID {
}
// Parse parses the packet from binary
func (m *MsgMhfEntryTournament) Parse(bf *byteframe.ByteFrame) error {
panic("Not implemented")
func (m *MsgMhfEntryTournament) Parse(bf *byteframe.ByteFrame, ctx *clientctx.ClientContext) error {
m.AckHandle = bf.ReadUint32()
m.TournamentID = bf.ReadUint32()
m.Unk0 = bf.ReadUint8()
return nil
}
// Build builds a binary packet from the current data.
func (m *MsgMhfEntryTournament) Build(bf *byteframe.ByteFrame) error {
panic("Not implemented")
func (m *MsgMhfEntryTournament) Build(bf *byteframe.ByteFrame, ctx *clientctx.ClientContext) error {
return errors.New("NOT IMPLEMENTED")
}

View File

@@ -1,12 +1,19 @@
package mhfpacket
import (
"github.com/Andoryuuta/Erupe/network"
"github.com/Andoryuuta/byteframe"
"errors"
"erupe-ce/common/byteframe"
"erupe-ce/network"
"erupe-ce/network/clientctx"
)
// MsgMhfEnumerateAiroulist represents the MSG_MHF_ENUMERATE_AIROULIST
type MsgMhfEnumerateAiroulist struct{}
type MsgMhfEnumerateAiroulist struct {
AckHandle uint32
Unk0 uint16
Unk1 uint16
}
// Opcode returns the ID associated with this packet type.
func (m *MsgMhfEnumerateAiroulist) Opcode() network.PacketID {
@@ -14,11 +21,14 @@ func (m *MsgMhfEnumerateAiroulist) Opcode() network.PacketID {
}
// Parse parses the packet from binary
func (m *MsgMhfEnumerateAiroulist) Parse(bf *byteframe.ByteFrame) error {
panic("Not implemented")
func (m *MsgMhfEnumerateAiroulist) Parse(bf *byteframe.ByteFrame, ctx *clientctx.ClientContext) error {
m.AckHandle = bf.ReadUint32()
m.Unk0 = bf.ReadUint16()
m.Unk1 = bf.ReadUint16()
return nil
}
// Build builds a binary packet from the current data.
func (m *MsgMhfEnumerateAiroulist) Build(bf *byteframe.ByteFrame) error {
panic("Not implemented")
func (m *MsgMhfEnumerateAiroulist) Build(bf *byteframe.ByteFrame, ctx *clientctx.ClientContext) error {
return errors.New("NOT IMPLEMENTED")
}

View File

@@ -1,12 +1,17 @@
package mhfpacket
import (
"github.com/Andoryuuta/Erupe/network"
"github.com/Andoryuuta/byteframe"
"erupe-ce/common/byteframe"
"erupe-ce/network"
"erupe-ce/network/clientctx"
)
// MsgMhfEnumerateCampaign represents the MSG_MHF_ENUMERATE_CAMPAIGN
type MsgMhfEnumerateCampaign struct{}
type MsgMhfEnumerateCampaign struct {
AckHandle uint32
Unk0 uint16
Unk1 uint16
}
// Opcode returns the ID associated with this packet type.
func (m *MsgMhfEnumerateCampaign) Opcode() network.PacketID {
@@ -14,11 +19,17 @@ func (m *MsgMhfEnumerateCampaign) Opcode() network.PacketID {
}
// Parse parses the packet from binary
func (m *MsgMhfEnumerateCampaign) Parse(bf *byteframe.ByteFrame) error {
panic("Not implemented")
func (m *MsgMhfEnumerateCampaign) Parse(bf *byteframe.ByteFrame, ctx *clientctx.ClientContext) error {
m.AckHandle = bf.ReadUint32()
m.Unk0 = bf.ReadUint16()
m.Unk1 = bf.ReadUint16()
return nil
}
// Build builds a binary packet from the current data.
func (m *MsgMhfEnumerateCampaign) Build(bf *byteframe.ByteFrame) error {
panic("Not implemented")
func (m *MsgMhfEnumerateCampaign) Build(bf *byteframe.ByteFrame, ctx *clientctx.ClientContext) error {
bf.WriteUint32(m.AckHandle)
bf.WriteUint16(m.Unk0)
bf.WriteUint16(m.Unk1)
return nil
}

View File

@@ -1,12 +1,18 @@
package mhfpacket
import (
"github.com/Andoryuuta/Erupe/network"
"github.com/Andoryuuta/byteframe"
"erupe-ce/common/byteframe"
"erupe-ce/network"
"erupe-ce/network/clientctx"
)
// MsgMhfEnumerateDistItem represents the MSG_MHF_ENUMERATE_DIST_ITEM
type MsgMhfEnumerateDistItem struct{}
type MsgMhfEnumerateDistItem struct {
AckHandle uint32
Unk0 uint8
Unk1 uint16
Unk2 uint16
}
// Opcode returns the ID associated with this packet type.
func (m *MsgMhfEnumerateDistItem) Opcode() network.PacketID {
@@ -14,11 +20,19 @@ func (m *MsgMhfEnumerateDistItem) Opcode() network.PacketID {
}
// Parse parses the packet from binary
func (m *MsgMhfEnumerateDistItem) Parse(bf *byteframe.ByteFrame) error {
panic("Not implemented")
func (m *MsgMhfEnumerateDistItem) Parse(bf *byteframe.ByteFrame, ctx *clientctx.ClientContext) error {
m.AckHandle = bf.ReadUint32()
m.Unk0 = bf.ReadUint8()
m.Unk1 = bf.ReadUint16()
m.Unk2 = bf.ReadUint16()
return nil
}
// Build builds a binary packet from the current data.
func (m *MsgMhfEnumerateDistItem) Build(bf *byteframe.ByteFrame) error {
panic("Not implemented")
func (m *MsgMhfEnumerateDistItem) Build(bf *byteframe.ByteFrame, ctx *clientctx.ClientContext) error {
bf.WriteUint32(m.AckHandle)
bf.WriteUint8(m.Unk0)
bf.WriteUint16(m.Unk1)
bf.WriteUint16(m.Unk2)
return nil
}

View File

@@ -1,8 +1,9 @@
package mhfpacket
import (
"github.com/Andoryuuta/Erupe/network"
"github.com/Andoryuuta/byteframe"
"erupe-ce/common/byteframe"
"erupe-ce/network"
"erupe-ce/network/clientctx"
)
// MsgMhfEnumerateEvent represents the MSG_MHF_ENUMERATE_EVENT
@@ -18,7 +19,7 @@ func (m *MsgMhfEnumerateEvent) Opcode() network.PacketID {
}
// Parse parses the packet from binary
func (m *MsgMhfEnumerateEvent) Parse(bf *byteframe.ByteFrame) error {
func (m *MsgMhfEnumerateEvent) Parse(bf *byteframe.ByteFrame, ctx *clientctx.ClientContext) error {
m.AckHandle = bf.ReadUint32()
m.Unk0 = bf.ReadUint16()
m.Unk1 = bf.ReadUint16()
@@ -26,6 +27,9 @@ func (m *MsgMhfEnumerateEvent) Parse(bf *byteframe.ByteFrame) error {
}
// Build builds a binary packet from the current data.
func (m *MsgMhfEnumerateEvent) Build(bf *byteframe.ByteFrame) error {
panic("Not implemented")
func (m *MsgMhfEnumerateEvent) Build(bf *byteframe.ByteFrame, ctx *clientctx.ClientContext) error {
bf.WriteUint32(m.AckHandle)
bf.WriteUint16(m.Unk0)
bf.WriteUint16(m.Unk1)
return nil
}

View File

@@ -1,8 +1,11 @@
package mhfpacket
import (
"github.com/Andoryuuta/Erupe/network"
"github.com/Andoryuuta/byteframe"
"errors"
"erupe-ce/common/byteframe"
"erupe-ce/network"
"erupe-ce/network/clientctx"
)
// MsgMhfEnumerateFestaIntermediatePrize represents the MSG_MHF_ENUMERATE_FESTA_INTERMEDIATE_PRIZE
@@ -16,12 +19,12 @@ func (m *MsgMhfEnumerateFestaIntermediatePrize) Opcode() network.PacketID {
}
// Parse parses the packet from binary
func (m *MsgMhfEnumerateFestaIntermediatePrize) Parse(bf *byteframe.ByteFrame) error {
func (m *MsgMhfEnumerateFestaIntermediatePrize) Parse(bf *byteframe.ByteFrame, ctx *clientctx.ClientContext) error {
m.AckHandle = bf.ReadUint32()
return nil
}
// Build builds a binary packet from the current data.
func (m *MsgMhfEnumerateFestaIntermediatePrize) Build(bf *byteframe.ByteFrame) error {
panic("Not implemented")
func (m *MsgMhfEnumerateFestaIntermediatePrize) Build(bf *byteframe.ByteFrame, ctx *clientctx.ClientContext) error {
return errors.New("NOT IMPLEMENTED")
}

View File

@@ -1,12 +1,19 @@
package mhfpacket
import (
"github.com/Andoryuuta/Erupe/network"
"github.com/Andoryuuta/byteframe"
"errors"
"erupe-ce/common/byteframe"
"erupe-ce/network"
"erupe-ce/network/clientctx"
)
// MsgMhfEnumerateFestaMember represents the MSG_MHF_ENUMERATE_FESTA_MEMBER
type MsgMhfEnumerateFestaMember struct{}
type MsgMhfEnumerateFestaMember struct {
AckHandle uint32
FestaID uint32
GuildID uint32
}
// Opcode returns the ID associated with this packet type.
func (m *MsgMhfEnumerateFestaMember) Opcode() network.PacketID {
@@ -14,11 +21,15 @@ func (m *MsgMhfEnumerateFestaMember) Opcode() network.PacketID {
}
// Parse parses the packet from binary
func (m *MsgMhfEnumerateFestaMember) Parse(bf *byteframe.ByteFrame) error {
panic("Not implemented")
func (m *MsgMhfEnumerateFestaMember) Parse(bf *byteframe.ByteFrame, ctx *clientctx.ClientContext) error {
m.AckHandle = bf.ReadUint32()
m.FestaID = bf.ReadUint32()
m.GuildID = bf.ReadUint32()
_ = bf.ReadUint16() // Hardcoded 0 in the binary.
return nil
}
// Build builds a binary packet from the current data.
func (m *MsgMhfEnumerateFestaMember) Build(bf *byteframe.ByteFrame) error {
panic("Not implemented")
func (m *MsgMhfEnumerateFestaMember) Build(bf *byteframe.ByteFrame, ctx *clientctx.ClientContext) error {
return errors.New("NOT IMPLEMENTED")
}

View File

@@ -1,8 +1,11 @@
package mhfpacket
import (
"github.com/Andoryuuta/Erupe/network"
"github.com/Andoryuuta/byteframe"
"errors"
"erupe-ce/common/byteframe"
"erupe-ce/network"
"erupe-ce/network/clientctx"
)
// MsgMhfEnumerateFestaPersonalPrize represents the MSG_MHF_ENUMERATE_FESTA_PERSONAL_PRIZE
@@ -16,12 +19,12 @@ func (m *MsgMhfEnumerateFestaPersonalPrize) Opcode() network.PacketID {
}
// Parse parses the packet from binary
func (m *MsgMhfEnumerateFestaPersonalPrize) Parse(bf *byteframe.ByteFrame) error {
func (m *MsgMhfEnumerateFestaPersonalPrize) Parse(bf *byteframe.ByteFrame, ctx *clientctx.ClientContext) error {
m.AckHandle = bf.ReadUint32()
return nil
}
// Build builds a binary packet from the current data.
func (m *MsgMhfEnumerateFestaPersonalPrize) Build(bf *byteframe.ByteFrame) error {
panic("Not implemented")
func (m *MsgMhfEnumerateFestaPersonalPrize) Build(bf *byteframe.ByteFrame, ctx *clientctx.ClientContext) error {
return errors.New("NOT IMPLEMENTED")
}

View File

@@ -1,16 +1,17 @@
package mhfpacket
import (
"github.com/Andoryuuta/Erupe/network"
"github.com/Andoryuuta/byteframe"
"errors"
"erupe-ce/common/byteframe"
"erupe-ce/network"
"erupe-ce/network/clientctx"
)
// MsgMhfEnumerateGuacot represents the MSG_MHF_ENUMERATE_GUACOT
type MsgMhfEnumerateGuacot struct {
AckHandle uint32
Unk0 uint16 // Hardcoded 0 in binary
Unk0 uint32 // Hardcoded 0 in binary
Unk1 uint16 // Hardcoded 0 in binary
Unk2 uint16 // Hardcoded 0 in binary
}
// Opcode returns the ID associated with this packet type.
@@ -19,15 +20,14 @@ func (m *MsgMhfEnumerateGuacot) Opcode() network.PacketID {
}
// Parse parses the packet from binary
func (m *MsgMhfEnumerateGuacot) Parse(bf *byteframe.ByteFrame) error {
func (m *MsgMhfEnumerateGuacot) Parse(bf *byteframe.ByteFrame, ctx *clientctx.ClientContext) error {
m.AckHandle = bf.ReadUint32()
m.Unk0 = bf.ReadUint16()
m.Unk0 = bf.ReadUint32()
m.Unk1 = bf.ReadUint16()
m.Unk2 = bf.ReadUint16()
return nil
}
// Build builds a binary packet from the current data.
func (m *MsgMhfEnumerateGuacot) Build(bf *byteframe.ByteFrame) error {
panic("Not implemented")
func (m *MsgMhfEnumerateGuacot) Build(bf *byteframe.ByteFrame, ctx *clientctx.ClientContext) error {
return errors.New("NOT IMPLEMENTED")
}

View File

@@ -1,12 +1,42 @@
package mhfpacket
import (
"github.com/Andoryuuta/Erupe/network"
"github.com/Andoryuuta/byteframe"
"errors"
"erupe-ce/common/bfutil"
"erupe-ce/common/byteframe"
"erupe-ce/common/stringsupport"
"erupe-ce/network"
"erupe-ce/network/clientctx"
)
type EnumerateGuildType uint8
const (
ENUMERATE_GUILD_UNKNOWN = iota
ENUMERATE_GUILD_TYPE_GUILD_NAME
ENUMERATE_GUILD_TYPE_LEADER_NAME
ENUMERATE_GUILD_TYPE_LEADER_ID
ENUMERATE_GUILD_TYPE_ORDER_MEMBERS
ENUMERATE_GUILD_TYPE_ORDER_REGISTRATION
ENUMERATE_GUILD_TYPE_ORDER_RANK
ENUMERATE_GUILD_TYPE_MOTTO
ENUMERATE_GUILD_TYPE_RECRUITING
ENUMERATE_ALLIANCE_TYPE_ALLIANCE_NAME
ENUMERATE_ALLIANCE_TYPE_LEADER_NAME
ENUMERATE_ALLIANCE_TYPE_LEADER_ID
ENUMERATE_ALLIANCE_TYPE_ORDER_MEMBERS
ENUMERATE_ALLIANCE_TYPE_ORDER_REGISTRATION
)
// MsgMhfEnumerateGuild represents the MSG_MHF_ENUMERATE_GUILD
type MsgMhfEnumerateGuild struct{}
type MsgMhfEnumerateGuild struct {
AckHandle uint32
Type EnumerateGuildType
Page uint8
Sorting bool
Data1 []byte
Data2 string
}
// Opcode returns the ID associated with this packet type.
func (m *MsgMhfEnumerateGuild) Opcode() network.PacketID {
@@ -14,11 +44,21 @@ func (m *MsgMhfEnumerateGuild) Opcode() network.PacketID {
}
// Parse parses the packet from binary
func (m *MsgMhfEnumerateGuild) Parse(bf *byteframe.ByteFrame) error {
panic("Not implemented")
func (m *MsgMhfEnumerateGuild) Parse(bf *byteframe.ByteFrame, ctx *clientctx.ClientContext) error {
m.AckHandle = bf.ReadUint32()
m.Type = EnumerateGuildType(bf.ReadUint8())
m.Page = bf.ReadUint8()
m.Sorting = bf.ReadBool()
_ = bf.ReadBytes(1)
m.Data1 = bf.ReadBytes(4)
_ = bf.ReadBytes(2)
lenData2 := uint(bf.ReadUint8())
_ = bf.ReadBytes(1)
m.Data2 = stringsupport.SJISToUTF8(bfutil.UpToNull(bf.ReadBytes(lenData2)))
return nil
}
// Build builds a binary packet from the current data.
func (m *MsgMhfEnumerateGuild) Build(bf *byteframe.ByteFrame) error {
panic("Not implemented")
func (m *MsgMhfEnumerateGuild) Build(bf *byteframe.ByteFrame, ctx *clientctx.ClientContext) error {
return errors.New("NOT IMPLEMENTED")
}

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