Added new tokens and database upgrade
@ -23,6 +23,7 @@ function Tokens({ onCreateMapTokenState, tokens }) {
|
||||
onCreateMapTokenState({
|
||||
id: shortid.generate(),
|
||||
tokenId: token.id,
|
||||
type: token.type,
|
||||
owner: userId,
|
||||
size: tokenSize,
|
||||
label: "",
|
||||
|
@ -26,6 +26,68 @@ function loadVersions(db) {
|
||||
map.file = mapBuffers[map.id];
|
||||
});
|
||||
});
|
||||
// v1.3.0 - Added new default tokens
|
||||
db.version(3)
|
||||
.stores({})
|
||||
.upgrade((tx) => {
|
||||
return tx
|
||||
.table("states")
|
||||
.toCollection()
|
||||
.modify((state) => {
|
||||
function mapTokenId(id) {
|
||||
switch (id) {
|
||||
case "__default-Axes":
|
||||
return "__default-barbarian";
|
||||
case "__default-Bird":
|
||||
return "__default-druid";
|
||||
case "__default-Book":
|
||||
return "__default-wizard";
|
||||
case "__default-Crown":
|
||||
return "__default-humanoid";
|
||||
case "__default-Dragon":
|
||||
return "__default-dragon";
|
||||
case "__default-Eye":
|
||||
return "__default-warlock";
|
||||
case "__default-Fist":
|
||||
return "__default-monk";
|
||||
case "__default-Horse":
|
||||
return "__default-fey";
|
||||
case "__default-Leaf":
|
||||
return "__default-druid";
|
||||
case "__default-Lion":
|
||||
return "__default-monstrosity";
|
||||
case "__default-Money":
|
||||
return "__default-humanoid";
|
||||
case "__default-Moon":
|
||||
return "__default-cleric";
|
||||
case "__default-Potion":
|
||||
return "__default-sorcerer";
|
||||
case "__default-Shield":
|
||||
return "__default-paladin";
|
||||
case "__default-Skull":
|
||||
return "__default-undead";
|
||||
case "__default-Snake":
|
||||
return "__default-beast";
|
||||
case "__default-Sun":
|
||||
return "__default-cleric";
|
||||
case "__default-Swords":
|
||||
return "__default-fighter";
|
||||
case "__default-Tree":
|
||||
return "__default-plant";
|
||||
case "__default-Triangle":
|
||||
return "__default-sorcerer";
|
||||
default:
|
||||
return "__default-fighter";
|
||||
}
|
||||
}
|
||||
for (let stateId in state.tokens) {
|
||||
state.tokens[stateId].tokenId = mapTokenId(
|
||||
state.tokens[stateId].tokenId
|
||||
);
|
||||
state.tokens[stateId].type = "default";
|
||||
}
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
// Get the dexie database used in DatabaseContext
|
||||
|
@ -450,7 +450,7 @@ function Game() {
|
||||
for (let defaultToken of defaultTokens) {
|
||||
defaultTokensWithIds.push({
|
||||
...defaultToken,
|
||||
id: `__default-${defaultToken.name}`,
|
||||
id: `__default-${defaultToken.key}`,
|
||||
owner: userId,
|
||||
});
|
||||
}
|
||||
|
BIN
src/tokens/Aberration.png
Normal file
After Width: | Height: | Size: 74 KiB |
BIN
src/tokens/Artificer.png
Normal file
After Width: | Height: | Size: 73 KiB |
Before Width: | Height: | Size: 105 KiB |
BIN
src/tokens/Barbarian.png
Normal file
After Width: | Height: | Size: 75 KiB |
BIN
src/tokens/Bard.png
Normal file
After Width: | Height: | Size: 74 KiB |
BIN
src/tokens/Beast.png
Normal file
After Width: | Height: | Size: 85 KiB |
Before Width: | Height: | Size: 99 KiB |
BIN
src/tokens/Blood Hunter.png
Normal file
After Width: | Height: | Size: 79 KiB |
Before Width: | Height: | Size: 102 KiB |
BIN
src/tokens/Celestial.png
Normal file
After Width: | Height: | Size: 77 KiB |
BIN
src/tokens/Cleric.png
Normal file
After Width: | Height: | Size: 78 KiB |
BIN
src/tokens/Construct.png
Normal file
After Width: | Height: | Size: 74 KiB |
Before Width: | Height: | Size: 102 KiB |
Before Width: | Height: | Size: 104 KiB After Width: | Height: | Size: 86 KiB |
BIN
src/tokens/Druid.png
Normal file
After Width: | Height: | Size: 69 KiB |
BIN
src/tokens/Elemental.png
Normal file
After Width: | Height: | Size: 68 KiB |
Before Width: | Height: | Size: 105 KiB |
BIN
src/tokens/Fey.png
Normal file
After Width: | Height: | Size: 82 KiB |
BIN
src/tokens/Fiend.png
Normal file
After Width: | Height: | Size: 73 KiB |
BIN
src/tokens/Fighter.png
Normal file
After Width: | Height: | Size: 78 KiB |
Before Width: | Height: | Size: 105 KiB |
BIN
src/tokens/Giant.png
Normal file
After Width: | Height: | Size: 75 KiB |
BIN
src/tokens/Goblinoid.png
Normal file
After Width: | Height: | Size: 74 KiB |
Before Width: | Height: | Size: 102 KiB |
BIN
src/tokens/Humanoid.png
Normal file
After Width: | Height: | Size: 73 KiB |
Before Width: | Height: | Size: 107 KiB |
Before Width: | Height: | Size: 100 KiB |
Before Width: | Height: | Size: 103 KiB |
BIN
src/tokens/Monk.png
Normal file
After Width: | Height: | Size: 70 KiB |
BIN
src/tokens/Monstrosity.png
Normal file
After Width: | Height: | Size: 73 KiB |
Before Width: | Height: | Size: 96 KiB |
BIN
src/tokens/Ooze.png
Normal file
After Width: | Height: | Size: 69 KiB |
BIN
src/tokens/Paladin.png
Normal file
After Width: | Height: | Size: 74 KiB |
BIN
src/tokens/Plant.png
Normal file
After Width: | Height: | Size: 86 KiB |
Before Width: | Height: | Size: 96 KiB |
BIN
src/tokens/Ranger.png
Normal file
After Width: | Height: | Size: 81 KiB |
BIN
src/tokens/Rouge.png
Normal file
After Width: | Height: | Size: 77 KiB |
BIN
src/tokens/Shapechanger.png
Normal file
After Width: | Height: | Size: 73 KiB |
Before Width: | Height: | Size: 103 KiB |
Before Width: | Height: | Size: 106 KiB |
Before Width: | Height: | Size: 99 KiB |
BIN
src/tokens/Sorcerer.png
Normal file
After Width: | Height: | Size: 69 KiB |
Before Width: | Height: | Size: 114 KiB |
Before Width: | Height: | Size: 103 KiB |
BIN
src/tokens/Titan.png
Normal file
After Width: | Height: | Size: 78 KiB |
Before Width: | Height: | Size: 109 KiB |
Before Width: | Height: | Size: 98 KiB |
BIN
src/tokens/Undead.png
Normal file
After Width: | Height: | Size: 84 KiB |
BIN
src/tokens/Warlock.png
Normal file
After Width: | Height: | Size: 83 KiB |
BIN
src/tokens/Wizard.png
Normal file
After Width: | Height: | Size: 73 KiB |
@ -1,45 +1,67 @@
|
||||
import axes from "./Axes.png";
|
||||
import bird from "./Bird.png";
|
||||
import book from "./Book.png";
|
||||
import crown from "./Crown.png";
|
||||
import aberration from "./Aberration.png";
|
||||
import artificer from "./Artificer.png";
|
||||
import barbarian from "./Barbarian.png";
|
||||
import bard from "./Bard.png";
|
||||
import beast from "./Beast.png";
|
||||
import bloodHunter from "./Blood Hunter.png";
|
||||
import celestial from "./Celestial.png";
|
||||
import cleric from "./Cleric.png";
|
||||
import construct from "./Construct.png";
|
||||
import dragon from "./Dragon.png";
|
||||
import eye from "./Eye.png";
|
||||
import fist from "./Fist.png";
|
||||
import horse from "./Horse.png";
|
||||
import leaf from "./Leaf.png";
|
||||
import lion from "./Lion.png";
|
||||
import money from "./Money.png";
|
||||
import moon from "./Moon.png";
|
||||
import potion from "./Potion.png";
|
||||
import shield from "./Shield.png";
|
||||
import skull from "./Skull.png";
|
||||
import snake from "./Snake.png";
|
||||
import sun from "./Sun.png";
|
||||
import swords from "./Swords.png";
|
||||
import tree from "./Tree.png";
|
||||
import triangle from "./Triangle.png";
|
||||
import druid from "./Druid.png";
|
||||
import elemental from "./Elemental.png";
|
||||
import fey from "./Fey.png";
|
||||
import fiend from "./Fiend.png";
|
||||
import fighter from "./Fighter.png";
|
||||
import giant from "./Giant.png";
|
||||
import goblinoid from "./Goblinoid.png";
|
||||
import humanoid from "./Humanoid.png";
|
||||
import monk from "./Monk.png";
|
||||
import monstrosity from "./Monstrosity.png";
|
||||
import ooze from "./Ooze.png";
|
||||
import paladin from "./Paladin.png";
|
||||
import plant from "./Plant.png";
|
||||
import ranger from "./Ranger.png";
|
||||
import rouge from "./Rouge.png";
|
||||
import shapechanger from "./Shapechanger.png";
|
||||
import sorcerer from "./Sorcerer.png";
|
||||
import titan from "./Titan.png";
|
||||
import undead from "./Undead.png";
|
||||
import warlock from "./Warlock.png";
|
||||
import wizard from "./Wizard.png";
|
||||
|
||||
export const tokenSources = {
|
||||
axes,
|
||||
bird,
|
||||
book,
|
||||
crown,
|
||||
barbarian,
|
||||
bard,
|
||||
cleric,
|
||||
druid,
|
||||
fighter,
|
||||
monk,
|
||||
paladin,
|
||||
ranger,
|
||||
rouge,
|
||||
sorcerer,
|
||||
warlock,
|
||||
wizard,
|
||||
artificer,
|
||||
bloodHunter,
|
||||
aberration,
|
||||
beast,
|
||||
celestial,
|
||||
construct,
|
||||
dragon,
|
||||
eye,
|
||||
fist,
|
||||
horse,
|
||||
leaf,
|
||||
lion,
|
||||
money,
|
||||
moon,
|
||||
potion,
|
||||
shield,
|
||||
skull,
|
||||
snake,
|
||||
sun,
|
||||
swords,
|
||||
tree,
|
||||
triangle,
|
||||
elemental,
|
||||
fey,
|
||||
fiend,
|
||||
giant,
|
||||
goblinoid,
|
||||
humanoid,
|
||||
monstrosity,
|
||||
ooze,
|
||||
plant,
|
||||
shapechanger,
|
||||
titan,
|
||||
undead,
|
||||
};
|
||||
|
||||
export const tokens = Object.keys(tokenSources).map((key) => ({
|
||||
|