コード例 #1
0
ファイル: index.php プロジェクト: RadicalLinux/faceBot
<link rel="stylesheet" type="text/css" href="/plugins/fvNeighbors/js/grid/gt_grid.css" />
<link rel="stylesheet" type="text/css" href="css/index.css" />
<script src="/plugins/fvNeighbors/js/grid/gt_msg_en.js"></script>
<script src="/plugins/fvNeighbors/js/grid/gt_const.js"></script>
<script src="/plugins/fvNeighbors/js/grid/gt_grid_all.js"></script>
<script type="text/javascript">
var data1= [
<?php 
$nbors = $fsM->fnGetNeighbors();
foreach ($nbors as $nbor) {
    $lastseen = date("m/d/y, g:i a", $nbor['neighbors_lastseen']);
    $lastseen = empty($lastseen) ? 'Not Seen' : $lastseen;
    $lastupdate = date("m/d/y, g:i a", $nbor['neighbors_timestamp']);
    $lastupdate = empty($lastupdate) ? 'Not Updated' : $lastupdate;
    $farmsize = $nbor['neighbors_sizeX'] . 'x' . $nbor['neighbors_sizeY'];
    $nbor['neighbors_name'] = fBGetNeighborRealName($nbor['neighbors_fbid']);
    $nbor['neighbors_name'] = empty($nbor['neighbors_name']) ? 'Unknown' : $nbor['neighbors_name'];
    $nbor['neighbors_plots'] = $nbor['neighbors_plots'] < 1 ? 0 : $nbor['neighbors_plots'];
    $narray[] = '{fbid:"' . $nbor['neighbors_fbid'] . '",' . 'name:"' . $nbor['neighbors_name'] . '",lastseen:"' . $lastseen . '", farmsize:"' . $farmsize . '",' . 'objects:' . $nbor['neighbors_objects'] . ',lastupdate:"' . $lastupdate . '"}';
}
@($narray2 = implode(",\n", $narray));
echo $narray2;
?>
];

