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.
 
 
 
 
 
 

176 lines
6.6 KiB

//using Google.Protobuf.WellKnownTypes;
//using System;
//using System.Collections.Generic;
//using System.Linq;
//using System.Text;
//using System.Threading.Tasks;
//namespace SogClient
//{
// public class TestPetPvp : ITestHandler
// {
// private Player player = null;
// private long m_lastUpdateTime;
// private long m_lastInfoTime;
// private OpState m_opState = OpState.LOCK;
// private CSPetPVPInfoRes res;
// public TestPetPvp(Player player) : base(player)
// {
// this.player = player;
// TraceLog.Debug("TestPetPvp player {0}", player.GetUid());
// }
// private enum OpState
// {
// LOCK,
// UNLOCK,
// SIGNUP,
// ATT,
// ATTPOS,
// BATTLE,
// FINISH
// }
// public override void RegisterMsg(TestHandlerMgr mgr)
// {
// //mgr.RegisterPacketHandler((int)CSGameMsgID.PetNotify, this);
// mgr.RegisterPacketHandler((int)CSGameMsgID.PetpvpInfoRes, this);
// mgr.RegisterPacketHandler((int)CSGameMsgID.PetpvpAttRes, this);
// mgr.RegisterPacketHandler((int)CSGameMsgID.PetpvpGetreadyinfoRes, this);
// mgr.RegisterPacketHandler((int)CSGameMsgID.PetpvpBattleInfoRes, this);
// mgr.RegisterPacketHandler((int)CSGameMsgID.PetpvpBattleDetailRes, this);
// }
// public override void HandlerMsg(RequestPacket packet)
// {
// switch (packet.MsgID)
// {
// //case (int)CSGameMsgID.PetNotify:
// // {
// // CSPetNotify res = packet.Packet as CSPetNotify;
// // for (int i = 0; i < res.PetDetailList.Count; i++)
// // {
// // if (res.PetDetailList[i].IsNew)
// // {
// // player.m_playerCache.m_data.PetData.PetDetailList.Add(res.PetDetailList[i]);
// // }
// // }
// // }
// // break;
// case (int)CSGameMsgID.PetpvpInfoRes:
// PetPvpInfoRes(packet);
// break;
// case (int)CSGameMsgID.PetpvpAttRes:
// {
// CSPetPVPAttRes res = packet.Packet as CSPetPVPAttRes;
// if(res.Ret == CSErrCode.None)
// {
// m_opState = OpState.SIGNUP;
// }
// }
// break;
// }
// }
// public override void Update(long nowSecond)
// {
// if (m_lastUpdateTime == 0)
// {
// m_lastUpdateTime = nowSecond;
// }
// //cd 5s,太短压力测试时gate撑不住
// if (m_lastUpdateTime + 5 > nowSecond)
// {
// return;
// }
// m_lastUpdateTime = nowSecond;
// if (m_opState == OpState.LOCK)
// {
// if (!player.IsUnlockSys((int)SystemUnlockId.PetPvp))
// {
// //发送gm开启
// player.SendGM("AddItem 3 200000");
// player.SendGM("TaskEXJumpMain 177 " + player.GetUid());
// player.SendGM("UpgradeGloryLevel 3");
// player.SendGM("AddPet 0 1");
// TraceLog.Debug("发送GM开启 {0}", player.GetUid());
// }
// //else if (m_opState == OpState.LOCK)
// //{
// m_opState = OpState.UNLOCK;
// CSPetPVPInfo req = new CSPetPVPInfo();
// SendToServer(req, (int)CSGameMsgID.PetpvpInfo);
// //}
// }
// if(res != null && res.Status == PetPvpSeasonStatus.Signup && m_opState == OpState.UNLOCK)
// {
// if(player.m_playerCache.m_data.Mate.MateList.Count > 0 )
// {
// //配置表里的数字
// int attNum = 5;
// CSPetPVPAtt req = new CSPetPVPAtt();
// for(int i = 0; i < attNum; i++)
// {
// PetPvpAttData att = new PetPvpAttData();
// att.Index = i + 1;
// att.Hide = false;
// if (i < player.m_playerCache.m_data.Mate.MateList.Count)
// {
// att.PetId = player.m_playerCache.m_data.Mate.MateList[i].MateId;
// }
// else
// {
// att.PetId = 0;
// }
// req.Att.Add(att);
// }
// SendToServer(req, (int)CSGameMsgID.PetpvpAtt);
// TraceLog.Debug("布阵petpvp {0}", player.GetUid());
// }
// else
// {
// TraceLog.Debug("uid={0}, petlist = 0", player.GetUid());
// }
// if(res.SignUp == false && res.Att.Count > 0)
// {
// CSPetPVPSignup sPetPVPSignup = new CSPetPVPSignup();
// foreach (var item in res.Att)
// {
// sPetPVPSignup.Att.Add(item.PetId);
// }
// SendToServer(sPetPVPSignup, (int)CSGameMsgID.PetpvpSignup);
// TraceLog.Debug("报名petpvp {0}", player.GetUid());
// }
// }
// if(m_lastInfoTime == 0)
// {
// m_lastInfoTime = nowSecond;
// }
// if(nowSecond - m_lastInfoTime > 120)
// {
// m_lastInfoTime = nowSecond;
// {
// CSPetPVPInfo req = new CSPetPVPInfo();
// SendToServer(req, (int)CSGameMsgID.PetpvpInfo);
// }
// }
// }
// private void PetPvpInfoRes(RequestPacket packet)
// {
// this.res = packet.Packet as CSPetPVPInfoRes;
// TraceLog.Debug("CSPetPVPInfoRes {0} ", res);
// if(res.Status == PetPvpSeasonStatus.Finish && m_opState != OpState.FINISH)
// {
// m_opState = OpState.FINISH;
// }
// if (res.Status == PetPvpSeasonStatus.Signup && m_opState == OpState.FINISH)
// {
// m_opState = OpState.UNLOCK;
// }
// }
// }
//}