Skip to content

Commit

Permalink
Merge pull request #25 from mcred/develop
Browse files Browse the repository at this point in the history
Fixes #10
Fixes #11
Fixes #23
  • Loading branch information
mcred authored Feb 20, 2020
2 parents 02cd191 + ab3fd01 commit 3599449
Show file tree
Hide file tree
Showing 19 changed files with 150 additions and 105 deletions.
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -9,4 +9,5 @@ build
*.App

# Development files
/notes
/notes
*.psd
Binary file modified assets/icon.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
16 changes: 8 additions & 8 deletions internal/app/characters/Albert.go
Original file line number Diff line number Diff line change
@@ -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: 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},
}
}
16 changes: 8 additions & 8 deletions internal/app/characters/Character.go
Original file line number Diff line number Diff line change
@@ -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 Attribute
HP Attribute
Weapon Attribute
Helmet Attribute
Chest Attribute
Boots Attribute
Accessory Attribute
}

func GetCharacters() []Character {
Expand Down
16 changes: 8 additions & 8 deletions internal/app/characters/Dart.go
Original file line number Diff line number Diff line change
@@ -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: 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},
}
}
16 changes: 8 additions & 8 deletions internal/app/characters/Haschel.go
Original file line number Diff line number Diff line change
@@ -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: 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},
}
}
16 changes: 8 additions & 8 deletions internal/app/characters/Kongol.go
Original file line number Diff line number Diff line change
@@ -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: 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},
}
}
16 changes: 8 additions & 8 deletions internal/app/characters/Lavitz.go
Original file line number Diff line number Diff line change
@@ -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: 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},
}
}
16 changes: 8 additions & 8 deletions internal/app/characters/Meru.go
Original file line number Diff line number Diff line change
@@ -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: 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},
}
}
16 changes: 8 additions & 8 deletions internal/app/characters/Miranda.go
Original file line number Diff line number Diff line change
@@ -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: 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},
}
}
20 changes: 10 additions & 10 deletions internal/app/characters/Rose.go
Original file line number Diff line number Diff line change
@@ -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: 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},
}
}
20 changes: 10 additions & 10 deletions internal/app/characters/Shana.go
Original file line number Diff line number Diff line change
@@ -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: 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},
}
}
17 changes: 17 additions & 0 deletions internal/app/common/Collectibles.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
package common

import . "LODeditor/internal/app/storage"

func Gold() Attribute {
return Attribute{0x294, 4, true}
}
func GoldDisplay() Attribute {
return Attribute{0x19C, 4, true}
}

func Stardust() Attribute {
return Attribute{0x29C, 1, false}
}
func StardustDisplay() Attribute {
return Attribute{0x1A8, 1, false}
}
2 changes: 2 additions & 0 deletions internal/app/common/Positions.go
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
package common

import . "LODeditor/internal/app/storage"

func First() Attribute {
return Attribute{0x288,1,false}
}
Expand Down
1 change: 0 additions & 1 deletion internal/app/inventory/Armor.go
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
package inventory


func Armor() Inventory {
return []Item{
{46,"Leather Armor"},
Expand Down
1 change: 0 additions & 1 deletion internal/app/inventory/Helms.go
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
package inventory


func Helms() Inventory {
return []Item{
{76,"Bandana"},
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package common
package storage

type Attribute struct {
Location int
Expand Down
27 changes: 18 additions & 9 deletions internal/app/storage/Slot.go
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
package storage

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

Expand All @@ -10,20 +9,30 @@ 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.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])
}
}
}

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 {
Expand Down
Loading

0 comments on commit 3599449

Please sign in to comment.