Last active
May 28, 2018 19:11
-
-
Save johnX9/00f82d6b2a288d265f9da8deded6b44b to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <eosiolib/eosio.hpp> | |
#include <eosiolib/print.hpp> | |
#include <string> | |
namespace Oasis { | |
using namespace eosio; | |
using std::string; | |
class Players : public contract { | |
using contract::contract; | |
public: | |
Players(account_name self):contract(self) {} | |
//@abi action | |
void add(account_name account, string& username); | |
//@abi action | |
void update(account_name account, uint64_t level, int64_t healthPoints, int64_t energyPoints); | |
//@abi action | |
void getplayer(const account_name account); | |
private: | |
//@abi table player i64 | |
struct player { | |
uint64_t account_name; | |
string username; | |
uint64_t level; | |
int64_t health_points = 1000; | |
int64_t energy_points = 1000; | |
uint64_t primary_key() const { return account_name; } | |
EOSLIB_SERIALIZE(player, (account_name)(username)(level)(health_points)(energy_points)) | |
}; | |
typedef multi_index<N(player), player> playerIndex; | |
}; | |
EOSIO_ABI(Players, (add)(update)(getplayer)); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment