public HFloorItem(HPacket packet) { Id = packet.ReadInt32(); TypeId = packet.ReadInt32(); var tile = new HPoint(packet.ReadInt32(), packet.ReadInt32()); Facing = (HDirection)packet.ReadInt32(); tile.Z = double.Parse(packet.ReadUTF8(), CultureInfo.InvariantCulture); Tile = tile; packet.ReadUTF8(); packet.ReadInt32(); Category = packet.ReadInt32(); Stuff = ReadData(packet, Category); SecondsToExpiration = packet.ReadInt32(); UsagePolicy = packet.ReadInt32(); OwnerId = packet.ReadInt32(); if (TypeId < 0) { packet.ReadUTF8(); } }
public HWallItem(HPacket packet) { Id = int.Parse(packet.ReadUTF8()); TypeId = packet.ReadInt32(); Location = packet.ReadUTF8(); Data = packet.ReadUTF8(); SecondsToExpiration = packet.ReadInt32(); UsagePolicy = packet.ReadInt32(); OwnerId = packet.ReadInt32(); if (float.TryParse(Data, out float fResult)) { State = int.Parse(Data); } string[] locations = Location.Split(' '); if (Location.IndexOf(":") == 0 && locations.Length >= 3) // False { Placement = locations[2]; if (locations[0].Length <= 3 || locations[1].Length <= 2) { return; } string firstLoc = locations[0].Substring(3); string secondLoc = locations[1].Substring(2); locations = firstLoc.Split(','); if (locations.Length >= 2) { Global = new HPoint(int.Parse(locations[0]), int.Parse(locations[1])); locations = secondLoc.Split(','); if (locations.Length >= 2) { Local = new HPoint(int.Parse(locations[0]), int.Parse(locations[1])); } } } else if (locations.Length >= 2) // True { Placement = locations[0]; if (Placement == "rightwall" || Placement == "frontwall") { Placement = "r"; } else { Placement = "l"; } string[] coords = locations[1].Split(','); if (coords.Length >= 3) { Y = float.Parse(coords[0]); Z = float.Parse(coords[1]); } } }
public HEntityUpdate(HPacket packet) { Index = packet.ReadInt32(); Tile = new HPoint(packet.ReadInt32(), packet.ReadInt32(), double.Parse(packet.ReadUTF8(), CultureInfo.InvariantCulture)); HeadFacing = (HDirection)packet.ReadInt32(); BodyFacing = (HDirection)packet.ReadInt32(); string action = packet.ReadUTF8(); string[] actionData = action.Split(new[] { '/' }, StringSplitOptions.RemoveEmptyEntries); foreach (string actionInfo in actionData) { string[] actionValues = actionInfo.Split(' '); if (actionValues.Length < 2) { continue; } if (string.IsNullOrWhiteSpace(actionValues[0])) { continue; } switch (actionValues[0]) { case "flatctrl": { IsController = true; break; } case "mv": { string[] values = actionValues[1].Split(','); if (values.Length >= 3) { MovingTo = new HPoint(int.Parse(values[0]), int.Parse(values[1]), double.Parse(values[2], CultureInfo.InvariantCulture)); } Action = HAction.Move; break; } case "sit": { Action = HAction.Sit; Stance = HStance.Sit; break; } case "lay": { Action = HAction.Lay; Stance = HStance.Lay; break; } case "sign": { Sign = (HSign)int.Parse(actionValues[1]); Action = HAction.Sign; break; } } } }