diff options
| author | workhorse <workhorse@localhost.localdomain> | 2026-06-19 03:57:06 -0400 |
|---|---|---|
| committer | workhorse <workhorse@localhost.localdomain> | 2026-06-19 03:57:06 -0400 |
| commit | 52a3ce6a4b4a254dc5d3067979a09e93c060fa20 (patch) | |
| tree | 167c62990013733bc8669c1387078bc86ea48db5 /internal/game/action_talk.go | |
| parent | fbd1c30d7b9777c9df6653f0c393afa7a7dfa519 (diff) | |
| download | thehouseoficarus-52a3ce6a4b4a254dc5d3067979a09e93c060fa20.tar.gz | |
feat: shops and rough assassin skill
Diffstat (limited to 'internal/game/action_talk.go')
| -rw-r--r-- | internal/game/action_talk.go | 47 |
1 files changed, 47 insertions, 0 deletions
diff --git a/internal/game/action_talk.go b/internal/game/action_talk.go index 2d4a814..1a21e7f 100644 --- a/internal/game/action_talk.go +++ b/internal/game/action_talk.go @@ -57,7 +57,27 @@ func (g *Game) showTalkNode(sess *net.Session, node action.TalkNode) { sess.WriteLine(fmt.Sprintf("\n%s", g.colorize(sess, "dialog", node.Message))) if node.Action != nil { + if node.Action.Shop != nil { + g.applyNodeAction(sess, node.Action) + g.enterShop(sess, node.Action.Shop) + return + } g.applyNodeAction(sess, node.Action) + + if g.WorldFlags["guard_hostile"] != nil { + delete(g.WorldFlags, "guard_hostile") + p, _ := sess.Player.(*player.Player) + if p != nil && p.Action != nil && p.Action.Data["steal_guard"] == true { + guardMob := g.findGuardInRoom(p.RoomID, "guard") + if guardMob != nil { + sess.State = net.StateGame + g.CancelAction(p) + guardMob.Protected = false + g.startCombat(sess, p, guardMob) + } + return + } + } } if len(node.Options) == 0 { @@ -162,11 +182,38 @@ func (g *Game) handleTalkInput(sess *net.Session, input string) { g.writePrompt(sess) } +func (g *Game) enterShop(sess *net.Session, cfg *action.ShopConfig) { + sess.Shop = cfg + sess.State = net.StateShop + g.showShopBrowse(sess) + g.writeShopPrompt(sess) +} + func (g *Game) applyNodeAction(sess *net.Session, na *action.NodeAction) { p, ok := sess.Player.(*player.Player) if !ok { return } + + if na.AssignTask { + g.assignAssassinTask(sess, p) + } + if na.SkipTask { + g.skipAssassinTask(sess, p) + } + if na.ExtendTask { + g.extendAssassinTask(sess, p) + } + if na.ReputationCost > 0 { + rep := getPlayerFlagInt(p, "assassin_reputation") + if rep < na.ReputationCost { + sess.WriteLine(fmt.Sprintf("You don't have enough Reputation. (Need %d, have %d)", na.ReputationCost, rep)) + return + } + setPlayerFlag(p, "assassin_reputation", rep-na.ReputationCost) + g.AccountStore.SaveCharacter(p) + } + for k, v := range na.SetFlags { g.WorldFlags[k] = v } |
