tx · 7jFHSfB9KugXPtzH4vmeT5bVSqDzf3RvDaQxRft5JtXD 3NDCyBG5q85JuaRiigUeEtainyjCQT3XpZm: -0.02000000 Waves 2022.12.24 04:21 [2373700] smart account 3NDCyBG5q85JuaRiigUeEtainyjCQT3XpZm > SELF 0.00000000 Waves
{ "type": 13, "id": "7jFHSfB9KugXPtzH4vmeT5bVSqDzf3RvDaQxRft5JtXD", "fee": 2000000, "feeAssetId": null, "timestamp": 1671844873210, "version": 2, "chainId": 84, "sender": "3NDCyBG5q85JuaRiigUeEtainyjCQT3XpZm", "senderPublicKey": "EVooykMNV691Venwp1dHUTBd7KWequzUcda57Wd3LQEX", "proofs": [ "2sm6MFVpNNf2dMvGpLJwxtoV4AdzTAzftLBQPBGzRYqJDidGFNJ8mxiEoRqa8cy8ykU68XfcVrex6dkLqAHgmNaJ" ], "script": "base64:BgI0CAISABIDCgEIEgASAwoBCBIECgIBCBIECgICAhIECgIBCBIECgIBARIECgIICBIECgICAjwABWNoYWluCQCwCQEJAMkBAgkAygECCAUEdGhpcwVieXRlcwABAAEAC3VzZG5Bc3NldElkBAckbWF0Y2gwBQVjaGFpbgMJAAACAgFXBQckbWF0Y2gwASC2JinDBPXOU5GkDkt1JC9kjFGx+t+vVCm9SNIdKrKq0QMJAAACAgFUBQckbWF0Y2gwASD3dur394PKZdtuE+4CO89YKZWpwdGN8kvabNgdYoDI3gkAAgECDVVua25vd24gY2hhaW4ADWluY3ViYXRvckFkZHIEByRtYXRjaDAFBWNoYWluAwkAAAICAVcFByRtYXRjaDAJARFAZXh0ck5hdGl2ZSgxMDYyKQECIzNQRWt0VnV4MlJoY2hTTjYzRHNEbzRiNG16NFFxektTZUR2AwkAAAICAVQFByRtYXRjaDAFBHRoaXMJAAIBAg1Vbmtub3duIGNoYWluAAticmVlZGVyQWRkcgQHJG1hdGNoMAUFY2hhaW4DCQAAAgIBVwUHJG1hdGNoMAkBEUBleHRyTmF0aXZlKDEwNjIpAQIjM1BEVnVVNDVIN0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5ld01hdAkAzAgCCQCRAwIFC2N1cnJlbnRQYWNrBQlicElkeFByb2QFA25pbAIBOgUDbmlsBQR1bml0ADhELMw=", "height": 2373700, "applicationStatus": "succeeded", "spentComplexity": 0 } View: original | compacted Prev: 7g5t5rQfrJkYyopZd59UAi4e3tT4Y31EVUV5khJuyWC7 Next: 8XNJmpGm51w3yzhwpht7AkgrZjNust3eFvtWHPaHMzJo Diff:
Old | New | Differences | |
---|---|---|---|
61 | 61 | ||
62 | 62 | let EXPMATERIALS = 157679960139 | |
63 | 63 | ||
64 | + | let MULT6 = 1000000 | |
65 | + | ||
64 | 66 | let FIVEX = toBigInt(5) | |
65 | 67 | ||
66 | 68 | let TWENTYX = toBigInt(20) | |
116 | 118 | func keyDuckHealth (duckAssetId) = ("duckHealth_" + duckAssetId) | |
117 | 119 | ||
118 | 120 | ||
121 | + | func keyResProportions () = "resTypesProportions" | |
122 | + | ||
123 | + | ||
119 | 124 | let recLandNum = 0 | |
120 | 125 | ||
121 | 126 | let recLandSize = 1 | |
137 | 142 | let bpIdxMat = 2 | |
138 | 143 | ||
139 | 144 | let bpIdxProd = 3 | |
145 | + | ||
146 | + | func getNeededMaterials () = { | |
147 | + | let props = split(value(getString(keyResProportions())), "_") | |
148 | + | if ((size(props) != NUMRES)) | |
149 | + | then throw("Wrong proportions data") | |
150 | + | else { | |
151 | + | let r = [parseIntValue(props[0]), parseIntValue(props[1]), parseIntValue(props[2]), parseIntValue(props[3]), parseIntValue(props[4]), parseIntValue(props[5])] | |
152 | + | let sum = (((((r[0] + r[1]) + r[2]) + r[3]) + r[4]) + r[5]) | |
153 | + | if ((0 >= sum)) | |
154 | + | then throw("No lands staked") | |
155 | + | else { | |
156 | + | let norm6 = fraction(EXPMATERIALS, MULT6, sum) | |
157 | + | func normalizer (acc,elem) = (acc :+ fraction(elem, norm6, MULT6)) | |
158 | + | ||
159 | + | let $l = r | |
160 | + | let $s = size($l) | |
161 | + | let $acc0 = nil | |
162 | + | func $f0_1 ($a,$i) = if (($i >= $s)) | |
163 | + | then $a | |
164 | + | else normalizer($a, $l[$i]) | |
165 | + | ||
166 | + | func $f0_2 ($a,$i) = if (($i >= $s)) | |
167 | + | then $a | |
168 | + | else throw("List size exceeds 6") | |
169 | + | ||
170 | + | $f0_2($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($acc0, 0), 1), 2), 3), 4), 5), 6) | |
171 | + | } | |
172 | + | } | |
173 | + | } | |
174 | + | ||
175 | + | ||
176 | + | func subtractMaterials (has,need) = { | |
177 | + | func subtractor (acc,idx) = { | |
178 | + | let result = (parseIntValue(has[idx]) - need[idx]) | |
179 | + | if ((0 > result)) | |
180 | + | then throw(((((("Not enough material idx=" + toString(idx)) + ", you have ") + has[idx]) + ", but need ") + toString(need[idx]))) | |
181 | + | else (acc :+ toString(result)) | |
182 | + | } | |
183 | + | ||
184 | + | let $l = [0, 1, 2, 3, 4, 5] | |
185 | + | let $s = size($l) | |
186 | + | let $acc0 = nil | |
187 | + | func $f0_1 ($a,$i) = if (($i >= $s)) | |
188 | + | then $a | |
189 | + | else subtractor($a, $l[$i]) | |
190 | + | ||
191 | + | func $f0_2 ($a,$i) = if (($i >= $s)) | |
192 | + | then $a | |
193 | + | else throw("List size exceeds 6") | |
194 | + | ||
195 | + | $f0_2($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($acc0, 0), 1), 2), 3), 4), 5), 6) | |
196 | + | } | |
197 | + | ||
198 | + | ||
199 | + | func updateProportions (terrainCounts,landSizeIndex,sign) = { | |
200 | + | let props = split(valueOrElse(getString(keyResProportions()), "0_0_0_0_0_0"), "_") | |
201 | + | if ((size(props) != NUMRES)) | |
202 | + | then throw("Wrong proportions data") | |
203 | + | else { | |
204 | + | func updater (acc,i) = { | |
205 | + | let result = (parseIntValue(props[i]) + ((sign * terrainCounts[i]) * landSizeIndex)) | |
206 | + | if ((0 > result)) | |
207 | + | then throw(((((((("Panic! Pieces of type=" + toString(i)) + ", sign=") + toString(sign)) + ", terrainCounts[i]=") + toString(terrainCounts[i])) + ", landSizeIndex=") + toString(landSizeIndex))) | |
208 | + | else (acc :+ toString(result)) | |
209 | + | } | |
210 | + | ||
211 | + | let r = { | |
212 | + | let $l = [0, 1, 2, 3, 4, 5] | |
213 | + | let $s = size($l) | |
214 | + | let $acc0 = nil | |
215 | + | func $f0_1 ($a,$i) = if (($i >= $s)) | |
216 | + | then $a | |
217 | + | else updater($a, $l[$i]) | |
218 | + | ||
219 | + | func $f0_2 ($a,$i) = if (($i >= $s)) | |
220 | + | then $a | |
221 | + | else throw("List size exceeds 6") | |
222 | + | ||
223 | + | $f0_2($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($acc0, 0), 1), 2), 3), 4), 5), 6) | |
224 | + | } | |
225 | + | makeString(r, "_") | |
226 | + | } | |
227 | + | } | |
228 | + | ||
140 | 229 | ||
141 | 230 | func countTerrains (terrains) = [(size(split(terrains, "A")) - 1), (size(split(terrains, "B")) - 1), (size(split(terrains, "C")) - 1), (size(split(terrains, "D")) - 1), (size(split(terrains, "E")) - 1), (size(split(terrains, "F")) - 1)] | |
142 | 231 | ||
254 | 343 | let timeKey = keyStakedTimeByAssetId(toBase58String(assetId)) | |
255 | 344 | if (isDefined(getInteger(timeKey))) | |
256 | 345 | then throw((("NFT " + asset.name) + " is already staked")) | |
257 | - | else [IntegerEntry(timeKey, lastBlock.timestamp), IntegerEntry(keyStakedTimeByTypeAssetIdAndOwner(LANDPREFIX, toBase58String(assetId), address), lastBlock.timestamp), StringEntry(keyLandAssetIdToOwner(toBase58String(assetId)), address), StringEntry(keyLandNumToOwner(landNum), address)] | |
346 | + | else { | |
347 | + | let d = split(asset.description, "_") | |
348 | + | let terrainCounts = countTerrains(d[recTerrains]) | |
349 | + | let props = updateProportions(terrainCounts, (numPiecesBySize(d[recLandSize]) / 25), 1) | |
350 | + | [IntegerEntry(timeKey, lastBlock.timestamp), IntegerEntry(keyStakedTimeByTypeAssetIdAndOwner(LANDPREFIX, toBase58String(assetId), address), lastBlock.timestamp), StringEntry(keyLandAssetIdToOwner(toBase58String(assetId)), address), StringEntry(keyLandNumToOwner(landNum), address), StringEntry(keyResProportions(), props)] | |
351 | + | } | |
258 | 352 | } | |
259 | 353 | } | |
260 | 354 | } | |
281 | 375 | let owner = valueOrErrorMessage(getString(keyLandAssetIdToOwner(landAssetId)), (("NFT " + asset.name) + " is orphaned")) | |
282 | 376 | if ((owner != address)) | |
283 | 377 | then throw("Staked NFT is not yours") | |
284 | - | else [ScriptTransfer(i.caller, 1, assetId), DeleteEntry(timeKey), DeleteEntry(keyStakedTimeByTypeAssetIdAndOwner(LANDPREFIX, landAssetId, address))] | |
378 | + | else { | |
379 | + | let d = split(asset.description, "_") | |
380 | + | let terrainCounts = countTerrains(d[recTerrains]) | |
381 | + | let props = updateProportions(terrainCounts, (numPiecesBySize(d[recLandSize]) / 25), -1) | |
382 | + | [ScriptTransfer(i.caller, 1, assetId), DeleteEntry(timeKey), DeleteEntry(keyStakedTimeByTypeAssetIdAndOwner(LANDPREFIX, landAssetId, address)), StringEntry(keyResProportions(), props)] | |
383 | + | } | |
285 | 384 | } | |
286 | 385 | } | |
287 | 386 | } | |
543 | 642 | else if ((0 >= newHP)) | |
544 | 643 | then throw("Your duck health is zero, expedition failed") | |
545 | 644 | else { | |
546 | - | let currentPack = split(valueOrElse(getString(keyBackpackByDuck(duckAssetId)), "0:0_0_0_0_0_0:0_0_0_0_0_0:"), ":") | |
645 | + | let bpKey = keyBackpackByDuck(duckAssetId) | |
646 | + | let currentPack = split(valueOrElse(getString(bpKey), "0:0_0_0_0_0_0:0_0_0_0_0_0:"), ":") | |
647 | + | let matList = split(currentPack[bpIdxMat], "_") | |
648 | + | let mList = if ((size(matList) != NUMRES)) | |
649 | + | then ["0", "0", "0", "0", "0", "0"] | |
650 | + | else matList | |
651 | + | let mNeed = getNeededMaterials() | |
652 | + | let newMat = makeString(mList, "_") | |
547 | 653 | let nums = split_51C(valueOrErrorMessage(getString(keyFreeLandNumsMap()), (keyFreeLandNumsMap() + " is not initialized")), "_") | |
548 | 654 | let len = size(nums) | |
549 | 655 | let bigNum = abs(toBigInt(i.transactionId)) | |
579 | 685 | let issue = Issue(keyNftName(numActionAndSeed._1, "S"), makeString([numActionAndSeed._1, "S", t._1, continent], "_"), 1, 0, false) | |
580 | 686 | let assetId = calculateAssetId(issue) | |
581 | 687 | let id = toBase58String(assetId) | |
582 | - | $Tuple2([numActionAndSeed._2, issue, StringEntry(keyLandToAssetId(numActionAndSeed._1), id), StringEntry(keyLandAssetIdToOwner(id), userAddr), StringEntry(keyLandNumToOwner(numActionAndSeed._1), userAddr), ScriptTransfer(i.caller, 1, assetId), StringEntry(keyDuckLocation(duckAssetId), makeString([continent, "L", id], "_")), IntegerEntry(keyHealth, newHP)], unit) | |
688 | + | $Tuple2([numActionAndSeed._2, issue, StringEntry(keyLandToAssetId(numActionAndSeed._1), id), StringEntry(keyLandAssetIdToOwner(id), userAddr), StringEntry(keyLandNumToOwner(numActionAndSeed._1), userAddr), ScriptTransfer(i.caller, 1, assetId), StringEntry(keyDuckLocation(duckAssetId), makeString([continent, "L", id], "_")), IntegerEntry(keyHealth, newHP), StringEntry(bpKey, makeString([currentPack[bpIdxLevel], currentPack[bpIdxRes], newMat, currentPack[bpIdxProd]], ":"))], unit) | |
583 | 689 | } | |
584 | 690 | } | |
585 | 691 | } |
Old | New | Differences | |
---|---|---|---|
1 | 1 | {-# STDLIB_VERSION 6 #-} | |
2 | 2 | {-# SCRIPT_TYPE ACCOUNT #-} | |
3 | 3 | {-# CONTENT_TYPE DAPP #-} | |
4 | 4 | let chain = toUtf8String(take(drop(this.bytes, 1), 1)) | |
5 | 5 | ||
6 | 6 | let usdnAssetId = match chain { | |
7 | 7 | case _ => | |
8 | 8 | if (("W" == $match0)) | |
9 | 9 | then base58'DG2xFkPdDwKUoBkzGAhQtLpSGzfXLiCYPEzeKH2Ad24p' | |
10 | 10 | else if (("T" == $match0)) | |
11 | 11 | then base58'HezsdQuRDtzksAYUy97gfhKy7Z1NW2uXYSHA3bgqenNZ' | |
12 | 12 | else throw("Unknown chain") | |
13 | 13 | } | |
14 | 14 | ||
15 | 15 | let incubatorAddr = match chain { | |
16 | 16 | case _ => | |
17 | 17 | if (("W" == $match0)) | |
18 | 18 | then addressFromStringValue("3PEktVux2RhchSN63DsDo4b4mz4QqzKSeDv") | |
19 | 19 | else if (("T" == $match0)) | |
20 | 20 | then this | |
21 | 21 | else throw("Unknown chain") | |
22 | 22 | } | |
23 | 23 | ||
24 | 24 | let breederAddr = match chain { | |
25 | 25 | case _ => | |
26 | 26 | if (("W" == $match0)) | |
27 | 27 | then addressFromStringValue("3PDVuU45H7Eh5dmtNbnRNRStGwULA7NY6Hb") | |
28 | 28 | else if (("T" == $match0)) | |
29 | 29 | then this | |
30 | 30 | else throw("Unknown chain") | |
31 | 31 | } | |
32 | 32 | ||
33 | 33 | let economyAddr = match chain { | |
34 | 34 | case _ => | |
35 | 35 | if (("W" == $match0)) | |
36 | 36 | then addressFromStringValue("3P2sk1KncSxRaZs8b4CWGPw2jkvvav74u4D") | |
37 | 37 | else if (("T" == $match0)) | |
38 | 38 | then addressFromStringValue("3N8y4wxX3JC4TdrCJBXX16SjWf6X256hrep") | |
39 | 39 | else throw("Unknown chain") | |
40 | 40 | } | |
41 | 41 | ||
42 | 42 | let pub = base58'6LfPuKJjLgekmncBhMg2LZyMTNVzZBccXR28ySXm9uXD' | |
43 | 43 | ||
44 | 44 | let HEALCOST = 10000 | |
45 | 45 | ||
46 | 46 | let LANDPREFIX = "LAND" | |
47 | 47 | ||
48 | 48 | let DUCKPREFIX = "DUCK" | |
49 | 49 | ||
50 | 50 | let DEFAULTLOCATION = "Africa_F_Africa" | |
51 | 51 | ||
52 | 52 | let NUMRES = 6 | |
53 | 53 | ||
54 | 54 | let DAILYRESBYPIECE = 3456000 | |
55 | 55 | ||
56 | 56 | let DAYMILLIS = 86400000 | |
57 | 57 | ||
58 | 58 | let FIVEMINUTESMILLIS = 300000 | |
59 | 59 | ||
60 | 60 | let RESOURCEPRICEMIN = 158549 | |
61 | 61 | ||
62 | 62 | let EXPMATERIALS = 157679960139 | |
63 | 63 | ||
64 | + | let MULT6 = 1000000 | |
65 | + | ||
64 | 66 | let FIVEX = toBigInt(5) | |
65 | 67 | ||
66 | 68 | let TWENTYX = toBigInt(20) | |
67 | 69 | ||
68 | 70 | let TWENTY2X = toBigInt((20 * 20)) | |
69 | 71 | ||
70 | 72 | let TWENTY3X = toBigInt(((20 * 20) * 20)) | |
71 | 73 | ||
72 | 74 | let TWENTY4X = toBigInt((((20 * 20) * 20) * 20)) | |
73 | 75 | ||
74 | 76 | let TWENTY5X = toBigInt(((((20 * 20) * 20) * 20) * 20)) | |
75 | 77 | ||
76 | 78 | let matTypes = ["Fuel", "Metal", "Plank", "Glass", "Plastic", "Protein"] | |
77 | 79 | ||
78 | 80 | let continents = ["Asia", "Europe", "Americas", "Oceania", "Africa"] | |
79 | 81 | ||
80 | 82 | func keyNextFreeLandNum () = "nextLandNum" | |
81 | 83 | ||
82 | 84 | ||
83 | 85 | func keyFreeLandNumsMap () = "freeLandNumsMap" | |
84 | 86 | ||
85 | 87 | ||
86 | 88 | func keyLandToAssetId (landNum) = ("landToAsset_" + landNum) | |
87 | 89 | ||
88 | 90 | ||
89 | 91 | func keyNftName (landNum,landSize) = ((LANDPREFIX + landNum) + landSize) | |
90 | 92 | ||
91 | 93 | ||
92 | 94 | func keyLandAssetIdToOwner (assetId) = ("nftOwner_" + assetId) | |
93 | 95 | ||
94 | 96 | ||
95 | 97 | func keyDuckIdToOwner (assetId) = ("duckOwner_" + assetId) | |
96 | 98 | ||
97 | 99 | ||
98 | 100 | func keyStakedTimeByAssetId (assetId) = ("stakedTime_" + assetId) | |
99 | 101 | ||
100 | 102 | ||
101 | 103 | func keyStakedDuckByOwner (ownerAddr) = ("stakedDuckByOwner_" + ownerAddr) | |
102 | 104 | ||
103 | 105 | ||
104 | 106 | func keyStakedTimeByTypeAssetIdAndOwner (nftType,assetId,ownerAddr) = ((((("stakedTimeByTypeAssetIdAndOwner_" + nftType) + "_") + assetId) + "_") + ownerAddr) | |
105 | 107 | ||
106 | 108 | ||
107 | 109 | func keyLandNumToOwner (landNum) = ("landOwner_" + landNum) | |
108 | 110 | ||
109 | 111 | ||
110 | 112 | func keyBackpackByDuck (duckAssetId) = ("backPack_" + duckAssetId) | |
111 | 113 | ||
112 | 114 | ||
113 | 115 | func keyDuckLocation (duckAssetId) = ("duckLocation_" + duckAssetId) | |
114 | 116 | ||
115 | 117 | ||
116 | 118 | func keyDuckHealth (duckAssetId) = ("duckHealth_" + duckAssetId) | |
117 | 119 | ||
118 | 120 | ||
121 | + | func keyResProportions () = "resTypesProportions" | |
122 | + | ||
123 | + | ||
119 | 124 | let recLandNum = 0 | |
120 | 125 | ||
121 | 126 | let recLandSize = 1 | |
122 | 127 | ||
123 | 128 | let recTerrains = 2 | |
124 | 129 | ||
125 | 130 | let recContinent = 3 | |
126 | 131 | ||
127 | 132 | let locIdxContinent = 0 | |
128 | 133 | ||
129 | 134 | let locIdxType = 1 | |
130 | 135 | ||
131 | 136 | let locIdxId = 2 | |
132 | 137 | ||
133 | 138 | let bpIdxLevel = 0 | |
134 | 139 | ||
135 | 140 | let bpIdxRes = 1 | |
136 | 141 | ||
137 | 142 | let bpIdxMat = 2 | |
138 | 143 | ||
139 | 144 | let bpIdxProd = 3 | |
145 | + | ||
146 | + | func getNeededMaterials () = { | |
147 | + | let props = split(value(getString(keyResProportions())), "_") | |
148 | + | if ((size(props) != NUMRES)) | |
149 | + | then throw("Wrong proportions data") | |
150 | + | else { | |
151 | + | let r = [parseIntValue(props[0]), parseIntValue(props[1]), parseIntValue(props[2]), parseIntValue(props[3]), parseIntValue(props[4]), parseIntValue(props[5])] | |
152 | + | let sum = (((((r[0] + r[1]) + r[2]) + r[3]) + r[4]) + r[5]) | |
153 | + | if ((0 >= sum)) | |
154 | + | then throw("No lands staked") | |
155 | + | else { | |
156 | + | let norm6 = fraction(EXPMATERIALS, MULT6, sum) | |
157 | + | func normalizer (acc,elem) = (acc :+ fraction(elem, norm6, MULT6)) | |
158 | + | ||
159 | + | let $l = r | |
160 | + | let $s = size($l) | |
161 | + | let $acc0 = nil | |
162 | + | func $f0_1 ($a,$i) = if (($i >= $s)) | |
163 | + | then $a | |
164 | + | else normalizer($a, $l[$i]) | |
165 | + | ||
166 | + | func $f0_2 ($a,$i) = if (($i >= $s)) | |
167 | + | then $a | |
168 | + | else throw("List size exceeds 6") | |
169 | + | ||
170 | + | $f0_2($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($acc0, 0), 1), 2), 3), 4), 5), 6) | |
171 | + | } | |
172 | + | } | |
173 | + | } | |
174 | + | ||
175 | + | ||
176 | + | func subtractMaterials (has,need) = { | |
177 | + | func subtractor (acc,idx) = { | |
178 | + | let result = (parseIntValue(has[idx]) - need[idx]) | |
179 | + | if ((0 > result)) | |
180 | + | then throw(((((("Not enough material idx=" + toString(idx)) + ", you have ") + has[idx]) + ", but need ") + toString(need[idx]))) | |
181 | + | else (acc :+ toString(result)) | |
182 | + | } | |
183 | + | ||
184 | + | let $l = [0, 1, 2, 3, 4, 5] | |
185 | + | let $s = size($l) | |
186 | + | let $acc0 = nil | |
187 | + | func $f0_1 ($a,$i) = if (($i >= $s)) | |
188 | + | then $a | |
189 | + | else subtractor($a, $l[$i]) | |
190 | + | ||
191 | + | func $f0_2 ($a,$i) = if (($i >= $s)) | |
192 | + | then $a | |
193 | + | else throw("List size exceeds 6") | |
194 | + | ||
195 | + | $f0_2($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($acc0, 0), 1), 2), 3), 4), 5), 6) | |
196 | + | } | |
197 | + | ||
198 | + | ||
199 | + | func updateProportions (terrainCounts,landSizeIndex,sign) = { | |
200 | + | let props = split(valueOrElse(getString(keyResProportions()), "0_0_0_0_0_0"), "_") | |
201 | + | if ((size(props) != NUMRES)) | |
202 | + | then throw("Wrong proportions data") | |
203 | + | else { | |
204 | + | func updater (acc,i) = { | |
205 | + | let result = (parseIntValue(props[i]) + ((sign * terrainCounts[i]) * landSizeIndex)) | |
206 | + | if ((0 > result)) | |
207 | + | then throw(((((((("Panic! Pieces of type=" + toString(i)) + ", sign=") + toString(sign)) + ", terrainCounts[i]=") + toString(terrainCounts[i])) + ", landSizeIndex=") + toString(landSizeIndex))) | |
208 | + | else (acc :+ toString(result)) | |
209 | + | } | |
210 | + | ||
211 | + | let r = { | |
212 | + | let $l = [0, 1, 2, 3, 4, 5] | |
213 | + | let $s = size($l) | |
214 | + | let $acc0 = nil | |
215 | + | func $f0_1 ($a,$i) = if (($i >= $s)) | |
216 | + | then $a | |
217 | + | else updater($a, $l[$i]) | |
218 | + | ||
219 | + | func $f0_2 ($a,$i) = if (($i >= $s)) | |
220 | + | then $a | |
221 | + | else throw("List size exceeds 6") | |
222 | + | ||
223 | + | $f0_2($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($acc0, 0), 1), 2), 3), 4), 5), 6) | |
224 | + | } | |
225 | + | makeString(r, "_") | |
226 | + | } | |
227 | + | } | |
228 | + | ||
140 | 229 | ||
141 | 230 | func countTerrains (terrains) = [(size(split(terrains, "A")) - 1), (size(split(terrains, "B")) - 1), (size(split(terrains, "C")) - 1), (size(split(terrains, "D")) - 1), (size(split(terrains, "E")) - 1), (size(split(terrains, "F")) - 1)] | |
142 | 231 | ||
143 | 232 | ||
144 | 233 | func numPiecesBySize (landSize) = match landSize { | |
145 | 234 | case _ => | |
146 | 235 | if (("S" == $match0)) | |
147 | 236 | then 25 | |
148 | 237 | else if (("M" == $match0)) | |
149 | 238 | then 100 | |
150 | 239 | else if (("L" == $match0)) | |
151 | 240 | then 225 | |
152 | 241 | else if (("XL" == $match0)) | |
153 | 242 | then 400 | |
154 | 243 | else if (("XXL" == $match0)) | |
155 | 244 | then 625 | |
156 | 245 | else throw("Unknown land size") | |
157 | 246 | } | |
158 | 247 | ||
159 | 248 | ||
160 | 249 | func subOneInList (aList,idx,amount) = { | |
161 | 250 | func subber (acc,i) = (acc :+ (if ((i == idx)) | |
162 | 251 | then toString((parseIntValue(aList[i]) - amount)) | |
163 | 252 | else aList[i])) | |
164 | 253 | ||
165 | 254 | let r = { | |
166 | 255 | let $l = [0, 1, 2, 3, 4, 5] | |
167 | 256 | let $s = size($l) | |
168 | 257 | let $acc0 = nil | |
169 | 258 | func $f0_1 ($a,$i) = if (($i >= $s)) | |
170 | 259 | then $a | |
171 | 260 | else subber($a, $l[$i]) | |
172 | 261 | ||
173 | 262 | func $f0_2 ($a,$i) = if (($i >= $s)) | |
174 | 263 | then $a | |
175 | 264 | else throw("List size exceeds 6") | |
176 | 265 | ||
177 | 266 | $f0_2($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($acc0, 0), 1), 2), 3), 4), 5), 6) | |
178 | 267 | } | |
179 | 268 | makeString(r, "_") | |
180 | 269 | } | |
181 | 270 | ||
182 | 271 | ||
183 | 272 | func addRes (currentRes,terrainCounts,deltaTime,landSizeIndex) = { | |
184 | 273 | func adder (acc,i) = { | |
185 | 274 | let resOfType = ((fraction(deltaTime, DAILYRESBYPIECE, DAYMILLIS) * terrainCounts[i]) * landSizeIndex) | |
186 | 275 | (acc :+ toString((parseIntValue(currentRes[i]) + resOfType))) | |
187 | 276 | } | |
188 | 277 | ||
189 | 278 | let r = { | |
190 | 279 | let $l = [0, 1, 2, 3, 4, 5] | |
191 | 280 | let $s = size($l) | |
192 | 281 | let $acc0 = nil | |
193 | 282 | func $f0_1 ($a,$i) = if (($i >= $s)) | |
194 | 283 | then $a | |
195 | 284 | else adder($a, $l[$i]) | |
196 | 285 | ||
197 | 286 | func $f0_2 ($a,$i) = if (($i >= $s)) | |
198 | 287 | then $a | |
199 | 288 | else throw("List size exceeds 6") | |
200 | 289 | ||
201 | 290 | $f0_2($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($acc0, 0), 1), 2), 3), 4), 5), 6) | |
202 | 291 | } | |
203 | 292 | makeString(r, "_") | |
204 | 293 | } | |
205 | 294 | ||
206 | 295 | ||
207 | 296 | func abs (x) = if ((x >= toBigInt(0))) | |
208 | 297 | then x | |
209 | 298 | else -(x) | |
210 | 299 | ||
211 | 300 | ||
212 | 301 | let freq = [[1, 4, 9, 10, 15], [5, 8, 13, 14, 15], [6, 9, 14, 15, 16], [4, 7, 8, 13, 18], [1, 6, 7, 15, 19]] | |
213 | 302 | ||
214 | 303 | func genChar (n,freqs) = { | |
215 | 304 | let rem = toInt((n % TWENTYX)) | |
216 | 305 | let letter = if ((freqs[0] > rem)) | |
217 | 306 | then "A" | |
218 | 307 | else if ((freqs[1] > rem)) | |
219 | 308 | then "B" | |
220 | 309 | else if ((freqs[2] > rem)) | |
221 | 310 | then "C" | |
222 | 311 | else if ((freqs[3] > rem)) | |
223 | 312 | then "D" | |
224 | 313 | else if ((freqs[4] > rem)) | |
225 | 314 | then "E" | |
226 | 315 | else "F" | |
227 | 316 | letter | |
228 | 317 | } | |
229 | 318 | ||
230 | 319 | ||
231 | 320 | @Callable(i) | |
232 | 321 | func stakeLand () = { | |
233 | 322 | let pmt = value(i.payments[0]) | |
234 | 323 | let assetId = value(pmt.assetId) | |
235 | 324 | let address = toString(i.caller) | |
236 | 325 | if ((pmt.amount != 1)) | |
237 | 326 | then throw((("NFT " + LANDPREFIX) + " token should be attached as payment")) | |
238 | 327 | else { | |
239 | 328 | let asset = value(assetInfo(assetId)) | |
240 | 329 | if ((asset.issuer != this)) | |
241 | 330 | then throw("Unknown issuer of token") | |
242 | 331 | else if (!(contains(asset.name, LANDPREFIX))) | |
243 | 332 | then throw((("Only NFT " + LANDPREFIX) + " tokens are accepted")) | |
244 | 333 | else { | |
245 | 334 | let landNumSize = drop(asset.name, 4) | |
246 | 335 | let landNum = if (contains(landNumSize, "XXL")) | |
247 | 336 | then dropRight(landNumSize, 3) | |
248 | 337 | else if (contains(landNumSize, "XL")) | |
249 | 338 | then dropRight(landNumSize, 2) | |
250 | 339 | else dropRight(landNumSize, 1) | |
251 | 340 | if (!(isDefined(parseInt(landNum)))) | |
252 | 341 | then throw(("Cannot parse land number from " + asset.name)) | |
253 | 342 | else { | |
254 | 343 | let timeKey = keyStakedTimeByAssetId(toBase58String(assetId)) | |
255 | 344 | if (isDefined(getInteger(timeKey))) | |
256 | 345 | then throw((("NFT " + asset.name) + " is already staked")) | |
257 | - | else [IntegerEntry(timeKey, lastBlock.timestamp), IntegerEntry(keyStakedTimeByTypeAssetIdAndOwner(LANDPREFIX, toBase58String(assetId), address), lastBlock.timestamp), StringEntry(keyLandAssetIdToOwner(toBase58String(assetId)), address), StringEntry(keyLandNumToOwner(landNum), address)] | |
346 | + | else { | |
347 | + | let d = split(asset.description, "_") | |
348 | + | let terrainCounts = countTerrains(d[recTerrains]) | |
349 | + | let props = updateProportions(terrainCounts, (numPiecesBySize(d[recLandSize]) / 25), 1) | |
350 | + | [IntegerEntry(timeKey, lastBlock.timestamp), IntegerEntry(keyStakedTimeByTypeAssetIdAndOwner(LANDPREFIX, toBase58String(assetId), address), lastBlock.timestamp), StringEntry(keyLandAssetIdToOwner(toBase58String(assetId)), address), StringEntry(keyLandNumToOwner(landNum), address), StringEntry(keyResProportions(), props)] | |
351 | + | } | |
258 | 352 | } | |
259 | 353 | } | |
260 | 354 | } | |
261 | 355 | } | |
262 | 356 | ||
263 | 357 | ||
264 | 358 | ||
265 | 359 | @Callable(i) | |
266 | 360 | func unstakeLand (landAssetId) = if ((size(i.payments) != 0)) | |
267 | 361 | then throw("unstake doesn't require any payments") | |
268 | 362 | else { | |
269 | 363 | let assetId = fromBase58String(landAssetId) | |
270 | 364 | let address = toString(i.caller) | |
271 | 365 | let asset = value(assetInfo(assetId)) | |
272 | 366 | if ((asset.issuer != this)) | |
273 | 367 | then throw("Unknown issuer of token") | |
274 | 368 | else if (!(contains(asset.name, LANDPREFIX))) | |
275 | 369 | then throw((("Only NFT " + LANDPREFIX) + " tokens can be unstaked")) | |
276 | 370 | else { | |
277 | 371 | let timeKey = keyStakedTimeByAssetId(landAssetId) | |
278 | 372 | if (!(isDefined(timeKey))) | |
279 | 373 | then throw((("NFT " + asset.name) + " is not staked")) | |
280 | 374 | else { | |
281 | 375 | let owner = valueOrErrorMessage(getString(keyLandAssetIdToOwner(landAssetId)), (("NFT " + asset.name) + " is orphaned")) | |
282 | 376 | if ((owner != address)) | |
283 | 377 | then throw("Staked NFT is not yours") | |
284 | - | else [ScriptTransfer(i.caller, 1, assetId), DeleteEntry(timeKey), DeleteEntry(keyStakedTimeByTypeAssetIdAndOwner(LANDPREFIX, landAssetId, address))] | |
378 | + | else { | |
379 | + | let d = split(asset.description, "_") | |
380 | + | let terrainCounts = countTerrains(d[recTerrains]) | |
381 | + | let props = updateProportions(terrainCounts, (numPiecesBySize(d[recLandSize]) / 25), -1) | |
382 | + | [ScriptTransfer(i.caller, 1, assetId), DeleteEntry(timeKey), DeleteEntry(keyStakedTimeByTypeAssetIdAndOwner(LANDPREFIX, landAssetId, address)), StringEntry(keyResProportions(), props)] | |
383 | + | } | |
285 | 384 | } | |
286 | 385 | } | |
287 | 386 | } | |
288 | 387 | ||
289 | 388 | ||
290 | 389 | ||
291 | 390 | @Callable(i) | |
292 | 391 | func stakeDuck () = { | |
293 | 392 | let pmt = value(i.payments[0]) | |
294 | 393 | let assetId = value(pmt.assetId) | |
295 | 394 | let address = toString(i.caller) | |
296 | 395 | if ((pmt.amount != 1)) | |
297 | 396 | then throw((("NFT " + DUCKPREFIX) + " token should be attached as payment")) | |
298 | 397 | else { | |
299 | 398 | let asset = value(assetInfo(assetId)) | |
300 | 399 | if (if ((asset.issuer != incubatorAddr)) | |
301 | 400 | then (asset.issuer != breederAddr) | |
302 | 401 | else false) | |
303 | 402 | then throw((("Unknown issuer of " + DUCKPREFIX) + " token")) | |
304 | 403 | else if (!(contains(asset.name, DUCKPREFIX))) | |
305 | 404 | then throw((("Only NFT " + DUCKPREFIX) + " tokens are accepted")) | |
306 | 405 | else { | |
307 | 406 | let assetIdStr = toBase58String(assetId) | |
308 | 407 | let timeKey = keyStakedTimeByAssetId(assetIdStr) | |
309 | 408 | if (isDefined(getInteger(timeKey))) | |
310 | 409 | then throw((("NFT " + asset.name) + " is already staked")) | |
311 | 410 | else if (isDefined(getString(keyStakedDuckByOwner(address)))) | |
312 | 411 | then throw(("You already staked one duck: " + asset.name)) | |
313 | 412 | else { | |
314 | 413 | let locKey = keyDuckLocation(assetIdStr) | |
315 | 414 | let location = getString(locKey) | |
316 | 415 | let keyHealth = keyDuckHealth(assetIdStr) | |
317 | 416 | let health = getInteger(keyHealth) | |
318 | 417 | let bpKey = keyBackpackByDuck(assetIdStr) | |
319 | 418 | let backpack = getString(bpKey) | |
320 | 419 | ([IntegerEntry(timeKey, lastBlock.timestamp), IntegerEntry(keyStakedTimeByTypeAssetIdAndOwner(DUCKPREFIX, toBase58String(assetId), address), lastBlock.timestamp), StringEntry(keyDuckIdToOwner(assetIdStr), address), StringEntry(keyStakedDuckByOwner(address), assetIdStr)] ++ (if (isDefined(location)) | |
321 | 420 | then nil | |
322 | 421 | else ([StringEntry(locKey, DEFAULTLOCATION)] ++ (if (isDefined(health)) | |
323 | 422 | then nil | |
324 | 423 | else ([IntegerEntry(keyHealth, 100)] ++ (if (isDefined(backpack)) | |
325 | 424 | then nil | |
326 | 425 | else [StringEntry(bpKey, "0:0_0_0_0_0_0:0_0_0_0_0_0:")])))))) | |
327 | 426 | } | |
328 | 427 | } | |
329 | 428 | } | |
330 | 429 | } | |
331 | 430 | ||
332 | 431 | ||
333 | 432 | ||
334 | 433 | @Callable(i) | |
335 | 434 | func unstakeDuck (assetIdStr) = if ((size(i.payments) != 0)) | |
336 | 435 | then throw("unstake doesn't require any payments") | |
337 | 436 | else { | |
338 | 437 | let assetId = fromBase58String(assetIdStr) | |
339 | 438 | let address = toString(i.caller) | |
340 | 439 | let asset = value(assetInfo(assetId)) | |
341 | 440 | if (if ((asset.issuer != incubatorAddr)) | |
342 | 441 | then (asset.issuer != breederAddr) | |
343 | 442 | else false) | |
344 | 443 | then throw((("Unknown issuer of " + DUCKPREFIX) + " token")) | |
345 | 444 | else if (!(contains(asset.name, DUCKPREFIX))) | |
346 | 445 | then throw((("Only NFT " + DUCKPREFIX) + " tokens can be unstaked")) | |
347 | 446 | else { | |
348 | 447 | let timeKey = keyStakedTimeByAssetId(toBase58String(assetId)) | |
349 | 448 | if (!(isDefined(timeKey))) | |
350 | 449 | then throw((("NFT " + asset.name) + " is not staked")) | |
351 | 450 | else if (!(isDefined(keyStakedDuckByOwner(address)))) | |
352 | 451 | then throw((("The duck " + asset.name) + " is not staked")) | |
353 | 452 | else { | |
354 | 453 | let owner = valueOrErrorMessage(getString(keyDuckIdToOwner(toBase58String(assetId))), (("NFT " + asset.name) + " is orphaned")) | |
355 | 454 | if ((owner != address)) | |
356 | 455 | then throw("Staked NFT is not yours") | |
357 | 456 | else [ScriptTransfer(i.caller, 1, assetId), DeleteEntry(timeKey), DeleteEntry(keyDuckLocation(assetIdStr)), DeleteEntry(keyStakedTimeByTypeAssetIdAndOwner(DUCKPREFIX, assetIdStr, address)), DeleteEntry(keyStakedDuckByOwner(address))] | |
358 | 457 | } | |
359 | 458 | } | |
360 | 459 | } | |
361 | 460 | ||
362 | 461 | ||
363 | 462 | ||
364 | 463 | @Callable(i) | |
365 | 464 | func claimRes (amount,landAssetId) = if ((size(i.payments) != 0)) | |
366 | 465 | then throw("claimRes doesn't require any payments") | |
367 | 466 | else { | |
368 | 467 | let addr = toString(i.caller) | |
369 | 468 | let asset = value(assetInfo(fromBase58String(landAssetId))) | |
370 | 469 | if (!(contains(asset.name, LANDPREFIX))) | |
371 | 470 | then throw((("NFT " + LANDPREFIX) + " token should be passed as param")) | |
372 | 471 | else { | |
373 | 472 | let timeKey = keyStakedTimeByAssetId(landAssetId) | |
374 | 473 | let savedTime = getInteger(timeKey) | |
375 | 474 | if (!(isDefined(savedTime))) | |
376 | 475 | then throw((("NFT " + asset.name) + " is not staked")) | |
377 | 476 | else { | |
378 | 477 | let owner = getStringValue(keyLandAssetIdToOwner(landAssetId)) | |
379 | 478 | if ((owner != addr)) | |
380 | 479 | then throw((LANDPREFIX + " is not yours")) | |
381 | 480 | else { | |
382 | 481 | let d = split(asset.description, "_") | |
383 | 482 | let landSize = d[recLandSize] | |
384 | 483 | let terrainCounts = countTerrains(d[recTerrains]) | |
385 | 484 | let duck = getString(keyStakedDuckByOwner(addr)) | |
386 | 485 | if (!(isDefined(duck))) | |
387 | 486 | then throw("You don't have a duck staked") | |
388 | 487 | else { | |
389 | 488 | let duckAssetIdStr = value(duck) | |
390 | 489 | let curLocation = valueOrElse(getString(keyDuckLocation(duckAssetIdStr)), DEFAULTLOCATION) | |
391 | 490 | let loc = split(value(curLocation), "_") | |
392 | 491 | if ((loc[locIdxType] != "L")) | |
393 | 492 | then throw((("Duck location type is " + loc[locIdxType]) + ", but should be L")) | |
394 | 493 | else if ((loc[locIdxId] != landAssetId)) | |
395 | 494 | then throw(((("Duck location id is " + loc[locIdxId]) + ", but should be ") + landAssetId)) | |
396 | 495 | else { | |
397 | 496 | let deltaTime = (lastBlock.timestamp - value(savedTime)) | |
398 | 497 | if ((0 > deltaTime)) | |
399 | 498 | then throw(((("Saved timestamp is in future, saved = " + toString(value(savedTime))) + ", current = ") + toString(lastBlock.timestamp))) | |
400 | 499 | else { | |
401 | 500 | let pieces = numPiecesBySize(landSize) | |
402 | 501 | let availRes = (fraction(deltaTime, DAILYRESBYPIECE, DAYMILLIS) * pieces) | |
403 | 502 | if ((amount > availRes)) | |
404 | 503 | then throw(((("Not enough resources, available = " + toString(availRes)) + ", requested = ") + toString(amount))) | |
405 | 504 | else { | |
406 | 505 | let newDeltaTime = fraction((availRes - amount), DAYMILLIS, (pieces * DAILYRESBYPIECE)) | |
407 | 506 | let newTimestamp = (lastBlock.timestamp - newDeltaTime) | |
408 | 507 | let bpKey = keyBackpackByDuck(duckAssetIdStr) | |
409 | 508 | let currentPack = split(valueOrElse(getString(bpKey), "0:0_0_0_0_0_0:0_0_0_0_0_0:"), ":") | |
410 | 509 | let currentRes = split(currentPack[bpIdxRes], "_") | |
411 | 510 | let bpRes = addRes(currentRes, terrainCounts, (deltaTime - newDeltaTime), (pieces / 25)) | |
412 | 511 | let newPack = makeString([currentPack[bpIdxLevel], bpRes, currentPack[bpIdxMat], currentPack[bpIdxProd]], ":") | |
413 | 512 | $Tuple2([StringEntry(bpKey, newPack), IntegerEntry(timeKey, newTimestamp), IntegerEntry(keyStakedTimeByTypeAssetIdAndOwner(LANDPREFIX, landAssetId, owner), newTimestamp)], unit) | |
414 | 513 | } | |
415 | 514 | } | |
416 | 515 | } | |
417 | 516 | } | |
418 | 517 | } | |
419 | 518 | } | |
420 | 519 | } | |
421 | 520 | } | |
422 | 521 | ||
423 | 522 | ||
424 | 523 | ||
425 | 524 | @Callable(i) | |
426 | 525 | func flight (message,sig) = if (!(sigVerify_8Kb(message, sig, pub))) | |
427 | 526 | then throw("signature does not match") | |
428 | 527 | else if ((size(i.payments) != 0)) | |
429 | 528 | then throw("flight doesn't require any payments") | |
430 | 529 | else { | |
431 | 530 | let parts = split(toUtf8String(message), ";") | |
432 | 531 | let hp = split(split(parts[0], "|")[0], "_") | |
433 | 532 | let curHP = parseIntValue(hp[0]) | |
434 | 533 | let newHP = parseIntValue(hp[1]) | |
435 | 534 | let newLocAndTime = split(parts[1], ":") | |
436 | 535 | let newLocation = newLocAndTime[0] | |
437 | 536 | let time = parseIntValue(newLocAndTime[1]) | |
438 | 537 | if (if ((time > (lastBlock.timestamp + FIVEMINUTESMILLIS))) | |
439 | 538 | then true | |
440 | 539 | else ((lastBlock.timestamp - FIVEMINUTESMILLIS) > time)) | |
441 | 540 | then throw("signature outdated") | |
442 | 541 | else { | |
443 | 542 | let duckAssetId = valueOrErrorMessage(getString(keyStakedDuckByOwner(toString(i.caller))), "You don't have a duck staked") | |
444 | 543 | let keyHealth = keyDuckHealth(duckAssetId) | |
445 | 544 | let oldFromState = valueOrElse(getInteger(keyHealth), 100) | |
446 | 545 | if ((oldFromState != curHP)) | |
447 | 546 | then throw(((("oldHealth=" + toString(valueOrElse(getInteger(keyHealth), 100))) + " from state does not match one from flight log=") + toString(curHP))) | |
448 | 547 | else if ((0 >= curHP)) | |
449 | 548 | then throw("You can't fly with zero health") | |
450 | 549 | else { | |
451 | 550 | let locKey = keyDuckLocation(duckAssetId) | |
452 | 551 | let curLocation = valueOrElse(getString(locKey), DEFAULTLOCATION) | |
453 | 552 | if ((newLocation == curLocation)) | |
454 | 553 | then throw("You can't fly to the same location") | |
455 | 554 | else $Tuple2([StringEntry(locKey, if ((newHP > 0)) | |
456 | 555 | then newLocation | |
457 | 556 | else curLocation), IntegerEntry(keyHealth, newHP)], unit) | |
458 | 557 | } | |
459 | 558 | } | |
460 | 559 | } | |
461 | 560 | ||
462 | 561 | ||
463 | 562 | ||
464 | 563 | @Callable(i) | |
465 | 564 | func setHealth (health,duckAssetId) = if (if ((0 > health)) | |
466 | 565 | then true | |
467 | 566 | else (health > 100)) | |
468 | 567 | then throw("HP should be within 0..100") | |
469 | 568 | else [IntegerEntry(keyDuckHealth(duckAssetId), health)] | |
470 | 569 | ||
471 | 570 | ||
472 | 571 | ||
473 | 572 | @Callable(i) | |
474 | 573 | func heal (matType,amount) = if (if ((0 > matType)) | |
475 | 574 | then true | |
476 | 575 | else (matType >= NUMRES)) | |
477 | 576 | then throw(("Unknown material: " + toString(matType))) | |
478 | 577 | else if ((0 >= amount)) | |
479 | 578 | then throw(("Amount should be positive! " + toString(amount))) | |
480 | 579 | else { | |
481 | 580 | let duckAssetId = valueOrErrorMessage(getString(keyStakedDuckByOwner(toString(i.caller))), "You don't have a duck staked") | |
482 | 581 | let keyHealth = keyDuckHealth(duckAssetId) | |
483 | 582 | let oldHealth = valueOrElse(getInteger(keyHealth), 100) | |
484 | 583 | if ((oldHealth >= 100)) | |
485 | 584 | then throw("HP should be < 100 to heal") | |
486 | 585 | else { | |
487 | 586 | let bpKey = keyBackpackByDuck(duckAssetId) | |
488 | 587 | let currentPack = split(valueOrElse(getString(bpKey), "0:0_0_0_0_0_0:0_0_0_0_0_0:"), ":") | |
489 | 588 | let matList = split(currentPack[bpIdxMat], "_") | |
490 | 589 | let mList = if ((size(matList) != NUMRES)) | |
491 | 590 | then ["0", "0", "0", "0", "0", "0"] | |
492 | 591 | else matList | |
493 | 592 | let currentAmount = parseIntValue(mList[matType]) | |
494 | 593 | let deltaHealth = min([(amount / HEALCOST), (100 - oldHealth)]) | |
495 | 594 | let spendAmount = (deltaHealth * HEALCOST) | |
496 | 595 | if ((spendAmount > currentAmount)) | |
497 | 596 | then throw(((((("You need " + toString(spendAmount)) + " of ") + matTypes[matType]) + " to heal, but you backpack contains ") + toString(currentAmount))) | |
498 | 597 | else { | |
499 | 598 | let newMat = subOneInList(mList, matType, spendAmount) | |
500 | 599 | [IntegerEntry(keyHealth, (oldHealth + deltaHealth)), StringEntry(bpKey, makeString([currentPack[bpIdxLevel], currentPack[bpIdxRes], newMat, currentPack[bpIdxProd]], ":"))] | |
501 | 600 | } | |
502 | 601 | } | |
503 | 602 | } | |
504 | 603 | ||
505 | 604 | ||
506 | 605 | ||
507 | 606 | @Callable(i) | |
508 | 607 | func updateBackpack (duckAssetId,newPack) = if ((i.caller != economyAddr)) | |
509 | 608 | then throw("permission denied") | |
510 | 609 | else $Tuple2([StringEntry(keyBackpackByDuck(duckAssetId), newPack)], newPack) | |
511 | 610 | ||
512 | 611 | ||
513 | 612 | ||
514 | 613 | @Callable(i) | |
515 | 614 | func expedition (message,sig) = if (!(sigVerify_8Kb(message, sig, pub))) | |
516 | 615 | then throw("signature does not match") | |
517 | 616 | else if ((size(i.payments) != 0)) | |
518 | 617 | then throw("expedition doesn't require any payments") | |
519 | 618 | else { | |
520 | 619 | let parts = split(toUtf8String(message), ";") | |
521 | 620 | let hp = split(split(parts[0], "|")[0], "_") | |
522 | 621 | let curHP = parseIntValue(hp[0]) | |
523 | 622 | let newHP = parseIntValue(hp[1]) | |
524 | 623 | let locAndTime = split(parts[1], ":") | |
525 | 624 | let targetLocation = split(locAndTime[0], "_") | |
526 | 625 | if ((targetLocation[1] != "E")) | |
527 | 626 | then throw("expedition target location type should be E") | |
528 | 627 | else { | |
529 | 628 | let time = parseIntValue(locAndTime[1]) | |
530 | 629 | if (if ((time > (lastBlock.timestamp + FIVEMINUTESMILLIS))) | |
531 | 630 | then true | |
532 | 631 | else ((lastBlock.timestamp - FIVEMINUTESMILLIS) > time)) | |
533 | 632 | then throw("signature outdated") | |
534 | 633 | else { | |
535 | 634 | let userAddr = toString(i.caller) | |
536 | 635 | let duckAssetId = valueOrErrorMessage(getString(keyStakedDuckByOwner(userAddr)), "You don't have a duck staked") | |
537 | 636 | let keyHealth = keyDuckHealth(duckAssetId) | |
538 | 637 | let oldFromState = valueOrElse(getInteger(keyHealth), 100) | |
539 | 638 | if ((oldFromState != curHP)) | |
540 | 639 | then throw(((("oldHealth=" + toString(valueOrElse(getInteger(keyHealth), 100))) + " from state does not match one from flight log=") + toString(curHP))) | |
541 | 640 | else if ((0 >= curHP)) | |
542 | 641 | then throw("You can't fly with zero health") | |
543 | 642 | else if ((0 >= newHP)) | |
544 | 643 | then throw("Your duck health is zero, expedition failed") | |
545 | 644 | else { | |
546 | - | let currentPack = split(valueOrElse(getString(keyBackpackByDuck(duckAssetId)), "0:0_0_0_0_0_0:0_0_0_0_0_0:"), ":") | |
645 | + | let bpKey = keyBackpackByDuck(duckAssetId) | |
646 | + | let currentPack = split(valueOrElse(getString(bpKey), "0:0_0_0_0_0_0:0_0_0_0_0_0:"), ":") | |
647 | + | let matList = split(currentPack[bpIdxMat], "_") | |
648 | + | let mList = if ((size(matList) != NUMRES)) | |
649 | + | then ["0", "0", "0", "0", "0", "0"] | |
650 | + | else matList | |
651 | + | let mNeed = getNeededMaterials() | |
652 | + | let newMat = makeString(mList, "_") | |
547 | 653 | let nums = split_51C(valueOrErrorMessage(getString(keyFreeLandNumsMap()), (keyFreeLandNumsMap() + " is not initialized")), "_") | |
548 | 654 | let len = size(nums) | |
549 | 655 | let bigNum = abs(toBigInt(i.transactionId)) | |
550 | 656 | let numActionAndSeed = if ((len == 0)) | |
551 | 657 | then { | |
552 | 658 | let freeNum = valueOrElse(getInteger(keyNextFreeLandNum()), 501) | |
553 | 659 | $Tuple3(toString(freeNum), IntegerEntry(keyNextFreeLandNum(), (freeNum + 1)), bigNum) | |
554 | 660 | } | |
555 | 661 | else { | |
556 | 662 | let q = toBigInt(len) | |
557 | 663 | let mapIdx = toInt((bigNum % q)) | |
558 | 664 | $Tuple3(nums[mapIdx], StringEntry(keyFreeLandNumsMap(), makeString_11C(removeByIndex(nums, mapIdx), "_")), (bigNum / q)) | |
559 | 665 | } | |
560 | 666 | let continentIdx = toInt((numActionAndSeed._3 % FIVEX)) | |
561 | 667 | let f = freq[continentIdx] | |
562 | 668 | func terrainGenerator (acc,elem) = $Tuple2((((((acc._1 + genChar(acc._2, f)) + genChar((acc._2 / TWENTYX), f)) + genChar((acc._2 / TWENTY2X), f)) + genChar((acc._2 / TWENTY3X), f)) + genChar((acc._2 / TWENTY4X), f)), (acc._2 / TWENTY5X)) | |
563 | 669 | ||
564 | 670 | let t = { | |
565 | 671 | let $l = [1, 2, 3, 4, 5] | |
566 | 672 | let $s = size($l) | |
567 | 673 | let $acc0 = $Tuple2("", (numActionAndSeed._3 / FIVEX)) | |
568 | 674 | func $f0_1 ($a,$i) = if (($i >= $s)) | |
569 | 675 | then $a | |
570 | 676 | else terrainGenerator($a, $l[$i]) | |
571 | 677 | ||
572 | 678 | func $f0_2 ($a,$i) = if (($i >= $s)) | |
573 | 679 | then $a | |
574 | 680 | else throw("List size exceeds 5") | |
575 | 681 | ||
576 | 682 | $f0_2($f0_1($f0_1($f0_1($f0_1($f0_1($acc0, 0), 1), 2), 3), 4), 5) | |
577 | 683 | } | |
578 | 684 | let continent = continents[continentIdx] | |
579 | 685 | let issue = Issue(keyNftName(numActionAndSeed._1, "S"), makeString([numActionAndSeed._1, "S", t._1, continent], "_"), 1, 0, false) | |
580 | 686 | let assetId = calculateAssetId(issue) | |
581 | 687 | let id = toBase58String(assetId) | |
582 | - | $Tuple2([numActionAndSeed._2, issue, StringEntry(keyLandToAssetId(numActionAndSeed._1), id), StringEntry(keyLandAssetIdToOwner(id), userAddr), StringEntry(keyLandNumToOwner(numActionAndSeed._1), userAddr), ScriptTransfer(i.caller, 1, assetId), StringEntry(keyDuckLocation(duckAssetId), makeString([continent, "L", id], "_")), IntegerEntry(keyHealth, newHP)], unit) | |
688 | + | $Tuple2([numActionAndSeed._2, issue, StringEntry(keyLandToAssetId(numActionAndSeed._1), id), StringEntry(keyLandAssetIdToOwner(id), userAddr), StringEntry(keyLandNumToOwner(numActionAndSeed._1), userAddr), ScriptTransfer(i.caller, 1, assetId), StringEntry(keyDuckLocation(duckAssetId), makeString([continent, "L", id], "_")), IntegerEntry(keyHealth, newHP), StringEntry(bpKey, makeString([currentPack[bpIdxLevel], currentPack[bpIdxRes], newMat, currentPack[bpIdxProd]], ":"))], unit) | |
583 | 689 | } | |
584 | 690 | } | |
585 | 691 | } | |
586 | 692 | } | |
587 | 693 | ||
588 | 694 |
github/deemru/w8io/026f985 81.94 ms ◑