mirror of
https://github.com/Mezeporta/Erupe.git
synced 2025-12-14 07:55:33 +01:00
Compare commits
2 Commits
feature/en
...
8f3624d589
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
8f3624d589 | ||
|
|
8d1c6a79e2 |
@@ -28,7 +28,7 @@ If you want to modify or compile Erupe yourself, please read on.
|
|||||||
## Installation
|
## Installation
|
||||||
|
|
||||||
1. Bring up a fresh database by using the [backup file attached with the latest release](https://github.com/ZeruLight/Erupe/releases/latest/download/SCHEMA.sql).
|
1. Bring up a fresh database by using the [backup file attached with the latest release](https://github.com/ZeruLight/Erupe/releases/latest/download/SCHEMA.sql).
|
||||||
2. Run each script under [patch-schema](./patch-schema) as they introduce newer schema.
|
2. Run each script under [patch-schema](./schemas/patch-schema) as they introduce newer schema.
|
||||||
3. Edit [config.json](./config.json) such that the database password matches your PostgreSQL setup.
|
3. Edit [config.json](./config.json) such that the database password matches your PostgreSQL setup.
|
||||||
4. Run `go build` or `go run .` to compile Erupe.
|
4. Run `go build` or `go run .` to compile Erupe.
|
||||||
|
|
||||||
|
|||||||
@@ -103,14 +103,7 @@
|
|||||||
"EnableHiganjimaEvent": false,
|
"EnableHiganjimaEvent": false,
|
||||||
"EnableNierEvent": false,
|
"EnableNierEvent": false,
|
||||||
"DisableRoad": false,
|
"DisableRoad": false,
|
||||||
"SeasonOverride": false,
|
"SeasonOverride": false
|
||||||
"EnumerateEvent": {
|
|
||||||
"Enabled":false,
|
|
||||||
"EventID":2,
|
|
||||||
"Duration":172800,
|
|
||||||
"RestartAfter":2977200,
|
|
||||||
"QuestIDs": [20001, 20004, 20005, 20006, 20011, 20012, 20013, 20018, 20019, 20020, 20021, 20022, 20023, 20024, 20025, 20026, 20027, 20028, 20029]
|
|
||||||
}
|
|
||||||
},
|
},
|
||||||
"Discord": {
|
"Discord": {
|
||||||
"Enabled": false,
|
"Enabled": false,
|
||||||
|
|||||||
@@ -140,14 +140,6 @@ type CapLinkOptions struct {
|
|||||||
Port int
|
Port int
|
||||||
}
|
}
|
||||||
|
|
||||||
type EnumerateEventOptions struct {
|
|
||||||
QuestIDs []uint16
|
|
||||||
EventID uint16
|
|
||||||
Enabled bool
|
|
||||||
Duration int
|
|
||||||
RestartAfter int
|
|
||||||
}
|
|
||||||
|
|
||||||
// GameplayOptions has various gameplay modifiers
|
// GameplayOptions has various gameplay modifiers
|
||||||
type GameplayOptions struct {
|
type GameplayOptions struct {
|
||||||
MinFeatureWeapons int // Minimum number of Active Feature weapons to generate daily
|
MinFeatureWeapons int // Minimum number of Active Feature weapons to generate daily
|
||||||
@@ -202,7 +194,6 @@ type GameplayOptions struct {
|
|||||||
EnableNierEvent bool // Enables the Nier event in the Rasta Bar
|
EnableNierEvent bool // Enables the Nier event in the Rasta Bar
|
||||||
DisableRoad bool // Disables the Hunting Road
|
DisableRoad bool // Disables the Hunting Road
|
||||||
SeasonOverride bool // Overrides the Quest Season with the current Mezeporta Season
|
SeasonOverride bool // Overrides the Quest Season with the current Mezeporta Season
|
||||||
EnumerateEvent EnumerateEventOptions
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Discord holds the discord integration config.
|
// Discord holds the discord integration config.
|
||||||
|
|||||||
@@ -1,5 +0,0 @@
|
|||||||
BEGIN;
|
|
||||||
|
|
||||||
ALTER TYPE event_type ADD VALUE 'ancientdragon';
|
|
||||||
|
|
||||||
END;
|
|
||||||
@@ -11,54 +11,22 @@ import (
|
|||||||
)
|
)
|
||||||
|
|
||||||
type Event struct {
|
type Event struct {
|
||||||
EventType uint16 //0 Nothing //1 or 2 "An Acient Dragon has attacked the fort"
|
EventType uint16
|
||||||
Unk1 uint16
|
Unk1 uint16
|
||||||
Unk2 uint16
|
Unk2 uint16
|
||||||
Unk3 uint16
|
Unk3 uint16
|
||||||
Unk4 uint16
|
Unk4 uint16
|
||||||
StartTime uint32
|
Unk5 uint32
|
||||||
EndTime uint32
|
Unk6 uint32
|
||||||
QuestFileIDs []uint16
|
QuestFileIDs []uint16
|
||||||
}
|
}
|
||||||
|
|
||||||
func cleanupEnumEvent(s *Session) {
|
|
||||||
s.server.db.Exec("DELETE FROM events WHERE event_type='ancientdragon'")
|
|
||||||
}
|
|
||||||
func generateEnumEventTimestamps(s *Session, start uint32) []uint32 {
|
|
||||||
timestamps := make([]uint32, 2)
|
|
||||||
midnight := TimeMidnight()
|
|
||||||
//if start is 0 or start is after a duration
|
|
||||||
if start == 0 || TimeAdjusted().Unix() > int64(start)+int64(s.server.erupeConfig.GameplayOptions.EnumerateEvent.RestartAfter) {
|
|
||||||
cleanupEnumEvent(s)
|
|
||||||
// Generate a new diva defense, starting midnight tomorrow
|
|
||||||
start = uint32(midnight.Add(24 * time.Hour).Unix())
|
|
||||||
s.server.db.Exec("INSERT INTO events (event_type, start_time) VALUES ('ancientdragon', to_timestamp($1)::timestamp without time zone)", start)
|
|
||||||
}
|
|
||||||
timestamps[0] = start
|
|
||||||
timestamps[1] = timestamps[0] + uint32(s.server.erupeConfig.GameplayOptions.EnumerateEvent.Duration)
|
|
||||||
return timestamps
|
|
||||||
}
|
|
||||||
|
|
||||||
func handleMsgMhfEnumerateEvent(s *Session, p mhfpacket.MHFPacket) {
|
func handleMsgMhfEnumerateEvent(s *Session, p mhfpacket.MHFPacket) {
|
||||||
pkt := p.(*mhfpacket.MsgMhfEnumerateEvent)
|
pkt := p.(*mhfpacket.MsgMhfEnumerateEvent)
|
||||||
bf := byteframe.NewByteFrame()
|
bf := byteframe.NewByteFrame()
|
||||||
id, start := uint32(0xCAFEBEEF), uint32(0)
|
|
||||||
|
|
||||||
rows, _ := s.server.db.Queryx("SELECT id, (EXTRACT(epoch FROM start_time)::int) as start_time FROM events WHERE event_type='ancientdragon'")
|
|
||||||
if !rows.Next() {
|
|
||||||
for rows.Next() {
|
|
||||||
rows.Scan(&id, &start)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
var timestamps []uint32
|
|
||||||
events := []Event{}
|
events := []Event{}
|
||||||
|
|
||||||
if s.server.erupeConfig.GameplayOptions.EnumerateEvent.Enabled {
|
|
||||||
timestamps = generateEnumEventTimestamps(s, start)
|
|
||||||
events = append(events, Event{s.server.erupeConfig.GameplayOptions.EnumerateEvent.EventID, 0, 0, 0, 0, timestamps[0], timestamps[1], s.server.erupeConfig.GameplayOptions.EnumerateEvent.QuestIDs})
|
|
||||||
}
|
|
||||||
|
|
||||||
bf.WriteUint8(uint8(len(events)))
|
bf.WriteUint8(uint8(len(events)))
|
||||||
for _, event := range events {
|
for _, event := range events {
|
||||||
bf.WriteUint16(event.EventType)
|
bf.WriteUint16(event.EventType)
|
||||||
@@ -66,8 +34,8 @@ func handleMsgMhfEnumerateEvent(s *Session, p mhfpacket.MHFPacket) {
|
|||||||
bf.WriteUint16(event.Unk2)
|
bf.WriteUint16(event.Unk2)
|
||||||
bf.WriteUint16(event.Unk3)
|
bf.WriteUint16(event.Unk3)
|
||||||
bf.WriteUint16(event.Unk4)
|
bf.WriteUint16(event.Unk4)
|
||||||
bf.WriteUint32(event.StartTime)
|
bf.WriteUint32(event.Unk5)
|
||||||
bf.WriteUint32(event.EndTime)
|
bf.WriteUint32(event.Unk6)
|
||||||
if event.EventType == 2 {
|
if event.EventType == 2 {
|
||||||
bf.WriteUint8(uint8(len(event.QuestFileIDs)))
|
bf.WriteUint8(uint8(len(event.QuestFileIDs)))
|
||||||
for _, qf := range event.QuestFileIDs {
|
for _, qf := range event.QuestFileIDs {
|
||||||
|
|||||||
@@ -85,6 +85,10 @@ func BackportQuest(data []byte) []byte {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if _config.ErupeConfig.RealClientMode <= _config.S6 {
|
||||||
|
binary.LittleEndian.PutUint32(data[16:20], binary.LittleEndian.Uint32(data[8:12]))
|
||||||
|
}
|
||||||
return data
|
return data
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user