RG-Banner


PremiumsystemForumVote AllRegeln Kontakt Tools
Willkommen, Gast
Benutzername: Passwort: Angemeldet bleiben:

RG-DB Tooltips in Eqdkp
(1 Leser) (1) Gast
  • Seite:
  • 1
  • 2

THEMA: RG-DB Tooltips in Eqdkp

RG-DB Tooltips in Eqdkp 07 Feb 2014 16:50 #580733

Hallo RG,

hat jemand von Euch zufällig ne Ahnung wie man Item-Tooltips von der RG-DB ins neue Eqdkp bekommt?

Für Anregungen jeder Art wäre ich dankbar.

Liebe Grüße
  • FreakerBust
  • OFFLINE
  • Gelegenheits-Spieler
  • /wave
  • Beiträge: 274

Aw: RG-DB Tooltips in Eqdkp 07 Feb 2014 17:49 #580746

Hiho,

ins eqDKP selbst, oder ins Forum?

lg
freeed
  • Freeed
  • OFFLINE
  • VIP
  • Beiträge: 3814

Aw: RG-DB Tooltips in Eqdkp 07 Feb 2014 18:58 #580754

<script src="https://db.rising-gods.de/power/aowowPower.js?v=1" type="text/javascript"></script>

wie hier im Forum auch..?
  • Sarjuuk
  • OFFLINE
  • DEV
  • alias GMs="Staff"
  • Beiträge: 657
Ein Leben ohne Drachen ist möglich, aber sinnlos.
*hugs*
:pinch: Warnung: Spoiler!

Aw: RG-DB Tooltips in Eqdkp 07 Feb 2014 20:36 #580761

Ich denke er meint in die liste, an wen welcher loot gegangen ist
  • Suchti2
  • OFFLINE
  • Gelegenheits-SuFu
  • Beiträge: 853
Folgende Benutzer bedankten sich: FreakerBust

Aw: RG-DB Tooltips in Eqdkp 08 Feb 2014 00:45 #580789

@Suchti: Genau das meine ich.

@Freeed: Ich meine ins Eqdkp direkt
So sieht der Code beispielweise aus, mit dem Wowhead eingebunden wird:
<?php
 /*
 * Project:		EQdkp-Plus
 * License:		Creative Commons - Attribution-Noncommercial-Share Alike 3.0 Unported
 * Link:		http://creativecommons.org/licenses/by-nc-sa/3.0/
 * -----------------------------------------------------------------------
 * Began:		2010
 * Date:		$Date: 2011-11-01 13:38:39 +0100 (Tue, 01 Nov 2011) $
 * -----------------------------------------------------------------------
 * @author		$Author: hoofy $
 * @copyright	2006-2011 EQdkp-Plus Developer Team
 * @link		http://eqdkp-plus.com
 * @package		eqdkp-plus
 * @version		$Rev: 11419 $
 * 
 * $Id: wowhead.class.php 11419 2011-11-01 12:38:39Z hoofy $
 */

include_once('itt_parser.aclass.php');

