From fde52230626138437e5836bf419ad3028ec58d94 Mon Sep 17 00:00:00 2001 From: piernov Date: Sun, 24 Apr 2016 22:29:57 +0200 Subject: Rewrote index.xhtml: GUI rework --- index.xhtml | 78 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++----- 1 file changed, 72 insertions(+), 6 deletions(-) (limited to 'index.xhtml') diff --git a/index.xhtml b/index.xhtml index 5b38b69..6ec45ef 100644 --- a/index.xhtml +++ b/index.xhtml @@ -1,5 +1,6 @@ + @@ -11,13 +12,78 @@ CraftMine + + - + +
+

CraftMine

- 0 - 0 -
- -
+
+
+
+
+
+ 0 + 0 +
+ +
+
+
+ + + +
+
+
+ +
+ +
+
+

Select a building to build:

+
    +
  • +
  • +
+
+
+

There's no shop in this city.

+
+
+

Your inventory is empty.

+
+
+

Look at how poor you are! You can't access the dungeon, it is only for the elite.

+
+
+
+ + + +
+
+
+
-- cgit v1.2.3-70-g09d2 From 8984aa2ecca7feacec93db35aee1570e40fa5123 Mon Sep 17 00:00:00 2001 From: alexichi Date: Mon, 25 Apr 2016 10:18:41 +0200 Subject: Add the guild add buttons to hireMiner and purchase the guild on xhtml javascript send request to the server php -> update $_SESSION for miner --- inc/guild.inc | 19 ++++++++++--------- index.xhtml | 26 +++++++++++++++++++++++--- js/guild.js | 24 ++++++++++++++++-------- 3 files changed, 49 insertions(+), 20 deletions(-) (limited to 'index.xhtml') diff --git a/inc/guild.inc b/inc/guild.inc index 5ede1f6..4ca0262 100644 --- a/inc/guild.inc +++ b/inc/guild.inc @@ -1,29 +1,30 @@ = 150){ + if($_SESSION["mine"]["gold"] >= 50 && !isset($_SESSION["guild"])){ $_SESSION["guild"]= array("miners" => 1); - $_SESSION["mine"]["gold"] -= 150; + $_SESSION["mine"]["gold"] -= 50; echo "Guild has been successfully created"; } else{ - echo "Not enough money"; + echo "g"; } } function hireMiner(){ if(!isset($_SESSION["guild"])){ - echo "

you need to create a guild first"; + echo "you need to create a guild first"; } - if($_SESSION["mine"]["gold"] >= 40){ + if($_SESSION["mine"]["gold"] >= 20 && isset($_SESSION["guild"])){ $_SESSION["guild"]["miners"]++; - $_SESSION["mine"]["gold"] -= 40; + $_SESSION["mine"]["gold"] -= 20; $_SESSION["mine"]["miners"] = $_SESSION["guild"]["miners"]; $mine = $_SESSION["mine"]; - $guild = $_SESSION["guild"]; - echo $mine["gold"]; - echo $mine["miners"]; + echo $mine["gold"] +","+ $mine["miners"]; } } +//function buy($obj,$prix){} + + ?> diff --git a/index.xhtml b/index.xhtml index 30352bf..495d6f4 100644 --- a/index.xhtml +++ b/index.xhtml @@ -21,8 +21,28 @@

- - -
+ + + + + + +
+

Items Shop

+
wooden sword + +
+
golden sword + +
+
life bottle + +
+
strength bottle + +
+
+ + diff --git a/js/guild.js b/js/guild.js index 28f58b8..cb9e783 100644 --- a/js/guild.js +++ b/js/guild.js @@ -1,18 +1,26 @@ function hireMiner(){ - sendRequest("craftmine.php", "op=hireMiner", function() { - //datas.gold -= parseInt(datas.mine); + sendRequest("craftmine.php", "op=hireMiner", function(xhr) { + //data.gold -= 40; var ret = xhr.responseText; - console.log(ret); - //datas.gold = ret; - //updateDatas("gold"); - //updateDatas("miners"); + if(ret != "you need to create a guild first" && ret!=""){ + console.log(ret); + var tmp = ret.split(","); + console.log(tmp); + data.gold = parseInt(tmp[0]); + data.miners = parseInt(tmp[1]); + updateData("gold","miners"); + } }) } function createGuild(){ - sendRequest("craftmine.php", "op=createGuild", function() { + sendRequest("craftmine.php", "op=createGuild", function(xhr) { var ret = xhr.responseText; - console.log(ret); + if(ret != "g"){ + document.getElementById("guild").innerHTML = ret; + data.gold -= 50; + updateData("gold"); + } }) } -- cgit v1.2.3-70-g09d2 From 8140617aeb2f32f7095a443ca743c6d6915739c6 Mon Sep 17 00:00:00 2001 From: alexichi Date: Mon, 25 Apr 2016 13:45:05 +0200 Subject: change class of Hire a Miner, and change type submit to button for items --- index.xhtml | 2 +- js/shop.js | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) (limited to 'index.xhtml') diff --git a/index.xhtml b/index.xhtml index 1685eb9..aa29615 100644 --- a/index.xhtml +++ b/index.xhtml @@ -31,7 +31,7 @@
- +
diff --git a/js/shop.js b/js/shop.js index 00636e1..22ca85f 100644 --- a/js/shop.js +++ b/js/shop.js @@ -25,7 +25,7 @@ function buildShop() { function addItem(ret) { var itemhtml = "
  • "; - itemhtml += ""; + itemhtml += ""; itemhtml += "
  • "; var invcontent = document.getElementById("tab3"); -- cgit v1.2.3-70-g09d2