Settings

Blockchain
Network
Unit
Language
Theme
Sound New Block

Transaction

576dc49c369dfd74554a0ea561217094f7c0839d0a9e217d71ef06c003ea9090
Timestamp (utc)
2021-08-14 18:21:53
Fee Paid
0.00003193 BSV
(
0.00098688 BSV
-
0.00095495 BSV
)
Fee Rate
502.6 sat/KB
Version
1
Confirmations
288,291
Size Stats
6,350 B

3 Outputs

Total Output:
0.00095495 BSV
  • jrun cryptofightsM6{"in":1,"ref":["49932fba5a7a47d91cd61007a993eaefaf12b99344ab1240419aab2ab0eed6db_o1","b9de14ec03e6d9961b3f9fa64cece7ace0bb3dfa0efd3dd7f3a8249c6d01c790_o1","5334f688050535806987424ec00ba75b74a2087c8c3945765dd9107ac81af1a7_o1","e2f4d8e09c9835156a2a221aedd8bb04db191d9642573906439bbd889dde40d0_o1","5dc606e8c78f47a10ecb5f8645f2dbe09a3b3a2da87e7e614dcc150203adba1a_o1"],"out":["775a61257acb720280335131f29900dbcc24b41df8644d47a1e863ce10301d7e"],"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 === 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[this.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[this.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}},"hash":"42e33dff832c9428960af3554abfe2e13ac26cc59de720d764fe2b6b89aedddb","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/576dc49c369dfd74554a0ea561217094f7c0839d0a9e217d71ef06c003ea9090