import Entity, { printMessage, action, time, state } from "Entity";
import { addItem, removeItem, isInInventory } from 'inventory.js';

export class Customer extends Entity {
  name() {
    return 'An old lady';
  }

  shortDescription() {
    return 'probably in her ninteties';
  }

  additionalDescription() {
    return `She's tapping her foot impatiently.`;
  }

  handle() {
    'oldLady'
  }

  actions() {
    return [
      action("Talk.", () => {
        printMessage('Old lady: I want a hamburger.');
      }),
      action("Give burger.", () => {
        printMessage('Humph. About time.');
        removeItem('burger');
        printMessage('The lady gives pays you for the burger.');
        addItem('$10');
        state.oldLadyServerd = true;
      }, () => isInInventory('burger')),
    ];
  }
}

export default new Customer();

@@ -31,16 +31,32 @@
  action,
+ actionWithItem,
  time, s
@@ -531,16 +531,17 @@
     %7D),%0A
+%0A
       ac
@@ -544,16 +544,217 @@
   action
+WithItem(%22Give fries.%22, %22fries%22, () =%3E %7B%0A        printMessage(%60I didn't ask for this%60);%0A        printMessage(%60The lady storms off%60);%0A        state.oldLadyServerd = true;%0A      %7D),%0A%0A      actionWithItem
 (%22Give b
@@ -761,16 +761,26 @@
 urger.%22,
+ %22burger%22,
  () =%3E %7B
@@ -828,38 +828,8 @@
 ');%0A
-        removeItem('burger');%0A
     
@@ -954,46 +954,15 @@
 ue;%0A
+
       %7D
-, () =%3E isInInventory('burger')
 ),%0A 

Use actionsWithItem for customer