wdb

package
v0.0.0-...-382259f Latest Latest
Warning

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

Go to latest
Published: Jan 25, 2021 License: GPL-3.0 Imports: 11 Imported by: 0

Documentation

Overview

Package wdb contains the Worldserver databases. For server content, in-memory databases are utilized to maximize performance. For character-generated data, a SQL backend is used.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetID

func GetID(value reflect.Value) string

func GetName

func GetName(value reflect.Value) string

func SetEntry

func SetEntry(value reflect.Value, entry uint32)

func SortNamedTemplates

func SortNamedTemplates(value reflect.Value)

Types

type AccountProp

type AccountProp struct {
	ID   uint64 `xorm:"'id' pk"` // Account
	Prop PropID `xorm:"'prop' char(8)"`
}

An account having this property will

type ActionButton

type ActionButton struct {
	Player uint64 `xorm:"'player' index"`
	Button uint8
	Action uint32
	Type   uint8
	Misc   uint8
}

ActionButton stores all the buttons a player has in their action bars.

type Character

type Character struct {
	ID          uint64 `json:"id" xorm:"'id' pk autoincr"`
	GameAccount uint64 `json:"gameAccount"`
	Name        string `json:"name"`
	Faction     uint32 `json:"faction"`
	FirstLogin  bool
	Level       uint32 `json:"level"`
	XP          uint32
	RealmID     uint64     `json:"realmID" xorm:"'realm_id'"`
	Race        uint8      `json:"race"`
	Class       uint8      `json:"class"`
	Gender      uint8      `json:"gender"`
	Skin        uint8      `json:"skin"`
	Face        uint8      `json:"face"`
	HairStyle   uint8      `json:"hairStyle"`
	HairColor   uint8      `json:"hairColor"`
	FacialHair  uint8      `json:"facialHair"`
	Coinage     econ.Money `json:"coinage"`
	Zone        uint32     `json:"zone"`
	Map         uint32     `json:"map"`
	X           float32    `json:"x"`
	Y           float32    `json:"y"`
	Z           float32    `json:"z"`
	O           float32    `json:"o"`
	Leader      uint64
	Guild       uint64
	HideHelm    bool
	HideCloak   bool
	Ghost       bool
}

Character describes a Player/Session's character attributes.

type Contact

type Contact struct {
	Player   uint64 `xorm:"'player' index"`
	Friend   uint64 `xorm:"'friend'"`
	Friended bool   `xorm:"'friended'"`
	Ignored  bool   `xorm:"'ignored'"`
	Muted    bool   `xorm:"'muted'"`
	Note     string `xorm:"'note'"`
}

Contact describes the friend and ignore statuses of a Player in relation to another Player.

type Core

type Core struct {
	*xorm.Engine
	DataStores map[reflect.Type]*Store
}

func NewCore

func NewCore(driver, source string) (*Core, error)

func (*Core) ClearData

func (c *Core) ClearData(typ reflect.Type)

func (*Core) GetData

func (c *Core) GetData(key, ptrTo interface{})

func (*Core) GetGameObjectTemplate

func (c *Core) GetGameObjectTemplate(id string) (*GameObjectTemplate, error)

func (*Core) GetGameObjectTemplateByEntry

func (c *Core) GetGameObjectTemplateByEntry(entry uint32) (*GameObjectTemplate, error)

func (*Core) GetItemTemplate

func (c *Core) GetItemTemplate(id string) (*ItemTemplate, error)

func (*Core) GetItemTemplateByEntry

func (c *Core) GetItemTemplateByEntry(entry uint32) (*ItemTemplate, error)

func (*Core) GetStore

func (c *Core) GetStore(in interface{}) *Store

func (*Core) SearchTemplates

func (c *Core) SearchTemplates(nameString string, max int64, sliceInterface interface{}) error

func (*Core) StoreData

func (c *Core) StoreData(value reflect.Value)

type CreatureTemplate

