function GB_export_action($Task, $filename) { // $Task = 'EXPORT' ==> // $Task = 'SHOW' ==> $file = '################################################################## # export file ################################################################## # Format of the lines: #Code #| Place on farm? Y/0 #| | Sell? Y/0 #| | | Keep #| | | | Consume? Y/0 #| | | | | reserved #| | | | | | reserved #| | | | | | | reserved #| | | | | | | | reserved #| | | | | | | | | reserved #| | | | | | | | | | reserved #| | | | | | | | | | | reserved #0 1 2 3 4 5 6 7 8 9 0 | reserved #| | | | | | | | | | | | | '; $screen = ''; $screen .= '<table width="90%" class="sofT" cellspacing="0">'; $screen .= '<tr><td class="helpHed">Code</td> <td class="helpHed">Item Name:</td> <td class="helpHed">Place?</td> <td class="helpHed">Sell?</td> <td class="helpHed">Keep?</td> <td class="helpHed">Consume?</td> <td class="helpHed">Notes:</td></tr>'; $GBSQL = "SELECT * FROM action WHERE _target = '0' AND _place_in_special = '0' AND _construction = '0' AND _collection = '0'"; $query = $this->_GBUser->query($GBSQL); $actions = $query->fetchAll(); foreach ($actions as $action) { $output = '<tr>'; $output .= '<td>' . $action['_code'] . '</td>'; // code $Unit = Units_GetUnitByCode($action['_code']); $output .= '<td>' . $Unit['name'] . '</td>'; // name $output .= '<td>' . $action['_place_on_farm'] . '</td>'; // place $output .= '<td>' . $action['_selling'] . '</td>'; // sell $output .= '<td>' . $action['_keep'] . '</td>'; // keep $output .= '<td>' . $action['_consume'] . '</td>'; // consume if ($action['_place_on_farm'] == '0' && $action['_selling'] == '0' && $action['_keep'] == '0' && $action['_consume'] == '0') { $output .= '<td>Will not be exported. NO action defined</td>'; } else { $output .= '<td>Will be exported</td>'; $file .= $action['_code'] . ':' . $action['_place_on_farm'] . ':' . $action['_selling'] . ':' . $action['_keep'] . ':' . $action['_consume'] . ':0:0:0:0:0:0:0:0:item name ' . $Unit['name'] . ":\r\n"; } $output .= '</tr>'; // end $screen .= $output; } $screen .= '</table>'; if ($Task == 'EXPORT') { $f = fopen($filename, "w+"); fputs($f, $file, strlen($file)); fclose($f); return 'done'; } return $screen; }
private function _fvBuyBushels() { $amfcount = 0; $amf = ''; $tmpArray = array(); while ($this->bBagsConsumed < $this->bDailyPurch) { if ($this->myBushels >= $this->bMaxCap) { AddLog2('Max Bushels Reached - Not Buying'); break; } $cnt = count($this->availBushels); if ($this->settings['debug'] == 1) { AddLog2('Users With Bushels Available: ' . $cnt); } $bcnt = 1; foreach ($this->availBushels as $aBushels) { //number_format($number, 2, '.', ''); $uid = number_format($aBushels['uid'], 0, '', ''); if (fBGetNeighborRealName($uid) === false) { continue; } if ($this->settings['debug'] == 1) { AddLog2('[' . $bcnt . '] *******User: '******' - Bushel Types: ' . count($aBushels['in']) . '*******'); } $bcnt++; $iguser = load_array('ignores.txt'); if (isset($iguser[$uid])) { if ($this->settings['debug'] == 1) { AddLog2("User on Ignore List"); } continue; } if ($this->myBushels >= $this->bMaxCap) { AddLog2('Max Bushels Reached - Not Buying'); break 2; } $keep = $this->settings['ascbushels_keep']; foreach ($aBushels['in'] as $aInvent) { $code = $aInvent['ic']; if (!isset($this->actBushel[$code]) && $this->settings['debug'] == 1) { AddLog2("Bushel: " . $code . " - Not Selected for Recipes"); continue; } if ($this->fvFMBCounts2($code) >= $keep && $this->settings['debug'] == 1) { AddLog2("Bushel: " . $code . " - Exceeds Keep Amount"); continue; } if (isset($this->actBushel[$code]) && $this->fvFMBCounts2($code) < $keep) { if ($this->settings['debug'] == 1) { AddLog2("Bushel: " . $code . " - Submitting for Purchase"); } $amf = $this->_fvCreateMultAMFRequest($amf, $amfcount, '', 'CraftingService.onClaimMarketStallItem'); $amf->_bodys[0]->_value[1][$amfcount]['params'][0] = $uid; $amf->_bodys[0]->_value[1][$amfcount]['params'][1] = trim($code); $amf->_bodys[0]->_value[1][$amfcount]['params'][2] = 0; $tmpArray[$amfcount]['uid'] = $uid; $tmpArray[$amfcount]['code'] = $code; /*if ($amfcount < 4) { $amfcount++; continue; }*/ $amf2 = $this->_fvAMFSend($amf); $amf = ''; $amfcount = 0; if ($amf2 === false) { continue; } foreach ($amf2->_bodys[0]->_value['data'] as $key => $returned) { $resp2 = $returned['data']['responseCode']; if ($resp2 == 5) { AddLog2('Farmer\'s Market Full'); break 3; } if ($resp2 == 0) { $bush = Units_GetUnitByCode($tmpArray[$key]['code']); AddLog2("Buy " . $bush['realname'] . " from " . $tmpArray[$key]['uid'] . " result: " . $this->zErrCBushels[$resp2]); $bush['realname'] = str_replace("'", "''", $bush['realname']); $gfvSQL = "INSERT INTO fmbushels(fmbushels_className, fmbushels_itemName, fmbushels_itemRealName, fmbushels_iconURL, fmbushels_itemCode, fmbushels_type, fmbushels_itemCount)\n\t\t\t\t\t\t\t\t\t\t\t\tvalues('" . @$bush['className'] . "', '" . @$bush['name'] . "', '" . @$bush['realname'] . "', '" . $bush['iconurl'] . "', '" . $bush . "','" . @$bush['type'] . "',1);"; $this->_fvManagerDBW->queryExec($gfvSQL); $this->bBagsConsumed++; $this->myBushels++; } else { if ($this->settings['debug'] == 1) { AddLog2("Buy from " . $tmpArray[$key]['uid'] . " result: " . $this->zErrCBushels[$resp2]); } } } } } } break; } if ($amf != '') { $amf2 = $this->_fvAMFSend($amf); if ($amf2 !== false) { foreach ($amf2->_bodys[0]->_value['data'] as $key => $returned) { $resp2 = $returned['data']['responseCode']; if ($resp2 == 5) { AddLog2('Farmer\'s Market Full'); break; } if ($resp2 == 0) { $bush = Units_GetUnitByCode($tmpArray[$key]['code']); AddLog2("Buy " . $bush['realname'] . " from " . $tmpArray[$key]['uid'] . " result: " . $this->zErrCBushels[$resp2]); $bush['realname'] = str_replace("'", "''", $bush['realname']); $gfvSQL = "INSERT INTO fmbushels(fmbushels_className, fmbushels_itemName, fmbushels_itemRealName, fmbushels_iconURL, fmbushels_itemCode, fmbushels_type, fmbushels_itemCount)\n\t\t\t\t\t\t\t\t\t\t\t\tvalues('" . @$bush['className'] . "', '" . @$bush['name'] . "', '" . @$bush['realname'] . "', '" . $bush['iconurl'] . "', '" . $bush . "','" . @$bush['type'] . "',1);"; $this->_fvManagerDBW->queryExec($gfvSQL); } else { if ($this->settings['debug'] == 1) { AddLog2("Buy from " . $tmpArray[$key]['uid'] . " result: " . $this->zErrCBushels[$resp2]); } } } } } }
function Sections_GetGiftboxContent() { $ingiftbox = @unserialize(fBGetDataStore('ingiftbox')); if (is_array($ingiftbox)) { foreach ($ingiftbox as $gift => $count) { list($qcount) = explode(',', $count); # $vItem = Section_GetUnit($units,$gift); $vItem = Units_GetUnitByCode($gift); if ($vItem['type'] == 'animal') { $vItemTyp = 'animal'; } elseif ($vItem['type'] == 'tree') { $vItemTyp = 'tree'; } elseif ($vItem['type'] == 'decoration') { $vItemTyp = 'decoration'; } elseif ($vItem['type'] == 'rotateabledecoration') { $vItemTyp = 'decoration'; } elseif ($vItem['type'] == 'lootabledecoration') { $vItemTyp = 'decoration'; } elseif ($vItem['type'] == 'egg') { $vItemTyp = 'decoration'; } elseif ($vItem['type'] == 'mysterygift') { $vItemTyp = 'decoration'; } elseif ($vItem['type'] == 'flowerdecoration') { $vItemTyp = 'decoration'; } elseif ($vItem['type'] == 'building') { $vItemTyp = 'building'; } else { $vItemTyp = 'unused'; } for ($vI = 0; $vI < $qcount; $vI++) { $Return[$vItemTyp][] = $vItem; } } } return $Return; }
function fsGetUnits($code) { $results = Units_GetUnitByCode($code); return $results; }
echo '<b>Collection information:</b><br> Note that this information only updates at the begin of a cycle. So it is alway 1 cycle behind.'; echo '<br>'; echo '<table class="sofT" cellspacing="0">'; echo "<tr>"; $GBccount = GB_LoadCcount(); $GB_CollectionList = GB_GetCollectionList(); if (!$GB_CollectionList) { echo $GB_file_error . "<br><br>(Collection list file missing)"; return; } foreach ($GB_CollectionList as $value) { echo '<td class="helpLeft">' . $value['name'] . "</td>"; $GB_amount_Coll = count($value['collectable']); $i = 0; while ($i < $GB_amount_Coll) { $unit = Units_GetUnitByCode($value['collectable'][$i]); $Amount_in_Collection = GB_GetColInfo($value['collectable'][$i], $GBccount); $BG_color = " class=\"lime\""; if ($Amount_in_Collection == "10") { $BG_color = " class=\"lgreen\""; } if ($Amount_in_Collection == "0") { $BG_color = " class=\"ired\""; } if ($images == 1 && $GBC->GB_Setting['ShowImageAll']) { $GB_image = GB_ShowIMG($unit); } else { $GB_image = " "; } echo "<td {$BG_color} > {$GB_image} <br> {$Amount_in_Collection} " . $unit['realname'] . " </td>"; $i++;
function DoInit($inittype = '') { $T = time(true); $res = 0; Hook('before_load_farm'); $_SESSION['sequence'] = 0; // Create Init request $amf = CreateRequestAMF('', 'UserService.initUser'); $amf->_bodys[0]->_value[1][0]['params'][0] = ""; $amf->_bodys[0]->_value[1][0]['params'][1] = -1; $amf->_bodys[0]->_value[1][0]['params'][2] = true; $serializer = new AMFSerializer(); $result = $serializer->serialize($amf); // serialize the data $answer = Request('', $result); $amf2 = new AMFObject($answer); $deserializer2 = new AMFDeserializer($amf2->rawData); // deserialize the data $deserializer2->deserialize($amf2); // run the deserializer $res = CheckAMF2Response($amf2); if ($res == 'OK') { // get flashSessionKey //$_SESSION['sequence'] = 1; //file_put_contents('all.txt', print_r($amf2,true)); if (isset($amf2->_bodys[0]->_value['data'][0]['data']['userInfo']['session_key'])) { $_SESSION['flashSessionKey'] = $amf2->_bodys[0]->_value['data'][0]['data']['userInfo']['session_key']; } $_SESSION['servertime'] = $amf2->_bodys[0]->_value['data'][0]['serverTime']; // save to file $flashSessionKey, $xp, $energy $xp = $amf2->_bodys[0]->_value['data'][0]['data']['userInfo']['player']['xp']; $energy = $amf2->_bodys[0]->_value['data'][0]['data']['energy']; $hlXP = Units_GetFarming('higherLevelXp'); $hlBegin = Units_GetFarming('higherLevelBegin'); $hlStep = Units_GetFarming('higherLevelStep'); // get extra info $level = $amf2->_bodys[0]->_value['data'][0]['data']['userInfo']['player']['level']; if (isset($hlXP) && $xp >= $hlXP) { $level = @$hlBegin + floor(($xp - @$hlXP) / @$hlStep); } $gold = $amf2->_bodys[0]->_value['data'][0]['data']['userInfo']['player']['gold']; $cash = $amf2->_bodys[0]->_value['data'][0]['data']['userInfo']['player']['cash']; $sizeX = $amf2->_bodys[0]->_value['data'][0]['data']['userInfo']['world']['sizeX']; $sizeY = $amf2->_bodys[0]->_value['data'][0]['data']['userInfo']['world']['sizeY']; $firstname = $amf2->_bodys[0]->_value['data'][0]['data']['userInfo']['attr']['name']; $locale = $amf2->_bodys[0]->_value['data'][0]['data']['locale']; $tileset = $amf2->_bodys[0]->_value['data'][0]['data']['userInfo']['world']['tileSet']; $wither = $amf2->_bodys[0]->_value['data'][0]['data']['userInfo']['player']['witherOn']; // save to file $level, $coins, $cash, $sizex, $sizey $uSQL = 'INSERT OR REPLACE INTO datastore(userid, storetype, content) values("' . $_SESSION['userId'] . '", "playerinfo", "' . implode(';', array($level, $gold, $cash, $sizeX, $sizeY, $firstname, $locale, $tileset, $wither, $xp, $energy, $_SESSION['flashRevision'])) . '");'; // save world to file save_botarray($amf2->_bodys[0]->_value, F('world.txt')); //file_put_contents('world.txt', print_r($amf2->_bodys[0]->_value,true)); // get objects on farm $objects = $amf2->_bodys[0]->_value['data'][0]['data']['userInfo']['world']['objectsArray']; //file_put_contents('world.txt', print_r($objects, true)); // FarmFIX/object split $newobjects = serialize($objects); $cleanedobjects = str_replace("'", "''", $newobjects); $uSQL .= "INSERT OR REPLACE INTO datastore(userid, storetype, content) values('" . $_SESSION['userId'] . "',\n\t\t\t\t\t'objects', '" . $cleanedobjects . "');"; // save collection counters to a file $nAQ = @$amf2->_bodys[0]->_value['data'][0]['data']['userInfo']['player']['neighborActionQueue']['m_actionQueue']; $uSQL .= "INSERT OR REPLACE INTO datastore(userid, storetype, content) values('" . $_SESSION['userId'] . "',\n\t\t\t\t'nactionqueue', '" . serialize($nAQ) . "');"; $nAL = @$amf2->_bodys[0]->_value['data'][0]['data']['userInfo']['player']['neighborActionLimits']['m_neighborActionLimits'][date('ymd', $_SESSION['servertime'])]; $uSQL .= "INSERT OR REPLACE INTO datastore(userid, storetype, content) values('" . $_SESSION['userId'] . "',\n\t\t\t\t'nactionlimit', '" . serialize($nAL) . "');"; $c_count = @$amf2->_bodys[0]->_value['data'][0]['data']['userInfo']['player']['collectionCounters']; $uSQL .= "INSERT OR REPLACE INTO datastore(userid, storetype, content) values('" . $_SESSION['userId'] . "',\n\t\t\t\t'ccount', '" . serialize($c_count) . "');"; $c_bushel = @$amf2->_bodys[0]->_value['data'][0]['data']['userInfo']['player']['buffs']['BBushel']['crop']; $uSQL .= "INSERT OR REPLACE INTO datastore(userid, storetype, content) values('" . $_SESSION['userId'] . "',\n\t\t\t\t'cbushel', '" . serialize($c_bushel) . "');"; $c_busheltime = @$amf2->_bodys[0]->_value['data'][0]['data']['userInfo']['player']['buffs']['BBushel']['time']; $uSQL .= "INSERT OR REPLACE INTO datastore(userid, storetype, content) values('" . $_SESSION['userId'] . "',\n\t\t\t\t'cbusheltime', '" . serialize($c_busheltime) . "');"; $craftstate = @$amf2->_bodys[0]->_value['data'][0]['data']['craftingState']; $uSQL .= "INSERT OR REPLACE INTO datastore(userid, storetype, content) values('" . $_SESSION['userId'] . "',\n\t\t\t\t'craftstate', '" . serialize($craftstate) . "');"; // save lonelyanimals to a file $animallinks = @$amf2->_bodys[0]->_value['data'][0]['data']['userInfo']['player']['lonelyAnimals']; $uSQL .= "INSERT OR REPLACE INTO datastore(userid, storetype, content) values('" . $_SESSION['userId'] . "',\n\t\t\t\t'ralinks', '" . serialize($animallinks) . "');"; // save license information $licenses = $amf2->_bodys[0]->_value['data'][0]['data']['userInfo']['player']['licenseManager']['licenses']; $uSQL .= "INSERT OR REPLACE INTO datastore(userid, storetype, content) values('" . $_SESSION['userId'] . "',\n\t\t\t\t'licenses', '" . serialize($licenses) . "');"; $storagedata = $amf2->_bodys[0]->_value['data'][0]['data']['userInfo']['player']['storageData']; $uSQL .= "INSERT OR REPLACE INTO datastore(userid, storetype, content) values('" . $_SESSION['userId'] . "',\n\t\t\t\t'storagedata', '" . serialize($storagedata) . "');"; $incraftbox = $amf2->_bodys[0]->_value['data'][0]['data']['userInfo']['player']['storageData']['-7']; $uSQL .= "INSERT OR REPLACE INTO datastore(userid, storetype, content) values('" . $_SESSION['userId'] . "',\n\t\t\t\t'craftbox', '" . serialize($incraftbox) . "');"; // save giftbox info for plugins $ingiftbox = $amf2->_bodys[0]->_value['data'][0]['data']['userInfo']['player']['storageData']['-1']; $uSQL .= "INSERT OR REPLACE INTO datastore(userid, storetype, content) values('" . $_SESSION['userId'] . "',\n\t\t\t\t'giftbox', '" . serialize($ingiftbox) . "');"; foreach ($ingiftbox as $key => $item) { $ingiftbox[$key] = isset($item[0]) ? $item[0] : 0; } $uSQL .= "INSERT OR REPLACE INTO datastore(userid, storetype, content) values('" . $_SESSION['userId'] . "',\n\t\t\t\t'ingiftbox', '" . serialize($ingiftbox) . "');"; // save consumable info for plugins $inconbox = $amf2->_bodys[0]->_value['data'][0]['data']['userInfo']['player']['storageData']['-6']; $uSQL .= "INSERT OR REPLACE INTO datastore(userid, storetype, content) values('" . $_SESSION['userId'] . "',\n\t\t\t\t'consumebox', '" . serialize($inconbox) . "');"; foreach ($inconbox as $key => $item) { $uInfo = Units_GetUnitByCode($key); if (@$uInfo['className'] == 'CSeedPackage') { $inseedbox[$key] = isset($item[0]) ? $item[0] : 0; unset($inconbox[$key]); continue; } $inconbox[$key] = isset($item[0]) ? $item[0] : 0; } $uSQL .= "INSERT OR REPLACE INTO datastore(userid, storetype, content) values('" . $_SESSION['userId'] . "',\n\t\t\t\t'inconbox', '" . serialize($inconbox) . "');"; $uSQL .= "INSERT OR REPLACE INTO datastore(userid, storetype, content) values('" . $_SESSION['userId'] . "',\n\t\t\t\t'inseedbox', '" . serialize($inseedbox) . "');"; // save storage info for plugins $instorage = @$amf2->_bodys[0]->_value['data'][0]['data']['userInfo']['player']['storageData']['-2']; $uSQL .= "INSERT OR REPLACE INTO datastore(userid, storetype, content) values('" . $_SESSION['userId'] . "',\n\t\t\t\t'storagebox', '" . serialize($instorage) . "');"; foreach ($instorage as $key => $item) { $instorage[$key] = $item[0]; } $uSQL .= "INSERT OR REPLACE INTO datastore(userid, storetype, content) values('" . $_SESSION['userId'] . "',\n\t\t\t\t'instorage', '" . serialize($instorage) . "');"; // save neighbors list $neighbors = $amf2->_bodys[0]->_value['data'][0]['data']['userInfo']['player']['neighbors']; $uSQL .= "INSERT OR REPLACE INTO datastore(userid, storetype, content) values('" . $_SESSION['userId'] . "',\n\t\t\t\t'neighbors', '" . serialize($neighbors) . "');"; $bsStats = $amf2->_bodys[0]->_value['data'][0]['data']['userInfo']['player']['breedingState']; $uSQL .= "INSERT OR REPLACE INTO datastore(userid, storetype, content) values('" . $_SESSION['userId'] . "',\n\t\t\t\t'bsstats', '" . serialize($bsStats) . "');"; $pneighbors = $amf2->_bodys[0]->_value['data'][0]['data']['userInfo']['player']['pendingNeighbors']; $uSQL .= "INSERT OR REPLACE INTO datastore(userid, storetype, content) values('" . $_SESSION['userId'] . "',\n\t\t\t\t'pneighbors', '" . serialize($pneighbors) . "');"; // save crop mastery list $cropmastery = $amf2->_bodys[0]->_value['data'][0]['data']['userInfo']['player']['masteryCounters']; $uSQL .= "INSERT OR REPLACE INTO datastore(userid, storetype, content) values('" . $_SESSION['userId'] . "',\n\t\t\t\t'cropmastery', '" . serialize($cropmastery) . "');"; $cropmasterycnt = $amf2->_bodys[0]->_value['data'][0]['data']['userInfo']['player']['mastery']; $uSQL .= "INSERT OR REPLACE INTO datastore(userid, storetype, content) values('" . $_SESSION['userId'] . "',\n\t\t\t\t'cropmasterycnt', '" . serialize($cropmasterycnt) . "');"; if (isset($amf2->_bodys[0]->_value['data'][0]['data']['userInfo']['player']['featureCredits']['farm'])) { $featurecred = $amf2->_bodys[0]->_value['data'][0]['data']['userInfo']['player']['featureCredits']['farm']; } else { $featurecred = $amf2->_bodys[0]->_value['data'][0]['data']['userInfo']['player']['featureCredits']; } $uSQL .= "INSERT OR REPLACE INTO datastore(userid, storetype, content) values('" . $_SESSION['userId'] . "',\n\t\t\t\t'featurecred', '" . serialize($featurecred) . "');"; // save ribbon data $achievements = @$amf2->_bodys[0]->_value['data'][0]['data']['userInfo']['player']['achCounters']; $earned_ribbons = @$amf2->_bodys[0]->_value['data'][0]['data']['userInfo']['player']['achievements']; $ribbon_merge = array(); foreach ($achievements as $name => $data) { $ribbon_merge[$name]['count'] = $data; } if (@count($earned_ribbons) > 0) { foreach ($earned_ribbons as $name => $data) { $ribbon_merge[$name]['earned'] = $data; } } $uSQL .= "INSERT OR REPLACE INTO datastore(userid, storetype, content) values('" . $_SESSION['userId'] . "',\n\t\t\t\t'ach_count', '" . serialize($ribbon_merge) . "');"; $_SESSION['vDataStoreDB']->exec($uSQL); unset($uSQL, $amf2); // save_botarray ($array, $filename); } if ($inittype == 'full') { $amf = CreateRequestAMF('', 'UserService.postInit'); $serializer = new AMFSerializer(); $result = $serializer->serialize($amf); // serialize the data $answer = Request('', $result); $amf2 = new AMFObject($answer); $deserializer2 = new AMFDeserializer($amf2->rawData); // deserialize the data $deserializer2->deserialize($amf2); // run the deserializer $res2 = CheckAMF2Response($amf2); if ($res2 == 'OK') { file_put_contents('world2.txt', print_r($amf2->_bodys[0]->_value, true)); $availBushels = @$amf2->_bodys[0]->_value['data'][0]['data']['marketView']['marketStalls']; $availGoods = @$amf2->_bodys[0]->_value['data'][0]['data']['marketView']['craftedGoods']; $bsInfo = @$amf2->_bodys[0]->_value['data'][0]['data']['breedingState']; $uSQL = "INSERT OR REPLACE INTO datastore(userid, storetype, content) values('" . $_SESSION['userId'] . "',\n\t\t\t\t'availbushels', '" . serialize($availBushels) . "');"; $uSQL .= "INSERT OR REPLACE INTO datastore(userid, storetype, content) values('" . $_SESSION['userId'] . "',\n\t\t\t\t'availgoods', '" . serialize($availGoods) . "');"; $uSQL .= "INSERT OR REPLACE INTO datastore(userid, storetype, content) values('" . $_SESSION['userId'] . "',\n\t\t\t\t'bsinfo', '" . serialize($bsInfo) . "');"; $_SESSION['vDataStoreDB']->exec($uSQL); unset($uSQL, $amf2); } Hook('after_load_farm'); $res = $res == 'OK' && $res2 == 'OK' ? 'OK' : 'Init: ' . $res . ' - PostInit: ' . $res2; } $T2 = time(); $T2 -= $T; if ($res == 'OK') { AddLog2("Initialization Took: " . $T2 . " Seconds"); } else { AddLog2("Initialization Failed: " . $res); } return $res; }
<td class="builds" style="vertical-align: top; width: 33%;"><font size="2"><b>Seeds: </b><?php echo array_sum($seedpkgs); ?> </font></td> <td class="builds" style="vertical-align: top; width: 33%;"></td> <td class="builds" style="vertical-align: top;"></td> </tr> <tr> <!-- Seeds --> <td class="builds" style="vertical-align: top;"> <div style="overflow-y: scroll; height: 245px;"> <ul> <?php foreach ($seedpkgs as $key => $seedpack) { $uInfo = Units_GetUnitByCode($key); echo '<li style="text-indent:-40px; list-style-type: none;">' . $seedpack . ' - ' . $uInfo['realname'] . '</li>'; } ?> </ul> </div> </td> <!-- EMPTY --> <td class="builds" style="vertical-align: top;"> </td> <!-- EMPTY --> <td class="builds" style="vertical-align: top;"> </td> </tr> </tbody> </table>
function _fvPlantCrafts($plots) { if (empty($plots)) { return; } sort($plots); $craft = @$this->settings['craft']; if (empty($craft)) { return; } AddLog2("Planting for Crafts"); $craftinfo = Crafts_GetByCode($craft); $seeds = explode(':', $craftinfo['Ingredient_itemCode']); foreach ($seeds as $seed) { $newseed[$seed] = $craftinfo['Ingredient_quantityRequired_' . $seed]; } $seedcnt = array_sum($newseed); $seed_plots = array(); $emptyplots = count($plots); $i = 0; foreach ($newseed as $seed => $cnt) { if (empty($plots)) { break; } $seedpercent = ceil($emptyplots * ($cnt / $seedcnt)); $seedpercent = $seedpercent < 1 ? 1 : $seedpercent; for ($x = 0; $x < $seedpercent; $x++) { if (empty($plots)) { break 2; } $sinfo = Units_GetUnitByCode($seed, true); $plots[$i]['itemName'] = Units_GetNamebyCode($sinfo['crop']); $seed_plots[] = $plots[$i]; unset($plots[$i]); $i++; } } if (count($seed_plots) > 0) { $this->_fvPlotWork($seed_plots, 'place'); } }
private function _fvDeleteTrees() { $fvSQL .= "INSERT OR REPLACE INTO settings(settings_name,settings_value) values('deltrees','0');"; $this->_fvToolsDBM->queryExec($fvSQL); $fgtrees = unserialize($this->fvGetSettings('trees')); $amfcount = 0; $amf = ''; $msUnit = Units_GetUnitByName('mysteryseedling'); foreach (GetObjects('MysterySeedling') as $tree) { if (!isset($fgtrees[$tree['seedType']])) { $item['itemName'] = $tree['itemName']; $item['position'] = $tree['position']; $item['id'] = $tree['id']; $item['className'] = $tree['className']; $amf = $this->_fvCreateMultAMFRequest($amf, $amfcount, 'sell', 'WorldService.performAction'); $amf->_bodys[0]->_value[1][$amfcount]['params'][1] = $item; $amf->_bodys[0]->_value[1][$amfcount]['params'][2] = array(); $msUnit = Units_GetUnitByCode($tree['seedType']); $tmpArray[$amfcount]['realname'] = $msUnit['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'] . ' Mystery Seedling - Result: ' . $this->zErrCGen[$resp]); } else { AddLog2('fvTools Error: ' . $tmpArray[$key]['realname'] . " Code: " . $resp . ' - ' . $err); } } if ($this->reload === true) { DoInit(); $this->reload = false; } } } if ($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; } } }