database

package
v0.1.81 Latest Latest
Warning

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

Go to latest
Published: Aug 3, 2024 License: MIT Imports: 21 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var DenyListNameRegexes = []*regexp.Regexp{
	regexp.MustCompile(`30 Epic`),
	regexp.MustCompile(`63 Blue`),
	regexp.MustCompile(`63 Green`),
	regexp.MustCompile(`66 Epic`),
	regexp.MustCompile(`90 Epic`),
	regexp.MustCompile(`90 Green`),
	regexp.MustCompile(`Boots 1`),
	regexp.MustCompile(`Boots 2`),
	regexp.MustCompile(`Boots 3`),
	regexp.MustCompile(`Bracer 1`),
	regexp.MustCompile(`Bracer 2`),
	regexp.MustCompile(`Bracer 3`),
	regexp.MustCompile(`DB\d`),
	regexp.MustCompile(`DEPRECATED`),
	regexp.MustCompile(`Deprecated: Keanna`),
	regexp.MustCompile(`Indalamar`),
	regexp.MustCompile(`Monster -`),
	regexp.MustCompile(`NEW`),
	regexp.MustCompile(`PH`),
	regexp.MustCompile(`QR XXXX`),
	regexp.MustCompile(`TEST`),
	regexp.MustCompile(`Test`),
	regexp.MustCompile(`zOLD`),
}

If any of these match the item name, don't include it.

View Source
var EnchantOverrides = []*proto.UIEnchant{}/* 225 elements not displayed */
View Source
var ExtraItemIcons = []int32{}/* 106 elements not displayed */

Item icons to include in the DB, so they don't need to be separately loaded in the UI.

View Source
var GemAllowList = map[int32]struct{}{
	22459: {},
	36766: {},
	36767: {},
}
View Source
var GemDenyList = map[int32]struct{}{

	32735: {},
	34142: {},
	34143: {},
	35489: {},
	37430: {},
	38545: {},
	38546: {},
	38547: {},
	38548: {},
	38549: {},
	38550: {},
}
View Source
var GemOverrides = []*proto.UIGem{
	{Id: 33131, Stats: stats.Stats{stats.AttackPower: 32, stats.RangedAttackPower: 32}.ToFloatArray()},
}

Allows manual overriding for Gem fields in case WowHead is wrong.

View Source
var ItemAllowList = map[int32]struct{}{
	11815: {},
	12590: {},
	15808: {},
	18843: {},
	18844: {},
	18847: {},
	18848: {},
	19019: {},
	19808: {},
	20837: {},
	20966: {},
	21625: {},
	21685: {},
	24114: {},
	28572: {},
	28830: {},
	29383: {},
	29387: {},
	29994: {},
	29996: {},
	30032: {},
	30627: {},
	30720: {},
	31193: {},
	32387: {},
	32658: {},
	33135: {},
	33140: {},
	33143: {},
	33144: {},
	33504: {},
	33506: {},
	33507: {},
	33508: {},
	33510: {},
	33829: {},
	33831: {},
	34472: {},
	34473: {},
	37032: {},
	37574: {},
	38072: {},
	38212: {},
	38287: {},
	38289: {},
	39208: {},
	41752: {},
	6360:  {},
	8345:  {},
	9449:  {},

	27510: {},
	27802: {},
	27909: {},
	28231: {},
	28349: {},

	15056: {},
	15057: {},
	15058: {},
	21278: {},

	43068: {},
	43069: {},
	43070: {},
	43071: {},

	43072: {},
	43073: {},
	43074: {},
	43075: {},

	43076: {},
	43077: {},
	43078: {},
	43079: {},

	43080: {},
	43081: {},
	43082: {},
	43083: {},
}

Keep these sorted by item ID.

View Source
var ItemDenyList = map[int32]struct{}{
	17782: {},
	17783: {},
	17802: {},
	18582: {},
	18583: {},
	18584: {},
	24265: {},
	32384: {},
	32421: {},
	32422: {},
	33482: {},
	33350: {},
	34576: {},
	34577: {},
	34578: {},
	34579: {},
	34580: {},

	38694: {},
	45084: {},

	49312: {},
	49313: {},
	49314: {},

	50251: {},
	53500: {},

	48880: {},
	48881: {},
	48882: {},
	48883: {},
	48884: {},
	48885: {},
	48886: {},
	48887: {},
	48888: {},
	48889: {},
	48890: {},
	48891: {},
	48892: {},
	48893: {},
	48894: {},
	48895: {},
	48896: {},
	48897: {},
	48898: {},
	48899: {},
}