if(!class_exists('wowhead')) {
	class wowhead extends itt_parser {

		public static $shortcuts = array('pdl', 'puf' => 'urlfetcher');

		public $supported_games = array('wow');
		public $av_langs = array('en' => 'en_US', 'de' => 'de_DE', 'fr' => 'fr_FR', 'ru' => 'ru_RU', 'es' => 'es_ES');

		public $settings = array(
			'itt_icon_loc' => array('name' => 'itt_icon_loc',
									'language' => 'pk_itt_icon_loc',
									'fieldtype' => 'text',
									'size' => false,
									'options' => false,
									'default' => 'http://static.wowhead.com/images/wow/icons/large/'),
			'itt_icon_ext' => array('name' => 'itt_icon_ext',
									'language' => 'pk_itt_icon_ext',
									'fieldtype' => 'text',
									'size' => false,
									'options' => false,
									'default' => '.jpg'),
			'itt_default_icon' => array('name' => 'itt_default_icon',
										'language' => 'pk_itt_default_icon',
										'fieldtype' => 'text',
										'size' => false,
										'options' => false,
										'default' => 'inv_misc_questionmark')
		);

		private $searched_langs = array();

		public function __destruct(){
			unset($this->searched_langs);
			parent::__destruct();
		}

		protected function searchItemID($itemname, $lang, $searchagain=0) {
			$searchagain++;
			$this->pdl->log('infotooltip', 'wowhead->searchItemID called: itemname: '.$itemname.', lang: '.$lang.', searchagain: '.$searchagain);
			$item_id = 0;
			
			// Ignore blank names.
			$name = trim($itemname);
			if (empty($name)) { return null; }

			$encoded_name = urlencode($name);
			$encoded_name = str_replace('+' , '%20' , $encoded_name);
			$url = ($lang == 'en') ? 'www' : $lang;#
			$url = 'http://'.$url.'.wowhead.com/item='.$encoded_name.'&xml';
			$this->pdl->log('infotooltip', 'Search for ItemID at '.$url);
			$item_data = $this->puf->fetch($url);
			
			$xml = simplexml_load_string($item_data);
			if(is_object($xml)) {
				$item_id = (int)$xml->item->attributes()->id;
			} else {
				$this->pdl->log('infotooltip', 'Invalid XML');
			}
			//search in other languages
			if(!$item_id AND $searchagain < count($this->av_langs)) {
				$this->pdl->log('infotooltip', 'No Items found.');
				if(count($this->config['lang_prio']) >= $searchagain) {
					$this->pdl->log('infotooltip', 'Search again in other language.');
					$this->searched_langs[] = $lang;
					foreach($this->config['lang_prio'] as $slang) {
						if(!in_array($slang, $this->searched_langs)) {
							return $this->searchItemID($itemname, $slang, $searchagain);
						}
					}
				}
			}
			$debug_out = ($item_id > 0) ? 'Item-ID found: '.$item_id : 'No Item-ID found';
			$this->pdl->log('infotooltip', $debug_out);
			return array($item_id, 'items');
		}

		protected function getItemData($item_id, $lang, $itemname='', $type='items'){
			settype($item_id, 'int');
			if(!$item_id) {
				$item['baditem'] = true;
				return $item;
			}
			$item = array('id' => $item_id);
			$url = ($lang == 'en') ? 'www' : $lang;
			$item['link'] = 'http://'.$url.'.wowhead.com/item='.$item['id'].'&xml';
			$this->pdl->log('infotooltip', 'fetch item-data from: '.$item['link']);
			$itemxml = $this->puf->fetch($item['link'], array('Cookie: cookieLangId="'.$lang.'";'));
			if($itemxml AND $itemxml != 'ERROR') $itemxml = simplexml_load_string($itemxml);

			$item['name'] = ((!is_numeric($itemname) AND strlen($itemname) > 0) OR !is_object($itemxml)) ? $itemname : trim($itemxml->item->name);
			$item['lang'] = $lang;

			//filter baditems
			if(!is_object($itemxml) OR !isset($itemxml->item->htmlTooltip) OR strlen($itemxml->item->htmlTooltip) < 5) {
				$this->pdl->log('infotooltip', 'no xml-object returned');
				$item['baditem'] = true;
				return $item;
			}

			//build itemhtml
			$html = str_replace('"', "'", $itemxml->item->htmlTooltip);
			$template_html = trim(file_get_contents($this->root_path.'infotooltip/includes/parser/templates/wow_popup.tpl'));
			$item['html'] = str_replace('{ITEM_HTML}', stripslashes($html), $template_html);
			$item['lang'] = $lang;
			$item['icon'] = (string) strtolower($itemxml->item->icon);
			$item['color'] = 'q'.$this->convert_color((string) $itemxml->item->quality);
			return $item;
		}

		/*
		 * Translate Old-Colors to new css-classes
		 */
		private function convert_color($color) {
			if(is_numeric($color)) return $color;
			$color_array = array(
				'Verbreitet' => 1,
				'Common' => 1,
				'Común' => 1,
				'Classique' => 1,
				'Обычный' => 1,
				'Selten' => 2,
				'Uncommon' => 2,
				'Bonne' => 2,
				'Poco Común' => 2,
				'Необычный' => 2,
				'Rar' => 3,
				'Rare' => 3,
				'Raro' => 3,
				'Редкий' => 3,
				'Episch' => 4,
				'Epic' => 4,
				'Épica' => 4,
				'Épique' => 4,
				'Эпический' => 4,
				'Legendär' => 5,
				'Legendary' => 5,
				'Légendaire' => 5,
				'Legendaria' => 5,
				'Легендарный' => 5
			);
			return $color_array[$color];
		}
	}
}
if(version_compare(PHP_VERSION, '5.3.0', '<')) registry::add_const('short_wowhead', wowhead::$shortcuts);
?>


