Prevent restoring amulet

This commit is contained in:
jl777
2019-02-10 08:28:43 -11:00
parent deb3326e19
commit 3483c0ac9a
2 changed files with 43 additions and 38 deletions

View File

@@ -1339,41 +1339,44 @@ rs_read_monsters(FILE *inf, struct monster *m, int count)
void rogue_restoreobject(THING *o,struct rogue_packitem *item)
{
int32_t i;
o->_o._o_type = item->type;
o->_o._o_launch = item->launch;
memcpy(o->_o._o_damage,item->damage,sizeof(item->damage));
memcpy(o->_o._o_hurldmg,item->hurldmg,sizeof(item->hurldmg));
o->_o._o_count = item->count;
o->_o._o_which = item->which;
o->_o._o_hplus = item->hplus;
o->_o._o_dplus = item->dplus;
o->_o._o_arm = item->arm;
o->_o._o_flags = item->flags;
o->_o._o_group = item->group;
o->o_flags |= ISKNOW;
o->o_flags &= ~ISFOUND;
switch ( item->type )
if ( item->type != AMULET )
{
case SCROLL:
if ( item->which < MAXSCROLLS )
scr_info[item->which].oi_know = TRUE;
break;
case POTION:
if ( item->which < MAXPOTIONS )
pot_info[item->which].oi_know = TRUE;
break;
case RING:
if ( item->which < MAXRINGS )
ring_info[item->which].oi_know = TRUE;
break;
case STICK:
if ( item->which < MAXSTICKS )
ws_info[item->which].oi_know = TRUE;
break;
o->_o._o_type = item->type;
o->_o._o_launch = item->launch;
memcpy(o->_o._o_damage,item->damage,sizeof(item->damage));
memcpy(o->_o._o_hurldmg,item->hurldmg,sizeof(item->hurldmg));
o->_o._o_count = item->count;
o->_o._o_which = item->which;
o->_o._o_hplus = item->hplus;
o->_o._o_dplus = item->dplus;
o->_o._o_arm = item->arm;
o->_o._o_flags = item->flags;
o->_o._o_group = item->group;
o->o_flags |= ISKNOW;
o->o_flags &= ~ISFOUND;
switch ( item->type )
{
case SCROLL:
if ( item->which < MAXSCROLLS )
scr_info[item->which].oi_know = TRUE;
break;
case POTION:
if ( item->which < MAXPOTIONS )
pot_info[item->which].oi_know = TRUE;
break;
case RING:
if ( item->which < MAXRINGS )
ring_info[item->which].oi_know = TRUE;
break;
case STICK:
if ( item->which < MAXSTICKS )
ws_info[item->which].oi_know = TRUE;
break;
}
char packitemstr[256];
strcpy(packitemstr,inv_name(o,FALSE));
fprintf(stderr,"packitem.(%s)\n",packitemstr);
}
char packitemstr[256];
strcpy(packitemstr,inv_name(o,FALSE));
fprintf(stderr,"packitem.(%s)\n",packitemstr);
}
void rogue_packitemstr(char *packitemstr,struct rogue_packitem *item)
@@ -1440,7 +1443,7 @@ rs_write_object(struct rogue_state *rs,FILE *savef, THING *o)
}
else
{
if ( rs->P.packsize++ == 0 )
if ( rs->P.packsize == 0 )
{
rs->P.gold = purse;
rs->P.hitpoints = max_hp;
@@ -1451,8 +1454,11 @@ rs_write_object(struct rogue_state *rs,FILE *savef, THING *o)
fprintf(stderr,"%ld gold.%d hp.%d strength.%d level.%d exp.%d %d\n",ftell(savef),purse,max_hp,max_stats.s_str,pstats.s_lvl,pstats.s_exp,level);
}
fprintf(stderr,"object (%s) x.%d y.%d type.%d pack.(%c:%d)\n",inv_name(o,FALSE),o->_o._o_pos.x,o->_o._o_pos.y,o->_o._o_type,o->_o._o_packch,o->_o._o_packch);
if ( rs->P.packsize < MAXPACK )
if ( rs->P.packsize < MAXPACK && o->o_type != AMULET )
{
packsave(item,o->_o._o_type,o->_o._o_launch,o->_o._o_damage,sizeof(o->_o._o_damage),o->_o._o_hurldmg,sizeof(o->_o._o_hurldmg),o->_o._o_count,o->_o._o_which,o->_o._o_hplus,o->_o._o_dplus,o->_o._o_arm,o->_o._o_flags,o->_o._o_group);
rs->P.packsize++;
}
}
}
rs_write_marker(savef, RSID_OBJECT);

View File

@@ -114,11 +114,10 @@
*/
// todo:
// -detect playerdeath/quit to prevent illegal keystrokes vector
// make register a token burn
// convert playertxid to the original playertxid
// verify keystrokes tx is in mempool and confirmed
// check that bailout is legal, ie. proper gametxid vin
// verify amulet possession in pack
// -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 &