type CreatureTemplate struct {
	ID              string
	Entry           uint32    `xorm:"'entry'"`
	Name            i18n.Text `xorm:"'name'"`
	SubName         i18n.Text `xorm:"'sub_name'"`
	MinLevel        uint32    `xorm:"'min_level'"`
	MaxLevel        uint32    `xorm:"'max_level'"`
	DisplayIDs      []uint32  `xorm:"'display_ids'"`
	Faction         uint32    `xorm:"'faction'"`
	Scale           float32   `xorm:"'scale'"`
	Family          string    `xorm:"'family'"`
	CreatureType    uint32    `xorm:"'creature_type'"`
	InhabitType     uint32    `xorm:"'inhabit_type'"`
	RegenerateStats uint32    `xorm:"'regenerateStats'"`
	RacialLeader    bool      `xorm:"'racialLeader'"`
	// NpcFlags: should not tied to any particular version.
	Gossip         bool
	QuestGiver     bool
	Vendor         bool
	FlightMaster   bool
	Trainer        bool
	SpiritHealer   bool
	SpiritGuide    bool
	Innkeeper      bool
	Banker         bool
	Petitioner     bool
	TabardDesigner bool
	BattleMaster   bool
	Auctioneer     bool
	StableMaster   bool
	Repairer       bool
	OutdoorPVP     bool

	// UnitFlags: should not tied to any particular version.
	ServerControlled    bool // 0x1
	NonAttackable       bool // 0x2
	RemoveClientControl bool // 0x4
	PlayerControlled    bool // 0x8
	Rename              bool // 0x10
	PetAbandon          bool // 0x20
	OOCNotAttackable    bool // 0x100
	Passive             bool // 0x200
	PVP                 bool // 0x1000
	IsSilenced          bool // 0x2000
	IsPersuaded         bool // 0x4000
	Swimming            bool // 0x8000
	RemoveAttackIcon    bool // 0x10000
	IsPacified          bool // 0x20000
	IsStunned           bool // 0x40000
	InCombat            bool // 0x80000
	InTaxiFlight        bool // 0x100000
	Disarmed            bool // 0x200000
	Confused            bool // 0x400000
	Fleeing             bool // 0x800000
	Possessed           bool // 0x1000000
	NotSelectable       bool // 0x2000000
	Skinnable           bool // 0x4000000
	AurasVisible        bool // 0x8000000
	Sheathe             bool // 0x40000000
	NoKillReward        bool // 0x80000000

	// DynamicFlags: should not tied to any particular version.
	Lootable              bool
	TrackUnit             bool
	Tapped                bool
	TappedByPlayer        bool
	SpecialInfo           bool
	VisuallyDead          bool
	TappedByAllThreatList bool

	// Extra flags
	InstanceBind             bool // creature kill bind instance with killer and killer’s group
	NoAggroOnSight           bool // no aggro (ignore faction/reputation hostility)
	NoParry                  bool // creature can’t parry
	NoParryHasten            bool // creature can’t counter-attack at parry
	NoBlock                  bool //	creature can’t block
	NoCrush                  bool // creature can’t do crush attacks
	NoXPAtKill               bool // creature kill not provide XP
	Invisible                bool // creature is always invisible for player (mostly trigger creatures)
	NotTauntable             bool // creature is immune to taunt auras and effect attack me
	AggroZone                bool // creature sets itself in combat with zone on aggro
	Guard                    bool // creature is a guard
	NoCallAssist             bool // creature shouldn’t call for assistance on aggro
	Active                   bool //creature is active object. Grid of this creature will be loaded and creature set as active
	ForceEnableMMap          bool // creature is forced to use MMaps
	ForceDisableMMap         bool // creature is forced to NOT use MMaps
	WalkInWater              bool // creature is forced to walk in water even it can swim
	Civilian                 bool // CreatureInfo→civilian substitute (for expansions as Civilian Colum was removed)
	NoMelee                  bool // creature can’t melee
	FarView                  bool // creature with far view
	ForceAttackingCapability bool // SetForceAttackingCapability(true); for nonattackable, nontargetable creatures that should be able to attack nontheless
	IgnoreUsedPosition       bool // ignore creature when checking used positions around target
	CountSpawns              bool // count creature spawns in Map*
	HasteSpellImmunity       bool // immunity to COT or Mind Numbing Poison – very common in instances

	// CreatureTypeFlags    uint32     `xorm:"'creatureTypeFlags'"`
	Tameable                bool // Makes the mob tameable (must also be a beast and have family set)
	VisibleToGhosts         bool // Sets Creatures that can ALSO be seen when player is a ghost. Used in CanInteract function by client, can’t be attacked
	BossLevel               bool
	DontPlayWoundParryAnim  bool
	HideFactionTooltip      bool // Controls something in client tooltip related to creature faction
	SpellAttackable         bool
	DeadInteract            bool // Player can interact with the creature if its dead (not player dead)
	HerbLoot                bool // Uses Skinning Loot Field
	MiningLoot              bool // Makes Mob Corpse Mineable – Uses Skinning Loot Field
	DontLogDeath            bool // Does not combatlog death.
	MountedCombat           bool
	CanAssist               bool // Can aid any player or group in combat. Typically seen for escorting NPC’s
	PetHasActionBar         bool // checked from calls in Lua_PetHasActionBar
	MaskUID                 bool
	EngineerLoot            bool // Makes Mob Corpse Engineer Lootable – Uses Skinning Loot Field
	ExoticPet               bool // Tamable as an exotic pet. Normal tamable flag must also be set.
	UseDefaultCollisionBox  bool
	IsSiegeWeapon           bool
	ProjectileCollision     bool
	HideNameplate           bool
	DontPlayMountedAnim     bool
	IsLinkAll               bool
	InteractOnlyWithCreator bool
	ForceGossip             bool

	SpeedWalk            float32    `xorm:"'speedWalk'"`
	SpeedRun             float32    `xorm:"'speedRun'"`
	UnitClass            uint32     `xorm:"'unitClass'"`
	Rank                 uint32     `xorm:"'rank'"`
	HealthMultiplier     float32    `xorm:"'healthMultiplier'"`
	PowerMultiplier      float32    `xorm:"'powerMultiplier'"`
	DamageMultiplier     float32    `xorm:"'damageMultiplier'"`
	DamageVariance       float32    `xorm:"'damageVariance'"`
	ArmorMultiplier      float32    `xorm:"'armorMultiplier'"`
	ExperienceMultiplier float32    `xorm:"'experienceMultiplier'"`
	MinLevelHealth       uint32     `xorm:"'minLevelHealth'"`
	MaxLevelHealth       uint32     `xorm:"'maxLevelHealth'"`
	MinLevelMana         uint32     `xorm:"'minLevelMana'"`
	MaxLevelMana         uint32     `xorm:"'maxLevelMana'"`
	MinMeleeDmg          float32    `xorm:"'minMeleeDmg'"`
	MaxMeleeDmg          float32    `xorm:"'maxMeleeDmg'"`
	MinRangedDmg         float32    `xorm:"'minRangedDmg'"`
	MaxRangedDmg         float32    `xorm:"'maxRangedDmg'"`
	Armor                uint32     `xorm:"'armor'"`
	MeleeAttackPower     uint32     `xorm:"'meleeAttackPower'"`
	RangedAttackPower    uint32     `xorm:"'rangedAttackPower'"`
	MeleeBaseAttackTime  uint32     `xorm:"'meleeBaseAttackTime'"`
	RangedBaseAttackTime uint32     `xorm:"'mangedBaseAttackTime'"`
	DamageSchool         int32      `xorm:"'damageSchool'"`
	MinLootGold          econ.Money `xorm:"'minLootGold'"`
	MaxLootGold          econ.Money `xorm:"'maxLootGold'"`
	LootId               uint32     `xorm:"'lootId'"`
	PickpocketLootId     uint32     `xorm:"'pickpocketLootId'"`
	SkinningLootId       uint32     `xorm:"'skinningLootId'"`
	KillCredit1          uint32     `xorm:"'killCredit1'"`
	KillCredit2          uint32     `xorm:"'killCredit2'"`
	MechanicImmuneMask   uint32     `xorm:"'mechanicImmuneMask'"`
	SchoolImmuneMask     uint32     `xorm:"'schoolImmuneMask'"`
	ResistanceHoly       int32      `xorm:"'resistanceHoly'"`
	ResistanceFire       int32      `xorm:"'resistanceFire'"`
	ResistanceNature     int32      `xorm:"'resistanceNature'"`
	ResistanceFrost      int32      `xorm:"'resistanceFrost'"`
	ResistanceShadow     int32      `xorm:"'resistanceShadow'"`
	ResistanceArcane     int32      `xorm:"'resistanceArcane'"`
	PetSpellDataId       uint32     `xorm:"'petSpellDataId'"`
	MovementType         uint32     `xorm:"'movementType'"`
	TrainerType          int32      `xorm:"'trainerType'"`
	TrainerSpell         uint32     `xorm:"'trainerSpell'"`
	TrainerClass         uint32     `xorm:"'trainerClass'"`
	TrainerRace          uint32     `xorm:"'trainerRace'"`
	TrainerTemplateId    uint32     `xorm:"'trainerTemplateId'"`
	VendorTemplateId     uint32     `xorm:"'vendorTemplateId'"`
	GossipMenuId         string     `xorm:"'gossipMenuId'"`
	EquipmentTemplateId  uint32     `xorm:"'equipmentTemplateId'"`
	DishonourableKill    bool       `xorm:"'dishonourable_kill'"`
	AIName               string     `xorm:"'aIName'"`
	ScriptName           string     `xorm:"'script_name'"`
}

