Settings

Blockchain
Network
Unit
Language
Theme
Sound New Block

Transaction

6d471f097dd5df07f5a84ffb2b8005a34419f5a94f3f5b6958633c8a48cb99b4
Timestamp (utc)
2021-08-18 16:21:34
Fee Paid
0.00003991 BSV
(
0.00095257 BSV
-
0.00091266 BSV
)
Fee Rate
502.3 sat/KB
Version
1
Confirmations
286,910
Size Stats
7,945 B

3 Outputs

Total Output:
0.00091266 BSV
  • jrun cryptofightsMq{"in":1,"ref":["49932fba5a7a47d91cd61007a993eaefaf12b99344ab1240419aab2ab0eed6db_o1","b9ec210df061c93987b5ab2589c6bc80e531882219b59211a7a3d3dd7f582c9a_o1","5334f688050535806987424ec00ba75b74a2087c8c3945765dd9107ac81af1a7_o1","e2f4d8e09c9835156a2a221aedd8bb04db191d9642573906439bbd889dde40d0_o1","5dc606e8c78f47a10ecb5f8645f2dbe09a3b3a2da87e7e614dcc150203adba1a_o1","870c20f2e1b5f421a3083f749776c059e5bf227d6b2d555f11ffda2306389c56_o1"],"out":["f651a1b8786357ce94b2b493f1767e9aa8eb558e8b0274879d01673128839e1c"],"del":[],"cre":[],"exec":[{"op":"UPGRADE","data":[{"$jig":0},"class Fighter extends FyxJig {\n init(owner, race, abilityScores, appearance, metadata = {}) {\n Fighter.validateStartingScores(race, abilityScores);\n this.race = race;\n this.abilityScores = abilityScores;\n this.appearance = appearance;\n this.metadata = {\n ...metadata,\n publisher: 'FYX'\n };\n\n this.xp = 0;\n this.level = 1;\n\n this.skills = [\n Constants.SkillType.Attack,\n Constants.SkillType.Focus,\n Constants.SkillType.Hide,\n Fighter.initialSkills[race]\n ];\n\n this.levelUpHpBonusDice = [0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0]; \n this.levelUpHpBonusModifiers = [0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0];\n\n this.owner = owner;\n }\n\n setSatoshis(satoshis) {\n this.satoshis = satoshis;\n }\n\n static validateStartingScores(race, abilityScores) {\n const costs = {\n 1: 1,\n 2: 2,\n 3: 4,\n 4: 7,\n 5: 11,\n 6: 16\n };\n\n let cost = 0;\n abilityScores.forEach((score, ability) => {\n const start = Fighter.initialScores[race][ability];\n const upgrade = score - start;\n if (upgrade < 0) throw new Error('Invalid Ability Scores');\n if (upgrade > 0) {\n const points = costs[upgrade];\n if (!points) throw new Error('Invalid Ability Scores');\n cost += points;\n }\n });\n if (cost === 15) return true;\n throw new Error('Invalid Ability Scores');\n }\n\n transfer(recipient) {\n this.owner = recipient;\n }\n\n recordVictory(battle) {\n if (battle.constructor.owner !== Fighter.owner) throw new Error('Unauthorized battle');\n if (battle.validator !== Config.pubkey) {\n console.log('Validator:', battle.validator);\n console.log('Config.pubkey:', Config.pubkey);\n throw new Error('Unauthorized validator');\n }\n if (battle.victor.fighter !== this) throw new Error('Stolen Valor!');\n\n this.xp += battle.xp;\n this.diceSeed = battle.random;\n battle.destroy();\n }\n\n levelUp(ability, skillType) {\n const reqXp = Constants.XPTable[this.level];\n\n if (this.xp < reqXp) {\n throw new Error(`Inadequate XP fighter has ${this.xp}, ${reqXp} is required.`);\n }\n this.level++;\n this.xp -= reqXp;\n if (Constants.SkillLevels.includes(this.level)) {\n if (!skillType) {\n throw new Error('Requested skill at Index ' + skillType + ' is not found!');\n }\n let skillInfo = Constants.SkillData[skillType];\n if ((this.level - 1) < skillInfo.requiredLevel) {\n throw new Error(`Player doesn't meet skill level up requirements to unlock ${skillType}. Player is low level`);\n }\n skillInfo.requiredSkills.forEach(st => {\n if (!this.skills.includes(st)) {\n throw new Error(`Player doesn't meet skill level up requirements unlock ${skillType}. Missing ${st}`);\n }\n });\n\n this._applySkill(skillType);\n skillInfo.unlockableSkills.forEach(st => {\n this._applySkill(st);\n });\n }\n\n if (Constants.AbilityScoreLevels.includes(this.level)) {\n this.abilityScores[ability]++;\n }\n \n if(this.diceSeed == null){\n console.log(`Uninitialized dice seed, using fighter location`);\n this.diceSeed = this.location;\n }\n const dice = new Dice(this.diceSeed);\n const strMod = parseInt(KronoMath.floor((this.abilityScores[0] - 10) / 2));\n if(!this.levelUpHpBonusDice) {\n this.levelUpHpBonusDice = [0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0];\n }\n if(this.levelUpHpBonusDice.length < this.level) {\n for(let i = this.levelUpHpBonusDice.length; i < this.level; i++) {\n this.levelUpHpBonusDice.push(0);\n }\n }\n this.levelUpHpBonusDice[this.level-1] = dice.roll(1,4);\n\n if(!this.levelUpHpBonusModifiers) {\n this.levelUpHpBonusModifiers = [0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0];\n }\n if(this.levelUpHpBonusModifiers.length < this.level) {\n for(let i = this.levelUpHpBonusModifiers.length; i < this.level; i++) {\n this.levelUpHpBonusModifiers.push(0);\n }\n }\n this.levelUpHpBonusModifiers[this.level-1] = strMod;\n }\n\n\n rerollHp(level) {\n const reqXp = KronoMath.floor(Constants.XPTable[level] * Constants.RespecCost);\n\n if (this.xp < reqXp) {\n throw new Error(`Inadequate XP fighter has ${this.xp}, ${reqXp} is required.`);\n }\n \n this.xp -= reqXp;\n \n if(!this.diceSeed){\n console.log(`Uninitialized dice seed, using fighter location`);\n this.diceSeed = this.location;\n }\n const dice = new Dice(this.diceSeed);\n this.diceSeed = Sha256.hashToHex(this.diceSeed);\n\n const strMod = parseInt(KronoMath.floor((this.abilityScores[0] - 10) / 2));\n if(this.levelUpHpBonusDice === null || !this.levelUpHpBonusDice || this.levelUpHpBonusDice.length < this.level){\n this.levelUpHpBonusDice = [0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0];\n }\n this.levelUpHpBonusDice[level] = dice.roll(1,4);\n\n if(this.levelUpHpBonusModifiers === null || !this.levelUpHpBonusModifiers || this.levelUpHpBonusModifiers.length < this.level){\n this.levelUpHpBonusModifiers = [0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0];\n }\n this.levelUpHpBonusModifiers[level] = strMod;\n }\n\n static floor(value)\n {\n return value>0 ? value >> 0 : (value -.5) >> 0;\n }\n\n _applySkill(skillType) {\n // TODO validate prerequesite for skillType\n this.skills.push(skillType);\n }\n\n static async deploy (deployer, prev) {\n if(!prev) {\n console.log('Deploying');\n return deployer.run.deploy(Fighter);\n } else {\n console.log('Upgrading');\n prev.upgrade(Fighter);\n await prev.sync();\n return prev;\n }\n }\n}",{"deps":{"Config":{"$jig":1},"Constants":{"$jig":2},"Dice":{"$jig":3},"FyxJig":{"$jig":4},"KronoMath":{"$jig":5},"Sha256":{"$jig":6}},"hash":"511b13abc7447d91b53afd16d0d862fae254cd8cd148b6494e2635ced6a09657","initialScores":{"0":[8,8,8],"1":[9,7,7],"2":[7,7,7]},"initialSkills":{"0":33,"1":31,"2":32},"metadata":{"app":"Cryptofights","emoji":"👤","name":"Fighter","publisher":"FYX"},"transferrable":true}]}]}
    https://whatsonchain.com/tx/6d471f097dd5df07f5a84ffb2b8005a34419f5a94f3f5b6958633c8a48cb99b4