Ejemplo n.º 1
0
        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);
        }