mirror of
https://github.com/Mezeporta/Erupe.git
synced 2025-12-14 07:55:33 +01:00
add ClientMode support based on Forward.4
This commit is contained in:
@@ -47,8 +47,10 @@ func (cc *CryptConn) ReadPacket() ([]byte, error) {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
dataSize := uint32(cph.DataSize) + (uint32(cph.Pf0-0x03) * 0x1000)
|
||||
|
||||
// Now read the encrypted packet body after getting its size from the header.
|
||||
encryptedPacketBody := make([]byte, cph.DataSize)
|
||||
encryptedPacketBody := make([]byte, dataSize)
|
||||
_, err = io.ReadFull(cc.conn, encryptedPacketBody)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
@@ -56,7 +58,7 @@ func (cc *CryptConn) ReadPacket() ([]byte, error) {
|
||||
|
||||
// Update the key rotation before decrypting.
|
||||
if cph.KeyRotDelta != 0 {
|
||||
cc.readKeyRot = (uint32(cph.KeyRotDelta) * (cc.readKeyRot + 1))
|
||||
cc.readKeyRot = uint32(cph.KeyRotDelta) * (cc.readKeyRot + 1)
|
||||
}
|
||||
|
||||
out, combinedCheck, check0, check1, check2 := crypto.Decrypt(encryptedPacketBody, cc.readKeyRot, nil)
|
||||
@@ -94,7 +96,7 @@ func (cc *CryptConn) SendPacket(data []byte) error {
|
||||
keyRotDelta := byte(3)
|
||||
|
||||
if keyRotDelta != 0 {
|
||||
cc.sendKeyRot = (uint32(keyRotDelta) * (cc.sendKeyRot + 1))
|
||||
cc.sendKeyRot = uint32(keyRotDelta) * (cc.sendKeyRot + 1)
|
||||
}
|
||||
|
||||
// Encrypt the data
|
||||
|
||||
@@ -2,10 +2,11 @@ package mhfpacket
|
||||
|
||||
import (
|
||||
"errors"
|
||||
_config "erupe-ce/config"
|
||||
|
||||
"erupe-ce/common/byteframe"
|
||||
"erupe-ce/network"
|
||||
"erupe-ce/network/clientctx"
|
||||
"erupe-ce/common/byteframe"
|
||||
)
|
||||
|
||||
// MsgMhfAcquireCafeItem represents the MSG_MHF_ACQUIRE_CAFE_ITEM
|
||||
@@ -30,7 +31,11 @@ func (m *MsgMhfAcquireCafeItem) Parse(bf *byteframe.ByteFrame, ctx *clientctx.Cl
|
||||
m.ItemType = bf.ReadUint16()
|
||||
m.ItemID = bf.ReadUint16()
|
||||
m.Quant = bf.ReadUint16()
|
||||
m.PointCost = bf.ReadUint32()
|
||||
if _config.ErupeConfig.RealClientMode >= _config.G1 {
|
||||
m.PointCost = bf.ReadUint32()
|
||||
} else {
|
||||
m.PointCost = uint32(bf.ReadUint16())
|
||||
}
|
||||
m.Unk0 = bf.ReadUint16()
|
||||
return nil
|
||||
}
|
||||
|
||||
@@ -39,7 +39,7 @@ func (m *MsgSysTerminalLog) Parse(bf *byteframe.ByteFrame, ctx *clientctx.Client
|
||||
m.Unk0 = bf.ReadUint16()
|
||||
|
||||
values := 15
|
||||
if _config.ErupeConfig.RealClientMode <= _config.S6 {
|
||||
if _config.ErupeConfig.RealClientMode <= _config.F4 {
|
||||
values = 7
|
||||
}
|
||||
for i := 0; i < int(m.EntryCount); i++ {
|
||||
|
||||
@@ -130,6 +130,8 @@ func (g *Guild) Rank() uint16 {
|
||||
if g.RankRP < u {
|
||||
if _config.ErupeConfig.RealClientMode <= _config.S6 && i >= 12 {
|
||||
return 12
|
||||
} else if _config.ErupeConfig.RealClientMode <= _config.F4 && i >= 13 {
|
||||
return 13
|
||||
} else if _config.ErupeConfig.RealClientMode <= _config.G32 && i >= 14 {
|
||||
return 14
|
||||
}
|
||||
@@ -138,6 +140,8 @@ func (g *Guild) Rank() uint16 {
|
||||
}
|
||||
if _config.ErupeConfig.RealClientMode <= _config.S6 {
|
||||
return 12
|
||||
} else if _config.ErupeConfig.RealClientMode <= _config.F4 {
|
||||
return 13
|
||||
} else if _config.ErupeConfig.RealClientMode <= _config.G32 {
|
||||
return 14
|
||||
}
|
||||
|
||||
@@ -56,7 +56,7 @@ func encodeServerInfo(config *_config.Config, s *Server, local bool) []byte {
|
||||
bf.WriteUint8(si.Recommended)
|
||||
}
|
||||
|
||||
if s.erupeConfig.RealClientMode <= _config.S6 {
|
||||
if s.erupeConfig.RealClientMode <= _config.F4 {
|
||||
combined := append(stringsupport.UTF8ToSJIS(si.Name), []byte{0x00}...)
|
||||
combined = append(combined, stringsupport.UTF8ToSJIS(si.Description)...)
|
||||
bf.WriteBytes(stringsupport.PaddedString(string(combined), 65, false))
|
||||
|
||||
Reference in New Issue
Block a user