forked from LetItPlay/CryptoWizards-SmartContract
-
Notifications
You must be signed in to change notification settings - Fork 0
/
feature.hpp
62 lines (43 loc) · 1.17 KB
/
feature.hpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
#pragma once
#include <eosiolib/eosio.hpp>
#include <eosiolib/types.hpp>
#include <eosiolib/asset.hpp>
#include "math.h"
using namespace eosio;
using namespace std;
#define PRICE asset(1000, eosio::string_to_symbol(4, "EOS"))
#define PRICE5 asset(5000, eosio::string_to_symbol(4, "EOS"))
#define PRICEBOX asset(1, eosio::string_to_symbol(0, "WIZBOX"))
//@abi table races i64
struct race {
race() {
possible = vector<uint8_t>(8);
};
uint64_t num;
vector<uint8_t> possible;
uint64_t primary_key() const { return num; }
EOSLIB_SERIALIZE( race, (num)(possible))
};
//@abi table ragdist i64
struct ragdist {
ragdist() {
};
uint64_t num;
vector<uint32_t> possible;
uint32_t sum;
uint64_t primary_key() const { return num; }
EOSLIB_SERIALIZE( ragdist, (num)(possible)(sum))
};
//@abi table shop i64
struct ragshop {
ragshop() {
};
uint64_t num;
vector<uint32_t> possible;
vector<uint32_t> bought;
uint64_t primary_key() const { return num; }
EOSLIB_SERIALIZE( ragshop, (num)(possible)(bought))
};
uint64_t calc_rag_price(const ragdist& dist, uint8_t rag){
return (uint64_t)trunc((PRICE.amount * (((double)dist.sum)/dist.possible[rag]/20)));
}