Das müsste man ja nur auf die RG DB abändern... Aber ich hab davon leider keine Ahnung :/
  • FreakerBust
  • OFFLINE
  • Gelegenheits-Spieler
  • /wave
  • Beiträge: 274
Letzte Änderung: 08 Feb 2014 15:43 von FreakerBust.

Aw: RG-DB Tooltips in Eqdkp 10 Feb 2014 00:53 #581001

Eventuell kann man ja Tooltips ausm Arsenal besser einbauen? Jemand ne Idee?
  • FreakerBust
  • OFFLINE
  • Gelegenheits-Spieler
  • /wave
  • Beiträge: 274

Aw: RG-DB Tooltips in Eqdkp 10 Feb 2014 15:50 #581073

$item['link'] = 'http://'.$url.'.wowhead.com/item='.$item['id'].'&xml';

so einfach geht das erst mal gar nicht, weil das aowow items nicht als xml ausgeben kann.

wahrscheinlich bist du dann mit dem arsenal wirklich besser beraten


/edith sagt:

aufn zweiten Gedanken kannst du aber auch statt nem xml, dir das json geben lassen (was aowow
unterstützt), das enthält nämlich auch alle Informationen, die das Plugin braucht. Allerdings musst du dich dann etwas mehr mit dem Code auseinandersetzen und teile umschreiben.

zum Vergleich:
db.rising-gods.de/?item=30883
db.rising-gods.de/?item=30883&xml
db.rising-gods.de/ajax.php?item=30883

www.wowhead.com/item=30883
www.wowhead.com/item=30883&xml
www.wowhead.com/item=30883&power
  • Sarjuuk
  • OFFLINE
  • DEV
  • alias GMs="Staff"
  • Beiträge: 657
Ein Leben ohne Drachen ist möglich, aber sinnlos.
*hugs*
:pinch: Warnung: Spoiler!
Letzte Änderung: 10 Feb 2014 17:09 von Sarjuuk.

Aw: RG-DB Tooltips in Eqdkp 11 Feb 2014 22:18 #581265

Sarjuuk schrieb:
Allerdings musst du dich dann etwas mehr mit dem Code auseinandersetzen und teile umschreiben.

und genau da ist bei mir was Problem... Von Php hab ich null Ahnung. Aber vielleicht bekomme ich es ja irgendwie mit dem Arsenal hin.

Danke dir!
  • FreakerBust
  • OFFLINE
  • Gelegenheits-Spieler
  • /wave
  • Beiträge: 274

Aw: RG-DB Tooltips in Eqdkp 01 Jul 2015 13:54 #627271

Im Zuge der neuen db frage ich nochmal vorsichtig nach:

