$val = json_decode($val, true); if ($val['item_position'] != 3) { continue; } if (!isset($player[$val['player_id']])) { $player[$val['player_id']] = $this->get_data('Player')->get_player_info($val['player_id'], array('user_account', 'level')); } $aim_grid = $val['grid']; $sub_type = $val['sub_type']; $baim_grid = $this->get_body_part($sub_type); if (is_array($baim_grid) && !in_array($aim_grid, $baim_grid) || !is_array($baim_grid) && $baim_grid != $aim_grid) { echo "{$val['player_id']},{$val['player_prop_id']},{$val['prop_id']}\n"; file_put_contents("fix_equip.csv", "{$val['player_id']},{$player[$val['player_id']]['user_account']},{$player[$val['player_id']]['level']},{$val['player_prop_id']},{$val['prop_id']}\n", FILE_APPEND); } } } } } /** * 由类型获取装备的位置 * @param $sub_type * @return array */ protected function get_body_part($sub_type) { $part = array(1 => 0, 2 => 0, 3 => 0, 4 => 0, 5 => 1, 6 => 3, 7 => 5, 8 => 7, 9 => 9, 10 => 2, 11 => 4, 12 => array(6, 8)); return isset($part[$sub_type]) ? $part[$sub_type] : false; } } $obj = new fix_player_prop(); $obj->fix_equip();
$player_key = "data|player_prop:info:{$player_id}"; $datas = $this->redis()->hash_get($player_key); if ($datas) { foreach ($datas as $key => $val) { $val = json_decode($val, true); $arrPropConfig = Cache_Prop::getInstance()->get_prop_info($val['prop_id']); if ($arrPropConfig && $arrPropConfig['type'] == 1) { $arrPropConfig['star_level'] = $val['star_level']; $arrPropConfig['quality'] = $val['quality']; $arrPropConfig['level'] = $val['level']; $arrPropConfig = $this->get_game('Prop')->get_equip_attr($arrPropConfig); $val['base_attr'] = $arrPropConfig['base_attr']; $val['addition_attr'] = $arrPropConfig['addition_attr']; $result = $this->redis()->hash_set($player_key, $key, json_encode($val)); if ($result) { echo "player:{$val['player_id']}|player_prop_id:{$val['player_prop_id']}|prop_id:{$val['prop_id']} luck\n"; } else { echo "player:{$val['player_id']}|player_prop_id:{$val['player_prop_id']}|prop_id:{$val['prop_id']} fail\n"; } } } } } } } if (!isset($argv[1])) { echo "Usage: 参数使用英文冒号连接的多个PlayerID\n"; exit("Usage: php {$argv['0']} [ID1,ID2,ID3...] \n"); } $obj = new fix_player_prop(); $obj->run($argv[1]);