var dsOption= {
    fields :[
        {name : "fbid" },
        {name : "name" },
        {name : "lastseen", type: 'date' },
        {name : 'farmsize' },
コード例 #2
0
 private function _fvBuyGoods()
 {
     $amfcount = 0;
     $amf = '';
     $tmpArray = array();
     $iguser = load_array('ignores.txt');
     $usedUserIds = array();
     while ($this->cBagsConsumed < $this->cDailyPurch) {
         foreach ($this->availGoods as $aGoods) {
             $uid = number_format($aGoods['uid'], 0, '', '');
             if (fBGetNeighborRealName($uid) === false) {
                 continue;
             }
             if (isset($iguser[$uid])) {
                 continue;
             }
             if (@$this->cConsumed[$uid] >= $this->cDailyBags) {
                 if ($this->settings['debug'] == 1) {
                     AddLog2("Buy from " . $uid . " result: Maximum Goods Consumed");
                 }
                 continue;
             }
             foreach ($aGoods['in'] as $aInvent) {
                 if (isset($usedUserIds[$uid])) {
                     break;
                 }
                 $code = $aInvent['ic'];
                 $cost = $aInvent['pr'];
                 $amf = $this->_fvCreateMultAMFRequest($amf, $amfcount, '', 'CraftingService.onBuyCraftedGoods');
                 $amf->_bodys[0]->_value[1][$amfcount]['params'][0][0]['itemCode'] = trim($code);
                 $amf->_bodys[0]->_value[1][$amfcount]['params'][0][0]['priceOffered'] = $cost;
                 $amf->_bodys[0]->_value[1][$amfcount]['params'][0][0]['sellingUserId'] = trim($uid);
                 $tmpArray[$amfcount]['uid'] = $uid;
                 $tmpArray[$amfcount]['code'] = $code;
                 $amf2 = $this->_fvAMFSend($amf);
                 $amf = '';
                 $amfcount = 0;
                 if ($amf2 === false) {
                     continue;
                 }
                 foreach ($amf2->_bodys[0]->_value['data'] as $key => $returned) {
                     $resp2 = $returned['data']['buyResponse']['buyResults'][0]['code'];
                     if ($resp2 == 1 || $resp2 == 2 || $resp2 == 12) {
                         $iguser = load_array('ignores.txt');
                         $iguser[$tmpArray[$key]['uid']] = $tmpArray[$key]['uid'];
                         save_array($iguser, 'ignores.txt');
                     }
                     if ($resp2 == 0) {
                         $item = $this->fvGetUnits($tmpArray[$key]['code']);
                         AddLog2("Buy " . $item['units_realname'] . " from " . $tmpArray[$key]['uid'] . " result: " . $this->zErrCGoods[$resp2]);
                         $usedUserIds[$uid] = 1;
                         $this->cBagsConsumed++;
                         break;
                     } else {
                         if ($this->settings['debug'] == 1) {
                             AddLog2("Buy from {$uid} result: " . $this->zErrCGoods[$resp2]);
                         }
                     }
                 }
             }
         }
         break;
     }
     if ($amf != '') {
         $amf2 = $this->_fvAMFSend($amf);
         if ($amf2 !== false) {
             foreach ($amf2->_bodys[0]->_value['data'] as $key => $returned) {
                 $resp2 = $returned['data']['buyResponse']['code'];
                 if ($resp2 == 1 || $resp2 == 2 || $resp2 == 12) {
                     $iguser = load_array('ignores.txt');
                     $iguser[$tmpArray[$key]['uid']] = $tmpArray[$key]['uid'];
                     save_array($iguser, 'ignores.txt');
                 }
                 if ($resp2 == 0) {
                     $item = $this->fvGetUnits($tmpArray[$key]['code']);
                     AddLog2("Buy " . $item['units_realname'] . " from " . $tmpArray[$key]['uid'] . " result: " . $this->zErrCGoods[$resp2]);
                 } else {
                     if ($this->settings['debug'] == 1) {
                         AddLog2("Buy from " . $tmpArray[$key]['uid'] . " result: " . $this->zErrCGoods[$resp2]);
                     }
                 }
             }
         }
     }
 }
コード例 #3
0
 private function _fnUpdateWorldDB()
 {
     //Insert Missing Neighbors
     foreach ($this->neighbors as $neigh) {
         $fn_SQL = "INSERT OR IGNORE INTO neighbors(neighbors_fbid) ";
         $fn_SQL .= "VALUES('{$neigh}')";
         $q = $this->_fnNeighborsDBM->query($fn_SQL);
     }
     //Delete Neighbors
     $fn_SQL = "SELECT * FROM neighbors WHERE neighbors_delete=1 ";
     $q = $this->_fnNeighborsDBM->query($fn_SQL);
     $results = $q->fetchAll(SQLITE_ASSOC);
     foreach ($results as $result) {
         $this->_fnRemoveNeighbor($result['neighbors_fbid']);
     }
     //Cancel Pending Neighbor Requests
     if (@$this->settings['delpending'] == 1) {
         $cnt = 0;
         AddLog2('Pending Count: ' . count($this->pneighbors));
         foreach ($this->pneighbors as $pendn) {
             $this->_fnCancelNeighbor($pendn);
             $cnt++;
             if ($cnt == $this->settings['helpcycle']) {
                 break;
             }
         }
     }
     //Clear Neighbor Actions
     if (@$this->settings['accepthelp'] == 1) {
         AddLog2('Accepting Neighbors Help');
         $amfcount = 0;
         $amf = '';
         $tmpArray = array();
         $this->_fnGetBotSettings();
         foreach ($this->neighborActs as $nActs) {
             $nid = $nActs['visitorId'];
             foreach ($nActs['actions'] as $acts) {
                 $amf = CreateMultAMFRequest($amf, $amfcount, '', 'NeighborActionService.clearNeighborAction');
                 $amf->_bodys[0]->_value[1][$amfcount]['params'][0] = $nid;
                 $amf->_bodys[0]->_value[1][$amfcount]['params'][1] = $acts['actionType'];
                 $amf->_bodys[0]->_value[1][$amfcount]['params'][2] = $acts['objectId'];
                 $tmpArray[$amfcount]['id'] = $nid;
                 $tmpArray[$amfcount]['action'] = $acts['actionType'];
                 if ($amfcount < $this->botspeed - 1) {
                     $amfcount++;
                     continue;
                 }
                 $amf2 = $this->_fnAMFSend($amf);
                 $amf = '';
                 $amfcount = 0;
                 if ($amf2 === false) {
                     continue;
                 }
                 foreach ($amf2->_bodys[0]->_value['data'] as $key => $returned) {
                     $resp = $returned['errorType'];
                     $err = $returned['errorData'];
                     if ($resp == 0) {
                         AddLog2('[' . $key . '] Action: ' . $tmpArray[$key]['action'] . ' - ' . $tmpArray[$key]['id'] . ' - Result: ' . $this->zErrCGen[$resp]);
                     }
                 }
             }
         }
         if ($amf != '') {
             $amf2 = $this->_fnAMFSend($amf);
             if ($amf2 !== false) {
                 foreach ($amf2->_bodys[0]->_value['data'] as $key => $returned) {
                     $resp = $returned['errorType'];
                     $err = $returned['errorData'];
                     if ($resp == 0) {
                         AddLog2('[' . $key . '] Action: ' . $tmpArray[$key]['action'] . ' - ' . $tmpArray[$key]['id'] . ' - Result: ' . $this->zErrCGen[$resp]);
                     }
                 }
             }
         }
     }
     //Update Neighbors
     AddLog2('Updating Neighbors');
     $mytime = time() - 3600 * $this->settings['helptime'];
     $fvSQL = "SELECT * FROM neighbors WHERE neighbors_timestamp <= '" . $mytime . "' LIMIT " . $this->settings['helpcycle'];
     $q = $this->_fnNeighborsDBM->query($fvSQL);
     $results = $q->fetchAll(SQLITE_ASSOC);
     $tmpArray = array();
     $iguser = load_array('ignores.txt');
     foreach ($results as $result) {
         if (fBGetNeighborRealName($result['neighbors_fbid']) === false) {
             continue;
         }
         //echo $result['neighbors_timestamp'] . ' - ' . $mytime . ' - ' . ($mytime - $result['neighbors_timestamp']) . "\n";
         if (isset($iguser[$result['neighbors_fbid']])) {
             AddLog2("fvNeighbors: Ignored " . $result['neighbors_fbid'] . ' - ' . $result['neighbors_name']);
             AddLog2("fvNeighbors: Listed in Ignored.txt File");
             continue;
         }
         $amf = CreateRequestAMF('', 'WorldService.loadNeighborWorld');
         $amf->_bodys[0]->_value[1][0]['params'][0] = trim($result['neighbors_fbid']);
         $amf2 = $this->_fnAMFSend($amf);
         if ($amf2 === false) {
             AddLog2("fvNeighbors Error: " . $result['neighbors_fbid'] . ' - ' . $result['neighbors_name']);
             continue;
         }
         $this->_fnNeighborsDBM->queryExec('BEGIN;');
         foreach ($amf2->_bodys[0]->_value['data'] as $key => $returned) {
             //AddLog2(print_r($returned,true));
             $resp = $returned['errorType'];
             $err = $returned['errorData'];
             if ($resp == 0) {
                 $this->_fnGetFriends($returned, 'neighbor');
             }
         }
         $this->_fnNeighborsDBM->queryExec('COMMIT;');
     }
     AddLog2('Finished Updating Neighbors');
 }