Преглед на файлове

11号单

福袋任务、礼炮奖励、进度奖励改为点击后直接领取全部可领取奖励
flowerpig преди 5 месеца
родител
ревизия
5dfdd8ab69

+ 89 - 11
script/module/absAct/DrumBlastingLogic.lua

@@ -150,9 +150,87 @@ function get(human,index,type,id)
     initDB(human,id)
 
     local nowDay = Util.diffDay(starTime) + 1
+    local allItems = {}  -- 用于批量领取时收集所有奖励
+    
+    -- 如果index为0或nil,则批量领取该type下所有可领取的奖励
+    if not index or index == 0 then
+        local hasReward = false
+        
+        if type == 1 then
+            -- 福袋任务:遍历所有drum任务,领取状态为1的
+            local taskConfig = AbsActExcel.drum
+            for i = 1, #taskConfig do
+                local v = taskConfig[i]
+                if v.day == nowDay then
+                    local taskState = absAct.drum[i] and absAct.drum[i].state or 0
+                    if taskState == 1 then
+                        hasReward = true
+                        -- 收集奖励
+                        for j = 1, #v.item do
+                            table.insert(allItems, v.item[j])
+                        end
+                        -- 更新状态
+                        absAct.drum[i].state = 2
+                    end
+                end
+            end
+        elseif type == 2 then
+            -- 礼炮奖励:遍历所有blasting,领取状态为1的
+            local taskConfig = AbsActExcel.blasting
+            for i = 1, #taskConfig do
+                local v = taskConfig[i]
+                local blastingState = absAct.blasting[i] and absAct.blasting[i].state or 0
+                if blastingState == 1 then
+                    hasReward = true
+                    -- 收集奖励
+                    local itemLen = type(v.item[nowDay]) == "table" and #v.item[nowDay] or 0
+                    for j = 1, itemLen do
+                        table.insert(allItems, v.item[nowDay][j])
+                    end
+                    -- 更新状态
+                    absAct.blasting[i].state = 2
+                    -- 增加一次,累计放炮次数,判断是否达到进度奖励领取值
+                    absAct.blastingCnt = absAct.blastingCnt + 1
+                    for j = 1, #AbsActExcel.blastingBox do
+                        if absAct.blastingCnt - 1 < AbsActExcel.blastingBox[j].needCnt and absAct.blastingCnt == AbsActExcel.blastingBox[j].needCnt then
+                            absAct.box[j] = 1
+                            break
+                        end
+                    end
+                end
+            end
+        elseif type == 3 then
+            -- 进度奖励:遍历所有box,领取状态为1的
+            local taskConfig = AbsActExcel.blastingBox
+            for i = 1, #taskConfig do
+                local v = taskConfig[i]
+                local boxState = absAct.box[i] or 0
+                if boxState == 1 then
+                    hasReward = true
+                    -- 收集奖励
+                    for j = 1, #v.item do
+                        table.insert(allItems, v.item[j])
+                    end
+                    -- 更新状态
+                    absAct.box[i] = 2
+                end
+            end
+        end
+        
+        -- 如果有奖励,则发放
+        if hasReward and #allItems > 0 then
+            BagLogic.addItemList(human, allItems, "abs_drumblasting")
+            getAndSendMsg(human, id, absConfig.actID)
+            YunYingLogic.sendBanner(human)
+            YunYingLogic.sendGroupUpdate(YYInfo[id], human, absConfig.panelID)
+        end
+        return
+    end
+    
+    -- 原有逻辑:单个领取
     local item = nil
 
-    -- 选锟斤拷锟接︼拷锟斤拷锟�
+    -- 选锟斤拷锟接︼拷锟斤拷锟?
     local config = nil
     local state = nil
     if type == 1 then
@@ -166,7 +244,7 @@ function get(human,index,type,id)
         state = absAct.box[index] or 0
     end
 
-    -- 锟斤拷锟斤拷锟斤拷锟斤拷锟斤拷锟
+    -- 锟斤拷锟斤拷锟斤拷锟斤拷锟斤拷锟?
     if not config then
         return 
     end
@@ -183,7 +261,7 @@ function get(human,index,type,id)
     elseif type == 2 then
         item = config.item[nowDay]
         absAct.blasting[index].state = 2
