mirror of
https://github.com/Mezeporta/Erupe.git
synced 2025-12-15 08:25:09 +01:00
Merge pull request #1 from Ellie42/fix-full-party-bug
Add a quick fix to allow partying with 4 players
This commit is contained in:
@@ -646,7 +646,12 @@ func handleMsgSysReserveStage(s *Session, p mhfpacket.MHFPacket) {
|
||||
stage.Lock()
|
||||
defer stage.Unlock()
|
||||
|
||||
if uint16(len(stage.reservedClientSlots)) < stage.maxPlayers {
|
||||
// Quick fix to allow readying up while party is full, more investigation needed
|
||||
// Reserve stage is also sent when a player is ready, probably need to parse the
|
||||
// request a little more thoroughly.
|
||||
if _, exists := stage.reservedClientSlots[s.charID]; exists {
|
||||
s.QueueAck(pkt.AckHandle, []byte{0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00})
|
||||
} else if uint16(len(stage.reservedClientSlots)) < stage.maxPlayers {
|
||||
// Add the charID to the stage's reservation map
|
||||
stage.reservedClientSlots[s.charID] = nil
|
||||
|
||||
@@ -1338,9 +1343,9 @@ func handleMsgMhfEntryRookieGuild(s *Session, p mhfpacket.MHFPacket) {}
|
||||
func handleMsgMhfEnumerateQuest(s *Session, p mhfpacket.MHFPacket) {
|
||||
// local files are easier for now, probably best would be to generate dynamically
|
||||
pkt := p.(*mhfpacket.MsgMhfEnumerateQuest)
|
||||
data, err := ioutil.ReadFile(filepath.Join(s.server.erupeConfig.BinPath, fmt.Sprintf("questlists/list_%d.bin",pkt.QuestList)))
|
||||
data, err := ioutil.ReadFile(filepath.Join(s.server.erupeConfig.BinPath, fmt.Sprintf("questlists/list_%d.bin", pkt.QuestList)))
|
||||
if err != nil {
|
||||
fmt.Printf("questlists/list_%d.bin",pkt.QuestList)
|
||||
fmt.Printf("questlists/list_%d.bin", pkt.QuestList)
|
||||
stubEnumerateNoResults(s, pkt.AckHandle)
|
||||
} else {
|
||||
doSizedAckResp(s, pkt.AckHandle, data)
|
||||
@@ -1415,7 +1420,7 @@ func handleMsgMhfEnumerateShop(s *Session, p mhfpacket.MHFPacket) {
|
||||
stubEnumerateNoResults(s, pkt.AckHandle)
|
||||
} else if pkt.ShopType == 7 {
|
||||
// GCP conversion store
|
||||
if pkt.ShopID == 0{
|
||||
if pkt.ShopID == 0 {
|
||||
// Items to GCP exchange. Gou Tickets, Shiten Tickets, GP Tickets
|
||||
data, _ := hex.DecodeString("000300033a9186fb000033860000000a000100000000000000000000000000000000097fdb1c0000067e0000000a0001000000000000000000000000000000001374db29000027c300000064000100000000000000000000000000000000")
|
||||
doSizedAckResp(s, pkt.AckHandle, data)
|
||||
@@ -1425,7 +1430,7 @@ func handleMsgMhfEnumerateShop(s *Session, p mhfpacket.MHFPacket) {
|
||||
} else if pkt.ShopType == 8 {
|
||||
// Dive Defense sections
|
||||
// 00 = normal level limited exchange store, 05 = GCP skill store, 07 = limited quantity exchange
|
||||
if pkt.ShopID == 5{
|
||||
if pkt.ShopID == 5 {
|
||||
// diva defense skill level limited store
|
||||
data, _ := hex.DecodeString("001f001f2c9365c1000000010000001e000a0000000000000000000a0000000000001979f1c2000000020000003c000a0000000000000000000a0000000000003e5197df000000030000003c000a0000000000000000000a000000000000219337c0000000040000001e000a0000000000000000000a00000000000009b24c9d000000140000001e000a0000000000000000000a0000000000001f1d496e000000150000001e000a0000000000000000000a0000000000003b918fcb000000160000003c000a0000000000000000000a0000000000000b7fd81c000000170000003c000a0000000000000000000a0000000000001374f239000000180000003c000a0000000000000000000a00000000000026950cba0000001c0000003c000a0000000000000000000a0000000000003797eae70000001d0000003c000a012b000000000000000a00000000000015758ad8000000050000003c00000000000000000000000a0000000000003c7035050000000600000050000a0000000000000001000a00000000000024f3b5560000000700000050000a0000000000000001000a00000000000000b600330000000800000050000a0000000000000001000a0000000000002efdce840000001900000050000a0000000000000001000a0000000000002d9365f10000001a00000050000a0000000000000001000a0000000000001979f3420000001f00000050000a012b000000000001000a0000000000003f5397cf0000002000000050000a012b000000000001000a000000000000319337c00000002100000050000a012b000000000001000a00000000000008b04cbd0000000900000064000a0000000000000002000a0000000000000b1d4b6e0000000a00000064000a0000000000000002000a0000000000003b918feb0000000b00000064000a0000000000000002000a0000000000001b7fd81c0000000c00000064000a0000000000000002000a0000000000001276f2290000000d00000064000a0000000000000002000a00000000000022950cba0000000e000000c8000a0000000000000002000a0000000000003697ead70000000f000001f4000a0000000000000003000a00000000000005758a5800000010000003e8000a0000000000000003000a0000000000003c7035250000001b000001f4000a0000000000010003000a00000000000034f3b5d60000001e00000064000a012b000000000003000a00000000000000b600030000002200000064000a0000000000010003000a000000000000")
|
||||
doSizedAckResp(s, pkt.AckHandle, data)
|
||||
@@ -1703,7 +1708,7 @@ func handleMsgMhfGetWeeklySchedule(s *Session, p mhfpacket.MHFPacket) {
|
||||
pkt := p.(*mhfpacket.MsgMhfGetWeeklySchedule)
|
||||
//japanese timestamps as client needs to be in japanese locale
|
||||
var t = time.Now().In(time.FixedZone("UTC+9", 9*60*60))
|
||||
year,month,day := t.Date()
|
||||
year, month, day := t.Date()
|
||||
midnight := time.Date(year, month, day, 0, 0, 0, 0, t.Location()).Add(time.Hour)
|
||||
// ActiveFeatures is a bit field, 0x3FFF is all 14 active features.
|
||||
// Long term it should probably be made persistent and simply cycle a couple daily
|
||||
@@ -1714,7 +1719,7 @@ func handleMsgMhfGetWeeklySchedule(s *Session, p mhfpacket.MHFPacket) {
|
||||
Unk1 uint16
|
||||
}{
|
||||
{
|
||||
StartTime: midnight.Add(-24*time.Hour), // midnight of previous day.
|
||||
StartTime: midnight.Add(-24 * time.Hour), // midnight of previous day.
|
||||
ActiveFeatures: 0x3FFF,
|
||||
Unk1: 0,
|
||||
},
|
||||
@@ -1724,7 +1729,7 @@ func handleMsgMhfGetWeeklySchedule(s *Session, p mhfpacket.MHFPacket) {
|
||||
Unk1: 0,
|
||||
},
|
||||
{
|
||||
StartTime: midnight.Add(24*time.Hour), // midnight of following day.
|
||||
StartTime: midnight.Add(24 * time.Hour), // midnight of following day.
|
||||
ActiveFeatures: 0x3FFF,
|
||||
Unk1: 0,
|
||||
},
|
||||
@@ -1732,7 +1737,7 @@ func handleMsgMhfGetWeeklySchedule(s *Session, p mhfpacket.MHFPacket) {
|
||||
|
||||
resp := byteframe.NewByteFrame()
|
||||
resp.WriteUint8(uint8(len(eventSchedules))) // Entry count, client only parses the first 7 or 8.
|
||||
resp.WriteUint32(uint32(t.Add(-5*time.Minute).Unix())) // 5 minutes ago server time
|
||||
resp.WriteUint32(uint32(t.Add(-5 * time.Minute).Unix())) // 5 minutes ago server time
|
||||
for _, es := range eventSchedules {
|
||||
resp.WriteUint32(uint32(es.StartTime.Unix()))
|
||||
resp.WriteUint32(es.ActiveFeatures)
|
||||
@@ -2261,7 +2266,7 @@ func handleMsgMhfPostGemInfo(s *Session, p mhfpacket.MHFPacket) {}
|
||||
func handleMsgMhfGetEarthValue(s *Session, p mhfpacket.MHFPacket) {
|
||||
pkt := p.(*mhfpacket.MsgMhfGetEarthValue)
|
||||
var earthValues []struct{ Unk0, Unk1, Unk2, Unk3, Unk4, Unk5 uint32 }
|
||||
if pkt.ReqType == 3{
|
||||
if pkt.ReqType == 3 {
|
||||
earthValues = []struct {
|
||||
Unk0, Unk1, Unk2, Unk3, Unk4, Unk5 uint32
|
||||
}{
|
||||
@@ -2280,7 +2285,7 @@ func handleMsgMhfGetEarthValue(s *Session, p mhfpacket.MHFPacket) {
|
||||
Unk2: 0x012C,
|
||||
},
|
||||
}
|
||||
} else if pkt.ReqType == 2{
|
||||
} else if pkt.ReqType == 2 {
|
||||
earthValues = []struct {
|
||||
Unk0, Unk1, Unk2, Unk3, Unk4, Unk5 uint32
|
||||
}{
|
||||
@@ -2294,7 +2299,7 @@ func handleMsgMhfGetEarthValue(s *Session, p mhfpacket.MHFPacket) {
|
||||
Unk1: 0x0737,
|
||||
},
|
||||
}
|
||||
}else if pkt.ReqType == 1{
|
||||
} else if pkt.ReqType == 1 {
|
||||
earthValues = []struct {
|
||||
Unk0, Unk1, Unk2, Unk3, Unk4, Unk5 uint32
|
||||
}{
|
||||
@@ -2581,19 +2586,19 @@ func handleMsgMhfUseKeepLoginBoost(s *Session, p mhfpacket.MHFPacket) {}
|
||||
func handleMsgMhfGetUdSchedule(s *Session, p mhfpacket.MHFPacket) {
|
||||
pkt := p.(*mhfpacket.MsgMhfGetUdSchedule)
|
||||
var t = time.Now().In(time.FixedZone("UTC+9", 9*60*60))
|
||||
year,month,day := t.Date()
|
||||
year, month, day := t.Date()
|
||||
midnight := time.Date(year, month, day, 0, 0, 0, 0, t.Location()).Add(time.Hour)
|
||||
// Events with time limits are Festival with Sign up, Soul Week and Winners Weeks
|
||||
// Diva Defense with Prayer, Interception and Song weeks
|
||||
// Mezeporta Festival with simply 'available' being a weekend thing
|
||||
resp := byteframe.NewByteFrame()
|
||||
resp.WriteUint32(0x1d5fda5c) // Unk (1d5fda5c, 0b5397df)
|
||||
resp.WriteUint32(uint32(midnight.Add(-24*21*time.Hour).Unix())) // Week 1 Timestamp, Festi start?
|
||||
resp.WriteUint32(uint32(midnight.Add(-24*14*time.Hour).Unix())) // Week 2 Timestamp
|
||||
resp.WriteUint32(uint32(midnight.Add(-24*14*time.Hour).Unix())) // Week 2 Timestamp
|
||||
resp.WriteUint32(uint32(midnight.Add(24*7*time.Hour).Unix())) // Diva Defense Interception
|
||||
resp.WriteUint32(uint32(midnight.Add(24*7*time.Hour).Unix())) // Diva Defense Interception
|
||||
resp.WriteUint32(uint32(midnight.Add(24*14*time.Hour).Unix())) // Diva Defense Greeting Song
|
||||
resp.WriteUint32(uint32(midnight.Add(-24 * 21 * time.Hour).Unix())) // Week 1 Timestamp, Festi start?
|
||||
resp.WriteUint32(uint32(midnight.Add(-24 * 14 * time.Hour).Unix())) // Week 2 Timestamp
|
||||
resp.WriteUint32(uint32(midnight.Add(-24 * 14 * time.Hour).Unix())) // Week 2 Timestamp
|
||||
resp.WriteUint32(uint32(midnight.Add(24 * 7 * time.Hour).Unix())) // Diva Defense Interception
|
||||
resp.WriteUint32(uint32(midnight.Add(24 * 7 * time.Hour).Unix())) // Diva Defense Interception
|
||||
resp.WriteUint32(uint32(midnight.Add(24 * 14 * time.Hour).Unix())) // Diva Defense Greeting Song
|
||||
resp.WriteUint16(0x19) // Unk
|
||||
resp.WriteUint16(0x2d) // Unk
|
||||
resp.WriteUint16(0x02) // Unk
|
||||
@@ -2865,7 +2870,7 @@ func handleMsgMhfGetUdTacticsPoint(s *Session, p mhfpacket.MHFPacket) {
|
||||
}
|
||||
|
||||
func handleMsgMhfAddUdTacticsPoint(s *Session, p mhfpacket.MHFPacket) {
|
||||
pkt := p.(*mhfpacket.MsgMhfAddUdTacticsPoint)
|
||||
pkt := p.(*mhfpacket.MsgMhfAddUdTacticsPoint)
|
||||
stubEnumerateNoResults(s, pkt.AckHandle)
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user