diff --git a/README.md b/README.md index 91b8be4..e9538cb 100644 --- a/README.md +++ b/README.md @@ -2,11 +2,11 @@ An alternative and experimental client for the blockchain game NextColony. -Demo: https://nc-client.jarunik.com/ +Demo: [nc-client.jarunik.com/](https://nc-client.jarunik.com/) -Documentation about NextColony: https://jarunik.github.io/nc-docs/ +Documentation about NextColony: [jarunik.github.io/nc-docs/](https://jarunik.github.io/nc-docs/) -Official Game Client: https://nextcolony.io +Official Game Client: [nextcolony.io](https://nextcolony.io) ## Contributing @@ -19,34 +19,27 @@ To help with development: 1. Fork the repository 2. Create a feature branch on the `develop` branch 3. Make a pull request to the `develop` branch -4. Let jarunik know on Discord: https://discord.gg/A8tH9Vv +4. Let jarunik know on Discord: [discord.gg/A8tH9Vv](https://discord.gg/A8tH9Vv) 5. Jarunik will review, discuss and merge the pull request. In case you want to do bigger changes: Please describe them in an issue and discuss them with jarunik before implementation. ## Project setup -``` + +```bash npm install ``` ### Compiles and hot-reloads for development -``` + +```bash npm run serve ``` ### Compiles and minifies for production -``` -npm run build -``` -### Run your tests -``` -npm run test -``` - -### Lints and fixes files -``` -npm run lint +```bash +npm run build ``` ### Environment Variables @@ -55,7 +48,7 @@ Please check `.env` for environment configurations. Example: -``` +```bash VUE_APP_ROOT_API=https://nextcolony.io/api VUE_APP_STEEMCONNECT_APP=nc-client VUE_APP_JSON_ID=nextcolony @@ -63,19 +56,19 @@ VUE_APP_JSON_ID=nextcolony You can create a local file `.env.development.local` to use a different configuration during development. This will only work if you have a server providing the needed API's. -`npm run server`will use the `.env.development`environment by default. +`npm run server` will use the `.env.development` environment by default. -``` +```bash VUE_APP_ROOT_API=https://locahost:8080/api VUE_APP_STEEMCONNECT_APP=nc-client VUE_APP_JSON_ID=nextcolony.test ``` -More information about Environment Variables in VueJS: https://cli.vuejs.org/guide/mode-and-env.html#modes +More information about Environment Variables in VueJS: [cli.vuejs.org/guide/mode-and-env.html#modes](https://cli.vuejs.org/guide/mode-and-env.html#modes) #### VUE_APP_ROOT_API -The root of the API server that will provide the data through an API as specified here: https://jarunik.github.io/nc-docs/api/ +The root of the API server that will provide the data through an API as specified here: [jarunik.github.io/nc-docs/api/](https://jarunik.github.io/nc-docs/api/) Example call that will be created: `VUE_APP_ROOT_API + "/loaduser"` @@ -83,12 +76,12 @@ Example call that will be created: `VUE_APP_ROOT_API + "/loaduser"` This is the steemconnect app that will be used to manage the authorities. You will have to create your own to whitelist your IP. -You can find the information to create the Steemconnect App registration here: https://app.steemconnect.com/apps/create +You can find the information to create the Steemconnect App registration here: [app.steemconnect.com/apps/create](https://app.steemconnect.com/apps/create) #### VUE_APP_JSON_ID You have to include the correct ID in order that the backend server will pick up your JSON transactions. -You can find more information about the JSON format here: https://jarunik.github.io/nc-docs/json/ +You can find more information about the JSON format here: [jarunik.github.io/nc-docs/json/](https://jarunik.github.io/nc-docs/json/) The currently productive game server uses the id: `nextcolony`. diff --git a/src/services/steemconnect.js b/src/services/steemconnect.js index 7959d0c..830fbd2 100644 --- a/src/services/steemconnect.js +++ b/src/services/steemconnect.js @@ -76,6 +76,34 @@ class SteemConnectService extends Client { super.customJson([], [user], [appId], finalJson, cb); } + + giftItem(user, itemId, recipient, cb) { + var scJson = {}; + var scCommand = {}; + scJson["username"] = user; + scJson["type"] = "giftitem"; + scCommand["tr_var1"] = itemId; + scCommand["tr_var2"] = recipient; + scJson["command"] = scCommand; + var finalJson = JSON.stringify(scJson); + var appId = this.appId(); + + super.customJson([], [user], [appId], finalJson, cb); + } + + activateItem(user, itemId, planetId, cb) { + var scJson = {}; + var scCommand = {}; + scJson["username"] = user; + scJson["type"] = "activate"; + scCommand["tr_var1"] = itemId; + scCommand["tr_var2"] = planetId; + scJson["command"] = scCommand; + var finalJson = JSON.stringify(scJson); + var appId = this.appId(); + + super.customJson([], [user], [appId], finalJson, cb); + } } export default new SteemConnectService(); diff --git a/src/store/modules/game.js b/src/store/modules/game.js index 0f4b6c6..3983a6a 100644 --- a/src/store/modules/game.js +++ b/src/store/modules/game.js @@ -26,7 +26,7 @@ export default { }, [types.SET_GAME_EXPIRYDATE](state, payload) { state.expiryDate = payload.value; - }, + }, [types.SET_GAME_LANGUAGE](state, payload) { state.language = payload.value; }, @@ -75,7 +75,7 @@ export default { type: types.SET_GAME_EXPIRYDATE, value }); - }, + }, setLanguage: ({ commit }, value) => { localStorage.setItem("gameLanguage", JSON.stringify(value)); diff --git a/src/views/Buildings.vue b/src/views/Buildings.vue index 045d19d..dbfa5e7 100644 --- a/src/views/Buildings.vue +++ b/src/views/Buildings.vue @@ -153,7 +153,7 @@ export default { } } }, - upgradeBuilding(building, index) { + upgradeBuilding(building) { this.clicked.push(building.name); SteemConnectService.setAccessToken(this.$store.state.game.accessToken); SteemConnectService.upgradeBuilding( @@ -161,13 +161,13 @@ export default { this.$store.state.planet.id, building.name, (error, result) => { - if (error === null) { + if (error === null && result.success) { this.chainResponse.push(building.name); } } ); }, - buildingPossible(building, index) { + buildingPossible(building) { if (this.isBusy(building.busy)) { return false; } diff --git a/src/views/Items.vue b/src/views/Items.vue index 991cb43..30e8064 100644 --- a/src/views/Items.vue +++ b/src/views/Items.vue @@ -11,11 +11,41 @@ {{ $t("Name") }} {{ $t("Quantity") }} + {{ $t("Gift") }} + {{ $t("Activate") }} + {{ $t(" ") }} - + {{ $t(item.name) }} {{ item.total }} + + + + + + + + + {{ $t("⌛") }} + @@ -39,13 +69,19 @@