From 98ff6c5870fa358049bd60997c0f92c78c883dc3 Mon Sep 17 00:00:00 2001 From: Derek Smart Date: Thu, 20 Feb 2020 10:27:43 -0500 Subject: [PATCH 1/5] Fixes #23 Signed-off-by: Derek Smart --- .gitignore | 3 ++- assets/icon.png | Bin 4235 -> 8833 bytes 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/.gitignore b/.gitignore index b44d363..dafe760 100644 --- a/.gitignore +++ b/.gitignore @@ -9,4 +9,5 @@ build *.App # Development files -/notes \ No newline at end of file +/notes +*.psd diff --git a/assets/icon.png b/assets/icon.png index c066aece6b5efd45ea23ca34c2148fe8521b14fa..e8f0bbd69deed4378c6f44f0a60b3107b681569f 100644 GIT binary patch literal 8833 zcmd5>3tSUd)=x`!ZEIcH+Da=*QmnO#5RgZB4=9iN#6?zGq{Il}A&(#o1chYiQ$c~c zmij=*Hd$m9St=CK02y6tSxW%}T8wmvNHtNygc`^I!_0g)TKqnLwY7e~e&3Sc?qEsh=g~ll-H66@mv3#MN zbU|#g5aw(VCM2c#*&CZsdrnfEpM9kJTIaRtD};$jZ|%qsZrHIdB6de|tXG^p7Cxbz{!60_k?*D6g z;dwc^c(^&cdMxEEb9V9KI(u?mTpgWVyq!I~-Fcj!KK5X>jJSC3@Su>N)&h5a_K7f@ z?#<%4lr@?|8$F$4^QyhYXnXws3>2Q)Ljbq^` z*doe;{p^9H_qLFlzIN?>#%Y;9DGI2JnIq0qO6QqV2}6(QusGKhV4BA1IIgyhpu@) zQ&iCFmNa|E^OsgFc%k8lP3kid%a#{LIGsBBsl%yuKi=L?^8Oqg@&1+%KlxkM`J;t@ z4fq0keO>fn&l64lLrv!R1aZrt=3x1I5NqR^+j~t{Wu5F{gQ%}uqNDH#=`f}H?gsK@Rk=o{KOSI>T=R;Aq zO)}qY$1drR{_{Eo*)HFO_t?(TiKRL*&3xC!ZMjY()(Cy1lW*3F4vB#H0bu-!f`6t) zj)nfwYP?VKaJxOg_U(P&SgV-mkr@`PM~*v9-273Yrq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VwP@cOg-xKk{=xVauoxlPLblz%;`l^ilM0Pp6pK<+mQS#Ci>KczkP=rQ5n>&%D z7>GH}SlT&BVQu5#*3@9PnWUz}xUBK~Nv*59lfX+E?}1;x+cb8%?b5>_K{%_JtAXO} zF`ME{_CgE=?lrCfUH&FLYW?h8=g%dbS8c`t+RvCy64D+pL|*ikMduX%O%vVlzp*izVB$%Q#dgmhq!D*ULlr+d#Et z56!=DpnB;Z0W)&7b5N&77G7IPh5y|+r;xt^W0BYpp<+5HRA1}oyfR`2vx=2cia!f^D1VEYOp)Tg}^Doxw$6(alv+bzmPW>@A}Em`Ydc_r%=*B+XTX_b+GX z$hE`+xF?2OBgQ%rqJL2}r1f-ON<7>;jm-w9hadpvJ6wo`JwFsTZ=PS~NWs#125u-C zH{EmXbSDh*Z9$P4dFq>W+?i_|ry)gSknZQ4RqeZ1uke_c&h1N`D9o6kv2|y+_2%_k zj8GT9h(TC`t;)4GRc9R85+vMOa2RK4=LbTMVWSuP3{ldIqLZFwoXg7f<$Pyy2) zR|)`Fkfx*Hyh8JIy1fS*kv0@U2$%Sto6m4TFuW*cWO&mb6>H7GhF(kM|57$~wSck?co5zruI^C{LXX+Omj! z;}D~MY*!#(YE5s)iQ!JKUNb7({>$pkUh%wpr`y@+FTdSb|M>AS`~g780_VFcqdI)T jc<}2eY|Wu3i4Ei?VgE^8$+hlZs{>(7tc Date: Thu, 20 Feb 2020 11:03:29 -0500 Subject: [PATCH 2/5] Fixes #10 Signed-off-by: Derek Smart --- internal/app/common/Collectibles.go | 8 ++++++++ internal/app/storage/Slot.go | 22 ++++++++++++++++------ internal/app/ui/Form.go | 9 ++++++++- 3 files changed, 32 insertions(+), 7 deletions(-) create mode 100644 internal/app/common/Collectibles.go diff --git a/internal/app/common/Collectibles.go b/internal/app/common/Collectibles.go new file mode 100644 index 0000000..5eb230d --- /dev/null +++ b/internal/app/common/Collectibles.go @@ -0,0 +1,8 @@ +package common + +func Gold() Attribute { + return Attribute{0x294, 4, true} +} +func GoldDisplay() Attribute { + return Attribute{0x19C, 4, true} +} \ No newline at end of file diff --git a/internal/app/storage/Slot.go b/internal/app/storage/Slot.go index 68ce539..fda816f 100644 --- a/internal/app/storage/Slot.go +++ b/internal/app/storage/Slot.go @@ -12,13 +12,23 @@ type Slot struct { func (s *Slot) GetValueByAttribute(a common.Attribute) int { b := s.Data[a.Location:(a.Location+a.Bytes)] - if a.Bytes == 1 { - return int(b[0]) + if a.Reversed { + switch a.Bytes { + case 2: + return int(binary.LittleEndian.Uint16(b)) + case 4: + return int(binary.LittleEndian.Uint32(b)) + default: + return int(b[0]) + } } else { - if a.Reversed { - return int(binary.LittleEndian.Uint16(b)) - } else { - return int(binary.BigEndian.Uint16(b)) + switch a.Bytes { + case 2: + return int(binary.BigEndian.Uint16(b)) + case 4: + return int(binary.LittleEndian.Uint32(b)) + default: + return int(b[0]) } } } diff --git a/internal/app/ui/Form.go b/internal/app/ui/Form.go index 84f8291..b3d82a8 100644 --- a/internal/app/ui/Form.go +++ b/internal/app/ui/Form.go @@ -54,8 +54,15 @@ func createPartyForm(s *storage.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) + e1 := widget.NewEntry() + e1.SetPlaceHolder(strconv.Itoa(s.GetValueByAttribute(common.Gold()))) + e1.OnChanged = func(v string) { + i, _ := strconv.Atoi(v) + s.SetValueAtLocation(common.Gold(), i) + s.SetValueAtLocation(common.GoldDisplay(), i) + } return fyne.NewContainerWithLayout(layout.NewHBoxLayout(), - widget.NewLabel("Party"), s1, s2, s3) + 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) { From 6cb1c84b7e523705d004b856eb6a7ea95eb01527 Mon Sep 17 00:00:00 2001 From: Derek Smart Date: Thu, 20 Feb 2020 11:08:16 -0500 Subject: [PATCH 3/5] Move attribute to storage 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 | 20 +++++++------- internal/app/characters/Shana.go | 20 +++++++------- internal/app/common/Collectibles.go | 10 ++++--- internal/app/common/Positions.go | 26 ++++++++++--------- internal/app/{common => storage}/Attribute.go | 2 +- internal/app/storage/Slot.go | 5 ++-- internal/app/ui/Form.go | 6 ++--- 15 files changed, 110 insertions(+), 107 deletions(-) rename internal/app/{common => storage}/Attribute.go (80%) diff --git a/internal/app/characters/Albert.go b/internal/app/characters/Albert.go index 46692fe..1fb60a8 100644 --- a/internal/app/characters/Albert.go +++ b/internal/app/characters/Albert.go @@ -1,19 +1,19 @@ package characters import ( - "LODeditor/internal/app/common" + "LODeditor/internal/app/storage" ) func Albert() Character { //TODO MAP return Character{ ID: 05, Name: "Albert", - 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}, + 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}, } } diff --git a/internal/app/characters/Character.go b/internal/app/characters/Character.go index ef92a4c..29737b3 100644 --- a/internal/app/characters/Character.go +++ b/internal/app/characters/Character.go @@ -1,19 +1,19 @@ package characters import ( - "LODeditor/internal/app/common" + "LODeditor/internal/app/storage" ) type Character struct { ID int Name string - XP common.Attribute - HP common.Attribute - Weapon common.Attribute - Helmet common.Attribute - Chest common.Attribute - Boots common.Attribute - Accessory common.Attribute + XP storage.Attribute + HP storage.Attribute + Weapon storage.Attribute + Helmet storage.Attribute + Chest storage.Attribute + Boots storage.Attribute + Accessory storage.Attribute } func GetCharacters() []Character { diff --git a/internal/app/characters/Dart.go b/internal/app/characters/Dart.go index c4be341..1c430ee 100644 --- a/internal/app/characters/Dart.go +++ b/internal/app/characters/Dart.go @@ -1,19 +1,19 @@ package characters import ( - "LODeditor/internal/app/common" + "LODeditor/internal/app/storage" ) func Dart() Character { return Character{ ID: 0, Name: "Dart", - XP: common.Attribute{0x52C,4,true}, - HP: common.Attribute{0x534,2,true}, - Weapon: common.Attribute{0x540,1,false}, - Helmet: common.Attribute{0x541,1,false}, - Chest: common.Attribute{0x542,1,false}, - Boots: common.Attribute{0x543,1,false}, - Accessory: common.Attribute{0x544,1,false}, + 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}, } } \ No newline at end of file diff --git a/internal/app/characters/Haschel.go b/internal/app/characters/Haschel.go index 73f87f3..24ed31c 100644 --- a/internal/app/characters/Haschel.go +++ b/internal/app/characters/Haschel.go @@ -1,19 +1,19 @@ package characters import ( - "LODeditor/internal/app/common" + "LODeditor/internal/app/storage" ) func Haschel() Character { //TODO MAP return Character{ ID: 04, Name: "Haschel", - 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}, + 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}, } } diff --git a/internal/app/characters/Kongol.go b/internal/app/characters/Kongol.go index 5c3be18..9010b8a 100644 --- a/internal/app/characters/Kongol.go +++ b/internal/app/characters/Kongol.go @@ -1,19 +1,19 @@ package characters import ( - "LODeditor/internal/app/common" + "LODeditor/internal/app/storage" ) func Kongol() Character { //TODO map return Character{ ID: 07, Name: "Kongol", - 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}, + 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}, } } diff --git a/internal/app/characters/Lavitz.go b/internal/app/characters/Lavitz.go index 592ebc6..5cfc334 100644 --- a/internal/app/characters/Lavitz.go +++ b/internal/app/characters/Lavitz.go @@ -1,19 +1,19 @@ package characters import ( - "LODeditor/internal/app/common" + "LODeditor/internal/app/storage" ) func Lavitz() Character { return Character{ ID: 1, Name: "Lavitz", - XP: common.Attribute{0x558,4,true}, - HP: common.Attribute{0x560,2,true}, - Weapon: common.Attribute{0x56C,1,false}, - Helmet: common.Attribute{0x56D,1,false}, - Chest: common.Attribute{0x56E,1,false}, - Boots: common.Attribute{0x56F,1,false}, - Accessory: common.Attribute{0x570,1,false}, + 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}, } } diff --git a/internal/app/characters/Meru.go b/internal/app/characters/Meru.go index 7a7230c..de6be41 100644 --- a/internal/app/characters/Meru.go +++ b/internal/app/characters/Meru.go @@ -1,19 +1,19 @@ package characters import ( - "LODeditor/internal/app/common" + "LODeditor/internal/app/storage" ) func Meru() Character { //TODO map return Character{ ID: 06, Name: "Meru", - 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}, + 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}, } } diff --git a/internal/app/characters/Miranda.go b/internal/app/characters/Miranda.go index 0896ec0..1851639 100644 --- a/internal/app/characters/Miranda.go +++ b/internal/app/characters/Miranda.go @@ -1,19 +1,19 @@ package characters import ( - "LODeditor/internal/app/common" + "LODeditor/internal/app/storage" ) func Miranda() Character { //TODO Map return Character{ ID: 8, Name: "Miranda", - 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}, + 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}, } } diff --git a/internal/app/characters/Rose.go b/internal/app/characters/Rose.go index 5ccf214..a81edd4 100644 --- a/internal/app/characters/Rose.go +++ b/internal/app/characters/Rose.go @@ -1,19 +1,19 @@ package characters import ( - "LODeditor/internal/app/common" + "LODeditor/internal/app/storage" ) func Rose() Character { return Character{ - ID: 3, - Name: "Rose", - 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}, + 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}, } } diff --git a/internal/app/characters/Shana.go b/internal/app/characters/Shana.go index 00c8109..da8a300 100644 --- a/internal/app/characters/Shana.go +++ b/internal/app/characters/Shana.go @@ -1,19 +1,19 @@ package characters import ( - "LODeditor/internal/app/common" + "LODeditor/internal/app/storage" ) func Shana() Character { return Character{ - ID: 2, - Name: "Shana", - XP: common.Attribute{0x584,4,true}, - HP: common.Attribute{0x58C,2,true}, - Weapon: common.Attribute{0x598,1,false}, - Helmet: common.Attribute{0x599,1,false}, - Chest: common.Attribute{0x59A,1,false}, - Boots: common.Attribute{0x59B,1,false}, - Accessory: common.Attribute{0x59C,1,false}, + 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}, } } diff --git a/internal/app/common/Collectibles.go b/internal/app/common/Collectibles.go index 5eb230d..60a940c 100644 --- a/internal/app/common/Collectibles.go +++ b/internal/app/common/Collectibles.go @@ -1,8 +1,10 @@ package common -func Gold() Attribute { - return Attribute{0x294, 4, true} +import "LODeditor/internal/app/storage" + +func Gold() storage.Attribute { + return storage.Attribute{0x294, 4, true} } -func GoldDisplay() Attribute { - return Attribute{0x19C, 4, true} +func GoldDisplay() storage.Attribute { + return storage.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 71ae234..1c62d7c 100644 --- a/internal/app/common/Positions.go +++ b/internal/app/common/Positions.go @@ -1,22 +1,24 @@ package common -func First() Attribute { - return Attribute{0x288,1,false} +import "LODeditor/internal/app/storage" + +func First() storage.Attribute { + return storage.Attribute{0x288,1,false} } -func FirstDisplay() Attribute { - return Attribute{0x188,1,false} +func FirstDisplay() storage.Attribute { + return storage.Attribute{0x188,1,false} } -func Second() Attribute { - return Attribute{0x28C,1,false} +func Second() storage.Attribute { + return storage.Attribute{0x28C,1,false} } -func SecondDisplay() Attribute { - return Attribute{0x18C,1,false} +func SecondDisplay() storage.Attribute { + return storage.Attribute{0x18C,1,false} } -func Third() Attribute { - return Attribute{0x290,1,false} +func Third() storage.Attribute { + return storage.Attribute{0x290,1,false} } -func ThirdDisplay() Attribute { - return Attribute{0x190,1,false} +func ThirdDisplay() storage.Attribute { + return storage.Attribute{0x190,1,false} } \ No newline at end of file diff --git a/internal/app/common/Attribute.go b/internal/app/storage/Attribute.go similarity index 80% rename from internal/app/common/Attribute.go rename to internal/app/storage/Attribute.go index 14811a8..292aa56 100644 --- a/internal/app/common/Attribute.go +++ b/internal/app/storage/Attribute.go @@ -1,4 +1,4 @@ -package common +package storage type Attribute struct { Location int diff --git a/internal/app/storage/Slot.go b/internal/app/storage/Slot.go index fda816f..a890767 100644 --- a/internal/app/storage/Slot.go +++ b/internal/app/storage/Slot.go @@ -1,7 +1,6 @@ package storage import ( - "LODeditor/internal/app/common" "encoding/binary" ) @@ -10,7 +9,7 @@ type Slot struct { Data []byte } -func (s *Slot) GetValueByAttribute(a common.Attribute) int { +func (s *Slot) GetValueByAttribute(a Attribute) int { b := s.Data[a.Location:(a.Location+a.Bytes)] if a.Reversed { switch a.Bytes { @@ -33,7 +32,7 @@ func (s *Slot) GetValueByAttribute(a common.Attribute) int { } } -func (s *Slot) SetValueAtLocation(a common.Attribute, val int) { +func (s *Slot) SetValueAtLocation(a Attribute, val int) { b := make([]byte, a.Bytes) if a.Reversed { switch a.Bytes { diff --git a/internal/app/ui/Form.go b/internal/app/ui/Form.go index b3d82a8..6d89a1c 100644 --- a/internal/app/ui/Form.go +++ b/internal/app/ui/Form.go @@ -23,7 +23,7 @@ var meru = characters.Meru() var kongol = characters.Kongol() var miranda = characters.Miranda() -func createCharSelect(i inventory.Inventory, a common.Attribute, s *storage.Slot) *widget.Select { +func createCharSelect(i inventory.Inventory, a storage.Attribute, s *storage.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 common.Attribute, s *storage.Slot return r } -func createPosSelect(n []string, a common.Attribute, ad common.Attribute, s *storage.Slot) *widget.Select { +func createPosSelect(n []string, a storage.Attribute, ad storage.Attribute, s *storage.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 common.Attribute, ad common.Attribute, s *sto return r } -func createCharEntry(a common.Attribute, s *storage.Slot) *widget.Entry { +func createCharEntry(a storage.Attribute, s *storage.Slot) *widget.Entry { e := widget.NewEntry() e.SetPlaceHolder(strconv.Itoa(s.GetValueByAttribute(a))) e.OnChanged = func(v string) { From 4f18e2659836750354472984f64a40653eeab767 Mon Sep 17 00:00:00 2001 From: Derek Smart Date: Thu, 20 Feb 2020 11:15:33 -0500 Subject: [PATCH 4/5] 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") From ab3fd01408dd497011199da6c6e99d3c48f8ba91 Mon Sep 17 00:00:00 2001 From: Derek Smart Date: Thu, 20 Feb 2020 11:34:23 -0500 Subject: [PATCH 5/5] Fixes #11 Signed-off-by: Derek Smart --- internal/app/common/Collectibles.go | 7 +++++++ internal/app/ui/Form.go | 13 ++++++++++++- 2 files changed, 19 insertions(+), 1 deletion(-) diff --git a/internal/app/common/Collectibles.go b/internal/app/common/Collectibles.go index fc3c883..4bb6e31 100644 --- a/internal/app/common/Collectibles.go +++ b/internal/app/common/Collectibles.go @@ -7,4 +7,11 @@ func Gold() Attribute { } func GoldDisplay() Attribute { return Attribute{0x19C, 4, true} +} + +func Stardust() Attribute { + return Attribute{0x29C, 1, false} +} +func StardustDisplay() Attribute { + return Attribute{0x1A8, 1, false} } \ No newline at end of file diff --git a/internal/app/ui/Form.go b/internal/app/ui/Form.go index 4bad4e4..c23d99e 100644 --- a/internal/app/ui/Form.go +++ b/internal/app/ui/Form.go @@ -61,8 +61,19 @@ func createPartyForm(s *Slot) *fyne.Container { s.SetValueAtLocation(common.Gold(), i) s.SetValueAtLocation(common.GoldDisplay(), i) } + e2 := widget.NewEntry() + e2.SetPlaceHolder(strconv.Itoa(s.GetValueByAttribute(common.Stardust()))) + e2.OnChanged = func(v string) { + i, _ := strconv.Atoi(v) + s.SetValueAtLocation(common.Stardust(), i) + s.SetValueAtLocation(common.StardustDisplay(), i) + } + return fyne.NewContainerWithLayout(layout.NewHBoxLayout(), - widget.NewLabel("Party"), s1, s2, s3, widget.NewLabel("Gold"), e1) + widget.NewLabel("Party"), s1, s2, s3, + widget.NewLabel("Gold"), e1, + widget.NewLabel("Stardust"), e2, + ) } func createCharacterBox(b *widget.Box, c characters.Character, w inventory.Inventory, s *Slot, window fyne.Window) {