From 3a9bb4886317e82aee1a45e4b643b5973c5215f9 Mon Sep 17 00:00:00 2001 From: El-BG-1970 Date: Sun, 7 Aug 2022 13:45:02 +0200 Subject: implemented game;commodities-panel --- src/game.lisp | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) (limited to 'src/game.lisp') diff --git a/src/game.lisp b/src/game.lisp index 979e4e2..b55224a 100644 --- a/src/game.lisp +++ b/src/game.lisp @@ -55,3 +55,20 @@ (defmethod get-profit ((g game) name) (with-slots (cur-zone) g (get-profit-in-zone g name cur-zone))) + + +(defmethod commodities-panel ((g game)) + (with-slots (player cur-zone) g + (mapcar (lambda (c) + (let* ((name (commodities:name c)) + (price (commodities:price c)) + (player-item (player:find-item player name)) + (quantity (if player-item (cdr player-item) 0)) + (profit (if player-item + (- price + (commodities:price (car player-item)))))) + (list name + price + quantity + profit))) + (zone:get-commodities cur-zone)))) -- cgit v1.2.3