Re: LiveMap Mods support

2
Hi,
full support for mods or plugins for every aspect of the map is far too much work for little use. LiF community is very small and has few modders - there aren't many people who would benefit from that. Sorry.
However, if you want to post more details about your implementation I can try to find a convenient solution for you or even implement it as official feature in a future update.

Cheers

Re: LiveMap Mods support

3
Ok)))
On click icon "Find Monument Place Mode" - all exist claims showed in maximum size and Uncompleted monument Red Circle MAX radius.

Differences:

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>&nbsp;</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>&nbsp;</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>&nbsp;</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} &COPY; Nyuton <a href="javascript:void(0);" onclick="Master.creditsDialog.dialog('open');">&starf; 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} &COPY; Nyuton <a href="javascript:void(0);" onclick="Master.creditsDialog.dialog('open');">&starf; 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
Picture find-ico.png in /img folder.
In locales for RU $text array add 'claimbuildmode' => 'Режим поиска места для монумента',

for EN 'claimbuildmode' => 'Find monument place mode',

Re: LiveMap Mods support

6
Livemap 2.6 released today has this new claim planner feature. See a working example here: https://livemap.insel-der-verbannten.de/ - the icon next to the grid icon.

I don't display unfinished monuments though. I think this information should not be exposed. People building up a new monument have no protection and for sure don't want us to draw a target on their backs :D However, I might put an option for it in the next update that can be toggled on/off by the admin.
cron