Пример #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);
        }
Пример #2
0
        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);
            }
        }
Пример #3
0
        public void HandleGameRoomCreate(GSPacketIn pkg)
        {
            int  totalLevel      = 0;
            int  totalFightPower = 0;
            int  roomId          = pkg.ReadInt();
            int  gameType        = pkg.ReadInt();
            int  guildId         = pkg.ReadInt();
            int  areaId          = pkg.ReadInt();
            bool IsArea          = pkg.ReadBoolean();
            int  count           = pkg.ReadInt();

            IGamePlayer[] players = new IGamePlayer[count];
            for (int i = 0; i < count; i++)
            {
                PlayerInfo      info            = new PlayerInfo();
                ProxyPlayerInfo proxyPlayerInfo = new ProxyPlayerInfo();
                proxyPlayerInfo.m_AreaID   = pkg.ReadInt();
                proxyPlayerInfo.m_AreaName = pkg.ReadString();
                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.Nimbus          = pkg.ReadInt();
                info.ConsortiaID     = pkg.ReadInt();
                info.ConsortiaName   = pkg.ReadString();
                info.ConsortiaLevel  = pkg.ReadInt();
                info.ConsortiaRepute = pkg.ReadInt();
                info.Win             = pkg.ReadInt();
                info.Total           = pkg.ReadInt();
                info.Attack          = pkg.ReadInt();
                info.Defence         = pkg.ReadInt();
                info.Agility         = pkg.ReadInt();
                info.Luck            = pkg.ReadInt();
                info.FightPower      = pkg.ReadInt();
                info.IsMarried       = pkg.ReadBoolean();
                if (info.IsMarried)
                {
                    info.SpouseID   = pkg.ReadInt();
                    info.SpouseName = pkg.ReadString();
                }
                totalFightPower                      += info.FightPower;
                proxyPlayerInfo.BaseAttack            = pkg.ReadDouble();
                proxyPlayerInfo.BaseDefence           = pkg.ReadDouble();
                proxyPlayerInfo.BaseAgility           = pkg.ReadDouble();
                proxyPlayerInfo.BaseBlood             = pkg.ReadDouble();
                proxyPlayerInfo.TemplateId            = pkg.ReadInt();
                proxyPlayerInfo.CanUserProp           = pkg.ReadBoolean();
                proxyPlayerInfo.SecondWeapon          = pkg.ReadInt();
                proxyPlayerInfo.StrengthLevel         = pkg.ReadInt();
                proxyPlayerInfo.GPAddPlus             = pkg.ReadDouble();
                proxyPlayerInfo.GMExperienceRate      = pkg.ReadFloat();
                proxyPlayerInfo.AuncherExperienceRate = pkg.ReadFloat();
                proxyPlayerInfo.OfferAddPlus          = pkg.ReadDouble();
                proxyPlayerInfo.GMOfferRate           = pkg.ReadFloat();
                proxyPlayerInfo.AuncherOfferRate      = pkg.ReadFloat();
                proxyPlayerInfo.GMRichesRate          = pkg.ReadFloat();
                proxyPlayerInfo.AuncherRichesRate     = pkg.ReadFloat();
                proxyPlayerInfo.AntiAddictionRate     = pkg.ReadDouble();
                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, proxyPlayerInfo, infos);
                players[i].CanUseProp = proxyPlayerInfo.CanUserProp;
                int ec = pkg.ReadInt();
                for (int j = 0; j < ec; j++)
                {
                    players[i].EquipEffect.Add(pkg.ReadInt());
                }
                totalLevel += info.Grade;
            }
            if (players.Length != 0)
            {
                ProxyRoom room = new ProxyRoom(ProxyRoomMgr.NextRoomId(), roomId, players, this, totalLevel, totalFightPower, IsArea);
                room.GuildId  = guildId;
                room.AreaID   = areaId;
                room.GameType = (eGameType)gameType;
                ProxyRoom oldroom = null;
                Dictionary <int, ProxyRoom> rooms;
                Monitor.Enter(rooms = this.m_rooms);
                try
                {
                    if (this.m_rooms.ContainsKey(roomId))
                    {
                        oldroom = this.m_rooms[roomId];
                        this.m_rooms.Remove(roomId);
                    }
                }
                finally
                {
                    Monitor.Exit(rooms);
                }
                if (oldroom != null)
                {
                    ProxyRoomMgr.RemoveRoom(oldroom);
                }
                Monitor.Enter(rooms = this.m_rooms);
                try
                {
                    if (!this.m_rooms.ContainsKey(roomId))
                    {
                        this.m_rooms.Add(roomId, room);
                        this.SendFightRoomID(roomId, room.RoomId);
                    }
                    else
                    {
                        room = null;
                    }
                }
                finally
                {
                    Monitor.Exit(rooms);
                }
                if (room != null)
                {
                    ProxyRoomMgr.AddRoom(room);
                }
                else
                {
                    ServerClient.log.ErrorFormat("Room already exists:{0}", roomId);
                }
            }
        }
