From 1cefa46d7cbff46fc14c44ab36b4976047b98c70 Mon Sep 17 00:00:00 2001 From: chai <215380520@qq.com> Date: Mon, 20 May 2024 22:35:55 +0800 Subject: *rename --- Valheim_r202102_v0.141.2/.gitignore | 6 + .../Doc/\344\275\234\345\274\212.txt" | 10 + .../Doc/\345\210\206\346\236\220.xlsx" | Bin 0 -> 1697725 bytes ...4\260\345\275\242\347\224\237\346\210\220.xlsx" | Bin 0 -> 18088 bytes ...215\347\274\226\350\257\221\345\222\214mod.txt" | 9 + .../Doc/\350\257\264\346\230\216.txt" | 1 + .../Valheim/assembly_valheim/.gitignore | 399 ++ .../Valheim/assembly_valheim/AnimalAI.cs | 80 + .../Valheim/assembly_valheim/AnimationEffect.cs | 102 + .../Valheim/assembly_valheim/Aoe.cs | 331 ++ .../Valheim/assembly_valheim/Attack.cs | 988 ++++ .../Valheim/assembly_valheim/AudioMan.cs | 496 ++ .../Valheim/assembly_valheim/AutoJumpLedge.cs | 19 + .../Valheim/assembly_valheim/BaseAI.cs | 1459 ++++++ .../Valheim/assembly_valheim/Beacon.cs | 46 + .../Valheim/assembly_valheim/Bed.cs | 201 + .../Valheim/assembly_valheim/Beehive.cs | 186 + .../Valheim/assembly_valheim/Billboard.cs | 37 + .../Valheim/assembly_valheim/BiomeEnvSetup.cs | 23 + .../Valheim/assembly_valheim/BossStone.cs | 111 + .../Valheim/assembly_valheim/CamShaker.cs | 65 + .../Valheim/assembly_valheim/CameraEffects.cs | 127 + .../Valheim/assembly_valheim/Chair.cs | 73 + .../Valheim/assembly_valheim/ChangeLog.cs | 15 + .../Valheim/assembly_valheim/Character.cs | 2567 +++++++++++ .../Valheim/assembly_valheim/CharacterAnimEvent.cs | 525 +++ .../Valheim/assembly_valheim/CharacterDrop.cs | 118 + .../assembly_valheim/CharacterTimedDestruction.cs | 48 + .../Valheim/assembly_valheim/Chat.cs | 568 +++ .../Valheim/assembly_valheim/CircleProjector.cs | 63 + .../Valheim/assembly_valheim/ClutterSystem.cs | 472 ++ .../Valheim/assembly_valheim/ConnectPanel.cs | 215 + .../Valheim/assembly_valheim/Console.cs | 654 +++ .../Valheim/assembly_valheim/Container.cs | 417 ++ .../Valheim/assembly_valheim/CookingStation.cs | 363 ++ .../Valheim/assembly_valheim/Corpse.cs | 67 + .../Valheim/assembly_valheim/CraftingStation.cs | 317 ++ .../Valheim/assembly_valheim/CreatureSpawner.cs | 160 + .../Valheim/assembly_valheim/DLCMan.cs | 98 + .../Valheim/assembly_valheim/DamageText.cs | 181 + .../Valheim/assembly_valheim/DepthCamera.cs | 39 + .../Valheim/assembly_valheim/Destructible.cs | 213 + .../Valheim/assembly_valheim/DestructibleType.cs | 7 + .../Valheim/assembly_valheim/DistantFogEmitter.cs | 114 + .../Valheim/assembly_valheim/Door.cs | 166 + .../Valheim/assembly_valheim/DreamTexts.cs | 61 + .../Valheim/assembly_valheim/DropOnDestroyed.cs | 46 + .../Valheim/assembly_valheim/DropTable.cs | 152 + .../Valheim/assembly_valheim/DungeonDB.cs | 105 + .../Valheim/assembly_valheim/DungeonGenerator.cs | 787 ++++ .../Valheim/assembly_valheim/EffectArea.cs | 108 + .../Valheim/assembly_valheim/EffectFade.cs | 66 + .../Valheim/assembly_valheim/EffectList.cs | 88 + .../Valheim/assembly_valheim/EmitterRotation.cs | 37 + .../Valheim/assembly_valheim/EnemyHud.cs | 216 + .../Valheim/assembly_valheim/EnvEntry.cs | 12 + .../Valheim/assembly_valheim/EnvMan.cs | 987 ++++ .../Valheim/assembly_valheim/EnvSetup.cs | 108 + .../Valheim/assembly_valheim/EnvZone.cs | 49 + .../Valheim/assembly_valheim/EventZone.cs | 38 + .../Valheim/assembly_valheim/Feedback.cs | 91 + .../Valheim/assembly_valheim/FejdStartup.cs | 1393 ++++++ .../Valheim/assembly_valheim/Fermenter.cs | 342 ++ .../Valheim/assembly_valheim/Fireplace.cs | 307 ++ .../Valheim/assembly_valheim/Fish.cs | 373 ++ .../Valheim/assembly_valheim/FishingFloat.cs | 313 ++ .../Valheim/assembly_valheim/Floating.cs | 174 + .../Valheim/assembly_valheim/FollowPlayer.cs | 37 + .../Valheim/assembly_valheim/FootStep.cs | 401 ++ .../Valheim/assembly_valheim/Game.cs | 575 +++ .../Valheim/assembly_valheim/GameCamera.cs | 663 +++ .../Valheim/assembly_valheim/Gibber.cs | 114 + .../Valheim/assembly_valheim/GlobalWind.cs | 98 + .../Valheim/assembly_valheim/Growup.cs | 34 + .../Valheim/assembly_valheim/GuidePoint.cs | 28 + .../Valheim/assembly_valheim/Heightmap.cs | 1111 +++++ .../Valheim/assembly_valheim/HeightmapBuilder.cs | 273 ++ .../Valheim/assembly_valheim/HitArea.cs | 25 + .../Valheim/assembly_valheim/HitData.cs | 625 +++ .../Valheim/assembly_valheim/HotkeyBar.cs | 156 + .../Valheim/assembly_valheim/HoverText.cs | 16 + .../Valheim/assembly_valheim/Hoverable.cs | 6 + .../Valheim/assembly_valheim/Hud.cs | 1171 +++++ .../Valheim/assembly_valheim/Humanoid.cs | 1550 +++++++ .../Valheim/assembly_valheim/IDestructible.cs | 6 + .../Valheim/assembly_valheim/IEquipmentVisual.cs | 4 + .../Valheim/assembly_valheim/IProjectile.cs | 8 + .../Valheim/assembly_valheim/ISocket.cs | 30 + .../Valheim/assembly_valheim/IWaterInteractable.cs | 10 + .../Valheim/assembly_valheim/ImpactEffect.cs | 159 + .../Valheim/assembly_valheim/InputFieldSubmit.cs | 24 + .../Valheim/assembly_valheim/InstanceRenderer.cs | 176 + .../Valheim/assembly_valheim/InstantiatePrefab.cs | 22 + .../Valheim/assembly_valheim/Interactable.cs | 6 + .../Valheim/assembly_valheim/Interpolate.cs | 456 ++ .../Valheim/assembly_valheim/Inventory.cs | 755 ++++ .../Valheim/assembly_valheim/InventoryGrid.cs | 378 ++ .../Valheim/assembly_valheim/InventoryGui.cs | 1535 +++++++ .../Valheim/assembly_valheim/ItemDrop.cs | 970 ++++ .../Valheim/assembly_valheim/ItemStand.cs | 392 ++ .../Valheim/assembly_valheim/ItemStyle.cs | 9 + .../Valheim/assembly_valheim/KeyHints.cs | 95 + .../Valheim/assembly_valheim/Ladder.cs | 50 + .../Valheim/assembly_valheim/Ledge.cs | 40 + .../Valheim/assembly_valheim/LevelEffects.cs | 99 + .../Valheim/assembly_valheim/Leviathan.cs | 91 + .../Valheim/assembly_valheim/LightFlicker.cs | 71 + .../Valheim/assembly_valheim/LightLod.cs | 106 + .../Valheim/assembly_valheim/LineAttach.cs | 27 + .../Valheim/assembly_valheim/LineConnect.cs | 141 + .../Valheim/assembly_valheim/Location.cs | 118 + .../Valheim/assembly_valheim/LocationProxy.cs | 43 + .../Valheim/assembly_valheim/LodFadeInOut.cs | 30 + .../Valheim/assembly_valheim/LootSpawner.cs | 89 + .../Valheim/assembly_valheim/MasterClient.cs | 291 ++ .../Valheim/assembly_valheim/MeleeWeaponTrail.cs | 344 ++ .../Valheim/assembly_valheim/Menu.cs | 131 + .../Valheim/assembly_valheim/MenuScene.cs | 41 + .../Valheim/assembly_valheim/MenuShipMovement.cs | 23 + .../Valheim/assembly_valheim/MessageHud.cs | 305 ++ .../Valheim/assembly_valheim/MineRock.cs | 233 + .../Valheim/assembly_valheim/MineRock5.cs | 472 ++ .../Valheim/assembly_valheim/Minimap.cs | 1463 ++++++ .../Valheim/assembly_valheim/MistEmitter.cs | 91 + .../Valheim/assembly_valheim/MonsterAI.cs | 744 +++ .../Valheim/assembly_valheim/MovementTest.cs | 30 + .../Valheim/assembly_valheim/MusicMan.cs | 473 ++ .../Valheim/assembly_valheim/NavmeshTest.cs | 62 + .../Valheim/assembly_valheim/ObjectDB.cs | 104 + .../Valheim/assembly_valheim/Odin.cs | 55 + .../Valheim/assembly_valheim/OfferingBowl.cs | 213 + .../Valheim/assembly_valheim/ParticleDecal.cs | 42 + .../Valheim/assembly_valheim/Pathfinding.cs | 754 ++++ .../Valheim/assembly_valheim/Pickable.cs | 146 + .../Valheim/assembly_valheim/PickableItem.cs | 194 + .../Valheim/assembly_valheim/Piece.cs | 332 ++ .../Valheim/assembly_valheim/PieceTable.cs | 224 + .../Valheim/assembly_valheim/Plant.cs | 243 + .../Valheim/assembly_valheim/Player.cs | 4732 ++++++++++++++++++++ .../Valheim/assembly_valheim/PlayerController.cs | 173 + .../Valheim/assembly_valheim/PlayerCustomizaton.cs | 176 + .../Valheim/assembly_valheim/PlayerProfile.cs | 444 ++ .../Valheim/assembly_valheim/PointGenerator.cs | 70 + .../Valheim/assembly_valheim/PrivateArea.cs | 546 +++ .../Valheim/assembly_valheim/Procreation.cs | 144 + .../Valheim/assembly_valheim/Projectile.cs | 375 ++ .../assembly_valheim/Properties/AssemblyInfo.cs | 5 + .../Valheim/assembly_valheim/Ragdoll.cs | 193 + .../Valheim/assembly_valheim/RandEventSystem.cs | 504 +++ .../Valheim/assembly_valheim/RandomAnimation.cs | 101 + .../Valheim/assembly_valheim/RandomEvent.cs | 119 + .../Valheim/assembly_valheim/RandomFlyingBird.cs | 273 ++ .../Valheim/assembly_valheim/RandomIdle.cs | 48 + .../Valheim/assembly_valheim/RandomMovement.cs | 22 + .../Valheim/assembly_valheim/RandomSpawn.cs | 59 + .../Valheim/assembly_valheim/RandomSpeak.cs | 45 + .../Valheim/assembly_valheim/Raven.cs | 563 +++ .../Valheim/assembly_valheim/Recipe.cs | 37 + .../Valheim/assembly_valheim/ReflectionUpdate.cs | 84 + .../Valheim/assembly_valheim/Room.cs | 119 + .../Valheim/assembly_valheim/RoomConnection.cs | 35 + .../Valheim/assembly_valheim/RopeAttachment.cs | 66 + .../Valheim/assembly_valheim/RoutedMethod.cs | 74 + .../Valheim/assembly_valheim/RoutedMethodBase.cs | 4 + .../Valheim/assembly_valheim/RuneStone.cs | 83 + .../Valheim/assembly_valheim/SEMan.cs | 321 ++ .../Valheim/assembly_valheim/SE_Burning.cs | 54 + .../Valheim/assembly_valheim/SE_Cozy.cs | 34 + .../Valheim/assembly_valheim/SE_Finder.cs | 71 + .../Valheim/assembly_valheim/SE_Frost.cs | 36 + .../Valheim/assembly_valheim/SE_Harpooned.cs | 128 + .../Valheim/assembly_valheim/SE_HealthUpgrade.cs | 36 + .../Valheim/assembly_valheim/SE_Poison.cs | 50 + .../Valheim/assembly_valheim/SE_Rested.cs | 98 + .../Valheim/assembly_valheim/SE_Shield.cs | 36 + .../Valheim/assembly_valheim/SE_Smoke.cs | 34 + .../Valheim/assembly_valheim/SE_Spawn.cs | 32 + .../Valheim/assembly_valheim/SE_Stats.cs | 322 ++ .../Valheim/assembly_valheim/SE_Wet.cs | 41 + .../Valheim/assembly_valheim/SceneLoader.cs | 23 + .../assembly_valheim/ScrollRectEnsureVisible.cs | 93 + .../Valheim/assembly_valheim/ServerCtrl.cs | 53 + .../Valheim/assembly_valheim/Settings.cs | 582 +++ .../Valheim/assembly_valheim/Ship.cs | 746 +++ .../Valheim/assembly_valheim/ShipConstructor.cs | 58 + .../Valheim/assembly_valheim/ShipControlls.cs | 175 + .../Valheim/assembly_valheim/ShipEffects.cs | 150 + .../Valheim/assembly_valheim/ShuffleClass.cs | 20 + .../Valheim/assembly_valheim/Sign.cs | 82 + .../Valheim/assembly_valheim/Skills.cs | 333 ++ .../Valheim/assembly_valheim/SkillsDialog.cs | 56 + .../Valheim/assembly_valheim/SleepText.cs | 43 + .../Valheim/assembly_valheim/SlowUpdate.cs | 34 + .../Valheim/assembly_valheim/SlowUpdater.cs | 41 + .../Valheim/assembly_valheim/Smelter.cs | 519 +++ .../Valheim/assembly_valheim/Smoke.cs | 128 + .../Valheim/assembly_valheim/SmokeLod.cs | 5 + .../Valheim/assembly_valheim/SmokeRenderer.cs | 26 + .../Valheim/assembly_valheim/SmokeSpawner.cs | 73 + .../Valheim/assembly_valheim/SnapToGround.cs | 63 + .../Valheim/assembly_valheim/SpawnAbility.cs | 164 + .../Valheim/assembly_valheim/SpawnArea.cs | 198 + .../Valheim/assembly_valheim/SpawnOnDamaged.cs | 29 + .../Valheim/assembly_valheim/SpawnSystem.cs | 510 +++ .../Valheim/assembly_valheim/StateController.cs | 53 + .../Valheim/assembly_valheim/StaticPhysics.cs | 122 + .../Valheim/assembly_valheim/StaticTarget.cs | 80 + .../Valheim/assembly_valheim/StationExtension.cs | 158 + .../Valheim/assembly_valheim/StatusEffect.cs | 268 ++ .../Valheim/assembly_valheim/StealthSystem.cs | 83 + .../Valheim/assembly_valheim/SteamManager.cs | 166 + .../Valheim/assembly_valheim/StoreGui.cs | 354 ++ .../Valheim/assembly_valheim/Switch.cs | 56 + .../Valheim/assembly_valheim/Tail.cs | 116 + .../Valheim/assembly_valheim/Talker.cs | 60 + .../Valheim/assembly_valheim/Tameable.cs | 239 + .../Valheim/assembly_valheim/Teleport.cs | 64 + .../Valheim/assembly_valheim/TeleportHome.cs | 13 + .../Valheim/assembly_valheim/TeleportWorld.cs | 159 + .../assembly_valheim/TeleportWorldTrigger.cs | 21 + .../Valheim/assembly_valheim/TerrainLod.cs | 37 + .../Valheim/assembly_valheim/TerrainModifier.cs | 246 + .../Valheim/assembly_valheim/TestCollision.cs | 19 + .../Valheim/assembly_valheim/TestSceneCharacter.cs | 82 + .../Valheim/assembly_valheim/TestSceneSetup.cs | 13 + .../Valheim/assembly_valheim/TextInput.cs | 93 + .../Valheim/assembly_valheim/TextReceiver.cs | 6 + .../Valheim/assembly_valheim/TextViewer.cs | 155 + .../Valheim/assembly_valheim/TextsDialog.cs | 196 + .../Valheim/assembly_valheim/ThorFly.cs | 24 + .../Valheim/assembly_valheim/Thunder.cs | 133 + .../Valheim/assembly_valheim/TimedDestruction.cs | 51 + .../Valheim/assembly_valheim/ToggleImage.cs | 30 + .../Valheim/assembly_valheim/ToggleSwitch.cs | 53 + .../Valheim/assembly_valheim/TombStone.cs | 217 + .../Valheim/assembly_valheim/Tracker.cs | 34 + .../Valheim/assembly_valheim/Trader.cs | 168 + .../Valheim/assembly_valheim/TreeBase.cs | 183 + .../Valheim/assembly_valheim/TreeLog.cs | 139 + .../Valheim/assembly_valheim/Tutorial.cs | 64 + .../Valheim/assembly_valheim/Vagon.cs | 333 ++ .../Valheim/assembly_valheim/Valheim.csproj | 273 ++ .../Valheim/assembly_valheim/Valheim.sln | 25 + .../Valheim/assembly_valheim/Valkyrie.cs | 192 + .../Valheim/assembly_valheim/VariantDialog.cs | 58 + .../Valheim/assembly_valheim/Vegvisir.cs | 38 + .../Valheim/assembly_valheim/Version.cs | 101 + .../Valheim/assembly_valheim/VisEquipment.cs | 1022 +++++ .../Valheim/assembly_valheim/WaterMark.cs | 12 + .../Valheim/assembly_valheim/WaterTrigger.cs | 24 + .../Valheim/assembly_valheim/WaterVolume.cs | 237 + .../Valheim/assembly_valheim/WayStone.cs | 71 + .../Valheim/assembly_valheim/WearNTear.cs | 792 ++++ .../Valheim/assembly_valheim/WearNTearUpdater.cs | 41 + .../Valheim/assembly_valheim/Windmill.cs | 91 + .../Valheim/assembly_valheim/World.cs | 236 + .../Valheim/assembly_valheim/WorldGenerator.cs | 1069 +++++ .../Valheim/assembly_valheim/ZBroastcast.cs | 174 + .../Valheim/assembly_valheim/ZConnector.cs | 150 + .../Valheim/assembly_valheim/ZConnector2.cs | 131 + .../Valheim/assembly_valheim/ZDO.cs | 1076 +++++ .../Valheim/assembly_valheim/ZDOComparer.cs | 14 + .../Valheim/assembly_valheim/ZDOID.cs | 105 + .../Valheim/assembly_valheim/ZDOMan.cs | 1207 +++++ .../Valheim/assembly_valheim/ZDOPool.cs | 69 + .../Valheim/assembly_valheim/ZNat.cs | 32 + .../Valheim/assembly_valheim/ZNet.cs | 1488 ++++++ .../Valheim/assembly_valheim/ZNetPeer.cs | 44 + .../Valheim/assembly_valheim/ZNetScene.cs | 423 ++ .../Valheim/assembly_valheim/ZNetView.cs | 226 + .../Valheim/assembly_valheim/ZNtp.cs | 137 + .../Valheim/assembly_valheim/ZPackage.cs | 293 ++ .../Valheim/assembly_valheim/ZRoutedRpc.cs | 234 + .../Valheim/assembly_valheim/ZRpc.cs | 405 ++ .../Valheim/assembly_valheim/ZSFX.cs | 219 + .../Valheim/assembly_valheim/ZSocket.cs | 449 ++ .../Valheim/assembly_valheim/ZSocket2.cs | 440 ++ .../Valheim/assembly_valheim/ZSteamMatchmaking.cs | 427 ++ .../Valheim/assembly_valheim/ZSteamSocket.cs | 340 ++ .../Valheim/assembly_valheim/ZSyncAnimation.cs | 217 + .../Valheim/assembly_valheim/ZSyncTransform.cs | 327 ++ .../Valheim/assembly_valheim/ZoneSystem.cs | 1712 +++++++ Valheim_r202102_v0.141.2/valheim.zip | Bin 0 -> 669155069 bytes Valheim_v202102/.gitignore | 6 - "Valheim_v202102/Doc/\344\275\234\345\274\212.txt" | 10 - .../Doc/\345\210\206\346\236\220.xlsx" | Bin 1697725 -> 0 bytes ...4\260\345\275\242\347\224\237\346\210\220.xlsx" | Bin 18088 -> 0 bytes ...215\347\274\226\350\257\221\345\222\214mod.txt" | 9 - "Valheim_v202102/Doc/\350\257\264\346\230\216.txt" | 1 - .../Valheim/assembly_valheim/.gitignore | 399 -- .../Valheim/assembly_valheim/AnimalAI.cs | 80 - .../Valheim/assembly_valheim/AnimationEffect.cs | 102 - Valheim_v202102/Valheim/assembly_valheim/Aoe.cs | 331 -- Valheim_v202102/Valheim/assembly_valheim/Attack.cs | 988 ---- .../Valheim/assembly_valheim/AudioMan.cs | 496 -- .../Valheim/assembly_valheim/AutoJumpLedge.cs | 19 - Valheim_v202102/Valheim/assembly_valheim/BaseAI.cs | 1459 ------ Valheim_v202102/Valheim/assembly_valheim/Beacon.cs | 46 - Valheim_v202102/Valheim/assembly_valheim/Bed.cs | 201 - .../Valheim/assembly_valheim/Beehive.cs | 186 - .../Valheim/assembly_valheim/Billboard.cs | 37 - .../Valheim/assembly_valheim/BiomeEnvSetup.cs | 23 - .../Valheim/assembly_valheim/BossStone.cs | 111 - .../Valheim/assembly_valheim/CamShaker.cs | 65 - .../Valheim/assembly_valheim/CameraEffects.cs | 127 - Valheim_v202102/Valheim/assembly_valheim/Chair.cs | 73 - .../Valheim/assembly_valheim/ChangeLog.cs | 15 - .../Valheim/assembly_valheim/Character.cs | 2567 ----------- .../Valheim/assembly_valheim/CharacterAnimEvent.cs | 525 --- .../Valheim/assembly_valheim/CharacterDrop.cs | 118 - .../assembly_valheim/CharacterTimedDestruction.cs | 48 - Valheim_v202102/Valheim/assembly_valheim/Chat.cs | 568 --- .../Valheim/assembly_valheim/CircleProjector.cs | 63 - .../Valheim/assembly_valheim/ClutterSystem.cs | 472 -- .../Valheim/assembly_valheim/ConnectPanel.cs | 215 - .../Valheim/assembly_valheim/Console.cs | 654 --- .../Valheim/assembly_valheim/Container.cs | 417 -- .../Valheim/assembly_valheim/CookingStation.cs | 363 -- Valheim_v202102/Valheim/assembly_valheim/Corpse.cs | 67 - .../Valheim/assembly_valheim/CraftingStation.cs | 317 -- .../Valheim/assembly_valheim/CreatureSpawner.cs | 160 - Valheim_v202102/Valheim/assembly_valheim/DLCMan.cs | 98 - .../Valheim/assembly_valheim/DamageText.cs | 181 - .../Valheim/assembly_valheim/DepthCamera.cs | 39 - .../Valheim/assembly_valheim/Destructible.cs | 213 - .../Valheim/assembly_valheim/DestructibleType.cs | 7 - .../Valheim/assembly_valheim/DistantFogEmitter.cs | 114 - Valheim_v202102/Valheim/assembly_valheim/Door.cs | 166 - .../Valheim/assembly_valheim/DreamTexts.cs | 61 - .../Valheim/assembly_valheim/DropOnDestroyed.cs | 46 - .../Valheim/assembly_valheim/DropTable.cs | 152 - .../Valheim/assembly_valheim/DungeonDB.cs | 105 - .../Valheim/assembly_valheim/DungeonGenerator.cs | 787 ---- .../Valheim/assembly_valheim/EffectArea.cs | 108 - .../Valheim/assembly_valheim/EffectFade.cs | 66 - .../Valheim/assembly_valheim/EffectList.cs | 88 - .../Valheim/assembly_valheim/EmitterRotation.cs | 37 - .../Valheim/assembly_valheim/EnemyHud.cs | 216 - .../Valheim/assembly_valheim/EnvEntry.cs | 12 - Valheim_v202102/Valheim/assembly_valheim/EnvMan.cs | 987 ---- .../Valheim/assembly_valheim/EnvSetup.cs | 108 - .../Valheim/assembly_valheim/EnvZone.cs | 49 - .../Valheim/assembly_valheim/EventZone.cs | 38 - .../Valheim/assembly_valheim/Feedback.cs | 91 - .../Valheim/assembly_valheim/FejdStartup.cs | 1393 ------ .../Valheim/assembly_valheim/Fermenter.cs | 342 -- .../Valheim/assembly_valheim/Fireplace.cs | 307 -- Valheim_v202102/Valheim/assembly_valheim/Fish.cs | 373 -- .../Valheim/assembly_valheim/FishingFloat.cs | 313 -- .../Valheim/assembly_valheim/Floating.cs | 174 - .../Valheim/assembly_valheim/FollowPlayer.cs | 37 - .../Valheim/assembly_valheim/FootStep.cs | 401 -- Valheim_v202102/Valheim/assembly_valheim/Game.cs | 575 --- .../Valheim/assembly_valheim/GameCamera.cs | 663 --- Valheim_v202102/Valheim/assembly_valheim/Gibber.cs | 114 - .../Valheim/assembly_valheim/GlobalWind.cs | 98 - Valheim_v202102/Valheim/assembly_valheim/Growup.cs | 34 - .../Valheim/assembly_valheim/GuidePoint.cs | 28 - .../Valheim/assembly_valheim/Heightmap.cs | 1111 ----- .../Valheim/assembly_valheim/HeightmapBuilder.cs | 273 -- .../Valheim/assembly_valheim/HitArea.cs | 25 - .../Valheim/assembly_valheim/HitData.cs | 625 --- .../Valheim/assembly_valheim/HotkeyBar.cs | 156 - .../Valheim/assembly_valheim/HoverText.cs | 16 - .../Valheim/assembly_valheim/Hoverable.cs | 6 - Valheim_v202102/Valheim/assembly_valheim/Hud.cs | 1171 ----- .../Valheim/assembly_valheim/Humanoid.cs | 1550 ------- .../Valheim/assembly_valheim/IDestructible.cs | 6 - .../Valheim/assembly_valheim/IEquipmentVisual.cs | 4 - .../Valheim/assembly_valheim/IProjectile.cs | 8 - .../Valheim/assembly_valheim/ISocket.cs | 30 - .../Valheim/assembly_valheim/IWaterInteractable.cs | 10 - .../Valheim/assembly_valheim/ImpactEffect.cs | 159 - .../Valheim/assembly_valheim/InputFieldSubmit.cs | 24 - .../Valheim/assembly_valheim/InstanceRenderer.cs | 176 - .../Valheim/assembly_valheim/InstantiatePrefab.cs | 22 - .../Valheim/assembly_valheim/Interactable.cs | 6 - .../Valheim/assembly_valheim/Interpolate.cs | 456 -- .../Valheim/assembly_valheim/Inventory.cs | 755 ---- .../Valheim/assembly_valheim/InventoryGrid.cs | 378 -- .../Valheim/assembly_valheim/InventoryGui.cs | 1535 ------- .../Valheim/assembly_valheim/ItemDrop.cs | 970 ---- .../Valheim/assembly_valheim/ItemStand.cs | 392 -- .../Valheim/assembly_valheim/ItemStyle.cs | 9 - .../Valheim/assembly_valheim/KeyHints.cs | 95 - Valheim_v202102/Valheim/assembly_valheim/Ladder.cs | 50 - Valheim_v202102/Valheim/assembly_valheim/Ledge.cs | 40 - .../Valheim/assembly_valheim/LevelEffects.cs | 99 - .../Valheim/assembly_valheim/Leviathan.cs | 91 - .../Valheim/assembly_valheim/LightFlicker.cs | 71 - .../Valheim/assembly_valheim/LightLod.cs | 106 - .../Valheim/assembly_valheim/LineAttach.cs | 27 - .../Valheim/assembly_valheim/LineConnect.cs | 141 - .../Valheim/assembly_valheim/Location.cs | 118 - .../Valheim/assembly_valheim/LocationProxy.cs | 43 - .../Valheim/assembly_valheim/LodFadeInOut.cs | 30 - .../Valheim/assembly_valheim/LootSpawner.cs | 89 - .../Valheim/assembly_valheim/MasterClient.cs | 291 -- .../Valheim/assembly_valheim/MeleeWeaponTrail.cs | 344 -- Valheim_v202102/Valheim/assembly_valheim/Menu.cs | 131 - .../Valheim/assembly_valheim/MenuScene.cs | 41 - .../Valheim/assembly_valheim/MenuShipMovement.cs | 23 - .../Valheim/assembly_valheim/MessageHud.cs | 305 -- .../Valheim/assembly_valheim/MineRock.cs | 233 - .../Valheim/assembly_valheim/MineRock5.cs | 472 -- .../Valheim/assembly_valheim/Minimap.cs | 1463 ------ .../Valheim/assembly_valheim/MistEmitter.cs | 91 - .../Valheim/assembly_valheim/MonsterAI.cs | 744 --- .../Valheim/assembly_valheim/MovementTest.cs | 30 - .../Valheim/assembly_valheim/MusicMan.cs | 473 -- .../Valheim/assembly_valheim/NavmeshTest.cs | 62 - .../Valheim/assembly_valheim/ObjectDB.cs | 104 - Valheim_v202102/Valheim/assembly_valheim/Odin.cs | 55 - .../Valheim/assembly_valheim/OfferingBowl.cs | 213 - .../Valheim/assembly_valheim/ParticleDecal.cs | 42 - .../Valheim/assembly_valheim/Pathfinding.cs | 754 ---- .../Valheim/assembly_valheim/Pickable.cs | 146 - .../Valheim/assembly_valheim/PickableItem.cs | 194 - Valheim_v202102/Valheim/assembly_valheim/Piece.cs | 332 -- .../Valheim/assembly_valheim/PieceTable.cs | 224 - Valheim_v202102/Valheim/assembly_valheim/Plant.cs | 243 - Valheim_v202102/Valheim/assembly_valheim/Player.cs | 4732 -------------------- .../Valheim/assembly_valheim/PlayerController.cs | 173 - .../Valheim/assembly_valheim/PlayerCustomizaton.cs | 176 - .../Valheim/assembly_valheim/PlayerProfile.cs | 444 -- .../Valheim/assembly_valheim/PointGenerator.cs | 70 - .../Valheim/assembly_valheim/PrivateArea.cs | 546 --- .../Valheim/assembly_valheim/Procreation.cs | 144 - .../Valheim/assembly_valheim/Projectile.cs | 375 -- .../assembly_valheim/Properties/AssemblyInfo.cs | 5 - .../Valheim/assembly_valheim/Ragdoll.cs | 193 - .../Valheim/assembly_valheim/RandEventSystem.cs | 504 --- .../Valheim/assembly_valheim/RandomAnimation.cs | 101 - .../Valheim/assembly_valheim/RandomEvent.cs | 119 - .../Valheim/assembly_valheim/RandomFlyingBird.cs | 273 -- .../Valheim/assembly_valheim/RandomIdle.cs | 48 - .../Valheim/assembly_valheim/RandomMovement.cs | 22 - .../Valheim/assembly_valheim/RandomSpawn.cs | 59 - .../Valheim/assembly_valheim/RandomSpeak.cs | 45 - Valheim_v202102/Valheim/assembly_valheim/Raven.cs | 563 --- Valheim_v202102/Valheim/assembly_valheim/Recipe.cs | 37 - .../Valheim/assembly_valheim/ReflectionUpdate.cs | 84 - Valheim_v202102/Valheim/assembly_valheim/Room.cs | 119 - .../Valheim/assembly_valheim/RoomConnection.cs | 35 - .../Valheim/assembly_valheim/RopeAttachment.cs | 66 - .../Valheim/assembly_valheim/RoutedMethod.cs | 74 - .../Valheim/assembly_valheim/RoutedMethodBase.cs | 4 - .../Valheim/assembly_valheim/RuneStone.cs | 83 - Valheim_v202102/Valheim/assembly_valheim/SEMan.cs | 321 -- .../Valheim/assembly_valheim/SE_Burning.cs | 54 - .../Valheim/assembly_valheim/SE_Cozy.cs | 34 - .../Valheim/assembly_valheim/SE_Finder.cs | 71 - .../Valheim/assembly_valheim/SE_Frost.cs | 36 - .../Valheim/assembly_valheim/SE_Harpooned.cs | 128 - .../Valheim/assembly_valheim/SE_HealthUpgrade.cs | 36 - .../Valheim/assembly_valheim/SE_Poison.cs | 50 - .../Valheim/assembly_valheim/SE_Rested.cs | 98 - .../Valheim/assembly_valheim/SE_Shield.cs | 36 - .../Valheim/assembly_valheim/SE_Smoke.cs | 34 - .../Valheim/assembly_valheim/SE_Spawn.cs | 32 - .../Valheim/assembly_valheim/SE_Stats.cs | 322 -- Valheim_v202102/Valheim/assembly_valheim/SE_Wet.cs | 41 - .../Valheim/assembly_valheim/SceneLoader.cs | 23 - .../assembly_valheim/ScrollRectEnsureVisible.cs | 93 - .../Valheim/assembly_valheim/ServerCtrl.cs | 53 - .../Valheim/assembly_valheim/Settings.cs | 582 --- Valheim_v202102/Valheim/assembly_valheim/Ship.cs | 746 --- .../Valheim/assembly_valheim/ShipConstructor.cs | 58 - .../Valheim/assembly_valheim/ShipControlls.cs | 175 - .../Valheim/assembly_valheim/ShipEffects.cs | 150 - .../Valheim/assembly_valheim/ShuffleClass.cs | 20 - Valheim_v202102/Valheim/assembly_valheim/Sign.cs | 82 - Valheim_v202102/Valheim/assembly_valheim/Skills.cs | 333 -- .../Valheim/assembly_valheim/SkillsDialog.cs | 56 - .../Valheim/assembly_valheim/SleepText.cs | 43 - .../Valheim/assembly_valheim/SlowUpdate.cs | 34 - .../Valheim/assembly_valheim/SlowUpdater.cs | 41 - .../Valheim/assembly_valheim/Smelter.cs | 519 --- Valheim_v202102/Valheim/assembly_valheim/Smoke.cs | 128 - .../Valheim/assembly_valheim/SmokeLod.cs | 5 - .../Valheim/assembly_valheim/SmokeRenderer.cs | 26 - .../Valheim/assembly_valheim/SmokeSpawner.cs | 73 - .../Valheim/assembly_valheim/SnapToGround.cs | 63 - .../Valheim/assembly_valheim/SpawnAbility.cs | 164 - .../Valheim/assembly_valheim/SpawnArea.cs | 198 - .../Valheim/assembly_valheim/SpawnOnDamaged.cs | 29 - .../Valheim/assembly_valheim/SpawnSystem.cs | 510 --- .../Valheim/assembly_valheim/StateController.cs | 53 - .../Valheim/assembly_valheim/StaticPhysics.cs | 122 - .../Valheim/assembly_valheim/StaticTarget.cs | 80 - .../Valheim/assembly_valheim/StationExtension.cs | 158 - .../Valheim/assembly_valheim/StatusEffect.cs | 268 -- .../Valheim/assembly_valheim/StealthSystem.cs | 83 - .../Valheim/assembly_valheim/SteamManager.cs | 166 - .../Valheim/assembly_valheim/StoreGui.cs | 354 -- Valheim_v202102/Valheim/assembly_valheim/Switch.cs | 56 - Valheim_v202102/Valheim/assembly_valheim/Tail.cs | 116 - Valheim_v202102/Valheim/assembly_valheim/Talker.cs | 60 - .../Valheim/assembly_valheim/Tameable.cs | 239 - .../Valheim/assembly_valheim/Teleport.cs | 64 - .../Valheim/assembly_valheim/TeleportHome.cs | 13 - .../Valheim/assembly_valheim/TeleportWorld.cs | 159 - .../assembly_valheim/TeleportWorldTrigger.cs | 21 - .../Valheim/assembly_valheim/TerrainLod.cs | 37 - .../Valheim/assembly_valheim/TerrainModifier.cs | 246 - .../Valheim/assembly_valheim/TestCollision.cs | 19 - .../Valheim/assembly_valheim/TestSceneCharacter.cs | 82 - .../Valheim/assembly_valheim/TestSceneSetup.cs | 13 - .../Valheim/assembly_valheim/TextInput.cs | 93 - .../Valheim/assembly_valheim/TextReceiver.cs | 6 - .../Valheim/assembly_valheim/TextViewer.cs | 155 - .../Valheim/assembly_valheim/TextsDialog.cs | 196 - .../Valheim/assembly_valheim/ThorFly.cs | 24 - .../Valheim/assembly_valheim/Thunder.cs | 133 - .../Valheim/assembly_valheim/TimedDestruction.cs | 51 - .../Valheim/assembly_valheim/ToggleImage.cs | 30 - .../Valheim/assembly_valheim/ToggleSwitch.cs | 53 - .../Valheim/assembly_valheim/TombStone.cs | 217 - .../Valheim/assembly_valheim/Tracker.cs | 34 - Valheim_v202102/Valheim/assembly_valheim/Trader.cs | 168 - .../Valheim/assembly_valheim/TreeBase.cs | 183 - .../Valheim/assembly_valheim/TreeLog.cs | 139 - .../Valheim/assembly_valheim/Tutorial.cs | 64 - Valheim_v202102/Valheim/assembly_valheim/Vagon.cs | 333 -- .../Valheim/assembly_valheim/Valheim.csproj | 273 -- .../Valheim/assembly_valheim/Valheim.sln | 25 - .../Valheim/assembly_valheim/Valkyrie.cs | 192 - .../Valheim/assembly_valheim/VariantDialog.cs | 58 - .../Valheim/assembly_valheim/Vegvisir.cs | 38 - .../Valheim/assembly_valheim/Version.cs | 101 - .../Valheim/assembly_valheim/VisEquipment.cs | 1022 ----- .../Valheim/assembly_valheim/WaterMark.cs | 12 - .../Valheim/assembly_valheim/WaterTrigger.cs | 24 - .../Valheim/assembly_valheim/WaterVolume.cs | 237 - .../Valheim/assembly_valheim/WayStone.cs | 71 - .../Valheim/assembly_valheim/WearNTear.cs | 792 ---- .../Valheim/assembly_valheim/WearNTearUpdater.cs | 41 - .../Valheim/assembly_valheim/Windmill.cs | 91 - Valheim_v202102/Valheim/assembly_valheim/World.cs | 236 - .../Valheim/assembly_valheim/WorldGenerator.cs | 1069 ----- .../Valheim/assembly_valheim/ZBroastcast.cs | 174 - .../Valheim/assembly_valheim/ZConnector.cs | 150 - .../Valheim/assembly_valheim/ZConnector2.cs | 131 - Valheim_v202102/Valheim/assembly_valheim/ZDO.cs | 1076 ----- .../Valheim/assembly_valheim/ZDOComparer.cs | 14 - Valheim_v202102/Valheim/assembly_valheim/ZDOID.cs | 105 - Valheim_v202102/Valheim/assembly_valheim/ZDOMan.cs | 1207 ----- .../Valheim/assembly_valheim/ZDOPool.cs | 69 - Valheim_v202102/Valheim/assembly_valheim/ZNat.cs | 32 - Valheim_v202102/Valheim/assembly_valheim/ZNet.cs | 1488 ------ .../Valheim/assembly_valheim/ZNetPeer.cs | 44 - .../Valheim/assembly_valheim/ZNetScene.cs | 423 -- .../Valheim/assembly_valheim/ZNetView.cs | 226 - Valheim_v202102/Valheim/assembly_valheim/ZNtp.cs | 137 - .../Valheim/assembly_valheim/ZPackage.cs | 293 -- .../Valheim/assembly_valheim/ZRoutedRpc.cs | 234 - Valheim_v202102/Valheim/assembly_valheim/ZRpc.cs | 405 -- Valheim_v202102/Valheim/assembly_valheim/ZSFX.cs | 219 - .../Valheim/assembly_valheim/ZSocket.cs | 449 -- .../Valheim/assembly_valheim/ZSocket2.cs | 440 -- .../Valheim/assembly_valheim/ZSteamMatchmaking.cs | 427 -- .../Valheim/assembly_valheim/ZSteamSocket.cs | 340 -- .../Valheim/assembly_valheim/ZSyncAnimation.cs | 217 - .../Valheim/assembly_valheim/ZSyncTransform.cs | 327 -- .../Valheim/assembly_valheim/ZoneSystem.cs | 1712 ------- 565 files changed, 71342 insertions(+), 71342 deletions(-) create mode 100644 Valheim_r202102_v0.141.2/.gitignore create mode 100644 "Valheim_r202102_v0.141.2/Doc/\344\275\234\345\274\212.txt" create mode 100644 "Valheim_r202102_v0.141.2/Doc/\345\210\206\346\236\220.xlsx" create mode 100644 "Valheim_r202102_v0.141.2/Doc/\345\210\206\346\236\220/\345\234\260\345\275\242\347\224\237\346\210\220.xlsx" create mode 100644 "Valheim_r202102_v0.141.2/Doc/\345\217\215\347\274\226\350\257\221\345\222\214mod.txt" create mode 100644 "Valheim_r202102_v0.141.2/Doc/\350\257\264\346\230\216.txt" create mode 100644 Valheim_r202102_v0.141.2/Valheim/assembly_valheim/.gitignore create mode 100644 Valheim_r202102_v0.141.2/Valheim/assembly_valheim/AnimalAI.cs create mode 100644 Valheim_r202102_v0.141.2/Valheim/assembly_valheim/AnimationEffect.cs create mode 100644 Valheim_r202102_v0.141.2/Valheim/assembly_valheim/Aoe.cs create mode 100644 Valheim_r202102_v0.141.2/Valheim/assembly_valheim/Attack.cs create mode 100644 Valheim_r202102_v0.141.2/Valheim/assembly_valheim/AudioMan.cs create mode 100644 Valheim_r202102_v0.141.2/Valheim/assembly_valheim/AutoJumpLedge.cs create mode 100644 Valheim_r202102_v0.141.2/Valheim/assembly_valheim/BaseAI.cs create mode 100644 Valheim_r202102_v0.141.2/Valheim/assembly_valheim/Beacon.cs create mode 100644 Valheim_r202102_v0.141.2/Valheim/assembly_valheim/Bed.cs create mode 100644 Valheim_r202102_v0.141.2/Valheim/assembly_valheim/Beehive.cs create mode 100644 Valheim_r202102_v0.141.2/Valheim/assembly_valheim/Billboard.cs create mode 100644 Valheim_r202102_v0.141.2/Valheim/assembly_valheim/BiomeEnvSetup.cs create mode 100644 Valheim_r202102_v0.141.2/Valheim/assembly_valheim/BossStone.cs create mode 100644 Valheim_r202102_v0.141.2/Valheim/assembly_valheim/CamShaker.cs create mode 100644 Valheim_r202102_v0.141.2/Valheim/assembly_valheim/CameraEffects.cs create mode 100644 Valheim_r202102_v0.141.2/Valheim/assembly_valheim/Chair.cs create mode 100644 Valheim_r202102_v0.141.2/Valheim/assembly_valheim/ChangeLog.cs create mode 100644 Valheim_r202102_v0.141.2/Valheim/assembly_valheim/Character.cs create mode 100644 Valheim_r202102_v0.141.2/Valheim/assembly_valheim/CharacterAnimEvent.cs create mode 100644 Valheim_r202102_v0.141.2/Valheim/assembly_valheim/CharacterDrop.cs create mode 100644 Valheim_r202102_v0.141.2/Valheim/assembly_valheim/CharacterTimedDestruction.cs create mode 100644 Valheim_r202102_v0.141.2/Valheim/assembly_valheim/Chat.cs create mode 100644 Valheim_r202102_v0.141.2/Valheim/assembly_valheim/CircleProjector.cs create mode 100644 Valheim_r202102_v0.141.2/Valheim/assembly_valheim/ClutterSystem.cs create mode 100644 Valheim_r202102_v0.141.2/Valheim/assembly_valheim/ConnectPanel.cs create mode 100644 Valheim_r202102_v0.141.2/Valheim/assembly_valheim/Console.cs create mode 100644 Valheim_r202102_v0.141.2/Valheim/assembly_valheim/Container.cs create mode 100644 Valheim_r202102_v0.141.2/Valheim/assembly_valheim/CookingStation.cs create mode 100644 Valheim_r202102_v0.141.2/Valheim/assembly_valheim/Corpse.cs create mode 100644 Valheim_r202102_v0.141.2/Valheim/assembly_valheim/CraftingStation.cs create mode 100644 Valheim_r202102_v0.141.2/Valheim/assembly_valheim/CreatureSpawner.cs create mode 100644 Valheim_r202102_v0.141.2/Valheim/assembly_valheim/DLCMan.cs create mode 100644 Valheim_r202102_v0.141.2/Valheim/assembly_valheim/DamageText.cs create mode 100644 Valheim_r202102_v0.141.2/Valheim/assembly_valheim/DepthCamera.cs create mode 100644 Valheim_r202102_v0.141.2/Valheim/assembly_valheim/Destructible.cs create mode 100644 Valheim_r202102_v0.141.2/Valheim/assembly_valheim/DestructibleType.cs create mode 100644 Valheim_r202102_v0.141.2/Valheim/assembly_valheim/DistantFogEmitter.cs create mode 100644 Valheim_r202102_v0.141.2/Valheim/assembly_valheim/Door.cs create mode 100644 Valheim_r202102_v0.141.2/Valheim/assembly_valheim/DreamTexts.cs create mode 100644 Valheim_r202102_v0.141.2/Valheim/assembly_valheim/DropOnDestroyed.cs create mode 100644 Valheim_r202102_v0.141.2/Valheim/assembly_valheim/DropTable.cs create mode 100644 Valheim_r202102_v0.141.2/Valheim/assembly_valheim/DungeonDB.cs create mode 100644 Valheim_r202102_v0.141.2/Valheim/assembly_valheim/DungeonGenerator.cs create mode 100644 Valheim_r202102_v0.141.2/Valheim/assembly_valheim/EffectArea.cs create mode 100644 Valheim_r202102_v0.141.2/Valheim/assembly_valheim/EffectFade.cs create mode 100644 Valheim_r202102_v0.141.2/Valheim/assembly_valheim/EffectList.cs create mode 100644 Valheim_r202102_v0.141.2/Valheim/assembly_valheim/EmitterRotation.cs create mode 100644 Valheim_r202102_v0.141.2/Valheim/assembly_valheim/EnemyHud.cs create mode 100644 Valheim_r202102_v0.141.2/Valheim/assembly_valheim/EnvEntry.cs create mode 100644 Valheim_r202102_v0.141.2/Valheim/assembly_valheim/EnvMan.cs create mode 100644 Valheim_r202102_v0.141.2/Valheim/assembly_valheim/EnvSetup.cs create mode 100644 Valheim_r202102_v0.141.2/Valheim/assembly_valheim/EnvZone.cs create mode 100644 Valheim_r202102_v0.141.2/Valheim/assembly_valheim/EventZone.cs create mode 100644 Valheim_r202102_v0.141.2/Valheim/assembly_valheim/Feedback.cs create mode 100644 Valheim_r202102_v0.141.2/Valheim/assembly_valheim/FejdStartup.cs create mode 100644 Valheim_r202102_v0.141.2/Valheim/assembly_valheim/Fermenter.cs create mode 100644 Valheim_r202102_v0.141.2/Valheim/assembly_valheim/Fireplace.cs create mode 100644 Valheim_r202102_v0.141.2/Valheim/assembly_valheim/Fish.cs create mode 100644 Valheim_r202102_v0.141.2/Valheim/assembly_valheim/FishingFloat.cs create mode 100644 Valheim_r202102_v0.141.2/Valheim/assembly_valheim/Floating.cs create mode 100644 Valheim_r202102_v0.141.2/Valheim/assembly_valheim/FollowPlayer.cs create mode 100644 Valheim_r202102_v0.141.2/Valheim/assembly_valheim/FootStep.cs create mode 100644 Valheim_r202102_v0.141.2/Valheim/assembly_valheim/Game.cs create mode 100644 Valheim_r202102_v0.141.2/Valheim/assembly_valheim/GameCamera.cs create mode 100644 Valheim_r202102_v0.141.2/Valheim/assembly_valheim/Gibber.cs create mode 100644 Valheim_r202102_v0.141.2/Valheim/assembly_valheim/GlobalWind.cs create mode 100644 Valheim_r202102_v0.141.2/Valheim/assembly_valheim/Growup.cs create mode 100644 Valheim_r202102_v0.141.2/Valheim/assembly_valheim/GuidePoint.cs create mode 100644 Valheim_r202102_v0.141.2/Valheim/assembly_valheim/Heightmap.cs create mode 100644 Valheim_r202102_v0.141.2/Valheim/assembly_valheim/HeightmapBuilder.cs create mode 100644 Valheim_r202102_v0.141.2/Valheim/assembly_valheim/HitArea.cs create mode 100644 Valheim_r202102_v0.141.2/Valheim/assembly_valheim/HitData.cs create mode 100644 Valheim_r202102_v0.141.2/Valheim/assembly_valheim/HotkeyBar.cs create mode 100644 Valheim_r202102_v0.141.2/Valheim/assembly_valheim/HoverText.cs create mode 100644 Valheim_r202102_v0.141.2/Valheim/assembly_valheim/Hoverable.cs create mode 100644 Valheim_r202102_v0.141.2/Valheim/assembly_valheim/Hud.cs create mode 100644 Valheim_r202102_v0.141.2/Valheim/assembly_valheim/Humanoid.cs create mode 100644 Valheim_r202102_v0.141.2/Valheim/assembly_valheim/IDestructible.cs create mode 100644 Valheim_r202102_v0.141.2/Valheim/assembly_valheim/IEquipmentVisual.cs create mode 100644 Valheim_r202102_v0.141.2/Valheim/assembly_valheim/IProjectile.cs create mode 100644 Valheim_r202102_v0.141.2/Valheim/assembly_valheim/ISocket.cs create mode 100644 Valheim_r202102_v0.141.2/Valheim/assembly_valheim/IWaterInteractable.cs create mode 100644 Valheim_r202102_v0.141.2/Valheim/assembly_valheim/ImpactEffect.cs create mode 100644 Valheim_r202102_v0.141.2/Valheim/assembly_valheim/InputFieldSubmit.cs create mode 100644 Valheim_r202102_v0.141.2/Valheim/assembly_valheim/InstanceRenderer.cs create mode 100644 Valheim_r202102_v0.141.2/Valheim/assembly_valheim/InstantiatePrefab.cs create mode 100644 Valheim_r202102_v0.141.2/Valheim/assembly_valheim/Interactable.cs create mode 100644 Valheim_r202102_v0.141.2/Valheim/assembly_valheim/Interpolate.cs create mode 100644 Valheim_r202102_v0.141.2/Valheim/assembly_valheim/Inventory.cs create mode 100644 Valheim_r202102_v0.141.2/Valheim/assembly_valheim/InventoryGrid.cs create mode 100644 Valheim_r202102_v0.141.2/Valheim/assembly_valheim/InventoryGui.cs create mode 100644 Valheim_r202102_v0.141.2/Valheim/assembly_valheim/ItemDrop.cs create mode 100644 Valheim_r202102_v0.141.2/Valheim/assembly_valheim/ItemStand.cs create mode 100644 Valheim_r202102_v0.141.2/Valheim/assembly_valheim/ItemStyle.cs create mode 100644 Valheim_r202102_v0.141.2/Valheim/assembly_valheim/KeyHints.cs create mode 100644 Valheim_r202102_v0.141.2/Valheim/assembly_valheim/Ladder.cs create mode 100644 Valheim_r202102_v0.141.2/Valheim/assembly_valheim/Ledge.cs create mode 100644 Valheim_r202102_v0.141.2/Valheim/assembly_valheim/LevelEffects.cs create mode 100644 Valheim_r202102_v0.141.2/Valheim/assembly_valheim/Leviathan.cs create mode 100644 Valheim_r202102_v0.141.2/Valheim/assembly_valheim/LightFlicker.cs create mode 100644 Valheim_r202102_v0.141.2/Valheim/assembly_valheim/LightLod.cs create mode 100644 Valheim_r202102_v0.141.2/Valheim/assembly_valheim/LineAttach.cs create mode 100644 Valheim_r202102_v0.141.2/Valheim/assembly_valheim/LineConnect.cs create mode 100644 Valheim_r202102_v0.141.2/Valheim/assembly_valheim/Location.cs create mode 100644 Valheim_r202102_v0.141.2/Valheim/assembly_valheim/LocationProxy.cs create mode 100644 Valheim_r202102_v0.141.2/Valheim/assembly_valheim/LodFadeInOut.cs create mode 100644 Valheim_r202102_v0.141.2/Valheim/assembly_valheim/LootSpawner.cs create mode 100644 Valheim_r202102_v0.141.2/Valheim/assembly_valheim/MasterClient.cs create mode 100644 Valheim_r202102_v0.141.2/Valheim/assembly_valheim/MeleeWeaponTrail.cs create mode 100644 Valheim_r202102_v0.141.2/Valheim/assembly_valheim/Menu.cs create mode 100644 Valheim_r202102_v0.141.2/Valheim/assembly_valheim/MenuScene.cs create mode 100644 Valheim_r202102_v0.141.2/Valheim/assembly_valheim/MenuShipMovement.cs create mode 100644 Valheim_r202102_v0.141.2/Valheim/assembly_valheim/MessageHud.cs create mode 100644 Valheim_r202102_v0.141.2/Valheim/assembly_valheim/MineRock.cs create mode 100644 Valheim_r202102_v0.141.2/Valheim/assembly_valheim/MineRock5.cs create mode 100644 Valheim_r202102_v0.141.2/Valheim/assembly_valheim/Minimap.cs create mode 100644 Valheim_r202102_v0.141.2/Valheim/assembly_valheim/MistEmitter.cs create mode 100644 Valheim_r202102_v0.141.2/Valheim/assembly_valheim/MonsterAI.cs create mode 100644 Valheim_r202102_v0.141.2/Valheim/assembly_valheim/MovementTest.cs create mode 100644 Valheim_r202102_v0.141.2/Valheim/assembly_valheim/MusicMan.cs create mode 100644 Valheim_r202102_v0.141.2/Valheim/assembly_valheim/NavmeshTest.cs create mode 100644 Valheim_r202102_v0.141.2/Valheim/assembly_valheim/ObjectDB.cs create mode 100644 Valheim_r202102_v0.141.2/Valheim/assembly_valheim/Odin.cs create mode 100644 Valheim_r202102_v0.141.2/Valheim/assembly_valheim/OfferingBowl.cs create mode 100644 Valheim_r202102_v0.141.2/Valheim/assembly_valheim/ParticleDecal.cs create mode 100644 Valheim_r202102_v0.141.2/Valheim/assembly_valheim/Pathfinding.cs create mode 100644 Valheim_r202102_v0.141.2/Valheim/assembly_valheim/Pickable.cs create mode 100644 Valheim_r202102_v0.141.2/Valheim/assembly_valheim/PickableItem.cs create mode 100644 Valheim_r202102_v0.141.2/Valheim/assembly_valheim/Piece.cs create mode 100644 Valheim_r202102_v0.141.2/Valheim/assembly_valheim/PieceTable.cs create mode 100644 Valheim_r202102_v0.141.2/Valheim/assembly_valheim/Plant.cs create mode 100644 Valheim_r202102_v0.141.2/Valheim/assembly_valheim/Player.cs create mode 100644 Valheim_r202102_v0.141.2/Valheim/assembly_valheim/PlayerController.cs create mode 100644 Valheim_r202102_v0.141.2/Valheim/assembly_valheim/PlayerCustomizaton.cs create mode 100644 Valheim_r202102_v0.141.2/Valheim/assembly_valheim/PlayerProfile.cs create mode 100644 Valheim_r202102_v0.141.2/Valheim/assembly_valheim/PointGenerator.cs create mode 100644 Valheim_r202102_v0.141.2/Valheim/assembly_valheim/PrivateArea.cs create mode 100644 Valheim_r202102_v0.141.2/Valheim/assembly_valheim/Procreation.cs create mode 100644 Valheim_r202102_v0.141.2/Valheim/assembly_valheim/Projectile.cs create mode 100644 Valheim_r202102_v0.141.2/Valheim/assembly_valheim/Properties/AssemblyInfo.cs create mode 100644 Valheim_r202102_v0.141.2/Valheim/assembly_valheim/Ragdoll.cs create mode 100644 Valheim_r202102_v0.141.2/Valheim/assembly_valheim/RandEventSystem.cs create mode 100644 Valheim_r202102_v0.141.2/Valheim/assembly_valheim/RandomAnimation.cs create mode 100644 Valheim_r202102_v0.141.2/Valheim/assembly_valheim/RandomEvent.cs create mode 100644 Valheim_r202102_v0.141.2/Valheim/assembly_valheim/RandomFlyingBird.cs create mode 100644 Valheim_r202102_v0.141.2/Valheim/assembly_valheim/RandomIdle.cs create mode 100644 Valheim_r202102_v0.141.2/Valheim/assembly_valheim/RandomMovement.cs create mode 100644 Valheim_r202102_v0.141.2/Valheim/assembly_valheim/RandomSpawn.cs create mode 100644 Valheim_r202102_v0.141.2/Valheim/assembly_valheim/RandomSpeak.cs create mode 100644 Valheim_r202102_v0.141.2/Valheim/assembly_valheim/Raven.cs create mode 100644 Valheim_r202102_v0.141.2/Valheim/assembly_valheim/Recipe.cs create mode 100644 Valheim_r202102_v0.141.2/Valheim/assembly_valheim/ReflectionUpdate.cs create mode 100644 Valheim_r202102_v0.141.2/Valheim/assembly_valheim/Room.cs create mode 100644 Valheim_r202102_v0.141.2/Valheim/assembly_valheim/RoomConnection.cs create mode 100644 Valheim_r202102_v0.141.2/Valheim/assembly_valheim/RopeAttachment.cs create mode 100644 Valheim_r202102_v0.141.2/Valheim/assembly_valheim/RoutedMethod.cs create mode 100644 Valheim_r202102_v0.141.2/Valheim/assembly_valheim/RoutedMethodBase.cs create mode 100644 Valheim_r202102_v0.141.2/Valheim/assembly_valheim/RuneStone.cs create mode 100644 Valheim_r202102_v0.141.2/Valheim/assembly_valheim/SEMan.cs create mode 100644 Valheim_r202102_v0.141.2/Valheim/assembly_valheim/SE_Burning.cs create mode 100644 Valheim_r202102_v0.141.2/Valheim/assembly_valheim/SE_Cozy.cs create mode 100644 Valheim_r202102_v0.141.2/Valheim/assembly_valheim/SE_Finder.cs create mode 100644 Valheim_r202102_v0.141.2/Valheim/assembly_valheim/SE_Frost.cs create mode 100644 Valheim_r202102_v0.141.2/Valheim/assembly_valheim/SE_Harpooned.cs create mode 100644 Valheim_r202102_v0.141.2/Valheim/assembly_valheim/SE_HealthUpgrade.cs create mode 100644 Valheim_r202102_v0.141.2/Valheim/assembly_valheim/SE_Poison.cs create mode 100644 Valheim_r202102_v0.141.2/Valheim/assembly_valheim/SE_Rested.cs create mode 100644 Valheim_r202102_v0.141.2/Valheim/assembly_valheim/SE_Shield.cs create mode 100644 Valheim_r202102_v0.141.2/Valheim/assembly_valheim/SE_Smoke.cs create mode 100644 Valheim_r202102_v0.141.2/Valheim/assembly_valheim/SE_Spawn.cs create mode 100644 Valheim_r202102_v0.141.2/Valheim/assembly_valheim/SE_Stats.cs create mode 100644 Valheim_r202102_v0.141.2/Valheim/assembly_valheim/SE_Wet.cs create mode 100644 Valheim_r202102_v0.141.2/Valheim/assembly_valheim/SceneLoader.cs create mode 100644 Valheim_r202102_v0.141.2/Valheim/assembly_valheim/ScrollRectEnsureVisible.cs create mode 100644 Valheim_r202102_v0.141.2/Valheim/assembly_valheim/ServerCtrl.cs create mode 100644 Valheim_r202102_v0.141.2/Valheim/assembly_valheim/Settings.cs create mode 100644 Valheim_r202102_v0.141.2/Valheim/assembly_valheim/Ship.cs create mode 100644 Valheim_r202102_v0.141.2/Valheim/assembly_valheim/ShipConstructor.cs create mode 100644 Valheim_r202102_v0.141.2/Valheim/assembly_valheim/ShipControlls.cs create mode 100644 Valheim_r202102_v0.141.2/Valheim/assembly_valheim/ShipEffects.cs create mode 100644 Valheim_r202102_v0.141.2/Valheim/assembly_valheim/ShuffleClass.cs create mode 100644 Valheim_r202102_v0.141.2/Valheim/assembly_valheim/Sign.cs create mode 100644 Valheim_r202102_v0.141.2/Valheim/assembly_valheim/Skills.cs create mode 100644 Valheim_r202102_v0.141.2/Valheim/assembly_valheim/SkillsDialog.cs create mode 100644 Valheim_r202102_v0.141.2/Valheim/assembly_valheim/SleepText.cs create mode 100644 Valheim_r202102_v0.141.2/Valheim/assembly_valheim/SlowUpdate.cs create mode 100644 Valheim_r202102_v0.141.2/Valheim/assembly_valheim/SlowUpdater.cs create mode 100644 Valheim_r202102_v0.141.2/Valheim/assembly_valheim/Smelter.cs create mode 100644 Valheim_r202102_v0.141.2/Valheim/assembly_valheim/Smoke.cs create mode 100644 Valheim_r202102_v0.141.2/Valheim/assembly_valheim/SmokeLod.cs create mode 100644 Valheim_r202102_v0.141.2/Valheim/assembly_valheim/SmokeRenderer.cs create mode 100644 Valheim_r202102_v0.141.2/Valheim/assembly_valheim/SmokeSpawner.cs create mode 100644 Valheim_r202102_v0.141.2/Valheim/assembly_valheim/SnapToGround.cs create mode 100644 Valheim_r202102_v0.141.2/Valheim/assembly_valheim/SpawnAbility.cs create mode 100644 Valheim_r202102_v0.141.2/Valheim/assembly_valheim/SpawnArea.cs create mode 100644 Valheim_r202102_v0.141.2/Valheim/assembly_valheim/SpawnOnDamaged.cs create mode 100644 Valheim_r202102_v0.141.2/Valheim/assembly_valheim/SpawnSystem.cs create mode 100644 Valheim_r202102_v0.141.2/Valheim/assembly_valheim/StateController.cs create mode 100644 Valheim_r202102_v0.141.2/Valheim/assembly_valheim/StaticPhysics.cs create mode 100644 Valheim_r202102_v0.141.2/Valheim/assembly_valheim/StaticTarget.cs create mode 100644 Valheim_r202102_v0.141.2/Valheim/assembly_valheim/StationExtension.cs create mode 100644 Valheim_r202102_v0.141.2/Valheim/assembly_valheim/StatusEffect.cs create mode 100644 Valheim_r202102_v0.141.2/Valheim/assembly_valheim/StealthSystem.cs create mode 100644 Valheim_r202102_v0.141.2/Valheim/assembly_valheim/SteamManager.cs create mode 100644 Valheim_r202102_v0.141.2/Valheim/assembly_valheim/StoreGui.cs create mode 100644 Valheim_r202102_v0.141.2/Valheim/assembly_valheim/Switch.cs create mode 100644 Valheim_r202102_v0.141.2/Valheim/assembly_valheim/Tail.cs create mode 100644 Valheim_r202102_v0.141.2/Valheim/assembly_valheim/Talker.cs create mode 100644 Valheim_r202102_v0.141.2/Valheim/assembly_valheim/Tameable.cs create mode 100644 Valheim_r202102_v0.141.2/Valheim/assembly_valheim/Teleport.cs create mode 100644 Valheim_r202102_v0.141.2/Valheim/assembly_valheim/TeleportHome.cs create mode 100644 Valheim_r202102_v0.141.2/Valheim/assembly_valheim/TeleportWorld.cs create mode 100644 Valheim_r202102_v0.141.2/Valheim/assembly_valheim/TeleportWorldTrigger.cs create mode 100644 Valheim_r202102_v0.141.2/Valheim/assembly_valheim/TerrainLod.cs create mode 100644 Valheim_r202102_v0.141.2/Valheim/assembly_valheim/TerrainModifier.cs create mode 100644 Valheim_r202102_v0.141.2/Valheim/assembly_valheim/TestCollision.cs create mode 100644 Valheim_r202102_v0.141.2/Valheim/assembly_valheim/TestSceneCharacter.cs create mode 100644 Valheim_r202102_v0.141.2/Valheim/assembly_valheim/TestSceneSetup.cs create mode 100644 Valheim_r202102_v0.141.2/Valheim/assembly_valheim/TextInput.cs create mode 100644 Valheim_r202102_v0.141.2/Valheim/assembly_valheim/TextReceiver.cs create mode 100644 Valheim_r202102_v0.141.2/Valheim/assembly_valheim/TextViewer.cs create mode 100644 Valheim_r202102_v0.141.2/Valheim/assembly_valheim/TextsDialog.cs create mode 100644 Valheim_r202102_v0.141.2/Valheim/assembly_valheim/ThorFly.cs create mode 100644 Valheim_r202102_v0.141.2/Valheim/assembly_valheim/Thunder.cs create mode 100644 Valheim_r202102_v0.141.2/Valheim/assembly_valheim/TimedDestruction.cs create mode 100644 Valheim_r202102_v0.141.2/Valheim/assembly_valheim/ToggleImage.cs create mode 100644 Valheim_r202102_v0.141.2/Valheim/assembly_valheim/ToggleSwitch.cs create mode 100644 Valheim_r202102_v0.141.2/Valheim/assembly_valheim/TombStone.cs create mode 100644 Valheim_r202102_v0.141.2/Valheim/assembly_valheim/Tracker.cs create mode 100644 Valheim_r202102_v0.141.2/Valheim/assembly_valheim/Trader.cs create mode 100644 Valheim_r202102_v0.141.2/Valheim/assembly_valheim/TreeBase.cs create mode 100644 Valheim_r202102_v0.141.2/Valheim/assembly_valheim/TreeLog.cs create mode 100644 Valheim_r202102_v0.141.2/Valheim/assembly_valheim/Tutorial.cs create mode 100644 Valheim_r202102_v0.141.2/Valheim/assembly_valheim/Vagon.cs create mode 100644 Valheim_r202102_v0.141.2/Valheim/assembly_valheim/Valheim.csproj create mode 100644 Valheim_r202102_v0.141.2/Valheim/assembly_valheim/Valheim.sln create mode 100644 Valheim_r202102_v0.141.2/Valheim/assembly_valheim/Valkyrie.cs create mode 100644 Valheim_r202102_v0.141.2/Valheim/assembly_valheim/VariantDialog.cs create mode 100644 Valheim_r202102_v0.141.2/Valheim/assembly_valheim/Vegvisir.cs create mode 100644 Valheim_r202102_v0.141.2/Valheim/assembly_valheim/Version.cs create mode 100644 Valheim_r202102_v0.141.2/Valheim/assembly_valheim/VisEquipment.cs create mode 100644 Valheim_r202102_v0.141.2/Valheim/assembly_valheim/WaterMark.cs create mode 100644 Valheim_r202102_v0.141.2/Valheim/assembly_valheim/WaterTrigger.cs create mode 100644 Valheim_r202102_v0.141.2/Valheim/assembly_valheim/WaterVolume.cs create mode 100644 Valheim_r202102_v0.141.2/Valheim/assembly_valheim/WayStone.cs create mode 100644 Valheim_r202102_v0.141.2/Valheim/assembly_valheim/WearNTear.cs create mode 100644 Valheim_r202102_v0.141.2/Valheim/assembly_valheim/WearNTearUpdater.cs create mode 100644 Valheim_r202102_v0.141.2/Valheim/assembly_valheim/Windmill.cs create mode 100644 Valheim_r202102_v0.141.2/Valheim/assembly_valheim/World.cs create mode 100644 Valheim_r202102_v0.141.2/Valheim/assembly_valheim/WorldGenerator.cs create mode 100644 Valheim_r202102_v0.141.2/Valheim/assembly_valheim/ZBroastcast.cs create mode 100644 Valheim_r202102_v0.141.2/Valheim/assembly_valheim/ZConnector.cs create mode 100644 Valheim_r202102_v0.141.2/Valheim/assembly_valheim/ZConnector2.cs create mode 100644 Valheim_r202102_v0.141.2/Valheim/assembly_valheim/ZDO.cs create mode 100644 Valheim_r202102_v0.141.2/Valheim/assembly_valheim/ZDOComparer.cs create mode 100644 Valheim_r202102_v0.141.2/Valheim/assembly_valheim/ZDOID.cs create mode 100644 Valheim_r202102_v0.141.2/Valheim/assembly_valheim/ZDOMan.cs create mode 100644 Valheim_r202102_v0.141.2/Valheim/assembly_valheim/ZDOPool.cs create mode 100644 Valheim_r202102_v0.141.2/Valheim/assembly_valheim/ZNat.cs create mode 100644 Valheim_r202102_v0.141.2/Valheim/assembly_valheim/ZNet.cs create mode 100644 Valheim_r202102_v0.141.2/Valheim/assembly_valheim/ZNetPeer.cs create mode 100644 Valheim_r202102_v0.141.2/Valheim/assembly_valheim/ZNetScene.cs create mode 100644 Valheim_r202102_v0.141.2/Valheim/assembly_valheim/ZNetView.cs create mode 100644 Valheim_r202102_v0.141.2/Valheim/assembly_valheim/ZNtp.cs create mode 100644 Valheim_r202102_v0.141.2/Valheim/assembly_valheim/ZPackage.cs create mode 100644 Valheim_r202102_v0.141.2/Valheim/assembly_valheim/ZRoutedRpc.cs create mode 100644 Valheim_r202102_v0.141.2/Valheim/assembly_valheim/ZRpc.cs create mode 100644 Valheim_r202102_v0.141.2/Valheim/assembly_valheim/ZSFX.cs create mode 100644 Valheim_r202102_v0.141.2/Valheim/assembly_valheim/ZSocket.cs create mode 100644 Valheim_r202102_v0.141.2/Valheim/assembly_valheim/ZSocket2.cs create mode 100644 Valheim_r202102_v0.141.2/Valheim/assembly_valheim/ZSteamMatchmaking.cs create mode 100644 Valheim_r202102_v0.141.2/Valheim/assembly_valheim/ZSteamSocket.cs create mode 100644 Valheim_r202102_v0.141.2/Valheim/assembly_valheim/ZSyncAnimation.cs create mode 100644 Valheim_r202102_v0.141.2/Valheim/assembly_valheim/ZSyncTransform.cs create mode 100644 Valheim_r202102_v0.141.2/Valheim/assembly_valheim/ZoneSystem.cs create mode 100644 Valheim_r202102_v0.141.2/valheim.zip delete mode 100644 Valheim_v202102/.gitignore delete mode 100644 "Valheim_v202102/Doc/\344\275\234\345\274\212.txt" delete mode 100644 "Valheim_v202102/Doc/\345\210\206\346\236\220.xlsx" delete mode 100644 "Valheim_v202102/Doc/\345\210\206\346\236\220/\345\234\260\345\275\242\347\224\237\346\210\220.xlsx" delete mode 100644 "Valheim_v202102/Doc/\345\217\215\347\274\226\350\257\221\345\222\214mod.txt" delete mode 100644 "Valheim_v202102/Doc/\350\257\264\346\230\216.txt" delete mode 100644 Valheim_v202102/Valheim/assembly_valheim/.gitignore delete mode 100644 Valheim_v202102/Valheim/assembly_valheim/AnimalAI.cs delete mode 100644 Valheim_v202102/Valheim/assembly_valheim/AnimationEffect.cs delete mode 100644 Valheim_v202102/Valheim/assembly_valheim/Aoe.cs delete mode 100644 Valheim_v202102/Valheim/assembly_valheim/Attack.cs delete mode 100644 Valheim_v202102/Valheim/assembly_valheim/AudioMan.cs delete mode 100644 Valheim_v202102/Valheim/assembly_valheim/AutoJumpLedge.cs delete mode 100644 Valheim_v202102/Valheim/assembly_valheim/BaseAI.cs delete mode 100644 Valheim_v202102/Valheim/assembly_valheim/Beacon.cs delete mode 100644 Valheim_v202102/Valheim/assembly_valheim/Bed.cs delete mode 100644 Valheim_v202102/Valheim/assembly_valheim/Beehive.cs delete mode 100644 Valheim_v202102/Valheim/assembly_valheim/Billboard.cs delete mode 100644 Valheim_v202102/Valheim/assembly_valheim/BiomeEnvSetup.cs delete mode 100644 Valheim_v202102/Valheim/assembly_valheim/BossStone.cs delete mode 100644 Valheim_v202102/Valheim/assembly_valheim/CamShaker.cs delete mode 100644 Valheim_v202102/Valheim/assembly_valheim/CameraEffects.cs delete mode 100644 Valheim_v202102/Valheim/assembly_valheim/Chair.cs delete mode 100644 Valheim_v202102/Valheim/assembly_valheim/ChangeLog.cs delete mode 100644 Valheim_v202102/Valheim/assembly_valheim/Character.cs delete mode 100644 Valheim_v202102/Valheim/assembly_valheim/CharacterAnimEvent.cs delete mode 100644 Valheim_v202102/Valheim/assembly_valheim/CharacterDrop.cs delete mode 100644 Valheim_v202102/Valheim/assembly_valheim/CharacterTimedDestruction.cs delete mode 100644 Valheim_v202102/Valheim/assembly_valheim/Chat.cs delete mode 100644 Valheim_v202102/Valheim/assembly_valheim/CircleProjector.cs delete mode 100644 Valheim_v202102/Valheim/assembly_valheim/ClutterSystem.cs delete mode 100644 Valheim_v202102/Valheim/assembly_valheim/ConnectPanel.cs delete mode 100644 Valheim_v202102/Valheim/assembly_valheim/Console.cs delete mode 100644 Valheim_v202102/Valheim/assembly_valheim/Container.cs delete mode 100644 Valheim_v202102/Valheim/assembly_valheim/CookingStation.cs delete mode 100644 Valheim_v202102/Valheim/assembly_valheim/Corpse.cs delete mode 100644 Valheim_v202102/Valheim/assembly_valheim/CraftingStation.cs delete mode 100644 Valheim_v202102/Valheim/assembly_valheim/CreatureSpawner.cs delete mode 100644 Valheim_v202102/Valheim/assembly_valheim/DLCMan.cs delete mode 100644 Valheim_v202102/Valheim/assembly_valheim/DamageText.cs delete mode 100644 Valheim_v202102/Valheim/assembly_valheim/DepthCamera.cs delete mode 100644 Valheim_v202102/Valheim/assembly_valheim/Destructible.cs delete mode 100644 Valheim_v202102/Valheim/assembly_valheim/DestructibleType.cs delete mode 100644 Valheim_v202102/Valheim/assembly_valheim/DistantFogEmitter.cs delete mode 100644 Valheim_v202102/Valheim/assembly_valheim/Door.cs delete mode 100644 Valheim_v202102/Valheim/assembly_valheim/DreamTexts.cs delete mode 100644 Valheim_v202102/Valheim/assembly_valheim/DropOnDestroyed.cs delete mode 100644 Valheim_v202102/Valheim/assembly_valheim/DropTable.cs delete mode 100644 Valheim_v202102/Valheim/assembly_valheim/DungeonDB.cs delete mode 100644 Valheim_v202102/Valheim/assembly_valheim/DungeonGenerator.cs delete mode 100644 Valheim_v202102/Valheim/assembly_valheim/EffectArea.cs delete mode 100644 Valheim_v202102/Valheim/assembly_valheim/EffectFade.cs delete mode 100644 Valheim_v202102/Valheim/assembly_valheim/EffectList.cs delete mode 100644 Valheim_v202102/Valheim/assembly_valheim/EmitterRotation.cs delete mode 100644 Valheim_v202102/Valheim/assembly_valheim/EnemyHud.cs delete mode 100644 Valheim_v202102/Valheim/assembly_valheim/EnvEntry.cs delete mode 100644 Valheim_v202102/Valheim/assembly_valheim/EnvMan.cs delete mode 100644 Valheim_v202102/Valheim/assembly_valheim/EnvSetup.cs delete mode 100644 Valheim_v202102/Valheim/assembly_valheim/EnvZone.cs delete mode 100644 Valheim_v202102/Valheim/assembly_valheim/EventZone.cs delete mode 100644 Valheim_v202102/Valheim/assembly_valheim/Feedback.cs delete mode 100644 Valheim_v202102/Valheim/assembly_valheim/FejdStartup.cs delete mode 100644 Valheim_v202102/Valheim/assembly_valheim/Fermenter.cs delete mode 100644 Valheim_v202102/Valheim/assembly_valheim/Fireplace.cs delete mode 100644 Valheim_v202102/Valheim/assembly_valheim/Fish.cs delete mode 100644 Valheim_v202102/Valheim/assembly_valheim/FishingFloat.cs delete mode 100644 Valheim_v202102/Valheim/assembly_valheim/Floating.cs delete mode 100644 Valheim_v202102/Valheim/assembly_valheim/FollowPlayer.cs delete mode 100644 Valheim_v202102/Valheim/assembly_valheim/FootStep.cs delete mode 100644 Valheim_v202102/Valheim/assembly_valheim/Game.cs delete mode 100644 Valheim_v202102/Valheim/assembly_valheim/GameCamera.cs delete mode 100644 Valheim_v202102/Valheim/assembly_valheim/Gibber.cs delete mode 100644 Valheim_v202102/Valheim/assembly_valheim/GlobalWind.cs delete mode 100644 Valheim_v202102/Valheim/assembly_valheim/Growup.cs delete mode 100644 Valheim_v202102/Valheim/assembly_valheim/GuidePoint.cs delete mode 100644 Valheim_v202102/Valheim/assembly_valheim/Heightmap.cs delete mode 100644 Valheim_v202102/Valheim/assembly_valheim/HeightmapBuilder.cs delete mode 100644 Valheim_v202102/Valheim/assembly_valheim/HitArea.cs delete mode 100644 Valheim_v202102/Valheim/assembly_valheim/HitData.cs delete mode 100644 Valheim_v202102/Valheim/assembly_valheim/HotkeyBar.cs delete mode 100644 Valheim_v202102/Valheim/assembly_valheim/HoverText.cs delete mode 100644 Valheim_v202102/Valheim/assembly_valheim/Hoverable.cs delete mode 100644 Valheim_v202102/Valheim/assembly_valheim/Hud.cs delete mode 100644 Valheim_v202102/Valheim/assembly_valheim/Humanoid.cs delete mode 100644 Valheim_v202102/Valheim/assembly_valheim/IDestructible.cs delete mode 100644 Valheim_v202102/Valheim/assembly_valheim/IEquipmentVisual.cs delete mode 100644 Valheim_v202102/Valheim/assembly_valheim/IProjectile.cs delete mode 100644 Valheim_v202102/Valheim/assembly_valheim/ISocket.cs delete mode 100644 Valheim_v202102/Valheim/assembly_valheim/IWaterInteractable.cs delete mode 100644 Valheim_v202102/Valheim/assembly_valheim/ImpactEffect.cs delete mode 100644 Valheim_v202102/Valheim/assembly_valheim/InputFieldSubmit.cs delete mode 100644 Valheim_v202102/Valheim/assembly_valheim/InstanceRenderer.cs delete mode 100644 Valheim_v202102/Valheim/assembly_valheim/InstantiatePrefab.cs delete mode 100644 Valheim_v202102/Valheim/assembly_valheim/Interactable.cs delete mode 100644 Valheim_v202102/Valheim/assembly_valheim/Interpolate.cs delete mode 100644 Valheim_v202102/Valheim/assembly_valheim/Inventory.cs delete mode 100644 Valheim_v202102/Valheim/assembly_valheim/InventoryGrid.cs delete mode 100644 Valheim_v202102/Valheim/assembly_valheim/InventoryGui.cs delete mode 100644 Valheim_v202102/Valheim/assembly_valheim/ItemDrop.cs delete mode 100644 Valheim_v202102/Valheim/assembly_valheim/ItemStand.cs delete mode 100644 Valheim_v202102/Valheim/assembly_valheim/ItemStyle.cs delete mode 100644 Valheim_v202102/Valheim/assembly_valheim/KeyHints.cs delete mode 100644 Valheim_v202102/Valheim/assembly_valheim/Ladder.cs delete mode 100644 Valheim_v202102/Valheim/assembly_valheim/Ledge.cs delete mode 100644 Valheim_v202102/Valheim/assembly_valheim/LevelEffects.cs delete mode 100644 Valheim_v202102/Valheim/assembly_valheim/Leviathan.cs delete mode 100644 Valheim_v202102/Valheim/assembly_valheim/LightFlicker.cs delete mode 100644 Valheim_v202102/Valheim/assembly_valheim/LightLod.cs delete mode 100644 Valheim_v202102/Valheim/assembly_valheim/LineAttach.cs delete mode 100644 Valheim_v202102/Valheim/assembly_valheim/LineConnect.cs delete mode 100644 Valheim_v202102/Valheim/assembly_valheim/Location.cs delete mode 100644 Valheim_v202102/Valheim/assembly_valheim/LocationProxy.cs delete mode 100644 Valheim_v202102/Valheim/assembly_valheim/LodFadeInOut.cs delete mode 100644 Valheim_v202102/Valheim/assembly_valheim/LootSpawner.cs delete mode 100644 Valheim_v202102/Valheim/assembly_valheim/MasterClient.cs delete mode 100644 Valheim_v202102/Valheim/assembly_valheim/MeleeWeaponTrail.cs delete mode 100644 Valheim_v202102/Valheim/assembly_valheim/Menu.cs delete mode 100644 Valheim_v202102/Valheim/assembly_valheim/MenuScene.cs delete mode 100644 Valheim_v202102/Valheim/assembly_valheim/MenuShipMovement.cs delete mode 100644 Valheim_v202102/Valheim/assembly_valheim/MessageHud.cs delete mode 100644 Valheim_v202102/Valheim/assembly_valheim/MineRock.cs delete mode 100644 Valheim_v202102/Valheim/assembly_valheim/MineRock5.cs delete mode 100644 Valheim_v202102/Valheim/assembly_valheim/Minimap.cs delete mode 100644 Valheim_v202102/Valheim/assembly_valheim/MistEmitter.cs delete mode 100644 Valheim_v202102/Valheim/assembly_valheim/MonsterAI.cs delete mode 100644 Valheim_v202102/Valheim/assembly_valheim/MovementTest.cs delete mode 100644 Valheim_v202102/Valheim/assembly_valheim/MusicMan.cs delete mode 100644 Valheim_v202102/Valheim/assembly_valheim/NavmeshTest.cs delete mode 100644 Valheim_v202102/Valheim/assembly_valheim/ObjectDB.cs delete mode 100644 Valheim_v202102/Valheim/assembly_valheim/Odin.cs delete mode 100644 Valheim_v202102/Valheim/assembly_valheim/OfferingBowl.cs delete mode 100644 Valheim_v202102/Valheim/assembly_valheim/ParticleDecal.cs delete mode 100644 Valheim_v202102/Valheim/assembly_valheim/Pathfinding.cs delete mode 100644 Valheim_v202102/Valheim/assembly_valheim/Pickable.cs delete mode 100644 Valheim_v202102/Valheim/assembly_valheim/PickableItem.cs delete mode 100644 Valheim_v202102/Valheim/assembly_valheim/Piece.cs delete mode 100644 Valheim_v202102/Valheim/assembly_valheim/PieceTable.cs delete mode 100644 Valheim_v202102/Valheim/assembly_valheim/Plant.cs delete mode 100644 Valheim_v202102/Valheim/assembly_valheim/Player.cs delete mode 100644 Valheim_v202102/Valheim/assembly_valheim/PlayerController.cs delete mode 100644 Valheim_v202102/Valheim/assembly_valheim/PlayerCustomizaton.cs delete mode 100644 Valheim_v202102/Valheim/assembly_valheim/PlayerProfile.cs delete mode 100644 Valheim_v202102/Valheim/assembly_valheim/PointGenerator.cs delete mode 100644 Valheim_v202102/Valheim/assembly_valheim/PrivateArea.cs delete mode 100644 Valheim_v202102/Valheim/assembly_valheim/Procreation.cs delete mode 100644 Valheim_v202102/Valheim/assembly_valheim/Projectile.cs delete mode 100644 Valheim_v202102/Valheim/assembly_valheim/Properties/AssemblyInfo.cs delete mode 100644 Valheim_v202102/Valheim/assembly_valheim/Ragdoll.cs delete mode 100644 Valheim_v202102/Valheim/assembly_valheim/RandEventSystem.cs delete mode 100644 Valheim_v202102/Valheim/assembly_valheim/RandomAnimation.cs delete mode 100644 Valheim_v202102/Valheim/assembly_valheim/RandomEvent.cs delete mode 100644 Valheim_v202102/Valheim/assembly_valheim/RandomFlyingBird.cs delete mode 100644 Valheim_v202102/Valheim/assembly_valheim/RandomIdle.cs delete mode 100644 Valheim_v202102/Valheim/assembly_valheim/RandomMovement.cs delete mode 100644 Valheim_v202102/Valheim/assembly_valheim/RandomSpawn.cs delete mode 100644 Valheim_v202102/Valheim/assembly_valheim/RandomSpeak.cs delete mode 100644 Valheim_v202102/Valheim/assembly_valheim/Raven.cs delete mode 100644 Valheim_v202102/Valheim/assembly_valheim/Recipe.cs delete mode 100644 Valheim_v202102/Valheim/assembly_valheim/ReflectionUpdate.cs delete mode 100644 Valheim_v202102/Valheim/assembly_valheim/Room.cs delete mode 100644 Valheim_v202102/Valheim/assembly_valheim/RoomConnection.cs delete mode 100644 Valheim_v202102/Valheim/assembly_valheim/RopeAttachment.cs delete mode 100644 Valheim_v202102/Valheim/assembly_valheim/RoutedMethod.cs delete mode 100644 Valheim_v202102/Valheim/assembly_valheim/RoutedMethodBase.cs delete mode 100644 Valheim_v202102/Valheim/assembly_valheim/RuneStone.cs delete mode 100644 Valheim_v202102/Valheim/assembly_valheim/SEMan.cs delete mode 100644 Valheim_v202102/Valheim/assembly_valheim/SE_Burning.cs delete mode 100644 Valheim_v202102/Valheim/assembly_valheim/SE_Cozy.cs delete mode 100644 Valheim_v202102/Valheim/assembly_valheim/SE_Finder.cs delete mode 100644 Valheim_v202102/Valheim/assembly_valheim/SE_Frost.cs delete mode 100644 Valheim_v202102/Valheim/assembly_valheim/SE_Harpooned.cs delete mode 100644 Valheim_v202102/Valheim/assembly_valheim/SE_HealthUpgrade.cs delete mode 100644 Valheim_v202102/Valheim/assembly_valheim/SE_Poison.cs delete mode 100644 Valheim_v202102/Valheim/assembly_valheim/SE_Rested.cs delete mode 100644 Valheim_v202102/Valheim/assembly_valheim/SE_Shield.cs delete mode 100644 Valheim_v202102/Valheim/assembly_valheim/SE_Smoke.cs delete mode 100644 Valheim_v202102/Valheim/assembly_valheim/SE_Spawn.cs delete mode 100644 Valheim_v202102/Valheim/assembly_valheim/SE_Stats.cs delete mode 100644 Valheim_v202102/Valheim/assembly_valheim/SE_Wet.cs delete mode 100644 Valheim_v202102/Valheim/assembly_valheim/SceneLoader.cs delete mode 100644 Valheim_v202102/Valheim/assembly_valheim/ScrollRectEnsureVisible.cs delete mode 100644 Valheim_v202102/Valheim/assembly_valheim/ServerCtrl.cs delete mode 100644 Valheim_v202102/Valheim/assembly_valheim/Settings.cs delete mode 100644 Valheim_v202102/Valheim/assembly_valheim/Ship.cs delete mode 100644 Valheim_v202102/Valheim/assembly_valheim/ShipConstructor.cs delete mode 100644 Valheim_v202102/Valheim/assembly_valheim/ShipControlls.cs delete mode 100644 Valheim_v202102/Valheim/assembly_valheim/ShipEffects.cs delete mode 100644 Valheim_v202102/Valheim/assembly_valheim/ShuffleClass.cs delete mode 100644 Valheim_v202102/Valheim/assembly_valheim/Sign.cs delete mode 100644 Valheim_v202102/Valheim/assembly_valheim/Skills.cs delete mode 100644 Valheim_v202102/Valheim/assembly_valheim/SkillsDialog.cs delete mode 100644 Valheim_v202102/Valheim/assembly_valheim/SleepText.cs delete mode 100644 Valheim_v202102/Valheim/assembly_valheim/SlowUpdate.cs delete mode 100644 Valheim_v202102/Valheim/assembly_valheim/SlowUpdater.cs delete mode 100644 Valheim_v202102/Valheim/assembly_valheim/Smelter.cs delete mode 100644 Valheim_v202102/Valheim/assembly_valheim/Smoke.cs delete mode 100644 Valheim_v202102/Valheim/assembly_valheim/SmokeLod.cs delete mode 100644 Valheim_v202102/Valheim/assembly_valheim/SmokeRenderer.cs delete mode 100644 Valheim_v202102/Valheim/assembly_valheim/SmokeSpawner.cs delete mode 100644 Valheim_v202102/Valheim/assembly_valheim/SnapToGround.cs delete mode 100644 Valheim_v202102/Valheim/assembly_valheim/SpawnAbility.cs delete mode 100644 Valheim_v202102/Valheim/assembly_valheim/SpawnArea.cs delete mode 100644 Valheim_v202102/Valheim/assembly_valheim/SpawnOnDamaged.cs delete mode 100644 Valheim_v202102/Valheim/assembly_valheim/SpawnSystem.cs delete mode 100644 Valheim_v202102/Valheim/assembly_valheim/StateController.cs delete mode 100644 Valheim_v202102/Valheim/assembly_valheim/StaticPhysics.cs delete mode 100644 Valheim_v202102/Valheim/assembly_valheim/StaticTarget.cs delete mode 100644 Valheim_v202102/Valheim/assembly_valheim/StationExtension.cs delete mode 100644 Valheim_v202102/Valheim/assembly_valheim/StatusEffect.cs delete mode 100644 Valheim_v202102/Valheim/assembly_valheim/StealthSystem.cs delete mode 100644 Valheim_v202102/Valheim/assembly_valheim/SteamManager.cs delete mode 100644 Valheim_v202102/Valheim/assembly_valheim/StoreGui.cs delete mode 100644 Valheim_v202102/Valheim/assembly_valheim/Switch.cs delete mode 100644 Valheim_v202102/Valheim/assembly_valheim/Tail.cs delete mode 100644 Valheim_v202102/Valheim/assembly_valheim/Talker.cs delete mode 100644 Valheim_v202102/Valheim/assembly_valheim/Tameable.cs delete mode 100644 Valheim_v202102/Valheim/assembly_valheim/Teleport.cs delete mode 100644 Valheim_v202102/Valheim/assembly_valheim/TeleportHome.cs delete mode 100644 Valheim_v202102/Valheim/assembly_valheim/TeleportWorld.cs delete mode 100644 Valheim_v202102/Valheim/assembly_valheim/TeleportWorldTrigger.cs delete mode 100644 Valheim_v202102/Valheim/assembly_valheim/TerrainLod.cs delete mode 100644 Valheim_v202102/Valheim/assembly_valheim/TerrainModifier.cs delete mode 100644 Valheim_v202102/Valheim/assembly_valheim/TestCollision.cs delete mode 100644 Valheim_v202102/Valheim/assembly_valheim/TestSceneCharacter.cs delete mode 100644 Valheim_v202102/Valheim/assembly_valheim/TestSceneSetup.cs delete mode 100644 Valheim_v202102/Valheim/assembly_valheim/TextInput.cs delete mode 100644 Valheim_v202102/Valheim/assembly_valheim/TextReceiver.cs delete mode 100644 Valheim_v202102/Valheim/assembly_valheim/TextViewer.cs delete mode 100644 Valheim_v202102/Valheim/assembly_valheim/TextsDialog.cs delete mode 100644 Valheim_v202102/Valheim/assembly_valheim/ThorFly.cs delete mode 100644 Valheim_v202102/Valheim/assembly_valheim/Thunder.cs delete mode 100644 Valheim_v202102/Valheim/assembly_valheim/TimedDestruction.cs delete mode 100644 Valheim_v202102/Valheim/assembly_valheim/ToggleImage.cs delete mode 100644 Valheim_v202102/Valheim/assembly_valheim/ToggleSwitch.cs delete mode 100644 Valheim_v202102/Valheim/assembly_valheim/TombStone.cs delete mode 100644 Valheim_v202102/Valheim/assembly_valheim/Tracker.cs delete mode 100644 Valheim_v202102/Valheim/assembly_valheim/Trader.cs delete mode 100644 Valheim_v202102/Valheim/assembly_valheim/TreeBase.cs delete mode 100644 Valheim_v202102/Valheim/assembly_valheim/TreeLog.cs delete mode 100644 Valheim_v202102/Valheim/assembly_valheim/Tutorial.cs delete mode 100644 Valheim_v202102/Valheim/assembly_valheim/Vagon.cs delete mode 100644 Valheim_v202102/Valheim/assembly_valheim/Valheim.csproj delete mode 100644 Valheim_v202102/Valheim/assembly_valheim/Valheim.sln delete mode 100644 Valheim_v202102/Valheim/assembly_valheim/Valkyrie.cs delete mode 100644 Valheim_v202102/Valheim/assembly_valheim/VariantDialog.cs delete mode 100644 Valheim_v202102/Valheim/assembly_valheim/Vegvisir.cs delete mode 100644 Valheim_v202102/Valheim/assembly_valheim/Version.cs delete mode 100644 Valheim_v202102/Valheim/assembly_valheim/VisEquipment.cs delete mode 100644 Valheim_v202102/Valheim/assembly_valheim/WaterMark.cs delete mode 100644 Valheim_v202102/Valheim/assembly_valheim/WaterTrigger.cs delete mode 100644 Valheim_v202102/Valheim/assembly_valheim/WaterVolume.cs delete mode 100644 Valheim_v202102/Valheim/assembly_valheim/WayStone.cs delete mode 100644 Valheim_v202102/Valheim/assembly_valheim/WearNTear.cs delete mode 100644 Valheim_v202102/Valheim/assembly_valheim/WearNTearUpdater.cs delete mode 100644 Valheim_v202102/Valheim/assembly_valheim/Windmill.cs delete mode 100644 Valheim_v202102/Valheim/assembly_valheim/World.cs delete mode 100644 Valheim_v202102/Valheim/assembly_valheim/WorldGenerator.cs delete mode 100644 Valheim_v202102/Valheim/assembly_valheim/ZBroastcast.cs delete mode 100644 Valheim_v202102/Valheim/assembly_valheim/ZConnector.cs delete mode 100644 Valheim_v202102/Valheim/assembly_valheim/ZConnector2.cs delete mode 100644 Valheim_v202102/Valheim/assembly_valheim/ZDO.cs delete mode 100644 Valheim_v202102/Valheim/assembly_valheim/ZDOComparer.cs delete mode 100644 Valheim_v202102/Valheim/assembly_valheim/ZDOID.cs delete mode 100644 Valheim_v202102/Valheim/assembly_valheim/ZDOMan.cs delete mode 100644 Valheim_v202102/Valheim/assembly_valheim/ZDOPool.cs delete mode 100644 Valheim_v202102/Valheim/assembly_valheim/ZNat.cs delete mode 100644 Valheim_v202102/Valheim/assembly_valheim/ZNet.cs delete mode 100644 Valheim_v202102/Valheim/assembly_valheim/ZNetPeer.cs delete mode 100644 Valheim_v202102/Valheim/assembly_valheim/ZNetScene.cs delete mode 100644 Valheim_v202102/Valheim/assembly_valheim/ZNetView.cs delete mode 100644 Valheim_v202102/Valheim/assembly_valheim/ZNtp.cs delete mode 100644 Valheim_v202102/Valheim/assembly_valheim/ZPackage.cs delete mode 100644 Valheim_v202102/Valheim/assembly_valheim/ZRoutedRpc.cs delete mode 100644 Valheim_v202102/Valheim/assembly_valheim/ZRpc.cs delete mode 100644 Valheim_v202102/Valheim/assembly_valheim/ZSFX.cs delete mode 100644 Valheim_v202102/Valheim/assembly_valheim/ZSocket.cs delete mode 100644 Valheim_v202102/Valheim/assembly_valheim/ZSocket2.cs delete mode 100644 Valheim_v202102/Valheim/assembly_valheim/ZSteamMatchmaking.cs delete mode 100644 Valheim_v202102/Valheim/assembly_valheim/ZSteamSocket.cs delete mode 100644 Valheim_v202102/Valheim/assembly_valheim/ZSyncAnimation.cs delete mode 100644 Valheim_v202102/Valheim/assembly_valheim/ZSyncTransform.cs delete mode 100644 Valheim_v202102/Valheim/assembly_valheim/ZoneSystem.cs diff --git a/Valheim_r202102_v0.141.2/.gitignore b/Valheim_r202102_v0.141.2/.gitignore new file mode 100644 index 0000000..223208c --- /dev/null +++ b/Valheim_r202102_v0.141.2/.gitignore @@ -0,0 +1,6 @@ +~*.* +*.log +Dump +Valheim/MelonLoader/ +Valheim/Mods/ +Game/ \ No newline at end of file diff --git "a/Valheim_r202102_v0.141.2/Doc/\344\275\234\345\274\212.txt" "b/Valheim_r202102_v0.141.2/Doc/\344\275\234\345\274\212.txt" new file mode 100644 index 0000000..3daed88 --- /dev/null +++ "b/Valheim_r202102_v0.141.2/Doc/\344\275\234\345\274\212.txt" @@ -0,0 +1,10 @@ +https://valheim.fandom.com/wiki/Item_IDs +https://valheim.fandom.com/wiki/Armor +https://www.dexerto.com/gaming/valheim-cheats-all-codes-console-commands-how-enter-them-1696329/ +https://www.rockpapershotgun.com/valheim-cheats-spawn-item-list-console-commands-creative-mode#valheim-spawn-item-codes + +https://commands.gg/valheim/items + +è€ç‰ˆæœ¬è¾“å…¥imacheaterè€Œä¸æ˜¯devcommands + + diff --git "a/Valheim_r202102_v0.141.2/Doc/\345\210\206\346\236\220.xlsx" "b/Valheim_r202102_v0.141.2/Doc/\345\210\206\346\236\220.xlsx" new file mode 100644 index 0000000..d5e5b83 Binary files /dev/null and "b/Valheim_r202102_v0.141.2/Doc/\345\210\206\346\236\220.xlsx" differ diff --git "a/Valheim_r202102_v0.141.2/Doc/\345\210\206\346\236\220/\345\234\260\345\275\242\347\224\237\346\210\220.xlsx" "b/Valheim_r202102_v0.141.2/Doc/\345\210\206\346\236\220/\345\234\260\345\275\242\347\224\237\346\210\220.xlsx" new file mode 100644 index 0000000..10237e2 Binary files /dev/null and "b/Valheim_r202102_v0.141.2/Doc/\345\210\206\346\236\220/\345\234\260\345\275\242\347\224\237\346\210\220.xlsx" differ diff --git "a/Valheim_r202102_v0.141.2/Doc/\345\217\215\347\274\226\350\257\221\345\222\214mod.txt" "b/Valheim_r202102_v0.141.2/Doc/\345\217\215\347\274\226\350\257\221\345\222\214mod.txt" new file mode 100644 index 0000000..229f382 --- /dev/null +++ "b/Valheim_r202102_v0.141.2/Doc/\345\217\215\347\274\226\350\257\221\345\222\214mod.txt" @@ -0,0 +1,9 @@ +https://www.youtube.com/watch?v=XPFvHo1UCTE&ab_channel=SBToonz + +https://github.com/Valheim-Modding/Wiki/wiki/Valheim-Unity-Project-Guide + +https://github.com/heinermann/ValheimExportHelper + +https://www.youtube.com/watch?v=_61pLVH2qPk&ab_channel=BetterCoder + +https://www.youtube.com/watch?v=OanlUYSZkZA&ab_channel=Azumatt \ No newline at end of file diff --git "a/Valheim_r202102_v0.141.2/Doc/\350\257\264\346\230\216.txt" "b/Valheim_r202102_v0.141.2/Doc/\350\257\264\346\230\216.txt" new file mode 100644 index 0000000..dda2762 --- /dev/null +++ "b/Valheim_r202102_v0.141.2/Doc/\350\257\264\346\230\216.txt" @@ -0,0 +1 @@ +knowhow \ No newline at end of file diff --git a/Valheim_r202102_v0.141.2/Valheim/assembly_valheim/.gitignore b/Valheim_r202102_v0.141.2/Valheim/assembly_valheim/.gitignore new file mode 100644 index 0000000..a4da27a --- /dev/null +++ b/Valheim_r202102_v0.141.2/Valheim/assembly_valheim/.gitignore @@ -0,0 +1,399 @@ +## Ignore Visual Studio temporary files, build results, and +## files generated by popular Visual Studio add-ons. +## +## Get latest from https://github.com/github/gitignore/blob/main/VisualStudio.gitignore + +# User-specific files +*.rsuser +*.suo +*.user +*.userosscache +*.sln.docstates + +# User-specific files (MonoDevelop/Xamarin Studio) +*.userprefs + +# Mono auto generated files +mono_crash.* + +# Build results +[Dd]ebug/ +[Dd]ebugPublic/ +[Rr]elease/ +[Rr]eleases/ +x64/ +x86/ +[Ww][Ii][Nn]32/ +[Aa][Rr][Mm]/ +[Aa][Rr][Mm]64/ +bld/ +[Bb]in/ +[Oo]bj/ +[Ll]og/ +[Ll]ogs/ + +# Visual Studio 2015/2017 cache/options directory +.vs/ +# Uncomment if you have tasks that create the project's static files in wwwroot +#wwwroot/ + +# Visual Studio 2017 auto generated files +Generated\ Files/ + +# MSTest test Results +[Tt]est[Rr]esult*/ +[Bb]uild[Ll]og.* + +# NUnit +*.VisualState.xml +TestResult.xml +nunit-*.xml + +# Build Results of an ATL Project +[Dd]ebugPS/ +[Rr]eleasePS/ +dlldata.c + +# Benchmark Results +BenchmarkDotNet.Artifacts/ + +# .NET Core +project.lock.json +project.fragment.lock.json +artifacts/ + +# ASP.NET Scaffolding +ScaffoldingReadMe.txt + +# StyleCop +StyleCopReport.xml + +# Files built by Visual Studio +*_i.c +*_p.c +*_h.h +*.ilk +*.meta +*.obj +*.iobj +*.pch +*.pdb +*.ipdb +*.pgc +*.pgd +*.rsp +*.sbr +*.tlb +*.tli +*.tlh +*.tmp +*.tmp_proj +*_wpftmp.csproj +*.log +*.tlog +*.vspscc +*.vssscc +.builds +*.pidb +*.svclog +*.scc + +# Chutzpah Test files +_Chutzpah* + +# Visual C++ cache files +ipch/ +*.aps +*.ncb +*.opendb +*.opensdf +*.sdf +*.cachefile +*.VC.db +*.VC.VC.opendb + +# Visual Studio profiler +*.psess +*.vsp +*.vspx +*.sap + +# Visual Studio Trace Files +*.e2e + +# TFS 2012 Local Workspace +$tf/ + +# Guidance Automation Toolkit +*.gpState + +# ReSharper is a .NET coding add-in +_ReSharper*/ +*.[Rr]e[Ss]harper +*.DotSettings.user + +# TeamCity is a build add-in +_TeamCity* + +# DotCover is a Code Coverage Tool +*.dotCover + +# AxoCover is a Code Coverage Tool +.axoCover/* +!.axoCover/settings.json + +# Coverlet is a free, cross platform Code Coverage Tool +coverage*.json +coverage*.xml +coverage*.info + +# Visual Studio code coverage results +*.coverage +*.coveragexml + +# NCrunch +_NCrunch_* +.*crunch*.local.xml +nCrunchTemp_* + +# MightyMoose +*.mm.* +AutoTest.Net/ + +# Web workbench (sass) +.sass-cache/ + +# Installshield output folder +[Ee]xpress/ + +# DocProject is a documentation generator add-in +DocProject/buildhelp/ +DocProject/Help/*.HxT +DocProject/Help/*.HxC +DocProject/Help/*.hhc +DocProject/Help/*.hhk +DocProject/Help/*.hhp +DocProject/Help/Html2 +DocProject/Help/html + +# Click-Once directory +publish/ + +# Publish Web Output +*.[Pp]ublish.xml +*.azurePubxml +# Note: Comment the next line if you want to checkin your web deploy settings, +# but database connection strings (with potential passwords) will be unencrypted +*.pubxml +*.publishproj + +# Microsoft Azure Web App publish settings. Comment the next line if you want to +# checkin your Azure Web App publish settings, but sensitive information contained +# in these scripts will be unencrypted +PublishScripts/ + +# NuGet Packages +*.nupkg +# NuGet Symbol Packages +*.snupkg +# The packages folder can be ignored because of Package Restore +**/[Pp]ackages/* +# except build/, which is used as an MSBuild target. +!**/[Pp]ackages/build/ +# Uncomment if necessary however generally it will be regenerated when needed +#!**/[Pp]ackages/repositories.config +# NuGet v3's project.json files produces more ignorable files +*.nuget.props +*.nuget.targets + +# Microsoft Azure Build Output +csx/ +*.build.csdef + +# Microsoft Azure Emulator +ecf/ +rcf/ + +# Windows Store app package directories and files +AppPackages/ +BundleArtifacts/ +Package.StoreAssociation.xml +_pkginfo.txt +*.appx +*.appxbundle +*.appxupload + +# Visual Studio cache files +# files ending in .cache can be ignored +*.[Cc]ache +# but keep track of directories ending in .cache +!?*.[Cc]ache/ + +# Others +ClientBin/ +~$* +*~ +*.dbmdl +*.dbproj.schemaview +*.jfm +*.pfx +*.publishsettings +orleans.codegen.cs + +# Including strong name files can present a security risk +# (https://github.com/github/gitignore/pull/2483#issue-259490424) +#*.snk + +# Since there are multiple workflows, uncomment next line to ignore bower_components +# (https://github.com/github/gitignore/pull/1529#issuecomment-104372622) +#bower_components/ + +# RIA/Silverlight projects +Generated_Code/ + +# Backup & report files from converting an old project file +# to a newer Visual Studio version. Backup files are not needed, +# because we have git ;-) +_UpgradeReport_Files/ +Backup*/ +UpgradeLog*.XML +UpgradeLog*.htm +ServiceFabricBackup/ +*.rptproj.bak + +# SQL Server files +*.mdf +*.ldf +*.ndf + +# Business Intelligence projects +*.rdl.data +*.bim.layout +*.bim_*.settings +*.rptproj.rsuser +*- [Bb]ackup.rdl +*- [Bb]ackup ([0-9]).rdl +*- [Bb]ackup ([0-9][0-9]).rdl + +# Microsoft Fakes +FakesAssemblies/ + +# GhostDoc plugin setting file +*.GhostDoc.xml + +# Node.js Tools for Visual Studio +.ntvs_analysis.dat +node_modules/ + +# Visual Studio 6 build log +*.plg + +# Visual Studio 6 workspace options file +*.opt + +# Visual Studio 6 auto-generated workspace file (contains which files were open etc.) +*.vbw + +# Visual Studio 6 auto-generated project file (contains which files were open etc.) +*.vbp + +# Visual Studio 6 workspace and project file (working project files containing files to include in project) +*.dsw +*.dsp + +# Visual Studio 6 technical files +*.ncb +*.aps + +# Visual Studio LightSwitch build output +**/*.HTMLClient/GeneratedArtifacts +**/*.DesktopClient/GeneratedArtifacts +**/*.DesktopClient/ModelManifest.xml +**/*.Server/GeneratedArtifacts +**/*.Server/ModelManifest.xml +_Pvt_Extensions + +# Paket dependency manager +.paket/paket.exe +paket-files/ + +# FAKE - F# Make +.fake/ + +# CodeRush personal settings +.cr/personal + +# Python Tools for Visual Studio (PTVS) +__pycache__/ +*.pyc + +# Cake - Uncomment if you are using it +# tools/** +# !tools/packages.config + +# Tabs Studio +*.tss + +# Telerik's JustMock configuration file +*.jmconfig + +# BizTalk build output +*.btp.cs +*.btm.cs +*.odx.cs +*.xsd.cs + +# OpenCover UI analysis results +OpenCover/ + +# Azure Stream Analytics local run output +ASALocalRun/ + +# MSBuild Binary and Structured Log +*.binlog + +# NVidia Nsight GPU debugger configuration file +*.nvuser + +# MFractors (Xamarin productivity tool) working folder +.mfractor/ + +# Local History for Visual Studio +.localhistory/ + +# Visual Studio History (VSHistory) files +.vshistory/ + +# BeatPulse healthcheck temp database +healthchecksdb + +# Backup folder for Package Reference Convert tool in Visual Studio 2017 +MigrationBackup/ + +# Ionide (cross platform F# VS Code tools) working folder +.ionide/ + +# Fody - auto-generated XML schema +FodyWeavers.xsd + +# VS Code files for those working on multiple tools +.vscode/* +!.vscode/settings.json +!.vscode/tasks.json +!.vscode/launch.json +!.vscode/extensions.json +*.code-workspace + +# Local History for Visual Studio Code +.history/ + +# Windows Installer files from build outputs +*.cab +*.msi +*.msix +*.msm +*.msp + +# JetBrains Rider +*.sln.iml +.vs diff --git a/Valheim_r202102_v0.141.2/Valheim/assembly_valheim/AnimalAI.cs b/Valheim_r202102_v0.141.2/Valheim/assembly_valheim/AnimalAI.cs new file mode 100644 index 0000000..8f747b4 --- /dev/null +++ b/Valheim_r202102_v0.141.2/Valheim/assembly_valheim/AnimalAI.cs @@ -0,0 +1,80 @@ +using UnityEngine; + +public class AnimalAI : BaseAI +{ + private const float m_updateTargetFarRange = 32f; + + private const float m_updateTargetIntervalNear = 2f; + + private const float m_updateTargetIntervalFar = 10f; + + public float m_timeToSafe = 4f; + + private Character m_target; + + private float m_inDangerTimer; + + private float m_updateTargetTimer; + + protected override void Awake() + { + base.Awake(); + m_updateTargetTimer = Random.Range(0f, 2f); + } + + protected override void OnDamaged(float damage, Character attacker) + { + base.OnDamaged(damage, attacker); + SetAlerted(alert: true); + } + + protected override void UpdateAI(float dt) + { + base.UpdateAI(dt); + if (!m_nview.IsOwner() || (m_afraidOfFire && AvoidFire(dt, null, superAfraid: true))) + { + return; + } + m_updateTargetTimer -= dt; + if (m_updateTargetTimer <= 0f) + { + m_updateTargetTimer = (Character.IsCharacterInRange(base.transform.position, 32f) ? 2f : 10f); + Character character = FindEnemy(); + if ((bool)character) + { + m_target = character; + } + } + if ((bool)m_target && !m_target.IsDead() && CanSenseTarget(m_target)) + { + SetAlerted(alert: true); + } + if (IsAlerted()) + { + m_inDangerTimer += dt; + if (m_inDangerTimer > m_timeToSafe) + { + m_target = null; + SetAlerted(alert: false); + } + } + if ((bool)m_target) + { + Flee(dt, m_target.transform.position); + m_target.OnTargeted(sensed: false, alerted: false); + } + else + { + IdleMovement(dt); + } + } + + protected override void SetAlerted(bool alert) + { + if (alert) + { + m_inDangerTimer = 0f; + } + base.SetAlerted(alert); + } +} diff --git a/Valheim_r202102_v0.141.2/Valheim/assembly_valheim/AnimationEffect.cs b/Valheim_r202102_v0.141.2/Valheim/assembly_valheim/AnimationEffect.cs new file mode 100644 index 0000000..f77f3b2 --- /dev/null +++ b/Valheim_r202102_v0.141.2/Valheim/assembly_valheim/AnimationEffect.cs @@ -0,0 +1,102 @@ +using System.Collections.Generic; +using UnityEngine; + +public class AnimationEffect : MonoBehaviour +{ + public Transform m_effectRoot; + + private Animator m_animator; + + private List m_attachments; + + private int m_attachStateHash; + + private void Start() + { + m_animator = GetComponent(); + } + + public void Effect(AnimationEvent e) + { + string stringParameter = e.stringParameter; + GameObject original = e.objectReferenceParameter as GameObject; + Transform transform = null; + if (stringParameter.Length > 0) + { + transform = Utils.FindChild(base.transform, stringParameter); + } + if (transform == null) + { + transform = (m_effectRoot ? m_effectRoot : base.transform); + } + Object.Instantiate(original, transform.position, transform.rotation); + } + + public void Attach(AnimationEvent e) + { + string stringParameter = e.stringParameter; + GameObject original = e.objectReferenceParameter as GameObject; + Transform transform = Utils.FindChild(base.transform, stringParameter); + if (transform == null) + { + ZLog.LogWarning("Failed to find attach joint " + stringParameter); + return; + } + ClearAttachment(transform); + GameObject gameObject = Object.Instantiate(original, transform.position, transform.rotation); + gameObject.transform.SetParent(transform, worldPositionStays: true); + if (m_attachments == null) + { + m_attachments = new List(); + } + m_attachments.Add(gameObject); + m_attachStateHash = e.animatorStateInfo.fullPathHash; + CancelInvoke("UpdateAttachments"); + InvokeRepeating("UpdateAttachments", 0.1f, 0.1f); + } + + private void ClearAttachment(Transform parent) + { + if (m_attachments == null) + { + return; + } + foreach (GameObject attachment in m_attachments) + { + if ((bool)attachment && attachment.transform.parent == parent) + { + m_attachments.Remove(attachment); + Object.Destroy(attachment); + break; + } + } + } + + public void RemoveAttachments() + { + if (m_attachments == null) + { + return; + } + foreach (GameObject attachment in m_attachments) + { + Object.Destroy(attachment); + } + m_attachments.Clear(); + } + + private void UpdateAttachments() + { + if (m_attachments != null && m_attachments.Count > 0) + { + if (m_attachStateHash != m_animator.GetCurrentAnimatorStateInfo(0).fullPathHash && m_attachStateHash != m_animator.GetNextAnimatorStateInfo(0).fullPathHash) + { + RemoveAttachments(); + } + } + else + { + CancelInvoke("UpdateAttachments"); + } + } +} diff --git a/Valheim_r202102_v0.141.2/Valheim/assembly_valheim/Aoe.cs b/Valheim_r202102_v0.141.2/Valheim/assembly_valheim/Aoe.cs new file mode 100644 index 0000000..4f657e9 --- /dev/null +++ b/Valheim_r202102_v0.141.2/Valheim/assembly_valheim/Aoe.cs @@ -0,0 +1,331 @@ +using System.Collections.Generic; +using System.Text; +using UnityEngine; + +public class Aoe : MonoBehaviour, IProjectile +{ + [Header("Attack (overridden by item )")] + public bool m_useAttackSettings = true; + + public HitData.DamageTypes m_damage; + + public bool m_dodgeable; + + public bool m_blockable; + + public int m_toolTier; + + public float m_attackForce; + + public float m_backstabBonus = 4f; + + public string m_statusEffect = ""; + + [Header("Attack (other)")] + public HitData.DamageTypes m_damagePerLevel; + + public bool m_attackForceForward; + + [Header("Damage self")] + public float m_damageSelf; + + [Header("Ignore targets")] + public bool m_hitOwner; + + public bool m_hitSame; + + public bool m_hitFriendly = true; + + public bool m_hitEnemy = true; + + public bool m_hitCharacters = true; + + public bool m_hitProps = true; + + [Header("Other")] + public Skills.SkillType m_skill; + + public bool m_useTriggers; + + public bool m_triggerEnterOnly; + + public float m_radius = 4f; + + public float m_ttl = 4f; + + public float m_hitInterval = 1f; + + public EffectList m_hitEffects = new EffectList(); + + public bool m_attachToCaster; + + private ZNetView m_nview; + + private Character m_owner; + + private List m_hitList = new List(); + + private float m_hitTimer; + + private Vector3 m_offset = Vector3.zero; + + private Quaternion m_localRot = Quaternion.identity; + + private int m_level; + + private int m_rayMask; + + private void Awake() + { + m_nview = GetComponentInParent(); + m_rayMask = 0; + if (m_hitCharacters) + { + m_rayMask |= LayerMask.GetMask("character", "character_net", "character_ghost"); + } + if (m_hitProps) + { + m_rayMask |= LayerMask.GetMask("Default", "static_solid", "Default_small", "piece", "hitbox", "character_noenv", "vehicle"); + } + } + + public HitData.DamageTypes GetDamage() + { + return GetDamage(m_level); + } + + public HitData.DamageTypes GetDamage(int itemQuality) + { + if (itemQuality <= 1) + { + return m_damage; + } + HitData.DamageTypes damage = m_damage; + damage.Add(m_damagePerLevel, itemQuality - 1); + return damage; + } + + public string GetTooltipString(int itemQuality) + { + StringBuilder stringBuilder = new StringBuilder(256); + stringBuilder.Append("AOE"); + stringBuilder.Append(GetDamage(itemQuality).GetTooltipString()); + stringBuilder.AppendFormat("\n$item_knockback: {0}", m_attackForce); + stringBuilder.AppendFormat("\n$item_backstab: {0}x", m_backstabBonus); + return stringBuilder.ToString(); + } + + private void Start() + { + if ((!(m_nview != null) || (m_nview.IsValid() && m_nview.IsOwner())) && !m_useTriggers && m_hitInterval <= 0f) + { + CheckHits(); + } + } + + private void FixedUpdate() + { + if (m_nview != null && (!m_nview.IsValid() || !m_nview.IsOwner())) + { + return; + } + if (m_hitInterval > 0f) + { + m_hitTimer -= Time.fixedDeltaTime; + if (m_hitTimer <= 0f) + { + m_hitTimer = m_hitInterval; + if (m_useTriggers) + { + m_hitList.Clear(); + } + else + { + CheckHits(); + } + } + } + if (m_owner != null && m_attachToCaster) + { + base.transform.position = m_owner.transform.TransformPoint(m_offset); + base.transform.rotation = m_owner.transform.rotation * m_localRot; + } + if (m_ttl > 0f) + { + m_ttl -= Time.fixedDeltaTime; + if (m_ttl <= 0f) + { + ZNetScene.instance.Destroy(base.gameObject); + } + } + } + + private void CheckHits() + { + m_hitList.Clear(); + Collider[] array = Physics.OverlapSphere(base.transform.position, m_radius, m_rayMask); + bool flag = false; + Collider[] array2 = array; + foreach (Collider collider in array2) + { + if (OnHit(collider, collider.transform.position)) + { + flag = true; + } + } + if (flag && (bool)m_owner && m_owner.IsPlayer() && m_skill != 0) + { + m_owner.RaiseSkill(m_skill); + } + } + + public void Setup(Character owner, Vector3 velocity, float hitNoise, HitData hitData, ItemDrop.ItemData item) + { + m_owner = owner; + if (item != null) + { + m_level = item.m_quality; + } + if (m_attachToCaster && owner != null) + { + m_offset = owner.transform.InverseTransformPoint(base.transform.position); + m_localRot = Quaternion.Inverse(owner.transform.rotation) * base.transform.rotation; + } + if (hitData != null && m_useAttackSettings) + { + m_damage = hitData.m_damage; + m_blockable = hitData.m_blockable; + m_dodgeable = hitData.m_dodgeable; + m_attackForce = hitData.m_pushForce; + m_backstabBonus = hitData.m_backstabBonus; + m_statusEffect = hitData.m_statusEffect; + m_toolTier = hitData.m_toolTier; + } + } + + private void OnTriggerEnter(Collider collider) + { + if (m_triggerEnterOnly) + { + if (!m_useTriggers) + { + ZLog.LogWarning("AOE got OnTriggerStay but trigger damage is disabled in " + base.gameObject.name); + } + else if (!(m_nview != null) || (m_nview.IsValid() && m_nview.IsOwner())) + { + OnHit(collider, collider.transform.position); + } + } + } + + private void OnTriggerStay(Collider collider) + { + if (!m_triggerEnterOnly) + { + if (!m_useTriggers) + { + ZLog.LogWarning("AOE got OnTriggerStay but trigger damage is disabled in " + base.gameObject.name); + } + else if (!(m_nview != null) || (m_nview.IsValid() && m_nview.IsOwner())) + { + OnHit(collider, collider.transform.position); + } + } + } + + private bool OnHit(Collider collider, Vector3 hitPoint) + { + GameObject gameObject = Projectile.FindHitObject(collider); + if (m_hitList.Contains(gameObject)) + { + return false; + } + m_hitList.Add(gameObject); + float num = 1f; + if ((bool)m_owner && m_owner.IsPlayer() && m_skill != 0) + { + num = m_owner.GetRandomSkillFactor(m_skill); + } + bool result = false; + IDestructible component = gameObject.GetComponent(); + if (component != null) + { + Character character = component as Character; + if ((bool)character) + { + if (m_nview == null && !character.IsOwner()) + { + return false; + } + if (m_owner != null) + { + if (!m_hitOwner && character == m_owner) + { + return false; + } + if (!m_hitSame && character.m_name == m_owner.m_name) + { + return false; + } + bool flag = BaseAI.IsEnemy(m_owner, character); + if (!m_hitFriendly && !flag) + { + return false; + } + if (!m_hitEnemy && flag) + { + return false; + } + } + if (!m_hitCharacters) + { + return false; + } + if (m_dodgeable && character.IsDodgeInvincible()) + { + return false; + } + } + else if (!m_hitProps) + { + return false; + } + Vector3 dir = (m_attackForceForward ? base.transform.forward : (hitPoint - base.transform.position).normalized); + HitData hitData = new HitData(); + hitData.m_hitCollider = collider; + hitData.m_damage = GetDamage(); + hitData.m_pushForce = m_attackForce * num; + hitData.m_backstabBonus = m_backstabBonus; + hitData.m_point = hitPoint; + hitData.m_dir = dir; + hitData.m_statusEffect = m_statusEffect; + hitData.m_dodgeable = m_dodgeable; + hitData.m_blockable = m_blockable; + hitData.m_toolTier = m_toolTier; + hitData.SetAttacker(m_owner); + hitData.m_damage.Modify(num); + component.Damage(hitData); + if (m_damageSelf > 0f) + { + IDestructible componentInParent = GetComponentInParent(); + if (componentInParent != null) + { + HitData hitData2 = new HitData(); + hitData2.m_damage.m_damage = m_damageSelf; + hitData2.m_point = base.transform.position; + hitData2.m_blockable = false; + hitData2.m_dodgeable = false; + componentInParent.Damage(hitData2); + } + } + result = true; + } + m_hitEffects.Create(hitPoint, Quaternion.identity); + return result; + } + + private void OnDrawGizmos() + { + _ = m_useTriggers; + } +} diff --git a/Valheim_r202102_v0.141.2/Valheim/assembly_valheim/Attack.cs b/Valheim_r202102_v0.141.2/Valheim/assembly_valheim/Attack.cs new file mode 100644 index 0000000..fe7c100 --- /dev/null +++ b/Valheim_r202102_v0.141.2/Valheim/assembly_valheim/Attack.cs @@ -0,0 +1,988 @@ +using System; +using System.Collections.Generic; +using UnityEngine; +using UnityEngine.Serialization; + +[Serializable] +public class Attack +{ + private class HitPoint + { + public GameObject go; + + public Vector3 avgPoint = Vector3.zero; + + public int count; + + public Vector3 firstPoint; + + public Collider collider; + + public Vector3 closestPoint; + + public float closestDistance = 999999f; + } + + public enum AttackType + { + Horizontal, + Vertical, + Projectile, + None, + Area, + TriggerProjectile + } + + public enum HitPointType + { + Closest, + Average, + First + } + + [Header("Common")] + public AttackType m_attackType; + + public string m_attackAnimation = ""; + + public int m_attackRandomAnimations; + + public int m_attackChainLevels; + + public bool m_consumeItem; + + public bool m_hitTerrain = true; + + public float m_attackStamina = 20f; + + public float m_speedFactor = 0.2f; + + public float m_speedFactorRotation = 0.2f; + + public float m_attackStartNoise = 10f; + + public float m_attackHitNoise = 30f; + + public float m_damageMultiplier = 1f; + + public float m_forceMultiplier = 1f; + + public float m_staggerMultiplier = 1f; + + [Header("Misc")] + public string m_attackOriginJoint = ""; + + public float m_attackRange = 1.5f; + + public float m_attackHeight = 0.6f; + + public float m_attackOffset; + + public GameObject m_spawnOnTrigger; + + [Header("Melee/AOE")] + public float m_attackAngle = 90f; + + public float m_attackRayWidth; + + public float m_maxYAngle; + + public bool m_lowerDamagePerHit = true; + + public HitPointType m_hitPointtype; + + public bool m_hitThroughWalls; + + public bool m_multiHit = true; + + public float m_lastChainDamageMultiplier = 2f; + + [BitMask(typeof(DestructibleType))] + public DestructibleType m_resetChainIfHit; + + [Header("Melee special-skill")] + public Skills.SkillType m_specialHitSkill; + + [BitMask(typeof(DestructibleType))] + public DestructibleType m_specialHitType; + + [Header("Projectile")] + public GameObject m_attackProjectile; + + public float m_projectileVel = 10f; + + public float m_projectileVelMin = 2f; + + public float m_projectileAccuracy = 10f; + + public float m_projectileAccuracyMin = 20f; + + public bool m_useCharacterFacing; + + public bool m_useCharacterFacingYAim; + + [FormerlySerializedAs("m_useCharacterFacingAngle")] + public float m_launchAngle; + + public int m_projectiles = 1; + + public int m_projectileBursts = 1; + + public float m_burstInterval; + + public bool m_destroyPreviousProjectile; + + [Header("Attack-Effects")] + public EffectList m_hitEffect = new EffectList(); + + public EffectList m_hitTerrainEffect = new EffectList(); + + public EffectList m_startEffect = new EffectList(); + + public EffectList m_triggerEffect = new EffectList(); + + public EffectList m_trailStartEffect = new EffectList(); + + protected static int m_attackMask; + + protected static int m_attackMaskTerrain; + + private Humanoid m_character; + + private BaseAI m_baseAI; + + private Rigidbody m_body; + + private ZSyncAnimation m_zanim; + + private CharacterAnimEvent m_animEvent; + + [NonSerialized] + private ItemDrop.ItemData m_weapon; + + private VisEquipment m_visEquipment; + + private float m_attackDrawPercentage; + + private const float m_freezeFrameDuration = 0.15f; + + private const float m_chainAttackMaxTime = 0.2f; + + private int m_nextAttackChainLevel; + + private int m_currentAttackCainLevel; + + private bool m_wasInAttack; + + private float m_time; + + private bool m_projectileAttackStarted; + + private float m_projectileFireTimer = -1f; + + private int m_projectileBurstsFired; + + [NonSerialized] + private ItemDrop.ItemData m_ammoItem; + + public bool StartDraw(Humanoid character, ItemDrop.ItemData weapon) + { + if (!HaveAmmo(character, weapon)) + { + return false; + } + EquipAmmoItem(character, weapon); + return true; + } + + public bool Start(Humanoid character, Rigidbody body, ZSyncAnimation zanim, CharacterAnimEvent animEvent, VisEquipment visEquipment, ItemDrop.ItemData weapon, Attack previousAttack, float timeSinceLastAttack, float attackDrawPercentage) + { + if (m_attackAnimation == "") + { + return false; + } + m_character = character; + m_baseAI = m_character.GetComponent(); + m_body = body; + m_zanim = zanim; + m_animEvent = animEvent; + m_visEquipment = visEquipment; + m_weapon = weapon; + m_attackDrawPercentage = attackDrawPercentage; + if (m_attackMask == 0) + { + m_attackMask = LayerMask.GetMask("Default", "static_solid", "Default_small", "piece", "piece_nonsolid", "character", "character_net", "character_ghost", "hitbox", "character_noenv", "vehicle"); + m_attackMaskTerrain = LayerMask.GetMask("Default", "static_solid", "Default_small", "piece", "piece_nonsolid", "terrain", "character", "character_net", "character_ghost", "hitbox", "character_noenv", "vehicle"); + } + float staminaUsage = GetStaminaUsage(); + if (staminaUsage > 0f && !character.HaveStamina(staminaUsage + 0.1f)) + { + if (character.IsPlayer()) + { + Hud.instance.StaminaBarNoStaminaFlash(); + } + return false; + } + if (!HaveAmmo(character, m_weapon)) + { + return false; + } + EquipAmmoItem(character, m_weapon); + if (m_attackChainLevels > 1) + { + if (previousAttack != null && previousAttack.m_attackAnimation == m_attackAnimation) + { + m_currentAttackCainLevel = previousAttack.m_nextAttackChainLevel; + } + if (m_currentAttackCainLevel >= m_attackChainLevels || timeSinceLastAttack > 0.2f) + { + m_currentAttackCainLevel = 0; + } + m_zanim.SetTrigger(m_attackAnimation + m_currentAttackCainLevel); + } + else if (m_attackRandomAnimations >= 2) + { + int num = UnityEngine.Random.Range(0, m_attackRandomAnimations); + m_zanim.SetTrigger(m_attackAnimation + num); + } + else + { + m_zanim.SetTrigger(m_attackAnimation); + } + if (character.IsPlayer() && m_attackType != AttackType.None && m_currentAttackCainLevel == 0) + { + if (ZInput.IsMouseActive() || m_attackType == AttackType.Projectile) + { + character.transform.rotation = character.GetLookYaw(); + m_body.rotation = character.transform.rotation; + } + else if (ZInput.IsGamepadActive() && !character.IsBlocking() && character.GetMoveDir().magnitude > 0.3f) + { + character.transform.rotation = Quaternion.LookRotation(character.GetMoveDir()); + m_body.rotation = character.transform.rotation; + } + } + weapon.m_lastAttackTime = Time.time; + m_animEvent.ResetChain(); + return true; + } + + private float GetStaminaUsage() + { + if (m_attackStamina <= 0f) + { + return 0f; + } + float attackStamina = m_attackStamina; + float skillFactor = m_character.GetSkillFactor(m_weapon.m_shared.m_skillType); + return attackStamina - attackStamina * 0.33f * skillFactor; + } + + public void Update(float dt) + { + m_time += dt; + if (m_character.InAttack()) + { + if (!m_wasInAttack) + { + m_character.UseStamina(GetStaminaUsage()); + Transform attackOrigin = GetAttackOrigin(); + m_weapon.m_shared.m_startEffect.Create(attackOrigin.position, m_character.transform.rotation, attackOrigin); + m_startEffect.Create(attackOrigin.position, m_character.transform.rotation, attackOrigin); + m_character.AddNoise(m_attackStartNoise); + m_nextAttackChainLevel = m_currentAttackCainLevel + 1; + if (m_nextAttackChainLevel >= m_attackChainLevels) + { + m_nextAttackChainLevel = 0; + } + } + m_wasInAttack = true; + } + else if (m_wasInAttack) + { + OnAttackDone(); + m_wasInAttack = false; + } + UpdateProjectile(dt); + } + + private void OnAttackDone() + { + if ((bool)m_visEquipment) + { + m_visEquipment.SetWeaponTrails(enabled: false); + } + } + + public void Stop() + { + if (m_wasInAttack) + { + OnAttackDone(); + m_wasInAttack = false; + } + } + + public void OnAttackTrigger() + { + if (UseAmmo()) + { + switch (m_attackType) + { + case AttackType.Horizontal: + case AttackType.Vertical: + DoMeleeAttack(); + break; + case AttackType.Area: + DoAreaAttack(); + break; + case AttackType.Projectile: + ProjectileAttackTriggered(); + break; + case AttackType.None: + DoNonAttack(); + break; + } + if (m_consumeItem) + { + ConsumeItem(); + } + } + } + + private void ConsumeItem() + { + if (m_weapon.m_shared.m_maxStackSize > 1 && m_weapon.m_stack > 1) + { + m_weapon.m_stack--; + return; + } + m_character.UnequipItem(m_weapon, triggerEquipEffects: false); + m_character.GetInventory().RemoveItem(m_weapon); + } + + private static bool EquipAmmoItem(Humanoid character, ItemDrop.ItemData weapon) + { + if (!string.IsNullOrEmpty(weapon.m_shared.m_ammoType)) + { + ItemDrop.ItemData ammoItem = character.GetAmmoItem(); + if (ammoItem != null && character.GetInventory().ContainsItem(ammoItem) && ammoItem.m_shared.m_ammoType == weapon.m_shared.m_ammoType) + { + return true; + } + ItemDrop.ItemData ammoItem2 = character.GetInventory().GetAmmoItem(weapon.m_shared.m_ammoType); + if (ammoItem2.m_shared.m_itemType == ItemDrop.ItemData.ItemType.Ammo) + { + return character.EquipItem(ammoItem2); + } + } + return true; + } + + private static bool HaveAmmo(Humanoid character, ItemDrop.ItemData weapon) + { + if (!string.IsNullOrEmpty(weapon.m_shared.m_ammoType)) + { + ItemDrop.ItemData itemData = character.GetAmmoItem(); + if (itemData != null && (!character.GetInventory().ContainsItem(itemData) || itemData.m_shared.m_ammoType != weapon.m_shared.m_ammoType)) + { + itemData = null; + } + if (itemData == null) + { + itemData = character.GetInventory().GetAmmoItem(weapon.m_shared.m_ammoType); + } + if (itemData == null) + { + character.Message(MessageHud.MessageType.Center, "$msg_outof " + weapon.m_shared.m_ammoType); + return false; + } + if (itemData.m_shared.m_itemType == ItemDrop.ItemData.ItemType.Consumable) + { + return character.CanConsumeItem(itemData); + } + return true; + } + return true; + } + + private bool UseAmmo() + { + m_ammoItem = null; + ItemDrop.ItemData itemData = null; + if (!string.IsNullOrEmpty(m_weapon.m_shared.m_ammoType)) + { + itemData = m_character.GetAmmoItem(); + if (itemData != null && (!m_character.GetInventory().ContainsItem(itemData) || itemData.m_shared.m_ammoType != m_weapon.m_shared.m_ammoType)) + { + itemData = null; + } + if (itemData == null) + { + itemData = m_character.GetInventory().GetAmmoItem(m_weapon.m_shared.m_ammoType); + } + if (itemData == null) + { + m_character.Message(MessageHud.MessageType.Center, "$msg_outof " + m_weapon.m_shared.m_ammoType); + return false; + } + if (itemData.m_shared.m_itemType == ItemDrop.ItemData.ItemType.Consumable) + { + bool num = m_character.ConsumeItem(m_character.GetInventory(), itemData); + if (num) + { + m_ammoItem = itemData; + } + return num; + } + m_character.GetInventory().RemoveItem(itemData, 1); + m_ammoItem = itemData; + return true; + } + return true; + } + + private void ProjectileAttackTriggered() + { + GetProjectileSpawnPoint(out var spawnPoint, out var aimDir); + m_weapon.m_shared.m_triggerEffect.Create(spawnPoint, Quaternion.LookRotation(aimDir)); + m_triggerEffect.Create(spawnPoint, Quaternion.LookRotation(aimDir)); + if (m_weapon.m_shared.m_useDurability && m_character.IsPlayer()) + { + m_weapon.m_durability -= m_weapon.m_shared.m_useDurabilityDrain; + } + if (m_projectileBursts == 1) + { + FireProjectileBurst(); + } + else + { + m_projectileAttackStarted = true; + } + } + + private void UpdateProjectile(float dt) + { + if (m_projectileAttackStarted && m_projectileBurstsFired < m_projectileBursts) + { + m_projectileFireTimer -= dt; + if (m_projectileFireTimer <= 0f) + { + m_projectileFireTimer = m_burstInterval; + FireProjectileBurst(); + m_projectileBurstsFired++; + } + } + } + + private Transform GetAttackOrigin() + { + if (m_attackOriginJoint.Length > 0) + { + return Utils.FindChild(m_character.GetVisual().transform, m_attackOriginJoint); + } + return m_character.transform; + } + + private void GetProjectileSpawnPoint(out Vector3 spawnPoint, out Vector3 aimDir) + { + Transform attackOrigin = GetAttackOrigin(); + Transform transform = m_character.transform; + spawnPoint = attackOrigin.position + transform.up * m_attackHeight + transform.forward * m_attackRange + transform.right * m_attackOffset; + aimDir = m_character.GetAimDir(spawnPoint); + if ((bool)m_baseAI) + { + Character targetCreature = m_baseAI.GetTargetCreature(); + if ((bool)targetCreature) + { + Vector3 normalized = (targetCreature.GetCenterPoint() - spawnPoint).normalized; + aimDir = Vector3.RotateTowards(m_character.transform.forward, normalized, (float)Math.PI / 2f, 1f); + } + } + } + + private void FireProjectileBurst() + { + ItemDrop.ItemData ammoItem = m_ammoItem; + GameObject attackProjectile = m_attackProjectile; + float num = m_projectileVel; + float num2 = m_projectileVelMin; + float num3 = m_projectileAccuracy; + float num4 = m_projectileAccuracyMin; + float num5 = m_attackHitNoise; + if (ammoItem != null && (bool)ammoItem.m_shared.m_attack.m_attackProjectile) + { + attackProjectile = ammoItem.m_shared.m_attack.m_attackProjectile; + num += ammoItem.m_shared.m_attack.m_projectileVel; + num2 += ammoItem.m_shared.m_attack.m_projectileVelMin; + num3 += ammoItem.m_shared.m_attack.m_projectileAccuracy; + num4 += ammoItem.m_shared.m_attack.m_projectileAccuracyMin; + num5 += ammoItem.m_shared.m_attack.m_attackHitNoise; + } + float num6 = m_character.GetRandomSkillFactor(m_weapon.m_shared.m_skillType); + if (m_weapon.m_shared.m_holdDurationMin > 0f) + { + num3 = Mathf.Lerp(num4, num3, Mathf.Pow(m_attackDrawPercentage, 0.5f)); + num6 *= m_attackDrawPercentage; + num = Mathf.Lerp(num2, num, m_attackDrawPercentage); + } + GetProjectileSpawnPoint(out var spawnPoint, out var aimDir); + Transform transform = m_character.transform; + if (m_useCharacterFacing) + { + Vector3 forward = Vector3.forward; + if (m_useCharacterFacingYAim) + { + forward.y = aimDir.y; + } + aimDir = transform.TransformDirection(forward); + } + if (m_launchAngle != 0f) + { + Vector3 axis = Vector3.Cross(Vector3.up, aimDir); + aimDir = Quaternion.AngleAxis(m_launchAngle, axis) * aimDir; + } + for (int i = 0; i < m_projectiles; i++) + { + if (m_destroyPreviousProjectile && (bool)m_weapon.m_lastProjectile) + { + ZNetScene.instance.Destroy(m_weapon.m_lastProjectile); + m_weapon.m_lastProjectile = null; + } + Vector3 vector = aimDir; + Vector3 axis2 = Vector3.Cross(vector, Vector3.up); + Quaternion quaternion = Quaternion.AngleAxis(UnityEngine.Random.Range(0f - num3, num3), Vector3.up); + vector = Quaternion.AngleAxis(UnityEngine.Random.Range(0f - num3, num3), axis2) * vector; + vector = quaternion * vector; + GameObject gameObject = UnityEngine.Object.Instantiate(attackProjectile, spawnPoint, Quaternion.LookRotation(vector)); + HitData hitData = new HitData(); + hitData.m_toolTier = m_weapon.m_shared.m_toolTier; + hitData.m_pushForce = m_weapon.m_shared.m_attackForce * m_forceMultiplier; + hitData.m_backstabBonus = m_weapon.m_shared.m_backstabBonus; + hitData.m_staggerMultiplier = m_staggerMultiplier; + hitData.m_damage.Add(m_weapon.GetDamage()); + hitData.m_statusEffect = (m_weapon.m_shared.m_attackStatusEffect ? m_weapon.m_shared.m_attackStatusEffect.name : ""); + hitData.m_blockable = m_weapon.m_shared.m_blockable; + hitData.m_dodgeable = m_weapon.m_shared.m_dodgeable; + hitData.m_skill = m_weapon.m_shared.m_skillType; + hitData.SetAttacker(m_character); + if (ammoItem != null) + { + hitData.m_damage.Add(ammoItem.GetDamage()); + hitData.m_pushForce += ammoItem.m_shared.m_attackForce; + if (ammoItem.m_shared.m_attackStatusEffect != null) + { + hitData.m_statusEffect = ammoItem.m_shared.m_attackStatusEffect.name; + } + if (!ammoItem.m_shared.m_blockable) + { + hitData.m_blockable = false; + } + if (!ammoItem.m_shared.m_dodgeable) + { + hitData.m_dodgeable = false; + } + } + hitData.m_pushForce *= num6; + hitData.m_damage.Modify(m_damageMultiplier); + hitData.m_damage.Modify(num6); + hitData.m_damage.Modify(GetLevelDamageFactor()); + m_character.GetSEMan().ModifyAttack(m_weapon.m_shared.m_skillType, ref hitData); + gameObject.GetComponent()?.Setup(m_character, vector * num, num5, hitData, m_weapon); + m_weapon.m_lastProjectile = gameObject; + } + } + + private void DoNonAttack() + { + if (m_weapon.m_shared.m_useDurability && m_character.IsPlayer()) + { + m_weapon.m_durability -= m_weapon.m_shared.m_useDurabilityDrain; + } + Transform attackOrigin = GetAttackOrigin(); + m_weapon.m_shared.m_triggerEffect.Create(attackOrigin.position, m_character.transform.rotation, attackOrigin); + m_triggerEffect.Create(attackOrigin.position, m_character.transform.rotation, attackOrigin); + if ((bool)m_weapon.m_shared.m_consumeStatusEffect) + { + m_character.GetSEMan().AddStatusEffect(m_weapon.m_shared.m_consumeStatusEffect, resetTime: true); + } + m_character.AddNoise(m_attackHitNoise); + } + + private float GetLevelDamageFactor() + { + return 1f + (float)Mathf.Max(0, m_character.GetLevel() - 1) * 0.5f; + } + + private void DoAreaAttack() + { + Transform transform = m_character.transform; + Transform attackOrigin = GetAttackOrigin(); + Vector3 vector = attackOrigin.position + Vector3.up * m_attackHeight + transform.forward * m_attackRange + transform.right * m_attackOffset; + m_weapon.m_shared.m_triggerEffect.Create(vector, transform.rotation, attackOrigin); + m_triggerEffect.Create(vector, transform.rotation, attackOrigin); + Vector3 vector2 = vector - transform.position; + vector2.y = 0f; + vector2.Normalize(); + int num = 0; + Vector3 zero = Vector3.zero; + bool flag = false; + bool flag2 = false; + float randomSkillFactor = m_character.GetRandomSkillFactor(m_weapon.m_shared.m_skillType); + int layerMask = (m_hitTerrain ? m_attackMaskTerrain : m_attackMask); + Collider[] array = Physics.OverlapSphere(vector, m_attackRayWidth, layerMask, QueryTriggerInteraction.UseGlobal); + HashSet hashSet = new HashSet(); + Collider[] array2 = array; + foreach (Collider collider in array2) + { + if (collider.gameObject == m_character.gameObject) + { + continue; + } + GameObject gameObject = Projectile.FindHitObject(collider); + if (gameObject == m_character.gameObject || hashSet.Contains(gameObject)) + { + continue; + } + hashSet.Add(gameObject); + Vector3 vector3 = ((!(collider is MeshCollider)) ? collider.ClosestPoint(vector) : collider.ClosestPointOnBounds(vector)); + IDestructible component = gameObject.GetComponent(); + if (component != null) + { + Vector3 vector4 = vector3 - vector; + vector4.y = 0f; + float num2 = Vector3.Dot(vector2, vector4); + if (num2 < 0f) + { + vector4 += vector2 * (0f - num2); + } + vector4.Normalize(); + HitData hitData = new HitData(); + hitData.m_toolTier = m_weapon.m_shared.m_toolTier; + hitData.m_statusEffect = (m_weapon.m_shared.m_attackStatusEffect ? m_weapon.m_shared.m_attackStatusEffect.name : ""); + hitData.m_pushForce = m_weapon.m_shared.m_attackForce * randomSkillFactor * m_forceMultiplier; + hitData.m_backstabBonus = m_weapon.m_shared.m_backstabBonus; + hitData.m_staggerMultiplier = m_staggerMultiplier; + hitData.m_dodgeable = m_weapon.m_shared.m_dodgeable; + hitData.m_blockable = m_weapon.m_shared.m_blockable; + hitData.m_skill = m_weapon.m_shared.m_skillType; + hitData.m_damage.Add(m_weapon.GetDamage()); + hitData.m_point = vector3; + hitData.m_dir = vector4; + hitData.m_hitCollider = collider; + hitData.SetAttacker(m_character); + hitData.m_damage.Modify(m_damageMultiplier); + hitData.m_damage.Modify(randomSkillFactor); + hitData.m_damage.Modify(GetLevelDamageFactor()); + if (m_attackChainLevels > 1 && m_currentAttackCainLevel == m_attackChainLevels - 1 && m_lastChainDamageMultiplier > 1f) + { + hitData.m_damage.Modify(m_lastChainDamageMultiplier); + hitData.m_pushForce *= 1.2f; + } + m_character.GetSEMan().ModifyAttack(m_weapon.m_shared.m_skillType, ref hitData); + Character character = component as Character; + if ((bool)character) + { + if ((!m_character.IsPlayer() && !BaseAI.IsEnemy(m_character, character)) || (hitData.m_dodgeable && character.IsDodgeInvincible())) + { + continue; + } + flag2 = true; + } + component.Damage(hitData); + flag = true; + } + num++; + zero += vector3; + } + if (num > 0) + { + zero /= (float)num; + m_weapon.m_shared.m_hitEffect.Create(zero, Quaternion.identity); + m_hitEffect.Create(zero, Quaternion.identity); + if (m_weapon.m_shared.m_useDurability && m_character.IsPlayer()) + { + m_weapon.m_durability -= 1f; + } + m_character.AddNoise(m_attackHitNoise); + if (flag) + { + m_character.RaiseSkill(m_weapon.m_shared.m_skillType, flag2 ? 1.5f : 1f); + } + } + if ((bool)m_spawnOnTrigger) + { + UnityEngine.Object.Instantiate(m_spawnOnTrigger, vector, Quaternion.identity).GetComponent()?.Setup(m_character, m_character.transform.forward, -1f, null, null); + } + } + + private void GetMeleeAttackDir(out Transform originJoint, out Vector3 attackDir) + { + originJoint = GetAttackOrigin(); + Vector3 forward = m_character.transform.forward; + Vector3 aimDir = m_character.GetAimDir(originJoint.position); + aimDir.x = forward.x; + aimDir.z = forward.z; + aimDir.Normalize(); + attackDir = Vector3.RotateTowards(m_character.transform.forward, aimDir, (float)Math.PI / 180f * m_maxYAngle, 10f); + } + + private void AddHitPoint(List list, GameObject go, Collider collider, Vector3 point, float distance) + { + HitPoint hitPoint = null; + for (int num = list.Count - 1; num >= 0; num--) + { + if (list[num].go == go) + { + hitPoint = list[num]; + break; + } + } + if (hitPoint == null) + { + hitPoint = new HitPoint(); + hitPoint.go = go; + hitPoint.collider = collider; + hitPoint.firstPoint = point; + list.Add(hitPoint); + } + hitPoint.avgPoint += point; + hitPoint.count++; + if (distance < hitPoint.closestDistance) + { + hitPoint.closestPoint = point; + hitPoint.closestDistance = distance; + } + } + + private void DoMeleeAttack() + { + GetMeleeAttackDir(out var originJoint, out var attackDir); + Vector3 vector = m_character.transform.InverseTransformDirection(attackDir); + Quaternion quaternion = Quaternion.LookRotation(attackDir, Vector3.up); + m_weapon.m_shared.m_triggerEffect.Create(originJoint.position, quaternion, originJoint); + m_triggerEffect.Create(originJoint.position, quaternion, originJoint); + Vector3 vector2 = originJoint.position + Vector3.up * m_attackHeight + m_character.transform.right * m_attackOffset; + float num = m_attackAngle / 2f; + float num2 = 4f; + float attackRange = m_attackRange; + List list = new List(); + HashSet hashSet = new HashSet(); + int layerMask = (m_hitTerrain ? m_attackMaskTerrain : m_attackMask); + for (float num3 = 0f - num; num3 <= num; num3 += num2) + { + Quaternion quaternion2 = Quaternion.identity; + if (m_attackType == AttackType.Horizontal) + { + quaternion2 = Quaternion.Euler(0f, 0f - num3, 0f); + } + else if (m_attackType == AttackType.Vertical) + { + quaternion2 = Quaternion.Euler(num3, 0f, 0f); + } + Vector3 vector3 = m_character.transform.TransformDirection(quaternion2 * vector); + Debug.DrawLine(vector2, vector2 + vector3 * attackRange); + RaycastHit[] array = ((!(m_attackRayWidth > 0f)) ? Physics.RaycastAll(vector2, vector3, attackRange, layerMask, QueryTriggerInteraction.Ignore) : Physics.SphereCastAll(vector2, m_attackRayWidth, vector3, Mathf.Max(0f, attackRange - m_attackRayWidth), layerMask, QueryTriggerInteraction.Ignore)); + Array.Sort(array, (RaycastHit x, RaycastHit y) => x.distance.CompareTo(y.distance)); + RaycastHit[] array2 = array; + for (int i = 0; i < array2.Length; i++) + { + RaycastHit raycastHit = array2[i]; + if (raycastHit.collider.gameObject == m_character.gameObject) + { + continue; + } + Vector3 vector4 = raycastHit.point; + if (raycastHit.distance < float.Epsilon) + { + vector4 = ((!(raycastHit.collider is MeshCollider)) ? raycastHit.collider.ClosestPoint(vector2) : (vector2 + vector3 * attackRange)); + } + if (m_attackAngle < 180f && Vector3.Dot(vector4 - vector2, attackDir) <= 0f) + { + continue; + } + GameObject gameObject = Projectile.FindHitObject(raycastHit.collider); + if (gameObject == m_character.gameObject) + { + continue; + } + Vagon component = gameObject.GetComponent(); + if ((bool)component && component.IsAttached(m_character)) + { + continue; + } + Character component2 = gameObject.GetComponent(); + if (!(component2 != null) || ((m_character.IsPlayer() || BaseAI.IsEnemy(m_character, component2)) && (!m_weapon.m_shared.m_dodgeable || !component2.IsDodgeInvincible()))) + { + AddHitPoint(list, gameObject, raycastHit.collider, vector4, raycastHit.distance); + if (!m_hitThroughWalls) + { + break; + } + } + } + } + int num4 = 0; + Vector3 zero = Vector3.zero; + bool flag = false; + bool flag2 = false; + foreach (HitPoint item in list) + { + GameObject go = item.go; + Vector3 vector5 = item.avgPoint / item.count; + Vector3 vector6 = vector5; + switch (m_hitPointtype) + { + case HitPointType.Average: + vector6 = vector5; + break; + case HitPointType.First: + vector6 = item.firstPoint; + break; + case HitPointType.Closest: + vector6 = item.closestPoint; + break; + } + num4++; + zero += vector5; + m_weapon.m_shared.m_hitEffect.Create(vector6, Quaternion.identity); + m_hitEffect.Create(vector6, Quaternion.identity); + IDestructible component3 = go.GetComponent(); + if (component3 != null) + { + DestructibleType destructibleType = component3.GetDestructibleType(); + Skills.SkillType skillType = m_weapon.m_shared.m_skillType; + if (m_specialHitSkill != 0 && (destructibleType & m_specialHitType) != 0) + { + skillType = m_specialHitSkill; + } + float num5 = m_character.GetRandomSkillFactor(skillType); + if (m_lowerDamagePerHit && list.Count > 1) + { + num5 /= (float)list.Count * 0.75f; + } + HitData hitData = new HitData(); + hitData.m_toolTier = m_weapon.m_shared.m_toolTier; + hitData.m_statusEffect = (m_weapon.m_shared.m_attackStatusEffect ? m_weapon.m_shared.m_attackStatusEffect.name : ""); + hitData.m_pushForce = m_weapon.m_shared.m_attackForce * num5 * m_forceMultiplier; + hitData.m_backstabBonus = m_weapon.m_shared.m_backstabBonus; + hitData.m_staggerMultiplier = m_staggerMultiplier; + hitData.m_dodgeable = m_weapon.m_shared.m_dodgeable; + hitData.m_blockable = m_weapon.m_shared.m_blockable; + hitData.m_skill = skillType; + hitData.m_damage = m_weapon.GetDamage(); + hitData.m_point = vector6; + hitData.m_dir = (vector6 - vector2).normalized; + hitData.m_hitCollider = item.collider; + hitData.SetAttacker(m_character); + hitData.m_damage.Modify(m_damageMultiplier); + hitData.m_damage.Modify(num5); + hitData.m_damage.Modify(GetLevelDamageFactor()); + if (m_attackChainLevels > 1 && m_currentAttackCainLevel == m_attackChainLevels - 1) + { + hitData.m_damage.Modify(2f); + hitData.m_pushForce *= 1.2f; + } + m_character.GetSEMan().ModifyAttack(skillType, ref hitData); + if (component3 is Character) + { + flag2 = true; + } + component3.Damage(hitData); + if ((destructibleType & m_resetChainIfHit) != 0) + { + m_nextAttackChainLevel = 0; + } + hashSet.Add(skillType); + if (!m_multiHit) + { + break; + } + } + if (go.GetComponent() != null && !flag) + { + flag = true; + m_weapon.m_shared.m_hitTerrainEffect.Create(vector5, quaternion); + m_hitTerrainEffect.Create(vector5, quaternion); + if ((bool)m_weapon.m_shared.m_spawnOnHitTerrain) + { + SpawnOnHitTerrain(vector5, m_weapon.m_shared.m_spawnOnHitTerrain); + } + if (!m_multiHit) + { + break; + } + } + } + if (num4 > 0) + { + zero /= (float)num4; + if (m_weapon.m_shared.m_useDurability && m_character.IsPlayer()) + { + m_weapon.m_durability -= m_weapon.m_shared.m_useDurabilityDrain; + } + m_character.AddNoise(m_attackHitNoise); + m_animEvent.FreezeFrame(0.15f); + if ((bool)m_weapon.m_shared.m_spawnOnHit) + { + UnityEngine.Object.Instantiate(m_weapon.m_shared.m_spawnOnHit, zero, quaternion).GetComponent()?.Setup(m_character, Vector3.zero, m_attackHitNoise, null, m_weapon); + } + foreach (Skills.SkillType item2 in hashSet) + { + m_character.RaiseSkill(item2, flag2 ? 1.5f : 1f); + } + } + if ((bool)m_spawnOnTrigger) + { + UnityEngine.Object.Instantiate(m_spawnOnTrigger, vector2, Quaternion.identity).GetComponent()?.Setup(m_character, m_character.transform.forward, -1f, null, m_weapon); + } + } + + private void SpawnOnHitTerrain(Vector3 hitPoint, GameObject prefab) + { + TerrainModifier componentInChildren = prefab.GetComponentInChildren(); + if (!componentInChildren || (PrivateArea.CheckAccess(hitPoint, componentInChildren.GetRadius()) && !Location.IsInsideNoBuildLocation(hitPoint))) + { + TerrainModifier.SetTriggerOnPlaced(trigger: true); + GameObject gameObject = UnityEngine.Object.Instantiate(prefab, hitPoint, Quaternion.LookRotation(m_character.transform.forward)); + TerrainModifier.SetTriggerOnPlaced(trigger: false); + gameObject.GetComponent()?.Setup(m_character, Vector3.zero, m_attackHitNoise, null, m_weapon); + } + } + + public Attack Clone() + { + return MemberwiseClone() as Attack; + } + + public ItemDrop.ItemData GetWeapon() + { + return m_weapon; + } + + public bool CanStartChainAttack() + { + if (m_nextAttackChainLevel > 0) + { + return m_animEvent.CanChain(); + } + return false; + } + + public void OnTrailStart() + { + if (m_attackType == AttackType.Projectile) + { + Transform attackOrigin = GetAttackOrigin(); + m_weapon.m_shared.m_trailStartEffect.Create(attackOrigin.position, m_character.transform.rotation); + m_trailStartEffect.Create(attackOrigin.position, m_character.transform.rotation); + } + else + { + GetMeleeAttackDir(out var originJoint, out var attackDir); + Quaternion rot = Quaternion.LookRotation(attackDir, Vector3.up); + m_weapon.m_shared.m_trailStartEffect.Create(originJoint.position, rot); + m_trailStartEffect.Create(originJoint.position, rot); + } + } +} diff --git a/Valheim_r202102_v0.141.2/Valheim/assembly_valheim/AudioMan.cs b/Valheim_r202102_v0.141.2/Valheim/assembly_valheim/AudioMan.cs new file mode 100644 index 0000000..3c4d300 --- /dev/null +++ b/Valheim_r202102_v0.141.2/Valheim/assembly_valheim/AudioMan.cs @@ -0,0 +1,496 @@ +using System; +using System.Collections.Generic; +using UnityEngine; +using UnityEngine.Audio; +using UnityEngine.Rendering; + +public class AudioMan : MonoBehaviour +{ + [Serializable] + public class BiomeAmbients + { + public string m_name = ""; + + [BitMask(typeof(Heightmap.Biome))] + public Heightmap.Biome m_biome; + + public List m_randomAmbientClips = new List(); + + public List m_randomAmbientClipsDay = new List(); + + public List m_randomAmbientClipsNight = new List(); + } + + private enum Snapshot + { + Default, + Menu, + Indoor + } + + private static AudioMan m_instance; + + [Header("Mixers")] + public AudioMixerGroup m_ambientMixer; + + public AudioMixer m_masterMixer; + + public float m_snapshotTransitionTime = 2f; + + [Header("Wind")] + public AudioClip m_windAudio; + + public float m_windMinVol; + + public float m_windMaxVol = 1f; + + public float m_windMinPitch = 0.5f; + + public float m_windMaxPitch = 1.5f; + + public float m_windVariation = 0.2f; + + public float m_windIntensityPower = 1.5f; + + [Header("Ocean")] + public AudioClip m_oceanAudio; + + public float m_oceanVolumeMax = 1f; + + public float m_oceanVolumeMin = 1f; + + public float m_oceanFadeSpeed = 0.1f; + + public float m_oceanMoveSpeed = 0.1f; + + public float m_oceanDepthTreshold = 10f; + + [Header("Random ambients")] + public float m_ambientFadeTime = 2f; + + public float m_randomAmbientInterval = 5f; + + public float m_randomAmbientChance = 0.5f; + + public float m_randomMinPitch = 0.9f; + + public float m_randomMaxPitch = 1.1f; + + public float m_randomMinVol = 0.2f; + + public float m_randomMaxVol = 0.4f; + + public float m_randomPan = 0.2f; + + public float m_randomFadeIn = 0.2f; + + public float m_randomFadeOut = 2f; + + public float m_randomMinDistance = 5f; + + public float m_randomMaxDistance = 20f; + + public List m_randomAmbients = new List(); + + public GameObject m_randomAmbientPrefab; + + private AudioSource m_oceanAmbientSource; + + private AudioSource m_ambientLoopSource; + + private AudioSource m_windLoopSource; + + private AudioClip m_queuedAmbientLoop; + + private float m_queuedAmbientVol; + + private float m_ambientVol; + + private float m_randomAmbientTimer; + + private bool m_stopAmbientLoop; + + private bool m_indoor; + + private float m_oceanUpdateTimer; + + private bool m_haveOcean; + + private Vector3 m_avgOceanPoint = Vector3.zero; + + private Snapshot m_currentSnapshot; + + public static AudioMan instance => m_instance; + + private void Awake() + { + if (m_instance != null) + { + ZLog.Log("Audioman already exist, destroying self"); + UnityEngine.Object.DestroyImmediate(base.gameObject); + return; + } + m_instance = this; + UnityEngine.Object.DontDestroyOnLoad(base.gameObject); + GameObject gameObject = new GameObject("ocean_ambient_loop"); + gameObject.transform.SetParent(base.transform); + m_oceanAmbientSource = gameObject.AddComponent(); + m_oceanAmbientSource.loop = true; + m_oceanAmbientSource.spatialBlend = 0.75f; + m_oceanAmbientSource.outputAudioMixerGroup = m_ambientMixer; + m_oceanAmbientSource.maxDistance = 128f; + m_oceanAmbientSource.minDistance = 40f; + m_oceanAmbientSource.spread = 90f; + m_oceanAmbientSource.rolloffMode = AudioRolloffMode.Linear; + m_oceanAmbientSource.clip = m_oceanAudio; + m_oceanAmbientSource.bypassReverbZones = true; + m_oceanAmbientSource.dopplerLevel = 0f; + m_oceanAmbientSource.volume = 0f; + m_oceanAmbientSource.Play(); + GameObject gameObject2 = new GameObject("ambient_loop"); + gameObject2.transform.SetParent(base.transform); + m_ambientLoopSource = gameObject2.AddComponent(); + m_ambientLoopSource.loop = true; + m_ambientLoopSource.spatialBlend = 0f; + m_ambientLoopSource.outputAudioMixerGroup = m_ambientMixer; + m_ambientLoopSource.bypassReverbZones = true; + m_ambientLoopSource.volume = 0f; + GameObject gameObject3 = new GameObject("wind_loop"); + gameObject3.transform.SetParent(base.transform); + m_windLoopSource = gameObject3.AddComponent(); + m_windLoopSource.loop = true; + m_windLoopSource.spatialBlend = 0f; + m_windLoopSource.outputAudioMixerGroup = m_ambientMixer; + m_windLoopSource.bypassReverbZones = true; + m_windLoopSource.clip = m_windAudio; + m_windLoopSource.volume = 0f; + m_windLoopSource.Play(); + if (SystemInfo.graphicsDeviceType == GraphicsDeviceType.Null) + { + AudioListener.volume = 0f; + return; + } + AudioListener.volume = PlayerPrefs.GetFloat("MasterVolume", AudioListener.volume); + SetSFXVolume(PlayerPrefs.GetFloat("SfxVolume", GetSFXVolume())); + } + + private void OnDestroy() + { + if (m_instance == this) + { + m_instance = null; + } + } + + private void Update() + { + float deltaTime = Time.deltaTime; + UpdateAmbientLoop(deltaTime); + UpdateRandomAmbient(deltaTime); + UpdateSnapshots(deltaTime); + } + + private void FixedUpdate() + { + float fixedDeltaTime = Time.fixedDeltaTime; + UpdateOceanAmbiance(fixedDeltaTime); + UpdateWindAmbience(fixedDeltaTime); + } + + public static float GetSFXVolume() + { + if (m_instance == null) + { + return 1f; + } + m_instance.m_masterMixer.GetFloat("SfxVol", out var value); + return Mathf.Pow(10f, value / 20f); + } + + public static void SetSFXVolume(float vol) + { + if (!(m_instance == null)) + { + float value = Mathf.Log(Mathf.Clamp(vol, 0.001f, 1f)) * 10f; + m_instance.m_masterMixer.SetFloat("SfxVol", value); + } + } + + private void UpdateRandomAmbient(float dt) + { + if (InMenu()) + { + return; + } + m_randomAmbientTimer += dt; + if (!(m_randomAmbientTimer > m_randomAmbientInterval)) + { + return; + } + m_randomAmbientTimer = 0f; + if (UnityEngine.Random.value <= m_randomAmbientChance) + { + AudioClip audioClip = SelectRandomAmbientClip(); + if ((bool)audioClip) + { + Vector3 randomAmbiencePoint = GetRandomAmbiencePoint(); + GameObject obj = UnityEngine.Object.Instantiate(m_randomAmbientPrefab, randomAmbiencePoint, Quaternion.identity, base.transform); + obj.GetComponent().pitch = UnityEngine.Random.Range(m_randomMinPitch, m_randomMaxPitch); + ZSFX component = obj.GetComponent(); + component.m_audioClips = new AudioClip[1] { audioClip }; + component.Play(); + component.FadeOut(); + } + } + } + + private Vector3 GetRandomAmbiencePoint() + { + Vector3 vector = Vector3.zero; + Camera mainCamera = Utils.GetMainCamera(); + if ((bool)Player.m_localPlayer) + { + vector = Player.m_localPlayer.transform.position; + } + else if ((bool)mainCamera) + { + vector = mainCamera.transform.position; + } + float f = UnityEngine.Random.value * (float)Math.PI * 2f; + float num = UnityEngine.Random.Range(m_randomMinDistance, m_randomMaxDistance); + return vector + new Vector3(Mathf.Sin(f) * num, 0f, Mathf.Cos(f) * num); + } + + private AudioClip SelectRandomAmbientClip() + { + if (EnvMan.instance == null) + { + return null; + } + EnvSetup currentEnvironment = EnvMan.instance.GetCurrentEnvironment(); + BiomeAmbients biomeAmbients = null; + biomeAmbients = ((currentEnvironment == null || string.IsNullOrEmpty(currentEnvironment.m_ambientList)) ? GetBiomeAmbients(EnvMan.instance.GetCurrentBiome()) : GetAmbients(currentEnvironment.m_ambientList)); + if (biomeAmbients == null) + { + return null; + } + List list = new List(biomeAmbients.m_randomAmbientClips); + List collection = (EnvMan.instance.IsDaylight() ? biomeAmbients.m_randomAmbientClipsDay : biomeAmbients.m_randomAmbientClipsNight); + list.AddRange(collection); + if (list.Count == 0) + { + return null; + } + return list[UnityEngine.Random.Range(0, list.Count)]; + } + + private void UpdateAmbientLoop(float dt) + { + if (EnvMan.instance == null) + { + m_ambientLoopSource.Stop(); + } + else if ((bool)m_queuedAmbientLoop || m_stopAmbientLoop) + { + if (!m_ambientLoopSource.isPlaying || m_ambientLoopSource.volume <= 0f) + { + m_ambientLoopSource.Stop(); + m_stopAmbientLoop = false; + if ((bool)m_queuedAmbientLoop) + { + m_ambientLoopSource.clip = m_queuedAmbientLoop; + m_ambientLoopSource.volume = 0f; + m_ambientLoopSource.Play(); + m_ambientVol = m_queuedAmbientVol; + m_queuedAmbientLoop = null; + } + } + else + { + m_ambientLoopSource.volume = Mathf.MoveTowards(m_ambientLoopSource.volume, 0f, dt / m_ambientFadeTime); + } + } + else if (m_ambientLoopSource.isPlaying) + { + m_ambientLoopSource.volume = Mathf.MoveTowards(m_ambientLoopSource.volume, m_ambientVol, dt / m_ambientFadeTime); + } + } + + public void SetIndoor(bool indoor) + { + m_indoor = indoor; + } + + private bool InMenu() + { + if (!(FejdStartup.instance != null) && !Menu.IsVisible() && (!Game.instance || !Game.instance.WaitingForRespawn())) + { + return TextViewer.IsShowingIntro(); + } + return true; + } + + private void UpdateSnapshots(float dt) + { + if (InMenu()) + { + SetSnapshot(Snapshot.Menu); + } + else if (m_indoor) + { + SetSnapshot(Snapshot.Indoor); + } + else + { + SetSnapshot(Snapshot.Default); + } + } + + private void SetSnapshot(Snapshot snapshot) + { + if (m_currentSnapshot != snapshot) + { + m_currentSnapshot = snapshot; + switch (snapshot) + { + case Snapshot.Default: + m_masterMixer.FindSnapshot("Default").TransitionTo(m_snapshotTransitionTime); + break; + case Snapshot.Indoor: + m_masterMixer.FindSnapshot("Indoor").TransitionTo(m_snapshotTransitionTime); + break; + case Snapshot.Menu: + m_masterMixer.FindSnapshot("Menu").TransitionTo(m_snapshotTransitionTime); + break; + } + } + } + + public void StopAmbientLoop() + { + m_queuedAmbientLoop = null; + m_stopAmbientLoop = true; + } + + public void QueueAmbientLoop(AudioClip clip, float vol) + { + if ((!(m_queuedAmbientLoop == clip) || m_queuedAmbientVol != vol) && (!(m_queuedAmbientLoop == null) || !(m_ambientLoopSource.clip == clip) || m_ambientVol != vol)) + { + m_queuedAmbientLoop = clip; + m_queuedAmbientVol = vol; + m_stopAmbientLoop = false; + } + } + + private void UpdateWindAmbience(float dt) + { + if (ZoneSystem.instance == null) + { + m_windLoopSource.volume = 0f; + return; + } + float windIntensity = EnvMan.instance.GetWindIntensity(); + windIntensity = Mathf.Pow(windIntensity, m_windIntensityPower); + windIntensity += windIntensity * Mathf.Sin(Time.time) * Mathf.Sin(Time.time * 1.54323f) * Mathf.Sin(Time.time * 2.31237f) * m_windVariation; + m_windLoopSource.volume = Mathf.Lerp(m_windMinVol, m_windMaxVol, windIntensity); + m_windLoopSource.pitch = Mathf.Lerp(m_windMinPitch, m_windMaxPitch, windIntensity); + } + + private void UpdateOceanAmbiance(float dt) + { + if (ZoneSystem.instance == null) + { + m_oceanAmbientSource.volume = 0f; + return; + } + m_oceanUpdateTimer += dt; + if (m_oceanUpdateTimer > 2f) + { + m_oceanUpdateTimer = 0f; + m_haveOcean = FindAverageOceanPoint(out m_avgOceanPoint); + } + if (m_haveOcean) + { + float windIntensity = EnvMan.instance.GetWindIntensity(); + float target = Mathf.Lerp(m_oceanVolumeMin, m_oceanVolumeMax, windIntensity); + m_oceanAmbientSource.volume = Mathf.MoveTowards(m_oceanAmbientSource.volume, target, m_oceanFadeSpeed * dt); + m_oceanAmbientSource.transform.position = Vector3.Lerp(m_oceanAmbientSource.transform.position, m_avgOceanPoint, m_oceanMoveSpeed); + } + else + { + m_oceanAmbientSource.volume = Mathf.MoveTowards(m_oceanAmbientSource.volume, 0f, m_oceanFadeSpeed * dt); + } + } + + private bool FindAverageOceanPoint(out Vector3 point) + { + Camera mainCamera = Utils.GetMainCamera(); + if (mainCamera == null) + { + point = Vector3.zero; + return false; + } + Vector3 zero = Vector3.zero; + int num = 0; + Vector3 position = mainCamera.transform.position; + Vector2i zone = ZoneSystem.instance.GetZone(position); + for (int i = -1; i <= 1; i++) + { + for (int j = -1; j <= 1; j++) + { + Vector2i id = zone; + id.x += j; + id.y += i; + Vector3 zonePos = ZoneSystem.instance.GetZonePos(id); + if (IsOceanZone(zonePos)) + { + num++; + zero += zonePos; + } + } + } + if (num > 0) + { + zero /= (float)num; + point = zero; + point.y = ZoneSystem.instance.m_waterLevel; + return true; + } + point = Vector3.zero; + return false; + } + + private bool IsOceanZone(Vector3 centerPos) + { + float groundHeight = ZoneSystem.instance.GetGroundHeight(centerPos); + if (ZoneSystem.instance.m_waterLevel - groundHeight > m_oceanDepthTreshold) + { + return true; + } + return false; + } + + private BiomeAmbients GetAmbients(string name) + { + foreach (BiomeAmbients randomAmbient in m_randomAmbients) + { + if (randomAmbient.m_name == name) + { + return randomAmbient; + } + } + return null; + } + + private BiomeAmbients GetBiomeAmbients(Heightmap.Biome biome) + { + foreach (BiomeAmbients randomAmbient in m_randomAmbients) + { + if ((randomAmbient.m_biome & biome) != 0) + { + return randomAmbient; + } + } + return null; + } +} diff --git a/Valheim_r202102_v0.141.2/Valheim/assembly_valheim/AutoJumpLedge.cs b/Valheim_r202102_v0.141.2/Valheim/assembly_valheim/AutoJumpLedge.cs new file mode 100644 index 0000000..d39ae81 --- /dev/null +++ b/Valheim_r202102_v0.141.2/Valheim/assembly_valheim/AutoJumpLedge.cs @@ -0,0 +1,19 @@ +using UnityEngine; + +public class AutoJumpLedge : MonoBehaviour +{ + public bool m_forwardOnly = true; + + public float m_upVel = 1f; + + public float m_forwardVel = 1f; + + private void OnTriggerStay(Collider collider) + { + Character component = collider.GetComponent(); + if ((bool)component) + { + component.OnAutoJump(base.transform.forward, m_upVel, m_forwardVel); + } + } +} diff --git a/Valheim_r202102_v0.141.2/Valheim/assembly_valheim/BaseAI.cs b/Valheim_r202102_v0.141.2/Valheim/assembly_valheim/BaseAI.cs new file mode 100644 index 0000000..ea33b4d --- /dev/null +++ b/Valheim_r202102_v0.141.2/Valheim/assembly_valheim/BaseAI.cs @@ -0,0 +1,1459 @@ +using System; +using System.Collections.Generic; +using UnityEngine; + +public class BaseAI : MonoBehaviour +{ + private float m_lastMoveToWaterUpdate; + + private bool m_haveWaterPosition; + + private Vector3 m_moveToWaterPosition = Vector3.zero; + + private float m_fleeTargetUpdateTime; + + private Vector3 m_fleeTarget = Vector3.zero; + + private float m_nearFireTime; + + private EffectArea m_nearFireArea; + + private float aroundPointUpdateTime; + + private Vector3 arroundPointTarget = Vector3.zero; + + private const bool m_debugDraw = false; + + public float m_viewRange = 50f; + + public float m_viewAngle = 90f; + + public float m_hearRange = 9999f; + + private const float m_interiorMaxHearRange = 8f; + + private const float m_despawnDistance = 80f; + + private const float m_regenAllHPTime = 3600f; + + public EffectList m_alertedEffects = new EffectList(); + + public EffectList m_idleSound = new EffectList(); + + public float m_idleSoundInterval = 5f; + + public float m_idleSoundChance = 0.5f; + + public Pathfinding.AgentType m_pathAgentType = Pathfinding.AgentType.Humanoid; + + public float m_moveMinAngle = 10f; + + public bool m_smoothMovement = true; + + public bool m_serpentMovement; + + public float m_serpentTurnRadius = 20f; + + public float m_jumpInterval; + + [Header("Random circle")] + public float m_randomCircleInterval = 2f; + + [Header("Random movement")] + public float m_randomMoveInterval = 5f; + + public float m_randomMoveRange = 4f; + + [Header("Fly behaviour")] + public bool m_randomFly; + + public float m_chanceToTakeoff = 1f; + + public float m_chanceToLand = 1f; + + public float m_groundDuration = 10f; + + public float m_airDuration = 10f; + + public float m_maxLandAltitude = 5f; + + public float m_flyAltitudeMin = 3f; + + public float m_flyAltitudeMax = 10f; + + public float m_takeoffTime = 5f; + + [Header("Other")] + public bool m_avoidFire; + + public bool m_afraidOfFire; + + public bool m_avoidWater = true; + + public string m_spawnMessage = ""; + + public string m_deathMessage = ""; + + private bool m_patrol; + + private Vector3 m_patrolPoint = Vector3.zero; + + private float m_patrolPointUpdateTime; + + protected ZNetView m_nview; + + protected Character m_character; + + protected ZSyncAnimation m_animator; + + protected Rigidbody m_body; + + private float m_updateTimer; + + private int m_solidRayMask; + + private int m_viewBlockMask; + + private int m_monsterTargetRayMask; + + private Vector3 m_randomMoveTarget = Vector3.zero; + + private float m_randomMoveUpdateTimer; + + private float m_jumpTimer; + + private float m_randomFlyTimer; + + private float m_regenTimer; + + protected bool m_alerted; + + protected bool m_huntPlayer; + + protected Vector3 m_spawnPoint = Vector3.zero; + + private const float m_getOfOfCornerMaxAngle = 20f; + + private float m_getOutOfCornerTimer; + + private float m_getOutOfCornerAngle; + + private Vector3 m_lastPosition = Vector3.zero; + + private float m_stuckTimer; + + protected float m_timeSinceHurt = 99999f; + + private Vector3 m_havePathTarget = new Vector3(-999999f, -999999f, -999999f); + + private Vector3 m_havePathFrom = new Vector3(-999999f, -999999f, -999999f); + + private float m_lastHavePathTime; + + private bool m_lastHavePathResult; + + private Vector3 m_lastFindPathTarget = new Vector3(-999999f, -999999f, -999999f); + + private float m_lastFindPathTime; + + private bool m_lastFindPathResult; + + private List m_path = new List(); + + private static RaycastHit[] m_tempRaycastHits = new RaycastHit[128]; + + private static List m_instances = new List(); + + private static int worldTimeHash = "lastWorldTime".GetStableHashCode(); + + private static int spawnTimeHash = "spawntime".GetStableHashCode(); + + protected virtual void Awake() + { + m_instances.Add(this); + m_nview = GetComponent(); + m_character = GetComponent(); + m_animator = GetComponent(); + m_body = GetComponent(); + m_solidRayMask = LayerMask.GetMask("Default", "static_solid", "Default_small", "piece", "terrain", "vehicle"); + m_viewBlockMask = LayerMask.GetMask("Default", "static_solid", "Default_small", "piece", "terrain", "viewblock", "vehicle"); + m_monsterTargetRayMask = LayerMask.GetMask("piece", "piece_nonsolid", "Default", "static_solid", "Default_small", "vehicle"); + Character character = m_character; + character.m_onDamaged = (Action)Delegate.Combine(character.m_onDamaged, new Action(OnDamaged)); + Character character2 = m_character; + character2.m_onDeath = (Action)Delegate.Combine(character2.m_onDeath, new Action(OnDeath)); + if (m_nview.IsOwner() && m_nview.GetZDO().GetLong(spawnTimeHash, 0L) == 0L) + { + m_nview.GetZDO().Set(spawnTimeHash, ZNet.instance.GetTime().Ticks); + if (!string.IsNullOrEmpty(m_spawnMessage)) + { + MessageHud.instance.MessageAll(MessageHud.MessageType.Center, m_spawnMessage); + } + } + m_randomMoveUpdateTimer = UnityEngine.Random.Range(0f, m_randomMoveInterval); + m_nview.Register("Alert", RPC_Alert); + m_huntPlayer = m_nview.GetZDO().GetBool("huntplayer", m_huntPlayer); + m_spawnPoint = m_nview.GetZDO().GetVec3("spawnpoint", base.transform.position); + if (m_nview.IsOwner()) + { + m_nview.GetZDO().Set("spawnpoint", m_spawnPoint); + } + InvokeRepeating("DoIdleSound", m_idleSoundInterval, m_idleSoundInterval); + } + + private void OnDestroy() + { + m_instances.Remove(this); + } + + public void SetPatrolPoint() + { + SetPatrolPoint(base.transform.position); + } + + public void SetPatrolPoint(Vector3 point) + { + m_patrol = true; + m_patrolPoint = point; + m_nview.GetZDO().Set("patrolPoint", point); + m_nview.GetZDO().Set("patrol", value: true); + } + + public void ResetPatrolPoint() + { + m_patrol = false; + m_nview.GetZDO().Set("patrol", value: false); + } + + public bool GetPatrolPoint(out Vector3 point) + { + if (Time.time - m_patrolPointUpdateTime > 1f) + { + m_patrolPointUpdateTime = Time.time; + m_patrol = m_nview.GetZDO().GetBool("patrol"); + if (m_patrol) + { + m_patrolPoint = m_nview.GetZDO().GetVec3("patrolPoint", m_patrolPoint); + } + } + point = m_patrolPoint; + return m_patrol; + } + + private void FixedUpdate() + { + if (m_nview.IsValid()) + { + m_updateTimer += Time.fixedDeltaTime; + if (m_updateTimer >= 0.05f) + { + UpdateAI(0.05f); + m_updateTimer -= 0.05f; + } + } + } + + protected virtual void UpdateAI(float dt) + { + if (m_nview.IsOwner()) + { + UpdateTakeoffLanding(dt); + if (m_jumpInterval > 0f) + { + m_jumpTimer += dt; + } + if (m_randomMoveUpdateTimer > 0f) + { + m_randomMoveUpdateTimer -= dt; + } + UpdateRegeneration(dt); + m_timeSinceHurt += dt; + } + else + { + m_alerted = m_nview.GetZDO().GetBool("alert"); + } + } + + private void UpdateRegeneration(float dt) + { + m_regenTimer += dt; + if (m_regenTimer > 1f) + { + m_regenTimer = 0f; + float num = m_character.GetMaxHealth() / 3600f; + float worldTimeDelta = GetWorldTimeDelta(); + m_character.Heal(num * worldTimeDelta, showText: false); + } + } + + public bool IsTakingOff() + { + if (m_randomFly && m_character.IsFlying() && m_randomFlyTimer < m_takeoffTime) + { + return true; + } + return false; + } + + public void UpdateTakeoffLanding(float dt) + { + if (!m_randomFly) + { + return; + } + m_randomFlyTimer += dt; + if (m_character.InAttack() || m_character.IsStaggering()) + { + return; + } + if (m_character.IsFlying()) + { + if (m_randomFlyTimer > m_airDuration && GetAltitude() < m_maxLandAltitude) + { + m_randomFlyTimer = 0f; + if (UnityEngine.Random.value <= m_chanceToLand) + { + m_character.m_flying = false; + m_animator.SetTrigger("fly_land"); + } + } + } + else if (m_randomFlyTimer > m_groundDuration) + { + m_randomFlyTimer = 0f; + if (UnityEngine.Random.value <= m_chanceToTakeoff) + { + m_character.m_flying = true; + m_character.m_jumpEffects.Create(m_character.transform.position, Quaternion.identity); + m_animator.SetTrigger("fly_takeoff"); + } + } + } + + private float GetWorldTimeDelta() + { + DateTime time = ZNet.instance.GetTime(); + long @long = m_nview.GetZDO().GetLong(worldTimeHash, 0L); + if (@long == 0L) + { + m_nview.GetZDO().Set(worldTimeHash, time.Ticks); + return 0f; + } + DateTime dateTime = new DateTime(@long); + TimeSpan timeSpan = time - dateTime; + m_nview.GetZDO().Set(worldTimeHash, time.Ticks); + return (float)timeSpan.TotalSeconds; + } + + public TimeSpan GetTimeSinceSpawned() + { + long num = m_nview.GetZDO().GetLong("spawntime", 0L); + if (num == 0L) + { + num = ZNet.instance.GetTime().Ticks; + m_nview.GetZDO().Set("spawntime", num); + } + DateTime dateTime = new DateTime(num); + return ZNet.instance.GetTime() - dateTime; + } + + private void DoIdleSound() + { + if (!IsSleeping() && !(UnityEngine.Random.value > m_idleSoundChance)) + { + m_idleSound.Create(base.transform.position, Quaternion.identity); + } + } + + protected void Follow(GameObject go, float dt) + { + float num = Vector3.Distance(go.transform.position, base.transform.position); + bool run = num > 10f; + if (num < 3f) + { + StopMoving(); + } + else + { + MoveTo(dt, go.transform.position, 0f, run); + } + } + + protected void MoveToWater(float dt, float maxRange) + { + float num = (m_haveWaterPosition ? 2f : 0.5f); + if (Time.time - m_lastMoveToWaterUpdate > num) + { + m_lastMoveToWaterUpdate = Time.time; + Vector3 moveToWaterPosition = base.transform.position; + for (int i = 0; i < 10; i++) + { + Vector3 vector = Quaternion.Euler(0f, UnityEngine.Random.Range(0, 360), 0f) * Vector3.forward * UnityEngine.Random.Range(4f, maxRange); + Vector3 vector2 = base.transform.position + vector; + vector2.y = ZoneSystem.instance.GetSolidHeight(vector2); + if (vector2.y < moveToWaterPosition.y) + { + moveToWaterPosition = vector2; + } + } + if (moveToWaterPosition.y < ZoneSystem.instance.m_waterLevel) + { + m_moveToWaterPosition = moveToWaterPosition; + m_haveWaterPosition = true; + } + else + { + m_haveWaterPosition = false; + } + } + if (m_haveWaterPosition) + { + MoveTowards(m_moveToWaterPosition - base.transform.position, run: true); + } + } + + protected void MoveAwayAndDespawn(float dt, bool run) + { + Player closestPlayer = Player.GetClosestPlayer(base.transform.position, 40f); + if (closestPlayer != null) + { + Vector3 normalized = (closestPlayer.transform.position - base.transform.position).normalized; + MoveTo(dt, base.transform.position - normalized * 5f, 0f, run); + } + else + { + m_nview.Destroy(); + } + } + + protected void IdleMovement(float dt) + { + Vector3 centerPoint = (m_character.IsTamed() ? base.transform.position : m_spawnPoint); + if (GetPatrolPoint(out var point)) + { + centerPoint = point; + } + RandomMovement(dt, centerPoint); + } + + protected void RandomMovement(float dt, Vector3 centerPoint) + { + if (m_randomMoveUpdateTimer <= 0f) + { + if (Utils.DistanceXZ(centerPoint, base.transform.position) > m_randomMoveRange * 2f) + { + Vector3 vector = centerPoint - base.transform.position; + vector.y = 0f; + vector.Normalize(); + vector = Quaternion.Euler(0f, UnityEngine.Random.Range(-30, 30), 0f) * vector; + m_randomMoveTarget = base.transform.position + vector * m_randomMoveRange * 2f; + } + else + { + Vector3 vector2 = Quaternion.Euler(0f, UnityEngine.Random.Range(0, 360), 0f) * base.transform.forward * UnityEngine.Random.Range(m_randomMoveRange * 0.7f, m_randomMoveRange); + m_randomMoveTarget = centerPoint + vector2; + } + if (m_character.IsFlying() && ZoneSystem.instance.GetSolidHeight(m_randomMoveTarget, out var height)) + { + if (height < ZoneSystem.instance.m_waterLevel) + { + height = ZoneSystem.instance.m_waterLevel; + } + m_randomMoveTarget.y = height + UnityEngine.Random.Range(m_flyAltitudeMin, m_flyAltitudeMax); + } + if (!IsValidRandomMovePoint(m_randomMoveTarget)) + { + return; + } + m_randomMoveUpdateTimer = UnityEngine.Random.Range(m_randomMoveInterval, m_randomMoveInterval + m_randomMoveInterval / 2f); + if (m_avoidWater && m_character.IsSwiming()) + { + m_randomMoveUpdateTimer /= 4f; + } + } + bool flag = IsAlerted() || Utils.DistanceXZ(base.transform.position, centerPoint) > m_randomMoveRange * 2f; + if (MoveTo(dt, m_randomMoveTarget, 0f, flag) && flag) + { + m_randomMoveUpdateTimer = 0f; + } + } + + protected void Flee(float dt, Vector3 from) + { + float time = Time.time; + if (time - m_fleeTargetUpdateTime > 2f) + { + m_fleeTargetUpdateTime = time; + Vector3 vector = -(from - base.transform.position); + vector.y = 0f; + vector.Normalize(); + bool flag = false; + for (int i = 0; i < 4; i++) + { + m_fleeTarget = base.transform.position + Quaternion.Euler(0f, UnityEngine.Random.Range(-45f, 45f), 0f) * vector * 25f; + if (HavePath(m_fleeTarget) && (!m_avoidWater || m_character.IsSwiming() || !(ZoneSystem.instance.GetSolidHeight(m_fleeTarget) < ZoneSystem.instance.m_waterLevel))) + { + flag = true; + break; + } + } + if (!flag) + { + m_fleeTarget = base.transform.position + Quaternion.Euler(0f, UnityEngine.Random.Range(0, 360), 0f) * Vector3.forward * 25f; + } + } + MoveTo(dt, m_fleeTarget, 0f, IsAlerted()); + } + + protected bool AvoidFire(float dt, Character moveToTarget, bool superAfraid) + { + if (superAfraid) + { + EffectArea effectArea = EffectArea.IsPointInsideArea(base.transform.position, EffectArea.Type.Fire, 3f); + if ((bool)effectArea) + { + m_nearFireTime = Time.time; + m_nearFireArea = effectArea; + } + if (Time.time - m_nearFireTime < 6f && (bool)m_nearFireArea) + { + SetAlerted(alert: true); + Flee(dt, m_nearFireArea.transform.position); + return true; + } + } + else + { + EffectArea effectArea2 = EffectArea.IsPointInsideArea(base.transform.position, EffectArea.Type.Fire, 3f); + if ((bool)effectArea2) + { + if (moveToTarget != null && (bool)EffectArea.IsPointInsideArea(moveToTarget.transform.position, EffectArea.Type.Fire)) + { + RandomMovementArroundPoint(dt, effectArea2.transform.position, effectArea2.GetRadius() + 3f + 1f, IsAlerted()); + return true; + } + RandomMovementArroundPoint(dt, effectArea2.transform.position, (effectArea2.GetRadius() + 3f) * 1.5f, IsAlerted()); + return true; + } + } + return false; + } + + protected void RandomMovementArroundPoint(float dt, Vector3 point, float distance, bool run) + { + float time = Time.time; + if (time - aroundPointUpdateTime > m_randomCircleInterval) + { + aroundPointUpdateTime = time; + Vector3 vector = base.transform.position - point; + vector.y = 0f; + vector.Normalize(); + float num = ((!(Vector3.Distance(base.transform.position, point) < distance / 2f)) ? ((float)(((double)UnityEngine.Random.value > 0.5) ? 40 : (-40))) : ((float)(((double)UnityEngine.Random.value > 0.5) ? 90 : (-90)))); + Vector3 vector2 = Quaternion.Euler(0f, num, 0f) * vector; + arroundPointTarget = point + vector2 * distance; + if (Vector3.Dot(base.transform.forward, arroundPointTarget - base.transform.position) < 0f) + { + vector2 = Quaternion.Euler(0f, 0f - num, 0f) * vector; + arroundPointTarget = point + vector2 * distance; + if (m_serpentMovement && Vector3.Distance(point, base.transform.position) > distance / 2f && Vector3.Dot(base.transform.forward, arroundPointTarget - base.transform.position) < 0f) + { + arroundPointTarget = point - vector2 * distance; + } + } + if (m_character.IsFlying()) + { + arroundPointTarget.y += UnityEngine.Random.Range(m_flyAltitudeMin, m_flyAltitudeMax); + } + } + if (MoveTo(dt, arroundPointTarget, 0f, run)) + { + if (run) + { + aroundPointUpdateTime = 0f; + } + if (!m_serpentMovement && !run) + { + LookAt(point); + } + } + } + + private bool GetSolidHeight(Vector3 p, out float height, float maxYDistance) + { + if (Physics.Raycast(p + Vector3.up * maxYDistance, Vector3.down, out var hitInfo, maxYDistance * 2f, m_solidRayMask)) + { + height = hitInfo.point.y; + return true; + } + height = 0f; + return false; + } + + protected bool IsValidRandomMovePoint(Vector3 point) + { + if (m_character.IsFlying()) + { + return true; + } + if (m_avoidWater && GetSolidHeight(point, out var height, 50f)) + { + if (m_character.IsSwiming()) + { + if (GetSolidHeight(base.transform.position, out var height2, 50f) && height < height2) + { + return false; + } + } + else if (height < ZoneSystem.instance.m_waterLevel) + { + return false; + } + } + if ((m_afraidOfFire || m_avoidFire) && (bool)EffectArea.IsPointInsideArea(point, EffectArea.Type.Fire)) + { + return false; + } + return true; + } + + protected virtual void OnDamaged(float damage, Character attacker) + { + m_timeSinceHurt = 0f; + } + + protected virtual void OnDeath() + { + if (!string.IsNullOrEmpty(m_deathMessage)) + { + MessageHud.instance.MessageAll(MessageHud.MessageType.Center, m_deathMessage); + } + } + + public bool CanSenseTarget(Character target) + { + if (CanHearTarget(target)) + { + return true; + } + if (CanSeeTarget(target)) + { + return true; + } + return false; + } + + public bool CanHearTarget(Character target) + { + if (target.IsPlayer()) + { + Player player = target as Player; + if (player.InDebugFlyMode() || player.InGhostMode()) + { + return false; + } + } + float num = Vector3.Distance(target.transform.position, base.transform.position); + float num2 = m_hearRange; + if (m_character.InInterior()) + { + num2 = Mathf.Min(8f, num2); + } + if (num > num2) + { + return false; + } + if (num < target.GetNoiseRange()) + { + return true; + } + return false; + } + + public bool CanSeeTarget(Character target) + { + if (target.IsPlayer()) + { + Player player = target as Player; + if (player.InDebugFlyMode() || player.InGhostMode()) + { + return false; + } + } + float num = Vector3.Distance(target.transform.position, base.transform.position); + if (num > m_viewRange) + { + return false; + } + float factor = 1f - num / m_viewRange; + float stealthFactor = target.GetStealthFactor(); + float num2 = m_viewRange * stealthFactor; + if (num > num2) + { + target.OnStealthSuccess(m_character, factor); + return false; + } + if (!IsAlerted() && Vector3.Angle(target.transform.position - m_character.transform.position, base.transform.forward) > m_viewAngle) + { + target.OnStealthSuccess(m_character, factor); + return false; + } + Vector3 vector = (target.IsCrouching() ? target.GetCenterPoint() : target.m_eye.position) - m_character.m_eye.position; + if (Physics.Raycast(m_character.m_eye.position, vector.normalized, vector.magnitude, m_viewBlockMask)) + { + target.OnStealthSuccess(m_character, factor); + return false; + } + return true; + } + + public bool CanSeeTarget(StaticTarget target) + { + Vector3 center = target.GetCenter(); + if (Vector3.Distance(center, base.transform.position) > m_viewRange) + { + return false; + } + Vector3 rhs = center - m_character.m_eye.position; + if (!IsAlerted() && Vector3.Dot(base.transform.forward, rhs) < 0f) + { + return false; + } + List allColliders = target.GetAllColliders(); + int num = Physics.RaycastNonAlloc(m_character.m_eye.position, rhs.normalized, m_tempRaycastHits, rhs.magnitude, m_viewBlockMask); + for (int i = 0; i < num; i++) + { + RaycastHit raycastHit = m_tempRaycastHits[i]; + if (!allColliders.Contains(raycastHit.collider)) + { + return false; + } + } + return true; + } + + protected void MoveTowardsSwoop(Vector3 dir, bool run, float distance) + { + dir = dir.normalized; + float num = Mathf.Clamp01(Vector3.Dot(dir, m_character.transform.forward)); + num *= num; + float num2 = Mathf.Clamp01(distance / m_serpentTurnRadius); + float num3 = 1f - (1f - num2) * (1f - num); + num3 = num3 * 0.9f + 0.1f; + Vector3 moveDir = base.transform.forward * num3; + LookTowards(dir); + m_character.SetMoveDir(moveDir); + m_character.SetRun(run); + } + + protected void MoveTowards(Vector3 dir, bool run) + { + dir = dir.normalized; + LookTowards(dir); + if (m_smoothMovement) + { + float num = Vector3.Angle(dir, base.transform.forward); + float num2 = 1f - Mathf.Clamp01(num / m_moveMinAngle); + Vector3 moveDir = base.transform.forward * num2; + moveDir.y = dir.y; + m_character.SetMoveDir(moveDir); + m_character.SetRun(run); + if (m_jumpInterval > 0f && m_jumpTimer >= m_jumpInterval) + { + m_jumpTimer = 0f; + m_character.Jump(); + } + } + else if (IsLookingTowards(dir, m_moveMinAngle)) + { + m_character.SetMoveDir(dir); + m_character.SetRun(run); + if (m_jumpInterval > 0f && m_jumpTimer >= m_jumpInterval) + { + m_jumpTimer = 0f; + m_character.Jump(); + } + } + else + { + StopMoving(); + } + } + + protected void LookAt(Vector3 point) + { + Vector3 vector = point - m_character.m_eye.position; + if (!(Utils.LengthXZ(vector) < 0.01f)) + { + vector.Normalize(); + LookTowards(vector); + } + } + + protected void LookTowards(Vector3 dir) + { + m_character.SetLookDir(dir); + } + + protected bool IsLookingAt(Vector3 point, float minAngle) + { + return IsLookingTowards((point - base.transform.position).normalized, minAngle); + } + + protected bool IsLookingTowards(Vector3 dir, float minAngle) + { + dir.y = 0f; + Vector3 forward = base.transform.forward; + forward.y = 0f; + return Vector3.Angle(dir, forward) < minAngle; + } + + protected void StopMoving() + { + m_character.SetMoveDir(Vector3.zero); + } + + protected bool HavePath(Vector3 target) + { + if (m_character.IsFlying()) + { + return true; + } + float time = Time.time; + float num = time - m_lastHavePathTime; + Vector3 position = base.transform.position; + if (Vector3.Distance(position, m_havePathFrom) > 2f || Vector3.Distance(target, m_havePathTarget) > 1f || num > 5f) + { + m_havePathFrom = position; + m_havePathTarget = target; + m_lastHavePathTime = time; + m_lastHavePathResult = Pathfinding.instance.HavePath(position, target, m_pathAgentType); + } + return m_lastHavePathResult; + } + + protected bool FindPath(Vector3 target) + { + float time = Time.time; + float num = time - m_lastFindPathTime; + if (num < 1f) + { + return m_lastFindPathResult; + } + if (Vector3.Distance(target, m_lastFindPathTarget) < 1f && num < 5f) + { + return m_lastFindPathResult; + } + m_lastFindPathTarget = target; + m_lastFindPathTime = time; + m_lastFindPathResult = Pathfinding.instance.GetPath(base.transform.position, target, m_path, m_pathAgentType); + return m_lastFindPathResult; + } + + protected bool FoundPath() + { + return m_lastFindPathResult; + } + + protected bool MoveTo(float dt, Vector3 point, float dist, bool run) + { + if (m_character.m_flying) + { + dist = Mathf.Max(dist, 1f); + if (ZoneSystem.instance.GetSolidHeight(point, out var height)) + { + point.y = Mathf.Max(point.y, height + m_flyAltitudeMin); + } + return MoveAndAvoid(dt, point, dist, run); + } + float num = (run ? 1f : 0.5f); + if (m_serpentMovement) + { + num = 3f; + } + if (Utils.DistanceXZ(point, base.transform.position) < Mathf.Max(dist, num)) + { + StopMoving(); + return true; + } + if (!FindPath(point)) + { + StopMoving(); + return true; + } + if (m_path.Count == 0) + { + StopMoving(); + return true; + } + Vector3 vector = m_path[0]; + if (Utils.DistanceXZ(vector, base.transform.position) < num) + { + m_path.RemoveAt(0); + if (m_path.Count == 0) + { + StopMoving(); + return true; + } + } + else if (m_serpentMovement) + { + float distance = Vector3.Distance(vector, base.transform.position); + Vector3 normalized = (vector - base.transform.position).normalized; + MoveTowardsSwoop(normalized, run, distance); + } + else + { + Vector3 normalized2 = (vector - base.transform.position).normalized; + MoveTowards(normalized2, run); + } + return false; + } + + protected bool MoveAndAvoid(float dt, Vector3 point, float dist, bool run) + { + Vector3 vector = point - base.transform.position; + if (m_character.IsFlying()) + { + if (vector.magnitude < dist) + { + StopMoving(); + return true; + } + } + else + { + vector.y = 0f; + if (vector.magnitude < dist) + { + StopMoving(); + return true; + } + } + vector.Normalize(); + float radius = m_character.GetRadius(); + float num = radius + 1f; + if (!m_character.InAttack()) + { + m_getOutOfCornerTimer -= dt; + if (m_getOutOfCornerTimer > 0f) + { + Vector3 dir = Quaternion.Euler(0f, m_getOutOfCornerAngle, 0f) * -vector; + MoveTowards(dir, run); + return false; + } + m_stuckTimer += Time.fixedDeltaTime; + if (m_stuckTimer > 1.5f) + { + if (Vector3.Distance(base.transform.position, m_lastPosition) < 0.2f) + { + m_getOutOfCornerTimer = 4f; + m_getOutOfCornerAngle = UnityEngine.Random.Range(-20f, 20f); + m_stuckTimer = 0f; + return false; + } + m_stuckTimer = 0f; + m_lastPosition = base.transform.position; + } + } + if (CanMove(vector, radius, num)) + { + MoveTowards(vector, run); + } + else + { + Vector3 forward = base.transform.forward; + if (m_character.IsFlying()) + { + forward.y = 0.2f; + forward.Normalize(); + } + Vector3 vector2 = base.transform.right * radius * 0.75f; + float num2 = num * 1.5f; + Vector3 centerPoint = m_character.GetCenterPoint(); + float num3 = Raycast(centerPoint - vector2, forward, num2, 0.1f); + float num4 = Raycast(centerPoint + vector2, forward, num2, 0.1f); + if (num3 >= num2 && num4 >= num2) + { + MoveTowards(forward, run); + } + else + { + Vector3 dir2 = Quaternion.Euler(0f, -20f, 0f) * forward; + Vector3 dir3 = Quaternion.Euler(0f, 20f, 0f) * forward; + if (num3 > num4) + { + MoveTowards(dir2, run); + } + else + { + MoveTowards(dir3, run); + } + } + } + return false; + } + + private bool CanMove(Vector3 dir, float checkRadius, float distance) + { + Vector3 centerPoint = m_character.GetCenterPoint(); + Vector3 right = base.transform.right; + if (Raycast(centerPoint, dir, distance, 0.1f) < distance) + { + return false; + } + if (Raycast(centerPoint - right * (checkRadius - 0.1f), dir, distance, 0.1f) < distance) + { + return false; + } + if (Raycast(centerPoint + right * (checkRadius - 0.1f), dir, distance, 0.1f) < distance) + { + return false; + } + return true; + } + + public float Raycast(Vector3 p, Vector3 dir, float distance, float radius) + { + if (radius == 0f) + { + if (Physics.Raycast(p, dir, out var hitInfo, distance, m_solidRayMask)) + { + return hitInfo.distance; + } + return distance; + } + if (Physics.SphereCast(p, radius, dir, out var hitInfo2, distance, m_solidRayMask)) + { + return hitInfo2.distance; + } + return distance; + } + + public bool IsEnemey(Character other) + { + return IsEnemy(m_character, other); + } + + public static bool IsEnemy(Character a, Character b) + { + if (a == b) + { + return false; + } + Character.Faction faction = a.GetFaction(); + Character.Faction faction2 = b.GetFaction(); + if (faction == faction2) + { + return false; + } + bool flag = a.IsTamed(); + bool flag2 = b.IsTamed(); + if (flag || flag2) + { + if ((flag && flag2) || (flag && faction2 == Character.Faction.Players) || (flag2 && faction == Character.Faction.Players)) + { + return false; + } + return true; + } + switch (faction) + { + case Character.Faction.AnimalsVeg: + return true; + case Character.Faction.Players: + return true; + case Character.Faction.ForestMonsters: + if (faction2 != Character.Faction.AnimalsVeg) + { + return faction2 != Character.Faction.Boss; + } + return false; + case Character.Faction.Undead: + if (faction2 != Character.Faction.Demon) + { + return faction2 != Character.Faction.Boss; + } + return false; + case Character.Faction.Demon: + if (faction2 != Character.Faction.Undead) + { + return faction2 != Character.Faction.Boss; + } + return false; + case Character.Faction.MountainMonsters: + return faction2 != Character.Faction.Boss; + case Character.Faction.SeaMonsters: + return faction2 != Character.Faction.Boss; + case Character.Faction.PlainsMonsters: + return faction2 != Character.Faction.Boss; + case Character.Faction.Boss: + return faction2 == Character.Faction.Players; + default: + return false; + } + } + + protected StaticTarget FindRandomStaticTarget(float maxDistance, bool priorityTargetsOnly) + { + float radius = m_character.GetRadius(); + Collider[] array = Physics.OverlapSphere(base.transform.position, radius + maxDistance, m_monsterTargetRayMask); + if (array.Length == 0) + { + return null; + } + List list = new List(); + Collider[] array2 = array; + for (int i = 0; i < array2.Length; i++) + { + StaticTarget componentInParent = array2[i].GetComponentInParent(); + if (componentInParent == null || !componentInParent.IsValidMonsterTarget()) + { + continue; + } + if (priorityTargetsOnly) + { + if (!componentInParent.m_primaryTarget) + { + continue; + } + } + else if (!componentInParent.m_randomTarget) + { + continue; + } + if (CanSeeTarget(componentInParent)) + { + list.Add(componentInParent); + } + } + if (list.Count == 0) + { + return null; + } + return list[UnityEngine.Random.Range(0, list.Count)]; + } + + protected StaticTarget FindClosestStaticPriorityTarget(float maxDistance) + { + float num = Mathf.Min(maxDistance, m_viewRange); + Collider[] array = Physics.OverlapSphere(base.transform.position, num, m_monsterTargetRayMask); + if (array.Length == 0) + { + return null; + } + StaticTarget result = null; + float num2 = num; + Collider[] array2 = array; + for (int i = 0; i < array2.Length; i++) + { + StaticTarget componentInParent = array2[i].GetComponentInParent(); + if (!(componentInParent == null) && componentInParent.IsValidMonsterTarget() && componentInParent.m_primaryTarget) + { + float num3 = Vector3.Distance(base.transform.position, componentInParent.GetCenter()); + if (num3 < num2 && CanSeeTarget(componentInParent)) + { + result = componentInParent; + num2 = num3; + } + } + } + return result; + } + + protected void HaveFriendsInRange(float range, out Character hurtFriend, out Character friend) + { + List allCharacters = Character.GetAllCharacters(); + friend = HaveFriendInRange(allCharacters, range); + hurtFriend = HaveHurtFriendInRange(allCharacters, range); + } + + private Character HaveFriendInRange(List characters, float range) + { + foreach (Character character in characters) + { + if (!(character == m_character) && !IsEnemy(m_character, character) && !(Vector3.Distance(character.transform.position, base.transform.position) > range)) + { + return character; + } + } + return null; + } + + protected Character HaveFriendInRange(float range) + { + List allCharacters = Character.GetAllCharacters(); + return HaveFriendInRange(allCharacters, range); + } + + private Character HaveHurtFriendInRange(List characters, float range) + { + foreach (Character character in characters) + { + if (!IsEnemy(m_character, character) && !(Vector3.Distance(character.transform.position, base.transform.position) > range) && character.GetHealth() < character.GetMaxHealth()) + { + return character; + } + } + return null; + } + + protected Character HaveHurtFriendInRange(float range) + { + List allCharacters = Character.GetAllCharacters(); + return HaveHurtFriendInRange(allCharacters, range); + } + + protected Character FindEnemy() + { + List allCharacters = Character.GetAllCharacters(); + Character character = null; + float num = 99999f; + foreach (Character item in allCharacters) + { + if (!IsEnemy(m_character, item) || item.IsDead()) + { + continue; + } + BaseAI baseAI = item.GetBaseAI(); + if ((!(baseAI != null) || !baseAI.IsSleeping()) && CanSenseTarget(item)) + { + float num2 = Vector3.Distance(item.transform.position, base.transform.position); + if (num2 < num || character == null) + { + character = item; + num = num2; + } + } + } + if (character == null && HuntPlayer()) + { + Player closestPlayer = Player.GetClosestPlayer(base.transform.position, 200f); + if ((bool)closestPlayer && (closestPlayer.InDebugFlyMode() || closestPlayer.InGhostMode())) + { + return null; + } + return closestPlayer; + } + return character; + } + + public void SetHuntPlayer(bool hunt) + { + if (m_huntPlayer != hunt) + { + m_huntPlayer = hunt; + if (m_nview.IsOwner()) + { + m_nview.GetZDO().Set("huntplayer", m_huntPlayer); + } + } + } + + public virtual bool HuntPlayer() + { + return m_huntPlayer; + } + + protected bool HaveAlertedCreatureInRange(float range) + { + foreach (BaseAI instance in m_instances) + { + if (Vector3.Distance(base.transform.position, instance.transform.position) < range && instance.IsAlerted()) + { + return true; + } + } + return false; + } + + public static void AlertAllInRange(Vector3 center, float range, Character attacker) + { + foreach (BaseAI instance in m_instances) + { + if ((!attacker || instance.IsEnemey(attacker)) && Vector3.Distance(instance.transform.position, center) < range) + { + instance.Alert(); + } + } + } + + public void Alert() + { + if (m_nview.IsValid() && !IsAlerted()) + { + if (m_nview.IsOwner()) + { + SetAlerted(alert: true); + } + else + { + m_nview.InvokeRPC("Alert"); + } + } + } + + private void RPC_Alert(long sender) + { + if (m_nview.IsOwner()) + { + SetAlerted(alert: true); + } + } + + protected virtual void SetAlerted(bool alert) + { + if (m_alerted != alert) + { + m_alerted = alert; + m_animator.SetBool("alert", m_alerted); + if (m_nview.IsOwner()) + { + m_nview.GetZDO().Set("alert", m_alerted); + } + if (m_alerted) + { + m_alertedEffects.Create(base.transform.position, Quaternion.identity); + } + } + } + + public static bool InStealthRange(Character me) + { + bool result = false; + foreach (BaseAI allInstance in GetAllInstances()) + { + if (!IsEnemy(me, allInstance.m_character)) + { + continue; + } + float num = Vector3.Distance(me.transform.position, allInstance.transform.position); + if (num < allInstance.m_viewRange || num < 10f) + { + if (allInstance.IsAlerted()) + { + return false; + } + result = true; + } + } + return result; + } + + public static Character FindClosestEnemy(Character me, Vector3 point, float maxDistance) + { + Character character = null; + float num = maxDistance; + foreach (Character allCharacter in Character.GetAllCharacters()) + { + if (IsEnemy(me, allCharacter)) + { + float num2 = Vector3.Distance(allCharacter.transform.position, point); + if (character == null || num2 < num) + { + character = allCharacter; + num = num2; + } + } + } + return character; + } + + public static Character FindRandomEnemy(Character me, Vector3 point, float maxDistance) + { + List list = new List(); + foreach (Character allCharacter in Character.GetAllCharacters()) + { + if (IsEnemy(me, allCharacter) && Vector3.Distance(allCharacter.transform.position, point) < maxDistance) + { + list.Add(allCharacter); + } + } + if (list.Count == 0) + { + return null; + } + return list[UnityEngine.Random.Range(0, list.Count)]; + } + + public bool IsAlerted() + { + return m_alerted; + } + + protected float GetAltitude() + { + float groundHeight = ZoneSystem.instance.GetGroundHeight(m_character.transform.position); + return m_character.transform.position.y - groundHeight; + } + + public static List GetAllInstances() + { + return m_instances; + } + + protected virtual void OnDrawGizmosSelected() + { + if (m_lastFindPathResult) + { + Gizmos.color = Color.yellow; + for (int i = 0; i < m_path.Count - 1; i++) + { + Vector3 vector = m_path[i]; + Gizmos.DrawLine(to: m_path[i + 1] + Vector3.up * 0.1f, from: vector + Vector3.up * 0.1f); + } + Gizmos.color = Color.cyan; + foreach (Vector3 item in m_path) + { + Gizmos.DrawSphere(item + Vector3.up * 0.1f, 0.1f); + } + Gizmos.color = Color.green; + Gizmos.DrawLine(base.transform.position, m_lastFindPathTarget); + Gizmos.DrawSphere(m_lastFindPathTarget, 0.2f); + } + else + { + Gizmos.color = Color.red; + Gizmos.DrawLine(base.transform.position, m_lastFindPathTarget); + Gizmos.DrawSphere(m_lastFindPathTarget, 0.2f); + } + } + + public virtual bool IsSleeping() + { + return false; + } + + public bool HasZDOOwner() + { + if (!m_nview.IsValid()) + { + return false; + } + return m_nview.GetZDO().HasOwner(); + } + + public static bool CanUseAttack(Character character, ItemDrop.ItemData item) + { + bool flag = character.IsFlying(); + bool flag2 = character.IsSwiming(); + if (item.m_shared.m_aiWhenFlying && flag) + { + return true; + } + if (item.m_shared.m_aiWhenWalking && !flag && !flag2) + { + return true; + } + if (item.m_shared.m_aiWhenSwiming && flag2) + { + return true; + } + return false; + } + + public virtual Character GetTargetCreature() + { + return null; + } +} diff --git a/Valheim_r202102_v0.141.2/Valheim/assembly_valheim/Beacon.cs b/Valheim_r202102_v0.141.2/Valheim/assembly_valheim/Beacon.cs new file mode 100644 index 0000000..8dd7cba --- /dev/null +++ b/Valheim_r202102_v0.141.2/Valheim/assembly_valheim/Beacon.cs @@ -0,0 +1,46 @@ +using System.Collections.Generic; +using UnityEngine; + +public class Beacon : MonoBehaviour +{ + public float m_range = 20f; + + private static List m_instances = new List(); + + private void Awake() + { + m_instances.Add(this); + } + + private void OnDestroy() + { + m_instances.Remove(this); + } + + public static Beacon FindClosestBeaconInRange(Vector3 point) + { + Beacon beacon = null; + float num = 999999f; + foreach (Beacon instance in m_instances) + { + float num2 = Vector3.Distance(point, instance.transform.position); + if (num2 < instance.m_range && (beacon == null || num2 < num)) + { + beacon = instance; + num = num2; + } + } + return beacon; + } + + public static void FindBeaconsInRange(Vector3 point, List becons) + { + foreach (Beacon instance in m_instances) + { + if (Vector3.Distance(point, instance.transform.position) < instance.m_range) + { + becons.Add(instance); + } + } + } +} diff --git a/Valheim_r202102_v0.141.2/Valheim/assembly_valheim/Bed.cs b/Valheim_r202102_v0.141.2/Valheim/assembly_valheim/Bed.cs new file mode 100644 index 0000000..2af71df --- /dev/null +++ b/Valheim_r202102_v0.141.2/Valheim/assembly_valheim/Bed.cs @@ -0,0 +1,201 @@ +using UnityEngine; + +public class Bed : MonoBehaviour, Hoverable, Interactable +{ + public Transform m_spawnPoint; + + public float m_monsterCheckRadius = 20f; + + private ZNetView m_nview; + + private void Awake() + { + m_nview = GetComponent(); + if (m_nview.GetZDO() != null) + { + m_nview.Register("SetOwner", RPC_SetOwner); + } + } + + public string GetHoverText() + { + string ownerName = GetOwnerName(); + if (ownerName == "") + { + return Localization.instance.Localize("$piece_bed_unclaimed\n[$KEY_Use] $piece_bed_claim"); + } + string text = ownerName + "'s $piece_bed"; + if (IsMine()) + { + if (IsCurrent()) + { + return Localization.instance.Localize(text + "\n[$KEY_Use] $piece_bed_sleep"); + } + return Localization.instance.Localize(text + "\n[$KEY_Use] $piece_bed_setspawn"); + } + return Localization.instance.Localize(text); + } + + public string GetHoverName() + { + return Localization.instance.Localize("$piece_bed"); + } + + public bool Interact(Humanoid human, bool repeat) + { + if (repeat) + { + return false; + } + long playerID = Game.instance.GetPlayerProfile().GetPlayerID(); + long owner = GetOwner(); + Player human2 = human as Player; + if (owner == 0L) + { + ZLog.Log("Has no creator"); + if (!CheckExposure(human2)) + { + return false; + } + SetOwner(playerID, Game.instance.GetPlayerProfile().GetName()); + Game.instance.GetPlayerProfile().SetCustomSpawnPoint(GetSpawnPoint()); + human.Message(MessageHud.MessageType.Center, "$msg_spawnpointset"); + } + else if (IsMine()) + { + ZLog.Log("Is mine"); + if (IsCurrent()) + { + ZLog.Log("is current spawnpoint"); + if (!EnvMan.instance.IsAfternoon() && !EnvMan.instance.IsNight()) + { + human.Message(MessageHud.MessageType.Center, "$msg_cantsleep"); + return false; + } + if (!CheckEnemies(human2)) + { + return false; + } + if (!CheckExposure(human2)) + { + return false; + } + if (!CheckFire(human2)) + { + return false; + } + if (!CheckWet(human2)) + { + return false; + } + human.AttachStart(m_spawnPoint, hideWeapons: true, isBed: true, "attach_bed", new Vector3(0f, 0.5f, 0f)); + return false; + } + ZLog.Log("Not current spawn point"); + if (!CheckExposure(human2)) + { + return false; + } + Game.instance.GetPlayerProfile().SetCustomSpawnPoint(GetSpawnPoint()); + human.Message(MessageHud.MessageType.Center, "$msg_spawnpointset"); + } + return false; + } + + private bool CheckWet(Player human) + { + if (human.GetSEMan().HaveStatusEffect("Wet")) + { + human.Message(MessageHud.MessageType.Center, "$msg_bedwet"); + return false; + } + return true; + } + + private bool CheckEnemies(Player human) + { + if (human.IsSensed()) + { + human.Message(MessageHud.MessageType.Center, "$msg_bedenemiesnearby"); + return false; + } + return true; + } + + private bool CheckExposure(Player human) + { + Cover.GetCoverForPoint(GetSpawnPoint(), out var coverPercentage, out var underRoof); + if (!underRoof) + { + human.Message(MessageHud.MessageType.Center, "$msg_bedneedroof"); + return false; + } + if (coverPercentage < 0.8f) + { + human.Message(MessageHud.MessageType.Center, "$msg_bedtooexposed"); + return false; + } + ZLog.Log("exporeusre check " + coverPercentage + " " + underRoof.ToString()); + return true; + } + + private bool CheckFire(Player human) + { + if (!EffectArea.IsPointInsideArea(base.transform.position, EffectArea.Type.Heat)) + { + human.Message(MessageHud.MessageType.Center, "$msg_bednofire"); + return false; + } + return true; + } + + public bool UseItem(Humanoid user, ItemDrop.ItemData item) + { + return false; + } + + public bool IsCurrent() + { + if (!IsMine()) + { + return false; + } + return Vector3.Distance(GetSpawnPoint(), Game.instance.GetPlayerProfile().GetCustomSpawnPoint()) < 1f; + } + + public Vector3 GetSpawnPoint() + { + return m_spawnPoint.position; + } + + private bool IsMine() + { + long playerID = Game.instance.GetPlayerProfile().GetPlayerID(); + long owner = GetOwner(); + return playerID == owner; + } + + private void SetOwner(long uid, string name) + { + m_nview.InvokeRPC("SetOwner", uid, name); + } + + private void RPC_SetOwner(long sender, long uid, string name) + { + if (m_nview.IsOwner()) + { + m_nview.GetZDO().Set("owner", uid); + m_nview.GetZDO().Set("ownerName", name); + } + } + + private long GetOwner() + { + return m_nview.GetZDO().GetLong("owner", 0L); + } + + private string GetOwnerName() + { + return m_nview.GetZDO().GetString("ownerName"); + } +} diff --git a/Valheim_r202102_v0.141.2/Valheim/assembly_valheim/Beehive.cs b/Valheim_r202102_v0.141.2/Valheim/assembly_valheim/Beehive.cs new file mode 100644 index 0000000..0e92ae1 --- /dev/null +++ b/Valheim_r202102_v0.141.2/Valheim/assembly_valheim/Beehive.cs @@ -0,0 +1,186 @@ +using System; +using UnityEngine; + +public class Beehive : MonoBehaviour, Hoverable, Interactable +{ + public string m_name = ""; + + public Transform m_coverPoint; + + public Transform m_spawnPoint; + + public GameObject m_beeEffect; + + public float m_maxCover = 0.25f; + + [BitMask(typeof(Heightmap.Biome))] + public Heightmap.Biome m_biome; + + public float m_secPerUnit = 10f; + + public int m_maxHoney = 4; + + public ItemDrop m_honeyItem; + + public EffectList m_spawnEffect = new EffectList(); + + private ZNetView m_nview; + + private void Awake() + { + m_nview = GetComponent(); + if (m_nview.GetZDO() != null) + { + if (m_nview.IsOwner() && m_nview.GetZDO().GetLong("lastTime", 0L) == 0L) + { + m_nview.GetZDO().Set("lastTime", ZNet.instance.GetTime().Ticks); + } + m_nview.Register("Extract", RPC_Extract); + InvokeRepeating("UpdateBees", 0f, 10f); + } + } + + public string GetHoverText() + { + if (!PrivateArea.CheckAccess(base.transform.position, 0f, flash: false)) + { + return Localization.instance.Localize(m_name + "\n$piece_noaccess"); + } + int honeyLevel = GetHoneyLevel(); + if (honeyLevel > 0) + { + return Localization.instance.Localize(m_name + " ( " + m_honeyItem.m_itemData.m_shared.m_name + " x " + honeyLevel + " )\n[$KEY_Use] $piece_beehive_extract"); + } + return Localization.instance.Localize(m_name + " ( $piece_container_empty )\n[$KEY_Use] $piece_beehive_check"); + } + + public string GetHoverName() + { + return m_name; + } + + public bool Interact(Humanoid character, bool repeat) + { + if (repeat) + { + return false; + } + if (!PrivateArea.CheckAccess(base.transform.position)) + { + return true; + } + if (GetHoneyLevel() > 0) + { + Extract(); + } + else + { + if (!CheckBiome()) + { + character.Message(MessageHud.MessageType.Center, "$piece_beehive_area"); + return true; + } + if (!HaveFreeSpace()) + { + character.Message(MessageHud.MessageType.Center, "$piece_beehive_freespace"); + return true; + } + if (!EnvMan.instance.IsDaylight()) + { + character.Message(MessageHud.MessageType.Center, "$piece_beehive_sleep"); + return true; + } + character.Message(MessageHud.MessageType.Center, "$piece_beehive_happy"); + } + return true; + } + + public bool UseItem(Humanoid user, ItemDrop.ItemData item) + { + return false; + } + + private void Extract() + { + m_nview.InvokeRPC("Extract"); + } + + private void RPC_Extract(long caller) + { + int honeyLevel = GetHoneyLevel(); + if (honeyLevel > 0) + { + m_spawnEffect.Create(m_spawnPoint.position, Quaternion.identity); + for (int i = 0; i < honeyLevel; i++) + { + Vector2 vector = UnityEngine.Random.insideUnitCircle * 0.5f; + Vector3 position = m_spawnPoint.position + new Vector3(vector.x, 0.25f * (float)i, vector.y); + UnityEngine.Object.Instantiate(m_honeyItem, position, Quaternion.identity); + } + ResetLevel(); + } + } + + private float GetTimeSinceLastUpdate() + { + DateTime dateTime = new DateTime(m_nview.GetZDO().GetLong("lastTime", ZNet.instance.GetTime().Ticks)); + DateTime time = ZNet.instance.GetTime(); + TimeSpan timeSpan = time - dateTime; + m_nview.GetZDO().Set("lastTime", time.Ticks); + double num = timeSpan.TotalSeconds; + if (num < 0.0) + { + num = 0.0; + } + return (float)num; + } + + private void ResetLevel() + { + m_nview.GetZDO().Set("level", 0); + } + + private void IncreseLevel(int i) + { + int honeyLevel = GetHoneyLevel(); + honeyLevel += i; + honeyLevel = Mathf.Clamp(honeyLevel, 0, m_maxHoney); + m_nview.GetZDO().Set("level", honeyLevel); + } + + private int GetHoneyLevel() + { + return m_nview.GetZDO().GetInt("level"); + } + + private void UpdateBees() + { + bool flag = CheckBiome() && HaveFreeSpace(); + bool active = flag && EnvMan.instance.IsDaylight(); + m_beeEffect.SetActive(active); + if (m_nview.IsOwner() && flag) + { + float timeSinceLastUpdate = GetTimeSinceLastUpdate(); + float @float = m_nview.GetZDO().GetFloat("product"); + @float += timeSinceLastUpdate; + if (@float > m_secPerUnit) + { + int i = (int)(@float / m_secPerUnit); + IncreseLevel(i); + @float = 0f; + } + m_nview.GetZDO().Set("product", @float); + } + } + + private bool HaveFreeSpace() + { + Cover.GetCoverForPoint(m_coverPoint.position, out var coverPercentage, out var _); + return coverPercentage < m_maxCover; + } + + private bool CheckBiome() + { + return (Heightmap.FindBiome(base.transform.position) & m_biome) != 0; + } +} diff --git a/Valheim_r202102_v0.141.2/Valheim/assembly_valheim/Billboard.cs b/Valheim_r202102_v0.141.2/Valheim/assembly_valheim/Billboard.cs new file mode 100644 index 0000000..108afa6 --- /dev/null +++ b/Valheim_r202102_v0.141.2/Valheim/assembly_valheim/Billboard.cs @@ -0,0 +1,37 @@ +using UnityEngine; + +public class Billboard : MonoBehaviour +{ + public bool m_vertical = true; + + public bool m_invert; + + private Vector3 m_normal; + + private void Awake() + { + m_normal = base.transform.up; + } + + private void LateUpdate() + { + Camera mainCamera = Utils.GetMainCamera(); + if (!(mainCamera == null)) + { + Vector3 vector = mainCamera.transform.position; + if (m_invert) + { + vector = base.transform.position - (vector - base.transform.position); + } + if (m_vertical) + { + vector.y = base.transform.position.y; + base.transform.LookAt(vector, m_normal); + } + else + { + base.transform.LookAt(vector); + } + } + } +} diff --git a/Valheim_r202102_v0.141.2/Valheim/assembly_valheim/BiomeEnvSetup.cs b/Valheim_r202102_v0.141.2/Valheim/assembly_valheim/BiomeEnvSetup.cs new file mode 100644 index 0000000..4ff8e60 --- /dev/null +++ b/Valheim_r202102_v0.141.2/Valheim/assembly_valheim/BiomeEnvSetup.cs @@ -0,0 +1,23 @@ +using System; +using System.Collections.Generic; +using UnityEngine.Serialization; + +[Serializable] +public class BiomeEnvSetup +{ + public string m_name = ""; + + public Heightmap.Biome m_biome = Heightmap.Biome.Meadows; + + public List m_environments = new List(); + + public string m_musicMorning = "morning"; + + public string m_musicEvening = "evening"; + + [FormerlySerializedAs("m_musicRandomDay")] + public string m_musicDay = ""; + + [FormerlySerializedAs("m_musicRandomNight")] + public string m_musicNight = ""; +} diff --git a/Valheim_r202102_v0.141.2/Valheim/assembly_valheim/BossStone.cs b/Valheim_r202102_v0.141.2/Valheim/assembly_valheim/BossStone.cs new file mode 100644 index 0000000..67aa52f --- /dev/null +++ b/Valheim_r202102_v0.141.2/Valheim/assembly_valheim/BossStone.cs @@ -0,0 +1,111 @@ +using System.Collections; +using UnityEngine; + +public class BossStone : MonoBehaviour +{ + public ItemStand m_itemStand; + + public GameObject m_activeEffect; + + public EffectList m_activateStep1 = new EffectList(); + + public EffectList m_activateStep2 = new EffectList(); + + public EffectList m_activateStep3 = new EffectList(); + + public string m_completedMessage = ""; + + public MeshRenderer m_mesh; + + public int m_emissiveMaterialIndex; + + public Color m_activeEmissiveColor = Color.white; + + private bool m_active; + + private ZNetView m_nview; + + private void Start() + { + if (m_mesh.material.HasProperty("_EmissionColor")) + { + m_mesh.materials[m_emissiveMaterialIndex].SetColor("_EmissionColor", Color.black); + } + if ((bool)m_activeEffect) + { + m_activeEffect.SetActive(value: false); + } + SetActivated(m_itemStand.HaveAttachment(), triggerEffect: false); + InvokeRepeating("UpdateVisual", 1f, 1f); + } + + private void UpdateVisual() + { + SetActivated(m_itemStand.HaveAttachment(), triggerEffect: true); + } + + private void SetActivated(bool active, bool triggerEffect) + { + if (active == m_active) + { + return; + } + m_active = active; + if (triggerEffect && active) + { + Invoke("DelayedAttachEffects_Step1", 1f); + Invoke("DelayedAttachEffects_Step2", 5f); + Invoke("DelayedAttachEffects_Step3", 11f); + return; + } + if ((bool)m_activeEffect) + { + m_activeEffect.SetActive(active); + } + StopCoroutine("FadeEmission"); + StartCoroutine("FadeEmission"); + } + + private void DelayedAttachEffects_Step1() + { + m_activateStep1.Create(m_itemStand.transform.position, base.transform.rotation); + } + + private void DelayedAttachEffects_Step2() + { + m_activateStep2.Create(base.transform.position, base.transform.rotation); + } + + private void DelayedAttachEffects_Step3() + { + if ((bool)m_activeEffect) + { + m_activeEffect.SetActive(value: true); + } + m_activateStep3.Create(base.transform.position, base.transform.rotation); + StopCoroutine("FadeEmission"); + StartCoroutine("FadeEmission"); + Player.MessageAllInRange(base.transform.position, 20f, MessageHud.MessageType.Center, m_completedMessage); + } + + private IEnumerator FadeEmission() + { + if ((bool)m_mesh && m_mesh.materials[m_emissiveMaterialIndex].HasProperty("_EmissionColor")) + { + Color startColor = m_mesh.materials[m_emissiveMaterialIndex].GetColor("_EmissionColor"); + Color targetColor = (m_active ? m_activeEmissiveColor : Color.black); + for (float t = 0f; t < 1f; t += Time.deltaTime) + { + Color value = Color.Lerp(startColor, targetColor, t / 1f); + m_mesh.materials[m_emissiveMaterialIndex].SetColor("_EmissionColor", value); + yield return null; + } + } + ZLog.Log("Done fading color"); + } + + public bool IsActivated() + { + return m_active; + } +} diff --git a/Valheim_r202102_v0.141.2/Valheim/assembly_valheim/CamShaker.cs b/Valheim_r202102_v0.141.2/Valheim/assembly_valheim/CamShaker.cs new file mode 100644 index 0000000..4d661c5 --- /dev/null +++ b/Valheim_r202102_v0.141.2/Valheim/assembly_valheim/CamShaker.cs @@ -0,0 +1,65 @@ +using System.Collections; +using UnityEngine; + +public class CamShaker : MonoBehaviour +{ + public float m_strength = 1f; + + public float m_range = 50f; + + public float m_delay; + + public bool m_continous; + + public float m_continousDuration; + + public bool m_localOnly; + + private void Start() + { + if (m_continous) + { + StartCoroutine("TriggerContinous"); + } + else if (m_delay <= 0f) + { + Trigger(); + } + else + { + Invoke("Trigger", m_delay); + } + } + + private IEnumerator TriggerContinous() + { + float t = 0f; + while (true) + { + Trigger(); + t += Time.deltaTime; + if (m_continousDuration > 0f && t > m_continousDuration) + { + break; + } + yield return null; + } + } + + private void Trigger() + { + if (!GameCamera.instance) + { + return; + } + if (m_localOnly) + { + ZNetView component = GetComponent(); + if ((bool)component && !component.IsOwner()) + { + return; + } + } + GameCamera.instance.AddShake(base.transform.position, m_range, m_strength, m_continous); + } +} diff --git a/Valheim_r202102_v0.141.2/Valheim/assembly_valheim/CameraEffects.cs b/Valheim_r202102_v0.141.2/Valheim/assembly_valheim/CameraEffects.cs new file mode 100644 index 0000000..7aa1f95 --- /dev/null +++ b/Valheim_r202102_v0.141.2/Valheim/assembly_valheim/CameraEffects.cs @@ -0,0 +1,127 @@ +using UnityEngine; +using UnityEngine.PostProcessing; +using UnityStandardAssets.ImageEffects; + +public class CameraEffects : MonoBehaviour +{ + private static CameraEffects m_instance; + + public bool m_forceDof; + + public LayerMask m_dofRayMask; + + public bool m_dofAutoFocus; + + public float m_dofMinDistance = 50f; + + public float m_dofMinDistanceShip = 50f; + + public float m_dofMaxDistance = 3000f; + + private PostProcessingBehaviour m_postProcessing; + + private DepthOfField m_dof; + + public static CameraEffects instance => m_instance; + + private void Awake() + { + m_instance = this; + m_postProcessing = GetComponent(); + m_dof = GetComponent(); + ApplySettings(); + } + + private void OnDestroy() + { + if (m_instance == this) + { + m_instance = null; + } + } + + public void ApplySettings() + { + SetDof(PlayerPrefs.GetInt("DOF", 1) == 1); + SetBloom(PlayerPrefs.GetInt("Bloom", 1) == 1); + SetSSAO(PlayerPrefs.GetInt("SSAO", 1) == 1); + SetSunShafts(PlayerPrefs.GetInt("SunShafts", 1) == 1); + SetAntiAliasing(PlayerPrefs.GetInt("AntiAliasing", 1) == 1); + SetCA(PlayerPrefs.GetInt("ChromaticAberration", 1) == 1); + SetMotionBlur(PlayerPrefs.GetInt("MotionBlur", 1) == 1); + } + + public void SetSunShafts(bool enabled) + { + SunShafts component = GetComponent(); + if (component != null) + { + component.enabled = enabled; + } + } + + private void SetBloom(bool enabled) + { + m_postProcessing.profile.bloom.enabled = enabled; + } + + private void SetSSAO(bool enabled) + { + m_postProcessing.profile.ambientOcclusion.enabled = enabled; + } + + private void SetMotionBlur(bool enabled) + { + m_postProcessing.profile.motionBlur.enabled = enabled; + } + + private void SetAntiAliasing(bool enabled) + { + m_postProcessing.profile.antialiasing.enabled = enabled; + } + + private void SetCA(bool enabled) + { + m_postProcessing.profile.chromaticAberration.enabled = enabled; + } + + private void SetDof(bool enabled) + { + m_dof.enabled = enabled || m_forceDof; + } + + private void LateUpdate() + { + UpdateDOF(); + } + + private bool ControllingShip() + { + if (Player.m_localPlayer == null || Player.m_localPlayer.GetControlledShip() != null) + { + return true; + } + return false; + } + + private void UpdateDOF() + { + if (m_dof.enabled && m_dofAutoFocus) + { + float num = m_dofMaxDistance; + if (Physics.Raycast(base.transform.position, base.transform.forward, out var hitInfo, m_dofMaxDistance, m_dofRayMask)) + { + num = hitInfo.distance; + } + if (ControllingShip() && num < m_dofMinDistanceShip) + { + num = m_dofMinDistanceShip; + } + if (num < m_dofMinDistance) + { + num = m_dofMinDistance; + } + m_dof.focalLength = Mathf.Lerp(m_dof.focalLength, num, 0.2f); + } + } +} diff --git a/Valheim_r202102_v0.141.2/Valheim/assembly_valheim/Chair.cs b/Valheim_r202102_v0.141.2/Valheim/assembly_valheim/Chair.cs new file mode 100644 index 0000000..09c5277 --- /dev/null +++ b/Valheim_r202102_v0.141.2/Valheim/assembly_valheim/Chair.cs @@ -0,0 +1,73 @@ +using UnityEngine; + +public class Chair : MonoBehaviour, Hoverable, Interactable +{ + public string m_name = "Chair"; + + public float m_useDistance = 2f; + + public Transform m_attachPoint; + + public Vector3 m_detachOffset = new Vector3(0f, 0.5f, 0f); + + public string m_attachAnimation = "attach_chair"; + + private const float m_minSitDelay = 2f; + + private static float m_lastSitTime; + + public string GetHoverText() + { + if (Time.time - m_lastSitTime < 2f) + { + return ""; + } + if (!InUseDistance(Player.m_localPlayer)) + { + return Localization.instance.Localize("$piece_toofar"); + } + return Localization.instance.Localize(m_name + "\n[$KEY_Use] $piece_use"); + } + + public string GetHoverName() + { + return m_name; + } + + public bool Interact(Humanoid human, bool hold) + { + if (hold) + { + return false; + } + Player player = human as Player; + if (!InUseDistance(player)) + { + return false; + } + if (Time.time - m_lastSitTime < 2f) + { + return false; + } + if ((bool)player) + { + if (player.IsEncumbered()) + { + return false; + } + player.AttachStart(m_attachPoint, hideWeapons: false, isBed: false, m_attachAnimation, m_detachOffset); + m_lastSitTime = Time.time; + } + return false; + } + + public bool UseItem(Humanoid user, ItemDrop.ItemData item) + { + return false; + } + + private bool InUseDistance(Humanoid human) + { + return Vector3.Distance(human.transform.position, m_attachPoint.position) < m_useDistance; + } +} diff --git a/Valheim_r202102_v0.141.2/Valheim/assembly_valheim/ChangeLog.cs b/Valheim_r202102_v0.141.2/Valheim/assembly_valheim/ChangeLog.cs new file mode 100644 index 0000000..ff4874f --- /dev/null +++ b/Valheim_r202102_v0.141.2/Valheim/assembly_valheim/ChangeLog.cs @@ -0,0 +1,15 @@ +using UnityEngine; +using UnityEngine.UI; + +public class ChangeLog : MonoBehaviour +{ + public Text m_textField; + + public TextAsset m_changeLog; + + private void Start() + { + string text = m_changeLog.text; + m_textField.text = text; + } +} diff --git a/Valheim_r202102_v0.141.2/Valheim/assembly_valheim/Character.cs b/Valheim_r202102_v0.141.2/Valheim/assembly_valheim/Character.cs new file mode 100644 index 0000000..7807218 --- /dev/null +++ b/Valheim_r202102_v0.141.2/Valheim/assembly_valheim/Character.cs @@ -0,0 +1,2567 @@ +using System; +using System.Collections.Generic; +using UnityEngine; + +public class Character : MonoBehaviour, IDestructible, Hoverable, IWaterInteractable +{ + public enum Faction + { + Players, + AnimalsVeg, + ForestMonsters, + Undead, + Demon, + MountainMonsters, + SeaMonsters, + PlainsMonsters, + Boss + } + + public enum GroundTiltType + { + None, + Pitch, + Full, + PitchRaycast, + FullRaycast + } + + private float m_underWorldCheckTimer; + + private Collider m_lowestContactCollider; + + private bool m_groundContact; + + private Vector3 m_groundContactPoint = Vector3.zero; + + private Vector3 m_groundContactNormal = Vector3.zero; + + public Action m_onDamaged; + + public Action m_onDeath; + + public Action m_onLevelSet; + + public Action m_onLand; + + [Header("Character")] + public string m_name = ""; + + public Faction m_faction = Faction.AnimalsVeg; + + public bool m_boss; + + public string m_bossEvent = ""; + + public string m_defeatSetGlobalKey = ""; + + [Header("Movement & Physics")] + public float m_crouchSpeed = 2f; + + public float m_walkSpeed = 5f; + + public float m_speed = 10f; + + public float m_turnSpeed = 300f; + + public float m_runSpeed = 20f; + + public float m_runTurnSpeed = 300f; + + public float m_flySlowSpeed = 5f; + + public float m_flyFastSpeed = 12f; + + public float m_flyTurnSpeed = 12f; + + public float m_acceleration = 1f; + + public float m_jumpForce = 10f; + + public float m_jumpForceForward; + + public float m_jumpForceTiredFactor = 0.7f; + + public float m_airControl = 0.1f; + + private const float m_slopeStaminaDrain = 10f; + + public const float m_minSlideDegreesPlayer = 38f; + + public const float m_minSlideDegreesMonster = 90f; + + private const float m_rootMotionMultiplier = 55f; + + private const float m_continousPushForce = 10f; + + private const float m_pushForcedissipation = 100f; + + private const float m_maxMoveForce = 20f; + + public bool m_canSwim = true; + + public float m_swimDepth = 2f; + + public float m_swimSpeed = 2f; + + public float m_swimTurnSpeed = 100f; + + public float m_swimAcceleration = 0.05f; + + public GroundTiltType m_groundTilt; + + public bool m_flying; + + public float m_jumpStaminaUsage = 10f; + + [Header("Bodyparts")] + public Transform m_eye; + + protected Transform m_head; + + [Header("Effects")] + public EffectList m_hitEffects = new EffectList(); + + public EffectList m_critHitEffects = new EffectList(); + + public EffectList m_backstabHitEffects = new EffectList(); + + public EffectList m_deathEffects = new EffectList(); + + public EffectList m_waterEffects = new EffectList(); + + public EffectList m_slideEffects = new EffectList(); + + public EffectList m_jumpEffects = new EffectList(); + + [Header("Health & Damage")] + public bool m_tolerateWater = true; + + public bool m_tolerateFire; + + public bool m_tolerateSmoke = true; + + public float m_health = 10f; + + public HitData.DamageModifiers m_damageModifiers; + + public bool m_staggerWhenBlocked = true; + + public float m_staggerDamageFactor; + + private const float m_staggerResetTime = 3f; + + private float m_staggerDamage; + + private float m_staggerTimer; + + private float m_backstabTime = -99999f; + + private const float m_backstabResetTime = 300f; + + private GameObject[] m_waterEffects_instances; + + private GameObject[] m_slideEffects_instances; + + protected Vector3 m_moveDir = Vector3.zero; + + protected Vector3 m_lookDir = Vector3.forward; + + protected Quaternion m_lookYaw = Quaternion.identity; + + protected bool m_run; + + protected bool m_walk; + + protected bool m_attack; + + protected bool m_attackDraw; + + protected bool m_secondaryAttack; + + protected bool m_blocking; + + protected GameObject m_visual; + + protected LODGroup m_lodGroup; + + protected Rigidbody m_body; + + protected CapsuleCollider m_collider; + + protected ZNetView m_nview; + + protected ZSyncAnimation m_zanim; + + protected Animator m_animator; + + protected CharacterAnimEvent m_animEvent; + + protected BaseAI m_baseAI; + + private const float m_maxFallHeight = 20f; + + private const float m_minFallHeight = 4f; + + private const float m_maxFallDamage = 100f; + + private const float m_staggerDamageBonus = 2f; + + private const float m_baseVisualRange = 30f; + + private const float m_autoJumpInterval = 0.5f; + + private float m_jumpTimer; + + private float m_lastAutoJumpTime; + + private float m_lastGroundTouch; + + private Vector3 m_lastGroundNormal = Vector3.up; + + private Vector3 m_lastGroundPoint = Vector3.up; + + private Collider m_lastGroundCollider; + + private Rigidbody m_lastGroundBody; + + private Vector3 m_lastAttachPos = Vector3.zero; + + private Rigidbody m_lastAttachBody; + + protected float m_maxAirAltitude = -10000f; + + private float m_waterLevel = -10000f; + + private float m_swimTimer = 999f; + + protected SEMan m_seman; + + private float m_noiseRange; + + private float m_syncNoiseTimer; + + private bool m_tamed; + + private float m_lastTamedCheck; + + private int m_level = 1; + + private Vector3 m_currentVel = Vector3.zero; + + private float m_currentTurnVel; + + private float m_currentTurnVelChange; + + private Vector3 m_groundTiltNormal = Vector3.up; + + protected Vector3 m_pushForce = Vector3.zero; + + private Vector3 m_rootMotion = Vector3.zero; + + private static int forward_speed = 0; + + private static int sideway_speed = 0; + + private static int turn_speed = 0; + + private static int inWater = 0; + + private static int onGround = 0; + + private static int encumbered = 0; + + private static int flying = 0; + + private float m_slippage; + + protected bool m_wallRunning; + + protected bool m_sliding; + + protected bool m_running; + + private Vector3 m_originalLocalRef; + + private bool m_lodVisible = true; + + private static int m_smokeRayMask = 0; + + private float m_smokeCheckTimer; + + private static bool m_dpsDebugEnabled = false; + + private static List> m_enemyDamage = new List>(); + + private static List> m_playerDamage = new List>(); + + private static List m_characters = new List(); + + protected static int m_characterLayer = 0; + + protected static int m_characterNetLayer = 0; + + protected static int m_characterGhostLayer = 0; + + protected static int m_animatorTagFreeze = Animator.StringToHash("freeze"); + + protected static int m_animatorTagStagger = Animator.StringToHash("stagger"); + + protected static int m_animatorTagSitting = Animator.StringToHash("sitting"); + + protected virtual void Awake() + { + m_characters.Add(this); + m_collider = GetComponent(); + m_body = GetComponent(); + m_zanim = GetComponent(); + m_nview = GetComponent(); + m_animator = GetComponentInChildren(); + m_animEvent = m_animator.GetComponent(); + m_baseAI = GetComponent(); + m_animator.logWarnings = false; + m_visual = base.transform.Find("Visual").gameObject; + m_lodGroup = m_visual.GetComponent(); + m_head = m_animator.GetBoneTransform(HumanBodyBones.Head); + m_body.maxDepenetrationVelocity = 2f; + if (m_smokeRayMask == 0) + { + m_smokeRayMask = LayerMask.GetMask("smoke"); + m_characterLayer = LayerMask.NameToLayer("character"); + m_characterNetLayer = LayerMask.NameToLayer("character_net"); + m_characterGhostLayer = LayerMask.NameToLayer("character_ghost"); + } + if (forward_speed == 0) + { + forward_speed = ZSyncAnimation.GetHash("forward_speed"); + sideway_speed = ZSyncAnimation.GetHash("sideway_speed"); + turn_speed = ZSyncAnimation.GetHash("turn_speed"); + inWater = ZSyncAnimation.GetHash("inWater"); + onGround = ZSyncAnimation.GetHash("onGround"); + encumbered = ZSyncAnimation.GetHash("encumbered"); + flying = ZSyncAnimation.GetHash("flying"); + } + if ((bool)m_lodGroup) + { + m_originalLocalRef = m_lodGroup.localReferencePoint; + } + m_seman = new SEMan(this, m_nview); + if (m_nview.GetZDO() == null) + { + return; + } + if (!IsPlayer()) + { + if (m_nview.IsOwner() && GetHealth() == GetMaxHealth()) + { + SetupMaxHealth(); + } + m_tamed = m_nview.GetZDO().GetBool("tamed", m_tamed); + m_level = m_nview.GetZDO().GetInt("level", 1); + } + m_nview.Register("Damage", RPC_Damage); + m_nview.Register("Heal", RPC_Heal); + m_nview.Register("AddNoise", RPC_AddNoise); + m_nview.Register("Stagger", RPC_Stagger); + m_nview.Register("ResetCloth", RPC_ResetCloth); + m_nview.Register("SetTamed", RPC_SetTamed); + } + + private void SetupMaxHealth() + { + int level = GetLevel(); + float difficultyHealthScale = Game.instance.GetDifficultyHealthScale(base.transform.position); + SetMaxHealth(m_health * difficultyHealthScale * (float)level); + } + + protected virtual void Start() + { + m_nview.GetZDO(); + } + + public virtual void OnDestroy() + { + m_seman.OnDestroy(); + m_characters.Remove(this); + } + + public void SetLevel(int level) + { + if (level >= 1) + { + m_level = level; + m_nview.GetZDO().Set("level", level); + SetupMaxHealth(); + if (m_onLevelSet != null) + { + m_onLevelSet(m_level); + } + } + } + + public int GetLevel() + { + return m_level; + } + + public virtual bool IsPlayer() + { + return false; + } + + public Faction GetFaction() + { + return m_faction; + } + + protected virtual void FixedUpdate() + { + if (m_nview.IsValid()) + { + float fixedDeltaTime = Time.fixedDeltaTime; + UpdateLayer(); + UpdateContinousEffects(); + UpdateWater(fixedDeltaTime); + UpdateGroundTilt(fixedDeltaTime); + SetVisible(m_nview.HasOwner()); + if (m_nview.IsOwner()) + { + UpdateGroundContact(fixedDeltaTime); + UpdateNoise(fixedDeltaTime); + m_seman.Update(fixedDeltaTime); + UpdateStagger(fixedDeltaTime); + UpdatePushback(fixedDeltaTime); + UpdateMotion(fixedDeltaTime); + UpdateSmoke(fixedDeltaTime); + UnderWorldCheck(fixedDeltaTime); + SyncVelocity(); + CheckDeath(); + } + } + } + + private void UpdateLayer() + { + if (m_collider.gameObject.layer == m_characterLayer || m_collider.gameObject.layer == m_characterNetLayer) + { + if (m_nview.IsOwner()) + { + m_collider.gameObject.layer = (IsAttached() ? m_characterNetLayer : m_characterLayer); + } + else + { + m_collider.gameObject.layer = m_characterNetLayer; + } + } + } + + private void UnderWorldCheck(float dt) + { + if (IsDead()) + { + return; + } + m_underWorldCheckTimer += dt; + if (m_underWorldCheckTimer > 5f || IsPlayer()) + { + m_underWorldCheckTimer = 0f; + float groundHeight = ZoneSystem.instance.GetGroundHeight(base.transform.position); + if (base.transform.position.y < groundHeight - 1f) + { + Vector3 position = base.transform.position; + position.y = groundHeight + 0.5f; + base.transform.position = position; + m_body.position = position; + m_body.velocity = Vector3.zero; + } + } + } + + private void UpdateSmoke(float dt) + { + if (m_tolerateSmoke) + { + return; + } + m_smokeCheckTimer += dt; + if (m_smokeCheckTimer > 2f) + { + m_smokeCheckTimer = 0f; + if (Physics.CheckSphere(GetTopPoint() + Vector3.up * 0.1f, 0.5f, m_smokeRayMask)) + { + m_seman.AddStatusEffect("Smoked", resetTime: true); + } + else + { + m_seman.RemoveStatusEffect("Smoked", quiet: true); + } + } + } + + private void UpdateContinousEffects() + { + SetupContinousEffect(base.transform.position, m_sliding, m_slideEffects, ref m_slideEffects_instances); + Vector3 position = base.transform.position; + position.y = m_waterLevel + 0.05f; + SetupContinousEffect(position, InWater(), m_waterEffects, ref m_waterEffects_instances); + } + + private void SetupContinousEffect(Vector3 point, bool enabled, EffectList effects, ref GameObject[] instances) + { + if (!effects.HasEffects()) + { + return; + } + if (enabled) + { + if (instances == null) + { + instances = effects.Create(point, Quaternion.identity, base.transform); + return; + } + GameObject[] array = instances; + foreach (GameObject gameObject in array) + { + if ((bool)gameObject) + { + gameObject.transform.position = point; + } + } + } + else + { + if (instances == null) + { + return; + } + GameObject[] array = instances; + foreach (GameObject gameObject2 in array) + { + if ((bool)gameObject2) + { + ParticleSystem[] componentsInChildren = gameObject2.GetComponentsInChildren(); + foreach (ParticleSystem obj in componentsInChildren) + { + ParticleSystem.EmissionModule emission = obj.emission; + emission.enabled = false; + obj.Stop(); + } + CamShaker componentInChildren = gameObject2.GetComponentInChildren(); + if ((bool)componentInChildren) + { + UnityEngine.Object.Destroy(componentInChildren); + } + ZSFX componentInChildren2 = gameObject2.GetComponentInChildren(); + if ((bool)componentInChildren2) + { + componentInChildren2.FadeOut(); + } + TimedDestruction component = gameObject2.GetComponent(); + if ((bool)component) + { + component.Trigger(); + } + else + { + UnityEngine.Object.Destroy(gameObject2); + } + } + } + instances = null; + } + } + + protected virtual void OnSwiming(Vector3 targetVel, float dt) + { + } + + protected virtual void OnSneaking(float dt) + { + } + + protected virtual void OnJump() + { + } + + protected virtual bool TakeInput() + { + return true; + } + + private float GetSlideAngle() + { + if (!IsPlayer()) + { + return 90f; + } + return 38f; + } + + private void ApplySlide(float dt, ref Vector3 currentVel, Vector3 bodyVel, bool running) + { + bool flag = CanWallRun(); + float num = Mathf.Acos(Mathf.Clamp01(m_lastGroundNormal.y)) * 57.29578f; + Vector3 lastGroundNormal = m_lastGroundNormal; + lastGroundNormal.y = 0f; + lastGroundNormal.Normalize(); + _ = m_body.velocity; + Vector3 vector = Vector3.Cross(rhs: Vector3.Cross(m_lastGroundNormal, Vector3.up), lhs: m_lastGroundNormal); + bool flag2 = currentVel.magnitude > 0.1f; + if (num > GetSlideAngle()) + { + if (running && flag && flag2) + { + UseStamina(10f * dt); + m_slippage = 0f; + m_wallRunning = true; + } + else + { + m_slippage = Mathf.MoveTowards(m_slippage, 1f, 1f * dt); + } + Vector3 b = vector * 5f; + currentVel = Vector3.Lerp(currentVel, b, m_slippage); + m_sliding = m_slippage > 0.5f; + } + else + { + m_slippage = 0f; + } + } + + private void UpdateMotion(float dt) + { + UpdateBodyFriction(); + m_sliding = false; + m_wallRunning = false; + m_running = false; + if (IsDead()) + { + return; + } + if (IsDebugFlying()) + { + UpdateDebugFly(dt); + return; + } + if (InIntro()) + { + m_maxAirAltitude = base.transform.position.y; + m_body.velocity = Vector3.zero; + m_body.angularVelocity = Vector3.zero; + } + if (!InWaterSwimDepth() && !IsOnGround()) + { + float y = base.transform.position.y; + m_maxAirAltitude = Mathf.Max(m_maxAirAltitude, y); + } + if (IsSwiming()) + { + UpdateSwiming(dt); + } + else if (m_flying) + { + UpdateFlying(dt); + } + else + { + UpdateWalking(dt); + } + m_lastGroundTouch += Time.fixedDeltaTime; + m_jumpTimer += Time.fixedDeltaTime; + } + + private void UpdateDebugFly(float dt) + { + float num = (m_run ? 50 : 20); + Vector3 b = m_moveDir * num; + if (TakeInput()) + { + if (ZInput.GetButton("Jump")) + { + b.y = num; + } + else if (Input.GetKey(KeyCode.LeftControl)) + { + b.y = 0f - num; + } + } + m_currentVel = Vector3.Lerp(m_currentVel, b, 0.5f); + m_body.velocity = m_currentVel; + m_body.useGravity = false; + m_lastGroundTouch = 0f; + m_maxAirAltitude = base.transform.position.y; + m_body.rotation = Quaternion.RotateTowards(base.transform.rotation, m_lookYaw, m_turnSpeed * dt); + m_body.angularVelocity = Vector3.zero; + UpdateEyeRotation(); + } + + private void UpdateSwiming(float dt) + { + bool flag = IsOnGround(); + if (Mathf.Max(0f, m_maxAirAltitude - base.transform.position.y) > 0.5f && m_onLand != null) + { + m_onLand(new Vector3(base.transform.position.x, m_waterLevel, base.transform.position.z)); + } + m_maxAirAltitude = base.transform.position.y; + float speed = m_swimSpeed * GetAttackSpeedFactorMovement(); + if (InMinorAction()) + { + speed = 0f; + } + m_seman.ApplyStatusEffectSpeedMods(ref speed); + Vector3 vector = m_moveDir * speed; + if (vector.magnitude > 0f && IsOnGround()) + { + vector = Vector3.ProjectOnPlane(vector, m_lastGroundNormal).normalized * vector.magnitude; + } + if (IsPlayer()) + { + m_currentVel = Vector3.Lerp(m_currentVel, vector, m_swimAcceleration); + } + else + { + float magnitude = vector.magnitude; + float magnitude2 = m_currentVel.magnitude; + if (magnitude > magnitude2) + { + magnitude = Mathf.MoveTowards(magnitude2, magnitude, m_swimAcceleration); + vector = vector.normalized * magnitude; + } + m_currentVel = Vector3.Lerp(m_currentVel, vector, 0.5f); + } + if (vector.magnitude > 0.1f) + { + AddNoise(15f); + } + AddPushbackForce(ref m_currentVel); + Vector3 force = m_currentVel - m_body.velocity; + force.y = 0f; + if (force.magnitude > 20f) + { + force = force.normalized * 20f; + } + m_body.AddForce(force, ForceMode.VelocityChange); + float num = m_waterLevel - m_swimDepth; + if (base.transform.position.y < num) + { + float t = Mathf.Clamp01((num - base.transform.position.y) / 2f); + float target = Mathf.Lerp(0f, 10f, t); + Vector3 velocity = m_body.velocity; + velocity.y = Mathf.MoveTowards(velocity.y, target, 50f * dt); + m_body.velocity = velocity; + } + else + { + float t2 = Mathf.Clamp01((0f - (num - base.transform.position.y)) / 1f); + float num2 = Mathf.Lerp(0f, 10f, t2); + Vector3 velocity2 = m_body.velocity; + velocity2.y = Mathf.MoveTowards(velocity2.y, 0f - num2, 30f * dt); + m_body.velocity = velocity2; + } + float target2 = 0f; + if (m_moveDir.magnitude > 0.1f || AlwaysRotateCamera()) + { + float speed2 = m_swimTurnSpeed; + m_seman.ApplyStatusEffectSpeedMods(ref speed2); + target2 = UpdateRotation(speed2, dt); + } + m_body.angularVelocity = Vector3.zero; + UpdateEyeRotation(); + m_body.useGravity = true; + float num3 = Vector3.Dot(m_currentVel, base.transform.forward); + float value = Vector3.Dot(m_currentVel, base.transform.right); + float num4 = Vector3.Dot(m_body.velocity, base.transform.forward); + m_currentTurnVel = Mathf.SmoothDamp(m_currentTurnVel, target2, ref m_currentTurnVelChange, 0.5f, 99f); + m_zanim.SetFloat(forward_speed, IsPlayer() ? num3 : num4); + m_zanim.SetFloat(sideway_speed, value); + m_zanim.SetFloat(turn_speed, m_currentTurnVel); + m_zanim.SetBool(inWater, !flag); + m_zanim.SetBool(onGround, value: false); + m_zanim.SetBool(encumbered, value: false); + m_zanim.SetBool(flying, value: false); + if (!flag) + { + OnSwiming(vector, dt); + } + } + + private void UpdateFlying(float dt) + { + float num = (m_run ? m_flyFastSpeed : m_flySlowSpeed) * GetAttackSpeedFactorMovement(); + Vector3 b = (CanMove() ? (m_moveDir * num) : Vector3.zero); + m_currentVel = Vector3.Lerp(m_currentVel, b, m_acceleration); + m_maxAirAltitude = base.transform.position.y; + ApplyRootMotion(ref m_currentVel); + AddPushbackForce(ref m_currentVel); + Vector3 force = m_currentVel - m_body.velocity; + if (force.magnitude > 20f) + { + force = force.normalized * 20f; + } + m_body.AddForce(force, ForceMode.VelocityChange); + float target = 0f; + if ((m_moveDir.magnitude > 0.1f || AlwaysRotateCamera()) && !InDodge() && CanMove()) + { + float speed = m_flyTurnSpeed; + m_seman.ApplyStatusEffectSpeedMods(ref speed); + target = UpdateRotation(speed, dt); + } + m_body.angularVelocity = Vector3.zero; + UpdateEyeRotation(); + m_body.useGravity = false; + float num2 = Vector3.Dot(m_currentVel, base.transform.forward); + float value = Vector3.Dot(m_currentVel, base.transform.right); + float num3 = Vector3.Dot(m_body.velocity, base.transform.forward); + m_currentTurnVel = Mathf.SmoothDamp(m_currentTurnVel, target, ref m_currentTurnVelChange, 0.5f, 99f); + m_zanim.SetFloat(forward_speed, IsPlayer() ? num2 : num3); + m_zanim.SetFloat(sideway_speed, value); + m_zanim.SetFloat(turn_speed, m_currentTurnVel); + m_zanim.SetBool(inWater, value: false); + m_zanim.SetBool(onGround, value: false); + m_zanim.SetBool(encumbered, value: false); + m_zanim.SetBool(flying, value: true); + } + + private void UpdateWalking(float dt) + { + Vector3 moveDir = m_moveDir; + bool flag = IsCrouching(); + m_running = CheckRun(moveDir, dt); + float num = m_speed * GetJogSpeedFactor(); + if ((m_walk || InMinorAction()) && !flag) + { + num = m_walkSpeed; + } + else if (m_running) + { + bool num2 = InWaterDepth() > 0.4f; + float num3 = m_runSpeed * GetRunSpeedFactor(); + num = (num2 ? Mathf.Lerp(num, num3, 0.33f) : num3); + if (IsPlayer() && moveDir.magnitude > 0f) + { + moveDir.Normalize(); + } + } + else if (flag || IsEncumbered()) + { + num = m_crouchSpeed; + } + num *= GetAttackSpeedFactorMovement(); + m_seman.ApplyStatusEffectSpeedMods(ref num); + Vector3 vector = (CanMove() ? (moveDir * num) : Vector3.zero); + if (vector.magnitude > 0f && IsOnGround()) + { + vector = Vector3.ProjectOnPlane(vector, m_lastGroundNormal).normalized * vector.magnitude; + } + float magnitude = vector.magnitude; + float magnitude2 = m_currentVel.magnitude; + if (magnitude > magnitude2) + { + magnitude = Mathf.MoveTowards(magnitude2, magnitude, m_acceleration); + vector = vector.normalized * magnitude; + } + else if (IsPlayer()) + { + magnitude = Mathf.MoveTowards(magnitude2, magnitude, m_acceleration * 2f); + vector = ((vector.magnitude > 0f) ? (vector.normalized * magnitude) : (m_currentVel.normalized * magnitude)); + } + m_currentVel = Vector3.Lerp(m_currentVel, vector, 0.5f); + Vector3 velocity = m_body.velocity; + Vector3 vel = m_currentVel; + vel.y = velocity.y; + if (IsOnGround() && m_lastAttachBody == null) + { + ApplySlide(dt, ref vel, velocity, m_running); + } + ApplyRootMotion(ref vel); + AddPushbackForce(ref vel); + ApplyGroundForce(ref vel, vector); + Vector3 vector2 = vel - velocity; + if (!IsOnGround()) + { + if (vector.magnitude > 0.1f) + { + vector2 *= m_airControl; + } + else + { + vector2 = Vector3.zero; + } + } + if (IsAttached()) + { + vector2 = Vector3.zero; + } + if (IsSneaking()) + { + OnSneaking(dt); + } + if (vector2.magnitude > 20f) + { + vector2 = vector2.normalized * 20f; + } + if (vector2.magnitude > 0.01f) + { + m_body.AddForce(vector2, ForceMode.VelocityChange); + } + if ((bool)m_lastGroundBody && m_lastGroundBody.gameObject.layer != base.gameObject.layer && m_lastGroundBody.mass > m_body.mass) + { + float num4 = m_body.mass / m_lastGroundBody.mass; + m_lastGroundBody.AddForceAtPosition(-vector2 * num4, base.transform.position, ForceMode.VelocityChange); + } + float target = 0f; + if ((moveDir.magnitude > 0.1f || AlwaysRotateCamera()) && !InDodge() && CanMove()) + { + float speed = (m_run ? m_runTurnSpeed : m_turnSpeed); + m_seman.ApplyStatusEffectSpeedMods(ref speed); + target = UpdateRotation(speed, dt); + } + UpdateEyeRotation(); + m_body.useGravity = true; + float num5 = Vector3.Dot(m_currentVel, Vector3.ProjectOnPlane(base.transform.forward, m_lastGroundNormal).normalized); + float value = Vector3.Dot(m_currentVel, Vector3.ProjectOnPlane(base.transform.right, m_lastGroundNormal).normalized); + float num6 = Vector3.Dot(m_body.velocity, base.transform.forward); + m_currentTurnVel = Mathf.SmoothDamp(m_currentTurnVel, target, ref m_currentTurnVelChange, 0.5f, 99f); + m_zanim.SetFloat(forward_speed, IsPlayer() ? num5 : num6); + m_zanim.SetFloat(sideway_speed, value); + m_zanim.SetFloat(turn_speed, m_currentTurnVel); + m_zanim.SetBool(inWater, value: false); + m_zanim.SetBool(onGround, IsOnGround()); + m_zanim.SetBool(encumbered, IsEncumbered()); + m_zanim.SetBool(flying, value: false); + if (m_currentVel.magnitude > 0.1f) + { + if (m_running) + { + AddNoise(30f); + } + else if (!flag) + { + AddNoise(15f); + } + } + } + + public bool IsSneaking() + { + if (IsCrouching() && m_currentVel.magnitude > 0.1f) + { + return IsOnGround(); + } + return false; + } + + private float GetSlopeAngle() + { + if (!IsOnGround()) + { + return 0f; + } + float num = Vector3.SignedAngle(base.transform.forward, m_lastGroundNormal, base.transform.right); + return 0f - (90f - (0f - num)); + } + + protected void AddPushbackForce(ref Vector3 velocity) + { + if (m_pushForce != Vector3.zero) + { + Vector3 normalized = m_pushForce.normalized; + float num = Vector3.Dot(normalized, velocity); + if (num < 10f) + { + velocity += normalized * (10f - num); + } + if (IsSwiming() || m_flying) + { + velocity *= 0.5f; + } + } + } + + private void ApplyPushback(HitData hit) + { + if (hit.m_pushForce != 0f) + { + float num = Mathf.Min(40f, hit.m_pushForce / m_body.mass * 5f); + Vector3 pushForce = hit.m_dir * num; + pushForce.y = 0f; + if (m_pushForce.magnitude < pushForce.magnitude) + { + m_pushForce = pushForce; + } + } + } + + private void UpdatePushback(float dt) + { + m_pushForce = Vector3.MoveTowards(m_pushForce, Vector3.zero, 100f * dt); + } + + private void ApplyGroundForce(ref Vector3 vel, Vector3 targetVel) + { + Vector3 vector = Vector3.zero; + if (IsOnGround() && (bool)m_lastGroundBody) + { + vector = m_lastGroundBody.GetPointVelocity(base.transform.position); + vector.y = 0f; + } + Ship standingOnShip = GetStandingOnShip(); + if (standingOnShip != null) + { + if (targetVel.magnitude > 0.01f) + { + m_lastAttachBody = null; + } + else if (m_lastAttachBody != m_lastGroundBody) + { + m_lastAttachBody = m_lastGroundBody; + m_lastAttachPos = m_lastAttachBody.transform.InverseTransformPoint(m_body.position); + } + if ((bool)m_lastAttachBody) + { + Vector3 vector2 = m_lastAttachBody.transform.TransformPoint(m_lastAttachPos); + Vector3 vector3 = vector2 - m_body.position; + if (vector3.magnitude < 4f) + { + Vector3 position = vector2; + position.y = m_body.position.y; + if (standingOnShip.IsOwner()) + { + vector3.y = 0f; + vector += vector3 * 10f; + } + else + { + m_body.position = position; + } + } + else + { + m_lastAttachBody = null; + } + } + } + else + { + m_lastAttachBody = null; + } + vel += vector; + } + + private float UpdateRotation(float turnSpeed, float dt) + { + Quaternion quaternion = (AlwaysRotateCamera() ? m_lookYaw : Quaternion.LookRotation(m_moveDir)); + float yawDeltaAngle = Utils.GetYawDeltaAngle(base.transform.rotation, quaternion); + float num = 1f; + if (!IsPlayer()) + { + num = Mathf.Clamp01(Mathf.Abs(yawDeltaAngle) / 90f); + num = Mathf.Pow(num, 0.5f); + } + float num2 = turnSpeed * GetAttackSpeedFactorRotation() * num; + Quaternion rotation = Quaternion.RotateTowards(base.transform.rotation, quaternion, num2 * dt); + if (Mathf.Abs(yawDeltaAngle) > 0.001f) + { + base.transform.rotation = rotation; + } + return num2 * Mathf.Sign(yawDeltaAngle) * ((float)Math.PI / 180f); + } + + private void UpdateGroundTilt(float dt) + { + if (m_visual == null) + { + return; + } + if (m_nview.IsOwner()) + { + if (m_groundTilt != 0) + { + if (!IsFlying() && IsOnGround()) + { + Vector3 vector = m_lastGroundNormal; + if (m_groundTilt == GroundTiltType.PitchRaycast || m_groundTilt == GroundTiltType.FullRaycast) + { + Vector3 p = base.transform.position + base.transform.forward * m_collider.radius; + Vector3 p2 = base.transform.position - base.transform.forward * m_collider.radius; + ZoneSystem.instance.GetSolidHeight(p, out var _, out var normal); + ZoneSystem.instance.GetSolidHeight(p2, out var _, out var normal2); + vector = (vector + normal + normal2).normalized; + } + Vector3 target = base.transform.InverseTransformVector(vector); + target = Vector3.RotateTowards(Vector3.up, target, 0.87266463f, 1f); + m_groundTiltNormal = Vector3.Lerp(m_groundTiltNormal, target, 0.05f); + Vector3 vector3; + if (m_groundTilt == GroundTiltType.Pitch || m_groundTilt == GroundTiltType.PitchRaycast) + { + Vector3 vector2 = Vector3.Project(m_groundTiltNormal, Vector3.right); + vector3 = m_groundTiltNormal - vector2; + } + else + { + vector3 = m_groundTiltNormal; + } + Vector3 forward = Vector3.Cross(vector3, Vector3.left); + m_visual.transform.localRotation = Quaternion.LookRotation(forward, vector3); + } + else + { + m_visual.transform.localRotation = Quaternion.RotateTowards(m_visual.transform.localRotation, Quaternion.identity, dt * 200f); + } + m_nview.GetZDO().Set("tiltrot", m_visual.transform.localRotation); + } + else if (CanWallRun()) + { + if (m_wallRunning) + { + Vector3 vector4 = Vector3.Lerp(Vector3.up, m_lastGroundNormal, 0.65f); + Vector3 forward2 = Vector3.ProjectOnPlane(base.transform.forward, vector4); + forward2.Normalize(); + Quaternion to = Quaternion.LookRotation(forward2, vector4); + m_visual.transform.rotation = Quaternion.RotateTowards(m_visual.transform.rotation, to, 30f * dt); + } + else + { + m_visual.transform.localRotation = Quaternion.RotateTowards(m_visual.transform.localRotation, Quaternion.identity, 100f * dt); + } + m_nview.GetZDO().Set("tiltrot", m_visual.transform.localRotation); + } + } + else if (m_groundTilt != 0 || CanWallRun()) + { + Quaternion quaternion = m_nview.GetZDO().GetQuaternion("tiltrot", Quaternion.identity); + m_visual.transform.localRotation = quaternion; + } + } + + public bool IsWallRunning() + { + return m_wallRunning; + } + + private bool IsOnSnow() + { + return false; + } + + public void Heal(float hp, bool showText = true) + { + if (!(hp <= 0f)) + { + if (m_nview.IsOwner()) + { + RPC_Heal(0L, hp, showText); + return; + } + m_nview.InvokeRPC("Heal", hp, showText); + } + } + + private void RPC_Heal(long sender, float hp, bool showText) + { + if (!m_nview.IsOwner()) + { + return; + } + float health = GetHealth(); + if (health <= 0f || IsDead()) + { + return; + } + float num = Mathf.Min(health + hp, GetMaxHealth()); + if (num > health) + { + SetHealth(num); + if (showText) + { + Vector3 topPoint = GetTopPoint(); + DamageText.instance.ShowText(DamageText.TextType.Heal, topPoint, hp, IsPlayer()); + } + } + } + + public Vector3 GetTopPoint() + { + Vector3 center = m_collider.bounds.center; + center.y = m_collider.bounds.max.y; + return center; + } + + public float GetRadius() + { + return m_collider.radius; + } + + public Vector3 GetHeadPoint() + { + return m_head.position; + } + + public Vector3 GetEyePoint() + { + return m_eye.position; + } + + public Vector3 GetCenterPoint() + { + return m_collider.bounds.center; + } + + public DestructibleType GetDestructibleType() + { + return DestructibleType.Character; + } + + public void Damage(HitData hit) + { + if (m_nview.IsValid()) + { + m_nview.InvokeRPC("Damage", hit); + } + } + + private void RPC_Damage(long sender, HitData hit) + { + if (IsDebugFlying() || !m_nview.IsOwner() || GetHealth() <= 0f || IsDead() || IsTeleporting() || InCutscene() || (hit.m_dodgeable && IsDodgeInvincible())) + { + return; + } + Character attacker = hit.GetAttacker(); + if ((hit.HaveAttacker() && attacker == null) || (IsPlayer() && !IsPVPEnabled() && attacker != null && attacker.IsPlayer())) + { + return; + } + if (attacker != null && !attacker.IsPlayer()) + { + float difficultyDamageScale = Game.instance.GetDifficultyDamageScale(base.transform.position); + hit.ApplyModifier(difficultyDamageScale); + } + m_seman.OnDamaged(hit, attacker); + if (m_baseAI != null && !m_baseAI.IsAlerted() && hit.m_backstabBonus > 1f && Time.time - m_backstabTime > 300f) + { + m_backstabTime = Time.time; + hit.ApplyModifier(hit.m_backstabBonus); + m_backstabHitEffects.Create(hit.m_point, Quaternion.identity, base.transform); + } + if (IsStaggering() && !IsPlayer()) + { + hit.ApplyModifier(2f); + m_critHitEffects.Create(hit.m_point, Quaternion.identity, base.transform); + } + if (hit.m_blockable && IsBlocking()) + { + BlockAttack(hit, attacker); + } + ApplyPushback(hit); + if (!string.IsNullOrEmpty(hit.m_statusEffect)) + { + StatusEffect statusEffect = m_seman.GetStatusEffect(hit.m_statusEffect); + if (statusEffect == null) + { + statusEffect = m_seman.AddStatusEffect(hit.m_statusEffect); + } + if (statusEffect != null && attacker != null) + { + statusEffect.SetAttacker(attacker); + } + } + HitData.DamageModifiers damageModifiers = GetDamageModifiers(); + hit.ApplyResistance(damageModifiers, out var significantModifier); + if (IsPlayer()) + { + float bodyArmor = GetBodyArmor(); + hit.ApplyArmor(bodyArmor); + DamageArmorDurability(hit); + } + float poison = hit.m_damage.m_poison; + float fire = hit.m_damage.m_fire; + float spirit = hit.m_damage.m_spirit; + hit.m_damage.m_poison = 0f; + hit.m_damage.m_fire = 0f; + hit.m_damage.m_spirit = 0f; + ApplyDamage(hit, showDamageText: true, triggerEffects: true, significantModifier); + AddFireDamage(fire); + AddSpiritDamage(spirit); + AddPoisonDamage(poison); + AddFrostDamage(hit.m_damage.m_frost); + AddLightningDamage(hit.m_damage.m_lightning); + } + + protected HitData.DamageModifier GetDamageModifier(HitData.DamageType damageType) + { + return GetDamageModifiers().GetModifier(damageType); + } + + protected HitData.DamageModifiers GetDamageModifiers() + { + HitData.DamageModifiers mods = m_damageModifiers.Clone(); + ApplyArmorDamageMods(ref mods); + m_seman.ApplyDamageMods(ref mods); + return mods; + } + + public void ApplyDamage(HitData hit, bool showDamageText, bool triggerEffects, HitData.DamageModifier mod = HitData.DamageModifier.Normal) + { + if (IsDebugFlying() || IsDead() || IsTeleporting() || InCutscene()) + { + return; + } + float totalDamage = hit.GetTotalDamage(); + if (showDamageText && (totalDamage > 0f || !IsPlayer())) + { + DamageText.instance.ShowText(mod, hit.m_point, totalDamage, IsPlayer()); + } + if (!(totalDamage <= 0f)) + { + if (!InGodMode() && !InGhostMode()) + { + float health = GetHealth(); + health -= totalDamage; + SetHealth(health); + } + AddStaggerDamage(totalDamage * hit.m_staggerMultiplier, hit.m_dir); + if (triggerEffects && totalDamage > 2f) + { + DoDamageCameraShake(hit); + m_hitEffects.Create(hit.m_point, Quaternion.identity, base.transform); + } + OnDamaged(hit); + if (m_onDamaged != null) + { + m_onDamaged(totalDamage, hit.GetAttacker()); + } + if (m_dpsDebugEnabled) + { + AddDPS(totalDamage, this); + } + } + } + + protected virtual void DoDamageCameraShake(HitData hit) + { + } + + protected virtual void DamageArmorDurability(HitData hit) + { + } + + private void AddFireDamage(float damage) + { + if (!(damage <= 0f)) + { + SE_Burning sE_Burning = m_seman.GetStatusEffect("Burning") as SE_Burning; + if (sE_Burning == null) + { + sE_Burning = m_seman.AddStatusEffect("Burning") as SE_Burning; + } + sE_Burning.AddFireDamage(damage); + } + } + + private void AddSpiritDamage(float damage) + { + if (!(damage <= 0f)) + { + SE_Burning sE_Burning = m_seman.GetStatusEffect("Spirit") as SE_Burning; + if (sE_Burning == null) + { + sE_Burning = m_seman.AddStatusEffect("Spirit") as SE_Burning; + } + sE_Burning.AddSpiritDamage(damage); + } + } + + private void AddPoisonDamage(float damage) + { + if (!(damage <= 0f)) + { + SE_Poison sE_Poison = m_seman.GetStatusEffect("Poison") as SE_Poison; + if (sE_Poison == null) + { + sE_Poison = m_seman.AddStatusEffect("Poison") as SE_Poison; + } + sE_Poison.AddDamage(damage); + } + } + + private void AddFrostDamage(float damage) + { + if (!(damage <= 0f)) + { + SE_Frost sE_Frost = m_seman.GetStatusEffect("Frost") as SE_Frost; + if (sE_Frost == null) + { + sE_Frost = m_seman.AddStatusEffect("Frost") as SE_Frost; + } + sE_Frost.AddDamage(damage); + } + } + + private void AddLightningDamage(float damage) + { + if (!(damage <= 0f)) + { + m_seman.AddStatusEffect("Lightning", resetTime: true); + } + } + + private void AddStaggerDamage(float damage, Vector3 forceDirection) + { + if (!(m_staggerDamageFactor <= 0f) || IsPlayer()) + { + m_staggerDamage += damage; + m_staggerTimer = 0f; + float maxHealth = GetMaxHealth(); + float num = (IsPlayer() ? (maxHealth / 2f) : (maxHealth * m_staggerDamageFactor)); + if (m_staggerDamage >= num) + { + m_staggerDamage = 0f; + Stagger(forceDirection); + } + } + } + + private static void AddDPS(float damage, Character me) + { + if (me == Player.m_localPlayer) + { + CalculateDPS("To-you ", m_playerDamage, damage); + } + else + { + CalculateDPS("To-others ", m_enemyDamage, damage); + } + } + + private static void CalculateDPS(string name, List> damages, float damage) + { + float time = Time.time; + if (damages.Count > 0 && Time.time - damages[damages.Count - 1].Key > 5f) + { + damages.Clear(); + } + damages.Add(new KeyValuePair(time, damage)); + float num = Time.time - damages[0].Key; + if (num < 0.01f) + { + return; + } + float num2 = 0f; + foreach (KeyValuePair damage2 in damages) + { + num2 += damage2.Value; + } + float num3 = num2 / num; + string text = "DPS " + name + " (" + damages.Count + " attacks): " + num3.ToString("0.0"); + ZLog.Log(text); + MessageHud.instance.ShowMessage(MessageHud.MessageType.Center, text); + } + + private void UpdateStagger(float dt) + { + if (!(m_staggerDamageFactor <= 0f) || IsPlayer()) + { + m_staggerTimer += dt; + if (m_staggerTimer > 3f) + { + m_staggerDamage = 0f; + } + } + } + + public void Stagger(Vector3 forceDirection) + { + if (m_nview.IsOwner()) + { + RPC_Stagger(0L, forceDirection); + return; + } + m_nview.InvokeRPC("Stagger", forceDirection); + } + + private void RPC_Stagger(long sender, Vector3 forceDirection) + { + if (!IsStaggering()) + { + if (forceDirection.magnitude > 0.01f) + { + forceDirection.y = 0f; + base.transform.rotation = Quaternion.LookRotation(-forceDirection); + } + m_zanim.SetTrigger("stagger"); + } + } + + protected virtual void ApplyArmorDamageMods(ref HitData.DamageModifiers mods) + { + } + + public virtual float GetBodyArmor() + { + return 0f; + } + + protected virtual bool BlockAttack(HitData hit, Character attacker) + { + return false; + } + + protected virtual void OnDamaged(HitData hit) + { + } + + private void OnCollisionStay(Collision collision) + { + if (!m_nview.IsValid() || !m_nview.IsOwner() || m_jumpTimer < 0.1f) + { + return; + } + ContactPoint[] contacts = collision.contacts; + for (int i = 0; i < contacts.Length; i++) + { + ContactPoint contactPoint = contacts[i]; + float num = contactPoint.point.y - base.transform.position.y; + if (!(contactPoint.normal.y > 0.1f) || !(num < m_collider.radius)) + { + continue; + } + if (contactPoint.normal.y > m_groundContactNormal.y || !m_groundContact) + { + m_groundContact = true; + m_groundContactNormal = contactPoint.normal; + m_groundContactPoint = contactPoint.point; + m_lowestContactCollider = collision.collider; + continue; + } + Vector3 groundContactNormal = Vector3.Normalize(m_groundContactNormal + contactPoint.normal); + if (groundContactNormal.y > m_groundContactNormal.y) + { + m_groundContactNormal = groundContactNormal; + m_groundContactPoint = (m_groundContactPoint + contactPoint.point) * 0.5f; + } + } + } + + private void UpdateGroundContact(float dt) + { + if (!m_groundContact) + { + return; + } + m_lastGroundCollider = m_lowestContactCollider; + m_lastGroundNormal = m_groundContactNormal; + m_lastGroundPoint = m_groundContactPoint; + m_lastGroundBody = (m_lastGroundCollider ? m_lastGroundCollider.attachedRigidbody : null); + if (!IsPlayer() && m_lastGroundBody != null && m_lastGroundBody.gameObject.layer == base.gameObject.layer) + { + m_lastGroundCollider = null; + m_lastGroundBody = null; + } + float num = Mathf.Max(0f, m_maxAirAltitude - base.transform.position.y); + if (num > 0.8f) + { + if (m_onLand != null) + { + Vector3 lastGroundPoint = m_lastGroundPoint; + if (InWater()) + { + lastGroundPoint.y = m_waterLevel; + } + m_onLand(m_lastGroundPoint); + } + ResetCloth(); + } + if (IsPlayer() && num > 4f) + { + HitData hitData = new HitData(); + hitData.m_damage.m_damage = Mathf.Clamp01((num - 4f) / 16f) * 100f; + hitData.m_point = m_lastGroundPoint; + hitData.m_dir = m_lastGroundNormal; + Damage(hitData); + } + ResetGroundContact(); + m_lastGroundTouch = 0f; + m_maxAirAltitude = base.transform.position.y; + } + + private void ResetGroundContact() + { + m_lowestContactCollider = null; + m_groundContact = false; + m_groundContactNormal = Vector3.zero; + m_groundContactPoint = Vector3.zero; + } + + public Ship GetStandingOnShip() + { + if (!IsOnGround()) + { + return null; + } + if ((bool)m_lastGroundBody) + { + return m_lastGroundBody.GetComponent(); + } + return null; + } + + public bool IsOnGround() + { + if (!(m_lastGroundTouch < 0.2f)) + { + return m_body.IsSleeping(); + } + return true; + } + + private void CheckDeath() + { + if (!IsDead() && GetHealth() <= 0f) + { + OnDeath(); + if (m_onDeath != null) + { + m_onDeath(); + } + } + } + + protected virtual void OnRagdollCreated(Ragdoll ragdoll) + { + } + + protected virtual void OnDeath() + { + GameObject[] array = m_deathEffects.Create(base.transform.position, base.transform.rotation, base.transform); + for (int i = 0; i < array.Length; i++) + { + Ragdoll component = array[i].GetComponent(); + if ((bool)component) + { + CharacterDrop component2 = GetComponent(); + LevelEffects componentInChildren = GetComponentInChildren(); + Vector3 velocity = m_body.velocity; + if (m_pushForce.magnitude * 0.5f > velocity.magnitude) + { + velocity = m_pushForce * 0.5f; + } + float hue = 0f; + float saturation = 0f; + float value = 0f; + if ((bool)componentInChildren) + { + componentInChildren.GetColorChanges(out hue, out saturation, out value); + } + component.Setup(velocity, hue, saturation, value, component2); + OnRagdollCreated(component); + if ((bool)component2) + { + component2.SetDropsEnabled(enabled: false); + } + } + } + if (!string.IsNullOrEmpty(m_defeatSetGlobalKey)) + { + ZoneSystem.instance.SetGlobalKey(m_defeatSetGlobalKey); + } + ZNetScene.instance.Destroy(base.gameObject); + GoogleAnalyticsV4.instance.LogEvent("Game", "Killed", m_name, 0L); + } + + public float GetHealth() + { + return m_nview.GetZDO()?.GetFloat("health", GetMaxHealth()) ?? GetMaxHealth(); + } + + public void SetHealth(float health) + { + ZDO zDO = m_nview.GetZDO(); + if (zDO != null && m_nview.IsOwner()) + { + if (health < 0f) + { + health = 0f; + } + zDO.Set("health", health); + } + } + + public float GetHealthPercentage() + { + return GetHealth() / GetMaxHealth(); + } + + public virtual bool IsDead() + { + return false; + } + + public void SetMaxHealth(float health) + { + if (m_nview.GetZDO() != null) + { + m_nview.GetZDO().Set("max_health", health); + } + if (GetHealth() > health) + { + SetHealth(health); + } + } + + public float GetMaxHealth() + { + if (m_nview.GetZDO() != null) + { + return m_nview.GetZDO().GetFloat("max_health", m_health); + } + return m_health; + } + + public virtual float GetMaxStamina() + { + return 0f; + } + + public virtual float GetStaminaPercentage() + { + return 1f; + } + + public bool IsBoss() + { + return m_boss; + } + + public void SetLookDir(Vector3 dir) + { + if (dir.magnitude <= Mathf.Epsilon) + { + dir = base.transform.forward; + } + else + { + dir.Normalize(); + } + m_lookDir = dir; + dir.y = 0f; + m_lookYaw = Quaternion.LookRotation(dir); + } + + public Vector3 GetLookDir() + { + return m_eye.forward; + } + + public virtual void OnAttackTrigger() + { + } + + public virtual void OnStopMoving() + { + } + + public virtual void OnWeaponTrailStart() + { + } + + public void SetMoveDir(Vector3 dir) + { + m_moveDir = dir; + } + + public void SetRun(bool run) + { + m_run = run; + } + + public void SetWalk(bool walk) + { + m_walk = walk; + } + + public bool GetWalk() + { + return m_walk; + } + + protected virtual void UpdateEyeRotation() + { + m_eye.rotation = Quaternion.LookRotation(m_lookDir); + } + + public void OnAutoJump(Vector3 dir, float upVel, float forwardVel) + { + if (m_nview.IsValid() && m_nview.IsOwner() && IsOnGround() && !IsDead() && !InAttack() && !InDodge() && !IsKnockedBack() && !(Time.time - m_lastAutoJumpTime < 0.5f)) + { + m_lastAutoJumpTime = Time.time; + if (!(Vector3.Dot(m_moveDir, dir) < 0.5f)) + { + Vector3 zero = Vector3.zero; + zero.y = upVel; + zero += dir * forwardVel; + m_body.velocity = zero; + m_lastGroundTouch = 1f; + m_jumpTimer = 0f; + m_jumpEffects.Create(base.transform.position, base.transform.rotation, base.transform); + SetCrouch(crouch: false); + UpdateBodyFriction(); + } + } + } + + public void Jump() + { + if (!IsOnGround() || IsDead() || InAttack() || IsEncumbered() || InDodge() || IsKnockedBack()) + { + return; + } + bool flag = false; + if (!HaveStamina(m_jumpStaminaUsage)) + { + if (IsPlayer()) + { + Hud.instance.StaminaBarNoStaminaFlash(); + } + flag = true; + } + float num = 0f; + Skills skills = GetSkills(); + if (skills != null) + { + num = skills.GetSkillFactor(Skills.SkillType.Jump); + if (!flag) + { + RaiseSkill(Skills.SkillType.Jump); + } + } + Vector3 velocity = m_body.velocity; + Mathf.Acos(Mathf.Clamp01(m_lastGroundNormal.y)); + Vector3 normalized = (m_lastGroundNormal + Vector3.up).normalized; + float num2 = 1f + num * 0.4f; + float num3 = m_jumpForce * num2; + float num4 = Vector3.Dot(normalized, velocity); + if (num4 < num3) + { + velocity += normalized * (num3 - num4); + } + velocity += m_moveDir * m_jumpForceForward * num2; + if (flag) + { + velocity *= m_jumpForceTiredFactor; + } + m_body.WakeUp(); + m_body.velocity = velocity; + ResetGroundContact(); + m_lastGroundTouch = 1f; + m_jumpTimer = 0f; + m_zanim.SetTrigger("jump"); + AddNoise(30f); + m_jumpEffects.Create(base.transform.position, base.transform.rotation, base.transform); + OnJump(); + SetCrouch(crouch: false); + UpdateBodyFriction(); + } + + private void UpdateBodyFriction() + { + m_collider.material.frictionCombine = PhysicMaterialCombine.Multiply; + if (IsDead()) + { + m_collider.material.staticFriction = 1f; + m_collider.material.dynamicFriction = 1f; + m_collider.material.frictionCombine = PhysicMaterialCombine.Maximum; + } + else if (IsSwiming()) + { + m_collider.material.staticFriction = 0.2f; + m_collider.material.dynamicFriction = 0.2f; + } + else if (!IsOnGround()) + { + m_collider.material.staticFriction = 0f; + m_collider.material.dynamicFriction = 0f; + } + else if (IsFlying()) + { + m_collider.material.staticFriction = 0f; + m_collider.material.dynamicFriction = 0f; + } + else if (m_moveDir.magnitude < 0.1f) + { + m_collider.material.staticFriction = 0.8f * (1f - m_slippage); + m_collider.material.dynamicFriction = 0.8f * (1f - m_slippage); + m_collider.material.frictionCombine = PhysicMaterialCombine.Maximum; + } + else + { + m_collider.material.staticFriction = 0.4f * (1f - m_slippage); + m_collider.material.dynamicFriction = 0.4f * (1f - m_slippage); + } + } + + public virtual bool StartAttack(Character target, bool charge) + { + return false; + } + + public virtual void OnNearFire(Vector3 point) + { + } + + public ZDOID GetZDOID() + { + if (m_nview.IsValid()) + { + return m_nview.GetZDO().m_uid; + } + return ZDOID.None; + } + + public bool IsOwner() + { + if (m_nview.IsValid()) + { + return m_nview.IsOwner(); + } + return false; + } + + public long GetOwner() + { + if (m_nview.IsValid()) + { + return m_nview.GetZDO().m_owner; + } + return 0L; + } + + public virtual bool UseMeleeCamera() + { + return false; + } + + public virtual bool AlwaysRotateCamera() + { + return true; + } + + public void SetInWater(float depth) + { + m_waterLevel = depth; + } + + public virtual bool IsPVPEnabled() + { + return false; + } + + public virtual bool InIntro() + { + return false; + } + + public virtual bool InCutscene() + { + return false; + } + + public virtual bool IsCrouching() + { + return false; + } + + public virtual bool InBed() + { + return false; + } + + public virtual bool IsAttached() + { + return false; + } + + protected virtual void SetCrouch(bool crouch) + { + } + + public virtual void AttachStart(Transform attachPoint, bool hideWeapons, bool isBed, string attachAnimation, Vector3 detachOffset) + { + } + + public virtual void AttachStop() + { + } + + private void UpdateWater(float dt) + { + m_swimTimer += dt; + if (InWaterSwimDepth()) + { + if (m_nview.IsOwner()) + { + m_seman.AddStatusEffect("Wet", resetTime: true); + } + if (m_canSwim) + { + m_swimTimer = 0f; + } + } + } + + public bool IsSwiming() + { + return m_swimTimer < 0.5f; + } + + public bool InWaterSwimDepth() + { + return InWaterDepth() > Mathf.Max(0f, m_swimDepth - 0.4f); + } + + private float InWaterDepth() + { + if (GetStandingOnShip() != null) + { + return 0f; + } + return Mathf.Max(0f, m_waterLevel - base.transform.position.y); + } + + public bool InWater() + { + return InWaterDepth() > 0f; + } + + protected virtual bool CheckRun(Vector3 moveDir, float dt) + { + if (!m_run) + { + return false; + } + if (moveDir.magnitude < 0.1f) + { + return false; + } + if (IsCrouching() || IsEncumbered()) + { + return false; + } + if (InDodge()) + { + return false; + } + return true; + } + + public bool IsRunning() + { + return m_running; + } + + public virtual bool InPlaceMode() + { + return false; + } + + public virtual bool HaveStamina(float amount = 0f) + { + return true; + } + + public virtual void AddStamina(float v) + { + } + + public virtual void UseStamina(float stamina) + { + } + + public bool IsStaggering() + { + return m_animator.GetCurrentAnimatorStateInfo(0).tagHash == m_animatorTagStagger; + } + + public virtual bool CanMove() + { + AnimatorStateInfo animatorStateInfo = (m_animator.IsInTransition(0) ? m_animator.GetNextAnimatorStateInfo(0) : m_animator.GetCurrentAnimatorStateInfo(0)); + if (animatorStateInfo.tagHash == m_animatorTagFreeze || animatorStateInfo.tagHash == m_animatorTagStagger || animatorStateInfo.tagHash == m_animatorTagSitting) + { + return false; + } + return true; + } + + public virtual bool IsEncumbered() + { + return false; + } + + public virtual bool IsTeleporting() + { + return false; + } + + private bool CanWallRun() + { + return IsPlayer(); + } + + public void ShowPickupMessage(ItemDrop.ItemData item, int amount) + { + Message(MessageHud.MessageType.TopLeft, "$msg_added " + item.m_shared.m_name, amount, item.GetIcon()); + } + + public void ShowRemovedMessage(ItemDrop.ItemData item, int amount) + { + Message(MessageHud.MessageType.TopLeft, "$msg_removed " + item.m_shared.m_name, amount, item.GetIcon()); + } + + public virtual void Message(MessageHud.MessageType type, string msg, int amount = 0, Sprite icon = null) + { + } + + public CapsuleCollider GetCollider() + { + return m_collider; + } + + public virtual void OnStealthSuccess(Character character, float factor) + { + } + + public virtual float GetStealthFactor() + { + return 1f; + } + + private void UpdateNoise(float dt) + { + m_noiseRange = Mathf.Max(0f, m_noiseRange - dt * 4f); + m_syncNoiseTimer += dt; + if (m_syncNoiseTimer > 0.5f) + { + m_syncNoiseTimer = 0f; + m_nview.GetZDO().Set("noise", m_noiseRange); + } + } + + public void AddNoise(float range) + { + if (m_nview.IsValid()) + { + if (m_nview.IsOwner()) + { + RPC_AddNoise(0L, range); + return; + } + m_nview.InvokeRPC("AddNoise", range); + } + } + + private void RPC_AddNoise(long sender, float range) + { + if (m_nview.IsOwner() && range > m_noiseRange) + { + m_noiseRange = range; + m_seman.ModifyNoise(m_noiseRange, ref m_noiseRange); + } + } + + public float GetNoiseRange() + { + if (!m_nview.IsValid()) + { + return 0f; + } + if (m_nview.IsOwner()) + { + return m_noiseRange; + } + return m_nview.GetZDO().GetFloat("noise"); + } + + public virtual bool InGodMode() + { + return false; + } + + public virtual bool InGhostMode() + { + return false; + } + + public virtual bool IsDebugFlying() + { + return false; + } + + public virtual string GetHoverText() + { + Tameable component = GetComponent(); + if ((bool)component) + { + return component.GetHoverText(); + } + return ""; + } + + public virtual string GetHoverName() + { + return Localization.instance.Localize(m_name); + } + + public virtual bool IsHoldingAttack() + { + return false; + } + + public virtual bool InAttack() + { + return false; + } + + protected virtual void StopEmote() + { + } + + public virtual bool InMinorAction() + { + return false; + } + + public virtual bool InDodge() + { + return false; + } + + public virtual bool IsDodgeInvincible() + { + return false; + } + + public virtual bool InEmote() + { + return false; + } + + public virtual bool IsBlocking() + { + return false; + } + + public bool IsFlying() + { + return m_flying; + } + + public bool IsKnockedBack() + { + return m_pushForce != Vector3.zero; + } + + private void OnDrawGizmosSelected() + { + if (m_nview != null && m_nview.GetZDO() != null) + { + float @float = m_nview.GetZDO().GetFloat("noise"); + Gizmos.DrawWireSphere(base.transform.position, @float); + } + Gizmos.color = Color.blue; + Gizmos.DrawWireCube(base.transform.position + Vector3.up * m_swimDepth, new Vector3(1f, 0.05f, 1f)); + if (IsOnGround()) + { + Gizmos.color = Color.green; + Gizmos.DrawLine(m_lastGroundPoint, m_lastGroundPoint + m_lastGroundNormal); + } + } + + public virtual bool TeleportTo(Vector3 pos, Quaternion rot, bool distantTeleport) + { + return false; + } + + private void SyncVelocity() + { + m_nview.GetZDO().Set("BodyVelocity", m_body.velocity); + } + + public Vector3 GetVelocity() + { + if (!m_nview.IsValid()) + { + return Vector3.zero; + } + if (m_nview.IsOwner()) + { + return m_body.velocity; + } + return m_nview.GetZDO().GetVec3("BodyVelocity", Vector3.zero); + } + + public void AddRootMotion(Vector3 vel) + { + if (InDodge() || InAttack() || InEmote()) + { + m_rootMotion += vel; + } + } + + private void ApplyRootMotion(ref Vector3 vel) + { + Vector3 vector = m_rootMotion * 55f; + if (vector.magnitude > vel.magnitude) + { + vel = vector; + } + m_rootMotion = Vector3.zero; + } + + public static void GetCharactersInRange(Vector3 point, float radius, List characters) + { + foreach (Character character in m_characters) + { + if (Vector3.Distance(character.transform.position, point) < radius) + { + characters.Add(character); + } + } + } + + public static List GetAllCharacters() + { + return m_characters; + } + + public static bool IsCharacterInRange(Vector3 point, float range) + { + foreach (Character character in m_characters) + { + if (Vector3.Distance(character.transform.position, point) < range) + { + return true; + } + } + return false; + } + + public virtual void OnTargeted(bool sensed, bool alerted) + { + } + + public GameObject GetVisual() + { + return m_visual; + } + + protected void UpdateLodgroup() + { + if (!(m_lodGroup == null)) + { + Renderer[] componentsInChildren = m_visual.GetComponentsInChildren(); + LOD[] lODs = m_lodGroup.GetLODs(); + lODs[0].renderers = componentsInChildren; + m_lodGroup.SetLODs(lODs); + } + } + + public virtual float GetEquipmentMovementModifier() + { + return 0f; + } + + protected virtual float GetJogSpeedFactor() + { + return 1f; + } + + protected virtual float GetRunSpeedFactor() + { + return 1f; + } + + protected virtual float GetAttackSpeedFactorMovement() + { + return 1f; + } + + protected virtual float GetAttackSpeedFactorRotation() + { + return 1f; + } + + public virtual void RaiseSkill(Skills.SkillType skill, float value = 1f) + { + } + + public virtual Skills GetSkills() + { + return null; + } + + public virtual float GetSkillFactor(Skills.SkillType skill) + { + return 0f; + } + + public virtual float GetRandomSkillFactor(Skills.SkillType skill) + { + return UnityEngine.Random.Range(0.75f, 1f); + } + + public bool IsMonsterFaction() + { + if (IsTamed()) + { + return false; + } + if (m_faction != Faction.ForestMonsters && m_faction != Faction.Undead && m_faction != Faction.Demon && m_faction != Faction.PlainsMonsters && m_faction != Faction.MountainMonsters) + { + return m_faction == Faction.SeaMonsters; + } + return true; + } + + public Transform GetTransform() + { + if (this == null) + { + return null; + } + return base.transform; + } + + public Collider GetLastGroundCollider() + { + return m_lastGroundCollider; + } + + public Vector3 GetLastGroundNormal() + { + return m_groundContactNormal; + } + + public void ResetCloth() + { + m_nview.InvokeRPC(ZNetView.Everybody, "ResetCloth"); + } + + private void RPC_ResetCloth(long sender) + { + Cloth[] componentsInChildren = GetComponentsInChildren(); + foreach (Cloth cloth in componentsInChildren) + { + if (cloth.enabled) + { + cloth.enabled = false; + cloth.enabled = true; + } + } + } + + public virtual bool GetRelativePosition(out ZDOID parent, out Vector3 relativePos, out Vector3 relativeVel) + { + relativeVel = Vector3.zero; + if (IsOnGround() && (bool)m_lastGroundBody) + { + ZNetView component = m_lastGroundBody.GetComponent(); + if ((bool)component && component.IsValid()) + { + parent = component.GetZDO().m_uid; + relativePos = component.transform.InverseTransformPoint(base.transform.position); + relativeVel = component.transform.InverseTransformVector(m_body.velocity - m_lastGroundBody.velocity); + return true; + } + } + parent = ZDOID.None; + relativePos = Vector3.zero; + return false; + } + + public Quaternion GetLookYaw() + { + return m_lookYaw; + } + + public Vector3 GetMoveDir() + { + return m_moveDir; + } + + public BaseAI GetBaseAI() + { + return m_baseAI; + } + + public float GetMass() + { + return m_body.mass; + } + + protected void SetVisible(bool visible) + { + if (!(m_lodGroup == null) && m_lodVisible != visible) + { + m_lodVisible = visible; + if (m_lodVisible) + { + m_lodGroup.localReferencePoint = m_originalLocalRef; + } + else + { + m_lodGroup.localReferencePoint = new Vector3(999999f, 999999f, 999999f); + } + } + } + + public void SetTamed(bool tamed) + { + if (m_nview.IsValid() && m_tamed != tamed) + { + m_nview.InvokeRPC("SetTamed", tamed); + } + } + + private void RPC_SetTamed(long sender, bool tamed) + { + if (m_nview.IsOwner() && m_tamed != tamed) + { + m_tamed = tamed; + m_nview.GetZDO().Set("tamed", m_tamed); + } + } + + public bool IsTamed() + { + if (!m_nview.IsValid()) + { + return false; + } + if (!m_nview.IsOwner() && Time.time - m_lastTamedCheck > 1f) + { + m_lastTamedCheck = Time.time; + m_tamed = m_nview.GetZDO().GetBool("tamed", m_tamed); + } + return m_tamed; + } + + public SEMan GetSEMan() + { + return m_seman; + } + + public bool InInterior() + { + return base.transform.position.y > 3000f; + } + + public static void SetDPSDebug(bool enabled) + { + m_dpsDebugEnabled = enabled; + } + + public static bool IsDPSDebugEnabled() + { + return m_dpsDebugEnabled; + } +} diff --git a/Valheim_r202102_v0.141.2/Valheim/assembly_valheim/CharacterAnimEvent.cs b/Valheim_r202102_v0.141.2/Valheim/assembly_valheim/CharacterAnimEvent.cs new file mode 100644 index 0000000..8f0db87 --- /dev/null +++ b/Valheim_r202102_v0.141.2/Valheim/assembly_valheim/CharacterAnimEvent.cs @@ -0,0 +1,525 @@ +using System; +using System.Collections.Generic; +using UnityEngine; + +public class CharacterAnimEvent : MonoBehaviour +{ + [Serializable] + public class Foot + { + public Transform m_transform; + + public AvatarIKGoal m_ikHandle; + + public float m_footDownMax = 0.4f; + + public float m_footOffset = 0.1f; + + public float m_footStepHeight = 1f; + + public float m_stabalizeDistance; + + [NonSerialized] + public float m_ikWeight; + + [NonSerialized] + public Vector3 m_plantPosition = Vector3.zero; + + [NonSerialized] + public Vector3 m_plantNormal = Vector3.up; + + [NonSerialized] + public bool m_isPlanted; + + public Foot(Transform t, AvatarIKGoal handle) + { + m_transform = t; + m_ikHandle = handle; + m_ikWeight = 0f; + } + } + + [Header("Foot IK")] + public bool m_footIK; + + public float m_footDownMax = 0.4f; + + public float m_footOffset = 0.1f; + + public float m_footStepHeight = 1f; + + public float m_stabalizeDistance; + + public bool m_useFeetValues; + + public Foot[] m_feets = new Foot[0]; + + [Header("Head/eye rotation")] + public bool m_headRotation = true; + + public Transform[] m_eyes; + + public float m_lookWeight = 0.5f; + + public float m_bodyLookWeight = 0.1f; + + public float m_headLookWeight = 1f; + + public float m_eyeLookWeight; + + public float m_lookClamp = 0.5f; + + private const float m_headRotationSmoothness = 0.1f; + + public Transform m_lookAt; + + [Header("Player Female hack")] + public bool m_femaleHack; + + public Transform m_leftShoulder; + + public Transform m_rightShoulder; + + public float m_femaleOffset = 0.0004f; + + public float m_maleOffset = 0.0007651657f; + + private Character m_character; + + private Animator m_animator; + + private ZNetView m_nview; + + private MonsterAI m_monsterAI; + + private VisEquipment m_visEquipment; + + private FootStep m_footStep; + + private int m_chainID; + + private float m_pauseTimer; + + private float m_pauseSpeed = 1f; + + private float m_sendTimer; + + private Vector3 m_headLookDir; + + private float m_lookAtWeight; + + private Transform m_head; + + private bool m_chain; + + private static int m_ikGroundMask; + + private void Awake() + { + m_character = GetComponentInParent(); + m_nview = m_character.GetComponent(); + m_animator = GetComponent(); + m_monsterAI = m_character.GetComponent(); + m_visEquipment = m_character.GetComponent(); + m_footStep = m_character.GetComponent(); + m_head = m_animator.GetBoneTransform(HumanBodyBones.Head); + m_chainID = Animator.StringToHash("chain"); + m_headLookDir = m_character.transform.forward; + if (m_ikGroundMask == 0) + { + m_ikGroundMask = LayerMask.GetMask("Default", "static_solid", "Default_small", "piece", "terrain", "vehicle"); + } + } + + private void OnAnimatorMove() + { + if (m_nview.IsValid() && m_nview.IsOwner()) + { + m_character.AddRootMotion(m_animator.deltaPosition); + } + } + + private void FixedUpdate() + { + if (m_character == null || !m_nview.IsValid()) + { + return; + } + if (!m_character.InAttack() && !m_character.InMinorAction() && !m_character.InEmote() && m_character.CanMove()) + { + m_animator.speed = 1f; + } + if (m_pauseTimer > 0f) + { + m_pauseTimer -= Time.fixedDeltaTime; + if (m_pauseTimer <= 0f) + { + m_animator.speed = m_pauseSpeed; + } + } + } + + public bool CanChain() + { + return m_chain; + } + + public void FreezeFrame(float delay) + { + if (delay <= 0f) + { + return; + } + if (m_pauseTimer > 0f) + { + m_pauseTimer = delay; + return; + } + m_pauseTimer = delay; + m_pauseSpeed = m_animator.speed; + m_animator.speed = 0.0001f; + if (m_pauseSpeed <= 0.01f) + { + m_pauseSpeed = 1f; + } + } + + public void Speed(float speedScale) + { + m_animator.speed = speedScale; + } + + public void Chain() + { + m_chain = true; + } + + public void ResetChain() + { + m_chain = false; + } + + public void FootStep(AnimationEvent e) + { + if (!((double)e.animatorClipInfo.weight < 0.33) && (bool)m_footStep) + { + if (e.stringParameter.Length > 0) + { + m_footStep.OnFoot(e.stringParameter); + } + else + { + m_footStep.OnFoot(); + } + } + } + + public void Hit() + { + m_character.OnAttackTrigger(); + } + + public void OnAttackTrigger() + { + m_character.OnAttackTrigger(); + } + + public void Stop(AnimationEvent e) + { + m_character.OnStopMoving(); + } + + public void DodgeMortal() + { + Player player = m_character as Player; + if ((bool)player) + { + player.OnDodgeMortal(); + } + } + + public void TrailOn() + { + if ((bool)m_visEquipment) + { + m_visEquipment.SetWeaponTrails(enabled: true); + } + m_character.OnWeaponTrailStart(); + } + + public void TrailOff() + { + if ((bool)m_visEquipment) + { + m_visEquipment.SetWeaponTrails(enabled: false); + } + } + + public void GPower() + { + Player player = m_character as Player; + if ((bool)player) + { + player.ActivateGuardianPower(); + } + } + + private void OnAnimatorIK(int layerIndex) + { + if (m_nview.IsValid()) + { + UpdateLookat(); + UpdateFootIK(); + } + } + + private void LateUpdate() + { + UpdateHeadRotation(Time.deltaTime); + if (m_femaleHack) + { + _ = m_character; + float num = ((m_visEquipment.GetModelIndex() == 1) ? m_femaleOffset : m_maleOffset); + Vector3 localPosition = m_leftShoulder.localPosition; + localPosition.x = 0f - num; + m_leftShoulder.localPosition = localPosition; + Vector3 localPosition2 = m_rightShoulder.localPosition; + localPosition2.x = num; + m_rightShoulder.localPosition = localPosition2; + } + } + + private void UpdateLookat() + { + if (m_headRotation && (bool)m_head) + { + float target = m_lookWeight; + if (m_headLookDir != Vector3.zero) + { + m_animator.SetLookAtPosition(m_head.position + m_headLookDir * 10f); + } + if (m_character.InAttack() || (!m_character.IsPlayer() && !m_character.CanMove())) + { + target = 0f; + } + m_lookAtWeight = Mathf.MoveTowards(m_lookAtWeight, target, Time.deltaTime); + float bodyWeight = (m_character.IsAttached() ? 0f : m_bodyLookWeight); + m_animator.SetLookAtWeight(m_lookAtWeight, bodyWeight, m_headLookWeight, m_eyeLookWeight, m_lookClamp); + } + } + + private void UpdateFootIK() + { + if (!m_footIK) + { + return; + } + Camera mainCamera = Utils.GetMainCamera(); + if (mainCamera == null || Vector3.Distance(base.transform.position, mainCamera.transform.position) > 64f) + { + return; + } + if ((m_character.IsFlying() && !m_character.IsOnGround()) || (m_character.IsSwiming() && !m_character.IsOnGround())) + { + for (int i = 0; i < m_feets.Length; i++) + { + Foot foot = m_feets[i]; + m_animator.SetIKPositionWeight(foot.m_ikHandle, 0f); + m_animator.SetIKRotationWeight(foot.m_ikHandle, 0f); + } + return; + } + float deltaTime = Time.deltaTime; + for (int j = 0; j < m_feets.Length; j++) + { + Foot foot2 = m_feets[j]; + Vector3 position = foot2.m_transform.position; + AvatarIKGoal ikHandle = foot2.m_ikHandle; + float num = (m_useFeetValues ? foot2.m_footDownMax : m_footDownMax); + float num2 = (m_useFeetValues ? foot2.m_footOffset : m_footOffset); + float num3 = (m_useFeetValues ? foot2.m_footStepHeight : m_footStepHeight); + float num4 = (m_useFeetValues ? foot2.m_stabalizeDistance : m_stabalizeDistance); + float target = 1f - Mathf.Clamp01(base.transform.InverseTransformPoint(position - base.transform.up * num2).y / num); + foot2.m_ikWeight = Mathf.MoveTowards(foot2.m_ikWeight, target, deltaTime * 10f); + m_animator.SetIKPositionWeight(ikHandle, foot2.m_ikWeight); + m_animator.SetIKRotationWeight(ikHandle, foot2.m_ikWeight * 0.5f); + if (!(foot2.m_ikWeight > 0f)) + { + continue; + } + if (Physics.Raycast(position + Vector3.up * num3, Vector3.down, out var hitInfo, num3 * 4f, m_ikGroundMask)) + { + Vector3 vector = hitInfo.point + Vector3.up * num2; + Vector3 normal = hitInfo.normal; + if (num4 > 0f) + { + if (foot2.m_ikWeight >= 1f) + { + if (!foot2.m_isPlanted) + { + foot2.m_plantPosition = vector; + foot2.m_plantNormal = normal; + foot2.m_isPlanted = true; + } + else if (Vector3.Distance(foot2.m_plantPosition, vector) > num4) + { + foot2.m_isPlanted = false; + } + else + { + vector = foot2.m_plantPosition; + normal = foot2.m_plantNormal; + } + } + else + { + foot2.m_isPlanted = false; + } + } + m_animator.SetIKPosition(ikHandle, vector); + Quaternion goalRotation = Quaternion.LookRotation(Vector3.Cross(m_animator.GetIKRotation(ikHandle) * Vector3.right, hitInfo.normal), hitInfo.normal); + m_animator.SetIKRotation(ikHandle, goalRotation); + } + else + { + foot2.m_ikWeight = Mathf.MoveTowards(foot2.m_ikWeight, 0f, deltaTime * 4f); + m_animator.SetIKPositionWeight(ikHandle, foot2.m_ikWeight); + m_animator.SetIKRotationWeight(ikHandle, foot2.m_ikWeight * 0.5f); + } + } + } + + private void UpdateHeadRotation(float dt) + { + if (m_nview == null || !m_nview.IsValid() || !m_headRotation || !m_head) + { + return; + } + Vector3 lookFromPos = GetLookFromPos(); + Vector3 vector = Vector3.zero; + if (m_nview.IsOwner()) + { + if (m_monsterAI != null) + { + Character targetCreature = m_monsterAI.GetTargetCreature(); + if (targetCreature != null) + { + vector = targetCreature.GetEyePoint(); + } + } + else + { + vector = lookFromPos + m_character.GetLookDir() * 100f; + } + if (m_lookAt != null) + { + vector = m_lookAt.position; + } + m_sendTimer += Time.deltaTime; + if (m_sendTimer > 0.2f) + { + m_sendTimer = 0f; + m_nview.GetZDO().Set("LookTarget", vector); + } + } + else + { + vector = m_nview.GetZDO().GetVec3("LookTarget", Vector3.zero); + } + if (vector != Vector3.zero) + { + Vector3 b = Vector3.Normalize(vector - lookFromPos); + m_headLookDir = Vector3.Lerp(m_headLookDir, b, 0.1f); + } + else + { + m_headLookDir = m_character.transform.forward; + } + } + + private Vector3 GetLookFromPos() + { + if (m_eyes != null && m_eyes.Length != 0) + { + Vector3 zero = Vector3.zero; + Transform[] eyes = m_eyes; + foreach (Transform transform in eyes) + { + zero += transform.position; + } + return zero / m_eyes.Length; + } + return m_head.position; + } + + public void FindJoints() + { + ZLog.Log("Finding joints"); + List list = new List(); + Transform transform = Utils.FindChild(base.transform, "LeftEye"); + Transform transform2 = Utils.FindChild(base.transform, "RightEye"); + if ((bool)transform) + { + list.Add(transform); + } + if ((bool)transform2) + { + list.Add(transform2); + } + m_eyes = list.ToArray(); + Transform transform3 = Utils.FindChild(base.transform, "LeftFootFront"); + Transform transform4 = Utils.FindChild(base.transform, "RightFootFront"); + Transform transform5 = Utils.FindChild(base.transform, "LeftFoot"); + if (transform5 == null) + { + transform5 = Utils.FindChild(base.transform, "LeftFootBack"); + } + if (transform5 == null) + { + transform5 = Utils.FindChild(base.transform, "l_foot"); + } + if (transform5 == null) + { + transform5 = Utils.FindChild(base.transform, "Foot.l"); + } + if (transform5 == null) + { + transform5 = Utils.FindChild(base.transform, "foot.l"); + } + Transform transform6 = Utils.FindChild(base.transform, "RightFoot"); + if (transform6 == null) + { + transform6 = Utils.FindChild(base.transform, "RightFootBack"); + } + if (transform6 == null) + { + transform6 = Utils.FindChild(base.transform, "r_foot"); + } + if (transform6 == null) + { + transform6 = Utils.FindChild(base.transform, "Foot.r"); + } + if (transform6 == null) + { + transform6 = Utils.FindChild(base.transform, "foot.r"); + } + List list2 = new List(); + if ((bool)transform3) + { + list2.Add(new Foot(transform3, AvatarIKGoal.LeftHand)); + } + if ((bool)transform4) + { + list2.Add(new Foot(transform4, AvatarIKGoal.RightHand)); + } + if ((bool)transform5) + { + list2.Add(new Foot(transform5, AvatarIKGoal.LeftFoot)); + } + if ((bool)transform6) + { + list2.Add(new Foot(transform6, AvatarIKGoal.RightFoot)); + } + m_feets = list2.ToArray(); + } +} diff --git a/Valheim_r202102_v0.141.2/Valheim/assembly_valheim/CharacterDrop.cs b/Valheim_r202102_v0.141.2/Valheim/assembly_valheim/CharacterDrop.cs new file mode 100644 index 0000000..89dfc87 --- /dev/null +++ b/Valheim_r202102_v0.141.2/Valheim/assembly_valheim/CharacterDrop.cs @@ -0,0 +1,118 @@ +using System; +using System.Collections.Generic; +using UnityEngine; + +[RequireComponent(typeof(Character))] +public class CharacterDrop : MonoBehaviour +{ + [Serializable] + public class Drop + { + public GameObject m_prefab; + + public int m_amountMin = 1; + + public int m_amountMax = 1; + + public float m_chance = 1f; + + public bool m_onePerPlayer; + + public bool m_levelMultiplier = true; + } + + public Vector3 m_spawnOffset = Vector3.zero; + + public List m_drops = new List(); + + private const float m_dropArea = 0.5f; + + private const float m_vel = 5f; + + private bool m_dropsEnabled = true; + + private Character m_character; + + private void Start() + { + m_character = GetComponent(); + if ((bool)m_character) + { + Character character = m_character; + character.m_onDeath = (Action)Delegate.Combine(character.m_onDeath, new Action(OnDeath)); + } + } + + public void SetDropsEnabled(bool enabled) + { + m_dropsEnabled = enabled; + } + + private void OnDeath() + { + if (m_dropsEnabled) + { + List> drops = GenerateDropList(); + Vector3 centerPos = m_character.GetCenterPoint() + base.transform.TransformVector(m_spawnOffset); + DropItems(drops, centerPos, 0.5f); + } + } + + public List> GenerateDropList() + { + List> list = new List>(); + int num = ((!m_character) ? 1 : Mathf.Max(1, (int)Mathf.Pow(2f, m_character.GetLevel() - 1))); + foreach (Drop drop in m_drops) + { + if (drop.m_prefab == null) + { + continue; + } + float num2 = drop.m_chance; + if (drop.m_levelMultiplier) + { + num2 *= (float)num; + } + if (UnityEngine.Random.value <= num2) + { + int num3 = UnityEngine.Random.Range(drop.m_amountMin, drop.m_amountMax); + if (drop.m_levelMultiplier) + { + num3 *= num; + } + if (drop.m_onePerPlayer) + { + num3 = ZNet.instance.GetNrOfPlayers(); + } + if (num3 > 0) + { + list.Add(new KeyValuePair(drop.m_prefab, num3)); + } + } + } + return list; + } + + public static void DropItems(List> drops, Vector3 centerPos, float dropArea) + { + foreach (KeyValuePair drop in drops) + { + for (int i = 0; i < drop.Value; i++) + { + Quaternion rotation = Quaternion.Euler(0f, UnityEngine.Random.Range(0, 360), 0f); + Vector3 vector = UnityEngine.Random.insideUnitSphere * dropArea; + GameObject gameObject = UnityEngine.Object.Instantiate(drop.Key, centerPos + vector, rotation); + Rigidbody component = gameObject.GetComponent(); + if ((bool)component) + { + Vector3 insideUnitSphere = UnityEngine.Random.insideUnitSphere; + if (insideUnitSphere.y < 0f) + { + insideUnitSphere.y = 0f - insideUnitSphere.y; + } + component.AddForce(insideUnitSphere * 5f, ForceMode.VelocityChange); + } + } + } + } +} diff --git a/Valheim_r202102_v0.141.2/Valheim/assembly_valheim/CharacterTimedDestruction.cs b/Valheim_r202102_v0.141.2/Valheim/assembly_valheim/CharacterTimedDestruction.cs new file mode 100644 index 0000000..f4382e2 --- /dev/null +++ b/Valheim_r202102_v0.141.2/Valheim/assembly_valheim/CharacterTimedDestruction.cs @@ -0,0 +1,48 @@ +using UnityEngine; + +public class CharacterTimedDestruction : MonoBehaviour +{ + public float m_timeoutMin = 1f; + + public float m_timeoutMax = 1f; + + public bool m_triggerOnAwake; + + private ZNetView m_nview; + + private Character m_character; + + private void Awake() + { + m_nview = GetComponent(); + if (m_triggerOnAwake) + { + Trigger(); + } + } + + public void Trigger() + { + InvokeRepeating("DestroyNow", Random.Range(m_timeoutMin, m_timeoutMax), 1f); + } + + public void Trigger(float timeout) + { + InvokeRepeating("DestroyNow", timeout, 1f); + } + + private void DestroyNow() + { + if (m_nview.IsValid() && m_nview.IsOwner()) + { + GetComponent().ApplyDamage(new HitData + { + m_damage = + { + m_damage = 99999f + }, + m_point = base.transform.position + }, showDamageText: false, triggerEffects: true); + } + } +} diff --git a/Valheim_r202102_v0.141.2/Valheim/assembly_valheim/Chat.cs b/Valheim_r202102_v0.141.2/Valheim/assembly_valheim/Chat.cs new file mode 100644 index 0000000..4646819 --- /dev/null +++ b/Valheim_r202102_v0.141.2/Valheim/assembly_valheim/Chat.cs @@ -0,0 +1,568 @@ +using System.Collections.Generic; +using System.Text; +using UnityEngine; +using UnityEngine.EventSystems; +using UnityEngine.UI; + +public class Chat : MonoBehaviour +{ + public class WorldTextInstance + { + public long m_talkerID; + + public GameObject m_go; + + public Vector3 m_position; + + public float m_timer; + + public GameObject m_gui; + + public Text m_textField; + + public string m_name = ""; + + public Talker.Type m_type; + + public string m_text = ""; + } + + public class NpcText + { + public GameObject m_go; + + public Vector3 m_offset = Vector3.zero; + + public float m_cullDistance = 20f; + + public GameObject m_gui; + + public Animator m_animator; + + public Text m_textField; + + public Text m_topicField; + + public float m_ttl; + + public bool m_timeout; + + public void SetVisible(bool visible) + { + m_animator.SetBool("visible", visible); + } + + public bool IsVisible() + { + if (m_animator.GetCurrentAnimatorStateInfo(0).IsTag("visible")) + { + return true; + } + return m_animator.GetBool("visible"); + } + } + + private static Chat m_instance; + + public RectTransform m_chatWindow; + + public Text m_output; + + public InputField m_input; + + public float m_hideDelay = 10f; + + public float m_worldTextTTL = 5f; + + public GameObject m_worldTextBase; + + public GameObject m_npcTextBase; + + public GameObject m_npcTextBaseLarge; + + private List m_worldTexts = new List(); + + private List m_npcTexts = new List(); + + private float m_hideTimer = 9999f; + + private bool m_wasFocused; + + private const int m_maxBufferLength = 15; + + private List m_chatBuffer = new List(); + + public static Chat instance => m_instance; + + private void Awake() + { + m_instance = this; + ZRoutedRpc.instance.Register("ChatMessage", RPC_ChatMessage); + AddString(Localization.instance.Localize("/w [text] - $chat_whisper")); + AddString(Localization.instance.Localize("/s [text] - $chat_shout")); + AddString(Localization.instance.Localize("/killme - $chat_kill")); + AddString(Localization.instance.Localize("/resetspawn - $chat_resetspawn")); + AddString(Localization.instance.Localize("/[emote]")); + AddString(Localization.instance.Localize("Emotes: sit,wave,challenge,cheer,nonono,thumbsup,point")); + AddString(""); + m_input.gameObject.SetActive(value: false); + m_worldTextBase.SetActive(value: false); + } + + public bool HasFocus() + { + if (m_chatWindow.gameObject.activeInHierarchy) + { + return m_input.isFocused; + } + return false; + } + + public bool IsChatDialogWindowVisible() + { + return m_chatWindow.gameObject.activeSelf; + } + + private void Update() + { + m_hideTimer += Time.deltaTime; + m_chatWindow.gameObject.SetActive(m_hideTimer < m_hideDelay); + if (!m_wasFocused) + { + if (Input.GetKeyDown(KeyCode.Return) && Player.m_localPlayer != null && !Console.IsVisible() && !TextInput.IsVisible() && !Minimap.InTextInput() && !Menu.IsVisible()) + { + m_hideTimer = 0f; + m_chatWindow.gameObject.SetActive(value: true); + m_input.gameObject.SetActive(value: true); + m_input.ActivateInputField(); + } + } + else if (m_wasFocused) + { + m_hideTimer = 0f; + if (Input.GetKeyDown(KeyCode.Return)) + { + if (!string.IsNullOrEmpty(m_input.text)) + { + InputText(); + m_input.text = ""; + } + EventSystem.current.SetSelectedGameObject(null); + m_input.gameObject.SetActive(value: false); + } + } + m_wasFocused = m_input.isFocused; + } + + private void LateUpdate() + { + UpdateWorldTexts(Time.deltaTime); + UpdateNpcTexts(Time.deltaTime); + } + + private void UpdateChat() + { + StringBuilder stringBuilder = new StringBuilder(); + foreach (string item in m_chatBuffer) + { + stringBuilder.Append(item); + stringBuilder.Append("\n"); + } + m_output.text = stringBuilder.ToString(); + } + + public void OnNewChatMessage(GameObject go, long senderID, Vector3 pos, Talker.Type type, string user, string text) + { + text = text.Replace('<', ' '); + text = text.Replace('>', ' '); + AddString(user, text, type); + AddInworldText(go, senderID, pos, type, user, text); + } + + private void UpdateWorldTexts(float dt) + { + WorldTextInstance worldTextInstance = null; + Camera mainCamera = Utils.GetMainCamera(); + if (mainCamera == null) + { + return; + } + foreach (WorldTextInstance worldText in m_worldTexts) + { + worldText.m_timer += dt; + if (worldText.m_timer > m_worldTextTTL && worldTextInstance == null) + { + worldTextInstance = worldText; + } + worldText.m_position.y += dt * 0.15f; + Vector3 zero = Vector3.zero; + if ((bool)worldText.m_go) + { + Character component = worldText.m_go.GetComponent(); + zero = ((!component) ? (worldText.m_go.transform.position + Vector3.up * 0.3f) : (component.GetHeadPoint() + Vector3.up * 0.3f)); + } + else + { + zero = worldText.m_position + Vector3.up * 0.3f; + } + Vector3 position = mainCamera.WorldToScreenPoint(zero); + if (position.x < 0f || position.x > (float)Screen.width || position.y < 0f || position.y > (float)Screen.height || position.z < 0f) + { + Vector3 vector = zero - mainCamera.transform.position; + bool flag = Vector3.Dot(mainCamera.transform.right, vector) < 0f; + Vector3 vector2 = vector; + vector2.y = 0f; + float magnitude = vector2.magnitude; + float y = vector.y; + Vector3 forward = mainCamera.transform.forward; + forward.y = 0f; + forward.Normalize(); + forward *= magnitude; + Vector3 vector3 = forward + Vector3.up * y; + position = mainCamera.WorldToScreenPoint(mainCamera.transform.position + vector3); + position.x = ((!flag) ? Screen.width : 0); + } + RectTransform rectTransform = worldText.m_gui.transform as RectTransform; + position.x = Mathf.Clamp(position.x, rectTransform.rect.width / 2f, (float)Screen.width - rectTransform.rect.width / 2f); + position.y = Mathf.Clamp(position.y, rectTransform.rect.height / 2f, (float)Screen.height - rectTransform.rect.height); + position.z = Mathf.Min(position.z, 100f); + worldText.m_gui.transform.position = position; + } + if (worldTextInstance != null) + { + Object.Destroy(worldTextInstance.m_gui); + m_worldTexts.Remove(worldTextInstance); + } + } + + private void AddInworldText(GameObject go, long senderID, Vector3 position, Talker.Type type, string user, string text) + { + WorldTextInstance worldTextInstance = FindExistingWorldText(senderID); + if (worldTextInstance == null) + { + worldTextInstance = new WorldTextInstance(); + worldTextInstance.m_talkerID = senderID; + worldTextInstance.m_gui = Object.Instantiate(m_worldTextBase, base.transform); + worldTextInstance.m_gui.gameObject.SetActive(value: true); + worldTextInstance.m_textField = worldTextInstance.m_gui.transform.Find("Text").GetComponent(); + m_worldTexts.Add(worldTextInstance); + } + worldTextInstance.m_name = user; + worldTextInstance.m_type = type; + worldTextInstance.m_go = go; + worldTextInstance.m_position = position; + Color color; + switch (type) + { + case Talker.Type.Shout: + color = Color.yellow; + text = text.ToUpper(); + break; + case Talker.Type.Whisper: + color = new Color(1f, 1f, 1f, 0.75f); + text = text.ToLowerInvariant(); + break; + case Talker.Type.Ping: + color = new Color(0.6f, 0.7f, 1f, 1f); + text = "PING"; + break; + default: + color = Color.white; + break; + } + worldTextInstance.m_textField.color = color; + worldTextInstance.m_textField.GetComponent().enabled = type != Talker.Type.Whisper; + worldTextInstance.m_timer = 0f; + worldTextInstance.m_text = text; + UpdateWorldTextField(worldTextInstance); + } + + private void UpdateWorldTextField(WorldTextInstance wt) + { + string text = ""; + if (wt.m_type == Talker.Type.Shout || wt.m_type == Talker.Type.Ping) + { + text = wt.m_name + ": "; + } + text += wt.m_text; + wt.m_textField.text = text; + } + + private WorldTextInstance FindExistingWorldText(long senderID) + { + foreach (WorldTextInstance worldText in m_worldTexts) + { + if (worldText.m_talkerID == senderID) + { + return worldText; + } + } + return null; + } + + private void AddString(string user, string text, Talker.Type type) + { + Color white = Color.white; + switch (type) + { + case Talker.Type.Shout: + white = Color.yellow; + text = text.ToUpper(); + break; + case Talker.Type.Whisper: + white = new Color(1f, 1f, 1f, 0.75f); + text = text.ToLowerInvariant(); + break; + default: + white = Color.white; + break; + } + string text2 = "" + user + ": " + text + ""; + AddString(text2); + } + + private void AddString(string text) + { + m_chatBuffer.Add(text); + while (m_chatBuffer.Count > 15) + { + m_chatBuffer.RemoveAt(0); + } + UpdateChat(); + } + + private void InputText() + { + string text = m_input.text; + if (text == "/resetspawn") + { + Game.instance.GetPlayerProfile()?.ClearCustomSpawnPoint(); + AddString("Reseting spawn point"); + return; + } + if (text == "/killme") + { + HitData hitData = new HitData(); + hitData.m_damage.m_damage = 99999f; + Player.m_localPlayer.Damage(hitData); + SendText(Talker.Type.Normal, "I am off to valhalla"); + return; + } + Talker.Type type = Talker.Type.Normal; + if (text.StartsWith("/s ") || text.StartsWith("/S ")) + { + type = Talker.Type.Shout; + text = text.Substring(3); + } + if (text.StartsWith("/w ") || text.StartsWith("/W ")) + { + type = Talker.Type.Whisper; + text = text.Substring(3); + } + if (text.StartsWith("/wave")) + { + Player.m_localPlayer.StartEmote("wave"); + } + else if (text.StartsWith("/sit")) + { + Player.m_localPlayer.StartEmote("sit", oneshot: false); + } + else if (text.StartsWith("/challenge")) + { + Player.m_localPlayer.StartEmote("challenge"); + } + else if (text.StartsWith("/cheer")) + { + Player.m_localPlayer.StartEmote("cheer"); + } + else if (text.StartsWith("/nonono")) + { + Player.m_localPlayer.StartEmote("nonono"); + } + else if (text.StartsWith("/thumbsup")) + { + Player.m_localPlayer.StartEmote("thumbsup"); + } + else if (text.StartsWith("/point")) + { + Player.m_localPlayer.FaceLookDirection(); + Player.m_localPlayer.StartEmote("point"); + } + else + { + SendText(type, text); + } + } + + private void RPC_ChatMessage(long sender, Vector3 position, int type, string name, string text) + { + OnNewChatMessage(null, sender, position, (Talker.Type)type, name, text); + } + + public void SendText(Talker.Type type, string text) + { + Player localPlayer = Player.m_localPlayer; + if ((bool)localPlayer) + { + if (type == Talker.Type.Shout) + { + ZRoutedRpc.instance.InvokeRoutedRPC(ZRoutedRpc.Everybody, "ChatMessage", localPlayer.GetHeadPoint(), 2, localPlayer.GetPlayerName(), text); + } + else + { + localPlayer.GetComponent().Say(type, text); + } + } + } + + public void SendPing(Vector3 position) + { + Player localPlayer = Player.m_localPlayer; + if ((bool)localPlayer) + { + Vector3 vector = position; + vector.y = localPlayer.transform.position.y; + ZRoutedRpc.instance.InvokeRoutedRPC(ZRoutedRpc.Everybody, "ChatMessage", vector, 3, localPlayer.GetPlayerName(), ""); + } + } + + public void GetShoutWorldTexts(List texts) + { + foreach (WorldTextInstance worldText in m_worldTexts) + { + if (worldText.m_type == Talker.Type.Shout) + { + texts.Add(worldText); + } + } + } + + public void GetPingWorldTexts(List texts) + { + foreach (WorldTextInstance worldText in m_worldTexts) + { + if (worldText.m_type == Talker.Type.Ping) + { + texts.Add(worldText); + } + } + } + + private void UpdateNpcTexts(float dt) + { + NpcText npcText = null; + Camera mainCamera = Utils.GetMainCamera(); + foreach (NpcText npcText2 in m_npcTexts) + { + if (!npcText2.m_go) + { + npcText2.m_gui.SetActive(value: false); + if (npcText == null) + { + npcText = npcText2; + } + continue; + } + if (npcText2.m_timeout) + { + npcText2.m_ttl -= dt; + if (npcText2.m_ttl <= 0f) + { + npcText2.SetVisible(visible: false); + if (!npcText2.IsVisible()) + { + npcText = npcText2; + } + continue; + } + } + Vector3 vector = npcText2.m_go.transform.position + npcText2.m_offset; + Vector3 position = mainCamera.WorldToScreenPoint(vector); + if (position.x < 0f || position.x > (float)Screen.width || position.y < 0f || position.y > (float)Screen.height || position.z < 0f) + { + npcText2.SetVisible(visible: false); + } + else + { + npcText2.SetVisible(visible: true); + RectTransform rectTransform = npcText2.m_gui.transform as RectTransform; + position.x = Mathf.Clamp(position.x, rectTransform.rect.width / 2f, (float)Screen.width - rectTransform.rect.width / 2f); + position.y = Mathf.Clamp(position.y, rectTransform.rect.height / 2f, (float)Screen.height - rectTransform.rect.height); + npcText2.m_gui.transform.position = position; + } + if (Vector3.Distance(mainCamera.transform.position, vector) > npcText2.m_cullDistance) + { + npcText2.SetVisible(visible: false); + if (npcText == null && !npcText2.IsVisible()) + { + npcText = npcText2; + } + } + } + if (npcText != null) + { + ClearNpcText(npcText); + } + } + + public void SetNpcText(GameObject talker, Vector3 offset, float cullDistance, float ttl, string topic, string text, bool large) + { + NpcText npcText = FindNpcText(talker); + if (npcText != null) + { + ClearNpcText(npcText); + } + npcText = new NpcText(); + npcText.m_go = talker; + npcText.m_gui = Object.Instantiate(large ? m_npcTextBaseLarge : m_npcTextBase, base.transform); + npcText.m_gui.SetActive(value: true); + npcText.m_animator = npcText.m_gui.GetComponent(); + npcText.m_topicField = npcText.m_gui.transform.Find("Topic").GetComponent(); + npcText.m_textField = npcText.m_gui.transform.Find("Text").GetComponent(); + npcText.m_ttl = ttl; + npcText.m_timeout = ttl > 0f; + npcText.m_offset = offset; + npcText.m_cullDistance = cullDistance; + if (topic.Length > 0) + { + npcText.m_textField.text = "" + Localization.instance.Localize(topic) + "\n" + Localization.instance.Localize(text); + } + else + { + npcText.m_textField.text = Localization.instance.Localize(text); + } + m_npcTexts.Add(npcText); + } + + public bool IsDialogVisible(GameObject talker) + { + return FindNpcText(talker)?.IsVisible() ?? false; + } + + public void ClearNpcText(GameObject talker) + { + NpcText npcText = FindNpcText(talker); + if (npcText != null) + { + ClearNpcText(npcText); + } + } + + private void ClearNpcText(NpcText npcText) + { + Object.Destroy(npcText.m_gui); + m_npcTexts.Remove(npcText); + } + + private NpcText FindNpcText(GameObject go) + { + foreach (NpcText npcText in m_npcTexts) + { + if (npcText.m_go == go) + { + return npcText; + } + } + return null; + } +} diff --git a/Valheim_r202102_v0.141.2/Valheim/assembly_valheim/CircleProjector.cs b/Valheim_r202102_v0.141.2/Valheim/assembly_valheim/CircleProjector.cs new file mode 100644 index 0000000..a60fab6 --- /dev/null +++ b/Valheim_r202102_v0.141.2/Valheim/assembly_valheim/CircleProjector.cs @@ -0,0 +1,63 @@ +using System; +using System.Collections.Generic; +using UnityEngine; + +public class CircleProjector : MonoBehaviour +{ + public float m_radius = 5f; + + public int m_nrOfSegments = 20; + + public GameObject m_prefab; + + public LayerMask m_mask; + + private List m_segments = new List(); + + private void Start() + { + CreateSegments(); + } + + private void Update() + { + CreateSegments(); + float num = (float)Math.PI * 2f / (float)m_segments.Count; + for (int i = 0; i < m_segments.Count; i++) + { + float f = (float)i * num + Time.time * 0.1f; + Vector3 vector = base.transform.position + new Vector3(Mathf.Sin(f) * m_radius, 0f, Mathf.Cos(f) * m_radius); + GameObject obj = m_segments[i]; + if (Physics.Raycast(vector + Vector3.up * 500f, Vector3.down, out var hitInfo, 1000f, m_mask.value)) + { + vector.y = hitInfo.point.y; + } + obj.transform.position = vector; + } + for (int j = 0; j < m_segments.Count; j++) + { + GameObject obj2 = m_segments[j]; + GameObject gameObject = ((j == 0) ? m_segments[m_segments.Count - 1] : m_segments[j - 1]); + Vector3 normalized = (((j == m_segments.Count - 1) ? m_segments[0] : m_segments[j + 1]).transform.position - gameObject.transform.position).normalized; + obj2.transform.rotation = Quaternion.LookRotation(normalized, Vector3.up); + } + } + + private void CreateSegments() + { + if (m_segments.Count == m_nrOfSegments) + { + return; + } + foreach (GameObject segment in m_segments) + { + UnityEngine.Object.Destroy(segment); + } + m_segments.Clear(); + for (int i = 0; i < m_nrOfSegments; i++) + { + GameObject item = UnityEngine.Object.Instantiate(m_prefab, base.transform.position, Quaternion.identity, base.transform); + m_segments.Add(item); + } + } +} diff --git a/Valheim_r202102_v0.141.2/Valheim/assembly_valheim/ClutterSystem.cs b/Valheim_r202102_v0.141.2/Valheim/assembly_valheim/ClutterSystem.cs new file mode 100644 index 0000000..b08e638 --- /dev/null +++ b/Valheim_r202102_v0.141.2/Valheim/assembly_valheim/ClutterSystem.cs @@ -0,0 +1,472 @@ +using System; +using System.Collections.Generic; +using UnityEngine; +using UnityEngine.Rendering; + +public class ClutterSystem : MonoBehaviour +{ + [Serializable] + public class Clutter + { + public string m_name = ""; + + public bool m_enabled = true; + + [BitMask(typeof(Heightmap.Biome))] + public Heightmap.Biome m_biome; + + public bool m_instanced; + + public GameObject m_prefab; + + public int m_amount = 80; + + public bool m_onUncleared = true; + + public bool m_onCleared; + + public float m_scaleMin = 1f; + + public float m_scaleMax = 1f; + + public float m_maxTilt = 18f; + + public float m_maxAlt = 1000f; + + public float m_minAlt = 27f; + + public bool m_snapToWater; + + public bool m_terrainTilt; + + public float m_randomOffset; + + [Header("Ocean depth ")] + public float m_minOceanDepth; + + public float m_maxOceanDepth; + + [Header("Forest fractal 0-1 inside forest")] + public bool m_inForest; + + public float m_forestTresholdMin; + + public float m_forestTresholdMax = 1f; + + [Header("Fractal placement (m_fractalScale > 0 == enabled) ")] + public float m_fractalScale; + + public float m_fractalOffset; + + public float m_fractalTresholdMin = 0.5f; + + public float m_fractalTresholdMax = 1f; + } + + private class PatchData + { + public Vector3 center; + + public List m_objects = new List(); + + public float m_timer; + + public bool m_reset; + } + + public enum Quality + { + Off, + Med, + High + } + + private static ClutterSystem m_instance; + + private int m_placeRayMask; + + public List m_clutter = new List(); + + public float m_grassPatchSize = 8f; + + public float m_distance = 40f; + + public float m_waterLevel = 27f; + + public float m_playerPushFade = 0.05f; + + public float m_amountScale = 1f; + + public bool m_menuHack; + + private Dictionary m_patches = new Dictionary(); + + private Stack m_freePatches = new Stack(); + + private GameObject m_grassRoot; + + private Vector3 m_oldPlayerPos = Vector3.zero; + + private List m_tempToRemove = new List(); + + private List> m_tempToRemovePair = new List>(); + + private Quality m_quality = Quality.High; + + private bool m_forceRebuild; + + public static ClutterSystem instance => m_instance; + + private void Awake() + { + m_instance = this; + if (SystemInfo.graphicsDeviceType != GraphicsDeviceType.Null) + { + ApplySettings(); + m_placeRayMask = LayerMask.GetMask("terrain"); + m_grassRoot = new GameObject("grassroot"); + m_grassRoot.transform.SetParent(base.transform); + } + } + + public void ApplySettings() + { + Quality @int = (Quality)PlayerPrefs.GetInt("ClutterQuality", 2); + if (m_quality != @int) + { + m_quality = @int; + ClearAll(); + } + } + + private void LateUpdate() + { + Camera mainCamera = Utils.GetMainCamera(); + if (mainCamera == null) + { + return; + } + Vector3 center = ((!GameCamera.InFreeFly() && (bool)Player.m_localPlayer) ? Player.m_localPlayer.transform.position : mainCamera.transform.position); + if (m_forceRebuild) + { + if (IsHeightmapReady()) + { + m_forceRebuild = false; + UpdateGrass(Time.deltaTime, rebuildAll: true, center); + } + } + else if (IsHeightmapReady()) + { + UpdateGrass(Time.deltaTime, rebuildAll: false, center); + } + Player localPlayer = Player.m_localPlayer; + if (localPlayer != null) + { + m_oldPlayerPos = Vector3.Lerp(m_oldPlayerPos, localPlayer.transform.position, m_playerPushFade); + Shader.SetGlobalVector("_PlayerPosition", localPlayer.transform.position); + Shader.SetGlobalVector("_PlayerOldPosition", m_oldPlayerPos); + } + else + { + Shader.SetGlobalVector("_PlayerPosition", new Vector3(999999f, 999999f, 999999f)); + Shader.SetGlobalVector("_PlayerOldPosition", new Vector3(999999f, 999999f, 999999f)); + } + } + + public Vector2Int GetVegPatch(Vector3 point) + { + int x = Mathf.FloorToInt((point.x + m_grassPatchSize / 2f) / m_grassPatchSize); + int y = Mathf.FloorToInt((point.z + m_grassPatchSize / 2f) / m_grassPatchSize); + return new Vector2Int(x, y); + } + + public Vector3 GetVegPatchCenter(Vector2Int p) + { + return new Vector3((float)p.x * m_grassPatchSize, 0f, (float)p.y * m_grassPatchSize); + } + + private bool IsHeightmapReady() + { + Camera mainCamera = Utils.GetMainCamera(); + if (!mainCamera) + { + return false; + } + if (Heightmap.HaveQueuedRebuild(mainCamera.transform.position, m_distance)) + { + return false; + } + return true; + } + + private void UpdateGrass(float dt, bool rebuildAll, Vector3 center) + { + if (m_quality != 0) + { + GeneratePatches(rebuildAll, center); + TimeoutPatches(dt); + } + } + + private void GeneratePatches(bool rebuildAll, Vector3 center) + { + bool generated = false; + Vector2Int vegPatch = GetVegPatch(center); + GeneratePatch(center, vegPatch, ref generated, rebuildAll); + int num = Mathf.CeilToInt((m_distance - m_grassPatchSize / 2f) / m_grassPatchSize); + for (int i = 1; i <= num; i++) + { + for (int j = vegPatch.x - i; j <= vegPatch.x + i; j++) + { + GeneratePatch(center, new Vector2Int(j, vegPatch.y - i), ref generated, rebuildAll); + GeneratePatch(center, new Vector2Int(j, vegPatch.y + i), ref generated, rebuildAll); + } + for (int k = vegPatch.y - i + 1; k <= vegPatch.y + i - 1; k++) + { + GeneratePatch(center, new Vector2Int(vegPatch.x - i, k), ref generated, rebuildAll); + GeneratePatch(center, new Vector2Int(vegPatch.x + i, k), ref generated, rebuildAll); + } + } + } + + private void GeneratePatch(Vector3 camPos, Vector2Int p, ref bool generated, bool rebuildAll) + { + if (Utils.DistanceXZ(GetVegPatchCenter(p), camPos) > m_distance) + { + return; + } + if (m_patches.TryGetValue(p, out var value) && !value.m_reset) + { + value.m_timer = 0f; + } + else + { + if (!rebuildAll && generated && !m_menuHack) + { + return; + } + PatchData patchData = GenerateVegPatch(p, m_grassPatchSize); + if (patchData == null) + { + return; + } + if (m_patches.TryGetValue(p, out var value2)) + { + foreach (GameObject @object in value2.m_objects) + { + UnityEngine.Object.Destroy(@object); + } + FreePatch(value2); + m_patches.Remove(p); + } + m_patches.Add(p, patchData); + generated = true; + } + } + + private void TimeoutPatches(float dt) + { + m_tempToRemovePair.Clear(); + foreach (KeyValuePair patch in m_patches) + { + patch.Value.m_timer += dt; + if (patch.Value.m_timer >= 2f) + { + m_tempToRemovePair.Add(patch); + } + } + foreach (KeyValuePair item in m_tempToRemovePair) + { + foreach (GameObject @object in item.Value.m_objects) + { + UnityEngine.Object.Destroy(@object); + } + m_patches.Remove(item.Key); + FreePatch(item.Value); + } + } + + private void ClearAll() + { + foreach (KeyValuePair patch in m_patches) + { + foreach (GameObject @object in patch.Value.m_objects) + { + UnityEngine.Object.Destroy(@object); + } + FreePatch(patch.Value); + } + m_patches.Clear(); + m_forceRebuild = true; + } + + public void ResetGrass(Vector3 center, float radius) + { + float num = m_grassPatchSize / 2f; + foreach (KeyValuePair patch in m_patches) + { + Vector3 center2 = patch.Value.center; + if (!(center2.x + num < center.x - radius) && !(center2.x - num > center.x + radius) && !(center2.z + num < center.z - radius) && !(center2.z - num > center.z + radius)) + { + patch.Value.m_reset = true; + m_forceRebuild = true; + } + } + } + + public bool GetGroundInfo(Vector3 p, out Vector3 point, out Vector3 normal, out Heightmap hmap, out Heightmap.Biome biome) + { + if (Physics.Raycast(p + Vector3.up * 500f, Vector3.down, out var hitInfo, 1000f, m_placeRayMask)) + { + point = hitInfo.point; + normal = hitInfo.normal; + hmap = hitInfo.collider.GetComponent(); + biome = hmap.GetBiome(point); + return true; + } + point = p; + normal = Vector3.up; + hmap = null; + biome = Heightmap.Biome.Meadows; + return false; + } + + private Heightmap.Biome GetPatchBiomes(Vector3 center, float halfSize) + { + Heightmap.Biome biome = Heightmap.FindBiomeClutter(new Vector3(center.x - halfSize, 0f, center.z - halfSize)); + Heightmap.Biome biome2 = Heightmap.FindBiomeClutter(new Vector3(center.x + halfSize, 0f, center.z - halfSize)); + Heightmap.Biome biome3 = Heightmap.FindBiomeClutter(new Vector3(center.x - halfSize, 0f, center.z + halfSize)); + Heightmap.Biome biome4 = Heightmap.FindBiomeClutter(new Vector3(center.x + halfSize, 0f, center.z + halfSize)); + if (biome == Heightmap.Biome.None || biome2 == Heightmap.Biome.None || biome3 == Heightmap.Biome.None || biome4 == Heightmap.Biome.None) + { + return Heightmap.Biome.None; + } + return biome | biome2 | biome3 | biome4; + } + + private PatchData GenerateVegPatch(Vector2Int patchID, float size) + { + Vector3 vegPatchCenter = GetVegPatchCenter(patchID); + float num = size / 2f; + Heightmap.Biome patchBiomes = GetPatchBiomes(vegPatchCenter, num); + if (patchBiomes == Heightmap.Biome.None) + { + return null; + } + _ = Time.realtimeSinceStartup; + UnityEngine.Random.State state = UnityEngine.Random.state; + PatchData patchData = AllocatePatch(); + patchData.center = vegPatchCenter; + for (int i = 0; i < m_clutter.Count; i++) + { + Clutter clutter = m_clutter[i]; + if (!clutter.m_enabled || (patchBiomes & clutter.m_biome) == 0) + { + continue; + } + InstanceRenderer instanceRenderer = null; + UnityEngine.Random.InitState(patchID.x * (patchID.y * 1374) + i * 9321); + Vector3 vector = new Vector3(clutter.m_fractalOffset, 0f, 0f); + float num2 = Mathf.Cos((float)Math.PI / 180f * clutter.m_maxTilt); + int num3 = ((m_quality == Quality.High) ? clutter.m_amount : (clutter.m_amount / 2)); + num3 = (int)((float)num3 * m_amountScale); + for (int j = 0; j < num3; j++) + { + Vector3 vector2 = new Vector3(UnityEngine.Random.Range(vegPatchCenter.x - num, vegPatchCenter.x + num), 0f, UnityEngine.Random.Range(vegPatchCenter.z - num, vegPatchCenter.z + num)); + float num4 = UnityEngine.Random.Range(0, 360); + if (clutter.m_inForest) + { + float forestFactor = WorldGenerator.GetForestFactor(vector2); + if (forestFactor < clutter.m_forestTresholdMin || forestFactor > clutter.m_forestTresholdMax) + { + continue; + } + } + if (clutter.m_fractalScale > 0f) + { + float num5 = Utils.Fbm(vector2 * 0.01f * clutter.m_fractalScale + vector, 3, 1.6f, 0.7f); + if (num5 < clutter.m_fractalTresholdMin || num5 > clutter.m_fractalTresholdMax) + { + continue; + } + } + if (!GetGroundInfo(vector2, out var point, out var normal, out var hmap, out var biome) || (clutter.m_biome & biome) == 0) + { + continue; + } + float num6 = point.y - m_waterLevel; + if (num6 < clutter.m_minAlt || num6 > clutter.m_maxAlt || normal.y < num2) + { + continue; + } + if (clutter.m_minOceanDepth != clutter.m_maxOceanDepth) + { + float oceanDepth = hmap.GetOceanDepth(vector2); + if (oceanDepth < clutter.m_minOceanDepth || oceanDepth > clutter.m_maxOceanDepth) + { + continue; + } + } + if (!clutter.m_onCleared || !clutter.m_onUncleared) + { + bool flag = hmap.IsCleared(point); + if ((clutter.m_onCleared && !flag) || (clutter.m_onUncleared && flag)) + { + continue; + } + } + vector2 = point; + if (clutter.m_snapToWater) + { + vector2.y = m_waterLevel; + } + if (clutter.m_randomOffset != 0f) + { + vector2.y += UnityEngine.Random.Range(0f - clutter.m_randomOffset, clutter.m_randomOffset); + } + Quaternion identity = Quaternion.identity; + identity = ((!clutter.m_terrainTilt) ? Quaternion.Euler(0f, num4, 0f) : Quaternion.AngleAxis(num4, normal)); + if (clutter.m_instanced) + { + if (instanceRenderer == null) + { + GameObject gameObject = UnityEngine.Object.Instantiate(clutter.m_prefab, vegPatchCenter, Quaternion.identity, m_grassRoot.transform); + instanceRenderer = gameObject.GetComponent(); + if (instanceRenderer.m_lodMaxDistance > m_distance - m_grassPatchSize / 2f) + { + instanceRenderer.m_lodMaxDistance = m_distance - m_grassPatchSize / 2f; + } + patchData.m_objects.Add(gameObject); + } + float scale = UnityEngine.Random.Range(clutter.m_scaleMin, clutter.m_scaleMax); + instanceRenderer.AddInstance(vector2, identity, scale); + } + else + { + GameObject item = UnityEngine.Object.Instantiate(clutter.m_prefab, vector2, identity, m_grassRoot.transform); + patchData.m_objects.Add(item); + } + } + } + UnityEngine.Random.state = state; + return patchData; + } + + private PatchData AllocatePatch() + { + if (m_freePatches.Count > 0) + { + return m_freePatches.Pop(); + } + return new PatchData(); + } + + private void FreePatch(PatchData patch) + { + patch.center = Vector3.zero; + patch.m_objects.Clear(); + patch.m_timer = 0f; + patch.m_reset = false; + m_freePatches.Push(patch); + } +} diff --git a/Valheim_r202102_v0.141.2/Valheim/assembly_valheim/ConnectPanel.cs b/Valheim_r202102_v0.141.2/Valheim/assembly_valheim/ConnectPanel.cs new file mode 100644 index 0000000..cd973c6 --- /dev/null +++ b/Valheim_r202102_v0.141.2/Valheim/assembly_valheim/ConnectPanel.cs @@ -0,0 +1,215 @@ +using System.Collections.Generic; +using UnityEngine; +using UnityEngine.UI; + +public class ConnectPanel : MonoBehaviour +{ + private static ConnectPanel m_instance; + + public Transform m_root; + + public Text m_serverField; + + public Text m_worldField; + + public Text m_statusField; + + public Text m_connections; + + public RectTransform m_playerList; + + public Scrollbar m_playerListScroll; + + public GameObject m_playerElement; + + public InputField m_hostName; + + public InputField m_hostPort; + + public Button m_connectButton; + + public Text m_myPort; + + public Text m_myUID; + + public Text m_knownHosts; + + public Text m_nrOfConnections; + + public Text m_pendingConnections; + + public Toggle m_autoConnect; + + public Text m_zdos; + + public Text m_zdosPool; + + public Text m_zdosSent; + + public Text m_zdosRecv; + + public Text m_zdosInstances; + + public Text m_activePeers; + + public Text m_ntp; + + public Text m_upnp; + + public Text m_dataSent; + + public Text m_dataRecv; + + public Text m_clientSendQueue; + + public Text m_fps; + + public Text m_frameTime; + + private float m_playerListBaseSize; + + private List m_playerListElements = new List(); + + private int m_frameSamples; + + private float m_frameTimer; + + public static ConnectPanel instance => m_instance; + + private void Start() + { + m_instance = this; + m_root.gameObject.SetActive(value: false); + m_playerListBaseSize = m_playerList.rect.height; + } + + public static bool IsVisible() + { + if ((bool)m_instance) + { + return m_instance.m_root.gameObject.activeSelf; + } + return false; + } + + private void Update() + { + if (Input.GetKeyDown(KeyCode.F2)) + { + m_root.gameObject.SetActive(!m_root.gameObject.activeSelf); + } + if (!m_root.gameObject.activeInHierarchy) + { + return; + } + if (!ZNet.instance.IsServer() && ZNet.GetConnectionStatus() == ZNet.ConnectionStatus.Connected) + { + m_serverField.gameObject.SetActive(value: true); + m_serverField.text = ZNet.GetServerString(); + } + else + { + m_serverField.gameObject.SetActive(value: false); + } + m_worldField.text = ZNet.instance.GetWorldName(); + UpdateFps(); + m_myPort.gameObject.SetActive(ZNet.instance.IsServer()); + m_myPort.text = ZNet.instance.GetHostPort().ToString(); + m_myUID.text = ZNet.instance.GetUID().ToString(); + if (ZDOMan.instance != null) + { + m_zdos.text = ZDOMan.instance.NrOfObjects().ToString(); + ZDOMan.instance.GetAverageStats(out var sentZdos, out var recvZdos); + m_zdosSent.text = sentZdos.ToString("0.0"); + m_zdosRecv.text = recvZdos.ToString("0.0"); + m_activePeers.text = ZNet.instance.GetNrOfPlayers().ToString(); + } + m_zdosPool.text = ZDOPool.GetPoolActive() + " / " + ZDOPool.GetPoolSize() + " / " + ZDOPool.GetPoolTotal(); + if ((bool)ZNetScene.instance) + { + m_zdosInstances.text = ZNetScene.instance.NrOfInstances().ToString(); + } + if (ZNtp.instance != null) + { + m_ntp.text = (ZNtp.instance.GetStatus() ? "OK" : "fail"); + } + if (ZNet.instance != null && ZNet.instance.GetZNat() != null) + { + m_upnp.text = (ZNet.instance.GetZNat().GetStatus() ? "OK" : "fail"); + } + ZNet.instance.GetNetStats(out var totalSent, out var totalRecv); + m_dataSent.text = totalSent / 1024 + "kb/s"; + m_dataRecv.text = totalRecv / 1024 + "kb/s"; + m_clientSendQueue.text = ZDOMan.instance.GetClientChangeQueue().ToString(); + m_nrOfConnections.text = ZNet.instance.GetPeerConnections().ToString(); + string text = ""; + foreach (ZNetPeer connectedPeer in ZNet.instance.GetConnectedPeers()) + { + text = ((!connectedPeer.IsReady()) ? (text + connectedPeer.m_socket.GetEndPointString() + " connecting \n") : (text + connectedPeer.m_socket.GetEndPointString() + " UID: " + connectedPeer.m_uid + "\n")); + } + m_connections.text = text; + List playerList = ZNet.instance.GetPlayerList(); + float num = 16f; + if (playerList.Count != m_playerListElements.Count) + { + foreach (GameObject playerListElement in m_playerListElements) + { + Object.Destroy(playerListElement); + } + m_playerListElements.Clear(); + for (int i = 0; i < playerList.Count; i++) + { + GameObject gameObject = Object.Instantiate(m_playerElement, m_playerList); + (gameObject.transform as RectTransform).anchoredPosition = new Vector2(0f, (float)i * (0f - num)); + m_playerListElements.Add(gameObject); + } + float b = (float)playerList.Count * num; + b = Mathf.Max(m_playerListBaseSize, b); + m_playerList.SetSizeWithCurrentAnchors(RectTransform.Axis.Vertical, b); + m_playerListScroll.value = 1f; + } + for (int j = 0; j < playerList.Count; j++) + { + ZNet.PlayerInfo playerInfo = playerList[j]; + Text component = m_playerListElements[j].transform.Find("name").GetComponent(); + Text component2 = m_playerListElements[j].transform.Find("hostname").GetComponent(); + Button component3 = m_playerListElements[j].transform.Find("KickButton").GetComponent