mirror of
https://github.com/Mezeporta/Erupe.git
synced 2025-12-13 15:34:38 +01:00
Compare commits
54 Commits
tower-expe
...
chore/reor
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
7eef02061a | ||
|
|
db4120bb85 | ||
|
|
67a5dc412c | ||
|
|
d5bb0ac337 | ||
|
|
094855b984 | ||
|
|
674ac9bd47 | ||
|
|
5baff56517 | ||
|
|
fa35141f97 | ||
|
|
6075e9c756 | ||
|
|
b6f24ae22d | ||
|
|
e9ae953993 | ||
|
|
0fa7f37743 | ||
|
|
f6efbb39a6 | ||
|
|
35a0c910af | ||
|
|
89c364065f | ||
|
|
c46d8dea3f | ||
|
|
0af565a766 | ||
|
|
5f975c97b5 | ||
|
|
44692e986e | ||
|
|
32dbfa7514 | ||
|
|
830834c5b5 | ||
|
|
62fe5cf277 | ||
|
|
701d88166f | ||
|
|
738a46a01b | ||
|
|
e8fc650d49 | ||
|
|
4348aa02a8 | ||
|
|
8191994acb | ||
|
|
436e30f83d | ||
|
|
34e84f31df | ||
|
|
1432e8f2b8 | ||
|
|
edd357fe50 | ||
|
|
ae32951671 | ||
|
|
2d48d63263 | ||
|
|
b20969ddc6 | ||
|
|
8f68e10f1d | ||
|
|
2c5896814f | ||
|
|
8a55c5ff89 | ||
|
|
7d760bd3b4 | ||
|
|
04008fceb8 | ||
|
|
1ab6940b01 | ||
|
|
ae759be046 | ||
|
|
459f382dd7 | ||
|
|
f545576fc9 | ||
|
|
4204ab1ecb | ||
|
|
717d785342 | ||
|
|
d29b7d00fc | ||
|
|
b755de269e | ||
|
|
0ef3b08e86 | ||
|
|
aa5d95e7c5 | ||
|
|
5de6570510 | ||
|
|
ca38f5671d | ||
|
|
632aa081b9 | ||
|
|
0caaeac3af | ||
|
|
843b6a9dff |
1
.dockerignore
Normal file
1
.dockerignore
Normal file
@@ -0,0 +1 @@
|
||||
bin/
|
||||
3
.gitignore
vendored
3
.gitignore
vendored
@@ -8,4 +8,5 @@ savedata/*/
|
||||
*.lnk
|
||||
*.bat
|
||||
/docker/db-data
|
||||
screenshots/*
|
||||
screenshots/*
|
||||
/docker/Servers
|
||||
92
config.json
92
config.json
@@ -17,13 +17,15 @@
|
||||
"UploadQuality":100
|
||||
},
|
||||
"DeleteOnSaveCorruption": false,
|
||||
"ClientMode": "G9.1",
|
||||
"ClientMode": "ZZ",
|
||||
"QuestCacheExpiry": 300,
|
||||
"CommandPrefix": "!",
|
||||
"AutoCreateAccount": true,
|
||||
"LoopDelay": 50,
|
||||
"DefaultCourses": [1, 23, 24],
|
||||
"EarthDebug": false,
|
||||
"EarthMonsters": [116, 107, 2, 36],
|
||||
"EarthStatus": 0,
|
||||
"EarthID": 0,
|
||||
"EarthMonsters": [0, 0, 0, 0],
|
||||
"SaveDumps": {
|
||||
"Enabled": true,
|
||||
"RawEnabled": false,
|
||||
@@ -46,8 +48,8 @@
|
||||
"CapLink": {
|
||||
"Values": [51728, 20000, 51729, 1, 20000],
|
||||
"Key": "",
|
||||
"Host": "127.0.0.1",
|
||||
"Port": 8080
|
||||
"Host": "",
|
||||
"Port": 80
|
||||
}
|
||||
},
|
||||
"GameplayOptions": {
|
||||
@@ -112,64 +114,52 @@
|
||||
"RelayChannelID": ""
|
||||
}
|
||||
},
|
||||
"Commands": [
|
||||
{
|
||||
"Name": "Help",
|
||||
"Commands": {
|
||||
"help": {
|
||||
"Enabled": true,
|
||||
"Description": "Show enabled chat commands",
|
||||
"Prefix": "help"
|
||||
}, {
|
||||
"Name": "Rights",
|
||||
"Description": "Show enabled chat commands"
|
||||
},
|
||||
"rights":{
|
||||
"Enabled": false,
|
||||
"Description": "Overwrite the Rights value on your account",
|
||||
"Prefix": "rights"
|
||||
}, {
|
||||
"Name": "Raviente",
|
||||
"Description": "Overwrite the Rights value on your account"
|
||||
},
|
||||
"ravi": {
|
||||
"Enabled": true,
|
||||
"Description": "Various Raviente siege commands",
|
||||
"Prefix": "ravi"
|
||||
}, {
|
||||
"Name": "Teleport",
|
||||
"Description": "Various Raviente siege commands"
|
||||
},
|
||||
"teleport": {
|
||||
"Enabled": false,
|
||||
"Description": "Teleport to specified coordinates",
|
||||
"Prefix": "tele"
|
||||
}, {
|
||||
"Name": "Reload",
|
||||
"Description": "Teleport to specified coordinates"
|
||||
},
|
||||
"reload": {
|
||||
"Enabled": true,
|
||||
"Description": "Reload all players in your Land",
|
||||
"Prefix": "reload"
|
||||
}, {
|
||||
"Name": "KeyQuest",
|
||||
"Description": "Reload all players in your Land"
|
||||
},
|
||||
"kqf":{
|
||||
"Enabled": false,
|
||||
"Description": "Overwrite your HR Key Quest progress",
|
||||
"Prefix": "kqf"
|
||||
}, {
|
||||
"Name": "Course",
|
||||
"Description": "Get or Set your HR Key Quest progress"
|
||||
},
|
||||
"course": {
|
||||
"Enabled": true,
|
||||
"Description": "Toggle Courses on your account",
|
||||
"Prefix": "course"
|
||||
}, {
|
||||
"Name": "PSN",
|
||||
"Description": "Toggle Courses on your account"
|
||||
},
|
||||
"psn": {
|
||||
"Enabled": true,
|
||||
"Description": "Link a PlayStation Network ID to your account",
|
||||
"Prefix": "psn"
|
||||
}, {
|
||||
"Name": "Discord",
|
||||
"Description": "Link a PlayStation Network ID to your account"
|
||||
},
|
||||
"discord": {
|
||||
"Enabled": true,
|
||||
"Description": "Generate a token to link your Discord account",
|
||||
"Prefix": "discord"
|
||||
}, {
|
||||
"Name": "Ban",
|
||||
"Description": "Generate a token to link your Discord account"
|
||||
},
|
||||
"ban": {
|
||||
"Enabled": false,
|
||||
"Description": "Ban/Temp Ban a user",
|
||||
"Prefix": "ban"
|
||||
}, {
|
||||
"Name": "Timer",
|
||||
"Description": "Ban/Temp Ban a user"
|
||||
},
|
||||
"timer": {
|
||||
"Enabled": true,
|
||||
"Description": "Toggle the Quest timer",
|
||||
"Prefix": "timer"
|
||||
"Description": "Toggle the Quest timer"
|
||||
}
|
||||
],
|
||||
},
|
||||
"Courses": [
|
||||
{"Name": "HunterLife", "Enabled": true},
|
||||
{"Name": "Extra", "Enabled": true},
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
package _config
|
||||
package config
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
@@ -6,6 +6,7 @@ import (
|
||||
"net"
|
||||
"os"
|
||||
"strings"
|
||||
"sync"
|
||||
"time"
|
||||
|
||||
"github.com/spf13/viper"
|
||||
@@ -77,12 +78,14 @@ type Config struct {
|
||||
PatchServerFile string // File patch server override
|
||||
DeleteOnSaveCorruption bool // Attempts to save corrupted data will flag the save for deletion
|
||||
ClientMode string
|
||||
RealClientMode Mode
|
||||
ClientID Mode
|
||||
QuestCacheExpiry int // Number of seconds to keep quest data cached
|
||||
CommandPrefix string // The prefix for commands
|
||||
AutoCreateAccount bool // Automatically create accounts if they don't exist
|
||||
LoopDelay int // Delay in milliseconds between each loop iteration
|
||||
DefaultCourses []uint16
|
||||
EarthDebug bool
|
||||
EarthStatus int32
|
||||
EarthID int32
|
||||
EarthMonsters []int32
|
||||
SaveDumps SaveDumpOptions
|
||||
Screenshots ScreenshotsOptions
|
||||
@@ -90,7 +93,7 @@ type Config struct {
|
||||
DebugOptions DebugOptions
|
||||
GameplayOptions GameplayOptions
|
||||
Discord Discord
|
||||
Commands []Command
|
||||
Commands map[string]Command
|
||||
Courses []Course
|
||||
Database Database
|
||||
Sign Sign
|
||||
@@ -297,15 +300,10 @@ type EntranceChannelInfo struct {
|
||||
CurrentPlayers uint16
|
||||
}
|
||||
|
||||
var ErupeConfig *Config
|
||||
|
||||
func init() {
|
||||
var err error
|
||||
ErupeConfig, err = LoadConfig()
|
||||
if err != nil {
|
||||
preventClose(fmt.Sprintf("Failed to load config: %s", err.Error()))
|
||||
}
|
||||
}
|
||||
var (
|
||||
once sync.Once
|
||||
ErupeConfig *Config
|
||||
)
|
||||
|
||||
// getOutboundIP4 gets the preferred outbound ip4 of this machine
|
||||
// From https://stackoverflow.com/a/37382208
|
||||
@@ -348,16 +346,16 @@ func LoadConfig() (*Config, error) {
|
||||
|
||||
for i := range versionStrings {
|
||||
if strings.ToUpper(c.ClientMode) == versionStrings[i] {
|
||||
c.RealClientMode = Mode(i + 1)
|
||||
c.ClientID = Mode(i + 1)
|
||||
c.ClientMode = strings.ToUpper(c.ClientMode)
|
||||
if c.RealClientMode <= G101 {
|
||||
if c.ClientID <= G101 {
|
||||
c.ClientMode += " (Debug only)"
|
||||
}
|
||||
}
|
||||
}
|
||||
if c.RealClientMode == 0 {
|
||||
if c.ClientID == 0 {
|
||||
c.ClientMode = versionStrings[len(versionStrings)-1]
|
||||
c.RealClientMode = ZZ
|
||||
c.ClientID = ZZ
|
||||
}
|
||||
|
||||
if c.GameplayOptions.MinFeatureWeapons > c.GameplayOptions.MaxFeatureWeapons {
|
||||
@@ -366,7 +364,16 @@ func LoadConfig() (*Config, error) {
|
||||
|
||||
return c, nil
|
||||
}
|
||||
|
||||
func GetConfig() *Config {
|
||||
once.Do(func() {
|
||||
var err error
|
||||
ErupeConfig, err = LoadConfig()
|
||||
if err != nil {
|
||||
preventClose(fmt.Sprintf("Failed to load config: %s", err.Error()))
|
||||
}
|
||||
})
|
||||
return ErupeConfig
|
||||
}
|
||||
func preventClose(text string) {
|
||||
if ErupeConfig.DisableSoftCrash {
|
||||
os.Exit(0)
|
||||
|
||||
@@ -64,3 +64,7 @@ if you want all the logs and you want it to be in an attached state
|
||||
```bash
|
||||
docker-compose up
|
||||
```
|
||||
|
||||
|
||||
# Troubleshooting
|
||||
Q: My Postgres will not populate. A: You're setup.sh is maybe saved as CRLF it needs to be saved as LF.
|
||||
BIN
erupe.ico
BIN
erupe.ico
Binary file not shown.
|
Before Width: | Height: | Size: 97 KiB After Width: | Height: | Size: 88 KiB |
18
internal/constant/cast.go
Normal file
18
internal/constant/cast.go
Normal file
@@ -0,0 +1,18 @@
|
||||
package constant
|
||||
|
||||
const (
|
||||
BinaryMessageTypeState = 0
|
||||
BinaryMessageTypeChat = 1
|
||||
BinaryMessageTypeQuest = 2
|
||||
BinaryMessageTypeData = 3
|
||||
BinaryMessageTypeMailNotify = 4
|
||||
BinaryMessageTypeEmote = 6
|
||||
)
|
||||
|
||||
// MSG_SYS_CAST[ED]_BINARY broadcast types enum
|
||||
const (
|
||||
BroadcastTypeTargeted = 0x01
|
||||
BroadcastTypeStage = 0x03
|
||||
BroadcastTypeServer = 0x06
|
||||
BroadcastTypeWorld = 0x0a
|
||||
)
|
||||
15
internal/constant/festa.go
Normal file
15
internal/constant/festa.go
Normal file
@@ -0,0 +1,15 @@
|
||||
package constant
|
||||
|
||||
import "erupe-ce/internal/model"
|
||||
|
||||
const (
|
||||
FestivalColorNone model.FestivalColor = "none"
|
||||
FestivalColorBlue model.FestivalColor = "blue"
|
||||
FestivalColorRed model.FestivalColor = "red"
|
||||
)
|
||||
|
||||
var FestivalColorCodes = map[model.FestivalColor]int16{
|
||||
FestivalColorNone: -1,
|
||||
FestivalColorBlue: 0,
|
||||
FestivalColorRed: 1,
|
||||
}
|
||||
8
internal/constant/guild.go
Normal file
8
internal/constant/guild.go
Normal file
@@ -0,0 +1,8 @@
|
||||
package constant
|
||||
|
||||
import "erupe-ce/internal/model"
|
||||
|
||||
const (
|
||||
GuildApplicationTypeApplied model.GuildApplicationType = "applied"
|
||||
GuildApplicationTypeInvited model.GuildApplicationType = "invited"
|
||||
)
|
||||
11
internal/model/achievements.go
Normal file
11
internal/model/achievements.go
Normal file
@@ -0,0 +1,11 @@
|
||||
package model
|
||||
|
||||
type Achievement struct {
|
||||
Level uint8
|
||||
Value uint32
|
||||
NextValue uint16
|
||||
Required uint32
|
||||
Updated bool
|
||||
Progress uint32
|
||||
Trophy uint8
|
||||
}
|
||||
12
internal/model/airou.go
Normal file
12
internal/model/airou.go
Normal file
@@ -0,0 +1,12 @@
|
||||
package model
|
||||
|
||||
type Airou struct {
|
||||
ID uint32
|
||||
Name []byte
|
||||
Task uint8
|
||||
Personality uint8
|
||||
Class uint8
|
||||
Experience uint32
|
||||
WeaponType uint8
|
||||
WeaponID uint16
|
||||
}
|
||||
10
internal/model/cafe.go
Normal file
10
internal/model/cafe.go
Normal file
@@ -0,0 +1,10 @@
|
||||
package model
|
||||
|
||||
type CafeBonus struct {
|
||||
ID uint32 `db:"id"`
|
||||
TimeReq uint32 `db:"time_req"`
|
||||
ItemType uint32 `db:"item_type"`
|
||||
ItemID uint32 `db:"item_id"`
|
||||
Quantity uint32 `db:"quantity"`
|
||||
Claimed bool `db:"claimed"`
|
||||
}
|
||||
41
internal/model/campaign.go
Normal file
41
internal/model/campaign.go
Normal file
@@ -0,0 +1,41 @@
|
||||
package model
|
||||
|
||||
import "time"
|
||||
|
||||
type CampaignEvent struct {
|
||||
ID uint32
|
||||
Unk0 uint32
|
||||
MinHR int16
|
||||
MaxHR int16
|
||||
MinSR int16
|
||||
MaxSR int16
|
||||
MinGR int16
|
||||
MaxGR int16
|
||||
Unk1 uint16
|
||||
Unk2 uint8
|
||||
Unk3 uint8
|
||||
Unk4 uint16
|
||||
Unk5 uint16
|
||||
Start time.Time
|
||||
End time.Time
|
||||
Unk6 uint8
|
||||
String0 string
|
||||
String1 string
|
||||
String2 string
|
||||
String3 string
|
||||
Link string
|
||||
Prefix string
|
||||
Categories []uint16
|
||||
}
|
||||
|
||||
type CampaignCategory struct {
|
||||
ID uint16
|
||||
Type uint8
|
||||
Title string
|
||||
Description string
|
||||
}
|
||||
|
||||
type CampaignLink struct {
|
||||
CategoryID uint16
|
||||
CampaignID uint32
|
||||
}
|
||||
27
internal/model/distribution.go
Normal file
27
internal/model/distribution.go
Normal file
@@ -0,0 +1,27 @@
|
||||
package model
|
||||
|
||||
import "time"
|
||||
|
||||
type Distribution struct {
|
||||
ID uint32 `db:"id"`
|
||||
Deadline time.Time `db:"deadline"`
|
||||
Rights uint32 `db:"rights"`
|
||||
TimesAcceptable uint16 `db:"times_acceptable"`
|
||||
TimesAccepted uint16 `db:"times_accepted"`
|
||||
MinHR int16 `db:"min_hr"`
|
||||
MaxHR int16 `db:"max_hr"`
|
||||
MinSR int16 `db:"min_sr"`
|
||||
MaxSR int16 `db:"max_sr"`
|
||||
MinGR int16 `db:"min_gr"`
|
||||
MaxGR int16 `db:"max_gr"`
|
||||
EventName string `db:"event_name"`
|
||||
Description string `db:"description"`
|
||||
Selection bool `db:"selection"`
|
||||
}
|
||||
|
||||
type DistributionItem struct {
|
||||
ItemType uint8 `db:"item_type"`
|
||||
ID uint32 `db:"id"`
|
||||
ItemID uint32 `db:"item_id"`
|
||||
Quantity uint32 `db:"quantity"`
|
||||
}
|
||||
31
internal/model/event.go
Normal file
31
internal/model/event.go
Normal file
@@ -0,0 +1,31 @@
|
||||
package model
|
||||
|
||||
import "time"
|
||||
|
||||
type Event struct {
|
||||
EventType uint16
|
||||
Unk1 uint16
|
||||
Unk2 uint16
|
||||
Unk3 uint16
|
||||
Unk4 uint16
|
||||
Unk5 uint32
|
||||
Unk6 uint32
|
||||
QuestFileIDs []uint16
|
||||
}
|
||||
|
||||
type LoginBoost struct {
|
||||
WeekReq uint8 `db:"week_req"`
|
||||
WeekCount uint8
|
||||
Active bool
|
||||
Expiration time.Time `db:"expiration"`
|
||||
Reset time.Time `db:"reset"`
|
||||
}
|
||||
|
||||
type ActiveFeature struct {
|
||||
StartTime time.Time `db:"start_time"`
|
||||
ActiveFeatures uint32 `db:"featured"`
|
||||
}
|
||||
type TrendWeapon struct {
|
||||
WeaponType uint8
|
||||
WeaponID uint16
|
||||
}
|
||||
32
internal/model/festa.go
Normal file
32
internal/model/festa.go
Normal file
@@ -0,0 +1,32 @@
|
||||
package model
|
||||
|
||||
type FestaTrial struct {
|
||||
ID uint32 `db:"id"`
|
||||
Objective uint16 `db:"objective"`
|
||||
GoalID uint32 `db:"goal_id"`
|
||||
TimesReq uint16 `db:"times_req"`
|
||||
Locale uint16 `db:"locale_req"`
|
||||
Reward uint16 `db:"reward"`
|
||||
Monopoly FestivalColor `db:"monopoly"`
|
||||
Unk uint16
|
||||
}
|
||||
|
||||
type FestaReward struct {
|
||||
Unk0 uint8
|
||||
Unk1 uint8
|
||||
ItemType uint16
|
||||
Quantity uint16
|
||||
ItemID uint16
|
||||
Unk5 uint16
|
||||
Unk6 uint16
|
||||
Unk7 uint8
|
||||
}
|
||||
|
||||
type FestaPrize struct {
|
||||
ID uint32 `db:"id"`
|
||||
Tier uint32 `db:"tier"`
|
||||
SoulsReq uint32 `db:"souls_req"`
|
||||
ItemID uint32 `db:"item_id"`
|
||||
NumItem uint32 `db:"num_item"`
|
||||
Claimed int `db:"claimed"`
|
||||
}
|
||||
58
internal/model/gacha.go
Normal file
58
internal/model/gacha.go
Normal file
@@ -0,0 +1,58 @@
|
||||
package model
|
||||
|
||||
type ShopItem struct {
|
||||
ID uint32 `db:"id"`
|
||||
ItemID uint32 `db:"item_id"`
|
||||
Cost uint32 `db:"cost"`
|
||||
Quantity uint16 `db:"quantity"`
|
||||
MinHR uint16 `db:"min_hr"`
|
||||
MinSR uint16 `db:"min_sr"`
|
||||
MinGR uint16 `db:"min_gr"`
|
||||
StoreLevel uint8 `db:"store_level"`
|
||||
MaxQuantity uint16 `db:"max_quantity"`
|
||||
UsedQuantity uint16 `db:"used_quantity"`
|
||||
RoadFloors uint16 `db:"road_floors"`
|
||||
RoadFatalis uint16 `db:"road_fatalis"`
|
||||
}
|
||||
|
||||
type Gacha struct {
|
||||
ID uint32 `db:"id"`
|
||||
MinGR uint32 `db:"min_gr"`
|
||||
MinHR uint32 `db:"min_hr"`
|
||||
Name string `db:"name"`
|
||||
URLBanner string `db:"url_banner"`
|
||||
URLFeature string `db:"url_feature"`
|
||||
URLThumbnail string `db:"url_thumbnail"`
|
||||
Wide bool `db:"wide"`
|
||||
Recommended bool `db:"recommended"`
|
||||
GachaType uint8 `db:"gacha_type"`
|
||||
Hidden bool `db:"hidden"`
|
||||
}
|
||||
|
||||
type GachaEntry struct {
|
||||
EntryType uint8 `db:"entry_type"`
|
||||
ID uint32 `db:"id"`
|
||||
ItemType uint8 `db:"item_type"`
|
||||
ItemNumber uint32 `db:"item_number"`
|
||||
ItemQuantity uint16 `db:"item_quantity"`
|
||||
Weight float64 `db:"weight"`
|
||||
Rarity uint8 `db:"rarity"`
|
||||
Rolls uint8 `db:"rolls"`
|
||||
FrontierPoints uint16 `db:"frontier_points"`
|
||||
DailyLimit uint8 `db:"daily_limit"`
|
||||
Name string `db:"name"`
|
||||
}
|
||||
|
||||
type GachaItem struct {
|
||||
ItemType uint8 `db:"item_type"`
|
||||
ItemID uint16 `db:"item_id"`
|
||||
Quantity uint16 `db:"quantity"`
|
||||
}
|
||||
type FPointExchange struct {
|
||||
ID uint32 `db:"id"`
|
||||
ItemType uint8 `db:"item_type"`
|
||||
ItemID uint16 `db:"item_id"`
|
||||
Quantity uint16 `db:"quantity"`
|
||||
FPoints uint16 `db:"fpoints"`
|
||||
Buyable bool `db:"buyable"`
|
||||
}
|
||||
102
internal/model/guild.go
Normal file
102
internal/model/guild.go
Normal file
@@ -0,0 +1,102 @@
|
||||
package model
|
||||
|
||||
import "time"
|
||||
|
||||
type GuildAdventure struct {
|
||||
ID uint32 `db:"id"`
|
||||
Destination uint32 `db:"destination"`
|
||||
Charge uint32 `db:"charge"`
|
||||
Depart uint32 `db:"depart"`
|
||||
Return uint32 `db:"return"`
|
||||
CollectedBy string `db:"collected_by"`
|
||||
}
|
||||
|
||||
type GuildTreasureHunt struct {
|
||||
HuntID uint32 `db:"id"`
|
||||
HostID uint32 `db:"host_id"`
|
||||
Destination uint32 `db:"destination"`
|
||||
Level uint32 `db:"level"`
|
||||
Start time.Time `db:"start"`
|
||||
Acquired bool `db:"acquired"`
|
||||
Collected bool `db:"collected"`
|
||||
HuntData []byte `db:"hunt_data"`
|
||||
Hunters uint32 `db:"hunters"`
|
||||
Claimed bool `db:"claimed"`
|
||||
}
|
||||
type GuildTreasureSouvenir struct {
|
||||
Destination uint32
|
||||
Quantity uint32
|
||||
}
|
||||
|
||||
type FestivalColor string
|
||||
type GuildApplicationType string
|
||||
|
||||
type GuildIconPart struct {
|
||||
Index uint16
|
||||
ID uint16
|
||||
Page uint8
|
||||
Size uint8
|
||||
Rotation uint8
|
||||
Red uint8
|
||||
Green uint8
|
||||
Blue uint8
|
||||
PosX uint16
|
||||
PosY uint16
|
||||
}
|
||||
|
||||
type GuildApplication struct {
|
||||
ID int `db:"id"`
|
||||
GuildID uint32 `db:"guild_id"`
|
||||
CharID uint32 `db:"character_id"`
|
||||
ActorID uint32 `db:"actor_id"`
|
||||
ApplicationType GuildApplicationType `db:"application_type"`
|
||||
CreatedAt time.Time `db:"created_at"`
|
||||
}
|
||||
|
||||
type GuildLeader struct {
|
||||
LeaderCharID uint32 `db:"leader_id"`
|
||||
LeaderName string `db:"leader_name"`
|
||||
}
|
||||
type MessageBoardPost struct {
|
||||
ID uint32 `db:"id"`
|
||||
StampID uint32 `db:"stamp_id"`
|
||||
Title string `db:"title"`
|
||||
Body string `db:"body"`
|
||||
AuthorID uint32 `db:"author_id"`
|
||||
Timestamp time.Time `db:"created_at"`
|
||||
LikedBy string `db:"liked_by"`
|
||||
}
|
||||
|
||||
type GuildMeal struct {
|
||||
ID uint32 `db:"id"`
|
||||
MealID uint32 `db:"meal_id"`
|
||||
Level uint32 `db:"level"`
|
||||
CreatedAt time.Time `db:"created_at"`
|
||||
}
|
||||
|
||||
type GuildMission struct {
|
||||
ID uint32
|
||||
Unk uint32
|
||||
Type uint16
|
||||
Goal uint16
|
||||
Quantity uint16
|
||||
SkipTickets uint16
|
||||
GR bool
|
||||
RewardType uint16
|
||||
RewardLevel uint16
|
||||
}
|
||||
|
||||
type GuildAllianceInvite struct {
|
||||
GuildID uint32
|
||||
LeaderID uint32
|
||||
Unk0 uint16
|
||||
Unk1 uint16
|
||||
Members uint16
|
||||
GuildName string
|
||||
LeaderName string
|
||||
}
|
||||
type UnkGuildInfo struct {
|
||||
Unk0 uint8
|
||||
Unk1 uint8
|
||||
Unk2 uint8
|
||||
}
|
||||
17
internal/model/house.go
Normal file
17
internal/model/house.go
Normal file
@@ -0,0 +1,17 @@
|
||||
package model
|
||||
|
||||
import "time"
|
||||
|
||||
type HouseData struct {
|
||||
CharID uint32 `db:"id"`
|
||||
HR uint16 `db:"hr"`
|
||||
GR uint16 `db:"gr"`
|
||||
Name string `db:"name"`
|
||||
HouseState uint8 `db:"house_state"`
|
||||
HousePassword string `db:"house_password"`
|
||||
}
|
||||
type Title struct {
|
||||
ID uint16 `db:"id"`
|
||||
Acquired time.Time `db:"unlocked_at"`
|
||||
Updated time.Time `db:"updated_at"`
|
||||
}
|
||||
40
internal/model/paper.go
Normal file
40
internal/model/paper.go
Normal file
@@ -0,0 +1,40 @@
|
||||
package model
|
||||
|
||||
import "time"
|
||||
|
||||
type PaperMissionTimetable struct {
|
||||
Start time.Time
|
||||
End time.Time
|
||||
}
|
||||
|
||||
type PaperMissionData struct {
|
||||
Unk0 uint8
|
||||
Unk1 uint8
|
||||
Unk2 int16
|
||||
Reward1ID uint16
|
||||
Reward1Quantity uint8
|
||||
Reward2ID uint16
|
||||
Reward2Quantity uint8
|
||||
}
|
||||
|
||||
type PaperMission struct {
|
||||
Timetables []PaperMissionTimetable
|
||||
Data []PaperMissionData
|
||||
}
|
||||
|
||||
type PaperData struct {
|
||||
Unk0 uint16
|
||||
Unk1 int16
|
||||
Unk2 int16
|
||||
Unk3 int16
|
||||
Unk4 int16
|
||||
Unk5 int16
|
||||
Unk6 int16
|
||||
}
|
||||
|
||||
type PaperGift struct {
|
||||
Unk0 uint16
|
||||
Unk1 uint8
|
||||
Unk2 uint8
|
||||
Unk3 uint16
|
||||
}
|
||||
36
internal/model/ryoudama.go
Normal file
36
internal/model/ryoudama.go
Normal file
@@ -0,0 +1,36 @@
|
||||
package model
|
||||
|
||||
import "time"
|
||||
|
||||
type RyoudamaReward struct {
|
||||
Unk0 uint8
|
||||
Unk1 uint8
|
||||
Unk2 uint16
|
||||
Unk3 uint16
|
||||
Unk4 uint16
|
||||
Unk5 uint16
|
||||
}
|
||||
|
||||
type RyoudamaKeyScore struct {
|
||||
Unk0 uint8
|
||||
Unk1 int32
|
||||
}
|
||||
|
||||
type RyoudamaCharInfo struct {
|
||||
CID uint32
|
||||
Unk0 int32
|
||||
Name string
|
||||
}
|
||||
|
||||
type RyoudamaBoostInfo struct {
|
||||
Start time.Time
|
||||
End time.Time
|
||||
}
|
||||
|
||||
type Ryoudama struct {
|
||||
Reward []RyoudamaReward
|
||||
KeyScore []RyoudamaKeyScore
|
||||
CharInfo []RyoudamaCharInfo
|
||||
BoostInfo []RyoudamaBoostInfo
|
||||
Score []int32
|
||||
}
|
||||
53
internal/model/seibattle.go
Normal file
53
internal/model/seibattle.go
Normal file
@@ -0,0 +1,53 @@
|
||||
package model
|
||||
|
||||
import "time"
|
||||
|
||||
type SeibattleTimetable struct {
|
||||
Start time.Time
|
||||
End time.Time
|
||||
}
|
||||
|
||||
type SeibattleKeyScore struct {
|
||||
Unk0 uint8
|
||||
Unk1 int32
|
||||
}
|
||||
|
||||
type SeibattleCareer struct {
|
||||
Unk0 uint16
|
||||
Unk1 uint16
|
||||
Unk2 uint16
|
||||
}
|
||||
|
||||
type SeibattleOpponent struct {
|
||||
Unk0 int32
|
||||
Unk1 int8
|
||||
}
|
||||
|
||||
type SeibattleConventionResult struct {
|
||||
Unk0 uint32
|
||||
Unk1 uint16
|
||||
Unk2 uint16
|
||||
Unk3 uint16
|
||||
Unk4 uint16
|
||||
}
|
||||
|
||||
type SeibattleCharScore struct {
|
||||
Unk0 uint32
|
||||
}
|
||||
|
||||
type SeibattleCurResult struct {
|
||||
Unk0 uint32
|
||||
Unk1 uint16
|
||||
Unk2 uint16
|
||||
Unk3 uint16
|
||||
}
|
||||
|
||||
type Seibattle struct {
|
||||
Timetable []SeibattleTimetable
|
||||
KeyScore []SeibattleKeyScore
|
||||
Career []SeibattleCareer
|
||||
Opponent []SeibattleOpponent
|
||||
ConventionResult []SeibattleConventionResult
|
||||
CharScore []SeibattleCharScore
|
||||
CurResult []SeibattleCurResult
|
||||
}
|
||||
45
internal/model/tournament.go
Normal file
45
internal/model/tournament.go
Normal file
@@ -0,0 +1,45 @@
|
||||
package model
|
||||
|
||||
import "time"
|
||||
|
||||
type TournamentInfo0 struct {
|
||||
ID uint32
|
||||
MaxPlayers uint32
|
||||
CurrentPlayers uint32
|
||||
Unk1 uint16
|
||||
TextColor uint16
|
||||
Unk2 uint32
|
||||
Time1 time.Time
|
||||
Time2 time.Time
|
||||
Time3 time.Time
|
||||
Time4 time.Time
|
||||
Time5 time.Time
|
||||
Time6 time.Time
|
||||
Unk3 uint8
|
||||
Unk4 uint8
|
||||
MinHR uint32
|
||||
MaxHR uint32
|
||||
Unk5 string
|
||||
Unk6 string
|
||||
}
|
||||
|
||||
type TournamentInfo21 struct {
|
||||
Unk0 uint32
|
||||
Unk1 uint32
|
||||
Unk2 uint32
|
||||
Unk3 uint8
|
||||
}
|
||||
|
||||
type TournamentInfo22 struct {
|
||||
Unk0 uint32
|
||||
Unk1 uint32
|
||||
Unk2 uint32
|
||||
Unk3 uint8
|
||||
Unk4 string
|
||||
}
|
||||
|
||||
type TournamentReward struct {
|
||||
Unk0 uint16
|
||||
Unk1 uint16
|
||||
Unk2 uint16
|
||||
}
|
||||
99
internal/model/tower.go
Normal file
99
internal/model/tower.go
Normal file
@@ -0,0 +1,99 @@
|
||||
package model
|
||||
|
||||
import "time"
|
||||
|
||||
type TowerInfoTRP struct {
|
||||
TR int32
|
||||
TRP int32
|
||||
}
|
||||
|
||||
type TowerInfoSkill struct {
|
||||
TSP int32
|
||||
Skills []int16 // 64
|
||||
}
|
||||
|
||||
type TowerInfoHistory struct {
|
||||
Unk0 []int16 // 5
|
||||
Unk1 []int16 // 5
|
||||
}
|
||||
|
||||
type TowerInfoLevel struct {
|
||||
Floors int32
|
||||
Unk1 int32
|
||||
Unk2 int32
|
||||
Unk3 int32
|
||||
}
|
||||
|
||||
type GemInfo struct {
|
||||
Gem uint16
|
||||
Quantity uint16
|
||||
}
|
||||
|
||||
type GemHistory struct {
|
||||
Gem uint16
|
||||
Message uint16
|
||||
Timestamp time.Time
|
||||
Sender string
|
||||
}
|
||||
type TenrouiraiProgress struct {
|
||||
Page uint8
|
||||
Mission1 uint16
|
||||
Mission2 uint16
|
||||
Mission3 uint16
|
||||
}
|
||||
|
||||
type TenrouiraiReward struct {
|
||||
Index uint8
|
||||
Item []uint16 // 5
|
||||
Quantity []uint8 // 5
|
||||
}
|
||||
|
||||
type TenrouiraiKeyScore struct {
|
||||
Unk0 uint8
|
||||
Unk1 int32
|
||||
}
|
||||
|
||||
type TenrouiraiData struct {
|
||||
Block uint8
|
||||
Mission uint8
|
||||
// 1 = Floors climbed
|
||||
// 2 = Collect antiques
|
||||
// 3 = Open chests
|
||||
// 4 = Cats saved
|
||||
// 5 = TRP acquisition
|
||||
// 6 = Monster slays
|
||||
Goal uint16
|
||||
Cost uint16
|
||||
Skill1 uint8 // 80
|
||||
Skill2 uint8 // 40
|
||||
Skill3 uint8 // 40
|
||||
Skill4 uint8 // 20
|
||||
Skill5 uint8 // 40
|
||||
Skill6 uint8 // 50
|
||||
}
|
||||
|
||||
type TenrouiraiCharScore struct {
|
||||
Score int32
|
||||
Name string
|
||||
}
|
||||
|
||||
type TenrouiraiTicket struct {
|
||||
Unk0 uint8
|
||||
RP uint32
|
||||
Unk2 uint32
|
||||
}
|
||||
|
||||
type Tenrouirai struct {
|
||||
Progress []TenrouiraiProgress
|
||||
Reward []TenrouiraiReward
|
||||
KeyScore []TenrouiraiKeyScore
|
||||
Data []TenrouiraiData
|
||||
CharScore []TenrouiraiCharScore
|
||||
Ticket []TenrouiraiTicket
|
||||
}
|
||||
type TowerInfo struct {
|
||||
TRP []TowerInfoTRP
|
||||
Skill []TowerInfoSkill
|
||||
History []TowerInfoHistory
|
||||
Level []TowerInfoLevel
|
||||
}
|
||||
@@ -1,14 +1,16 @@
|
||||
package channelserver
|
||||
package service
|
||||
|
||||
import (
|
||||
"encoding/binary"
|
||||
"errors"
|
||||
"erupe-ce/common/bfutil"
|
||||
"erupe-ce/common/stringsupport"
|
||||
_config "erupe-ce/config"
|
||||
|
||||
"erupe-ce/network/mhfpacket"
|
||||
"erupe-ce/config"
|
||||
"erupe-ce/server/channelserver/compression/nullcomp"
|
||||
"erupe-ce/utils/bfutil"
|
||||
"erupe-ce/utils/database"
|
||||
"erupe-ce/utils/logger"
|
||||
"erupe-ce/utils/stringsupport"
|
||||
"fmt"
|
||||
|
||||
"go.uber.org/zap"
|
||||
)
|
||||
|
||||
@@ -57,8 +59,8 @@ type CharacterSaveData struct {
|
||||
|
||||
func getPointers() map[SavePointer]int {
|
||||
pointers := map[SavePointer]int{pGender: 81, lBookshelfData: 5576}
|
||||
switch _config.ErupeConfig.RealClientMode {
|
||||
case _config.ZZ:
|
||||
switch config.GetConfig().ClientID {
|
||||
case config.ZZ:
|
||||
pointers[pWeaponID] = 128522
|
||||
pointers[pWeaponType] = 128789
|
||||
pointers[pHouseTier] = 129900
|
||||
@@ -71,9 +73,9 @@ func getPointers() map[SavePointer]int {
|
||||
pointers[pGardenData] = 142424
|
||||
pointers[pRP] = 142614
|
||||
pointers[pKQF] = 146720
|
||||
case _config.Z2, _config.Z1, _config.G101, _config.G10, _config.G91, _config.G9, _config.G81, _config.G8,
|
||||
_config.G7, _config.G61, _config.G6, _config.G52, _config.G51, _config.G5, _config.GG, _config.G32, _config.G31,
|
||||
_config.G3, _config.G2, _config.G1:
|
||||
case config.Z2, config.Z1, config.G101, config.G10, config.G91, config.G9, config.G81, config.G8,
|
||||
config.G7, config.G61, config.G6, config.G52, config.G51, config.G5, config.GG, config.G32, config.G31,
|
||||
config.G3, config.G2, config.G1:
|
||||
pointers[pWeaponID] = 92522
|
||||
pointers[pWeaponType] = 92789
|
||||
pointers[pHouseTier] = 93900
|
||||
@@ -86,7 +88,7 @@ func getPointers() map[SavePointer]int {
|
||||
pointers[pGardenData] = 106424
|
||||
pointers[pRP] = 106614
|
||||
pointers[pKQF] = 110720
|
||||
case _config.F5, _config.F4:
|
||||
case config.F5, config.F4:
|
||||
pointers[pWeaponID] = 60522
|
||||
pointers[pWeaponType] = 60789
|
||||
pointers[pHouseTier] = 61900
|
||||
@@ -97,7 +99,7 @@ func getPointers() map[SavePointer]int {
|
||||
pointers[pGalleryData] = 72064
|
||||
pointers[pGardenData] = 74424
|
||||
pointers[pRP] = 74614
|
||||
case _config.S6:
|
||||
case config.S6:
|
||||
pointers[pWeaponID] = 12522
|
||||
pointers[pWeaponType] = 12789
|
||||
pointers[pHouseTier] = 13900
|
||||
@@ -109,24 +111,29 @@ func getPointers() map[SavePointer]int {
|
||||
pointers[pGardenData] = 26424
|
||||
pointers[pRP] = 26614
|
||||
}
|
||||
if _config.ErupeConfig.RealClientMode == _config.G5 {
|
||||
if config.GetConfig().ClientID == config.G5 {
|
||||
pointers[lBookshelfData] = 5548
|
||||
} else if _config.ErupeConfig.RealClientMode <= _config.GG {
|
||||
} else if config.GetConfig().ClientID <= config.GG {
|
||||
pointers[lBookshelfData] = 4520
|
||||
}
|
||||
return pointers
|
||||
}
|
||||
|
||||
func GetCharacterSaveData(s *Session, charID uint32) (*CharacterSaveData, error) {
|
||||
result, err := s.server.db.Query("SELECT id, savedata, is_new_character, name FROM characters WHERE id = $1", charID)
|
||||
func GetCharacterSaveData(charID uint32) (*CharacterSaveData, error) {
|
||||
db, err := database.GetDB()
|
||||
logger := logger.Get()
|
||||
if err != nil {
|
||||
s.logger.Error("Failed to get savedata", zap.Error(err), zap.Uint32("charID", charID))
|
||||
logger.Fatal(fmt.Sprintf("Failed to get database instance: %s", err))
|
||||
}
|
||||
result, err := db.Query("SELECT id, savedata, is_new_character, name FROM characters WHERE id = $1", charID)
|
||||
if err != nil {
|
||||
logger.Error("Failed to get savedata", zap.Error(err), zap.Uint32("charID", charID))
|
||||
return nil, err
|
||||
}
|
||||
defer result.Close()
|
||||
if !result.Next() {
|
||||
err = errors.New("no savedata found")
|
||||
s.logger.Error("No savedata found", zap.Uint32("charID", charID))
|
||||
logger.Error("No savedata found", zap.Uint32("charID", charID))
|
||||
return nil, err
|
||||
}
|
||||
|
||||
@@ -135,7 +142,7 @@ func GetCharacterSaveData(s *Session, charID uint32) (*CharacterSaveData, error)
|
||||
}
|
||||
err = result.Scan(&saveData.CharID, &saveData.compSave, &saveData.IsNewCharacter, &saveData.Name)
|
||||
if err != nil {
|
||||
s.logger.Error("Failed to scan savedata", zap.Error(err), zap.Uint32("charID", charID))
|
||||
logger.Error("Failed to scan savedata", zap.Error(err), zap.Uint32("charID", charID))
|
||||
return nil, err
|
||||
}
|
||||
|
||||
@@ -145,28 +152,41 @@ func GetCharacterSaveData(s *Session, charID uint32) (*CharacterSaveData, error)
|
||||
|
||||
err = saveData.Decompress()
|
||||
if err != nil {
|
||||
s.logger.Error("Failed to decompress savedata", zap.Error(err))
|
||||
logger.Error("Failed to decompress savedata", zap.Error(err))
|
||||
return nil, err
|
||||
}
|
||||
|
||||
saveData.updateStructWithSaveData()
|
||||
saveData.UpdateStructWithSaveData()
|
||||
|
||||
return saveData, nil
|
||||
}
|
||||
|
||||
func (save *CharacterSaveData) Save(s *Session) {
|
||||
if !s.kqfOverride {
|
||||
s.kqf = save.KQF
|
||||
type SessionCharacter interface {
|
||||
Setkqf(data []byte)
|
||||
Getkqf() []byte
|
||||
GetkqfOverride() bool
|
||||
GetCharID() uint32
|
||||
}
|
||||
|
||||
func (save *CharacterSaveData) Save(s SessionCharacter) {
|
||||
db, err := database.GetDB()
|
||||
logger := logger.Get()
|
||||
|
||||
if err != nil {
|
||||
logger.Fatal(fmt.Sprintf("Failed to get database instance: %s", err))
|
||||
}
|
||||
if !s.GetkqfOverride() {
|
||||
s.Setkqf(save.KQF)
|
||||
} else {
|
||||
save.KQF = s.kqf
|
||||
save.KQF = s.Getkqf()
|
||||
}
|
||||
|
||||
save.updateSaveDataWithStruct()
|
||||
|
||||
if _config.ErupeConfig.RealClientMode >= _config.G1 {
|
||||
if config.GetConfig().ClientID >= config.G1 {
|
||||
err := save.Compress()
|
||||
if err != nil {
|
||||
s.logger.Error("Failed to compress savedata", zap.Error(err))
|
||||
logger.Error("Failed to compress savedata", zap.Error(err))
|
||||
return
|
||||
}
|
||||
} else {
|
||||
@@ -174,14 +194,14 @@ func (save *CharacterSaveData) Save(s *Session) {
|
||||
save.compSave = save.decompSave
|
||||
}
|
||||
|
||||
_, err := s.server.db.Exec(`UPDATE characters SET savedata=$1, is_new_character=false, hr=$2, gr=$3, is_female=$4, weapon_type=$5, weapon_id=$6 WHERE id=$7
|
||||
_, err = db.Exec(`UPDATE characters SET savedata=$1, is_new_character=false, hr=$2, gr=$3, is_female=$4, weapon_type=$5, weapon_id=$6 WHERE id=$7
|
||||
`, save.compSave, save.HR, save.GR, save.Gender, save.WeaponType, save.WeaponID, save.CharID)
|
||||
if err != nil {
|
||||
s.logger.Error("Failed to update savedata", zap.Error(err), zap.Uint32("charID", save.CharID))
|
||||
logger.Error("Failed to update savedata", zap.Error(err), zap.Uint32("charID", save.CharID))
|
||||
}
|
||||
|
||||
s.server.db.Exec(`UPDATE user_binary SET house_tier=$1, house_data=$2, bookshelf=$3, gallery=$4, tore=$5, garden=$6 WHERE id=$7
|
||||
`, save.HouseTier, save.HouseData, save.BookshelfData, save.GalleryData, save.ToreData, save.GardenData, s.charID)
|
||||
db.Exec(`UPDATE user_binary SET house_tier=$1, house_data=$2, bookshelf=$3, gallery=$4, tore=$5, garden=$6 WHERE id=$7
|
||||
`, save.HouseTier, save.HouseData, save.BookshelfData, save.GalleryData, save.ToreData, save.GardenData, s.GetCharID())
|
||||
}
|
||||
|
||||
func (save *CharacterSaveData) Compress() error {
|
||||
@@ -206,16 +226,16 @@ func (save *CharacterSaveData) Decompress() error {
|
||||
func (save *CharacterSaveData) updateSaveDataWithStruct() {
|
||||
rpBytes := make([]byte, 2)
|
||||
binary.LittleEndian.PutUint16(rpBytes, save.RP)
|
||||
if _config.ErupeConfig.RealClientMode >= _config.F4 {
|
||||
if config.GetConfig().ClientID >= config.F4 {
|
||||
copy(save.decompSave[save.Pointers[pRP]:save.Pointers[pRP]+2], rpBytes)
|
||||
}
|
||||
if _config.ErupeConfig.RealClientMode >= _config.G10 {
|
||||
if config.GetConfig().ClientID >= config.G10 {
|
||||
copy(save.decompSave[save.Pointers[pKQF]:save.Pointers[pKQF]+8], save.KQF)
|
||||
}
|
||||
}
|
||||
|
||||
// This will update the save struct with the values stored in the character save
|
||||
func (save *CharacterSaveData) updateStructWithSaveData() {
|
||||
func (save *CharacterSaveData) UpdateStructWithSaveData() {
|
||||
save.Name = stringsupport.SJISToUTF8(bfutil.UpToNull(save.decompSave[88:100]))
|
||||
if save.decompSave[save.Pointers[pGender]] == 1 {
|
||||
save.Gender = true
|
||||
@@ -223,7 +243,7 @@ func (save *CharacterSaveData) updateStructWithSaveData() {
|
||||
save.Gender = false
|
||||
}
|
||||
if !save.IsNewCharacter {
|
||||
if _config.ErupeConfig.RealClientMode >= _config.S6 {
|
||||
if config.GetConfig().ClientID >= config.S6 {
|
||||
save.RP = binary.LittleEndian.Uint16(save.decompSave[save.Pointers[pRP] : save.Pointers[pRP]+2])
|
||||
save.HouseTier = save.decompSave[save.Pointers[pHouseTier] : save.Pointers[pHouseTier]+5]
|
||||
save.HouseData = save.decompSave[save.Pointers[pHouseData] : save.Pointers[pHouseData]+195]
|
||||
@@ -234,20 +254,57 @@ func (save *CharacterSaveData) updateStructWithSaveData() {
|
||||
save.WeaponType = save.decompSave[save.Pointers[pWeaponType]]
|
||||
save.WeaponID = binary.LittleEndian.Uint16(save.decompSave[save.Pointers[pWeaponID] : save.Pointers[pWeaponID]+2])
|
||||
save.HR = binary.LittleEndian.Uint16(save.decompSave[save.Pointers[pHR] : save.Pointers[pHR]+2])
|
||||
if _config.ErupeConfig.RealClientMode >= _config.G1 {
|
||||
if config.GetConfig().ClientID >= config.G1 {
|
||||
if save.HR == uint16(999) {
|
||||
save.GR = grpToGR(int(binary.LittleEndian.Uint32(save.decompSave[save.Pointers[pGRP] : save.Pointers[pGRP]+4])))
|
||||
}
|
||||
}
|
||||
if _config.ErupeConfig.RealClientMode >= _config.G10 {
|
||||
if config.GetConfig().ClientID >= config.G10 {
|
||||
save.KQF = save.decompSave[save.Pointers[pKQF] : save.Pointers[pKQF]+8]
|
||||
}
|
||||
}
|
||||
}
|
||||
return
|
||||
}
|
||||
func grpToGR(n int) uint16 {
|
||||
var gr int
|
||||
a := []int{208750, 593400, 993400, 1400900, 2315900, 3340900, 4505900, 5850900, 7415900, 9230900, 11345900, 100000000}
|
||||
b := []int{7850, 8000, 8150, 9150, 10250, 11650, 13450, 15650, 18150, 21150, 23950}
|
||||
c := []int{51, 100, 150, 200, 300, 400, 500, 600, 700, 800, 900}
|
||||
|
||||
func handleMsgMhfSexChanger(s *Session, p mhfpacket.MHFPacket) {
|
||||
pkt := p.(*mhfpacket.MsgMhfSexChanger)
|
||||
doAckSimpleSucceed(s, pkt.AckHandle, make([]byte, 4))
|
||||
for i := 0; i < len(a); i++ {
|
||||
if n < a[i] {
|
||||
if i == 0 {
|
||||
for {
|
||||
n -= 500
|
||||
if n <= 500 {
|
||||
if n < 0 {
|
||||
i--
|
||||
}
|
||||
break
|
||||
} else {
|
||||
i++
|
||||
for j := 0; j < i; j++ {
|
||||
n -= 150
|
||||
}
|
||||
}
|
||||
}
|
||||
gr = i + 2
|
||||
} else {
|
||||
n -= a[i-1]
|
||||
gr = c[i-1]
|
||||
gr += n / b[i-1]
|
||||
}
|
||||
break
|
||||
}
|
||||
}
|
||||
return uint16(gr)
|
||||
}
|
||||
|
||||
func (save *CharacterSaveData) GetDecompSave() []byte {
|
||||
return save.decompSave
|
||||
}
|
||||
|
||||
func (save *CharacterSaveData) SetDecompSave(decompSave []byte) {
|
||||
save.decompSave = decompSave
|
||||
}
|
||||
641
internal/service/guild.go
Normal file
641
internal/service/guild.go
Normal file
@@ -0,0 +1,641 @@
|
||||
package service
|
||||
|
||||
import (
|
||||
"database/sql"
|
||||
"database/sql/driver"
|
||||
"encoding/json"
|
||||
"errors"
|
||||
"erupe-ce/config"
|
||||
"erupe-ce/internal/model"
|
||||
"erupe-ce/utils/database"
|
||||
"erupe-ce/utils/logger"
|
||||
"fmt"
|
||||
"time"
|
||||
|
||||
"github.com/jmoiron/sqlx"
|
||||
"go.uber.org/zap"
|
||||
)
|
||||
|
||||
type Guild struct {
|
||||
ID uint32 `db:"id"`
|
||||
Name string `db:"name"`
|
||||
MainMotto uint8 `db:"main_motto"`
|
||||
SubMotto uint8 `db:"sub_motto"`
|
||||
CreatedAt time.Time `db:"created_at"`
|
||||
MemberCount uint16 `db:"member_count"`
|
||||
RankRP uint32 `db:"rank_rp"`
|
||||
EventRP uint32 `db:"event_rp"`
|
||||
RoomRP uint16 `db:"room_rp"`
|
||||
RoomExpiry time.Time `db:"room_expiry"`
|
||||
Comment string `db:"comment"`
|
||||
PugiName1 string `db:"pugi_name_1"`
|
||||
PugiName2 string `db:"pugi_name_2"`
|
||||
PugiName3 string `db:"pugi_name_3"`
|
||||
PugiOutfit1 uint8 `db:"pugi_outfit_1"`
|
||||
PugiOutfit2 uint8 `db:"pugi_outfit_2"`
|
||||
PugiOutfit3 uint8 `db:"pugi_outfit_3"`
|
||||
PugiOutfits uint32 `db:"pugi_outfits"`
|
||||
Recruiting bool `db:"recruiting"`
|
||||
FestivalColor model.FestivalColor `db:"festival_color"`
|
||||
Souls uint32 `db:"souls"`
|
||||
AllianceID uint32 `db:"alliance_id"`
|
||||
Icon *GuildIcon `db:"icon"`
|
||||
|
||||
model.GuildLeader
|
||||
}
|
||||
|
||||
func RollbackTransaction(transaction *sql.Tx) {
|
||||
err := transaction.Rollback()
|
||||
logger := logger.Get()
|
||||
|
||||
if err != nil {
|
||||
logger.Error("failed to rollback transaction", zap.Error(err))
|
||||
}
|
||||
}
|
||||
|
||||
type GuildIcon struct {
|
||||
Parts []model.GuildIconPart
|
||||
}
|
||||
|
||||
func (gi *GuildIcon) Scan(val interface{}) (err error) {
|
||||
switch v := val.(type) {
|
||||
case []byte:
|
||||
err = json.Unmarshal(v, &gi)
|
||||
case string:
|
||||
err = json.Unmarshal([]byte(v), &gi)
|
||||
}
|
||||
|
||||
return
|
||||
}
|
||||
|
||||
func (gi *GuildIcon) Value() (valuer driver.Value, err error) {
|
||||
return json.Marshal(gi)
|
||||
}
|
||||
|
||||
func (g *Guild) Rank() uint16 {
|
||||
rpMap := []uint32{
|
||||
24, 48, 96, 144, 192, 240, 288, 360, 432,
|
||||
504, 600, 696, 792, 888, 984, 1080, 1200,
|
||||
}
|
||||
if config.GetConfig().ClientID <= config.Z2 {
|
||||
rpMap = []uint32{
|
||||
3500, 6000, 8500, 11000, 13500, 16000, 20000, 24000, 28000,
|
||||
33000, 38000, 43000, 48000, 55000, 70000, 90000, 120000,
|
||||
}
|
||||
}
|
||||
for i, u := range rpMap {
|
||||
if g.RankRP < u {
|
||||
if config.GetConfig().ClientID <= config.S6 && i >= 12 {
|
||||
return 12
|
||||
} else if config.GetConfig().ClientID <= config.F5 && i >= 13 {
|
||||
return 13
|
||||
} else if config.GetConfig().ClientID <= config.G32 && i >= 14 {
|
||||
return 14
|
||||
}
|
||||
return uint16(i)
|
||||
}
|
||||
}
|
||||
if config.GetConfig().ClientID <= config.S6 {
|
||||
return 12
|
||||
} else if config.GetConfig().ClientID <= config.F5 {
|
||||
return 13
|
||||
} else if config.GetConfig().ClientID <= config.G32 {
|
||||
return 14
|
||||
}
|
||||
return 17
|
||||
}
|
||||
|
||||
func (guild *Guild) Save() error {
|
||||
db, err := database.GetDB()
|
||||
logger := logger.Get()
|
||||
|
||||
if err != nil {
|
||||
logger.Fatal(fmt.Sprintf("Failed to get database instance: %s", err))
|
||||
}
|
||||
_, err = db.Exec(`
|
||||
UPDATE guilds SET main_motto=$2, sub_motto=$3, comment=$4, pugi_name_1=$5, pugi_name_2=$6, pugi_name_3=$7,
|
||||
pugi_outfit_1=$8, pugi_outfit_2=$9, pugi_outfit_3=$10, pugi_outfits=$11, icon=$12, leader_id=$13 WHERE id=$1
|
||||
`, guild.ID, guild.MainMotto, guild.SubMotto, guild.Comment, guild.PugiName1, guild.PugiName2, guild.PugiName3,
|
||||
guild.PugiOutfit1, guild.PugiOutfit2, guild.PugiOutfit3, guild.PugiOutfits, guild.Icon, guild.GuildLeader.LeaderCharID)
|
||||
|
||||
if err != nil {
|
||||
logger.Error("failed to update guild data", zap.Error(err), zap.Uint32("guildID", guild.ID))
|
||||
return err
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
func (guild *Guild) CreateApplication(charID uint32, applicationType model.GuildApplicationType, transaction *sql.Tx, actorId uint32) error {
|
||||
db, err := database.GetDB()
|
||||
logger := logger.Get()
|
||||
|
||||
if err != nil {
|
||||
logger.Fatal(fmt.Sprintf("Failed to get database instance: %s", err))
|
||||
}
|
||||
query := `
|
||||
INSERT INTO guild_applications (guild_id, character_id, actor_id, application_type)
|
||||
VALUES ($1, $2, $3, $4)
|
||||
`
|
||||
// Actor ID is the s.CharID
|
||||
if transaction == nil {
|
||||
_, err = db.Exec(query, guild.ID, charID, actorId, applicationType)
|
||||
} else {
|
||||
_, err = transaction.Exec(query, guild.ID, charID, actorId, applicationType)
|
||||
}
|
||||
|
||||
if err != nil {
|
||||
logger.Error(
|
||||
"failed to add guild application",
|
||||
zap.Error(err),
|
||||
zap.Uint32("guildID", guild.ID),
|
||||
zap.Uint32("charID", charID),
|
||||
)
|
||||
return err
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
func (guild *Guild) Disband(charID uint32) error {
|
||||
db, err := database.GetDB()
|
||||
logger := logger.Get()
|
||||
|
||||
if err != nil {
|
||||
logger.Fatal(fmt.Sprintf("Failed to get database instance: %s", err))
|
||||
}
|
||||
transaction, err := db.Begin()
|
||||
|
||||
if err != nil {
|
||||
logger.Error("failed to begin transaction", zap.Error(err))
|
||||
return err
|
||||
}
|
||||
|
||||
_, err = transaction.Exec("DELETE FROM guild_characters WHERE guild_id = $1", guild.ID)
|
||||
|
||||
if err != nil {
|
||||
logger.Error("failed to remove guild characters", zap.Error(err), zap.Uint32("guildId", guild.ID))
|
||||
RollbackTransaction(transaction)
|
||||
return err
|
||||
}
|
||||
|
||||
_, err = transaction.Exec("DELETE FROM guilds WHERE id = $1", guild.ID)
|
||||
|
||||
if err != nil {
|
||||
logger.Error("failed to remove guild", zap.Error(err), zap.Uint32("guildID", guild.ID))
|
||||
RollbackTransaction(transaction)
|
||||
return err
|
||||
}
|
||||
|
||||
_, err = transaction.Exec("DELETE FROM guild_alliances WHERE parent_id=$1", guild.ID)
|
||||
|
||||
if err != nil {
|
||||
logger.Error("failed to remove guild alliance", zap.Error(err), zap.Uint32("guildID", guild.ID))
|
||||
RollbackTransaction(transaction)
|
||||
return err
|
||||
}
|
||||
|
||||
_, err = transaction.Exec("UPDATE guild_alliances SET sub1_id=sub2_id, sub2_id=NULL WHERE sub1_id=$1", guild.ID)
|
||||
|
||||
if err != nil {
|
||||
logger.Error("failed to remove guild from alliance", zap.Error(err), zap.Uint32("guildID", guild.ID))
|
||||
RollbackTransaction(transaction)
|
||||
return err
|
||||
}
|
||||
|
||||
_, err = transaction.Exec("UPDATE guild_alliances SET sub2_id=NULL WHERE sub2_id=$1", guild.ID)
|
||||
|
||||
if err != nil {
|
||||
logger.Error("failed to remove guild from alliance", zap.Error(err), zap.Uint32("guildID", guild.ID))
|
||||
RollbackTransaction(transaction)
|
||||
return err
|
||||
}
|
||||
|
||||
err = transaction.Commit()
|
||||
|
||||
if err != nil {
|
||||
logger.Error("failed to commit transaction", zap.Error(err))
|
||||
return err
|
||||
}
|
||||
|
||||
logger.Info("Character disbanded guild", zap.Uint32("charID", charID), zap.Uint32("guildID", guild.ID))
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
func (guild *Guild) RemoveCharacter(charID uint32) error {
|
||||
db, err := database.GetDB()
|
||||
logger := logger.Get()
|
||||
|
||||
if err != nil {
|
||||
logger.Fatal(fmt.Sprintf("Failed to get database instance: %s", err))
|
||||
}
|
||||
_, err = db.Exec("DELETE FROM guild_characters WHERE character_id=$1", charID)
|
||||
|
||||
if err != nil {
|
||||
logger.Error(
|
||||
"failed to remove character from guild",
|
||||
zap.Error(err),
|
||||
zap.Uint32("charID", charID),
|
||||
zap.Uint32("guildID", guild.ID),
|
||||
)
|
||||
|
||||
return err
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
func (guild *Guild) AcceptApplication(charID uint32) error {
|
||||
db, err := database.GetDB()
|
||||
logger := logger.Get()
|
||||
|
||||
if err != nil {
|
||||
logger.Fatal(fmt.Sprintf("Failed to get database instance: %s", err))
|
||||
}
|
||||
transaction, err := db.Begin()
|
||||
|
||||
if err != nil {
|
||||
logger.Error("failed to start db transaction", zap.Error(err))
|
||||
return err
|
||||
}
|
||||
|
||||
_, err = transaction.Exec(`DELETE FROM guild_applications WHERE character_id = $1`, charID)
|
||||
|
||||
if err != nil {
|
||||
logger.Error("failed to accept character's guild application", zap.Error(err))
|
||||
RollbackTransaction(transaction)
|
||||
return err
|
||||
}
|
||||
|
||||
_, err = transaction.Exec(`
|
||||
INSERT INTO guild_characters (guild_id, character_id, order_index)
|
||||
VALUES ($1, $2, (SELECT MAX(order_index) + 1 FROM guild_characters WHERE guild_id = $1))
|
||||
`, guild.ID, charID)
|
||||
|
||||
if err != nil {
|
||||
logger.Error(
|
||||
"failed to add applicant to guild",
|
||||
zap.Error(err),
|
||||
zap.Uint32("guildID", guild.ID),
|
||||
zap.Uint32("charID", charID),
|
||||
)
|
||||
RollbackTransaction(transaction)
|
||||
return err
|
||||
}
|
||||
|
||||
err = transaction.Commit()
|
||||
|
||||
if err != nil {
|
||||
logger.Error("failed to commit db transaction", zap.Error(err))
|
||||
RollbackTransaction(transaction)
|
||||
return err
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
// This is relying on the fact that invitation ID is also character ID right now
|
||||
// if invitation ID changes, this will break.
|
||||
func (guild *Guild) CancelInvitation(charID uint32) error {
|
||||
db, err := database.GetDB()
|
||||
logger := logger.Get()
|
||||
|
||||
if err != nil {
|
||||
logger.Fatal(fmt.Sprintf("Failed to get database instance: %s", err))
|
||||
}
|
||||
_, err = db.Exec(
|
||||
`DELETE FROM guild_applications WHERE character_id = $1 AND guild_id = $2 AND application_type = 'invited'`,
|
||||
charID, guild.ID,
|
||||
)
|
||||
|
||||
if err != nil {
|
||||
logger.Error(
|
||||
"failed to cancel guild invitation",
|
||||
zap.Error(err),
|
||||
zap.Uint32("guildID", guild.ID),
|
||||
zap.Uint32("charID", charID),
|
||||
)
|
||||
return err
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
func (guild *Guild) RejectApplication(charID uint32) error {
|
||||
db, err := database.GetDB()
|
||||
logger := logger.Get()
|
||||
|
||||
if err != nil {
|
||||
logger.Fatal(fmt.Sprintf("Failed to get database instance: %s", err))
|
||||
}
|
||||
_, err = db.Exec(
|
||||
`DELETE FROM guild_applications WHERE character_id = $1 AND guild_id = $2 AND application_type = 'applied'`,
|
||||
charID, guild.ID,
|
||||
)
|
||||
|
||||
if err != nil {
|
||||
logger.Error(
|
||||
"failed to reject guild application",
|
||||
zap.Error(err),
|
||||
zap.Uint32("guildID", guild.ID),
|
||||
zap.Uint32("charID", charID),
|
||||
)
|
||||
return err
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
func (guild *Guild) ArrangeCharacters(charIDs []uint32) error {
|
||||
db, err := database.GetDB()
|
||||
logger := logger.Get()
|
||||
|
||||
if err != nil {
|
||||
logger.Fatal(fmt.Sprintf("Failed to get database instance: %s", err))
|
||||
}
|
||||
transaction, err := db.Begin()
|
||||
|
||||
if err != nil {
|
||||
logger.Error("failed to start db transaction", zap.Error(err))
|
||||
return err
|
||||
}
|
||||
|
||||
for i, id := range charIDs {
|
||||
_, err := transaction.Exec("UPDATE guild_characters SET order_index = $1 WHERE character_id = $2", 2+i, id)
|
||||
|
||||
if err != nil {
|
||||
err = transaction.Rollback()
|
||||
|
||||
if err != nil {
|
||||
logger.Error("failed to rollback db transaction", zap.Error(err))
|
||||
}
|
||||
|
||||
return err
|
||||
}
|
||||
}
|
||||
|
||||
err = transaction.Commit()
|
||||
|
||||
if err != nil {
|
||||
logger.Error("failed to commit db transaction", zap.Error(err))
|
||||
return err
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
func (guild *Guild) GetApplicationForCharID(charID uint32, applicationType model.GuildApplicationType) (*model.GuildApplication, error) {
|
||||
db, err := database.GetDB()
|
||||
logger := logger.Get()
|
||||
|
||||
if err != nil {
|
||||
logger.Fatal(fmt.Sprintf("Failed to get database instance: %s", err))
|
||||
}
|
||||
row := db.QueryRowx(`
|
||||
SELECT * from guild_applications WHERE character_id = $1 AND guild_id = $2 AND application_type = $3
|
||||
`, charID, guild.ID, applicationType)
|
||||
|
||||
application := &model.GuildApplication{}
|
||||
|
||||
err = row.StructScan(application)
|
||||
|
||||
if errors.Is(err, sql.ErrNoRows) {
|
||||
return nil, nil
|
||||
}
|
||||
|
||||
if err != nil {
|
||||
logger.Error(
|
||||
"failed to retrieve guild application for character",
|
||||
zap.Error(err),
|
||||
zap.Uint32("charID", charID),
|
||||
zap.Uint32("guildID", guild.ID),
|
||||
)
|
||||
return nil, err
|
||||
}
|
||||
|
||||
return application, nil
|
||||
}
|
||||
|
||||
func (guild *Guild) HasApplicationForCharID(charID uint32) (bool, error) {
|
||||
db, err := database.GetDB()
|
||||
logger := logger.Get()
|
||||
|
||||
if err != nil {
|
||||
logger.Fatal(fmt.Sprintf("Failed to get database instance: %s", err))
|
||||
}
|
||||
row := db.QueryRowx(`
|
||||
SELECT 1 from guild_applications WHERE character_id = $1 AND guild_id = $2
|
||||
`, charID, guild.ID)
|
||||
|
||||
num := 0
|
||||
|
||||
err = row.Scan(&num)
|
||||
|
||||
if errors.Is(err, sql.ErrNoRows) {
|
||||
return false, nil
|
||||
}
|
||||
|
||||
if err != nil {
|
||||
logger.Error(
|
||||
"failed to retrieve guild applications for character",
|
||||
zap.Error(err),
|
||||
zap.Uint32("charID", charID),
|
||||
zap.Uint32("guildID", guild.ID),
|
||||
)
|
||||
return false, err
|
||||
}
|
||||
|
||||
return true, nil
|
||||
}
|
||||
|
||||
const GuildInfoSelectQuery = `
|
||||
SELECT
|
||||
g.id,
|
||||
g.name,
|
||||
rank_rp,
|
||||
event_rp,
|
||||
room_rp,
|
||||
COALESCE(room_expiry, '1970-01-01') AS room_expiry,
|
||||
main_motto,
|
||||
sub_motto,
|
||||
created_at,
|
||||
leader_id,
|
||||
c.name AS leader_name,
|
||||
comment,
|
||||
COALESCE(pugi_name_1, '') AS pugi_name_1,
|
||||
COALESCE(pugi_name_2, '') AS pugi_name_2,
|
||||
COALESCE(pugi_name_3, '') AS pugi_name_3,
|
||||
pugi_outfit_1,
|
||||
pugi_outfit_2,
|
||||
pugi_outfit_3,
|
||||
pugi_outfits,
|
||||
recruiting,
|
||||
COALESCE((SELECT team FROM festa_registrations fr WHERE fr.guild_id = g.id), 'none') AS festival_color,
|
||||
COALESCE((SELECT SUM(fs.souls) FROM festa_submissions fs WHERE fs.guild_id=g.id), 0) AS souls,
|
||||
COALESCE((
|
||||
SELECT id FROM guild_alliances ga WHERE
|
||||
ga.parent_id = g.id OR
|
||||
ga.sub1_id = g.id OR
|
||||
ga.sub2_id = g.id
|
||||
), 0) AS alliance_id,
|
||||
icon,
|
||||
(SELECT count(1) FROM guild_characters gc WHERE gc.guild_id = g.id) AS member_count
|
||||
FROM guilds g
|
||||
JOIN guild_characters gc ON gc.character_id = leader_id
|
||||
JOIN characters c on leader_id = c.id
|
||||
`
|
||||
|
||||
func CreateGuild(guildName string, charID uint32) (int32, error) {
|
||||
db, err := database.GetDB()
|
||||
logger := logger.Get()
|
||||
|
||||
if err != nil {
|
||||
logger.Fatal(fmt.Sprintf("Failed to get database instance: %s", err))
|
||||
}
|
||||
transaction, err := db.Begin()
|
||||
|
||||
if err != nil {
|
||||
logger.Error("failed to start db transaction", zap.Error(err))
|
||||
return 0, err
|
||||
}
|
||||
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
|
||||
guildResult, err := transaction.Query(
|
||||
"INSERT INTO guilds (name, leader_id) VALUES ($1, $2) RETURNING id",
|
||||
guildName, charID,
|
||||
)
|
||||
|
||||
if err != nil {
|
||||
logger.Error("failed to create guild", zap.Error(err))
|
||||
RollbackTransaction(transaction)
|
||||
return 0, err
|
||||
}
|
||||
|
||||
var guildId int32
|
||||
|
||||
guildResult.Next()
|
||||
|
||||
err = guildResult.Scan(&guildId)
|
||||
|
||||
if err != nil {
|
||||
logger.Error("failed to retrieve guild ID", zap.Error(err))
|
||||
RollbackTransaction(transaction)
|
||||
return 0, err
|
||||
}
|
||||
|
||||
err = guildResult.Close()
|
||||
|
||||
if err != nil {
|
||||
logger.Error("failed to finalise query", zap.Error(err))
|
||||
RollbackTransaction(transaction)
|
||||
return 0, err
|
||||
}
|
||||
|
||||
_, err = transaction.Exec(`
|
||||
INSERT INTO guild_characters (guild_id, character_id)
|
||||
VALUES ($1, $2)
|
||||
`, guildId, charID)
|
||||
|
||||
if err != nil {
|
||||
logger.Error("failed to add character to guild", zap.Error(err))
|
||||
RollbackTransaction(transaction)
|
||||
return 0, err
|
||||
}
|
||||
|
||||
err = transaction.Commit()
|
||||
|
||||
if err != nil {
|
||||
logger.Error("failed to commit guild creation", zap.Error(err))
|
||||
return 0, err
|
||||
}
|
||||
|
||||
return guildId, nil
|
||||
}
|
||||
|
||||
func GetGuildInfoByID(guildID uint32) (*Guild, error) {
|
||||
db, err := database.GetDB()
|
||||
logger := logger.Get()
|
||||
|
||||
if err != nil {
|
||||
logger.Fatal(fmt.Sprintf("Failed to get database instance: %s", err))
|
||||
}
|
||||
rows, err := db.Queryx(fmt.Sprintf(`
|
||||
%s
|
||||
WHERE g.id = $1
|
||||
LIMIT 1
|
||||
`, GuildInfoSelectQuery), guildID)
|
||||
|
||||
if err != nil {
|
||||
logger.Error("failed to retrieve guild", zap.Error(err), zap.Uint32("guildID", guildID))
|
||||
return nil, err
|
||||
}
|
||||
|
||||
defer rows.Close()
|
||||
|
||||
hasRow := rows.Next()
|
||||
|
||||
if !hasRow {
|
||||
return nil, nil
|
||||
}
|
||||
|
||||
return BuildGuildObjectFromDbResult(rows, err)
|
||||
}
|
||||
|
||||
func GetGuildInfoByCharacterId(charID uint32) (*Guild, error) {
|
||||
db, err := database.GetDB()
|
||||
logger := logger.Get()
|
||||
|
||||
if err != nil {
|
||||
logger.Fatal(fmt.Sprintf("Failed to get database instance: %s", err))
|
||||
}
|
||||
rows, err := db.Queryx(fmt.Sprintf(`
|
||||
%s
|
||||
WHERE EXISTS(
|
||||
SELECT 1
|
||||
FROM guild_characters gc1
|
||||
WHERE gc1.character_id = $1
|
||||
AND gc1.guild_id = g.id
|
||||
)
|
||||
OR EXISTS(
|
||||
SELECT 1
|
||||
FROM guild_applications ga
|
||||
WHERE ga.character_id = $1
|
||||
AND ga.guild_id = g.id
|
||||
AND ga.application_type = 'applied'
|
||||
)
|
||||
LIMIT 1
|
||||
`, GuildInfoSelectQuery), charID)
|
||||
|
||||
if err != nil {
|
||||
logger.Error("failed to retrieve guild for character", zap.Error(err), zap.Uint32("charID", charID))
|
||||
return nil, err
|
||||
}
|
||||
|
||||
defer rows.Close()
|
||||
|
||||
hasRow := rows.Next()
|
||||
|
||||
if !hasRow {
|
||||
return nil, nil
|
||||
}
|
||||
|
||||
return BuildGuildObjectFromDbResult(rows, err)
|
||||
}
|
||||
|
||||
func BuildGuildObjectFromDbResult(result *sqlx.Rows, err error) (*Guild, error) {
|
||||
guild := &Guild{}
|
||||
logger := logger.Get()
|
||||
|
||||
err = result.StructScan(guild)
|
||||
|
||||
if err != nil {
|
||||
logger.Error("failed to retrieve guild data from database", zap.Error(err))
|
||||
return nil, err
|
||||
}
|
||||
|
||||
return guild, nil
|
||||
}
|
||||
112
internal/service/guild_alliance.go
Normal file
112
internal/service/guild_alliance.go
Normal file
@@ -0,0 +1,112 @@
|
||||
package service
|
||||
|
||||
import (
|
||||
"erupe-ce/utils/database"
|
||||
"erupe-ce/utils/logger"
|
||||
"fmt"
|
||||
"time"
|
||||
|
||||
"github.com/jmoiron/sqlx"
|
||||
"go.uber.org/zap"
|
||||
)
|
||||
|
||||
type GuildAlliance struct {
|
||||
ID uint32 `db:"id"`
|
||||
Name string `db:"name"`
|
||||
CreatedAt time.Time `db:"created_at"`
|
||||
TotalMembers uint16
|
||||
|
||||
ParentGuildID uint32 `db:"parent_id"`
|
||||
SubGuild1ID uint32 `db:"sub1_id"`
|
||||
SubGuild2ID uint32 `db:"sub2_id"`
|
||||
|
||||
ParentGuild Guild
|
||||
SubGuild1 Guild
|
||||
SubGuild2 Guild
|
||||
}
|
||||
|
||||
const AllianceInfoSelectQuery = `
|
||||
SELECT
|
||||
ga.id,
|
||||
ga.name,
|
||||
created_at,
|
||||
parent_id,
|
||||
CASE
|
||||
WHEN sub1_id IS NULL THEN 0
|
||||
ELSE sub1_id
|
||||
END,
|
||||
CASE
|
||||
WHEN sub2_id IS NULL THEN 0
|
||||
ELSE sub2_id
|
||||
END
|
||||
FROM guild_alliances ga
|
||||
`
|
||||
|
||||
func GetAllianceData(AllianceID uint32) (*GuildAlliance, error) {
|
||||
db, err := database.GetDB()
|
||||
logger := logger.Get()
|
||||
|
||||
if err != nil {
|
||||
logger.Fatal(fmt.Sprintf("Failed to get database instance: %s", err))
|
||||
}
|
||||
rows, err := db.Queryx(fmt.Sprintf(`
|
||||
%s
|
||||
WHERE ga.id = $1
|
||||
`, AllianceInfoSelectQuery), AllianceID)
|
||||
if err != nil {
|
||||
logger.Error("Failed to retrieve alliance data from database", zap.Error(err))
|
||||
return nil, err
|
||||
}
|
||||
defer rows.Close()
|
||||
hasRow := rows.Next()
|
||||
if !hasRow {
|
||||
return nil, nil
|
||||
}
|
||||
|
||||
return BuildAllianceObjectFromDbResult(rows, err)
|
||||
}
|
||||
|
||||
func BuildAllianceObjectFromDbResult(result *sqlx.Rows, err error) (*GuildAlliance, error) {
|
||||
alliance := &GuildAlliance{}
|
||||
logger := logger.Get()
|
||||
|
||||
err = result.StructScan(alliance)
|
||||
|
||||
if err != nil {
|
||||
logger.Error("failed to retrieve alliance from database", zap.Error(err))
|
||||
return nil, err
|
||||
}
|
||||
|
||||
parentGuild, err := GetGuildInfoByID(alliance.ParentGuildID)
|
||||
if err != nil {
|
||||
logger.Error("Failed to get parent guild info", zap.Error(err))
|
||||
return nil, err
|
||||
} else {
|
||||
alliance.ParentGuild = *parentGuild
|
||||
alliance.TotalMembers += parentGuild.MemberCount
|
||||
}
|
||||
|
||||
if alliance.SubGuild1ID > 0 {
|
||||
subGuild1, err := GetGuildInfoByID(alliance.SubGuild1ID)
|
||||
if err != nil {
|
||||
logger.Error("Failed to get sub guild 1 info", zap.Error(err))
|
||||
return nil, err
|
||||
} else {
|
||||
alliance.SubGuild1 = *subGuild1
|
||||
alliance.TotalMembers += subGuild1.MemberCount
|
||||
}
|
||||
}
|
||||
|
||||
if alliance.SubGuild2ID > 0 {
|
||||
subGuild2, err := GetGuildInfoByID(alliance.SubGuild2ID)
|
||||
if err != nil {
|
||||
logger.Error("Failed to get sub guild 2 info", zap.Error(err))
|
||||
return nil, err
|
||||
} else {
|
||||
alliance.SubGuild2 = *subGuild2
|
||||
alliance.TotalMembers += subGuild2.MemberCount
|
||||
}
|
||||
}
|
||||
|
||||
return alliance, nil
|
||||
}
|
||||
@@ -1,6 +1,8 @@
|
||||
package channelserver
|
||||
package service
|
||||
|
||||
import (
|
||||
"erupe-ce/utils/database"
|
||||
"erupe-ce/utils/logger"
|
||||
"fmt"
|
||||
"time"
|
||||
|
||||
@@ -45,11 +47,17 @@ func (gm *GuildMember) IsSubLeader() bool {
|
||||
return gm.OrderIndex <= 3
|
||||
}
|
||||
|
||||
func (gm *GuildMember) Save(s *Session) error {
|
||||
_, err := s.server.db.Exec("UPDATE guild_characters SET avoid_leadership=$1, order_index=$2 WHERE character_id=$3", gm.AvoidLeadership, gm.OrderIndex, gm.CharID)
|
||||
func (gm *GuildMember) Save() error {
|
||||
db, err := database.GetDB()
|
||||
logger := logger.Get()
|
||||
|
||||
if err != nil {
|
||||
s.logger.Error(
|
||||
logger.Fatal(fmt.Sprintf("Failed to get database instance: %s", err))
|
||||
}
|
||||
_, err = db.Exec("UPDATE guild_characters SET avoid_leadership=$1, order_index=$2 WHERE character_id=$3", gm.AvoidLeadership, gm.OrderIndex, gm.CharID)
|
||||
|
||||
if err != nil {
|
||||
logger.Error(
|
||||
"failed to update guild member data",
|
||||
zap.Error(err),
|
||||
zap.Uint32("charID", gm.CharID),
|
||||
@@ -86,14 +94,20 @@ SELECT * FROM (
|
||||
) AS subquery
|
||||
`
|
||||
|
||||
func GetGuildMembers(s *Session, guildID uint32, applicants bool) ([]*GuildMember, error) {
|
||||
rows, err := s.server.db.Queryx(fmt.Sprintf(`
|
||||
func GetGuildMembers(guildID uint32, applicants bool) ([]*GuildMember, error) {
|
||||
db, err := database.GetDB()
|
||||
logger := logger.Get()
|
||||
|
||||
if err != nil {
|
||||
logger.Fatal(fmt.Sprintf("Failed to get database instance: %s", err))
|
||||
}
|
||||
rows, err := db.Queryx(fmt.Sprintf(`
|
||||
%s
|
||||
WHERE guild_id = $1 AND is_applicant = $2
|
||||
`, guildMembersSelectSQL), guildID, applicants)
|
||||
|
||||
if err != nil {
|
||||
s.logger.Error("failed to retrieve membership data for guild", zap.Error(err), zap.Uint32("guildID", guildID))
|
||||
logger.Error("failed to retrieve membership data for guild", zap.Error(err), zap.Uint32("guildID", guildID))
|
||||
return nil, err
|
||||
}
|
||||
|
||||
@@ -102,7 +116,7 @@ func GetGuildMembers(s *Session, guildID uint32, applicants bool) ([]*GuildMembe
|
||||
members := make([]*GuildMember, 0)
|
||||
|
||||
for rows.Next() {
|
||||
member, err := buildGuildMemberObjectFromDBResult(rows, err, s)
|
||||
member, err := buildGuildMemberObjectFromDBResult(rows, err)
|
||||
|
||||
if err != nil {
|
||||
return nil, err
|
||||
@@ -114,11 +128,17 @@ func GetGuildMembers(s *Session, guildID uint32, applicants bool) ([]*GuildMembe
|
||||
return members, nil
|
||||
}
|
||||
|
||||
func GetCharacterGuildData(s *Session, charID uint32) (*GuildMember, error) {
|
||||
rows, err := s.server.db.Queryx(fmt.Sprintf("%s WHERE character_id=$1", guildMembersSelectSQL), charID)
|
||||
func GetCharacterGuildData(charID uint32) (*GuildMember, error) {
|
||||
db, err := database.GetDB()
|
||||
logger := logger.Get()
|
||||
|
||||
if err != nil {
|
||||
s.logger.Error(fmt.Sprintf("failed to retrieve membership data for character '%d'", charID))
|
||||
logger.Fatal(fmt.Sprintf("Failed to get database instance: %s", err))
|
||||
}
|
||||
rows, err := db.Queryx(fmt.Sprintf("%s WHERE character_id=$1", guildMembersSelectSQL), charID)
|
||||
|
||||
if err != nil {
|
||||
logger.Error(fmt.Sprintf("failed to retrieve membership data for character '%d'", charID))
|
||||
return nil, err
|
||||
}
|
||||
|
||||
@@ -130,16 +150,18 @@ func GetCharacterGuildData(s *Session, charID uint32) (*GuildMember, error) {
|
||||
return nil, nil
|
||||
}
|
||||
|
||||
return buildGuildMemberObjectFromDBResult(rows, err, s)
|
||||
return buildGuildMemberObjectFromDBResult(rows, err)
|
||||
}
|
||||
|
||||
func buildGuildMemberObjectFromDBResult(rows *sqlx.Rows, err error, s *Session) (*GuildMember, error) {
|
||||
func buildGuildMemberObjectFromDBResult(rows *sqlx.Rows, err error) (*GuildMember, error) {
|
||||
logger := logger.Get()
|
||||
|
||||
memberData := &GuildMember{}
|
||||
|
||||
err = rows.StructScan(&memberData)
|
||||
|
||||
if err != nil {
|
||||
s.logger.Error("failed to retrieve guild data from database", zap.Error(err))
|
||||
logger.Error("failed to retrieve guild data from database", zap.Error(err))
|
||||
return nil, err
|
||||
}
|
||||
|
||||
236
internal/service/mail.go
Normal file
236
internal/service/mail.go
Normal file
@@ -0,0 +1,236 @@
|
||||
package service
|
||||
|
||||
import (
|
||||
"database/sql"
|
||||
"erupe-ce/internal/constant"
|
||||
"erupe-ce/network/binpacket"
|
||||
"erupe-ce/network/mhfpacket"
|
||||
"erupe-ce/utils/byteframe"
|
||||
"erupe-ce/utils/database"
|
||||
|
||||
"erupe-ce/utils/logger"
|
||||
"fmt"
|
||||
"time"
|
||||
|
||||
"go.uber.org/zap"
|
||||
)
|
||||
|
||||
type Mail struct {
|
||||
ID int `db:"id"`
|
||||
SenderID uint32 `db:"sender_id"`
|
||||
RecipientID uint32 `db:"recipient_id"`
|
||||
Subject string `db:"subject"`
|
||||
Body string `db:"body"`
|
||||
Read bool `db:"read"`
|
||||
Deleted bool `db:"deleted"`
|
||||
Locked bool `db:"locked"`
|
||||
AttachedItemReceived bool `db:"attached_item_received"`
|
||||
AttachedItemID uint16 `db:"attached_item"`
|
||||
AttachedItemAmount uint16 `db:"attached_item_amount"`
|
||||
CreatedAt time.Time `db:"created_at"`
|
||||
IsGuildInvite bool `db:"is_guild_invite"`
|
||||
IsSystemMessage bool `db:"is_sys_message"`
|
||||
SenderName string `db:"sender_name"`
|
||||
}
|
||||
|
||||
func (m *Mail) Send(transaction *sql.Tx) error {
|
||||
db, err := database.GetDB()
|
||||
logger := logger.Get()
|
||||
|
||||
if err != nil {
|
||||
logger.Fatal(fmt.Sprintf("Failed to get database instance: %s", err))
|
||||
}
|
||||
query := `
|
||||
INSERT INTO mail (sender_id, recipient_id, subject, body, attached_item, attached_item_amount, is_guild_invite, is_sys_message)
|
||||
VALUES ($1, $2, $3, $4, $5, $6, $7, $8)
|
||||
`
|
||||
|
||||
if transaction == nil {
|
||||
_, err = db.Exec(query, m.SenderID, m.RecipientID, m.Subject, m.Body, m.AttachedItemID, m.AttachedItemAmount, m.IsGuildInvite, m.IsSystemMessage)
|
||||
} else {
|
||||
_, err = transaction.Exec(query, m.SenderID, m.RecipientID, m.Subject, m.Body, m.AttachedItemID, m.AttachedItemAmount, m.IsGuildInvite, m.IsSystemMessage)
|
||||
}
|
||||
|
||||
if err != nil {
|
||||
logger.Error(
|
||||
"failed to send mail",
|
||||
zap.Error(err),
|
||||
zap.Uint32("senderID", m.SenderID),
|
||||
zap.Uint32("recipientID", m.RecipientID),
|
||||
zap.String("subject", m.Subject),
|
||||
zap.String("body", m.Body),
|
||||
zap.Uint16("itemID", m.AttachedItemID),
|
||||
zap.Uint16("itemAmount", m.AttachedItemAmount),
|
||||
zap.Bool("isGuildInvite", m.IsGuildInvite),
|
||||
zap.Bool("isSystemMessage", m.IsSystemMessage),
|
||||
)
|
||||
return err
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
func (m *Mail) MarkRead() error {
|
||||
db, err := database.GetDB()
|
||||
logger := logger.Get()
|
||||
if err != nil {
|
||||
logger.Fatal(fmt.Sprintf("Failed to get database instance: %s", err))
|
||||
}
|
||||
_, err = db.Exec(`
|
||||
UPDATE mail SET read = true WHERE id = $1
|
||||
`, m.ID)
|
||||
|
||||
if err != nil {
|
||||
logger.Error(
|
||||
"failed to mark mail as read",
|
||||
zap.Error(err),
|
||||
zap.Int("mailID", m.ID),
|
||||
)
|
||||
return err
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
func GetMailListForCharacter(charID uint32) ([]Mail, error) {
|
||||
db, err := database.GetDB()
|
||||
logger := logger.Get()
|
||||
if err != nil {
|
||||
logger.Fatal(fmt.Sprintf("Failed to get database instance: %s", err))
|
||||
}
|
||||
rows, err := db.Queryx(`
|
||||
SELECT
|
||||
m.id,
|
||||
m.sender_id,
|
||||
m.recipient_id,
|
||||
m.subject,
|
||||
m.read,
|
||||
m.attached_item_received,
|
||||
m.attached_item,
|
||||
m.attached_item_amount,
|
||||
m.created_at,
|
||||
m.is_guild_invite,
|
||||
m.is_sys_message,
|
||||
m.deleted,
|
||||
m.locked,
|
||||
c.name as sender_name
|
||||
FROM mail m
|
||||
JOIN characters c ON c.id = m.sender_id
|
||||
WHERE recipient_id = $1 AND m.deleted = false
|
||||
ORDER BY m.created_at DESC, id DESC
|
||||
LIMIT 32
|
||||
`, charID)
|
||||
|
||||
if err != nil {
|
||||
logger.Error("failed to get mail for character", zap.Error(err), zap.Uint32("charID", charID))
|
||||
return nil, err
|
||||
}
|
||||
|
||||
defer rows.Close()
|
||||
|
||||
allMail := make([]Mail, 0)
|
||||
|
||||
for rows.Next() {
|
||||
mail := Mail{}
|
||||
|
||||
err := rows.StructScan(&mail)
|
||||
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
allMail = append(allMail, mail)
|
||||
}
|
||||
|
||||
return allMail, nil
|
||||
}
|
||||
|
||||
func GetMailByID(ID int) (*Mail, error) {
|
||||
db, err := database.GetDB()
|
||||
logger := logger.Get()
|
||||
|
||||
if err != nil {
|
||||
logger.Fatal(fmt.Sprintf("Failed to get database instance: %s", err))
|
||||
}
|
||||
row := db.QueryRowx(`
|
||||
SELECT
|
||||
m.id,
|
||||
m.sender_id,
|
||||
m.recipient_id,
|
||||
m.subject,
|
||||
m.read,
|
||||
m.body,
|
||||
m.attached_item_received,
|
||||
m.attached_item,
|
||||
m.attached_item_amount,
|
||||
m.created_at,
|
||||
m.is_guild_invite,
|
||||
m.is_sys_message,
|
||||
m.deleted,
|
||||
m.locked,
|
||||
c.name as sender_name
|
||||
FROM mail m
|
||||
JOIN characters c ON c.id = m.sender_id
|
||||
WHERE m.id = $1
|
||||
LIMIT 1
|
||||
`, ID)
|
||||
|
||||
mail := &Mail{}
|
||||
|
||||
err = row.StructScan(mail)
|
||||
|
||||
if err != nil {
|
||||
logger.Error(
|
||||
"failed to retrieve mail",
|
||||
zap.Error(err),
|
||||
zap.Int("mailID", ID),
|
||||
)
|
||||
return nil, err
|
||||
}
|
||||
|
||||
return mail, nil
|
||||
}
|
||||
|
||||
type SessionMail interface {
|
||||
QueueSendMHFLazy(packet mhfpacket.MHFPacket)
|
||||
}
|
||||
|
||||
func SendMailNotification(m *Mail, recipient SessionMail) {
|
||||
bf := byteframe.NewByteFrame()
|
||||
|
||||
notification := &binpacket.MsgBinMailNotify{
|
||||
SenderName: getCharacterName(m.SenderID),
|
||||
}
|
||||
|
||||
notification.Build(bf)
|
||||
|
||||
castedBinary := &mhfpacket.MsgSysCastedBinary{
|
||||
CharID: m.SenderID,
|
||||
BroadcastType: 0x00,
|
||||
MessageType: constant.BinaryMessageTypeMailNotify,
|
||||
RawDataPayload: bf.Data(),
|
||||
}
|
||||
|
||||
castedBinary.Build(bf)
|
||||
|
||||
recipient.QueueSendMHFLazy(castedBinary)
|
||||
}
|
||||
|
||||
func getCharacterName(charID uint32) string {
|
||||
db, err := database.GetDB()
|
||||
logger := logger.Get()
|
||||
|
||||
if err != nil {
|
||||
logger.Fatal(fmt.Sprintf("Failed to get database instance: %s", err))
|
||||
}
|
||||
row := db.QueryRow("SELECT name FROM characters WHERE id = $1", charID)
|
||||
|
||||
charName := ""
|
||||
|
||||
err = row.Scan(&charName)
|
||||
|
||||
if err != nil {
|
||||
return ""
|
||||
}
|
||||
return charName
|
||||
}
|
||||
@@ -1,24 +1,29 @@
|
||||
package channelserver
|
||||
package system
|
||||
|
||||
import (
|
||||
"sync"
|
||||
|
||||
"erupe-ce/common/byteframe"
|
||||
"erupe-ce/network/mhfpacket"
|
||||
)
|
||||
|
||||
type SessionStage interface {
|
||||
QueueSendMHFLazy(packet mhfpacket.MHFPacket)
|
||||
GetCharID() uint32
|
||||
GetName() string
|
||||
}
|
||||
|
||||
// Object holds infomation about a specific object.
|
||||
type Object struct {
|
||||
sync.RWMutex
|
||||
id uint32
|
||||
ownerCharID uint32
|
||||
x, y, z float32
|
||||
Id uint32
|
||||
OwnerCharID uint32
|
||||
X, Y, Z float32
|
||||
}
|
||||
|
||||
// stageBinaryKey is a struct used as a map key for identifying a stage binary part.
|
||||
type stageBinaryKey struct {
|
||||
id0 uint8
|
||||
id1 uint8
|
||||
type StageBinaryKey struct {
|
||||
Id0 uint8
|
||||
Id1 uint8
|
||||
}
|
||||
|
||||
// Stage holds stage-specific information
|
||||
@@ -26,73 +31,64 @@ type Stage struct {
|
||||
sync.RWMutex
|
||||
|
||||
// Stage ID string
|
||||
id string
|
||||
Id string
|
||||
|
||||
// Objects
|
||||
objects map[uint32]*Object
|
||||
Objects map[uint32]*Object
|
||||
objectIndex uint8
|
||||
|
||||
// Map of session -> charID.
|
||||
// These are clients that are CURRENTLY in the stage
|
||||
clients map[*Session]uint32
|
||||
Clients map[SessionStage]uint32
|
||||
|
||||
// Map of charID -> bool, key represents whether they are ready
|
||||
// These are clients that aren't in the stage, but have reserved a slot (for quests, etc).
|
||||
reservedClientSlots map[uint32]bool
|
||||
ReservedClientSlots map[uint32]bool
|
||||
|
||||
// These are raw binary blobs that the stage owner sets,
|
||||
// other clients expect the server to echo them back in the exact same format.
|
||||
rawBinaryData map[stageBinaryKey][]byte
|
||||
RawBinaryData map[StageBinaryKey][]byte
|
||||
|
||||
host *Session
|
||||
maxPlayers uint16
|
||||
password string
|
||||
locked bool
|
||||
Host SessionStage
|
||||
MaxPlayers uint16
|
||||
Password string
|
||||
Locked bool
|
||||
}
|
||||
|
||||
// NewStage creates a new stage with intialized values.
|
||||
func NewStage(ID string) *Stage {
|
||||
s := &Stage{
|
||||
id: ID,
|
||||
clients: make(map[*Session]uint32),
|
||||
reservedClientSlots: make(map[uint32]bool),
|
||||
objects: make(map[uint32]*Object),
|
||||
Id: ID,
|
||||
Clients: make(map[SessionStage]uint32),
|
||||
ReservedClientSlots: make(map[uint32]bool),
|
||||
Objects: make(map[uint32]*Object),
|
||||
objectIndex: 0,
|
||||
rawBinaryData: make(map[stageBinaryKey][]byte),
|
||||
maxPlayers: 127,
|
||||
RawBinaryData: make(map[StageBinaryKey][]byte),
|
||||
MaxPlayers: 127,
|
||||
}
|
||||
return s
|
||||
}
|
||||
|
||||
// BroadcastMHF queues a MHFPacket to be sent to all sessions in the stage.
|
||||
func (s *Stage) BroadcastMHF(pkt mhfpacket.MHFPacket, ignoredSession *Session) {
|
||||
func (s *Stage) BroadcastMHF(pkt mhfpacket.MHFPacket, ignoredSession SessionStage) {
|
||||
s.Lock()
|
||||
defer s.Unlock()
|
||||
for session := range s.clients {
|
||||
for session := range s.Clients {
|
||||
if session == ignoredSession {
|
||||
continue
|
||||
}
|
||||
|
||||
// Make the header
|
||||
bf := byteframe.NewByteFrame()
|
||||
bf.WriteUint16(uint16(pkt.Opcode()))
|
||||
|
||||
// Build the packet onto the byteframe.
|
||||
pkt.Build(bf, session.clientContext)
|
||||
|
||||
// Enqueue in a non-blocking way that drops the packet if the connections send buffer channel is full.
|
||||
session.QueueSendNonBlocking(bf.Data())
|
||||
session.QueueSendMHFLazy(pkt)
|
||||
}
|
||||
}
|
||||
|
||||
func (s *Stage) isCharInQuestByID(charID uint32) bool {
|
||||
if _, exists := s.reservedClientSlots[charID]; exists {
|
||||
if _, exists := s.ReservedClientSlots[charID]; exists {
|
||||
return exists
|
||||
}
|
||||
|
||||
return false
|
||||
}
|
||||
|
||||
func (s *Stage) isQuest() bool {
|
||||
return len(s.reservedClientSlots) > 0
|
||||
func (s *Stage) IsQuest() bool {
|
||||
return len(s.ReservedClientSlots) > 0
|
||||
}
|
||||
249
main.go
249
main.go
@@ -1,7 +1,7 @@
|
||||
package main
|
||||
|
||||
import (
|
||||
_config "erupe-ce/config"
|
||||
"erupe-ce/config"
|
||||
"fmt"
|
||||
"net"
|
||||
"os"
|
||||
@@ -13,21 +13,18 @@ import (
|
||||
"erupe-ce/server/api"
|
||||
"erupe-ce/server/channelserver"
|
||||
"erupe-ce/server/discordbot"
|
||||
"erupe-ce/server/entranceserver"
|
||||
"erupe-ce/server/signserver"
|
||||
"erupe-ce/server/entrance"
|
||||
"erupe-ce/server/sign"
|
||||
"erupe-ce/utils/database"
|
||||
"erupe-ce/utils/logger"
|
||||
|
||||
"erupe-ce/utils/gametime"
|
||||
|
||||
"github.com/jmoiron/sqlx"
|
||||
_ "github.com/lib/pq"
|
||||
"go.uber.org/zap"
|
||||
)
|
||||
|
||||
// Temporary DB auto clean on startup for quick development & testing.
|
||||
func cleanDB(db *sqlx.DB) {
|
||||
_ = db.MustExec("DELETE FROM guild_characters")
|
||||
_ = db.MustExec("DELETE FROM guilds")
|
||||
_ = db.MustExec("DELETE FROM characters")
|
||||
_ = db.MustExec("DELETE FROM users")
|
||||
}
|
||||
var mainLogger logger.Logger
|
||||
|
||||
var Commit = func() string {
|
||||
if info, ok := debug.ReadBuildInfo(); ok {
|
||||
@@ -40,166 +37,79 @@ var Commit = func() string {
|
||||
return "unknown"
|
||||
}
|
||||
|
||||
func initLogger() {
|
||||
var zapLogger *zap.Logger
|
||||
zapLogger, _ = zap.NewDevelopment(zap.WithCaller(false))
|
||||
defer zapLogger.Sync()
|
||||
// Initialize the global logger
|
||||
logger.Init(zapLogger)
|
||||
mainLogger = logger.Get().Named("main")
|
||||
|
||||
}
|
||||
|
||||
func main() {
|
||||
var err error
|
||||
|
||||
var zapLogger *zap.Logger
|
||||
config := _config.ErupeConfig
|
||||
zapLogger, _ = zap.NewDevelopment()
|
||||
config := config.GetConfig()
|
||||
initLogger()
|
||||
mainLogger.Info(fmt.Sprintf("Starting Erupe (9.3b-%s)", Commit()))
|
||||
mainLogger.Info(fmt.Sprintf("Client Mode: %s (%d)", config.ClientMode, config.ClientID))
|
||||
|
||||
defer zapLogger.Sync()
|
||||
logger := zapLogger.Named("main")
|
||||
checkAndExitIf(config.Database.Password == "", "Database password is blank")
|
||||
|
||||
logger.Info(fmt.Sprintf("Starting Erupe (9.3b-%s)", Commit()))
|
||||
logger.Info(fmt.Sprintf("Client Mode: %s (%d)", config.ClientMode, config.RealClientMode))
|
||||
resolveHostIP()
|
||||
|
||||
if config.Database.Password == "" {
|
||||
preventClose("Database password is blank")
|
||||
}
|
||||
discordBot := initializeDiscordBot()
|
||||
|
||||
if net.ParseIP(config.Host) == nil {
|
||||
ips, _ := net.LookupIP(config.Host)
|
||||
for _, ip := range ips {
|
||||
if ip != nil {
|
||||
config.Host = ip.String()
|
||||
break
|
||||
}
|
||||
}
|
||||
if net.ParseIP(config.Host) == nil {
|
||||
preventClose("Invalid host address")
|
||||
}
|
||||
}
|
||||
|
||||
// Discord bot
|
||||
var discordBot *discordbot.DiscordBot = nil
|
||||
|
||||
if config.Discord.Enabled {
|
||||
bot, err := discordbot.NewDiscordBot(discordbot.Options{
|
||||
Logger: logger,
|
||||
Config: _config.ErupeConfig,
|
||||
})
|
||||
|
||||
if err != nil {
|
||||
preventClose(fmt.Sprintf("Discord: Failed to start, %s", err.Error()))
|
||||
}
|
||||
|
||||
// Discord bot
|
||||
err = bot.Start()
|
||||
|
||||
if err != nil {
|
||||
preventClose(fmt.Sprintf("Discord: Failed to start, %s", err.Error()))
|
||||
}
|
||||
|
||||
discordBot = bot
|
||||
|
||||
_, err = discordBot.Session.ApplicationCommandBulkOverwrite(discordBot.Session.State.User.ID, "", discordbot.Commands)
|
||||
if err != nil {
|
||||
preventClose(fmt.Sprintf("Discord: Failed to start, %s", err.Error()))
|
||||
}
|
||||
|
||||
logger.Info("Discord: Started successfully")
|
||||
} else {
|
||||
logger.Info("Discord: Disabled")
|
||||
}
|
||||
|
||||
// Create the postgres DB pool.
|
||||
connectString := fmt.Sprintf(
|
||||
"host='%s' port='%d' user='%s' password='%s' dbname='%s' sslmode=disable",
|
||||
config.Database.Host,
|
||||
config.Database.Port,
|
||||
config.Database.User,
|
||||
config.Database.Password,
|
||||
config.Database.Database,
|
||||
)
|
||||
|
||||
db, err := sqlx.Open("postgres", connectString)
|
||||
database, err := database.InitDB(config)
|
||||
if err != nil {
|
||||
preventClose(fmt.Sprintf("Database: Failed to open, %s", err.Error()))
|
||||
mainLogger.Fatal(fmt.Sprintf("Database initialization failed: %s", err))
|
||||
}
|
||||
|
||||
// Test the DB connection.
|
||||
err = db.Ping()
|
||||
if err != nil {
|
||||
preventClose(fmt.Sprintf("Database: Failed to ping, %s", err.Error()))
|
||||
}
|
||||
logger.Info("Database: Started successfully")
|
||||
|
||||
// Clear stale data
|
||||
if config.DebugOptions.ProxyPort == 0 {
|
||||
_ = db.MustExec("DELETE FROM sign_sessions")
|
||||
}
|
||||
_ = db.MustExec("DELETE FROM servers")
|
||||
_ = db.MustExec(`UPDATE guild_characters SET treasure_hunt=NULL`)
|
||||
|
||||
// Clean the DB if the option is on.
|
||||
if config.DebugOptions.CleanDB {
|
||||
logger.Info("Database: Started clearing...")
|
||||
cleanDB(db)
|
||||
logger.Info("Database: Finished clearing")
|
||||
}
|
||||
|
||||
logger.Info(fmt.Sprintf("Server Time: %s", channelserver.TimeAdjusted().String()))
|
||||
mainLogger.Info(fmt.Sprintf("Server Time: %s", gametime.TimeAdjusted().String()))
|
||||
|
||||
// Now start our server(s).
|
||||
|
||||
// Entrance server.
|
||||
|
||||
var entranceServer *entranceserver.Server
|
||||
var entranceServer *entrance.EntranceServer
|
||||
if config.Entrance.Enabled {
|
||||
entranceServer = entranceserver.NewServer(
|
||||
&entranceserver.Config{
|
||||
Logger: logger.Named("entrance"),
|
||||
ErupeConfig: _config.ErupeConfig,
|
||||
DB: db,
|
||||
})
|
||||
entranceServer = entrance.NewServer()
|
||||
err = entranceServer.Start()
|
||||
if err != nil {
|
||||
preventClose(fmt.Sprintf("Entrance: Failed to start, %s", err.Error()))
|
||||
}
|
||||
logger.Info("Entrance: Started successfully")
|
||||
mainLogger.Info("Entrance: Started successfully")
|
||||
} else {
|
||||
logger.Info("Entrance: Disabled")
|
||||
mainLogger.Info("Entrance: Disabled")
|
||||
}
|
||||
|
||||
// Sign server.
|
||||
|
||||
var signServer *signserver.Server
|
||||
var signServer *sign.SignServer
|
||||
if config.Sign.Enabled {
|
||||
signServer = signserver.NewServer(
|
||||
&signserver.Config{
|
||||
Logger: logger.Named("sign"),
|
||||
ErupeConfig: _config.ErupeConfig,
|
||||
DB: db,
|
||||
})
|
||||
signServer = sign.NewServer()
|
||||
err = signServer.Start()
|
||||
if err != nil {
|
||||
preventClose(fmt.Sprintf("Sign: Failed to start, %s", err.Error()))
|
||||
}
|
||||
logger.Info("Sign: Started successfully")
|
||||
mainLogger.Info("Sign: Started successfully")
|
||||
} else {
|
||||
logger.Info("Sign: Disabled")
|
||||
mainLogger.Info("Sign: Disabled")
|
||||
}
|
||||
|
||||
// New Sign server
|
||||
var ApiServer *api.APIServer
|
||||
// Api server
|
||||
var apiServer *api.APIServer
|
||||
if config.API.Enabled {
|
||||
ApiServer = api.NewAPIServer(
|
||||
&api.Config{
|
||||
Logger: logger.Named("sign"),
|
||||
ErupeConfig: _config.ErupeConfig,
|
||||
DB: db,
|
||||
})
|
||||
err = ApiServer.Start()
|
||||
apiServer = api.NewAPIServer()
|
||||
err = apiServer.Start()
|
||||
if err != nil {
|
||||
preventClose(fmt.Sprintf("API: Failed to start, %s", err.Error()))
|
||||
}
|
||||
logger.Info("API: Started successfully")
|
||||
mainLogger.Info("API: Started successfully")
|
||||
} else {
|
||||
logger.Info("API: Disabled")
|
||||
mainLogger.Info("API: Disabled")
|
||||
}
|
||||
|
||||
var channels []*channelserver.Server
|
||||
|
||||
var channelServers []*channelserver.ChannelServer
|
||||
if config.Channel.Enabled {
|
||||
channelQuery := ""
|
||||
si := 0
|
||||
@@ -209,11 +119,8 @@ func main() {
|
||||
for i, ce := range ee.Channels {
|
||||
sid := (4096 + si*256) + (16 + ci)
|
||||
c := *channelserver.NewServer(&channelserver.Config{
|
||||
ID: uint16(sid),
|
||||
Logger: logger.Named("channel-" + fmt.Sprint(count)),
|
||||
ErupeConfig: _config.ErupeConfig,
|
||||
DB: db,
|
||||
DiscordBot: discordBot,
|
||||
ID: uint16(sid),
|
||||
DiscordBot: discordBot,
|
||||
})
|
||||
if ee.IP == "" {
|
||||
c.IP = config.Host
|
||||
@@ -227,8 +134,8 @@ func main() {
|
||||
preventClose(fmt.Sprintf("Channel: Failed to start, %s", err.Error()))
|
||||
} else {
|
||||
channelQuery += fmt.Sprintf(`INSERT INTO servers (server_id, current_players, world_name, world_description, land) VALUES (%d, 0, '%s', '%s', %d);`, sid, ee.Name, ee.Description, i+1)
|
||||
channels = append(channels, &c)
|
||||
logger.Info(fmt.Sprintf("Channel %d (%d): Started successfully", count, ce.Port))
|
||||
channelServers = append(channelServers, &c)
|
||||
mainLogger.Info(fmt.Sprintf("Channel %d (%d): Started successfully", count, ce.Port))
|
||||
ci++
|
||||
count++
|
||||
}
|
||||
@@ -238,14 +145,14 @@ func main() {
|
||||
}
|
||||
|
||||
// Register all servers in DB
|
||||
_ = db.MustExec(channelQuery)
|
||||
_ = database.MustExec(channelQuery)
|
||||
|
||||
for _, c := range channels {
|
||||
c.Channels = channels
|
||||
for _, c := range channelServers {
|
||||
c.Channels = channelServers
|
||||
}
|
||||
}
|
||||
|
||||
logger.Info("Finished starting Erupe")
|
||||
mainLogger.Info("Finished starting Erupe")
|
||||
|
||||
// Wait for exit or interrupt with ctrl+C.
|
||||
c := make(chan os.Signal, 1)
|
||||
@@ -255,17 +162,17 @@ func main() {
|
||||
if !config.DisableSoftCrash {
|
||||
for i := 0; i < 10; i++ {
|
||||
message := fmt.Sprintf("Shutting down in %d...", 10-i)
|
||||
for _, c := range channels {
|
||||
c.BroadcastChatMessage(message)
|
||||
for _, channelServer := range channelServers {
|
||||
channelServer.BroadcastChatMessage(message)
|
||||
}
|
||||
logger.Info(message)
|
||||
mainLogger.Warn(message)
|
||||
time.Sleep(time.Second)
|
||||
}
|
||||
}
|
||||
|
||||
if config.Channel.Enabled {
|
||||
for _, c := range channels {
|
||||
c.Shutdown()
|
||||
for _, channelServer := range channelServers {
|
||||
channelServer.Shutdown()
|
||||
}
|
||||
}
|
||||
|
||||
@@ -274,7 +181,7 @@ func main() {
|
||||
}
|
||||
|
||||
if config.API.Enabled {
|
||||
ApiServer.Shutdown()
|
||||
apiServer.Shutdown()
|
||||
}
|
||||
|
||||
if config.Entrance.Enabled {
|
||||
@@ -291,12 +198,46 @@ func wait() {
|
||||
}
|
||||
|
||||
func preventClose(text string) {
|
||||
if _config.ErupeConfig.DisableSoftCrash {
|
||||
if config.GetConfig().DisableSoftCrash {
|
||||
os.Exit(0)
|
||||
}
|
||||
fmt.Println("\nFailed to start Erupe:\n" + text)
|
||||
mainLogger.Error(fmt.Sprintf(("\nFailed to start Erupe:\n" + text)))
|
||||
go wait()
|
||||
fmt.Println("\nPress Enter/Return to exit...")
|
||||
fmt.Scanln()
|
||||
mainLogger.Error(fmt.Sprintf(("\nPress Enter/Return to exit...")))
|
||||
os.Exit(0)
|
||||
}
|
||||
|
||||
func checkAndExitIf(condition bool, message string) {
|
||||
if condition {
|
||||
preventClose(message)
|
||||
}
|
||||
}
|
||||
|
||||
func resolveHostIP() {
|
||||
if net.ParseIP(config.GetConfig().Host) == nil {
|
||||
ips, err := net.LookupIP(config.GetConfig().Host)
|
||||
if err == nil && len(ips) > 0 {
|
||||
config.GetConfig().Host = ips[0].String()
|
||||
}
|
||||
checkAndExitIf(net.ParseIP(config.GetConfig().Host) == nil, "Invalid host address")
|
||||
}
|
||||
}
|
||||
|
||||
func initializeDiscordBot() *discordbot.DiscordBot {
|
||||
if !config.GetConfig().Discord.Enabled {
|
||||
mainLogger.Info("Discord: Disabled")
|
||||
return nil
|
||||
}
|
||||
|
||||
bot, err := discordbot.NewDiscordBot()
|
||||
checkAndExitIf(err != nil, fmt.Sprintf("Discord: Failed to start, %s", err))
|
||||
|
||||
err = bot.Start()
|
||||
checkAndExitIf(err != nil, fmt.Sprintf("Discord: Failed to start, %s", err))
|
||||
|
||||
_, err = bot.Session.ApplicationCommandBulkOverwrite(bot.Session.State.User.ID, "", discordbot.Commands)
|
||||
checkAndExitIf(err != nil, fmt.Sprintf("Discord: Failed to register commands, %s", err))
|
||||
|
||||
mainLogger.Info("Discord: Started successfully")
|
||||
return bot
|
||||
}
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
package binpacket
|
||||
|
||||
import (
|
||||
"erupe-ce/common/byteframe"
|
||||
"erupe-ce/common/stringsupport"
|
||||
"erupe-ce/network"
|
||||
"erupe-ce/utils/byteframe"
|
||||
"erupe-ce/utils/stringsupport"
|
||||
)
|
||||
|
||||
// ChatType represents the chat message type (Thanks to @Alice on discord for identifying these!)
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
package binpacket
|
||||
|
||||
import (
|
||||
"erupe-ce/common/byteframe"
|
||||
"erupe-ce/common/stringsupport"
|
||||
"erupe-ce/network"
|
||||
"erupe-ce/utils/byteframe"
|
||||
"erupe-ce/utils/stringsupport"
|
||||
)
|
||||
|
||||
type MsgBinMailNotify struct {
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
package binpacket
|
||||
|
||||
import (
|
||||
"erupe-ce/common/byteframe"
|
||||
"erupe-ce/network"
|
||||
"erupe-ce/utils/byteframe"
|
||||
)
|
||||
|
||||
// MsgBinTargeted is a format used for some broadcast types
|
||||
|
||||
@@ -1,4 +0,0 @@
|
||||
package clientctx
|
||||
|
||||
// ClientContext holds contextual data required for packet encoding/decoding.
|
||||
type ClientContext struct{} // Unused
|
||||
@@ -3,7 +3,7 @@ package network
|
||||
import (
|
||||
"encoding/hex"
|
||||
"errors"
|
||||
_config "erupe-ce/config"
|
||||
"erupe-ce/config"
|
||||
"erupe-ce/network/crypto"
|
||||
"fmt"
|
||||
"io"
|
||||
@@ -51,7 +51,7 @@ func (cc *CryptConn) ReadPacket() ([]byte, error) {
|
||||
var encryptedPacketBody []byte
|
||||
|
||||
// Don't know when support for this was added, works in Forward.4, doesn't work in Season 6.0
|
||||
if _config.ErupeConfig.RealClientMode < _config.F1 {
|
||||
if config.GetConfig().ClientID < config.F1 {
|
||||
encryptedPacketBody = make([]byte, cph.DataSize)
|
||||
} else {
|
||||
encryptedPacketBody = make([]byte, uint32(cph.DataSize)+(uint32(cph.Pf0-0x03)*0x1000))
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
package entranceserver
|
||||
package bin8
|
||||
|
||||
import (
|
||||
"encoding/binary"
|
||||
@@ -1,4 +1,4 @@
|
||||
package entranceserver
|
||||
package bin8
|
||||
|
||||
import (
|
||||
"bytes"
|
||||
@@ -1,19 +1,18 @@
|
||||
package mhfpacket
|
||||
|
||||
import (
|
||||
"erupe-ce/common/byteframe"
|
||||
"erupe-ce/network"
|
||||
"erupe-ce/network/clientctx"
|
||||
"erupe-ce/utils/byteframe"
|
||||
)
|
||||
|
||||
// Parser is the interface that wraps the Parse method.
|
||||
type Parser interface {
|
||||
Parse(bf *byteframe.ByteFrame, ctx *clientctx.ClientContext) error
|
||||
Parse(bf *byteframe.ByteFrame) error
|
||||
}
|
||||
|
||||
// Builder is the interface that wraps the Build method.
|
||||
type Builder interface {
|
||||
Build(bf *byteframe.ByteFrame, ctx *clientctx.ClientContext) error
|
||||
Build(bf *byteframe.ByteFrame) error
|
||||
}
|
||||
|
||||
// Opcoder is the interface that wraps the Opcode method.
|
||||
|
||||
@@ -3,9 +3,8 @@ package mhfpacket
|
||||
import (
|
||||
"errors"
|
||||
|
||||
"erupe-ce/common/byteframe"
|
||||
"erupe-ce/network"
|
||||
"erupe-ce/network/clientctx"
|
||||
"erupe-ce/utils/byteframe"
|
||||
)
|
||||
|
||||
// MsgCaExchangeItem represents the MSG_CA_EXCHANGE_ITEM
|
||||
@@ -17,11 +16,11 @@ func (m *MsgCaExchangeItem) Opcode() network.PacketID {
|
||||
}
|
||||
|
||||
// Parse parses the packet from binary
|
||||
func (m *MsgCaExchangeItem) Parse(bf *byteframe.ByteFrame, ctx *clientctx.ClientContext) error {
|
||||
func (m *MsgCaExchangeItem) Parse(bf *byteframe.ByteFrame) error {
|
||||
return errors.New("NOT IMPLEMENTED")
|
||||
}
|
||||
|
||||
// Build builds a binary packet from the current data.
|
||||
func (m *MsgCaExchangeItem) Build(bf *byteframe.ByteFrame, ctx *clientctx.ClientContext) error {
|
||||
func (m *MsgCaExchangeItem) Build(bf *byteframe.ByteFrame) error {
|
||||
return errors.New("NOT IMPLEMENTED")
|
||||
}
|
||||
|
||||
@@ -3,10 +3,8 @@ package mhfpacket
|
||||
import (
|
||||
"errors"
|
||||
|
||||
"erupe-ce/network/clientctx"
|
||||
|
||||
"erupe-ce/network"
|
||||
"erupe-ce/common/byteframe"
|
||||
"erupe-ce/utils/byteframe"
|
||||
)
|
||||
|
||||
// MsgHead represents the MSG_HEAD
|
||||
@@ -18,11 +16,11 @@ func (m *MsgHead) Opcode() network.PacketID {
|
||||
}
|
||||
|
||||
// Parse parses the packet from binary
|
||||
func (m *MsgHead) Parse(bf *byteframe.ByteFrame, ctx *clientctx.ClientContext) error {
|
||||
func (m *MsgHead) Parse(bf *byteframe.ByteFrame) error {
|
||||
return errors.New("NOT IMPLEMENTED")
|
||||
}
|
||||
|
||||
// Build builds a binary packet from the current data.
|
||||
func (m *MsgHead) Build(bf *byteframe.ByteFrame, ctx *clientctx.ClientContext) error {
|
||||
func (m *MsgHead) Build(bf *byteframe.ByteFrame) error {
|
||||
return errors.New("NOT IMPLEMENTED")
|
||||
}
|
||||
|
||||
@@ -3,10 +3,8 @@ package mhfpacket
|
||||
import (
|
||||
"errors"
|
||||
|
||||
"erupe-ce/network/clientctx"
|
||||
|
||||
"erupe-ce/network"
|
||||
"erupe-ce/common/byteframe"
|
||||
"erupe-ce/utils/byteframe"
|
||||
)
|
||||
|
||||
// MsgMhfAcceptReadReward represents the MSG_MHF_ACCEPT_READ_REWARD
|
||||
@@ -18,11 +16,11 @@ func (m *MsgMhfAcceptReadReward) Opcode() network.PacketID {
|
||||
}
|
||||
|
||||
// Parse parses the packet from binary
|
||||
func (m *MsgMhfAcceptReadReward) Parse(bf *byteframe.ByteFrame, ctx *clientctx.ClientContext) error {
|
||||
func (m *MsgMhfAcceptReadReward) Parse(bf *byteframe.ByteFrame) error {
|
||||
return errors.New("NOT IMPLEMENTED")
|
||||
}
|
||||
|
||||
// Build builds a binary packet from the current data.
|
||||
func (m *MsgMhfAcceptReadReward) Build(bf *byteframe.ByteFrame, ctx *clientctx.ClientContext) error {
|
||||
func (m *MsgMhfAcceptReadReward) Build(bf *byteframe.ByteFrame) error {
|
||||
return errors.New("NOT IMPLEMENTED")
|
||||
}
|
||||
|
||||
@@ -2,11 +2,10 @@ package mhfpacket
|
||||
|
||||
import (
|
||||
"errors"
|
||||
_config "erupe-ce/config"
|
||||
"erupe-ce/config"
|
||||
|
||||
"erupe-ce/common/byteframe"
|
||||
"erupe-ce/network"
|
||||
"erupe-ce/network/clientctx"
|
||||
"erupe-ce/utils/byteframe"
|
||||
)
|
||||
|
||||
// MsgMhfAcquireCafeItem represents the MSG_MHF_ACQUIRE_CAFE_ITEM
|
||||
@@ -26,12 +25,12 @@ func (m *MsgMhfAcquireCafeItem) Opcode() network.PacketID {
|
||||
}
|
||||
|
||||
// Parse parses the packet from binary
|
||||
func (m *MsgMhfAcquireCafeItem) Parse(bf *byteframe.ByteFrame, ctx *clientctx.ClientContext) error {
|
||||
func (m *MsgMhfAcquireCafeItem) Parse(bf *byteframe.ByteFrame) error {
|
||||
m.AckHandle = bf.ReadUint32()
|
||||
m.ItemType = bf.ReadUint16()
|
||||
m.ItemID = bf.ReadUint16()
|
||||
m.Quant = bf.ReadUint16()
|
||||
if _config.ErupeConfig.RealClientMode >= _config.G1 {
|
||||
if config.GetConfig().ClientID >= config.G1 {
|
||||
m.PointCost = bf.ReadUint32()
|
||||
} else {
|
||||
m.PointCost = uint32(bf.ReadUint16())
|
||||
@@ -41,6 +40,6 @@ func (m *MsgMhfAcquireCafeItem) Parse(bf *byteframe.ByteFrame, ctx *clientctx.Cl
|
||||
}
|
||||
|
||||
// Build builds a binary packet from the current data.
|
||||
func (m *MsgMhfAcquireCafeItem) Build(bf *byteframe.ByteFrame, ctx *clientctx.ClientContext) error {
|
||||
func (m *MsgMhfAcquireCafeItem) Build(bf *byteframe.ByteFrame) error {
|
||||
return errors.New("NOT IMPLEMENTED")
|
||||
}
|
||||
|
||||
@@ -4,15 +4,14 @@ import (
|
||||
"errors"
|
||||
|
||||
"erupe-ce/network"
|
||||
"erupe-ce/network/clientctx"
|
||||
"erupe-ce/common/byteframe"
|
||||
"erupe-ce/utils/byteframe"
|
||||
)
|
||||
|
||||
// MsgMhfAcquireDistItem represents the MSG_MHF_ACQUIRE_DIST_ITEM
|
||||
type MsgMhfAcquireDistItem struct {
|
||||
AckHandle uint32
|
||||
AckHandle uint32
|
||||
DistributionType uint8
|
||||
DistributionID uint32
|
||||
DistributionID uint32
|
||||
}
|
||||
|
||||
// Opcode returns the ID associated with this packet type.
|
||||
@@ -21,7 +20,7 @@ func (m *MsgMhfAcquireDistItem) Opcode() network.PacketID {
|
||||
}
|
||||
|
||||
// Parse parses the packet from binary
|
||||
func (m *MsgMhfAcquireDistItem) Parse(bf *byteframe.ByteFrame, ctx *clientctx.ClientContext) error {
|
||||
func (m *MsgMhfAcquireDistItem) Parse(bf *byteframe.ByteFrame) error {
|
||||
m.AckHandle = bf.ReadUint32()
|
||||
m.DistributionType = bf.ReadUint8()
|
||||
m.DistributionID = bf.ReadUint32()
|
||||
@@ -29,6 +28,6 @@ func (m *MsgMhfAcquireDistItem) Parse(bf *byteframe.ByteFrame, ctx *clientctx.Cl
|
||||
}
|
||||
|
||||
// Build builds a binary packet from the current data.
|
||||
func (m *MsgMhfAcquireDistItem) Build(bf *byteframe.ByteFrame, ctx *clientctx.ClientContext) error {
|
||||
func (m *MsgMhfAcquireDistItem) Build(bf *byteframe.ByteFrame) error {
|
||||
return errors.New("NOT IMPLEMENTED")
|
||||
}
|
||||
|
||||
@@ -2,8 +2,7 @@ package mhfpacket
|
||||
|
||||
import (
|
||||
"erupe-ce/network"
|
||||
"erupe-ce/network/clientctx"
|
||||
"erupe-ce/common/byteframe"
|
||||
"erupe-ce/utils/byteframe"
|
||||
)
|
||||
|
||||
// MsgMhfAcquireExchangeShop represents the MSG_MHF_ACQUIRE_EXCHANGE_SHOP
|
||||
@@ -19,7 +18,7 @@ func (m *MsgMhfAcquireExchangeShop) Opcode() network.PacketID {
|
||||
}
|
||||
|
||||
// Parse parses the packet from binary
|
||||
func (m *MsgMhfAcquireExchangeShop) Parse(bf *byteframe.ByteFrame, ctx *clientctx.ClientContext) error {
|
||||
func (m *MsgMhfAcquireExchangeShop) Parse(bf *byteframe.ByteFrame) error {
|
||||
m.AckHandle = bf.ReadUint32()
|
||||
m.DataSize = bf.ReadUint16()
|
||||
m.RawDataPayload = bf.ReadBytes(uint(m.DataSize))
|
||||
@@ -27,7 +26,7 @@ func (m *MsgMhfAcquireExchangeShop) Parse(bf *byteframe.ByteFrame, ctx *clientct
|
||||
}
|
||||
|
||||
// Build builds a binary packet from the current data.
|
||||
func (m *MsgMhfAcquireExchangeShop) Build(bf *byteframe.ByteFrame, ctx *clientctx.ClientContext) error {
|
||||
func (m *MsgMhfAcquireExchangeShop) Build(bf *byteframe.ByteFrame) error {
|
||||
bf.WriteUint32(m.AckHandle)
|
||||
bf.WriteUint16(m.DataSize)
|
||||
bf.WriteBytes(m.RawDataPayload)
|
||||
|
||||
@@ -3,9 +3,8 @@ package mhfpacket
|
||||
import (
|
||||
"errors"
|
||||
|
||||
"erupe-ce/common/byteframe"
|
||||
"erupe-ce/network"
|
||||
"erupe-ce/network/clientctx"
|
||||
"erupe-ce/utils/byteframe"
|
||||
)
|
||||
|
||||
// MsgMhfAcquireFesta represents the MSG_MHF_ACQUIRE_FESTA
|
||||
@@ -22,7 +21,7 @@ func (m *MsgMhfAcquireFesta) Opcode() network.PacketID {
|
||||
}
|
||||
|
||||
// Parse parses the packet from binary
|
||||
func (m *MsgMhfAcquireFesta) Parse(bf *byteframe.ByteFrame, ctx *clientctx.ClientContext) error {
|
||||
func (m *MsgMhfAcquireFesta) Parse(bf *byteframe.ByteFrame) error {
|
||||
m.AckHandle = bf.ReadUint32()
|
||||
m.FestaID = bf.ReadUint32()
|
||||
m.GuildID = bf.ReadUint32()
|
||||
@@ -32,6 +31,6 @@ func (m *MsgMhfAcquireFesta) Parse(bf *byteframe.ByteFrame, ctx *clientctx.Clien
|
||||
}
|
||||
|
||||
// Build builds a binary packet from the current data.
|
||||
func (m *MsgMhfAcquireFesta) Build(bf *byteframe.ByteFrame, ctx *clientctx.ClientContext) error {
|
||||
func (m *MsgMhfAcquireFesta) Build(bf *byteframe.ByteFrame) error {
|
||||
return errors.New("NOT IMPLEMENTED")
|
||||
}
|
||||
|
||||
@@ -4,14 +4,13 @@ import (
|
||||
"errors"
|
||||
|
||||
"erupe-ce/network"
|
||||
"erupe-ce/network/clientctx"
|
||||
"erupe-ce/common/byteframe"
|
||||
"erupe-ce/utils/byteframe"
|
||||
)
|
||||
|
||||
// MsgMhfAcquireFestaIntermediatePrize represents the MSG_MHF_ACQUIRE_FESTA_INTERMEDIATE_PRIZE
|
||||
type MsgMhfAcquireFestaIntermediatePrize struct {
|
||||
AckHandle uint32
|
||||
PrizeID uint32
|
||||
PrizeID uint32
|
||||
}
|
||||
|
||||
// Opcode returns the ID associated with this packet type.
|
||||
@@ -20,13 +19,13 @@ func (m *MsgMhfAcquireFestaIntermediatePrize) Opcode() network.PacketID {
|
||||
}
|
||||
|
||||
// Parse parses the packet from binary
|
||||
func (m *MsgMhfAcquireFestaIntermediatePrize) Parse(bf *byteframe.ByteFrame, ctx *clientctx.ClientContext) error {
|
||||
func (m *MsgMhfAcquireFestaIntermediatePrize) Parse(bf *byteframe.ByteFrame) error {
|
||||
m.AckHandle = bf.ReadUint32()
|
||||
m.PrizeID = bf.ReadUint32()
|
||||
m.PrizeID = bf.ReadUint32()
|
||||
return nil
|
||||
}
|
||||
|
||||
// Build builds a binary packet from the current data.
|
||||
func (m *MsgMhfAcquireFestaIntermediatePrize) Build(bf *byteframe.ByteFrame, ctx *clientctx.ClientContext) error {
|
||||
func (m *MsgMhfAcquireFestaIntermediatePrize) Build(bf *byteframe.ByteFrame) error {
|
||||
return errors.New("NOT IMPLEMENTED")
|
||||
}
|
||||
|
||||
@@ -1,17 +1,16 @@
|
||||
package mhfpacket
|
||||
|
||||
import (
|
||||
"errors"
|
||||
"errors"
|
||||
|
||||
"erupe-ce/network/clientctx"
|
||||
"erupe-ce/network"
|
||||
"erupe-ce/common/byteframe"
|
||||
"erupe-ce/utils/byteframe"
|
||||
)
|
||||
|
||||
// MsgMhfAcquireFestaPersonalPrize represents the MSG_MHF_ACQUIRE_FESTA_PERSONAL_PRIZE
|
||||
type MsgMhfAcquireFestaPersonalPrize struct {
|
||||
AckHandle uint32
|
||||
PrizeID uint32
|
||||
AckHandle uint32
|
||||
PrizeID uint32
|
||||
}
|
||||
|
||||
// Opcode returns the ID associated with this packet type.
|
||||
@@ -20,13 +19,13 @@ func (m *MsgMhfAcquireFestaPersonalPrize) Opcode() network.PacketID {
|
||||
}
|
||||
|
||||
// Parse parses the packet from binary
|
||||
func (m *MsgMhfAcquireFestaPersonalPrize) Parse(bf *byteframe.ByteFrame, ctx *clientctx.ClientContext) error {
|
||||
m.AckHandle = bf.ReadUint32()
|
||||
m.PrizeID = bf.ReadUint32()
|
||||
return nil
|
||||
func (m *MsgMhfAcquireFestaPersonalPrize) Parse(bf *byteframe.ByteFrame) error {
|
||||
m.AckHandle = bf.ReadUint32()
|
||||
m.PrizeID = bf.ReadUint32()
|
||||
return nil
|
||||
}
|
||||
|
||||
// Build builds a binary packet from the current data.
|
||||
func (m *MsgMhfAcquireFestaPersonalPrize) Build(bf *byteframe.ByteFrame, ctx *clientctx.ClientContext) error {
|
||||
func (m *MsgMhfAcquireFestaPersonalPrize) Build(bf *byteframe.ByteFrame) error {
|
||||
return errors.New("NOT IMPLEMENTED")
|
||||
}
|
||||
|
||||
@@ -1,17 +1,16 @@
|
||||
package mhfpacket
|
||||
|
||||
import (
|
||||
"errors"
|
||||
"errors"
|
||||
|
||||
"erupe-ce/network/clientctx"
|
||||
"erupe-ce/network"
|
||||
"erupe-ce/common/byteframe"
|
||||
"erupe-ce/utils/byteframe"
|
||||
)
|
||||
|
||||
// MsgMhfAcquireGuildAdventure represents the MSG_MHF_ACQUIRE_GUILD_ADVENTURE
|
||||
type MsgMhfAcquireGuildAdventure struct {
|
||||
AckHandle uint32
|
||||
ID uint32
|
||||
AckHandle uint32
|
||||
ID uint32
|
||||
}
|
||||
|
||||
// Opcode returns the ID associated with this packet type.
|
||||
@@ -20,13 +19,13 @@ func (m *MsgMhfAcquireGuildAdventure) Opcode() network.PacketID {
|
||||
}
|
||||
|
||||
// Parse parses the packet from binary
|
||||
func (m *MsgMhfAcquireGuildAdventure) Parse(bf *byteframe.ByteFrame, ctx *clientctx.ClientContext) error {
|
||||
m.AckHandle = bf.ReadUint32()
|
||||
m.ID = bf.ReadUint32()
|
||||
return nil
|
||||
func (m *MsgMhfAcquireGuildAdventure) Parse(bf *byteframe.ByteFrame) error {
|
||||
m.AckHandle = bf.ReadUint32()
|
||||
m.ID = bf.ReadUint32()
|
||||
return nil
|
||||
}
|
||||
|
||||
// Build builds a binary packet from the current data.
|
||||
func (m *MsgMhfAcquireGuildAdventure) Build(bf *byteframe.ByteFrame, ctx *clientctx.ClientContext) error {
|
||||
func (m *MsgMhfAcquireGuildAdventure) Build(bf *byteframe.ByteFrame) error {
|
||||
return errors.New("NOT IMPLEMENTED")
|
||||
}
|
||||
|
||||
@@ -3,9 +3,8 @@ package mhfpacket
|
||||
import (
|
||||
"errors"
|
||||
|
||||
"erupe-ce/common/byteframe"
|
||||
"erupe-ce/network"
|
||||
"erupe-ce/network/clientctx"
|
||||
"erupe-ce/utils/byteframe"
|
||||
)
|
||||
|
||||
// MsgMhfAcquireGuildTresure represents the MSG_MHF_ACQUIRE_GUILD_TRESURE
|
||||
@@ -21,7 +20,7 @@ func (m *MsgMhfAcquireGuildTresure) Opcode() network.PacketID {
|
||||
}
|
||||
|
||||
// Parse parses the packet from binary
|
||||
func (m *MsgMhfAcquireGuildTresure) Parse(bf *byteframe.ByteFrame, ctx *clientctx.ClientContext) error {
|
||||
func (m *MsgMhfAcquireGuildTresure) Parse(bf *byteframe.ByteFrame) error {
|
||||
m.AckHandle = bf.ReadUint32()
|
||||
m.HuntID = bf.ReadUint32()
|
||||
m.Unk = bf.ReadBool()
|
||||
@@ -29,6 +28,6 @@ func (m *MsgMhfAcquireGuildTresure) Parse(bf *byteframe.ByteFrame, ctx *clientct
|
||||
}
|
||||
|
||||
// Build builds a binary packet from the current data.
|
||||
func (m *MsgMhfAcquireGuildTresure) Build(bf *byteframe.ByteFrame, ctx *clientctx.ClientContext) error {
|
||||
func (m *MsgMhfAcquireGuildTresure) Build(bf *byteframe.ByteFrame) error {
|
||||
return errors.New("NOT IMPLEMENTED")
|
||||
}
|
||||
|
||||
@@ -1,11 +1,10 @@
|
||||
package mhfpacket
|
||||
|
||||
import (
|
||||
"errors"
|
||||
import (
|
||||
"errors"
|
||||
|
||||
"erupe-ce/network/clientctx"
|
||||
"erupe-ce/network"
|
||||
"erupe-ce/common/byteframe"
|
||||
"erupe-ce/utils/byteframe"
|
||||
)
|
||||
|
||||
// MsgMhfAcquireGuildTresureSouvenir represents the MSG_MHF_ACQUIRE_GUILD_TRESURE_SOUVENIR
|
||||
@@ -19,12 +18,12 @@ func (m *MsgMhfAcquireGuildTresureSouvenir) Opcode() network.PacketID {
|
||||
}
|
||||
|
||||
// Parse parses the packet from binary
|
||||
func (m *MsgMhfAcquireGuildTresureSouvenir) Parse(bf *byteframe.ByteFrame, ctx *clientctx.ClientContext) error {
|
||||
func (m *MsgMhfAcquireGuildTresureSouvenir) Parse(bf *byteframe.ByteFrame) error {
|
||||
m.AckHandle = bf.ReadUint32()
|
||||
return nil
|
||||
}
|
||||
|
||||
// Build builds a binary packet from the current data.
|
||||
func (m *MsgMhfAcquireGuildTresureSouvenir) Build(bf *byteframe.ByteFrame, ctx *clientctx.ClientContext) error {
|
||||
func (m *MsgMhfAcquireGuildTresureSouvenir) Build(bf *byteframe.ByteFrame) error {
|
||||
return errors.New("NOT IMPLEMENTED")
|
||||
}
|
||||
|
||||
@@ -3,9 +3,8 @@ package mhfpacket
|
||||
import (
|
||||
"errors"
|
||||
|
||||
"erupe-ce/common/byteframe"
|
||||
"erupe-ce/network"
|
||||
"erupe-ce/network/clientctx"
|
||||
"erupe-ce/utils/byteframe"
|
||||
)
|
||||
|
||||
// MsgMhfAcquireItem represents the MSG_MHF_ACQUIRE_ITEM
|
||||
@@ -22,7 +21,7 @@ func (m *MsgMhfAcquireItem) Opcode() network.PacketID {
|
||||
}
|
||||
|
||||
// Parse parses the packet from binary
|
||||
func (m *MsgMhfAcquireItem) Parse(bf *byteframe.ByteFrame, ctx *clientctx.ClientContext) error {
|
||||
func (m *MsgMhfAcquireItem) Parse(bf *byteframe.ByteFrame) error {
|
||||
m.AckHandle = bf.ReadUint32()
|
||||
m.Unk0 = bf.ReadUint16()
|
||||
m.Length = bf.ReadUint16()
|
||||
@@ -33,6 +32,6 @@ func (m *MsgMhfAcquireItem) Parse(bf *byteframe.ByteFrame, ctx *clientctx.Client
|
||||
}
|
||||
|
||||
// Build builds a binary packet from the current data.
|
||||
func (m *MsgMhfAcquireItem) Build(bf *byteframe.ByteFrame, ctx *clientctx.ClientContext) error {
|
||||
func (m *MsgMhfAcquireItem) Build(bf *byteframe.ByteFrame) error {
|
||||
return errors.New("NOT IMPLEMENTED")
|
||||
}
|
||||
|
||||
@@ -3,9 +3,8 @@ package mhfpacket
|
||||
import (
|
||||
"errors"
|
||||
|
||||
"erupe-ce/common/byteframe"
|
||||
"erupe-ce/network"
|
||||
"erupe-ce/network/clientctx"
|
||||
"erupe-ce/utils/byteframe"
|
||||
)
|
||||
|
||||
// MsgMhfAcquireMonthlyItem represents the MSG_MHF_ACQUIRE_MONTHLY_ITEM
|
||||
@@ -23,7 +22,7 @@ func (m *MsgMhfAcquireMonthlyItem) Opcode() network.PacketID {
|
||||
}
|
||||
|
||||
// Parse parses the packet from binary
|
||||
func (m *MsgMhfAcquireMonthlyItem) Parse(bf *byteframe.ByteFrame, ctx *clientctx.ClientContext) error {
|
||||
func (m *MsgMhfAcquireMonthlyItem) Parse(bf *byteframe.ByteFrame) error {
|
||||
m.AckHandle = bf.ReadUint32()
|
||||
m.Unk0 = bf.ReadUint8()
|
||||
m.Unk1 = bf.ReadUint8()
|
||||
@@ -34,6 +33,6 @@ func (m *MsgMhfAcquireMonthlyItem) Parse(bf *byteframe.ByteFrame, ctx *clientctx
|
||||
}
|
||||
|
||||
// Build builds a binary packet from the current data.
|
||||
func (m *MsgMhfAcquireMonthlyItem) Build(bf *byteframe.ByteFrame, ctx *clientctx.ClientContext) error {
|
||||
func (m *MsgMhfAcquireMonthlyItem) Build(bf *byteframe.ByteFrame) error {
|
||||
return errors.New("NOT IMPLEMENTED")
|
||||
}
|
||||
|
||||
@@ -1,11 +1,10 @@
|
||||
package mhfpacket
|
||||
|
||||
import (
|
||||
"errors"
|
||||
import (
|
||||
"errors"
|
||||
|
||||
"erupe-ce/network/clientctx"
|
||||
"erupe-ce/network"
|
||||
"erupe-ce/common/byteframe"
|
||||
"erupe-ce/utils/byteframe"
|
||||
)
|
||||
|
||||
// MsgMhfAcquireMonthlyReward represents the MSG_MHF_ACQUIRE_MONTHLY_REWARD
|
||||
@@ -19,12 +18,12 @@ func (m *MsgMhfAcquireMonthlyReward) Opcode() network.PacketID {
|
||||
}
|
||||
|
||||
// Parse parses the packet from binary
|
||||
func (m *MsgMhfAcquireMonthlyReward) Parse(bf *byteframe.ByteFrame, ctx *clientctx.ClientContext) error {
|
||||
func (m *MsgMhfAcquireMonthlyReward) Parse(bf *byteframe.ByteFrame) error {
|
||||
m.AckHandle = bf.ReadUint32()
|
||||
return nil
|
||||
}
|
||||
|
||||
// Build builds a binary packet from the current data.
|
||||
func (m *MsgMhfAcquireMonthlyReward) Build(bf *byteframe.ByteFrame, ctx *clientctx.ClientContext) error {
|
||||
func (m *MsgMhfAcquireMonthlyReward) Build(bf *byteframe.ByteFrame) error {
|
||||
return errors.New("NOT IMPLEMENTED")
|
||||
}
|
||||
|
||||
@@ -3,9 +3,8 @@ package mhfpacket
|
||||
import (
|
||||
"errors"
|
||||
|
||||
"erupe-ce/common/byteframe"
|
||||
"erupe-ce/network"
|
||||
"erupe-ce/network/clientctx"
|
||||
"erupe-ce/utils/byteframe"
|
||||
)
|
||||
|
||||
// MsgMhfAcquireTitle represents the MSG_MHF_ACQUIRE_TITLE
|
||||
@@ -20,7 +19,7 @@ func (m *MsgMhfAcquireTitle) Opcode() network.PacketID {
|
||||
}
|
||||
|
||||
// Parse parses the packet from binary
|
||||
func (m *MsgMhfAcquireTitle) Parse(bf *byteframe.ByteFrame, ctx *clientctx.ClientContext) error {
|
||||
func (m *MsgMhfAcquireTitle) Parse(bf *byteframe.ByteFrame) error {
|
||||
m.AckHandle = bf.ReadUint32()
|
||||
titles := int(bf.ReadUint16())
|
||||
bf.ReadUint16() // Zeroed
|
||||
@@ -31,6 +30,6 @@ func (m *MsgMhfAcquireTitle) Parse(bf *byteframe.ByteFrame, ctx *clientctx.Clien
|
||||
}
|
||||
|
||||
// Build builds a binary packet from the current data.
|
||||
func (m *MsgMhfAcquireTitle) Build(bf *byteframe.ByteFrame, ctx *clientctx.ClientContext) error {
|
||||
func (m *MsgMhfAcquireTitle) Build(bf *byteframe.ByteFrame) error {
|
||||
return errors.New("NOT IMPLEMENTED")
|
||||
}
|
||||
|
||||
@@ -3,9 +3,8 @@ package mhfpacket
|
||||
import (
|
||||
"errors"
|
||||
|
||||
"erupe-ce/common/byteframe"
|
||||
"erupe-ce/network"
|
||||
"erupe-ce/network/clientctx"
|
||||
"erupe-ce/utils/byteframe"
|
||||
)
|
||||
|
||||
// MsgMhfAcquireTournament represents the MSG_MHF_ACQUIRE_TOURNAMENT
|
||||
@@ -20,13 +19,13 @@ func (m *MsgMhfAcquireTournament) Opcode() network.PacketID {
|
||||
}
|
||||
|
||||
// Parse parses the packet from binary
|
||||
func (m *MsgMhfAcquireTournament) Parse(bf *byteframe.ByteFrame, ctx *clientctx.ClientContext) error {
|
||||
func (m *MsgMhfAcquireTournament) Parse(bf *byteframe.ByteFrame) error {
|
||||
m.AckHandle = bf.ReadUint32()
|
||||
m.TournamentID = bf.ReadUint32()
|
||||
return nil
|
||||
}
|
||||
|
||||
// Build builds a binary packet from the current data.
|
||||
func (m *MsgMhfAcquireTournament) Build(bf *byteframe.ByteFrame, ctx *clientctx.ClientContext) error {
|
||||
func (m *MsgMhfAcquireTournament) Build(bf *byteframe.ByteFrame) error {
|
||||
return errors.New("NOT IMPLEMENTED")
|
||||
}
|
||||
|
||||
@@ -1,30 +1,29 @@
|
||||
package mhfpacket
|
||||
|
||||
import (
|
||||
"errors"
|
||||
"errors"
|
||||
|
||||
"erupe-ce/network/clientctx"
|
||||
"erupe-ce/network"
|
||||
"erupe-ce/common/byteframe"
|
||||
"erupe-ce/utils/byteframe"
|
||||
)
|
||||
|
||||
// MsgMhfAcquireUdItem represents the MSG_MHF_ACQUIRE_UD_ITEM
|
||||
type MsgMhfAcquireUdItem struct {
|
||||
AckHandle uint32
|
||||
Unk0 uint8
|
||||
// from gal
|
||||
// daily = 0
|
||||
// personal = 1
|
||||
// personal rank = 2
|
||||
// guild rank = 3
|
||||
// gcp = 4
|
||||
// from cat
|
||||
// treasure achievement = 5
|
||||
// personal achievement = 6
|
||||
// guild achievement = 7
|
||||
RewardType uint8
|
||||
Unk2 uint8 // Number of uint32s to read?
|
||||
Unk3 []byte
|
||||
AckHandle uint32
|
||||
Unk0 uint8
|
||||
// from gal
|
||||
// daily = 0
|
||||
// personal = 1
|
||||
// personal rank = 2
|
||||
// guild rank = 3
|
||||
// gcp = 4
|
||||
// from cat
|
||||
// treasure achievement = 5
|
||||
// personal achievement = 6
|
||||
// guild achievement = 7
|
||||
RewardType uint8
|
||||
Unk2 uint8 // Number of uint32s to read?
|
||||
Unk3 []byte
|
||||
}
|
||||
|
||||
// Opcode returns the ID associated with this packet type.
|
||||
@@ -33,18 +32,18 @@ func (m *MsgMhfAcquireUdItem) Opcode() network.PacketID {
|
||||
}
|
||||
|
||||
// Parse parses the packet from binary
|
||||
func (m *MsgMhfAcquireUdItem) Parse(bf *byteframe.ByteFrame, ctx *clientctx.ClientContext) error {
|
||||
m.AckHandle = bf.ReadUint32()
|
||||
func (m *MsgMhfAcquireUdItem) Parse(bf *byteframe.ByteFrame) error {
|
||||
m.AckHandle = bf.ReadUint32()
|
||||
m.Unk0 = bf.ReadUint8()
|
||||
m.RewardType = bf.ReadUint8()
|
||||
m.Unk2 = bf.ReadUint8()
|
||||
for i := uint8(0); i < m.Unk2; i++ {
|
||||
bf.ReadUint32()
|
||||
}
|
||||
m.Unk2 = bf.ReadUint8()
|
||||
for i := uint8(0); i < m.Unk2; i++ {
|
||||
bf.ReadUint32()
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
// Build builds a binary packet from the current data.
|
||||
func (m *MsgMhfAcquireUdItem) Build(bf *byteframe.ByteFrame, ctx *clientctx.ClientContext) error {
|
||||
func (m *MsgMhfAcquireUdItem) Build(bf *byteframe.ByteFrame) error {
|
||||
return errors.New("NOT IMPLEMENTED")
|
||||
}
|
||||
|
||||
@@ -3,9 +3,8 @@ package mhfpacket
|
||||
import (
|
||||
"errors"
|
||||
|
||||
"erupe-ce/common/byteframe"
|
||||
"erupe-ce/network"
|
||||
"erupe-ce/network/clientctx"
|
||||
"erupe-ce/utils/byteframe"
|
||||
)
|
||||
|
||||
// MsgMhfAddAchievement represents the MSG_MHF_ADD_ACHIEVEMENT
|
||||
@@ -21,7 +20,7 @@ func (m *MsgMhfAddAchievement) Opcode() network.PacketID {
|
||||
}
|
||||
|
||||
// Parse parses the packet from binary
|
||||
func (m *MsgMhfAddAchievement) Parse(bf *byteframe.ByteFrame, ctx *clientctx.ClientContext) error {
|
||||
func (m *MsgMhfAddAchievement) Parse(bf *byteframe.ByteFrame) error {
|
||||
m.AchievementID = bf.ReadUint8()
|
||||
m.Unk1 = bf.ReadUint16()
|
||||
m.Unk2 = bf.ReadUint16()
|
||||
@@ -29,6 +28,6 @@ func (m *MsgMhfAddAchievement) Parse(bf *byteframe.ByteFrame, ctx *clientctx.Cli
|
||||
}
|
||||
|
||||
// Build builds a binary packet from the current data.
|
||||
func (m *MsgMhfAddAchievement) Build(bf *byteframe.ByteFrame, ctx *clientctx.ClientContext) error {
|
||||
func (m *MsgMhfAddAchievement) Build(bf *byteframe.ByteFrame) error {
|
||||
return errors.New("NOT IMPLEMENTED")
|
||||
}
|
||||
|
||||
@@ -1,18 +1,17 @@
|
||||
package mhfpacket
|
||||
|
||||
import (
|
||||
"errors"
|
||||
"errors"
|
||||
|
||||
"erupe-ce/network/clientctx"
|
||||
"erupe-ce/network"
|
||||
"erupe-ce/common/byteframe"
|
||||
"erupe-ce/utils/byteframe"
|
||||
)
|
||||
|
||||
// MsgMhfAddGuildMissionCount represents the MSG_MHF_ADD_GUILD_MISSION_COUNT
|
||||
type MsgMhfAddGuildMissionCount struct {
|
||||
AckHandle uint32
|
||||
MissionID uint32
|
||||
Count uint32
|
||||
AckHandle uint32
|
||||
MissionID uint32
|
||||
Count uint32
|
||||
}
|
||||
|
||||
// Opcode returns the ID associated with this packet type.
|
||||
@@ -21,14 +20,14 @@ func (m *MsgMhfAddGuildMissionCount) Opcode() network.PacketID {
|
||||
}
|
||||
|
||||
// Parse parses the packet from binary
|
||||
func (m *MsgMhfAddGuildMissionCount) Parse(bf *byteframe.ByteFrame, ctx *clientctx.ClientContext) error {
|
||||
m.AckHandle = bf.ReadUint32()
|
||||
m.MissionID = bf.ReadUint32()
|
||||
m.Count = bf.ReadUint32()
|
||||
return nil
|
||||
func (m *MsgMhfAddGuildMissionCount) Parse(bf *byteframe.ByteFrame) error {
|
||||
m.AckHandle = bf.ReadUint32()
|
||||
m.MissionID = bf.ReadUint32()
|
||||
m.Count = bf.ReadUint32()
|
||||
return nil
|
||||
}
|
||||
|
||||
// Build builds a binary packet from the current data.
|
||||
func (m *MsgMhfAddGuildMissionCount) Build(bf *byteframe.ByteFrame, ctx *clientctx.ClientContext) error {
|
||||
func (m *MsgMhfAddGuildMissionCount) Build(bf *byteframe.ByteFrame) error {
|
||||
return errors.New("NOT IMPLEMENTED")
|
||||
}
|
||||
|
||||
@@ -1,17 +1,16 @@
|
||||
package mhfpacket
|
||||
|
||||
import (
|
||||
"errors"
|
||||
"errors"
|
||||
|
||||
"erupe-ce/network/clientctx"
|
||||
"erupe-ce/network"
|
||||
"erupe-ce/common/byteframe"
|
||||
"erupe-ce/utils/byteframe"
|
||||
)
|
||||
|
||||
// MsgMhfAddGuildWeeklyBonusExceptionalUser represents the MSG_MHF_ADD_GUILD_WEEKLY_BONUS_EXCEPTIONAL_USER
|
||||
type MsgMhfAddGuildWeeklyBonusExceptionalUser struct {
|
||||
AckHandle uint32
|
||||
NumUsers uint8
|
||||
AckHandle uint32
|
||||
NumUsers uint8
|
||||
}
|
||||
|
||||
// Opcode returns the ID associated with this packet type.
|
||||
@@ -20,13 +19,13 @@ func (m *MsgMhfAddGuildWeeklyBonusExceptionalUser) Opcode() network.PacketID {
|
||||
}
|
||||
|
||||
// Parse parses the packet from binary
|
||||
func (m *MsgMhfAddGuildWeeklyBonusExceptionalUser) Parse(bf *byteframe.ByteFrame, ctx *clientctx.ClientContext) error {
|
||||
m.AckHandle = bf.ReadUint32()
|
||||
m.NumUsers = bf.ReadUint8()
|
||||
return nil
|
||||
func (m *MsgMhfAddGuildWeeklyBonusExceptionalUser) Parse(bf *byteframe.ByteFrame) error {
|
||||
m.AckHandle = bf.ReadUint32()
|
||||
m.NumUsers = bf.ReadUint8()
|
||||
return nil
|
||||
}
|
||||
|
||||
// Build builds a binary packet from the current data.
|
||||
func (m *MsgMhfAddGuildWeeklyBonusExceptionalUser) Build(bf *byteframe.ByteFrame, ctx *clientctx.ClientContext) error {
|
||||
func (m *MsgMhfAddGuildWeeklyBonusExceptionalUser) Build(bf *byteframe.ByteFrame) error {
|
||||
return errors.New("NOT IMPLEMENTED")
|
||||
}
|
||||
|
||||
@@ -2,8 +2,7 @@ package mhfpacket
|
||||
|
||||
import (
|
||||
"erupe-ce/network"
|
||||
"erupe-ce/network/clientctx"
|
||||
"erupe-ce/common/byteframe"
|
||||
"erupe-ce/utils/byteframe"
|
||||
)
|
||||
|
||||
// MsgMhfAddKouryouPoint represents the MSG_MHF_ADD_KOURYOU_POINT
|
||||
@@ -18,14 +17,14 @@ func (m *MsgMhfAddKouryouPoint) Opcode() network.PacketID {
|
||||
}
|
||||
|
||||
// Parse parses the packet from binary
|
||||
func (m *MsgMhfAddKouryouPoint) Parse(bf *byteframe.ByteFrame, ctx *clientctx.ClientContext) error {
|
||||
func (m *MsgMhfAddKouryouPoint) Parse(bf *byteframe.ByteFrame) error {
|
||||
m.AckHandle = bf.ReadUint32()
|
||||
m.KouryouPoints = bf.ReadUint32()
|
||||
return nil
|
||||
}
|
||||
|
||||
// Build builds a binary packet from the current data.
|
||||
func (m *MsgMhfAddKouryouPoint) Build(bf *byteframe.ByteFrame, ctx *clientctx.ClientContext) error {
|
||||
func (m *MsgMhfAddKouryouPoint) Build(bf *byteframe.ByteFrame) error {
|
||||
bf.WriteUint32(m.AckHandle)
|
||||
bf.WriteUint32(m.KouryouPoints)
|
||||
return nil
|
||||
|
||||
@@ -1,11 +1,10 @@
|
||||
package mhfpacket
|
||||
|
||||
import (
|
||||
"errors"
|
||||
import (
|
||||
"errors"
|
||||
|
||||
"erupe-ce/network/clientctx"
|
||||
"erupe-ce/network"
|
||||
"erupe-ce/common/byteframe"
|
||||
"erupe-ce/utils/byteframe"
|
||||
)
|
||||
|
||||
// MsgMhfAddRewardSongCount represents the MSG_MHF_ADD_REWARD_SONG_COUNT
|
||||
@@ -17,11 +16,11 @@ func (m *MsgMhfAddRewardSongCount) Opcode() network.PacketID {
|
||||
}
|
||||
|
||||
// Parse parses the packet from binary
|
||||
func (m *MsgMhfAddRewardSongCount) Parse(bf *byteframe.ByteFrame, ctx *clientctx.ClientContext) error {
|
||||
func (m *MsgMhfAddRewardSongCount) Parse(bf *byteframe.ByteFrame) error {
|
||||
return errors.New("NOT IMPLEMENTED")
|
||||
}
|
||||
|
||||
// Build builds a binary packet from the current data.
|
||||
func (m *MsgMhfAddRewardSongCount) Build(bf *byteframe.ByteFrame, ctx *clientctx.ClientContext) error {
|
||||
func (m *MsgMhfAddRewardSongCount) Build(bf *byteframe.ByteFrame) error {
|
||||
return errors.New("NOT IMPLEMENTED")
|
||||
}
|
||||
|
||||
@@ -1,11 +1,10 @@
|
||||
package mhfpacket
|
||||
|
||||
import (
|
||||
"errors"
|
||||
import (
|
||||
"errors"
|
||||
|
||||
"erupe-ce/network/clientctx"
|
||||
"erupe-ce/network"
|
||||
"erupe-ce/common/byteframe"
|
||||
"erupe-ce/utils/byteframe"
|
||||
)
|
||||
|
||||
// MsgMhfAddUdPoint represents the MSG_MHF_ADD_UD_POINT
|
||||
@@ -21,7 +20,7 @@ func (m *MsgMhfAddUdPoint) Opcode() network.PacketID {
|
||||
}
|
||||
|
||||
// Parse parses the packet from binary
|
||||
func (m *MsgMhfAddUdPoint) Parse(bf *byteframe.ByteFrame, ctx *clientctx.ClientContext) error {
|
||||
func (m *MsgMhfAddUdPoint) Parse(bf *byteframe.ByteFrame) error {
|
||||
m.AckHandle = bf.ReadUint32()
|
||||
m.Unk1 = bf.ReadUint32()
|
||||
m.Unk2 = bf.ReadUint32()
|
||||
@@ -31,6 +30,6 @@ func (m *MsgMhfAddUdPoint) Parse(bf *byteframe.ByteFrame, ctx *clientctx.ClientC
|
||||
}
|
||||
|
||||
// Build builds a binary packet from the current data.
|
||||
func (m *MsgMhfAddUdPoint) Build(bf *byteframe.ByteFrame, ctx *clientctx.ClientContext) error {
|
||||
func (m *MsgMhfAddUdPoint) Build(bf *byteframe.ByteFrame) error {
|
||||
return errors.New("NOT IMPLEMENTED")
|
||||
}
|
||||
|
||||
@@ -2,8 +2,7 @@ package mhfpacket
|
||||
|
||||
import (
|
||||
"erupe-ce/network"
|
||||
"erupe-ce/network/clientctx"
|
||||
"erupe-ce/common/byteframe"
|
||||
"erupe-ce/utils/byteframe"
|
||||
)
|
||||
|
||||
// MsgMhfAddUdTacticsPoint represents the MSG_MHF_ADD_UD_TACTICS_POINT
|
||||
@@ -19,7 +18,7 @@ func (m *MsgMhfAddUdTacticsPoint) Opcode() network.PacketID {
|
||||
}
|
||||
|
||||
// Parse parses the packet from binary
|
||||
func (m *MsgMhfAddUdTacticsPoint) Parse(bf *byteframe.ByteFrame, ctx *clientctx.ClientContext) error {
|
||||
func (m *MsgMhfAddUdTacticsPoint) Parse(bf *byteframe.ByteFrame) error {
|
||||
m.AckHandle = bf.ReadUint32()
|
||||
m.Unk0 = bf.ReadUint16()
|
||||
m.Unk1 = bf.ReadUint32()
|
||||
@@ -27,7 +26,7 @@ func (m *MsgMhfAddUdTacticsPoint) Parse(bf *byteframe.ByteFrame, ctx *clientctx.
|
||||
}
|
||||
|
||||
// Build builds a binary packet from the current data.
|
||||
func (m *MsgMhfAddUdTacticsPoint) Build(bf *byteframe.ByteFrame, ctx *clientctx.ClientContext) error {
|
||||
func (m *MsgMhfAddUdTacticsPoint) Build(bf *byteframe.ByteFrame) error {
|
||||
bf.WriteUint32(m.AckHandle)
|
||||
bf.WriteUint16(m.Unk0)
|
||||
bf.WriteUint32(m.Unk1)
|
||||
|
||||
@@ -3,9 +3,8 @@ package mhfpacket
|
||||
import (
|
||||
"errors"
|
||||
|
||||
"erupe-ce/common/byteframe"
|
||||
"erupe-ce/network"
|
||||
"erupe-ce/network/clientctx"
|
||||
"erupe-ce/utils/byteframe"
|
||||
)
|
||||
|
||||
// MsgMhfAnnounce represents the MSG_MHF_ANNOUNCE
|
||||
@@ -23,7 +22,7 @@ func (m *MsgMhfAnnounce) Opcode() network.PacketID {
|
||||
}
|
||||
|
||||
// Parse parses the packet from binary
|
||||
func (m *MsgMhfAnnounce) Parse(bf *byteframe.ByteFrame, ctx *clientctx.ClientContext) error {
|
||||
func (m *MsgMhfAnnounce) Parse(bf *byteframe.ByteFrame) error {
|
||||
m.AckHandle = bf.ReadUint32()
|
||||
m.IPAddress = bf.ReadUint32()
|
||||
m.Port = bf.ReadUint16()
|
||||
@@ -36,6 +35,6 @@ func (m *MsgMhfAnnounce) Parse(bf *byteframe.ByteFrame, ctx *clientctx.ClientCon
|
||||
}
|
||||
|
||||
// Build builds a binary packet from the current data.
|
||||
func (m *MsgMhfAnnounce) Build(bf *byteframe.ByteFrame, ctx *clientctx.ClientContext) error {
|
||||
func (m *MsgMhfAnnounce) Build(bf *byteframe.ByteFrame) error {
|
||||
return errors.New("NOT IMPLEMENTED")
|
||||
}
|
||||
|
||||
@@ -1,11 +1,10 @@
|
||||
package mhfpacket
|
||||
|
||||
import (
|
||||
"errors"
|
||||
import (
|
||||
"errors"
|
||||
|
||||
"erupe-ce/network/clientctx"
|
||||
"erupe-ce/network"
|
||||
"erupe-ce/common/byteframe"
|
||||
"erupe-ce/utils/byteframe"
|
||||
)
|
||||
|
||||
// MsgMhfAnswerGuildScout represents the MSG_MHF_ANSWER_GUILD_SCOUT
|
||||
@@ -21,7 +20,7 @@ func (m *MsgMhfAnswerGuildScout) Opcode() network.PacketID {
|
||||
}
|
||||
|
||||
// Parse parses the packet from binary
|
||||
func (m *MsgMhfAnswerGuildScout) Parse(bf *byteframe.ByteFrame, ctx *clientctx.ClientContext) error {
|
||||
func (m *MsgMhfAnswerGuildScout) Parse(bf *byteframe.ByteFrame) error {
|
||||
m.AckHandle = bf.ReadUint32()
|
||||
m.LeaderID = bf.ReadUint32()
|
||||
m.Answer = bf.ReadBool()
|
||||
@@ -29,6 +28,6 @@ func (m *MsgMhfAnswerGuildScout) Parse(bf *byteframe.ByteFrame, ctx *clientctx.C
|
||||
}
|
||||
|
||||
// Build builds a binary packet from the current data.
|
||||
func (m *MsgMhfAnswerGuildScout) Build(bf *byteframe.ByteFrame, ctx *clientctx.ClientContext) error {
|
||||
func (m *MsgMhfAnswerGuildScout) Build(bf *byteframe.ByteFrame) error {
|
||||
return errors.New("NOT IMPLEMENTED")
|
||||
}
|
||||
|
||||
@@ -2,12 +2,11 @@ package mhfpacket
|
||||
|
||||
import (
|
||||
"errors"
|
||||
"erupe-ce/common/bfutil"
|
||||
"erupe-ce/common/stringsupport"
|
||||
"erupe-ce/utils/bfutil"
|
||||
"erupe-ce/utils/stringsupport"
|
||||
|
||||
"erupe-ce/common/byteframe"
|
||||
"erupe-ce/network"
|
||||
"erupe-ce/network/clientctx"
|
||||
"erupe-ce/utils/byteframe"
|
||||
)
|
||||
|
||||
// MsgMhfApplyBbsArticle represents the MSG_MHF_APPLY_BBS_ARTICLE
|
||||
@@ -26,7 +25,7 @@ func (m *MsgMhfApplyBbsArticle) Opcode() network.PacketID {
|
||||
}
|
||||
|
||||
// Parse parses the packet from binary
|
||||
func (m *MsgMhfApplyBbsArticle) Parse(bf *byteframe.ByteFrame, ctx *clientctx.ClientContext) error {
|
||||
func (m *MsgMhfApplyBbsArticle) Parse(bf *byteframe.ByteFrame) error {
|
||||
m.AckHandle = bf.ReadUint32()
|
||||
m.Unk0 = bf.ReadUint32()
|
||||
m.Unk1 = bf.ReadBytes(16)
|
||||
@@ -37,6 +36,6 @@ func (m *MsgMhfApplyBbsArticle) Parse(bf *byteframe.ByteFrame, ctx *clientctx.Cl
|
||||
}
|
||||
|
||||
// Build builds a binary packet from the current data.
|
||||
func (m *MsgMhfApplyBbsArticle) Build(bf *byteframe.ByteFrame, ctx *clientctx.ClientContext) error {
|
||||
func (m *MsgMhfApplyBbsArticle) Build(bf *byteframe.ByteFrame) error {
|
||||
return errors.New("NOT IMPLEMENTED")
|
||||
}
|
||||
|
||||
@@ -2,9 +2,8 @@ package mhfpacket
|
||||
|
||||
import (
|
||||
"errors"
|
||||
"erupe-ce/common/byteframe"
|
||||
"erupe-ce/network"
|
||||
"erupe-ce/network/clientctx"
|
||||
"erupe-ce/utils/byteframe"
|
||||
)
|
||||
|
||||
// MsgMhfApplyCampaign represents the MSG_MHF_APPLY_CAMPAIGN
|
||||
@@ -21,7 +20,7 @@ func (m *MsgMhfApplyCampaign) Opcode() network.PacketID {
|
||||
}
|
||||
|
||||
// Parse parses the packet from binary
|
||||
func (m *MsgMhfApplyCampaign) Parse(bf *byteframe.ByteFrame, ctx *clientctx.ClientContext) error {
|
||||
func (m *MsgMhfApplyCampaign) Parse(bf *byteframe.ByteFrame) error {
|
||||
m.AckHandle = bf.ReadUint32()
|
||||
m.Unk0 = bf.ReadUint32()
|
||||
m.Unk1 = bf.ReadUint16()
|
||||
@@ -30,6 +29,6 @@ func (m *MsgMhfApplyCampaign) Parse(bf *byteframe.ByteFrame, ctx *clientctx.Clie
|
||||
}
|
||||
|
||||
// Build builds a binary packet from the current data.
|
||||
func (m *MsgMhfApplyCampaign) Build(bf *byteframe.ByteFrame, ctx *clientctx.ClientContext) error {
|
||||
func (m *MsgMhfApplyCampaign) Build(bf *byteframe.ByteFrame) error {
|
||||
return errors.New("NOT IMPLEMENTED")
|
||||
}
|
||||
|
||||
@@ -2,10 +2,9 @@ package mhfpacket
|
||||
|
||||
import (
|
||||
"errors"
|
||||
"erupe-ce/common/byteframe"
|
||||
_config "erupe-ce/config"
|
||||
"erupe-ce/config"
|
||||
"erupe-ce/network"
|
||||
"erupe-ce/network/clientctx"
|
||||
"erupe-ce/utils/byteframe"
|
||||
)
|
||||
|
||||
// MsgMhfApplyDistItem represents the MSG_MHF_APPLY_DIST_ITEM
|
||||
@@ -23,20 +22,20 @@ func (m *MsgMhfApplyDistItem) Opcode() network.PacketID {
|
||||
}
|
||||
|
||||
// Parse parses the packet from binary
|
||||
func (m *MsgMhfApplyDistItem) Parse(bf *byteframe.ByteFrame, ctx *clientctx.ClientContext) error {
|
||||
func (m *MsgMhfApplyDistItem) Parse(bf *byteframe.ByteFrame) error {
|
||||
m.AckHandle = bf.ReadUint32()
|
||||
m.DistributionType = bf.ReadUint8()
|
||||
m.DistributionID = bf.ReadUint32()
|
||||
if _config.ErupeConfig.RealClientMode >= _config.G8 {
|
||||
if config.GetConfig().ClientID >= config.G8 {
|
||||
m.Unk2 = bf.ReadUint32()
|
||||
}
|
||||
if _config.ErupeConfig.RealClientMode >= _config.G10 {
|
||||
if config.GetConfig().ClientID >= config.G10 {
|
||||
m.Unk3 = bf.ReadUint32()
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
// Build builds a binary packet from the current data.
|
||||
func (m *MsgMhfApplyDistItem) Build(bf *byteframe.ByteFrame, ctx *clientctx.ClientContext) error {
|
||||
func (m *MsgMhfApplyDistItem) Build(bf *byteframe.ByteFrame) error {
|
||||
return errors.New("NOT IMPLEMENTED")
|
||||
}
|
||||
|
||||
@@ -2,9 +2,8 @@ package mhfpacket
|
||||
|
||||
import (
|
||||
"errors"
|
||||
"erupe-ce/common/byteframe"
|
||||
"erupe-ce/network"
|
||||
"erupe-ce/network/clientctx"
|
||||
"erupe-ce/utils/byteframe"
|
||||
)
|
||||
|
||||
// MsgMhfArrangeGuildMember represents the MSG_MHF_ARRANGE_GUILD_MEMBER
|
||||
@@ -20,7 +19,7 @@ func (m *MsgMhfArrangeGuildMember) Opcode() network.PacketID {
|
||||
}
|
||||
|
||||
// Parse parses the packet from binary
|
||||
func (m *MsgMhfArrangeGuildMember) Parse(bf *byteframe.ByteFrame, ctx *clientctx.ClientContext) error {
|
||||
func (m *MsgMhfArrangeGuildMember) Parse(bf *byteframe.ByteFrame) error {
|
||||
m.AckHandle = bf.ReadUint32()
|
||||
m.GuildID = bf.ReadUint32()
|
||||
bf.ReadUint8() // Zeroed
|
||||
@@ -35,6 +34,6 @@ func (m *MsgMhfArrangeGuildMember) Parse(bf *byteframe.ByteFrame, ctx *clientctx
|
||||
}
|
||||
|
||||
// Build builds a binary packet from the current data.
|
||||
func (m *MsgMhfArrangeGuildMember) Build(bf *byteframe.ByteFrame, ctx *clientctx.ClientContext) error {
|
||||
func (m *MsgMhfArrangeGuildMember) Build(bf *byteframe.ByteFrame) error {
|
||||
return errors.New("NOT IMPLEMENTED")
|
||||
}
|
||||
|
||||
@@ -1,17 +1,16 @@
|
||||
package mhfpacket
|
||||
|
||||
import (
|
||||
"errors"
|
||||
"errors"
|
||||
|
||||
"erupe-ce/network/clientctx"
|
||||
"erupe-ce/network"
|
||||
"erupe-ce/common/byteframe"
|
||||
"erupe-ce/utils/byteframe"
|
||||
)
|
||||
|
||||
// MsgMhfCancelGuildMissionTarget represents the MSG_MHF_CANCEL_GUILD_MISSION_TARGET
|
||||
type MsgMhfCancelGuildMissionTarget struct {
|
||||
AckHandle uint32
|
||||
MissionID uint32
|
||||
AckHandle uint32
|
||||
MissionID uint32
|
||||
}
|
||||
|
||||
// Opcode returns the ID associated with this packet type.
|
||||
@@ -20,13 +19,13 @@ func (m *MsgMhfCancelGuildMissionTarget) Opcode() network.PacketID {
|
||||
}
|
||||
|
||||
// Parse parses the packet from binary
|
||||
func (m *MsgMhfCancelGuildMissionTarget) Parse(bf *byteframe.ByteFrame, ctx *clientctx.ClientContext) error {
|
||||
m.AckHandle = bf.ReadUint32()
|
||||
m.MissionID = bf.ReadUint32()
|
||||
return nil
|
||||
func (m *MsgMhfCancelGuildMissionTarget) Parse(bf *byteframe.ByteFrame) error {
|
||||
m.AckHandle = bf.ReadUint32()
|
||||
m.MissionID = bf.ReadUint32()
|
||||
return nil
|
||||
}
|
||||
|
||||
// Build builds a binary packet from the current data.
|
||||
func (m *MsgMhfCancelGuildMissionTarget) Build(bf *byteframe.ByteFrame, ctx *clientctx.ClientContext) error {
|
||||
func (m *MsgMhfCancelGuildMissionTarget) Build(bf *byteframe.ByteFrame) error {
|
||||
return errors.New("NOT IMPLEMENTED")
|
||||
}
|
||||
|
||||
@@ -1,11 +1,10 @@
|
||||
package mhfpacket
|
||||
|
||||
import (
|
||||
"errors"
|
||||
import (
|
||||
"errors"
|
||||
|
||||
"erupe-ce/network/clientctx"
|
||||
"erupe-ce/network"
|
||||
"erupe-ce/common/byteframe"
|
||||
"erupe-ce/utils/byteframe"
|
||||
)
|
||||
|
||||
// MsgMhfCancelGuildScout represents the MSG_MHF_CANCEL_GUILD_SCOUT
|
||||
@@ -20,13 +19,13 @@ func (m *MsgMhfCancelGuildScout) Opcode() network.PacketID {
|
||||
}
|
||||
|
||||
// Parse parses the packet from binary
|
||||
func (m *MsgMhfCancelGuildScout) Parse(bf *byteframe.ByteFrame, ctx *clientctx.ClientContext) error {
|
||||
func (m *MsgMhfCancelGuildScout) Parse(bf *byteframe.ByteFrame) error {
|
||||
m.AckHandle = bf.ReadUint32()
|
||||
m.InvitationID = bf.ReadUint32()
|
||||
return nil
|
||||
}
|
||||
|
||||
// Build builds a binary packet from the current data.
|
||||
func (m *MsgMhfCancelGuildScout) Build(bf *byteframe.ByteFrame, ctx *clientctx.ClientContext) error {
|
||||
func (m *MsgMhfCancelGuildScout) Build(bf *byteframe.ByteFrame) error {
|
||||
return errors.New("NOT IMPLEMENTED")
|
||||
}
|
||||
|
||||
@@ -2,11 +2,9 @@ package mhfpacket
|
||||
|
||||
import (
|
||||
"errors"
|
||||
"fmt"
|
||||
|
||||
"erupe-ce/common/byteframe"
|
||||
"erupe-ce/network"
|
||||
"erupe-ce/network/clientctx"
|
||||
"erupe-ce/utils/byteframe"
|
||||
)
|
||||
|
||||
// MsgMhfCaravanMyRank represents the MSG_MHF_CARAVAN_MY_RANK
|
||||
@@ -23,17 +21,15 @@ func (m *MsgMhfCaravanMyRank) Opcode() network.PacketID {
|
||||
}
|
||||
|
||||
// Parse parses the packet from binary
|
||||
func (m *MsgMhfCaravanMyRank) Parse(bf *byteframe.ByteFrame, ctx *clientctx.ClientContext) error {
|
||||
func (m *MsgMhfCaravanMyRank) Parse(bf *byteframe.ByteFrame) error {
|
||||
m.AckHandle = bf.ReadUint32()
|
||||
m.Unk0 = bf.ReadUint32()
|
||||
m.Unk1 = bf.ReadUint32()
|
||||
m.Unk2 = bf.ReadUint32()
|
||||
fmt.Printf("MsgMhfCaravanMyRank: Unk0:[%d] Unk1:[%d] Unk2:[%d] \n\n", m.Unk0, m.Unk1, m.Unk2)
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
// Build builds a binary packet from the current data.
|
||||
func (m *MsgMhfCaravanMyRank) Build(bf *byteframe.ByteFrame, ctx *clientctx.ClientContext) error {
|
||||
func (m *MsgMhfCaravanMyRank) Build(bf *byteframe.ByteFrame) error {
|
||||
return errors.New("NOT IMPLEMENTED")
|
||||
}
|
||||
|
||||
@@ -2,11 +2,9 @@ package mhfpacket
|
||||
|
||||
import (
|
||||
"errors"
|
||||
"fmt"
|
||||
|
||||
"erupe-ce/common/byteframe"
|
||||
"erupe-ce/network"
|
||||
"erupe-ce/network/clientctx"
|
||||
"erupe-ce/utils/byteframe"
|
||||
)
|
||||
|
||||
// MsgMhfCaravanMyScore represents the MSG_MHF_CARAVAN_MY_SCORE
|
||||
@@ -27,7 +25,7 @@ func (m *MsgMhfCaravanMyScore) Opcode() network.PacketID {
|
||||
}
|
||||
|
||||
// Parse parses the packet from binary
|
||||
func (m *MsgMhfCaravanMyScore) Parse(bf *byteframe.ByteFrame, ctx *clientctx.ClientContext) error {
|
||||
func (m *MsgMhfCaravanMyScore) Parse(bf *byteframe.ByteFrame) error {
|
||||
m.AckHandle = bf.ReadUint32()
|
||||
m.Unk0 = bf.ReadUint32()
|
||||
m.Unk1 = bf.ReadUint32()
|
||||
@@ -36,12 +34,10 @@ func (m *MsgMhfCaravanMyScore) Parse(bf *byteframe.ByteFrame, ctx *clientctx.Cli
|
||||
m.Unk4 = bf.ReadUint32()
|
||||
m.Unk5 = bf.ReadInt32()
|
||||
m.Unk6 = bf.ReadInt32()
|
||||
fmt.Printf("MsgMhfCaravanMyScore: Unk0:[%d] Unk1:[%d] Unk2:[%d] Unk3:[%d] Unk4:[%d] Unk5:[%d] Unk6:[%d] \n", m.Unk0, m.Unk1, m.Unk2, m.Unk3, m.Unk4, m.Unk5, m.Unk6)
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
// Build builds a binary packet from the current data.
|
||||
func (m *MsgMhfCaravanMyScore) Build(bf *byteframe.ByteFrame, ctx *clientctx.ClientContext) error {
|
||||
func (m *MsgMhfCaravanMyScore) Build(bf *byteframe.ByteFrame) error {
|
||||
return errors.New("NOT IMPLEMENTED")
|
||||
}
|
||||
|
||||
@@ -2,19 +2,17 @@ package mhfpacket
|
||||
|
||||
import (
|
||||
"errors"
|
||||
"fmt"
|
||||
|
||||
"erupe-ce/common/byteframe"
|
||||
"erupe-ce/network"
|
||||
"erupe-ce/network/clientctx"
|
||||
"erupe-ce/utils/byteframe"
|
||||
)
|
||||
|
||||
// MsgMhfCaravanRanking represents the MSG_MHF_CARAVAN_RANKING
|
||||
type MsgMhfCaravanRanking struct {
|
||||
AckHandle uint32
|
||||
Unk0 uint32
|
||||
Operation uint32
|
||||
HunterGroupId int32
|
||||
AckHandle uint32
|
||||
Unk0 uint32
|
||||
Unk1 uint32
|
||||
Unk2 int32
|
||||
}
|
||||
|
||||
// Opcode returns the ID associated with this packet type.
|
||||
@@ -23,17 +21,15 @@ func (m *MsgMhfCaravanRanking) Opcode() network.PacketID {
|
||||
}
|
||||
|
||||
// Parse parses the packet from binary
|
||||
func (m *MsgMhfCaravanRanking) Parse(bf *byteframe.ByteFrame, ctx *clientctx.ClientContext) error {
|
||||
func (m *MsgMhfCaravanRanking) Parse(bf *byteframe.ByteFrame) error {
|
||||
m.AckHandle = bf.ReadUint32()
|
||||
m.Unk0 = bf.ReadUint32()
|
||||
m.Operation = bf.ReadUint32()
|
||||
m.HunterGroupId = bf.ReadInt32()
|
||||
fmt.Printf("Unk0:[%d] Operation:[%d] HunterGroupId:[%d] \n\n", m.Unk0, m.Operation, m.HunterGroupId)
|
||||
|
||||
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, ctx *clientctx.ClientContext) error {
|
||||
func (m *MsgMhfCaravanRanking) Build(bf *byteframe.ByteFrame) error {
|
||||
return errors.New("NOT IMPLEMENTED")
|
||||
}
|
||||
|
||||
@@ -3,9 +3,8 @@ package mhfpacket
|
||||
import (
|
||||
"errors"
|
||||
|
||||
"erupe-ce/common/byteframe"
|
||||
"erupe-ce/network"
|
||||
"erupe-ce/network/clientctx"
|
||||
"erupe-ce/utils/byteframe"
|
||||
)
|
||||
|
||||
// MsgMhfChargeFesta represents the MSG_MHF_CHARGE_FESTA
|
||||
@@ -23,7 +22,7 @@ func (m *MsgMhfChargeFesta) Opcode() network.PacketID {
|
||||
}
|
||||
|
||||
// Parse parses the packet from binary
|
||||
func (m *MsgMhfChargeFesta) Parse(bf *byteframe.ByteFrame, ctx *clientctx.ClientContext) error {
|
||||
func (m *MsgMhfChargeFesta) Parse(bf *byteframe.ByteFrame) error {
|
||||
m.AckHandle = bf.ReadUint32()
|
||||
m.FestaID = bf.ReadUint32()
|
||||
m.GuildID = bf.ReadUint32()
|
||||
@@ -35,6 +34,6 @@ func (m *MsgMhfChargeFesta) Parse(bf *byteframe.ByteFrame, ctx *clientctx.Client
|
||||
}
|
||||
|
||||
// Build builds a binary packet from the current data.
|
||||
func (m *MsgMhfChargeFesta) Build(bf *byteframe.ByteFrame, ctx *clientctx.ClientContext) error {
|
||||
func (m *MsgMhfChargeFesta) Build(bf *byteframe.ByteFrame) error {
|
||||
return errors.New("NOT IMPLEMENTED")
|
||||
}
|
||||
|
||||
@@ -1,18 +1,17 @@
|
||||
package mhfpacket
|
||||
|
||||
import (
|
||||
"errors"
|
||||
"errors"
|
||||
|
||||
"erupe-ce/network/clientctx"
|
||||
"erupe-ce/network"
|
||||
"erupe-ce/common/byteframe"
|
||||
"erupe-ce/utils/byteframe"
|
||||
)
|
||||
|
||||
// MsgMhfChargeGuildAdventure represents the MSG_MHF_CHARGE_GUILD_ADVENTURE
|
||||
type MsgMhfChargeGuildAdventure struct {
|
||||
AckHandle uint32
|
||||
ID uint32
|
||||
Amount uint32
|
||||
AckHandle uint32
|
||||
ID uint32
|
||||
Amount uint32
|
||||
}
|
||||
|
||||
// Opcode returns the ID associated with this packet type.
|
||||
@@ -21,14 +20,14 @@ func (m *MsgMhfChargeGuildAdventure) Opcode() network.PacketID {
|
||||
}
|
||||
|
||||
// Parse parses the packet from binary
|
||||
func (m *MsgMhfChargeGuildAdventure) Parse(bf *byteframe.ByteFrame, ctx *clientctx.ClientContext) error {
|
||||
m.AckHandle = bf.ReadUint32()
|
||||
m.ID = bf.ReadUint32()
|
||||
m.Amount = bf.ReadUint32()
|
||||
return nil
|
||||
func (m *MsgMhfChargeGuildAdventure) Parse(bf *byteframe.ByteFrame) error {
|
||||
m.AckHandle = bf.ReadUint32()
|
||||
m.ID = bf.ReadUint32()
|
||||
m.Amount = bf.ReadUint32()
|
||||
return nil
|
||||
}
|
||||
|
||||
// Build builds a binary packet from the current data.
|
||||
func (m *MsgMhfChargeGuildAdventure) Build(bf *byteframe.ByteFrame, ctx *clientctx.ClientContext) error {
|
||||
func (m *MsgMhfChargeGuildAdventure) Build(bf *byteframe.ByteFrame) error {
|
||||
return errors.New("NOT IMPLEMENTED")
|
||||
}
|
||||
|
||||
@@ -2,9 +2,8 @@ package mhfpacket
|
||||
|
||||
import (
|
||||
"errors"
|
||||
"erupe-ce/common/byteframe"
|
||||
"erupe-ce/network"
|
||||
"erupe-ce/network/clientctx"
|
||||
"erupe-ce/utils/byteframe"
|
||||
)
|
||||
|
||||
// MsgMhfCheckDailyCafepoint represents the MSG_MHF_CHECK_DAILY_CAFEPOINT
|
||||
@@ -19,12 +18,12 @@ func (m *MsgMhfCheckDailyCafepoint) Opcode() network.PacketID {
|
||||
}
|
||||
|
||||
// Parse parses the packet from binary
|
||||
func (m *MsgMhfCheckDailyCafepoint) Parse(bf *byteframe.ByteFrame, ctx *clientctx.ClientContext) error {
|
||||
func (m *MsgMhfCheckDailyCafepoint) Parse(bf *byteframe.ByteFrame) error {
|
||||
m.AckHandle = bf.ReadUint32()
|
||||
m.Unk = bf.ReadUint32()
|
||||
return nil
|
||||
}
|
||||
|
||||
func (m *MsgMhfCheckDailyCafepoint) Build(bf *byteframe.ByteFrame, ctx *clientctx.ClientContext) error {
|
||||
func (m *MsgMhfCheckDailyCafepoint) Build(bf *byteframe.ByteFrame) error {
|
||||
return errors.New("NOT IMPLEMENTED")
|
||||
}
|
||||
|
||||
@@ -3,9 +3,8 @@ package mhfpacket
|
||||
import (
|
||||
"errors"
|
||||
|
||||
"erupe-ce/common/byteframe"
|
||||
"erupe-ce/network"
|
||||
"erupe-ce/network/clientctx"
|
||||
"erupe-ce/utils/byteframe"
|
||||
)
|
||||
|
||||
// MsgMhfCheckMonthlyItem represents the MSG_MHF_CHECK_MONTHLY_ITEM
|
||||
@@ -20,7 +19,7 @@ func (m *MsgMhfCheckMonthlyItem) Opcode() network.PacketID {
|
||||
}
|
||||
|
||||
// Parse parses the packet from binary
|
||||
func (m *MsgMhfCheckMonthlyItem) Parse(bf *byteframe.ByteFrame, ctx *clientctx.ClientContext) error {
|
||||
func (m *MsgMhfCheckMonthlyItem) Parse(bf *byteframe.ByteFrame) error {
|
||||
m.AckHandle = bf.ReadUint32()
|
||||
m.Type = bf.ReadUint8()
|
||||
bf.ReadUint8() // Zeroed
|
||||
@@ -30,6 +29,6 @@ func (m *MsgMhfCheckMonthlyItem) Parse(bf *byteframe.ByteFrame, ctx *clientctx.C
|
||||
}
|
||||
|
||||
// Build builds a binary packet from the current data.
|
||||
func (m *MsgMhfCheckMonthlyItem) Build(bf *byteframe.ByteFrame, ctx *clientctx.ClientContext) error {
|
||||
func (m *MsgMhfCheckMonthlyItem) Build(bf *byteframe.ByteFrame) error {
|
||||
return errors.New("NOT IMPLEMENTED")
|
||||
}
|
||||
|
||||
@@ -2,9 +2,8 @@ package mhfpacket
|
||||
|
||||
import (
|
||||
"errors"
|
||||
"erupe-ce/common/byteframe"
|
||||
"erupe-ce/network"
|
||||
"erupe-ce/network/clientctx"
|
||||
"erupe-ce/utils/byteframe"
|
||||
)
|
||||
|
||||
// MsgMhfCheckWeeklyStamp represents the MSG_MHF_CHECK_WEEKLY_STAMP
|
||||
@@ -20,7 +19,7 @@ func (m *MsgMhfCheckWeeklyStamp) Opcode() network.PacketID {
|
||||
}
|
||||
|
||||
// Parse parses the packet from binary
|
||||
func (m *MsgMhfCheckWeeklyStamp) Parse(bf *byteframe.ByteFrame, ctx *clientctx.ClientContext) error {
|
||||
func (m *MsgMhfCheckWeeklyStamp) Parse(bf *byteframe.ByteFrame) error {
|
||||
m.AckHandle = bf.ReadUint32()
|
||||
stampType := bf.ReadUint8()
|
||||
switch stampType {
|
||||
@@ -35,6 +34,6 @@ func (m *MsgMhfCheckWeeklyStamp) Parse(bf *byteframe.ByteFrame, ctx *clientctx.C
|
||||
}
|
||||
|
||||
// Build builds a binary packet from the current data.
|
||||
func (m *MsgMhfCheckWeeklyStamp) Build(bf *byteframe.ByteFrame, ctx *clientctx.ClientContext) error {
|
||||
func (m *MsgMhfCheckWeeklyStamp) Build(bf *byteframe.ByteFrame) error {
|
||||
return errors.New("NOT IMPLEMENTED")
|
||||
}
|
||||
|
||||
@@ -3,9 +3,8 @@ package mhfpacket
|
||||
import (
|
||||
"errors"
|
||||
|
||||
"erupe-ce/common/byteframe"
|
||||
"erupe-ce/network"
|
||||
"erupe-ce/network/clientctx"
|
||||
"erupe-ce/utils/byteframe"
|
||||
)
|
||||
|
||||
// MsgMhfContractMercenary represents the MSG_MHF_CONTRACT_MERCENARY
|
||||
@@ -22,7 +21,7 @@ func (m *MsgMhfContractMercenary) Opcode() network.PacketID {
|
||||
}
|
||||
|
||||
// Parse parses the packet from binary
|
||||
func (m *MsgMhfContractMercenary) Parse(bf *byteframe.ByteFrame, ctx *clientctx.ClientContext) error {
|
||||
func (m *MsgMhfContractMercenary) Parse(bf *byteframe.ByteFrame) error {
|
||||
m.AckHandle = bf.ReadUint32()
|
||||
m.PactMercID = bf.ReadUint32()
|
||||
m.CID = bf.ReadUint32()
|
||||
@@ -31,6 +30,6 @@ func (m *MsgMhfContractMercenary) Parse(bf *byteframe.ByteFrame, ctx *clientctx.
|
||||
}
|
||||
|
||||
// Build builds a binary packet from the current data.
|
||||
func (m *MsgMhfContractMercenary) Build(bf *byteframe.ByteFrame, ctx *clientctx.ClientContext) error {
|
||||
func (m *MsgMhfContractMercenary) Build(bf *byteframe.ByteFrame) error {
|
||||
return errors.New("NOT IMPLEMENTED")
|
||||
}
|
||||
|
||||
@@ -3,10 +3,9 @@ package mhfpacket
|
||||
import (
|
||||
"errors"
|
||||
|
||||
"erupe-ce/common/byteframe"
|
||||
"erupe-ce/common/stringsupport"
|
||||
"erupe-ce/network"
|
||||
"erupe-ce/network/clientctx"
|
||||
"erupe-ce/utils/byteframe"
|
||||
"erupe-ce/utils/stringsupport"
|
||||
)
|
||||
|
||||
// MsgMhfCreateGuild represents the MSG_MHF_CREATE_GUILD
|
||||
@@ -21,7 +20,7 @@ func (m *MsgMhfCreateGuild) Opcode() network.PacketID {
|
||||
}
|
||||
|
||||
// Parse parses the packet from binary
|
||||
func (m *MsgMhfCreateGuild) Parse(bf *byteframe.ByteFrame, ctx *clientctx.ClientContext) error {
|
||||
func (m *MsgMhfCreateGuild) Parse(bf *byteframe.ByteFrame) error {
|
||||
m.AckHandle = bf.ReadUint32()
|
||||
bf.ReadUint16() // Zeroed
|
||||
bf.ReadUint16() // Name length
|
||||
@@ -30,6 +29,6 @@ func (m *MsgMhfCreateGuild) Parse(bf *byteframe.ByteFrame, ctx *clientctx.Client
|
||||
}
|
||||
|
||||
// Build builds a binary packet from the current data.
|
||||
func (m *MsgMhfCreateGuild) Build(bf *byteframe.ByteFrame, ctx *clientctx.ClientContext) error {
|
||||
func (m *MsgMhfCreateGuild) Build(bf *byteframe.ByteFrame) error {
|
||||
return errors.New("NOT IMPLEMENTED")
|
||||
}
|
||||
|
||||
@@ -3,10 +3,9 @@ package mhfpacket
|
||||
import (
|
||||
"errors"
|
||||
|
||||
"erupe-ce/common/byteframe"
|
||||
"erupe-ce/common/stringsupport"
|
||||
"erupe-ce/network"
|
||||
"erupe-ce/network/clientctx"
|
||||
"erupe-ce/utils/byteframe"
|
||||
"erupe-ce/utils/stringsupport"
|
||||
)
|
||||
|
||||
// MsgMhfCreateJoint represents the MSG_MHF_CREATE_JOINT
|
||||
@@ -22,7 +21,7 @@ func (m *MsgMhfCreateJoint) Opcode() network.PacketID {
|
||||
}
|
||||
|
||||
// Parse parses the packet from binary
|
||||
func (m *MsgMhfCreateJoint) Parse(bf *byteframe.ByteFrame, ctx *clientctx.ClientContext) error {
|
||||
func (m *MsgMhfCreateJoint) Parse(bf *byteframe.ByteFrame) error {
|
||||
m.AckHandle = bf.ReadUint32()
|
||||
m.GuildID = bf.ReadUint32()
|
||||
bf.ReadUint16() // Zeroed
|
||||
@@ -32,6 +31,6 @@ func (m *MsgMhfCreateJoint) Parse(bf *byteframe.ByteFrame, ctx *clientctx.Client
|
||||
}
|
||||
|
||||
// Build builds a binary packet from the current data.
|
||||
func (m *MsgMhfCreateJoint) Build(bf *byteframe.ByteFrame, ctx *clientctx.ClientContext) error {
|
||||
func (m *MsgMhfCreateJoint) Build(bf *byteframe.ByteFrame) error {
|
||||
return errors.New("NOT IMPLEMENTED")
|
||||
}
|
||||
|
||||
@@ -1,11 +1,10 @@
|
||||
package mhfpacket
|
||||
|
||||
import (
|
||||
"errors"
|
||||
import (
|
||||
"errors"
|
||||
|
||||
"erupe-ce/network/clientctx"
|
||||
"erupe-ce/network"
|
||||
"erupe-ce/common/byteframe"
|
||||
"erupe-ce/utils/byteframe"
|
||||
)
|
||||
|
||||
// MsgMhfCreateMercenary represents the MSG_MHF_CREATE_MERCENARY
|
||||
@@ -19,12 +18,12 @@ func (m *MsgMhfCreateMercenary) Opcode() network.PacketID {
|
||||
}
|
||||
|
||||
// Parse parses the packet from binary
|
||||
func (m *MsgMhfCreateMercenary) Parse(bf *byteframe.ByteFrame, ctx *clientctx.ClientContext) error {
|
||||
func (m *MsgMhfCreateMercenary) Parse(bf *byteframe.ByteFrame) error {
|
||||
m.AckHandle = bf.ReadUint32()
|
||||
return nil
|
||||
}
|
||||
|
||||
// Build builds a binary packet from the current data.
|
||||
func (m *MsgMhfCreateMercenary) Build(bf *byteframe.ByteFrame, ctx *clientctx.ClientContext) error {
|
||||
func (m *MsgMhfCreateMercenary) Build(bf *byteframe.ByteFrame) error {
|
||||
return errors.New("NOT IMPLEMENTED")
|
||||
}
|
||||
|
||||
@@ -1,11 +1,10 @@
|
||||
package mhfpacket
|
||||
|
||||
import (
|
||||
"errors"
|
||||
import (
|
||||
"errors"
|
||||
|
||||
"erupe-ce/network/clientctx"
|
||||
"erupe-ce/network"
|
||||
"erupe-ce/common/byteframe"
|
||||
"erupe-ce/utils/byteframe"
|
||||
)
|
||||
|
||||
// MsgMhfDebugPostValue represents the MSG_MHF_DEBUG_POST_VALUE
|
||||
@@ -17,11 +16,11 @@ func (m *MsgMhfDebugPostValue) Opcode() network.PacketID {
|
||||
}
|
||||
|
||||
// Parse parses the packet from binary
|
||||
func (m *MsgMhfDebugPostValue) Parse(bf *byteframe.ByteFrame, ctx *clientctx.ClientContext) error {
|
||||
func (m *MsgMhfDebugPostValue) Parse(bf *byteframe.ByteFrame) error {
|
||||
return errors.New("NOT IMPLEMENTED")
|
||||
}
|
||||
|
||||
// Build builds a binary packet from the current data.
|
||||
func (m *MsgMhfDebugPostValue) Build(bf *byteframe.ByteFrame, ctx *clientctx.ClientContext) error {
|
||||
func (m *MsgMhfDebugPostValue) Build(bf *byteframe.ByteFrame) error {
|
||||
return errors.New("NOT IMPLEMENTED")
|
||||
}
|
||||
|
||||
@@ -2,9 +2,8 @@ package mhfpacket
|
||||
|
||||
import (
|
||||
"errors"
|
||||
"erupe-ce/common/byteframe"
|
||||
"erupe-ce/network"
|
||||
"erupe-ce/network/clientctx"
|
||||
"erupe-ce/utils/byteframe"
|
||||
)
|
||||
|
||||
// MsgMhfDisplayedAchievement represents the MSG_MHF_DISPLAYED_ACHIEVEMENT
|
||||
@@ -16,12 +15,12 @@ func (m *MsgMhfDisplayedAchievement) Opcode() network.PacketID {
|
||||
}
|
||||
|
||||
// Parse parses the packet from binary
|
||||
func (m *MsgMhfDisplayedAchievement) Parse(bf *byteframe.ByteFrame, ctx *clientctx.ClientContext) error {
|
||||
func (m *MsgMhfDisplayedAchievement) Parse(bf *byteframe.ByteFrame) error {
|
||||
bf.ReadUint8() // Zeroed
|
||||
return nil
|
||||
}
|
||||
|
||||
// Build builds a binary packet from the current data.
|
||||
func (m *MsgMhfDisplayedAchievement) Build(bf *byteframe.ByteFrame, ctx *clientctx.ClientContext) error {
|
||||
func (m *MsgMhfDisplayedAchievement) Build(bf *byteframe.ByteFrame) error {
|
||||
return errors.New("NOT IMPLEMENTED")
|
||||
}
|
||||
|
||||
@@ -1,11 +1,10 @@
|
||||
package mhfpacket
|
||||
|
||||
import (
|
||||
"errors"
|
||||
import (
|
||||
"errors"
|
||||
|
||||
"erupe-ce/network/clientctx"
|
||||
"erupe-ce/network"
|
||||
"erupe-ce/common/byteframe"
|
||||
"erupe-ce/utils/byteframe"
|
||||
)
|
||||
|
||||
// MsgMhfEnterTournamentQuest represents the MSG_MHF_ENTER_TOURNAMENT_QUEST
|
||||
@@ -17,11 +16,11 @@ func (m *MsgMhfEnterTournamentQuest) Opcode() network.PacketID {
|
||||
}
|
||||
|
||||
// Parse parses the packet from binary
|
||||
func (m *MsgMhfEnterTournamentQuest) Parse(bf *byteframe.ByteFrame, ctx *clientctx.ClientContext) error {
|
||||
func (m *MsgMhfEnterTournamentQuest) Parse(bf *byteframe.ByteFrame) error {
|
||||
return errors.New("NOT IMPLEMENTED")
|
||||
}
|
||||
|
||||
// Build builds a binary packet from the current data.
|
||||
func (m *MsgMhfEnterTournamentQuest) Build(bf *byteframe.ByteFrame, ctx *clientctx.ClientContext) error {
|
||||
func (m *MsgMhfEnterTournamentQuest) Build(bf *byteframe.ByteFrame) error {
|
||||
return errors.New("NOT IMPLEMENTED")
|
||||
}
|
||||
|
||||
@@ -3,9 +3,8 @@ package mhfpacket
|
||||
import (
|
||||
"errors"
|
||||
|
||||
"erupe-ce/common/byteframe"
|
||||
"erupe-ce/network"
|
||||
"erupe-ce/network/clientctx"
|
||||
"erupe-ce/utils/byteframe"
|
||||
)
|
||||
|
||||
// MsgMhfEntryFesta represents the MSG_MHF_ENTRY_FESTA
|
||||
@@ -21,7 +20,7 @@ func (m *MsgMhfEntryFesta) Opcode() network.PacketID {
|
||||
}
|
||||
|
||||
// Parse parses the packet from binary
|
||||
func (m *MsgMhfEntryFesta) Parse(bf *byteframe.ByteFrame, ctx *clientctx.ClientContext) error {
|
||||
func (m *MsgMhfEntryFesta) Parse(bf *byteframe.ByteFrame) error {
|
||||
m.AckHandle = bf.ReadUint32()
|
||||
m.FestaID = bf.ReadUint32()
|
||||
m.GuildID = bf.ReadUint32()
|
||||
@@ -30,6 +29,6 @@ func (m *MsgMhfEntryFesta) Parse(bf *byteframe.ByteFrame, ctx *clientctx.ClientC
|
||||
}
|
||||
|
||||
// Build builds a binary packet from the current data.
|
||||
func (m *MsgMhfEntryFesta) Build(bf *byteframe.ByteFrame, ctx *clientctx.ClientContext) error {
|
||||
func (m *MsgMhfEntryFesta) Build(bf *byteframe.ByteFrame) error {
|
||||
return errors.New("NOT IMPLEMENTED")
|
||||
}
|
||||
|
||||
@@ -3,9 +3,8 @@ package mhfpacket
|
||||
import (
|
||||
"errors"
|
||||
|
||||
"erupe-ce/common/byteframe"
|
||||
"erupe-ce/network"
|
||||
"erupe-ce/network/clientctx"
|
||||
"erupe-ce/utils/byteframe"
|
||||
)
|
||||
|
||||
// MsgMhfEntryRookieGuild represents the MSG_MHF_ENTRY_ROOKIE_GUILD
|
||||
@@ -20,13 +19,13 @@ func (m *MsgMhfEntryRookieGuild) Opcode() network.PacketID {
|
||||
}
|
||||
|
||||
// Parse parses the packet from binary
|
||||
func (m *MsgMhfEntryRookieGuild) Parse(bf *byteframe.ByteFrame, ctx *clientctx.ClientContext) error {
|
||||
func (m *MsgMhfEntryRookieGuild) Parse(bf *byteframe.ByteFrame) 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, ctx *clientctx.ClientContext) error {
|
||||
func (m *MsgMhfEntryRookieGuild) Build(bf *byteframe.ByteFrame) error {
|
||||
return errors.New("NOT IMPLEMENTED")
|
||||
}
|
||||
|
||||
@@ -3,9 +3,8 @@ package mhfpacket
|
||||
import (
|
||||
"errors"
|
||||
|
||||
"erupe-ce/common/byteframe"
|
||||
"erupe-ce/network"
|
||||
"erupe-ce/network/clientctx"
|
||||
"erupe-ce/utils/byteframe"
|
||||
)
|
||||
|
||||
// MsgMhfEntryTournament represents the MSG_MHF_ENTRY_TOURNAMENT
|
||||
@@ -21,7 +20,7 @@ func (m *MsgMhfEntryTournament) Opcode() network.PacketID {
|
||||
}
|
||||
|
||||
// Parse parses the packet from binary
|
||||
func (m *MsgMhfEntryTournament) Parse(bf *byteframe.ByteFrame, ctx *clientctx.ClientContext) error {
|
||||
func (m *MsgMhfEntryTournament) Parse(bf *byteframe.ByteFrame) error {
|
||||
m.AckHandle = bf.ReadUint32()
|
||||
m.TournamentID = bf.ReadUint32()
|
||||
m.Unk0 = bf.ReadUint8()
|
||||
@@ -29,6 +28,6 @@ func (m *MsgMhfEntryTournament) Parse(bf *byteframe.ByteFrame, ctx *clientctx.Cl
|
||||
}
|
||||
|
||||
// Build builds a binary packet from the current data.
|
||||
func (m *MsgMhfEntryTournament) Build(bf *byteframe.ByteFrame, ctx *clientctx.ClientContext) error {
|
||||
func (m *MsgMhfEntryTournament) Build(bf *byteframe.ByteFrame) error {
|
||||
return errors.New("NOT IMPLEMENTED")
|
||||
}
|
||||
|
||||
@@ -3,9 +3,8 @@ package mhfpacket
|
||||
import (
|
||||
"errors"
|
||||
|
||||
"erupe-ce/common/byteframe"
|
||||
"erupe-ce/network"
|
||||
"erupe-ce/network/clientctx"
|
||||
"erupe-ce/utils/byteframe"
|
||||
)
|
||||
|
||||
// MsgMhfEnumerateAiroulist represents the MSG_MHF_ENUMERATE_AIROULIST
|
||||
@@ -21,7 +20,7 @@ func (m *MsgMhfEnumerateAiroulist) Opcode() network.PacketID {
|
||||
}
|
||||
|
||||
// Parse parses the packet from binary
|
||||
func (m *MsgMhfEnumerateAiroulist) Parse(bf *byteframe.ByteFrame, ctx *clientctx.ClientContext) error {
|
||||
func (m *MsgMhfEnumerateAiroulist) Parse(bf *byteframe.ByteFrame) error {
|
||||
m.AckHandle = bf.ReadUint32()
|
||||
m.Unk0 = bf.ReadUint16()
|
||||
m.Unk1 = bf.ReadUint16()
|
||||
@@ -29,6 +28,6 @@ func (m *MsgMhfEnumerateAiroulist) Parse(bf *byteframe.ByteFrame, ctx *clientctx
|
||||
}
|
||||
|
||||
// Build builds a binary packet from the current data.
|
||||
func (m *MsgMhfEnumerateAiroulist) Build(bf *byteframe.ByteFrame, ctx *clientctx.ClientContext) error {
|
||||
func (m *MsgMhfEnumerateAiroulist) Build(bf *byteframe.ByteFrame) error {
|
||||
return errors.New("NOT IMPLEMENTED")
|
||||
}
|
||||
|
||||
@@ -1,9 +1,8 @@
|
||||
package mhfpacket
|
||||
|
||||
import (
|
||||
"erupe-ce/common/byteframe"
|
||||
"erupe-ce/network"
|
||||
"erupe-ce/network/clientctx"
|
||||
"erupe-ce/utils/byteframe"
|
||||
)
|
||||
|
||||
// MsgMhfEnumerateCampaign represents the MSG_MHF_ENUMERATE_CAMPAIGN
|
||||
@@ -19,7 +18,7 @@ func (m *MsgMhfEnumerateCampaign) Opcode() network.PacketID {
|
||||
}
|
||||
|
||||
// Parse parses the packet from binary
|
||||
func (m *MsgMhfEnumerateCampaign) Parse(bf *byteframe.ByteFrame, ctx *clientctx.ClientContext) error {
|
||||
func (m *MsgMhfEnumerateCampaign) Parse(bf *byteframe.ByteFrame) error {
|
||||
m.AckHandle = bf.ReadUint32()
|
||||
m.Unk0 = bf.ReadUint16()
|
||||
m.Unk1 = bf.ReadUint16()
|
||||
@@ -27,7 +26,7 @@ func (m *MsgMhfEnumerateCampaign) Parse(bf *byteframe.ByteFrame, ctx *clientctx.
|
||||
}
|
||||
|
||||
// Build builds a binary packet from the current data.
|
||||
func (m *MsgMhfEnumerateCampaign) Build(bf *byteframe.ByteFrame, ctx *clientctx.ClientContext) error {
|
||||
func (m *MsgMhfEnumerateCampaign) Build(bf *byteframe.ByteFrame) error {
|
||||
bf.WriteUint32(m.AckHandle)
|
||||
bf.WriteUint16(m.Unk0)
|
||||
bf.WriteUint16(m.Unk1)
|
||||
|
||||
@@ -2,10 +2,9 @@ package mhfpacket
|
||||
|
||||
import (
|
||||
"errors"
|
||||
"erupe-ce/common/byteframe"
|
||||
_config "erupe-ce/config"
|
||||
"erupe-ce/config"
|
||||
"erupe-ce/network"
|
||||
"erupe-ce/network/clientctx"
|
||||
"erupe-ce/utils/byteframe"
|
||||
)
|
||||
|
||||
// MsgMhfEnumerateDistItem represents the MSG_MHF_ENUMERATE_DIST_ITEM
|
||||
@@ -23,18 +22,18 @@ func (m *MsgMhfEnumerateDistItem) Opcode() network.PacketID {
|
||||
}
|
||||
|
||||
// Parse parses the packet from binary
|
||||
func (m *MsgMhfEnumerateDistItem) Parse(bf *byteframe.ByteFrame, ctx *clientctx.ClientContext) error {
|
||||
func (m *MsgMhfEnumerateDistItem) Parse(bf *byteframe.ByteFrame) error {
|
||||
m.AckHandle = bf.ReadUint32()
|
||||
m.DistType = bf.ReadUint8()
|
||||
m.Unk1 = bf.ReadUint8()
|
||||
m.Unk2 = bf.ReadUint16() // Maximum? Hardcoded to 256
|
||||
if _config.ErupeConfig.RealClientMode >= _config.Z1 {
|
||||
if config.GetConfig().ClientID >= config.Z1 {
|
||||
m.Unk3 = bf.ReadBytes(uint(bf.ReadUint8()))
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
// Build builds a binary packet from the current data.
|
||||
func (m *MsgMhfEnumerateDistItem) Build(bf *byteframe.ByteFrame, ctx *clientctx.ClientContext) error {
|
||||
func (m *MsgMhfEnumerateDistItem) Build(bf *byteframe.ByteFrame) error {
|
||||
return errors.New("NOT IMPLEMENTED")
|
||||
}
|
||||
|
||||
@@ -2,9 +2,8 @@ package mhfpacket
|
||||
|
||||
import (
|
||||
"errors"
|
||||
"erupe-ce/common/byteframe"
|
||||
"erupe-ce/network"
|
||||
"erupe-ce/network/clientctx"
|
||||
"erupe-ce/utils/byteframe"
|
||||
)
|
||||
|
||||
// MsgMhfEnumerateEvent represents the MSG_MHF_ENUMERATE_EVENT
|
||||
@@ -18,7 +17,7 @@ func (m *MsgMhfEnumerateEvent) Opcode() network.PacketID {
|
||||
}
|
||||
|
||||
// Parse parses the packet from binary
|
||||
func (m *MsgMhfEnumerateEvent) Parse(bf *byteframe.ByteFrame, ctx *clientctx.ClientContext) error {
|
||||
func (m *MsgMhfEnumerateEvent) Parse(bf *byteframe.ByteFrame) error {
|
||||
m.AckHandle = bf.ReadUint32()
|
||||
bf.ReadUint16() // Zeroed
|
||||
bf.ReadUint16() // Zeroed
|
||||
@@ -26,6 +25,6 @@ func (m *MsgMhfEnumerateEvent) Parse(bf *byteframe.ByteFrame, ctx *clientctx.Cli
|
||||
}
|
||||
|
||||
// Build builds a binary packet from the current data.
|
||||
func (m *MsgMhfEnumerateEvent) Build(bf *byteframe.ByteFrame, ctx *clientctx.ClientContext) error {
|
||||
func (m *MsgMhfEnumerateEvent) Build(bf *byteframe.ByteFrame) error {
|
||||
return errors.New("NOT IMPLEMENTED")
|
||||
}
|
||||
|
||||
@@ -1,11 +1,10 @@
|
||||
package mhfpacket
|
||||
|
||||
import (
|
||||
"errors"
|
||||
import (
|
||||
"errors"
|
||||
|
||||
"erupe-ce/network/clientctx"
|
||||
"erupe-ce/network"
|
||||
"erupe-ce/common/byteframe"
|
||||
"erupe-ce/utils/byteframe"
|
||||
)
|
||||
|
||||
// MsgMhfEnumerateFestaIntermediatePrize represents the MSG_MHF_ENUMERATE_FESTA_INTERMEDIATE_PRIZE
|
||||
@@ -19,12 +18,12 @@ func (m *MsgMhfEnumerateFestaIntermediatePrize) Opcode() network.PacketID {
|
||||
}
|
||||
|
||||
// Parse parses the packet from binary
|
||||
func (m *MsgMhfEnumerateFestaIntermediatePrize) Parse(bf *byteframe.ByteFrame, ctx *clientctx.ClientContext) error {
|
||||
func (m *MsgMhfEnumerateFestaIntermediatePrize) Parse(bf *byteframe.ByteFrame) error {
|
||||
m.AckHandle = bf.ReadUint32()
|
||||
return nil
|
||||
}
|
||||
|
||||
// Build builds a binary packet from the current data.
|
||||
func (m *MsgMhfEnumerateFestaIntermediatePrize) Build(bf *byteframe.ByteFrame, ctx *clientctx.ClientContext) error {
|
||||
func (m *MsgMhfEnumerateFestaIntermediatePrize) Build(bf *byteframe.ByteFrame) error {
|
||||
return errors.New("NOT IMPLEMENTED")
|
||||
}
|
||||
|
||||
@@ -3,9 +3,8 @@ package mhfpacket
|
||||
import (
|
||||
"errors"
|
||||
|
||||
"erupe-ce/common/byteframe"
|
||||
"erupe-ce/network"
|
||||
"erupe-ce/network/clientctx"
|
||||
"erupe-ce/utils/byteframe"
|
||||
)
|
||||
|
||||
// MsgMhfEnumerateFestaMember represents the MSG_MHF_ENUMERATE_FESTA_MEMBER
|
||||
@@ -21,7 +20,7 @@ func (m *MsgMhfEnumerateFestaMember) Opcode() network.PacketID {
|
||||
}
|
||||
|
||||
// Parse parses the packet from binary
|
||||
func (m *MsgMhfEnumerateFestaMember) Parse(bf *byteframe.ByteFrame, ctx *clientctx.ClientContext) error {
|
||||
func (m *MsgMhfEnumerateFestaMember) Parse(bf *byteframe.ByteFrame) error {
|
||||
m.AckHandle = bf.ReadUint32()
|
||||
m.FestaID = bf.ReadUint32()
|
||||
m.GuildID = bf.ReadUint32()
|
||||
@@ -30,6 +29,6 @@ func (m *MsgMhfEnumerateFestaMember) Parse(bf *byteframe.ByteFrame, ctx *clientc
|
||||
}
|
||||
|
||||
// Build builds a binary packet from the current data.
|
||||
func (m *MsgMhfEnumerateFestaMember) Build(bf *byteframe.ByteFrame, ctx *clientctx.ClientContext) error {
|
||||
func (m *MsgMhfEnumerateFestaMember) Build(bf *byteframe.ByteFrame) error {
|
||||
return errors.New("NOT IMPLEMENTED")
|
||||
}
|
||||
|
||||
@@ -1,11 +1,10 @@
|
||||
package mhfpacket
|
||||
|
||||
import (
|
||||
"errors"
|
||||
import (
|
||||
"errors"
|
||||
|
||||
"erupe-ce/network/clientctx"
|
||||
"erupe-ce/network"
|
||||
"erupe-ce/common/byteframe"
|
||||
"erupe-ce/utils/byteframe"
|
||||
)
|
||||
|
||||
// MsgMhfEnumerateFestaPersonalPrize represents the MSG_MHF_ENUMERATE_FESTA_PERSONAL_PRIZE
|
||||
@@ -19,12 +18,12 @@ func (m *MsgMhfEnumerateFestaPersonalPrize) Opcode() network.PacketID {
|
||||
}
|
||||
|
||||
// Parse parses the packet from binary
|
||||
func (m *MsgMhfEnumerateFestaPersonalPrize) Parse(bf *byteframe.ByteFrame, ctx *clientctx.ClientContext) error {
|
||||
func (m *MsgMhfEnumerateFestaPersonalPrize) Parse(bf *byteframe.ByteFrame) error {
|
||||
m.AckHandle = bf.ReadUint32()
|
||||
return nil
|
||||
}
|
||||
|
||||
// Build builds a binary packet from the current data.
|
||||
func (m *MsgMhfEnumerateFestaPersonalPrize) Build(bf *byteframe.ByteFrame, ctx *clientctx.ClientContext) error {
|
||||
func (m *MsgMhfEnumerateFestaPersonalPrize) Build(bf *byteframe.ByteFrame) error {
|
||||
return errors.New("NOT IMPLEMENTED")
|
||||
}
|
||||
|
||||
@@ -2,9 +2,8 @@ package mhfpacket
|
||||
|
||||
import (
|
||||
"errors"
|
||||
"erupe-ce/common/byteframe"
|
||||
"erupe-ce/network"
|
||||
"erupe-ce/network/clientctx"
|
||||
"erupe-ce/utils/byteframe"
|
||||
)
|
||||
|
||||
// MsgMhfEnumerateGuacot represents the MSG_MHF_ENUMERATE_GUACOT
|
||||
@@ -19,7 +18,7 @@ func (m *MsgMhfEnumerateGuacot) Opcode() network.PacketID {
|
||||
}
|
||||
|
||||
// Parse parses the packet from binary
|
||||
func (m *MsgMhfEnumerateGuacot) Parse(bf *byteframe.ByteFrame, ctx *clientctx.ClientContext) error {
|
||||
func (m *MsgMhfEnumerateGuacot) Parse(bf *byteframe.ByteFrame) error {
|
||||
m.AckHandle = bf.ReadUint32()
|
||||
m.Unk0 = bf.ReadUint32()
|
||||
bf.ReadUint16() // Zeroed
|
||||
@@ -27,6 +26,6 @@ func (m *MsgMhfEnumerateGuacot) Parse(bf *byteframe.ByteFrame, ctx *clientctx.Cl
|
||||
}
|
||||
|
||||
// Build builds a binary packet from the current data.
|
||||
func (m *MsgMhfEnumerateGuacot) Build(bf *byteframe.ByteFrame, ctx *clientctx.ClientContext) error {
|
||||
func (m *MsgMhfEnumerateGuacot) Build(bf *byteframe.ByteFrame) error {
|
||||
return errors.New("NOT IMPLEMENTED")
|
||||
}
|
||||
|
||||
@@ -2,9 +2,8 @@ package mhfpacket
|
||||
|
||||
import (
|
||||
"errors"
|
||||
"erupe-ce/common/byteframe"
|
||||
"erupe-ce/network"
|
||||
"erupe-ce/network/clientctx"
|
||||
"erupe-ce/utils/byteframe"
|
||||
)
|
||||
|
||||
type EnumerateGuildType uint8
|
||||
@@ -42,7 +41,7 @@ func (m *MsgMhfEnumerateGuild) Opcode() network.PacketID {
|
||||
}
|
||||
|
||||
// Parse parses the packet from binary
|
||||
func (m *MsgMhfEnumerateGuild) Parse(bf *byteframe.ByteFrame, ctx *clientctx.ClientContext) error {
|
||||
func (m *MsgMhfEnumerateGuild) Parse(bf *byteframe.ByteFrame) error {
|
||||
m.AckHandle = bf.ReadUint32()
|
||||
m.Type = EnumerateGuildType(bf.ReadUint8())
|
||||
m.Page = bf.ReadUint8()
|
||||
@@ -57,6 +56,6 @@ func (m *MsgMhfEnumerateGuild) Parse(bf *byteframe.ByteFrame, ctx *clientctx.Cli
|
||||
}
|
||||
|
||||
// Build builds a binary packet from the current data.
|
||||
func (m *MsgMhfEnumerateGuild) Build(bf *byteframe.ByteFrame, ctx *clientctx.ClientContext) error {
|
||||
func (m *MsgMhfEnumerateGuild) Build(bf *byteframe.ByteFrame) error {
|
||||
return errors.New("NOT IMPLEMENTED")
|
||||
}
|
||||
|
||||
@@ -3,9 +3,8 @@ package mhfpacket
|
||||
import (
|
||||
"errors"
|
||||
|
||||
"erupe-ce/common/byteframe"
|
||||
"erupe-ce/network"
|
||||
"erupe-ce/network/clientctx"
|
||||
"erupe-ce/utils/byteframe"
|
||||
)
|
||||
|
||||
// MsgMhfEnumerateGuildItem represents the MSG_MHF_ENUMERATE_GUILD_ITEM
|
||||
@@ -20,7 +19,7 @@ func (m *MsgMhfEnumerateGuildItem) Opcode() network.PacketID {
|
||||
}
|
||||
|
||||
// Parse parses the packet from binary
|
||||
func (m *MsgMhfEnumerateGuildItem) Parse(bf *byteframe.ByteFrame, ctx *clientctx.ClientContext) error {
|
||||
func (m *MsgMhfEnumerateGuildItem) Parse(bf *byteframe.ByteFrame) error {
|
||||
m.AckHandle = bf.ReadUint32()
|
||||
m.GuildID = bf.ReadUint32()
|
||||
bf.ReadUint8() // Zeroed
|
||||
@@ -29,6 +28,6 @@ func (m *MsgMhfEnumerateGuildItem) Parse(bf *byteframe.ByteFrame, ctx *clientctx
|
||||
}
|
||||
|
||||
// Build builds a binary packet from the current data.
|
||||
func (m *MsgMhfEnumerateGuildItem) Build(bf *byteframe.ByteFrame, ctx *clientctx.ClientContext) error {
|
||||
func (m *MsgMhfEnumerateGuildItem) Build(bf *byteframe.ByteFrame) error {
|
||||
return errors.New("NOT IMPLEMENTED")
|
||||
}
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user