fetch static data from txt files and properly get all the item stats... maybe?
This commit is contained in:
62
cmd/txttocode/templates.go
Normal file
62
cmd/txttocode/templates.go
Normal file
@@ -0,0 +1,62 @@
|
||||
package main
|
||||
|
||||
const templateItemType = `// Code generated by cmd/txttocode. DO NOT EDIT.
|
||||
// source: cmd/txttocode/txt/itemtypes.txt
|
||||
package item
|
||||
|
||||
const (
|
||||
{{- range $key, $value := . }}
|
||||
Type{{ replace $value.ItemType " " "" }} = "{{ $value.Code }}"
|
||||
{{- end }}
|
||||
)
|
||||
|
||||
var ItemTypes = map[string]Type{
|
||||
{{- range $key, $value := . }}
|
||||
Type{{ replace $value.ItemType " " "" }}: {ID: {{ $key }}, Name: "{{ $value.ItemType }}", Code: "{{ $value.Code }}", Throwable: {{ if eq $value.Throwable "1" }}true{{ else }}false{{ end }}, Beltable: {{ if eq $value.Beltable "1" }}true{{ else }}false{{ end }}},
|
||||
{{- end }}
|
||||
}`
|
||||
|
||||
const templateLevels = `// Code generated by cmd/txttocode. DO NOT EDIT.
|
||||
// source: cmd/txttocode/txt/levels.txt
|
||||
package area
|
||||
|
||||
var Areas = map[ID]Area{
|
||||
{{- range $key, $value := . }}
|
||||
{{ $key }}: {Name: "{{ $value.LevelName }}", ID: {{ $key }}},
|
||||
{{- end }}
|
||||
}`
|
||||
|
||||
const templateSkillDesc = `// Code generated by cmd/txttocode. DO NOT EDIT.
|
||||
// source: cmd/txttocode/txt/skilldesc.txt
|
||||
package skill
|
||||
|
||||
var Desc = map[ID]Description{
|
||||
{{- range $key, $value := . }}
|
||||
{{ $key }}: {Page: {{ $value.SkillPage }}, Row: {{ $value.SkillRow }}, Column: {{ $value.SkillColumn }}, ListRow: {{ $value.ListRow }}, IconCel: {{ $value.IconCel }}},
|
||||
{{- end }}
|
||||
}`
|
||||
|
||||
const templateSkills = `// Code generated by cmd/txttocode. DO NOT EDIT.
|
||||
// source: cmd/txttocode/txt/skills.txt
|
||||
package skill
|
||||
|
||||
var Skills = map[ID]Skill{
|
||||
{{- range $key, $value := . }}
|
||||
{{ index $value "*Id" }}: {Name: "{{ $value.skill }}", ID: {{ $key }}, LeftSkill: {{ if eq $value.leftskill "1" }}true{{ else }}false{{ end }}, RightSkill: {{ if eq $value.rightskill "1" }}true{{ else }}false{{ end }}},
|
||||
{{- end }}
|
||||
}`
|
||||
|
||||
const templateWeapons = `// Code generated by cmd/txttocode. DO NOT EDIT.
|
||||
// source: cmd/txttocode/txt/weapons.txt, cmd/txttocode/txt/armor.txt, cmd/txttocode/txt/misc.txt
|
||||
package item
|
||||
|
||||
var Desc = map[int]Description{
|
||||
{{- range $key, $value := . }}
|
||||
{{ $value.ID }}: {Name: "{{ $value.name }}", ID: {{ $value.ID }}, Code: "{{ $value.code }}", NormalCode: "{{ $value.normcode }}", UberCode: "{{ $value.ubercode }}", UltraCode: "{{ $value.ultracode }}", InventoryWidth: {{ $value.invwidth }}, InventoryHeight: {{ $value.invheight }}, MinDefense: {{ $value.minac }}, MaxDefense: {{ $value.maxac }}, Type: "{{ $value.type }}"},
|
||||
{{- end }}`
|
||||
|
||||
const templateArmorAndMisc = `
|
||||
{{- range $key, $value := . }}
|
||||
{{ $value.ID }}: {Name: "{{ $value.name }}", ID: {{ $value.ID }}, Code: "{{ $value.code }}", NormalCode: "{{ $value.normcode }}", UberCode: "{{ $value.ubercode }}", UltraCode: "{{ $value.ultracode }}", InventoryWidth: {{ $value.invwidth }}, InventoryHeight: {{ $value.invheight }}, MinDefense: {{ $value.minac }}, MaxDefense: {{ $value.maxac }}, Type: "{{ $value.type }}"},
|
||||
{{- end }}
|
||||
`
|
||||
Reference in New Issue
Block a user