Jump to content
FapFap

ItemInfo Cache

Recommended Posts

I'm using this ItemInfo Cache function and it works fine, but can someone tell me how to make it work on item mall the same way it looks on screenshot from EXAMPLE
345.png.c6f71f84c847acd0f8fa102c11aef1d4.png

it doesn't make a new iteminfo as cache, it loads the original iteminfo.txt

 

Edited by FapFap

Share this post


Link to post
Share on other sites

Hello, @FapFap!

 

What is the ItemInfo Cache function? Show us its code

 

 


Share this post


Link to post
Share on other sites
22 hours ago, FapFap said:

I'm using this ItemInfo Cache function and it works fine, but can someone tell me how to make it work on item mall the same way it looks on screenshot from EXAMPLE
345.png.c6f71f84c847acd0f8fa102c11aef1d4.png

it doesn't make a new iteminfo as cache, it loads the original iteminfo.txt

 

Go ur website and look if this works? 

WebsiteAdress/Itemhint/ID

ID = any item is number. 

I mean do you trying to get tooltips for items? 

Edited by Onioni

Download: Nightmare Demonic Helm

Dimension Pirates Online files: get now

New map Project: Flag PK

Black Skin 3.1.3 for pko 1: Get now

Share this post


Link to post
Share on other sites
3 hours ago, Onioni said:

Go ur website and look if this works? 

WebsiteAdress/Itemhint/ID

ID = any item is number. 

I mean do you trying to get tooltips for items? 

Hi, This iteminfo cache function works fine with my iteminfo.txt from the Example file which shows my whole iteminfo.txt and I can hover & see details of the item, but what i'm asking here is how to make it work with Item Mall, so I can view stats of weapons on item mall before I buy it, I hope im clear

Share this post


Link to post
Share on other sites
1 hour ago, FapFap said:

Hi, This iteminfo cache function works fine with my iteminfo.txt from the Example file which shows my whole iteminfo.txt and I can hover & see details of the item, but what i'm asking here is how to make it work with Item Mall, so I can view stats of weapons on item mall before I buy it, I hope im clear

Something like this..

'<tr height="50px"><td style="text-align:center;" width="10%"><img src="../images/icons2/'.$ItemIcon.'.png"></td><td width="33%" style="text-align:center;font-size:15px;"><b><a class="tips" rel="index.php?act=itemhint&id='.$PlsCorrectThisID.'" title style>'

 

IDont know what your website correct way call item Id so I added PlsCorrectThisID

Also check that iteminfocache.Php is enabled and that all is right

Edited by Onioni

Download: Nightmare Demonic Helm

Dimension Pirates Online files: get now

New map Project: Flag PK

Black Skin 3.1.3 for pko 1: Get now

Share this post


Link to post
Share on other sites

@Onioni Check my ItemMall & ItemInfoCache, i can't make it work idk why isn't working..
I got ItemInfoCache Folder inside htdocs, and inside ItemInfoCache Folder theres:
- config.php

<?php

	/* ----------------------------------------
		CONFIGURATION
	---------------------------------------- */
	
	// Location of the itemInfo.txt file
	define('IIC_BASE_FILE', 'C:\\Zend\\Apache2\\htdocs\\ItemInfoCache\\iteminfo.txt');
	
	// URL of the root folder containing this script
	// DO NOT USE LOCALHOST !!!
	define('IIC_BASE_URL', 'http://58.126.35.54//ItemInfoCache/');
	
	// Define if data caching is enabled or not.
	define('IIC_ENABLE_CACHING', false);
	
	// Define if Item Hint caching is enabled or not.
	define('IIC_ENABLE_ITEM_HINT_CACHING', false);
	
	// Define if cache is stable
	// source file not changing and cache does not need to verify source data
	// turning to true improve performances but will create inconsistencies
	define('IIC_STABLE_CACHE', false);
	
	// Location of the cache file on disk
	define('IIC_CACHE_ROOT', sys_get_temp_dir());
	define('IIC_CACHE_TARGET', 'ItemInfoCache.data');
	define('IIC_CACHE_ITEM_HINT_FOLDER', 'IIC_ITEMS\\');
	define('IIC_CACHE_FILE', IIC_CACHE_ROOT.IIC_CACHE_TARGET);
	define('IIC_CACHE_FOLDER', IIC_CACHE_ROOT.IIC_CACHE_ITEM_HINT_FOLDER);
	