type ExploredZone

type ExploredZone struct {
	Player uint64 `xorm:"'player' index"`
	ZoneID uint32 `xorm:"'zone_id'"` // The actual zone ID, not the flag.
}

ExploredZone lists a player, and the zones which that player has explored in their map.

type GameObjectTemplate

type GameObjectTemplate struct {
	ID             string `xorm:"'id' index"`
	Entry          uint32 `csv:"-" xorm:"'entry' bigint pk"`
	Type           uint32
	DisplayID      uint32 `xorm:"'display_id'"`
	Name           i18n.Text
	IconName       string
	CastBarCaption string
	Faction        uint32
	Flags          update.GameObjectFlags
	HasCustomAnim  bool
	Size           float32
	Data           []uint32
	MinGold        econ.Money
	MaxGold        econ.Money
}

type Inventory

type Inventory struct {
	ItemID uint64 `xorm:"'item_id' pk"`
	Player uint64 `xorm:"'player' index"`
	Bag    uint8  `xorm:"'bag'"`
	Slot   uint8  `xorm:"'slot'"`
}

Inventory describes the positions of items/item stacks in a player's inventory.

type Item

type Item struct {
	ID           uint64 `xorm:"'id' pk autoincr"`
	Creator      uint64 `xorm:"'creator'"` // player UID
	ItemType     uint32 `xorm:"'item_type'"`
	ItemID       string `xorm:"'item_id'"`
	DisplayID    uint32 `xorm:"'display_id'"`
	StackCount   uint32 `xorm:"'stack_count'"`
	Enchantments []uint32
	Charges      []int32 `xorm:"'charges'"`
}

