SCFC 1 рік тому
батько
коміт
614d39bd4b

+ 13 - 0
script/module/chat/Gm.lua

@@ -736,6 +736,19 @@ function d3.buy(human,val)
 	--AdminLogic.adminFunction.tencentPay(msg)
 end
 
+function d3.buyCharge(human, val)
+	local BuyExcel = require("excel.buy")
+	local buyConf = BuyExcel.buy[val]
+	if not buyConf then
+		return
+	end
+
+	local tOJsonInput = {}
+	tOJsonInput.buyID = buyConf.id
+	tOJsonInput.price = buyConf.CN
+	tOJsonInput.money = buyConf.CN
+	BuyLogic.charge(human, tOJsonInput)
+end
 
 function d3.gol(human)
     local AdminLogic = require("AdminLogic")

+ 37 - 0
script/module/guide/GuideDefine.lua

@@ -0,0 +1,37 @@
+--------------------------------
+-- 文件名       :  GuideDefine.lua
+-- 文件说明     :  创角流程相关定义
+-- 创建时间     :   2024/12/11
+-- 创建人       :   FC
+--------------------------------
+
+-- createRoleReward
+
+-- 需要发送奖励的行为 和奖励
+-- guide.lua
+--[[
+    [子行为] = 
+    {
+        [main_guide ID] = {
+            [sub_guide ID] = {奖励}
+        }
+    } 
+]]
+tGuidePrizeBehavior = 
+{
+    ["createRoleReward"] = {
+        [100] = {
+            [104] = {{1203,1}, {118, 10}, {101, 100000000}},
+        },
+    },
+}
+
+-- 新手引导主ID
+tGuideNoJumpInfo = 
+{
+    -- main_guideID 
+    [100] = {
+        -- nSubStep 步骤
+        [3] = 1,
+    }
+}

+ 69 - 1
script/module/guide/GuideLogic.lua

@@ -34,7 +34,7 @@ local OpenActExcel = require("excel.openAct")
 local OpenAct = require("present.OpenAct")
 local CommonDB = require("common.CommonDB")
 local OpenServerGiftLogic = require("present.OpenServerGiftLogic")
-
+local GuideDefine = require("guide.GuideDefine")
 
 local WeiLen = 30
 local GUIDECMD_LIST = {"battle"}
@@ -184,6 +184,14 @@ function setGuideStep(human, step, sid)
         return 
     end
     human.db.guide.step = step
+    if step then
+        print("[setGuideStep] step = "..step)
+    end
+
+    if sid then
+        print("[setGuideStep] sid = "..sid)
+    end
+    
     if sid then
         Log.write(Log.LOGID_OSS_GUIDE_SUB, human.db._id, human.db.account, human.db.name, human.db.lv, human.db.ip, human.pf or "", human.appid, sid)
     end
@@ -421,6 +429,10 @@ end
 function skipGuide(human)
     local id = getGuideID(human) 
     local state = getGuideState(human)
+    local nSubStep = getGuideStep(human)
+    local nNextSubStep = nSubStep + 1
+
+    print("[skipGuide] nSubStep = "..nSubStep)
     if id and state == STATE_FINISH then
         return
     end
@@ -442,6 +454,7 @@ function skipGuide(human)
         end
     elseif cf.skipType == SKIPTYPE_JUMP_NAME then
         if human.db.changeNameCnt ~= nil then
+            print("[skipGuide] changeNameCnt = "..human.db.changeNameCnt)
             isJump = true
         end
     
@@ -488,6 +501,18 @@ function skipGuide(human)
             end
         end
     end
+
+    if isJump == true then
+        -- 存在且进行中
+        if id and STATE_DOING == state then
+            print("[skipGuide] id = "..id)
+            local tNoJumpInfo = GuideDefine.tGuideNoJumpInfo[id]
+            if tNoJumpInfo and tNoJumpInfo[nNextSubStep] then
+                return
+            end
+        end
+    end
+
     if isJump then
         --跳过所有战斗
         for i = CombatDefine.COMBAT_TYPE1,  CombatDefine.COMBAT_TYPE_MAX do
@@ -495,9 +520,49 @@ function skipGuide(human)
         end
         return setGuide(human, id, STATE_FINISH, cf.skipType)
     end
+    local nJump = isJump and 1 or 0
+    print("[skipGuide] nJump = "..nJump)
     setGuideStep(human, nil)
 end
 
+-- 奖励判断操作
+local function GuideLogic_StepPrize(human, nNowStep, nNowSubStep)
+    if not human or 0 >= nNowSubStep or 0 >= nNowStep then
+        return
+    end
+
+    local tSubConfig = GuideExcel.sub_guide[nNowSubStep]
+    if not tSubConfig  then
+        return
+    end
+
+   local szBehaviorName = tSubConfig.behavior[1]
+   if not szBehaviorName then
+        return
+   end
+
+   print("[GuideLogic_StepPrize] szBehaviorName = "..szBehaviorName.." nNowStep = "..nNowStep.." nNowSubStep = "..nNowSubStep)
+   local tPrizeConfig = GuideDefine.tGuidePrizeBehavior[szBehaviorName]
+   if not tPrizeConfig or not tPrizeConfig[nNowStep] or not tPrizeConfig[nNowStep][nNowSubStep] then
+        return
+   end
+
+   local tPrize = tPrizeConfig[nNowStep][nNowSubStep]
+
+   local tGoodsInfo = {}
+    for k, v in pairs(tPrize) do
+        table.insert(tGoodsInfo, {v[1],v[2]})
+
+        -- 获取奖励写日志
+        Log.write(Log.LOGID_OSS_GUIDE_SUB, "[GuideLogic_StepPrize] 玩家创角步骤获取到奖励 name = "
+                ..human.db.name.." _id = "..human.db._id.." nGoodsID = "..v[1].." nGoodsNum = "..v[2].." nNowStep = "..nNowStep .. " nNowSubStep = "..nNowSubStep)
+    end
+
+    BagLogic.addItemList(human, tGoodsInfo, "guide")
+
+    print("[GuideLogic_StepPrize] 玩家创角发送奖励 name = "..human.db.name)
+end
+
 ---------------------------- condition -----------------------------------
 GuideCondition = {}
 GuideCondition["lv"] = function(human, lv, checkAct)
@@ -630,6 +695,8 @@ function sendStep(human, sendNil)
     local nextstep = getGuideStep(human) + 1
     local state = getGuideState(human)
 
+    print("[sendStep] id = "..id.." nextstep = "..nextstep.." state = "..state)
+    
     local msgRet = Msg.gc.GC_GUIDE_STEP
     msgRet.step[0] = 0
     if cf and state == STATE_DOING then
@@ -714,6 +781,7 @@ function stepFinish(human, sid, noSend)
         else
             setGuideStep(human, step, sid)
         end
+        GuideLogic_StepPrize(human, id, sid)
     end
 
     refreshGuide(human)