?>


- ItemHint.php

<?php

	
	/* ***********************************
	This page creates Item tooltips.
	*********************************** */

	// Include key file
	require_once(dirname(__FILE__).'/ItemInfoCache.php');
	
	// Retrieve Item ID
	$itemId = 0;
	if (isset($_GET['id'])) 
	{
		$itemId = $_GET['id'];
	} else if (isset($_POST['id'])) 
	{
		$itemId = $_POST['id'];
	}
	
	// Retrieve the item hint from cash store.
	echo ItemInfoStore::GetItemHint($itemId);
	
?>


- ItemHint.template.php

<div class="itemHolder">
	<div class="heading">
		<div class="name">
			<?php echo $item->name ?>
		</div>
		<div class="type">
			<?php echo $item->GetType() ?>
		</div>
	</div>
	<div class="description">
		<?php echo $item->description ?>
	</div>

	<?php
	// This part is displayed for equipments only !
	if ($item->IsEquipment())	
	{
	?>
	<div class="requirement">
		<div class="levelReq">
			<div class="reqType">
				Level
			</div>
			<div class="reqValue">
				<?php echo $item->levelRequirement; ?>
			</div>
		</div>
		<div class="raceReq">
			<div class="reqType">
				Race
			</div>
			<div class="reqValue">
				<?php echo $item->GetRaceRequirement(); ?>
			</div>
		</div>
		<div class="classReq">
			<div class="reqType">
				Class
			</div>
			<div class="reqValue">
				<?php echo $item->GetClassRequirement(); ?>
			</div>		
		</div>
	</div>
	<div class="bonusList">
		<?php if ($item->PHYSICAL_RESISTANCE) { ?>
		<div class="bonus">
			<div class="bonusType">Physical Resistance</div>
			<div class="bonusValue">+<?php echo $item->PHYSICAL_RESISTANCE ?></div>
		</div>
		<?php } ?>
		<?php if ($item->MIN_ATTACK || $item->MAX_ATTACK)  { ?>
		<div class="bonus">
			<div class="bonusType">Base Damage</div>
			<div class="bonusValue"><?php echo $item->MIN_ATTACK ?> / <?php echo $item->MAX_ATTACK ?></div>
		</div>
		<?php } ?>
		<?php if ($item->DEFENSE) { ?>
		<div class="bonus">
			<div class="bonusType">Defense</div>
			<div class="bonusValue">+<?php echo $item->DEFENSE ?></div>
		</div>
		<?php } ?>
		<br/>
		<?php if ($item->STR_BONUS) { ?>
		<div class="bonus">
			<div class="bonusType">Strenght</div>
			<div class="bonusValue">+<?php echo $item->STR_BONUS ?></div>
		</div>
		<?php } ?>
		<?php if ($item->CON_BONUS) { ?>
		<div class="bonus">
			<div class="bonusType">Constitution</div>
			<div class="bonusValue">+<?php echo $item->CON_BONUS ?></div>
		</div>
		<?php } ?>
		<?php if ($item->ACC_BONUS) { ?>
		<div class="bonus">
			<div class="bonusType">Accurency</div>
			<div class="bonusValue">+<?php echo $item->ACC_BONUS ?></div>
		</div>
		<?php } ?>
		<?php if ($item->SPR_BONUS) { ?>
		<div class="bonus">
			<div class="bonusType">Spirit</div>
			<div class="bonusValue">+<?php echo $item->SPR_BONUS ?></div>
		</div>
		<?php } ?>
		<?php if ($item->AGI_BONUS) { ?>
		<div class="bonus">
			<div class="bonusType">Agility</div>
			<div class="bonusValue">+<?php echo $item->AGI_BONUS ?></div>
		</div>
		<?php } ?>
		<br/>
		<?php if ($item->MAX_HP) { ?>
		<div class="bonus">
			<div class="bonusType">Max HP</div>
			<div class="bonusValue">+<?php echo $item->MAX_HP ?></div>
		</div>
		<?php } ?>
		<?php if ($item->HP_RECOVERY) { ?>
		<div class="bonus">
			<div class="bonusType">HP Recovery</div>
			<div class="bonusValue">+<?php echo $item->HP_RECOVERY ?></div>
		</div>
		<?php } ?>
		<?php if ($item->MAX_SP) { ?>
		<div class="bonus">
			<div class="bonusType">Max SP</div>
			<div class="bonusValue">+<?php echo $item->MAX_SP ?></div>
		</div>
		<?php } ?>
		<?php if ($item->SP_RECOVERY) { ?>
		<div class="bonus">
			<div class="bonusType">SP Recovery</div>
			<div class="bonusValue">+<?php echo $item->SP_RECOVERY ?></div>
		</div>
		<?php } ?>
		<?php if ($item->DODGE) { ?>
		<div class="bonus">
			<div class="bonusType">Dodge</div>
			<div class="bonusValue">+<?php echo $item->DODGE ?></div>
		</div>
		<?php } ?>
		<?php if ($item->HIT_RATE) { ?>
		<div class="bonus">
			<div class="bonusType">Hit Rate</div>
			<div class="bonusValue">+<?php echo $item->HIT_RATE ?></div>
		</div>
		<?php } ?>
		<?php if ($item->CRITICAL_RATE) { ?>
		<div class="bonus">
			<div class="bonusType">Critical Rate</div>
			<div class="bonusValue">+<?php echo $item->CRITICAL_RATE ?></div>
		</div>
		<?php } ?>
		<?php if ($item->MOVEMENT_SPEED) { ?>
		<div class="bonus">
			<div class="bonusType">Movement Speed</div>
			<div class="bonusValue">+<?php echo $item->MOVEMENT_SPEED ?></div>
		</div>
		<?php } ?>
	</div>
	<?php
	}
	?>
	
	<div class="price">
		<?php echo number_format($item->price, 0, ',', '.'); ?> gold
	</div>
