saimod for visuals
This commit is contained in:
parent
db82b92074
commit
0d63dc59a6
12
mojotrollz/api/char/qq/RACE_VISUALS.php
Normal file
12
mojotrollz/api/char/qq/RACE_VISUALS.php
Normal file
@ -0,0 +1,12 @@
|
||||
<?php
|
||||
namespace DBD;
|
||||
|
||||
class RACE_VISUALS extends \SYSTEM\DB\QP {
|
||||
protected static function query(){
|
||||
return new \SYSTEM\DB\QQuery(get_class(),
|
||||
//pg
|
||||
'',
|
||||
//mys
|
||||
'SELECT * FROM mojotrollz_visuals WHERE race = ? ORDER BY type, id;'
|
||||
);}}
|
||||
|
||||
@ -1,7 +1,7 @@
|
||||
<?php
|
||||
namespace DBD;
|
||||
|
||||
class RACE_VISUALS extends \SYSTEM\DB\QP {
|
||||
class RACE_VISUALS_BY_TYPE extends \SYSTEM\DB\QP {
|
||||
protected static function query(){
|
||||
return new \SYSTEM\DB\QQuery(get_class(),
|
||||
//pg
|
||||
@ -9,9 +9,9 @@
|
||||
<img src="${EQ_PICS}Ui-paperdoll-slot-tabard.png" width="48px" style="padding-bottom: 5px;"/><br/>
|
||||
<img src="${EQ_PICS}Ui-paperdoll-slot-wrists.png" width="48px" style="padding-bottom: 5px;"/>
|
||||
</div>
|
||||
<div style="float:left; width: 322px; height: 400px; padding-top: 0px;">
|
||||
<div style="float:left; width: 300px; height: 400px; padding-top: 0px;">
|
||||
<h4>${name} <img src="${CLASS_PICS}${class_name}.png" width="24px" style="float: right; margin-right: 10px;"/></h4>
|
||||
<object data="http://static.wowhead.com/modelviewer/ModelView.swf" width="322px" height="400px" type="application/x-shockwave-flash">
|
||||
<object data="http://static.wowhead.com/modelviewer/ModelView.swf" width="300px" height="400px" type="application/x-shockwave-flash">
|
||||
<param name="quality" value="high"/>
|
||||
<param name="wmode" value="transparent"/>
|
||||
<param name="allowsscriptaccess" value="always"/>
|
||||
|
||||
@ -3,8 +3,8 @@ class player_races {
|
||||
const HUMAN = 1;
|
||||
const HUMAN_NAME = 'human';
|
||||
|
||||
const ORK = 2;
|
||||
const ORK_NAME = 'ork';
|
||||
const ORC = 2;
|
||||
const ORC_NAME = 'orc';
|
||||
|
||||
const DWARF = 3;
|
||||
const DWARF_NAME = 'dwarf';
|
||||
@ -28,8 +28,8 @@ class player_races {
|
||||
switch($race){
|
||||
case self::HUMAN:
|
||||
return self::HUMAN_NAME;
|
||||
case self::ORK:
|
||||
return self::ORK_NAME;
|
||||
case self::ORC:
|
||||
return self::ORC_NAME;
|
||||
case self::DWARF:
|
||||
return self::DWARF_NAME;
|
||||
case self::NIGHTELF:
|
||||
@ -50,7 +50,7 @@ class player_races {
|
||||
public static function is($class){
|
||||
switch($class){
|
||||
case self::HUMAN:
|
||||
case self::ORK:
|
||||
case self::ORC:
|
||||
case self::DWARF:
|
||||
case self::NIGHTELF:
|
||||
case self::SCOURGE:
|
||||
|
||||
@ -2,6 +2,7 @@
|
||||
\SYSTEM\SAI\sai::register('saimod_mojotrollz_server_handling');
|
||||
require_once dirname(__FILE__).'/saimod_mojotrollz_db_creature/autoload.inc.php';
|
||||
require_once dirname(__FILE__).'/saimod_mojotrollz_skilltree/autoload.inc.php';
|
||||
require_once dirname(__FILE__).'/saimod_mojotrollz_visuals/autoload.inc.php';
|
||||
\SYSTEM\SAI\sai::register('saimod_mojotrollz_db_command');
|
||||
\SYSTEM\SAI\sai::register('saimod_mojotrollz_db_event');
|
||||
\SYSTEM\SAI\sai::register('saimod_mojotrollz_db_gossip');
|
||||
|
||||
@ -33,7 +33,7 @@ class saimod_mojotrollz_skilltree 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_skilltree_flag_js(){return \SYSTEM\LOG\JsonResult::toString(
|
||||
array( \SYSTEM\WEBPATH(new PSAI(),'saimod_mojotrollz_skilltree/saimod_mojotrollz_skilltree.js'),
|
||||
array( \SYSTEM\WEBPATH(new PSAI(),'saimod_mojotrollz_skilltree/js/saimod_mojotrollz_skilltree.js'),
|
||||
\SYSTEM\WEBPATH(new PAPI(),'char/js/skilltree.js')));}
|
||||
public static function sai_mod_saimod_mojotrollz_skilltree_flag_css(){return \SYSTEM\LOG\JsonResult::toString(
|
||||
array(\SYSTEM\WEBPATH(new PAPI(),'char/css/skilltree.css')));}
|
||||
|
||||
@ -0,0 +1,4 @@
|
||||
<?php
|
||||
\SYSTEM\autoload::registerFolder(dirname(__FILE__),'');
|
||||
\SYSTEM\autoload::registerFolder(dirname(__FILE__).'/qq','DBD');
|
||||
\SYSTEM\SAI\sai::register('saimod_mojotrollz_visuals');
|
||||
@ -0,0 +1,99 @@
|
||||
function init_saimod_mojotrollz_visuals() {
|
||||
$('#tabs_visuals a').click(function (e) {
|
||||
e.preventDefault();
|
||||
$(this).tab('show');
|
||||
load_visuals_tab($(this).attr('race'));
|
||||
});
|
||||
|
||||
load_visuals_tab(1);
|
||||
};
|
||||
|
||||
function load_visuals_tab(race){
|
||||
$('img#loader').show();
|
||||
$('#tab_visual').load(SAI_ENDPOINT+'sai_mod=saimod_mojotrollz_visuals&action=visuals&race='+race, function(){
|
||||
register_male_female(race);
|
||||
register_test(race);
|
||||
register_edit(race);
|
||||
register_del(race);
|
||||
register_add(race);
|
||||
$('img#loader').hide();});
|
||||
}
|
||||
|
||||
function register_test(race){
|
||||
$('.btn_visual_test').click(function(){
|
||||
var type = parseInt($(this).attr('_type'));
|
||||
switch(type){
|
||||
case 0: type = 'char_skin_color'; break;
|
||||
case 1: type = 'char_hair'; break;
|
||||
case 2: type = 'char_hair_color'; break;
|
||||
case 3: type = 'char_face'; break;
|
||||
case 4: type = 'char_facial_hair'; break;
|
||||
case 5: type = 'char_facial_hair_color'; break;
|
||||
}
|
||||
send_info(race,'{"'+type+'" : "'+$(this).attr('_id')+'"}');
|
||||
});
|
||||
}
|
||||
|
||||
function register_edit(race){
|
||||
$('.btn_visual_edit').click(function(){
|
||||
$('#input_type').val($(this).attr('_type'));
|
||||
$('#input_id').val($(this).attr('_id'));
|
||||
$('#input_name').val($(this).attr('_name'));
|
||||
$("#btn_visual_add").focus();
|
||||
});
|
||||
}
|
||||
|
||||
function register_del(race){
|
||||
$('.btn_visual_del').click(function(){
|
||||
$.ajax({ type :'GET',
|
||||
url : SAI_ENDPOINT+'sai_mod=saimod_mojotrollz_visuals&action=delete'+
|
||||
'&race='+$(this).attr('race')+
|
||||
'&type='+$(this).attr('_type')+
|
||||
'&id='+$(this).attr('_id'),
|
||||
success : function(data) {
|
||||
if(data.status){
|
||||
load_visuals_tab(race);
|
||||
}else{
|
||||
alert('Problem: '+data);}
|
||||
}
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
function register_add(race){
|
||||
$('.btn_visual_add').click(function(){
|
||||
$.ajax({ type :'GET',
|
||||
url : SAI_ENDPOINT+'sai_mod=saimod_mojotrollz_visuals&action=insert'+
|
||||
'&race='+$(this).attr('race')+
|
||||
'&type='+$('#input_type').val()+
|
||||
'&id='+$('#input_id').val()+
|
||||
'&name='+$('#input_name').val(),
|
||||
success : function(data) {
|
||||
if(data.status){
|
||||
load_visuals_tab(race);
|
||||
}else{
|
||||
alert('Problem: '+data);}
|
||||
}
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
function register_male_female(race){
|
||||
$('#btn_male').click(function(){
|
||||
send_info(race,'{"char_gender" : "male"}');
|
||||
});
|
||||
$('#btn_female').click(function(){
|
||||
send_info(race,'{"char_gender" : "female"}');
|
||||
});
|
||||
}
|
||||
|
||||
function send_info(race,json){
|
||||
$.ajax({
|
||||
async: true,
|
||||
data: {},
|
||||
dataType: 'json',
|
||||
url: SAI_ENDPOINT+'sai_mod=saimod_mojotrollz_visuals&action=info&json='+json,
|
||||
success: function(){
|
||||
load_visuals_tab(race);}
|
||||
});
|
||||
}
|
||||
@ -0,0 +1,12 @@
|
||||
<?php
|
||||
namespace DBD;
|
||||
|
||||
class VISUALS_DELETE extends \SYSTEM\DB\QP {
|
||||
protected static function query(){
|
||||
return new \SYSTEM\DB\QQuery(get_class(),
|
||||
//pg
|
||||
'',
|
||||
//mys
|
||||
'DELETE FROM `mojotrollz_visuals` WHERE `race` = ? AND `type` = ? AND `id` = ?;'
|
||||
);}}
|
||||
|
||||
@ -0,0 +1,14 @@
|
||||
<?php
|
||||
namespace DBD;
|
||||
|
||||
class VISUALS_INSERT extends \SYSTEM\DB\QP {
|
||||
protected static function query(){
|
||||
return new \SYSTEM\DB\QQuery(get_class(),
|
||||
//pg
|
||||
'',
|
||||
//mys
|
||||
'INSERT INTO `mojotrollz_visuals` (`race`, `type`, `id`, `name`)
|
||||
VALUES (?, ?, ?, ?)
|
||||
ON DUPLICATE KEY UPDATE `name`=VALUES(`name`);'
|
||||
);}}
|
||||
|
||||
@ -0,0 +1,44 @@
|
||||
<?php
|
||||
class saimod_mojotrollz_visuals extends \SYSTEM\SAI\SaiModule {
|
||||
public static function sai_mod_saimod_mojotrollz_visuals(){
|
||||
$vars = array();
|
||||
$vars['PICPATH'] = \SYSTEM\WEBPATH(new \SYSTEM\PSAI(), 'modules/saimod_sys_log/img/');
|
||||
return \SYSTEM\PAGE\replace::replaceFile(\SYSTEM\SERVERPATH(new PSAI(),'saimod_mojotrollz_visuals/tpl/saimod_mojotrollz_visuals.tpl'), $vars);}
|
||||
public static function sai_mod_saimod_mojotrollz_visuals_action_visuals($race){
|
||||
$vars = charcreation::data(NULL,false);
|
||||
$vars['char_race'] = $race;
|
||||
$vars['visual'] = equipment::generate( $vars['char_class'],
|
||||
$vars['char_name'],
|
||||
$vars['char_race'],
|
||||
$vars['char_gender'],
|
||||
$vars['char_equip'],
|
||||
$vars['char_skin_color'],
|
||||
$vars['char_hair'],
|
||||
$vars['char_hair_color'],
|
||||
$vars['char_face'],
|
||||
$vars['char_facial_hair'],
|
||||
$vars['char_facial_hair_color']);
|
||||
$vars['visual_entry'] = '';
|
||||
$res = \DBD\RACE_VISUALS::QQ(array($race));
|
||||
while($row = $res->next()){
|
||||
$row['type_name'] = race_visuals::name($row['type']);
|
||||
$vars['visual_entry'] .= \SYSTEM\PAGE\replace::replaceFile(\SYSTEM\SERVERPATH(new PSAI(),'saimod_mojotrollz_visuals/tpl/saimod_mojotrollz_visuals_visual_entry.tpl'), $row);}
|
||||
return \SYSTEM\PAGE\replace::replaceFile(\SYSTEM\SERVERPATH(new PSAI(),'saimod_mojotrollz_visuals/tpl/saimod_mojotrollz_visuals_page.tpl'), $vars);}
|
||||
public static function sai_mod_saimod_mojotrollz_visuals_action_info($json){
|
||||
return charcreation::data($json);}
|
||||
public static function sai_mod_saimod_mojotrollz_visuals_action_delete($race,$type,$id){
|
||||
if(!\DBD\VISUALS_DELETE::QI(array($race,$type,$id))){
|
||||
throw new ERROR("Could not delete visual.");}
|
||||
return JsonResult::ok();}
|
||||
public static function sai_mod_saimod_mojotrollz_visuals_action_insert($race,$type,$id,$name){
|
||||
if(!\DBD\VISUALS_INSERT::QI(array($race,$type,$id,$name))){
|
||||
throw new ERROR("Could not insert visual.");}
|
||||
return JsonResult::ok();}
|
||||
public static function html_li_menu(){return '<li><a href="#" saimenu="saimod_mojotrollz_visuals">Visuals</a></li><li class="divider"></li>';}
|
||||
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_visuals_flag_js(){return \SYSTEM\LOG\JsonResult::toString(
|
||||
array( \SYSTEM\WEBPATH(new PSAI(),'saimod_mojotrollz_visuals/js/saimod_mojotrollz_visuals.js')));}
|
||||
public static function sai_mod_saimod_mojotrollz_visuals_flag_css(){return \SYSTEM\LOG\JsonResult::toString(
|
||||
array( \SYSTEM\WEBPATH(new PAPI(),'char/css/equipment.css')));}
|
||||
}
|
||||
16
mojotrollz/sai/saimod_mojotrollz_visuals/sql/visuals.sql
Normal file
16
mojotrollz/sai/saimod_mojotrollz_visuals/sql/visuals.sql
Normal file
@ -0,0 +1,16 @@
|
||||
INSERT INTO `system_api` (`ID`, `group`, `type`, `parentID`, `parentValue`, `name`, `verify`) VALUES (5200, 42, 0, 0, 'saimod_mojotrollz_visuals', 'action', NULL);
|
||||
INSERT INTO `system_api` (`ID`, `group`, `type`, `parentID`, `parentValue`, `name`, `verify`) VALUES (5201, 42, 2, 5200, 'visuals', 'race', 'INT');
|
||||
|
||||
-- send info
|
||||
INSERT INTO `system_api` (`ID`, `group`, `type`, `parentID`, `parentValue`, `name`, `verify`) VALUES (5205, 42, 2, 5200, 'info', 'json', 'JSON');
|
||||
|
||||
-- delete
|
||||
INSERT INTO `system_api` (`ID`, `group`, `type`, `parentID`, `parentValue`, `name`, `verify`) VALUES (5210, 42, 2, 5200, 'delete', 'race', 'INT');
|
||||
INSERT INTO `system_api` (`ID`, `group`, `type`, `parentID`, `parentValue`, `name`, `verify`) VALUES (5211, 42, 2, 5200, 'delete', 'type', 'INT');
|
||||
INSERT INTO `system_api` (`ID`, `group`, `type`, `parentID`, `parentValue`, `name`, `verify`) VALUES (5212, 42, 2, 5200, 'delete', 'id', 'INT');
|
||||
|
||||
-- insert
|
||||
INSERT INTO `system_api` (`ID`, `group`, `type`, `parentID`, `parentValue`, `name`, `verify`) VALUES (5215, 42, 2, 5200, 'insert', 'race', 'INT');
|
||||
INSERT INTO `system_api` (`ID`, `group`, `type`, `parentID`, `parentValue`, `name`, `verify`) VALUES (5216, 42, 2, 5200, 'insert', 'type', 'INT');
|
||||
INSERT INTO `system_api` (`ID`, `group`, `type`, `parentID`, `parentValue`, `name`, `verify`) VALUES (5217, 42, 2, 5200, 'insert', 'id', 'INT');
|
||||
INSERT INTO `system_api` (`ID`, `group`, `type`, `parentID`, `parentValue`, `name`, `verify`) VALUES (5218, 42, 2, 5200, 'insert', 'name', 'STRING');
|
||||
@ -0,0 +1,18 @@
|
||||
<h4>Visuals</h4>
|
||||
<hr>
|
||||
<div class="tabbable">
|
||||
<ul class="nav nav-tabs" id="tabs_visuals">
|
||||
<li class="active"><a href="#tab_visual" race="1">Human(1)</a></li>
|
||||
<li><a href="#tab_visual" race="2">Ork(2)</a></li>
|
||||
<li><a href="#tab_visual" race="3">Dwarf(3)</a></li>
|
||||
<li><a href="#tab_visual" race="4">Nightelf(4)</a></li>
|
||||
<li><a href="#tab_visual" race="5">Scourge(5)</a></li>
|
||||
<li><a href="#tab_visual" race="7">Tauren(7)</a></li>
|
||||
<li><a href="#tab_visual" race="8">Gnome(8)</a></li>
|
||||
<li><a href="#tab_visual" race="9">Troll(9)</a></li>
|
||||
<img id="loader" src="${PICPATH}ajax-loader.gif" style="margin-left: 10px; margin-top: 10px; display: none; float: left"/>
|
||||
</ul>
|
||||
<div class="tab-content">
|
||||
<div class="tab-pane active" id="tab_visual"></div>
|
||||
</div>
|
||||
</div>
|
||||
@ -0,0 +1,36 @@
|
||||
${visual}
|
||||
<div>
|
||||
<button class="btn btn-success" id="btn_male">Male</button>
|
||||
<button class="btn btn-success" id="btn_female">Female</button>
|
||||
<br><br>
|
||||
name = ${char_name}<br>
|
||||
gender = ${char_gender}<br>
|
||||
race = ${char_race}<br>
|
||||
class = ${char_class}<br>
|
||||
<br>
|
||||
skin_color = ${char_skin_color}<br>
|
||||
hair = ${char_hair}<br>
|
||||
hair_color = ${char_hair_color}<br>
|
||||
face = ${char_face}<br>
|
||||
facial_hair = ${char_facial_hair}<br>
|
||||
facial_hair_color = ${char_facial_hair_color}<br>
|
||||
</div>
|
||||
<div style="clear: both;"></div>
|
||||
<hr>
|
||||
<table class="sai_table">
|
||||
<tr>
|
||||
<th>race</th>
|
||||
<th>type</th>
|
||||
<th>id</th>
|
||||
<th>name</th>
|
||||
<th>action</th>
|
||||
</tr>
|
||||
${visual_entry}
|
||||
<tr>
|
||||
<td>${char_race}</td>
|
||||
<td><input id="input_type" type="number" placeholder="type" style="width: 50px;"/></td>
|
||||
<td><input id="input_id" type="number" placeholder="id" style="width: 50px;"/></td>
|
||||
<td><input id="input_name" type="text" placeholder="name" style="width: 50px;"/></td>
|
||||
<td><button class="btn btn-danger btn_visual_add" race="${char_race}">Add/Edit</button></td>
|
||||
</tr>
|
||||
</table>
|
||||
@ -0,0 +1,9 @@
|
||||
<tr>
|
||||
<td>${race}</td>
|
||||
<td>${type_name}</td>
|
||||
<td>${id}</td>
|
||||
<td>${name}</td>
|
||||
<td><button class="btn btn-success btn_visual_test" race="${race}" _type="${type}" _id="${id}">Test</button>
|
||||
<button class="btn btn-success btn_visual_edit" race="${race}" _type="${type}" _id="${id}" _name="${name}">Edit</button>
|
||||
<button class="btn btn-danger btn_visual_del" race="${race}" _type="${type}" _id="${id}">Delete</button></td>
|
||||
</tr>
|
||||
Loading…
x
Reference in New Issue
Block a user