-        -- 锟斤拷锟斤拷一锟斤拷,锟斤拷锟斤拷锟桔计达拷锟斤拷锟斤拷锟斤拷锟叫讹拷锟角凤拷锏斤拷锟斤拷锟斤拷锟饺★拷锟街
+        -- 锟斤拷锟斤拷一锟斤拷,锟斤拷锟斤拷锟桔计达拷锟斤拷锟斤拷锟斤拷锟叫讹拷锟角凤拷锏斤拷锟斤拷锟斤拷锟饺★拷锟街?
         absAct.blastingCnt = absAct.blastingCnt + 1
         for i = 1,#AbsActExcel.blastingBox do
             if absAct.blastingCnt - 1 < AbsActExcel.blastingBox[i].needCnt and absAct.blastingCnt == AbsActExcel.blastingBox[i].needCnt then
@@ -199,13 +277,13 @@ function get(human,index,type,id)
     end
 
     BagLogic.addItemList(human, item, "abs_drumblasting")
-    getAndSendMsg(human,id,actID)
+    getAndSendMsg(human,id,absConfig.actID)
     
     YunYingLogic.sendBanner(human)
     YunYingLogic.sendGroupUpdate(YYInfo[id], human, absConfig.panelID)
 end
 
--- 每锟斤拷锟斤拷锟斤拷锟皆撅拷锟
+-- 每锟斤拷锟斤拷锟斤拷锟皆撅拷锟?
 function onDailyTask(human,funcID, parameter)
     drumTaskCallBack(human,funcID,1,parameter)
 end
@@ -241,7 +319,7 @@ function onJjcFight(human,funcID, parameter)
     drumTaskCallBack(human,funcID,7,parameter)
 end
 
--- 锟斤拷锟斤拷痰旯猴拷锟
+-- 锟斤拷锟斤拷痰旯猴拷锟?
 function onShopBuy(human,funcID,parameter)
     drumTaskCallBack(human,funcID,8,parameter)
 end
@@ -256,7 +334,7 @@ function onBinglong(human,funcID,parameter)
     drumTaskCallBack(human,funcID,10,parameter)
 end
 
--- 锟斤拷锟
+-- 锟斤拷锟?
 function onExchangeJinbi(human,funcID,parameter)
     drumTaskCallBack(human,funcID,11,parameter)
 end
@@ -278,7 +356,7 @@ end
 
 -- 占锟斤拷
 function onZhanBuBuyCard(human,funcID,parameter)
-    -- ZhanbuLogic.lua  436琛� 浼犵殑鏁板€间负璐�, 涓嶇煡閬撳摢涓�洃鍚��浜嬩欢鐨勫湴鏂归渶瑕佹暟鍊间负璐燂紝鎵€浠ュ彧澶勭悊褰撳墠妯″潡
+    -- ZhanbuLogic.lua  436琛? 浼犵殑鏁板€间负璐?, 涓嶇煡閬撳摢涓?鐩戝惉璇ヤ簨浠剁殑鍦版柟闇€瑕佹暟鍊间负璐燂紝鎵€浠ュ彧澶勭悊褰撳墠妯″潡
     if parameter < 0 then
         return
     end
@@ -308,7 +386,7 @@ function drumTaskCallBack(human,id,type,cnt)
    
 
     local state, endTime, starTime = AbsActLogic.isStarted(human, id)
-    -- 娲诲嫊鏈�枊鍟�
+    -- 娲诲嫊鏈?闁嬪晸
     if not state or os.time() > endTime then 
         return
     end
@@ -378,11 +456,11 @@ function updateDaily(human,id)
     human.db.absAct[id] = absAct
 end
 
