forked from iopietro/Travianz-Legacy
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
and resource panel - just display static values
- Loading branch information
Showing
32 changed files
with
596 additions
and
316 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
<?php | ||
|
||
namespace App\FrontModule\Model\User; | ||
|
||
use App; | ||
use Nette; | ||
|
||
class UserService | ||
{ | ||
/** | ||
* @var UserModel | ||
*/ | ||
private $userModel; | ||
|
||
|
||
public function __construct( | ||
UserModel $userModel | ||
) { | ||
$this->userModel = $userModel; | ||
} | ||
|
||
|
||
public function hasPlus($uid) | ||
{ | ||
/** @var \stdClass $user */ | ||
$user = $this->userModel->get($uid); | ||
if ($user->plus > time()) { | ||
return TRUE; | ||
} else { | ||
return FALSE; | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,76 @@ | ||
<div id="header"> | ||
<div id="mtop"> | ||
<a href="{plink ':Game:OuterVillage:default'}" id="n1" accesskey="1"><img src="{$baseUrl}/img/x.gif" title="Village overview" alt="Village overview" /></a> | ||
<a href="{plink ':Game:InnerVillage:default'}" id="n2" accesskey="2"><img src="{$baseUrl}/img/x.gif" title="Village centre" alt="Village centre" /></a> | ||
<a href="{plink ':Game:Map:default'}" id="n3" accesskey="3"><img src="{$baseUrl}/img/x.gif" title="Map" alt="Map" /></a> | ||
<a href="{plink ':Game:Statistics:default'}" id="n4" accesskey="4"><img src="{$baseUrl}/img/x.gif" title="Statistics" alt="Statistics" /></a> | ||
<div id="n5" n:class=" | ||
$unread && ! $report ? i2, | ||
! $unread && $report ? i3, | ||
$unread && $report ? i1, | ||
! $unread && ! $report ? i4 | ||
"> | ||
<a href="{plink ':Game:Reports:default'}" accesskey="5"><img src="{$baseUrl}/img/x.gif" class="l" title="Reports" alt="Reports"/></a> | ||
<a href="{plink ':Game:Messages:default'}" accesskey="6"><img src="{$baseUrl}/img/x.gif" class="r" title="Messages" alt="Messages" /></a> | ||
</div> | ||
|
||
<a href="{plink ':Game:Plus:default'}" id="plus"> | ||
<span class="plus_text"> | ||
<span class="plus_g">P</span> | ||
<span class="plus_o">l</span> | ||
<span class="plus_g">u</span> | ||
<span class="plus_o">s</span> | ||
</span> | ||
<img src="{$baseUrl}/img/x.gif" id="btn_plus" n:class="$plusActive ? active, ! $plusActive ? inactive" | ||
title="Plus menu" alt="Plus menu" /> | ||
</a> | ||
|
||
<style> | ||
.day_image { | ||
background-image: url("../gpack/travian_default/img/l/day.gif"); | ||
width: 18px; | ||
height:18px; | ||
} | ||
.night_image { | ||
background-image: url("../gpack/travian_default/img/l/night.gif"); | ||
width: 18px; | ||
height:18px; | ||
} | ||
#container { | ||
width: 30px; | ||
height: 60px; | ||
position: relative; | ||
} | ||
#wrapper > #container { | ||
display: table; | ||
position: static; | ||
} | ||
#container div { | ||
position: absolute; | ||
top: 50%; | ||
} | ||
#container div div { | ||
position: relative; | ||
top: -50%; | ||
} | ||
#container > div { | ||
display: table-cell; | ||
vertical-align: middle; | ||
position: static; | ||
} | ||
</style> | ||
{var hour = date('Hi')} | ||
<div id="wrapper"> | ||
<div id="container"> | ||
<div> | ||
<div> | ||
<p> | ||
<img src="{$baseUrl}/img/x.gif" style="display: block; margin: 0 auto; vertical-align:middle;" n:class="$hour > 1750 || $hour < 500 ? night_image : day_image" /> | ||
</p> | ||
</div> | ||
</div> | ||
</div> | ||
</div> | ||
<div class="clear"></div> | ||
</div> | ||
</div> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
<?php | ||
|
||
namespace App\GameModule\Controls\Header; | ||
|
||
use Nette; | ||
use App; | ||
|
||
class HeaderControl extends Nette\Application\UI\Control | ||
{ | ||
/** | ||
* @var App\GameModule\Model\MData\MDataModel | ||
*/ | ||
private $MDataModel; | ||
/** | ||
* @var App\GameModule\Model\NData\NDataModel | ||
*/ | ||
private $NDataModel; | ||
/** | ||
* @var App\FrontModule\Model\User\UserService | ||
*/ | ||
private $userService; | ||
|
||
|
||
public function __construct( | ||
App\GameModule\Model\MData\MDataModel $MDataModel, | ||
App\GameModule\Model\NData\NDataModel $NDataModel, | ||
App\FrontModule\Model\User\UserService $userService | ||
) { | ||
$this->MDataModel = $MDataModel; | ||
$this->NDataModel = $NDataModel; | ||
$this->userService = $userService; | ||
} | ||
|
||
|
||
public function render() | ||
{ | ||
$this->template->unread = $this->MDataModel->countUnread($this->presenter->getUser()->getId()) ? TRUE : FALSE; | ||
$this->template->report = $this->NDataModel->countUnread($this->presenter->getUser()->getId()) ? TRUE : FALSE; | ||
$this->template->plusActive = $this->userService->hasPlus($this->presenter->getUser()->getId()); | ||
$this->template->setFile(__DIR__ . '/HeaderControl.latte'); | ||
$this->template->render(); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
<?php | ||
|
||
namespace App\GameModule\Controls\Header; | ||
|
||
|
||
interface IHeaderControl | ||
{ | ||
/** @return HeaderControl */ | ||
function create(); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
<?php | ||
|
||
namespace App\GameModule\Controls\Header; | ||
|
||
|
||
trait THeaderControl | ||
{ | ||
/** @var IHeaderControl @inject */ | ||
public $headerFactory; | ||
|
||
|
||
protected function createComponentHeader() | ||
{ | ||
return $this->headerFactory->create(); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
<?php | ||
|
||
namespace App\GameModule\Controls\Resource; | ||
|
||
use Nette; | ||
use App; | ||
|
||
interface IResourceControl | ||
{ | ||
/** @return ResourceControl */ | ||
public function create(); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
<div id="res"> | ||
<div id="resWrap"> | ||
<table cellpadding="1" cellspacing="1"> | ||
<tr> | ||
<td> | ||
<img src="{$baseUrl}/img/x.gif" class="r1" alt="Lumber" title="Lumber" /> | ||
</td> | ||
<td id="l4" title="Wood"> | ||
{$actualWood} / {$store} | ||
</td> | ||
<td> | ||
<img src="{$baseUrl}/img/x.gif" class="r2" alt="Clay" title="Clay" /> | ||
</td> | ||
<td id="l3" title="Clay"> | ||
{$actualClay} / {$store} | ||
</td> | ||
<td> | ||
<img src="{$baseUrl}/img/x.gif" class="r3" alt="Iron" title="Iron" /> | ||
</td> | ||
<td id="l2" title="Iron"> | ||
{$actualIron} / {$store} | ||
</td> | ||
<td> | ||
<img src="{$baseUrl}/img/x.gif" class="r4" alt="Crop" title="Crop" /> | ||
</td> | ||
|
||
|
||
<td id="l1" title="Crop" n:if="$actualCrop > 0"> | ||
{$actualCrop} / {$granary} | ||
</td> | ||
<td> | ||
<img src="{$baseUrl}/img/x.gif" class="r5" alt="Crop consumption" title="Crop consumption" /></td> | ||
<td> | ||
{$upkeep} / {$cropProduction} | ||
</td> | ||
</tr> | ||
</table> | ||
<table cellpadding="1" cellspacing="1"> | ||
<tr> | ||
<td> </td> | ||
<td> </td> | ||
<td> </td> | ||
<td> </td> | ||
<td></td> | ||
<td> | ||
<font color="#B3B3B3" n:tag-if="$gold < 2"> | ||
<img src="{$baseUrl}/gpack/travian_default/img/a/gold.gif" alt="Remaining gold" title="You currently have: {$gold} gold"/> {$gold} <span><span>G</span><span>o</span><span>l</span><span>d</span></span> | ||
</font> | ||
</td> | ||
</tr> | ||
</table> | ||
</div> | ||
</div> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
<?php | ||
|
||
namespace App\GameModule\Controls\Resource; | ||
|
||
use Nette; | ||
use App; | ||
|
||
class ResourceControl extends Nette\Application\UI\Control | ||
{ | ||
public function render() | ||
{ | ||
$this->template->actualWood = 750; | ||
$this->template->actualClay = 750; | ||
$this->template->actualIron = 750; | ||
$this->template->actualCrop = 750; | ||
$this->template->store = 800; | ||
$this->template->granary = 800; | ||
$this->template->upkeep = 2; | ||
$this->template->cropProduction = 15; | ||
$this->template->gold = 40; | ||
|
||
|
||
$this->template->setFile(__DIR__ . '/ResourceControl.latte'); | ||
$this->template->render(); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
<?php | ||
|
||
namespace App\GameModule\Controls\Resource; | ||
|
||
use Nette; | ||
use App; | ||
|
||
trait TResourceControl | ||
{ | ||
/** @var IResourceControl @inject */ | ||
public $resourceFactory; | ||
|
||
|
||
protected function createComponentResource() | ||
{ | ||
return $this->resourceFactory->create(); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
<?php | ||
|
||
namespace App\GameModule\Model\MData; | ||
|
||
use App; | ||
|
||
class MDataModel extends App\Model\BaseModel | ||
{ | ||
protected $table = 'mdata'; | ||
|
||
|
||
/** | ||
* @param int $uid | ||
* @return array | ||
*/ | ||
public function getUnread($uid) | ||
{ | ||
return $this->database->select('*')->from($this->table) | ||
->where('viewed != 1') | ||
->where('send = 1') | ||
->where('target = %i', $uid) | ||
->fetchAll(); | ||
} | ||
|
||
/** | ||
* @param int $uid | ||
* @return array | ||
*/ | ||
public function countUnread($uid) | ||
{ | ||
return $this->database->select('count(id)')->from($this->table) | ||
->where('viewed != 1') | ||
->where('send = 1') | ||
->where('target = %i', $uid) | ||
->fetchSingle(); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
<?php | ||
|
||
namespace App\GameModule\Model\NData; | ||
|
||
use App; | ||
|
||
class NDataModel extends App\Model\BaseModel | ||
{ | ||
protected $table = 'ndata'; | ||
|
||
|
||
/** | ||
* @param int $uid | ||
* @return array | ||
*/ | ||
public function getUnread($uid) | ||
{ | ||
return $this->database->select('*')->from($this->table) | ||
->where('viewed != 1') | ||
->where('uid = %i', $uid) | ||
->fetchAll(); | ||
} | ||
|
||
/** | ||
* @param int $uid | ||
* @return array | ||
*/ | ||
public function countUnread($uid) | ||
{ | ||
return $this->database->select('count(id)')->from($this->table) | ||
->where('viewed != 1') | ||
->where('uid = %i', $uid) | ||
->fetchSingle(); | ||
} | ||
} |
Oops, something went wrong.