2023-03-27 22:02:13 +00:00
|
|
|
package login
|
2023-03-09 07:48:13 +00:00
|
|
|
|
|
|
|
import (
|
|
|
|
"encoding/binary"
|
2023-11-30 01:52:10 +00:00
|
|
|
"errors"
|
2023-03-09 07:48:13 +00:00
|
|
|
"fmt"
|
2023-06-22 06:53:38 +00:00
|
|
|
"log"
|
|
|
|
"math/rand"
|
2023-03-09 07:48:13 +00:00
|
|
|
|
2023-03-10 07:02:28 +00:00
|
|
|
"github.com/CPunch/gopenfusion/config"
|
2023-08-23 23:16:24 +00:00
|
|
|
"github.com/CPunch/gopenfusion/internal/db"
|
|
|
|
"github.com/CPunch/gopenfusion/internal/protocol"
|
|
|
|
"github.com/CPunch/gopenfusion/internal/redis"
|
2023-03-09 07:48:13 +00:00
|
|
|
)
|
|
|
|
|
|
|
|
const (
|
|
|
|
LOGIN_DATABASE_ERROR = 0
|
|
|
|
LOGIN_ID_DOESNT_EXIST = 1
|
|
|
|
LOGIN_ID_AND_PASSWORD_DO_NOT_MATCH = 2
|
|
|
|
LOGIN_ID_ALREADY_IN_USE = 3
|
|
|
|
LOGIN_ERROR = 4
|
|
|
|
LOGIN_CLIENT_VERSION_OUTDATED = 6
|
|
|
|
LOGIN_YOU_ARE_NOT_AN_AUTHORIZED_BETA_TESTER = 7
|
|
|
|
LOGIN_AUTHENTICATION_CONNECTION_ERROR = 8
|
|
|
|
LOGIN_UPDATED_EUALA_REQUIRED = 9
|
|
|
|
)
|
|
|
|
|
2023-03-18 21:40:20 +00:00
|
|
|
func (server *LoginServer) AcceptLogin(peer *protocol.CNPeer, SzID string, IClientVerC int32, ISlotNum int8, data []protocol.SP_LS2CL_REP_CHAR_INFO) error {
|
2023-03-11 06:24:20 +00:00
|
|
|
resp := protocol.SP_LS2CL_REP_LOGIN_SUCC{
|
2023-03-09 07:48:13 +00:00
|
|
|
SzID: SzID,
|
|
|
|
ICharCount: int8(len(data)),
|
|
|
|
ISlotNum: ISlotNum,
|
|
|
|
IPaymentFlag: 1,
|
|
|
|
IOpenBetaFlag: 0,
|
2023-06-25 23:29:31 +00:00
|
|
|
UiSvrTime: protocol.GetTime(),
|
2023-03-09 07:48:13 +00:00
|
|
|
}
|
|
|
|
|
2023-03-11 05:59:13 +00:00
|
|
|
if err := peer.Send(protocol.P_LS2CL_REP_LOGIN_SUCC, resp); err != nil {
|
2023-03-11 02:30:16 +00:00
|
|
|
return err
|
|
|
|
}
|
|
|
|
|
2023-03-10 23:10:57 +00:00
|
|
|
// swap keys
|
2023-03-09 22:42:13 +00:00
|
|
|
peer.E_key = protocol.CreateNewKey(
|
2023-03-09 07:48:13 +00:00
|
|
|
resp.UiSvrTime,
|
|
|
|
uint64(resp.ICharCount+1),
|
|
|
|
uint64(resp.ISlotNum+1),
|
|
|
|
)
|
2023-03-09 22:42:13 +00:00
|
|
|
peer.FE_key = protocol.CreateNewKey(
|
2023-03-09 07:48:13 +00:00
|
|
|
binary.LittleEndian.Uint64([]byte(protocol.DEFAULT_KEY)),
|
|
|
|
uint64(IClientVerC),
|
|
|
|
1,
|
|
|
|
)
|
|
|
|
|
|
|
|
// send characters (if any)
|
|
|
|
for i := 0; i < len(data); i++ {
|
2023-03-11 05:59:13 +00:00
|
|
|
if err := peer.Send(protocol.P_LS2CL_REP_CHAR_INFO, &data[i]); err != nil {
|
2023-03-11 02:30:16 +00:00
|
|
|
return err
|
|
|
|
}
|
2023-03-09 07:48:13 +00:00
|
|
|
}
|
2023-03-11 02:30:16 +00:00
|
|
|
|
|
|
|
return nil
|
2023-03-09 07:48:13 +00:00
|
|
|
}
|
|
|
|
|
2023-11-28 03:23:28 +00:00
|
|
|
func (server *LoginServer) Login(peer *protocol.CNPeer, _account interface{}, pkt protocol.Packet) error {
|
2023-03-09 07:48:13 +00:00
|
|
|
var loginPkt protocol.SP_CL2LS_REQ_LOGIN
|
|
|
|
pkt.Decode(&loginPkt)
|
|
|
|
|
|
|
|
SendError := func(e int32) {
|
2023-03-11 06:24:20 +00:00
|
|
|
peer.Send(protocol.P_LS2CL_REP_LOGIN_FAIL, protocol.SP_LS2CL_REP_LOGIN_FAIL{
|
2023-03-09 07:48:13 +00:00
|
|
|
IErrorCode: e,
|
|
|
|
SzID: loginPkt.SzID,
|
2023-03-11 05:59:13 +00:00
|
|
|
})
|
2023-03-09 07:48:13 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
// client is resending a login packet??
|
2023-11-28 03:23:28 +00:00
|
|
|
if _account != nil {
|
2023-03-09 07:48:13 +00:00
|
|
|
SendError(LOGIN_ERROR)
|
2023-11-28 03:23:28 +00:00
|
|
|
return fmt.Errorf("out of order P_CL2LS_REQ_LOGIN: %v", _account)
|
2023-03-09 07:48:13 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
// attempt login
|
2023-03-17 21:27:47 +00:00
|
|
|
account, err := server.dbHndlr.TryLogin(loginPkt.SzID, loginPkt.SzPassword)
|
2023-11-30 01:52:10 +00:00
|
|
|
if errors.Is(err, db.ErrLoginInvalidID) {
|
2023-03-09 07:48:13 +00:00
|
|
|
// this is the default behavior, auto create the account if the ID isn't in use
|
2023-03-17 21:27:47 +00:00
|
|
|
account, err = server.dbHndlr.NewAccount(loginPkt.SzID, loginPkt.SzPassword)
|
2023-03-09 07:48:13 +00:00
|
|
|
if err != nil {
|
|
|
|
// respond with a dummy login error packet so the client doesn't get softlocked
|
|
|
|
SendError(LOGIN_DATABASE_ERROR)
|
2023-03-11 02:30:16 +00:00
|
|
|
return err
|
2023-03-09 07:48:13 +00:00
|
|
|
}
|
2023-11-30 01:52:10 +00:00
|
|
|
} else if errors.Is(err, db.ErrLoginInvalidPassword) {
|
2023-03-09 07:48:13 +00:00
|
|
|
// respond with invalid password
|
|
|
|
SendError(LOGIN_ID_AND_PASSWORD_DO_NOT_MATCH)
|
2023-03-11 02:30:16 +00:00
|
|
|
return nil
|
2023-03-09 07:48:13 +00:00
|
|
|
} else if err != nil { // wtf?
|
|
|
|
SendError(LOGIN_DATABASE_ERROR)
|
2023-03-11 02:30:16 +00:00
|
|
|
return err
|
2023-03-09 07:48:13 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
// grab player data
|
2023-11-28 03:23:28 +00:00
|
|
|
server.service.SetPeerData(peer, account)
|
2023-03-17 21:27:47 +00:00
|
|
|
plrs, err := server.dbHndlr.GetPlayers(account.AccountID)
|
2023-03-09 07:48:13 +00:00
|
|
|
if err != nil {
|
|
|
|
SendError(LOGIN_DATABASE_ERROR)
|
2023-03-11 02:30:16 +00:00
|
|
|
return err
|
2023-03-09 07:48:13 +00:00
|
|
|
}
|
2023-06-22 06:53:38 +00:00
|
|
|
log.Printf("Account (%d) %s has logged in", account.AccountID, account.Login)
|
2023-03-09 07:48:13 +00:00
|
|
|
|
2023-03-11 09:28:11 +00:00
|
|
|
// truncate plrs
|
|
|
|
if len(plrs) > 3 {
|
|
|
|
plrs = plrs[:4]
|
|
|
|
}
|
|
|
|
|
2023-03-09 07:48:13 +00:00
|
|
|
// build character list
|
2023-03-11 09:28:11 +00:00
|
|
|
charInfo := [4]protocol.SP_LS2CL_REP_CHAR_INFO{}
|
|
|
|
for i, plr := range plrs {
|
2023-03-09 07:48:13 +00:00
|
|
|
info := protocol.SP_LS2CL_REP_CHAR_INFO{
|
|
|
|
ISlot: int8(plr.Slot),
|
|
|
|
ILevel: int16(plr.Level),
|
2023-03-22 05:30:58 +00:00
|
|
|
SPC_Style: plr.PCStyle,
|
|
|
|
SPC_Style2: plr.PCStyle2,
|
|
|
|
IX: int32(plr.X),
|
|
|
|
IY: int32(plr.Y),
|
|
|
|
IZ: int32(plr.Z),
|
2023-03-09 07:48:13 +00:00
|
|
|
}
|
|
|
|
|
2023-03-17 21:27:47 +00:00
|
|
|
AEquip, err := server.dbHndlr.GetPlayerInventorySlots(plr.PlayerID, 0, config.AEQUIP_COUNT-1)
|
2023-03-09 07:48:13 +00:00
|
|
|
if err != nil {
|
|
|
|
SendError(LOGIN_DATABASE_ERROR)
|
2023-03-11 02:30:16 +00:00
|
|
|
return err
|
2023-03-09 07:48:13 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
copy(info.AEquip[:], AEquip)
|
2023-03-11 09:28:11 +00:00
|
|
|
charInfo[i] = info
|
2023-03-09 07:48:13 +00:00
|
|
|
}
|
|
|
|
|
2023-03-11 09:28:11 +00:00
|
|
|
return server.AcceptLogin(peer, loginPkt.SzID, loginPkt.IClientVerC, 1, charInfo[:len(plrs)])
|
2023-03-09 07:48:13 +00:00
|
|
|
}
|
|
|
|
|
2023-11-28 03:23:28 +00:00
|
|
|
func (server *LoginServer) CheckCharacterName(peer *protocol.CNPeer, account interface{}, pkt protocol.Packet) error {
|
2023-03-10 06:41:21 +00:00
|
|
|
var charPkt protocol.SP_CL2LS_REQ_CHECK_CHAR_NAME
|
|
|
|
pkt.Decode(&charPkt)
|
|
|
|
|
|
|
|
// just auto accept, client resends this data later
|
2023-03-11 06:24:20 +00:00
|
|
|
return peer.Send(protocol.P_LS2CL_REP_CHECK_CHAR_NAME_SUCC, protocol.SP_LS2CL_REP_CHECK_CHAR_NAME_SUCC{
|
2023-03-10 06:41:21 +00:00
|
|
|
SzFirstName: charPkt.SzFirstName,
|
|
|
|
SzLastName: charPkt.SzLastName,
|
2023-03-11 05:59:13 +00:00
|
|
|
})
|
2023-03-10 06:41:21 +00:00
|
|
|
}
|
|
|
|
|
2023-11-28 03:23:28 +00:00
|
|
|
func (server *LoginServer) SaveCharacterName(peer *protocol.CNPeer, account interface{}, pkt protocol.Packet) error {
|
2023-03-09 07:48:13 +00:00
|
|
|
var charPkt protocol.SP_CL2LS_REQ_SAVE_CHAR_NAME
|
|
|
|
pkt.Decode(&charPkt)
|
|
|
|
|
2023-11-28 03:23:28 +00:00
|
|
|
if account == nil {
|
2023-03-11 06:24:20 +00:00
|
|
|
peer.Send(protocol.P_LS2CL_REP_SAVE_CHAR_NAME_FAIL, protocol.SP_LS2CL_REP_SAVE_CHAR_NAME_FAIL{})
|
2023-08-23 23:37:57 +00:00
|
|
|
return fmt.Errorf("out of order P_LS2CL_REP_SAVE_CHAR_NAME_FAIL")
|
2023-03-09 07:48:13 +00:00
|
|
|
}
|
|
|
|
|
2023-03-10 06:41:21 +00:00
|
|
|
// TODO: sanity check SzFirstName && SzLastName
|
2023-11-28 03:23:28 +00:00
|
|
|
PlayerID, err := server.dbHndlr.NewPlayer(account.(*db.Account).AccountID, charPkt.SzFirstName, charPkt.SzLastName, int(charPkt.ISlotNum))
|
2023-03-09 07:48:13 +00:00
|
|
|
if err != nil {
|
2023-03-11 06:24:20 +00:00
|
|
|
peer.Send(protocol.P_LS2CL_REP_SAVE_CHAR_NAME_FAIL, protocol.SP_LS2CL_REP_SAVE_CHAR_NAME_FAIL{})
|
2023-03-11 02:30:16 +00:00
|
|
|
return err
|
2023-03-09 07:48:13 +00:00
|
|
|
}
|
|
|
|
|
2023-03-11 06:24:20 +00:00
|
|
|
return peer.Send(protocol.P_LS2CL_REP_SAVE_CHAR_NAME_SUCC, protocol.SP_LS2CL_REP_SAVE_CHAR_NAME_SUCC{
|
2023-03-09 07:48:13 +00:00
|
|
|
IPC_UID: int64(PlayerID),
|
|
|
|
ISlotNum: charPkt.ISlotNum,
|
|
|
|
IGender: charPkt.IGender,
|
|
|
|
SzFirstName: charPkt.SzFirstName,
|
|
|
|
SzLastName: charPkt.SzLastName,
|
2023-03-11 05:59:13 +00:00
|
|
|
})
|
2023-03-09 07:48:13 +00:00
|
|
|
}
|
|
|
|
|
2023-03-09 20:41:38 +00:00
|
|
|
func validateCharacterCreation(character *protocol.SP_CL2LS_REQ_CHAR_CREATE) bool {
|
|
|
|
// thanks openfusion!
|
|
|
|
// all the values have been determined from analyzing client code and xdt
|
|
|
|
// and double checked using cheat engine
|
|
|
|
|
|
|
|
// check base parameters
|
|
|
|
style := &character.PCStyle
|
|
|
|
if !(style.IBody >= 0 && style.IBody <= 2 &&
|
|
|
|
style.IEyeColor >= 1 && style.IEyeColor <= 5 &&
|
|
|
|
style.IGender >= 1 && style.IGender <= 2 &&
|
|
|
|
style.IHairColor >= 1 && style.IHairColor <= 18) &&
|
|
|
|
style.IHeight >= 0 && style.IHeight <= 4 &&
|
|
|
|
style.INameCheck >= 0 && style.INameCheck <= 2 &&
|
|
|
|
style.ISkinColor >= 1 && style.ISkinColor <= 12 {
|
|
|
|
return false
|
|
|
|
}
|
|
|
|
|
|
|
|
// facestyle and hairstyle are gender dependent
|
|
|
|
if !(style.IGender == 1 && style.IFaceStyle >= 1 && style.IFaceStyle <= 5 && style.IHairStyle >= 1 && style.IHairStyle <= 23) &&
|
|
|
|
!(style.IGender == 2 && style.IFaceStyle >= 6 && style.IFaceStyle <= 10 && style.IHairStyle >= 25 && style.IHairStyle <= 45) {
|
|
|
|
return false
|
|
|
|
}
|
|
|
|
|
2023-03-11 09:28:11 +00:00
|
|
|
// TODO: sanity check items in SOn_Item; see db.FinishPlayer()
|
2023-03-09 20:41:38 +00:00
|
|
|
return true
|
|
|
|
}
|
|
|
|
|
2023-03-18 21:40:20 +00:00
|
|
|
func SendFail(peer *protocol.CNPeer) error {
|
2023-03-11 06:24:20 +00:00
|
|
|
if err := peer.Send(protocol.P_LS2CL_REP_SHARD_SELECT_FAIL, protocol.SP_LS2CL_REP_SHARD_SELECT_FAIL{
|
2023-03-11 05:59:13 +00:00
|
|
|
IErrorCode: 2,
|
|
|
|
}); err != nil {
|
|
|
|
return err
|
|
|
|
}
|
|
|
|
|
|
|
|
return nil
|
|
|
|
}
|
|
|
|
|
2023-11-28 03:23:28 +00:00
|
|
|
func (server *LoginServer) CharacterCreate(peer *protocol.CNPeer, account interface{}, pkt protocol.Packet) error {
|
2023-03-09 07:48:13 +00:00
|
|
|
var charPkt protocol.SP_CL2LS_REQ_CHAR_CREATE
|
|
|
|
pkt.Decode(&charPkt)
|
|
|
|
|
2023-11-28 03:23:28 +00:00
|
|
|
if account == nil {
|
|
|
|
return SendFail(peer)
|
|
|
|
}
|
|
|
|
|
2023-03-09 20:41:38 +00:00
|
|
|
if !validateCharacterCreation(&charPkt) {
|
2023-06-25 06:51:21 +00:00
|
|
|
log.Printf("Invalid character creation packet: %+v", charPkt)
|
2023-03-11 05:59:13 +00:00
|
|
|
return SendFail(peer)
|
2023-03-09 20:41:38 +00:00
|
|
|
}
|
|
|
|
|
2023-11-28 03:23:28 +00:00
|
|
|
if err := server.dbHndlr.FinishPlayer(&charPkt, account.(*db.Account).AccountID); err != nil {
|
2023-06-22 06:53:38 +00:00
|
|
|
log.Printf("Error finishing player: %v", err)
|
2023-03-11 05:59:13 +00:00
|
|
|
return SendFail(peer)
|
2023-03-09 07:48:13 +00:00
|
|
|
}
|
|
|
|
|
2023-03-17 21:27:47 +00:00
|
|
|
plr, err := server.dbHndlr.GetPlayer(int(charPkt.PCStyle.IPC_UID))
|
2023-03-09 07:48:13 +00:00
|
|
|
if err != nil {
|
2023-06-22 06:53:38 +00:00
|
|
|
log.Printf("Error getting player: %v", err)
|
2023-03-11 05:59:13 +00:00
|
|
|
return SendFail(peer)
|
2023-03-09 07:48:13 +00:00
|
|
|
}
|
|
|
|
|
2023-03-11 06:24:20 +00:00
|
|
|
return peer.Send(protocol.P_LS2CL_REP_CHAR_CREATE_SUCC, protocol.SP_LS2CL_REP_CHAR_CREATE_SUCC{
|
2023-03-09 07:48:13 +00:00
|
|
|
ILevel: int16(plr.Level),
|
2023-03-22 05:30:58 +00:00
|
|
|
SPC_Style: plr.PCStyle,
|
|
|
|
SPC_Style2: plr.PCStyle2,
|
2023-03-10 06:58:29 +00:00
|
|
|
SOn_Item: charPkt.SOn_Item, // if items were faked, we don't really care since the db only stores the sanitized fields
|
2023-03-11 05:59:13 +00:00
|
|
|
})
|
2023-03-09 07:48:13 +00:00
|
|
|
}
|
2023-03-10 06:41:21 +00:00
|
|
|
|
2023-11-28 03:23:28 +00:00
|
|
|
func (server *LoginServer) CharacterDelete(peer *protocol.CNPeer, account interface{}, pkt protocol.Packet) error {
|
2023-03-10 06:41:21 +00:00
|
|
|
var charPkt protocol.SP_CL2LS_REQ_CHAR_DELETE
|
|
|
|
pkt.Decode(&charPkt)
|
|
|
|
|
2023-11-28 03:23:28 +00:00
|
|
|
if account == nil {
|
|
|
|
return SendFail(peer)
|
|
|
|
}
|
|
|
|
|
|
|
|
slot, err := server.dbHndlr.DeletePlayer(int(charPkt.IPC_UID), account.(*db.Account).AccountID)
|
2023-03-10 06:41:21 +00:00
|
|
|
if err != nil {
|
2023-03-11 05:59:13 +00:00
|
|
|
return SendFail(peer)
|
2023-03-10 06:41:21 +00:00
|
|
|
}
|
|
|
|
|
2023-03-11 06:24:20 +00:00
|
|
|
return peer.Send(protocol.P_LS2CL_REP_CHAR_DELETE_SUCC, protocol.SP_LS2CL_REP_CHAR_DELETE_SUCC{
|
2023-03-10 06:41:21 +00:00
|
|
|
ISlotNum: int8(slot),
|
2023-03-11 05:59:13 +00:00
|
|
|
})
|
2023-03-10 06:41:21 +00:00
|
|
|
}
|
|
|
|
|
2023-11-28 03:23:28 +00:00
|
|
|
func (server *LoginServer) ShardSelect(peer *protocol.CNPeer, account interface{}, pkt protocol.Packet) error {
|
2023-03-17 21:27:47 +00:00
|
|
|
var selection protocol.SP_CL2LS_REQ_CHAR_SELECT
|
|
|
|
pkt.Decode(&selection)
|
|
|
|
|
2023-11-28 03:23:28 +00:00
|
|
|
if account == nil {
|
|
|
|
return SendFail(peer)
|
|
|
|
}
|
|
|
|
|
2023-06-22 06:53:38 +00:00
|
|
|
shards := server.redisHndlr.GetShards()
|
|
|
|
if len(shards) == 0 {
|
|
|
|
SendFail(peer)
|
2023-08-23 23:37:57 +00:00
|
|
|
return fmt.Errorf("loginServer has found no linked shards")
|
2023-03-17 21:27:47 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
key, err := protocol.GenSerialKey()
|
|
|
|
if err != nil {
|
|
|
|
return err
|
|
|
|
}
|
|
|
|
|
2023-06-22 06:53:38 +00:00
|
|
|
// TODO: better shard selection logic pls
|
|
|
|
// for now, pick random shard
|
|
|
|
shard := shards[rand.Intn(len(shards))]
|
2023-03-17 21:27:47 +00:00
|
|
|
|
2023-06-22 06:53:38 +00:00
|
|
|
// make sure the player is owned by the account
|
|
|
|
plr, err := server.dbHndlr.GetPlayer(int(selection.IPC_UID))
|
|
|
|
if err != nil {
|
|
|
|
log.Printf("Error getting player: %v", err)
|
|
|
|
return SendFail(peer)
|
|
|
|
}
|
2023-11-28 03:23:28 +00:00
|
|
|
accountID := account.(*db.Account).AccountID
|
2023-06-22 06:53:38 +00:00
|
|
|
|
2023-11-28 03:23:28 +00:00
|
|
|
if plr.AccountID != accountID {
|
|
|
|
log.Printf("HACK: player %d tried to join shard as player %d", accountID, plr.AccountID)
|
2023-06-22 06:53:38 +00:00
|
|
|
return SendFail(peer)
|
|
|
|
}
|
|
|
|
|
|
|
|
// share the login attempt
|
|
|
|
server.redisHndlr.QueueLogin(key, redis.LoginMetadata{
|
2023-06-22 23:12:31 +00:00
|
|
|
FEKey: peer.FE_key,
|
|
|
|
PlayerID: int32(selection.IPC_UID),
|
2023-11-28 03:23:28 +00:00
|
|
|
AccountID: accountID,
|
2023-06-22 06:53:38 +00:00
|
|
|
})
|
|
|
|
|
|
|
|
// craft response
|
2023-03-17 21:27:47 +00:00
|
|
|
resp := protocol.SP_LS2CL_REP_SHARD_SELECT_SUCC{
|
2023-06-22 06:53:38 +00:00
|
|
|
G_FE_ServerPort: int32(shard.Port),
|
2023-03-17 21:27:47 +00:00
|
|
|
IEnterSerialKey: key,
|
|
|
|
}
|
|
|
|
|
|
|
|
// the rest of the bytes in G_FE_ServerIP will be zero'd, so there's no need to write the NULL byte
|
2023-06-22 06:53:38 +00:00
|
|
|
copy(resp.G_FE_ServerIP[:], []byte(shard.IP))
|
2023-03-17 21:27:47 +00:00
|
|
|
|
|
|
|
return peer.Send(protocol.P_LS2CL_REP_SHARD_SELECT_SUCC, resp)
|
|
|
|
}
|
|
|
|
|
2023-11-28 03:23:28 +00:00
|
|
|
func (server *LoginServer) FinishTutorial(peer *protocol.CNPeer, account interface{}, pkt protocol.Packet) error {
|
2023-03-10 06:41:21 +00:00
|
|
|
var charPkt protocol.SP_CL2LS_REQ_SAVE_CHAR_TUTOR
|
|
|
|
pkt.Decode(&charPkt)
|
|
|
|
|
2023-11-28 03:23:28 +00:00
|
|
|
if account == nil {
|
|
|
|
return SendFail(peer)
|
|
|
|
}
|
|
|
|
|
|
|
|
if err := server.dbHndlr.FinishTutorial(int(charPkt.IPC_UID), account.(*db.Account).AccountID); err != nil {
|
2023-03-11 05:59:13 +00:00
|
|
|
return SendFail(peer)
|
2023-03-10 06:41:21 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
// no response
|
2023-03-11 02:30:16 +00:00
|
|
|
return nil
|
2023-03-10 06:41:21 +00:00
|
|
|
}
|