</div>


- ItemInfoCache.php

<?php

	require_once(dirname(__FILE__).'/config.php');
	
	/* ----------------------------------------
		CLASSES
	---------------------------------------- */
	
	class ItemInfo
	{
		// Attributes for all items
		var $id;
		var $icon;
		var $name;
		var $description;
		var $type;
		var $durability;
		var $maxStack;
		var $price;		
		
		// Attributes for equipments
		var $levelRequirement;
		var $raceRequirement;
		var $classRequirement;
		var $STR_BONUS = 0;
		var $CON_BONUS = 0;
		var $ACC_BONUS = 0;
		var $SPR_BONUS = 0;
		var $AGI_BONUS = 0;
		var $MAX_HP = 0;
		var $MAX_SP = 0;
		var $DEFENSE = 0;
		var $MIN_ATTACK = 0;
		var $MAX_ATTACK = 0;
		var $DODGE = 0;
		var $HIT_RATE = 0;
		var $CRITICAL_RATE = 0;
		var $HP_RECOVERY = 0;
		var $SP_RECOVERY = 0;
		var $MOVEMENT_SPEED = 0;
		var $PHYSICAL_RESISTANCE = 0;
	
		// Static data maps
		public static $TYPE_NAMES = array (
			1 => 'Sword',
			2 => 'Greatsword',
			3 => 'Bow',
			4 => 'Gun',
			7 => 'Dagger',
			9 => 'Staff',
			11 => 'Shield',
			20 => 'Cap',
			22 => 'Armor',
			23 => 'Gloves',
			24 => 'Shoes',
			25 => 'Necklace',
			26 => 'Ring',
			27 => 'Tattoo',
			29 => 'Coral'
		);			
		
		public static $RACE_NAMES = array (
			1 => 'Lance',
			2 => 'Carsise',
			3 => 'Phyllis',
			4 => 'Ami'
		);

		public static $CLASS_NAMES = array (
			0 => 'Newbie',
			1 => 'Swordsman',
			2 => 'Hunter',
			//3 => 'Sailor',
			4 => 'Explorer',
			5 => 'Herbalist',
			//6 => 'Artisan',
			//7 => 'Merchant',
			8 => 'Champion',
			9 => 'Crusader',
			//10 => 'White Knight',
			//11 => 'Animal Tamer',
			12 => 'Sharpshooter',
			13 => 'Cleric',
			14 => 'Seal Master',
			//15 => 'Captain',
			16 => 'Voyager',
			//17 => 'Upstart',
			//18 => 'Engineer'
		);
		
		private static $EQUIPMENT_TYPES = array (
			1,2,3,4,7,9,11,20,22,23,24,25,26,27,29
		);
		
		// Accessors to formatted data
		function GetType() {
			if (isset(ItemInfo::$TYPE_NAMES[$this->type])) 
			{
				return ItemInfo::$TYPE_NAMES[$this->type];
			} else {
				return 'Miscellaneous';
			}
		}
		
		function GetRaceRequirement() {
			if (count($this->raceRequirement) == 0)
			{
				return 'All';
			} else {
				$raceReq = array();
				foreach ($this->raceRequirement as $raceId) 
				{
					$raceReq[] = ItemInfo::$RACE_NAMES[$raceId];
				}
				return implode(', ', $raceReq);
			}
		}
		
		function GetClassRequirement() {
			if (count($this->classRequirement) == 0)
			{
				return 'All';
			} else {
				$classReq = array();
				foreach ($this->classRequirement as $classId) 
				{
					$classReq[] = ItemInfo::$CLASS_NAMES[$classId];
				}
				return implode(', ', $classReq);
			}
		}
		
		function IsEquipment()
		{
			if (in_array($this->type, ItemInfo::$EQUIPMENT_TYPES))
			{
				return true;
			} else {
				return false;
			}
		}
	}
	
	class ItemInfoStore
	{
		// Global Variable holding the in-memory data store
		public	static $IIC_STORE = null;
		public	static $IIC_STORE_EXTRACT_DATE = null;
		public	static $IIC_ITEM_COUNT = 0;
		
		public function __construct()
		{
			die('IICStore is a static class, please do not instanciate!');
		}
		
		function GetItemInfo($itemId)
		{		
			// if data store was never loaded, load it
			if (ItemInfoStore::$IIC_STORE == null) {
				ItemInfoStore::LoadIICStore();
			}
			// return the item definition
			if (isset(ItemInfoStore::$IIC_STORE[$itemId]))
			{
				return ItemInfoStore::$IIC_STORE[$itemId];
			} 
			else 
			{
				return null;
			}
		}
		
		public static function LoadIICStore()
		{
			if (!IIC_ENABLE_CACHING) {
				// Cache is disabled, extract data directly from base file
				ItemInfoStore::LoadIICStoreFromSource();
			} else {				
				if (!file_exists(IIC_CACHE_FILE)) 
				{
					// Cache file does not exists, load from source
					ItemInfoStore::LoadIICStoreFromSource();
				} else {
					if (IIC_STABLE_CACHE)
					{
						// Cache is always considered as synchronized if it exists.
						// Load from cache without further testing.
						ItemInfoStore::LoadIICStoreFromCache();
					} else {
						$sourceModificationDate = filemtime(IIC_BASE_FILE);
						$cacheModificationDate =  filemtime(IIC_CACHE_FILE);
						if ($cacheModificationDate < $sourceModificationDate) 
						{
							// Cache is older than source, reload it
							ItemInfoStore::LoadIICStoreFromSource();
						} else {
							// Source was not modified since cache was generated. Load from cache
							ItemInfoStore::LoadIICStoreFromCache();
						}
					}
				}
			}
		}
		
		private static function LoadIICStoreFromCache()
		{
			$data = file_get_contents(IIC_CACHE_FILE);
			$data = unserialize($data);
			ItemInfoStore::$IIC_STORE_EXTRACT_DATE = $data[0];
			ItemInfoStore::$IIC_ITEM_COUNT = $data[1];
			ItemInfoStore::$IIC_STORE = $data[2];
		}
		
		private static function DumpIICStoreToCache()
		{
			$fd = fopen(IIC_CACHE_FILE, 'w+');
			$data = array(
				ItemInfoStore::$IIC_STORE_EXTRACT_DATE,
				ItemInfoStore::$IIC_ITEM_COUNT,
				ItemInfoStore::$IIC_STORE
			);
			fwrite($fd, serialize($data));
			fclose($fd);
		}
		
		private static function LoadIICStoreFromSource()
		{
			$sourceFileHandler = fopen(IIC_BASE_FILE, 'r');
			while ($line = fgets($sourceFileHandler)) {
				
				// Strip comments
				$line =  preg_replace('/\/\/.*$/', '', $line);
				$line =  trim($line);
				if ($line != '') {
					$item = ItemInfoStore::GetItemFromDataLine($line);
					if ($item != null) 
					{
						ItemInfoStore::$IIC_STORE[$item->id] = $item;
						unset($item);
					}
				}
			}
			fclose($sourceFileHandler);
			ItemInfoStore::$IIC_ITEM_COUNT = count(ItemInfoStore::$IIC_STORE);
			ItemInfoStore::$IIC_STORE_EXTRACT_DATE = date('l jS \of F Y h:i:s A');
			if (IIC_ENABLE_CACHING) {
				ItemInfoStore::DumpIICStoreToCache();
			}
			
			// Clear any existing item cache
			rrmdir(IIC_CACHE_FOLDER);
		}
		
		private static function GetItemFromDataLine($line)
		{
			$lineData = explode("\t", $line);
			if (count ($lineData) < 94  )
			{	
				return null;
			}
			$item = new ItemInfo();
			$item->id 	= $lineData[0];
			$item->name = $lineData[1];
			$item->icon = $lineData[2];
			$item->type = $lineData[10];
			
			// description
			$item->description = '';
			$lineData[93] = trim($lineData[93]);
			if ($lineData[93] != '' && $lineData[93] != '0') 
			{
				$item->description .= $lineData[93]; 
			}
			if ($lineData[94] != '' && $lineData[94] != '0') 
			{
				if ($item->description != '') 
					$item->description .= '<br />';
				$item->description .= $lineData[94]; 
			}
			
			// Dura
			$durability = $lineData[76];
			$durability = split (',', $durability);
			$item->durability = $durability[0];
			
			$item->maxStack = $lineData[20];
			$item->price = $lineData[22];
			
			// Bonus - We read those only for "Equipments" items
			if ($item->IsEquipment()) 
			{
				$item->levelRequirement = $lineData[24];
				
				// Race Requirement
				$item->raceRequirement = array();
				$raceReq = $lineData[23];
				$raceReq = explode(',', $raceReq);
				foreach ($raceReq as $race) 
				{
					if (isset($race, ItemInfo::$RACE_NAMES[$race]))
					{
						$item->raceRequirement[]=$race;
					}
				}
				
				// Class Requirement
				$item->classRequirement = array();
				$classReq = $lineData[25];
				$classReq = explode(',', $classReq);
				foreach ($classReq as $class) 
				{
					if (isset($class, ItemInfo::$CLASS_NAMES[$class]))
					{
						$item->classRequirement[]=$class;
					}
				}
				
				
				$item->STR_BONUS = getStatBonus($lineData[52]);
				$item->CON_BONUS = getStatBonus($lineData[55]);
				$item->ACC_BONUS = getStatBonus($lineData[54]);
				$item->AGI_BONUS = getStatBonus($lineData[53]);
				$item->SPR_BONUS = getStatBonus($lineData[56]);
				
				$item->MIN_ATTACK = getStatBonus($lineData[60]);
				$item->MAX_ATTACK = getStatBonus($lineData[61]);
				$item->DEFENSE = getStatBonus($lineData[62]);

				$item->MAX_HP = getStatBonus($lineData[63]);
				$item->MAX_SP = getStatBonus($lineData[64]);
				$item->DODGE = getStatBonus($lineData[65]);
				$item->HIT_RATE = getStatBonus($lineData[66]);
				$item->CRITICAL_RATE = getStatBonus($lineData[67]);
				
				$item->PHYSICAL_RESISTANCE = getStatBonus($lineData[73]);
				
				$item->HP_RECOVERY = getStatBonus($lineData[69]);
				$item->SP_RECOVERY = getStatBonus($lineData[70]);
				
				$item->MOVEMENT_SPEED = getStatBonus($lineData[71]);
				
			}
			
			return $item;
		}
		
		function GetItemHintCacheFile($itemId) 
		{
			if (!is_dir(IIC_CACHE_FOLDER)) {
				mkdir(IIC_CACHE_FOLDER, 0755);
			}
			return IIC_CACHE_FOLDER.'Item_'.$itemId.'.htm';
		}
		
		function GetItemHint($itemId) 
		{	
			// Load from cache if cache is enabled and available.
			if (IIC_ENABLE_ITEM_HINT_CACHING)
			{
				$cacheFile = ItemInfoStore::GetItemHintCacheFile($itemId);
				if (file_exists($cacheFile)) {
					return file_get_contents($cacheFile);
				}
			}
			
			// Generate expected page data
			$item = ItemInfoStore::GetItemInfo($itemId);
			ob_start();
			include(dirname(__FILE__).'/ItemHint.template.php');
			$content = ob_get_clean();
			
			// If cache is enabled, cache the content
			if (IIC_ENABLE_ITEM_HINT_CACHING)
			{
				$fd = fopen(ItemInfoStore::GetItemHintCacheFile($itemId), 'w+');
				fwrite($fd, $content);
				fclose($fd);
			}
				
			// Send the result.
			return $content;
		}
		
		function GetItemHintHttpHeader() 
		{
			$header = '<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.4/jquery.min.js" type="text/javascript"></script>';
			$header.= '<script src="'.IIC_BASE_URL.'js/jquery.cluetip.js" type="text/javascript"></script>';
			$header.= '<script type="text/javascript">';
			$header.= 	'$(document).ready(function() {';
			$header.= 		'$("a.tips").cluetip({';
			$header.= 			'width:            350,';	
			$header.= 			'showTitle:        false,';
			$header.= 			'dropShadow:       false,';
			$header.= 			'cluetipClass:	  \'item\',';
			$header.= 			'sticky:           false';
			$header.= 		'});';
			$header.= 	'});';
			$header.= '</script>';
			$header.= '<link rel="stylesheet" href="'.IIC_BASE_URL.'css/itemHint.css" type="text/css" />';
			
			return $header;
		}
		
		function GetItemTooltip($itemId, $hoverText)
		{
			$content = '<a class="tips" href="#" rel="'.IIC_BASE_URL.'ItemHint.php?id='.$itemId.'">'.$hoverText.'</a>';
			return $content;
		}
	}
	
	/* ----------------------------------------
		TOOLS FUNCTIONS
	---------------------------------------- */
	
	function getStatBonus($value)
	{
		$value = trim($value);
		if (preg_match('/^[0-9]+$/', $value)) 
		{
			return $value;
		} else if (preg_match('/^([0-9]+),([0-9]+)$/', $value, $matches)) {
			$value1 = $matches[1];
			$value2 = $matches[2];
			if (($value1 == $value2) || ($value2 == 0))
				return $value1;
			else
				return $value1.'-'.$value2;
		} else {
			return 0;
		}
	}
	
	function rrmdir($dir) 
	{ 
	   if (is_dir($dir)) { 
		 $objects = scandir($dir); 
		 foreach ($objects as $object) { 
		   if ($object != "." && $object != "..") { 
			 if (filetype($dir."/".$object) == "dir") rrmdir($dir."/".$object); else unlink($dir."/".$object); 
		   } 
		 } 
		 reset($objects); 
		 rmdir($dir); 
	   } 
	} 