Wie genau funktioniert die Einbindung der Datenbank in das eqDKP?
Die Tooltips sind ja nun wirklich sehr einfach jedoch wäre es vll sinnvoll eine Art Tutorial für die db in eqDKP zu schreiben =)
  • SplattedRabbit
  • OFFLINE
  • Gelegenheits-Spieler
  • @ff3_m!T_w@ff3
  • Beiträge: 204
Signature changed his status to “occupied“

Aw: RG-DB Tooltips in Eqdkp 13 Jul 2015 23:31 #628478

FreakerBust schrieb:
@Suchti: Genau das meine ich.

@Freeed: Ich meine ins Eqdkp direkt
So sieht der Code beispielweise aus, mit dem Wowhead eingebunden wird:
<?php
 /*
 * Project:		EQdkp-Plus
 * License:		Creative Commons - Attribution-Noncommercial-Share Alike 3.0 Unported
 * Link:		http://creativecommons.org/licenses/by-nc-sa/3.0/
 * -----------------------------------------------------------------------
 * Began:		2010
 * Date:		$Date: 2011-11-01 13:38:39 +0100 (Tue, 01 Nov 2011) $
 * -----------------------------------------------------------------------
 * @author		$Author: hoofy $
 * @copyright	2006-2011 EQdkp-Plus Developer Team
 * @link		http://eqdkp-plus.com
 * @package		eqdkp-plus
 * @version		$Rev: 11419 $
 * 
 * $Id: wowhead.class.php 11419 2011-11-01 12:38:39Z hoofy $
 */

include_once('itt_parser.aclass.php');

