示例#1
0
 private function _fvFarmLimits()
 {
     //Go Through All Objects on the Farm and Get Counts for Items
     foreach (GetObjects() as $object) {
         if ($object['className'] != 'MysterySeedling') {
             $uCode = Units_GetCodeByName($object['itemName']);
             if (isset($this->fbFarmLims[$uCode])) {
                 @$items[$uCode]['count']++;
                 @($items[$uCode]['object'][] = $object);
             }
         } else {
             $uCode = Units_GetNameByCode($object['seedType']);
             if (isset($this->fbFarmLims['tree_' . $object['seedType']])) {
                 @$items['tree_' . $object['seedType']]['count']++;
                 @($items['tree_' . $object['seedType']]['object'][] = $object);
             }
         }
     }
     if (empty($items)) {
         return;
     }
     AddLog2('fvTools: Applying Farm Limits');
     foreach ($items as $key => $item) {
         if ($this->fbFarmLims[$key] < $item['count']) {
             array_splice($item['object'], $item['count'] - $this->fbFarmLims[$key]);
             if (!empty($item['object'])) {
                 foreach ($item['object'] as $object) {
                     $newitems[] = $object;
                 }
             }
         }
     }
     $amfcount = 0;
     $amf = '';
     foreach ($newitems as $object) {
         $amf = $this->_fvCreateMultAMFRequest($amf, $amfcount, 'sell', 'WorldService.performAction');
         $amf->_bodys[0]->_value[1][$amfcount]['params'][1] = $object;
         $amf->_bodys[0]->_value[1][$amfcount]['params'][2] = array();
         $realname = Units_GetRealnameByName($object['itemName']);
         $tmpArray[$amfcount]['realname'] = $realname;
         if ($amfcount < $this->botspeed - 1) {
             $amfcount++;
             continue;
         }
         $amf2 = $this->_fvAMFSend($amf);
         $amf = '';
         $amfcount = 0;
         if ($amf2 === false) {
             DoInit();
             continue;
         }
         foreach ($amf2->_bodys[0]->_value['data'] as $key => $returned) {
             $resp = $returned['errorType'];
             $err = $returned['errorData'];
             if ($resp == 0) {
                 AddLog2('[' . $key . '] Sold: ' . $tmpArray[$key]['realname'] . ' - Result: ' . $this->zErrCGen[$resp]);
             } else {
                 AddLog2('fvTools Error: ' . $tmpArray[$key]['realname'] . " Code: " . $resp . ' - ' . $err);
             }
         }
         if ($this->reload === true) {
             DoInit();
             $this->reload = false;
         }
     }
     if (!empty($amf)) {
         $amf2 = $this->_fvAMFSend($amf);
         if ($amf2 === false) {
             continue;
         }
         foreach ($amf2->_bodys[0]->_value['data'] as $key => $returned) {
             $resp = $returned['errorType'];
             $err = $returned['errorData'];
             if ($resp == 0) {
                 AddLog2('[' . $key . '] Sold: ' . $tmpArray[$key]['realname'] . ' - Result: ' . $this->zErrCGen[$resp]);
             } else {
                 AddLog2('fvTools Error: ' . $tmpArray[$key]['realname'] . " Code: " . $resp . ' - ' . $err);
             }
         }
         if ($this->reload === true) {
             DoInit();
             $this->reload = false;
         }
     }
 }
示例#2
0
function Units_GetUnitByCode($vCode, $vAllInfo = false)
{
    return Units_GetUnitByName(Units_GetNameByCode($vCode), $vAllInfo);
}
示例#3
0
 function GetNameByCode($code)
 {
     if (strlen($code) == 4) {
         if (file_exists($_SESSION['base_path'] . 'achievement_info.txt')) {
             $codelist = @unserialize(file_get_contents($_SESSION['base_path'] . 'achievement_info.txt'));
             return $item['code']['name'];
         }
     }
     if (strlen($code) == 2) {
         $item = Units_GetNameByCode($code);
         if ($item != '') {
             return $item;
         }
     }
     return 0;
 }