3#include "absl/status/status.h"
14 if (server.revision() != revision_ || waited_ >
kPatience) {
22 const protocol::ItemAction& action) {
25 absl::Status done = absl::OkStatus();
26 switch (action.action_case()) {
27 case protocol::ItemAction::kMove:
28 done = bag.
Move(items_, action.move().from(), action.move().to(),
29 action.move().count());
31 case protocol::ItemAction::kUse:
34 case protocol::ItemAction::kDestroy:
35 done = bag.
Destroy(action.destroy());
37 case protocol::ItemAction::ACTION_NOT_SET:
44 revision_ = server.revision();
absl::Status Destroy(const protocol::Place &place)
Throws away all of what's at the place.
absl::Status Move(const ItemTable &table, const protocol::Place &from, const protocol::Place &to, uint32_t count=0)
absl::Status TakeOne(const protocol::Place &place)
Takes one off the stack at the place, as using one does.
const protocol::Inventory & items() const
static constexpr float kPatience
In seconds.
protocol::Inventory Shown(const protocol::Inventory &server, float seconds)
void Act(const protocol::Inventory &server, const protocol::ItemAction &action)
What the player asked for, done to the bag shown, if the rules allow it.
protocol::Place InBag(uint32_t slot)
A place in the bag, by its slot from zero.