// Token: 0x060026B7 RID: 9911 RVA: 0x000E54EC File Offset: 0x000E38EC private IEnumerator teleport() { yield return(new WaitForSeconds(3f)); if (this.target != null) { ZombieSoulTeleporter.nearbyPlayers.Clear(); PlayerTool.getPlayersInRadius(base.transform.position, this.sqrRadius, ZombieSoulTeleporter.nearbyPlayers); for (int i = 0; i < ZombieSoulTeleporter.nearbyPlayers.Count; i++) { Player player = ZombieSoulTeleporter.nearbyPlayers[i]; if (!player.life.isDead) { short num; short num2; if (player.quests.getFlag(211, out num) && num == 1 && player.quests.getFlag(212, out num2) && num2 == 1 && player.quests.getQuestStatus(213) != ENPCQuestStatus.COMPLETED) { player.quests.sendSetFlag(214, 0); player.quests.sendAddQuest(213); player.sendTeleport(this.targetBoss.position, MeasurementTool.angleToByte(this.targetBoss.rotation.eulerAngles.y)); } else { player.sendTeleport(this.target.position, MeasurementTool.angleToByte(this.target.rotation.eulerAngles.y)); if (player.equipment.isSelected) { player.equipment.dequip(); } player.equipment.canEquip = false; } } } } yield break; }
public static void transformStructure(Transform structure, Vector3 point, float angle_x, float angle_y, float angle_z) { angle_x = (float)(Mathf.RoundToInt(angle_x / 2f) * 2); angle_y = (float)(Mathf.RoundToInt(angle_y / 2f) * 2); angle_z = (float)(Mathf.RoundToInt(angle_z / 2f) * 2); byte b; byte b2; ushort num; StructureRegion structureRegion; StructureDrop structureDrop; if (StructureManager.tryGetInfo(structure, out b, out b2, out num, out structureRegion, out structureDrop)) { StructureManager.manager.channel.send("askTransformStructure", ESteamCall.SERVER, ESteamPacket.UPDATE_RELIABLE_BUFFER, new object[] { b, b2, structureDrop.instanceID, point, MeasurementTool.angleToByte(angle_x), MeasurementTool.angleToByte(angle_y), MeasurementTool.angleToByte(angle_z) }); } }
public void writeQuaternion(string key, Quaternion value) { Vector3 eulerAngles = value.eulerAngles; this.writeByte(key + "_X", MeasurementTool.angleToByte(eulerAngles.x)); this.writeByte(key + "_Y", MeasurementTool.angleToByte(eulerAngles.y)); this.writeByte(key + "_Z", MeasurementTool.angleToByte(eulerAngles.z)); }
public void askAnimals(CSteamID steamID) { base.channel.openWrite(); base.channel.write((ushort)AnimalManager.animals.Count); for (int i = 0; i < AnimalManager.animals.Count; i++) { Animal animal = AnimalManager.animals[i]; base.channel.write(animal.id, animal.transform.position, MeasurementTool.angleToByte(animal.transform.rotation.eulerAngles.y), animal.isDead); } base.channel.closeWrite("tellAnimals", steamID, ESteamPacket.UPDATE_RELIABLE_CHUNK_BUFFER); }
public void askLighting(CSteamID steamID) { base.channel.send("tellLighting", steamID, ESteamPacket.UPDATE_RELIABLE_BUFFER, new object[] { Provider.time, LightingManager.cycle, LightingManager.offset, LevelLighting.moon, MeasurementTool.angleToByte(LevelLighting.wind), (byte)LevelLighting.rainyness, (byte)LevelLighting.snowyness }); }
// Token: 0x060025BA RID: 9658 RVA: 0x000DCD44 File Offset: 0x000DB144 public static void save() { River river = new River(Level.info.path + "/Spawns/Players.dat", false); river.writeByte(LevelPlayers.SAVEDATA_VERSION); river.writeByte((byte)LevelPlayers.spawns.Count); for (int i = 0; i < LevelPlayers.spawns.Count; i++) { PlayerSpawnpoint playerSpawnpoint = LevelPlayers.spawns[i]; river.writeSingleVector3(playerSpawnpoint.point); river.writeByte(MeasurementTool.angleToByte(playerSpawnpoint.angle)); river.writeBoolean(playerSpawnpoint.isAlt); } river.closeRiver(); }
public override void grantReward(Player player, bool shouldSend) { if (!Provider.isServer) { return; } Spawnpoint spawnpoint = SpawnpointSystem.getSpawnpoint(this.spawnpoint); if (spawnpoint == null) { Debug.LogError("Failed to find NPC teleport reward spawnpoint: " + this.spawnpoint); return; } player.sendTeleport(spawnpoint.transform.position, MeasurementTool.angleToByte(spawnpoint.transform.rotation.eulerAngles.y)); }
// Token: 0x060028BB RID: 10427 RVA: 0x000F7308 File Offset: 0x000F5708 private void updateLighting() { LightingManager._time = (Provider.time - LightingManager.offset) % LightingManager.cycle; if (Provider.isServer && Time.time - LightingManager.lastWind > LightingManager.windDelay) { LightingManager.windDelay = (float)UnityEngine.Random.Range(45, 75); LightingManager.lastWind = Time.time; LevelLighting.wind = (float)UnityEngine.Random.Range(0, 360); LightingManager.manager.channel.send("tellLightingWind", ESteamCall.OTHERS, ESteamPacket.UPDATE_RELIABLE_BUFFER, new object[] { MeasurementTool.angleToByte(LevelLighting.wind) }); } if (LightingManager.day > LevelLighting.bias) { if (!LightingManager.isCycled) { LightingManager.isCycled = true; if (LevelLighting.moon < LevelLighting.MOON_CYCLES - 1) { LevelLighting.moon += 1; LightingManager.isFullMoon = (LevelLighting.moon == 2); } else { LevelLighting.moon = 0; LightingManager.isFullMoon = false; } if (LightingManager.onDayNightUpdated != null) { LightingManager.onDayNightUpdated(false); } } } else if (LightingManager.isCycled) { LightingManager.isCycled = false; LightingManager.isFullMoon = false; if (LightingManager.onDayNightUpdated != null) { LightingManager.onDayNightUpdated(true); } } if (!Dedicator.isDedicated) { LevelLighting.time = LightingManager.day; } }
// Token: 0x0600269D RID: 9885 RVA: 0x000E4A44 File Offset: 0x000E2E44 private IEnumerator teleport() { yield return(new WaitForSeconds(3f)); if (this.target != null && this.playerTeleported != null && !this.playerTeleported.life.isDead) { this.playerTeleported.sendTeleport(this.target.position, MeasurementTool.angleToByte(this.target.rotation.eulerAngles.y)); if (this.playerTeleported.equipment.isSelected) { this.playerTeleported.equipment.dequip(); } this.playerTeleported.equipment.canEquip = true; } this.playerTeleported = null; yield break; }
public static void save() { River river = new River(Level.info.path + "/Spawns/Vehicles.dat", false); river.writeByte(LevelVehicles.SAVEDATA_VERSION); river.writeByte((byte)LevelVehicles.tables.Count); byte b = 0; while ((int)b < LevelVehicles.tables.Count) { VehicleTable vehicleTable = LevelVehicles.tables[(int)b]; river.writeColor(vehicleTable.color); river.writeString(vehicleTable.name); river.writeUInt16(vehicleTable.tableID); river.writeByte((byte)vehicleTable.tiers.Count); byte b2 = 0; while ((int)b2 < vehicleTable.tiers.Count) { VehicleTier vehicleTier = vehicleTable.tiers[(int)b2]; river.writeString(vehicleTier.name); river.writeSingle(vehicleTier.chance); river.writeByte((byte)vehicleTier.table.Count); byte b3 = 0; while ((int)b3 < vehicleTier.table.Count) { VehicleSpawn vehicleSpawn = vehicleTier.table[(int)b3]; river.writeUInt16(vehicleSpawn.vehicle); b3 += 1; } b2 += 1; } b += 1; } river.writeUInt16((ushort)LevelVehicles.spawns.Count); for (int i = 0; i < LevelVehicles.spawns.Count; i++) { VehicleSpawnpoint vehicleSpawnpoint = LevelVehicles.spawns[i]; river.writeByte(vehicleSpawnpoint.type); river.writeSingleVector3(vehicleSpawnpoint.point); river.writeByte(MeasurementTool.angleToByte(vehicleSpawnpoint.angle)); } river.closeRiver(); }
// Token: 0x060026A5 RID: 9893 RVA: 0x000E4DD0 File Offset: 0x000E31D0 private IEnumerator teleport() { yield return(new WaitForSeconds(3f)); if (this.target != null) { ZombieBossQuest.nearbyPlayers.Clear(); PlayerTool.getPlayersInRadius(base.transform.position, this.sqrRadius, ZombieBossQuest.nearbyPlayers); for (int i = 0; i < ZombieBossQuest.nearbyPlayers.Count; i++) { Player player = ZombieBossQuest.nearbyPlayers[i]; if (!player.life.isDead) { player.quests.sendRemoveQuest(213); player.quests.setFlag(213, 1); player.sendTeleport(this.target.position, MeasurementTool.angleToByte(this.target.rotation.eulerAngles.y)); } } } yield break; }
protected override IEnumerator teleport() { yield return(new WaitForSeconds(1f)); if (this.target != null) { GermanyTeleporterA.nearbyPlayers.Clear(); PlayerTool.getPlayersInRadius(base.transform.position, this.sqrRadius, GermanyTeleporterA.nearbyPlayers); for (int i = 0; i < GermanyTeleporterA.nearbyPlayers.Count; i++) { Player player = GermanyTeleporterA.nearbyPlayers[i]; if (!player.life.isDead) { if (player.quests.getQuestStatus(248) == ENPCQuestStatus.COMPLETED) { player.sendTeleport(this.target.position, MeasurementTool.angleToByte(this.target.rotation.eulerAngles.y)); } } } } yield break; }
// Token: 0x06001E2F RID: 7727 RVA: 0x000A4BF8 File Offset: 0x000A2FF8 protected override void execute(CSteamID executorID, string parameter) { if (!Provider.isServer) { CommandWindow.LogError(this.localization.format("NotRunningErrorText")); return; } string[] componentsFromSerial = Parser.getComponentsFromSerial(parameter, '/'); if (componentsFromSerial.Length < 1 || componentsFromSerial.Length > 2) { CommandWindow.LogError(this.localization.format("InvalidParameterErrorText")); return; } bool flag = componentsFromSerial.Length == 1; SteamPlayer steamPlayer; if (flag) { steamPlayer = PlayerTool.getSteamPlayer(executorID); } else { PlayerTool.tryGetSteamPlayer(componentsFromSerial[0], out steamPlayer); } if (steamPlayer == null) { CommandWindow.LogError(this.localization.format("NoPlayerErrorText", new object[] { componentsFromSerial[0] })); return; } if (steamPlayer.player.movement.getVehicle() != null) { CommandWindow.LogError(this.localization.format("NoVehicleErrorText")); return; } SteamPlayer steamPlayer2; if (PlayerTool.tryGetSteamPlayer(componentsFromSerial[(!flag) ? 1 : 0], out steamPlayer2)) { steamPlayer.player.sendTeleport(steamPlayer2.player.transform.position, MeasurementTool.angleToByte(steamPlayer2.player.transform.rotation.eulerAngles.y)); CommandWindow.Log(this.localization.format("TeleportText", new object[] { steamPlayer.playerID.playerName, steamPlayer2.playerID.playerName })); } else if (componentsFromSerial[(!flag) ? 1 : 0].Equals(this.localization.format("WaypointCommand"), StringComparison.InvariantCultureIgnoreCase) && steamPlayer.player.quests.isMarkerPlaced) { Vector3 markerPosition = steamPlayer.player.quests.markerPosition; markerPosition.y = 1024f; RaycastHit raycastHit; if (Physics.Raycast(markerPosition, Vector3.down, out raycastHit, 2048f, RayMasks.WAYPOINT)) { steamPlayer.player.sendTeleport(raycastHit.point + Vector3.up, MeasurementTool.angleToByte(steamPlayer.player.transform.rotation.eulerAngles.y)); CommandWindow.Log(this.localization.format("TeleportText", new object[] { steamPlayer.playerID.playerName, this.localization.format("WaypointText") })); } } else { Node node = null; for (int i = 0; i < LevelNodes.nodes.Count; i++) { if (LevelNodes.nodes[i].type == ENodeType.LOCATION && NameTool.checkNames(componentsFromSerial[(!flag) ? 1 : 0], ((LocationNode)LevelNodes.nodes[i]).name)) { node = LevelNodes.nodes[i]; break; } } if (node != null) { steamPlayer.player.sendTeleport(node.point, MeasurementTool.angleToByte(steamPlayer.player.transform.rotation.eulerAngles.y)); CommandWindow.Log(this.localization.format("TeleportText", new object[] { steamPlayer.playerID.playerName, ((LocationNode)node).name })); } else { CommandWindow.LogError(this.localization.format("NoLocationErrorText", new object[] { componentsFromSerial[(!flag) ? 1 : 0] })); } } }
public static void dropStructure(Structure structure, Vector3 point, float angle_x, float angle_y, float angle_z, ulong owner, ulong group) { ItemStructureAsset itemStructureAsset = (ItemStructureAsset)Assets.find(EAssetType.ITEM, structure.id); if (itemStructureAsset != null) { Vector3 eulerAngles = Quaternion.Euler(-90f, angle_y, 0f).eulerAngles; angle_x = (float)(Mathf.RoundToInt(eulerAngles.x / 2f) * 2); angle_y = (float)(Mathf.RoundToInt(eulerAngles.y / 2f) * 2); angle_z = (float)(Mathf.RoundToInt(eulerAngles.z / 2f) * 2); byte b; byte b2; StructureRegion structureRegion; if (Regions.tryGetCoordinate(point, out b, out b2) && StructureManager.tryGetRegion(b, b2, out structureRegion)) { StructureData structureData = new StructureData(structure, point, MeasurementTool.angleToByte(angle_x), MeasurementTool.angleToByte(angle_y), MeasurementTool.angleToByte(angle_z), owner, group, Provider.time); structureRegion.structures.Add(structureData); StructureManager.manager.channel.send("tellStructure", ESteamCall.ALL, b, b2, StructureManager.STRUCTURE_REGIONS, ESteamPacket.UPDATE_RELIABLE_BUFFER, new object[] { b, b2, structure.id, structureData.point, structureData.angle_x, structureData.angle_y, structureData.angle_z, owner, group, StructureManager.instanceCount += 1u }); } } }
public void sendRevive(Vector3 position, float angle) { AnimalManager.sendAnimalAlive(this, position, MeasurementTool.angleToByte(angle)); }
// Token: 0x0600287A RID: 10362 RVA: 0x000F56AC File Offset: 0x000F3AAC private void arenaSpawn() { for (byte b = 0; b < Regions.WORLD_SIZE; b += 1) { for (byte b2 = 0; b2 < Regions.WORLD_SIZE; b2 += 1) { if (LevelItems.spawns[(int)b, (int)b2].Count > 0) { for (int i = 0; i < LevelItems.spawns[(int)b, (int)b2].Count; i++) { ItemSpawnpoint itemSpawnpoint = LevelItems.spawns[(int)b, (int)b2][i]; ushort item = LevelItems.getItem(itemSpawnpoint); if (item != 0) { Item item2 = new Item(item, EItemOrigin.ADMIN); ItemManager.dropItem(item2, itemSpawnpoint.point, false, false, false); } } } } } List <VehicleSpawnpoint> spawns = LevelVehicles.spawns; for (int j = 0; j < spawns.Count; j++) { VehicleSpawnpoint vehicleSpawnpoint = spawns[j]; ushort vehicle = LevelVehicles.getVehicle(vehicleSpawnpoint); if (vehicle != 0) { Vector3 point = vehicleSpawnpoint.point; point.y += 1f; VehicleManager.spawnVehicle(vehicle, point, Quaternion.Euler(0f, vehicleSpawnpoint.angle, 0f)); } } List <PlayerSpawnpoint> altSpawns = LevelPlayers.getAltSpawns(); float num = LevelManager.arenaCurrentRadius - SafezoneNode.MIN_SIZE; num *= num; for (int k = altSpawns.Count - 1; k >= 0; k--) { PlayerSpawnpoint playerSpawnpoint = altSpawns[k]; float num2 = Mathf.Pow(playerSpawnpoint.point.x - LevelManager.arenaCurrentCenter.x, 2f) + Mathf.Pow(playerSpawnpoint.point.z - LevelManager.arenaCurrentCenter.z, 2f); if (num2 > num) { altSpawns.RemoveAt(k); } } for (int l = 0; l < Provider.clients.Count; l++) { if (altSpawns.Count == 0) { break; } SteamPlayer steamPlayer = Provider.clients[l]; if (steamPlayer != null && !(steamPlayer.player == null) && !steamPlayer.player.life.isDead) { int index = UnityEngine.Random.Range(0, altSpawns.Count); PlayerSpawnpoint playerSpawnpoint2 = altSpawns[index]; altSpawns.RemoveAt(index); ArenaPlayer arenaPlayer = new ArenaPlayer(steamPlayer); arenaPlayer.steamPlayer.player.life.sendRevive(); arenaPlayer.steamPlayer.player.sendTeleport(playerSpawnpoint2.point, MeasurementTool.angleToByte(playerSpawnpoint2.angle)); LevelManager.arenaPlayers.Add(arenaPlayer); foreach (ArenaLoadout arenaLoadout in Level.info.configData.Arena_Loadouts) { for (ushort num3 = 0; num3 < arenaLoadout.Amount; num3 += 1) { ushort newID = SpawnTableTool.resolve(arenaLoadout.Table_ID); arenaPlayer.steamPlayer.player.inventory.forceAddItemAuto(new Item(newID, true), true, false, true, false); } } } } this.arenaAirdrop(); LevelManager.arenaState = EArenaState.PLAY; base.channel.send("tellLevelNumber", ESteamCall.ALL, ESteamPacket.UPDATE_RELIABLE_BUFFER, new object[] { (byte)LevelManager.arenaPlayers.Count }); }
private void FixedUpdate() { if (this.isDismissed) { return; } if (base.channel.isOwner) { if (this.count % PlayerInput.SAMPLES == 0u) { this._tick = Time.realtimeSinceStartup; this.keys[0] = base.player.movement.jump; this.keys[1] = base.player.equipment.primary; this.keys[2] = base.player.equipment.secondary; this.keys[3] = base.player.stance.crouch; this.keys[4] = base.player.stance.prone; this.keys[5] = base.player.stance.sprint; this.keys[6] = base.player.animator.leanLeft; this.keys[7] = base.player.animator.leanRight; this.keys[8] = false; this.analog = (byte)((int)base.player.movement.horizontal << 4 | (int)base.player.movement.vertical); base.player.life.simulate(this.simulation); base.player.stance.simulate(this.simulation, base.player.stance.crouch, base.player.stance.prone, base.player.stance.sprint); this.pitch = base.player.look.pitch; this.yaw = base.player.look.yaw; base.player.movement.simulate(this.simulation, 0, (int)(base.player.movement.horizontal - 1), (int)(base.player.movement.vertical - 1), base.player.look.look_x, base.player.look.look_y, base.player.movement.jump, Vector3.zero, PlayerInput.RATE); if (Provider.isServer) { this.inputs.Clear(); } else { this.sequence++; if (base.player.stance.stance == EPlayerStance.DRIVING) { this.clientsidePackets.Add(new DrivingPlayerInputPacket()); } else { this.clientsidePackets.Add(new WalkingPlayerInputPacket()); } PlayerInputPacket playerInputPacket = this.clientsidePackets[this.clientsidePackets.Count - 1]; playerInputPacket.sequence = this.sequence; playerInputPacket.recov = this.recov; } base.player.equipment.simulate(this.simulation, base.player.equipment.primary, base.player.equipment.secondary, base.player.stance.sprint); base.player.animator.simulate(this.simulation, base.player.animator.leanLeft, base.player.animator.leanRight); this.buffer += PlayerInput.SAMPLES; this._simulation += 1u; } if (this.consumed < this.buffer) { this.consumed += 1u; base.player.equipment.tock(this.clock); this._clock += 1u; } if (this.consumed == this.buffer && this.clientsidePackets.Count > 0 && !Provider.isServer) { ushort num = 0; byte b = 0; while ((int)b < this.keys.Length) { if (this.keys[(int)b]) { num |= this.flags[(int)b]; } b += 1; } PlayerInputPacket playerInputPacket2 = this.clientsidePackets[this.clientsidePackets.Count - 1]; playerInputPacket2.keys = num; if (playerInputPacket2 is DrivingPlayerInputPacket) { DrivingPlayerInputPacket drivingPlayerInputPacket = playerInputPacket2 as DrivingPlayerInputPacket; drivingPlayerInputPacket.position = base.transform.parent.parent.parent.position; drivingPlayerInputPacket.angle_x = MeasurementTool.angleToByte2(base.transform.parent.parent.parent.rotation.eulerAngles.x); drivingPlayerInputPacket.angle_y = MeasurementTool.angleToByte2(base.transform.parent.parent.parent.rotation.eulerAngles.y); drivingPlayerInputPacket.angle_z = MeasurementTool.angleToByte2(base.transform.parent.parent.parent.rotation.eulerAngles.z); drivingPlayerInputPacket.speed = (byte)(Mathf.Clamp(base.player.movement.getVehicle().speed, -100f, 100f) + 128f); drivingPlayerInputPacket.physicsSpeed = (byte)(Mathf.Clamp(base.player.movement.getVehicle().physicsSpeed, -100f, 100f) + 128f); drivingPlayerInputPacket.turn = (byte)(base.player.movement.getVehicle().turn + 1); } else { WalkingPlayerInputPacket walkingPlayerInputPacket = playerInputPacket2 as WalkingPlayerInputPacket; walkingPlayerInputPacket.analog = this.analog; walkingPlayerInputPacket.position = base.transform.localPosition; walkingPlayerInputPacket.yaw = this.yaw; walkingPlayerInputPacket.pitch = this.pitch; } base.channel.openWrite(); while (this.clientsidePackets.Count >= 25) { this.clientsidePackets.RemoveAt(0); } base.channel.write((byte)this.clientsidePackets.Count); foreach (PlayerInputPacket playerInputPacket3 in this.clientsidePackets) { if (playerInputPacket3 is DrivingPlayerInputPacket) { base.channel.write(1); } else { base.channel.write(0); } playerInputPacket3.write(base.channel); } base.channel.closeWrite("askInput", ESteamCall.SERVER, ESteamPacket.UPDATE_UNRELIABLE_CHUNK_INSTANT); } this.count += 1u; } else if (Provider.isServer) { if (this.serversidePackets.Count > 0) { PlayerInputPacket playerInputPacket4 = this.serversidePackets.Peek(); if (playerInputPacket4 is WalkingPlayerInputPacket || this.count % PlayerInput.SAMPLES == 0u) { if (this.simulation > (uint)((Time.realtimeSinceStartup + 5f - this.tick) / PlayerInput.RATE)) { return; } playerInputPacket4 = this.serversidePackets.Dequeue(); if (playerInputPacket4 == null) { return; } this.hasDoneOcclusionCheck = false; this.inputs = playerInputPacket4.serversideInputs; byte b2 = 0; while ((int)b2 < this.keys.Length) { this.keys[(int)b2] = ((playerInputPacket4.keys & this.flags[(int)b2]) == this.flags[(int)b2]); b2 += 1; } if (playerInputPacket4 is DrivingPlayerInputPacket) { DrivingPlayerInputPacket drivingPlayerInputPacket2 = playerInputPacket4 as DrivingPlayerInputPacket; if (!base.player.life.isDead) { base.player.life.simulate(this.simulation); base.player.look.simulate(0f, 0f, PlayerInput.RATE); base.player.stance.simulate(this.simulation, false, false, false); base.player.movement.simulate(this.simulation, drivingPlayerInputPacket2.recov, this.keys[0], drivingPlayerInputPacket2.position, MeasurementTool.byteToAngle2(drivingPlayerInputPacket2.angle_x), MeasurementTool.byteToAngle2(drivingPlayerInputPacket2.angle_y), MeasurementTool.byteToAngle2(drivingPlayerInputPacket2.angle_z), (float)(drivingPlayerInputPacket2.speed - 128), (float)(drivingPlayerInputPacket2.physicsSpeed - 128), (int)(drivingPlayerInputPacket2.turn - 1), PlayerInput.RATE); base.player.equipment.simulate(this.simulation, this.keys[1], this.keys[2], this.keys[5]); base.player.animator.simulate(this.simulation, false, false); } } else { WalkingPlayerInputPacket walkingPlayerInputPacket2 = playerInputPacket4 as WalkingPlayerInputPacket; this.analog = walkingPlayerInputPacket2.analog; if (!base.player.life.isDead) { base.player.life.simulate(this.simulation); base.player.look.simulate(walkingPlayerInputPacket2.yaw, walkingPlayerInputPacket2.pitch, PlayerInput.RATE); base.player.stance.simulate(this.simulation, this.keys[3], this.keys[4], this.keys[5]); base.player.movement.simulate(this.simulation, walkingPlayerInputPacket2.recov, (this.analog >> 4 & 15) - 1, (int)((this.analog & 15) - 1), 0f, 0f, this.keys[0], walkingPlayerInputPacket2.position, PlayerInput.RATE); base.player.equipment.simulate(this.simulation, this.keys[1], this.keys[2], this.keys[5]); base.player.animator.simulate(this.simulation, this.keys[6], this.keys[7]); } } this.buffer += PlayerInput.SAMPLES; this._simulation += 1u; while (this.consumed < this.buffer) { this.consumed += 1u; if (!base.player.life.isDead) { base.player.equipment.tock(this.clock); } this._clock += 1u; } } this.count += 1u; } else { base.player.movement.simulate(); if (this.hasInputed && Time.realtimeSinceStartup - this.lastInputed > 10f) { Provider.dismiss(base.channel.owner.playerID.steamID); this.isDismissed = true; } } } }
private static void loadRegion(byte version, River river, StructureRegion region) { ushort num = river.readUInt16(); for (ushort num2 = 0; num2 < num; num2 += 1) { ushort num3 = river.readUInt16(); ushort num4 = river.readUInt16(); Vector3 vector = river.readSingleVector3(); byte b = 0; if (version > 4) { b = river.readByte(); } byte b2 = river.readByte(); byte b3 = 0; if (version > 4) { b3 = river.readByte(); } ulong num5 = 0UL; ulong num6 = 0UL; if (version > 2) { num5 = river.readUInt64(); num6 = river.readUInt64(); } uint newObjActiveDate; if (version > 3) { newObjActiveDate = river.readUInt32(); if (Provider.time - StructureManager.serverActiveDate > Provider.modeConfigData.Structures.Decay_Time / 2u) { newObjActiveDate = Provider.time; } } else { newObjActiveDate = Provider.time; } ItemStructureAsset itemStructureAsset; try { itemStructureAsset = (ItemStructureAsset)Assets.find(EAssetType.ITEM, num3); } catch { itemStructureAsset = null; } if (itemStructureAsset != null) { if (version < 5) { Vector3 eulerAngles = Quaternion.Euler(-90f, (float)(b2 * 2), 0f).eulerAngles; b = MeasurementTool.angleToByte((float)(Mathf.RoundToInt(eulerAngles.x / 2f) * 2)); b2 = MeasurementTool.angleToByte((float)(Mathf.RoundToInt(eulerAngles.y / 2f) * 2)); b3 = MeasurementTool.angleToByte((float)(Mathf.RoundToInt(eulerAngles.z / 2f) * 2)); } region.structures.Add(new StructureData(new Structure(num3, num4, itemStructureAsset), vector, b, b2, b3, num5, num6, newObjActiveDate)); StructureManager.manager.spawnStructure(region, num3, vector, b, b2, b3, (byte)Mathf.RoundToInt((float)num4 / (float)itemStructureAsset.health * 100f), num5, num6, StructureManager.instanceCount += 1u); } } }
public static void load() { bool flag = false; if (LevelSavedata.fileExists("/Structures.dat") && Level.info.type == ELevelType.SURVIVAL) { River river = LevelSavedata.openRiver("/Structures.dat", true); byte b = river.readByte(); if (b > 3) { StructureManager.serverActiveDate = river.readUInt32(); } else { StructureManager.serverActiveDate = Provider.time; } if (b > 1) { for (byte b2 = 0; b2 < Regions.WORLD_SIZE; b2 += 1) { for (byte b3 = 0; b3 < Regions.WORLD_SIZE; b3 += 1) { StructureRegion region = StructureManager.regions[(int)b2, (int)b3]; StructureManager.loadRegion(b, river, region); } } } if (b < 6) { flag = true; } } else { flag = true; } if (flag && LevelObjects.buildables != null) { for (byte b4 = 0; b4 < Regions.WORLD_SIZE; b4 += 1) { for (byte b5 = 0; b5 < Regions.WORLD_SIZE; b5 += 1) { List <LevelBuildableObject> list = LevelObjects.buildables[(int)b4, (int)b5]; if (list != null && list.Count != 0) { StructureRegion structureRegion = StructureManager.regions[(int)b4, (int)b5]; for (int i = 0; i < list.Count; i++) { LevelBuildableObject levelBuildableObject = list[i]; if (levelBuildableObject != null) { ItemStructureAsset itemStructureAsset = levelBuildableObject.asset as ItemStructureAsset; if (itemStructureAsset != null) { Vector3 eulerAngles = levelBuildableObject.rotation.eulerAngles; byte newAngle_X = MeasurementTool.angleToByte((float)(Mathf.RoundToInt(eulerAngles.x / 2f) * 2)); byte newAngle_Y = MeasurementTool.angleToByte((float)(Mathf.RoundToInt(eulerAngles.y / 2f) * 2)); byte newAngle_Z = MeasurementTool.angleToByte((float)(Mathf.RoundToInt(eulerAngles.z / 2f) * 2)); Structure structure = new Structure(itemStructureAsset.id, itemStructureAsset.health, itemStructureAsset); StructureData structureData = new StructureData(structure, levelBuildableObject.point, newAngle_X, newAngle_Y, newAngle_Z, 0UL, 0UL, uint.MaxValue); structureRegion.structures.Add(structureData); StructureManager.manager.spawnStructure(structureRegion, structure.id, structureData.point, structureData.angle_x, structureData.angle_y, structureData.angle_z, (byte)Mathf.RoundToInt((float)structure.health / (float)itemStructureAsset.health * 100f), 0UL, 0UL, StructureManager.instanceCount += 1u); } } } } } } } Level.isLoadingStructures = false; }
// Token: 0x06002700 RID: 9984 RVA: 0x000E7B1C File Offset: 0x000E5F1C public void sendAnimal(Animal animal) { base.channel.write(animal.id, animal.transform.position, MeasurementTool.angleToByte(animal.transform.rotation.eulerAngles.y), animal.isDead); }
// Token: 0x0600270D RID: 9997 RVA: 0x000E85C4 File Offset: 0x000E69C4 private void Update() { if (!Provider.isServer || !Level.isLoaded) { return; } if (AnimalManager.animals == null || AnimalManager.animals.Count == 0) { return; } if (AnimalManager.tickingAnimals == null) { return; } int num; int num2; if (Dedicator.isDedicated) { if (AnimalManager.tickIndex >= AnimalManager.tickingAnimals.Count) { AnimalManager.tickIndex = 0; } num = AnimalManager.tickIndex; num2 = num + 25; if (num2 >= AnimalManager.tickingAnimals.Count) { num2 = AnimalManager.tickingAnimals.Count; } AnimalManager.tickIndex = num2; } else { num = 0; num2 = AnimalManager.tickingAnimals.Count; } for (int i = num2 - 1; i >= num; i--) { Animal animal = AnimalManager.tickingAnimals[i]; if (animal == null) { Debug.LogError("Missing animal " + i); } else { animal.tick(); } } if (Dedicator.isDedicated && Time.realtimeSinceStartup - AnimalManager.lastTick > Provider.UPDATE_TIME) { AnimalManager.lastTick += Provider.UPDATE_TIME; if (Time.realtimeSinceStartup - AnimalManager.lastTick > Provider.UPDATE_TIME) { AnimalManager.lastTick = Time.realtimeSinceStartup; } base.channel.useCompression = true; this.seq += 1u; for (int j = 0; j < Provider.clients.Count; j++) { SteamPlayer steamPlayer = Provider.clients[j]; if (steamPlayer != null && !(steamPlayer.player == null)) { base.channel.openWrite(); base.channel.write(this.seq); ushort num3 = 0; int step = base.channel.step; base.channel.write(num3); int num4 = 0; for (int k = 0; k < AnimalManager.animals.Count; k++) { if (num3 >= 64) { break; } Animal animal2 = AnimalManager.animals[k]; if (!(animal2 == null) && animal2.isUpdated) { if ((animal2.transform.position - steamPlayer.player.transform.position).sqrMagnitude > 331776f) { if ((ulong)(this.seq % 8u) == (ulong)((long)num4)) { base.channel.write(animal2.index, animal2.transform.position, MeasurementTool.angleToByte(animal2.transform.rotation.eulerAngles.y)); num3 += 1; } num4++; } else { base.channel.write(animal2.index, animal2.transform.position, MeasurementTool.angleToByte(animal2.transform.rotation.eulerAngles.y)); num3 += 1; } } } if (num3 != 0) { int step2 = base.channel.step; base.channel.step = step; base.channel.write(num3); base.channel.step = step2; base.channel.closeWrite("tellAnimalStates", steamPlayer.playerID.steamID, ESteamPacket.UPDATE_UNRELIABLE_CHUNK_BUFFER); } } } base.channel.useCompression = false; for (int l = 0; l < AnimalManager.animals.Count; l++) { Animal animal3 = AnimalManager.animals[l]; if (!(animal3 == null)) { animal3.isUpdated = false; } } } this.respawnAnimals(); }
protected override void execute(CSteamID executorID, string parameter) { if (!Provider.isServer) { CommandWindow.LogError(this.localization.format("NotRunningErrorText")); return; } string[] componentsFromSerial = Parser.getComponentsFromSerial(parameter, '/'); if (componentsFromSerial.Length < 1 || componentsFromSerial.Length > 2) { CommandWindow.LogError(this.localization.format("InvalidParameterErrorText")); return; } bool flag = componentsFromSerial.Length == 1; SteamPlayer steamPlayer; if (flag) { steamPlayer = PlayerTool.getSteamPlayer(executorID); } else { PlayerTool.tryGetSteamPlayer(componentsFromSerial[0], out steamPlayer); } if (steamPlayer == null) { CommandWindow.LogError(this.localization.format("NoPlayerErrorText", new object[] { componentsFromSerial[0] })); return; } if (steamPlayer.player.movement.getVehicle() != null) { CommandWindow.LogError(this.localization.format("NoVehicleErrorText")); return; } SteamPlayer steamPlayer2; if (PlayerTool.tryGetSteamPlayer(componentsFromSerial[(!flag) ? 1 : 0], out steamPlayer2)) { steamPlayer.player.sendTeleport(steamPlayer2.player.transform.position, MeasurementTool.angleToByte(steamPlayer2.player.transform.rotation.eulerAngles.y)); CommandWindow.Log(this.localization.format("TeleportText", new object[] { steamPlayer.playerID.playerName, steamPlayer2.playerID.playerName })); } else { Node node = null; for (int i = 0; i < LevelNodes.nodes.Count; i++) { if (LevelNodes.nodes[i].type == ENodeType.LOCATION && NameTool.checkNames(componentsFromSerial[(!flag) ? 1 : 0], ((LocationNode)LevelNodes.nodes[i]).name)) { node = LevelNodes.nodes[i]; break; } } if (node != null) { steamPlayer.player.sendTeleport(node.point, MeasurementTool.angleToByte(steamPlayer.player.transform.rotation.eulerAngles.y)); CommandWindow.Log(this.localization.format("TeleportText", new object[] { steamPlayer.playerID.playerName, ((LocationNode)node).name })); } else { CommandWindow.LogError(this.localization.format("NoLocationErrorText", new object[] { componentsFromSerial[(!flag) ? 1 : 0] })); } } }
// Token: 0x0600367B RID: 13947 RVA: 0x001747B4 File Offset: 0x00172BB4 private static void onClickedStatButton(SleekButton button) { byte b; do { b = (byte)UnityEngine.Random.Range(1, (int)(MenuTitleUI.STAT_COUNT + 1)); }while (b == (byte)MenuTitleUI.stat); MenuTitleUI.stat = (EPlayerStat)b; if (MenuTitleUI.stat == EPlayerStat.KILLS_ZOMBIES_NORMAL) { int num; Provider.provider.statisticsService.userStatisticsService.getStatistic("Kills_Zombies_Normal", out num); long num2; Provider.provider.statisticsService.globalStatisticsService.getStatistic("Kills_Zombies_Normal", out num2); MenuTitleUI.statButton.text = MenuTitleUI.localization.format("Stat_Kills_Zombies_Normal", new object[] { num.ToString("n0"), num2.ToString("n0") }); } else if (MenuTitleUI.stat == EPlayerStat.KILLS_PLAYERS) { int num3; Provider.provider.statisticsService.userStatisticsService.getStatistic("Kills_Players", out num3); long num4; Provider.provider.statisticsService.globalStatisticsService.getStatistic("Kills_Players", out num4); MenuTitleUI.statButton.text = MenuTitleUI.localization.format("Stat_Kills_Players", new object[] { num3.ToString("n0"), num4.ToString("n0") }); } else if (MenuTitleUI.stat == EPlayerStat.FOUND_ITEMS) { int num5; Provider.provider.statisticsService.userStatisticsService.getStatistic("Found_Items", out num5); long num6; Provider.provider.statisticsService.globalStatisticsService.getStatistic("Found_Items", out num6); MenuTitleUI.statButton.text = MenuTitleUI.localization.format("Stat_Found_Items", new object[] { num5.ToString("n0"), num6.ToString("n0") }); } else if (MenuTitleUI.stat == EPlayerStat.FOUND_RESOURCES) { int num7; Provider.provider.statisticsService.userStatisticsService.getStatistic("Found_Resources", out num7); long num8; Provider.provider.statisticsService.globalStatisticsService.getStatistic("Found_Resources", out num8); MenuTitleUI.statButton.text = MenuTitleUI.localization.format("Stat_Found_Resources", new object[] { num7.ToString("n0"), num8.ToString("n0") }); } else if (MenuTitleUI.stat == EPlayerStat.FOUND_EXPERIENCE) { int num9; Provider.provider.statisticsService.userStatisticsService.getStatistic("Found_Experience", out num9); long num10; Provider.provider.statisticsService.globalStatisticsService.getStatistic("Found_Experience", out num10); MenuTitleUI.statButton.text = MenuTitleUI.localization.format("Stat_Found_Experience", new object[] { num9.ToString("n0"), num10.ToString("n0") }); } else if (MenuTitleUI.stat == EPlayerStat.KILLS_ZOMBIES_MEGA) { int num11; Provider.provider.statisticsService.userStatisticsService.getStatistic("Kills_Zombies_Mega", out num11); long num12; Provider.provider.statisticsService.globalStatisticsService.getStatistic("Kills_Zombies_Mega", out num12); MenuTitleUI.statButton.text = MenuTitleUI.localization.format("Stat_Kills_Zombies_Mega", new object[] { num11.ToString("n0"), num12.ToString("n0") }); } else if (MenuTitleUI.stat == EPlayerStat.DEATHS_PLAYERS) { int num13; Provider.provider.statisticsService.userStatisticsService.getStatistic("Deaths_Players", out num13); long num14; Provider.provider.statisticsService.globalStatisticsService.getStatistic("Deaths_Players", out num14); MenuTitleUI.statButton.text = MenuTitleUI.localization.format("Stat_Deaths_Players", new object[] { num13.ToString("n0"), num14.ToString("n0") }); } else if (MenuTitleUI.stat == EPlayerStat.KILLS_ANIMALS) { int num15; Provider.provider.statisticsService.userStatisticsService.getStatistic("Kills_Animals", out num15); long num16; Provider.provider.statisticsService.globalStatisticsService.getStatistic("Kills_Animals", out num16); MenuTitleUI.statButton.text = MenuTitleUI.localization.format("Stat_Kills_Animals", new object[] { num15.ToString("n0"), num16.ToString("n0") }); } else if (MenuTitleUI.stat == EPlayerStat.FOUND_CRAFTS) { int num17; Provider.provider.statisticsService.userStatisticsService.getStatistic("Found_Crafts", out num17); long num18; Provider.provider.statisticsService.globalStatisticsService.getStatistic("Found_Crafts", out num18); MenuTitleUI.statButton.text = MenuTitleUI.localization.format("Stat_Found_Crafts", new object[] { num17.ToString("n0"), num18.ToString("n0") }); } else if (MenuTitleUI.stat == EPlayerStat.FOUND_FISHES) { int num19; Provider.provider.statisticsService.userStatisticsService.getStatistic("Found_Fishes", out num19); long num20; Provider.provider.statisticsService.globalStatisticsService.getStatistic("Found_Fishes", out num20); MenuTitleUI.statButton.text = MenuTitleUI.localization.format("Stat_Found_Fishes", new object[] { num19.ToString("n0"), num20.ToString("n0") }); } else if (MenuTitleUI.stat == EPlayerStat.FOUND_PLANTS) { int num21; Provider.provider.statisticsService.userStatisticsService.getStatistic("Found_Plants", out num21); long num22; Provider.provider.statisticsService.globalStatisticsService.getStatistic("Found_Plants", out num22); MenuTitleUI.statButton.text = MenuTitleUI.localization.format("Stat_Found_Plants", new object[] { num21.ToString("n0"), num22.ToString("n0") }); } else if (MenuTitleUI.stat == EPlayerStat.ACCURACY) { int num23; Provider.provider.statisticsService.userStatisticsService.getStatistic("Accuracy_Shot", out num23); int num24; Provider.provider.statisticsService.userStatisticsService.getStatistic("Accuracy_Hit", out num24); long num25; Provider.provider.statisticsService.globalStatisticsService.getStatistic("Accuracy_Shot", out num25); long num26; Provider.provider.statisticsService.globalStatisticsService.getStatistic("Accuracy_Hit", out num26); float num27; if (num23 == 0 || num24 == 0) { num27 = 0f; } else { num27 = (float)num24 / (float)num23; } double num28; if (num25 == 0L || num26 == 0L) { num28 = 0.0; } else { num28 = (double)num26 / (double)num25; } MenuTitleUI.statButton.text = MenuTitleUI.localization.format("Stat_Accuracy", new object[] { num23.ToString("n0"), (float)((int)(num27 * 10000f)) / 100f, num25.ToString("n0"), (double)((long)(num28 * 10000.0)) / 100.0 }); } else if (MenuTitleUI.stat == EPlayerStat.HEADSHOTS) { int num29; Provider.provider.statisticsService.userStatisticsService.getStatistic("Headshots", out num29); long num30; Provider.provider.statisticsService.globalStatisticsService.getStatistic("Headshots", out num30); MenuTitleUI.statButton.text = MenuTitleUI.localization.format("Stat_Headshots", new object[] { num29.ToString("n0"), num30.ToString("n0") }); } else if (MenuTitleUI.stat == EPlayerStat.TRAVEL_FOOT) { int m; Provider.provider.statisticsService.userStatisticsService.getStatistic("Travel_Foot", out m); long m2; Provider.provider.statisticsService.globalStatisticsService.getStatistic("Travel_Foot", out m2); if (OptionsSettings.metric) { MenuTitleUI.statButton.text = MenuTitleUI.localization.format("Stat_Travel_Foot", new object[] { m.ToString("n0") + " m", m2.ToString("n0") + " m" }); } else { MenuTitleUI.statButton.text = MenuTitleUI.localization.format("Stat_Travel_Foot", new object[] { MeasurementTool.MtoYd(m).ToString("n0") + " yd", MeasurementTool.MtoYd(m2).ToString("n0") + " yd" }); } } else if (MenuTitleUI.stat == EPlayerStat.TRAVEL_VEHICLE) { int m3; Provider.provider.statisticsService.userStatisticsService.getStatistic("Travel_Vehicle", out m3); long m4; Provider.provider.statisticsService.globalStatisticsService.getStatistic("Travel_Vehicle", out m4); if (OptionsSettings.metric) { MenuTitleUI.statButton.text = MenuTitleUI.localization.format("Stat_Travel_Vehicle", new object[] { m3.ToString("n0") + " m", m4.ToString("n0") + " m" }); } else { MenuTitleUI.statButton.text = MenuTitleUI.localization.format("Stat_Travel_Vehicle", new object[] { MeasurementTool.MtoYd(m3).ToString("n0") + " yd", MeasurementTool.MtoYd(m4).ToString("n0") + " yd" }); } } else if (MenuTitleUI.stat == EPlayerStat.ARENA_WINS) { int num31; Provider.provider.statisticsService.userStatisticsService.getStatistic("Arena_Wins", out num31); long num32; Provider.provider.statisticsService.globalStatisticsService.getStatistic("Arena_Wins", out num32); MenuTitleUI.statButton.text = MenuTitleUI.localization.format("Stat_Arena_Wins", new object[] { num31.ToString("n0"), num32.ToString("n0") }); } else if (MenuTitleUI.stat == EPlayerStat.FOUND_BUILDABLES) { int num33; Provider.provider.statisticsService.userStatisticsService.getStatistic("Found_Buildables", out num33); long num34; Provider.provider.statisticsService.globalStatisticsService.getStatistic("Found_Buildables", out num34); MenuTitleUI.statButton.text = MenuTitleUI.localization.format("Stat_Found_Buildables", new object[] { num33.ToString("n0"), num34.ToString("n0") }); } else if (MenuTitleUI.stat == EPlayerStat.FOUND_THROWABLES) { int num35; Provider.provider.statisticsService.userStatisticsService.getStatistic("Found_Throwables", out num35); long num36; Provider.provider.statisticsService.globalStatisticsService.getStatistic("Found_Throwables", out num36); MenuTitleUI.statButton.text = MenuTitleUI.localization.format("Stat_Found_Throwables", new object[] { num35.ToString("n0"), num36.ToString("n0") }); } }