Keep these sorted by item ID.

View Source
var ItemOverrides = []*proto.UIItem{}/* 131 elements not displayed */
View Source
var OtherItemIdsToFetch = []string{

	"211817",
	"211844",
	"211847",
	"211850",
	"211851",
}
View Source
var SharedSpellsIcons = []int32{}/* 124 elements not displayed */

Raid buffs / debuffs

Functions

func GetBestRegexIntValue

func GetBestRegexIntValue(srcStr string, patterns []*regexp.Regexp, matchIdx int) int

func GetRegexIntValue

func GetRegexIntValue(srcStr string, pattern *regexp.Regexp, matchIdx int) int

func GetRegexStringValue

func GetRegexStringValue(srcStr string, pattern *regexp.Regexp, matchIdx int) string

func ParseItemFactionRestrictionsFromWagoDB added in v0.1.28

func ParseItemFactionRestrictionsFromWagoDB(dbContents string) map[int32]proto.UIItem_FactionRestriction

Types

type BlizzardAuthResponse

type BlizzardAuthResponse struct {
	AccessToken string `json:"access_token"`
}

type BlizzardItemResponse

type BlizzardItemResponse struct {
	ID   int    `json:"id"`
	Name string `json:"name"`

	Quality struct {
		Type string `json:"type"`
	} `json:"quality"`

	ItemClass struct {
		Id int `json:"id"`
	} `json:"item_class"`

	ItemSubclass struct {
		Id int `json:"id"`
	} `json:"item_subclass"`

	InventoryType struct {
		Type string `json:"type"`
	} `json:"inventory_type"`

	PreviewItem struct {
		Armor struct {
			Value int `json:"value"`
		} `json:"armor"`

		Stats []struct {
			Type struct {
				Type string `json:"type"`
			} `json:"type"`
			Value int `json:"value"`
		} `json:"stats"`
	} `json:"preview_item"`
}

There are more fields, these are just the ones we care about

func (BlizzardItemResponse) GetStatValue

func (item BlizzardItemResponse) GetStatValue(statType string) int

type ClassMask added in v0.1.78

type ClassMask uint16
const (
	ClassMaskWarrior     ClassMask = 1 << iota
	ClassMaskPaladin               // 2
	ClassMaskHunter                // 4
	ClassMaskRogue                 // 8
	ClassMaskPriest                // 16
	ClassMaskDeathKnight           // 32
	ClassMaskShaman                // 64
	ClassMaskMage                  // 128
	ClassMaskWarlock               // 256
	ClassMaskUnknown               // 512 seemingly unused?
	ClassMaskDruid                 // 1024
)

type EnchantDBKey

type EnchantDBKey struct {
	EffectID int32
	ItemID   int32
	SpellID  int32
}

func EnchantToDBKey

func EnchantToDBKey(enchant *proto.UIEnchant) EnchantDBKey

type ItemResponse

type ItemResponse interface {
	GetName() string
	GetQuality() int
	GetIcon() string
	TooltipWithoutSetBonus() string
	GetTooltipRegexString(pattern *regexp.Regexp, matchIdx int) string
	GetTooltipRegexValue(pattern *regexp.Regexp, matchIdx int) int
	GetIntValue(pattern *regexp.Regexp) int
	GetStats() Stats
	IsEquippable() bool
	GetItemLevel() int
	GetPhase() int
	GetUnique() bool
	GetItemType() proto.ItemType
	GetArmorType() proto.ArmorType
	GetWeaponType() proto.WeaponType
	GetHandType() proto.HandType
	GetRangedWeaponType() proto.RangedWeaponType
	GetWeaponDamage() (float64, float64)
	GetWeaponSpeed() float64
	GetGemSockets() []proto.GemColor
	GetSocketBonus() Stats
	GetSocketColor() proto.GemColor
	GetGemStats() Stats
	GetItemSetName() string
	IsHeroic() bool
	GetRequiredProfession() proto.Profession
}

type Stats

type Stats [35]float64

type TooltipManager

type TooltipManager struct {
	FilePath   string
	UrlPattern string
}

Generic class for fetching tooltip info from the web.

func (*TooltipManager) Fetch

func (tm *TooltipManager) Fetch(minId, maxId int32, otherIds []string)

func (*TooltipManager) FetchFromWeb added in v0.1.14

func (tm *TooltipManager) FetchFromWeb(idsToFetch []string) map[string]string

func (*TooltipManager) Read

