Transaction

68d5fa4e714fa44e76fa5bfb89a84882f0dc48c497af3e1f2fc737a1e48ff14b
Timestamp (utc)
2021-08-27 15:14:11
Fee Paid
0.00005017 BSV
(
0.00100000 BSV
-
0.00094983 BSV
)
Fee Rate
501.8 sat/KB
Version
1
Confirmations
227,470
Size Stats
9,998 B

3 Outputs

Total Output:
0.00094983 BSV
  • jrun cryptofightsM &{"in":0,"ref":["bfa75b66cfc49c6fa565a95496139aee4b063b26d028b3148473631ac7c84366_o1","780aa10a223532550383173d0414872516bc241a75423d556f1cb57165a8875d_o1","b4af85bf639b6fefc9e7d7eecee383e3506589545f8fec6f2abdbc11d93c7207_o1","a78f5a6d72f78711e66c6211fbbd0a0bfd15ad91bdd00404928a9facc63da6d9_o1","14e278c68ff521e0916ad7c713ae4a0156e76361dbd3b2b357dfb6028e0dca7a_o1","d67bf5454d02dafcb4350e65899d890a0660e51442dc0c0f6f7b256a85d19eac_o1","c2c4c971e85b499c29a8ab2148fd324fe12b550b8f4f57658a4686e011d8fd58_o1","3a67cec3c16bdb847b972bee2fc1c0717c59edcae7bf5f48c91feccfa635af33_o1","71fba386341b932380ec5bfedc3a40bce43d4974decdc94c419a94a8ce5dfc23_o1","98ec0a3651b0fdd3ee89850e6c8f51d1b91f019cd8281704cfdbfbc86bd99329_o1"],"out":["cfefe5d4e8b0f5eb67d74d4b749c457e362d0fbfe8ddda3c843bccdd3b80d04e"],"del":[],"cre":["1AFqaCgQfj2D4CqXJF4zzBM86YnXKXctX"],"exec":[{"op":"DEPLOY","data":["class Battle extends FyxJig {\n init(validator, rules, players, id, timestamp) {\n this.id = this.random = id;\n this.timestamp = timestamp;\n this.rules = rules;\n\n this.battlePlayers = players.map((player, i) => this.joinBattle(player, i < rules.playerCount));\n this.battlegroundTier = rules.tier;\n this.dice = new Dice(id);\n this.state = BattleUtils.buildBattleState(this.battlePlayers, this.dice);\n\n this.turnCount = 0;\n\n this.stateHash = Sha256.hashToHex(JSON.stringify(this.state));\n this.status = Constants.Status.Open;\n this.stateHistory = [];\n this.actor = players[this.state.playerToAct].userId;\n this.stage = 'created';\n \n this.owner = this.validator = validator;\n\n const tempPlayerToAct = this.state.playerToAct;\n\n for (let i = 0; i < 2; i++) {\n this.state.playerToAct = i;\n let skills = this.battlePlayers[i].fighter.skills;\n if (skills.includes(Constants.SkillType.Shadowy))\n {\n var playerName = BattleUtils.getPrettifiedPlayerName(this, this.state);\n let log = `${playerName} uses <sprite name=\"${BattleUtils.parseSkillName(Constants.SkillType.Hide)}\">${BattleUtils.parseSkillName(Constants.SkillType.Hide)}\\n`;\n this.state.actionLogs.push(BattleUtils.abilityCheckAndApplyStatusEffect(this, this.state, this.dice, Constants.SkillType.Hide\n , Constants.Ability.Dexterity, Constants.Ability.Intelligence, Constants.StatusEffect.Hidden, 99, true, log));\n \n this.state.fighterStates = BattleUtils.computeFighterStates(this, this.state);\n }\n }\n \n this.state.playerToAct = tempPlayerToAct; \n }\n\n joinBattle(player, auth) {\n const { userId, pubkey, owner, items, fighter, skills, tags } = player;\n\n if(auth) {\n fighter.auth();\n items.forEach(item => item && item.auth());\n }\n \n const [mainhand, offhand, armor, hat, disguise] = items.map(i => i && i.item && FyxClass.deepClone(i.item));\n\n return {\n userId,\n pubkey,\n owner,\n fighter,\n mainhand,\n offhand,\n armor,\n hat,\n disguise,\n skills,\n tags: tags || []\n };\n }\n\n begin(timeout) {\n if (this.stage !== 'created') throw new Error('Invalid Stage');\n this.timeout = timeout;\n delete this.stage;\n }\n\n resolve(random, timestamp, timeout, actionIndex, sig) {\n const location = this.location;\n console.log('Resolve', this.location);\n if (this.status !== Constants.Status.Open) throw new Error('Invalid Status');\n if (!BattleUtils.validateRandom(random, this.random)) throw new Error('Invalid Random');\n this.sig = sig;\n this.random = random;\n \n this.stateHistory[this.turnCount] = {\n location,\n ...this.getState()\n };\n const state = FyxClass.deepClone(this.state);\n state.actionLogs = [];\n this.dice = new Dice(random);\n if (timestamp < this.timeout) {\n if (actionIndex === -1 || actionIndex === undefined) {\n this.state = BattleUtils.skipTurn(this, state, this.dice, timestamp);\n } else {\n const attacker = this.battlePlayers[this.state.playerToAct];\n const skill = attacker.skills[actionIndex];\n if (!skill) throw new Error(`${attacker.fighter.displayName} used an invalid Skill ID: ${actionIndex}`);\n this.state = skill.run(this, state, this.dice, timestamp);\n }\n } else {\n this.state = BattleUtils.skipTurn(this, state, this.dice, timestamp);\n }\n\n this.status = this.state.status;\n this.timestamp = timestamp;\n this.timeout = timeout;\n this._endTurn();\n }\n\n simulate(state, random, actionIndex) {\n const attacker = this.battlePlayers[state.playerToAct];\n const skill = attacker.skills[actionIndex];\n state.actionLogs = [];\n if (!skill) throw new Error(`${attacker.fighter.displayName} used an invalid Skill ID: ${actionIndex}`);\n let { turnCount } = state;\n state = skill.run(this, state, new Dice(random));\n \n return {\n battleId: this.id,\n ...state,\n battleStatus: state.status,\n random,\n turnCount: turnCount + 1,\n actor: this.battlePlayers[state.playerToAct].userId,\n stateHash: Sha256.hashToHex(JSON.stringify(state)),\n location: this.origin,\n origin: this.origin,\n };\n }\n\n forfeit(userId, sig, timestamp) {\n if (this.status !== Constants.Status.Open) throw new Error('Invalid Status');\n this.stateHistory[this.turnCount] = {\n location: this.location,\n ...this.getState()\n };\n const playerIndex = this.battlePlayers.findIndex(p => p.userId === userId);\n const player = this.battlePlayers[playerIndex];\n const victorIndex = this.battlePlayers.findIndex(p => p.userId !== userId);\n const victor = this.battlePlayers[victorIndex];\n \n const state = FyxClass.deepClone(this.state);\n state.victor = {\n pubkey: victor.pubkey,\n owner: victor.owner,\n fighter: victor.fighter,\n userId: victor.userId\n };\n state.actionLogs = [{\n playerIndex: playerIndex,\n actionLogMessage: `<gradient=!player${playerIndex}-color><b>${player.fighter.metadata.name.toUpperCase()}</b> <gradient=!log-color> Forfeited`\n }];\n state.playerToAct = victorIndex;\n state.status = Constants.Status.Forfeit;\n this.state = state;\n\n this.status = this.state.status;\n this.timestamp = timestamp;\n this._endTurn();\n }\n\n _endTurn() {\n if (this.status !== Constants.Status.Open) {\n this.victor = {...this.battlePlayers[this.state.playerToAct]};\n }\n this.turnCount++;\n this.stateHash = Sha256.hashToHex(JSON.stringify(this.state));\n this.actor = this.battlePlayers[this.state.playerToAct].userId;\n }\n\n finalize() {\n this.stateHistory[this.turnCount] = {\n location: this.location,\n ...this.getState()\n };\n if(![Constants.Status.Complete, Constants.Status.Forfeit].includes(this.status)) throw new Error('Invalid Status');\n const victor = this.victor;\n const loser = this.battlePlayers.find(p => p.userId !== victor.userId);\n\n this.xp = 0;\n // TODO: We should use rawXP instead of level\n // Otherwise they might forego levelling to farm low level mobs for XP\n if(victor.fighter.level <= Battle.LevelCap){ // Level cap\n const xpBonus = this.rules.xpBonus;\n const baseXp = victor.fighter.level * Battle.XPRate + xpBonus;\n\n if(victor.fighter.level<=loser.fighter.level){ // Higher level mobs\n const diff = loser.fighter.level - victor.fighter.level;\n this.xp = parseInt(baseXp * (1 + 0.5*diff));\n }else{ // Lower level mobs\n this.xp = 0;\n }\n }\n \n if (!victor.tags.includes('bot')) {\n const items = issueRewards(this.dice, this.battlegroundTier);\n this.rewards = items.map(i => new FyxItem(victor.fighter.owner, i.metadata, i.item, i.satoshis));\n }\n \n this.owner = victor.fighter.owner;\n this.status = Constants.Status.Finalized;\n }\n \n getState() {\n const state = {\n ...this.state,\n location: this.origin,\n origin: this.origin,\n actor: this.actor,\n battleId: this.id,\n random: this.random,\n stateHash: this.stateHash,\n timestamp: this.timestamp,\n turnCount: this.turnCount,\n timeout: this.timeout,\n battleStatus: this.status\n };\n return state;\n }\n}",{"LevelCap":10,"MaxRounds":100,"XPRate":15,"deps":{"BattleUtils":{"$jig":0},"Config":{"$jig":1},"Constants":{"$jig":2},"Dice":{"$jig":3},"FyxClass":{"$jig":4},"FyxItem":{"$jig":5},"FyxJig":{"$jig":6},"Sha256":{"$jig":7},"expect":{"$jig":8},"issueRewards":{"$jig":9}},"hash":"987625f652a6346d369d77ea81bab9bb66817ee102002fa20a067208381b3a81","metadata":{"app":"Cryptofights","emoji":"⚔","name":"Battle","publisher":"FYX"}}]}]}
    https://whatsonchain.com/tx/68d5fa4e714fa44e76fa5bfb89a84882f0dc48c497af3e1f2fc737a1e48ff14b