--Cheat_Controller比较特殊,是用来作弊的,可以直接访问战斗内核,直接修改战斗内核对象 local Cheat_Controller = {} local private = {} local EventSystem = require('Event/EventSystem') local WorldBossAutoTest = require("Tools/WorldBossAutoTest") local ArgParser = require("Tools/ArgParser") local LuaUpdater = require("Main/LuaUpdater") local LuaFuncEntry = require("Main/LuaFuncEntry") local itemKeys = nil local itemDict = nil local CheatConfig = require("Modules/Cheat/CheatConfig") local dragonPlayerGsTable = {"属性强", "属性弱"} local dragonPlayerNameTable = {"有名字", "无名字"} local dragonPlayerDescribeDic = {["gsHigh"] = "属性强", ["gsLow"] = "属性弱", ["hasName"] = "有名字", ["noName"] = "无名字", ["属性强"] = "gsHigh", ["属性弱"] = "gsLow", ["有名字"] = "hasName", ["无名字"] = "noName",} local dragonPlayerDic = { ["阵营1"] = { ["gsHigh"] = {["hasName"] = {2101,2102,2403,2404}, ["noName"] = {2105,2106,2407,2408}}, ["gsLow"] = {["hasName"] = {2109,2110,2411,2412}, ["noName"] = {2113,2114,2415,2416}} }, ["阵营2"] = { ["gsHigh"] = {["hasName"] = {2201,2202,2103,2104}, ["noName"] = {2107,2108,2205,2206}}, ["gsLow"] = {["hasName"] = {2111,2112,2209,2210}, ["noName"] = {2115,2116,2213,2214}} }, ["阵营3"] = { ["gsHigh"] = {["hasName"] = {2203,2204,2301,2302}, ["noName"] = {2207,2208,2305,2306}}, ["gsLow"] = {["hasName"] = {2211,2212,2309,2310}, ["noName"] = {2215,2216,2313,2314}} }, ["阵营4"] = { ["gsHigh"] = {["hasName"] = {2303,2304,2401,2402}, ["noName"] = {2307,2308,2405,2406}}, ["gsLow"] = {["hasName"] = {2311,2312,2409,2410}, ["noName"] = {2315,2316,2413,2414}} }, } --回放造假专用,目前用于龙脉回放。40个一组,每组对应不同语言 local AllFakeGuildName = { --1-40 简中 "狂战霸主", "横行无双", "彼岸之神", "酷酷孤皇", "圣王堂", "狂气纵横", "陨星苍龙", "九龙神话", "御林天团", "风斩一吻", "霸心无求", "傲影无极", "不败连萌", "至尊至尊", "很狠恨痕", "绝世梦境", "无限战意", "武圣殿", "星空之下", "汉鼎之巅", "空月皇族", "大汉情深", "狂歌魅影", "飞将联合", "龙凤阁", "斗苍痕", "傲视水月", "黑色神话", "龙殿星阁", "虎镇山海", "傲剑寒香", "龙魂幻影", "止战无殇", "拼一把嘿", "霸刀轨迹", "不战狂人", "醉意楼", "天涯飘雪", "湮雨盟", "龙吟阡陌", --41-80 繁中 "狂戰霸主", "橫行無雙", "彼岸之神", "酷酷孤皇", "聖王堂", "狂氣縱橫", "殞星蒼龍", "九龍神話", "御林天團", "風斬一吻", "霸心無求", "傲影無極", "不敗聯萌", "至尊至尊", "很狠恨痕", "絕世夢境", "無限戰意", "武聖殿", "星空之下", "漢鼎之巔", "空月皇族", "大漢情深", "狂歌魅影", "飛將聯合", "龍鳳閣", "斗蒼痕", "傲視水月", "黑色神話", "龍殿星閣", "虎鎮山海", "傲劍寒香", "龍魂幻影", "止戰無殤", "拚一把嘿", "霸刀軌跡", "不戰狂人", "醉意樓", "天涯飄雪", "煙雨盟", "龍吟阡陌", --81-120 印尼语 "Barbarian","TakTertandingi","DewaNeraka","RajaSolo","SageKing","Liar","NagaMeteor","Legenda9Naga","PasukanRaja","SeranganTopan", "TanpaHasrat","BayanganMitos","JuaraImut","Supremasi","Brutalitas","LautanMimpi","JalurPerang","DewaPerang","BawahBintang","PenguasaHan", "RatuBulan","LaguCinta","SetanLagu","HeroTerbang","NagaPhoenix","LawanAngkasa","AirBulan","Kegelapan","NagaBintang","Harimaus", "PedangEs","NagaBayangan","Damai","KlubBertarung","PedangLiar","OrangGilaDamai","KlubMabuk","Salju","KabutAngin","AumanNaga", --121-140 英语 "BerserkerLords","RideRoughshod", "UnderworldGods", "CoolLonelyKing", "SageMonarch", "Wildness", "MeteorDragons", "9DragonsLegend", "TheRoyalArmy", "StormSlash", "NoDesire", "ShadowLegend", "CuteWinners","Supremay","ExtremelyCruel","GreatDreamland","EndlessWarpath","WarSaintPalace","UnderTheStars","PeakOfHan", "MoonRoyalty","LoveInHan","GhostOfSongs","FlyingBoss","DragonPhoenix","FightWithSky","XWaterMoon","DarkLegend","DragonStarClub","TigerCrushAll", "IceSword","DragonPhantom","Ceasefire","GoForIt","WildBlade","PeacefulMadmen","DrunkClub","Snowing","MistyRainUnion","DragonRoar", } local monsterFactoryKeys = {"101-盾阵", "102-长蛇阵", "103-方阵", "104-三角阵","105-圆阵","106-八卦阵", "107-BOSS", } local testBossAttrKeys = {"血量", "血量上限", "攻击", "防御"} local testBossAttr = {["血量"] = "hp", ["血量上限"] = "hplmt", ["攻击"] = "atk", ["防御"] = "def"} local pcCheatLevelID = {4603301,4603302,4603303,4603304,4603305,4603306,4603401,4603402,4603501,4603502,4603503,4603504,4603505,4603506,4603507,4603508,4603509,4603510,4603511, 4603601,4603602,4603603,4603604,4603605,4603606,4603701,4603702} local CommandArr = {}; local CommandExcuteDict = {}; local sortTab = {} local damageFactorStrList = {} local HurtFormulaStep = LuaConst.HurtFormulaStepEnum --需要与C#中传入的CheatFuncType对应 local CheatFuncType = { ChangeSkillCD = 1, ShowCurrentAttackRange = 2, HideCurrentAttackRange = 3, ShowAttackRange = 4, AddBuff = 5, DeleteBuff = 6, ChangeAttr = 7, StopPlayTimelineList = 8, StartPlayTimelineList = 9, ReplaceMusouSkillByWeaponLevel = 10, SetAttrPlayerStrengthType = 11, SetAttrPlayerLevel = 12, SetRandomValue = 13, ChangeInitAttr = 14, WorldBossAutoFightTest = 15, UsePvpModel = 16, UsePveModel = 17, Update = 18, SwitchHitFlyCountRecordState = 19, SwitchAutoFight = 20, ShowWinPoseWithHeroId = 21, ShowWinPose = 22, ShowMonsterColliderBox = 23, HideMonsterColliderBox = 24, ShowGuildBossRoomList = 25, ChangeGuildBossRoom = 26, IndividualCheer = 27, GuildCheer = 28, CheatBeginAutoFindPath = 29, FillFP = 30, FillSA = 31, SetReplayPlayerID = 32, ReplaySyncLevel = 33, ReplayAsyncLevel = 34, SetReplayFastFrame = 35, CheatStopAutoFindPath = 36, ChangeHorse = 37, SetHitFlyDistance = 38, SaveReplayData = 39, Replay3V3Level = 40, RecordHurt = 41, AutoRunLevels = 42, PlayAllHeroWinPose = 43, PlayLastHeroWinPose = 44, PlayNextHeroWinPose = 45, ManualKCPConnect = 46, KCPConnectLastIP = 47, KillAllMonsters = 48, CreateTestMonster = 49, CreateTestEnemyHero = 50, --其他模块 Login_SendEnterWorld = 51, LevelSelect_GoldenFingerPassLevel = 52, Level_ConveyLevelByLevelID = 53, GuildBoss_SwitchGuildBossTownModel = 54, Guild_EndGuideLevel = 55, --进入英雄测试场景 EnterHeroTestScene = 56, StopPetAttack = 57, SetSkillInterCutType = 58, } local function sortRule(a,b) return a[2].sort > b[2].sort end function Cheat_Controller.OnStartup() private.SetupEntryFunc(true) EventSystem.Regist(EventID.Cheat_TestAutoGetCommond , private.TestAutoGetCommond) EventSystem.Regist(EventID.Level_InitExpLevel , private.OnInitExpLevel) private.RegistCheatCMD() private.RegisterCommandFun() CheatConfig.InitCheatCmdArgsData() private.cheatEntryFunc = {} private.InitCheatEntryFunc() end function private.SetupEntryFunc(isRegist) LuaFuncEntry.SetupMainEntryFunc(isRegist, LuaFuncEntry.FuncType.OnHandleCheatFunc, private.CSCallCheatFunc) end function Cheat_Controller.OnShutdown() private.SetupEntryFunc(false) end function private.RegistCheatCMD() for keyName, cmdData in pairs(CheatConfig.CheatCommands) do local commond = ArgParser.RegistCommand(keyName); if cmdData.params then for k, v in pairs(cmdData.params) do commond:RequiredParam(v[1], v[2], v[3]) end end if cmdData.optionalParams then for k, v in pairs(cmdData.optionalParams) do commond:OptionalParam(v[1], v[2], v[3]) end end end end function private.RegistCheatEntryFunc(funcType, func) private.cheatEntryFunc[funcType] = func end -- 注册CheatEntryFunc function private.InitCheatEntryFunc() private.RegistCheatEntryFunc(CheatFuncType.ChangeSkillCD, Cheat_Controller.ChangeSkillCD) private.RegistCheatEntryFunc(CheatFuncType.ShowCurrentAttackRange, Cheat_Controller.ShowCurrentAttackRange) private.RegistCheatEntryFunc(CheatFuncType.HideCurrentAttackRange, Cheat_Controller.HideCurrentAttackRange) private.RegistCheatEntryFunc(CheatFuncType.ShowAttackRange, Cheat_Controller.ShowAttackRange) private.RegistCheatEntryFunc(CheatFuncType.AddBuff, Cheat_Controller.AddBuff) private.RegistCheatEntryFunc(CheatFuncType.DeleteBuff, Cheat_Controller.DeleteBuff) private.RegistCheatEntryFunc(CheatFuncType.ChangeAttr, Cheat_Controller.ChangeAttr) private.RegistCheatEntryFunc(CheatFuncType.StopPlayTimelineList, Cheat_Controller.StopPlayTimelineList) private.RegistCheatEntryFunc(CheatFuncType.StartPlayTimelineList, Cheat_Controller.StartPlayTimelineList) private.RegistCheatEntryFunc(CheatFuncType.ReplaceMusouSkillByWeaponLevel, Cheat_Controller.ReplaceMusouSkillByWeaponLevel) private.RegistCheatEntryFunc(CheatFuncType.SetAttrPlayerStrengthType, Cheat_Controller.SetAttrPlayerStrengthType) private.RegistCheatEntryFunc(CheatFuncType.SetAttrPlayerLevel, Cheat_Controller.SetAttrPlayerLevel) private.RegistCheatEntryFunc(CheatFuncType.SetRandomValue, Cheat_Controller.SetRandomValue) private.RegistCheatEntryFunc(CheatFuncType.ChangeInitAttr, Cheat_Controller.ChangeInitAttr) private.RegistCheatEntryFunc(CheatFuncType.WorldBossAutoFightTest, Cheat_Controller.WorldBossAutoFightTest) private.RegistCheatEntryFunc(CheatFuncType.UsePvpModel, Cheat_Controller.UsePvpModel) private.RegistCheatEntryFunc(CheatFuncType.UsePveModel, Cheat_Controller.UsePveModel) private.RegistCheatEntryFunc(CheatFuncType.Update, Cheat_Controller.Update) private.RegistCheatEntryFunc(CheatFuncType.SwitchHitFlyCountRecordState, Cheat_Controller.SwitchHitFlyCountRecordState) private.RegistCheatEntryFunc(CheatFuncType.SwitchAutoFight, Cheat_Controller.SwitchAutoFight) private.RegistCheatEntryFunc(CheatFuncType.ShowWinPoseWithHeroId, Cheat_Controller.ShowWinPoseWithHeroId) private.RegistCheatEntryFunc(CheatFuncType.ShowWinPose, Cheat_Controller.ShowWinPose) private.RegistCheatEntryFunc(CheatFuncType.ShowMonsterColliderBox, Cheat_Controller.ShowMonsterColliderBox) private.RegistCheatEntryFunc(CheatFuncType.HideMonsterColliderBox, Cheat_Controller.HideMonsterColliderBox) private.RegistCheatEntryFunc(CheatFuncType.ShowGuildBossRoomList, Cheat_Controller.ShowGuildBossRoomList) private.RegistCheatEntryFunc(CheatFuncType.ChangeGuildBossRoom, Cheat_Controller.ChangeGuildBossRoom) private.RegistCheatEntryFunc(CheatFuncType.IndividualCheer, Cheat_Controller.IndividualCheer) private.RegistCheatEntryFunc(CheatFuncType.GuildCheer, Cheat_Controller.GuildCheer) private.RegistCheatEntryFunc(CheatFuncType.CheatBeginAutoFindPath, Cheat_Controller.CheatBeginAutoFindPath) private.RegistCheatEntryFunc(CheatFuncType.FillFP, Cheat_Controller.FillFP) private.RegistCheatEntryFunc(CheatFuncType.FillSA, Cheat_Controller.FillSA) private.RegistCheatEntryFunc(CheatFuncType.SetReplayPlayerID, Cheat_Controller.SetReplayPlayerID) private.RegistCheatEntryFunc(CheatFuncType.ReplaySyncLevel, Cheat_Controller.ReplaySyncLevel) private.RegistCheatEntryFunc(CheatFuncType.ReplayAsyncLevel, Cheat_Controller.ReplayAsyncLevel) private.RegistCheatEntryFunc(CheatFuncType.SetReplayFastFrame, Cheat_Controller.SetReplayFastFrame) private.RegistCheatEntryFunc(CheatFuncType.CheatStopAutoFindPath, Cheat_Controller.CheatStopAutoFindPath) private.RegistCheatEntryFunc(CheatFuncType.ChangeHorse, Cheat_Controller.ChangeHorse) private.RegistCheatEntryFunc(CheatFuncType.SaveReplayData, Cheat_Controller.SaveReplayData) private.RegistCheatEntryFunc(CheatFuncType.Replay3V3Level, Cheat_Controller.Replay3V3Level) private.RegistCheatEntryFunc(CheatFuncType.RecordHurt, Cheat_Controller.RecordHurt) private.RegistCheatEntryFunc(CheatFuncType.AutoRunLevels, Cheat_Controller.AutoRunLevels) private.RegistCheatEntryFunc(CheatFuncType.PlayAllHeroWinPose, Cheat_Controller.PlayAllHeroWinPose) private.RegistCheatEntryFunc(CheatFuncType.PlayLastHeroWinPose, Cheat_Controller.PlayLastHeroWinPose) private.RegistCheatEntryFunc(CheatFuncType.PlayNextHeroWinPose, Cheat_Controller.PlayNextHeroWinPose) private.RegistCheatEntryFunc(CheatFuncType.ManualKCPConnect, Cheat_Controller.ManualKCPConnect) private.RegistCheatEntryFunc(CheatFuncType.KCPConnectLastIP, Cheat_Controller.KCPConnectLastIP) private.RegistCheatEntryFunc(CheatFuncType.KillAllMonsters, Cheat_Controller.KillAllMonsters) private.RegistCheatEntryFunc(CheatFuncType.CreateTestMonster, Cheat_Controller.CreateTestMonster) private.RegistCheatEntryFunc(CheatFuncType.CreateTestEnemyHero, Cheat_Controller.CreateTestEnemyHero) private.RegistCheatEntryFunc(CheatFuncType.StopPetAttack, Cheat_Controller.StopPetAttack) private.RegistCheatEntryFunc(CheatFuncType.SetSkillInterCutType, Cheat_Controller.SetSkillInterCutType) private.RegistCheatEntryFunc(CheatFuncType.Login_SendEnterWorld,function(...) MDL.Login.SendEnterWorld(...) end) private.RegistCheatEntryFunc(CheatFuncType.LevelSelect_GoldenFingerPassLevel, function(...) MDL.LevelSelect.GoldenFingerPassLevel(...) end) private.RegistCheatEntryFunc(CheatFuncType.Level_ConveyLevelByLevelID, function(...) CTL.Level.ConveyLevelByLevelID(...) end) private.RegistCheatEntryFunc(CheatFuncType.GuildBoss_SwitchGuildBossTownModel, function(...) CTL.GuildBoss.SwitchGuildBossTownModel(...) end) private.RegistCheatEntryFunc(CheatFuncType.Guild_EndGuideLevel, function(...) CTL.Guide.EndGuideLevel(...) end) private.RegistCheatEntryFunc(CheatFuncType.EnterHeroTestScene, private.EnterHeroTestScene) end function private.EnterHeroTestScene(heroIndex, seed) require("Common/define") UTL.Material.InitCircleHpMaterialPool() LogicRandom.SetRandomPool(seed) LogicUpdateManager.ChangeOnlineState(false) NotSyncBattleSetter.Set_CheatHeroIndex(heroIndex) CTL.Login.OnLoadGameLevel(false) end function private.enterHeroTestLevel(cmd, param) private.EnterHeroTestScene(param.heroID, math.random(1, 10000)) end function private.enterBattleTestLevel(cmd, param) CTL.Cheat.AutoRunBattleProfiler(param.levelID, param.playerID, param.playerCount) end function private.replayBattleLevel(cmd, param) CTL.Replay.StartReplay(param.dataFilePath, param.playerID, param.startFrame) end function private.CSCallCheatFunc(cheatFuncType, ...) private.cheatEntryFunc[cheatFuncType](...) end function Cheat_Controller.GetCommandData(commandName) return ArgParser.GetCommand(commandName); end function Cheat_Controller.GetCommandCfgData(commandName) return CheatConfig.CheatCommands[commandName]; end function Cheat_Controller.GetCommandsByGroup(groupType) if not CommandArr[groupType] then table.clearArray(sortTab) CommandArr[groupType] = {}; for commandName, commandCfgData in pairs(CheatConfig.CheatCommands) do if commandCfgData.viewGroupType == groupType then table.insert(sortTab, { commandName, commandCfgData }) end end table.sort(sortTab, sortRule) for _,v in ipairs(sortTab) do local commandData = ArgParser.GetCommand(v[1]) if not NetManager.IsLaunch() or (v[2].clientOnly and not v[2].dependLogin) then table.insert(CommandArr[groupType], commandData) end end end return CommandArr[groupType]; end function Cheat_Controller.ChangeSkillCD() local value = GlobalBattleData.Get_IsSkillNoCD() NotSyncBattleSetter.Set_IsSkillNoCD(not value) end function Cheat_Controller.DoFileByUrl(url) local HttpReq = require("Http/HttpReq") local path if UNITY_EDITOR then path = ConstAssetPathConfig.path else path = "TKData/LuaScripts/remote_temp_file.lua" end HttpReq.StartHttpDownload(url, path, function() require("remote_temp_file") end) end --region 怪物实验室 function Cheat_Controller.Update() if MDL.Cheat.Get_IsWorldBossAutoFightTest() then WorldBossAutoTest.TryAutoEnterWorldBoss() end end function private.OnInitExpLevel() if BattleDataGetter.IsMonsterTestLevel() then CTL.HomeMain.OpenPreBattleSceneUI() end end function private.TestAutoGetCommond() if LevelManager.IsSyncWorldBossLevel() then WorldBossAutoTest.GetCommand() end end function Cheat_Controller.KillAllMonsters() LevelItemManager.ClearMonsterItem() for key, entity in pairs(LogicUpdateManager._entityDic) do if entity._logicInitData.CharacterType ~= LuaConst.CharacterType.Hero and entity._logicInitData.CharacterType ~= LuaConst.CharacterType.Adjutant then SystemManager.DeadQuit(entity) end end end function Cheat_Controller.LogMonstersCount() local mytotal = 0 local otherTotal = 0 local result = "" local myFeature = {} local othersFeatrue = {} local myCampID = LogicUpdateManager._curEntity:GetCampID() local myEntityList = CampManager.GetEntityListOfCampId(myCampID) for i, entity in ipairs(myEntityList) do local featureID = entity.components.base.CurMonsterFeature.ID if not myFeature[featureID] then myFeature[featureID] = 1 else myFeature[featureID] = myFeature[featureID] + 1 end mytotal = mytotal + 1 end local otherList = CampManager.Get2DEnitityListExceptCampId(myCampID) for key, otherentityLists in ipairs(otherList) do for i, entity in ipairs(otherentityLists) do local featureID = entity.components.base.CurMonsterFeature.ID if not othersFeatrue[featureID] then othersFeatrue[featureID] = 1 else othersFeatrue[featureID] = othersFeatrue[featureID] + 1 end otherTotal = otherTotal + 1 end end result = "我方总数:" .. tostring(mytotal) .. "\n" for mf, count in pairs(myFeature) do result = result .. tostring(mf) .. ":" .. tostring(count) .. "\n" end result = result .. "|敌方总数:" .. tostring(otherTotal) .. "\n" for of, count in pairs(othersFeatrue) do result = result .. tostring(of) .. ":" .. tostring(count) .. "\n" end return result end --endregion --region replay function Cheat_Controller.SaveReplayData(val) BattleSimulator.Client_SaveReplayData(val) end function Cheat_Controller.Replay3V3Level() BattleSimulator.StartClientData() end function Cheat_Controller.ReplaySyncLevel(needSplitFrame) if needSplitFrame then local clientProfilerSaveAndRideCmdManager = require("Battle/Logic/NetWork/ClientProfilerSaveAndRideCmdManager") clientProfilerSaveAndRideCmdManager.CheckHasReplayFile(function() BattleSimulator.StartServerData(nil, needSplitFrame) end) else BattleSimulator.StartServerData() end end function Cheat_Controller.ReplayAsyncLevel(levelType) if levelType == LuaConst.LevelType.RogueLike then CTL.Replay.StartPlayAsyncLevel_ByFile("roguelike") else BattleSimulator.ReplayAsyncLevel() end end function Cheat_Controller.SetReplayFastFrame(fastFrame) BattleSimulator.FastPlayFrame = fastFrame end function Cheat_Controller.SetReplayPlayerID(playerID) BattleSimulator.SetPlayerID(playerID) end function Cheat_Controller.ResetFakeInfo() private.fakeGuildDic = {} private.fakeNameDic = {} end function private.GetFakeGuildName(realName) local name = private.fakeGuildDic[realName] if not name then local indexGap, startIndex, endIndex = 40 if Localization.IsChinese() then startIndex, endIndex = 1, indexGap elseif Localization.IsTraditional() then startIndex, endIndex = indexGap + 1, 2 * indexGap elseif Localization.IsIndonesian() then startIndex, endIndex = 2 * indexGap + 1, 3 * indexGap else startIndex, endIndex = 3 * indexGap + 1, 4 * indexGap --默认取英语的 end local fakeGuildNames = table.pack(table.unpack(AllFakeGuildName, startIndex, endIndex)) for i = 1, #fakeGuildNames do if realName == fakeGuildNames[i] then return realName --输入的就是假军团名,返回自己 end local used for _, v in pairs(private.fakeGuildDic) do if v == fakeGuildNames[i] then used = true --这个假名用过了,换下一个 break end end if not used then name = fakeGuildNames[i] --没用过,占坑 break end end if not name then --全都用过了,就用最后一个。目前配置满了,理论上不会发生 name = fakeGuildNames[#fakeGuildNames] end private.fakeGuildDic[realName] = name end return name end function private.CheatRefreshFakeHeadUI() if BattleDataGetter.IsOnlineTownLevel() then return --只在战斗里有效 end for _, playerID in ipairs(LevelPlayerManager.SyncPlayerIDList) do local playerInfo = LevelPlayerManager.GetPlayerInfoByPlayerIDInRoom(playerID) if playerInfo then local heroEntitys = LevelPlayerManager.GetPlayerEntitysByPlayerIDInRoom(playerID) if heroEntitys then for _, entity in ipairs(heroEntitys) do --假的势力名 local expEntity = entity.ExpEntity local fakeGuildName, guildEmblemFrame, fakeGuildEmblemContent, guildJob, guildIdentity = playerInfo.guildName, playerInfo.guildEmblemFrame, playerInfo.guildEmblemContent, playerInfo.guildJob, playerInfo.guildIdentity fakeGuildName = private.GetFakeGuildName(fakeGuildName) fakeGuildEmblemContent = string.sub(fakeGuildName, 1, 3) --cheat篡改数据 playerInfo.guildName = fakeGuildName playerInfo.guildEmblemContent = fakeGuildEmblemContent --假的昵称 local heroData = entity._logicInitData._characterData.HeroNumData if heroData then local fakeName = private.fakeNameDic[playerID] if not fakeName then --玩家名字改成武将+随机序号 fakeName = UIUtils.GetLocalizedTxt(Const_IDS[heroData.NameIDS]) .. entity.EntityID private.fakeNameDic[playerID] = fakeName end --cheat篡改数据 entity._logicInitData.Name = fakeName playerInfo.name = fakeName --刷ui expEntity:UpdateModelHeadGuildShow(entity) expEntity:UpdateModelHeadCountryShow(entity) end end end end end end --endregion replay --region 自动寻路 function Cheat_Controller.CheatBeginAutoFindPath(x, z) local pos = FP.newV2(x, z) SystemManager.AutoFindPathInTown(LogicUpdateManager._curEntity, pos, FP.Const.Two) end function Cheat_Controller.CheatStopAutoFindPath() SystemManager.StopAutoFightPathInTown(LogicUpdateManager._curEntity) end --endregion function Cheat_Controller.WorldBossAutoFightTest() local value = MDL.Cheat.Get_IsWorldBossAutoFightTest() MDL.Cheat.Set_IsWorldBossAutoFightTest(not value) end function Cheat_Controller.GetCurEntityName() if LogicUpdateManager and LogicUpdateManager._curEntity then return LogicUpdateManager._curEntity.components.base.CurCharacterData.NameIDS end return "None" end function Cheat_Controller.GetMusouBlackRoomState() local index = MDL.Setting.GetSkillInterCutType() return index == LuaConst.SkillInterCutEnum.Every end function Cheat_Controller.GetCurEntityID() local id = LogicUpdateManager._curEntity._logicInitData.EntityID return id end function Cheat_Controller.AddBuff(entityID, buffID) local entity = LogicUpdateManager._entityDic[entityID] SystemManager.AddBuff(entity, buffID, entity, nil, nil) end function Cheat_Controller.DeleteBuff(entityID, buffID) local entity = LogicUpdateManager._entityDic[entityID] SystemManager.DeleteBuff(entity, buffID, nil) local buffData = DataSheetManager.BuffData:GetDataByBuffID(buffID) entity.ExpEntity:BreakPsEffect(buffData.BuffResource) end --for debug deleteme now↓ 这里纯为了米欧展示做的,展示完毕需要删掉 function Cheat_Controller.SetHitFlyDistance(aliveHitFlyDist, deadHitFlyDist, randomDist) NotSyncBattleSetter.SetHitFlyDistance(aliveHitFlyDist, deadHitFlyDist, randomDist) end function Cheat_Controller.SwitchHitFlyCountRecordState() NotSyncBattleSetter.SwitchHitFlyCountRecordState() end --for debug deleteme now↑ function Cheat_Controller.ChangeAttr(entityID, attrID, attrVal) local entity = LogicUpdateManager._entityDic[entityID] if attrID == 100 then local val = FP.newV1(attrVal) --val:Clamp(FP.Const.Zero, entity.components.attr:GetAttrValue(LuaConst.AttrType.hplmt))--加了依赖机制,这个clamp不需要了 entity:SetAttrBaseValue("hp", val) SystemManager.OnHPChange(entity, entity, val, val, val, "sub") if val == FP.Const.Zero then entity.components.record.KillerEntity = entity SystemManager.OnDead(entity) end elseif attrID == 101 then local val = FP.newV1(attrVal) --val:Clamp(FP.Const.Zero, entity.components.attr:GetAttrValue(LuaConst.AttrType.salmt))--加了依赖机制,这个clamp不需要了 entity:SetAttrBaseValue("sa", val) SystemManager.OnSAChange(entity, val, val) elseif attrID == 102 then local val = FP.newV1(attrVal) --val:Clamp(FP.Const.Zero, entity.components.attr:GetAttrValue(LuaConst.AttrType.amlmt))--加了依赖机制,这个clamp不需要了 entity:SetAttrBaseValue("am", val) SystemManager.OnAMChange(entity, val, val) else entity:SetAttrBaseValue(LuaConst.AttrIntType[attrID], attrVal) end end function Cheat_Controller.GetEntityBuff(entityID) local result = "" local entity = LogicUpdateManager._entityDic[entityID] if not entity then return result end for i,buffObject in ipairs(entity.components.buff.CurBuffObjectList) do local buffUpdateData = buffObject.BuffUpdateData local buffUpdateList = buffObject.BuffUpdateList if buffUpdateData and buffUpdateData.BuffLayer > 0 then result = result .. "ID:" .. buffObject.BuffID .. "\n" .. "层数:" .. buffUpdateData.BuffLayer .. "\n来源无\n" end if buffUpdateList then for i, updateData in ipairs(buffUpdateList) do local sid = -1 if updateData.SourceEntity then sid = updateData.SourceEntity._logicInitData.EntityID end if updateData.BuffLayer > 0 then result = result .. "ID:" .. buffObject.BuffID .. "\n" .. "层数:" .. updateData.BuffLayer .. "\n来源id:" .. sid .. "\n" end end end end return result end function Cheat_Controller.GetEntityAttr(entityID) local result = "" local entity = LogicUpdateManager._entityDic[entityID] if not entity then return result end local attrcomp = entity.components.attr result = result .. "hp:" .. FP.tonumberV1(attrcomp.hp) .. "\n" .. "sa:" .. FP.tonumberV1(attrcomp.sa) .. "\n" .. "am:" .. FP.tonumberV1(attrcomp.am) .. "\n" for k, v in pairs(attrcomp.AttrInfo) do result = result .. "" .. k .. "" .. FP.tonumberV1(v) .. "\n" end return result end function Cheat_Controller.GetBuffByID(entityID) local result = {} local entity = LogicUpdateManager._entityDic[entityID] if (not entity) or (not entity.components.buff) then return result end for i,buffObject in ipairs(entity.components.buff.CurBuffObjectList) do local buffUpdateData = buffObject.BuffUpdateData local buffUpdateList = buffObject.BuffUpdateList if buffUpdateData and buffUpdateData.BuffLayer > 0 then table.insert(result, buffObject.BuffID) end if buffUpdateList then for i, updateData in ipairs(buffUpdateList) do if updateData.BuffLayer > 0 then table.insert(result, buffObject.BuffID) end end end end return result end function Cheat_Controller.GetAttrByID(entityID) local result = { avail = false } local entity = LogicUpdateManager._entityDic[entityID] if not entity then return result end local attrcomp = entity.components.attr result.hp = FP.tonumberV1(attrcomp.hp) result.sa = FP.tonumberV1(attrcomp.sa) result.am = FP.tonumberV1(attrcomp.am) result.pc = FP.tonumberV1(attrcomp.pc) local attrInfo = attrcomp.AttrInfo for k, attr in ipairs(LuaConst.AttrIntType) do if attrInfo[attr] then result[attr] = FP.tonumberV1(attrInfo[attr]) end end result.avail = true return result end function Cheat_Controller.GetCharacterIDByID(entityID) local entity = LogicUpdateManager._entityDic[entityID] if not entity then return -1 end local result = entity:GetCurCharacterID() return result end function Cheat_Controller.GetCampIDByID(entityID) local entity = LogicUpdateManager._entityDic[entityID] if not entity then return -1 end local result = entity:GetCampID() return result end function Cheat_Controller.GetAIDecison(entityID) local result = {} local entity = LogicUpdateManager._entityDic[entityID] if not entity then return result end local aicomp = entity.components.aiBase result.CurID = aicomp.CurDecisionID return result end function Cheat_Controller.FillSA() LogicUpdateManager._curEntity:SetAttrBaseValue("sa", LogicUpdateManager._curEntity.components.attr:MaxSA()) SystemManager.OnSAChange(LogicUpdateManager._curEntity, 100, LogicUpdateManager._curEntity.components.attr.sa) end function Cheat_Controller.FillFP() local delta = LogicUpdateManager._curEntity.components.attr:MaxHP() - LogicUpdateManager._curEntity.components.attr.hp LogicUpdateManager._curEntity:SetAttrBaseValue("hp", LogicUpdateManager._curEntity.components.attr:MaxHP()) SystemManager.OnHPChange(LogicUpdateManager._curEntity, LogicUpdateManager._curEntity, delta, delta, LogicUpdateManager._curEntity.components.attr:MaxHP(), "add") end function Cheat_Controller.ChangeFP() FP.ToggleMode() end function Cheat_Controller.SetAttrPlayerLevel(level) private.attrPlayerLevel = level end function Cheat_Controller.ChangeHorse(horseID) SystemManager.ChangeHorse(LogicUpdateManager._curEntity ,horseID) end function Cheat_Controller.SetAttrPlayerStrengthType(strType) private.attrPlayerStrengthType = strType end function Cheat_Controller.SetEntityAttrByPlayerStrengthData(entity, data) if entity then local value = nil for i,attrName in ipairs(LuaConst.AttrIntType) do value = data[attrName] if value then entity.components.attr.InitAttr[attrName] = FP.newV1(value) entity:SetAttrBaseValue(attrName, value) end if entity:IsAlive() then entity:SetAttrBaseValue("hp", entity.components.attr.InitAttr[LuaConst.AttrType.hplmt]) end entity:SetAttrBaseValue("sa", 0) end local AttrSystem = require "Battle/Logic/Entity/System/AttrSystem" AttrSystem.RecalculateAllModifyOfEntity(entity) entity:SetGs(data.PowerScore) entity._logicInitData.IsActiveMagicWeapon = data.magicweaponlevel > 0 entity._logicInitData.WeaponBreak = data.magicweaponlevel entity.components.skillBase:SetMusouSkillDynamicDamageFactor() --刷新无双技能伤害系数 --这里就不刷新神兵特效了,因为数值策划也不关心特效。而且神兵特效还会牵扯到变身,相当难搞 end end --调整预设属性 function Cheat_Controller.ChangeInitAttr() local entities = LevelPlayerManager.GetPlayerEntitysByPlayerIDInRoom(LevelPlayerManager.MyPlayerIDInRoom) local data = DataSheetManager.PlayerStrengthData:GetDataByPlayerLevel_PlayerStrengthType(private.attrPlayerLevel or 0, private.attrPlayerStrengthType or 0) if data then for i,entity in ipairs(entities) do Cheat_Controller.SetEntityAttrByPlayerStrengthData(entity, data) Cheat_Controller.SetEntityAttrByPlayerStrengthData(entity.components.adjutant.AdjutantEntity, data) end EventSystem.Dispatch(EventID.Set_CurEntity)--这个消息触发刷新战斗UI,以便显示出无双按钮 else logging.error(LTAG.ERROR, "HYW : 不存在PlayerLevel为:", private.attrPlayerLevel or 0, " PlayerStrengthType为:", private.attrPlayerStrengthType or 0, " 的PlayerStrengthData") end end local tempCritRate local tempParryRate local tempTotalDmgFactor local tempPvPAttrFactor ----查看伤害结果 start local Attacker local Target local AttackerStr = "%s -> %s \n" --local CritStr = "暴击率 :Max{ 0.8*{1- 4000/{Max[ (暴击%s-敌人暴抗%s)/10,0]+4600} } ,0.1 } = %s ;" local CritStr = "暴击率 = minMax(真实暴率%s-真实抗暴%s+max(%s*(1-%s/max((暴击值%s-敌人暴抗%s)/%s+%s,0)),%s),%s,%s) = %s ;" --9个参数 local CritRatePlusStr = "额外暴击率 = %s ; " local CritRateFinalStr = "最终暴击率 = %s; \n" local RandomStr = " 随机值:%s \n" --local CritEffStr = "暴击倍率 :Max{ 3*{1-2150/{Max[(暴击强度%s-敌人暴抗强度%s)/10,0]+3600}} ,1.2 } = %s ; \n" local CritEffStr = "暴击倍率 = minMax(真实倍率增加%s-真实倍率减少%s+max(%s*(1-%s/max((暴击效果值%s-敌人暴效抗性%s)/%s+%s,0)),%s),%s,%s) = %s ; \n" --12个参数 local NoCritStr = "本次伤害未暴击,暴击倍率设置为1 ; \n" local CritEffFinalStr = "最终暴击倍率 = 暴击倍率 + 额外暴击倍率 %s = %s ; \n" --2个参数 local ParryEffFinalStr = "最终格挡倍率 = 格挡倍率 + 额外格挡倍率(负数是破击倍率) %s = %s ; \n" --2个参数 --local ParryStr = "格挡率 :Max{ 0.4*{1-4000/{Max[(抵抗%s-敌人破击%s)/10,0]+4600}}, 0} = %s ; " local ParryStr = "基础格挡率 = minMax(真实格挡率%s-真实破击率%s+max(%s*(1-%s/max((目标格挡值%s-攻击者破击值%s)/%s+%s,0)),%s),%s,%s) = %s ;" --9个参数 --local ParryEffStr = "格挡倍率 :Max{ 0.75*{1-1900/{Max[(格挡强度%s-敌人破击强度%s)/10,0]+2400}}, 0.15} = %s ; \n" local ParryEffStr = "基础格挡倍率 = minMax(真实格挡减伤%s-真实破击倍率%s+max(%s*(1-%s/max((格挡减伤值%s-攻击者破击倍率%s)/%s+%s,0)),%s),%s,%s) = %s ; \n" --12个参数 local NoParryStr = "本次伤害未被格挡,格挡倍率设置为0 ; \n" --local BaseAtkStr = "初始伤害:攻击(技能%s+属性%s) > 1.1 * 防御%s ? 攻击-防御 , 0.1*攻击 = %s \n" local BaseAtkStr = "攻击力(技能%s+属性%s), 防御力%s ; " local AtkLessThanDefStr = "攻击*0.9<防御,初始伤害 = 0.1*攻击*pvp伤害系数(如果有) = %s ; \n" local AtkGreaterThanDefStr = "攻击*0.9>=防御,初始伤害 = (攻击-防御)*pvp伤害系数(如果有) = %s ; \n" local tempStrAdd_NoPercentHurtStr local tempStrAdd_PercentHurtStr local tempStrAdd_SumHurtStr local tempStrAdd_FinalDmgOverrideStr local tempStrAdd_PcAbsorbStr local EventDmgPercentageStr = "最大生命百分比伤害系数 = %s 最大生命值 = %s 最大生命百分比伤害 = %s 非百分比伤害 = %s \n" local NoPercentHurtStr = "非百分比伤害 = 技能倍率%s * 初始伤害 = %s \n" local PercentHurtStr = "最大生命百分比伤害系数 = %s,最大生命值 = %s,最大生命值百分比伤害 = %s \n" local SumHurtStr = "总伤害 = 非百分比伤害%s + 最大生命值百分比伤害%s = %s \n" local PcAbsorbStr = "保护罩抵挡伤害 = %s 抵挡后伤害 = %s \n" --local HurtStr = "最终伤害总量 :(百分比伤害 + 非百分比伤害*子弹伤害系数%s)* 击中分摊系数%s*(1+伤害加成%s-敌人受伤减免%s)*(1+可变的伤害加成%s-可变的受伤减免%s) * 暴击倍率 * (1-格挡倍率)* 额外伤害系数总量 - 保护罩抵挡伤害 = %s \n " local HurtStr = "最终伤害总量 = 保护罩抵挡后伤害*击中分摊系数%s*(1+伤害加成%s-敌人受伤减免%s)*(1+可变的伤害加成%s-可变的受伤减免%s) * 暴击倍率%s * (1-格挡倍率%s)* 额外伤害系数%s * 对战强度属性系数%s = %s \n" local FinalDmgOverrideStr = "存在最终伤害重载值,最终伤害被覆盖为 %s \n" local AmChangeStr = "本次攻击击破霸体值%s \n" local SaChangeStr = "本次伤害提供无双值%s \n" local DamageReturnStr = "反伤%s \n" local AttrStr = "\n---属性:攻击者:Atk%s,Sa%s ||| 被打者:HP%s, Hplmt%s, def%s, Am%s, PC%s \n" local DmgFactorStr = "叠加额外伤害系数 = %s \n" local TotalDmgFactorStr = "额外伤害系数总量 = %s \n" local FinalDmgFactorStr = "叠加最终伤害系数 = %s , 最终伤害系数 = %s" local SubjugateDmgFactorStr = "战力压制伤害系数 = %s 进攻方战力 = %s 防御方战力 = %s \n" local PvPAttrFactorStr = "对战强度属性系数 = %s \n" local PileHealFactorStr = "叠加治疗系数 = %s 当前治疗系数 = %s \n" local PilePCLossFactorStr = "叠加护盾损伤系数 = %s 当前护盾损伤系数 = %s \n" local PileParryEffRatioPlusStr = "叠加格挡比例 = %s 当前额外格挡比例 = %s \n" local PileAntiParryEffRatioPlusStr = "减少格挡比例 = %s 当前额外格挡比例 = %s \n" local PileParryRatePlusStr = "叠加格挡几率 = %s 当前额外格挡几率 = %s \n" local PileAntiParryRatePlusStr = "减少格挡几率 = %s 当前额外格挡几率 = %s \n" local PileCritRatePlusStr = "叠加暴击率 = %s 当前额外暴击率 = %s \n" local PileAntiCritRatePlusStr = "减少暴击率 = %s 当前额外暴击率 = %s \n" local PileCritEffRatioPlusStr = "叠加暴击倍率 = %s 当前额外暴击倍率 = %s \n" local PileAntiCritEffRatioPlusStr = "减少暴击倍率 = %s 当前额外暴击倍率 = %s \n" local ApplyParryRatePlusStr = "叠加额外格挡率 = %s 总格挡率 = %s \n" local PerAddNoPerDmgStr= "百分比伤害 + 非百分比伤害 = %s \n" local EDamageFactorReasonType = LuaConst.EDamageFactorReasonType local DamageFactorReasonType2StrDic = { [EDamageFactorReasonType.PVP_GS_SUBJUGATE] = "PVP压制", [EDamageFactorReasonType.PVE_GS_SUBJUGATE] = "PVE压制", [EDamageFactorReasonType.EVP_GS_SUBJUGATE] = "EVP压制", [EDamageFactorReasonType.OFFICIAL_POSITION_SUBJUGATE] = "官职压制", [EDamageFactorReasonType.MISSILE] = "子弹动态伤害系数", [EDamageFactorReasonType.MUSOU] = "无双动态伤害系数", [EDamageFactorReasonType.BUFF_OF_BATTLEFFECT] = "Buff或BattleEffect", } function Cheat_Controller.RecordHurt(isRecord) private.IsRecordHurt = isRecord if isRecord then private.AttackRecordList = {} private.CurRecordIndex = 0 EventSystem.Regist(EventID.TryAddAttackLog, Cheat_Controller.TryAddAttackLog) else EventSystem.UnRegist(EventID.TryAddAttackLog, Cheat_Controller.TryAddAttackLog) end end function Cheat_Controller.GetAttackResult(index) if private.AttackRecordList == nil then return "" end local result = private.AttackRecordList[index] if result == nil then return "" end return result end function Cheat_Controller.GetAttackResultCount() if private.AttackRecordList == nil then return 0 end return #private.AttackRecordList end function Cheat_Controller.TryAddAttackLog(type, ...) if not private.IsRecordHurt then return end local str = nil if type ~= 0 then str = private.AttackRecordList[private.CurRecordIndex] end local strAdd = nil if type == HurtFormulaStep.Step_0 then table.clearArray(damageFactorStrList) tempStrAdd_PcAbsorbStr = nil tempPvPAttrFactor = nil -- 一次伤害的开始 private.CurRecordIndex = private.CurRecordIndex + 1 if private.CurRecordIndex > 50 then private.CurRecordIndex = 50 table.remove(private.AttackRecordList, 1) end elseif type == HurtFormulaStep.Step_1 then -- 暴击率 strAdd = string.format(CritStr, ...) --old elseif type == HurtFormulaStep.Step_2 then -- 暴击倍率 local arg = {...} tempCritRate = arg[12] strAdd = string.format(CritEffStr, ...) elseif type == HurtFormulaStep.Step_3 then -- 格挡率 strAdd = string.format(ParryStr, ...) elseif type == HurtFormulaStep.Step_4 then local arg = {...} tempParryRate = arg[12] -- 格挡倍率 strAdd = string.format(ParryEffStr, ...) elseif type == HurtFormulaStep.Step_5 then -- 打印血护甲怒气 local attk, hurt, missileData, isLast = ... if attk.Entity == Attacker and hurt.Entity == Target then if isLast then strAdd = "战斗结果:\n" else strAdd = "" end local musouAtkEffStr = "" if missileData and missileData.HurtBuffFormula == "MN" then musouAtkEffStr = " 无双伤害加成:" .. tostring(attk:GetAttrValueNum("musoueff")) end strAdd = strAdd .. string.format(AttrStr, tostring(attk:GetAttrValueNum("atk")), tostring(attk.sa) .. musouAtkEffStr, tostring(hurt.hp), tostring(hurt:GetAttrValueNum("hplmt")), tostring(hurt:GetAttrValueNum("def")), tostring(hurt.am), tostring(hurt.pc)) end elseif type == HurtFormulaStep.Step_6 then -- 打印随机值 strAdd = string.format(RandomStr, ...) elseif type == HurtFormulaStep.Step_7 then -- 特殊公式打印 --do nothing elseif type == HurtFormulaStep.Step_10 then -- 伤害-初始值 local skillAtk, atk, def, hurtResultV1, pvpDmgModifier = ... strAdd = string.format(BaseAtkStr, skillAtk, atk, def) local strTemp if atk * 0.9 < def then strTemp = AtkLessThanDefStr else strTemp = AtkGreaterThanDefStr end if pvpDmgModifier then strAdd = strAdd .. " pvp伤害系数:" .. tostring(pvpDmgModifier) .. " " else strAdd = strAdd .. " 无pvp伤害系数 " end strAdd = strAdd .. string.format(strTemp, hurtResultV1) elseif type == HurtFormulaStep.Step_11 then -- 伤害-最终值 local missileDmgRate, missileHitRate, findmg, anitfindmg, findmgvar, anitfindmgvar, hurtResultV1 = ... strAdd = tempStrAdd_NoPercentHurtStr or "" tempStrAdd_NoPercentHurtStr = nil strAdd = strAdd .. (tempStrAdd_PercentHurtStr or "") tempStrAdd_PercentHurtStr = nil strAdd = strAdd .. (tempStrAdd_SumHurtStr or "") tempStrAdd_SumHurtStr = nil if tempStrAdd_PcAbsorbStr then strAdd = strAdd .. tempStrAdd_PcAbsorbStr tempStrAdd_PcAbsorbStr = nil else strAdd = strAdd .. "无护罩,保护罩抵挡后伤害 = 总伤害\n" end strAdd = strAdd .. string.format(HurtStr, missileHitRate, findmg, anitfindmg, findmgvar, anitfindmgvar, tempCritRate or 1, tempParryRate or 0, tempTotalDmgFactor or "", tempPvPAttrFactor, hurtResultV1) tempCritRate = nil tempParryRate = nil tempTotalDmgFactor = nil if tempStrAdd_FinalDmgOverrideStr then strAdd = strAdd .. tempStrAdd_FinalDmgOverrideStr tempStrAdd_FinalDmgOverrideStr = nil end elseif type == HurtFormulaStep.Step_12 then -- 保护罩抵挡伤害 tempStrAdd_PcAbsorbStr = string.format(PcAbsorbStr, ...) --strAdd = string.format(PcAbsorbStr, ...) elseif type == HurtFormulaStep.Step_13 then local arg = {...} local factor = arg[1] local reason = arg[2] local reasonStr if reason and DamageFactorReasonType2StrDic[reason] then reasonStr = " 来源: " .. DamageFactorReasonType2StrDic[reason] if reason == EDamageFactorReasonType.PVP_GS_SUBJUGATE then reasonStr = reasonStr .. " 进攻方战力" .. arg[3] .. " 防御方战力" .. arg[4] elseif reason == EDamageFactorReasonType.PVE_GS_SUBJUGATE then reasonStr = reasonStr .. " 进攻方战力" .. arg[3] .. " SubjugateDataPVE ID : " .. arg[4] elseif reason == EDamageFactorReasonType.EVP_GS_SUBJUGATE then reasonStr = reasonStr .. " 防御方战力" .. arg[3] .. " SubjugateDataPVE ID : " .. arg[4] end else reasonStr = "" end table.insert(damageFactorStrList, string.format(DmgFactorStr, tostring(factor) .. reasonStr)) --strAdd = string.format(DmgFactorStr, tostring(factor) .. reasonStr) elseif type == HurtFormulaStep.Step_14 then strAdd = string.format(SubjugateDmgFactorStr, ...) elseif type == HurtFormulaStep.Step_15 then local eventDmgPercentage, maxhp, percentHurt, notPercentHurt, missileDmgRate = ... tempStrAdd_NoPercentHurtStr = string.format(NoPercentHurtStr, missileDmgRate, notPercentHurt) tempStrAdd_PercentHurtStr = string.format(PercentHurtStr, eventDmgPercentage, maxhp, percentHurt) tempStrAdd_SumHurtStr = string.format(SumHurtStr, notPercentHurt, percentHurt, notPercentHurt + percentHurt) --strAdd = string.format(EventDmgPercentageStr, ...) elseif type == HurtFormulaStep.Step_16 then --strAdd = string.format(PerAddNoPerDmgStr, ...) elseif type == HurtFormulaStep.Step_17 then strAdd = string.format(CritEffFinalStr, ...) elseif type == HurtFormulaStep.Step_18 then strAdd = string.format(ParryEffFinalStr, ...) elseif type == HurtFormulaStep.Step_CirtRatePlus then strAdd = string.format(CritRatePlusStr, ...) elseif type == HurtFormulaStep.Step_FinalCritRate then strAdd = string.format(CritRateFinalStr, ...) elseif type == HurtFormulaStep.Step_TotalDmgFactor then strAdd = strAdd or "" for i,v in ipairs(damageFactorStrList) do strAdd = strAdd .. i .."、" .. v end table.clearArray(damageFactorStrList) tempTotalDmgFactor = ... strAdd = strAdd .. string.format(TotalDmgFactorStr, ...) elseif type == HurtFormulaStep.Step_PileFinalDmgFactor then strAdd = strAdd .. string.format(FinalDmgFactorStr, ...) elseif type == HurtFormulaStep.Step_NoCrit then strAdd = NoCritStr elseif type == HurtFormulaStep.Step_NoParry then strAdd = NoParryStr elseif type == HurtFormulaStep.Step_FinalDamageOverrideValue then tempStrAdd_FinalDmgOverrideStr = string.format(FinalDmgOverrideStr, ...) elseif type == HurtFormulaStep.Step_AmChange then strAdd = string.format(AmChangeStr, ...) elseif type == HurtFormulaStep.Step_SaChange then strAdd = string.format(SaChangeStr, ...) elseif type == HurtFormulaStep.Step_DamageReturn then strAdd = string.format(DamageReturnStr, ...) elseif type == HurtFormulaStep.Step_PvPAttrFactor then tempPvPAttrFactor = ... strAdd = string.format(PvPAttrFactorStr, tempPvPAttrFactor) elseif type == HurtFormulaStep.Step_PileHealFactor then strAdd = string.format(PileHealFactorStr, ...) elseif type == HurtFormulaStep.Step_PilePCLossFactor then strAdd = string.format(PilePCLossFactorStr, ...) elseif type == HurtFormulaStep.Step_PileParryEffRatioPlus then strAdd = string.format(PileParryEffRatioPlusStr, ...) elseif type == HurtFormulaStep.Step_PileAntiParryEffRatioPlus then strAdd = string.format(PileAntiParryEffRatioPlusStr, ...) elseif type == HurtFormulaStep.Step_PileParryRatePlus then strAdd = string.format(PileParryRatePlusStr, ...) elseif type == HurtFormulaStep.Step_PileAntiParryRatePlus then strAdd = string.format(PileAntiParryRatePlusStr, ...) elseif type == HurtFormulaStep.Step_PileCritRatePlus then strAdd = string.format(PileCritRatePlusStr, ...) elseif type == HurtFormulaStep.Step_PileAntiCritRatePlus then strAdd = string.format(PileAntiCritRatePlusStr, ...) elseif type == HurtFormulaStep.Step_PileCritEffRatioPlus then strAdd = string.format(PileCritEffRatioPlusStr, ...) elseif type == HurtFormulaStep.Step_PileAntiCritEffRatioPlus then strAdd = string.format(PileAntiCritEffRatioPlusStr, ...) elseif type == HurtFormulaStep.Step_ApplyParryRatePlus then strAdd = string.format(ApplyParryRatePlusStr, ...) end if type == HurtFormulaStep.Step_0 then local sourceEntity, targetEntity, missileData = ... Attacker = sourceEntity Target = targetEntity private.AttackRecordList[private.CurRecordIndex] = string.format(AttackerStr, sourceEntity._logicInitData.CharacterID .. ":" .. (BattleDataGetter.GetEntityName(sourceEntity) or "无名字") .. (sourceEntity.isHero and (sourceEntity:IsPlayerSelf() and "(操作者)" or "(其他玩家)") or ""), targetEntity._logicInitData.CharacterID .. ":" .. (BattleDataGetter.GetEntityName(targetEntity) or "无名字") .. (targetEntity.isHero and (targetEntity:IsPlayerSelf() and "(操作者)" or "(其他玩家)") or "") .. (missileData and "子弹ID : " .. missileData.ID or "")) elseif type == HurtFormulaStep.Step_7 then private.AttackRecordList[private.CurRecordIndex] = str .. ... .. "\n" else if str and strAdd then private.AttackRecordList[private.CurRecordIndex] = str .. strAdd end end end -----查看伤害结果 end ---- 显示攻击范围 function Cheat_Controller.ShowAttackRange(entityID, isShow) GlobalBattleData.ShowAttackRange(entityID , isShow) end function Cheat_Controller.ShowCurrentAttackRange() GlobalBattleData.ShowAttackRange(CTL.Cheat.GetCurEntityID(), true) end function Cheat_Controller.HideCurrentAttackRange() GlobalBattleData.ShowAttackRange(CTL.Cheat.GetCurEntityID(), nil) end function Cheat_Controller.UsePvpModel() LevelManager.IsNeedUsePVPModelLevel = function() return true end end function Cheat_Controller.UsePveModel() LevelManager.IsNeedUsePVPModelLevel = function() return false end end --------------------------------------Cheat 客户端命令----------------------------------------------- ---- 显示怪物碰撞盒 function Cheat_Controller.ShowMonsterColliderBox() for i, entity in ipairs(LogicUpdateManager._entityDic) do entity.ExpEntity:PlayEffectByType(LuaConst.EffectType.Debug_Square) local modelData = entity.components.base.CurModelData local scale = modelData.ModelScale entity.ExpEntity:SetEffectScaleByType(LuaConst.EffectType.Debug_Square, modelData.ShoveDiameterZ * scale, 0.03, modelData.ShoveDiameterX * scale) end end function Cheat_Controller.HideMonsterColliderBox() for i, entity in ipairs(LogicUpdateManager._entityDic) do entity.ExpEntity:StopEffectByType(LuaConst.EffectType.Debug_Square) end end function Cheat_Controller.GetItemDict() if itemKeys == nil then itemDict = {} itemKeys = {} for i, v in DataSheetManager.ItemData:GetEnumerator() do local key = UIUtils.GetLocalizedTxt(Const_IDS[v.Tips]) if itemDict[key] == nil then itemDict[key] = {} table.insert(itemKeys, key) end if not itemDict[key].dropDownValue then itemDict[key].dropDownValue = {} end if not itemDict[key].dropDownData then itemDict[key].dropDownData = {} end local itemName = UTL.Item.GetItemDataSpliceByType(v.ID).Name table.insert(itemDict[key].dropDownValue, itemName) table.insert(itemDict[key].dropDownData, {id = v.ID}) end end return {itemKeys,itemDict} end -- 参数单dropdown dataSheet-数据表, primaryKey-主键名, desIDSName-描述键名, dataPrimaryKey想要存储的数据键名(默认是主键) function Cheat_Controller.GetCheatDataDict(dataSheet, primaryKey, desIDSName, dataPrimaryKey) local dropDownData = {} dropDownData.dropDownValue = {} dropDownData.dropDownData = {} for i, v in dataSheet:GetEnumerator() do local valueStr if desIDSName then valueStr = UIUtils.GetLocalizedTxt(Const_IDS[v[desIDSName]]) else valueStr = v[primaryKey] end table.insert(dropDownData.dropDownValue, valueStr) if dataPrimaryKey then table.insert(dropDownData.dropDownData, v[dataPrimaryKey]) else table.insert(dropDownData.dropDownData, v[primaryKey]) end end return {dropDownData} end function Cheat_Controller.GetMonsterFactoryKeys() return {monsterFactoryKeys} end function Cheat_Controller.GetDragonPlayerGsTable() return {dragonPlayerGsTable} end function Cheat_Controller.GetDragonPlayerNameTable() return {dragonPlayerNameTable} end function Cheat_Controller.GetDragonPlayerDrowDownValue(drowDownValue) return dragonPlayerDescribeDic[drowDownValue] end function Cheat_Controller.GetTestBossAttrKeys() return {testBossAttrKeys} end function Cheat_Controller.GetTestBossAttrDrowDownValue(drowDownValue) return testBossAttr[drowDownValue] end function Cheat_Controller.GetGameSenceDrowDownValue() local dropDownData = {} dropDownData.dropDownValue = {} dropDownData.dropDownData = {} local levelInfoData for index, v in ipairs(pcCheatLevelID) do levelInfoData = DataSheetManager.LevelInfoData:GetDataByLevelID(v) local valueStr valueStr = UIUtils.GetLocalizedTxt(Const_IDS[levelInfoData.LevelNameIDS]) if levelInfoData.LevelType == LuaConst.LevelType.SyncSolo then valueStr = valueStr.."-1V1匹配" elseif levelInfoData.LevelType == LuaConst.LevelType.SyncTeamPVP then valueStr = valueStr.."-3V3匹配" elseif levelInfoData.LevelType == LuaConst.LevelType.SyncTestLevel then valueStr = valueStr.."-同步关卡" elseif levelInfoData.LevelType == LuaConst.LevelType.SyncSoloPractice then valueStr = valueStr.."-1V1切磋" elseif levelInfoData.LevelType == LuaConst.LevelType.SyncTeamPVPPractice then valueStr = valueStr.."-3v3切磋" end table.insert(dropDownData.dropDownValue, valueStr) table.insert(dropDownData.dropDownData, levelInfoData.LevelID) end return {dropDownData} end --快速打开cheatHelp function Cheat_Controller.OpenUILuaConsole() local viewName = Const_UI_Lua.UIEnum.UICheatPanel if UIManager.IsViewOpened(viewName) then UIManager.CloseView(viewName) else UIManager.OpenView(viewName) end end --按键相关事件派发 function Cheat_Controller.HandleReplayUI() EventSystem.Dispatch(EventID.Cheat_ShowOrHideReplayUI) private.CheatRefreshFakeHeadUI() --目前是刷回放头顶显示假信息 end function Cheat_Controller.SwitchReplayPlayer(useLast) EventSystem.Dispatch(EventID.Cheat_ReplaySwitchPlayer,useLast) end function Cheat_Controller.StopGame() private.StopGame() end -------军团boss↓↓↓↓↓↓ function Cheat_Controller.ShowGuildBossRoomList() MDL.GuildBoss.GetGuildBossRoomListReq() end function Cheat_Controller.ChangeGuildBossRoom(index) MDL.GuildBoss.TryChangeBattleRoomID(index) end function Cheat_Controller.IndividualCheer() MDL.GuildBoss.IndividualCheerReq() end function Cheat_Controller.GuildCheer() MDL.GuildBoss.GuildCheerReq() end ------军团boss ↑↑↑↑↑↑ -------一键切换场景、天气、TL ↓↓↓↓↓↓ local gByte = string.byte('g') local hByte = string.byte('h') function Cheat_Controller.StartPlayTimelineList(tlFormatID, playBeginEvent, playEndEvent, callback) -- 将C#的callback转译成Lua的function local luaBeginEvent,luaEndEvent,luaCallback if playBeginEvent then luaBeginEvent = function(name) playBeginEvent:Call(name) end end if playEndEvent then luaEndEvent = function(name) playEndEvent:Call(name) end end if callback then luaCallback = function() callback:Call(true) end end local ids = {} local idFormat = tonumber(tlFormatID) if idFormat then if idFormat == 0 then --播放全部 for _, data in DataSheetManager.CutsceneList:GetEnumerator() do table.insert(ids, data.ID) end else --播放指定ID table.insert(ids, idFormat) end else local flag = string.byte(tlFormatID) --播放指定组ID if flag == gByte then local groupID = tonumber(string.sub(tlFormatID,2)) for _, data in DataSheetManager.CutsceneList:GetEnumerator() do if groupID == data.GroupID then table.insert(ids, data.ID) end end --播放以指定ID为起始的序列 elseif flag == hByte then local headID = tonumber(string.sub(tlFormatID,2)) for _, data in DataSheetManager.CutsceneList:GetEnumerator() do if headID >= data.ID then table.insert(ids, data.ID) end end end end CTL.Cutscene.PlayCutsceneList(ids, luaBeginEvent, luaEndEvent, luaCallback) end function Cheat_Controller.StopPlayTimelineList() CTL.Cutscene.StopCutsceneList() end ------一键切换场景、天气、TL ↑↑↑↑↑↑ ----------------------------------------执行客户端cheat命令-------------------------------------------- --承接C#输入的GM function Cheat_Controller.ExecuteCommand(cmdMsg) MDL.Cheat.Send(cmdMsg) end function Cheat_Controller.ExcuteClientCommand(commandName, commandParam) if CommandExcuteDict[commandName] then CommandExcuteDict[commandName](commandName, commandParam); end end function private.RegisterCommandFun() --PC-Cheat CommandExcuteDict["SetGreenBgShow"] = private.SetGreenBgShow; CommandExcuteDict["convertHeroShowMode"] = private.ConvertHeroShowMode; CommandExcuteDict["oneKeySwitchTimeLine"] = private.OneKeySwitchTimeLine; CommandExcuteDict["switchHero"] = private.SwitchHero; CommandExcuteDict["switchLevel"] = private.SwitchLevel; CommandExcuteDict["switchCombinationLevel"] = private.SwitchCombinationLevel; CommandExcuteDict["setOnlyShowDamageUI"] = private.SetOnlyShowDamageUI; CommandExcuteDict["showOrHideDamageUI"] = private.ShowOrHideDamageUI CommandExcuteDict["switchCameraModel"] = private.SwitchCameraModel; CommandExcuteDict["setPlayerMove"] = private.SetPlayerMove; CommandExcuteDict["addPlayerBuff"] = private.AddPlayerBuff; CommandExcuteDict["deletePlayerBuff"] = private.DeletePlayerBuff; CommandExcuteDict["playerReleaseSkill"] = private.PlayerReleaseSkill; CommandExcuteDict["replacePlayerAnim"] = private.ReplacePlayerAnim; CommandExcuteDict["switchWeather"] = private.SwitchWeather; CommandExcuteDict["playNotice"] = private.PlayFunctionNotice; CommandExcuteDict["stopNotice"] = private.StopFunctionNotice; CommandExcuteDict["playAllTimeLine"] = private.PlayAllTimeLine; CommandExcuteDict["addMonsterFactory"] = private.AddMonsterFactory; CommandExcuteDict["playTimeLineList"] = private.PlayTimeLineList; CommandExcuteDict["playTimeLine"] = private.PlayTimeLine; CommandExcuteDict["setCameraMove"] = private.SetCameraMove; CommandExcuteDict["autoRotCamera"] = private.AutoRotCamera; CommandExcuteDict["setAIEnable"] = private.SetAIEnable; CommandExcuteDict["showDebugViewData"] = private.ShowDebugViewData; CommandExcuteDict["setScreenResolution"] = private.SetScreenResolution; CommandExcuteDict["isShowNarrationContent"] = private.SetIsShowNarrationContent; CommandExcuteDict["isHangUpEnabled"] = private.SetHangUpEnabled; CommandExcuteDict["stopAllCheat"] = private.StopAllCheat; CommandExcuteDict["showTextIDS"] = private.ShowTextIDS; CommandExcuteDict["onOroffHorse"] = private.OnOrOffHorse CommandExcuteDict["changeEntitySpeed"] = private.ChangeEntitySpeed CommandExcuteDict["SetGameSence"] = private.SetGameSence CommandExcuteDict["CreateTestBoss"] = private.CreateTestBoss CommandExcuteDict["SetTestBossAttr"] = private.SetTestBossAttr CommandExcuteDict["PauseOrStartTestBossAI"] = private.PauseOrStartTestBossAI --通用 CommandExcuteDict["passLoginFreeLevel"] = private.PassLoginFreeLevel; CommandExcuteDict["pauseDownload"] = private.PauseDownload; CommandExcuteDict["resumeDownload"] = private.ResumeDownload; CommandExcuteDict["deleteStage"] = private.DeleteStagePackage; CommandExcuteDict["openStage2Tips"] = private.OpenStage2Tips; CommandExcuteDict["switchMirror"] = private.SwitchMirror; CommandExcuteDict["changeTimeScale"] = private.ChangeTimeScale --关卡 CommandExcuteDict["enterLevel"] = private.EnterLevel; CommandExcuteDict["leaveGuide"] = private.LeaveGuide; CommandExcuteDict["toName"] = private.ToName; --战斗 CommandExcuteDict["getAttr"] = private.GetAttr; CommandExcuteDict["kill"] = private.Kill; CommandExcuteDict["setBuff"] = private.SetBuff; CommandExcuteDict["showWinPose"] = Cheat_Controller.ShowWinPose; --时间 CommandExcuteDict["getGameTime"] = private.GetGameTime; CommandExcuteDict["RefreshGameTime"] = private.RefreshGameTime; --性能 CommandExcuteDict["startNetStatic"] = private.StartNetStatic; CommandExcuteDict["recordElectricity"] = private.RecordElectricity; CommandExcuteDict["vculldist"] = private.Vculldist; CommandExcuteDict["vcullcap"] = private.Vcullcap; CommandExcuteDict["pscullcap"] = private.Pscullcap; CommandExcuteDict["frCheckSensitivity"] = private.FrCheckSensitivity; CommandExcuteDict["fps60"] = private.Fps60; CommandExcuteDict["waterLevel"] = private.WaterLevel; CommandExcuteDict["textureLevel"] = private.TextureLevel; CommandExcuteDict["lodBiasLevel"] = private.LodBiasLevel; CommandExcuteDict["profiler"] = private.Profiler; CommandExcuteDict["setBloom"] = private.SetBloom; CommandExcuteDict["setLodLevel"] = private.SetLodLevel; CommandExcuteDict["debugSkipTimeline"] = private.DebugSkipTimeline; CommandExcuteDict["onLowMemory"] = private.OnLowMemory; CommandExcuteDict["sdkPay"] = private.SdkPay; --基础 CommandExcuteDict["addTypeItem"] = private.AddTypeItem; CommandExcuteDict["printPlayerAcid"] = private.PrintPlayerAcid; CommandExcuteDict["SetExchangeRateType"] = private.SetExchangeRateType; --其他 CommandExcuteDict["setShowBattleAgentPing"] = private.SetShowBattleAgentPing; CommandExcuteDict["fightingShowPingList"] = private.FightingShowPingList; CommandExcuteDict["stopGame"] = private.StopGame; CommandExcuteDict["reloadGame"] = private.ReloadGame; CommandExcuteDict["passLevel"] = private.PassLevel; CommandExcuteDict["skipTimeLine"] = private.SkipTimeLine; CommandExcuteDict["showPay"] = private.ShowPay; CommandExcuteDict["deltaFontSize"] = private.DeltaFontSize; CommandExcuteDict["gaChaGetPV"] = private.GaChaGetPV; CommandExcuteDict["goldenHeroBossFindPV"] = private.GoldenHeroBossFindPV; CommandExcuteDict["ForceNewGuideLevel"] = private.ForceNewGuideLevel; --场景 CommandExcuteDict["soloScene"] = private.ChangeSoloScene; CommandExcuteDict["addNPC"] = private.AddNPC; CommandExcuteDict["setCulling"] = private.SetCulling; CommandExcuteDict["setLod"] = private.SetLod; CommandExcuteDict["setSceneState"] = private.SetSceneState; CommandExcuteDict["setPlayerState"] = private.SetPlayerState; CommandExcuteDict["setPS"] = private.SetPS; CommandExcuteDict["addEnemy"] = private.AddEnemy; CommandExcuteDict["setGrass"] = private.SetGrass; CommandExcuteDict["setDynamic"] = private.SetDynamic; CommandExcuteDict["setTree"] = private.SetTree; CommandExcuteDict["setShadow"] = private.SetShadow; CommandExcuteDict["setObjects"] = private.SetObjects; CommandExcuteDict["setItem"] = private.SetItem; CommandExcuteDict["setShader"] = private.SetShader; CommandExcuteDict["setActorHP"] = private.SetActorHP; CommandExcuteDict["setCombo"] = private.SetCombo; CommandExcuteDict["setPsInstance"] = private.SetPsInstance; CommandExcuteDict["setZhangBao"] = private.SetZhangBao; CommandExcuteDict["setAllShow"] = private.SetAllShow; CommandExcuteDict["addMonster"] = private.AddMonster; CommandExcuteDict["addHorse"] = private.AddHorse; CommandExcuteDict["useSameActor"] = private.UseSameActor; CommandExcuteDict["horseRearFeed"] = private.HorseRearFeed; --任务 CommandExcuteDict["fetchGuildEscort"] = private.FetchGuildEscort; CommandExcuteDict["frameStatistic"] = private.Frame2CmdStatistic; CommandExcuteDict["openStageDownload"] = private.OpenStageDownload; CommandExcuteDict["openSLGEdit"] = private.OpenSLGEdit; CommandExcuteDict["exportSLGGrid"] = private.ExportSLGGrid; CommandExcuteDict["enterHeroTestLevel"] = private.enterHeroTestLevel; CommandExcuteDict["enterBattleTestLevel"] = private.enterBattleTestLevel; CommandExcuteDict["replayBattleLevel"] = private.replayBattleLevel; --市场 CommandExcuteDict["marketBattleProp2122"] = private.MarketGetDragonMySelf; CommandExcuteDict["marketEnemyGetDragon"] = private.MarketGetDragonEnemy CommandExcuteDict["marketBattleProp23"] = private.AddBattleProp23; CommandExcuteDict["marketBattleProp24"] = private.AddBattleProp24; CommandExcuteDict["marketBattleProp25"] = private.AddBattleProp25; CommandExcuteDict["marketBattleProp26"] = private.AddBattleProp26; CommandExcuteDict["marketBattleProp27"] = private.AddBattleProp27; CommandExcuteDict["marketBattleProp28"] = private.AddBattleProp28; CommandExcuteDict["marketCamp1Player"] = private.MarketActiveCamp1PlayerPlayer CommandExcuteDict["marketCamp2Player"] = private.MarketActiveCamp2PlayerPlayer CommandExcuteDict["marketCamp3Player"] = private.MarketActiveCamp3PlayerPlayer CommandExcuteDict["marketCamp4Player"] = private.MarketActiveCamp4PlayerPlayer CommandExcuteDict["marketAllSnakeBoss"] = private.MarketAllSnakeBoss CommandExcuteDict["marketZhuyanBoss"] = private.MarketZhuyanBoss CommandExcuteDict["marketAllBattlePropMonster"] = private.MarketAllBattlePropMonster CommandExcuteDict["marketDragonIndex"] = private.SetDragonBossIndex end function private.SetDragonBossIndex(commandName, commandParam) LevelManager.CurLevelFunc.dragonArteryIndex = commandParam.index end function private.MarketAllBattlePropMonster() for i = 2021,2024 do local item = LevelItemManager.GetItemByID(i) item:DoAction(LuaConst.LevelActionType.Monster_Active) end end function private.MarketZhuyanBoss() local item = LevelItemManager.GetItemByID(2005) item:DoAction(LuaConst.LevelActionType.Monster_Active) end function private.MarketAllSnakeBoss() for i = 2001,2004 do local item = LevelItemManager.GetItemByID(i) item:DoAction(LuaConst.LevelActionType.Monster_Active) end end -- 假的玩家 function private.MarketActiveCamp1PlayerPlayer(commandName, commandParam) local list = dragonPlayerDic["阵营1"][commandParam.gsLevel][commandParam.hasName] for i, levelItemID in ipairs(list) do local item = LevelItemManager.GetItemByID(levelItemID) item:DoAction(LuaConst.LevelActionType.Monster_Active) end end function private.MarketActiveCamp2PlayerPlayer(commandName, commandParam) local list = dragonPlayerDic["阵营2"][commandParam.gsLevel][commandParam.hasName] for i, levelItemID in ipairs(list) do local item = LevelItemManager.GetItemByID(levelItemID) item:DoAction(LuaConst.LevelActionType.Monster_Active) end end function private.MarketActiveCamp3PlayerPlayer(commandName, commandParam) local list = dragonPlayerDic["阵营3"][commandParam.gsLevel][commandParam.hasName] for i, levelItemID in ipairs(list) do local item = LevelItemManager.GetItemByID(levelItemID) item:DoAction(LuaConst.LevelActionType.Monster_Active) end end function private.MarketActiveCamp4PlayerPlayer(commandName, commandParam) local list = dragonPlayerDic["阵营4"][commandParam.gsLevel][commandParam.hasName] for i, levelItemID in ipairs(list) do local item = LevelItemManager.GetItemByID(levelItemID) item:DoAction(LuaConst.LevelActionType.Monster_Active) end end function private.MarketGetDragonMySelf() LevelManager.CurLevelFunc.dragonArteryEntity = LogicUpdateManager._curEntity LevelManager.CurLevelFunc.dragonArteryPlayerID = 1 LogicUpdateManager._curEntity.ExpEntity:PlayEffectByType(LuaConst.EffectType.DragonArtery) SystemManager.AddBattleProp(LogicUpdateManager._curEntity, 21) SystemManager.AddBattleProp(LogicUpdateManager._curEntity, 22) end function private.MarketGetDragonEnemy() for eid, entity in pairs(LogicUpdateManager._entityDic) do if entity:IsValid() and entity:GetCampID() ~= LogicUpdateManager._curEntity:GetCampID() then LevelManager.CurLevelFunc.dragonArteryEntity = entity LevelManager.CurLevelFunc.dragonArteryPlayerID = entity:GetPlayerID() > 0 and entity:GetPlayerID() or 1 entity.ExpEntity:PlayEffectByType(LuaConst.EffectType.DragonArtery) SystemManager.AddBattleProp(entity, 21) SystemManager.AddBattleProp(entity, 22) end end end function private.AddBattleProp23() SystemManager.AddBattleProp(LogicUpdateManager._curEntity, 23) end function private.AddBattleProp24() SystemManager.AddBattleProp(LogicUpdateManager._curEntity, 24) end function private.AddBattleProp25() SystemManager.AddBattleProp(LogicUpdateManager._curEntity, 25) end function private.AddBattleProp26() SystemManager.AddBattleProp(LogicUpdateManager._curEntity, 26) end function private.AddBattleProp27() SystemManager.AddBattleProp(LogicUpdateManager._curEntity, 27) end function private.AddBattleProp28() SystemManager.AddBattleProp(LogicUpdateManager._curEntity, 28) end function private.OpenStageDownload() CTL.HotFix.ForceOpenStageDownload() end function private.OpenSLGEdit() UIManager.CloseView(Const_UI_Lua.UIEnum.UISlgGvEEditorPanel) UIManager.OpenView(Const_UI_Lua.UIEnum.UISlgGvEEditorPanel) end function private.ExportSLGGrid() CTL.SlgGvE.ExportGrids() end function private.Frame2CmdStatistic() local battle_common_pb = require 'Proto/battle_common_pb' local dataBytes = LuaExt.FileReadBytes("BattleCheck/frame2cmd-pc") if dataBytes then local file, err = io.open("BattleCheck/frameStatistic-pc", "wb") local statistic = battle_common_pb.Frame2CmdStatistic() statistic:ParseFromString(dataBytes) file:write("帧数 :获取, 执行" .. "\n") for i = 1,#statistic.getCmds do file:write( i .. " : " .. statistic.getCmds[i] .." ," .. statistic.handleCmds[i] .. "\n") end file:close() print("生成 帧cmd的统计 完毕!") end local dataBytes = LuaExt.FileReadBytes("BattleCheck/frame2cmd") if dataBytes then local file, err = io.open("BattleCheck/frameStatistic", "wb") local statistic = battle_common_pb.Frame2CmdStatistic() statistic:ParseFromString(dataBytes) file:write("帧数 :获取, 执行" .. "\n") for i = 1,#statistic.getCmds do file:write( i .. " : " .. statistic.getCmds[i] .." ," .. statistic.handleCmds[i] .. "\n") end file:close() print("生成 帧cmd的统计 完毕!") end end function private.FetchGuildEscort(commandName, commandParam) MDL.Cheat.SendFirstParamIsAcid("Escort_SetCart", commandParam) end function private.HorseRearFeed(commandName, commandParam) MDL.HorseRear.HorseRearReq(commandParam.activityId, commandParam.times) end function private.SetGreenBgShow(commandName, commandParam) EventSystem.Dispatch(EventID.UI_CheatGreenBg, commandParam.color, commandParam.clearEffect) end function private.ConvertHeroShowMode(commandName, commandParam) CTL.HeroDetail.ConvertHeroShowSceneMode() end --cheat模式 一键切换场景、天气、tl function private.OneKeySwitchTimeLine(commandName, commandParam) Cheat_Controller.StartPlayTimelineList(commandParam.timelineId) end --cheat模式 切换武将 function private.SwitchHero(commandName, commandParam) LevelPlayerManager.ChangeAvatarCheatForMonsterTest(commandParam.heroId) end --cheat模式 SwitchLevel function private.SwitchLevel(commandName, commandParam) LevelPlayerManager.SetOffLineHeroTable(); LevelManager.SwitchLevel(commandParam.levelId); end function private.SwitchCombinationLevel(commandName, commandParam) LevelPlayerManager.SetOffLineHeroTable(); LevelManager.SwitchCombinationLevel(commandParam.combineId); end --cheat模式只显示伤害UI function private.SetOnlyShowDamageUI(commandName, commandParam) MDL.Cheat.SetPCCheatModel(commandParam.isEnter and commandParam.isEnter == 1) if commandParam.isEnter and commandParam.isEnter == 1 then ExpLevelManager.HidePathGuide() end UIManager.EnterCheatModel(commandParam.isEnter and commandParam.isEnter == 1); end function private.ShowOrHideDamageUI(commandName, commandParam) EventSystem.Dispatch(EventID.UI_ShowOrHideHurt, commandParam.isShow == 1); if commandParam.isShow == 1 then UIManager.OpenView(Const_UI_Lua.UIEnum.UIBattleLevelPanel) else UIManager.CloseView(Const_UI_Lua.UIEnum.UIBattleLevelPanel) end end --cheat模式切换相机模式 function private.SwitchCameraModel(commandName, commandParam) CameraController.Instance:EnterLevel(commandParam.model or 1, 0); end --cheat模式,给玩家一个方向持续移动 local PlayerMoveDir = nil; function private.SetPlayerMove(commandName, commandParam) if not PlayerMoveDir then PlayerMoveDir = {{0,1}, {1,1}, {1,0}, {1,-1}, {0,-1}, {-1,-1}, {-1,0}, {-1,1}}; end if commandParam.moveDirType then if commandParam.moveDirType == -1 then LuaInputManager.SetVirtualMoveDir(0, 0); else local vector3TempX, vector3TempY,vector3TempZ = UIUtils.CameraTransformDirection(PlayerMoveDir[commandParam.moveDirType][1],0,PlayerMoveDir[commandParam.moveDirType][2],nil,nil,nil); LuaInputManager.SetVirtualMoveDir(vector3TempX, vector3TempZ); end end end function private.AddPlayerBuff(commandName, commandParam) CTL.Cheat.AddBuff(CTL.Cheat.GetCurEntityID(),commandParam.buffID) end function private.DeletePlayerBuff(commandName, commandParam) CTL.Cheat.DeleteBuff(CTL.Cheat.GetCurEntityID(),commandParam.buffID) end --cheat模式,连续释放技能 local releaseTimer = nil; function private.PlayerReleaseSkill(commandName, commandParam) if releaseTimer then TimerUtil.Remove(releaseTimer); releaseTimer = nil; end LuaInputManager.ReleaseAttackKey(); if string.isNilOrEmpty(commandParam.keyPos) then return end --无CD NotSyncBattleSetter.Set_IsSkillNoCD(true) --无双加满 Cheat_Controller.FillSA(); commandParam.releaseType = commandParam.releaseType or 0; local keyPosArr = string.split(commandParam.keyPos, ","); local index = 0; local curFrameTime = 0; local nextPlayTime = 1; if commandParam.releaseType == -1 then releaseTimer = TimerUtil.Interval( function() curFrameTime = curFrameTime+0.06; if curFrameTime > nextPlayTime then index = index + 2; index = index > #keyPosArr and 2 or index; LuaInputManager.PressAttackKey(tonumber(keyPosArr[index-1])); curFrameTime = 0; nextPlayTime = tonumber(keyPosArr[index]); else LuaInputManager.ReleaseAttackKey(); end end, 0.06, 0); elseif commandParam.releaseType == 1 then releaseTimer = TimerUtil.Interval( function() curFrameTime = curFrameTime+0.06; if curFrameTime > nextPlayTime then index = index + 2; if index > table.getn(keyPosArr) then TimerUtil.Remove(releaseTimer); releaseTimer = nil; return; end LuaInputManager.PressAttackKey(tonumber(keyPosArr[index-1])); curFrameTime = 0; nextPlayTime = tonumber(keyPosArr[index]); else LuaInputManager.ReleaseAttackKey(); end end, 0.06, 0); end end function private.ReplacePlayerAnim(commandName, commandParam) local entity = LogicUpdateManager._curEntity local animID = entity.components.base.CurModelData.AnimID local fromAnim = string.format("%s_%s",animID,commandParam.from) local toPath = string.format(ConstAssetPathConfig.AssetPath52,animID,animID,commandParam.to) entity.ExpEntity:ReplaceAnimation(fromAnim,toPath) end --cheat模式,切换天气 function private.SwitchWeather(commandName, commandParam) AuxUtil.SwitchWeather(commandParam.weatherId, commandParam.duration or 3); end --播放功能预告表现 function private.PlayFunctionNotice(commandName, commandParam) CTL.FunctionNotice.CheatOpenNotice(commandParam.functionPredictionID) end --停止功能预告表现 function private.StopFunctionNotice(commandName, commandParam) CTL.FunctionNotice.CheatCloseNotice() end --遍历所有tl资源,一个个播放 function private.PlayAllTimeLine() local luaEditorDataGetter = require("Tools/LuaEditorDataGetter") local timelineStageConfig = luaEditorDataGetter.GetConfigTimeline(false) local curStage = LoginProxy.GetCurStage() for path, v in pairs(timelineStageConfig) do local abStage = AuxUtil.GetAssetBundleStage(path) if curStage >= abStage then SystemManager.PlayTimeline(path, true, -1) else logging.error(LTAG.ERROR, path, abStage) end end end --cheat模式,开关测试怪AI function private.SetAIEnable(commandName, commandParam) NotSyncBattleSetter.Set_IsUseSelfAI(commandParam.enable == 1); end --cheat模式,开关测试怪AI function private.ShowDebugViewData(commandName, commandParam) EventSystem.Dispatch(EventID.UI_DebugViewShowData); end function private.SetScreenResolution(commandName, commandParam) if commandParam.width <= 1 then UnityEngine.Screen.fullScreen = true else UnityEngine.Screen.SetResolution(commandParam.width, commandParam.height, false); end end function private.SetIsShowNarrationContent(commandName, commandParam) AuxUtil.IsShowNarrationContent = commandParam.enable == 1; end function private.SetHangUpEnabled(commandName, commandParam) LuaInputManager.SetSpecialCommand(6) end --cheat模式,停止所有PC的Cheat function private.StopAllCheat(commandName, commandParam) MDL.Cheat.Send("setOnlyShowDamageUI 0"); MDL.Cheat.Send("setPlayerMove -1"); MDL.Cheat.Send("playerReleaseSkill 0 1,0.2"); MDL.Cheat.Send("setCameraMove 0 0 0 0 0 0"); LevelItemManager.DeleteAllTestItem(); end function private.OnOrOffHorse(commandName, commandParam) local entity = LogicUpdateManager._curEntity entity:SetHorseData(commandParam.horseId) LuaInputManager.SetSpecialCommand(LuaConst.SpecialCommandType.Ride) end function private.ChangeEntitySpeed(commandName, commandParam) local entity = LogicUpdateManager._curEntity local curSpeed = entity.components.attr:GetAttrValue(LuaConst.AttrType.spd) entity.components.attr:SetAttrBaseValue(LuaConst.AttrType.spd, curSpeed+commandParam.speed) end local pcCheatLevelID function private.SetGameSence(commandName, commandParam) pcCheatLevelID = commandParam.levelID private.SetCheatSwitchLevelFuc() end local switchLevelFuc function private.SetCheatSwitchLevelFuc() if not switchLevelFuc then switchLevelFuc = LevelManager.SwitchLevel LevelManager.SwitchLevel = function(levelID, randomSeed, needCheck,isNormalScene) levelID = private.GetPCCheatLevelID(levelID) switchLevelFuc(levelID, randomSeed, needCheck,isNormalScene) end end end function private.GetPCCheatLevelID(levelID) if pcCheatLevelID then local pcCheatLevelType = DataSheetManager.LevelInfoData:GetDataByLevelID(pcCheatLevelID).LevelType local levelInfoData = DataSheetManager.LevelInfoData:GetDataByLevelID(levelID) if levelInfoData.LevelType == pcCheatLevelType then return pcCheatLevelID end end return levelID end function private.ShowTextIDS() UIUtils.ShowTextIDS() end local testBossEntity = {} function private.CreateTestBoss(commandName, commandParam) local myPosX, myPosZ = FP.tonumberV2(BattleDataGetter.GetMainEntityLogicPos()) local posV2 = FP.newV2(myPosX, myPosZ) local dirV2 = FP.newV2(0, 1) EntityFactory.SetType_ID(1, commandParam.mosterId) EntityFactory.SetPos_Dir(posV2, dirV2) local entity = EntityFactory.DoCreateEntity() table.insert(testBossEntity, entity) entity._logicInitData.IsTest = true SystemManager.DeleteBuff(entity, LuaConst.SpecialBuffs.CanRotate) SystemManager.DeleteBuff(entity, LuaConst.SpecialBuffs.CanMove) SystemManager.DeleteBuff(entity, LuaConst.SpecialBuffs.CanSkill) local priority = entity.components.move.ShovePriority if priority > 50 then LuaShoveManager.SetGridDataByPriorityOfEntity(entity, priority, true, true) end LevelItemManager.Global:Notify_MonsterBorn(entity) end function private.SetTestBossAttr(commandName, commandParam) if commandParam.attrValueFactor > 0 then for index, entity in ipairs(testBossEntity) do if entity:IsAlive() then local val = entity:GetAttrValueNum(commandParam.attrName) entity:SetAttrBaseValue(commandParam.attrName, val*commandParam.attrValueFactor) end end end end local isPause = true function private.PauseOrStartTestBossAI(commandName, commandParam) for index, entity in ipairs(testBossEntity) do if isPause then SystemManager.AddBuff(entity, LuaConst.SpecialBuffs.CanRotate) SystemManager.AddBuff(entity, LuaConst.SpecialBuffs.CanMove) SystemManager.AddBuff(entity, LuaConst.SpecialBuffs.CanSkill) else SystemManager.DeleteBuff(entity, LuaConst.SpecialBuffs.CanRotate) SystemManager.DeleteBuff(entity, LuaConst.SpecialBuffs.CanMove) SystemManager.DeleteBuff(entity, LuaConst.SpecialBuffs.CanSkill) end end isPause = not isPause end --cheat模式,添加怪物工厂 local levelItemIndex = 10000; function private.AddMonsterFactory(commandName, commandParam) NotSyncBattleSetter.Set_IsUseSelfAI(false); local selfEntity = LogicUpdateManager._curEntity; local vector3TempX, vector3TempY,vector3TempZ = UIUtils.CameraTransformDirection(0, 0, 1,nil,nil,nil); local curLevelData = require("Battle/Logic/Level/LevelItemAndEventData/LevelLayoutData" .. commandParam.layoutId) --关卡的原始数据 for index, levelItemData in ipairs(curLevelData.LevelItemList) do if levelItemData.LevelItemType == LuaConst.LevelItemType.Monster then local targetDir = selfEntity:GetLogicRotateDir():cloneV2(); local distance = levelItemData.ItemPos:Magnitude(); local targetPos = selfEntity:GetLogicPos():cloneV2():Add(FP.newV2(vector3TempX*distance, vector3TempZ*distance)); logging.error(LTAG.ERROR, targetPos, levelItemData.ItemPos) levelItemData.ItemPos:Reset(targetPos); levelItemData.ItemDir:Reset(targetDir:Mul(-1)); levelItemData.ActiveDis = FP.newV1(-1); levelItemData.LevelItemID = levelItemIndex; if commandParam.monsterId > 0 then levelItemData.WeightMonsterIDList = {{MonsterID = commandParam.monsterId, Weight = FP.newV1(1)}} end local factory = LevelItemManager.CreateOneItem(levelItemData, true); factory:OnActive(); levelItemIndex = levelItemIndex + 1; end end package.loaded["Battle.Logic.Level.LevelItemAndEventData.LevelLayoutData" .. commandParam.layoutId] = nil end local cameraSpeedTimer = nil; local rotateTimer = nil; local cameraEntity; function private.SetCameraMove(commandName, commandParam) if cameraSpeedTimer then TimerUtil.RemoveUpdate(cameraSpeedTimer); cameraSpeedTimer = nil; end if rotateTimer then TimerUtil.RemoveUpdate(rotateTimer); rotateTimer = nil; end if commandParam.isMainRoleTarget == 1 then private.CloneMainPlayer(); elseif cameraEntity then SystemManager.OnUnload(cameraEntity, true); cameraEntity = nil; SystemManager.SetCurEntity(LevelPlayerManager.GetPlayerActiveEntity(LuaConst.STANDALONE_PLAYER_PlayID)); end if cameraEntity then private.SetCameraSpeed(commandName, commandParam); end private.SetCameraRotate(commandName, commandParam); end function private.SetCameraSpeed(commandName, commandParam) if commandParam.speedX == 0 and commandParam.speedY == 0 and commandParam.speedZ == 0 then return; end local vector3TempX, vector3TempY,vector3TempZ = UIUtils.CameraTransformDirection(commandParam.speedX, 0, commandParam.speedZ, nil, nil, nil); vector3TempY = commandParam.speedY; if not cameraSpeedTimer then cameraSpeedTimer = TimerUtil.Update( function() cameraEntity.components.move.LogicPos:Reset(cameraEntity:GetLogicPos():cloneV2():Add(FP.newV2(vector3TempX*Time.deltaTime, vector3TempZ*Time.deltaTime))); cameraEntity.ExpEntity:ApplyExpTrans(); SystemManager.SetCallEntityY(cameraEntity, cameraEntity:GetLogicPosY():cloneV1():Add(FP.newV1(vector3TempY*Time.deltaTime))) end); end end function private.CloneMainPlayer() if not cameraEntity then local selfEntity = LogicUpdateManager._curEntity; local characterType = selfEntity:GetCharacterType(); local characterID = selfEntity:GetCharacterID(); local characterPos = selfEntity:GetLogicPos(); local characterDir = selfEntity.components.move.LogicRotateDir; local posV2 = characterPos:cloneV2(); local dirV2 = FP.newV2(characterDir.x, characterDir.z) EntityFactory.SetType_ID(characterType, characterID) EntityFactory.SetPos_Dir(posV2, dirV2) cameraEntity = EntityFactory.DoCreateEntity() cameraEntity._logicInitData.IsTest = true SystemManager.SetCurEntity(cameraEntity); cameraEntity.ExpEntity:SetUseG(true); cameraEntity.ExpEntity:SetVisible(false) end end --设置相机旋转 local rotateVec; function private.SetCameraRotate(commandName, commandParam) if commandParam.rotateSpeedX == 0 and commandParam.rotateSpeedY == 0 then rotateVec = nil; return; end if not rotateVec then rotateVec = Vector2.New(0, 0); end rotateVec.x = commandParam.rotateSpeedX; rotateVec.y = commandParam.rotateSpeedY; rotateTimer = TimerUtil.Update(function() CameraController.Instance:RotatingByManual(rotateVec) end); end function private.AutoRotCamera(name, params) EventSystem.Dispatch(EventID.UI_CheatAutoRotCamera, params.enable == 1) end function private.PlayTimeLine(commandName, commandParam) local path = string.format(ConstAssetPathConfig.TIMELINE_PATH, commandParam.TimeLineID) SystemManager.PlayTimeline(path, true, -1) end --cheat模式,播放场景的timeline动画 function private.PlayTimeLineList(commandName, commandParam) local timeLineArr = string.split(commandParam.timelineIds, ","); private.StartPlayTimeLine(commandParam.timelineType, 1, timeLineArr, true); end function private.StartPlayTimeLine(timeLineType, index, pathArr, isPause) if index <= #pathArr then if timeLineType == 0 then SystemManager.PlayTimeline(string.format(ConstAssetPathConfig.TIMELINE_PATH, pathArr[index]), isPause, -1, function(id, level, isReward) private.StartPlayTimeLine(timeLineType, index+1, pathArr, isPause); end) else SystemManager.PlayTimeline(string.format(ConstAssetPathConfig.Path4, pathArr[index]), isPause, -1, function(id, level, isReward) private.StartPlayTimeLine(timeLineType, index+1, pathArr, isPause); end) end end end function private.EnterLevel(commandName, commandParam) local curLevelId = tonumber( "10" .. commandParam.levelID) MDL.LevelSelect.EnterFuben(LuaConst.LevelType.NORMAL ,curLevelId, nil, commandParam.levelID) end function private.ForceNewGuideLevel(commandName,commandParam) MDL.Cheat.Set_ForceNewGuideLevel(commandParam.hasNewLevel) end function private.LeaveGuide(commandName, commandParam) CTL.Guide.EndGuideLevel(); end function private.ToName(commandName, commandParam) MDL.Cheat.Send("leaveGuide"); MDL.Cheat.Send('commitTaskAll 100200 1'); end function private.GetAttr(commandName, commandParam) EventSystem.Dispatch(EventID.UI_LuaConsole_Refresh_Attr, 2, Cheat_Controller.GetAttrByID(LogicUpdateManager._curEntity._logicInitData.EntityID)) end function private.Kill(commandName, commandParam) SystemManager.OnDead(LogicUpdateManager._curEntity); end function private.SetBuff(commandName, commandParam) EventSystem.Dispatch(EventID.UI_LuaConsole_Refresh_Attr, 1, LogicUpdateManager._curEntity.components.buff.CurBuffObjectList) end function private.PassLoginFreeLevel() LevelManager.CurLevelFunc:OnLevelSucceed(true) end function private.PauseDownload() CTL.HotFix.PauseDownload() end function private.ResumeDownload() CTL.HotFix.ResumeDownload() end function private.DeleteStagePackage(commandName, commandParam) AuxUtil.DeleteStagePackage(commandParam.stage) end function private.OpenStage2Tips(commandName, commandParam) CTL.HotFix.CheatFinishPack2 = commandParam.isFinish == 1 UIManager.OpenView(Const_UI_Lua.UIEnum.UIPack2DownloadTip) end function private.ChangeTimeScale(commandName, commandParam) UnityEngine.Time.timeScale = commandParam.speed end function private.SwitchMirror(commandName, commandParam) if LuaExt.FileExists("IsSwitchMirror") then LuaExt.FileDelete("IsSwitchMirror") CTL.Tips.AddTipsMsg("准备切换到mirror服") else LuaExt.FileWriteText("IsSwitchMirror", "") CTL.Tips.AddTipsMsg("准备切换到mirror1服") end TimerUtil.Interval(function() LuaNetManager.RebootGame() end, 3, 1) end function private.GetGameTime(commandName, commandParam) CTL.Tips.AddTipsMsg(os.date(UTL.Time.FormatDateEnum.YMDHMS, UTL.Time.GetServerTimestamp())) end function private.RefreshGameTime() NetManager.ManualReConnect(nil) end function private.StartNetStatic(commandName, commandParam) LuaNetManager.SetNetStaticEnable(); end function private.RecordElectricity(commandName, commandParam) local value = MDL.Cheat.Get_isRecordElectricity() MDL.Cheat.Set_isRecordElectricity(not value) end function private.Vculldist(commandName, commandParam) AuxUtil.SetVisualCullingDistance(commandParam.near, commandParam.far, commandParam.max) end function private.Vcullcap(commandName, commandParam) AuxUtil.SetVisualCullingCapacity(commandParam.capacity) end function private.Pscullcap(commandName, commandParam) AuxUtil.SetEffectCullingCapacity(commandParam.near, commandParam.medium, commandParam.far) end function private.FrCheckSensitivity(commandName, commandParam) CTL.Optimize.AdjustFrameCheckSensitivity(commandParam.dtThreshold,commandParam.totalCount,commandParam.frameCount,commandParam.tolerateTimes) end function private.Fps60(commandName, commandParam) CTL.Setting.SaveFrameLimitation(commandParam.quality) end function private.WaterLevel(commandName, commandParam) SettingAPI.waterLevel = commandParam.quality end function private.TextureLevel(commandName, commandParam) SettingAPI.textureLevel = commandParam.quality end function private.LodBiasLevel(commandName, commandParam) SettingAPI.LodBiasLevel = commandParam.quality end --跳过所有剧情 function private.DebugSkipTimeline(commandName, commandParam) MDL.Cheat.Set_IsDebugSkipTimeline(commandParam.enable==1) end function private.OnLowMemory(commandName, commandParam) AuxUtil.OnLowMemory(false) end function private.Profiler(commandName, commandParam) require('Tools/UnityProfiler').WrapAll() end function private.SetBloom(commandName, commandParam) SettingAPI.glow = commandParam.enable; end function private.SetLodLevel(commandName, commandParam) SettingAPI.lodLevel = commandParam.lodLevel; end function private.SdkPay(commandName, commandParam) MDL.Currency.GetOrderIDReq(commandParam.IAPIndex) end function private.AddTypeItem(commandName, commandParam) MDL.Cheat.GetAllItemByItemType(commandParam.type, commandParam.num) end function private.PrintPlayerAcid(commandName, commandParam) print(BattleDataGetter.GetAcID()) end function private.SetShowBattleAgentPing(commandName, commandParam) MDL.BattleAgent.SetAgentPingByCheat(commandParam.index, commandParam.ping) end function private.FightingShowPingList(commandName, commandParam) CTL.BattleAgent.ChangeFightingShowPing() end function private.StopGame(commandName, commandParam) local value = MDL.Cheat.Get_CheatIsPause() MDL.Cheat.Set_CheatIsPause(not value) end function private.ReloadGame(commandName, commandParam) SDKUtil.SwitchAccount() end function private.PassLevel(commandName, commandParam) MDL.LevelSelect.GoldenFingerPassLevel() end function private.SkipTimeLine(commandName, commandParam) AuxUtil.StopTimeline() end function private.ShowPay(commandName, commandParam) MDL.Shop.SetIsShowPayForTest(true) end function private.ChangeSoloScene() if private._originExpLevelManagerLoadLevel == nil then private._originExpLevelManagerLoadLevel = ExpLevelManager.LoadLevel ExpLevelManager.LoadLevel = function(levelInfoData) local params = levelInfoData if levelInfoData.LevelType == LuaConst.LevelType.SyncSolo or levelInfoData.LevelType == LuaConst.LevelType.SyncSoloPractice then params = {} for key, val in pairs(levelInfoData) do params[key] = val params.ScenePath = "C-World_Tournament" end end private._originExpLevelManagerLoadLevel(params) end else ExpLevelManager.LoadLevel = private._originExpLevelManagerLoadLevel private._originExpLevelManagerLoadLevel = nil end end function private.AddNPC(commandName, commandParam) if commandParam.NpcType == 1 then AuxUtil.DevLev_CreateOtherRoles() elseif commandParam.NpcType == 2 then AuxUtil.DevLev_CreateOtherRolesWithoutPS() end end function private.SetCulling(commandName, commandParam) local value = MDL.Cheat.Get_isOpenOcclusion() MDL.Cheat.Set_isOpenOcclusion(not value) end function private.SetLod(commandName, commandParam) local value = MDL.Cheat.Get_isOpenLod() MDL.Cheat.Set_isOpenLod(not value) end function private.SetSceneState(commandName, commandParam) local value = MDL.Cheat.Get_ShowScene() MDL.Cheat.Set_ShowScene(not value) end function private.SetPlayerState(commandName, commandParam) local value = MDL.Cheat.Get_ShowPlayer() MDL.Cheat.Set_ShowPlayer(not value) end function private.SetPS(commandName, commandParam) local value = MDL.Cheat.Get_ShowPS() MDL.Cheat.Set_ShowPS(not value) end function private.AddEnemy(commandName, commandParam) local Count for i, k, v in commandParam:Iterator() do Count = v end local value = MDL.Cheat.Get_EnableEnemyCheat() MDL.Cheat.Set_EnableEnemyCheat(not value, Count) end function private.SetGrass(commandName, commandParam) local value = MDL.Cheat.Get_isShowGrass() MDL.Cheat.Set_isShowGrass(not value) end function private.SetDynamic(commandName, commandParam) local value = MDL.Cheat.Get_isShowDynamic() MDL.Cheat.Set_isShowDynamic(not value) end function private.SetTree(commandName, commandParam) local value = MDL.Cheat.Get_isShowTree() MDL.Cheat.Set_isShowTree(not value) end function private.SetShadow(commandName, commandParam) SettingAPI.shadowLevel = SettingAPI.shadowLevel == 0 and 1 or 0 end function private.SetObjects(commandName, commandParam) local value = MDL.Cheat.Get_isShowObjects() MDL.Cheat.Set_isShowObjects(not value) end function private.SetItem(commandName, commandParam) local value = MDL.Cheat.Get_isShowItem() MDL.Cheat.Set_isShowItem(not value) end function private.SetShader(commandName, commandParam) local value = MDL.Cheat.Get_replaceShader() MDL.Cheat.Set_replaceShader(not value) end function private.SetActorHP(commandName, commandParam) local value = MDL.Cheat.Get_isShowActorHP() MDL.Cheat.Set_isShowActorHP(not value) end function private.SetCombo(commandName, commandParam) local value = MDL.Cheat.Get_isShowCombo() MDL.Cheat.Set_isShowCombo(not value) end function private.SetPsInstance(commandName, commandParam) local value = MDL.Cheat.Get_ShowPsInstance() MDL.Cheat.Set_ShowPsInstance(not value) end function private.SetZhangBao(commandName, commandParam) local value = MDL.Cheat.Get_isUseZhangBao() MDL.Cheat.Set_isUseZhangBao(not value) end function private.UseSameActor(commandName, commandParam) MDL.Cheat.Set_isUseSameActor(true) end function private.AddHorse(commandName, commandParam) CTL.Setting.OpenRideHorse(); end function private.SetAllShow(commandName, commandParam) local Count for i, k, v in commandParam:Iterator() do Count = v end local value = MDL.Cheat.Get_ShowPlayer() MDL.Cheat.Set_ShowPlayer(not value) local value = MDL.Cheat.Get_EnableEnemyCheat() MDL.Cheat.Set_EnableEnemyCheat(not value, Count) local value = MDL.Cheat.Get_ShowPS() MDL.Cheat.Set_ShowPS(not value) local value = MDL.Cheat.Get_ShowPsInstance() MDL.Cheat.Set_ShowPsInstance(not value) end function private.AddMonster(commandName, commandParam) if commandParam.EnemyType == 1 then AuxUtil.DevLev_CreateMonsterNoAI(commandParam.EnemyCount) elseif commandParam.EnemyType == 2 then AuxUtil.DevLev_CreateMonsterBati(commandParam.EnemyCount) end end function private.DeltaFontSize(commandName, commandParam) AuxUtil.SetDeltaFontSize(commandParam.DeltaFontSize) SDKUtil.SwitchAccount() end function private.GaChaGetPV() local count = DataSheetManager.HeroNum:GetDataCount() count = math.ceil(count/10) for i=1,count do UIManager.OpenView(Const_UI_Lua.UIEnum.UIGaChaPV, { startHeroId = (i - 1) * 10 + 1}, "DrawCard/UIGachaGet") end end function private.GoldenHeroBossFindPV() for i, v in DataSheetManager.HeroNum:GetEnumerator() do UIManager.OpenView(Const_UI_Lua.UIEnum.GoldenHeroBossFindPV, { heroId = v.ID }, "GoldenHero/GoldenHeroBoss/UIGoldenHeroBossFind") end end function Cheat_Controller.StopPetAttack(val) for eid,entity in pairs(LogicUpdateManager._entityDic) do if entity.components.pet then entity.components.pet:SetPauseAttack(val) end end end function Cheat_Controller.CreateTestMonster(characterType, monsterID, posX, posZ, forwardX, forwardZ) forwardX = forwardX or 1 forwardZ = forwardZ or 0 local posV2 = FP.newV2(posX, posZ) local dirV2 = FP.newV2(forwardX, forwardZ) EntityFactory.SetType_ID(characterType, monsterID) EntityFactory.SetPos_Dir(posV2, dirV2) local entity = EntityFactory.DoCreateEntity() entity._logicInitData.IsTest = true local priority = entity.components.move.ShovePriority if priority > 50 then LuaShoveManager.SetGridDataByPriorityOfEntity(entity, priority, true, true) end LevelItemManager.Global:Notify_MonsterBorn(entity) end function Cheat_Controller.CreateTestEnemyHero(heroId, posX, posZ, forwardX, forwardZ) forwardX = forwardX or 1 forwardZ = forwardZ or 0 local posV2 = FP.newV2(posX, posZ) local dirV2 = FP.newV2(forwardX, forwardZ) EntityFactory.SetType_ID(LuaConst.CharacterType.Hero, heroId) EntityFactory.SetPos_Dir(posV2, dirV2) EntityFactory.SetParams("CampID", LuaConst.STANDALONE_ENEMY_CAMP) EntityFactory.SetParams("PlayerID", 2) EntityFactory.SetSelf_Sync(true, true) local entity = EntityFactory.DoCreateEntity() entity._logicInitData.IsTest = true --SystemManager.Active(entity, false) end function Cheat_Controller.SwitchAutoFight() if LevelManager.IsSyncSolo() then logging.error(LTAG.ERROR, "HYW : 注意!同步1v1开启自动战斗后,因为要设置elo,所以会引发不一致!") local otherPlayerId = LevelPlayerManager.MyPlayerIDInRoom == 1 and 2 or 1 local otherEntity = LevelPlayerManager.GetPlayerActiveEntity(otherPlayerId) if otherEntity then local entities = LevelPlayerManager.GetPlayerEntitysByPlayerIDInRoom(LevelPlayerManager.MyPlayerIDInRoom) if entities then for i,entity in ipairs(entities) do entity._logicInitData.elo = otherEntity._logicInitData.elo end end end end LuaInputManager.SetSpecialCommand(6) end --自动跑很多关 function Cheat_Controller.AutoRunLevels(isRecord) local BattleSimulatorAutoFight = require("Battle/Logic/MainLoop/BattleSimulatorAutoFight") BattleSimulatorAutoFight.RunLevels() end function Cheat_Controller.AutoRunBattleProfiler(levelID, playeID, playerCount) local BattleSimulatorAutoFight = require("Battle/Logic/MainLoop/BattleSimulatorBattleProfiler") BattleSimulatorAutoFight.StartFight(levelID, playeID, playerCount) end function Cheat_Controller.ShowWinPose() local entity = LogicUpdateManager._curEntity local victoryID = DataSheetManager.ConstData:GetDataByID("ScenesVictoryShowPoint").IntValue local item = LevelItemManager.GetItemByID(victoryID) if item then local itemData = item.ItemData local heroData = DataSheetManager.HeroNum:GetDataByID(entity._logicInitData.CharacterID) local victoryPoseEffect = entity.components.replace:GetVictoryPose(heroData.VictoryPose) local winEffect = "Public/Win/"..victoryPoseEffect SystemManager.OnWinBattle(entity, itemData.ItemPos, itemData.ItemDir,winEffect) else logging.error(LTAG.ERROR, "现在不在战斗关卡中,请勿使用该Cheat!!!") end end function private.ShowWinPoseWithoutChange(heroId) local entity = LogicUpdateManager._curEntity local victoryID = DataSheetManager.ConstData:GetDataByID("ScenesVictoryShowPoint").IntValue local item = LevelItemManager.GetItemByID(victoryID) if item then local itemData = item.ItemData local heroData = DataSheetManager.HeroNum:GetDataByID(heroId) local victoryPoseEffect = entity.components.replace:GetVictoryPose(heroData.VictoryPose) local winEffect = "Public/Win/"..victoryPoseEffect --SystemManager.OnWinBattle()方法注释掉一行代码 local MoveSystem = require "Battle/Logic/Entity/System/MoveSystem" local RotateSystem = require "Battle/Logic/Entity/System/RotateSystem" local AdjutantSystem = require "Battle/Logic/Entity/System/AdjutantSystem" local BuffSystem = require "Battle/Logic/Entity/System/BuffSystem" if not LevelManager.ShouldKeepSyncLevel() and not LevelManager.IsGoldHeroCooperate() then NotSyncBattleSetter.SetPveAutoFightState(false) end RotateSystem.OnConvey(entity, itemData.ItemDir) MoveSystem.OnConvey(entity, itemData.ItemPos) --ChangeAvatarSystem.OnWinBattle(entity) AdjutantSystem.OnConvey(entity) SystemManager.OffHorse(entity)-- 下马 BuffSystem.OnWinBattle(entity) ExpSystemManager.OnWinBattle(entity.ExpEntity, winEffect) entity.components.anim:InvalidateSetAnim() --禁用entity的动画设置,这样victoryPose动画就再也不会被修改了 else logging.error(LTAG.ERROR, "现在不在战斗关卡中,请勿使用该Cheat!!!") end end local WinPoseHeroId = 0 local IsShowWinPose = false function Cheat_Controller.ShowWinPoseWithHeroId(heroId, isOperate) if isOperate then IsShowWinPose = false end heroId = tonumber(heroId) WinPoseHeroId = heroId local heroData = DataSheetManager.HeroData:GetDataByID(heroId) if not heroData then logging.error(LTAG.ERROR, "没有ID为", heroId, "的武将,请检查!!!") return end local ChangeAvatarSystem = require "Battle/Logic/Entity/System/ChangeAvatarSystem" --主视角调用 local initInfo = LogicUpdateManager._curEntity._logicInitData initInfo:NotSyncResetInfo(heroId,0,false,nil, heroId,0,{ 201001}) ChangeAvatarSystem.ChangeAvatar(LogicUpdateManager._curEntity, heroId,nil ,nil, nil, true) TimerUtil.Interval(function() private.ShowWinPoseWithoutChange(heroId) end, 0.5, 1) end function Cheat_Controller.PlayAllHeroWinPose(isOperate) if isOperate then IsShowWinPose = not IsShowWinPose if IsShowWinPose then logging.log(LTAG.LOG, "开始轮播武将胜利Pose!!!") else logging.log(LTAG.LOG, "暂停轮播武将胜利Pose!!!") end end if IsShowWinPose then if DataSheetManager.HeroNum:GetDataByID(WinPoseHeroId + 1) then WinPoseHeroId = WinPoseHeroId + 1 Cheat_Controller.ShowWinPoseWithHeroId(WinPoseHeroId) TimerUtil.Interval(function() Cheat_Controller.PlayAllHeroWinPose() end, 6, 1) else WinPoseHeroId = 0 IsShowWinPose = false end end end function Cheat_Controller.PlayNextHeroWinPose() IsShowWinPose = false WinPoseHeroId = WinPoseHeroId + 1 if DataSheetManager.HeroNum:GetDataByID(WinPoseHeroId) then Cheat_Controller.ShowWinPoseWithHeroId(WinPoseHeroId) else logging.error(LTAG.ERROR, "武将ID:", WinPoseHeroId, "没有对应武将数据,当前已回退到ID:", WinPoseHeroId - 1, "的武将!") WinPoseHeroId = WinPoseHeroId - 1 end end function Cheat_Controller.PlayLastHeroWinPose() IsShowWinPose = false WinPoseHeroId = WinPoseHeroId - 1 if DataSheetManager.HeroNum:GetDataByID(WinPoseHeroId) then Cheat_Controller.ShowWinPoseWithHeroId(WinPoseHeroId) else logging.error(LTAG.ERROR, "武将ID:", WinPoseHeroId, "没有对应武将数据,当前已回退到ID:", WinPoseHeroId + 1, "的武将!") WinPoseHeroId = WinPoseHeroId + 1 end end function Cheat_Controller.ReplaceMusouSkillByWeaponLevel(mainWeaponLevelStr, viceWeaponLevelStr) local mainWeaponLevel = tonumber(mainWeaponLevelStr) or 1 local viceWeaponLevel = tonumber(viceWeaponLevelStr) logging.error(LTAG.ERROR, "HYW : 替换神兵等级 - 主将神兵等级 : ", mainWeaponLevel, " 副将神兵等级 : ", viceWeaponLevel) local heroArmyData = LevelPlayerManager.GetPlayerArmyData(LevelPlayerManager.MyPlayerIDInRoom, LogicUpdateManager._curEntity) heroArmyData.mainHeroWeaponLevels = mainWeaponLevel if viceWeaponLevel then heroArmyData.viceHeroWeaponLevels = viceWeaponLevel end LogicUpdateManager._curEntity.components.skillBase:TryReplaceSkillByMagicWeapon(LogicUpdateManager._curEntity:GetOriginCharacterData()) LogicUpdateManager._entityDic[LogicUpdateManager._curEntity.EntityID + 1].components.skillBase:TryReplaceSkillByMagicWeapon(LogicUpdateManager._entityDic[LogicUpdateManager._curEntity.EntityID + 1]:GetOriginCharacterData()) end --肉鸽玩法设置某个技能的等级 skillType = skillNodeData.BelongToSkill function Cheat_Controller.SetRogueSkillGrade(skillType, grade) local list = LevelManager.CurLevelFunc.skillGradeList local find = false for _, info in ipairs(list) do if info[1] == skillType then info[2] = grade find = true break end end if not find then table.insert(list, {skillType, grade}) end local Const_SkillMaxGrade = DataSheetManager.ConstData:GetDataByID("Rogue_SkillMaxGrade").IntValue if grade >= Const_SkillMaxGrade then LevelManager.CurLevelFunc:SkillUptoMaxRefreshRandomPool(skillType) -- 最高级后则移除 else LevelManager.CurLevelFunc:SkillLevelUpRefreshRandomPool(skillType, grade) -- 检测本技能是否有新功能分支进入随机池 end EventSystem.Dispatch(EventID.RogueLike_SkillGradeUp, false, skillType, grade) -- 通知界面,哪个技能升级到了多少级 end --肉鸽玩法,直接添加某个技能节点 function Cheat_Controller.UseRogueSkillNode(nodeId, clearRandomPool) LevelManager.CurLevelFunc:PauseLogic(true) LevelManager.CurLevelFunc.randomResult = {nodeId} LevelManager.CurLevelFunc:RogueSelectUpgradeSkill(1) if clearRandomPool then LevelManager.CurLevelFunc.skillRandomPool = {} LevelManager.CurLevelFunc.preSkillRandomPool = {} end end -- 设置无双小黑屋是否开启 function Cheat_Controller.SetSkillInterCutType(isOpen) local state = isOpen and LuaConst.SkillInterCutEnum.Every or LuaConst.SkillInterCutEnum.Never MDL.Setting.SetSkillInterCutType(state) end function Cheat_Controller.SetRandomValue(value) if value and value >= 0 then -- if not Cheat_Controller.__oldGetRangeValue then --不能设置范围类型(小数)的,否则整个游戏运行都会受影响,只能设置整数形的LogicRandom.GetIntegerValue -- Cheat_Controller.__oldGetRangeValue = LogicRandom.GetRangeValue -- end if not Cheat_Controller.__oldGetIntegerValue then Cheat_Controller.__oldGetIntegerValue = LogicRandom.GetIntegerValue end -- local valueFp = FP.newV1(value) -- LogicRandom.GetRangeValue = function() -- logging.error(LTAG.ERROR, "HYW : 111") -- return valueFp -- end LogicRandom.GetIntegerValue = function() return value end else -- if Cheat_Controller.__oldGetRangeValue then -- LogicRandom.GetRangeValue = Cheat_Controller.__oldGetRangeValue -- Cheat_Controller.__oldGetRangeValue = nil -- end if Cheat_Controller.__oldGetIntegerValue then LogicRandom.GetIntegerValue = Cheat_Controller.__oldGetIntegerValue Cheat_Controller.__oldGetIntegerValue = nil end end end function Cheat_Controller.KCPConnectLastIP() local connectInfo = MultiplayManager.GetKCPConnectInfo() local connectFunc = Cheat_Controller.KCPConnect or KCPTransport.Connect connectFunc(connectInfo.ip ,connectInfo.port ,connectInfo.roomId ,connectInfo.playerId ) -- 不连接暂时没办法让Lua获取到大补帧数据 end function Cheat_Controller.ManualKCPConnect() Cheat_Controller.KCPConnect = KCPTransport.Connect KCPTransport.Connect = function() end end -- 模拟切换汇率 function Cheat_Controller.GetExchangeRateTable() return { { dropDownValue = { "默认", "香港地区", "台湾地区", "日本", "韩国", "印度尼西亚" }, dropDownData = { 1, 2, 3, 4, 5, 6 } } } end -- 设置汇率 function private.SetExchangeRateType(commandName, commandParam) local ExchangeRateJsonStrList = require("Modules/Cheat/ExchangeRateJsonStrList") local exchangeRateTable = ExchangeRateJsonStrList[commandParam.ExchangeRateType] MDL.Currency.CheatSetSkuDetail(exchangeRateTable) end return Cheat_Controller