Item describes a *spawned* item. For the item's constant attributes, refer to ItemTemplate.

type ItemDamage

type ItemDamage struct {
	Type uint8
	Min  float32
	Max  float32
}

type ItemSocket

type ItemSocket struct {
	Color   int32
	Content int32
}

type ItemSpell

type ItemSpell struct {
	ID               uint32
	Trigger          uint32
	Charges          int32
	PPMRate          float32
	Cooldown         int64
	Category         uint32
	CategoryCooldown int64
}

type ItemStat

type ItemStat struct {
	Type  uint8
	Value int32
}

type ItemTemplate

type ItemTemplate struct {
	Entry                     uint32          `json:",omitempty" xorm:"'entry' bigint pk" csv:"-"`
	ID                        string          `json:",omitempty" xorm:"'id' index"`
	Name                      i18n.Text       `json:",omitempty" xorm:"'name' index"`
	Class                     uint32          `json:",omitempty" xorm:"'class'"`
	Subclass                  uint32          `json:",omitempty" xorm:"'subclass'"`
	DisplayID                 uint32          `json:",omitempty" xorm:"'display_id'"`
	Quality                   uint8           `json:",omitempty" xorm:"'quality'"`
	Flags                     update.ItemFlag `json:",omitempty" xorm:"'flags'"`
	BuyCount                  uint8           `json:",omitempty" xorm:"'buy_count'"`
	BuyPrice                  uint32          `json:",omitempty" xorm:"'buy_price'"`
	SellPrice                 uint32          `json:",omitempty" xorm:"'sell_price'"`
	InventoryType             uint8           `json:",omitempty" xorm:"'inv_type'"`
	AllowableClass            int32           `json:",omitempty" xorm:"'allowable_class'"`
	AllowableRace             int32           `json:",omitempty" xorm:"'allowable_race'"`
	ItemLevel                 uint32          `json:",omitempty" xorm:"'item_level'"`
	RequiredLevel             uint8           `json:",omitempty" xorm:"'required_level'"`
	RequiredSkill             uint32          `json:",omitempty" xorm:"'required_skill'"`
	RequiredSkillRank         uint32          `json:",omitempty" xorm:"'required_skill_rank'"`
	RequiredSpell             uint32          `json:",omitempty" xorm:"'required_spell'"`
	RequiredHonorRank         uint32          `json:",omitempty" xorm:"'required_honor_rank'"`
	RequiredCityRank          uint32          `json:",omitempty" xorm:"'required_city_rank'"`
	RequiredReputationFaction uint32          `json:",omitempty" xorm:"'required_reputation_faction'"`
	RequiredReputationRank    uint32          `json:",omitempty" xorm:"'required_reputation_rank'"`
	MaxCount                  uint32          `json:",omitempty" xorm:"'max_count'"`
	Stackable                 uint32          `json:",omitempty" xorm:"'stackable'"`
	ContainerSlots            uint8           `json:",omitempty" xorm:"'container_slots'"`
	Stats                     []ItemStat      `json:",omitempty" xorm:"'stats'"`
	Damage                    []ItemDamage    `json:",omitempty" xorm:"'dmg'"`
	Armor                     uint32          `json:",omitempty" xorm:"'armor'"`
	HolyRes                   uint32          `json:",omitempty" xorm:"'holy_res'"`
	FireRes                   uint32          `json:",omitempty" xorm:"'fire_res'"`
	NatureRes                 uint32          `json:",omitempty" xorm:"'nature_res'"`
	FrostRes                  uint32          `json:",omitempty" xorm:"'frost_res'"`
	ShadowRes                 uint32          `json:",omitempty" xorm:"'shadow_res'"`
	ArcaneRes                 uint32          `json:",omitempty" xorm:"'arcane_res'"`
	Delay                     uint32          `json:",omitempty" xorm:"'delay'"`
	AmmoType                  uint32          `json:",omitempty" xorm:"'ammo_type'"`
	RangedModRange            float32         `json:",omitempty" xorm:"'ranged_mod_range'"`
	Spells                    []ItemSpell     `json:",omitempty" xorm:"'spells'"`
	Bonding                   uint8           `json:",omitempty" xorm:"'bonding'"`
	Description               i18n.Text       `json:",omitempty" xorm:"'description' longtext"`
	PageText                  uint32          `json:",omitempty" xorm:"'page_text"`
	LanguageID                uint32          `json:",omitempty" xorm:"'language_id'"`
	PageMaterial              uint32          `json:",omitempty" xorm:"'page_material'"`
	StartQuest                uint32          `json:",omitempty" xorm:"'start_quest'"`
	LockID                    uint32          `json:",omitempty" xorm:"'lock_id'"`
	Material                  int32           `json:",omitempty" xorm:"'material'"`
	Sheath                    uint32          `json:",omitempty" xorm:"'sheath'"`
	RandomProperty            uint32          `json:",omitempty" xorm:"'random_property'"`
	RandomSuffix              uint32          `json:",omitempty" xorm:"'random_suffix'"`
	Block                     uint32          `json:",omitempty" xorm:"'block'"`
	Itemset                   uint32          `json:",omitempty" xorm:"'itemset'"`
	MaxDurability             uint32          `json:",omitempty" xorm:"'max_durability'"`
	Area                      uint32          `json:",omitempty" xorm:"'area'"`
	Map                       int32           `json:",omitempty" xorm:"'map'"`
	BagFamily                 int32           `json:",omitempty" xorm:"'bag_family'"`
	TotemCategory             int32           `json:",omitempty" xorm:"'totem_category'"`
	Socket                    []ItemSocket    `json:",omitempty" xorm:"'sockets'"`
	SocketBonus               uint32
	GemProperties             int32      `json:",omitempty" xorm:"'gem_properties'"`
	RequiredDisenchantSkill   int32      `json:",omitempty" xorm:"'required_disenchant_skill'"`
	ArmorDamageModifier       float32    `json:",omitempty" xorm:"'armor_damage_modifier'"`
	ItemLimitCategory         int32      `json:",omitempty" xorm:"'item_limit_category'"`
	ScriptName                string     `json:",omitempty" xorm:"'script_name'"`
	DisenchantID              uint32     `json:",omitempty" xorm:"'disenchant_id'"`
	FoodType                  uint8      `json:",omitempty" xorm:"'food_type'"`
	MinMoneyLoot              econ.Money `json:",omitempty" xorm:"'min_money_loot'"`
	MaxMoneyLoot              econ.Money `json:",omitempty" xorm:"'max_money_loot'"`
	Duration                  int32      `json:",omitempty" xorm:"'duration'"`
	ExtraFlags                uint8      `json:",omitempty" xorm:"'extra_flags'"`
}

