#!/system/bin/sh
# 定义颜色代码
RED="\033[1;31m"
GREEN="\033[1;32m"
YELLOW="\033[1;33m"
BLUE="\033[1;34m"
MAGENTA="\033[1;35m"
CYAN="\033[1;36m"
WHITE="\033[1;37m"
RESET="\033[0m"

# 开启动画函数
startup_animation() {
    echo -ne "${CYAN}liuying Tool欢迎你${RESET}"
    for i in {1..10}; do
        echo -ne "${CYAN}.${RESET}"
        sleep 0.2
    done
    echo -ne "\n"
    echo "${GREEN}liuying Tool[by.流莹]${RESET}"
    sleep 1
}

# 显示启动图案
show_logo() {
    echo -e "${CYAN}"
    echo "  ____  _   _  ___  ____  _____  ____  "
    echo " |  _ \| | | |/ _ \|  _ \| ____|/ ___| "
    echo " | |_) | |_| | | | | | | |  _|  \___ \ "
    echo " |  __/|  _  | |_| | |_| | |___  ___) |"
    echo " |_|   |_| |_|\___/|____/|_____||____/ "
    echo -e "${RESET}"
    echo "${BLUE}========================================${RESET}"
    echo "${WHITE} 欢迎使用liuying-Tool ProMax${RESET}"
    echo "${BLUE}========================================${RESET}"
}

# 获取系统信息
OS=$(uname -s)
KERNEL=$(uname -r)
ARCH=$(uname -m)
HOSTNAME=$(hostname)
USER=$(whoami)

# 显示启动图案和开启动画
clear
show_logo
startup_animation
sleep 1

echo "${YELLOW}liuying初始化中${RESET}"
sleep 1
echo "${CYAN}检测到系统信息：${RESET}"
echo "${GREEN}操作系统: ${WHITE}安卓${RESET}"
echo "${GREEN}内核版本: ${WHITE}$KERNEL${RESET}"
echo "${GREEN}系统架构: ${WHITE}$ARCH${RESET}"
echo "${GREEN}主机名: ${WHITE}$HOSTNAME${RESET}"
echo "${GREEN}当前用户: ${WHITE}$USER${RESET}"
sleep 2
echo "好莱坞防封拉满套餐内容:宝物:1,背饰:109,角色:341,滑板:327,荣耀奖杯:1800,宝物钥匙:888,最高排名:1,最高段位:6,金币:15888888,得分倍增:6666,蓝色钥匙:28888,喷射起跑:6666,滑板:28888,人物等级:388,头像框:245,特权:1"
# 密码验证
auth_pass="liuying"
echo "-----------------------------"
echo -n "请输入流莹生成器访问密码: "
read input_pass

if [ "$input_pass" != "$auth_pass" ]; then
    echo "欢迎使用流莹免root生成器"
    exit
fi

# 预置链接库（替换为您的实际链接）
links="
http://liuying.ouduck.ggff.net/0038644bd192cc8de98076e73aa6eb52
http://liuying.ouduck.ggff.net/1c1b997b2cdae58678426e5d580b4741
http://liuying.ouduck.ggff.net/192986ad7e4edbc3056d4b0c8bc30e17
http://liuying.ouduck.ggff.net/1746ae2b9d78b2936a9c4318d71d03e0
http://liuying.ouduck.ggff.net/174435889d7e1e0a649a29237c556b18
http://liuying.ouduck.ggff.net/1224a5b9c247a9e13bc88ebd0360617c
http://liuying.ouduck.ggff.net/100048abe2ca974183a9c126d668c2bd
http://liuying.ouduck.ggff.net/0bede7ab0795a31a836c8e9d96c41806
http://liuying.ouduck.ggff.net/093e7d61acb7005a1c823a9e4b714659
http://liuying.ouduck.ggff.net/0918e37b5e92c0a6b1cbaa8649542e72
http://liuying.ouduck.ggff.net/08e1a7ad6c0d15a80ec7685132b45922
http://liuying.ouduck.ggff.net/00ae0d9368e3a6c44862d31b54c71a25
"

# 数量输入验证
while true; do
    echo -n "请输入生成数量 (1-10): "
    read count
    
    if [ "$count" -ge 1 ] && [ "$count" -le 10 ] 2>/dev/null; then
        break
    else
        echo "错误：请输入1-10的数字"
    fi
done

# 随机抽取逻辑（免 shuf 替代方案）
echo "${CYAN}正在尝试获取Subwayliuying云端数据中${RESET}"
sleep 5.5
echo "${CYAN}Subwayliuying云端数据获取成功!${RESET}"
echo "${GREEN}正在检测liuying-Tool信息中${RESET}"
sleep 1
echo "${GREEN}liuyiny-Tool直充工具正常!${RESET}"
sleep 2
echo "${YELLOW}正在连接Subwayliuying系统信息...${RESET}"
sleep 2
echo "${GREEN}Subwayliuying系统信息连接成功！${RESET}"
sleep 1
echo "-----------------------------"
echo "生成的随机链接:"
echo "$links" | awk -v count="$count" '
    BEGIN { srand() } 
    { pool[NR] = $0 } 
    END {
        total = NR > count ? count : NR
        for (i=1; i<=total; i++) {
            idx = int(rand() * NR) + 1
            while (selected[idx]) { idx = idx % NR + 1 }
            print pool[idx]
            selected[idx] = 1
        }
    }
'
echo "-----------------------------"
echo "谢谢使用"