小楼社区

 找回密码
 立即注册

求助 诛仙宠物LUA脚本 怎么修改宠物采集时间 15分钟一次简直虐心

[复制链接]
斩风 发表于 2016-10-14 22:52:36 | 显示全部楼层 |阅读模式
如题 求大神指教 我是在这里面改的每次都能成功采集物品 但是采集时间我死活找不到 求大神帮忙啊



---分别为宠物id,宠物对象,采集类型(共六种)
        local DataIndex=ZLuaPetBedgeDataIndex()
        local CollectTypes=ZLuaPetCollectTypes()
        local Msg =ZLuaPetCollectMsg()
        local Acuity=pet:QueryData(DataIndex["acuity"]) + pet:QueryData(DataIndex["fatalityaddacuity"])or 0
        local Stamina=pet:QueryData(DataIndex["stamina"])        + pet:QueryData(DataIndex["fatalityaddstamina"]) or 0
        local Sawy=pet:QueryData(DataIndex["sawy"]) + pet:QueryData(DataIndex["fatalityaddsawy"]) or 0
        local Dowry=pet:QueryData(DataIndex["dowry"]) +        pet:QueryData(DataIndex["fatalityadddowry"])or 0
        local Wisdom=pet:QueryData(DataIndex["wisdom"])  + pet:QueryData(DataIndex["fatalityaddwisdom"])or 0
        local CNR=pet:QueryData(DataIndex["cnr"]) + pet:QueryData(DataIndex["fatalityaddcnr"])or 0

        local Level= pet : QueryLevel() or 1
        local Star = pet : QueryStar() or 1
        --- 获得当前饱食度值,对其进行操作
        local msgid =        Msg["Wrong"]
        local origin=pet:QueryData(DataIndex["orign"])
        local Curhunger = pet:QueryCurHungerPoint() or 0
        ---local Curhunger = pet:QueryMaxHungerPoint(DataIndex["maxhunger"])
        local maxhunger = pet:QueryMaxHungerPoint() or 1
        ---每次减少100饱食度
        local newHungerValue = Curhunger - 1

        local channel = 0
        local count = 0
        local returnedthing = 0
  ---调用ZLuaPetCollectValueKey(),ZLuaPetCollectDropCount(),ZLuaPetCollectDropQuality()获得掉落数量和质量
        local ValueOfMode,ValueOfStar,ValueOfLevel,ValueOfAttribute,RateOfHunger=ZLuaPetCollectValueKey(pet,Mode,Star,Level,Curhunger,maxhunger,Collecttype)

        local DropQualityKey = ZLuaPetCollectDropQuality(ValueOfStar,ValueOfLevel,ValueOfMode,ValueOfAttribute)
        local DropCountKey   = ZLuaPetCollectDropCount(ValueOfMode,RateOfHunger)
        local LevelStep      = ZLuaPetCollectLevelSelect(Level)
        --[[if DropCountKey ~=0 then
                counttt =counttt+1
        end
        if DropQualityKey ==2 then
          nice = nice +1
         elseif DropQualityKey==3 then
          elite = elite+1
         end--]]
        ---
        if Curhunger < 100  and  Curhunger>=0  then
                                msgid =Msg["Hungery"]
               
        elseif Curhunger < 0 then
                                pet:SetCurHungerPoint(0)         
                     ZLuaPetBedgeRebuild(pet_tid,pet,origin)
                                msgid=Msg["Wrong"]
       
        elseif Curhunger >= 100 then
              pet:SetCurHungerPoint(newHungerValue)                 
              ZLuaPetBedgeRebuild(pet_tid,pet,origin)
              count = DropCountKey
              if         (((0<= Acuity) and (Acuity<=100))
                    and (( 0<= Stamina) and (Stamina <= 100))
                    and ((0<= Dowry) and (Dowry <=100))
                    and ((0<= Wisdom) and (Wisdom<=100))
                    and ((0<=CNR) and (CNR<=100))
                    and ((0<=Sawy) and (Sawy<=100)))
                    and ((0<Level) and (Level<=150))
                    and ((0<Star) and (Star<=20))        
                    and (( collecttype<=6) and (collecttype>=0))  then
                                        local maxmetatable   = table.maxn(ItemList[collecttype+1][DropQualityKey])       
                                        ---print("maxmetatable : "..maxmetatable)               
                                        if Level< 30 then
                                                                msgid = Msg["NotEnoughLevel"]
                                        elseif ValueOfAttribute ==0 then
                                                     if     collecttype == 0 then
                                                             msgid = Msg["cannotzhongzhi"]
                                                     elseif collecttype == 1 then
                                                             msgid = Msg["cannotfamu"]
                                                    elseif collecttype == 2 then
                                                             msgid = Msg["cannotshoulie"]
                                                    elseif collecttype == 3 then
                                                             msgid  = Msg["cannotdiaoyu"]
                                                     elseif collecttype == 4 then
                                                            msgid  = Msg["cannotcaikuang"]
                                                     elseif collecttype == 5 then
                                                             msgid  = Msg["cannotkaogu"]
                                                      end
                                        elseif ValueOfAttribute ~=0 then
                                                if DropCountKey ~= 0 then
                                                        ---print("levelstep : "..LevelStep)
                                                     returnedthing = ItemList[collecttype+1][DropQualityKey][math.random(maxmetatable/6*LevelStep+1,maxmetatable/6*(LevelStep+1))]
                                                     if     collecttype == 0 then
                                                             msgid = Msg["succzhongzhi"]
                                                     elseif collecttype == 1 then
                                                             msgid = Msg["succfamu"]
                                                    elseif collecttype == 2 then
                                                             msgid = Msg["succshoulie"]
                                                    elseif collecttype == 3 then
                                                             msgid  = Msg["succdiaoyu"]
                                                     elseif collecttype == 4 then
                                                            msgid  = Msg["succcaikuang"]
                                                     elseif collecttype == 5 then
                                                             msgid  = Msg["succkaogu"]
                                                      end
                                    elseif DropCountKey == 0 then
                                                    if     collecttype == 0 then
                                                             msgid = Msg["badluckzhongzhi"]       
                                                    elseif collecttype == 1 then       
                                                            msgid = Msg["badluckfamu"]
                                                    elseif collecttype == 2 then
                                                      msgid = Msg["badluckshoulie"]
                                                    elseif collecttype == 3 then
                                                            msgid = Msg["badluckdiaoyu"]
                                                    elseif collecttype == 4 then
                                                            msgid = Msg["badluckcaikuang"]
                                                    elseif collecttype == 5 then
                                                            msgid = Msg["badluckkaogu"]
                                                    end
                                    end
                            end  
               
                end
        end
        return pet_tid,channel,msgid,returnedthing,count