if(!class_exists('wowhead')) {
	class wowhead extends itt_parser {

		public static $shortcuts = array('pdl', 'puf' => 'urlfetcher');

		public $supported_games = array('wow');
		public $av_langs = array('en' => 'en_US', 'de' => 'de_DE', 'fr' => 'fr_FR', 'ru' => 'ru_RU', 'es' => 'es_ES');

		public $settings = array(
			'itt_icon_loc' => array('name' => 'itt_icon_loc',
									'language' => 'pk_itt_icon_loc',
									'fieldtype' => 'text',
									'size' => false,
									'options' => false,
									'default' => 'http://static.wowhead.com/images/wow/icons/large/'),
			'itt_icon_ext' => array('name' => 'itt_icon_ext',
									'language' => 'pk_itt_icon_ext',
									'fieldtype' => 'text',
									'size' => false,
									'options' => false,
									'default' => '.jpg'),
			'itt_default_icon' => array('name' => 'itt_default_icon',
										'language' => 'pk_itt_default_icon',
										'fieldtype' => 'text',
										'size' => false,
										'options' => false,
										'default' => 'inv_misc_questionmark')
		);

		private $searched_langs = array();

		public function __destruct(){
			unset($this->searched_langs);
			parent::__destruct();
		}

		protected function searchItemID($itemname, $lang, $searchagain=0) {
			$searchagain++;
			$this->pdl->log('infotooltip', 'wowhead->searchItemID called: itemname: '.$itemname.', lang: '.$lang.', searchagain: '.$searchagain);
			$item_id = 0;
			
			// Ignore blank names.
			$name = trim($itemname);
			if (empty($name)) { return null; }

			$encoded_name = urlencode($name);
			$encoded_name = str_replace('+' , '%20' , $encoded_name);
			$url = ($lang == 'en') ? 'www' : $lang;#
			$url = 'http://'.$url.'.wowhead.com/item='.$encoded_name.'&xml';
			$this->pdl->log('infotooltip', 'Search for ItemID at '.$url);
			$item_data = $this->puf->fetch($url);
			
			$xml = simplexml_load_string($item_data);
			if(is_object($xml)) {
				$item_id = (int)$xml->item->attributes()->id;
			} else {
				$this->pdl->log('infotooltip', 'Invalid XML');
			}
			//search in other languages
			if(!$item_id AND $searchagain < count($this->av_langs)) {
				$this->pdl->log('infotooltip', 'No Items found.');
				if(count($this->config['lang_prio']) >= $searchagain) {
					$this->pdl->log('infotooltip', 'Search again in other language.');
					$this->searched_langs[] = $lang;
					foreach($this->config['lang_prio'] as $slang) {
						if(!in_array($slang, $this->searched_langs)) {
							return $this->searchItemID($itemname, $slang, $searchagain);
						}
					}
				}
			}
			$debug_out = ($item_id > 0) ? 'Item-ID found: '.$item_id : 'No Item-ID found';
			$this->pdl->log('infotooltip', $debug_out);
			return array($item_id, 'items');
		}

		protected function getItemData($item_id, $lang, $itemname='', $type='items'){
			settype($item_id, 'int');
			if(!$item_id) {
				$item['baditem'] = true;
				return $item;
			}
			$item = array('id' => $item_id);
			$url = ($lang == 'en') ? 'www' : $lang;
			$item['link'] = 'http://'.$url.'.wowhead.com/item='.$item['id'].'&xml';
			$this->pdl->log('infotooltip', 'fetch item-data from: '.$item['link']);
			$itemxml = $this->puf->fetch($item['link'], array('Cookie: cookieLangId="'.$lang.'";'));
			if($itemxml AND $itemxml != 'ERROR') $itemxml = simplexml_load_string($itemxml);

			$item['name'] = ((!is_numeric($itemname) AND strlen($itemname) > 0) OR !is_object($itemxml)) ? $itemname : trim($itemxml->item->name);
			$item['lang'] = $lang;

			//filter baditems
			if(!is_object($itemxml) OR !isset($itemxml->item->htmlTooltip) OR strlen($itemxml->item->htmlTooltip) < 5) {
				$this->pdl->log('infotooltip', 'no xml-object returned');
				$item['baditem'] = true;
				return $item;
			}

			//build itemhtml
			$html = str_replace('"', "'", $itemxml->item->htmlTooltip);
			$template_html = trim(file_get_contents($this->root_path.'infotooltip/includes/parser/templates/wow_popup.tpl'));
			$item['html'] = str_replace('{ITEM_HTML}', stripslashes($html), $template_html);
			$item['lang'] = $lang;
			$item['icon'] = (string) strtolower($itemxml->item->icon);
			$item['color'] = 'q'.$this->convert_color((string) $itemxml->item->quality);
			return $item;
		}

		/*
		 * Translate Old-Colors to new css-classes
		 */
		private function convert_color($color) {
			if(is_numeric($color)) return $color;
			$color_array = array(
				'Verbreitet' => 1,
				'Common' => 1,
				'Común' => 1,
				'Classique' => 1,
				'Обычный' => 1,
				'Selten' => 2,
				'Uncommon' => 2,
				'Bonne' => 2,
				'Poco Común' => 2,
				'Необычный' => 2,
				'Rar' => 3,
				'Rare' => 3,
				'Raro' => 3,
				'Редкий' => 3,
				'Episch' => 4,
				'Epic' => 4,
				'Épica' => 4,
				'Épique' => 4,
				'Эпический' => 4,
				'Legendär' => 5,
				'Legendary' => 5,
				'Légendaire' => 5,
				'Legendaria' => 5,
				'Легендарный' => 5
			);
			return $color_array[$color];
		}
	}
}
if(version_compare(PHP_VERSION, '5.3.0', '<')) registry::add_const('short_wowhead', wowhead::$shortcuts);
?>


Das müsste man ja nur auf die RG DB abändern... Aber ich hab davon leider keine Ahnung :/


Ich hab den mal editiert so dass es passen sollt:
paste2.org/DanI9cU1

Diff:
paste2.org/hbYEWczb
  • Exordian
  • OFFLINE
  • Administrator
  • Do you even lift?
  • Beiträge: 1748
  • Seite:
  • 1
  • 2
Ladezeit der Seite: 0.11 Sekunden
legal notice