Пример #4
0
        public void HandleGameRoomCreate(GSPacketIn pkg)
        {
            int num      = pkg.ReadInt();
            int gameType = pkg.ReadInt();
            int guildId  = pkg.ReadInt();
            int num2     = pkg.ReadInt();
            int num3     = 0;

            IGamePlayer[] array = new IGamePlayer[num2];
            for (int i = 0; i < num2; i++)
            {
                PlayerInfo playerInfo = new PlayerInfo();
                playerInfo.ID                    = pkg.ReadInt();
                playerInfo.NickName              = pkg.ReadString();
                playerInfo.Sex                   = pkg.ReadBoolean();
                playerInfo.typeVIP               = pkg.ReadByte();
                playerInfo.VIPLevel              = pkg.ReadInt();
                playerInfo.Hide                  = pkg.ReadInt();
                playerInfo.Style                 = pkg.ReadString();
                playerInfo.Colors                = pkg.ReadString();
                playerInfo.Skin                  = pkg.ReadString();
                playerInfo.Offer                 = pkg.ReadInt();
                playerInfo.GP                    = pkg.ReadInt();
                playerInfo.Grade                 = pkg.ReadInt();
                playerInfo.Repute                = pkg.ReadInt();
                playerInfo.ConsortiaID           = pkg.ReadInt();
                playerInfo.ConsortiaName         = pkg.ReadString();
                playerInfo.ConsortiaLevel        = pkg.ReadInt();
                playerInfo.ConsortiaRepute       = pkg.ReadInt();
                playerInfo.badgeID               = pkg.ReadInt();
                playerInfo.weaklessGuildProgress = Base64.decodeToByteArray(pkg.ReadString());
                playerInfo.Attack                = pkg.ReadInt();
                playerInfo.Defence               = pkg.ReadInt();
                playerInfo.Agility               = pkg.ReadInt();
                playerInfo.Luck                  = pkg.ReadInt();
                playerInfo.hp                    = pkg.ReadInt();
                playerInfo.FightPower            = pkg.ReadInt();
                playerInfo.IsMarried             = pkg.ReadBoolean();
                if (playerInfo.IsMarried)
                {
                    playerInfo.SpouseID   = pkg.ReadInt();
                    playerInfo.SpouseName = pkg.ReadString();
                }
                ProxyPlayerInfo proxyPlayerInfo = new ProxyPlayerInfo();
                proxyPlayerInfo.BaseAttack        = pkg.ReadDouble();
                proxyPlayerInfo.BaseDefence       = pkg.ReadDouble();
                proxyPlayerInfo.BaseAgility       = pkg.ReadDouble();
                proxyPlayerInfo.BaseBlood         = pkg.ReadDouble();
                proxyPlayerInfo.TemplateId        = pkg.ReadInt();
                proxyPlayerInfo.CanUserProp       = pkg.ReadBoolean();
                proxyPlayerInfo.SecondWeapon      = pkg.ReadInt();
                proxyPlayerInfo.StrengthLevel     = pkg.ReadInt();
                proxyPlayerInfo.GPAddPlus         = pkg.ReadDouble();
                proxyPlayerInfo.OfferAddPlus      = pkg.ReadDouble();
                proxyPlayerInfo.AntiAddictionRate = pkg.ReadDouble();
                proxyPlayerInfo.ServerId          = pkg.ReadInt();
                UsersPetinfo usersPetinfo = new UsersPetinfo();
                int          num4         = pkg.ReadInt();
                if (num4 == 1)
                {
                    usersPetinfo.Place      = pkg.ReadInt();
                    usersPetinfo.TemplateID = pkg.ReadInt();
                    usersPetinfo.ID         = pkg.ReadInt();
                    usersPetinfo.Name       = pkg.ReadString();
                    usersPetinfo.UserID     = pkg.ReadInt();
                    usersPetinfo.Level      = pkg.ReadInt();
                    usersPetinfo.Skill      = pkg.ReadString();
                    usersPetinfo.SkillEquip = pkg.ReadString();
                }
                else
                {
                    usersPetinfo = null;
                }
                List <BufferInfo> list = new List <BufferInfo>();
                int num5 = pkg.ReadInt();
                for (int j = 0; j < num5; j++)
                {
                    BufferInfo bufferInfo = new BufferInfo();
                    bufferInfo.Type       = pkg.ReadInt();
                    bufferInfo.IsExist    = pkg.ReadBoolean();
                    bufferInfo.BeginDate  = pkg.ReadDateTime();
                    bufferInfo.ValidDate  = pkg.ReadInt();
                    bufferInfo.Value      = pkg.ReadInt();
                    bufferInfo.ValidCount = pkg.ReadInt();
                    if (playerInfo != null)
                    {
                        list.Add(bufferInfo);
                    }
                }
                List <ItemInfo> list2 = new List <ItemInfo>();
                int             num6  = pkg.ReadInt();
                for (int k = 0; k < num6; k++)
                {
                    int      templateId = pkg.ReadInt();
                    int      hole       = pkg.ReadInt();
                    ItemInfo itemInfo   = ItemInfo.CreateFromTemplate(ItemMgr.FindItemTemplate(templateId), 1, 1);
                    itemInfo.Hole1 = hole;
                    list2.Add(itemInfo);
                }
                array[i]            = new ProxyPlayer(this, playerInfo, proxyPlayerInfo, usersPetinfo, list, list2);
                array[i].CanUseProp = proxyPlayerInfo.CanUserProp;
                num3 += playerInfo.Grade;
            }
            ProxyRoom proxyRoom = new ProxyRoom(ProxyRoomMgr.NextRoomId(), num, array, this);

            proxyRoom.GuildId  = guildId;
            proxyRoom.GameType = (eGameType)gameType;
            Dictionary <int, ProxyRoom> rooms;

            Monitor.Enter(rooms = this.m_rooms);
            try
            {
                if (!this.m_rooms.ContainsKey(num))
                {
                    this.m_rooms.Add(num, proxyRoom);
                }
                else
                {
                    proxyRoom = null;
                }
            }
            finally
            {
                Monitor.Exit(rooms);
            }
            if (proxyRoom != null)
            {
                ProxyRoomMgr.AddRoom(proxyRoom);
                return;
            }
            ServerClient.log.ErrorFormat("Room already exists:{0}", num);
        }