diff --git a/mojotrollz/api/api_mojotrollz.php b/mojotrollz/api/api_mojotrollz.php index 097e6af..863e7e3 100644 --- a/mojotrollz/api/api_mojotrollz.php +++ b/mojotrollz/api/api_mojotrollz.php @@ -16,7 +16,8 @@ class api_mojotrollz extends \SYSTEM\API\api_system { 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); - } + public static function call_positions($type,$map=null,$entry=null){ + return map::positions($type,$map,$entry);} + public static function call_tooltip($type,$id){ + return tooltip::html($type,$id);} } diff --git a/mojotrollz/api/api_mojotrollz.sql b/mojotrollz/api/api_mojotrollz.sql new file mode 100644 index 0000000..76e0baf --- /dev/null +++ b/mojotrollz/api/api_mojotrollz.sql @@ -0,0 +1,27 @@ +-- sys api +INSERT INTO `system_api` (`ID`, `group`, `type`, `parentID`, `parentValue`, `name`, `verify`) VALUES (10, 0, 0, -1, NULL, 'call', NULL); +INSERT INTO `system_api` (`ID`, `group`, `type`, `parentID`, `parentValue`, `name`, `verify`) VALUES (11, 0, 0, 10, NULL, 'action', NULL); +INSERT INTO `system_api` (`ID`, `group`, `type`, `parentID`, `parentValue`, `name`, `verify`) VALUES (20, 0, 2, 11, 'login', 'username', 'STRING'); +INSERT INTO `system_api` (`ID`, `group`, `type`, `parentID`, `parentValue`, `name`, `verify`) VALUES (21, 0, 2, 11, 'login', 'password_sha', 'STRING'); +INSERT INTO `system_api` (`ID`, `group`, `type`, `parentID`, `parentValue`, `name`, `verify`) VALUES (22, 0, 2, 11, 'login', 'password_md5', 'STRING'); +INSERT INTO `system_api` (`ID`, `group`, `type`, `parentID`, `parentValue`, `name`, `verify`) VALUES (23, 0, 2, 11, 'check', 'rightid', 'UINT'); +INSERT INTO `system_api` (`ID`, `group`, `type`, `parentID`, `parentValue`, `name`, `verify`) VALUES (24, 0, 2, 11, 'create', 'username', 'STRING'); +INSERT INTO `system_api` (`ID`, `group`, `type`, `parentID`, `parentValue`, `name`, `verify`) VALUES (25, 0, 2, 11, 'create', 'password_sha', 'STRING'); +INSERT INTO `system_api` (`ID`, `group`, `type`, `parentID`, `parentValue`, `name`, `verify`) VALUES (26, 0, 2, 11, 'create', 'email', 'STRING'); +INSERT INTO `system_api` (`ID`, `group`, `type`, `parentID`, `parentValue`, `name`, `verify`) VALUES (27, 0, 2, 11, 'create', 'locale', 'LANG'); +INSERT INTO `system_api` (`ID`, `group`, `type`, `parentID`, `parentValue`, `name`, `verify`) VALUES (30, 0, 2, 10, 'files', 'cat', 'STRING'); +INSERT INTO `system_api` (`ID`, `group`, `type`, `parentID`, `parentValue`, `name`, `verify`) VALUES (31, 0, 3, 10, 'files', 'id', 'STRING'); +INSERT INTO `system_api` (`ID`, `group`, `type`, `parentID`, `parentValue`, `name`, `verify`) VALUES (40, 0, 2, 10, 'text', 'request', 'STRING'); +INSERT INTO `system_api` (`ID`, `group`, `type`, `parentID`, `parentValue`, `name`, `verify`) VALUES (41, 0, 2, 10, 'text', 'lang', 'LANG'); +INSERT INTO `system_api` (`ID`, `group`, `type`, `parentID`, `parentValue`, `name`, `verify`) VALUES (50, 0, 2, 10, 'pages', 'group', 'UINT'); + +INSERT INTO `system_api` (`ID`, `group`, `type`, `parentID`, `parentValue`, `name`, `verify`) VALUES (100, 0, 3, 10, 'charcreation', 'json', 'JSON'); +INSERT INTO `system_api` (`ID`, `group`, `type`, `parentID`, `parentValue`, `name`, `verify`) VALUES (132, 0, 2, 10, 'quest', 'entry', 'INT'); +INSERT INTO `system_api` (`ID`, `group`, `type`, `parentID`, `parentValue`, `name`, `verify`) VALUES (133, 0, 2, 10, 'creature', 'entry', 'INT'); + +INSERT INTO `system_api` (`ID`, `group`, `type`, `parentID`, `parentValue`, `name`, `verify`) VALUES (140, 0, 2, 10, 'positions', 'type', 'INT'); +INSERT INTO `system_api` (`ID`, `group`, `type`, `parentID`, `parentValue`, `name`, `verify`) VALUES (141, 0, 3, 10, 'positions', 'map', 'INT'); +INSERT INTO `system_api` (`ID`, `group`, `type`, `parentID`, `parentValue`, `name`, `verify`) VALUES (142, 0, 3, 10, 'positions', 'entry', 'INT'); + +INSERT INTO `system_api` (`ID`, `group`, `type`, `parentID`, `parentValue`, `name`, `verify`) VALUES (150, 0, 2, 10, 'tooltip', 'type', 'INT'); +INSERT INTO `system_api` (`ID`, `group`, `type`, `parentID`, `parentValue`, `name`, `verify`) VALUES (151, 0, 2, 10, 'tooltip', 'id', 'INT'); \ No newline at end of file diff --git a/mojotrollz/api/database/autoload.inc b/mojotrollz/api/database/autoload.inc index a5c4d98..2af472f 100644 --- a/mojotrollz/api/database/autoload.inc +++ b/mojotrollz/api/database/autoload.inc @@ -6,4 +6,6 @@ \SYSTEM\autoload::registerFolder(dirname(__FILE__).'/quest'); \SYSTEM\autoload::registerFolder(dirname(__FILE__).'/quest/qq','DBD'); \SYSTEM\autoload::registerFolder(dirname(__FILE__).'/tags'); -\SYSTEM\autoload::registerFolder(dirname(__FILE__).'/tags/qq','DBD'); \ No newline at end of file +\SYSTEM\autoload::registerFolder(dirname(__FILE__).'/tags/qq','DBD'); +\SYSTEM\autoload::registerFolder(dirname(__FILE__).'/tooltip'); +\SYSTEM\autoload::registerFolder(dirname(__FILE__).'/tooltip/qq','DBD'); \ No newline at end of file diff --git a/mojotrollz/api/database/database_elements.php b/mojotrollz/api/database/database_elements.php new file mode 100644 index 0000000..a805f8c --- /dev/null +++ b/mojotrollz/api/database/database_elements.php @@ -0,0 +1,9 @@ + +Race: ${race}
+Class: ${class}
+Gender: ${gender}
+Level: ${level} \ No newline at end of file diff --git a/mojotrollz/api/database/tooltip/tpl/tooltip_object.tpl b/mojotrollz/api/database/tooltip/tpl/tooltip_object.tpl new file mode 100644 index 0000000..bb3d896 --- /dev/null +++ b/mojotrollz/api/database/tooltip/tpl/tooltip_object.tpl @@ -0,0 +1,5 @@ +Player: ${name}(${guid})
+Race: ${race}
+Class: ${class}
+Gender: ${gender}
+Level: ${level} \ No newline at end of file diff --git a/mojotrollz/api/database/tooltip/tpl/tooltip_player.tpl b/mojotrollz/api/database/tooltip/tpl/tooltip_player.tpl new file mode 100644 index 0000000..bb3d896 --- /dev/null +++ b/mojotrollz/api/database/tooltip/tpl/tooltip_player.tpl @@ -0,0 +1,5 @@ +Player: ${name}(${guid})
+Race: ${race}
+Class: ${class}
+Gender: ${gender}
+Level: ${level} \ No newline at end of file diff --git a/mojotrollz/api/map/css/map.css b/mojotrollz/api/map/css/map.css index a3bed5b..69a2241 100644 --- a/mojotrollz/api/map/css/map.css +++ b/mojotrollz/api/map/css/map.css @@ -1,4 +1,11 @@ -#map { +.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 { margin-left: 0px; margin-top: 0px; margin-right: 0px; @@ -8,31 +15,10 @@ background-color: #000000; height: 450px; width: 600px; -} -.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); background-size: cover; background-repeat: no-repeat; - z-index: 10; } -#map_pointsWorld { - position: absolute; - height: 732px; - width: 966px; - left: 50%; - margin-left: -483px; - z-index: 100; -} -#map_tooltip { +.map_tooltips { border: 0px solid #aaaaaa; padding: 0px; position: relative; diff --git a/mojotrollz/api/map/js/map.js b/mojotrollz/api/map/js/map.js index f1a3912..873f5d5 100644 --- a/mojotrollz/api/map/js/map.js +++ b/mojotrollz/api/map/js/map.js @@ -164,38 +164,6 @@ function getMultiText(multitext, onClick) return data; } -function tip(object, type, onClick,x,y) -{ - var t, data; - var tipxy; - t=document.getElementById("map_tooltip"); - switch(type) - { - case 2: - tipxy = new _coord(); - tipxy.x = x+15; - tipxy.y = y-60; - t.innerHTML=''+object+''; - break; - case 1: - if(onClick || t.innerHTML == '') - { - data = getMultiText(object.multi_text, onClick); - t.innerHTML='
'+object.zone+'
# namelevelrace class'+data+'<\/table\>'; - } - tipxy = get_tipxy(t.offsetWidth, t.offsetHeight, pointx, pointy); - break; - case 0: - if(object.faction) {color='#D2321E';} - else {color='#0096BE';} - t.innerHTML=' '+object.name+' 
'+object.single_text+'<\/table\><\/table\>'; - tipxy = get_tipxy(t.offsetWidth, t.offsetHeight, pointx, pointy); - break; - } - t.style.left=tipxy.x + "px"; - t.style.top=tipxy.y + "px"; -} - function get_player_position(x,y,m) { pos = new _pos(); @@ -462,22 +430,32 @@ function show(data) } } -function tooltip_close(){ - t=document.getElementById("map_tooltip"); - t.innerHTML = ''; +function map(type,entry){ + $('#tabs_maps a').click(function (e) { + e.preventDefault(); + $(this).tab('show'); + map_positions(type,$(this).attr('map'),entry); + }); + map_positions(type,0,entry); } -function map() -{ +function map_positions(type,map,entry){ + $('#map_positions_'+map).html(''); $.ajax({type : 'GET', - url : './api.php?call=map', + url : './api.php?call=positions&type='+type+'&map='+map+'&entry='+entry, 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('
') + x = data.result[i].x*0.0025+100; + y = data.result[i].y*0.0025+100; + $('#map_positions_'+map).append('
'+ + '
') } }else{ alert('Problem: '+data);} diff --git a/mojotrollz/api/map/map.php b/mojotrollz/api/map/map.php index a1cdbc1..767efed 100644 --- a/mojotrollz/api/map/map.php +++ b/mojotrollz/api/map/map.php @@ -1,18 +1,76 @@ next()){ + $map['active'] = $active ? 'active' : ''; + $vars['tabs'] .= \SYSTEM\PAGE\replace::replaceFile(\SYSTEM\SERVERPATH(new PAPI(),'map/tpl/maps_tab.tpl'), $map); + $vars['tabs_content'] .= \SYSTEM\PAGE\replace::replaceFile(\SYSTEM\SERVERPATH(new PAPI(),'map/tpl/map.tpl'), $map); + $active = false; + } + return \SYSTEM\PAGE\replace::replaceFile(\SYSTEM\SERVERPATH(new PAPI(),'map/tpl/maps.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){ + public static function positions($type,$map=null,$entry=null){ + switch($type){ + case database_elements::DB_CREATURE: + return self::creatures($map,$entry); + case database_elements::DB_OBJECT: + return self::objects($map,$entry); + case database_elements::DB_ITEM: + throw new ERROR('Incompatible Type - Item & Position'); + case database_elements::DB_QUEST: + return self::quests($map,$entry); + case database_elements::DB_SPELL: + throw new ERROR('Incompatible Type - Spell & Position'); + case database_elements::DB_PLAYER: + return self::players($map); + default: + throw new ERROR('Wrong Type'); + } } - private static function creatures($filter = null){ + private static function players($map=null){ + if($map == null){ + return JsonResult::toString(\DBD\MAP_PLAYERS_MAPS::QA());} + return JsonResult::toString(\DBD\MAP_PLAYERS::QA(array($map)));} + private static function objects($map=null,$entry=null){ + if($entry == null){ + throw new ERROR('Problem');} + if($map == null){ + return JsonResult::toString(\DBD\MAP_OBJECTS_MAPS::QA(array($entry)));} + return JsonResult::toString(\DBD\MAP_OBJECTS::QA(array($map,$entry)));} + private static function creatures($map=null,$entry=null){ + if($entry == null){ + throw new ERROR('Problem');} + if($map == null){ + return JsonResult::toString(\DBD\MAP_CREATURES_MAPS::QA(array($entry)));} + return JsonResult::toString(\DBD\MAP_CREATURES::QA(array($map,$entry)));} + private static function quests($map=null,$entry=null){ } public static function zone($map,$x1,$y1){ diff --git a/mojotrollz/api/map/qq/MAP_CREATURES.php b/mojotrollz/api/map/qq/MAP_CREATURES.php new file mode 100644 index 0000000..f7a9aae --- /dev/null +++ b/mojotrollz/api/map/qq/MAP_CREATURES.php @@ -0,0 +1,15 @@ + -
-
-
+
+
+
+
\ No newline at end of file diff --git a/mojotrollz/api/map/tpl/maps.tpl b/mojotrollz/api/map/tpl/maps.tpl new file mode 100644 index 0000000..3931185 --- /dev/null +++ b/mojotrollz/api/map/tpl/maps.tpl @@ -0,0 +1,8 @@ +
+ +
+ ${tabs_content} +
+
\ No newline at end of file diff --git a/mojotrollz/api/map/tpl/maps_tab.tpl b/mojotrollz/api/map/tpl/maps_tab.tpl new file mode 100644 index 0000000..5b99e98 --- /dev/null +++ b/mojotrollz/api/map/tpl/maps_tab.tpl @@ -0,0 +1 @@ +
  • ${map_name}
  • \ No newline at end of file diff --git a/mojotrollz/sai/saimod_mojotrollz_db_creature/saimod_mojotrollz_db_creature.js b/mojotrollz/sai/saimod_mojotrollz_db_creature/saimod_mojotrollz_db_creature.js index e6ec861..c2beef2 100644 --- a/mojotrollz/sai/saimod_mojotrollz_db_creature/saimod_mojotrollz_db_creature.js +++ b/mojotrollz/sai/saimod_mojotrollz_db_creature/saimod_mojotrollz_db_creature.js @@ -6,8 +6,9 @@ function init_saimod_mojotrollz_db_creature(){ }); }); $('.sai_table_row').click(function(){ - $('#content-wrapper').load(SAI_ENDPOINT + 'sai_mod=saimod_mojotrollz_db_creature&action=creature&id=' + $(this).attr('sai_table_row'),function(){ - + var entry = $(this).attr('sai_table_row'); + $('#content-wrapper').load(SAI_ENDPOINT + 'sai_mod=saimod_mojotrollz_db_creature&action=creature&id=' + entry,function(){ + map(1,entry); }); }); } diff --git a/mojotrollz/sai/saimod_mojotrollz_db_creature/saimod_mojotrollz_db_creature.php b/mojotrollz/sai/saimod_mojotrollz_db_creature/saimod_mojotrollz_db_creature.php index d9ce694..68d38fe 100644 --- a/mojotrollz/sai/saimod_mojotrollz_db_creature/saimod_mojotrollz_db_creature.php +++ b/mojotrollz/sai/saimod_mojotrollz_db_creature/saimod_mojotrollz_db_creature.php @@ -17,7 +17,7 @@ class saimod_mojotrollz_db_creature extends \SYSTEM\SAI\SaiModule { '\DBD\DB_CREATURE_TEMPLATE_CREATURE_AI_SCRIPTS' => array('key' => 'Entry', 'caption' => 'AI Scripts'), '\DBD\DB_CREATURE_TEMPLATE_CREATURE_MOVEMENT_TEMPLATE' => array('key' => 'Entry', 'caption' => 'Movement Template'),)); - $result = '
    '; + $result = map::generate(1,$id).'
    '; $base_row = \DBD\DB_CREATURE_TEMPLATE_CREATURE::Q1(array($id)); foreach($base_row as $key=>$value){ $result .= '';} @@ -153,6 +153,9 @@ class saimod_mojotrollz_db_creature extends \SYSTEM\SAI\SaiModule { public static function right_public(){return false;} public static function right_right(){return \SYSTEM\SECURITY\Security::check(\SYSTEM\SECURITY\RIGHTS::SYS_SAI);} public static function sai_mod_saimod_mojotrollz_db_creature_flag_js(){return \SYSTEM\LOG\JsonResult::toString(array( - \SYSTEM\WEBPATH(new PSAI(),'saimod_mojotrollz_db_creature/saimod_mojotrollz_db_creature.js')));} - public static function sai_mod_saimod_mojotrollz_db_creature_flag_css(){} + \SYSTEM\WEBPATH(new PAPI(),'database/js/wow.js'), + \SYSTEM\WEBPATH(new PAPI(),'map/js/map.js'), + \SYSTEM\WEBPATH(new PSAI(),'saimod_mojotrollz_db_creature/saimod_mojotrollz_db_creature.js')));} + public static function sai_mod_saimod_mojotrollz_db_creature_flag_css(){return \SYSTEM\LOG\JsonResult::toString(array( + \SYSTEM\WEBPATH(new PAPI(),'map/css/map.css')));} } \ No newline at end of file diff --git a/mojotrollz/sai/saimod_mojotrollz_db_player/js/saimod_mojotrollz_db_player.js b/mojotrollz/sai/saimod_mojotrollz_db_player/js/saimod_mojotrollz_db_player.js index 02ba466..7497868 100644 --- a/mojotrollz/sai/saimod_mojotrollz_db_player/js/saimod_mojotrollz_db_player.js +++ b/mojotrollz/sai/saimod_mojotrollz_db_player/js/saimod_mojotrollz_db_player.js @@ -1,3 +1,3 @@ function init_saimod_mojotrollz_db_player(){ - map(); + map(6,-1); } \ No newline at end of file diff --git a/mojotrollz/sai/saimod_mojotrollz_db_player/saimod_mojotrollz_db_player.php b/mojotrollz/sai/saimod_mojotrollz_db_player/saimod_mojotrollz_db_player.php index 8bb24ce..900967d 100644 --- a/mojotrollz/sai/saimod_mojotrollz_db_player/saimod_mojotrollz_db_player.php +++ b/mojotrollz/sai/saimod_mojotrollz_db_player/saimod_mojotrollz_db_player.php @@ -2,19 +2,20 @@ class saimod_mojotrollz_db_player extends \SYSTEM\SAI\SaiModule { public static function sai_mod_saimod_mojotrollz_db_player(){ $con = new \SYSTEM\DB\Connection(new \DBD\mangos_chars()); - $res = $con->query('SELECT * FROM characters LIMIT 100;'); + $res = $con->query('SELECT * FROM characters WHERE deleteInfos_Account IS NULL LIMIT 100;'); $vars = array(); $elements = ''; 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(); + $vars['map'] = map::generate(6); return \SYSTEM\PAGE\replace::replaceFile(\SYSTEM\SERVERPATH(new PSAI(),'saimod_mojotrollz_db_player/tpl/players.tpl'), $vars); } public static function html_li_menu(){return '
  • DB:Players
  • ';} public static function right_public(){return false;} public static function right_right(){return \SYSTEM\SECURITY\Security::check(\SYSTEM\SECURITY\RIGHTS::SYS_SAI);} public static function sai_mod_saimod_mojotrollz_db_player_flag_js(){return \SYSTEM\LOG\JsonResult::toString(array( + \SYSTEM\WEBPATH(new PAPI(),'database/js/wow.js'), \SYSTEM\WEBPATH(new PAPI(),'map/js/map.js'), \SYSTEM\WEBPATH(new PSAI(),'saimod_mojotrollz_db_player/js/saimod_mojotrollz_db_player.js') ));}
    '.$key.''.$value.'