tx · FTjSYj5JvJfyn9D6smakoyRVSFFfZ4Pgj32fJorAKTvd 3N37A69qLQj49KGRgWhx9C8Zxb1UjHfL8os: -0.01400000 Waves 2020.07.21 15:16 [1097214] smart account 3N37A69qLQj49KGRgWhx9C8Zxb1UjHfL8os > SELF 0.00000000 Waves
{ "type": 13, "id": "FTjSYj5JvJfyn9D6smakoyRVSFFfZ4Pgj32fJorAKTvd", "fee": 1400000, "feeAssetId": null, "timestamp": 1595333808159, "version": 1, "sender": "3N37A69qLQj49KGRgWhx9C8Zxb1UjHfL8os", "senderPublicKey": "2H7prj9bMBS9xMv4iNhFyNLKx38JpRZ6tnf1GNHu9xUX", "proofs": [ "2hzDBNX5UdcLX5aDW8BFgMw7x9VkDZG1Xu7bnJERU8rK1STYCKNeVcMmZEoMtvFa566VnDc9iKVomnYBVEdMbDcM" ], "script": "base64:AAIDAAAAAAAAAA8IARIECgIBARIFCgMBAQEAAAAIAQAAAAlnZXRDb29yZHMAAAABAAAAA2tleQkABEwAAAACCQAEGgAAAAIFAAAABHRoaXMJAAEsAAAAAgIAAAAMcG9zaXRpb25MYXRfBQAAAANrZXkJAARMAAAAAgkABBoAAAACBQAAAAR0aGlzCQABLAAAAAICAAAADXBvc2l0aW9uTG9uZ18FAAAAA2tleQUAAAADbmlsAQAAAAlzZXRDb29yZHMAAAADAAAAA2tleQAAAAhsYXRpdHVkZQAAAAlsb25naXR1ZGUJAARMAAAAAgkBAAAACURhdGFFbnRyeQAAAAIJAAEsAAAAAgIAAAAMcG9zaXRpb25MYXRfBQAAAANrZXkFAAAACGxhdGl0dWRlCQAETAAAAAIJAQAAAAlEYXRhRW50cnkAAAACCQABLAAAAAICAAAADXBvc2l0aW9uTG9uZ18FAAAAA2tleQUAAAAJbG9uZ2l0dWRlBQAAAANuaWwBAAAAC3NldEdhbWVEYXRhAAAAAgAAAANpZDAAAAADaWQxBAAAAAZnYW1lSWQJAAEsAAAAAgkAASwAAAACBQAAAANpZDACAAAAAV8FAAAAA2l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ABmNhbGxlcgkAAAIAAAABAgAAABlwbGVhc2Ugd2FpdCBmb3IgeW91ciB0dXJuAwkBAAAABmdvdEhpdAAAAAMFAAAABXBpdGNoBQAAAAN5YXcFAAAABWZvcmNlCQEAAAAIV3JpdGVTZXQAAAABCQEAAAANdW5zZXRHYW1lRGF0YQAAAAEFAAAABmNhbGxlcgkBAAAACFdyaXRlU2V0AAAAAQkBAAAADGNoYW5nZVBsYXllcgAAAAEFAAAABmNhbGxlcgAAAAB0JImq", "chainId": 84, "height": 1097214, "spentComplexity": 0 } View: original | compacted Prev: 7T2Bq9cFUWZJ9CELsMRJySSchaA3yikK6iiNgD4EWBeW Next: none Diff:
Old | New | Differences | |
---|---|---|---|
19 | 19 | func unsetGameData (id0) = { | |
20 | 20 | let gameId = value(getGameId(id0)) | |
21 | 21 | let id1 = getStringValue(this, ("opponent_" + id0)) | |
22 | - | [DataEntry(("gameId_" + id0), ""), DataEntry(("gameId_" + id1), ""), DataEntry(("game_" + gameId), false), DataEntry(("gameTurn_" + gameId), "")] | |
22 | + | [DataEntry(("gameId_" + id0), ""), DataEntry(("gameId_" + id1), ""), DataEntry(("game_" + gameId), false), DataEntry(("gameTurn_" + gameId), ""), DataEntry(("gameWinner_" + gameId), id0)] | |
23 | 23 | } | |
24 | 24 | ||
25 | 25 |
Old | New | Differences | |
---|---|---|---|
1 | 1 | {-# STDLIB_VERSION 3 #-} | |
2 | 2 | {-# SCRIPT_TYPE ACCOUNT #-} | |
3 | 3 | {-# CONTENT_TYPE DAPP #-} | |
4 | 4 | func getCoords (key) = [getInteger(this, ("positionLat_" + key)), getInteger(this, ("positionLong_" + key))] | |
5 | 5 | ||
6 | 6 | ||
7 | 7 | func setCoords (key,latitude,longitude) = [DataEntry(("positionLat_" + key), latitude), DataEntry(("positionLong_" + key), longitude)] | |
8 | 8 | ||
9 | 9 | ||
10 | 10 | func setGameData (id0,id1) = { | |
11 | 11 | let gameId = ((id0 + "_") + id1) | |
12 | 12 | [DataEntry(("gameId_" + id0), gameId), DataEntry(("opponent_" + id0), id1), DataEntry(("gameId_" + id1), gameId), DataEntry(("opponent_" + id1), id0), DataEntry(("game_" + gameId), true), DataEntry(("gameTurn_" + gameId), id0), DataEntry(("gameWinner_" + gameId), "")] | |
13 | 13 | } | |
14 | 14 | ||
15 | 15 | ||
16 | 16 | func getGameId (key) = getString(this, ("gameId_" + key)) | |
17 | 17 | ||
18 | 18 | ||
19 | 19 | func unsetGameData (id0) = { | |
20 | 20 | let gameId = value(getGameId(id0)) | |
21 | 21 | let id1 = getStringValue(this, ("opponent_" + id0)) | |
22 | - | [DataEntry(("gameId_" + id0), ""), DataEntry(("gameId_" + id1), ""), DataEntry(("game_" + gameId), false), DataEntry(("gameTurn_" + gameId), "")] | |
22 | + | [DataEntry(("gameId_" + id0), ""), DataEntry(("gameId_" + id1), ""), DataEntry(("game_" + gameId), false), DataEntry(("gameTurn_" + gameId), ""), DataEntry(("gameWinner_" + gameId), id0)] | |
23 | 23 | } | |
24 | 24 | ||
25 | 25 | ||
26 | 26 | func isPlayerTurn (id0) = if ((getStringValue(this, ("gameTurn_" + value(getGameId(id0)))) == id0)) | |
27 | 27 | then true | |
28 | 28 | else false | |
29 | 29 | ||
30 | 30 | ||
31 | 31 | func changePlayer (id0) = [DataEntry(("gameTurn_" + value(getGameId(id0))), getStringValue(this, ("opponent_" + id0)))] | |
32 | 32 | ||
33 | 33 | ||
34 | 34 | func gotHit (pitch,yaw,force) = if ((pitch == yaw)) | |
35 | 35 | then true | |
36 | 36 | else false | |
37 | 37 | ||
38 | 38 | ||
39 | 39 | @Callable(i) | |
40 | 40 | func startGame (latitude,longitude) = { | |
41 | 41 | let caller = toString(i.caller) | |
42 | 42 | let coordinates = setCoords(caller, latitude, longitude) | |
43 | 43 | let openGame = getString(this, "openGame") | |
44 | 44 | let gameId = getGameId(caller) | |
45 | 45 | if (if ((gameId != "")) | |
46 | 46 | then (gameId != unit) | |
47 | 47 | else false) | |
48 | 48 | then throw("Please finish your current game, before starting another one") | |
49 | 49 | else if (!(isDefined(openGame))) | |
50 | 50 | then WriteSet(DataEntry("openGame", caller) :: coordinates) | |
51 | 51 | else if (if ((openGame == "")) | |
52 | 52 | then true | |
53 | 53 | else (openGame == caller)) | |
54 | 54 | then WriteSet(DataEntry("openGame", caller) :: coordinates) | |
55 | 55 | else WriteSet([DataEntry("openGame", ""), coordinates[0], coordinates[1], setGameData(value(openGame), caller)]) | |
56 | 56 | } | |
57 | 57 | ||
58 | 58 | ||
59 | 59 | ||
60 | 60 | @Callable(i) | |
61 | 61 | func executeShot (pitch,yaw,force) = { | |
62 | 62 | let caller = toString(i.caller) | |
63 | 63 | if (!(isPlayerTurn(caller))) | |
64 | 64 | then throw("please wait for your turn") | |
65 | 65 | else if (gotHit(pitch, yaw, force)) | |
66 | 66 | then WriteSet(unsetGameData(caller)) | |
67 | 67 | else WriteSet(changePlayer(caller)) | |
68 | 68 | } | |
69 | 69 | ||
70 | 70 |
github/deemru/w8io/169f3d6 27.45 ms ◑