1 package org
.sevenchan
.dongs
.screens
3 import org
.sevenchan
.dongs
.Item
;
4 import org
.sevenchan
.dongs
.Screen;
9 public class InventoryScreen
extends Screen
11 private var text
:String = "";
12 private var menu
:String = "main";
13 private var newItem
:Item
= null;
14 public function InventoryScreen
(new_itm
:Item
=null)
20 override public function processButtonPress
(id
:int):Boolean
28 var foundSlot
:Boolean = false;
29 text
= "<h2>Inventory</h2><p>You also picked up a " + newItem
.descr
+".</p>";
30 for (var ii
:int = 0; ii
< main
.player
.inventory
.length
; ii
++) {
31 if ((main
.player
.inventory
[i
] as Item
).id
== newItem
.id
) {
32 (main
.player
.inventory
[i
] as Item
).amount
++;
33 text
+= "You shove it into the " + Utils
.nTh
(i
+ 1) + " slot in your inventory, give you a total of " + (main
.player
.inventory
[i
] as Item
).amount
+ " " + (main
.player
.inventory
[i
] as Item
).name
+ "s.</p>";
38 if (main
.player
.inventory
.length
== 11) {
40 return processButtonPress
( -1);
42 text
+= "You shove it into the " + Utils
.nTh
(main
.player
.inventory
.length
) + " slot in your inventory, give you a total of " + (main
.player
.inventory
[i
] as Item
).amount
+ " " + (main
.player
.inventory
[i
] as Item
).name
+ "s.</p>";
43 main
.player
.inventory
.push
(newItem
);
48 setButton
(NEXT_BUTTON
, "Next");
56 if (menu
== "replace") {
58 text
+= "<p>However, you don't have enough room. Either DISCARD the item, or click on a slot to replace it with.</p>";
60 setButton
(0, "DISCARD");
61 for (var i
:int = 0; i
< main
.player
.inventory
.length
;i
++ ) {
62 var item
:Item
= Item
(main
.player
.inventory
[i
]);
63 text
+= "<li><b>" + item
.amount
+ "x " + item
.name
+ "</b> - " + item
.descr
+ "</li>";
64 setButton
(i
+ 1, item
.name
);
73 main
.player
.inventory
[id
- 1]=newItem
;
78 text
= "<h2>Inventory</h2><p>You peer into your canvas bag of stuff and find";
79 if (main
.player
.inventory
.length
== 0) {
81 text
+= " nothing of value. You should explore more. Purchased items will also end up here.</p>";
82 setButton
(NEXT_BUTTON
, "Next");
88 for (i
= 0; i
< main
.player
.inventory
.length
;i
++ ) {
89 item
= Item
(main
.player
.inventory
[i
]);
90 text
+= "<li><b>" + item
.amount
+ "x " + item
.name
+ "</b> - " + item
.descr
+ "</li>";
91 setButton
(i
+ 1, item
.name
);
100 if ((main
.player
.inventory
[id
- 1] as Item
).Use
(main
.player
)) {
101 (main
.player
.inventory
[id
- 1] as Item
).amount
--;
102 if ((main
.player
.inventory
[id
- 1] as Item
).amount
== 0) {
103 main
.player
.inventory
.splice
(id
- 1,1);
113 override public function getScreenText
():String