From 590af9b2fd3db54803b3ea2c6f526f4d4759036d Mon Sep 17 00:00:00 2001 From: MasterGordon Date: Wed, 11 Apr 2018 14:26:37 +0200 Subject: [PATCH] add php + some files --- index.html => game.html | 0 images/items/briquettes.png | Bin 0 -> 527 bytes images/tiles/filterleft10.png | Bin 0 -> 320 bytes images/tiles/filterright10.png | Bin 0 -> 325 bytes images/tiles/papermanufactory10.png | Bin 0 -> 1930 bytes images/tiles/weaver10.png | Bin 0 -> 628 bytes js/game.js | 2 +- js/items.json | 32 +++++ js/tiles.js | 213 +++++++++++++++++++++++++++- js/util.js | 16 ++- lang/en.json | 29 +++- php/login.php | 7 + php/mysqldata.php | 8 ++ 13 files changed, 294 insertions(+), 13 deletions(-) rename index.html => game.html (100%) create mode 100644 images/items/briquettes.png create mode 100644 images/tiles/filterleft10.png create mode 100644 images/tiles/filterright10.png create mode 100644 images/tiles/papermanufactory10.png create mode 100644 images/tiles/weaver10.png create mode 100644 php/login.php create mode 100644 php/mysqldata.php diff --git a/index.html b/game.html similarity index 100% rename from index.html rename to game.html diff --git a/images/items/briquettes.png b/images/items/briquettes.png new file mode 100644 index 0000000000000000000000000000000000000000..cdae365619bc87da6296fc1c134e9c7796668c81 GIT binary patch literal 527 zcmeAS@N?(olHy`uVBq!ia0vp^1|ZDA1|-9oezpTC#^NA%Cx&(BWL^R}Ea{HEjtmSN z`?>!lvI6;>1s;*b3=DjSL74G){)!Z!pk#?_L`iUdT1k0gQ7S`0VrE{6US4X6f{C7i zo{`~4h0LiyQ|mol978gk-(CsqYc}9vxgggmt<(O>_1lq^&kmoMDVvexv@-l>h0s=^ z+sr}oOQ&2(F%*tG<057}@u&|nv+(@;&&wIEzgOu#wMmCn;J`fI`MIW#T0`tB3|(0} zs;-}Yzb(BwfOm>NTf(;0+ih2HpPI|K=L_Qkt_xC0Yz1xX45b&OMHx0PBGZ#JYV-T5vY@mp>)Do2EQ%S z@9*SV@Zss=g*D$f&bc!c%zt&<`Um&nfPc~54)$L*-3#2bV$$pv>FFGTm6Ch1zcODj zXl`80pho9lqf|-mb_Hzil&HVk3 zli?Lp4!lvI6;>1s;*b3=DjSL74G){)!Z!pk#?_L`iUdT1k0gQ7S`0VrE{6US4X6f{C7i zo{`~4h0LiyMH@U_978gk-<~(*I&2`o;JE+X`Sa7KoJu(Iz>O>A;L(K2rH|f8Brh?1 zS5kMbaOV56ggZ~|{;Z#taL4g*{Il)a65(eL-`oFvAM;}_Ud#E3Y2~PgXv%A+3tJxHb9>;FnGH9xvX!lvI6;>1s;*b3=DjSL74G){)!Z!pk#?_L`iUdT1k0gQ7S`0VrE{6US4X6f{C7i zo{`~4h0LiyMO!^x978gk-<~(*YB6ANb@YG!@w?Z%C>;-p9HDM@G3PItA2-V$pLi_d z5H;YATmNp>x9>lj6!UiP0p4R*?{VKrm{Zs%%l^9d>QagHKgVO)`_4c9F4?pB*u?9f zZ-pnsJhUn^`Dfi+ICc5)`4Zt(MSnUsKEAQfckbD41=A(JfgWJ+boFyt=akR{0D#+v A)&Kwi literal 0 HcmV?d00001 diff --git a/images/tiles/papermanufactory10.png b/images/tiles/papermanufactory10.png new file mode 100644 index 0000000000000000000000000000000000000000..e9865e0434a4411d5f9d0efcc96049d11231348a GIT binary patch literal 1930 zcmV;52X**~P)N2bZe?^J zG%heMGBNQWX_Wu~2M0++K~!i%?bum!RYep9VE>Un#20^xZ@#K!6;LQ3AR;IzqKttg zKp=q-AO<2JXsIujip=voPqy`S)wm6gok(E zdb7+1X)(VZ1iC5B2ALx;(=tb3rsbssmM{Of?C4uv_6&Sg`g>QET|2(4^L<0>%jm%^ zbxw|s_t&v^+sZP$_uDFT26nEgYq8te|3&p-xNV*V>N1`SaiJif6J+ zA+Tb_;*O)egWr^+N4A!y4~~|*Hx8BSm-dxA*AJHax4th|FAUW&&zax2JX{{#JyPf8 z*-v$B<>rm#l1BM&;s4Q zcAz@Fb#Q2b9?F<0vAs2s(#Evj__x+7hSQkPxxsQMot{-EsGY- zdoh6}OBR&jp|zzvJz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W^{L9 za%BK;VQFr3E^cLXAT%y8E;2FkAZe8V00HDlL_t(&L+zF^O2t4BhEsY6J1^iBY%GFU z>Ej711QGO=YGGqxDR>F75-;HKR{qF@$>dM6NjBL8Q+&L)v$K=`O9&)!&Mg{RToSan zBxtcKpT~Rd>ulc}^xGMIp~WUx*zfIu`*}*eLBE_GDnpA53Enkq8$)GiQ8QL>Mjshk z1XBiQXqhIVNXCTi6*NW+MRDxi-87 zLVO3Y&=z*C3GYvdA$MQHLTlKWHrP`rEkGy%z=CVonK~wa0s;#zu>Lx{-+|BqU}$&{ zRY2$)9?U{u2&+JBR)N^80IViWCKC?xDDlontW7?Iur@4NF#P4jlY$zgi}_FwO| zt$l*@KU}2lh( zl_>rQT7V6)Yu48X-&x)QfDLQAP}@GR`%S$TFM+wE^A>-W3N0=Nm;3_!N5Ka+b8!Oz O0000= requieredCount) { + if (this.input.countOf(1) >= requieredCount || this.input.countOf(2) >= 1) { if (this.currentwork == this.maxwork) { - this.input.take(1, requieredCount, this.factory) - for (var i = 0; i < 4; i++) { - var item = new Item(2, this.x * 48, this.y * 48) + if (this.input.countOf(1) >= requieredCount) { + this.input.take(1, requieredCount, this.factory) + for (var i = 0; i < 4; i++) { + var item = new Item(2, this.x * 48, this.y * 48) + this.factory.items.push(item) + item.setDFromDirection(this.direction) + } + } else { + this.input.take(2, 1, this.factory) + var item = new Item(5, this.x * 48, this.y * 48) this.factory.items.push(item) item.setDFromDirection(this.direction) } @@ -93,6 +100,98 @@ class Saw extends Tile { } } +class Weaver extends Tile { + constructor(x, y, factory) { + super(x, y, factory) + this.maxwork = 48 * 3 + this.currentwork = 0 + this.name = "weaver" + this.i = 10 + this.cost = [{ + "id": 2, + "count": 200 + }, + { + "id": 3, + "count": 100 + }, + { + "id": 0, + "count": 25000 + } + ] + this.texture = { + "0": [], + "1": ["weaver10"] + } + this.loadImages() + } + + work() { + //Items für ein Pank + var requieredCount = 5 + if (this.input.countOf(2) >= requieredCount) { + if (this.currentwork == this.maxwork) { + this.currentwork = 0 + var item = new Item(9, this.x * 48, this.y * 48) + this.factory.items.push(item) + item.setDFromDirection(this.direction) + } else { + this.currentwork++ + } + } else { + this.currentwork = 0 + } + } +} + +class Papermanufactory extends Tile { + constructor(x, y, factory) { + super(x, y, factory) + this.maxwork = 48 * 10 + this.currentwork = 0 + this.name = "papermanufactory" + this.i = 11 + this.cost = [{ + "id": 2, + "count": 200 + }, + { + "id": 3, + "count": 500 + }, + { + "id": 0, + "count": 10000 + } + ] + this.texture = { + "0": [], + "1": ["papermanufactory10"] + } + this.loadImages() + } + + work() { + //Items für ein Pank + var requieredCount = 5 + if (this.input.countOf(9) >= 10 && this.input.countOf(5) >= 100) { + if (this.currentwork == this.maxwork) { + this.currentwork = 0 + for (var i = 0; i < 10; i++) { + var item = new Item(7, this.x * 48, this.y * 48) + this.factory.items.push(item) + item.setDFromDirection(this.direction) + } + } else { + this.currentwork++ + } + } else { + this.currentwork = 0 + } + } +} + class Charcoalmeiler extends Tile { constructor(x, y, factory) { super(x, y, factory) @@ -117,7 +216,7 @@ class Charcoalmeiler extends Tile { } getImage(fulltime, layer) { - fulltime = Math.round(fulltime/4) + fulltime = Math.round(fulltime / 4) if (this.images[layer].length == 0) return "0" return this.images[layer][(fulltime % this.images[layer].length)] @@ -261,6 +360,104 @@ class Spliter extends Tile { } } +class FilterRight extends Tile { + constructor(x, y, factory) { + super(x, y, factory) + this.name = "filterright" + this.hasNoInventory = true + this.i = 9 + this.filter = 0 + this.cost = [{ + "id": 0, + "count": 50000 + }, { + "id": 2, + "count": 200 + }] + this.options = [{ + "type": "item", + "var": "filter" + }] + this.texture = { + "0": ["conveyorbelt00", "conveyorbelt01", "conveyorbelt02", "conveyorbelt03", "conveyorbelt04", "conveyorbelt05", "conveyorbelt06"], + "1": ["filterright10"] + } + this.loadImages() + } + + work() { + while (this.input.items.length > 0) { + var item = this.input.items.pop() + var d = this.direction + if (item.id == this.filter) + switch (this.direction) { + case "right": + d = "down" + break; + case "down": + d = "left" + break; + case "left": + d = "up" + break; + case "up": + d = "right" + break; + } + item.setDFromDirection(d) + } + } +} + +class FilterLeft extends Tile { + constructor(x, y, factory) { + super(x, y, factory) + this.name = "filterleft" + this.hasNoInventory = true + this.i = 8 + this.filter = 0 + this.cost = [{ + "id": 0, + "count": 50000 + }, { + "id": 2, + "count": 200 + }] + this.options = [{ + "type": "item", + "var": "filter" + }] + this.texture = { + "0": ["conveyorbelt00", "conveyorbelt01", "conveyorbelt02", "conveyorbelt03", "conveyorbelt04", "conveyorbelt05", "conveyorbelt06"], + "1": ["filterleft10"] + } + this.loadImages() + } + + work() { + while (this.input.items.length > 0) { + var item = this.input.items.pop() + var d = this.direction + if (item.id == this.filter) + switch (this.direction) { + case "right": + d = "up" + break; + case "down": + d = "right" + break; + case "left": + d = "down" + break; + case "up": + d = "left" + break; + } + item.setDFromDirection(d) + } + } +} + class Warehouse extends Tile { constructor(x, y, factory) { super(x, y, factory) @@ -274,7 +471,7 @@ class Warehouse extends Tile { "count": 20000 }] this.pivot = 0 - this.toSell = 1 + this.toSell = 0 this.options = [{ "type": "item", "var": "toSell" @@ -311,3 +508,7 @@ tileClasses.push(Quarry) tileClasses.push(Collector) tileClasses.push(Spliter) tileClasses.push(Warehouse) +tileClasses.push(FilterLeft) +tileClasses.push(FilterRight) +tileClasses.push(Weaver) +tileClasses.push(Papermanufactory) diff --git a/js/util.js b/js/util.js index 21cb052..450c1d6 100644 --- a/js/util.js +++ b/js/util.js @@ -25,7 +25,7 @@ var directions = { } } -var d = ["right","down","left","up"] +var d = ["right", "down", "left", "up"] //Umrechnung von Grad zu Bogenmaß var TO_RADIANS = Math.PI / 180; @@ -46,6 +46,16 @@ function infoDrawRotatedImage(image, x, y, angle) { infoCtx.restore(); } -function formatCount(c){ - return c +function formatCount(c) { + for (var pow = 0; pow < lang.numbers.length; pow++) { + if (c / Math.pow(10, pow * 3) >= 1 && c / Math.pow(10, pow * 3) < 1000) { + return round(c / Math.pow(10, pow * 3), 3) + lang.numbers[pow] + } + } + return round(c / Math.pow(10, (lang.numbers.length - 1) * 3), 3) + lang.numbers[(lang.numbers.length - 1)] +} + +function round(n, p) { + var factor = Math.pow(10, p); + return Math.round(n * factor) / factor; } diff --git a/lang/en.json b/lang/en.json index c258279..f71e185 100644 --- a/lang/en.json +++ b/lang/en.json @@ -14,7 +14,7 @@ }, "saw": { "name": "Saw", - "description": "Cuts 5 Logs in to 4 Planks. Works only if it contains 5 Log. It works fast!" + "description": "Cuts 5 Logs in to 4 Planks. Works only if it contains 5 Log. Can also cut Planks into Sawdust. It works fast!" }, "spliter": { "name": "Spliter", @@ -39,14 +39,37 @@ "charcoalmeiler": { "name": "Charcoal Meiler", "description": "Requieres 10 Planks to burn them down to 5 Charcoal." + }, + "papermanufactory": { + "name": "Paper Manufactory", + "description": "Uses 10 Sive and 100 Sawdust to create 10 Rawpaper" + }, + "weaver": { + "name": "Weaver", + "description": "Makes a Siev out of 5 Planks." + }, + "filterleft": { + "name": "Item Filter (left)", + "description": "Puts a selected Item to the left and all other straight.", + "options": { + "filter": "Filtered Item" + } + }, + "filterright": { + "name": "Item Filter (right)", + "description": "Puts a selected Item to the right and all other straight.", + "options": { + "filter": "Filtered Item" + } } }, - "items": ["None", "Log", "Planks", "Stone","Charcoal"], + "items": ["None", "Log", "Planks", "Stone", "Charcoal", "Sawdust", "Charcoal Dust", "Raw Paper", "Paper", "Siev", "Filter", "Koks", "Briquettes"], "more": "Show Inventory / Sell Items", "inventory": "Inventory", "player": "Player", "infotooltips": ["Build", "Move", "Rotate", "Delete!", "", "Upgrade", "Information", "", "Go To Space!!"], "cost": "Cost", "clickToSell": "Click on items to sell them.", - "money": "Dollars" + "money": "Dollars", + "numbers": ["", " Thousand", " Million", " Billion", " Trillion", " Quadrillion", " Quintillion", " Sextillion", " Septillion", " Octillion", " Nonillion", " Decillion", " Undecillion", " Duodecillion", " Tredecillion", " Quattuordecillion", " Quindecillion", " Sexdecillion", " Septendecillion", " Octodecillion", " Novemdecillion", " Vigintillion"] } diff --git a/php/login.php b/php/login.php new file mode 100644 index 0000000..5e343c2 --- /dev/null +++ b/php/login.php @@ -0,0 +1,7 @@ + + + diff --git a/php/mysqldata.php b/php/mysqldata.php new file mode 100644 index 0000000..cac7b96 --- /dev/null +++ b/php/mysqldata.php @@ -0,0 +1,8 @@ +