Пример #1
0
        public void RPC_GemCombine(int id, RPC.RPCForwardInfo fwd)
        {
            RPC.PackageWriter pkg = new RPC.PackageWriter();
            int count             = GemBag.GetItemCount(id);
            int need = CSCommon.ItemCommon.Instance.GemCombineNeedCount;

            if (count < need)
            {
                pkg.Write((sbyte)CSCommon.eRet_GemCombine.LessCount);
                pkg.DoReturnPlanes2Client(fwd);
                return;
            }
            var getId  = id + 1;
            var getTpl = CSTable.ItemUtil.GetItem(getId);

            if (getTpl == null)
            {
                pkg.Write((sbyte)CSCommon.eRet_GemCombine.NotCombine);
                pkg.DoReturnPlanes2Client(fwd);
                return;
            }
            int getCount  = count / need;
            int costCount = getCount * need;

            GemBag.RemoveItemCountByTid(id, costCount);
            CreateItemToBag(getId, getCount);
            pkg.Write((sbyte)CSCommon.eRet_GemCombine.Succeed);
            pkg.DoReturnPlanes2Client(fwd);
        }
Пример #2
0
 /// <summary>
 /// 计算宝石带的二级属性
 /// </summary>
 public void CalcGemValue()
 {
     //GemRoleValue.Reset();
     foreach (var item in GemBag.IterItems())
     {
         var temp = CSTable.ItemUtil.GetItem(item.ItemData.ItemTemlateId) as CSTable.ItemGemData;
         if (temp != null)
         {
             AddAttrBasePer(eValueType.Equip, CommonUtil.EquipTypeTranslate((eEquipValueType)temp.attr), temp.value);
         }
     }
 }
Пример #3
0
        private bool InitRoleInstance(PlanesInstance planes, CSCommon.Data.PlayerData pd, Iocp.TcpConnect p2gConnect, UInt16 linkId)
        {
            mPlanes2GateConnect = p2gConnect;
            mClientLinkId       = linkId;

            mPlayerData = pd;
            mPlayerData.RoleDetail._SetHostPlayer(this);
            Bag.InventoryType = CSCommon.eItemInventory.ItemBag;

            //var sp = CSCommon.RoleCommonData.Instance.SexProToTId.Find(x => ((byte)x.Sex == pd.RoleDetail.Sex && (byte)x.Pro == pd.RoleDetail.Profession));
            //if (sp == null)
            //{
            //    Log.Log.Common.Print("SexProToTId is Null sex={0},pro={1}", pd.RoleDetail.Sex, pd.RoleDetail.Profession);
            //    return false;
            //}

            mPlayerData.RoleDetail.TemplateId = CSCommon.CommonUtil.GetTemplateIDBySexAndPro(pd.RoleDetail.Sex, pd.RoleDetail.Profession);

            #region 背包初始化
            Bag.InitBag(this, mPlayerData.RoleDetail.BagSize, mPlayerData.BagItems);
            EquipBag.InitBag(this, (UInt16)CSCommon.eEquipType.MaxBagSize, mPlayerData.EquipedItems);
            FashionBag.InitBag(this, byte.MaxValue, mPlayerData.FashionItems);
            EquipGemBag.InitBag(this, (UInt16)CSCommon.eEquipType.MaxBagSize, mPlayerData.EquipGemItems);
            GemBag.InitBag(this, (UInt16)CSCommon.eEquipType.MaxBagSize, mPlayerData.GemItems);
            #endregion
            InitMartial();
            #region 任务初始化
            InitTask(mPlayerData.TaskData);
            mRecordMgr.Init(this, mPlayerData.AchieveData);
            #endregion
            mSkillMgr.InitBag(this, mPlayerData.SkillDatas);
            #region 状态机初始化
            InitState();
            #endregion
            CalcAllValues();

            //mPlayerData.RoleDetail.RoleMaxHp = FinalRoleValue.MaxHP;
            //暂时先这样,以后需要客户端操作复活
            //if (CurHP <= 0)
            //    Relive();

            //EventDispacth.Instance.AddListener(eGlobleEvent.Fight_KillActor, this);



            return(true);
        }
Пример #4
0
 public void SaveAll()
 {
     // 物品背包
     mPlayerData.BagItems      = Bag.GetBagSaver();
     mPlayerData.EquipedItems  = EquipBag.GetBagSaver();
     mPlayerData.FashionItems  = FashionBag.GetBagSaver();
     mPlayerData.EquipGemItems = EquipGemBag.GetBagSaver();
     mPlayerData.GemItems      = GemBag.GetBagSaver();
     // 任务
     mPlayerData.TaskData = mCurTask.TaskData;
     mRecordMgr.Save(mPlayerData.AchieveData);
     mPlayerData.SkillDatas = mSkillMgr.GetBagSaver();
     SaveMartial();
     //发送存盘数据给数据服务器保存
     RPC.PackageWriter pkg = new RPC.PackageWriter();
     H_RPCRoot.smInstance.HGet_DataServer(pkg).HGet_PlayerManager(pkg).SaveRole(pkg, mPlayerData.RoleDetail.RoleId, mPlayerData);
     pkg.DoCommand(IPlanesServer.Instance.DataConnect, RPC.CommandTargetType.DefaultType);
 }