Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
What's new
4
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Switch to GitLab Next
Sign in / Register
Toggle navigation
coUserver
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Locked Files
Issues
2
Issues
2
List
Boards
Labels
Service Desk
Milestones
Iterations
Merge Requests
0
Merge Requests
0
Requirements
Requirements
List
Security & Compliance
Security & Compliance
Dependency List
License Compliance
Operations
Operations
Incidents
Environments
Packages & Registries
Packages & Registries
Package Registry
Container Registry
Analytics
Analytics
Code Review
Insights
Issue
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Children of Ur
coUserver
Commits
7d73ab35
Commit
7d73ab35
authored
Jun 01, 2017
by
Craig S. Cottingham
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Finish adding rice as a distillable ingredient
parent
175831c4
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
16 additions
and
30 deletions
+16
-30
lib/entities/npcs/items/still.dart
lib/entities/npcs/items/still.dart
+16
-30
No files found.
lib/entities/npcs/items/still.dart
View file @
7d73ab35
...
...
@@ -30,6 +30,13 @@ class Still extends EntityItem {
POTATO
=
'potato'
,
RICE
=
'rice'
;
static
final
Map
<
String
,
int
>
FERMENTABILITY
=
{
CORN:
4
,
GRAIN:
1
,
POTATO:
8
,
RICE:
2
};
static
final
Action
ACTION_ADD
=
new
Action
()
..
timeRequired
=
500
..
multiEnabled
=
true
...
...
@@ -57,8 +64,6 @@ class Still extends EntityItem {
int
pending
=
0
;
int
processed
=
0
;
Map
<
String
,
int
>
itemsAdded
=
{};
bool
collecting
=
false
;
Still
(
String
id
,
num
x
,
num
y
,
num
z
,
num
rotation
,
bool
h_flip
,
String
streetName
)
:
super
(
id
,
x
,
y
,
z
,
rotation
,
h_flip
,
streetName
)
{
...
...
@@ -72,6 +77,7 @@ class Still extends EntityItem {
..
add
(
ACTION_ADD_CORN
)
..
add
(
ACTION_ADD_GRAIN
)
..
add
(
ACTION_ADD_POTATO
)
..
add
(
ACTION_ADD_RICE
)
..
add
(
ACTION_COLLECT
);
}
...
...
@@ -105,17 +111,13 @@ class Still extends EntityItem {
@override
Map
<
String
,
String
>
getPersistMetadata
()
=>
super
.
getPersistMetadata
()
..[
'pending'
]
=
pending
.
toString
()
..[
'processed'
]
=
processed
.
toString
()
..[
'itemsAdded'
]
=
JSON
.
encode
(
itemsAdded
);
..[
'processed'
]
=
processed
.
toString
();
@override
void
restoreState
(
Map
<
String
,
String
>
metadata
)
{
super
.
restoreState
(
metadata
);
pending
=
int
.
parse
((
metadata
[
'pending'
]
??
0
).
toString
());
processed
=
int
.
parse
((
metadata
[
'processed'
]
??
0
).
toString
());
if
(
metadata
.
containsKey
(
'itemsAdded'
))
{
itemsAdded
=
JSON
.
decode
(
metadata
[
'itemsAdded'
]);
}
}
@override
...
...
@@ -123,26 +125,15 @@ class Still extends EntityItem {
if
(
pending
>=
INPUT_PER_HOOCH
)
{
toast
(
'Wait for me to finish!'
,
userSocket
);
return
false
;
}
else
if
(
pending
>
0
)
{
await
Future
.
forEach
(
itemsAdded
.
keys
,
(
String
itemType
)
async
{
await
InventoryV2
.
addItemToUser
(
email
,
itemType
,
itemsAdded
[
itemType
]);
});
itemsAdded
=
{};
return
await
super
.
pickUp
(
userSocket:
userSocket
,
email:
email
);
}
else
{
return
await
super
.
pickUp
(
userSocket:
userSocket
,
email:
email
);
}
}
Future
<
bool
>
add
Hop
s
(
String
itemType
,
String
email
,
[
int
count
=
1
])
async
{
Future
<
bool
>
add
Fermentable
s
(
String
itemType
,
String
email
,
[
int
count
=
1
])
async
{
try
{
int
taken
=
await
InventoryV2
.
takeAnyItemsFromUser
(
email
,
itemType
,
count
);
pending
+=
taken
;
if
(
itemsAdded
.
containsKey
(
itemType
))
{
itemsAdded
[
itemType
]
+=
taken
;
}
else
{
itemsAdded
[
itemType
]
=
taken
;
}
pending
+=
taken
*
FERMENTABILITY
[
itemType
];
SkillManager
.
learn
(
SKILL
,
email
,
(
count
/
3
).
ceil
());
return
true
;
...
...
@@ -152,18 +143,14 @@ class Still extends EntityItem {
}
}
Future
<
bool
>
addCorn
({
WebSocket
userSocket
,
String
email
,
int
count:
1
})
async
=>
add
Hop
s
(
CORN
,
email
,
count
);
Future
<
bool
>
addGrain
({
WebSocket
userSocket
,
String
email
,
int
count:
1
})
async
=>
add
Hop
s
(
GRAIN
,
email
,
count
);
Future
<
bool
>
addPotato
({
WebSocket
userSocket
,
String
email
,
int
count:
1
})
async
=>
add
Hop
s
(
POTATO
,
email
,
count
);
Future
<
bool
>
addRice
({
WebSocket
userSocket
,
String
email
,
int
count:
1
})
async
=>
add
Hop
s
(
RICE
,
email
,
count
);
Future
<
bool
>
addCorn
({
WebSocket
userSocket
,
String
email
,
int
count:
1
})
async
=>
add
Fermentable
s
(
CORN
,
email
,
count
);
Future
<
bool
>
addGrain
({
WebSocket
userSocket
,
String
email
,
int
count:
1
})
async
=>
add
Fermentable
s
(
GRAIN
,
email
,
count
);
Future
<
bool
>
addPotato
({
WebSocket
userSocket
,
String
email
,
int
count:
1
})
async
=>
add
Fermentable
s
(
POTATO
,
email
,
count
);
Future
<
bool
>
addRice
({
WebSocket
userSocket
,
String
email
,
int
count:
1
})
async
=>
add
Fermentable
s
(
RICE
,
email
,
count
);
Future
<
bool
>
collect
({
WebSocket
userSocket
,
String
email
})
async
{
if
(
processed
==
0
)
{
if
(
pending
==
0
)
{
toast
(
"There's nothing to collect!"
,
userSocket
);
}
else
{
toast
(
"There's not enough in here to make any hooch worth collecting!"
,
userSocket
);
}
toast
(
"There's nothing to collect!"
,
userSocket
);
return
false
;
}
else
{
int
collected
=
0
;
...
...
@@ -187,7 +174,6 @@ class Still extends EntityItem {
// Done
collecting
=
false
;
itemsAdded
=
{};
SkillManager
.
learn
(
SKILL
,
email
,
(
collected
/
4
).
ceil
());
return
true
;
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment