Jump to content

Sphinx²

Inactive Member
  • Posts

    22
  • Joined

  • Last visited

  • Feedback

    0%

Posts posted by Sphinx²

  1. Screenshot of my nVidia center:

    0450a-051055f7-4cff-42c7-9e1b-febe21672c

     

    Windows rating:

    0450a-6d1cf70a-eca6-4020-b380-cccfca92e0

    My SSD is not optimized to AHCI.

    Need to do that in the next few days.

     

    CPU-Z Report:

    0450a-63e5bff0-a0aa-422b-a157-5bdddd7480

     

    Details:

    - Asus Rampage IV Black Edition

    - Intel i7 4930K 3,4 GHZ

    - GeForce GTX Titan Black

    - 16 GB Kingston RAm 1666 (I'm not sure)

    - Corsair Platinum 1000W

    - 2 SSD 256 GB Ram

    - 3x 1 TB 7'200 RPM

     

    Kind Regards

    Sphinx

  2. M2 Download Center

    This is the hidden content, please
    ( Internal )

    Hey guys,

     

    I want to release my old DBManager.

    I wrote it for my current CMS.

     

    I recoded it and now I dont need the old one anymore.

     

    You can use multiple instances with setting the instance id to 2 or 3.

    <?php
    	/**
    	 * Author: Sphinx²
    	 * Descr: Database manager class
    	 */
    	 
    	 class dbmanager {
    		private $dbconnection = false;
    		private $connected;
    		private $logging;
    		static private $instance = array();
    		private $instancen_id;
    		private $host;
    		private $username;
    		private $password;
    		
    		private static $querys = 0;
    		private static $escapes = 0;
    		
    		/**
    		 * Set instance id for manage log files
    		 */
    		public function setInstanceID($instance_id) {
    			$this->instancen_id = $instance_id;
    		}
    		
    		/**
    		 * dbmanager singleton (with multi instance support for multiple connections over the db manager)
    		 */
    		public static function instance($instance_id=1)  {
    			if ( !isset(self::$instance[$instance_id]) ) {
    				self::$instance[$instance_id] = new self;
    			}
    			self::$instance[$instance_id]->setInstanceID($instance_id);
    			return self::$instance[$instance_id];
    		}
    		
    		/**
    		 * dbmanager check instance
    		 */
    		public static function instanceExists($instance_id=1)  {
    			if ( !isset(self::$instance[$instance_id]) ) {
    				return false;
    			} else {
    				return self::$instance[$instance_id]->connected();
    			}
    			return true;
    		}
    		
    		/**
    		 * Check if instance is connected
    		 */
    		public function connected() {
    			return $this->connected;	
    		}
    		
    		/**
    		 * Initialize the log file and other init shit
    		 */
    		public function init() {
    
    		}
    		
    		/**
    		 * Set connect details
    		 */
    		public function setConnection($host,$username,$password="") {
    			$this->host = $host;
    			$this->username = $username;
    			$this->password = $password;
    		}
    		
    		/**
    		 * mysql_connect
    		 */
    		public function connect() {
    			if(!$this->connected()) {
    				$this->dbconnection = @mysql_connect($this->host,$this->username,$this->password);
    				if($this->dbconnection) {
    					$this->connected = true;
    					return true;
    				} else {
    					$this->connected = false;
    					return false;
    				}
    			} else {
    				return $this->connected();	
    			}
    		}
    		
    		/**
    		 * mysql_query
    		 */
    		public function query($strquery) {
    			if(!$this->dbconnection) {
    				if(!$this->connect()) {
    					// Error reporting
    				}
    			}
    			if($this->dbconnection) {
    				self::$querys++;
    				$query = mysql_query($strquery,$this->dbconnection);
    				if($query) {
    					return $query;
    				} else {
    					return false;
    				}
    			} else {
    				return false;	
    			}
    		}
    		
    		/**
    		 * mysql_real_escape_string
    		 */	
    		public function escape($strescape) {
    			if(!$this->dbconnection) {
    				if(!$this->connect()) {
    					// Error reporting
    				}
    			}
    			
    			if($this->dbconnection) {
    				//$this->escapes++;
    				self::$escapes++;
    				return mysql_real_escape_string($strescape,$this->dbconnection);
    			} else {
    				die("DBManager: Failed to escape string (Connection lost)");	
    			}
    		}
    		
    		/**
    		 * mysql_fetch_object first row
    		 */	
    		public function fetcho($strquery) {
    			if(!$this->dbconnection) {
    				if(!$this->connect()) {
    					// Error reporting
    				}
    			}
    			
    			if($this->dbconnection) {
    				$query = mysql_query($strquery,$this->dbconnection);
    				if($query) {
    					$object = mysql_fetch_object($query);
    				} else {
    					$object = NULL;
    				}
    				return $object;
    			}
    			return NULL;
    		}
    		
    		/**
    		 * mysql_fetch_object
    		 */
    		public static function fetchobj($resource) {
    			return mysql_fetch_object($resource);	
    		}
    		
    		
    		/*
    		 * mysql_fetch_array
    		 */
    		public static function fetcharr($resource) {
    			return mysql_fetch_array($resource);	
    		}
    		
    		/**
    		 * mysql_num_row
    		 */
    		public static function num_rows($resource) {
    			return mysql_num_rows($resource);	
    		}
    		
    		public function insertID() {
    			return mysql_insert_id($this->dbconnection);	
    		}
    		
    		/**
    		 * mysql_fetch_assoc
    		 */	
    		public function fetcha($strquery) {
    			if(!$this->dbconnection) {
    				if(!$this->connect()) {
    					// Error reporting
    				}
    			}
    			
    			if($this->dbconnection) {
    				$query = mysql_query($strquery,$this->dbconnection);
    				if($query) {
    					$array = mysql_fetch_assoc($query);
    				} else {
    					$array = NULL;
    				}
    				return $array;
    			}
    			return NULL;
    		}
    		
    		/**
    		 * return query count
    		 */
    		public static function getQueryCount() {
    			return self::$querys;	
    		}
    		
    		/**
    		 * return escape count
    		 */
    		public static function getEscapeCount() {
    			return self::$escapes;	
    		}
    			
    		/**
    		 * shutdown
    		 */	
    		public function shutdown() {
    			if($this->dbconnection && $this->connected) {
    				$this->connected = false;
    				mysql_close($this->dbconnection);	
    			}
    		}
    	 }
    
    ?>

    Method 1:

    dbmanager::instance(1)->init();
    dbmanager::instance(1)->setConnection("127.0.0.1","root","password");
    
    if(dbmanager::instance(1)->connect()) {
          $ret = dbmanager::instance()->query("SELECT * FROM account 
                                               WHERE id = '".dbmanager::instance(1)->escape("some string or something else")."'");
          if($ret) {
           // Maybe fetch array or something else
           $arr = dbmanager::fetcharr($ret);
           echo $arr["login"]; 
           } else {
            // Some code here
           } 
    }
    
    dbmanager::instance(1)->shutdown(); // Kill connection

    Method 2 (Its not important to use the connect function if you dont use the escape function in your query:

    dbmanager::instance(1)->init();
    dbmanager::instance(1)->setConnection("127.0.0.1","root","password");
    
    $ret = dbmanager::instance()->query("SELECT * FROM account");
    if($ret) {
     // Maybe fetch array or something else
     $arr = dbmanager::fetcharr($ret);
     echo $arr["login"]; 
    } else {
      // Some code here
    } 
    
    
    dbmanager::instance(1)->shutdown(); // Kill connection

    The error reporting is not included.

    You can write your own reporting with logfiles or something else.

     

    This is based on the mysql php extension.

    To port it to mysqli is easy I think.

     

    Kind regards

    Sphinx

     

     

     

    • Metin2 Dev 8
    • Good 2
    • Love 2
  3. Not everyone can develop their own core and for those who can't I suggest using the Vanilla Core.

     

    No one how now how to work with the source will use this Vanilla Core.

    The reason for that is that the source code isn't available.

     

    Kind regards

    Sphinx

  4. Hello guys,

     

    right now I'm working on my base client and I have errors that I saw often.

    Now I just try to fix them but I can't find the reason for that stupid error.

     

    The error description:

    - Sometimes I have terrains(textures) or actually dds files that can not be loaded by the eterpack library.

     

     

    CEterPackManager::Get (Called from CResource::Load()) return false but the file is existing in the archive (for sure)

    #ifdef _DEBUG
    		if(!GetFromPack(rMappedFile, c_szFileName, pData)) {
    			Tracenf("CEterPackManager::Get: Failed to get file from pack %s.",c_szFileName);
    			if (GetFromFile(rMappedFile, c_szFileName, pData))
    			{
    				return true;
    			} else {
    				Tracenf("CEterPackManager::Get: Failed to get file from dir %s.",c_szFileName);
    				return false;
    			}
    			return false;
    		}
    #else
    		if (GetFromFile(rMappedFile, c_szFileName, pData))
    		{
    			return true;
    		}
    		return GetFromPack(rMappedFile, c_szFileName, pData);
    #endif

    Now I decided to change the file type to 0 (My friend xXDemonenXx had the idea).

    Then it works.

    Actually I search the reason for that but I can not find that.

     

    With type 2 the file not exists and the terrain is white but with type 0 it is still here.

    Does anyone of you guys had the same problem or have any idea whats the reason for that?

     

    Kind regards

    Sphinx

     

     

     

     

  5. Hi, good afternoon.

    This is a very nice script but I have a little problem with the cron part and I would like to know if you also happens and if you could solve.

     

    I put in the crontab this to test it

    * * * * * root sh /Cron/auto_back.sh all
    

    It do the auto_back.sh every min, but not dump the tables and not upload the files, it generates a empty empyfiles.gz, to test if the cron works I put in the script header

    echo "test" >> /log_auto
    

    And It works, every mins. insert test in the /log_auto.

     

    If I do manually it works.

     

    Does anyone know how can be solved?

     

    Kind regards.

     

    The same error I have with my auto vpn cron.

    I think there is a permission problem.

     

    btw: nice script

     

    Kind regards

    Sphinx

  6. for sure, for better protection, you can make some password protection for your game file with a little c++ codes.. ;)

     

    Why not use a license server?

    (But no one will use your compiled game core anymore... because the source is public).

     

     

    Kind regards

    Sphinx

  7. Guys this anti_exp ring is very very dangerous.

    When the player use the exp ring before a level up like 10.9k exp of 11k exp and he activate the exp ring.

    After a kill he gains the next level and the exp will be setted by the quest.

    After this he kills again a mob and have the (- exp + the next exp).

     

    You have to freeze the exp function of the character like this (not the full code):

    void CHARACTER::SetExp(DWORD exp)	{ 
    	if(!ExpDisabled()) {
    		m_points.exp = exp;	
    	}
    }
    

    Kind regards

    Sphinx

  8. Why you have this part in your code?

    if (!ch || ch->GetGMLevel() != GM_IMPLEMENTOR) // Again change here the rights
    {
        sys_log(0, "do_ban without rights %s[%d]", ch->GetName(), ch->GetPlayerID());
        return;
    }

    The command interpreter is already checking the permissions.

     

    Kind regards

    Sphinx

    • Love 4
  9. cool, I remember they had this in Metin2US before using the same color code system and it was removed because people didn't want to only use it to sell and buy items. I've been looking for this modification for such a long time.

     

    UndergroundMt2 used the same system but with python code.

    You can append the same color codes over python.

     

    @Topic: Not bad

    • Love 1
×
×
  • Create New...

Important Information

Terms of Use / Privacy Policy / Guidelines / We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.