add php + some files

This commit is contained in:
MasterGordon 2018-04-11 14:26:37 +02:00
parent 61b4a7ff6d
commit 590af9b2fd
13 changed files with 294 additions and 13 deletions

BIN
images/items/briquettes.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 527 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 320 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 325 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.9 KiB

BIN
images/tiles/weaver10.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 628 B

View File

@ -289,7 +289,7 @@ function render() {
} else { } else {
drawInventory(inventory, lang["player"]) drawInventory(inventory, lang["player"])
} }
$('#money').text(money + " " + lang.money) $('#money').text(formatCount(money) + " " + lang.money)
if (mode == "showmore") { if (mode == "showmore") {
drawBigInventory(inventory) drawBigInventory(inventory)
} }

View File

@ -19,5 +19,37 @@
"id": 4, "id": 4,
"name": "charcoal", "name": "charcoal",
"value": 14 "value": 14
},{
"id": 5,
"name": "sawdust",
"value": 1
},{
"id": 6,
"name": "charcoaldust",
"value": 3
},{
"id": 7,
"name": "rawpaper",
"value": 30
},{
"id": 8,
"name": "paper",
"value": 200
},{
"id": 9,
"name": "siev",
"value": 33
},{
"id": 10,
"name": "paperfilter",
"value": 100
},{
"id": 11,
"name": "koks",
"value": 14
},{
"id": 12,
"name": "briquettes",
"value": 14
}] }]
} }

View File

@ -75,14 +75,21 @@ class Saw extends Tile {
work() { work() {
//Items für ein Pank //Items für ein Pank
var requieredCount = 5 var requieredCount = 5
if (this.input.countOf(1) >= requieredCount) { if (this.input.countOf(1) >= requieredCount || this.input.countOf(2) >= 1) {
if (this.currentwork == this.maxwork) { if (this.currentwork == this.maxwork) {
if (this.input.countOf(1) >= requieredCount) {
this.input.take(1, requieredCount, this.factory) this.input.take(1, requieredCount, this.factory)
for (var i = 0; i < 4; i++) { for (var i = 0; i < 4; i++) {
var item = new Item(2, this.x * 48, this.y * 48) var item = new Item(2, this.x * 48, this.y * 48)
this.factory.items.push(item) this.factory.items.push(item)
item.setDFromDirection(this.direction) 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)
}
this.currentwork = 0 this.currentwork = 0
} else { } else {
this.currentwork++ this.currentwork++
@ -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 { class Charcoalmeiler extends Tile {
constructor(x, y, factory) { constructor(x, y, factory) {
super(x, y, factory) super(x, y, factory)
@ -117,7 +216,7 @@ class Charcoalmeiler extends Tile {
} }
getImage(fulltime, layer) { getImage(fulltime, layer) {
fulltime = Math.round(fulltime/4) fulltime = Math.round(fulltime / 4)
if (this.images[layer].length == 0) if (this.images[layer].length == 0)
return "0" return "0"
return this.images[layer][(fulltime % this.images[layer].length)] 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 { class Warehouse extends Tile {
constructor(x, y, factory) { constructor(x, y, factory) {
super(x, y, factory) super(x, y, factory)
@ -274,7 +471,7 @@ class Warehouse extends Tile {
"count": 20000 "count": 20000
}] }]
this.pivot = 0 this.pivot = 0
this.toSell = 1 this.toSell = 0
this.options = [{ this.options = [{
"type": "item", "type": "item",
"var": "toSell" "var": "toSell"
@ -311,3 +508,7 @@ tileClasses.push(Quarry)
tileClasses.push(Collector) tileClasses.push(Collector)
tileClasses.push(Spliter) tileClasses.push(Spliter)
tileClasses.push(Warehouse) tileClasses.push(Warehouse)
tileClasses.push(FilterLeft)
tileClasses.push(FilterRight)
tileClasses.push(Weaver)
tileClasses.push(Papermanufactory)

View File

@ -25,7 +25,7 @@ var directions = {
} }
} }
var d = ["right","down","left","up"] var d = ["right", "down", "left", "up"]
//Umrechnung von Grad zu Bogenmaß //Umrechnung von Grad zu Bogenmaß
var TO_RADIANS = Math.PI / 180; var TO_RADIANS = Math.PI / 180;
@ -46,6 +46,16 @@ function infoDrawRotatedImage(image, x, y, angle) {
infoCtx.restore(); infoCtx.restore();
} }
function formatCount(c){ function formatCount(c) {
return 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;
} }

View File

@ -14,7 +14,7 @@
}, },
"saw": { "saw": {
"name": "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": { "spliter": {
"name": "Spliter", "name": "Spliter",
@ -39,14 +39,37 @@
"charcoalmeiler": { "charcoalmeiler": {
"name": "Charcoal Meiler", "name": "Charcoal Meiler",
"description": "Requieres 10 Planks to burn them down to 5 Charcoal." "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"
} }
}, },
"items": ["None", "Log", "Planks", "Stone","Charcoal"], "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", "Sawdust", "Charcoal Dust", "Raw Paper", "Paper", "Siev", "Filter", "Koks", "Briquettes"],
"more": "Show Inventory / Sell Items", "more": "Show Inventory / Sell Items",
"inventory": "Inventory", "inventory": "Inventory",
"player": "Player", "player": "Player",
"infotooltips": ["Build", "Move", "Rotate", "Delete!", "", "Upgrade", "Information", "", "Go To Space!!"], "infotooltips": ["Build", "Move", "Rotate", "Delete!", "", "Upgrade", "Information", "", "Go To Space!!"],
"cost": "Cost", "cost": "Cost",
"clickToSell": "Click on items to sell them.", "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"]
} }

7
php/login.php Normal file
View File

@ -0,0 +1,7 @@
<?php
include "mysqldata.php"
?>
<?php
?>

8
php/mysqldata.php Normal file
View File

@ -0,0 +1,8 @@
<?php
//MYSQL
$GLOBALS["servername"] = "localhost";
$GLOBALS["username"] = "root";
$GLOBALS["password"] = "";
$GLOBALS["database"] = "factorymaster"
?>