func (tm *TooltipManager) Read() map[int32]string

type WotlkItemResponse

type WotlkItemResponse struct {
	ID      int32
	Name    string `json:"name"`
	Quality int    `json:"quality"`
	Icon    string `json:"icon"`
	Tooltip string `json:"tooltip"`
}

func NewWotlkItemResponse

func NewWotlkItemResponse(id int32, tooltip string) WotlkItemResponse

func (WotlkItemResponse) GetArmorType

func (item WotlkItemResponse) GetArmorType() proto.ArmorType

func (WotlkItemResponse) GetGemSockets

func (item WotlkItemResponse) GetGemSockets() []proto.GemColor

func (WotlkItemResponse) GetGemStats

func (item WotlkItemResponse) GetGemStats() Stats

func (WotlkItemResponse) GetHandType

func (item WotlkItemResponse) GetHandType() proto.HandType

func (WotlkItemResponse) GetIcon

func (item WotlkItemResponse) GetIcon() string

func (WotlkItemResponse) GetIntValue

func (item WotlkItemResponse) GetIntValue(pattern *regexp.Regexp) int

func (WotlkItemResponse) GetItemLevel

func (item WotlkItemResponse) GetItemLevel() int

func (WotlkItemResponse) GetItemSetName

func (item WotlkItemResponse) GetItemSetName() string

func (WotlkItemResponse) GetItemType

func (item WotlkItemResponse) GetItemType() proto.ItemType

func (WotlkItemResponse) GetName

func (item WotlkItemResponse) GetName() string

func (WotlkItemResponse) GetPhase

func (item WotlkItemResponse) GetPhase() int

WOTLK DB has no phase info

func (WotlkItemResponse) GetQuality

func (item WotlkItemResponse) GetQuality() int

func (WotlkItemResponse) GetRangedWeaponType

func (item WotlkItemResponse) GetRangedWeaponType() proto.RangedWeaponType

func (WotlkItemResponse) GetRequiredProfession

func (item WotlkItemResponse) GetRequiredProfession() proto.Profession

func (WotlkItemResponse) GetSocketBonus

func (item WotlkItemResponse) GetSocketBonus() Stats

func (WotlkItemResponse) GetSocketColor

func (item WotlkItemResponse) GetSocketColor() proto.GemColor

func (WotlkItemResponse) GetStats

func (item WotlkItemResponse) GetStats() Stats

func (WotlkItemResponse) GetTooltipRegexString

func (item WotlkItemResponse) GetTooltipRegexString(pattern *regexp.Regexp, matchIdx int) string

func (WotlkItemResponse) GetTooltipRegexValue

func (item WotlkItemResponse) GetTooltipRegexValue(pattern *regexp.Regexp, matchIdx int) int

func (WotlkItemResponse) GetUnique

func (item WotlkItemResponse) GetUnique() bool

func (WotlkItemResponse) GetWeaponDamage

func (item WotlkItemResponse) GetWeaponDamage() (float64, float64)

Returns min/max of weapon damage

func (WotlkItemResponse) GetWeaponSpeed

func (item WotlkItemResponse) GetWeaponSpeed() float64

func (WotlkItemResponse) GetWeaponType

func (item WotlkItemResponse) GetWeaponType() proto.WeaponType

func (WotlkItemResponse) IsEquippable

func (item WotlkItemResponse) IsEquippable() bool

func (WotlkItemResponse) IsHeroic

func (item WotlkItemResponse) IsHeroic() bool

func (WotlkItemResponse) IsPattern

func (item WotlkItemResponse) IsPattern() bool

func (WotlkItemResponse) IsRandomEnchant

func (item WotlkItemResponse) IsRandomEnchant() bool

func (WotlkItemResponse) TooltipWithoutSetBonus

func (item WotlkItemResponse) TooltipWithoutSetBonus() string

type WotlkTooltipManager

type WotlkTooltipManager struct {
	TooltipManager
}

func NewWotlkItemTooltipManager

func NewWotlkItemTooltipManager(filePath string) *WotlkTooltipManager

func (*WotlkTooltipManager) Read

type WowDatabase

type WowDatabase struct {
	Items    map[int32]*proto.UIItem
	Enchants map[EnchantDBKey]*proto.UIEnchant
	Gems     map[int32]*proto.UIGem

	Zones map[int32]*proto.UIZone
	Npcs  map[int32]*proto.UINPC

	ItemIcons  map[int32]*proto.IconData
	SpellIcons map[int32]*proto.IconData

	Encounters []*proto.PresetEncounter
	GlyphIDs   []*proto.GlyphID
}

