OSDN Git Service

#17687 - Extract ability data.
authormumin <mumincacao@users.sourceforge.jp>
Sun, 26 Jul 2009 13:36:15 +0000 (22:36 +0900)
committermumin <mumincacao@users.sourceforge.jp>
Sun, 26 Jul 2009 13:36:15 +0000 (22:36 +0900)
documents/changes.en.txt
documents/changes.ja.txt
trust_path/modules/sd3rd/class/Enum.class.php
trust_path/modules/sd3rd/class/handler/Ability.class.php [new file with mode: 0644]
trust_path/modules/sd3rd/class/updater/dispose/Backup.class.php
trust_path/modules/sd3rd/class/updater/execute/parser/char/SAbility_Data.class.php [new file with mode: 0644]
trust_path/modules/sd3rd/class/updater/prepare/RefreshTable.class.php
trust_path/modules/sd3rd/class/updater/prepare/SetupContext.class.php [new file with mode: 0644]
trust_path/modules/sd3rd/sql/mysql.sql

index b5a3674..274be56 100644 (file)
@@ -1,3 +1,4 @@
+#17687 - Extract ability data.
 #17686 - Extract eno and name.
 #17958 - Append backup process.
 #17912 - Append update time data.
index 8e410b1..f46415c 100644 (file)
@@ -1,3 +1,4 @@
+#17687 - \82 \82Ñ\82Å\81`\82½\82Ì\92\8a\8fo\8f\88\97\9d\82ð\92Ç\89Á
 #17686 - Eno \82Æ\82Ó\82é\82Ë\81`\82Þ\82ð\92\8a\8fo\82·\82é\8f\88\97\9d\82ð\92Ç\89Á
 #17958 - \82Î\82Á\82­\82 \82Á\82Õ\8f\88\97\9d\92Ç\89Á
 #17912 - \8dX\90V\93ú\8aÇ\97\9d\82ð\92Ç\89Á
index 4f5d1f8..9856bec 100644 (file)
@@ -15,6 +15,7 @@ if(!defined('XOOPS_ROOT_PATH'))
 **/
 interface Sd3rd_HANDLER
 {
+    const ABILITY = 'Ability';
     const CHAR = 'Char';
     const UPDATE = 'Update';
 }
diff --git a/trust_path/modules/sd3rd/class/handler/Ability.class.php b/trust_path/modules/sd3rd/class/handler/Ability.class.php
new file mode 100644 (file)
index 0000000..24b735a
--- /dev/null
@@ -0,0 +1,61 @@
+<?php
+/**
+ * @file
+ * @package sd3rd
+ * @version $Id$
+**/
+
+if(!defined('XOOPS_ROOT_PATH'))
+{
+    exit;
+}
+
+/**
+ * Sd3rd_AbilityObject
+**/
+class Sd3rd_AbilityObject extends XoopsSimpleObject
+{
+    /**
+     * __construct
+     * 
+     * @param   void
+     * 
+     * @return  void
+    **/
+    public function __construct()
+    {
+        $this->initVar('ability_id', XOBJ_DTYPE_INT, '', false);
+        $this->initVar('ability_name', XOBJ_DTYPE_STRING, '', false, 50);
+        $this->initVar('description', XOBJ_DTYPE_STRING, '', false, 255);
+        $this->initVar('ability_cost', XOBJ_DTYPE_INT, '', false);
+        $this->initVar('can_upgrade', XOBJ_DTYPE_INT, '', false);
+        $this->initVar('upgrade', XOBJ_DTYPE_STRING, '', false, 255);
+        $this->initVar('register_time', XOBJ_DTYPE_INT, '', false);
+    }
+}
+
+/**
+ * Sd3rd_AbilityHandler
+**/
+class Sd3rd_AbilityHandler extends XoopsObjectGenericHandler
+{
+    public /*** string ***/ $mTable = '{dirname}_ability';
+    public /*** string ***/ $mPrimary = 'ability_id';
+    public /*** string ***/ $mClass = 'Sd3rd_AbilityObject';
+
+    /**
+     * __construct
+     * 
+     * @param   XoopsDatabase  &$db
+     * @param   string  $dirname
+     * 
+     * @return  void
+    **/
+    public function __construct(/*** XoopsDatabase ***/ &$db,/*** string ***/ $dirname)
+    {
+        $this->mTable = strtr($this->mTable,array('{dirname}' => $dirname));
+        parent::XoopsObjectGenericHandler($db);
+    }
+}
+
+?>
index 0c0f480..dd5d623 100644 (file)
@@ -207,7 +207,11 @@ class Sd3rd_BackupDispose extends Sd3rd_AbstractFilter
     **/
     public function executeLatest()
     {
-        $this->_mTableList = array(Sd3rd_HANDLER::CHAR,Sd3rd_HANDLER::UPDATE);
+        $this->_mTableList = array(
+            Sd3rd_HANDLER::ABILITY,
+            Sd3rd_HANDLER::CHAR,
+            Sd3rd_HANDLER::UPDATE
+        );
     }
 }
 
