18 Commits

Author SHA1 Message Date
stratic-dev
40b73baf75 Added conquest quests 2024-07-31 18:26:11 +01:00
stratic-dev
ed5489571b Init Conquest 2024-07-31 18:13:40 +01:00
stratic-dev
2d0cce719b Added seiabatu cross event pkt 2024-07-31 18:06:32 +01:00
stratic-dev
c6fdf47779 Added earth 2024-07-31 14:56:34 +01:00
wish
ae759be046 Merge pull request #126 from ZeruLight/fix/quest-stamps
fix/quest-stamps
2024-07-24 23:46:13 +10:00
wish
459f382dd7 simplify 2024-07-24 23:41:05 +10:00
wish
f545576fc9 merge changes 2024-07-24 23:33:04 +10:00
wish
4204ab1ecb Merge branch 'refs/heads/main' into fix/quest-stamps 2024-07-24 23:28:13 +10:00
wish
717d785342 fix possible warehouse error 2024-07-23 21:56:01 +10:00
wish
d29b7d00fc fix retro stamp rewards 2024-07-23 21:26:43 +10:00
wish
b755de269e add retro stamp rewards 2024-07-23 00:11:54 +10:00
wish
0ef3b08e86 Merge pull request #125 from ZeruLight/feature/ngword
feature/ngword
2024-07-22 23:47:49 +10:00
wish
aa5d95e7c5 fix sjis ngwords 2024-07-22 23:44:53 +10:00
wish
5de6570510 ascii working, sjis not working 2024-07-16 01:13:17 +10:00
wish
ca38f5671d ascii working, sjis not working 2024-07-16 01:12:02 +10:00
wish
632aa081b9 decode SMC table 2024-07-16 00:57:59 +10:00
wish
0caaeac3af initial ngword commit 2024-07-15 01:07:50 +10:00
wish
843b6a9dff fix quest stampcard 2024-03-17 16:39:06 +11:00
19 changed files with 1261 additions and 342 deletions

View File

