Exemple #1
0
        internal void SendAddRoom(Game.Server.Rooms.BaseRoom room)
        {
            GSPacketIn pkg = new GSPacketIn((int)eFightPackageType.GAME_ROOM_CREATE);

            pkg.WriteInt(room.RoomId);
            pkg.WriteInt((int)room.GameType);
            pkg.WriteInt(room.Game.PlayerCount);

            List <GamePlayer> players = room.GetPlayersSafe();

            foreach (GamePlayer p in players)
            {
                pkg.WriteInt(p.PlayerCharacter.ID);//改为唯一ID
                pkg.WriteInt(p.PlayerCharacter.Attack);
                pkg.WriteInt(p.PlayerCharacter.Defence);
                pkg.WriteInt(p.PlayerCharacter.Agility);
                pkg.WriteInt(p.PlayerCharacter.Luck);
                pkg.WriteDouble(p.GetBaseAttack());
                pkg.WriteDouble(p.GetBaseDefence());
                pkg.WriteDouble(p.GetBaseAgility());
                pkg.WriteDouble(p.GetBaseBlood());
                pkg.WriteInt(p.CurrentWeapon.TemplateID);
            }
            SendTCP(pkg, room);
        }
Exemple #2
0
        public void SendAddRoom(BaseRoom room)
        {
            GSPacketIn gSPacketIn = new GSPacketIn(64);

            gSPacketIn.WriteInt(room.RoomId);
            gSPacketIn.WriteInt((int)room.GameType);
            gSPacketIn.WriteInt(room.GuildId);
            List <GamePlayer> players = room.GetPlayers();

            gSPacketIn.WriteInt(players.Count);
            foreach (GamePlayer current in players)
            {
                gSPacketIn.WriteInt(current.PlayerCharacter.ID);
                gSPacketIn.WriteString(current.PlayerCharacter.NickName);
                gSPacketIn.WriteBoolean(current.PlayerCharacter.Sex);
                gSPacketIn.WriteByte(current.PlayerCharacter.typeVIP);
                gSPacketIn.WriteInt(current.PlayerCharacter.VIPLevel);
                gSPacketIn.WriteInt(current.PlayerCharacter.Hide);
                gSPacketIn.WriteString(current.PlayerCharacter.Style);
                gSPacketIn.WriteString(current.PlayerCharacter.Colors);
                gSPacketIn.WriteString(current.PlayerCharacter.Skin);
                gSPacketIn.WriteInt(current.PlayerCharacter.Offer);
                gSPacketIn.WriteInt(current.PlayerCharacter.GP);
                gSPacketIn.WriteInt(current.PlayerCharacter.Grade);
                gSPacketIn.WriteInt(current.PlayerCharacter.Repute);
                gSPacketIn.WriteInt(current.PlayerCharacter.ConsortiaID);
                gSPacketIn.WriteString(current.PlayerCharacter.ConsortiaName);
                gSPacketIn.WriteInt(current.PlayerCharacter.ConsortiaLevel);
                gSPacketIn.WriteInt(current.PlayerCharacter.ConsortiaRepute);
                gSPacketIn.WriteInt(current.PlayerCharacter.badgeID);
                gSPacketIn.WriteString(current.PlayerCharacter.WeaklessGuildProgressStr);
                gSPacketIn.WriteInt(current.PlayerCharacter.Attack);
                gSPacketIn.WriteInt(current.PlayerCharacter.Defence);
                gSPacketIn.WriteInt(current.PlayerCharacter.Agility);
                gSPacketIn.WriteInt(current.PlayerCharacter.Luck);
                gSPacketIn.WriteInt(current.PlayerCharacter.hp);
                gSPacketIn.WriteInt(current.PlayerCharacter.FightPower);
                gSPacketIn.WriteBoolean(current.PlayerCharacter.IsMarried);
                if (current.PlayerCharacter.IsMarried)
                {
                    gSPacketIn.WriteInt(current.PlayerCharacter.SpouseID);
                    gSPacketIn.WriteString(current.PlayerCharacter.SpouseName);
                }
                gSPacketIn.WriteDouble(current.GetBaseAttack());
                gSPacketIn.WriteDouble(current.GetBaseDefence());
                gSPacketIn.WriteDouble(current.GetBaseAgility());
                gSPacketIn.WriteDouble(current.GetBaseBlood());
                gSPacketIn.WriteInt(current.MainWeapon.TemplateID);
                gSPacketIn.WriteBoolean(current.CanUseProp);
                if (current.SecondWeapon != null)
                {
                    gSPacketIn.WriteInt(current.SecondWeapon.TemplateID);
                    gSPacketIn.WriteInt(current.SecondWeapon.StrengthenLevel);
                }
                else
                {
                    gSPacketIn.WriteInt(0);
                    gSPacketIn.WriteInt(0);
                }
                gSPacketIn.WriteDouble((double)RateMgr.GetRate(eRateType.Experience_Rate) * AntiAddictionMgr.GetAntiAddictionCoefficient(current.PlayerCharacter.AntiAddiction) * ((current.GPAddPlus == 0.0) ? 1.0 : current.GPAddPlus));
                gSPacketIn.WriteDouble(AntiAddictionMgr.GetAntiAddictionCoefficient(current.PlayerCharacter.AntiAddiction) * ((current.OfferAddPlus == 0.0) ? 1.0 : current.OfferAddPlus));
                gSPacketIn.WriteDouble((double)RateMgr.GetRate(eRateType.Experience_Rate));
                gSPacketIn.WriteInt(GameServer.Instance.Configuration.ServerID);
                if (current.Pet == null)
                {
                    gSPacketIn.WriteInt(0);
                }
                else
                {
                    gSPacketIn.WriteInt(1);
                    gSPacketIn.WriteInt(current.Pet.Place);
                    gSPacketIn.WriteInt(current.Pet.TemplateID);
                    gSPacketIn.WriteInt(current.Pet.ID);
                    gSPacketIn.WriteString(current.Pet.Name);
                    gSPacketIn.WriteInt(current.Pet.UserID);
                    gSPacketIn.WriteInt(current.Pet.Level);
                    gSPacketIn.WriteString(current.Pet.Skill);
                    gSPacketIn.WriteString(current.Pet.SkillEquip);
                }
                List <AbstractBuffer> allBuffer = current.BufferList.GetAllBuffer();
                gSPacketIn.WriteInt(allBuffer.Count);
                foreach (AbstractBuffer current2 in allBuffer)
                {
                    BufferInfo info = current2.Info;
                    gSPacketIn.WriteInt(info.Type);
                    gSPacketIn.WriteBoolean(info.IsExist);
                    gSPacketIn.WriteDateTime(info.BeginDate);
                    gSPacketIn.WriteInt(info.ValidDate);
                    gSPacketIn.WriteInt(info.Value);
                    gSPacketIn.WriteInt(info.ValidCount);
                }
                gSPacketIn.WriteInt(current.EquipEffect.Count);
                foreach (ItemInfo current3 in current.EquipEffect)
                {
                    gSPacketIn.WriteInt(current3.TemplateID);
                    gSPacketIn.WriteInt(current3.Hole1);
                }
            }
            this.SendTCP(gSPacketIn);
        }
        public void SendAddRoom(BaseRoom room)
        {
            GSPacketIn pkg = new GSPacketIn(64);

            pkg.WriteInt(room.RoomId);
            pkg.WriteInt((int)room.GameType);
            pkg.WriteInt(room.GuildId);
            pkg.WriteInt(GameServer.Instance.Config.AreaID);
            pkg.WriteBoolean(room.IsArea);
            List <GamePlayer> players = room.GetPlayers();

            pkg.WriteInt(players.Count);
            foreach (GamePlayer p in players)
            {
                pkg.WriteInt(p.AreaID);
                pkg.WriteString(p.AreaName);
                pkg.WriteInt(p.PlayerCharacter.ID);
                pkg.WriteString(p.PlayerCharacter.NickName);
                pkg.WriteBoolean(p.PlayerCharacter.Sex);
                pkg.WriteInt(p.PlayerCharacter.Hide);
                pkg.WriteString(p.PlayerCharacter.Style);
                pkg.WriteString(p.PlayerCharacter.Colors);
                pkg.WriteString(p.PlayerCharacter.Skin);
                pkg.WriteInt(p.PlayerCharacter.Offer);
                pkg.WriteInt(p.PlayerCharacter.GP);
                pkg.WriteInt(p.PlayerCharacter.Grade);
                pkg.WriteInt(p.PlayerCharacter.Repute);
                pkg.WriteInt(p.PlayerCharacter.Nimbus);
                pkg.WriteInt(p.PlayerCharacter.ConsortiaID);
                pkg.WriteString(p.PlayerCharacter.ConsortiaName);
                pkg.WriteInt(p.PlayerCharacter.ConsortiaLevel);
                pkg.WriteInt(p.PlayerCharacter.ConsortiaRepute);
                pkg.WriteInt(p.PlayerCharacter.Win);
                pkg.WriteInt(p.PlayerCharacter.Total);
                pkg.WriteInt(p.PlayerCharacter.Attack);
                pkg.WriteInt(p.PlayerCharacter.Defence);
                pkg.WriteInt(p.PlayerCharacter.Agility);
                pkg.WriteInt(p.PlayerCharacter.Luck);
                pkg.WriteInt(p.PlayerCharacter.FightPower);
                pkg.WriteBoolean(p.PlayerCharacter.IsMarried);
                if (p.PlayerCharacter.IsMarried)
                {
                    pkg.WriteInt(p.PlayerCharacter.SpouseID);
                    pkg.WriteString(p.PlayerCharacter.SpouseName);
                }
                pkg.WriteDouble(p.GetBaseAttack());
                pkg.WriteDouble(p.GetBaseDefence());
                pkg.WriteDouble(p.GetBaseAgility());
                pkg.WriteDouble(p.GetBaseBlood());
                if (p.MainWeapon != null)
                {
                    pkg.WriteInt(p.MainWeapon.TemplateID);
                }
                else
                {
                    pkg.WriteInt(0);
                }
                pkg.WriteBoolean(p.CanUseProp);
                if (p.SecondWeapon != null)
                {
                    pkg.WriteInt(p.SecondWeapon.TemplateID);
                    pkg.WriteInt(p.SecondWeapon.StrengthenLevel);
                }
                else
                {
                    pkg.WriteInt(0);
                    pkg.WriteInt(0);
                }
                pkg.WriteDouble(p.GPAddPlus);
                pkg.WriteFloat(p.GMExperienceRate);
                pkg.WriteFloat(p.AuncherExperienceRate);
                pkg.WriteDouble(p.OfferAddPlus);
                pkg.WriteFloat(p.GMOfferRate);
                pkg.WriteFloat(p.AuncherOfferRate);
                pkg.WriteFloat(p.GMRichesRate);
                pkg.WriteFloat(p.AuncherRichesRate);
                pkg.WriteDouble(p.AntiAddictionRate);
                List <AbstractBuffer> infos = p.BufferList.GetAllBuffer();
                pkg.WriteInt(infos.Count);
                foreach (AbstractBuffer bufferInfo in infos)
                {
                    BufferInfo info = bufferInfo.Info;
                    pkg.WriteInt(info.Type);
                    pkg.WriteBoolean(info.IsExist);
                    pkg.WriteDateTime(info.BeginDate);
                    pkg.WriteInt(info.ValidDate);
                    pkg.WriteInt(info.Value);
                }
                pkg.WriteInt(p.EquipEffect.Count);
                foreach (int i in p.EquipEffect)
                {
                    pkg.WriteInt(i);
                }
            }
            this.SendTCP(pkg);
        }
        public void SendAddRoom(Game.Server.Rooms.BaseRoom room)
        {
            GSPacketIn pkg = new GSPacketIn((int)eFightPackageType.ROOM_CREATE);

            pkg.WriteInt(room.RoomId);
            pkg.WriteInt((int)room.GameType);
            pkg.WriteInt(room.GuildId);

            List <GamePlayer> players = room.GetPlayers();

            pkg.WriteInt(players.Count);
            foreach (GamePlayer p in players)
            {
                pkg.WriteInt(p.PlayerCharacter.ID);//改为唯一ID
                pkg.WriteString(p.PlayerCharacter.NickName);
                pkg.WriteBoolean(p.PlayerCharacter.Sex);

                pkg.WriteInt(p.PlayerCharacter.Hide);
                pkg.WriteString(p.PlayerCharacter.Style);
                pkg.WriteString(p.PlayerCharacter.Colors);
                pkg.WriteString(p.PlayerCharacter.Skin);
                pkg.WriteInt(p.PlayerCharacter.Offer);
                pkg.WriteInt(p.PlayerCharacter.GP);
                pkg.WriteInt(p.PlayerCharacter.Grade);
                pkg.WriteInt(p.PlayerCharacter.Repute);
                pkg.WriteInt(p.PlayerCharacter.ConsortiaID);
                pkg.WriteString(p.PlayerCharacter.ConsortiaName);
                pkg.WriteInt(p.PlayerCharacter.ConsortiaLevel);
                pkg.WriteInt(p.PlayerCharacter.ConsortiaRepute);

                pkg.WriteInt(p.PlayerCharacter.Attack);
                pkg.WriteInt(p.PlayerCharacter.Defence);
                pkg.WriteInt(p.PlayerCharacter.Agility);
                pkg.WriteInt(p.PlayerCharacter.Luck);
                pkg.WriteDouble(p.GetBaseAttack());
                pkg.WriteDouble(p.GetBaseDefence());
                pkg.WriteDouble(p.GetBaseAgility());
                pkg.WriteDouble(p.GetBaseBlood());
                pkg.WriteInt(p.MainWeapon.TemplateID);
                pkg.WriteBoolean(p.CanUseProp);
                if (p.SecondWeapon != null)
                {
                    pkg.WriteInt(p.SecondWeapon.TemplateID);
                    pkg.WriteInt(p.SecondWeapon.StrengthenLevel);
                }
                else
                {
                    pkg.WriteInt(0);
                    pkg.WriteInt(0);
                }
                pkg.WriteDouble(RateMgr.GetRate(eRateType.Experience_Rate) * AntiAddictionMgr.GetAntiAddictionCoefficient(p.PlayerCharacter.AntiAddiction) * (p.GPAddPlus == 0 ? 1 : p.GPAddPlus));
                pkg.WriteDouble(AntiAddictionMgr.GetAntiAddictionCoefficient(p.PlayerCharacter.AntiAddiction) * (p.OfferAddPlus == 0 ? 1 : p.OfferAddPlus));
                pkg.WriteDouble(RateMgr.GetRate(eRateType.Experience_Rate));
                pkg.WriteInt(GameServer.Instance.Configuration.ServerID);


                List <AbstractBuffer> infos = p.BufferList.GetAllBuffer();
                pkg.WriteInt(infos.Count);
                foreach (AbstractBuffer bufferInfo in infos)
                {
                    BufferInfo info = bufferInfo.Info;
                    pkg.WriteInt(info.Type);
                    pkg.WriteBoolean(info.IsExist);
                    pkg.WriteDateTime(info.BeginDate);
                    pkg.WriteInt(info.ValidDate);
                    pkg.WriteInt(info.Value);
                }

                pkg.WriteInt(p.EquipEffect.Count);
                foreach (int i in p.EquipEffect)
                {
                    pkg.WriteInt(i);
                }
            }
            SendTCP(pkg);
        }