├── .github └── workflows │ ├── nightly-release-linux-x64.yml │ └── nightly-release-windows-x64.yml ├── .gitignore ├── CONTRIBUTING.md ├── CREDITS.md ├── LICENSE ├── MHServerEmu.sln ├── README.md ├── Tools.sln ├── assets ├── LiveLoadingTips.xml ├── LiveTuningDataBackup.json ├── SiteConfig.xml ├── SiteConfigTestCenter.xml └── ssl │ ├── server.crt │ └── server.key ├── dep ├── Dapper │ ├── Dapper.License │ ├── Dapper.dll │ └── Dapper.xml ├── Free.Ports.zLib │ ├── Free.Ports.zLib.License │ └── Free.Ports.zLib.dll ├── K4os.Compression.LZ4 │ ├── K4os.Compression.LZ4.License │ ├── K4os.Compression.LZ4.dll │ └── K4os.Compression.LZ4.xml ├── RobustPredicates │ ├── RobustPredicates.License │ └── RobustPredicates.dll ├── System.Data.SQLite │ ├── System.Data.SQLite.dll │ ├── System.Data.SQLite.dll.config │ └── System.Data.SQLite.xml ├── ini-parser │ ├── INIFileParser.License │ ├── INIFileParser.dll │ └── INIFileParser.xml └── protobuf-csharp │ ├── Google.ProtocolBuffers.License │ ├── Google.ProtocolBuffers.dll │ └── Google.ProtocolBuffers.xml ├── docs ├── Client │ ├── ClientChatCommands.md │ ├── ClientConfig.md │ ├── ClientIniFiles.md │ ├── ClientLaunchParameters.md │ ├── ClientVersions.md │ └── InternalConsoleCommands.md ├── Game │ ├── Glossary.md │ ├── LiveTuning.md │ └── Properties.md ├── GameData │ ├── AuxiliaryResourcePrototypes.md │ ├── Calligraphy.md │ ├── DataReferences.md │ ├── Locale.md │ ├── Overview.md │ ├── PakFile.md │ └── Resources.md ├── Index.md ├── Networking │ ├── Authentication.md │ └── PacketStructure.md ├── ServerEmu │ └── ServerCommands.md ├── Setup │ ├── AdvancedSetup.md │ ├── InitialSetup.md │ └── ManualSetup.md └── Web │ ├── EmbeddedBrowser.md │ └── SiteConfig.md ├── proto ├── AuthMessages.proto ├── BillingCommon.proto ├── ChatCommon.proto ├── ClientToGameServer.proto ├── ClientToGroupingManager.proto ├── CommonMessages.proto ├── FrontendProtocol.proto ├── GameServerToClient.proto ├── GazillionCommon.proto ├── GlobalEventsCommon.proto ├── GroupingManager.proto ├── Guild.proto ├── MatchCommon.proto ├── PubSubProtocol.proto └── google │ └── protobuf │ └── descriptor.proto └── src ├── Gazillion ├── AuthMessages.cs ├── BillingCommon.cs ├── ChatCommon.cs ├── ClientToGameServer.cs ├── ClientToGroupingManager.cs ├── CommonMessages.cs ├── FrontendProtocol.cs ├── GameServerToClient.cs ├── Gazillion.csproj ├── GazillionCommon.cs ├── GlobalEventsCommon.cs ├── GroupingManager.cs ├── Guild.cs ├── MatchCommon.cs ├── ProtocolEnums.cs └── PubSubProtocol.cs ├── MHServerEmu.Billing ├── BillingService.cs └── MHServerEmu.Billing.csproj ├── MHServerEmu.Core.Tests ├── Extensions │ ├── ArrayExtensionTests.cs │ └── BinaryReaderExtensionTests.cs ├── Helpers │ ├── HashHelperTests.cs │ └── MathHelperTests.cs ├── MHServerEmu.Core.Tests.csproj ├── Serialization │ ├── ArchiveTests.cs │ └── FakeISerialize.cs └── System │ └── Random │ ├── GRandomTests.cs │ ├── RandMwcTests.cs │ └── RandTests.cs ├── MHServerEmu.Core ├── Collections │ ├── CircularBuffer.cs │ ├── CustomQueues.cs │ ├── DoubleBufferQueue.cs │ ├── GBitArray.cs │ ├── InvasiveList.cs │ ├── Picker.cs │ ├── Range.cs │ └── SortedVector.cs ├── Collisions │ ├── Aabb.cs │ ├── Aabb2.cs │ ├── Capsule.cs │ ├── Circle2.cs │ ├── Cylinder2.cs │ ├── IBounds.cs │ ├── Obb.cs │ ├── Plane.cs │ ├── Segment.cs │ ├── Sphere.cs │ ├── Square.cs │ └── Triangle.cs ├── Config │ ├── ConfigContainer.cs │ ├── ConfigIgnoreAttribute.cs │ ├── ConfigManager.cs │ └── IniFile.cs ├── Extensions │ ├── ArrayExtensions.cs │ ├── BinaryReaderExtensions.cs │ ├── LinkedListExtensions.cs │ ├── MiscExtensions.cs │ ├── NumberExtensions.cs │ ├── ReflectionExtensions.cs │ ├── StreamExtensions.cs │ └── TimeExtensions.cs ├── Helpers │ ├── AssemblyHelper.cs │ ├── CompressionHelper.cs │ ├── CryptographyHelper.cs │ ├── FileHelper.cs │ ├── HashHelper.cs │ ├── MathHelper.cs │ └── ProtobufHelper.cs ├── Logging │ ├── LogEnums.cs │ ├── LogManager.cs │ ├── LogMessage.cs │ ├── LogRouter.cs │ ├── LogTarget.cs │ ├── LogTargetSettings.cs │ ├── Logger.cs │ ├── LoggingConfig.cs │ └── Targets │ │ ├── ConsoleTarget.cs │ │ └── FileTarget.cs ├── MHServerEmu.Core.csproj ├── Memory │ ├── CollectionPool.cs │ ├── IPoolable.cs │ ├── ObjectPool.cs │ └── ObjectPoolManager.cs ├── Metrics │ ├── Categories │ │ ├── GamePerformanceMetrics.cs │ │ └── MemoryMetrics.cs │ ├── GameProfileTimer.cs │ ├── MetricTracker.cs │ ├── MetricValue.cs │ ├── MetricsEnums.cs │ ├── MetricsManager.cs │ └── PerformanceReport.cs ├── Network │ ├── CoreNetworkMailbox.cs │ ├── GameServiceProtocol.cs │ ├── IFrontendClient.cs │ ├── IFrontendSession.cs │ ├── IGameService.cs │ ├── MailboxMessage.cs │ ├── MessageBuffer.cs │ ├── MessageList.cs │ ├── MessagePackageOut.cs │ ├── MuxHeader.cs │ ├── MuxPacket.cs │ ├── MuxReader.cs │ ├── NetClient.cs │ ├── NetworkManager.cs │ ├── ProtocolDispatchTable.cs │ ├── ServerManager.cs │ ├── ServiceMailbox.cs │ ├── Tcp │ │ ├── IPacket.cs │ │ ├── TcpClient.cs │ │ ├── TcpClientConnection.cs │ │ └── TcpServer.cs │ └── Web │ │ ├── WebHandler.cs │ │ ├── WebRequestContext.cs │ │ ├── WebService.cs │ │ └── WebServiceSettings.cs ├── Serialization │ ├── Archive.cs │ ├── ISerialize.cs │ └── TimeSpanJsonConverter.cs ├── System │ ├── IdGenerator.cs │ ├── Random │ │ ├── GRandom.cs │ │ ├── Rand.cs │ │ └── RandMwc.cs │ ├── Time │ │ ├── Clock.cs │ │ ├── CooldownTimer.cs │ │ └── FixedQuantumGameTime.cs │ ├── TimeLeakyBucketCollection.cs │ └── TokenBucket.cs └── VectorMath │ ├── Matrix3.cs │ ├── Orientation.cs │ ├── Point2.cs │ ├── Point3.cs │ ├── Transform3.cs │ ├── Vector2.cs │ └── Vector3.cs ├── MHServerEmu.DatabaseAccess ├── IDBAccountOwner.cs ├── IDBManager.cs ├── Interop │ ├── linux-x64 │ │ └── SQLite.Interop.dll │ └── win-x64 │ │ └── SQLite.Interop.dll ├── Json │ ├── DBAccountBinarySerializer.cs │ ├── DBAccountJsonSerializer.cs │ ├── DBEntityCollectionJsonConverter.cs │ ├── JsonDBManager.cs │ └── JsonDBManagerConfig.cs ├── MHServerEmu.DatabaseAccess.csproj ├── Models │ ├── DBAccount.cs │ ├── DBEntity.cs │ ├── DBEntityCollection.cs │ ├── DBPlayer.cs │ ├── Leaderboards │ │ ├── DBLeaderboard.cs │ │ ├── DBLeaderboardEntry.cs │ │ ├── DBLeaderboardInstance.cs │ │ ├── DBMetaEntry.cs │ │ ├── DBRewardEntry.cs │ │ └── LeaderboardRuleState.cs │ └── MigrationData.cs └── SQLite │ ├── SQLiteDBManager.cs │ ├── SQLiteDBManagerConfig.cs │ ├── SQLiteEntityTable.cs │ ├── SQLiteLeaderboardDBManager.cs │ ├── SQLiteScripts.cs │ └── Scripts │ ├── InitializeDatabase.sql │ ├── InitializeLeaderboardsDatabase.sql │ └── Migrations │ ├── 0.sql │ ├── 1.sql │ ├── 2.sql │ └── 3.sql ├── MHServerEmu.Frontend ├── FrontendClient.cs ├── FrontendConfig.cs ├── FrontendServer.cs └── MHServerEmu.Frontend.csproj ├── MHServerEmu.Games.Tests ├── Events │ └── EventTests.cs ├── MHServerEmu.Games.Tests.csproj └── Navi │ └── PredTests.cs ├── MHServerEmu.Games ├── Achievements │ ├── AchievementContext.cs │ ├── AchievementDatabase.cs │ ├── AchievementInfo.cs │ ├── AchievementManager.cs │ ├── AchievementProgress.cs │ └── AchievementState.cs ├── Behavior │ ├── AIController.cs │ ├── BehaviorBlackboard.cs │ ├── BehaviorSensorySystem.cs │ ├── ProceduralAI │ │ ├── ProceduralAI.cs │ │ └── ProceduralProfilesPvP.cs │ └── StaticAI │ │ ├── Delay.cs │ │ ├── Despawn.cs │ │ ├── Flank.cs │ │ ├── Flee.cs │ │ ├── Flock.cs │ │ ├── IAIState.cs │ │ ├── Interact.cs │ │ ├── MoveTo.cs │ │ ├── Orbit.cs │ │ ├── Rotate.cs │ │ ├── SelectEntity.cs │ │ ├── Teleport.cs │ │ ├── TriggerSpawners.cs │ │ ├── UseAffixPower.cs │ │ ├── UsePower.cs │ │ └── Wander.cs ├── Common │ ├── AdminCommandManager.cs │ ├── ArchiveExtensions.cs │ ├── Combat.cs │ ├── EntityTrackingContextMap.cs │ ├── ICommandParser.cs │ ├── Serializer.cs │ ├── SpatialPartitions │ │ ├── Node.cs │ │ ├── Quadtree.cs │ │ └── QuadtreeLocation.cs │ └── TuningTable.cs ├── CustomGameOptionsConfig.cs ├── DRAG │ ├── CellSetRegistry.cs │ ├── DRAGSystem.cs │ ├── GenCell.cs │ ├── GenCellContainer.cs │ ├── GenCellGridContainer.cs │ └── Generators │ │ ├── Areas │ │ ├── AreaGenerationInterface.cs │ │ ├── BaseGridAreaGenerator.cs │ │ ├── CanyonGridAreaGenerator.cs │ │ ├── CellGridGenerator.cs │ │ ├── Generator.cs │ │ ├── SingleCellAreaGenerator.cs │ │ ├── StaticAreaCellGenerator.cs │ │ ├── TowerAreaGenerator.cs │ │ └── WideGridAreaGenerator.cs │ │ └── Regions │ │ ├── RegionGenerator.cs │ │ ├── RegionTransition.cs │ │ ├── SequenceRegionGenerator.cs │ │ ├── SingleCellRegionGenerator.cs │ │ └── StaticRegionGenerator.cs ├── Data │ ├── Billing │ │ ├── Catalog.json │ │ └── CatalogPatch.json │ └── Game │ │ ├── Achievements │ │ ├── AchievementContextMap.json │ │ ├── AchievementInfoMap.json │ │ ├── AchievementNewThresholdUS.txt │ │ ├── AchievementPartyVisible.json │ │ ├── Off │ │ │ └── AchievementInfoMapParty.json │ │ └── eng.achievements.string │ │ ├── LiveTuningData.json │ │ ├── LiveTuningDataBugFixes.json │ │ └── Patches │ │ ├── Off │ │ ├── PatchDataCarnival.json │ │ ├── PatchDataGameBalance.json │ │ └── PatchDataTestOverrideLoot.json │ │ ├── PatchDataBugFixes.json │ │ ├── PatchDataMissions.json │ │ ├── PatchDataRestoredContent.json │ │ └── PatchDataSpecialEvents.json ├── Dialog │ ├── AttackOption.cs │ ├── CircleOption.cs │ ├── DialogOption.cs │ ├── EntitySelectorActionOption.cs │ ├── GameDialog.cs │ ├── GuildInviteOption.cs │ ├── InspectOption.cs │ ├── InteractionEnums.cs │ ├── InteractionManager.cs │ ├── InteractionOption.cs │ ├── ItemBuyOption.cs │ ├── ItemDonateOption.cs │ ├── ItemDonatePetTechOption.cs │ ├── ItemEquipOption.cs │ ├── ItemLinkInChatOption.cs │ ├── ItemMoveToGeneralInventoryOption.cs │ ├── ItemMoveToStashOption.cs │ ├── ItemMoveToTeamUpOption.cs │ ├── ItemMoveToTradeInventoryOption.cs │ ├── ItemPickupOption.cs │ ├── ItemSellOption.cs │ ├── ItemSlotCraftingIngredientOption.cs │ ├── ItemUseOption.cs │ ├── MissionOptions.cs │ ├── OpenMTXStoreOption.cs │ ├── PartyOption.cs │ ├── PostInteractStateOption.cs │ ├── ReportAsSpamOption.cs │ ├── ReportOption.cs │ ├── ResurrectOption.cs │ ├── StashOption.cs │ ├── StoryWarpOption.cs │ ├── ThrowOption.cs │ ├── TradeOption.cs │ ├── TrainerOption.cs │ ├── TransitionOption.cs │ ├── UIWidgetOption.cs │ └── VendorOption.cs ├── Entities │ ├── Agent.cs │ ├── Avatars │ │ ├── AbilityKeyMapping.cs │ │ ├── Avatar.AlternateAdvancement.cs │ │ ├── Avatar.cs │ │ ├── AvatarEnums.cs │ │ ├── AvatarIterator.cs │ │ ├── HotkeyData.cs │ │ ├── PendingAction.cs │ │ └── PendingPowerData.cs │ ├── Bounds.cs │ ├── ConditionCollection.cs │ ├── Entity.cs │ ├── EntityActionComponent.cs │ ├── EntityDesc.cs │ ├── EntityDestroyListNodePool.cs │ ├── EntityHelper.cs │ ├── EntityManager.cs │ ├── EntityOctree.cs │ ├── EntitySettings.cs │ ├── EntityTracker.cs │ ├── Hotspot.cs │ ├── InterestReferences.cs │ ├── Inventories │ │ ├── Inventory.cs │ │ ├── InventoryCollection.cs │ │ ├── InventoryEnums.cs │ │ ├── InventoryIterator.cs │ │ ├── InventoryLocation.cs │ │ ├── InventoryMetaData.cs │ │ └── VendorPurchaseData.cs │ ├── Items │ │ ├── AffixPropertiesCopyEntry.cs │ │ ├── AffixSpec.cs │ │ ├── BuiltInAffixDetails.cs │ │ ├── Item.ItemActions.cs │ │ ├── Item.cs │ │ └── ItemSpec.cs │ ├── KismetSequenceEntity.cs │ ├── Locomotion │ │ ├── LocomotionState.cs │ │ └── Locomotor.cs │ ├── Missile.cs │ ├── Options │ │ ├── GameplayOptions.cs │ │ └── StashTabOptions.cs │ ├── Persistence │ │ ├── PersistenceHelper.cs │ │ └── PlayerVersioning.cs │ ├── Physics │ │ ├── EntityPhysics.cs │ │ ├── ForceSystem.cs │ │ └── PhysicsManager.cs │ ├── Player.Crafting.cs │ ├── Player.Vendors.cs │ ├── Player.cs │ ├── PlayerIterator.cs │ ├── PowerCollections │ │ ├── PowerCollection.cs │ │ ├── PowerCollectionRecord.cs │ │ └── PowerIndexProperties.cs │ ├── RegionLocation.cs │ ├── Spawner.cs │ ├── SummonedEntityIterator.cs │ ├── TagPlayers.cs │ ├── Transition.cs │ ├── TransitionDestination.cs │ ├── WorldEntity.Procs.cs │ └── WorldEntity.cs ├── Events │ ├── Event.cs │ ├── EventGroup.cs │ ├── EventPointer.cs │ ├── EventScheduler.cs │ ├── IScheduledEventFilter.cs │ ├── ScheduledEvent.cs │ ├── ScheduledEventPool.cs │ ├── ScoringEvents.cs │ └── Templates │ │ ├── CallMethodEvent.cs │ │ ├── CallMethodEventParam1.cs │ │ ├── CallMethodEventParam2.cs │ │ ├── CallMethodEventParam3.cs │ │ └── TargetedScheduledEvent.cs ├── Game.cs ├── GameData │ ├── Calligraphy │ │ ├── AssetDirectory.cs │ │ ├── AssetType.cs │ │ ├── Attributes │ │ │ ├── AssetEnumAttribute.cs │ │ │ ├── DoNotCopyAttribute.cs │ │ │ └── MixinAttribute.cs │ │ ├── Blueprint.cs │ │ ├── CalligraphyConsts.cs │ │ ├── CalligraphyHeader.cs │ │ ├── CalligraphySerializer.Parsing.cs │ │ ├── CalligraphySerializer.cs │ │ ├── Curve.cs │ │ ├── CurveDirectory.cs │ │ ├── PropertyBuilder.cs │ │ ├── PrototypeMixinList.cs │ │ ├── PrototypePropertyCollection.cs │ │ └── ReplacementDirectory.cs │ ├── DataDirectory.cs │ ├── DataRefManager.cs │ ├── DataRefTypes.cs │ ├── GameDataConfig.cs │ ├── GameDataExtensions.cs │ ├── GameDataSerializer.cs │ ├── GameDatabase.cs │ ├── LiveTuning │ │ ├── LiveTuningData.cs │ │ ├── LiveTuningManager.cs │ │ ├── LiveTuningUpdateValue.cs │ │ └── TuningVarArray.cs │ ├── PakFile.cs │ ├── PakFileSystem.cs │ ├── PatchManager │ │ ├── PrototypePatchEntry.cs │ │ └── PrototypePatchManager.cs │ ├── PrototypeClassManager.cs │ ├── PrototypeFieldTypes.cs │ ├── PrototypeIterator.cs │ ├── Prototypes │ │ ├── AI │ │ │ ├── BehaviorPrototype.cs │ │ │ ├── ProceduralContextPrototype.cs │ │ │ └── Profiles │ │ │ │ ├── ProceduralAIProfilePrototype.cs │ │ │ │ ├── ProceduralProfilePersonalPrototype.cs │ │ │ │ ├── ProceduralProfileWithAttackPrototype.cs │ │ │ │ └── ProceduralProfileWithTargetPrototype.cs │ │ ├── AffixPrototype.cs │ │ ├── AgentPrototype.cs │ │ ├── AreaPrototype.cs │ │ ├── AvatarPrototype.cs │ │ ├── BoundsPrototype.cs │ │ ├── CellPrototype.cs │ │ ├── ChapterPrototype.cs │ │ ├── ChatCommandPrototype.cs │ │ ├── ConditionPrototype.cs │ │ ├── CraftingPrototype.cs │ │ ├── DifficultyPrototype.cs │ │ ├── DistrictPrototype.cs │ │ ├── DownloadChunkPrototype.cs │ │ ├── DropRestrictionPrototype.cs │ │ ├── EncounterResourcePrototype.cs │ │ ├── EntityFilterPrototype.cs │ │ ├── EntityPrototype.cs │ │ ├── EvalPrototype.cs │ │ ├── FullscreenMoviePrototype.cs │ │ ├── GameEventPrototype.cs │ │ ├── Generators │ │ │ ├── AreaGeneratorPrototype.cs │ │ │ ├── BaseGridAreaGeneratorPrototype.cs │ │ │ ├── CanyonGridAreaGeneratorPrototype.cs │ │ │ ├── RegionGeneratorPrototype.cs │ │ │ ├── SequenceRegionGeneratorPrototype.cs │ │ │ ├── SingleCellRegionGeneratorPrototype.cs │ │ │ ├── StaticRegionGeneratorPrototype.cs │ │ │ └── SuperCellPrototype.cs │ │ ├── GlobalsPrototype.cs │ │ ├── InventoryPrototype.cs │ │ ├── InventorySortPrototype.cs │ │ ├── ItemCostPrototype.cs │ │ ├── ItemPrototype.cs │ │ ├── KeywordPrototype.cs │ │ ├── LeaderboardPrototype.cs │ │ ├── LootActionPrototypes.cs │ │ ├── LootCooldownPrototypes.cs │ │ ├── LootDropPrototypes.cs │ │ ├── LootMutationPrototypes.cs │ │ ├── LootRollModifierPrototype.cs │ │ ├── LootSpawnModifierPrototypes.cs │ │ ├── LootSpawnTablePrototype.cs │ │ ├── LootTablePrototype.cs │ │ ├── ManaBehaviorPrototype.cs │ │ ├── Markers │ │ │ ├── CellConnectorMarkerPrototype.cs │ │ │ ├── DotCornerMarkerPrototype.cs │ │ │ ├── EntityMarkerPrototype.cs │ │ │ ├── MarkerPrototype.cs │ │ │ ├── ResourceMarkerPrototype.cs │ │ │ ├── RoadConnectionMarkerPrototype.cs │ │ │ └── UnrealPropMarkerPrototype.cs │ │ ├── MetaGame │ │ │ ├── MetaGamePrototype.cs │ │ │ └── MetaStatePrototype.cs │ │ ├── MissilePrototype.cs │ │ ├── Missions │ │ │ ├── MissionActionPrototype.cs │ │ │ ├── MissionConditionPrototype.cs │ │ │ └── MissionPrototype.cs │ │ ├── MovementBehaviorPrototype.cs │ │ ├── NaviFragmentPrototype.cs │ │ ├── NaviPatchPrototype.cs │ │ ├── PartyFilterRulePrototype.cs │ │ ├── PathCollectionPrototype.cs │ │ ├── PickWeightPrototype.cs │ │ ├── PlayerPrototype.cs │ │ ├── PopulationObjectPrototype.cs │ │ ├── PopulationPrototype.cs │ │ ├── PowerPrototype.cs │ │ ├── ProceduralPropPrototype.cs │ │ ├── PropPrototype.cs │ │ ├── PropSetPrototype.cs │ │ ├── PropertyInfoPrototype.cs │ │ ├── PropertyPrototype.cs │ │ ├── Prototype.cs │ │ ├── RegionAffixPrototype.cs │ │ ├── RegionPrototype.cs │ │ ├── ScoringEventPrototype.cs │ │ ├── SummonPowerPrototype.cs │ │ ├── TooltipSectionPrototype.cs │ │ ├── TowerAreaGeneratorPrototype.cs │ │ ├── TypesPrototype.cs │ │ ├── UIMapInfoPrototype.cs │ │ ├── UIPrototype.cs │ │ └── VendorTypePrototype.cs │ ├── Resources │ │ ├── BinaryResourceHeader.cs │ │ ├── BinaryResourceSerializer.cs │ │ ├── IBinaryResource.cs │ │ └── ResourcePrototypeHashes.cs │ └── Tables │ │ ├── AllianceTable.cs │ │ ├── EquipmentSlotTable.cs │ │ ├── GameDataTables.cs │ │ ├── InfinityGemBonusPostreqsTable.cs │ │ ├── InfinityGemBonusTable.cs │ │ ├── LootCooldownTable.cs │ │ ├── LootPickingTable.cs │ │ ├── OmegaBonusPostreqsTable.cs │ │ ├── OmegaBonusSetTable.cs │ │ └── PowerOwnerTable.cs ├── GameOptionsConfig.cs ├── Leaderboards │ ├── LeaderboardInfo.cs │ ├── LeaderboardInfoCache.cs │ └── LeaderboardManager.cs ├── Locales │ ├── Locale.cs │ ├── LocaleManager.cs │ └── StringFile.cs ├── Loot │ ├── AffixPickerTable.cs │ ├── AffixRecord.cs │ ├── DropFilterArguments.cs │ ├── IItemResolver.cs │ ├── ItemResolver.cs │ ├── ItemResolverContext.cs │ ├── LootCloneRecord.cs │ ├── LootEnums.cs │ ├── LootInputSettings.cs │ ├── LootLocationData.cs │ ├── LootManager.cs │ ├── LootResult.cs │ ├── LootResultSummary.cs │ ├── LootRollSettings.cs │ ├── LootSpawnGrid.cs │ ├── LootUtilities.cs │ ├── LootVaporizer.cs │ ├── RarityEntry.cs │ ├── ScopedAffixRef.cs │ ├── Specs │ │ ├── AgentSpec.cs │ │ ├── CurrencySpec.cs │ │ └── VendorXPSummary.cs │ └── Visitors │ │ ├── ILootTableNodeVisitor.cs │ │ ├── LootTableContainsMutationOfType.cs │ │ └── LootTableContainsNodeOfType.cs ├── MHServerEmu.Games.csproj ├── MTXStore │ ├── BillingConfig.cs │ ├── CatalogManager.cs │ └── Catalogs │ │ ├── BannerUrl.cs │ │ ├── Catalog.cs │ │ ├── CatalogEntry.cs │ │ ├── CatalogEntryType.cs │ │ ├── CatalogEntryTypeModifier.cs │ │ ├── CatalogGuidEntry.cs │ │ ├── LocalizedCatalogEntry.cs │ │ ├── LocalizedCatalogEntryUrlOrData.cs │ │ └── LocalizedCatalogUrls.cs ├── MetaGames │ ├── GameModes │ │ ├── MetaGameMode.cs │ │ ├── MetaGameModeIdle.cs │ │ ├── MetaGameModeShutdown.cs │ │ ├── MetaGameStateMode.cs │ │ ├── NexusPvPMainMode.cs │ │ ├── PvEScaleGameMode.cs │ │ ├── PvEWaveGameMode.cs │ │ └── PvPDefenderGameMode.cs │ ├── MetaGame.cs │ ├── MetaGameTeam.cs │ ├── MetaStates │ │ ├── MetaState.cs │ │ ├── MetaStateCombatQueueLockout.cs │ │ ├── MetaStateEntityEventCounter.cs │ │ ├── MetaStateEntityModifier.cs │ │ ├── MetaStateLimitPlayerDeaths.cs │ │ ├── MetaStateLimitPlayerDeathsPerMission.cs │ │ ├── MetaStateMissionActivate.cs │ │ ├── MetaStateMissionProgression.cs │ │ ├── MetaStateMissionRestart.cs │ │ ├── MetaStateMissionSequencer.cs │ │ ├── MetaStateMissionStateListener.cs │ │ ├── MetaStatePopulationMaintain.cs │ │ ├── MetaStateRegionPlayerAccess.cs │ │ ├── MetaStateScoringEventTimerEnd.cs │ │ ├── MetaStateScoringEventTimerStart.cs │ │ ├── MetaStateScoringEventTimerStop.cs │ │ ├── MetaStateShutdown.cs │ │ ├── MetaStateStartTargetOverride.cs │ │ ├── MetaStateTimedBonus.cs │ │ ├── MetaStateTrackRegionScore.cs │ │ └── MetaStateWaveInstance.cs │ ├── MissionMetaGame.cs │ ├── PvP.cs │ └── ScoreTable.cs ├── Missions │ ├── Actions │ │ ├── IMissionActionOwner.cs │ │ ├── MissionAction.cs │ │ ├── MissionActionAllianceSet.cs │ │ ├── MissionActionAvatarResetUltimateCooldown.cs │ │ ├── MissionActionDangerRoomReturnScenarioItem.cs │ │ ├── MissionActionDifficultyOverride.cs │ │ ├── MissionActionDisableRegionAvatarSwap.cs │ │ ├── MissionActionDisableRegionRestrictedRoster.cs │ │ ├── MissionActionEnableRegionAvatarSwap.cs │ │ ├── MissionActionEnableRegionRestrictedRoster.cs │ │ ├── MissionActionEncounterSpawn.cs │ │ ├── MissionActionEntSelEvtBroadcast.cs │ │ ├── MissionActionEntityCreate.cs │ │ ├── MissionActionEntityDestroy.cs │ │ ├── MissionActionEntityKill.cs │ │ ├── MissionActionEntityPerformPower.cs │ │ ├── MissionActionEntitySetState.cs │ │ ├── MissionActionEntityTarget.cs │ │ ├── MissionActionEventTeamAssign.cs │ │ ├── MissionActionFactionSet.cs │ │ ├── MissionActionHideHUDTutorial.cs │ │ ├── MissionActionHideWaypointNotification.cs │ │ ├── MissionActionInventoryGiveAvatar.cs │ │ ├── MissionActionInventoryGiveTeamUp.cs │ │ ├── MissionActionInventoryRemoveItem.cs │ │ ├── MissionActionList.cs │ │ ├── MissionActionMetaStateWaveForce.cs │ │ ├── MissionActionMissionActivate.cs │ │ ├── MissionActionOpenUIPanel.cs │ │ ├── MissionActionParticipantPerformPower.cs │ │ ├── MissionActionPlayBanter.cs │ │ ├── MissionActionPlayKismetSeq.cs │ │ ├── MissionActionPlayerTeleport.cs │ │ ├── MissionActionRegionScore.cs │ │ ├── MissionActionRegionShutdown.cs │ │ ├── MissionActionRemoveConditionsKwd.cs │ │ ├── MissionActionResetAllMissions.cs │ │ ├── MissionActionScoringEventTimerEnd.cs │ │ ├── MissionActionScoringEventTimerStart.cs │ │ ├── MissionActionScoringEventTimerStop.cs │ │ ├── MissionActionSetActiveChapter.cs │ │ ├── MissionActionSetAvatarEndurance.cs │ │ ├── MissionActionSetAvatarHealth.cs │ │ ├── MissionActionShowBannerMessage.cs │ │ ├── MissionActionShowHUDTutorial.cs │ │ ├── MissionActionShowMotionComic.cs │ │ ├── MissionActionShowOverheadText.cs │ │ ├── MissionActionShowTeamSelectDialog.cs │ │ ├── MissionActionShowWaypointNotification.cs │ │ ├── MissionActionSpawnerTrigger.cs │ │ ├── MissionActionStoryNotification.cs │ │ ├── MissionActionSwapAvatar.cs │ │ ├── MissionActionTimedAction.cs │ │ ├── MissionActionUnlockUISystem.cs │ │ ├── MissionActionUpdateMatch.cs │ │ ├── MissionActionWaypointLock.cs │ │ └── MissionActionWaypointUnlock.cs │ ├── Conditions │ │ ├── IMissionConditionOwner.cs │ │ ├── MissionCondition.cs │ │ ├── MissionConditionActiveChapter.cs │ │ ├── MissionConditionAnd.cs │ │ ├── MissionConditionAreaBeginTravelTo.cs │ │ ├── MissionConditionAreaContains.cs │ │ ├── MissionConditionAreaEnter.cs │ │ ├── MissionConditionAreaLeave.cs │ │ ├── MissionConditionAvatarIsActive.cs │ │ ├── MissionConditionAvatarIsUnlocked.cs │ │ ├── MissionConditionAvatarLevelUp.cs │ │ ├── MissionConditionAvatarUsedPower.cs │ │ ├── MissionConditionCellEnter.cs │ │ ├── MissionConditionCellLeave.cs │ │ ├── MissionConditionClusterEnemiesCleared.cs │ │ ├── MissionConditionCohort.cs │ │ ├── MissionConditionContains.cs │ │ ├── MissionConditionCount.cs │ │ ├── MissionConditionCurrencyCollected.cs │ │ ├── MissionConditionEmotePerformed.cs │ │ ├── MissionConditionEntityAggro.cs │ │ ├── MissionConditionEntityDamaged.cs │ │ ├── MissionConditionEntityDeath.cs │ │ ├── MissionConditionEntityInteract.cs │ │ ├── MissionConditionFaction.cs │ │ ├── MissionConditionGlobalEventComplete.cs │ │ ├── MissionConditionHealthRange.cs │ │ ├── MissionConditionHotspotContains.cs │ │ ├── MissionConditionHotspotEnter.cs │ │ ├── MissionConditionHotspotLeave.cs │ │ ├── MissionConditionInventoryCapacity.cs │ │ ├── MissionConditionItemBuy.cs │ │ ├── MissionConditionItemCollect.cs │ │ ├── MissionConditionItemCraft.cs │ │ ├── MissionConditionItemDonate.cs │ │ ├── MissionConditionItemEquip.cs │ │ ├── MissionConditionKismetSeqFinished.cs │ │ ├── MissionConditionList.cs │ │ ├── MissionConditionLogicFalse.cs │ │ ├── MissionConditionLogicTrue.cs │ │ ├── MissionConditionMemberOfEventTeam.cs │ │ ├── MissionConditionMetaGameComplete.cs │ │ ├── MissionConditionMetaStateComplete.cs │ │ ├── MissionConditionMetaStateDeathLimitHit.cs │ │ ├── MissionConditionMissionComplete.cs │ │ ├── MissionConditionMissionFailed.cs │ │ ├── MissionConditionObjectiveComplete.cs │ │ ├── MissionConditionOr.cs │ │ ├── MissionConditionOrbPickUp.cs │ │ ├── MissionConditionPartySize.cs │ │ ├── MissionConditionPowerEquip.cs │ │ ├── MissionConditionPowerPointsRemaining.cs │ │ ├── MissionConditionPublicEventIsActive.cs │ │ ├── MissionConditionRegionBeginTravelTo.cs │ │ ├── MissionConditionRegionContains.cs │ │ ├── MissionConditionRegionEnter.cs │ │ ├── MissionConditionRegionHasMatch.cs │ │ ├── MissionConditionRegionLeave.cs │ │ ├── MissionConditionRemoteNotification.cs │ │ ├── MissionConditionSpawnerDefeated.cs │ │ ├── MissionConditionTeamUpIsActive.cs │ │ ├── MissionConditionTeamUpIsUnlocked.cs │ │ ├── MissionConditionThrowablePickUp.cs │ │ └── MissionPlayerCondition.cs │ ├── IMissionManagerOwner.cs │ ├── InteractionTag.cs │ ├── Mission.cs │ ├── MissionConditionPrototypeIterator.cs │ ├── MissionManager.cs │ └── MissionObjective.cs ├── Navi │ ├── ICanBlock.cs │ ├── NaviCdt.cs │ ├── NaviEar.cs │ ├── NaviEdge.cs │ ├── NaviEdgePathingFlags.cs │ ├── NaviFunnel.cs │ ├── NaviMesh.cs │ ├── NaviPath.cs │ ├── NaviPathGenerator.cs │ ├── NaviPathNode.cs │ ├── NaviPoint.cs │ ├── NaviSvgHelper.cs │ ├── NaviSweep.cs │ ├── NaviSystem.cs │ ├── NaviTriangle.cs │ ├── NaviUtil.cs │ ├── NaviVertexLookupCache.cs │ ├── PathCache.cs │ └── Pred.cs ├── Network │ ├── ArchiveMessageBuilder.cs │ ├── AreaOfInterest.cs │ ├── GameServiceMailbox.cs │ ├── IArchiveMessageDispatcher.cs │ ├── IArchiveMessageHandler.cs │ ├── InstanceManagement │ │ ├── GameInstanceConfig.cs │ │ ├── GameInstanceService.cs │ │ ├── GameManager.cs │ │ ├── GameThread.cs │ │ └── GameThreadManager.cs │ ├── MigrationUtility.cs │ ├── NetworkEnums.cs │ ├── Parsing │ │ ├── ArchiveParser.cs │ │ ├── MessagePrinter.PrintMethods.cs │ │ └── MessagePrinter.cs │ ├── PlayerConnection.cs │ ├── PlayerConnectionManager.cs │ ├── RepVar.cs │ └── TransferParams.cs ├── Populations │ ├── BlackOutZone.cs │ ├── ClusterObject.cs │ ├── PopulationArea.cs │ ├── PopulationManager.cs │ ├── PopulationObject.cs │ ├── PropSpawnVisitor.cs │ ├── PropTable.cs │ ├── SpawnEvent.cs │ ├── SpawnLocation.cs │ ├── SpawnMap.cs │ ├── SpawnMarkerRegistry.cs │ ├── SpawnPicker.cs │ ├── SpawnReservation.cs │ ├── SpawnScheduler.cs │ └── SpawnSpec.cs ├── Powers │ ├── Conditions │ │ ├── Condition.cs │ │ ├── ConditionFilter.cs │ │ ├── ConditionPool.cs │ │ ├── ConditionStore.cs │ │ └── TrackedCondition.cs │ ├── DamageConversionContext.cs │ ├── MissilePower.cs │ ├── MovementPowerEntityCollideFunc.cs │ ├── Power.PowerEvents.cs │ ├── Power.Validation.cs │ ├── Power.cs │ ├── PowerActivationSettings.cs │ ├── PowerApplication.cs │ ├── PowerEffectsPacket.cs │ ├── PowerEnums.cs │ ├── PowerPayload.cs │ ├── PowerProgressionInfo.cs │ ├── PowerResults.cs │ ├── SituationalPowerComponent.cs │ ├── SituationalTrigger.cs │ └── SummonPower.cs ├── Properties │ ├── Evals │ │ ├── Eval.cs │ │ ├── EvalContextData.cs │ │ ├── EvalContextVar.cs │ │ ├── EvalEnums.cs │ │ ├── EvalVar.cs │ │ └── EvalVarValue.cs │ ├── IPropertyChangeWatcher.cs │ ├── Property.cs │ ├── PropertyCollection.cs │ ├── PropertyEnum.cs │ ├── PropertyEnumFilter.cs │ ├── PropertyId.cs │ ├── PropertyInfo.cs │ ├── PropertyInfoTable.cs │ ├── PropertyList.cs │ ├── PropertyStore.cs │ ├── PropertyTicker.cs │ ├── PropertyTickerManager.cs │ ├── PropertyValue.cs │ └── ReplicatedPropertyCollection.cs ├── Regions │ ├── Area.cs │ ├── AreaSettings.cs │ ├── Bodyslider.cs │ ├── Cell.cs │ ├── CellSettings.cs │ ├── Events.cs │ ├── Maps │ │ ├── LowResMap.cs │ │ └── MapDiscoveryData.cs │ ├── MatchQueues │ │ ├── MatchQueuePlayerInfoEntry.cs │ │ ├── MatchQueueRegionStatus.cs │ │ └── MatchQueueStatus.cs │ ├── ObjectiveGraphs │ │ ├── ObjectiveGraph.cs │ │ ├── ObjectiveGraphConnection.cs │ │ ├── ObjectiveGraphEnums.cs │ │ └── ObjectiveGraphNode.cs │ ├── POIPickers │ │ ├── POISpiderNode.cs │ │ ├── RegionPOIPickerCollection.cs │ │ └── RegionPOIPickerSpider.cs │ ├── Region.cs │ ├── RegionEnums.cs │ ├── RegionManager.cs │ ├── RegionProgressionGraph.cs │ ├── RegionProgressionNode.cs │ ├── RegionSettings.cs │ ├── ReservedSpawn.cs │ ├── Teleporter.cs │ └── WorldViewCache.cs ├── Social │ ├── ChatManager.cs │ ├── Communities │ │ ├── AvatarSlotInfo.cs │ │ ├── Community.cs │ │ ├── CommunityCircle.cs │ │ ├── CommunityCircleManager.cs │ │ ├── CommunityCirclePrototype.cs │ │ └── CommunityMember.cs │ ├── Guilds │ │ └── GuildMember.cs │ └── Parties │ │ ├── Party.cs │ │ ├── PartyManager.cs │ │ └── PartyMemberInfo.cs └── UI │ ├── DialogButton.cs │ ├── DialogResponse.cs │ ├── GameDialogInstance.cs │ ├── GameDialogManager.cs │ ├── IUIDataProviderOwner.cs │ ├── LocaleStringMessageHandler.cs │ ├── UIDataProvider.cs │ ├── UISyncData.cs │ └── Widgets │ ├── UIWidgetButton.cs │ ├── UIWidgetEntityIconsSyncData.cs │ ├── UIWidgetGenericFraction.cs │ ├── UIWidgetMissionText.cs │ └── UIWidgetReadyCheck.cs ├── MHServerEmu.Grouping ├── ChatHelper.cs ├── GroupingChatManager.cs ├── GroupingClientManager.cs ├── GroupingManagerConfig.cs ├── GroupingManagerService.cs ├── GroupingServiceMailbox.cs └── MHServerEmu.Grouping.csproj ├── MHServerEmu.Leaderboards ├── Leaderboard.cs ├── LeaderboardDatabase.cs ├── LeaderboardEntry.cs ├── LeaderboardInstance.cs ├── LeaderboardRewardManager.cs ├── LeaderboardScheduler.cs ├── LeaderboardService.cs ├── LeaderboardsConfig.cs ├── MHServerEmu.Leaderboards.csproj └── MetaLeaderboardEntry.cs ├── MHServerEmu.PlayerManagement ├── Auth │ ├── AuthStatusCodes.cs │ ├── ClientSession.cs │ └── SessionManager.cs ├── Games │ ├── GameHandle.cs │ └── GameHandleManager.cs ├── MHServerEmu.PlayerManagement.csproj ├── Network │ └── PlayerManagerServiceMailbox.cs ├── PlayerManagerConfig.cs ├── PlayerManagerService.cs ├── Players │ ├── AccountManager.cs │ ├── ClientManager.cs │ ├── LoginQueueManager.cs │ └── PlayerHandle.cs ├── Regions │ ├── RegionHandle.cs │ ├── RegionLoadBalancer.cs │ ├── RegionReport.cs │ ├── WorldManager.cs │ └── WorldView.cs └── Social │ ├── CommunityMemberEntry.cs │ ├── CommunityRegistry.cs │ ├── MasterParty.cs │ ├── MasterPartyManager.cs │ └── PlayerNameCache.cs ├── MHServerEmu.WebFrontend ├── Data │ └── Web │ │ ├── Dashboard │ │ ├── config.js │ │ ├── index.html │ │ ├── script.js │ │ └── style.css │ │ └── MTXStore │ │ └── add-g.html ├── Handlers │ ├── MTXStore │ │ └── AddGWebHandler.cs │ ├── NotFoundWebHandler.cs │ ├── ProtobufWebHandler.cs │ ├── StaticFileWebHandler.cs │ ├── TrailingSlashRedirectWebHandler.cs │ └── WebApi │ │ ├── AccountCreateWebHandler.cs │ │ ├── MetricsPerformanceWebHandler.cs │ │ ├── RegionReportWebHandler.cs │ │ └── ServerStatusWebHandler.cs ├── MHServerEmu.WebFrontend.csproj ├── WebFrontendConfig.cs └── WebFrontendService.cs ├── MHServerEmu ├── Commands │ ├── Attributes │ │ ├── CommandAttribute.cs │ │ ├── CommandDescriptionAttribute.cs │ │ ├── CommandGroupAttribute.cs │ │ ├── CommandGroupDescriptionAttribute.cs │ │ ├── CommandGroupFlagsAttribute.cs │ │ ├── CommandGroupUserLevelAttribute.cs │ │ ├── CommandInvokerTypeAttribute.cs │ │ ├── CommandParamCountAttribute.cs │ │ ├── CommandUsageAttribute.cs │ │ ├── CommandUserLevelAttribute.cs │ │ └── DefaultCommandAttribute.cs │ ├── CommandDefinition.cs │ ├── CommandDocsGenerator.cs │ ├── CommandGroup.cs │ ├── CommandGroupDefinition.cs │ ├── CommandHelper.cs │ ├── CommandManager.cs │ ├── CommandParser.cs │ ├── FrontendClientChatOutput.cs │ ├── IClientOutput.cs │ └── Implementations │ │ ├── AOICommands.cs │ │ ├── AccountCommands.cs │ │ ├── AchievementCommands.cs │ │ ├── BoostCommands.cs │ │ ├── ClientCommands.cs │ │ ├── DebugCommands.cs │ │ ├── EntityCommands.cs │ │ ├── InstanceCommands.cs │ │ ├── ItemCommands.cs │ │ ├── LeaderboardsCommands.cs │ │ ├── LevelCommands.cs │ │ ├── LookupCommands.cs │ │ ├── MetaGameCommands.cs │ │ ├── MiscCommands.cs │ │ ├── MissionCommands.cs │ │ ├── PlayerCommands.cs │ │ ├── PowerCommands.cs │ │ ├── RegionCommands.cs │ │ ├── ServerCommands.cs │ │ ├── StoreCommands.cs │ │ └── UnlockCommands.cs ├── Config.ini ├── MHServerEmu.csproj ├── Program.cs ├── ServerApp.cs └── icon.ico └── Tools ├── MHExecutableAnalyzer ├── ExecutableLoader.cs ├── FilePathExtractor.cs ├── MHExecutableAnalyzer.csproj └── Program.cs ├── MHPakTool ├── Extensions.cs ├── HashHelper.cs ├── MHPakTool.csproj ├── PakEntry.cs ├── PakFile.cs └── Program.cs ├── Scripts └── protogen.bat └── Setup ├── MainForm.Designer.cs ├── MainForm.cs ├── MainForm.resx ├── Program.cs ├── Setup.csproj ├── SetupHelper.cs └── icon.ico /.github/workflows/nightly-release-linux-x64.yml: -------------------------------------------------------------------------------- 1 | name: Nightly Release (Linux x64) 2 | 3 | on: 4 | schedule: 5 | - cron: '15 7 * * *' 6 | 7 | jobs: 8 | build: 9 | 10 | runs-on: ubuntu-latest 11 | 12 | steps: 13 | - uses: actions/checkout@v4 14 | - name: Setup .NET 15 | uses: actions/setup-dotnet@v4 16 | with: 17 | dotnet-version: 8.0.x 18 | - name: Restore dependencies 19 | run: dotnet restore MHServerEmu.sln 20 | - name: Build 21 | run: dotnet build MHServerEmu.sln --no-restore --configuration Release 22 | - name: Run tests 23 | run: dotnet test MHServerEmu.sln --no-restore --no-build --configuration Release 24 | - name: Get current date 25 | run: echo "DATE=$(date +'%Y%m%d')" >> $GITHUB_ENV 26 | - name: Upload artifact 27 | uses: actions/upload-artifact@v4 28 | with: 29 | name: MHServerEmu-nightly-${{ env.DATE }}-Release-linux-x64 30 | path: | 31 | ./src/MHServerEmu/bin/x64/Release/net8.0 32 | !./src/MHServerEmu/bin/x64/Release/net8.0/*.pdb 33 | !./src/MHServerEmu/bin/x64/Release/net8.0/*.xml 34 | -------------------------------------------------------------------------------- /.github/workflows/nightly-release-windows-x64.yml: -------------------------------------------------------------------------------- 1 | name: Nightly Release (Windows x64) 2 | 3 | on: 4 | schedule: 5 | - cron: '15 7 * * *' 6 | 7 | jobs: 8 | build: 9 | 10 | runs-on: windows-latest 11 | 12 | steps: 13 | - uses: actions/checkout@v4 14 | - name: Setup .NET 15 | uses: actions/setup-dotnet@v4 16 | with: 17 | dotnet-version: 8.0.x 18 | - name: Restore dependencies 19 | run: dotnet restore MHServerEmu.sln 20 | - name: Build 21 | run: dotnet build MHServerEmu.sln --no-restore --configuration Release 22 | - name: Run tests 23 | run: dotnet test MHServerEmu.sln --no-restore --no-build --configuration Release 24 | - name: Get current date 25 | run: echo "DATE=$(date +'%Y%m%d')" >> $env:GITHUB_ENV 26 | - name: Upload artifact 27 | uses: actions/upload-artifact@v4 28 | with: 29 | name: MHServerEmu-nightly-${{ env.DATE }}-Release-windows-x64 30 | path: | 31 | ./src/MHServerEmu/bin/x64/Release/net8.0 32 | !./src/MHServerEmu/bin/x64/Release/net8.0/*.pdb 33 | !./src/MHServerEmu/bin/x64/Release/net8.0/*.xml 34 | -------------------------------------------------------------------------------- /CREDITS.md: -------------------------------------------------------------------------------- 1 | # MHServerEmu Thanks/Credits file 2 | 3 | ## Contributors 4 | 5 | - AlexBond 6 | 7 | - Crypto137 8 | 9 | - Kawaikikinou 10 | 11 | - SirLimbo 12 | 13 | - yn01 14 | 15 | ## Special Thanks 16 | 17 | - Denys Smirnov for his [protod](https://github.com/dennwc/protod) tool that has been invaluable for reverse engineering the network protocol. 18 | 19 | - mooege and diiis for inspiration. 20 | 21 | - All the Discord MVPs and taskmasters who help us. 22 | 23 | - Black Cat for her abilities of math and cheating death. 24 | 25 | - All the people who worked on the game in any capacity. 26 | -------------------------------------------------------------------------------- /assets/LiveLoadingTips.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | true 4 | true 5 | You can change what is displayed here by editing LiveLoadingTips.xml. 6 | 7 | -------------------------------------------------------------------------------- /assets/ssl/server.crt: -------------------------------------------------------------------------------- 1 | -----BEGIN CERTIFICATE----- 2 | MIIDTDCCAjSgAwIBAgIUNgH/b8j1AoYpb4Kj4rTmhCj1QAowDQYJKoZIhvcNAQEL 3 | BQAwUzEcMBoGA1UECgwTVEVTVElORyBDRVJUSUZJQ0FURTEfMB0GA1UECwwWTk9U 4 | IEZPUiBUUlVTVCBQVVJQT1NFUzESMBAGA1UEAwwJbG9jYWxob3N0MB4XDTIzMDEx 5 | NzE5NDAwNFoXDTIzMDcxOTE5NDAwNFowUzEcMBoGA1UECgwTVEVTVElORyBDRVJU 6 | SUZJQ0FURTEfMB0GA1UECwwWTk9UIEZPUiBUUlVTVCBQVVJQT1NFUzESMBAGA1UE 7 | AwwJbG9jYWxob3N0MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEApFik 8 | BV/MVVVBQONGEVTguPh77nXscQ0JEzT2CAJrP1DNR53EhPgAxBbpPlxWt2QM9O8R 9 | XLyJfHfGSH+On43GiXWb/HhiiwVpiO6o+Vi96i1DXcogHZFqbpaZWe5BD4RxGRRw 10 | F9Z3aOtmZU71qaH1j/1eodK1i59Yq2tAGcqSzrtygRCCyUqdJ1Akx1tavIvIhRcL 11 | zT7Xb0L3AbR7xguqFiyfnI4eLYiAjDiIC02GCJd7SmcuVoY3A1l2+pRLwHU4LPjP 12 | fGJrB1OUGANtWN81FjnAQ1ikKUsptZnGfid9YWCvdT3IZgmCD//Wcxy5QxS7nDuv 13 | Dcy7M15wemS5zPuNmwIDAQABoxgwFjAUBgNVHREEDTALgglsb2NhbGhvc3QwDQYJ 14 | KoZIhvcNAQELBQADggEBAGXG/9fToONUkMB2UfO83gTE/1/w4eAkPOvKp0NeC3gZ 15 | 3Ep32sLaAsBan2L192aU4cHw5ebEDhIquxXGKdagH0HD23bJOF9Fc110mQEfzqA+ 16 | E4q4a2Zf8pqD3VRU+K5KW/j3BnwRp/l6waCrjUvMW5Dr5TZUjQfyLpbnDSnC5mNk 17 | htAfFdMegw8EsZIPrLODxag4qeqJkYIywu67k0ki6B9CSSdhw4+eip2aCAJaMNLO 18 | A/fZMYYJgNfkQM+18aK/IY7h7B62LyUSzsyoeIi2eCJNKNCxn1HLjNCUW0BlEKdF 19 | ZwQrf5AFodzjKkoTkTmmO19QtTE7LXo0xEQ3jPKGhB0= 20 | -----END CERTIFICATE----- 21 | -------------------------------------------------------------------------------- /dep/Dapper/Dapper.License: -------------------------------------------------------------------------------- 1 | The Dapper library and tools are licenced under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 2 | 3 | The Dapper logo is copyright Marc Gravell 2021 onwards; it is fine to use the Dapper logo when referencing the Dapper library and utilities, but 4 | the Dapper logo (including derivatives) must not be used in a way that misrepresents an external product or library as being affiliated or endorsed 5 | with Dapper. For example, you must not use the Dapper logo as the package icon on your own external tool (even if it uses Dapper internally), 6 | without written permission. If in doubt: ask. -------------------------------------------------------------------------------- /dep/Dapper/Dapper.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Crypto137/MHServerEmu/a9851b8e31549e75b8d6dfa12f3d44e678058c77/dep/Dapper/Dapper.dll -------------------------------------------------------------------------------- /dep/Free.Ports.zLib/Free.Ports.zLib.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Crypto137/MHServerEmu/a9851b8e31549e75b8d6dfa12f3d44e678058c77/dep/Free.Ports.zLib/Free.Ports.zLib.dll -------------------------------------------------------------------------------- /dep/K4os.Compression.LZ4/K4os.Compression.LZ4.License: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2017 Milosz Krajewski 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /dep/K4os.Compression.LZ4/K4os.Compression.LZ4.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Crypto137/MHServerEmu/a9851b8e31549e75b8d6dfa12f3d44e678058c77/dep/K4os.Compression.LZ4/K4os.Compression.LZ4.dll -------------------------------------------------------------------------------- /dep/RobustPredicates/RobustPredicates.License: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2021 Modios 4 | Copyright (c) 2024 Crypto137 5 | 6 | Permission is hereby granted, free of charge, to any person obtaining a copy 7 | of this software and associated documentation files (the "Software"), to deal 8 | in the Software without restriction, including without limitation the rights 9 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 10 | copies of the Software, and to permit persons to whom the Software is 11 | furnished to do so, subject to the following conditions: 12 | 13 | The above copyright notice and this permission notice shall be included in all 14 | copies or substantial portions of the Software. 15 | 16 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 17 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 18 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 19 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 20 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 21 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 22 | SOFTWARE. 23 | -------------------------------------------------------------------------------- /dep/RobustPredicates/RobustPredicates.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Crypto137/MHServerEmu/a9851b8e31549e75b8d6dfa12f3d44e678058c77/dep/RobustPredicates/RobustPredicates.dll -------------------------------------------------------------------------------- /dep/System.Data.SQLite/System.Data.SQLite.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Crypto137/MHServerEmu/a9851b8e31549e75b8d6dfa12f3d44e678058c77/dep/System.Data.SQLite/System.Data.SQLite.dll -------------------------------------------------------------------------------- /dep/ini-parser/INIFileParser.License: -------------------------------------------------------------------------------- 1 | The MIT License (MIT) 2 | 3 | Copyright (c) 2008 Ricardo Amores Hernández 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy of 6 | this software and associated documentation files (the "Software"), to deal in 7 | the Software without restriction, including without limitation the rights to 8 | use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of 9 | the Software, and to permit persons to whom the Software is furnished to do so, 10 | subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS 17 | FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR 18 | COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER 19 | IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN 20 | CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 21 | -------------------------------------------------------------------------------- /dep/ini-parser/INIFileParser.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Crypto137/MHServerEmu/a9851b8e31549e75b8d6dfa12f3d44e678058c77/dep/ini-parser/INIFileParser.dll -------------------------------------------------------------------------------- /dep/protobuf-csharp/Google.ProtocolBuffers.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Crypto137/MHServerEmu/a9851b8e31549e75b8d6dfa12f3d44e678058c77/dep/protobuf-csharp/Google.ProtocolBuffers.dll -------------------------------------------------------------------------------- /proto/ClientToGroupingManager.proto: -------------------------------------------------------------------------------- 1 | syntax = "proto2"; 2 | 3 | package Gazillion; 4 | 5 | message GetPlayerInfoByName { 6 | required string playerName = 1; 7 | } 8 | 9 | -------------------------------------------------------------------------------- /proto/GazillionCommon.proto: -------------------------------------------------------------------------------- 1 | syntax = "proto2"; 2 | 3 | package Gazillion; 4 | 5 | import "google/protobuf/descriptor.proto"; 6 | 7 | -------------------------------------------------------------------------------- /proto/GlobalEventsCommon.proto: -------------------------------------------------------------------------------- 1 | syntax = "proto2"; 2 | 3 | package Gazillion; 4 | 5 | enum GlobalEventUpdateType { 6 | eGlobalEventUpdate_EventData = 0; 7 | eGlobalEventUpdate_Leaderboard = 1; 8 | eGlobalEventUpdate_Count = 2; 9 | } 10 | 11 | -------------------------------------------------------------------------------- /src/Gazillion/Gazillion.csproj: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | net8.0 5 | enable 6 | disable 7 | x64 8 | 9 | 10 | 11 | 1.52.0.1700 12 | $(AssemblyVersion) 13 | $(AssemblyVersion) 14 | 15 | 16 | 17 | 1701;1702;CS8981 18 | 19 | 20 | 21 | 1701;1702;CS8981 22 | 23 | 24 | 25 | 26 | ..\..\dep\protobuf-csharp\Google.ProtocolBuffers.dll 27 | 28 | 29 | 30 | 31 | -------------------------------------------------------------------------------- /src/MHServerEmu.Billing/MHServerEmu.Billing.csproj: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | net8.0 5 | enable 6 | disable 7 | x64 8 | 9 | 10 | 11 | 0.8.0.0 12 | $(AssemblyVersion) 13 | $(AssemblyVersion) 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | ..\..\dep\protobuf-csharp\Google.ProtocolBuffers.dll 23 | 24 | 25 | 26 | 27 | -------------------------------------------------------------------------------- /src/MHServerEmu.Core.Tests/Helpers/MathHelperTests.cs: -------------------------------------------------------------------------------- 1 | using MHServerEmu.Core.Helpers; 2 | 3 | namespace MHServerEmu.Core.Tests.Helpers 4 | { 5 | public class MathHelperTests 6 | { 7 | [Theory] 8 | [InlineData(100f, 1.74532926f)] 9 | [InlineData(-256f, -4.46804285f)] 10 | [InlineData(0f, 0f)] 11 | public void ToRadians_Float_ReturnsExpectedValue(float v, float expectedValue) 12 | { 13 | Assert.Equal(expectedValue, MathHelper.ToRadians(v)); 14 | } 15 | 16 | [Theory] 17 | [InlineData(144f, 12f)] 18 | [InlineData(12.512f, 3.53723049f)] 19 | [InlineData(-16f, 0f)] 20 | [InlineData(0f, 0f)] 21 | public void SquareRoot_Float_ReturnsExpectedValue(float f, float expectedValue) 22 | { 23 | Assert.Equal(expectedValue, MathHelper.SquareRoot(f)); 24 | } 25 | 26 | [Theory] 27 | [InlineData(0x0000000000000000, 0)] 28 | [InlineData(0x0000000000000001, 0)] 29 | [InlineData(0x0000000000000002, 1)] 30 | [InlineData(0x00000000B65F6806, 31)] 31 | [InlineData(0x1D6868A33FF0E850, 60)] 32 | public void HighestBitSet_ULong_ReturnsExpectedValue(ulong value, int expectedValue) 33 | { 34 | Assert.Equal(expectedValue, MathHelper.HighestBitSet(value)); 35 | } 36 | } 37 | } 38 | -------------------------------------------------------------------------------- /src/MHServerEmu.Core.Tests/MHServerEmu.Core.Tests.csproj: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | net8.0 5 | enable 6 | disable 7 | 8 | false 9 | true 10 | x64 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | ..\..\dep\protobuf-csharp\Google.ProtocolBuffers.dll 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | -------------------------------------------------------------------------------- /src/MHServerEmu.Core.Tests/Serialization/ArchiveTests.cs: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Crypto137/MHServerEmu/a9851b8e31549e75b8d6dfa12f3d44e678058c77/src/MHServerEmu.Core.Tests/Serialization/ArchiveTests.cs -------------------------------------------------------------------------------- /src/MHServerEmu.Core/Collections/Range.cs: -------------------------------------------------------------------------------- 1 | namespace MHServerEmu.Core.Collections 2 | { 3 | public struct Range where T : IComparable 4 | { 5 | public T Min { get; private set; } 6 | public T Max { get; private set; } 7 | 8 | public Range(T min, T max) 9 | { 10 | Min = min; 11 | Max = max; 12 | } 13 | 14 | public bool Intersects(Range other) 15 | { 16 | return (Min.CompareTo(other.Max) <= 0) && (Max.CompareTo(other.Min) >= 0); 17 | } 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /src/MHServerEmu.Core/Collisions/Circle2.cs: -------------------------------------------------------------------------------- 1 | using MHServerEmu.Core.Helpers; 2 | using MHServerEmu.Core.VectorMath; 3 | 4 | namespace MHServerEmu.Core.Collisions 5 | { 6 | public struct Circle2 7 | { 8 | public Vector3 Center; 9 | public float Radius; 10 | 11 | public Circle2(Vector3 center, float radius) 12 | { 13 | Center = center; 14 | Radius = radius; 15 | } 16 | 17 | public bool Sweep(Vector3 velocity, Vector3 point, ref float time) 18 | { 19 | float a = Vector3.LengthSquared2D(velocity); 20 | if (a < Segment.Epsilon) return false; 21 | a = MathHelper.SquareRoot(a); 22 | Vector3 d = velocity / a; 23 | Vector3 v = (Center - point).To2D(); 24 | 25 | float b = Vector3.Dot(v, d); 26 | float c = Vector3.Dot(v, v) - Radius * Radius; 27 | if (c > 0.0f && b > 0.0f) return false; 28 | 29 | float discr = b * b - c; 30 | if (discr > 0.0f) 31 | { 32 | time = (-b - MathHelper.SquareRoot(discr)) / a; 33 | if (time < 0.0f) time = 0.0f; 34 | return (time <= 1.0f); 35 | } 36 | return false; 37 | } 38 | 39 | } 40 | } 41 | -------------------------------------------------------------------------------- /src/MHServerEmu.Core/Collisions/IBounds.cs: -------------------------------------------------------------------------------- 1 | namespace MHServerEmu.Core.Collisions 2 | { 3 | public interface IBounds 4 | { 5 | ContainmentType Contains(in Aabb2 bounds); 6 | bool Intersects(in Aabb bounds); 7 | } 8 | } 9 | -------------------------------------------------------------------------------- /src/MHServerEmu.Core/Collisions/Square.cs: -------------------------------------------------------------------------------- 1 | using MHServerEmu.Core.VectorMath; 2 | 3 | namespace MHServerEmu.Core.Collisions 4 | { 5 | public struct Square 6 | { 7 | public Point2 Min; 8 | public Point2 Max; 9 | public int Width { get => Max.X - Min.X + 1; } 10 | public int Height { get => Max.Y - Min.Y + 1; } 11 | 12 | public Square(Point2 min, Point2 max) 13 | { 14 | Min = min; 15 | Max = max; 16 | } 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /src/MHServerEmu.Core/Config/ConfigIgnoreAttribute.cs: -------------------------------------------------------------------------------- 1 | namespace MHServerEmu.Core.Config 2 | { 3 | /// 4 | /// An attribute for ignoring properties when initializing config containers. 5 | /// 6 | [AttributeUsage(AttributeTargets.Property)] 7 | public class ConfigIgnoreAttribute : Attribute { } 8 | } 9 | -------------------------------------------------------------------------------- /src/MHServerEmu.Core/Extensions/LinkedListExtensions.cs: -------------------------------------------------------------------------------- 1 | namespace MHServerEmu.Core.Extensions 2 | { 3 | public static class LinkedListExtensions 4 | { 5 | /// 6 | /// Retrieves and removes the head element from this . 7 | /// Returns if successful. 8 | /// 9 | public static bool PopFront(this LinkedList list, out T value) 10 | { 11 | value = default; 12 | LinkedListNode first = list.First; 13 | 14 | if (first == null) 15 | return false; 16 | 17 | list.RemoveFirst(); 18 | value = first.Value; 19 | return true; 20 | } 21 | 22 | /// 23 | /// Removes this from the it belongs to. 24 | /// Returns if successful. 25 | /// 26 | public static bool Remove(this LinkedListNode node) 27 | { 28 | LinkedList list = node.List; 29 | if (list == null) 30 | return false; 31 | 32 | list.Remove(node); 33 | return true; 34 | } 35 | } 36 | } 37 | -------------------------------------------------------------------------------- /src/MHServerEmu.Core/Extensions/TimeExtensions.cs: -------------------------------------------------------------------------------- 1 | using MHServerEmu.Core.System.Time; 2 | 3 | namespace MHServerEmu.Core.Extensions 4 | { 5 | public static class TimeExtensions 6 | { 7 | public static long CalcNumTimeQuantums(this TimeSpan timeSpan, TimeSpan quantumSize) 8 | { 9 | return Clock.CalcNumTimeQuantums(timeSpan, quantumSize); 10 | } 11 | } 12 | } 13 | -------------------------------------------------------------------------------- /src/MHServerEmu.Core/Helpers/CompressionHelper.cs: -------------------------------------------------------------------------------- 1 | using Free.Ports.zLib; 2 | using K4os.Compression.LZ4; 3 | 4 | namespace MHServerEmu.Core.Helpers 5 | { 6 | public static class CompressionHelper 7 | { 8 | /// 9 | /// Decompresses the provided LZ4 buffer. 10 | /// 11 | public static void LZ4Decode(ReadOnlySpan source, Span target) 12 | { 13 | LZ4Codec.Decode(source, target); 14 | } 15 | 16 | /// 17 | /// Compresses the provided buffer using zlib. 18 | /// 19 | public static byte[] ZLibDeflate(byte[] buffer) 20 | { 21 | // This is used for compressing the achievement database dump before sending it to clients. 22 | // We need to compress specifically with a port of zlib rather than various alternatives like SharpZipLib 23 | // to produce the same result as the original. zlib.compress() in Python also produces the result we need. 24 | 25 | using (MemoryStream ms = new()) 26 | using (ZStreamWriter writer = new(ms)) 27 | { 28 | writer.Write(buffer); 29 | writer.Close(); 30 | return ms.ToArray(); 31 | } 32 | } 33 | } 34 | } 35 | -------------------------------------------------------------------------------- /src/MHServerEmu.Core/Logging/LogEnums.cs: -------------------------------------------------------------------------------- 1 | namespace MHServerEmu.Core.Logging 2 | { 3 | /// 4 | /// is used to filter log output by severity level. 5 | /// 6 | public enum LoggingLevel 7 | { 8 | Trace, 9 | Debug, 10 | Info, 11 | Warn, 12 | Error, 13 | Fatal 14 | } 15 | 16 | /// 17 | /// are used to filter log output by source. 18 | /// 19 | [Flags] 20 | public enum LogChannels : ulong 21 | { 22 | None, 23 | General = 1ul << 0, 24 | 25 | // Add channels here to enable them by default 26 | Default = General, 27 | All = unchecked((ulong)-1L) 28 | } 29 | 30 | /// 31 | /// is used to split log output. 32 | /// 33 | public enum LogCategory 34 | { 35 | Common, 36 | Chat, 37 | MTXStore, 38 | NumCategories 39 | } 40 | } 41 | -------------------------------------------------------------------------------- /src/MHServerEmu.Core/Logging/LogTarget.cs: -------------------------------------------------------------------------------- 1 | namespace MHServerEmu.Core.Logging 2 | { 3 | /// 4 | /// An abstract class for logging output targets. 5 | /// 6 | public abstract class LogTarget 7 | { 8 | private readonly LogTargetSettings _settings; 9 | 10 | public bool IncludeTimestamps { get => _settings.IncludeTimestamps; } 11 | public LoggingLevel MinimumLevel { get => _settings.MinimumLevel; } 12 | public LoggingLevel MaximumLevel { get => _settings.MaximumLevel; } 13 | public LogChannels Channels { get => _settings.Channels; } 14 | 15 | /// 16 | /// Constructs a new instance with the specified . 17 | /// 18 | public LogTarget(LogTargetSettings settings) 19 | { 20 | _settings = settings; 21 | } 22 | 23 | /// 24 | /// Processes a . 25 | /// 26 | public abstract void ProcessLogMessage(in LogMessage message); 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /src/MHServerEmu.Core/Logging/LogTargetSettings.cs: -------------------------------------------------------------------------------- 1 | namespace MHServerEmu.Core.Logging 2 | { 3 | /// 4 | /// Contains settings for a . 5 | /// 6 | public class LogTargetSettings 7 | { 8 | public bool IncludeTimestamps { get; set; } 9 | public LoggingLevel MinimumLevel { get; set; } 10 | public LoggingLevel MaximumLevel { get; set; } 11 | public LogChannels Channels { get; set; } 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /src/MHServerEmu.Core/MHServerEmu.Core.csproj: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | net8.0 5 | enable 6 | disable 7 | x64 8 | 9 | 10 | 11 | 0.8.0.0 12 | $(AssemblyVersion) 13 | $(AssemblyVersion) 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | ..\..\dep\Free.Ports.zLib\Free.Ports.zLib.dll 23 | 24 | 25 | ..\..\dep\protobuf-csharp\Google.ProtocolBuffers.dll 26 | 27 | 28 | ..\..\dep\ini-parser\INIFileParser.dll 29 | 30 | 31 | ..\..\dep\K4os.Compression.LZ4\K4os.Compression.LZ4.dll 32 | 33 | 34 | 35 | 36 | -------------------------------------------------------------------------------- /src/MHServerEmu.Core/Memory/IPoolable.cs: -------------------------------------------------------------------------------- 1 | namespace MHServerEmu.Core.Memory 2 | { 3 | /// 4 | /// Interface for objects that can be stored in an . 5 | /// 6 | public interface IPoolable 7 | { 8 | /// 9 | /// A flag to guard against returning the same instance to the pool multiple times. 10 | /// 11 | public bool IsInPool { get; set; } 12 | 13 | /// 14 | /// Resets an instance before it returns to the pool. 15 | /// 16 | public void ResetForPool(); 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /src/MHServerEmu.Core/Metrics/GameProfileTimer.cs: -------------------------------------------------------------------------------- 1 | using System.Diagnostics; 2 | 3 | namespace MHServerEmu.Core.Metrics 4 | { 5 | /// 6 | /// Starts a timer when it is created. Records the elapsed time as a when it is disposed. 7 | /// 8 | public readonly struct GameProfileTimer : IDisposable 9 | { 10 | private static readonly Stopwatch Stopwatch = Stopwatch.StartNew(); 11 | 12 | private readonly ulong _gameId; 13 | private readonly GamePerformanceMetricEnum _metric; 14 | private readonly TimeSpan _referenceTime; 15 | 16 | public GameProfileTimer(ulong gameId, GamePerformanceMetricEnum metric) 17 | { 18 | _gameId = gameId; 19 | _metric = metric; 20 | _referenceTime = Stopwatch.Elapsed; 21 | } 22 | 23 | public void Dispose() 24 | { 25 | TimeSpan stopTime = Stopwatch.Elapsed; 26 | TimeSpan elapsed = stopTime - _referenceTime; 27 | MetricsManager.Instance.RecordGamePerformanceMetric(_gameId, _metric, elapsed); 28 | } 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /src/MHServerEmu.Core/Metrics/MetricValue.cs: -------------------------------------------------------------------------------- 1 | using System.Runtime.InteropServices; 2 | 3 | namespace MHServerEmu.Core.Metrics 4 | { 5 | [StructLayout(LayoutKind.Explicit)] 6 | public readonly struct MetricValue 7 | { 8 | [FieldOffset(0)] 9 | public readonly float FloatValue = default; 10 | [FieldOffset(0)] 11 | public readonly TimeSpan TimeValue = default; 12 | 13 | public MetricValue(float value) 14 | { 15 | FloatValue = value; 16 | } 17 | 18 | public MetricValue(TimeSpan value) 19 | { 20 | TimeValue = value; 21 | } 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /src/MHServerEmu.Core/Metrics/MetricsEnums.cs: -------------------------------------------------------------------------------- 1 | namespace MHServerEmu.Core.Metrics 2 | { 3 | public enum MetricsReportFormat 4 | { 5 | PlainText, 6 | Json, 7 | } 8 | 9 | public enum GamePerformanceMetricEnum 10 | { 11 | Invalid = -1, 12 | UpdateTime, 13 | FrameTime, 14 | ScheduledEventsPerUpdate, 15 | EntityCount, 16 | PlayerCount, 17 | NumGameMetrics 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /src/MHServerEmu.Core/Network/IFrontendSession.cs: -------------------------------------------------------------------------------- 1 | namespace MHServerEmu.Core.Network 2 | { 3 | /// 4 | /// Represents a session. 5 | /// 6 | public interface IFrontendSession 7 | { 8 | public ulong Id { get; } 9 | public object Account { get; } // Not having this be strongly typed is not ideal, but it allows us to avoid coupling Core and DatabaseAccess. 10 | } 11 | } 12 | -------------------------------------------------------------------------------- /src/MHServerEmu.Core/Network/IGameService.cs: -------------------------------------------------------------------------------- 1 | namespace MHServerEmu.Core.Network 2 | { 3 | /// 4 | /// An interface for services that handle instances. 5 | /// 6 | public interface IGameService 7 | { 8 | public GameServiceState State { get; } 9 | 10 | /// 11 | /// Starts this instance. 12 | /// 13 | public void Run(); 14 | 15 | /// 16 | /// Shuts down this instance. 17 | /// 18 | public void Shutdown(); 19 | 20 | /// 21 | /// Receives an from another . 22 | /// 23 | public void ReceiveServiceMessage(in T message) where T: struct, IGameServiceMessage; 24 | 25 | /// 26 | /// Adds the status of this to the provided dictionary. 27 | /// 28 | public void GetStatus(Dictionary statusDict); 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /src/MHServerEmu.Core/Network/MailboxMessage.cs: -------------------------------------------------------------------------------- 1 | using Google.ProtocolBuffers; 2 | 3 | namespace MHServerEmu.Core.Network 4 | { 5 | /// 6 | /// Contains a deserialized . 7 | /// 8 | public readonly struct MailboxMessage 9 | { 10 | private readonly IMessage _message; 11 | 12 | public uint Id { get; } 13 | 14 | public TimeSpan GameTimeReceived { get; } 15 | public TimeSpan DateTimeReceived { get; } 16 | 17 | /// 18 | /// Constructs a new . 19 | /// 20 | public MailboxMessage(uint id, IMessage message, TimeSpan gameTimeReceived = default, TimeSpan dateTimeReceived = default) 21 | { 22 | Id = id; 23 | _message = message; 24 | 25 | GameTimeReceived = gameTimeReceived; 26 | DateTimeReceived = dateTimeReceived; 27 | } 28 | 29 | /// 30 | /// Returns the contents of this as . 31 | /// 32 | public T As() where T: class, IMessage 33 | { 34 | return _message as T; 35 | } 36 | } 37 | } 38 | -------------------------------------------------------------------------------- /src/MHServerEmu.Core/Network/Tcp/IPacket.cs: -------------------------------------------------------------------------------- 1 | namespace MHServerEmu.Core.Network.Tcp 2 | { 3 | /// 4 | /// Exposes a packet's serialization routine. 5 | /// 6 | public interface IPacket 7 | { 8 | public int SerializedSize { get; } 9 | 10 | public int Serialize(byte[] buffer); 11 | public int Serialize(Stream stream); 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /src/MHServerEmu.Core/Network/Tcp/TcpClient.cs: -------------------------------------------------------------------------------- 1 | namespace MHServerEmu.Core.Network.Tcp 2 | { 3 | /// 4 | /// Base class for clients. 5 | /// 6 | public abstract class TcpClient 7 | { 8 | public TcpClientConnection Connection { get; } 9 | 10 | public TcpClient(TcpClientConnection connection) 11 | { 12 | Connection = connection; 13 | Connection.Client = this; 14 | } 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /src/MHServerEmu.Core/Network/Web/WebServiceSettings.cs: -------------------------------------------------------------------------------- 1 | namespace MHServerEmu.Core.Network.Web 2 | { 3 | public class WebServiceSettings 4 | { 5 | public string Name { get; init; } 6 | public string ListenUrl { get; init; } 7 | public WebHandler FallbackHandler { get; init; } 8 | } 9 | } 10 | -------------------------------------------------------------------------------- /src/MHServerEmu.Core/Serialization/ISerialize.cs: -------------------------------------------------------------------------------- 1 | namespace MHServerEmu.Core.Serialization 2 | { 3 | /// 4 | /// Exposes serialization routine. 5 | /// 6 | public interface ISerialize 7 | { 8 | public bool Serialize(Archive archive); 9 | } 10 | } 11 | -------------------------------------------------------------------------------- /src/MHServerEmu.Core/Serialization/TimeSpanJsonConverter.cs: -------------------------------------------------------------------------------- 1 | using System.Text.Json; 2 | using System.Text.Json.Serialization; 3 | 4 | namespace MHServerEmu.Core.Serialization 5 | { 6 | /// 7 | /// Serializes values using the underlying number of ticks. 8 | /// 9 | public class TimeSpanJsonConverter : JsonConverter 10 | { 11 | public override TimeSpan Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options) 12 | { 13 | return new(reader.GetInt64()); 14 | } 15 | 16 | public override void Write(Utf8JsonWriter writer, TimeSpan value, JsonSerializerOptions options) 17 | { 18 | writer.WriteNumberValue(value.Ticks); 19 | } 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /src/MHServerEmu.Core/System/Random/RandMwc.cs: -------------------------------------------------------------------------------- 1 | namespace MHServerEmu.Core.System.Random 2 | { 3 | // More info on MWC random: https://en.wikipedia.org/wiki/Multiply-with-carry_pseudorandom_number_generator 4 | public class RandMwc 5 | { 6 | private ulong _seed; 7 | public const uint RandMax = 0xffffffff; 8 | 9 | public RandMwc(uint seed) 10 | { 11 | SetSeed(seed == 0 ? (uint)DateTime.Now.Ticks : seed); 12 | } 13 | 14 | public void SetSeed(uint seed) 15 | { 16 | _seed = (ulong)666 << 32 | seed; 17 | } 18 | 19 | public uint Get() 20 | { 21 | _seed = 698769069UL * (_seed & 0xffffffff) + (_seed >> 32); 22 | return (uint)_seed; 23 | } 24 | 25 | public ulong Get64() 26 | { 27 | return (ulong)Get() << 32 | Get(); 28 | } 29 | 30 | public override string ToString() 31 | { 32 | return $"0x{_seed:X16}"; 33 | } 34 | } 35 | } 36 | -------------------------------------------------------------------------------- /src/MHServerEmu.Core/System/Time/CooldownTimer.cs: -------------------------------------------------------------------------------- 1 | namespace MHServerEmu.Core.System.Time 2 | { 3 | /// 4 | /// Checks if enough time has passed to perform an action. 5 | /// 6 | public struct CooldownTimer 7 | { 8 | private readonly TimeSpan _cooldown; 9 | private TimeSpan _lastTime; 10 | 11 | /// 12 | /// Constructs a new for the specified . 13 | /// 14 | public CooldownTimer(TimeSpan cooldown) 15 | { 16 | _cooldown = cooldown; 17 | _lastTime = GetTime(); 18 | } 19 | 20 | /// 21 | /// Returns if enough time has passed since the last successful call of this function. 22 | /// 23 | public bool Check() 24 | { 25 | TimeSpan now = GetTime(); 26 | 27 | if ((now - _lastTime) < _cooldown) 28 | return false; 29 | 30 | _lastTime = now; 31 | return true; 32 | } 33 | 34 | /// 35 | /// Returns a representing current time. 36 | /// 37 | private static TimeSpan GetTime() 38 | { 39 | return Clock.UnixTime; 40 | } 41 | } 42 | } 43 | -------------------------------------------------------------------------------- /src/MHServerEmu.Core/VectorMath/Point2.cs: -------------------------------------------------------------------------------- 1 | namespace MHServerEmu.Core.VectorMath 2 | { 3 | public struct Point2 : IEquatable 4 | { 5 | public int X; 6 | public int Y; 7 | 8 | public Point2(int x, int y) 9 | { 10 | X = x; 11 | Y = y; 12 | } 13 | 14 | public Point2(float x, float y) 15 | { 16 | X = (int)x; 17 | Y = (int)y; 18 | } 19 | 20 | public override int GetHashCode() => HashCode.Combine(X, Y); 21 | 22 | public override bool Equals(object obj) 23 | { 24 | if (obj is not Point2 other) return false; 25 | return Equals(other); 26 | } 27 | 28 | public bool Equals(Point2 point) 29 | { 30 | return X == point.X && Y == point.Y; 31 | } 32 | 33 | public static float DistanceSquared2D(Point2 a, Point2 b) => Vector3.LengthSqr(new(b.X - a.X, b.Y - a.Y, 0.0f)); 34 | 35 | public static bool operator ==(Point2 a, Point2 b) => a.Equals(b); 36 | public static bool operator !=(Point2 a, Point2 b) => !a.Equals(b); 37 | } 38 | } 39 | -------------------------------------------------------------------------------- /src/MHServerEmu.Core/VectorMath/Point3.cs: -------------------------------------------------------------------------------- 1 | namespace MHServerEmu.Core.VectorMath 2 | { 3 | public struct Point3 4 | { 5 | public float X; 6 | public float Y; 7 | public float Z; 8 | 9 | public Point3(float x, float y, float z) 10 | { 11 | X = x; 12 | Y = y; 13 | Z = z; 14 | } 15 | 16 | public Point3(Vector3 v) 17 | { 18 | X = v.X; 19 | Y = v.Y; 20 | Z = v.Z; 21 | } 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /src/MHServerEmu.DatabaseAccess/IDBAccountOwner.cs: -------------------------------------------------------------------------------- 1 | using MHServerEmu.DatabaseAccess.Models; 2 | 3 | namespace MHServerEmu.DatabaseAccess 4 | { 5 | /// 6 | /// Provides access to a . 7 | /// 8 | public interface IDBAccountOwner 9 | { 10 | public DBAccount Account { get; } 11 | } 12 | } 13 | -------------------------------------------------------------------------------- /src/MHServerEmu.DatabaseAccess/Interop/linux-x64/SQLite.Interop.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Crypto137/MHServerEmu/a9851b8e31549e75b8d6dfa12f3d44e678058c77/src/MHServerEmu.DatabaseAccess/Interop/linux-x64/SQLite.Interop.dll -------------------------------------------------------------------------------- /src/MHServerEmu.DatabaseAccess/Interop/win-x64/SQLite.Interop.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Crypto137/MHServerEmu/a9851b8e31549e75b8d6dfa12f3d44e678058c77/src/MHServerEmu.DatabaseAccess/Interop/win-x64/SQLite.Interop.dll -------------------------------------------------------------------------------- /src/MHServerEmu.DatabaseAccess/Json/DBEntityCollectionJsonConverter.cs: -------------------------------------------------------------------------------- 1 | using System.Text.Json; 2 | using System.Text.Json.Serialization; 3 | using MHServerEmu.DatabaseAccess.Models; 4 | 5 | namespace MHServerEmu.DatabaseAccess.Json 6 | { 7 | public class DBEntityCollectionJsonConverter : JsonConverter 8 | { 9 | public override DBEntityCollection Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options) 10 | { 11 | DBEntity[] entities = JsonSerializer.Deserialize(ref reader, options); 12 | return new(entities); 13 | } 14 | 15 | public override void Write(Utf8JsonWriter writer, DBEntityCollection value, JsonSerializerOptions options) 16 | { 17 | JsonSerializer.Serialize(writer, value.Entries.ToArray(), options); 18 | } 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /src/MHServerEmu.DatabaseAccess/Json/JsonDBManagerConfig.cs: -------------------------------------------------------------------------------- 1 | using MHServerEmu.Core.Config; 2 | 3 | namespace MHServerEmu.DatabaseAccess.Json 4 | { 5 | public class JsonDBManagerConfig : ConfigContainer 6 | { 7 | public string FileName { get; private set; } = "DefaultAccount.json"; 8 | public int MaxBackupNumber { get; private set; } = 5; 9 | public int BackupIntervalMinutes { get; private set; } = 15; 10 | 11 | public string PlayerName { get; private set; } = "Player"; 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /src/MHServerEmu.DatabaseAccess/Models/DBEntity.cs: -------------------------------------------------------------------------------- 1 | namespace MHServerEmu.DatabaseAccess.Models 2 | { 3 | public class DBEntity 4 | { 5 | // NOTE: We store 64 bit integers as signed because the Dapper + SQLite combo throws overflow exceptions with ulong values over 2^63 6 | 7 | public long DbGuid { get; set; } 8 | public long ContainerDbGuid { get; set; } 9 | public long InventoryProtoGuid { get; set; } 10 | public uint Slot { get; set; } 11 | public long EntityProtoGuid { get; set; } 12 | public byte[] ArchiveData { get; set; } 13 | 14 | public override string ToString() 15 | { 16 | return $"DbGuid=0x{DbGuid:X}, ContainerDbGuid=0x{ContainerDbGuid:X}, InventoryProtoGuid={InventoryProtoGuid}, Slot={Slot}, EntityProtoGuid={EntityProtoGuid}"; 17 | } 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /src/MHServerEmu.DatabaseAccess/Models/DBPlayer.cs: -------------------------------------------------------------------------------- 1 | namespace MHServerEmu.DatabaseAccess.Models 2 | { 3 | public class DBPlayer 4 | { 5 | public long DbGuid { get; set; } 6 | public byte[] ArchiveData { get; set; } 7 | public long StartTarget { get; set; } 8 | public int AOIVolume { get; set; } 9 | public long GazillioniteBalance { get; set; } = -1; // -1 indicates that Gs need to be restored to the default value for new accounts when the player logs in 10 | public long LastLogoutTime { get; set; } 11 | 12 | public DBPlayer() { } 13 | 14 | public DBPlayer(long dbGuid) 15 | { 16 | DbGuid = dbGuid; 17 | Reset(); 18 | } 19 | 20 | public void Reset() 21 | { 22 | ArchiveData = Array.Empty(); 23 | StartTarget = unchecked((long)15338215617681369199); // Regions/StoryRevamp/CH00Raft/TimesSquare/ConnectionTargets/TimesSquareTutorialStartTarget.prototype 24 | AOIVolume = 3200; 25 | GazillioniteBalance = -1; 26 | LastLogoutTime = 0; 27 | } 28 | } 29 | } 30 | -------------------------------------------------------------------------------- /src/MHServerEmu.DatabaseAccess/Models/Leaderboards/DBLeaderboard.cs: -------------------------------------------------------------------------------- 1 | using MHServerEmu.Core.System.Time; 2 | 3 | namespace MHServerEmu.DatabaseAccess.Models.Leaderboards 4 | { 5 | public class DBLeaderboard 6 | { 7 | public long LeaderboardId { get; set; } 8 | public string PrototypeName { get; set; } 9 | public long ActiveInstanceId { get; set; } 10 | public bool IsEnabled { get; set; } 11 | public long StartTime { get; set; } 12 | public int MaxResetCount { get; set; } 13 | 14 | public DBLeaderboard() 15 | { 16 | } 17 | 18 | public DBLeaderboard(DBLeaderboard other) 19 | { 20 | LeaderboardId = other.LeaderboardId; 21 | PrototypeName = other.PrototypeName; 22 | ActiveInstanceId = other.ActiveInstanceId; 23 | IsEnabled = other.IsEnabled; 24 | StartTime = other.StartTime; 25 | MaxResetCount = other.MaxResetCount; 26 | } 27 | 28 | public DateTime GetStartDateTime() 29 | { 30 | return Clock.TimestampToDateTime(StartTime); 31 | } 32 | 33 | public void SetStartDateTime(DateTime dateTime) 34 | { 35 | StartTime = Clock.DateTimeToTimestamp(dateTime); 36 | } 37 | } 38 | } 39 | -------------------------------------------------------------------------------- /src/MHServerEmu.DatabaseAccess/Models/Leaderboards/DBLeaderboardInstance.cs: -------------------------------------------------------------------------------- 1 | using Gazillion; 2 | using MHServerEmu.Core.System.Time; 3 | 4 | namespace MHServerEmu.DatabaseAccess.Models.Leaderboards 5 | { 6 | public class DBLeaderboardInstance 7 | { 8 | public long InstanceId { get; set; } 9 | public long LeaderboardId { get; set; } 10 | public LeaderboardState State { get; set; } 11 | public long ActivationDate { get; set; } 12 | public bool Visible { get; set; } 13 | 14 | public DateTime GetActivationDateTime() 15 | { 16 | return Clock.TimestampToDateTime(ActivationDate); 17 | } 18 | 19 | public void SetActivationDateTime(DateTime dateTime) 20 | { 21 | ActivationDate = Clock.DateTimeToTimestamp(dateTime); 22 | } 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /src/MHServerEmu.DatabaseAccess/Models/Leaderboards/DBMetaEntry.cs: -------------------------------------------------------------------------------- 1 | namespace MHServerEmu.DatabaseAccess.Models.Leaderboards 2 | { 3 | public class DBMetaEntry 4 | { 5 | public long LeaderboardId { get; set; } 6 | public long InstanceId { get; set; } 7 | public long SubLeaderboardId { get; set; } 8 | public long SubInstanceId { get; set; } 9 | } 10 | } 11 | -------------------------------------------------------------------------------- /src/MHServerEmu.DatabaseAccess/Models/Leaderboards/DBRewardEntry.cs: -------------------------------------------------------------------------------- 1 | using MHServerEmu.Core.System.Time; 2 | 3 | namespace MHServerEmu.DatabaseAccess.Models.Leaderboards 4 | { 5 | public class DBRewardEntry 6 | { 7 | public long LeaderboardId { get; set; } 8 | public long InstanceId { get; set; } 9 | public long RewardId { get; set; } 10 | public long ParticipantId { get; set; } 11 | public int Rank { get; set; } 12 | public long CreationDate { get; set; } 13 | public long RewardedDate { get; set; } 14 | 15 | public DBRewardEntry() { } 16 | 17 | public DBRewardEntry(long leaderboardId, long instanceId, long rewardId, long participantId, int rank) 18 | { 19 | LeaderboardId = leaderboardId; 20 | InstanceId = instanceId; 21 | RewardId = rewardId; 22 | ParticipantId = participantId; 23 | Rank = rank; 24 | 25 | CreationDate = Clock.UtcNowTimestamp; 26 | RewardedDate = 0; 27 | } 28 | 29 | public void UpdateRewardedDate() 30 | { 31 | RewardedDate = Clock.UtcNowTimestamp; 32 | } 33 | } 34 | } 35 | -------------------------------------------------------------------------------- /src/MHServerEmu.DatabaseAccess/Models/Leaderboards/LeaderboardRuleState.cs: -------------------------------------------------------------------------------- 1 | namespace MHServerEmu.DatabaseAccess.Models.Leaderboards 2 | { 3 | public class LeaderboardRuleState 4 | { 5 | public ulong RuleId { get; set; } 6 | public ulong Count { get; set; } 7 | public ulong Score { get; set; } 8 | } 9 | } 10 | -------------------------------------------------------------------------------- /src/MHServerEmu.DatabaseAccess/Models/MigrationData.cs: -------------------------------------------------------------------------------- 1 | using Gazillion; 2 | 3 | namespace MHServerEmu.DatabaseAccess.Models 4 | { 5 | public class MigrationData 6 | { 7 | public bool SkipNextUpdate { get; set; } 8 | 9 | public bool IsFirstLoad { get; set; } = true; 10 | 11 | // Store everything here as ulong, PropertyCollection will sort it out game-side 12 | public List> PlayerProperties { get; } = new(256); 13 | public List<(ulong, ulong)> WorldView { get; } = new(); 14 | public List CommunityStatus { get; } = new(); 15 | 16 | // TODO: Summoned inventory 17 | 18 | public MigrationData() { } 19 | 20 | public void Reset() 21 | { 22 | SkipNextUpdate = false; 23 | 24 | IsFirstLoad = true; 25 | PlayerProperties.Clear(); 26 | WorldView.Clear(); 27 | CommunityStatus.Clear(); 28 | } 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /src/MHServerEmu.DatabaseAccess/SQLite/SQLiteDBManagerConfig.cs: -------------------------------------------------------------------------------- 1 | using MHServerEmu.Core.Config; 2 | 3 | namespace MHServerEmu.DatabaseAccess.SQLite 4 | { 5 | public class SQLiteDBManagerConfig : ConfigContainer 6 | { 7 | public string FileName { get; private set; } = "Account.db"; 8 | public int MaxBackupNumber { get; private set; } = 5; 9 | public int BackupIntervalMinutes { get; private set; } = 15; 10 | } 11 | } 12 | -------------------------------------------------------------------------------- /src/MHServerEmu.DatabaseAccess/SQLite/SQLiteScripts.cs: -------------------------------------------------------------------------------- 1 | using System.Reflection; 2 | 3 | namespace MHServerEmu.DatabaseAccess.SQLite 4 | { 5 | public static class SQLiteScripts 6 | { 7 | public static string GetInitializationScript() 8 | { 9 | return LoadScript("InitializeDatabase"); 10 | } 11 | 12 | public static string GetMigrationScript(int currentVersion) 13 | { 14 | return LoadScript($"Migrations.{currentVersion}"); 15 | } 16 | 17 | public static string GetLeaderboardsScript() 18 | { 19 | return LoadScript("InitializeLeaderboardsDatabase"); 20 | } 21 | 22 | private static string LoadScript(string name) 23 | { 24 | string resourceName = $"MHServerEmu.DatabaseAccess.SQLite.Scripts.{name}.sql"; 25 | 26 | using Stream stream = Assembly.GetExecutingAssembly().GetManifestResourceStream(resourceName); 27 | if (stream == null) 28 | throw new Exception($"Script '{name}' not found."); 29 | 30 | using StreamReader reader = new(stream); 31 | return reader.ReadToEnd(); 32 | } 33 | } 34 | } 35 | -------------------------------------------------------------------------------- /src/MHServerEmu.DatabaseAccess/SQLite/Scripts/Migrations/1.sql: -------------------------------------------------------------------------------- 1 | -- Convert individual flag columns into a single bit field 2 | 3 | -- Reuse existing IsBanned column, allowing us to keep ban information 4 | ALTER TABLE Account RENAME COLUMN IsBanned TO Flags; 5 | 6 | -- Get rid of archived and password expired columns 7 | ALTER TABLE Account DROP COLUMN IsArchived; 8 | ALTER TABLE Account DROP COLUMN IsPasswordExpired; 9 | -------------------------------------------------------------------------------- /src/MHServerEmu.DatabaseAccess/SQLite/Scripts/Migrations/2.sql: -------------------------------------------------------------------------------- 1 | -- Add per-account G balance 2 | 3 | -- Add new column for G balance to the Player table 4 | ALTER TABLE Player ADD COLUMN GazillioniteBalance INTEGER; 5 | 6 | -- Set the value to -1 for all rows, it will be set to the correct value for new accounts when the player logs in 7 | UPDATE Player SET GazillioniteBalance=-1; 8 | -------------------------------------------------------------------------------- /src/MHServerEmu.DatabaseAccess/SQLite/Scripts/Migrations/3.sql: -------------------------------------------------------------------------------- 1 | -- Game instancing update. 2 | 3 | -- Remove the deprecated start target override column. 4 | ALTER TABLE Player DROP COLUMN StartTargetRegionOverride; 5 | 6 | -- Switch the database to the WAL mode to allow concurrent reads and writes. 7 | PRAGMA journal_mode=WAL; 8 | -------------------------------------------------------------------------------- /src/MHServerEmu.Frontend/FrontendConfig.cs: -------------------------------------------------------------------------------- 1 | using MHServerEmu.Core.Config; 2 | 3 | namespace MHServerEmu.Frontend 4 | { 5 | /// 6 | /// Contains configuration for the . 7 | /// 8 | public class FrontendConfig : ConfigContainer 9 | { 10 | public string BindIP { get; private set; } = "127.0.0.1"; 11 | public string Port { get; private set; } = "4306"; 12 | public string PublicAddress { get; private set; } = "127.0.0.1"; 13 | public int ReceiveTimeoutMS { get; private set; } = 1000 * 30; 14 | public int SendTimeoutMS { get; private set; } = 1000 * 6; 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /src/MHServerEmu.Frontend/MHServerEmu.Frontend.csproj: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | net8.0 5 | enable 6 | disable 7 | x64 8 | 9 | 10 | 11 | 0.8.0.0 12 | $(AssemblyVersion) 13 | $(AssemblyVersion) 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | ..\..\dep\protobuf-csharp\Google.ProtocolBuffers.dll 24 | 25 | 26 | 27 | 28 | -------------------------------------------------------------------------------- /src/MHServerEmu.Games.Tests/MHServerEmu.Games.Tests.csproj: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | net8.0 5 | enable 6 | disable 7 | 8 | false 9 | true 10 | x64 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | -------------------------------------------------------------------------------- /src/MHServerEmu.Games/Common/ArchiveExtensions.cs: -------------------------------------------------------------------------------- 1 | using MHServerEmu.Core.Serialization; 2 | using MHServerEmu.Games.Network; 3 | 4 | namespace MHServerEmu.Games.Common 5 | { 6 | public static class ArchiveExtensions 7 | { 8 | /// 9 | /// Returns the replication policy for this as an enum. 10 | /// 11 | public static AOINetworkPolicyValues GetReplicationPolicyEnum(this Archive archive) 12 | { 13 | return (AOINetworkPolicyValues)archive.ReplicationPolicy; 14 | } 15 | 16 | public static bool HasReplicationPolicy(this Archive archive, AOINetworkPolicyValues replicationPolicy) 17 | { 18 | return ((AOINetworkPolicyValues)archive.ReplicationPolicy).HasFlag(replicationPolicy); 19 | } 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /src/MHServerEmu.Games/Common/ICommandParser.cs: -------------------------------------------------------------------------------- 1 | using MHServerEmu.Core.Network; 2 | using MHServerEmu.Games.Social; 3 | 4 | namespace MHServerEmu.Games.Common 5 | { 6 | /// 7 | /// Exposes a method for parsing commands from chat messages. 8 | /// 9 | public interface ICommandParser 10 | { 11 | /// 12 | /// Globally accessible implementation of used by instances. 13 | /// 14 | public static ICommandParser Instance { get; set; } 15 | 16 | /// 17 | /// Attempts to parse a command from the provided message. Returns if successful. 18 | /// 19 | public bool TryParse(string message, NetClient client); 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /src/MHServerEmu.Games/Common/SpatialPartitions/QuadtreeLocation.cs: -------------------------------------------------------------------------------- 1 | using MHServerEmu.Core.Collisions; 2 | 3 | namespace MHServerEmu.Games.Common.SpatialPartitions 4 | { 5 | public class QuadtreeLocation 6 | { 7 | public T Element { get; } 8 | public Node Node { get; set; } 9 | public bool AtTargetLevel { get; set; } 10 | public bool Linked { get; set; } 11 | 12 | public QuadtreeLocation(T element) 13 | { 14 | Element = element; 15 | Node = default; 16 | } 17 | 18 | public void Clear() 19 | { 20 | if (Node != null) 21 | { 22 | Node.Elements.Remove(this); 23 | if (AtTargetLevel) --Node.AtTargetLevelCount; 24 | Node = null; 25 | } 26 | AtTargetLevel = false; 27 | } 28 | 29 | public bool IsValid() => Node != null; 30 | public bool IsUnlinked() => Linked == false; 31 | public virtual Aabb GetBounds() => default; 32 | } 33 | } 34 | -------------------------------------------------------------------------------- /src/MHServerEmu.Games/CustomGameOptionsConfig.cs: -------------------------------------------------------------------------------- 1 | using MHServerEmu.Core.Config; 2 | 3 | namespace MHServerEmu.Games 4 | { 5 | public class CustomGameOptionsConfig : ConfigContainer 6 | { 7 | public float ESCooldownOverrideMinutes { get; private set; } = -1f; 8 | public bool CombineESStacks { get; private set; } = false; 9 | public bool AutoUnlockAvatars { get; private set; } = true; 10 | public bool AutoUnlockTeamUps { get; private set; } = true; 11 | public bool DisableMovementPowerChargeCost { get; private set; } = false; 12 | public bool AllowSameGroupTalents { get; private set; } = false; 13 | public bool DisableInstancedLoot { get; private set; } = false; 14 | public float LootSpawnGridCellRadius { get; private set; } = 20f; 15 | public float TrashedItemExpirationTimeMultiplier { get; private set; } = 1f; 16 | public bool DisableAccountBinding { get; private set; } = false; 17 | public bool DisableCharacterBinding { get; private set; } = true; 18 | public bool UsePrestigeLootTable { get; private set; } = false; 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /src/MHServerEmu.Games/Data/Game/Achievements/AchievementNewThresholdUS.txt: -------------------------------------------------------------------------------- 1 | 1499616000 -------------------------------------------------------------------------------- /src/MHServerEmu.Games/Data/Game/Achievements/AchievementPartyVisible.json: -------------------------------------------------------------------------------- 1 | [16,28,38,50,163,208,215,263,449,453,460,576,619,639,825,839,895,982,1073,1109,1229,1278,1312,1332,1349,1364,1421,1470,1577,1584,1803,1858,1871,1896,2006,2041,2044,2115,2125,2204,2214,2322,2354,2468,2484,2485,2512,2554,2594,2707,2771,2835,2846,2902,2935,2955,2966,2999,3009,3068,3073,3079,10747,11432] -------------------------------------------------------------------------------- /src/MHServerEmu.Games/Data/Game/Achievements/eng.achievements.string: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Crypto137/MHServerEmu/a9851b8e31549e75b8d6dfa12f3d44e678058c77/src/MHServerEmu.Games/Data/Game/Achievements/eng.achievements.string -------------------------------------------------------------------------------- /src/MHServerEmu.Games/Data/Game/LiveTuningDataBugFixes.json: -------------------------------------------------------------------------------- 1 | [ 2 | { 3 | "Prototype": "Missions/Prototypes/PVEEndgame/Controllers/DoomFightDailyKismetControl.prototype", 4 | "Setting": "eMTV_Enabled", 5 | "Value": 0.0 6 | } 7 | ] -------------------------------------------------------------------------------- /src/MHServerEmu.Games/Data/Game/Patches/Off/PatchDataGameBalance.json: -------------------------------------------------------------------------------- 1 | [ 2 | { 3 | "Enabled": true, 4 | "Prototype": "Loot/Tables/SplinterBoostTable.prototype", 5 | "Path": "Modifiers[0].Choices", 6 | "Description": "Disable boost condition requirement for the SplinterBoost loot table.", 7 | "ValueType": "PrototypeId[]", 8 | "Value": [] 9 | }, 10 | { 11 | "Enabled": true, 12 | "Prototype": "Loot/Tables/ItemType/ESDropNormalDropTable.prototype", 13 | "Path": "Modifiers[0].Choices", 14 | "Description": "Allow ESDropNormalDropTable drops when the boost condition is applied.", 15 | "ValueType": "PrototypeId[]", 16 | "Value": [] 17 | } 18 | ] -------------------------------------------------------------------------------- /src/MHServerEmu.Games/Data/Game/Patches/Off/PatchDataTestOverrideLoot.json: -------------------------------------------------------------------------------- 1 | [ 2 | { 3 | "Enabled": true, 4 | "Prototype": "Entity/Characters/Mobs/MGH/Chapter/MGHChapter05/MGHBruteNamedCH04.prototype", 5 | "Path": "Properties", 6 | "Description": "Set LootTablePrototype [OnKilledMiniBoss, 0, Spawn, EasterEggHuntObjective]", 7 | "ValueType": "Properties", 8 | "Value": { 9 | "LootTablePrototype": [ 17910267881806762587, 0, 9316722085805298222, 16576396162899383486 ] 10 | } 11 | } 12 | ] -------------------------------------------------------------------------------- /src/MHServerEmu.Games/Dialog/GuildInviteOption.cs: -------------------------------------------------------------------------------- 1 | using MHServerEmu.Games.Entities; 2 | using MHServerEmu.Games.Social.Guilds; 3 | 4 | namespace MHServerEmu.Games.Dialog 5 | { 6 | public class GuildInviteOption : InteractionOption 7 | { 8 | public GuildInviteOption() 9 | { 10 | Priority = 50; 11 | MethodEnum = InteractionMethod.GuildInvite; 12 | } 13 | 14 | public override bool IsCurrentlyAvailable(EntityDesc interacteeDesc, WorldEntity localInteractee, WorldEntity interactor, InteractionFlags interactionFlags) 15 | { 16 | bool isAvailable = false; 17 | if (base.IsCurrentlyAvailable(interacteeDesc, localInteractee, interactor, interactionFlags)) 18 | { 19 | Player interactingPlayer = interactor.GetOwnerOfType(); 20 | if (interactingPlayer == null) 21 | { 22 | Logger.Warn($"GuildInviteOption only works on avatars with a player, but could not find one on {interactor.PrototypeName}!"); 23 | return false; 24 | } 25 | isAvailable = GuildMember.CanInvite(interactingPlayer.GuildMembership); 26 | } 27 | return isAvailable; 28 | } 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /src/MHServerEmu.Games/Dialog/InspectOption.cs: -------------------------------------------------------------------------------- 1 | using MHServerEmu.Games.Entities; 2 | 3 | namespace MHServerEmu.Games.Dialog 4 | { 5 | public class InspectOption : InteractionOption 6 | { 7 | public InspectOption() 8 | { 9 | MethodEnum = InteractionMethod.Inspect; 10 | } 11 | 12 | public override bool IsCurrentlyAvailable(EntityDesc interacteeDesc, WorldEntity localInteractee, WorldEntity interactor, InteractionFlags interactionFlags) 13 | { 14 | bool isAvailable = false; 15 | if (base.IsCurrentlyAvailable(interacteeDesc, localInteractee, interactor, interactionFlags)) 16 | { 17 | Player interactingPlayer = interactor.GetOwnerOfType(); 18 | if (interactingPlayer == null) return Logger.WarnReturn(false, $"InspectOption only works on avatars with a player, but could not find one on {interactor.PrototypeName}!"); 19 | isAvailable = interacteeDesc.PlayerName != interactingPlayer.GetName(); 20 | } 21 | return isAvailable; 22 | } 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /src/MHServerEmu.Games/Dialog/ItemBuyOption.cs: -------------------------------------------------------------------------------- 1 | using MHServerEmu.Games.Entities; 2 | using MHServerEmu.Games.Entities.Items; 3 | using MHServerEmu.Games.GameData.Prototypes; 4 | 5 | namespace MHServerEmu.Games.Dialog 6 | { 7 | public class ItemBuyOption : InteractionOption 8 | { 9 | public ItemBuyOption() 10 | { 11 | MethodEnum = InteractionMethod.Buy; 12 | } 13 | 14 | public override bool IsCurrentlyAvailable(EntityDesc interacteeDesc, WorldEntity localInteractee, WorldEntity interactor, InteractionFlags interactionFlags) 15 | { 16 | bool isAvailable = false; 17 | if (base.IsCurrentlyAvailable(interacteeDesc, localInteractee, interactor, interactionFlags) 18 | && localInteractee != null) 19 | { 20 | if (localInteractee is not Item item) return false; 21 | InventoryPrototype inventoryProto = item.InventoryLocation.InventoryPrototype; 22 | isAvailable = inventoryProto != null && inventoryProto.VendorInvContentsCanBeBought; 23 | } 24 | return isAvailable; 25 | } 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /src/MHServerEmu.Games/Dialog/ItemDonatePetTechOption.cs: -------------------------------------------------------------------------------- 1 | using MHServerEmu.Games.Entities; 2 | using MHServerEmu.Games.Entities.Items; 3 | using MHServerEmu.Games.GameData.Prototypes; 4 | 5 | namespace MHServerEmu.Games.Dialog 6 | { 7 | public class ItemDonatePetTechOption : InteractionOption 8 | { 9 | public ItemDonatePetTechOption() 10 | { 11 | MethodEnum = InteractionMethod.DonatePetTech; 12 | } 13 | 14 | public override bool IsCurrentlyAvailable(EntityDesc interacteeDesc, WorldEntity localInteractee, WorldEntity interactor, InteractionFlags interactionFlags) 15 | { 16 | bool isAvailable = false; 17 | if (base.IsCurrentlyAvailable(interacteeDesc, localInteractee, interactor, interactionFlags) 18 | && localInteractee != null) 19 | { 20 | if (localInteractee is not Item item) return false; 21 | InventoryPrototype inventoryProto = item.InventoryLocation.InventoryPrototype; 22 | if (inventoryProto != null) 23 | isAvailable = inventoryProto.IsPlayerGeneralInventory || inventoryProto.IsPlayerStashInventory; 24 | } 25 | return isAvailable; 26 | } 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /src/MHServerEmu.Games/Dialog/ItemEquipOption.cs: -------------------------------------------------------------------------------- 1 | using MHServerEmu.Games.Entities.Items; 2 | using MHServerEmu.Games.Entities; 3 | using MHServerEmu.Games.GameData.Prototypes; 4 | 5 | namespace MHServerEmu.Games.Dialog 6 | { 7 | public class ItemEquipOption : InteractionOption 8 | { 9 | public ItemEquipOption() 10 | { 11 | Priority = 12; 12 | MethodEnum = InteractionMethod.Equip; 13 | } 14 | 15 | public override bool IsCurrentlyAvailable(EntityDesc interacteeDesc, WorldEntity localInteractee, WorldEntity interactor, InteractionFlags interactionFlags) 16 | { 17 | bool isAvailable = false; 18 | if (base.IsCurrentlyAvailable(interacteeDesc, localInteractee, interactor, interactionFlags) 19 | && localInteractee != null) 20 | { 21 | InventoryPrototype inventoryProto = localInteractee.InventoryLocation.InventoryPrototype; 22 | if (inventoryProto != null) 23 | isAvailable = inventoryProto.IsPlayerGeneralInventory || inventoryProto.IsPlayerGeneralExtraInventory; 24 | } 25 | return isAvailable; 26 | } 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /src/MHServerEmu.Games/Dialog/ItemLinkInChatOption.cs: -------------------------------------------------------------------------------- 1 | using MHServerEmu.Games.Entities; 2 | using MHServerEmu.Games.GameData.Prototypes; 3 | 4 | namespace MHServerEmu.Games.Dialog 5 | { 6 | public class ItemLinkInChatOption : InteractionOption 7 | { 8 | public ItemLinkInChatOption() 9 | { 10 | Priority = 10; 11 | MethodEnum = InteractionMethod.LinkItemInChat; 12 | } 13 | 14 | public override bool IsCurrentlyAvailable(EntityDesc interacteeDesc, WorldEntity localInteractee, WorldEntity interactor, InteractionFlags interactionFlags) 15 | { 16 | bool isAvailable = false; 17 | if (base.IsCurrentlyAvailable(interacteeDesc, localInteractee, interactor, interactionFlags) 18 | && localInteractee != null) 19 | { 20 | InventoryPrototype inventoryProto = localInteractee.InventoryLocation.InventoryPrototype; 21 | isAvailable = inventoryProto != null; 22 | } 23 | 24 | return isAvailable; 25 | } 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /src/MHServerEmu.Games/Dialog/ItemMoveToStashOption.cs: -------------------------------------------------------------------------------- 1 | using MHServerEmu.Games.Entities; 2 | using MHServerEmu.Games.Entities.Items; 3 | using MHServerEmu.Games.GameData.Prototypes; 4 | 5 | namespace MHServerEmu.Games.Dialog 6 | { 7 | public class ItemMoveToStashOption : InteractionOption 8 | { 9 | public ItemMoveToStashOption() 10 | { 11 | Priority = 8; 12 | MethodEnum = InteractionMethod.MoveToStash; 13 | } 14 | 15 | public override bool IsCurrentlyAvailable(EntityDesc interacteeDesc, WorldEntity localInteractee, WorldEntity interactor, InteractionFlags interactionFlags) 16 | { 17 | bool isAvailable = false; 18 | if (base.IsCurrentlyAvailable(interacteeDesc, localInteractee, interactor, interactionFlags) 19 | && localInteractee != null) 20 | { 21 | if (localInteractee is not Item item) return false; 22 | InventoryPrototype inventoryProto = item.InventoryLocation.InventoryPrototype; 23 | if (inventoryProto != null) 24 | isAvailable = inventoryProto.IsPlayerGeneralInventory || inventoryProto.IsEquipmentInventory; 25 | } 26 | return isAvailable; 27 | } 28 | } 29 | } 30 | -------------------------------------------------------------------------------- /src/MHServerEmu.Games/Dialog/ItemMoveToTradeInventoryOption.cs: -------------------------------------------------------------------------------- 1 | using MHServerEmu.Games.Entities.Items; 2 | using MHServerEmu.Games.Entities; 3 | using MHServerEmu.Games.GameData.Prototypes; 4 | 5 | namespace MHServerEmu.Games.Dialog 6 | { 7 | public class ItemMoveToTradeInventoryOption : InteractionOption 8 | { 9 | public ItemMoveToTradeInventoryOption() 10 | { 11 | Priority = 9; 12 | MethodEnum = InteractionMethod.MoveToTradeInventory; 13 | } 14 | 15 | public override bool IsCurrentlyAvailable(EntityDesc interacteeDesc, WorldEntity localInteractee, WorldEntity interactor, InteractionFlags interactionFlags) 16 | { 17 | bool isAvailable = false; 18 | if (base.IsCurrentlyAvailable(interacteeDesc, localInteractee, interactor, interactionFlags) 19 | && localInteractee != null) 20 | { 21 | if (localInteractee is not Item item) return false; 22 | InventoryPrototype inventoryProto = item.InventoryLocation.InventoryPrototype; 23 | if (inventoryProto != null) 24 | isAvailable = inventoryProto.IsPlayerGeneralInventory; 25 | } 26 | return isAvailable; 27 | } 28 | 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /src/MHServerEmu.Games/Dialog/ItemSellOption.cs: -------------------------------------------------------------------------------- 1 | using MHServerEmu.Games.Entities.Items; 2 | using MHServerEmu.Games.Entities; 3 | using MHServerEmu.Games.GameData.Prototypes; 4 | 5 | namespace MHServerEmu.Games.Dialog 6 | { 7 | public class ItemSellOption : InteractionOption 8 | { 9 | public ItemSellOption() 10 | { 11 | MethodEnum = InteractionMethod.Sell; 12 | } 13 | 14 | public override bool IsCurrentlyAvailable(EntityDesc interacteeDesc, WorldEntity localInteractee, WorldEntity interactor, InteractionFlags interactionFlags) 15 | { 16 | bool isAvailable = false; 17 | if (base.IsCurrentlyAvailable(interacteeDesc, localInteractee, interactor, interactionFlags) 18 | && localInteractee != null) 19 | { 20 | if (localInteractee is not Item item) return false; 21 | 22 | InventoryPrototype inventoryProto = item.InventoryLocation.InventoryPrototype; 23 | Player player = interactor.GetOwnerOfType(); 24 | 25 | if (inventoryProto != null && player != null) 26 | isAvailable = inventoryProto.IsPlayerGeneralInventory || item.GetSellPrice(player) > 0; 27 | } 28 | return isAvailable; 29 | } 30 | } 31 | } 32 | -------------------------------------------------------------------------------- /src/MHServerEmu.Games/Dialog/ItemSlotCraftingIngredientOption.cs: -------------------------------------------------------------------------------- 1 | using MHServerEmu.Games.Entities.Items; 2 | using MHServerEmu.Games.Entities; 3 | using MHServerEmu.Games.GameData.Prototypes; 4 | 5 | namespace MHServerEmu.Games.Dialog 6 | { 7 | public class ItemSlotCraftingIngredientOption : InteractionOption 8 | { 9 | public ItemSlotCraftingIngredientOption() 10 | { 11 | Priority = 8; 12 | MethodEnum = InteractionMethod.SlotCraftingIngredient; 13 | } 14 | 15 | public override bool IsCurrentlyAvailable(EntityDesc interacteeDesc, WorldEntity localInteractee, WorldEntity interactor, InteractionFlags interactionFlags) 16 | { 17 | bool isAvailable = false; 18 | if (base.IsCurrentlyAvailable(interacteeDesc, localInteractee, interactor, interactionFlags) 19 | && localInteractee != null) 20 | { 21 | if (localInteractee is not Item item) return false; 22 | InventoryPrototype inventoryProto = item.InventoryLocation.InventoryPrototype; 23 | if (inventoryProto != null) 24 | isAvailable = inventoryProto.IsPlayerGeneralInventory || inventoryProto is PlayerStashInventoryPrototype; 25 | } 26 | return isAvailable; 27 | } 28 | } 29 | } 30 | -------------------------------------------------------------------------------- /src/MHServerEmu.Games/Dialog/PostInteractStateOption.cs: -------------------------------------------------------------------------------- 1 | namespace MHServerEmu.Games.Dialog 2 | { 3 | public class PostInteractStateOption : InteractionOption 4 | { 5 | public PostInteractStateOption() 6 | { 7 | MethodEnum = InteractionMethod.Use; 8 | } 9 | } 10 | } 11 | -------------------------------------------------------------------------------- /src/MHServerEmu.Games/Dialog/ReportAsSpamOption.cs: -------------------------------------------------------------------------------- 1 | namespace MHServerEmu.Games.Dialog 2 | { 3 | public class ReportAsSpamOption : InteractionOption 4 | { 5 | public ReportAsSpamOption() 6 | { 7 | Priority = 50; 8 | MethodEnum = InteractionMethod.ReportAsSpam; 9 | } 10 | } 11 | } 12 | -------------------------------------------------------------------------------- /src/MHServerEmu.Games/Dialog/ReportOption.cs: -------------------------------------------------------------------------------- 1 | namespace MHServerEmu.Games.Dialog 2 | { 3 | public class ReportOption : InteractionOption 4 | { 5 | public ReportOption() 6 | { 7 | Priority = 50; 8 | MethodEnum = InteractionMethod.Report; 9 | } 10 | } 11 | } 12 | -------------------------------------------------------------------------------- /src/MHServerEmu.Games/Dialog/ResurrectOption.cs: -------------------------------------------------------------------------------- 1 | namespace MHServerEmu.Games.Dialog 2 | { 3 | public class ResurrectOption : InteractionOption 4 | { 5 | public ResurrectOption() 6 | { 7 | MethodEnum = InteractionMethod.Resurrect; 8 | } 9 | } 10 | } 11 | -------------------------------------------------------------------------------- /src/MHServerEmu.Games/Dialog/StoryWarpOption.cs: -------------------------------------------------------------------------------- 1 | using MHServerEmu.Games.GameData.Prototypes; 2 | 3 | namespace MHServerEmu.Games.Dialog 4 | { 5 | public class StoryWarpOption : InteractionOption 6 | { 7 | public StoryWarpOption() 8 | { 9 | Priority = 50; 10 | MethodEnum = InteractionMethod.StoryWarp; 11 | IndicatorType = HUDEntityOverheadIcon.StoryWarp; 12 | } 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /src/MHServerEmu.Games/Dialog/TradeOption.cs: -------------------------------------------------------------------------------- 1 | namespace MHServerEmu.Games.Dialog 2 | { 3 | public class TradeOption : InteractionOption 4 | { 5 | public TradeOption() 6 | { 7 | MethodEnum = InteractionMethod.Trade; 8 | } 9 | } 10 | } 11 | -------------------------------------------------------------------------------- /src/MHServerEmu.Games/Dialog/TrainerOption.cs: -------------------------------------------------------------------------------- 1 | namespace MHServerEmu.Games.Dialog 2 | { 3 | public class TrainerOption : InteractionOption 4 | { 5 | public TrainerOption() 6 | { 7 | Priority = 50; 8 | } 9 | } 10 | } 11 | -------------------------------------------------------------------------------- /src/MHServerEmu.Games/Dialog/TransitionOption.cs: -------------------------------------------------------------------------------- 1 | namespace MHServerEmu.Games.Dialog 2 | { 3 | public class TransitionOption : InteractionOption 4 | { 5 | public TransitionOption() 6 | { 7 | Priority = 10; 8 | MethodEnum = InteractionMethod.Use; 9 | } 10 | } 11 | } 12 | -------------------------------------------------------------------------------- /src/MHServerEmu.Games/Entities/Avatars/HotkeyData.cs: -------------------------------------------------------------------------------- 1 | using MHServerEmu.Games.GameData; 2 | 3 | namespace MHServerEmu.Games.Entities.Avatars 4 | { 5 | public readonly struct HotkeyData 6 | { 7 | public PrototypeId AbilityProtoRef { get; } 8 | public AbilitySlot AbilitySlot { get; } 9 | 10 | public HotkeyData(PrototypeId abilityProtoRef, AbilitySlot abilitySlot) 11 | { 12 | AbilityProtoRef = abilityProtoRef; 13 | AbilitySlot = abilitySlot; 14 | } 15 | 16 | public override string ToString() 17 | { 18 | return $"abilityProtoRef={AbilityProtoRef.GetName()}, abilitySlot={AbilitySlot}"; 19 | } 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /src/MHServerEmu.Games/Entities/Avatars/PendingPowerData.cs: -------------------------------------------------------------------------------- 1 | using MHServerEmu.Core.VectorMath; 2 | using MHServerEmu.Games.GameData; 3 | 4 | namespace MHServerEmu.Games.Entities.Avatars 5 | { 6 | public class PendingPowerData 7 | { 8 | public PrototypeId PowerProtoRef { get; protected set; } 9 | public ulong TargetId { get; protected set; } 10 | public Vector3 TargetPosition { get; protected set; } 11 | public ulong SourceItemId { get; protected set; } 12 | 13 | public int RandomSeed { get; set; } 14 | public bool Interrupted { get; set; } 15 | 16 | public virtual bool SetData(PrototypeId powerProtoRef, ulong targetId, Vector3 targetPosition, ulong sourceItemId) 17 | { 18 | PowerProtoRef = powerProtoRef; 19 | TargetId = targetId; 20 | TargetPosition = targetPosition; 21 | SourceItemId = sourceItemId; 22 | 23 | return true; 24 | } 25 | 26 | public virtual bool Clear() 27 | { 28 | PowerProtoRef = PrototypeId.Invalid; 29 | TargetId = Entity.InvalidId; 30 | TargetPosition = Vector3.Zero; 31 | RandomSeed = 0; 32 | Interrupted = false; 33 | 34 | return true; 35 | } 36 | } 37 | } 38 | -------------------------------------------------------------------------------- /src/MHServerEmu.Games/Entities/Items/AffixPropertiesCopyEntry.cs: -------------------------------------------------------------------------------- 1 | using MHServerEmu.Games.GameData.Prototypes; 2 | using MHServerEmu.Games.Properties; 3 | 4 | namespace MHServerEmu.Games.Entities.Items 5 | { 6 | public struct AffixPropertiesCopyEntry 7 | { 8 | public AffixPrototype AffixProto; 9 | public int LevelRequirement; 10 | public PropertyCollection Properties; 11 | public PropertyId PowerModifierPropertyId; // PowerBoost / PowerGrantRank 12 | 13 | public AffixPropertiesCopyEntry() 14 | { 15 | AffixProto = null; 16 | LevelRequirement = 0; 17 | Properties = null; 18 | PowerModifierPropertyId = new(); 19 | } 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /src/MHServerEmu.Games/Entities/Items/BuiltInAffixDetails.cs: -------------------------------------------------------------------------------- 1 | using MHServerEmu.Games.GameData; 2 | using MHServerEmu.Games.GameData.Prototypes; 3 | 4 | namespace MHServerEmu.Games.Entities.Items 5 | { 6 | public struct BuiltInAffixDetails 7 | { 8 | public AffixEntryPrototype AffixEntryProto; 9 | public int LevelRequirement; 10 | public PrototypeId AvatarProtoRef; 11 | public PrototypeId ScopeProtoRef; 12 | public int Seed; 13 | 14 | public BuiltInAffixDetails(AffixEntryPrototype affixEntryProto) 15 | { 16 | AffixEntryProto = affixEntryProto; 17 | LevelRequirement = 0; 18 | AvatarProtoRef = PrototypeId.Invalid; 19 | ScopeProtoRef = PrototypeId.Invalid; 20 | Seed = 0; 21 | } 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /src/MHServerEmu.Games/Entities/KismetSequenceEntity.cs: -------------------------------------------------------------------------------- 1 | namespace MHServerEmu.Games.Entities 2 | { 3 | // KismetSequenceEntity doesn't contain any data of its own, but probably contains behavior 4 | public class KismetSequenceEntity : WorldEntity 5 | { 6 | public KismetSequenceEntity(Game game) : base(game) { } 7 | 8 | public override void OnEnteredWorld(EntitySettings settings) 9 | { 10 | base.OnEnteredWorld(settings); 11 | 12 | Region?.DiscoverEntity(this, false); 13 | } 14 | 15 | public override void OnExitedWorld() 16 | { 17 | Region?.UndiscoverEntity(this, true); 18 | 19 | base.OnExitedWorld(); 20 | } 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /src/MHServerEmu.Games/Entities/PowerCollections/PowerIndexProperties.cs: -------------------------------------------------------------------------------- 1 | namespace MHServerEmu.Games.Entities.PowerCollections 2 | { 3 | public readonly struct PowerIndexProperties 4 | { 5 | public int PowerRank { get; } = 0; 6 | public int CharacterLevel { get; } = 1; 7 | public int CombatLevel { get; } = 1; 8 | public int ItemLevel { get; } = 1; 9 | public float ItemVariation { get; } = 1.0f; 10 | 11 | public PowerIndexProperties(int powerRank = 0, int characterLevel = 1, int combatLevel = 1, int itemLevel = 1, float itemVariation = 1.0f) 12 | { 13 | PowerRank = powerRank; 14 | CharacterLevel = characterLevel; 15 | CombatLevel = combatLevel; 16 | ItemLevel = itemLevel; 17 | ItemVariation = itemVariation; 18 | } 19 | 20 | public override string ToString() 21 | { 22 | return $"{nameof(PowerRank)}={PowerRank}, {nameof(CharacterLevel)}={CharacterLevel}, {nameof(CombatLevel)}={CombatLevel}, {nameof(ItemLevel)}={ItemLevel}, {nameof(ItemVariation)}={ItemVariation:0.0}f"; 23 | } 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /src/MHServerEmu.Games/Events/IScheduledEventFilter.cs: -------------------------------------------------------------------------------- 1 | namespace MHServerEmu.Games.Events 2 | { 3 | /// 4 | /// Filters instances. 5 | /// 6 | public interface IScheduledEventFilter 7 | { 8 | /// 9 | /// Returns if the provided passes the filter. 10 | /// 11 | public bool Filter(ScheduledEvent @event); 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /src/MHServerEmu.Games/Events/Templates/TargetedScheduledEvent.cs: -------------------------------------------------------------------------------- 1 | namespace MHServerEmu.Games.Events.Templates 2 | { 3 | /// 4 | /// An abstract template for a that operates on a instance. 5 | /// 6 | public abstract class TargetedScheduledEvent : ScheduledEvent 7 | { 8 | protected T _eventTarget; 9 | 10 | public override void Clear() 11 | { 12 | _eventTarget = default; 13 | } 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /src/MHServerEmu.Games/GameData/Calligraphy/Attributes/AssetEnumAttribute.cs: -------------------------------------------------------------------------------- 1 | namespace MHServerEmu.Games.GameData.Calligraphy.Attributes 2 | { 3 | /// 4 | /// Indicates that an enum has a corresponding Calligraphy asset type. 5 | /// 6 | [AttributeUsage(AttributeTargets.Enum)] 7 | public class AssetEnumAttribute : Attribute 8 | { 9 | public int DefaultValue { get; } 10 | public string AssetBinding { get; } 11 | 12 | public AssetEnumAttribute(int defaultValue = 0, string assetBinding = null) 13 | { 14 | DefaultValue = defaultValue; 15 | AssetBinding = assetBinding; 16 | } 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /src/MHServerEmu.Games/GameData/Calligraphy/Attributes/DoNotCopyAttribute.cs: -------------------------------------------------------------------------------- 1 | namespace MHServerEmu.Games.GameData.Calligraphy.Attributes 2 | { 3 | /// 4 | /// Indicates that a property needs to be ignored when copying prototype fields. 5 | /// 6 | [AttributeUsage(AttributeTargets.Property)] 7 | public class DoNotCopyAttribute : Attribute { } 8 | } 9 | -------------------------------------------------------------------------------- /src/MHServerEmu.Games/GameData/Calligraphy/Attributes/MixinAttribute.cs: -------------------------------------------------------------------------------- 1 | using MHServerEmu.Games.GameData.Prototypes; 2 | 3 | namespace MHServerEmu.Games.GameData.Calligraphy.Attributes 4 | { 5 | // We use these attributes as a replacement for the PrototypeFieldType enum value that is defined for each field in the client. 6 | // We need this to differentiate non-property mixins from RHStructs when using reflection to deserialize data. 7 | 8 | /// 9 | /// Indicates that a prototype field is a mixin prototype. As far as we currently know, these are used only in and . 10 | /// 11 | [AttributeUsage(AttributeTargets.Property)] 12 | public class MixinAttribute : Attribute { } 13 | 14 | /// 15 | /// Indicates that a prototype field is a list mixin prototype. As far as we currently know, these are used only in . 16 | /// 17 | [AttributeUsage(AttributeTargets.Property)] 18 | public class ListMixinAttribute : Attribute 19 | { 20 | public Type FieldType { get; } // This property is used to indicate what prototype class type is expected in this list mixin 21 | 22 | public ListMixinAttribute(Type fieldType) 23 | { 24 | FieldType = fieldType; 25 | } 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /src/MHServerEmu.Games/GameData/Calligraphy/CalligraphyHeader.cs: -------------------------------------------------------------------------------- 1 | using MHServerEmu.Core.Extensions; 2 | 3 | namespace MHServerEmu.Games.GameData.Calligraphy 4 | { 5 | public readonly struct CalligraphyHeader 6 | { 7 | public string Magic { get; } // File signature 8 | public byte Version { get; } // 10 for versions 1.9-1.17, 11 for 1.18+ 9 | 10 | public CalligraphyHeader(BinaryReader reader) 11 | { 12 | Magic = reader.ReadBytesAsUtf8String(3); 13 | Version = reader.ReadByte(); 14 | } 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /src/MHServerEmu.Games/GameData/Calligraphy/PrototypeMixinList.cs: -------------------------------------------------------------------------------- 1 | using MHServerEmu.Games.GameData.Prototypes; 2 | 3 | namespace MHServerEmu.Games.GameData.Calligraphy 4 | { 5 | /// 6 | /// A of . 7 | /// 8 | public class PrototypeMixinList : List { } 9 | 10 | /// 11 | /// Contains an item and its blueprint information for a list of mixin prototypes. 12 | /// 13 | public class PrototypeMixinListItem 14 | { 15 | public Prototype Prototype { get; set; } 16 | public BlueprintId BlueprintId { get; set; } 17 | public byte BlueprintCopyNum { get; set; } 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /src/MHServerEmu.Games/GameData/GameDataConfig.cs: -------------------------------------------------------------------------------- 1 | using MHServerEmu.Core.Config; 2 | 3 | namespace MHServerEmu.Games.GameData 4 | { 5 | public class GameDataConfig : ConfigContainer 6 | { 7 | public bool LoadAllPrototypes { get; private set; } = false; 8 | public bool UseEquipmentSlotTableCache { get; private set; } = false; 9 | public bool EnablePatchManager { get; private set; } = true; 10 | } 11 | } 12 | -------------------------------------------------------------------------------- /src/MHServerEmu.Games/GameData/GameDataSerializer.cs: -------------------------------------------------------------------------------- 1 | using MHServerEmu.Games.GameData.Prototypes; 2 | 3 | namespace MHServerEmu.Games.GameData 4 | { 5 | /// 6 | /// Base class for prototype data serializers. 7 | /// 8 | public abstract class GameDataSerializer 9 | { 10 | public virtual void Deserialize(Prototype prototype, PrototypeId dataRef, Stream stream) 11 | { 12 | throw new NotImplementedException(); 13 | } 14 | 15 | /* The client also has a Serialize() method here that we don't need. 16 | public void Serialize(Prototype prototype, Stream stream) 17 | { 18 | throw new NotImplementedException(); 19 | } 20 | */ 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /src/MHServerEmu.Games/GameData/Prototypes/DistrictPrototype.cs: -------------------------------------------------------------------------------- 1 | using MHServerEmu.Games.GameData.Prototypes.Markers; 2 | using MHServerEmu.Games.GameData.Resources; 3 | 4 | namespace MHServerEmu.Games.GameData.Prototypes 5 | { 6 | public class DistrictPrototype : Prototype, IBinaryResource 7 | { 8 | public MarkerSetPrototype CellMarkerSet { get; private set; } 9 | public MarkerSetPrototype MarkerSet { get; private set; } // Size is always 0 in all of our files 10 | public PathCollectionPrototype PathCollection { get; private set; } 11 | 12 | public void Deserialize(BinaryReader reader) 13 | { 14 | CellMarkerSet = new(reader); 15 | MarkerSet = new(reader); 16 | PathCollection = new(reader); 17 | } 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /src/MHServerEmu.Games/GameData/Prototypes/EncounterResourcePrototype.cs: -------------------------------------------------------------------------------- 1 | using MHServerEmu.Core.Extensions; 2 | using MHServerEmu.Games.GameData.Prototypes.Markers; 3 | using MHServerEmu.Games.GameData.Resources; 4 | 5 | namespace MHServerEmu.Games.GameData.Prototypes 6 | { 7 | public class EncounterResourcePrototype : Prototype, IBinaryResource 8 | { 9 | public PrototypeGuid PopulationMarkerGuid { get; private set; } 10 | public string ClientMap { get; private set; } 11 | public MarkerSetPrototype MarkerSet { get; private set; } 12 | public NaviPatchSourcePrototype NaviPatchSource { get; private set; } 13 | public bool HasEdges { get; private set; } 14 | 15 | public void Deserialize(BinaryReader reader) 16 | { 17 | PopulationMarkerGuid = (PrototypeGuid)reader.ReadUInt64(); 18 | ClientMap = reader.ReadFixedString32(); 19 | 20 | MarkerSet = new(reader); 21 | NaviPatchSource = new(reader); 22 | 23 | HasEdges = NaviPatchSource.NaviPatch.Edges.HasValue() || NaviPatchSource.PropPatch.Edges.HasValue(); 24 | } 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /src/MHServerEmu.Games/GameData/Prototypes/GameEventPrototype.cs: -------------------------------------------------------------------------------- 1 | using MHServerEmu.Games.GameData.Calligraphy.Attributes; 2 | 3 | namespace MHServerEmu.Games.GameData.Prototypes 4 | { 5 | #region Enums 6 | 7 | [AssetEnum((int)Invalid)] 8 | public enum EntityGameEventEnum 9 | { 10 | Invalid = 0, 11 | AdjustHealth = 1, 12 | EntityDead = 2, 13 | EntityEnteredWorld = 3, 14 | EntityExitedWorld = 4, 15 | PlayerInteract = 5, 16 | } 17 | 18 | #endregion 19 | 20 | public class GameEventPrototype : Prototype 21 | { 22 | } 23 | 24 | public class EntityGameEventPrototype : GameEventPrototype 25 | { 26 | public EntityFilterPrototype EntityFilter { get; protected set; } 27 | public EntityGameEventEnum Event { get; protected set; } 28 | public bool UniqueEntities { get; protected set; } 29 | } 30 | 31 | public class EntityGameEventEvalPrototype : Prototype 32 | { 33 | public EntityGameEventPrototype Event { get; protected set; } 34 | public EvalPrototype Eval { get; protected set; } 35 | } 36 | } 37 | -------------------------------------------------------------------------------- /src/MHServerEmu.Games/GameData/Prototypes/Generators/RegionGeneratorPrototype.cs: -------------------------------------------------------------------------------- 1 | using MHServerEmu.Games.Regions; 2 | 3 | namespace MHServerEmu.Games.GameData.Prototypes 4 | { 5 | public class RegionGeneratorPrototype : Prototype 6 | { 7 | public PrototypeId[] POIGroups { get; protected set; } 8 | 9 | //--- 10 | 11 | public virtual PrototypeId GetStartAreaRef(Region region) { return PrototypeId.Invalid; } 12 | public virtual void GetAreasInGenerator(HashSet areas) { } 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /src/MHServerEmu.Games/GameData/Prototypes/Generators/SingleCellRegionGeneratorPrototype.cs: -------------------------------------------------------------------------------- 1 | namespace MHServerEmu.Games.GameData.Prototypes 2 | { 3 | 4 | public class SingleCellRegionGeneratorPrototype : RegionGeneratorPrototype 5 | { 6 | public PrototypeId AreaInterface { get; protected set; } 7 | public AssetId Cell { get; protected set; } 8 | 9 | public PrototypeId CellProto; 10 | } 11 | } 12 | -------------------------------------------------------------------------------- /src/MHServerEmu.Games/GameData/Prototypes/InventorySortPrototype.cs: -------------------------------------------------------------------------------- 1 | namespace MHServerEmu.Games.GameData.Prototypes 2 | { 3 | public class InventorySortPrototype : Prototype 4 | { 5 | public LocaleStringId DisplayName { get; protected set; } 6 | public bool Ascending { get; protected set; } 7 | public bool DisplayInUI { get; protected set; } 8 | } 9 | 10 | public class InventorySortAlphaPrototype : InventorySortPrototype 11 | { 12 | } 13 | 14 | public class InventorySortRarityPrototype : InventorySortPrototype 15 | { 16 | } 17 | 18 | public class InventorySortItemLevelPrototype : InventorySortPrototype 19 | { 20 | } 21 | 22 | public class InventorySortUsableByPrototype : InventorySortPrototype 23 | { 24 | } 25 | 26 | public class ItemSortCategoryPrototype : Prototype 27 | { 28 | } 29 | 30 | public class InventorySortCategoryPrototype : InventorySortPrototype 31 | { 32 | } 33 | 34 | public class InventorySortSubCategoryPrototype : InventorySortCategoryPrototype 35 | { 36 | } 37 | } 38 | -------------------------------------------------------------------------------- /src/MHServerEmu.Games/GameData/Prototypes/Markers/CellConnectorMarkerPrototype.cs: -------------------------------------------------------------------------------- 1 | using MHServerEmu.Core.Extensions; 2 | using MHServerEmu.Core.VectorMath; 3 | 4 | namespace MHServerEmu.Games.GameData.Prototypes.Markers 5 | { 6 | public class CellConnectorMarkerPrototype : MarkerPrototype 7 | { 8 | public Vector3 Extents { get; } 9 | 10 | public CellConnectorMarkerPrototype(BinaryReader reader) 11 | { 12 | Extents = reader.ReadVector3(); 13 | 14 | ReadMarker(reader); 15 | } 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /src/MHServerEmu.Games/GameData/Prototypes/Markers/DotCornerMarkerPrototype.cs: -------------------------------------------------------------------------------- 1 | using MHServerEmu.Core.Extensions; 2 | using MHServerEmu.Core.VectorMath; 3 | 4 | namespace MHServerEmu.Games.GameData.Prototypes.Markers 5 | { 6 | public class DotCornerMarkerPrototype : MarkerPrototype 7 | { 8 | public Vector3 Extents { get; } 9 | 10 | public DotCornerMarkerPrototype(BinaryReader reader) 11 | { 12 | Extents = reader.ReadVector3(); 13 | 14 | ReadMarker(reader); 15 | } 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /src/MHServerEmu.Games/GameData/Prototypes/Markers/ResourceMarkerPrototype.cs: -------------------------------------------------------------------------------- 1 | using MHServerEmu.Core.Extensions; 2 | 3 | namespace MHServerEmu.Games.GameData.Prototypes.Markers 4 | { 5 | public class ResourceMarkerPrototype : MarkerPrototype 6 | { 7 | public string Resource { get; } 8 | 9 | public ResourceMarkerPrototype(BinaryReader reader) 10 | { 11 | Resource = reader.ReadFixedString32(); 12 | 13 | ReadMarker(reader); 14 | } 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /src/MHServerEmu.Games/GameData/Prototypes/Markers/RoadConnectionMarkerPrototype.cs: -------------------------------------------------------------------------------- 1 | using MHServerEmu.Core.Extensions; 2 | using MHServerEmu.Core.VectorMath; 3 | 4 | namespace MHServerEmu.Games.GameData.Prototypes.Markers 5 | { 6 | public class RoadConnectionMarkerPrototype : MarkerPrototype 7 | { 8 | public Vector3 Extents { get; } 9 | 10 | public RoadConnectionMarkerPrototype(BinaryReader reader) 11 | { 12 | Extents = reader.ReadVector3(); 13 | 14 | ReadMarker(reader); 15 | } 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /src/MHServerEmu.Games/GameData/Prototypes/Markers/UnrealPropMarkerPrototype.cs: -------------------------------------------------------------------------------- 1 | using MHServerEmu.Core.Extensions; 2 | 3 | namespace MHServerEmu.Games.GameData.Prototypes.Markers 4 | { 5 | public class UnrealPropMarkerPrototype : MarkerPrototype 6 | { 7 | public string UnrealClassName { get; } 8 | public string UnrealQualifiedName { get; } 9 | public string UnrealArchetypeName { get; } 10 | 11 | public UnrealPropMarkerPrototype(BinaryReader reader) 12 | { 13 | UnrealClassName = reader.ReadFixedString32(); 14 | UnrealQualifiedName = reader.ReadFixedString32(); 15 | UnrealArchetypeName = reader.ReadFixedString32(); 16 | 17 | ReadMarker(reader); 18 | } 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /src/MHServerEmu.Games/GameData/Prototypes/NaviFragmentPrototype.cs: -------------------------------------------------------------------------------- 1 | using MHServerEmu.Games.Navi; 2 | 3 | namespace MHServerEmu.Games.GameData.Prototypes 4 | { 5 | public class NaviFragmentPrototype : Prototype 6 | { 7 | public NaviFragmentPolyPrototype[] FragmentPolys { get; protected set; } 8 | public NaviFragmentPolyPrototype[] PropFragmentPolys { get; protected set; } 9 | } 10 | 11 | public class NaviFragmentPolyPrototype : Prototype 12 | { 13 | public NaviContentTags ContentTag { get; protected set; } 14 | public ulong Points { get; protected set; } 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /src/MHServerEmu.Games/GameData/Prototypes/PickWeightPrototype.cs: -------------------------------------------------------------------------------- 1 | namespace MHServerEmu.Games.GameData.Prototypes 2 | { 3 | public class PickMethodPrototype : Prototype 4 | { 5 | } 6 | 7 | public class PickAllPrototype : PickMethodPrototype 8 | { 9 | } 10 | 11 | public class PickWeightPrototype : PickMethodPrototype 12 | { 13 | public short Choices { get; protected set; } 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /src/MHServerEmu.Games/GameData/Prototypes/PlayerPrototype.cs: -------------------------------------------------------------------------------- 1 | namespace MHServerEmu.Games.GameData.Prototypes 2 | { 3 | public class PlayerPrototype : EntityPrototype 4 | { 5 | public float CameraFacingDirX { get; protected set; } 6 | public float CameraFacingDirY { get; protected set; } 7 | public float CameraFacingDirZ { get; protected set; } 8 | public float CameraFOV { get; protected set; } 9 | public float CameraZoomDistance { get; protected set; } 10 | public float ResurrectWaitTime { get; protected set; } 11 | public int NumConsumableSlots { get; protected set; } 12 | public AbilityAssignmentPrototype[] StartingEmotes { get; protected set; } 13 | public EntityInventoryAssignmentPrototype[] StashInventories { get; protected set; } 14 | public int MaxDroppedItems { get; protected set; } 15 | } 16 | 17 | public class CohortPrototype : Prototype 18 | { 19 | public int Weight { get; protected set; } 20 | } 21 | 22 | public class CohortExperimentPrototype : Prototype 23 | { 24 | public PrototypeId[] Cohorts { get; protected set; } // VectorPrototypeRefPtr CohortPrototype 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /src/MHServerEmu.Games/GameData/Prototypes/PropertyPrototype.cs: -------------------------------------------------------------------------------- 1 | using MHServerEmu.Games.Properties; 2 | 3 | namespace MHServerEmu.Games.GameData.Prototypes 4 | { 5 | public class PropertyPrototype : Prototype 6 | { 7 | } 8 | 9 | public class PropertyEntryPrototype : Prototype 10 | { 11 | } 12 | 13 | public class PropertyPickInRangeEntryPrototype : PropertyEntryPrototype 14 | { 15 | public PropertyId Prop { get; protected set; } 16 | public EvalPrototype ValueMax { get; protected set; } 17 | public EvalPrototype ValueMin { get; protected set; } 18 | public bool RollAsInteger { get; protected set; } 19 | public LocaleStringId TooltipOverrideText { get; protected set; } 20 | } 21 | 22 | public class PropertySetEntryPrototype : PropertyEntryPrototype 23 | { 24 | public PropertyId Prop { get; protected set; } 25 | public LocaleStringId TooltipOverrideText { get; protected set; } 26 | public EvalPrototype Value { get; protected set; } 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /src/MHServerEmu.Games/GameData/Prototypes/TowerAreaGeneratorPrototype.cs: -------------------------------------------------------------------------------- 1 | namespace MHServerEmu.Games.GameData.Prototypes 2 | { 3 | 4 | public class TowerAreaGeneratorPrototype : GeneratorPrototype 5 | { 6 | public int CellSize { get; protected set; } 7 | public int CellSpacing { get; protected set; } 8 | public TowerAreaEntryPrototype[] Entries { get; protected set; } 9 | 10 | } 11 | 12 | #region TowerAreaEntryPrototype 13 | public class TowerAreaEntryPrototype : Prototype 14 | { 15 | } 16 | 17 | public class TowerAreaRandomSeqCellsEntryPrototype : TowerAreaEntryPrototype 18 | { 19 | public int CellMax { get; protected set; } 20 | public int CellMin { get; protected set; } 21 | public CellSetEntryPrototype[] CellSets { get; protected set; } 22 | } 23 | 24 | public class TowerAreaStaticCellEntryPrototype : TowerAreaEntryPrototype 25 | { 26 | public AssetId Cell { get; protected set; } 27 | public LocaleStringId Name { get; protected set; } 28 | } 29 | #endregion 30 | } 31 | -------------------------------------------------------------------------------- /src/MHServerEmu.Games/GameData/Resources/BinaryResourceHeader.cs: -------------------------------------------------------------------------------- 1 | namespace MHServerEmu.Games.GameData.Resources 2 | { 3 | /// 4 | /// A header shared by all resource prototype files. 5 | /// 6 | public readonly struct BinaryResourceHeader 7 | { 8 | public byte CookerVersion { get; } // 16 9 | public byte Endianness { get; } // 1 for little endian 10 | public ushort Field2 { get; } // wtf is this 11 | public uint PrototypeDataVersion { get; } 12 | public uint ClassHash { get; } 13 | 14 | public BinaryResourceHeader(BinaryReader reader) 15 | { 16 | CookerVersion = reader.ReadByte(); 17 | Endianness = reader.ReadByte(); 18 | Field2 = reader.ReadUInt16(); 19 | PrototypeDataVersion = reader.ReadUInt32(); 20 | ClassHash = reader.ReadUInt32(); 21 | } 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /src/MHServerEmu.Games/GameData/Resources/BinaryResourceSerializer.cs: -------------------------------------------------------------------------------- 1 | using MHServerEmu.Games.GameData.Prototypes; 2 | 3 | namespace MHServerEmu.Games.GameData.Resources 4 | { 5 | /// 6 | /// An implementation of for resource prototypes. 7 | /// 8 | public class BinaryResourceSerializer : GameDataSerializer 9 | { 10 | public override void Deserialize(Prototype prototype, PrototypeId dataRef, Stream stream) 11 | { 12 | // Set this prototype's id data ref 13 | prototype.DataRef = dataRef; 14 | 15 | // Deserialize 16 | using (BinaryReader reader = new(stream)) 17 | { 18 | // Read resource header 19 | BinaryResourceHeader header = new(reader); 20 | 21 | // Deserialize using the IBinaryResource interface 22 | IBinaryResource binaryResource = (IBinaryResource)prototype; 23 | binaryResource.Deserialize(reader); 24 | } 25 | } 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /src/MHServerEmu.Games/GameData/Resources/IBinaryResource.cs: -------------------------------------------------------------------------------- 1 | namespace MHServerEmu.Games.GameData.Resources 2 | { 3 | /// 4 | /// Provides a custom prototype deserialization routine. 5 | /// 6 | public interface IBinaryResource 7 | { 8 | /// 9 | /// Deserializes this binary resource using its custom routine. 10 | /// 11 | public void Deserialize(BinaryReader reader); 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /src/MHServerEmu.Games/GameData/Resources/ResourcePrototypeHashes.cs: -------------------------------------------------------------------------------- 1 | namespace MHServerEmu.Games.GameData.Resources 2 | { 3 | /// 4 | /// A djb2 hash used to identify the resource prototype class. 5 | /// 6 | public enum ResourcePrototypeHash : uint 7 | { 8 | None = 0, 9 | CellConnectorMarkerPrototype = 2901607432, 10 | DotCornerMarkerPrototype = 468664301, 11 | EntityMarkerPrototype = 3862899546, 12 | RoadConnectionMarkerPrototype = 576407411, 13 | ResourceMarkerPrototype = 3468126021, 14 | UnrealPropMarkerPrototype = 913217989, 15 | PathNodeSetPrototype = 1572935802, 16 | PathNodePrototype = 908860270, 17 | PropSetTypeListPrototype = 1819714054, 18 | PropSetTypeEntryPrototype = 2348267420, 19 | ProceduralPropGroupPrototype = 2480167290, 20 | StretchedPanelPrototype = 805156721, 21 | AnchoredPanelPrototype = 1255662575 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /src/MHServerEmu.Games/GameData/Tables/GameDataTables.cs: -------------------------------------------------------------------------------- 1 | namespace MHServerEmu.Games.GameData.Tables 2 | { 3 | public class GameDataTables 4 | { 5 | public static GameDataTables Instance { get; } = new(); 6 | 7 | public AllianceTable AllianceTable { get; } = new(); 8 | public EquipmentSlotTable EquipmentSlotTable { get; } = new(); 9 | public InfinityGemBonusTable InfinityGemBonusTable { get; } = new(); 10 | public InfinityGemBonusPostreqsTable InfinityGetBonusPostreqsTable { get; } = new(); 11 | public LootPickingTable LootPickingTable { get; } = new(); 12 | public PowerOwnerTable PowerOwnerTable { get; } = new(); 13 | public OmegaBonusSetTable OmegaBonusSetTable { get; } = new(); 14 | public OmegaBonusPostreqsTable OmegaBonusPostreqsTable { get; } = new(); 15 | public LootCooldownTable LootCooldownTable { get; } = new(); 16 | 17 | private GameDataTables() { } 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /src/MHServerEmu.Games/GameData/Tables/OmegaBonusSetTable.cs: -------------------------------------------------------------------------------- 1 | using MHServerEmu.Games.GameData.Prototypes; 2 | 3 | namespace MHServerEmu.Games.GameData.Tables 4 | { 5 | public class OmegaBonusSetTable 6 | { 7 | private readonly Dictionary _omegaBonusSetDict = new(); 8 | 9 | public OmegaBonusSetTable() 10 | { 11 | AdvancementGlobalsPrototype advGlobalsProto = GameDatabase.AdvancementGlobalsPrototype; 12 | 13 | foreach (var omegaBonusSetRef in advGlobalsProto.OmegaBonusSets) 14 | { 15 | var omegaBonusSetProto = omegaBonusSetRef.As(); 16 | 17 | foreach (var omegaBonusRef in omegaBonusSetProto.OmegaBonuses) 18 | _omegaBonusSetDict[omegaBonusRef] = omegaBonusSetProto; 19 | } 20 | } 21 | 22 | public OmegaBonusSetPrototype GetOmegaBonusSet(PrototypeId omegaBonusRef) 23 | { 24 | if (_omegaBonusSetDict.TryGetValue(omegaBonusRef, out OmegaBonusSetPrototype omegaBonusSet) == false) 25 | return null; 26 | 27 | return omegaBonusSet; 28 | } 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /src/MHServerEmu.Games/Locales/LocaleManager.cs: -------------------------------------------------------------------------------- 1 | namespace MHServerEmu.Games.Locales 2 | { 3 | /// 4 | /// A singleton that manages instances. 5 | /// 6 | public class LocaleManager 7 | { 8 | public static LocaleManager Instance { get; } = new(); 9 | 10 | public Locale CurrentLocale { get; private set; } 11 | 12 | private LocaleManager() { } 13 | 14 | public bool Initialize() 15 | { 16 | CurrentLocale = new(); 17 | return true; 18 | } 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /src/MHServerEmu.Games/Loot/RarityEntry.cs: -------------------------------------------------------------------------------- 1 | using MHServerEmu.Games.GameData.Prototypes; 2 | 3 | namespace MHServerEmu.Games.Loot 4 | { 5 | /// 6 | /// Wraps with comparison support for magic find scaling. 7 | /// 8 | public readonly struct RarityEntry : IComparable 9 | { 10 | public RarityPrototype Prototype { get; } 11 | public float Weight { get; } 12 | 13 | public RarityEntry(RarityPrototype rarityProto, int level) 14 | { 15 | Prototype = rarityProto; 16 | Weight = rarityProto.GetWeight(level); 17 | } 18 | 19 | public int CompareTo(RarityEntry other) 20 | { 21 | return Prototype.Tier.CompareTo(other.Prototype.Tier); 22 | } 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /src/MHServerEmu.Games/Loot/Specs/AgentSpec.cs: -------------------------------------------------------------------------------- 1 | using Gazillion; 2 | using MHServerEmu.Games.GameData; 3 | 4 | namespace MHServerEmu.Games.Loot.Specs 5 | { 6 | public readonly struct AgentSpec 7 | { 8 | public PrototypeId AgentProtoRef { get; } 9 | public int AgentLevel { get; } 10 | public int CreditsAmount { get; } 11 | 12 | public AgentSpec(PrototypeId agentProtoRef, int agentLevel, int creditsAmount) 13 | { 14 | AgentProtoRef = agentProtoRef; 15 | AgentLevel = agentLevel; 16 | CreditsAmount = creditsAmount; 17 | } 18 | 19 | public NetStructAgentSpec ToProtobuf() 20 | { 21 | return NetStructAgentSpec.CreateBuilder() 22 | .SetAgentProtoRef((ulong)AgentProtoRef) 23 | .SetAgentLevel((uint)AgentLevel) 24 | .SetCreditsAmount((uint)CreditsAmount) 25 | .Build(); 26 | } 27 | 28 | public override string ToString() 29 | { 30 | return $"agentProtoRef={AgentProtoRef.GetName()}, level={AgentLevel}, creditsAmount={CreditsAmount}"; 31 | } 32 | } 33 | } 34 | -------------------------------------------------------------------------------- /src/MHServerEmu.Games/Loot/Specs/VendorXPSummary.cs: -------------------------------------------------------------------------------- 1 | using Gazillion; 2 | using MHServerEmu.Games.GameData; 3 | 4 | namespace MHServerEmu.Games.Loot.Specs 5 | { 6 | public readonly struct VendorXPSummary 7 | { 8 | public PrototypeId VendorProtoRef { get; } 9 | public int XPAmount { get; } 10 | 11 | public VendorXPSummary(PrototypeId vendorProtoRef, int xpAmount) 12 | { 13 | VendorProtoRef = vendorProtoRef; 14 | XPAmount = xpAmount; 15 | } 16 | 17 | public NetStructVendorXPSummary ToProtobuf() 18 | { 19 | return NetStructVendorXPSummary.CreateBuilder() 20 | .SetVendorProtoRef((ulong)VendorProtoRef) 21 | .SetXpAmount((uint)XPAmount) 22 | .Build(); 23 | } 24 | 25 | public override string ToString() 26 | { 27 | return $"vendorProtoRef={VendorProtoRef.GetName()}, xpAmount={XPAmount}"; 28 | } 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /src/MHServerEmu.Games/Loot/Visitors/ILootTableNodeVisitor.cs: -------------------------------------------------------------------------------- 1 | using MHServerEmu.Games.GameData.Prototypes; 2 | 3 | namespace MHServerEmu.Games.Loot.Visitors 4 | { 5 | /// 6 | /// An interface for various visitor pattern implementations used in loot tables. 7 | /// 8 | public interface ILootTableNodeVisitor 9 | { 10 | public void Visit(LootNodePrototype lootNodeProto); 11 | } 12 | } 13 | -------------------------------------------------------------------------------- /src/MHServerEmu.Games/MTXStore/Catalogs/BannerUrl.cs: -------------------------------------------------------------------------------- 1 | using System.Text.Json.Serialization; 2 | using Gazillion; 3 | 4 | namespace MHServerEmu.Games.MTXStore.Catalogs 5 | { 6 | public class BannerUrl 7 | { 8 | public string Type { get; set; } 9 | public string Url { get; set; } 10 | 11 | [JsonConstructor] 12 | public BannerUrl(string type, string url) 13 | { 14 | Type = type; 15 | Url = url; 16 | } 17 | 18 | public BannerUrl(MHBannerUrl bannerUrl) 19 | { 20 | Type = bannerUrl.Type; 21 | Url = bannerUrl.Url; 22 | } 23 | 24 | public MHBannerUrl ToNetStruct() => MHBannerUrl.CreateBuilder().SetType(Type).SetUrl(Url).Build(); 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /src/MHServerEmu.Games/MTXStore/Catalogs/CatalogEntryType.cs: -------------------------------------------------------------------------------- 1 | using System.Text.Json.Serialization; 2 | using Gazillion; 3 | 4 | namespace MHServerEmu.Games.MTXStore.Catalogs 5 | { 6 | public class CatalogEntryType 7 | { 8 | public string Name { get; set; } 9 | public int Order { get; set; } 10 | 11 | [JsonConstructor] 12 | public CatalogEntryType(string name, int order) 13 | { 14 | Name = name; 15 | Order = order; 16 | } 17 | 18 | public CatalogEntryType(MHCatalogEntryType catalogEntryType) 19 | { 20 | Name = catalogEntryType.Name; 21 | Order = catalogEntryType.Order; 22 | } 23 | 24 | public MHCatalogEntryType ToNetStruct() 25 | { 26 | return MHCatalogEntryType.CreateBuilder() 27 | .SetName(Name) 28 | .SetOrder(Order) 29 | .Build(); 30 | } 31 | } 32 | } 33 | -------------------------------------------------------------------------------- /src/MHServerEmu.Games/MTXStore/Catalogs/CatalogEntryTypeModifier.cs: -------------------------------------------------------------------------------- 1 | using System.Text.Json.Serialization; 2 | using Gazillion; 3 | 4 | namespace MHServerEmu.Games.MTXStore.Catalogs 5 | { 6 | public class CatalogEntryTypeModifier 7 | { 8 | public string Name { get; set; } 9 | public int Order { get; set; } 10 | 11 | [JsonConstructor] 12 | public CatalogEntryTypeModifier(string name, int order) 13 | { 14 | Name = name; 15 | Order = order; 16 | } 17 | 18 | public CatalogEntryTypeModifier(MHCatalogEntryTypeModifier catalogEntryTypeModifier) 19 | { 20 | Name = catalogEntryTypeModifier.Name; 21 | Order = catalogEntryTypeModifier.Order; 22 | } 23 | 24 | public MHCatalogEntryTypeModifier ToNetStruct() 25 | { 26 | return MHCatalogEntryTypeModifier.CreateBuilder() 27 | .SetName(Name) 28 | .SetOrder(Order) 29 | .Build(); 30 | } 31 | } 32 | } 33 | -------------------------------------------------------------------------------- /src/MHServerEmu.Games/MetaGames/GameModes/NexusPvPMainMode.cs: -------------------------------------------------------------------------------- 1 | using MHServerEmu.Games.GameData.Prototypes; 2 | 3 | namespace MHServerEmu.Games.MetaGames.GameModes 4 | { 5 | public class NexusPvPMainMode : MetaGameMode 6 | { 7 | private NexusPvPMainModePrototype _proto; 8 | 9 | public NexusPvPMainMode(MetaGame metaGame, MetaGameModePrototype proto) : base(metaGame, proto) 10 | { 11 | // Nexus PvP Region 12 | _proto = proto as NexusPvPMainModePrototype; 13 | } 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /src/MHServerEmu.Games/MetaGames/GameModes/PvEScaleGameMode.cs: -------------------------------------------------------------------------------- 1 | using MHServerEmu.Games.GameData.Prototypes; 2 | 3 | namespace MHServerEmu.Games.MetaGames.GameModes 4 | { 5 | public class PvEScaleGameMode : MetaGameMode 6 | { 7 | private PvEScaleGameModePrototype _proto; 8 | 9 | public PvEScaleGameMode(MetaGame metaGame, MetaGameModePrototype proto) : base(metaGame, proto) 10 | { 11 | // UNUSED Limbo for 32-55 lvl 12 | _proto = proto as PvEScaleGameModePrototype; 13 | } 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /src/MHServerEmu.Games/MetaGames/GameModes/PvEWaveGameMode.cs: -------------------------------------------------------------------------------- 1 | using MHServerEmu.Games.GameData.Prototypes; 2 | 3 | namespace MHServerEmu.Games.MetaGames.GameModes 4 | { 5 | public class PvEWaveGameMode : MetaGameMode 6 | { 7 | private PvEWaveGameModePrototype _proto; 8 | 9 | public PvEWaveGameMode(MetaGame metaGame, MetaGameModePrototype proto) : base(metaGame, proto) 10 | { 11 | // PvE Wave Battle (Dinos Invade Manhattan) 12 | _proto = proto as PvEWaveGameModePrototype; 13 | } 14 | } 15 | } 16 | 17 | -------------------------------------------------------------------------------- /src/MHServerEmu.Games/MetaGames/GameModes/PvPDefenderGameMode.cs: -------------------------------------------------------------------------------- 1 | using MHServerEmu.Games.GameData.Prototypes; 2 | 3 | namespace MHServerEmu.Games.MetaGames.GameModes 4 | { 5 | public class PvPDefenderGameMode : MetaGameMode 6 | { 7 | private PvPDefenderGameModePrototype _proto; 8 | 9 | public PvPDefenderGameMode(MetaGame metaGame, MetaGameModePrototype proto) : base(metaGame, proto) 10 | { 11 | _proto = proto as PvPDefenderGameModePrototype; 12 | } 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /src/MHServerEmu.Games/MetaGames/MetaStates/MetaStateCombatQueueLockout.cs: -------------------------------------------------------------------------------- 1 | using MHServerEmu.Games.GameData.Prototypes; 2 | 3 | namespace MHServerEmu.Games.MetaGames.MetaStates 4 | { 5 | public class MetaStateCombatQueueLockout : MetaState 6 | { 7 | private MetaStateCombatQueueLockoutPrototype _proto; 8 | 9 | public MetaStateCombatQueueLockout(MetaGame metaGame, MetaStatePrototype prototype) : base(metaGame, prototype) 10 | { 11 | _proto = prototype as MetaStateCombatQueueLockoutPrototype; 12 | } 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /src/MHServerEmu.Games/MetaGames/MetaStates/MetaStateLimitPlayerDeathsPerMission.cs: -------------------------------------------------------------------------------- 1 | using MHServerEmu.Games.GameData.Prototypes; 2 | 3 | namespace MHServerEmu.Games.MetaGames.MetaStates 4 | { 5 | public class MetaStateLimitPlayerDeathsPerMission : MetaStateLimitPlayerDeaths 6 | { 7 | private MetaStateLimitPlayerDeathsPerMissionPrototype _proto; 8 | 9 | public MetaStateLimitPlayerDeathsPerMission(MetaGame metaGame, MetaStatePrototype prototype) : base(metaGame, prototype) 10 | { 11 | // SurturDebugDeathLimitPerMisState only 12 | _proto = prototype as MetaStateLimitPlayerDeathsPerMissionPrototype; 13 | } 14 | } 15 | } 16 | 17 | -------------------------------------------------------------------------------- /src/MHServerEmu.Games/MetaGames/MetaStates/MetaStateMissionRestart.cs: -------------------------------------------------------------------------------- 1 | using MHServerEmu.Core.Extensions; 2 | using MHServerEmu.Games.GameData.Prototypes; 3 | 4 | namespace MHServerEmu.Games.MetaGames.MetaStates 5 | { 6 | public class MetaStateMissionRestart : MetaState 7 | { 8 | private MetaStateMissionRestartPrototype _proto; 9 | 10 | public MetaStateMissionRestart(MetaGame metaGame, MetaStatePrototype prototype) : base(metaGame, prototype) 11 | { 12 | _proto = prototype as MetaStateMissionRestartPrototype; 13 | } 14 | 15 | public override void OnApply() 16 | { 17 | if (_proto.MissionsToRestart.IsNullOrEmpty()) return; 18 | 19 | var manager = Region?.MissionManager; 20 | if (manager == null) return; 21 | 22 | foreach (var missionRef in _proto.MissionsToRestart) 23 | { 24 | var mission = manager.MissionByDataRef(missionRef); 25 | mission?.RestartMission(); 26 | } 27 | } 28 | } 29 | } 30 | -------------------------------------------------------------------------------- /src/MHServerEmu.Games/MetaGames/MetaStates/MetaStateRegionPlayerAccess.cs: -------------------------------------------------------------------------------- 1 | using MHServerEmu.Games.GameData.Prototypes; 2 | 3 | namespace MHServerEmu.Games.MetaGames.MetaStates 4 | { 5 | public class MetaStateRegionPlayerAccess : MetaState 6 | { 7 | private MetaStateRegionPlayerAccessPrototype _proto; 8 | 9 | public MetaStateRegionPlayerAccess(MetaGame metaGame, MetaStatePrototype prototype) : base(metaGame, prototype) 10 | { 11 | _proto = prototype as MetaStateRegionPlayerAccessPrototype; 12 | } 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /src/MHServerEmu.Games/MetaGames/MetaStates/MetaStateScoringEventTimerEnd.cs: -------------------------------------------------------------------------------- 1 | using MHServerEmu.Games.GameData.Prototypes; 2 | 3 | namespace MHServerEmu.Games.MetaGames.MetaStates 4 | { 5 | public class MetaStateScoringEventTimerEnd : MetaState 6 | { 7 | private MetaStateScoringEventTimerEndPrototype _proto; 8 | 9 | public MetaStateScoringEventTimerEnd(MetaGame metaGame, MetaStatePrototype prototype) : base(metaGame, prototype) 10 | { 11 | _proto = prototype as MetaStateScoringEventTimerEndPrototype; 12 | } 13 | 14 | public override void OnApply() 15 | { 16 | Region?.ScoringEventTimerEnd(_proto.Timer); 17 | } 18 | } 19 | } 20 | 21 | -------------------------------------------------------------------------------- /src/MHServerEmu.Games/MetaGames/MetaStates/MetaStateScoringEventTimerStart.cs: -------------------------------------------------------------------------------- 1 | using MHServerEmu.Games.GameData.Prototypes; 2 | 3 | namespace MHServerEmu.Games.MetaGames.MetaStates 4 | { 5 | public class MetaStateScoringEventTimerStart : MetaState 6 | { 7 | private MetaStateScoringEventTimerStartPrototype _proto; 8 | 9 | public MetaStateScoringEventTimerStart(MetaGame metaGame, MetaStatePrototype prototype) : base(metaGame, prototype) 10 | { 11 | _proto = prototype as MetaStateScoringEventTimerStartPrototype; 12 | } 13 | 14 | public override void OnApply() 15 | { 16 | Region?.ScoringEventTimerStart(_proto.Timer); 17 | } 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /src/MHServerEmu.Games/MetaGames/MetaStates/MetaStateScoringEventTimerStop.cs: -------------------------------------------------------------------------------- 1 | using MHServerEmu.Games.GameData.Prototypes; 2 | 3 | namespace MHServerEmu.Games.MetaGames.MetaStates 4 | { 5 | public class MetaStateScoringEventTimerStop : MetaState 6 | { 7 | private MetaStateScoringEventTimerStopPrototype _proto; 8 | 9 | public MetaStateScoringEventTimerStop(MetaGame metaGame, MetaStatePrototype prototype) : base(metaGame, prototype) 10 | { 11 | _proto = prototype as MetaStateScoringEventTimerStopPrototype; 12 | } 13 | 14 | public override void OnApply() 15 | { 16 | Region?.ScoringEventTimerStop(_proto.Timer); 17 | } 18 | } 19 | } 20 | 21 | -------------------------------------------------------------------------------- /src/MHServerEmu.Games/MetaGames/MissionMetaGame.cs: -------------------------------------------------------------------------------- 1 | namespace MHServerEmu.Games.MetaGames 2 | { 3 | // MissionMetaGame doesn't contain any data of its own, but probably contains behavior 4 | public class MissionMetaGame : MetaGame 5 | { 6 | public MissionMetaGame(Game game) : base(game) { } 7 | } 8 | } -------------------------------------------------------------------------------- /src/MHServerEmu.Games/Missions/Actions/IMissionActionOwner.cs: -------------------------------------------------------------------------------- 1 |  2 | using MHServerEmu.Games.GameData; 3 | using MHServerEmu.Games.Regions; 4 | 5 | namespace MHServerEmu.Games.Missions.Actions 6 | { 7 | public interface IMissionActionOwner 8 | { 9 | PrototypeId PrototypeDataRef { get; } 10 | Region Region { get; } 11 | } 12 | } 13 | -------------------------------------------------------------------------------- /src/MHServerEmu.Games/Missions/Actions/MissionActionDangerRoomReturnScenarioItem.cs: -------------------------------------------------------------------------------- 1 | using MHServerEmu.Games.GameData.Prototypes; 2 | 3 | namespace MHServerEmu.Games.Missions.Actions 4 | { 5 | public class MissionActionDangerRoomReturnScenarioItem : MissionAction 6 | { 7 | public MissionActionDangerRoomReturnScenarioItem(IMissionActionOwner owner, MissionActionPrototype prototype) : base(owner, prototype) 8 | { 9 | // Not Used 10 | } 11 | } 12 | } 13 | -------------------------------------------------------------------------------- /src/MHServerEmu.Games/Missions/Actions/MissionActionDifficultyOverride.cs: -------------------------------------------------------------------------------- 1 | using MHServerEmu.Games.GameData.Prototypes; 2 | 3 | namespace MHServerEmu.Games.Missions.Actions 4 | { 5 | public class MissionActionDifficultyOverride : MissionAction 6 | { 7 | public MissionActionDifficultyOverride(IMissionActionOwner owner, MissionActionPrototype prototype) : base(owner, prototype) 8 | { 9 | } 10 | } 11 | } 12 | -------------------------------------------------------------------------------- /src/MHServerEmu.Games/Missions/Actions/MissionActionDisableRegionAvatarSwap.cs: -------------------------------------------------------------------------------- 1 | using MHServerEmu.Games.GameData.Prototypes; 2 | 3 | namespace MHServerEmu.Games.Missions.Actions 4 | { 5 | public class MissionActionDisableRegionAvatarSwap : MissionAction 6 | { 7 | public MissionActionDisableRegionAvatarSwap(IMissionActionOwner owner, MissionActionPrototype prototype) : base(owner, prototype) 8 | { 9 | // Not Used 10 | } 11 | } 12 | } 13 | -------------------------------------------------------------------------------- /src/MHServerEmu.Games/Missions/Actions/MissionActionDisableRegionRestrictedRoster.cs: -------------------------------------------------------------------------------- 1 | using MHServerEmu.Games.Entities; 2 | using MHServerEmu.Games.GameData.Prototypes; 3 | 4 | namespace MHServerEmu.Games.Missions.Actions 5 | { 6 | public class MissionActionDisableRegionRestrictedRoster : MissionAction 7 | { 8 | public MissionActionDisableRegionRestrictedRoster(IMissionActionOwner owner, MissionActionPrototype prototype) : base(owner, prototype) 9 | { 10 | // TimesBehaviorController 11 | } 12 | 13 | public override void Run() 14 | { 15 | var region = Region; 16 | if (region == null) return; 17 | region.RestrictedRosterEnabled = false; 18 | foreach (Player player in new PlayerIterator(region)) 19 | player.SendRegionRestrictedRosterUpdate(false); 20 | } 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /src/MHServerEmu.Games/Missions/Actions/MissionActionEnableRegionAvatarSwap.cs: -------------------------------------------------------------------------------- 1 | using MHServerEmu.Games.Entities; 2 | using MHServerEmu.Games.GameData.Prototypes; 3 | 4 | namespace MHServerEmu.Games.Missions.Actions 5 | { 6 | public class MissionActionEnableRegionAvatarSwap : MissionAction 7 | { 8 | public MissionActionEnableRegionAvatarSwap(IMissionActionOwner owner, MissionActionPrototype prototype) : base(owner, prototype) 9 | { 10 | // TimesBehaviorController 11 | } 12 | 13 | public override void Run() 14 | { 15 | var region = Region; 16 | if (region == null) return; 17 | region.AvatarSwapEnabled = true; 18 | foreach (Player player in new PlayerIterator(region)) 19 | player.SendRegionAvatarSwapUpdate(true); 20 | } 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /src/MHServerEmu.Games/Missions/Actions/MissionActionEnableRegionRestrictedRoster.cs: -------------------------------------------------------------------------------- 1 | using MHServerEmu.Games.GameData.Prototypes; 2 | 3 | namespace MHServerEmu.Games.Missions.Actions 4 | { 5 | public class MissionActionEnableRegionRestrictedRoster : MissionAction 6 | { 7 | public MissionActionEnableRegionRestrictedRoster(IMissionActionOwner owner, MissionActionPrototype prototype) : base(owner, prototype) 8 | { 9 | // Not Used 10 | } 11 | } 12 | } 13 | -------------------------------------------------------------------------------- /src/MHServerEmu.Games/Missions/Actions/MissionActionEncounterSpawn.cs: -------------------------------------------------------------------------------- 1 | using MHServerEmu.Games.GameData; 2 | using MHServerEmu.Games.GameData.Prototypes; 3 | 4 | namespace MHServerEmu.Games.Missions.Actions 5 | { 6 | public class MissionActionEncounterSpawn : MissionAction 7 | { 8 | private MissionActionEncounterSpawnPrototype _proto; 9 | public MissionActionEncounterSpawn(IMissionActionOwner owner, MissionActionPrototype prototype) : base(owner, prototype) 10 | { 11 | // CH07MrSinisterSpawnController 12 | _proto = prototype as MissionActionEncounterSpawnPrototype; 13 | } 14 | 15 | public override void Run() 16 | { 17 | var popManager = Region?.PopulationManager; 18 | if (popManager == null) return; 19 | var missionRef = _proto.MissionSpawnOnly ? MissionRef : PrototypeId.Invalid; 20 | popManager.SpawnEncounterPhase(_proto.Phase, _proto.GetEncounterRef(), missionRef); 21 | } 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /src/MHServerEmu.Games/Missions/Actions/MissionActionEntSelEvtBroadcast.cs: -------------------------------------------------------------------------------- 1 | using MHServerEmu.Games.Entities; 2 | using MHServerEmu.Games.GameData.Prototypes; 3 | 4 | namespace MHServerEmu.Games.Missions.Actions 5 | { 6 | public class MissionActionEntSelEvtBroadcast : MissionActionEntityTarget 7 | { 8 | private MissionActionEntSelEvtBroadcastPrototype _proto; 9 | public MissionActionEntSelEvtBroadcast(IMissionActionOwner owner, MissionActionPrototype prototype) : base(owner, prototype) 10 | { 11 | // HeliInvBehaviorController 12 | _proto = prototype as MissionActionEntSelEvtBroadcastPrototype; 13 | } 14 | 15 | public override bool Evaluate(WorldEntity entity) 16 | { 17 | if (base.Evaluate(entity) == false) return false; 18 | if (entity.IsDead) return false; 19 | return true; 20 | } 21 | 22 | public override bool RunEntity(WorldEntity entity) 23 | { 24 | entity.TriggerEntityActionEvent(_proto.EventToBroadcast); 25 | return true; 26 | } 27 | 28 | public override bool RunOnStart() => false; 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /src/MHServerEmu.Games/Missions/Actions/MissionActionEntityDestroy.cs: -------------------------------------------------------------------------------- 1 | using MHServerEmu.Games.Entities; 2 | using MHServerEmu.Games.Entities.Avatars; 3 | using MHServerEmu.Games.GameData.Prototypes; 4 | 5 | namespace MHServerEmu.Games.Missions.Actions 6 | { 7 | public class MissionActionEntityDestroy : MissionActionEntityTarget 8 | { 9 | public MissionActionEntityDestroy(IMissionActionOwner owner, MissionActionPrototype prototype) : base(owner, prototype) 10 | { 11 | // MGNgaraiInvasion 12 | } 13 | 14 | public override bool Evaluate(WorldEntity entity) 15 | { 16 | if (base.Evaluate(entity) == false) return false; 17 | if (entity.IsControlledEntity) return false; 18 | return true; 19 | } 20 | 21 | public override bool RunEntity(WorldEntity entity) 22 | { 23 | if (entity is Avatar || entity.IsTeamUpAgent) return true; 24 | 25 | var spec = entity.SpawnSpec; 26 | if (spec != null) 27 | spec.Destroy(); 28 | else 29 | entity.Destroy(); 30 | 31 | return true; 32 | } 33 | 34 | public override bool RunOnStart() => false; 35 | } 36 | } 37 | -------------------------------------------------------------------------------- /src/MHServerEmu.Games/Missions/Actions/MissionActionEntityKill.cs: -------------------------------------------------------------------------------- 1 | using MHServerEmu.Games.Entities; 2 | using MHServerEmu.Games.GameData.Prototypes; 3 | 4 | namespace MHServerEmu.Games.Missions.Actions 5 | { 6 | public class MissionActionEntityKill : MissionActionEntityTarget 7 | { 8 | private MissionActionEntityKillPrototype _proto; 9 | public MissionActionEntityKill(IMissionActionOwner owner, MissionActionPrototype prototype) : base(owner, prototype) 10 | { 11 | // MGNgaraiInvasion 12 | _proto = prototype as MissionActionEntityKillPrototype; 13 | } 14 | 15 | public override bool Evaluate(WorldEntity entity) 16 | { 17 | if (base.Evaluate(entity) == false) return false; 18 | if (entity.IsDead) return false; 19 | return true; 20 | } 21 | 22 | public override bool RunEntity(WorldEntity entity) 23 | { 24 | entity.Kill(null, _proto.KillFlags); 25 | return true; 26 | } 27 | 28 | public override bool RunOnStart() => false; 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /src/MHServerEmu.Games/Missions/Actions/MissionActionEntitySetState.cs: -------------------------------------------------------------------------------- 1 | using MHServerEmu.Games.Entities; 2 | using MHServerEmu.Games.GameData.Prototypes; 3 | using MHServerEmu.Games.Properties; 4 | 5 | namespace MHServerEmu.Games.Missions.Actions 6 | { 7 | public class MissionActionEntitySetState : MissionActionEntityTarget 8 | { 9 | private MissionActionEntitySetStatePrototype _proto; 10 | public MissionActionEntitySetState(IMissionActionOwner owner, MissionActionPrototype prototype) : base(owner, prototype) 11 | { 12 | // TRBambooVillageSerpent 13 | _proto = prototype as MissionActionEntitySetStatePrototype; 14 | } 15 | 16 | public override bool RunEntity(WorldEntity entity) 17 | { 18 | entity.SetState(_proto.EntityState); 19 | if (_proto.Interactable != TriBool.Undefined) 20 | entity.Properties[PropertyEnum.Interactable] = (int)_proto.Interactable; 21 | return true; 22 | } 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /src/MHServerEmu.Games/Missions/Actions/MissionActionEventTeamAssign.cs: -------------------------------------------------------------------------------- 1 | using MHServerEmu.Games.GameData.Prototypes; 2 | 3 | namespace MHServerEmu.Games.Missions.Actions 4 | { 5 | public class MissionActionEventTeamAssign : MissionAction 6 | { 7 | public MissionActionEventTeamAssign(IMissionActionOwner owner, MissionActionPrototype prototype) : base(owner, prototype) 8 | { 9 | // Not Used 10 | } 11 | } 12 | } 13 | -------------------------------------------------------------------------------- /src/MHServerEmu.Games/Missions/Actions/MissionActionFactionSet.cs: -------------------------------------------------------------------------------- 1 | using MHServerEmu.Games.GameData.Prototypes; 2 | 3 | namespace MHServerEmu.Games.Missions.Actions 4 | { 5 | public class MissionActionFactionSet : MissionAction 6 | { 7 | public MissionActionFactionSet(IMissionActionOwner owner, MissionActionPrototype prototype) : base(owner, prototype) 8 | { 9 | // NotInGame JoinPVPFaction1Daily 10 | } 11 | } 12 | } 13 | -------------------------------------------------------------------------------- /src/MHServerEmu.Games/Missions/Actions/MissionActionHideHUDTutorial.cs: -------------------------------------------------------------------------------- 1 | using MHServerEmu.Core.Memory; 2 | using MHServerEmu.Games.Entities; 3 | using MHServerEmu.Games.GameData.Prototypes; 4 | 5 | namespace MHServerEmu.Games.Missions.Actions 6 | { 7 | public class MissionActionHideHUDTutorial : MissionAction 8 | { 9 | private MissionActionHideHUDTutorialPrototype _proto; 10 | public MissionActionHideHUDTutorial(IMissionActionOwner owner, MissionActionPrototype prototype) : base(owner, prototype) 11 | { 12 | // CH00NPETrainingRoom 13 | _proto = prototype as MissionActionHideHUDTutorialPrototype; 14 | } 15 | 16 | public override void Run() 17 | { 18 | List players = ListPool.Instance.Get(); 19 | if (GetDistributors(_proto.SendTo, players)) 20 | { 21 | foreach (Player player in players) 22 | player.ShowHUDTutorial(null); 23 | } 24 | ListPool.Instance.Return(players); 25 | } 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /src/MHServerEmu.Games/Missions/Actions/MissionActionHideWaypointNotification.cs: -------------------------------------------------------------------------------- 1 | using MHServerEmu.Games.GameData.Prototypes; 2 | 3 | namespace MHServerEmu.Games.Missions.Actions 4 | { 5 | public class MissionActionHideWaypointNotification : MissionAction 6 | { 7 | public MissionActionHideWaypointNotification(IMissionActionOwner owner, MissionActionPrototype prototype) : base(owner, prototype) 8 | { 9 | // Not Used 10 | } 11 | } 12 | } 13 | -------------------------------------------------------------------------------- /src/MHServerEmu.Games/Missions/Actions/MissionActionInventoryGiveAvatar.cs: -------------------------------------------------------------------------------- 1 | using MHServerEmu.Games.GameData.Prototypes; 2 | 3 | namespace MHServerEmu.Games.Missions.Actions 4 | { 5 | public class MissionActionInventoryGiveAvatar : MissionAction 6 | { 7 | public MissionActionInventoryGiveAvatar(IMissionActionOwner owner, MissionActionPrototype prototype) : base(owner, prototype) 8 | { 9 | // NotInGame DefeatMoonstone 10 | } 11 | } 12 | } 13 | -------------------------------------------------------------------------------- /src/MHServerEmu.Games/Missions/Actions/MissionActionMetaStateWaveForce.cs: -------------------------------------------------------------------------------- 1 | using MHServerEmu.Games.GameData.Prototypes; 2 | 3 | namespace MHServerEmu.Games.Missions.Actions 4 | { 5 | public class MissionActionMetaStateWaveForce : MissionAction 6 | { 7 | public MissionActionMetaStateWaveForce(IMissionActionOwner owner, MissionActionPrototype prototype) : base(owner, prototype) 8 | { 9 | // NotInGame RaidSurturResetTC 10 | } 11 | } 12 | } 13 | -------------------------------------------------------------------------------- /src/MHServerEmu.Games/Missions/Actions/MissionActionOpenUIPanel.cs: -------------------------------------------------------------------------------- 1 | using MHServerEmu.Core.Memory; 2 | using MHServerEmu.Games.Entities; 3 | using MHServerEmu.Games.GameData.Prototypes; 4 | 5 | namespace MHServerEmu.Games.Missions.Actions 6 | { 7 | public class MissionActionOpenUIPanel : MissionAction 8 | { 9 | private MissionActionOpenUIPanelPrototype _proto; 10 | public MissionActionOpenUIPanel(IMissionActionOwner owner, MissionActionPrototype prototype) : base(owner, prototype) 11 | { 12 | // OneTimeWhatsNext 13 | _proto = prototype as MissionActionOpenUIPanelPrototype; 14 | } 15 | 16 | public override void Run() 17 | { 18 | List players = ListPool.Instance.Get(); 19 | if (GetDistributors(_proto.SendTo, players)) 20 | { 21 | foreach (Player player in players) 22 | player.SendOpenUIPanel(_proto.PanelName); 23 | } 24 | ListPool.Instance.Return(players); 25 | } 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /src/MHServerEmu.Games/Missions/Actions/MissionActionParticipantPerformPower.cs: -------------------------------------------------------------------------------- 1 | using MHServerEmu.Games.GameData.Prototypes; 2 | 3 | namespace MHServerEmu.Games.Missions.Actions 4 | { 5 | public class MissionActionParticipantPerformPower : MissionAction 6 | { 7 | public MissionActionParticipantPerformPower(IMissionActionOwner owner, MissionActionPrototype prototype) : base(owner, prototype) 8 | { 9 | // Not Used 10 | } 11 | } 12 | } 13 | -------------------------------------------------------------------------------- /src/MHServerEmu.Games/Missions/Actions/MissionActionPlayBanter.cs: -------------------------------------------------------------------------------- 1 | using MHServerEmu.Core.Memory; 2 | using MHServerEmu.Games.Entities; 3 | using MHServerEmu.Games.GameData; 4 | using MHServerEmu.Games.GameData.Prototypes; 5 | 6 | namespace MHServerEmu.Games.Missions.Actions 7 | { 8 | public class MissionActionPlayBanter : MissionAction 9 | { 10 | private MissionActionPlayBanterPrototype _proto; 11 | public MissionActionPlayBanter(IMissionActionOwner owner, MissionActionPrototype prototype) : base(owner, prototype) 12 | { 13 | // CH08MODOKSpawnKismetController 14 | _proto = prototype as MissionActionPlayBanterPrototype; 15 | } 16 | 17 | public override void Run() 18 | { 19 | var banterRef = _proto.BanterAsset; 20 | if (banterRef == AssetId.Invalid) return; 21 | 22 | List players = ListPool.Instance.Get(); 23 | if (GetDistributors(_proto.SendTo, players)) 24 | { 25 | foreach (Player player in players) 26 | player.SendPlayStoryBanter(banterRef); 27 | } 28 | ListPool.Instance.Return(players); 29 | } 30 | } 31 | } 32 | -------------------------------------------------------------------------------- /src/MHServerEmu.Games/Missions/Actions/MissionActionRegionScore.cs: -------------------------------------------------------------------------------- 1 | using MHServerEmu.Games.GameData.Prototypes; 2 | using MHServerEmu.Games.Properties; 3 | 4 | namespace MHServerEmu.Games.Missions.Actions 5 | { 6 | public class MissionActionRegionScore : MissionAction 7 | { 8 | private MissionActionRegionScorePrototype _proto; 9 | public MissionActionRegionScore(IMissionActionOwner owner, MissionActionPrototype prototype) : base(owner, prototype) 10 | { 11 | _proto = prototype as MissionActionRegionScorePrototype; 12 | } 13 | 14 | public override void Run() 15 | { 16 | Region?.Properties.AdjustProperty((float)_proto.Amount, PropertyEnum.TrackedRegionScore); 17 | } 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /src/MHServerEmu.Games/Missions/Actions/MissionActionRegionShutdown.cs: -------------------------------------------------------------------------------- 1 | using MHServerEmu.Games.GameData; 2 | using MHServerEmu.Games.GameData.Prototypes; 3 | 4 | namespace MHServerEmu.Games.Missions.Actions 5 | { 6 | public class MissionActionRegionShutdown : MissionAction 7 | { 8 | private MissionActionRegionShutdownPrototype _proto; 9 | public MissionActionRegionShutdown(IMissionActionOwner owner, MissionActionPrototype prototype) : base(owner, prototype) 10 | { 11 | // OneShotMissionRedSkull 12 | _proto = prototype as MissionActionRegionShutdownPrototype; 13 | } 14 | 15 | public override void Run() 16 | { 17 | var region = Region; 18 | if (region == null) return; 19 | var regionRef = _proto.RegionPrototype; 20 | if (regionRef == PrototypeId.Invalid) return; 21 | var regionProto = GameDatabase.GetPrototype(regionRef); 22 | if (regionProto == null) return; 23 | 24 | if (RegionPrototype.Equivalent(regionProto, region.Prototype) == false) return; 25 | 26 | // TODO add event for shutdown 27 | region.RequestShutdown(); 28 | } 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /src/MHServerEmu.Games/Missions/Actions/MissionActionResetAllMissions.cs: -------------------------------------------------------------------------------- 1 | using MHServerEmu.Games.GameData.Prototypes; 2 | 3 | namespace MHServerEmu.Games.Missions.Actions 4 | { 5 | public class MissionActionResetAllMissions : MissionAction 6 | { 7 | public MissionActionResetAllMissions(IMissionActionOwner owner, MissionActionPrototype prototype) : base(owner, prototype) 8 | { 9 | // Not Used 10 | } 11 | } 12 | } 13 | -------------------------------------------------------------------------------- /src/MHServerEmu.Games/Missions/Actions/MissionActionScoringEventTimerEnd.cs: -------------------------------------------------------------------------------- 1 | using MHServerEmu.Games.GameData.Prototypes; 2 | 3 | namespace MHServerEmu.Games.Missions.Actions 4 | { 5 | public class MissionActionScoringEventTimerEnd : MissionAction 6 | { 7 | private MissionActionScoringEventTimerEndPrototype _proto; 8 | public MissionActionScoringEventTimerEnd(IMissionActionOwner owner, MissionActionPrototype prototype) : base(owner, prototype) 9 | { 10 | // Not Used 11 | _proto = prototype as MissionActionScoringEventTimerEndPrototype; 12 | } 13 | 14 | public override void Run() 15 | { 16 | Region?.ScoringEventTimerEnd(_proto.Timer); 17 | } 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /src/MHServerEmu.Games/Missions/Actions/MissionActionScoringEventTimerStart.cs: -------------------------------------------------------------------------------- 1 | using MHServerEmu.Games.GameData.Prototypes; 2 | 3 | namespace MHServerEmu.Games.Missions.Actions 4 | { 5 | public class MissionActionScoringEventTimerStart : MissionAction 6 | { 7 | private MissionActionScoringEventTimerStartPrototype _proto; 8 | public MissionActionScoringEventTimerStart(IMissionActionOwner owner, MissionActionPrototype prototype) : base(owner, prototype) 9 | { 10 | // DRMissionChallengeCosmicDoopPhase01 11 | _proto = prototype as MissionActionScoringEventTimerStartPrototype; 12 | } 13 | 14 | public override void Run() 15 | { 16 | Region?.ScoringEventTimerStart(_proto.Timer); 17 | } 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /src/MHServerEmu.Games/Missions/Actions/MissionActionScoringEventTimerStop.cs: -------------------------------------------------------------------------------- 1 | using MHServerEmu.Games.GameData.Prototypes; 2 | 3 | namespace MHServerEmu.Games.Missions.Actions 4 | { 5 | public class MissionActionScoringEventTimerStop : MissionAction 6 | { 7 | private MissionActionScoringEventTimerStopPrototype _proto; 8 | public MissionActionScoringEventTimerStop(IMissionActionOwner owner, MissionActionPrototype prototype) : base(owner, prototype) 9 | { 10 | // DRMissionChallengeCosmicDoopPhase01 11 | _proto = prototype as MissionActionScoringEventTimerStopPrototype; 12 | } 13 | 14 | public override void Run() 15 | { 16 | Region?.ScoringEventTimerStop(_proto.Timer); 17 | } 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /src/MHServerEmu.Games/Missions/Actions/MissionActionSetActiveChapter.cs: -------------------------------------------------------------------------------- 1 | using MHServerEmu.Core.Memory; 2 | using MHServerEmu.Games.Entities; 3 | using MHServerEmu.Games.GameData; 4 | using MHServerEmu.Games.GameData.Prototypes; 5 | 6 | namespace MHServerEmu.Games.Missions.Actions 7 | { 8 | public class MissionActionSetActiveChapter : MissionAction 9 | { 10 | private MissionActionSetActiveChapterPrototype _proto; 11 | public MissionActionSetActiveChapter(IMissionActionOwner owner, MissionActionPrototype prototype) : base(owner, prototype) 12 | { 13 | // CH00RaftTutorial 14 | _proto = prototype as MissionActionSetActiveChapterPrototype; 15 | } 16 | 17 | public override void Run() 18 | { 19 | var chapterRef = _proto.Chapter; 20 | if (chapterRef == PrototypeId.Invalid) return; 21 | 22 | List participants = ListPool.Instance.Get(); 23 | if (Mission.GetParticipants(participants)) 24 | { 25 | foreach (Player player in participants) 26 | player.SetActiveChapter(chapterRef); 27 | } 28 | ListPool.Instance.Return(participants); 29 | } 30 | } 31 | } 32 | -------------------------------------------------------------------------------- /src/MHServerEmu.Games/Missions/Actions/MissionActionSetAvatarEndurance.cs: -------------------------------------------------------------------------------- 1 | using MHServerEmu.Games.GameData.Prototypes; 2 | 3 | namespace MHServerEmu.Games.Missions.Actions 4 | { 5 | public class MissionActionSetAvatarEndurance : MissionAction 6 | { 7 | public MissionActionSetAvatarEndurance(IMissionActionOwner owner, MissionActionPrototype prototype) : base(owner, prototype) 8 | { 9 | // Not Used 10 | } 11 | } 12 | } 13 | -------------------------------------------------------------------------------- /src/MHServerEmu.Games/Missions/Actions/MissionActionSetAvatarHealth.cs: -------------------------------------------------------------------------------- 1 | using MHServerEmu.Games.GameData.Prototypes; 2 | 3 | namespace MHServerEmu.Games.Missions.Actions 4 | { 5 | public class MissionActionSetAvatarHealth : MissionAction 6 | { 7 | public MissionActionSetAvatarHealth(IMissionActionOwner owner, MissionActionPrototype prototype) : base(owner, prototype) 8 | { 9 | // Not Used 10 | } 11 | } 12 | } 13 | -------------------------------------------------------------------------------- /src/MHServerEmu.Games/Missions/Actions/MissionActionShowBannerMessage.cs: -------------------------------------------------------------------------------- 1 | using MHServerEmu.Core.Memory; 2 | using MHServerEmu.Games.Entities; 3 | using MHServerEmu.Games.GameData.Prototypes; 4 | 5 | namespace MHServerEmu.Games.Missions.Actions 6 | { 7 | public class MissionActionShowBannerMessage : MissionAction 8 | { 9 | private MissionActionShowBannerMessagePrototype _proto; 10 | public MissionActionShowBannerMessage(IMissionActionOwner owner, MissionActionPrototype prototype) : base(owner, prototype) 11 | { 12 | // SHIELDTeamUpController 13 | _proto = prototype as MissionActionShowBannerMessagePrototype; 14 | } 15 | 16 | public override void Run() 17 | { 18 | List players = ListPool.Instance.Get(); 19 | if (GetDistributors(_proto.SendTo, players)) 20 | { 21 | foreach (Player player in players) 22 | player.SendBannerMessage(_proto.BannerMessage); 23 | } 24 | ListPool.Instance.Return(players); 25 | } 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /src/MHServerEmu.Games/Missions/Actions/MissionActionShowHUDTutorial.cs: -------------------------------------------------------------------------------- 1 | using MHServerEmu.Core.Memory; 2 | using MHServerEmu.Games.Entities; 3 | using MHServerEmu.Games.GameData.Prototypes; 4 | 5 | namespace MHServerEmu.Games.Missions.Actions 6 | { 7 | public class MissionActionShowHUDTutorial : MissionAction 8 | { 9 | private MissionActionShowHUDTutorialPrototype _proto; 10 | public MissionActionShowHUDTutorial(IMissionActionOwner owner, MissionActionPrototype prototype) : base(owner, prototype) 11 | { 12 | // RaftNPETutorialTipsController 13 | _proto = prototype as MissionActionShowHUDTutorialPrototype; 14 | } 15 | 16 | public override void Run() 17 | { 18 | var hudTutorial = _proto.HUDTutorial; 19 | if (hudTutorial == null) return; 20 | 21 | if (hudTutorial.SkipIfOnPC == false) // only PC check 22 | { 23 | List players = ListPool.Instance.Get(); 24 | if (GetDistributors(_proto.SendTo, players)) 25 | { 26 | foreach (Player player in players) 27 | player.ShowHUDTutorial(hudTutorial); 28 | } 29 | ListPool.Instance.Return(players); 30 | } 31 | } 32 | } 33 | } 34 | -------------------------------------------------------------------------------- /src/MHServerEmu.Games/Missions/Actions/MissionActionShowMotionComic.cs: -------------------------------------------------------------------------------- 1 | using MHServerEmu.Core.Memory; 2 | using MHServerEmu.Games.Entities; 3 | using MHServerEmu.Games.GameData.Prototypes; 4 | 5 | namespace MHServerEmu.Games.Missions.Actions 6 | { 7 | public class MissionActionShowMotionComic : MissionAction 8 | { 9 | private MissionActionShowMotionComicPrototype _proto; 10 | public MissionActionShowMotionComic(IMissionActionOwner owner, MissionActionPrototype prototype) : base(owner, prototype) 11 | { 12 | // RaftNPEMotionComicDoomAndHydra 13 | _proto = prototype as MissionActionShowMotionComicPrototype; 14 | } 15 | 16 | public override void Run() 17 | { 18 | List players = ListPool.Instance.Get(); 19 | if (GetDistributors(_proto.SendTo, players)) 20 | { 21 | foreach (Player player in players) 22 | player.QueueFullscreenMovie(_proto.MotionComic); 23 | } 24 | ListPool.Instance.Return(players); 25 | } 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /src/MHServerEmu.Games/Missions/Actions/MissionActionShowOverheadText.cs: -------------------------------------------------------------------------------- 1 | using MHServerEmu.Games.Entities; 2 | using MHServerEmu.Games.GameData.Prototypes; 3 | 4 | namespace MHServerEmu.Games.Missions.Actions 5 | { 6 | public class MissionActionShowOverheadText : MissionActionEntityTarget 7 | { 8 | private MissionActionShowOverheadTextPrototype _proto; 9 | public MissionActionShowOverheadText(IMissionActionOwner owner, MissionActionPrototype prototype) : base(owner, prototype) 10 | { 11 | // PunksLoiteringChurch 12 | _proto = prototype as MissionActionShowOverheadTextPrototype; 13 | } 14 | 15 | public override bool RunEntity(WorldEntity entity) 16 | { 17 | entity.ShowOverheadText(_proto.DisplayText, _proto.DurationMS / 1000.0f); 18 | return true; 19 | } 20 | 21 | public override bool RunOnStart() => false; 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /src/MHServerEmu.Games/Missions/Actions/MissionActionShowTeamSelectDialog.cs: -------------------------------------------------------------------------------- 1 | using MHServerEmu.Games.GameData.Prototypes; 2 | 3 | namespace MHServerEmu.Games.Missions.Actions 4 | { 5 | public class MissionActionShowTeamSelectDialog : MissionAction 6 | { 7 | public MissionActionShowTeamSelectDialog(IMissionActionOwner owner, MissionActionPrototype prototype) : base(owner, prototype) 8 | { 9 | // NotInGame CivilWarEventProgressionMissionPhase02 10 | } 11 | } 12 | } 13 | -------------------------------------------------------------------------------- /src/MHServerEmu.Games/Missions/Actions/MissionActionShowWaypointNotification.cs: -------------------------------------------------------------------------------- 1 | using MHServerEmu.Core.Memory; 2 | using MHServerEmu.Games.Entities; 3 | using MHServerEmu.Games.GameData.Prototypes; 4 | 5 | namespace MHServerEmu.Games.Missions.Actions 6 | { 7 | public class MissionActionShowWaypointNotification : MissionAction 8 | { 9 | private MissionActionShowWaypointNotificationPrototype _proto; 10 | public MissionActionShowWaypointNotification(IMissionActionOwner owner, MissionActionPrototype prototype) : base(owner, prototype) 11 | { 12 | // DailyBugleBreadcrumb 13 | _proto = prototype as MissionActionShowWaypointNotificationPrototype; 14 | } 15 | 16 | public override void Run() 17 | { 18 | List players = ListPool.Instance.Get(); 19 | if (GetDistributors(_proto.SendTo, players)) 20 | { 21 | foreach (Player player in players) 22 | player.SendWaypointNotification(_proto.Waypoint); 23 | } 24 | ListPool.Instance.Return(players); 25 | } 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /src/MHServerEmu.Games/Missions/Actions/MissionActionStoryNotification.cs: -------------------------------------------------------------------------------- 1 | using MHServerEmu.Core.Memory; 2 | using MHServerEmu.Games.Entities; 3 | using MHServerEmu.Games.GameData.Prototypes; 4 | 5 | namespace MHServerEmu.Games.Missions.Actions 6 | { 7 | public class MissionActionStoryNotification : MissionAction 8 | { 9 | private MissionActionStoryNotificationPrototype _proto; 10 | public MissionActionStoryNotification(IMissionActionOwner owner, MissionActionPrototype prototype) : base(owner, prototype) 11 | { 12 | // KaZarController 13 | _proto = prototype as MissionActionStoryNotificationPrototype; 14 | } 15 | 16 | public override void Run() 17 | { 18 | List players = ListPool.Instance.Get(); 19 | if (GetDistributors(_proto.SendTo, players)) 20 | { 21 | foreach (Player player in players) 22 | player.SendStoryNotification(_proto.StoryNotification, MissionRef); 23 | } 24 | ListPool.Instance.Return(players); 25 | } 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /src/MHServerEmu.Games/Missions/Actions/MissionActionUpdateMatch.cs: -------------------------------------------------------------------------------- 1 | using MHServerEmu.Games.GameData.Prototypes; 2 | 3 | namespace MHServerEmu.Games.Missions.Actions 4 | { 5 | public class MissionActionUpdateMatch : MissionAction 6 | { 7 | public MissionActionUpdateMatch(IMissionActionOwner owner, MissionActionPrototype prototype) : base(owner, prototype) 8 | { 9 | // Not Used 10 | } 11 | } 12 | } 13 | -------------------------------------------------------------------------------- /src/MHServerEmu.Games/Missions/Actions/MissionActionWaypointLock.cs: -------------------------------------------------------------------------------- 1 | using MHServerEmu.Core.Memory; 2 | using MHServerEmu.Games.Entities; 3 | using MHServerEmu.Games.GameData.Prototypes; 4 | 5 | namespace MHServerEmu.Games.Missions.Actions 6 | { 7 | public class MissionActionWaypointLock : MissionAction 8 | { 9 | private MissionActionWaypointLockPrototype _proto; 10 | public MissionActionWaypointLock(IMissionActionOwner owner, MissionActionPrototype prototype) : base(owner, prototype) 11 | { 12 | // CivilWarMissionControllerWPRelockCap 13 | _proto = prototype as MissionActionWaypointLockPrototype; 14 | } 15 | 16 | public override void Run() 17 | { 18 | List participants = ListPool.Instance.Get(); 19 | if (Mission.GetParticipants(participants)) 20 | { 21 | foreach (Player player in participants) 22 | player.LockWaypoint(_proto.WaypointToLock); 23 | } 24 | ListPool.Instance.Return(participants); 25 | } 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /src/MHServerEmu.Games/Missions/Actions/MissionActionWaypointUnlock.cs: -------------------------------------------------------------------------------- 1 | using MHServerEmu.Core.Memory; 2 | using MHServerEmu.Games.Entities; 3 | using MHServerEmu.Games.GameData.Prototypes; 4 | 5 | namespace MHServerEmu.Games.Missions.Actions 6 | { 7 | public class MissionActionWaypointUnlock : MissionAction 8 | { 9 | private MissionActionWaypointUnlockPrototype _proto; 10 | public MissionActionWaypointUnlock(IMissionActionOwner owner, MissionActionPrototype prototype) : base(owner, prototype) 11 | { 12 | // HellsKitchenPortalController 13 | _proto = prototype as MissionActionWaypointUnlockPrototype; 14 | } 15 | 16 | public override void Run() 17 | { 18 | List participants = ListPool.Instance.Get(); 19 | if (Mission.GetParticipants(participants)) 20 | { 21 | foreach (Player player in participants) 22 | player.UnlockWaypoint(_proto.WaypointToUnlock); 23 | } 24 | ListPool.Instance.Return(participants); 25 | } 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /src/MHServerEmu.Games/Missions/Conditions/IMissionConditionOwner.cs: -------------------------------------------------------------------------------- 1 |  2 | namespace MHServerEmu.Games.Missions.Conditions 3 | { 4 | public interface IMissionConditionOwner 5 | { 6 | void OnUpdateCondition(MissionCondition condition); 7 | bool OnConditionCompleted(); 8 | } 9 | } 10 | -------------------------------------------------------------------------------- /src/MHServerEmu.Games/Missions/Conditions/MissionConditionAnd.cs: -------------------------------------------------------------------------------- 1 | using MHServerEmu.Games.GameData.Prototypes; 2 | 3 | namespace MHServerEmu.Games.Missions.Conditions 4 | { 5 | public class MissionConditionAnd : MissionConditionList 6 | { 7 | public MissionConditionAnd(Mission mission, IMissionConditionOwner owner, MissionConditionPrototype prototype) 8 | : base(mission, owner, prototype) 9 | { 10 | } 11 | 12 | public override bool IsCompleted() 13 | { 14 | foreach (var condition in Conditions) 15 | if (condition != null && condition.IsCompleted() == false) 16 | return false; 17 | 18 | return true; 19 | } 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /src/MHServerEmu.Games/Missions/Conditions/MissionConditionCohort.cs: -------------------------------------------------------------------------------- 1 | using MHServerEmu.Games.GameData.Prototypes; 2 | 3 | namespace MHServerEmu.Games.Missions.Conditions 4 | { 5 | public class MissionConditionCohort : MissionPlayerCondition 6 | { 7 | private MissionConditionCohortPrototype _proto; 8 | 9 | public MissionConditionCohort(Mission mission, IMissionConditionOwner owner, MissionConditionPrototype prototype) 10 | : base(mission, owner, prototype) 11 | { 12 | // DevelopmentOnly testCohorts 13 | _proto = prototype as MissionConditionCohortPrototype; 14 | } 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /src/MHServerEmu.Games/Missions/Conditions/MissionConditionGlobalEventComplete.cs: -------------------------------------------------------------------------------- 1 | using MHServerEmu.Games.GameData.Prototypes; 2 | 3 | namespace MHServerEmu.Games.Missions.Conditions 4 | { 5 | public class MissionConditionGlobalEventComplete : MissionPlayerCondition 6 | { 7 | public MissionConditionGlobalEventComplete(Mission mission, IMissionConditionOwner owner, MissionConditionPrototype prototype) 8 | : base(mission, owner, prototype) 9 | { 10 | // NotInGame CH09Main1AFrostyReception 11 | } 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /src/MHServerEmu.Games/Missions/Conditions/MissionConditionInventoryCapacity.cs: -------------------------------------------------------------------------------- 1 | using MHServerEmu.Games.GameData.Prototypes; 2 | 3 | namespace MHServerEmu.Games.Missions.Conditions 4 | { 5 | public class MissionConditionInventoryCapacity : MissionPlayerCondition 6 | { 7 | public MissionConditionInventoryCapacity(Mission mission, IMissionConditionOwner owner, MissionConditionPrototype prototype) 8 | : base(mission, owner, prototype) 9 | { 10 | // Not Used 11 | } 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /src/MHServerEmu.Games/Missions/Conditions/MissionConditionLogicFalse.cs: -------------------------------------------------------------------------------- 1 | using MHServerEmu.Games.GameData.Prototypes; 2 | 3 | namespace MHServerEmu.Games.Missions.Conditions 4 | { 5 | public class MissionConditionLogicFalse : MissionPlayerCondition 6 | { 7 | public MissionConditionLogicFalse(Mission mission, IMissionConditionOwner owner, MissionConditionPrototype prototype) 8 | : base(mission, owner, prototype) 9 | { 10 | } 11 | } 12 | } 13 | -------------------------------------------------------------------------------- /src/MHServerEmu.Games/Missions/Conditions/MissionConditionLogicTrue.cs: -------------------------------------------------------------------------------- 1 | using MHServerEmu.Games.GameData.Prototypes; 2 | 3 | namespace MHServerEmu.Games.Missions.Conditions 4 | { 5 | public class MissionConditionLogicTrue : MissionPlayerCondition 6 | { 7 | public MissionConditionLogicTrue(Mission mission, IMissionConditionOwner owner, MissionConditionPrototype prototype) 8 | : base(mission, owner, prototype) 9 | { 10 | } 11 | 12 | public override bool OnReset() 13 | { 14 | SetCompleted(); 15 | return true; 16 | } 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /src/MHServerEmu.Games/Missions/Conditions/MissionConditionMetaStateComplete.cs: -------------------------------------------------------------------------------- 1 | using MHServerEmu.Games.GameData.Prototypes; 2 | 3 | namespace MHServerEmu.Games.Missions.Conditions 4 | { 5 | public class MissionConditionMetaStateComplete : MissionPlayerCondition 6 | { 7 | private MissionConditionMetaStateCompletePrototype _proto; 8 | protected override long RequiredCount => _proto.Count; 9 | 10 | public MissionConditionMetaStateComplete(Mission mission, IMissionConditionOwner owner, MissionConditionPrototype prototype) 11 | : base(mission, owner, prototype) 12 | { 13 | // Not Used 14 | _proto = prototype as MissionConditionMetaStateCompletePrototype; 15 | } 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /src/MHServerEmu.Games/Missions/Conditions/MissionConditionOr.cs: -------------------------------------------------------------------------------- 1 | using MHServerEmu.Games.GameData.Prototypes; 2 | 3 | namespace MHServerEmu.Games.Missions.Conditions 4 | { 5 | public class MissionConditionOr : MissionConditionList 6 | { 7 | public MissionConditionOr(Mission mission, IMissionConditionOwner owner, MissionConditionPrototype prototype) 8 | : base(mission, owner, prototype) 9 | { 10 | } 11 | 12 | public override bool IsCompleted() 13 | { 14 | if (Conditions.Count == 0) return false; 15 | foreach (var condition in Conditions) 16 | if (condition != null && condition.IsCompleted()) 17 | return true; 18 | 19 | return false; 20 | } 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /src/MHServerEmu.Games/Missions/Conditions/MissionConditionPowerEquip.cs: -------------------------------------------------------------------------------- 1 | using MHServerEmu.Games.GameData.Prototypes; 2 | 3 | namespace MHServerEmu.Games.Missions.Conditions 4 | { 5 | public class MissionConditionPowerEquip : MissionPlayerCondition 6 | { 7 | public MissionConditionPowerEquip(Mission mission, IMissionConditionOwner owner, MissionConditionPrototype prototype) 8 | : base(mission, owner, prototype) 9 | { 10 | // Not Used 11 | } 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /src/MHServerEmu.Games/Missions/Conditions/MissionConditionPowerPointsRemaining.cs: -------------------------------------------------------------------------------- 1 | using MHServerEmu.Games.GameData.Prototypes; 2 | 3 | namespace MHServerEmu.Games.Missions.Conditions 4 | { 5 | public class MissionConditionPowerPointsRemaining : MissionPlayerCondition 6 | { 7 | public MissionConditionPowerPointsRemaining(Mission mission, IMissionConditionOwner owner, MissionConditionPrototype prototype) 8 | : base(mission, owner, prototype) 9 | { 10 | // NotInGame TimesPowerPointController 11 | } 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /src/MHServerEmu.Games/Missions/Conditions/MissionConditionPublicEventIsActive.cs: -------------------------------------------------------------------------------- 1 | using MHServerEmu.Games.GameData.Prototypes; 2 | 3 | namespace MHServerEmu.Games.Missions.Conditions 4 | { 5 | public class MissionConditionPublicEventIsActive : MissionPlayerCondition 6 | { 7 | public MissionConditionPublicEventIsActive(Mission mission, IMissionConditionOwner owner, MissionConditionPrototype prototype) 8 | : base(mission, owner, prototype) 9 | { 10 | // Not Used 11 | } 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /src/MHServerEmu.Games/Missions/Conditions/MissionConditionRegionHasMatch.cs: -------------------------------------------------------------------------------- 1 | using MHServerEmu.Games.GameData.Prototypes; 2 | 3 | namespace MHServerEmu.Games.Missions.Conditions 4 | { 5 | public class MissionConditionRegionHasMatch : MissionPlayerCondition 6 | { 7 | public MissionConditionRegionHasMatch(Mission mission, IMissionConditionOwner owner, MissionConditionPrototype prototype) 8 | : base(mission, owner, prototype) 9 | { 10 | // Not Used 11 | } 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /src/MHServerEmu.Games/Missions/Conditions/MissionConditionTeamUpIsActive.cs: -------------------------------------------------------------------------------- 1 | using MHServerEmu.Games.GameData.Prototypes; 2 | 3 | namespace MHServerEmu.Games.Missions.Conditions 4 | { 5 | public class MissionConditionTeamUpIsActive : MissionPlayerCondition 6 | { 7 | public MissionConditionTeamUpIsActive(Mission mission, IMissionConditionOwner owner, MissionConditionPrototype prototype) 8 | : base(mission, owner, prototype) 9 | { 10 | // NotInGame BenjaTeamUpTest 11 | } 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /src/MHServerEmu.Games/Missions/IMissionManagerOwner.cs: -------------------------------------------------------------------------------- 1 | namespace MHServerEmu.Games.Missions 2 | { 3 | public interface IMissionManagerOwner { } 4 | } 5 | -------------------------------------------------------------------------------- /src/MHServerEmu.Games/Missions/InteractionTag.cs: -------------------------------------------------------------------------------- 1 | using System.Text; 2 | 3 | namespace MHServerEmu.Games.Missions 4 | { 5 | public readonly struct InteractionTag 6 | { 7 | // Relevant protobuf: NetStructMissionInteractionTag 8 | 9 | public ulong EntityId { get; } 10 | public ulong RegionId { get; } 11 | //public TimeSpan Timestamp { get; } // GameTime, used only in non-replication archives, tags older than 1 day are discarded during deserialization 12 | 13 | public InteractionTag(ulong entityId, ulong regionId) 14 | { 15 | EntityId = entityId; 16 | RegionId = regionId; 17 | //Timestamp = TimeSpan.Zero; 18 | } 19 | 20 | public override string ToString() 21 | { 22 | StringBuilder sb = new(); 23 | sb.AppendLine($"{nameof(EntityId)}: {EntityId}"); 24 | sb.AppendLine($"{nameof(RegionId)}: {RegionId}"); 25 | //sb.AppendLine($"{nameof(Timestamp)}: {Clock.GameTimeToDateTime(Timestamp)}"); 26 | return sb.ToString(); 27 | } 28 | } 29 | } 30 | -------------------------------------------------------------------------------- /src/MHServerEmu.Games/Navi/ICanBlock.cs: -------------------------------------------------------------------------------- 1 | using MHServerEmu.Games.Entities; 2 | 3 | namespace MHServerEmu.Games.Navi 4 | { 5 | public interface ICanBlock 6 | { 7 | public bool CanBlock(WorldEntity other); 8 | } 9 | } 10 | -------------------------------------------------------------------------------- /src/MHServerEmu.Games/Navi/NaviEar.cs: -------------------------------------------------------------------------------- 1 | using MHServerEmu.Core.VectorMath; 2 | 3 | namespace MHServerEmu.Games.Navi 4 | { 5 | public class NaviEar : IComparable 6 | { 7 | public float Power; 8 | public NaviPoint Point; 9 | public NaviEdge Edge; 10 | public int PrevIndex; 11 | public int NextIndex; 12 | 13 | public int CompareTo(NaviEar other) 14 | { 15 | return other.Power.CompareTo(Power); 16 | } 17 | 18 | public void CalcPower(List listEar, Vector3 point) 19 | { 20 | var p0 = listEar[PrevIndex].Point; 21 | var p1 = Point; 22 | var p2 = listEar[NextIndex].Point; 23 | 24 | if (Pred.IsDegenerate(p0, p1, p2) == false) 25 | Power = Pred.CalcEarPower(p0.Pos, p1.Pos, p2.Pos, point); 26 | else 27 | Power = float.MaxValue; 28 | } 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /src/MHServerEmu.Games/Network/IArchiveMessageHandler.cs: -------------------------------------------------------------------------------- 1 | namespace MHServerEmu.Games.Network 2 | { 3 | // Note: this has to be an interface rather than an abstract class like in the client because C# does not support multiple inheritance. 4 | 5 | public interface IArchiveMessageHandler 6 | { 7 | public ulong ReplicationId { get; } 8 | public bool IsBound { get; } 9 | 10 | public bool Bind(IArchiveMessageDispatcher messageDispatcher, AOINetworkPolicyValues interestPolicies); 11 | public void Unbind(); 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /src/MHServerEmu.Games/Network/InstanceManagement/GameInstanceConfig.cs: -------------------------------------------------------------------------------- 1 | using MHServerEmu.Core.Config; 2 | 3 | namespace MHServerEmu.Games.Network.InstanceManagement 4 | { 5 | public class GameInstanceConfig : ConfigContainer 6 | { 7 | public int NumWorkerThreads { get; private set; } = 1; 8 | } 9 | } 10 | -------------------------------------------------------------------------------- /src/MHServerEmu.Games/Powers/MovementPowerEntityCollideFunc.cs: -------------------------------------------------------------------------------- 1 | using MHServerEmu.Core.Logging; 2 | using MHServerEmu.Games.Entities; 3 | using MHServerEmu.Games.GameData.Prototypes; 4 | using MHServerEmu.Games.Navi; 5 | 6 | namespace MHServerEmu.Games.Powers 7 | { 8 | public readonly struct MovementPowerEntityCollideFunc : ICanBlock 9 | { 10 | private static readonly Logger Logger = LogManager.CreateLogger(); 11 | 12 | private readonly int _blockTypeFlags; // BoundsMovementPowerBlockType 13 | 14 | public MovementPowerEntityCollideFunc(int blockTypeFlags) 15 | { 16 | _blockTypeFlags = blockTypeFlags; 17 | if (_blockTypeFlags == 0) 18 | Logger.Warn("Blocking query with movement power blocking type of None doesn't make sense"); 19 | } 20 | 21 | public bool CanBlock(WorldEntity otherEntity) 22 | { 23 | var otherEntityProto = otherEntity.WorldEntityPrototype; 24 | BoundsPrototype otherEntityBoundsProto = otherEntityProto?.Bounds; 25 | 26 | if (otherEntityBoundsProto == null) 27 | return false; 28 | 29 | return ((1 << (int)otherEntityBoundsProto.BlocksMovementPowers) & _blockTypeFlags) != 0; 30 | } 31 | } 32 | } 33 | -------------------------------------------------------------------------------- /src/MHServerEmu.Games/Properties/Evals/EvalContextVar.cs: -------------------------------------------------------------------------------- 1 | namespace MHServerEmu.Games.Properties.Evals 2 | { 3 | public struct EvalContextVar 4 | { 5 | public EvalVar Var; 6 | public bool ReadOnly; 7 | } 8 | } 9 | -------------------------------------------------------------------------------- /src/MHServerEmu.Games/Properties/Evals/EvalVarValue.cs: -------------------------------------------------------------------------------- 1 | using System.Runtime.InteropServices; 2 | using MHServerEmu.Games.Entities; 3 | using MHServerEmu.Games.GameData; 4 | 5 | namespace MHServerEmu.Games.Properties.Evals 6 | { 7 | [StructLayout(LayoutKind.Explicit)] 8 | public struct EvalVarValue 9 | { 10 | [FieldOffset(0)] 11 | public bool Bool = false; 12 | [FieldOffset(0)] 13 | public float Float = 0.0f; 14 | [FieldOffset(0)] 15 | public long Int = 0; 16 | [FieldOffset(0)] 17 | public ulong EntityId = 0; 18 | [FieldOffset(0)] 19 | public AssetId AssetId = 0; 20 | [FieldOffset(0)] 21 | public PrototypeId Proto = 0; 22 | [FieldOffset(0)] 23 | public ulong PropId = 0; 24 | [FieldOffset(8)] 25 | public PropertyCollection Props = null; 26 | [FieldOffset(8)] 27 | public List ProtoRefList = null; 28 | [FieldOffset(8)] 29 | public PrototypeId[] ProtoRefVector = null; 30 | [FieldOffset(8)] 31 | public ConditionCollection Conditions = null; 32 | [FieldOffset(8)] 33 | public Entity Entity = null; 34 | [FieldOffset(0)] 35 | public ulong EntityGuid = 0; 36 | 37 | public EvalVarValue() { } 38 | } 39 | } 40 | -------------------------------------------------------------------------------- /src/MHServerEmu.Games/Properties/IPropertyChangeWatcher.cs: -------------------------------------------------------------------------------- 1 | namespace MHServerEmu.Games.Properties 2 | { 3 | /// 4 | /// An inteface for implementing the Observer pattern for . 5 | /// 6 | public interface IPropertyChangeWatcher 7 | { 8 | /// 9 | /// Subscribes for property updates in the provided . 10 | /// 11 | public void Attach(PropertyCollection propertyCollection); 12 | 13 | /// 14 | /// Unsubscribes from property updates in the provided / 15 | /// 16 | public void Detach(bool removeFromAttachedCollection); 17 | 18 | /// 19 | /// Handles property change in the attached . 20 | /// 21 | public void OnPropertyChange(PropertyId id, PropertyValue newValue, PropertyValue oldValue, SetPropertyFlags flags); 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /src/MHServerEmu.Games/Regions/AreaSettings.cs: -------------------------------------------------------------------------------- 1 | using MHServerEmu.Core.VectorMath; 2 | using MHServerEmu.Games.GameData; 3 | 4 | namespace MHServerEmu.Games.Regions 5 | { 6 | public class AreaSettings 7 | { 8 | public uint Id { get; set; } 9 | public Vector3 Origin { get; set; } 10 | public RegionSettings RegionSettings { get; set; } 11 | public PrototypeId AreaDataRef { get; set; } 12 | public bool IsStartArea { get; set; } 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /src/MHServerEmu.Games/Regions/CellSettings.cs: -------------------------------------------------------------------------------- 1 | using MHServerEmu.Core.VectorMath; 2 | using MHServerEmu.Games.GameData; 3 | 4 | namespace MHServerEmu.Games.Regions 5 | { 6 | public class CellSettings 7 | { 8 | public Vector3 PositionInArea { get; set; } 9 | public Orientation OrientationInArea { get; set; } 10 | public PrototypeId CellRef { get; set; } 11 | public int Seed { get; set; } 12 | public int BufferWidth { get; set; } 13 | public LocaleStringId OverrideLocationName { get; set; } 14 | public List ConnectedCells { get; set; } 15 | public PrototypeId PopulationThemeOverrideRef { get; set; } 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /src/MHServerEmu.Games/Regions/ObjectiveGraphs/ObjectiveGraphConnection.cs: -------------------------------------------------------------------------------- 1 | namespace MHServerEmu.Games.Regions.ObjectiveGraphs 2 | { 3 | public readonly struct ObjectiveGraphConnection 4 | { 5 | public ObjectiveGraphNode Node0 { get; } 6 | public ObjectiveGraphNode Node1 { get; } 7 | public float Distance { get; } 8 | 9 | public ObjectiveGraphConnection(ObjectiveGraphNode node0, ObjectiveGraphNode node1, float distance) 10 | { 11 | // The original implementation sorts by pointer here 12 | if (node0.InstanceNumber >= node1.InstanceNumber) 13 | { 14 | Node0 = node1; 15 | Node1 = node0; 16 | } 17 | else 18 | { 19 | Node0 = node0; 20 | Node1 = node1; 21 | } 22 | 23 | Distance = distance; 24 | } 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /src/MHServerEmu.Games/Regions/ObjectiveGraphs/ObjectiveGraphEnums.cs: -------------------------------------------------------------------------------- 1 | using MHServerEmu.Games.GameData.Calligraphy.Attributes; 2 | 3 | namespace MHServerEmu.Games.Regions.ObjectiveGraphs 4 | { 5 | [AssetEnum((int)Off)] 6 | public enum ObjectiveGraphMode // Regions/EnumObjectiveGraphMode.type 7 | { 8 | Off, 9 | PathDistance, 10 | PathNavi, 11 | } 12 | 13 | public enum ObjectiveGraphType 14 | { 15 | Invalid = 0, 16 | Objective = 1, 17 | Avatar = 2, 18 | Layout = 3, 19 | Portal = 4 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /src/MHServerEmu.Games/Regions/ReservedSpawn.cs: -------------------------------------------------------------------------------- 1 | using Gazillion; 2 | using MHServerEmu.Games.GameData; 3 | 4 | namespace MHServerEmu.Games.Regions 5 | { 6 | public class ReservedSpawn 7 | { 8 | public AssetId Asset { get; } 9 | public int Id { get; } 10 | public bool UseMarkerOrientation { get; } 11 | 12 | public ReservedSpawn(AssetId asset, int id, bool useMarkerOrientation) 13 | { 14 | Asset = asset; 15 | Id = id; 16 | UseMarkerOrientation = useMarkerOrientation; 17 | } 18 | 19 | public NetStructReservedSpawn ToNetStruct() 20 | { 21 | return NetStructReservedSpawn.CreateBuilder() 22 | .SetAsset((ulong)Asset) 23 | .SetId((uint)Id) 24 | .SetUseMarkerOrientation(UseMarkerOrientation) 25 | .Build(); 26 | } 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /src/MHServerEmu.Games/UI/DialogButton.cs: -------------------------------------------------------------------------------- 1 | using Gazillion; 2 | using MHServerEmu.Games.GameData; 3 | using MHServerEmu.Games.GameData.Prototypes; 4 | 5 | namespace MHServerEmu.Games.UI 6 | { 7 | public class DialogButton 8 | { 9 | public GameDialogResultEnum Type { get; } 10 | public LocaleStringMessageHandler ButtonText { get; } 11 | public ButtonStyle Style { get; } 12 | public bool Enabled { get; set; } 13 | 14 | public DialogButton(GameDialogResultEnum type, LocaleStringId buttonText, ButtonStyle style, bool enabled) 15 | { 16 | Type = type; 17 | ButtonText = new(buttonText); 18 | Style = style; 19 | Enabled = enabled; 20 | } 21 | 22 | public NetStructDialogButton ToProtobuf() 23 | { 24 | return new NetStructDialogButton.Builder() 25 | .SetType(Type) 26 | .SetFormatString(ButtonText.ToProtobuf()) 27 | .SetStyle((uint)Style) 28 | .SetEnabled(Enabled).Build(); 29 | } 30 | } 31 | } 32 | -------------------------------------------------------------------------------- /src/MHServerEmu.Games/UI/DialogResponse.cs: -------------------------------------------------------------------------------- 1 |  2 | using Gazillion; 3 | 4 | namespace MHServerEmu.Games.UI 5 | { 6 | public class DialogResponse 7 | { 8 | public GameDialogResultEnum ButtonIndex { get; } 9 | public bool CheckboxClicked { get; } 10 | 11 | public DialogResponse(GameDialogResultEnum buttonIndex, bool checkboxClicked) 12 | { 13 | ButtonIndex = buttonIndex; 14 | CheckboxClicked = checkboxClicked; 15 | } 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /src/MHServerEmu.Games/UI/IUIDataProviderOwner.cs: -------------------------------------------------------------------------------- 1 | namespace MHServerEmu.Games.UI 2 | { 3 | /// 4 | /// Exposes a instance. 5 | /// 6 | public interface IUIDataProviderOwner 7 | { 8 | public UIDataProvider UIDataProvider { get; } 9 | } 10 | } 11 | -------------------------------------------------------------------------------- /src/MHServerEmu.Games/UI/LocaleStringMessageHandler.cs: -------------------------------------------------------------------------------- 1 |  2 | using Gazillion; 3 | using MHServerEmu.Games.GameData; 4 | 5 | namespace MHServerEmu.Games.UI 6 | { 7 | public class LocaleStringMessageHandler 8 | { 9 | public LocaleStringId LocaleString { get; set; } 10 | 11 | public LocaleStringMessageHandler(LocaleStringId localeString = LocaleStringId.Blank) 12 | { 13 | LocaleString = localeString; 14 | } 15 | 16 | public bool HasString => LocaleString != LocaleStringId.Blank; 17 | 18 | public NetStructFormatString ToProtobuf() 19 | { 20 | return new NetStructFormatString.Builder().SetFormatStringId((ulong)LocaleString).Build(); 21 | } 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /src/MHServerEmu.Grouping/GroupingManagerConfig.cs: -------------------------------------------------------------------------------- 1 | using MHServerEmu.Core.Config; 2 | 3 | namespace MHServerEmu.Grouping 4 | { 5 | public class GroupingManagerConfig : ConfigContainer 6 | { 7 | public string ServerName { get; private set; } = "MHServerEmu"; 8 | public int ServerPrestigeLevel { get; private set; } = 6; 9 | public string MotdText { get; private set; } = "Welcome back to Marvel Heroes!"; 10 | public bool LogTells { get; private set; } = false; 11 | } 12 | } 13 | -------------------------------------------------------------------------------- /src/MHServerEmu.Grouping/MHServerEmu.Grouping.csproj: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | net8.0 5 | enable 6 | disable 7 | x64 8 | 9 | 10 | 11 | 0.8.0.0 12 | $(AssemblyVersion) 13 | $(AssemblyVersion) 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | ..\..\dep\protobuf-csharp\Google.ProtocolBuffers.dll 25 | 26 | 27 | 28 | 29 | -------------------------------------------------------------------------------- /src/MHServerEmu.Leaderboards/LeaderboardsConfig.cs: -------------------------------------------------------------------------------- 1 | using MHServerEmu.Core.Config; 2 | 3 | namespace MHServerEmu.Leaderboards 4 | { 5 | public class LeaderboardsConfig : ConfigContainer 6 | { 7 | public string DatabaseFile { get; private set; } = "Leaderboards.db"; 8 | public string ScheduleFile { get; private set; } = "LeaderboardSchedule.json"; 9 | public int AutoSaveIntervalMinutes { get; private set; } = 5; 10 | } 11 | } 12 | -------------------------------------------------------------------------------- /src/MHServerEmu.Leaderboards/MHServerEmu.Leaderboards.csproj: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | net8.0 5 | enable 6 | disable 7 | x64 8 | 9 | 10 | 11 | 0.8.0.0 12 | $(AssemblyVersion) 13 | $(AssemblyVersion) 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | ..\..\dep\protobuf-csharp\Google.ProtocolBuffers.dll 25 | 26 | 27 | 28 | 29 | -------------------------------------------------------------------------------- /src/MHServerEmu.Leaderboards/MetaLeaderboardEntry.cs: -------------------------------------------------------------------------------- 1 | using MHServerEmu.Games.GameData; 2 | using MHServerEmu.Games.GameData.Prototypes; 3 | 4 | namespace MHServerEmu.Leaderboards 5 | { 6 | /// 7 | /// Represents a reference to a SubLeaderboard instance tracked by a MetaLeaderboard. 8 | /// 9 | public class MetaLeaderboardEntry 10 | { 11 | public PrototypeGuid SubLeaderboardId { get; } 12 | public ulong SubInstanceId { get; set; } 13 | public LeaderboardInstance SubInstance { get; set; } 14 | public LeaderboardRewardEntryPrototype[] Rewards { get; } 15 | 16 | public MetaLeaderboardEntry(PrototypeGuid subLeaderboardId, LeaderboardRewardEntryPrototype[] rewards) 17 | { 18 | SubLeaderboardId = subLeaderboardId; 19 | Rewards = rewards; 20 | } 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /src/MHServerEmu.PlayerManagement/Auth/AuthStatusCodes.cs: -------------------------------------------------------------------------------- 1 | namespace MHServerEmu.PlayerManagement.Auth 2 | { 3 | public enum AuthStatusCode 4 | { 5 | Success = 200, 6 | IncorrectUsernameOrPassword401 = 401, 7 | AccountBanned = 402, 8 | IncorrectUsernameOrPassword403 = 403, 9 | CouldNotReachAuthServer = 404, 10 | EmailNotVerified = 405, 11 | UnableToConnect406 = 406, 12 | NeedToAcceptLegal = 407, // The client expects an auth ticket with TOS url with this code 13 | PatchRequired = 409, 14 | AccountArchived = 411, 15 | PasswordExpired = 412, 16 | UnableToConnect413 = 413, 17 | UnableToConnect414 = 414, 18 | UnableToConnect415 = 415, 19 | UnableToConnect416 = 416, 20 | AgeRestricted = 417, 21 | UnableToConnect418 = 418, 22 | InternalError500 = 500, 23 | TemporarilyUnavailable = 503 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /src/MHServerEmu.PlayerManagement/MHServerEmu.PlayerManagement.csproj: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | net8.0 5 | enable 6 | disable 7 | x64 8 | 9 | 10 | 11 | 0.8.0.0 12 | $(AssemblyVersion) 13 | $(AssemblyVersion) 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | ..\..\dep\protobuf-csharp\Google.ProtocolBuffers.dll 26 | 27 | 28 | 29 | 30 | -------------------------------------------------------------------------------- /src/MHServerEmu.PlayerManagement/PlayerManagerConfig.cs: -------------------------------------------------------------------------------- 1 | using MHServerEmu.Core.Config; 2 | 3 | namespace MHServerEmu.PlayerManagement 4 | { 5 | /// 6 | /// Contains configuration for the . 7 | /// 8 | public class PlayerManagerConfig : ConfigContainer 9 | { 10 | public bool EnablePersistence { get; private set; } = true; 11 | public bool UseJsonDBManager { get; private set; } = false; 12 | public bool AllowClientVersionMismatch { get; private set; } = false; 13 | public bool UseWhitelist { get; private set; } = false; 14 | public bool ShowNewsOnLogin { get; private set; } = false; 15 | public string NewsUrl { get; private set; } = "http://localhost/"; 16 | public int ServerCapacity { get; private set; } = 0; 17 | public int MaxLoginQueueClients { get; private set; } = 10000; 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /src/MHServerEmu.WebFrontend/Data/Web/Dashboard/config.js: -------------------------------------------------------------------------------- 1 | const dashboardConfig = { 2 | originSuffix: "", 3 | } 4 | -------------------------------------------------------------------------------- /src/MHServerEmu.WebFrontend/Handlers/NotFoundWebHandler.cs: -------------------------------------------------------------------------------- 1 | using MHServerEmu.Core.Logging; 2 | using MHServerEmu.Core.Network.Web; 3 | 4 | namespace MHServerEmu.WebFrontend.Handlers 5 | { 6 | /// 7 | /// Empty that responds with status code 404 to incoming requests. 8 | /// 9 | public class NotFoundWebHandler : WebHandler 10 | { 11 | private static readonly Logger Logger = LogManager.CreateLogger(); 12 | 13 | protected override Task Get(WebRequestContext context) 14 | { 15 | Logger.Trace($"Get(): {context.LocalPath}"); 16 | context.StatusCode = 404; 17 | return Task.CompletedTask; 18 | } 19 | 20 | protected override Task Post(WebRequestContext context) 21 | { 22 | Logger.Trace($"Post(): {context.LocalPath}"); 23 | context.StatusCode = 404; 24 | return Task.CompletedTask; 25 | } 26 | 27 | protected override Task Delete(WebRequestContext context) 28 | { 29 | Logger.Trace($"Delete(): {context.LocalPath}"); 30 | context.StatusCode = 404; 31 | return Task.CompletedTask; 32 | } 33 | } 34 | } 35 | -------------------------------------------------------------------------------- /src/MHServerEmu.WebFrontend/Handlers/WebApi/MetricsPerformanceWebHandler.cs: -------------------------------------------------------------------------------- 1 | using MHServerEmu.Core.Memory; 2 | using MHServerEmu.Core.Metrics; 3 | using MHServerEmu.Core.Network.Web; 4 | 5 | namespace MHServerEmu.WebFrontend.Handlers.WebApi 6 | { 7 | public class MetricsPerformanceWebHandler : WebHandler 8 | { 9 | protected override async Task Get(WebRequestContext context) 10 | { 11 | using PerformanceReport report = ObjectPoolManager.Instance.Get(); 12 | MetricsManager.Instance.GetPerformanceReportData(report); 13 | await context.SendJsonAsync(report); 14 | } 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /src/MHServerEmu.WebFrontend/Handlers/WebApi/RegionReportWebHandler.cs: -------------------------------------------------------------------------------- 1 | using System.Net; 2 | using MHServerEmu.Core.Network; 3 | using MHServerEmu.Core.Network.Web; 4 | using MHServerEmu.PlayerManagement; 5 | using MHServerEmu.PlayerManagement.Regions; 6 | 7 | namespace MHServerEmu.WebFrontend.Handlers.WebApi 8 | { 9 | public class RegionReportWebHandler : WebHandler 10 | { 11 | protected override async Task Get(WebRequestContext context) 12 | { 13 | if (ServerManager.Instance.GetGameService(GameServiceType.PlayerManager) is not PlayerManagerService playerManager) 14 | { 15 | context.StatusCode = (int)HttpStatusCode.InternalServerError; 16 | return; 17 | } 18 | 19 | using RegionReport regionReport = new(); 20 | playerManager.GetRegionReportData(regionReport); 21 | await context.SendJsonAsync(regionReport); 22 | } 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /src/MHServerEmu.WebFrontend/Handlers/WebApi/ServerStatusWebHandler.cs: -------------------------------------------------------------------------------- 1 | using MHServerEmu.Core.Memory; 2 | using MHServerEmu.Core.Network; 3 | using MHServerEmu.Core.Network.Web; 4 | 5 | namespace MHServerEmu.WebFrontend.Handlers.WebApi 6 | { 7 | public class ServerStatusWebHandler : WebHandler 8 | { 9 | protected override async Task Get(WebRequestContext context) 10 | { 11 | Dictionary statusDict = DictionaryPool.Instance.Get(); 12 | ServerManager.Instance.GetServerStatus(statusDict); 13 | 14 | await context.SendJsonAsync(statusDict); 15 | 16 | DictionaryPool.Instance.Return(statusDict); 17 | } 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /src/MHServerEmu.WebFrontend/WebFrontendConfig.cs: -------------------------------------------------------------------------------- 1 | using MHServerEmu.Core.Config; 2 | 3 | namespace MHServerEmu.WebFrontend 4 | { 5 | public class WebFrontendConfig : ConfigContainer 6 | { 7 | public string Address { get; private set; } = "localhost"; 8 | public string Port { get; private set; } = "8080"; 9 | public bool EnableLoginRateLimit { get; private set; } = false; 10 | public int LoginRateLimitCostMS { get; private set; } = 30000; 11 | public int LoginRateLimitBurst { get; private set; } = 10; 12 | public bool EnableWebApi { get; private set; } = true; 13 | public bool EnableDashboard { get; private set; } = true; 14 | public string DashboardFileDirectory { get; private set; } = "Dashboard"; 15 | public string DashboardUrlPath { get; private set; } = "/"; 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /src/MHServerEmu/Commands/Attributes/CommandAttribute.cs: -------------------------------------------------------------------------------- 1 | namespace MHServerEmu.Commands.Attributes 2 | { 3 | /// 4 | /// Indicates that a method is a command. 5 | /// 6 | [AttributeUsage(AttributeTargets.Method)] 7 | public class CommandAttribute : Attribute 8 | { 9 | public string Name { get; } 10 | 11 | public CommandAttribute(string name) 12 | { 13 | Name = name.ToLower(); 14 | } 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /src/MHServerEmu/Commands/Attributes/CommandDescriptionAttribute.cs: -------------------------------------------------------------------------------- 1 | namespace MHServerEmu.Commands.Attributes 2 | { 3 | /// 4 | /// Specifies the description for a command. 5 | /// 6 | [AttributeUsage(AttributeTargets.Method)] 7 | public class CommandDescriptionAttribute : Attribute 8 | { 9 | public string Description { get; } 10 | 11 | public CommandDescriptionAttribute() : this("No description available.") 12 | { 13 | } 14 | 15 | public CommandDescriptionAttribute(string description) 16 | { 17 | Description = description; 18 | } 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /src/MHServerEmu/Commands/Attributes/CommandGroupAttribute.cs: -------------------------------------------------------------------------------- 1 | namespace MHServerEmu.Commands.Attributes 2 | { 3 | /// 4 | /// Indicates that a class contains commands. 5 | /// 6 | [AttributeUsage(AttributeTargets.Class)] 7 | public class CommandGroupAttribute : Attribute 8 | { 9 | public string Name { get; } 10 | 11 | public CommandGroupAttribute(string name) 12 | { 13 | Name = name.ToLower(); 14 | } 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /src/MHServerEmu/Commands/Attributes/CommandGroupDescriptionAttribute.cs: -------------------------------------------------------------------------------- 1 | namespace MHServerEmu.Commands.Attributes 2 | { 3 | /// 4 | /// Specifies the description for a . 5 | /// 6 | [AttributeUsage(AttributeTargets.Class)] 7 | public class CommandGroupDescriptionAttribute : Attribute 8 | { 9 | public string Description { get; } 10 | 11 | public CommandGroupDescriptionAttribute() : this("No description available.") 12 | { 13 | } 14 | 15 | public CommandGroupDescriptionAttribute(string description) 16 | { 17 | Description = description; 18 | } 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /src/MHServerEmu/Commands/Attributes/CommandGroupFlagsAttribute.cs: -------------------------------------------------------------------------------- 1 | namespace MHServerEmu.Commands.Attributes 2 | { 3 | /// 4 | /// Specifies the for this . 5 | /// 6 | [AttributeUsage(AttributeTargets.Class)] 7 | public class CommandGroupFlagsAttribute : Attribute 8 | { 9 | public CommandGroupFlags Flags { get; } 10 | 11 | public CommandGroupFlagsAttribute() : this(CommandGroupFlags.None) 12 | { 13 | } 14 | 15 | public CommandGroupFlagsAttribute(CommandGroupFlags flags) 16 | { 17 | Flags = flags; 18 | } 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /src/MHServerEmu/Commands/Attributes/CommandGroupUserLevelAttribute.cs: -------------------------------------------------------------------------------- 1 | using MHServerEmu.DatabaseAccess.Models; 2 | 3 | namespace MHServerEmu.Commands.Attributes 4 | { 5 | /// 6 | /// Specifies the minimum required to invoke commands contained in this . 7 | /// 8 | [AttributeUsage(AttributeTargets.Class)] 9 | public class CommandGroupUserLevelAttribute : Attribute 10 | { 11 | public AccountUserLevel UserLevel { get; } 12 | 13 | public CommandGroupUserLevelAttribute() : this(AccountUserLevel.User) 14 | { 15 | } 16 | 17 | public CommandGroupUserLevelAttribute(AccountUserLevel userLevel) 18 | { 19 | UserLevel = userLevel; 20 | } 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /src/MHServerEmu/Commands/Attributes/CommandInvokerTypeAttribute.cs: -------------------------------------------------------------------------------- 1 | namespace MHServerEmu.Commands.Attributes 2 | { 3 | public enum CommandInvokerType 4 | { 5 | Any, 6 | Client, 7 | ServerConsole, 8 | } 9 | 10 | /// 11 | /// Specifies the required to invoke a command. 12 | /// 13 | [AttributeUsage(AttributeTargets.Method)] 14 | public class CommandInvokerTypeAttribute : Attribute 15 | { 16 | public CommandInvokerType InvokerType { get; } 17 | 18 | public CommandInvokerTypeAttribute() : this(CommandInvokerType.Any) 19 | { 20 | } 21 | 22 | public CommandInvokerTypeAttribute(CommandInvokerType invokerType) 23 | { 24 | InvokerType = invokerType; 25 | } 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /src/MHServerEmu/Commands/Attributes/CommandParamCountAttribute.cs: -------------------------------------------------------------------------------- 1 | namespace MHServerEmu.Commands.Attributes 2 | { 3 | /// 4 | /// Specifies the minimum number of parameters required to invoke a command. 5 | /// 6 | [AttributeUsage(AttributeTargets.Method)] 7 | public class CommandParamCountAttribute : Attribute 8 | { 9 | public int ParamCount { get; } 10 | 11 | public CommandParamCountAttribute() : this(0) 12 | { 13 | } 14 | 15 | public CommandParamCountAttribute(int paramCount) 16 | { 17 | ParamCount = paramCount; 18 | } 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /src/MHServerEmu/Commands/Attributes/CommandUsageAttribute.cs: -------------------------------------------------------------------------------- 1 | namespace MHServerEmu.Commands.Attributes 2 | { 3 | /// 4 | /// Specifies the usage for a command. 5 | /// 6 | [AttributeUsage(AttributeTargets.Method)] 7 | public class CommandUsageAttribute : Attribute 8 | { 9 | public string Usage { get; } 10 | 11 | public CommandUsageAttribute() : this(string.Empty) 12 | { 13 | } 14 | 15 | public CommandUsageAttribute(string usage) 16 | { 17 | Usage = usage; 18 | } 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /src/MHServerEmu/Commands/Attributes/CommandUserLevelAttribute.cs: -------------------------------------------------------------------------------- 1 | using MHServerEmu.DatabaseAccess.Models; 2 | 3 | namespace MHServerEmu.Commands.Attributes 4 | { 5 | /// 6 | /// Specifies the minimum required to invoke a command. 7 | /// 8 | [AttributeUsage(AttributeTargets.Method)] 9 | public class CommandUserLevelAttribute : Attribute 10 | { 11 | public AccountUserLevel UserLevel { get; } 12 | 13 | public CommandUserLevelAttribute() : this(AccountUserLevel.User) 14 | { 15 | } 16 | 17 | public CommandUserLevelAttribute(AccountUserLevel userLevel) 18 | { 19 | UserLevel = userLevel; 20 | } 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /src/MHServerEmu/Commands/Attributes/DefaultCommandAttribute.cs: -------------------------------------------------------------------------------- 1 | namespace MHServerEmu.Commands.Attributes 2 | { 3 | /// 4 | /// Indicates that a method is the default command for the it belongs to. 5 | /// 6 | [AttributeUsage(AttributeTargets.Method)] 7 | public class DefaultCommandAttribute : CommandAttribute 8 | { 9 | public DefaultCommandAttribute() : base(string.Empty) { } 10 | } 11 | } 12 | -------------------------------------------------------------------------------- /src/MHServerEmu/Commands/CommandParser.cs: -------------------------------------------------------------------------------- 1 | using MHServerEmu.Core.Network; 2 | using MHServerEmu.Games.Common; 3 | 4 | namespace MHServerEmu.Commands 5 | { 6 | /// 7 | /// An implementation of that uses . 8 | /// 9 | public class CommandParser : ICommandParser 10 | { 11 | public bool TryParse(string message, NetClient client) 12 | { 13 | return CommandManager.Instance.TryParse(message, client); 14 | } 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /src/MHServerEmu/Commands/FrontendClientChatOutput.cs: -------------------------------------------------------------------------------- 1 | using MHServerEmu.Core.Network; 2 | using MHServerEmu.Grouping; 3 | 4 | namespace MHServerEmu.Commands 5 | { 6 | /// 7 | /// Provides output to a chat window of a . 8 | /// 9 | public class FrontendClientChatOutput : IClientOutput 10 | { 11 | // TODO: Potentially move this to MHServerEmu.Grouping. 12 | 13 | public void Output(string output, NetClient client) 14 | { 15 | ChatHelper.SendMetagameMessage(client.FrontendClient, output); 16 | } 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /src/MHServerEmu/Commands/IClientOutput.cs: -------------------------------------------------------------------------------- 1 | using MHServerEmu.Core.Network; 2 | 3 | namespace MHServerEmu.Commands 4 | { 5 | /// 6 | /// Exposes output for an . 7 | /// 8 | public interface IClientOutput 9 | { 10 | /// 11 | /// Outputs the provided to the specified . 12 | /// 13 | public void Output(string output, NetClient client); 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /src/MHServerEmu/Program.cs: -------------------------------------------------------------------------------- 1 | namespace MHServerEmu 2 | { 3 | class Program 4 | { 5 | static void Main(string[] args) 6 | { 7 | // We set the console title here because if we were to make a GUI it would have to set its title separately. 8 | Console.Title = $"MHServerEmu ({ServerApp.VersionInfo})"; 9 | ServerApp.Instance.Run(); 10 | } 11 | } 12 | } 13 | -------------------------------------------------------------------------------- /src/MHServerEmu/icon.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Crypto137/MHServerEmu/a9851b8e31549e75b8d6dfa12f3d44e678058c77/src/MHServerEmu/icon.ico -------------------------------------------------------------------------------- /src/Tools/MHExecutableAnalyzer/MHExecutableAnalyzer.csproj: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | Exe 5 | net6.0 6 | enable 7 | disable 8 | 9 | 10 | 11 | -------------------------------------------------------------------------------- /src/Tools/MHPakTool/Extensions.cs: -------------------------------------------------------------------------------- 1 | using System.Text; 2 | 3 | namespace MHPakTool 4 | { 5 | public static class Extensions 6 | { 7 | /// 8 | /// Reads a fixed-length string preceded by its length as a 32-bit signed integer. 9 | /// 10 | public static string ReadFixedString32(this BinaryReader reader) 11 | { 12 | return Encoding.UTF8.GetString(reader.ReadBytes(reader.ReadInt32())); 13 | } 14 | 15 | /// 16 | /// Writes a fixed-length string preceded by its length as a 32-bit signed integer. 17 | /// 18 | public static void WriteFixedString32(this BinaryWriter writer, string @string) 19 | { 20 | writer.Write(@string.Length); 21 | writer.Write(Encoding.UTF8.GetBytes(@string)); 22 | } 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /src/Tools/MHPakTool/MHPakTool.csproj: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | Exe 5 | net6.0 6 | enable 7 | disable 8 | 9 | 10 | 11 | 12 | ..\..\..\dep\Free.Ports.zLib\Free.Ports.zLib.dll 13 | 14 | 15 | ..\..\..\dep\K4os.Compression.LZ4\K4os.Compression.LZ4.dll 16 | 17 | 18 | 19 | 20 | -------------------------------------------------------------------------------- /src/Tools/Setup/Program.cs: -------------------------------------------------------------------------------- 1 | namespace Setup 2 | { 3 | internal static class Program 4 | { 5 | /// 6 | /// The main entry point for the application. 7 | /// 8 | [STAThread] 9 | static void Main() 10 | { 11 | // To customize application configuration such as set high DPI settings or default font, 12 | // see https://aka.ms/applicationconfiguration. 13 | ApplicationConfiguration.Initialize(); 14 | Application.Run(new MainForm()); 15 | } 16 | } 17 | } -------------------------------------------------------------------------------- /src/Tools/Setup/Setup.csproj: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | WinExe 5 | net8.0-windows 6 | disable 7 | true 8 | true 9 | false 10 | win-x64 11 | enable 12 | icon.ico 13 | 1.2.0.0 14 | 15 | 16 | 17 | 18 | 19 | 20 | -------------------------------------------------------------------------------- /src/Tools/Setup/icon.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Crypto137/MHServerEmu/a9851b8e31549e75b8d6dfa12f3d44e678058c77/src/Tools/Setup/icon.ico --------------------------------------------------------------------------------