diff options
author | Wim <wim@42.be> | 2018-08-06 21:47:05 +0200 |
---|---|---|
committer | Wim <wim@42.be> | 2018-08-06 21:47:05 +0200 |
commit | 51062863a5c34d81e296cf15c61140911037cf3b (patch) | |
tree | 9b5e044672486326c7a0ca8fb26430f37bf4d83c /vendor/github.com/Philipp15b/go-steam/trade/actions.go | |
parent | 4fb4b7aa6c02a54db8ad8dd98e4d321396926c0d (diff) | |
download | matterbridge-msglm-51062863a5c34d81e296cf15c61140911037cf3b.tar.gz matterbridge-msglm-51062863a5c34d81e296cf15c61140911037cf3b.tar.bz2 matterbridge-msglm-51062863a5c34d81e296cf15c61140911037cf3b.zip |
Use mod vendor for vendored directory (backwards compatible)
Diffstat (limited to 'vendor/github.com/Philipp15b/go-steam/trade/actions.go')
-rw-r--r-- | vendor/github.com/Philipp15b/go-steam/trade/actions.go | 84 |
1 files changed, 0 insertions, 84 deletions
diff --git a/vendor/github.com/Philipp15b/go-steam/trade/actions.go b/vendor/github.com/Philipp15b/go-steam/trade/actions.go deleted file mode 100644 index e9301940..00000000 --- a/vendor/github.com/Philipp15b/go-steam/trade/actions.go +++ /dev/null @@ -1,84 +0,0 @@ -package trade - -import ( - "github.com/Philipp15b/go-steam/economy/inventory" - "github.com/Philipp15b/go-steam/trade/tradeapi" - "time" -) - -type Slot uint - -func (t *Trade) action(status *tradeapi.Status, err error) error { - if err != nil { - return err - } - t.onStatus(status) - return nil -} - -// Returns the next batch of events to process. These can be queued from calls to methods -// like `AddItem` or, if there are no queued events, from a new HTTP request to Steam's API (blocking!). -// If the latter is the case, this method may also sleep before the request -// to conform to the polling interval of the official Steam client. -func (t *Trade) Poll() ([]interface{}, error) { - if t.queuedEvents != nil { - return t.Events(), nil - } - - if d := time.Since(t.lastPoll); d < pollTimeout { - time.Sleep(pollTimeout - d) - } - t.lastPoll = time.Now() - - err := t.action(t.api.GetStatus()) - if err != nil { - return nil, err - } - - return t.Events(), nil -} - -func (t *Trade) GetTheirInventory(contextId uint64, appId uint32) (*inventory.Inventory, error) { - return inventory.GetFullInventory(func() (*inventory.PartialInventory, error) { - return t.api.GetForeignInventory(contextId, appId, nil) - }, func(start uint) (*inventory.PartialInventory, error) { - return t.api.GetForeignInventory(contextId, appId, &start) - }) -} - -func (t *Trade) GetOwnInventory(contextId uint64, appId uint32) (*inventory.Inventory, error) { - return t.api.GetOwnInventory(contextId, appId) -} - -func (t *Trade) GetMain() (*tradeapi.Main, error) { - return t.api.GetMain() -} - -func (t *Trade) AddItem(slot Slot, item *Item) error { - return t.action(t.api.AddItem(uint(slot), item.AssetId, item.ContextId, item.AppId)) -} - -func (t *Trade) RemoveItem(slot Slot, item *Item) error { - return t.action(t.api.RemoveItem(uint(slot), item.AssetId, item.ContextId, item.AppId)) -} - -func (t *Trade) Chat(message string) error { - return t.action(t.api.Chat(message)) -} - -func (t *Trade) SetCurrency(amount uint, currency *Currency) error { - return t.action(t.api.SetCurrency(amount, currency.CurrencyId, currency.ContextId, currency.AppId)) -} - -func (t *Trade) SetReady(ready bool) error { - return t.action(t.api.SetReady(ready)) -} - -// This may only be called after a successful `SetReady(true)`. -func (t *Trade) Confirm() error { - return t.action(t.api.Confirm()) -} - -func (t *Trade) Cancel() error { - return t.action(t.api.Cancel()) -} |