- -- 鍥犱负鐜╁�鍦ㄦ椿鍔ㄦ湭寮€鍚�墠瀹屾垚浜嗘椿璺冨害浠诲姟锛屾椿鍔ㄥ紑鍚�悗娌℃硶瀹屾垚娲昏穬搴︿换鍔�,鎵€浠ュ湪鐜╁�涓婄嚎鏃�,鍋氫竴娆℃洿鏂版椿璺冨害鏁版嵁鎿嶄綔
+ -- 鍥犱负鐜╁?跺湪娲诲姩鏈?寮€鍚?鍓嶅畬鎴愪簡娲昏穬搴︿换鍔★紝娲诲姩寮€鍚?鍚庢病娉曞畬鎴愭椿璺冨害浠诲姟,鎵€浠ュ湪鐜╁?朵笂绾挎椂,鍋氫竴娆℃洿鏂版椿璺冨害鏁版嵁鎿嶄綔
 function specialFunc(human, id)
     AbsActLogic.checkAbsActClean(human, id)
     local state, endTime, starTime = AbsActLogic.isStarted(human, id)
-    -- 娲诲嫊鏈�枊鍟�
+    -- 娲诲嫊鏈?闁嬪晸
     if not state or os.time() > endTime then 
         return
     end

+ 61 - 0
srv_install.sh

@@ -0,0 +1,61 @@
+#!/bin/bash
+# 用于开新区 
+if [[ -z "$1" || ! "$1" =~ ^[0-9]+$ ]]; then
+  echo "错误: 请输入有效的 zone_id (正整数)。"
+  exit 1
+fi
+
+serverPath=/server #能否获取当前路径作为服务器路径
+zone_id=$1
+echo -e "获取服务器id: ${zone_id} \n"
+
+### 下面xxx修改为需要的路径
+to_dir=${serverPath}/bin${zone_id}
+if [ ! -d "$to_dir" ]; then
+    # 目录不存在,创建目录
+    mkdir -p "$to_dir"
+    cd $to_dir
+    # 目录不存在,创建目录
+    mkdir -p "log"
+    ## 复制 Config ,Main,AdminLogic 三个文件 创建common core excel module 四个软链接
+    cp -r ${serverPath}/bin/script ${to_dir}
+    cp -r ${serverPath}/bin/lua51.dll ${to_dir}
+    cp -r ${serverPath}/bin/logic.exe ${to_dir}
+    cp -r ${serverPath}/bin/logic ${to_dir}
+    cp -r ${serverPath}/bin/libgcc_s_dw2-1.dll ${to_dir}
+    
+     chmod 777 logic
+    
+    rm -rf ${to_dir}/script/common
+    rm -rf ${to_dir}/script/excel
+    rm -rf ${to_dir}/script/module
+    
+    
+    #cp ${serverPath}/bin/script/Config.lua     ${serverPath}/bin${zone_id}/script/Config.lua
+    #cp ${serverPath}/bin/script/Main.lua       ${serverPath}/bin${zone_id}/script/Main.lua
+    #cp ${serverPath}/bin/script/AdminLogic.lua ${serverPath}/bin${zone_id}/script/AdminLogic.lua
+    
+    ln -s ${serverPath}/bin/script/common ${serverPath}/bin${zone_id}/script/common 
+    #ln -s ${serverPath}/bin/script/core ${serverPath}/bin${zone_id}/script/core 
+    ln -s ${serverPath}/bin/script/excel ${serverPath}/bin${zone_id}/script/excel 
+    ln -s ${serverPath}/bin/script/module ${serverPath}/bin${zone_id}/script/module 
+    
+    port=$((8191 + zone_id))
+    port_admin=$((10000 + zone_id))
+    database_idx=$((350001 + zone_id))
+    svr_idx=$((810537 + zone_id))
+    svrName_idx=$((zone_id - 1))
+    
+    # 替换配置文件
+    sed -i "24c\PORT_CLIENT = ${port}" ${to_dir}/script/Config.lua
+    sed -i "25c\PORT_ADMIN = \"${port_admin}\"" ${to_dir}/script/Config.lua
+    sed -i "28c\DB_NAME = \"ckwy_fy_S${database_idx}\"" ${to_dir}/script/Config.lua
+    sed -i "31c\SVR_INDEX = ${svr_idx}" ${to_dir}/script/Config.lua
+    sed -i "32c\SVR_NAME = \"s${svrName_idx}\"" ${to_dir}/script/Config.lua
+    sed -i "33c\NEW_SVR_INDEX = ${zone_id}" ${to_dir}/script/Config.lua
+    
+fi
+
+#启动服务
+echo -e "开始启动服务:${zone_id}\n"
+cd $to_dir && ${to_dir}/logic

+ 63 - 0
timed_task.sh

