= Legends of the Balkans - Database Documentation = == Entity Relationship Diagram == [[Image(lotb_erdiagram.png)]] == Data Requirements == === Entities === Below are the core entities in the database, their descriptions, and attributes: - **Player**: Represents a game user with login credentials. - `PlayerID` (Primary Key) - `Username` - `Password` - `Email` - **Character**: A player-controlled entity in the game. - `CharacterID` (Primary Key) - `PlayerID` (Foreign Key → Player) - `Name` - `Health` - `EXP` - `Gold` - **Faction**: Represents a faction that characters can join. - `FactionID` (Primary Key) - `Name` - `Description` - **Reputation**: Tracks character reputation with different factions. - `CharacterID` (Foreign Key → Character) - `FactionID` (Foreign Key → Faction) - `ReputationPoints` - `Rank` - **Quest**: Missions that characters can complete. - `QuestID` (Primary Key) - `Name` - `EXP_Required` - `EXP_Reward` - `Gold_Reward` - **Item**: Objects that characters can own, craft, or trade. - `ItemID` (Primary Key) - `Name` - `Type` - `Rarity` - `Craftable` - **Enemy**: Represents hostile NPCs in the game. - `EnemyID` (Primary Key) - `Name` - `Health` - `Damage` - `LootDrop` - **Trader**: NPC merchants selling items. - `TraderID` (Primary Key) - `Name` - `Type` - **Market**: A system where players can list and sell items. - `MarketID` (Primary Key) - `ItemID` (Foreign Key → Item) - `SellerID` (Foreign Key → Player) - `Price` - **Guild**: Player-created groups for collaboration. - `GuildID` (Primary Key) - `Name` - `LeaderID` (Foreign Key → Player) == Relations == === 1-1 Relations === - `Guild.LeaderID` → `Player.PlayerID`: A guild has a single leader, who is a player. === 1-N Relations === - `Character.PlayerID` → `Player.PlayerID`: A player can have multiple characters. - `Character.FactionID` → `Faction.FactionID`: A character belongs to one faction. - `Market.SellerID` → `Player.PlayerID`: A player can list multiple items on the market. === N-N Relations === - `ReputationIn(CharacterID, FactionID, ReputationPoints, Rank)`: A character can have reputation with multiple factions, and factions can have multiple characters. This relation tracks the `ReputationPoints` and `Rank` for each character faction pair. - `Completes(CharacterID, QuestID)`: A character can accept multiple quests, and quests can be taken by multiple characters. - `Owns(CharacterID, ItemID, Quantity)`: A character can own multiple items, and items can belong to multiple characters. - `Drops(EnemyID, ItemID, Quantity)`: Enemies can drop multiple items, and items can be dropped by multiple enemies. - `Sells(TraderID, ItemID, Quantity)`: Traders can sell multiple items, and items can be sold by multiple traders. - `IsMember(CharacterID, GuildID, Role)`: A character can join a guild, and a guild can have multiple members. The `Role` attribute defines if the character is a "Leader" or "Member" in the guild.