?>

And ItemInfo.txt is also in ItemInfoCache Folder

Here is my addon/class.ItemMall.php

<?php

	define ('IconFolder' , './img/icons');
	define ('ButtonFolder' , './img');
	
class ItemMall
	{
		protected $Action;
		protected $Typo;
		
		public function __construct($Action, $Typo)
			{
					if ((!isset($_GET[$Action])) && (!isset($_POST[$Action]))) 
						$this->Action		= 'pet'; 
					else 
						$this->Action		= ((isset($_POST[$Action])) ? $_POST[$Action] : $_GET[$Action]);
						$this->Action		= strtolower(trim(preg_replace('/[^0-9a-z]/i','',$this->Action)));
						
					$this->MallTable = 'ItemMall';
					$this->cType = $Typo;
			}
			
		public function AssignMall($Category)
			{
				$GetItems = doQuery("SELECT * FROM $this->MallTable WHERE category='$Category' AND cType = '$this->cType'", DATABASE_AUCTION);
					$ItemsNum = mssql_num_rows($GetItems);
					
						if($ItemsNum < 1)	
							{
								return '<br /><br /><center>No Items found!</center>';
							}
						else
							{
								$ItemMall = '';
								//$ItemMall = '<table width="100%" border="0">';
							
									while($oRow = mssql_fetch_array($GetItems))
										{
											$ItemName 	= trim($oRow['ItemName']);
											$ItemPrice 	= trim($oRow['ItemPrice']);
											$ItemDesc 	= trim($oRow['ItemDesc']);
											$Quota 		= trim($oRow['Quota']);
											$ItemID 	= trim($oRow['ItemID']);
											$MallID 	= trim($oRow['MallID']);
											$ItemIcon	= trim($oRow['Icon']);
											$qty		= trim($oRow['quantity']);
											
											if($Quota == -1)	$Remaining = '<b>Unlimited</b>';
											elseif($Quota > 0)	$Remaining = '<b>'.$Quota.'</b>';
											else				$Remaining = '<b>Exhausted</b>';
											
											$ItemMall.= '<div class="it11">';
											
											$ItemMall.= '<a shape="header=['.$qty.'x '.$ItemName.'] body=[<div align=left style=padding:3px><p>Quota: '.$Remaining.'</p><hr /><p>'.$ItemDesc.'</p></div>]" title="Click me" class="tips">';
											$ItemMall.= '<div class="it12"><img src="'.IconFolder.'/'.$ItemIcon.'.png" alt="'.IconFolder.'/'.$ItemIcon.'.png" />';
											$ItemMall.= '<p class="it12text">'.$qty.'x '.$ItemName.'</p></div></a>';
											$ItemMall.= '<div class="pricetag">'.$ItemPrice.' <span>Points</span></div>';
											$ItemMall.= '<div class="pbuyitem"><a href="home.php?act=mall&buy='.$MallID.'">BUY</a></div></div>';	
											//$ItemMall.= '<tr height="50px"><td style="text-align:center;" width="10%"><img src="'.IconFolder.'/'.$ItemIcon.'.png"></td><td width="33%" style="text-align:center;font-size:15px;"><b>'.$qty.'x '.$ItemName.'</b></td>';
											//$ItemMall.= '<td style="text-align:center;" width="15%">Price: <b>'.$ItemPrice.'</b></td><td style="text-align:center;"><a shape="header=['.$qty.'x '.$ItemName.'] body=[<div align=left style=padding:3px><p>'.$ItemDesc.'</p></div>]" title="Click me" />Details <br /><small style="font-size:5px;">[Click Me]</small></a></td>';
											//$ItemMall.= '<td style="text-align:center;" width="15%">Quota:<br /> '.$Remaining.'</td><td style="text-align:center;"><a href="home.php?act=mall&buy='.$MallID.'"><img src="'.ButtonFolder.'/btn_mall_buy.png" style="width:82px; height:26px;" /></a></td></tr>';
	
										}
									$ItemMall.= '<div class="clearfix"></div>';
									//$ItemMall.= '</table>';
									
								return $ItemMall;
							}
				
			}
			
		public function StartMall()
			{
				switch($this->Action)
					{
						case 'pet':
						case 'forging':
						case 'miscelaneous':
						case 'decoration':
						case 'equipment':
						
								$GetItemMall = $this->AssignMall($this->Action);
									return $GetItemMall;
							
						break;
						
						
						default:
							die('Not available');
					}
			}
			
		public function BuyPage($ItemID)
			{
				$GetDetails = doQuery("SELECT * FROM $this->MallTable WHERE MallID = '$ItemID'", DATABASE_AUCTION);
					$ItemNum = mssql_num_rows($GetDetails);
						if($ItemNum < 1)	
							{
								return '<br /><br />No Item Found';
								
							}
						else
							{
									$oRow = mssql_fetch_array($GetDetails);
										$ItemName 	= $oRow['ItemName'];
										$ItemPrice 	= trim($oRow['ItemPrice']);
										$ItemDesc 	= trim($oRow['ItemDesc']);
										$ID 		= trim($oRow['ItemID']);
										$qty		= trim($oRow['quantity']);
										
								$BuyPage = '<form method="POST" action="home.php?act=mall&buy=buy">';
								$BuyPage.= '<input type="hidden" name="mall_id" value='.$ItemID.' /><br /><br />';
								$BuyPage.= 'Are you sure you want to buy <b>'.$ItemName.'(x'.$qty.')</b> for <b>'.$ItemPrice.'</b> points?<br />';
								$BuyPage.= '<input type="submit" name="buy_item" value=" Buy Now! " class="buybut" />';
								$BuyPage.= '</form>';
								return $BuyPage;
							}
			}
			
		public function MallMenu()
			{
				$Menu = '<a href="home.php?act=mall&category=pet">			Pet</a> | ';
				$Menu.= '<a href="home.php?act=mall&category=forging">		Forging</a> | ';
				$Menu.= '<a href="home.php?act=mall&category=equipment">	Equipment</a> | ';
				$Menu.= '<a href="home.php?act=mall&category=decoration">	Decoration</a> | ';
				$Menu.= '<a href="home.php?act=mall&category=miscelaneous">Miscelaneous</a>';
				return $Menu;
			}
	}