@@ -0,0 +1,63 @@
+#!bin/bash
+
+echo "start"
+
+serverPath=/server
+task_log_path=${serverPath}/timed_task.log
+
+#zone_id=$(awk '{print $1}' ${serverPath}/config.txt)
+zone_id=$(awk 'NR==1{split($0,a,"=");print a[2]}' ${serverPath}/config.txt)
+echo $zone_id
+
+cur_time=$(date "+%Y-%m-%d %H:%M:%S")
+echo "当前执行开服:${zone_id}区开始时间为:${cur_time}" >> $task_log_path
+
+#1:execute install
+sh ${serverPath}/srv_install.sh $zone_id
+cur_time=$(date "+%Y-%m-%d %H:%M:%S")
+echo "${cur_time}=>srv_install.sh ${zone_id}" >> $task_log_path
+
+#4:update 
+db_user="root"
+db_password="wch123.com"
+db_name="sdk"
+table_name="game_server"
+
+index1=Tap
+index2=区
+server_name="$index1$zone_id$index2"
+server_name2="寻道$((zone_id - 180))服"
+#mapserver() {
+#  server_name=$index1$zone_id$index2
+#  echo $server_name
+#}
+echo $server_name
+mongodb_name=$((350001 + zone_id))
+port=$((8191 + zone_id))
+
+update_sql="insert into game_server(id,name,status,ip,port,tag,tips,white_list,open_time,db_name, megre_server,wss,sid)values(${zone_id},'${server_name}', 1,'118.145.139.78',${port},1,'','',0,'ckwy_fy_S${mongodb_name=$}',0,'',${zone_id});"
+
+if [ $zone_id -ge 180 ]; then
+    update_sql="${update_sql}insert into game_server(id,name,status,ip,port,tag,tips,white_list,open_time,db_name, megre_server,wss,sid) values($((2000 + zone_id)),'${server_name2}', 1,'118.145.139.78',${port},14,'','',0,'ckwy_fy_S${mongodb_name=$}',0,'',${zone_id});"
+fi
+
+mysql -u $db_user -p$db_password $db_name -e "$update_sql"
+
+cur_time=$(date "+%Y-%m-%d %H:%M:%S")
+echo "${cur_time}=>update sql:${update_sql}" >> $task_log_path
+
+#5:add 1
+((zone_id++))
+cur_time=$(date "+%Y-%m-%d %H:%M:%S")
+echo "${cur_time}=>zone_id++ ${zone_id}" >> $task_log_path
+
+#6:save id
+sed -i "1c\zone_start_id=${zone_id}" ${serverPath}/config.txt
+sed -i "2c\port=${port}" ${serverPath}/config.txt
+cur_time=$(date "+%Y-%m-%d %H:%M:%S")
+echo "${cur_time}=>zone_id++ ${zone_id}" >> $task_log_path
+
+cur_time=$(date "+%Y-%m-%d %H:%M:%S")
+echo "当前执行开服:${zone_id}区结束时间为:${cur_time}" >> $task_log_path
+
+echo $zone_id

+ 1 - 1
webServer/src/channels/handlers/HupuChannelHandler.ts

@@ -52,7 +52,7 @@ export class HupuChannelHandler implements ChannelHandler {
             const response = await axios.get(requestUrl, {params, timeout: 8000});
             logger.info("Hupu登录验证响应", {data: response.data});
 
-            if (response.data === "1") {
+            if (response.data == "1") {
                 return {code: 1, msg: "success"};
             }
 

+ 6 - 0
webServer/src/controller/ApiController.ts

@@ -1075,6 +1075,12 @@ class ApiController {
                 "aiqi7777",
                 "aiqi8888",
                 "aiqi9999",
+                "gf555",
+                "gf666",
+                "gf777",
+                "gf100",
+                "gf200",
+                "gf300",
             ];
             let param: string = "";
 

+ 1 - 1
webServer/src/server.ts

@@ -23,7 +23,7 @@ let serverManager: ServerManager;
 // 启动服务器
 async function startServer() {
   // 先初始化MongoDB
-  await initializeMongoDB();
+  // await initializeMongoDB();
   
   // 创建服务器管理器实例
   serverManager = new ServerManager(router);