...
This commit is contained in:
@@ -4,6 +4,7 @@ import encoding.binary as bin
|
||||
import freeflowuniverse.herolib.data.ourtime
|
||||
import time
|
||||
import freeflowuniverse.herolib.data.gid
|
||||
import freeflowuniverse.herolib.data.currency
|
||||
|
||||
pub struct Decoder {
|
||||
pub mut:
|
||||
@@ -148,6 +149,18 @@ pub fn (mut d Decoder) get_ourtime() !ourtime.OurTime {
|
||||
}
|
||||
}
|
||||
|
||||
pub fn (mut d Decoder) get_currency() !currency.Amount {
|
||||
curstring:=d.get_string()!
|
||||
if curstring.len == 0 {
|
||||
return error('currency string is empty')
|
||||
}
|
||||
currencyo := currency.get(curstring)!
|
||||
return currency.Amount{
|
||||
currency: currencyo
|
||||
val: d.get_f64()!
|
||||
}
|
||||
}
|
||||
|
||||
pub fn (mut d Decoder) get_percentage() !u8 {
|
||||
val := d.get_u8()!
|
||||
if val > 100 {
|
||||
|
||||
Reference in New Issue
Block a user