mirror of
https://github.com/Mezeporta/Erupe.git
synced 2026-02-06 10:06:53 +01:00
Abracted away broadcast utils
This commit is contained in:
@@ -3,11 +3,13 @@ package channelserver
|
||||
import (
|
||||
"encoding/binary"
|
||||
"erupe-ce/config"
|
||||
"erupe-ce/utils/broadcast"
|
||||
"erupe-ce/utils/db"
|
||||
"erupe-ce/utils/gametime"
|
||||
"erupe-ce/utils/mhfcourse"
|
||||
"erupe-ce/utils/mhfitem"
|
||||
"erupe-ce/utils/mhfmon"
|
||||
|
||||
ps "erupe-ce/utils/pascalstring"
|
||||
"erupe-ce/utils/stringsupport"
|
||||
"fmt"
|
||||
@@ -29,7 +31,7 @@ func stubEnumerateNoResults(s *Session, ackHandle uint32) {
|
||||
enumBf := byteframe.NewByteFrame()
|
||||
enumBf.WriteUint32(0) // Entry count (count for quests, rankings, events, etc.)
|
||||
|
||||
DoAckBufSucceed(s, ackHandle, enumBf.Data())
|
||||
broadcast.DoAckBufSucceed(s, ackHandle, enumBf.Data())
|
||||
}
|
||||
|
||||
func updateRights(s *Session) {
|
||||
@@ -80,7 +82,7 @@ func handleMsgSysTerminalLog(s *Session, p mhfpacket.MHFPacket) {
|
||||
}
|
||||
resp := byteframe.NewByteFrame()
|
||||
resp.WriteUint32(pkt.LogID + 1) // LogID to use for requests after this.
|
||||
DoAckSimpleSucceed(s, pkt.AckHandle, resp.Data())
|
||||
broadcast.DoAckSimpleSucceed(s, pkt.AckHandle, resp.Data())
|
||||
}
|
||||
|
||||
func handleMsgSysLogin(s *Session, p mhfpacket.MHFPacket) {
|
||||
@@ -127,7 +129,7 @@ func handleMsgSysLogin(s *Session, p mhfpacket.MHFPacket) {
|
||||
panic(err)
|
||||
}
|
||||
|
||||
DoAckSimpleSucceed(s, pkt.AckHandle, bf.Data())
|
||||
broadcast.DoAckSimpleSucceed(s, pkt.AckHandle, bf.Data())
|
||||
|
||||
updateRights(s)
|
||||
|
||||
@@ -234,7 +236,7 @@ func handleMsgSysSetStatus(s *Session, p mhfpacket.MHFPacket) {}
|
||||
|
||||
func handleMsgSysPing(s *Session, p mhfpacket.MHFPacket) {
|
||||
pkt := p.(*mhfpacket.MsgSysPing)
|
||||
DoAckSimpleSucceed(s, pkt.AckHandle, []byte{0x00, 0x00, 0x00, 0x00})
|
||||
broadcast.DoAckSimpleSucceed(s, pkt.AckHandle, []byte{0x00, 0x00, 0x00, 0x00})
|
||||
}
|
||||
|
||||
func handleMsgSysTime(s *Session, p mhfpacket.MHFPacket) {
|
||||
@@ -265,7 +267,7 @@ func handleMsgSysIssueLogkey(s *Session, p mhfpacket.MHFPacket) {
|
||||
// Issue it.
|
||||
resp := byteframe.NewByteFrame()
|
||||
resp.WriteBytes(logKey)
|
||||
DoAckBufSucceed(s, pkt.AckHandle, resp.Data())
|
||||
broadcast.DoAckBufSucceed(s, pkt.AckHandle, resp.Data())
|
||||
}
|
||||
|
||||
func handleMsgSysRecordLog(s *Session, p mhfpacket.MHFPacket) {
|
||||
@@ -287,7 +289,7 @@ func handleMsgSysRecordLog(s *Session, p mhfpacket.MHFPacket) {
|
||||
}
|
||||
// remove a client returning to town from reserved slots to make sure the stage is hidden from board
|
||||
delete(s.stage.reservedClientSlots, s.CharID)
|
||||
DoAckSimpleSucceed(s, pkt.AckHandle, make([]byte, 4))
|
||||
broadcast.DoAckSimpleSucceed(s, pkt.AckHandle, make([]byte, 4))
|
||||
}
|
||||
|
||||
func handleMsgSysEcho(s *Session, p mhfpacket.MHFPacket) {}
|
||||
@@ -312,12 +314,12 @@ func handleMsgSysLockGlobalSema(s *Session, p mhfpacket.MHFPacket) {
|
||||
bf.WriteUint8(0)
|
||||
ps.Uint16(bf, pkt.ServerChannelIDString, false)
|
||||
}
|
||||
DoAckBufSucceed(s, pkt.AckHandle, bf.Data())
|
||||
broadcast.DoAckBufSucceed(s, pkt.AckHandle, bf.Data())
|
||||
}
|
||||
|
||||
func handleMsgSysUnlockGlobalSema(s *Session, p mhfpacket.MHFPacket) {
|
||||
pkt := p.(*mhfpacket.MsgSysUnlockGlobalSema)
|
||||
DoAckSimpleSucceed(s, pkt.AckHandle, make([]byte, 4))
|
||||
broadcast.DoAckSimpleSucceed(s, pkt.AckHandle, make([]byte, 4))
|
||||
}
|
||||
|
||||
func handleMsgSysUpdateRight(s *Session, p mhfpacket.MHFPacket) {}
|
||||
@@ -329,7 +331,7 @@ func handleMsgSysAuthTerminal(s *Session, p mhfpacket.MHFPacket) {}
|
||||
func handleMsgSysRightsReload(s *Session, p mhfpacket.MHFPacket) {
|
||||
pkt := p.(*mhfpacket.MsgSysRightsReload)
|
||||
updateRights(s)
|
||||
DoAckSimpleSucceed(s, pkt.AckHandle, []byte{0x00, 0x00, 0x00, 0x00})
|
||||
broadcast.DoAckSimpleSucceed(s, pkt.AckHandle, []byte{0x00, 0x00, 0x00, 0x00})
|
||||
}
|
||||
|
||||
func handleMsgMhfTransitMessage(s *Session, p mhfpacket.MHFPacket) {
|
||||
@@ -578,7 +580,7 @@ func handleMsgMhfTransitMessage(s *Session, p mhfpacket.MHFPacket) {
|
||||
}
|
||||
resp.Seek(0, io.SeekStart)
|
||||
resp.WriteUint16(count)
|
||||
DoAckBufSucceed(s, pkt.AckHandle, resp.Data())
|
||||
broadcast.DoAckBufSucceed(s, pkt.AckHandle, resp.Data())
|
||||
}
|
||||
|
||||
func handleMsgCaExchangeItem(s *Session, p mhfpacket.MHFPacket) {}
|
||||
@@ -588,7 +590,7 @@ func handleMsgMhfServerCommand(s *Session, p mhfpacket.MHFPacket) {}
|
||||
func handleMsgMhfAnnounce(s *Session, p mhfpacket.MHFPacket) {
|
||||
pkt := p.(*mhfpacket.MsgMhfAnnounce)
|
||||
s.Server.BroadcastRaviente(pkt.IPAddress, pkt.Port, pkt.StageID, pkt.Data.ReadUint8())
|
||||
DoAckSimpleSucceed(s, pkt.AckHandle, make([]byte, 4))
|
||||
broadcast.DoAckSimpleSucceed(s, pkt.AckHandle, make([]byte, 4))
|
||||
}
|
||||
|
||||
func handleMsgMhfSetLoginwindow(s *Session, p mhfpacket.MHFPacket) {}
|
||||
@@ -611,7 +613,7 @@ func handleMsgMhfGetCaUniqueID(s *Session, p mhfpacket.MHFPacket) {}
|
||||
|
||||
func handleMsgMhfTransferItem(s *Session, p mhfpacket.MHFPacket) {
|
||||
pkt := p.(*mhfpacket.MsgMhfTransferItem)
|
||||
DoAckSimpleSucceed(s, pkt.AckHandle, []byte{0x00, 0x00, 0x00, 0x00})
|
||||
broadcast.DoAckSimpleSucceed(s, pkt.AckHandle, []byte{0x00, 0x00, 0x00, 0x00})
|
||||
}
|
||||
|
||||
func handleMsgMhfEnumeratePrice(s *Session, p mhfpacket.MHFPacket) {
|
||||
@@ -776,7 +778,7 @@ func handleMsgMhfEnumeratePrice(s *Session, p mhfpacket.MHFPacket) {
|
||||
bf.WriteUint16(gz.Unk3)
|
||||
bf.WriteUint8(gz.Unk4)
|
||||
}
|
||||
DoAckBufSucceed(s, pkt.AckHandle, bf.Data())
|
||||
broadcast.DoAckBufSucceed(s, pkt.AckHandle, bf.Data())
|
||||
}
|
||||
|
||||
func handleMsgMhfEnumerateOrder(s *Session, p mhfpacket.MHFPacket) {
|
||||
@@ -810,7 +812,7 @@ func handleMsgMhfEnumerateUnionItem(s *Session, p mhfpacket.MHFPacket) {
|
||||
items := userGetItems(s)
|
||||
bf := byteframe.NewByteFrame()
|
||||
bf.WriteBytes(mhfitem.SerializeWarehouseItems(items))
|
||||
DoAckBufSucceed(s, pkt.AckHandle, bf.Data())
|
||||
broadcast.DoAckBufSucceed(s, pkt.AckHandle, bf.Data())
|
||||
}
|
||||
|
||||
func handleMsgMhfUpdateUnionItem(s *Session, p mhfpacket.MHFPacket) {
|
||||
@@ -821,7 +823,7 @@ func handleMsgMhfUpdateUnionItem(s *Session, p mhfpacket.MHFPacket) {
|
||||
s.Logger.Fatal(fmt.Sprintf("Failed to get database instance: %s", err))
|
||||
}
|
||||
database.Exec(`UPDATE users u SET item_box=$1 WHERE u.id=(SELECT c.user_id FROM characters c WHERE c.id=$2)`, mhfitem.SerializeWarehouseItems(newStacks), s.CharID)
|
||||
DoAckSimpleSucceed(s, pkt.AckHandle, make([]byte, 4))
|
||||
broadcast.DoAckSimpleSucceed(s, pkt.AckHandle, make([]byte, 4))
|
||||
}
|
||||
|
||||
func handleMsgMhfGetCogInfo(s *Session, p mhfpacket.MHFPacket) {}
|
||||
@@ -855,7 +857,7 @@ func handleMsgMhfCheckWeeklyStamp(s *Session, p mhfpacket.MHFPacket) {
|
||||
bf.WriteUint16(0)
|
||||
bf.WriteUint16(0)
|
||||
bf.WriteUint32(uint32(gametime.TimeWeekStart().Unix()))
|
||||
DoAckBufSucceed(s, pkt.AckHandle, bf.Data())
|
||||
broadcast.DoAckBufSucceed(s, pkt.AckHandle, bf.Data())
|
||||
}
|
||||
|
||||
func handleMsgMhfExchangeWeeklyStamp(s *Session, p mhfpacket.MHFPacket) {
|
||||
@@ -885,7 +887,7 @@ func handleMsgMhfExchangeWeeklyStamp(s *Session, p mhfpacket.MHFPacket) {
|
||||
bf.WriteUint16(tktStack.Item.ItemID)
|
||||
bf.WriteUint16(tktStack.Quantity)
|
||||
bf.WriteUint32(uint32(gametime.TimeWeekStart().Unix()))
|
||||
DoAckBufSucceed(s, pkt.AckHandle, bf.Data())
|
||||
broadcast.DoAckBufSucceed(s, pkt.AckHandle, bf.Data())
|
||||
}
|
||||
|
||||
func getGoocooData(s *Session, cid uint32) [][]byte {
|
||||
@@ -917,7 +919,7 @@ func handleMsgMhfEnumerateGuacot(s *Session, p mhfpacket.MHFPacket) {
|
||||
for _, goocoo := range goocoos {
|
||||
bf.WriteBytes(goocoo)
|
||||
}
|
||||
DoAckBufSucceed(s, pkt.AckHandle, bf.Data())
|
||||
broadcast.DoAckBufSucceed(s, pkt.AckHandle, bf.Data())
|
||||
}
|
||||
|
||||
func handleMsgMhfUpdateGuacot(s *Session, p mhfpacket.MHFPacket) {
|
||||
@@ -944,7 +946,7 @@ func handleMsgMhfUpdateGuacot(s *Session, p mhfpacket.MHFPacket) {
|
||||
dumpSaveData(s, bf.Data(), fmt.Sprintf("goocoo-%d", goocoo.Index))
|
||||
}
|
||||
}
|
||||
DoAckSimpleSucceed(s, pkt.AckHandle, make([]byte, 4))
|
||||
broadcast.DoAckSimpleSucceed(s, pkt.AckHandle, make([]byte, 4))
|
||||
}
|
||||
|
||||
type Scenario struct {
|
||||
@@ -969,7 +971,7 @@ func handleMsgMhfInfoScenarioCounter(s *Session, p mhfpacket.MHFPacket) {
|
||||
if err != nil {
|
||||
scenarioData.Close()
|
||||
s.Logger.Error("Failed to get scenario counter info from db", zap.Error(err))
|
||||
DoAckBufSucceed(s, pkt.AckHandle, make([]byte, 1))
|
||||
broadcast.DoAckBufSucceed(s, pkt.AckHandle, make([]byte, 1))
|
||||
return
|
||||
}
|
||||
for scenarioData.Next() {
|
||||
@@ -998,7 +1000,7 @@ func handleMsgMhfInfoScenarioCounter(s *Session, p mhfpacket.MHFPacket) {
|
||||
}
|
||||
bf.WriteUint8(scenario.CategoryID)
|
||||
}
|
||||
DoAckBufSucceed(s, pkt.AckHandle, bf.Data())
|
||||
broadcast.DoAckBufSucceed(s, pkt.AckHandle, bf.Data())
|
||||
}
|
||||
|
||||
func handleMsgMhfGetEtcPoints(s *Session, p mhfpacket.MHFPacket) {
|
||||
@@ -1020,7 +1022,7 @@ func handleMsgMhfGetEtcPoints(s *Session, p mhfpacket.MHFPacket) {
|
||||
resp.WriteUint32(bonusQuests)
|
||||
resp.WriteUint32(dailyQuests)
|
||||
resp.WriteUint32(promoPoints)
|
||||
DoAckBufSucceed(s, pkt.AckHandle, resp.Data())
|
||||
broadcast.DoAckBufSucceed(s, pkt.AckHandle, resp.Data())
|
||||
}
|
||||
|
||||
func handleMsgMhfUpdateEtcPoint(s *Session, p mhfpacket.MHFPacket) {
|
||||
@@ -1048,7 +1050,7 @@ func handleMsgMhfUpdateEtcPoint(s *Session, p mhfpacket.MHFPacket) {
|
||||
database.Exec(fmt.Sprintf(`UPDATE characters SET %s = %s + $1 WHERE id = $2`, column, column), pkt.Delta, s.CharID)
|
||||
}
|
||||
}
|
||||
DoAckSimpleSucceed(s, pkt.AckHandle, make([]byte, 4))
|
||||
broadcast.DoAckSimpleSucceed(s, pkt.AckHandle, make([]byte, 4))
|
||||
}
|
||||
|
||||
func handleMsgMhfStampcardStamp(s *Session, p mhfpacket.MHFPacket) {
|
||||
@@ -1109,14 +1111,14 @@ func handleMsgMhfStampcardStamp(s *Session, p mhfpacket.MHFPacket) {
|
||||
bf.WriteUint16(rewardUnk)
|
||||
bf.WriteUint16(reward.Item.ItemID)
|
||||
bf.WriteUint16(reward.Quantity)
|
||||
DoAckBufSucceed(s, pkt.AckHandle, bf.Data())
|
||||
broadcast.DoAckBufSucceed(s, pkt.AckHandle, bf.Data())
|
||||
}
|
||||
|
||||
func handleMsgMhfStampcardPrize(s *Session, p mhfpacket.MHFPacket) {}
|
||||
|
||||
func handleMsgMhfUnreserveSrg(s *Session, p mhfpacket.MHFPacket) {
|
||||
pkt := p.(*mhfpacket.MsgMhfUnreserveSrg)
|
||||
DoAckSimpleSucceed(s, pkt.AckHandle, make([]byte, 4))
|
||||
broadcast.DoAckSimpleSucceed(s, pkt.AckHandle, make([]byte, 4))
|
||||
}
|
||||
|
||||
func handleMsgMhfKickExportForce(s *Session, p mhfpacket.MHFPacket) {}
|
||||
@@ -1139,7 +1141,7 @@ func handleMsgMhfGetEarthStatus(s *Session, p mhfpacket.MHFPacket) {
|
||||
}
|
||||
bf.WriteInt32(m)
|
||||
}
|
||||
DoAckBufSucceed(s, pkt.AckHandle, bf.Data())
|
||||
broadcast.DoAckBufSucceed(s, pkt.AckHandle, bf.Data())
|
||||
}
|
||||
|
||||
func handleMsgMhfRegistSpabiTime(s *Session, p mhfpacket.MHFPacket) {}
|
||||
@@ -1178,7 +1180,7 @@ func handleMsgMhfGetEarthValue(s *Session, p mhfpacket.MHFPacket) {
|
||||
}
|
||||
data = append(data, bf)
|
||||
}
|
||||
DoAckEarthSucceed(s, pkt.AckHandle, data)
|
||||
broadcast.DoAckEarthSucceed(s, pkt.AckHandle, data)
|
||||
}
|
||||
|
||||
func handleMsgMhfDebugPostValue(s *Session, p mhfpacket.MHFPacket) {}
|
||||
@@ -1189,7 +1191,7 @@ func handleMsgMhfGetRandFromTable(s *Session, p mhfpacket.MHFPacket) {
|
||||
for i := uint16(0); i < pkt.Results; i++ {
|
||||
bf.WriteUint32(0)
|
||||
}
|
||||
DoAckBufSucceed(s, pkt.AckHandle, bf.Data())
|
||||
broadcast.DoAckBufSucceed(s, pkt.AckHandle, bf.Data())
|
||||
}
|
||||
|
||||
func handleMsgMhfGetSenyuDailyCount(s *Session, p mhfpacket.MHFPacket) {
|
||||
@@ -1197,7 +1199,7 @@ func handleMsgMhfGetSenyuDailyCount(s *Session, p mhfpacket.MHFPacket) {
|
||||
bf := byteframe.NewByteFrame()
|
||||
bf.WriteUint16(0)
|
||||
bf.WriteUint16(0)
|
||||
DoAckBufSucceed(s, pkt.AckHandle, bf.Data())
|
||||
broadcast.DoAckBufSucceed(s, pkt.AckHandle, bf.Data())
|
||||
}
|
||||
|
||||
type SeibattleTimetable struct {
|
||||
@@ -1335,12 +1337,12 @@ func handleMsgMhfGetSeibattle(s *Session, p mhfpacket.MHFPacket) {
|
||||
data = append(data, bf)
|
||||
}
|
||||
}
|
||||
DoAckEarthSucceed(s, pkt.AckHandle, data)
|
||||
broadcast.DoAckEarthSucceed(s, pkt.AckHandle, data)
|
||||
}
|
||||
|
||||
func handleMsgMhfPostSeibattle(s *Session, p mhfpacket.MHFPacket) {
|
||||
pkt := p.(*mhfpacket.MsgMhfPostSeibattle)
|
||||
DoAckSimpleSucceed(s, pkt.AckHandle, make([]byte, 4))
|
||||
broadcast.DoAckSimpleSucceed(s, pkt.AckHandle, make([]byte, 4))
|
||||
}
|
||||
|
||||
func handleMsgMhfGetDailyMissionMaster(s *Session, p mhfpacket.MHFPacket) {}
|
||||
@@ -1373,7 +1375,7 @@ func handleMsgMhfGetEquipSkinHist(s *Session, p mhfpacket.MHFPacket) {
|
||||
s.Logger.Error("Failed to load skin_hist", zap.Error(err))
|
||||
data = make([]byte, size)
|
||||
}
|
||||
DoAckBufSucceed(s, pkt.AckHandle, data)
|
||||
broadcast.DoAckBufSucceed(s, pkt.AckHandle, data)
|
||||
}
|
||||
|
||||
func handleMsgMhfUpdateEquipSkinHist(s *Session, p mhfpacket.MHFPacket) {
|
||||
@@ -1387,7 +1389,7 @@ func handleMsgMhfUpdateEquipSkinHist(s *Session, p mhfpacket.MHFPacket) {
|
||||
err = database.QueryRow("SELECT COALESCE(skin_hist, $2) FROM characters WHERE id = $1", s.CharID, make([]byte, size)).Scan(&data)
|
||||
if err != nil {
|
||||
s.Logger.Error("Failed to get skin_hist", zap.Error(err))
|
||||
DoAckSimpleSucceed(s, pkt.AckHandle, make([]byte, 4))
|
||||
broadcast.DoAckSimpleSucceed(s, pkt.AckHandle, make([]byte, 4))
|
||||
return
|
||||
}
|
||||
|
||||
@@ -1399,14 +1401,14 @@ func handleMsgMhfUpdateEquipSkinHist(s *Session, p mhfpacket.MHFPacket) {
|
||||
data[startByte+byteInd] |= bits.Reverse8(1 << uint(bitInByte))
|
||||
dumpSaveData(s, data, "skinhist")
|
||||
database.Exec("UPDATE characters SET skin_hist=$1 WHERE id=$2", data, s.CharID)
|
||||
DoAckSimpleSucceed(s, pkt.AckHandle, make([]byte, 4))
|
||||
broadcast.DoAckSimpleSucceed(s, pkt.AckHandle, make([]byte, 4))
|
||||
}
|
||||
|
||||
func handleMsgMhfGetUdShopCoin(s *Session, p mhfpacket.MHFPacket) {
|
||||
pkt := p.(*mhfpacket.MsgMhfGetUdShopCoin)
|
||||
bf := byteframe.NewByteFrame()
|
||||
bf.WriteUint32(0)
|
||||
DoAckSimpleSucceed(s, pkt.AckHandle, bf.Data())
|
||||
broadcast.DoAckSimpleSucceed(s, pkt.AckHandle, bf.Data())
|
||||
}
|
||||
|
||||
func handleMsgMhfUseUdShopCoin(s *Session, p mhfpacket.MHFPacket) {}
|
||||
@@ -1424,7 +1426,7 @@ func handleMsgMhfGetEnhancedMinidata(s *Session, p mhfpacket.MHFPacket) {
|
||||
s.Logger.Error("Failed to load minidata")
|
||||
data = make([]byte, 1)
|
||||
}
|
||||
DoAckBufSucceed(s, pkt.AckHandle, data)
|
||||
broadcast.DoAckBufSucceed(s, pkt.AckHandle, data)
|
||||
}
|
||||
|
||||
func handleMsgMhfSetEnhancedMinidata(s *Session, p mhfpacket.MHFPacket) {
|
||||
@@ -1438,7 +1440,7 @@ func handleMsgMhfSetEnhancedMinidata(s *Session, p mhfpacket.MHFPacket) {
|
||||
if err != nil {
|
||||
s.Logger.Error("Failed to save minidata", zap.Error(err))
|
||||
}
|
||||
DoAckSimpleSucceed(s, pkt.AckHandle, []byte{0x00, 0x00, 0x00, 0x00})
|
||||
broadcast.DoAckSimpleSucceed(s, pkt.AckHandle, []byte{0x00, 0x00, 0x00, 0x00})
|
||||
}
|
||||
|
||||
func handleMsgMhfGetLobbyCrowd(s *Session, p mhfpacket.MHFPacket) {
|
||||
@@ -1448,7 +1450,7 @@ func handleMsgMhfGetLobbyCrowd(s *Session, p mhfpacket.MHFPacket) {
|
||||
// It can be worried about later if we ever get to the point where there are
|
||||
// full servers to actually need to migrate people from and empty ones to
|
||||
pkt := p.(*mhfpacket.MsgMhfGetLobbyCrowd)
|
||||
DoAckBufSucceed(s, pkt.AckHandle, make([]byte, 0x320))
|
||||
broadcast.DoAckBufSucceed(s, pkt.AckHandle, make([]byte, 0x320))
|
||||
}
|
||||
|
||||
type TrendWeapon struct {
|
||||
@@ -1488,7 +1490,7 @@ func handleMsgMhfGetTrendWeapon(s *Session, p mhfpacket.MHFPacket) {
|
||||
}
|
||||
bf.Seek(0, 0)
|
||||
bf.WriteUint8(x)
|
||||
DoAckBufSucceed(s, pkt.AckHandle, bf.Data())
|
||||
broadcast.DoAckBufSucceed(s, pkt.AckHandle, bf.Data())
|
||||
}
|
||||
|
||||
func handleMsgMhfUpdateUseTrendWeaponLog(s *Session, p mhfpacket.MHFPacket) {
|
||||
@@ -1499,5 +1501,5 @@ func handleMsgMhfUpdateUseTrendWeaponLog(s *Session, p mhfpacket.MHFPacket) {
|
||||
}
|
||||
database.Exec(`INSERT INTO trend_weapons (weapon_id, weapon_type, count) VALUES ($1, $2, 1) ON CONFLICT (weapon_id) DO
|
||||
UPDATE SET count = trend_weapons.count+1`, pkt.WeaponID, pkt.WeaponType)
|
||||
DoAckSimpleSucceed(s, pkt.AckHandle, make([]byte, 4))
|
||||
broadcast.DoAckSimpleSucceed(s, pkt.AckHandle, make([]byte, 4))
|
||||
}
|
||||
|
||||
@@ -2,6 +2,7 @@ package channelserver
|
||||
|
||||
import (
|
||||
"erupe-ce/network/mhfpacket"
|
||||
"erupe-ce/utils/broadcast"
|
||||
"erupe-ce/utils/byteframe"
|
||||
"erupe-ce/utils/db"
|
||||
"fmt"
|
||||
@@ -105,7 +106,7 @@ func handleMsgMhfGetAchievement(s *Session, p mhfpacket.MHFPacket) {
|
||||
&scores[17], &scores[18], &scores[19], &scores[20], &scores[21], &scores[22], &scores[23], &scores[24],
|
||||
&scores[25], &scores[26], &scores[27], &scores[28], &scores[29], &scores[30], &scores[31], &scores[32])
|
||||
if err != nil {
|
||||
DoAckBufSucceed(s, pkt.AckHandle, make([]byte, 20))
|
||||
broadcast.DoAckBufSucceed(s, pkt.AckHandle, make([]byte, 20))
|
||||
return
|
||||
}
|
||||
|
||||
@@ -141,12 +142,12 @@ func handleMsgMhfGetAchievement(s *Session, p mhfpacket.MHFPacket) {
|
||||
resp.WriteUint32(points)
|
||||
resp.WriteUint32(points)
|
||||
resp.WriteUint32(points)
|
||||
DoAckBufSucceed(s, pkt.AckHandle, resp.Data())
|
||||
broadcast.DoAckBufSucceed(s, pkt.AckHandle, resp.Data())
|
||||
}
|
||||
|
||||
func handleMsgMhfSetCaAchievementHist(s *Session, p mhfpacket.MHFPacket) {
|
||||
pkt := p.(*mhfpacket.MsgMhfSetCaAchievementHist)
|
||||
DoAckSimpleSucceed(s, pkt.AckHandle, []byte{0x00, 0x00, 0x00, 0x00})
|
||||
broadcast.DoAckSimpleSucceed(s, pkt.AckHandle, []byte{0x00, 0x00, 0x00, 0x00})
|
||||
}
|
||||
|
||||
func handleMsgMhfResetAchievement(s *Session, p mhfpacket.MHFPacket) {}
|
||||
|
||||
@@ -3,6 +3,7 @@ package channelserver
|
||||
import (
|
||||
"erupe-ce/config"
|
||||
"erupe-ce/network/mhfpacket"
|
||||
"erupe-ce/utils/broadcast"
|
||||
"erupe-ce/utils/byteframe"
|
||||
"erupe-ce/utils/stringsupport"
|
||||
"erupe-ce/utils/token"
|
||||
@@ -19,7 +20,7 @@ func handleMsgMhfGetBbsUserStatus(s *Session, p mhfpacket.MHFPacket) {
|
||||
bf.WriteUint32(0)
|
||||
bf.WriteUint32(0)
|
||||
bf.WriteUint32(0)
|
||||
DoAckBufSucceed(s, pkt.AckHandle, bf.Data())
|
||||
broadcast.DoAckBufSucceed(s, pkt.AckHandle, bf.Data())
|
||||
}
|
||||
|
||||
// Checks the status of Bultin Board Server to see if authenticated
|
||||
@@ -30,7 +31,7 @@ func handleMsgMhfGetBbsSnsStatus(s *Session, p mhfpacket.MHFPacket) {
|
||||
bf.WriteUint32(401) //unk http status?
|
||||
bf.WriteUint32(401) //unk http status?
|
||||
bf.WriteUint32(0)
|
||||
DoAckBufSucceed(s, pkt.AckHandle, bf.Data())
|
||||
broadcast.DoAckBufSucceed(s, pkt.AckHandle, bf.Data())
|
||||
}
|
||||
|
||||
// Tells the game client what host port and gives the bultin board article a token
|
||||
@@ -49,6 +50,6 @@ func handleMsgMhfApplyBbsArticle(s *Session, p mhfpacket.MHFPacket) {
|
||||
if config.GetConfig().Screenshots.Enabled && config.GetConfig().Discord.Enabled {
|
||||
s.Server.DiscordScreenShotSend(pkt.Name, pkt.Title, pkt.Description, articleToken)
|
||||
}
|
||||
DoAckBufSucceed(s, pkt.AckHandle, bf.Data())
|
||||
broadcast.DoAckBufSucceed(s, pkt.AckHandle, bf.Data())
|
||||
|
||||
}
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
package channelserver
|
||||
|
||||
import (
|
||||
"erupe-ce/utils/broadcast"
|
||||
"erupe-ce/utils/byteframe"
|
||||
"erupe-ce/utils/db"
|
||||
"erupe-ce/utils/gametime"
|
||||
@@ -29,7 +30,7 @@ func handleMsgMhfAcquireCafeItem(s *Session, p mhfpacket.MHFPacket) {
|
||||
}
|
||||
resp := byteframe.NewByteFrame()
|
||||
resp.WriteUint32(netcafePoints)
|
||||
DoAckSimpleSucceed(s, pkt.AckHandle, resp.Data())
|
||||
broadcast.DoAckSimpleSucceed(s, pkt.AckHandle, resp.Data())
|
||||
}
|
||||
|
||||
func handleMsgMhfUpdateCafepoint(s *Session, p mhfpacket.MHFPacket) {
|
||||
@@ -45,7 +46,7 @@ func handleMsgMhfUpdateCafepoint(s *Session, p mhfpacket.MHFPacket) {
|
||||
}
|
||||
resp := byteframe.NewByteFrame()
|
||||
resp.WriteUint32(netcafePoints)
|
||||
DoAckSimpleSucceed(s, pkt.AckHandle, resp.Data())
|
||||
broadcast.DoAckSimpleSucceed(s, pkt.AckHandle, resp.Data())
|
||||
}
|
||||
|
||||
func handleMsgMhfCheckDailyCafepoint(s *Session, p mhfpacket.MHFPacket) {
|
||||
@@ -82,7 +83,7 @@ func handleMsgMhfCheckDailyCafepoint(s *Session, p mhfpacket.MHFPacket) {
|
||||
bf.WriteUint32(bondBonus)
|
||||
bf.WriteUint32(bonusQuests)
|
||||
bf.WriteUint32(dailyQuests)
|
||||
DoAckBufSucceed(s, pkt.AckHandle, bf.Data())
|
||||
broadcast.DoAckBufSucceed(s, pkt.AckHandle, bf.Data())
|
||||
}
|
||||
|
||||
func handleMsgMhfGetCafeDuration(s *Session, p mhfpacket.MHFPacket) {
|
||||
@@ -117,7 +118,7 @@ func handleMsgMhfGetCafeDuration(s *Session, p mhfpacket.MHFPacket) {
|
||||
bf.WriteUint16(0)
|
||||
ps.Uint16(bf, fmt.Sprintf(s.Server.i18n.cafe.reset, int(cafeReset.Month()), cafeReset.Day()), true)
|
||||
}
|
||||
DoAckBufSucceed(s, pkt.AckHandle, bf.Data())
|
||||
broadcast.DoAckBufSucceed(s, pkt.AckHandle, bf.Data())
|
||||
}
|
||||
|
||||
type CafeBonus struct {
|
||||
@@ -147,7 +148,7 @@ func handleMsgMhfGetCafeDurationBonusInfo(s *Session, p mhfpacket.MHFPacket) {
|
||||
FROM cafebonus cb ORDER BY id ASC;`, s.CharID)
|
||||
if err != nil {
|
||||
s.Logger.Error("Error getting cafebonus", zap.Error(err))
|
||||
DoAckBufSucceed(s, pkt.AckHandle, make([]byte, 4))
|
||||
broadcast.DoAckBufSucceed(s, pkt.AckHandle, make([]byte, 4))
|
||||
} else {
|
||||
for rows.Next() {
|
||||
count++
|
||||
@@ -167,7 +168,7 @@ func handleMsgMhfGetCafeDurationBonusInfo(s *Session, p mhfpacket.MHFPacket) {
|
||||
resp.WriteUint32(uint32(gametime.TimeAdjusted().Unix()))
|
||||
resp.WriteUint32(count)
|
||||
resp.WriteBytes(bf.Data())
|
||||
DoAckBufSucceed(s, pkt.AckHandle, resp.Data())
|
||||
broadcast.DoAckBufSucceed(s, pkt.AckHandle, resp.Data())
|
||||
}
|
||||
}
|
||||
|
||||
@@ -193,7 +194,7 @@ func handleMsgMhfReceiveCafeDurationBonus(s *Session, p mhfpacket.MHFPacket) {
|
||||
WHERE ch.id = $1
|
||||
) >= time_req`, s.CharID, gametime.TimeAdjusted().Unix()-s.sessionStart)
|
||||
if err != nil {
|
||||
DoAckBufSucceed(s, pkt.AckHandle, bf.Data())
|
||||
broadcast.DoAckBufSucceed(s, pkt.AckHandle, bf.Data())
|
||||
} else {
|
||||
for rows.Next() {
|
||||
cafeBonus := &CafeBonus{}
|
||||
@@ -209,7 +210,7 @@ func handleMsgMhfReceiveCafeDurationBonus(s *Session, p mhfpacket.MHFPacket) {
|
||||
}
|
||||
bf.Seek(0, io.SeekStart)
|
||||
bf.WriteUint32(count)
|
||||
DoAckBufSucceed(s, pkt.AckHandle, bf.Data())
|
||||
broadcast.DoAckBufSucceed(s, pkt.AckHandle, bf.Data())
|
||||
}
|
||||
}
|
||||
|
||||
@@ -231,7 +232,7 @@ func handleMsgMhfPostCafeDurationBonusReceived(s *Session, p mhfpacket.MHFPacket
|
||||
}
|
||||
database.Exec("INSERT INTO public.cafe_accepted VALUES ($1, $2)", cbID, s.CharID)
|
||||
}
|
||||
DoAckSimpleSucceed(s, pkt.AckHandle, make([]byte, 4))
|
||||
broadcast.DoAckSimpleSucceed(s, pkt.AckHandle, make([]byte, 4))
|
||||
}
|
||||
|
||||
func addPointNetcafe(s *Session, p int) error {
|
||||
@@ -263,17 +264,17 @@ func handleMsgMhfStartBoostTime(s *Session, p mhfpacket.MHFPacket) {
|
||||
boostLimit := gametime.TimeAdjusted().Add(time.Duration(config.GetConfig().GameplayOptions.BoostTimeDuration) * time.Second)
|
||||
if config.GetConfig().GameplayOptions.DisableBoostTime {
|
||||
bf.WriteUint32(0)
|
||||
DoAckBufSucceed(s, pkt.AckHandle, bf.Data())
|
||||
broadcast.DoAckBufSucceed(s, pkt.AckHandle, bf.Data())
|
||||
return
|
||||
}
|
||||
database.Exec("UPDATE characters SET boost_time=$1 WHERE id=$2", boostLimit, s.CharID)
|
||||
bf.WriteUint32(uint32(boostLimit.Unix()))
|
||||
DoAckBufSucceed(s, pkt.AckHandle, bf.Data())
|
||||
broadcast.DoAckBufSucceed(s, pkt.AckHandle, bf.Data())
|
||||
}
|
||||
|
||||
func handleMsgMhfGetBoostTime(s *Session, p mhfpacket.MHFPacket) {
|
||||
pkt := p.(*mhfpacket.MsgMhfGetBoostTime)
|
||||
DoAckBufSucceed(s, pkt.AckHandle, []byte{})
|
||||
broadcast.DoAckBufSucceed(s, pkt.AckHandle, []byte{})
|
||||
}
|
||||
|
||||
func handleMsgMhfGetBoostTimeLimit(s *Session, p mhfpacket.MHFPacket) {
|
||||
@@ -290,8 +291,8 @@ func handleMsgMhfGetBoostTimeLimit(s *Session, p mhfpacket.MHFPacket) {
|
||||
} else {
|
||||
bf.WriteUint32(uint32(boostLimit.Unix()))
|
||||
}
|
||||
DoAckBufSucceed(s, pkt.AckHandle, bf.Data())
|
||||
DoAckSimpleSucceed(s, pkt.AckHandle, make([]byte, 4))
|
||||
broadcast.DoAckBufSucceed(s, pkt.AckHandle, bf.Data())
|
||||
broadcast.DoAckSimpleSucceed(s, pkt.AckHandle, make([]byte, 4))
|
||||
}
|
||||
|
||||
func handleMsgMhfGetBoostRight(s *Session, p mhfpacket.MHFPacket) {
|
||||
@@ -303,27 +304,27 @@ func handleMsgMhfGetBoostRight(s *Session, p mhfpacket.MHFPacket) {
|
||||
}
|
||||
err = database.QueryRow("SELECT boost_time FROM characters WHERE id=$1", s.CharID).Scan(&boostLimit)
|
||||
if err != nil {
|
||||
DoAckBufSucceed(s, pkt.AckHandle, []byte{0x00, 0x00, 0x00, 0x00})
|
||||
broadcast.DoAckBufSucceed(s, pkt.AckHandle, []byte{0x00, 0x00, 0x00, 0x00})
|
||||
return
|
||||
}
|
||||
if boostLimit.After(gametime.TimeAdjusted()) {
|
||||
DoAckBufSucceed(s, pkt.AckHandle, []byte{0x00, 0x00, 0x00, 0x01})
|
||||
broadcast.DoAckBufSucceed(s, pkt.AckHandle, []byte{0x00, 0x00, 0x00, 0x01})
|
||||
} else {
|
||||
DoAckBufSucceed(s, pkt.AckHandle, []byte{0x00, 0x00, 0x00, 0x02})
|
||||
broadcast.DoAckBufSucceed(s, pkt.AckHandle, []byte{0x00, 0x00, 0x00, 0x02})
|
||||
}
|
||||
}
|
||||
|
||||
func handleMsgMhfPostBoostTimeQuestReturn(s *Session, p mhfpacket.MHFPacket) {
|
||||
pkt := p.(*mhfpacket.MsgMhfPostBoostTimeQuestReturn)
|
||||
DoAckSimpleSucceed(s, pkt.AckHandle, []byte{0x00, 0x00, 0x00, 0x00})
|
||||
broadcast.DoAckSimpleSucceed(s, pkt.AckHandle, []byte{0x00, 0x00, 0x00, 0x00})
|
||||
}
|
||||
|
||||
func handleMsgMhfPostBoostTime(s *Session, p mhfpacket.MHFPacket) {
|
||||
pkt := p.(*mhfpacket.MsgMhfPostBoostTime)
|
||||
DoAckSimpleSucceed(s, pkt.AckHandle, make([]byte, 4))
|
||||
broadcast.DoAckSimpleSucceed(s, pkt.AckHandle, make([]byte, 4))
|
||||
}
|
||||
|
||||
func handleMsgMhfPostBoostTimeLimit(s *Session, p mhfpacket.MHFPacket) {
|
||||
pkt := p.(*mhfpacket.MsgMhfPostBoostTimeLimit)
|
||||
DoAckSimpleSucceed(s, pkt.AckHandle, make([]byte, 4))
|
||||
broadcast.DoAckSimpleSucceed(s, pkt.AckHandle, make([]byte, 4))
|
||||
}
|
||||
|
||||
@@ -3,6 +3,7 @@ package channelserver
|
||||
import (
|
||||
"erupe-ce/config"
|
||||
"erupe-ce/network/mhfpacket"
|
||||
"erupe-ce/utils/broadcast"
|
||||
"erupe-ce/utils/byteframe"
|
||||
ps "erupe-ce/utils/pascalstring"
|
||||
"erupe-ce/utils/stringsupport"
|
||||
@@ -129,7 +130,7 @@ func handleMsgMhfEnumerateCampaign(s *Session, p mhfpacket.MHFPacket) {
|
||||
bf.WriteUint16(link.CategoryID)
|
||||
bf.WriteUint32(link.CampaignID)
|
||||
}
|
||||
DoAckBufSucceed(s, pkt.AckHandle, bf.Data())
|
||||
broadcast.DoAckBufSucceed(s, pkt.AckHandle, bf.Data())
|
||||
}
|
||||
|
||||
func handleMsgMhfStateCampaign(s *Session, p mhfpacket.MHFPacket) {
|
||||
@@ -137,14 +138,14 @@ func handleMsgMhfStateCampaign(s *Session, p mhfpacket.MHFPacket) {
|
||||
bf := byteframe.NewByteFrame()
|
||||
bf.WriteUint16(1)
|
||||
bf.WriteUint16(0)
|
||||
DoAckBufSucceed(s, pkt.AckHandle, bf.Data())
|
||||
broadcast.DoAckBufSucceed(s, pkt.AckHandle, bf.Data())
|
||||
}
|
||||
|
||||
func handleMsgMhfApplyCampaign(s *Session, p mhfpacket.MHFPacket) {
|
||||
pkt := p.(*mhfpacket.MsgMhfApplyCampaign)
|
||||
bf := byteframe.NewByteFrame()
|
||||
bf.WriteUint32(1)
|
||||
DoAckSimpleSucceed(s, pkt.AckHandle, bf.Data())
|
||||
broadcast.DoAckSimpleSucceed(s, pkt.AckHandle, bf.Data())
|
||||
}
|
||||
|
||||
func handleMsgMhfEnumerateItem(s *Session, p mhfpacket.MHFPacket) {
|
||||
@@ -167,10 +168,10 @@ func handleMsgMhfEnumerateItem(s *Session, p mhfpacket.MHFPacket) {
|
||||
bf.WriteUint32(item.Unk4)
|
||||
bf.WriteUint32(item.Unk5)
|
||||
}
|
||||
DoAckBufSucceed(s, pkt.AckHandle, bf.Data())
|
||||
broadcast.DoAckBufSucceed(s, pkt.AckHandle, bf.Data())
|
||||
}
|
||||
|
||||
func handleMsgMhfAcquireItem(s *Session, p mhfpacket.MHFPacket) {
|
||||
pkt := p.(*mhfpacket.MsgMhfAcquireItem)
|
||||
DoAckSimpleSucceed(s, pkt.AckHandle, make([]byte, 4))
|
||||
broadcast.DoAckSimpleSucceed(s, pkt.AckHandle, make([]byte, 4))
|
||||
}
|
||||
|
||||
@@ -2,6 +2,7 @@ package channelserver
|
||||
|
||||
import (
|
||||
"erupe-ce/network/mhfpacket"
|
||||
"erupe-ce/utils/broadcast"
|
||||
"erupe-ce/utils/byteframe"
|
||||
"erupe-ce/utils/stringsupport"
|
||||
"time"
|
||||
@@ -67,7 +68,7 @@ func handleMsgMhfGetRyoudama(s *Session, p mhfpacket.MHFPacket) {
|
||||
data = append(data, bf)
|
||||
}
|
||||
}
|
||||
DoAckEarthSucceed(s, pkt.AckHandle, data)
|
||||
broadcast.DoAckEarthSucceed(s, pkt.AckHandle, data)
|
||||
}
|
||||
|
||||
func handleMsgMhfPostRyoudama(s *Session, p mhfpacket.MHFPacket) {}
|
||||
@@ -75,12 +76,12 @@ func handleMsgMhfPostRyoudama(s *Session, p mhfpacket.MHFPacket) {}
|
||||
func handleMsgMhfGetTinyBin(s *Session, p mhfpacket.MHFPacket) {
|
||||
pkt := p.(*mhfpacket.MsgMhfGetTinyBin)
|
||||
// requested after conquest quests
|
||||
DoAckBufSucceed(s, pkt.AckHandle, []byte{})
|
||||
broadcast.DoAckBufSucceed(s, pkt.AckHandle, []byte{})
|
||||
}
|
||||
|
||||
func handleMsgMhfPostTinyBin(s *Session, p mhfpacket.MHFPacket) {
|
||||
pkt := p.(*mhfpacket.MsgMhfPostTinyBin)
|
||||
DoAckSimpleSucceed(s, pkt.AckHandle, make([]byte, 4))
|
||||
broadcast.DoAckSimpleSucceed(s, pkt.AckHandle, make([]byte, 4))
|
||||
}
|
||||
|
||||
func handleMsgMhfCaravanMyScore(s *Session, p mhfpacket.MHFPacket) {
|
||||
@@ -92,7 +93,7 @@ func handleMsgMhfCaravanMyScore(s *Session, p mhfpacket.MHFPacket) {
|
||||
bf.WriteInt32(0)
|
||||
bf.WriteInt32(0)
|
||||
*/
|
||||
DoAckEarthSucceed(s, pkt.AckHandle, data)
|
||||
broadcast.DoAckEarthSucceed(s, pkt.AckHandle, data)
|
||||
}
|
||||
|
||||
func handleMsgMhfCaravanRanking(s *Session, p mhfpacket.MHFPacket) {
|
||||
@@ -108,7 +109,7 @@ func handleMsgMhfCaravanRanking(s *Session, p mhfpacket.MHFPacket) {
|
||||
bf.WriteInt32(1)
|
||||
bf.WriteBytes(stringsupport.PaddedString("Test", 14, true))
|
||||
*/
|
||||
DoAckEarthSucceed(s, pkt.AckHandle, data)
|
||||
broadcast.DoAckEarthSucceed(s, pkt.AckHandle, data)
|
||||
}
|
||||
|
||||
func handleMsgMhfCaravanMyRank(s *Session, p mhfpacket.MHFPacket) {
|
||||
@@ -119,5 +120,5 @@ func handleMsgMhfCaravanMyRank(s *Session, p mhfpacket.MHFPacket) {
|
||||
bf.WriteInt32(0)
|
||||
bf.WriteInt32(0)
|
||||
*/
|
||||
DoAckEarthSucceed(s, pkt.AckHandle, data)
|
||||
broadcast.DoAckEarthSucceed(s, pkt.AckHandle, data)
|
||||
}
|
||||
|
||||
@@ -5,6 +5,7 @@ import (
|
||||
"errors"
|
||||
"erupe-ce/config"
|
||||
"erupe-ce/utils/bfutil"
|
||||
"erupe-ce/utils/broadcast"
|
||||
"erupe-ce/utils/db"
|
||||
"erupe-ce/utils/stringsupport"
|
||||
"fmt"
|
||||
@@ -260,5 +261,5 @@ func (save *CharacterSaveData) updateStructWithSaveData() {
|
||||
|
||||
func handleMsgMhfSexChanger(s *Session, p mhfpacket.MHFPacket) {
|
||||
pkt := p.(*mhfpacket.MsgMhfSexChanger)
|
||||
DoAckSimpleSucceed(s, pkt.AckHandle, make([]byte, 4))
|
||||
broadcast.DoAckSimpleSucceed(s, pkt.AckHandle, make([]byte, 4))
|
||||
}
|
||||
|
||||
@@ -2,6 +2,7 @@ package channelserver
|
||||
|
||||
import (
|
||||
"erupe-ce/network/mhfpacket"
|
||||
"erupe-ce/utils/broadcast"
|
||||
"erupe-ce/utils/byteframe"
|
||||
"erupe-ce/utils/db"
|
||||
"erupe-ce/utils/stringsupport"
|
||||
@@ -18,7 +19,7 @@ func handleMsgSysEnumerateClient(s *Session, p mhfpacket.MHFPacket) {
|
||||
if !ok {
|
||||
s.Server.stagesLock.RUnlock()
|
||||
s.Logger.Warn("Can't enumerate clients for stage that doesn't exist!", zap.String("stageID", pkt.StageID))
|
||||
DoAckSimpleFail(s, pkt.AckHandle, make([]byte, 4))
|
||||
broadcast.DoAckSimpleFail(s, pkt.AckHandle, make([]byte, 4))
|
||||
return
|
||||
}
|
||||
s.Server.stagesLock.RUnlock()
|
||||
@@ -54,7 +55,7 @@ func handleMsgSysEnumerateClient(s *Session, p mhfpacket.MHFPacket) {
|
||||
}
|
||||
stage.RUnlock()
|
||||
|
||||
DoAckBufSucceed(s, pkt.AckHandle, resp.Data())
|
||||
broadcast.DoAckBufSucceed(s, pkt.AckHandle, resp.Data())
|
||||
s.Logger.Debug("MsgSysEnumerateClient Done!")
|
||||
}
|
||||
|
||||
@@ -85,7 +86,7 @@ func handleMsgMhfListMember(s *Session, p mhfpacket.MHFPacket) {
|
||||
}
|
||||
resp.Seek(0, 0)
|
||||
resp.WriteUint32(count)
|
||||
DoAckBufSucceed(s, pkt.AckHandle, resp.Data())
|
||||
broadcast.DoAckBufSucceed(s, pkt.AckHandle, resp.Data())
|
||||
}
|
||||
|
||||
func handleMsgMhfOprMember(s *Session, p mhfpacket.MHFPacket) {
|
||||
@@ -118,7 +119,7 @@ func handleMsgMhfOprMember(s *Session, p mhfpacket.MHFPacket) {
|
||||
}
|
||||
}
|
||||
}
|
||||
DoAckSimpleSucceed(s, pkt.AckHandle, make([]byte, 4))
|
||||
broadcast.DoAckSimpleSucceed(s, pkt.AckHandle, make([]byte, 4))
|
||||
}
|
||||
|
||||
func handleMsgMhfShutClient(s *Session, p mhfpacket.MHFPacket) {}
|
||||
|
||||
@@ -2,6 +2,7 @@ package channelserver
|
||||
|
||||
import (
|
||||
"erupe-ce/config"
|
||||
"erupe-ce/utils/broadcast"
|
||||
"erupe-ce/utils/db"
|
||||
"erupe-ce/utils/gametime"
|
||||
"erupe-ce/utils/mhfmon"
|
||||
@@ -38,7 +39,7 @@ func handleMsgMhfSavedata(s *Session, p mhfpacket.MHFPacket) {
|
||||
diff, err := nullcomp.Decompress(pkt.RawDataPayload)
|
||||
if err != nil {
|
||||
s.Logger.Error("Failed to decompress diff", zap.Error(err))
|
||||
DoAckSimpleSucceed(s, pkt.AckHandle, make([]byte, 4))
|
||||
broadcast.DoAckSimpleSucceed(s, pkt.AckHandle, make([]byte, 4))
|
||||
return
|
||||
}
|
||||
// Perform diff.
|
||||
@@ -50,7 +51,7 @@ func handleMsgMhfSavedata(s *Session, p mhfpacket.MHFPacket) {
|
||||
saveData, err := nullcomp.Decompress(pkt.RawDataPayload)
|
||||
if err != nil {
|
||||
s.Logger.Error("Failed to decompress savedata from packet", zap.Error(err))
|
||||
DoAckSimpleSucceed(s, pkt.AckHandle, make([]byte, 4))
|
||||
broadcast.DoAckSimpleSucceed(s, pkt.AckHandle, make([]byte, 4))
|
||||
return
|
||||
}
|
||||
if config.GetConfig().SaveDumps.RawEnabled {
|
||||
@@ -81,7 +82,7 @@ func handleMsgMhfSavedata(s *Session, p mhfpacket.MHFPacket) {
|
||||
if err != nil {
|
||||
s.Logger.Error("Failed to update character name in db", zap.Error(err))
|
||||
}
|
||||
DoAckSimpleSucceed(s, pkt.AckHandle, make([]byte, 4))
|
||||
broadcast.DoAckSimpleSucceed(s, pkt.AckHandle, make([]byte, 4))
|
||||
}
|
||||
|
||||
func grpToGR(n int) uint16 {
|
||||
@@ -153,7 +154,7 @@ func handleMsgMhfLoaddata(s *Session, p mhfpacket.MHFPacket) {
|
||||
}
|
||||
if _, err := os.Stat(filepath.Join(config.GetConfig().BinPath, "save_override.bin")); err == nil {
|
||||
data, _ := os.ReadFile(filepath.Join(config.GetConfig().BinPath, "save_override.bin"))
|
||||
DoAckBufSucceed(s, pkt.AckHandle, data)
|
||||
broadcast.DoAckBufSucceed(s, pkt.AckHandle, data)
|
||||
return
|
||||
}
|
||||
|
||||
@@ -164,7 +165,7 @@ func handleMsgMhfLoaddata(s *Session, p mhfpacket.MHFPacket) {
|
||||
s.rawConn.Close() // Terminate the connection
|
||||
return
|
||||
}
|
||||
DoAckBufSucceed(s, pkt.AckHandle, data)
|
||||
broadcast.DoAckBufSucceed(s, pkt.AckHandle, data)
|
||||
|
||||
decompSaveData, err := nullcomp.Decompress(data)
|
||||
if err != nil {
|
||||
@@ -190,7 +191,7 @@ func handleMsgMhfSaveScenarioData(s *Session, p mhfpacket.MHFPacket) {
|
||||
if err != nil {
|
||||
s.Logger.Error("Failed to update scenario data in db", zap.Error(err))
|
||||
}
|
||||
DoAckSimpleSucceed(s, pkt.AckHandle, make([]byte, 4))
|
||||
broadcast.DoAckSimpleSucceed(s, pkt.AckHandle, make([]byte, 4))
|
||||
}
|
||||
|
||||
func handleMsgMhfLoadScenarioData(s *Session, p mhfpacket.MHFPacket) {
|
||||
@@ -208,7 +209,7 @@ func handleMsgMhfLoadScenarioData(s *Session, p mhfpacket.MHFPacket) {
|
||||
} else {
|
||||
bf.WriteBytes(scenarioData)
|
||||
}
|
||||
DoAckBufSucceed(s, pkt.AckHandle, bf.Data())
|
||||
broadcast.DoAckBufSucceed(s, pkt.AckHandle, bf.Data())
|
||||
}
|
||||
|
||||
var paperGiftData = map[uint32][]PaperGift{
|
||||
@@ -1545,7 +1546,7 @@ func handleMsgMhfGetPaperData(s *Session, p mhfpacket.MHFPacket) {
|
||||
bf.WriteUint16(gift.Unk3)
|
||||
data = append(data, bf)
|
||||
}
|
||||
DoAckEarthSucceed(s, pkt.AckHandle, data)
|
||||
broadcast.DoAckEarthSucceed(s, pkt.AckHandle, data)
|
||||
} else if pkt.Unk2 == 0 {
|
||||
bf := byteframe.NewByteFrame()
|
||||
bf.WriteUint16(uint16(len(paperMissions.Timetables)))
|
||||
@@ -1563,7 +1564,7 @@ func handleMsgMhfGetPaperData(s *Session, p mhfpacket.MHFPacket) {
|
||||
bf.WriteUint16(mdata.Reward2ID)
|
||||
bf.WriteUint8(mdata.Reward2Quantity)
|
||||
}
|
||||
DoAckBufSucceed(s, pkt.AckHandle, bf.Data())
|
||||
broadcast.DoAckBufSucceed(s, pkt.AckHandle, bf.Data())
|
||||
} else {
|
||||
for _, pdata := range paperData {
|
||||
bf := byteframe.NewByteFrame()
|
||||
@@ -1576,7 +1577,7 @@ func handleMsgMhfGetPaperData(s *Session, p mhfpacket.MHFPacket) {
|
||||
bf.WriteInt16(pdata.Unk6)
|
||||
data = append(data, bf)
|
||||
}
|
||||
DoAckEarthSucceed(s, pkt.AckHandle, data)
|
||||
broadcast.DoAckEarthSucceed(s, pkt.AckHandle, data)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -3,6 +3,7 @@ package channelserver
|
||||
import (
|
||||
"erupe-ce/config"
|
||||
"erupe-ce/network/mhfpacket"
|
||||
"erupe-ce/utils/broadcast"
|
||||
"erupe-ce/utils/byteframe"
|
||||
"erupe-ce/utils/db"
|
||||
ps "erupe-ce/utils/pascalstring"
|
||||
@@ -122,7 +123,7 @@ func handleMsgMhfEnumerateDistItem(s *Session, p mhfpacket.MHFPacket) {
|
||||
}
|
||||
}
|
||||
}
|
||||
DoAckBufSucceed(s, pkt.AckHandle, bf.Data())
|
||||
broadcast.DoAckBufSucceed(s, pkt.AckHandle, bf.Data())
|
||||
}
|
||||
|
||||
type DistributionItem struct {
|
||||
@@ -166,7 +167,7 @@ func handleMsgMhfApplyDistItem(s *Session, p mhfpacket.MHFPacket) {
|
||||
bf.WriteUint32(item.ID)
|
||||
}
|
||||
}
|
||||
DoAckBufSucceed(s, pkt.AckHandle, bf.Data())
|
||||
broadcast.DoAckBufSucceed(s, pkt.AckHandle, bf.Data())
|
||||
}
|
||||
|
||||
func handleMsgMhfAcquireDistItem(s *Session, p mhfpacket.MHFPacket) {
|
||||
@@ -199,7 +200,7 @@ func handleMsgMhfAcquireDistItem(s *Session, p mhfpacket.MHFPacket) {
|
||||
}
|
||||
}
|
||||
}
|
||||
DoAckSimpleSucceed(s, pkt.AckHandle, make([]byte, 4))
|
||||
broadcast.DoAckSimpleSucceed(s, pkt.AckHandle, make([]byte, 4))
|
||||
}
|
||||
|
||||
func handleMsgMhfGetDistDescription(s *Session, p mhfpacket.MHFPacket) {
|
||||
@@ -212,11 +213,11 @@ func handleMsgMhfGetDistDescription(s *Session, p mhfpacket.MHFPacket) {
|
||||
err = database.QueryRow("SELECT description FROM distribution WHERE id = $1", pkt.DistributionID).Scan(&desc)
|
||||
if err != nil {
|
||||
s.Logger.Error("Error parsing item distribution description", zap.Error(err))
|
||||
DoAckBufSucceed(s, pkt.AckHandle, make([]byte, 4))
|
||||
broadcast.DoAckBufSucceed(s, pkt.AckHandle, make([]byte, 4))
|
||||
return
|
||||
}
|
||||
bf := byteframe.NewByteFrame()
|
||||
ps.Uint16(bf, desc, true)
|
||||
ps.Uint16(bf, "", false)
|
||||
DoAckBufSucceed(s, pkt.AckHandle, bf.Data())
|
||||
broadcast.DoAckBufSucceed(s, pkt.AckHandle, bf.Data())
|
||||
}
|
||||
|
||||
@@ -3,6 +3,7 @@ package channelserver
|
||||
import (
|
||||
"encoding/hex"
|
||||
config "erupe-ce/config"
|
||||
"erupe-ce/utils/broadcast"
|
||||
"erupe-ce/utils/db"
|
||||
"erupe-ce/utils/gametime"
|
||||
"erupe-ce/utils/stringsupport"
|
||||
@@ -87,9 +88,9 @@ func handleMsgMhfGetUdSchedule(s *Session, p mhfpacket.MHFPacket) {
|
||||
if config.GetConfig().DebugOptions.DivaOverride >= 0 {
|
||||
if config.GetConfig().DebugOptions.DivaOverride == 0 {
|
||||
if config.GetConfig().ClientID >= config.Z2 {
|
||||
DoAckBufSucceed(s, pkt.AckHandle, make([]byte, 36))
|
||||
broadcast.DoAckBufSucceed(s, pkt.AckHandle, make([]byte, 36))
|
||||
} else {
|
||||
DoAckBufSucceed(s, pkt.AckHandle, make([]byte, 32))
|
||||
broadcast.DoAckBufSucceed(s, pkt.AckHandle, make([]byte, 32))
|
||||
}
|
||||
return
|
||||
}
|
||||
@@ -110,7 +111,7 @@ func handleMsgMhfGetUdSchedule(s *Session, p mhfpacket.MHFPacket) {
|
||||
bf.WriteUint16(0x02) // Unk 00000010
|
||||
bf.WriteUint16(0x02) // Unk 00000010
|
||||
|
||||
DoAckBufSucceed(s, pkt.AckHandle, bf.Data())
|
||||
broadcast.DoAckBufSucceed(s, pkt.AckHandle, bf.Data())
|
||||
}
|
||||
|
||||
func handleMsgMhfGetUdInfo(s *Session, p mhfpacket.MHFPacket) {
|
||||
@@ -130,45 +131,45 @@ func handleMsgMhfGetUdInfo(s *Session, p mhfpacket.MHFPacket) {
|
||||
resp.WriteUint32(uint32(udInfo.EndTime.Unix()))
|
||||
}
|
||||
|
||||
DoAckBufSucceed(s, pkt.AckHandle, resp.Data())
|
||||
broadcast.DoAckBufSucceed(s, pkt.AckHandle, resp.Data())
|
||||
}
|
||||
|
||||
func handleMsgMhfGetKijuInfo(s *Session, p mhfpacket.MHFPacket) {
|
||||
pkt := p.(*mhfpacket.MsgMhfGetKijuInfo)
|
||||
// Temporary canned response
|
||||
data, _ := hex.DecodeString("04965C959782CC8B468EEC00000000000000000000000000000000000000000000815C82A082E782B582DC82A982BA82CC82AB82B682E3815C0A965C959782C682CD96D282E98E7682A281420A95B782AD8ED282C997458B4382F0975E82A682E98142000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001018BAD8C8282CC8B468EEC00000000000000000000000000000000000000000000815C82AB82E582A482B082AB82CC82AB82B682E3815C0A8BAD8C8282C682CD8BAD82A290BA904681420A95B782AD8ED282CC97CD82F08CA482AC909F82DC82B78142200000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000003138C8B8F5782CC8B468EEC00000000000000000000000000000000000000000000815C82AF82C182B582E382A482CC82AB82B682E3815C0A8C8B8F5782C682CD8A6D8CC582BD82E9904D978A81420A8F5782DF82E982D982C782C98EEB906C82BD82BF82CC90B8905F97CD82C682C882E9814200000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000041189CC8CEC82CC8B468EEC00000000000000000000000000000000000000000000815C82A482BD82DC82E082E882CC82AB82B682E3815C0A89CC8CEC82C682CD89CC955082CC8CEC82E881420A8F5782DF82E982D982C782C98EEB906C82BD82BF82CC8E7882A682C682C882E9814220000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000212")
|
||||
DoAckBufSucceed(s, pkt.AckHandle, data)
|
||||
broadcast.DoAckBufSucceed(s, pkt.AckHandle, data)
|
||||
}
|
||||
|
||||
func handleMsgMhfSetKiju(s *Session, p mhfpacket.MHFPacket) {
|
||||
pkt := p.(*mhfpacket.MsgMhfSetKiju)
|
||||
DoAckSimpleSucceed(s, pkt.AckHandle, []byte{0x00, 0x00, 0x00, 0x00})
|
||||
broadcast.DoAckSimpleSucceed(s, pkt.AckHandle, []byte{0x00, 0x00, 0x00, 0x00})
|
||||
}
|
||||
|
||||
func handleMsgMhfAddUdPoint(s *Session, p mhfpacket.MHFPacket) {
|
||||
pkt := p.(*mhfpacket.MsgMhfAddUdPoint)
|
||||
DoAckSimpleSucceed(s, pkt.AckHandle, []byte{0x00, 0x00, 0x00, 0x00})
|
||||
broadcast.DoAckSimpleSucceed(s, pkt.AckHandle, []byte{0x00, 0x00, 0x00, 0x00})
|
||||
}
|
||||
|
||||
func handleMsgMhfGetUdMyPoint(s *Session, p mhfpacket.MHFPacket) {
|
||||
pkt := p.(*mhfpacket.MsgMhfGetUdMyPoint)
|
||||
// Temporary canned response
|
||||
data, _ := hex.DecodeString("00040000013C000000FA000000000000000000040000007E0000003C02000000000000000000000000000000000000000000000000000002000004CC00000438000000000000000000000000000000000000000000000000000000020000026E00000230000000000000000000020000007D0000007D000000000000000000000000000000000000000000000000000000")
|
||||
DoAckBufSucceed(s, pkt.AckHandle, data)
|
||||
broadcast.DoAckBufSucceed(s, pkt.AckHandle, data)
|
||||
}
|
||||
|
||||
func handleMsgMhfGetUdTotalPointInfo(s *Session, p mhfpacket.MHFPacket) {
|
||||
pkt := p.(*mhfpacket.MsgMhfGetUdTotalPointInfo)
|
||||
// Temporary canned response
|
||||
data, _ := hex.DecodeString("00000000000007A12000000000000F424000000000001E848000000000002DC6C000000000003D090000000000004C4B4000000000005B8D8000000000006ACFC000000000007A1200000000000089544000000000009896800000000000E4E1C00000000001312D0000000000017D78400000000001C9C3800000000002160EC00000000002625A000000000002AEA5400000000002FAF0800000000003473BC0000000000393870000000000042C1D800000000004C4B40000000000055D4A800000000005F5E10000000000008954400000000001C9C3800000000003473BC00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001020300000000000000000000000000000000000000000000000000000000000000000000000000000000101F1420")
|
||||
DoAckBufSucceed(s, pkt.AckHandle, data)
|
||||
broadcast.DoAckBufSucceed(s, pkt.AckHandle, data)
|
||||
}
|
||||
|
||||
func handleMsgMhfGetUdSelectedColorInfo(s *Session, p mhfpacket.MHFPacket) {
|
||||
pkt := p.(*mhfpacket.MsgMhfGetUdSelectedColorInfo)
|
||||
|
||||
// Unk
|
||||
DoAckBufSucceed(s, pkt.AckHandle, []byte{0x00, 0x01, 0x01, 0x01, 0x02, 0x03, 0x02, 0x00, 0x00})
|
||||
broadcast.DoAckBufSucceed(s, pkt.AckHandle, []byte{0x00, 0x01, 0x01, 0x01, 0x02, 0x03, 0x02, 0x00, 0x00})
|
||||
}
|
||||
|
||||
func handleMsgMhfGetUdMonsterPoint(s *Session, p mhfpacket.MHFPacket) {
|
||||
@@ -300,36 +301,36 @@ func handleMsgMhfGetUdMonsterPoint(s *Session, p mhfpacket.MHFPacket) {
|
||||
resp.WriteUint16(mp.Points)
|
||||
}
|
||||
|
||||
DoAckBufSucceed(s, pkt.AckHandle, resp.Data())
|
||||
broadcast.DoAckBufSucceed(s, pkt.AckHandle, resp.Data())
|
||||
}
|
||||
|
||||
func handleMsgMhfGetUdDailyPresentList(s *Session, p mhfpacket.MHFPacket) {
|
||||
pkt := p.(*mhfpacket.MsgMhfGetUdDailyPresentList)
|
||||
// Temporary canned response
|
||||
data, _ := hex.DecodeString("0100001600000A5397DF00000000000000000000000000000000")
|
||||
DoAckBufSucceed(s, pkt.AckHandle, data)
|
||||
broadcast.DoAckBufSucceed(s, pkt.AckHandle, data)
|
||||
}
|
||||
|
||||
func handleMsgMhfGetUdNormaPresentList(s *Session, p mhfpacket.MHFPacket) {
|
||||
pkt := p.(*mhfpacket.MsgMhfGetUdNormaPresentList)
|
||||
// Temporary canned response
|
||||
data, _ := hex.DecodeString("0100001600000A5397DF00000000000000000000000000000000")
|
||||
DoAckBufSucceed(s, pkt.AckHandle, data)
|
||||
broadcast.DoAckBufSucceed(s, pkt.AckHandle, data)
|
||||
}
|
||||
|
||||
func handleMsgMhfAcquireUdItem(s *Session, p mhfpacket.MHFPacket) {
|
||||
pkt := p.(*mhfpacket.MsgMhfAcquireUdItem)
|
||||
DoAckSimpleSucceed(s, pkt.AckHandle, []byte{0x00, 0x00, 0x00, 0x00})
|
||||
broadcast.DoAckSimpleSucceed(s, pkt.AckHandle, []byte{0x00, 0x00, 0x00, 0x00})
|
||||
}
|
||||
|
||||
func handleMsgMhfGetUdRanking(s *Session, p mhfpacket.MHFPacket) {
|
||||
pkt := p.(*mhfpacket.MsgMhfGetUdRanking)
|
||||
DoAckSimpleSucceed(s, pkt.AckHandle, []byte{0x00, 0x00, 0x00, 0x00})
|
||||
broadcast.DoAckSimpleSucceed(s, pkt.AckHandle, []byte{0x00, 0x00, 0x00, 0x00})
|
||||
}
|
||||
|
||||
func handleMsgMhfGetUdMyRanking(s *Session, p mhfpacket.MHFPacket) {
|
||||
pkt := p.(*mhfpacket.MsgMhfGetUdMyRanking)
|
||||
// Temporary canned response
|
||||
data, _ := hex.DecodeString("00000515000005150000CEB4000003CE000003CE0000CEB44D49444E494748542D414E47454C0000000000000000000000")
|
||||
DoAckBufSucceed(s, pkt.AckHandle, data)
|
||||
broadcast.DoAckBufSucceed(s, pkt.AckHandle, data)
|
||||
}
|
||||
|
||||
@@ -2,6 +2,7 @@ package channelserver
|
||||
|
||||
import (
|
||||
"erupe-ce/config"
|
||||
"erupe-ce/utils/broadcast"
|
||||
"erupe-ce/utils/db"
|
||||
"erupe-ce/utils/gametime"
|
||||
"erupe-ce/utils/token"
|
||||
@@ -47,7 +48,7 @@ func handleMsgMhfEnumerateEvent(s *Session, p mhfpacket.MHFPacket) {
|
||||
}
|
||||
}
|
||||
|
||||
DoAckBufSucceed(s, pkt.AckHandle, bf.Data())
|
||||
broadcast.DoAckBufSucceed(s, pkt.AckHandle, bf.Data())
|
||||
}
|
||||
|
||||
type activeFeature struct {
|
||||
@@ -88,7 +89,7 @@ func handleMsgMhfGetWeeklySchedule(s *Session, p mhfpacket.MHFPacket) {
|
||||
bf.WriteUint32(feature.ActiveFeatures)
|
||||
bf.WriteUint16(0)
|
||||
}
|
||||
DoAckBufSucceed(s, pkt.AckHandle, bf.Data())
|
||||
broadcast.DoAckBufSucceed(s, pkt.AckHandle, bf.Data())
|
||||
}
|
||||
|
||||
func generateFeatureWeapons(count int) activeFeature {
|
||||
@@ -146,7 +147,7 @@ func handleMsgMhfGetKeepLoginBoostStatus(s *Session, p mhfpacket.MHFPacket) {
|
||||
rows, err := database.Queryx("SELECT week_req, expiration, reset FROM login_boost WHERE char_id=$1 ORDER BY week_req", s.CharID)
|
||||
if err != nil || config.GetConfig().GameplayOptions.DisableLoginBoost {
|
||||
rows.Close()
|
||||
DoAckBufSucceed(s, pkt.AckHandle, make([]byte, 35))
|
||||
broadcast.DoAckBufSucceed(s, pkt.AckHandle, make([]byte, 35))
|
||||
return
|
||||
}
|
||||
for rows.Next() {
|
||||
@@ -199,7 +200,7 @@ func handleMsgMhfGetKeepLoginBoostStatus(s *Session, p mhfpacket.MHFPacket) {
|
||||
}
|
||||
}
|
||||
|
||||
DoAckBufSucceed(s, pkt.AckHandle, bf.Data())
|
||||
broadcast.DoAckBufSucceed(s, pkt.AckHandle, bf.Data())
|
||||
}
|
||||
|
||||
func handleMsgMhfUseKeepLoginBoost(s *Session, p mhfpacket.MHFPacket) {
|
||||
@@ -221,12 +222,12 @@ func handleMsgMhfUseKeepLoginBoost(s *Session, p mhfpacket.MHFPacket) {
|
||||
s.Logger.Fatal(fmt.Sprintf("Failed to get database instance: %s", err))
|
||||
}
|
||||
database.Exec(`UPDATE login_boost SET expiration=$1, reset=$2 WHERE char_id=$3 AND week_req=$4`, expiration, gametime.TimeWeekNext(), s.CharID, pkt.BoostWeekUsed)
|
||||
DoAckBufSucceed(s, pkt.AckHandle, bf.Data())
|
||||
broadcast.DoAckBufSucceed(s, pkt.AckHandle, bf.Data())
|
||||
}
|
||||
|
||||
func handleMsgMhfGetRestrictionEvent(s *Session, p mhfpacket.MHFPacket) {}
|
||||
|
||||
func handleMsgMhfSetRestrictionEvent(s *Session, p mhfpacket.MHFPacket) {
|
||||
pkt := p.(*mhfpacket.MsgMhfSetRestrictionEvent)
|
||||
DoAckSimpleSucceed(s, pkt.AckHandle, make([]byte, 4))
|
||||
broadcast.DoAckSimpleSucceed(s, pkt.AckHandle, make([]byte, 4))
|
||||
}
|
||||
|
||||
@@ -3,6 +3,7 @@ package channelserver
|
||||
import (
|
||||
"erupe-ce/config"
|
||||
"erupe-ce/network/mhfpacket"
|
||||
"erupe-ce/utils/broadcast"
|
||||
"erupe-ce/utils/byteframe"
|
||||
"erupe-ce/utils/db"
|
||||
"erupe-ce/utils/gametime"
|
||||
@@ -20,7 +21,7 @@ func handleMsgMhfSaveMezfesData(s *Session, p mhfpacket.MHFPacket) {
|
||||
s.Logger.Fatal(fmt.Sprintf("Failed to get database instance: %s", err))
|
||||
}
|
||||
database.Exec(`UPDATE characters SET mezfes=$1 WHERE id=$2`, pkt.RawDataPayload, s.CharID)
|
||||
DoAckSimpleSucceed(s, pkt.AckHandle, []byte{0x00, 0x00, 0x00, 0x00})
|
||||
broadcast.DoAckSimpleSucceed(s, pkt.AckHandle, []byte{0x00, 0x00, 0x00, 0x00})
|
||||
}
|
||||
|
||||
func handleMsgMhfLoadMezfesData(s *Session, p mhfpacket.MHFPacket) {
|
||||
@@ -41,7 +42,7 @@ func handleMsgMhfLoadMezfesData(s *Session, p mhfpacket.MHFPacket) {
|
||||
bf.WriteUint32(0)
|
||||
bf.WriteUint32(0)
|
||||
}
|
||||
DoAckBufSucceed(s, pkt.AckHandle, bf.Data())
|
||||
broadcast.DoAckBufSucceed(s, pkt.AckHandle, bf.Data())
|
||||
}
|
||||
|
||||
func handleMsgMhfEnumerateRanking(s *Session, p mhfpacket.MHFPacket) {
|
||||
@@ -74,7 +75,7 @@ func handleMsgMhfEnumerateRanking(s *Session, p mhfpacket.MHFPacket) {
|
||||
bf.WriteUint32(uint32(gametime.TimeAdjusted().Unix())) // TS Current Time
|
||||
bf.WriteUint8(3)
|
||||
bf.WriteBytes(make([]byte, 4))
|
||||
DoAckBufSucceed(s, pkt.AckHandle, bf.Data())
|
||||
broadcast.DoAckBufSucceed(s, pkt.AckHandle, bf.Data())
|
||||
return
|
||||
}
|
||||
bf.WriteUint32(uint32(gametime.TimeAdjusted().Unix())) // TS Current Time
|
||||
@@ -100,7 +101,7 @@ func handleMsgMhfEnumerateRanking(s *Session, p mhfpacket.MHFPacket) {
|
||||
psUint16 desc
|
||||
*/
|
||||
|
||||
DoAckBufSucceed(s, pkt.AckHandle, bf.Data())
|
||||
broadcast.DoAckBufSucceed(s, pkt.AckHandle, bf.Data())
|
||||
}
|
||||
|
||||
func cleanupFesta(s *Session) {
|
||||
@@ -198,7 +199,7 @@ func handleMsgMhfInfoFesta(s *Session, p mhfpacket.MHFPacket) {
|
||||
var timestamps []uint32
|
||||
if config.GetConfig().DebugOptions.FestaOverride >= 0 {
|
||||
if config.GetConfig().DebugOptions.FestaOverride == 0 {
|
||||
DoAckBufSucceed(s, pkt.AckHandle, make([]byte, 4))
|
||||
broadcast.DoAckBufSucceed(s, pkt.AckHandle, make([]byte, 4))
|
||||
return
|
||||
}
|
||||
timestamps = generateFestaTimestamps(s, uint32(config.GetConfig().DebugOptions.FestaOverride), true)
|
||||
@@ -207,7 +208,7 @@ func handleMsgMhfInfoFesta(s *Session, p mhfpacket.MHFPacket) {
|
||||
}
|
||||
|
||||
if timestamps[0] > uint32(gametime.TimeAdjusted().Unix()) {
|
||||
DoAckBufSucceed(s, pkt.AckHandle, make([]byte, 4))
|
||||
broadcast.DoAckBufSucceed(s, pkt.AckHandle, make([]byte, 4))
|
||||
return
|
||||
}
|
||||
|
||||
@@ -372,7 +373,7 @@ func handleMsgMhfInfoFesta(s *Session, p mhfpacket.MHFPacket) {
|
||||
if config.GetConfig().ClientID >= config.G52 {
|
||||
ps.Uint16(bf, "", false)
|
||||
}
|
||||
DoAckBufSucceed(s, pkt.AckHandle, bf.Data())
|
||||
broadcast.DoAckBufSucceed(s, pkt.AckHandle, bf.Data())
|
||||
}
|
||||
|
||||
// state festa (U)ser
|
||||
@@ -388,7 +389,7 @@ func handleMsgMhfStateFestaU(s *Session, p mhfpacket.MHFPacket) {
|
||||
applicant, _ = guild.HasApplicationForCharID(s, s.CharID)
|
||||
}
|
||||
if err != nil || guild == nil || applicant {
|
||||
DoAckSimpleFail(s, pkt.AckHandle, make([]byte, 4))
|
||||
broadcast.DoAckSimpleFail(s, pkt.AckHandle, make([]byte, 4))
|
||||
return
|
||||
}
|
||||
var souls, exists uint32
|
||||
@@ -403,7 +404,7 @@ func handleMsgMhfStateFestaU(s *Session, p mhfpacket.MHFPacket) {
|
||||
bf.WriteBool(false)
|
||||
bf.WriteBool(true)
|
||||
}
|
||||
DoAckBufSucceed(s, pkt.AckHandle, bf.Data())
|
||||
broadcast.DoAckBufSucceed(s, pkt.AckHandle, bf.Data())
|
||||
}
|
||||
|
||||
// state festa (G)uild
|
||||
@@ -421,7 +422,7 @@ func handleMsgMhfStateFestaG(s *Session, p mhfpacket.MHFPacket) {
|
||||
resp.WriteInt32(-1)
|
||||
resp.WriteInt32(0)
|
||||
resp.WriteInt32(0)
|
||||
DoAckBufSucceed(s, pkt.AckHandle, resp.Data())
|
||||
broadcast.DoAckBufSucceed(s, pkt.AckHandle, resp.Data())
|
||||
return
|
||||
}
|
||||
resp.WriteUint32(guild.Souls)
|
||||
@@ -429,19 +430,19 @@ func handleMsgMhfStateFestaG(s *Session, p mhfpacket.MHFPacket) {
|
||||
resp.WriteInt32(1) // unk, rank?
|
||||
resp.WriteInt32(1) // unk
|
||||
resp.WriteInt32(1) // unk
|
||||
DoAckBufSucceed(s, pkt.AckHandle, resp.Data())
|
||||
broadcast.DoAckBufSucceed(s, pkt.AckHandle, resp.Data())
|
||||
}
|
||||
|
||||
func handleMsgMhfEnumerateFestaMember(s *Session, p mhfpacket.MHFPacket) {
|
||||
pkt := p.(*mhfpacket.MsgMhfEnumerateFestaMember)
|
||||
guild, err := GetGuildInfoByCharacterId(s, s.CharID)
|
||||
if err != nil || guild == nil {
|
||||
DoAckSimpleFail(s, pkt.AckHandle, make([]byte, 4))
|
||||
broadcast.DoAckSimpleFail(s, pkt.AckHandle, make([]byte, 4))
|
||||
return
|
||||
}
|
||||
members, err := GetGuildMembers(s, guild.ID, false)
|
||||
if err != nil {
|
||||
DoAckSimpleFail(s, pkt.AckHandle, make([]byte, 4))
|
||||
broadcast.DoAckSimpleFail(s, pkt.AckHandle, make([]byte, 4))
|
||||
return
|
||||
}
|
||||
sort.Slice(members, func(i, j int) bool {
|
||||
@@ -465,7 +466,7 @@ func handleMsgMhfEnumerateFestaMember(s *Session, p mhfpacket.MHFPacket) {
|
||||
bf.WriteUint32(member.Souls)
|
||||
}
|
||||
}
|
||||
DoAckBufSucceed(s, pkt.AckHandle, bf.Data())
|
||||
broadcast.DoAckBufSucceed(s, pkt.AckHandle, bf.Data())
|
||||
}
|
||||
|
||||
func handleMsgMhfVoteFesta(s *Session, p mhfpacket.MHFPacket) {
|
||||
@@ -475,7 +476,7 @@ func handleMsgMhfVoteFesta(s *Session, p mhfpacket.MHFPacket) {
|
||||
s.Logger.Fatal(fmt.Sprintf("Failed to get database instance: %s", err))
|
||||
}
|
||||
database.Exec(`UPDATE guild_characters SET trial_vote=$1 WHERE character_id=$2`, pkt.TrialID, s.CharID)
|
||||
DoAckSimpleSucceed(s, pkt.AckHandle, make([]byte, 4))
|
||||
broadcast.DoAckSimpleSucceed(s, pkt.AckHandle, make([]byte, 4))
|
||||
}
|
||||
|
||||
func handleMsgMhfEntryFesta(s *Session, p mhfpacket.MHFPacket) {
|
||||
@@ -486,7 +487,7 @@ func handleMsgMhfEntryFesta(s *Session, p mhfpacket.MHFPacket) {
|
||||
}
|
||||
guild, err := GetGuildInfoByCharacterId(s, s.CharID)
|
||||
if err != nil || guild == nil {
|
||||
DoAckSimpleFail(s, pkt.AckHandle, make([]byte, 4))
|
||||
broadcast.DoAckSimpleFail(s, pkt.AckHandle, make([]byte, 4))
|
||||
return
|
||||
}
|
||||
team := uint32(token.RNG.Intn(2))
|
||||
@@ -498,7 +499,7 @@ func handleMsgMhfEntryFesta(s *Session, p mhfpacket.MHFPacket) {
|
||||
}
|
||||
bf := byteframe.NewByteFrame()
|
||||
bf.WriteUint32(team)
|
||||
DoAckSimpleSucceed(s, pkt.AckHandle, bf.Data())
|
||||
broadcast.DoAckSimpleSucceed(s, pkt.AckHandle, bf.Data())
|
||||
}
|
||||
|
||||
func handleMsgMhfChargeFesta(s *Session, p mhfpacket.MHFPacket) {
|
||||
@@ -515,7 +516,7 @@ func handleMsgMhfChargeFesta(s *Session, p mhfpacket.MHFPacket) {
|
||||
_, _ = tx.Exec(`INSERT INTO festa_submissions VALUES ($1, $2, $3, $4, now())`, s.CharID, pkt.GuildID, i, pkt.Souls[i])
|
||||
}
|
||||
_ = tx.Commit()
|
||||
DoAckSimpleSucceed(s, pkt.AckHandle, make([]byte, 4))
|
||||
broadcast.DoAckSimpleSucceed(s, pkt.AckHandle, make([]byte, 4))
|
||||
}
|
||||
|
||||
func handleMsgMhfAcquireFesta(s *Session, p mhfpacket.MHFPacket) {
|
||||
@@ -525,7 +526,7 @@ func handleMsgMhfAcquireFesta(s *Session, p mhfpacket.MHFPacket) {
|
||||
s.Logger.Fatal(fmt.Sprintf("Failed to get database instance: %s", err))
|
||||
}
|
||||
database.Exec("INSERT INTO public.festa_prizes_accepted VALUES (0, $1)", s.CharID)
|
||||
DoAckSimpleSucceed(s, pkt.AckHandle, make([]byte, 4))
|
||||
broadcast.DoAckSimpleSucceed(s, pkt.AckHandle, make([]byte, 4))
|
||||
}
|
||||
|
||||
func handleMsgMhfAcquireFestaPersonalPrize(s *Session, p mhfpacket.MHFPacket) {
|
||||
@@ -535,7 +536,7 @@ func handleMsgMhfAcquireFestaPersonalPrize(s *Session, p mhfpacket.MHFPacket) {
|
||||
s.Logger.Fatal(fmt.Sprintf("Failed to get database instance: %s", err))
|
||||
}
|
||||
database.Exec("INSERT INTO public.festa_prizes_accepted VALUES ($1, $2)", pkt.PrizeID, s.CharID)
|
||||
DoAckSimpleSucceed(s, pkt.AckHandle, make([]byte, 4))
|
||||
broadcast.DoAckSimpleSucceed(s, pkt.AckHandle, make([]byte, 4))
|
||||
}
|
||||
|
||||
func handleMsgMhfAcquireFestaIntermediatePrize(s *Session, p mhfpacket.MHFPacket) {
|
||||
@@ -545,7 +546,7 @@ func handleMsgMhfAcquireFestaIntermediatePrize(s *Session, p mhfpacket.MHFPacket
|
||||
s.Logger.Fatal(fmt.Sprintf("Failed to get database instance: %s", err))
|
||||
}
|
||||
database.Exec("INSERT INTO public.festa_prizes_accepted VALUES ($1, $2)", pkt.PrizeID, s.CharID)
|
||||
DoAckSimpleSucceed(s, pkt.AckHandle, make([]byte, 4))
|
||||
broadcast.DoAckSimpleSucceed(s, pkt.AckHandle, make([]byte, 4))
|
||||
}
|
||||
|
||||
type Prize struct {
|
||||
@@ -584,7 +585,7 @@ func handleMsgMhfEnumerateFestaPersonalPrize(s *Session, p mhfpacket.MHFPacket)
|
||||
bf := byteframe.NewByteFrame()
|
||||
bf.WriteUint32(count)
|
||||
bf.WriteBytes(prizeData.Data())
|
||||
DoAckBufSucceed(s, pkt.AckHandle, bf.Data())
|
||||
broadcast.DoAckBufSucceed(s, pkt.AckHandle, bf.Data())
|
||||
}
|
||||
|
||||
func handleMsgMhfEnumerateFestaIntermediatePrize(s *Session, p mhfpacket.MHFPacket) {
|
||||
@@ -614,5 +615,5 @@ func handleMsgMhfEnumerateFestaIntermediatePrize(s *Session, p mhfpacket.MHFPack
|
||||
bf := byteframe.NewByteFrame()
|
||||
bf.WriteUint32(count)
|
||||
bf.WriteBytes(prizeData.Data())
|
||||
DoAckBufSucceed(s, pkt.AckHandle, bf.Data())
|
||||
broadcast.DoAckBufSucceed(s, pkt.AckHandle, bf.Data())
|
||||
}
|
||||
|
||||
@@ -6,9 +6,11 @@ import (
|
||||
"encoding/json"
|
||||
"errors"
|
||||
"erupe-ce/config"
|
||||
"erupe-ce/utils/broadcast"
|
||||
"erupe-ce/utils/db"
|
||||
"erupe-ce/utils/gametime"
|
||||
"erupe-ce/utils/mhfitem"
|
||||
|
||||
"fmt"
|
||||
"math"
|
||||
"sort"
|
||||
@@ -682,7 +684,7 @@ func HandleMsgMhfCreateGuild(s *Session, p mhfpacket.MHFPacket) {
|
||||
// style message, it's better than nothing for now.
|
||||
bf.WriteUint32(0x01010101)
|
||||
|
||||
DoAckSimpleFail(s, pkt.AckHandle, bf.Data())
|
||||
broadcast.DoAckSimpleFail(s, pkt.AckHandle, bf.Data())
|
||||
return
|
||||
}
|
||||
|
||||
@@ -690,7 +692,7 @@ func HandleMsgMhfCreateGuild(s *Session, p mhfpacket.MHFPacket) {
|
||||
|
||||
bf.WriteUint32(uint32(guildId))
|
||||
|
||||
DoAckSimpleSucceed(s, pkt.AckHandle, bf.Data())
|
||||
broadcast.DoAckSimpleSucceed(s, pkt.AckHandle, bf.Data())
|
||||
}
|
||||
|
||||
func HandleMsgMhfOperateGuild(s *Session, p mhfpacket.MHFPacket) {
|
||||
@@ -699,7 +701,7 @@ func HandleMsgMhfOperateGuild(s *Session, p mhfpacket.MHFPacket) {
|
||||
guild, err := GetGuildInfoByID(s, pkt.GuildID)
|
||||
characterGuildInfo, err := GetCharacterGuildData(s, s.CharID)
|
||||
if err != nil {
|
||||
DoAckSimpleFail(s, pkt.AckHandle, make([]byte, 4))
|
||||
broadcast.DoAckSimpleFail(s, pkt.AckHandle, make([]byte, 4))
|
||||
return
|
||||
}
|
||||
database, err := db.GetDB()
|
||||
@@ -778,14 +780,14 @@ func HandleMsgMhfOperateGuild(s *Session, p mhfpacket.MHFPacket) {
|
||||
handleAvoidLeadershipUpdate(s, pkt, false)
|
||||
case mhfpacket.OperateGuildUpdateComment:
|
||||
if !characterGuildInfo.IsLeader && !characterGuildInfo.IsSubLeader() {
|
||||
DoAckSimpleFail(s, pkt.AckHandle, make([]byte, 4))
|
||||
broadcast.DoAckSimpleFail(s, pkt.AckHandle, make([]byte, 4))
|
||||
return
|
||||
}
|
||||
guild.Comment = stringsupport.SJISToUTF8(pkt.Data2.ReadNullTerminatedBytes())
|
||||
guild.Save(s)
|
||||
case mhfpacket.OperateGuildUpdateMotto:
|
||||
if !characterGuildInfo.IsLeader && !characterGuildInfo.IsSubLeader() {
|
||||
DoAckSimpleFail(s, pkt.AckHandle, make([]byte, 4))
|
||||
broadcast.DoAckSimpleFail(s, pkt.AckHandle, make([]byte, 4))
|
||||
return
|
||||
}
|
||||
_ = pkt.Data1.ReadUint16()
|
||||
@@ -825,9 +827,9 @@ func HandleMsgMhfOperateGuild(s *Session, p mhfpacket.MHFPacket) {
|
||||
}
|
||||
|
||||
if len(bf.Data()) > 0 {
|
||||
DoAckSimpleSucceed(s, pkt.AckHandle, bf.Data())
|
||||
broadcast.DoAckSimpleSucceed(s, pkt.AckHandle, bf.Data())
|
||||
} else {
|
||||
DoAckSimpleSucceed(s, pkt.AckHandle, make([]byte, 4))
|
||||
broadcast.DoAckSimpleSucceed(s, pkt.AckHandle, make([]byte, 4))
|
||||
}
|
||||
}
|
||||
|
||||
@@ -901,7 +903,7 @@ func handleAvoidLeadershipUpdate(s *Session, pkt *mhfpacket.MsgMhfOperateGuild,
|
||||
characterGuildData, err := GetCharacterGuildData(s, s.CharID)
|
||||
|
||||
if err != nil {
|
||||
DoAckSimpleFail(s, pkt.AckHandle, make([]byte, 4))
|
||||
broadcast.DoAckSimpleFail(s, pkt.AckHandle, make([]byte, 4))
|
||||
return
|
||||
}
|
||||
|
||||
@@ -910,11 +912,11 @@ func handleAvoidLeadershipUpdate(s *Session, pkt *mhfpacket.MsgMhfOperateGuild,
|
||||
err = characterGuildData.Save(s)
|
||||
|
||||
if err != nil {
|
||||
DoAckSimpleFail(s, pkt.AckHandle, make([]byte, 4))
|
||||
broadcast.DoAckSimpleFail(s, pkt.AckHandle, make([]byte, 4))
|
||||
return
|
||||
}
|
||||
|
||||
DoAckSimpleSucceed(s, pkt.AckHandle, make([]byte, 4))
|
||||
broadcast.DoAckSimpleSucceed(s, pkt.AckHandle, make([]byte, 4))
|
||||
}
|
||||
|
||||
func HandleMsgMhfOperateGuildMember(s *Session, p mhfpacket.MHFPacket) {
|
||||
@@ -923,14 +925,14 @@ func HandleMsgMhfOperateGuildMember(s *Session, p mhfpacket.MHFPacket) {
|
||||
guild, err := GetGuildInfoByCharacterId(s, pkt.CharID)
|
||||
|
||||
if err != nil || guild == nil {
|
||||
DoAckSimpleFail(s, pkt.AckHandle, make([]byte, 4))
|
||||
broadcast.DoAckSimpleFail(s, pkt.AckHandle, make([]byte, 4))
|
||||
return
|
||||
}
|
||||
|
||||
actorCharacter, err := GetCharacterGuildData(s, s.CharID)
|
||||
|
||||
if err != nil || (!actorCharacter.IsSubLeader() && guild.LeaderCharID != s.CharID) {
|
||||
DoAckSimpleFail(s, pkt.AckHandle, make([]byte, 4))
|
||||
broadcast.DoAckSimpleFail(s, pkt.AckHandle, make([]byte, 4))
|
||||
return
|
||||
}
|
||||
|
||||
@@ -961,12 +963,12 @@ func HandleMsgMhfOperateGuildMember(s *Session, p mhfpacket.MHFPacket) {
|
||||
IsSystemMessage: true,
|
||||
}
|
||||
default:
|
||||
DoAckSimpleFail(s, pkt.AckHandle, make([]byte, 4))
|
||||
broadcast.DoAckSimpleFail(s, pkt.AckHandle, make([]byte, 4))
|
||||
s.Logger.Warn(fmt.Sprintf("unhandled operateGuildMember action '%d'", pkt.Action))
|
||||
}
|
||||
|
||||
if err != nil {
|
||||
DoAckSimpleFail(s, pkt.AckHandle, make([]byte, 4))
|
||||
broadcast.DoAckSimpleFail(s, pkt.AckHandle, make([]byte, 4))
|
||||
} else {
|
||||
mail.Send(s, nil)
|
||||
for _, channel := range s.Server.Channels {
|
||||
@@ -976,7 +978,7 @@ func HandleMsgMhfOperateGuildMember(s *Session, p mhfpacket.MHFPacket) {
|
||||
}
|
||||
}
|
||||
}
|
||||
DoAckSimpleSucceed(s, pkt.AckHandle, make([]byte, 4))
|
||||
broadcast.DoAckSimpleSucceed(s, pkt.AckHandle, make([]byte, 4))
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1011,7 +1013,7 @@ func HandleMsgMhfInfoGuild(s *Session, p mhfpacket.MHFPacket) {
|
||||
resp.WriteUint32(0) // Count
|
||||
resp.WriteUint8(0) // Unk, read if count == 0.
|
||||
|
||||
DoAckBufSucceed(s, pkt.AckHandle, resp.Data())
|
||||
broadcast.DoAckBufSucceed(s, pkt.AckHandle, resp.Data())
|
||||
return
|
||||
}
|
||||
|
||||
@@ -1219,9 +1221,9 @@ func HandleMsgMhfInfoGuild(s *Session, p mhfpacket.MHFPacket) {
|
||||
}
|
||||
bf.WriteUint8(0) // Unk
|
||||
|
||||
DoAckBufSucceed(s, pkt.AckHandle, bf.Data())
|
||||
broadcast.DoAckBufSucceed(s, pkt.AckHandle, bf.Data())
|
||||
} else {
|
||||
DoAckBufSucceed(s, pkt.AckHandle, make([]byte, 5))
|
||||
broadcast.DoAckBufSucceed(s, pkt.AckHandle, make([]byte, 5))
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1428,7 +1430,7 @@ func HandleMsgMhfEnumerateGuild(s *Session, p mhfpacket.MHFPacket) {
|
||||
}
|
||||
}
|
||||
|
||||
DoAckBufSucceed(s, pkt.AckHandle, bf.Data())
|
||||
broadcast.DoAckBufSucceed(s, pkt.AckHandle, bf.Data())
|
||||
}
|
||||
|
||||
func HandleMsgMhfArrangeGuildMember(s *Session, p mhfpacket.MHFPacket) {
|
||||
@@ -1463,7 +1465,7 @@ func HandleMsgMhfArrangeGuildMember(s *Session, p mhfpacket.MHFPacket) {
|
||||
return
|
||||
}
|
||||
|
||||
DoAckSimpleSucceed(s, pkt.AckHandle, make([]byte, 4))
|
||||
broadcast.DoAckSimpleSucceed(s, pkt.AckHandle, make([]byte, 4))
|
||||
}
|
||||
|
||||
func HandleMsgMhfEnumerateGuildMember(s *Session, p mhfpacket.MHFPacket) {
|
||||
@@ -1481,7 +1483,7 @@ func HandleMsgMhfEnumerateGuildMember(s *Session, p mhfpacket.MHFPacket) {
|
||||
if guild != nil {
|
||||
isApplicant, _ := guild.HasApplicationForCharID(s, s.CharID)
|
||||
if isApplicant {
|
||||
DoAckBufSucceed(s, pkt.AckHandle, make([]byte, 2))
|
||||
broadcast.DoAckBufSucceed(s, pkt.AckHandle, make([]byte, 2))
|
||||
return
|
||||
}
|
||||
}
|
||||
@@ -1492,10 +1494,10 @@ func HandleMsgMhfEnumerateGuildMember(s *Session, p mhfpacket.MHFPacket) {
|
||||
|
||||
if err != nil {
|
||||
s.Logger.Warn("failed to retrieve guild sending no result message")
|
||||
DoAckBufSucceed(s, pkt.AckHandle, make([]byte, 2))
|
||||
broadcast.DoAckBufSucceed(s, pkt.AckHandle, make([]byte, 2))
|
||||
return
|
||||
} else if guild == nil {
|
||||
DoAckBufSucceed(s, pkt.AckHandle, make([]byte, 2))
|
||||
broadcast.DoAckBufSucceed(s, pkt.AckHandle, make([]byte, 2))
|
||||
return
|
||||
}
|
||||
|
||||
@@ -1584,7 +1586,7 @@ func HandleMsgMhfEnumerateGuildMember(s *Session, p mhfpacket.MHFPacket) {
|
||||
bf.WriteUint16(member.RPYesterday)
|
||||
}
|
||||
|
||||
DoAckBufSucceed(s, pkt.AckHandle, bf.Data())
|
||||
broadcast.DoAckBufSucceed(s, pkt.AckHandle, bf.Data())
|
||||
}
|
||||
|
||||
func HandleMsgMhfGetGuildManageRight(s *Session, p mhfpacket.MHFPacket) {
|
||||
@@ -1595,7 +1597,7 @@ func HandleMsgMhfGetGuildManageRight(s *Session, p mhfpacket.MHFPacket) {
|
||||
guild, err = GetGuildInfoByID(s, s.prevGuildID)
|
||||
s.prevGuildID = 0
|
||||
if guild == nil || err != nil {
|
||||
DoAckBufSucceed(s, pkt.AckHandle, make([]byte, 4))
|
||||
broadcast.DoAckBufSucceed(s, pkt.AckHandle, make([]byte, 4))
|
||||
return
|
||||
}
|
||||
}
|
||||
@@ -1608,12 +1610,12 @@ func HandleMsgMhfGetGuildManageRight(s *Session, p mhfpacket.MHFPacket) {
|
||||
bf.WriteBool(member.Recruiter)
|
||||
bf.WriteBytes(make([]byte, 3))
|
||||
}
|
||||
DoAckBufSucceed(s, pkt.AckHandle, bf.Data())
|
||||
broadcast.DoAckBufSucceed(s, pkt.AckHandle, bf.Data())
|
||||
}
|
||||
|
||||
func HandleMsgMhfGetUdGuildMapInfo(s *Session, p mhfpacket.MHFPacket) {
|
||||
pkt := p.(*mhfpacket.MsgMhfGetUdGuildMapInfo)
|
||||
DoAckSimpleFail(s, pkt.AckHandle, make([]byte, 4))
|
||||
broadcast.DoAckSimpleFail(s, pkt.AckHandle, make([]byte, 4))
|
||||
}
|
||||
|
||||
func HandleMsgMhfGetGuildTargetMemberNum(s *Session, p mhfpacket.MHFPacket) {
|
||||
@@ -1629,7 +1631,7 @@ func HandleMsgMhfGetGuildTargetMemberNum(s *Session, p mhfpacket.MHFPacket) {
|
||||
}
|
||||
|
||||
if err != nil || guild == nil {
|
||||
DoAckBufSucceed(s, pkt.AckHandle, []byte{0x00, 0x00, 0x00, 0x02})
|
||||
broadcast.DoAckBufSucceed(s, pkt.AckHandle, []byte{0x00, 0x00, 0x00, 0x02})
|
||||
return
|
||||
}
|
||||
|
||||
@@ -1638,7 +1640,7 @@ func HandleMsgMhfGetGuildTargetMemberNum(s *Session, p mhfpacket.MHFPacket) {
|
||||
bf.WriteUint16(0x0)
|
||||
bf.WriteUint16(guild.MemberCount - 1)
|
||||
|
||||
DoAckBufSucceed(s, pkt.AckHandle, bf.Data())
|
||||
broadcast.DoAckBufSucceed(s, pkt.AckHandle, bf.Data())
|
||||
}
|
||||
|
||||
func guildGetItems(s *Session, guildID uint32) []mhfitem.MHFItemStack {
|
||||
@@ -1665,7 +1667,7 @@ func HandleMsgMhfEnumerateGuildItem(s *Session, p mhfpacket.MHFPacket) {
|
||||
items := guildGetItems(s, pkt.GuildID)
|
||||
bf := byteframe.NewByteFrame()
|
||||
bf.WriteBytes(mhfitem.SerializeWarehouseItems(items))
|
||||
DoAckBufSucceed(s, pkt.AckHandle, bf.Data())
|
||||
broadcast.DoAckBufSucceed(s, pkt.AckHandle, bf.Data())
|
||||
}
|
||||
|
||||
func HandleMsgMhfUpdateGuildItem(s *Session, p mhfpacket.MHFPacket) {
|
||||
@@ -1676,7 +1678,7 @@ func HandleMsgMhfUpdateGuildItem(s *Session, p mhfpacket.MHFPacket) {
|
||||
s.Logger.Fatal(fmt.Sprintf("Failed to get database instance: %s", err))
|
||||
}
|
||||
database.Exec(`UPDATE guilds SET item_box=$1 WHERE id=$2`, mhfitem.SerializeWarehouseItems(newStacks), pkt.GuildID)
|
||||
DoAckSimpleSucceed(s, pkt.AckHandle, make([]byte, 4))
|
||||
broadcast.DoAckSimpleSucceed(s, pkt.AckHandle, make([]byte, 4))
|
||||
}
|
||||
|
||||
func HandleMsgMhfUpdateGuildIcon(s *Session, p mhfpacket.MHFPacket) {
|
||||
@@ -1700,7 +1702,7 @@ func HandleMsgMhfUpdateGuildIcon(s *Session, p mhfpacket.MHFPacket) {
|
||||
zap.Uint32("guildID", guild.ID),
|
||||
zap.Uint32("charID", s.CharID),
|
||||
)
|
||||
DoAckSimpleFail(s, pkt.AckHandle, make([]byte, 4))
|
||||
broadcast.DoAckSimpleFail(s, pkt.AckHandle, make([]byte, 4))
|
||||
return
|
||||
}
|
||||
|
||||
@@ -1728,11 +1730,11 @@ func HandleMsgMhfUpdateGuildIcon(s *Session, p mhfpacket.MHFPacket) {
|
||||
err = guild.Save(s)
|
||||
|
||||
if err != nil {
|
||||
DoAckSimpleFail(s, pkt.AckHandle, make([]byte, 4))
|
||||
broadcast.DoAckSimpleFail(s, pkt.AckHandle, make([]byte, 4))
|
||||
return
|
||||
}
|
||||
|
||||
DoAckSimpleSucceed(s, pkt.AckHandle, make([]byte, 4))
|
||||
broadcast.DoAckSimpleSucceed(s, pkt.AckHandle, make([]byte, 4))
|
||||
}
|
||||
|
||||
func HandleMsgMhfReadGuildcard(s *Session, p mhfpacket.MHFPacket) {
|
||||
@@ -1748,7 +1750,7 @@ func HandleMsgMhfReadGuildcard(s *Session, p mhfpacket.MHFPacket) {
|
||||
resp.WriteUint32(0)
|
||||
resp.WriteUint32(0)
|
||||
|
||||
DoAckBufSucceed(s, pkt.AckHandle, resp.Data())
|
||||
broadcast.DoAckBufSucceed(s, pkt.AckHandle, resp.Data())
|
||||
}
|
||||
|
||||
type GuildMission struct {
|
||||
@@ -1795,29 +1797,29 @@ func HandleMsgMhfGetGuildMissionList(s *Session, p mhfpacket.MHFPacket) {
|
||||
bf.WriteUint16(mission.RewardLevel)
|
||||
bf.WriteUint32(uint32(gametime.TimeAdjusted().Unix()))
|
||||
}
|
||||
DoAckBufSucceed(s, pkt.AckHandle, bf.Data())
|
||||
broadcast.DoAckBufSucceed(s, pkt.AckHandle, bf.Data())
|
||||
}
|
||||
|
||||
func HandleMsgMhfGetGuildMissionRecord(s *Session, p mhfpacket.MHFPacket) {
|
||||
pkt := p.(*mhfpacket.MsgMhfGetGuildMissionRecord)
|
||||
|
||||
// No guild mission records = 0x190 empty bytes
|
||||
DoAckBufSucceed(s, pkt.AckHandle, make([]byte, 0x190))
|
||||
broadcast.DoAckBufSucceed(s, pkt.AckHandle, make([]byte, 0x190))
|
||||
}
|
||||
|
||||
func HandleMsgMhfAddGuildMissionCount(s *Session, p mhfpacket.MHFPacket) {
|
||||
pkt := p.(*mhfpacket.MsgMhfAddGuildMissionCount)
|
||||
DoAckSimpleSucceed(s, pkt.AckHandle, make([]byte, 4))
|
||||
broadcast.DoAckSimpleSucceed(s, pkt.AckHandle, make([]byte, 4))
|
||||
}
|
||||
|
||||
func HandleMsgMhfSetGuildMissionTarget(s *Session, p mhfpacket.MHFPacket) {
|
||||
pkt := p.(*mhfpacket.MsgMhfSetGuildMissionTarget)
|
||||
DoAckSimpleSucceed(s, pkt.AckHandle, make([]byte, 4))
|
||||
broadcast.DoAckSimpleSucceed(s, pkt.AckHandle, make([]byte, 4))
|
||||
}
|
||||
|
||||
func HandleMsgMhfCancelGuildMissionTarget(s *Session, p mhfpacket.MHFPacket) {
|
||||
pkt := p.(*mhfpacket.MsgMhfCancelGuildMissionTarget)
|
||||
DoAckSimpleSucceed(s, pkt.AckHandle, make([]byte, 4))
|
||||
broadcast.DoAckSimpleSucceed(s, pkt.AckHandle, make([]byte, 4))
|
||||
}
|
||||
|
||||
type GuildMeal struct {
|
||||
@@ -1837,7 +1839,7 @@ func HandleMsgMhfLoadGuildCooking(s *Session, p mhfpacket.MHFPacket) {
|
||||
data, err := database.Queryx("SELECT id, meal_id, level, created_at FROM guild_meals WHERE guild_id = $1", guild.ID)
|
||||
if err != nil {
|
||||
s.Logger.Error("Failed to get guild meals from db", zap.Error(err))
|
||||
DoAckBufSucceed(s, pkt.AckHandle, make([]byte, 2))
|
||||
broadcast.DoAckBufSucceed(s, pkt.AckHandle, make([]byte, 2))
|
||||
return
|
||||
}
|
||||
var meals []GuildMeal
|
||||
@@ -1859,7 +1861,7 @@ func HandleMsgMhfLoadGuildCooking(s *Session, p mhfpacket.MHFPacket) {
|
||||
bf.WriteUint32(meal.Level)
|
||||
bf.WriteUint32(uint32(meal.CreatedAt.Unix()))
|
||||
}
|
||||
DoAckBufSucceed(s, pkt.AckHandle, bf.Data())
|
||||
broadcast.DoAckBufSucceed(s, pkt.AckHandle, bf.Data())
|
||||
}
|
||||
|
||||
func HandleMsgMhfRegistGuildCooking(s *Session, p mhfpacket.MHFPacket) {
|
||||
@@ -1881,14 +1883,14 @@ func HandleMsgMhfRegistGuildCooking(s *Session, p mhfpacket.MHFPacket) {
|
||||
bf.WriteUint32(uint32(pkt.MealID))
|
||||
bf.WriteUint32(uint32(pkt.Success))
|
||||
bf.WriteUint32(uint32(startTime.Unix()))
|
||||
DoAckBufSucceed(s, pkt.AckHandle, bf.Data())
|
||||
broadcast.DoAckBufSucceed(s, pkt.AckHandle, bf.Data())
|
||||
}
|
||||
|
||||
func HandleMsgMhfGetGuildWeeklyBonusMaster(s *Session, p mhfpacket.MHFPacket) {
|
||||
pkt := p.(*mhfpacket.MsgMhfGetGuildWeeklyBonusMaster)
|
||||
|
||||
// Values taken from brand new guild capture
|
||||
DoAckBufSucceed(s, pkt.AckHandle, make([]byte, 40))
|
||||
broadcast.DoAckBufSucceed(s, pkt.AckHandle, make([]byte, 40))
|
||||
}
|
||||
func HandleMsgMhfGetGuildWeeklyBonusActiveCount(s *Session, p mhfpacket.MHFPacket) {
|
||||
pkt := p.(*mhfpacket.MsgMhfGetGuildWeeklyBonusActiveCount)
|
||||
@@ -1896,7 +1898,7 @@ func HandleMsgMhfGetGuildWeeklyBonusActiveCount(s *Session, p mhfpacket.MHFPacke
|
||||
bf.WriteUint8(60) // Active count
|
||||
bf.WriteUint8(60) // Current active count
|
||||
bf.WriteUint8(0) // New active count
|
||||
DoAckBufSucceed(s, pkt.AckHandle, bf.Data())
|
||||
broadcast.DoAckBufSucceed(s, pkt.AckHandle, bf.Data())
|
||||
}
|
||||
|
||||
func HandleMsgMhfGuildHuntdata(s *Session, p mhfpacket.MHFPacket) {
|
||||
@@ -1954,7 +1956,7 @@ func HandleMsgMhfGuildHuntdata(s *Session, p mhfpacket.MHFPacket) {
|
||||
bf.WriteBool(false)
|
||||
}
|
||||
}
|
||||
DoAckBufSucceed(s, pkt.AckHandle, bf.Data())
|
||||
broadcast.DoAckBufSucceed(s, pkt.AckHandle, bf.Data())
|
||||
}
|
||||
|
||||
type MessageBoardPost struct {
|
||||
@@ -1980,7 +1982,7 @@ func HandleMsgMhfEnumerateGuildMessageBoard(s *Session, p mhfpacket.MHFPacket) {
|
||||
msgs, err := database.Queryx("SELECT id, stamp_id, title, body, author_id, created_at, liked_by FROM guild_posts WHERE guild_id = $1 AND post_type = $2 ORDER BY created_at DESC", guild.ID, int(pkt.BoardType))
|
||||
if err != nil {
|
||||
s.Logger.Error("Failed to get guild messages from db", zap.Error(err))
|
||||
DoAckBufSucceed(s, pkt.AckHandle, make([]byte, 4))
|
||||
broadcast.DoAckBufSucceed(s, pkt.AckHandle, make([]byte, 4))
|
||||
return
|
||||
}
|
||||
database.Exec("UPDATE characters SET guild_post_checked = now() WHERE id = $1", s.CharID)
|
||||
@@ -2006,7 +2008,7 @@ func HandleMsgMhfEnumerateGuildMessageBoard(s *Session, p mhfpacket.MHFPacket) {
|
||||
data := byteframe.NewByteFrame()
|
||||
data.WriteUint32(postCount)
|
||||
data.WriteBytes(bf.Data())
|
||||
DoAckBufSucceed(s, pkt.AckHandle, data.Data())
|
||||
broadcast.DoAckBufSucceed(s, pkt.AckHandle, data.Data())
|
||||
}
|
||||
|
||||
func HandleMsgMhfUpdateGuildMessageBoard(s *Session, p mhfpacket.MHFPacket) {
|
||||
@@ -2021,7 +2023,7 @@ func HandleMsgMhfUpdateGuildMessageBoard(s *Session, p mhfpacket.MHFPacket) {
|
||||
applicant, _ = guild.HasApplicationForCharID(s, s.CharID)
|
||||
}
|
||||
if err != nil || guild == nil || applicant {
|
||||
DoAckSimpleSucceed(s, pkt.AckHandle, make([]byte, 4))
|
||||
broadcast.DoAckSimpleSucceed(s, pkt.AckHandle, make([]byte, 4))
|
||||
return
|
||||
}
|
||||
switch pkt.MessageOp {
|
||||
@@ -2055,17 +2057,17 @@ func HandleMsgMhfUpdateGuildMessageBoard(s *Session, p mhfpacket.MHFPacket) {
|
||||
if err == nil {
|
||||
database.QueryRow("SELECT COUNT(*) FROM guild_posts WHERE guild_id = $1 AND (EXTRACT(epoch FROM created_at)::int) > $2", guild.ID, timeChecked.Unix()).Scan(&newPosts)
|
||||
if newPosts > 0 {
|
||||
DoAckSimpleSucceed(s, pkt.AckHandle, []byte{0x00, 0x00, 0x00, 0x01})
|
||||
broadcast.DoAckSimpleSucceed(s, pkt.AckHandle, []byte{0x00, 0x00, 0x00, 0x01})
|
||||
return
|
||||
}
|
||||
}
|
||||
}
|
||||
DoAckSimpleSucceed(s, pkt.AckHandle, make([]byte, 4))
|
||||
broadcast.DoAckSimpleSucceed(s, pkt.AckHandle, make([]byte, 4))
|
||||
}
|
||||
|
||||
func HandleMsgMhfEntryRookieGuild(s *Session, p mhfpacket.MHFPacket) {
|
||||
pkt := p.(*mhfpacket.MsgMhfEntryRookieGuild)
|
||||
DoAckSimpleFail(s, pkt.AckHandle, make([]byte, 4))
|
||||
broadcast.DoAckSimpleFail(s, pkt.AckHandle, make([]byte, 4))
|
||||
}
|
||||
|
||||
func HandleMsgMhfUpdateForceGuildRank(s *Session, p mhfpacket.MHFPacket) {}
|
||||
@@ -2074,12 +2076,12 @@ func HandleMsgMhfAddGuildWeeklyBonusExceptionalUser(s *Session, p mhfpacket.MHFP
|
||||
pkt := p.(*mhfpacket.MsgMhfAddGuildWeeklyBonusExceptionalUser)
|
||||
// TODO: record pkt.NumUsers to DB
|
||||
// must use addition
|
||||
DoAckSimpleSucceed(s, pkt.AckHandle, []byte{0x00, 0x00, 0x00, 0x00})
|
||||
broadcast.DoAckSimpleSucceed(s, pkt.AckHandle, []byte{0x00, 0x00, 0x00, 0x00})
|
||||
}
|
||||
|
||||
func HandleMsgMhfGenerateUdGuildMap(s *Session, p mhfpacket.MHFPacket) {
|
||||
pkt := p.(*mhfpacket.MsgMhfGenerateUdGuildMap)
|
||||
DoAckSimpleFail(s, pkt.AckHandle, make([]byte, 4))
|
||||
broadcast.DoAckSimpleFail(s, pkt.AckHandle, make([]byte, 4))
|
||||
}
|
||||
|
||||
func HandleMsgMhfUpdateGuild(s *Session, p mhfpacket.MHFPacket) {}
|
||||
@@ -2091,19 +2093,19 @@ func HandleMsgMhfSetGuildManageRight(s *Session, p mhfpacket.MHFPacket) {
|
||||
s.Logger.Fatal(fmt.Sprintf("Failed to get database instance: %s", err))
|
||||
}
|
||||
database.Exec("UPDATE guild_characters SET recruiter=$1 WHERE character_id=$2", pkt.Allowed, pkt.CharID)
|
||||
DoAckBufSucceed(s, pkt.AckHandle, make([]byte, 4))
|
||||
broadcast.DoAckBufSucceed(s, pkt.AckHandle, make([]byte, 4))
|
||||
}
|
||||
|
||||
func HandleMsgMhfCheckMonthlyItem(s *Session, p mhfpacket.MHFPacket) {
|
||||
pkt := p.(*mhfpacket.MsgMhfCheckMonthlyItem)
|
||||
DoAckSimpleSucceed(s, pkt.AckHandle, []byte{0x00, 0x00, 0x00, 0x01})
|
||||
broadcast.DoAckSimpleSucceed(s, pkt.AckHandle, []byte{0x00, 0x00, 0x00, 0x01})
|
||||
// TODO: Implement month-by-month tracker, 0 = Not claimed, 1 = Claimed
|
||||
// Also handles HLC and EXC items, IDs = 064D, 076B
|
||||
}
|
||||
|
||||
func HandleMsgMhfAcquireMonthlyItem(s *Session, p mhfpacket.MHFPacket) {
|
||||
pkt := p.(*mhfpacket.MsgMhfAcquireMonthlyItem)
|
||||
DoAckSimpleSucceed(s, pkt.AckHandle, make([]byte, 4))
|
||||
broadcast.DoAckSimpleSucceed(s, pkt.AckHandle, make([]byte, 4))
|
||||
}
|
||||
|
||||
func HandleMsgMhfEnumerateInvGuild(s *Session, p mhfpacket.MHFPacket) {
|
||||
@@ -2113,7 +2115,7 @@ func HandleMsgMhfEnumerateInvGuild(s *Session, p mhfpacket.MHFPacket) {
|
||||
|
||||
func HandleMsgMhfOperationInvGuild(s *Session, p mhfpacket.MHFPacket) {
|
||||
pkt := p.(*mhfpacket.MsgMhfOperationInvGuild)
|
||||
DoAckSimpleFail(s, pkt.AckHandle, make([]byte, 4))
|
||||
broadcast.DoAckSimpleFail(s, pkt.AckHandle, make([]byte, 4))
|
||||
}
|
||||
|
||||
func HandleMsgMhfUpdateGuildcard(s *Session, p mhfpacket.MHFPacket) {}
|
||||
|
||||
@@ -5,6 +5,7 @@ import (
|
||||
"time"
|
||||
|
||||
"erupe-ce/network/mhfpacket"
|
||||
"erupe-ce/utils/broadcast"
|
||||
"erupe-ce/utils/byteframe"
|
||||
"erupe-ce/utils/db"
|
||||
"erupe-ce/utils/gametime"
|
||||
@@ -32,7 +33,7 @@ func HandleMsgMhfLoadGuildAdventure(s *Session, p mhfpacket.MHFPacket) {
|
||||
data, err := database.Queryx("SELECT id, destination, charge, depart, return, collected_by FROM guild_adventures WHERE guild_id = $1", guild.ID)
|
||||
if err != nil {
|
||||
s.Logger.Error("Failed to get guild adventures from db", zap.Error(err))
|
||||
DoAckBufSucceed(s, pkt.AckHandle, make([]byte, 1))
|
||||
broadcast.DoAckBufSucceed(s, pkt.AckHandle, make([]byte, 1))
|
||||
return
|
||||
}
|
||||
temp := byteframe.NewByteFrame()
|
||||
@@ -54,7 +55,7 @@ func HandleMsgMhfLoadGuildAdventure(s *Session, p mhfpacket.MHFPacket) {
|
||||
bf := byteframe.NewByteFrame()
|
||||
bf.WriteUint8(uint8(count))
|
||||
bf.WriteBytes(temp.Data())
|
||||
DoAckBufSucceed(s, pkt.AckHandle, bf.Data())
|
||||
broadcast.DoAckBufSucceed(s, pkt.AckHandle, bf.Data())
|
||||
}
|
||||
|
||||
func HandleMsgMhfRegistGuildAdventure(s *Session, p mhfpacket.MHFPacket) {
|
||||
@@ -68,7 +69,7 @@ func HandleMsgMhfRegistGuildAdventure(s *Session, p mhfpacket.MHFPacket) {
|
||||
if err != nil {
|
||||
s.Logger.Error("Failed to register guild adventure", zap.Error(err))
|
||||
}
|
||||
DoAckSimpleSucceed(s, pkt.AckHandle, make([]byte, 4))
|
||||
broadcast.DoAckSimpleSucceed(s, pkt.AckHandle, make([]byte, 4))
|
||||
}
|
||||
|
||||
func HandleMsgMhfAcquireGuildAdventure(s *Session, p mhfpacket.MHFPacket) {
|
||||
@@ -88,7 +89,7 @@ func HandleMsgMhfAcquireGuildAdventure(s *Session, p mhfpacket.MHFPacket) {
|
||||
s.Logger.Error("Failed to collect adventure in db", zap.Error(err))
|
||||
}
|
||||
}
|
||||
DoAckSimpleSucceed(s, pkt.AckHandle, make([]byte, 4))
|
||||
broadcast.DoAckSimpleSucceed(s, pkt.AckHandle, make([]byte, 4))
|
||||
}
|
||||
|
||||
func HandleMsgMhfChargeGuildAdventure(s *Session, p mhfpacket.MHFPacket) {
|
||||
@@ -101,7 +102,7 @@ func HandleMsgMhfChargeGuildAdventure(s *Session, p mhfpacket.MHFPacket) {
|
||||
if err != nil {
|
||||
s.Logger.Error("Failed to charge guild adventure", zap.Error(err))
|
||||
}
|
||||
DoAckSimpleSucceed(s, pkt.AckHandle, make([]byte, 4))
|
||||
broadcast.DoAckSimpleSucceed(s, pkt.AckHandle, make([]byte, 4))
|
||||
}
|
||||
|
||||
func HandleMsgMhfRegistGuildAdventureDiva(s *Session, p mhfpacket.MHFPacket) {
|
||||
@@ -115,5 +116,5 @@ func HandleMsgMhfRegistGuildAdventureDiva(s *Session, p mhfpacket.MHFPacket) {
|
||||
if err != nil {
|
||||
s.Logger.Error("Failed to register guild adventure", zap.Error(err))
|
||||
}
|
||||
DoAckSimpleSucceed(s, pkt.AckHandle, make([]byte, 4))
|
||||
broadcast.DoAckSimpleSucceed(s, pkt.AckHandle, make([]byte, 4))
|
||||
}
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
package channelserver
|
||||
|
||||
import (
|
||||
"erupe-ce/utils/broadcast"
|
||||
"erupe-ce/utils/byteframe"
|
||||
"erupe-ce/utils/db"
|
||||
ps "erupe-ce/utils/pascalstring"
|
||||
@@ -121,7 +122,7 @@ func HandleMsgMhfCreateJoint(s *Session, p mhfpacket.MHFPacket) {
|
||||
if err != nil {
|
||||
s.Logger.Error("Failed to create guild alliance in db", zap.Error(err))
|
||||
}
|
||||
DoAckSimpleSucceed(s, pkt.AckHandle, []byte{0x01, 0x01, 0x01, 0x01})
|
||||
broadcast.DoAckSimpleSucceed(s, pkt.AckHandle, []byte{0x01, 0x01, 0x01, 0x01})
|
||||
}
|
||||
|
||||
func HandleMsgMhfOperateJoint(s *Session, p mhfpacket.MHFPacket) {
|
||||
@@ -146,14 +147,14 @@ func HandleMsgMhfOperateJoint(s *Session, p mhfpacket.MHFPacket) {
|
||||
if err != nil {
|
||||
s.Logger.Error("Failed to disband alliance", zap.Error(err))
|
||||
}
|
||||
DoAckSimpleSucceed(s, pkt.AckHandle, make([]byte, 4))
|
||||
broadcast.DoAckSimpleSucceed(s, pkt.AckHandle, make([]byte, 4))
|
||||
} else {
|
||||
s.Logger.Warn(
|
||||
"Non-owner of alliance attempted disband",
|
||||
zap.Uint32("CharID", s.CharID),
|
||||
zap.Uint32("AllyID", alliance.ID),
|
||||
)
|
||||
DoAckSimpleFail(s, pkt.AckHandle, make([]byte, 4))
|
||||
broadcast.DoAckSimpleFail(s, pkt.AckHandle, make([]byte, 4))
|
||||
}
|
||||
case mhfpacket.OPERATE_JOINT_LEAVE:
|
||||
if guild.LeaderCharID == s.CharID {
|
||||
@@ -165,13 +166,13 @@ func HandleMsgMhfOperateJoint(s *Session, p mhfpacket.MHFPacket) {
|
||||
database.Exec(`UPDATE guild_alliances SET sub2_id = NULL WHERE id = $1`, alliance.ID)
|
||||
}
|
||||
// TODO: Handle deleting Alliance applications
|
||||
DoAckSimpleSucceed(s, pkt.AckHandle, make([]byte, 4))
|
||||
broadcast.DoAckSimpleSucceed(s, pkt.AckHandle, make([]byte, 4))
|
||||
} else {
|
||||
s.Logger.Warn(
|
||||
"Non-owner of guild attempted alliance leave",
|
||||
zap.Uint32("CharID", s.CharID),
|
||||
)
|
||||
DoAckSimpleFail(s, pkt.AckHandle, make([]byte, 4))
|
||||
broadcast.DoAckSimpleFail(s, pkt.AckHandle, make([]byte, 4))
|
||||
}
|
||||
case mhfpacket.OPERATE_JOINT_KICK:
|
||||
if alliance.ParentGuild.LeaderCharID == s.CharID {
|
||||
@@ -183,17 +184,17 @@ func HandleMsgMhfOperateJoint(s *Session, p mhfpacket.MHFPacket) {
|
||||
} else {
|
||||
database.Exec(`UPDATE guild_alliances SET sub2_id = NULL WHERE id = $1`, alliance.ID)
|
||||
}
|
||||
DoAckSimpleSucceed(s, pkt.AckHandle, make([]byte, 4))
|
||||
broadcast.DoAckSimpleSucceed(s, pkt.AckHandle, make([]byte, 4))
|
||||
} else {
|
||||
s.Logger.Warn(
|
||||
"Non-owner of alliance attempted kick",
|
||||
zap.Uint32("CharID", s.CharID),
|
||||
zap.Uint32("AllyID", alliance.ID),
|
||||
)
|
||||
DoAckSimpleFail(s, pkt.AckHandle, make([]byte, 4))
|
||||
broadcast.DoAckSimpleFail(s, pkt.AckHandle, make([]byte, 4))
|
||||
}
|
||||
default:
|
||||
DoAckSimpleSucceed(s, pkt.AckHandle, make([]byte, 4))
|
||||
broadcast.DoAckSimpleSucceed(s, pkt.AckHandle, make([]byte, 4))
|
||||
panic(fmt.Sprintf("Unhandled operate joint action '%d'", pkt.Action))
|
||||
}
|
||||
}
|
||||
@@ -203,7 +204,7 @@ func HandleMsgMhfInfoJoint(s *Session, p mhfpacket.MHFPacket) {
|
||||
bf := byteframe.NewByteFrame()
|
||||
alliance, err := GetAllianceData(s, pkt.AllianceID)
|
||||
if err != nil {
|
||||
DoAckSimpleFail(s, pkt.AckHandle, make([]byte, 4))
|
||||
broadcast.DoAckSimpleFail(s, pkt.AckHandle, make([]byte, 4))
|
||||
} else {
|
||||
bf.WriteUint32(alliance.ID)
|
||||
bf.WriteUint32(uint32(alliance.CreatedAt.Unix()))
|
||||
@@ -241,6 +242,6 @@ func HandleMsgMhfInfoJoint(s *Session, p mhfpacket.MHFPacket) {
|
||||
ps.Uint16(bf, alliance.SubGuild2.Name, true)
|
||||
ps.Uint16(bf, alliance.SubGuild2.LeaderName, true)
|
||||
}
|
||||
DoAckBufSucceed(s, pkt.AckHandle, bf.Data())
|
||||
broadcast.DoAckBufSucceed(s, pkt.AckHandle, bf.Data())
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2,6 +2,7 @@ package channelserver
|
||||
|
||||
import (
|
||||
"erupe-ce/network/mhfpacket"
|
||||
"erupe-ce/utils/broadcast"
|
||||
"erupe-ce/utils/byteframe"
|
||||
"erupe-ce/utils/db"
|
||||
"erupe-ce/utils/gametime"
|
||||
@@ -18,31 +19,31 @@ func HandleMsgMhfPostGuildScout(s *Session, p mhfpacket.MHFPacket) {
|
||||
actorCharGuildData, err := GetCharacterGuildData(s, s.CharID)
|
||||
|
||||
if err != nil {
|
||||
DoAckBufFail(s, pkt.AckHandle, make([]byte, 4))
|
||||
broadcast.DoAckBufFail(s, pkt.AckHandle, make([]byte, 4))
|
||||
panic(err)
|
||||
}
|
||||
|
||||
if actorCharGuildData == nil || !actorCharGuildData.CanRecruit() {
|
||||
DoAckBufFail(s, pkt.AckHandle, make([]byte, 4))
|
||||
broadcast.DoAckBufFail(s, pkt.AckHandle, make([]byte, 4))
|
||||
return
|
||||
}
|
||||
|
||||
guildInfo, err := GetGuildInfoByID(s, actorCharGuildData.GuildID)
|
||||
|
||||
if err != nil {
|
||||
DoAckBufFail(s, pkt.AckHandle, make([]byte, 4))
|
||||
broadcast.DoAckBufFail(s, pkt.AckHandle, make([]byte, 4))
|
||||
panic(err)
|
||||
}
|
||||
|
||||
hasApplication, err := guildInfo.HasApplicationForCharID(s, pkt.CharID)
|
||||
|
||||
if err != nil {
|
||||
DoAckBufFail(s, pkt.AckHandle, make([]byte, 4))
|
||||
broadcast.DoAckBufFail(s, pkt.AckHandle, make([]byte, 4))
|
||||
panic(err)
|
||||
}
|
||||
|
||||
if hasApplication {
|
||||
DoAckBufSucceed(s, pkt.AckHandle, []byte{0x00, 0x00, 0x00, 0x04})
|
||||
broadcast.DoAckBufSucceed(s, pkt.AckHandle, []byte{0x00, 0x00, 0x00, 0x04})
|
||||
return
|
||||
}
|
||||
database, err := db.GetDB()
|
||||
@@ -59,7 +60,7 @@ func HandleMsgMhfPostGuildScout(s *Session, p mhfpacket.MHFPacket) {
|
||||
|
||||
if err != nil {
|
||||
rollbackTransaction(s, transaction)
|
||||
DoAckBufFail(s, pkt.AckHandle, nil)
|
||||
broadcast.DoAckBufFail(s, pkt.AckHandle, nil)
|
||||
panic(err)
|
||||
}
|
||||
|
||||
@@ -78,18 +79,18 @@ func HandleMsgMhfPostGuildScout(s *Session, p mhfpacket.MHFPacket) {
|
||||
|
||||
if err != nil {
|
||||
rollbackTransaction(s, transaction)
|
||||
DoAckBufFail(s, pkt.AckHandle, nil)
|
||||
broadcast.DoAckBufFail(s, pkt.AckHandle, nil)
|
||||
return
|
||||
}
|
||||
|
||||
err = transaction.Commit()
|
||||
|
||||
if err != nil {
|
||||
DoAckBufFail(s, pkt.AckHandle, nil)
|
||||
broadcast.DoAckBufFail(s, pkt.AckHandle, nil)
|
||||
panic(err)
|
||||
}
|
||||
|
||||
DoAckBufSucceed(s, pkt.AckHandle, []byte{0x00, 0x00, 0x00, 0x00})
|
||||
broadcast.DoAckBufSucceed(s, pkt.AckHandle, []byte{0x00, 0x00, 0x00, 0x00})
|
||||
}
|
||||
|
||||
func HandleMsgMhfCancelGuildScout(s *Session, p mhfpacket.MHFPacket) {
|
||||
@@ -102,25 +103,25 @@ func HandleMsgMhfCancelGuildScout(s *Session, p mhfpacket.MHFPacket) {
|
||||
}
|
||||
|
||||
if guildCharData == nil || !guildCharData.CanRecruit() {
|
||||
DoAckBufFail(s, pkt.AckHandle, make([]byte, 4))
|
||||
broadcast.DoAckBufFail(s, pkt.AckHandle, make([]byte, 4))
|
||||
return
|
||||
}
|
||||
|
||||
guild, err := GetGuildInfoByID(s, guildCharData.GuildID)
|
||||
|
||||
if err != nil {
|
||||
DoAckBufFail(s, pkt.AckHandle, make([]byte, 4))
|
||||
broadcast.DoAckBufFail(s, pkt.AckHandle, make([]byte, 4))
|
||||
return
|
||||
}
|
||||
|
||||
err = guild.CancelInvitation(s, pkt.InvitationID)
|
||||
|
||||
if err != nil {
|
||||
DoAckBufFail(s, pkt.AckHandle, make([]byte, 4))
|
||||
broadcast.DoAckBufFail(s, pkt.AckHandle, make([]byte, 4))
|
||||
return
|
||||
}
|
||||
|
||||
DoAckBufSucceed(s, pkt.AckHandle, make([]byte, 4))
|
||||
broadcast.DoAckBufSucceed(s, pkt.AckHandle, make([]byte, 4))
|
||||
}
|
||||
|
||||
func HandleMsgMhfAnswerGuildScout(s *Session, p mhfpacket.MHFPacket) {
|
||||
@@ -143,7 +144,7 @@ func HandleMsgMhfAnswerGuildScout(s *Session, p mhfpacket.MHFPacket) {
|
||||
)
|
||||
bf.WriteUint32(7)
|
||||
bf.WriteUint32(guild.ID)
|
||||
DoAckBufSucceed(s, pkt.AckHandle, bf.Data())
|
||||
broadcast.DoAckBufSucceed(s, pkt.AckHandle, bf.Data())
|
||||
return
|
||||
}
|
||||
|
||||
@@ -182,11 +183,11 @@ func HandleMsgMhfAnswerGuildScout(s *Session, p mhfpacket.MHFPacket) {
|
||||
if err != nil {
|
||||
bf.WriteUint32(7)
|
||||
bf.WriteUint32(guild.ID)
|
||||
DoAckBufSucceed(s, pkt.AckHandle, bf.Data())
|
||||
broadcast.DoAckBufSucceed(s, pkt.AckHandle, bf.Data())
|
||||
} else {
|
||||
bf.WriteUint32(0)
|
||||
bf.WriteUint32(guild.ID)
|
||||
DoAckBufSucceed(s, pkt.AckHandle, bf.Data())
|
||||
broadcast.DoAckBufSucceed(s, pkt.AckHandle, bf.Data())
|
||||
for _, m := range mail {
|
||||
m.Send(s, nil)
|
||||
}
|
||||
@@ -199,12 +200,12 @@ func HandleMsgMhfGetGuildScoutList(s *Session, p mhfpacket.MHFPacket) {
|
||||
guildInfo, err := GetGuildInfoByCharacterId(s, s.CharID)
|
||||
|
||||
if guildInfo == nil && s.prevGuildID == 0 {
|
||||
DoAckSimpleSucceed(s, pkt.AckHandle, make([]byte, 4))
|
||||
broadcast.DoAckSimpleSucceed(s, pkt.AckHandle, make([]byte, 4))
|
||||
return
|
||||
} else {
|
||||
guildInfo, err = GetGuildInfoByID(s, s.prevGuildID)
|
||||
if guildInfo == nil || err != nil {
|
||||
DoAckSimpleSucceed(s, pkt.AckHandle, make([]byte, 4))
|
||||
broadcast.DoAckSimpleSucceed(s, pkt.AckHandle, make([]byte, 4))
|
||||
return
|
||||
}
|
||||
}
|
||||
@@ -221,7 +222,7 @@ func HandleMsgMhfGetGuildScoutList(s *Session, p mhfpacket.MHFPacket) {
|
||||
|
||||
if err != nil {
|
||||
s.Logger.Error("failed to retrieve scouted characters", zap.Error(err))
|
||||
DoAckSimpleSucceed(s, pkt.AckHandle, make([]byte, 4))
|
||||
broadcast.DoAckSimpleSucceed(s, pkt.AckHandle, make([]byte, 4))
|
||||
return
|
||||
}
|
||||
|
||||
@@ -244,7 +245,7 @@ func HandleMsgMhfGetGuildScoutList(s *Session, p mhfpacket.MHFPacket) {
|
||||
err = rows.Scan(&charID, &charName, &HR, &GR, &actorID)
|
||||
|
||||
if err != nil {
|
||||
DoAckSimpleFail(s, pkt.AckHandle, nil)
|
||||
broadcast.DoAckSimpleFail(s, pkt.AckHandle, nil)
|
||||
continue
|
||||
}
|
||||
|
||||
@@ -269,7 +270,7 @@ func HandleMsgMhfGetGuildScoutList(s *Session, p mhfpacket.MHFPacket) {
|
||||
|
||||
bf.WriteUint32(count)
|
||||
|
||||
DoAckBufSucceed(s, pkt.AckHandle, bf.Data())
|
||||
broadcast.DoAckBufSucceed(s, pkt.AckHandle, bf.Data())
|
||||
}
|
||||
|
||||
func HandleMsgMhfGetRejectGuildScout(s *Session, p mhfpacket.MHFPacket) {
|
||||
@@ -290,7 +291,7 @@ func HandleMsgMhfGetRejectGuildScout(s *Session, p mhfpacket.MHFPacket) {
|
||||
zap.Error(err),
|
||||
zap.Uint32("charID", s.CharID),
|
||||
)
|
||||
DoAckSimpleFail(s, pkt.AckHandle, nil)
|
||||
broadcast.DoAckSimpleFail(s, pkt.AckHandle, nil)
|
||||
return
|
||||
}
|
||||
|
||||
@@ -300,7 +301,7 @@ func HandleMsgMhfGetRejectGuildScout(s *Session, p mhfpacket.MHFPacket) {
|
||||
response = 0x01
|
||||
}
|
||||
|
||||
DoAckSimpleSucceed(s, pkt.AckHandle, []byte{0x00, 0x00, 0x00, response})
|
||||
broadcast.DoAckSimpleSucceed(s, pkt.AckHandle, []byte{0x00, 0x00, 0x00, response})
|
||||
}
|
||||
|
||||
func HandleMsgMhfSetRejectGuildScout(s *Session, p mhfpacket.MHFPacket) {
|
||||
@@ -317,9 +318,9 @@ func HandleMsgMhfSetRejectGuildScout(s *Session, p mhfpacket.MHFPacket) {
|
||||
zap.Error(err),
|
||||
zap.Uint32("charID", s.CharID),
|
||||
)
|
||||
DoAckSimpleFail(s, pkt.AckHandle, nil)
|
||||
broadcast.DoAckSimpleFail(s, pkt.AckHandle, nil)
|
||||
return
|
||||
}
|
||||
|
||||
DoAckSimpleSucceed(s, pkt.AckHandle, nil)
|
||||
broadcast.DoAckSimpleSucceed(s, pkt.AckHandle, nil)
|
||||
}
|
||||
|
||||
@@ -3,6 +3,7 @@ package channelserver
|
||||
import (
|
||||
"erupe-ce/config"
|
||||
"erupe-ce/network/mhfpacket"
|
||||
"erupe-ce/utils/broadcast"
|
||||
"erupe-ce/utils/byteframe"
|
||||
"erupe-ce/utils/db"
|
||||
"erupe-ce/utils/gametime"
|
||||
@@ -28,7 +29,7 @@ func HandleMsgMhfEnumerateGuildTresure(s *Session, p mhfpacket.MHFPacket) {
|
||||
pkt := p.(*mhfpacket.MsgMhfEnumerateGuildTresure)
|
||||
guild, err := GetGuildInfoByCharacterId(s, s.CharID)
|
||||
if err != nil || guild == nil {
|
||||
DoAckBufSucceed(s, pkt.AckHandle, make([]byte, 4))
|
||||
broadcast.DoAckBufSucceed(s, pkt.AckHandle, make([]byte, 4))
|
||||
return
|
||||
}
|
||||
var hunts []TreasureHunt
|
||||
@@ -56,7 +57,7 @@ func HandleMsgMhfEnumerateGuildTresure(s *Session, p mhfpacket.MHFPacket) {
|
||||
`, s.CharID, guild.ID)
|
||||
if err != nil {
|
||||
rows.Close()
|
||||
DoAckBufSucceed(s, pkt.AckHandle, make([]byte, 4))
|
||||
broadcast.DoAckBufSucceed(s, pkt.AckHandle, make([]byte, 4))
|
||||
return
|
||||
} else {
|
||||
for rows.Next() {
|
||||
@@ -83,7 +84,7 @@ func HandleMsgMhfEnumerateGuildTresure(s *Session, p mhfpacket.MHFPacket) {
|
||||
bf.WriteBool(h.Claimed)
|
||||
bf.WriteBytes(h.HuntData)
|
||||
}
|
||||
DoAckBufSucceed(s, pkt.AckHandle, bf.Data())
|
||||
broadcast.DoAckBufSucceed(s, pkt.AckHandle, bf.Data())
|
||||
}
|
||||
|
||||
func HandleMsgMhfRegistGuildTresure(s *Session, p mhfpacket.MHFPacket) {
|
||||
@@ -92,7 +93,7 @@ func HandleMsgMhfRegistGuildTresure(s *Session, p mhfpacket.MHFPacket) {
|
||||
huntData := byteframe.NewByteFrame()
|
||||
guild, err := GetGuildInfoByCharacterId(s, s.CharID)
|
||||
if err != nil || guild == nil {
|
||||
DoAckSimpleFail(s, pkt.AckHandle, make([]byte, 4))
|
||||
broadcast.DoAckSimpleFail(s, pkt.AckHandle, make([]byte, 4))
|
||||
return
|
||||
}
|
||||
guildCats := getGuildAirouList(s)
|
||||
@@ -121,7 +122,7 @@ func HandleMsgMhfRegistGuildTresure(s *Session, p mhfpacket.MHFPacket) {
|
||||
}
|
||||
database.Exec(`INSERT INTO guild_hunts (guild_id, host_id, destination, level, hunt_data, cats_used) VALUES ($1, $2, $3, $4, $5, $6)
|
||||
`, guild.ID, s.CharID, destination, level, huntData.Data(), catsUsed)
|
||||
DoAckSimpleSucceed(s, pkt.AckHandle, make([]byte, 4))
|
||||
broadcast.DoAckSimpleSucceed(s, pkt.AckHandle, make([]byte, 4))
|
||||
}
|
||||
|
||||
func HandleMsgMhfAcquireGuildTresure(s *Session, p mhfpacket.MHFPacket) {
|
||||
@@ -131,7 +132,7 @@ func HandleMsgMhfAcquireGuildTresure(s *Session, p mhfpacket.MHFPacket) {
|
||||
s.Logger.Fatal(fmt.Sprintf("Failed to get database instance: %s", err))
|
||||
}
|
||||
database.Exec(`UPDATE guild_hunts SET acquired=true WHERE id=$1`, pkt.HuntID)
|
||||
DoAckSimpleSucceed(s, pkt.AckHandle, make([]byte, 4))
|
||||
broadcast.DoAckSimpleSucceed(s, pkt.AckHandle, make([]byte, 4))
|
||||
}
|
||||
|
||||
func HandleMsgMhfOperateGuildTresureReport(s *Session, p mhfpacket.MHFPacket) {
|
||||
@@ -149,7 +150,7 @@ func HandleMsgMhfOperateGuildTresureReport(s *Session, p mhfpacket.MHFPacket) {
|
||||
case 2: // Claim treasure
|
||||
database.Exec(`INSERT INTO guild_hunts_claimed VALUES ($1, $2)`, pkt.HuntID, s.CharID)
|
||||
}
|
||||
DoAckSimpleSucceed(s, pkt.AckHandle, make([]byte, 4))
|
||||
broadcast.DoAckSimpleSucceed(s, pkt.AckHandle, make([]byte, 4))
|
||||
}
|
||||
|
||||
type TreasureSouvenir struct {
|
||||
@@ -167,10 +168,10 @@ func HandleMsgMhfGetGuildTresureSouvenir(s *Session, p mhfpacket.MHFPacket) {
|
||||
bf.WriteUint32(souvenir.Destination)
|
||||
bf.WriteUint32(souvenir.Quantity)
|
||||
}
|
||||
DoAckBufSucceed(s, pkt.AckHandle, bf.Data())
|
||||
broadcast.DoAckBufSucceed(s, pkt.AckHandle, bf.Data())
|
||||
}
|
||||
|
||||
func HandleMsgMhfAcquireGuildTresureSouvenir(s *Session, p mhfpacket.MHFPacket) {
|
||||
pkt := p.(*mhfpacket.MsgMhfAcquireGuildTresureSouvenir)
|
||||
DoAckSimpleSucceed(s, pkt.AckHandle, make([]byte, 4))
|
||||
broadcast.DoAckSimpleSucceed(s, pkt.AckHandle, make([]byte, 4))
|
||||
}
|
||||
|
||||
@@ -3,6 +3,7 @@ package channelserver
|
||||
import (
|
||||
"erupe-ce/config"
|
||||
"erupe-ce/network/mhfpacket"
|
||||
"erupe-ce/utils/broadcast"
|
||||
"erupe-ce/utils/byteframe"
|
||||
"erupe-ce/utils/db"
|
||||
"erupe-ce/utils/mhfitem"
|
||||
@@ -48,7 +49,7 @@ func handleMsgMhfUpdateInterior(s *Session, p mhfpacket.MHFPacket) {
|
||||
s.Logger.Fatal(fmt.Sprintf("Failed to get database instance: %s", err))
|
||||
}
|
||||
database.Exec(`UPDATE user_binary SET house_furniture=$1 WHERE id=$2`, pkt.InteriorData, s.CharID)
|
||||
DoAckSimpleSucceed(s, pkt.AckHandle, make([]byte, 4))
|
||||
broadcast.DoAckSimpleSucceed(s, pkt.AckHandle, make([]byte, 4))
|
||||
}
|
||||
|
||||
type HouseData struct {
|
||||
@@ -138,7 +139,7 @@ func handleMsgMhfEnumerateHouse(s *Session, p mhfpacket.MHFPacket) {
|
||||
}
|
||||
bf.Seek(0, 0)
|
||||
bf.WriteUint16(uint16(len(houses)))
|
||||
DoAckBufSucceed(s, pkt.AckHandle, bf.Data())
|
||||
broadcast.DoAckBufSucceed(s, pkt.AckHandle, bf.Data())
|
||||
}
|
||||
|
||||
func handleMsgMhfUpdateHouse(s *Session, p mhfpacket.MHFPacket) {
|
||||
@@ -153,7 +154,7 @@ func handleMsgMhfUpdateHouse(s *Session, p mhfpacket.MHFPacket) {
|
||||
// 04 = open guild
|
||||
// 05 = open friends+guild
|
||||
database.Exec(`UPDATE user_binary SET house_state=$1, house_password=$2 WHERE id=$3`, pkt.State, pkt.Password, s.CharID)
|
||||
DoAckSimpleSucceed(s, pkt.AckHandle, make([]byte, 4))
|
||||
broadcast.DoAckSimpleSucceed(s, pkt.AckHandle, make([]byte, 4))
|
||||
}
|
||||
|
||||
func handleMsgMhfLoadHouse(s *Session, p mhfpacket.MHFPacket) {
|
||||
@@ -171,7 +172,7 @@ func handleMsgMhfLoadHouse(s *Session, p mhfpacket.MHFPacket) {
|
||||
|
||||
if pkt.Destination != 9 && len(pkt.Password) > 0 && pkt.CheckPass {
|
||||
if pkt.Password != password {
|
||||
DoAckSimpleFail(s, pkt.AckHandle, make([]byte, 4))
|
||||
broadcast.DoAckSimpleFail(s, pkt.AckHandle, make([]byte, 4))
|
||||
return
|
||||
}
|
||||
}
|
||||
@@ -207,7 +208,7 @@ func handleMsgMhfLoadHouse(s *Session, p mhfpacket.MHFPacket) {
|
||||
}
|
||||
|
||||
if !allowed {
|
||||
DoAckSimpleFail(s, pkt.AckHandle, make([]byte, 4))
|
||||
broadcast.DoAckSimpleFail(s, pkt.AckHandle, make([]byte, 4))
|
||||
return
|
||||
}
|
||||
}
|
||||
@@ -243,9 +244,9 @@ func handleMsgMhfLoadHouse(s *Session, p mhfpacket.MHFPacket) {
|
||||
}
|
||||
}
|
||||
if len(bf.Data()) == 0 {
|
||||
DoAckSimpleFail(s, pkt.AckHandle, make([]byte, 4))
|
||||
broadcast.DoAckSimpleFail(s, pkt.AckHandle, make([]byte, 4))
|
||||
} else {
|
||||
DoAckBufSucceed(s, pkt.AckHandle, bf.Data())
|
||||
broadcast.DoAckBufSucceed(s, pkt.AckHandle, bf.Data())
|
||||
}
|
||||
}
|
||||
|
||||
@@ -258,9 +259,9 @@ func handleMsgMhfGetMyhouseInfo(s *Session, p mhfpacket.MHFPacket) {
|
||||
var data []byte
|
||||
database.QueryRow(`SELECT mission FROM user_binary WHERE id=$1`, s.CharID).Scan(&data)
|
||||
if len(data) > 0 {
|
||||
DoAckBufSucceed(s, pkt.AckHandle, data)
|
||||
broadcast.DoAckBufSucceed(s, pkt.AckHandle, data)
|
||||
} else {
|
||||
DoAckBufSucceed(s, pkt.AckHandle, make([]byte, 9))
|
||||
broadcast.DoAckBufSucceed(s, pkt.AckHandle, make([]byte, 9))
|
||||
}
|
||||
}
|
||||
|
||||
@@ -271,7 +272,7 @@ func handleMsgMhfUpdateMyhouseInfo(s *Session, p mhfpacket.MHFPacket) {
|
||||
s.Logger.Fatal(fmt.Sprintf("Failed to get database instance: %s", err))
|
||||
}
|
||||
database.Exec("UPDATE user_binary SET mission=$1 WHERE id=$2", pkt.Data, s.CharID)
|
||||
DoAckSimpleSucceed(s, pkt.AckHandle, make([]byte, 4))
|
||||
broadcast.DoAckSimpleSucceed(s, pkt.AckHandle, make([]byte, 4))
|
||||
}
|
||||
|
||||
func handleMsgMhfLoadDecoMyset(s *Session, p mhfpacket.MHFPacket) {
|
||||
@@ -292,7 +293,7 @@ func handleMsgMhfLoadDecoMyset(s *Session, p mhfpacket.MHFPacket) {
|
||||
data = []byte{0x00, 0x00}
|
||||
}
|
||||
}
|
||||
DoAckBufSucceed(s, pkt.AckHandle, data)
|
||||
broadcast.DoAckBufSucceed(s, pkt.AckHandle, data)
|
||||
}
|
||||
|
||||
func handleMsgMhfSaveDecoMyset(s *Session, p mhfpacket.MHFPacket) {
|
||||
@@ -305,7 +306,7 @@ func handleMsgMhfSaveDecoMyset(s *Session, p mhfpacket.MHFPacket) {
|
||||
err = database.QueryRow("SELECT decomyset FROM characters WHERE id = $1", s.CharID).Scan(&temp)
|
||||
if err != nil {
|
||||
s.Logger.Error("Failed to load decomyset", zap.Error(err))
|
||||
DoAckSimpleSucceed(s, pkt.AckHandle, make([]byte, 4))
|
||||
broadcast.DoAckSimpleSucceed(s, pkt.AckHandle, make([]byte, 4))
|
||||
return
|
||||
}
|
||||
|
||||
@@ -349,7 +350,7 @@ func handleMsgMhfSaveDecoMyset(s *Session, p mhfpacket.MHFPacket) {
|
||||
|
||||
dumpSaveData(s, bf.Data(), "decomyset")
|
||||
database.Exec("UPDATE characters SET decomyset=$1 WHERE id=$2", bf.Data(), s.CharID)
|
||||
DoAckSimpleSucceed(s, pkt.AckHandle, make([]byte, 4))
|
||||
broadcast.DoAckSimpleSucceed(s, pkt.AckHandle, make([]byte, 4))
|
||||
}
|
||||
|
||||
type Title struct {
|
||||
@@ -370,7 +371,7 @@ func handleMsgMhfEnumerateTitle(s *Session, p mhfpacket.MHFPacket) {
|
||||
bf.WriteUint16(0) // Unk
|
||||
rows, err := database.Queryx("SELECT id, unlocked_at, updated_at FROM titles WHERE char_id=$1", s.CharID)
|
||||
if err != nil {
|
||||
DoAckBufSucceed(s, pkt.AckHandle, bf.Data())
|
||||
broadcast.DoAckBufSucceed(s, pkt.AckHandle, bf.Data())
|
||||
return
|
||||
}
|
||||
for rows.Next() {
|
||||
@@ -387,7 +388,7 @@ func handleMsgMhfEnumerateTitle(s *Session, p mhfpacket.MHFPacket) {
|
||||
}
|
||||
bf.Seek(0, io.SeekStart)
|
||||
bf.WriteUint16(count)
|
||||
DoAckBufSucceed(s, pkt.AckHandle, bf.Data())
|
||||
broadcast.DoAckBufSucceed(s, pkt.AckHandle, bf.Data())
|
||||
}
|
||||
|
||||
func handleMsgMhfAcquireTitle(s *Session, p mhfpacket.MHFPacket) {
|
||||
@@ -405,7 +406,7 @@ func handleMsgMhfAcquireTitle(s *Session, p mhfpacket.MHFPacket) {
|
||||
database.Exec(`UPDATE titles SET updated_at=now() WHERE id=$1 AND char_id=$2`, title, s.CharID)
|
||||
}
|
||||
}
|
||||
DoAckSimpleSucceed(s, pkt.AckHandle, make([]byte, 4))
|
||||
broadcast.DoAckSimpleSucceed(s, pkt.AckHandle, make([]byte, 4))
|
||||
}
|
||||
|
||||
func handleMsgMhfResetTitle(s *Session, p mhfpacket.MHFPacket) {}
|
||||
@@ -483,7 +484,7 @@ func handleMsgMhfOperateWarehouse(s *Session, p mhfpacket.MHFPacket) {
|
||||
// 2 = Rename
|
||||
// 3 = Get usage limit
|
||||
// 4 = Get gift box names (doesn't do anything?)
|
||||
DoAckBufSucceed(s, pkt.AckHandle, bf.Data())
|
||||
broadcast.DoAckBufSucceed(s, pkt.AckHandle, bf.Data())
|
||||
}
|
||||
|
||||
func addWarehouseItem(s *Session, item mhfitem.MHFItemStack) {
|
||||
@@ -559,9 +560,9 @@ func handleMsgMhfEnumerateWarehouse(s *Session, p mhfpacket.MHFPacket) {
|
||||
bf.WriteBytes(mhfitem.SerializeWarehouseEquipment(equipment))
|
||||
}
|
||||
if bf.Index() > 0 {
|
||||
DoAckBufSucceed(s, pkt.AckHandle, bf.Data())
|
||||
broadcast.DoAckBufSucceed(s, pkt.AckHandle, bf.Data())
|
||||
} else {
|
||||
DoAckBufSucceed(s, pkt.AckHandle, make([]byte, 4))
|
||||
broadcast.DoAckBufSucceed(s, pkt.AckHandle, make([]byte, 4))
|
||||
}
|
||||
}
|
||||
|
||||
@@ -600,5 +601,5 @@ func handleMsgMhfUpdateWarehouse(s *Session, p mhfpacket.MHFPacket) {
|
||||
}
|
||||
database.Exec(fmt.Sprintf(`UPDATE warehouse SET equip%d=$1 WHERE character_id=$2`, pkt.BoxIndex), mhfitem.SerializeWarehouseEquipment(fEquip), s.CharID)
|
||||
}
|
||||
DoAckSimpleSucceed(s, pkt.AckHandle, make([]byte, 4))
|
||||
broadcast.DoAckSimpleSucceed(s, pkt.AckHandle, make([]byte, 4))
|
||||
}
|
||||
|
||||
@@ -2,6 +2,7 @@ package channelserver
|
||||
|
||||
import (
|
||||
"erupe-ce/network/mhfpacket"
|
||||
"erupe-ce/utils/broadcast"
|
||||
"erupe-ce/utils/byteframe"
|
||||
"erupe-ce/utils/db"
|
||||
"fmt"
|
||||
@@ -23,7 +24,7 @@ func handleMsgMhfAddKouryouPoint(s *Session, p mhfpacket.MHFPacket) {
|
||||
}
|
||||
resp := byteframe.NewByteFrame()
|
||||
resp.WriteUint32(uint32(points))
|
||||
DoAckBufSucceed(s, pkt.AckHandle, resp.Data())
|
||||
broadcast.DoAckBufSucceed(s, pkt.AckHandle, resp.Data())
|
||||
}
|
||||
|
||||
func handleMsgMhfGetKouryouPoint(s *Session, p mhfpacket.MHFPacket) {
|
||||
@@ -39,7 +40,7 @@ func handleMsgMhfGetKouryouPoint(s *Session, p mhfpacket.MHFPacket) {
|
||||
}
|
||||
resp := byteframe.NewByteFrame()
|
||||
resp.WriteUint32(uint32(points))
|
||||
DoAckBufSucceed(s, pkt.AckHandle, resp.Data())
|
||||
broadcast.DoAckBufSucceed(s, pkt.AckHandle, resp.Data())
|
||||
}
|
||||
|
||||
func handleMsgMhfExchangeKouryouPoint(s *Session, p mhfpacket.MHFPacket) {
|
||||
@@ -56,5 +57,5 @@ func handleMsgMhfExchangeKouryouPoint(s *Session, p mhfpacket.MHFPacket) {
|
||||
}
|
||||
resp := byteframe.NewByteFrame()
|
||||
resp.WriteUint32(uint32(points))
|
||||
DoAckBufSucceed(s, pkt.AckHandle, resp.Data())
|
||||
broadcast.DoAckBufSucceed(s, pkt.AckHandle, resp.Data())
|
||||
}
|
||||
|
||||
@@ -2,6 +2,7 @@ package channelserver
|
||||
|
||||
import (
|
||||
"database/sql"
|
||||
"erupe-ce/utils/broadcast"
|
||||
"erupe-ce/utils/db"
|
||||
"erupe-ce/utils/stringsupport"
|
||||
"fmt"
|
||||
@@ -230,13 +231,13 @@ func handleMsgMhfReadMail(s *Session, p mhfpacket.MHFPacket) {
|
||||
}
|
||||
mailId := s.mailList[pkt.AccIndex]
|
||||
if mailId == 0 {
|
||||
DoAckBufSucceed(s, pkt.AckHandle, []byte{0})
|
||||
broadcast.DoAckBufSucceed(s, pkt.AckHandle, []byte{0})
|
||||
return
|
||||
}
|
||||
|
||||
mail, err := GetMailByID(s, mailId)
|
||||
if err != nil {
|
||||
DoAckBufSucceed(s, pkt.AckHandle, []byte{0})
|
||||
broadcast.DoAckBufSucceed(s, pkt.AckHandle, []byte{0})
|
||||
return
|
||||
}
|
||||
|
||||
@@ -244,7 +245,7 @@ func handleMsgMhfReadMail(s *Session, p mhfpacket.MHFPacket) {
|
||||
bf := byteframe.NewByteFrame()
|
||||
body := stringsupport.UTF8ToSJIS(mail.Body)
|
||||
bf.WriteNullTerminatedBytes(body)
|
||||
DoAckBufSucceed(s, pkt.AckHandle, bf.Data())
|
||||
broadcast.DoAckBufSucceed(s, pkt.AckHandle, bf.Data())
|
||||
}
|
||||
|
||||
func handleMsgMhfListMail(s *Session, p mhfpacket.MHFPacket) {
|
||||
@@ -252,7 +253,7 @@ func handleMsgMhfListMail(s *Session, p mhfpacket.MHFPacket) {
|
||||
|
||||
mail, err := GetMailListForCharacter(s, s.CharID)
|
||||
if err != nil {
|
||||
DoAckBufSucceed(s, pkt.AckHandle, []byte{0})
|
||||
broadcast.DoAckBufSucceed(s, pkt.AckHandle, []byte{0})
|
||||
return
|
||||
}
|
||||
|
||||
@@ -313,7 +314,7 @@ func handleMsgMhfListMail(s *Session, p mhfpacket.MHFPacket) {
|
||||
}
|
||||
}
|
||||
|
||||
DoAckBufSucceed(s, pkt.AckHandle, msg.Data())
|
||||
broadcast.DoAckBufSucceed(s, pkt.AckHandle, msg.Data())
|
||||
}
|
||||
|
||||
func handleMsgMhfOprtMail(s *Session, p mhfpacket.MHFPacket) {
|
||||
@@ -324,7 +325,7 @@ func handleMsgMhfOprtMail(s *Session, p mhfpacket.MHFPacket) {
|
||||
}
|
||||
mail, err := GetMailByID(s, s.mailList[pkt.AccIndex])
|
||||
if err != nil {
|
||||
DoAckSimpleSucceed(s, pkt.AckHandle, make([]byte, 4))
|
||||
broadcast.DoAckSimpleSucceed(s, pkt.AckHandle, make([]byte, 4))
|
||||
return
|
||||
}
|
||||
|
||||
@@ -338,7 +339,7 @@ func handleMsgMhfOprtMail(s *Session, p mhfpacket.MHFPacket) {
|
||||
case mhfpacket.OperateMailAcquireItem:
|
||||
database.Exec(`UPDATE mail SET attached_item_received = TRUE WHERE id = $1`, mail.ID)
|
||||
}
|
||||
DoAckSimpleSucceed(s, pkt.AckHandle, make([]byte, 4))
|
||||
broadcast.DoAckSimpleSucceed(s, pkt.AckHandle, make([]byte, 4))
|
||||
}
|
||||
|
||||
func handleMsgMhfSendMail(s *Session, p mhfpacket.MHFPacket) {
|
||||
@@ -356,20 +357,20 @@ func handleMsgMhfSendMail(s *Session, p mhfpacket.MHFPacket) {
|
||||
g, err := GetGuildInfoByCharacterId(s, s.CharID)
|
||||
if err != nil {
|
||||
s.Logger.Error("Failed to get guild info for mail")
|
||||
DoAckSimpleSucceed(s, pkt.AckHandle, make([]byte, 4))
|
||||
broadcast.DoAckSimpleSucceed(s, pkt.AckHandle, make([]byte, 4))
|
||||
return
|
||||
}
|
||||
gm, err := GetGuildMembers(s, g.ID, false)
|
||||
if err != nil {
|
||||
s.Logger.Error("Failed to get guild members for mail")
|
||||
DoAckSimpleSucceed(s, pkt.AckHandle, make([]byte, 4))
|
||||
broadcast.DoAckSimpleSucceed(s, pkt.AckHandle, make([]byte, 4))
|
||||
return
|
||||
}
|
||||
for i := 0; i < len(gm); i++ {
|
||||
_, err := database.Exec(query, s.CharID, gm[i].CharID, pkt.Subject, pkt.Body, 0, 0, false)
|
||||
if err != nil {
|
||||
s.Logger.Error("Failed to send mail")
|
||||
DoAckSimpleSucceed(s, pkt.AckHandle, make([]byte, 4))
|
||||
broadcast.DoAckSimpleSucceed(s, pkt.AckHandle, make([]byte, 4))
|
||||
return
|
||||
}
|
||||
}
|
||||
@@ -379,5 +380,5 @@ func handleMsgMhfSendMail(s *Session, p mhfpacket.MHFPacket) {
|
||||
s.Logger.Error("Failed to send mail")
|
||||
}
|
||||
}
|
||||
DoAckSimpleSucceed(s, pkt.AckHandle, make([]byte, 4))
|
||||
broadcast.DoAckSimpleSucceed(s, pkt.AckHandle, make([]byte, 4))
|
||||
}
|
||||
|
||||
@@ -6,6 +6,7 @@ import (
|
||||
"erupe-ce/server/channelserver/compression/deltacomp"
|
||||
"erupe-ce/server/channelserver/compression/nullcomp"
|
||||
|
||||
"erupe-ce/utils/broadcast"
|
||||
"erupe-ce/utils/byteframe"
|
||||
"erupe-ce/utils/db"
|
||||
"erupe-ce/utils/gametime"
|
||||
@@ -29,7 +30,7 @@ func handleMsgMhfLoadPartner(s *Session, p mhfpacket.MHFPacket) {
|
||||
s.Logger.Error("Failed to load partner", zap.Error(err))
|
||||
data = make([]byte, 9)
|
||||
}
|
||||
DoAckBufSucceed(s, pkt.AckHandle, data)
|
||||
broadcast.DoAckBufSucceed(s, pkt.AckHandle, data)
|
||||
}
|
||||
|
||||
func handleMsgMhfSavePartner(s *Session, p mhfpacket.MHFPacket) {
|
||||
@@ -43,7 +44,7 @@ func handleMsgMhfSavePartner(s *Session, p mhfpacket.MHFPacket) {
|
||||
if err != nil {
|
||||
s.Logger.Error("Failed to save partner", zap.Error(err))
|
||||
}
|
||||
DoAckSimpleSucceed(s, pkt.AckHandle, []byte{0x00, 0x00, 0x00, 0x00})
|
||||
broadcast.DoAckSimpleSucceed(s, pkt.AckHandle, []byte{0x00, 0x00, 0x00, 0x00})
|
||||
}
|
||||
|
||||
func handleMsgMhfLoadLegendDispatch(s *Session, p mhfpacket.MHFPacket) {
|
||||
@@ -62,7 +63,7 @@ func handleMsgMhfLoadLegendDispatch(s *Session, p mhfpacket.MHFPacket) {
|
||||
bf.WriteUint32(dispatch.Unk)
|
||||
bf.WriteUint32(dispatch.Timestamp)
|
||||
}
|
||||
DoAckBufSucceed(s, pkt.AckHandle, bf.Data())
|
||||
broadcast.DoAckBufSucceed(s, pkt.AckHandle, bf.Data())
|
||||
}
|
||||
|
||||
func handleMsgMhfLoadHunterNavi(s *Session, p mhfpacket.MHFPacket) {
|
||||
@@ -81,7 +82,7 @@ func handleMsgMhfLoadHunterNavi(s *Session, p mhfpacket.MHFPacket) {
|
||||
s.Logger.Error("Failed to load hunternavi", zap.Error(err))
|
||||
data = make([]byte, naviLength)
|
||||
}
|
||||
DoAckBufSucceed(s, pkt.AckHandle, data)
|
||||
broadcast.DoAckBufSucceed(s, pkt.AckHandle, data)
|
||||
}
|
||||
|
||||
func handleMsgMhfSaveHunterNavi(s *Session, p mhfpacket.MHFPacket) {
|
||||
@@ -124,7 +125,7 @@ func handleMsgMhfSaveHunterNavi(s *Session, p mhfpacket.MHFPacket) {
|
||||
s.Logger.Error("Failed to save hunternavi", zap.Error(err))
|
||||
}
|
||||
}
|
||||
DoAckSimpleSucceed(s, pkt.AckHandle, []byte{0x00, 0x00, 0x00, 0x00})
|
||||
broadcast.DoAckSimpleSucceed(s, pkt.AckHandle, []byte{0x00, 0x00, 0x00, 0x00})
|
||||
}
|
||||
|
||||
func handleMsgMhfMercenaryHuntdata(s *Session, p mhfpacket.MHFPacket) {
|
||||
@@ -135,9 +136,9 @@ func handleMsgMhfMercenaryHuntdata(s *Session, p mhfpacket.MHFPacket) {
|
||||
// struct Hunt
|
||||
// uint32 HuntID
|
||||
// uint32 MonID
|
||||
DoAckBufSucceed(s, pkt.AckHandle, make([]byte, 1))
|
||||
broadcast.DoAckBufSucceed(s, pkt.AckHandle, make([]byte, 1))
|
||||
} else {
|
||||
DoAckBufSucceed(s, pkt.AckHandle, make([]byte, 0))
|
||||
broadcast.DoAckBufSucceed(s, pkt.AckHandle, make([]byte, 0))
|
||||
}
|
||||
}
|
||||
|
||||
@@ -151,7 +152,7 @@ func handleMsgMhfEnumerateMercenaryLog(s *Session, p mhfpacket.MHFPacket) {
|
||||
// []byte Name (len 18)
|
||||
// uint8 Unk
|
||||
// uint8 Unk
|
||||
DoAckBufSucceed(s, pkt.AckHandle, bf.Data())
|
||||
broadcast.DoAckBufSucceed(s, pkt.AckHandle, bf.Data())
|
||||
}
|
||||
|
||||
func handleMsgMhfCreateMercenary(s *Session, p mhfpacket.MHFPacket) {
|
||||
@@ -165,7 +166,7 @@ func handleMsgMhfCreateMercenary(s *Session, p mhfpacket.MHFPacket) {
|
||||
_ = database.QueryRow("SELECT nextval('rasta_id_seq')").Scan(&nextID)
|
||||
database.Exec("UPDATE characters SET rasta_id=$1 WHERE id=$2", nextID, s.CharID)
|
||||
bf.WriteUint32(nextID)
|
||||
DoAckSimpleSucceed(s, pkt.AckHandle, bf.Data())
|
||||
broadcast.DoAckSimpleSucceed(s, pkt.AckHandle, bf.Data())
|
||||
}
|
||||
|
||||
func handleMsgMhfSaveMercenary(s *Session, p mhfpacket.MHFPacket) {
|
||||
@@ -180,7 +181,7 @@ func handleMsgMhfSaveMercenary(s *Session, p mhfpacket.MHFPacket) {
|
||||
database.Exec("UPDATE characters SET savemercenary=$1, rasta_id=$2 WHERE id=$3", pkt.MercData, temp.ReadUint32(), s.CharID)
|
||||
}
|
||||
database.Exec("UPDATE characters SET gcp=$1, pact_id=$2 WHERE id=$3", pkt.GCP, pkt.PactMercID, s.CharID)
|
||||
DoAckSimpleSucceed(s, pkt.AckHandle, []byte{0x00, 0x00, 0x00, 0x00})
|
||||
broadcast.DoAckSimpleSucceed(s, pkt.AckHandle, []byte{0x00, 0x00, 0x00, 0x00})
|
||||
}
|
||||
|
||||
func handleMsgMhfReadMercenaryW(s *Session, p mhfpacket.MHFPacket) {
|
||||
@@ -242,7 +243,7 @@ func handleMsgMhfReadMercenaryW(s *Session, p mhfpacket.MHFPacket) {
|
||||
bf.WriteUint32(gcp)
|
||||
}
|
||||
|
||||
DoAckBufSucceed(s, pkt.AckHandle, bf.Data())
|
||||
broadcast.DoAckBufSucceed(s, pkt.AckHandle, bf.Data())
|
||||
}
|
||||
|
||||
func handleMsgMhfReadMercenaryM(s *Session, p mhfpacket.MHFPacket) {
|
||||
@@ -259,7 +260,7 @@ func handleMsgMhfReadMercenaryM(s *Session, p mhfpacket.MHFPacket) {
|
||||
} else {
|
||||
resp.WriteBytes(data)
|
||||
}
|
||||
DoAckBufSucceed(s, pkt.AckHandle, resp.Data())
|
||||
broadcast.DoAckBufSucceed(s, pkt.AckHandle, resp.Data())
|
||||
}
|
||||
|
||||
func handleMsgMhfContractMercenary(s *Session, p mhfpacket.MHFPacket) {
|
||||
@@ -276,7 +277,7 @@ func handleMsgMhfContractMercenary(s *Session, p mhfpacket.MHFPacket) {
|
||||
case 2: // Cancel loan
|
||||
database.Exec("UPDATE characters SET pact_id=0 WHERE id=$1", pkt.CID)
|
||||
}
|
||||
DoAckSimpleSucceed(s, pkt.AckHandle, make([]byte, 4))
|
||||
broadcast.DoAckSimpleSucceed(s, pkt.AckHandle, make([]byte, 4))
|
||||
}
|
||||
|
||||
func handleMsgMhfLoadOtomoAirou(s *Session, p mhfpacket.MHFPacket) {
|
||||
@@ -291,7 +292,7 @@ func handleMsgMhfLoadOtomoAirou(s *Session, p mhfpacket.MHFPacket) {
|
||||
s.Logger.Error("Failed to load otomoairou", zap.Error(err))
|
||||
data = make([]byte, 10)
|
||||
}
|
||||
DoAckBufSucceed(s, pkt.AckHandle, data)
|
||||
broadcast.DoAckBufSucceed(s, pkt.AckHandle, data)
|
||||
}
|
||||
|
||||
func handleMsgMhfSaveOtomoAirou(s *Session, p mhfpacket.MHFPacket) {
|
||||
@@ -304,7 +305,7 @@ func handleMsgMhfSaveOtomoAirou(s *Session, p mhfpacket.MHFPacket) {
|
||||
decomp, err := nullcomp.Decompress(pkt.RawDataPayload[1:])
|
||||
if err != nil {
|
||||
s.Logger.Error("Failed to decompress airou", zap.Error(err))
|
||||
DoAckSimpleSucceed(s, pkt.AckHandle, make([]byte, 4))
|
||||
broadcast.DoAckSimpleSucceed(s, pkt.AckHandle, make([]byte, 4))
|
||||
return
|
||||
}
|
||||
bf := byteframe.NewByteFrameFromBytes(decomp)
|
||||
@@ -339,7 +340,7 @@ func handleMsgMhfSaveOtomoAirou(s *Session, p mhfpacket.MHFPacket) {
|
||||
comp = append([]byte{0x01}, comp...)
|
||||
database.Exec("UPDATE characters SET otomoairou=$1 WHERE id=$2", comp, s.CharID)
|
||||
}
|
||||
DoAckSimpleSucceed(s, pkt.AckHandle, make([]byte, 4))
|
||||
broadcast.DoAckSimpleSucceed(s, pkt.AckHandle, make([]byte, 4))
|
||||
}
|
||||
|
||||
func handleMsgMhfEnumerateAiroulist(s *Session, p mhfpacket.MHFPacket) {
|
||||
@@ -358,7 +359,7 @@ func handleMsgMhfEnumerateAiroulist(s *Session, p mhfpacket.MHFPacket) {
|
||||
resp.WriteUint16(cat.WeaponID)
|
||||
resp.WriteUint32(0) // 32 bit unix timestamp, either time at which the cat stops being fatigued or the time at which it started
|
||||
}
|
||||
DoAckBufSucceed(s, pkt.AckHandle, resp.Data())
|
||||
broadcast.DoAckBufSucceed(s, pkt.AckHandle, resp.Data())
|
||||
}
|
||||
|
||||
type Airou struct {
|
||||
|
||||
@@ -5,6 +5,7 @@ import (
|
||||
|
||||
"erupe-ce/config"
|
||||
"erupe-ce/network/mhfpacket"
|
||||
"erupe-ce/utils/broadcast"
|
||||
"erupe-ce/utils/byteframe"
|
||||
)
|
||||
|
||||
@@ -25,7 +26,7 @@ func handleMsgSysCreateObject(s *Session, p mhfpacket.MHFPacket) {
|
||||
// Response to our requesting client.
|
||||
resp := byteframe.NewByteFrame()
|
||||
resp.WriteUint32(newObj.id) // New local obj handle.
|
||||
DoAckSimpleSucceed(s, pkt.AckHandle, resp.Data())
|
||||
broadcast.DoAckSimpleSucceed(s, pkt.AckHandle, resp.Data())
|
||||
// Duplicate the object creation to all sessions in the same stage.
|
||||
dupObjUpdate := &mhfpacket.MsgSysDuplicateObject{
|
||||
ObjID: newObj.id,
|
||||
|
||||
@@ -4,6 +4,7 @@ import (
|
||||
"erupe-ce/network/mhfpacket"
|
||||
"erupe-ce/server/channelserver/compression/deltacomp"
|
||||
"erupe-ce/server/channelserver/compression/nullcomp"
|
||||
"erupe-ce/utils/broadcast"
|
||||
"erupe-ce/utils/db"
|
||||
"fmt"
|
||||
|
||||
@@ -21,7 +22,7 @@ func handleMsgMhfLoadPlateData(s *Session, p mhfpacket.MHFPacket) {
|
||||
if err != nil {
|
||||
s.Logger.Error("Failed to load platedata", zap.Error(err))
|
||||
}
|
||||
DoAckBufSucceed(s, pkt.AckHandle, data)
|
||||
broadcast.DoAckBufSucceed(s, pkt.AckHandle, data)
|
||||
}
|
||||
|
||||
func handleMsgMhfSavePlateData(s *Session, p mhfpacket.MHFPacket) {
|
||||
@@ -37,7 +38,7 @@ func handleMsgMhfSavePlateData(s *Session, p mhfpacket.MHFPacket) {
|
||||
err := database.QueryRow("SELECT platedata FROM characters WHERE id = $1", s.CharID).Scan(&data)
|
||||
if err != nil {
|
||||
s.Logger.Error("Failed to load platedata", zap.Error(err))
|
||||
DoAckSimpleSucceed(s, pkt.AckHandle, []byte{0x00, 0x00, 0x00, 0x00})
|
||||
broadcast.DoAckSimpleSucceed(s, pkt.AckHandle, []byte{0x00, 0x00, 0x00, 0x00})
|
||||
return
|
||||
}
|
||||
|
||||
@@ -47,7 +48,7 @@ func handleMsgMhfSavePlateData(s *Session, p mhfpacket.MHFPacket) {
|
||||
data, err = nullcomp.Decompress(data)
|
||||
if err != nil {
|
||||
s.Logger.Error("Failed to decompress platedata", zap.Error(err))
|
||||
DoAckSimpleSucceed(s, pkt.AckHandle, []byte{0x00, 0x00, 0x00, 0x00})
|
||||
broadcast.DoAckSimpleSucceed(s, pkt.AckHandle, []byte{0x00, 0x00, 0x00, 0x00})
|
||||
return
|
||||
}
|
||||
} else {
|
||||
@@ -60,14 +61,14 @@ func handleMsgMhfSavePlateData(s *Session, p mhfpacket.MHFPacket) {
|
||||
saveOutput, err := nullcomp.Compress(deltacomp.ApplyDataDiff(pkt.RawDataPayload, data))
|
||||
if err != nil {
|
||||
s.Logger.Error("Failed to diff and compress platedata", zap.Error(err))
|
||||
DoAckSimpleSucceed(s, pkt.AckHandle, []byte{0x00, 0x00, 0x00, 0x00})
|
||||
broadcast.DoAckSimpleSucceed(s, pkt.AckHandle, []byte{0x00, 0x00, 0x00, 0x00})
|
||||
return
|
||||
}
|
||||
|
||||
_, err = database.Exec("UPDATE characters SET platedata=$1 WHERE id=$2", saveOutput, s.CharID)
|
||||
if err != nil {
|
||||
s.Logger.Error("Failed to save platedata", zap.Error(err))
|
||||
DoAckSimpleSucceed(s, pkt.AckHandle, []byte{0x00, 0x00, 0x00, 0x00})
|
||||
broadcast.DoAckSimpleSucceed(s, pkt.AckHandle, []byte{0x00, 0x00, 0x00, 0x00})
|
||||
return
|
||||
}
|
||||
|
||||
@@ -81,7 +82,7 @@ func handleMsgMhfSavePlateData(s *Session, p mhfpacket.MHFPacket) {
|
||||
}
|
||||
}
|
||||
|
||||
DoAckSimpleSucceed(s, pkt.AckHandle, []byte{0x00, 0x00, 0x00, 0x00})
|
||||
broadcast.DoAckSimpleSucceed(s, pkt.AckHandle, []byte{0x00, 0x00, 0x00, 0x00})
|
||||
}
|
||||
|
||||
func handleMsgMhfLoadPlateBox(s *Session, p mhfpacket.MHFPacket) {
|
||||
@@ -95,7 +96,7 @@ func handleMsgMhfLoadPlateBox(s *Session, p mhfpacket.MHFPacket) {
|
||||
if err != nil {
|
||||
s.Logger.Error("Failed to load platebox", zap.Error(err))
|
||||
}
|
||||
DoAckBufSucceed(s, pkt.AckHandle, data)
|
||||
broadcast.DoAckBufSucceed(s, pkt.AckHandle, data)
|
||||
}
|
||||
|
||||
func handleMsgMhfSavePlateBox(s *Session, p mhfpacket.MHFPacket) {
|
||||
@@ -111,7 +112,7 @@ func handleMsgMhfSavePlateBox(s *Session, p mhfpacket.MHFPacket) {
|
||||
err := database.QueryRow("SELECT platebox FROM characters WHERE id = $1", s.CharID).Scan(&data)
|
||||
if err != nil {
|
||||
s.Logger.Error("Failed to load platebox", zap.Error(err))
|
||||
DoAckSimpleSucceed(s, pkt.AckHandle, []byte{0x00, 0x00, 0x00, 0x00})
|
||||
broadcast.DoAckSimpleSucceed(s, pkt.AckHandle, []byte{0x00, 0x00, 0x00, 0x00})
|
||||
return
|
||||
}
|
||||
|
||||
@@ -122,7 +123,7 @@ func handleMsgMhfSavePlateBox(s *Session, p mhfpacket.MHFPacket) {
|
||||
data, err = nullcomp.Decompress(data)
|
||||
if err != nil {
|
||||
s.Logger.Error("Failed to decompress platebox", zap.Error(err))
|
||||
DoAckSimpleSucceed(s, pkt.AckHandle, []byte{0x00, 0x00, 0x00, 0x00})
|
||||
broadcast.DoAckSimpleSucceed(s, pkt.AckHandle, []byte{0x00, 0x00, 0x00, 0x00})
|
||||
return
|
||||
}
|
||||
} else {
|
||||
@@ -135,14 +136,14 @@ func handleMsgMhfSavePlateBox(s *Session, p mhfpacket.MHFPacket) {
|
||||
saveOutput, err := nullcomp.Compress(deltacomp.ApplyDataDiff(pkt.RawDataPayload, data))
|
||||
if err != nil {
|
||||
s.Logger.Error("Failed to diff and compress platebox", zap.Error(err))
|
||||
DoAckSimpleSucceed(s, pkt.AckHandle, []byte{0x00, 0x00, 0x00, 0x00})
|
||||
broadcast.DoAckSimpleSucceed(s, pkt.AckHandle, []byte{0x00, 0x00, 0x00, 0x00})
|
||||
return
|
||||
}
|
||||
|
||||
_, err = database.Exec("UPDATE characters SET platebox=$1 WHERE id=$2", saveOutput, s.CharID)
|
||||
if err != nil {
|
||||
s.Logger.Error("Failed to save platebox", zap.Error(err))
|
||||
DoAckSimpleSucceed(s, pkt.AckHandle, []byte{0x00, 0x00, 0x00, 0x00})
|
||||
broadcast.DoAckSimpleSucceed(s, pkt.AckHandle, []byte{0x00, 0x00, 0x00, 0x00})
|
||||
return
|
||||
}
|
||||
|
||||
@@ -155,7 +156,7 @@ func handleMsgMhfSavePlateBox(s *Session, p mhfpacket.MHFPacket) {
|
||||
s.Logger.Error("Failed to save platebox", zap.Error(err))
|
||||
}
|
||||
}
|
||||
DoAckSimpleSucceed(s, pkt.AckHandle, []byte{0x00, 0x00, 0x00, 0x00})
|
||||
broadcast.DoAckSimpleSucceed(s, pkt.AckHandle, []byte{0x00, 0x00, 0x00, 0x00})
|
||||
}
|
||||
|
||||
func handleMsgMhfLoadPlateMyset(s *Session, p mhfpacket.MHFPacket) {
|
||||
@@ -170,7 +171,7 @@ func handleMsgMhfLoadPlateMyset(s *Session, p mhfpacket.MHFPacket) {
|
||||
s.Logger.Error("Failed to load platemyset", zap.Error(err))
|
||||
data = make([]byte, 1920)
|
||||
}
|
||||
DoAckBufSucceed(s, pkt.AckHandle, data)
|
||||
broadcast.DoAckBufSucceed(s, pkt.AckHandle, data)
|
||||
}
|
||||
|
||||
func handleMsgMhfSavePlateMyset(s *Session, p mhfpacket.MHFPacket) {
|
||||
@@ -185,5 +186,5 @@ func handleMsgMhfSavePlateMyset(s *Session, p mhfpacket.MHFPacket) {
|
||||
if err != nil {
|
||||
s.Logger.Error("Failed to save platemyset", zap.Error(err))
|
||||
}
|
||||
DoAckSimpleSucceed(s, pkt.AckHandle, []byte{0x00, 0x00, 0x00, 0x00})
|
||||
broadcast.DoAckSimpleSucceed(s, pkt.AckHandle, []byte{0x00, 0x00, 0x00, 0x00})
|
||||
}
|
||||
|
||||
@@ -3,6 +3,7 @@ package channelserver
|
||||
import (
|
||||
"database/sql"
|
||||
"encoding/binary"
|
||||
"erupe-ce/utils/broadcast"
|
||||
"erupe-ce/utils/byteframe"
|
||||
"erupe-ce/utils/db"
|
||||
"erupe-ce/utils/decryption"
|
||||
@@ -110,10 +111,10 @@ func handleMsgSysGetFile(s *Session, p mhfpacket.MHFPacket) {
|
||||
if err != nil {
|
||||
s.Logger.Error(fmt.Sprintf("Failed to open file: %s/scenarios/%s.bin", config.GetConfig().BinPath, filename))
|
||||
// This will crash the game.
|
||||
DoAckBufSucceed(s, pkt.AckHandle, data)
|
||||
broadcast.DoAckBufSucceed(s, pkt.AckHandle, data)
|
||||
return
|
||||
}
|
||||
DoAckBufSucceed(s, pkt.AckHandle, data)
|
||||
broadcast.DoAckBufSucceed(s, pkt.AckHandle, data)
|
||||
} else {
|
||||
if config.GetConfig().DebugOptions.QuestTools {
|
||||
s.Logger.Debug(
|
||||
@@ -130,13 +131,13 @@ func handleMsgSysGetFile(s *Session, p mhfpacket.MHFPacket) {
|
||||
if err != nil {
|
||||
s.Logger.Error(fmt.Sprintf("Failed to open file: %s/quests/%s.bin", config.GetConfig().BinPath, pkt.Filename))
|
||||
// This will crash the game.
|
||||
DoAckBufSucceed(s, pkt.AckHandle, data)
|
||||
broadcast.DoAckBufSucceed(s, pkt.AckHandle, data)
|
||||
return
|
||||
}
|
||||
if config.GetConfig().ClientID <= config.Z1 && config.GetConfig().DebugOptions.AutoQuestBackport {
|
||||
data = BackportQuest(decryption.UnpackSimple(data))
|
||||
}
|
||||
DoAckBufSucceed(s, pkt.AckHandle, data)
|
||||
broadcast.DoAckBufSucceed(s, pkt.AckHandle, data)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -176,9 +177,9 @@ func handleMsgMhfLoadFavoriteQuest(s *Session, p mhfpacket.MHFPacket) {
|
||||
}
|
||||
err = database.QueryRow("SELECT savefavoritequest FROM characters WHERE id = $1", s.CharID).Scan(&data)
|
||||
if err == nil && len(data) > 0 {
|
||||
DoAckBufSucceed(s, pkt.AckHandle, data)
|
||||
broadcast.DoAckBufSucceed(s, pkt.AckHandle, data)
|
||||
} else {
|
||||
DoAckBufSucceed(s, pkt.AckHandle, []byte{0x01, 0x00, 0x01, 0x00, 0x01, 0x00, 0x01, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00})
|
||||
broadcast.DoAckBufSucceed(s, pkt.AckHandle, []byte{0x01, 0x00, 0x01, 0x00, 0x01, 0x00, 0x01, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00})
|
||||
}
|
||||
}
|
||||
|
||||
@@ -190,7 +191,7 @@ func handleMsgMhfSaveFavoriteQuest(s *Session, p mhfpacket.MHFPacket) {
|
||||
s.Logger.Fatal(fmt.Sprintf("Failed to get database instance: %s", err))
|
||||
}
|
||||
database.Exec("UPDATE characters SET savefavoritequest=$1 WHERE id=$2", pkt.Data, s.CharID)
|
||||
DoAckSimpleSucceed(s, pkt.AckHandle, []byte{0x00, 0x00, 0x00, 0x00})
|
||||
broadcast.DoAckSimpleSucceed(s, pkt.AckHandle, []byte{0x00, 0x00, 0x00, 0x00})
|
||||
}
|
||||
|
||||
func loadQuestFile(s *Session, questId int) []byte {
|
||||
@@ -656,7 +657,7 @@ func handleMsgMhfEnumerateQuest(s *Session, p mhfpacket.MHFPacket) {
|
||||
bf.Seek(0, io.SeekStart)
|
||||
bf.WriteUint16(returnedCount)
|
||||
|
||||
DoAckBufSucceed(s, pkt.AckHandle, bf.Data())
|
||||
broadcast.DoAckBufSucceed(s, pkt.AckHandle, bf.Data())
|
||||
}
|
||||
|
||||
func getTuneValueRange(start uint16, value uint16) []tuneValue {
|
||||
@@ -694,5 +695,5 @@ func handleMsgMhfGetUdBonusQuestInfo(s *Session, p mhfpacket.MHFPacket) {
|
||||
resp.WriteUint8(q.Unk6)
|
||||
}
|
||||
|
||||
DoAckBufSucceed(s, pkt.AckHandle, resp.Data())
|
||||
broadcast.DoAckBufSucceed(s, pkt.AckHandle, resp.Data())
|
||||
}
|
||||
|
||||
@@ -3,6 +3,7 @@ package channelserver
|
||||
import (
|
||||
"erupe-ce/config"
|
||||
"erupe-ce/network/mhfpacket"
|
||||
"erupe-ce/utils/broadcast"
|
||||
"erupe-ce/utils/byteframe"
|
||||
"strings"
|
||||
)
|
||||
@@ -12,13 +13,13 @@ func handleMsgMhfRegisterEvent(s *Session, p mhfpacket.MHFPacket) {
|
||||
bf := byteframe.NewByteFrame()
|
||||
// Some kind of check if there's already a session
|
||||
if pkt.Unk1 && s.Server.getRaviSemaphore() == nil {
|
||||
DoAckSimpleSucceed(s, pkt.AckHandle, make([]byte, 4))
|
||||
broadcast.DoAckSimpleSucceed(s, pkt.AckHandle, make([]byte, 4))
|
||||
return
|
||||
}
|
||||
bf.WriteUint8(uint8(pkt.WorldID))
|
||||
bf.WriteUint8(uint8(pkt.LandID))
|
||||
bf.WriteUint16(s.Server.raviente.id)
|
||||
DoAckSimpleSucceed(s, pkt.AckHandle, bf.Data())
|
||||
broadcast.DoAckSimpleSucceed(s, pkt.AckHandle, bf.Data())
|
||||
}
|
||||
|
||||
func handleMsgMhfReleaseEvent(s *Session, p mhfpacket.MHFPacket) {
|
||||
@@ -86,7 +87,7 @@ func handleMsgSysOperateRegister(s *Session, p mhfpacket.MHFPacket) {
|
||||
bf.WriteUint32(_new)
|
||||
}
|
||||
s.Server.raviente.Unlock()
|
||||
DoAckBufSucceed(s, pkt.AckHandle, bf.Data())
|
||||
broadcast.DoAckBufSucceed(s, pkt.AckHandle, bf.Data())
|
||||
|
||||
if config.GetConfig().GameplayOptions.LowLatencyRaviente {
|
||||
s.notifyRavi()
|
||||
@@ -108,7 +109,7 @@ func handleMsgSysLoadRegister(s *Session, p mhfpacket.MHFPacket) {
|
||||
bf.WriteUint32(s.Server.raviente.register[i])
|
||||
}
|
||||
}
|
||||
DoAckBufSucceed(s, pkt.AckHandle, bf.Data())
|
||||
broadcast.DoAckBufSucceed(s, pkt.AckHandle, bf.Data())
|
||||
}
|
||||
|
||||
func (s *Session) notifyRavi() {
|
||||
|
||||
@@ -2,6 +2,7 @@ package channelserver
|
||||
|
||||
import (
|
||||
"erupe-ce/config"
|
||||
"erupe-ce/utils/broadcast"
|
||||
"erupe-ce/utils/db"
|
||||
ps "erupe-ce/utils/pascalstring"
|
||||
"fmt"
|
||||
@@ -28,7 +29,7 @@ func handleMsgMhfSaveRengokuData(s *Session, p mhfpacket.MHFPacket) {
|
||||
_, err = database.Exec("UPDATE characters SET rengokudata=$1 WHERE id=$2", pkt.RawDataPayload, s.CharID)
|
||||
if err != nil {
|
||||
s.Logger.Error("Failed to save rengokudata", zap.Error(err))
|
||||
DoAckSimpleSucceed(s, pkt.AckHandle, make([]byte, 4))
|
||||
broadcast.DoAckSimpleSucceed(s, pkt.AckHandle, make([]byte, 4))
|
||||
return
|
||||
}
|
||||
bf := byteframe.NewByteFrameFromBytes(pkt.RawDataPayload)
|
||||
@@ -44,7 +45,7 @@ func handleMsgMhfSaveRengokuData(s *Session, p mhfpacket.MHFPacket) {
|
||||
database.Exec("INSERT INTO rengoku_score (character_id) VALUES ($1)", s.CharID)
|
||||
}
|
||||
database.Exec("UPDATE rengoku_score SET max_stages_mp=$1, max_points_mp=$2, max_stages_sp=$3, max_points_sp=$4 WHERE character_id=$5", maxStageMp, maxScoreMp, maxStageSp, maxScoreSp, s.CharID)
|
||||
DoAckSimpleSucceed(s, pkt.AckHandle, make([]byte, 4))
|
||||
broadcast.DoAckSimpleSucceed(s, pkt.AckHandle, make([]byte, 4))
|
||||
}
|
||||
|
||||
func handleMsgMhfLoadRengokuData(s *Session, p mhfpacket.MHFPacket) {
|
||||
@@ -59,7 +60,7 @@ func handleMsgMhfLoadRengokuData(s *Session, p mhfpacket.MHFPacket) {
|
||||
s.Logger.Error("Failed to load rengokudata", zap.Error(err))
|
||||
}
|
||||
if len(data) > 0 {
|
||||
DoAckBufSucceed(s, pkt.AckHandle, data)
|
||||
broadcast.DoAckBufSucceed(s, pkt.AckHandle, data)
|
||||
} else {
|
||||
resp := byteframe.NewByteFrame()
|
||||
resp.WriteUint32(0)
|
||||
@@ -97,7 +98,7 @@ func handleMsgMhfLoadRengokuData(s *Session, p mhfpacket.MHFPacket) {
|
||||
resp.WriteUint32(0)
|
||||
resp.WriteUint32(0)
|
||||
|
||||
DoAckBufSucceed(s, pkt.AckHandle, resp.Data())
|
||||
broadcast.DoAckBufSucceed(s, pkt.AckHandle, resp.Data())
|
||||
}
|
||||
}
|
||||
|
||||
@@ -108,7 +109,7 @@ func handleMsgMhfGetRengokuBinary(s *Session, p mhfpacket.MHFPacket) {
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
DoAckBufSucceed(s, pkt.AckHandle, data)
|
||||
broadcast.DoAckBufSucceed(s, pkt.AckHandle, data)
|
||||
}
|
||||
|
||||
const rengokuScoreQuery = `, c.name FROM rengoku_score rs
|
||||
@@ -131,7 +132,7 @@ func handleMsgMhfEnumerateRengokuRanking(s *Session, p mhfpacket.MHFPacket) {
|
||||
|
||||
if pkt.Leaderboard == 2 || pkt.Leaderboard == 3 || pkt.Leaderboard == 6 || pkt.Leaderboard == 7 {
|
||||
if guild == nil {
|
||||
DoAckBufSucceed(s, pkt.AckHandle, make([]byte, 11))
|
||||
broadcast.DoAckBufSucceed(s, pkt.AckHandle, make([]byte, 11))
|
||||
return
|
||||
}
|
||||
}
|
||||
@@ -190,7 +191,7 @@ func handleMsgMhfEnumerateRengokuRanking(s *Session, p mhfpacket.MHFPacket) {
|
||||
}
|
||||
bf.WriteUint8(uint8(i) - 1)
|
||||
bf.WriteBytes(scoreData.Data())
|
||||
DoAckBufSucceed(s, pkt.AckHandle, bf.Data())
|
||||
broadcast.DoAckBufSucceed(s, pkt.AckHandle, bf.Data())
|
||||
}
|
||||
|
||||
func handleMsgMhfGetRengokuRankingRank(s *Session, p mhfpacket.MHFPacket) {
|
||||
@@ -199,5 +200,5 @@ func handleMsgMhfGetRengokuRankingRank(s *Session, p mhfpacket.MHFPacket) {
|
||||
bf := byteframe.NewByteFrame()
|
||||
bf.WriteUint32(0) // Max stage overall MP rank
|
||||
bf.WriteUint32(0) // Max RdP overall MP rank
|
||||
DoAckBufSucceed(s, pkt.AckHandle, bf.Data())
|
||||
broadcast.DoAckBufSucceed(s, pkt.AckHandle, bf.Data())
|
||||
}
|
||||
|
||||
@@ -1,19 +1,22 @@
|
||||
package channelserver
|
||||
|
||||
import "erupe-ce/network/mhfpacket"
|
||||
import (
|
||||
"erupe-ce/network/mhfpacket"
|
||||
"erupe-ce/utils/broadcast"
|
||||
)
|
||||
|
||||
func handleMsgSysReserve188(s *Session, p mhfpacket.MHFPacket) {
|
||||
pkt := p.(*mhfpacket.MsgSysReserve188)
|
||||
|
||||
// Left as raw bytes because I couldn't easily find the request or resp parser function in the binary.
|
||||
DoAckBufSucceed(s, pkt.AckHandle, []byte{0x00, 0x00, 0x00, 0x00})
|
||||
broadcast.DoAckBufSucceed(s, pkt.AckHandle, []byte{0x00, 0x00, 0x00, 0x00})
|
||||
}
|
||||
|
||||
func handleMsgSysReserve18B(s *Session, p mhfpacket.MHFPacket) {
|
||||
pkt := p.(*mhfpacket.MsgSysReserve18B)
|
||||
|
||||
// Left as raw bytes because I couldn't easily find the request or resp parser function in the binary.
|
||||
DoAckBufSucceed(s, pkt.AckHandle, []byte{0x00, 0x00, 0x00, 0x3C})
|
||||
broadcast.DoAckBufSucceed(s, pkt.AckHandle, []byte{0x00, 0x00, 0x00, 0x3C})
|
||||
}
|
||||
|
||||
func handleMsgSysReserve55(s *Session, p mhfpacket.MHFPacket) {}
|
||||
|
||||
@@ -4,6 +4,7 @@ import (
|
||||
"encoding/hex"
|
||||
|
||||
"erupe-ce/network/mhfpacket"
|
||||
"erupe-ce/utils/broadcast"
|
||||
"erupe-ce/utils/byteframe"
|
||||
)
|
||||
|
||||
@@ -12,21 +13,21 @@ func handleMsgMhfGetAdditionalBeatReward(s *Session, p mhfpacket.MHFPacket) {
|
||||
// Actual response in packet captures are all just giant batches of null bytes
|
||||
// I'm assuming this is because it used to be tied to an actual event and
|
||||
// they never bothered killing off the packet when they made it static
|
||||
DoAckBufSucceed(s, pkt.AckHandle, make([]byte, 0x104))
|
||||
broadcast.DoAckBufSucceed(s, pkt.AckHandle, make([]byte, 0x104))
|
||||
}
|
||||
|
||||
func handleMsgMhfGetUdRankingRewardList(s *Session, p mhfpacket.MHFPacket) {
|
||||
pkt := p.(*mhfpacket.MsgMhfGetUdRankingRewardList)
|
||||
// Temporary canned response
|
||||
data, _ := hex.DecodeString("0100001600000A5397DF00000000000000000000000000000000")
|
||||
DoAckBufSucceed(s, pkt.AckHandle, data)
|
||||
broadcast.DoAckBufSucceed(s, pkt.AckHandle, data)
|
||||
}
|
||||
|
||||
func handleMsgMhfGetRewardSong(s *Session, p mhfpacket.MHFPacket) {
|
||||
pkt := p.(*mhfpacket.MsgMhfGetRewardSong)
|
||||
// Temporary canned response
|
||||
data, _ := hex.DecodeString("0100001600000A5397DF00000000000000000000000000000000")
|
||||
DoAckBufSucceed(s, pkt.AckHandle, data)
|
||||
broadcast.DoAckBufSucceed(s, pkt.AckHandle, data)
|
||||
}
|
||||
|
||||
func handleMsgMhfUseRewardSong(s *Session, p mhfpacket.MHFPacket) {}
|
||||
@@ -39,7 +40,7 @@ func handleMsgMhfAcquireMonthlyReward(s *Session, p mhfpacket.MHFPacket) {
|
||||
resp := byteframe.NewByteFrame()
|
||||
resp.WriteUint32(0)
|
||||
|
||||
DoAckBufSucceed(s, pkt.AckHandle, resp.Data())
|
||||
broadcast.DoAckBufSucceed(s, pkt.AckHandle, resp.Data())
|
||||
}
|
||||
|
||||
func handleMsgMhfAcceptReadReward(s *Session, p mhfpacket.MHFPacket) {}
|
||||
|
||||
@@ -2,6 +2,7 @@ package channelserver
|
||||
|
||||
import (
|
||||
"erupe-ce/network/mhfpacket"
|
||||
"erupe-ce/utils/broadcast"
|
||||
"erupe-ce/utils/byteframe"
|
||||
)
|
||||
|
||||
@@ -12,7 +13,7 @@ func handleMsgMhfGetBreakSeibatuLevelReward(s *Session, p mhfpacket.MHFPacket) {
|
||||
bf.WriteInt32(0)
|
||||
bf.WriteInt32(0)
|
||||
bf.WriteInt32(0)
|
||||
DoAckBufSucceed(s, pkt.AckHandle, bf.Data())
|
||||
broadcast.DoAckBufSucceed(s, pkt.AckHandle, bf.Data())
|
||||
}
|
||||
|
||||
type WeeklySeibatuRankingReward struct {
|
||||
@@ -40,7 +41,7 @@ func handleMsgMhfGetWeeklySeibatuRankingReward(s *Session, p mhfpacket.MHFPacket
|
||||
bf.WriteInt32(reward.Unk5)
|
||||
data = append(data, bf)
|
||||
}
|
||||
DoAckEarthSucceed(s, pkt.AckHandle, data)
|
||||
broadcast.DoAckEarthSucceed(s, pkt.AckHandle, data)
|
||||
}
|
||||
|
||||
func handleMsgMhfGetFixedSeibatuRankingTable(s *Session, p mhfpacket.MHFPacket) {
|
||||
@@ -49,7 +50,7 @@ func handleMsgMhfGetFixedSeibatuRankingTable(s *Session, p mhfpacket.MHFPacket)
|
||||
bf.WriteInt32(0)
|
||||
bf.WriteInt32(0)
|
||||
bf.WriteBytes(make([]byte, 32))
|
||||
DoAckBufSucceed(s, pkt.AckHandle, bf.Data())
|
||||
broadcast.DoAckBufSucceed(s, pkt.AckHandle, bf.Data())
|
||||
}
|
||||
|
||||
func handleMsgMhfReadBeatLevel(s *Session, p mhfpacket.MHFPacket) {
|
||||
@@ -65,7 +66,7 @@ func handleMsgMhfReadBeatLevel(s *Session, p mhfpacket.MHFPacket) {
|
||||
resp.WriteUint32(1)
|
||||
}
|
||||
|
||||
DoAckBufSucceed(s, pkt.AckHandle, resp.Data())
|
||||
broadcast.DoAckBufSucceed(s, pkt.AckHandle, resp.Data())
|
||||
}
|
||||
|
||||
func handleMsgMhfReadLastWeekBeatRanking(s *Session, p mhfpacket.MHFPacket) {
|
||||
@@ -75,13 +76,13 @@ func handleMsgMhfReadLastWeekBeatRanking(s *Session, p mhfpacket.MHFPacket) {
|
||||
bf.WriteInt32(0)
|
||||
bf.WriteInt32(0)
|
||||
bf.WriteInt32(0)
|
||||
DoAckBufSucceed(s, pkt.AckHandle, bf.Data())
|
||||
broadcast.DoAckBufSucceed(s, pkt.AckHandle, bf.Data())
|
||||
}
|
||||
|
||||
func handleMsgMhfUpdateBeatLevel(s *Session, p mhfpacket.MHFPacket) {
|
||||
pkt := p.(*mhfpacket.MsgMhfUpdateBeatLevel)
|
||||
|
||||
DoAckBufSucceed(s, pkt.AckHandle, []byte{0x00, 0x00, 0x00, 0x00})
|
||||
broadcast.DoAckBufSucceed(s, pkt.AckHandle, []byte{0x00, 0x00, 0x00, 0x00})
|
||||
}
|
||||
|
||||
func handleMsgMhfReadBeatLevelAllRanking(s *Session, p mhfpacket.MHFPacket) {
|
||||
@@ -96,11 +97,11 @@ func handleMsgMhfReadBeatLevelAllRanking(s *Session, p mhfpacket.MHFPacket) {
|
||||
bf.WriteUint32(0)
|
||||
bf.WriteBytes(make([]byte, 32))
|
||||
}
|
||||
DoAckBufSucceed(s, pkt.AckHandle, bf.Data())
|
||||
broadcast.DoAckBufSucceed(s, pkt.AckHandle, bf.Data())
|
||||
}
|
||||
|
||||
func handleMsgMhfReadBeatLevelMyRanking(s *Session, p mhfpacket.MHFPacket) {
|
||||
pkt := p.(*mhfpacket.MsgMhfReadBeatLevelMyRanking)
|
||||
bf := byteframe.NewByteFrame()
|
||||
DoAckBufSucceed(s, pkt.AckHandle, bf.Data())
|
||||
broadcast.DoAckBufSucceed(s, pkt.AckHandle, bf.Data())
|
||||
}
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
package channelserver
|
||||
|
||||
import (
|
||||
"erupe-ce/utils/broadcast"
|
||||
"erupe-ce/utils/byteframe"
|
||||
"strconv"
|
||||
"strings"
|
||||
@@ -22,7 +23,7 @@ func removeSessionFromSemaphore(s *Session) {
|
||||
|
||||
func handleMsgSysCreateSemaphore(s *Session, p mhfpacket.MHFPacket) {
|
||||
pkt := p.(*mhfpacket.MsgSysCreateSemaphore)
|
||||
DoAckSimpleSucceed(s, pkt.AckHandle, []byte{0x00, 0x03, 0x00, 0x0d})
|
||||
broadcast.DoAckSimpleSucceed(s, pkt.AckHandle, []byte{0x00, 0x03, 0x00, 0x0d})
|
||||
}
|
||||
|
||||
func destructEmptySemaphores(s *Session) {
|
||||
@@ -107,7 +108,7 @@ func handleMsgSysCreateAcquireSemaphore(s *Session, p mhfpacket.MHFPacket) {
|
||||
} else {
|
||||
bf.WriteUint32(0)
|
||||
}
|
||||
DoAckSimpleSucceed(s, pkt.AckHandle, bf.Data())
|
||||
broadcast.DoAckSimpleSucceed(s, pkt.AckHandle, bf.Data())
|
||||
}
|
||||
|
||||
func handleMsgSysAcquireSemaphore(s *Session, p mhfpacket.MHFPacket) {
|
||||
@@ -116,9 +117,9 @@ func handleMsgSysAcquireSemaphore(s *Session, p mhfpacket.MHFPacket) {
|
||||
sema.host = s
|
||||
bf := byteframe.NewByteFrame()
|
||||
bf.WriteUint32(sema.id)
|
||||
DoAckSimpleSucceed(s, pkt.AckHandle, bf.Data())
|
||||
broadcast.DoAckSimpleSucceed(s, pkt.AckHandle, bf.Data())
|
||||
} else {
|
||||
DoAckSimpleFail(s, pkt.AckHandle, make([]byte, 4))
|
||||
broadcast.DoAckSimpleFail(s, pkt.AckHandle, make([]byte, 4))
|
||||
}
|
||||
}
|
||||
|
||||
@@ -134,5 +135,5 @@ func handleMsgSysCheckSemaphore(s *Session, p mhfpacket.MHFPacket) {
|
||||
resp = []byte{0x00, 0x00, 0x00, 0x01}
|
||||
}
|
||||
s.Server.semaphoreLock.Unlock()
|
||||
DoAckSimpleSucceed(s, pkt.AckHandle, resp)
|
||||
broadcast.DoAckSimpleSucceed(s, pkt.AckHandle, resp)
|
||||
}
|
||||
|
||||
@@ -3,6 +3,7 @@ package channelserver
|
||||
import (
|
||||
"erupe-ce/config"
|
||||
"erupe-ce/network/mhfpacket"
|
||||
"erupe-ce/utils/broadcast"
|
||||
"erupe-ce/utils/byteframe"
|
||||
"erupe-ce/utils/db"
|
||||
"erupe-ce/utils/gametime"
|
||||
@@ -134,13 +135,13 @@ func handleMsgMhfEnumerateShop(s *Session, p mhfpacket.MHFPacket) {
|
||||
case 1: // Running gachas
|
||||
// Fundamentally, gacha works completely differently, just hide it for now.
|
||||
if config.GetConfig().ClientID <= config.G7 {
|
||||
DoAckBufSucceed(s, pkt.AckHandle, make([]byte, 4))
|
||||
broadcast.DoAckBufSucceed(s, pkt.AckHandle, make([]byte, 4))
|
||||
return
|
||||
}
|
||||
|
||||
rows, err := database.Queryx("SELECT id, min_gr, min_hr, name, url_banner, url_feature, url_thumbnail, wide, recommended, gacha_type, hidden FROM gacha_shop")
|
||||
if err != nil {
|
||||
DoAckBufSucceed(s, pkt.AckHandle, make([]byte, 4))
|
||||
broadcast.DoAckBufSucceed(s, pkt.AckHandle, make([]byte, 4))
|
||||
return
|
||||
}
|
||||
bf := byteframe.NewByteFrame()
|
||||
@@ -180,7 +181,7 @@ func handleMsgMhfEnumerateShop(s *Session, p mhfpacket.MHFPacket) {
|
||||
bf.WriteBool(g.Hidden)
|
||||
}
|
||||
}
|
||||
DoAckBufSucceed(s, pkt.AckHandle, bf.Data())
|
||||
broadcast.DoAckBufSucceed(s, pkt.AckHandle, bf.Data())
|
||||
case 2: // Actual gacha
|
||||
bf := byteframe.NewByteFrame()
|
||||
bf.WriteUint32(pkt.ShopID)
|
||||
@@ -188,7 +189,7 @@ func handleMsgMhfEnumerateShop(s *Session, p mhfpacket.MHFPacket) {
|
||||
database.QueryRow(`SELECT gacha_type FROM gacha_shop WHERE id = $1`, pkt.ShopID).Scan(&gachaType)
|
||||
rows, err := database.Queryx(`SELECT entry_type, id, item_type, item_number, item_quantity, weight, rarity, rolls, daily_limit, frontier_points, COALESCE(name, '') AS name FROM gacha_entries WHERE gacha_id = $1 ORDER BY weight DESC`, pkt.ShopID)
|
||||
if err != nil {
|
||||
DoAckBufSucceed(s, pkt.AckHandle, make([]byte, 4))
|
||||
broadcast.DoAckBufSucceed(s, pkt.AckHandle, make([]byte, 4))
|
||||
return
|
||||
}
|
||||
var divisor float64
|
||||
@@ -245,7 +246,7 @@ func handleMsgMhfEnumerateShop(s *Session, p mhfpacket.MHFPacket) {
|
||||
bf.WriteUint16(gi.Quantity)
|
||||
}
|
||||
}
|
||||
DoAckBufSucceed(s, pkt.AckHandle, bf.Data())
|
||||
broadcast.DoAckBufSucceed(s, pkt.AckHandle, bf.Data())
|
||||
case 3: // Hunting Festival Exchange
|
||||
fallthrough
|
||||
case 4: // N Points, 0-6
|
||||
@@ -267,7 +268,7 @@ func handleMsgMhfEnumerateShop(s *Session, p mhfpacket.MHFPacket) {
|
||||
items = items[:pkt.Limit]
|
||||
}
|
||||
writeShopItems(bf, items)
|
||||
DoAckBufSucceed(s, pkt.AckHandle, bf.Data())
|
||||
broadcast.DoAckBufSucceed(s, pkt.AckHandle, bf.Data())
|
||||
}
|
||||
}
|
||||
|
||||
@@ -291,14 +292,14 @@ func handleMsgMhfAcquireExchangeShop(s *Session, p mhfpacket.MHFPacket) {
|
||||
WHERE EXCLUDED.character_id=$1 AND EXCLUDED.shop_item_id=$2
|
||||
`, s.CharID, itemHash, buyCount)
|
||||
}
|
||||
DoAckSimpleSucceed(s, pkt.AckHandle, []byte{0x00, 0x00, 0x00, 0x00})
|
||||
broadcast.DoAckSimpleSucceed(s, pkt.AckHandle, []byte{0x00, 0x00, 0x00, 0x00})
|
||||
}
|
||||
|
||||
func handleMsgMhfGetGachaPlayHistory(s *Session, p mhfpacket.MHFPacket) {
|
||||
pkt := p.(*mhfpacket.MsgMhfGetGachaPlayHistory)
|
||||
bf := byteframe.NewByteFrame()
|
||||
bf.WriteUint8(1)
|
||||
DoAckBufSucceed(s, pkt.AckHandle, bf.Data())
|
||||
broadcast.DoAckBufSucceed(s, pkt.AckHandle, bf.Data())
|
||||
}
|
||||
|
||||
func handleMsgMhfGetGachaPoint(s *Session, p mhfpacket.MHFPacket) {
|
||||
@@ -313,7 +314,7 @@ func handleMsgMhfGetGachaPoint(s *Session, p mhfpacket.MHFPacket) {
|
||||
resp.WriteUint32(gp)
|
||||
resp.WriteUint32(gt)
|
||||
resp.WriteUint32(fp)
|
||||
DoAckBufSucceed(s, pkt.AckHandle, resp.Data())
|
||||
broadcast.DoAckBufSucceed(s, pkt.AckHandle, resp.Data())
|
||||
}
|
||||
|
||||
func handleMsgMhfUseGachaPoint(s *Session, p mhfpacket.MHFPacket) {
|
||||
@@ -328,7 +329,7 @@ func handleMsgMhfUseGachaPoint(s *Session, p mhfpacket.MHFPacket) {
|
||||
if pkt.PremiumCoins > 0 {
|
||||
database.Exec(`UPDATE users u SET gacha_premium=gacha_premium-$1 WHERE u.id=(SELECT c.user_id FROM characters c WHERE c.id=$2)`, pkt.PremiumCoins, s.CharID)
|
||||
}
|
||||
DoAckSimpleSucceed(s, pkt.AckHandle, make([]byte, 4))
|
||||
broadcast.DoAckSimpleSucceed(s, pkt.AckHandle, make([]byte, 4))
|
||||
}
|
||||
|
||||
func spendGachaCoin(s *Session, quantity uint16) {
|
||||
@@ -471,9 +472,9 @@ func handleMsgMhfReceiveGachaItem(s *Session, p mhfpacket.MHFPacket) {
|
||||
resp := byteframe.NewByteFrame()
|
||||
resp.WriteUint8(36)
|
||||
resp.WriteBytes(data[1:181])
|
||||
DoAckBufSucceed(s, pkt.AckHandle, resp.Data())
|
||||
broadcast.DoAckBufSucceed(s, pkt.AckHandle, resp.Data())
|
||||
} else {
|
||||
DoAckBufSucceed(s, pkt.AckHandle, data)
|
||||
broadcast.DoAckBufSucceed(s, pkt.AckHandle, data)
|
||||
}
|
||||
|
||||
if !pkt.Freeze {
|
||||
@@ -501,13 +502,13 @@ func handleMsgMhfPlayNormalGacha(s *Session, p mhfpacket.MHFPacket) {
|
||||
}
|
||||
err, rolls := transactGacha(s, pkt.GachaID, pkt.RollType)
|
||||
if err != nil {
|
||||
DoAckBufSucceed(s, pkt.AckHandle, make([]byte, 1))
|
||||
broadcast.DoAckBufSucceed(s, pkt.AckHandle, make([]byte, 1))
|
||||
return
|
||||
}
|
||||
|
||||
rows, err := database.Queryx(`SELECT id, weight, rarity FROM gacha_entries WHERE gacha_id = $1 AND entry_type = 100 ORDER BY weight DESC`, pkt.GachaID)
|
||||
if err != nil {
|
||||
DoAckBufSucceed(s, pkt.AckHandle, make([]byte, 1))
|
||||
broadcast.DoAckBufSucceed(s, pkt.AckHandle, make([]byte, 1))
|
||||
return
|
||||
}
|
||||
for rows.Next() {
|
||||
@@ -540,7 +541,7 @@ func handleMsgMhfPlayNormalGacha(s *Session, p mhfpacket.MHFPacket) {
|
||||
|
||||
bf.WriteUint8(uint8(len(rewards)))
|
||||
bf.WriteBytes(temp.Data())
|
||||
DoAckBufSucceed(s, pkt.AckHandle, bf.Data())
|
||||
broadcast.DoAckBufSucceed(s, pkt.AckHandle, bf.Data())
|
||||
addGachaItem(s, rewards)
|
||||
}
|
||||
|
||||
@@ -553,7 +554,7 @@ func handleMsgMhfPlayStepupGacha(s *Session, p mhfpacket.MHFPacket) {
|
||||
var reward GachaItem
|
||||
err, rolls := transactGacha(s, pkt.GachaID, pkt.RollType)
|
||||
if err != nil {
|
||||
DoAckBufSucceed(s, pkt.AckHandle, make([]byte, 1))
|
||||
broadcast.DoAckBufSucceed(s, pkt.AckHandle, make([]byte, 1))
|
||||
return
|
||||
}
|
||||
database, err := db.GetDB()
|
||||
@@ -566,7 +567,7 @@ func handleMsgMhfPlayStepupGacha(s *Session, p mhfpacket.MHFPacket) {
|
||||
|
||||
rows, err := database.Queryx(`SELECT id, weight, rarity FROM gacha_entries WHERE gacha_id = $1 AND entry_type = 100 ORDER BY weight DESC`, pkt.GachaID)
|
||||
if err != nil {
|
||||
DoAckBufSucceed(s, pkt.AckHandle, make([]byte, 1))
|
||||
broadcast.DoAckBufSucceed(s, pkt.AckHandle, make([]byte, 1))
|
||||
return
|
||||
}
|
||||
for rows.Next() {
|
||||
@@ -607,7 +608,7 @@ func handleMsgMhfPlayStepupGacha(s *Session, p mhfpacket.MHFPacket) {
|
||||
bf.WriteUint8(0)
|
||||
}
|
||||
bf.WriteBytes(temp.Data())
|
||||
DoAckBufSucceed(s, pkt.AckHandle, bf.Data())
|
||||
broadcast.DoAckBufSucceed(s, pkt.AckHandle, bf.Data())
|
||||
addGachaItem(s, rewards)
|
||||
addGachaItem(s, guaranteedItems)
|
||||
}
|
||||
@@ -630,7 +631,7 @@ func handleMsgMhfGetStepupStatus(s *Session, p mhfpacket.MHFPacket) {
|
||||
bf := byteframe.NewByteFrame()
|
||||
bf.WriteUint8(step)
|
||||
bf.WriteUint32(uint32(gametime.TimeAdjusted().Unix()))
|
||||
DoAckBufSucceed(s, pkt.AckHandle, bf.Data())
|
||||
broadcast.DoAckBufSucceed(s, pkt.AckHandle, bf.Data())
|
||||
}
|
||||
|
||||
func handleMsgMhfGetBoxGachaInfo(s *Session, p mhfpacket.MHFPacket) {
|
||||
@@ -641,7 +642,7 @@ func handleMsgMhfGetBoxGachaInfo(s *Session, p mhfpacket.MHFPacket) {
|
||||
}
|
||||
entries, err := database.Queryx(`SELECT entry_id FROM gacha_box WHERE gacha_id = $1 AND character_id = $2`, pkt.GachaID, s.CharID)
|
||||
if err != nil {
|
||||
DoAckBufSucceed(s, pkt.AckHandle, make([]byte, 1))
|
||||
broadcast.DoAckBufSucceed(s, pkt.AckHandle, make([]byte, 1))
|
||||
return
|
||||
}
|
||||
var entryIDs []uint32
|
||||
@@ -656,7 +657,7 @@ func handleMsgMhfGetBoxGachaInfo(s *Session, p mhfpacket.MHFPacket) {
|
||||
bf.WriteUint32(entryIDs[i])
|
||||
bf.WriteBool(true)
|
||||
}
|
||||
DoAckBufSucceed(s, pkt.AckHandle, bf.Data())
|
||||
broadcast.DoAckBufSucceed(s, pkt.AckHandle, bf.Data())
|
||||
}
|
||||
|
||||
func handleMsgMhfPlayBoxGacha(s *Session, p mhfpacket.MHFPacket) {
|
||||
@@ -668,7 +669,7 @@ func handleMsgMhfPlayBoxGacha(s *Session, p mhfpacket.MHFPacket) {
|
||||
var reward GachaItem
|
||||
err, rolls := transactGacha(s, pkt.GachaID, pkt.RollType)
|
||||
if err != nil {
|
||||
DoAckBufSucceed(s, pkt.AckHandle, make([]byte, 1))
|
||||
broadcast.DoAckBufSucceed(s, pkt.AckHandle, make([]byte, 1))
|
||||
return
|
||||
}
|
||||
database, err := db.GetDB()
|
||||
@@ -677,7 +678,7 @@ func handleMsgMhfPlayBoxGacha(s *Session, p mhfpacket.MHFPacket) {
|
||||
}
|
||||
rows, err := database.Queryx(`SELECT id, weight, rarity FROM gacha_entries WHERE gacha_id = $1 AND entry_type = 100 ORDER BY weight DESC`, pkt.GachaID)
|
||||
if err != nil {
|
||||
DoAckBufSucceed(s, pkt.AckHandle, make([]byte, 1))
|
||||
broadcast.DoAckBufSucceed(s, pkt.AckHandle, make([]byte, 1))
|
||||
return
|
||||
}
|
||||
for rows.Next() {
|
||||
@@ -707,7 +708,7 @@ func handleMsgMhfPlayBoxGacha(s *Session, p mhfpacket.MHFPacket) {
|
||||
bf.WriteUint16(r.Quantity)
|
||||
bf.WriteUint8(0)
|
||||
}
|
||||
DoAckBufSucceed(s, pkt.AckHandle, bf.Data())
|
||||
broadcast.DoAckBufSucceed(s, pkt.AckHandle, bf.Data())
|
||||
addGachaItem(s, rewards)
|
||||
}
|
||||
|
||||
@@ -718,7 +719,7 @@ func handleMsgMhfResetBoxGachaInfo(s *Session, p mhfpacket.MHFPacket) {
|
||||
s.Logger.Fatal(fmt.Sprintf("Failed to get database instance: %s", err))
|
||||
}
|
||||
database.Exec("DELETE FROM gacha_box WHERE gacha_id = $1 AND character_id = $2", pkt.GachaID, s.CharID)
|
||||
DoAckSimpleSucceed(s, pkt.AckHandle, make([]byte, 4))
|
||||
broadcast.DoAckSimpleSucceed(s, pkt.AckHandle, make([]byte, 4))
|
||||
}
|
||||
|
||||
func handleMsgMhfExchangeFpoint2Item(s *Session, p mhfpacket.MHFPacket) {
|
||||
@@ -734,7 +735,7 @@ func handleMsgMhfExchangeFpoint2Item(s *Session, p mhfpacket.MHFPacket) {
|
||||
database.QueryRow("UPDATE users u SET frontier_points=frontier_points::int - $1 WHERE u.id=(SELECT c.user_id FROM characters c WHERE c.id=$2) RETURNING frontier_points", cost, s.CharID).Scan(&balance)
|
||||
bf := byteframe.NewByteFrame()
|
||||
bf.WriteUint32(balance)
|
||||
DoAckSimpleSucceed(s, pkt.AckHandle, bf.Data())
|
||||
broadcast.DoAckSimpleSucceed(s, pkt.AckHandle, bf.Data())
|
||||
}
|
||||
|
||||
func handleMsgMhfExchangeItem2Fpoint(s *Session, p mhfpacket.MHFPacket) {
|
||||
@@ -750,7 +751,7 @@ func handleMsgMhfExchangeItem2Fpoint(s *Session, p mhfpacket.MHFPacket) {
|
||||
database.QueryRow("UPDATE users u SET frontier_points=COALESCE(frontier_points::int + $1, $1) WHERE u.id=(SELECT c.user_id FROM characters c WHERE c.id=$2) RETURNING frontier_points", cost, s.CharID).Scan(&balance)
|
||||
bf := byteframe.NewByteFrame()
|
||||
bf.WriteUint32(balance)
|
||||
DoAckSimpleSucceed(s, pkt.AckHandle, bf.Data())
|
||||
broadcast.DoAckSimpleSucceed(s, pkt.AckHandle, bf.Data())
|
||||
}
|
||||
|
||||
type FPointExchange struct {
|
||||
@@ -804,12 +805,12 @@ func handleMsgMhfGetFpointExchangeList(s *Session, p mhfpacket.MHFPacket) {
|
||||
bf.WriteUint16(e.FPoints)
|
||||
}
|
||||
|
||||
DoAckBufSucceed(s, pkt.AckHandle, bf.Data())
|
||||
broadcast.DoAckBufSucceed(s, pkt.AckHandle, bf.Data())
|
||||
}
|
||||
|
||||
func handleMsgMhfPlayFreeGacha(s *Session, p mhfpacket.MHFPacket) {
|
||||
pkt := p.(*mhfpacket.MsgMhfPlayFreeGacha)
|
||||
bf := byteframe.NewByteFrame()
|
||||
bf.WriteUint32(1)
|
||||
DoAckSimpleSucceed(s, pkt.AckHandle, bf.Data())
|
||||
broadcast.DoAckSimpleSucceed(s, pkt.AckHandle, bf.Data())
|
||||
}
|
||||
|
||||
@@ -6,6 +6,7 @@ import (
|
||||
"time"
|
||||
|
||||
"erupe-ce/network/mhfpacket"
|
||||
"erupe-ce/utils/broadcast"
|
||||
"erupe-ce/utils/byteframe"
|
||||
ps "erupe-ce/utils/pascalstring"
|
||||
|
||||
@@ -17,13 +18,13 @@ func handleMsgSysCreateStage(s *Session, p mhfpacket.MHFPacket) {
|
||||
s.Server.Lock()
|
||||
defer s.Server.Unlock()
|
||||
if _, exists := s.Server.stages[pkt.StageID]; exists {
|
||||
DoAckSimpleFail(s, pkt.AckHandle, []byte{0x00, 0x00, 0x00, 0x00})
|
||||
broadcast.DoAckSimpleFail(s, pkt.AckHandle, []byte{0x00, 0x00, 0x00, 0x00})
|
||||
} else {
|
||||
stage := NewStage(pkt.StageID)
|
||||
stage.host = s
|
||||
stage.maxPlayers = uint16(pkt.PlayerCount)
|
||||
s.Server.stages[stage.id] = stage
|
||||
DoAckSimpleSucceed(s, pkt.AckHandle, []byte{0x00, 0x00, 0x00, 0x00})
|
||||
broadcast.DoAckSimpleSucceed(s, pkt.AckHandle, []byte{0x00, 0x00, 0x00, 0x00})
|
||||
}
|
||||
}
|
||||
|
||||
@@ -63,7 +64,7 @@ func doStageTransfer(s *Session, ackHandle uint32, stageID string) {
|
||||
s.QueueSendMHF(&mhfpacket.MsgSysCleanupObject{})
|
||||
|
||||
// Confirm the stage entry.
|
||||
DoAckSimpleSucceed(s, ackHandle, []byte{0x00, 0x00, 0x00, 0x00})
|
||||
broadcast.DoAckSimpleSucceed(s, ackHandle, []byte{0x00, 0x00, 0x00, 0x00})
|
||||
|
||||
var temp mhfpacket.MHFPacket
|
||||
|
||||
@@ -153,7 +154,7 @@ func handleMsgSysEnterStage(s *Session, p mhfpacket.MHFPacket) {
|
||||
pkt := p.(*mhfpacket.MsgSysEnterStage)
|
||||
|
||||
if isStageFull(s, pkt.StageID) {
|
||||
DoAckSimpleFail(s, pkt.AckHandle, []byte{0x00, 0x00, 0x00, 0x01})
|
||||
broadcast.DoAckSimpleFail(s, pkt.AckHandle, []byte{0x00, 0x00, 0x00, 0x01})
|
||||
return
|
||||
}
|
||||
|
||||
@@ -183,7 +184,7 @@ func handleMsgSysBackStage(s *Session, p mhfpacket.MHFPacket) {
|
||||
|
||||
if isStageFull(s, backStage) {
|
||||
s.stageMoveStack.Push(backStage)
|
||||
DoAckSimpleFail(s, pkt.AckHandle, []byte{0x00, 0x00, 0x00, 0x01})
|
||||
broadcast.DoAckSimpleFail(s, pkt.AckHandle, []byte{0x00, 0x00, 0x00, 0x01})
|
||||
return
|
||||
}
|
||||
|
||||
@@ -202,7 +203,7 @@ func handleMsgSysMoveStage(s *Session, p mhfpacket.MHFPacket) {
|
||||
pkt := p.(*mhfpacket.MsgSysMoveStage)
|
||||
|
||||
if isStageFull(s, pkt.StageID) {
|
||||
DoAckSimpleFail(s, pkt.AckHandle, []byte{0x00, 0x00, 0x00, 0x01})
|
||||
broadcast.DoAckSimpleFail(s, pkt.AckHandle, []byte{0x00, 0x00, 0x00, 0x01})
|
||||
return
|
||||
}
|
||||
|
||||
@@ -218,7 +219,7 @@ func handleMsgSysLockStage(s *Session, p mhfpacket.MHFPacket) {
|
||||
stage.locked = true
|
||||
stage.Unlock()
|
||||
}
|
||||
DoAckSimpleSucceed(s, pkt.AckHandle, make([]byte, 4))
|
||||
broadcast.DoAckSimpleSucceed(s, pkt.AckHandle, make([]byte, 4))
|
||||
}
|
||||
|
||||
func handleMsgSysUnlockStage(s *Session, p mhfpacket.MHFPacket) {
|
||||
@@ -251,15 +252,15 @@ func handleMsgSysReserveStage(s *Session, p mhfpacket.MHFPacket) {
|
||||
case 17: // 0x11
|
||||
stage.reservedClientSlots[s.CharID] = true
|
||||
}
|
||||
DoAckSimpleSucceed(s, pkt.AckHandle, make([]byte, 4))
|
||||
broadcast.DoAckSimpleSucceed(s, pkt.AckHandle, make([]byte, 4))
|
||||
} else if uint16(len(stage.reservedClientSlots)) < stage.maxPlayers {
|
||||
if stage.locked {
|
||||
DoAckSimpleFail(s, pkt.AckHandle, make([]byte, 4))
|
||||
broadcast.DoAckSimpleFail(s, pkt.AckHandle, make([]byte, 4))
|
||||
return
|
||||
}
|
||||
if len(stage.password) > 0 {
|
||||
if stage.password != s.stagePass {
|
||||
DoAckSimpleFail(s, pkt.AckHandle, make([]byte, 4))
|
||||
broadcast.DoAckSimpleFail(s, pkt.AckHandle, make([]byte, 4))
|
||||
return
|
||||
}
|
||||
}
|
||||
@@ -268,13 +269,13 @@ func handleMsgSysReserveStage(s *Session, p mhfpacket.MHFPacket) {
|
||||
s.Lock()
|
||||
s.reservationStage = stage
|
||||
s.Unlock()
|
||||
DoAckSimpleSucceed(s, pkt.AckHandle, make([]byte, 4))
|
||||
broadcast.DoAckSimpleSucceed(s, pkt.AckHandle, make([]byte, 4))
|
||||
} else {
|
||||
DoAckSimpleFail(s, pkt.AckHandle, make([]byte, 4))
|
||||
broadcast.DoAckSimpleFail(s, pkt.AckHandle, make([]byte, 4))
|
||||
}
|
||||
} else {
|
||||
s.Logger.Error("Failed to get stage", zap.String("StageID", pkt.StageID))
|
||||
DoAckSimpleFail(s, pkt.AckHandle, make([]byte, 4))
|
||||
broadcast.DoAckSimpleFail(s, pkt.AckHandle, make([]byte, 4))
|
||||
}
|
||||
}
|
||||
|
||||
@@ -328,15 +329,15 @@ func handleMsgSysGetStageBinary(s *Session, p mhfpacket.MHFPacket) {
|
||||
if stage, exists := s.Server.stages[pkt.StageID]; exists {
|
||||
stage.Lock()
|
||||
if binaryData, exists := stage.rawBinaryData[stageBinaryKey{pkt.BinaryType0, pkt.BinaryType1}]; exists {
|
||||
DoAckBufSucceed(s, pkt.AckHandle, binaryData)
|
||||
broadcast.DoAckBufSucceed(s, pkt.AckHandle, binaryData)
|
||||
} else if pkt.BinaryType1 == 4 {
|
||||
// Unknown binary type that is supposedly generated server side
|
||||
// Temporary response
|
||||
DoAckBufSucceed(s, pkt.AckHandle, []byte{})
|
||||
broadcast.DoAckBufSucceed(s, pkt.AckHandle, []byte{})
|
||||
} else {
|
||||
s.Logger.Warn("Failed to get stage binary", zap.Uint8("BinaryType0", pkt.BinaryType0), zap.Uint8("pkt.BinaryType1", pkt.BinaryType1))
|
||||
s.Logger.Warn("Sending blank stage binary")
|
||||
DoAckBufSucceed(s, pkt.AckHandle, []byte{})
|
||||
broadcast.DoAckBufSucceed(s, pkt.AckHandle, []byte{})
|
||||
}
|
||||
stage.Unlock()
|
||||
} else {
|
||||
@@ -350,7 +351,7 @@ func handleMsgSysWaitStageBinary(s *Session, p mhfpacket.MHFPacket) {
|
||||
if stage, exists := s.Server.stages[pkt.StageID]; exists {
|
||||
if pkt.BinaryType0 == 1 && pkt.BinaryType1 == 12 {
|
||||
// This might contain the hunter count, or max player count?
|
||||
DoAckBufSucceed(s, pkt.AckHandle, []byte{0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00})
|
||||
broadcast.DoAckBufSucceed(s, pkt.AckHandle, []byte{0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00})
|
||||
return
|
||||
}
|
||||
for {
|
||||
@@ -360,7 +361,7 @@ func handleMsgSysWaitStageBinary(s *Session, p mhfpacket.MHFPacket) {
|
||||
stage.Unlock()
|
||||
s.Logger.Debug("MsgSysWaitStageBinary after lock and get stage")
|
||||
if gotBinary {
|
||||
DoAckBufSucceed(s, pkt.AckHandle, stageBinary)
|
||||
broadcast.DoAckBufSucceed(s, pkt.AckHandle, stageBinary)
|
||||
break
|
||||
} else {
|
||||
s.Logger.Debug("Waiting stage binary", zap.Uint8("BinaryType0", pkt.BinaryType0), zap.Uint8("pkt.BinaryType1", pkt.BinaryType1))
|
||||
@@ -420,5 +421,5 @@ func handleMsgSysEnumerateStage(s *Session, p mhfpacket.MHFPacket) {
|
||||
bf.Seek(0, 0)
|
||||
bf.WriteUint16(joinable)
|
||||
|
||||
DoAckBufSucceed(s, pkt.AckHandle, bf.Data())
|
||||
broadcast.DoAckBufSucceed(s, pkt.AckHandle, bf.Data())
|
||||
}
|
||||
|
||||
File diff suppressed because one or more lines are too long
@@ -2,6 +2,7 @@ package channelserver
|
||||
|
||||
import (
|
||||
"erupe-ce/network/mhfpacket"
|
||||
"erupe-ce/utils/broadcast"
|
||||
"erupe-ce/utils/byteframe"
|
||||
"erupe-ce/utils/gametime"
|
||||
ps "erupe-ce/utils/pascalstring"
|
||||
@@ -103,12 +104,12 @@ func handleMsgMhfInfoTournament(s *Session, p mhfpacket.MHFPacket) {
|
||||
}
|
||||
}
|
||||
|
||||
DoAckBufSucceed(s, pkt.AckHandle, bf.Data())
|
||||
broadcast.DoAckBufSucceed(s, pkt.AckHandle, bf.Data())
|
||||
}
|
||||
|
||||
func handleMsgMhfEntryTournament(s *Session, p mhfpacket.MHFPacket) {
|
||||
pkt := p.(*mhfpacket.MsgMhfEntryTournament)
|
||||
DoAckSimpleSucceed(s, pkt.AckHandle, make([]byte, 4))
|
||||
broadcast.DoAckSimpleSucceed(s, pkt.AckHandle, make([]byte, 4))
|
||||
}
|
||||
|
||||
type TournamentReward struct {
|
||||
@@ -127,5 +128,5 @@ func handleMsgMhfAcquireTournament(s *Session, p mhfpacket.MHFPacket) {
|
||||
bf.WriteUint16(reward.Unk1)
|
||||
bf.WriteUint16(reward.Unk2)
|
||||
}
|
||||
DoAckBufSucceed(s, pkt.AckHandle, bf.Data())
|
||||
broadcast.DoAckBufSucceed(s, pkt.AckHandle, bf.Data())
|
||||
}
|
||||
|
||||
@@ -9,6 +9,7 @@ import (
|
||||
"go.uber.org/zap"
|
||||
|
||||
"erupe-ce/network/mhfpacket"
|
||||
"erupe-ce/utils/broadcast"
|
||||
"erupe-ce/utils/byteframe"
|
||||
"erupe-ce/utils/db"
|
||||
"erupe-ce/utils/stringsupport"
|
||||
@@ -117,7 +118,7 @@ func handleMsgMhfGetTowerInfo(s *Session, p mhfpacket.MHFPacket) {
|
||||
data = append(data, bf)
|
||||
}
|
||||
}
|
||||
DoAckEarthSucceed(s, pkt.AckHandle, data)
|
||||
broadcast.DoAckEarthSucceed(s, pkt.AckHandle, data)
|
||||
}
|
||||
|
||||
func handleMsgMhfPostTowerInfo(s *Session, p mhfpacket.MHFPacket) {
|
||||
@@ -151,7 +152,7 @@ func handleMsgMhfPostTowerInfo(s *Session, p mhfpacket.MHFPacket) {
|
||||
// This might give too much TSP? No idea what the rate is supposed to be
|
||||
database.Exec(`UPDATE tower SET tr=$1, trp=COALESCE(trp, 0)+$2, tsp=COALESCE(tsp, 0)+$3, block1=COALESCE(block1, 0)+$4 WHERE char_id=$5`, pkt.TR, pkt.TRP, pkt.Cost, pkt.Block1, s.CharID)
|
||||
}
|
||||
DoAckSimpleSucceed(s, pkt.AckHandle, make([]byte, 4))
|
||||
broadcast.DoAckSimpleSucceed(s, pkt.AckHandle, make([]byte, 4))
|
||||
}
|
||||
|
||||
// Default missions
|
||||
@@ -346,7 +347,7 @@ func handleMsgMhfGetTenrouirai(s *Session, p mhfpacket.MHFPacket) {
|
||||
}
|
||||
}
|
||||
|
||||
DoAckEarthSucceed(s, pkt.AckHandle, data)
|
||||
broadcast.DoAckEarthSucceed(s, pkt.AckHandle, data)
|
||||
}
|
||||
|
||||
func handleMsgMhfPostTenrouirai(s *Session, p mhfpacket.MHFPacket) {
|
||||
@@ -396,9 +397,9 @@ func handleMsgMhfPostTenrouirai(s *Session, p mhfpacket.MHFPacket) {
|
||||
bf.WriteUint32(0)
|
||||
}
|
||||
|
||||
DoAckSimpleSucceed(s, pkt.AckHandle, bf.Data())
|
||||
broadcast.DoAckSimpleSucceed(s, pkt.AckHandle, bf.Data())
|
||||
} else {
|
||||
DoAckSimpleSucceed(s, pkt.AckHandle, make([]byte, 4))
|
||||
broadcast.DoAckSimpleSucceed(s, pkt.AckHandle, make([]byte, 4))
|
||||
}
|
||||
}
|
||||
|
||||
@@ -418,7 +419,7 @@ func handleMsgMhfPresentBox(s *Session, p mhfpacket.MHFPacket) {
|
||||
bf.WriteInt32(0)
|
||||
bf.WriteInt32(0)
|
||||
*/
|
||||
DoAckEarthSucceed(s, pkt.AckHandle, data)
|
||||
broadcast.DoAckEarthSucceed(s, pkt.AckHandle, data)
|
||||
}
|
||||
|
||||
type GemInfo struct {
|
||||
@@ -466,7 +467,7 @@ func handleMsgMhfGetGemInfo(s *Session, p mhfpacket.MHFPacket) {
|
||||
data = append(data, bf)
|
||||
}
|
||||
}
|
||||
DoAckEarthSucceed(s, pkt.AckHandle, data)
|
||||
broadcast.DoAckEarthSucceed(s, pkt.AckHandle, data)
|
||||
}
|
||||
|
||||
func handleMsgMhfPostGemInfo(s *Session, p mhfpacket.MHFPacket) {
|
||||
@@ -497,15 +498,15 @@ func handleMsgMhfPostGemInfo(s *Session, p mhfpacket.MHFPacket) {
|
||||
case 2: // Transfer gem
|
||||
// no way im doing this for now
|
||||
}
|
||||
DoAckSimpleSucceed(s, pkt.AckHandle, make([]byte, 4))
|
||||
broadcast.DoAckSimpleSucceed(s, pkt.AckHandle, make([]byte, 4))
|
||||
}
|
||||
|
||||
func handleMsgMhfGetNotice(s *Session, p mhfpacket.MHFPacket) {
|
||||
pkt := p.(*mhfpacket.MsgMhfGetNotice)
|
||||
DoAckSimpleSucceed(s, pkt.AckHandle, make([]byte, 4))
|
||||
broadcast.DoAckSimpleSucceed(s, pkt.AckHandle, make([]byte, 4))
|
||||
}
|
||||
|
||||
func handleMsgMhfPostNotice(s *Session, p mhfpacket.MHFPacket) {
|
||||
pkt := p.(*mhfpacket.MsgMhfPostNotice)
|
||||
DoAckSimpleSucceed(s, pkt.AckHandle, make([]byte, 4))
|
||||
broadcast.DoAckSimpleSucceed(s, pkt.AckHandle, make([]byte, 4))
|
||||
}
|
||||
|
||||
@@ -4,6 +4,7 @@ import (
|
||||
"fmt"
|
||||
|
||||
"erupe-ce/network/mhfpacket"
|
||||
"erupe-ce/utils/broadcast"
|
||||
"erupe-ce/utils/db"
|
||||
)
|
||||
|
||||
@@ -51,12 +52,12 @@ func handleMsgSysGetUserBinary(s *Session, p mhfpacket.MHFPacket) {
|
||||
if !ok {
|
||||
err = database.QueryRow(fmt.Sprintf("SELECT type%d FROM user_binary WHERE id=$1", pkt.BinaryType), pkt.CharID).Scan(&data)
|
||||
if err != nil {
|
||||
DoAckBufFail(s, pkt.AckHandle, make([]byte, 4))
|
||||
broadcast.DoAckBufFail(s, pkt.AckHandle, make([]byte, 4))
|
||||
} else {
|
||||
DoAckBufSucceed(s, pkt.AckHandle, data)
|
||||
broadcast.DoAckBufSucceed(s, pkt.AckHandle, data)
|
||||
}
|
||||
} else {
|
||||
DoAckBufSucceed(s, pkt.AckHandle, data)
|
||||
broadcast.DoAckBufSucceed(s, pkt.AckHandle, data)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
package channelserver
|
||||
package broadcast
|
||||
|
||||
import (
|
||||
"erupe-ce/config"
|
||||
@@ -6,7 +6,11 @@ import (
|
||||
"erupe-ce/utils/byteframe"
|
||||
)
|
||||
|
||||
func DoAckEarthSucceed(s *Session, ackHandle uint32, data []*byteframe.ByteFrame) {
|
||||
type AckSession interface {
|
||||
QueueSendMHF(packet mhfpacket.MHFPacket)
|
||||
}
|
||||
|
||||
func DoAckEarthSucceed(s AckSession, ackHandle uint32, data []*byteframe.ByteFrame) {
|
||||
bf := byteframe.NewByteFrame()
|
||||
bf.WriteUint32(uint32(config.GetConfig().EarthID))
|
||||
bf.WriteUint32(0)
|
||||
@@ -18,7 +22,7 @@ func DoAckEarthSucceed(s *Session, ackHandle uint32, data []*byteframe.ByteFrame
|
||||
DoAckBufSucceed(s, ackHandle, bf.Data())
|
||||
}
|
||||
|
||||
func DoAckBufSucceed(s *Session, ackHandle uint32, data []byte) {
|
||||
func DoAckBufSucceed(s AckSession, ackHandle uint32, data []byte) {
|
||||
s.QueueSendMHF(&mhfpacket.MsgSysAck{
|
||||
AckHandle: ackHandle,
|
||||
IsBufferResponse: true,
|
||||
@@ -27,7 +31,7 @@ func DoAckBufSucceed(s *Session, ackHandle uint32, data []byte) {
|
||||
})
|
||||
}
|
||||
|
||||
func DoAckBufFail(s *Session, ackHandle uint32, data []byte) {
|
||||
func DoAckBufFail(s AckSession, ackHandle uint32, data []byte) {
|
||||
s.QueueSendMHF(&mhfpacket.MsgSysAck{
|
||||
AckHandle: ackHandle,
|
||||
IsBufferResponse: true,
|
||||
@@ -36,7 +40,7 @@ func DoAckBufFail(s *Session, ackHandle uint32, data []byte) {
|
||||
})
|
||||
}
|
||||
|
||||
func DoAckSimpleSucceed(s *Session, ackHandle uint32, data []byte) {
|
||||
func DoAckSimpleSucceed(s AckSession, ackHandle uint32, data []byte) {
|
||||
s.QueueSendMHF(&mhfpacket.MsgSysAck{
|
||||
AckHandle: ackHandle,
|
||||
IsBufferResponse: false,
|
||||
@@ -45,7 +49,7 @@ func DoAckSimpleSucceed(s *Session, ackHandle uint32, data []byte) {
|
||||
})
|
||||
}
|
||||
|
||||
func DoAckSimpleFail(s *Session, ackHandle uint32, data []byte) {
|
||||
func DoAckSimpleFail(s AckSession, ackHandle uint32, data []byte) {
|
||||
s.QueueSendMHF(&mhfpacket.MsgSysAck{
|
||||
AckHandle: ackHandle,
|
||||
IsBufferResponse: false,
|
||||
Reference in New Issue
Block a user