Skip to content

Commit

Permalink
Merge pull request #21 from mcred/develop
Browse files Browse the repository at this point in the history
Character Weapon Forms
  • Loading branch information
mcred authored Feb 20, 2020
2 parents 23572f4 + a9edc74 commit 7e87fe7
Show file tree
Hide file tree
Showing 8 changed files with 84 additions and 56 deletions.
14 changes: 7 additions & 7 deletions internal/app/characters/Albert.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,12 @@ func Albert() Character { //TODO MAP
return Character{
ID: 05,
Name: "Albert",
XP: common.Attribute{0x5B0,4,true},
HP: common.Attribute{0x5B8,2,true},
Weapon: common.Attribute{0x5C4,1,false},
Helmet: common.Attribute{0x5C5,1,false},
Chest: common.Attribute{0x5C6,1,false},
Boots: common.Attribute{0x5C7,1,false},
Accessory: common.Attribute{0x5C8,1,false},
XP: common.Attribute{0x608,4,true},
HP: common.Attribute{0x610,2,true},
Weapon: common.Attribute{0x61C,1,false},
Helmet: common.Attribute{0x61D,1,false},
Chest: common.Attribute{0x61E,1,false},
Boots: common.Attribute{0x61F,1,false},
Accessory: common.Attribute{0x620,1,false},
}
}
17 changes: 12 additions & 5 deletions internal/app/characters/Character.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,16 +16,23 @@ type Character struct {
Accessory common.Attribute
}

