예제 #1
0
/**
 * 
 * @param InventorySlot $item
 * @return string
 */
function gwlink_inventoryslot(InventorySlot $item)
{
    $url = 'slot-' . $item->getId();
    foreach ($item->getUpgrades() as $upgrade) {
        $url .= '-up' . $upgrade->getId();
    }
    foreach ($item->getInfusions() as $infusion) {
        $url .= '-in' . $infusion->getId();
    }
    if ($item->getSkin()) {
        $url .= '-sk' . $item->getSkin()->getId();
    }
    if ($item->getCount() > 1) {
        $url .= '-cn' . $item->getCount();
    }
    if ($item->getBinding()) {
        $url .= '-bn' . $item->getBinding();
    }
    if ($item->getBoundTo()) {
        $url .= '-bt' . $item->getBoundTo();
    }
    $stats = $item->getData('stats');
    if (!empty($stats) && is_array($stats)) {
        if (isset($stats['id'])) {
            $url .= '-st' . $item->getItemStat()->getId();
        }
        if (isset($stats['attributes'])) {
            $map = ['AgonyResistance' => 'za', 'BoonDuration' => 'zb', 'ConditionDamage' => 'zc', 'ConditionDuration' => 'zd', 'CritDamage' => 'ze', 'Healing' => 'zf', 'Power' => 'zg', 'Precision' => 'zh', 'Toughness' => 'zi', 'Vitality' => 'zj'];
            foreach ($stats['attributes'] as $key => $value) {
                if (isset($map[$key])) {
                    $url .= '-' . $map[$key] . $value;
                }
            }
        }
    }
    $url .= '.html';
    return ' class="gwitemlink" data-url="' . $url . '"';
}
예제 #2
0
/**
 * 
 * @param InventorySlot $item
 * @return string
 */
function gwlink_inventoryslot(InventorySlot $item)
{
    $url = 'item/' . $item->getId();
    if (count($item->getInfusions())) {
        $url .= '/inf';
        foreach ($item->getInfusions() as $infusion) {
            $url .= '-' . $infusion->getId();
        }
    }
    if (count($item->getUpgrades())) {
        $url .= '/upg';
        foreach ($item->getUpgrades() as $upgrade) {
            $url .= '-' . $upgrade->getId();
        }
    }
    if ($item->getSkin()) {
        $url .= '/ski-' . $item->getSkin()->getId();
    }
    if ($item->getCount() > 1) {
        $url .= '/cnt-' . $item->getCount();
    }
    $url .= '.html';
    return ' class="gwitemlink" data-url="' . $url . '"';
}