// Token: 0x0600284A RID: 10314 RVA: 0x000F4490 File Offset: 0x000F2890 private bool respawnItems() { if (Level.info == null || Level.info.type == ELevelType.ARENA) { return(false); } if (LevelItems.spawns[(int)ItemManager.respawnItems_X, (int)ItemManager.respawnItems_Y].Count > 0) { if (Time.realtimeSinceStartup - ItemManager.regions[(int)ItemManager.respawnItems_X, (int)ItemManager.respawnItems_Y].lastRespawn > Provider.modeConfigData.Items.Respawn_Time && (float)ItemManager.regions[(int)ItemManager.respawnItems_X, (int)ItemManager.respawnItems_Y].items.Count < (float)LevelItems.spawns[(int)ItemManager.respawnItems_X, (int)ItemManager.respawnItems_Y].Count * Provider.modeConfigData.Items.Spawn_Chance) { ItemManager.regions[(int)ItemManager.respawnItems_X, (int)ItemManager.respawnItems_Y].lastRespawn = Time.realtimeSinceStartup; ItemSpawnpoint itemSpawnpoint = LevelItems.spawns[(int)ItemManager.respawnItems_X, (int)ItemManager.respawnItems_Y][UnityEngine.Random.Range(0, LevelItems.spawns[(int)ItemManager.respawnItems_X, (int)ItemManager.respawnItems_Y].Count)]; if (!SafezoneManager.checkPointValid(itemSpawnpoint.point)) { return(false); } ushort num = 0; while ((int)num < ItemManager.regions[(int)ItemManager.respawnItems_X, (int)ItemManager.respawnItems_Y].items.Count) { if ((ItemManager.regions[(int)ItemManager.respawnItems_X, (int)ItemManager.respawnItems_Y].items[(int)num].point - itemSpawnpoint.point).sqrMagnitude < 4f) { return(false); } num += 1; } ushort item = LevelItems.getItem(itemSpawnpoint); ItemAsset itemAsset = (ItemAsset)Assets.find(EAssetType.ITEM, item); if (itemAsset != null) { Item item2 = new Item(item, EItemOrigin.WORLD); ItemData itemData = new ItemData(item2, ItemManager.instanceCount += 1u, itemSpawnpoint.point, false); ItemManager.regions[(int)ItemManager.respawnItems_X, (int)ItemManager.respawnItems_Y].items.Add(itemData); ItemManager.manager.channel.send("tellItem", ESteamCall.CLIENTS, ESteamPacket.UPDATE_RELIABLE_BUFFER, new object[] { ItemManager.respawnItems_X, ItemManager.respawnItems_Y, item2.id, item2.quality, item2.state, itemSpawnpoint.point, itemData.instanceID }); } else { CommandWindow.LogError(string.Concat(new object[] { "Failed to respawn an item with ID ", item, " from type ", itemSpawnpoint.type, "!" })); } } return(false); } return(true); }
// Token: 0x0600284B RID: 10315 RVA: 0x000F475C File Offset: 0x000F2B5C private void generateItems(byte x, byte y) { if (Level.info == null || Level.info.type == ELevelType.ARENA) { return; } List <ItemData> list = new List <ItemData>(); if (LevelItems.spawns[(int)x, (int)y].Count > 0) { List <ItemSpawnpoint> list2 = new List <ItemSpawnpoint>(); for (int i = 0; i < LevelItems.spawns[(int)x, (int)y].Count; i++) { ItemSpawnpoint itemSpawnpoint = LevelItems.spawns[(int)x, (int)y][i]; if (SafezoneManager.checkPointValid(itemSpawnpoint.point)) { list2.Add(itemSpawnpoint); } } while ((float)list.Count < (float)LevelItems.spawns[(int)x, (int)y].Count * Provider.modeConfigData.Items.Spawn_Chance && list2.Count > 0) { int index = UnityEngine.Random.Range(0, list2.Count); ItemSpawnpoint itemSpawnpoint2 = list2[index]; list2.RemoveAt(index); ushort item = LevelItems.getItem(itemSpawnpoint2); ItemAsset itemAsset = (ItemAsset)Assets.find(EAssetType.ITEM, item); if (itemAsset != null) { Item newItem = new Item(item, EItemOrigin.WORLD); list.Add(new ItemData(newItem, ItemManager.instanceCount += 1u, itemSpawnpoint2.point, false)); } else { CommandWindow.LogError(string.Concat(new object[] { "Failed to generate an item with ID ", item, " from type ", itemSpawnpoint2.type, "!" })); } } } for (int j = 0; j < ItemManager.regions[(int)x, (int)y].items.Count; j++) { if (ItemManager.regions[(int)x, (int)y].items[j].isDropped) { list.Add(ItemManager.regions[(int)x, (int)y].items[j]); } } ItemManager.regions[(int)x, (int)y].items = list; }
public void UpdateBoss() { if (this.bossZombie != null) { return; } for (int i = 0; i < Provider.clients.Count; i++) { SteamPlayer steamPlayer = Provider.clients[i]; if (!(steamPlayer.player == null) && !(steamPlayer.player.movement == null) && !(steamPlayer.player.life == null) && !steamPlayer.player.life.isDead) { if (steamPlayer.player.movement.nav == this.nav) { for (int j = 0; j < steamPlayer.player.quests.questsList.Count; j++) { PlayerQuest playerQuest = steamPlayer.player.quests.questsList[j]; if (playerQuest != null && playerQuest.asset != null) { for (int k = 0; k < playerQuest.asset.conditions.Length; k++) { NPCZombieKillsCondition npczombieKillsCondition = playerQuest.asset.conditions[k] as NPCZombieKillsCondition; if (npczombieKillsCondition != null) { if (npczombieKillsCondition.nav == this.nav && npczombieKillsCondition.spawn && !npczombieKillsCondition.isConditionMet(steamPlayer.player)) { Zombie zombie = null; for (int l = 0; l < this.zombies.Count; l++) { Zombie zombie2 = this.zombies[l]; if (zombie2 != null && zombie2.isDead) { zombie = zombie2; break; } } if (zombie == null) { for (int m = 0; m < this.zombies.Count; m++) { Zombie zombie3 = this.zombies[m]; if (zombie3 != null && !zombie3.isHunting) { zombie = zombie3; break; } } } if (zombie == null) { zombie = this.zombies[Random.Range(0, this.zombies.Count)]; } Vector3 position = zombie.transform.position; if (zombie.isDead) { for (int n = 0; n < 10; n++) { ZombieSpawnpoint zombieSpawnpoint = LevelZombies.zombies[(int)this.nav][Random.Range(0, LevelZombies.zombies[(int)this.nav].Count)]; if (SafezoneManager.checkPointValid(zombieSpawnpoint.point)) { break; } position = zombieSpawnpoint.point; position.y += 0.1f; } } this.bossZombie = zombie; this.bossZombie.sendRevive(this.bossZombie.type, (byte)npczombieKillsCondition.zombie, this.bossZombie.shirt, this.bossZombie.pants, this.bossZombie.hat, this.bossZombie.gear, position, Random.Range(0f, 360f)); } } } } } } } } }