Skip to content

Commit

Permalink
can edit reilcs basic
Browse files Browse the repository at this point in the history
Signed-off-by: Derek Smart <derek@grindaga.com>
  • Loading branch information
mcred committed Mar 5, 2019
1 parent b0128a4 commit d4bfe4b
Show file tree
Hide file tree
Showing 6 changed files with 309 additions and 14 deletions.
2 changes: 2 additions & 0 deletions src/main/kotlin/com/grindaga/crissaegrim/Crissaegrim.kt
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,8 @@ class Crissaegrim : App(){
stage.isFullScreen = false
stage.minWidth = WINDOW_WIDTH
stage.minHeight = WINDOW_HEIGHT
stage.maxHeight = WINDOW_HEIGHT
stage.maxWidth = WINDOW_WIDTH
}
}

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,105 @@
package com.grindaga.crissaegrim.controllers

import com.grindaga.crissaegrim.maps.RelicsMap
import com.grindaga.crissaegrim.model.RelicsScope
import com.grindaga.crissaegrim.objects.Slot
import tornadofx.*

class RelicsController: Controller() {
val relicsScope = RelicsScope()
val relicsMap = RelicsMap()
val relics = relicsScope.relics

init {
relics.soulOfBat.setValue(0)
relics.fireOfBat.setValue(0)
relics.echoOfBat.setValue(0)
relics.forceOfEcho.setValue(0)
relics.soulOfWolf.setValue(0)
relics.powerOfWolf.setValue(0)
relics.skillOfWolf.setValue(0)
relics.formOfMist.setValue(0)
relics.powerOfMist.setValue(0)
relics.gasCloud.setValue(0)
relics.cubeOfZoe.setValue(0)
relics.spiritOrb.setValue(0)
relics.gravityBoots.setValue(0)
relics.leapStone.setValue(0)
relics.holySymbol.setValue(0)
relics.faerieScroll.setValue(0)
relics.jewelOfOpen.setValue(0)
relics.mermanStatue.setValue(0)
relics.batCard.setValue(0)
relics.ghostCard.setValue(0)
relics.faerieCard.setValue(0)
relics.demonCard.setValue(0)
relics.swordCard.setValue(0)
relics.heartOfVlad.setValue(0)
relics.toothOfVlad.setValue(0)
relics.ribOfVlad.setValue(0)
relics.ringOfVlad.setValue(0)
relics.eyeOfVlad.setValue(0)
}

fun loadFromSlot(slot: Slot) {
relics.soulOfBat.setValue(slot.read(relicsMap.soulOfBat))
relics.fireOfBat.setValue(slot.read(relicsMap.fireOfBat))
relics.echoOfBat.setValue(slot.read(relicsMap.echoOfBat))
relics.forceOfEcho.setValue(slot.read(relicsMap.forceOfEcho))
relics.soulOfWolf.setValue(slot.read(relicsMap.soulOfWolf))
relics.powerOfWolf.setValue(slot.read(relicsMap.powerOfWolf))
relics.skillOfWolf.setValue(slot.read(relicsMap.skillOfWolf))
relics.formOfMist.setValue(slot.read(relicsMap.formOfMist))
relics.powerOfMist.setValue(slot.read(relicsMap.powerOfMist))
relics.gasCloud.setValue(slot.read(relicsMap.gasCloud))
relics.cubeOfZoe.setValue(slot.read(relicsMap.cubeOfZoe))
relics.spiritOrb.setValue(slot.read(relicsMap.spiritOrb))
relics.gravityBoots.setValue(slot.read(relicsMap.gravityBoots))
relics.leapStone.setValue(slot.read(relicsMap.leapStone))
relics.holySymbol.setValue(slot.read(relicsMap.holySymbol))
relics.faerieScroll.setValue(slot.read(relicsMap.faerieScroll))
relics.jewelOfOpen.setValue(slot.read(relicsMap.jewelOfOpen))
relics.mermanStatue.setValue(slot.read(relicsMap.mermanStatue))
relics.batCard.setValue(slot.read(relicsMap.batCard))
relics.ghostCard.setValue(slot.read(relicsMap.ghostCard))
relics.faerieCard.setValue(slot.read(relicsMap.faerieCard))
relics.demonCard.setValue(slot.read(relicsMap.demonCard))
relics.swordCard.setValue(slot.read(relicsMap.swordCard))
relics.heartOfVlad.setValue(slot.read(relicsMap.heartOfVlad))
relics.toothOfVlad.setValue(slot.read(relicsMap.toothOfVlad))
relics.ribOfVlad.setValue(slot.read(relicsMap.ribOfVlad))
relics.ringOfVlad.setValue(slot.read(relicsMap.ringOfVlad))
relics.eyeOfVlad.setValue(slot.read(relicsMap.eyeOfVlad))
}

fun writeToSlot(slot: Slot) {
slot.write(relicsMap.soulOfBat, relics.soulOfBat.value.toInt())
slot.write(relicsMap.fireOfBat, relics.fireOfBat.value.toInt())
slot.write(relicsMap.echoOfBat, relics.echoOfBat.value.toInt())
slot.write(relicsMap.forceOfEcho, relics.forceOfEcho.value.toInt())
slot.write(relicsMap.soulOfWolf, relics.soulOfWolf.value.toInt())
slot.write(relicsMap.powerOfWolf, relics.powerOfWolf.value.toInt())
slot.write(relicsMap.skillOfWolf, relics.skillOfWolf.value.toInt())
slot.write(relicsMap.formOfMist, relics.formOfMist.value.toInt())
slot.write(relicsMap.powerOfMist, relics.powerOfMist.value.toInt())
slot.write(relicsMap.gasCloud, relics.gasCloud.value.toInt())
slot.write(relicsMap.cubeOfZoe, relics.cubeOfZoe.value.toInt())
slot.write(relicsMap.spiritOrb, relics.spiritOrb.value.toInt())
slot.write(relicsMap.gravityBoots, relics.gravityBoots.value.toInt())
slot.write(relicsMap.leapStone, relics.leapStone.value.toInt())
slot.write(relicsMap.holySymbol, relics.holySymbol.value.toInt())
slot.write(relicsMap.faerieScroll, relics.faerieScroll.value.toInt())
slot.write(relicsMap.jewelOfOpen, relics.jewelOfOpen.value.toInt())
slot.write(relicsMap.mermanStatue, relics.mermanStatue.value.toInt())
slot.write(relicsMap.batCard, relics.batCard.value.toInt())
slot.write(relicsMap.ghostCard, relics.ghostCard.value.toInt())
slot.write(relicsMap.faerieCard, relics.faerieCard.value.toInt())
slot.write(relicsMap.demonCard, relics.demonCard.value.toInt())
slot.write(relicsMap.swordCard, relics.swordCard.value.toInt())
slot.write(relicsMap.heartOfVlad, relics.heartOfVlad.value.toInt())
slot.write(relicsMap.toothOfVlad, relics.toothOfVlad.value.toInt())
slot.write(relicsMap.ribOfVlad, relics.ribOfVlad.value.toInt())
slot.write(relicsMap.ringOfVlad, relics.ringOfVlad.value.toInt())
slot.write(relicsMap.eyeOfVlad, relics.eyeOfVlad.value.toInt())
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ package com.grindaga.crissaegrim.maps

import com.grindaga.crissaegrim.objects.Location

data class Relics(
data class RelicsMap(
val soulOfBat: Location = Location(0x238),
val fireOfBat: Location = Location(0x239),
val echoOfBat: Location = Location(0x23A),
Expand Down
128 changes: 128 additions & 0 deletions src/main/kotlin/com/grindaga/crissaegrim/model/RelicsModel.kt
Original file line number Diff line number Diff line change
@@ -0,0 +1,128 @@
package com.grindaga.crissaegrim.model

import javafx.beans.property.SimpleIntegerProperty
import tornadofx.*

class Relics (
soulOfBat: Int,
fireOfBat: Int,
echoOfBat: Int,
forceOfEcho: Int,
soulOfWolf: Int,
powerOfWolf: Int,
skillOfWolf: Int,
formOfMist: Int,
powerOfMist: Int,
gasCloud: Int,
cubeOfZoe: Int,
spiritOrb: Int,
gravityBoots: Int,
leapStone: Int,
holySymbol: Int,
faerieScroll: Int,
jewelOfOpen: Int,
mermanStatue: Int,
batCard: Int,
ghostCard: Int,
faerieCard: Int,
demonCard: Int,
swordCard: Int,
heartOfVlad: Int,
toothOfVlad: Int,
ribOfVlad: Int,
ringOfVlad: Int,
eyeOfVlad: Int
){
val soulOfBatProperty = SimpleIntegerProperty()
var soulOfBat by soulOfBatProperty
val fireOfBatProperty = SimpleIntegerProperty()
var fireOfBat by fireOfBatProperty
val echoOfBatProperty = SimpleIntegerProperty()
var echoOfBat by echoOfBatProperty
val forceOfEchoProperty = SimpleIntegerProperty()
var forceOfEcho by forceOfEchoProperty
val soulOfWolfProperty = SimpleIntegerProperty()
var soulOfWolf by soulOfWolfProperty
val powerOfWolfProperty = SimpleIntegerProperty()
var powerOfWolf by powerOfWolfProperty
val skillOfWolfProperty = SimpleIntegerProperty()
var skillOfWolf by skillOfWolfProperty
val formOfMistProperty = SimpleIntegerProperty()
var formOfMist by formOfMistProperty
val powerOfMistProperty = SimpleIntegerProperty()
var powerOfMist by powerOfMistProperty
val gasCloudProperty = SimpleIntegerProperty()
var gasCloud by gasCloudProperty
val cubeOfZoeProperty = SimpleIntegerProperty()
var cubeOfZoe by cubeOfZoeProperty
val spiritOrbProperty = SimpleIntegerProperty()
var spiritOrb by spiritOrbProperty
val gravityBootsProperty = SimpleIntegerProperty()
var gravityBoots by gravityBootsProperty
val leapStoneProperty = SimpleIntegerProperty()
var leapStone by leapStoneProperty
val holySymbolProperty = SimpleIntegerProperty()
var holySymbol by holySymbolProperty
val faerieScrollProperty = SimpleIntegerProperty()
var faerieScroll by faerieScrollProperty
val jewelOfOpenProperty = SimpleIntegerProperty()
var jewelOfOpen by jewelOfOpenProperty
val mermanStatueProperty = SimpleIntegerProperty()
var mermanStatue by mermanStatueProperty
val batCardProperty = SimpleIntegerProperty()
var batCard by batCardProperty
val ghostCardProperty = SimpleIntegerProperty()
var ghostCard by ghostCardProperty
val faerieCardProperty = SimpleIntegerProperty()
var faerieCard by faerieCardProperty
val demonCardProperty = SimpleIntegerProperty()
var demonCard by demonCardProperty
val swordCardProperty = SimpleIntegerProperty()
var swordCard by swordCardProperty
val heartOfVladProperty = SimpleIntegerProperty()
var heartOfVlad by heartOfVladProperty
val toothOfVladProperty = SimpleIntegerProperty()
var toothOfVlad by toothOfVladProperty
val ribOfVladProperty = SimpleIntegerProperty()
var ribOfVlad by ribOfVladProperty
val ringOfVladProperty = SimpleIntegerProperty()
var ringOfVlad by ringOfVladProperty
val eyeOfVladProperty = SimpleIntegerProperty()
var eyeOfVlad by eyeOfVladProperty

}

class RelicsModel(relics: Relics? = null) : ItemViewModel<Relics>(relics) {
val soulOfBat = bind(Relics::soulOfBatProperty)
val fireOfBat = bind(Relics::fireOfBatProperty)
val echoOfBat = bind(Relics::echoOfBatProperty)
val forceOfEcho = bind(Relics::forceOfEchoProperty)
val soulOfWolf = bind(Relics::soulOfWolfProperty)
val powerOfWolf = bind(Relics::powerOfWolfProperty)
val skillOfWolf = bind(Relics::skillOfWolfProperty)
val formOfMist = bind(Relics::formOfMistProperty)
val powerOfMist = bind(Relics::powerOfMistProperty)
val gasCloud = bind(Relics::gasCloudProperty)
val cubeOfZoe = bind(Relics::cubeOfZoeProperty)
val spiritOrb = bind(Relics::spiritOrbProperty)
val gravityBoots = bind(Relics::gravityBootsProperty)
val leapStone = bind(Relics::leapStoneProperty)
val holySymbol = bind(Relics::holySymbolProperty)
val faerieScroll = bind(Relics::faerieScrollProperty)
val jewelOfOpen = bind(Relics::jewelOfOpenProperty)
val mermanStatue = bind(Relics::mermanStatueProperty)
val batCard = bind(Relics::batCardProperty)
val ghostCard = bind(Relics::ghostCardProperty)
val faerieCard = bind(Relics::faerieCardProperty)
val demonCard = bind(Relics::demonCardProperty)
val swordCard = bind(Relics::swordCardProperty)
val heartOfVlad = bind(Relics::heartOfVladProperty)
val toothOfVlad = bind(Relics::toothOfVladProperty)
val ribOfVlad = bind(Relics::ribOfVladProperty)
val ringOfVlad = bind(Relics::ringOfVladProperty)
val eyeOfVlad = bind(Relics::eyeOfVladProperty)
}

class RelicsScope : Scope() {
val relics = RelicsModel()
}
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package com.grindaga.crissaegrim.service

import com.grindaga.crissaegrim.controllers.MessageController
import com.grindaga.crissaegrim.controllers.RelicsController
import com.grindaga.crissaegrim.controllers.StatsController
import com.grindaga.crissaegrim.objects.Card
import javafx.stage.FileChooser
Expand All @@ -19,6 +20,7 @@ object FileService: Component() {
private val allFilter = FileChooser.ExtensionFilter("all files (*.*)", "*.*")

private val statsCtrl: StatsController by inject()
private val relicsCtrl: RelicsController by inject()
private val messageCtrl: MessageController by inject()
private var fileLocation: String = ""

Expand All @@ -34,6 +36,7 @@ object FileService: Component() {
val slot = card.slots[1]

statsCtrl.loadFromSlot(slot)
relicsCtrl.loadFromSlot(slot)

} catch (e: Exception) {
println(e)
Expand All @@ -47,6 +50,7 @@ object FileService: Component() {
val slot = card.slots[1]

statsCtrl.writeToSlot(slot)
relicsCtrl.writeToSlot(slot)

/*
val file: File = when (targetFile) {
Expand Down
82 changes: 69 additions & 13 deletions src/main/kotlin/com/grindaga/crissaegrim/views/StatsView.kt
Original file line number Diff line number Diff line change
@@ -1,26 +1,82 @@
package com.grindaga.crissaegrim.views

import com.grindaga.crissaegrim.controllers.RelicsController
import com.grindaga.crissaegrim.controllers.StatsController
import com.grindaga.crissaegrim.model.Relics
import tornadofx.*

class StatsView : View("My View") {
private val statsCtrl: StatsController by inject()
private val stats = statsCtrl.stats
private val relicsCtrl: RelicsController by inject()
private val relics = relicsCtrl.relics

override val root = tabpane {
useMaxWidth = true

tab("Stats") {
isClosable = false
tabMinWidth= 800.0/3

form {
fieldset("Character Stats") {
field("HP") { textfield ( stats.HP ) }
field("HPMax") { textfield ( stats.HPMax ) }
field("Hearts") { textfield ( stats.Hearts ) }
field("HeartsMax") { textfield ( stats.HeartsMax ) }
field("MP") { textfield ( stats.MP ) }
field("MPMax") { textfield ( stats.MPMax ) }
field("STR") { textfield ( stats.STR ) }
field("CON") { textfield ( stats.CON ) }
field("INT") { textfield ( stats.INT ) }
field("LCK") { textfield ( stats.LCK ) }
field("ATTBonus") { textfield ( stats.ATTBonus ) }
}
}
}
tab("Equipment") {
isClosable = false
tabMinWidth= 800.0/3

override val root = form {
fieldset("Character Stats") {
field("HP") { textfield ( stats.HP ) }
field("HPMax") { textfield ( stats.HPMax ) }
field("Hearts") { textfield ( stats.Hearts ) }
field("HeartsMax") { textfield ( stats.HeartsMax ) }
field("MP") { textfield ( stats.MP ) }
field("MPMax") { textfield ( stats.MPMax ) }
field("STR") { textfield ( stats.STR ) }
field("CON") { textfield ( stats.CON ) }
field("INT") { textfield ( stats.INT ) }
field("LCK") { textfield ( stats.LCK ) }
field("ATTBonus") { textfield ( stats.ATTBonus ) }
}
tab("Relics") {
isClosable = false
tabMinWidth= 800.0/3

form {
fieldset("Relics") {
field("soulOfBat") {textfield (relics.soulOfBat) }
field("fireOfBat") {textfield (relics.fireOfBat) }
field("echoOfBat") {textfield (relics.echoOfBat) }
field("forceOfEcho") {textfield (relics.forceOfEcho) }
field("soulOfWolf") {textfield (relics.soulOfWolf) }
field("powerOfWolf") {textfield (relics.powerOfWolf) }
field("skillOfWolf") {textfield (relics.skillOfWolf) }
field("formOfMist") {textfield (relics.formOfMist) }
field("powerOfMist") {textfield (relics.powerOfMist) }
field("gasCloud") {textfield (relics.gasCloud) }
field("cubeOfZoe") {textfield (relics.cubeOfZoe) }
field("spiritOrb") {textfield (relics.spiritOrb) }
field("gravityBoots") {textfield (relics.gravityBoots) }
field("leapStone") {textfield (relics.leapStone) }
field("holySymbol") {textfield (relics.holySymbol) }
field("faerieScroll") {textfield (relics.faerieScroll) }
field("jewelOfOpen") {textfield (relics.jewelOfOpen) }
field("mermanStatue") {textfield (relics.mermanStatue) }
field("batCard") {textfield (relics.batCard) }
field("ghostCard") {textfield (relics.ghostCard) }
field("faerieCard") {textfield (relics.faerieCard) }
field("demonCard") {textfield (relics.demonCard) }
field("swordCard") {textfield (relics.swordCard) }
field("heartOfVlad") {textfield (relics.heartOfVlad) }
field("toothOfVlad") {textfield (relics.toothOfVlad) }
field("ribOfVlad") {textfield (relics.ribOfVlad) }
field("ringOfVlad") {textfield (relics.ringOfVlad) }
field("eyeOfVlad") {textfield (relics.eyeOfVlad) }
}
}
}

}
}

Expand Down

0 comments on commit d4bfe4b

Please sign in to comment.