playermap proto

This commit is contained in:
Ulf Gebhardt 2014-12-14 06:03:53 +01:00
parent 58b2485cd6
commit 92bb23e4f9
11 changed files with 79 additions and 181 deletions

View File

@ -1,19 +1,22 @@
<?php
class api_mojotrollz extends \SYSTEM\API\api_system {
public static function call_stats(){
public static function call_stats(){
$result = \DBD\ONLINE_STATS::QA(array('3600'));
return \SYSTEM\LOG\JsonResult::toString($result);}
public static function call_charcreation($json=NULL){
public static function call_charcreation($json=NULL){
return charcreation::data($json);}
public static function call_quest($entry){
public static function call_quest($entry){
if(!\SYSTEM\SECURITY\Security::isLoggedIn()){
throw new ERROR("You need to be logged in to view this ressource.");}
$quest = quest::test($entry);
return $quest;}
public static function call_creature($entry){
public static function call_creature($entry){
if(!\SYSTEM\SECURITY\Security::isLoggedIn()){
throw new ERROR("You need to be logged in to view this ressource.");}
$creature = creature::data($entry);
return $creature;}
public static function call_map($filter = null){
return map::positions($filter);
}
}

View File

@ -1,2 +1,3 @@
<?php
\SYSTEM\autoload::registerFolder(dirname(__FILE__),'');
\SYSTEM\autoload::registerFolder(dirname(__FILE__),'');
\SYSTEM\autoload::registerFolder(dirname(__FILE__).'/qq','DBD');

View File

@ -1,4 +1,4 @@
.map {
#map {
margin-left: 0px;
margin-top: 0px;
margin-right: 0px;
@ -9,7 +9,14 @@
height: 450px;
width: 600px;
}
.map_world {
.map_element{
position: relative;
width: 7px;
height: 7px;
background-image: url(http://www.mojotrollz.eu/web/mojotrollz/api.php?call=files&cat=map&id=position.gif);
background-repeat: no-repeat;
}
#map_world {
height: 450px;
width: 600px;
background-image: url(http://www.mojotrollz.eu/web/mojotrollz/api.php?call=files&cat=map&id=azeroth.jpg);
@ -17,7 +24,7 @@
background-repeat: no-repeat;
z-index: 10;
}
.map_pointsWorld {
#map_pointsWorld {
position: absolute;
height: 732px;
width: 966px;
@ -25,12 +32,10 @@
margin-left: -483px;
z-index: 100;
}
.map_tip {
#map_tooltip {
border: 0px solid #aaaaaa;
left: -1000px;
padding: 0px;
position: absolute;
top: -1000px;
position: relative;
z-index: 150;
}
.tip_header {

View File

@ -1,4 +1,3 @@
var current_map = 0;
//var show_time=<?php echo $show_time ?>;
//var show_status=<?php echo $show_status ?>;
//var maps_count = <?php echo count($lang_defs['maps_names']); ?>;
@ -165,34 +164,24 @@ function getMultiText(multitext, onClick)
return data;
}
function tip(object, type, onClick)
function tip(object, type, onClick,x,y)
{
var t, data;
var tipxy;
t=document.getElementById("tip");
if(window.opera)
{
pointx = window.event.clientX;
pointy = window.event.clientY;
}
else if(navigator.appName != "Netscape")
{
pointx = window.event.clientX + document.documentElement.scrollLeft + document.body.scrollLeft;
pointy = window.event.clientY + document.documentElement.scrollTop + document.body.scrollTop;
}
t=document.getElementById("map_tooltip");
switch(type)
{
case 2:
tipxy = new _coord();
tipxy.x = pointx+15;
tipxy.y = pointy-60;
tipxy.x = x+15;
tipxy.y = y-60;
t.innerHTML='<table width="120" border="0" cellspacing="0" cellpadding="0" class=\'tip_worldinfo\'\>'+object+'</table\>';
break;
case 1:
if(onClick || t.innerHTML == '')
{
data = getMultiText(object.multi_text, onClick);
//t.innerHTML='<table border=\'0\' cellspacing=\'0\' cellpadding=\'0\'\><tr class=\'tip_header\'\><td colspan=\'7\'\>'+object.zone+'</td\></tr\><tr class=\'tip_head_text\'\><td align=\'center\'\>#</td\><td\>&nbsp;<?php echo $lang_defs['name'];?></td\><td width=\'25\' align=\'center\'\><?php echo $lang_defs['level'];?></td\><td colspan=\'2\'\><?php echo $lang_defs['race'];?></td\><td colspan=\'2\'\>&nbsp;<?php echo $lang_defs['class'];?></td\></tr\>'+data+'<\/table\>';
t.innerHTML='<table border=\'0\' cellspacing=\'0\' cellpadding=\'0\'\><tr class=\'tip_header\'\><td colspan=\'7\'\>'+object.zone+'</td\></tr\><tr class=\'tip_head_text\'\><td align=\'center\'\>#</td\><td\>&nbsp;name</td\><td width=\'25\' align=\'center\'\>level</td\><td colspan=\'2\'\>race</td\><td colspan=\'2\'\>&nbsp;class</td\></tr\>'+data+'<\/table\>';
}
tipxy = get_tipxy(t.offsetWidth, t.offsetHeight, pointx, pointy);
break;
@ -207,14 +196,6 @@ function tip(object, type, onClick)
t.style.top=tipxy.y + "px";
}
function h_tip() {
var t;
t=document.getElementById("tip");
t.innerHTML="";
t.style.left="-1000px";
t.style.top="-1000px";
}
function get_player_position(x,y,m)
{
pos = new _pos();
@ -324,27 +305,6 @@ function getPointsLayerByID(id)
}
}
function switchworld(n)
{
for(var i = 0; i < maps_count; i++)
{
obj_map_layer = getMapLayerByID(i);
obj_points_layer = getPointsLayerByID(i);
if(i == n)
{
obj_map_layer.style.visibility = "visible";
obj_points_layer.style.visibility = "visible";
}
else
{
obj_map_layer.style.visibility = "hidden";
obj_points_layer.style.visibility = "hidden";
}
}
}
function show(data)
{
if(!data)
@ -502,126 +462,25 @@ function show(data)
}
}
function statusController(status_process_id,diff)
{
var action = status_process[status_process_id].action;
if(action)
{
var obj = document.getElementById("status");
var text_type = status_process[status_process_id].text_type;
if(text_type == 0)
{
var status_process_now = new Date();
var status_process_diff = status_process_now.getTime() - status_process_started.getTime();
var objDate = new Date(status_data[status_process[status_process_id].status_data]*1000 + status_process_diff);
var days = parseInt(status_data[status_process[status_process_id].status_data]/86400);
var hours = objDate.getUTCHours();
var min = objDate.getUTCMinutes();
var sec = objDate.getUTCSeconds();
if(hours < 10) hours = '0'+hours;
if(min < 10) min = '0'+min;
if(sec < 10) sec = '0'+sec;
if(days) days = days+' '; else days = '';
obj.innerHTML = status_text[status_process[status_process_id].text_id]+' - '+days+''+hours+':'+min+':'+sec;
}
else if(text_type == 1)
{
obj.innerHTML = status_text[status_process[status_process_id].text_id]+' - '+status_data[status_process[status_process_id].status_data];
}
else
obj.innerHTML = status_text[status_process[status_process_id].text_id];
switch(action)
{
case 1:
if(fade_cur_color > 0)
{
fade_cur_color--;
obj.style.color = '#'+fade_colors[fade_cur_color];
}
break;
case 2:
if(fade_cur_color < (fade_colors.length-1))
{
fade_cur_color++;
obj.style.color = '#'+fade_colors[fade_cur_color];
}
break;
}
}
status_cur_time += diff;
if(status_next_process || status_cur_time >= status_process[status_process_id].time)
{
if(status_next_process)
status_cur_time = statusUpdateInterval*fade_colors.length;
else
status_cur_time = 0;
do
{
status_process_id++;
if(status_process_id >= (status_process.length))
status_process_id = 0;
} while(status_next_process && status_process[status_process_id].action == 2);
status_next_process = 0;
}
setTimeout('statusController('+status_process_id+','+statusUpdateInterval+')', statusUpdateInterval);
}
function showNextStatusText()
{
if(status_process.length > 2)
status_next_process = 1;
}
function statusInit()
{
var blinkTime = statusUpdateInterval*fade_colors.length;
//var time_to_show_uptime = <?php echo $time_to_show_uptime ?>;
//var time_to_show_maxonline = <?php echo $time_to_show_maxonline ?>;
//var time_to_show_gmonline = <?php echo $time_to_show_gmonline ?>;
// for first time
if(status_process.length == 0)
setTimeout('statusController(0,'+statusUpdateInterval+')', statusUpdateInterval);
status_process = new Array();
if(status_data[0] == 1) // online
{
if(time_to_show_uptime)
{
status_process.push(new _status_action(2,1,0,1,time_to_show_uptime));
status_process.push(new _status_action(2,1,0,2,blinkTime));
}
if(time_to_show_maxonline)
{
status_process.push(new _status_action(3,2,1,1,time_to_show_maxonline));
status_process.push(new _status_action(3,2,1,2,blinkTime));
}
if(time_to_show_gmonline)
{
status_process.push(new _status_action(4,3,1,1,time_to_show_gmonline));
status_process.push(new _status_action(4,3,1,2,blinkTime));
}
}
else if(status_data[0] == 0) // offline
{
status_process.push(new _status_action(0,0,2,1,blinkTime));
status_process.push(new _status_action(0,0,2,2,blinkTime));
}
else //DB connect error
{
status_process.push(new _status_action(1,0,2,1,blinkTime));
status_process.push(new _status_action(1,0,2,2,blinkTime));
}
}
function load_data()
{
/*
req.open('GET', 'pomm_play.php', true);
*/
function tooltip_close(){
t=document.getElementById("map_tooltip");
t.innerHTML = '';
}
function map()
{
load_data();
$.ajax({type : 'GET',
url : './api.php?call=map',
success : function(data) {
if(data.status){
for (var i in data.result) {
x = data.result[i].x*0.01+125;
y = data.result[i].y*0.01+250;
$('#map_positions').append('<div '+'onMouseMove="tip(\'<tr\><td\><img src=\\\'hordeicon.gif\\\'\></td\><td\><b style=\\\'color: rgb(210,50,30);\\\'\>:</b\> <b\>5</b\></td\></tr\><tr\><td\><img src=\\\'allianceicon.gif\\\'\></td\><td\><b style=\\\'color: rgb(0,150,190);\\\'\>:</b\> <b\>10</b\></td\></tr\>\',2,false,'+x+','+y+');" onMouseOut="tooltip_close()"'+
'class="map_element" x="'+x+'" y="'+y+'" style="left: '+x+'px; top: '+y+'px;"></div>')
}
}else{
alert('Problem: '+data);}
}
});
}

View File

@ -1,10 +1,20 @@
<?php
class map {
public static function generate($objects){
public static function generate(){
$vars = array();
return \SYSTEM\PAGE\replace::replaceFile(\SYSTEM\SERVERPATH(new PAPI(),'map/tpl/map.tpl'), $vars);
}
public static function positions($filter = null){
return self::players($filter);}
private static function players($filter = null){
return JsonResult::toString(\DBD\MAP_PLAYERS::QA());}
private static function objects($filter = null){
}
private static function creatures($filter = null){
}
public static function zone($map,$x1,$y1){
}

View File

@ -0,0 +1,13 @@
<?php
namespace DBD;
class MAP_PLAYERS extends \SYSTEM\DB\QQ {
protected static function query(){
return new \SYSTEM\DB\QQuery(get_class(),
//pg
'',
//mys
'SELECT guid as id,map,position_x as x,position_y as y,position_z as z,orientation as o FROM characters WHERE map = 1;',
new \DBD\mangos_chars()
);}}

View File

@ -1,5 +1,6 @@
<div class="map">
<div class="map_tip"></div>
<div class="map_pointsWorld"></div>
<div class="map_world"></div>
<div id="map">
<div id="map_world">
<div id="map_positions"></div>
<div id="map_tooltip"></div>
</div>
</div>

Binary file not shown.

After

Width:  |  Height:  |  Size: 60 B

View File

@ -8,7 +8,7 @@ class saimod_mojotrollz_db_player extends \SYSTEM\SAI\SaiModule {
while($row = $res->next()){
$elements .= \SYSTEM\PAGE\replace::replaceFile(\SYSTEM\SERVERPATH(new PSAI(),'saimod_mojotrollz_db_player/tpl/player.tpl'), $row);}
$vars['elements'] = $elements;
$vars['map'] = map::generate(array());
$vars['map'] = map::generate();
return \SYSTEM\PAGE\replace::replaceFile(\SYSTEM\SERVERPATH(new PSAI(),'saimod_mojotrollz_db_player/tpl/players.tpl'), $vars);
}
public static function html_li_menu(){return '<li><a href="#" saimenu="saimod_mojotrollz_db_player">DB:Players</a></li><li class="divider"></li>';}

View File

@ -1,3 +1,6 @@
<tr>
<td>${name}</td>
<td>${level}</td>
<td>${class}</td>
<td>${race}</td>
</tr>

View File

@ -2,6 +2,9 @@ ${map}
<table class="sai_table" style="width: 620px;">
<tr>
<th>Name</th>
<th>Level</th>
<th>Class</th>
<th>Race</th>
</tr>
${elements}
</table>