Fix cclibinfo for rogue

This commit is contained in:
jl777
2019-02-10 07:11:30 -11:00
parent 24c390a0cd
commit 6fdf25af76
10 changed files with 30 additions and 28 deletions

View File

@@ -262,7 +262,7 @@ int32_t CClib_initcp(struct CCcontract_info *cp,uint8_t evalcode)
{
if ( buf2pk(check33) == pk && strcmp(checkaddr,cp->normaladdr) == 0 )
{
fprintf(stderr,"verified evalcode.%d %s %s\n",cp->evalcode,checkaddr,pubkey33_str(str,pub33));
//fprintf(stderr,"verified evalcode.%d %s %s\n",cp->evalcode,checkaddr,pubkey33_str(str,pub33));
return(0);
} else fprintf(stderr,"CClib_initcp mismatched privkey -> addr %s vs %s\n",checkaddr,cp->normaladdr);
}

View File

@@ -58,10 +58,10 @@ CClib_methods[] =
{ (char *)"rogue", (char *)"pending", (char *)"<no args>", 0, 0, 'P', EVAL_ROGUE },
{ (char *)"rogue", (char *)"register", (char *)"gametxid [playertxid]", 1, 2, 'R', EVAL_ROGUE },
{ (char *)"rogue", (char *)"keystrokes", (char *)"gametxid keystrokes", 2, 2, 'K', EVAL_ROGUE },
{ (char *)"rogue", (char *)"bailout", (char *)"baton finalhash", 2, 2, 'Q', EVAL_ROGUE },
{ (char *)"rogue", (char *)"highlander", (char *)"baton finalhash", 2, 2, 'H', EVAL_ROGUE },
{ (char *)"rogue", (char *)"bailout", (char *)"gametxid", 1, 1, 'Q', EVAL_ROGUE },
{ (char *)"rogue", (char *)"highlander", (char *)"gametxid", 1, 1, 'H', EVAL_ROGUE },
{ (char *)"rogue", (char *)"playerinfo", (char *)"playertxid", 1, 1, 'I', EVAL_ROGUE },
{ (char *)"rogue", (char *)"players", (char *)"playertxid", 1, 1, 'D', EVAL_ROGUE },
{ (char *)"rogue", (char *)"players", (char *)"<no args>", 0, 0, 'D', EVAL_ROGUE },
#else
{ (char *)"sudoku", (char *)"gen", (char *)"<no args>", 0, 0, 'G', EVAL_SUDOKU },
{ (char *)"sudoku", (char *)"txidinfo", (char *)"txid", 1, 1, 'T', EVAL_SUDOKU },

View File

@@ -143,7 +143,7 @@ stomach(struct rogue_state *rs,int arg)
if (food_left <= 0)
{
if (food_left-- < -STARVETIME)
death('s');
death(rs,'s');
/*
* the hero is fainting
*/

View File

@@ -175,7 +175,7 @@ attack(struct rogue_state *rs,THING *mp)
endmsg(rs);
has_hit = FALSE;
if (pstats.s_hpt <= 0)
death(mp->t_type); /* Bye bye life ... */
death(rs,mp->t_type); /* Bye bye life ... */
else if (!kamikaze)
{
oldhp -= pstats.s_hpt;
@@ -206,7 +206,7 @@ attack(struct rogue_state *rs,THING *mp)
}
no_command += rnd(2) + 2;
if (no_command > BORE_LEVEL)
death('h');
death(rs,'h');
when 'R':
/*
* Rattlesnakes have poisonous bites
@@ -242,7 +242,7 @@ attack(struct rogue_state *rs,THING *mp)
if (mp->t_type == 'W')
{
if (pstats.s_exp == 0)
death('W'); /* All levels gone */
death(rs,'W'); /* All levels gone */
if (--pstats.s_lvl == 0)
{
pstats.s_exp = 0;
@@ -259,7 +259,7 @@ attack(struct rogue_state *rs,THING *mp)
if (pstats.s_hpt <= 0)
pstats.s_hpt = 1;
if (max_hp <= 0)
death(mp->t_type);
death(rs,mp->t_type);
msg(rs,"you suddenly feel weaker");
}
when 'F':
@@ -269,7 +269,7 @@ attack(struct rogue_state *rs,THING *mp)
player.t_flags |= ISHELD;
sprintf(monsters['F'-'A'].m_stats.s_dmg,"%dx1", ++vf_hit);
if (--pstats.s_hpt <= 0)
death('F');
death(rs,'F');
when 'L':
{
/*
@@ -327,7 +327,7 @@ attack(struct rogue_state *rs,THING *mp)
{
pstats.s_hpt -= vf_hit;
if (pstats.s_hpt <= 0)
death(mp->t_type); /* Bye bye life ... */
death(rs,mp->t_type); /* Bye bye life ... */
}
miss(rs,mname, (char *) NULL, FALSE);
}

View File