type LearnedAbility

type LearnedAbility struct {
	Player uint64 `xorm:"'player' index"`
	Spell  uint32 `xorm:"'spell'"`
	Active bool   `xorm:"'active'"`
}

LearnedAbility lists all the abilities/spells a player has learned.

type LevelExperience

type LevelExperience map[uint32]uint32

type LocString

type LocString struct {
	ID   string
	Text i18n.Text
}

type Map

type Map struct {
	ID           uint32
	Directory    string
	InstanceType uint32
	MapType      uint32
	Name         string
	MinLevel     uint32
	MaxLevel     uint32
	MaxPlayers   uint32
	Descriptions []string
}

func (Map) GetDirectory

func (m Map) GetDirectory() string

type NPCText

type NPCText struct {
	ID    string
	Entry uint32
	Opts  []NPCTextOption
}

type NPCTextOption

type NPCTextOption struct {
	Text  i18n.Text
	Lang  uint32
	Prob  float32
	Emote []NPCTextOptionEmote
}

type NPCTextOptionEmote

type NPCTextOptionEmote struct {
	Delay uint32
	ID    uint32
}

type ObjectTemplateRegistry

type ObjectTemplateRegistry struct {
	ID    string      `xorm:"'id' pk"`
	Type  guid.TypeID `xorm:"'type'"`
	Entry uint32
}

