// Token: 0x0600290A RID: 10506 RVA: 0x000FAE20 File Offset: 0x000F9220 private void onRegionUpdated(Player player, byte old_x, byte old_y, byte new_x, byte new_y, byte step, ref bool canIncrementIndex) { if (step == 0) { for (byte b = 0; b < Regions.WORLD_SIZE; b += 1) { for (byte b2 = 0; b2 < Regions.WORLD_SIZE; b2 += 1) { if (Provider.isServer) { if (player.movement.loadedRegions[(int)b, (int)b2].isResourcesLoaded && !Regions.checkArea(b, b2, new_x, new_y, ResourceManager.RESOURCE_REGIONS)) { player.movement.loadedRegions[(int)b, (int)b2].isResourcesLoaded = false; } } else if (player.channel.isOwner && ResourceManager.regions[(int)b, (int)b2].isNetworked && !Regions.checkArea(b, b2, new_x, new_y, ResourceManager.RESOURCE_REGIONS)) { ResourceManager.regions[(int)b, (int)b2].isNetworked = false; } } } } if (step == 3 && Dedicator.isDedicated && Regions.checkSafe((int)new_x, (int)new_y)) { for (int i = (int)(new_x - ResourceManager.RESOURCE_REGIONS); i <= (int)(new_x + ResourceManager.RESOURCE_REGIONS); i++) { for (int j = (int)(new_y - ResourceManager.RESOURCE_REGIONS); j <= (int)(new_y + ResourceManager.RESOURCE_REGIONS); j++) { if (Regions.checkSafe((int)((byte)i), (int)((byte)j)) && !player.movement.loadedRegions[i, j].isResourcesLoaded) { player.movement.loadedRegions[i, j].isResourcesLoaded = true; this.askResources(player.channel.owner.playerID.steamID, (byte)i, (byte)j); } } } } }
public static void repair(Transform structure, float damage, float times) { byte b; byte b2; ushort num; StructureRegion structureRegion; if (StructureManager.tryGetInfo(structure, out b, out b2, out num, out structureRegion) && !structureRegion.structures[(int)num].structure.isDead && !structureRegion.structures[(int)num].structure.isRepaired) { ushort amount = (ushort)(damage * times); structureRegion.structures[(int)num].structure.askRepair(amount); for (int i = 0; i < Provider.clients.Count; i++) { if (Provider.clients[i].player != null && OwnershipTool.checkToggle(Provider.clients[i].playerID.steamID, structureRegion.structures[(int)num].owner, Provider.clients[i].player.quests.groupID, structureRegion.structures[(int)num].group) && Regions.checkArea(b, b2, Provider.clients[i].player.movement.region_x, Provider.clients[i].player.movement.region_y, StructureManager.STRUCTURE_REGIONS)) { StructureManager.manager.channel.send("tellStructureHealth", Provider.clients[i].playerID.steamID, ESteamPacket.UPDATE_UNRELIABLE_BUFFER, new object[] { b, b2, num, (byte)Mathf.RoundToInt((float)structureRegion.structures[(int)num].structure.health / (float)structureRegion.structures[(int)num].structure.asset.health * 100f) }); } } } }
public static void damage(Transform structure, Vector3 direction, float damage, float times, bool armor) { byte b; byte b2; ushort num; StructureRegion structureRegion; if (StructureManager.tryGetInfo(structure, out b, out b2, out num, out structureRegion) && !structureRegion.structures[(int)num].structure.isDead) { if (armor) { times *= Provider.modeConfigData.Structures.Armor_Multiplier; } ushort num2 = (ushort)(damage * times); structureRegion.structures[(int)num].structure.askDamage(num2); if (structureRegion.structures[(int)num].structure.isDead) { ItemStructureAsset itemStructureAsset = (ItemStructureAsset)Assets.find(EAssetType.ITEM, structureRegion.structures[(int)num].structure.id); if (itemStructureAsset != null && itemStructureAsset.explosion != 0) { EffectManager.sendEffect(itemStructureAsset.explosion, EffectManager.SMALL, structure.position + Vector3.down * StructureManager.HEIGHT); } structureRegion.structures.RemoveAt((int)num); StructureManager.manager.channel.send("tellTakeStructure", ESteamCall.ALL, b, b2, StructureManager.STRUCTURE_REGIONS, ESteamPacket.UPDATE_RELIABLE_BUFFER, new object[] { b, b2, num, direction * (float)num2 }); } else { for (int i = 0; i < Provider.clients.Count; i++) { if (Provider.clients[i].player != null && OwnershipTool.checkToggle(Provider.clients[i].playerID.steamID, structureRegion.structures[(int)num].owner, Provider.clients[i].player.quests.groupID, structureRegion.structures[(int)num].group) && Regions.checkArea(b, b2, Provider.clients[i].player.movement.region_x, Provider.clients[i].player.movement.region_y, StructureManager.STRUCTURE_REGIONS)) { StructureManager.manager.channel.send("tellStructureHealth", Provider.clients[i].playerID.steamID, ESteamPacket.UPDATE_UNRELIABLE_BUFFER, new object[] { b, b2, num, (byte)Mathf.RoundToInt((float)structureRegion.structures[(int)num].structure.health / (float)structureRegion.structures[(int)num].structure.asset.health * 100f) }); } } } } }
// Token: 0x0600284E RID: 10318 RVA: 0x000F4AEC File Offset: 0x000F2EEC private void onRegionUpdated(Player player, byte old_x, byte old_y, byte new_x, byte new_y, byte step, ref bool canIncrementIndex) { if (step == 0) { for (byte b = 0; b < Regions.WORLD_SIZE; b += 1) { for (byte b2 = 0; b2 < Regions.WORLD_SIZE; b2 += 1) { if (player.channel.isOwner && ItemManager.regions[(int)b, (int)b2].isNetworked && !Regions.checkArea(b, b2, new_x, new_y, ItemManager.ITEM_REGIONS)) { ItemManager.regions[(int)b, (int)b2].destroy(); ItemManager.regions[(int)b, (int)b2].isNetworked = false; } if (Provider.isServer && player.movement.loadedRegions[(int)b, (int)b2].isItemsLoaded && !Regions.checkArea(b, b2, new_x, new_y, ItemManager.ITEM_REGIONS)) { player.movement.loadedRegions[(int)b, (int)b2].isItemsLoaded = false; } } } } if (step == 5 && Provider.isServer && Regions.checkSafe((int)new_x, (int)new_y)) { for (int i = (int)(new_x - ItemManager.ITEM_REGIONS); i <= (int)(new_x + ItemManager.ITEM_REGIONS); i++) { for (int j = (int)(new_y - ItemManager.ITEM_REGIONS); j <= (int)(new_y + ItemManager.ITEM_REGIONS); j++) { if (Regions.checkSafe((int)((byte)i), (int)((byte)j)) && !player.movement.loadedRegions[i, j].isItemsLoaded) { if (player.channel.isOwner) { this.generateItems((byte)i, (byte)j); } player.movement.loadedRegions[i, j].isItemsLoaded = true; this.askItems(player.channel.owner.playerID.steamID, (byte)i, (byte)j); } } } } }
public void send(ESteamCall mode, byte x, byte y, byte area, ESteamPacket type, int size, byte[] packet) { if (mode == ESteamCall.SERVER) { if (Provider.isServer) { this.receive(Provider.server, packet, 0, size); } else { Provider.send(Provider.server, type, packet, size, this.id); } } else if (mode == ESteamCall.ALL) { if (!Provider.isServer) { Provider.send(Provider.server, type, packet, size, this.id); } for (int i = 0; i < Provider.clients.Count; i++) { if (Provider.clients[i].playerID.steamID != Provider.client && Provider.clients[i].player != null && Regions.checkArea(x, y, Provider.clients[i].player.movement.region_x, Provider.clients[i].player.movement.region_y, area)) { Provider.send(Provider.clients[i].playerID.steamID, type, packet, size, this.id); } } if (Provider.isServer) { this.receive(Provider.server, packet, 0, size); } else { this.receive(Provider.client, packet, 0, size); } } else if (mode == ESteamCall.OTHERS) { if (!Provider.isServer) { Provider.send(Provider.server, type, packet, size, this.id); } for (int j = 0; j < Provider.clients.Count; j++) { if (Provider.clients[j].playerID.steamID != Provider.client && Provider.clients[j].player != null && Regions.checkArea(x, y, Provider.clients[j].player.movement.region_x, Provider.clients[j].player.movement.region_y, area)) { Provider.send(Provider.clients[j].playerID.steamID, type, packet, size, this.id); } } } else if (mode == ESteamCall.OWNER) { if (this.isOwner) { this.receive(this.owner.playerID.steamID, packet, 0, size); } else { Provider.send(this.owner.playerID.steamID, type, packet, size, this.id); } } else if (mode == ESteamCall.NOT_OWNER) { if (!Provider.isServer) { Provider.send(Provider.server, type, packet, size, this.id); } for (int k = 0; k < Provider.clients.Count; k++) { if (Provider.clients[k].playerID.steamID != this.owner.playerID.steamID && Provider.clients[k].player != null && Regions.checkArea(x, y, Provider.clients[k].player.movement.region_x, Provider.clients[k].player.movement.region_y, area)) { Provider.send(Provider.clients[k].playerID.steamID, type, packet, size, this.id); } } } else if (mode == ESteamCall.CLIENTS) { for (int l = 0; l < Provider.clients.Count; l++) { if (Provider.clients[l].playerID.steamID != Provider.client && Provider.clients[l].player != null && Regions.checkArea(x, y, Provider.clients[l].player.movement.region_x, Provider.clients[l].player.movement.region_y, area)) { Provider.send(Provider.clients[l].playerID.steamID, type, packet, size, this.id); } } if (Provider.isClient) { this.receive(Provider.client, packet, 0, size); } } else if (mode == ESteamCall.PEERS) { for (int m = 0; m < Provider.clients.Count; m++) { if (Provider.clients[m].playerID.steamID != Provider.client && Provider.clients[m].player != null && Regions.checkArea(x, y, Provider.clients[m].player.movement.region_x, Provider.clients[m].player.movement.region_y, area)) { Provider.send(Provider.clients[m].playerID.steamID, type, packet, size, this.id); } } } }
private static void onRegionUpdated(Player player, byte old_x, byte old_y, byte new_x, byte new_y, byte step, ref bool canIncrementIndex) { if (step != 0) { return; } for (byte b = 0; b < Regions.WORLD_SIZE; b += 1) { for (byte b2 = 0; b2 < Regions.WORLD_SIZE; b2 += 1) { if (LevelObjects.regions[(int)b, (int)b2] && !Regions.checkArea(b, b2, new_x, new_y, LevelObjects.OBJECT_REGIONS)) { LevelObjects.regions[(int)b, (int)b2] = false; if (LevelObjects.shouldInstantlyLoad) { List <LevelObject> list = LevelObjects.objects[(int)b, (int)b2]; for (int i = 0; i < list.Count; i++) { list[i].disableCollision(); if (!list[i].isSpeciallyCulled) { list[i].disableVisual(); if (list[i].isLandmarkQualityMet) { list[i].enableSkybox(); } } } } else { LevelObjects.loads[(int)b, (int)b2] = 0; } if (Level.isEditor) { List <LevelBuildableObject> list2 = LevelObjects.buildables[(int)b, (int)b2]; for (int j = 0; j < list2.Count; j++) { list2[j].disable(); } } } } } if (Regions.checkSafe((int)new_x, (int)new_y)) { for (int k = (int)(new_x - LevelObjects.OBJECT_REGIONS); k <= (int)(new_x + LevelObjects.OBJECT_REGIONS); k++) { for (int l = (int)(new_y - LevelObjects.OBJECT_REGIONS); l <= (int)(new_y + LevelObjects.OBJECT_REGIONS); l++) { if (Regions.checkSafe((int)((byte)k), (int)((byte)l)) && !LevelObjects.regions[k, l]) { LevelObjects.regions[k, l] = true; if (LevelObjects.shouldInstantlyLoad) { List <LevelObject> list3 = LevelObjects.objects[k, l]; for (int m = 0; m < list3.Count; m++) { list3[m].enableCollision(); if (!list3[m].isSpeciallyCulled) { list3[m].enableVisual(); list3[m].disableSkybox(); } } } else { LevelObjects.loads[k, l] = 0; } if (Level.isEditor) { List <LevelBuildableObject> list4 = LevelObjects.buildables[k, l]; for (int n = 0; n < list4.Count; n++) { list4[n].enable(); } } } } } } Level.isLoadingArea = false; LevelObjects.shouldInstantlyLoad = false; }