| 1 | = Legends of the Balkans - Database Documentation = |
| 2 | |
| 3 | == Entity Relationship Diagram == |
| 4 | [[Image(lotb_er.png)]] |
| 5 | |
| 6 | == Data Requirements == |
| 7 | |
| 8 | === Entities === |
| 9 | Below are the core entities in the database, their descriptions, and attributes: |
| 10 | |
| 11 | - **Player**: Represents a game user with login credentials. |
| 12 | - `PlayerID` (Primary Key) |
| 13 | - `Username` |
| 14 | - `Password` |
| 15 | - `Email` |
| 16 | |
| 17 | - **Character**: A player-controlled entity in the game. |
| 18 | - `CharacterID` (Primary Key) |
| 19 | - `PlayerID` (Foreign Key → Player) |
| 20 | - `Name` |
| 21 | - `Health` |
| 22 | - `EXP` |
| 23 | - `Gold` |
| 24 | |
| 25 | - **Faction**: Represents a faction that characters can join. |
| 26 | - `FactionID` (Primary Key) |
| 27 | - `Name` |
| 28 | - `Description` |
| 29 | |
| 30 | - **Reputation**: Tracks character reputation with different factions. |
| 31 | - `CharacterID` (Foreign Key → Character) |
| 32 | - `FactionID` (Foreign Key → Faction) |
| 33 | - `ReputationPoints` |
| 34 | - `Rank` |
| 35 | |
| 36 | - **Quest**: Missions that characters can complete. |
| 37 | - `QuestID` (Primary Key) |
| 38 | - `Name` |
| 39 | - `EXP_Required` |
| 40 | - `EXP_Reward` |
| 41 | - `Gold_Reward` |
| 42 | |
| 43 | - **Item**: Objects that characters can own, craft, or trade. |
| 44 | - `ItemID` (Primary Key) |
| 45 | - `Name` |
| 46 | - `Type` |
| 47 | - `Rarity` |
| 48 | - `Craftable` |
| 49 | |
| 50 | - **Enemy**: Represents hostile NPCs in the game. |
| 51 | - `EnemyID` (Primary Key) |
| 52 | - `Name` |
| 53 | - `Health` |
| 54 | - `Damage` |
| 55 | - `LootDrop` |
| 56 | |
| 57 | - **Trader**: NPC merchants selling items. |
| 58 | - `TraderID` (Primary Key) |
| 59 | - `Name` |
| 60 | - `Type` |
| 61 | |
| 62 | - **Market**: A system where players can list and sell items. |
| 63 | - `MarketID` (Primary Key) |
| 64 | - `ItemID` (Foreign Key → Item) |
| 65 | - `SellerID` (Foreign Key → Player) |
| 66 | - `Price` |
| 67 | |
| 68 | - **Guild**: Player-created groups for collaboration. |
| 69 | - `GuildID` (Primary Key) |
| 70 | - `Name` |
| 71 | - `LeaderID` (Foreign Key → Player) |
| 72 | |
| 73 | == Relations == |
| 74 | |
| 75 | === 1-1 Relations === |
| 76 | - `Guild.LeaderID` → `Player.PlayerID`: A guild has a single leader, who is a player. |
| 77 | |
| 78 | === 1-N Relations === |
| 79 | - `Character.PlayerID` → `Player.PlayerID`: A player can have multiple characters. |
| 80 | - `Character.FactionID` → `Faction.FactionID`: A character belongs to one faction. |
| 81 | - `Market.SellerID` → `Player.PlayerID`: A player can list multiple items on the market. |
| 82 | |
| 83 | === N-N Relations === |
| 84 | - `Reputation (CharacterID, FactionID)`: A character can have reputation with multiple factions, and factions can have multiple characters. |
| 85 | - `Character_Quest (CharacterID, QuestID)`: A character can accept multiple quests, and quests can be taken by multiple characters. |
| 86 | - `Character_Item (CharacterID, ItemID)`: A character can own multiple items, and items can belong to multiple characters. |
| 87 | - `Enemy_Item (EnemyID, ItemID)`: Enemies can drop multiple items, and items can be dropped by multiple enemies. |
| 88 | - `Trader_Item (TraderID, ItemID)`: Traders can sell multiple items, and items can be sold by multiple traders. |
| 89 | - `Character_Guild (CharacterID, GuildID)`: A character can join a guild, and a guild can have multiple members. |
| 90 | |
| 91 | ---- |