Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
{
"typescript.tsdk": "node_modules/typescript/lib"
"typescript.tsdk": "node_modules/typescript/lib",
"solidity.compileUsingRemoteVersion": "latest"
}
2 changes: 2 additions & 0 deletions packages/contracts/constants.sol
Original file line number Diff line number Diff line change
Expand Up @@ -9,3 +9,5 @@ bytes14 constant WORLD_NAMESPACE = "UD";
string constant ERC721_NAME = "UDCharacters";
string constant ERC721_SYMBOL = "UDC";
string constant TOKEN_URI = "ipfs://";

uint256 constant DEFAULT_MAX_TURNS = 15;
75 changes: 73 additions & 2 deletions packages/contracts/mud.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,11 @@ export default defineWorld({
"Mage", // 2
],
RngRequestType: ["CharacterStats", "Combat", "WorldGeneration"],
ItemType: ["Weapon", "Armor", "Potion", "Scroll", "Material"],
ItemType: ["Weapon", "Armor", "Spell", "Potion", "Material", "QuestItem"],
MobType: ["Monster", "NPC"],
Alignment: ["Loyalist", "Neutral", "Rebel", "Aggro"],
EncounterType: ["PvP", "PvE"],
SkillType: ["PhysicalAttack", "MagicAttack", "StatusEffect"],
},
tables: {
/**
Expand All @@ -39,9 +43,38 @@ export default defineWorld({
agility: "uint256",
intelligence: "uint256",
hitPoints: "uint256",
damageTaken: "int256",
experience: "uint256",
},
},
MobStats: {
key: ["entityId"],
schema: {
entityId: "bytes32",
strength: "uint256",
agility: "uint256",
intelligence: "uint256",
hitPoints: "uint256",
damageTaken: "int256",
experience: "uint256",
},
},
Levels: {
key: ["level"],
schema: {
level: "uint256",
experience: "uint256",
},
},
CharacterEquipment: {
key: ["characterId"],
schema: {
characterId: "uint256",
equippedArmor: "uint256[]",
equippedWeapons: "uint256[]",
equippedSpells: "uint256[]",
},
},
Counters: {
schema: {
contractAddress: "address",
Expand All @@ -57,6 +90,15 @@ export default defineWorld({
},
key: ["itemId"],
},
Mobs: {
schema: {
mobId: "uint256",
mobType: "MobType",
mobStats: "bytes",
mobMetadata: "string",
},
key: ["mobId"],
},
StarterItems: {
key: ["class"],
schema: {
Expand All @@ -76,7 +118,36 @@ export default defineWorld({
value: "bool",
},
},

CombatEncounter: {
schema: {
//keccak hash of (attackers, defenders, encounterType, startTime)
encounterId: "bytes32",
encounterType: "EncounterType",
// the starting timestamp
start: "uint256",
// timestamp of when combat ended. 0 if ongoing.
end: "uint256",
// the current turn. starts at 0
currentTurn: "uint256",
// the max number of turns. default is 15 for pve
maxTurns: "uint256",
// array of monsterIds if pve playerIds if pvp
defenders: "bytes32[]",
// array of playerIds
attackers: "uint256[]",
},
key: ["encounterId"],
},
MobEntity: {
key: ["mobEntityId"],
schema: {
mobEntityId: "bytes32",
remainingHp: "int256",
// by default this is bytes(0), if this mob is in an encounter it will be set,
// if the mob survives its encounter this will be set back to bytes(0)
encounterId: "bytes32",
},
},
RandomNumbers: {
key: ["sequenceNumber"],
schema: {
Expand Down
Loading