@@ -310,7 +310,7 @@ be_trapped(struct rogue_state *rs,coord *tc)
if (pstats.s_hpt <= 0)
{
msg(rs,"an arrow killed you");
death('a');
death(rs,'a');
}
else
msg(rs,"oh no! An arrow shot you");
@@ -340,7 +340,7 @@ be_trapped(struct rogue_state *rs,coord *tc)
if (pstats.s_hpt <= 0)
{
msg(rs,"a poisoned dart killed you");
death('d');
death(rs,'d');
}
if (!ISWEARING(R_SUSTSTR) && !save(VS_POISON))
chg_str(-1);

View File

@@ -227,13 +227,18 @@ score(int amount, int flags, char monst)
*/
void
death(char monst)
death(struct rogue_state *rs,char monst)
{
char **dp, *killer;
struct tm *lt;
static time_t date;
//struct tm *localtime(const time_t *);
if ( rs->guiflag == 0 )
{
fprintf(stderr,"death during replay\n");
rs->replaydone = (uint32_t)time(NULL);
return;
}
signal(SIGINT, SIG_IGN);
purse -= purse / 10;
signal(SIGINT, leave);

View File

@@ -388,7 +388,7 @@ int rogue(int argc, char **argv, char **envp)
level = rnd(100) + 1;
initscr();
getltchars();
death(death_monst());
death(rs,death_monst());
exit(0);
}
}

View File

@@ -586,7 +586,7 @@ void create_obj(struct rogue_state *rs);
void current(struct rogue_state *rs,THING *cur, char *how, char *where);
void d_level(struct rogue_state *rs);
void death(char monst);
void death(struct rogue_state *rs,char monst);
char death_monst(void);
void dig(int y, int x);
void discard(THING *item);

View File

@@ -391,9 +391,9 @@ def:
if ((pstats.s_hpt -= roll(6, 6)) <= 0)
{
if (start == &hero)
death('b');
death(rs,'b');
else
death(moat(start->y, start->x)->t_type);
death(rs,moat(start->y, start->x)->t_type);
}
used = TRUE;
if (terse)

View File

@@ -114,26 +114,23 @@
*/
// todo:
// verify playerdata is usable
// detect playerdeath/quit to prevent illegal keystrokes vector
// -detect playerdeath/quit to prevent illegal keystrokes vector
// verify keystrokes tx is in mempool and confirmed
// check that bailout is legal, ie. proper gametxid vin
// verify amulet possession in pack
// display playerdata (user comments?, or fully decode)
// verify playerdata can be used and has same initial level
// prevent running gui mode when keystrokes txid already there
// -verify playerdata can be used and has same initial level
//////////////////////// start of CClib interface
//./komodod -ac_name=ROGUE -ac_supply=1000000 -pubkey=03951a6f7967ad784453116bc55cd30c54f91ea8a5b1e9b04d6b29cfd6b395ba6c -addnode=5.9.102.210 -ac_cclib=rogue -ac_perc=10000000 -ac_reward=100000000 -ac_cc=60001 -ac_script=2ea22c80203d1579313abe7d8ea85f48c65ea66fc512c878c0d0e6f6d54036669de940febf8103120c008203000401cc > /dev/null &
// cclib newgame 17 \"[3,10]\"
// cclib pending 17
// cclib gameinfo 17 \"[%22f60167a973fc4a5ff08b378bff78bfbfa2f7fae04d603e8deb9acdb1551e0d10%22]\"
// cclib register 17 \"[%22f60167a973fc4a5ff08b378bff78bfbfa2f7fae04d603e8deb9acdb1551e0d10%22]\"
// cclib gameinfo 17 \"[%22a49f90d6b5a226132a8615c9b55b254629611565c69246ea58f7a02059b847bf%22]\"
// cclib register 17 \"[%22a49f90d6b5a226132a8615c9b55b254629611565c69246ea58f7a02059b847bf%22]\"
// ./rogue <seed> gui -> creates keystroke files
// cclib register 17 \"[%22f60167a973fc4a5ff08b378bff78bfbfa2f7fae04d603e8deb9acdb1551e0d10%22,%2233d52f92980ceaa81556093171ee224e085fd384690d83460d6fbbad96fe0e7e%22]\"
// cclib register 17 \"[%22a49f90d6b5a226132a8615c9b55b254629611565c69246ea58f7a02059b847bf%22,%22f3a4a61cfa0dd43733b06d1368c199594258e0f3db983dc1b9b10768a5671909%22]\"
// cclib keystrokes 17 \"[%220a4ecb345ca3090f4acad63f889c3668e46e245cb00ca4b8b57c4677b1ee95b2%22,%22deadbeef%22]\"
// cclib bailout 17 \"[%22f60167a973fc4a5ff08b378bff78bfbfa2f7fae04d603e8deb9acdb1551e0d10%22]\"
// cclib bailout 17 \"[%22a49f90d6b5a226132a8615c9b55b254629611565c69246ea58f7a02059b847bf%22]\"
// eef1d0091a88d85bdac1ede9d31db8504bc466a6695fdf259dac623fce09e0dd
/*
2409 gold.209 hp.17 strength.16 level.3 exp.22 3