This commit is contained in:
@@ -828,7 +828,7 @@ UniValue rogue_keystrokes(uint64_t txfee,struct CCcontract_info *cp,cJSON *param
|
||||
|
||||
UniValue rogue_extract(uint64_t txfee,struct CCcontract_info *cp,cJSON *params)
|
||||
{
|
||||
UniValue result; CPubKey pk,roguepk; int32_t i,n,num,maxplayers,gameheight,batonht,batonvout,numplayers,regslot,numkeys,err; std::string symbol,pname; CTransaction gametx; uint64_t seed,mult; int64_t buyin,batonvalue; char rogueaddr[64],fname[64],*pubstr,*keystrokes = 0; std::vector<uint8_t> playerdata; uint256 batontxid,playertxid,gametxid; FILE *fp; uint8_t player[10000],pub33[33];
|
||||
UniValue result; CPubKey pk,roguepk; int32_t i,n,num,maxplayers,gameheight,batonht,batonvout,numplayers,regslot,numkeys,err; std::string symbol,pname; CTransaction gametx; uint64_t seed,mult; int64_t buyin,batonvalue; char rogueaddr[64],fname[64],*pubstr,*keystrokes = 0; std::vector<uint8_t> playerdata,newdata; uint256 batontxid,playertxid,gametxid; FILE *fp; uint8_t player[10000],pub33[33];
|
||||
pk = pubkey2pk(Mypubkey());
|
||||
roguepk = GetUnspendable(cp,0);
|
||||
result.push_back(Pair("status","success"));
|
||||
@@ -881,6 +881,18 @@ UniValue rogue_extract(uint64_t txfee,struct CCcontract_info *cp,cJSON *params)
|
||||
fclose(fp);
|
||||
}
|
||||
num = rogue_replay2(player,seed,keystrokes,numkeys,playerdata.size()==0?0:&P,50);
|
||||
newdata.resize(num);
|
||||
for (i=0; i<num; i++)
|
||||
{
|
||||
newdata[i] = player[i];
|
||||
((uint8_t *)&P)[i] = player[i];
|
||||
}
|
||||
if ( P.gold <= 0 || P.hitpoints <= 0 || P.strength <= 0 || P.level <= 0 || P.experience <= 0 || P.dungeonlevel <= 0 )
|
||||
{
|
||||
fprintf(stderr,"zero value character was killed -> no playerdata\n");
|
||||
newdata.resize(0);
|
||||
}
|
||||
else fprintf(stderr,"\nextracted $$$gold.%d hp.%d strength.%d level.%d exp.%d dl.%d n.%d size.%d\n",P.gold,P.hitpoints,P.strength,P.level,P.experience,P.dungeonlevel,n,(int32_t)sizeof(P));
|
||||
if ( keystrokes != 0 )
|
||||
free(keystrokes);
|
||||
} else num = 0;
|
||||
|
||||
Reference in New Issue
Block a user