Example #1
0
        /// <summary>
        /// 计算装备带的二级属性
        /// </summary>
        public void CalcEquipValue()
        {
            //EquipRoleValue.Reset();
            //TODO:EquipRoleValue
            foreach (var item in EquipBag.IterItems())
            {
                //等级表
                var temp = CSTable.ItemUtil.GetEquipLvTpl(item.ItemTemplate.ItemProfession, (item.ItemTemplate as CSTable.ItemEquipData).EquipType, item.ItemData.ItemLv);
                if (temp != null)
                {
                    AddAttrBase(eValueType.Equip, CommonUtil.EquipTypeTranslate((eEquipValueType)temp.attri1), temp.value1);
                }

                //精炼表
                var temp1 = CSTable.ItemUtil.GetEquipRefineLvTpl((item.ItemTemplate as CSTable.ItemEquipData).EquipType, item.ItemData.ItemRefineLv);
                if (temp1 != null)
                {
                    AddAttrBase(eValueType.Equip, CommonUtil.EquipTypeTranslate((eEquipValueType)temp1.attri1), temp1.value1);
                    AddAttrBase(eValueType.Equip, CommonUtil.EquipTypeTranslate((eEquipValueType)temp1.attri2), temp1.value2);
                    AddAttrBase(eValueType.Equip, CommonUtil.EquipTypeTranslate((eEquipValueType)temp1.attri3), temp1.value3);
                    AddAttrBasePer(eValueType.Equip, CommonUtil.EquipTypeTranslate((eEquipValueType)temp1.attri4), temp1.value4);
                    AddAttrBasePer(eValueType.Equip, CommonUtil.EquipTypeTranslate((eEquipValueType)temp1.attri5), temp1.value5);
                    AddAttrBasePer(eValueType.Equip, CommonUtil.EquipTypeTranslate((eEquipValueType)temp1.attri6), temp1.value6);
                }
            }
        }
Example #2
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);
        }
Example #3
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);
 }