After every version, i'm add my function for it...
Show uncompleted guilds monuments on map, with maximum radius of all monuments for find free place.

Code: Select all
*** H:\lifyo.livemap.2.5.0\main.php 2018-04-21 06:31:29.645167300 +0300
--- main.php 2018-05-14 14:07:27.895057700 +0300
***************
*** 469,479 ****
$gm_chars = $server->get_gm_characters();
$buildings = $mygroup->privileges['struct_count'] ? $server->get_structures() : array();
// Loop through all guild claims
foreach( $claims AS $i => &$claim ) {
// Get pixel position of guild claim CENTER
! $d = intval($claim['Radius']);
$r = intval(ceil($d/2));
$coords = Livemap::terpos2pixelpos( $claim['TerID'], $claim['x'], $claim['y'] );
$cenX = $coords[0];
--- 469,553 ----
$gm_chars = $server->get_gm_characters();
$buildings = $mygroup->privileges['struct_count'] ? $server->get_structures() : array();
+ //////// STL
+ if (!isset($_COOKIE["ClaimBuildMode"]))
+ setcookie("ClaimBuildMode", 0);
+
+ if($_COOKIE["ClaimBuildMode"]==1){
+
+ echo "<br><br><br><br>";
+
+ $mons = $server->get_monuments();
+ $monsid = 100000;
+ foreach( $mons AS $i => &$claim ){
+ // Get pixel position of guild claim CENTER
+ $monsid = $monsid + 1;
+ $claim['GuildID'] = $monsid;
+
+ $d = intval("152");
+ $r = intval(ceil($d/2));
+ $coords = Livemap::terpos2pixelpos( $claim['TerID'], $claim['x'], $claim['y'] );
+ $cenX = $coords[0];
+ $cenY = $coords[1];
+ $domX = $cenX - $r;
+ $domY = $cenY - $r;
+
+ // Escape HTML characters
+ $claim['name'] = htmlspecialchars( "Unknow" );
+
+ // Center the label or place on top?
+ $center = center_guild_label($claim['name'], $d);
+
+ // Assign positions and dimensions for claim
+ $claim['d'] = $d;
+ $claim['r'] = $d/2;
+ $claim['centerx'] = $cenX;
+ $claim['centery'] = $cenY;
+ $claim['cx'] = $domX;
+ $claim['cy'] = $domY;
+ $claim['class'] = $center ? 'guild-name-center' : 'guild-name-top';
+ $claim['lsize'] = $center ? $d - 8 : 250;
+ $claim['lx'] = $center ? $domX + 4 : $cenX - ($claim['lsize']/2);
+ $claim['ly'] = $center ? $domY : $domY - 22;
+ $claim['height'] = $center ? "height: {$d}px;" : "";
+
+ // Process founding time
+ $ftime = strtotime($claim['ctime']);
+ switch( $lang ) {
+ case 'de': $claim['founded'] = date('d.m.Y, H:i', $ftime) . ""; break;
+ case 'ru': $claim['founded'] = date('d.m.Y, H:i', $ftime) . " Uhr"; break;
+ case 'en':
+ case 'cc': $claim['founded'] = date('Y-m-d, H:i', $ftime); break;
+ }
+
+ }
+ // Push to JS claims array
+ $claimsUC_js[] = array(
+ 'id' => intval($claim['GuildID']),
+ 'name' => $claim['name'],
+ 'radius' => $r,
+ 'center_x' => $cenX,
+ 'center_y' => $cenY
+ );
+ } else {
+ unset($mons);
+ }
+ //////// END STL
+
+
+
// Loop through all guild claims
foreach( $claims AS $i => &$claim ) {
// Get pixel position of guild claim CENTER
!
! // STL ClaimBuildMode
! if($_COOKIE["ClaimBuildMode"]==1){
! $d = 152;
! } else {
! $d = intval($claim['Radius']);
! }
! //$d = intval($claim['Radius']);
$r = intval(ceil($d/2));
$coords = Livemap::terpos2pixelpos( $claim['TerID'], $claim['x'], $claim['y'] );
$cenX = $coords[0];
***************
*** 599,605 ****
$content->assign( 'aclaims', $aclaims );
$content->assign( 'json_claims', json_encode($claims_js) );
$content->assign( 'json_standings', json_encode($standings) );
!
// Use configured background color on livemap page
$bgcolor = $config['color_bg'];
--- 673,686 ----
$content->assign( 'aclaims', $aclaims );
$content->assign( 'json_claims', json_encode($claims_js) );
$content->assign( 'json_standings', json_encode($standings) );
! //STL Assign
! if($_COOKIE["ClaimBuildMode"]==1){
! $content->assign( 'claimsUC', $mons );
! $content->assign( 'json_claimsUC', json_encode($claimsUC_js) );
! }
! //STL END Assign
!
!
// Use configured background color on livemap page
$bgcolor = $config['color_bg'];
***************
*** 629,634 ****
--- 710,726 ----
$html->assign( 'STEAM_AUTH', isSet($_SESSION['SteamAuth']) );
$html->assign( 'PRIV_conf', $mygroup->admin );
$html->assign( 'SHOW_CONTROLS', ($site === 'main') );
+
+ // STL Assign
+ if($_COOKIE["ClaimBuildMode"]==1){
+ $html->assign("ClaimBuildMode",TRUE);
+ } else {
+ $html->assign("ClaimBuildMode",FALSE);
+ }
+
+
+ // STL END ASSIGN
+
// Assign fonts
Livemap::load_font( $config['font_claimlabel'] );
Code: Select all
*** H:\lifyo.livemap.2.5.0\css\style.css 2018-04-20 01:18:39.484975500 +0300
--- style.css 2018-05-14 00:47:34.362397700 +0300
***************
*** 420,425 ****
--- 420,442 ----
}
+
+ /*STL ClaimBuildMode */
+ #claimbuildmode {
+ z-index: 91;
+ position: fixed;
+ Left: 12px;
+ top: 64px;
+ padding: 4px 8px;
+ background-color: #333;
+ background-color: rgba(0,0,0,0.5);
+ color: Red;
+ font-size: 0.975em;
+ font-family: Calibri, Verdana, monospace;
+ }
+
+
+
/* Legacy Dialogues */
.dialogue-wrapper {
Code: Select all
*** H:\lifyo.livemap.2.5.0\html\main.html 2018-04-22 23:04:57.710187900 +0300
--- main.html 2018-05-14 00:45:47.044749600 +0300
***************
*** 93,98 ****
--- 93,102 ----
{IF:MOD_INSTALLED}
{IF:PRIV_player_layer}<a href="javascript:void(0);" onclick="Livemap.togglePlayers();"><img id="ctrlbtn-players" class="control-button control-button-inactive" src="img/ni-players.png" title="{text_tplrs}"></a>{ENDIF:PRIV_player_layer}
{ENDIF:MOD_INSTALLED}
+ <!-- STL START ICONS ON TOP -->
+ {IF:HAS_LAYERS}<p> </p>{ENDIF:HAS_LAYERS}
+ <a href="javascript:void(0);" onclick="Livemap.toggleClaimBuildMode();"><img class="control-button" src="img/find-icon.png" title="{text_claimbuildmode}"></a>
+ <!-- STL END ICONS ON TOP -->
{IF:HAS_LAYERS}<p> </p>{ENDIF:HAS_LAYERS}
{IF:ENABLE_ALTMAP}<a href="javascript:void(0);" onclick="Livemap.toggleImage();"><img class="control-button" src="img/altmap-icon.png" title="{text_tmaps}"></a>{ENDIF:ENABLE_ALTMAP}
<a href="javascript:void(0);" onclick="Livemap.toggleGrid();"><img class="control-button" src="img/grid-icon.png" title="{text_tgrid}"></a><p> </p>
Code: Select all
*** H:\lifyo.livemap.2.5.0\html\map.html 2018-04-22 23:05:38.431867300 +0300
--- map.html 2018-05-14 00:46:41.315377900 +0300
***************
*** 8,14 ****
{LOOP:pclaims}<div class="personal-claim" id="personal_{ID}" style="width: {width}px; height: {height}px; left: {x}px; top: {y}px;"></div>{ENDLOOP:pclaims}
{LOOP:aclaims}<div class="admin-land" id="adminland_{ID}" style="width: {width}px; height: {height}px; left: {x}px; top: {y}px;"></div>{ENDLOOP:aclaims}
!
<div id="credits">
LiF:YO Livemap {VERSION} © Nyuton <a href="javascript:void(0);" onclick="Master.creditsDialog.dialog('open');">★ info</a>
</div>
--- 8,23 ----
{LOOP:pclaims}<div class="personal-claim" id="personal_{ID}" style="width: {width}px; height: {height}px; left: {x}px; top: {y}px;"></div>{ENDLOOP:pclaims}
{LOOP:aclaims}<div class="admin-land" id="adminland_{ID}" style="width: {width}px; height: {height}px; left: {x}px; top: {y}px;"></div>{ENDLOOP:aclaims}
! <!-- STL ClaimUC -->
! {IF:ClaimBuildMode}
! {LOOP:claimsUC}
! <a class="guild-claim guild-claim-tier{GuildTier}" id="guild_{GuildID}" style="border-radius: {d}px; width: {d}px; height: {d}px; left: {cx}px; top: {cy}px; border:2px solid #FF0000" onmouseover="Livemap.highlightClaim({GuildID});" onmouseleave="Livemap.unhighlightClaims();"></a>
! <div class="{class} guild-name-tier{GuildTier}" style="width: {lsize}px; left: {lx}px; top: {ly}px; {height}"><p>{name}</p></div>
! {ENDLOOP:claimsUC}
! <div id="claimbuildmode">{text_claimbuildmode}</div>
! {ENDIF:ClaimBuildMode}
! <!-- STL END ClaimUC -->
!
<div id="credits">
LiF:YO Livemap {VERSION} © Nyuton <a href="javascript:void(0);" onclick="Master.creditsDialog.dialog('open');">★ info</a>
</div>
Code: Select all
*** H:\lifyo.livemap.2.5.0\includes\gameserver.class.php 2018-04-20 01:07:54.006615900 +0300
--- gameserver.class.php 2018-05-14 14:09:09.498536200 +0300
***************
*** 68,73 ****
--- 68,146 ----
}
+
+ //////////////////////////////////////////// STL
+
+
+ public function get_monuments() {
+
+ if( ! $this->db ) $this->db_connect();
+
+ $monuments = $this->db->query( "SELECT mon.*, ( mon.GeoDataID >> 18 ) AS TerID, ( mon.GeoDataID & ((1 << 9) - 1) ) AS `x`, ( (mon.GeoDataID >> 9) & ((1 << (9)) - 1) ) AS `y`, mon.DroppedTime AS ctime
+ FROM unmovable_objects AS mon WHERE (ObjectTypeID=152 AND IsComplete=0)" );
+
+
+
+ return $monuments;
+
+ }
+
+
+
+ /////////////////////////////////////////// END STL
+
+
+
+
+
// Get all guild claims from database
public function get_claims() {
Code: Select all
*** H:\lifyo.livemap.2.5.0\js\livemap.js 2018-04-23 20:55:03.091139000 +0300
--- livemap.js 2018-05-14 00:42:16.978992900 +0300
***************
*** 278,284 ****
for( var i = 0; i < data.length; i++ ) ctx.fillRect( data[i][0] * this.zoomScale, data[i][1] * this.zoomScale, Math.round(1*this.zoomScale), Math.round(1*this.zoomScale) );
};
!
this.toggleGrid = function() {
// Adjust canvas size
--- 278,290 ----
for( var i = 0; i < data.length; i++ ) ctx.fillRect( data[i][0] * this.zoomScale, data[i][1] * this.zoomScale, Math.round(1*this.zoomScale), Math.round(1*this.zoomScale) );
};
! // Toggle Claim Build Mode (STL)
! this.toggleClaimBuildMode = function (){
! if( getCookie('ClaimBuildMode') === '0' ) setCookie('ClaimBuildMode', '1', 30);
! else setCookie('ClaimBuildMode', '0', 30);
! location.reload();
! };
! // End STL
this.toggleGrid = function() {
// Adjust canvas size