Can you take a look on it?
If theres any other page needed i'll post it

Share this post


Link to post
Share on other sites
12 hours ago, Onioni said:

Sorry I don't have pc right now, can't help more on phone. It will l work when u setup cache, tips, css, tpl/php correctly

Like i said, it works fine on Example.php, i only need help how to make it work on Item Mall Page

Share this post


Link to post
Share on other sites

Hello, @FapFap!

 

Try change the following constants in file config.php

 

from

	// Define if data caching is enabled or not.
	define('IIC_ENABLE_CACHING', false);
	
	// Define if Item Hint caching is enabled or not.
	define('IIC_ENABLE_ITEM_HINT_CACHING', false);
	
	// Define if cache is stable
	// source file not changing and cache does not need to verify source data
	// turning to true improve performances but will create inconsistencies
	define('IIC_STABLE_CACHE', false);

 

to

 

	// Define if data caching is enabled or not.
	define('IIC_ENABLE_CACHING', true);
	
	// Define if Item Hint caching is enabled or not.
	define('IIC_ENABLE_ITEM_HINT_CACHING', true);
	
	// Define if cache is stable
	// source file not changing and cache does not need to verify source data
	// turning to true improve performances but will create inconsistencies
	define('IIC_STABLE_CACHE', true);

 


Share this post


