Documentation ¶
Overview ¶
Package w3m implements basic information extraction functions for w3m/w3x files.
Example ¶
package main import ( "fmt" "github.com/nielsAD/gowarcraft3/file/w3m" ) func main() { m, err := w3m.Open("./test_tft.w3x") if err != nil { fmt.Println(err) return } defer m.Close() info, err := m.Info() if err != nil { fmt.Println(err) return } fmt.Println(info.Name) }
Output: Small Wars
Index ¶
- Variables
- type CustomTechAvailability
- type CustomUpgradeAvailability
- type Force
- type ForceFlags
- type GameCodeFormat
- type GameVersion
- type Hash
- type Info
- type Map
- func (m *Map) Checksum(stor *fs.Storage) (*Hash, error)
- func (m *Map) Close() error
- func (m *Map) ExpandString(s string) (string, error)
- func (m *Map) Info() (*Info, error)
- func (m *Map) MenuMinimap() (image.Image, error)
- func (m *Map) Minimap() (image.Image, error)
- func (m *Map) MinimapIcons() (image.Image, error)
- func (m *Map) Preview() (image.Image, error)
- func (m *Map) Signed() bool
- func (m *Map) TriggerStrings() (map[int]string, error)
- type MapFlags
- type MinimapIcon
- type Player
- type PlayerFlags
- type PlayerType
- type Race
- type Size
- type Tileset
- type UpgradeAvailability
Examples ¶
Constants ¶
This section is empty.
Variables ¶
var (
ErrBadFormat = errors.New("w3m: Invalid file format")
)
Errors
Functions ¶
This section is empty.
Types ¶
type CustomTechAvailability ¶
type CustomTechAvailability struct { PlayerSet protocol.BitSet32 TechID protocol.DWordString }
CustomTechAvailability in war3map.w3i file
type CustomUpgradeAvailability ¶
type CustomUpgradeAvailability struct { PlayerSet protocol.BitSet32 UpgradeID protocol.DWordString Level uint32 Availability UpgradeAvailability }
CustomUpgradeAvailability in war3map.w3i file
type Force ¶
type Force struct { Flags ForceFlags PlayerSet protocol.BitSet32 Name string }
Force structure in war3map.w3i file
type ForceFlags ¶
type ForceFlags uint32
ForceFlags enum
const ( ForceFlagAllied ForceFlags = 0x01 ForceFlagAlliedVictory ForceFlags = 0x02 )
Force Flags
func (ForceFlags) String ¶
func (f ForceFlags) String() string
type GameCodeFormat ¶
type GameCodeFormat uint32
GameCodeFormat of source code
const ( GameCodeFormatJASS GameCodeFormat = iota GameCodeFormatLua )
Triggers source code types
type GameVersion ¶
GameVersion stored in map file
type Info ¶
type Info struct { FileFormat uint32 SaveCount uint32 EditorVersion uint32 GameVersion GameVersion CodeFormat GameCodeFormat Name string Author string Description string SuggestedPlayers string CamBounds [8]float32 CamBoundsCompl [4]uint32 Width uint32 Height uint32 Flags MapFlags Tileset Tileset LsBackground uint32 LsPath string LsText string LsTitle string LsSubTitle string DataSet uint32 PsPath string PsText string PsTitle string PsSubTitle string Fog uint32 FogStart float32 FogEnd float32 FogDensity float32 FogColor uint32 WeatherID protocol.DWordString SoundEnv string LightEnv Tileset WaterColor uint32 Players []Player Forces []Force CustomUpgradeAvailabilities []CustomUpgradeAvailability CustomTechAvailabilities []CustomTechAvailability }
Info for Warcraft III maps as found in the war3map.w3i file
type Map ¶
Map refers to an w3m/w3x map (MPQ archive)
func (*Map) Checksum ¶
Checksum returns the content hash that identifies the map (used in version < 1.32)
func (*Map) ExpandString ¶
ExpandString expands trigger strings in s and returns the expanded string
func (*Map) MenuMinimap ¶
MenuMinimap returns the minimap with icons
func (*Map) MinimapIcons ¶
MinimapIcons returns an image with (just the) minimap icons
type MapFlags ¶
type MapFlags uint32
MapFlags enum
const ( MapFlagHideMinimap MapFlags = 0x0001 MapFlagModifyAllyPriorities MapFlags = 0x0002 MapFlagMelee MapFlags = 0x0004 MapFlagRevealTerrain MapFlags = 0x0010 MapFlagFixedPlayerSettings MapFlags = 0x0020 MapFlagCustomForces MapFlags = 0x0040 MapFlagCustomTechTree MapFlags = 0x0080 MapFlagCustomAbilities MapFlags = 0x0100 MapFlagCustomUpgrades MapFlags = 0x0200 MapFlagWaterWavesOnCliffShores MapFlags = 0x0800 MapFlagWaterWavesOnSlopeShores MapFlags = 0x1000 )
Map Flags
type MinimapIcon ¶
type MinimapIcon uint32
MinimapIcon enum
const ( IconGold MinimapIcon = iota IconNeutral IconCross )
MinimapIcon for preview
func (MinimapIcon) String ¶
func (i MinimapIcon) String() string
type Player ¶
type Player struct { ID uint32 Type PlayerType Race Race Flags PlayerFlags Name string StartPosX float32 StartPosY float32 AllyPrioLow protocol.BitSet32 AllyPrioHigh protocol.BitSet32 }
Player structure in war3map.w3i file
type PlayerFlags ¶
type PlayerFlags uint32
PlayerFlags enum
const (
PlayerFlagFixedPos PlayerFlags = 0x01
)
Player Flags
func (PlayerFlags) String ¶
func (f PlayerFlags) String() string
type PlayerType ¶
type PlayerType uint32
PlayerType enum
const ( PlayerHuman PlayerType = iota + 1 PlayerComputer PlayerNeutral PlayerRescuable )
Player types
func (PlayerType) String ¶
func (p PlayerType) String() string
type Size ¶
type Size uint8
Size enum
type Tileset ¶
type Tileset byte
Tileset enum
const ( TileAshenvale Tileset = 'A' TileBarrens Tileset = 'B' TileFelwood Tileset = 'C' TileDungeon Tileset = 'D' TileLordaeronFall Tileset = 'F' TileUnderground Tileset = 'G' TileLordaeronSummer Tileset = 'L' TileNorthrend Tileset = 'N' TileVillageFall Tileset = 'Q' TileVillage Tileset = 'V' TileLordaeronWinter Tileset = 'W' TileDalaran Tileset = 'X' TileCityscape Tileset = 'Y' TileSunkenRuins Tileset = 'Z' TileIcecrown Tileset = 'I' TileDalaranRuins Tileset = 'J' TileOutland Tileset = 'O' TileBlackCitadel Tileset = 'K' )
Tileset
type UpgradeAvailability ¶
type UpgradeAvailability uint32
UpgradeAvailability enum
const ( UpgradeAvailable UpgradeResearched )
Upgrade availabilities
func (UpgradeAvailability) String ¶
func (u UpgradeAvailability) String() string