end

function ZLuaPetCollectValueKey(pet,mode,Star,Level,Curhunger,maxhunger,collecttype)
        local ValueOfMode =0
        local ValueOfStar =0
        local ValueOfLevel=0
        local DataIndex=ZLuaPetBedgeDataIndex()
        local CollectTypes=ZLuaPetCollectTypes()
        local Msg =ZLuaPetCollectMsg()
        local Acuity=pet:QueryData(DataIndex["acuity"]) + pet:QueryData(DataIndex["fatalityaddacuity"])or 0
        local Stamina=pet:QueryData(DataIndex["stamina"])        + pet:QueryData(DataIndex["fatalityaddstamina"]) or 0
        local Sawy=pet:QueryData(DataIndex["sawy"]) + pet:QueryData(DataIndex["fatalityaddsawy"]) or 0
        local Dowry=pet:QueryData(DataIndex["dowry"]) +        pet:QueryData(DataIndex["fatalityadddowry"])or 0
        local Wisdom=pet:QueryData(DataIndex["wisdom"])  + pet:QueryData(DataIndex["fatalityaddwisdom"])or 0
        local CNR=pet:QueryData(DataIndex["cnr"]) + pet:QueryData(DataIndex["fatalityaddcnr"])or 0
        local Level= pet : QueryLevel() or 1
        local Star = pet : QueryStar() or 1
        local RateOfHunger = Curhunger/maxhunger or 0
        local ValueOfAttribute=0
        local DataIndex=ZLuaPetBedgeDataIndex()

        if     mode == 0 then
    ValueOfMode = 1
        elseif mode == 1 then
                ValueOfMode = 0
        elseif mode == 2 then
                ValueOfMode = 0
        else
                ValueOfMode = 0
        end
        ---星等所对应的权值
        if Star >= 10 then
                ValueOfStar = Star
        else
                ValueOfStar = 0
        end
        ---等级所对应的权值
        if Level >=70 then
                ValueOfLevel = 10
        else
                ValueOfLevel = 0
        end
        ---饱食度所对应的权值

        ---各个属性对采集的权值
        if     collecttype ==0  then
                ValueOfAttribute = Acuity
        elseif collecttype ==1 then
                ValueOfAttribute = Stamina
  elseif collecttype ==2 then
                ValueOfAttribute = Sawy
        elseif collecttype ==3 then
                ValueOfAttribute = Dowry
        elseif collecttype ==4 then
                ValueOfAttribute = Wisdom
        elseif collecttype ==5 then
                ValueOfAttribute = CNR
        else
                ValueOfAttribute = 0
        end
        if ValueOfAttribute >25 then
                ValueOfAttribute = 25
        end       
        return ValueOfMode,ValueOfStar,ValueOfLevel,ValueOfAttribute,RateOfHunger