diff --git a/trust_path/modules/sd3rd/class/updater/execute/parser/char/SAbility_Data.class.php b/trust_path/modules/sd3rd/class/updater/execute/parser/char/SAbility_Data.class.php
new file mode 100644 (file)
index 0000000..dd756d8
--- /dev/null
@@ -0,0 +1,47 @@
+<?php
+/**
+ * @file
+ * @package sd3rd
+ * @version $Id$
+**/
+
+if(!defined('XOOPS_ROOT_PATH'))
+{
+    exit();
+}
+
+/**
+ * Extract process for Chardata at soul ability.
+**/
+class Sd3rd_SAbility_DataChar extends Sd3rd_AbstractParser
+{
+    /**
+     * Latest main process.
+     * 
+     * @param   void
+     * 
+     * @return  void
+    **/
+    public function executeLatest()
+    {
+        $data = Sd3rd_UpdateUtils::parseByRegex($this->_mSource,"/\('(?P<name>[^']+)','(?P<desc>[^']+)',(?P<ac>\d),(?P<flag>\d),'(?P<upgrade>[^']*)'\)/");
+        try
+        {
+            Sd3rd_Context::get(Sd3rd_HANDLER::ABILITY,$data['name']);
+        }
+        catch(Sd3rd_NotFoundException $ex)
+        {
+            $ability = Sd3rd_UpdateUtils::createObject(Sd3rd_HANDLER::ABILITY);
+            $ability->set('ability_name',$data['name']);
+            $ability->set('description',$data['desc']);
+            $ability->set('ability_cost',$data['ac']);
+            $ability->set('can_upgrade',(bool)$data['flag']);
+            $ability->set('upgrade',$data['upgrade']);
+            $ability->set('register_time',$this->_mUpdateTime);
+            Sd3rd_UpdateUtils::insertObject(Sd3rd_HANDLER::ABILITY,$ability);
+            Sd3rd_Context::set(Sd3rd_HANDLER::ABILITY,$data['name'],$ability->get('ability_id'));
+        }
+    }
+}
+
+?>
index 30c4eb2..91da25c 100644 (file)
@@ -75,9 +75,26 @@ class Sd3rd_RefreshTablePrepare extends Sd3rd_AbstractFilter
     **/
     public function executeLatest()
     {
+        $this->_mRegisterTableList = array(Sd3rd_HANDLER::ABILITY);
         $this->_mUpdateTableList = array(Sd3rd_HANDLER::UPDATE);
         $this->_mTruncateTableList = array(Sd3rd_HANDLER::CHAR);
     }
+    
+    /**
+     * First main process.
+     * 
+     * @param   void
+     * 
+     * @return  void
+    **/
+    public function execute090527()
+    {
+        $this->_mTruncateTableList = array(
+            Sd3rd_HANDLER::ABILITY,
+            Sd3rd_HANDLER::CHAR,
+            Sd3rd_HANDLER::UPDATE
+        );
+    }
 }
 
 ?>
diff --git a/trust_path/modules/sd3rd/class/updater/prepare/SetupContext.class.php b/trust_path/modules/sd3rd/class/updater/prepare/SetupContext.class.php
new file mode 100644 (file)
index 0000000..d13eb00
--- /dev/null
@@ -0,0 +1,60 @@
+<?php
+/**
+ * @file
+ * @package sd3rd
+ * @version $Id$
+**/
+
+if(!defined('XOOPS_ROOT_PATH'))
+{
+    exit();
+}
+
+/**
+ * Setup context at master data.
+**/
+class Sd3rd_SetupContextPrepare extends Sd3rd_AbstractFilter
+{
+    /**
+     * Get process priority
+     * 
+     * @param   void
+     * 
+     * @return  Enum
+    **/
+    public function getPriority()
+    {
+        return XCUBE_DELEGATE_PRIORITY_FINAL;
+    }
+    
+    /**
+     * Latest main process.
+     * 
+     * @param   void
+     * 
+     * @return  void
+    **/
+    public function executeLatest()
+    {
+        $this->_setupMaster(Sd3rd_HANDLER::ABILITY,'ability_name','ability_id');
+    }
+    
+    /**
+     * Setup master data.
+     * 
+     * @param   Enum    $type
+     * @param   string  $key
+     * @param   string  $value
+     * 
+     * @return  void
+    **/
+    protected function _setupMaster(/*** Enum ***/ $type,/*** string ***/ $key,/*** string ***/ $value)
+    {
+        foreach(Sd3rd_UpdateUtils::getHandler($type)->getObjects() as $obj)
+        {
+            Sd3rd_Context::set($type,$obj->get($key),$obj->get($value));
+        }
+    }
+}
+
+?>
index 1b6ae8c..773c0b7 100644 (file)
@@ -1,3 +1,15 @@
+CREATE TABLE `{dirname}_{prefix}_ability` (
+  `ability_id` smallint(5) unsigned NOT NULL auto_increment,
+  `ability_name` varchar(50) NOT NULL,
+  `description` varchar(255) NOT NULL,
+  `ability_cost` tinyint(4) NOT NULL,
+  `can_upgrade` tinyint(3) unsigned NOT NULL,
+  `upgrade` varchar(255) NOT NULL,
+  `register_time` int(10) unsigned NOT NULL,
+  PRIMARY KEY  (`ability_id`),
+  UNIQUE KEY `ability_name` (`ability_name`)
+) ENGINE=MyISAM;
+
 CREATE TABLE `{dirname}_{prefix}_char` (
   `eno` smallint(5) unsigned NOT NULL,
   `full_name` varchar(255) NOT NULL,