fix trade package

This commit is contained in:
Sky Johnson 2025-08-06 13:27:01 -05:00
parent 0c37453971
commit fa47af5ffe
3 changed files with 1399 additions and 5 deletions

View File

@ -21,9 +21,9 @@ const (
// Trade slot configuration // Trade slot configuration
const ( const (
TradeMaxSlotsDefault = 12 // Default max slots for newer clients TradeMaxSlotsDefault = 12 // Default max slots for newer clients
TradeMaxSlotsLegacy = 6 // Max slots for older clients (version <= 561) TradeMaxSlotsLegacy = 6 // Max slots for older clients (version <= 561)
TradeSlotAutoFind = 255 // Automatically find next free slot TradeSlotAutoFind = -1 // Automatically find next free slot
) )
// Coin conversion constants (from C++ CalculateCoins) // Coin conversion constants (from C++ CalculateCoins)

1394
internal/trade/trade_test.go Normal file

File diff suppressed because it is too large Load Diff

View File

@ -8,7 +8,7 @@ import (
// TradeItemInfo represents an item in a trade slot // TradeItemInfo represents an item in a trade slot
// Converted from C++ TradeItemInfo struct // Converted from C++ TradeItemInfo struct
type TradeItemInfo struct { type TradeItemInfo struct {
Item *Item // TODO: Replace with actual Item type when available Item Item // TODO: Replace with actual Item type when available
Quantity int32 // Quantity of the item being traded Quantity int32 // Quantity of the item being traded
} }
@ -77,7 +77,7 @@ func (tp *TradeParticipant) GetNextFreeSlot() int8 {
return slot return slot
} }
} }
return TradeSlotAutoFind // No free slots available return int8(TradeSlotAutoFind) // No free slots available
} }
// HasItem checks if participant has a specific item in trade // HasItem checks if participant has a specific item in trade