You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 

56 lines
2.2 KiB

using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using Sog;
using ProtoCSStruct;
namespace GameDB
{
public static class MainlandRecordOp
{
public static void OnQueryBattleReplayDbReq(uint remoteAppID, StructPacket packet, GameDBOperator dbOperator)
{
ref SSQueryBattleReplayDbReq req = ref packet.GetMessage<SSQueryBattleReplayDbReq>();
SSQueryBattleReplayDbRes res = new SSQueryBattleReplayDbRes();
res.RemoteAppID = req.RemoteAppID;
res.BattleId = req.BattleId;
res.OpType = req.OpType;
bool ret = dbOperator.QueryBattleReplay((long)req.BattleId, ref res);
if (!ret)
{
res.Ret = (int)CSErrCode.BattleVersionError;
}
GameDBServerUtils.GetPacketSender().SendToServerByID(remoteAppID, (int)SSGameMsgID.QueryBattleReplayDbRes, ref res, packet.ObjectID);
}
public static void OnSaveBattleReplayDbReq(uint remoteAppID, StructPacket packet, GameDBOperator dbOperator)
{
ref SSSaveBattleReplayDbReq req = ref packet.GetMessage<SSSaveBattleReplayDbReq>();
bool ret = dbOperator.AddBattleReplayData((long)req.BattleId, req.CreateDay, ref req.Replay);
SSSaveBattleReplayDbRes res = new SSSaveBattleReplayDbRes();
if(ret == false)
{
res.Ret = -1;
}
GameDBServerUtils.GetPacketSender().SendToServerByID(remoteAppID, (int)SSGameMsgID.SaveBattleReplayDbRes, ref res, packet.ObjectID);
}
public static void OnDeleteBattleReplayDbReq(uint remoteAppID, StructPacket packet, GameDBOperator dbOperator)
{
ref SSDeleteBattleReplayDbReq req = ref packet.GetMessage<SSDeleteBattleReplayDbReq>();
bool ret = dbOperator.DeleteBattleReplay((long)req.BattleId);
SSDeleteBattleReplayDbRes res = new SSDeleteBattleReplayDbRes();
res.BattleId = req.BattleId;
GameDBServerUtils.GetPacketSender().SendToServerByID(remoteAppID, (int)SSGameMsgID.DeleteBattleReplayDbRes, ref res, packet.ObjectID);
}
}
}