end   

function ZLuaPetCollectDropCount(ValueOfMode,RateOfHunger)
---影响掉落概率的最终权值
---DropKey = ( Mode * 0.8 + Random(0.2-2.2) ) * (1 + HungerRate)/2
        local DropCountKey = 0
        local a = (ValueOfMode*8000 +math.random(2000,22000))*(1 + RateOfHunger)/2
        if a < 10000 then
                DropCountKey = 1
        elseif a>=10000 and a < 20000 then
                DropCountKey = 1
        elseif a>=20000 and a < 30000 then
                DropCountKey = 2
  elseif a>=30000  then
                DropCountKey = 3
        end
        return DropCountKey
end

function ZLuaPetCollectLevelSelect(level)
        local levelstep
        if level <= 70 then
                levelstep =1
        elseif level>70 and level<=100 then
                levelstep =1
        elseif level>100 and level<=120 then
                levelstep =2
        elseif level>120 and level<=135 then
                levelstep =3
        elseif level>135 and level<=145 then
                levelstep =4
        elseif level>145 then
                levelstep =5
        end
        return levelstep
end
               
function ZLuaPetCollectDropQuality(ValueOfStar,ValueOfLevel,ValueOfMode,ValueOfAttribute)
---影响掉落物品品质的最终权值   QualityKey =  Random((Star+Level),99) + Attribute + Mode
        local DropQualityKey = 1
        local b =  (math.random(0+ValueOfStar+ValueOfLevel,999)) + ValueOfAttribute+ ValueOfMode*15
        if b < 850 then
                DropQualityKey = 1
        elseif b>=850 and b < 950 then
                DropQualityKey = 2
  elseif b>=950 and b < 975 then
                DropQualityKey = 3
  elseif b>=975 and b < 985 then
                DropQualityKey = 4
  elseif b>=985 and b < 990 then
                DropQualityKey = 5               
        elseif b>=990 then
                DropQualityKey = 6
        end
        return DropQualityKey       
end

function PetBedgeAskCollectRequirement(pet_tid,pet,collecttype)
        local RequireList = {}
  ---物品ID
        local RequireList = {}
  ---物品ID
        local RequireList = {}
  ---物品ID
        local RequireList = {}
  ---物品ID
        local RequireList = {}
  ---物品ID
        local RequireList = {}
  ---物品ID
  local RequireList = {18305}
        if pet_tid ~= nil then
                ---此表具体物品未定       
                local hunger = pet:QueryCurHungerPoint() or 1
                if hunger >= 100 then
                                if collecttype == 0 then
                                        return RequireList[1],1
                                elseif collecttype ==1 then
                                  return RequireList[1],1
                                elseif collecttype ==2 then
                                  return RequireList[1],1
                                elseif collecttype ==3 then
                                  return RequireList[1],1
                                elseif collecttype ==4 then
                                  return RequireList[1],1
                                elseif collecttype ==5 then
                                  return RequireList[1],1
                          else
                                         return 0,0
                                end
                else  return 0,0
                end
        else
                        return 0,0
        end
end
还有怎么上传不了附件 哎  求大神解答
^-~↙无邪的笑靥 发表于 2018-6-24 21:20:11 | 显示全部楼层

回帖奖励 +1 RMB金钱

不在脚本里 会不会在GS里
回复 支持 反对

使用道具 举报

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

Archiver|手机版|小黑屋|小楼社区.

GMT+8, 2024-10-5 04:40 , Processed in 0.102657 second(s), 19 queries .

Powered by Discuz! X3.4

© 2001-2023 Discuz! Team.

快速回复 返回顶部 返回列表