GithubHelp home page GithubHelp logo

xivpads-lodestoneapi's Introduction

XIVPads-LodestoneAPI

An API for parsing lodestone data, designed and maintained by XIVPads.com and XIVDB.com

Requirements

Implemented

  • Character Search
  • Profile Parse
  • Achievement Parse

Todo

  • Clean up some code
  • Individual Achievement Parse using an Category ID
  • Linkshell Parse
  • Free Company Parse
  • Friend Parse
  • Blog Parse

Getting Started

The API is heavily object-oriented. It will parse the Lodestone for information and attach this to a entity type object, for example searching a character and parsing the profile will create a character object pre-filled with the profile information where you can call traditional "get" functions.

Quick Parse

// Initialize a LodestoneAPI Obkect
$API = new LodestoneAPI();

// Parse the character: Premium Virtue - Gungnir
$Character = $API->get("Premium Virtue", "Gungnir");

// Print character portrait
echo '<img src="'. $Character->getPortrait() .'" />';

Search Character

// Search the character: Premium Virtue - Gungnir, with exact matching
$API->searchCharacter("Premium Virtue", "Gungnir", true);

/* The getSearch object will contain an array with the following data:
 * 'total' - The total number of results found
 * 'results' - The list of results found
 * If the 3rd param "Exact" is true, it will attempt to find an exact match
 * if one is found, it will be the only result at index [0] of 'results'
 */
Show($API->getSearch());

Parse by ID

// Set an ID
$ID = 730968;

// Parse profile
$API->parseProfile($ID);

// Select character
$Character = $API->getCharacterByID($ID);

Parse multiple IDs

IMPORTANT: Depending on your servers distance from Japan and the bandwidth speed, parsing multiple characters at the same time can lock down your server and it may crash. I recommend using a buffer or flush to stock the collected data

// Set an ID
$IDList = array(730968, 123456, 098765)

// Loop through ID list and parse all characters
foreach($IDList as $ID)
{
  // Parse profile
  $API->parseProfile($ID);
}

// Print all character objects
Show($API->getCharacters());

// Select a specific character (in this case, the $IDList index 0)
$Character = $API->getCharacterByID($IDList[0]);

Parse Achievements

This will take a significant amount of time to complete as it is looping through all achievement categories, I plan to make a standalone function call that can be looped locally.

// Set an ID
$ID = 730968;

// Parse achievements
$API->parseAchievements($ID)

// Show achievements
Show($API->getAchievements());

API Methods

LodestoneAPI

searchCharacter(name, server, exact[true|false])
get(name, server)
getSearch()
getAchievements()
getCharacters()
getCharacterByID(id)
parseProfile(id)
parseBiography(id)
parseAchievements(id)

Character

getID()
getLodestone() // the url of their lodestone profile
getName()
getServer()
getNameClean() // twitter like name, eg "Premium Vir'tue" --> "premiumvirtue"
getAvatar(size) // size of avatars: 50, 64, 96
getPortrait()
getRace()
getClan()
getLegacy() // This is "Sixth Astral Era" status
getNameday()
getGuardian()
getCompanyName()
getCompanyRank()
getFreeCompany() // Returns array with 'name' and 'id'
getCity()
getBiography()
getStat(type, attribute) // (List below)
getGear() // Returns array containing 'name', 'icon', 'slot'
getEquipped(type) // List by 'numbers', or list by 'slots'
getSlot() // (List below)
getActiveClass()
getActiveJob()
getActiveLevel()
getMinions() // Returns array containing 'Name' and 'Icon'
getClassJob(class) // Get level/exp info of a class
isValid() // Wheather character data is valid or not (WIP)
getErrors() // List of errors found during validation

Stat Types Type > Attribute.

// Example use:
echo $Character->getStat('offense', 'critical hit rate');
  • core
    • hp
    • mp
    • tp
  • attributes
    • strength
    • vitality
    • dexterity
    • intelligence
    • mind
    • piety
  • elemental
    • fire
    • ice
    • wind
    • earth
    • lightning
    • water
  • offense
    • accuracy
    • critical hit rate
    • determination
  • defense
    • defense
    • parry
    • magic defense
  • physical
    • attack power
    • skill speed
  • resists
    • slashing
    • piercing
    • blunt
  • crafting
    • craftsmanship
    • control
  • spell
    • attack magic potency
    • healing magic potency
    • spell speed
  • pvp
    • morale
  • gathering
    • gathering
    • Perception

Slot Types

// Example use:
echo $Character->getSlot('head');
  • main - main hand weapon or tool
  • shield
  • head
  • body
  • waist
  • legs
  • feet
  • necklace
  • earrings
  • bracelets
  • ring
  • ring2
  • soul crystal

Achievements todo...

xivpads-lodestoneapi's People

Contributors

pipprit avatar vekien avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.