public void ReqGuide(MsgPack pack) { ReqGuide data = pack.msg.reqGuide; GameMsg msg = new GameMsg { cmd = (int)CMD.RspGuide }; PlayerData pd = cacheSvc.GetPlayerDataBySession(pack.session); GuideCfg gc = cfgSvc.GetGuideCfg(data.guideid); // 更新引导ID if (pd.guideid == data.guideid) { // 检测是否是智者点拨任务 if (pd.guideid == 1001) { TaskSys.Instance.CalcTaskPrgs(pd, 1); } pd.guideid += 1; // 更新玩家数据 pd.coin += gc.coin; Common.CalcExp(pd, gc.exp); // 数据更新数据库 if (cacheSvc.UpdatePlayerData(pd.id, pd) == false) { msg.err = (int)ErrorCode.UpdateDBError; } else { msg.rspGuide = new RspGuide { guideid = pd.guideid, coin = pd.coin, lv = pd.lv, exp = pd.exp }; } } else { msg.err = (int)ErrorCode.ServerDataError; } pack.session.SendMsg(msg); }
public void ReqGuide(MsgPack pack) { ReqGuide data = (ReqGuide)pack.msg; SCPacketBase msg = new RspGuide(); PlayerData pd = cacheSvc.GetPlayerDataBySession(pack.session); GuideCfg gc = cfgSvc.GetGuideCfg(data.Guideid); //更新引导ID if (pd.Guideid == data.Guideid) { //检测是否为智者点拔任务 if (pd.Guideid == 1001) { TaskSys.Instance.CalcTaskPrgs(pd, 1); } pd.Guideid += 1; //更新玩家数据 pd.Coin += gc.coin; KDCommon.CalcExp(pd, gc.exp); if (!cacheSvc.UpdatePlayerData(pd.Id, pd)) { msg.error = (int)ErrorCode.UpdateDBError; } else { msg = new RspGuide { Guideid = pd.Guideid, Coin = pd.Coin, Lv = pd.Lv, Exp = pd.Exp }; } } else { msg.error = (int)ErrorCode.ServerDataError; } pack.session.SendMsg(msg); }