forked from andrecronje/rarity
-
Notifications
You must be signed in to change notification settings - Fork 0
/
codex.sol
100 lines (90 loc) · 2.74 KB
/
codex.sol
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
// SPDX-License-Identifier: MIT
pragma solidity 0.8.7;
contract codex {
string constant index = "Spells";
string constant class = "Wizard";
mapping(uint => mapping(uint => address)) public pages;
address public loremaster;
constructor() {
loremaster = msg.sender;
}
modifier lm() {
require(msg.sender == loremaster);
_;
}
function setLoremaster(address _loremaster) external lm {
loremaster = _loremaster;
}
function addPage(uint _school, uint _level, address _page) external lm {
pages[_school][_level] = _page;
}
function school(uint id) external pure returns (string memory description) {
if (id == 0) {
return "Abjuration";
} else if (id == 1) {
return "Conjuration";
} else if (id == 2) {
return "Divination";
} else if (id == 3) {
return "Enchantment";
} else if (id == 4) {
return "Evocation";
} else if (id == 5) {
return "Illusion";
} else if (id == 6) {
return "Necromancy";
} else if (id == 7) {
return "Transmutation";
} else if (id == 8) {
return "Universal";
}
}
function casting_time(uint id) external pure returns (string memory description) {
if (id == 0) {
return "1 free action";
} else if (id == 1) {
return "1 standard action";
} else if (id == 2) {
return "full-round action";
} else if (id == 3) {
return "10 full-round actions";
}
}
function range(uint id) external pure returns (string memory description) {
if (id == 0) {
return "Personal";
} else if (id == 1) {
return "Touch";
} else if (id == 2) {
return "Close";
} else if (id == 3) {
return "Medium";
} else if (id == 4) {
return "Long";
} else if (id == 5) {
return "Unlimited";
}
}
function saving_throw_type(uint id) external pure returns (string memory description) {
if (id == 0) {
return "None";
} else if (id == 1) {
return "Fortitude";
} else if (id == 2) {
return "Reflex";
} else if (id == 3) {
return "Will";
}
}
function saving_throw_effect(uint id) external pure returns (string memory description) {
if (id == 0) {
return "None";
} else if (id == 1) {
return "Partial";
} else if (id == 2) {
return "Half";
} else if (id == 3) {
return "Negates";
}
}
}