func characters() []Character {
func GetCharacters() []Character {
return []Character {
Dart(), Shana(), Lavitz(), Rose(), Haschel(), Albert(),
Miranda(), Meru(), Kongol(),
Dart(), Shana(), Lavitz(), Rose(), Haschel(), Albert(), Miranda(), Meru(), Kongol(),
}
}

func GetCharacterNames() []string {
var r []string
for _, c := range GetCharacters() {
r = append(r, c.Name)
}
return r
}

func GetNameByID(i int) string {
r := ""
for _, c := range characters() {
for _, c := range GetCharacters() {
if i == c.ID {
r = c.Name
}
Expand All @@ -35,7 +42,7 @@ func GetNameByID(i int) string {

func GetIDByName(n string) int {
r := 0
for _, c := range characters() {
for _, c := range GetCharacters() {
if n == c.Name {
r = c.ID
}
Expand Down
14 changes: 7 additions & 7 deletions internal/app/characters/Haschel.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,12 @@ func Haschel() Character { //TODO MAP
return Character{
ID: 04,
Name: "Haschel",
XP: common.Attribute{0x5B0,4,true},
HP: common.Attribute{0x5B8,2,true},
Weapon: common.Attribute{0x5C4,1,false},
Helmet: common.Attribute{0x5C5,1,false},
Chest: common.Attribute{0x5C6,1,false},
Boots: common.Attribute{0x5C7,1,false},
Accessory: common.Attribute{0x5C8,1,false},
XP: common.Attribute{0x5DC,4,true},
HP: common.Attribute{0x5E4,2,true},
Weapon: common.Attribute{0x5F0,1,false},
Helmet: common.Attribute{0x5F1,1,false},
Chest: common.Attribute{0x5F2,1,false},
Boots: common.Attribute{0x5F3,1,false},
Accessory: common.Attribute{0x5F4,1,false},
}
}
14 changes: 7 additions & 7 deletions internal/app/characters/Kongol.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,12 @@ func Kongol() Character { //TODO map
return Character{
ID: 07,
Name: "Kongol",
XP: common.Attribute{0x5B0,4,true},
HP: common.Attribute{0x5B8,2,true},
Weapon: common.Attribute{0x5C4,1,false},
Helmet: common.Attribute{0x5C5,1,false},
Chest: common.Attribute{0x5C6,1,false},
Boots: common.Attribute{0x5C7,1,false},
Accessory: common.Attribute{0x5C8,1,false},
XP: common.Attribute{0x660,4,true},
HP: common.Attribute{0x668,2,true},
Weapon: common.Attribute{0x674,1,false},
Helmet: common.Attribute{0x675,1,false},
Chest: common.Attribute{0x676,1,false},
Boots: common.Attribute{0x677,1,false},
Accessory: common.Attribute{0x678,1,false},
}
}
14 changes: 7 additions & 7 deletions internal/app/characters/Meru.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,12 @@ func Meru() Character { //TODO map
return Character{
ID: 06,
Name: "Meru",
XP: common.Attribute{0x5B0,4,true},
HP: common.Attribute{0x5B8,2,true},
Weapon: common.Attribute{0x5C4,1,false},
Helmet: common.Attribute{0x5C5,1,false},
Chest: common.Attribute{0x5C6,1,false},
Boots: common.Attribute{0x5C7,1,false},
Accessory: common.Attribute{0x5C8,1,false},
XP: common.Attribute{0x634,4,true},
HP: common.Attribute{0x63C,2,true},
Weapon: common.Attribute{0x648,1,false},
Helmet: common.Attribute{0x649,1,false},
Chest: common.Attribute{0x64A,1,false},
Boots: common.Attribute{0x64B,1,false},
Accessory: common.Attribute{0x64C,1,false},
}
}
14 changes: 7 additions & 7 deletions internal/app/characters/Miranda.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,12 @@ func Miranda() Character { //TODO Map
return Character{
ID: 8,
Name: "Miranda",
XP: common.Attribute{0x5B0,4,true},
HP: common.Attribute{0x5B8,2,true},
Weapon: common.Attribute{0x5C4,1,false},
Helmet: common.Attribute{0x5C5,1,false},
Chest: common.Attribute{0x5C6,1,false},
Boots: common.Attribute{0x5C7,1,false},
Accessory: common.Attribute{0x5C8,1,false},
XP: common.Attribute{0x68C,4,true},
HP: common.Attribute{0x694,2,true},
Weapon: common.Attribute{0x6A0,1,false},
Helmet: common.Attribute{0x6A1,1,false},
Chest: common.Attribute{0x6A2,1,false},
Boots: common.Attribute{0x6A3,1,false},
Accessory: common.Attribute{0x6A4,1,false},
}
}
22 changes: 22 additions & 0 deletions internal/app/common/Positions.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
package common

func First() Attribute {
return Attribute{0x288,1,false}
}
func FirstDisplay() Attribute {
return Attribute{0x188,1,false}
}

func Second() Attribute {
return Attribute{0x28C,1,false}
}
func SecondDisplay() Attribute {
return Attribute{0x18C,1,false}
}

func Third() Attribute {
return Attribute{0x290,1,false}
}
func ThirdDisplay() Attribute {
return Attribute{0x190,1,false}
}
31 changes: 15 additions & 16 deletions internal/app/ui/Form.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,13 +22,6 @@ var meru = characters.Meru()
var kongol = characters.Kongol()
var miranda = characters.Miranda()

var pos1 = common.Attribute{0x288,1, false}
var pos1Display = common.Attribute{0x188,1, false}
var pos2 = common.Attribute{0x28C,1, false}
var pos2Display = common.Attribute{0x18C,1, false}
var pos3 = common.Attribute{0x290,1, false}
var pos3Display = common.Attribute{0x190,1, false}

func createCharSelect(i inventory.Inventory, a common.Attribute, s *storage.Slot) *widget.Select {
r := widget.NewSelect(i.GetVals(), func(v string) {
s.SetValueAtLocation(a, i.GetIDByVal(v))
Expand All @@ -47,13 +40,9 @@ func createPosSelect(n []string, a common.Attribute, ad common.Attribute, s *sto
}

func createPartyForm(s *storage.Slot) *fyne.Container {
names := []string{
dart.Name, shana.Name, lavitz.Name, rose.Name, haschel.Name,
albert.Name, meru.Name, kongol.Name, miranda.Name,
}
s1 := createPosSelect(names, pos1, pos1Display, s)
s2 := createPosSelect(names, pos2, pos2Display, s)
s3 := createPosSelect(names, pos3, pos3Display, s)
s1 := createPosSelect(characters.GetCharacterNames(), common.First(), common.FirstDisplay(), s)
s2 := createPosSelect(characters.GetCharacterNames(), common.Second(), common.SecondDisplay(), s)
s3 := createPosSelect(characters.GetCharacterNames(), common.Third(), common.ThirdDisplay(), s)
return fyne.NewContainerWithLayout(layout.NewHBoxLayout(),
widget.NewLabel("Party"), s1, s2, s3)
}
Expand Down Expand Up @@ -90,9 +79,19 @@ func CreateForm(slot *storage.Slot, card *storage.Card, w fyne.Window) *fyne.Con
createCharacterBox(box3, lavitz, inventory.Spears(), slot)
box4 := widget.NewVBox()
createCharacterBox(box4, rose, inventory.Daggers(), slot)
box5 := widget.NewVBox()
createCharacterBox(box5, haschel, inventory.Knuckles(), slot)
box6 := widget.NewVBox()
createCharacterBox(box6, albert, inventory.Spears(), slot)
box7 := widget.NewVBox()
createCharacterBox(box7, meru, inventory.Maces(), slot)
box8 := widget.NewVBox()
createCharacterBox(box8, kongol, inventory.Axes(), slot)
box9 := widget.NewVBox()
createCharacterBox(box9, miranda, inventory.Bows(), slot)

chars := fyne.NewContainerWithLayout(layout.NewGridLayout(4),
box1, box2, box3, box4)
chars := fyne.NewContainerWithLayout(layout.NewGridLayout(9),
box1, box2, box3, box4, box5, box6, box7, box8, box9)
submit := fyne.NewContainerWithLayout(layout.NewHBoxLayout(),
form)

Expand Down

0 comments on commit 7e87fe7

Please sign in to comment.