112 lines
3.5 KiB
Go
112 lines
3.5 KiB
Go
package transmute
|
|
|
|
// TransmutingTier represents a level range and associated material IDs for transmutation
|
|
type TransmutingTier struct {
|
|
MinLevel int32 // Minimum item level for this tier
|
|
MaxLevel int32 // Maximum item level for this tier
|
|
FragmentID int32 // Item ID for fragments (lowest tier materials)
|
|
PowderID int32 // Item ID for powder (mid tier materials)
|
|
InfusionID int32 // Item ID for infusions (high tier materials)
|
|
ManaID int32 // Item ID for mana (highest tier materials)
|
|
}
|
|
|
|
// TransmuteRequest represents an active transmutation request
|
|
type TransmuteRequest struct {
|
|
RequestID int32 // Unique request identifier
|
|
ClientID int32 // Client making the request
|
|
ItemID int32 // Item being transmuted (if in confirmation phase)
|
|
Phase TransmutePhase
|
|
}
|
|
|
|
// TransmutePhase represents the current phase of transmutation
|
|
type TransmutePhase int
|
|
|
|
const (
|
|
PhaseItemSelection TransmutePhase = iota // Player selecting item to transmute
|
|
PhaseConfirmation // Player confirming transmutation
|
|
PhaseProcessing // Transmutation in progress
|
|
PhaseComplete // Transmutation completed
|
|
)
|
|
|
|
// TransmuteResult represents the outcome of a transmutation
|
|
type TransmuteResult struct {
|
|
Success bool // Whether transmutation was successful
|
|
CommonMaterial *Item // Common material received (if any)
|
|
RareMaterial *Item // Rare material received (if any)
|
|
ErrorMessage string // Error message if unsuccessful
|
|
SkillIncrease bool // Whether player received skill increase
|
|
}
|
|
|
|
// Item represents the minimal item interface needed for transmutation
|
|
type Item interface {
|
|
GetID() int32
|
|
GetUniqueID() int32
|
|
GetName() string
|
|
GetAdventureDefaultLevel() int32
|
|
GetItemFlags() int32
|
|
GetItemFlags2() int32
|
|
GetTier() int32
|
|
GetStackCount() int32
|
|
CreateItemLink(version int32, detailed bool) string
|
|
SetCount(count int32)
|
|
}
|
|
|
|
// Player represents the minimal player interface needed for transmutation
|
|
type Player interface {
|
|
GetItemList() map[int32]Item
|
|
GetItemFromUniqueID(uniqueID int32) Item
|
|
GetSkillByName(skillName string) Skill
|
|
GetStat(statType int32) int32
|
|
GetName() string
|
|
GetZone() Zone
|
|
RemoveItem(item Item, deleteItem bool) bool
|
|
AddItem(item Item) (bool, error)
|
|
IncreaseSkill(skillName string, amount int32) error
|
|
}
|
|
|
|
// Client represents the minimal client interface needed for transmutation
|
|
type Client interface {
|
|
GetVersion() int32
|
|
GetTransmuteID() int32
|
|
SetTransmuteID(id int32)
|
|
QueuePacket(packet []byte)
|
|
SimpleMessage(channel int32, message string)
|
|
Message(channel int32, format string, args ...interface{})
|
|
AddItem(item Item, itemDeleted *bool) error
|
|
}
|
|
|
|
// Skill represents a player skill
|
|
type Skill interface {
|
|
GetCurrentValue() int32
|
|
GetMaxValue() int32
|
|
}
|
|
|
|
// Zone represents a game zone
|
|
type Zone interface {
|
|
ProcessSpell(spell Spell, caster Player) error
|
|
}
|
|
|
|
// Spell represents a spell that can be cast
|
|
type Spell interface {
|
|
GetID() int32
|
|
GetName() string
|
|
}
|
|
|
|
// Database represents the database interface for transmutation
|
|
type Database interface {
|
|
LoadTransmutingTiers() ([]*TransmutingTier, error)
|
|
}
|
|
|
|
// PacketBuilder represents the interface for building packets
|
|
type PacketBuilder interface {
|
|
BuildItemRequestPacket(requestID int32, items []int32, version int32) ([]byte, error)
|
|
BuildConfirmationPacket(requestID int32, item Item, version int32) ([]byte, error)
|
|
BuildRewardPacket(items []Item, version int32) ([]byte, error)
|
|
}
|
|
|
|
// ItemMaster represents the master item list interface
|
|
type ItemMaster interface {
|
|
GetItem(itemID int32) Item
|
|
CreateItem(itemID int32) Item
|
|
}
|