adventure: let a player back out from the web, not only in Matrix
Three verbs to match gogobee's: call off an expedition, turn back out of somebody else's party, send the pet sitter home. Which one this page offers is derived here rather than pushed — leadership is already legible in the party seats and the sitter's standing is already in the babysit offer, so nothing new crosses the wire. Two things running it turned up that no test would have. An applied abandon left "Pull out of the run" sitting under a verdict saying the expedition was over, so an applied verb now also hides the other verbs it just made untrue. And a party member was being offered that same button in the first place, beside the one that actually works — Pete knows from the seat it just read that gogobee would refuse it, so it is withheld. Also: heal the Matrix handle onto push rows stored before the column existed, on its own endpoint rather than through the subscribe upsert, which resets both watermarks and would have silenced the digest for anybody who reads the site regularly. And stack the board row below sm — four flex columns that wrapped to six lines on a phone, pre-existing.
This commit is contained in:
+25
-2
@@ -72,7 +72,8 @@ func (s *Server) handleAdvOrder(w http.ResponseWriter, r *http.Request) {
|
||||
}
|
||||
switch req.Action {
|
||||
case storage.AdvActionExtract, storage.AdvActionSiegeJoin,
|
||||
storage.AdvActionExpedition, storage.AdvActionResume, storage.AdvActionBabysit:
|
||||
storage.AdvActionExpedition, storage.AdvActionResume, storage.AdvActionBabysit,
|
||||
storage.AdvActionAbandon, storage.AdvActionLeave, storage.AdvActionBabysitCancel:
|
||||
default:
|
||||
writeAdvOrderError(w, http.StatusBadRequest, "bad action")
|
||||
return
|
||||
@@ -165,7 +166,9 @@ func (s *Server) handleAdvOrder(w http.ResponseWriter, r *http.Request) {
|
||||
|
||||
// resolveAdvOrderParams turns the browser's arguments into the stored ones by
|
||||
// looking each up in the owner's pushed offer list, and returns the reason to
|
||||
// refuse when it cannot. The two W5a verbs take no arguments and resolve to nil.
|
||||
// refuse when it cannot. Five of the eight verbs take no arguments and resolve to
|
||||
// nil — but babysit_cancel still comes through here, because the offer row is
|
||||
// the one place Pete can see that there is no sitter to dismiss.
|
||||
//
|
||||
// Note what W5a's "Pete has never heard about it" asymmetry does NOT need to
|
||||
// become here. There is no such state to defer on: the detail row this reads is
|
||||
@@ -177,6 +180,15 @@ func resolveAdvOrderParams(owner, token string, req advOrderReq) (*storage.AdvOr
|
||||
switch req.Action {
|
||||
case storage.AdvActionExtract, storage.AdvActionSiegeJoin:
|
||||
return nil, ""
|
||||
case storage.AdvActionAbandon, storage.AdvActionLeave:
|
||||
// No snapshot pre-check for either, deliberately, and it is the same call
|
||||
// W5a made for extract: the board is up to two minutes stale, so the only
|
||||
// thing Pete could test — "the mark reads idle" — would refuse actions the
|
||||
// game would have allowed. Abandon is worse than extract in that respect,
|
||||
// because an *extracted* expedition is still abandonable while its owner
|
||||
// reads as standing in town. gogobee answers rejected_not_running /
|
||||
// rejected_not_leader / rejected_is_leader, and the strip shows it.
|
||||
return nil, ""
|
||||
}
|
||||
detail, haveDetail, err := storage.PlayerDetailByOwner(owner, token)
|
||||
if err != nil {
|
||||
@@ -229,6 +241,17 @@ func resolveAdvOrderParams(owner, token string, req advOrderReq) (*storage.AdvOr
|
||||
return nil, "a sitter is already looking after your camp"
|
||||
}
|
||||
return &storage.AdvOrderParams{Days: req.Days}, ""
|
||||
|
||||
case storage.AdvActionBabysitCancel:
|
||||
// The mirror of the check above, and the one W9 verb where the snapshot
|
||||
// really does contradict the request: a sitter's engagement is a fact about
|
||||
// the character, not about where they are standing, so it does not go stale
|
||||
// the way "on an expedition" does. A missing offer is still not a refusal —
|
||||
// that is a gogobee too old to push one, not a player without a sitter.
|
||||
if detail.Babysit != nil && !detail.Babysit.Active {
|
||||
return nil, "there's no sitter to dismiss"
|
||||
}
|
||||
return nil, ""
|
||||
}
|
||||
return nil, "bad action"
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user