Exemplo n.º 1
0
        public void RPC_UpCheats(int skillId, byte costType, RPC.RPCForwardInfo fwd)
        {
            RPC.PackageWriter pkg = new RPC.PackageWriter();
            var sk = SkillMgr.GetSkill(skillId);

            if (sk == null)
            {
                pkg.Write((sbyte)eRet_UpSkillLv.NotLearn);
                pkg.DoReturnPlanes2Client(fwd);
                return;
            }
            var sktpl = CSTable.SkillUtil.GetSkillTpl(skillId);

            if (sktpl == null)
            {
                pkg.Write((sbyte)eRet_UpSkillLv.NoSkill);
                pkg.DoReturnPlanes2Client(fwd);
                return;
            }
            //升级
            if (sk.Level >= PlayerData.RoleDetail.RoleLevel)
            {
                pkg.Write((sbyte)eRet_UpSkillLv.LessRoleLv);
                pkg.DoReturnPlanes2Client(fwd);
                return;
            }
            if (sk.Level >= sk.Data.maxLv)
            {
                pkg.Write((sbyte)eRet_UpSkillLv.MaxLv);
                pkg.DoReturnPlanes2Client(fwd);
                return;
            }
            //下级模板
            var sklvtpl = CSTable.SkillUtil.GetSkillLevelTpl(skillId, sk.Level + 1);

            if (sklvtpl == null)
            {
                pkg.Write((sbyte)eRet_UpSkillLv.NoSkillLvTpl);
                pkg.DoReturnPlanes2Client(fwd);
                return;
            }
            sbyte result = UpCheats(sklvtpl, costType);

            if (result != (sbyte)eRet_UpSkillLv.Succeed)
            {
                pkg.Write(result);
                pkg.DoReturnPlanes2Client(fwd);
                return;
            }
            sk.Init(sklvtpl.id, (byte)sklvtpl.level);
            sk.SetOwner(this);
            pkg.Write((sbyte)eRet_UpSkillLv.Succeed);
            pkg.DoReturnPlanes2Client(fwd);
        }
Exemplo n.º 2
0
 void Cast(string str, Char owner, params Char[] targets)
 {
     SkillMgr.GetSkill(str).Cast(owner, targets);
 }
Exemplo n.º 3
0
        public void RPC_UpSkillLv(int skillId, RPC.RPCForwardInfo fwd)
        {
            RPC.PackageWriter pkg = new RPC.PackageWriter();
            var sk    = SkillMgr.GetSkill(skillId);
            var sktpl = CSTable.SkillUtil.GetSkillTpl(skillId);

            if (sktpl == null)
            {
                pkg.Write((sbyte)eRet_UpSkillLv.NoSkill);
                pkg.DoReturnPlanes2Client(fwd);
                return;
            }
            if (sk == null)
            {
                //学习
                var sklvtpl = CSTable.SkillUtil.GetSkillLevelTpl(skillId, 1);
                if (sklvtpl == null)
                {
                    pkg.Write((sbyte)eRet_UpSkillLv.NoSkillLvTpl);
                    pkg.DoReturnPlanes2Client(fwd);
                    return;
                }
                sbyte result = (sbyte)eRet_UpSkillLv.Failure;
                switch ((CSCommon.eSkillType)sktpl.type)
                {
                case eSkillType.Active:
                    result = UpActiveSkill(sklvtpl);
                    break;

                case eSkillType.Cheats:    //秘籍通过副本开启
                    break;

                case eSkillType.BodyChannel:
                    result = UpBodyChannel(sklvtpl);
                    break;
                }
                if (result != (sbyte)eRet_UpSkillLv.Succeed)
                {
                    pkg.Write(result);
                    pkg.DoReturnPlanes2Client(fwd);
                    return;
                }
                SkillMgr.CreateSkillToBag(sklvtpl.id, (byte)sklvtpl.level);
            }
            else
            {
                //升级
                if (sk.Level >= PlayerData.RoleDetail.RoleLevel)
                {
                    pkg.Write((sbyte)eRet_UpSkillLv.LessRoleLv);
                    pkg.DoReturnPlanes2Client(fwd);
                    return;
                }
                if (sk.Level >= sk.Data.maxLv)
                {
                    pkg.Write((sbyte)eRet_UpSkillLv.MaxLv);
                    pkg.DoReturnPlanes2Client(fwd);
                    return;
                }
                //下级模板
                var sklvtpl = CSTable.SkillUtil.GetSkillLevelTpl(skillId, sk.Level + 1);
                if (sklvtpl == null)
                {
                    pkg.Write((sbyte)eRet_UpSkillLv.NoSkillLvTpl);
                    pkg.DoReturnPlanes2Client(fwd);
                    return;
                }
                sbyte result = (sbyte)eRet_UpSkillLv.Failure;
                switch ((CSCommon.eSkillType)sktpl.type)
                {
                case eSkillType.Active:
                case eSkillType.Hide:
                    result = UpActiveSkill(sklvtpl);
                    break;

                case eSkillType.Cheats:    //秘籍通过其他方法
                    break;

                case eSkillType.BodyChannel:
                    result = UpBodyChannel(sklvtpl);
                    break;
                }
                if (result != (sbyte)eRet_UpSkillLv.Succeed)
                {
                    pkg.Write(result);
                    pkg.DoReturnPlanes2Client(fwd);
                    return;
                }
                sk.Init(sklvtpl.id, (byte)sklvtpl.level);
                sk.SetOwner(this);
            }
            pkg.Write((sbyte)eRet_UpSkillLv.Succeed);
            pkg.DoReturnPlanes2Client(fwd);
        }
Exemplo n.º 4
0
 void Cast(string str)
 {
     SkillMgr.GetSkill(str).Cast();
 }