diff --git a/Game/World/WorldHandler.cs b/Game/World/WorldHandler.cs index 3cd249a..479e857 100644 --- a/Game/World/WorldHandler.cs +++ b/Game/World/WorldHandler.cs @@ -105,6 +105,7 @@ public sealed partial class WorldHandler : IClientMessageHandler var db = scope.ServiceProvider.GetRequiredService(); var mobs = await db.Set() + .AsNoTracking() .Where(m => m.IsEnabled) .Include(m => m.AbilityAssignments) .ThenInclude(a => a.AbilityDefinition) @@ -112,9 +113,20 @@ public sealed partial class WorldHandler : IClientMessageHandler _mobDefinitions = mobs.ToDictionary(m => m.Id); var npcs = await db.Set() + .AsNoTracking() .Where(n => n.IsEnabled) .ToListAsync(); _npcDefinitions = npcs.ToDictionary(n => n.Id); + + // Log mob stats for debugging + foreach (var mob in mobs.Take(5)) + { + var stats = mob.GetStatsForBracket(1); + _log.LogInformation( + "MobDef {Id} '{Name}': MoveSpeed={MoveSpeed}, AggroRange={AggroRange}, LeashRange={LeashRange}, Behavior={Behavior}, Abilities={AbilityCount}", + mob.Id, mob.Name, stats.MoveSpeed, stats.AggroRange, stats.LeashRange, mob.Behavior, + mob.AbilityAssignments?.Count(a => a.IsEnabled) ?? 0); + } } public async Task HandleAsync(int opCode, IConnection connection, ReadOnlyMemory payload, CancellationToken ct) @@ -593,8 +605,17 @@ public sealed partial class WorldHandler : IClientMessageHandler if (_activeZones.TryAdd(zoneKey, zoneSim)) { _log.LogInformation( - "Activated zone simulation {ZoneKey}: {MobCount} mobs, {NpcCount} NPCs", - zoneKey, zoneSim.Mobs.Count, zoneSim.Npcs.Count); + "Activated zone simulation {ZoneKey}: {MobCount} mobs, {NpcCount} NPCs, {SpawnPoints} spawn points", + zoneKey, zoneSim.Mobs.Count, zoneSim.Npcs.Count, + zoneSim.MobSpawnTracker?.SpawnPointCount ?? 0); + + // Log mob details for debugging + foreach (var mob in zoneSim.Mobs.Values.Take(3)) + { + _log.LogInformation( + " Mob {Id} '{Name}' at ({X:F0},{Y:F0}): MoveSpeed={MoveSpeed}, Behavior={Behavior}, State={State}, Abilities={AbilityCount}", + mob.Id, mob.Name, mob.X, mob.Y, mob.Stats.MoveSpeed, mob.Behavior, mob.State, mob.Abilities.Count); + } return zoneSim; } @@ -680,6 +701,19 @@ public sealed partial class WorldHandler : IClientMessageHandler try { zoneSim.Tick(tick, TickDeltaSeconds); + + // Periodic debug log every ~10 seconds (100 ticks) + if (tick % 100 == 0 && zoneSim.Mobs.Count > 0) + { + var sample = zoneSim.Mobs.Values.FirstOrDefault(); + if (sample != null) + { + _log.LogDebug( + "Zone {ZoneKey} tick {Tick}: {MobCount} mobs, {PlayerCount} players. Sample mob {Id} '{Name}' state={State} pos=({X:F0},{Y:F0}) speed={Speed}", + zoneKey, tick, zoneSim.Mobs.Count, zoneSim.Players.Count, + sample.Id, sample.Name, sample.State, sample.X, sample.Y, sample.Stats.MoveSpeed); + } + } } catch (Exception ex) { @@ -751,10 +785,18 @@ public sealed partial class WorldHandler : IClientMessageHandler { try { + _log.LogInformation( + "Persisting location for character {CharacterId}: Region={RegionId} Zone=({ZoneX},{ZoneY},{ZoneZ}) Chunk=({ChunkX},{ChunkY}) Pos=({X:F1},{Y:F1})", + s.CharacterId, s.RegionId, s.ZoneX, s.ZoneY, s.ZoneZ, s.ChunkX, s.ChunkY, s.X, s.Y); + using var scope = _scopeFactory.CreateScope(); var db = scope.ServiceProvider.GetRequiredService(); var character = await db.DungeonCharacters.FirstOrDefaultAsync(c => c.Id == s.CharacterId); - if (character == null) return; + if (character == null) + { + _log.LogWarning("Character {CharacterId} not found for position persist", s.CharacterId); + return; + } character.WorldRegionId = s.RegionId; character.WorldZoneX = s.ZoneX; @@ -766,10 +808,12 @@ public sealed partial class WorldHandler : IClientMessageHandler character.WorldY = s.Y; character.LastPlayedAt = DateTime.UtcNow; await db.SaveChangesAsync(); + + _log.LogInformation("Successfully persisted location for character {CharacterId}", s.CharacterId); } catch (Exception ex) { - _log.LogWarning(ex, "Failed to persist world location for character {CharacterId}", s.CharacterId); + _log.LogError(ex, "Failed to persist world location for character {CharacterId}", s.CharacterId); } } } diff --git a/Game/World/client_fixes.md b/Game/World/client_fixes.md index 122150b..98f67f3 100644 --- a/Game/World/client_fixes.md +++ b/Game/World/client_fixes.md @@ -1,266 +1,582 @@ -# Client Changes Required After WorldHandler Refactor +# Client Fixes for World Systems Update -## Existing Protocol: UNCHANGED -All existing OpCodes (700-711) and payload shapes are identical. No changes needed for spawn, input, or state. +This document covers all client-side changes needed for the world overhaul: +Z-levels, world mobs/NPCs, combat, object interaction, and portal updates. -## NEW: OpCode 712 - WORLD_CHUNK_DELTA (Server -> Client) +--- -The server now pushes live chunk deltas to clients whenever the world is edited (admin panel, etc). -Any player who has the affected chunk in their visible set receives the delta immediately, -without waiting for a full chunk reload. +## 1. Breaking Changes -### When it fires -- Admin places/removes a tile via the world editor -- Admin places/removes an object, NPC, or mob spawn -- Admin clears or deletes a chunk +### 1.1 Chunk Key Format (6-part, was 5-part) + +All chunk keys now include `zoneZ`: + +``` +OLD: "{regionId}:{zoneX}:{zoneY}:{chunkX}:{chunkY}" +NEW: "{regionId}:{zoneX}:{zoneY}:{zoneZ}:{chunkX}:{chunkY}" +``` + +Update any client-side chunk key parsing/caching to expect the 6-segment format. + +### 1.2 WORLD_STATE (711) - New Fields + +The per-tick `WORLD_STATE` payload now includes `mobs` and `npcs` arrays. +These are **null** when no zone simulation is active, so guard against null. -### Payload shape ```json { - "kind": "chunk_delta", - "regionId": 1, - "zoneX": 0, - "zoneY": 0, - "chunkX": 3, - "chunkY": 2, - "fromVersion": 5, - "toVersion": 6, - "op": { ... } + "tick": 1234, + "ackSeq": 42, + "self": { + "x": 1024.5, "y": 512.3, + "velocityX": 120.0, "velocityY": 0.0, + "regionId": 1, + "zoneX": 0, "zoneY": 0, + "chunkX": 5, "chunkY": 3 + }, + "players": [ ... ], + "mobs": [ // NEW - nullable + { + "id": 1, + "definitionId": 101, + "name": "Goblin", + "x": 800.0, "y": 400.0, + "health": 45, "maxHealth": 100, + "isAlive": true, + "state": "Idle", // "Idle","Chasing","Attacking","Dead" + "animation": "idle_down", + "facing": "down", + "spriteConfig": "{...}", + "tintColor": "#ffffff", + "scale": 1.0 + } + ], + "npcs": [ // NEW - nullable + { + "id": 1, + "definitionId": 5, + "name": "Village Elder", + "x": 1200.0, "y": 600.0, + "health": 100, "maxHealth": 100, + "isAlive": true, + "canShop": true, + "hasDialog": true, + "animation": "idle", + "spriteConfig": "{...}", + "tintColor": "#ffffff", + "scale": 1.0 + } + ], + "chunkUpdates": [ ... ], + "portalEvent": { ... }, + "errors": [ ... ] } ``` -### `op` types the client must handle +Mob/NPC arrays contain all entities within **1536px** (48 tiles) of the player, same Z-level only. Render mobs and NPCs from these arrays every tick. Dead mobs (`isAlive: false`) should show death animation and remain for looting. + +### 1.3 Chunk Payload - `zoneZ` Added + +Every chunk payload now includes `zoneZ` in its `chunk` object: -#### `tile_upsert` - A tile was added or changed ```json { - "type": "tile_upsert", - "x": 12, - "y": 8, - "sheetId": 3, - "frameIndex": 42, - "isWalkable": true, - "isInvisiblePaywall": false + "type": "chunk_full", + "chunk": { + "regionId": 1, + "zoneX": 0, "zoneY": 0, + "zoneZ": 0, // NEW + "chunkX": 5, "chunkY": 3, + "version": 12345, + "width": 20, "height": 20 + }, + "tiles": [ ... ], + "objects": [ ... ], + "npcs": [ ... ], + "mobs": [ ... ] } ``` -**Client action**: Find the chunk in `chunk_cache` by regionId/zoneX/zoneY/chunkX/chunkY. -Update or insert the tile in the chunk's `tiles` array. Then call `_rebuild_world_visuals()`. -Also update local walkability data if you cache it. -#### `tile_remove` - A tile was removed +### 1.4 Visible Players Filtered by Z-Level + +Players on different Z-levels are no longer visible to each other. The server +already handles this -- the client just needs to be aware that entering a +building (Z-level change) will make other ground-level players disappear. + +--- + +## 2. New OpCodes + +| OpCode | Constant | Direction | Purpose | +|--------|-------------------------------|-----------|----------------------------------| +| 720 | WORLD_COMBAT_STATE | S -> C | Combat events broadcast | +| 721 | WORLD_ATTACK | C -> S | Player attacks mob or player | +| 722 | WORLD_MOB_LOOT_REQUEST | C -> S | Loot a dead mob | +| 723 | WORLD_MOB_LOOT_RESULT | S -> C | Loot contents | +| 740 | WORLD_NPC_INTERACT | C -> S | Start NPC interaction | +| 741 | WORLD_NPC_INTERACT_STATE | S -> C | NPC metadata + dialog/shop state | +| 742 | WORLD_NPC_DIALOG_SELECT | C -> S | Choose a dialog option | +| 743 | WORLD_NPC_DIALOG_RESULT | S -> C | Dialog option outcome | +| 744 | WORLD_NPC_SHOP_ACTION | C -> S | Buy from NPC shop | +| 745 | WORLD_NPC_SHOP_RESULT | S -> C | Shop transaction result | +| 750 | WORLD_OBJECT_INTERACT | C -> S | Interact with world object | +| 751 | WORLD_OBJECT_INTERACT_RESULT | S -> C | Object interaction result | +| 752 | WORLD_OBJECT_STATE | S -> C | Object state broadcast (broken) | + +--- + +## 3. Combat System + +### 3.1 Sending an Attack (721 WORLD_ATTACK) C -> S + ```json { - "type": "tile_remove", - "x": 12, - "y": 8 + "targetType": "mob", // "mob" or "player" + "targetMobId": 1, // required when targetType = "mob" + "targetPlayerId": 67890 // required when targetType = "player" } ``` -**Client action**: Remove the tile at (x, y) from the chunk's `tiles` array. -Call `_rebuild_world_visuals()`. Mark that tile as walkable in local collision data. -#### `object_upsert` - An object was added or changed +- Server validates: alive, not stunned, within 80px melee range. +- PvP attacks are rejected unless the zone has `IsPvpEnabled = true`. + +### 3.2 Combat Events (720 WORLD_COMBAT_STATE) S -> C + +Sent to **all players in the zone** when combat occurs. Contains an `events` +array. Each event has a `type` string field. + ```json { - "type": "object_upsert", - "id": 456, + "events": [ + { + "type": "PlayerAttack", + "sourcePlayerId": 12345, + "targetMobId": 1, + "damage": 45, + "damageTypeKey": "physical", + "x": 800.0, "y": 400.0, + "wasResisted": false, + "wasWeakness": true + } + ] +} +``` + +**Event types from player-initiated combat (WorldHandler.Combat.cs):** + +| type | Fields | When | +|-----------------|---------------------------------------------------------------------------|---------------------------| +| `PlayerAttack` | sourcePlayerId, targetMobId, damage, damageTypeKey, x, y, wasResisted, wasWeakness | Player hits mob | +| `MobDeath` | targetMobId, sourcePlayerId, x, y, xpReward, lootAvailable | Mob killed | +| `PvpDamage` | sourcePlayerId, targetPlayerId, damage, damageTypeKey, x, y | Player hits player (PvP) | +| `PlayerDeath` | targetPlayerId, sourcePlayerId, x, y, isPvpKill | Player killed (PvP) | +| `AttackFailed` | error | Attack rejected | + +`AttackFailed` error values: `"stunned"`, `"dead"`, `"target_not_found"`, `"out_of_range"`, `"pvp_disabled_in_zone"`, `"target_invulnerable"` + +**Event types from zone simulation ticks (WorldZoneSimulation.cs via BroadcastCombatEventsAsync):** + +| type | Fields | When | +|--------------------|--------------------------------------------------------------------------|---------------------------| +| `Damage` | sourceMobId, targetPlayerId, damage, damageTypeKey, x, y | Mob hits player | +| `MobDeath` | targetMobId, sourcePlayerId, x, y | Mob dies from AI tick | +| `PlayerDeath` | targetPlayerId, x, y | Player killed by mob | +| `MobSpawn` | targetMobId, x, y, mobData (full mob serialize object) | Mob respawned | +| `ProjectileSpawn` | sourceMobId, x, y | Mob fires projectile | +| `AbilityUsed` | sourceMobId, targetPlayerId, damage, damageTypeKey, x, y | Mob uses ability | + +Note: Zone-tick events use the generic serialization format: +```json +{ + "type": "Damage", + "sourceMobId": 2, + "sourcePlayerId": 0, + "targetMobId": 0, + "targetPlayerId": 12345, + "damage": 25, + "damageTypeKey": "fire", + "x": 1024.0, "y": 512.0, + "mobData": null +} +``` + +The client should handle **both** formats -- direct combat events from `WorldHandler.Combat.cs` (only the relevant fields) and zone-broadcast events (all fields present, irrelevant ones zeroed/null). + +### 3.3 Mob Looting (722/723) C -> S / S -> C + +**Request (722 WORLD_MOB_LOOT_REQUEST):** +```json +{ "mobId": 1 } +``` + +Server validates: mob is dead, within 128px, exists. + +**Response (723 WORLD_MOB_LOOT_RESULT):** +```json +{ + "success": true, + "mobId": 1, + "gold": 75, + "items": [] +} +``` + +Error cases: `"mob_not_found"`, `"mob_still_alive"`, `"too_far"` + +Items array is currently empty (loot tables not yet integrated). Gold is `XpReward / 2`. + +--- + +## 4. NPC Interaction System + +### 4.1 Starting NPC Interaction (740/741) + +**Request (740 WORLD_NPC_INTERACT):** +```json +{ "npcId": 1 } +``` + +Server validates: NPC exists in zone sim, within 128px. + +**Response (741 WORLD_NPC_INTERACT_STATE):** + +The server sends NPC metadata, and then auto-sends dialog and/or shop state +if the NPC supports them. All arrive on opcode 741. + +```json +{ + "success": true, + "npc": { + "id": 1, + "definitionId": 5, + "name": "Village Elder", + "canShop": true, + "hasDialog": true, + "isKillable": false, + "behavior": "passive", + "onAttackBehavior": "flee", + "shopId": 10, + "dialogTreeId": 25 + } +} +``` + +If `hasDialog && dialogTreeId != null`, a follow-up 741 arrives with dialog: +```json +{ + "success": true, + "npcId": 1, + "dialogNode": { + "id": 100, + "text": "Hello traveler! What brings you here?", + "isTerminal": false, + "rewardGold": 0, + "rewardXp": 0, + "rewardItemDefinitionId": null, + "rewardItemQuantity": 0 + }, + "options": [ + { "id": 200, "text": "Tell me about yourself", "nextNodeId": 101 }, + { "id": 201, "text": "I'm looking for work", "nextNodeId": 102 } + ] +} +``` + +If `canShop && shopId != null`, a follow-up 741 arrives with shop: +```json +{ + "success": true, + "shop": { + "id": 10, + "name": "General Store", + "items": [ + { + "slotIndex": 0, + "itemDefinitionId": 42, + "itemName": "Healing Potion", + "quantity": 10, + "priceGold": 50, + "restocks": true, + "restockIntervalSeconds": 3600 + } + ] + } +} +``` + +Error cases on 741: `"npc_not_found"`, `"too_far"` + +### 4.2 Selecting a Dialog Option (742/743) + +**Request (742 WORLD_NPC_DIALOG_SELECT):** +```json +{ "npcId": 1, "optionId": 200 } +``` + +**Response (743 WORLD_NPC_DIALOG_RESULT):** +```json +{ + "success": true, + "npcId": 1, + "nextNodeId": 101, + "isTerminal": false +} +``` + +On success, the server also sends the next dialog node on opcode **741** +(same as initial dialog state), so the client should update the dialog UI +when it gets a new 741 with `dialogNode`. + +If the selected option has **rewards** (gold, XP, items), they are applied +server-side automatically when the next node loads. The client should display +the `rewardGold`/`rewardXp`/`rewardItemDefinitionId` fields from the +`dialogNode` in the follow-up 741 to show the player what they received. + +If the option required consuming items (e.g. quest turn-in), those are +deducted server-side as well. On `"condition_failed"` error, the option's +prerequisite is not met. + +Error cases on 743: `"npc_dialog_unavailable"`, `"invalid_option"`, `"condition_failed"`, `"requires_item"`, `"level_too_low"`, `"level_too_high"`, `"not_enough_gold"` + +### 4.3 Buying from a Shop (744/745) + +**Request (744 WORLD_NPC_SHOP_ACTION):** +```json +{ + "npcId": 1, + "action": "buy", + "slotIndex": 0, + "quantity": 1 +} +``` + +Only `"buy"` is currently supported. + +**Response (745 WORLD_NPC_SHOP_RESULT):** +```json +{ + "success": true, + "npcId": 1, + "action": "buy", + "itemDefinitionId": 42, + "quantity": 1, + "totalPrice": 50, + "remainingGold": 450, + "remainingStock": 9 +} +``` + +On success, the server also re-sends the full shop state on opcode **741** +(`shop` object) with updated quantities. + +Error cases on 745: `"npc_shop_unavailable"`, `"unsupported_shop_action"`, `"shop_item_not_found"`, `"out_of_stock"`, `"character_not_found"`, `"not_enough_gold"` (includes `requiredGold` + `currentGold`), `"inventory_full"` + +--- + +## 5. World Object Interaction + +### 5.1 Interacting with an Object (750/751) + +**Request (750 WORLD_OBJECT_INTERACT):** +```json +{ + "objectId": 999, + "action": "interact" +} +``` + +`action` values: `"interact"` (default), `"break"` (for destructibles), `"loot"` (for containers). + +Server validates: object exists in DB, within 128px. + +**Response (751 WORLD_OBJECT_INTERACT_RESULT):** + +Response shape varies by object type: + +**Destructible object** (when `action = "break"` and `IsDestructible = true`): +```json +{ + "success": true, + "objectId": 999, + "type": "break", + "gold": 25, + "items": [] +} +``` + +**Container / OpenContainer** (lootable): +```json +{ + "success": true, + "objectId": 999, + "type": "loot", + "gold": 50, + "items": [] +} +``` + +**Trigger** (readable signs, plaques, etc.): +```json +{ + "success": true, + "objectId": 999, + "type": "readable", + "name": "Weathered Sign", + "text": "Danger ahead!" +} +``` + +**Teleport** (handled by movement system, not this handler): +```json +{ + "success": true, + "objectId": 999, + "type": "teleport", + "message": "Portal triggered by movement." +} +``` + +**Generic / unhandled types:** +```json +{ + "success": true, + "objectId": 999, + "type": "heal", + "name": "Healing Shrine", + "metadataJson": "{...}" +} +``` + +Error cases on 751: `"object_not_found"`, `"object_chunk_not_found"`, `"too_far"` + +### 5.2 Object State Broadcast (752 WORLD_OBJECT_STATE) S -> C + +Broadcast to **all players in the zone** when an object's state changes +(e.g. a destructible is broken): + +```json +{ + "objectId": 999, + "state": "broken", "x": 5, - "y": 3, - "objectDefinitionId": 12, - "objectName": "Portal Stone", - "interactionType": "Teleport", - "rotation": 0, - "metadataJson": "{\"portalType\":\"world\",...}" + "y": 10 } ``` -**Client action**: Upsert by `id` in the chunk's `objects` array. Call `_rebuild_world_entities()`. -#### `object_remove` - An object was removed +The client should visually remove or swap the object sprite when receiving +this. Coordinates are **tile** positions (not world pixels). + +--- + +## 6. Portal / Z-Level System + +### 6.1 Portal Metadata + +Portal objects on tiles now include `targetZoneZ` and a `portalType` field +in their `MetadataJson`: + +| portalType | Behavior | +|------------------|----------------------------------------------------------| +| `"world"` | Teleport to different region/zone. Includes full target. | +| `"building"` | Enter a building: stays same zoneX/zoneY, changes zoneZ. | +| `"building_exit"`| Exit building: returns to zoneZ=0 (ground level). | + +### 6.2 Portal Events in WORLD_STATE + +When a player walks over a portal tile, the server triggers a teleport and +includes a `portalEvent` in the next `WORLD_STATE`: + ```json { - "type": "object_remove", - "id": 456 + "portalEvent": { + "type": "world_teleport", + "sourceObjectId": 123, + "regionId": 2, + "zoneX": 1, "zoneY": 1, "zoneZ": 0, + "chunkX": 2, "chunkY": 2, + "x": 512.0, "y": 512.0 + } } ``` -**Client action**: Remove the object with matching `id` from `objects`. Call `_rebuild_world_entities()`. -#### `npc_upsert` - An NPC spawn was added or changed -```json -{ - "type": "npc_upsert", - "id": 789, - "x": 10, - "y": 15, - "npcDefinitionId": 5, - "npcName": "Merchant", - "rotation": 0, - "metadataJson": null -} -``` -**Client action**: Upsert by `id` in the chunk's `npcs` array. Call `_rebuild_world_entities()`. +For building portals, the portal event may only change `zoneZ` while keeping +the same region/zone XY. The client should: -#### `npc_remove` -```json -{ "type": "npc_remove", "id": 789 } -``` -**Client action**: Remove NPC with matching `id`. Call `_rebuild_world_entities()`. +1. Detect the `portalEvent` in `WORLD_STATE`. +2. Clear loaded chunks (new Z-level = new tile data). +3. Start loading chunks from the new position. +4. The server sends new chunks via `chunkUpdates` automatically. -#### `mob_upsert` - A mob spawn was added or changed -```json -{ - "type": "mob_upsert", - "id": 101, - "x": 20, - "y": 25, - "mobDefinitionId": 3, - "mobName": "Slime", - "rotation": 0, - "spawnCount": 2, - "respawnSeconds": 30.0, - "metadataJson": null -} -``` -**Client action**: Upsert by `id` in the chunk's `mobs` array. Call `_rebuild_world_entities()`. +Portal cooldown is **0.8 seconds** (8 server ticks), enforced server-side. -#### `mob_remove` -```json -{ "type": "mob_remove", "id": 101 } -``` -**Client action**: Remove mob with matching `id`. Call `_rebuild_world_entities()`. +--- -#### `chunk_clear` - All tiles/objects/npcs/mobs removed from chunk -```json -{ "type": "chunk_clear" } -``` -**Client action**: Empty the chunk's `tiles`, `objects`, `npcs`, `mobs` arrays. -Call `_rebuild_world_visuals()` and `_rebuild_world_entities()`. +## 7. Client Implementation Checklist -#### `chunk_deleted` - Entire chunk deleted from DB -```json -{ "type": "chunk_deleted" } -``` -**Client action**: Remove the chunk from `chunk_cache` entirely. -Call `_rebuild_world_visuals()` and `_rebuild_world_entities()`. +### Mob Rendering +- [ ] Parse `mobs` array from WORLD_STATE (nullable -- skip if null) +- [ ] Render mob sprites using `spriteConfig`, `tintColor`, `scale` +- [ ] Animate using `animation` string (e.g. `"idle_down"`, `"walk_right"`) +- [ ] Show mob health bars (health/maxHealth) +- [ ] Handle mob states: Idle, Chasing, Attacking, Dead +- [ ] Dead mobs: play death animation, show loot indicator if `lootAvailable` +- [ ] Mob click/tap target -> send WORLD_ATTACK with `targetType: "mob"` +- [ ] Show damage numbers from WORLD_COMBAT_STATE events -### Implementation guide for the client +### NPC Rendering +- [ ] Parse `npcs` array from WORLD_STATE (nullable -- skip if null) +- [ ] Render NPC sprites using `spriteConfig`, `tintColor`, `scale` +- [ ] Show interaction indicator (speech bubble? shop icon?) based on `canShop`/`hasDialog` +- [ ] NPC click/tap -> send WORLD_NPC_INTERACT +- [ ] Build dialog UI: show `dialogNode.text` + selectable `options` +- [ ] On option click -> send WORLD_NPC_DIALOG_SELECT +- [ ] Build shop UI: list items with prices, buy button +- [ ] On buy -> send WORLD_NPC_SHOP_ACTION -In your GameState (or wherever you route opcodes), add a handler for opcode 712: +### Combat UI +- [ ] Register handler for opcode 720 (WORLD_COMBAT_STATE) +- [ ] Floating damage numbers (position from event x/y) +- [ ] Color coding: red for damage, yellow for resisted, green for weakness +- [ ] Death handling: PvP death shows killer name, mob death shows respawn +- [ ] XP popup on MobDeath events (`xpReward` field) +- [ ] Mob target frame / health bar while attacking -```gdscript -# In GameState or network handler: -712: # WORLD_CHUNK_DELTA - emit_signal("world_chunk_delta_received", data) -``` +### Mob Looting +- [ ] On dead mob click -> send WORLD_MOB_LOOT_REQUEST +- [ ] Register handler for opcode 723 (WORLD_MOB_LOOT_RESULT) +- [ ] Show loot window with gold + items +- [ ] Update local gold counter from loot result -In the world scene script, connect to the signal and apply: +### Object Interaction +- [ ] Register handler for opcode 751 (WORLD_OBJECT_INTERACT_RESULT) +- [ ] Register handler for opcode 752 (WORLD_OBJECT_STATE) +- [ ] Object click/tap -> send WORLD_OBJECT_INTERACT (action based on object type) +- [ ] Breakable objects: show break animation then remove sprite on WORLD_OBJECT_STATE +- [ ] Lootable objects: show loot popup with gold + items +- [ ] Readable objects: show text popup with `text` field +- [ ] Handle WORLD_OBJECT_STATE broadcast to update/remove objects broken by other players -```gdscript -func _setup_runtime(): - # ... existing connections ... - if GameState: - GameState.world_chunk_delta_received.connect(_on_world_chunk_delta_received) +### Z-Level / Portals +- [ ] Handle `portalEvent` in WORLD_STATE response +- [ ] On portalEvent: clear chunk cache, transition to new position +- [ ] Building entrance visual indicator on portal tiles +- [ ] Building interior: same zone XY but different Z = different tile set +- [ ] Track current `zoneZ` client-side (from `self` in WORLD_STATE) -func _on_world_chunk_delta_received(data: Dictionary): - if runtime == null: - return - runtime.apply_chunk_delta(data) - _rebuild_world_visuals() - _rebuild_world_entities() -``` +### PvP +- [ ] Visual indicator when entering a PvP-enabled zone (server does not send zone flags yet -- use hardcoded zone list or future opcode) +- [ ] Player click/tap in PvP zone -> send WORLD_ATTACK with `targetType: "player"` +- [ ] Handle `PvpDamage` and `PlayerDeath` with `isPvpKill: true` events +- [ ] Invulnerability visual (shield icon) when defender `isInvulnerable` -In the world runtime client, add the delta application logic: +--- -```gdscript -func apply_chunk_delta(data: Dictionary): - var key = _chunk_key( - int(data.get("regionId", 0)), - int(data.get("zoneX", 0)), - int(data.get("zoneY", 0)), - int(data.get("chunkX", 0)), - int(data.get("chunkY", 0)) - ) - var op = data.get("op", {}) - var op_type = str(op.get("type", "")) +## 8. Known Limitations / TODOs - if not chunk_cache.has(key): - return # We don't have this chunk loaded, ignore - - var chunk = chunk_cache[key] - - match op_type: - "tile_upsert": - _delta_upsert_tile(chunk, op) - "tile_remove": - _delta_remove_tile(chunk, op) - "object_upsert": - _delta_upsert_by_id(chunk, "objects", op) - "object_remove": - _delta_remove_by_id(chunk, "objects", int(op.get("id", -1))) - "npc_upsert": - _delta_upsert_by_id(chunk, "npcs", op) - "npc_remove": - _delta_remove_by_id(chunk, "npcs", int(op.get("id", -1))) - "mob_upsert": - _delta_upsert_by_id(chunk, "mobs", op) - "mob_remove": - _delta_remove_by_id(chunk, "mobs", int(op.get("id", -1))) - "chunk_clear": - chunk["tiles"] = [] - chunk["objects"] = [] - chunk["npcs"] = [] - chunk["mobs"] = [] - "chunk_deleted": - chunk_cache.erase(key) - - # Update version tracking - var new_version = int(data.get("toVersion", 0)) - if chunk_cache.has(key): - chunk_cache[key]["version"] = new_version - -func _delta_upsert_tile(chunk: Dictionary, op: Dictionary): - var tx = int(op.get("x", -1)) - var ty = int(op.get("y", -1)) - var tiles = chunk.get("tiles", []) - for i in range(tiles.size()): - var t = tiles[i] - if int(t.get("x", t.get("tileX", -1))) == tx and int(t.get("y", t.get("tileY", -1))) == ty: - tiles[i] = op - return - tiles.append(op) - -func _delta_remove_tile(chunk: Dictionary, op: Dictionary): - var tx = int(op.get("x", -1)) - var ty = int(op.get("y", -1)) - var tiles = chunk.get("tiles", []) - for i in range(tiles.size() - 1, -1, -1): - var t = tiles[i] - if int(t.get("x", t.get("tileX", -1))) == tx and int(t.get("y", t.get("tileY", -1))) == ty: - tiles.remove_at(i) - return - -func _delta_upsert_by_id(chunk: Dictionary, array_name: String, op: Dictionary): - var id = int(op.get("id", -1)) - var arr = chunk.get(array_name, []) - for i in range(arr.size()): - if int(arr[i].get("id", -1)) == id: - arr[i] = op - return - arr.append(op) - -func _delta_remove_by_id(chunk: Dictionary, array_name: String, id: int): - var arr = chunk.get(array_name, []) - for i in range(arr.size() - 1, -1, -1): - if int(arr[i].get("id", -1)) == id: - arr.remove_at(i) - return -``` - -## Performance Notes - -### Server movement fix -The server tick loop no longer hits the database. Movement/collision is now pure in-memory. -The "1 tile per 3 seconds" latency was caused by 30+ DB round-trips per player per tick on the server side. - -### LOCAL_MOVE_SPEED mismatch -The client uses `LOCAL_MOVE_SPEED = 160.0` for local prediction, but the server walk speed -is `120 px/s` and run speed is `180 px/s`. This causes minor rubber-banding. -Consider changing `LOCAL_MOVE_SPEED` to `120.0` or reading the server's speed from WORLD_SPAWN. +- **Loot tables not integrated**: WORLD_MOB_LOOT_RESULT `items` array is always empty. Only gold drops currently. +- **Player combat stats hardcoded**: EnsurePlayersInZoneSimsAsync uses default stats (str=10, int=10, etc). Real gear-based stats not loaded yet. +- **No zone PvP flag sent to client**: The client has no way to know if a zone is PvP-enabled. Will need a future opcode or flag in chunk/zone data. +- **Object broken state not persisted**: Breakable objects reset on server restart. +- **Sell action not implemented**: WORLD_NPC_SHOP_ACTION only supports `"buy"`. +- **No world death/respawn flow**: PlayerDeath events are broadcast but there is no respawn opcode or flow yet. +- **Mob AI abilities**: Mobs use the dungeon AI system (10 behavior patterns) but world mob abilities haven't been extensively tested. diff --git a/Migrations/20260217172059_tableUpdatesForWorld.Designer.cs b/Migrations/20260217172059_tableUpdatesForWorld.Designer.cs new file mode 100644 index 0000000..8ab39ec --- /dev/null +++ b/Migrations/20260217172059_tableUpdatesForWorld.Designer.cs @@ -0,0 +1,4170 @@ +// +using System; +using DataServer.Data; +using Microsoft.EntityFrameworkCore; +using Microsoft.EntityFrameworkCore.Infrastructure; +using Microsoft.EntityFrameworkCore.Metadata; +using Microsoft.EntityFrameworkCore.Migrations; +using Microsoft.EntityFrameworkCore.Storage.ValueConversion; + +#nullable disable + +namespace SystemRevivalServer.Migrations +{ + [DbContext(typeof(GameDbContext))] + [Migration("20260217172059_tableUpdatesForWorld")] + partial class tableUpdatesForWorld + { + /// + protected override void BuildTargetModel(ModelBuilder modelBuilder) + { +#pragma warning disable 612, 618 + modelBuilder + .HasAnnotation("ProductVersion", "9.0.10") + .HasAnnotation("Relational:MaxIdentifierLength", 64); + + MySqlModelBuilderExtensions.AutoIncrementColumns(modelBuilder); + + modelBuilder.Entity("DataServer.Data.Account", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("bigint unsigned"); + + MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property("Id")); + + b.Property("BannedUntil") + .HasColumnType("datetime(6)"); + + b.Property("CreatedAt") + .ValueGeneratedOnAdd() + .HasColumnType("datetime(6)") + .HasDefaultValueSql("CURRENT_TIMESTAMP(6)"); + + b.Property("Email") + .HasMaxLength(255) + .HasColumnType("varchar(255)"); + + b.Property("IsBanned") + .HasColumnType("tinyint(1)"); + + b.Property("PasswordHash") + .IsRequired() + .HasColumnType("varbinary(64)"); + + b.Property("PasswordSalt") + .IsRequired() + .HasColumnType("varbinary(32)"); + + b.Property("Role") + .ValueGeneratedOnAdd() + .HasColumnType("int") + .HasDefaultValue(0); + + b.Property("UpdatedAt") + .ValueGeneratedOnAddOrUpdate() + .HasColumnType("datetime(6)") + .HasDefaultValueSql("CURRENT_TIMESTAMP(6)"); + + MySqlPropertyBuilderExtensions.UseMySqlComputedColumn(b.Property("UpdatedAt")); + + b.Property("Username") + .IsRequired() + .HasMaxLength(32) + .HasColumnType("varchar(32)"); + + b.HasKey("Id"); + + b.HasIndex("Email") + .IsUnique(); + + b.HasIndex("Username") + .IsUnique(); + + b.ToTable("accounts", (string)null); + }); + + modelBuilder.Entity("DataServer.Data.Entities.BuilderRoomTemplate", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property("Id")); + + b.Property("AllowMirror") + .HasColumnType("tinyint(1)"); + + b.Property("AllowRotation") + .HasColumnType("tinyint(1)"); + + b.Property("Biome") + .HasMaxLength(32) + .HasColumnType("varchar(32)"); + + b.Property("ConnectionPointsJson") + .HasColumnType("json"); + + b.Property("CreatedAt") + .HasColumnType("datetime(6)"); + + b.Property("Description") + .HasMaxLength(256) + .HasColumnType("varchar(256)"); + + b.Property("ExitPortalX") + .HasColumnType("int"); + + b.Property("ExitPortalY") + .HasColumnType("int"); + + b.Property("Height") + .HasColumnType("int"); + + b.Property("IsEnabled") + .HasColumnType("tinyint(1)"); + + b.Property("ItemSpawnsJson") + .HasColumnType("json"); + + b.Property("MaxConnections") + .HasColumnType("int"); + + b.Property("MaxTier") + .HasColumnType("int"); + + b.Property("MinConnections") + .HasColumnType("int"); + + b.Property("MinTier") + .HasColumnType("int"); + + b.Property("MobSpawnsJson") + .HasColumnType("json"); + + b.Property("Name") + .IsRequired() + .HasMaxLength(64) + .HasColumnType("varchar(64)"); + + b.Property("ObjectPlacementsJson") + .HasColumnType("json"); + + b.Property("PlayerSpawnX") + .HasColumnType("int"); + + b.Property("PlayerSpawnY") + .HasColumnType("int"); + + b.Property("Tags") + .HasMaxLength(256) + .HasColumnType("varchar(256)"); + + b.Property("TileGridJson") + .HasColumnType("json"); + + b.Property("TilePlacementsJson") + .HasColumnType("json"); + + b.Property("Type") + .HasColumnType("int"); + + b.Property("UpdatedAt") + .HasColumnType("datetime(6)"); + + b.Property("Weight") + .HasColumnType("int"); + + b.Property("Width") + .HasColumnType("int"); + + b.HasKey("Id"); + + b.ToTable("builder_room_templates"); + }); + + modelBuilder.Entity("DataServer.Data.Entities.ClientAsset", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property("Id")); + + b.Property("AssetType") + .HasColumnType("int"); + + b.Property("CdnPath") + .HasMaxLength(256) + .HasColumnType("varchar(256)"); + + b.Property("CreatedAt") + .HasColumnType("datetime(6)"); + + b.Property("FileHash") + .IsRequired() + .HasMaxLength(32) + .HasColumnType("varchar(32)"); + + b.Property("FilePath") + .IsRequired() + .HasMaxLength(256) + .HasColumnType("varchar(256)"); + + b.Property("FileSize") + .HasColumnType("bigint"); + + b.Property("IsEnabled") + .HasColumnType("tinyint(1)"); + + b.Property("IsRequired") + .HasColumnType("tinyint(1)"); + + b.Property("MinClientVersion") + .HasMaxLength(16) + .HasColumnType("varchar(16)"); + + b.Property("UpdatedAt") + .HasColumnType("datetime(6)"); + + b.Property("Version") + .HasColumnType("int"); + + b.HasKey("Id"); + + b.ToTable("client_assets"); + }); + + modelBuilder.Entity("DataServer.Data.Entities.DamageResistanceType", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property("Id")); + + b.Property("Color") + .IsRequired() + .HasMaxLength(16) + .HasColumnType("varchar(16)"); + + b.Property("CreatedAt") + .HasColumnType("datetime(6)"); + + b.Property("Description") + .IsRequired() + .HasMaxLength(256) + .HasColumnType("varchar(256)"); + + b.Property("DisplayName") + .IsRequired() + .HasMaxLength(64) + .HasColumnType("varchar(64)"); + + b.Property("IconPath") + .HasMaxLength(256) + .HasColumnType("varchar(256)"); + + b.Property("IsEnabled") + .HasColumnType("tinyint(1)"); + + b.Property("Key") + .IsRequired() + .HasMaxLength(32) + .HasColumnType("varchar(32)"); + + b.Property("SortOrder") + .HasColumnType("int"); + + b.HasKey("Id"); + + b.ToTable("damage_resistance_types"); + }); + + modelBuilder.Entity("DataServer.Data.Entities.DeathChest", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("bigint unsigned"); + + MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property("Id")); + + b.Property("CreatedAt") + .HasColumnType("datetime(6)"); + + b.Property("DungeonInstanceId") + .HasColumnType("char(36)"); + + b.Property("EmptiedAt") + .HasColumnType("datetime(6)"); + + b.Property("GoldAmount") + .HasColumnType("bigint"); + + b.Property("IsEmpty") + .HasColumnType("tinyint(1)"); + + b.Property("OwnerCharacterId") + .HasColumnType("bigint unsigned"); + + b.Property("VictimCharacterId") + .HasColumnType("bigint unsigned"); + + b.Property("VictimMobDefinitionId") + .HasColumnType("int"); + + b.Property("X") + .HasColumnType("float"); + + b.Property("Y") + .HasColumnType("float"); + + b.HasKey("Id"); + + b.HasIndex("OwnerCharacterId"); + + b.HasIndex("VictimCharacterId"); + + b.ToTable("dungeon_death_chests"); + }); + + modelBuilder.Entity("DataServer.Data.Entities.DeathChestItem", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("bigint unsigned"); + + MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property("Id")); + + b.Property("DeathChestId") + .HasColumnType("bigint unsigned"); + + b.Property("IsTaken") + .HasColumnType("tinyint(1)"); + + b.Property("ItemDefinitionId") + .HasColumnType("int"); + + b.Property("Quantity") + .HasColumnType("int"); + + b.Property("SlotIndex") + .HasColumnType("int"); + + b.Property("TakenAt") + .HasColumnType("datetime(6)"); + + b.HasKey("Id"); + + b.HasIndex("DeathChestId"); + + b.HasIndex("ItemDefinitionId"); + + b.ToTable("dungeon_death_chest_items"); + }); + + modelBuilder.Entity("DataServer.Data.Entities.DungeonBeltItem", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("bigint unsigned"); + + MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property("Id")); + + b.Property("CharacterId") + .HasColumnType("bigint unsigned"); + + b.Property("InventorySlotIndex") + .HasColumnType("int"); + + b.Property("SlotIndex") + .HasColumnType("int"); + + b.HasKey("Id"); + + b.HasIndex("CharacterId"); + + b.ToTable("dungeon_belt_items"); + }); + + modelBuilder.Entity("DataServer.Data.Entities.DungeonCharacter", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("bigint unsigned"); + + MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property("Id")); + + b.Property("AccountId") + .HasColumnType("bigint unsigned"); + + b.Property("BossesKilled") + .HasColumnType("int"); + + b.Property("CreatedAt") + .HasColumnType("datetime(6)"); + + b.Property("CurrentHealth") + .HasColumnType("int"); + + b.Property("CurrentMana") + .HasColumnType("int"); + + b.Property("Dexterity") + .HasColumnType("int"); + + b.Property("DungeonsCompleted") + .HasColumnType("int"); + + b.Property("Endurance") + .HasColumnType("int"); + + b.Property("EquippedBoots") + .HasColumnType("bigint unsigned"); + + b.Property("EquippedChest") + .HasColumnType("bigint unsigned"); + + b.Property("EquippedGloves") + .HasColumnType("bigint unsigned"); + + b.Property("EquippedHead") + .HasColumnType("bigint unsigned"); + + b.Property("EquippedLegs") + .HasColumnType("bigint unsigned"); + + b.Property("EquippedNecklace") + .HasColumnType("bigint unsigned"); + + b.Property("EquippedOffhand") + .HasColumnType("bigint unsigned"); + + b.Property("EquippedQuiver") + .HasColumnType("bigint unsigned"); + + b.Property("EquippedRing1") + .HasColumnType("bigint unsigned"); + + b.Property("EquippedRing2") + .HasColumnType("bigint unsigned"); + + b.Property("EquippedWeapon") + .HasColumnType("bigint unsigned"); + + b.Property("Experience") + .HasColumnType("bigint"); + + b.Property("Gold") + .HasColumnType("bigint"); + + b.Property("Intelligence") + .HasColumnType("int"); + + b.Property("IsDeleted") + .HasColumnType("tinyint(1)"); + + b.Property("LastPlayedAt") + .HasColumnType("datetime(6)"); + + b.Property("Level") + .HasColumnType("int"); + + b.Property("Name") + .IsRequired() + .HasMaxLength(32) + .HasColumnType("varchar(32)"); + + b.Property("PlayersKilled") + .HasColumnType("int"); + + b.Property("ResistancesJson") + .IsRequired() + .HasMaxLength(1024) + .HasColumnType("varchar(1024)"); + + b.Property("Strength") + .HasColumnType("int"); + + b.Property("TotalDeaths") + .HasColumnType("int"); + + b.Property("TotalKills") + .HasColumnType("int"); + + b.Property("UnspentStatPoints") + .HasColumnType("int"); + + b.Property("Wisdom") + .HasColumnType("int"); + + b.Property("WorldChunkX") + .HasColumnType("int"); + + b.Property("WorldChunkY") + .HasColumnType("int"); + + b.Property("WorldRegionId") + .HasColumnType("int"); + + b.Property("WorldX") + .HasColumnType("float"); + + b.Property("WorldY") + .HasColumnType("float"); + + b.Property("WorldZoneX") + .HasColumnType("int"); + + b.Property("WorldZoneY") + .HasColumnType("int"); + + b.Property("WorldZoneZ") + .HasColumnType("int"); + + b.HasKey("Id"); + + b.HasIndex("AccountId"); + + b.ToTable("dungeon_characters"); + }); + + modelBuilder.Entity("DataServer.Data.Entities.DungeonCharacterCraftingSkill", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("bigint unsigned"); + + MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property("Id")); + + b.Property("CharacterId") + .HasColumnType("bigint unsigned"); + + b.Property("Experience") + .HasColumnType("bigint"); + + b.Property("Level") + .HasColumnType("int"); + + b.Property("SkillType") + .HasColumnType("int"); + + b.Property("TotalItemsCrafted") + .HasColumnType("int"); + + b.HasKey("Id"); + + b.HasIndex("CharacterId"); + + b.ToTable("dungeon_character_crafting_skills"); + }); + + modelBuilder.Entity("DataServer.Data.Entities.DungeonCharacterItem", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("bigint unsigned"); + + MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property("Id")); + + b.Property("AcquiredAt") + .HasColumnType("datetime(6)"); + + b.Property("CharacterId") + .HasColumnType("bigint unsigned"); + + b.Property("CraftedItemId") + .HasColumnType("bigint unsigned"); + + b.Property("EquipSlot") + .HasColumnType("int"); + + b.Property("IsEquipped") + .HasColumnType("tinyint(1)"); + + b.Property("ItemDefinitionId") + .HasColumnType("int"); + + b.Property("Quantity") + .HasColumnType("int"); + + b.Property("SlotIndex") + .HasColumnType("int"); + + b.HasKey("Id"); + + b.HasIndex("CharacterId"); + + b.HasIndex("CraftedItemId"); + + b.HasIndex("ItemDefinitionId"); + + b.ToTable("dungeon_character_items"); + }); + + modelBuilder.Entity("DataServer.Data.Entities.DungeonCharacterItemCraftedLink", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("bigint unsigned"); + + MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property("Id")); + + b.Property("CharacterItemId") + .HasColumnType("bigint unsigned"); + + b.Property("CraftedItemId") + .HasColumnType("bigint unsigned"); + + b.HasKey("Id"); + + b.HasIndex("CharacterItemId"); + + b.HasIndex("CraftedItemId"); + + b.ToTable("dungeon_character_item_crafted_link"); + }); + + modelBuilder.Entity("DataServer.Data.Entities.DungeonCharacterKnownRecipe", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("bigint unsigned"); + + MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property("Id")); + + b.Property("CharacterId") + .HasColumnType("bigint unsigned"); + + b.Property("DiscoveredAt") + .HasColumnType("datetime(6)"); + + b.Property("RecipeId") + .HasColumnType("int"); + + b.Property("TimesCrafted") + .HasColumnType("int"); + + b.HasKey("Id"); + + b.HasIndex("CharacterId"); + + b.HasIndex("RecipeId"); + + b.ToTable("dungeon_character_known_recipes"); + }); + + modelBuilder.Entity("DataServer.Data.Entities.DungeonCraftedItem", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("bigint unsigned"); + + MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property("Id")); + + b.Property("BaseItemDefinitionId") + .HasColumnType("int"); + + b.Property("CraftedAt") + .HasColumnType("datetime(6)"); + + b.Property("CrafterId") + .HasColumnType("bigint unsigned"); + + b.Property("CrafterName") + .HasMaxLength(32) + .HasColumnType("varchar(32)"); + + b.Property("CraftingLevelAtCreation") + .HasColumnType("int"); + + b.Property("CustomName") + .HasMaxLength(64) + .HasColumnType("varchar(64)"); + + b.Property("QualityRating") + .HasColumnType("int"); + + b.Property("RecipeId") + .HasColumnType("int"); + + b.Property("RollHistoryJson") + .HasMaxLength(1024) + .HasColumnType("varchar(1024)"); + + b.Property("RolledBonusArmor") + .HasColumnType("int"); + + b.Property("RolledBonusDexterity") + .HasColumnType("int"); + + b.Property("RolledBonusEndurance") + .HasColumnType("int"); + + b.Property("RolledBonusHealAmount") + .HasColumnType("int"); + + b.Property("RolledBonusHealth") + .HasColumnType("int"); + + b.Property("RolledBonusIntelligence") + .HasColumnType("int"); + + b.Property("RolledBonusMagicResist") + .HasColumnType("int"); + + b.Property("RolledBonusMana") + .HasColumnType("int"); + + b.Property("RolledBonusManaRestore") + .HasColumnType("int"); + + b.Property("RolledBonusMaxDamage") + .HasColumnType("int"); + + b.Property("RolledBonusMinDamage") + .HasColumnType("int"); + + b.Property("RolledBonusStrength") + .HasColumnType("int"); + + b.Property("RolledBonusWisdom") + .HasColumnType("int"); + + b.HasKey("Id"); + + b.HasIndex("BaseItemDefinitionId"); + + b.HasIndex("CrafterId"); + + b.HasIndex("RecipeId"); + + b.ToTable("dungeon_crafted_items"); + }); + + modelBuilder.Entity("DataServer.Data.Entities.DungeonCraftingRecipe", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property("Id")); + + b.Property("BaseXp") + .HasColumnType("int"); + + b.Property("BonusOutputChanceAtMinLevel") + .HasColumnType("float"); + + b.Property("BonusOutputItemDefinitionId") + .HasColumnType("int"); + + b.Property("BonusOutputMaxLevel") + .HasColumnType("int"); + + b.Property("BonusOutputMinLevel") + .HasColumnType("int"); + + b.Property("BonusOutputQuantity") + .HasColumnType("int"); + + b.Property("Description") + .IsRequired() + .HasMaxLength(256) + .HasColumnType("varchar(256)"); + + b.Property("HasStatRolls") + .HasColumnType("tinyint(1)"); + + b.Property("IsBaseRecipe") + .HasColumnType("tinyint(1)"); + + b.Property("IsEnabled") + .HasColumnType("tinyint(1)"); + + b.Property("Name") + .IsRequired() + .HasMaxLength(64) + .HasColumnType("varchar(64)"); + + b.Property("OutputItemDefinitionId") + .HasColumnType("int"); + + b.Property("OutputQuantity") + .HasColumnType("int"); + + b.Property("PossibleStatsJson") + .HasMaxLength(1024) + .HasColumnType("varchar(1024)"); + + b.Property("RequiredLevel") + .HasColumnType("int"); + + b.Property("SkillType") + .HasColumnType("int"); + + b.Property("Tier") + .HasColumnType("int"); + + b.HasKey("Id"); + + b.HasIndex("OutputItemDefinitionId"); + + b.ToTable("dungeon_crafting_recipes"); + }); + + modelBuilder.Entity("DataServer.Data.Entities.DungeonCraftingRecipeIngredient", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property("Id")); + + b.Property("ItemDefinitionId") + .HasColumnType("int"); + + b.Property("Quantity") + .HasColumnType("int"); + + b.Property("RecipeId") + .HasColumnType("int"); + + b.Property("SlotOrder") + .HasColumnType("int"); + + b.HasKey("Id"); + + b.HasIndex("ItemDefinitionId"); + + b.HasIndex("RecipeId"); + + b.ToTable("dungeon_crafting_recipe_ingredients"); + }); + + modelBuilder.Entity("DataServer.Data.Entities.DungeonItemDefinition", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property("Id")); + + b.Property("AmmunitionType") + .HasMaxLength(32) + .HasColumnType("varchar(32)"); + + b.Property("Armor") + .HasColumnType("int"); + + b.Property("ArrowRecoveryChance") + .HasColumnType("float"); + + b.Property("AttackRange") + .HasColumnType("float"); + + b.Property("BonusDexterity") + .HasColumnType("int"); + + b.Property("BonusEndurance") + .HasColumnType("int"); + + b.Property("BonusHealth") + .HasColumnType("int"); + + b.Property("BonusIntelligence") + .HasColumnType("int"); + + b.Property("BonusMana") + .HasColumnType("int"); + + b.Property("BonusStrength") + .HasColumnType("int"); + + b.Property("BonusWisdom") + .HasColumnType("int"); + + b.Property("BuffDuration") + .HasColumnType("int"); + + b.Property("BuffResistancesJson") + .IsRequired() + .HasMaxLength(1024) + .HasColumnType("varchar(1024)"); + + b.Property("DamageTypeKey") + .IsRequired() + .HasMaxLength(32) + .HasColumnType("varchar(32)"); + + b.Property("Description") + .IsRequired() + .HasMaxLength(256) + .HasColumnType("varchar(256)"); + + b.Property("EquipSlot") + .HasColumnType("int"); + + b.Property("HealAmount") + .HasColumnType("int"); + + b.Property("IsEnabled") + .HasColumnType("tinyint(1)"); + + b.Property("IsLinearProjectile") + .HasColumnType("tinyint(1)"); + + b.Property("IsTeleportScroll") + .HasColumnType("tinyint(1)"); + + b.Property("IsThrowable") + .HasColumnType("tinyint(1)"); + + b.Property("ManaRestore") + .HasColumnType("int"); + + b.Property("MaxArmor") + .HasColumnType("int"); + + b.Property("MaxBonusDexterity") + .HasColumnType("int"); + + b.Property("MaxBonusEndurance") + .HasColumnType("int"); + + b.Property("MaxBonusHealth") + .HasColumnType("int"); + + b.Property("MaxBonusIntelligence") + .HasColumnType("int"); + + b.Property("MaxBonusMana") + .HasColumnType("int"); + + b.Property("MaxBonusStrength") + .HasColumnType("int"); + + b.Property("MaxBonusWisdom") + .HasColumnType("int"); + + b.Property("MaxDamage") + .HasColumnType("int"); + + b.Property("MaxMaxDamage") + .HasColumnType("int"); + + b.Property("MaxMinDamage") + .HasColumnType("int"); + + b.Property("MaxStack") + .HasColumnType("int"); + + b.Property("MinArmor") + .HasColumnType("int"); + + b.Property("MinBonusDexterity") + .HasColumnType("int"); + + b.Property("MinBonusEndurance") + .HasColumnType("int"); + + b.Property("MinBonusHealth") + .HasColumnType("int"); + + b.Property("MinBonusIntelligence") + .HasColumnType("int"); + + b.Property("MinBonusMana") + .HasColumnType("int"); + + b.Property("MinBonusStrength") + .HasColumnType("int"); + + b.Property("MinBonusWisdom") + .HasColumnType("int"); + + b.Property("MinDamage") + .HasColumnType("int"); + + b.Property("MinMaxDamage") + .HasColumnType("int"); + + b.Property("MinMinDamage") + .HasColumnType("int"); + + b.Property("Name") + .IsRequired() + .HasMaxLength(64) + .HasColumnType("varchar(64)"); + + b.Property("ProjectileBackX") + .HasColumnType("int"); + + b.Property("ProjectileBackY") + .HasColumnType("int"); + + b.Property("ProjectileFrontX") + .HasColumnType("int"); + + b.Property("ProjectileFrontY") + .HasColumnType("int"); + + b.Property("ProjectileRange") + .HasColumnType("int"); + + b.Property("ProjectileSpeed") + .HasColumnType("float"); + + b.Property("QuiverCapacity") + .HasColumnType("int"); + + b.Property("Rarity") + .HasColumnType("int"); + + b.Property("RequiredDexterity") + .HasColumnType("int"); + + b.Property("RequiredIntelligence") + .HasColumnType("int"); + + b.Property("RequiredLevel") + .HasColumnType("int"); + + b.Property("RequiredStrength") + .HasColumnType("int"); + + b.Property("RequiredWisdom") + .HasColumnType("int"); + + b.Property("RequiresAmmunition") + .HasColumnType("tinyint(1)"); + + b.Property("ResistancesJson") + .IsRequired() + .HasMaxLength(1024) + .HasColumnType("varchar(1024)"); + + b.Property("SpriteId") + .HasColumnType("int"); + + b.Property("SpritePath") + .HasMaxLength(256) + .HasColumnType("varchar(256)"); + + b.Property("Stackable") + .HasColumnType("tinyint(1)"); + + b.Property("StaminaRestore") + .HasColumnType("int"); + + b.Property("TeachesSpellId") + .HasColumnType("int"); + + b.Property("TintColor") + .HasMaxLength(16) + .HasColumnType("varchar(16)"); + + b.Property("Type") + .HasColumnType("int"); + + b.HasKey("Id"); + + b.ToTable("dungeon_item_definitions"); + }); + + modelBuilder.Entity("DataServer.Data.Entities.DungeonLearnedSpell", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("bigint unsigned"); + + MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property("Id")); + + b.Property("CharacterId") + .HasColumnType("bigint unsigned"); + + b.Property("DefinitionId") + .HasColumnType("int"); + + b.Property("LearnedAt") + .HasColumnType("datetime(6)"); + + b.Property("SpellDefinitionId") + .HasColumnType("int"); + + b.Property("SpellLevel") + .HasColumnType("int"); + + b.HasKey("Id"); + + b.HasIndex("CharacterId"); + + b.HasIndex("DefinitionId"); + + b.ToTable("dungeon_learned_spells"); + }); + + modelBuilder.Entity("DataServer.Data.Entities.DungeonLootTable", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property("Id")); + + b.Property("Description") + .IsRequired() + .HasMaxLength(256) + .HasColumnType("varchar(256)"); + + b.Property("DropChanceMultiplier") + .HasColumnType("float"); + + b.Property("GoldDropChance") + .HasColumnType("float"); + + b.Property("GuaranteedDrop") + .HasColumnType("tinyint(1)"); + + b.Property("IsEnabled") + .HasColumnType("tinyint(1)"); + + b.Property("MaxDrops") + .HasColumnType("int"); + + b.Property("MaxGold") + .HasColumnType("int"); + + b.Property("MaxTier") + .HasColumnType("int"); + + b.Property("MinDrops") + .HasColumnType("int"); + + b.Property("MinGold") + .HasColumnType("int"); + + b.Property("MinTier") + .HasColumnType("int"); + + b.Property("Name") + .IsRequired() + .HasMaxLength(64) + .HasColumnType("varchar(64)"); + + b.HasKey("Id"); + + b.ToTable("dungeon_loot_tables"); + }); + + modelBuilder.Entity("DataServer.Data.Entities.DungeonLootTableEntry", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property("Id")); + + b.Property("DropChance") + .HasColumnType("float"); + + b.Property("DropChancePerTier") + .HasColumnType("float"); + + b.Property("Guaranteed") + .HasColumnType("tinyint(1)"); + + b.Property("ItemDefinitionId") + .HasColumnType("int"); + + b.Property("LootTableId") + .HasColumnType("int"); + + b.Property("MaxDropChance") + .HasColumnType("float"); + + b.Property("MaxQuantity") + .HasColumnType("int"); + + b.Property("MinQuantity") + .HasColumnType("int"); + + b.Property("Weight") + .HasColumnType("int"); + + b.HasKey("Id"); + + b.HasIndex("ItemDefinitionId"); + + b.HasIndex("LootTableId"); + + b.ToTable("dungeon_loot_table_entries"); + }); + + modelBuilder.Entity("DataServer.Data.Entities.DungeonMobDefinition", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property("Id")); + + b.Property("AggroRange") + .HasColumnType("float"); + + b.Property("AnimationSpeed") + .HasColumnType("float"); + + b.Property("ArmorPerTier") + .HasColumnType("float"); + + b.Property("AttackRange") + .HasColumnType("float"); + + b.Property("AttackSpeed") + .HasColumnType("float"); + + b.Property("BaseArmor") + .HasColumnType("int"); + + b.Property("BaseHealth") + .HasColumnType("int"); + + b.Property("BaseMagicDamage") + .HasColumnType("int"); + + b.Property("BaseMagicResist") + .HasColumnType("int"); + + b.Property("BaseMana") + .HasColumnType("int"); + + b.Property("BasePhysicalDamage") + .HasColumnType("int"); + + b.Property("BaseXp") + .HasColumnType("int"); + + b.Property("Behavior") + .HasColumnType("int"); + + b.Property("CallForHelpRadius") + .HasColumnType("float"); + + b.Property("Category") + .HasColumnType("int"); + + b.Property("DamagePerTier") + .HasColumnType("float"); + + b.Property("DamageTypeKey") + .IsRequired() + .HasMaxLength(32) + .HasColumnType("varchar(32)"); + + b.Property("Description") + .IsRequired() + .HasMaxLength(256) + .HasColumnType("varchar(256)"); + + b.Property("DropChanceMultiplier") + .HasColumnType("float"); + + b.Property("FleeThreshold") + .HasColumnType("float"); + + b.Property("HealthPerTier") + .HasColumnType("float"); + + b.Property("IsEnabled") + .HasColumnType("tinyint(1)"); + + b.Property("LeashRange") + .HasColumnType("float"); + + b.Property("LootTableId") + .HasColumnType("int"); + + b.Property("MaxTier") + .HasColumnType("int"); + + b.Property("MinTier") + .HasColumnType("int"); + + b.Property("MoveSpeed") + .HasColumnType("float"); + + b.Property("Name") + .IsRequired() + .HasMaxLength(64) + .HasColumnType("varchar(64)"); + + b.Property("PhasesJson") + .HasMaxLength(2048) + .HasColumnType("varchar(2048)"); + + b.Property("PreferredRange") + .HasColumnType("float"); + + b.Property("ResistancesJson") + .IsRequired() + .HasMaxLength(1024) + .HasColumnType("varchar(1024)"); + + b.Property("Scale") + .HasColumnType("float"); + + b.Property("SpriteConfigJson") + .HasMaxLength(8192) + .HasColumnType("varchar(8192)"); + + b.Property("TintColor") + .IsRequired() + .HasMaxLength(16) + .HasColumnType("varchar(16)"); + + b.Property("Type") + .HasColumnType("int"); + + b.Property("XpPerTier") + .HasColumnType("float"); + + b.HasKey("Id"); + + b.ToTable("dungeon_mob_definitions"); + }); + + modelBuilder.Entity("DataServer.Data.Entities.DungeonMobLootTable", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property("Id")); + + b.Property("LootTableId") + .HasColumnType("int"); + + b.Property("MobDefinitionId") + .HasColumnType("int"); + + b.Property("Priority") + .HasColumnType("int"); + + b.Property("RollChance") + .HasColumnType("float"); + + b.HasKey("Id"); + + b.HasIndex("LootTableId"); + + b.HasIndex("MobDefinitionId"); + + b.ToTable("dungeon_mob_loot_tables"); + }); + + modelBuilder.Entity("DataServer.Data.Entities.DungeonNpcDefinition", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property("Id")); + + b.Property("AbilityDefinitionIdsJson") + .IsRequired() + .HasMaxLength(2048) + .HasColumnType("varchar(2048)"); + + b.Property("AttackPower") + .HasColumnType("int"); + + b.Property("BehaviorMode") + .HasColumnType("int"); + + b.Property("CanShop") + .HasColumnType("tinyint(1)"); + + b.Property("CanWander") + .HasColumnType("tinyint(1)"); + + b.Property("CreatedAt") + .HasColumnType("datetime(6)"); + + b.Property("Defense") + .HasColumnType("int"); + + b.Property("Description") + .IsRequired() + .HasMaxLength(256) + .HasColumnType("varchar(256)"); + + b.Property("Dexterity") + .HasColumnType("int"); + + b.Property("DialogTreeId") + .HasColumnType("int"); + + b.Property("Endurance") + .HasColumnType("int"); + + b.Property("HasDialog") + .HasColumnType("tinyint(1)"); + + b.Property("Intelligence") + .HasColumnType("int"); + + b.Property("IsEnabled") + .HasColumnType("tinyint(1)"); + + b.Property("IsKillable") + .HasColumnType("tinyint(1)"); + + b.Property("Key") + .IsRequired() + .HasMaxLength(64) + .HasColumnType("varchar(64)"); + + b.Property("Level") + .HasColumnType("int"); + + b.Property("LootTableId") + .HasColumnType("int"); + + b.Property("MaxHealth") + .HasColumnType("int"); + + b.Property("Name") + .IsRequired() + .HasMaxLength(64) + .HasColumnType("varchar(64)"); + + b.Property("OnAttackBehavior") + .HasColumnType("int"); + + b.Property("ResistancesJson") + .IsRequired() + .HasMaxLength(2048) + .HasColumnType("varchar(2048)"); + + b.Property("Scale") + .HasColumnType("float"); + + b.Property("ShopId") + .HasColumnType("int"); + + b.Property("SpriteConfigJson") + .HasMaxLength(4096) + .HasColumnType("varchar(4096)"); + + b.Property("Strength") + .HasColumnType("int"); + + b.Property("TintColor") + .IsRequired() + .HasMaxLength(16) + .HasColumnType("varchar(16)"); + + b.Property("UpdatedAt") + .HasColumnType("datetime(6)"); + + b.Property("WanderIntervalSeconds") + .HasColumnType("float"); + + b.Property("WanderRadiusPx") + .HasColumnType("float"); + + b.Property("Wisdom") + .HasColumnType("int"); + + b.HasKey("Id"); + + b.HasIndex("DialogTreeId"); + + b.HasIndex("LootTableId"); + + b.HasIndex("ShopId"); + + b.ToTable("dungeon_npc_definitions"); + }); + + modelBuilder.Entity("DataServer.Data.Entities.DungeonNpcDialogNode", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property("Id")); + + b.Property("DialogTreeId") + .HasColumnType("int"); + + b.Property("IsRoot") + .HasColumnType("tinyint(1)"); + + b.Property("IsTerminal") + .HasColumnType("tinyint(1)"); + + b.Property("NodeKey") + .IsRequired() + .HasMaxLength(128) + .HasColumnType("varchar(128)"); + + b.Property("RewardGold") + .HasColumnType("bigint"); + + b.Property("RewardItemDefinitionId") + .HasColumnType("int"); + + b.Property("RewardItemQuantity") + .HasColumnType("int"); + + b.Property("RewardQuestKey") + .HasMaxLength(64) + .HasColumnType("varchar(64)"); + + b.Property("RewardType") + .HasMaxLength(64) + .HasColumnType("varchar(64)"); + + b.Property("RewardXp") + .HasColumnType("bigint"); + + b.Property("Text") + .IsRequired() + .HasMaxLength(2048) + .HasColumnType("varchar(2048)"); + + b.HasKey("Id"); + + b.HasIndex("DialogTreeId"); + + b.ToTable("dungeon_npc_dialog_nodes"); + }); + + modelBuilder.Entity("DataServer.Data.Entities.DungeonNpcDialogOption", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property("Id")); + + b.Property("ConditionQuantity") + .HasColumnType("int"); + + b.Property("ConditionType") + .HasColumnType("int"); + + b.Property("ConditionValue") + .HasMaxLength(64) + .HasColumnType("varchar(64)"); + + b.Property("ConsumeConditionItem") + .HasColumnType("tinyint(1)"); + + b.Property("NextNodeId") + .HasColumnType("int"); + + b.Property("NodeId") + .HasColumnType("int"); + + b.Property("PlayerText") + .IsRequired() + .HasMaxLength(256) + .HasColumnType("varchar(256)"); + + b.Property("SortOrder") + .HasColumnType("int"); + + b.HasKey("Id"); + + b.HasIndex("NodeId"); + + b.ToTable("dungeon_npc_dialog_options"); + }); + + modelBuilder.Entity("DataServer.Data.Entities.DungeonNpcDialogTree", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property("Id")); + + b.Property("CreatedAt") + .HasColumnType("datetime(6)"); + + b.Property("Description") + .IsRequired() + .HasMaxLength(256) + .HasColumnType("varchar(256)"); + + b.Property("IsEnabled") + .HasColumnType("tinyint(1)"); + + b.Property("Name") + .IsRequired() + .HasMaxLength(64) + .HasColumnType("varchar(64)"); + + b.Property("UpdatedAt") + .HasColumnType("datetime(6)"); + + b.HasKey("Id"); + + b.ToTable("dungeon_npc_dialog_trees"); + }); + + modelBuilder.Entity("DataServer.Data.Entities.DungeonNpcShop", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property("Id")); + + b.Property("CreatedAt") + .HasColumnType("datetime(6)"); + + b.Property("IsEnabled") + .HasColumnType("tinyint(1)"); + + b.Property("Name") + .IsRequired() + .HasMaxLength(64) + .HasColumnType("varchar(64)"); + + b.Property("UpdatedAt") + .HasColumnType("datetime(6)"); + + b.HasKey("Id"); + + b.ToTable("dungeon_npc_shops"); + }); + + modelBuilder.Entity("DataServer.Data.Entities.DungeonNpcShopItem", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property("Id")); + + b.Property("ItemDefinitionId") + .HasColumnType("int"); + + b.Property("LastRestockAt") + .HasColumnType("datetime(6)"); + + b.Property("PriceGold") + .HasColumnType("bigint"); + + b.Property("Quantity") + .HasColumnType("int"); + + b.Property("RestockIntervalSeconds") + .HasColumnType("int"); + + b.Property("Restocks") + .HasColumnType("tinyint(1)"); + + b.Property("ShopId") + .HasColumnType("int"); + + b.Property("SlotIndex") + .HasColumnType("int"); + + b.HasKey("Id"); + + b.HasIndex("ItemDefinitionId"); + + b.HasIndex("ShopId"); + + b.ToTable("dungeon_npc_shop_items"); + }); + + modelBuilder.Entity("DataServer.Data.Entities.DungeonObjectDefinition", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property("Id")); + + b.Property("AnimationFps") + .HasColumnType("float"); + + b.Property("AnimationFrameCount") + .HasColumnType("int"); + + b.Property("Biome") + .HasMaxLength(32) + .HasColumnType("varchar(32)"); + + b.Property("BlocksLineOfSight") + .HasColumnType("tinyint(1)"); + + b.Property("BlocksMovement") + .HasColumnType("tinyint(1)"); + + b.Property("BlocksProjectiles") + .HasColumnType("tinyint(1)"); + + b.Property("CreatedAt") + .HasColumnType("datetime(6)"); + + b.Property("Description") + .HasMaxLength(512) + .HasColumnType("varchar(512)"); + + b.Property("Health") + .HasColumnType("int"); + + b.Property("Height") + .HasColumnType("int"); + + b.Property("InteractedSpritePath") + .HasMaxLength(256) + .HasColumnType("varchar(256)"); + + b.Property("InteractionType") + .HasColumnType("int"); + + b.Property("IsAnimated") + .HasColumnType("tinyint(1)"); + + b.Property("IsDestructible") + .HasColumnType("tinyint(1)"); + + b.Property("IsEnabled") + .HasColumnType("tinyint(1)"); + + b.Property("IsInteractable") + .HasColumnType("tinyint(1)"); + + b.Property("LootTableId") + .HasColumnType("int"); + + b.Property("Name") + .IsRequired() + .HasMaxLength(64) + .HasColumnType("varchar(64)"); + + b.Property("SpriteId") + .HasColumnType("int"); + + b.Property("SpritePath") + .HasMaxLength(256) + .HasColumnType("varchar(256)"); + + b.Property("Tags") + .HasMaxLength(256) + .HasColumnType("varchar(256)"); + + b.Property("Type") + .HasColumnType("int"); + + b.Property("UpdatedAt") + .HasColumnType("datetime(6)"); + + b.Property("Width") + .HasColumnType("int"); + + b.Property("ZIndex") + .HasColumnType("int"); + + b.HasKey("Id"); + + b.ToTable("dungeon_objects"); + }); + + modelBuilder.Entity("DataServer.Data.Entities.DungeonPalette", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property("Id")); + + b.Property("AllowedBucketIdsJson") + .HasColumnType("json"); + + b.Property("Biome") + .HasMaxLength(32) + .HasColumnType("varchar(32)"); + + b.Property("ContainerDensity") + .HasColumnType("int"); + + b.Property("ContainerIdsJson") + .HasColumnType("json"); + + b.Property("CreatedAt") + .HasColumnType("datetime(6)"); + + b.Property("DecorationDensity") + .HasColumnType("int"); + + b.Property("DecorationIdsJson") + .HasColumnType("json"); + + b.Property("Description") + .HasMaxLength(256) + .HasColumnType("varchar(256)"); + + b.Property("DoorTemplateIdsJson") + .HasColumnType("json"); + + b.Property("EnforceBiomeBuckets") + .HasColumnType("tinyint(1)"); + + b.Property("FloorTemplateIdsJson") + .HasColumnType("json"); + + b.Property("IsEnabled") + .HasColumnType("tinyint(1)"); + + b.Property("MaxCorridorWidth") + .HasColumnType("int"); + + b.Property("MaxRoomHeight") + .HasColumnType("int"); + + b.Property("MaxRoomWidth") + .HasColumnType("int"); + + b.Property("MaxRooms") + .HasColumnType("int"); + + b.Property("MinCorridorWidth") + .HasColumnType("int"); + + b.Property("MinRoomHeight") + .HasColumnType("int"); + + b.Property("MinRoomWidth") + .HasColumnType("int"); + + b.Property("MinRooms") + .HasColumnType("int"); + + b.Property("Name") + .IsRequired() + .HasMaxLength(64) + .HasColumnType("varchar(64)"); + + b.Property("RoomTemplateIdsJson") + .HasColumnType("json"); + + b.Property("Tags") + .HasMaxLength(256) + .HasColumnType("varchar(256)"); + + b.Property("TrapDensity") + .HasColumnType("int"); + + b.Property("TrapIdsJson") + .HasColumnType("json"); + + b.Property("UpdatedAt") + .HasColumnType("datetime(6)"); + + b.Property("WallTemplateIdsJson") + .HasColumnType("json"); + + b.HasKey("Id"); + + b.ToTable("dungeon_palettes"); + }); + + modelBuilder.Entity("DataServer.Data.Entities.DungeonPersistence", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("BossKilled") + .HasColumnType("tinyint(1)"); + + b.Property("ChestStateJson") + .HasColumnType("json"); + + b.Property("CreatedAt") + .HasColumnType("datetime(6)"); + + b.Property("CreatorCharacterId") + .HasColumnType("bigint unsigned"); + + b.Property("CreatorId") + .HasColumnType("bigint unsigned"); + + b.Property("CreatorLevel") + .HasColumnType("int"); + + b.Property("CreatorName") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("IsCleared") + .HasColumnType("tinyint(1)"); + + b.Property("LastActivity") + .HasColumnType("datetime(6)"); + + b.Property("LevelBracketMax") + .HasColumnType("int"); + + b.Property("LevelBracketMin") + .HasColumnType("int"); + + b.Property("LootChestStateJson") + .HasColumnType("json"); + + b.Property("MobStateJson") + .HasColumnType("json"); + + b.Property("PersistedAt") + .HasColumnType("datetime(6)"); + + b.Property("Seed") + .HasColumnType("int"); + + b.Property("Tier") + .HasColumnType("int"); + + b.HasKey("Id"); + + b.HasIndex("CreatorId"); + + b.ToTable("dungeon_instances"); + }); + + modelBuilder.Entity("DataServer.Data.Entities.DungeonQuiverAmmoSlot", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("bigint unsigned"); + + MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property("Id")); + + b.Property("ItemDefinitionId") + .HasColumnType("int"); + + b.Property("MaxQuantity") + .HasColumnType("int"); + + b.Property("Quantity") + .HasColumnType("int"); + + b.Property("QuiverCharacterItemId") + .HasColumnType("bigint unsigned"); + + b.Property("QuiverItemId") + .HasColumnType("bigint unsigned"); + + b.Property("SlotIndex") + .HasColumnType("int"); + + b.HasKey("Id"); + + b.HasIndex("ItemDefinitionId"); + + b.HasIndex("QuiverItemId"); + + b.ToTable("dungeon_quiver_ammo_slots"); + }); + + modelBuilder.Entity("DataServer.Data.Entities.DungeonRecipeScroll", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property("Id")); + + b.Property("ItemDefinitionId") + .HasColumnType("int"); + + b.Property("RecipeId") + .HasColumnType("int"); + + b.HasKey("Id"); + + b.HasIndex("ItemDefinitionId"); + + b.HasIndex("RecipeId"); + + b.ToTable("dungeon_recipe_scrolls"); + }); + + modelBuilder.Entity("DataServer.Data.Entities.DungeonSpellDefinition", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property("Id")); + + b.Property("AreaOfEffect") + .HasColumnType("float"); + + b.Property("BaseDamage") + .HasColumnType("int"); + + b.Property("BaseHealing") + .HasColumnType("int"); + + b.Property("Cooldown") + .HasColumnType("float"); + + b.Property("Description") + .IsRequired() + .HasMaxLength(256) + .HasColumnType("varchar(256)"); + + b.Property("EffectColor") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("IsEnabled") + .HasColumnType("tinyint(1)"); + + b.Property("IsShield") + .HasColumnType("tinyint(1)"); + + b.Property("IsTeleport") + .HasColumnType("tinyint(1)"); + + b.Property("ManaCost") + .HasColumnType("int"); + + b.Property("Name") + .IsRequired() + .HasMaxLength(64) + .HasColumnType("varchar(64)"); + + b.Property("Range") + .HasColumnType("float"); + + b.Property("RequiredIntelligence") + .HasColumnType("int"); + + b.Property("RequiredLevel") + .HasColumnType("int"); + + b.Property("RequiredWisdom") + .HasColumnType("int"); + + b.Property("ShieldAmount") + .HasColumnType("int"); + + b.Property("SpriteId") + .HasColumnType("int"); + + b.Property("Type") + .HasColumnType("int"); + + b.HasKey("Id"); + + b.ToTable("dungeon_spell_definitions"); + }); + + modelBuilder.Entity("DataServer.Data.Entities.DungeonStashItem", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("bigint unsigned"); + + MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property("Id")); + + b.Property("CharacterId") + .HasColumnType("bigint unsigned"); + + b.Property("DefinitionId") + .HasColumnType("int"); + + b.Property("ItemDefinitionId") + .HasColumnType("int"); + + b.Property("Quantity") + .HasColumnType("int"); + + b.Property("SlotIndex") + .HasColumnType("int"); + + b.Property("StoredAt") + .HasColumnType("datetime(6)"); + + b.HasKey("Id"); + + b.HasIndex("CharacterId"); + + b.HasIndex("DefinitionId"); + + b.ToTable("dungeon_stash_items"); + }); + + modelBuilder.Entity("DataServer.Data.Entities.DungeonTemplate", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property("Id")); + + b.Property("CreatedAt") + .HasColumnType("datetime(6)"); + + b.Property("DefaultTileMapSheetId") + .HasColumnType("int"); + + b.Property("Description") + .HasMaxLength(512) + .HasColumnType("varchar(512)"); + + b.Property("GenerationParamsJson") + .HasColumnType("json"); + + b.Property("Height") + .HasColumnType("int"); + + b.Property("IsEnabled") + .HasColumnType("tinyint(1)"); + + b.Property("IsHandCrafted") + .HasColumnType("tinyint(1)"); + + b.Property("Name") + .IsRequired() + .HasMaxLength(64) + .HasColumnType("varchar(64)"); + + b.Property("RoomPlacementsJson") + .HasColumnType("json"); + + b.Property("Tags") + .HasMaxLength(256) + .HasColumnType("varchar(256)"); + + b.Property("Tier") + .HasColumnType("int"); + + b.Property("TileDataJson") + .HasColumnType("json"); + + b.Property("UpdatedAt") + .HasColumnType("datetime(6)"); + + b.Property("Width") + .HasColumnType("int"); + + b.HasKey("Id"); + + b.HasIndex("DefaultTileMapSheetId"); + + b.ToTable("dungeon_templates"); + }); + + modelBuilder.Entity("DataServer.Data.Entities.MobAbilityAnimationMapping", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property("Id")); + + b.Property("AbilityAssignmentId") + .HasColumnType("int"); + + b.Property("AnimationKey") + .IsRequired() + .HasMaxLength(64) + .HasColumnType("varchar(64)"); + + b.Property("DirectionSuffix") + .HasMaxLength(16) + .HasColumnType("varchar(16)"); + + b.HasKey("Id"); + + b.HasIndex("AbilityAssignmentId"); + + b.ToTable("mob_ability_animation_mappings"); + }); + + modelBuilder.Entity("DataServer.Data.Entities.MobAbilityAssignment", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property("Id")); + + b.Property("AbilityDefinitionId") + .HasColumnType("int"); + + b.Property("CooldownOverride") + .HasColumnType("float"); + + b.Property("DamageOverride") + .HasColumnType("int"); + + b.Property("IsEnabled") + .HasColumnType("tinyint(1)"); + + b.Property("MaxHpPercent") + .HasColumnType("float"); + + b.Property("MinHpPercent") + .HasColumnType("float"); + + b.Property("MobDefinitionId") + .HasColumnType("int"); + + b.Property("Phase") + .HasColumnType("int"); + + b.Property("PriorityOverride") + .HasColumnType("int"); + + b.HasKey("Id"); + + b.HasIndex("AbilityDefinitionId"); + + b.HasIndex("MobDefinitionId"); + + b.ToTable("dungeon_mob_ability_assignments"); + }); + + modelBuilder.Entity("DataServer.Data.Entities.MobAbilityDefinition", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property("Id")); + + b.Property("AbilityType") + .HasColumnType("int"); + + b.Property("AffectedStat") + .HasMaxLength(32) + .HasColumnType("varchar(32)"); + + b.Property("AnimationDuration") + .HasColumnType("float"); + + b.Property("AnimationKey") + .IsRequired() + .HasMaxLength(32) + .HasColumnType("varchar(32)"); + + b.Property("AoeRadius") + .HasColumnType("float"); + + b.Property("BaseDamage") + .HasColumnType("int"); + + b.Property("CastTime") + .HasColumnType("float"); + + b.Property("ConeAngle") + .HasColumnType("float"); + + b.Property("Cooldown") + .HasColumnType("float"); + + b.Property("CreatedAt") + .HasColumnType("datetime(6)"); + + b.Property("DamagePerTier") + .HasColumnType("float"); + + b.Property("DamageTypeKey") + .IsRequired() + .HasMaxLength(32) + .HasColumnType("varchar(32)"); + + b.Property("Description") + .IsRequired() + .HasMaxLength(256) + .HasColumnType("varchar(256)"); + + b.Property("DisplacementDistance") + .HasColumnType("float"); + + b.Property("DotDamagePerTick") + .HasColumnType("int"); + + b.Property("DotTickInterval") + .HasColumnType("float"); + + b.Property("EffectDuration") + .HasColumnType("float"); + + b.Property("HazardTintColor") + .IsRequired() + .HasMaxLength(16) + .HasColumnType("varchar(16)"); + + b.Property("HazardTintOpacity") + .HasColumnType("float"); + + b.Property("HpThresholdAbove") + .HasColumnType("float"); + + b.Property("HpThresholdBelow") + .HasColumnType("float"); + + b.Property("IsEnabled") + .HasColumnType("tinyint(1)"); + + b.Property("Key") + .IsRequired() + .HasMaxLength(64) + .HasColumnType("varchar(64)"); + + b.Property("ManaCost") + .HasColumnType("int"); + + b.Property("MinTargetsInRange") + .HasColumnType("int"); + + b.Property("Name") + .IsRequired() + .HasMaxLength(64) + .HasColumnType("varchar(64)"); + + b.Property("Priority") + .HasColumnType("int"); + + b.Property("ProjectileSpeed") + .HasColumnType("float"); + + b.Property("ProjectileSprite") + .HasMaxLength(256) + .HasColumnType("varchar(256)"); + + b.Property("Range") + .HasColumnType("float"); + + b.Property("SoundEffectKey") + .HasMaxLength(64) + .HasColumnType("varchar(64)"); + + b.Property("SpeedModifier") + .HasColumnType("float"); + + b.Property("StatModifier") + .HasColumnType("float"); + + b.Property("SummonCount") + .HasColumnType("int"); + + b.Property("SummonMobId") + .HasColumnType("int"); + + b.Property("Targeting") + .HasColumnType("int"); + + b.Property("UpdatedAt") + .HasColumnType("datetime(6)"); + + b.Property("VisualEffectKey") + .HasMaxLength(64) + .HasColumnType("varchar(64)"); + + b.HasKey("Id"); + + b.ToTable("dungeon_mob_abilities"); + }); + + modelBuilder.Entity("DataServer.Data.Entities.MobAnimationAssignment", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property("Id")); + + b.Property("AnimationDefinitionId") + .HasColumnType("int"); + + b.Property("IsEnabled") + .HasColumnType("tinyint(1)"); + + b.Property("MobDefinitionId") + .HasColumnType("int"); + + b.Property("OverrideKey") + .HasMaxLength(64) + .HasColumnType("varchar(64)"); + + b.Property("Priority") + .HasColumnType("int"); + + b.HasKey("Id"); + + b.HasIndex("AnimationDefinitionId"); + + b.HasIndex("MobDefinitionId"); + + b.ToTable("mob_animation_assignments"); + }); + + modelBuilder.Entity("DataServer.Data.Entities.MobAnimationDefinition", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property("Id")); + + b.Property("FlipX") + .HasColumnType("tinyint(1)"); + + b.Property("FlipY") + .HasColumnType("tinyint(1)"); + + b.Property("Fps") + .HasColumnType("float"); + + b.Property("FrameSequence") + .IsRequired() + .HasMaxLength(256) + .HasColumnType("varchar(256)"); + + b.Property("IsEnabled") + .HasColumnType("tinyint(1)"); + + b.Property("Key") + .IsRequired() + .HasMaxLength(64) + .HasColumnType("varchar(64)"); + + b.Property("Loop") + .HasColumnType("tinyint(1)"); + + b.Property("Name") + .HasMaxLength(64) + .HasColumnType("varchar(64)"); + + b.Property("SpriteSheetId") + .HasColumnType("int"); + + b.HasKey("Id"); + + b.HasIndex("SpriteSheetId"); + + b.ToTable("mob_animation_definitions"); + }); + + modelBuilder.Entity("DataServer.Data.Entities.MobSpriteSheet", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property("Id")); + + b.Property("CdnPath") + .IsRequired() + .HasMaxLength(256) + .HasColumnType("varchar(256)"); + + b.Property("CreatedAt") + .HasColumnType("datetime(6)"); + + b.Property("FrameHeight") + .HasColumnType("int"); + + b.Property("FrameWidth") + .HasColumnType("int"); + + b.Property("IsEnabled") + .HasColumnType("tinyint(1)"); + + b.Property("Name") + .IsRequired() + .HasMaxLength(64) + .HasColumnType("varchar(64)"); + + b.Property("SheetHeight") + .HasColumnType("int"); + + b.Property("SheetWidth") + .HasColumnType("int"); + + b.Property("UpdatedAt") + .HasColumnType("datetime(6)"); + + b.HasKey("Id"); + + b.ToTable("mob_sprite_sheets"); + }); + + modelBuilder.Entity("DataServer.Data.Entities.ObjectTemplate", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property("Id")); + + b.Property("AnimationFps") + .HasColumnType("float"); + + b.Property("AnimationFrameCount") + .HasColumnType("int"); + + b.Property("AnimationLoops") + .HasColumnType("tinyint(1)"); + + b.Property("AnimationStatesJson") + .HasColumnType("json"); + + b.Property("Biome") + .HasMaxLength(32) + .HasColumnType("varchar(32)"); + + b.Property("BlockedCellsJson") + .HasColumnType("json"); + + b.Property("BlocksLineOfSight") + .HasColumnType("tinyint(1)"); + + b.Property("BlocksMovement") + .HasColumnType("tinyint(1)"); + + b.Property("BlocksProjectiles") + .HasColumnType("tinyint(1)"); + + b.Property("CreatedAt") + .HasColumnType("datetime(6)"); + + b.Property("Damage") + .HasColumnType("int"); + + b.Property("DamageTypeKey") + .HasMaxLength(32) + .HasColumnType("varchar(32)"); + + b.Property("DefaultState") + .HasMaxLength(32) + .HasColumnType("varchar(32)"); + + b.Property("Description") + .HasMaxLength(256) + .HasColumnType("varchar(256)"); + + b.Property("DestroyedLootTableId") + .HasColumnType("int"); + + b.Property("DestroyedState") + .HasMaxLength(32) + .HasColumnType("varchar(32)"); + + b.Property("FrameIndex") + .HasColumnType("int"); + + b.Property("GoldAmount") + .HasColumnType("int"); + + b.Property("Health") + .HasColumnType("int"); + + b.Property("Height") + .HasColumnType("int"); + + b.Property("InteractionCooldown") + .HasColumnType("float"); + + b.Property("InteractionState") + .HasMaxLength(32) + .HasColumnType("varchar(32)"); + + b.Property("InteractionType") + .HasColumnType("int"); + + b.Property("IsAnimated") + .HasColumnType("tinyint(1)"); + + b.Property("IsDestructible") + .HasColumnType("tinyint(1)"); + + b.Property("IsEnabled") + .HasColumnType("tinyint(1)"); + + b.Property("IsInteractable") + .HasColumnType("tinyint(1)"); + + b.Property("LootTableId") + .HasColumnType("int"); + + b.Property("MaxPerRoom") + .HasColumnType("int"); + + b.Property("MaxTier") + .HasColumnType("int"); + + b.Property("MinTier") + .HasColumnType("int"); + + b.Property("Name") + .IsRequired() + .HasMaxLength(64) + .HasColumnType("varchar(64)"); + + b.Property("OffsetX") + .HasColumnType("int"); + + b.Property("OffsetY") + .HasColumnType("int"); + + b.Property("Placement") + .HasColumnType("int"); + + b.Property("RequiredItemId") + .HasColumnType("int"); + + b.Property("ResetTime") + .HasColumnType("float"); + + b.Property("SpritePath") + .HasMaxLength(256) + .HasColumnType("varchar(256)"); + + b.Property("SpriteSheetId") + .HasColumnType("int"); + + b.Property("Tags") + .HasMaxLength(256) + .HasColumnType("varchar(256)"); + + b.Property("TriggerDelay") + .HasColumnType("float"); + + b.Property("TriggeredByWalk") + .HasColumnType("tinyint(1)"); + + b.Property("Type") + .HasColumnType("int"); + + b.Property("UpdatedAt") + .HasColumnType("datetime(6)"); + + b.Property("Weight") + .HasColumnType("int"); + + b.Property("Width") + .HasColumnType("int"); + + b.Property("XpReward") + .HasColumnType("int"); + + b.Property("ZIndex") + .HasColumnType("int"); + + b.HasKey("Id"); + + b.HasIndex("SpriteSheetId"); + + b.ToTable("object_templates"); + }); + + modelBuilder.Entity("DataServer.Data.Entities.RoomTemplate", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property("Id")); + + b.Property("ConnectionPointsJson") + .HasColumnType("json"); + + b.Property("CreatedAt") + .HasColumnType("datetime(6)"); + + b.Property("Description") + .HasMaxLength(512) + .HasColumnType("varchar(512)"); + + b.Property("Height") + .HasColumnType("int"); + + b.Property("IsEnabled") + .HasColumnType("tinyint(1)"); + + b.Property("MaxTier") + .HasColumnType("int"); + + b.Property("MinTier") + .HasColumnType("int"); + + b.Property("Name") + .IsRequired() + .HasMaxLength(64) + .HasColumnType("varchar(64)"); + + b.Property("SpawnPointsJson") + .HasColumnType("json"); + + b.Property("Tags") + .HasMaxLength(256) + .HasColumnType("varchar(256)"); + + b.Property("TileDataJson") + .HasColumnType("json"); + + b.Property("Type") + .HasColumnType("int"); + + b.Property("UpdatedAt") + .HasColumnType("datetime(6)"); + + b.Property("Weight") + .HasColumnType("int"); + + b.Property("Width") + .HasColumnType("int"); + + b.HasKey("Id"); + + b.ToTable("room_templates"); + }); + + modelBuilder.Entity("DataServer.Data.Entities.SocketName", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property("Id")); + + b.Property("CreatedAt") + .HasColumnType("datetime(6)"); + + b.Property("Description") + .HasMaxLength(256) + .HasColumnType("varchar(256)"); + + b.Property("Name") + .IsRequired() + .HasMaxLength(64) + .HasColumnType("varchar(64)"); + + b.Property("UsageCount") + .HasColumnType("int"); + + b.HasKey("Id"); + + b.ToTable("socket_names"); + }); + + modelBuilder.Entity("DataServer.Data.Entities.TileBucket", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property("Id")); + + b.Property("BucketType") + .HasMaxLength(32) + .HasColumnType("varchar(32)"); + + b.Property("CreatedAt") + .HasColumnType("datetime(6)"); + + b.Property("Description") + .HasMaxLength(256) + .HasColumnType("varchar(256)"); + + b.Property("IsEnabled") + .HasColumnType("tinyint(1)"); + + b.Property("Name") + .IsRequired() + .HasMaxLength(64) + .HasColumnType("varchar(64)"); + + b.Property("UpdatedAt") + .HasColumnType("datetime(6)"); + + b.HasKey("Id"); + + b.ToTable("tile_buckets"); + }); + + modelBuilder.Entity("DataServer.Data.Entities.TileBucketRule", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property("Id")); + + b.Property("SourceBucketId") + .HasColumnType("int"); + + b.Property("TargetBucketId") + .HasColumnType("int"); + + b.Property("Weight") + .HasColumnType("float"); + + b.HasKey("Id"); + + b.HasIndex("SourceBucketId"); + + b.HasIndex("TargetBucketId"); + + b.ToTable("tile_bucket_rules"); + }); + + modelBuilder.Entity("DataServer.Data.Entities.TileDefinition", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property("Id")); + + b.Property("AnimationFps") + .HasColumnType("float"); + + b.Property("AnimationFrameCount") + .HasColumnType("int"); + + b.Property("Biome") + .HasMaxLength(32) + .HasColumnType("varchar(32)"); + + b.Property("BlocksLineOfSight") + .HasColumnType("tinyint(1)"); + + b.Property("BlocksProjectiles") + .HasColumnType("tinyint(1)"); + + b.Property("FrameIndex") + .HasColumnType("int"); + + b.Property("IsAnimated") + .HasColumnType("tinyint(1)"); + + b.Property("IsEnabled") + .HasColumnType("tinyint(1)"); + + b.Property("IsInteractable") + .HasColumnType("tinyint(1)"); + + b.Property("IsWalkable") + .HasColumnType("tinyint(1)"); + + b.Property("Name") + .HasMaxLength(64) + .HasColumnType("varchar(64)"); + + b.Property("RenderLayer") + .HasColumnType("int"); + + b.Property("SocketE") + .HasColumnType("int"); + + b.Property("SocketECustom") + .HasMaxLength(32) + .HasColumnType("varchar(32)"); + + b.Property("SocketN") + .HasColumnType("int"); + + b.Property("SocketNCustom") + .HasMaxLength(32) + .HasColumnType("varchar(32)"); + + b.Property("SocketS") + .HasColumnType("int"); + + b.Property("SocketSCustom") + .HasMaxLength(32) + .HasColumnType("varchar(32)"); + + b.Property("SocketW") + .HasColumnType("int"); + + b.Property("SocketWCustom") + .HasMaxLength(32) + .HasColumnType("varchar(32)"); + + b.Property("Tags") + .HasMaxLength(256) + .HasColumnType("varchar(256)"); + + b.Property("TileMapSheetId") + .HasColumnType("int"); + + b.Property("Type") + .HasColumnType("int"); + + b.Property("ZIndex") + .HasColumnType("int"); + + b.HasKey("Id"); + + b.HasIndex("TileMapSheetId"); + + b.ToTable("tile_definitions"); + }); + + modelBuilder.Entity("DataServer.Data.Entities.TileDefinitionBucket", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property("Id")); + + b.Property("TileBucketId") + .HasColumnType("int"); + + b.Property("TileDefinitionId") + .HasColumnType("int"); + + b.HasKey("Id"); + + b.HasIndex("TileBucketId"); + + b.HasIndex("TileDefinitionId"); + + b.ToTable("tile_definition_buckets"); + }); + + modelBuilder.Entity("DataServer.Data.Entities.TileMapSheet", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property("Id")); + + b.Property("CdnPath") + .IsRequired() + .HasMaxLength(256) + .HasColumnType("varchar(256)"); + + b.Property("CreatedAt") + .HasColumnType("datetime(6)"); + + b.Property("IsEnabled") + .HasColumnType("tinyint(1)"); + + b.Property("Name") + .IsRequired() + .HasMaxLength(64) + .HasColumnType("varchar(64)"); + + b.Property("SheetHeight") + .HasColumnType("int"); + + b.Property("SheetWidth") + .HasColumnType("int"); + + b.Property("Tags") + .HasMaxLength(256) + .HasColumnType("varchar(256)"); + + b.Property("TileHeight") + .HasColumnType("int"); + + b.Property("TileWidth") + .HasColumnType("int"); + + b.Property("UpdatedAt") + .HasColumnType("datetime(6)"); + + b.HasKey("Id"); + + b.ToTable("tilemap_sheets"); + }); + + modelBuilder.Entity("DataServer.Data.Entities.TileStamp", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property("Id")); + + b.Property("CreatedAt") + .HasColumnType("datetime(6)"); + + b.Property("Description") + .HasMaxLength(256) + .HasColumnType("varchar(256)"); + + b.Property("Height") + .HasColumnType("int"); + + b.Property("IsEnabled") + .HasColumnType("tinyint(1)"); + + b.Property("Name") + .IsRequired() + .HasMaxLength(64) + .HasColumnType("varchar(64)"); + + b.Property("TilesJson") + .HasColumnType("json"); + + b.Property("UpdatedAt") + .HasColumnType("datetime(6)"); + + b.Property("Width") + .HasColumnType("int"); + + b.HasKey("Id"); + + b.ToTable("tile_stamps"); + }); + + modelBuilder.Entity("DataServer.Data.Entities.TileTemplate", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property("Id")); + + b.Property("Biome") + .HasMaxLength(32) + .HasColumnType("varchar(32)"); + + b.Property("BlocksLineOfSight") + .HasColumnType("tinyint(1)"); + + b.Property("BlocksMovement") + .HasColumnType("tinyint(1)"); + + b.Property("BlocksProjectiles") + .HasColumnType("tinyint(1)"); + + b.Property("Category") + .HasColumnType("int"); + + b.Property("CreatedAt") + .HasColumnType("datetime(6)"); + + b.Property("Description") + .HasMaxLength(256) + .HasColumnType("varchar(256)"); + + b.Property("Height") + .HasColumnType("int"); + + b.Property("IsEnabled") + .HasColumnType("tinyint(1)"); + + b.Property("IsWalkable") + .HasColumnType("tinyint(1)"); + + b.Property("MaxTier") + .HasColumnType("int"); + + b.Property("MinTier") + .HasColumnType("int"); + + b.Property("Name") + .IsRequired() + .HasMaxLength(64) + .HasColumnType("varchar(64)"); + + b.Property("PrimaryTileDefinitionId") + .HasColumnType("int"); + + b.Property("SocketConfigJson") + .HasColumnType("json"); + + b.Property("SocketCustom") + .HasMaxLength(128) + .HasColumnType("varchar(128)"); + + b.Property("SocketE") + .HasColumnType("int"); + + b.Property("SocketN") + .HasColumnType("int"); + + b.Property("SocketS") + .HasColumnType("int"); + + b.Property("SocketW") + .HasColumnType("int"); + + b.Property("Tags") + .HasMaxLength(256) + .HasColumnType("varchar(256)"); + + b.Property("TilesJson") + .HasColumnType("json"); + + b.Property("UpdatedAt") + .HasColumnType("datetime(6)"); + + b.Property("Weight") + .HasColumnType("int"); + + b.Property("Width") + .HasColumnType("int"); + + b.HasKey("Id"); + + b.HasIndex("PrimaryTileDefinitionId"); + + b.ToTable("tile_templates"); + }); + + modelBuilder.Entity("DataServer.Data.Entities.WorldChunk", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("bigint"); + + MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property("Id")); + + b.Property("ChunkX") + .HasColumnType("int"); + + b.Property("ChunkY") + .HasColumnType("int"); + + b.Property("CreatedAt") + .HasColumnType("datetime(6)"); + + b.Property("UpdatedAt") + .HasColumnType("datetime(6)"); + + b.Property("Version") + .HasColumnType("bigint"); + + b.Property("WorldZoneId") + .HasColumnType("bigint"); + + b.HasKey("Id"); + + b.HasIndex("WorldZoneId", "ChunkX", "ChunkY") + .IsUnique(); + + b.ToTable("world_chunks"); + }); + + modelBuilder.Entity("DataServer.Data.Entities.WorldChunkMobSpawn", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("bigint"); + + MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property("Id")); + + b.Property("MetadataJson") + .HasMaxLength(1024) + .HasColumnType("varchar(1024)"); + + b.Property("MobDefinitionId") + .HasColumnType("int"); + + b.Property("RespawnSeconds") + .HasColumnType("float"); + + b.Property("Rotation") + .HasColumnType("int"); + + b.Property("SpawnCount") + .HasColumnType("int"); + + b.Property("TileX") + .HasColumnType("int"); + + b.Property("TileY") + .HasColumnType("int"); + + b.Property("WorldChunkId") + .HasColumnType("bigint"); + + b.HasKey("Id"); + + b.HasIndex("MobDefinitionId"); + + b.HasIndex("WorldChunkId", "TileX", "TileY", "MobDefinitionId"); + + b.ToTable("world_chunk_mob_spawns"); + }); + + modelBuilder.Entity("DataServer.Data.Entities.WorldChunkNpcSpawn", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("bigint"); + + MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property("Id")); + + b.Property("MetadataJson") + .HasMaxLength(1024) + .HasColumnType("varchar(1024)"); + + b.Property("NpcDefinitionId") + .HasColumnType("int"); + + b.Property("Rotation") + .HasColumnType("int"); + + b.Property("TileX") + .HasColumnType("int"); + + b.Property("TileY") + .HasColumnType("int"); + + b.Property("WorldChunkId") + .HasColumnType("bigint"); + + b.HasKey("Id"); + + b.HasIndex("NpcDefinitionId"); + + b.HasIndex("WorldChunkId", "TileX", "TileY", "NpcDefinitionId"); + + b.ToTable("world_chunk_npc_spawns"); + }); + + modelBuilder.Entity("DataServer.Data.Entities.WorldChunkObject", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("bigint"); + + MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property("Id")); + + b.Property("MetadataJson") + .HasMaxLength(1024) + .HasColumnType("varchar(1024)"); + + b.Property("ObjectDefinitionId") + .HasColumnType("int"); + + b.Property("Rotation") + .HasColumnType("int"); + + b.Property("TileX") + .HasColumnType("int"); + + b.Property("TileY") + .HasColumnType("int"); + + b.Property("WorldChunkId") + .HasColumnType("bigint"); + + b.HasKey("Id"); + + b.HasIndex("ObjectDefinitionId"); + + b.HasIndex("WorldChunkId", "TileX", "TileY", "ObjectDefinitionId"); + + b.ToTable("world_chunk_objects"); + }); + + modelBuilder.Entity("DataServer.Data.Entities.WorldChunkTile", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("bigint"); + + MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property("Id")); + + b.Property("FrameIndex") + .HasColumnType("int"); + + b.Property("IsInvisiblePaywall") + .HasColumnType("tinyint(1)"); + + b.Property("IsWalkable") + .HasColumnType("tinyint(1)"); + + b.Property("SheetId") + .HasColumnType("int"); + + b.Property("TileX") + .HasColumnType("int"); + + b.Property("TileY") + .HasColumnType("int"); + + b.Property("WorldChunkId") + .HasColumnType("bigint"); + + b.HasKey("Id"); + + b.HasIndex("WorldChunkId", "TileX", "TileY") + .IsUnique(); + + b.ToTable("world_chunk_tiles"); + }); + + modelBuilder.Entity("DataServer.Data.Entities.WorldRegion", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property("Id")); + + b.Property("ChunkHeightTiles") + .HasColumnType("int"); + + b.Property("ChunkWidthTiles") + .HasColumnType("int"); + + b.Property("ChunksPerZoneX") + .HasColumnType("int"); + + b.Property("ChunksPerZoneY") + .HasColumnType("int"); + + b.Property("CreatedAt") + .HasColumnType("datetime(6)"); + + b.Property("IsEnabled") + .HasColumnType("tinyint(1)"); + + b.Property("Name") + .IsRequired() + .HasMaxLength(64) + .HasColumnType("varchar(64)"); + + b.Property("UpdatedAt") + .HasColumnType("datetime(6)"); + + b.Property("ZonesPerRegionX") + .HasColumnType("int"); + + b.Property("ZonesPerRegionY") + .HasColumnType("int"); + + b.HasKey("Id"); + + b.HasIndex("Name") + .IsUnique(); + + b.ToTable("world_regions"); + }); + + modelBuilder.Entity("DataServer.Data.Entities.WorldZone", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("bigint"); + + MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property("Id")); + + b.Property("CreatedAt") + .HasColumnType("datetime(6)"); + + b.Property("IsEnabled") + .HasColumnType("tinyint(1)"); + + b.Property("IsPvpEnabled") + .HasColumnType("tinyint(1)"); + + b.Property("Name") + .IsRequired() + .HasMaxLength(64) + .HasColumnType("varchar(64)"); + + b.Property("RegionId") + .HasColumnType("int"); + + b.Property("UpdatedAt") + .HasColumnType("datetime(6)"); + + b.Property("ZoneX") + .HasColumnType("int"); + + b.Property("ZoneY") + .HasColumnType("int"); + + b.Property("ZoneZ") + .HasColumnType("int"); + + b.HasKey("Id"); + + b.HasIndex("RegionId", "ZoneX", "ZoneY", "ZoneZ") + .IsUnique(); + + b.ToTable("world_zones"); + }); + + modelBuilder.Entity("DataServer.Data.Session", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("bigint unsigned"); + + MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property("Id")); + + b.Property("AccountId") + .HasColumnType("bigint unsigned"); + + b.Property("CreatedAt") + .ValueGeneratedOnAdd() + .HasColumnType("datetime(6)") + .HasDefaultValueSql("CURRENT_TIMESTAMP(6)"); + + b.Property("CreatedIp") + .HasMaxLength(64) + .HasColumnType("varchar(64)"); + + b.Property("ExpiresAt") + .HasColumnType("datetime(6)"); + + b.Property("RevokedAt") + .HasColumnType("datetime(6)"); + + b.Property("TokenHash") + .IsRequired() + .HasMaxLength(128) + .HasColumnType("varchar(128)"); + + b.Property("UserAgent") + .HasMaxLength(256) + .HasColumnType("varchar(256)"); + + b.HasKey("Id"); + + b.HasIndex("AccountId"); + + b.HasIndex("TokenHash") + .IsUnique(); + + b.ToTable("sessions", (string)null); + }); + + modelBuilder.Entity("DataServer.Data.Zone", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("bigint unsigned"); + + MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property("Id")); + + b.Property("CreatedAt") + .ValueGeneratedOnAdd() + .HasColumnType("datetime(6)") + .HasDefaultValueSql("CURRENT_TIMESTAMP(6)"); + + b.Property("MaxX") + .HasColumnType("double"); + + b.Property("MaxY") + .HasColumnType("double"); + + b.Property("MaxZ") + .HasColumnType("double"); + + b.Property("MinX") + .HasColumnType("double"); + + b.Property("MinY") + .HasColumnType("double"); + + b.Property("MinZ") + .HasColumnType("double"); + + b.Property("Name") + .IsRequired() + .HasMaxLength(64) + .HasColumnType("varchar(64)"); + + b.Property("UpdatedAt") + .ValueGeneratedOnAddOrUpdate() + .HasColumnType("datetime(6)") + .HasDefaultValueSql("CURRENT_TIMESTAMP(6)"); + + MySqlPropertyBuilderExtensions.UseMySqlComputedColumn(b.Property("UpdatedAt")); + + b.HasKey("Id"); + + b.HasIndex("Name") + .IsUnique(); + + b.ToTable("zones", (string)null); + }); + + modelBuilder.Entity("DataServer.Data.Entities.DeathChest", b => + { + b.HasOne("DataServer.Data.Entities.DungeonCharacter", "OwnerCharacter") + .WithMany() + .HasForeignKey("OwnerCharacterId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("DataServer.Data.Entities.DungeonCharacter", "VictimCharacter") + .WithMany() + .HasForeignKey("VictimCharacterId"); + + b.Navigation("OwnerCharacter"); + + b.Navigation("VictimCharacter"); + }); + + modelBuilder.Entity("DataServer.Data.Entities.DeathChestItem", b => + { + b.HasOne("DataServer.Data.Entities.DeathChest", "DeathChest") + .WithMany("Items") + .HasForeignKey("DeathChestId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("DataServer.Data.Entities.DungeonItemDefinition", "ItemDefinition") + .WithMany() + .HasForeignKey("ItemDefinitionId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("DeathChest"); + + b.Navigation("ItemDefinition"); + }); + + modelBuilder.Entity("DataServer.Data.Entities.DungeonBeltItem", b => + { + b.HasOne("DataServer.Data.Entities.DungeonCharacter", "Character") + .WithMany() + .HasForeignKey("CharacterId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Character"); + }); + + modelBuilder.Entity("DataServer.Data.Entities.DungeonCharacter", b => + { + b.HasOne("DataServer.Data.Account", "Account") + .WithMany("Characters") + .HasForeignKey("AccountId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Account"); + }); + + modelBuilder.Entity("DataServer.Data.Entities.DungeonCharacterCraftingSkill", b => + { + b.HasOne("DataServer.Data.Entities.DungeonCharacter", "Character") + .WithMany("CraftingSkills") + .HasForeignKey("CharacterId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Character"); + }); + + modelBuilder.Entity("DataServer.Data.Entities.DungeonCharacterItem", b => + { + b.HasOne("DataServer.Data.Entities.DungeonCharacter", "Character") + .WithMany("Inventory") + .HasForeignKey("CharacterId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("DataServer.Data.Entities.DungeonCraftedItem", "CraftedItem") + .WithMany() + .HasForeignKey("CraftedItemId"); + + b.HasOne("DataServer.Data.Entities.DungeonItemDefinition", "ItemDefinition") + .WithMany() + .HasForeignKey("ItemDefinitionId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Character"); + + b.Navigation("CraftedItem"); + + b.Navigation("ItemDefinition"); + }); + + modelBuilder.Entity("DataServer.Data.Entities.DungeonCharacterItemCraftedLink", b => + { + b.HasOne("DataServer.Data.Entities.DungeonCharacterItem", "CharacterItem") + .WithMany() + .HasForeignKey("CharacterItemId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("DataServer.Data.Entities.DungeonCraftedItem", "CraftedItem") + .WithMany() + .HasForeignKey("CraftedItemId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("CharacterItem"); + + b.Navigation("CraftedItem"); + }); + + modelBuilder.Entity("DataServer.Data.Entities.DungeonCharacterKnownRecipe", b => + { + b.HasOne("DataServer.Data.Entities.DungeonCharacter", "Character") + .WithMany("KnownRecipes") + .HasForeignKey("CharacterId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("DataServer.Data.Entities.DungeonCraftingRecipe", "Recipe") + .WithMany() + .HasForeignKey("RecipeId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Character"); + + b.Navigation("Recipe"); + }); + + modelBuilder.Entity("DataServer.Data.Entities.DungeonCraftedItem", b => + { + b.HasOne("DataServer.Data.Entities.DungeonItemDefinition", "BaseItemDefinition") + .WithMany() + .HasForeignKey("BaseItemDefinitionId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("DataServer.Data.Entities.DungeonCharacter", "Crafter") + .WithMany() + .HasForeignKey("CrafterId"); + + b.HasOne("DataServer.Data.Entities.DungeonCraftingRecipe", "Recipe") + .WithMany() + .HasForeignKey("RecipeId"); + + b.Navigation("BaseItemDefinition"); + + b.Navigation("Crafter"); + + b.Navigation("Recipe"); + }); + + modelBuilder.Entity("DataServer.Data.Entities.DungeonCraftingRecipe", b => + { + b.HasOne("DataServer.Data.Entities.DungeonItemDefinition", "OutputItem") + .WithMany() + .HasForeignKey("OutputItemDefinitionId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("OutputItem"); + }); + + modelBuilder.Entity("DataServer.Data.Entities.DungeonCraftingRecipeIngredient", b => + { + b.HasOne("DataServer.Data.Entities.DungeonItemDefinition", "ItemDefinition") + .WithMany() + .HasForeignKey("ItemDefinitionId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("DataServer.Data.Entities.DungeonCraftingRecipe", "Recipe") + .WithMany("Ingredients") + .HasForeignKey("RecipeId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("ItemDefinition"); + + b.Navigation("Recipe"); + }); + + modelBuilder.Entity("DataServer.Data.Entities.DungeonLearnedSpell", b => + { + b.HasOne("DataServer.Data.Entities.DungeonCharacter", "Character") + .WithMany("LearnedSpells") + .HasForeignKey("CharacterId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("DataServer.Data.Entities.DungeonSpellDefinition", "Definition") + .WithMany() + .HasForeignKey("DefinitionId"); + + b.Navigation("Character"); + + b.Navigation("Definition"); + }); + + modelBuilder.Entity("DataServer.Data.Entities.DungeonLootTableEntry", b => + { + b.HasOne("DataServer.Data.Entities.DungeonItemDefinition", "ItemDefinition") + .WithMany() + .HasForeignKey("ItemDefinitionId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("DataServer.Data.Entities.DungeonLootTable", "LootTable") + .WithMany("Entries") + .HasForeignKey("LootTableId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("ItemDefinition"); + + b.Navigation("LootTable"); + }); + + modelBuilder.Entity("DataServer.Data.Entities.DungeonMobLootTable", b => + { + b.HasOne("DataServer.Data.Entities.DungeonLootTable", "LootTable") + .WithMany() + .HasForeignKey("LootTableId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("DataServer.Data.Entities.DungeonMobDefinition", "MobDefinition") + .WithMany() + .HasForeignKey("MobDefinitionId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("LootTable"); + + b.Navigation("MobDefinition"); + }); + + modelBuilder.Entity("DataServer.Data.Entities.DungeonNpcDefinition", b => + { + b.HasOne("DataServer.Data.Entities.DungeonNpcDialogTree", "DialogTree") + .WithMany() + .HasForeignKey("DialogTreeId"); + + b.HasOne("DataServer.Data.Entities.DungeonLootTable", "LootTable") + .WithMany() + .HasForeignKey("LootTableId"); + + b.HasOne("DataServer.Data.Entities.DungeonNpcShop", "Shop") + .WithMany() + .HasForeignKey("ShopId"); + + b.Navigation("DialogTree"); + + b.Navigation("LootTable"); + + b.Navigation("Shop"); + }); + + modelBuilder.Entity("DataServer.Data.Entities.DungeonNpcDialogNode", b => + { + b.HasOne("DataServer.Data.Entities.DungeonNpcDialogTree", "DialogTree") + .WithMany("Nodes") + .HasForeignKey("DialogTreeId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("DialogTree"); + }); + + modelBuilder.Entity("DataServer.Data.Entities.DungeonNpcDialogOption", b => + { + b.HasOne("DataServer.Data.Entities.DungeonNpcDialogNode", "Node") + .WithMany("Options") + .HasForeignKey("NodeId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Node"); + }); + + modelBuilder.Entity("DataServer.Data.Entities.DungeonNpcShopItem", b => + { + b.HasOne("DataServer.Data.Entities.DungeonItemDefinition", "ItemDefinition") + .WithMany() + .HasForeignKey("ItemDefinitionId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("DataServer.Data.Entities.DungeonNpcShop", "Shop") + .WithMany("Items") + .HasForeignKey("ShopId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("ItemDefinition"); + + b.Navigation("Shop"); + }); + + modelBuilder.Entity("DataServer.Data.Entities.DungeonPersistence", b => + { + b.HasOne("DataServer.Data.Entities.DungeonCharacter", "Creator") + .WithMany() + .HasForeignKey("CreatorId"); + + b.Navigation("Creator"); + }); + + modelBuilder.Entity("DataServer.Data.Entities.DungeonQuiverAmmoSlot", b => + { + b.HasOne("DataServer.Data.Entities.DungeonItemDefinition", "ItemDefinition") + .WithMany() + .HasForeignKey("ItemDefinitionId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("DataServer.Data.Entities.DungeonCharacterItem", "QuiverItem") + .WithMany() + .HasForeignKey("QuiverItemId"); + + b.Navigation("ItemDefinition"); + + b.Navigation("QuiverItem"); + }); + + modelBuilder.Entity("DataServer.Data.Entities.DungeonRecipeScroll", b => + { + b.HasOne("DataServer.Data.Entities.DungeonItemDefinition", "ItemDefinition") + .WithMany() + .HasForeignKey("ItemDefinitionId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("DataServer.Data.Entities.DungeonCraftingRecipe", "Recipe") + .WithMany() + .HasForeignKey("RecipeId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("ItemDefinition"); + + b.Navigation("Recipe"); + }); + + modelBuilder.Entity("DataServer.Data.Entities.DungeonStashItem", b => + { + b.HasOne("DataServer.Data.Entities.DungeonCharacter", "Character") + .WithMany("Stash") + .HasForeignKey("CharacterId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("DataServer.Data.Entities.DungeonItemDefinition", "Definition") + .WithMany() + .HasForeignKey("DefinitionId"); + + b.Navigation("Character"); + + b.Navigation("Definition"); + }); + + modelBuilder.Entity("DataServer.Data.Entities.DungeonTemplate", b => + { + b.HasOne("DataServer.Data.Entities.TileMapSheet", "DefaultTileMapSheet") + .WithMany() + .HasForeignKey("DefaultTileMapSheetId"); + + b.Navigation("DefaultTileMapSheet"); + }); + + modelBuilder.Entity("DataServer.Data.Entities.MobAbilityAnimationMapping", b => + { + b.HasOne("DataServer.Data.Entities.MobAbilityAssignment", "AbilityAssignment") + .WithMany() + .HasForeignKey("AbilityAssignmentId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("AbilityAssignment"); + }); + + modelBuilder.Entity("DataServer.Data.Entities.MobAbilityAssignment", b => + { + b.HasOne("DataServer.Data.Entities.MobAbilityDefinition", "AbilityDefinition") + .WithMany() + .HasForeignKey("AbilityDefinitionId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("DataServer.Data.Entities.DungeonMobDefinition", "MobDefinition") + .WithMany("AbilityAssignments") + .HasForeignKey("MobDefinitionId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("AbilityDefinition"); + + b.Navigation("MobDefinition"); + }); + + modelBuilder.Entity("DataServer.Data.Entities.MobAnimationAssignment", b => + { + b.HasOne("DataServer.Data.Entities.MobAnimationDefinition", "AnimationDefinition") + .WithMany() + .HasForeignKey("AnimationDefinitionId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("DataServer.Data.Entities.DungeonMobDefinition", "MobDefinition") + .WithMany() + .HasForeignKey("MobDefinitionId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("AnimationDefinition"); + + b.Navigation("MobDefinition"); + }); + + modelBuilder.Entity("DataServer.Data.Entities.MobAnimationDefinition", b => + { + b.HasOne("DataServer.Data.Entities.MobSpriteSheet", "SpriteSheet") + .WithMany("Animations") + .HasForeignKey("SpriteSheetId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("SpriteSheet"); + }); + + modelBuilder.Entity("DataServer.Data.Entities.ObjectTemplate", b => + { + b.HasOne("DataServer.Data.Entities.TileMapSheet", "SpriteSheet") + .WithMany() + .HasForeignKey("SpriteSheetId"); + + b.Navigation("SpriteSheet"); + }); + + modelBuilder.Entity("DataServer.Data.Entities.TileBucketRule", b => + { + b.HasOne("DataServer.Data.Entities.TileBucket", "SourceBucket") + .WithMany() + .HasForeignKey("SourceBucketId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("DataServer.Data.Entities.TileBucket", "TargetBucket") + .WithMany() + .HasForeignKey("TargetBucketId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("SourceBucket"); + + b.Navigation("TargetBucket"); + }); + + modelBuilder.Entity("DataServer.Data.Entities.TileDefinition", b => + { + b.HasOne("DataServer.Data.Entities.TileMapSheet", "TileMapSheet") + .WithMany("Tiles") + .HasForeignKey("TileMapSheetId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("TileMapSheet"); + }); + + modelBuilder.Entity("DataServer.Data.Entities.TileDefinitionBucket", b => + { + b.HasOne("DataServer.Data.Entities.TileBucket", "TileBucket") + .WithMany() + .HasForeignKey("TileBucketId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("DataServer.Data.Entities.TileDefinition", "TileDefinition") + .WithMany() + .HasForeignKey("TileDefinitionId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("TileBucket"); + + b.Navigation("TileDefinition"); + }); + + modelBuilder.Entity("DataServer.Data.Entities.TileTemplate", b => + { + b.HasOne("DataServer.Data.Entities.TileDefinition", "PrimaryTileDefinition") + .WithMany() + .HasForeignKey("PrimaryTileDefinitionId"); + + b.Navigation("PrimaryTileDefinition"); + }); + + modelBuilder.Entity("DataServer.Data.Entities.WorldChunk", b => + { + b.HasOne("DataServer.Data.Entities.WorldZone", "Zone") + .WithMany() + .HasForeignKey("WorldZoneId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Zone"); + }); + + modelBuilder.Entity("DataServer.Data.Entities.WorldChunkMobSpawn", b => + { + b.HasOne("DataServer.Data.Entities.DungeonMobDefinition", "MobDefinition") + .WithMany() + .HasForeignKey("MobDefinitionId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("DataServer.Data.Entities.WorldChunk", "Chunk") + .WithMany() + .HasForeignKey("WorldChunkId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Chunk"); + + b.Navigation("MobDefinition"); + }); + + modelBuilder.Entity("DataServer.Data.Entities.WorldChunkNpcSpawn", b => + { + b.HasOne("DataServer.Data.Entities.DungeonNpcDefinition", "NpcDefinition") + .WithMany() + .HasForeignKey("NpcDefinitionId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("DataServer.Data.Entities.WorldChunk", "Chunk") + .WithMany() + .HasForeignKey("WorldChunkId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Chunk"); + + b.Navigation("NpcDefinition"); + }); + + modelBuilder.Entity("DataServer.Data.Entities.WorldChunkObject", b => + { + b.HasOne("DataServer.Data.Entities.DungeonObjectDefinition", "ObjectDefinition") + .WithMany() + .HasForeignKey("ObjectDefinitionId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("DataServer.Data.Entities.WorldChunk", "Chunk") + .WithMany() + .HasForeignKey("WorldChunkId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Chunk"); + + b.Navigation("ObjectDefinition"); + }); + + modelBuilder.Entity("DataServer.Data.Entities.WorldChunkTile", b => + { + b.HasOne("DataServer.Data.Entities.WorldChunk", "Chunk") + .WithMany() + .HasForeignKey("WorldChunkId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Chunk"); + }); + + modelBuilder.Entity("DataServer.Data.Entities.WorldZone", b => + { + b.HasOne("DataServer.Data.Entities.WorldRegion", "Region") + .WithMany() + .HasForeignKey("RegionId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Region"); + }); + + modelBuilder.Entity("DataServer.Data.Session", b => + { + b.HasOne("DataServer.Data.Account", "Account") + .WithMany("Sessions") + .HasForeignKey("AccountId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Account"); + }); + + modelBuilder.Entity("DataServer.Data.Account", b => + { + b.Navigation("Characters"); + + b.Navigation("Sessions"); + }); + + modelBuilder.Entity("DataServer.Data.Entities.DeathChest", b => + { + b.Navigation("Items"); + }); + + modelBuilder.Entity("DataServer.Data.Entities.DungeonCharacter", b => + { + b.Navigation("CraftingSkills"); + + b.Navigation("Inventory"); + + b.Navigation("KnownRecipes"); + + b.Navigation("LearnedSpells"); + + b.Navigation("Stash"); + }); + + modelBuilder.Entity("DataServer.Data.Entities.DungeonCraftingRecipe", b => + { + b.Navigation("Ingredients"); + }); + + modelBuilder.Entity("DataServer.Data.Entities.DungeonLootTable", b => + { + b.Navigation("Entries"); + }); + + modelBuilder.Entity("DataServer.Data.Entities.DungeonMobDefinition", b => + { + b.Navigation("AbilityAssignments"); + }); + + modelBuilder.Entity("DataServer.Data.Entities.DungeonNpcDialogNode", b => + { + b.Navigation("Options"); + }); + + modelBuilder.Entity("DataServer.Data.Entities.DungeonNpcDialogTree", b => + { + b.Navigation("Nodes"); + }); + + modelBuilder.Entity("DataServer.Data.Entities.DungeonNpcShop", b => + { + b.Navigation("Items"); + }); + + modelBuilder.Entity("DataServer.Data.Entities.MobSpriteSheet", b => + { + b.Navigation("Animations"); + }); + + modelBuilder.Entity("DataServer.Data.Entities.TileMapSheet", b => + { + b.Navigation("Tiles"); + }); +#pragma warning restore 612, 618 + } + } +} diff --git a/Migrations/20260217172059_tableUpdatesForWorld.cs b/Migrations/20260217172059_tableUpdatesForWorld.cs new file mode 100644 index 0000000..2ad5cd8 --- /dev/null +++ b/Migrations/20260217172059_tableUpdatesForWorld.cs @@ -0,0 +1,72 @@ +using Microsoft.EntityFrameworkCore.Migrations; + +#nullable disable + +namespace SystemRevivalServer.Migrations +{ + /// + public partial class tableUpdatesForWorld : Migration + { + /// + protected override void Up(MigrationBuilder migrationBuilder) + { + migrationBuilder.AddColumn( + name: "IsPvpEnabled", + table: "world_zones", + type: "tinyint(1)", + nullable: false, + defaultValue: false); + + migrationBuilder.AddColumn( + name: "ZoneZ", + table: "world_zones", + type: "int", + nullable: false, + defaultValue: 0); + + migrationBuilder.AddColumn( + name: "WorldZoneZ", + table: "dungeon_characters", + type: "int", + nullable: true); + + // Drop old 3-column unique index before creating the new 4-column one + migrationBuilder.DropIndex( + name: "IX_world_zones_RegionId_ZoneX_ZoneY", + table: "world_zones"); + + migrationBuilder.CreateIndex( + name: "IX_world_zones_RegionId_ZoneX_ZoneY_ZoneZ", + table: "world_zones", + columns: new[] { "RegionId", "ZoneX", "ZoneY", "ZoneZ" }, + unique: true); + } + + /// + protected override void Down(MigrationBuilder migrationBuilder) + { + migrationBuilder.DropIndex( + name: "IX_world_zones_RegionId_ZoneX_ZoneY_ZoneZ", + table: "world_zones"); + + // Restore old 3-column unique index + migrationBuilder.CreateIndex( + name: "IX_world_zones_RegionId_ZoneX_ZoneY", + table: "world_zones", + columns: new[] { "RegionId", "ZoneX", "ZoneY" }, + unique: true); + + migrationBuilder.DropColumn( + name: "IsPvpEnabled", + table: "world_zones"); + + migrationBuilder.DropColumn( + name: "ZoneZ", + table: "world_zones"); + + migrationBuilder.DropColumn( + name: "WorldZoneZ", + table: "dungeon_characters"); + } + } +} diff --git a/Migrations/GameDbContextModelSnapshot.cs b/Migrations/GameDbContextModelSnapshot.cs index f4c1f91..d8bd9b7 100644 --- a/Migrations/GameDbContextModelSnapshot.cs +++ b/Migrations/GameDbContextModelSnapshot.cs @@ -516,6 +516,9 @@ namespace SystemRevivalServer.Migrations b.Property("WorldZoneY") .HasColumnType("int"); + b.Property("WorldZoneZ") + .HasColumnType("int"); + b.HasKey("Id"); b.HasIndex("AccountId"); @@ -3366,6 +3369,9 @@ namespace SystemRevivalServer.Migrations b.Property("IsEnabled") .HasColumnType("tinyint(1)"); + b.Property("IsPvpEnabled") + .HasColumnType("tinyint(1)"); + b.Property("Name") .IsRequired() .HasMaxLength(64) @@ -3383,9 +3389,12 @@ namespace SystemRevivalServer.Migrations b.Property("ZoneY") .HasColumnType("int"); + b.Property("ZoneZ") + .HasColumnType("int"); + b.HasKey("Id"); - b.HasIndex("RegionId", "ZoneX", "ZoneY") + b.HasIndex("RegionId", "ZoneX", "ZoneY", "ZoneZ") .IsUnique(); b.ToTable("world_zones");