diff --git a/code/web/app/app_achievements/_AchWebParser/AchWebParser.php b/code/web/app/app_achievements/_AchWebParser/AchWebParser.php index 3e2cae8df..84ec7273c 100644 --- a/code/web/app/app_achievements/_AchWebParser/AchWebParser.php +++ b/code/web/app/app_achievements/_AchWebParser/AchWebParser.php @@ -20,6 +20,8 @@ require_once("class/DataSourceHandler_class.php"); require_once("class/DataSource_abstract.php"); + require_once("class/Atom_class.php"); + //create datasource handler $_DATA = new DataSourceHandler(); foreach($CONF['data_source'] as $elem) { //populate @@ -42,35 +44,7 @@ #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 - } - - ############# diff --git a/code/web/app/app_achievements/_AchWebParser/_doc/Class_scheme.dia b/code/web/app/app_achievements/_AchWebParser/_doc/Class_scheme.dia index aa0d65c93..b620e6af4 100644 Binary files a/code/web/app/app_achievements/_AchWebParser/_doc/Class_scheme.dia and b/code/web/app/app_achievements/_AchWebParser/_doc/Class_scheme.dia differ diff --git a/code/web/app/app_achievements/_AchWebParser/_doc/Class_scheme.png b/code/web/app/app_achievements/_AchWebParser/_doc/Class_scheme.png index 98722b96e..30f5e89af 100644 Binary files a/code/web/app/app_achievements/_AchWebParser/_doc/Class_scheme.png and b/code/web/app/app_achievements/_AchWebParser/_doc/Class_scheme.png differ diff --git a/code/web/app/app_achievements/_AchWebParser/class/Atom_class.php b/code/web/app/app_achievements/_AchWebParser/class/Atom_class.php new file mode 100644 index 000000000..435eac302 --- /dev/null +++ b/code/web/app/app_achievements/_AchWebParser/class/Atom_class.php @@ -0,0 +1,162 @@ +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; + } + } +?> \ No newline at end of file diff --git a/code/web/app/app_achievements/_doc/Class_scheme.dia b/code/web/app/app_achievements/_doc/Class_scheme.dia index 31768b998..fdcd0f32f 100644 Binary files a/code/web/app/app_achievements/_doc/Class_scheme.dia and b/code/web/app/app_achievements/_doc/Class_scheme.dia differ diff --git a/code/web/app/app_achievements/_doc/Class_scheme.png b/code/web/app/app_achievements/_doc/Class_scheme.png index 93d9d08c0..99886f635 100644 Binary files a/code/web/app/app_achievements/_doc/Class_scheme.png and b/code/web/app/app_achievements/_doc/Class_scheme.png differ diff --git a/code/web/app/app_achievements/_doc/ER_scheme.dia b/code/web/app/app_achievements/_doc/ER_scheme.dia index 346035702..f104fbfa8 100644 Binary files a/code/web/app/app_achievements/_doc/ER_scheme.dia and b/code/web/app/app_achievements/_doc/ER_scheme.dia differ diff --git a/code/web/app/app_achievements/_doc/ER_scheme.png b/code/web/app/app_achievements/_doc/ER_scheme.png index 1281febfb..c1e7f5e59 100644 Binary files a/code/web/app/app_achievements/_doc/ER_scheme.png and b/code/web/app/app_achievements/_doc/ER_scheme.png differ diff --git a/code/web/app/app_achievements/class/Tieable_inter.php b/code/web/app/app_achievements/class/Tieable_inter.php new file mode 100644 index 000000000..ce472e055 --- /dev/null +++ b/code/web/app/app_achievements/class/Tieable_inter.php @@ -0,0 +1,11 @@ + \ No newline at end of file