Skip to content

Commit

Permalink
Merge pull request #4 from mcred/develop
Browse files Browse the repository at this point in the history
Characters in Party
  • Loading branch information
mcred authored Feb 19, 2020
2 parents bb27fa8 + 454f24e commit 23572f4
Show file tree
Hide file tree
Showing 14 changed files with 259 additions and 103 deletions.
2 changes: 1 addition & 1 deletion internal/app/Editor.go
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ func Run() {

w.SetContent(widget.NewVBox(
ui.Toolbar(&slot, a),
ui.CharacterForm(&slot, &card, w),
ui.CreateForm(&slot, &card, w),
))

w.Resize(fyne.NewSize(800, 600))
Expand Down
19 changes: 19 additions & 0 deletions internal/app/characters/Albert.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
package characters

import (
"LODeditor/internal/app/common"
)

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},
}
}
50 changes: 38 additions & 12 deletions internal/app/characters/Character.go
Original file line number Diff line number Diff line change
@@ -1,18 +1,44 @@
package characters

import (
"LODeditor/internal/app/common"
)

type Character struct {
ID int
XP Attribute
HP Attribute
Weapon Attribute
Helmet Attribute
Chest Attribute
Boots Attribute
Accessory Attribute
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
}

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

type Attribute struct {
Location int
Bytes int
Reversed bool
func GetNameByID(i int) string {
r := ""
for _, c := range characters() {
if i == c.ID {
r = c.Name
}
}
return r
}

func GetIDByName(n string) int {
r := 0
for _, c := range characters() {
if n == c.Name {
r = c.ID
}
}
return r
}
21 changes: 13 additions & 8 deletions internal/app/characters/Dart.go
Original file line number Diff line number Diff line change
@@ -1,14 +1,19 @@
package characters

import (
"LODeditor/internal/app/common"
)

func Dart() Character {
return Character{
ID: 0,
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},
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},
}
}
19 changes: 19 additions & 0 deletions internal/app/characters/Haschel.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
package characters

import (
"LODeditor/internal/app/common"
)

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},
}
}
19 changes: 19 additions & 0 deletions internal/app/characters/Kongol.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
package characters

import (
"LODeditor/internal/app/common"
)

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},
}
}
21 changes: 13 additions & 8 deletions internal/app/characters/Lavitz.go
Original file line number Diff line number Diff line change
@@ -1,14 +1,19 @@
package characters

import (
"LODeditor/internal/app/common"
)

func Lavitz() Character {
return Character{
ID: 1,
XP: Attribute{0x584,4,true},
HP: Attribute{0x534,2,true}, //TODO map this
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},
ID: 1,
Name: "Lavitz",
XP: common.Attribute{0x584,4,true},
HP: common.Attribute{0x534,2,true}, //TODO map this
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},
}
}
19 changes: 19 additions & 0 deletions internal/app/characters/Meru.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
package characters

import (
"LODeditor/internal/app/common"
)

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},
}
}
19 changes: 19 additions & 0 deletions internal/app/characters/Miranda.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
package characters

import (
"LODeditor/internal/app/common"
)

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},
}
}
19 changes: 12 additions & 7 deletions internal/app/characters/Rose.go
Original file line number Diff line number Diff line change
@@ -1,14 +1,19 @@
package characters

import (
"LODeditor/internal/app/common"
)

func Rose() Character {
return Character{
ID: 3,
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},
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},
}
}
19 changes: 12 additions & 7 deletions internal/app/characters/Shana.go
Original file line number Diff line number Diff line change
@@ -1,14 +1,19 @@
package characters

import (
"LODeditor/internal/app/common"
)

func Shana() Character {
return Character{
ID: 2,
XP: Attribute{0x558,4,true},
HP: Attribute{0x560,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},
Name: "Shana",
XP: common.Attribute{0x558,4,true},
HP: common.Attribute{0x560,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},
}
}
7 changes: 7 additions & 0 deletions internal/app/common/Attribute.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
package common

type Attribute struct {
Location int
Bytes int
Reversed bool
}
6 changes: 3 additions & 3 deletions internal/app/storage/Slot.go
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
package storage

import (
"LODeditor/internal/app/characters"
"LODeditor/internal/app/common"
"encoding/binary"
)

Expand All @@ -10,7 +10,7 @@ type Slot struct {
Data []byte
}

func (s *Slot) GetValueByAttribute(a characters.Attribute) int {
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])
Expand All @@ -23,6 +23,6 @@ func (s *Slot) GetValueByAttribute(a characters.Attribute) int {
}
}

func (s *Slot) SetValueAtLocation(a characters.Attribute, val int) {
func (s *Slot) SetValueAtLocation(a common.Attribute, val int) {
s.Data[a.Location] = byte(val)
}
Loading

0 comments on commit 23572f4

Please sign in to comment.