d2

package
v1.0.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Dec 22, 2019 License: MIT Imports: 15 Imported by: 16

Documentation

Index

Constants

View Source
const (
	// ModMaphackIdentifier is the identifier we use to look for installs of maphack.
	ModMaphackIdentifier = "BH.dll"

	// ModHDIdentifier is the identifier we use to look for installs of hd mod.
	ModHDIdentifier = "D2HD.dll"
)
View Source
const (
	// GatewaySlashdiablo is the gateway option used if the user wants to connect to Slashdiablo.
	GatewaySlashdiablo = "Slashdiablo"

	// GatewayBattleNet is the gateway option used if the user wants to connect to the original Battle.net.
	GatewayBattleNet = "Battle.net"

	// SlashDiabloIP is the default IP for Slashdiablo.
	SlashDiabloIP = "play.slashdiablo.net"

	// BattleNetIP is the default Battle.net IP.
	BattleNetIP = "uswest.battle.net"
)

Variables

View Source
var (
	// ErrCRCFileNotFound is used when the file to be hashed didn't exist.
	ErrCRCFileNotFound = errors.New("file not found")
)

Functions

This section is empty.

Types

type Manifest

type Manifest struct {
	Files []PatchFile `json:"files"`
}

Manifest represents the current patch.

type PatchFile

type PatchFile struct {
	Name          string    `json:"name"`
	CRC           string    `json:"crc"`
	LastModified  time.Time `json:"last_modified"`
	ContentLength int64     `json:"content_length"`
}

PatchFile represents a file that should be patched.

type PatchState

type PatchState struct {
	Message string
	Error   error
}

PatchState represents the state given on every patch cycle.

type Service

type Service interface {
	// Exec is responsible for executing the Diablo II game.
	Exec() error

	// ValidateGameVersions will make sure the game is up to date with expected patch.
	ValidateGameVersions() (bool, error)

	// Patch will patch Diablo II to the correct version.
	Patch(done chan bool) (<-chan float32, <-chan PatchState)

	// ApplyDEP will apply Windows specific fix for DEP.
	ApplyDEP(path string) error

	// SetGateway is responsible for setting Battle.net gateway.
	SetGateway(gateway string) error
}

Service is responsible for all things related to the Slashdiablo ladder.

func NewService

func NewService(
	slashdiabloClient slashdiablo.Client,
	configuration config.Service,
	logger log.Logger,
) Service

NewService returns a service with all the dependencies.

type WriteCounter

type WriteCounter struct {
	Total   float32
	Written float32
	// contains filtered or unexported fields
}

WriteCounter counts the number of bytes written to it. It implements to the io.Writer interface and we can pass this into io.TeeReader() which will report progress on each write cycle.

func (*WriteCounter) Write

func (wc *WriteCounter) Write(p []byte) (int, error)

Write gets every write cycle reported on it.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL