Exemple #1
0
        public void HandleGameRoomCreate(GSPacketIn pkg)
        {
            int roomId = pkg.ReadInt();
            int gameType = pkg.ReadInt();
            int count = pkg.ReadInt();

            IGamePlayer[] players = new IGamePlayer[count];
            for (int i = 0; i < count; i++)
            {
                PlayerInfo info = new PlayerInfo();
                info.ID = pkg.ReadInt();
                info.Attack = pkg.ReadInt();
                info.Defence = pkg.ReadInt();
                info.Agility = pkg.ReadInt();
                info.Luck = pkg.ReadInt();

                double baseAttack = pkg.ReadDouble();
                double baseDefence = pkg.ReadDouble();
                double baseAgility = pkg.ReadDouble();
                double baseBlood = pkg.ReadDouble();
                int templateId = pkg.ReadInt();

                ItemTemplateInfo itemTemplate = ItemMgr.FindItemTemplate(templateId);
                ItemInfo item = new ItemInfo(itemTemplate);

                players[i] = new ProxyPlayer(info, item, baseAttack, baseDefence, baseAgility, baseBlood);
            }

            ProxyRoomMgr.CreateRoom(players, roomId, this);
        }
        public void HandleGameRoomCreate(GSPacketIn pkg)
        {
            int roomId = pkg.ReadInt();
            int gameType = pkg.ReadInt();
            int guildId = pkg.ReadInt();

            int count = pkg.ReadInt();
            int totalLevel = 0;
            IGamePlayer[] players = new IGamePlayer[count];
            for (int i = 0; i < count; i++)
            {
                PlayerInfo info = new PlayerInfo();
                info.ID = pkg.ReadInt();
                info.NickName = pkg.ReadString();
                info.Sex = pkg.ReadBoolean();
                info.Hide = pkg.ReadInt();
                info.Style = pkg.ReadString();
                info.Colors = pkg.ReadString();
                info.Skin = pkg.ReadString();
                info.Offer = pkg.ReadInt();
                info.GP = pkg.ReadInt();
                info.Grade = pkg.ReadInt();
                info.Repute = pkg.ReadInt();
                info.ConsortiaID = pkg.ReadInt();
                info.ConsortiaName = pkg.ReadString();
                info.ConsortiaLevel = pkg.ReadInt();
                info.ConsortiaRepute = pkg.ReadInt();

                info.Attack = pkg.ReadInt();
                info.Defence = pkg.ReadInt();
                info.Agility = pkg.ReadInt();
                info.Luck = pkg.ReadInt();

                double baseAttack = pkg.ReadDouble();
                double baseDefence = pkg.ReadDouble();
                double baseAgility = pkg.ReadDouble();
                double baseBlood = pkg.ReadDouble();
                int templateId = pkg.ReadInt();
                bool canUserProp = pkg.ReadBoolean();
                int secondWeapon = pkg.ReadInt();
                int strengthLevel = pkg.ReadInt();


                double gprate = pkg.ReadDouble();
                double offerrate = pkg.ReadDouble();
                double rate = pkg.ReadDouble();
                int serverid = pkg.ReadInt();

                ItemTemplateInfo itemTemplate = ItemMgr.FindItemTemplate(templateId);
                ItemInfo item = null;
                if (secondWeapon != 0)
                {
                    ItemTemplateInfo secondWeaponTemp = ItemMgr.FindItemTemplate(secondWeapon);
                    item = ItemInfo.CreateFromTemplate(secondWeaponTemp, 1, 1);
                    item.StrengthenLevel = strengthLevel;
                }

                List<BufferInfo> infos = new List<BufferInfo>();

                int buffercout = pkg.ReadInt();
                for (int j = 0; j < buffercout; j++)
                {
                    BufferInfo buffinfo = new BufferInfo();
                    buffinfo.Type = pkg.ReadInt();
                    buffinfo.IsExist = pkg.ReadBoolean();
                    buffinfo.BeginDate = pkg.ReadDateTime();
                    buffinfo.ValidDate = pkg.ReadInt();
                    buffinfo.Value = pkg.ReadInt();
                    if (info != null)
                        infos.Add(buffinfo);
                }

                players[i] = new ProxyPlayer(this, info, itemTemplate, item, baseAttack, baseDefence, baseAgility, baseBlood, gprate, offerrate, rate, infos, serverid);
                players[i].CanUseProp = canUserProp;

                int ec = pkg.ReadInt();
                for (int j = 0; j < ec; j++)
                {
                    players[i].EquipEffect.Add(pkg.ReadInt());
                }
                totalLevel += info.Grade;
            }

            ProxyRoom room = new ProxyRoom(ProxyRoomMgr.NextRoomId(), roomId, players, this);
            room.GuildId = guildId;
            room.GameType = (eGameType)gameType;

            lock (m_rooms)
            {
                if (!m_rooms.ContainsKey(roomId))
                {
                    m_rooms.Add(roomId, room);
                }
                else
                {
                    room = null;
                }
            }

            if (room != null)
            {
                ProxyRoomMgr.AddRoom(room);
            }
            else
            {
                log.ErrorFormat("Room already exists:{0}", roomId);
            }
        }