mirror of
https://github.com/Mezeporta/Erupe.git
synced 2025-12-14 07:55:33 +01:00
Merge branch 'ZeruLight:main' into main
This commit is contained in:
@@ -4,6 +4,7 @@ import (
|
||||
"erupe-ce/common/byteframe"
|
||||
ps "erupe-ce/common/pascalstring"
|
||||
"erupe-ce/common/stringsupport"
|
||||
_config "erupe-ce/config"
|
||||
"erupe-ce/network/mhfpacket"
|
||||
"time"
|
||||
)
|
||||
@@ -67,8 +68,10 @@ func handleMsgMhfEnumerateCampaign(s *Session, p mhfpacket.MHFPacket) {
|
||||
bf.WriteInt16(event.MaxHR)
|
||||
bf.WriteInt16(event.MinSR)
|
||||
bf.WriteInt16(event.MaxSR)
|
||||
bf.WriteInt16(event.MinGR)
|
||||
bf.WriteInt16(event.MaxGR)
|
||||
if _config.ErupeConfig.RealClientMode >= _config.G3 {
|
||||
bf.WriteInt16(event.MinGR)
|
||||
bf.WriteInt16(event.MaxGR)
|
||||
}
|
||||
bf.WriteUint16(event.Unk1)
|
||||
bf.WriteUint8(event.Unk2)
|
||||
bf.WriteUint8(event.Unk3)
|
||||
|
||||
@@ -49,14 +49,14 @@ func handleMsgMhfReleaseEvent(s *Session, p mhfpacket.MHFPacket) {
|
||||
}
|
||||
|
||||
type Event struct {
|
||||
Unk0 uint16
|
||||
Unk1 uint16
|
||||
Unk2 uint16
|
||||
Unk3 uint16
|
||||
Unk4 uint16
|
||||
Unk5 uint32
|
||||
Unk6 uint32
|
||||
Unk7 []uint16
|
||||
EventType uint16
|
||||
Unk1 uint16
|
||||
Unk2 uint16
|
||||
Unk3 uint16
|
||||
Unk4 uint16
|
||||
Unk5 uint32
|
||||
Unk6 uint32
|
||||
QuestFileIDs []uint16
|
||||
}
|
||||
|
||||
func handleMsgMhfEnumerateEvent(s *Session, p mhfpacket.MHFPacket) {
|
||||
@@ -67,17 +67,17 @@ func handleMsgMhfEnumerateEvent(s *Session, p mhfpacket.MHFPacket) {
|
||||
|
||||
bf.WriteUint8(uint8(len(events)))
|
||||
for _, event := range events {
|
||||
bf.WriteUint16(event.Unk0)
|
||||
bf.WriteUint16(event.EventType)
|
||||
bf.WriteUint16(event.Unk1)
|
||||
bf.WriteUint16(event.Unk2)
|
||||
bf.WriteUint16(event.Unk3)
|
||||
bf.WriteUint16(event.Unk4)
|
||||
bf.WriteUint32(event.Unk5)
|
||||
bf.WriteUint32(event.Unk6)
|
||||
if event.Unk0 == 2 {
|
||||
bf.WriteUint8(uint8(len(event.Unk7)))
|
||||
for _, u := range event.Unk7 {
|
||||
bf.WriteUint16(u)
|
||||
if event.EventType == 2 {
|
||||
bf.WriteUint8(uint8(len(event.QuestFileIDs)))
|
||||
for _, qf := range event.QuestFileIDs {
|
||||
bf.WriteUint16(qf)
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -123,24 +123,24 @@ func handleMsgMhfGetWeeklySchedule(s *Session, p mhfpacket.MHFPacket) {
|
||||
}
|
||||
|
||||
func generateFeatureWeapons(count int) activeFeature {
|
||||
max := 14
|
||||
_max := 14
|
||||
if _config.ErupeConfig.RealClientMode < _config.ZZ {
|
||||
max = 13
|
||||
_max = 13
|
||||
}
|
||||
if _config.ErupeConfig.RealClientMode < _config.G10 {
|
||||
max = 12
|
||||
_max = 12
|
||||
}
|
||||
if _config.ErupeConfig.RealClientMode < _config.GG {
|
||||
max = 11
|
||||
_max = 11
|
||||
}
|
||||
if count > max {
|
||||
count = max
|
||||
if count > _max {
|
||||
count = _max
|
||||
}
|
||||
nums := make([]int, 0)
|
||||
var result int
|
||||
for len(nums) < count {
|
||||
rng := token.RNG()
|
||||
num := rng.Intn(max)
|
||||
num := rng.Intn(_max)
|
||||
exist := false
|
||||
for _, v := range nums {
|
||||
if v == num {
|
||||
|
||||
@@ -660,6 +660,27 @@ func handleMsgMhfEnumerateQuest(s *Session, p mhfpacket.MHFPacket) {
|
||||
|
||||
offset := uint16(time.Now().Unix())
|
||||
bf.WriteUint16(offset)
|
||||
|
||||
if _config.ErupeConfig.RealClientMode <= _config.F5 {
|
||||
tuneValues = tuneValues[:256]
|
||||
} else if _config.ErupeConfig.RealClientMode <= _config.G3 {
|
||||
tuneValues = tuneValues[:283]
|
||||
} else if _config.ErupeConfig.RealClientMode <= _config.GG {
|
||||
tuneValues = tuneValues[:315]
|
||||
} else if _config.ErupeConfig.RealClientMode <= _config.G61 {
|
||||
tuneValues = tuneValues[:332]
|
||||
} else if _config.ErupeConfig.RealClientMode <= _config.G7 {
|
||||
tuneValues = tuneValues[:339]
|
||||
} else if _config.ErupeConfig.RealClientMode <= _config.G81 {
|
||||
tuneValues = tuneValues[:396]
|
||||
} else if _config.ErupeConfig.RealClientMode <= _config.G91 {
|
||||
tuneValues = tuneValues[:694]
|
||||
} else if _config.ErupeConfig.RealClientMode <= _config.G101 {
|
||||
tuneValues = tuneValues[:704]
|
||||
} else if _config.ErupeConfig.RealClientMode <= _config.Z2 {
|
||||
tuneValues = tuneValues[:750]
|
||||
}
|
||||
|
||||
bf.WriteUint16(uint16(len(tuneValues)))
|
||||
for i := range tuneValues {
|
||||
bf.WriteUint16(tuneValues[i].ID ^ offset)
|
||||
|
||||
@@ -1,87 +0,0 @@
|
||||
package timeserver
|
||||
|
||||
import (
|
||||
"time"
|
||||
)
|
||||
|
||||
var DoOnce_midnight = false
|
||||
var DoOnce_t2 = false
|
||||
var DoOnce_t = false
|
||||
var Fix_midnight = time.Time{}
|
||||
var Fix_t2 = time.Time{}
|
||||
var Fix_t = time.Time{}
|
||||
var Pfixtimer time.Duration
|
||||
var Pnewtime = 0
|
||||
var yearsFixed = -7
|
||||
|
||||
func PFadd_time() time.Duration {
|
||||
Pnewtime = Pnewtime + 24
|
||||
Pfixtimer = time.Duration(Pnewtime)
|
||||
return Pfixtimer
|
||||
}
|
||||
|
||||
func Time_static() time.Time {
|
||||
if !DoOnce_t {
|
||||
DoOnce_t = true
|
||||
// Force to 201x
|
||||
tFix1 := time.Now()
|
||||
tFix2 := tFix1.AddDate(yearsFixed, 0, 0)
|
||||
Fix_t = tFix2.In(time.FixedZone("UTC+1", 1*60*60))
|
||||
}
|
||||
return Fix_t
|
||||
}
|
||||
|
||||
func Tstatic_midnight() time.Time {
|
||||
if !DoOnce_midnight {
|
||||
DoOnce_midnight = true
|
||||
// Force to 201x
|
||||
tFix1 := time.Now()
|
||||
tFix2 := tFix1.AddDate(yearsFixed, 0, 0)
|
||||
var tFix = tFix2.In(time.FixedZone("UTC+1", 1*60*60))
|
||||
yearFix, monthFix, dayFix := tFix2.Date()
|
||||
Fix_midnight = time.Date(yearFix, monthFix, dayFix, 0, 0, 0, 0, tFix.Location()).Add(time.Hour)
|
||||
}
|
||||
return Fix_midnight
|
||||
}
|
||||
|
||||
func Time_midnight() time.Time {
|
||||
// Force to 201x
|
||||
t1 := time.Now()
|
||||
t2 := t1.AddDate(yearsFixed, 0, 0)
|
||||
var t = t2.In(time.FixedZone("UTC+1", 1*60*60))
|
||||
year, month, day := t2.Date()
|
||||
midnight := time.Date(year, month, day, 0, 0, 0, 0, t.Location()).Add(time.Hour)
|
||||
return midnight
|
||||
}
|
||||
|
||||
func TimeCurrent() time.Time {
|
||||
// Force to 201x
|
||||
t1 := time.Now()
|
||||
t2 := t1.AddDate(yearsFixed, 0, 0)
|
||||
var t = t2.In(time.FixedZone("UTC+1", 1*60*60))
|
||||
return t
|
||||
}
|
||||
|
||||
func Time_Current_Week_uint8() uint8 {
|
||||
beginningOfTheMonth := time.Date(TimeCurrent().Year(), TimeCurrent().Month(), 1, 1, 1, 1, 1, time.UTC)
|
||||
_, thisWeek := TimeCurrent().ISOWeek()
|
||||
_, beginningWeek := beginningOfTheMonth.ISOWeek()
|
||||
|
||||
return uint8(1 + thisWeek - beginningWeek)
|
||||
}
|
||||
|
||||
func Time_Current_Week_uint32() uint32 {
|
||||
beginningOfTheMonth := time.Date(TimeCurrent().Year(), TimeCurrent().Month(), 1, 1, 1, 1, 1, time.UTC)
|
||||
_, thisWeek := TimeCurrent().ISOWeek()
|
||||
_, beginningWeek := beginningOfTheMonth.ISOWeek()
|
||||
result := 1 + thisWeek - beginningWeek
|
||||
return uint32(result)
|
||||
}
|
||||
|
||||
func Detect_Day() bool {
|
||||
switch time.Now().Weekday() {
|
||||
case time.Wednesday:
|
||||
return true
|
||||
}
|
||||
return false
|
||||
}
|
||||
Reference in New Issue
Block a user