tx · 7T2Bq9cFUWZJ9CELsMRJySSchaA3yikK6iiNgD4EWBeW 3N37A69qLQj49KGRgWhx9C8Zxb1UjHfL8os: -0.01400000 Waves 2020.07.21 14:54 [1097190] smart account 3N37A69qLQj49KGRgWhx9C8Zxb1UjHfL8os > SELF 0.00000000 Waves
{ "type": 13, "id": "7T2Bq9cFUWZJ9CELsMRJySSchaA3yikK6iiNgD4EWBeW", "fee": 1400000, "feeAssetId": null, "timestamp": 1595332478322, "version": 1, "sender": "3N37A69qLQj49KGRgWhx9C8Zxb1UjHfL8os", "senderPublicKey": "2H7prj9bMBS9xMv4iNhFyNLKx38JpRZ6tnf1GNHu9xUX", "proofs": [ "4wRK2K8WretERxMcQAsYhjcSgC1rVsD45yiNqBq4Gy5ZdpLktR5jMrAFjvcumMJDAy6jZGp4FdTeVLd8rby7DSre" ], "script": "base64:AAIDAAAAAAAAAA8IARIECgIBARIFCgMBAQEAAAAIAQAAAAlnZXRDb29yZHMAAAABAAAAA2tleQkABEwAAAACCQAEGgAAAAIFAAAABHRoaXMJAAEsAAAAAgIAAAAMcG9zaXRpb25MYXRfBQAAAANrZXkJAARMAAAAAgkABBoAAAACBQAAAAR0aGlzCQABLAAAAAICAAAADXBvc2l0aW9uTG9uZ18FAAAAA2tleQUAAAADbmlsAQAAAAlzZXRDb29yZHMAAAADAAAAA2tleQAAAAhsYXRpdHVkZQAAAAlsb25naXR1ZGUJAARMAAAAAgkBAAAACURhdGFFbnRyeQAAAAIJAAEsAAAAAgIAAAAMcG9zaXRpb25MYXRfBQAAAANrZXkFAAAACGxhdGl0dWRlCQAETAAAAAIJAQAAAAlEYXRhRW50cnkAAAACCQABLAAAAAICAAAADXBvc2l0aW9uTG9uZ18FAAAAA2tleQUAAAAJbG9uZ2l0dWRlBQAAAANuaWwBAAAAC3NldEdhbWVEYXRhAAAAAgAAAANpZDAAAAADaWQxBAAAAAZnYW1lSWQJAAEsAAAAAgkAASwAAAACBQAAAANpZDACAAAAAV8FAAAAA2lk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AAAFcGl0Y2gFAAAAA3lhdwUAAAAFZm9yY2UJAQAAAAhXcml0ZVNldAAAAAEJAQAAAA11bnNldEdhbWVEYXRhAAAAAQUAAAAGY2FsbGVyCQEAAAAIV3JpdGVTZXQAAAABCQEAAAAMY2hhbmdlUGxheWVyAAAAAQUAAAAGY2FsbGVyAAAAALDjtiQ=", "chainId": 84, "height": 1097190, "spentComplexity": 0 } View: original | compacted Prev: 5ehFhHmVg3aZJX7wthgQMpTNf9ctEcMYwXQzT5tbGrHS Next: FTjSYj5JvJfyn9D6smakoyRVSFFfZ4Pgj32fJorAKTvd Diff:
Old | New | Differences | |
---|---|---|---|
13 | 13 | } | |
14 | 14 | ||
15 | 15 | ||
16 | - | func getGameId (key) = | |
16 | + | func getGameId (key) = getString(this, ("gameId_" + key)) | |
17 | 17 | ||
18 | 18 | ||
19 | 19 | func unsetGameData (id0) = { | |
20 | - | let gameId = getGameId(id0) | |
20 | + | let gameId = value(getGameId(id0)) | |
21 | 21 | let id1 = getStringValue(this, ("opponent_" + id0)) | |
22 | 22 | [DataEntry(("gameId_" + id0), ""), DataEntry(("gameId_" + id1), ""), DataEntry(("game_" + gameId), false), DataEntry(("gameTurn_" + gameId), "")] | |
23 | 23 | } | |
24 | 24 | ||
25 | 25 | ||
26 | - | func isPlayerTurn (id0) = if ((getStringValue(this, ("gameTurn_" + getGameId(id0))) == id0)) | |
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 | - | func changePlayer (id0) = [DataEntry(("gameTurn_" + getGameId(id0)), getStringValue(this, ("opponent_" + id0)))] | |
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)) | |
41 | 41 | let caller = toString(i.caller) | |
42 | 42 | let coordinates = setCoords(caller, latitude, longitude) | |
43 | 43 | let openGame = getString(this, "openGame") | |
44 | - | if ((getGameId(caller) != "")) | |
44 | + | let gameId = getGameId(caller) | |
45 | + | if (if ((gameId != "")) | |
46 | + | then (gameId != unit) | |
47 | + | else false) | |
45 | 48 | then throw("Please finish your current game, before starting another one") | |
46 | 49 | else if (!(isDefined(openGame))) | |
47 | 50 | then WriteSet(DataEntry("openGame", caller) :: coordinates) |
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 | - | func getGameId (key) = | |
16 | + | func getGameId (key) = getString(this, ("gameId_" + key)) | |
17 | 17 | ||
18 | 18 | ||
19 | 19 | func unsetGameData (id0) = { | |
20 | - | let gameId = getGameId(id0) | |
20 | + | let gameId = value(getGameId(id0)) | |
21 | 21 | let id1 = getStringValue(this, ("opponent_" + id0)) | |
22 | 22 | [DataEntry(("gameId_" + id0), ""), DataEntry(("gameId_" + id1), ""), DataEntry(("game_" + gameId), false), DataEntry(("gameTurn_" + gameId), "")] | |
23 | 23 | } | |
24 | 24 | ||
25 | 25 | ||
26 | - | func isPlayerTurn (id0) = if ((getStringValue(this, ("gameTurn_" + getGameId(id0))) == id0)) | |
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 | - | func changePlayer (id0) = [DataEntry(("gameTurn_" + getGameId(id0)), getStringValue(this, ("opponent_" + id0)))] | |
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 | - | if ((getGameId(caller) != "")) | |
44 | + | let gameId = getGameId(caller) | |
45 | + | if (if ((gameId != "")) | |
46 | + | then (gameId != unit) | |
47 | + | else false) | |
45 | 48 | then throw("Please finish your current game, before starting another one") | |
46 | 49 | else if (!(isDefined(openGame))) | |
47 | 50 | then WriteSet(DataEntry("openGame", caller) :: coordinates) | |
48 | 51 | else if (if ((openGame == "")) | |
49 | 52 | then true | |
50 | 53 | else (openGame == caller)) | |
51 | 54 | then WriteSet(DataEntry("openGame", caller) :: coordinates) | |
52 | 55 | else WriteSet([DataEntry("openGame", ""), coordinates[0], coordinates[1], setGameData(value(openGame), caller)]) | |
53 | 56 | } | |
54 | 57 | ||
55 | 58 | ||
56 | 59 | ||
57 | 60 | @Callable(i) | |
58 | 61 | func executeShot (pitch,yaw,force) = { | |
59 | 62 | let caller = toString(i.caller) | |
60 | 63 | if (!(isPlayerTurn(caller))) | |
61 | 64 | then throw("please wait for your turn") | |
62 | 65 | else if (gotHit(pitch, yaw, force)) | |
63 | 66 | then WriteSet(unsetGameData(caller)) | |
64 | 67 | else WriteSet(changePlayer(caller)) | |
65 | 68 | } | |
66 | 69 | ||
67 | 70 |
github/deemru/w8io/026f985 30.10 ms ◑