aboutsummaryrefslogtreecommitdiff
path: root/internal/game/action_talk.go
diff options
context:
space:
mode:
Diffstat (limited to 'internal/game/action_talk.go')
-rw-r--r--internal/game/action_talk.go47
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
}