@@ -29,6 +29,23 @@ func SJISToUTF8(b []byte) string {
return string(result)
}
func ToNGWord(x string) []uint16 {
var w []uint16
for _, r := range []rune(x) {
if r > 0xFF {
t := UTF8ToSJIS(string(r))
if len(t) > 1 {
w = append(w, uint16(t[1])<<8|uint16(t[0]))
} else {
w = append(w, uint16(t[0]))
}
} else {
w = append(w, uint16(r))
}
}
return w
}
func PaddedString(x string, size uint, t bool) []byte {
if t {
e := japanese.ShiftJIS.NewEncoder()

View File

@@ -22,9 +22,8 @@
"CommandPrefix": "!",
"AutoCreateAccount": true,
"DefaultCourses": [1, 23, 24],
"EarthStatus": 0,
"EarthID": 0,
"EarthMonsters": [0, 0, 0, 0],
"EarthDebug": false,
"EarthMonsters": [116, 107, 2, 36],
"SaveDumps": {
"Enabled": true,
"RawEnabled": false,

View File

@@ -82,8 +82,7 @@ type Config struct {
CommandPrefix string // The prefix for commands
AutoCreateAccount bool // Automatically create accounts if they don't exist
DefaultCourses []uint16
EarthStatus int32
EarthID int32
EarthDebug bool
EarthMonsters []int32
SaveDumps SaveDumpOptions
Screenshots ScreenshotsOptions

View File

@@ -1,18 +1,18 @@
package mhfpacket
import (
"errors"
import (
"errors"
"erupe-ce/common/byteframe"
"erupe-ce/network/clientctx"
"erupe-ce/network"
"erupe-ce/network/clientctx"
"erupe-ce/common/byteframe"
)
// MsgMhfEnumerateOrder represents the MSG_MHF_ENUMERATE_ORDER
type MsgMhfEnumerateOrder struct {
AckHandle uint32
EventID uint32
ClanID uint32
Unk0 uint32
Unk1 uint32
}
// Opcode returns the ID associated with this packet type.
@@ -23,8 +23,8 @@ func (m *MsgMhfEnumerateOrder) Opcode() network.PacketID {
// Parse parses the packet from binary
func (m *MsgMhfEnumerateOrder) Parse(bf *byteframe.ByteFrame, ctx *clientctx.ClientContext) error {
m.AckHandle = bf.ReadUint32()
m.EventID = bf.ReadUint32()
m.ClanID = bf.ReadUint32()
m.Unk0 = bf.ReadUint32()
m.Unk1 = bf.ReadUint32()
return nil
}

View File

@@ -2,6 +2,7 @@ package mhfpacket
import (
"errors"
"fmt"
"erupe-ce/common/byteframe"
"erupe-ce/network"
@@ -10,9 +11,9 @@ import (
// MsgMhfGetBreakSeibatuLevelReward represents the MSG_MHF_GET_BREAK_SEIBATU_LEVEL_REWARD
type MsgMhfGetBreakSeibatuLevelReward struct {
AckHandle uint32
Unk0 uint32
Unk1 int32
AckHandle uint32
Unk0 uint32
EarthMonster int32
}
// Opcode returns the ID associated with this packet type.
@@ -24,7 +25,8 @@ func (m *MsgMhfGetBreakSeibatuLevelReward) Opcode() network.PacketID {
func (m *MsgMhfGetBreakSeibatuLevelReward) Parse(bf *byteframe.ByteFrame, ctx *clientctx.ClientContext) error {
m.AckHandle = bf.ReadUint32()
m.Unk0 = bf.ReadUint32()
m.Unk1 = bf.ReadInt32()
m.EarthMonster = bf.ReadInt32()
fmt.Printf("MsgMhfGetBreakSeibatuLevelReward: Unk0:[%d] EarthMonster:[%d] \n\n", m.Unk0, m.EarthMonster)
return nil
}

View File

@@ -2,6 +2,7 @@ package mhfpacket
import (
"errors"
"fmt"
"erupe-ce/common/byteframe"
"erupe-ce/network"
@@ -10,12 +11,12 @@ import (
// MsgMhfGetFixedSeibatuRankingTable represents the MSG_MHF_GET_FIXED_SEIBATU_RANKING_TABLE
type MsgMhfGetFixedSeibatuRankingTable struct {
AckHandle uint32
Unk0 uint32
Unk1 int32
Unk2 int32
Unk3 int32
Unk4 int32
AckHandle uint32
Unk0 uint32
Unk1 int32
EarthMonster int32
Unk3 int32
Unk4 int32
}
// Opcode returns the ID associated with this packet type.
@@ -28,9 +29,10 @@ func (m *MsgMhfGetFixedSeibatuRankingTable) Parse(bf *byteframe.ByteFrame, ctx *
m.AckHandle = bf.ReadUint32()
m.Unk0 = bf.ReadUint32()
m.Unk1 = bf.ReadInt32()
m.Unk2 = bf.ReadInt32()
m.EarthMonster = bf.ReadInt32()
m.Unk3 = bf.ReadInt32()
m.Unk4 = bf.ReadInt32()
fmt.Printf("MsgMhfGetFixedSeibatuRankingTable: Unk0:[%d] Unk1:[%d] EarthMonster:[%d] Unk3:[%d] Unk4:[%d]\n\n", m.Unk0, m.Unk1, m.EarthMonster, m.Unk3, m.Unk4)
return nil
}

View File

@@ -2,6 +2,7 @@ package mhfpacket
import (
"errors"
"fmt"
"erupe-ce/common/byteframe"
"erupe-ce/network"
@@ -10,11 +11,11 @@ import (
// MsgMhfGetWeeklySeibatuRankingReward represents the MSG_MHF_GET_WEEKLY_SEIBATU_RANKING_REWARD
type MsgMhfGetWeeklySeibatuRankingReward struct {
AckHandle uint32
Unk0 uint32
Unk1 uint32
Unk2 uint32
Unk3 uint32
AckHandle uint32
Unk0 uint32
Operation uint32
ID uint32
EarthMonster uint32
}
// Opcode returns the ID associated with this packet type.
@@ -26,9 +27,10 @@ func (m *MsgMhfGetWeeklySeibatuRankingReward) Opcode() network.PacketID {
func (m *MsgMhfGetWeeklySeibatuRankingReward) Parse(bf *byteframe.ByteFrame, ctx *clientctx.ClientContext) error {
m.AckHandle = bf.ReadUint32()
m.Unk0 = bf.ReadUint32()
m.Unk1 = bf.ReadUint32()
m.Unk2 = bf.ReadUint32()
m.Unk3 = bf.ReadUint32()
m.Operation = bf.ReadUint32()
m.ID = bf.ReadUint32()
m.EarthMonster = bf.ReadUint32()
fmt.Printf("MsgMhfGetWeeklySeibatuRankingReward: Unk0:[%d] Operation:[%d] ID:[%d] EarthMonster:[%d]\n\n", m.Unk0, m.Operation, m.ID, m.EarthMonster)
return nil
}

View File

@@ -12,7 +12,7 @@ import (
type MsgMhfReadBeatLevelAllRanking struct {
AckHandle uint32
Unk0 uint32
GuildID int32
MonsterID int32
Unk2 int32
}
@@ -25,7 +25,7 @@ func (m *MsgMhfReadBeatLevelAllRanking) Opcode() network.PacketID {
func (m *MsgMhfReadBeatLevelAllRanking) Parse(bf *byteframe.ByteFrame, ctx *clientctx.ClientContext) error {
m.AckHandle = bf.ReadUint32()
m.Unk0 = bf.ReadUint32()
m.GuildID = bf.ReadInt32()
m.MonsterID = bf.ReadInt32()
m.Unk2 = bf.ReadInt32()
return nil
}

View File

@@ -2,6 +2,7 @@ package mhfpacket
import (
"errors"
"fmt"
"erupe-ce/common/byteframe"
"erupe-ce/network"
@@ -10,9 +11,9 @@ import (
// MsgMhfReadLastWeekBeatRanking represents the MSG_MHF_READ_LAST_WEEK_BEAT_RANKING
type MsgMhfReadLastWeekBeatRanking struct {
AckHandle uint32
Unk0 uint32
Unk1 int32
AckHandle uint32
Unk0 uint32
EarthMonster int32
}
// Opcode returns the ID associated with this packet type.
@@ -24,7 +25,9 @@ func (m *MsgMhfReadLastWeekBeatRanking) Opcode() network.PacketID {
func (m *MsgMhfReadLastWeekBeatRanking) Parse(bf *byteframe.ByteFrame, ctx *clientctx.ClientContext) error {
m.AckHandle = bf.ReadUint32()
m.Unk0 = bf.ReadUint32()
m.Unk1 = bf.ReadInt32()
m.EarthMonster = bf.ReadInt32()
fmt.Printf("MsgMhfGetFixedSeibatuRankingTable: Unk0:[%d] EarthMonster:[%d] \n\n", m.Unk0, m.EarthMonster)
return nil
}

View File

@@ -37,13 +37,16 @@ func (m *MsgMhfStampcardStamp) Parse(bf *byteframe.ByteFrame, ctx *clientctx.Cli
}
m.Stamps = bf.ReadUint16()
bf.ReadUint16() // Zeroed
if _config.ErupeConfig.RealClientMode > _config.Z1 {
if _config.ErupeConfig.RealClientMode >= _config.Z2 {
m.Reward1 = uint16(bf.ReadUint32())
m.Reward2 = uint16(bf.ReadUint32())
m.Item1 = uint16(bf.ReadUint32())
m.Item2 = uint16(bf.ReadUint32())
m.Quantity1 = uint16(bf.ReadUint32())
m.Quantity2 = uint16(bf.ReadUint32())
} else {
m.Reward1 = 10
m.Reward2 = 10
}
return nil
}

View File

@@ -0,0 +1,9 @@
BEGIN;
INSERT INTO public.event_quests (max_players, quest_type, quest_id, mark) VALUES
(0,33,54257,0),
(0,33,54258,0),
(0,33,54277,0),
(0,33,54370,0);
END;

View File

@@ -0,0 +1,6 @@
BEGIN;
-- Add 'earth' to the event_type ENUM type
ALTER TYPE event_type ADD VALUE 'earth';
END;

View File

@@ -0,0 +1,5 @@
BEGIN;
ALTER TABLE public.characters ADD COLUMN IF NOT EXISTS conquest_data BYTEA;
END;

View File

@@ -30,18 +30,6 @@ func stubEnumerateNoResults(s *Session, ackHandle uint32) {
doAckBufSucceed(s, ackHandle, enumBf.Data())
}
func doAckEarthSucceed(s *Session, ackHandle uint32, data []*byteframe.ByteFrame) {
bf := byteframe.NewByteFrame()
bf.WriteUint32(uint32(s.server.erupeConfig.EarthID))
bf.WriteUint32(0)
bf.WriteUint32(0)
bf.WriteUint32(uint32(len(data)))
for i := range data {
bf.WriteBytes(data[i].Data())
}
doAckBufSucceed(s, ackHandle, bf.Data())
}
func doAckBufSucceed(s *Session, ackHandle uint32, data []byte) {
s.QueueSendMHF(&mhfpacket.MsgSysAck{
AckHandle: ackHandle,
@@ -811,6 +799,11 @@ func handleMsgMhfEnumeratePrice(s *Session, p mhfpacket.MHFPacket) {
doAckBufSucceed(s, pkt.AckHandle, bf.Data())
}
func handleMsgMhfEnumerateOrder(s *Session, p mhfpacket.MHFPacket) {
pkt := p.(*mhfpacket.MsgMhfEnumerateOrder)
stubEnumerateNoResults(s, pkt.AckHandle)
}
func handleMsgMhfGetExtraInfo(s *Session, p mhfpacket.MHFPacket) {}
func userGetItems(s *Session) []mhfitem.MHFItemStack {
@@ -1046,32 +1039,58 @@ func handleMsgMhfUpdateEtcPoint(s *Session, p mhfpacket.MHFPacket) {
func handleMsgMhfStampcardStamp(s *Session, p mhfpacket.MHFPacket) {
pkt := p.(*mhfpacket.MsgMhfStampcardStamp)
rewards := []struct {
HR uint16
Item1 uint16
Quantity1 uint16
Item2 uint16
Quantity2 uint16
}{
{0, 6164, 1, 6164, 2},
{50, 6164, 2, 6164, 3},
{100, 6164, 3, 5392, 1},
{300, 5392, 1, 5392, 3},
{999, 5392, 1, 5392, 4},
}
if _config.ErupeConfig.RealClientMode <= _config.Z1 {
for _, reward := range rewards {
if pkt.HR >= reward.HR {
pkt.Item1 = reward.Item1
pkt.Quantity1 = reward.Quantity1
pkt.Item2 = reward.Item2
pkt.Quantity2 = reward.Quantity2
}
}
}
bf := byteframe.NewByteFrame()
bf.WriteUint16(pkt.HR)
var stamps uint16
_ = s.server.db.QueryRow(`SELECT stampcard FROM characters WHERE id = $1`, s.charID).Scan(&stamps)
if _config.ErupeConfig.RealClientMode >= _config.G1 {
bf.WriteUint16(pkt.GR)
}
var stamps, rewardTier, rewardUnk uint16
reward := mhfitem.MHFItemStack{Item: mhfitem.MHFItem{}}
s.server.db.QueryRow(`UPDATE characters SET stampcard = stampcard + $1 WHERE id = $2 RETURNING stampcard`, pkt.Stamps, s.charID).Scan(&stamps)
bf.WriteUint16(stamps - pkt.Stamps)
bf.WriteUint16(stamps)
stamps += pkt.Stamps
bf.WriteUint16(stamps)
s.server.db.Exec(`UPDATE characters SET stampcard = $1 WHERE id = $2`, stamps, s.charID)
if stamps%30 == 0 {
bf.WriteUint16(2)
bf.WriteUint16(pkt.Reward2)
bf.WriteUint16(pkt.Item2)
bf.WriteUint16(pkt.Quantity2)
addWarehouseItem(s, mhfitem.MHFItemStack{Item: mhfitem.MHFItem{ItemID: pkt.Item2}, Quantity: pkt.Quantity2})
} else if stamps%15 == 0 {
bf.WriteUint16(1)
bf.WriteUint16(pkt.Reward1)
bf.WriteUint16(pkt.Item1)
bf.WriteUint16(pkt.Quantity1)
addWarehouseItem(s, mhfitem.MHFItemStack{Item: mhfitem.MHFItem{ItemID: pkt.Item1}, Quantity: pkt.Quantity1})
} else {
bf.WriteBytes(make([]byte, 8))
if stamps/30 > (stamps-pkt.Stamps)/30 {
rewardTier = 2
rewardUnk = pkt.Reward2
reward = mhfitem.MHFItemStack{Item: mhfitem.MHFItem{ItemID: pkt.Item2}, Quantity: pkt.Quantity2}
addWarehouseItem(s, reward)
} else if stamps/15 > (stamps-pkt.Stamps)/15 {
rewardTier = 1
rewardUnk = pkt.Reward1
reward = mhfitem.MHFItemStack{Item: mhfitem.MHFItem{ItemID: pkt.Item1}, Quantity: pkt.Quantity1}
addWarehouseItem(s, reward)
}
bf.WriteUint16(rewardTier)
bf.WriteUint16(rewardUnk)
bf.WriteUint16(reward.Item.ItemID)
bf.WriteUint16(reward.Quantity)
doAckBufSucceed(s, pkt.AckHandle, bf.Data())
}
@@ -1084,66 +1103,8 @@ func handleMsgMhfUnreserveSrg(s *Session, p mhfpacket.MHFPacket) {
func handleMsgMhfKickExportForce(s *Session, p mhfpacket.MHFPacket) {}
func handleMsgMhfGetEarthStatus(s *Session, p mhfpacket.MHFPacket) {
pkt := p.(*mhfpacket.MsgMhfGetEarthStatus)
bf := byteframe.NewByteFrame()
bf.WriteUint32(uint32(TimeWeekStart().Unix())) // Start
bf.WriteUint32(uint32(TimeWeekNext().Unix())) // End
bf.WriteInt32(s.server.erupeConfig.EarthStatus)
bf.WriteInt32(s.server.erupeConfig.EarthID)
for i, m := range s.server.erupeConfig.EarthMonsters {
if _config.ErupeConfig.RealClientMode <= _config.G9 {
if i == 3 {
break
}
}
if i == 4 {
break
}
bf.WriteInt32(m)
}
doAckBufSucceed(s, pkt.AckHandle, bf.Data())
}
func handleMsgMhfRegistSpabiTime(s *Session, p mhfpacket.MHFPacket) {}
func handleMsgMhfGetEarthValue(s *Session, p mhfpacket.MHFPacket) {
pkt := p.(*mhfpacket.MsgMhfGetEarthValue)
type EarthValues struct {
Value []uint32
}
var earthValues []EarthValues
switch pkt.ReqType {
case 1:
earthValues = []EarthValues{
{[]uint32{1, 312, 0, 0, 0, 0}},
{[]uint32{2, 99, 0, 0, 0, 0}},
}
case 2:
earthValues = []EarthValues{
{[]uint32{1, 5771, 0, 0, 0, 0}},
{[]uint32{2, 1847, 0, 0, 0, 0}},
}
case 3:
earthValues = []EarthValues{
{[]uint32{1001, 36, 0, 0, 0, 0}},
{[]uint32{9001, 3, 0, 0, 0, 0}},
{[]uint32{9002, 10, 300, 0, 0, 0}},
}
}
var data []*byteframe.ByteFrame
for _, i := range earthValues {
bf := byteframe.NewByteFrame()
for _, j := range i.Value {
bf.WriteUint32(j)
}
data = append(data, bf)
}
doAckEarthSucceed(s, pkt.AckHandle, data)
}
func handleMsgMhfDebugPostValue(s *Session, p mhfpacket.MHFPacket) {}
func handleMsgMhfGetRandFromTable(s *Session, p mhfpacket.MHFPacket) {

View File

@@ -0,0 +1,173 @@
package channelserver
import (
"erupe-ce/common/byteframe"
_config "erupe-ce/config"
"erupe-ce/network/mhfpacket"
"log"
"time"
)
func doAckEarthSucceed(s *Session, ackHandle uint32, data []*byteframe.ByteFrame) {
bf := byteframe.NewByteFrame()
bf.WriteUint32(0)
bf.WriteUint32(0)
bf.WriteUint32(0)
bf.WriteUint32(uint32(len(data)))
for i := range data {
bf.WriteBytes(data[i].Data())
}
doAckBufSucceed(s, ackHandle, bf.Data())
}
func handleMsgMhfGetEarthValue(s *Session, p mhfpacket.MHFPacket) {
pkt := p.(*mhfpacket.MsgMhfGetEarthValue)
type EarthValues struct {
Value []uint32
}
var earthValues []EarthValues
switch pkt.ReqType {
case 1:
earthValues = []EarthValues{
// {Block, DureSlays, Unk, Unk, Unk, Unk}
{[]uint32{1, 100, 0, 0, 0, 0}},
{[]uint32{2, 100, 0, 0, 0, 0}},
}
case 2:
earthValues = []EarthValues{
// {Block, Floors?, Unk, Unk, Unk, Unk}
{[]uint32{1, 5771, 0, 0, 0, 0}},
{[]uint32{2, 1847, 0, 0, 0, 0}},
}
case 3:
earthValues = []EarthValues{
{[]uint32{1001, 36, 0, 0, 0, 0}}, //getTouhaHistory
{[]uint32{9001, 3, 0, 0, 0, 0}}, //getKohouhinDropStopFlag // something to do with ttcSetDisableFlag?
{[]uint32{9002, 10, 300, 0, 0, 0}}, //getKohouhinForceValue
}
}
var data []*byteframe.ByteFrame
for _, i := range earthValues {
bf := byteframe.NewByteFrame()
for _, j := range i.Value {
bf.WriteUint32(j)
}
data = append(data, bf)
}
doAckEarthSucceed(s, pkt.AckHandle, data)
}
func cleanupEarthStatus(s *Session) {
s.server.db.Exec(`DELETE FROM events WHERE event_type='earth'`)
s.server.db.Exec(`UPDATE characters SET conquest_data=NULL`)
}
func generateEarthStatusTimestamps(s *Session, start uint32, debug bool) []uint32 {
timestamps := make([]uint32, 4)
midnight := TimeMidnight()
if start == 0 || TimeAdjusted().Unix() > int64(start)+1814400 {
cleanupEarthStatus(s)
start = uint32(midnight.Add(24 * time.Hour).Unix())
s.server.db.Exec("INSERT INTO events (event_type, start_time) VALUES ('earth', to_timestamp($1)::timestamp without time zone)", start)
}
if debug {
timestamps[0] = uint32(TimeWeekStart().Unix())
timestamps[1] = uint32(TimeWeekNext().Unix())
timestamps[2] = uint32(TimeWeekNext().Add(time.Duration(7) * time.Hour * 24).Unix())
timestamps[3] = uint32(TimeWeekNext().Add(time.Duration(14) * time.Hour * 24).Unix())
} else {
timestamps[0] = start
timestamps[1] = timestamps[0] + 604800
timestamps[2] = timestamps[1] + 604800
timestamps[3] = timestamps[2] + 604800
}
return timestamps
}
func handleMsgMhfGetEarthStatus(s *Session, p mhfpacket.MHFPacket) {
pkt := p.(*mhfpacket.MsgMhfGetEarthStatus)
bf := byteframe.NewByteFrame()
var earthTimestamps []uint32
var debug = s.server.erupeConfig.EarthDebug
earthId, earthStart := int32(0x01BEEFEE), uint32(0)
rows, _ := s.server.db.Queryx("SELECT id, (EXTRACT(epoch FROM start_time)::int) as start_time FROM events WHERE event_type='earth'")
if rows == nil {
log.Println("No rows found")
} else {
for rows.Next() {
rows.Scan(&earthId, &earthStart)
}
}
earthTimestamps = generateEarthStatusTimestamps(s, earthStart, debug)
// Conquest
if uint32(TimeAdjusted().Unix()) > earthTimestamps[0] {
bf.WriteUint32(earthTimestamps[0]) // Start
bf.WriteUint32(earthTimestamps[1]) // End
bf.WriteInt32(1) //Conquest Earth Status ID //1 and 2 UNK the difference
bf.WriteInt32(earthId) //ID
} else {
bf.WriteUint32(earthTimestamps[1]) // Start
bf.WriteUint32(earthTimestamps[2]) // End
bf.WriteInt32(2) //Conquest Earth Status ID //1 and 2 UNK the difference
bf.WriteInt32(earthId) //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
if uint32(TimeAdjusted().Unix()) > earthTimestamps[1] {
bf.WriteUint32(earthTimestamps[1]) // Start
bf.WriteUint32(earthTimestamps[2]) // End
bf.WriteInt32(11) //Pallone Earth Status ID //11 is Fest //12 is Reward
bf.WriteInt32(earthId + 1) //ID
} else {
bf.WriteUint32(earthTimestamps[2]) // Start
bf.WriteUint32(earthTimestamps[3]) // End
bf.WriteInt32(12) //Pallone Earth Status ID //11 is Fest //12 is Reward
bf.WriteInt32(earthId + 1) //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
if uint32(TimeAdjusted().Unix()) > earthTimestamps[2] {
bf.WriteUint32(earthTimestamps[2]) // Start
bf.WriteUint32(earthTimestamps[3]) // End
bf.WriteInt32(21) //Tower Earth Status ID
bf.WriteInt32(earthId + 2) //ID
for i, m := range s.server.erupeConfig.EarthMonsters {
if _config.ErupeConfig.RealClientMode <= _config.G8 {
if i == 3 {
break
}
}
if i == 4 {
break
}
bf.WriteInt32(m)
}
}
doAckBufSucceed(s, pkt.AckHandle, bf.Data())
}

View File

@@ -3,7 +3,6 @@ package channelserver
import (
"erupe-ce/common/byteframe"
ps "erupe-ce/common/pascalstring"
"erupe-ce/common/stringsupport"
"erupe-ce/common/token"
_config "erupe-ce/config"
"erupe-ce/network/mhfpacket"
@@ -34,180 +33,62 @@ func handleMsgMhfLoadMezfesData(s *Session, p mhfpacket.MHFPacket) {
doAckBufSucceed(s, pkt.AckHandle, bf.Data())
}
func generateTournamentTimestamps(start uint32, debug bool) []uint32 {
timestamps := make([]uint32, 4)
midnight := TimeMidnight()
if debug && start <= 3 {
midnight := uint32(midnight.Unix())
switch start {
case 1:
timestamps[0] = midnight
timestamps[1] = timestamps[0] + 259200
timestamps[2] = timestamps[1] + 766800
timestamps[3] = timestamps[2] + 604800
case 2:
timestamps[0] = midnight - 259200
timestamps[1] = midnight
timestamps[2] = timestamps[1] + 766800
timestamps[3] = timestamps[2] + 604800
case 3:
timestamps[0] = midnight - 1026000
timestamps[1] = midnight - 766800
timestamps[2] = midnight
timestamps[3] = timestamps[2] + 604800
}
return timestamps
}
timestamps[0] = start
timestamps[1] = timestamps[0] + 259200
timestamps[2] = timestamps[1] + 766800
timestamps[3] = timestamps[2] + 604800
return timestamps
}
type TournamentEvent struct {
ID uint32
CupGroup uint16
EventSubType int16
QuestFileID uint32
Name string
}
type TournamentCup struct {
ID uint32
CupGroup uint16
Type uint16
Unk uint16
Name string
Description string
}
func handleMsgMhfEnumerateRanking(s *Session, p mhfpacket.MHFPacket) {
pkt := p.(*mhfpacket.MsgMhfEnumerateRanking)
bf := byteframe.NewByteFrame()
id, start := uint32(0xBEEFDEAD), uint32(0)
rows, _ := s.server.db.Queryx("SELECT id, (EXTRACT(epoch FROM start_time)::int) as start_time FROM events WHERE event_type='festa'")
for rows.Next() {
rows.Scan(&id, &start)
}
var timestamps []uint32
if s.server.erupeConfig.DebugOptions.TournamentOverride >= 0 {
if s.server.erupeConfig.DebugOptions.TournamentOverride == 0 {
bf.WriteBytes(make([]byte, 16))
bf.WriteUint32(uint32(TimeAdjusted().Unix()))
bf.WriteUint8(0)
ps.Uint8(bf, "", true)
bf.WriteUint16(0)
bf.WriteUint8(0)
doAckBufSucceed(s, pkt.AckHandle, bf.Data())
return
}
timestamps = generateTournamentTimestamps(uint32(s.server.erupeConfig.DebugOptions.TournamentOverride), true)
} else {
timestamps = generateTournamentTimestamps(start, false)
}
if timestamps[0] > uint32(TimeAdjusted().Unix()) {
state := s.server.erupeConfig.DebugOptions.TournamentOverride
// Unk
// Unk
// Start?
// End?
midnight := TimeMidnight()
switch state {
case 1:
bf.WriteUint32(uint32(midnight.Unix()))
bf.WriteUint32(uint32(midnight.Add(3 * 24 * time.Hour).Unix()))
bf.WriteUint32(uint32(midnight.Add(13 * 24 * time.Hour).Unix()))
bf.WriteUint32(uint32(midnight.Add(20 * 24 * time.Hour).Unix()))
case 2:
bf.WriteUint32(uint32(midnight.Add(-3 * 24 * time.Hour).Unix()))
bf.WriteUint32(uint32(midnight.Unix()))
bf.WriteUint32(uint32(midnight.Add(10 * 24 * time.Hour).Unix()))
bf.WriteUint32(uint32(midnight.Add(17 * 24 * time.Hour).Unix()))
case 3:
bf.WriteUint32(uint32(midnight.Add(-13 * 24 * time.Hour).Unix()))
bf.WriteUint32(uint32(midnight.Add(-10 * 24 * time.Hour).Unix()))
bf.WriteUint32(uint32(midnight.Unix()))
bf.WriteUint32(uint32(midnight.Add(7 * 24 * time.Hour).Unix()))
default:
bf.WriteBytes(make([]byte, 16))
bf.WriteUint32(uint32(TimeAdjusted().Unix()))
bf.WriteUint8(0)
ps.Uint8(bf, "", true)
bf.WriteUint16(0)
bf.WriteUint8(0)
bf.WriteUint32(uint32(TimeAdjusted().Unix())) // TS Current Time
bf.WriteUint8(3)
bf.WriteBytes(make([]byte, 4))
doAckBufSucceed(s, pkt.AckHandle, bf.Data())
return
}
bf.WriteUint32(uint32(TimeAdjusted().Unix())) // TS Current Time
bf.WriteUint8(3)
ps.Uint8(bf, "", false)
bf.WriteUint16(0) // numEvents
bf.WriteUint8(0) // numCups
for _, timestamp := range timestamps {
bf.WriteUint32(timestamp)
}
bf.WriteUint32(uint32(TimeAdjusted().Unix()))
bf.WriteUint8(1) // TODO: Make this dynamic depending on timestamp
ps.Uint8(bf, "第150回公式狩猟大会", true)
/*
struct event
uint32 eventID
uint16 unk
uint16 unk
uint32 unk
psUint8 name
// Temp direct port
tournamentEvents := []TournamentEvent{
{2644, 16, 0, 60691, "爆霧竜討伐!"},
{2645, 16, 1, 60691, "爆霧竜討伐!"},
{2646, 16, 2, 60691, "爆霧竜討伐!"},
{2647, 16, 3, 60691, "爆霧竜討伐!"},
{2648, 16, 4, 60691, "爆霧竜討伐!"},
{2649, 16, 5, 60691, "爆霧竜討伐!"},
{2650, 16, 6, 60691, "爆霧竜討伐!"},
{2651, 16, 7, 60691, "爆霧竜討伐!"},
{2652, 16, 8, 60691, "爆霧竜討伐!"},
{2653, 16, 9, 60691, "爆霧竜討伐!"},
{2654, 16, 10, 60691, "爆霧竜討伐!"},
{2655, 16, 11, 60691, "爆霧竜討伐!"},
{2656, 16, 12, 60691, "爆霧竜討伐!"},
{2657, 16, 13, 60691, "爆霧竜討伐!"},
{2658, 17, -1, 60690, "みんなで爆霧竜討伐!"},
{2659, 6, 234, 0, "キレアジ"},
{2660, 6, 237, 0, "ハリマグロ"},
{2661, 6, 239, 0, "カクサンデメキン"},
}
tournamentCups := []TournamentCup{
{569, 6, 6, 0, "個人 巨大魚杯", "~C05【競技内容】\n~C00クエストで釣った魚のサイズを競う\n~C04【対象魚】\n~C00キレアジ、\nハリマグロ、カクサンデメキン\n~C07【入賞賞品】\n~C00魚杯のしるし、タルネコ生産券、\nグーク生産券、グーク足生産券、\nグーク解放券(1〜3位)\n/猟団ポイント(1〜100位)\n/匠チケット+ハーフチケット白\n(1〜500位)\n~C03【開催期間】\n~C002019年11月22日 14:00から\n2019年11月25日 14:00まで"},
{570, 17, 7, 0, "猟団 G級韋駄天杯", "~C05【競技内容】\n~C00≪みんなで爆霧竜討伐≫を\n同じ猟団に所属する4人までの\n猟団員でいかに早くクリアするか\nを競う\n\n~C07【入賞賞品】\n~C00第147回狩人祭の魂(1〜200位)\n\n~C03【開催期間】\n~C002019年11月22日 14:00から\n2019年11月25日 14:00まで\n\n"},
{571, 16, 7, 0, "個人 G級韋駄天杯", "~C05【競技内容】\n~C00≪爆霧竜討伐≫を\nいかに早くクリアするかを競う\n\n~C07【入賞賞品】\n~C00王者のメダル(1位)\n/公式のしるし、タルネコ生産券、\nグーク生産券、グーク足生産券、\nグーク解放券(1〜3位)\n/猟団ポイント(1〜100位)\n/匠チケット+ハーフチケット白\n(1〜500位)\n~C03【開催期間】\n~C002019年11月22日 14:00から\n2019年11月25日 14:00まで"},
}
struct cup
uint32 cupID
uint16 unk
uint16 unk
uint16 unk
psUint8 name
psUint16 desc
*/
bf.WriteUint16(uint16(len(tournamentEvents)))
for _, event := range tournamentEvents {
bf.WriteUint32(event.ID)
bf.WriteUint16(event.CupGroup)
bf.WriteInt16(event.EventSubType)
bf.WriteUint32(event.QuestFileID)
ps.Uint8(bf, event.Name, true)
}
bf.WriteUint8(uint8(len(tournamentCups)))
for _, cup := range tournamentCups {
bf.WriteUint32(cup.ID)
bf.WriteUint16(cup.CupGroup)
bf.WriteUint16(cup.Type)
bf.WriteUint16(cup.Unk)
ps.Uint8(bf, cup.Name, true)
ps.Uint16(bf, cup.Description, true)
}
doAckBufSucceed(s, pkt.AckHandle, bf.Data())
}
type TournamentRank struct {
CID uint32
Rank uint32
Grade uint16
HR uint16
GR uint16
CharName string
GuildName string
}
func handleMsgMhfEnumerateOrder(s *Session, p mhfpacket.MHFPacket) {
pkt := p.(*mhfpacket.MsgMhfEnumerateOrder)
bf := byteframe.NewByteFrame()
bf.WriteUint32(pkt.EventID)
bf.WriteUint32(uint32(TimeAdjusted().Unix()))
tournamentRanks := []TournamentRank{}
bf.WriteUint16(uint16(len(tournamentRanks)))
bf.WriteUint16(0) // Unk
for _, rank := range tournamentRanks {
bf.WriteUint32(rank.CID)
bf.WriteUint32(rank.Rank)
bf.WriteUint16(rank.Grade)
bf.WriteUint16(0)
bf.WriteUint16(rank.HR)
if _config.ErupeConfig.RealClientMode >= _config.G10 {
bf.WriteUint16(rank.GR)
}
bf.WriteUint16(0)
bf.WriteUint8(uint8(len(rank.CharName) + 1))
bf.WriteUint8(uint8(len(rank.GuildName) + 1))
bf.WriteNullTerminatedBytes(stringsupport.UTF8ToSJIS(rank.CharName))
bf.WriteNullTerminatedBytes(stringsupport.UTF8ToSJIS(rank.GuildName))
}
doAckBufSucceed(s, pkt.AckHandle, bf.Data())
}
@@ -246,10 +127,10 @@ func generateFestaTimestamps(s *Session, start uint32, debug bool) []uint32 {
}
return timestamps
}
if start == 0 || TimeAdjusted().Unix() > int64(start)+3024000 {
if start == 0 || TimeAdjusted().Unix() > int64(start)+2977200 {
cleanupFesta(s)
// Generate a new festa, starting 11am tomorrow
start = uint32(midnight.Add(35 * time.Hour).Unix())
// 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 ('festa', to_timestamp($1)::timestamp without time zone)", start)
}
timestamps[0] = start

View File

@@ -367,13 +367,17 @@ func handleMsgMhfAcquireTitle(s *Session, p mhfpacket.MHFPacket) {
func handleMsgMhfResetTitle(s *Session, p mhfpacket.MHFPacket) {}
func handleMsgMhfOperateWarehouse(s *Session, p mhfpacket.MHFPacket) {
pkt := p.(*mhfpacket.MsgMhfOperateWarehouse)
func initializeWarehouse(s *Session) {
var t int
err := s.server.db.QueryRow("SELECT character_id FROM warehouse WHERE character_id=$1", s.charID).Scan(&t)
if err != nil {
s.server.db.Exec("INSERT INTO warehouse (character_id) VALUES ($1)", s.charID)
}
}
func handleMsgMhfOperateWarehouse(s *Session, p mhfpacket.MHFPacket) {
pkt := p.(*mhfpacket.MsgMhfOperateWarehouse)
initializeWarehouse(s)
bf := byteframe.NewByteFrame()
bf.WriteUint8(pkt.Operation)
switch pkt.Operation {
@@ -446,6 +450,7 @@ func addWarehouseEquipment(s *Session, equipment mhfitem.MHFEquipment) {
}
func warehouseGetItems(s *Session, index uint8) []mhfitem.MHFItemStack {
initializeWarehouse(s)
var data []byte
var items []mhfitem.MHFItemStack
s.server.db.QueryRow(fmt.Sprintf(`SELECT item%d FROM warehouse WHERE character_id=$1`, index), s.charID).Scan(&data)

View File

@@ -2,85 +2,741 @@ package channelserver
import (
"erupe-ce/common/byteframe"
"erupe-ce/common/stringsupport"
"erupe-ce/network/mhfpacket"
)
type BreakSeibatuLevelReward struct {
Item int32
Quantity int32
Level int32
Unk int32
}
func handleMsgMhfGetBreakSeibatuLevelReward(s *Session, p mhfpacket.MHFPacket) {
pkt := p.(*mhfpacket.MsgMhfGetBreakSeibatuLevelReward)
bf := byteframe.NewByteFrame()
bf.WriteInt32(0)
bf.WriteInt32(0)
bf.WriteInt32(0)
bf.WriteInt32(0)
doAckBufSucceed(s, pkt.AckHandle, bf.Data())
}
type WeeklySeibatuRankingReward struct {
Unk0 int32
Unk1 int32
Unk2 uint32
Unk3 int32
Unk4 int32
Unk5 int32
}
func handleMsgMhfGetWeeklySeibatuRankingReward(s *Session, p mhfpacket.MHFPacket) {
pkt := p.(*mhfpacket.MsgMhfGetWeeklySeibatuRankingReward)
var data []*byteframe.ByteFrame
weeklySeibatuRankingRewards := []WeeklySeibatuRankingReward{
{0, 0, 0, 0, 0, 0},
var weeklySeibatuRankingRewards []BreakSeibatuLevelReward
switch pkt.EarthMonster {
case 116:
weeklySeibatuRankingRewards = []BreakSeibatuLevelReward{
{8, 3, 2, 0},
{8, 3, 2, 0},
{8, 3, 2, 0},
{8, 3, 3, 0},
{8, 3, 3, 0},
{8, 3, 3, 0},
{8, 3, 3, 0}}
case 107:
weeklySeibatuRankingRewards = []BreakSeibatuLevelReward{
{4, 3, 1, 0},
{4, 3, 2, 0},
{4, 3, 3, 0},
{4, 3, 4, 0},
{4, 3, 5, 0}}
case 2:
weeklySeibatuRankingRewards = []BreakSeibatuLevelReward{
{5, 3, 1, 0},
{5, 3, 2, 0},
{5, 3, 3, 0},
{5, 3, 4, 0},
{5, 3, 5, 0}}
case 36:
weeklySeibatuRankingRewards = []BreakSeibatuLevelReward{
{7, 3, 1, 0},
{7, 3, 2, 0},
{7, 3, 3, 0},
{7, 3, 4, 0},
{7, 3, 5, 0}}
default:
weeklySeibatuRankingRewards = []BreakSeibatuLevelReward{
{1, 3, 1, 0},
{1, 3, 2, 0},
{1, 3, 3, 0},
{1, 3, 4, 0},
{1, 3, 5, 0}}
}
for _, reward := range weeklySeibatuRankingRewards {
for _, seibatuData := range weeklySeibatuRankingRewards {
bf := byteframe.NewByteFrame()
bf.WriteInt32(reward.Unk0)
bf.WriteInt32(reward.Unk1)
bf.WriteUint32(reward.Unk2)
bf.WriteInt32(reward.Unk3)
bf.WriteInt32(reward.Unk4)
bf.WriteInt32(reward.Unk5)
bf.WriteInt32(seibatuData.Item)
bf.WriteInt32(seibatuData.Quantity)
bf.WriteInt32(seibatuData.Level)
bf.WriteInt32(seibatuData.Unk)
data = append(data, bf)
}
doAckEarthSucceed(s, pkt.AckHandle, data)
}
type WeeklySeibatuRankingRewardData struct {
Index0 int32 //Place Start
Index1 int32 //Place Finish
Index2 uint32 // UNK
DistributionType int32 //Type 7201:Item 7202:N Points 7203:Guild Contribution Points
ItemID int32
Amount int32
}
type WeeklySeibatuRankingRewards struct {
Unk0 int32
ItemID int32
Amount uint32
PlaceFrom int32
PlaceTo int32
}
func handleMsgMhfGetWeeklySeibatuRankingReward(s *Session, p mhfpacket.MHFPacket) {
pkt := p.(*mhfpacket.MsgMhfGetWeeklySeibatuRankingReward)
var data []*byteframe.ByteFrame
var weeklySeibatuRankingRewards []WeeklySeibatuRankingRewards
var weeklySeibatuRankingRewardsData []WeeklySeibatuRankingRewardData
switch pkt.Operation {
case 1:
//Conquest Data
switch pkt.ID { // Seems to align with EarthStatus 1 and 2 for Conquest
case 1:
switch pkt.EarthMonster {
case 116:
weeklySeibatuRankingRewards = []WeeklySeibatuRankingRewards{
{0, 2, 3, 1, 100},
{0, 2, 6, 1, 100},
{0, 2, 6, 1, 100},
{0, 2, 6, 1, 100},
{0, 2, 15, 1, 100},
{0, 2, 15, 1, 100},
{0, 2, 25, 1, 100},
{0, 2, 2, 101, 1000},
{0, 2, 4, 101, 1000},
{0, 2, 4, 101, 1000},
{0, 2, 4, 101, 1000},
{0, 2, 9, 101, 1000},
{0, 2, 9, 101, 1000},
{0, 2, 30, 101, 1000},
{0, 2, 2, 1000, 1001},
{0, 2, 4, 1000, 1001},
{0, 2, 4, 1000, 1001},
{0, 2, 4, 1000, 1001},
{0, 2, 6, 1000, 1001},
{0, 2, 6, 1000, 1001},
}
case 107:
weeklySeibatuRankingRewards = []WeeklySeibatuRankingRewards{
{0, 2, 3, 1, 100},
{0, 2, 6, 1, 100},
{0, 2, 6, 1, 100},
{0, 2, 6, 1, 100},
{0, 2, 15, 1, 100},
{0, 2, 15, 1, 100},
{0, 2, 25, 1, 100},
{0, 2, 2, 101, 1000},
{0, 2, 4, 101, 1000},
{0, 2, 4, 101, 1000},
{0, 2, 4, 101, 1000},
{0, 2, 9, 101, 1000},
{0, 2, 9, 101, 1000},
{0, 2, 30, 101, 1000},
{0, 2, 2, 1000, 1001},
{0, 2, 4, 1000, 1001},
{0, 2, 4, 1000, 1001},
{0, 2, 4, 1000, 1001},
{0, 2, 6, 1000, 1001},
{0, 2, 6, 1000, 1001},
}
case 2:
weeklySeibatuRankingRewards = []WeeklySeibatuRankingRewards{
{0, 2, 3, 1, 100},
{0, 2, 6, 1, 100},
{0, 2, 6, 1, 100},
{0, 2, 6, 1, 100},
{0, 2, 15, 1, 100},
{0, 2, 15, 1, 100},
{0, 2, 25, 1, 100},
{0, 2, 2, 101, 1000},
{0, 2, 4, 101, 1000},
{0, 2, 4, 101, 1000},
{0, 2, 4, 101, 1000},
{0, 2, 9, 101, 1000},
{0, 2, 9, 101, 1000},
{0, 2, 30, 101, 1000},
{0, 2, 2, 1000, 1001},
{0, 2, 4, 1000, 1001},
{0, 2, 4, 1000, 1001},
{0, 2, 4, 1000, 1001},
{0, 2, 6, 1000, 1001},
{0, 2, 6, 1000, 1001},
}
case 36:
weeklySeibatuRankingRewards = []WeeklySeibatuRankingRewards{
{0, 2, 3, 1, 100},
{0, 2, 6, 1, 100},
{0, 2, 6, 1, 100},
{0, 2, 6, 1, 100},
{0, 2, 15, 1, 100},
{0, 2, 15, 1, 100},
{0, 2, 25, 1, 100},
{0, 2, 2, 101, 1000},
{0, 2, 4, 101, 1000},
{0, 2, 4, 101, 1000},
{0, 2, 4, 101, 1000},
{0, 2, 9, 101, 1000},
{0, 2, 9, 101, 1000},
{0, 2, 30, 101, 1000},
{0, 2, 2, 1000, 1001},
{0, 2, 4, 1000, 1001},
{0, 2, 4, 1000, 1001},
{0, 2, 4, 1000, 1001},
{0, 2, 6, 1000, 1001},
{0, 2, 6, 1000, 1001},
}
}
case 2:
switch pkt.EarthMonster {
case 116:
weeklySeibatuRankingRewards = []WeeklySeibatuRankingRewards{
{0, 2, 3, 1, 100},
{0, 2, 6, 1, 100},
{0, 2, 6, 1, 100},
{0, 2, 6, 1, 100},
{0, 2, 15, 1, 100},
{0, 2, 15, 1, 100},
{0, 2, 25, 1, 100},
{0, 2, 2, 101, 1000},
{0, 2, 4, 101, 1000},
{0, 2, 4, 101, 1000},
{0, 2, 4, 101, 1000},
{0, 2, 9, 101, 1000},
{0, 2, 9, 101, 1000},
{0, 2, 30, 101, 1000},
{0, 2, 2, 1000, 1001},
{0, 2, 4, 1000, 1001},
{0, 2, 4, 1000, 1001},
{0, 2, 4, 1000, 1001},
{0, 2, 6, 1000, 1001},
{0, 2, 6, 1000, 1001},
}
case 107:
weeklySeibatuRankingRewards = []WeeklySeibatuRankingRewards{
{0, 2, 3, 1, 100},
{0, 2, 6, 1, 100},
{0, 2, 6, 1, 100},
{0, 2, 6, 1, 100},
{0, 2, 15, 1, 100},
{0, 2, 15, 1, 100},
{0, 2, 25, 1, 100},
{0, 2, 2, 101, 1000},
{0, 2, 4, 101, 1000},
{0, 2, 4, 101, 1000},
{0, 2, 4, 101, 1000},
{0, 2, 9, 101, 1000},
{0, 2, 9, 101, 1000},
{0, 2, 30, 101, 1000},
{0, 2, 2, 1000, 1001},
{0, 2, 4, 1000, 1001},
{0, 2, 4, 1000, 1001},
{0, 2, 4, 1000, 1001},
{0, 2, 6, 1000, 1001},
{0, 2, 6, 1000, 1001},
}
case 2:
weeklySeibatuRankingRewards = []WeeklySeibatuRankingRewards{
{0, 2, 3, 1, 100},
{0, 2, 6, 1, 100},
{0, 2, 6, 1, 100},
{0, 2, 6, 1, 100},
{0, 2, 15, 1, 100},
{0, 2, 15, 1, 100},
{0, 2, 25, 1, 100},
{0, 2, 2, 101, 1000},
{0, 2, 4, 101, 1000},
{0, 2, 4, 101, 1000},
{0, 2, 4, 101, 1000},
{0, 2, 9, 101, 1000},
{0, 2, 9, 101, 1000},
{0, 2, 30, 101, 1000},
{0, 2, 2, 1000, 1001},
{0, 2, 4, 1000, 1001},
{0, 2, 4, 1000, 1001},
{0, 2, 4, 1000, 1001},
{0, 2, 6, 1000, 1001},
{0, 2, 6, 1000, 1001},
}
case 36:
weeklySeibatuRankingRewards = []WeeklySeibatuRankingRewards{
{0, 2, 3, 1, 100},
{0, 2, 6, 1, 100},
{0, 2, 6, 1, 100},
{0, 2, 6, 1, 100},
{0, 2, 15, 1, 100},
{0, 2, 15, 1, 100},
{0, 2, 25, 1, 100},
{0, 2, 2, 101, 1000},
{0, 2, 4, 101, 1000},
{0, 2, 4, 101, 1000},
{0, 2, 4, 101, 1000},
{0, 2, 9, 101, 1000},
{0, 2, 9, 101, 1000},
{0, 2, 30, 101, 1000},
{0, 2, 2, 1000, 1001},
{0, 2, 4, 1000, 1001},
{0, 2, 4, 1000, 1001},
{0, 2, 4, 1000, 1001},
{0, 2, 6, 1000, 1001},
{0, 2, 6, 1000, 1001},
}
}
}
case 3:
//Pallone Festival Data
weeklySeibatuRankingRewardsData = []WeeklySeibatuRankingRewardData{
//Unk0
//Unk1
//Unk2
//Unk3,
//ROUTE, (Crashes if it doesnt exist be careful with values )
//Status 1 = Only Now ! 2= Unk 3= Disabled}
//Route 0
{0, 0, 0, 0, 0, 0}, {0, 0, 0, 0, 0, 0}, {0, 0, 0, 0, 0, 0}, {0, 0, 0, 0, 0, 0}, {0, 0, 0, 0, 0, 0}, {0, 0, 0, 0, 0, 0}, {0, 0, 0, 0, 0, 0}, {0, 0, 0, 0, 0, 0}, {0, 0, 0, 0, 0, 0}, {0, 0, 0, 0, 0, 0}, {0, 0, 0, 0, 0, 0}, {0, 0, 0, 0, 0, 0}, {0, 0, 0, 0, 0, 0},
//Route 1
{0, 0, 0, 0, 0, 0}, {0, 0, 0, 0, 0, 0}, {0, 0, 0, 0, 0, 0}, {0, 0, 0, 0, 0, 0}, {0, 0, 0, 0, 0, 0}, {0, 0, 0, 0, 0, 0}, {0, 0, 0, 0, 0, 0}, {0, 0, 0, 0, 0, 0}, {0, 0, 0, 0, 0, 0}, {0, 0, 0, 0, 0, 0}, {0, 0, 0, 0, 0, 0}, {0, 0, 0, 0, 0, 0}, {0, 0, 0, 0, 0, 0},
//Route 2
{0, 0, 0, 0, 0, 0}, {0, 0, 0, 0, 0, 0}, {0, 0, 0, 0, 0, 0}, {0, 0, 0, 0, 0, 0}, {0, 0, 0, 0, 0, 0}, {0, 0, 0, 0, 0, 0}, {0, 0, 0, 0, 0, 0}, {0, 0, 0, 0, 0, 0}, {0, 0, 0, 0, 0, 0}, {0, 0, 0, 0, 0, 0}, {0, 0, 0, 0, 0, 0}, {0, 0, 0, 0, 0, 0}, {0, 0, 0, 0, 0, 0},
//Route 3
{0, 0, 0, 0, 0, 0}, {0, 0, 0, 0, 0, 0}, {0, 0, 0, 0, 0, 0}, {0, 0, 0, 0, 0, 0}, {0, 0, 0, 0, 0, 0}, {0, 0, 0, 0, 0, 0}, {0, 0, 0, 0, 0, 0}, {0, 0, 0, 0, 0, 0}, {0, 0, 0, 0, 0, 0}, {0, 0, 0, 0, 0, 0}, {0, 0, 0, 0, 0, 0}, {0, 0, 0, 0, 0, 0}, {0, 0, 0, 0, 0, 0},
//Route 4
{0, 0, 0, 0, 0, 0}, {0, 0, 0, 0, 0, 0}, {0, 0, 0, 0, 0, 0}, {0, 0, 0, 0, 0, 0}, {0, 0, 0, 0, 0, 0}, {0, 0, 0, 0, 0, 0}, {0, 0, 0, 0, 0, 0}, {0, 0, 0, 0, 0, 0}, {0, 0, 0, 0, 0, 0}, {0, 0, 0, 0, 0, 0}, {0, 0, 0, 0, 0, 0}, {0, 0, 0, 0, 0, 0}, {0, 0, 0, 0, 0, 0},
//Route 5
{0, 0, 0, 0, 0, 0}, {0, 0, 0, 0, 0, 0}, {0, 0, 0, 0, 0, 0}, {0, 0, 0, 0, 0, 0}, {0, 0, 0, 0, 0, 0}, {0, 0, 0, 0, 0, 0}, {0, 0, 0, 0, 0, 0}, {0, 0, 0, 0, 0, 0}, {0, 0, 0, 0, 0, 0}, {0, 0, 0, 0, 0, 0}, {0, 0, 0, 0, 0, 0}, {0, 0, 0, 0, 0, 0}, {0, 0, 0, 0, 0, 0},
//Route 6
{0, 0, 0, 0, 0, 0}, {0, 0, 0, 0, 0, 0}, {0, 0, 0, 0, 0, 0}, {0, 0, 0, 0, 0, 0}, {0, 0, 0, 0, 0, 0}, {0, 0, 0, 0, 0, 0}, {0, 0, 0, 0, 0, 0}, {0, 0, 0, 0, 0, 0}, {0, 0, 0, 0, 0, 0}, {0, 0, 0, 0, 0, 0}, {0, 0, 0, 0, 0, 0}, {0, 0, 0, 0, 0, 0}, {0, 0, 0, 0, 0, 0},
//Route 7
{0, 0, 0, 0, 0, 0}, {0, 0, 0, 0, 0, 0}, {0, 0, 0, 0, 0, 0}, {0, 0, 0, 0, 0, 0}, {0, 0, 0, 0, 0, 0}, {0, 0, 0, 0, 0, 0}, {0, 0, 0, 0, 0, 0}, {0, 0, 0, 0, 0, 0}, {0, 0, 0, 0, 0, 0}, {0, 0, 0, 0, 0, 0}, {0, 0, 0, 0, 0, 0}, {0, 0, 0, 0, 0, 0}, {0, 0, 0, 0, 0, 0},
//Route 8
{0, 0, 0, 0, 0, 0}, {0, 0, 0, 0, 0, 0}, {0, 0, 0, 0, 0, 0}, {0, 0, 0, 0, 0, 0}, {0, 0, 0, 0, 0, 0}, {0, 0, 0, 0, 0, 0}, {0, 0, 0, 0, 0, 0}, {0, 0, 0, 0, 0, 0}, {0, 0, 0, 0, 0, 0}, {0, 0, 0, 0, 0, 0}, {0, 0, 0, 0, 0, 0}, {0, 0, 0, 0, 0, 0}, {0, 0, 0, 0, 0, 0},
//Route 9
{0, 0, 0, 0, 0, 0}, {0, 0, 0, 0, 0, 0}, {0, 0, 0, 0, 0, 0}, {0, 0, 0, 0, 0, 0}, {0, 0, 0, 0, 0, 0}, {0, 0, 0, 0, 0, 0}, {0, 0, 0, 0, 0, 0}, {0, 0, 0, 0, 0, 0}, {0, 0, 0, 0, 0, 0}, {0, 0, 0, 0, 0, 0}, {0, 0, 0, 0, 0, 0}, {0, 0, 0, 0, 0, 0}, {0, 0, 0, 0, 0, 0},
//Route 10
{0, 0, 0, 0, 0, 0}, {0, 0, 0, 0, 0, 0}, {0, 0, 0, 0, 0, 0}, {0, 0, 0, 0, 0, 0}, {0, 0, 0, 0, 0, 0}, {0, 0, 0, 0, 0, 0}, {0, 0, 0, 0, 0, 0}, {0, 0, 0, 0, 0, 0}, {0, 0, 0, 0, 0, 0}, {0, 0, 0, 0, 0, 0}, {0, 0, 0, 0, 0, 0}, {0, 0, 0, 0, 0, 0}, {0, 0, 0, 0, 0, 0},
}
// 0 = Max 7 Routes so value 6
//ZZ looks like it only works up to Route 2
case 5:
//Event Reward Data
switch pkt.ID {
//243400 = Route 0
//243401 = Route 1
//I have a sneaky suspicion that the above massive array is feeding into this somehow....
case 240031:
weeklySeibatuRankingRewardsData = []WeeklySeibatuRankingRewardData{
{1, 1, 1, 7201, 12068, 1}}
case 240041:
weeklySeibatuRankingRewardsData = []WeeklySeibatuRankingRewardData{
{0, 0, 1, 7201, 12068, 1}}
case 240042:
weeklySeibatuRankingRewardsData = []WeeklySeibatuRankingRewardData{
{0, 0, 2, 7201, 12068, 1}}
case 240051:
weeklySeibatuRankingRewardsData = []WeeklySeibatuRankingRewardData{
{0, 0, 1, 7201, 12068, 1}}
case 240052:
weeklySeibatuRankingRewardsData = []WeeklySeibatuRankingRewardData{
{1, 1, 1, 7201, 12068, 1},
}
case 260001:
//Tower Dure Kill Reward
weeklySeibatuRankingRewardsData = []WeeklySeibatuRankingRewardData{
//Can only have 10 in each dist (It disapears otherwise) Looks like up to dist 4 is implemented
//This is claimable for every Dure Kill, Make cliamable in bulk or mandatory claim per kill
//{unk,unk,dist,seiabtuType,ItemID,Value}
{0, 0, 1, 7201, 11463, 1},
{0, 0, 1, 7201, 11464, 1},
{0, 0, 1, 7201, 11163, 1},
{0, 0, 1, 7201, 11159, 5},
{0, 0, 1, 7201, 11160, 5},
{0, 0, 1, 7201, 11161, 5},
{0, 0, 2, 7201, 12506, 1},
{0, 0, 2, 7201, 10355, 1},
{0, 0, 2, 7201, 11163, 1},
{0, 0, 2, 7201, 11159, 5},
{0, 0, 2, 7201, 11160, 5},
{0, 0, 2, 7201, 11161, 5},
}
case 260003:
//Tower Floor Reward
weeklySeibatuRankingRewardsData = []WeeklySeibatuRankingRewardData{
//Adjust Floors done in database to make blue
//This is claimable for every Floor Climbed across dist 1 and 2
//{Floor,unk,unk,seiabtuType,ItemID,Value}
{1, 0, 0, 7201, 11158, 1},
{2, 0, 0, 7201, 11173, 1},
{3, 0, 0, 7201, 10813, 3},
{4, 0, 0, 7201, 11163, 1},
{5, 0, 0, 7201, 11164, 1},
{6, 0, 0, 7201, 11389, 3},
{6, 0, 0, 7201, 11381, 1},
{7, 0, 0, 7201, 11384, 1},
{8, 0, 0, 7201, 11159, 10},
{9, 0, 0, 7201, 11160, 10},
{10, 0, 0, 7201, 11161, 10},
{11, 0, 0, 7201, 11265, 2},
{11, 0, 0, 7201, 7279, 2},
{12, 0, 0, 7201, 11381, 1},
{13, 0, 0, 7201, 11384, 1},
{14, 0, 0, 7201, 11381, 1},
{15, 0, 0, 7201, 11384, 1},
{15, 0, 0, 7201, 11464, 1},
{16, 0, 0, 7201, 11381, 1},
{17, 0, 0, 7201, 11384, 1},
{18, 0, 0, 7201, 11381, 1},
{19, 0, 0, 7201, 11384, 1},
{20, 0, 0, 7201, 10778, 3},
{21, 0, 0, 7201, 11265, 2},
{21, 0, 0, 7201, 7279, 2},
{22, 0, 0, 7201, 11381, 1},
{23, 0, 0, 7201, 11384, 1},
{24, 0, 0, 7201, 11381, 1},
{25, 0, 0, 7201, 11389, 3},
{25, 0, 0, 7201, 11286, 4},
{26, 0, 0, 7201, 11384, 1},
{27, 0, 0, 7201, 11381, 1},
{28, 0, 0, 7201, 11384, 1},
{29, 0, 0, 7201, 11381, 1},
{30, 0, 0, 7201, 11209, 3},
{31, 0, 0, 7201, 11265, 2},
{31, 0, 0, 7201, 7279, 2},
{32, 0, 0, 7201, 11159, 10},
{33, 0, 0, 7201, 11463, 1},
{34, 0, 0, 7201, 11160, 10},
{35, 0, 0, 7201, 11286, 4},
{36, 0, 0, 7201, 11161, 10},
{38, 0, 0, 7201, 11384, 1},
{39, 0, 0, 7201, 11164, 1},
{40, 0, 0, 7201, 10813, 3},
{41, 0, 0, 7201, 11265, 2},
{41, 0, 0, 7201, 7280, 2},
{43, 0, 0, 7201, 11381, 1},
{45, 0, 0, 7201, 11286, 4},
{47, 0, 0, 7201, 11384, 1},
{48, 0, 0, 7201, 11358, 1},
{50, 0, 0, 7201, 11356, 1},
{51, 0, 0, 7201, 11265, 2},
{51, 0, 0, 7201, 7280, 2},
{53, 0, 0, 7201, 11381, 2},
{55, 0, 0, 7201, 11357, 1},
{57, 0, 0, 7201, 11384, 1},
{60, 0, 0, 7201, 11286, 4},
{61, 0, 0, 7201, 11265, 2},
{61, 0, 0, 7201, 7280, 2},
{63, 0, 0, 7201, 11381, 2},
{66, 0, 0, 7201, 11463, 1},
{67, 0, 0, 7201, 11384, 1},
{70, 0, 0, 7201, 11286, 4},
{71, 0, 0, 7201, 11265, 2},
{71, 0, 0, 7201, 7280, 2},
{73, 0, 0, 7201, 11381, 2},
{77, 0, 0, 7201, 11384, 1},
{79, 0, 0, 7201, 11164, 1},
{80, 0, 0, 7201, 11286, 6},
{81, 0, 0, 7201, 11265, 2},
{81, 0, 0, 7201, 7281, 1},
{83, 0, 0, 7201, 11381, 2},
{85, 0, 0, 7201, 11464, 1},
{87, 0, 0, 7201, 11384, 1},
{90, 0, 0, 7201, 11286, 6},
{91, 0, 0, 7201, 11265, 2},
{91, 0, 0, 7201, 7281, 1},
{93, 0, 0, 7201, 11381, 2},
{95, 0, 0, 7201, 10778, 3},
{97, 0, 0, 7201, 11384, 1},
{99, 0, 0, 7201, 11463, 1},
{100, 0, 0, 7201, 11286, 6},
{101, 0, 0, 7201, 11265, 2},
{101, 0, 0, 7201, 7281, 1},
{103, 0, 0, 7201, 11381, 2},
{107, 0, 0, 7201, 11384, 1},
{110, 0, 0, 7201, 11286, 6},
{113, 0, 0, 7201, 11381, 2},
{115, 0, 0, 7201, 11164, 1},
{117, 0, 0, 7201, 11384, 1},
{120, 0, 0, 7201, 11286, 12},
{123, 0, 0, 7201, 11381, 2},
{127, 0, 0, 7201, 11384, 1},
{130, 0, 0, 7201, 11286, 12},
{132, 0, 0, 7201, 11381, 2},
{134, 0, 0, 7201, 11384, 1},
{136, 0, 0, 7201, 11381, 2},
{138, 0, 0, 7201, 11384, 1},
{140, 0, 0, 7201, 11286, 12},
{142, 0, 0, 7201, 11382, 1},
{144, 0, 0, 7201, 11385, 1},
{145, 0, 0, 7201, 11464, 1},
{146, 0, 0, 7201, 11382, 1},
{148, 0, 0, 7201, 11385, 1},
{150, 0, 0, 7201, 11164, 1},
{155, 0, 0, 7201, 11382, 1},
{160, 0, 0, 7201, 11209, 3},
{165, 0, 0, 7201, 11385, 1},
{170, 0, 0, 7201, 11159, 10},
{175, 0, 0, 7201, 11382, 1},
{180, 0, 0, 7201, 11160, 10},
{185, 0, 0, 7201, 11385, 1},
{190, 0, 0, 7201, 11161, 10},
{195, 0, 0, 7201, 11382, 1},
{200, 0, 0, 7201, 11159, 15},
{210, 0, 0, 7201, 11160, 15},
{220, 0, 0, 7201, 11385, 1},
{235, 0, 0, 7201, 11382, 2},
{250, 0, 0, 7201, 11161, 15},
{265, 0, 0, 7201, 11159, 20},
{280, 0, 0, 7201, 11385, 1},
{300, 0, 0, 7201, 11160, 20},
{315, 0, 0, 7201, 11382, 2},
{330, 0, 0, 7201, 11385, 1},
{350, 0, 0, 7201, 11161, 20},
{365, 0, 0, 7201, 11382, 2},
{380, 0, 0, 7201, 11385, 1},
{400, 0, 0, 7201, 11159, 25},
{415, 0, 0, 7201, 11382, 2},
{430, 0, 0, 7201, 11385, 1},
{450, 0, 0, 7201, 11160, 25},
{465, 0, 0, 7201, 11382, 2},
{480, 0, 0, 7201, 11385, 1},
{500, 0, 0, 7201, 11161, 25},
{525, 0, 0, 7201, 11382, 2},
{550, 0, 0, 7201, 11385, 1},
{575, 0, 0, 7201, 11159, 25},
{600, 0, 0, 7201, 11382, 2},
{625, 0, 0, 7201, 11385, 1},
{650, 0, 0, 7201, 11160, 25},
{675, 0, 0, 7201, 11382, 2},
{700, 0, 0, 7201, 11385, 1},
{725, 0, 0, 7201, 11161, 25},
{750, 0, 0, 7201, 11382, 2},
{775, 0, 0, 7201, 11385, 1},
{800, 0, 0, 7201, 11159, 25},
{825, 0, 0, 7201, 11382, 2},
{850, 0, 0, 7201, 11385, 1},
{875, 0, 0, 7201, 11160, 25},
{900, 0, 0, 7201, 11382, 2},
{925, 0, 0, 7201, 11385, 1},
{950, 0, 0, 7201, 11161, 25},
{975, 0, 0, 7201, 11382, 2},
{1000, 0, 0, 7201, 11385, 1},
{1025, 0, 0, 7201, 11159, 25},
{1050, 0, 0, 7201, 11382, 2},
{1075, 0, 0, 7201, 11385, 1},
{1100, 0, 0, 7201, 11160, 25},
{1125, 0, 0, 7201, 11382, 2},
{1150, 0, 0, 7201, 11385, 1},
{1200, 0, 0, 7201, 11161, 25},
{1235, 0, 0, 7201, 11382, 2},
{1270, 0, 0, 7201, 11385, 1},
{1305, 0, 0, 7201, 11159, 25},
{1340, 0, 0, 7201, 11382, 2},
{1375, 0, 0, 7201, 11385, 1},
{1410, 0, 0, 7201, 11160, 25},
{1445, 0, 0, 7201, 11382, 2},
{1480, 0, 0, 7201, 11385, 1},
{1500, 0, 0, 7201, 11161, 25},
}
default:
//Covers all Pallone Requests... for now
weeklySeibatuRankingRewardsData = []WeeklySeibatuRankingRewardData{
//1st
{1, 0, 0, 7202, 10, 10000},
{1, 1, 0, 7201, 10, 30},
{1, 1, 0, 7201, 10, 18},
{1, 1, 0, 7201, 10, 18},
//2nd - 3rd
{2, 3, 0, 7202, 10, 6000},
{2, 3, 0, 7201, 10, 15},
{2, 3, 0, 7201, 10, 9},
{2, 3, 0, 7201, 10, 9},
//4th -10th
{4, 10, 0, 7202, 10, 5500},
{4, 10, 0, 7201, 10, 12},
{4, 10, 0, 7201, 10, 9},
}
}
}
if pkt.Operation == 1 {
for _, seibatuData := range weeklySeibatuRankingRewards {
bf := byteframe.NewByteFrame()
bf.WriteInt32(seibatuData.Unk0)
bf.WriteInt32(seibatuData.ItemID)
bf.WriteUint32(seibatuData.Amount)
bf.WriteInt32(seibatuData.PlaceFrom)
bf.WriteInt32(seibatuData.PlaceTo)
data = append(data, bf)
}
} else {
for _, seibatuData := range weeklySeibatuRankingRewardsData {
bf := byteframe.NewByteFrame()
bf.WriteInt32(seibatuData.Index0)
bf.WriteInt32(seibatuData.Index1)
bf.WriteUint32(seibatuData.Index2)
bf.WriteInt32(seibatuData.DistributionType)
bf.WriteInt32(seibatuData.ItemID)
bf.WriteInt32(seibatuData.Amount)
data = append(data, bf)
}
}
doAckEarthSucceed(s, pkt.AckHandle, data)
}
type FixedSeibatuRankingTable struct {
Rank int32
Level int32
Name string
}
func handleMsgMhfGetFixedSeibatuRankingTable(s *Session, p mhfpacket.MHFPacket) {
pkt := p.(*mhfpacket.MsgMhfGetFixedSeibatuRankingTable)
var fixedSeibatuRankingTable []FixedSeibatuRankingTable
//Interestingly doesn't trigger the pkt on EarthStatus 1 But menu option is there is this Seibatu instead?
switch pkt.EarthMonster {
case 116:
fixedSeibatuRankingTable = []FixedSeibatuRankingTable{
{1, 1, "Hunter 1"},
{2, 1, "Hunter 2"},
{3, 1, "Hunter 3"},
{4, 1, "Hunter 4"},
{5, 1, "Hunter 5"},
{6, 1, "Hunter 6"},
{7, 1, "Hunter 7"},
{8, 1, "Hunter 8"},
{9, 1, "Hunter 9"},
}
case 107:
fixedSeibatuRankingTable = []FixedSeibatuRankingTable{
{1, 2, "Hunter 1"},
{2, 2, "Hunter 2"},
{3, 2, "Hunter 3"},
{4, 2, "Hunter 4"},
{5, 2, "Hunter 5"},
{6, 2, "Hunter 6"},
{7, 2, "Hunter 7"},
{8, 2, "Hunter 8"},
{9, 2, "Hunter 9"},
}
case 2:
fixedSeibatuRankingTable = []FixedSeibatuRankingTable{
{1, 3, "Hunter 1"},
{2, 3, "Hunter 2"},
{3, 3, "Hunter 3"},
{4, 3, "Hunter 4"},
{5, 3, "Hunter 5"},
{6, 3, "Hunter 6"},
{7, 3, "Hunter 7"},
{8, 3, "Hunter 8"},
{9, 3, "Hunter 9"},
}
case 36:
fixedSeibatuRankingTable = []FixedSeibatuRankingTable{
{1, 4, "Hunter 1"},
{2, 4, "Hunter 2"},
{3, 4, "Hunter 3"},
{4, 4, "Hunter 4"},
{5, 4, "Hunter 5"},
{6, 4, "Hunter 6"},
{7, 4, "Hunter 7"},
{8, 4, "Hunter 8"},
{9, 4, "Hunter 9"},
}
default:
fixedSeibatuRankingTable = []FixedSeibatuRankingTable{
{1, 1, "Hunter 1"},
{2, 1, "Hunter 2"},
{3, 1, "Hunter 3"},
{4, 1, "Hunter 4"},
{5, 1, "Hunter 5"},
{6, 1, "Hunter 6"},
{7, 1, "Hunter 7"},
{8, 1, "Hunter 8"},
{9, 1, "Hunter 9"},
}
}
bf := byteframe.NewByteFrame()
bf.WriteInt32(0)
bf.WriteInt32(0)
bf.WriteBytes(make([]byte, 32))
for _, seibatuData := range fixedSeibatuRankingTable {
bf.WriteInt32(seibatuData.Rank)
bf.WriteInt32(seibatuData.Level)
bf.WriteBytes(stringsupport.PaddedString(seibatuData.Name, 32, true))
}
doAckBufSucceed(s, pkt.AckHandle, bf.Data())
}
func handleMsgMhfReadBeatLevel(s *Session, p mhfpacket.MHFPacket) {
pkt := p.(*mhfpacket.MsgMhfReadBeatLevel)
// This response is fixed and will never change on JP,
// but I've left it dynamic for possible other client differences.
var data []byte
err := s.server.db.QueryRow(`SELECT conquest_data FROM characters WHERE id = $1`, s.charID).Scan(&data)
if err != nil || len(data) == 0 {
data = []byte{0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 1}
}
bf := byteframe.NewByteFrameFromBytes(data)
resp := byteframe.NewByteFrame()
for i := 0; i < int(pkt.ValidIDCount); i++ {
resp.WriteUint32(pkt.IDs[i])
resp.WriteUint32(1)
resp.WriteUint32(1)
resp.WriteUint32(1)
resp.WriteUint32(bf.ReadUint32())
resp.WriteUint32(0)
resp.WriteUint32(0)
}
doAckBufSucceed(s, pkt.AckHandle, resp.Data())
}
func handleMsgMhfReadLastWeekBeatRanking(s *Session, p mhfpacket.MHFPacket) {
//Controls the monster headings for the other menus
pkt := p.(*mhfpacket.MsgMhfReadLastWeekBeatRanking)
bf := byteframe.NewByteFrame()
bf.WriteInt32(0)
bf.WriteInt32(0)
bf.WriteInt32(0)
bf.WriteInt32(0)
doAckBufSucceed(s, pkt.AckHandle, bf.Data())
resp := byteframe.NewByteFrame()
resp.WriteUint32(uint32(pkt.EarthMonster))
resp.WriteUint32(0)
resp.WriteUint32(0)
resp.WriteUint32(0)
doAckBufSucceed(s, pkt.AckHandle, resp.Data())
}
func handleMsgMhfUpdateBeatLevel(s *Session, p mhfpacket.MHFPacket) {
pkt := p.(*mhfpacket.MsgMhfUpdateBeatLevel)
bf := byteframe.NewByteFrame()
for i := 0; i < 4; i++ {
bf.WriteInt32(pkt.Data2[i])
}
s.server.db.Exec(`UPDATE characters SET conquest_data = $1 WHERE id = $2`, bf.Data(), s.charID)
doAckBufSucceed(s, pkt.AckHandle, []byte{0x00, 0x00, 0x00, 0x00})
}

View File

@@ -135,7 +135,203 @@ func (s *Session) makeSignResponse(uid uint32) []byte {
bf.WriteUint32(s.server.getLastCID(uid))
bf.WriteUint32(s.server.getUserRights(uid))
ps.Uint16(bf, "", false) // filters
namNGWords := []string{}
msgNGWords := []string{}
filters := byteframe.NewByteFrame()
filters.SetLE()
filters.WriteNullTerminatedBytes([]byte("smc"))
smc := byteframe.NewByteFrame()
smc.SetLE()
smcData := []struct {
charGroup [][]rune
}{
{[][]rune{{'='}, {''}}},
{[][]rune{{')'}, {''}}},
{[][]rune{{'('}, {''}}},
{[][]rune{{'!'}, {''}}},
{[][]rune{{'/'}, {''}}},
{[][]rune{{'+'}, {''}}},
{[][]rune{{'&'}, {''}}},
{[][]rune{{'ぼ'}, {'ボ'}, {'ホ', '゙'}, {'ほ', '゙'}, {'ホ', '゙'}, {'ほ', '゛'}, {'ホ', '゛'}, {'ホ', '゛'}}},
{[][]rune{{'べ'}, {'ベ'}, {'ヘ', '゙'}, {'へ', '゙'}, {'ヘ', '゙'}, {'へ', '゛'}, {'ヘ', '゛'}, {'ヘ', '゛'}}},
{[][]rune{{'で'}, {'デ'}, {'テ', '゙'}, {'て', '゙'}, {'テ', '゙'}, {'て', '゛'}, {'テ', '゛'}, {'テ', '゛'}, {'〒', '゛'}, {'〒', '゙'}, {'乙', '゙'}, {'乙', '゛'}}},
{[][]rune{{'び'}, {'ビ'}, {'ヒ', '゙'}, {'ひ', '゙'}, {'ヒ', '゙'}, {'ひ', '゛'}, {'ヒ', '゛'}, {'ヒ', '゛'}}},
{[][]rune{{'ど'}, {'ド'}, {'ト', '゙'}, {'と', '゙'}, {'ト', '゙'}, {'と', '゛'}, {'ト', '゛'}, {'ト', '゛'}, {'┣', '゙'}, {'┣', '゛'}, {'├', '゙'}, {'├', '゛'}}},
{[][]rune{{'ば'}, {'バ'}, {'ハ', '゙'}, {'は', '゙'}, {'ハ', '゙'}, {'八', '゙'}, {'は', '゛'}, {'ハ', '゛'}, {'ハ', '゛'}, {'八', '゛'}}},
{[][]rune{{'つ', '゙'}, {'ヅ'}, {'ツ', '゙'}, {'つ', '゛'}, {'ツ', '゛'}, {'ツ', '゙'}, {'ツ', '゛'}, {'づ'}, {'っ', '゙'}, {'ッ', '゙'}, {'ッ', '゙'}, {'っ', '゛'}, {'ッ', '゛'}, {'ッ', '゛'}}},
{[][]rune{{'ぶ'}, {'ブ'}, {'フ', '゙'}, {'ヴ'}, {'ウ', '゙'}, {'う', '゛'}, {'う', '゙'}, {'ウ', '゙'}, {'ゥ', '゙'}, {'ぅ', '゙'}, {'ふ', '゙'}, {'フ', '゙'}, {'フ', '゛'}}},
{[][]rune{{'ぢ'}, {'ヂ'}, {'チ', '゙'}, {'ち', '゙'}, {'チ', '゙'}, {'ち', '゛'}, {'チ', '゛'}, {'チ', '゛'}, {'千', '゛'}, {'千', '゙'}}},
{[][]rune{{'だ'}, {'ダ'}, {'タ', '゙'}, {'た', '゙'}, {'タ', '゙'}, {'夕', '゙'}, {'た', '゛'}, {'タ', '゛'}, {'タ', '゛'}, {'夕', '゛'}}},
{[][]rune{{'ぞ'}, {'ゾ'}, {'ソ', '゙'}, {'そ', '゙'}, {'ソ', '゙'}, {'そ', '゛'}, {'ソ', '゛'}, {'ソ', '゛'}, {'ン', '゙'}, {'ン', '゛'}, {'ン', '゛'}, {'ン', '゙'}, {'リ', '゙'}, {'リ', '゙'}, {'リ', '゛'}, {'リ', '゛'}}},
{[][]rune{{'ぜ'}, {'セ', '゙'}, {'せ', '゙'}, {'セ', '゙'}, {'せ', '゛'}, {'セ', '゛'}, {'セ', '゛'}, {'ゼ'}}},
{[][]rune{{'ず'}, {'ズ'}, {'ス', '゙'}, {'す', '゙'}, {'ス', '゙'}, {'す', '゛'}, {'ス', '゛'}, {'ス', '゛'}}},
{[][]rune{{'じ'}, {'ジ'}, {'シ', '゙'}, {'し', '゙'}, {'シ', '゙'}, {'し', '゛'}, {'シ', '゛'}, {'シ', '゛'}}},
{[][]rune{{'ざ'}, {'ザ'}, {'サ', '゙'}, {'さ', '゙'}, {'サ', '゙'}, {'さ', '゛'}, {'サ', '゛'}, {'サ', '゛'}}},
{[][]rune{{'ご'}, {'ゴ'}, {'コ', '゙'}, {'こ', '゙'}, {'コ', '゙'}, {'こ', '゛'}, {'コ', '゛'}, {'コ', '゛'}}},
{[][]rune{{'げ'}, {'ゲ'}, {'ケ', '゙'}, {'け', '゙'}, {'ケ', '゙'}, {'け', '゛'}, {'ケ', '゛'}, {'ケ', '゛'}, {'ヶ', '゙'}, {'ヶ', '゛'}}},
{[][]rune{{'ぐ'}, {'グ'}, {'ク', '゙'}, {'く', '゙'}, {'ク', '゙'}, {'く', '゛'}, {'ク', '゛'}, {'ク', '゛'}}},
{[][]rune{{'ぎ'}, {'ギ'}, {'キ', '゙'}, {'き', '゙'}, {'キ', '゙'}, {'き', '゛'}, {'キ', '゛'}, {'キ', '゛'}}},
{[][]rune{{'が'}, {'ガ'}, {'カ', '゙'}, {'ヵ', '゙'}, {'カ', '゙'}, {'か', '゙'}, {'力', '゙'}, {'ヵ', '゛'}, {'カ', '゛'}, {'か', '゛'}, {'力', '゛'}, {'カ', '゛'}}},
{[][]rune{{'を'}, {'ヲ'}, {'ヲ'}}},
{[][]rune{{'わ'}, {'ワ'}, {'ワ'}, {'ヮ'}}},
{[][]rune{{'ろ'}, {'ロ'}, {'ロ'}, {'□'}, {'口'}}},
{[][]rune{{'れ'}, {'レ'}, {'レ'}}},
{[][]rune{{'る'}, {'ル'}, {'ル'}}},
{[][]rune{{'り'}, {'リ'}, {'リ'}}},
{[][]rune{{'ら'}, {'ラ'}, {'ラ'}}},
{[][]rune{{'よ'}, {'ヨ'}, {'ヨ'}, {'ョ'}, {'ょ'}, {'ョ'}}},
{[][]rune{{'ゆ'}, {'ユ'}, {'ユ'}, {'ュ'}, {'ゅ'}, {'ュ'}}},
{[][]rune{{'や'}, {'ヤ'}, {'ヤ'}, {'ャ'}, {'ゃ'}, {'ャ'}}},
{[][]rune{{'も'}, {'モ'}, {'モ'}}},
{[][]rune{{'め'}, {'メ'}, {'メ'}, {'M', 'E'}}},
{[][]rune{{'む'}, {'ム'}, {'ム'}}},
{[][]rune{{'み'}, {'ミ'}, {'ミ'}}},
{[][]rune{{'ま'}, {'マ'}, {'マ'}}},
{[][]rune{{'ほ'}, {'ホ'}, {'ホ'}}},
{[][]rune{{'へ'}, {'ヘ'}, {'ヘ'}}},
{[][]rune{{'ふ'}, {'フ'}, {'フ'}}},
{[][]rune{{'ひ'}, {'ヒ'}, {'ヒ'}}},
{[][]rune{{'は'}, {'ハ'}, {'ハ'}, {'八'}}},
{[][]rune{{'の'}, {''}, {'ノ'}}},
{[][]rune{{'ね'}, {'ネ'}, {'ネ'}}},
{[][]rune{{'ぬ'}, {'ヌ'}, {'ヌ'}}},
{[][]rune{{'に'}, {'ニ'}, {'ニ'}, {'二'}}},
{[][]rune{{'な'}, {'ナ'}, {'ナ'}}},
{[][]rune{{'と'}, {'ト'}, {'ト'}, {'┣'}, {'├'}}},
{[][]rune{{'て'}, {'テ'}, {'テ'}, {'〒'}, {'乙'}}},
{[][]rune{{'つ'}, {'ツ'}, {'ツ'}, {'っ'}, {'ッ'}, {'ッ'}}},
{[][]rune{{'ち'}, {'チ'}, {'チ'}, {'千'}}},
{[][]rune{{'た'}, {'タ'}, {'タ'}, {'夕'}}},
{[][]rune{{'そ'}, {'ソ'}, {'ソ'}}},
{[][]rune{{'せ'}, {'セ'}, {'セ'}}},
{[][]rune{{'す'}, {'ス'}, {'ス'}}},
{[][]rune{{'し'}, {'シ'}, {'シ'}}},
{[][]rune{{'さ'}, {'サ'}, {'サ'}}},
{[][]rune{{'こ'}, {'コ'}, {'コ'}}},
{[][]rune{{'け'}, {'ケ'}, {'ケ'}, {'ヶ'}}},
{[][]rune{{'く'}, {'ク'}, {'ク'}}},
{[][]rune{{'き'}, {'キ'}, {'キ'}}},
{[][]rune{{'か'}, {'カ'}, {'カ'}, {'ヵ'}, {'力'}}},
{[][]rune{{'お'}, {'オ'}, {'オ'}, {'ォ'}, {'ぉ'}, {'ォ'}}},
{[][]rune{{'え'}, {'エ'}, {'エ'}, {'ェ'}, {'ぇ'}, {'ェ'}, {'工'}}},
{[][]rune{{'う'}, {'ウ'}, {'ウ'}, {'ゥ'}, {'ぅ'}, {'ゥ'}}},
{[][]rune{{'い'}, {'イ'}, {'イ'}, {'ィ'}, {'ぃ'}, {'ィ'}}},
{[][]rune{{'あ'}, {'ア'}, {'ァ'}, {'ア'}, {'ぁ'}, {'ァ'}}},
{[][]rune{{'ー'}, {'―'}, {''}, {'-'}, {''}, {'ー'}, {'一'}}},
{[][]rune{{'9'}, {''}}},
{[][]rune{{'8'}, {''}}},
{[][]rune{{'7'}, {''}}},
{[][]rune{{'6'}, {''}}},
{[][]rune{{'5'}, {''}}},
{[][]rune{{'4'}, {''}}},
{[][]rune{{'3'}, {''}}},
{[][]rune{{'2'}, {''}}},
{[][]rune{{'1'}, {''}}},
{[][]rune{{'ぽ'}, {'ポ'}, {'ホ', '゚'}, {'ほ', '゚'}, {'ホ', '゚'}, {'ホ', '°'}, {'ほ', '°'}, {'ホ', '°'}}},
{[][]rune{{'ぺ'}, {'ペ'}, {'ヘ', '゚'}, {'へ', '゚'}, {'ヘ', '゚'}, {'ヘ', '°'}, {'へ', '°'}, {'ヘ', '°'}}},
{[][]rune{{'ぷ'}, {'プ'}, {'フ', '゚'}, {'ふ', '゚'}, {'フ', '゚'}, {'フ', '°'}, {'ふ', '°'}, {'フ', '°'}}},
{[][]rune{{'ぴ'}, {'ピ'}, {'ヒ', '゚'}, {'ひ', '゚'}, {'ヒ', '゚'}, {'ヒ', '°'}, {'ひ', '°'}, {'ヒ', '°'}}},
{[][]rune{{'ぱ'}, {'パ'}, {'ハ', '゚'}, {'は', '゚'}, {'ハ', '゚'}, {'ハ', '°'}, {'は', '°'}, {'ハ', '°'}, {'八', '゚'}, {'八', '゜'}}},
{[][]rune{{'z'}, {''}, {'Z'}, {''}, {'Ζ'}}},
{[][]rune{{'y'}, {''}, {'Y'}, {''}, {'Υ'}, {'У'}, {'у'}}},
{[][]rune{{'x'}, {''}, {'X'}, {''}, {'Χ'}, {'χ'}, {'Х'}, {'×'}, {'х'}}},
{[][]rune{{'w'}, {''}, {'W'}, {''}, {'ω'}, {'Ш'}, {'ш'}, {'щ'}}},
{[][]rune{{'v'}, {''}, {'V'}, {''}, {'ν'}, {'υ'}}},
{[][]rune{{'u'}, {''}, {'U'}, {''}, {'μ'}, {''}}},
{[][]rune{{'t'}, {''}, {'T'}, {''}, {'Τ'}, {'τ'}, {'Т'}, {'т'}}},
{[][]rune{{'s'}, {''}, {'S'}, {''}, {'∫'}, {''}, {'$'}}},
{[][]rune{{'r'}, {''}, {'R'}, {''}, {'Я'}, {'я'}}},
{[][]rune{{'q'}, {''}, {'Q'}, {''}}},
{[][]rune{{'p'}, {''}, {'P'}, {''}, {'Ρ'}, {'ρ'}, {'Р'}, {'р'}}},
{[][]rune{{'o'}, {''}, {'O'}, {''}, {'○'}, {'Ο'}, {'ο'}, {'О'}, {'о'}, {'◯'}, {''}, {'0'}, {''}}},
{[][]rune{{'n'}, {''}, {'N'}, {''}, {'Ν'}, {'η'}, {'ン'}, {'ん'}, {'ン'}}},
{[][]rune{{'m'}, {''}, {'M'}, {''}, {'Μ'}, {'М'}, {'м'}}},
{[][]rune{{'l'}, {''}, {'L'}, {''}, {'|'}}},
{[][]rune{{'k'}, {''}, {'K'}, {''}, {'Κ'}, {'κ'}, {'К'}, {'к'}}},
{[][]rune{{'j'}, {''}, {'J'}, {''}}},
{[][]rune{{'i'}, {''}, {'I'}, {''}, {'Ι'}}},
{[][]rune{{'h'}, {''}, {'H'}, {''}, {'Η'}, {'Н'}, {'н'}}},
{[][]rune{{'f'}, {''}, {'F'}, {''}}},
{[][]rune{{'g'}, {''}, {'G'}, {''}}},
{[][]rune{{'e'}, {''}, {'E'}, {''}, {'Ε'}, {'ε'}, {'Е'}, {'Ё'}, {'е'}, {'ё'}, {'∈'}}},
{[][]rune{{'d'}, {''}, {'D'}, {''}}},
{[][]rune{{'c'}, {''}, {'C'}, {'С'}, {'с'}, {''}, {'℃'}}},
{[][]rune{{'b'}, {''}, {''}, {'B'}, {'β'}, {'Β'}, {'В'}, {'в'}, {'ъ'}, {'ь'}, {'♭'}}},
{[][]rune{{'\''}, {''}}},
{[][]rune{{'a'}, {''}, {''}, {'A'}, {'α'}, {'@'}, {''}, {'а'}, {'Å'}, {'А'}, {'Α'}}},
{[][]rune{{'"'}, {'”'}}},
{[][]rune{{'%'}, {''}}},
}
for _, smcGroup := range smcData {
for _, smcPair := range smcGroup.charGroup {
smc.WriteUint16(stringsupport.ToNGWord(string(smcPair[0]))[0])
if len(smcPair) > 1 {
smc.WriteUint16(stringsupport.ToNGWord(string(smcPair[1]))[0])
} else {
smc.WriteUint16(0)
}
}
smc.WriteUint32(0)
}
filters.WriteUint32(uint32(len(smc.Data())))
filters.WriteBytes(smc.Data())
filters.WriteNullTerminatedBytes([]byte("nam"))
nam := byteframe.NewByteFrame()
nam.SetLE()
for _, word := range namNGWords {
parts := stringsupport.ToNGWord(word)
nam.WriteUint32(uint32(len(parts)))
for _, part := range parts {
nam.WriteUint16(part)
var i int16
j := int16(-1)
for _, smcGroup := range smcData {
if rune(part) == rune(stringsupport.ToNGWord(string(smcGroup.charGroup[0][0]))[0]) {
j = i
break
}
i += int16(len(smcGroup.charGroup) + 1)
}
nam.WriteInt16(j)
}
nam.WriteUint16(0)
nam.WriteInt16(-1)
}
filters.WriteUint32(uint32(len(nam.Data())))
filters.WriteBytes(nam.Data())
filters.WriteNullTerminatedBytes([]byte("msg"))
msg := byteframe.NewByteFrame()
msg.SetLE()
for _, word := range msgNGWords {
parts := stringsupport.ToNGWord(word)
msg.WriteUint32(uint32(len(parts)))
for _, part := range parts {
msg.WriteUint16(part)
var i int16
j := int16(-1)
for _, smcGroup := range smcData {
if rune(part) == rune(stringsupport.ToNGWord(string(smcGroup.charGroup[0][0]))[0]) {
j = i
break
}
i += int16(len(smcGroup.charGroup) + 1)
}
msg.WriteInt16(j)
}
msg.WriteUint16(0)
msg.WriteInt16(-1)
}
filters.WriteUint32(uint32(len(msg.Data())))
filters.WriteBytes(msg.Data())
bf.WriteUint16(uint16(len(filters.Data())))
bf.WriteBytes(filters.Data())
if s.client == VITA || s.client == PS3 || s.client == PS4 {
var psnUser string
s.server.db.QueryRow("SELECT psn_id FROM users WHERE id = $1", uid).Scan(&psnUser)