func NewWowDatabase

func NewWowDatabase() *WowDatabase

func ReadAtlasLootData added in v0.1.14

func ReadAtlasLootData() *WowDatabase

func ReadDatabaseFromJson added in v0.1.14

func ReadDatabaseFromJson(jsonStr string) *WowDatabase

func (*WowDatabase) AddItemIcon

func (db *WowDatabase) AddItemIcon(id int32, tooltips map[int32]WowheadItemResponse)

func (*WowDatabase) AddSpellIcon

func (db *WowDatabase) AddSpellIcon(id int32, tooltips map[int32]WowheadItemResponse)

func (*WowDatabase) Clone added in v0.1.6

func (db *WowDatabase) Clone() *WowDatabase

func (*WowDatabase) MergeEnchant

func (db *WowDatabase) MergeEnchant(src *proto.UIEnchant)

func (*WowDatabase) MergeEnchants

func (db *WowDatabase) MergeEnchants(arr []*proto.UIEnchant)

func (*WowDatabase) MergeGem

func (db *WowDatabase) MergeGem(src *proto.UIGem)

func (*WowDatabase) MergeGems

func (db *WowDatabase) MergeGems(arr []*proto.UIGem)

func (*WowDatabase) MergeItem

func (db *WowDatabase) MergeItem(src *proto.UIItem)

func (*WowDatabase) MergeItems

func (db *WowDatabase) MergeItems(arr []*proto.UIItem)

func (*WowDatabase) MergeNpc added in v0.1.14

func (db *WowDatabase) MergeNpc(src *proto.UINPC)

func (*WowDatabase) MergeNpcs added in v0.1.14

func (db *WowDatabase) MergeNpcs(arr []*proto.UINPC)

func (*WowDatabase) MergeZone added in v0.1.14

func (db *WowDatabase) MergeZone(src *proto.UIZone)

func (*WowDatabase) MergeZones added in v0.1.14

func (db *WowDatabase) MergeZones(arr []*proto.UIZone)

func (*WowDatabase) ToUIProto added in v0.1.14

func (db *WowDatabase) ToUIProto() *proto.UIDatabase

func (*WowDatabase) WriteBinary added in v0.1.14

func (db *WowDatabase) WriteBinary(binFilePath string)

func (*WowDatabase) WriteBinaryAndJson

func (db *WowDatabase) WriteBinaryAndJson(binFilePath, jsonFilePath string)

func (*WowDatabase) WriteJson added in v0.1.14

func (db *WowDatabase) WriteJson(jsonFilePath string)

type WowheadDatabase added in v0.1.14

type WowheadDatabase struct {
	Items map[string]WowheadItem
}

func ParseWowheadDB added in v0.1.14

func ParseWowheadDB(dbContents string) WowheadDatabase

type WowheadItem added in v0.1.14

type WowheadItem struct {
	ID   int32  `json:"id"`
	Name string `json:"name"`
	Icon string `json:"icon"`

	Quality int32 `json:"quality"`
	Ilvl    int32 `json:"itemLevel"`
	Phase   int32 `json:"contentPhase"`

	RaceMask  uint16 `json:"raceMask"`
	ClassMask uint16 `json:"classMask"`

	Stats WowheadItemStats `json:"stats"`

	SourceTypes   []int32             `json:"source"` // 1 = Crafted, 2 = Dropped by, 3 = sold by zone vendor? barely used, 4 = Quest, 5 = Sold by
	SourceDetails []WowheadItemSource `json:"sourcemore"`
}

func (WowheadItem) ToProto added in v0.1.14

func (wi WowheadItem) ToProto() *proto.UIItem

type WowheadItemResponse

type WowheadItemResponse struct {
	ID      int32
	Name    string `json:"name"`
	Quality int    `json:"quality"`
	Icon    string `json:"icon"`
	Tooltip string `json:"tooltip"`
}

func NewWowheadItemResponse

func NewWowheadItemResponse(id int32, tooltip string) WowheadItemResponse

func (WowheadItemResponse) GetArmorType

func (item WowheadItemResponse) GetArmorType() proto.ArmorType

func (WowheadItemResponse) GetArmorValues added in v0.1.28

func (item WowheadItemResponse) GetArmorValues() (int, int)

func (WowheadItemResponse) GetGemSockets

func (item WowheadItemResponse) GetGemSockets() []proto.GemColor

func (WowheadItemResponse) GetGemStats

