Claude/implement missing features wr8 zc - #96
Merged
Conversation
…ntime verification Packet Handlers: - Add 30+ missing opcode handlers from mangoszero/TrinityCore reference - Battleground: CMSG_BATTLEMASTER_JOIN, CMSG_BATTLEFIELD_PORT, CMSG_LEAVE_BATTLEFIELD, CMSG_AREA_SPIRIT_HEALER_QUERY/QUEUE - Pets: MSG_LIST_STABLED_PETS, CMSG_STABLE_PET, CMSG_UNSTABLE_PET, CMSG_BUY_STABLE_SLOT, CMSG_STABLE_REVIVE_PET, CMSG_STABLE_SWAP_PET - Misc: CMSG_FAR_SIGHT, CMSG_SELF_RES, CMSG_UNLEARN_SKILL, MSG_RANDOM_ROLL, CMSG_CANCEL_GROWTH_AURA, CMSG_REQUEST_RAID_INFO, CMSG_RESET_INSTANCES, MSG_RAID_ICON_TARGET, MSG_RAID_READY_CHECK, CMSG_PLAYED_TIME, CMSG_INSPECT, CMSG_SUMMON_RESPONSE, CMSG_LOOT_MASTER_GIVE, CMSG_OPENING_CINEMATIC, CMSG_COMPLETE_CINEMATIC, CMSG_NEXT_CINEMATIC_CAMERA, CMSG_CHAT_IGNORED, CMSG_SET_EXPLORATION, MSG_LOOKING_FOR_GROUP, CMSG_SET_LOOKING_FOR_GROUP - Instance: On_CMSG_RESET_INSTANCES with SendResetInstanceSuccess/Failed Spell Effects: - Implement SPELL_EFFECT_SUMMON (creature summoning with pet ownership) - Fix SPELL_EFFECT_SUMMON_WILD (timed creature spawns) - Implement SPELL_EFFECT_SUMMON_PET (recall/summon player pets) - Implement SPELL_EFFECT_SUMMON_DEMON (warlock demon summoning) - Implement SPELL_EFFECT_SUMMON_CRITTER (non-combat pets with toggle) - Fix SPELL_EFFECT_KNOCK_BACK (removed false failure return) - Enhance SPELL_EFFECT_DISPEL (immunity feedback via SMSG_DISPEL_FAILED) Database Models: - CreatureInfo: Add DamageMultiplier, HealthMultiplier, ManaMultiplier, ArmorMultiplier, ExperienceMultiplier, SchoolImmuneMask, ExtraFlags, MovementType, InhabitType, BoundingRadius, CombatReach, GossipMenuId, ScriptName, IconName fields matching mangoszero schema - WS_PlayerData: Add SelfResurrectSpell, TimePlayed, TimePlayedLevel, StableSlots, SummonPosition, NonCombatPet fields - WS_Group: Add BroadcastToAll, BroadcastToOther, raid target icons, LootMaster field - WS_Loot: Add MasterLootGive method - Gossips enum: Add explicit values Runtime Verification System: - GameLogicVerifier: 9 verification checks running periodically (character integrity, creature state, item integrity, spell state, world objects, network state, quest state, combat state, map consistency) - VerificationResult: Status tracking with details and timestamps - Registered in DI container and auto-started with WorldServer https://claude.ai/code/session_01G5fsn9qsvTTU96VDB5BpXo
- Add ClusterVerifier to Mangos.Cluster with checks for client connections, character state, packet handlers, database connections, and world server connections - Add RealmVerifier to RealmServer with checks for handler dispatchers, auth opcode coverage, and runtime health monitoring - Integrate both verifiers into DI containers and server startup - Fix build workflow: update .NET SDK from 7.0 to 9.0, upgrade actions to v4, reorder checkout before SDK install - Fix editorconfig typo: 'truee' -> 'true' - Fix WS_Handlers.cs: route CMSG_RESET_INSTANCES to WSHandlersInstance https://claude.ai/code/session_01G5fsn9qsvTTU96VDB5BpXo
…st project - Implement 8 petition packet handlers (showlist, buy, sign, query, offer, decline, rename, show signatures) - Fix GameTcpConnection NotImplementedException with proper async read/write retry loops - Implement channel Save/Load persistence with DB-backed storage - Add guild rank deletion validation and tabard cost money check - Add battleground minimum player count check - Fix auth client hash validation using SHA1 digest comparison - Register petition handlers in opcode dispatch table - Create Mangos.Tests xunit project with verification and opcode tests https://claude.ai/code/session_01G5fsn9qsvTTU96VDB5BpXo
…nd more Implements 8 game engine patterns across 4 phases, ported from Unreal Engine, Unity, and TrinityCore to address architectural gaps in MangosSharp: Phase 1 - Foundation Infrastructure: - Event Bus (IGameEventBus/GameEventBus): Thread-safe pub/sub system inspired by UE4 event dispatchers and TrinityCore hooks. Enables decoupled communication between game systems (AI, combat, spells, guilds). - Cooldown Manager: Centralized cooldown tracking inspired by UE4 GAS. Replaces the manual "NextX -= AI_UPDATE" pattern found in every boss script. - Object Pool: Generic thread-safe ObjectPool<T> inspired by Unity's pooling. Reduces allocation pressure for frequently created objects like packets. Phase 2 - AI Overhaul: - ICreatureAI interface: Enhanced AI hook system with ~15 methods (vs legacy 7), inspired by TrinityCore's CreatureAI. Includes DamageTaken, SpellHit, MovementInform, SummonedCreatureDies with structured context data. - CreatureAIBase + LegacyAIAdapter for backward compatibility. - Action Sequence System: Unity coroutine-inspired sequencer for multi-step boss phases. Fluent builder API for expressing "move, wait, cast, spawn". - Movement Generators: TrinityCore-style pluggable movement (Idle, Random, Chase, Flee, ReturnHome, Point, Waypoint) managed by MovementManager stack. Phase 3 - Tags + Lifecycle: - Gameplay Tags: UE4 GAS-inspired hierarchical tagging system for categorizing creatures, spells, effects, and immunities with composable queries. - Actor Lifecycle (IWorldEntity): UE4-style BeginPlay/Tick/EndPlay hooks with EntityLifecycleManager that guarantees cleanup, fixing Dispose leak patterns. Phase 4 - Behavior Trees: - Lightweight BT framework inspired by UE4's behavior tree system. Includes Selector/Sequence composites, Inverter/Repeat/Cooldown/Conditional decorators, and leaf nodes for combat checks and spell casting. StandardTrees provides pre-built trees for melee, caster, critter, and guard archetypes. All systems coexist with legacy code via adapters and feature flags. https://claude.ai/code/session_01G5fsn9qsvTTU96VDB5BpXo
…, domain model Logging (Mangos.Logging): - Add LogLevel enum (Trace/Debug/Information/Warning/Error/Critical) - Add MinimumLevel filtering to IMangosLogger - Add Debug() and Critical() log methods - Add generic Log(level, message) methods - Add optional file output with auto-flush - Use proper lock object instead of lock(this) - Add structured timestamp format (yyyy-MM-dd HH:mm:ss.fff) - Reset console color after each write Configuration (Mangos.Configuration): - Add environment variable overrides (MANGOS_* prefix) - Support MANGOS_CONFIG_PATH for alternate config file location - Add validation for required fields, port ranges, rates - Use JsonNode for env var merging before deserialization - Use proper exception types (FileNotFoundException, InvalidOperationException) Database (Mangos.MySql): - Add IDisposable to AccountConnection for proper cleanup - Add SemaphoreSlim for thread-safe concurrent query access - Add EnsureConnectionOpenAsync() for auto-reconnect on broken connections - Add error logging on query/execute failures - Add Mangos.Logging project dependency Threading (WorldServer, LegacyWorldCluster): - Replace non-thread-safe Random with Random.Shared (.NET 6+) - Replace ArrayList WORLD_CREATUREsKeys with List<ulong> - Add ReaderWriterLockSlim for WORLD_GAMEOBJECTs, WORLD_CORPSEOBJECTs, WORLD_ITEMs - Remove unused System.Collections import Error Handling (Mangos.Tcp): - Add SO_REUSEADDR socket option - Track active connection count with Interlocked - Handle ConnectionReset, IOException, OperationCanceledException separately - Include client endpoint in all log messages - Dispose socket on failed endpoint resolution Serialization (GameServer/Network): - Add UInt8/UInt16/UInt64, Int16/Int32/Int64, Float, CString, Bytes, Skip to PacketReader - Add UInt8/UInt16/UInt64, Int16/Int32/Int64, Float, CString, Bytes to PacketWriter - Add Remaining property to PacketReader, Length to PacketWriter Domain Model (Mangos.Domain): - Add GameState enum with state machine transitions - Add Uptime tracking, StartedAt timestamp - Add TransitionTo() with valid state transition enforcement Script System (Mangos.World.Scripts): - Implement ScriptHarness with reflection-based script discovery - Auto-discover all BossAI subclasses in assembly - Provide GetScript(name) lookup and ScriptCount DataStore (Mangos.DataStores): - Fix ReadString to use Encoding.UTF8 instead of BitConverter.ToString - Fix string block offset calculation (was reading from wrong position) - Add file existence and minimum size validation - Add bounds checking with proper ArgumentOutOfRangeException - Add IsLoaded property - Initialize data field to avoid null reference https://claude.ai/code/session_01G5fsn9qsvTTU96VDB5BpXo
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This change is