Patch to implement Arena Data to armory.class.php

Posts from previous Beta sessions

Patch to implement Arena Data to armory.class.php

Postby poetter » Wed Oct 10, 2007 4:11 am

Hi,

here is a patch that will implement fetching arena data from the Armory. I think we will need that when zanix finished roster arena structures.

Code: Select all
--- D:/xampp/roster.com/htdocs/lib/armory.class.php.org   Mon Sep 24 10:41:04 2007
+++ D:/xampp/roster.com/htdocs/lib/armory.class.php   Tue Oct 09 20:23:52 2007
@@ -620,6 +620,90 @@
       return $this->fetchCharacterReputation($character, $locale, $realm, 'html');
    }
 
+   /**
+    * Fetch arena teams of $character from the Armory
+    * $realm is required
+    * $locale is reqired
+    *
+    * @param string $character
+    * @param string $locale
+    * @param string $realm
+    * @param bool $fetch_type
+    * @return array
+    */
+   function fetchCharacterArenaTeams( $character, $locale, $realm, $fetch_type='array' )
+   {
+      global $roster;
+
+      $locale = substr($locale, 0, 2);
+      $cache_tag = $character.$locale.$realm.$fetch_type.'arenateams';
+
+      if( $roster->cache->check($cache_tag) )
+      {
+         if( $this->debug_cachehits )
+         {
+            trigger_error(__FUNCTION__ . " ::: Cache Hit: [ $cache_tag ]", E_NOTICE);
+         }
+         return $roster->cache->get($cache_tag);
+      }
+      else
+      {
+         $url = $this->_makeUrl( 7, $locale, false, $character, $realm );
+         if( $this->_requestXml($url) )
+         {
+            // unparsed fetches
+            if( $fetch_type != 'array' )
+            {
+               $roster->cache->put($cache_tag);
+               return $this->xml;
+            }
+            // else parse and return array
+            $this->xmlParser->Parse($this->xml);
+            $char = $this->xmlParser->getParsedData();
+            $roster->cache->put($char, $cache_tag);
+            return $char;
+         }
+         else
+         {
+            trigger_error('RosterArmory:: Failed to fetch ' . $url);
+            return false;
+         }
+      }
+   }
+
+   /**
+    * Fetch arena teams of $character from the Armory
+    * $realm is required
+    * $locale is reqired
+    * Returns XML string
+    *
+    * @param string $character
+    * @param string $locale
+    * @param string $realm
+    * @return string | xml string
+    */
+   function fetchCharacterArenaTeamsXML( $character, $locale, $realm )
+   {
+      return $this->fetchCharacterArenaTeams($character, $locale, $realm, 'xml');
+   }
+
+   /**
+    * Fetch arena teams of $character from the Armory
+    * $realm is required
+    * $locale is reqired
+    * Returns HTML string
+    *
+    * @param string $character
+    * @param string $locale
+    * @param string $realm
+    * @return string | html string
+    */
+   function fetchCharacterArenaTeamsHTML( $character, $locale, $realm )
+   {
+      $this->setUserAgent('Opera/9.22 (X11; Linux i686; U; en)');
+      return $this->fetchCharacterArenaTeams($character, $locale, $realm, 'html');
+   }
+
    function fetchStrings( $locale, $fetch_type='array' )
    {
       global $roster;
@@ -637,7 +721,7 @@
       }
       else
       {
-         $url = $this->_makeUrl( 7, $locale );
+         $url = $this->_makeUrl( 8, $locale );
          if( $this->_requestXml($url) )
          {
             // unparsed fetches
@@ -793,6 +877,10 @@
             $mode = 'character-reputation.xml?n=' . urlencode($char) . '&r=' . urlencode($realm);
             break;
          case 7:
+         case 'character-arenateams':
+            $mode = 'character-arenateams.xml?n=' . urlencode($char) . '&r=' . urlencode($realm);
+            break;
+         case 8:
          case 'strings':
             switch( $locale )
             {
Image
User avatar
poetter
Roster AddOn Dev
Roster AddOn Dev
 
Posts: 462
Joined: Sat Jun 30, 2007 9:41 pm
Location: Germany/Hamburg

Patch to implement Arena Data to armory.class.php

Postby zanix » Wed Oct 10, 2007 6:40 am

The devs (we) decided that the data provided by CP isn't enough to implement arena data into Roster 2.0
Perhaps in 2.1 or so when the data from CP is more complete

armory.class.php will still have this patch to retrieve this data
Read the Forum Rules, the WiKi, and Search before posting!
WoWRoster v2.1 - SigGen v0.3.3.523 - WoWRosterDF
User avatar
zanix
Admin
Admin
WoWRoster.net Dev Team
WoWRoster.net Dev Team
UA/UU Developer
UA/UU Developer
 
Posts: 5546
Joined: Mon Jul 03, 2006 8:29 am
Location: Idaho Falls, Idaho
Realm: Doomhammer (PvE) - US

Patch to implement Arena Data to armory.class.php

Postby poetter » Wed Oct 10, 2007 6:58 am

Hmm, that's to bad. Let's give ArmorySync a chance having an advantage over CP! ;-)
Image
User avatar
poetter
Roster AddOn Dev
Roster AddOn Dev
 
Posts: 462
Joined: Sat Jun 30, 2007 9:41 pm
Location: Germany/Hamburg

Patch to implement Arena Data to armory.class.php

Postby zanix » Wed Oct 10, 2007 7:09 am

Perhaps in the next big version of Roster (Codename R2, probably R3 now)

For 1.x and 2.x our primary data source is CP
Read the Forum Rules, the WiKi, and Search before posting!
WoWRoster v2.1 - SigGen v0.3.3.523 - WoWRosterDF
User avatar
zanix
Admin
Admin
WoWRoster.net Dev Team
WoWRoster.net Dev Team
UA/UU Developer
UA/UU Developer
 
Posts: 5546
Joined: Mon Jul 03, 2006 8:29 am
Location: Idaho Falls, Idaho
Realm: Doomhammer (PvE) - US

Patch to implement Arena Data to armory.class.php

Postby zanix » Wed Oct 10, 2007 7:12 am

ArmorySync already has a huge advantage over CP
Not having to deal with grumpy guildies :tongue:
Read the Forum Rules, the WiKi, and Search before posting!
WoWRoster v2.1 - SigGen v0.3.3.523 - WoWRosterDF
User avatar
zanix
Admin
Admin
WoWRoster.net Dev Team
WoWRoster.net Dev Team
UA/UU Developer
UA/UU Developer
 
Posts: 5546
Joined: Mon Jul 03, 2006 8:29 am
Location: Idaho Falls, Idaho
Realm: Doomhammer (PvE) - US


Return to Archived

Who is online

Users browsing this forum: No registered users and 1 guest

cron