Exemplo n.º 1
0
 public ActorStats(Lidgren.Network.NetIncomingMessage r)
 {
     life        = new Container(r);
     breath      = new FloatContainer(r);
     power       = new Container(r);
     share_power = r.ReadBoolean();
     ammo        = new Container(r);
     experience  = r.ReadInt32();
     level       = 1 + (int)Math.Pow(experience / 5, .5f);
     if (level > 1)
     {
         experience_to_level = new Container(experience - ((int)Math.Pow((level - 1), 2) * 5), ((int)Math.Pow((level), 2) * 5) - (int)Math.Pow((level - 1), 2) * 5);
     }
     else
     {
         experience_to_level = new Container(experience, (int)Math.Pow((level), 2) * 5);
     }
     complexity             = r.ReadInt32();
     armor                  = r.ReadString();
     jump_speed             = r.ReadSingle();
     run_speed              = r.ReadSingle();
     jump_max_time          = r.ReadSingle();
     jump_cur_time          = 0f;
     can_swim               = r.ReadBoolean();
     boyant                 = r.ReadBoolean();
     jump_can_resume        = r.ReadBoolean();
     life_regen             = r.ReadSingle();
     accum_life_regen       = 0f;
     ammo_regen             = r.ReadSingle();
     accum_ammo_regen       = 0f;
     energy_regen           = r.ReadSingle();
     accum_energy_regen     = 0f;
     water_jump_proficiency = r.ReadSingle();
     max_safe_fall          = r.ReadInt32();
 }
Exemplo n.º 2
0
 public ItemConnector(Lidgren.Network.NetIncomingMessage r)
 {
     conn_type   = (ItemConnectionType)r.ReadByte();
     target_type = (TargetType)r.ReadByte();
     target_id   = r.ReadInt32();
     data_one    = r.ReadInt32();
     data_two    = r.ReadInt32();
 }
Exemplo n.º 3
0
 public void Deserialize(ref Lidgren.Network.NetIncomingMessage buff)
 {
     _player  = (PLAYER)buff.ReadInt32();
     _obj     = (SIM_OBJ)buff.ReadInt32();
     _action  = (OBJ_ACTION)buff.ReadInt32();
     _pos[0]  = buff.ReadFloat();
     _pos[1]  = buff.ReadFloat();
     _angle   = buff.ReadFloat();
     _inst_id = buff.ReadInt32();
 }
Exemplo n.º 4
0
        public ItemPieceEnumeration(Lidgren.Network.NetIncomingMessage r)
        {
            itempiece_id = r.ReadInt32();
            loc          = new Point((int)r.ReadInt16(), (int)r.ReadInt16());
            rotation     = r.ReadByte();
            children     = new Dictionary <int, int>();
            int num_child = r.ReadInt32();

            for (int x = 0; x < num_child; x++)
            {
                children[r.ReadInt32()] = r.ReadInt32();
            }
        }
Exemplo n.º 5
0
        /// <summary>
        /// Updates our zonelist screen with required info
        /// </summary>
        /// <param name="msg">Incoming message</param>
        public void UpdateList(Lidgren.Network.NetIncomingMessage msg)
        {
            if (Zones.Count > 0)
            {
                foreach (string zname in Zones.Keys)
                {
                    oldZones.Add(zname);
                }
            }
            Zones.Clear();

            int count = msg.ReadInt32();

            for (int i = 0; i < count; i++)
            {
                ZoneSettings _zone = new ZoneSettings();
                _zone.ID          = msg.ReadInt64();
                _zone.Name        = msg.ReadString();
                _zone.Description = msg.ReadString();
                _zone.Address     = msg.ReadIPEndPoint();

                //Add it to our dictionary
                Zones.Add(_zone.Name, _zone);

                //Remove it from our old list
                if (oldZones.Contains(_zone.Name))
                {
                    oldZones.Remove(_zone.Name);
                }
            }

            UpdateButtons();
        }
Exemplo n.º 6
0
        public void ReadMe(Lidgren.Network.NetIncomingMessage msg)
        {
            EmmitingDirection   = msg.ReadVector();
            EmitingTime         = msg.ReadFloat();
            MinAngle            = msg.ReadFloat();
            MaxAngle            = msg.ReadFloat();
            MaxForce            = msg.ReadFloat();
            MinForce            = msg.ReadFloat();
            MaxLife             = msg.ReadFloat();
            MinLife             = msg.ReadFloat();
            MaxSize             = msg.ReadFloat();
            MinSize             = msg.ReadFloat();
            MaxRotation         = msg.ReadFloat();
            MinRotation         = msg.ReadFloat();
            MaxStartingRotation = msg.ReadFloat();
            MinStartingRotation = msg.ReadFloat();
            Delay          = msg.ReadFloat();
            SizeMultiplier = msg.ReadFloat();
            Amount         = msg.ReadInt32();
            FireAll        = msg.ReadBoolean();
            Infinite       = msg.ReadBoolean();
            Position       = msg.ReadVector();
            Direction      = msg.ReadVector();

            Factory = NetDataHelper.ReadParticleFactory(msg);
            IList <IControl> controls = NetDataHelper.ReadControls(msg);

            foreach (IControl control in controls)
            {
                AddControl(control);
            }
        }
Exemplo n.º 7
0
        public Item(Lidgren.Network.NetIncomingMessage r)
        {
            init_empty();
            item_name = r.ReadString();
            int num_sub_pieces = r.ReadInt32();

            for (int x = 0; x < num_sub_pieces; x++)
            {
                pieces.Add(new ItemPieceEnumeration(r));
            }
            construct_item(item_name);
        }
Exemplo n.º 8
0
        public void ReadObject(Lidgren.Network.NetIncomingMessage msg)
        {
            BulletFired    = msg.ReadFloat();
            BulletHit      = msg.ReadFloat();
            MineFired      = msg.ReadFloat();
            MineHit        = msg.ReadFloat();
            HookFired      = msg.ReadFloat();
            HookHit        = msg.ReadFloat();
            Healed         = msg.ReadFloat();
            GoldEarned     = msg.ReadFloat();
            DamageTaken    = msg.ReadFloat();
            DeadTime       = msg.ReadFloat();
            time           = msg.ReadFloat();
            PoweredActions = msg.ReadInt32();

            Actions = msg.ReadSpecialActions(Owner.SceneMgr);
            Stats   = msg.ReadStats();
        }
Exemplo n.º 9
0
        /// <summary>
        /// Deserialize the array from the message
        /// </summary>
        /// <param name="message"></param>
        public void OnDeserialize(Lidgren.Network.NetIncomingMessage message)
        {
            var length = message.ReadInt32();

            items = new T[length];

            for (int i = 0; i < length; i++)
            {
                var hasValue = true;
                if (PreserveIndex && !IsValueType)
                {
                    hasValue = message.ReadBoolean();
                }
                if (!hasValue)
                {
                    continue;
                }

                var t = new T();
                t.OnDeserialize(message);
                items[i] = t;
            }
        }
 public override void ReadObject(Lidgren.Network.NetIncomingMessage msg)
 {
     Color      = msg.ReadColor();
     RenderSize = msg.ReadInt32();
     Source     = new Uri(msg.ReadString());
 }
Exemplo n.º 11
0
 public Container(Lidgren.Network.NetIncomingMessage r)
 {
     max_val = r.ReadInt32();
     cur_val = r.ReadInt32();
     percent = (float)Math.Round((float)cur_val / (float)max_val, 3);
 }