コード例 #1
0
ファイル: TreeNode.php プロジェクト: diamondo25/mapler.me
 public function offsetGet($index)
 {
     if ($index == '..') {
         return $this->parentNode;
     }
     if (!parent::offsetExists($index)) {
         return null;
     }
     $result = parent::offsetGet($index);
     if (is_string($result) && strpos($result, '{UOL}') !== false) {
         $splits = explode('/', substr($result, 5));
         if (count($splits) == 1) {
             return $result;
         }
         $curnode = $this;
         for ($i = 0; $i < count($splits); $i++) {
             $o = $splits[$i];
             if (!isset($curnode[$o])) {
                 if ($curnode->isroot && $o == '..' && $i + 1 != count($splits)) {
                     $i++;
                     // Well.. shit
                     $temp = GetItemWZInfo(intval($splits[$i]), CURRENT_LOCALE);
                     if ($temp == null) {
                         return null;
                     }
                     $curnode = $temp;
                 } else {
                     return null;
                 }
             } else {
                 $curnode = $curnode[$o];
             }
         }
         //if ($curnode !== $this) {
         return $curnode;
         //}
     }
     return $result;
 }
コード例 #2
0
function RenderTamedMob()
{
    global $options;
    global $data_buffer, $imageoptions, $zmap;
    $itemid = $options['tamingmob'];
    // TamingMob manipulates body X/Y
    $info = GetItemWZInfo($itemid, CURRENT_LOCALE);
    $mainx = $imageoptions['mainx'];
    $mainy = $imageoptions['mainy'];
    if ($info !== null) {
        $block = $info[$options['stance']][$options['stance_frame']];
        foreach ($block as $innerid => $innerblock) {
            if (!$innerblock instanceof TreeNode) {
                continue;
            }
            $zval = $innerblock['z'];
            if ($zval == 'tamingMobBack') {
                // Nexon'd
                $zval = 'tamingMobRear';
            }
            if (is_string($zval)) {
                $zval = $zmap[$zval];
            }
            $objectdata = array('info' => $innerblock, 'itemid' => $itemid, 'category' => 'tamingmob', 'vslot' => array(), 'islot' => 'Tm');
            $x = $mainx;
            $y = $mainy;
            $mappings = $objectdata['info']['map'];
            if (!isset($mappings)) {
                continue;
            } else {
                $imageoptions['mainx'] = $mainx + $mappings['navel']['X'];
                $imageoptions['mainy'] = $mainy + $mappings['navel']['Y'] + 20;
            }
            $copy = $mappings->getArrayCopy();
            krsort($copy);
            foreach ($copy as $mapname => $mapping) {
                if (!isset($data_buffer['body_map'][$mapname])) {
                    $data_buffer['body_map'][$mapname][0] = $x + $mapping['X'];
                    $data_buffer['body_map'][$mapname][1] = $y + $mapping['Y'];
                } else {
                    $x = $data_buffer['body_map'][$mapname][0] - $mapping['X'];
                    $y = $data_buffer['body_map'][$mapname][1] - $mapping['Y'];
                }
            }
            if (DEBUGGING) {
                echo 'Final map ' . $x . ', ' . $y . "\r\n";
            }
            $objectdata['x'] = $x;
            $objectdata['y'] = $y;
            $objectdata['image'] = $options['stance'] . '.' . $options['stance_frame'] . '.' . $innerid . '.png';
            if (DEBUGGING) {
                echo 'Image ' . $objectdata['image'] . "\r\n";
            }
            $foundinfo = true;
            $data_buffer['zlayers'][$zval][] = $objectdata;
        }
        $data_buffer['item_locations'][$itemid] = GetItemDataLocation($data_buffer['main-dir'], $itemid);
        $options['stance'] = 'sit';
    }
}
コード例 #3
0
ファイル: render_pet.php プロジェクト: diamondo25/mapler.me
}
$petid = intval($_GET['id']);
if ($petid < 0 || $petid > 1000) {
    die;
}
$petid = 5000000 + $petid;
$images_location = 'http://static_images.mapler.me/Inventory/Pet/';
// Add ID to image location
$images_location .= $petid . '.img/';
$image = imagecreatetruecolor(256, 256);
imagesavealpha($image, true);
$trans = imagecolorallocatealpha($image, 0, 0, 0, 127);
imagefill($image, 0, 0, $trans);
$x = 128;
$y = 128 - 10;
$info = GetItemWZInfo($petid, CURRENT_LOCALE);
$image_offset = array(0, 0);
if ($info['stand0'] !== null) {
    $origin = $info['stand0']['0']['origin'];
    $image_offset[0] = $origin['X'];
    $image_offset[1] = $origin['Y'];
}
AddImage('stand0.0.png', $x - $image_offset[0], $y - $image_offset[1]);
imagepng($image);
imagedestroy($image);
function AddImage($url, $x, $y)
{
    global $image, $images_location;
    $img = @imagecreatefrompng($images_location . $url) or die('image not found');
    imagecopyresampled($image, $img, $x, $y, 0, 0, imagesx($img), imagesy($img), imagesx($img), imagesy($img));
    imagealphablending($img, true);
コード例 #4
0
ファイル: character.php プロジェクト: diamondo25/mapler.me
    function RenderItemAtPosition($item, $x, $y, $bgicon = false, $amount = true)
    {
        $isequip = $item->type == ITEM_EQUIP;
        $info = GetItemDialogInfo($item, $isequip);
        $pos = 'left: ' . $x . 'px; top: ' . $y . 'px;';
        $itemIcon = '';
        if ($item->bagid != -1 || $item->type == ITEM_PET && $item->IsExpired()) {
            $itemIcon = 'D';
        }
        if (floor($item->itemid / 10000) == 166) {
            $itemIcon = 'D';
        }
        $display_id = GetItemIconID($info['iconid'], CURRENT_LOCALE);
        // For nebulites
        $itemwzinfo = GetItemWZInfo($display_id, CURRENT_LOCALE);
        $uid = substr(uniqid(), -5);
        ?>
			<div class="item-slot<?php 
        echo $info['potentials'] != 0 ? ' potential' . $info['potentials'] : '';
        ?>
 <?php 
        echo !$bgicon ? 'no-bg' : '';
        ?>
" style="<?php 
        echo $pos;
        ?>
" item-name="<?php 
        echo IGTextToWeb(GetMapleStoryString("item", $item->itemid, "name", CURRENT_LOCALE));
        ?>
" onmouseover='<?php 
        echo $info['mouseover'];
        ?>
' onmousemove="MoveWindow(event)" onmouseout="HideItemInfo()">
				<img class="icon" potential="<?php 
        echo $info['potentials'];
        ?>
" style="margin-top: <?php 
        echo 32 - $itemwzinfo['info']['icon']['origin']['Y'];
        ?>
px; margin-left: <?php 
        echo -$itemwzinfo['info']['icon']['origin']['X'];
        ?>
px;" src="<?php 
        echo GetItemIcon($display_id, CURRENT_LOCALE, $itemIcon);
        ?>
" />
<?php 
        if (!$isequip && $amount) {
            ?>
				<span class="amount"><?php 
            echo $item->amount;
            ?>
</span>
<?php 
        }
        if ($info['iscash'] == 1) {
            ?>
<div class="cashitem"></div><?php 
        }
        if ($info['islocked'] == 1) {
            ?>
<div class="locked"></div><?php 
        }
        if ($info['isluckyscrolled'] == 1) {
            ?>
<div class="lucky"></div><?php 
        }
        AddNebulite($info, 1);
        AddNebulite($info, 2);
        AddNebulite($info, 3);
        ?>
			</div>
<?php 
    }
コード例 #5
0
function get_data($itemid)
{
    return GetItemWZInfo($itemid, CURRENT_LOCALE);
}
コード例 #6
0
ファイル: functions.php プロジェクト: diamondo25/mapler.me
function GetItemIconID($id, $locale)
{
    $type = GetItemType($id, $locale);
    if ($type != 306) {
        $iteminfo = GetItemWZInfo($id, $locale);
        if ($iteminfo['info'] === null) {
            return $id;
        }
        if ($iteminfo['info']->IsUOL('icon')) {
            $id = $iteminfo['info']['icon']['..']['..']['ITEMID'];
            // Hell yea. Get the UOL object, then go back to get the Item ID
        }
        return $id;
    }
    $nebtype = $id / 1000 % 5;
    $main_id = 3800274;
    return $main_id + $nebtype;
}