inventory

package
v0.0.14 Latest Latest
Warning

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

Go to latest
Published: Dec 28, 2019 License: MIT Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func InventoryResultString

func InventoryResultString(ir InvResult) string

Types

type InvItem

type InvItem struct {
	ItemID int
	Count  int
}

func (*InvItem) IDs

func (item *InvItem) IDs() []int

IDs generates the list of item IDs corresponding to a given inventory item.

type InvParams

type InvParams struct {
	Name       string
	Level      int
	SkillClass skill.SkillClass
	Skills     []decode.CharSkill
	Cfg        npcdefs.NPCCfg
}

type InvResult

type InvResult struct {
	// Intermediate data.
	RankedWeapons []RankedWeapon
	WeaponItems   []InvItem
	ArmorID       int
	EtcItems      []InvItem

	// Final Result
	ItemIDs   []int
	WeaponIdx int
	ArmorIdx  int
	Cash      int
}

func CalcInventory

func CalcInventory(params InvParams) *InvResult

CalcInventory calculates an NPC's set of items.

func (*InvResult) Replace

func (ir *InvResult) Replace(ch *decode.Character) error

Overwrites an NPC's inventory with the results of an inventory calculation.

type RankedWeapon

type RankedWeapon struct {
	AllWeaponIDs []int // All IDs having the relevant weapon type.
	WeaponID     int   // The selected weapon ID.
	SkillLevel   int   // Level of the relevant weapon skill.
	Rank         int
}

RankedWeapon is an abstraction of a set of weapon items. An NPC gets up to three ranked weapons: primary, secondary, and tertiary.

func (*RankedWeapon) Items

func (rw *RankedWeapon) Items(skills []decode.CharSkill, cfg npcdefs.NPCCfg) []InvItem

Items converts a ranked weapon to an appropriate item set. Non-reusable weapons are expanded to an item set. Guns are expanded to include clips.

Jump to

Keyboard shortcuts

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