From 4f18e2659836750354472984f64a40653eeab767 Mon Sep 17 00:00:00 2001 From: Derek Smart Date: Thu, 20 Feb 2020 11:15:33 -0500 Subject: [PATCH] use storage as a dot import Signed-off-by: Derek Smart --- internal/app/characters/Albert.go | 16 ++++++++-------- internal/app/characters/Character.go | 16 ++++++++-------- internal/app/characters/Dart.go | 16 ++++++++-------- internal/app/characters/Haschel.go | 16 ++++++++-------- internal/app/characters/Kongol.go | 16 ++++++++-------- internal/app/characters/Lavitz.go | 16 ++++++++-------- internal/app/characters/Meru.go | 16 ++++++++-------- internal/app/characters/Miranda.go | 16 ++++++++-------- internal/app/characters/Rose.go | 16 ++++++++-------- internal/app/characters/Shana.go | 16 ++++++++-------- internal/app/common/Collectibles.go | 10 +++++----- internal/app/common/Positions.go | 26 +++++++++++++------------- internal/app/inventory/Armor.go | 1 - internal/app/inventory/Helms.go | 1 - internal/app/ui/Form.go | 14 +++++++------- 15 files changed, 105 insertions(+), 107 deletions(-) diff --git a/internal/app/characters/Albert.go b/internal/app/characters/Albert.go index 1fb60a8..7c845c3 100644 --- a/internal/app/characters/Albert.go +++ b/internal/app/characters/Albert.go @@ -1,19 +1,19 @@ package characters import ( - "LODeditor/internal/app/storage" + . "LODeditor/internal/app/storage" ) func Albert() Character { //TODO MAP return Character{ ID: 05, Name: "Albert", - XP: storage.Attribute{0x608,4,true}, - HP: storage.Attribute{0x610,2,true}, - Weapon: storage.Attribute{0x61C,1,false}, - Helmet: storage.Attribute{0x61D,1,false}, - Chest: storage.Attribute{0x61E,1,false}, - Boots: storage.Attribute{0x61F,1,false}, - Accessory: storage.Attribute{0x620,1,false}, + XP: Attribute{0x608,4,true}, + HP: Attribute{0x610,2,true}, + Weapon: Attribute{0x61C,1,false}, + Helmet: Attribute{0x61D,1,false}, + Chest: Attribute{0x61E,1,false}, + Boots: Attribute{0x61F,1,false}, + Accessory: Attribute{0x620,1,false}, } } diff --git a/internal/app/characters/Character.go b/internal/app/characters/Character.go index 29737b3..5509850 100644 --- a/internal/app/characters/Character.go +++ b/internal/app/characters/Character.go @@ -1,19 +1,19 @@ package characters import ( - "LODeditor/internal/app/storage" + . "LODeditor/internal/app/storage" ) type Character struct { ID int Name string - XP storage.Attribute - HP storage.Attribute - Weapon storage.Attribute - Helmet storage.Attribute - Chest storage.Attribute - Boots storage.Attribute - Accessory storage.Attribute + XP Attribute + HP Attribute + Weapon Attribute + Helmet Attribute + Chest Attribute + Boots Attribute + Accessory Attribute } func GetCharacters() []Character { diff --git a/internal/app/characters/Dart.go b/internal/app/characters/Dart.go index 1c430ee..5965067 100644 --- a/internal/app/characters/Dart.go +++ b/internal/app/characters/Dart.go @@ -1,19 +1,19 @@ package characters import ( - "LODeditor/internal/app/storage" + . "LODeditor/internal/app/storage" ) func Dart() Character { return Character{ ID: 0, Name: "Dart", - XP: storage.Attribute{0x52C,4,true}, - HP: storage.Attribute{0x534,2,true}, - Weapon: storage.Attribute{0x540,1,false}, - Helmet: storage.Attribute{0x541,1,false}, - Chest: storage.Attribute{0x542,1,false}, - Boots: storage.Attribute{0x543,1,false}, - Accessory: storage.Attribute{0x544,1,false}, + XP: Attribute{0x52C,4,true}, + HP: Attribute{0x534,2,true}, + Weapon: Attribute{0x540,1,false}, + Helmet: Attribute{0x541,1,false}, + Chest: Attribute{0x542,1,false}, + Boots: Attribute{0x543,1,false}, + Accessory: Attribute{0x544,1,false}, } } \ No newline at end of file diff --git a/internal/app/characters/Haschel.go b/internal/app/characters/Haschel.go index 24ed31c..7bfe11c 100644 --- a/internal/app/characters/Haschel.go +++ b/internal/app/characters/Haschel.go @@ -1,19 +1,19 @@ package characters import ( - "LODeditor/internal/app/storage" + . "LODeditor/internal/app/storage" ) func Haschel() Character { //TODO MAP return Character{ ID: 04, Name: "Haschel", - XP: storage.Attribute{0x5DC,4,true}, - HP: storage.Attribute{0x5E4,2,true}, - Weapon: storage.Attribute{0x5F0,1,false}, - Helmet: storage.Attribute{0x5F1,1,false}, - Chest: storage.Attribute{0x5F2,1,false}, - Boots: storage.Attribute{0x5F3,1,false}, - Accessory: storage.Attribute{0x5F4,1,false}, + XP: Attribute{0x5DC,4,true}, + HP: Attribute{0x5E4,2,true}, + Weapon: Attribute{0x5F0,1,false}, + Helmet: Attribute{0x5F1,1,false}, + Chest: Attribute{0x5F2,1,false}, + Boots: Attribute{0x5F3,1,false}, + Accessory: Attribute{0x5F4,1,false}, } } diff --git a/internal/app/characters/Kongol.go b/internal/app/characters/Kongol.go index 9010b8a..a22d785 100644 --- a/internal/app/characters/Kongol.go +++ b/internal/app/characters/Kongol.go @@ -1,19 +1,19 @@ package characters import ( - "LODeditor/internal/app/storage" + . "LODeditor/internal/app/storage" ) func Kongol() Character { //TODO map return Character{ ID: 07, Name: "Kongol", - XP: storage.Attribute{0x660,4,true}, - HP: storage.Attribute{0x668,2,true}, - Weapon: storage.Attribute{0x674,1,false}, - Helmet: storage.Attribute{0x675,1,false}, - Chest: storage.Attribute{0x676,1,false}, - Boots: storage.Attribute{0x677,1,false}, - Accessory: storage.Attribute{0x678,1,false}, + XP: Attribute{0x660,4,true}, + HP: Attribute{0x668,2,true}, + Weapon: Attribute{0x674,1,false}, + Helmet: Attribute{0x675,1,false}, + Chest: Attribute{0x676,1,false}, + Boots: Attribute{0x677,1,false}, + Accessory: Attribute{0x678,1,false}, } } diff --git a/internal/app/characters/Lavitz.go b/internal/app/characters/Lavitz.go index 5cfc334..786f824 100644 --- a/internal/app/characters/Lavitz.go +++ b/internal/app/characters/Lavitz.go @@ -1,19 +1,19 @@ package characters import ( - "LODeditor/internal/app/storage" + . "LODeditor/internal/app/storage" ) func Lavitz() Character { return Character{ ID: 1, Name: "Lavitz", - XP: storage.Attribute{0x558,4,true}, - HP: storage.Attribute{0x560,2,true}, - Weapon: storage.Attribute{0x56C,1,false}, - Helmet: storage.Attribute{0x56D,1,false}, - Chest: storage.Attribute{0x56E,1,false}, - Boots: storage.Attribute{0x56F,1,false}, - Accessory: storage.Attribute{0x570,1,false}, + XP: Attribute{0x558,4,true}, + HP: Attribute{0x560,2,true}, + Weapon: Attribute{0x56C,1,false}, + Helmet: Attribute{0x56D,1,false}, + Chest: Attribute{0x56E,1,false}, + Boots: Attribute{0x56F,1,false}, + Accessory: Attribute{0x570,1,false}, } } diff --git a/internal/app/characters/Meru.go b/internal/app/characters/Meru.go index de6be41..c88a456 100644 --- a/internal/app/characters/Meru.go +++ b/internal/app/characters/Meru.go @@ -1,19 +1,19 @@ package characters import ( - "LODeditor/internal/app/storage" + . "LODeditor/internal/app/storage" ) func Meru() Character { //TODO map return Character{ ID: 06, Name: "Meru", - XP: storage.Attribute{0x634,4,true}, - HP: storage.Attribute{0x63C,2,true}, - Weapon: storage.Attribute{0x648,1,false}, - Helmet: storage.Attribute{0x649,1,false}, - Chest: storage.Attribute{0x64A,1,false}, - Boots: storage.Attribute{0x64B,1,false}, - Accessory: storage.Attribute{0x64C,1,false}, + XP: Attribute{0x634,4,true}, + HP: Attribute{0x63C,2,true}, + Weapon: Attribute{0x648,1,false}, + Helmet: Attribute{0x649,1,false}, + Chest: Attribute{0x64A,1,false}, + Boots: Attribute{0x64B,1,false}, + Accessory: Attribute{0x64C,1,false}, } } diff --git a/internal/app/characters/Miranda.go b/internal/app/characters/Miranda.go index 1851639..57b3fba 100644 --- a/internal/app/characters/Miranda.go +++ b/internal/app/characters/Miranda.go @@ -1,19 +1,19 @@ package characters import ( - "LODeditor/internal/app/storage" + . "LODeditor/internal/app/storage" ) func Miranda() Character { //TODO Map return Character{ ID: 8, Name: "Miranda", - XP: storage.Attribute{0x68C,4,true}, - HP: storage.Attribute{0x694,2,true}, - Weapon: storage.Attribute{0x6A0,1,false}, - Helmet: storage.Attribute{0x6A1,1,false}, - Chest: storage.Attribute{0x6A2,1,false}, - Boots: storage.Attribute{0x6A3,1,false}, - Accessory: storage.Attribute{0x6A4,1,false}, + XP: Attribute{0x68C,4,true}, + HP: Attribute{0x694,2,true}, + Weapon: Attribute{0x6A0,1,false}, + Helmet: Attribute{0x6A1,1,false}, + Chest: Attribute{0x6A2,1,false}, + Boots: Attribute{0x6A3,1,false}, + Accessory: Attribute{0x6A4,1,false}, } } diff --git a/internal/app/characters/Rose.go b/internal/app/characters/Rose.go index a81edd4..92e6523 100644 --- a/internal/app/characters/Rose.go +++ b/internal/app/characters/Rose.go @@ -1,19 +1,19 @@ package characters import ( - "LODeditor/internal/app/storage" + . "LODeditor/internal/app/storage" ) func Rose() Character { return Character{ ID: 3, Name: "Rose", - XP: storage.Attribute{0x5B0,4,true}, - HP: storage.Attribute{0x5B8,2,true}, - Weapon: storage.Attribute{0x5C4,1,false}, - Helmet: storage.Attribute{0x5C5,1,false}, - Chest: storage.Attribute{0x5C6,1,false}, - Boots: storage.Attribute{0x5C7,1,false}, - Accessory: storage.Attribute{0x5C8,1,false}, + XP: Attribute{0x5B0,4,true}, + HP: Attribute{0x5B8,2,true}, + Weapon: Attribute{0x5C4,1,false}, + Helmet: Attribute{0x5C5,1,false}, + Chest: Attribute{0x5C6,1,false}, + Boots: Attribute{0x5C7,1,false}, + Accessory: Attribute{0x5C8,1,false}, } } diff --git a/internal/app/characters/Shana.go b/internal/app/characters/Shana.go index da8a300..9b27ef5 100644 --- a/internal/app/characters/Shana.go +++ b/internal/app/characters/Shana.go @@ -1,19 +1,19 @@ package characters import ( - "LODeditor/internal/app/storage" + . "LODeditor/internal/app/storage" ) func Shana() Character { return Character{ ID: 2, Name: "Shana", - XP: storage.Attribute{0x584,4,true}, - HP: storage.Attribute{0x58C,2,true}, - Weapon: storage.Attribute{0x598,1,false}, - Helmet: storage.Attribute{0x599,1,false}, - Chest: storage.Attribute{0x59A,1,false}, - Boots: storage.Attribute{0x59B,1,false}, - Accessory: storage.Attribute{0x59C,1,false}, + XP: Attribute{0x584,4,true}, + HP: Attribute{0x58C,2,true}, + Weapon: Attribute{0x598,1,false}, + Helmet: Attribute{0x599,1,false}, + Chest: Attribute{0x59A,1,false}, + Boots: Attribute{0x59B,1,false}, + Accessory: Attribute{0x59C,1,false}, } } diff --git a/internal/app/common/Collectibles.go b/internal/app/common/Collectibles.go index 60a940c..fc3c883 100644 --- a/internal/app/common/Collectibles.go +++ b/internal/app/common/Collectibles.go @@ -1,10 +1,10 @@ package common -import "LODeditor/internal/app/storage" +import . "LODeditor/internal/app/storage" -func Gold() storage.Attribute { - return storage.Attribute{0x294, 4, true} +func Gold() Attribute { + return Attribute{0x294, 4, true} } -func GoldDisplay() storage.Attribute { - return storage.Attribute{0x19C, 4, true} +func GoldDisplay() Attribute { + return Attribute{0x19C, 4, true} } \ No newline at end of file diff --git a/internal/app/common/Positions.go b/internal/app/common/Positions.go index 1c62d7c..9fae7a5 100644 --- a/internal/app/common/Positions.go +++ b/internal/app/common/Positions.go @@ -1,24 +1,24 @@ package common -import "LODeditor/internal/app/storage" +import . "LODeditor/internal/app/storage" -func First() storage.Attribute { - return storage.Attribute{0x288,1,false} +func First() Attribute { + return Attribute{0x288,1,false} } -func FirstDisplay() storage.Attribute { - return storage.Attribute{0x188,1,false} +func FirstDisplay() Attribute { + return Attribute{0x188,1,false} } -func Second() storage.Attribute { - return storage.Attribute{0x28C,1,false} +func Second() Attribute { + return Attribute{0x28C,1,false} } -func SecondDisplay() storage.Attribute { - return storage.Attribute{0x18C,1,false} +func SecondDisplay() Attribute { + return Attribute{0x18C,1,false} } -func Third() storage.Attribute { - return storage.Attribute{0x290,1,false} +func Third() Attribute { + return Attribute{0x290,1,false} } -func ThirdDisplay() storage.Attribute { - return storage.Attribute{0x190,1,false} +func ThirdDisplay() Attribute { + return Attribute{0x190,1,false} } \ No newline at end of file diff --git a/internal/app/inventory/Armor.go b/internal/app/inventory/Armor.go index e3a86ba..a2abca3 100644 --- a/internal/app/inventory/Armor.go +++ b/internal/app/inventory/Armor.go @@ -1,6 +1,5 @@ package inventory - func Armor() Inventory { return []Item{ {46,"Leather Armor"}, diff --git a/internal/app/inventory/Helms.go b/internal/app/inventory/Helms.go index e783a7e..85fb44b 100644 --- a/internal/app/inventory/Helms.go +++ b/internal/app/inventory/Helms.go @@ -1,6 +1,5 @@ package inventory - func Helms() Inventory { return []Item{ {76,"Bandana"}, diff --git a/internal/app/ui/Form.go b/internal/app/ui/Form.go index 6d89a1c..4bad4e4 100644 --- a/internal/app/ui/Form.go +++ b/internal/app/ui/Form.go @@ -4,7 +4,7 @@ import ( "LODeditor/internal/app/characters" "LODeditor/internal/app/common" "LODeditor/internal/app/inventory" - "LODeditor/internal/app/storage" + . "LODeditor/internal/app/storage" "fmt" "fyne.io/fyne" "fyne.io/fyne/dialog" @@ -23,7 +23,7 @@ var meru = characters.Meru() var kongol = characters.Kongol() var miranda = characters.Miranda() -func createCharSelect(i inventory.Inventory, a storage.Attribute, s *storage.Slot) *widget.Select { +func createCharSelect(i inventory.Inventory, a Attribute, s *Slot) *widget.Select { r := widget.NewSelect(i.GetVals(), func(v string) { s.SetValueAtLocation(a, i.GetIDByVal(v)) }) @@ -31,7 +31,7 @@ func createCharSelect(i inventory.Inventory, a storage.Attribute, s *storage.Slo return r } -func createPosSelect(n []string, a storage.Attribute, ad storage.Attribute, s *storage.Slot) *widget.Select { +func createPosSelect(n []string, a Attribute, ad Attribute, s *Slot) *widget.Select { r := widget.NewSelect(n, func(v string) { s.SetValueAtLocation(a, characters.GetIDByName(v)) s.SetValueAtLocation(ad, characters.GetIDByName(v)) @@ -40,7 +40,7 @@ func createPosSelect(n []string, a storage.Attribute, ad storage.Attribute, s *s return r } -func createCharEntry(a storage.Attribute, s *storage.Slot) *widget.Entry { +func createCharEntry(a Attribute, s *Slot) *widget.Entry { e := widget.NewEntry() e.SetPlaceHolder(strconv.Itoa(s.GetValueByAttribute(a))) e.OnChanged = func(v string) { @@ -50,7 +50,7 @@ func createCharEntry(a storage.Attribute, s *storage.Slot) *widget.Entry { return e } -func createPartyForm(s *storage.Slot) *fyne.Container { +func createPartyForm(s *Slot) *fyne.Container { 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) @@ -65,7 +65,7 @@ func createPartyForm(s *storage.Slot) *fyne.Container { widget.NewLabel("Party"), s1, s2, s3, widget.NewLabel("Gold"), e1) } -func createCharacterBox(b *widget.Box, c characters.Character, w inventory.Inventory, s *storage.Slot, window fyne.Window) { +func createCharacterBox(b *widget.Box, c characters.Character, w inventory.Inventory, s *Slot, window fyne.Window) { b.Append(widget.NewLabel(c.Name)) b.Append(widget.NewLabel("HP")) @@ -83,7 +83,7 @@ func createCharacterBox(b *widget.Box, c characters.Character, w inventory.Inven b.Append(createCharSelect(inventory.Accessories(), c.Accessory, s)) } -func CreateForm(slot *storage.Slot, card *storage.Card, w fyne.Window) *fyne.Container { +func CreateForm(slot *Slot, card *Card, w fyne.Window) *fyne.Container { form := &widget.Form{ OnCancel: func() { fmt.Println("Cancelled")