#1470 monday's push_all

--HG--
branch : gsoc2012-achievements
This commit is contained in:
SirCotare 2012-06-04 21:23:14 +02:00
parent 41ce43d4b9
commit 6d33124bc3
9 changed files with 175 additions and 28 deletions

View file

@ -20,6 +20,8 @@
require_once("class/DataSourceHandler_class.php"); require_once("class/DataSourceHandler_class.php");
require_once("class/DataSource_abstract.php"); require_once("class/DataSource_abstract.php");
require_once("class/Atom_class.php");
//create datasource handler //create datasource handler
$_DATA = new DataSourceHandler(); $_DATA = new DataSourceHandler();
foreach($CONF['data_source'] as $elem) { //populate foreach($CONF['data_source'] as $elem) { //populate
@ -42,35 +44,7 @@
#MISSING: evaluate perk #MISSING: evaluate perk
} }
#WORKPAD:####
Trigger:
by value
(by event)
Sources:
XML
valuecache
(Achievement Service)
(Mirror Service)
VALUE dappers = c_money
if(dappers >= 5000) {
GRANT
}
VALUE tmp = c_fame[scorchers]
if(tmp == 0) {
DENY:3600
}
EVENT:player_death
ON player_death {
UNLOCK
}
#############

Binary file not shown.

Before

Width:  |  Height:  |  Size: 4.4 KiB

After

Width:  |  Height:  |  Size: 5.2 KiB

View file

@ -0,0 +1,162 @@
<?php
class Atom {
private $ruleset;
private $ruleset_parsed;
private $id;
private $objective;
function Atom(&$data) {
$this->ruleset = $data['atom_ruleset'];
$this->ruleset_parsed = false;
$this->id = $data['atom_id'];
$this->objective = $data['atom_objective'];
}
private function parseRuleset() {
#WORKPAD:####
/*
Trigger:
by value
(by event)
Sources:
XML
valuecache
ring_open
(Achievement Service)
(Mirror Service)
Keywords:
VALUE
GRANT:EVENT player_death
DENY:TIMER 3600
RESET
RESET_ALL
UNLOCK
UNLOCK_ALL
IF
SCRIPT
MSG
VALUE dappers = c_money
IF(dappers >= 5000) {
GRANT
}
VALUE tmp = c_fame[scorchers]
IF(tmp == 0) {
DENY:3600
}
VALUE x = c_pos_x
VALUE y = c_pos_y
SCRIPT inside(x,y) {
IF(MSG == "Majestic Garden") {
GRANT
}
}
EVENT player_death
ON player_death {
UNLOCK
}
EVENT region_changed
ON region_changed {
IF(MSG == "Majestic Garden") {
GRANT
}
}
*/
#############
VALUE var = name
IF(statement) {
}
SCRIPT script(a,r,g,s) {
MSG
}
EVENT name
ON name {
MSG
}
GRANT
GRANT:EVENT name
GRANT:TIMER seconds
DENY
DENY:EVENT name
DENY:TIMER seconds
RESET
RESET_ALL
UNLOCK
UNLOCK_ALL
}
function evalRuleset($user) {
global $DBc,$_DATA;
if($this->ruleset_parsed == false) {
$this->parseRuleset();
}
try {
return eval($this->ruleset_parsed);
}
catch(Exception $e) {
return $e->getMessage()
}
}
private function grant($user,$condition) {
global $DBc;
$DBc->sendSQL("INSERT INTO ach_player_atom (apa_atom,apa_player,apa_date,apa_expire,apa_state) VALUES ('".$this->id."','".$user."','".date()."','".$DBc->mre($condition)."','GRANT')","NONE");
}
private function deny($user,$condition) {
global $DBc;
$DBc->sendSQL("INSERT INTO ach_player_atom (apa_atom,apa_player,apa_date,apa_expire,apa_state) VALUES ('".$this->id."','".$user."','".date()."','".$DBc->mre($condition)."','DENY')","NONE");
}
private function reset_($user) {
global $DBc;
$DBc->sendSQL("DELETE FROM ach_player_atom WHERE apa_atom='".$this->id."' AND apa_player='".$user."'","NONE");
}
private function reset_all() {
}
private function unlock($user) {
global $DBc;
$DBc->sendSQL("DELETE FROM ach_player_atom WHERE apa_atom='".$this->id."' AND apa_player='".$user."' AND apa_state='DENY'","NONE");
}
private function unlock_all() {
}
function getID() {
return $this->id;
}
function getObjective() {
return $this->objective;
}
}
?>

Binary file not shown.

Before

Width:  |  Height:  |  Size: 22 KiB

After

Width:  |  Height:  |  Size: 26 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 185 KiB

After

Width:  |  Height:  |  Size: 188 KiB

View file

@ -0,0 +1,11 @@
<?php
interface Tieable {
function isTiedCult();
function isTiedCiv();
function getCurrentCiv();
function getCurrentCult();
}
?>