forked from townforge/townforge
remove old cc debug commands
They're useless now, since everything can be done in the game
This commit is contained in:
parent
968811a33e
commit
041b57752a
@ -884,19 +884,6 @@ show_list:
|
||||
return true;
|
||||
}
|
||||
|
||||
bool t_command_parser_executor::cc_debug_allocate_new_account(const std::vector<std::string>& args)
|
||||
{
|
||||
if (args.size() != 1)
|
||||
{
|
||||
std::cout << "cc_get_account <account>" << std::endl;
|
||||
return true;
|
||||
}
|
||||
|
||||
std::string address = args[0];
|
||||
|
||||
return m_executor.cc_debug_allocate_new_account(address);
|
||||
}
|
||||
|
||||
bool t_command_parser_executor::cc_get_account(const std::vector<std::string>& args)
|
||||
{
|
||||
if (args.size() != 1)
|
||||
@ -923,135 +910,6 @@ bool t_command_parser_executor::cc_get_account(const std::vector<std::string>& a
|
||||
return m_executor.cc_get_account(id, data);
|
||||
}
|
||||
|
||||
bool t_command_parser_executor::cc_debug_delete_account(const std::vector<std::string>& args)
|
||||
{
|
||||
if (args.size() != 1)
|
||||
{
|
||||
std::cout << "cc_debug_delete_account <account>" << std::endl;
|
||||
return true;
|
||||
}
|
||||
|
||||
uint32_t id;
|
||||
if (!epee::string_tools::get_xtype_from_string(id, args[0]))
|
||||
{
|
||||
std::cout << "Invalid id" << std::endl;
|
||||
return true;
|
||||
}
|
||||
|
||||
return m_executor.cc_debug_delete_account(id);
|
||||
}
|
||||
|
||||
bool t_command_parser_executor::cc_debug_set_account_balance(const std::vector<std::string>& args)
|
||||
{
|
||||
if (args.size() != 2)
|
||||
{
|
||||
std::cout << "cc_debug_set_account_balance <account> <balance>" << std::endl;
|
||||
return true;
|
||||
}
|
||||
|
||||
uint32_t id;
|
||||
if (!epee::string_tools::get_xtype_from_string(id, args[0]))
|
||||
{
|
||||
std::cout << "Invalid account ID" << std::endl;
|
||||
return true;
|
||||
}
|
||||
|
||||
uint64_t balance;
|
||||
if (!epee::string_tools::get_xtype_from_string(balance, args[1]))
|
||||
{
|
||||
std::cout << "Invalid balance" << std::endl;
|
||||
return true;
|
||||
}
|
||||
|
||||
return m_executor.cc_debug_set_account_balance(id, balance);
|
||||
}
|
||||
|
||||
bool t_command_parser_executor::cc_debug_set_account_item_balance(const std::vector<std::string>& args)
|
||||
{
|
||||
if (args.size() != 3)
|
||||
{
|
||||
std::cout << "cc_debug_set_account_item_balance <account> <index> <balance>" << std::endl;
|
||||
return true;
|
||||
}
|
||||
|
||||
uint32_t id;
|
||||
if (!epee::string_tools::get_xtype_from_string(id, args[0]))
|
||||
{
|
||||
std::cout << "Invalid account ID" << std::endl;
|
||||
return true;
|
||||
}
|
||||
|
||||
unsigned idx;
|
||||
if (!epee::string_tools::get_xtype_from_string(idx, args[1]) || idx == 0 || idx >= NUM_ITEMS)
|
||||
{
|
||||
std::cout << "Invalid block index" << std::endl;
|
||||
return true;
|
||||
}
|
||||
|
||||
uint64_t item_balance;
|
||||
if (!epee::string_tools::get_xtype_from_string(item_balance, args[2]))
|
||||
{
|
||||
std::cout << "Invalid balance" << std::endl;
|
||||
return true;
|
||||
}
|
||||
|
||||
return m_executor.cc_debug_set_account_item_balance(id, idx, item_balance);
|
||||
}
|
||||
|
||||
bool t_command_parser_executor::cc_debug_allocate_new_city(const std::vector<std::string>& args)
|
||||
{
|
||||
if (args.size() < 4)
|
||||
{
|
||||
std::cout << "cc_debug_allocate_new_city <ox> <oy> <mayor> <name (all other args)>" << std::endl;
|
||||
return true;
|
||||
}
|
||||
|
||||
uint32_t ox;
|
||||
if (!epee::string_tools::get_xtype_from_string(ox, args[0]))
|
||||
{
|
||||
std::cout << "Invalid ox" << std::endl;
|
||||
return true;
|
||||
}
|
||||
|
||||
uint32_t oy;
|
||||
if (!epee::string_tools::get_xtype_from_string(oy, args[1]))
|
||||
{
|
||||
std::cout << "Invalid oy" << std::endl;
|
||||
return true;
|
||||
}
|
||||
|
||||
uint32_t mayor;
|
||||
if (!epee::string_tools::get_xtype_from_string(mayor, args[2]))
|
||||
{
|
||||
std::cout << "Invalid mayor" << std::endl;
|
||||
return true;
|
||||
}
|
||||
|
||||
std::string name;
|
||||
for (size_t i = 3; i < args.size(); ++i)
|
||||
name += args[i] + (i == args.size() - 1 ? "" : " ");
|
||||
|
||||
return m_executor.cc_debug_allocate_new_city(ox, oy, name, mayor);
|
||||
}
|
||||
|
||||
bool t_command_parser_executor::cc_debug_delete_city(const std::vector<std::string>& args)
|
||||
{
|
||||
if (args.size() != 1)
|
||||
{
|
||||
std::cout << "cc_debug_delete_city <id>" << std::endl;
|
||||
return true;
|
||||
}
|
||||
|
||||
uint32_t id;
|
||||
if (!epee::string_tools::get_xtype_from_string(id, args[0]))
|
||||
{
|
||||
std::cout << "Invalid id" << std::endl;
|
||||
return true;
|
||||
}
|
||||
|
||||
return m_executor.cc_debug_delete_city(id);
|
||||
}
|
||||
|
||||
bool t_command_parser_executor::cc_get_city(const std::vector<std::string>& args)
|
||||
{
|
||||
if (args.size() != 1)
|
||||
@ -1078,77 +936,6 @@ bool t_command_parser_executor::cc_get_city(const std::vector<std::string>& args
|
||||
return m_executor.cc_get_city(id, data);
|
||||
}
|
||||
|
||||
bool t_command_parser_executor::cc_debug_allocate_new_flag(const std::vector<std::string>& args)
|
||||
{
|
||||
if (args.size() != 6)
|
||||
{
|
||||
std::cout << "cc_debug_allocate_new_flag <owner> <city> <x0> <y0> <x1> <y1>" << std::endl;
|
||||
return true;
|
||||
}
|
||||
|
||||
uint32_t owner = 0;
|
||||
if (!epee::string_tools::get_xtype_from_string(owner, args[0]))
|
||||
{
|
||||
std::cout << "Invalid owner" << std::endl;
|
||||
return true;
|
||||
}
|
||||
|
||||
uint32_t city = 0;
|
||||
if (!epee::string_tools::get_xtype_from_string(city, args[1]))
|
||||
{
|
||||
std::cout << "Invalid city" << std::endl;
|
||||
return true;
|
||||
}
|
||||
|
||||
uint32_t x0 = 0;
|
||||
if (!epee::string_tools::get_xtype_from_string(x0, args[2]))
|
||||
{
|
||||
std::cout << "Invalid x0" << std::endl;
|
||||
return true;
|
||||
}
|
||||
|
||||
uint32_t y0 = 0;
|
||||
if (!epee::string_tools::get_xtype_from_string(y0, args[3]))
|
||||
{
|
||||
std::cout << "Invalid y0" << std::endl;
|
||||
return true;
|
||||
}
|
||||
|
||||
uint32_t x1 = 0;
|
||||
if (!epee::string_tools::get_xtype_from_string(x1, args[4]))
|
||||
{
|
||||
std::cout << "Invalid x1" << std::endl;
|
||||
return true;
|
||||
}
|
||||
|
||||
uint32_t y1 = 0;
|
||||
if (!epee::string_tools::get_xtype_from_string(y1, args[5]))
|
||||
{
|
||||
std::cout << "Invalid y1" << std::endl;
|
||||
return true;
|
||||
}
|
||||
|
||||
return m_executor.cc_debug_allocate_new_flag(owner, city, x0, y0, x1, y1);
|
||||
}
|
||||
|
||||
bool t_command_parser_executor::cc_debug_delete_flag(const std::vector<std::string>& args)
|
||||
{
|
||||
if (args.size() != 1)
|
||||
{
|
||||
std::cout << "cc_debug_delete_flag <id>" << std::endl;
|
||||
return true;
|
||||
}
|
||||
|
||||
uint32_t id;
|
||||
if (!epee::string_tools::get_xtype_from_string(id, args[0]))
|
||||
{
|
||||
std::cout << "Invalid id" << std::endl;
|
||||
return true;
|
||||
}
|
||||
|
||||
return m_executor.cc_debug_delete_flag(id);
|
||||
}
|
||||
|
||||
bool t_command_parser_executor::cc_get_flag(const std::vector<std::string>& args)
|
||||
{
|
||||
if (args.size() != 1 && args.size() != 2)
|
||||
|
@ -158,16 +158,8 @@ public:
|
||||
bool flush_cache(const std::vector<std::string>& args);
|
||||
|
||||
// Crypto City
|
||||
bool cc_debug_allocate_new_account(const std::vector<std::string>& args);
|
||||
bool cc_debug_delete_account(const std::vector<std::string>& args);
|
||||
bool cc_get_account(const std::vector<std::string>& args);
|
||||
bool cc_debug_set_account_balance(const std::vector<std::string>& args);
|
||||
bool cc_debug_set_account_item_balance(const std::vector<std::string>& args);
|
||||
bool cc_debug_allocate_new_city(const std::vector<std::string>& args);
|
||||
bool cc_debug_delete_city(const std::vector<std::string>& args);
|
||||
bool cc_get_city(const std::vector<std::string>& args);
|
||||
bool cc_debug_allocate_new_flag(const std::vector<std::string>& args);
|
||||
bool cc_debug_delete_flag(const std::vector<std::string>& args);
|
||||
bool cc_get_flag(const std::vector<std::string>& args);
|
||||
bool cc_get_last_update_events(const std::vector<std::string>& args);
|
||||
};
|
||||
|
@ -323,56 +323,16 @@ t_command_server::t_command_server(
|
||||
"Use 'auto' to enable automatic public nodes discovering and bootstrap daemon switching"
|
||||
);
|
||||
// Crypto City
|
||||
m_command_lookup.set_handler(
|
||||
"cc_debug_allocate_new_account"
|
||||
, std::bind(&t_command_parser_executor::cc_debug_allocate_new_account, &m_parser, p::_1)
|
||||
, "Allocates a new TownForge account."
|
||||
);
|
||||
m_command_lookup.set_handler(
|
||||
"cc_debug_delete_account"
|
||||
, std::bind(&t_command_parser_executor::cc_debug_delete_account, &m_parser, p::_1)
|
||||
, "Deletes a TownForge account."
|
||||
);
|
||||
m_command_lookup.set_handler(
|
||||
"cc_get_account"
|
||||
, std::bind(&t_command_parser_executor::cc_get_account, &m_parser, p::_1)
|
||||
, "Gets data about a TownForge account."
|
||||
);
|
||||
m_command_lookup.set_handler(
|
||||
"cc_debug_set_account_balance"
|
||||
, std::bind(&t_command_parser_executor::cc_debug_set_account_balance, &m_parser, p::_1)
|
||||
, "Set a TownForge account's balance."
|
||||
);
|
||||
m_command_lookup.set_handler(
|
||||
"cc_debug_set_account_item_balance"
|
||||
, std::bind(&t_command_parser_executor::cc_debug_set_account_item_balance, &m_parser, p::_1)
|
||||
, "Set a TownForge account's item balance."
|
||||
);
|
||||
m_command_lookup.set_handler(
|
||||
"cc_debug_allocate_new_city"
|
||||
, std::bind(&t_command_parser_executor::cc_debug_allocate_new_city, &m_parser, p::_1)
|
||||
, "Allocates a new TownForge city."
|
||||
);
|
||||
m_command_lookup.set_handler(
|
||||
"cc_debug_delete_city"
|
||||
, std::bind(&t_command_parser_executor::cc_debug_delete_city, &m_parser, p::_1)
|
||||
, "Deletes a TownForge city."
|
||||
);
|
||||
m_command_lookup.set_handler(
|
||||
"cc_get_city"
|
||||
, std::bind(&t_command_parser_executor::cc_get_city, &m_parser, p::_1)
|
||||
, "Gets data about a TownForge city."
|
||||
);
|
||||
m_command_lookup.set_handler(
|
||||
"cc_debug_allocate_new_flag"
|
||||
, std::bind(&t_command_parser_executor::cc_debug_allocate_new_flag, &m_parser, p::_1)
|
||||
, "Allocates a new TownForge flag."
|
||||
);
|
||||
m_command_lookup.set_handler(
|
||||
"cc_debug_delete_flag"
|
||||
, std::bind(&t_command_parser_executor::cc_debug_delete_flag, &m_parser, p::_1)
|
||||
, "Deletes a TownForge flag."
|
||||
);
|
||||
m_command_lookup.set_handler(
|
||||
"cc_get_flag"
|
||||
, std::bind(&t_command_parser_executor::cc_get_flag, &m_parser, p::_1)
|
||||
|
@ -2445,63 +2445,6 @@ bool t_rpc_command_executor::set_bootstrap_daemon(
|
||||
return true;
|
||||
}
|
||||
|
||||
bool t_rpc_command_executor::cc_debug_allocate_new_account(const std::string &public_key)
|
||||
{
|
||||
cryptonote::COMMAND_RPC_CC_DEBUG_ALLOCATE_NEW_ACCOUNT::request req;
|
||||
cryptonote::COMMAND_RPC_CC_DEBUG_ALLOCATE_NEW_ACCOUNT::response res;
|
||||
std::string fail_message = "Unsuccessful";
|
||||
epee::json_rpc::error error_resp;
|
||||
|
||||
req.public_key = public_key;
|
||||
|
||||
if (m_is_rpc)
|
||||
{
|
||||
if (!m_rpc_client->json_rpc_request(req, res, "cc_debug_allocate_new_account", fail_message.c_str()))
|
||||
{
|
||||
return true;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (!m_rpc_server->on_cc_debug_allocate_new_account(req, res, error_resp) || res.status != CORE_RPC_STATUS_OK)
|
||||
{
|
||||
tools::fail_msg_writer() << make_error(fail_message, res.status);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
tools::success_msg_writer() << "New account: " << res.id;
|
||||
return true;
|
||||
}
|
||||
|
||||
bool t_rpc_command_executor::cc_debug_delete_account(uint32_t id)
|
||||
{
|
||||
cryptonote::COMMAND_RPC_CC_DEBUG_DELETE_ACCOUNT::request req;
|
||||
cryptonote::COMMAND_RPC_CC_DEBUG_DELETE_ACCOUNT::response res;
|
||||
std::string fail_message = "Unsuccessful";
|
||||
epee::json_rpc::error error_resp;
|
||||
|
||||
req.id = id;
|
||||
|
||||
if (m_is_rpc)
|
||||
{
|
||||
if (!m_rpc_client->json_rpc_request(req, res, "cc_debug_delete_account", fail_message.c_str()))
|
||||
{
|
||||
return true;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (!m_rpc_server->on_cc_debug_delete_account(req, res, error_resp) || res.status != CORE_RPC_STATUS_OK)
|
||||
{
|
||||
tools::fail_msg_writer() << make_error(fail_message, res.status);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
bool t_rpc_command_executor::cc_get_account(uint32_t id, const std::string &data)
|
||||
{
|
||||
cryptonote::COMMAND_RPC_CC_GET_ACCOUNT::request req;
|
||||
@ -2545,180 +2488,6 @@ bool t_rpc_command_executor::cc_get_account(uint32_t id, const std::string &data
|
||||
return true;
|
||||
}
|
||||
|
||||
bool t_rpc_command_executor::cc_debug_set_account_balance(uint32_t id, uint64_t balance)
|
||||
{
|
||||
cryptonote::COMMAND_RPC_CC_GET_ACCOUNT::request req_get;
|
||||
cryptonote::COMMAND_RPC_CC_GET_ACCOUNT::response res_get;
|
||||
cryptonote::COMMAND_RPC_CC_DEBUG_SET_ACCOUNT::request req_set;
|
||||
cryptonote::COMMAND_RPC_CC_DEBUG_SET_ACCOUNT::response res_set;
|
||||
std::string fail_message = "Unsuccessful";
|
||||
epee::json_rpc::error error_resp;
|
||||
|
||||
req_get.id = id;
|
||||
|
||||
if (m_is_rpc)
|
||||
{
|
||||
if (!m_rpc_client->json_rpc_request(req_get, res_get, "cc_get_account", fail_message.c_str()))
|
||||
{
|
||||
return true;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (!m_rpc_server->on_cc_get_account(req_get, res_get, error_resp) || res_get.status != CORE_RPC_STATUS_OK)
|
||||
{
|
||||
tools::fail_msg_writer() << make_error(fail_message, res_get.status);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
req_set.id = id;
|
||||
req_set.balance = balance;
|
||||
for (const auto &e: res_get.item_balances)
|
||||
if (e.amount > 0)
|
||||
req_set.item_balances.push_back({e.type, e.amount});
|
||||
|
||||
if (m_is_rpc)
|
||||
{
|
||||
if (!m_rpc_client->json_rpc_request(req_set, res_set, "cc_debug_set_account", fail_message.c_str()))
|
||||
{
|
||||
return true;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (!m_rpc_server->on_cc_debug_set_account(req_set, res_set, error_resp) || res_set.status != CORE_RPC_STATUS_OK)
|
||||
{
|
||||
tools::fail_msg_writer() << make_error(fail_message, res_set.status);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
bool t_rpc_command_executor::cc_debug_set_account_item_balance(uint32_t id, uint32_t idx, uint32_t item_balance)
|
||||
{
|
||||
cryptonote::COMMAND_RPC_CC_GET_ACCOUNT::request req_get;
|
||||
cryptonote::COMMAND_RPC_CC_GET_ACCOUNT::response res_get;
|
||||
cryptonote::COMMAND_RPC_CC_DEBUG_SET_ACCOUNT::request req_set;
|
||||
cryptonote::COMMAND_RPC_CC_DEBUG_SET_ACCOUNT::response res_set;
|
||||
std::string fail_message = "Unsuccessful";
|
||||
epee::json_rpc::error error_resp;
|
||||
|
||||
req_get.id = id;
|
||||
|
||||
if (m_is_rpc)
|
||||
{
|
||||
if (!m_rpc_client->json_rpc_request(req_get, res_get, "cc_get_account", fail_message.c_str()))
|
||||
{
|
||||
return true;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (!m_rpc_server->on_cc_get_account(req_get, res_get, error_resp) || res_get.status != CORE_RPC_STATUS_OK)
|
||||
{
|
||||
tools::fail_msg_writer() << make_error(fail_message, res_get.status);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
req_set.id = id;
|
||||
req_set.balance = res_get.balance;
|
||||
bool found = false;
|
||||
for (const auto &e: res_get.item_balances)
|
||||
{
|
||||
if (idx == e.type)
|
||||
{
|
||||
req_set.item_balances.push_back({e.type, item_balance});
|
||||
found = true;
|
||||
}
|
||||
else if (e.amount > 0)
|
||||
req_set.item_balances.push_back({e.type, e.amount});
|
||||
}
|
||||
if (!found)
|
||||
req_set.item_balances.push_back({idx, item_balance});
|
||||
|
||||
if (m_is_rpc)
|
||||
{
|
||||
if (!m_rpc_client->json_rpc_request(req_set, res_set, "cc_debug_set_account", fail_message.c_str()))
|
||||
{
|
||||
return true;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (!m_rpc_server->on_cc_debug_set_account(req_set, res_set, error_resp) || res_set.status != CORE_RPC_STATUS_OK)
|
||||
{
|
||||
tools::fail_msg_writer() << make_error(fail_message, res_set.status);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
bool t_rpc_command_executor::cc_debug_allocate_new_city(uint32_t ox, uint32_t oy, const std::string &name, uint32_t mayor)
|
||||
{
|
||||
cryptonote::COMMAND_RPC_CC_DEBUG_ALLOCATE_NEW_CITY::request req;
|
||||
cryptonote::COMMAND_RPC_CC_DEBUG_ALLOCATE_NEW_CITY::response res;
|
||||
std::string fail_message = "Unsuccessful";
|
||||
epee::json_rpc::error error_resp;
|
||||
|
||||
req.ox = ox;
|
||||
req.oy = oy;
|
||||
req.name = name;
|
||||
req.mayor = mayor;
|
||||
|
||||
if (m_is_rpc)
|
||||
{
|
||||
if (!m_rpc_client->json_rpc_request(req, res, "cc_debug_allocate_new_city", fail_message.c_str()))
|
||||
{
|
||||
return true;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (!m_rpc_server->on_cc_debug_allocate_new_city(req, res, error_resp) || res.status != CORE_RPC_STATUS_OK)
|
||||
{
|
||||
tools::fail_msg_writer() << make_error(fail_message, res.status);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
tools::success_msg_writer() << "New city: " << res.id;
|
||||
return true;
|
||||
}
|
||||
|
||||
bool t_rpc_command_executor::cc_debug_delete_city(uint32_t id)
|
||||
{
|
||||
cryptonote::COMMAND_RPC_CC_DEBUG_DELETE_CITY::request req;
|
||||
cryptonote::COMMAND_RPC_CC_DEBUG_DELETE_CITY::response res;
|
||||
std::string fail_message = "Unsuccessful";
|
||||
epee::json_rpc::error error_resp;
|
||||
|
||||
req.id = id;
|
||||
|
||||
if (m_is_rpc)
|
||||
{
|
||||
if (!m_rpc_client->json_rpc_request(req, res, "cc_debug_delete_city", fail_message.c_str()))
|
||||
{
|
||||
return true;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (!m_rpc_server->on_cc_debug_delete_city(req, res, error_resp) || res.status != CORE_RPC_STATUS_OK)
|
||||
{
|
||||
tools::fail_msg_writer() << make_error(fail_message, res.status);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
bool t_rpc_command_executor::cc_get_city(uint32_t id, const std::string &data)
|
||||
{
|
||||
cryptonote::COMMAND_RPC_CC_GET_CITY::request req;
|
||||
@ -2770,68 +2539,6 @@ bool t_rpc_command_executor::cc_get_city(uint32_t id, const std::string &data)
|
||||
return true;
|
||||
}
|
||||
|
||||
bool t_rpc_command_executor::cc_debug_allocate_new_flag(uint32_t owner, uint32_t city, uint32_t x0, uint32_t y0, uint32_t x1, uint32_t y1)
|
||||
{
|
||||
cryptonote::COMMAND_RPC_CC_DEBUG_ALLOCATE_NEW_FLAG::request req;
|
||||
cryptonote::COMMAND_RPC_CC_DEBUG_ALLOCATE_NEW_FLAG::response res;
|
||||
std::string fail_message = "Unsuccessful";
|
||||
epee::json_rpc::error error_resp;
|
||||
|
||||
req.owner_id = owner;
|
||||
req.city_id = city;
|
||||
req.x0 = x0;
|
||||
req.y0 = y0;
|
||||
req.x1 = x1;
|
||||
req.y1 = y1;
|
||||
|
||||
if (m_is_rpc)
|
||||
{
|
||||
if (!m_rpc_client->json_rpc_request(req, res, "cc_debug_allocate_new_flag", fail_message.c_str()))
|
||||
{
|
||||
return true;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (!m_rpc_server->on_cc_debug_allocate_new_flag(req, res, error_resp) || res.status != CORE_RPC_STATUS_OK)
|
||||
{
|
||||
tools::fail_msg_writer() << make_error(fail_message, res.status);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
tools::success_msg_writer() << "New flag: " << res.id;
|
||||
return true;
|
||||
}
|
||||
|
||||
bool t_rpc_command_executor::cc_debug_delete_flag(uint32_t id)
|
||||
{
|
||||
cryptonote::COMMAND_RPC_CC_DEBUG_DELETE_FLAG::request req;
|
||||
cryptonote::COMMAND_RPC_CC_DEBUG_DELETE_FLAG::response res;
|
||||
std::string fail_message = "Unsuccessful";
|
||||
epee::json_rpc::error error_resp;
|
||||
|
||||
req.id = id;
|
||||
|
||||
if (m_is_rpc)
|
||||
{
|
||||
if (!m_rpc_client->json_rpc_request(req, res, "cc_debug_delete_flag", fail_message.c_str()))
|
||||
{
|
||||
return true;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (!m_rpc_server->on_cc_debug_delete_flag(req, res, error_resp) || res.status != CORE_RPC_STATUS_OK)
|
||||
{
|
||||
tools::fail_msg_writer() << make_error(fail_message, res.status);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
bool t_rpc_command_executor::cc_get_flag(uint32_t id, const std::string &data, bool get_tiles)
|
||||
{
|
||||
cryptonote::COMMAND_RPC_CC_GET_FLAG::request req;
|
||||
|
@ -175,16 +175,8 @@ public:
|
||||
bool flush_cache(bool bad_txs, bool invalid_blocks);
|
||||
|
||||
// Crypto City
|
||||
bool cc_debug_allocate_new_account(const std::string &public_key);
|
||||
bool cc_debug_delete_account(uint32_t id);
|
||||
bool cc_get_account(uint32_t id, const std::string &data);
|
||||
bool cc_debug_set_account_balance(uint32_t id, uint64_t balance);
|
||||
bool cc_debug_set_account_item_balance(uint32_t id, uint32_t idx, uint32_t balance);
|
||||
bool cc_debug_allocate_new_city(uint32_t ox, uint32_t oy, const std::string &name, uint32_t mayor);
|
||||
bool cc_debug_delete_city(uint32_t id);
|
||||
bool cc_get_city(uint32_t id, const std::string &data);
|
||||
bool cc_debug_allocate_new_flag(uint32_t owner, uint32_t city, uint32_t x0, uint32_t y0, uint32_t x1, uint32_t y1);
|
||||
bool cc_debug_delete_flag(uint32_t id);
|
||||
bool cc_get_flag(uint32_t id, const std::string &data, bool get_tiles);
|
||||
bool cc_get_last_update_events(const std::string &filter);
|
||||
};
|
||||
|
@ -3372,60 +3372,6 @@ namespace cryptonote
|
||||
return true;
|
||||
}
|
||||
//------------------------------------------------------------------------------------------------------------------------------
|
||||
bool core_rpc_server::on_cc_debug_allocate_new_account(const COMMAND_RPC_CC_DEBUG_ALLOCATE_NEW_ACCOUNT::request& req, COMMAND_RPC_CC_DEBUG_ALLOCATE_NEW_ACCOUNT::response& res, epee::json_rpc::error& error_resp, const connection_context *ctx)
|
||||
{
|
||||
crypto::public_key public_key;
|
||||
if (!epee::string_tools::hex_to_pod(req.public_key, public_key))
|
||||
{
|
||||
error_resp.code = CORE_RPC_ERROR_CODE_WRONG_PUBLIC_KEY;
|
||||
error_resp.message = "Invalid public key";
|
||||
return true;
|
||||
}
|
||||
if (req.name.size() > MAX_CC_NAME_LENGTH)
|
||||
{
|
||||
error_resp.code = CORE_RPC_ERROR_CODE_WRONG_PARAM;
|
||||
error_resp.message = "Name too long";
|
||||
return true;
|
||||
}
|
||||
|
||||
try
|
||||
{
|
||||
// throws if it can't allocate
|
||||
RPCLockedTXN lock(m_core);
|
||||
res.id = m_core.get_blockchain_storage().get_db().allocate_new_cc_account(public_key, req.name);
|
||||
lock.commit();
|
||||
}
|
||||
catch (const std::exception &e)
|
||||
{
|
||||
error_resp.code = CORE_RPC_ERROR_CODE_INTERNAL_ERROR;
|
||||
error_resp.message = "Failed to allocate new account";
|
||||
return false;
|
||||
}
|
||||
|
||||
res.status = CORE_RPC_STATUS_OK;
|
||||
return true;
|
||||
}
|
||||
//------------------------------------------------------------------------------------------------------------------------------
|
||||
bool core_rpc_server::on_cc_debug_delete_account(const COMMAND_RPC_CC_DEBUG_DELETE_ACCOUNT::request& req, COMMAND_RPC_CC_DEBUG_DELETE_ACCOUNT::response& res, epee::json_rpc::error& error_resp, const connection_context *ctx)
|
||||
{
|
||||
try
|
||||
{
|
||||
// throws if it can't allocate
|
||||
RPCLockedTXN lock(m_core);
|
||||
m_core.get_blockchain_storage().get_db().delete_cc_account(req.id);
|
||||
lock.commit();
|
||||
}
|
||||
catch (const std::exception &e)
|
||||
{
|
||||
error_resp.code = CORE_RPC_ERROR_CODE_INTERNAL_ERROR;
|
||||
error_resp.message = "Failed to delete account";
|
||||
return false;
|
||||
}
|
||||
|
||||
res.status = CORE_RPC_STATUS_OK;
|
||||
return true;
|
||||
}
|
||||
//------------------------------------------------------------------------------------------------------------------------------
|
||||
bool core_rpc_server::on_cc_lookup_account(const COMMAND_RPC_CC_LOOKUP_ACCOUNT::request& req, COMMAND_RPC_CC_LOOKUP_ACCOUNT::response& res, epee::json_rpc::error& error_resp, const connection_context *ctx)
|
||||
{
|
||||
crypto::public_key public_key;
|
||||
@ -3514,76 +3460,6 @@ namespace cryptonote
|
||||
return true;
|
||||
}
|
||||
//------------------------------------------------------------------------------------------------------------------------------
|
||||
bool core_rpc_server::on_cc_debug_set_account(const COMMAND_RPC_CC_DEBUG_SET_ACCOUNT::request& req, COMMAND_RPC_CC_DEBUG_SET_ACCOUNT::response& res, epee::json_rpc::error& error_resp, const connection_context *ctx)
|
||||
{
|
||||
try
|
||||
{
|
||||
std::map<uint32_t, uint32_t> item_balances;
|
||||
for (const auto &e: req.item_balances)
|
||||
if (e.amount > 0)
|
||||
item_balances[e.type] += e.amount;
|
||||
RPCLockedTXN lock(m_core);
|
||||
m_core.get_blockchain_storage().get_db().set_cc_account_balance(req.id, req.balance);
|
||||
m_core.get_blockchain_storage().get_db().set_cc_account_item_balances(req.id, item_balances);
|
||||
lock.commit();
|
||||
}
|
||||
catch (const std::exception &e)
|
||||
{
|
||||
error_resp.code = CORE_RPC_ERROR_CODE_INTERNAL_ERROR;
|
||||
error_resp.message = "Failed to set account";
|
||||
return false;
|
||||
}
|
||||
|
||||
res.status = CORE_RPC_STATUS_OK;
|
||||
return true;
|
||||
}
|
||||
//------------------------------------------------------------------------------------------------------------------------------
|
||||
bool core_rpc_server::on_cc_debug_allocate_new_city(const COMMAND_RPC_CC_DEBUG_ALLOCATE_NEW_CITY::request& req, COMMAND_RPC_CC_DEBUG_ALLOCATE_NEW_CITY::response& res, epee::json_rpc::error& error_resp, const connection_context *ctx)
|
||||
{
|
||||
try
|
||||
{
|
||||
// throws if it can't allocate
|
||||
RPCLockedTXN lock(m_core);
|
||||
res.id = m_core.get_blockchain_storage().get_db().allocate_new_cc_city(req.ox, req.oy, req.mayor, req.name);
|
||||
if (!cc::setup_new_city(m_core.get_blockchain_storage().get_db(), res.id, req.ox, req.oy, req.mayor))
|
||||
{
|
||||
error_resp.code = CORE_RPC_ERROR_CODE_INTERNAL_ERROR;
|
||||
error_resp.message = "Failed to setup new city";
|
||||
return false;
|
||||
}
|
||||
lock.commit();
|
||||
}
|
||||
catch (const std::exception &e)
|
||||
{
|
||||
error_resp.code = CORE_RPC_ERROR_CODE_INTERNAL_ERROR;
|
||||
error_resp.message = "Failed to allocate new city";
|
||||
return false;
|
||||
}
|
||||
|
||||
res.status = CORE_RPC_STATUS_OK;
|
||||
return true;
|
||||
}
|
||||
//------------------------------------------------------------------------------------------------------------------------------
|
||||
bool core_rpc_server::on_cc_debug_delete_city(const COMMAND_RPC_CC_DEBUG_DELETE_CITY::request& req, COMMAND_RPC_CC_DEBUG_DELETE_CITY::response& res, epee::json_rpc::error& error_resp, const connection_context *ctx)
|
||||
{
|
||||
try
|
||||
{
|
||||
// throws if it can't allocate
|
||||
RPCLockedTXN lock(m_core);
|
||||
m_core.get_blockchain_storage().get_db().delete_cc_city(req.id);
|
||||
lock.commit();
|
||||
}
|
||||
catch (const std::exception &e)
|
||||
{
|
||||
error_resp.code = CORE_RPC_ERROR_CODE_INTERNAL_ERROR;
|
||||
error_resp.message = "Failed to delete city";
|
||||
return false;
|
||||
}
|
||||
|
||||
res.status = CORE_RPC_STATUS_OK;
|
||||
return true;
|
||||
}
|
||||
//------------------------------------------------------------------------------------------------------------------------------
|
||||
bool core_rpc_server::on_cc_get_city(const COMMAND_RPC_CC_GET_CITY::request& req, COMMAND_RPC_CC_GET_CITY::response& res, epee::json_rpc::error& error_resp, const connection_context *ctx)
|
||||
{
|
||||
try
|
||||
@ -3650,54 +3526,6 @@ namespace cryptonote
|
||||
return true;
|
||||
}
|
||||
//------------------------------------------------------------------------------------------------------------------------------
|
||||
bool core_rpc_server::on_cc_debug_allocate_new_flag(const COMMAND_RPC_CC_DEBUG_ALLOCATE_NEW_FLAG::request& req, COMMAND_RPC_CC_DEBUG_ALLOCATE_NEW_FLAG::response& res, epee::json_rpc::error& error_resp, const connection_context *ctx)
|
||||
{
|
||||
try
|
||||
{
|
||||
// throws if it can't allocate
|
||||
RPCLockedTXN lock(m_core);
|
||||
cryptonote::cc_city_data_t cd;
|
||||
if (!m_core.get_blockchain_storage().get_db().get_cc_city_data(req.city_id, cd))
|
||||
{
|
||||
error_resp.code = CORE_RPC_ERROR_CODE_INTERNAL_ERROR;
|
||||
error_resp.message = "Failed to find city";
|
||||
return false;
|
||||
}
|
||||
const uint8_t stability = cc::get_cc_stability(req.x0, req.y0, req.x1, req.y1, cd.ox, cd.oy);
|
||||
res.id = m_core.get_blockchain_storage().get_db().allocate_new_cc_flag(NULL, req.owner_id, req.city_id, req.x0, req.y0, req.x1, req.y1, stability);
|
||||
lock.commit();
|
||||
}
|
||||
catch (const std::exception &e)
|
||||
{
|
||||
error_resp.code = CORE_RPC_ERROR_CODE_INTERNAL_ERROR;
|
||||
error_resp.message = "Failed to allocate new flag";
|
||||
return false;
|
||||
}
|
||||
|
||||
res.status = CORE_RPC_STATUS_OK;
|
||||
return true;
|
||||
}
|
||||
//------------------------------------------------------------------------------------------------------------------------------
|
||||
bool core_rpc_server::on_cc_debug_delete_flag(const COMMAND_RPC_CC_DEBUG_DELETE_FLAG::request& req, COMMAND_RPC_CC_DEBUG_DELETE_FLAG::response& res, epee::json_rpc::error& error_resp, const connection_context *ctx)
|
||||
{
|
||||
try
|
||||
{
|
||||
// throws if it can't allocate
|
||||
RPCLockedTXN lock(m_core);
|
||||
m_core.get_blockchain_storage().get_db().delete_cc_flag(req.id);
|
||||
lock.commit();
|
||||
}
|
||||
catch (const std::exception &e)
|
||||
{
|
||||
error_resp.code = CORE_RPC_ERROR_CODE_INTERNAL_ERROR;
|
||||
error_resp.message = "Failed to delete flag";
|
||||
return false;
|
||||
}
|
||||
|
||||
res.status = CORE_RPC_STATUS_OK;
|
||||
return true;
|
||||
}
|
||||
//------------------------------------------------------------------------------------------------------------------------------
|
||||
bool core_rpc_server::on_cc_get_flag(const COMMAND_RPC_CC_GET_FLAG::request& req, COMMAND_RPC_CC_GET_FLAG::response& res, epee::json_rpc::error& error_resp, const connection_context *ctx)
|
||||
{
|
||||
try
|
||||
|
@ -185,16 +185,9 @@ namespace cryptonote
|
||||
MAP_JON_RPC_WE_IF("rpc_access_data", on_rpc_access_data, COMMAND_RPC_ACCESS_DATA, !m_restricted)
|
||||
MAP_JON_RPC_WE_IF("rpc_access_account", on_rpc_access_account, COMMAND_RPC_ACCESS_ACCOUNT, !m_restricted)
|
||||
|
||||
MAP_JON_RPC_WE_IF("cc_debug_allocate_new_account", on_cc_debug_allocate_new_account, COMMAND_RPC_CC_DEBUG_ALLOCATE_NEW_ACCOUNT, !m_restricted)
|
||||
MAP_JON_RPC_WE_IF("cc_debug_delete_account", on_cc_debug_delete_account, COMMAND_RPC_CC_DEBUG_DELETE_ACCOUNT, !m_restricted)
|
||||
MAP_JON_RPC_WE("cc_lookup_account", on_cc_lookup_account, COMMAND_RPC_CC_LOOKUP_ACCOUNT)
|
||||
MAP_JON_RPC_WE("cc_get_account", on_cc_get_account, COMMAND_RPC_CC_GET_ACCOUNT)
|
||||
MAP_JON_RPC_WE_IF("cc_debug_set_account", on_cc_debug_set_account, COMMAND_RPC_CC_DEBUG_SET_ACCOUNT, !m_restricted)
|
||||
MAP_JON_RPC_WE_IF("cc_debug_allocate_new_city", on_cc_debug_allocate_new_city, COMMAND_RPC_CC_DEBUG_ALLOCATE_NEW_CITY, !m_restricted)
|
||||
MAP_JON_RPC_WE_IF("cc_debug_delete_city", on_cc_debug_delete_city, COMMAND_RPC_CC_DEBUG_DELETE_CITY, !m_restricted)
|
||||
MAP_JON_RPC_WE("cc_get_city", on_cc_get_city, COMMAND_RPC_CC_GET_CITY)
|
||||
MAP_JON_RPC_WE_IF("cc_debug_allocate_new_flag", on_cc_debug_allocate_new_flag, COMMAND_RPC_CC_DEBUG_ALLOCATE_NEW_FLAG, !m_restricted)
|
||||
MAP_JON_RPC_WE_IF("cc_debug_delete_flag", on_cc_debug_delete_flag, COMMAND_RPC_CC_DEBUG_DELETE_FLAG, !m_restricted)
|
||||
MAP_JON_RPC_WE("cc_get_flag", on_cc_get_flag, COMMAND_RPC_CC_GET_FLAG)
|
||||
MAP_JON_RPC_WE("cc_find_flag", on_cc_find_flag, COMMAND_RPC_CC_FIND_FLAG)
|
||||
MAP_JON_RPC_WE("cc_get_new_flag_cost", on_cc_get_new_flag_cost, COMMAND_RPC_CC_GET_NEW_FLAG_COST)
|
||||
@ -294,16 +287,9 @@ namespace cryptonote
|
||||
bool on_rpc_access_data(const COMMAND_RPC_ACCESS_DATA::request& req, COMMAND_RPC_ACCESS_DATA::response& res, epee::json_rpc::error& error_resp, const connection_context *ctx = NULL);
|
||||
bool on_rpc_access_account(const COMMAND_RPC_ACCESS_ACCOUNT::request& req, COMMAND_RPC_ACCESS_ACCOUNT::response& res, epee::json_rpc::error& error_resp, const connection_context *ctx = NULL);
|
||||
//-----------------------
|
||||
bool on_cc_debug_allocate_new_account(const COMMAND_RPC_CC_DEBUG_ALLOCATE_NEW_ACCOUNT::request& req, COMMAND_RPC_CC_DEBUG_ALLOCATE_NEW_ACCOUNT::response& res, epee::json_rpc::error& error_resp, const connection_context *ctx = NULL);
|
||||
bool on_cc_debug_delete_account(const COMMAND_RPC_CC_DEBUG_DELETE_ACCOUNT::request& req, COMMAND_RPC_CC_DEBUG_DELETE_ACCOUNT::response& res, epee::json_rpc::error& error_resp, const connection_context *ctx = NULL);
|
||||
bool on_cc_lookup_account(const COMMAND_RPC_CC_LOOKUP_ACCOUNT::request& req, COMMAND_RPC_CC_LOOKUP_ACCOUNT::response& res, epee::json_rpc::error& error_resp, const connection_context *ctx = NULL);
|
||||
bool on_cc_get_account(const COMMAND_RPC_CC_GET_ACCOUNT::request& req, COMMAND_RPC_CC_GET_ACCOUNT::response& res, epee::json_rpc::error& error_resp, const connection_context *ctx = NULL);
|
||||
bool on_cc_debug_set_account(const COMMAND_RPC_CC_DEBUG_SET_ACCOUNT::request& req, COMMAND_RPC_CC_DEBUG_SET_ACCOUNT::response& res, epee::json_rpc::error& error_resp, const connection_context *ctx = NULL);
|
||||
bool on_cc_debug_allocate_new_city(const COMMAND_RPC_CC_DEBUG_ALLOCATE_NEW_CITY::request& req, COMMAND_RPC_CC_DEBUG_ALLOCATE_NEW_CITY::response& res, epee::json_rpc::error& error_resp, const connection_context *ctx = NULL);
|
||||
bool on_cc_debug_delete_city(const COMMAND_RPC_CC_DEBUG_DELETE_CITY::request& req, COMMAND_RPC_CC_DEBUG_DELETE_CITY::response& res, epee::json_rpc::error& error_resp, const connection_context *ctx = NULL);
|
||||
bool on_cc_get_city(const COMMAND_RPC_CC_GET_CITY::request& req, COMMAND_RPC_CC_GET_CITY::response& res, epee::json_rpc::error& error_resp, const connection_context *ctx = NULL);
|
||||
bool on_cc_debug_allocate_new_flag(const COMMAND_RPC_CC_DEBUG_ALLOCATE_NEW_FLAG::request& req, COMMAND_RPC_CC_DEBUG_ALLOCATE_NEW_FLAG::response& res, epee::json_rpc::error& error_resp, const connection_context *ctx = NULL);
|
||||
bool on_cc_debug_delete_flag(const COMMAND_RPC_CC_DEBUG_DELETE_FLAG::request& req, COMMAND_RPC_CC_DEBUG_DELETE_FLAG::response& res, epee::json_rpc::error& error_resp, const connection_context *ctx = NULL);
|
||||
bool on_cc_get_flag(const COMMAND_RPC_CC_GET_FLAG::request& req, COMMAND_RPC_CC_GET_FLAG::response& res, epee::json_rpc::error& error_resp, const connection_context *ctx = NULL);
|
||||
bool on_cc_find_flag(const COMMAND_RPC_CC_FIND_FLAG::request& req, COMMAND_RPC_CC_FIND_FLAG::response& res, epee::json_rpc::error& error_resp, const connection_context *ctx = NULL);
|
||||
bool on_cc_get_new_flag_cost(const COMMAND_RPC_CC_GET_NEW_FLAG_COST::request& req, COMMAND_RPC_CC_GET_NEW_FLAG_COST::response& res, epee::json_rpc::error& error_resp, const connection_context *ctx = NULL);
|
||||
|
@ -2694,58 +2694,6 @@ namespace cryptonote
|
||||
};
|
||||
|
||||
// Crypto City
|
||||
struct COMMAND_RPC_CC_DEBUG_ALLOCATE_NEW_ACCOUNT
|
||||
{
|
||||
struct request_t
|
||||
{
|
||||
std::string public_key;
|
||||
std::string name;
|
||||
|
||||
BEGIN_KV_SERIALIZE_MAP()
|
||||
KV_SERIALIZE(public_key)
|
||||
KV_SERIALIZE(name)
|
||||
END_KV_SERIALIZE_MAP()
|
||||
};
|
||||
typedef epee::misc_utils::struct_init<request_t> request;
|
||||
|
||||
struct response_t
|
||||
{
|
||||
uint32_t id;
|
||||
std::string status;
|
||||
|
||||
BEGIN_KV_SERIALIZE_MAP()
|
||||
KV_SERIALIZE(id)
|
||||
KV_SERIALIZE(status)
|
||||
END_KV_SERIALIZE_MAP()
|
||||
};
|
||||
typedef epee::misc_utils::struct_init<response_t> response;
|
||||
};
|
||||
|
||||
struct COMMAND_RPC_CC_DEBUG_DELETE_ACCOUNT
|
||||
{
|
||||
struct request_t
|
||||
{
|
||||
uint32_t id;
|
||||
bool economic_data;
|
||||
|
||||
BEGIN_KV_SERIALIZE_MAP()
|
||||
KV_SERIALIZE(id)
|
||||
KV_SERIALIZE(economic_data)
|
||||
END_KV_SERIALIZE_MAP()
|
||||
};
|
||||
typedef epee::misc_utils::struct_init<request_t> request;
|
||||
|
||||
struct response_t
|
||||
{
|
||||
std::string status;
|
||||
|
||||
BEGIN_KV_SERIALIZE_MAP()
|
||||
KV_SERIALIZE(status)
|
||||
END_KV_SERIALIZE_MAP()
|
||||
};
|
||||
typedef epee::misc_utils::struct_init<response_t> response;
|
||||
};
|
||||
|
||||
struct COMMAND_RPC_CC_GET_ACCOUNT
|
||||
{
|
||||
struct request_t
|
||||
@ -2865,98 +2813,6 @@ namespace cryptonote
|
||||
typedef epee::misc_utils::struct_init<response_t> response;
|
||||
};
|
||||
|
||||
struct COMMAND_RPC_CC_DEBUG_SET_ACCOUNT
|
||||
{
|
||||
struct item_t
|
||||
{
|
||||
uint32_t type;
|
||||
uint32_t amount;
|
||||
|
||||
BEGIN_KV_SERIALIZE_MAP()
|
||||
KV_SERIALIZE(type)
|
||||
KV_SERIALIZE(amount)
|
||||
END_KV_SERIALIZE_MAP()
|
||||
};
|
||||
|
||||
struct request_t
|
||||
{
|
||||
uint32_t id;
|
||||
uint64_t balance;
|
||||
std::vector<item_t> item_balances;
|
||||
|
||||
BEGIN_KV_SERIALIZE_MAP()
|
||||
KV_SERIALIZE(id)
|
||||
KV_SERIALIZE(balance)
|
||||
KV_SERIALIZE(item_balances)
|
||||
END_KV_SERIALIZE_MAP()
|
||||
};
|
||||
typedef epee::misc_utils::struct_init<request_t> request;
|
||||
|
||||
struct response_t
|
||||
{
|
||||
std::string status;
|
||||
|
||||
BEGIN_KV_SERIALIZE_MAP()
|
||||
KV_SERIALIZE(status)
|
||||
END_KV_SERIALIZE_MAP()
|
||||
};
|
||||
typedef epee::misc_utils::struct_init<response_t> response;
|
||||
};
|
||||
|
||||
struct COMMAND_RPC_CC_DEBUG_ALLOCATE_NEW_CITY
|
||||
{
|
||||
struct request_t
|
||||
{
|
||||
uint32_t ox;
|
||||
uint32_t oy;
|
||||
std::string name;
|
||||
uint32_t mayor;
|
||||
|
||||
BEGIN_KV_SERIALIZE_MAP()
|
||||
KV_SERIALIZE(ox)
|
||||
KV_SERIALIZE(oy)
|
||||
KV_SERIALIZE(name)
|
||||
KV_SERIALIZE(mayor)
|
||||
END_KV_SERIALIZE_MAP()
|
||||
};
|
||||
typedef epee::misc_utils::struct_init<request_t> request;
|
||||
|
||||
struct response_t
|
||||
{
|
||||
uint32_t id;
|
||||
std::string status;
|
||||
|
||||
BEGIN_KV_SERIALIZE_MAP()
|
||||
KV_SERIALIZE(id)
|
||||
KV_SERIALIZE(status)
|
||||
END_KV_SERIALIZE_MAP()
|
||||
};
|
||||
typedef epee::misc_utils::struct_init<response_t> response;
|
||||
};
|
||||
|
||||
struct COMMAND_RPC_CC_DEBUG_DELETE_CITY
|
||||
{
|
||||
struct request_t
|
||||
{
|
||||
uint32_t id;
|
||||
|
||||
BEGIN_KV_SERIALIZE_MAP()
|
||||
KV_SERIALIZE(id)
|
||||
END_KV_SERIALIZE_MAP()
|
||||
};
|
||||
typedef epee::misc_utils::struct_init<request_t> request;
|
||||
|
||||
struct response_t
|
||||
{
|
||||
std::string status;
|
||||
|
||||
BEGIN_KV_SERIALIZE_MAP()
|
||||
KV_SERIALIZE(status)
|
||||
END_KV_SERIALIZE_MAP()
|
||||
};
|
||||
typedef epee::misc_utils::struct_init<response_t> response;
|
||||
};
|
||||
|
||||
struct COMMAND_RPC_CC_GET_CITY
|
||||
{
|
||||
struct request_t
|
||||
@ -3006,64 +2862,6 @@ namespace cryptonote
|
||||
typedef epee::misc_utils::struct_init<response_t> response;
|
||||
};
|
||||
|
||||
struct COMMAND_RPC_CC_DEBUG_ALLOCATE_NEW_FLAG
|
||||
{
|
||||
struct request_t
|
||||
{
|
||||
uint32_t owner_id;
|
||||
uint32_t city_id;
|
||||
uint32_t x0;
|
||||
uint32_t y0;
|
||||
uint32_t x1;
|
||||
uint32_t y1;
|
||||
|
||||
BEGIN_KV_SERIALIZE_MAP()
|
||||
KV_SERIALIZE(owner_id)
|
||||
KV_SERIALIZE(city_id)
|
||||
KV_SERIALIZE(x0)
|
||||
KV_SERIALIZE(y0)
|
||||
KV_SERIALIZE(x1)
|
||||
KV_SERIALIZE(y1)
|
||||
END_KV_SERIALIZE_MAP()
|
||||
};
|
||||
typedef epee::misc_utils::struct_init<request_t> request;
|
||||
|
||||
struct response_t
|
||||
{
|
||||
uint32_t id;
|
||||
std::string status;
|
||||
|
||||
BEGIN_KV_SERIALIZE_MAP()
|
||||
KV_SERIALIZE(id)
|
||||
KV_SERIALIZE(status)
|
||||
END_KV_SERIALIZE_MAP()
|
||||
};
|
||||
typedef epee::misc_utils::struct_init<response_t> response;
|
||||
};
|
||||
|
||||
struct COMMAND_RPC_CC_DEBUG_DELETE_FLAG
|
||||
{
|
||||
struct request_t
|
||||
{
|
||||
uint32_t id;
|
||||
|
||||
BEGIN_KV_SERIALIZE_MAP()
|
||||
KV_SERIALIZE(id)
|
||||
END_KV_SERIALIZE_MAP()
|
||||
};
|
||||
typedef epee::misc_utils::struct_init<request_t> request;
|
||||
|
||||
struct response_t
|
||||
{
|
||||
std::string status;
|
||||
|
||||
BEGIN_KV_SERIALIZE_MAP()
|
||||
KV_SERIALIZE(status)
|
||||
END_KV_SERIALIZE_MAP()
|
||||
};
|
||||
typedef epee::misc_utils::struct_init<response_t> response;
|
||||
};
|
||||
|
||||
struct COMMAND_RPC_CC_GET_FLAG
|
||||
{
|
||||
struct request_t
|
||||
|
@ -628,28 +628,6 @@ class Daemon(object):
|
||||
|
||||
# CC
|
||||
|
||||
def cc_debug_allocate_new_account(self, address):
|
||||
cc_debug_allocate_new_account = {
|
||||
'method': 'cc_debug_allocate_new_account',
|
||||
'params': {
|
||||
'address': address,
|
||||
},
|
||||
'jsonrpc': '2.0',
|
||||
'id': '0'
|
||||
}
|
||||
return self.rpc.send_json_rpc_request(cc_debug_allocate_new_account)
|
||||
|
||||
def cc_debug_delete_account(self, id):
|
||||
cc_debug_delete_account = {
|
||||
'method': 'cc_debug_delete_account',
|
||||
'params': {
|
||||
'id': id,
|
||||
},
|
||||
'jsonrpc': '2.0',
|
||||
'id': '0'
|
||||
}
|
||||
return self.rpc.send_json_rpc_request(cc_debug_delete_account)
|
||||
|
||||
def cc_lookup_account(self, address):
|
||||
cc_lookup_account = {
|
||||
'method': 'cc_lookup_account',
|
||||
@ -672,43 +650,6 @@ class Daemon(object):
|
||||
}
|
||||
return self.rpc.send_json_rpc_request(cc_get_account)
|
||||
|
||||
def cc_debug_set_account(self, id, balance, item_balances = []):
|
||||
cc_debug_set_account = {
|
||||
'method': 'cc_debug_set_account',
|
||||
'params': {
|
||||
'id': id,
|
||||
'balance': balance,
|
||||
'item_balances': item_balances,
|
||||
},
|
||||
'jsonrpc': '2.0',
|
||||
'id': '0'
|
||||
}
|
||||
return self.rpc.send_json_rpc_request(cc_debug_set_account)
|
||||
|
||||
def cc_debug_allocate_new_city(self, ox, oy, mayor):
|
||||
cc_debug_allocate_new_city = {
|
||||
'method': 'cc_debug_allocate_new_city',
|
||||
'params': {
|
||||
'ox': ox,
|
||||
'oy': oy,
|
||||
'mayor': mayor,
|
||||
},
|
||||
'jsonrpc': '2.0',
|
||||
'id': '0'
|
||||
}
|
||||
return self.rpc.send_json_rpc_request(cc_debug_allocate_new_city)
|
||||
|
||||
def cc_debug_delete_city(self, id):
|
||||
cc_debug_delete_city = {
|
||||
'method': 'cc_debug_delete_city',
|
||||
'params': {
|
||||
'id': id,
|
||||
},
|
||||
'jsonrpc': '2.0',
|
||||
'id': '0'
|
||||
}
|
||||
return self.rpc.send_json_rpc_request(cc_debug_delete_city)
|
||||
|
||||
def cc_get_city(self, id):
|
||||
cc_get_city = {
|
||||
'method': 'cc_get_city',
|
||||
@ -720,33 +661,6 @@ class Daemon(object):
|
||||
}
|
||||
return self.rpc.send_json_rpc_request(cc_get_city)
|
||||
|
||||
def cc_debug_allocate_new_flag(self, owner_id, city_id, x0, y0, x1, y1):
|
||||
cc_debug_allocate_new_flag = {
|
||||
'method': 'cc_debug_allocate_new_flag',
|
||||
'params': {
|
||||
'owner_id': owner_id,
|
||||
'city_id': city_id,
|
||||
'x0': x0,
|
||||
'y0': y0,
|
||||
'x1': x1,
|
||||
'y1': y1,
|
||||
},
|
||||
'jsonrpc': '2.0',
|
||||
'id': '0'
|
||||
}
|
||||
return self.rpc.send_json_rpc_request(cc_debug_allocate_new_flag)
|
||||
|
||||
def cc_debug_delete_flag(self, id):
|
||||
cc_debug_delete_flag = {
|
||||
'method': 'cc_debug_delete_flag',
|
||||
'params': {
|
||||
'id': id,
|
||||
},
|
||||
'jsonrpc': '2.0',
|
||||
'id': '0'
|
||||
}
|
||||
return self.rpc.send_json_rpc_request(cc_debug_delete_flag)
|
||||
|
||||
def cc_get_flag(self, id, get_tiles = False):
|
||||
cc_get_flag = {
|
||||
'method': 'cc_get_flag',
|
||||
|
Loading…
Reference in New Issue
Block a user