Link to post
Share on other sites

@V3ct0r it says:
 

Item info cache testing mode
Base file = C:\Zend\Apache2\htdocs\ItemInfoCache\iteminfo.txt
Cache file = C:\Windows\TEMPItemInfoCache.data
Cache Enabled = Yes
Cache Mode = Stable

Item Count = 0 <--- ITEM COUNT 0
Validity date = Saturday 2nd of February 2019 02:56:35 AM

Item Count = 0 when i change those to True and nothing happens


Also up there i posted My ItemMall and not sure if the ItemInfoCache works with ItemMall

Edited by FapFap

Share this post


Link to post
Share on other sites
On 3/10/2019 at 3:23 PM, Danny said:

But what do you want to do? Make it so it shows the tooltip when you hover the icon?

Exactly but in Item Mall Store, so people ex: can view attrs of necklace by hovering mouse into icon

Share this post


Link to post
Share on other sites

Give me a bit to test, I'll get back to you in a couple of hours.

 

EDIT:

3 hours ago, FapFap said:

Exactly but in Item Mall Store, so people ex: can view attrs of necklace by hovering mouse into icon

 

I was able to do it easily just by changing some little things. First of all you need to make a CSS box to hold your information when you hover.

 

After that, you need to edit the function GetItemHintHttpHeader to the following:

 

public function GetItemHintHttpHeader() 
	{
		$header = '<script src="'.BASE_URL.'js/jquery.cluetip.js" type="text/javascript"></script>';
		$header.= '<script type="text/javascript">';
		$header.= 	'$(document).ready(function() {';
		$header.= 		'$("img").cluetip({tracking:true,showTitle:false,cluetipClass: "CSS BOX CLASS",dropShadow: false, sticky:false});';
		$header.= 		'});';
		$header.= '</script>';
		$header.= '<link rel="stylesheet" href="'.BASE_URL.'css/itemHint.css" type="text/css" />';

		return $header;
	}

 

ATTENTION: You have to edit inside cluetipClass: "" the css to match your box css so it is something like this -

ezgif-1-b3a03ca7bf3c.gif.aedc3662c4dc5150169351b6daa9821d.gif

 

After that, modify your icon img source to something like this:
 

<img src="BASE_URL/icons/icon.png" rel="BASE_URL/itemhint?id=ITEMID" title="" width="32px" height="32px" />

 

And once you hover your icon, in theory it should work and give you the box. The only part I'm not actually giving you is the CSS code since I can't do all the work for you :P Its easy enough though. GL!

Edited by Danny

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.


×
×
  • Create New...