mirror of
https://github.com/Mezeporta/Erupe.git
synced 2026-02-04 17:22:16 +01:00
Removed EarthStatus for Event System
This commit is contained in:
@@ -23,8 +23,7 @@
|
|||||||
|
|
||||||
"AutoCreateAccount": true,
|
"AutoCreateAccount": true,
|
||||||
"DefaultCourses": [1, 23, 24],
|
"DefaultCourses": [1, 23, 24],
|
||||||
"EarthStatus": 0,
|
"EarthDebug":true,
|
||||||
"EarthID": 0,
|
|
||||||
"EarthMonsters": [116, 107, 2, 36],
|
"EarthMonsters": [116, 107, 2, 36],
|
||||||
"SaveDumps": {
|
"SaveDumps": {
|
||||||
"Enabled": true,
|
"Enabled": true,
|
||||||
|
|||||||
@@ -82,8 +82,7 @@ type Config struct {
|
|||||||
CommandPrefix string // The prefix for commands
|
CommandPrefix string // The prefix for commands
|
||||||
AutoCreateAccount bool // Automatically create accounts if they don't exist
|
AutoCreateAccount bool // Automatically create accounts if they don't exist
|
||||||
DefaultCourses []uint16
|
DefaultCourses []uint16
|
||||||
EarthStatus int32
|
EarthDebug bool
|
||||||
EarthID int32
|
|
||||||
EarthMonsters []int32
|
EarthMonsters []int32
|
||||||
SaveDumps SaveDumpOptions
|
SaveDumps SaveDumpOptions
|
||||||
Screenshots ScreenshotsOptions
|
Screenshots ScreenshotsOptions
|
||||||
|
|||||||
@@ -2,6 +2,7 @@ package mhfpacket
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
"errors"
|
"errors"
|
||||||
|
"fmt"
|
||||||
|
|
||||||
"erupe-ce/common/byteframe"
|
"erupe-ce/common/byteframe"
|
||||||
"erupe-ce/network"
|
"erupe-ce/network"
|
||||||
@@ -31,6 +32,8 @@ func (m *MsgMhfPostTinyBin) Parse(bf *byteframe.ByteFrame, ctx *clientctx.Client
|
|||||||
m.Unk2 = bf.ReadUint8()
|
m.Unk2 = bf.ReadUint8()
|
||||||
m.Unk3 = bf.ReadUint8()
|
m.Unk3 = bf.ReadUint8()
|
||||||
m.Data = bf.ReadBytes(uint(bf.ReadUint16()))
|
m.Data = bf.ReadBytes(uint(bf.ReadUint16()))
|
||||||
|
fmt.Printf("MsgMhfPostTinyBin: Unk0:[%d] Unk1:[%d] Unk2:[%d] Unk3:[%d] \n\n", m.Unk0, m.Unk1, m.Unk2, m.Unk3)
|
||||||
|
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -20,7 +20,7 @@ type MsgMhfPostTowerInfo struct {
|
|||||||
Unk6 int32
|
Unk6 int32
|
||||||
Unk7 int32
|
Unk7 int32
|
||||||
Block1 int32
|
Block1 int32
|
||||||
Unk9 int64
|
TimeTaken int64
|
||||||
}
|
}
|
||||||
|
|
||||||
// Opcode returns the ID associated with this packet type.
|
// Opcode returns the ID associated with this packet type.
|
||||||
@@ -40,7 +40,7 @@ func (m *MsgMhfPostTowerInfo) Parse(bf *byteframe.ByteFrame, ctx *clientctx.Clie
|
|||||||
m.Unk6 = bf.ReadInt32()
|
m.Unk6 = bf.ReadInt32()
|
||||||
m.Unk7 = bf.ReadInt32()
|
m.Unk7 = bf.ReadInt32()
|
||||||
m.Block1 = bf.ReadInt32()
|
m.Block1 = bf.ReadInt32()
|
||||||
m.Unk9 = bf.ReadInt64()
|
m.TimeTaken = bf.ReadInt64()
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -10,6 +10,7 @@ import (
|
|||||||
_config "erupe-ce/config"
|
_config "erupe-ce/config"
|
||||||
"fmt"
|
"fmt"
|
||||||
"io"
|
"io"
|
||||||
|
"log"
|
||||||
"net"
|
"net"
|
||||||
"strings"
|
"strings"
|
||||||
"time"
|
"time"
|
||||||
@@ -32,7 +33,7 @@ func stubEnumerateNoResults(s *Session, ackHandle uint32) {
|
|||||||
|
|
||||||
func doAckEarthSucceed(s *Session, ackHandle uint32, data []*byteframe.ByteFrame) {
|
func doAckEarthSucceed(s *Session, ackHandle uint32, data []*byteframe.ByteFrame) {
|
||||||
bf := byteframe.NewByteFrame()
|
bf := byteframe.NewByteFrame()
|
||||||
bf.WriteUint32(uint32(s.server.erupeConfig.EarthID))
|
bf.WriteUint32(0)
|
||||||
bf.WriteUint32(0)
|
bf.WriteUint32(0)
|
||||||
bf.WriteUint32(0)
|
bf.WriteUint32(0)
|
||||||
bf.WriteUint32(uint32(len(data)))
|
bf.WriteUint32(uint32(len(data)))
|
||||||
@@ -1088,14 +1089,130 @@ func handleMsgMhfUnreserveSrg(s *Session, p mhfpacket.MHFPacket) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func handleMsgMhfKickExportForce(s *Session, p mhfpacket.MHFPacket) {}
|
func handleMsgMhfKickExportForce(s *Session, p mhfpacket.MHFPacket) {}
|
||||||
|
func cleanupEarthStatus(s *Session) {
|
||||||
|
s.server.db.Exec("DELETE FROM events WHERE event_type='tower'")
|
||||||
|
s.server.db.Exec("DELETE FROM events WHERE event_type='pallone'")
|
||||||
|
s.server.db.Exec("DELETE FROM events WHERE event_type='conquest'")
|
||||||
|
|
||||||
|
}
|
||||||
|
func generateEarthStatusTimestamps(s *Session, start uint32, debug bool) []uint32 {
|
||||||
|
timestamps := make([]uint32, 3)
|
||||||
|
midnight := TimeMidnight()
|
||||||
|
if start == 0 || TimeAdjusted().Unix() > int64(start)+2977200 {
|
||||||
|
cleanupEarthStatus(s)
|
||||||
|
// Generate a new festa, starting midnight tomorrow
|
||||||
|
start = uint32(midnight.Add(24 * time.Hour).Unix())
|
||||||
|
s.server.db.Exec("INSERT INTO events (event_type, start_time) VALUES ('tower', to_timestamp($1)::timestamp without time zone)", start)
|
||||||
|
}
|
||||||
|
if debug {
|
||||||
|
timestamps[0] = uint32(TimeWeekStart().Unix())
|
||||||
|
timestamps[1] = uint32(TimeWeekNext().Unix())
|
||||||
|
timestamps[1] = uint32(TimeWeekNext().Add((time.Duration(7) * time.Hour * 24)).Unix())
|
||||||
|
|
||||||
|
} else {
|
||||||
|
timestamps[0] = start
|
||||||
|
timestamps[1] = timestamps[0] + 604800
|
||||||
|
timestamps[2] = timestamps[1] + 604800
|
||||||
|
}
|
||||||
|
return timestamps
|
||||||
|
}
|
||||||
|
|
||||||
func handleMsgMhfGetEarthStatus(s *Session, p mhfpacket.MHFPacket) {
|
func handleMsgMhfGetEarthStatus(s *Session, p mhfpacket.MHFPacket) {
|
||||||
pkt := p.(*mhfpacket.MsgMhfGetEarthStatus)
|
pkt := p.(*mhfpacket.MsgMhfGetEarthStatus)
|
||||||
bf := byteframe.NewByteFrame()
|
bf := byteframe.NewByteFrame()
|
||||||
bf.WriteUint32(uint32(TimeWeekStart().Unix())) // Start
|
//Conquest
|
||||||
bf.WriteUint32(uint32(TimeWeekNext().Unix())) // End
|
var conquestTimestamps []uint32
|
||||||
bf.WriteInt32(s.server.erupeConfig.EarthStatus)
|
var debug = s.server.erupeConfig.EarthDebug
|
||||||
bf.WriteInt32(s.server.erupeConfig.EarthID)
|
conquestId, conquestStart := int32(0xBEEFEE), uint32(0)
|
||||||
|
rows, _ := s.server.db.Queryx("SELECT id, (EXTRACT(epoch FROM start_time)::int) as start_time FROM events WHERE event_type='conquest'")
|
||||||
|
if rows == nil {
|
||||||
|
log.Println("No rows found")
|
||||||
|
|
||||||
|
} else {
|
||||||
|
for rows.Next() {
|
||||||
|
rows.Scan(&conquestId, &conquestStart)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
conquestTimestamps = generateEarthStatusTimestamps(s, conquestStart, debug)
|
||||||
|
if TimeAdjusted().After(time.UnixMilli(int64(conquestTimestamps[1]))) {
|
||||||
|
bf.WriteUint32(conquestTimestamps[0]) // Start
|
||||||
|
bf.WriteUint32(conquestTimestamps[1]) // End
|
||||||
|
bf.WriteInt32(1) //Conquest Earth Status ID //1 and 2 UNK the difference
|
||||||
|
bf.WriteInt32(conquestId) //ID
|
||||||
|
} else {
|
||||||
|
bf.WriteUint32(conquestTimestamps[1]) // Start
|
||||||
|
bf.WriteUint32(conquestTimestamps[2]) // End
|
||||||
|
bf.WriteInt32(2) //Conquest Earth Status ID //1 and 2 UNK the difference
|
||||||
|
bf.WriteInt32(conquestId) //ID
|
||||||
|
}
|
||||||
|
for i, m := range s.server.erupeConfig.EarthMonsters {
|
||||||
|
//Changed from G9 to G8 to get conquest working in g9.1
|
||||||
|
if _config.ErupeConfig.RealClientMode <= _config.G8 {
|
||||||
|
if i == 3 {
|
||||||
|
break
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if i == 4 {
|
||||||
|
break
|
||||||
|
}
|
||||||
|
bf.WriteInt32(m)
|
||||||
|
}
|
||||||
|
//Pallone
|
||||||
|
var palloneTimestamps []uint32
|
||||||
|
palloneId, palloneStart := int32(0xBEEFEE), uint32(0)
|
||||||
|
rows, _ = s.server.db.Queryx("SELECT id, (EXTRACT(epoch FROM start_time)::int) as start_time FROM events WHERE event_type='pallone'")
|
||||||
|
|
||||||
|
if rows == nil {
|
||||||
|
log.Println("No rows found")
|
||||||
|
|
||||||
|
} else {
|
||||||
|
for rows.Next() {
|
||||||
|
rows.Scan(&palloneId, &palloneStart)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
palloneTimestamps = generateEarthStatusTimestamps(s, palloneStart, debug)
|
||||||
|
if TimeAdjusted().After(time.UnixMilli(int64(palloneTimestamps[1]))) {
|
||||||
|
bf.WriteUint32(palloneTimestamps[0]) // Start
|
||||||
|
bf.WriteUint32(palloneTimestamps[1]) // End
|
||||||
|
bf.WriteInt32(11) //Pallone Earth Status ID //11 is Fest //12 is Reward
|
||||||
|
bf.WriteInt32(palloneId) //ID
|
||||||
|
} else {
|
||||||
|
bf.WriteUint32(palloneTimestamps[1]) // Start
|
||||||
|
bf.WriteUint32(palloneTimestamps[2]) // End
|
||||||
|
bf.WriteInt32(12) //Pallone Earth Status ID //11 is Fest //12 is Reward
|
||||||
|
bf.WriteInt32(palloneId) //ID
|
||||||
|
}
|
||||||
|
|
||||||
|
for i, m := range s.server.erupeConfig.EarthMonsters {
|
||||||
|
//Changed from G9 to G8 to get conquest working in g9.1
|
||||||
|
if _config.ErupeConfig.RealClientMode <= _config.G8 {
|
||||||
|
if i == 3 {
|
||||||
|
break
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if i == 4 {
|
||||||
|
break
|
||||||
|
}
|
||||||
|
bf.WriteInt32(m)
|
||||||
|
}
|
||||||
|
|
||||||
|
//TOWER
|
||||||
|
var towerTimestamps []uint32
|
||||||
|
towerId, towerStart := int32(0xBEEFEE), uint32(0)
|
||||||
|
rows, _ = s.server.db.Queryx("SELECT id, (EXTRACT(epoch FROM start_time)::int) as start_time FROM events WHERE event_type='tower'")
|
||||||
|
if rows == nil {
|
||||||
|
log.Println("No rows found")
|
||||||
|
|
||||||
|
} else {
|
||||||
|
for rows.Next() {
|
||||||
|
rows.Scan(&towerId, &towerStart)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
towerTimestamps = generateEarthStatusTimestamps(s, towerStart, debug)
|
||||||
|
bf.WriteUint32(towerTimestamps[0]) // Start
|
||||||
|
bf.WriteUint32(towerTimestamps[1]) // End
|
||||||
|
bf.WriteInt32(21) //Tower Earth Status ID
|
||||||
|
bf.WriteInt32(towerId) //ID
|
||||||
for i, m := range s.server.erupeConfig.EarthMonsters {
|
for i, m := range s.server.erupeConfig.EarthMonsters {
|
||||||
//Changed from G9 to G8 to get conquest working in g9.1
|
//Changed from G9 to G8 to get conquest working in g9.1
|
||||||
if _config.ErupeConfig.RealClientMode <= _config.G8 {
|
if _config.ErupeConfig.RealClientMode <= _config.G8 {
|
||||||
|
|||||||
@@ -4,6 +4,7 @@ import (
|
|||||||
"erupe-ce/common/mhfmon"
|
"erupe-ce/common/mhfmon"
|
||||||
"erupe-ce/common/stringsupport"
|
"erupe-ce/common/stringsupport"
|
||||||
_config "erupe-ce/config"
|
_config "erupe-ce/config"
|
||||||
|
|
||||||
"fmt"
|
"fmt"
|
||||||
"io"
|
"io"
|
||||||
"os"
|
"os"
|
||||||
@@ -1010,6 +1011,17 @@ func handleMsgMhfGetPaperData(s *Session, p mhfpacket.MHFPacket) {
|
|||||||
|
|
||||||
switch pkt.ID {
|
switch pkt.ID {
|
||||||
case 0:
|
case 0:
|
||||||
|
//PaperMissionData Target
|
||||||
|
// 1: Total Floors
|
||||||
|
// 2: TRP Acquired
|
||||||
|
// 3: Treasure Chests
|
||||||
|
// 4: Old Tresure Chests
|
||||||
|
// 5: Defeat Large Monster
|
||||||
|
// 6: Dist 1 Dure Slays
|
||||||
|
// 7: Dist 2 Dure Slays
|
||||||
|
// 8: Dist 3 Dure Slays
|
||||||
|
// 9: Dist 4 Dure Slays
|
||||||
|
|
||||||
paperMissions = PaperMission{
|
paperMissions = PaperMission{
|
||||||
[]PaperMissionTimetable{{TimeMidnight(), TimeMidnight().Add(24 * time.Hour)}},
|
[]PaperMissionTimetable{{TimeMidnight(), TimeMidnight().Add(24 * time.Hour)}},
|
||||||
[]PaperMissionData{{1, 1, 50, 7, 10, 8, 11},
|
[]PaperMissionData{{1, 1, 50, 7, 10, 8, 11},
|
||||||
@@ -1032,6 +1044,11 @@ func handleMsgMhfGetPaperData(s *Session, p mhfpacket.MHFPacket) {
|
|||||||
//Value is based in 6001 for items
|
//Value is based in 6001 for items
|
||||||
{1012, 1, 0, 0, 0, 0, 0},
|
{1012, 1, 0, 0, 0, 0, 0},
|
||||||
{1012, 2, 0, 0, 0, 0, 0},
|
{1012, 2, 0, 0, 0, 0, 0},
|
||||||
|
|
||||||
|
//Its possible that these also controll the annoucement banners and chat messages ...
|
||||||
|
// Functions to look at...
|
||||||
|
//tower_announce_move() -> disp_tower_announce()
|
||||||
|
// sendTowerVenomChatMsg()
|
||||||
}
|
}
|
||||||
case 5:
|
case 5:
|
||||||
//On load into MezePorta
|
//On load into MezePorta
|
||||||
|
|||||||
@@ -24,8 +24,15 @@ type TowerInfoSkill struct {
|
|||||||
}
|
}
|
||||||
|
|
||||||
type TowerInfoHistory struct {
|
type TowerInfoHistory struct {
|
||||||
Unk0 []int16 // 5
|
Unk0 TowerHistory // 5
|
||||||
Unk1 []int16 // 5
|
Unk1 TowerHistory // 5
|
||||||
|
}
|
||||||
|
type TowerHistory struct {
|
||||||
|
Unk0 int16
|
||||||
|
Unk1 int16
|
||||||
|
Unk2 int16
|
||||||
|
Unk3 int16
|
||||||
|
Unk4 int16
|
||||||
}
|
}
|
||||||
|
|
||||||
type TowerInfoLevel struct {
|
type TowerInfoLevel struct {
|
||||||
@@ -53,11 +60,25 @@ func handleMsgMhfGetTowerInfo(s *Session, p mhfpacket.MHFPacket) {
|
|||||||
Level []TowerInfoLevel
|
Level []TowerInfoLevel
|
||||||
}
|
}
|
||||||
|
|
||||||
|
history1 := TowerHistory{
|
||||||
|
Unk0: 1,
|
||||||
|
Unk1: 2,
|
||||||
|
Unk2: 3,
|
||||||
|
Unk3: 4,
|
||||||
|
Unk4: 5,
|
||||||
|
}
|
||||||
|
history2 := TowerHistory{
|
||||||
|
Unk0: 1,
|
||||||
|
Unk1: 2,
|
||||||
|
Unk2: 3,
|
||||||
|
Unk3: 4,
|
||||||
|
Unk4: 5,
|
||||||
|
}
|
||||||
towerInfo := TowerInfo{
|
towerInfo := TowerInfo{
|
||||||
TRP: []TowerInfoTRP{{0, 0}},
|
TRP: []TowerInfoTRP{{0, 0}},
|
||||||
Skill: []TowerInfoSkill{{0, make([]int16, 64)}},
|
Skill: []TowerInfoSkill{{0, make([]int16, 64)}},
|
||||||
History: []TowerInfoHistory{{make([]int16, 5), make([]int16, 5)}},
|
History: []TowerInfoHistory{{history1, history2}},
|
||||||
Level: []TowerInfoLevel{{0, 0, 0, 0}, {0, 0, 0, 0}},
|
Level: []TowerInfoLevel{{0, 5, 5, 5}, {0, 5, 5, 5}},
|
||||||
}
|
}
|
||||||
|
|
||||||
var tempSkills string
|
var tempSkills string
|
||||||
@@ -95,12 +116,17 @@ func handleMsgMhfGetTowerInfo(s *Session, p mhfpacket.MHFPacket) {
|
|||||||
case 4:
|
case 4:
|
||||||
for _, history := range towerInfo.History {
|
for _, history := range towerInfo.History {
|
||||||
bf := byteframe.NewByteFrame()
|
bf := byteframe.NewByteFrame()
|
||||||
for i := range history.Unk0 {
|
bf.WriteInt16(history.Unk0.Unk0)
|
||||||
bf.WriteInt16(history.Unk0[i])
|
bf.WriteInt16(history.Unk0.Unk1)
|
||||||
}
|
bf.WriteInt16(history.Unk0.Unk2)
|
||||||
for i := range history.Unk1 {
|
bf.WriteInt16(history.Unk0.Unk3)
|
||||||
bf.WriteInt16(history.Unk1[i])
|
bf.WriteInt16(history.Unk0.Unk4)
|
||||||
}
|
|
||||||
|
bf.WriteInt16(history.Unk1.Unk0)
|
||||||
|
bf.WriteInt16(history.Unk1.Unk1)
|
||||||
|
bf.WriteInt16(history.Unk1.Unk2)
|
||||||
|
bf.WriteInt16(history.Unk1.Unk3)
|
||||||
|
bf.WriteInt16(history.Unk1.Unk4)
|
||||||
data = append(data, bf)
|
data = append(data, bf)
|
||||||
}
|
}
|
||||||
case 3, 5:
|
case 3, 5:
|
||||||
@@ -131,7 +157,7 @@ func handleMsgMhfPostTowerInfo(s *Session, p mhfpacket.MHFPacket) {
|
|||||||
zap.Int32("Unk6", pkt.Unk6),
|
zap.Int32("Unk6", pkt.Unk6),
|
||||||
zap.Int32("Unk7", pkt.Unk7),
|
zap.Int32("Unk7", pkt.Unk7),
|
||||||
zap.Int32("Block1", pkt.Block1),
|
zap.Int32("Block1", pkt.Block1),
|
||||||
zap.Int64("Unk9", pkt.Unk9),
|
zap.Int64("TimeTaken", pkt.TimeTaken),
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user