add script owner/player prestige operand

This commit is contained in:
Crypto City 2023-06-05 13:43:41 +00:00
parent 0e425a5743
commit c583f73b08
4 changed files with 18 additions and 1 deletions

View File

@ -1074,6 +1074,16 @@ static std::pair<uint64_t, bool> get_attribute(BlockchainStateProxy &proxy, cons
attribute = oad.coru_rating / 10;
}
break;
case op_player_prestige:
attribute = ad.prestige;
break;
case op_owner_prestige:
{
cryptonote::cc_account_data_t oad;
CHECK_AND_ASSERT_MES(proxy.get_cc_account_data(owner, oad), std::make_pair(0, false), "Failed to get owner data");
attribute = oad.prestige;
}
break;
default:
MERROR("Invalid condition type: " << c.type);
attribute = 0;

View File

@ -53,6 +53,8 @@ typedef enum OperandType
op_flag_epoch,
op_player_coru_rating,
op_owner_coru_rating,
op_player_prestige,
op_owner_prestige,
} OperandType;
static const struct
{
@ -106,6 +108,8 @@ static const struct
{ "flag epoch", op_flag_epoch },
{ "player coru rating", op_player_coru_rating },
{ "owner coru rating", op_owner_coru_rating },
{ "player prestige", op_player_prestige },
{ "owner prestige", op_owner_prestige },
};
typedef enum FunctionType

View File

@ -128,6 +128,7 @@ epoch { return EPOCH; }
title { return TITLE; }
coru { return CORU; }
rating { return RATING; }
prestige { return PRESTIGE; }
\+ { return ADD; }
- { return SUB; }

View File

@ -38,7 +38,7 @@ static script_partial_state_t *state = NULL;
%token <number> IMAGE UI CHOICES CHOICE NEXT SELECTED ENABLED ACTIONS PUBLIC IS BLOCKCHAIN BY OVERRIDES ID
%token <number> GEMSTONE BLOCK LABOUR COIN FOOD CUSTOM IF ELSE STORYLINE RESTRICTED START BACKGROUND LOG
%token <number> PROCEDURE CALL WITH ROLE FLAG CREATE DURING FEES EPOCH TITLE
%token <number> CORU RATING
%token <number> CORU RATING PRESTIGE
%type <number> script script_contents script_content choice_contents choice_content
%type <number> name owner description icon precondition reserves state public storyline
@ -358,6 +358,8 @@ operand: SIGNED_NUMBER { set_partial_state_operand(state, op_signed, $1, NULL, 0
| FLAG operand EPOCH { set_partial_state_operand(state, op_flag_epoch, 0, NULL, 1); }
| PLAYER CORU RATING { set_partial_state_operand(state, op_player_coru_rating, 0, NULL, 0); }
| OWNER CORU RATING { set_partial_state_operand(state, op_owner_coru_rating, 0, NULL, 0); }
| PLAYER PRESTIGE { set_partial_state_operand(state, op_player_prestige, 0, NULL, 0); }
| OWNER PRESTIGE { set_partial_state_operand(state, op_owner_prestige, 0, NULL, 0); }
;
procedure: PROCEDURE STRING '{' actions '}' { set_partial_state_procedure(state, $2); }