mirror of
https://github.com/Relintai/mourne_rcpp_fw.git
synced 2025-03-28 02:26:22 +01:00
Added the old project code itself.
This commit is contained in:
parent
5ea8eff56c
commit
a1cb41aa04
16
Mourne-CI/.gitignore
vendored
Executable file
16
Mourne-CI/.gitignore
vendored
Executable file
@ -0,0 +1,16 @@
|
||||
*~
|
||||
4
|
||||
*.swp
|
||||
*.swo
|
||||
*.swn
|
||||
*.swl
|
||||
*.sw*
|
||||
#*#
|
||||
*#*
|
||||
.#*
|
||||
log-*.php
|
||||
log_*.txt
|
||||
log.txt
|
||||
debug_*.sql
|
||||
map*.sql
|
||||
ai_village*.sql
|
1
Mourne-CI/application/.htaccess
Executable file
1
Mourne-CI/application/.htaccess
Executable file
@ -0,0 +1 @@
|
||||
Deny from all
|
1935
Mourne-CI/application/controllers/admin.php
Executable file
1935
Mourne-CI/application/controllers/admin.php
Executable file
File diff suppressed because it is too large
Load Diff
22
Mourne-CI/application/controllers/alliance.php
Executable file
22
Mourne-CI/application/controllers/alliance.php
Executable file
@ -0,0 +1,22 @@
|
||||
<?php
|
||||
|
||||
class Alliance extends MO_Controller
|
||||
{
|
||||
function __construct()
|
||||
{
|
||||
parent::__construct();
|
||||
}
|
||||
|
||||
function index()
|
||||
{
|
||||
}
|
||||
|
||||
function alliance_menu()
|
||||
{
|
||||
$this->headers('alliance');
|
||||
|
||||
$this->footer();
|
||||
}
|
||||
|
||||
}
|
||||
//nowhitesp
|
702
Mourne-CI/application/controllers/building.php
Executable file
702
Mourne-CI/application/controllers/building.php
Executable file
@ -0,0 +1,702 @@
|
||||
<?php
|
||||
|
||||
class Building extends MO_Controller
|
||||
{
|
||||
function __construct()
|
||||
{
|
||||
parent::__construct();
|
||||
}
|
||||
|
||||
function index($id)
|
||||
{
|
||||
$this->load->helper('url');
|
||||
redirect('building/stats/' .$id);
|
||||
}
|
||||
|
||||
function stats($slotid = 0)
|
||||
{
|
||||
if (!$slotid)
|
||||
{
|
||||
$this->load->helper($url);
|
||||
redirect('village/selected');
|
||||
}
|
||||
|
||||
$this->headers('do', $slotid);
|
||||
|
||||
if ($this->building['id'] == 1)
|
||||
{
|
||||
$this->load->helper('url');
|
||||
redirect('building/build');
|
||||
}
|
||||
|
||||
if ($this->building['id'] == 2)
|
||||
{
|
||||
//build_in_progress
|
||||
|
||||
$this->headers('build_in_progress');
|
||||
|
||||
$event = $this->_filter_events('type', 'slotid', $slotid, 0, TRUE);
|
||||
|
||||
$data['event'] = $event;
|
||||
$data['building'] = $this->building_model->get_building($event['data1']);
|
||||
|
||||
$this->load->view('building/header', $data);
|
||||
$this->load->view('building/spacer');
|
||||
$this->load->view('building/next_event', $data);
|
||||
$this->load->view('building/stats', $data);
|
||||
|
||||
$this->footer();
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
$this->headers('building', $slotid);
|
||||
|
||||
$data['slotid'] = $slotid;
|
||||
|
||||
$this->load->view('building/stats', $data);
|
||||
|
||||
$this->footer();
|
||||
}
|
||||
|
||||
function upgrade($slotid = 0)
|
||||
{
|
||||
if (!$slotid)
|
||||
{
|
||||
$this->load->helper('url');
|
||||
redirect('village/selected');
|
||||
}
|
||||
|
||||
$this->headers('building', $slotid);
|
||||
|
||||
$event = $this->_filter_events('type', 'slot', $slotid, 1);
|
||||
|
||||
$up['slotid'] = $slotid;
|
||||
|
||||
if ($this->building['next_rank'])
|
||||
{
|
||||
$up['slotid'] = $slotid;
|
||||
|
||||
$up['nextrank'] = $this->building_model->get_building(
|
||||
$this->building['next_rank']);
|
||||
|
||||
$up['upgrade'] = $this->building_model->can_be_upgraded(
|
||||
$event,
|
||||
$this->resources,
|
||||
$up['nextrank'],
|
||||
$this->villageid);
|
||||
}
|
||||
|
||||
$this->load->view('building/upgrade', $up);
|
||||
$this->footer();
|
||||
}
|
||||
|
||||
function create($slotid = 0)
|
||||
{
|
||||
if (!$slotid)
|
||||
{
|
||||
$this->load->helper($url);
|
||||
redirect('village/selected');
|
||||
}
|
||||
|
||||
$this->headers('building', $slotid);
|
||||
|
||||
//can create something
|
||||
if ($this->building['creates'])
|
||||
{
|
||||
$events = $this->_filter_events('type', 'all', $slotid, 2);
|
||||
|
||||
$this->load->model('unit_model');
|
||||
|
||||
$data['unit'] = $this->unit_model->get_unit($this->building['creates']);
|
||||
|
||||
if ($data['unit']['cost_unit'])
|
||||
$data['costu'] = $this->unit_model->get_unit(
|
||||
$data['unit']['cost_unit']);
|
||||
else
|
||||
$data['costu'] = FALSE;
|
||||
|
||||
$this->load->model('resource_model');
|
||||
|
||||
//This should be one function
|
||||
$data['maxunit'] = $this->resource_model->calc_max_unit($data['unit'],
|
||||
$this->building['num_creates'],
|
||||
$this->resources);
|
||||
|
||||
$data['maxunit'] = $this->unit_model->calc_max_unit_ev(
|
||||
$this->building['num_creates'],
|
||||
$data['maxunit'],
|
||||
$events);
|
||||
|
||||
if ($events)
|
||||
{
|
||||
$d['event'] = $events;
|
||||
$this->load->view('building/events', $d);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
$data['building'] = $this->building;
|
||||
$this->load->view('building/building_create', $data);
|
||||
|
||||
$this->footer();
|
||||
}
|
||||
|
||||
function assign($slotid)
|
||||
{
|
||||
if (!$slotid)
|
||||
{
|
||||
$this->load->helper($url);
|
||||
redirect('village/selected');
|
||||
}
|
||||
|
||||
$this->headers('building', $slotid);
|
||||
|
||||
//have assignments
|
||||
$this->load->model('assignment_model');
|
||||
|
||||
$assign = $this->assignment_model->get_assignments($slotid,
|
||||
$this->villageid,
|
||||
$this->userid);
|
||||
|
||||
$assign['slotid'] = $slotid;
|
||||
|
||||
$this->load->view('building/assignments', $assign);
|
||||
|
||||
$this->footer();
|
||||
}
|
||||
|
||||
function spells($slotid)
|
||||
{
|
||||
if (!$slotid)
|
||||
{
|
||||
$this->load->helper($url);
|
||||
redirect('village/selected');
|
||||
}
|
||||
|
||||
$this->headers('building', $slotid);
|
||||
|
||||
$this->load->model('spell_model');
|
||||
|
||||
$spell['spells'] = $this->spell_model->get_spells($slotid,
|
||||
$this->villageid);
|
||||
|
||||
$spell['slotid'] = $slotid;
|
||||
|
||||
$this->load->view('building/spells', $spell);
|
||||
$this->footer();
|
||||
}
|
||||
|
||||
function events($slotid = 0)
|
||||
{
|
||||
if (!$slotid)
|
||||
{
|
||||
$this->load->helper($url);
|
||||
redirect('village/selected');
|
||||
}
|
||||
|
||||
$this->headers('building', $slotid);
|
||||
|
||||
//$this->load->model('event_model');
|
||||
//$data['event'] = $this->event_model->get_events($slotid,
|
||||
// $this->villageid);
|
||||
|
||||
$data['event'] = $this->_filter_events('all', 'slot', $slotid);
|
||||
|
||||
$this->load->view('building/events', $data);
|
||||
|
||||
$this->footer();
|
||||
}
|
||||
|
||||
function research($slotid = 0)
|
||||
{
|
||||
if (!$slotid)
|
||||
{
|
||||
$this->load->helper('url');
|
||||
redirect('village/selected');
|
||||
}
|
||||
|
||||
$this->headers('building', $slotid);
|
||||
|
||||
$events = $this->_filter_events('type', 'slot', $slotid, 4);
|
||||
|
||||
if (!$events)
|
||||
{
|
||||
$this->load->model('technology_model');
|
||||
|
||||
$data = $this->technology_model->get_researchable($slotid,
|
||||
$this->villageid);
|
||||
|
||||
$data['slotid'] = $slotid;
|
||||
|
||||
|
||||
$this->load->view('building/research', $data);
|
||||
}
|
||||
else
|
||||
{
|
||||
$this->load->model('technology_model');
|
||||
|
||||
$data['technology'] = $this->technology_model->get_technology($events[0]['data1']);
|
||||
|
||||
$this->load->view('building/al_research', $data);
|
||||
}
|
||||
|
||||
$this->footer();
|
||||
|
||||
}
|
||||
|
||||
function build($slotid = 0)
|
||||
{
|
||||
if (!$slotid)
|
||||
{
|
||||
$this->load->helper('url');
|
||||
redirect('village/selected');
|
||||
}
|
||||
|
||||
$this->load->model('building_model');
|
||||
|
||||
$this->_get_slot_building($slotid);
|
||||
|
||||
$this->headers('build');
|
||||
|
||||
if ($this->building['id'] == 1)
|
||||
{
|
||||
//empty space
|
||||
|
||||
$data['buildings'] = $this->building_model->building_list(
|
||||
$this->villageid);
|
||||
|
||||
$data['slotid'] = $slotid;
|
||||
$this->load->view('building/list', $data);
|
||||
}
|
||||
else
|
||||
{
|
||||
//slot has some building
|
||||
$this->load->helper('url');
|
||||
redirect('building/stats/' . $slotid);
|
||||
}
|
||||
|
||||
$this->footer();
|
||||
}
|
||||
|
||||
function dobuild()
|
||||
{
|
||||
$this->load->helper('url');
|
||||
|
||||
$slotid = $this->input->post('slotid');
|
||||
$buildingid = $this->input->post('id');
|
||||
|
||||
if (!$slotid || !$buildingid)
|
||||
redirect('village/selected');
|
||||
|
||||
$this->headers('do');
|
||||
|
||||
$this->load->model('building_model');
|
||||
//$this->load->model('event_model');
|
||||
$this->load->model('resource_model');
|
||||
|
||||
//check if building exists
|
||||
if (!$this->building_model->is_valid_slot($slotid, $this->villageid))
|
||||
{
|
||||
//display error page
|
||||
echo "is_valid_slot returned FALSE";
|
||||
return;
|
||||
}
|
||||
|
||||
$building = $this->building_model->get_building($buildingid);
|
||||
|
||||
if (!$this->building_model->check_resources($this->resources, $building))
|
||||
{
|
||||
//display error page
|
||||
echo "You don't have enough resources";
|
||||
return;
|
||||
}
|
||||
|
||||
/*
|
||||
//do this matters? maybe it should be removed.
|
||||
if ($this->event_model->has_event($slotid, $this->villageid))
|
||||
{
|
||||
//display error page
|
||||
echo "has_event returned TRUE";
|
||||
return;
|
||||
}
|
||||
*/
|
||||
/* this probably aren't needed
|
||||
if (!$this->building_model->can_build($this->villageid, $buildingid))
|
||||
{
|
||||
//display an error page
|
||||
echo "can_build returned FALSE";
|
||||
return;
|
||||
}
|
||||
*/
|
||||
|
||||
//can be built
|
||||
if (!$this->building_model->has_req_tech($building['req_tech'], $this->villageid))
|
||||
{
|
||||
echo "Technology requirements not met.";
|
||||
return;
|
||||
}
|
||||
|
||||
//add_event
|
||||
$this->load->helper('event');
|
||||
|
||||
$ev['type'] = ev_type('build');
|
||||
$ev['villageid'] = $this->villageid;
|
||||
$ev['slotid'] = $slotid;
|
||||
$ev['time'] = $building['time_to_build'];
|
||||
$ev['data1'] = $buildingid;
|
||||
|
||||
$this->event_model->add_event($ev);
|
||||
|
||||
//resource substract
|
||||
$this->resource_model->set_resources($this->resources);
|
||||
$this->resource_model->substract_resources($building,
|
||||
$this->villageid);
|
||||
$this->resource_model->write_resources();
|
||||
|
||||
//change tile to build in progress
|
||||
$this->building_model->set_build_in_progress($slotid, $this->villageid);
|
||||
|
||||
$url = 'building/stats/' . $slotid;
|
||||
redirect($url);
|
||||
|
||||
}
|
||||
|
||||
function docreate($slotid)
|
||||
{
|
||||
$this->load->library('form_validation');
|
||||
|
||||
$this->form_validation->set_rules('create_num', 'Number to create',
|
||||
'is_natural_no_zero');
|
||||
|
||||
$this->load->helper('url');
|
||||
$url = 'building/create/' . $slotid;
|
||||
|
||||
$this->headers('do', $slotid);
|
||||
|
||||
if ($this->form_validation->run())
|
||||
{
|
||||
$num_create = $this->input->post('create_num');
|
||||
|
||||
if (!$num_create)
|
||||
redirect($url);
|
||||
|
||||
$this->load->model('building_model');
|
||||
|
||||
$building = $this->building;
|
||||
|
||||
$this->headers('do');
|
||||
|
||||
if ($building['id'] == 1 || $building['id'] == 2)
|
||||
{
|
||||
//TODO show proper error
|
||||
echo "There isn't any building in that slot";
|
||||
return;
|
||||
}
|
||||
|
||||
if (!$building['creates'])
|
||||
{
|
||||
//TODO show proper error
|
||||
echo "that building can't create units";
|
||||
return;
|
||||
}
|
||||
|
||||
$event = $this->_filter_events('type', 'slot', $slotid, 2);
|
||||
|
||||
$this->load->model('resource_model');
|
||||
$res = $this->resources;
|
||||
|
||||
$this->load->model('unit_model');
|
||||
$unit = $this->unit_model->get_unit($building['creates']);
|
||||
|
||||
$max = $this->resource_model->calc_max_unit($unit,
|
||||
$building['num_creates'],
|
||||
$res);
|
||||
|
||||
$max = $this->unit_model->calc_max_unit_ev($building['num_creates'],
|
||||
$max,
|
||||
$event);
|
||||
|
||||
if (!$max)
|
||||
{
|
||||
//TODO proper error
|
||||
echo "You can't make any";
|
||||
return;
|
||||
}
|
||||
|
||||
if ($num_create > $max)
|
||||
{
|
||||
//TODO proper error
|
||||
echo "You can't make that many";
|
||||
return;
|
||||
}
|
||||
|
||||
//add event
|
||||
$this->load->helper('event');
|
||||
|
||||
$ev['type'] = ev_type('create');
|
||||
$ev['villageid'] = $this->villageid;
|
||||
$ev['slotid'] = $slotid;
|
||||
$ev['time'] = ($unit['time_to_create'] * $num_create);
|
||||
$ev['data1'] = $unit['id'];
|
||||
$ev['data2'] = $num_create;
|
||||
|
||||
$this->event_model->add_event($ev);
|
||||
|
||||
$this->resource_model->set_resources($this->resources);
|
||||
$this->resource_model->substract_resources($unit,
|
||||
$this->villageid,
|
||||
$num_create);
|
||||
|
||||
$this->resource_model->write_resources();
|
||||
|
||||
redirect($url);
|
||||
}
|
||||
else
|
||||
{
|
||||
redirect($url);
|
||||
}
|
||||
}
|
||||
|
||||
function doupgrade()
|
||||
{
|
||||
$this->headers('do');
|
||||
|
||||
$this->load->helper('url');
|
||||
$this->load->library('form_validation');
|
||||
|
||||
$this->form_validation->set_rules('slotid', 'Slotid', 'is_natural');
|
||||
|
||||
if ($this->form_validation->run())
|
||||
{
|
||||
$this->load->model('event_model');
|
||||
$this->load->model('resource_model');
|
||||
$this->load->model('building_model');
|
||||
|
||||
$slotid = $this->input->post('slotid');
|
||||
|
||||
$this->headers('do', $slotid);
|
||||
|
||||
$building = $this->building;
|
||||
|
||||
if (!$building['next_rank'])
|
||||
{
|
||||
echo "Building doesn't have next rank.";
|
||||
return;
|
||||
}
|
||||
|
||||
$next_rank = $this->building_model->get_building($building['next_rank']);
|
||||
$res = $this->resources;
|
||||
|
||||
|
||||
$event = $this->_filter_events('type', 'slot', $slotid, 1);
|
||||
|
||||
$can = $this->building_model->can_be_upgraded($event, $res, $next_rank,
|
||||
$this->villageid);
|
||||
|
||||
if ($can == 3)
|
||||
{
|
||||
//can be upgraded
|
||||
|
||||
$this->load->helper('event');
|
||||
|
||||
$ev['type'] = ev_type('upgrade');
|
||||
$ev['villageid'] = $this->villageid;
|
||||
$ev['slotid'] = $slotid;
|
||||
$ev['time'] = $next_rank['time_to_build'];
|
||||
$ev['data1'] = $next_rank['id'];
|
||||
$ev['data2'] = $building['id'];
|
||||
|
||||
$this->event_model->add_event($ev);
|
||||
|
||||
$this->resource_model->set_resources($this->resources);
|
||||
$this->resource_model->substract_resources($next_rank,
|
||||
$this->villageid);
|
||||
|
||||
$this->resource_model->write_resources();
|
||||
|
||||
$url = 'building/upgrade/' . $slotid;
|
||||
redirect($url);
|
||||
|
||||
}
|
||||
elseif ($can == 1)
|
||||
{
|
||||
echo "Village doesn't have the required technology.";
|
||||
return;
|
||||
}
|
||||
elseif ($can == 2)
|
||||
{
|
||||
//not enough resources
|
||||
echo "Not enough resources";
|
||||
return;
|
||||
}
|
||||
else
|
||||
{
|
||||
//upgrading in progress
|
||||
echo "Upgrade already in progress.";
|
||||
return;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
redirect('village/selected');
|
||||
}
|
||||
}
|
||||
|
||||
function doassign()
|
||||
{
|
||||
$this->headers('do');
|
||||
|
||||
$this->load->library('form_validation');
|
||||
|
||||
$this->form_validation->set_rules('num_assign', 'Assigned number', 'is_natural');
|
||||
$this->form_validation->set_rules('slotid', 'slotid', 'required|is_natural');
|
||||
$this->form_validation->set_rules('assignmentid', 'Assignmentid',
|
||||
'required|is_natural');
|
||||
|
||||
if ($this->form_validation->run())
|
||||
{
|
||||
$assid = $this->input->post('assignmentid');
|
||||
$slotid = $this->input->post('slotid');
|
||||
$num_assign = $this->input->post('num_assign');
|
||||
|
||||
$this->load->model('assignment_model');
|
||||
|
||||
$a = $this->assignment_model->assign_unit($assid, $num_assign, $slotid, $this->resources,
|
||||
$this->villageid, $this->userid);
|
||||
|
||||
//error handling with return value
|
||||
if ($a == 1)
|
||||
{
|
||||
//no building in that slot
|
||||
echo "No building in that slot";
|
||||
return;
|
||||
}
|
||||
|
||||
if ($a == 2)
|
||||
{
|
||||
//no such assignmentid
|
||||
echo "No such assignmentid";
|
||||
return;
|
||||
}
|
||||
|
||||
if ($a == 3)
|
||||
{
|
||||
//building soesn't have that assignment
|
||||
echo "Building doesn't have that assignment";
|
||||
return;
|
||||
}
|
||||
|
||||
if ($a == 4)
|
||||
{
|
||||
echo "You don't have any units that can be assigned in that slot";
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
$this->load->helper('url');
|
||||
redirect('building/assign/' . $slotid);
|
||||
}
|
||||
else
|
||||
{
|
||||
$this->load->helper('url');
|
||||
redirect('village/selected');
|
||||
}
|
||||
}
|
||||
|
||||
function dospell()
|
||||
{
|
||||
$this->headers('do');
|
||||
|
||||
$this->load->library('form_validation');
|
||||
|
||||
$this->form_validation->set_rules('spellid', 'spellid', 'required|is_natural');
|
||||
$this->form_validation->set_rules('slotid', 'slotid', 'required|is_natural');
|
||||
|
||||
if ($this->form_validation->run())
|
||||
{
|
||||
$spellid = $this->input->post('spellid');
|
||||
$slotid = $this->input->post('slotid');
|
||||
|
||||
$this->load->model('spell_model');
|
||||
|
||||
$a = $this->spell_model->use_spell($spellid, $slotid, $this->resources,
|
||||
$this->villageid);
|
||||
|
||||
//error handling with return value
|
||||
if ($a == 1)
|
||||
{
|
||||
echo "Building doesn't have that spell";
|
||||
return;
|
||||
}
|
||||
|
||||
if ($a == 2)
|
||||
{
|
||||
echo "spell is on cooldown";
|
||||
return;
|
||||
}
|
||||
|
||||
if ($a == 3)
|
||||
{
|
||||
echo "Not enough resources";
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
|
||||
$this->load->helper('url');
|
||||
redirect('building/spells/' . $slotid);
|
||||
}
|
||||
else
|
||||
{
|
||||
$this->load->helper('url');
|
||||
redirect('village/selected');
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
function doresearch()
|
||||
{
|
||||
$this->load->helper('url');
|
||||
|
||||
$slotid = $this->input->post('slotid');
|
||||
$techid = $this->input->post('id');
|
||||
|
||||
if (!($slotid || $techid))
|
||||
redirect('village/selected');
|
||||
|
||||
$this->headers('do');
|
||||
|
||||
$event = $this->_filter_events('type', 'slot', $slotid, 4);
|
||||
|
||||
if ($event)
|
||||
echo "Already researching.";
|
||||
|
||||
$this->load->model('technology_model');
|
||||
|
||||
$a = $this->technology_model->do_research($techid, $this->resources, $slotid,
|
||||
$this->villageid);
|
||||
|
||||
if ($a == 1)
|
||||
{
|
||||
echo "Technology ID doesn't exist";
|
||||
return;
|
||||
}
|
||||
|
||||
if ($a == 2)
|
||||
{
|
||||
echo "Not enough resources";
|
||||
return;
|
||||
}
|
||||
|
||||
if ($a == 3)
|
||||
{
|
||||
echo "Building doesn't have that technology, or you already have it";
|
||||
return;
|
||||
}
|
||||
|
||||
redirect('building/research/' . $slotid);
|
||||
|
||||
}
|
||||
}
|
||||
//nowhitesp
|
78
Mourne-CI/application/controllers/changelog.php
Executable file
78
Mourne-CI/application/controllers/changelog.php
Executable file
@ -0,0 +1,78 @@
|
||||
<?php
|
||||
|
||||
class Changelog extends MO_Controller
|
||||
{
|
||||
|
||||
function __construct()
|
||||
{
|
||||
parent::__construct();
|
||||
}
|
||||
|
||||
function show()
|
||||
{
|
||||
$this->load->model('changelog_model');
|
||||
|
||||
$data['versions'] = $this->changelog_model->get_versions();
|
||||
$data['commits'] = $this->changelog_model->get_commits();
|
||||
$data['userlevel'] = $this->userlevel;
|
||||
$data['required_userlevel'] = 4;
|
||||
|
||||
$this->headers();
|
||||
$this->load->view('changelog/changelog', $data);
|
||||
$this->footer();
|
||||
}
|
||||
|
||||
function add_new_version()
|
||||
{
|
||||
if (!$this->userlevel > 4)
|
||||
show404();
|
||||
|
||||
$this->load->library('form_validation');
|
||||
|
||||
$this->form_validation->set_rules('text', 'Text', 'required');
|
||||
|
||||
if (!$this->form_validation->run())
|
||||
{
|
||||
$this->load->view('changelog/new_version');
|
||||
}
|
||||
else
|
||||
{
|
||||
$this->load->model('changelog_model');
|
||||
|
||||
$text = $this->input->post('text');
|
||||
$this->changelog_model->new_version($text);
|
||||
|
||||
$this->load->helper('url');
|
||||
redirect('changelog/show');
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
function add_new_commit()
|
||||
{
|
||||
if (!$this->userlevel > 4)
|
||||
show404();
|
||||
|
||||
$this->load->library('form_validation');
|
||||
|
||||
$this->form_validation->set_rules('text', 'Text', 'required');
|
||||
|
||||
if (!$this->form_validation->run())
|
||||
{
|
||||
$this->load->view('changelog/new_commit');
|
||||
}
|
||||
else
|
||||
{
|
||||
$this->load->model('changelog_model');
|
||||
|
||||
$text = $this->input->post('text');
|
||||
$this->changelog_model->new_commit($text);
|
||||
|
||||
$this->load->helper('url');
|
||||
redirect('changelog/show');
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
//nowhitesp
|
23
Mourne-CI/application/controllers/cron.php
Executable file
23
Mourne-CI/application/controllers/cron.php
Executable file
@ -0,0 +1,23 @@
|
||||
<?php
|
||||
class Cron extends CI_Controller
|
||||
{
|
||||
//no session stuff needed for this class, so it extends from CI_Controller.
|
||||
|
||||
function __construct()
|
||||
{
|
||||
parent::__construct();
|
||||
}
|
||||
|
||||
function aiattack()
|
||||
{
|
||||
//check for useragent and stuff like that
|
||||
|
||||
$this->load->model('ai_model');
|
||||
|
||||
$a = $this->ai_model->attack();
|
||||
|
||||
echo $a;
|
||||
}
|
||||
|
||||
}
|
||||
//nowhitesp
|
20
Mourne-CI/application/controllers/forum.php
Executable file
20
Mourne-CI/application/controllers/forum.php
Executable file
@ -0,0 +1,20 @@
|
||||
<?php
|
||||
|
||||
class Forum extends MO_Controller
|
||||
{
|
||||
function __construct()
|
||||
{
|
||||
parent::__construct();
|
||||
}
|
||||
|
||||
function index()
|
||||
{
|
||||
$this->headers('forum');
|
||||
|
||||
$this->load->view('forum/notimpl');
|
||||
|
||||
$this->footer();
|
||||
}
|
||||
|
||||
}
|
||||
//nowhitesp
|
17
Mourne-CI/application/controllers/gm.php
Executable file
17
Mourne-CI/application/controllers/gm.php
Executable file
@ -0,0 +1,17 @@
|
||||
<?php
|
||||
|
||||
class Gm extends MO_Controller
|
||||
{
|
||||
function __construct()
|
||||
{
|
||||
parent::__construct();
|
||||
}
|
||||
|
||||
function gm_panel()
|
||||
{
|
||||
$this->headers('gm');
|
||||
|
||||
$this->footer();
|
||||
}
|
||||
}
|
||||
//nowhitesp
|
213
Mourne-CI/application/controllers/hero.php
Executable file
213
Mourne-CI/application/controllers/hero.php
Executable file
@ -0,0 +1,213 @@
|
||||
<?php
|
||||
|
||||
class Hero extends MO_Controller
|
||||
{
|
||||
function __construct()
|
||||
{
|
||||
parent::__construct('hero');
|
||||
}
|
||||
|
||||
function index()
|
||||
{
|
||||
$this->load->helper('url');
|
||||
redirect('hero/selected');
|
||||
}
|
||||
|
||||
function selected($page = 'stats', $d1 = FALSE, $d2 = FALSE, $d3 = FALSE, $d4 = FALSE)
|
||||
{
|
||||
$this->headers('hero');
|
||||
|
||||
if ($page != 'stats' && $page != 'inventory' && $page != 'talents' && $page != 'spells' &&
|
||||
$page != 'actionbars')
|
||||
{
|
||||
$page = 'stats';
|
||||
}
|
||||
|
||||
$this->load->view('hero/hero_menu');
|
||||
|
||||
if ($page == 'stats')
|
||||
{
|
||||
$data['hero'] = $this->hero;
|
||||
|
||||
$data['hpp'] = floor(($this->hero['health'] / $this->hero['max_health']) * 100);
|
||||
$data['mpp'] = floor(($this->hero['mana'] / $this->hero['max_mana']) * 100);
|
||||
$data['exp'] = floor(($this->hero['experience'] /1000) * 100);
|
||||
|
||||
//STUB!
|
||||
$data['experience'] = 10000;
|
||||
|
||||
$this->load->view('hero/stats', $data);
|
||||
}
|
||||
elseif ($page == 'inventory')
|
||||
{
|
||||
$this->load->model('item_model');
|
||||
|
||||
if ($d1 !== FALSE && $d2 !== FALSE && $d3 !== FALSE && $d4 !== FALSE)
|
||||
{
|
||||
$this->item_model->set_hero($this->hero);
|
||||
|
||||
$res['message'] = $this->item_model->swap($d1, $d2, $d3, $d4);
|
||||
|
||||
if ($res['message'] === TRUE)
|
||||
$this->hero = $this->item_model->get_hero();
|
||||
|
||||
$d1 = FALSE;
|
||||
$d2 = FALSE;
|
||||
//we doesn't care about d3,d4 that isn't used in views
|
||||
}
|
||||
|
||||
|
||||
$data = $this->item_model->get_inventory($this->hero['id']);
|
||||
|
||||
$data['hero'] = $this->hero;
|
||||
|
||||
$data['d1'] = $d1;
|
||||
$data['d2'] = $d2;
|
||||
|
||||
$res['inventory'] = $this->load->view('hero/inventory', $data, TRUE);
|
||||
$res['equipment'] = $this->load->view('hero/character', $data, TRUE);
|
||||
|
||||
$this->load->view('hero/inventory_view', $res);
|
||||
}
|
||||
elseif ($page == 'talents')
|
||||
{
|
||||
}
|
||||
elseif ($page == 'spells')
|
||||
{
|
||||
}
|
||||
elseif ($page == 'actionbars')
|
||||
{
|
||||
}
|
||||
|
||||
$this->footer();
|
||||
}
|
||||
|
||||
function create()
|
||||
{
|
||||
$this->load->library('form_validation');
|
||||
|
||||
$this->form_validation->set_rules('name', 'Name', 'required|alpha|callback_chhn');
|
||||
$this->form_validation->set_rules('gender', 'Gender', 'required|greater_than[0]|less_than[3]|integer');
|
||||
//less than!
|
||||
$this->form_validation->set_rules('class', 'Class', 'required|integer|greater_than[0]|less_than[10]');
|
||||
|
||||
if (!$this->form_validation->run())
|
||||
{
|
||||
$this->headers('hero', 1);
|
||||
|
||||
$this->load->view('hero/create');
|
||||
|
||||
$this->footer();
|
||||
}
|
||||
else
|
||||
{
|
||||
$this->load->model('hero_model');
|
||||
|
||||
$data['name'] = $this->input->post('name');
|
||||
$data['gender'] = $this->input->post('gender');
|
||||
$data['class'] = $this->input->post('class');
|
||||
|
||||
$this->hero_model->create($data, $this->userid);
|
||||
|
||||
$this->load->helper('url');
|
||||
redirect('hero/selected');
|
||||
}
|
||||
}
|
||||
|
||||
function select()
|
||||
{
|
||||
$this->load->model('hero_model');
|
||||
$this->load->library('form_validation');
|
||||
|
||||
$this->form_validation->set_rules('heroid', 'Heroid', 'required');
|
||||
|
||||
if (!$this->form_validation->run())
|
||||
{
|
||||
$this->headers('hero');
|
||||
|
||||
$data['heroes'] = $this->hero_model->get_heroes($this->userid);
|
||||
|
||||
$this->load->view('hero/select', $data);
|
||||
|
||||
$this->footer();
|
||||
}
|
||||
else
|
||||
{
|
||||
$heroid = $this->input->post('heroid');
|
||||
|
||||
$this->hero_model->select_hero($heroid, $this->userid);
|
||||
|
||||
$this->load->helper('url');
|
||||
redirect('hero/selected');
|
||||
}
|
||||
}
|
||||
|
||||
function delete($id = FALSE)
|
||||
{
|
||||
$this->load->helper('url');
|
||||
|
||||
if (!$id || !is_numeric($id))
|
||||
redirect('hero/select');
|
||||
|
||||
$this->load->model('hero_model');
|
||||
$this->load->library('form_validation');
|
||||
|
||||
$this->form_validation->set_rules('confirm', 'Confirm', 'required|callback_delete_check');
|
||||
|
||||
if (!$this->form_validation->run())
|
||||
{
|
||||
$data['id'] = $id;
|
||||
$data['hero'] = $this->hero_model->get_hero($id, $this->userid);
|
||||
|
||||
if (!$data['hero'])
|
||||
redirect('hero/select');
|
||||
|
||||
$this->headers('hero');
|
||||
|
||||
$this->load->view('hero/delete_confirm', $data);
|
||||
|
||||
$this->footer();
|
||||
}
|
||||
else
|
||||
{
|
||||
$this->hero_model->delete_hero($id, $this->userid);
|
||||
|
||||
redirect('hero/select');
|
||||
}
|
||||
}
|
||||
|
||||
function addstat()
|
||||
{
|
||||
//hero's stat view calls this with a form the hidden field's name is attrid
|
||||
//1 agi, 2 str, 3 stam, 4 int, 5 spirit
|
||||
}
|
||||
|
||||
function chhn($name)
|
||||
{
|
||||
$this->load->model('hero_model');
|
||||
|
||||
$a = $this->hero_model->hero_name_is_unique($name);
|
||||
|
||||
if (!$a)
|
||||
{
|
||||
$this->form_validation->set_message('chhn', 'Name already taken.');
|
||||
return FALSE;
|
||||
}
|
||||
else
|
||||
{
|
||||
return TRUE;
|
||||
}
|
||||
}
|
||||
|
||||
function delete_check($chk)
|
||||
{
|
||||
if ($chk == "DELETE")
|
||||
return TRUE;
|
||||
|
||||
$this->form_validation->set_message('delete_check', 'You have to spell DELETE, exactly, and uppercase.');
|
||||
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
}
|
||||
//nowhitesp
|
10
Mourne-CI/application/controllers/index.html
Executable file
10
Mourne-CI/application/controllers/index.html
Executable file
@ -0,0 +1,10 @@
|
||||
<html>
|
||||
<head>
|
||||
<title>403 Forbidden</title>
|
||||
</head>
|
||||
<body>
|
||||
|
||||
<p>Directory access is forbidden.</p>
|
||||
|
||||
</body>
|
||||
</html>
|
164
Mourne-CI/application/controllers/mail.php
Executable file
164
Mourne-CI/application/controllers/mail.php
Executable file
@ -0,0 +1,164 @@
|
||||
<?php
|
||||
|
||||
class Mail extends MO_Controller
|
||||
{
|
||||
function __construct()
|
||||
{
|
||||
parent::__construct();
|
||||
}
|
||||
|
||||
function index()
|
||||
{
|
||||
$this->load->helper('url');
|
||||
redirect('mail/inbox');
|
||||
}
|
||||
|
||||
function inbox()
|
||||
{
|
||||
$this->headers('mail');
|
||||
|
||||
$this->load->model('mail_model');
|
||||
|
||||
$data['mails'] = $this->mail_model->get_inbox($this->userid, $this->new_mail);
|
||||
|
||||
$this->load->view('mail/inbox', $data);
|
||||
|
||||
$this->footer();
|
||||
}
|
||||
|
||||
function compose($id = 0)
|
||||
{
|
||||
$this->headers('mail');
|
||||
$this->load->model('mail_model');
|
||||
$this->load->library('form_validation');
|
||||
|
||||
$d['draft'] = FALSE;
|
||||
|
||||
if ($id && is_numeric($id))
|
||||
{
|
||||
$d['draft'] = $this->mail_model->get_draft($id, $this->userid);
|
||||
}
|
||||
|
||||
$this->form_validation->set_rules('name', 'Username', 'required');
|
||||
$this->form_validation->set_rules('subject', 'Subject', 'required');
|
||||
$this->form_validation->set_rules('message', 'Message', 'required');
|
||||
|
||||
if (!$this->form_validation->run())
|
||||
{
|
||||
$this->load->view('mail/new', $d);
|
||||
}
|
||||
else
|
||||
{
|
||||
$send = $this->input->post('send');
|
||||
$draft = $this->input->post('draft');
|
||||
|
||||
$data['name'] = $this->input->post('name');
|
||||
$data['subject'] = $this->input->post('subject');
|
||||
$data['message'] = $this->input->post('message');
|
||||
|
||||
if ($send)
|
||||
{
|
||||
$this->mail_model->send_message($data, $this->userid);
|
||||
}
|
||||
else
|
||||
{
|
||||
$this->mail_model->save_draft($data, $this->userid);
|
||||
}
|
||||
}
|
||||
|
||||
$this->footer();
|
||||
}
|
||||
|
||||
function del_draft($id = 0)
|
||||
{
|
||||
if ($id && is_numeric($id))
|
||||
{
|
||||
$this->load->model("mail_model");
|
||||
$this->mail_model->delete_draft($id, $this->userid);
|
||||
}
|
||||
|
||||
$this->load->helper('url');
|
||||
redirect('mail/drafts');
|
||||
}
|
||||
|
||||
function drafts()
|
||||
{
|
||||
$this->load->model('mail_model');
|
||||
|
||||
$this->headers('mail');
|
||||
|
||||
$data['mails'] = $this->mail_model->get_drafts($this->userid);
|
||||
|
||||
$this->load->view('mail/drafts', $data);
|
||||
|
||||
$this->footer();
|
||||
}
|
||||
|
||||
function read($id = 0)
|
||||
{
|
||||
if (!$id || !is_numeric($id))
|
||||
{
|
||||
$this->load->helper('url');
|
||||
redirect('mail/inbox');
|
||||
}
|
||||
|
||||
$this->load->model('mail_model');
|
||||
|
||||
$this->headers('mail');
|
||||
|
||||
$data['mail'] = $this->mail_model->get_mail($id, $this->userid);
|
||||
|
||||
$this->load->view('mail/read', $data);
|
||||
|
||||
$this->footer();
|
||||
|
||||
}
|
||||
|
||||
function sent()
|
||||
{
|
||||
$this->headers('mail');
|
||||
|
||||
$this->load->model('mail_model');
|
||||
|
||||
$data['mails'] = $this->mail_model->get_all_sent($this->userid);
|
||||
|
||||
$this->load->view('mail/sent', $data);
|
||||
|
||||
$this->footer();
|
||||
}
|
||||
|
||||
function sread($id = 0)
|
||||
{
|
||||
if (!$id || !is_numeric($id))
|
||||
{
|
||||
$this->load->helper('url');
|
||||
redirect('mail/inbox');
|
||||
}
|
||||
|
||||
$this->load->model('mail_model');
|
||||
|
||||
$this->headers('mail');
|
||||
|
||||
$data['mail'] = $this->mail_model->get_sent($id, $this->userid);
|
||||
|
||||
$this->load->view('mail/sread', $data);
|
||||
|
||||
$this->footer();
|
||||
|
||||
}
|
||||
|
||||
function friends()
|
||||
{
|
||||
$this->headers('mail');
|
||||
|
||||
$this->footer();
|
||||
}
|
||||
}
|
||||
//nowhitesp
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
68
Mourne-CI/application/controllers/news.php
Executable file
68
Mourne-CI/application/controllers/news.php
Executable file
@ -0,0 +1,68 @@
|
||||
<?php
|
||||
|
||||
class News extends MO_Controller
|
||||
{
|
||||
public function index($page = 1)
|
||||
{
|
||||
if (!$this->check_login()) return;
|
||||
|
||||
$this->load->model('news_model');
|
||||
|
||||
$data['admin'] = FALSE;
|
||||
|
||||
if ($this->userlevel > 3)
|
||||
{
|
||||
$data['admin'] = TRUE;
|
||||
}
|
||||
|
||||
$data['news'] = $this->news_model->get_news($page);
|
||||
|
||||
$this->headers();
|
||||
$this->load->view('news/news', $data);
|
||||
$this->footer();
|
||||
}
|
||||
|
||||
public function add()
|
||||
{
|
||||
if ($this->userlevel < 3) show_404();
|
||||
|
||||
$this->load->library('form_validation');
|
||||
|
||||
$this->form_validation->set_rules('text', 'Text', 'required');
|
||||
|
||||
if (!$this->form_validation->run())
|
||||
{
|
||||
|
||||
$this->load->helper(array('form', 'url'));
|
||||
|
||||
$this->headers();
|
||||
$this->load->view('news/add');
|
||||
$this->footer();
|
||||
}
|
||||
else
|
||||
{
|
||||
$this->load->model('news_model');
|
||||
|
||||
if ($this->news_model->add_news($this->input->post('text'), $this->username))
|
||||
{
|
||||
$this->load->view('news/add_success');
|
||||
}
|
||||
else
|
||||
{
|
||||
$this->load->view('db_error');
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public function delete($nid)
|
||||
{
|
||||
if (!$this->userlevel < 3) show_404();
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
//nowhitesp
|
139
Mourne-CI/application/controllers/user.php
Executable file
139
Mourne-CI/application/controllers/user.php
Executable file
@ -0,0 +1,139 @@
|
||||
<?php
|
||||
|
||||
class User extends MO_Controller
|
||||
{
|
||||
|
||||
function __construct()
|
||||
{
|
||||
parent::__construct();
|
||||
}
|
||||
|
||||
function login()
|
||||
{
|
||||
$this->load->helper(array('form', 'url'));
|
||||
$this->load->library('form_validation');
|
||||
|
||||
//is_unique[users.username]
|
||||
|
||||
//xss_validation
|
||||
|
||||
//TODO figure rules out
|
||||
$this->form_validation->set_rules('username', 'Username',
|
||||
'required');
|
||||
|
||||
//password callback -> $this->input->post('username'), after xss filter
|
||||
$this->form_validation->set_rules('password', 'Password',
|
||||
'required|callback_login_check');
|
||||
|
||||
if ($this->form_validation->run() == FALSE)
|
||||
{
|
||||
$this->load->view('login/login');
|
||||
}
|
||||
else
|
||||
{
|
||||
$this->load->helper('url');
|
||||
redirect('news/index');
|
||||
//$this->load->view('login/success');
|
||||
}
|
||||
}
|
||||
|
||||
function register()
|
||||
{
|
||||
$this->load->helper(array('form', 'url'));
|
||||
$this->load->library('form_validation');
|
||||
|
||||
//is_unique[users.username]
|
||||
//xss_clean
|
||||
$this->form_validation->set_rules('username', 'Username',
|
||||
'required|min_length[4]|max_length[32]|callback_register_username_check');
|
||||
|
||||
$this->form_validation->set_rules('password', 'Password',
|
||||
'required|min_length[5]|matches[password_check]');
|
||||
|
||||
$this->form_validation->set_rules('password_check', 'Password check', 'required');
|
||||
$this->form_validation->set_rules('email', 'Email', 'required|valid_email|matches[email_check]');
|
||||
$this->form_validation->set_rules('email_check', 'Email_check', 'required');
|
||||
//$this->form_validation->set_rules('license', 'License', 'required');
|
||||
|
||||
if ($this->form_validation->run() == FALSE)
|
||||
{
|
||||
$this->load->view('register/register');
|
||||
}
|
||||
else
|
||||
{
|
||||
if ($this->register_write())
|
||||
{
|
||||
$this->load->view('register/success');
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function logout()
|
||||
{
|
||||
$this->session->unset_userdata('userid');
|
||||
|
||||
$this->load->helper('url');
|
||||
redirect('user/login');
|
||||
|
||||
//TODO make it look cool
|
||||
//$this->load->view('redirect_to_login');
|
||||
}
|
||||
|
||||
function register_username_check($attr)
|
||||
{
|
||||
$this->load->model('user_model');
|
||||
|
||||
if ($this->user_model->reg_username_check($attr))
|
||||
{
|
||||
return TRUE;
|
||||
}
|
||||
else
|
||||
{
|
||||
$this->form_validation->set_message('register_username_check', 'Username already exists!');
|
||||
return FALSE;
|
||||
}
|
||||
}
|
||||
|
||||
function register_write()
|
||||
{
|
||||
$data['username'] = $this->input->post('username');
|
||||
$data['password'] = md5($this->input->post('password'));
|
||||
$data['email'] = $this->input->post('email');
|
||||
|
||||
$this->load->model('user_model');
|
||||
|
||||
return $this->user_model->reg_write($data);
|
||||
}
|
||||
|
||||
function login_check($attr)
|
||||
{
|
||||
$data['username'] = $this->input->post('username');
|
||||
$data['password'] = md5($attr);
|
||||
|
||||
$this->load->model('user_model');
|
||||
|
||||
if ($this->user_model->login_check($data))
|
||||
{
|
||||
$this->session->set_userdata('userid',
|
||||
$this->user_model->get_userid($data['username']));
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
else
|
||||
{
|
||||
return FALSE;
|
||||
}
|
||||
}
|
||||
|
||||
function settings()
|
||||
{
|
||||
$this->headers('settings');
|
||||
|
||||
|
||||
|
||||
$this->footer();
|
||||
}
|
||||
|
||||
}//login class
|
||||
|
||||
//nowhitesp
|
262
Mourne-CI/application/controllers/village.php
Executable file
262
Mourne-CI/application/controllers/village.php
Executable file
@ -0,0 +1,262 @@
|
||||
<?php
|
||||
|
||||
class Village extends MO_Controller
|
||||
{
|
||||
function __construct()
|
||||
{
|
||||
parent::__construct();
|
||||
}
|
||||
|
||||
function index()
|
||||
{
|
||||
$this->load->helper('url');
|
||||
redirect('village/selected');
|
||||
}
|
||||
|
||||
//function for testing, this will be handled when registering, and with npcs
|
||||
function create_village()
|
||||
{
|
||||
$this->load->model('village_model');
|
||||
|
||||
$this->village_model->create_village($this->userid, $this->username);
|
||||
}
|
||||
|
||||
function selected()
|
||||
{
|
||||
$this->load->model('village_model');
|
||||
|
||||
$this->headers('village');
|
||||
|
||||
$build['buildings'] = $this->village_model->get_buildings($this->villageid);
|
||||
|
||||
$event['event'] = $this->_filter_events('next', 'all');
|
||||
|
||||
$this->load->view('village/next_event', $event);
|
||||
$this->load->view('village/grid', $build);
|
||||
$this->footer();
|
||||
}
|
||||
|
||||
function map($x = FALSE, $y = FALSE)
|
||||
{
|
||||
$this->load->model('map_model');
|
||||
$action = $this->input->post('action');
|
||||
|
||||
if ($action == 'xy')
|
||||
{
|
||||
$px = $this->input->post('x');
|
||||
$py = $this->input->post('y');
|
||||
|
||||
if (is_numeric($px) && is_numeric($py))
|
||||
{
|
||||
$x = $px;
|
||||
$y = $py;
|
||||
}
|
||||
|
||||
}
|
||||
elseif ($action == 'name')
|
||||
{
|
||||
$name = $this->input->post('name');
|
||||
|
||||
$rep = array(';', "\"", "'", ',', '(', ')');
|
||||
|
||||
$name = str_replace($rep, ' ', $name);
|
||||
|
||||
if ($name)
|
||||
{
|
||||
$co = $this->map_model->get_village_by_name($name);
|
||||
|
||||
if ($co)
|
||||
{
|
||||
$x = $co['X'];
|
||||
$y = $co['Y'];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
$this->load->model('map_model');
|
||||
|
||||
if (!$x && !$y)
|
||||
{
|
||||
$coords = $this->map_model->get_village_coords($this->villageid);
|
||||
$x = $coords['X'];
|
||||
$y = $coords['Y'];
|
||||
}
|
||||
else
|
||||
{
|
||||
if ($x < 7)
|
||||
$x = 7;
|
||||
|
||||
if ($y < 7)
|
||||
$y = 7;
|
||||
|
||||
if ($x > 235)
|
||||
$x = 235;
|
||||
|
||||
if ($y > 235)
|
||||
$y = 235;
|
||||
}
|
||||
|
||||
$data['x'] = $x;
|
||||
$data['y'] = $y;
|
||||
$data['map'] = $this->map_model->get_map($x, $y);
|
||||
|
||||
$this->headers('village');
|
||||
|
||||
$this->load->view('village/map', $data);
|
||||
|
||||
$this->footer();
|
||||
}
|
||||
|
||||
function units()
|
||||
{
|
||||
$this->load->model('unit_model');
|
||||
|
||||
$data['units'] = $this->unit_model->get_village_units($this->villageid);
|
||||
|
||||
$this->headers('village');
|
||||
|
||||
$this->load->view('village/units', $data);
|
||||
|
||||
$this->footer();
|
||||
}
|
||||
|
||||
function log($action = 'list', $id = 0)
|
||||
{
|
||||
if ($action != 'list' && $action != 'view' && $action != 'delete')
|
||||
$action = 'list';
|
||||
|
||||
if (!is_numeric($id))
|
||||
{
|
||||
$action = 'list';
|
||||
$id = 0;
|
||||
}
|
||||
|
||||
$this->load->model('log_model');
|
||||
|
||||
if ($action == 'list')
|
||||
{
|
||||
$this->headers('village');
|
||||
|
||||
$data['logs'] = $this->log_model->get_combat_logs($this->villageid);
|
||||
$this->load->view('village/log/list', $data);
|
||||
|
||||
$this->footer();
|
||||
}
|
||||
|
||||
if ($action == 'view')
|
||||
{
|
||||
$this->headers('village');
|
||||
|
||||
$data['log'] = $this->log_model->get_combat_log($id, $this->villageid);
|
||||
$this->load->view('village/log/combat', $data);
|
||||
|
||||
$this->footer();
|
||||
}
|
||||
|
||||
if ($action == 'delete')
|
||||
{
|
||||
$this->log_model->delete_combat_log($id, $this->villageid);
|
||||
|
||||
$this->load->helper('url');
|
||||
redirect('village/log');
|
||||
}
|
||||
}
|
||||
|
||||
function select()
|
||||
{
|
||||
$this->load->model('village_model');
|
||||
$this->load->library('form_validation');
|
||||
|
||||
$this->form_validation->set_rules('id', 'ID', 'is_natural|required');
|
||||
|
||||
if (!$this->form_validation->run())
|
||||
{
|
||||
$this->headers('village');
|
||||
|
||||
$data['villages'] = $this->village_model->get_villages($this->userid);
|
||||
|
||||
$this->load->view('village/select', $data);
|
||||
|
||||
$this->footer();
|
||||
}
|
||||
else
|
||||
{
|
||||
$id = $this->input->post('id');
|
||||
|
||||
$this->village_model->select_village($id, $this->userid);
|
||||
|
||||
$this->load->helper('url');
|
||||
redirect('village/selected');
|
||||
}
|
||||
}
|
||||
|
||||
function events()
|
||||
{
|
||||
$this->headers('village');
|
||||
|
||||
$data['event'] = $this->_filter_events('all', 'all');
|
||||
|
||||
$this->load->view('village/events', $data);
|
||||
|
||||
$this->footer();
|
||||
}
|
||||
|
||||
function settings($id = 0)
|
||||
{
|
||||
$this->load->model('village_model');
|
||||
|
||||
if (!is_numeric($id) || !$id)
|
||||
{
|
||||
$this->load->heper('url');
|
||||
redirect('village/selected');
|
||||
}
|
||||
|
||||
$village = $this->village_model->get_village($id);
|
||||
|
||||
if ($village['userid'] != $this->userid)
|
||||
{
|
||||
$this->load->heper('url');
|
||||
redirect('village/selected');
|
||||
}
|
||||
|
||||
$this->load->library('form_validation');
|
||||
|
||||
$this->form_validation->set_rules('name', 'Name',
|
||||
'required|alpha|is_unique[ai_villages.name]');
|
||||
|
||||
if (!$this->form_validation->run())
|
||||
{
|
||||
$this->headers('village');
|
||||
|
||||
$data['id'] = $id;
|
||||
$data['village'] = $village;
|
||||
|
||||
$this->load->view('village/settings', $data);
|
||||
$this->footer();
|
||||
}
|
||||
else
|
||||
{
|
||||
$data['id'] = $id;
|
||||
$name = $this->input->post('name');
|
||||
$data['ai'] = $this->input->post('ai');
|
||||
|
||||
$data['name'] = ucfirst(strtolower($name));
|
||||
|
||||
$this->village_model->apply_settings($data);
|
||||
|
||||
$this->load->helper('url');
|
||||
redirect('village/select');
|
||||
}
|
||||
}
|
||||
|
||||
function event_update()
|
||||
{
|
||||
//TODO for ajax, but maybe it will be solved with APE
|
||||
}
|
||||
|
||||
function list_all()
|
||||
{
|
||||
}
|
||||
|
||||
}
|
||||
//nowhitesp
|
430
Mourne-CI/application/core/MO_Controller.php
Executable file
430
Mourne-CI/application/core/MO_Controller.php
Executable file
@ -0,0 +1,430 @@
|
||||
<?php
|
||||
|
||||
class MO_Controller extends CI_Controller
|
||||
{
|
||||
public $userid;
|
||||
public $username;
|
||||
public $language;
|
||||
public $userlevel;
|
||||
public $villageid;
|
||||
public $village_name;
|
||||
public $resources;
|
||||
public $events;
|
||||
public $building;
|
||||
public $village_data;
|
||||
public $weather;
|
||||
|
||||
//hero stuff
|
||||
public $hero;
|
||||
|
||||
public $new_mail;
|
||||
public $new_log;
|
||||
|
||||
|
||||
function __construct($page = 'village')
|
||||
{
|
||||
parent::__construct();
|
||||
$this->weather = FALSE;
|
||||
$this->resources = FALSE;
|
||||
$this->hero = FALSE;
|
||||
|
||||
$this->_manage_session($page);
|
||||
}
|
||||
|
||||
public function _manage_session($page)
|
||||
{
|
||||
$this->userid = 0;
|
||||
|
||||
//this should be solved with db!
|
||||
// if (!$this->session->userdata('language'))
|
||||
// $this->session->set_userdata('language', 'english');
|
||||
|
||||
// $this->language = $this->session->userdata('language');
|
||||
|
||||
$this->language = 'english';
|
||||
|
||||
if ($this->session->userdata('userid'))
|
||||
$this->userid = $this->session->userdata('userid');
|
||||
|
||||
$this->load->model('mo_common_model');
|
||||
|
||||
if ($this->userid)
|
||||
{
|
||||
$data = $this->mo_common_model->get_userdata($this->userid);
|
||||
|
||||
$this->userlevel = $data['userlevel'];
|
||||
$this->username = $data['username'];
|
||||
$this->new_mail = $data['new_mail'];
|
||||
|
||||
if ($page == 'village')
|
||||
{
|
||||
$mdata = $this->mo_common_model->get_village_data($this->userid);
|
||||
|
||||
$this->villageid = $mdata['id'];
|
||||
$this->villagename = $mdata['name'];
|
||||
$this->new_log = $mdata['new_log'];
|
||||
|
||||
$this->village_data = $mdata;
|
||||
}
|
||||
|
||||
if ($page == 'hero')
|
||||
{
|
||||
$this->hero = $this->mo_common_model->get_hero_data($this->userid);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public function check_login()
|
||||
{
|
||||
if ($this->userid == 0)
|
||||
{
|
||||
$this->load->helper('url');
|
||||
redirect('user/login');
|
||||
}
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
public function headers($page = 'village', $slotid = 0)
|
||||
{
|
||||
$data['username'] = $this->username;
|
||||
$data['userid'] = $this->userid;
|
||||
$data['userlevel'] = $this->userlevel;
|
||||
$data['newmail'] = $this->new_mail;
|
||||
$data['page'] = $page;
|
||||
|
||||
if ($page != 'hero')
|
||||
{
|
||||
$data['villagename'] = $this->villagename;
|
||||
$data['newlog'] = $this->new_log;
|
||||
|
||||
if ($page == 'building' || $page == 'village' || $page == 'build' || $page == 'build_in_progress' ||
|
||||
$page == 'mail')
|
||||
{
|
||||
$this->_update();
|
||||
}
|
||||
|
||||
//this has to be done like this, since this function will redirect if nothing in the slot
|
||||
if ($page == 'building')
|
||||
$this->_get_slot_building($slotid);
|
||||
|
||||
if ($page != 'do')
|
||||
{
|
||||
$data['weather'] = $this->weather;
|
||||
$data['resources'] = $this->_prep_res_js();
|
||||
$this->load->view('parts/header', $data);
|
||||
$this->load->view('menu', $data);
|
||||
$this->load->view('parts/js_res', $data);
|
||||
}
|
||||
|
||||
if ($page == 'building' || $page == 'village' || $page == 'build' || $page == 'build_in_progress' ||
|
||||
$page == 'mail')
|
||||
{
|
||||
$res['res'] = $this->resources;
|
||||
$this->load->view('village/resources', $res);
|
||||
}
|
||||
|
||||
if ($page == 'mail')
|
||||
{
|
||||
$this->load->view('mail/menu');
|
||||
}
|
||||
|
||||
if ($page == 'village')
|
||||
{
|
||||
$this->load->view('village/menu');
|
||||
}
|
||||
|
||||
if ($page == 'building')
|
||||
{
|
||||
$data['building'] = $this->building;
|
||||
$data['slotid'] = $slotid;
|
||||
|
||||
$this->load->view('building/header', $data);
|
||||
$this->load->view('building/menu', $data);
|
||||
}
|
||||
|
||||
if ($page == 'do')
|
||||
{
|
||||
$this->_update();
|
||||
|
||||
if ($slotid)
|
||||
$this->_get_slot_building($slotid);
|
||||
}
|
||||
}
|
||||
elseif ($page == 'hero')
|
||||
{
|
||||
if (!$this->hero && !$slotid)
|
||||
{
|
||||
$this->load->helper('url');
|
||||
redirect('hero/create');
|
||||
return;
|
||||
}
|
||||
|
||||
$data['hero'] = $this->hero;
|
||||
$data['weather'] = FALSE;
|
||||
$data['resources'] = FALSE;
|
||||
$this->load->view('parts/header', $data);
|
||||
$this->load->view('menu', $data);
|
||||
$this->load->view('hero/menu', $data);
|
||||
}
|
||||
}
|
||||
|
||||
public function _get_slot_building($slotid = 0)
|
||||
{
|
||||
if (!$slotid)
|
||||
return;
|
||||
|
||||
if ($this->building)
|
||||
return;
|
||||
|
||||
$this->load->model('building_model');
|
||||
$this->building = $this->building_model->get_slot_building($slotid, $this->villageid);
|
||||
|
||||
//this is commented out, because get_slot_building cannot return FALSE lol
|
||||
// if (!$this->building)
|
||||
// {
|
||||
// $this->load->helper('url');
|
||||
// redirect('village/selected');
|
||||
//}
|
||||
}
|
||||
|
||||
public function _get_resources()
|
||||
{
|
||||
if ($this->resources)
|
||||
return;
|
||||
|
||||
$this->load->model('resource_model');
|
||||
$this->resources = $this->resource_model->get_resources($this->villageid);
|
||||
}
|
||||
|
||||
public function _update()
|
||||
{
|
||||
$this->load->model('event_model');
|
||||
|
||||
if ($this->resources || $this->events || $this->weather)
|
||||
return;
|
||||
|
||||
//event model returns resources, and events, and weather
|
||||
$data = $this->event_model->update($this->village_data, TRUE);
|
||||
|
||||
$this->resources = $data['resources'];
|
||||
$this->events = $data['events'];
|
||||
$this->weather = $data['weather'];
|
||||
}
|
||||
|
||||
public function footer()
|
||||
{
|
||||
$this->load->view('parts/footer');
|
||||
}
|
||||
|
||||
/*
|
||||
filter events, based on type and filter, and order it ASC
|
||||
type -> 'next', 'type', 'all'
|
||||
if type == 'type' you have to provide an event type
|
||||
filter -> 'all', 'slot'
|
||||
if filter == 'slot' you have to provide slotid
|
||||
next -> TRUE/FALSE
|
||||
only return the next event, this is here, so every type can be asked to return the next one
|
||||
this is primarily here, so when events like EVENT_BUILD needed, since there aren't going to be 2
|
||||
*/
|
||||
|
||||
public function _filter_events($type, $filter, $slotid = 0, $ev_type = 0, $next = FALSE)
|
||||
{
|
||||
//means no events
|
||||
if (!$this->events)
|
||||
return FALSE;
|
||||
|
||||
$data = FALSE;
|
||||
|
||||
if ($type == 'all')
|
||||
{
|
||||
if ($filter == 'slot')
|
||||
{
|
||||
foreach ($this->events as $row)
|
||||
{
|
||||
if ($row['slotid'] == $slotid)
|
||||
{
|
||||
$data[] = $row;
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
$data = $this->events;
|
||||
}
|
||||
}
|
||||
|
||||
if ($type == 'type')
|
||||
{
|
||||
if ($filter == 'all')
|
||||
{
|
||||
foreach ($this->events as $row)
|
||||
{
|
||||
if ($row['type'] == $ev_type)
|
||||
{
|
||||
$data[] = $row;
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
foreach ($this->events as $row)
|
||||
{
|
||||
if ($row['type'] == $ev_type && $row['slotid'] == $slotid)
|
||||
{
|
||||
$data[] = $row;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if ($type == 'next')
|
||||
{
|
||||
if ($filter == 'all')
|
||||
{
|
||||
$last_end = 99999999999;
|
||||
$smallest = FALSE;
|
||||
foreach ($this->events as $row)
|
||||
{
|
||||
if ($row['end'] < $last_end)
|
||||
{
|
||||
$last_end = $row['end'];
|
||||
$smallest = $row;
|
||||
}
|
||||
}
|
||||
|
||||
return $smallest;
|
||||
}
|
||||
else
|
||||
{
|
||||
$last_end = 99999999999;
|
||||
$smallest = FALSE;
|
||||
foreach ($this->events as $row)
|
||||
{
|
||||
if ($row['end'] < $last_end && $row['slotid'] == $slotid)
|
||||
{
|
||||
$last_end = $row['end'];
|
||||
$smallest = $row;
|
||||
}
|
||||
}
|
||||
|
||||
return $smallest;
|
||||
}
|
||||
}
|
||||
|
||||
//order it
|
||||
if ($data)
|
||||
{
|
||||
$last_end = 99999999999;
|
||||
$last['id'] = FALSE;
|
||||
$smallest = FALSE;
|
||||
|
||||
for ($i = 0; $i < sizeof($data); $i++)
|
||||
{
|
||||
foreach ($data as $row)
|
||||
{
|
||||
//accounting for events ending at the same time
|
||||
if ($row['end'] <= $last_end && $last['id'] != $row['id'])
|
||||
{
|
||||
$smallest = $row;
|
||||
}
|
||||
}
|
||||
|
||||
$ret[] = $smallest;
|
||||
$last_end = $smallest['end'];
|
||||
$last = $smallest;
|
||||
}
|
||||
|
||||
if (!$next)
|
||||
return $ret;
|
||||
else
|
||||
return $ret[0];
|
||||
}
|
||||
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
function _prep_res_js()
|
||||
{
|
||||
if (!$this->resources)
|
||||
return FALSE;
|
||||
|
||||
$res = $this->resources;
|
||||
|
||||
//determining which have the lowest rate
|
||||
$a[] = $res['food'];
|
||||
$a[] = $res['wood'];
|
||||
$a[] = $res['stone'];
|
||||
$a[] = $res['iron'];
|
||||
$a[] = $res['mana'];
|
||||
|
||||
$last = $a[0];
|
||||
$index = 0;
|
||||
|
||||
for ($i = 0; $i < 5; $i++)
|
||||
{
|
||||
if ($a[$i] < $last)
|
||||
{
|
||||
$last = $a[$i];
|
||||
$index = $i;
|
||||
}
|
||||
}
|
||||
|
||||
//comberting back numerical index
|
||||
switch ($index)
|
||||
{
|
||||
case 0:
|
||||
$s_index = 'food';
|
||||
break;
|
||||
case 1:
|
||||
$s_index = 'wood';
|
||||
break;
|
||||
case 2:
|
||||
$s_index = 'stone';
|
||||
break;
|
||||
case 3:
|
||||
$s_index = 'iron';
|
||||
break;
|
||||
case 4:
|
||||
$s_index = 'mana';
|
||||
break;
|
||||
default:
|
||||
$s_index = 'food';
|
||||
break;
|
||||
}
|
||||
|
||||
//calculating the rate it brings 1 resource
|
||||
$num_tick = 0.1;
|
||||
$rate = 'rate_' . $s_index;
|
||||
|
||||
while (TRUE)
|
||||
{
|
||||
if (($res[$rate] * $num_tick) > 1)
|
||||
break;
|
||||
|
||||
$num_tick += 0.1;
|
||||
}
|
||||
|
||||
$res['rate_food'] *= $num_tick;
|
||||
$res['rate_wood'] *= $num_tick;
|
||||
$res['rate_stone'] *= $num_tick;
|
||||
$res['rate_iron'] *= $num_tick;
|
||||
$res['rate_mana'] *= $num_tick;
|
||||
|
||||
$res['timer_tick'] = (1000 * $num_tick);
|
||||
|
||||
return $res;
|
||||
}
|
||||
|
||||
}//MO_Controller
|
||||
//nowhitesp
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
1523
Mourne-CI/application/core/MO_Model.php
Executable file
1523
Mourne-CI/application/core/MO_Model.php
Executable file
File diff suppressed because it is too large
Load Diff
10
Mourne-CI/application/core/index.html
Executable file
10
Mourne-CI/application/core/index.html
Executable file
@ -0,0 +1,10 @@
|
||||
<html>
|
||||
<head>
|
||||
<title>403 Forbidden</title>
|
||||
</head>
|
||||
<body>
|
||||
|
||||
<p>Directory access is forbidden.</p>
|
||||
|
||||
</body>
|
||||
</html>
|
30
Mourne-CI/application/helpers/class_helper.php
Executable file
30
Mourne-CI/application/helpers/class_helper.php
Executable file
@ -0,0 +1,30 @@
|
||||
<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');
|
||||
|
||||
if ( ! function_exists('gender'))
|
||||
{
|
||||
function gender($gender = '')
|
||||
{
|
||||
if ($gender == 1)
|
||||
return 'Male';
|
||||
else
|
||||
return 'Female';
|
||||
}
|
||||
}
|
||||
|
||||
if ( ! function_exists('class_name'))
|
||||
{
|
||||
function class_name($id = 0)
|
||||
{
|
||||
switch ($id)
|
||||
{
|
||||
case 1:
|
||||
return 'Warrior';
|
||||
case 2:
|
||||
return 'Rogue';
|
||||
case 3:
|
||||
return 'Archer';
|
||||
default:
|
||||
return 'Error';
|
||||
}
|
||||
}
|
||||
}
|
246
Mourne-CI/application/helpers/equipment_helper.php
Executable file
246
Mourne-CI/application/helpers/equipment_helper.php
Executable file
@ -0,0 +1,246 @@
|
||||
<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');
|
||||
|
||||
//means set_selected
|
||||
if (!function_exists('ss'))
|
||||
{
|
||||
function ss($d1, $d2, $o1, $o2)
|
||||
{
|
||||
if ($o1 == $d1 && $o2 == $d2)
|
||||
{
|
||||
if ($d1 == 'eq')
|
||||
return 'equipment_entry_selected';
|
||||
else
|
||||
return 'inventory_entry_selected';
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//quality_(in)inventory
|
||||
if (!function_exists('qi'))
|
||||
{
|
||||
function qi($row)
|
||||
{
|
||||
if ($row)
|
||||
{
|
||||
switch ($row['quality'])
|
||||
{
|
||||
case (0):
|
||||
return 'iv_quality_really_poor';
|
||||
case (1):
|
||||
return 'iv_quality_poor';
|
||||
case (2):
|
||||
return 'iv_quality_good';
|
||||
case (3):
|
||||
return 'iv_quality_great';
|
||||
case (4):
|
||||
return 'iv_quality_epic';
|
||||
case (5):
|
||||
return 'iv_quality_legendary';
|
||||
case (6):
|
||||
return 'iv_quality_omg';
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//quality_(in)character('s view)
|
||||
if (!function_exists('qc'))
|
||||
{
|
||||
function qc($equipment, $id)
|
||||
{
|
||||
if ($equipment[$id])
|
||||
{
|
||||
switch ($equipment[$id]['quality'])
|
||||
{
|
||||
case (0):
|
||||
return 'eq_quality_really_poor';
|
||||
case (1):
|
||||
return 'eq_quality_poor';
|
||||
case (2):
|
||||
return 'eq_quality_good';
|
||||
case (3):
|
||||
return 'eq_quality_great';
|
||||
case (4):
|
||||
return 'eq_quality_epic';
|
||||
case (5):
|
||||
return 'eq_quality_legendary';
|
||||
case (6):
|
||||
return 'eq_quality_omg';
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (!function_exists('can_be_equipped'))
|
||||
{
|
||||
function can_be_equipped($item, $hero)
|
||||
{
|
||||
if (!$item)
|
||||
return FALSE;
|
||||
|
||||
$data['can'] = FALSE;
|
||||
$data['message'] = '';
|
||||
$data['allowed_slot1'] = FALSE;
|
||||
$data['allowed_slot2'] = FALSE;
|
||||
$data['two_handed'] = FALSE;
|
||||
|
||||
if ($item['type'] != 1)
|
||||
{
|
||||
$data['message'] = 'That item cannot be equipped.';
|
||||
return $data;
|
||||
}
|
||||
|
||||
if ($item['req_class'] != 0 && $item['req_class'] != $hero['class'])
|
||||
{
|
||||
$data['message'] = 'You can never use that item.';
|
||||
return $data;
|
||||
}
|
||||
|
||||
if ($item['req_level'] > $hero['level'])
|
||||
{
|
||||
$data['message'] = 'Your level is too low to use that item.';
|
||||
return $data;
|
||||
}
|
||||
|
||||
if ($item['subtype'] == 6)
|
||||
{
|
||||
$data['can'] = TRUE;
|
||||
$data['allowed_slot1'] = 6;
|
||||
return $data;
|
||||
}
|
||||
elseif ($item['subtype'] == 12)
|
||||
{
|
||||
$data['can'] = TRUE;
|
||||
$data['allowed_slot1'] = 12;
|
||||
$data['allowed_slot2'] = 13;
|
||||
return $data;
|
||||
}
|
||||
elseif ($item['subtype'] == 14)
|
||||
{
|
||||
$data['can'] = TRUE;
|
||||
$data['allowed_slot1'] = 14;
|
||||
$data['allowed_slot2'] = 15;
|
||||
return $data;
|
||||
}
|
||||
elseif ($item['subtype'] == 19)
|
||||
{
|
||||
if ($hero['class'] == 2)
|
||||
{
|
||||
$data['can'] = TRUE;
|
||||
$data['allowed_slot1'] = 19;
|
||||
return $data;
|
||||
}
|
||||
}
|
||||
|
||||
$datatype = array(
|
||||
//warrior
|
||||
'1' => array(0, 1, 2, 3, 4),
|
||||
//rogue
|
||||
'2' => array(0, 1, 2, FALSE, FALSE),
|
||||
//archer
|
||||
'3' => array(0, 1, 2, 3, FALSE));
|
||||
|
||||
$dataeqslots = array(
|
||||
//head
|
||||
'0' => array(0, FALSE),
|
||||
//neck
|
||||
'1' => array(1, FALSE),
|
||||
//shoulder
|
||||
'2' => array(2, FALSE),
|
||||
//back
|
||||
'3' => array(3, FALSE),
|
||||
//chest
|
||||
'4' => array(4, FALSE),
|
||||
//shirt
|
||||
'5' => array(5, FALSE),
|
||||
//bracer
|
||||
'7' => array(7, FALSE),
|
||||
//gloves
|
||||
'8' => array(8, FALSE),
|
||||
//belt
|
||||
'9' => array(9, FALSE),
|
||||
//legs
|
||||
'10' => array(10, FALSE),
|
||||
//foots
|
||||
'11' => array(11, FALSE),
|
||||
);
|
||||
|
||||
//this means every item, whose subsubtype means the type (like cloth)
|
||||
if ($item['subtype'] >= 0 && $item['subtype'] < 6 || $item['subtype'] > 6 && $item['subtype'] < 12)
|
||||
{
|
||||
if ($datatype[$hero['class']][$item['subsubtype']] !== FALSE)
|
||||
{
|
||||
$data['can'] = TRUE;
|
||||
$data['allowed_slot1'] = $dataeqslots[$item['subtype']][0];
|
||||
$data['allowed_slot2'] = $dataeqslots[$item['subtype']][1];
|
||||
return $data;
|
||||
}
|
||||
else
|
||||
{
|
||||
$data['can'] = FALSE;
|
||||
$data['message'] = "You don't have the required proficiency to use that item.";
|
||||
return $data;
|
||||
}
|
||||
}
|
||||
|
||||
$dataclasswep = array(
|
||||
//warrior
|
||||
'1' => array(FALSE, FALSE, FALSE, FALSE, 5, 6, 7, 8, 9, 10,
|
||||
11, 12, 13, 14, 15, 16, FALSE, FALSE, FALSE, 20, FALSE),
|
||||
//rogue
|
||||
'2' => array(FALSE, 2, 3, 4, 5, 6, 7, FALSE, 9, 10,
|
||||
11, FALSE, 13, 14, 15, FALSE, FALSE, FALSE, FALSE, FALSE, 21),
|
||||
//archer
|
||||
'3' => array(FALSE, 2, 3, 4, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE,
|
||||
FALSE, FALSE, 13, 14, 15, 16, 17, 18, 19, FALSE, FALSE)
|
||||
);
|
||||
|
||||
//array(first slot, second slot, two Handed)
|
||||
$datawep = array(
|
||||
//staff
|
||||
'1' => array(16, FALSE, TRUE),
|
||||
//dagger one, main, off
|
||||
'2' => array(16, 17, FALSE),
|
||||
'3' => array(16, FALSE, FALSE),
|
||||
'4' => array(17, FALSE, FALSE),
|
||||
//mace one main, off, 2h
|
||||
'5' => array(16, 17, FALSE),
|
||||
'6' => array(16, FALSE, FALSE),
|
||||
'7' => array(17, FALSE, FALSE),
|
||||
'8' => array(16, FALSE, TRUE),
|
||||
//axe one, main, off, 2h
|
||||
'9' => array(16, 17, FALSE),
|
||||
'10' => array(16, FALSE, FALSE),
|
||||
'11' => array(17, FALSE, FALSE),
|
||||
'12' => array(16, FALSE, TRUE),
|
||||
//sword one, main, off, 2h
|
||||
'13' => array(16, 17, FALSE),
|
||||
'14' => array(16, FALSE, FALSE),
|
||||
'15' => array(17, FALSE, FALSE),
|
||||
'16' => array(16, FALSE, TRUE),
|
||||
//bow, crossbow, gun
|
||||
'17' => array(18, 17, FALSE),
|
||||
'18' => array(18, FALSE, FALSE),
|
||||
'19' => array(18, FALSE, FALSE),
|
||||
//?? warri, rogue ranged
|
||||
'20' => array(18, FALSE, FALSE),
|
||||
'21' => array(18, FALSE, FALSE)
|
||||
);
|
||||
|
||||
if ($item['subtype'] == 16)
|
||||
{
|
||||
if ($dataclasswep[$hero['class']][$item['subsubtype']] !== FALSE)
|
||||
{
|
||||
$data['can'] = TRUE;
|
||||
$data['allowed_slot1'] = $datawep[$item['subsubtype']][0];
|
||||
$data['allowed_slot2'] = $datawep[$item['subsubtype']][1];
|
||||
$data['two_handed'] = $datawep[$item['subsubtype']][2];
|
||||
return $data;
|
||||
}
|
||||
}
|
||||
|
||||
$data['can'] = FALSE;
|
||||
$data['message'] = 'You cannot use that item.';
|
||||
return $data;
|
||||
}
|
||||
}
|
16
Mourne-CI/application/helpers/event_helper.php
Executable file
16
Mourne-CI/application/helpers/event_helper.php
Executable file
@ -0,0 +1,16 @@
|
||||
<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');
|
||||
|
||||
if ( ! function_exists('ev_type'))
|
||||
{
|
||||
function ev_type($ev)
|
||||
{
|
||||
if ($ev == 'build')
|
||||
return 0;
|
||||
|
||||
if ($ev == 'upgrade')
|
||||
return 1;
|
||||
|
||||
if ($ev == 'create')
|
||||
return 2;
|
||||
}
|
||||
}
|
10
Mourne-CI/application/helpers/index.html
Executable file
10
Mourne-CI/application/helpers/index.html
Executable file
@ -0,0 +1,10 @@
|
||||
<html>
|
||||
<head>
|
||||
<title>403 Forbidden</title>
|
||||
</head>
|
||||
<body>
|
||||
|
||||
<p>Directory access is forbidden.</p>
|
||||
|
||||
</body>
|
||||
</html>
|
24
Mourne-CI/application/helpers/murl_helper.php
Executable file
24
Mourne-CI/application/helpers/murl_helper.php
Executable file
@ -0,0 +1,24 @@
|
||||
<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');
|
||||
|
||||
//using different helper for images, so they can be easily relocated to like different servers etc...
|
||||
|
||||
if ( ! function_exists('isite_url'))
|
||||
{
|
||||
function isite_url($uri = '')
|
||||
{
|
||||
$CI =& get_instance();
|
||||
return $CI->config->site_url($uri);
|
||||
}
|
||||
}
|
||||
|
||||
//addign img/prefix, so I don't have to in every call
|
||||
|
||||
if ( ! function_exists('ibase_url'))
|
||||
{
|
||||
function ibase_url($uri = '')
|
||||
{
|
||||
$muri = 'img/' . $uri;
|
||||
$CI =& get_instance();
|
||||
return $CI->config->base_url($muri);
|
||||
}
|
||||
}
|
10
Mourne-CI/application/index.html
Executable file
10
Mourne-CI/application/index.html
Executable file
@ -0,0 +1,10 @@
|
||||
<html>
|
||||
<head>
|
||||
<title>403 Forbidden</title>
|
||||
</head>
|
||||
<body>
|
||||
|
||||
<p>Directory access is forbidden.</p>
|
||||
|
||||
</body>
|
||||
</html>
|
389
Mourne-CI/application/models/ai_model.php
Executable file
389
Mourne-CI/application/models/ai_model.php
Executable file
@ -0,0 +1,389 @@
|
||||
<?php
|
||||
class Ai_model extends MO_Model
|
||||
{
|
||||
protected $settings;
|
||||
|
||||
function __construct()
|
||||
{
|
||||
parent::__construct();
|
||||
}
|
||||
|
||||
function attack()
|
||||
{
|
||||
$this->parse_settings();
|
||||
|
||||
if (!$this->settings['on'])
|
||||
return 'AI is off';
|
||||
|
||||
$sql = "SELECT * FROM ai_villages WHERE attacked='0'";
|
||||
|
||||
$q = $this->db->query($sql);
|
||||
|
||||
$ai_village_not_attacked = $q->num_rows();
|
||||
|
||||
$log = "ai_villages query returned " . $ai_village_not_attacked . " rows. \n";
|
||||
|
||||
$ai_villages = $q->result_array();
|
||||
|
||||
$attacking_num = $this->settings['max_attack_village_limit'];
|
||||
|
||||
//determining how much will attack
|
||||
if ($this->settings['attack_village_rand'])
|
||||
{
|
||||
$a = rand(0, $this->settings['attack_village_rand']);
|
||||
|
||||
$attacking_num -= $a;
|
||||
}
|
||||
|
||||
$log .= $attacking_num . " villages attacking. \n";
|
||||
|
||||
$reset = FALSE;
|
||||
|
||||
//resetting ai_villages's attack field if everything will be set to attacked
|
||||
if ($ai_village_not_attacked < $attacking_num)
|
||||
{
|
||||
$attacking_num = $ai_village_not_attacked;
|
||||
|
||||
$reset = TRUE;
|
||||
}
|
||||
|
||||
//determining which villages are going to attack
|
||||
for ($i = 0; $i < $attacking_num; $i++)
|
||||
{
|
||||
$found = FALSE;
|
||||
|
||||
while (!$found)
|
||||
{
|
||||
foreach ($ai_villages as $row)
|
||||
{
|
||||
$r = rand(1, 100);
|
||||
|
||||
if ($r > 50 && !isset($s[$row['id']]))
|
||||
{
|
||||
$s[$row['id']] = TRUE;
|
||||
$data[] = $row;
|
||||
$found = TRUE;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//saving to the db that they are attacked
|
||||
if (!$reset)
|
||||
{
|
||||
$sql = "UPDATE ai_villages SET attacked='1' WHERE ";
|
||||
|
||||
$first = TRUE;
|
||||
foreach ($data as $row)
|
||||
{
|
||||
if ($first)
|
||||
$first = FALSE;
|
||||
else
|
||||
$sql .= " OR ";
|
||||
|
||||
$sql .= "id='" . $row['id'] . "'";
|
||||
}
|
||||
|
||||
$this->db->query($sql);
|
||||
}
|
||||
else
|
||||
{
|
||||
$sql = "UPDATE ai_villages SET attacked='0'";
|
||||
$this->db->query($sql);
|
||||
$log .= "ai_villages's attacked field reseted.\n";
|
||||
}
|
||||
|
||||
//getting ai_units
|
||||
$sql = "SELECT * FROM ai_units";
|
||||
$q = $this->db->query($sql);
|
||||
$num_ai_units = $q->num_rows();
|
||||
$res = $q->result_array();
|
||||
|
||||
if ($this->settings['ai_unit_max_diff'] < $num_ai_units)
|
||||
{
|
||||
$num = 0;
|
||||
$d = FALSE;
|
||||
|
||||
while ($num != $this->settings['ai_unit_max_diff'])
|
||||
{
|
||||
foreach ($res as $row)
|
||||
{
|
||||
if (!isset($d[$row['id']]))
|
||||
{
|
||||
$r = rand(1,50);
|
||||
if ($r > 50)
|
||||
{
|
||||
$ai_units[] = $row;
|
||||
$d[$row['id']] = TRUE;
|
||||
$num++;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
$ai_units = $res;
|
||||
}
|
||||
|
||||
//adding villages to log
|
||||
$log .= "Attacking villages: \n";
|
||||
foreach ($data as $row)
|
||||
{
|
||||
$log .= $row['name'] . "(" .$row['X'] . " " . $row['Y'] . ") \n";
|
||||
}
|
||||
|
||||
//sending attackers
|
||||
foreach ($data as $row)
|
||||
{
|
||||
$sql = "SELECT map.X,map.Y,villages.*
|
||||
FROM map
|
||||
LEFT JOIN villages ON (map.villageid=villages.id AND map.type='3')
|
||||
WHERE (map.type = 3 AND
|
||||
map.X > '" . ($row['X'] - 24) . "'
|
||||
AND map.X < '" . ($row['X'] + 24) . "'
|
||||
AND map.Y > '" . ($row['Y'] - 24) . "'
|
||||
AND map.Y < '" . ($row['Y'] + 24) . "')";
|
||||
|
||||
$q = $this->db->query($sql);
|
||||
|
||||
//no villages in range
|
||||
if (!$q->num_rows())
|
||||
continue;
|
||||
|
||||
$log .= $row['name'] . " is attacking: \n";
|
||||
|
||||
$res = $q->result_array();
|
||||
|
||||
//sending attackers
|
||||
foreach ($res as $rrow)
|
||||
{
|
||||
if ($rrow['ai_on'] || $rrow['ai_flagged'])
|
||||
{
|
||||
$log .= "Sending attackers to: " . $rrow['name'] . "[" . $rrow['id'] . "]";
|
||||
$log .= " (S: " . $rrow['score'] . ")\n";
|
||||
$log .= "Sent: \n";
|
||||
|
||||
foreach ($ai_units as $unit)
|
||||
{
|
||||
$a = ($rrow['score'] / $unit['rate']) / $unit['per_score'];
|
||||
$num = floor($a);
|
||||
|
||||
$log .= $unit['name'] . "->" . $num . "\n";
|
||||
|
||||
$send[] = array('unitid' => $unit['id'],
|
||||
'num' => $num);
|
||||
}
|
||||
|
||||
$this->send_attack($send, $row, $rrow);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
$this->load->helper('file');
|
||||
|
||||
$f = './logs/ai_log/log_' . time() . '.txt';
|
||||
|
||||
write_file($f, $log);
|
||||
|
||||
return $log;
|
||||
|
||||
}
|
||||
|
||||
function send_attack($send, $ai_village, $village)
|
||||
{
|
||||
$villageid = $village['id'];
|
||||
|
||||
$sql = "SELECT max(attackid) AS attackid FROM attacks WHERE villageid='$villageid'";
|
||||
$q = $this->db->query($sql);
|
||||
|
||||
$res = $q->row_array();
|
||||
|
||||
if ($res['attackid'])
|
||||
{
|
||||
$atkid = ($res['attackid'] + 1);
|
||||
}
|
||||
else
|
||||
$atkid = 1;
|
||||
|
||||
$first = TRUE;
|
||||
$sql = "INSERT INTO attacks VALUES";
|
||||
foreach ($send as $row)
|
||||
{
|
||||
if ($first)
|
||||
$first = FALSE;
|
||||
else
|
||||
$sql .= ',';
|
||||
|
||||
$sql .= "(default, '$villageid', '$atkid', '" . $row['unitid'] . "', '" . $row['num']. "')";
|
||||
}
|
||||
|
||||
$sql .= ";";
|
||||
|
||||
$this->db->query($sql);
|
||||
|
||||
//calculate distance
|
||||
$dist = sqrt(pow($ai_village['X'] - $village['X'], 2) + pow($ai_village['Y'] - $village['Y'], 2));
|
||||
|
||||
//15 min 1 square
|
||||
$time = $dist * 900;
|
||||
$r = rand(3600, 10800);
|
||||
$end = $time + $r;
|
||||
|
||||
//todo remove
|
||||
$end = 20;
|
||||
|
||||
//attack random sides
|
||||
$dir = rand(1, 4);
|
||||
|
||||
$ev['villageid'] = $villageid;
|
||||
$ev['slotid'] = 0;
|
||||
$ev['type'] = parent::EVENT_ATTACK;
|
||||
$ev['time'] = $end;
|
||||
$ev['data1'] = $atkid;
|
||||
$ev['data2'] = $dir;
|
||||
|
||||
$this->add_event($ev);
|
||||
|
||||
}
|
||||
|
||||
function parse_settings()
|
||||
{
|
||||
$sql = "SELECT * FROM ai_settings";
|
||||
|
||||
$q = $this->db->query($sql);
|
||||
|
||||
$res = $q->result_array();
|
||||
|
||||
foreach ($res as $row)
|
||||
{
|
||||
$data[$row['setting']] = $row['value'];
|
||||
}
|
||||
|
||||
$this->settings = $data;
|
||||
}
|
||||
|
||||
function get_unit_list_drop_admin()
|
||||
{
|
||||
$sql = "SELECT * FROM ai_units";
|
||||
|
||||
$q = $this->db->query($sql);
|
||||
|
||||
$res = $q->result_array();
|
||||
|
||||
$data[0] = 'Nothing';
|
||||
|
||||
foreach ($res as $row)
|
||||
{
|
||||
$data[$row['id']] = $row['name'];
|
||||
}
|
||||
|
||||
return $data;
|
||||
}
|
||||
|
||||
function list_units_admin()
|
||||
{
|
||||
$sql = "SELECT * FROM ai_units";
|
||||
|
||||
$q = $this->db->query($sql);
|
||||
|
||||
return $q->result_array();
|
||||
}
|
||||
|
||||
function get_unit_admin($id)
|
||||
{
|
||||
$sql = "SELECT * FROM ai_units WHERE id='$id'";
|
||||
$q = $this->db->query($sql);
|
||||
|
||||
return $q->row_array();
|
||||
}
|
||||
|
||||
function add_unit_admin($data)
|
||||
{
|
||||
$sql = "INSERT INTO ai_units
|
||||
VALUES(default,
|
||||
'" . $data['name'] . "',
|
||||
'" . $data['icon'] . "',
|
||||
'" . $data['ability'] . "',
|
||||
'" . $data['can_carry'] . "',
|
||||
'" . $data['attack'] . "',
|
||||
'" . $data['defense'] . "',
|
||||
'" . $data['rate'] . "',
|
||||
'" . $data['per_score'] . "',
|
||||
'" . $data['turn'] . "',
|
||||
'" . $data['strong_against'] . "',
|
||||
'" . $data['weak_against'] . "')";
|
||||
|
||||
$this->db->query($sql);
|
||||
|
||||
$this->_create_sql($sql);
|
||||
}
|
||||
|
||||
function edit_unit_admin($data)
|
||||
{
|
||||
$sql = "UPDATE ai_units
|
||||
SET name='" . $data['name'] . "',
|
||||
icon='" . $data['icon'] . "',
|
||||
ability='" . $data['ability'] . "',
|
||||
can_carry='" . $data['can_carry'] . "',
|
||||
attack='" . $data['attack'] . "',
|
||||
defense='" . $data['defense'] . "',
|
||||
rate='" . $data['rate'] . "',
|
||||
per_score='" . $data['per_score'] . "',
|
||||
turn='" . $data['turn'] . "',
|
||||
strong_against='" . $data['strong_against'] . "',
|
||||
weak_against='" . $data['weak_against'] . "'
|
||||
WHERE id='" . $data['id'] . "'";
|
||||
|
||||
$this->db->query($sql);
|
||||
|
||||
$this->_create_sql($sql);
|
||||
}
|
||||
|
||||
function get_settings_list_admin()
|
||||
{
|
||||
$sql = "SELECT * FROM ai_settings";
|
||||
|
||||
$q = $this->db->query($sql);
|
||||
|
||||
return $q->result_array();
|
||||
}
|
||||
|
||||
function get_setting_admin($id)
|
||||
{
|
||||
$sql = "SELECT * FROM ai_settings WHERE id='$id'";
|
||||
$q = $this->db->query($sql);
|
||||
|
||||
return $q->row_array();
|
||||
}
|
||||
|
||||
function edit_setting_admin($data)
|
||||
{
|
||||
$sql = "UPDATE ai_settings
|
||||
SET setting='" . $data['setting'] . "',
|
||||
value='" . $data['value'] . "',
|
||||
description='" . $data['description'] . "'
|
||||
WHERE id='" . $data['id'] . "'";
|
||||
|
||||
$this->db->query($sql);
|
||||
|
||||
$this->_create_sql($sql);
|
||||
}
|
||||
|
||||
function add_setting_admin($data)
|
||||
{
|
||||
$sql = "INSERT INTO ai_settings
|
||||
VALUES(default,
|
||||
'" . $data['setting'] . "',
|
||||
'" . $data['value'] . "' ,
|
||||
'" . $data['description'] . "')";
|
||||
|
||||
$this->db->query($sql);
|
||||
|
||||
$this->_create_sql($sql);
|
||||
}
|
||||
}
|
||||
//nowhitesp
|
396
Mourne-CI/application/models/assignment_model.php
Executable file
396
Mourne-CI/application/models/assignment_model.php
Executable file
@ -0,0 +1,396 @@
|
||||
<?php
|
||||
|
||||
class Assignment_model extends MO_Model
|
||||
{
|
||||
function __construct()
|
||||
{
|
||||
parent::__construct();
|
||||
}
|
||||
|
||||
function assign_unit($assid, $num, $slotid, $res, $villageid, $userid)
|
||||
{
|
||||
$this->set_resources($res);
|
||||
|
||||
//check if there is building in that slot
|
||||
$sql = "SELECT buildings.* FROM village_buildings
|
||||
INNER JOIN buildings ON village_buildings.buildingid=buildings.id
|
||||
WHERE slotid='$slotid' AND villageid='$villageid'";
|
||||
|
||||
$q = $this->db->query($sql);
|
||||
|
||||
if (!$q->num_rows())
|
||||
return 1;
|
||||
|
||||
$building = $q->row_array();
|
||||
|
||||
//check if there is already an assignment in which case we just deassign
|
||||
//in this case num will be 0 unless they play with the form,
|
||||
//but we shouldn't care about that since the user can write 0 into the form
|
||||
$sql = "SELECT * FROM building_assignments
|
||||
WHERE assignmentid='$assid'
|
||||
AND slotid='$slotid'
|
||||
AND villageid='$villageid'";
|
||||
$q = $this->db->query($sql);
|
||||
|
||||
if ($q->num_rows())
|
||||
{
|
||||
//the user wants to just deassign
|
||||
$ass = $q->row_array();
|
||||
|
||||
//delete assignment
|
||||
$sql = "DELETE FROM building_assignments WHERE id='" . $ass['id'] . "'";
|
||||
$this->db->query($sql);
|
||||
|
||||
//giving back units
|
||||
|
||||
//getting units
|
||||
$sql = "SELECT * FROM village_units
|
||||
WHERE villageid='$villageid'
|
||||
AND userid='$userid'";
|
||||
$q = $this->db->query($sql);
|
||||
|
||||
if ($q->num_rows())
|
||||
{
|
||||
$units = $q->result_array();
|
||||
}
|
||||
else
|
||||
{
|
||||
$units = FALSE;
|
||||
}
|
||||
|
||||
$found = FALSE;
|
||||
|
||||
if ($units)
|
||||
{
|
||||
foreach ($units as $row)
|
||||
{
|
||||
if ($row['unitid'] == $ass['unitid'])
|
||||
{
|
||||
$found = TRUE;
|
||||
$fdata = $row['id'];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if ($found)
|
||||
{
|
||||
$sql = "UPDATE village_units
|
||||
SET unitcount = unitcount + '". $ass['num_unit'] . "'
|
||||
WHERE id='$fdata'";
|
||||
}
|
||||
else
|
||||
{
|
||||
$sql = "INSERT INTO village_units
|
||||
VALUES(default, '$userid', '$villageid',
|
||||
'" . $ass['unitid'] . "', '" . $ass['num_unit'] . "')";
|
||||
}
|
||||
|
||||
$this->db->query($sql);
|
||||
|
||||
//substract the bonuses
|
||||
$this->substract_modifiers($assid, $villageid, 'assignment',
|
||||
$ass['num_bonus']);
|
||||
|
||||
$this->write_resources();
|
||||
|
||||
//taking away spells
|
||||
$sql = "DELETE FROM building_spells
|
||||
WHERE assignmentid='$assid'
|
||||
AND slotid='$slotid'
|
||||
AND villageid='$villageid'";
|
||||
|
||||
$this->db->query($sql);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
//check if assignment exists
|
||||
$sql = "SELECT * FROM assignments WHERE id='$assid'";
|
||||
$q = $this->db->query($sql);
|
||||
|
||||
if (!$q->num_rows())
|
||||
return 2;
|
||||
|
||||
$ass = $q->row_array();
|
||||
|
||||
//checking technology
|
||||
if ($ass['req_tech'])
|
||||
if (!$this->has_req_tech($ass['req_tech'], $villageid, $slotid))
|
||||
return 3;
|
||||
|
||||
//check if building has that assignment
|
||||
if (!($building['assignment1'] == $ass['id'] ||
|
||||
$building['assignment2'] == $ass['id'] ||
|
||||
$building['assignment3'] == $ass['id'] ||
|
||||
$building['assignment4'] == $ass['id'] ||
|
||||
$building['assignment5'] == $ass['id']))
|
||||
return 3;
|
||||
|
||||
//getting unit
|
||||
$sql = "SELECT * FROM village_units
|
||||
WHERE unitid='" . $ass['unitid'] . "'
|
||||
AND userid='$userid'";
|
||||
$q = $this->db->query($sql);
|
||||
|
||||
if (!$q->num_rows())
|
||||
return 4;
|
||||
|
||||
$unit = $q->row_array();
|
||||
|
||||
//it probably shouldn't happen but who knows
|
||||
if (!$unit['unitcount'])
|
||||
return 5;
|
||||
|
||||
//if the user just clicks on the assign we should assign max
|
||||
if (!$num)
|
||||
$num = $ass['max'];
|
||||
|
||||
//we shouldn't assign more than allowed
|
||||
if ($ass['max'] < $num)
|
||||
$num = $ass['max'];
|
||||
|
||||
//determining how much can be assigned
|
||||
if ($unit['unitcount'] < $num)
|
||||
$num = $unit['unitcount'];
|
||||
|
||||
//determining number of bonuses granted
|
||||
$num_bonus = floor(($num / $ass['bonus_per_assigned']));
|
||||
|
||||
$count = ($unit['unitcount'] - $num);
|
||||
|
||||
//updating unit field in db
|
||||
if ($count <= 0)
|
||||
{
|
||||
$sql = "DELETE FROM village_units WHERE id='" . $unit['id'] . "'";
|
||||
}
|
||||
else
|
||||
{
|
||||
$sql = "UPDATE village_units
|
||||
SET unitcount=unitcount - '$num'
|
||||
WHERE id='" . $unit['id'] . "'";
|
||||
}
|
||||
|
||||
$this->db->query($sql);
|
||||
|
||||
//adding assignment
|
||||
$sql = "INSERT INTO building_assignments
|
||||
VALUES(default, '$villageid', '$slotid', '" . $unit['unitid'] . "',
|
||||
'$num', '" . $assid . "', '$num_bonus')";
|
||||
|
||||
$this->db->query($sql);
|
||||
|
||||
//grant resource bonus
|
||||
$this->add_modifiers($assid, $villageid, 'assignment', $num_bonus);
|
||||
$this->write_resources();
|
||||
|
||||
//assignment has spell
|
||||
if (!$ass['spellid'])
|
||||
return 0;
|
||||
|
||||
/*
|
||||
//only give spells if bonus is granted
|
||||
if (!$num_bonus)
|
||||
return 0;
|
||||
*/
|
||||
|
||||
//only give spell if max unit assigned
|
||||
if (!($ass['max'] == $num))
|
||||
return 0;
|
||||
|
||||
//granting spell
|
||||
$sql = "INSERT INTO building_spells
|
||||
VALUES(default, '$villageid', '$slotid', '$assid',
|
||||
'" . $ass['spellid'] . "')";
|
||||
|
||||
$this->db->query($sql);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
function get_assignments($slotid, $villageid, $userid)
|
||||
{
|
||||
if ($slotid > parent::TOTAL_BUILDINGS)
|
||||
return 1; //that shouldn't happen
|
||||
|
||||
$sql = "SELECT buildings.* FROM village_buildings
|
||||
INNER JOIN buildings ON village_buildings.buildingid = buildings.id
|
||||
WHERE village_buildings.slotid='$slotid'
|
||||
AND village_buildings.villageid='$villageid'";
|
||||
|
||||
$q = $this->db->query($sql);
|
||||
|
||||
if (!$q->num_rows())
|
||||
return 2; //nothing in that slot
|
||||
|
||||
$res = $q->row_array();
|
||||
|
||||
//getting assignment data
|
||||
$sql = "SELECT assignments.*,units.name
|
||||
FROM assignments
|
||||
INNER JOIN units ON assignments.unitid=units.id
|
||||
WHERE assignments.id='" . $res['assignment1'] . "'
|
||||
OR assignments.id='" . $res['assignment2'] . "'
|
||||
OR assignments.id='" . $res['assignment3'] . "'
|
||||
OR assignments.id='" . $res['assignment4'] . "'
|
||||
OR assignments.id='" . $res['assignment5'] . "'";
|
||||
|
||||
$q = $this->db->query($sql);
|
||||
|
||||
|
||||
if (!$q->num_rows())
|
||||
{
|
||||
$data['assigndata'] = FALSE; //building doesn't have assignments
|
||||
return $data;
|
||||
}
|
||||
|
||||
$adata = $q->result_array();
|
||||
|
||||
$tech = $this->get_village_technologies($villageid, $slotid);
|
||||
|
||||
foreach ($adata as $row)
|
||||
{
|
||||
if ($this->have_technology($tech, $row['req_tech']))
|
||||
$data['assigndata'][] = $row;
|
||||
}
|
||||
|
||||
if (!isset($data['assigndata']))
|
||||
{
|
||||
$data['assigndata'] = FALSE;
|
||||
return $data;
|
||||
}
|
||||
|
||||
//getting assigned data
|
||||
$sql = "SELECT * FROM building_assignments
|
||||
WHERE slotid='$slotid'
|
||||
AND villageid='$villageid'";
|
||||
|
||||
$q = $this->db->query($sql);
|
||||
|
||||
if (!$q->num_rows())
|
||||
{
|
||||
$data['assigned'] = FALSE;
|
||||
}
|
||||
else
|
||||
{
|
||||
$data['assigned'] = $q->result_array();
|
||||
}
|
||||
|
||||
$data['building'] = $res;
|
||||
|
||||
//getting units
|
||||
$sql = "SELECT * FROM village_units
|
||||
WHERE villageid='$villageid'
|
||||
AND userid='$userid'";
|
||||
$q = $this->db->query($sql);
|
||||
|
||||
if ($q->num_rows)
|
||||
{
|
||||
$data['units'] = $q->result_array();
|
||||
}
|
||||
else
|
||||
{
|
||||
$data['units'] = FALSE;
|
||||
}
|
||||
|
||||
return $data;
|
||||
|
||||
}
|
||||
|
||||
function get_assignment_list_drop_admin()
|
||||
{
|
||||
$sql = "SELECT * FROM assignments";
|
||||
$q = $this->db->query($sql);
|
||||
|
||||
$res = $q->result_array();
|
||||
|
||||
$data[0] = 'Nothing';
|
||||
|
||||
foreach ($res as $row)
|
||||
{
|
||||
$data[$row['id']] = $row['description'];
|
||||
}
|
||||
|
||||
return $data;
|
||||
}
|
||||
|
||||
function get_assignments_admin()
|
||||
{
|
||||
$sql = "SELECT * FROM assignments";
|
||||
|
||||
$q = $this->db->query($sql);
|
||||
|
||||
return $q->result_array();
|
||||
}
|
||||
|
||||
function add_assignment_admin($data)
|
||||
{
|
||||
$sql = "INSERT INTO assignments
|
||||
VALUES (default,
|
||||
'" . $data['unitid'] . "',
|
||||
'" . $data['max'] . "',
|
||||
'" . $data['bonus_per_assigned'] . "',
|
||||
'" . $data['spellid'] . "',
|
||||
'" . $data['req_tech'] . "',
|
||||
'" . $data['mod_max_food'] . "',
|
||||
'" . $data['mod_max_wood'] . "',
|
||||
'" . $data['mod_max_stone'] . "',
|
||||
'" . $data['mod_max_iron'] . "',
|
||||
'" . $data['mod_max_mana'] . "',
|
||||
'" . $data['mod_rate_food'] . "',
|
||||
'" . $data['mod_rate_wood'] . "',
|
||||
'" . $data['mod_rate_stone'] . "',
|
||||
'" . $data['mod_rate_iron'] . "',
|
||||
'" . $data['mod_rate_mana'] . "',
|
||||
'" . $data['mod_percent_food'] . "',
|
||||
'" . $data['mod_percent_wood'] . "',
|
||||
'" . $data['mod_percent_stone'] . "',
|
||||
'" . $data['mod_percent_iron'] . "',
|
||||
'" . $data['mod_percent_mana'] . "',
|
||||
'" . $data['description'] . "')";
|
||||
|
||||
$this->db->query($sql);
|
||||
|
||||
$this->_create_sql($sql);
|
||||
}
|
||||
|
||||
function edit_assignment_admin($data)
|
||||
{
|
||||
$sql = "UPDATE assignments
|
||||
SET unitid='" . $data['unitid'] . "',
|
||||
max='" . $data['max'] . "',
|
||||
bonus_per_assigned='" . $data['bonus_per_assigned'] . "',
|
||||
spellid='" . $data['spellid'] . "',
|
||||
req_tech='" . $data['req_tech'] . "',
|
||||
mod_max_food='" . $data['mod_max_food'] . "',
|
||||
mod_max_wood='" . $data['mod_max_wood'] . "',
|
||||
mod_max_stone='" . $data['mod_max_stone'] . "',
|
||||
mod_max_iron='" . $data['mod_max_iron'] . "',
|
||||
mod_max_mana='" . $data['mod_max_mana'] . "',
|
||||
mod_rate_food='" . $data['mod_rate_food'] . "',
|
||||
mod_rate_wood='" . $data['mod_rate_wood'] . "',
|
||||
mod_rate_stone='" . $data['mod_rate_stone'] . "',
|
||||
mod_rate_iron='" . $data['mod_rate_iron'] . "',
|
||||
mod_rate_mana='" . $data['mod_rate_mana'] . "',
|
||||
mod_percent_food='" . $data['mod_percent_food'] . "',
|
||||
mod_percent_wood='" . $data['mod_percent_wood'] . "',
|
||||
mod_percent_stone='" . $data['mod_percent_stone'] . "',
|
||||
mod_percent_iron='" . $data['mod_percent_iron'] . "',
|
||||
mod_percent_mana='" . $data['mod_percent_mana'] . "',
|
||||
description='" . $data['description'] . "'
|
||||
WHERE id='" . $data['id'] . "'";
|
||||
|
||||
$this->db->query($sql);
|
||||
|
||||
$this->_create_sql($sql);
|
||||
}
|
||||
|
||||
function get_assignment_admin($id)
|
||||
{
|
||||
$sql = "SELECT * FROM assignments WHERE id='$id'";
|
||||
|
||||
$q = $this->db->query($sql);
|
||||
|
||||
return $q->row_array();
|
||||
}
|
||||
}
|
||||
//nowhitesp
|
265
Mourne-CI/application/models/building_model.php
Executable file
265
Mourne-CI/application/models/building_model.php
Executable file
@ -0,0 +1,265 @@
|
||||
<?php
|
||||
class Building_model extends MO_Model
|
||||
{
|
||||
function __construct()
|
||||
{
|
||||
parent::__construct();
|
||||
}
|
||||
|
||||
function get_building($buildingid)
|
||||
{
|
||||
$sql = "SELECT * FROM buildings WHERE id='$buildingid'";
|
||||
$q = $this->db->query($sql);
|
||||
|
||||
if ($q->num_rows())
|
||||
return $q->row_array();
|
||||
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
function set_build_in_progress($slotid, $villageid)
|
||||
{
|
||||
$sql = "INSERT INTO village_buildings
|
||||
VALUES(default, '$villageid', '$slotid', '2')";
|
||||
$this->db->query($sql);
|
||||
}
|
||||
|
||||
function building_list($villageid)
|
||||
{
|
||||
$sql = "SELECT * FROM buildings
|
||||
WHERE rank='1'";
|
||||
|
||||
$q = $this->db->query($sql);
|
||||
$res = $q->result_array();
|
||||
|
||||
$sql = "SELECT * FROM village_buildings WHERE villageid='$villageid'";
|
||||
$q = $this->db->query($sql);
|
||||
$vb = $q->result_array();
|
||||
|
||||
//checking requirements
|
||||
foreach ($res as $row)
|
||||
{
|
||||
if ($this->can_build($villageid, $row, $vb, FALSE))
|
||||
{
|
||||
$build[] = $row;
|
||||
}
|
||||
}
|
||||
|
||||
//requirements are met
|
||||
$tech = $this->get_village_technologies($villageid);
|
||||
|
||||
foreach ($build as $row)
|
||||
{
|
||||
if ($row['req_tech'])
|
||||
{
|
||||
foreach ($tech as $trow)
|
||||
{
|
||||
if ($row['req_tech'] == $trow['technologyid'])
|
||||
{
|
||||
$data[] = $row;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
$data[] = $row;
|
||||
}
|
||||
}
|
||||
|
||||
return $data;
|
||||
}
|
||||
|
||||
//returns 0 if upgrade in progress
|
||||
//returns 1 if technology requirement not met
|
||||
//returns 2 if not enough resources
|
||||
//returns 3 if can be built
|
||||
function can_be_upgraded($event, $res, $building, $villageid, $query = FALSE)
|
||||
{
|
||||
if ($query)
|
||||
{
|
||||
//this means we have to get building from the db,
|
||||
//and $building is only the id
|
||||
}
|
||||
|
||||
//check if upgrade in progress
|
||||
//we can just do this, since event is filtered to update events
|
||||
if ($event)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (!$this->has_req_tech($building['req_tech'], $villageid))
|
||||
return 1;
|
||||
|
||||
if ($res['food'] < $building['cost_food'] ||
|
||||
$res['wood'] < $building['cost_wood'] ||
|
||||
$res['stone'] < $building['cost_stone'] ||
|
||||
$res['iron'] < $building['cost_iron'] ||
|
||||
$res['mana'] < $building['cost_mana'])
|
||||
{
|
||||
return 2;
|
||||
}
|
||||
|
||||
//can be built
|
||||
return 3;
|
||||
}
|
||||
|
||||
function can_build($villageid, $buildingid, $data = 0, $is_buildingid = TRUE)
|
||||
{
|
||||
//STUB requirements aren't implemented
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
function is_valid_slot($slotid, $villageid)
|
||||
{
|
||||
if ($slotid > parent::TOTAL_BUILDINGS)
|
||||
return FALSE;
|
||||
|
||||
$sql = "SELECT id FROM village_buildings
|
||||
WHERE villageid='$villageid' AND slotid='$slotid'";
|
||||
$q = $this->db->query($sql);
|
||||
|
||||
if ($q->num_rows())
|
||||
return FALSE;
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
function get_building_ranks_admin()
|
||||
{
|
||||
$sql = "SELECT * FROM buildings WHERE id > 2";
|
||||
$q = $this->db->query($sql);
|
||||
|
||||
$res = $q->result_array();
|
||||
|
||||
$data[0] = 'Nothing';
|
||||
|
||||
foreach ($res as $row)
|
||||
{
|
||||
if (!$row['next_rank'])
|
||||
{
|
||||
$name = $row['name'] . ' R: ' . $row['rank'];
|
||||
$data[$row['id']] = $name;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
return $data;
|
||||
}
|
||||
|
||||
function list_buildings_admin()
|
||||
{
|
||||
$sql = "SELECT * FROM buildings";
|
||||
$q = $this->db->query($sql);
|
||||
|
||||
return $q->result_array();
|
||||
}
|
||||
|
||||
function get_building_admin($id)
|
||||
{
|
||||
$sql = "SELECT * FROM buildings WHERE id='$id'";
|
||||
$q = $this->db->query($sql);
|
||||
|
||||
return $q->row_array();
|
||||
}
|
||||
|
||||
function edit_building_admin($data)
|
||||
{
|
||||
|
||||
$sql = "UPDATE buildings
|
||||
SET name='" . $data['name'] . "',
|
||||
description='" . $data['description'] . "',
|
||||
icon='" . $data['icon'] . "',
|
||||
rank='" . $data['rank'] . "',
|
||||
next_rank='" . $data['next_rank'] . "',
|
||||
time_to_build='" . $data['time_to_build'] . "',
|
||||
creates='" . $data['creates'] . "',
|
||||
num_creates='" . $data['num_creates'] . "',
|
||||
score='" . $data['score'] . "',
|
||||
defense='" . $data['defense'] . "',
|
||||
ability='" . $data['ability'] . "',
|
||||
cost_food='" . $data['cost_food'] . "',
|
||||
cost_wood='" . $data['cost_wood'] . "',
|
||||
cost_stone='" . $data['cost_stone'] . "',
|
||||
cost_iron='" . $data['cost_iron'] . "',
|
||||
cost_mana='" . $data['cost_mana'] . "',
|
||||
mod_max_food='" . $data['mod_max_food'] . "',
|
||||
mod_max_wood='" . $data['mod_max_wood'] . "',
|
||||
mod_max_stone='" . $data['mod_max_stone'] . "',
|
||||
mod_max_iron='" . $data['mod_max_iron'] . "',
|
||||
mod_max_mana='" . $data['mod_max_mana'] . "',
|
||||
mod_rate_food='" . $data['mod_rate_food'] . "',
|
||||
mod_rate_wood='" . $data['mod_rate_wood'] . "',
|
||||
mod_rate_stone='" . $data['mod_rate_stone'] . "',
|
||||
mod_rate_iron='" . $data['mod_rate_iron'] . "',
|
||||
mod_rate_mana='" . $data['mod_rate_mana'] . "',
|
||||
mod_percent_food='" . $data['mod_percent_food'] . "',
|
||||
mod_percent_wood='" . $data['mod_percent_wood'] . "',
|
||||
mod_percent_stone='" . $data['mod_percent_stone'] . "',
|
||||
mod_percent_iron='" . $data['mod_percent_iron'] . "',
|
||||
mod_percent_mana='" . $data['mod_percent_mana'] . "',
|
||||
assignment1='" . $data['assignment1'] . "',
|
||||
assignment2='" . $data['assignment2'] . "',
|
||||
assignment3='" . $data['assignment3'] . "',
|
||||
assignment4='" . $data['assignment4'] . "',
|
||||
assignment5='" . $data['assignment5'] . "',
|
||||
req_tech='" . $data['req_tech'] . "',
|
||||
tech_group='" . $data['tech_group'] . "',
|
||||
tech_secondary_group='" . $data['tech_secondary_group'] . "'
|
||||
WHERE id='" . $data['id'] . "'";
|
||||
|
||||
$this->db->query($sql);
|
||||
|
||||
$this->_create_sql($sql);
|
||||
}
|
||||
|
||||
function add_building_admin($data)
|
||||
{
|
||||
$sql = "INSERT INTO buildings VALUES(default,
|
||||
'" . $data['name'] . "',
|
||||
'" . $data['description'] . "',
|
||||
'" . $data['icon'] . "',
|
||||
'" . $data['rank'] . "',
|
||||
'" . $data['next_rank'] . "',
|
||||
'" . $data['time_to_build'] . "',
|
||||
'" . $data['creates'] . "',
|
||||
'" . $data['num_creates'] . "',
|
||||
'" . $data['score'] . "',
|
||||
'" . $data['defense'] . "',
|
||||
'" . $data['ability'] . "',
|
||||
'" . $data['cost_food'] . "',
|
||||
'" . $data['cost_wood'] . "',
|
||||
'" . $data['cost_stone'] . "',
|
||||
'" . $data['cost_iron'] . "',
|
||||
'" . $data['cost_mana'] . "',
|
||||
'" . $data['mod_max_food'] . "',
|
||||
'" . $data['mod_max_wood'] . "',
|
||||
'" . $data['mod_max_stone'] . "',
|
||||
'" . $data['mod_max_iron'] . "',
|
||||
'" . $data['mod_max_mana'] . "',
|
||||
'" . $data['mod_rate_food'] . "',
|
||||
'" . $data['mod_rate_wood'] . "',
|
||||
'" . $data['mod_rate_stone'] . "',
|
||||
'" . $data['mod_rate_iron'] . "',
|
||||
'" . $data['mod_rate_mana'] . "',
|
||||
'" . $data['mod_percent_food'] . "',
|
||||
'" . $data['mod_percent_wood'] . "',
|
||||
'" . $data['mod_percent_stone'] . "',
|
||||
'" . $data['mod_percent_iron'] . "',
|
||||
'" . $data['mod_percent_mana'] . "',
|
||||
'" . $data['assignment1'] . "',
|
||||
'" . $data['assignment2'] . "',
|
||||
'" . $data['assignment3'] . "',
|
||||
'" . $data['assignment4'] . "',
|
||||
'" . $data['assignment5'] . "',
|
||||
'" . $data['req_tech'] . "',
|
||||
'" . $data['tech_group'] . "',
|
||||
'" . $data['tech_secondary_group'] . "')";
|
||||
|
||||
$this->db->query($sql);
|
||||
|
||||
$this->_create_sql($sql);
|
||||
}
|
||||
}
|
||||
//nowhitesp
|
55
Mourne-CI/application/models/changelog_model.php
Executable file
55
Mourne-CI/application/models/changelog_model.php
Executable file
@ -0,0 +1,55 @@
|
||||
<?php
|
||||
|
||||
class Changelog_model extends MO_Model
|
||||
{
|
||||
|
||||
function __construct()
|
||||
{
|
||||
parent::__construct();
|
||||
}
|
||||
|
||||
function new_version($version)
|
||||
{
|
||||
$time = time();
|
||||
|
||||
$sql = "INSERT INTO changelog_versions VALUES(default, '$version', '$time')";
|
||||
$this->db->query($sql);
|
||||
$this->_create_sql($sql);
|
||||
}
|
||||
|
||||
function new_commit($text)
|
||||
{
|
||||
$time = time();
|
||||
|
||||
$sql = "SELECT id FROM changelog_versions ORDER BY id DESC LIMIT 1";
|
||||
$q = $this->db->query($sql);
|
||||
$res = $q->row_array();
|
||||
$versionid = $res['id'];
|
||||
|
||||
$sql = "INSERT INTO changelog_commits VALUES(default, '$versionid', '$text', '$time')";
|
||||
$this->db->query($sql);
|
||||
$this->_create_sql($sql);
|
||||
}
|
||||
|
||||
function get_versions()
|
||||
{
|
||||
$sql = "SELECT * FROM changelog_versions ORDER BY timestamp DESC";
|
||||
$q = $this->db->query($sql);
|
||||
|
||||
|
||||
return $q->result_array();
|
||||
}
|
||||
|
||||
function get_commits()
|
||||
{
|
||||
$sql = "SELECT * FROM changelog_commits ORDER BY timestamp DESC";
|
||||
$q = $this->db->query($sql);
|
||||
|
||||
|
||||
return $q->result_array();
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
//nowhitesp
|
10
Mourne-CI/application/models/cron_model.php
Executable file
10
Mourne-CI/application/models/cron_model.php
Executable file
@ -0,0 +1,10 @@
|
||||
<?php
|
||||
class Cron_model extends MO_Model
|
||||
{
|
||||
function __construct()
|
||||
{
|
||||
parent::__construct();
|
||||
}
|
||||
|
||||
}
|
||||
//nowhitesp
|
1189
Mourne-CI/application/models/event_model.php
Executable file
1189
Mourne-CI/application/models/event_model.php
Executable file
File diff suppressed because it is too large
Load Diff
331
Mourne-CI/application/models/hero_model.php
Normal file
331
Mourne-CI/application/models/hero_model.php
Normal file
@ -0,0 +1,331 @@
|
||||
<?php
|
||||
|
||||
class Hero_model extends MO_Model
|
||||
{
|
||||
function __construct()
|
||||
{
|
||||
parent::__construct();
|
||||
}
|
||||
|
||||
function get_heroes($userid)
|
||||
{
|
||||
$sql = "SELECT * FROM heroes WHERE userid = ? AND deleted = '0'";
|
||||
|
||||
$q = $this->db->query($sql, array($userid));
|
||||
|
||||
if ($q->num_rows())
|
||||
return $q->result_array();
|
||||
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
function select_hero($id, $userid)
|
||||
{
|
||||
$sql = "SELECT userid,deleted FROM heroes WHERE id = ?";
|
||||
|
||||
$q = $this->db->query($sql, array($id));
|
||||
|
||||
if (!$q->num_rows())
|
||||
return FALSE;
|
||||
|
||||
$res = $q->row_array();
|
||||
|
||||
if ($res['userid'] != $userid || $res['deleted'])
|
||||
return FALSE;
|
||||
|
||||
$sql = "UPDATE heroes SET selected = 0 WHERE userid = ?";
|
||||
|
||||
$this->db->query($sql, array($userid));
|
||||
|
||||
$sql = "UPDATE heroes SET selected = 1 WHERE id = ?";
|
||||
|
||||
$this->db->query($sql, array($id));
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
function get_hero($id, $userid)
|
||||
{
|
||||
$sql = "SELECT * FROM heroes WHERE id = ? AND userid = ?";
|
||||
|
||||
$q = $this->db->query($sql, array($id, $userid));
|
||||
|
||||
if ($q->num_rows())
|
||||
return $q->row_array();
|
||||
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
function delete_hero($id, $userid)
|
||||
{
|
||||
$sql = "SELECT * FROM heroes WHERE id = ?";
|
||||
|
||||
$q = $this->db->query($sql, array($id));
|
||||
|
||||
if (!$q->num_rows())
|
||||
return FALSE;
|
||||
|
||||
$res = $q->row_array();
|
||||
|
||||
if ($res['deleted'])
|
||||
return FALSE;
|
||||
|
||||
if ($userid != $res['userid'])
|
||||
return FALSE;
|
||||
|
||||
if ($res['selected'])
|
||||
{
|
||||
$sql = "SELECT * FROM heroes WHERE userid = ? AND deleted = '0'";
|
||||
|
||||
$q = $this->db->query($sql, array($userid));
|
||||
|
||||
if (!$q->num_rows())
|
||||
return TRUE;
|
||||
|
||||
$data = $q->result_array();
|
||||
|
||||
foreach ($data as $row)
|
||||
{
|
||||
if ($row['id'] != $id)
|
||||
{
|
||||
$sql = "UPDATE heroes SET selected = '1' WHERE id = ?";
|
||||
$this->db->query($sql, array($row['id']));
|
||||
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
$sql = "UPDATE heroes SET deleted='1', delete_name = '" . $res['name'] . "', name=''
|
||||
WHERE id = ?";
|
||||
|
||||
$this->db->query($sql, array($id));
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
// function get_hero_admin($id)? or gm?
|
||||
|
||||
function create($data, $userid)
|
||||
{
|
||||
$name = ucfirst(mb_strtolower($data['name'], 'UTF-8'));
|
||||
|
||||
if ($gender == 1)
|
||||
{
|
||||
$av = 'characters/base/male.png';
|
||||
$avt = 'characters/base/male_thumb.png';
|
||||
}
|
||||
else
|
||||
{
|
||||
$av = 'characters/base/female.png';
|
||||
$avt = 'characters/base/female_thumb.png';
|
||||
}
|
||||
|
||||
$sql = "UPDATE heroes SET selected='0' WHERE userid = ?";
|
||||
|
||||
$this->db->query($sql, array($userid));
|
||||
|
||||
$sql = "SELECT * FROM hero_templates WHERE id = ?";
|
||||
|
||||
$q = $this->db->query($sql, array($data['class']));
|
||||
|
||||
if (!$q->num_rows())
|
||||
return FALSE;
|
||||
|
||||
$cd = $q->row_array();
|
||||
|
||||
//getting inventory template, and applying the stats
|
||||
|
||||
|
||||
|
||||
|
||||
$sql = "INSERT INTO heroes
|
||||
VALUES(default, '$userid', ?, default, default,
|
||||
?, default, '" . $cd['max_health'] . "', '" . $cd['max_mana'] . "', '" . $cd['max_health'] . "',
|
||||
'" . $cd['max_mana'] . "', default, default, '" . $cd['nomod_max_health'] . "',
|
||||
'". $cd['nomod_max_mana'] . "',
|
||||
default, '" . $cd['agility'] . "', '" . $cd['strength'] . "', '" . $cd['stamina'] . "',
|
||||
'" . $cd['intellect'] . "',
|
||||
'" . $cd['spirit'] . "', default, default, default, default,
|
||||
default, '" . $cd['agility'] . "', '" . $cd['strength'] . "', '" . $cd['stamina'] . "',
|
||||
'" . $cd['intellect'] . "',
|
||||
'" . $cd['spirit'] . "', default, default, default, default,
|
||||
default, '" . $cd['attackpower'] . "', default, '" . $cd['nomod_attackpower'] . "',
|
||||
'" . $cd['armor'] . "',
|
||||
default, '" . $cd['armor'] . "', '" . $cd['dodge'] . "', '" . $cd['nomod_dodge'] . "',
|
||||
'" . $cd['parry'] . "',
|
||||
'" . $cd['nomod_parry'] . "', '" . $cd['hit'] . "',
|
||||
'" . $cd['crit'] . "', '" . $cd['nomod_crit'] . "', '" . $cd['damage_min'] . "',
|
||||
'" . $cd['damage_max'] . "', default, default, '" . $cd['nomod_damage_min'] . "',
|
||||
'" . $cd['nomod_damage_max'] . "',
|
||||
'" . $cd['ranged_damage_min'] . "', '" . $cd['ranged_damage_max'] . "', default, default,
|
||||
'" . $cd['nomod_ranged_damage_min'] . "',
|
||||
'" . $cd['nomod_ranged_damage_max'] . "', '" . $cd['heal_min'] . "',
|
||||
'" . $cd['heal_max'] . "', default, default,
|
||||
'" . $cd['nomod_heal_min'] . "', '" . $cd['nomod_heal_max'] . "', default, default, ?,
|
||||
default, ?, ?, default, '')";
|
||||
|
||||
$this->db->query($sql, array($name, $data['class'], $data['gender'], $av, $avt));
|
||||
|
||||
//add invertory here
|
||||
|
||||
//add starter spells
|
||||
|
||||
//make actionbar entry
|
||||
}
|
||||
|
||||
function hero_name_is_unique($name)
|
||||
{
|
||||
$name = ucfirst(mb_strtolower($name, 'UTF-8'));
|
||||
|
||||
$sql = "SELECT * FROM heroes WHERE name = ? LIMIT 0, 1";
|
||||
|
||||
$q = $this->db->query($sql, array($name));
|
||||
|
||||
if ($q->num_rows())
|
||||
return FALSE;
|
||||
else
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
function all_hero_templates_admin()
|
||||
{
|
||||
$sql = "SELECT * FROM hero_templates";
|
||||
|
||||
$q = $this->db->query($sql);
|
||||
|
||||
if ($q->num_rows())
|
||||
return $q->result_array();
|
||||
else
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
function get_template_admin($id)
|
||||
{
|
||||
$sql = "SELECT * FROM hero_templates WHERE id = '$id'";
|
||||
|
||||
$q = $this->db->query($sql);
|
||||
|
||||
if ($q->num_rows())
|
||||
return $q->row_array();
|
||||
else
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
function edit_template_admin($d)
|
||||
{
|
||||
$c = $this->template_calc_stats($d, 'edit');
|
||||
|
||||
$sql = "UPDATE hero_templates
|
||||
SET classname = '" . $d['classname'] . "',
|
||||
nomod_max_health = '" . $d['nomod_max_health'] . "',
|
||||
nomod_max_mana = '" . $d['nomod_max_mana'] . "',
|
||||
max_health = '" . $c['max_health'] . "',
|
||||
max_mana = '" . $c['max_mana'] . "',
|
||||
agility = '" . $d['agility'] . "',
|
||||
strength = '" . $d['strength'] . "',
|
||||
stamina = '" . $d['stamina'] . "',
|
||||
intellect = '" . $d['intellect'] . "',
|
||||
spirit = '" . $d['spirit'] . "',
|
||||
nomod_attackpower = '" . $d['nomod_attackpower'] . "',
|
||||
attackpower = '" . $c['attackpower'] . "',
|
||||
armor = '" . $c['armor']. "',
|
||||
dodge = '" . $c['dodge'] . "',
|
||||
nomod_dodge = '" . $d['nomod_dodge'] . "',
|
||||
parry = '" . $c['parry'] . "',
|
||||
nomod_parry = '" . $d['nomod_parry'] . "',
|
||||
hit = '" . $d['hit'] . "',
|
||||
crit = '" . $c['crit'] . "',
|
||||
nomod_crit = '" . $d['nomod_crit'] . "',
|
||||
nomod_damage_min = '" . $c['nomod_damage_min'] . "',
|
||||
nomod_damage_max = '" . $c['nomod_damage_max'] . "',
|
||||
damage_min = '" . $c['damage_min'] . "',
|
||||
damage_max = '" . $c['damage_max'] . "',
|
||||
ranged_damage_min = '" . $c['ranged_damage_min'] . "',
|
||||
ranged_damage_max = '" . $c['ranged_damage_max'] . "',
|
||||
nomod_ranged_damage_min = '" . $c['nomod_ranged_damage_min'] . "',
|
||||
nomod_ranged_damage_max = '" . $c['nomod_ranged_damage_max'] . "',
|
||||
nomod_heal_min = '" . $c['nomod_heal_min'] . "',
|
||||
nomod_heal_max = '" . $c['nomod_heal_max'] . "',
|
||||
heal_min = '" . $c['heal_min'] . "',
|
||||
heal_max = '" . $c['heal_max'] . "'
|
||||
WHERE id = '" . $d['id'] . "'";
|
||||
|
||||
$this->db->query($sql);
|
||||
|
||||
$this->_create_sql($sql);
|
||||
}
|
||||
|
||||
function add_template_admin($d)
|
||||
{
|
||||
//0 armor is being added, because when adding a new class, eqipments shouldn't exists in db
|
||||
|
||||
//think about this!
|
||||
//maybe this is uniform in template and normal mode! or can be made uniform
|
||||
$c = $this->template_calc_stats($d, 'add');
|
||||
|
||||
|
||||
$sql = "INSERT INTO hero_templates
|
||||
VALUES(default, '" . $d['classname'] . "', '" . $d['nomod_max_health'] . "',
|
||||
'" . $d['nomod_max_mana'] . "', '" . $c['max_health'] . "',
|
||||
'" . $c['max_mana'] . "', '" . $d['agility'] . "', '" . $d['strength'] . "',
|
||||
'" . $d['stamina'] . "', '" . $d['intellect'] . "',
|
||||
'" . $d['nomod_attackpower'] . "', '" . $c['attackpower'] . "',
|
||||
'" . $d['spirit'] . "', '0', '" . $c['dodge'] . "',
|
||||
'" . $d['nomod_dodge'] . "', '" . $c['parry'] . "', '" . $d['nomod_parry'] . "',
|
||||
'" . $d['hit'] . "', '" . $c['crit'] . "',
|
||||
'" . $d['nomod_crit'] . "', '" . $d['nomod_damage_min'] . "', '" . $d['nomod_damage_max'] . "',
|
||||
'" . $c['damage_min'] . "', '" . $c['damage_max'] . "',
|
||||
'" . $c['ranged_damage_min'] . "', '" . $c['ranged_damage_max'] . "',
|
||||
'" . $d['nomod_ranged_damage_min'] . "', '" . $d['nomod_ranged_damage_max'] . "',
|
||||
'" . $d['nomod_heal_min'] . "',
|
||||
'" . $d['nomod_heal_max'] . "', '" . $c['heal_min'] . "', '" . $c['heal_max'] . "')";
|
||||
|
||||
$this->db->query($sql);
|
||||
|
||||
$this->_create_sql($sql);
|
||||
}
|
||||
|
||||
//this is for templates (calculating all stats)
|
||||
//type can be add and edit -> edit does thing like armor calc, and damage
|
||||
function template_calc_stats($d, $type)
|
||||
{
|
||||
$class = $d['classname'];
|
||||
|
||||
$c['max_health'] = $this->hero_stat($class, 'max_health', $d);
|
||||
$c['max_mana'] = $this->hero_stat($class, 'max_mana', $d);
|
||||
|
||||
$c['attackpower'] = $this->hero_stat($class, 'attackpower', $d);
|
||||
|
||||
$c['crit'] = $this->hero_stat($class, 'crit', $d);
|
||||
$c['parry'] = $this->hero_stat($class, 'parry', $d);
|
||||
$c['dodge'] = $this->hero_stat($class, 'dodge', $d);
|
||||
|
||||
$c['damage_min'] = $this->hero_stat($class, 'damage_min', $d);
|
||||
$c['damage_max'] = $this->hero_stat($class, 'damage_max', $d);
|
||||
|
||||
$c['ranged_damage_min'] = $this->hero_stat($class, 'ranged_damage_min', $d);
|
||||
$c['ranged_damage_max'] = $this->hero_stat($class, 'ranged_damage_max', $d);
|
||||
|
||||
$c['heal_min'] = $this->hero_stat($class, 'heal_min', $d);
|
||||
$c['heal_max'] = $this->hero_stat($class, 'heal_max', $d);
|
||||
|
||||
if ($type == 'edit')
|
||||
{
|
||||
//STUB
|
||||
//armor, damage, heal from items
|
||||
$c['armor'] = 0;
|
||||
$c['nomod_damage_min'] = $d['nomod_damage_min'];
|
||||
$c['nomod_damage_max'] = $d['nomod_damage_max'];
|
||||
|
||||
$c['nomod_ranged_damage_min'] = $d['nomod_ranged_damage_min'];
|
||||
$c['nomod_ranged_damage_max'] = $d['nomod_ranged_damage_max'];
|
||||
|
||||
$c['nomod_heal_min'] = $d['nomod_heal_min'];
|
||||
$c['nomod_heal_max'] = $d['nomod_heal_max'];
|
||||
}
|
||||
|
||||
return $c;
|
||||
}
|
||||
}
|
||||
//nowhitesp
|
298
Mourne-CI/application/models/image_model.php
Executable file
298
Mourne-CI/application/models/image_model.php
Executable file
@ -0,0 +1,298 @@
|
||||
<?php
|
||||
class Image_model extends MO_Model
|
||||
{
|
||||
function __construct()
|
||||
{
|
||||
parent::__construct();
|
||||
}
|
||||
|
||||
function apply_menu_images($data)
|
||||
{
|
||||
$path = './img/generated/';
|
||||
|
||||
$this->load->library('image_lib');
|
||||
|
||||
if ($data['apply_all'])
|
||||
$this->prepare_dir('menu', $data['file'], $data['menu_group']);
|
||||
else
|
||||
$this->prepare_dir('menu', $data['file'], FALSE, $data['wm_text']);
|
||||
|
||||
|
||||
if (!$data['apply_all'])
|
||||
{
|
||||
$data['source_image'] = $path . $data['wm_text'] . '.png';
|
||||
|
||||
$this->image_lib->initialize($data);
|
||||
|
||||
$this->image_lib->watermark();
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
//apply all is set
|
||||
$menu_list = $this->get_menu_list($data['menu_group']);
|
||||
$menu_file_list = $this->get_menu_file_list($data['menu_group']);
|
||||
|
||||
for ($i = 0; $i < sizeof($menu_list); $i++)
|
||||
{
|
||||
$data['source_image'] = $path . $menu_file_list[$i] . '.png';
|
||||
$data['wm_text'] = $menu_list[$i];
|
||||
|
||||
$this->image_lib->initialize($data);
|
||||
$this->image_lib->watermark();
|
||||
$this->image_lib->clear();
|
||||
}
|
||||
}
|
||||
|
||||
function prepare_dir($for, $sourcefile, $group = 1, $filename = FALSE)
|
||||
{
|
||||
$path = './img/generated/';
|
||||
$source = './img/imggen/' . $sourcefile;
|
||||
|
||||
$this->load->helper('file');
|
||||
|
||||
delete_files($path, FALSE);
|
||||
|
||||
if ($for == 'menu')
|
||||
{
|
||||
$img = read_file($source);
|
||||
|
||||
if (!$filename)
|
||||
{
|
||||
$menu_list = $this->get_menu_file_list($group);
|
||||
|
||||
foreach ($menu_list as $row)
|
||||
{
|
||||
$file = $path . $row . '.png';
|
||||
|
||||
write_file($file, $img);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
$file = $path . $filename . '.png';
|
||||
|
||||
write_file($file, $img);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
function get_menu_list($group = 1)
|
||||
{
|
||||
if ($group == 1)
|
||||
{
|
||||
//select village vill be omitted since it will need a different style button with a ˇ
|
||||
$data[] = 'News';
|
||||
$data[] = 'Village';
|
||||
$data[] = 'Select Village';
|
||||
$data[] = 'Forum';
|
||||
$data[] = 'Changelog';
|
||||
$data[] = 'Settings';
|
||||
$data[] = 'Logout';
|
||||
$data[] = 'Forum Mod Panel';
|
||||
$data[] = 'GM Panel';
|
||||
$data[] = 'Admin Panel';
|
||||
}
|
||||
|
||||
if ($group == 2)
|
||||
{
|
||||
$data[] = 'Stats';
|
||||
}
|
||||
|
||||
return $data;
|
||||
}
|
||||
|
||||
function get_menu_file_list($group = 1)
|
||||
{
|
||||
if ($group == 1)
|
||||
{
|
||||
//select village vill be omitted since it will need a different style button with a ˇ
|
||||
$data[] = 'news';
|
||||
$data[] = 'village';
|
||||
$data[] = 'select_village';
|
||||
$data[] = 'forum';
|
||||
$data[] = 'changelog';
|
||||
$data[] = 'settings';
|
||||
$data[] = 'logout';
|
||||
$data[] = 'forum_mod_panel';
|
||||
$data[] = 'gm_panel';
|
||||
$data[] = 'admin_panel';
|
||||
}
|
||||
|
||||
if ($group == 2)
|
||||
{
|
||||
$data[] = 'stats';
|
||||
}
|
||||
|
||||
return $data;
|
||||
}
|
||||
|
||||
function get_menu_group_list_drop()
|
||||
{
|
||||
$data = array(
|
||||
'1' => 'main',
|
||||
'2' => 'alt1');
|
||||
|
||||
return $data;
|
||||
}
|
||||
|
||||
function apply_slot_images($data)
|
||||
{
|
||||
$path = './img/generated/';
|
||||
|
||||
$this->load->library('image_lib');
|
||||
|
||||
$this->prepare_dir('menu', $data['file'], FALSE, 'gen');
|
||||
|
||||
$data['source_image'] = $path . 'gen.png';
|
||||
|
||||
$this->image_lib->initialize($data);
|
||||
$this->image_lib->watermark();
|
||||
$this->image_lib->clear();
|
||||
|
||||
$data['wm_type'] = 'text';
|
||||
$data['wm_text'] = $data['rank_text'];
|
||||
$data['wm_font_size'] = $data['rank_font_size'];
|
||||
$data['wm_vrt_alignment'] = $data['rank_v_align'];
|
||||
$data['wm_hor_alignment'] = $data['rank_h_align'];
|
||||
$data['wm_hor_offset'] = $data['rank_h_offset'];
|
||||
$data['wm_vrt_offset'] = $data['rank_v_offset'];
|
||||
$data['padding'] = $data['rank_padding'];
|
||||
|
||||
$this->image_lib->initialize($data);
|
||||
$this->image_lib->watermark();
|
||||
|
||||
}
|
||||
|
||||
function get_file_list_drop()
|
||||
{
|
||||
$this->load->helper('directory');
|
||||
|
||||
$dir = directory_map('./img/imggen/', 1);
|
||||
|
||||
foreach ($dir as $row)
|
||||
{
|
||||
$a = explode('.', $row);
|
||||
if (isset($a[1]))
|
||||
if ($a[1] == 'png' || $a[1] == 'PNG')
|
||||
$data[$row] = $row;
|
||||
}
|
||||
|
||||
return $data;
|
||||
}
|
||||
|
||||
function get_font_list_drop()
|
||||
{
|
||||
$this->load->helper('directory');
|
||||
|
||||
$dir = directory_map('./system/fonts', 1);
|
||||
|
||||
foreach ($dir as $row)
|
||||
{
|
||||
$a = explode('.', $row);
|
||||
|
||||
if ($a[1] == 'ttf' || $a['1'] == 'TTF')
|
||||
{
|
||||
$data[$row] = $row;
|
||||
}
|
||||
}
|
||||
|
||||
return $data;
|
||||
}
|
||||
|
||||
function get_v_align_drop()
|
||||
{
|
||||
$data = array(
|
||||
'top' => 'top',
|
||||
'middle' => 'middle',
|
||||
'bottom' => 'bottom');
|
||||
|
||||
return $data;
|
||||
}
|
||||
|
||||
function get_h_align_drop()
|
||||
{
|
||||
$data = array(
|
||||
'left' => 'left',
|
||||
'center' => 'center',
|
||||
'right' => 'right');
|
||||
|
||||
return $data;
|
||||
}
|
||||
|
||||
function get_overlay_list_drop()
|
||||
{
|
||||
$this->load->helper('directory');
|
||||
|
||||
$dir = directory_map('./img/imggen/overlay/', 1);
|
||||
|
||||
foreach ($dir as $row)
|
||||
{
|
||||
$data[$row] = $row;
|
||||
}
|
||||
|
||||
return $data;
|
||||
}
|
||||
|
||||
function save_menu_data($data)
|
||||
{
|
||||
$a = 'type : ' . $data['wm_type'] . "\n";
|
||||
$a .= 'quality: ' . $data['quality'] . "\n";
|
||||
$a .= 'file: ' . $data['file'] . "\n";
|
||||
$a .= 'padding: ' . $data['padding'] . "\n";
|
||||
$a .= 'vert alignment: ' . $data['wm_vrt_alignment'] . "\n";
|
||||
$a .= 'hor alignment: ' . $data['wm_hor_alignment'] . "\n";
|
||||
$a .= 'hor offset: ' . $data['wm_hor_offset'] . "\n";
|
||||
$a .= 'vert offset: ' . $data['wm_vrt_offset'] . "\n";
|
||||
$a .= 'text: ' . $data['wm_text'] . "\n";
|
||||
$a .= 'font path: ' . $data['wm_font_path'] . "\n";
|
||||
$a .= 'font size: ' . $data['wm_font_size'] . "\n";
|
||||
$a .= 'font color: ' . $data['wm_font_color'] . "\n";
|
||||
$a .= 'shadow color: ' . $data['wm_shadow_color'] . "\n";
|
||||
$a .= 'shadow_distance: ' . $data['wm_shadow_distance'] . "\n";
|
||||
$a .= 'apply all: ' . $data['apply_all'] . "\n";
|
||||
$a .= 'Menu Group: ' . $data['menu_group'] . "\n";
|
||||
|
||||
$this->load->helper('file');
|
||||
|
||||
write_file('./img/generated/settings.txt', $a);
|
||||
}
|
||||
|
||||
function save_slot_data($data)
|
||||
{
|
||||
$a = 'type : ' . $data['wm_type'] . "\n";
|
||||
$a .= 'quality: ' . $data['quality'] . "\n";
|
||||
$a .= 'file: ' . $data['file'] . "\n";
|
||||
$a .= 'padding: ' . $data['padding'] . "\n";
|
||||
$a .= 'vert alignment: ' . $data['wm_vrt_alignment'] . "\n";
|
||||
$a .= 'hor alignment: ' . $data['wm_hor_alignment'] . "\n";
|
||||
$a .= 'hor offset: ' . $data['wm_hor_offset'] . "\n";
|
||||
$a .= 'vert offset: ' . $data['wm_vrt_offset'] . "\n";
|
||||
$a .= 'text: ' . $data['wm_text'] . "\n";
|
||||
$a .= 'font path: ' . $data['wm_font_path'] . "\n";
|
||||
$a .= 'font size: ' . $data['wm_font_size'] . "\n";
|
||||
$a .= 'font color: ' . $data['wm_font_color'] . "\n";
|
||||
$a .= 'shadow color: ' . $data['wm_shadow_color'] . "\n";
|
||||
$a .= 'shadow_distance: ' . $data['wm_shadow_distance'] . "\n";
|
||||
$a .= '------------------------image---------------------------' . "\n";
|
||||
$a .= 'overlay image: ' . $data['wm_overlay_path'] . "\n";
|
||||
$a .= 'opacity: ' . $data['wm_opacity'] . "\n";
|
||||
$a .= 'x transp: ' . $data['wm_x_transp'] . "\n";
|
||||
$a .= 'y transp: ' . $data['wm_y_transp'] . "\n";
|
||||
$a .= '------------------------rank----------------------------' . "\n";
|
||||
$a .= 'text: ' . $data['rank_text'] . "\n";
|
||||
$a .= 'font size: ' . $data['rank_font_size'] . "\n";
|
||||
$a .= 'V align: ' . $data['rank_v_align'] . "\n";
|
||||
$a .= 'H align: ' . $data['rank_h_align'] . "\n";
|
||||
$a .= 'H offset: ' . $data['rank_h_offset'] . "\n";
|
||||
$a .= 'V offset: ' . $data['rank_v_offset'] . "\n";
|
||||
$a .= 'padding: ' . $data['rank_padding'] . "\n";
|
||||
|
||||
$this->load->helper('file');
|
||||
|
||||
write_file('./img/generated/settings.txt', $a);
|
||||
}
|
||||
}
|
||||
//nowhitesp
|
10
Mourne-CI/application/models/index.html
Executable file
10
Mourne-CI/application/models/index.html
Executable file
@ -0,0 +1,10 @@
|
||||
<html>
|
||||
<head>
|
||||
<title>403 Forbidden</title>
|
||||
</head>
|
||||
<body>
|
||||
|
||||
<p>Directory access is forbidden.</p>
|
||||
|
||||
</body>
|
||||
</html>
|
676
Mourne-CI/application/models/item_model.php
Normal file
676
Mourne-CI/application/models/item_model.php
Normal file
@ -0,0 +1,676 @@
|
||||
<?php
|
||||
|
||||
class Item_model extends MO_Model
|
||||
{
|
||||
const MAX_EQUIPMENT = 20; //19, starts with zero
|
||||
|
||||
function __construct()
|
||||
{
|
||||
parent::__construct();
|
||||
}
|
||||
|
||||
//this will equip too if needed!
|
||||
function swap($d1, $d2, $d3, $d4)
|
||||
{
|
||||
//data validation
|
||||
if (!($d1 == 'iv' || $d1 == 'eq') || !($d3 == 'iv' || $d3 == 'eq') || !is_numeric($d2) ||
|
||||
!is_numeric($d4) || ($d2 < 0 || $d2 > (parent::INVENTORY_MAX - 1)) ||
|
||||
($d4 < 0 || $d4 > (parent::INVENTORY_MAX - 1)))
|
||||
return FALSE;
|
||||
|
||||
//nothing needs to be done (same item twice)
|
||||
if (($d1 == $d3) && ($d2 == $d4))
|
||||
return TRUE;
|
||||
|
||||
//hero has to be set from controller!
|
||||
if (!$this->hero)
|
||||
return 'Internal error';
|
||||
|
||||
//just move in inventory
|
||||
if ($d1 == 'iv' && $d3 == 'iv')
|
||||
{
|
||||
$sql = "SELECT * FROM heros_inventory
|
||||
WHERE container = 1 AND (slot = ? OR slot = ?) AND charid = ?";
|
||||
|
||||
$q = $this->db->query($sql, array($d2, $d4, $this->hero['id']));
|
||||
|
||||
$num = $q->num_rows();
|
||||
|
||||
if (!$num)
|
||||
return FALSE;
|
||||
|
||||
$res = $q->result_array();
|
||||
|
||||
$item1 = $res[0];
|
||||
|
||||
if ($num == 2)
|
||||
$item2 = $res[1];
|
||||
else
|
||||
$item2 = FALSE;
|
||||
|
||||
if (!$item2)
|
||||
{
|
||||
$sql = "UPDATE heros_inventory
|
||||
SET slot = ?
|
||||
WHERE id = ?";
|
||||
|
||||
if ($item1['slot'] == $d2)
|
||||
$to = $d4;
|
||||
else
|
||||
$to = $d2;
|
||||
|
||||
$this->db->query($sql, array($to, $item1['id']));
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
//we only get here it two items needs to be swapped
|
||||
$sql = "UPDATE heros_inventory SET slot = ? WHERE id = ?";
|
||||
|
||||
$this->db->query($sql, array($item1['slot'], $item2['id']));
|
||||
$this->db->query($sql, array($item2['slot'], $item1['id']));
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
//equipping has to be performed (iv/iv case already handled!)
|
||||
if ($d1 == 'iv')
|
||||
$d1 = 1;
|
||||
else
|
||||
$d1 = 2;
|
||||
|
||||
if ($d3 == 'iv')
|
||||
$d3 = 1;
|
||||
else
|
||||
$d3 = 2;
|
||||
|
||||
|
||||
$sql = "SELECT heros_inventory.id AS invid,heros_inventory.is_soulbound,heros_inventory.stack_size,
|
||||
heros_inventory.container,heros_inventory.slot,hero_items.*
|
||||
FROM heros_inventory
|
||||
LEFT JOIN hero_items on heros_inventory.itemid = hero_items.id
|
||||
WHERE ((heros_inventory.container = ? AND heros_inventory.slot = ?) OR
|
||||
(heros_inventory.container = ? AND heros_inventory.slot = ?)) AND
|
||||
charid = ?";
|
||||
|
||||
$q = $this->db->query($sql, array($d1, $d2, $d3, $d4, $this->hero['id']));
|
||||
|
||||
$swap = FALSE;
|
||||
|
||||
$num = $q->num_rows();
|
||||
|
||||
if ($num == 2)
|
||||
{
|
||||
$res = $q->result_array();
|
||||
|
||||
if ($res[0]['container'] == 1)
|
||||
{
|
||||
//0 is in bag
|
||||
$equip = $res[0];
|
||||
$deequip = $res[1];
|
||||
}
|
||||
elseif ($res[1]['container'] == 1)
|
||||
{
|
||||
//1 is in bag
|
||||
$equip = $res[1];
|
||||
$deequip = $res[0];
|
||||
}
|
||||
else
|
||||
{
|
||||
//swap
|
||||
$equip = $res[0];
|
||||
$deequip = $res[1];
|
||||
$swap = TRUE;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
$res = $q->row_array();
|
||||
|
||||
if ($res['container'] == 1)
|
||||
{
|
||||
//not equipped, just equip it
|
||||
$equip = $res;
|
||||
$deequip = FALSE;
|
||||
|
||||
if ($d1 == 1)
|
||||
$equipslot = $d4;
|
||||
else
|
||||
$equipslot = $d2;
|
||||
}
|
||||
else
|
||||
{
|
||||
if ($d1 == 2 && $d3 == 2)
|
||||
{
|
||||
//switching between 2 equipslots, but one of them is empty
|
||||
$equip = $res;
|
||||
$deequip = FALSE;
|
||||
|
||||
if ($equip['slot'] == $d2)
|
||||
$equipslot = $d4;
|
||||
else
|
||||
$equipslot = $d2;
|
||||
|
||||
$swap = TRUE;
|
||||
}
|
||||
else
|
||||
{
|
||||
//equipped, just deequip it
|
||||
$equip = FALSE;
|
||||
$deequip = $res;
|
||||
|
||||
if ($d1 == 2)
|
||||
$deequipslot = $d4;
|
||||
else
|
||||
$deequipslot = $d2;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
$this->load->helper('equipment');
|
||||
|
||||
if ($equip)
|
||||
{
|
||||
//$cbe = can be equipped
|
||||
$cbe = can_be_equipped($equip, $this->hero);
|
||||
|
||||
if (!isset($cbe))
|
||||
return "Internal error! $cbe is not set!";
|
||||
}
|
||||
|
||||
//each of these functions has to return!
|
||||
|
||||
//for switching items from inventory
|
||||
if ($equip && $deequip && !$swap)
|
||||
{
|
||||
if ($cbe['can'] === TRUE)
|
||||
{
|
||||
if ($cbe['allowed_slot1'] == $deequip['slot'] || $cbe['allowed_slot2'] == $deequip['slot'])
|
||||
$equipslot = $deequip['slot'];
|
||||
|
||||
if (!isset($equipslot))
|
||||
return "That item cannot be equipped into that slot.";
|
||||
|
||||
if ($cbe['two_handed'])
|
||||
{
|
||||
$eq = $this->prep_two_hand();
|
||||
|
||||
if ($eq !== TRUE)
|
||||
return $eq;
|
||||
}
|
||||
|
||||
$this->hero_remove_stats($deequip);
|
||||
$this->hero_add_stats($equip);
|
||||
|
||||
$sql = "UPDATE heros_inventory SET container = ?, slot = ? WHERE id = ?";
|
||||
|
||||
//deequipping
|
||||
$this->db->query($sql, array(1, $equip['slot'], $deequip['invid']));
|
||||
|
||||
//equip
|
||||
$this->db->query($sql, array(2, $equipslot, $equip['invid']));
|
||||
|
||||
$this->calc_hero_stats();
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
else
|
||||
{
|
||||
return $cbe['message'];
|
||||
}
|
||||
}
|
||||
|
||||
//switching between 2 slots
|
||||
if ($equip && $deequip && $swap)
|
||||
{
|
||||
if (!(($cbe['allowed_slot1'] == $equip['slot'] || $cbe['allowed_slot2'] == $equip['slot']) &&
|
||||
($cbe['allowed_slot1'] == $deequip['slot'] || $cbe['allowed_slot2'] == $deequip['slot'])))
|
||||
return "Those items cannot be swapped";
|
||||
|
||||
$sql = "UPDATE heros_inventory SET slot = ? WHERE id = ?";
|
||||
|
||||
$this->db->query($sql, array($equip['slot'], $deequip['invid']));
|
||||
$this->db->query($sql, array($deequip['slot'], $equip['invid']));
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
//just deequip
|
||||
if ($deequip && !$swap)
|
||||
{
|
||||
$sql = "UPDATE heros_inventory SET container = 1, slot = ? WHERE id = ?";
|
||||
|
||||
$this->db->query($sql, array($deequipslot, $deequip['invid']));
|
||||
|
||||
$this->hero_remove_stats($deequip);
|
||||
$this->calc_hero_stats();
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
//just equip
|
||||
if ($equip && !$swap)
|
||||
{
|
||||
if (!$cbe['can'])
|
||||
return $cbe['message'];
|
||||
|
||||
if (!($cbe['allowed_slot1'] == $equipslot || $cbe['allowed_slot2'] == $equipslot))
|
||||
return 'That item cannot be equipped into that slot.';
|
||||
|
||||
if ($cbe['two_handed'])
|
||||
{
|
||||
$eq = $this->prep_two_hand();
|
||||
|
||||
if ($eq !== TRUE)
|
||||
return $eq;
|
||||
}
|
||||
|
||||
$sql = "UPDATE heros_inventory SET container = 2, slot = ? WHERE id = ?";
|
||||
|
||||
$this->db->query($sql, array($equipslot, $equip['invid']));
|
||||
|
||||
$this->hero_add_stats($equip);
|
||||
$this->calc_hero_stats();
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
//switching between two equipslots, when one of the slots is empty
|
||||
if ($swap)
|
||||
{
|
||||
if (!($cbe['allowed_slot1'] == $equipslot || $cbe['allowed_slot2'] == $equipslot))
|
||||
return "That item cannot be equipped into that slot";
|
||||
|
||||
$sql = "UPDATE heros_inventory SET slot = ? WHERE id = ?";
|
||||
|
||||
$this->db->query($sql, array($equipslot, $equip['invid']));
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
//unequips the off hand, if the user wants to equip a two-hand wep
|
||||
function prep_two_hand()
|
||||
{
|
||||
$sql = "SELECT heros_inventory.id AS invid,heros_inventory.is_soulbound,heros_inventory.stack_size,
|
||||
heros_inventory.container,heros_inventory.slot,hero_items.*
|
||||
FROM heros_inventory
|
||||
LEFT JOIN hero_items on heros_inventory.itemid = hero_items.id
|
||||
WHERE (heros_inventory.container = 2 AND heros_inventory.slot = 17) AND
|
||||
charid = ?";
|
||||
|
||||
$q = $this->db->query($sql, array($this->hero['id']));
|
||||
|
||||
if (!$q->num_rows())
|
||||
return TRUE;
|
||||
|
||||
$res = $q->row_array();
|
||||
|
||||
//find an empty place
|
||||
$sql = "SELECT * FROM heros_inventory WHERE container = 1 AND charid = ?";
|
||||
|
||||
$q = $this->db->query($sql, array($this->hero['id']));
|
||||
|
||||
$slot = FALSE;
|
||||
|
||||
if ($q->num_rows())
|
||||
{
|
||||
$inv = $q->result_array();
|
||||
|
||||
for ($i = 0; $i < parent::INVENTORY_MAX; $i++)
|
||||
{
|
||||
$found = FALSE;
|
||||
|
||||
foreach ($inv as $row)
|
||||
{
|
||||
if ($row['slot'] == $i)
|
||||
{
|
||||
$found = TRUE;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (!$found)
|
||||
{
|
||||
$slot = $i;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
$slot = 0;
|
||||
}
|
||||
|
||||
if ($slot === FALSE)
|
||||
return "You don't have any space in your inventory, to unequip the off hand.";
|
||||
|
||||
$this->hero_remove_stats($res);
|
||||
|
||||
$sql = "UPDATE heros_inventory SET slot = ?, container = 1 WHERE id = ?";
|
||||
|
||||
$this->db->query($sql, array($slot, $res['invid']));
|
||||
|
||||
return TRUE;
|
||||
|
||||
}
|
||||
|
||||
//returns ['equipment'], ['money'], ['inventory']
|
||||
function get_inventory($charid)
|
||||
{
|
||||
$sql = "SELECT heros_inventory.is_soulbound,heros_inventory.stack_size,heros_inventory.container,
|
||||
heros_inventory.slot,hero_items.*
|
||||
FROM heros_inventory
|
||||
LEFT JOIN hero_items ON heros_inventory.itemid=hero_items.id
|
||||
WHERE charid = ?";
|
||||
|
||||
$q = $this->db->query($sql, array($charid));
|
||||
|
||||
if ($q->num_rows())
|
||||
$res = $q->result_array();
|
||||
else
|
||||
$res = FALSE;
|
||||
|
||||
$found = FALSE;
|
||||
for ($i = 0; $i < parent::INVENTORY_MAX; $i++)
|
||||
{
|
||||
if ($res)
|
||||
{
|
||||
foreach ($res as $row)
|
||||
{
|
||||
if ($row['container'] == 1 && $row['slot'] == $i)
|
||||
{
|
||||
$data[] = $row;
|
||||
$found = TRUE;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (!$found)
|
||||
{
|
||||
$data[] = FALSE;
|
||||
}
|
||||
|
||||
$found = FALSE;
|
||||
}
|
||||
else
|
||||
{
|
||||
$data[] = FALSE;
|
||||
}
|
||||
}
|
||||
|
||||
//sort it
|
||||
|
||||
$r['inventory'] = $data;
|
||||
|
||||
if ($res)
|
||||
{
|
||||
foreach ($res as $row)
|
||||
{
|
||||
if ($row['container'] == 0)
|
||||
{
|
||||
$money = $row;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (isset($money))
|
||||
$r['money'] = $money;
|
||||
else
|
||||
$r['money'] = 0;
|
||||
|
||||
//equipment
|
||||
$found = FALSE;
|
||||
for ($i = 0; $i < self::MAX_EQUIPMENT; $i++)
|
||||
{
|
||||
if ($res)
|
||||
{
|
||||
foreach ($res as $row)
|
||||
{
|
||||
if ($row['container'] == 2 && $row['slot'] == $i)
|
||||
{
|
||||
$eq[] = $row;
|
||||
$found = TRUE;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (!$found)
|
||||
{
|
||||
$eq[] = FALSE;
|
||||
}
|
||||
|
||||
$found = FALSE;
|
||||
}
|
||||
else
|
||||
$eq[] = FALSE;
|
||||
}
|
||||
|
||||
$r['equipment'] = $eq;
|
||||
|
||||
//sort it, if needed
|
||||
$found = FALSE;
|
||||
if ($res)
|
||||
{
|
||||
for ($i = 0; $i < self::MAX_EQUIPMENT; $i++)
|
||||
{
|
||||
foreach ($eq as $row)
|
||||
{
|
||||
if ($row && $row['slot'] == $i)
|
||||
{
|
||||
$seq[] = $row;
|
||||
$found = TRUE;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (!$found)
|
||||
{
|
||||
$seq[] = FALSE;
|
||||
}
|
||||
|
||||
$found = FALSE;
|
||||
}
|
||||
|
||||
$r['equipment'] = $seq;
|
||||
}
|
||||
|
||||
return $r;
|
||||
|
||||
}
|
||||
|
||||
function add_item_admin($data)
|
||||
{
|
||||
$sql = "INSERT INTO hero_items
|
||||
VALUES(default,
|
||||
" . $this->db->escape($data['name']) . ",
|
||||
" . $this->db->escape($data['icon']) . ",
|
||||
'" . $data['quality'] . "',
|
||||
'" . $data['itemlevel'] . "',
|
||||
'" . $data['stack'] . "',
|
||||
'" . $data['type'] . "',
|
||||
'" . $data['subtype'] . "',
|
||||
'" . $data['subsubtype'] . "',
|
||||
'" . $data['sell_price'] . "',
|
||||
'" . $data['buy_price'] . "',
|
||||
" . $this->db->escape($data['text']) . ",
|
||||
'" . $data['soulbound'] . "',
|
||||
'" . $data['spell'] . "',
|
||||
'" . $data['proc'] . "',
|
||||
'" . $data['req_level'] . "',
|
||||
'" . $data['req_class'] . "',
|
||||
'" . $data['nomod_max_health'] . "',
|
||||
'" . $data['nomod_max_mana'] . "',
|
||||
'" . $data['percent_max_health'] . "',
|
||||
'" . $data['percent_max_mana'] . "',
|
||||
'" . $data['nomod_agility'] . "',
|
||||
'" . $data['nomod_strength'] . "',
|
||||
'" . $data['nomod_stamina'] . "',
|
||||
'" . $data['nomod_intellect'] . "',
|
||||
'" . $data['nomod_spirit'] . "',
|
||||
'" . $data['percent_agility'] . "',
|
||||
'" . $data['percent_strength'] . "',
|
||||
'" . $data['percent_stamina'] . "',
|
||||
'" . $data['percent_intellect'] . "',
|
||||
'" . $data['percent_spirit'] . "',
|
||||
'" . $data['nomod_attackpower'] . "',
|
||||
'" . $data['percent_attackpower'] . "',
|
||||
'" . $data['nomod_armor'] . "',
|
||||
'" . $data['percent_armor'] . "',
|
||||
'" . $data['nomod_dodge'] . "',
|
||||
'" . $data['nomod_parry'] . "',
|
||||
'" . $data['hit'] . "',
|
||||
'" . $data['nomod_crit'] . "',
|
||||
'" . $data['nomod_damage_min'] . "',
|
||||
'" . $data['nomod_damage_max'] . "',
|
||||
'" . $data['percent_damage_min'] . "',
|
||||
'" . $data['percent_damage_max'] . "',
|
||||
'" . $data['nomod_ranged_damage_min'] . "',
|
||||
'" . $data['nomod_ranged_damage_max'] . "',
|
||||
'" . $data['percent_ranged_damage_min'] . "',
|
||||
'" . $data['percent_ranged_damage_max'] . "',
|
||||
'" . $data['nomod_heal_min'] . "',
|
||||
'" . $data['nomod_heal_max'] . "',
|
||||
'" . $data['percent_heal_min'] . "',
|
||||
'" . $data['percent_heal_max'] . "',
|
||||
'" . $data['life_leech'] . "',
|
||||
'" . $data['mana_leech'] . "',
|
||||
'" . $data['level_modifier'] . "',
|
||||
'" . $data['level_modifier_max'] . "',
|
||||
'" . $data['data1'] . "',
|
||||
'" . $data['data2'] . "')";
|
||||
|
||||
$this->db->query($sql);
|
||||
|
||||
$this->_create_sql($sql);
|
||||
}
|
||||
|
||||
function edit_item_admin($data)
|
||||
{
|
||||
$sql = "UPDATE hero_items
|
||||
SET name = " . $this->db->escape($data['name']) . ",
|
||||
icon = " . $this->db->escape($data['icon']) . ",
|
||||
quality = '" . $data['quality'] . "',
|
||||
itemlevel = '" . $data['itemlevel'] . "',
|
||||
stack = '" . $data['stack'] . "',
|
||||
type = '" . $data['type'] . "',
|
||||
subtype = '" . $data['subtype'] . "',
|
||||
subsubtype = '" . $data['subsubtype'] . "',
|
||||
sell_price = '" . $data['sell_price'] . "',
|
||||
buy_price = '" . $data['buy_price'] . "',
|
||||
text = " . $this->db->escape($data['text']) . ",
|
||||
soulbound = '" . $data['soulbound'] . "',
|
||||
spell = '" . $data['spell'] . "',
|
||||
proc = '" . $data['proc'] . "',
|
||||
req_level = '" . $data['req_level'] . "',
|
||||
req_class = '" . $data['req_class'] . "',
|
||||
nomod_max_health = '" . $data['nomod_max_health'] . "',
|
||||
nomod_max_mana = '" . $data['nomod_max_mana'] . "',
|
||||
percent_max_health = '" . $data['percent_max_health'] . "',
|
||||
percent_max_mana = '" . $data['percent_max_mana'] . "',
|
||||
nomod_agility = '" . $data['nomod_agility'] . "',
|
||||
nomod_strength = '" . $data['nomod_strength'] . "',
|
||||
nomod_stamina = '" . $data['nomod_stamina'] . "',
|
||||
nomod_intellect = '" . $data['nomod_intellect'] . "',
|
||||
nomod_spirit = '" . $data['nomod_spirit'] . "',
|
||||
percent_agility = '" . $data['percent_agility'] . "',
|
||||
percent_strength = '" . $data['percent_strength'] . "',
|
||||
percent_Stamina = '" . $data['percent_stamina'] . "',
|
||||
percent_intellect = '" . $data['percent_intellect'] . "',
|
||||
percent_spirit = '" . $data['percent_spirit'] . "',
|
||||
nomod_attackpower = '" . $data['nomod_attackpower'] . "',
|
||||
percent_attackpower = '" . $data['percent_attackpower'] . "',
|
||||
nomod_armor = '" . $data['nomod_armor'] . "',
|
||||
percent_armor = '" . $data['percent_armor'] . "',
|
||||
nomod_dodge = '" . $data['nomod_dodge'] . "',
|
||||
nomod_parry = '" . $data['nomod_parry'] . "',
|
||||
hit = '" . $data['hit'] . "',
|
||||
nomod_Crit = '" . $data['nomod_crit'] . "',
|
||||
nomod_damage_min = '" . $data['nomod_damage_min'] . "',
|
||||
nomod_damage_max = '" . $data['nomod_damage_max'] . "',
|
||||
percent_damage_min = '" . $data['percent_damage_min'] . "',
|
||||
percent_damage_max = '" . $data['percent_damage_max'] . "',
|
||||
nomod_ranged_damage_min = '" . $data['nomod_ranged_damage_min'] . "',
|
||||
nomod_ranged_damage_max = '" . $data['nomod_ranged_damage_max'] . "',
|
||||
percent_ranged_damage_min = '" . $data['percent_ranged_damage_min'] . "',
|
||||
percent_ranged_damage_max = '" . $data['percent_ranged_damage_max'] . "',
|
||||
nomod_heal_min = '" . $data['nomod_heal_min'] . "',
|
||||
nomod_heal_max = '" . $data['nomod_heal_max'] . "',
|
||||
percent_heal_min = '" . $data['percent_heal_min'] . "',
|
||||
percent_heal_max = '" . $data['percent_heal_max'] . "',
|
||||
life_leech = '" . $data['life_leech'] . "',
|
||||
mana_leech = '" . $data['mana_leech'] . "',
|
||||
level_modifier = '" . $data['level_modifier'] . "',
|
||||
level_modifier_max = '" . $data['level_modifier_max'] . "',
|
||||
data1 = '" . $data['data1'] . "',
|
||||
data2 = '" . $data['data2'] . "'
|
||||
WHERE id = '" . $data['id'] . "'";
|
||||
|
||||
$this->db->query($sql);
|
||||
|
||||
$this->_create_sql($sql);
|
||||
}
|
||||
|
||||
function get_item_admin($id)
|
||||
{
|
||||
$sql = "SELECT * FROM hero_items WHERE id = ?";
|
||||
|
||||
$q = $this->db->query($sql, array($id));
|
||||
|
||||
if ($q->num_rows())
|
||||
return $q->row_array();
|
||||
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
function all_items_admin()
|
||||
{
|
||||
$sql = "SELECT * FROM hero_items";
|
||||
|
||||
$q = $this->db->query($sql);
|
||||
|
||||
if ($q->num_rows())
|
||||
return $q->result_array();
|
||||
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
function all_items_drop_admin()
|
||||
{
|
||||
$sql = "SELECT * FROM hero_items";
|
||||
|
||||
$q = $this->db->query($sql);
|
||||
|
||||
if (!$q->num_rows())
|
||||
return FALSE;
|
||||
|
||||
$res = $q->result_array();
|
||||
|
||||
foreach ($res as $row)
|
||||
{
|
||||
$data[$row['id']] = $row['name'];
|
||||
}
|
||||
|
||||
if (!isset($data))
|
||||
return FALSE;
|
||||
|
||||
return $data;
|
||||
}
|
||||
|
||||
function get_class_item_templates($classid)
|
||||
{
|
||||
$sql = "SELECT * FROM hero_inventory_templates WHERE classid = ?";
|
||||
|
||||
$q = $this->db->query($sql, array($classid));
|
||||
|
||||
if ($q->num_rows())
|
||||
return $q->result_array();
|
||||
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
}
|
||||
//nowhitesp
|
82
Mourne-CI/application/models/log_model.php
Executable file
82
Mourne-CI/application/models/log_model.php
Executable file
@ -0,0 +1,82 @@
|
||||
<?php
|
||||
class Log_model extends MO_Model
|
||||
{
|
||||
function __construct()
|
||||
{
|
||||
parent::__construct();
|
||||
}
|
||||
|
||||
function delete_combat_log($id, $villageid)
|
||||
{
|
||||
$sql = "SELECT * FROM combat_logs WHERE id='$id'";
|
||||
|
||||
$q = $this->db->query($sql);
|
||||
|
||||
if (!$q->num_rows())
|
||||
return;
|
||||
|
||||
$res = $q->row_array();
|
||||
|
||||
if ($res['villageid'] != $villageid)
|
||||
return;
|
||||
|
||||
$sql = "DELETE FROM combat_logs WHERE id='$id'";
|
||||
|
||||
$this->db->query($sql);
|
||||
}
|
||||
|
||||
function get_combat_log($id, $villageid)
|
||||
{
|
||||
$sql = "SELECT * FROM combat_logs WHERE id='$id'";
|
||||
|
||||
$q = $this->db->query($sql);
|
||||
|
||||
if (!$q->num_rows())
|
||||
return FALSE;
|
||||
|
||||
$res = $q->row_array();
|
||||
|
||||
if ($res['villageid'] != $villageid)
|
||||
return FALSE;
|
||||
|
||||
if ($res['new'])
|
||||
{
|
||||
$sql = "UPDATE combat_logs SET new='0' WHERE id='$id'";
|
||||
$this->db->query($sql);
|
||||
}
|
||||
|
||||
return $res;
|
||||
}
|
||||
|
||||
function get_combat_logs($villageid)
|
||||
{
|
||||
$sql = "SELECT * FROM combat_logs WHERE villageid='$villageid' ORDER BY time DESC";
|
||||
|
||||
$q = $this->db->query($sql);
|
||||
|
||||
if (!$q->num_rows())
|
||||
return FALSE;
|
||||
|
||||
$res = $q->result_array();
|
||||
|
||||
$new = FALSE;
|
||||
foreach ($res as $row)
|
||||
{
|
||||
if ($row['new'])
|
||||
{
|
||||
$new = TRUE;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (!$new)
|
||||
{
|
||||
$sql = "UPDATE villages SET new_log='0' WHERE id='$villageid'";
|
||||
|
||||
$this->db->query($sql);
|
||||
}
|
||||
|
||||
return $res;
|
||||
}
|
||||
}
|
||||
//nowhitesp
|
234
Mourne-CI/application/models/mail_model.php
Executable file
234
Mourne-CI/application/models/mail_model.php
Executable file
@ -0,0 +1,234 @@
|
||||
<?php
|
||||
|
||||
class Mail_model extends MO_Model
|
||||
{
|
||||
function __construct()
|
||||
{
|
||||
parent::__construct();
|
||||
}
|
||||
|
||||
function save_draft($data, $userid)
|
||||
{
|
||||
//values id, userid, friend, name, X, Y, time, subject, body
|
||||
$sql = "INSERT INTO mail_drafts
|
||||
VALUES(default, '$userid', ?, ?, ?, ?, '" . time() . "', ?, ?)";
|
||||
|
||||
//friend, name, X, Y, subject, body
|
||||
$this->db->query($sql, array(0, $data['name'], 0, 0, $data['subject'], $data['message']));
|
||||
}
|
||||
|
||||
function get_drafts($userid)
|
||||
{
|
||||
$sql = "SELECT * FROM mail_drafts WHERE userid='$userid'";
|
||||
|
||||
$q = $this->db->query($sql);
|
||||
|
||||
if (!$q->num_rows())
|
||||
return FALSE;
|
||||
|
||||
return $q->result_array();
|
||||
}
|
||||
|
||||
function get_draft($id, $userid)
|
||||
{
|
||||
$sql = "SELECT * FROM mail_drafts WHERE id = ?";
|
||||
|
||||
$q = $this->db->query($sql, array($id));
|
||||
|
||||
if (!$q->num_rows())
|
||||
return FALSE;
|
||||
|
||||
$res = $q->row_array();
|
||||
|
||||
if ($res['userid'] != $userid)
|
||||
return FALSE;
|
||||
|
||||
return $res;
|
||||
}
|
||||
|
||||
function delete_draft($id, $userid)
|
||||
{
|
||||
$sql = "DELETE FROM mail_drafts WHERE id = ? AND userid = ?";
|
||||
|
||||
$this->db->query($sql, array($id, $userid));
|
||||
}
|
||||
|
||||
function get_inbox($userid, $new)
|
||||
{
|
||||
$sql = "SELECT mails.*,users.username FROM mails
|
||||
LEFT JOIN users on mails.sender=users.id
|
||||
WHERE owner='$userid'
|
||||
ORDER BY time DESC";
|
||||
|
||||
$q = $this->db->query($sql);
|
||||
|
||||
if (!$q->num_rows())
|
||||
return FALSE;
|
||||
|
||||
$res = $q->result_array();
|
||||
|
||||
if (!$new)
|
||||
return $res;
|
||||
|
||||
$found = FALSE;
|
||||
foreach ($res as $row)
|
||||
{
|
||||
if ($row['new'])
|
||||
{
|
||||
$found = TRUE;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if ($found)
|
||||
return $res;
|
||||
|
||||
$sql = "UPDATE users SET new_mail='0' WHERE id='$userid'";
|
||||
|
||||
$this->db->query($sql);
|
||||
|
||||
return $res;
|
||||
}
|
||||
|
||||
function send_message($data, $userid)
|
||||
{
|
||||
$sql = "SELECT * FROM users WHERE username = ?";
|
||||
|
||||
$q = $this->db->query($sql, array($data['name']));
|
||||
|
||||
if (!$q->num_rows())
|
||||
return;
|
||||
|
||||
$res = $q->row_array();
|
||||
|
||||
$data['subject'] = htmlspecialchars($data['subject'], ENT_HTML5, 'UTF-8');
|
||||
|
||||
if (strlen($data['subject']) >= 45)
|
||||
$data['subject'] = (substr($data['subject'], 0, 45) . '...');
|
||||
|
||||
//determining line endings
|
||||
$w = substr_count($data['message'], "\r\n");
|
||||
|
||||
if ($w)
|
||||
$exp = "\r\n";
|
||||
else
|
||||
$exp = "\n";
|
||||
|
||||
$message = explode($exp, $data['message']);
|
||||
|
||||
if ($message)
|
||||
{
|
||||
$d = "";
|
||||
foreach ($message as $row)
|
||||
{
|
||||
if (strlen($row) > 70)
|
||||
{
|
||||
//split into multiple lines
|
||||
for ($i = 0; $i <= (floor(strlen($row) / 70)); $i++)
|
||||
{
|
||||
|
||||
$sub = substr($row, (0 + ($i * 70)), 70);
|
||||
|
||||
$d .= $sub;
|
||||
|
||||
if (strlen($sub) == 70)
|
||||
$d .= "«";
|
||||
|
||||
$d .= "\r\n";
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
$d .= $row . "\r\n";
|
||||
}
|
||||
}
|
||||
|
||||
$data['message'] = $d;
|
||||
}
|
||||
|
||||
$data['message'] = htmlspecialchars($data['message'], ENT_HTML5, 'UTF-8');
|
||||
|
||||
$breaks = array("\r\n", "\n");
|
||||
$text = str_ireplace($breaks, "<br />", $data['message']);
|
||||
|
||||
$sql = "INSERT INTO mails VALUES(default,
|
||||
'" . $res['id'] . "', '$userid', '" . time() . "', ?, ?, '1')";
|
||||
|
||||
$this->db->query($sql, array($data['subject'], $text));
|
||||
|
||||
$sql = "UPDATE users SET new_mail='1' WHERE id='" . $res['id'] . "'";
|
||||
|
||||
$this->db->query($sql);
|
||||
|
||||
//saving mail to sent
|
||||
//id, userid, to_id, to, time, subject, body
|
||||
$sql = "INSERT INTO mail_sent VALUES(default, ?, ?, ?, " . time(). ", ?, ?)";
|
||||
|
||||
$sent = array($userid, $res['id'], $res['username'], $data['subject'], $data['message']);
|
||||
|
||||
$this->db->query($sql, $sent);
|
||||
}
|
||||
|
||||
function get_mail($id, $userid, $edit = FALSE)
|
||||
{
|
||||
//querying userid here, so if the user types a random id into the browser bar, it won't return anything
|
||||
$sql = "SELECT mails.*,users.username FROM mails
|
||||
LEFT JOIN users ON mails.sender=users.id
|
||||
WHERE mails.id = ? AND mails.owner = ?";
|
||||
|
||||
$q = $this->db->query($sql, array($id, $userid));
|
||||
|
||||
if (!$q->num_rows())
|
||||
return FALSE;
|
||||
|
||||
$res = $q->row_array();
|
||||
|
||||
if ($res['new'])
|
||||
{
|
||||
//userid is correct we can query with just the id
|
||||
$sql = "UPDATE mails SET new='0' WHERE id = ?";
|
||||
|
||||
$this->db->query($sql, array($id));
|
||||
}
|
||||
|
||||
if ($edit)
|
||||
{
|
||||
//just in case
|
||||
$breaks = array("<br />","<br>","<br/>");
|
||||
|
||||
$data['body'] = str_ireplace($breaks, "\r\n", $data['body']);
|
||||
|
||||
$data['body'] = htmlspecialchars_decode($data['body'], ENT_HTML5, 'UTF-8');
|
||||
$data['subject'] = htmlspecialchars_decode($data['subject'], ENT_HTML5, 'UTF-8');
|
||||
}
|
||||
|
||||
return $res;
|
||||
}
|
||||
|
||||
function get_sent($id, $userid)
|
||||
{
|
||||
//querying userid here, so if the user types a random id into the browser bar, it won't return anything
|
||||
$sql = "SELECT * FROM mail_sent WHERE id = ? AND userid = ?";
|
||||
|
||||
$q = $this->db->query($sql, array($id, $userid));
|
||||
|
||||
if (!$q->num_rows())
|
||||
return FALSE;
|
||||
|
||||
return $q->row_array();
|
||||
}
|
||||
|
||||
|
||||
function get_all_sent($userid)
|
||||
{
|
||||
$sql = "SELECT * FROM mail_sent WHERE userid = ?";
|
||||
|
||||
$q = $this->db->query($sql, array($userid));
|
||||
|
||||
if (!$q->num_rows())
|
||||
return FALSE;
|
||||
|
||||
return $q->result_array();
|
||||
}
|
||||
}
|
||||
//nowhitesp
|
294
Mourne-CI/application/models/map_model.php
Executable file
294
Mourne-CI/application/models/map_model.php
Executable file
@ -0,0 +1,294 @@
|
||||
<?php
|
||||
|
||||
class Map_model extends MO_Model
|
||||
{
|
||||
function __construct()
|
||||
{
|
||||
parent::__construct();
|
||||
}
|
||||
|
||||
function get_village_by_name($name)
|
||||
{
|
||||
$sql = "SELECT id FROM villages WHERE name LIKE '%" . $name . "%'";
|
||||
|
||||
$q = $this->db->query($sql);
|
||||
|
||||
if (!$q->num_rows())
|
||||
return FALSE;
|
||||
|
||||
$res = $q->row_array();
|
||||
|
||||
return $this->get_village_coords($res['id']);
|
||||
}
|
||||
|
||||
function get_village_coords($vid)
|
||||
{
|
||||
$sql = "SELECT * FROM map WHERE type='3' AND villageid='$vid'";
|
||||
$q = $this->db->query($sql);
|
||||
|
||||
return $q->row_array();
|
||||
}
|
||||
|
||||
function get_map($x, $y)
|
||||
{
|
||||
if ($x < 7)
|
||||
$x = 7;
|
||||
|
||||
if ($y < 7)
|
||||
$y = 7;
|
||||
|
||||
if ($x > 235)
|
||||
$x = 235;
|
||||
|
||||
if ($y > 235)
|
||||
$y = 235;
|
||||
|
||||
$minx = $x - 6;
|
||||
$maxx = $x + 6;
|
||||
$miny = $y - 6;
|
||||
$maxy = $y + 6;
|
||||
|
||||
//< at max so it gets 12 rows and cols
|
||||
$sql = "SELECT map.*,ai_villages.name AS ai_name,villages.name FROM map
|
||||
LEFT JOIN ai_villages ON map.villageid=ai_villages.id AND map.type='4'
|
||||
LEFT JOIN villages ON map.villageid=villages.id AND map.type='3'
|
||||
WHERE ((map.X >= '$minx') AND (map.X < '$maxx')
|
||||
AND (map.Y >= '$miny') AND (map.Y < '$maxy'))";
|
||||
|
||||
$q = $this->db->query($sql);
|
||||
|
||||
$res = $q->result_array();
|
||||
|
||||
//preprocess it, so view only have to do a foreach
|
||||
for ($sy = $miny; $sy < ($miny + 12); $sy++)
|
||||
{
|
||||
for ($sx = $minx; $sx < ($minx + 12); $sx++)
|
||||
{
|
||||
foreach ($res as $row)
|
||||
{
|
||||
if (($row['X'] == $sx) && ($row['Y'] == $sy))
|
||||
{
|
||||
$data[] = $row;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return $data;
|
||||
}
|
||||
|
||||
function get_map_list_admin()
|
||||
{
|
||||
$this->load->helper('directory');
|
||||
|
||||
$map = directory_map('./sql/map/', 1);
|
||||
|
||||
foreach ($map as $row)
|
||||
{
|
||||
$a = explode('.', $row);
|
||||
|
||||
if (isset($a[1]))
|
||||
{
|
||||
if ($a[1] == 'sql')
|
||||
$data[] = $row;
|
||||
}
|
||||
}
|
||||
|
||||
if (isset($data))
|
||||
return $data;
|
||||
else
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
function generate_map_admin()
|
||||
{
|
||||
//process ai village names (in different table) here
|
||||
//they will be saved into a different file until everything here works correctly
|
||||
//add .!
|
||||
$a = "DROP TABLE IF EXISTS ai_villages; \n";
|
||||
|
||||
//create table
|
||||
$a .= "CREATE TABLE IF NOT EXISTS `ai_villages` (
|
||||
`id` int(11) NOT NULL AUTO_INCREMENT,
|
||||
`name` text NOT NULL,
|
||||
`attacked` tinyint(4) NOT NULL,
|
||||
`X` int(11) NOT NULL,
|
||||
`Y` int(11) NOT NULL,
|
||||
PRIMARY KEY (`id`)
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8 AUTO_INCREMENT=1 ;";
|
||||
|
||||
$i = 1;
|
||||
for ($x = 1; $x <= 240; $x++)
|
||||
{
|
||||
for ($y = 1; $y <= 240; $y++)
|
||||
{
|
||||
//if ai village space
|
||||
if (!((($x + 24) % 48) || (($y + 24) % 48)))
|
||||
{
|
||||
$name = $this->_rand_ai_name();
|
||||
|
||||
$a .= "INSERT INTO ai_villages
|
||||
VALUES('$i', '$name', '0', '$x', '$y'); \n";
|
||||
|
||||
$i++;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
$a .= "DROP TABLE IF EXISTS map; \n";
|
||||
|
||||
$a .= "CREATE TABLE IF NOT EXISTS `map` (
|
||||
`id` int(11) NOT NULL AUTO_INCREMENT,
|
||||
`X` int(11) NOT NULL,
|
||||
`Y` int(11) NOT NULL,
|
||||
`type` tinyint(4) NOT NULL,
|
||||
`villageid` int(11) NOT NULL,
|
||||
PRIMARY KEY (`id`),
|
||||
KEY `X` (`X`,`Y`,`type`,`villageid`)
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8 AUTO_INCREMENT=1 ;";
|
||||
|
||||
$a .= "\n";
|
||||
|
||||
$sql = "SELECT * FROM villages";
|
||||
$q = $this->db->query($sql);
|
||||
$villages = $q->result_array();
|
||||
|
||||
if ($villages)
|
||||
{
|
||||
foreach ($villages as $row)
|
||||
{
|
||||
$found = FALSE;
|
||||
|
||||
while (!$found)
|
||||
{
|
||||
$vx = mt_rand(1, 240);
|
||||
$vy = mt_rand(1, 240);
|
||||
|
||||
if (((($vx + 24) % 48) && (($vy + 24) % 48)))
|
||||
{
|
||||
//not in ai space
|
||||
$vdata[] = array(
|
||||
'id' => $row['id'],
|
||||
'x' => $vx,
|
||||
'y' => $vy);
|
||||
|
||||
$found = true;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
else
|
||||
$vdata = FALSE;
|
||||
|
||||
$villageid = 0;
|
||||
$ai = 1;
|
||||
$found = FALSE;
|
||||
|
||||
$i = 1;
|
||||
for ($x = 1; $x <= 240; $x++)
|
||||
{
|
||||
for ($y = 1; $y <= 240; $y++)
|
||||
{
|
||||
//if not ai village space
|
||||
if (((($x + 24) % 48) || (($y + 24) % 48)))
|
||||
{
|
||||
if ($vdata)
|
||||
{
|
||||
foreach ($vdata as $row)
|
||||
{
|
||||
if ($row['x'] == $x && $row['y'] == $y)
|
||||
{
|
||||
$villageid = $row['id'];
|
||||
$type = 3;
|
||||
$found = TRUE;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (!$found)
|
||||
{
|
||||
//check for village here, dont let this run when true
|
||||
$r = rand(0, 100);
|
||||
if ($r < 70)
|
||||
$type = 0;
|
||||
elseif ($r >= 70 && $r < 85)
|
||||
$type = 1;
|
||||
else
|
||||
$type = 2;
|
||||
}
|
||||
|
||||
$found = FALSE;
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
//ai village space
|
||||
$type = 4;
|
||||
$villageid = $ai;
|
||||
$ai++;
|
||||
}
|
||||
|
||||
$a .= "INSERT INTO map VALUES('$i', '$x', '$y', '$type', '$villageid');\n";
|
||||
$villageid = 0;
|
||||
$i++;
|
||||
}
|
||||
}
|
||||
|
||||
$this->load->helper('file');
|
||||
|
||||
$f = './sql/map/map' . time() . '.sql';
|
||||
|
||||
write_file($f, $a);
|
||||
}
|
||||
|
||||
function apply_map_admin($file)
|
||||
{
|
||||
$this->load->helper('file');
|
||||
|
||||
$f = readfile(('./sql/map/' . $file));
|
||||
|
||||
$sql = explode(';', $f);
|
||||
|
||||
foreach ($sql as $row)
|
||||
{
|
||||
$this->db->query($row);
|
||||
}
|
||||
}
|
||||
|
||||
function _rand_ai_name()
|
||||
{
|
||||
//they are in keyboard order from left to right, and top to bottom
|
||||
|
||||
//21 entries
|
||||
$a = array('q', 'w', 'r', 't', 'z', 'p', 's', 'd', 'f', 'g', 'h', 'j', 'k', 'l', 'y', 'x',
|
||||
'c', 'v', 'b', 'n', 'm');
|
||||
|
||||
//5 entries
|
||||
$b = array('e', 'u', 'i', 'o', 'a');
|
||||
|
||||
//ai village names should be between 4-6 chars
|
||||
$length = rand(4, 6);
|
||||
|
||||
$str = '';
|
||||
for ($i = 1; $i <= $length; $i++)
|
||||
{
|
||||
//start with $a
|
||||
if ($i % 2)
|
||||
{
|
||||
if ($i == 1)
|
||||
$str .= strtoupper($a[mt_rand(0,20)]);
|
||||
else
|
||||
$str .= $a[mt_rand(0, 20)];
|
||||
}
|
||||
else
|
||||
$str .= $b[mt_rand(0, 4)];
|
||||
|
||||
}
|
||||
|
||||
return $str;
|
||||
}
|
||||
|
||||
}
|
||||
//nowhitesp
|
14
Mourne-CI/application/models/menu_model.php
Executable file
14
Mourne-CI/application/models/menu_model.php
Executable file
@ -0,0 +1,14 @@
|
||||
<?php
|
||||
class Menu_model extends MO_Model
|
||||
{
|
||||
|
||||
function __construct()
|
||||
{
|
||||
parent::__construct();
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
//nowhitesp
|
73
Mourne-CI/application/models/mo_common_model.php
Executable file
73
Mourne-CI/application/models/mo_common_model.php
Executable file
@ -0,0 +1,73 @@
|
||||
<?php
|
||||
|
||||
class Mo_common_model extends MO_Model
|
||||
{
|
||||
function __construct()
|
||||
{
|
||||
parent::__construct();
|
||||
}
|
||||
|
||||
|
||||
function get_hero_data($userid)
|
||||
{
|
||||
$sql = "SELECT * FROM heroes WHERE userid = ? AND selected = '1'";
|
||||
|
||||
$q = $this->db->query($sql, array($userid));
|
||||
|
||||
if (!$q->num_rows())
|
||||
return FALSE;
|
||||
|
||||
return $q->row_array();
|
||||
}
|
||||
|
||||
function get_userlevel($uid)
|
||||
{
|
||||
$sql = "SELECT userlevel FROM users WHERE id=$uid";
|
||||
|
||||
$q = $this->db->query($sql);
|
||||
|
||||
$res = $q->row_array();
|
||||
|
||||
return $res['userlevel'];
|
||||
|
||||
}
|
||||
|
||||
function get_username($uid)
|
||||
{
|
||||
$sql = "SELECT username FROM users WHERE id=$uid";
|
||||
|
||||
$q = $this->db->query($sql);
|
||||
|
||||
$res = $q->row_array();
|
||||
|
||||
return $res['username'];
|
||||
}
|
||||
|
||||
function get_userdata($id)
|
||||
{
|
||||
$sql = "SELECT * FROM users WHERE id='$id'";
|
||||
$q = $this->db->query($sql);
|
||||
|
||||
return $q->row_array();
|
||||
|
||||
}
|
||||
|
||||
function get_villageid($userid)
|
||||
{
|
||||
$sql = "SELECT id FROM villages WHERE userid='$userid' AND selected='1'";
|
||||
$q = $this->db->query($sql);
|
||||
$res = $q->row_array();
|
||||
|
||||
return $res['id'];
|
||||
}
|
||||
|
||||
function get_village_data($uid)
|
||||
{
|
||||
$sql = "SELECT * FROM villages WHERE userid='$uid' AND selected='1'";
|
||||
$q = $this->db->query($sql);
|
||||
return $q->row_array();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
//nowhitesp
|
32
Mourne-CI/application/models/news_model.php
Executable file
32
Mourne-CI/application/models/news_model.php
Executable file
@ -0,0 +1,32 @@
|
||||
<?php
|
||||
|
||||
class News_model extends MO_Model
|
||||
{
|
||||
|
||||
function get_news($page)
|
||||
{
|
||||
$p = ($page - 1) * 5;
|
||||
|
||||
$sql = "SELECT * FROM news LIMIT $p, 5";
|
||||
|
||||
$q = $this->db->query($sql);
|
||||
|
||||
return $q->result_array();
|
||||
}
|
||||
|
||||
function add_news($text, $uname)
|
||||
{
|
||||
$sql = "INSERT INTO news VALUES(default, '$uname', '$text')";
|
||||
|
||||
return $this->db->query($sql);
|
||||
}
|
||||
|
||||
function del_news($id)
|
||||
{
|
||||
$sql = "";
|
||||
return $this->db->query($sql);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
//nowhitesp
|
64
Mourne-CI/application/models/resource_model.php
Executable file
64
Mourne-CI/application/models/resource_model.php
Executable file
@ -0,0 +1,64 @@
|
||||
<?php
|
||||
class Resource_model extends MO_Model
|
||||
{
|
||||
function __construct()
|
||||
{
|
||||
parent::__construct();
|
||||
}
|
||||
|
||||
//calculates how much unit can be created with the available resources
|
||||
//since where this is called I display resources, its passed from there
|
||||
function calc_max_unit($unit, $max_num, $res)
|
||||
{
|
||||
for ($i = 1; $i <= $max_num; $i++)
|
||||
{
|
||||
$res['food'] -= $unit['cost_food'];
|
||||
$res['wood'] -= $unit['cost_wood'];
|
||||
$res['stone'] -= $unit['cost_stone'];
|
||||
$res['iron'] -= $unit['cost_iron'];
|
||||
$res['mana'] -= $unit['cost_mana'];
|
||||
|
||||
//not sure if this is needed
|
||||
if ($res['food'] < 0 && $res['wood'] < 0 &&
|
||||
$res['stone'] < 0 && $res['iron'] < 0 &&
|
||||
$res['mana'] < 0)
|
||||
{
|
||||
return ($i - 1);
|
||||
}
|
||||
|
||||
|
||||
if ($res['food'] < 0 || $res['wood'] < 0 ||
|
||||
$res['stone'] < 0 || $res['iron'] < 0 ||
|
||||
$res['mana'] < 0)
|
||||
{
|
||||
return ($i - 1);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
return $max_num;
|
||||
}
|
||||
|
||||
|
||||
function have_enough_resources_building($buildingid, $villageid)
|
||||
{
|
||||
$res = $this->get_resources($villageid);
|
||||
|
||||
$sql = "SELECT * FROM buildings WHERE id='$buildingid'";
|
||||
$q = $this->db->query($sql);
|
||||
$building = $q->row_array();
|
||||
|
||||
if ($res['food'] >= $building['cost_food'] &&
|
||||
$res['wood'] >= $building['cost_wood'] &&
|
||||
$res['stone'] >= $building['cost_stone'] &&
|
||||
$res['iron'] >= $building['cost_iron'] &&
|
||||
$res['mana'] >= $building['cost_mana'])
|
||||
return TRUE;
|
||||
|
||||
return FALSE;
|
||||
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
//nowhitesp
|
240
Mourne-CI/application/models/spell_model.php
Executable file
240
Mourne-CI/application/models/spell_model.php
Executable file
@ -0,0 +1,240 @@
|
||||
<?php
|
||||
class Spell_model extends MO_Model
|
||||
{
|
||||
function __construct()
|
||||
{
|
||||
parent::__construct();
|
||||
}
|
||||
|
||||
function use_spell($spellid, $slotid, $res, $villageid)
|
||||
{
|
||||
$this->resources = $res;
|
||||
|
||||
//getting spell
|
||||
$sql = "SELECT spells.*,building_spell_cooldowns.cooldown_end
|
||||
FROM building_spells
|
||||
LEFT JOIN spells ON building_spells.spellid=spells.id
|
||||
LEFT JOIN building_spell_cooldowns
|
||||
ON (building_spells.spellid=building_spell_cooldowns.spellid
|
||||
AND building_spell_cooldowns.slotid='$slotid'
|
||||
AND building_spell_cooldowns.villageid='$villageid')
|
||||
WHERE building_spells.villageid='$villageid'
|
||||
AND building_spells.slotid='$slotid'
|
||||
AND building_spells.spellid='$spellid'";
|
||||
|
||||
$q = $this->db->query($sql);
|
||||
|
||||
if (!$q->num_rows())
|
||||
return 1;
|
||||
|
||||
$spell = $q->row_array();
|
||||
|
||||
if ($spell['cooldown_end'])
|
||||
return 2;
|
||||
|
||||
if (!$this->check_resources($res, $spell))
|
||||
return 3;
|
||||
|
||||
//everything is fine
|
||||
//substracting cost
|
||||
$this->substract_resources($spell, $villageid);
|
||||
|
||||
//addign modofiers
|
||||
$this->add_modifiers($spell['id'], $villageid, 'spell');
|
||||
|
||||
$this->write_resources();
|
||||
|
||||
if ($spell['weather_change_to'])
|
||||
{
|
||||
$sql = "UPDATE villages
|
||||
SET weather_change_to='" . $spell['weather_change_to'] . "'
|
||||
WHERE id='$villageid'";
|
||||
|
||||
$this->db->query($sql);
|
||||
}
|
||||
|
||||
//do spelleffects here
|
||||
|
||||
|
||||
//adding cooldown
|
||||
$cd = $spell['cooldown'] + time();
|
||||
|
||||
$sql = "INSERT INTO building_spell_cooldowns
|
||||
VALUES(default, '$villageid', '$slotid',
|
||||
'" . $spell['id'] . "', '$cd')";
|
||||
$this->db->query($sql);
|
||||
|
||||
//adding spell_effect_end to events
|
||||
$ev['type'] = 3;
|
||||
$ev['villageid'] = $villageid;
|
||||
$ev['slotid'] = $slotid;
|
||||
$ev['time'] = $spell['duration'];
|
||||
$ev['data1'] = $spell['id'];
|
||||
|
||||
$this->add_event($ev);
|
||||
}
|
||||
|
||||
function get_spells($slotid, $villageid)
|
||||
{
|
||||
$this->update_spells($slotid, $villageid);
|
||||
|
||||
$sql = "SELECT spells.*,building_spell_cooldowns.cooldown_end
|
||||
FROM building_spells
|
||||
LEFT JOIN spells ON building_spells.spellid=spells.id
|
||||
LEFT JOIN building_spell_cooldowns
|
||||
ON (building_spells.spellid=building_spell_cooldowns.spellid
|
||||
AND building_spell_cooldowns.slotid='$slotid'
|
||||
AND building_spell_cooldowns.villageid='$villageid')
|
||||
WHERE building_spells.villageid='$villageid'
|
||||
AND building_spells.slotid='$slotid'";
|
||||
|
||||
$q = $this->db->query($sql);
|
||||
|
||||
return $q->result_array();
|
||||
}
|
||||
|
||||
function update_spells($slotid, $villageid)
|
||||
{
|
||||
$sql = "SELECT * FROM building_spell_cooldowns
|
||||
WHERE slotid='$slotid'
|
||||
AND villageid='$villageid'";
|
||||
|
||||
$q = $this->db->query($sql);
|
||||
|
||||
if (!$q->num_rows())
|
||||
return;
|
||||
|
||||
$spells = $q->result_array();
|
||||
$time = time();
|
||||
|
||||
foreach ($spells as $row)
|
||||
{
|
||||
if ($row['cooldown_end'] <= $time)
|
||||
{
|
||||
$sql = "DELETE FROM building_spell_cooldowns
|
||||
WHERE id='" . $row['id'] . "'";
|
||||
$this->db->query($sql);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function get_spell_mod_drop_admin()
|
||||
{
|
||||
//STUB
|
||||
$data = array('0' => 'Nothing');
|
||||
return $data;
|
||||
}
|
||||
|
||||
function list_spells_admin()
|
||||
{
|
||||
$sql = "SELECT * FROM spells";
|
||||
$q = $this->db->query($sql);
|
||||
|
||||
return $q->result_array();
|
||||
}
|
||||
|
||||
function get_spell_list_drop_admin()
|
||||
{
|
||||
$sql = "SELECT * FROM spells";
|
||||
$q = $this->db->query($sql);
|
||||
$res = $q->result_array();
|
||||
|
||||
$data[0] = 'No Spell';
|
||||
|
||||
foreach ($res as $row)
|
||||
{
|
||||
$data[$row['id']] = $row['description_admin'];
|
||||
}
|
||||
|
||||
return $data;
|
||||
}
|
||||
|
||||
function get_spell_admin($id)
|
||||
{
|
||||
$sql = "SELECT * FROM spells WHERE id='$id'";
|
||||
$q = $this->db->query($sql);
|
||||
|
||||
return $q->row_array();
|
||||
}
|
||||
|
||||
function edit_spell_admin($data)
|
||||
{
|
||||
|
||||
$sql = "UPDATE spells
|
||||
SET effect='" . $data['effect'] . "',
|
||||
duration='" . $data['duration'] . "',
|
||||
cooldown='" . $data['cooldown'] . "',
|
||||
description='" . $data['description'] . "',
|
||||
description_admin='" . $data['description_admin'] . "',
|
||||
weather_change_to='" . $data['weather_change_to'] . "',
|
||||
cost_food='" . $data['cost_food'] . "',
|
||||
cost_wood='" . $data['cost_wood'] . "',
|
||||
cost_stone='" . $data['cost_stone'] . "',
|
||||
cost_iron='" . $data['cost_iron'] . "',
|
||||
cost_mana='" . $data['cost_mana'] . "',
|
||||
mod_max_food='" . $data['mod_max_food'] . "',
|
||||
mod_max_wood='" . $data['mod_max_wood'] . "',
|
||||
mod_max_stone='" . $data['mod_max_stone'] . "',
|
||||
mod_max_iron='" . $data['mod_max_iron'] . "',
|
||||
mod_max_mana='" . $data['mod_max_mana'] . "',
|
||||
mod_rate_food='" . $data['mod_rate_food'] . "',
|
||||
mod_rate_wood='" . $data['mod_rate_wood'] . "',
|
||||
mod_rate_stone='" . $data['mod_rate_stone'] . "',
|
||||
mod_rate_iron='" . $data['mod_rate_iron'] . "',
|
||||
mod_rate_mana='" . $data['mod_rate_mana'] . "',
|
||||
mod_percent_food='" . $data['mod_percent_food'] . "',
|
||||
mod_percent_wood='" . $data['mod_percent_wood'] . "',
|
||||
mod_percent_stone='" . $data['mod_percent_stone'] . "',
|
||||
mod_percent_iron='" . $data['mod_percent_iron'] . "',
|
||||
mod_percent_mana='" . $data['mod_percent_mana'] . "'
|
||||
WHERE id='" . $data['id'] . "'";
|
||||
|
||||
$this->db->query($sql);
|
||||
|
||||
$this->_create_sql($sql);
|
||||
}
|
||||
|
||||
function add_spell_admin($data)
|
||||
{
|
||||
$sql = "INSERT INTO spells VALUES(default,
|
||||
'" . $data['effect'] . "',
|
||||
'" . $data['duration'] . "',
|
||||
'" . $data['cooldown'] . "',
|
||||
'" . $data['description'] . "',
|
||||
'" . $data['description_admin'] . "',
|
||||
'" . $data['weather_change_to'] . "',
|
||||
'" . $data['cost_food'] . "',
|
||||
'" . $data['cost_wood'] . "',
|
||||
'" . $data['cost_stone'] . "',
|
||||
'" . $data['cost_iron'] . "',
|
||||
'" . $data['cost_mana'] . "',
|
||||
'" . $data['mod_max_food'] . "',
|
||||
'" . $data['mod_max_wood'] . "',
|
||||
'" . $data['mod_max_stone'] . "',
|
||||
'" . $data['mod_max_iron'] . "',
|
||||
'" . $data['mod_max_mana'] . "',
|
||||
'" . $data['mod_rate_food'] . "',
|
||||
'" . $data['mod_rate_wood'] . "',
|
||||
'" . $data['mod_rate_stone'] . "',
|
||||
'" . $data['mod_rate_iron'] . "',
|
||||
'" . $data['mod_rate_mana'] . "',
|
||||
'" . $data['mod_percent_food'] . "',
|
||||
'" . $data['mod_percent_wood'] . "',
|
||||
'" . $data['mod_percent_stone'] . "',
|
||||
'" . $data['mod_percent_iron'] . "',
|
||||
'" . $data['mod_percent_mana'] . "')";
|
||||
|
||||
$this->db->query($sql);
|
||||
|
||||
$this->_create_sql($sql);
|
||||
}
|
||||
|
||||
function get_spell_effects_admin()
|
||||
{
|
||||
//STUB!
|
||||
$data = array('0' => 'No Effect');
|
||||
|
||||
return $data;
|
||||
}
|
||||
}
|
||||
//nowhitesp
|
148
Mourne-CI/application/models/sql_model.php
Executable file
148
Mourne-CI/application/models/sql_model.php
Executable file
@ -0,0 +1,148 @@
|
||||
<?php
|
||||
|
||||
class Sql_model extends MO_Model
|
||||
{
|
||||
function __construct()
|
||||
{
|
||||
parent::__construct();
|
||||
}
|
||||
|
||||
//updates the db version, to current time, only used when saving a change as sql which already in db
|
||||
//like changes from phpmyadmin
|
||||
//dummy function to call the inherited _update_db_version($time);
|
||||
function update_db_version($time)
|
||||
{
|
||||
$this->_update_db_version($time);
|
||||
}
|
||||
|
||||
//dummy function which uses inherited _create_sql($sql);
|
||||
function create_sql($sql)
|
||||
{
|
||||
$this->_create_sql($sql);
|
||||
}
|
||||
|
||||
function get_db_version()
|
||||
{
|
||||
$sql = "SELECT version FROM db_version WHERE id='1'";
|
||||
|
||||
$q = $this->db->query($sql);
|
||||
|
||||
$res = $q->row_array();
|
||||
|
||||
return $res['version'];
|
||||
}
|
||||
|
||||
function get_appliable_files()
|
||||
{
|
||||
$this->load->helper('file');
|
||||
//$full_list = get_filenames('./sql');
|
||||
|
||||
$this->load->helper('directory');
|
||||
$full_list = directory_map('./sql', 1);
|
||||
|
||||
//get out the full db dumps
|
||||
foreach ($full_list as $row)
|
||||
{
|
||||
if (substr_compare($row, 'db', 0, 2, TRUE) && substr_compare($row, 'map', 0, 3, TRUE) &&
|
||||
substr_compare($row, 'old', 0, 3, TRUE) && substr_compare($row, 'index', 0, 5, TRUE))
|
||||
{
|
||||
$list[] = $row;
|
||||
}
|
||||
}
|
||||
|
||||
if (!isset($list))
|
||||
return 0;
|
||||
|
||||
$ver = $this->get_db_version();
|
||||
|
||||
foreach ($list as $row)
|
||||
{
|
||||
$l = explode('.', $row);
|
||||
|
||||
if ($l[0] > $ver)
|
||||
{
|
||||
$data[] = $row;
|
||||
}
|
||||
}
|
||||
|
||||
if (!isset($data))
|
||||
return 0;
|
||||
|
||||
//getting the max
|
||||
$max = 0;
|
||||
|
||||
foreach ($data as $row)
|
||||
{
|
||||
$l = explode('.', $row);
|
||||
|
||||
if ($l[0] > $max)
|
||||
{
|
||||
$max = $l[0];
|
||||
}
|
||||
}
|
||||
|
||||
$smallest = $max;
|
||||
$last_found = 0;
|
||||
|
||||
$ordered[] = $max . ".sql";
|
||||
|
||||
for ($i = 0; $i < (sizeof($data) - 1); $i++)
|
||||
{
|
||||
foreach ($data as $row)
|
||||
{
|
||||
$l = explode('.', $row);
|
||||
|
||||
if (($l[0] < $smallest) && ($l[0] > $last_found))
|
||||
{
|
||||
$smallest = $l[0];
|
||||
$ord = $row;
|
||||
}
|
||||
}
|
||||
|
||||
$last_found = $smallest;
|
||||
$smallest = $max;
|
||||
$ordered[$i] = $ord;
|
||||
}
|
||||
|
||||
if (isset($ordered))
|
||||
{
|
||||
return $ordered;
|
||||
}
|
||||
else
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
function apply_all_sql()
|
||||
{
|
||||
$this->load->helper('file');
|
||||
|
||||
$list = $this->get_appliable_files();
|
||||
|
||||
if (!$list)
|
||||
return;
|
||||
|
||||
for ($i = 0; $i < sizeof($list); $i++)
|
||||
{
|
||||
//reading file, then applying it to the db
|
||||
$loc = './sql/' . $list[$i];
|
||||
$sql = read_file($loc);
|
||||
|
||||
var_dump($loc);
|
||||
|
||||
$this->db->query($sql);
|
||||
|
||||
//TODO check if error happened, then stop everything
|
||||
//check is not needed, it just throws the error
|
||||
|
||||
//update db_version
|
||||
$ver = explode('.', $list[$i]);
|
||||
$sqlv = "UPDATE db_version SET version='" . $ver[0] . "' WHERE id='1'";
|
||||
$this->db->query($sqlv);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
//nowhitesp
|
646
Mourne-CI/application/models/technology_model.php
Executable file
646
Mourne-CI/application/models/technology_model.php
Executable file
@ -0,0 +1,646 @@
|
||||
<?php
|
||||
class Technology_model extends MO_Model
|
||||
{
|
||||
function __construct()
|
||||
{
|
||||
parent::__construct();
|
||||
}
|
||||
|
||||
function do_research($techid, $res, $slotid, $villageid)
|
||||
{
|
||||
$this->set_resources($res);
|
||||
|
||||
$technology = $this->get_technology($techid);
|
||||
|
||||
//no such technology
|
||||
if (!$technology)
|
||||
return 1;
|
||||
|
||||
if (!$this->check_resources($res, $technology))
|
||||
return 2;
|
||||
|
||||
$tech = $this->get_researchable($slotid, $villageid);
|
||||
|
||||
$primary = $tech['primary'];
|
||||
$secondary = $tech['secondary'];
|
||||
|
||||
$found = FALSE;
|
||||
$group = FALSE;
|
||||
foreach ($primary as $row)
|
||||
{
|
||||
if ($row['id'] == $techid)
|
||||
{
|
||||
$found = TRUE;
|
||||
$group = 'primary';
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
foreach ($secondary as $row)
|
||||
{
|
||||
if ($found)
|
||||
break;
|
||||
|
||||
if ($row['id'] = $techid)
|
||||
{
|
||||
$found = TRUE;
|
||||
$group = 'secondary';
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
//building doesn't have this technology (or user already have it)
|
||||
if (!$found)
|
||||
return 3;
|
||||
|
||||
//everything is fine
|
||||
//substract cost
|
||||
$this->substract_resources($technology, $villageid);
|
||||
|
||||
$this->write_resources();
|
||||
|
||||
//add event
|
||||
$ev['type'] = 4;
|
||||
$ev['villageid'] = $villageid;
|
||||
$ev['slotid'] = $slotid;
|
||||
$ev['time'] = $technology['time'];
|
||||
$ev['data1'] = $techid;
|
||||
|
||||
if ($group == 'secondary')
|
||||
$ev['data2'] = $slotid;
|
||||
|
||||
$this->add_event($ev);
|
||||
}
|
||||
|
||||
function get_researchable($slotid, $villageid)
|
||||
{
|
||||
$building = $this->get_slot_building($slotid, $villageid);
|
||||
|
||||
if (!($building['tech_group'] && $building['tech_secondary_group']))
|
||||
{
|
||||
$data['primary'] = FALSE;
|
||||
$data['secondary'] = FALSE;
|
||||
return $data;
|
||||
}
|
||||
|
||||
//technologies a village has
|
||||
$technologies = $this->get_village_technologies($villageid, $slotid);
|
||||
|
||||
//technologies a building can make
|
||||
$building_tech = $this->get_building_technologies($building['tech_group'],
|
||||
$building['tech_secondary_group']);
|
||||
|
||||
//technologies that a village (or building) doesn't have
|
||||
$av_tech = $this->select_technology_not_have($technologies, $building_tech);
|
||||
|
||||
//getting technology requirements
|
||||
$requirements = $this->get_requirements($av_tech);
|
||||
|
||||
if (!$requirements)
|
||||
return $av_tech;
|
||||
|
||||
$data['primary'] = $this->apply_requirements($av_tech['primary'],
|
||||
$requirements);
|
||||
|
||||
$data['secondary'] = $this->apply_requirements($av_tech['secondary'],
|
||||
$requirements);
|
||||
|
||||
return $data;
|
||||
|
||||
}
|
||||
|
||||
function apply_requirements($technologies, $requirements)
|
||||
{
|
||||
if (!$technologies)
|
||||
return FALSE;
|
||||
|
||||
if (!$requirements)
|
||||
return $technologies;
|
||||
|
||||
foreach ($technologies as $row)
|
||||
{
|
||||
$found = FALSE;
|
||||
foreach ($requirements as $req)
|
||||
{
|
||||
//if the technology's id matched the current requirement's techid
|
||||
if ($req['technologyid'] == $row['id'])
|
||||
{
|
||||
//looking for the matching technology that is required
|
||||
foreach ($technologies as $tech)
|
||||
{
|
||||
if ($req['req_tech_id'] == $tech['id'])
|
||||
{
|
||||
$found = TRUE;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (!$found)
|
||||
$data[] = $row;
|
||||
}
|
||||
|
||||
if (isset($data))
|
||||
return $data;
|
||||
else
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
function get_requirements($tech)
|
||||
{
|
||||
$primary = $tech['primary'];
|
||||
$secondary = $tech['secondary'];
|
||||
|
||||
if (!$primary && !$secondary)
|
||||
return FALSE;
|
||||
|
||||
$sql = "SELECT * FROM technology_requirements
|
||||
WHERE (";
|
||||
|
||||
$first = TRUE;
|
||||
if ($primary)
|
||||
{
|
||||
foreach ($primary as $row)
|
||||
{
|
||||
if ($first)
|
||||
$first = FALSE;
|
||||
else
|
||||
$sql .= "OR ";
|
||||
|
||||
$sql .= "technologyid='" . $row['id'] . "' ";
|
||||
}
|
||||
}
|
||||
|
||||
if ($secondary)
|
||||
{
|
||||
foreach ($secondary as $row)
|
||||
{
|
||||
if ($first)
|
||||
$first = FALSE;
|
||||
else
|
||||
$sql .= "OR ";
|
||||
|
||||
$sql .= "technologyid='" . $row['id'] . "' ";
|
||||
}
|
||||
}
|
||||
|
||||
$sql .= ")";
|
||||
|
||||
$q = $this->db->query($sql);
|
||||
|
||||
if ($q->num_rows())
|
||||
return $q->result_array();
|
||||
else
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
//TODO better name?
|
||||
function select_technology_not_have($village_tech, $building_technologies)
|
||||
{
|
||||
$primary = $building_technologies['primary'];
|
||||
$secondary = $building_technologies['secondary'];
|
||||
|
||||
//adding only which village doesn't have (primary)
|
||||
if ($primary)
|
||||
{
|
||||
$found = FALSE;
|
||||
foreach ($primary as $row)
|
||||
{
|
||||
foreach ($village_tech as $trow)
|
||||
{
|
||||
if ($found)
|
||||
continue;
|
||||
|
||||
if ($trow['technologyid'] == $row['id'])
|
||||
{
|
||||
$found = TRUE;
|
||||
}
|
||||
}
|
||||
|
||||
if (!$found)
|
||||
$data['primary'][] = $row;
|
||||
|
||||
$found = FALSE;
|
||||
}
|
||||
}
|
||||
if (!isset($data['primary']))
|
||||
$data['primary'] = FALSE;
|
||||
|
||||
|
||||
if ($secondary)
|
||||
{
|
||||
//same just with secondary
|
||||
$found = FALSE;
|
||||
foreach ($secondary as $row)
|
||||
{
|
||||
foreach ($village_tech as $trow)
|
||||
{
|
||||
if ($found)
|
||||
continue;
|
||||
|
||||
if ($trow['technologyid'] == $row['id'])
|
||||
{
|
||||
$found = TRUE;
|
||||
}
|
||||
}
|
||||
|
||||
if (!$found)
|
||||
$data['secondary'][] = $row;
|
||||
|
||||
$found = FALSE;
|
||||
}
|
||||
}
|
||||
|
||||
if (!isset($data['secondary']))
|
||||
$data['secondary'] = FALSE;
|
||||
|
||||
return $data;
|
||||
}
|
||||
|
||||
function get_building_technologies($id, $secid = 0)
|
||||
{
|
||||
if ($secid)
|
||||
{
|
||||
$sql = "SELECT technologies.*,technology_groups.groupid
|
||||
FROM technology_groups
|
||||
INNER JOIN technologies
|
||||
ON technology_groups.technologyid=technologies.id
|
||||
WHERE (groupid='$id' OR groupid='$secid')";
|
||||
}
|
||||
else
|
||||
{
|
||||
$sql = "SELECT technologies.*
|
||||
FROM technology_groups
|
||||
INNER JOIN technologies
|
||||
ON technology_groups.technologyid=technologies.id
|
||||
WHERE groupid='$id'";
|
||||
}
|
||||
|
||||
$q = $this->db->query($sql);
|
||||
|
||||
if (!$secid)
|
||||
{
|
||||
$data['primary'] = $q->result_array();
|
||||
$data['secondary'] = FALSE;
|
||||
|
||||
return $data;
|
||||
}
|
||||
|
||||
$res = $q->result_array();
|
||||
|
||||
foreach ($res as $row)
|
||||
{
|
||||
if ($row['groupid'] == $id)
|
||||
{
|
||||
$data['primary'][] = $row;
|
||||
}
|
||||
else
|
||||
{
|
||||
$data['secondary'][] = $row;
|
||||
}
|
||||
}
|
||||
|
||||
if (!isset($data['primary']))
|
||||
$data['primary'] = FALSE;
|
||||
|
||||
if (!isset($data['secondary']))
|
||||
$data['secondary'] = FALSE;
|
||||
|
||||
return $data;
|
||||
|
||||
}
|
||||
|
||||
function get_technology($id)
|
||||
{
|
||||
$sql = "SELECT * FROM technologies WHERE id='$id'";
|
||||
$q = $this->db->query($sql);
|
||||
|
||||
if ($q->num_rows())
|
||||
return $q->row_array();
|
||||
else
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
function add_tech_req_admin($techid, $reqid)
|
||||
{
|
||||
//dont add if already added
|
||||
$sql = "SELECT * FROM technology_requirements
|
||||
WHERE technologyid='$techid'
|
||||
AND req_tech_id='$reqid'";
|
||||
|
||||
$q = $this->db->query($sql);
|
||||
|
||||
if ($q->num_rows())
|
||||
return;
|
||||
|
||||
$sql = "INSERT INTO technology_requirements
|
||||
VALUES(default, '$techid', '$reqid')";
|
||||
|
||||
$this->db->query($sql);
|
||||
|
||||
$this->_create_sql($sql);
|
||||
}
|
||||
|
||||
function remove_tech_req_admin($id)
|
||||
{
|
||||
$sql = "DELETE FROM technology_requirements
|
||||
WHERE id='$id'";
|
||||
|
||||
$this->db->query($sql);
|
||||
|
||||
$this->_create_sql($sql);
|
||||
}
|
||||
|
||||
function get_tech_by_req_id_admin($id)
|
||||
{
|
||||
$sql = "SELECT technologies.*
|
||||
FROM technology_have_requirements
|
||||
INNER JOIN technologies
|
||||
ON technology_have_requirements.technologyid=technologies.id
|
||||
WHERE technology_have_requirements.id='$id'";
|
||||
|
||||
$q = $this->db->query($sql);
|
||||
|
||||
return $q->row_array();
|
||||
}
|
||||
|
||||
function get_tech_requirements_admin($id)
|
||||
{
|
||||
$sql = "SELECT technology_requirements.*,technologies.description
|
||||
FROM technology_requirements
|
||||
INNER JOIN technologies
|
||||
ON technology_requirements.req_tech_id=technologies.id
|
||||
WHERE technologyid='$id'";
|
||||
|
||||
$q = $this->db->query($sql);
|
||||
|
||||
return $q->result_array();
|
||||
}
|
||||
|
||||
function add_to_req_list_admin($data)
|
||||
{
|
||||
$sql = "SELECT * FROM technology_have_requirements
|
||||
WHERE technologyid='" . $data['technologyid'] . "'";
|
||||
|
||||
$q = $this->db->query($sql);
|
||||
|
||||
if ($q->num_rows)
|
||||
return;
|
||||
|
||||
$sql = "INSERT INTO technology_have_requirements
|
||||
VALUES(default,
|
||||
'" . $data['technologyid'] . "',
|
||||
'" . $data['comment'] . "')";
|
||||
|
||||
$this->db->query($sql);
|
||||
|
||||
$this->_create_sql($sql);
|
||||
}
|
||||
|
||||
function remove_from_req_list_admin($id)
|
||||
{
|
||||
$sql = "DELETE FROM technology_have_requirements
|
||||
WHERE id='$id'";
|
||||
|
||||
$this->db->query($sql);
|
||||
|
||||
$this->_create_sql($sql);
|
||||
}
|
||||
|
||||
function get_req_list_item_admin($id)
|
||||
{
|
||||
$sql = "SELECT technology_have_requirements.*,technologies.description
|
||||
FROM technology_have_requirements
|
||||
INNER JOIN technologies
|
||||
ON technology_have_requirements.technologyid=technologies.id
|
||||
WHERE technology_have_requirements.id='$id'";
|
||||
|
||||
$q = $this->db->query($sql);
|
||||
|
||||
return $q->row_array();
|
||||
}
|
||||
|
||||
function list_tech_have_req_admin()
|
||||
{
|
||||
$sql = "SELECT technology_have_requirements.*,technologies.description
|
||||
FROM technology_have_requirements
|
||||
INNER JOIN technologies
|
||||
ON technology_have_requirements.technologyid=technologies.id";
|
||||
|
||||
$q = $this->db->query($sql);
|
||||
return $q->result_array();
|
||||
}
|
||||
|
||||
function add_tech_to_group_admin($gid, $techid)
|
||||
{
|
||||
$sql = "INSERT INTO technology_groups
|
||||
VALUES(default, '$gid', '$techid')";
|
||||
$this->db->query($sql);
|
||||
|
||||
$this->_create_sql($sql);
|
||||
}
|
||||
|
||||
function remove_tech_from_group_admin($gid, $techid)
|
||||
{
|
||||
$sql = "DELETE FROM technology_groups
|
||||
WHERE groupid='$gid'
|
||||
AND technologyid='$techid'";
|
||||
$this->db->query($sql);
|
||||
|
||||
$this->_create_sql($sql);
|
||||
}
|
||||
|
||||
function get_group_admin($id)
|
||||
{
|
||||
$sql = "SELECT technology_groups.*, technologies.description
|
||||
FROM technology_groups
|
||||
INNER JOIN technologies ON technology_groups.technologyid=technologies.id
|
||||
WHERE groupid='$id'";
|
||||
|
||||
$q = $this->db->query($sql);
|
||||
|
||||
return $q->result_array();
|
||||
}
|
||||
|
||||
function get_tech_list_drop_admin()
|
||||
{
|
||||
$sql = "SELECT id,description FROM technologies";
|
||||
$q = $this->db->query($sql);
|
||||
|
||||
$res = $q->result_array();
|
||||
|
||||
$data[0] = 'Nothing';
|
||||
|
||||
foreach ($res as $row)
|
||||
{
|
||||
$data[$row['id']] = $row['description'];
|
||||
}
|
||||
|
||||
return $data;
|
||||
}
|
||||
|
||||
function list_tech_drop_admin()
|
||||
{
|
||||
$sql = "SELECT id,description FROM technologies";
|
||||
$q = $this->db->query($sql);
|
||||
|
||||
$res = $q->result_array();
|
||||
|
||||
foreach ($res as $row)
|
||||
{
|
||||
$data[$row['id']] = $row['description'];
|
||||
}
|
||||
|
||||
if (isset($data))
|
||||
return $data;
|
||||
else
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
function get_tech_group_list_drop_admin()
|
||||
{
|
||||
$sql = "SELECT * FROM technology_group_descriptions";
|
||||
|
||||
$q = $this->db->query($sql);
|
||||
|
||||
$res = $q->result_array();
|
||||
|
||||
$data[0] = 'Nothing';
|
||||
|
||||
foreach ($res as $row)
|
||||
{
|
||||
$data[$row['id']] = $row['group_name'];
|
||||
}
|
||||
|
||||
return $data;
|
||||
}
|
||||
|
||||
function add_tech_group_desc_admin($data)
|
||||
{
|
||||
$sql = "INSERT INTO technology_group_descriptions
|
||||
VALUES(default, '" . $data['group_name'] . "')";
|
||||
|
||||
$this->db->query($sql);
|
||||
|
||||
$this->_create_sql($sql);
|
||||
}
|
||||
|
||||
function edit_tech_group_desc_admin($data)
|
||||
{
|
||||
$sql = "UPDATE technology_group_descriptions
|
||||
SET group_name='" . $data['group_name'] . "'
|
||||
WHERE id='" . $data['id'] . "'";
|
||||
|
||||
$this->db->query($sql);
|
||||
|
||||
$this->_create_sql($sql);
|
||||
}
|
||||
|
||||
function get_tech_group_desc_admin($id)
|
||||
{
|
||||
$sql = "SELECT * FROM technology_group_descriptions WHERE id='$id'";
|
||||
$q = $this->db->query($sql);
|
||||
|
||||
return $q->row_array();
|
||||
}
|
||||
|
||||
function list_tech_groups_admin()
|
||||
{
|
||||
$sql = "SELECT * FROM technology_group_descriptions";
|
||||
$q = $this->db->query($sql);
|
||||
|
||||
return $q->result_array();
|
||||
}
|
||||
|
||||
function list_technologies_admin()
|
||||
{
|
||||
$sql = "SELECT * FROM technologies";
|
||||
$q = $this->db->query($sql);
|
||||
|
||||
return $q->result_array();
|
||||
}
|
||||
|
||||
function get_technology_admin($id)
|
||||
{
|
||||
$sql = "SELECT * FROM technologies WHERE id='$id'";
|
||||
$q = $this->db->query($sql);
|
||||
|
||||
return $q->row_array();
|
||||
}
|
||||
|
||||
function edit_technology_admin($data)
|
||||
{
|
||||
|
||||
$sql = "UPDATE technologies
|
||||
SET description='" . $data['description'] . "',
|
||||
time='" . $data['time'] . "',
|
||||
score='" . $data['score'] . "',
|
||||
cost_food='" . $data['cost_food'] . "',
|
||||
cost_wood='" . $data['cost_wood'] . "',
|
||||
cost_stone='" . $data['cost_stone'] . "',
|
||||
cost_iron='" . $data['cost_iron'] . "',
|
||||
cost_mana='" . $data['cost_mana'] . "',
|
||||
mod_max_food='" . $data['mod_max_food'] . "',
|
||||
mod_max_wood='" . $data['mod_max_wood'] . "',
|
||||
mod_max_stone='" . $data['mod_max_stone'] . "',
|
||||
mod_max_iron='" . $data['mod_max_iron'] . "',
|
||||
mod_max_mana='" . $data['mod_max_mana'] . "',
|
||||
mod_rate_food='" . $data['mod_rate_food'] . "',
|
||||
mod_rate_wood='" . $data['mod_rate_wood'] . "',
|
||||
mod_rate_stone='" . $data['mod_rate_stone'] . "',
|
||||
mod_rate_iron='" . $data['mod_rate_iron'] . "',
|
||||
mod_rate_mana='" . $data['mod_rate_mana'] . "',
|
||||
mod_percent_food='" . $data['mod_percent_food'] . "',
|
||||
mod_percent_wood='" . $data['mod_percent_wood'] . "',
|
||||
mod_percent_stone='" . $data['mod_percent_stone'] . "',
|
||||
mod_percent_iron='" . $data['mod_percent_iron'] . "',
|
||||
mod_percent_mana='" . $data['mod_percent_mana'] . "',
|
||||
mod_create_id='" . $data['mod_create_id'] . "',
|
||||
mod_spell_id='" . $data['mod_spell_id'] . "',
|
||||
flag_ai='" . $data['flag_ai'] . "',
|
||||
is_secondary='" . $data['is_secondary'] . "'
|
||||
WHERE id='" . $data['id'] . "'";
|
||||
|
||||
$this->db->query($sql);
|
||||
|
||||
$this->_create_sql($sql);
|
||||
}
|
||||
|
||||
function add_technology_admin($data)
|
||||
{
|
||||
$sql = "INSERT INTO technologies VALUES(default,
|
||||
'" . $data['description'] . "',
|
||||
'" . $data['time'] . "',
|
||||
'" . $data['score'] . "',
|
||||
'" . $data['cost_food'] . "',
|
||||
'" . $data['cost_wood'] . "',
|
||||
'" . $data['cost_stone'] . "',
|
||||
'" . $data['cost_iron'] . "',
|
||||
'" . $data['cost_mana'] . "',
|
||||
'" . $data['mod_max_food'] . "',
|
||||
'" . $data['mod_max_wood'] . "',
|
||||
'" . $data['mod_max_stone'] . "',
|
||||
'" . $data['mod_max_iron'] . "',
|
||||
'" . $data['mod_max_mana'] . "',
|
||||
'" . $data['mod_rate_food'] . "',
|
||||
'" . $data['mod_rate_wood'] . "',
|
||||
'" . $data['mod_rate_stone'] . "',
|
||||
'" . $data['mod_rate_iron'] . "',
|
||||
'" . $data['mod_rate_mana'] . "',
|
||||
'" . $data['mod_percent_food'] . "',
|
||||
'" . $data['mod_percent_wood'] . "',
|
||||
'" . $data['mod_percent_stone'] . "',
|
||||
'" . $data['mod_percent_iron'] . "',
|
||||
'" . $data['mod_percent_mana'] . "',
|
||||
'" . $data['mod_create_id'] . "',
|
||||
'" . $data['mod_spell_id'] . "',
|
||||
'" . $data['flag_ai'] . "',
|
||||
'" . $data['is_secondary'] . "')";
|
||||
|
||||
$this->db->query($sql);
|
||||
|
||||
$this->_create_sql($sql);
|
||||
}
|
||||
}
|
||||
//nowhitesp
|
172
Mourne-CI/application/models/unit_model.php
Executable file
172
Mourne-CI/application/models/unit_model.php
Executable file
@ -0,0 +1,172 @@
|
||||
<?php
|
||||
class Unit_model extends MO_Model
|
||||
{
|
||||
function __construct()
|
||||
{
|
||||
parent::__construct();
|
||||
}
|
||||
|
||||
function get_village_units($villageid)
|
||||
{
|
||||
$sql = "SELECT users.username,units.*,village_units.userid,village_units.unitcount
|
||||
FROM village_units
|
||||
LEFT JOIN users ON village_units.userid=users.id
|
||||
LEFT JOIN units ON village_units.unitid=units.id
|
||||
WHERE villageid='$villageid'";
|
||||
|
||||
$q = $this->db->query($sql);
|
||||
|
||||
//TODO order it!
|
||||
|
||||
return $q->result_array();
|
||||
}
|
||||
|
||||
function get_unit($id)
|
||||
{
|
||||
$sql = "SELECT * FROM units WHERE id='$id'";
|
||||
$q = $this->db->query($sql);
|
||||
|
||||
return $q->row_array();
|
||||
}
|
||||
|
||||
//calculates how many units can be created (by lookin at events)
|
||||
//nothing gets queried
|
||||
function calc_max_unit_ev($unit_max, $unit_res, $event)
|
||||
{
|
||||
$in_progress = 0;
|
||||
|
||||
if ($event)
|
||||
{
|
||||
foreach ($event as $row)
|
||||
{
|
||||
$in_progress += $row['data2'];
|
||||
}
|
||||
}
|
||||
|
||||
//if more are in progress that the building can make
|
||||
if ($in_progress >= $unit_max)
|
||||
return 0;
|
||||
|
||||
//calc how many can be made overall
|
||||
$max = $unit_max - $in_progress;
|
||||
|
||||
//if less can be made because of events than the resources allow
|
||||
if ($max <= $unit_res)
|
||||
return $max;
|
||||
|
||||
//if events allow more than resources
|
||||
if ($max > $unit_res)
|
||||
return $unit_res;
|
||||
|
||||
return $max;
|
||||
}
|
||||
|
||||
function list_create_mod_drop_admin()
|
||||
{
|
||||
//STUB
|
||||
return array('0' => 'Nothing');
|
||||
}
|
||||
|
||||
function list_units_admin()
|
||||
{
|
||||
$sql = "SELECT * FROM units";
|
||||
$q = $this->db->query($sql);
|
||||
|
||||
return $q->result_array();
|
||||
}
|
||||
|
||||
function get_unit_list_dropdown_admin()
|
||||
{
|
||||
$sql = "SELECT * FROM units";
|
||||
$q = $this->db->query($sql);
|
||||
|
||||
$res = $q->result_array();
|
||||
|
||||
$data[0] = 'Nothing';
|
||||
|
||||
|
||||
foreach ($res as $row)
|
||||
{
|
||||
$data[$row['id']] = $row['name'];
|
||||
}
|
||||
|
||||
return $data;
|
||||
}
|
||||
|
||||
function add_unit_admin($data)
|
||||
{
|
||||
$sql = "INSERT INTO units
|
||||
VALUES(default,
|
||||
'" . $data['type'] . "',
|
||||
'" . $data['name'] . "',
|
||||
'" . $data['icon'] . "',
|
||||
'" . $data['score'] . "',
|
||||
'" . $data['can_defend'] . "',
|
||||
'" . $data['defense'] . "',
|
||||
'" . $data['attack'] . "',
|
||||
'" . $data['weak_against'] . "',
|
||||
'" . $data['strong_against'] . "',
|
||||
'" . $data['turn'] . "',
|
||||
'" . $data['ability'] . "',
|
||||
'" . $data['time_to_create'] . "',
|
||||
'" . $data['cost_unit'] . "',
|
||||
'" . $data['cost_num_unit'] . "',
|
||||
'" . $data['cost_food'] . "',
|
||||
'" . $data['cost_wood'] . "',
|
||||
'" . $data['cost_stone'] . "',
|
||||
'" . $data['cost_iron'] . "',
|
||||
'" . $data['cost_mana'] . "',
|
||||
'" . $data['mod_rate_food'] . "',
|
||||
'" . $data['mod_rate_wood'] . "',
|
||||
'" . $data['mod_rate_stone'] . "',
|
||||
'" . $data['mod_rate_iron'] . "',
|
||||
'" . $data['mod_rate_mana'] . "')";
|
||||
|
||||
$this->db->query($sql);
|
||||
|
||||
$this->_create_sql($sql);
|
||||
}
|
||||
|
||||
function get_unit_admin($id)
|
||||
{
|
||||
$sql = "SELECT * FROM units WHERE id='$id'";
|
||||
$q = $this->db->query($sql);
|
||||
|
||||
return $q->row_array();
|
||||
}
|
||||
|
||||
function edit_unit_admin($data)
|
||||
{
|
||||
$sql = "UPDATE units
|
||||
SET type='" . $data['type'] . "',
|
||||
name='" . $data['name'] . "',
|
||||
icon='" . $data['icon'] . "',
|
||||
score='" . $data['score'] . "',
|
||||
can_defend='" . $data['can_defend'] . "',
|
||||
defense='" . $data['defense'] . "',
|
||||
attack='" . $data['attack'] . "',
|
||||
weak_against='" . $data['weak_against'] . "',
|
||||
strong_against='" . $data['strong_against'] . "',
|
||||
turn='" . $data['turn'] . "',
|
||||
ability='" . $data['ability'] . "',
|
||||
time_to_create='" . $data['time_to_create'] . "',
|
||||
cost_unit='" . $data['cost_unit'] . "',
|
||||
cost_num_unit='" . $data['cost_num_unit'] . "',
|
||||
cost_food='" . $data['cost_food'] . "',
|
||||
cost_wood='" . $data['cost_wood'] . "',
|
||||
cost_stone='" . $data['cost_stone'] . "',
|
||||
cost_iron='" . $data['cost_iron'] . "',
|
||||
cost_mana='" . $data['cost_mana'] . "',
|
||||
mod_rate_food='" . $data['mod_rate_food'] . "',
|
||||
mod_rate_wood='" . $data['mod_rate_wood'] . "',
|
||||
mod_rate_stone='" . $data['mod_rate_stone'] . "',
|
||||
mod_rate_iron='" . $data['mod_rate_iron'] . "',
|
||||
mod_rate_mana='" . $data['mod_rate_mana'] . "'
|
||||
WHERE id='" . $data['id'] . "'";
|
||||
|
||||
$this->db->query($sql);
|
||||
|
||||
$this->_create_sql($sql);
|
||||
}
|
||||
}
|
||||
//nowhitesp
|
72
Mourne-CI/application/models/user_model.php
Executable file
72
Mourne-CI/application/models/user_model.php
Executable file
@ -0,0 +1,72 @@
|
||||
<?php
|
||||
|
||||
class User_model extends MO_Model
|
||||
{
|
||||
function __construct()
|
||||
{
|
||||
parent::__construct();
|
||||
}
|
||||
|
||||
function login_check($data)
|
||||
{
|
||||
$sql = "SELECT passkey FROM users WHERE username=" . $this->db->escape($data['username']);
|
||||
|
||||
$q = $this->db->query($sql);
|
||||
|
||||
if ($q->num_rows > 0)
|
||||
{
|
||||
$row = $q->row_array();
|
||||
|
||||
if ($row['passkey'] == $data['password'])
|
||||
{
|
||||
return TRUE;
|
||||
}
|
||||
else
|
||||
{
|
||||
return FALSE;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
return FALSE;
|
||||
}
|
||||
}
|
||||
|
||||
function get_userid($username)
|
||||
{
|
||||
$sql = "SELECT id FROM users WHERE username=" . $this->db->escape($username);
|
||||
$q = $this->db->query($sql);
|
||||
$res = $q->row_array();
|
||||
|
||||
return $res['id'];
|
||||
}
|
||||
|
||||
function reg_username_check($uname)
|
||||
{
|
||||
$sql = "SELECT username FROM users WHERE username=" . $this->db->escape($uname);
|
||||
|
||||
$q = $this->db->query($sql);
|
||||
|
||||
if ($q->num_rows() == 0)
|
||||
{
|
||||
return TRUE;
|
||||
}
|
||||
else
|
||||
{
|
||||
return FALSE;
|
||||
}
|
||||
}
|
||||
|
||||
function reg_write($data)
|
||||
{
|
||||
$sql = "INSERT INTO users VALUES(default, "
|
||||
. $this->db->escape($data['username']) . ", '"
|
||||
. $data['password'] . "', '"
|
||||
. $data['email'] . "',
|
||||
default, default, default)";
|
||||
|
||||
|
||||
return $this->db->query($sql);
|
||||
}
|
||||
}
|
||||
//nowhitesp
|
194
Mourne-CI/application/models/village_model.php
Executable file
194
Mourne-CI/application/models/village_model.php
Executable file
@ -0,0 +1,194 @@
|
||||
<?php
|
||||
|
||||
class Village_model extends MO_Model
|
||||
{
|
||||
function __construct()
|
||||
{
|
||||
parent::__construct();
|
||||
}
|
||||
|
||||
function apply_settings($data)
|
||||
{
|
||||
if ($data['ai'])
|
||||
$ai = 1;
|
||||
else
|
||||
$ai = 0;
|
||||
|
||||
$sql = "UPDATE villages
|
||||
SET name='" . $data['name'] . "',
|
||||
ai_on = '$ai'
|
||||
WHERE id='" . $data['id'] . "'";
|
||||
|
||||
$this->db->query($sql);
|
||||
}
|
||||
|
||||
function get_village($id)
|
||||
{
|
||||
$sql = "SELECT * FROM villages WHERE id='$id'";
|
||||
|
||||
$q = $this->db->query($sql);
|
||||
|
||||
return $q->row_array();
|
||||
}
|
||||
|
||||
function select_village($id, $userid)
|
||||
{
|
||||
//first check if villageid belongs to user
|
||||
$sql = "SELECT * FROM villages WHERE id='$id'";
|
||||
|
||||
$q = $this->db->query($sql);
|
||||
|
||||
if (!$q->num_rows())
|
||||
return;
|
||||
|
||||
$res = $q->row_array();
|
||||
|
||||
if ($res['userid'] != $userid)
|
||||
return;
|
||||
|
||||
if ($res['selected'])
|
||||
return;
|
||||
|
||||
$sql = "UPDATE villages SET selected='0' WHERE userid='$userid'";
|
||||
|
||||
$this->db->query($sql);
|
||||
|
||||
$sql = "UPDATE villages SET selected='1' WHERE id='$id'";
|
||||
|
||||
$this->db->query($sql);
|
||||
}
|
||||
|
||||
function get_villages($userid)
|
||||
{
|
||||
$sql = "SELECT * FROM villages WHERE userid='$userid' ORDER BY score DESC";
|
||||
|
||||
$q = $this->db->query($sql);
|
||||
|
||||
return $q->result_array();
|
||||
}
|
||||
|
||||
function create_village($userid, $username, $posx = -1, $posy = -1)
|
||||
{
|
||||
//make all village unselected
|
||||
$sql = "UPDATE villages
|
||||
SET selected='0'
|
||||
WHERE userid='$userid'";
|
||||
|
||||
$this->db->query($sql);
|
||||
|
||||
$villagename = $username . "\'s village";
|
||||
|
||||
$sql = "INSERT INTO villages VALUES(default, '$userid', '$villagename',
|
||||
default, '1', default, default, default, default, default, default)";
|
||||
|
||||
$this->db->query($sql);
|
||||
|
||||
//getting back id from newly created village
|
||||
$sql = "SELECT id FROM villages WHERE userid='$userid' AND selected='1'";
|
||||
$q = $this->db->query($sql);
|
||||
$res = $q->row_array();
|
||||
|
||||
$id = $res['id'];
|
||||
|
||||
//resources-> id, villageid, res[5], max_res[5], rate_res[5], last_updated
|
||||
$time = time();
|
||||
|
||||
//make resources entry
|
||||
$sql = "INSERT INTO resources
|
||||
VALUES(default, '$id',
|
||||
default, default, default, default, default,
|
||||
default, default, default, default, default,
|
||||
default, default, default, default, default,
|
||||
default, default, default, default, default,
|
||||
default, default, default, default, default,
|
||||
'$time')";
|
||||
|
||||
$this->db->query($sql);
|
||||
|
||||
$found = FALSE;
|
||||
|
||||
while(!$found)
|
||||
{
|
||||
//get a map coordinates
|
||||
//we should get 20x20 field
|
||||
//ids start with 1, max is 240
|
||||
$x_m_s = rand(1, 220);
|
||||
$y_m_s = rand(1, 220);
|
||||
|
||||
$sql = "SELECT * FROM map
|
||||
WHERE (X >= '$x_m_s' AND X <= '" . ($x_m_s + 20) . "')
|
||||
AND (Y >= '$y_m_s' AND Y <= '" . ($y_m_s + 20) . "')";
|
||||
|
||||
$q = $this->db->query($sql);
|
||||
|
||||
$res = $q->result_array();
|
||||
|
||||
foreach ($res as $row)
|
||||
{
|
||||
if ($row['type'] == 0)
|
||||
{
|
||||
$found = TRUE;
|
||||
|
||||
$sql = "UPDATE map SET type='3', villageid='$id' WHERE id='" . $row['id'] . "'";
|
||||
|
||||
$this->db->query($sql);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
//slotids range from 1 to parent::TOTAL_BUILDINGS!
|
||||
//slot 0 can be used for a wall or something
|
||||
function get_buildings($vid)
|
||||
{
|
||||
//tODO Empty slots
|
||||
|
||||
//TODO query, get building info for empty spaces, and thats going to be pushed into empty
|
||||
//speces
|
||||
|
||||
$sql = "SELECT * FROM buildings WHERE id='1'";
|
||||
$q = $this->db->query($sql);
|
||||
$space = $q->row_array();
|
||||
|
||||
//this needs left join
|
||||
$sql = "SELECT * FROM village_buildings
|
||||
INNER JOIN buildings ON village_buildings.buildingid=buildings.id
|
||||
WHERE villageid='$vid' ORDER BY slotid ASC";
|
||||
$q = $this->db->query($sql);
|
||||
$res = $q->result_array();
|
||||
|
||||
$new = FALSE;
|
||||
$j = 0;
|
||||
|
||||
for ($i = 1; $i <= parent::TOTAL_BUILDINGS;$i++)
|
||||
{
|
||||
if (isset($res[$j]))
|
||||
{
|
||||
if ($res[$j]['slotid'] == $i)
|
||||
{
|
||||
$data[] = $res[$j];
|
||||
$j++;
|
||||
}
|
||||
else
|
||||
{
|
||||
$new = TRUE;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
$new = TRUE;
|
||||
}
|
||||
|
||||
if ($new)
|
||||
{
|
||||
$data[] = $space;
|
||||
$new = FALSE;
|
||||
}
|
||||
}
|
||||
|
||||
return $data;
|
||||
}
|
||||
}
|
||||
//nowhitesp
|
101
Mourne-CI/application/models/weather_model.php
Executable file
101
Mourne-CI/application/models/weather_model.php
Executable file
@ -0,0 +1,101 @@
|
||||
<?php
|
||||
class Weather_model extends MO_Model
|
||||
{
|
||||
function __construct()
|
||||
{
|
||||
parent::__construct();
|
||||
}
|
||||
|
||||
function get_weathers_drop_admin()
|
||||
{
|
||||
$sql = "SELECT * FROM weathers";
|
||||
$q = $this->db->query($sql);
|
||||
|
||||
$res = $q->result_array();
|
||||
|
||||
$data[] = 'Nothing';
|
||||
|
||||
foreach ($res as $row)
|
||||
{
|
||||
$data[] = $row['name'];
|
||||
}
|
||||
|
||||
return $data;
|
||||
}
|
||||
|
||||
function get_weather_effects_drop_admin()
|
||||
{
|
||||
$data[0] = 'No Effect';
|
||||
$data[1] = 'Fires';
|
||||
|
||||
return $data;
|
||||
}
|
||||
|
||||
function list_weathers_admin()
|
||||
{
|
||||
$sql = "SELECT * FROM weathers";
|
||||
$q = $this->db->query($sql);
|
||||
|
||||
return $q->result_array();
|
||||
}
|
||||
|
||||
function get_weather_admin($id)
|
||||
{
|
||||
$sql = "SELECT * FROM weathers WHERE id='$id'";
|
||||
$q = $this->db->query($sql);
|
||||
|
||||
return $q->row_array();
|
||||
}
|
||||
|
||||
function edit_weather_admin($data)
|
||||
{
|
||||
|
||||
$sql = "UPDATE weathers
|
||||
SET name='" . $data['name'] . "',
|
||||
description='" . $data['description'] . "',
|
||||
art='" . $data['art'] . "',
|
||||
css='" . $data['css'] . "',
|
||||
effect='" . $data['effect'] . "',
|
||||
mod_max_food='" . $data['mod_max_food'] . "',
|
||||
mod_max_wood='" . $data['mod_max_wood'] . "',
|
||||
mod_max_stone='" . $data['mod_max_stone'] . "',
|
||||
mod_max_iron='" . $data['mod_max_iron'] . "',
|
||||
mod_max_mana='" . $data['mod_max_mana'] . "',
|
||||
mod_percent_food='" . $data['mod_percent_food'] . "',
|
||||
mod_percent_wood='" . $data['mod_percent_wood'] . "',
|
||||
mod_percent_stone='" . $data['mod_percent_stone'] . "',
|
||||
mod_percent_iron='" . $data['mod_percent_iron'] . "',
|
||||
mod_percent_mana='" . $data['mod_percent_mana'] . "'
|
||||
WHERE id='" . $data['id'] . "'";
|
||||
|
||||
$this->db->query($sql);
|
||||
|
||||
$this->_create_sql($sql);
|
||||
}
|
||||
|
||||
function add_weather_admin($data)
|
||||
{
|
||||
$sql = "INSERT INTO weathers VALUES(default,
|
||||
'" . $data['name'] . "',
|
||||
'" . $data['description'] . "',
|
||||
'" . $data['art'] . "',
|
||||
'" . $data['css'] . "',
|
||||
'" . $data['effect'] . "',
|
||||
'" . $data['mod_max_food'] . "',
|
||||
'" . $data['mod_max_wood'] . "',
|
||||
'" . $data['mod_max_stone'] . "',
|
||||
'" . $data['mod_max_iron'] . "',
|
||||
'" . $data['mod_max_mana'] . "',
|
||||
'" . $data['mod_percent_food'] . "',
|
||||
'" . $data['mod_percent_wood'] . "',
|
||||
'" . $data['mod_percent_stone'] . "',
|
||||
'" . $data['mod_percent_iron'] . "',
|
||||
'" . $data['mod_percent_mana'] . "')";
|
||||
|
||||
$this->db->query($sql);
|
||||
|
||||
$this->_create_sql($sql);
|
||||
}
|
||||
|
||||
}
|
||||
//nowhitesp
|
42
Mourne-CI/application/views/admin/ai_settings_tool/list.php
Executable file
42
Mourne-CI/application/views/admin/ai_settings_tool/list.php
Executable file
@ -0,0 +1,42 @@
|
||||
<?php
|
||||
$this->load->helper('url');
|
||||
|
||||
$link_new = 'admin/ai_settings';
|
||||
$link_edit = 'admin/ai_settings/';
|
||||
|
||||
$link_back = 'admin/admin_panel';
|
||||
?>
|
||||
<div class="back">
|
||||
<a href="<?=site_url($link_back); ?>"><--- Back</a>
|
||||
</div>
|
||||
<div class="top_menu">
|
||||
<a href="<?=site_url($link_new); ?>">Create New</a>
|
||||
</div>
|
||||
<div class="list_container">
|
||||
<?php $i = 1; ?>
|
||||
<?php foreach ($settings as $row): ?>
|
||||
<?php $link = $link_edit . $row['id']; ?>
|
||||
<?php if (!($i % 2)): ?>
|
||||
<div class="row">
|
||||
<?php else: ?>
|
||||
<div class="row second">
|
||||
<?php endif; ?>
|
||||
<div class="attr_box">
|
||||
[<?=$row['id']; ?>]
|
||||
</div>
|
||||
<div class="attr_box">
|
||||
<?=$row['setting']; ?> =
|
||||
</div>
|
||||
<div class="attr_box">
|
||||
<?=$row['value']; ?>
|
||||
</div>
|
||||
<div class="name">
|
||||
(<?=$row['description']; ?>)
|
||||
</div>
|
||||
<div class="actionbox">
|
||||
<a href="<?=site_url($link); ?>">Edit</a>
|
||||
</div>
|
||||
</div>
|
||||
<?php $i++; ?>
|
||||
<?php endforeach; ?>
|
||||
</div>
|
88
Mourne-CI/application/views/admin/ai_settings_tool/settings.php
Executable file
88
Mourne-CI/application/views/admin/ai_settings_tool/settings.php
Executable file
@ -0,0 +1,88 @@
|
||||
<?php
|
||||
$this->load->helper('url');
|
||||
$this->load->helper('form');
|
||||
|
||||
$link_back = 'admin/ai_settings_tool';
|
||||
|
||||
$attr_description = array(
|
||||
'name' => 'description',
|
||||
'rows' => '5',
|
||||
'cols' => '50',
|
||||
'class' => 'textarea');
|
||||
|
||||
$attr_setting = array(
|
||||
'name' => 'setting',
|
||||
'class' => 'input');
|
||||
|
||||
$attr_value = array(
|
||||
'name' => 'value',
|
||||
'class' => 'input');
|
||||
|
||||
$attr_submit = array(
|
||||
'name' => 'submit',
|
||||
'value' => 'Submit',
|
||||
'class' => 'submit');
|
||||
|
||||
if ($new)
|
||||
{
|
||||
//set every value with set_value()
|
||||
$link_form = 'admin/ai_settings';
|
||||
|
||||
$attr_setting['value'] = set_value('setting');
|
||||
$attr_value['value'] = set_value('value');
|
||||
$attr_description['value'] = set_value('description');
|
||||
}
|
||||
else
|
||||
{
|
||||
//set every value from data sent
|
||||
$link_form = 'admin/ai_settings/' . $setting['id'];
|
||||
|
||||
$attr_setting['value'] = $setting['setting'];
|
||||
$attr_value['value'] = $setting['value'];
|
||||
$attr_description['value'] = $setting['description'];
|
||||
}
|
||||
?>
|
||||
<div class="back">
|
||||
<a href="<?=site_url($link_back); ?>"><-- Back</a>
|
||||
</div>
|
||||
<div class="action">
|
||||
<?php if ($new): ?>
|
||||
Creating!
|
||||
<?php else: ?>
|
||||
Editing!
|
||||
<?php endif; ?>
|
||||
</div>
|
||||
<?=validation_errors(); ?>
|
||||
<?=form_open($link_form); ?>
|
||||
|
||||
<div class="row_edit_textbox">
|
||||
<div class="edit_name">
|
||||
Description:
|
||||
</div>
|
||||
<div class="edit_input">
|
||||
<?=form_textarea($attr_description); ?>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="row_edit">
|
||||
<div class="edit_name">
|
||||
Setting:
|
||||
</div>
|
||||
<div class="edit_input">
|
||||
<?=form_input($attr_setting); ?>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="row_edit">
|
||||
<div class="edit_name">
|
||||
Value:
|
||||
</div>
|
||||
<div class="edit_input">
|
||||
<?=form_input($attr_value); ?>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="edit_submit">
|
||||
<?=form_submit($attr_submit); ?>
|
||||
</div>
|
||||
<?=form_close(); ?>
|
35
Mourne-CI/application/views/admin/ai_unit_tool/list.php
Executable file
35
Mourne-CI/application/views/admin/ai_unit_tool/list.php
Executable file
@ -0,0 +1,35 @@
|
||||
<?php
|
||||
$this->load->helper('url');
|
||||
|
||||
$link_edit = 'admin/ai_unit/';
|
||||
$link_new = 'admin/ai_unit';
|
||||
$link_back = 'admin/admin_panel';
|
||||
?>
|
||||
<div class="back">
|
||||
<a href="<?=site_url($link_back); ?>"><--- Back</a>
|
||||
</div>
|
||||
<div class="top_menu">
|
||||
<a href="<?=site_url($link_new); ?>">Create New</a>
|
||||
</div>
|
||||
<div class="list_container">
|
||||
<?php $i = 1; ?>
|
||||
<?php foreach ($units as $row): ?>
|
||||
<?php $link = $link_edit . $row['id']; ?>
|
||||
<?php if (!($i % 2)): ?>
|
||||
<div class="row">
|
||||
<?php else: ?>
|
||||
<div class="row second">
|
||||
<?php endif; ?>
|
||||
<div class="attr_box">
|
||||
[<?=$row['id']; ?>]
|
||||
</div>
|
||||
<div class="name">
|
||||
<?=$row['name']; ?>
|
||||
</div>
|
||||
<div class="actionbox">
|
||||
<a href="<?=site_url($link); ?>">Edit</a>
|
||||
</div>
|
||||
</div>
|
||||
<?php $i++; ?>
|
||||
<?php endforeach; ?>
|
||||
</div>
|
211
Mourne-CI/application/views/admin/ai_unit_tool/unit.php
Executable file
211
Mourne-CI/application/views/admin/ai_unit_tool/unit.php
Executable file
@ -0,0 +1,211 @@
|
||||
<?php
|
||||
$this->load->helper('url');
|
||||
$this->load->helper('form');
|
||||
|
||||
$link_back = 'admin/ai_unit_tool';
|
||||
|
||||
$attr_drop = 'class="drop"';
|
||||
|
||||
$attr_name = array(
|
||||
'name' => 'name',
|
||||
'class' => 'input');
|
||||
|
||||
$attr_icon = array(
|
||||
'name' => 'icon',
|
||||
'class' => 'input');
|
||||
|
||||
$attr_ability = array(
|
||||
'name' => 'ability',
|
||||
'class' => 'input');
|
||||
|
||||
$attr_can_carry = array(
|
||||
'name' => 'can_carry',
|
||||
'class' => 'input');
|
||||
|
||||
$attr_attack = array(
|
||||
'name' => 'attack',
|
||||
'class' => 'input');
|
||||
|
||||
$attr_defense = array(
|
||||
'name' => 'defense',
|
||||
'class' => 'input');
|
||||
|
||||
$attr_rate = array(
|
||||
'name' => 'rate',
|
||||
'class' => 'input');
|
||||
|
||||
$attr_per_score = array(
|
||||
'name' => 'per_score',
|
||||
'class' => 'input');
|
||||
|
||||
$attr_turn = array(
|
||||
'name' => 'turn',
|
||||
'class' => 'input');
|
||||
|
||||
$attr_submit = array(
|
||||
'name' => 'submit',
|
||||
'value' => 'Submit',
|
||||
'class' => 'submit');
|
||||
|
||||
if ($new)
|
||||
{
|
||||
//set every value with set_value()
|
||||
$link_form = 'admin/ai_unit';
|
||||
|
||||
$attr_name['value'] = set_value('name');
|
||||
$attr_icon['value'] = set_value('icon');
|
||||
$attr_ability['value'] = set_value('ability');
|
||||
|
||||
$attr_can_carry['value'] = set_value('can_carry');
|
||||
$attr_attack['value'] = set_value('attack');
|
||||
$attr_defense['value'] = set_value('defense');
|
||||
$attr_rate['value'] = set_value('rate');
|
||||
$attr_per_score['value'] = set_value('per_score');
|
||||
$attr_turn['value'] = set_value('turn');
|
||||
}
|
||||
else
|
||||
{
|
||||
//set every value from data sent
|
||||
$link_form = 'admin/ai_unit/' . $unit['id'];
|
||||
|
||||
$attr_name['value'] = $unit['name'];
|
||||
$attr_icon['value'] = $unit['icon'];
|
||||
$attr_ability['value'] = $unit['ability'];
|
||||
$attr_can_carry['value'] = $unit['can_carry'];
|
||||
|
||||
$attr_attack['value'] = $unit['attack'];
|
||||
$attr_defense['value'] = $unit['defense'];
|
||||
$attr_rate['value'] = $unit['rate'];
|
||||
$attr_per_score['value'] = $unit['per_score'];
|
||||
$attr_turn['value'] = $unit['turn'];
|
||||
|
||||
$sstrong = $unit['strong_against'];
|
||||
$sweak = $unit['weak_against'];
|
||||
}
|
||||
?>
|
||||
<div class="back">
|
||||
<a href="<?=site_url($link_back); ?>"><-- Back</a>
|
||||
</div>
|
||||
<div class="action">
|
||||
<?php if ($new): ?>
|
||||
Creating!
|
||||
<?php else: ?>
|
||||
Editing!
|
||||
<?php endif; ?>
|
||||
</div>
|
||||
<?=validation_errors(); ?>
|
||||
<?=form_open($link_form); ?>
|
||||
|
||||
<div class="row_edit">
|
||||
<div class="edit_name">
|
||||
Name:
|
||||
</div>
|
||||
<div class="edit_input">
|
||||
<?=form_input($attr_name); ?>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="row_edit">
|
||||
<div class="edit_name">
|
||||
Icon:
|
||||
</div>
|
||||
<div class="edit_input">
|
||||
<?=form_input($attr_icon); ?>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="edit_spacer"></div>
|
||||
|
||||
<div class="row_edit">
|
||||
<div class="edit_name">
|
||||
Ability:
|
||||
</div>
|
||||
<div class="edit_input">
|
||||
<?=form_input($attr_ability); ?>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="edit_spacer"></div>
|
||||
|
||||
<div class="row_edit">
|
||||
<div class="edit_name">
|
||||
Can Carry:
|
||||
</div>
|
||||
<div class="edit_input">
|
||||
<?=form_input($attr_can_carry); ?>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="row_edit">
|
||||
<div class="edit_name">
|
||||
Attack:
|
||||
</div>
|
||||
<div class="edit_input">
|
||||
<?=form_input($attr_attack); ?>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="row_edit">
|
||||
<div class="edit_name">
|
||||
Defense:
|
||||
</div>
|
||||
<div class="edit_input">
|
||||
<?=form_input($attr_defense); ?>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="edit_spacer"></div>
|
||||
|
||||
<div class="row_edit">
|
||||
<div class="edit_name">
|
||||
Rate:
|
||||
</div>
|
||||
<div class="edit_input">
|
||||
<?=form_input($attr_rate); ?>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="row_edit">
|
||||
<div class="edit_name">
|
||||
Per Score:
|
||||
</div>
|
||||
<div class="edit_input">
|
||||
<?=form_input($attr_per_score); ?>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="row_edit">
|
||||
<div class="edit_name">
|
||||
Turn:
|
||||
</div>
|
||||
<div class="edit_input">
|
||||
<?=form_input($attr_turn); ?>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="edit_spacer"></div>
|
||||
|
||||
<div class="row_edit">
|
||||
<div class="edit_name">
|
||||
Strong Against:
|
||||
</div>
|
||||
<div class="edit_input">
|
||||
<?=form_dropdown('strong_against', $optu, $sstrong, $attr_drop); ?>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="edit_spacer"></div>
|
||||
|
||||
<div class="row_edit">
|
||||
<div class="edit_name">
|
||||
Weak Against:
|
||||
</div>
|
||||
<div class="edit_input">
|
||||
<?=form_dropdown('weak_against', $optu, $sweak, $attr_drop); ?>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="edit_submit">
|
||||
<?=form_submit($attr_submit); ?>
|
||||
</div>
|
||||
<?=form_close(); ?>
|
374
Mourne-CI/application/views/admin/assignment_tool/assignment.php
Executable file
374
Mourne-CI/application/views/admin/assignment_tool/assignment.php
Executable file
@ -0,0 +1,374 @@
|
||||
<?php
|
||||
$this->load->helper('url');
|
||||
$this->load->helper('form');
|
||||
|
||||
$link_back = 'admin/assignment_tool';
|
||||
|
||||
$name_unit = 'unitid';
|
||||
$attr_unit = 'class="drop"';
|
||||
|
||||
$attr_max = array(
|
||||
'name' => 'max',
|
||||
'class' => 'input');
|
||||
|
||||
$attr_bonus_per_assigned = array(
|
||||
'name' => 'bonus_per_assigned',
|
||||
'class' => 'input');
|
||||
|
||||
$name_spellid = 'spellid';
|
||||
$attr_spellid = 'class="drop"';
|
||||
|
||||
$name_req_tech = 'req_tech';
|
||||
$attr_req_tech = 'class="drop"';
|
||||
|
||||
$attr_mod_max_food = array(
|
||||
'name' => 'mod_max_food',
|
||||
'class' => 'input');
|
||||
|
||||
$attr_mod_max_wood = array(
|
||||
'name' => 'mod_max_wood',
|
||||
'class' => 'input');
|
||||
|
||||
$attr_mod_max_stone = array(
|
||||
'name' => 'mod_max_stone',
|
||||
'class' => 'input');
|
||||
|
||||
$attr_mod_max_iron = array(
|
||||
'name' => 'mod_max_iron',
|
||||
'class' => 'input');
|
||||
|
||||
$attr_mod_max_mana = array(
|
||||
'name' => 'mod_max_mana',
|
||||
'class' => 'input');
|
||||
|
||||
$attr_mod_rate_food = array(
|
||||
'name' => 'mod_rate_food',
|
||||
'class' => 'input');
|
||||
|
||||
$attr_mod_rate_wood = array(
|
||||
'name' => 'mod_rate_wood',
|
||||
'class' => 'input');
|
||||
|
||||
$attr_mod_rate_stone = array(
|
||||
'name' => 'mod_rate_stone',
|
||||
'class' => 'input');
|
||||
|
||||
$attr_mod_rate_iron = array(
|
||||
'name' => 'mod_rate_iron',
|
||||
'class' => 'input');
|
||||
|
||||
$attr_mod_rate_mana = array(
|
||||
'name' => 'mod_rate_mana',
|
||||
'class' => 'input');
|
||||
|
||||
$attr_mod_percent_food = array(
|
||||
'name' => 'mod_percent_food',
|
||||
'class' => 'input');
|
||||
|
||||
$attr_mod_percent_wood = array(
|
||||
'name' => 'mod_percent_wood',
|
||||
'class' => 'input');
|
||||
|
||||
$attr_mod_percent_stone = array(
|
||||
'name' => 'mod_percent_stone',
|
||||
'class' => 'input');
|
||||
|
||||
$attr_mod_percent_iron = array(
|
||||
'name' => 'mod_percent_iron',
|
||||
'class' => 'input');
|
||||
|
||||
$attr_mod_percent_mana = array(
|
||||
'name' => 'mod_percent_mana',
|
||||
'class' => 'input');
|
||||
|
||||
$attr_description = array(
|
||||
'name' => 'description',
|
||||
'rows' => '5',
|
||||
'cols' => '50',
|
||||
'class' => 'textarea');
|
||||
|
||||
$attr_submit = array(
|
||||
'name' => 'submit',
|
||||
'value' => 'Submit',
|
||||
'class' => 'submit');
|
||||
|
||||
if ($new)
|
||||
{
|
||||
//set every value with set_value()
|
||||
$link_form = 'admin/assignment';
|
||||
//unitid goes from controller
|
||||
$attr_max['value'] = set_value('max');
|
||||
$attr_bonus_per_assigned['value'] = set_value('bonus_per_assigned');
|
||||
|
||||
$attr_mod_max_food['value'] = set_value('mod_max_food');
|
||||
$attr_mod_max_wood['value'] = set_value('mod_max_wood');
|
||||
$attr_mod_max_stone['value'] = set_value('mod_max_stone');
|
||||
$attr_mod_max_iron['value'] = set_value('mod_max_iron');
|
||||
$attr_mod_max_mana['value'] = set_value('mod_max_mana');
|
||||
|
||||
$attr_mod_rate_food['value'] = set_value('mod_rate_food');
|
||||
$attr_mod_rate_wood['value'] = set_value('mod_rate_wood');
|
||||
$attr_mod_rate_stone['value'] = set_value('mod_rate_stone');
|
||||
$attr_mod_rate_iron['value'] = set_value('mod_rate_iron');
|
||||
$attr_mod_rate_mana['value'] = set_value('mod_rate_mana');
|
||||
|
||||
$attr_mod_percent_food['value'] = set_value('mod_percent_food');
|
||||
$attr_mod_percent_wood['value'] = set_value('mod_percent_wood');
|
||||
$attr_mod_percent_stone['value'] = set_value('mod_percent_stone');
|
||||
$attr_mod_percent_iron['value'] = set_value('mod_percent_iron');
|
||||
$attr_mod_percent_mana['value'] = set_value('mod_percent_mana');
|
||||
|
||||
$attr_description['value'] = set_value('description');
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
//set every value from data sent
|
||||
$link_form = 'admin/assignment/' . $assignment['id'];
|
||||
|
||||
//I have no idea why a simple = wouldn't work
|
||||
$dassign = $assignment['unitid'];
|
||||
$sassign = $dassign;
|
||||
|
||||
$attr_max['value'] = $assignment['max'];
|
||||
$attr_bonus_per_assigned['value'] = $assignment['bonus_per_assigned'];
|
||||
|
||||
$ssp = $assignment['spellid'];
|
||||
|
||||
$srtech = $assignment['req_tech'];
|
||||
|
||||
$attr_mod_max_food['value'] = $assignment['mod_max_food'];
|
||||
$attr_mod_max_wood['value'] = $assignment['mod_max_wood'];
|
||||
$attr_mod_max_stone['value'] = $assignment['mod_max_stone'];
|
||||
$attr_mod_max_iron['value'] = $assignment['mod_max_iron'];
|
||||
$attr_mod_max_mana['value'] = $assignment['mod_max_mana'];
|
||||
|
||||
$attr_mod_rate_food['value'] = $assignment['mod_rate_food'];
|
||||
$attr_mod_rate_wood['value'] = $assignment['mod_rate_wood'];
|
||||
$attr_mod_rate_stone['value'] = $assignment['mod_rate_stone'];
|
||||
$attr_mod_rate_iron['value'] = $assignment['mod_rate_iron'];
|
||||
$attr_mod_rate_mana['value'] = $assignment['mod_rate_mana'];
|
||||
|
||||
$attr_mod_percent_food['value'] = $assignment['mod_percent_food'];
|
||||
$attr_mod_percent_wood['value'] = $assignment['mod_percent_wood'];
|
||||
$attr_mod_percent_stone['value'] = $assignment['mod_percent_stone'];
|
||||
$attr_mod_percent_iron['value'] = $assignment['mod_percent_iron'];
|
||||
$attr_mod_percent_mana['value'] = $assignment['mod_percent_mana'];
|
||||
|
||||
$attr_description['value'] = $assignment['description'];
|
||||
}
|
||||
?>
|
||||
<div class="back">
|
||||
<a href="<?=site_url($link_back); ?>"><-- Back</a>
|
||||
</div>
|
||||
<div class="action">
|
||||
<?php if ($new): ?>
|
||||
Creating!
|
||||
<?php else: ?>
|
||||
Editing!
|
||||
<?php endif; ?>
|
||||
</div>
|
||||
<?=validation_errors(); ?>
|
||||
<?=form_open($link_form); ?>
|
||||
|
||||
<div class="row_edit">
|
||||
<div class="edit_name">
|
||||
Unit:
|
||||
</div>
|
||||
<div class="edit_input">
|
||||
<?=form_dropdown($name_unit, $optass, $sassign, $attr_unit); ?>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="row_edit">
|
||||
<div class="edit_name">
|
||||
Max:
|
||||
</div>
|
||||
<div class="edit_input">
|
||||
<?=form_input($attr_max); ?>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="row_edit">
|
||||
<div class="edit_name">
|
||||
Bonus per Assigned:
|
||||
</div>
|
||||
<div class="edit_input">
|
||||
<?=form_input($attr_bonus_per_assigned); ?>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="row_edit">
|
||||
<div class="edit_name">
|
||||
Spell:
|
||||
</div>
|
||||
<div class="edit_input">
|
||||
<?=form_dropdown($name_spellid, $optsp, $ssp, $attr_spellid); ?>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="row_edit">
|
||||
<div class="edit_name">
|
||||
Required Technology:
|
||||
</div>
|
||||
<div class="edit_input">
|
||||
<?=form_dropdown($name_req_tech, $optrtech, $srtech, $attr_req_tech); ?>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="edit_spacer"></div>
|
||||
|
||||
<div class="row_edit">
|
||||
<div class="edit_name">
|
||||
Mod Max Food:
|
||||
</div>
|
||||
<div class="edit_input">
|
||||
<?=form_input($attr_mod_max_food); ?>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="row_edit">
|
||||
<div class="edit_name">
|
||||
Mod Max Wood:
|
||||
</div>
|
||||
<div class="edit_input">
|
||||
<?=form_input($attr_mod_max_wood); ?>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="row_edit">
|
||||
<div class="edit_name">
|
||||
Mod Max Stone:
|
||||
</div>
|
||||
<div class="edit_input">
|
||||
<?=form_input($attr_mod_max_stone); ?>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="row_edit">
|
||||
<div class="edit_name">
|
||||
Mod Max Iron:
|
||||
</div>
|
||||
<div class="edit_input">
|
||||
<?=form_input($attr_mod_max_iron); ?>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="row_edit">
|
||||
<div class="edit_name">
|
||||
Mod Max Mana:
|
||||
</div>
|
||||
<div class="edit_input">
|
||||
<?=form_input($attr_mod_max_mana); ?>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="edit_spacer"></div>
|
||||
|
||||
<div class="row_edit">
|
||||
<div class="edit_name">
|
||||
Mod Rate Food:
|
||||
</div>
|
||||
<div class="edit_input">
|
||||
<?=form_input($attr_mod_rate_food); ?>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="row_edit">
|
||||
<div class="edit_name">
|
||||
Mod Rate Wood:
|
||||
</div>
|
||||
<div class="edit_input">
|
||||
<?=form_input($attr_mod_rate_wood); ?>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="row_edit">
|
||||
<div class="edit_name">
|
||||
Mod Rate Stone:
|
||||
</div>
|
||||
<div class="edit_input">
|
||||
<?=form_input($attr_mod_rate_stone); ?>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="row_edit">
|
||||
<div class="edit_name">
|
||||
Mod Rate Iron:
|
||||
</div>
|
||||
<div class="edit_input">
|
||||
<?=form_input($attr_mod_rate_iron); ?>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="row_edit">
|
||||
<div class="edit_name">
|
||||
Mod Rate Mana:
|
||||
</div>
|
||||
<div class="edit_input">
|
||||
<?=form_input($attr_mod_rate_mana); ?>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="edit_spacer"></div>
|
||||
|
||||
<div class="row_edit">
|
||||
<div class="edit_name">
|
||||
Mod Percent Food:
|
||||
</div>
|
||||
<div class="edit_input">
|
||||
<?=form_input($attr_mod_percent_food); ?>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="row_edit">
|
||||
<div class="edit_name">
|
||||
Mod Percent Wood:
|
||||
</div>
|
||||
<div class="edit_input">
|
||||
<?=form_input($attr_mod_percent_wood); ?>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="row_edit">
|
||||
<div class="edit_name">
|
||||
Mod Percent Stone:
|
||||
</div>
|
||||
<div class="edit_input">
|
||||
<?=form_input($attr_mod_percent_stone); ?>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="row_edit">
|
||||
<div class="edit_name">
|
||||
Mod Percent Iron:
|
||||
</div>
|
||||
<div class="edit_input">
|
||||
<?=form_input($attr_mod_percent_iron); ?>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="row_edit">
|
||||
<div class="edit_name">
|
||||
Mod Percent Mana:
|
||||
</div>
|
||||
<div class="edit_input">
|
||||
<?=form_input($attr_mod_percent_mana); ?>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="edit_spacer"></div>
|
||||
|
||||
<div class="row_edit_textbox">
|
||||
<div class="edit_name">
|
||||
Description:
|
||||
</div>
|
||||
<div class="edit_input">
|
||||
<?=form_textarea($attr_description); ?>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="edit_submit">
|
||||
<?=form_submit($attr_submit); ?>
|
||||
</div>
|
||||
<?=form_close(); ?>
|
41
Mourne-CI/application/views/admin/assignment_tool/list.php
Executable file
41
Mourne-CI/application/views/admin/assignment_tool/list.php
Executable file
@ -0,0 +1,41 @@
|
||||
<?php
|
||||
$this->load->helper('url');
|
||||
|
||||
$link_edit = 'admin/assignment/';
|
||||
$link_new = 'admin/assignment';
|
||||
$link_back = 'admin/admin_panel';
|
||||
?>
|
||||
<div class="back">
|
||||
<a href="<?=site_url($link_back); ?>"><--- Back</a>
|
||||
</div>
|
||||
<div class="top_menu">
|
||||
<a href="<?=site_url($link_new); ?>">Create New</a>
|
||||
</div>
|
||||
<div class="list_container">
|
||||
<?php $i = 1; ?>
|
||||
<?php foreach ($assignments as $row): ?>
|
||||
<?php $link = $link_edit . $row['id']; ?>
|
||||
<?php if (!($i % 2)): ?>
|
||||
<div class="row">
|
||||
<?php else: ?>
|
||||
<div class="row second">
|
||||
<?php endif; ?>
|
||||
<div class="attr_box">
|
||||
[<?=$row['id']; ?>]
|
||||
</div>
|
||||
<div class="attr_box">
|
||||
[U: <?=$row['unitid']; ?>]
|
||||
</div>
|
||||
<div class="attr_box">
|
||||
[M: <?=$row['max']; ?>]
|
||||
</div>
|
||||
<div class="name">
|
||||
<?=$row['description']; ?>
|
||||
</div>
|
||||
<div class="actionbox">
|
||||
<a href="<?=site_url($link); ?>">Edit</a>
|
||||
</div>
|
||||
</div>
|
||||
<?php $i++; ?>
|
||||
<?php endforeach; ?>
|
||||
</div>
|
635
Mourne-CI/application/views/admin/building_tool/building.php
Executable file
635
Mourne-CI/application/views/admin/building_tool/building.php
Executable file
@ -0,0 +1,635 @@
|
||||
<?php
|
||||
$this->load->helper('url');
|
||||
$this->load->helper('form');
|
||||
|
||||
$link_back = 'admin/building_tool';
|
||||
|
||||
$attr_drop = 'class="drop"';
|
||||
|
||||
$attr_name = array(
|
||||
'name' => 'name',
|
||||
'class' => 'input');
|
||||
|
||||
$attr_description = array(
|
||||
'name' => 'description',
|
||||
'rows' => '5',
|
||||
'cols' => '50',
|
||||
'class' => 'textarea');
|
||||
|
||||
$attr_icon = array(
|
||||
'name' => 'icon',
|
||||
'class' => 'input');
|
||||
|
||||
$attr_rank = array(
|
||||
'name' => 'rank',
|
||||
'class' => 'input');
|
||||
|
||||
|
||||
$name_next_rank = 'next_rank';
|
||||
$attr_next_rank = 'class="drop"';
|
||||
|
||||
$attr_time_to_build = array(
|
||||
'name' => 'time_to_build',
|
||||
'class' => 'input');
|
||||
|
||||
$name_creates = 'creates';
|
||||
$attr_creates = 'class="drop"';
|
||||
|
||||
$attr_num_creates = array(
|
||||
'name' => 'num_creates',
|
||||
'class' => 'input');
|
||||
|
||||
$attr_score = array(
|
||||
'name' => 'score',
|
||||
'class' => 'input');
|
||||
|
||||
$attr_defense = array(
|
||||
'name' => 'defense',
|
||||
'class' => 'input');
|
||||
|
||||
$opt_ability = array(
|
||||
'0' => 'Nothing',
|
||||
'1' => "Enemy can't steal resources");
|
||||
|
||||
$attr_cost_food = array(
|
||||
'name' => 'cost_food',
|
||||
'class' => 'input');
|
||||
|
||||
$attr_cost_wood = array(
|
||||
'name' => 'cost_wood',
|
||||
'class' => 'input');
|
||||
|
||||
$attr_cost_stone = array(
|
||||
'name' => 'cost_stone',
|
||||
'class' => 'input');
|
||||
|
||||
$attr_cost_iron = array(
|
||||
'name' => 'cost_iron',
|
||||
'class' => 'input');
|
||||
|
||||
$attr_cost_mana = array(
|
||||
'name' => 'cost_mana',
|
||||
'class' => 'input');
|
||||
|
||||
$attr_mod_max_food = array(
|
||||
'name' => 'mod_max_food',
|
||||
'class' => 'input');
|
||||
|
||||
$attr_mod_max_wood = array(
|
||||
'name' => 'mod_max_wood',
|
||||
'class' => 'input');
|
||||
|
||||
$attr_mod_max_stone = array(
|
||||
'name' => 'mod_max_stone',
|
||||
'class' => 'input');
|
||||
|
||||
$attr_mod_max_iron = array(
|
||||
'name' => 'mod_max_iron',
|
||||
'class' => 'input');
|
||||
|
||||
$attr_mod_max_mana = array(
|
||||
'name' => 'mod_max_mana',
|
||||
'class' => 'input');
|
||||
|
||||
|
||||
$attr_mod_rate_food = array(
|
||||
'name' => 'mod_rate_food',
|
||||
'class' => 'input');
|
||||
|
||||
$attr_mod_rate_wood = array(
|
||||
'name' => 'mod_rate_wood',
|
||||
'class' => 'input');
|
||||
|
||||
$attr_mod_rate_stone = array(
|
||||
'name' => 'mod_rate_stone',
|
||||
'class' => 'input');
|
||||
|
||||
$attr_mod_rate_iron = array(
|
||||
'name' => 'mod_rate_iron',
|
||||
'class' => 'input');
|
||||
|
||||
$attr_mod_rate_mana = array(
|
||||
'name' => 'mod_rate_mana',
|
||||
'class' => 'input');
|
||||
|
||||
$attr_mod_percent_food = array(
|
||||
'name' => 'mod_percent_food',
|
||||
'class' => 'input');
|
||||
|
||||
$attr_mod_percent_wood = array(
|
||||
'name' => 'mod_percent_wood',
|
||||
'class' => 'input');
|
||||
|
||||
$attr_mod_percent_stone = array(
|
||||
'name' => 'mod_percent_stone',
|
||||
'class' => 'input');
|
||||
|
||||
$attr_mod_percent_iron = array(
|
||||
'name' => 'mod_percent_iron',
|
||||
'class' => 'input');
|
||||
|
||||
$attr_mod_percent_mana = array(
|
||||
'name' => 'mod_percent_mana',
|
||||
'class' => 'input');
|
||||
|
||||
$name_assign1 = 'assign1';
|
||||
$name_assign2 = 'assign2';
|
||||
$name_assign3 = 'assign3';
|
||||
$name_assign4 = 'assign4';
|
||||
$name_assign5 = 'assign5';
|
||||
|
||||
$attr_assign = 'class="drop"';
|
||||
|
||||
$name_req_tech = 'req_tech';
|
||||
$attr_req_tech = 'class="drop"';
|
||||
|
||||
$name_tech_group = 'tech_group';
|
||||
$attr_tech_group = 'class="drop"';
|
||||
|
||||
$name_tech_secondary_group = 'tech_secondary_group';
|
||||
$attr_tech_secondary_group = 'class="drop"';
|
||||
|
||||
$attr_submit = array(
|
||||
'name' => 'submit',
|
||||
'value' => 'Submit',
|
||||
'class' => 'submit');
|
||||
|
||||
if ($new)
|
||||
{
|
||||
//set every value with set_value()
|
||||
$link_form = 'admin/building';
|
||||
$attr_name['value'] = set_value('name');
|
||||
$attr_description['value'] = set_value('description');
|
||||
$attr_icon['value'] = set_value('icon');
|
||||
$attr_rank['value'] = set_value('rank');
|
||||
//next rank goes from controller
|
||||
$attr_time_to_build['value'] = set_value('time_to_build');
|
||||
|
||||
$attr_num_creates['value'] = set_value('num_creates');
|
||||
|
||||
$attr_score['value'] = set_value('score');
|
||||
$attr_defense['value'] = set_value('defense');
|
||||
|
||||
$attr_cost_food['value'] = set_value('cost_food');
|
||||
$attr_cost_wood['value'] = set_value('cost_wood');
|
||||
$attr_cost_stone['value'] = set_value('cost_stone');
|
||||
$attr_cost_iron['value'] = set_value('cost_iron');
|
||||
$attr_cost_mana['value'] = set_value('cost_mana');
|
||||
|
||||
$attr_mod_max_food['value'] = set_value('mod_max_food');
|
||||
$attr_mod_max_wood['value'] = set_value('mod_max_wood');
|
||||
$attr_mod_max_stone['value'] = set_value('mod_max_stone');
|
||||
$attr_mod_max_iron['value'] = set_value('mod_max_iron');
|
||||
$attr_mod_max_mana['value'] = set_value('mod_max_mana');
|
||||
|
||||
$attr_mod_rate_food['value'] = set_value('mod_rate_food');
|
||||
$attr_mod_rate_wood['value'] = set_value('mod_rate_wood');
|
||||
$attr_mod_rate_stone['value'] = set_value('mod_rate_stone');
|
||||
$attr_mod_rate_iron['value'] = set_value('mod_rate_iron');
|
||||
$attr_mod_rate_mana['value'] = set_value('mod_rate_mana');
|
||||
|
||||
$attr_mod_percent_food['value'] = set_value('mod_percent_food');
|
||||
$attr_mod_percent_wood['value'] = set_value('mod_percent_wood');
|
||||
$attr_mod_percent_stone['value'] = set_value('mod_percent_stone');
|
||||
$attr_mod_percent_iron['value'] = set_value('mod_percent_iron');
|
||||
$attr_mod_percent_mana['value'] = set_value('mod_percent_mana');
|
||||
}
|
||||
else
|
||||
{
|
||||
//set every value from data sent
|
||||
$link_form = 'admin/building/' . $building['id'];
|
||||
$attr_name['value'] = $building['name'];
|
||||
$attr_description['value'] = $building['description'];
|
||||
$attr_icon['value'] = $building['icon'];
|
||||
$attr_rank['value'] = $building['rank'];
|
||||
$nextr = $building['next_rank'];
|
||||
$attr_time_to_build['value'] = $building['time_to_build'];
|
||||
|
||||
$screate = $building['creates'];
|
||||
$attr_num_creates['value'] = $building['num_creates'];
|
||||
|
||||
$attr_score['value'] = $building['score'];
|
||||
$attr_defense['value'] = $building['defense'];
|
||||
|
||||
$sability = $building['ability'];
|
||||
|
||||
$attr_cost_food['value'] = $building['cost_food'];
|
||||
$attr_cost_wood['value'] = $building['cost_wood'];
|
||||
$attr_cost_stone['value'] = $building['cost_stone'];
|
||||
$attr_cost_iron['value'] = $building['cost_iron'];
|
||||
$attr_cost_mana['value'] = $building['cost_mana'];
|
||||
|
||||
$attr_mod_max_food['value'] = $building['mod_max_food'];
|
||||
$attr_mod_max_wood['value'] = $building['mod_max_wood'];
|
||||
$attr_mod_max_stone['value'] = $building['mod_max_stone'];
|
||||
$attr_mod_max_iron['value'] = $building['mod_max_iron'];
|
||||
$attr_mod_max_mana['value'] = $building['mod_max_mana'];
|
||||
|
||||
$attr_mod_rate_food['value'] = $building['mod_rate_food'];
|
||||
$attr_mod_rate_wood['value'] = $building['mod_rate_wood'];
|
||||
$attr_mod_rate_stone['value'] = $building['mod_rate_stone'];
|
||||
$attr_mod_rate_iron['value'] = $building['mod_rate_iron'];
|
||||
$attr_mod_rate_mana['value'] = $building['mod_rate_mana'];
|
||||
|
||||
$attr_mod_percent_food['value'] = $building['mod_percent_food'];
|
||||
$attr_mod_percent_wood['value'] = $building['mod_percent_wood'];
|
||||
$attr_mod_percent_stone['value'] = $building['mod_percent_stone'];
|
||||
$attr_mod_percent_iron['value'] = $building['mod_percent_iron'];
|
||||
$attr_mod_percent_mana['value'] = $building['mod_percent_mana'];
|
||||
|
||||
$assign1 = $building['assignment1'];
|
||||
$assign2 = $building['assignment2'];
|
||||
$assign3 = $building['assignment3'];
|
||||
$assign4 = $building['assignment4'];
|
||||
$assign5 = $building['assignment5'];
|
||||
|
||||
$selreqtech = $building['req_tech'];
|
||||
|
||||
$seltechgroup = $building['tech_group'];
|
||||
$seltechsecgroup = $building['tech_secondary_group'];
|
||||
}
|
||||
?>
|
||||
<div class="back">
|
||||
<a href="<?=site_url($link_back); ?>"><-- Back</a>
|
||||
</div>
|
||||
<div class="action">
|
||||
<?php if ($new): ?>
|
||||
Creating!
|
||||
<?php else: ?>
|
||||
Editing!
|
||||
<?php endif; ?>
|
||||
</div>
|
||||
<?=validation_errors(); ?>
|
||||
<div class="edit_container">
|
||||
<?=form_open($link_form); ?>
|
||||
|
||||
<div class="row_edit">
|
||||
<div class="edit_name">
|
||||
Name:
|
||||
</div>
|
||||
<div class="edit_input">
|
||||
<?=form_input($attr_name); ?>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="row_edit_textbox">
|
||||
<div class="edit_name">
|
||||
Description:
|
||||
</div>
|
||||
<div class="edit_input">
|
||||
<?=form_textarea($attr_description); ?>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="row_edit">
|
||||
<div class="edit_name">
|
||||
Icon:
|
||||
</div>
|
||||
<div class="edit_input">
|
||||
<?=form_input($attr_icon); ?>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="row_edit">
|
||||
<div class="edit_name">
|
||||
Rank:
|
||||
</div>
|
||||
<div class="edit_input">
|
||||
<?=form_input($attr_rank); ?>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="row_edit">
|
||||
<div class="edit_name">
|
||||
Next Rank:
|
||||
</div>
|
||||
<div class="edit_input">
|
||||
<?=form_dropdown($name_next_rank, $optnr, $nextr, $attr_next_rank); ?>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="row_edit">
|
||||
<div class="edit_name">
|
||||
Time to Build:
|
||||
</div>
|
||||
<div class="edit_input">
|
||||
<?=form_input($attr_time_to_build); ?>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="edit_spacer"></div>
|
||||
|
||||
<div class="row_edit">
|
||||
<div class="edit_name">
|
||||
Score:
|
||||
</div>
|
||||
<div class="edit_input">
|
||||
<?=form_input($attr_score); ?>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="row_edit">
|
||||
<div class="edit_name">
|
||||
Defense:
|
||||
</div>
|
||||
<div class="edit_input">
|
||||
<?=form_input($attr_defense); ?>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="row_edit">
|
||||
<div class="edit_name">
|
||||
Ability:
|
||||
</div>
|
||||
<div class="edit_input">
|
||||
<?=form_dropdown('ability', $opt_ability, $sability, $attr_drop); ?>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
<div class="edit_spacer"></div>
|
||||
|
||||
<div class="row_edit">
|
||||
<div class="edit_name">
|
||||
Cost Food:
|
||||
</div>
|
||||
<div class="edit_input">
|
||||
<?=form_input($attr_cost_food); ?>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="row_edit">
|
||||
<div class="edit_name">
|
||||
Cost Wood:
|
||||
</div>
|
||||
<div class="edit_input">
|
||||
<?=form_input($attr_cost_wood); ?>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="row_edit">
|
||||
<div class="edit_name">
|
||||
Cost Stone:
|
||||
</div>
|
||||
<div class="edit_input">
|
||||
<?=form_input($attr_cost_stone); ?>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="row_edit">
|
||||
<div class="edit_name">
|
||||
Cost Iron:
|
||||
</div>
|
||||
<div class="edit_input">
|
||||
<?=form_input($attr_cost_iron); ?>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="row_edit">
|
||||
<div class="edit_name">
|
||||
Cost Mana:
|
||||
</div>
|
||||
<div class="edit_input">
|
||||
<?=form_input($attr_cost_mana); ?>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="edit_spacer"></div>
|
||||
|
||||
<div class="row_edit">
|
||||
<div class="edit_name">
|
||||
Creates:
|
||||
</div>
|
||||
<div class="edit_input">
|
||||
<?=form_dropdown($name_creates, $optcre, $screate, $attr_creates); ?>
|
||||
X (max) <?=form_input($attr_num_creates); ?>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="edit_spacer"></div>
|
||||
|
||||
<div class="row_edit">
|
||||
<div class="edit_name">
|
||||
Mod Max Food:
|
||||
</div>
|
||||
<div class="edit_input">
|
||||
<?=form_input($attr_mod_max_food); ?>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="row_edit">
|
||||
<div class="edit_name">
|
||||
Mod Max Wood:
|
||||
</div>
|
||||
<div class="edit_input">
|
||||
<?=form_input($attr_mod_max_wood); ?>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="row_edit">
|
||||
<div class="edit_name">
|
||||
Mos Max Stone:
|
||||
</div>
|
||||
<div class="edit_input">
|
||||
<?=form_input($attr_mod_max_stone); ?>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="row_edit">
|
||||
<div class="edit_name">
|
||||
Mod Max Iron:
|
||||
</div>
|
||||
<div class="edit_input">
|
||||
<?=form_input($attr_mod_max_iron); ?>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="row_edit">
|
||||
<div class="edit_name">
|
||||
Mod Max Mana:
|
||||
</div>
|
||||
<div class="edit_input">
|
||||
<?=form_input($attr_mod_max_mana); ?>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="edit_spacer"></div>
|
||||
|
||||
<div class="row_edit">
|
||||
<div class="edit_name">
|
||||
Mod Rate Food:
|
||||
</div>
|
||||
<div class="edit_input">
|
||||
<?=form_input($attr_mod_rate_food); ?>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="row_edit">
|
||||
<div class="edit_name">
|
||||
Mod rate Wood:
|
||||
</div>
|
||||
<div class="edit_input">
|
||||
<?=form_input($attr_mod_rate_wood); ?>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="row_edit">
|
||||
<div class="edit_name">
|
||||
Mod Rate Stone:
|
||||
</div>
|
||||
<div class="edit_input">
|
||||
<?=form_input($attr_mod_rate_stone); ?>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="row_edit">
|
||||
<div class="edit_name">
|
||||
Mod Rate Iron:
|
||||
</div>
|
||||
<div class="edit_input">
|
||||
<?=form_input($attr_mod_rate_iron); ?>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="row_edit">
|
||||
<div class="edit_name">
|
||||
Mod Rate Mana:
|
||||
</div>
|
||||
<div class="edit_input">
|
||||
<?=form_input($attr_mod_rate_mana); ?>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="edit_spacer"></div>
|
||||
|
||||
<div class="row_edit">
|
||||
<div class="edit_name">
|
||||
Mod Percent Food:
|
||||
</div>
|
||||
<div class="edit_input">
|
||||
<?=form_input($attr_mod_percent_food); ?>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="row_edit">
|
||||
<div class="edit_name">
|
||||
Mod Percent Wood:
|
||||
</div>
|
||||
<div class="edit_input">
|
||||
<?=form_input($attr_mod_percent_wood); ?>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="row_edit">
|
||||
<div class="edit_name">
|
||||
Mod Percent Stone:
|
||||
</div>
|
||||
<div class="edit_input">
|
||||
<?=form_input($attr_mod_percent_stone); ?>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="row_edit">
|
||||
<div class="edit_name">
|
||||
Mod Percent Iron:
|
||||
</div>
|
||||
<div class="edit_input">
|
||||
<?=form_input($attr_mod_percent_iron); ?>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="row_edit">
|
||||
<div class="edit_name">
|
||||
Mod Percent Mana:
|
||||
</div>
|
||||
<div class="edit_input">
|
||||
<?=form_input($attr_mod_percent_mana); ?>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="edit_spacer"></div>
|
||||
|
||||
<div class="row_edit">
|
||||
<div class="edit_name">
|
||||
Assignment 1:
|
||||
</div>
|
||||
<div class="edit_input">
|
||||
<?=form_dropdown($name_assign1, $optass, $assign1, $attr_assign); ?>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="row_edit">
|
||||
<div class="edit_name">
|
||||
Assignment 2:
|
||||
</div>
|
||||
<div class="edit_input">
|
||||
<?=form_dropdown($name_assign2, $optass, $assign2, $attr_assign); ?>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="row_edit">
|
||||
<div class="edit_name">
|
||||
Assignment 3:
|
||||
</div>
|
||||
<div class="edit_input">
|
||||
<?=form_dropdown($name_assign3, $optass, $assign3, $attr_assign); ?>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="row_edit">
|
||||
<div class="edit_name">
|
||||
Assignment 4:
|
||||
</div>
|
||||
<div class="edit_input">
|
||||
<?=form_dropdown($name_assign4, $optass, $assign4, $attr_assign); ?>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="row_edit">
|
||||
<div class="edit_name">
|
||||
Assignment 5:
|
||||
</div>
|
||||
<div class="edit_input">
|
||||
<?=form_dropdown($name_assign5, $optass, $assign5, $attr_assign); ?>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="edit_spacer"></div>
|
||||
|
||||
<div class="row_edit">
|
||||
<div class="edit_name">
|
||||
Required Technology:
|
||||
</div>
|
||||
<div class="edit_input">
|
||||
<?=form_dropdown($name_req_tech, $optreqtech, $selreqtech, $attr_req_tech); ?>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="edit_spacer"></div>
|
||||
|
||||
<div class="row_edit">
|
||||
<div class="edit_name">
|
||||
Technology Group:
|
||||
</div>
|
||||
<div class="edit_input">
|
||||
<?=form_dropdown($name_tech_group, $opttechgroup, $seltechgroup, $attr_assign);?>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="edit_spacer"></div>
|
||||
|
||||
<div class="row_edit">
|
||||
<div class="edit_name">
|
||||
Secondary Technology Group:
|
||||
</div>
|
||||
<div class="edit_input">
|
||||
<?=form_dropdown($name_tech_secondary_group, $opttechgroup,
|
||||
$seltechsecgroup, $attr_tech_secondary_group); ?>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="edit_submit">
|
||||
<?=form_submit($attr_submit); ?>
|
||||
</div>
|
||||
<?=form_close(); ?>
|
||||
</div>
|
41
Mourne-CI/application/views/admin/building_tool/list.php
Executable file
41
Mourne-CI/application/views/admin/building_tool/list.php
Executable file
@ -0,0 +1,41 @@
|
||||
<?php
|
||||
$this->load->helper('url');
|
||||
|
||||
$link_edit = 'admin/building/';
|
||||
$link_new = 'admin/building';
|
||||
$link_back = 'admin/admin_panel';
|
||||
?>
|
||||
<div class="back">
|
||||
<a href="<?=site_url($link_back); ?>"><--- Back</a>
|
||||
</div>
|
||||
<div class="top_menu">
|
||||
<a href="<?=site_url($link_new); ?>">Create New</a>
|
||||
</div>
|
||||
<div class="list_container">
|
||||
<?php $i = 1; ?>
|
||||
<?php foreach ($buildings as $row): ?>
|
||||
<?php $link = $link_edit . $row['id']; ?>
|
||||
<?php if (!($i % 2)): ?>
|
||||
<div class="row">
|
||||
<?php else: ?>
|
||||
<div class="row second">
|
||||
<?php endif; ?>
|
||||
<div class="attr_box">
|
||||
[<?=$row['id']; ?>]
|
||||
</div>
|
||||
<div class="attr_box">
|
||||
[Rank: <?=$row['rank']; ?>]
|
||||
</div>
|
||||
<div class="attr_box">
|
||||
[N Rank: <?=$row['next_rank']; ?>]
|
||||
</div>
|
||||
<div class="name">
|
||||
<?=$row['name']; ?>
|
||||
</div>
|
||||
<div class="actionbox">
|
||||
<a href="<?=site_url($link); ?>">Edit</a>
|
||||
</div>
|
||||
</div>
|
||||
<?php $i++; ?>
|
||||
<?php endforeach; ?>
|
||||
</div>
|
58
Mourne-CI/application/views/admin/hero_inventory_template_tool/items.php
Executable file
58
Mourne-CI/application/views/admin/hero_inventory_template_tool/items.php
Executable file
@ -0,0 +1,58 @@
|
||||
<?php
|
||||
$this->load->helper('url');
|
||||
$this->load->helper('form');
|
||||
|
||||
$link_form = 'admin/hero_inventory_templates/' . $id;
|
||||
|
||||
$link_back = 'admin/hero_inventory_template_tool';
|
||||
|
||||
$name_add_drop = 'add';
|
||||
$attr_add_drop = 'class="drop"';
|
||||
|
||||
$attr_add = array(
|
||||
'name' => 'submit',
|
||||
'value' => 'Add!',
|
||||
'class' => 'submit');
|
||||
|
||||
$attr_delete = array(
|
||||
'name' => 'submit',
|
||||
'value' => 'Delete!',
|
||||
'class' => 'submit');
|
||||
?>
|
||||
|
||||
<div class="back">
|
||||
<a href="<?=site_url($link_back); ?>"><-- Back</a>
|
||||
</div>
|
||||
<div class="action">
|
||||
Editing: [<?=$hero['id']; ?>] <?=$hero['classname']; ?>
|
||||
</div>
|
||||
<?=validation_errors(); ?>
|
||||
<?php if ($items): ?>
|
||||
<?php foreach ($items as $row): ?>
|
||||
<?=form_open($link_form); ?>
|
||||
<?=form_hidden('action', 'delete'); ?>
|
||||
<?=form_hidden('id', $row['id']); ?>
|
||||
<div class="row_edit">
|
||||
<div class="edit_name">
|
||||
[<?=$row['id']; ?>] <?=$row['name']; ?>
|
||||
</div>
|
||||
<div class="edit_input">
|
||||
<?=form_submit($attr_delete); ?>
|
||||
</div>
|
||||
</div>
|
||||
<?=form_close(); ?>
|
||||
<?php endforeach; ?>
|
||||
<?php endif; ?>
|
||||
<?=form_open($link_form); ?>
|
||||
<?=form_hidden('action', 'add'); ?>
|
||||
<?=form_hidden('classid', $hero['id']); ?>
|
||||
<div class="row_edit">
|
||||
<div class="edit_name">
|
||||
Add:
|
||||
</div>
|
||||
<div class="edit_input">
|
||||
<?=form_dropdown($name_add_drop, $optitems, $selitems, $attr_add_drop); ?>
|
||||
<?=form_submit($attr_add); ?>
|
||||
</div>
|
||||
</div>
|
||||
<?=form_close(); ?>
|
32
Mourne-CI/application/views/admin/hero_inventory_template_tool/list.php
Executable file
32
Mourne-CI/application/views/admin/hero_inventory_template_tool/list.php
Executable file
@ -0,0 +1,32 @@
|
||||
<?php
|
||||
$this->load->helper('url');
|
||||
|
||||
$link_edit = 'admin/hero_inventory_templates/';
|
||||
|
||||
$link_back = 'admin/admin_panel';
|
||||
?>
|
||||
<div class="back">
|
||||
<a href="<?=site_url($link_back); ?>"><--- Back</a>
|
||||
</div>
|
||||
<div class="list_container">
|
||||
<?php $i = 1; ?>
|
||||
<?php foreach ($classes as $row): ?>
|
||||
<?php $link = $link_edit . $row['id']; ?>
|
||||
<?php if (!($i % 2)): ?>
|
||||
<div class="row">
|
||||
<?php else: ?>
|
||||
<div class="row second">
|
||||
<?php endif; ?>
|
||||
<div class="attr_box">
|
||||
[<?=$row['id']; ?>]
|
||||
</div>
|
||||
<div class="name">
|
||||
<?=$row['classname']; ?>
|
||||
</div>
|
||||
<div class="actionbox">
|
||||
<a href="<?=site_url($link); ?>">Edit Items</a>
|
||||
</div>
|
||||
</div>
|
||||
<?php $i++; ?>
|
||||
<?php endforeach; ?>
|
||||
</div>
|
500
Mourne-CI/application/views/admin/hero_template_tool/hero.php
Executable file
500
Mourne-CI/application/views/admin/hero_template_tool/hero.php
Executable file
@ -0,0 +1,500 @@
|
||||
<?php
|
||||
$this->load->helper('url');
|
||||
$this->load->helper('form');
|
||||
|
||||
$link_back = 'admin/hero_template_tool';
|
||||
|
||||
$attr_drop = 'class="drop"';
|
||||
|
||||
$attr_classname = array(
|
||||
'name' => 'classname',
|
||||
'class' => 'input');
|
||||
|
||||
$attr_nomod_max_health = array(
|
||||
'name' => 'nomod_max_health',
|
||||
'class' => 'input');
|
||||
|
||||
$attr_nomod_max_mana = array(
|
||||
'name' => 'nomod_max_mana',
|
||||
'class' => 'input');
|
||||
|
||||
$attr_agility = array(
|
||||
'name' => 'agility',
|
||||
'class' => 'input');
|
||||
|
||||
$attr_strength = array(
|
||||
'name' => 'strength',
|
||||
'class' => 'input');
|
||||
|
||||
$attr_stamina = array(
|
||||
'name' => 'stamina',
|
||||
'class' => 'input');
|
||||
|
||||
$attr_intellect = array(
|
||||
'name' => 'intellect',
|
||||
'class' => 'input');
|
||||
|
||||
$attr_spirit = array(
|
||||
'name' => 'spirit',
|
||||
'class' => 'input');
|
||||
|
||||
$attr_nomod_attackpower = array(
|
||||
'name' => 'nomod_attackpower',
|
||||
'class' => 'input');
|
||||
|
||||
$attr_nomod_dodge = array(
|
||||
'name' => 'nomod_dodge',
|
||||
'class' => 'input');
|
||||
|
||||
$attr_nomod_parry = array(
|
||||
'name' => 'nomod_parry',
|
||||
'class' => 'input');
|
||||
|
||||
$attr_hit = array(
|
||||
'name' => 'hit',
|
||||
'class' => 'input');
|
||||
|
||||
$attr_nomod_crit = array(
|
||||
'name' => 'nomod_crit',
|
||||
'class' => 'input');
|
||||
|
||||
$attr_nomod_damage_min = array(
|
||||
'name' => 'nomod_damage_min',
|
||||
'class' => 'input');
|
||||
|
||||
$attr_nomod_damage_max = array(
|
||||
'name' => 'nomod_damage_max',
|
||||
'class' => 'input');
|
||||
|
||||
$attr_nomod_ranged_damage_min = array(
|
||||
'name' => 'nomod_ranged_damage_min',
|
||||
'class' => 'input');
|
||||
|
||||
$attr_nomod_ranged_damage_max = array(
|
||||
'name' => 'nomod_ranged_damage_max',
|
||||
'class' => 'input');
|
||||
|
||||
|
||||
$attr_nomod_heal_min = array(
|
||||
'name' => 'nomod_heal_min',
|
||||
'class' => 'input');
|
||||
|
||||
$attr_nomod_heal_max = array(
|
||||
'name' => 'nomod_heal_max',
|
||||
'class' => 'input');
|
||||
|
||||
$attr_submit = array(
|
||||
'name' => 'submit',
|
||||
'value' => 'Submit',
|
||||
'class' => 'submit');
|
||||
|
||||
if ($new)
|
||||
{
|
||||
//set every value with set_value()
|
||||
$link_form = 'admin/hero_templates';
|
||||
|
||||
//template effect goes from controller
|
||||
$attr_classname['value'] = set_value('classname');
|
||||
|
||||
$attr_nomod_max_health['value'] = set_value('nomod_max_health');
|
||||
$attr_nomod_max_mana['value'] = set_value('nomod_max_mana');
|
||||
|
||||
$attr_agility['value'] = set_value('agility');
|
||||
$attr_strength['value'] = set_value('strength');
|
||||
$attr_stamina['value'] = set_value('stamina');
|
||||
$attr_intellect['value'] = set_value('intellect');
|
||||
$attr_spirit['value'] = set_value('spirit');
|
||||
|
||||
$attr_nomod_attackpower['value'] = set_value('nomod_attackpower');
|
||||
|
||||
$attr_nomod_dodge['value'] = set_value('nomod_dodge');
|
||||
$attr_nomod_parry['value'] = set_value('nomod_parry');
|
||||
$attr_hit['value'] = set_value('hit');
|
||||
$attr_nomod_crit['value'] = set_value('nomod_crit');
|
||||
|
||||
$attr_nomod_damage_min['value'] = set_value('nomod_damage_min');
|
||||
$attr_nomod_damage_max['value'] = set_value('nomod_damage_max');
|
||||
|
||||
$attr_nomod_ranged_damage_min['value'] = set_value('nomod_ranged_damage_min');
|
||||
$attr_nomod_ranged_damage_max['value'] = set_value('nomod_ranged_damage_max');
|
||||
|
||||
$attr_nomod_heal_min['value'] = set_value('nomod_heal_min');
|
||||
$attr_nomod_heal_max['value'] = set_value('nomod_heal_max');
|
||||
}
|
||||
else
|
||||
{
|
||||
//set every value from data sent
|
||||
$link_form = 'admin/hero_templates/' . $template['id'];
|
||||
|
||||
$attr_classname['value'] = $template['classname'];
|
||||
|
||||
$attr_nomod_max_health['value'] = $template['nomod_max_health'];
|
||||
$attr_nomod_max_mana['value'] = $template['nomod_max_mana'];
|
||||
|
||||
$attr_agility['value'] = $template['agility'];
|
||||
$attr_strength['value'] = $template['strength'];
|
||||
$attr_stamina['value'] = $template['stamina'];
|
||||
$attr_intellect['value'] = $template['intellect'];
|
||||
$attr_spirit['value'] = $template['spirit'];
|
||||
|
||||
$attr_nomod_attackpower['value'] = $template['nomod_attackpower'];
|
||||
|
||||
$attr_nomod_dodge['value'] = $template['nomod_dodge'];
|
||||
$attr_nomod_parry['value'] = $template['nomod_parry'];
|
||||
$attr_hit['value'] = $template['hit'];
|
||||
$attr_nomod_crit['value'] = $template['nomod_crit'];
|
||||
|
||||
$attr_nomod_damage_min['value'] = $template['nomod_damage_min'];
|
||||
$attr_nomod_damage_max['value'] = $template['nomod_damage_max'];
|
||||
|
||||
$attr_nomod_ranged_damage_min['value'] = $template['nomod_ranged_damage_min'];
|
||||
$attr_nomod_ranged_damage_max['value'] = $template['nomod_ranged_damage_max'];
|
||||
|
||||
$attr_nomod_heal_min['value'] = $template['nomod_heal_min'];
|
||||
$attr_nomod_heal_max['value'] = $template['nomod_heal_max'];
|
||||
}
|
||||
?>
|
||||
<div class="back">
|
||||
<a href="<?=site_url($link_back); ?>"><-- Back</a>
|
||||
</div>
|
||||
<div class="action">
|
||||
<?php if ($new): ?>
|
||||
Creating!
|
||||
<?php else: ?>
|
||||
Editing!
|
||||
<?php endif; ?>
|
||||
</div>
|
||||
<?=validation_errors(); ?>
|
||||
<?=form_open($link_form); ?>
|
||||
|
||||
<div class="row_edit">
|
||||
<div class="edit_name">
|
||||
Class:
|
||||
</div>
|
||||
<div class="edit_input">
|
||||
<?=form_input($attr_classname); ?>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="edit_spacer"></div>
|
||||
|
||||
<div class="row_edit">
|
||||
<div class="edit_name">
|
||||
Nomod Health:
|
||||
</div>
|
||||
<div class="edit_input">
|
||||
<?=form_input($attr_nomod_max_health); ?>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="row_edit">
|
||||
<div class="edit_name">
|
||||
Nomod Mana:
|
||||
</div>
|
||||
<div class="edit_input">
|
||||
<?=form_input($attr_nomod_max_mana); ?>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="edit_spacer"></div>
|
||||
|
||||
<div class="row_edit">
|
||||
<div class="edit_name">
|
||||
Agility:
|
||||
</div>
|
||||
<div class="edit_input">
|
||||
<?=form_input($attr_agility); ?>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="row_edit">
|
||||
<div class="edit_name">
|
||||
Strength:
|
||||
</div>
|
||||
<div class="edit_input">
|
||||
<?=form_input($attr_strength); ?>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="row_edit">
|
||||
<div class="edit_name">
|
||||
Stamina:
|
||||
</div>
|
||||
<div class="edit_input">
|
||||
<?=form_input($attr_stamina); ?>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="row_edit">
|
||||
<div class="edit_name">
|
||||
Intellect:
|
||||
</div>
|
||||
<div class="edit_input">
|
||||
<?=form_input($attr_intellect); ?>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="row_edit">
|
||||
<div class="edit_name">
|
||||
Spirit:
|
||||
</div>
|
||||
<div class="edit_input">
|
||||
<?=form_input($attr_spirit); ?>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="edit_spacer"></div>
|
||||
|
||||
<div class="row_edit">
|
||||
<div class="edit_name">
|
||||
Nomod Attackpower:
|
||||
</div>
|
||||
<div class="edit_input">
|
||||
<?=form_input($attr_nomod_attackpower); ?>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="edit_spacer"></div>
|
||||
|
||||
<div class="row_edit">
|
||||
<div class="edit_name">
|
||||
Nomod Dodge:
|
||||
</div>
|
||||
<div class="edit_input">
|
||||
<?=form_input($attr_nomod_dodge); ?>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="row_edit">
|
||||
<div class="edit_name">
|
||||
Nomod Parry:
|
||||
</div>
|
||||
<div class="edit_input">
|
||||
<?=form_input($attr_nomod_parry); ?>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="row_edit">
|
||||
<div class="edit_name">
|
||||
Hit:
|
||||
</div>
|
||||
<div class="edit_input">
|
||||
<?=form_input($attr_hit); ?>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="row_edit">
|
||||
<div class="edit_name">
|
||||
Nomod Crit:
|
||||
</div>
|
||||
<div class="edit_input">
|
||||
<?=form_input($attr_nomod_crit); ?>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="edit_spacer"></div>
|
||||
|
||||
<div class="row_edit">
|
||||
<div class="edit_name">
|
||||
Nomod Damage Min:
|
||||
</div>
|
||||
<div class="edit_input">
|
||||
<?=form_input($attr_nomod_damage_min); ?>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="row_edit">
|
||||
<div class="edit_name">
|
||||
Nomod Damage Max:
|
||||
</div>
|
||||
<div class="edit_input">
|
||||
<?=form_input($attr_nomod_damage_max); ?>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="edit_spacer"></div>
|
||||
|
||||
<div class="row_edit">
|
||||
<div class="edit_name">
|
||||
Nomod Ranged Damage Min:
|
||||
</div>
|
||||
<div class="edit_input">
|
||||
<?=form_input($attr_nomod_ranged_damage_min); ?>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="row_edit">
|
||||
<div class="edit_name">
|
||||
Nomod Ranged Damage Max:
|
||||
</div>
|
||||
<div class="edit_input">
|
||||
<?=form_input($attr_nomod_ranged_damage_max); ?>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="edit_spacer"></div>
|
||||
|
||||
<div class="row_edit">
|
||||
<div class="edit_name">
|
||||
Nomod Heal Min:
|
||||
</div>
|
||||
<div class="edit_input">
|
||||
<?=form_input($attr_nomod_heal_min); ?>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="row_edit">
|
||||
<div class="edit_name">
|
||||
Nomod Heal Max:
|
||||
</div>
|
||||
<div class="edit_input">
|
||||
<?=form_input($attr_nomod_heal_max); ?>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<?php if(!$new): ?>
|
||||
<div class="edit_spacer"></div>
|
||||
|
||||
<div class="row_edit">
|
||||
<div class="edit_name">
|
||||
Calculated Values:
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="edit_spacer"></div>
|
||||
|
||||
<div class="row_edit">
|
||||
<div class="edit_name">
|
||||
Max Health:
|
||||
</div>
|
||||
<div class="edit_input">
|
||||
<?=$template['max_health']; ?>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="row_edit">
|
||||
<div class="edit_name">
|
||||
Max Mana:
|
||||
</div>
|
||||
<div class="edit_input">
|
||||
<?=$template['max_mana']; ?>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="edit_spacer"></div>
|
||||
|
||||
<div class="row_edit">
|
||||
<div class="edit_name">
|
||||
Attackpower:
|
||||
</div>
|
||||
<div class="edit_input">
|
||||
<?=$template['attackpower']; ?>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="edit_spacer"></div>
|
||||
|
||||
<div class="row_edit">
|
||||
<div class="edit_name">
|
||||
Crit:
|
||||
</div>
|
||||
<div class="edit_input">
|
||||
<?=$template['crit']; ?>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="row_edit">
|
||||
<div class="edit_name">
|
||||
Parry:
|
||||
</div>
|
||||
<div class="edit_input">
|
||||
<?=$template['parry']; ?>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="row_edit">
|
||||
<div class="edit_name">
|
||||
Dodge:
|
||||
</div>
|
||||
<div class="edit_input">
|
||||
<?=$template['dodge']; ?>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="edit_spacer"></div>
|
||||
|
||||
<div class="row_edit">
|
||||
<div class="edit_name">
|
||||
Armor:
|
||||
</div>
|
||||
<div class="edit_input">
|
||||
<?=$template['armor']; ?>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="edit_spacer"></div>
|
||||
|
||||
<div class="row_edit">
|
||||
<div class="edit_name">
|
||||
Damage Min:
|
||||
</div>
|
||||
<div class="edit_input">
|
||||
<?=$template['damage_min']; ?>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="row_edit">
|
||||
<div class="edit_name">
|
||||
Damage Max:
|
||||
</div>
|
||||
<div class="edit_input">
|
||||
<?=$template['damage_max']; ?>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="edit_spacer"></div>
|
||||
|
||||
<div class="row_edit">
|
||||
<div class="edit_name">
|
||||
Ranged Damage Min:
|
||||
</div>
|
||||
<div class="edit_input">
|
||||
<?=$template['ranged_damage_min']; ?>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="row_edit">
|
||||
<div class="edit_name">
|
||||
Ranged Damage Max:
|
||||
</div>
|
||||
<div class="edit_input">
|
||||
<?=$template['ranged_damage_max']; ?>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="edit_spacer"></div>
|
||||
|
||||
<div class="row_edit">
|
||||
<div class="edit_name">
|
||||
Heal Min:
|
||||
</div>
|
||||
<div class="edit_input">
|
||||
<?=$template['heal_min']; ?>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="row_edit">
|
||||
<div class="edit_name">
|
||||
Heal Max:
|
||||
</div>
|
||||
<div class="edit_input">
|
||||
<?=$template['heal_min']; ?>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<?php endif; ?>
|
||||
|
||||
<div class="edit_submit">
|
||||
<?=form_submit($attr_submit); ?>
|
||||
</div>
|
||||
<?=form_close(); ?>
|
39
Mourne-CI/application/views/admin/hero_template_tool/list.php
Executable file
39
Mourne-CI/application/views/admin/hero_template_tool/list.php
Executable file
@ -0,0 +1,39 @@
|
||||
<?php
|
||||
$this->load->helper('url');
|
||||
|
||||
$link_edit = 'admin/hero_templates/';
|
||||
$link_new = 'admin/hero_templates';
|
||||
|
||||
$link_back = 'admin/admin_panel';
|
||||
?>
|
||||
<div class="back">
|
||||
<a href="<?=site_url($link_back); ?>"><--- Back</a>
|
||||
</div>
|
||||
<div class="top_menu">
|
||||
<a href="<?=site_url($link_new); ?>">Create New</a>
|
||||
</div>
|
||||
<div class="list_container">
|
||||
<?php if ($templates): ?>
|
||||
<?php $i = 1; ?>
|
||||
<?php foreach ($templates as $row): ?>
|
||||
<?php $link = $link_edit . $row['id']; ?>
|
||||
<?php if (!($i % 2)): ?>
|
||||
<div class="row">
|
||||
<?php else: ?>
|
||||
<div class="row second">
|
||||
<?php endif; ?>
|
||||
<div class="attr_box">
|
||||
[<?=$row['id']; ?>]
|
||||
</div>
|
||||
<div class="attr_box">
|
||||
Class: <?=$row['classname']; ?>
|
||||
</div>
|
||||
<div class="actionbox">
|
||||
<a href="<?=site_url($link); ?>">Edit</a>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
<?php $i++; ?>
|
||||
<?php endforeach; ?>
|
||||
<?php endif; ?>
|
||||
</div>
|
209
Mourne-CI/application/views/admin/image_tool/menu_image.php
Executable file
209
Mourne-CI/application/views/admin/image_tool/menu_image.php
Executable file
@ -0,0 +1,209 @@
|
||||
<?php
|
||||
$this->load->helper('form');
|
||||
$this->load->helper('url');
|
||||
|
||||
$link_back = 'admin/admin_panel';
|
||||
$link_form = 'admin/menu_image';
|
||||
|
||||
$attr_drop = 'class="drop"';
|
||||
|
||||
$name_font = 'font';
|
||||
$attr_font = 'class="drop"';
|
||||
|
||||
$attr_padding = array(
|
||||
'name' => 'padding',
|
||||
'value' => '0',
|
||||
'class' => 'input');
|
||||
|
||||
$attr_h_offset = array(
|
||||
'name' => 'h_offset',
|
||||
'value' => '0',
|
||||
'class' => 'input');
|
||||
|
||||
$attr_v_offset = array(
|
||||
'name' => 'v_offset',
|
||||
'value' => '0',
|
||||
'class' => 'input');
|
||||
|
||||
$attr_text = array(
|
||||
'name' => 'text',
|
||||
'class' => 'input');
|
||||
|
||||
$attr_font_size = array(
|
||||
'name' => 'font_size',
|
||||
'value' => '12',
|
||||
'class' => 'input');
|
||||
|
||||
$attr_font_color = array(
|
||||
'name' => 'font_color',
|
||||
'value' => 'ffffff',
|
||||
'class' => 'input');
|
||||
|
||||
$attr_shadow_color = array(
|
||||
'name' => 'shadow_color',
|
||||
'value' => 'ffffff',
|
||||
'class' => 'input');
|
||||
|
||||
$attr_shadow_distance = array(
|
||||
'name' => 'shadow_distance',
|
||||
'value' => '0',
|
||||
'class' => 'input');
|
||||
|
||||
$attr_apply_all = array(
|
||||
'name' => 'apply_all',
|
||||
'value' => '1',
|
||||
'checked' => 'TRUE');
|
||||
|
||||
$attr_submit = array(
|
||||
'name' => 'submit',
|
||||
'value' => 'Submit',
|
||||
'class' => 'submit');
|
||||
?>
|
||||
<div class="back">
|
||||
<a href="<?=site_url($link_back); ?>"><-- Back</a>
|
||||
</div>
|
||||
<div class="action">
|
||||
Menu Image Text Generator
|
||||
</div>
|
||||
<?=form_open($link_form); ?>
|
||||
|
||||
<div class="row_edit">
|
||||
<div class="edit_name">
|
||||
Source File:
|
||||
</div>
|
||||
<div class="edit_input">
|
||||
<?=form_dropdown('file', $optimg, 'menu.png', $attr_drop); ?>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="action">
|
||||
Alignment:
|
||||
</div>
|
||||
|
||||
<div class="row_edit">
|
||||
<div class="edit_name">
|
||||
Padding:
|
||||
</div>
|
||||
<div class="edit_input">
|
||||
<?=form_input($attr_padding); ?>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="row_edit">
|
||||
<div class="edit_name">
|
||||
Vertical Alignment:
|
||||
</div>
|
||||
<div class="edit_input">
|
||||
<?=form_dropdown('v_align', $optvalign, 'middle', $attr_drop); ?>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="row_edit">
|
||||
<div class="edit_name">
|
||||
Horizontal Alignment:
|
||||
</div>
|
||||
<div class="edit_input">
|
||||
<?=form_dropdown('h_align', $opthalign, 'center', $attr_drop); ?>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="row_edit">
|
||||
<div class="edit_name">
|
||||
Horizontal Offset:
|
||||
</div>
|
||||
<div class="edit_input">
|
||||
<?=form_input($attr_h_offset); ?>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="row_edit">
|
||||
<div class="edit_name">
|
||||
Vertical Offset:
|
||||
</div>
|
||||
<div class="edit_input">
|
||||
<?=form_input($attr_v_offset); ?>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="action">
|
||||
Text:
|
||||
</div>
|
||||
|
||||
<div class="row_edit">
|
||||
<div class="edit_name">
|
||||
Text:
|
||||
</div>
|
||||
<div class="edit_input">
|
||||
<?=form_input($attr_text); ?>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="row_edit">
|
||||
<div class="edit_name">
|
||||
Font:
|
||||
</div>
|
||||
<div class="edit_input">
|
||||
<?=form_dropdown($name_font, $optfont, FALSE, $attr_font); ?>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="row_edit">
|
||||
<div class="edit_name">
|
||||
Font Size:
|
||||
</div>
|
||||
<div class="edit_input">
|
||||
<?=form_input($attr_font_size); ?>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="row_edit">
|
||||
<div class="edit_name">
|
||||
Font Color:
|
||||
</div>
|
||||
<div class="edit_input">
|
||||
<?=form_input($attr_font_color); ?>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="row_edit">
|
||||
<div class="edit_name">
|
||||
Shadow Color:
|
||||
</div>
|
||||
<div class="edit_input">
|
||||
<?=form_input($attr_shadow_color); ?>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="row_edit">
|
||||
<div class="edit_name">
|
||||
Shadow Distance:
|
||||
</div>
|
||||
<div class="edit_input">
|
||||
<?=form_input($attr_shadow_distance); ?>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="edit_spacer"></div>
|
||||
|
||||
<div class="row_edit">
|
||||
<div class="edit_name">
|
||||
Apply to all menu images? (text field will be ignored)
|
||||
</div>
|
||||
<div class="edit_input">
|
||||
<?=form_checkbox($attr_apply_all); ?>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="row_edit">
|
||||
<div class="edit_name">
|
||||
Menu Group (only when Apply All is set): n
|
||||
</div>
|
||||
<div class="edit_input">
|
||||
<?=form_dropdown('menu_group', $optgroup, 1, $attr_drop); ?>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="edit_submit">
|
||||
<?=form_submit($attr_submit); ?>
|
||||
</div>
|
||||
<?=form_close(); ?>
|
20
Mourne-CI/application/views/admin/image_tool/menu_image_view.php
Executable file
20
Mourne-CI/application/views/admin/image_tool/menu_image_view.php
Executable file
@ -0,0 +1,20 @@
|
||||
<?php
|
||||
$this->load->helper('url');
|
||||
|
||||
$link_back = 'admin/menu_image';
|
||||
?>
|
||||
<div class="back">
|
||||
<a href="<?=site_url($link_back); ?>"><-- Back</a>
|
||||
</div>
|
||||
<div class="action">
|
||||
Images generated:
|
||||
</div>
|
||||
<?php if ($applyall): ?>
|
||||
<?php foreach ($list as $row): ?>
|
||||
<?php $link = 'img/generated/' . $row . '.png'; ?>
|
||||
<img src="<?=base_url($link); ?>">
|
||||
<?php endforeach; ?>
|
||||
<?php else: ?>
|
||||
<?php $link = 'img/generated/' . $text . '.png'; ?>
|
||||
<img src="<?=base_url($link); ?>">
|
||||
<?php endif; ?>
|
360
Mourne-CI/application/views/admin/image_tool/slot_image.php
Executable file
360
Mourne-CI/application/views/admin/image_tool/slot_image.php
Executable file
@ -0,0 +1,360 @@
|
||||
<?php
|
||||
$this->load->helper('form');
|
||||
$this->load->helper('url');
|
||||
|
||||
$link_back = 'admin/admin_panel';
|
||||
$link_form = 'admin/slot_image';
|
||||
|
||||
$attr_drop = 'class="drop"';
|
||||
|
||||
$name_font = 'font';
|
||||
$attr_font = 'class="drop"';
|
||||
|
||||
$opt_wm_type = array(
|
||||
'text' => 'Text',
|
||||
'overlay' => 'Overlay');
|
||||
|
||||
$attr_wm_opacity = array(
|
||||
'name' => 'wm_opacity',
|
||||
'value' => '1',
|
||||
'class' => 'input');
|
||||
|
||||
$attr_wm_x_transp = array(
|
||||
'name' => 'wm_x_transp',
|
||||
'value' => '1',
|
||||
'class' => 'input');
|
||||
|
||||
$attr_wm_y_transp = array(
|
||||
'name' => 'wm_y_transp',
|
||||
'value' => '1',
|
||||
'class' => 'input');
|
||||
|
||||
$attr_padding = array(
|
||||
'name' => 'padding',
|
||||
'value' => '0',
|
||||
'class' => 'input');
|
||||
|
||||
$attr_rank_padding = array(
|
||||
'name' => 'rank_padding',
|
||||
'value' => '0',
|
||||
'class' => 'input');
|
||||
|
||||
$attr_h_offset = array(
|
||||
'name' => 'h_offset',
|
||||
'value' => '-1',
|
||||
'class' => 'input');
|
||||
|
||||
$attr_v_offset = array(
|
||||
'name' => 'v_offset',
|
||||
'value' => '-5',
|
||||
'class' => 'input');
|
||||
|
||||
$attr_rank_h_offset = array(
|
||||
'name' => 'rank_h_offset',
|
||||
'value' => '0',
|
||||
'class' => 'input');
|
||||
|
||||
$attr_rank_v_offset = array(
|
||||
'name' => 'rank_v_offset',
|
||||
'value' => '0',
|
||||
'class' => 'input');
|
||||
|
||||
$attr_text = array(
|
||||
'name' => 'text',
|
||||
'class' => 'input');
|
||||
|
||||
$attr_rank_text = array(
|
||||
'name' => 'rank_text',
|
||||
'class' => 'input');
|
||||
|
||||
$attr_font_size = array(
|
||||
'name' => 'font_size',
|
||||
'value' => '5',
|
||||
'class' => 'input');
|
||||
|
||||
$attr_rank_font_size = array(
|
||||
'name' => 'rank_font_size',
|
||||
'value' => '8',
|
||||
'class' => 'input');
|
||||
|
||||
$attr_font_color = array(
|
||||
'name' => 'font_color',
|
||||
'value' => 'ffffff',
|
||||
'class' => 'input');
|
||||
|
||||
$attr_shadow_color = array(
|
||||
'name' => 'shadow_color',
|
||||
'value' => 'ffffff',
|
||||
'class' => 'input');
|
||||
|
||||
$attr_shadow_distance = array(
|
||||
'name' => 'shadow_distance',
|
||||
'value' => '0',
|
||||
'class' => 'input');
|
||||
|
||||
$attr_apply_all = array(
|
||||
'name' => 'apply_all',
|
||||
'value' => '1',
|
||||
'checked' => 'TRUE');
|
||||
|
||||
$attr_submit = array(
|
||||
'name' => 'submit',
|
||||
'value' => 'Submit',
|
||||
'class' => 'submit');
|
||||
?>
|
||||
<div class="back">
|
||||
<a href="<?=site_url($link_back); ?>"><-- Back</a>
|
||||
</div>
|
||||
<div class="action">
|
||||
Slot Image Text Generator
|
||||
</div>
|
||||
|
||||
<?=form_open($link_form); ?>
|
||||
|
||||
<div class="row_edit">
|
||||
<div class="edit_name">
|
||||
Type:
|
||||
</div>
|
||||
<div class="edit_input">
|
||||
<?=form_dropdown('wm_type', $opt_wm_type, 'text', $attr_drop); ?>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="row_edit">
|
||||
<div class="edit_name">
|
||||
Surce File:
|
||||
</div>
|
||||
<div class="edit_input">
|
||||
<?=form_dropdown('file', $optimg, 'slot.png', $attr_drop); ?>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="action">
|
||||
Alignment:
|
||||
</div>
|
||||
|
||||
<div class="row_edit">
|
||||
<div class="edit_name">
|
||||
Padding:
|
||||
</div>
|
||||
<div class="edit_input">
|
||||
<?=form_input($attr_padding); ?>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="row_edit">
|
||||
<div class="edit_name">
|
||||
Vertical Alignment:
|
||||
</div>
|
||||
<div class="edit_input">
|
||||
<?=form_dropdown('v_align', $optvalign, 'middle', $attr_drop); ?>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="row_edit">
|
||||
<div class="edit_name">
|
||||
Horizontal Alignment:
|
||||
</div>
|
||||
<div class="edit_input">
|
||||
<?=form_dropdown('h_align', $opthalign, 'center', $attr_drop); ?>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="row_edit">
|
||||
<div class="edit_name">
|
||||
Horizontal Offset:
|
||||
</div>
|
||||
<div class="edit_input">
|
||||
<?=form_input($attr_h_offset); ?>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="row_edit">
|
||||
<div class="edit_name">
|
||||
Vertical Offset:
|
||||
</div>
|
||||
<div class="edit_input">
|
||||
<?=form_input($attr_v_offset); ?>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="action">
|
||||
---------------------------------------Text:-------------------------------------
|
||||
</div>
|
||||
|
||||
<div class="row_edit">
|
||||
<div class="edit_name">
|
||||
Text:
|
||||
</div>
|
||||
<div class="edit_input">
|
||||
<?=form_input($attr_text); ?>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="row_edit">
|
||||
<div class="edit_name">
|
||||
Font:
|
||||
</div>
|
||||
<div class="edit_input">
|
||||
<?=form_dropdown($name_font, $optfont, FALSE, $attr_font); ?>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="row_edit">
|
||||
<div class="edit_name">
|
||||
Font Size:
|
||||
</div>
|
||||
<div class="edit_input">
|
||||
<?=form_input($attr_font_size); ?>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="row_edit">
|
||||
<div class="edit_name">
|
||||
Font Color:
|
||||
</div>
|
||||
<div class="edit_input">
|
||||
<?=form_input($attr_font_color); ?>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="row_edit">
|
||||
<div class="edit_name">
|
||||
Shadow Color:
|
||||
</div>
|
||||
<div class="edit_input">
|
||||
<?=form_input($attr_shadow_color); ?>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="row_edit">
|
||||
<div class="edit_name">
|
||||
Shadow Distance:
|
||||
</div>
|
||||
<div class="edit_input">
|
||||
<?=form_input($attr_shadow_distance); ?>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="action">
|
||||
----------------------------------------Rank:------------------------------------
|
||||
</div>
|
||||
|
||||
<div class="row_edit">
|
||||
<div class="edit_name">
|
||||
Rank Text:
|
||||
</div>
|
||||
<div class="edit_input">
|
||||
<?=form_input($attr_rank_text); ?>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="row_edit">
|
||||
<div class="edit_name">
|
||||
Rank Font Size:
|
||||
</div>
|
||||
<div class="edit_input">
|
||||
<?=form_input($attr_rank_font_size); ?>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="row_edit">
|
||||
<div class="edit_name">
|
||||
Vertical Alignment:
|
||||
</div>
|
||||
<div class="edit_input">
|
||||
<?=form_dropdown('rank_v_align', $optvalign, 'bottom', $attr_drop); ?>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="row_edit">
|
||||
<div class="edit_name">
|
||||
Horizontal Alignment:
|
||||
</div>
|
||||
<div class="edit_input">
|
||||
<?=form_dropdown('rank_h_align', $opthalign, 'left', $attr_drop); ?>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="row_edit">
|
||||
<div class="edit_name">
|
||||
Horizontal Offset:
|
||||
</div>
|
||||
<div class="edit_input">
|
||||
<?=form_input($attr_rank_h_offset); ?>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="row_edit">
|
||||
<div class="edit_name">
|
||||
Vertical Offset:
|
||||
</div>
|
||||
<div class="edit_input">
|
||||
<?=form_input($attr_rank_v_offset); ?>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="row_edit">
|
||||
<div class="edit_name">
|
||||
Padding:
|
||||
</div>
|
||||
<div class="edit_input">
|
||||
<?=form_input($attr_rank_padding); ?>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="action">
|
||||
---------------------------------------Image:------------------------------------
|
||||
</div>
|
||||
|
||||
<div class="row_edit">
|
||||
<div class="edit_name">
|
||||
Overlay Image:
|
||||
</div>
|
||||
<div class="edit_input">
|
||||
<?=form_dropdown('wm_overlay_path', $optoverlay, 'overlay.png', $attr_drop); ?>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="row_edit">
|
||||
<div class="edit_name">
|
||||
Opacity:
|
||||
</div>
|
||||
<div class="edit_input">
|
||||
<?=form_input($attr_wm_opacity); ?>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="edit_spacer"></div>
|
||||
|
||||
<div class="row_edit">
|
||||
<div class="edit_name">
|
||||
X Transp:
|
||||
</div>
|
||||
<div class="edit_input">
|
||||
<?=form_input($attr_wm_x_transp); ?>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="row_edit">
|
||||
<div class="edit_name">
|
||||
Y Transp:
|
||||
</div>
|
||||
<div class="edit_input">
|
||||
<?=form_input($attr_wm_y_transp); ?>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="row_edit_textbox">
|
||||
<div class="edit_name">
|
||||
(If your watermark image is a PNG or GIF image, you may specify a color on the image to be "transparent".
|
||||
This setting (along with the next) will allow you to specify that color. This works by specifying the
|
||||
"X" and "Y" coordinate pixel (measured from the upper left) within the image that corresponds to a pixel
|
||||
representative of the color you want to be transparent.)
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="edit_submit">
|
||||
<?=form_submit($attr_submit); ?>
|
||||
</div>
|
||||
<?=form_close(); ?>
|
14
Mourne-CI/application/views/admin/image_tool/slot_image_view.php
Executable file
14
Mourne-CI/application/views/admin/image_tool/slot_image_view.php
Executable file
@ -0,0 +1,14 @@
|
||||
<?php
|
||||
$this->load->helper('url');
|
||||
|
||||
$link_back = 'admin/slot_image';
|
||||
|
||||
$link = 'img/generated/gen.png';
|
||||
?>
|
||||
<div class="back">
|
||||
<a href="<?=site_url($link_back); ?>"><-- Back</a>
|
||||
</div>
|
||||
<div class="action">
|
||||
Image generated:
|
||||
</div>
|
||||
<img src="<?=base_url($link); ?>">
|
1006
Mourne-CI/application/views/admin/item_tool/item.php
Executable file
1006
Mourne-CI/application/views/admin/item_tool/item.php
Executable file
File diff suppressed because it is too large
Load Diff
45
Mourne-CI/application/views/admin/item_tool/list.php
Executable file
45
Mourne-CI/application/views/admin/item_tool/list.php
Executable file
@ -0,0 +1,45 @@
|
||||
<?php
|
||||
$this->load->helper('url');
|
||||
|
||||
$link_edit = 'admin/items/';
|
||||
$link_new = 'admin/items';
|
||||
|
||||
$link_back = 'admin/admin_panel';
|
||||
?>
|
||||
<div class="back">
|
||||
<a href="<?=site_url($link_back); ?>"><--- Back</a>
|
||||
</div>
|
||||
<div class="top_menu">
|
||||
<a href="<?=site_url($link_new); ?>">Create New</a>
|
||||
</div>
|
||||
<div class="list_container">
|
||||
<?php if ($items): ?>
|
||||
<?php $i = 1; ?>
|
||||
<?php foreach ($items as $row): ?>
|
||||
<?php $link = $link_edit . $row['id']; ?>
|
||||
<?php if (!($i % 2)): ?>
|
||||
<div class="row">
|
||||
<?php else: ?>
|
||||
<div class="row second">
|
||||
<?php endif; ?>
|
||||
<div class="attr_box">
|
||||
[<?=$row['id']; ?>]
|
||||
</div>
|
||||
<div class="attr_box">
|
||||
[ilvl: <?=$row['itemlevel']; ?>]
|
||||
</div>
|
||||
<div class="attr_box">
|
||||
[quality: <?=$row['quality']; ?>]
|
||||
</div>
|
||||
<div class="attr_box">
|
||||
<?=$row['name']; ?>
|
||||
</div>
|
||||
<div class="actionbox">
|
||||
<a href="<?=site_url($link); ?>">Edit</a>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
<?php $i++; ?>
|
||||
<?php endforeach; ?>
|
||||
<?php endif; ?>
|
||||
</div>
|
41
Mourne-CI/application/views/admin/map_tool/list.php
Executable file
41
Mourne-CI/application/views/admin/map_tool/list.php
Executable file
@ -0,0 +1,41 @@
|
||||
<?php
|
||||
$this->load->helper('url');
|
||||
$this->load->helper('form');
|
||||
|
||||
$link_generate = 'admin/map_generator';
|
||||
$link_form = 'admin/map_tool';
|
||||
|
||||
$link_back = 'admin/admin_panel';
|
||||
|
||||
$attr_apply = array(
|
||||
'name' => 'submit',
|
||||
'value' => 'Apply!',
|
||||
'class' => 'submit');
|
||||
?>
|
||||
<div class="back">
|
||||
<a href="<?=site_url($link_back); ?>"><--- Back</a>
|
||||
</div>
|
||||
<div class="top_menu">
|
||||
<a href="<?=site_url($link_generate); ?>">Generate New</a>
|
||||
</div>
|
||||
<div class="list_container">
|
||||
<?php if ($files): ?>
|
||||
<?php $i = 1; ?>
|
||||
<?php foreach ($files as $row): ?>
|
||||
<?php if (!($i % 2)): ?>
|
||||
<div class="row">
|
||||
<?php else: ?>
|
||||
<div class="row second">
|
||||
<?php endif; ?>
|
||||
<div class="name">
|
||||
<?=$row; ?>
|
||||
</div>
|
||||
<div class="actionbox">
|
||||
Apply will not wrok from here.
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<?php $i++; ?>
|
||||
<?php endforeach; ?>
|
||||
<?php endif; ?>
|
||||
</div>
|
144
Mourne-CI/application/views/admin/panel.php
Executable file
144
Mourne-CI/application/views/admin/panel.php
Executable file
@ -0,0 +1,144 @@
|
||||
<?php
|
||||
$this->load->helper('url');
|
||||
|
||||
$link_building_tool = 'admin/building_tool';
|
||||
$link_unit_tool = 'admin/unit_tool';
|
||||
$link_assignment_tool = 'admin/assignment_tool';
|
||||
$link_spell_tool = 'admin/spell_tool';
|
||||
$link_weather_tool = 'admin/weather_tool';
|
||||
$link_technology_tool = 'admin/technology_tool';
|
||||
$link_tech_group_tool = 'admin/technology_group_tool';
|
||||
$link_tech_requirements_tool = 'admin/technology_requirements_tool';
|
||||
$link_ai_unit_tool = 'admin/ai_unit_tool';
|
||||
$link_ai_settings_tool = 'admin/ai_settings_tool';
|
||||
$link_hero_template_tool = 'admin/hero_template_tool';
|
||||
$link_hero_inventory_template_tool = 'admin/hero_inventory_template_tool';
|
||||
$link_item_tool = 'admin/item_tool';
|
||||
$link_map_tool = 'admin/map_tool';
|
||||
$link_menu_image = 'admin/menu_image';
|
||||
$link_slot_image = 'admin/slot_image';
|
||||
$link_sql_tool = 'admin/sql_tool';
|
||||
?>
|
||||
<div class="action">
|
||||
Admin Panel
|
||||
</div>
|
||||
|
||||
<div class="edit_spacer"></div>
|
||||
|
||||
<div class="row_edit second text_center">
|
||||
<a href="<?=site_url($link_building_tool); ?>">Building Tool</a>
|
||||
</div>
|
||||
|
||||
<div class="row_edit second text_center">
|
||||
<a href="<?=site_url($link_unit_tool); ?>">Unit Tool</a>
|
||||
</div>
|
||||
|
||||
<div class="row_edit second text_center">
|
||||
<a href="<?=site_url($link_assignment_tool); ?>">Assignment Tool</a>
|
||||
</div>
|
||||
|
||||
<div class="row_edit second text_center">
|
||||
<a href="<?=site_url($link_spell_tool); ?>">Spell Tool</a>
|
||||
</div>
|
||||
|
||||
<div class="row_edit second text_center">
|
||||
<a href="<?=site_url($link_weather_tool); ?>">Weather Tool</a>
|
||||
</div>
|
||||
|
||||
<div class="edit_spacer"></div>
|
||||
|
||||
<div class="action">
|
||||
Technology tools
|
||||
</div>
|
||||
|
||||
<div class="edit_spacer"></div>
|
||||
|
||||
<div class="row_edit second text_center">
|
||||
<a href="<?=site_url($link_technology_tool); ?>">Technologies</a>
|
||||
</div>
|
||||
|
||||
<div class="row_edit second text_center">
|
||||
<a href="<?=site_url($link_tech_group_tool); ?>">Technology Groups</a>
|
||||
</div>
|
||||
|
||||
<div class="row_edit second text_center">
|
||||
<a href="<?=site_url($link_tech_requirements_tool); ?>">Technology Requirements</a>
|
||||
</div>
|
||||
|
||||
<div class="edit_spacer"></div>
|
||||
|
||||
<div class="action">
|
||||
Hero Tools
|
||||
</div>
|
||||
|
||||
<div class="edit_spacer"></div>
|
||||
|
||||
<div class="row_edit second text_center">
|
||||
<a href="<?=site_url($link_hero_template_tool); ?>">Hero Template Tool</a>
|
||||
</div>
|
||||
|
||||
<div class="row_edit second text_center">
|
||||
<a href="<?=site_url($link_hero_inventory_template_tool); ?>">Hero Inventory Template Tool</a>
|
||||
</div>
|
||||
|
||||
<div class="row_edit second text_center">
|
||||
<a href="<?=site_url($link_item_tool); ?>">Item Tool</a>
|
||||
</div>
|
||||
|
||||
<div class="edit_spacer"></div>
|
||||
|
||||
<div class="action">
|
||||
AI Tools
|
||||
</div>
|
||||
|
||||
<div class="edit_spacer"></div>
|
||||
|
||||
<div class="row_edit second text_center">
|
||||
<a href="<?=site_url($link_ai_unit_tool); ?>">AI Unit Tool</a>
|
||||
</div>
|
||||
|
||||
<div class="row_edit second text_center">
|
||||
<a href="<?=site_url($link_ai_settings_tool); ?>">AI Settings Tool</a>
|
||||
</div>
|
||||
|
||||
<div class="edit_spacer"></div>
|
||||
|
||||
<div class="action">
|
||||
Map Tools
|
||||
</div>
|
||||
|
||||
<div class="edit_spacer"></div>
|
||||
|
||||
<div class="row_edit second text_center">
|
||||
<a href="<?=site_url($link_map_tool); ?>">Map Tool</a>
|
||||
</div>
|
||||
|
||||
<div class="edit_spacer"></div>
|
||||
|
||||
<div class="action">
|
||||
Image Tool
|
||||
</div>
|
||||
|
||||
<div class="edit_spacer"></div>
|
||||
|
||||
<div class="row_edit second text_center">
|
||||
<a href="<?=site_url($link_menu_image); ?>">Menu Image</a>
|
||||
</div>
|
||||
|
||||
<div class="row_edit second text_center">
|
||||
<a href="<?=site_url($link_slot_image); ?>">Slot Image</a>
|
||||
</div>
|
||||
|
||||
<div class="edit_spacer"></div>
|
||||
|
||||
<div class="action">
|
||||
SQL Tool
|
||||
</div>
|
||||
|
||||
<div class="edit_spacer"></div>
|
||||
|
||||
<div class="row_edit second text_center">
|
||||
<a href="<?=site_url($link_sql_tool); ?>">SQL Tool</a>
|
||||
</div>
|
||||
|
||||
<div class="edit_spacer"></div>
|
43
Mourne-CI/application/views/admin/spell_tool/list.php
Executable file
43
Mourne-CI/application/views/admin/spell_tool/list.php
Executable file
@ -0,0 +1,43 @@
|
||||
<?php
|
||||
$this->load->helper('url');
|
||||
|
||||
$link_edit = 'admin/spell/';
|
||||
$link_new = 'admin/spell';
|
||||
|
||||
$link_back = 'admin/admin_panel';
|
||||
?>
|
||||
<div class="back">
|
||||
<a href="<?=site_url($link_back); ?>"><--- Back</a>
|
||||
</div>
|
||||
<div class="top_menu">
|
||||
<a href="<?=site_url($link_new); ?>">Create New</a>
|
||||
</div>
|
||||
<div class="list_container">
|
||||
<?php $i = 1; ?>
|
||||
<?php foreach ($spells as $row): ?>
|
||||
<?php $link = $link_edit . $row['id']; ?>
|
||||
<?php if (!($i % 2)): ?>
|
||||
<div class="row">
|
||||
<?php else: ?>
|
||||
<div class="row second">
|
||||
<?php endif; ?>
|
||||
<div class="attr_box">
|
||||
[<?=$row['id']; ?>]
|
||||
</div>
|
||||
<div class="attr_box">
|
||||
[Eff: <?=$row['effect']; ?>]
|
||||
</div>
|
||||
<div class="attr_box">
|
||||
[D: <?=$row['duration']; ?>]
|
||||
</div>
|
||||
<div class="name">
|
||||
<?=$row['description_admin']; ?>
|
||||
</div>
|
||||
<div class="actionbox">
|
||||
<a href="<?=site_url($link); ?>">Edit</a>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
<?php $i++; ?>
|
||||
<?php endforeach; ?>
|
||||
</div>
|
454
Mourne-CI/application/views/admin/spell_tool/spell.php
Executable file
454
Mourne-CI/application/views/admin/spell_tool/spell.php
Executable file
@ -0,0 +1,454 @@
|
||||
<?php
|
||||
$this->load->helper('url');
|
||||
$this->load->helper('form');
|
||||
|
||||
$link_back = 'admin/spell_tool';
|
||||
|
||||
$name_effect = 'effect';
|
||||
$attr_effect = 'class="drop"';
|
||||
|
||||
$attr_drop = 'class="drop"';
|
||||
|
||||
$attr_duration = array(
|
||||
'name' => 'duration',
|
||||
'class' => 'input');
|
||||
|
||||
$attr_cooldown = array(
|
||||
'name' => 'cooldown',
|
||||
'class' => 'input');
|
||||
|
||||
$attr_description = array(
|
||||
'name' => 'description',
|
||||
'rows' => '5',
|
||||
'cols' => '50',
|
||||
'class' => 'textarea');
|
||||
|
||||
$attr_description_admin = array(
|
||||
'name' => 'description_admin',
|
||||
'rows' => '5',
|
||||
'cols' => '50',
|
||||
'class' => 'textarea');
|
||||
|
||||
$attr_cost_food = array(
|
||||
'name' => 'cost_food',
|
||||
'class' => 'input');
|
||||
|
||||
$attr_cost_wood = array(
|
||||
'name' => 'cost_wood',
|
||||
'class' => 'input');
|
||||
|
||||
$attr_cost_stone = array(
|
||||
'name' => 'cost_stone',
|
||||
'class' => 'input');
|
||||
|
||||
$attr_cost_iron = array(
|
||||
'name' => 'cost_iron',
|
||||
'class' => 'input');
|
||||
|
||||
$attr_cost_mana = array(
|
||||
'name' => 'cost_mana',
|
||||
'class' => 'input');
|
||||
|
||||
$attr_mod_max_food = array(
|
||||
'name' => 'mod_max_food',
|
||||
'class' => 'input');
|
||||
|
||||
$attr_mod_max_wood = array(
|
||||
'name' => 'mod_max_wood',
|
||||
'class' => 'input');
|
||||
|
||||
$attr_mod_max_stone = array(
|
||||
'name' => 'mod_max_stone',
|
||||
'class' => 'input');
|
||||
|
||||
$attr_mod_max_iron = array(
|
||||
'name' => 'mod_max_iron',
|
||||
'class' => 'input');
|
||||
|
||||
$attr_mod_max_mana = array(
|
||||
'name' => 'mod_max_mana',
|
||||
'class' => 'input');
|
||||
|
||||
|
||||
$attr_mod_rate_food = array(
|
||||
'name' => 'mod_rate_food',
|
||||
'class' => 'input');
|
||||
|
||||
$attr_mod_rate_wood = array(
|
||||
'name' => 'mod_rate_wood',
|
||||
'class' => 'input');
|
||||
|
||||
$attr_mod_rate_stone = array(
|
||||
'name' => 'mod_rate_stone',
|
||||
'class' => 'input');
|
||||
|
||||
$attr_mod_rate_iron = array(
|
||||
'name' => 'mod_rate_iron',
|
||||
'class' => 'input');
|
||||
|
||||
$attr_mod_rate_mana = array(
|
||||
'name' => 'mod_rate_mana',
|
||||
'class' => 'input');
|
||||
|
||||
|
||||
$attr_mod_percent_food = array(
|
||||
'name' => 'mod_percent_food',
|
||||
'class' => 'input');
|
||||
|
||||
$attr_mod_percent_wood = array(
|
||||
'name' => 'mod_percent_wood',
|
||||
'class' => 'input');
|
||||
|
||||
$attr_mod_percent_stone = array(
|
||||
'name' => 'mod_percent_stone',
|
||||
'class' => 'input');
|
||||
|
||||
$attr_mod_percent_iron = array(
|
||||
'name' => 'mod_percent_iron',
|
||||
'class' => 'input');
|
||||
|
||||
$attr_mod_percent_mana = array(
|
||||
'name' => 'mod_percent_mana',
|
||||
'class' => 'input');
|
||||
|
||||
$attr_submit = array(
|
||||
'name' => 'submit',
|
||||
'value' => 'Submit',
|
||||
'class' => 'submit');
|
||||
|
||||
if ($new)
|
||||
{
|
||||
//set every value with set_value()
|
||||
$link_form = 'admin/spell';
|
||||
|
||||
//spell effect goes from controller
|
||||
$attr_duration['value'] = set_value('duration');
|
||||
$attr_cooldown['value'] = set_value('cooldown');
|
||||
$attr_description['value'] = set_value('description');
|
||||
$attr_description_admin['value'] = set_value('description_admin');
|
||||
|
||||
$attr_cost_food['value'] = set_value('cost_food');
|
||||
$attr_cost_wood['value'] = set_value('cost_wood');
|
||||
$attr_cost_stone['value'] = set_value('cost_stone');
|
||||
$attr_cost_iron['value'] = set_value('cost_iron');
|
||||
$attr_cost_mana['value'] = set_value('cost_mana');
|
||||
|
||||
$attr_mod_max_food['value'] = set_value('mod_max_food');
|
||||
$attr_mod_max_wood['value'] = set_value('mod_max_wood');
|
||||
$attr_mod_max_stone['value'] = set_value('mod_max_stone');
|
||||
$attr_mod_max_iron['value'] = set_value('mod_max_iron');
|
||||
$attr_mod_max_mana['value'] = set_value('mod_max_mana');
|
||||
|
||||
$attr_mod_rate_food['value'] = set_value('mod_rate_food');
|
||||
$attr_mod_rate_wood['value'] = set_value('mod_rate_wood');
|
||||
$attr_mod_rate_stone['value'] = set_value('mod_rate_stone');
|
||||
$attr_mod_rate_iron['value'] = set_value('mod_rate_iron');
|
||||
$attr_mod_rate_mana['value'] = set_value('mod_rate_mana');
|
||||
|
||||
$attr_mod_percent_food['value'] = set_value('mod_percent_food');
|
||||
$attr_mod_percent_wood['value'] = set_value('mod_percent_wood');
|
||||
$attr_mod_percent_stone['value'] = set_value('mod_percent_stone');
|
||||
$attr_mod_percent_iron['value'] = set_value('mod_percent_iron');
|
||||
$attr_mod_percent_mana['value'] = set_value('mod_percent_mana');
|
||||
}
|
||||
else
|
||||
{
|
||||
//set every value from data sent
|
||||
$link_form = 'admin/spell/' . $spell['id'];
|
||||
|
||||
$seff = $spell['effect'];
|
||||
|
||||
$attr_duration['value'] = $spell['duration'];
|
||||
$attr_cooldown['value'] = $spell['cooldown'];
|
||||
$attr_description['value'] = $spell['description'];
|
||||
$attr_description_admin['value'] = $spell['description_admin'];
|
||||
|
||||
$sweather = $spell['weather_change_to'];
|
||||
|
||||
$attr_cost_food['value'] = $spell['cost_food'];
|
||||
$attr_cost_wood['value'] = $spell['cost_wood'];
|
||||
$attr_cost_stone['value'] = $spell['cost_stone'];
|
||||
$attr_cost_iron['value'] = $spell['cost_iron'];
|
||||
$attr_cost_mana['value'] = $spell['cost_mana'];
|
||||
|
||||
$attr_mod_max_food['value'] = $spell['mod_max_food'];
|
||||
$attr_mod_max_wood['value'] = $spell['mod_max_wood'];
|
||||
$attr_mod_max_stone['value'] = $spell['mod_max_stone'];
|
||||
$attr_mod_max_iron['value'] = $spell['mod_max_iron'];
|
||||
$attr_mod_max_mana['value'] = $spell['mod_max_mana'];
|
||||
|
||||
$attr_mod_rate_food['value'] = $spell['mod_rate_food'];
|
||||
$attr_mod_rate_wood['value'] = $spell['mod_rate_wood'];
|
||||
$attr_mod_rate_stone['value'] = $spell['mod_rate_stone'];
|
||||
$attr_mod_rate_iron['value'] = $spell['mod_rate_iron'];
|
||||
$attr_mod_rate_mana['value'] = $spell['mod_rate_mana'];
|
||||
|
||||
$attr_mod_percent_food['value'] = $spell['mod_percent_food'];
|
||||
$attr_mod_percent_wood['value'] = $spell['mod_percent_wood'];
|
||||
$attr_mod_percent_stone['value'] = $spell['mod_percent_stone'];
|
||||
$attr_mod_percent_iron['value'] = $spell['mod_percent_iron'];
|
||||
$attr_mod_percent_mana['value'] = $spell['mod_percent_mana'];
|
||||
}
|
||||
?>
|
||||
<div class="back">
|
||||
<a href="<?=site_url($link_back); ?>"><-- Back</a>
|
||||
</div>
|
||||
<div class="action">
|
||||
<?php if ($new): ?>
|
||||
Creating!
|
||||
<?php else: ?>
|
||||
Editing!
|
||||
<?php endif; ?>
|
||||
</div>
|
||||
<?=validation_errors(); ?>
|
||||
<?=form_open($link_form); ?>
|
||||
|
||||
<div class="row_edit">
|
||||
<div class="edit_name">
|
||||
Effect:
|
||||
</div>
|
||||
<div class="edit_input">
|
||||
<?=form_dropdown($name_effect, $opteff, $seff, $attr_effect); ?>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="row_edit">
|
||||
<div class="edit_name">
|
||||
Duration:
|
||||
</div>
|
||||
<div class="edit_input">
|
||||
<?=form_input($attr_duration); ?>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="row_edit">
|
||||
<div class="edit_name">
|
||||
Cooldown:
|
||||
</div>
|
||||
<div class="edit_input">
|
||||
<?=form_input($attr_cooldown); ?>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="edit_spacer"></div>
|
||||
|
||||
<div class="row_edit_textbox">
|
||||
<div class="edit_name">
|
||||
Description:
|
||||
</div>
|
||||
<div class="edit_input">
|
||||
<?=form_textarea($attr_description); ?>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="row_edit_textbox">
|
||||
<div class="edit_name">
|
||||
Admin Description:
|
||||
</div>
|
||||
<div class="edit_input">
|
||||
<?=form_textarea($attr_description_admin); ?>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="row_edit">
|
||||
<div class="edit_name">
|
||||
Change Weather To:
|
||||
</div>
|
||||
<div class="edit_input">
|
||||
<?=form_dropdown('weather_change_to', $optweather, $sweather, $attr_drop); ?>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="edit_spacer"></div>
|
||||
|
||||
<div class="row_edit">
|
||||
<div class="edit_name">
|
||||
Cost Food:
|
||||
</div>
|
||||
<div class="edit_input">
|
||||
<?=form_input($attr_cost_food); ?>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="row_edit">
|
||||
<div class="edit_name">
|
||||
Cost wood:
|
||||
</div>
|
||||
<div class="edit_input">
|
||||
<?=form_input($attr_cost_wood); ?>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="row_edit">
|
||||
<div class="edit_name">
|
||||
Cost Stone:
|
||||
</div>
|
||||
<div class="edit_input">
|
||||
<?=form_input($attr_cost_stone); ?>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="row_edit">
|
||||
<div class="edit_name">
|
||||
Cost Iron:
|
||||
</div>
|
||||
<div class="edit_input">
|
||||
<?=form_input($attr_cost_iron); ?>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="row_edit">
|
||||
<div class="edit_name">
|
||||
Cost Mana:
|
||||
</div>
|
||||
<div class="edit_input">
|
||||
<?=form_input($attr_cost_mana); ?>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="edit_spacer"></div>
|
||||
|
||||
<div class="row_edit">
|
||||
<div class="edit_name">
|
||||
Mod Max Food:
|
||||
</div>
|
||||
<div class="edit_input">
|
||||
<?=form_input($attr_mod_max_food); ?>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="row_edit">
|
||||
<div class="edit_name">
|
||||
Mod Max Wood:
|
||||
</div>
|
||||
<div class="edit_input">
|
||||
<?=form_input($attr_mod_max_wood); ?>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="row_edit">
|
||||
<div class="edit_name">
|
||||
Mod Max Stone:
|
||||
</div>
|
||||
<div class="edit_input">
|
||||
<?=form_input($attr_mod_max_stone); ?>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="row_edit">
|
||||
<div class="edit_name">
|
||||
Mod Max Iron:
|
||||
</div>
|
||||
<div class="edit_input">
|
||||
<?=form_input($attr_mod_max_iron); ?>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="row_edit">
|
||||
<div class="edit_name">
|
||||
Mod Max Mana:
|
||||
</div>
|
||||
<div class="edit_input">
|
||||
<?=form_input($attr_mod_max_mana); ?>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="edit_spacer"></div>
|
||||
|
||||
<div class="row_edit">
|
||||
<div class="edit_name">
|
||||
Mod Rate Food:
|
||||
</div>
|
||||
<div class="edit_input">
|
||||
<?=form_input($attr_mod_rate_food); ?>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="row_edit">
|
||||
<div class="edit_name">
|
||||
Mod Rate Wood:
|
||||
</div>
|
||||
<div class="edit_input">
|
||||
<?=form_input($attr_mod_rate_wood); ?>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="row_edit">
|
||||
<div class="edit_name">
|
||||
Mod Rate Stone:
|
||||
</div>
|
||||
<div class="edit_input">
|
||||
<?=form_input($attr_mod_rate_stone); ?>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="row_edit">
|
||||
<div class="edit_name">
|
||||
Mod Rate Iron:
|
||||
</div>
|
||||
<div class="edit_input">
|
||||
<?=form_input($attr_mod_rate_iron); ?>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="row_edit">
|
||||
<div class="edit_name">
|
||||
Mod Rate Mana:
|
||||
</div>
|
||||
<div class="edit_input">
|
||||
<?=form_input($attr_mod_rate_mana); ?>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="edit_spacer"></div>
|
||||
|
||||
<div class="row_edit">
|
||||
<div class="edit_name">
|
||||
Mod Percent Food:
|
||||
</div>
|
||||
<div class="edit_input">
|
||||
<?=form_input($attr_mod_percent_food); ?>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="row_edit">
|
||||
<div class="edit_name">
|
||||
Mod Percent Wood:
|
||||
</div>
|
||||
<div class="edit_input">
|
||||
<?=form_input($attr_mod_percent_wood); ?>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="row_edit">
|
||||
<div class="edit_name">
|
||||
Mod Percent Stone:
|
||||
</div>
|
||||
<div class="edit_input">
|
||||
<?=form_input($attr_mod_percent_stone); ?>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="row_edit">
|
||||
<div class="edit_name">
|
||||
Mod Percent Iron:
|
||||
</div>
|
||||
<div class="edit_input">
|
||||
<?=form_input($attr_mod_percent_iron); ?>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="row_edit">
|
||||
<div class="edit_name">
|
||||
Mod Percent Mana:
|
||||
</div>
|
||||
<div class="edit_input">
|
||||
<?=form_input($attr_mod_percent_mana); ?>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
<div class="edit_submit">
|
||||
<?=form_submit($attr_submit); ?>
|
||||
</div>
|
||||
<?=form_close(); ?>
|
40
Mourne-CI/application/views/admin/sql_tool/list.php
Executable file
40
Mourne-CI/application/views/admin/sql_tool/list.php
Executable file
@ -0,0 +1,40 @@
|
||||
<?php
|
||||
$this->load->helper('url');
|
||||
|
||||
$link_new = 'admin/sql_new';
|
||||
$link_apply_all = 'admin/sql_apply_all';
|
||||
|
||||
$link_back = 'admin/admin_panel';
|
||||
?>
|
||||
<div class="back">
|
||||
<a href="<?=site_url($link_back); ?>"><--- Back</a>
|
||||
</div>
|
||||
<div class="top_menu">
|
||||
<a href="<?=site_url($link_new); ?>">New SQL</a>
|
||||
<a href="<?=site_url($link_apply_all); ?>">Apply all SQL</a>
|
||||
</div>
|
||||
<div class="list_container">
|
||||
|
||||
<?php if ($list): ?>
|
||||
<div class="top_menu">
|
||||
Appliable sqls:
|
||||
</div>
|
||||
<?php $i = 1; ?>
|
||||
<?php foreach($list as $row): ?>
|
||||
<?php if (!($i % 2)): ?>
|
||||
<div class="row">
|
||||
<?php else: ?>
|
||||
<div class="row second">
|
||||
<?php endif; ?>
|
||||
<div class="name">
|
||||
<?=$row; ?>
|
||||
</div>
|
||||
</div>
|
||||
<?php $i++; ?>
|
||||
<?php endforeach; ?>
|
||||
<?php else: ?>
|
||||
<div class="top_menu">
|
||||
Nothing to apply.
|
||||
</div>
|
||||
<?php endif; ?>
|
||||
</div>
|
35
Mourne-CI/application/views/admin/sql_tool/new.php
Executable file
35
Mourne-CI/application/views/admin/sql_tool/new.php
Executable file
@ -0,0 +1,35 @@
|
||||
<?php
|
||||
$this->load->helper('url');
|
||||
$this->load->helper('form');
|
||||
|
||||
$link_back = 'admin/sql_tool';
|
||||
|
||||
$link_form = 'admin/sql_new';
|
||||
|
||||
$attr_textarea = array(
|
||||
'name' => 'sql',
|
||||
'rows' => '15',
|
||||
'cols' => '100',
|
||||
'class' => 'textarea');
|
||||
|
||||
$attr_submit = array(
|
||||
'name' => 'submit',
|
||||
'value' => 'Submit',
|
||||
'class' => 'submit');
|
||||
|
||||
?>
|
||||
<div class="back">
|
||||
<a href="<?=site_url($link_back); ?>"><-- Back</a>
|
||||
</div>
|
||||
<div class="action">
|
||||
New SQL!
|
||||
</div>
|
||||
|
||||
<?=form_open($link_form); ?>
|
||||
<div class="sql_textbox">
|
||||
<?=form_textarea($attr_textarea); ?>
|
||||
</div>
|
||||
<div class="edit_submit">
|
||||
<?=form_submit($attr_submit); ?>
|
||||
</div>
|
||||
<?=form_close(); ?>
|
40
Mourne-CI/application/views/admin/technology_group_tool/list.php
Executable file
40
Mourne-CI/application/views/admin/technology_group_tool/list.php
Executable file
@ -0,0 +1,40 @@
|
||||
<?php
|
||||
$this->load->helper('url');
|
||||
|
||||
$link_edit = 'admin/technology_group/';
|
||||
|
||||
$link_edit_desc = 'admin/technology_group_desc/';
|
||||
$link_new_desc = 'admin/technology_group_desc';
|
||||
|
||||
$link_back = 'admin/admin_panel';
|
||||
?>
|
||||
<div class="back">
|
||||
<a href="<?=site_url($link_back); ?>"><--- Back</a>
|
||||
</div>
|
||||
<div class="top_menu">
|
||||
<a href="<?=site_url($link_new_desc); ?>">Create New</a>
|
||||
</div>
|
||||
<div class="list_container">
|
||||
<?php $i = 1; ?>
|
||||
<?php foreach ($groups as $row): ?>
|
||||
<?php $link = $link_edit . $row['id']; ?>
|
||||
<?php $link_desc = $link_edit_desc . $row['id']; ?>
|
||||
<?php if (!($i % 2)): ?>
|
||||
<div class="row">
|
||||
<?php else: ?>
|
||||
<div class="row second">
|
||||
<?php endif; ?>
|
||||
<div class="attr_box">
|
||||
[<?=$row['id']; ?>]
|
||||
</div>
|
||||
<div class="name">
|
||||
<?=$row['group_name']; ?>
|
||||
</div>
|
||||
<div class="actionbox">
|
||||
<a href="<?=site_url($link_desc); ?>">Edit Description</a>
|
||||
<a href="<?=site_url($link); ?>">Edit</a>
|
||||
</div>
|
||||
</div>
|
||||
<?php $i++; ?>
|
||||
<?php endforeach; ?>
|
||||
</div>
|
56
Mourne-CI/application/views/admin/technology_group_tool/tech_group_desc.php
Executable file
56
Mourne-CI/application/views/admin/technology_group_tool/tech_group_desc.php
Executable file
@ -0,0 +1,56 @@
|
||||
<?php
|
||||
$this->load->helper('url');
|
||||
$this->load->helper('form');
|
||||
|
||||
$link_back = 'admin/technology_group_tool';
|
||||
|
||||
$attr_group_name = array(
|
||||
'name' => 'group_name',
|
||||
'rows' => '5',
|
||||
'cols' => '50',
|
||||
'class' => 'textarea');
|
||||
|
||||
$attr_submit = array(
|
||||
'name' => 'submit',
|
||||
'value' => 'Submit',
|
||||
'class' => 'submit');
|
||||
|
||||
if ($new)
|
||||
{
|
||||
//set every value with set_value()
|
||||
$link_form = 'admin/technology_group_desc';
|
||||
$attr_group_name['value'] = set_value('description');
|
||||
}
|
||||
else
|
||||
{
|
||||
//set every value from data sent
|
||||
$link_form = 'admin/technology_group_desc/' . $group['id'];
|
||||
$attr_group_name['value'] = $group['group_name'];
|
||||
}
|
||||
?>
|
||||
<div class="back">
|
||||
<a href="<?=site_url($link_back); ?>"><-- Back</a>
|
||||
</div>
|
||||
<div class="action">
|
||||
<?php if ($new): ?>
|
||||
Creating!
|
||||
<?php else: ?>
|
||||
Editing!
|
||||
<?php endif; ?>
|
||||
</div>
|
||||
<?=validation_errors(); ?>
|
||||
<?=form_open($link_form); ?>
|
||||
|
||||
<div class="row_edit_textbox">
|
||||
<div class="edit_name">
|
||||
Group Name:
|
||||
</div>
|
||||
<div class="edit_input">
|
||||
<?=form_textarea($attr_group_name); ?>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="edit_submit">
|
||||
<?=form_submit($attr_submit); ?>
|
||||
</div>
|
||||
<?=form_close(); ?>
|
59
Mourne-CI/application/views/admin/technology_group_tool/tech_groups.php
Executable file
59
Mourne-CI/application/views/admin/technology_group_tool/tech_groups.php
Executable file
@ -0,0 +1,59 @@
|
||||
<?php
|
||||
$this->load->helper('url');
|
||||
$this->load->helper('form');
|
||||
|
||||
$link_form = 'admin/technology_group/' . $id;
|
||||
|
||||
$link_back = 'admin/technology_group_tool';
|
||||
|
||||
$name_add_drop = 'add';
|
||||
$attr_add_drop = 'class="drop"';
|
||||
|
||||
$attr_add = array(
|
||||
'name' => 'submit',
|
||||
'value' => 'Add!',
|
||||
'class' => 'submit');
|
||||
|
||||
$attr_delete = array(
|
||||
'name' => 'submit',
|
||||
'value' => 'Delete!',
|
||||
'class' => 'submit');
|
||||
?>
|
||||
<div class="back">
|
||||
<a href="<?=site_url($link_back); ?>"><-- Back</a>
|
||||
</div>
|
||||
<div class="action">
|
||||
Editing!
|
||||
</div>
|
||||
<?=validation_errors(); ?>
|
||||
<?php if ($group): ?>
|
||||
<?php foreach ($group as $row): ?>
|
||||
<?=form_open($link_form); ?>
|
||||
<?=form_hidden('action', 'delete'); ?>
|
||||
<?=form_hidden('id', $row['technologyid']); ?>
|
||||
<div class="row_edit">
|
||||
<div class="edit_name">
|
||||
[<?=$row['technologyid']; ?>] <?=$row['description']; ?>
|
||||
</div>
|
||||
<div class="edit_input">
|
||||
<?=form_submit($attr_delete); ?>
|
||||
</div>
|
||||
</div>
|
||||
<?=form_close(); ?>
|
||||
<?php endforeach; ?>
|
||||
<?php endif; ?>
|
||||
|
||||
<div class="edit_spacer"></div>
|
||||
|
||||
<?=form_open($link_form); ?>
|
||||
<div class="row_edit">
|
||||
<div class="edit_name">
|
||||
Add:
|
||||
</div>
|
||||
<div class="edit_input">
|
||||
<?=form_dropdown($name_add_drop, $opttech, $seltech, $attr_add_drop); ?>
|
||||
<?=form_hidden('action', 'add'); ?>
|
||||
<?=form_submit($attr_add); ?><br />
|
||||
</div>
|
||||
</div>
|
||||
<?=form_close(); ?>
|
@ -0,0 +1,30 @@
|
||||
<?php
|
||||
$this->load->helper('form');
|
||||
$this->load->helper('url');
|
||||
|
||||
$link_back = 'admin/technology_requirements_tool';
|
||||
|
||||
$link_form = 'admin/have_technology_requirement';
|
||||
|
||||
$name_drop = 'technologyid';
|
||||
|
||||
$attr_comment = array(
|
||||
'name' => 'comment',
|
||||
'class' => 'textarea');
|
||||
|
||||
$attr_drop = 'class="drop"';
|
||||
|
||||
$attr_submit = array(
|
||||
'name' => 'submit',
|
||||
'value' => 'Add!',
|
||||
'class' => 'submit');
|
||||
?>
|
||||
Add new!<br />
|
||||
<a href="<?=site_url($link_back); ?>"><-- Back</a><br />
|
||||
<?=form_open($link_form); ?>
|
||||
<?=form_hidden('action', 'new'); ?>
|
||||
Description: <br />
|
||||
<?=form_dropdown($name_drop, $opts, FALSE, $attr_drop); ?><br />
|
||||
<?=form_textarea($attr_comment); ?><br />
|
||||
<?=form_submit($attr_submit); ?><br />
|
||||
<?=form_close(); ?>
|
39
Mourne-CI/application/views/admin/technology_requirements_tool/list.php
Executable file
39
Mourne-CI/application/views/admin/technology_requirements_tool/list.php
Executable file
@ -0,0 +1,39 @@
|
||||
<?php
|
||||
$this->load->helper('url');
|
||||
|
||||
$link_edit = 'admin/technology_requirements/';
|
||||
$link_add_tech = 'admin/have_technology_requirement';
|
||||
$link_remove = 'admin/have_technology_requirement/';
|
||||
|
||||
$link_back = 'admin/admin_panel';
|
||||
?>
|
||||
<div class="back">
|
||||
<a href="<?=site_url($link_back); ?>"><--- Back</a>
|
||||
</div>
|
||||
<div class="top_menu">
|
||||
<a href="<?=site_url($link_add_tech); ?>">Add technology</a>
|
||||
</div>
|
||||
<div class="list_container">
|
||||
<?php $i = 1; ?>
|
||||
<?php foreach ($technologies as $row): ?>
|
||||
<?php $link = $link_edit . $row['id']; ?>
|
||||
<?php $rlink = $link_remove . $row['id']; ?>
|
||||
<?php if (!($i % 2)): ?>
|
||||
<div class="row">
|
||||
<?php else: ?>
|
||||
<div class="row second">
|
||||
<?php endif; ?>
|
||||
<div class="attr_box">
|
||||
[<?=$row['technologyid']; ?>]
|
||||
</div>
|
||||
<div class="name">
|
||||
<?=$row['description']; ?> (<?=$row['comment']; ?>)
|
||||
</div>
|
||||
<div class="actionbox">
|
||||
<a href="<?=site_url($rlink); ?>">Remove from list</a>
|
||||
<a href="<?=site_url($link); ?>">Edit Requirements</a>
|
||||
</div>
|
||||
</div>
|
||||
<?php $i++; ?>
|
||||
<?php endforeach; ?>
|
||||
</div>
|
@ -0,0 +1,30 @@
|
||||
<?php
|
||||
$this->load->helper('form');
|
||||
$this->load->helper('url');
|
||||
|
||||
$link_back = 'admin/technology_requirements_tool';
|
||||
|
||||
$link_form = 'admin/have_technology_requirement';
|
||||
|
||||
$attr_submit = array(
|
||||
'name' => 'submit',
|
||||
'value' => 'Remove!',
|
||||
'class' => 'submit');
|
||||
?>
|
||||
Add new!<br />
|
||||
<a href="<?=site_url($link_back); ?>"><-- Back</a><br />
|
||||
<?=form_open($link_form); ?>
|
||||
<?=form_hidden('action', 'delete'); ?>
|
||||
<?=form_hidden('technologyid', $id); ?>
|
||||
Are you sure you want to remove this from the list?<br />
|
||||
NOTE: This won't remove requirements, only from the tool's list!<br />
|
||||
<br />
|
||||
id: <?=$tech['id']; ?><br />
|
||||
technology id: <?=$tech['technologyid']; ?><br />
|
||||
Technology description: <?=$tech['description']; ?><br />
|
||||
Comment: <?=$tech['comment']; ?><br />
|
||||
<br />
|
||||
<?=form_submit($attr_submit); ?>
|
||||
<a href="<?=site_url($link_back); ?>">Nope!</a>
|
||||
<br />
|
||||
<?=form_close(); ?>
|
63
Mourne-CI/application/views/admin/technology_requirements_tool/tech_req.php
Executable file
63
Mourne-CI/application/views/admin/technology_requirements_tool/tech_req.php
Executable file
@ -0,0 +1,63 @@
|
||||
<?php
|
||||
$this->load->helper('url');
|
||||
$this->load->helper('form');
|
||||
|
||||
$link_form = 'admin/technology_requirements/' . $id;
|
||||
|
||||
$link_back = 'admin/technology_requirements_tool';
|
||||
|
||||
$name_add_drop = 'add';
|
||||
$attr_add_drop = 'class="drop"';
|
||||
|
||||
$attr_add = array(
|
||||
'name' => 'submit',
|
||||
'value' => 'Add!',
|
||||
'class' => 'submit');
|
||||
|
||||
$attr_delete = array(
|
||||
'name' => 'submit',
|
||||
'value' => 'Delete!',
|
||||
'class' => 'submit');
|
||||
?>
|
||||
|
||||
<div class="back">
|
||||
<a href="<?=site_url($link_back); ?>"><-- Back</a>
|
||||
</div>
|
||||
<div class="action">
|
||||
Editing: [<?=$technology['id']; ?>] <?=$technology['description']; ?>
|
||||
</div>
|
||||
<?=validation_errors(); ?>
|
||||
|
||||
<?php if ($required): ?>
|
||||
<?php foreach ($required as $row): ?>
|
||||
<?=form_open($link_form); ?>
|
||||
<?=form_hidden('action', 'delete'); ?>
|
||||
<?=form_hidden('id', $row['id']); ?>
|
||||
<div class="row_edit">
|
||||
<div class="edit_name">
|
||||
[<?=$row['req_tech_id']; ?>] <?=$row['description']; ?>
|
||||
</div>
|
||||
<div class="edit_input">
|
||||
<?=form_submit($attr_delete); ?>
|
||||
</div>
|
||||
</div>
|
||||
<?=form_close(); ?>
|
||||
<?php endforeach; ?>
|
||||
<?php endif; ?>
|
||||
<br />
|
||||
<?=form_open($link_form); ?>
|
||||
|
||||
|
||||
<?=form_hidden('action', 'add'); ?>
|
||||
<?=form_hidden('technologyid', $technology['id']); ?>
|
||||
<div class="row_edit">
|
||||
<div class="edit_name">
|
||||
Add:
|
||||
</div>
|
||||
<div class="edit_input">
|
||||
<?=form_dropdown($name_add_drop, $opttech, $seltech, $attr_add_drop); ?>
|
||||
<?=form_submit($attr_add); ?>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<?=form_close(); ?>
|
35
Mourne-CI/application/views/admin/technology_tool/list.php
Executable file
35
Mourne-CI/application/views/admin/technology_tool/list.php
Executable file
@ -0,0 +1,35 @@
|
||||
<?php
|
||||
$this->load->helper('url');
|
||||
|
||||
$link_edit = 'admin/technology/';
|
||||
$link_new = 'admin/technology';
|
||||
|
||||
$link_back = 'admin/admin_panel';
|
||||
?>
|
||||
<div class="back">
|
||||
<a href="<?=site_url($link_back); ?>"><--- Back</a>
|
||||
</div>
|
||||
<div class="top_menu">
|
||||
<a href="<?=site_url($link_new); ?>">Create New</a>
|
||||
</div>
|
||||
<div class="list_container">
|
||||
<?php $i = 1; ?>
|
||||
<?php foreach ($technologies as $row): ?>
|
||||
<?php $link = $link_edit . $row['id']; ?>
|
||||
<?php if (!($i % 2)): ?>
|
||||
<div class="row">
|
||||
<?php else: ?>
|
||||
<div class="row second">
|
||||
<?php endif; ?>
|
||||
<div class="attr_box">
|
||||
[<?=$row['id']; ?>]
|
||||
</div>
|
||||
<div class="name">
|
||||
<?=$row['description']; ?>
|
||||
</div>
|
||||
<div class="actionbox">
|
||||
<a href="<?=site_url($link); ?>">Edit</a>
|
||||
</div>
|
||||
</div>
|
||||
<?php $i++; ?>
|
||||
<?php endforeach; ?>
|
485
Mourne-CI/application/views/admin/technology_tool/technology.php
Executable file
485
Mourne-CI/application/views/admin/technology_tool/technology.php
Executable file
@ -0,0 +1,485 @@
|
||||
<?php
|
||||
$this->load->helper('url');
|
||||
$this->load->helper('form');
|
||||
|
||||
$link_back = 'admin/technology_tool';
|
||||
|
||||
$attr_description = array(
|
||||
'name' => 'description',
|
||||
'rows' => '5',
|
||||
'cols' => '50',
|
||||
'class' => 'textarea');
|
||||
|
||||
$attr_time = array(
|
||||
'name' => 'time',
|
||||
'class' => 'input');
|
||||
|
||||
$attr_score = array(
|
||||
'name' => 'score',
|
||||
'class' => 'input');
|
||||
|
||||
$opt_flag_ai = array(
|
||||
'0' => 'No',
|
||||
'1' => 'Yes');
|
||||
|
||||
$attr_num_creates = array(
|
||||
'name' => 'num_creates',
|
||||
'class' => 'input');
|
||||
|
||||
$attr_time_to_build = array(
|
||||
'name' => 'time_to_build',
|
||||
'class' => 'input');
|
||||
|
||||
$attr_cost_food = array(
|
||||
'name' => 'cost_food',
|
||||
'class' => 'input');
|
||||
|
||||
$attr_cost_wood = array(
|
||||
'name' => 'cost_wood',
|
||||
'class' => 'input');
|
||||
|
||||
$attr_cost_stone = array(
|
||||
'name' => 'cost_stone',
|
||||
'class' => 'input');
|
||||
|
||||
$attr_cost_iron = array(
|
||||
'name' => 'cost_iron',
|
||||
'class' => 'input');
|
||||
|
||||
$attr_cost_mana = array(
|
||||
'name' => 'cost_mana',
|
||||
'class' => 'input');
|
||||
|
||||
$attr_mod_max_food = array(
|
||||
'name' => 'mod_max_food',
|
||||
'class' => 'input');
|
||||
|
||||
$attr_mod_max_wood = array(
|
||||
'name' => 'mod_max_wood',
|
||||
'class' => 'input');
|
||||
|
||||
$attr_mod_max_stone = array(
|
||||
'name' => 'mod_max_stone',
|
||||
'class' => 'input');
|
||||
|
||||
$attr_mod_max_iron = array(
|
||||
'name' => 'mod_max_iron',
|
||||
'class' => 'input');
|
||||
|
||||
$attr_mod_max_mana = array(
|
||||
'name' => 'mod_max_mana',
|
||||
'class' => 'input');
|
||||
|
||||
|
||||
$attr_mod_rate_food = array(
|
||||
'name' => 'mod_rate_food',
|
||||
'class' => 'input');
|
||||
|
||||
$attr_mod_rate_wood = array(
|
||||
'name' => 'mod_rate_wood',
|
||||
'class' => 'input');
|
||||
|
||||
$attr_mod_rate_stone = array(
|
||||
'name' => 'mod_rate_stone',
|
||||
'class' => 'input');
|
||||
|
||||
$attr_mod_rate_iron = array(
|
||||
'name' => 'mod_rate_iron',
|
||||
'class' => 'input');
|
||||
|
||||
$attr_mod_rate_mana = array(
|
||||
'name' => 'mod_rate_mana',
|
||||
'class' => 'input');
|
||||
|
||||
$attr_mod_percent_food = array(
|
||||
'name' => 'mod_percent_food',
|
||||
'class' => 'input');
|
||||
|
||||
$attr_mod_percent_wood = array(
|
||||
'name' => 'mod_percent_wood',
|
||||
'class' => 'input');
|
||||
|
||||
$attr_mod_percent_stone = array(
|
||||
'name' => 'mod_percent_stone',
|
||||
'class' => 'input');
|
||||
|
||||
$attr_mod_percent_iron = array(
|
||||
'name' => 'mod_percent_iron',
|
||||
'class' => 'input');
|
||||
|
||||
$attr_mod_percent_mana = array(
|
||||
'name' => 'mod_percent_mana',
|
||||
'class' => 'input');
|
||||
|
||||
$name_mod_spell_id = 'mod_spell_id';
|
||||
$attr_mod_spell_id = 'class="drop"';
|
||||
|
||||
$name_mod_create_id = 'mod_create_id';
|
||||
$attr_mod_create_id = 'class="drop"';
|
||||
|
||||
$attr_drop = 'class="drop"';
|
||||
|
||||
$name_is_secondary = 'is_secondary';
|
||||
$attr_is_secondary = 'class="drop"';
|
||||
|
||||
$opt_is_secondary = array(
|
||||
'0' => 'Primary',
|
||||
'1' => 'Secondary');
|
||||
|
||||
$attr_submit = array(
|
||||
'name' => 'submit',
|
||||
'value' => 'Submit',
|
||||
'class' => 'submit');
|
||||
|
||||
if ($new)
|
||||
{
|
||||
//set every value with set_value()
|
||||
$link_form = 'admin/technology';
|
||||
$attr_description['value'] = set_value('description');
|
||||
$attr_time['value'] = set_value('time');
|
||||
|
||||
$attr_score['value'] = set_value('score');
|
||||
|
||||
$attr_cost_food['value'] = set_value('cost_food');
|
||||
$attr_cost_wood['value'] = set_value('cost_wood');
|
||||
$attr_cost_stone['value'] = set_value('cost_stone');
|
||||
$attr_cost_iron['value'] = set_value('cost_iron');
|
||||
$attr_cost_mana['value'] = set_value('cost_mana');
|
||||
|
||||
$attr_mod_max_food['value'] = set_value('mod_max_food');
|
||||
$attr_mod_max_wood['value'] = set_value('mod_max_wood');
|
||||
$attr_mod_max_stone['value'] = set_value('mod_max_stone');
|
||||
$attr_mod_max_iron['value'] = set_value('mod_max_iron');
|
||||
$attr_mod_max_mana['value'] = set_value('mod_max_mana');
|
||||
|
||||
$attr_mod_rate_food['value'] = set_value('mod_rate_food');
|
||||
$attr_mod_rate_wood['value'] = set_value('mod_rate_wood');
|
||||
$attr_mod_rate_stone['value'] = set_value('mod_rate_stone');
|
||||
$attr_mod_rate_iron['value'] = set_value('mod_rate_iron');
|
||||
$attr_mod_rate_mana['value'] = set_value('mod_rate_mana');
|
||||
|
||||
$attr_mod_percent_food['value'] = set_value('mod_percent_food');
|
||||
$attr_mod_percent_wood['value'] = set_value('mod_percent_wood');
|
||||
$attr_mod_percent_stone['value'] = set_value('mod_percent_stone');
|
||||
$attr_mod_percent_iron['value'] = set_value('mod_percent_iron');
|
||||
$attr_mod_percent_mana['value'] = set_value('mod_percent_mana');
|
||||
}
|
||||
else
|
||||
{
|
||||
//set every value from data sent
|
||||
$link_form = 'admin/technology/' . $technology['id'];
|
||||
$attr_description['value'] = $technology['description'];
|
||||
|
||||
$attr_time['value'] = $technology['time'];
|
||||
|
||||
$attr_score['value'] = $technology['score'];
|
||||
|
||||
$attr_cost_food['value'] = $technology['cost_food'];
|
||||
$attr_cost_wood['value'] = $technology['cost_wood'];
|
||||
$attr_cost_stone['value'] = $technology['cost_stone'];
|
||||
$attr_cost_iron['value'] = $technology['cost_iron'];
|
||||
$attr_cost_mana['value'] = $technology['cost_mana'];
|
||||
|
||||
$attr_mod_max_food['value'] = $technology['mod_max_food'];
|
||||
$attr_mod_max_wood['value'] = $technology['mod_max_wood'];
|
||||
$attr_mod_max_stone['value'] = $technology['mod_max_stone'];
|
||||
$attr_mod_max_iron['value'] = $technology['mod_max_iron'];
|
||||
$attr_mod_max_mana['value'] = $technology['mod_max_mana'];
|
||||
|
||||
$attr_mod_rate_food['value'] = $technology['mod_rate_food'];
|
||||
$attr_mod_rate_wood['value'] = $technology['mod_rate_wood'];
|
||||
$attr_mod_rate_stone['value'] = $technology['mod_rate_stone'];
|
||||
$attr_mod_rate_iron['value'] = $technology['mod_rate_iron'];
|
||||
$attr_mod_rate_mana['value'] = $technology['mod_rate_mana'];
|
||||
|
||||
$attr_mod_percent_food['value'] = $technology['mod_percent_food'];
|
||||
$attr_mod_percent_wood['value'] = $technology['mod_percent_wood'];
|
||||
$attr_mod_percent_stone['value'] = $technology['mod_percent_stone'];
|
||||
$attr_mod_percent_iron['value'] = $technology['mod_percent_iron'];
|
||||
$attr_mod_percent_mana['value'] = $technology['mod_percent_mana'];
|
||||
|
||||
$sspid = $technology['mod_spell_id'];
|
||||
$smcid = $technology['mod_create_id'];
|
||||
$sflai = $technology['flag_ai'];
|
||||
|
||||
$selissec = $technology['is_secondary'];
|
||||
}
|
||||
?>
|
||||
<div class="back">
|
||||
<a href="<?=site_url($link_back); ?>"><-- Back</a>
|
||||
</div>
|
||||
<div class="action">
|
||||
<?php if ($new): ?>
|
||||
Creating!
|
||||
<?php else: ?>
|
||||
Editing!
|
||||
<?php endif; ?>
|
||||
</div>
|
||||
<?=validation_errors(); ?>
|
||||
<?=form_open($link_form); ?>
|
||||
|
||||
<div class="row_edit_textbox">
|
||||
<div class="edit_name">
|
||||
Description:
|
||||
</div>
|
||||
<div class="edit_input">
|
||||
<?=form_textarea($attr_description); ?>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="edit_spacer"></div>
|
||||
|
||||
<div class="row_edit">
|
||||
<div class="edit_name">
|
||||
Time:
|
||||
</div>
|
||||
<div class="edit_input">
|
||||
<?=form_input($attr_time); ?>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="edit_spacer"></div>
|
||||
|
||||
<div class="row_edit">
|
||||
<div class="edit_name">
|
||||
Score:
|
||||
</div>
|
||||
<div class="edit_input">
|
||||
<?=form_input($attr_score); ?>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="edit_spacer"></div>
|
||||
|
||||
<div class="row_edit">
|
||||
<div class="edit_name">
|
||||
Cost Food:
|
||||
</div>
|
||||
<div class="edit_input">
|
||||
<?=form_input($attr_cost_food); ?>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="row_edit">
|
||||
<div class="edit_name">
|
||||
Cost Wood:
|
||||
</div>
|
||||
<div class="edit_input">
|
||||
<?=form_input($attr_cost_wood); ?>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="row_edit">
|
||||
<div class="edit_name">
|
||||
Cost Stone:
|
||||
</div>
|
||||
<div class="edit_input">
|
||||
<?=form_input($attr_cost_stone); ?>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="row_edit">
|
||||
<div class="edit_name">
|
||||
Cost iron:
|
||||
</div>
|
||||
<div class="edit_input">
|
||||
<?=form_input($attr_cost_iron); ?>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="row_edit">
|
||||
<div class="edit_name">
|
||||
Cost Mana:
|
||||
</div>
|
||||
<div class="edit_input">
|
||||
<?=form_input($attr_cost_mana); ?>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="edit_spacer"></div>
|
||||
|
||||
<div class="row_edit">
|
||||
<div class="edit_name">
|
||||
Mod Max Food:
|
||||
</div>
|
||||
<div class="edit_input">
|
||||
<?=form_input($attr_mod_max_food); ?>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="row_edit">
|
||||
<div class="edit_name">
|
||||
Mod Max Wood:
|
||||
</div>
|
||||
<div class="edit_input">
|
||||
<?=form_input($attr_mod_max_wood); ?>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="row_edit">
|
||||
<div class="edit_name">
|
||||
Mod Max Stone:
|
||||
</div>
|
||||
<div class="edit_input">
|
||||
<?=form_input($attr_mod_max_stone); ?>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="row_edit">
|
||||
<div class="edit_name">
|
||||
Mod Max Iron:
|
||||
</div>
|
||||
<div class="edit_input">
|
||||
<?=form_input($attr_mod_max_iron); ?>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="row_edit">
|
||||
<div class="edit_name">
|
||||
Mod Max Mana:
|
||||
</div>
|
||||
<div class="edit_input">
|
||||
<?=form_input($attr_mod_max_mana); ?>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="edit_spacer"></div>
|
||||
|
||||
<div class="row_edit">
|
||||
<div class="edit_name">
|
||||
Mod Rate Food:
|
||||
</div>
|
||||
<div class="edit_input">
|
||||
<?=form_input($attr_mod_rate_food); ?>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="row_edit">
|
||||
<div class="edit_name">
|
||||
Mod Rate Wood:
|
||||
</div>
|
||||
<div class="edit_input">
|
||||
<?=form_input($attr_mod_rate_wood); ?>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="row_edit">
|
||||
<div class="edit_name">
|
||||
Mod Rate Stone:
|
||||
</div>
|
||||
<div class="edit_input">
|
||||
<?=form_input($attr_mod_rate_stone); ?>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="row_edit">
|
||||
<div class="edit_name">
|
||||
Mod Rate Iron:
|
||||
</div>
|
||||
<div class="edit_input">
|
||||
<?=form_input($attr_mod_rate_iron); ?>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="row_edit">
|
||||
<div class="edit_name">
|
||||
Mod Rate Mana:
|
||||
</div>
|
||||
<div class="edit_input">
|
||||
<?=form_input($attr_mod_rate_mana); ?>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="edit_spacer"></div>
|
||||
|
||||
<div class="row_edit">
|
||||
<div class="edit_name">
|
||||
Mod Percent Food:
|
||||
</div>
|
||||
<div class="edit_input">
|
||||
<?=form_input($attr_mod_percent_food); ?>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="row_edit">
|
||||
<div class="edit_name">
|
||||
Mod Percent Wood:
|
||||
</div>
|
||||
<div class="edit_input">
|
||||
<?=form_input($attr_mod_percent_wood); ?>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="row_edit">
|
||||
<div class="edit_name">
|
||||
Mod Percent Stone:
|
||||
</div>
|
||||
<div class="edit_input">
|
||||
<?=form_input($attr_mod_percent_stone); ?>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="row_edit">
|
||||
<div class="edit_name">
|
||||
Mod Percent Iron:
|
||||
</div>
|
||||
<div class="edit_input">
|
||||
<?=form_input($attr_mod_percent_iron); ?>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="row_edit">
|
||||
<div class="edit_name">
|
||||
Mod Percent Mana:
|
||||
</div>
|
||||
<div class="edit_input">
|
||||
<?=form_input($attr_mod_percent_mana); ?>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="edit_spacer"></div>
|
||||
|
||||
<div class="row_edit">
|
||||
<div class="edit_name">
|
||||
Mod Spell Id:
|
||||
</div>
|
||||
<div class="edit_input">
|
||||
<?=form_dropdown($name_mod_spell_id, $mspidopt, $sspid, $attr_mod_spell_id); ?>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="row_edit">
|
||||
<div class="edit_name">
|
||||
Mod Create Id:
|
||||
</div>
|
||||
<div class="edit_input">
|
||||
<?=form_dropdown($name_mod_create_id, $mcidopt, $smcid, $attr_mod_create_id); ?>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="edit_spacer"></div>
|
||||
|
||||
<div class="row_edit">
|
||||
<div class="edit_name">
|
||||
Flag AI:
|
||||
</div>
|
||||
<div class="edit_input">
|
||||
<?=form_dropdown('flag_ai', $opt_flag_ai, $sflai, $attr_drop); ?>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="edit_spacer"></div>
|
||||
|
||||
<div class="row_edit">
|
||||
<div class="edit_name">
|
||||
Type:
|
||||
</div>
|
||||
<div class="edit_input">
|
||||
<?=form_dropdown($name_is_secondary, $opt_is_secondary, $selissec, $attr_is_secondary); ?>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="edit_submit">
|
||||
<?=form_submit($attr_submit); ?>
|
||||
</div>
|
||||
<?=form_close(); ?>
|
38
Mourne-CI/application/views/admin/unit_tool/list.php
Executable file
38
Mourne-CI/application/views/admin/unit_tool/list.php
Executable file
@ -0,0 +1,38 @@
|
||||
<?php
|
||||
$this->load->helper('url');
|
||||
|
||||
$link_edit = 'admin/unit/';
|
||||
$link_new = 'admin/unit';
|
||||
$link_back = 'admin/admin_panel';
|
||||
?>
|
||||
<div class="back">
|
||||
<a href="<?=site_url($link_back); ?>"><--- Back</a>
|
||||
</div>
|
||||
<div class="top_menu">
|
||||
<a href="<?=site_url($link_new); ?>">Create New</a>
|
||||
</div>
|
||||
<div class="list_container">
|
||||
<?php $i = 1; ?>
|
||||
<?php foreach ($units as $row): ?>
|
||||
<?php $link = $link_edit . $row['id']; ?>
|
||||
<?php if (!($i % 2)): ?>
|
||||
<div class="row">
|
||||
<?php else: ?>
|
||||
<div class="row second">
|
||||
<?php endif; ?>
|
||||
<div class="attr_box">
|
||||
[<?=$row['id']; ?>]
|
||||
</div>
|
||||
<div class="attr_box">
|
||||
[Cost U: <?=$row['cost_unit']; ?>]
|
||||
</div>
|
||||
<div class="name">
|
||||
<?=$row['name']; ?>
|
||||
</div>
|
||||
<div class="actionbox">
|
||||
<a href="<?=site_url($link); ?>">Edit</a>
|
||||
</div>
|
||||
</div>
|
||||
<?php $i++; ?>
|
||||
<?php endforeach; ?>
|
||||
</div>
|
400
Mourne-CI/application/views/admin/unit_tool/unit.php
Executable file
400
Mourne-CI/application/views/admin/unit_tool/unit.php
Executable file
@ -0,0 +1,400 @@
|
||||
<?php
|
||||
$this->load->helper('url');
|
||||
$this->load->helper('form');
|
||||
|
||||
$link_back = 'admin/unit_tool';
|
||||
|
||||
$attr_drop = 'class="drop"';
|
||||
|
||||
$attr_name = array(
|
||||
'name' => 'name',
|
||||
'class' => 'input');
|
||||
|
||||
$attr_type = array(
|
||||
'name' => 'type',
|
||||
'class' => 'input');
|
||||
|
||||
$attr_icon = array(
|
||||
'name' => 'icon',
|
||||
'class' => 'input');
|
||||
|
||||
$attr_score = array(
|
||||
'name' => 'score',
|
||||
'class' => 'input');
|
||||
|
||||
$opt_can_defend = array(
|
||||
'0' => 'Not',
|
||||
'1' => 'Yes');
|
||||
|
||||
$attr_defense = array(
|
||||
'name' => 'defense',
|
||||
'class' => 'input');
|
||||
|
||||
$attr_attack = array(
|
||||
'name' => 'attack',
|
||||
'class' => 'input');
|
||||
|
||||
$attr_turn = array(
|
||||
'name' => 'turn',
|
||||
'class' => 'input');
|
||||
|
||||
$attr_ability = array(
|
||||
'name' => 'ability',
|
||||
'class' => 'input');
|
||||
|
||||
$attr_time_to_create = array(
|
||||
'name' => 'time_to_create',
|
||||
'class' => 'input');
|
||||
|
||||
$name_cost_unit = 'cost_unit';
|
||||
|
||||
$attr_cost_unit = 'class="drop"';
|
||||
|
||||
$attr_cost_num_unit = array(
|
||||
'name' => 'cost_num_unit',
|
||||
'class' => 'input');
|
||||
|
||||
$attr_cost_food = array(
|
||||
'name' => 'cost_food',
|
||||
'class' => 'input');
|
||||
|
||||
$attr_cost_wood = array(
|
||||
'name' => 'cost_wood',
|
||||
'class' => 'input');
|
||||
|
||||
$attr_cost_stone = array(
|
||||
'name' => 'cost_stone',
|
||||
'class' => 'input');
|
||||
|
||||
$attr_cost_iron = array(
|
||||
'name' => 'cost_iron',
|
||||
'class' => 'input');
|
||||
|
||||
$attr_cost_mana = array(
|
||||
'name' => 'cost_mana',
|
||||
'class' => 'input');
|
||||
|
||||
$attr_mod_rate_food = array(
|
||||
'name' => 'mod_rate_food',
|
||||
'class' => 'input');
|
||||
|
||||
$attr_mod_rate_wood = array(
|
||||
'name' => 'mod_rate_wood',
|
||||
'class' => 'input');
|
||||
|
||||
$attr_mod_rate_stone = array(
|
||||
'name' => 'mod_rate_stone',
|
||||
'class' => 'input');
|
||||
|
||||
$attr_mod_rate_iron = array(
|
||||
'name' => 'mod_rate_iron',
|
||||
'class' => 'input');
|
||||
|
||||
$attr_mod_rate_mana = array(
|
||||
'name' => 'mod_rate_mana',
|
||||
'class' => 'input');
|
||||
|
||||
$attr_submit = array(
|
||||
'name' => 'submit',
|
||||
'value' => 'Submit',
|
||||
'class' => 'submit');
|
||||
|
||||
if ($new)
|
||||
{
|
||||
//set every value with set_value()
|
||||
$link_form = 'admin/unit';
|
||||
$attr_type['value'] = set_value('type');
|
||||
$attr_name['value'] = set_value('name');
|
||||
$attr_icon['value'] = set_value('icon');
|
||||
|
||||
$attr_score['value'] = set_value('score');
|
||||
$attr_defense['value'] = set_value('icon');
|
||||
$attr_attack['value'] = set_value('icon');
|
||||
$attr_turn['value'] = set_value('icon');
|
||||
$attr_ability['value'] = set_value('icon');
|
||||
|
||||
$attr_time_to_create['value'] = set_value('time_to_create');
|
||||
|
||||
$attr_cost_unit['value'] = set_value('cost_unit');
|
||||
$attr_cost_num_unit['value'] = set_value('cost_num_unit');
|
||||
|
||||
$attr_cost_food['value'] = set_value('cost_food');
|
||||
$attr_cost_wood['value'] = set_value('cost_wood');
|
||||
$attr_cost_stone['value'] = set_value('cost_stone');
|
||||
$attr_cost_iron['value'] = set_value('cost_iron');
|
||||
$attr_cost_mana['value'] = set_value('cost_mana');
|
||||
|
||||
$attr_mod_rate_food['value'] = set_value('mod_rate_food');
|
||||
$attr_mod_rate_wood['value'] = set_value('mod_rate_wood');
|
||||
$attr_mod_rate_stone['value'] = set_value('mod_rate_stone');
|
||||
$attr_mod_rate_iron['value'] = set_value('mod_rate_iron');
|
||||
$attr_mod_rate_mana['value'] = set_value('mod_rate_mana');
|
||||
}
|
||||
else
|
||||
{
|
||||
//set every value from data sent
|
||||
$link_form = 'admin/unit/' . $unit['id'];
|
||||
$attr_type['value'] = $unit['type'];
|
||||
$attr_name['value'] = $unit['name'];
|
||||
$attr_icon['value'] = $unit['icon'];
|
||||
|
||||
$attr_score['value'] = $unit['score'];
|
||||
$scd = $unit['can_defend'];
|
||||
$attr_defense['value'] = $unit['defense'];
|
||||
$attr_attack['value'] = $unit['attack'];
|
||||
$sstrong = $unit['strong_against'];
|
||||
$sweak = $unit['weak_against'];
|
||||
$attr_turn['value'] = $unit['turn'];
|
||||
$attr_ability['value'] = $unit['ability'];
|
||||
|
||||
$attr_time_to_create['value'] = $unit['time_to_create'];
|
||||
|
||||
$costu = $unit['cost_unit'];
|
||||
$attr_cost_num_unit['value'] = $unit['cost_num_unit'];
|
||||
|
||||
$attr_cost_food['value'] = $unit['cost_food'];
|
||||
$attr_cost_wood['value'] = $unit['cost_wood'];
|
||||
$attr_cost_stone['value'] = $unit['cost_stone'];
|
||||
$attr_cost_iron['value'] = $unit['cost_iron'];
|
||||
$attr_cost_mana['value'] = $unit['cost_mana'];
|
||||
|
||||
$attr_mod_rate_food['value'] = $unit['mod_rate_food'];
|
||||
$attr_mod_rate_wood['value'] = $unit['mod_rate_wood'];
|
||||
$attr_mod_rate_stone['value'] = $unit['mod_rate_stone'];
|
||||
$attr_mod_rate_iron['value'] = $unit['mod_rate_iron'];
|
||||
$attr_mod_rate_mana['value'] = $unit['mod_rate_mana'];
|
||||
}
|
||||
?>
|
||||
<div class="back">
|
||||
<a href="<?=site_url($link_back); ?>"><-- Back</a>
|
||||
</div>
|
||||
<div class="action">
|
||||
<?php if ($new): ?>
|
||||
Creating!
|
||||
<?php else: ?>
|
||||
Editing!
|
||||
<?php endif; ?>
|
||||
</div>
|
||||
<?=validation_errors(); ?>
|
||||
<?=form_open($link_form); ?>
|
||||
|
||||
<div class="row_edit">
|
||||
<div class="edit_name">
|
||||
Name:
|
||||
</div>
|
||||
<div class="edit_input">
|
||||
<?=form_input($attr_name); ?>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="row_edit">
|
||||
<div class="edit_name">
|
||||
Icon:
|
||||
</div>
|
||||
<div class="edit_input">
|
||||
<?=form_input($attr_icon); ?>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="row_edit">
|
||||
<div class="edit_name">
|
||||
Type:
|
||||
</div>
|
||||
<div class="edit_input">
|
||||
<?=form_input($attr_type); ?>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="row_edit">
|
||||
<div class="edit_name">
|
||||
Time to Create:
|
||||
</div>
|
||||
<div class="edit_input">
|
||||
<?=form_input($attr_time_to_create); ?>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="row_edit">
|
||||
<div class="edit_name">
|
||||
Score:
|
||||
</div>
|
||||
<div class="edit_input">
|
||||
<?=form_input($attr_score); ?>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="edit_spacer"></div>
|
||||
|
||||
<div class="row_edit">
|
||||
<div class="edit_name">
|
||||
Can Defend?
|
||||
</div>
|
||||
<div class="edit_input">
|
||||
<?=form_dropdown('can_defend', $opt_can_defend, $scd, $attr_drop); ?>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="row_edit">
|
||||
<div class="edit_name">
|
||||
Defense:
|
||||
</div>
|
||||
<div class="edit_input">
|
||||
<?=form_input($attr_defense); ?>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="row_edit">
|
||||
<div class="edit_name">
|
||||
Attack:
|
||||
</div>
|
||||
<div class="edit_input">
|
||||
<?=form_input($attr_attack); ?>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="row_edit">
|
||||
<div class="edit_name">
|
||||
Strong Against:
|
||||
</div>
|
||||
<div class="edit_input">
|
||||
<?=form_dropdown('strong_against', $optaiu, $sstrong, $attr_drop); ?>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="row_edit">
|
||||
<div class="edit_name">
|
||||
Weak Against:
|
||||
</div>
|
||||
<div class="edit_input">
|
||||
<?=form_dropdown('weak_against', $optaiu, $sweak, $attr_drop); ?>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="row_edit">
|
||||
<div class="edit_name">
|
||||
Turn:
|
||||
</div>
|
||||
<div class="edit_input">
|
||||
<?=form_input($attr_turn); ?>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="row_edit">
|
||||
<div class="edit_name">
|
||||
Ability:
|
||||
</div>
|
||||
<div class="edit_input">
|
||||
<?=form_input($attr_ability); ?>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="edit_spacer"></div>
|
||||
|
||||
<div class="row_edit">
|
||||
<div class="edit_name">
|
||||
Cost Unit:
|
||||
</div>
|
||||
<div class="edit_input">
|
||||
<?=form_dropdown($name_cost_unit, $optu, $costu, $attr_cost_unit); ?>
|
||||
X <?=form_input($attr_cost_num_unit); ?>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="edit_spacer"></div>
|
||||
|
||||
<div class="row_edit">
|
||||
<div class="edit_name">
|
||||
Cost Food:
|
||||
</div>
|
||||
<div class="edit_input">
|
||||
<?=form_input($attr_cost_food); ?>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="row_edit">
|
||||
<div class="edit_name">
|
||||
Cost Wood:
|
||||
</div>
|
||||
<div class="edit_input">
|
||||
<?=form_input($attr_cost_wood); ?>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="row_edit">
|
||||
<div class="edit_name">
|
||||
Cost Stone:
|
||||
</div>
|
||||
<div class="edit_input">
|
||||
<?=form_input($attr_cost_stone); ?>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="row_edit">
|
||||
<div class="edit_name">
|
||||
Cost iron:
|
||||
</div>
|
||||
<div class="edit_input">
|
||||
<?=form_input($attr_cost_iron); ?>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="row_edit">
|
||||
<div class="edit_name">
|
||||
Cost Mana:
|
||||
</div>
|
||||
<div class="edit_input">
|
||||
<?=form_input($attr_cost_mana); ?>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="edit_spacer"></div>
|
||||
|
||||
<div class="row_edit">
|
||||
<div class="edit_name">
|
||||
Mos Rate Food:
|
||||
</div>
|
||||
<div class="edit_input">
|
||||
<?=form_input($attr_mod_rate_food); ?>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="row_edit">
|
||||
<div class="edit_name">
|
||||
Mod Rate Wood:
|
||||
</div>
|
||||
<div class="edit_input">
|
||||
<?=form_input($attr_mod_rate_wood); ?>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="row_edit">
|
||||
<div class="edit_name">
|
||||
Mod Rate Stone:
|
||||
</div>
|
||||
<div class="edit_input">
|
||||
<?=form_input($attr_mod_rate_stone); ?>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="row_edit">
|
||||
<div class="edit_name">
|
||||
Mod Rate Iron:
|
||||
</div>
|
||||
<div class="edit_input">
|
||||
<?=form_input($attr_mod_rate_iron); ?>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="row_edit">
|
||||
<div class="edit_name">
|
||||
Mod Rate Mana:
|
||||
</div>
|
||||
<div class="edit_input">
|
||||
<?=form_input($attr_mod_rate_mana); ?>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="edit_submit">
|
||||
<?=form_submit($attr_submit); ?>
|
||||
</div>
|
||||
<?=form_close(); ?>
|
43
Mourne-CI/application/views/admin/weather_tool/list.php
Executable file
43
Mourne-CI/application/views/admin/weather_tool/list.php
Executable file
@ -0,0 +1,43 @@
|
||||
<?php
|
||||
$this->load->helper('url');
|
||||
|
||||
$link_edit = 'admin/weather/';
|
||||
$link_new = 'admin/weather';
|
||||
|
||||
$link_back = 'admin/admin_panel';
|
||||
?>
|
||||
<div class="back">
|
||||
<a href="<?=site_url($link_back); ?>"><--- Back</a>
|
||||
</div>
|
||||
<div class="top_menu">
|
||||
<a href="<?=site_url($link_new); ?>">Create New</a>
|
||||
</div>
|
||||
<div class="list_container">
|
||||
<?php $i = 1; ?>
|
||||
<?php foreach ($weathers as $row): ?>
|
||||
<?php $link = $link_edit . $row['id']; ?>
|
||||
<?php if (!($i % 2)): ?>
|
||||
<div class="row">
|
||||
<?php else: ?>
|
||||
<div class="row second">
|
||||
<?php endif; ?>
|
||||
<div class="attr_box">
|
||||
[<?=$row['id']; ?>]
|
||||
</div>
|
||||
<div class="attr_box">
|
||||
[Eff: <?=$row['effect']; ?>]
|
||||
</div>
|
||||
<div class="attr_box">
|
||||
[<?=$row['name']; ?>]
|
||||
</div>
|
||||
<div class="name">
|
||||
<?=$row['description']; ?>
|
||||
</div>
|
||||
<div class="actionbox">
|
||||
<a href="<?=site_url($link); ?>">Edit</a>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
<?php $i++; ?>
|
||||
<?php endforeach; ?>
|
||||
</div>
|
323
Mourne-CI/application/views/admin/weather_tool/weather.php
Executable file
323
Mourne-CI/application/views/admin/weather_tool/weather.php
Executable file
@ -0,0 +1,323 @@
|
||||
<?php
|
||||
$this->load->helper('url');
|
||||
$this->load->helper('form');
|
||||
|
||||
$link_back = 'admin/weather_tool';
|
||||
|
||||
$name_effect = 'effect';
|
||||
$attr_effect = 'class="drop"';
|
||||
|
||||
$attr_name = array(
|
||||
'name' => 'name',
|
||||
'class' => 'input');
|
||||
|
||||
$attr_description = array(
|
||||
'name' => 'description',
|
||||
'rows' => '5',
|
||||
'cols' => '50',
|
||||
'class' => 'textarea');
|
||||
|
||||
$attr_art = array(
|
||||
'name' => 'art',
|
||||
'class' => 'input');
|
||||
|
||||
$attr_css = array(
|
||||
'name' => 'css',
|
||||
'class' => 'input');
|
||||
|
||||
$attr_cost_food = array(
|
||||
'name' => 'cost_food',
|
||||
'class' => 'input');
|
||||
|
||||
$attr_cost_wood = array(
|
||||
'name' => 'cost_wood',
|
||||
'class' => 'input');
|
||||
|
||||
$attr_cost_stone = array(
|
||||
'name' => 'cost_stone',
|
||||
'class' => 'input');
|
||||
|
||||
$attr_cost_iron = array(
|
||||
'name' => 'cost_iron',
|
||||
'class' => 'input');
|
||||
|
||||
$attr_cost_mana = array(
|
||||
'name' => 'cost_mana',
|
||||
'class' => 'input');
|
||||
|
||||
$attr_mod_max_food = array(
|
||||
'name' => 'mod_max_food',
|
||||
'class' => 'input');
|
||||
|
||||
$attr_mod_max_wood = array(
|
||||
'name' => 'mod_max_wood',
|
||||
'class' => 'input');
|
||||
|
||||
$attr_mod_max_stone = array(
|
||||
'name' => 'mod_max_stone',
|
||||
'class' => 'input');
|
||||
|
||||
$attr_mod_max_iron = array(
|
||||
'name' => 'mod_max_iron',
|
||||
'class' => 'input');
|
||||
|
||||
$attr_mod_max_mana = array(
|
||||
'name' => 'mod_max_mana',
|
||||
'class' => 'input');
|
||||
|
||||
|
||||
$attr_mod_rate_food = array(
|
||||
'name' => 'mod_rate_food',
|
||||
'class' => 'input');
|
||||
|
||||
$attr_mod_rate_wood = array(
|
||||
'name' => 'mod_rate_wood',
|
||||
'class' => 'input');
|
||||
|
||||
$attr_mod_rate_stone = array(
|
||||
'name' => 'mod_rate_stone',
|
||||
'class' => 'input');
|
||||
|
||||
$attr_mod_rate_iron = array(
|
||||
'name' => 'mod_rate_iron',
|
||||
'class' => 'input');
|
||||
|
||||
$attr_mod_rate_mana = array(
|
||||
'name' => 'mod_rate_mana',
|
||||
'class' => 'input');
|
||||
|
||||
|
||||
$attr_mod_percent_food = array(
|
||||
'name' => 'mod_percent_food',
|
||||
'class' => 'input');
|
||||
|
||||
$attr_mod_percent_wood = array(
|
||||
'name' => 'mod_percent_wood',
|
||||
'class' => 'input');
|
||||
|
||||
$attr_mod_percent_stone = array(
|
||||
'name' => 'mod_percent_stone',
|
||||
'class' => 'input');
|
||||
|
||||
$attr_mod_percent_iron = array(
|
||||
'name' => 'mod_percent_iron',
|
||||
'class' => 'input');
|
||||
|
||||
$attr_mod_percent_mana = array(
|
||||
'name' => 'mod_percent_mana',
|
||||
'class' => 'input');
|
||||
|
||||
$attr_submit = array(
|
||||
'name' => 'submit',
|
||||
'value' => 'Submit',
|
||||
'class' => 'submit');
|
||||
|
||||
if ($new)
|
||||
{
|
||||
//set every value with set_value()
|
||||
$link_form = 'admin/weather';
|
||||
|
||||
$attr_name['value'] = set_value('name');
|
||||
$attr_description['value'] = set_value('description');
|
||||
$attr_art['value'] = set_value('art');
|
||||
$attr_css['value'] = set_value('css');
|
||||
//weather effect goes from controller
|
||||
|
||||
$attr_mod_max_food['value'] = set_value('mod_max_food');
|
||||
$attr_mod_max_wood['value'] = set_value('mod_max_wood');
|
||||
$attr_mod_max_stone['value'] = set_value('mod_max_stone');
|
||||
$attr_mod_max_iron['value'] = set_value('mod_max_iron');
|
||||
$attr_mod_max_mana['value'] = set_value('mod_max_mana');
|
||||
|
||||
$attr_mod_percent_food['value'] = set_value('mod_percent_food');
|
||||
$attr_mod_percent_wood['value'] = set_value('mod_percent_wood');
|
||||
$attr_mod_percent_stone['value'] = set_value('mod_percent_stone');
|
||||
$attr_mod_percent_iron['value'] = set_value('mod_percent_iron');
|
||||
$attr_mod_percent_mana['value'] = set_value('mod_percent_mana');
|
||||
}
|
||||
else
|
||||
{
|
||||
//set every value from data sent
|
||||
$link_form = 'admin/weather/' . $weather['id'];
|
||||
|
||||
|
||||
|
||||
$attr_name['value'] = $weather['name'];
|
||||
$attr_description['value'] = $weather['description'];
|
||||
$attr_art['value'] = $weather['art'];
|
||||
$attr_css['value'] = $weather['css'];
|
||||
|
||||
$seff = $weather['effect'];
|
||||
|
||||
$attr_mod_max_food['value'] = $weather['mod_max_food'];
|
||||
$attr_mod_max_wood['value'] = $weather['mod_max_wood'];
|
||||
$attr_mod_max_stone['value'] = $weather['mod_max_stone'];
|
||||
$attr_mod_max_iron['value'] = $weather['mod_max_iron'];
|
||||
$attr_mod_max_mana['value'] = $weather['mod_max_mana'];
|
||||
|
||||
$attr_mod_percent_food['value'] = $weather['mod_percent_food'];
|
||||
$attr_mod_percent_wood['value'] = $weather['mod_percent_wood'];
|
||||
$attr_mod_percent_stone['value'] = $weather['mod_percent_stone'];
|
||||
$attr_mod_percent_iron['value'] = $weather['mod_percent_iron'];
|
||||
$attr_mod_percent_mana['value'] = $weather['mod_percent_mana'];
|
||||
}
|
||||
?>
|
||||
<div class="back">
|
||||
<a href="<?=site_url($link_back); ?>"><-- Back</a>
|
||||
</div>
|
||||
<div class="action">
|
||||
<?php if ($new): ?>
|
||||
Creating!
|
||||
<?php else: ?>
|
||||
Editing!
|
||||
<?php endif; ?>
|
||||
</div>
|
||||
<?=validation_errors(); ?>
|
||||
<?=form_open($link_form); ?>
|
||||
|
||||
<div class="row_edit">
|
||||
<div class="edit_name">
|
||||
Name:
|
||||
</div>
|
||||
<div class="edit_input">
|
||||
<?=form_input($attr_name); ?>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="row_edit_textbox">
|
||||
<div class="edit_name">
|
||||
Description:
|
||||
</div>
|
||||
<div class="edit_input">
|
||||
<?=form_textarea($attr_description); ?>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="row_edit">
|
||||
<div class="edit_name">
|
||||
Art:
|
||||
</div>
|
||||
<div class="edit_input">
|
||||
<?=form_input($attr_art); ?>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="row_edit">
|
||||
<div class="edit_name">
|
||||
CSS:
|
||||
</div>
|
||||
<div class="edit_input">
|
||||
<?=form_input($attr_css); ?>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="edit_spacer"></div>
|
||||
|
||||
<div class="row_edit">
|
||||
<div class="edit_name">
|
||||
Effect:
|
||||
</div>
|
||||
<div class="edit_input">
|
||||
<?=form_dropdown($name_effect, $opteff, $seff, $attr_effect); ?>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="edit_spacer"></div>
|
||||
|
||||
<div class="row_edit">
|
||||
<div class="edit_name">
|
||||
Mod Max Food:
|
||||
</div>
|
||||
<div class="edit_input">
|
||||
<?=form_input($attr_mod_max_food); ?>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="row_edit">
|
||||
<div class="edit_name">
|
||||
Mod Max Wood:
|
||||
</div>
|
||||
<div class="edit_input">
|
||||
<?=form_input($attr_mod_max_wood); ?>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="row_edit">
|
||||
<div class="edit_name">
|
||||
Mod Max Stone:
|
||||
</div>
|
||||
<div class="edit_input">
|
||||
<?=form_input($attr_mod_max_stone); ?>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="row_edit">
|
||||
<div class="edit_name">
|
||||
Mod Max Iron:
|
||||
</div>
|
||||
<div class="edit_input">
|
||||
<?=form_input($attr_mod_max_iron); ?>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="row_edit">
|
||||
<div class="edit_name">
|
||||
Mod Max Mana:
|
||||
</div>
|
||||
<div class="edit_input">
|
||||
<?=form_input($attr_mod_max_mana); ?>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="edit_spacer"></div>
|
||||
|
||||
<div class="row_edit">
|
||||
<div class="edit_name">
|
||||
Mod Percent Food:
|
||||
</div>
|
||||
<div class="edit_input">
|
||||
<?=form_input($attr_mod_percent_food); ?>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="row_edit">
|
||||
<div class="edit_name">
|
||||
Mod Percent Wood:
|
||||
</div>
|
||||
<div class="edit_input">
|
||||
<?=form_input($attr_mod_percent_wood); ?>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="row_edit">
|
||||
<div class="edit_name">
|
||||
Mod Percent Stone:
|
||||
</div>
|
||||
<div class="edit_input">
|
||||
<?=form_input($attr_mod_percent_stone); ?>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="row_edit">
|
||||
<div class="edit_name">
|
||||
Mod Percent Iron:
|
||||
</div>
|
||||
<div class="edit_input">
|
||||
<?=form_input($attr_mod_percent_iron); ?>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="row_edit">
|
||||
<div class="edit_name">
|
||||
Mod Percent Mana:
|
||||
</div>
|
||||
<div class="edit_input">
|
||||
<?=form_input($attr_mod_percent_mana); ?>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
<div class="edit_submit">
|
||||
<?=form_submit($attr_submit); ?>
|
||||
</div>
|
||||
<?=form_close(); ?>
|
5
Mourne-CI/application/views/building/al_research.php
Executable file
5
Mourne-CI/application/views/building/al_research.php
Executable file
@ -0,0 +1,5 @@
|
||||
<div class="building_container">
|
||||
<div class="cannot">
|
||||
Research in progress: <?=$technology['description']; ?>
|
||||
</div>
|
||||
</div>
|
80
Mourne-CI/application/views/building/assignments.php
Executable file
80
Mourne-CI/application/views/building/assignments.php
Executable file
@ -0,0 +1,80 @@
|
||||
<?php
|
||||
$this->load->helper('form');
|
||||
$link_form = 'building/doassign';
|
||||
|
||||
$attr_deass = array(
|
||||
'name' => 'submit',
|
||||
'value' => 'Deassign',
|
||||
'class' => 'submit');
|
||||
|
||||
$attr_input = array(
|
||||
'name' => 'num_assign',
|
||||
'maxlength' => '10',
|
||||
'size' => '8',
|
||||
'class' => 'input');
|
||||
|
||||
$attr_assign = array(
|
||||
'name' => 'submit',
|
||||
'value' => 'Assign',
|
||||
'class' => 'submit');
|
||||
?>
|
||||
<div class="building_container">
|
||||
<?php if ($assigndata): ?>
|
||||
<?php foreach($assigndata as $row): ?>
|
||||
<div class="building_data">
|
||||
<?php $found = FALSE; ?>
|
||||
<?php if ($assigned): ?>
|
||||
<?php foreach ($assigned as $ass): ?>
|
||||
<?php if ($found) continue; ?>
|
||||
<?php if ($ass['assignmentid'] == $row['id']): ?>
|
||||
<div class="left">
|
||||
<div class="description">
|
||||
<?=$row['description']; ?><br />
|
||||
</div>
|
||||
</div>
|
||||
<div class="right">
|
||||
<?=form_open($link_form); ?>
|
||||
<?=form_hidden('slotid', $slotid); ?>
|
||||
<?=form_hidden('assignmentid', $row['id']); ?>
|
||||
Assigned <?=$row['name']; ?>
|
||||
<?=$row['max']; ?>/<?=$ass['num_unit']; ?>
|
||||
<?=form_submit($attr_deass); ?>
|
||||
<?=form_close(); ?>
|
||||
</div>
|
||||
<?php $found = TRUE; ?>
|
||||
<?php endif; ?>
|
||||
<?php endforeach; ?>
|
||||
<?php endif; ?>
|
||||
<?php if (!$found): ?>
|
||||
<div class="left">
|
||||
<div class="description">
|
||||
<?=$row['description']; ?>
|
||||
</div>
|
||||
</div>
|
||||
<div class="right">
|
||||
<?=form_open($link_form); ?>
|
||||
<?=form_hidden('slotid', $slotid); ?>
|
||||
<?=form_hidden('assignmentid', $row['id']); ?>
|
||||
(You have:
|
||||
<?php if ($units): ?>
|
||||
<?php foreach ($units as $u): ?>
|
||||
<?php if ($u['unitid'] == $row['unitid']): ?>
|
||||
<?=$u['unitcount']; ?>)
|
||||
<?php endif; ?>
|
||||
<?php endforeach; ?>
|
||||
<?php else: ?>
|
||||
0)
|
||||
<?php endif; ?>
|
||||
<?=$row['max']; ?>/<?=form_input($attr_input); ?>
|
||||
<?=form_submit($attr_assign); ?>
|
||||
<?=form_close(); ?>
|
||||
</div>
|
||||
<?php endif; ?>
|
||||
</div>
|
||||
<?php endforeach; ?>
|
||||
<?php else: ?>
|
||||
<div class="cannot">
|
||||
This building doesn't have assignments!
|
||||
</div>
|
||||
<?php endif; ?>
|
||||
</div>
|
113
Mourne-CI/application/views/building/building_create.php
Executable file
113
Mourne-CI/application/views/building/building_create.php
Executable file
@ -0,0 +1,113 @@
|
||||
<?php
|
||||
$this->load->helper('url');
|
||||
$this->load->helper('form');
|
||||
$this->load->helper('date');
|
||||
|
||||
$link_form = 'building/docreate/' . $slotid;
|
||||
|
||||
$attr_create_num = array(
|
||||
'name' => 'create_num',
|
||||
'size' => '8',
|
||||
'maxlength' => '10',
|
||||
'class' => 'input');
|
||||
|
||||
$attr_submit = array(
|
||||
'name' => 'submit',
|
||||
'value' => 'Create!',
|
||||
'class' => 'submit');
|
||||
|
||||
?>
|
||||
<div class="building_container">
|
||||
<?php if ($building['creates']): ?>
|
||||
<div class="create_data">
|
||||
<div class="create_name">
|
||||
Create: <?=$unit['name']; ?>
|
||||
</div>
|
||||
<div class="left">
|
||||
<div class="cost">
|
||||
<div class="cost_icon">
|
||||
F:
|
||||
</div>
|
||||
<div class="cost_food">
|
||||
<?=$unit['cost_food']; ?>
|
||||
</div>
|
||||
</div>
|
||||
<div class="cost">
|
||||
<div class="cost_icon">
|
||||
W:
|
||||
</div>
|
||||
<div class="cost_wood">
|
||||
<?=$unit['cost_wood']; ?>
|
||||
</div>
|
||||
</div>
|
||||
<div class="cost">
|
||||
<div class="cost_icon">
|
||||
S:
|
||||
</div>
|
||||
<div class="cost_stone">
|
||||
<?=$unit['cost_stone']; ?>
|
||||
</div>
|
||||
</div>
|
||||
<div class="cost">
|
||||
<div class="cost_icon">
|
||||
I:
|
||||
</div>
|
||||
<div class="cost_iron">
|
||||
<?=$unit['cost_iron']; ?>
|
||||
</div>
|
||||
</div>
|
||||
<div class="cost">
|
||||
<div class="cost_icon">
|
||||
M:
|
||||
</div>
|
||||
<div class="cost_mana">
|
||||
<?=$unit['cost_mana']; ?>
|
||||
</div>
|
||||
</div>
|
||||
<div class="nofloat"></div>
|
||||
<div class="cost">
|
||||
<div class="cost_unit_time_container">
|
||||
<div class="cost_icon">
|
||||
D:
|
||||
</div>
|
||||
<div class="cost_unit_time">
|
||||
<?=timespan(time(), (time() + $unit['time_to_create'])); ?>
|
||||
/ <?=$unit['name']; ?>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="nofloat"></div>
|
||||
<div class="cost">
|
||||
<div class="cost_unit_container">
|
||||
<div class="cost_icon">
|
||||
Unit:
|
||||
</div>
|
||||
<div class="cost_unit">
|
||||
<?php if ($unit['cost_unit']): ?>
|
||||
<?=$unit['cost_num_unit']; ?>
|
||||
<?=$costu['name']; ?> /
|
||||
<?=$unit['name']; ?>
|
||||
<?php else: ?>
|
||||
Nothing
|
||||
<?php endif; ?>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="right">
|
||||
<div class="create_unit_container">
|
||||
<?=form_open($link_form); ?>
|
||||
<div class="create_unit">
|
||||
<?=$maxunit; ?>/<?=form_input($attr_create_num); ?>
|
||||
<?=form_submit($attr_submit); ?>
|
||||
</div>
|
||||
<?=form_close(); ?>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<?php else: ?>
|
||||
<div class="cannot">
|
||||
This building cannot create units.
|
||||
</div>
|
||||
<?php endif; ?>
|
||||
</div>
|
28
Mourne-CI/application/views/building/events.php
Executable file
28
Mourne-CI/application/views/building/events.php
Executable file
@ -0,0 +1,28 @@
|
||||
<?php
|
||||
$this->load->helper('date');
|
||||
|
||||
$dstring = '%Y-%m-%d - %H:%i:%s';
|
||||
?>
|
||||
<?php if ($event): ?>
|
||||
<div class="building_container">
|
||||
<div class="event_data">
|
||||
<?php $i = 0; ?>
|
||||
<?php foreach ($event as $row): ?>
|
||||
<?php if ($i % 2): ?>
|
||||
<div class="event">
|
||||
<?php else: ?>
|
||||
<div class="event event_first">
|
||||
<?php endif; ?>
|
||||
<?php $left = $row['end'] - time(); ?>
|
||||
Type: <?=$row['type']; ?> Vid: <?=$row['villageid']; ?> D1: <?=$row['data1']; ?>
|
||||
D2: <?=$row['data2']; ?> Ends: <?=mdate($dstring, $row['end']); ?>
|
||||
Left: <?=timespan(time(), $row['end']); ?><br />
|
||||
</div>
|
||||
<?php $i++; ?>
|
||||
<?php endforeach; ?>
|
||||
</div>
|
||||
</div>
|
||||
<?php else: ?>
|
||||
<div class="building_container">
|
||||
</div>
|
||||
<?php endif; ?>
|
13
Mourne-CI/application/views/building/header.php
Executable file
13
Mourne-CI/application/views/building/header.php
Executable file
@ -0,0 +1,13 @@
|
||||
<?php
|
||||
$this->load->helper('murl');
|
||||
$this->load->helper('url');
|
||||
|
||||
$link_back = 'village/selected';
|
||||
?>
|
||||
<div class="building_header_container">
|
||||
<div class="building_header">
|
||||
<div class="building_header_back">
|
||||
<a href="<?=site_url($link_back); ?>"><-- <?=$building['name']; ?> (Rank: <?=$building['rank']; ?>)</a>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
86
Mourne-CI/application/views/building/list.php
Executable file
86
Mourne-CI/application/views/building/list.php
Executable file
@ -0,0 +1,86 @@
|
||||
<?php
|
||||
$this->load->helper('url');
|
||||
$this->load->helper('date');
|
||||
$this->load->helper('form');
|
||||
|
||||
$link_back = 'village/selected';
|
||||
|
||||
$link_form = 'building/dobuild';
|
||||
|
||||
$attr_submit = array(
|
||||
'name' => 'submit',
|
||||
'value' => 'Build!',
|
||||
'class' => 'submit');
|
||||
?>
|
||||
<div class="building_container">
|
||||
<div class="back">
|
||||
<a href="<?=site_url($link_back); ?>"><-- Back to Village</a>
|
||||
</div>
|
||||
<?php foreach ($buildings as $row): ?>
|
||||
<div class="building_list_data">
|
||||
<div class="left">
|
||||
<div class="cost">
|
||||
<div class="cost_icon">
|
||||
D:
|
||||
</div>
|
||||
<div class="cost_building_list">
|
||||
<?=timespan(time(), (time() + $row['time_to_build'])); ?>
|
||||
</div>
|
||||
</div>
|
||||
<div class="cost">
|
||||
<div class="cost_icon">
|
||||
F:
|
||||
</div>
|
||||
<div class="cost_building_list">
|
||||
<?=$row['cost_food']; ?>
|
||||
</div>
|
||||
</div>
|
||||
<div class="cost">
|
||||
<div class="cost_icon">
|
||||
W:
|
||||
</div>
|
||||
<div class="cost_building_list">
|
||||
<?=$row['cost_wood']; ?>
|
||||
</div>
|
||||
</div>
|
||||
<div class="cost">
|
||||
<div class="cost_icon">
|
||||
S:
|
||||
</div>
|
||||
<div class="cost_building_list">
|
||||
<?=$row['cost_stone']; ?>
|
||||
</div>
|
||||
</div>
|
||||
<div class="cost">
|
||||
<div class="cost_icon">
|
||||
I:
|
||||
</div>
|
||||
<div class="cost_building_list">
|
||||
<?=$row['cost_iron']; ?>
|
||||
</div>
|
||||
</div>
|
||||
<div class="cost">
|
||||
<div class="cost_icon">
|
||||
M:
|
||||
</div>
|
||||
<div class="cost_building_list">
|
||||
<?=$row['cost_mana']; ?>
|
||||
</div>
|
||||
</div>
|
||||
<div class="nofloat"></div>
|
||||
<div class="research_description">
|
||||
<?=$row['name']; ?>: (<?=$row['description']; ?>)
|
||||
</div>
|
||||
</div>
|
||||
<div class="right">
|
||||
<div class="research_box">
|
||||
<?=form_open($link_form); ?>
|
||||
<?=form_hidden('id', $row['id']); ?>
|
||||
<?=form_hidden('slotid', $slotid); ?>
|
||||
<?=form_submit($attr_submit); ?>
|
||||
<?=form_close(); ?>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<?php endforeach; ?>
|
||||
</div>
|
36
Mourne-CI/application/views/building/menu.php
Executable file
36
Mourne-CI/application/views/building/menu.php
Executable file
@ -0,0 +1,36 @@
|
||||
<?php
|
||||
$this->load->helper('url');
|
||||
|
||||
$link_stats = 'building/stats/' . $slotid;
|
||||
$link_create = 'building/create/' . $slotid;
|
||||
$link_assignments = 'building/assign/' . $slotid;
|
||||
$link_spells = 'building/spells/' . $slotid;
|
||||
$link_research = 'building/research/' . $slotid;
|
||||
$link_events = 'building/events/' . $slotid;
|
||||
$link_upgrade = 'building/upgrade/' . $slotid;
|
||||
?>
|
||||
<div class="building_menu_container">
|
||||
<div class="building_menu">
|
||||
<div class="building_menuentry_first">
|
||||
<a href="<?=site_url($link_stats); ?>">Stats</a>
|
||||
</div>
|
||||
<div class="building_menuentry">
|
||||
<a href="<?=site_url($link_create); ?>">Create</a>
|
||||
</div>
|
||||
<div class="building_menuentry">
|
||||
<a href="<?=site_url($link_assignments); ?>">Assignments</a>
|
||||
</div>
|
||||
<div class="building_menuentry">
|
||||
<a href="<?=site_url($link_spells); ?>">Spells</a>
|
||||
</div>
|
||||
<div class="building_menuentry">
|
||||
<a href="<?=site_url($link_research); ?>">Research</a>
|
||||
</div>
|
||||
<div class="building_menuentry">
|
||||
<a href="<?=site_url($link_events); ?>">Events</a>
|
||||
</div>
|
||||
<div class="building_menuentry">
|
||||
<a href="<?=site_url($link_upgrade); ?>">Uprade</a>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
17
Mourne-CI/application/views/building/next_event.php
Executable file
17
Mourne-CI/application/views/building/next_event.php
Executable file
@ -0,0 +1,17 @@
|
||||
<?php //needs event_name_helper or maybe logic of what to display ?>
|
||||
<?php
|
||||
$this->load->helper('date');
|
||||
|
||||
$dstring = '%Y-%m-%d - %H:%i:%s';
|
||||
?>
|
||||
<?php if ($event): ?>
|
||||
<div class="event_container">
|
||||
<div class="event">
|
||||
Type: <?=$event['type']; ?> Vid: <?=$event['villageid']; ?> D1: <?=$event['data1']; ?>
|
||||
Ends: <?=mdate($dstring, $event['end']); ?> Left: <?=timespan(time(), $event['end']); ?>
|
||||
</div>
|
||||
</div>
|
||||
<?php else: ?>
|
||||
<div class="event_container" style="display:none;">
|
||||
</div>
|
||||
<?php endif; ?>
|
166
Mourne-CI/application/views/building/research.php
Executable file
166
Mourne-CI/application/views/building/research.php
Executable file
@ -0,0 +1,166 @@
|
||||
<?php
|
||||
$this->load->helper('form');
|
||||
$this->load->helper('date');
|
||||
|
||||
$link_form = 'building/doresearch';
|
||||
|
||||
$attr_submit = array(
|
||||
'name' => 'submit',
|
||||
'value' => 'Research!',
|
||||
'class' => 'submit');
|
||||
?>
|
||||
<div class="building_container">
|
||||
<?php if ($primary): ?>
|
||||
<div class="research_header">
|
||||
Primary researches:
|
||||
</div>
|
||||
<?php foreach ($primary as $row): ?>
|
||||
<div class="research_data">
|
||||
<div class="left">
|
||||
<div class="cost">
|
||||
<div class="cost_icon">
|
||||
D:
|
||||
</div>
|
||||
<div class="cost_research">
|
||||
<?=timespan(time(), (time() + $row['time'])); ?>
|
||||
</div>
|
||||
</div>
|
||||
<div class="cost">
|
||||
<div class="cost_icon">
|
||||
F:
|
||||
</div>
|
||||
<div class="cost_research">
|
||||
<?=$row['cost_food']; ?>
|
||||
</div>
|
||||
</div>
|
||||
<div class="cost">
|
||||
<div class="cost_icon">
|
||||
W:
|
||||
</div>
|
||||
<div class="cost_research">
|
||||
<?=$row['cost_wood']; ?>
|
||||
</div>
|
||||
</div>
|
||||
<div class="cost">
|
||||
<div class="cost_icon">
|
||||
S:
|
||||
</div>
|
||||
<div class="cost_research">
|
||||
<?=$row['cost_stone']; ?>
|
||||
</div>
|
||||
</div>
|
||||
<div class="cost">
|
||||
<div class="cost_icon">
|
||||
I:
|
||||
</div>
|
||||
<div class="cost_research">
|
||||
<?=$row['cost_iron']; ?>
|
||||
</div>
|
||||
</div>
|
||||
<div class="cost">
|
||||
<div class="cost_icon">
|
||||
M:
|
||||
</div>
|
||||
<div class="cost_research">
|
||||
<?=$row['cost_mana']; ?>
|
||||
</div>
|
||||
</div>
|
||||
<div class="nofloat"></div>
|
||||
<div class="research_description">
|
||||
<?=$row['description']; ?>
|
||||
</div>
|
||||
</div>
|
||||
<div class="right">
|
||||
<div class="research_box">
|
||||
<?=form_open($link_form); ?>
|
||||
<?=form_hidden('id', $row['id']); ?>
|
||||
<?=form_hidden('slotid', $slotid); ?>
|
||||
<?=form_submit($attr_submit); ?>
|
||||
<?=form_close(); ?>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<?php endforeach; ?>
|
||||
<br />
|
||||
<?php else: ?>
|
||||
<div class="research_header">
|
||||
No primary researches.
|
||||
</div>
|
||||
<?php endif; ?>
|
||||
<?php if ($secondary): ?>
|
||||
<div class="research_header">
|
||||
Secondary researches:
|
||||
</div>
|
||||
<?php foreach ($secondary as $row): ?>
|
||||
<div class="research_data">
|
||||
<div class="left">
|
||||
<div class="cost">
|
||||
<div class="cost_icon">
|
||||
D:
|
||||
</div>
|
||||
<div class="cost_research">
|
||||
<?=timespan(time(), (time() + $row['time'])); ?>
|
||||
</div>
|
||||
</div>
|
||||
<div class="cost">
|
||||
<div class="cost_icon">
|
||||
F:
|
||||
</div>
|
||||
<div class="cost_research">
|
||||
<?=$row['cost_food']; ?>
|
||||
</div>
|
||||
</div>
|
||||
<div class="cost">
|
||||
<div class="cost_icon">
|
||||
W:
|
||||
</div>
|
||||
<div class="cost_research">
|
||||
<?=$row['cost_wood']; ?>
|
||||
</div>
|
||||
</div>
|
||||
<div class="cost">
|
||||
<div class="cost_icon">
|
||||
S:
|
||||
</div>
|
||||
<div class="cost_research">
|
||||
<?=$row['cost_stone']; ?>
|
||||
</div>
|
||||
</div>
|
||||
<div class="cost">
|
||||
<div class="cost_icon">
|
||||
I:
|
||||
</div>
|
||||
<div class="cost_research">
|
||||
<?=$row['cost_iron']; ?>
|
||||
</div>
|
||||
</div>
|
||||
<div class="cost">
|
||||
<div class="cost_icon">
|
||||
M:
|
||||
</div>
|
||||
<div class="cost_research">
|
||||
<?=$row['cost_mana']; ?>
|
||||
</div>
|
||||
</div>
|
||||
<div class="nofloat"></div>
|
||||
<div class="spell_description">
|
||||
<?=$row['description']; ?>
|
||||
</div>
|
||||
</div>
|
||||
<div class="right">
|
||||
<div class="spell_box">
|
||||
<?=form_open($link_form); ?>
|
||||
<?=form_hidden('id', $row['id']); ?>
|
||||
<?=form_hidden('slotid', $slotid); ?>
|
||||
<?=form_submit($attr_submit); ?>
|
||||
<?=form_close(); ?>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<?php endforeach; ?>
|
||||
<?php else: ?>
|
||||
<div class="research_header">
|
||||
No Secondary researches.
|
||||
</div>
|
||||
<?php endif; ?>
|
||||
</div>
|
2
Mourne-CI/application/views/building/spacer.php
Executable file
2
Mourne-CI/application/views/building/spacer.php
Executable file
@ -0,0 +1,2 @@
|
||||
<div class="vertical_spacer">
|
||||
</div>
|
103
Mourne-CI/application/views/building/spells.php
Executable file
103
Mourne-CI/application/views/building/spells.php
Executable file
@ -0,0 +1,103 @@
|
||||
<?php
|
||||
$this->load->helper('form');
|
||||
$this->load->helper('date');
|
||||
|
||||
$link_form = 'building/dospell';
|
||||
|
||||
$attr_submit = array(
|
||||
'name' => 'submit',
|
||||
'value' => 'Use',
|
||||
'class' => 'submit');
|
||||
?>
|
||||
<div class="building_container">
|
||||
<?php if ($spells): ?>
|
||||
<?php foreach ($spells as $row): ?>
|
||||
<div class="spell_data">
|
||||
<?php if (!$row['cooldown_end']): ?>
|
||||
<?=form_open($link_form); ?>
|
||||
<?php endif; ?>
|
||||
<div class="left">
|
||||
<div class="cost">
|
||||
<div class="cost_icon">
|
||||
D:
|
||||
</div>
|
||||
<div class="cost_spell">
|
||||
<?=$row['duration']; ?>
|
||||
</div>
|
||||
</div>
|
||||
<div class="cost">
|
||||
<div class="cost_icon">
|
||||
C:
|
||||
</div>
|
||||
<div class="cost_spell">
|
||||
<?=$row['cooldown']; ?>
|
||||
</div>
|
||||
</div>
|
||||
<div class="cost">
|
||||
<div class="cost_icon">
|
||||
F:
|
||||
</div>
|
||||
<div class="cost_spell">
|
||||
<?=$row['cost_food']; ?>
|
||||
</div>
|
||||
</div>
|
||||
<div class="cost">
|
||||
<div class="cost_icon">
|
||||
W:
|
||||
</div>
|
||||
<div class="cost_spell">
|
||||
<?=$row['cost_wood']; ?>
|
||||
</div>
|
||||
</div>
|
||||
<div class="cost">
|
||||
<div class="cost_icon">
|
||||
S:
|
||||
</div>
|
||||
<div class="cost_spell">
|
||||
<?=$row['cost_stone']; ?>
|
||||
</div>
|
||||
</div>
|
||||
<div class="cost">
|
||||
<div class="cost_icon">
|
||||
I:
|
||||
</div>
|
||||
<div class="cost_spell">
|
||||
<?=$row['cost_iron']; ?>
|
||||
</div>
|
||||
</div>
|
||||
<div class="cost">
|
||||
<div class="cost_icon">
|
||||
M:
|
||||
</div>
|
||||
<div class="cost_spell">
|
||||
<?=$row['cost_mana']; ?>
|
||||
</div>
|
||||
</div>
|
||||
<div class="nofloat"></div>
|
||||
<div class="spell_description">
|
||||
<?=$row['description']; ?>
|
||||
</div>
|
||||
</div>
|
||||
<div class="right">
|
||||
<div class="spell_box">
|
||||
<?php if (!$row['cooldown_end']): ?>
|
||||
<?=form_hidden('slotid', $slotid); ?>
|
||||
<?=form_hidden('spellid', $row['id']); ?>
|
||||
<?=form_submit($attr_submit); ?>
|
||||
<?php else: ?>
|
||||
<span class="cooldown_text">
|
||||
<?=timespan(time(), $row['cooldown_end']); ?></span>
|
||||
<?php endif; ?>
|
||||
<?php if (!$row['cooldown_end']): ?>
|
||||
<?=form_close(); ?>
|
||||
<?php endif; ?>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<?php endforeach; ?>
|
||||
<?php else: ?>
|
||||
<div class="cannot">
|
||||
This building doesn't have spells.
|
||||
</div>
|
||||
<?php endif; ?>
|
||||
</div>
|
91
Mourne-CI/application/views/building/stats.php
Executable file
91
Mourne-CI/application/views/building/stats.php
Executable file
@ -0,0 +1,91 @@
|
||||
<div class="building_container">
|
||||
<div class="stats_data">
|
||||
<div class="stat_header">
|
||||
Modifies Maximum Vales:
|
||||
</div>
|
||||
<div class="stat">
|
||||
<div class="stat_icon">
|
||||
F:
|
||||
</div>
|
||||
<div class="num_stat">
|
||||
<?=$building['mod_max_food']; ?>
|
||||
</div>
|
||||
</div>
|
||||
<div class="stat">
|
||||
<div class="stat_icon">
|
||||
W:
|
||||
</div>
|
||||
<div class="num_stat">
|
||||
<?=$building['mod_max_wood']; ?>
|
||||
</div>
|
||||
</div>
|
||||
<div class="stat">
|
||||
<div class="stat_icon">
|
||||
S:
|
||||
</div>
|
||||
<div class="num_stat">
|
||||
<?=$building['mod_max_stone']; ?>
|
||||
</div>
|
||||
</div>
|
||||
<div class="stat">
|
||||
<div class="stat_icon">
|
||||
I:
|
||||
</div>
|
||||
<div class="num_stat">
|
||||
<?=$building['mod_max_iron']; ?>
|
||||
</div>
|
||||
</div>
|
||||
<div class="stat">
|
||||
<div class="stat_icon">
|
||||
M:
|
||||
</div>
|
||||
<div class="num_stat">
|
||||
<?=$building['mod_max_mana']; ?>
|
||||
</div>
|
||||
</div>
|
||||
<div class="nofloat"></div>
|
||||
<div class="stat_header">
|
||||
Modifies Rates:
|
||||
</div>
|
||||
<div class="stat">
|
||||
<div class="stat_icon">
|
||||
F:
|
||||
</div>
|
||||
<div class="num_stat">
|
||||
<?=$building['mod_rate_food']; ?>
|
||||
</div>
|
||||
</div>
|
||||
<div class="stat">
|
||||
<div class="stat_icon">
|
||||
W:
|
||||
</div>
|
||||
<div class="num_stat">
|
||||
<?=$building['mod_rate_wood']; ?>
|
||||
</div>
|
||||
</div>
|
||||
<div class="stat">
|
||||
<div class="stat_icon">
|
||||
S:
|
||||
</div>
|
||||
<div class="num_stat">
|
||||
<?=$building['mod_rate_stone']; ?>
|
||||
</div>
|
||||
</div>
|
||||
<div class="stat">
|
||||
<div class="stat_icon">
|
||||
I:
|
||||
</div>
|
||||
<div class="num_stat">
|
||||
<?=$building['mod_rate_iron']; ?>
|
||||
</div>
|
||||
</div>
|
||||
<div class="stat">
|
||||
<div class="stat_icon">
|
||||
M:
|
||||
</div>
|
||||
<div class="num_stat">
|
||||
<?=$building['mod_rate_mana']; ?>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
98
Mourne-CI/application/views/building/upgrade.php
Executable file
98
Mourne-CI/application/views/building/upgrade.php
Executable file
@ -0,0 +1,98 @@
|
||||
<?php
|
||||
//$this->load->helper('url');
|
||||
$this->load->helper('form');
|
||||
$this->load->helper('date');
|
||||
|
||||
$link_form = 'building/doupgrade/';
|
||||
|
||||
$attr_submit = array(
|
||||
'name' => 'submit',
|
||||
'value' => 'Upgrade!',
|
||||
'class' => 'submit');
|
||||
?>
|
||||
<div class="building_container">
|
||||
<?php if ($building['next_rank']): ?>
|
||||
<?php if ($upgrade == 3): ?>
|
||||
<?=form_open($link_form); ?>
|
||||
<?php endif; ?>
|
||||
<div class="upgrade_data">
|
||||
<div class="left">
|
||||
<div class="cost">
|
||||
<div class="cost_icon">
|
||||
D:
|
||||
</div>
|
||||
<div class="cost_upgrade">
|
||||
<?=timespan(time(), (time() + $nextrank['time_to_build'])); ?>
|
||||
</div>
|
||||
</div>
|
||||
<div class="cost">
|
||||
<div class="cost_icon">
|
||||
F:
|
||||
</div>
|
||||
<div class="cost_upgrade">
|
||||
<?=$nextrank['cost_food']; ?>
|
||||
</div>
|
||||
</div>
|
||||
<div class="cost">
|
||||
<div class="cost_icon">
|
||||
W:
|
||||
</div>
|
||||
<div class="cost_upgrade">
|
||||
<?=$nextrank['cost_wood']; ?>
|
||||
</div>
|
||||
</div>
|
||||
<div class="cost">
|
||||
<div class="cost_icon">
|
||||
S:
|
||||
</div>
|
||||
<div class="cost_upgrade">
|
||||
<?=$nextrank['cost_stone']; ?>
|
||||
</div>
|
||||
</div>
|
||||
<div class="cost">
|
||||
<div class="cost_icon">
|
||||
I:
|
||||
</div>
|
||||
<div class="cost_upgrade">
|
||||
<?=$nextrank['cost_iron']; ?>
|
||||
</div>
|
||||
</div>
|
||||
<div class="cost">
|
||||
<div class="cost_icon">
|
||||
M:
|
||||
</div>
|
||||
<div class="cost_upgrade">
|
||||
<?=$nextrank['cost_mana']; ?>
|
||||
</div>
|
||||
</div>
|
||||
<div class="nofloat"></div>
|
||||
<div class="upgrade_description">
|
||||
<?php if ($upgrade == 0): ?>
|
||||
Already upgrading.
|
||||
<?php elseif ($upgrade == 1): ?>
|
||||
Technology requirement not met.
|
||||
<?php elseif ($upgrade == 2): ?>
|
||||
Not enough resources.
|
||||
<?php else: ?>
|
||||
Every requirement met.
|
||||
<?php endif; ?>
|
||||
</div>
|
||||
</div>
|
||||
<div class="right">
|
||||
<div class="upgrade_box">
|
||||
<?php if($upgrade == 3): ?>
|
||||
<?=form_hidden('slotid', $slotid); ?>
|
||||
<?=form_submit($attr_submit); ?>
|
||||
<?=form_close(); ?>
|
||||
<?php else: ?>
|
||||
Cannot Upgrade.
|
||||
<?php endif; ?>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<?php else: ?>
|
||||
<div class="cannot">
|
||||
This building cannot be upgraded.
|
||||
</div>
|
||||
<?php endif; ?>
|
||||
</div>
|
30
Mourne-CI/application/views/changelog/changelog.php
Executable file
30
Mourne-CI/application/views/changelog/changelog.php
Executable file
@ -0,0 +1,30 @@
|
||||
changelog lawl!<br />
|
||||
<?php
|
||||
$this->load->helper('date');
|
||||
$datestring = '%y.%m.%d - %H:%i';
|
||||
?>
|
||||
|
||||
<?php if ($userlevel > $required_userlevel):
|
||||
$this->load->helper('url');
|
||||
|
||||
$link_new_commit = 'changelog/add_new_commit';
|
||||
$link_new_version = 'changelog/add_new_version';
|
||||
?>
|
||||
<a href="<?=site_url($link_new_commit); ?>">New Commit</a>
|
||||
<a href="<?=site_url($link_new_version); ?>">New version</a><br />
|
||||
<?php endif; ?>
|
||||
|
||||
<?php if ($versions && $commits): ?>
|
||||
<?php foreach ($versions as $i): ?>
|
||||
<div class="changelog">
|
||||
Version: <?=$i['version']; ?> <br />
|
||||
<?php foreach ($commits as $com): ?>
|
||||
<? if ($i['id'] == $com['versionid']): ?>
|
||||
(<?=mdate($datestring, $com['timestamp']); ?>) - <?=$com['text']; ?><br />
|
||||
<? endif; ?>
|
||||
<?php endforeach; ?>
|
||||
</div>
|
||||
<?php endforeach; ?>
|
||||
<?php else: ?>
|
||||
sorry, nothing here :(
|
||||
<?php endif; ?>
|
27
Mourne-CI/application/views/changelog/new_commit.php
Executable file
27
Mourne-CI/application/views/changelog/new_commit.php
Executable file
@ -0,0 +1,27 @@
|
||||
New commit lawl!
|
||||
<?php
|
||||
$this->load->helper('url');
|
||||
$this->load->helper('form');
|
||||
|
||||
$link_back = 'changelog/show';
|
||||
|
||||
$link_form = 'changelog/add_new_commit';
|
||||
|
||||
$attr_form = array(
|
||||
'class' => 'changelog_form');
|
||||
|
||||
$attr_text = array(
|
||||
'name' => 'text',
|
||||
'class' => 'changelog_input');
|
||||
|
||||
$attr_submit = array(
|
||||
'name' => 'submit',
|
||||
'value' => 'Submit',
|
||||
'class' => 'changelog_submit');
|
||||
?>
|
||||
<a href="<?=site_url($link_back); ?>">Back</a><br />
|
||||
|
||||
<?=form_open($link_form, $attr_form); ?>
|
||||
<?=form_input($attr_text); ?>
|
||||
<?=form_submit($attr_submit); ?>
|
||||
<?=form_close(); ?>
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user