diff --git a/src/components/token/Tokens.js b/src/components/token/Tokens.js index 5fde471..e4ae82a 100644 --- a/src/components/token/Tokens.js +++ b/src/components/token/Tokens.js @@ -23,6 +23,7 @@ function Tokens({ onCreateMapTokenState, tokens }) { onCreateMapTokenState({ id: shortid.generate(), tokenId: token.id, + type: token.type, owner: userId, size: tokenSize, label: "", diff --git a/src/database.js b/src/database.js index 71851cb..27eded2 100644 --- a/src/database.js +++ b/src/database.js @@ -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 diff --git a/src/routes/Game.js b/src/routes/Game.js index f5d2c96..657eec0 100644 --- a/src/routes/Game.js +++ b/src/routes/Game.js @@ -450,7 +450,7 @@ function Game() { for (let defaultToken of defaultTokens) { defaultTokensWithIds.push({ ...defaultToken, - id: `__default-${defaultToken.name}`, + id: `__default-${defaultToken.key}`, owner: userId, }); } diff --git a/src/tokens/Aberration.png b/src/tokens/Aberration.png new file mode 100644 index 0000000..92dc768 Binary files /dev/null and b/src/tokens/Aberration.png differ diff --git a/src/tokens/Artificer.png b/src/tokens/Artificer.png new file mode 100644 index 0000000..964d149 Binary files /dev/null and b/src/tokens/Artificer.png differ diff --git a/src/tokens/Axes.png b/src/tokens/Axes.png deleted file mode 100644 index 7bd7f64..0000000 Binary files a/src/tokens/Axes.png and /dev/null differ diff --git a/src/tokens/Barbarian.png b/src/tokens/Barbarian.png new file mode 100644 index 0000000..d41bb88 Binary files /dev/null and b/src/tokens/Barbarian.png differ diff --git a/src/tokens/Bard.png b/src/tokens/Bard.png new file mode 100644 index 0000000..b4bd06f Binary files /dev/null and b/src/tokens/Bard.png differ diff --git a/src/tokens/Beast.png b/src/tokens/Beast.png new file mode 100644 index 0000000..9605182 Binary files /dev/null and b/src/tokens/Beast.png differ diff --git a/src/tokens/Bird.png b/src/tokens/Bird.png deleted file mode 100644 index 9473c7b..0000000 Binary files a/src/tokens/Bird.png and /dev/null differ diff --git a/src/tokens/Blood Hunter.png b/src/tokens/Blood Hunter.png new file mode 100644 index 0000000..ef9b640 Binary files /dev/null and b/src/tokens/Blood Hunter.png differ diff --git a/src/tokens/Book.png b/src/tokens/Book.png deleted file mode 100644 index 944a2c5..0000000 Binary files a/src/tokens/Book.png and /dev/null differ diff --git a/src/tokens/Celestial.png b/src/tokens/Celestial.png new file mode 100644 index 0000000..bcb5574 Binary files /dev/null and b/src/tokens/Celestial.png differ diff --git a/src/tokens/Cleric.png b/src/tokens/Cleric.png new file mode 100644 index 0000000..651cc74 Binary files /dev/null and b/src/tokens/Cleric.png differ diff --git a/src/tokens/Construct.png b/src/tokens/Construct.png new file mode 100644 index 0000000..52b0bdc Binary files /dev/null and b/src/tokens/Construct.png differ diff --git a/src/tokens/Crown.png b/src/tokens/Crown.png deleted file mode 100644 index 9158249..0000000 Binary files a/src/tokens/Crown.png and /dev/null differ diff --git a/src/tokens/Dragon.png b/src/tokens/Dragon.png index 2ec5e83..f4d6be0 100644 Binary files a/src/tokens/Dragon.png and b/src/tokens/Dragon.png differ diff --git a/src/tokens/Druid.png b/src/tokens/Druid.png new file mode 100644 index 0000000..80097f9 Binary files /dev/null and b/src/tokens/Druid.png differ diff --git a/src/tokens/Elemental.png b/src/tokens/Elemental.png new file mode 100644 index 0000000..c964c6f Binary files /dev/null and b/src/tokens/Elemental.png differ diff --git a/src/tokens/Eye.png b/src/tokens/Eye.png deleted file mode 100644 index 45219b0..0000000 Binary files a/src/tokens/Eye.png and /dev/null differ diff --git a/src/tokens/Fey.png b/src/tokens/Fey.png new file mode 100644 index 0000000..f877fe0 Binary files /dev/null and b/src/tokens/Fey.png differ diff --git a/src/tokens/Fiend.png b/src/tokens/Fiend.png new file mode 100644 index 0000000..eb051c6 Binary files /dev/null and b/src/tokens/Fiend.png differ diff --git a/src/tokens/Fighter.png b/src/tokens/Fighter.png new file mode 100644 index 0000000..38e0305 Binary files /dev/null and b/src/tokens/Fighter.png differ diff --git a/src/tokens/Fist.png b/src/tokens/Fist.png deleted file mode 100644 index 0a2abc9..0000000 Binary files a/src/tokens/Fist.png and /dev/null differ diff --git a/src/tokens/Giant.png b/src/tokens/Giant.png new file mode 100644 index 0000000..609be1d Binary files /dev/null and b/src/tokens/Giant.png differ diff --git a/src/tokens/Goblinoid.png b/src/tokens/Goblinoid.png new file mode 100644 index 0000000..494612d Binary files /dev/null and b/src/tokens/Goblinoid.png differ diff --git a/src/tokens/Horse.png b/src/tokens/Horse.png deleted file mode 100644 index b43e98f..0000000 Binary files a/src/tokens/Horse.png and /dev/null differ diff --git a/src/tokens/Humanoid.png b/src/tokens/Humanoid.png new file mode 100644 index 0000000..9129bfe Binary files /dev/null and b/src/tokens/Humanoid.png differ diff --git a/src/tokens/Leaf.png b/src/tokens/Leaf.png deleted file mode 100644 index 63b4ae0..0000000 Binary files a/src/tokens/Leaf.png and /dev/null differ diff --git a/src/tokens/Lion.png b/src/tokens/Lion.png deleted file mode 100644 index de3f2c1..0000000 Binary files a/src/tokens/Lion.png and /dev/null differ diff --git a/src/tokens/Money.png b/src/tokens/Money.png deleted file mode 100644 index c7fc359..0000000 Binary files a/src/tokens/Money.png and /dev/null differ diff --git a/src/tokens/Monk.png b/src/tokens/Monk.png new file mode 100644 index 0000000..a43c1ac Binary files /dev/null and b/src/tokens/Monk.png differ diff --git a/src/tokens/Monstrosity.png b/src/tokens/Monstrosity.png new file mode 100644 index 0000000..5a2730c Binary files /dev/null and b/src/tokens/Monstrosity.png differ diff --git a/src/tokens/Moon.png b/src/tokens/Moon.png deleted file mode 100644 index 91ee3a8..0000000 Binary files a/src/tokens/Moon.png and /dev/null differ diff --git a/src/tokens/Ooze.png b/src/tokens/Ooze.png new file mode 100644 index 0000000..e46afb8 Binary files /dev/null and b/src/tokens/Ooze.png differ diff --git a/src/tokens/Paladin.png b/src/tokens/Paladin.png new file mode 100644 index 0000000..c4ee7b1 Binary files /dev/null and b/src/tokens/Paladin.png differ diff --git a/src/tokens/Plant.png b/src/tokens/Plant.png new file mode 100644 index 0000000..d76fe79 Binary files /dev/null and b/src/tokens/Plant.png differ diff --git a/src/tokens/Potion.png b/src/tokens/Potion.png deleted file mode 100644 index 056dd28..0000000 Binary files a/src/tokens/Potion.png and /dev/null differ diff --git a/src/tokens/Ranger.png b/src/tokens/Ranger.png new file mode 100644 index 0000000..8851899 Binary files /dev/null and b/src/tokens/Ranger.png differ diff --git a/src/tokens/Rouge.png b/src/tokens/Rouge.png new file mode 100644 index 0000000..cbc8755 Binary files /dev/null and b/src/tokens/Rouge.png differ diff --git a/src/tokens/Shapechanger.png b/src/tokens/Shapechanger.png new file mode 100644 index 0000000..f31341e Binary files /dev/null and b/src/tokens/Shapechanger.png differ diff --git a/src/tokens/Shield.png b/src/tokens/Shield.png deleted file mode 100644 index e4eba5a..0000000 Binary files a/src/tokens/Shield.png and /dev/null differ diff --git a/src/tokens/Skull.png b/src/tokens/Skull.png deleted file mode 100644 index 3939468..0000000 Binary files a/src/tokens/Skull.png and /dev/null differ diff --git a/src/tokens/Snake.png b/src/tokens/Snake.png deleted file mode 100644 index 4a12bc8..0000000 Binary files a/src/tokens/Snake.png and /dev/null differ diff --git a/src/tokens/Sorcerer.png b/src/tokens/Sorcerer.png new file mode 100644 index 0000000..261789a Binary files /dev/null and b/src/tokens/Sorcerer.png differ diff --git a/src/tokens/Sun.png b/src/tokens/Sun.png deleted file mode 100644 index 093c458..0000000 Binary files a/src/tokens/Sun.png and /dev/null differ diff --git a/src/tokens/Swords.png b/src/tokens/Swords.png deleted file mode 100644 index 0483427..0000000 Binary files a/src/tokens/Swords.png and /dev/null differ diff --git a/src/tokens/Titan.png b/src/tokens/Titan.png new file mode 100644 index 0000000..cea6fb4 Binary files /dev/null and b/src/tokens/Titan.png differ diff --git a/src/tokens/Tree.png b/src/tokens/Tree.png deleted file mode 100644 index 20373a1..0000000 Binary files a/src/tokens/Tree.png and /dev/null differ diff --git a/src/tokens/Triangle.png b/src/tokens/Triangle.png deleted file mode 100644 index 753f889..0000000 Binary files a/src/tokens/Triangle.png and /dev/null differ diff --git a/src/tokens/Undead.png b/src/tokens/Undead.png new file mode 100644 index 0000000..3911c0d Binary files /dev/null and b/src/tokens/Undead.png differ diff --git a/src/tokens/Warlock.png b/src/tokens/Warlock.png new file mode 100644 index 0000000..11bf985 Binary files /dev/null and b/src/tokens/Warlock.png differ diff --git a/src/tokens/Wizard.png b/src/tokens/Wizard.png new file mode 100644 index 0000000..7ef896e Binary files /dev/null and b/src/tokens/Wizard.png differ diff --git a/src/tokens/index.js b/src/tokens/index.js index 1132688..c6a3a0f 100644 --- a/src/tokens/index.js +++ b/src/tokens/index.js @@ -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) => ({