ObjectTemplateRegistry contains the resolved IDs of a custom object template (think custom items and creatures) It allows you to add and remove new content and (hopefully) avoid conflicts between the client's WDB cache and the server's in-memory database.

type PlayerCreateAbility

type PlayerCreateAbility struct {
	Race   int8
	Class  int8
	Spell  uint32
	Note   string
	Active bool
}

type PlayerCreateActionButton

type PlayerCreateActionButton struct {
	Race   int8
	Class  int8
	Button uint8
	Action uint32
	Type   uint8
	Misc   uint8
}

type PlayerCreateInfo

type PlayerCreateInfo struct {
	Race  uint8
	Class uint8
	Map   uint32
	Zone  uint32
	X     float32
	Y     float32
	Z     float32
	O     float32
}

PlayerCreateInfo determines where a character is spawned at upon their first login, using their race and class.

type PlayerCreateItem

type PlayerCreateItem struct {
	Race   int8
	Class  int8
	ItemID string
	Amount uint32
}

type PortLocation

type PortLocation struct {
	ID  string  `xorm:"'port_id' pk" csv:"name"`
	X   float32 `xorm:"'x_pos'" csv:"x"`
	Y   float32 `xorm:"'y_pos'" csv:"y"`
	Z   float32 `xorm:"'z_pos'" csv:"z"`
	O   float32 `xorm:"'orientation'" csv:"orientation	"`
	Map uint32  `xorm:"'map'" csv:"mapID"`
}

type PropID

type PropID [8]byte

func MakePropID

func MakePropID(id string) PropID

func (PropID) String

func (p PropID) String() string

type Store

type Store struct {
	// contains filtered or unexported fields
}

func (*Store) Range

func (s *Store) Range(fn func(k, v interface{}) bool)

Jump to

Keyboard shortcuts

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