func (item WowheadItemResponse) GetGemStats() Stats

func (WowheadItemResponse) GetHandType

func (item WowheadItemResponse) GetHandType() proto.HandType

func (WowheadItemResponse) GetIcon

func (item WowheadItemResponse) GetIcon() string

func (WowheadItemResponse) GetIntValue

func (item WowheadItemResponse) GetIntValue(pattern *regexp.Regexp) int

func (WowheadItemResponse) GetItemLevel

func (item WowheadItemResponse) GetItemLevel() int

func (WowheadItemResponse) GetItemSetName

func (item WowheadItemResponse) GetItemSetName() string

func (WowheadItemResponse) GetItemType

func (item WowheadItemResponse) GetItemType() proto.ItemType

func (WowheadItemResponse) GetName

func (item WowheadItemResponse) GetName() string

func (WowheadItemResponse) GetPhase

func (item WowheadItemResponse) GetPhase() int

func (WowheadItemResponse) GetQuality

func (item WowheadItemResponse) GetQuality() int

func (WowheadItemResponse) GetRangedWeaponType

func (item WowheadItemResponse) GetRangedWeaponType() proto.RangedWeaponType

func (WowheadItemResponse) GetRequiredProfession

func (item WowheadItemResponse) GetRequiredProfession() proto.Profession

func (WowheadItemResponse) GetSocketBonus

func (item WowheadItemResponse) GetSocketBonus() Stats

func (WowheadItemResponse) GetSocketColor

func (item WowheadItemResponse) GetSocketColor() proto.GemColor

func (WowheadItemResponse) GetStats

func (item WowheadItemResponse) GetStats() Stats

func (WowheadItemResponse) GetTooltipRegexString

func (item WowheadItemResponse) GetTooltipRegexString(pattern *regexp.Regexp, matchIdx int) string

func (WowheadItemResponse) GetTooltipRegexValue

func (item WowheadItemResponse) GetTooltipRegexValue(pattern *regexp.Regexp, matchIdx int) int

func (WowheadItemResponse) GetUnique

func (item WowheadItemResponse) GetUnique() bool

func (WowheadItemResponse) GetWeaponDamage

func (item WowheadItemResponse) GetWeaponDamage() (float64, float64)

Returns min/max of weapon damage

func (WowheadItemResponse) GetWeaponSpeed

func (item WowheadItemResponse) GetWeaponSpeed() float64

func (WowheadItemResponse) GetWeaponType

func (item WowheadItemResponse) GetWeaponType() proto.WeaponType

func (WowheadItemResponse) IsEquippable

func (item WowheadItemResponse) IsEquippable() bool

func (WowheadItemResponse) IsGem

func (item WowheadItemResponse) IsGem() bool

func (WowheadItemResponse) IsHeroic

func (item WowheadItemResponse) IsHeroic() bool

func (WowheadItemResponse) IsPattern

func (item WowheadItemResponse) IsPattern() bool

func (WowheadItemResponse) IsRandomEnchant

func (item WowheadItemResponse) IsRandomEnchant() bool

func (WowheadItemResponse) IsScalableArmorSlot added in v0.1.28

func (item WowheadItemResponse) IsScalableArmorSlot() bool

func (WowheadItemResponse) ToGemProto

func (item WowheadItemResponse) ToGemProto() *proto.UIGem

func (WowheadItemResponse) ToItemProto

func (item WowheadItemResponse) ToItemProto() *proto.UIItem

func (WowheadItemResponse) TooltipWithoutSetBonus

func (item WowheadItemResponse) TooltipWithoutSetBonus() string

type WowheadItemSource added in v0.1.14

type WowheadItemSource struct {
	C        int32  `json:"c"`
	Name     string `json:"n"`    // Name of crafting spell
	Icon     string `json:"icon"` // Icon corresponding to the named entity
	EntityID int32  `json:"ti"`   // Crafting Spell ID / NPC ID / ?? / Quest ID
	ZoneID   int32  `json:"z"`    // Only for drop / sold by sources
}

type WowheadItemStats added in v0.1.14

type WowheadItemStats struct {
	Armor int32 `json:"armor"`
}

type WowheadTooltipManager

type WowheadTooltipManager struct {
	TooltipManager
}

func NewWowheadItemTooltipManager

func NewWowheadItemTooltipManager(filePath string) *WowheadTooltipManager

func NewWowheadSpellTooltipManager

func NewWowheadSpellTooltipManager(filePath string) *WowheadTooltipManager

func (*WowheadTooltipManager) Read

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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