Skip to content

Commit

Permalink
Add Shipyard (#10) (#11)
Browse files Browse the repository at this point in the history
Add shipyard and close #4
  • Loading branch information
Jarunik committed May 17, 2019
1 parent 1e8559a commit 08821b7
Show file tree
Hide file tree
Showing 7 changed files with 359 additions and 10 deletions.
29 changes: 19 additions & 10 deletions src/App.vue
Original file line number Diff line number Diff line change
Expand Up @@ -4,18 +4,27 @@
<router-link to="/ranking">{{ $t("Ranking") }}</router-link> |
<router-link to="/shop">{{ $t("Shop") }}</router-link> |
<router-link :to="'/' + userName + '/items'">
{{ $t("Items") }} </router-link
>|
{{ $t("Items") }}
</router-link>
|
<router-link :to="'/' + userName + '/skills'">
{{ $t("Skills") }} </router-link
>|
<router-link :to="'/' + userName + '/missions'">
{{ $t("Missions") }} </router-link
>|
{{ $t("Skills") }}
</router-link>
|
<router-link :to="'/' + userName + '/' + planetId + '/buildings'">
{{ $t("Buildings") }} </router-link
>| <router-link to="/user">{{ userName || $t("Set User") }}</router-link
>|
{{ $t("Buildings") }}
</router-link>
|
<router-link :to="'/' + userName + '/' + planetId + '/shipyard'">
{{ $t("Shipyard") }}
</router-link>
|
<router-link :to="'/' + userName + '/missions'">
{{ $t("Missions") }}
</router-link>
|

<router-link to="/user">{{ userName || $t("Set User") }}</router-link> |
<template v-if="loginUser === null">
<router-link to="/">{{ $t("Login") }}</router-link>
</template>
Expand Down
10 changes: 10 additions & 0 deletions src/router.js
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,16 @@ export default new Router({
import(/* webpackChunkName: "buildings" */ "./views/Buildings.vue"),
props: true
},
{
path: "/:user/:planet/shipyard",
name: "shipyard",
// route level code-splitting
// this generates a separate chunk (about.[hash].js) for this route
// which is lazy-loaded when the route is visited.
component: () =>
import(/* webpackChunkName: "shipyard" */ "./views/Shipyard.vue"),
props: true
},
{
path: "/:user/:planet/production",
name: "production",
Expand Down
11 changes: 11 additions & 0 deletions src/services/shipyard.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
import ApiService from "@/services/api";

class ShipyardService {
async all(planetId) {
const response = await ApiService.get(`/shipyard?id=${planetId}`);

return response;
}
}

export default new ShipyardService();
16 changes: 16 additions & 0 deletions src/services/steemconnect.js
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,22 @@ class SteemConnectService extends Client {

super.customJson([], [user], [appId], finalJson, cb);
}

buildShip(user, planetId, shipName, cb) {
var scJson = {};
var scCommand = {};
// Create Command
scJson["username"] = user;
scJson["type"] = "buildship";
scCommand["tr_var1"] = planetId;
scCommand["tr_var2"] = shipName;

scJson["command"] = scCommand;
var finalJson = JSON.stringify(scJson);
var appId = this.appId();

super.customJson([], [user], [appId], finalJson, cb);
}
}

export default new SteemConnectService();
4 changes: 4 additions & 0 deletions src/views/Buildings.vue
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@
>
{{ $t("Upgrade") }}
</th>
<th>{{ $t(" ") }}</th>
</thead>
<tbody>
<tr v-for="(building, index) in buildings" :key="building.name">
Expand Down Expand Up @@ -182,6 +183,9 @@ export default {
if (this.uranium < building.uranium) {
return false;
}
if (this.current >= this.skill) {
return false;
}
return true;
},
async getQuantity() {
Expand Down
Loading

0 comments on commit 08821b7

Please sign in to comment.