Exemplo n.º 1
0
        public static void GetProp(KBEngine.Packet g)
        {
            var pinfo   = ServerData.Instance.playerInfo;
            var getChar = g.protoBody as CGGetCharacterInfo;
            var au      = GCGetCharacterInfo.CreateBuilder();

            foreach (var k in getChar.ParamKeyList)
            {
                var att = RolesAttributes.CreateBuilder();
                var bd  = BasicData.CreateBuilder();
                att.AttrKey = k;
                bd.Indicate = 1;
                if (k == (int)CharAttribute.CharAttributeEnum.LEVEL)
                {
                    bd.TheInt32 = pinfo.Roles.Level;
                }
                else if (k == (int)CharAttribute.CharAttributeEnum.EXP)
                {
                    bd.TheInt32 = pinfo.Exp;
                }
                else if (k == (int)CharAttribute.CharAttributeEnum.GOLD_COIN)
                {
                    bd.TheInt32 = pinfo.Gold;
                }
                else if (k == (int)CharAttribute.CharAttributeEnum.JING_SHI)
                {
                    bd.TheInt32 = pinfo.JingShi;
                }
                att.BasicData = bd.Build();
                au.AddAttributes(att);
            }

            ServerBundle.SendImmediate(au, g.flowId);
        }
Exemplo n.º 2
0
        public static void UserDressEquip(KBEngine.Packet packet)
        {
            var inpb  = packet.protoBody as CGUserDressEquip;
            var pinfo = ServerData.Instance.playerInfo;

            PackInfo oldEquip = null;

            if (inpb.DestEquipId != 0)
            {
                foreach (var p in pinfo.DressInfoList)
                {
                    if (p.PackEntry.Id == inpb.DestEquipId)
                    {
                        oldEquip = p;
                        pinfo.DressInfoList.Remove(oldEquip);
                        break;
                    }
                }
            }
            PackInfo newEquip = null;

            if (inpb.SrcEquipId != 0)
            {
                foreach (var p in pinfo.PackInfoList)
                {
                    if (p.PackEntry.Id == inpb.SrcEquipId)
                    {
                        newEquip = p;
                        RemoveEquipFromPackage(inpb.SrcEquipId);
                        break;
                    }
                }
            }

            if (oldEquip != null)
            {
                PutEquipInPackage(oldEquip);
            }
            Log.Net("PutEquipInPackage " + oldEquip.PackEntry.Id);

            var newEquip2 = PackInfo.CreateBuilder(newEquip);

            newEquip2.PackEntry.Count = 1;

            pinfo.DressInfoList.Add(newEquip2.Build());

            var au = GCUserDressEquip.CreateBuilder();

            au.DressEquip = newEquip.PackEntry;
            if (oldEquip != null)
            {
                au.PackEquip = oldEquip.PackEntry;
            }
            ServerBundle.SendImmediate(au, packet.flowId);
        }
Exemplo n.º 3
0
        public static void CreateCharacter(KBEngine.Packet packet)
        {
            var inpb = packet.protoBody as CGCreateCharacter;
            var au   = GCCreateCharacter.CreateBuilder();
            var role = RolesInfo.CreateBuilder();

            role.Name     = inpb.PlayerName;
            role.PlayerId = 100;
            //playerId++;
            role.Level = 1;
            role.Job   = inpb.Job;

            var msg = role.Build();

            ServerData.Instance.playerInfo.Roles = RolesInfo.CreateBuilder(msg).Build();

            var dress = new int[]
            {
                97, 68, 69, 70, 71, 72,
            };
            int id    = 1;
            var pinfo = ServerData.Instance.playerInfo;

            foreach (var d in dress)
            {
                var pkinfo  = PackInfo.CreateBuilder();
                var pkEntry = PackEntry.CreateBuilder();
                pkEntry.Id        = id++;
                pkEntry.BaseId    = d;
                pkEntry.GoodsType = 1;
                pkEntry.Level     = 1;
                pkinfo.PackEntry  = pkEntry.Build();
                pinfo.AddDressInfo(pkinfo);
            }

            var cinfo = GCCopyInfo.CreateBuilder();
            var cin   = CopyInfo.CreateBuilder();

            cin.Id     = 209;
            cin.IsPass = true;
            cinfo.AddCopyInfo(cin);
            var msg2 = cinfo.Build();

            pinfo.CopyInfos = msg2;

            au.AddRolesInfos(msg);
            ServerBundle.SendImmediate(au, packet.flowId);

            //投掷 跳跃
            pinfo.Roles.Level = 10;
            AddSkillPoint(10);
            LevelUpSkill(3);
            LevelUpSkill(4);
        }
Exemplo n.º 4
0
        public static void LoadPackInfo(KBEngine.Packet packet)
        {
            var inpb = packet.protoBody as CGLoadPackInfo;
            var au   = GCLoadPackInfo.CreateBuilder();

            if (inpb.PackType == PackType.DEFAULT_PACK)
            {
                au.PackType = PackType.DEFAULT_PACK;
                var pkInfo = ServerData.Instance.playerInfo.PackInfoList;
                au.AddRangePackInfo(pkInfo);
            }
            else if (inpb.PackType == PackType.DRESSED_PACK)
            {
                au.PackType = PackType.DRESSED_PACK;
                var pkInfo = ServerData.Instance.playerInfo.DressInfoList;
                au.AddRangePackInfo(pkInfo);
            }
            ServerBundle.SendImmediate(au, packet.flowId);
        }
Exemplo n.º 5
0
        public static void GetKeyValue(KBEngine.Packet packet)
        {
            var  playerInfo = ServerData.Instance.playerInfo;
            var  inpb       = packet.protoBody as CGGetKeyValue;
            var  key        = inpb.Key;
            var  get        = GCGetKeyValue.CreateBuilder();
            bool find       = false;

            foreach (var kv1 in playerInfo.GameStateList)
            {
                if (kv1.Key == key)
                {
                    get.Value = kv1.Value;
                    find      = true;
                    break;
                }
            }
            if (!find)
            {
                get.Value = "";
            }
            ServerBundle.SendImmediate(get, packet.flowId);
        }
Exemplo n.º 6
0
        public static void GetShortCuts(KBEngine.Packet packet)
        {
            var au    = GCLoadShortcutsInfo.CreateBuilder();
            var pinfo = ServerData.Instance.playerInfo;

            if (pinfo.HasSkill)
            {
                var defaultSlot = GetShortCutsInfo();
                int ind         = 0;
                foreach (var sk in defaultSlot)
                {
                    if (sk != 0)
                    {
                        var sh = ShortCutInfo.CreateBuilder();
                        sh.Index  = ind;
                        sh.BaseId = sk;
                        au.AddShortCutInfo(sh);
                    }
                    ind++;
                }
            }
            ServerBundle.SendImmediate(au, packet.flowId);
        }