Gm.lua 50 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582158315841585158615871588158915901591159215931594159515961597159815991600160116021603160416051606160716081609161016111612161316141615161616171618161916201621162216231624162516261627162816291630163116321633163416351636163716381639164016411642164316441645164616471648164916501651165216531654165516561657165816591660166116621663166416651666166716681669167016711672167316741675167616771678167916801681168216831684168516861687168816891690169116921693169416951696169716981699170017011702170317041705170617071708170917101711171217131714171517161717171817191720172117221723172417251726172717281729173017311732173317341735173617371738173917401741174217431744174517461747174817491750175117521753175417551756175717581759176017611762176317641765176617671768176917701771177217731774177517761777177817791780178117821783178417851786178717881789179017911792179317941795179617971798179918001801180218031804180518061807180818091810181118121813181418151816181718181819182018211822182318241825182618271828182918301831183218331834183518361837183818391840184118421843184418451846184718481849
  1. local Config = require("Config")
  2. local Util = require("common.Util")
  3. local Log = require("common.Log")
  4. local Msg = require("core.Msg")
  5. local ObjHuman = require("core.ObjHuman")
  6. local BagLogic = require("bag.BagLogic")
  7. local Broadcast = require("broadcast.Broadcast")
  8. local Util = require("common.Util")
  9. local InnerMsg = require("core.InnerMsg")
  10. local CommonDB = require("common.CommonDB")
  11. local JjcDB = require("jjc.JjcDB")
  12. local VipLogic = require("vip.VipLogic")
  13. local VipExcel = require("excel.vip")
  14. local GMExcel = require("excel.gm")
  15. local RoleLogic = require("role.RoleLogic")
  16. local UnionDBLogic = require("union.UnionDBLogic")
  17. local CombatPosLogic = require("combat.CombatPosLogic")
  18. local CombatDefine = require("combat.CombatDefine")
  19. local ItemDefine = require("bag.ItemDefine")
  20. local MiddleConnect = require("middle.MiddleConnect")
  21. local BuyLogic = require("topup.BuyLogic")
  22. local WeekendLoopActManger = require("WeekendLoopActivity.WeekendLoopActManager")
  23. d3 = {}
  24. local function send(human, err)
  25. local mm = Msg.gc.GC_CHAT
  26. mm.item.msgType = 3
  27. mm.item.targetUuid = ""
  28. mm.item.sendTime = os.time()
  29. mm.item.msg = tostring(err)
  30. mm.item.vipLv = human.db.vipLv or 0
  31. mm.item.videoUuid = ""
  32. mm.item.isJson = 0
  33. mm.item.unionFrame = 0
  34. local union = {}
  35. if human.db.unionUuid ~= nil then
  36. union = UnionDBLogic.getUnion(human.db.unionUuid)
  37. end
  38. RoleLogic.getRoleBase(human,mm.item.roleBase)
  39. mm.item.label = human.db.throneLabel or 0
  40. Msg.send(mm, human.fd)
  41. end
  42. -- 直接调用gm命令
  43. function execGm(human, cmd,pos)
  44. print("直接调用gm命令",cmd,pos)
  45. Log.write(Log.LOGID_OSS_GM_CODE, human.db._id, human.db.account, human.db.name, cmd, pos)
  46. d3[cmd](human, tonumber(pos) or pos)
  47. return true
  48. end
  49. function checkGm(human, str)
  50. if not Config.IS_USE_GM_CMD and human.db.gm == nil then
  51. return
  52. end
  53. local pos = string.find(str, " ", 1, true)
  54. local cmd = string.sub(str, 1, pos and pos - 1)
  55. if not Config.IS_USE_GM_CMD then
  56. if human.db.gm == 1 and not GmControl[cmd] then -- 一级权限的gm只能使用部分gm命令
  57. send(human, "not permit for this gm cmd!")
  58. return true
  59. end
  60. if human.db.gm == 100 then -- 新手引导员不能使用gm命令
  61. return
  62. end
  63. end
  64. if not d3[cmd] then
  65. return
  66. end
  67. local arg = string.sub(str, #cmd + 2)
  68. Log.write(Log.LOGID_OSS_GM_CODE, human.db._id, human.db.account, human.db.name, cmd, arg)
  69. d3[cmd](human, tonumber(arg) or arg)
  70. return true
  71. end
  72. function d3.heroadd(human,val)
  73. if val == nil then return end
  74. local tb = Util.split(val, " ")
  75. local id = tonumber(tb[1])
  76. local cnt = tonumber(tb[2])
  77. local lv = tonumber(tb[3])
  78. local star = tonumber(tb[4])
  79. if not (id and cnt) then return end
  80. for i = 1, cnt do
  81. local heroGrid = require("hero.HeroGrid").createHeroGrid(id , star)
  82. if not heroGrid then break end
  83. local attrConfig = require("hero.HeroDefine").getAttrConfig(id, heroGrid.star)
  84. if not attrConfig then return end
  85. local quality = require("hero.HeroGrid").getMaxQualityByLv(heroGrid.star, lv)
  86. local maxLv = require("hero.HeroGrid").getMaxLv(heroGrid.star, quality)
  87. heroGrid.lv = math.min(maxLv, lv or 0)
  88. heroGrid.quality = math.max(heroGrid.quality, quality or 0)
  89. require("hero.HeroLogic").addHeroByGrid(human, heroGrid, "gm")
  90. end
  91. end
  92. function d3.herodel(human,val)
  93. if val == nil then return end
  94. local pos = string.find(val, " ", 1, true)
  95. if pos == nil then return end
  96. local index = tonumber(string.sub(val, 1, pos - 1))
  97. local cnt= tonumber(string.sub(val,pos+1,#val))
  98. require("hero.HeroLogic").delHeroByIndex(human,index,"gm")
  99. end
  100. function d3.herodelAll(human,val)
  101. for index = 1, human.db.heroBag[0]do
  102. require("hero.HeroLogic").delHeroByIndex(human,index,"gm")
  103. end
  104. end
  105. function d3.itemadd(human,val)
  106. if val == nil then return end
  107. local pos = string.find(val, " ", 1, true)
  108. if pos == nil then return end
  109. local id = tonumber(string.sub(val, 1, pos - 1))
  110. if not id then
  111. local name = string.sub(val, 1, pos - 1)
  112. local ItemExcel = require("excel.item").item
  113. for k,v in pairs(ItemExcel) do
  114. if v.name == name then
  115. id = k
  116. break
  117. end
  118. end
  119. end
  120. if not id then
  121. local name = string.sub(val,1,pos - 1)
  122. local EquipExcel = require("excel.equip").equip
  123. for k,v in pairs(EquipExcel) do
  124. if v.name == name then
  125. id = k
  126. break
  127. end
  128. end
  129. end
  130. if not id then
  131. return
  132. end
  133. local EquipExcel = require("excel.equip").equip
  134. if EquipExcel[id] then
  135. local cnt= tonumber(string.sub(val,pos+1,pos + 2))
  136. local rare= tonumber(string.sub(val,pos+2,#val))
  137. require("bag.BagLogic").addItem(human, id, cnt, "gm", nil, rare)
  138. human.getEquip = nil
  139. else
  140. -- 分开是因为 常规道具 给不了
  141. local cnt= tonumber(string.sub(val,pos+1,#val))
  142. require("bag.BagLogic").addItem(human,id,cnt,"gm")
  143. end
  144. end
  145. -- 删除道具
  146. function d3.itemdel(human,val)
  147. if val == nil then return end
  148. local pos = string.find(val, " ", 1, true)
  149. if pos == nil then return end
  150. local id = tonumber(string.sub(val, 1, pos - 1))
  151. local cnt= tonumber(string.sub(val,pos+1,#val))
  152. require("bag.BagLogic").delItem(human,id,cnt,"gm")
  153. end
  154. function d3.qingbaoMax(human)
  155. require("bar.BarTaskLogic").addBarQingBao(human, 10000)
  156. end
  157. function d3.maxbattle(human, val)
  158. val = val + 0
  159. human.db.battleID = val
  160. human.db.guajiID = val - 1
  161. local BRoleLogic = require("billboard.BRoleLogic")
  162. local BillboardDefine = require("billboard.BillboardDefine")
  163. BRoleLogic.updateData(BillboardDefine.TYPE_BATTLE, human.db)
  164. end
  165. function d3.dbsave(human)
  166. ObjHuman.save(human)
  167. end
  168. -- 设置当前金币
  169. function d3.jinbi(human, val)
  170. val = val + 0
  171. ObjHuman.updateJinbi(human, val - human.db.jinbi, "gm")
  172. end
  173. -- 设置钻石
  174. function d3.zuanshi(human, val)
  175. val = val + 0
  176. if val > human.db.zuanshi then
  177. print("234234234",val)
  178. ObjHuman.addZuanshi(human, val - human.db.zuanshi, "gm")
  179. else
  180. ObjHuman.decZuanshi(human, val - human.db.zuanshi, "gm")
  181. end
  182. end
  183. --添加邮件
  184. function d3.mail(human,val)
  185. local param = Util.split(val, " ")
  186. local mailtype = tonumber(param[1])
  187. local title = param[2]
  188. local content = param[3]
  189. local max = #param
  190. local count = (type(param[max]) == "number") and param[max] or 1
  191. local items
  192. if param[4] then
  193. items = {}
  194. for i = 4,max-1 do
  195. items[#items + 1] = {tonumber(param[i]),math.floor(math.random(1,10))}
  196. end
  197. end
  198. if not (mailtype == 1 or mailtype == 2) or not title or not content then
  199. send(human, "参数错误 "..type.." "..title.." "..content.." "..#items)
  200. end
  201. local MailManager = require("mail.MailManager")
  202. for i= 1,count do
  203. MailManager.add(mailtype,human.db._id,title,content,items,mailtype == 2 and [[测试用户]])
  204. end
  205. end
  206. function d3.clbag(human)
  207. human.db.bag = {}
  208. local msgRet = Msg.gc.GC_BAG_LIST
  209. msgRet.list[0] = 0
  210. Msg.send(msgRet, human.fd)
  211. end
  212. function d3.clhero(human)
  213. local HeroLogic = require("hero.HeroLogic")
  214. for i = 1, human.db.heroBag[0] do
  215. HeroLogic.delHeroByIndex(human, i, "gm")
  216. end
  217. end
  218. function d3.god(human)
  219. local GMExcelConfig = GMExcel.god[1]
  220. BagLogic.addItemList(human, GMExcelConfig.addItem, "gm")
  221. for k, v in ipairs(GMExcelConfig.addHero) do
  222. local id = tonumber(v[1])
  223. local cnt = tonumber(v[2])
  224. local lv = tonumber(v[3])
  225. local star = tonumber(v[4])
  226. local quality = require("hero.HeroGrid").getMaxQualityByLv(star, lv)
  227. for i = 1, cnt do
  228. local heroGrid = require("hero.HeroGrid").createHeroGrid(id, star)
  229. if heroGrid then
  230. heroGrid.lv = math.max(heroGrid.lv, lv or 0)
  231. heroGrid.quality = math.max(heroGrid.quality, quality or 0)
  232. require("hero.HeroLogic").addHeroByGrid(human, heroGrid, "gm")
  233. end
  234. end
  235. end
  236. --d3.viplv(human, 13)
  237. --d3.lv(human, 1)
  238. --d3.noguide(human)
  239. end
  240. function d3.wudi(human)
  241. if wudi then
  242. wudi = false
  243. Broadcast.sendErr(human, "取消无敌状态")
  244. else
  245. wudi = true
  246. Broadcast.sendErr(human, "进入无敌状态")
  247. end
  248. end
  249. -- 清空副本次数和购买次数
  250. function d3.clcopy(human)
  251. human.db.copy = nil
  252. end
  253. -- 设置等级
  254. function d3.lv(human, val)
  255. val = val + 0
  256. local lvOld = human.db.lv
  257. local lvNew = val + 0
  258. human.db.lv = lvNew
  259. ObjHuman.onLvUpCB(human,lvOld , lvNew)
  260. end
  261. -- 加经验
  262. function d3.addexp(human, val)
  263. val = val + 0
  264. ObjHuman.addExp(human, val)
  265. end
  266. -- 设置vip等级
  267. function d3.viplv(human, val)
  268. val = val + 0
  269. local oldVipLv = VipLogic.getVipLv(human)
  270. human.db.vipExp = VipExcel.vip[val] and VipExcel.vip[val].exp or 0
  271. human.db.vipLv = val
  272. VipLogic.addExp(human, 0)
  273. end
  274. -- 增加vip经验
  275. function d3.vipexp(human, val)
  276. val = val + 0
  277. VipLogic.addExp(human, val)
  278. end
  279. function d3.it1(human, value)
  280. value = tonumber(value)
  281. if not value then return end
  282. local ItemExcel = require("excel.item").item
  283. local BagLogic = require("bag.BagLogic")
  284. for itemID, cf in pairs(ItemExcel) do
  285. if cf.subType == value then
  286. BagLogic.addItem(human, itemID, 1, "gm", true)
  287. end
  288. end
  289. BagLogic.sendBagList(human)
  290. end
  291. function d3.equip(human, value)
  292. value = tonumber(value)
  293. if not value then return end
  294. local BagLogic = require("bag.BagLogic")
  295. local EquipExcel = require("excel.equip").equip
  296. for itemID in pairs(EquipExcel) do
  297. BagLogic.addItem(human, itemID, 1, "gm", true)
  298. end
  299. BagLogic.sendBagList(human)
  300. end
  301. function d3.task(human, val)
  302. if val == nil then return end
  303. local task = string.find(val, " ", 1, true)
  304. if task == nil then return end
  305. local id = tonumber(string.sub(val, 1, task - 1))
  306. local cnt= tonumber(string.sub(val,task+1,#val))
  307. local DailyTaskLogic = require("dailyTask.DailyTaskLogic")
  308. DailyTaskLogic.recordDailyTaskFinishCnt(human, id, cnt, nil)
  309. end
  310. function d3.os(human, value)
  311. value = value and tonumber(value)
  312. if value == nil then
  313. local openSvrTime = CommonDB.getServerOpenTime()
  314. if openSvrTime == 0 then
  315. Broadcast.sendErr(human, "未设置开服时间")
  316. else
  317. local tb = os.date("%Y%m%d", openSvrTime)
  318. Broadcast.sendErr(human, "当前开服时间为" .. tb)
  319. end
  320. else
  321. local now = os.time()
  322. local temp = Util.getDayStartTime(now)
  323. temp = temp - (value - 1) * 24 * 3600
  324. CommonDB.setServerOpenTime(temp)
  325. local tb = os.date("%Y%m%d", temp)
  326. Broadcast.sendErr(human, "设置当前开服时间为" .. tb)
  327. --同步中心服开服时间
  328. --[[local msgRet = InnerMsg.lw.LW_OS
  329. msgRet.uuid = human.db._id
  330. msgRet.value = temp
  331. InnerMsg.sendMsg(0, msgRet)]]
  332. end
  333. end
  334. function d3.createtime(human, value)
  335. value = value and tonumber(value)
  336. if not value then return end
  337. local now = os.time()
  338. local temp = Util.getDayStartTime(now)
  339. temp = temp - (value - 1) * 24 * 3600
  340. human.db.createTime = temp
  341. local tb = os.date("%Y%m%d", temp)
  342. Broadcast.sendErr(human, "设置当前创角时间为" .. tb)
  343. end
  344. --设置中心服开服时间
  345. function d3.osw(human, value)
  346. value = value and tonumber(value)
  347. local msgRet = InnerMsg.lw.LW_OS
  348. msgRet.uuid = human.db._id
  349. msgRet.value = value
  350. InnerMsg.sendMsg(0, msgRet)
  351. end
  352. function d3.chengjiu(human,val)
  353. local param = Util.split(val, " ")
  354. local ChengjiuLogic = require("chengjiu.ChengjiuLogic")
  355. ChengjiuLogic.onCallback(human,3,3,4)
  356. end
  357. function d3.jjczero()
  358. local JjcLogic = require("jjc.JjcLogic")
  359. JjcLogic.onZero()
  360. end
  361. function d3.jjcreset()
  362. JjcDB.resetJJCDB()
  363. end
  364. function d3.jpSet(human,val)
  365. local point = tonumber(val)
  366. JjcDB.updatePlayerPoint(human.db._id, point, nil)
  367. end
  368. function d3.billboard(human)
  369. local BillboardDB = require("billboard.BillboardDB")
  370. BillboardDB.sort()
  371. end
  372. function d3.cldjs(human)
  373. human.db.jinbiExchange = nil
  374. end
  375. -- 激活钻石基金
  376. function d3.fund(human, val)
  377. local type = tonumber(val)
  378. local FundLogic = require("present.FundLogic")
  379. FundLogic.fundBuy(human, type)
  380. end
  381. -- 清空钻石基金购买和发放记录
  382. function d3.clfund(human)
  383. human.db.fundFlag = nil
  384. end
  385. function d3.clbuy(human)
  386. human.db.buy = {}
  387. end
  388. --增加好战者计数 仅限竞技场和试炼
  389. function d3.hzzadd(human, val)
  390. if val == nil then return end
  391. local pos = string.find(val, " ", 1, true)
  392. if pos == nil then return end
  393. local type = tonumber(string.sub(val, 1, pos - 1))
  394. local add= tonumber(string.sub(val,pos+1,#val))
  395. local MonthHzz = require("monthAct.MonthHzz")
  396. if type == MonthHzz.MONTHACT_HZZ_TYPE_1 then
  397. MonthHzz.addJjcFight(human, nil, add)
  398. elseif type == MonthHzz.MONTHACT_HZZ_TYPE_2 then
  399. MonthHzz.addTrialCnt(human, nil, add)
  400. end
  401. end
  402. function d3.ydjiuguan(human, val)
  403. if val == nil then return end
  404. local pos = string.find(val, " ", 1, true)
  405. if pos == nil then return end
  406. local star = tonumber(string.sub(val, 1, pos - 1))
  407. local add= tonumber(string.sub(val,pos+1,#val))
  408. local MonthDrunkery = require("monthAct.MonthDrunkery")
  409. MonthDrunkery.addDrunkCntEx(human, star, add)
  410. end
  411. function d3.ydhcjx(human, val)
  412. if val == nil then return end
  413. local param = Util.split(val, " ")
  414. local type = tonumber(param[1])
  415. local heroId= tonumber(param[2])
  416. local add = tonumber(param[3])
  417. local MonthHecJuex = require("monthAct.MonthHecJuex")
  418. MonthHecJuex.addCntByGm(human,type,heroId, add)
  419. end
  420. function d3.clboss(human)
  421. local DB = require("common.DB")
  422. local LuaMongo = _G.lua_mongo
  423. LuaMongo.remove(DB.db_boss)
  424. end
  425. function d3.clwish(human)
  426. human.db.wishCnt = nil
  427. human.db.wishActAlrCnt = nil
  428. end
  429. -- 设置高抽次数
  430. function d3.hsum(human,val)
  431. human.db.summonCnt = val
  432. end
  433. function d3.clhsum(human)
  434. human.db.summonCnt = nil
  435. human.db.sumWinScoCnt = nil
  436. end
  437. function d3.unionquery(human,val)
  438. local name = val
  439. local UnionLogic = require("union.UnionLogic")
  440. UnionLogic.createUnion(human,name)
  441. end
  442. function d3.uniondonate(human, value)
  443. local UnionDBLogic = require("union.UnionDBLogic")
  444. local union = UnionDBLogic.getUnion(human.db.unionUuid)
  445. if union == nil then
  446. return
  447. end
  448. union.donate = union.donate or {}
  449. union.donate[1] = value
  450. union.donate[2] = os.time()
  451. UnionDBLogic.updateUnionData(union)
  452. end
  453. function d3.settower(human,val)
  454. local HuanjingTowerLogic = require("huanjingTower.HuanjingTowerLogic")
  455. HuanjingTowerLogic.setTowerByGm(human, val)
  456. end
  457. function d3.setbattle(human,val)
  458. local BattleLogic = require("battle.BattleLogic")
  459. local param = Util.split(val, " ")
  460. BattleLogic.setBattleByGm(human, param[1], param[2])
  461. end
  462. function d3.overmonth(human, val)
  463. val = math.max(tonumber(val) or 0, 10)
  464. human.db.actMonthEndTime = os.time() + val
  465. end
  466. function d3.zhuanpantime(human,val)
  467. local param = Util.split(val, " ")
  468. local ZhuanpanLogic = require("zhuanpan.ZhuanpanLogic")
  469. ZhuanpanLogic.zhuanpanByGm(human, tonumber(param[1]), tonumber(param[2]) )
  470. end
  471. function d3.signin(human,val)
  472. human.db.signInCnt = val
  473. for i =1,human.db.signInCnt do
  474. human.db.signIn[i] = 1
  475. end
  476. end
  477. function d3.unionLv(human, val)
  478. val = tonumber(val)
  479. if not val then return end
  480. local UnionDBLogic = require("union.UnionDBLogic")
  481. local union = UnionDBLogic.getUnion(human.db.unionUuid)
  482. if not union then return end
  483. UnionDBLogic.upsetUnionData(union._id, "lv", val)
  484. UnionDBLogic.upsetUnionData(union._id, "exp", 0)
  485. end
  486. function d3.unionexp(human, val)
  487. val = tonumber(val)
  488. if not val then return end
  489. local UnionDBLogic = require("union.UnionDBLogic")
  490. local UnionLogic = require("union.UnionLogic")
  491. local union = UnionDBLogic.getUnion(human.db.unionUuid)
  492. if not union then return end
  493. UnionLogic.addUnionExp(union, val)
  494. UnionDBLogic.updateUnionData(union)
  495. end
  496. function d3.gws(human,val)
  497. local LoginSignLogic = require("loginSign.LoginSignLogic")
  498. for i = 1,val do
  499. LoginSignLogic.getReward(human)
  500. end
  501. end
  502. function d3.tsht(human)
  503. local AdminLogic = require("AdminLogic")
  504. local JsonInput = {}
  505. JsonInput.accountName = human.db.account
  506. JsonInput.roleName = human.db.name
  507. AdminLogic.adminFunction.getuserstatus(JsonInput)
  508. end
  509. function d3.bs(human,val)
  510. local param = Util.split(val, " ")
  511. local AdminLogic = require("AdminLogic")
  512. local JsonInput = {}
  513. JsonInput.account = human.db.account
  514. JsonInput.minute = param[1]
  515. JsonInput.reason = param[2]
  516. AdminLogic.adminFunction.banSay(JsonInput)
  517. end
  518. function d3.bl(human,val)
  519. local AdminLogic = require("AdminLogic")
  520. local JsonInput = {}
  521. JsonInput.accountName = human.db.account
  522. JsonInput.minute = val
  523. AdminLogic.adminFunction.banAccount(JsonInput)
  524. end
  525. function d3.bl2(human,val)
  526. local AdminLogic = require("AdminLogic")
  527. local param = Util.split(val, " ")
  528. local JsonInput = {}
  529. JsonInput.accountName = param[1]
  530. JsonInput.minute = tonumber(param[2])
  531. AdminLogic.adminFunction.banAccount(JsonInput)
  532. end
  533. function d3.cbl(human,val)
  534. local param = Util.split(val, " ")
  535. local AdminLogic = require("AdminLogic")
  536. local JsonInput = {}
  537. JsonInput.accountName = param[1]
  538. JsonInput.cancelBanSay = param[2]
  539. AdminLogic.adminFunction.cancelBanAccount(JsonInput)
  540. end
  541. function d3.bip(human,val)
  542. local param = Util.split(val, " ")
  543. local AdminLogic = require("AdminLogic")
  544. local JsonInput = {}
  545. JsonInput.IP = param[1]
  546. JsonInput.banTime = param[2]
  547. AdminLogic.adminFunction.banIp(JsonInput)
  548. end
  549. function d3.ursc(human)
  550. human.db.ectypeCnt = nil
  551. human.db.ectypeFreeTime = nil
  552. end
  553. function d3.sue(human,val)
  554. local newLevel = tonumber(val)
  555. if not newLevel then return end
  556. local UnionDBLogic = require("union.UnionDBLogic")
  557. local union = UnionDBLogic.getUnion(human.db.unionUuid)
  558. if not union then return end
  559. UnionDBLogic.updateBossLv(union,newLevel)
  560. end
  561. function d3.smtp(human,val)
  562. local param = Util.split(val, " ")
  563. local AdminLogic = require("AdminLogic")
  564. local JsonInput = {}
  565. JsonInput.recvType = 3
  566. JsonInput.title = param[1]
  567. JsonInput.content = param[2]
  568. JsonInput.fbAccount = param[3]
  569. JsonInput.senderName = "系统邮件"
  570. JsonInput.fbTime = os.time()
  571. JsonInput.fbContent = "反馈"
  572. JsonInput.startLv =0
  573. JsonInput.endLv = 51
  574. JsonInput.lastLoginTime = os.time() - 60*60
  575. AdminLogic.adminFunction.mail(JsonInput)
  576. end
  577. function d3.clmilltime(human)
  578. human.db.unionTaskGetTime = nil
  579. end
  580. function d3.tstx(human,val)
  581. local RoleHeadLogic = require("role.RoleHeadLogic")
  582. RoleHeadLogic.active(human, RoleHeadLogic.HEAD_TYPE_1, val)
  583. end
  584. function d3.tstxk(human,val)
  585. local RoleHeadLogic = require("role.RoleHeadLogic")
  586. RoleHeadLogic.active(human, RoleHeadLogic.HEAD_TYPE_2, val)
  587. end
  588. function d3.buy(human,val)
  589. local AdminLogic = require("AdminLogic")
  590. local PlatformHandler = require("platform.Handler")
  591. local ApiLogic = require("platform.ApiLogic")
  592. local BuyExcel = require("excel.buy")
  593. local buyConf = BuyExcel.buy[val]
  594. if not buyConf then return end
  595. local shopConf = BuyExcel.topup[val]
  596. if shopConf and shopConf.buyID == val then
  597. else
  598. shopConf = nil
  599. end
  600. local checkMoney = buyConf["CN"]
  601. local msg = {}
  602. msg.logintype = 2
  603. msg.openid = "oCD-L5RxAtfRe8-aiezdY-Ccla5U"
  604. msg.openkey = "VsBJf2DKah7QhzU5xuzLNA=="
  605. msg.yuanbao = shopConf and shopConf.cnt or buyConf.CN * 10
  606. msg.buyID = val
  607. msg.account = human.db.account
  608. msg.transaction_id = "transaction_id1"
  609. msg.pf = "android"
  610. msg.money = checkMoney
  611. ApiLogic.CHARGE_CODE_HIS = {}
  612. print("cccc:",val)
  613. BuyLogic.buy(human,val)
  614. --PlatformHandler.CG_TENCENT_BUY(human,msg)
  615. --AdminLogic.adminFunction.tencentPay(msg)
  616. end
  617. function d3.gol(human)
  618. local AdminLogic = require("AdminLogic")
  619. AdminLogic.adminFunction.getonlinelist()
  620. end
  621. function d3.htm(human,val)
  622. local AdminLogic = require("AdminLogic")
  623. local oJsonInput = {}
  624. oJsonInput.recvType = val -- 邮件类型
  625. oJsonInput.title = "111" -- 邮件标题
  626. oJsonInput.content = "222" -- 邮件内容
  627. oJsonInput.items = nil -- 道具列表 可以为空
  628. oJsonInput.accounts = nil -- 指定玩家列表
  629. oJsonInput.startLv = 0
  630. oJsonInput.endLv = 200
  631. AdminLogic.adminFunction.mail(oJsonInput)
  632. end
  633. function d3.cluwar(human)
  634. require("union.UnionWarLogic").cleanUnionWar()
  635. local msg = InnerMsg.lw.LW_GM
  636. msg.gm = "cluwarmiddle"
  637. InnerMsg.sendMsg(0, msg)
  638. end
  639. function d3.cluniontime(human)
  640. human.db.unionJoinTime = nil
  641. end
  642. function d3.cluwarmiddle()
  643. local LuaMongo = _G.lua_mongo
  644. local DB = require("common.DB")
  645. LuaMongo.remove(DB.db_union_war)
  646. end
  647. function d3.uwarstart()
  648. -- 需要周1、3、5使用
  649. local UnionWarLogic = require("union.UnionWarLogic")
  650. UnionWarLogic.cleanUnionWar()
  651. local msg = InnerMsg.lw.LW_GM
  652. msg.gm = "cluwarmiddle"
  653. InnerMsg.sendMsg(0, msg)
  654. UnionWarLogic.onHour(0)
  655. UnionWarLogic.onHour(1)
  656. local msg = InnerMsg.lw.LW_GM
  657. msg.gm = "uwarstartmiddle"
  658. InnerMsg.sendMsg(0, msg)
  659. end
  660. function d3.warMaxtest(human, value)
  661. require("union.UnionWarLogic").auto(value)
  662. end
  663. function d3.uwar(human,state)
  664. local msg = InnerMsg.lw.LW_GM
  665. msg.gm = "muwar "..state
  666. InnerMsg.sendMsg(0, msg)
  667. if state == 1 then
  668. local UnionWarDBLogic = require("union.UnionWarDBLogic")
  669. UnionWarDBLogic.onHour(0, true)
  670. end
  671. end
  672. function d3.uwarshop(human, lv)
  673. require("union.UnionWarLogic").upWarShopLv(human, tonumber(lv))
  674. end
  675. function d3.uwarBuff(human)
  676. local msg = InnerMsg.lw.LW_GM
  677. msg.gm = "muwarBuff ".. human.db.unionUuid
  678. InnerMsg.sendMsg(0, msg)
  679. end
  680. function d3.muwar(human,state)
  681. local UnionWarDBLogic = require("union.UnionWarDBLogic")
  682. if state == 1 then
  683. UnionWarDBLogic.onHour(0, true)
  684. elseif state == 2 then
  685. UnionWarDBLogic.onHour(2, true)
  686. elseif state == 3 then
  687. UnionWarDBLogic.onHour(20, true)
  688. end
  689. end
  690. function d3.muwarBuff(human, unionUuid)
  691. local UnionWarDBLogic = require("union.UnionWarDBLogic")
  692. UnionWarDBLogic.addBuffLvByGm(unionUuid)
  693. end
  694. function d3.uwartask(human, type)
  695. local UnionWarLogic = require("union.UnionWarLogic")
  696. UnionWarLogic.chegnjiuFinishGm(human, tonumber(type))
  697. end
  698. function d3.uwarstartmiddle()
  699. -- 匹配
  700. require("union.UnionWarMiddleLogic").matchUnionStart()
  701. end
  702. function d3.cljjc(human, val)
  703. val = tonumber(val)
  704. local msgRet = InnerMsg.lw.LW_CL_JJC
  705. msgRet.type = val
  706. InnerMsg.sendMsg(0, msgRet)
  707. end
  708. function d3.cluwar(human)
  709. require("union.UnionWarLogic").cleanUnionWar()
  710. local msg = InnerMsg.lw.LW_GM
  711. msg.gm = "cluwarmiddle"
  712. InnerMsg.sendMsg(0, msg)
  713. end
  714. function d3.cluwarmiddle()
  715. local LuaMongo = _G.lua_mongo
  716. local DB = require("common.DB")
  717. LuaMongo.remove(DB.db_union_war)
  718. end
  719. function d3.uwarstart()
  720. -- 需要周1、3、5使用
  721. require("union.UnionWarLogic").onHour(0)
  722. require("union.UnionWarLogic").onHour(1)
  723. local msg = InnerMsg.lw.LW_GM
  724. msg.gm = "uwarstartmiddle"
  725. InnerMsg.sendMsg(0, msg)
  726. end
  727. function d3.uwarstartmiddle()
  728. -- 匹配
  729. require("union.UnionWarMiddleLogic").matchUnionStart()
  730. end
  731. function d3.cxh(human)
  732. d3.tgod(human)
  733. d3.lv(human,200)
  734. end
  735. function d3.drop(human,val)
  736. local BattleLogic = require("battle.BattleLogic")
  737. local param = Util.split(val, " ")
  738. local cnt = tonumber(param[1])
  739. local battleID = tonumber(param[2])
  740. BattleLogic.clacItemCntGM(human,cnt,battleID)
  741. end
  742. function d3.uif(human,val)
  743. local jsonInput = {}
  744. jsonInput.unionName = val
  745. local AdminLogic = require("AdminLogic")
  746. AdminLogic.adminFunction.unionInfo(jsonInput)
  747. end
  748. function d3.ul(human,val)
  749. local jsonInput = {}
  750. jsonInput.start = tonumber(val)
  751. local AdminLogic = require("AdminLogic")
  752. AdminLogic.adminFunction.unionList(jsonInput)
  753. end
  754. function d3.monthgaochou(human, val)
  755. local MonthSummon = require("monthAct.MonthSummon")
  756. MonthSummon.onSummon(human, tonumber(val))
  757. end
  758. function d3.jhtq(human,val)
  759. local TequanLogic = require("qqTequan.TequanLogic")
  760. local param = Util.split(val, " ")
  761. local val1 = tonumber(param[1])
  762. local val2 = tonumber(param[2])
  763. local val3 = tonumber(param[3])
  764. local val4 = tonumber(param[4])
  765. TequanLogic.activateTequan(human,val1,val2,val3,val4)
  766. end
  767. function d3.unionTecLv(human,val)
  768. local UnionTecLogic = require("union.UnionTecLogic")
  769. UnionTecLogic.lvAllUpByGm(human)
  770. end
  771. function d3.auto(human,val)
  772. local param = Util.split(val, " ")
  773. local str = param[1]
  774. local val = param[2]
  775. if not str or not val then
  776. return
  777. end
  778. for i = 1, val do
  779. require("union.UnionWarLogic").auto(str .. string.format("%02d", i))
  780. end
  781. end
  782. function d3.lvAuto(human, val)
  783. val = val + 0
  784. local lvOld = human.db.lv
  785. local lvNew = val + 0
  786. human.db.lv = lvNew
  787. end
  788. function d3.cap(human)
  789. human.db.buyCapCnt = require("hero.HeroDefine").BUY_CAP_CNT
  790. require("hero.HeroLogic").sendHeroBagCap(human)
  791. end
  792. function d3.abscharge(human)
  793. AbsBillboardLogic.charge(human,1000)
  794. end
  795. function d3.jhpt(human)
  796. if human.pf_info.pf == "qqgame" then
  797. human.db.txHall = {}
  798. elseif human.pf_info.pf == "qzone" or human.pf_info.pf == "website" then
  799. human.db.qqZone = {}
  800. end
  801. end
  802. function d3.addfuwen(human)
  803. d3.itemadd(human,"80001 10")
  804. d3.itemadd(human,"80002 10")
  805. d3.itemadd(human,"80003 10")
  806. d3.itemadd(human,"80004 10")
  807. d3.itemadd(human,"80005 10")
  808. end
  809. function d3.addSmelt(human,val)
  810. local num = tonumber(val)
  811. human.db.smeltVal = human.db.smeltVal or 0
  812. human.db.smeltVal = human.db.smeltVal + num
  813. end
  814. function d3.zdfw(human,val)
  815. local param = Util.split(val, " ")
  816. local fuwenID = tonumber(param[1])
  817. local attr1 = tonumber(param[2])
  818. local val1 = tonumber(param[3])
  819. local attr2 = tonumber(param[4])
  820. local val2 = tonumber(param[5])
  821. local skill1 = tonumber(param[6])
  822. local skill2 = tonumber(param[7])
  823. local FuwenGrid = require("fuwen.FuwenGrid")
  824. local FuwenExcel = require("excel.fuwen").skill
  825. if (skill1 ~= nil and FuwenExcel[skill1] == nil) or (skill2 ~= nil and FuwenExcel[skill2] == nil) then
  826. print("fuck! add fuwen skill is notreal")
  827. return
  828. end
  829. FuwenGrid.setFuwenSkillAttrByGM(human,fuwenID,attr1,val1,attr2,val2,skill1,skill2)
  830. end
  831. function d3.t2(human)
  832. local input = [[{"method":"OnTokenReturnForBuy","tencent_ret":{"ret":0,"token":"fC283BD0141D50418B68200972FBEE6A13102","url_params":"\/v1\/r\/1110099166\/mobile_goods_info?token_id=BC283BD0141D50418B68200972FBEE6A13102&transaction_id=BC283BD0141D50418B68200972FBEE6A13102&out_trade_no=&new_cpay=1&offer_type=0","transaction_id":"BC283BD0141D50418B68200972FBEE6A13102","attach":""},"callback_general_param":{"name":"0-15D9C743A68D57FF8B22CC944BAEAD8C","account":"0-a"}}]]
  833. local ret = require("AdminLogic").handleAdminRequest(_, input)
  834. print(ret)
  835. end
  836. function d3.t1(human)
  837. local input = {}
  838. input.token = "fC283BD0141D50418B68200972FBEE6A13102"
  839. input.payitem = "39*60*1"
  840. input.billno = os.time()
  841. local ret = require("platform.QQApi").onDeliverReturnForBuy(input)
  842. print(ret.ret,ret.msg)
  843. end
  844. function d3.skin(human,val)
  845. local tb = Util.split(val, " ")
  846. local id = tonumber(tb[1])
  847. local cnt = tonumber(tb[2])
  848. print(id,tb[1],tb[2])
  849. if not id then
  850. human.db.skinBag = {[0] = 999}
  851. return
  852. end
  853. local SkinLogic = require("skin.SkinLogic")
  854. SkinLogic.addSkin(human,id,cnt)
  855. end
  856. function d3.ff(human,val)
  857. local FriendLogic = require("friend.FriendLogic")
  858. FriendLogic.addFriend(human, val)
  859. end
  860. function d3.chenghao(human,val)
  861. val = tonumber(val)
  862. if not val then
  863. return
  864. end
  865. local RoleHeadLogic = require("role.RoleHeadLogic")
  866. RoleHeadLogic.active(human, RoleHeadLogic.HEAD_TYPE_4, val)
  867. end
  868. function d3.unionBillboard(human,val)
  869. val = tonumber(val)
  870. if not val then
  871. return
  872. end
  873. local BRoleLogic = require("billboard.BRoleLogic")
  874. BRoleLogic.queryUnionBillboard(human,val)
  875. end
  876. function d3.herotest(human, val)
  877. local tb = Util.split(val, " ")
  878. local combatType = 1
  879. local HeroExcel = require("excel.hero")
  880. local HeroLogic = require("hero.HeroLogic")
  881. local flags = {}
  882. human.db.combatHero = human.db.combatHero or {}
  883. human.db.combatHero[combatType] = {}
  884. for pos = 1, 6 do
  885. local id = tonumber(tb[pos])
  886. local index = nil
  887. if id and HeroExcel.hero[id] then
  888. for i = 1, human.db.heroBag[0] do
  889. local heroGrid = human.db.heroBag[i]
  890. if heroGrid and (heroGrid.id == id) and
  891. (not flags[i]) then
  892. flags[i] = true
  893. index = i
  894. break
  895. end
  896. end
  897. if not index then
  898. index = HeroLogic.getEmptyIndex(human)
  899. d3.heroadd(human, id .. " 1")
  900. end
  901. end
  902. human.db.combatHero[combatType][pos] = index
  903. end
  904. local CombatHandler = require("combat.Handler")
  905. CombatHandler.CG_COMBAT_BEGIN(human,{type = combatType, param = ""})
  906. end
  907. function d3.combat(human, monsterOutID)
  908. local CombatLogic = require("combat.CombatLogic")
  909. local param = {}
  910. param.defender, _, param.defRBase, param.defFormation = CombatLogic.getMonsterObjList(monsterOutID)
  911. require("combat.CombatLogic").combatBegin(human, 1001, param, 1)
  912. end
  913. function d3.combat2(human,id)
  914. local id = tonumber(id)
  915. local combatConf = require("excel.combat").gm[id]
  916. if not combatConf then
  917. assert()
  918. end
  919. local HeroGrid = require("hero.HeroGrid")
  920. local HeroLogic = require("hero.HeroLogic")
  921. local CombatLogic = require("combat.CombatLogic")
  922. local fakeman1 = {}
  923. local account1 = "combatFakeman1"
  924. local fakeman2 = {}
  925. local account2 = "combatFakeman2"
  926. local RoleDBLogic = require("role.RoleDBLogic")
  927. local fakemanDB1 = RoleDBLogic.getDbByAccount(account1)
  928. if not fakemanDB1 then
  929. fakemanDB1 = RoleDBLogic.createDefaultRole(account1)
  930. end
  931. fakeman1.db = fakemanDB1
  932. local fakemanDB2 = RoleDBLogic.getDbByAccount(account2)
  933. if not fakemanDB2 then
  934. fakemanDB2 = RoleDBLogic.createDefaultRole(account2)
  935. end
  936. fakeman2.db = fakemanDB2
  937. local attacker = {}
  938. local defender = {}
  939. for i = 1, fakeman1.db.heroBag[0] do
  940. HeroLogic.delHeroByIndex(fakeman1, i, "gm")
  941. end
  942. for i = 1, fakeman2.db.heroBag[0] do
  943. HeroLogic.delHeroByIndex(fakeman2, i, "gm")
  944. end
  945. for k,v in ipairs(combatConf.atk) do
  946. local heroGrid = HeroGrid.createHeroGrid(v[1], v[4])
  947. heroGrid.lv = math.max(heroGrid.lv, v[3] or 0)
  948. heroGrid.quality = HeroGrid.getMaxQuality(heroGrid.star)
  949. local heroIndex = HeroLogic.addHeroByGrid(fakeman1, heroGrid, "gm")
  950. attacker[v[2]] = CombatLogic.createHumanObj(fakeman1, heroGrid.uuid)
  951. end
  952. for k,v in ipairs(combatConf.def) do
  953. local heroGrid = HeroGrid.createHeroGrid(v[1], v[4])
  954. heroGrid.lv = math.max(heroGrid.lv, v[3] or 0)
  955. heroGrid.quality = HeroGrid.getMaxQuality(heroGrid.star)
  956. local heroIndex = HeroLogic.addHeroByGrid(fakeman2, heroGrid, "gm")
  957. defender[v[2]] = CombatLogic.createHumanObj(fakeman2, heroGrid.uuid)
  958. end
  959. local atkPet = nil
  960. local defPet = nil
  961. CombatLogic.combatGm(human,1001,combatConf.atkF, attacker,combatConf.defF,defender,atkPet,defPet,{{101,1},{102,2},{103,3},{104,4}})
  962. end
  963. function d3.combatEnd(human)
  964. local CombatLogic = require("combat.CombatLogic")
  965. for i = CombatDefine.COMBAT_TYPE1, CombatDefine.COMBAT_TYPE_MAX do
  966. CombatLogic.clientFinish(human, i)
  967. end
  968. end
  969. -- it道具添加(支持中文)
  970. function d3.it(human,value)
  971. local tb = Util.split(value," ")
  972. local id = tonumber(tb[1])
  973. local cnt = tonumber(tb[2])
  974. if id == nil then id = tb[1] end
  975. if type(id) == "string" then
  976. id = ItemDefine.getIdByName(id)
  977. end
  978. if type(id) ~= "number" then
  979. print("err id", tb[1], id, type(id))
  980. return
  981. end
  982. cnt = cnt or 1000
  983. BagLogic.addItem(human, id, cnt, "gm")
  984. end
  985. -- 清除酒馆
  986. function d3.clbartask(human)
  987. human.db.bar = nil
  988. end
  989. function d3.updaily(human)
  990. ObjHuman.updateDaily(human, true)
  991. end
  992. function d3.clguide(human)
  993. human.db.noguide = nil
  994. human.db.guide = nil
  995. human.guideLoginStep = nil
  996. require("guide.GuideLogic").refreshGuide(human)
  997. require("guide.GuideLogic").sendStep(human)
  998. end
  999. function d3.nextguide(human)
  1000. local GuideExcel = require("excel.guide")
  1001. local GuideLogic = require("guide.GuideLogic")
  1002. local id = GuideLogic.getGuideID(human)
  1003. local nextstep = GuideLogic.getGuideStep(human) + 1
  1004. local cf = id and GuideExcel.main_guide[id]
  1005. local sid = cf and cf.guideList[nextstep]
  1006. GuideLogic.stepFinish(human, sid)
  1007. end
  1008. function d3.guide(human, id)
  1009. human.db.noguide = nil
  1010. human.guideLoginStep = nil
  1011. local GuideLogic = require("guide.GuideLogic")
  1012. GuideLogic.setGuide(human, id, GuideLogic.STATE_DOING)
  1013. GuideLogic.sendStep(human)
  1014. end
  1015. -- 跳过指引
  1016. function d3.noguide(human)
  1017. human.db.noguide = true
  1018. human.guideLoginStep = nil
  1019. require("guide.GuideLogic").sendStep(human, true)
  1020. end
  1021. function d3.creatunion(human,value)
  1022. d3.lv(human,30)
  1023. d3.viplv(human,2)
  1024. d3.zuanshi(human, 1000)
  1025. local UnionLogic = require("union.UnionLogic")
  1026. UnionLogic.createUnion(human, value)
  1027. end
  1028. function d3.cldraw(human, value)
  1029. human.db.drawCard = {jifen=tonumber(value),list={[1]={},[2]={},[3]={},[4]={}}}
  1030. end
  1031. function d3.cldrill(human)
  1032. require("drill.DrillDB").reset()
  1033. end
  1034. function d3.zhengdian(_, hour)
  1035. hour = tonumber(hour) or 0
  1036. require("core.Timer").doZhengDian(hour)
  1037. end
  1038. function d3.tgod(human)
  1039. local HeroLogic = require("hero.HeroLogic")
  1040. local HeroGrid = require("hero.HeroGrid")
  1041. local HeroExcel = require("excel.hero")
  1042. for heroID, config in pairs(HeroExcel.tujian) do
  1043. local heroConfig = HeroExcel.hero[heroID]
  1044. if heroConfig then
  1045. local star = heroConfig.star
  1046. local maxQuality = HeroGrid.getMaxQuality(star)
  1047. local maxLv = HeroGrid.getMaxLv(star,maxQuality)
  1048. d3.heroadd(human, heroID .. " 1".." "..maxLv.." "..maxQuality)
  1049. end
  1050. end
  1051. end
  1052. function d3.tujian(human, camp)
  1053. local HeroExcel = require("excel.hero")
  1054. camp = tonumber(camp)
  1055. for heroID, config in pairs(HeroExcel.tujian) do
  1056. if config.camp == camp or not camp then
  1057. d3.heroadd(human, heroID .. " 1")
  1058. end
  1059. end
  1060. end
  1061. function d3.cljingcailibao(human)
  1062. human.db.dailyLeiChong = nil
  1063. human.db.leichongHaoli = nil
  1064. human.db.topupAcountDaily = nil
  1065. human.db.topupAccountMonth = nil
  1066. end
  1067. function d3.qijifen(human,value)
  1068. human.db.sevenDayGoal = human.db.sevenDayGoal or {}
  1069. human.db.sevenDayGoal[9] = human.db.sevenDayGoal[8] or {}
  1070. human.db.sevenDayGoal[9].jifen = value
  1071. end
  1072. function d3.clqirimubiao(human)
  1073. human.db.sevenDayGoal = nil
  1074. end
  1075. function d3.throne(human, str)
  1076. if str == nil then return end
  1077. local tb = Util.split(str, " ")
  1078. local id = tonumber(tb[1])
  1079. local lv = tonumber(tb[2])
  1080. if not id or not lv then return end
  1081. local TheStarsDBLogic = require("theStars.TheStarsDBLogic")
  1082. local list = TheStarsDBLogic.getThroneList()
  1083. local throne = list[id]
  1084. if not throne then return end
  1085. throne.lv = lv
  1086. TheStarsDBLogic.updateThroneDB(throne)
  1087. end
  1088. function d3.cltsts(human)
  1089. human.db.throneTime = human.db.throneTime - 14400
  1090. end
  1091. -- 删号
  1092. function d3.delaccount(human, account)
  1093. if not account then return end
  1094. local target = ObjHuman.onlineAccount[account]
  1095. if target then
  1096. return Broadcast.sendErr(human, "can't delete online")
  1097. end
  1098. local RoleDBLogic = require("role.RoleDBLogic")
  1099. if not RoleDBLogic.getDbByAccount(account) then
  1100. return Broadcast.sendErr(human, "account not exist")
  1101. end
  1102. local LuaMongo = _G.lua_mongo
  1103. local DB = require("common.DB")
  1104. local query = {}
  1105. query.account = tostring(account)
  1106. LuaMongo.remove(DB.db_char, query)
  1107. require("core.RoleDel").roleDel()
  1108. Broadcast.sendErr(human, "delete ok, account = " .. account)
  1109. end
  1110. -- 临时开指引
  1111. function d3.openguide()
  1112. require("Config").HAS_GUIDE = true
  1113. end
  1114. function d3.closeguide()
  1115. require("Config").HAS_GUIDE = false
  1116. end
  1117. -- 自动上阵
  1118. function d3.autoteam(human, combatType)
  1119. if tonumber(combatType) == nil then return end
  1120. local CombatPosLogic = require("combat.CombatPosLogic")
  1121. local str = ""
  1122. for i = 1, 6 do
  1123. if not human.db.heroBag[i] then
  1124. local heroID = require("hero.HeroDefine").getRandHeroByIsElite()
  1125. local lv = math.random(50, 100)
  1126. d3.heroadd(human, heroID .. " 1 " .. lv)
  1127. end
  1128. str = str .. i
  1129. if i % 6 == 0 then str = str .. ","
  1130. else str = str .. "|" end
  1131. end
  1132. CombatPosLogic.updatePos(human,combatType,str)
  1133. end
  1134. function d3.fcmstate(human, state)
  1135. human.fcmState = state
  1136. require("fcm.FcmLogic").checkFcm(human)
  1137. end
  1138. function d3.oltimeday(human, time)
  1139. time = tonumber(time)
  1140. if not time then return end
  1141. human.db.onlineTimeDay = time
  1142. require("fcm.FcmLogic").checkFcm(human)
  1143. end
  1144. function d3.dis(human, code)
  1145. ObjHuman.doDisconnect(human, code)
  1146. end
  1147. function d3.project(human)
  1148. local Lang = require("common.Lang")
  1149. Broadcast.sendErr(human, Lang.TEST_MULTY_PROJECT)
  1150. end
  1151. function d3.clextrabattle(human)
  1152. human.db.battleExtraReward = nil
  1153. end
  1154. function d3.clsharepf(human)
  1155. human.db.plShare = nil
  1156. end
  1157. function d3.clshareboard()
  1158. require("present.SharePlatformLogic").resetBoard()
  1159. end
  1160. function d3.sharepfall(human, cnt)
  1161. cnt = tonumber(cnt) or 15
  1162. for i = 1, cnt do
  1163. require("present.SharePlatformLogic").onShareOk(human.db.account, "account" .. i, true)
  1164. end
  1165. end
  1166. function d3.sharepf(human, accountB)
  1167. require("present.SharePlatformLogic").onShareOk(human.db.account, accountB)
  1168. end
  1169. function d3.sharepf2(human, accountA)
  1170. require("present.SharePlatformLogic").onShareOk(accountA, human.db.account)
  1171. end
  1172. function d3.sharegroup(human)
  1173. require("present.SharePlatformLogic").groupShareOK(human)
  1174. end
  1175. function d3.shareinvate(human)
  1176. require("present.SharePlatformLogic").shareInvate(human)
  1177. end
  1178. function d3.cltuisonglibao(human)
  1179. human.db.tuiSongLiBao = nil
  1180. end
  1181. function d3.clmoshou(human)
  1182. human.db.moshou = nil
  1183. end
  1184. function d3.moshoulv(human,lv)
  1185. local MoShouExcel = require("excel.moshou")
  1186. if not lv or lv <= 0 or lv > #MoShouExcel.moshouLv then return end
  1187. local MoshouLogic = require("moshou.MoshouLogic")
  1188. local isAllActive = MoshouLogic.isAllMoshouActive(human)
  1189. if not isAllActive then
  1190. local MoShouExcel = require("excel.moshou")
  1191. local config = MoShouExcel.moshouActive
  1192. for i=1,#config do
  1193. local activeTask = config[i].activeTask
  1194. for j=1,#activeTask do
  1195. human.db.moshou = human.db.moshou or {}
  1196. human.db.moshou[i] = human.db.moshou[i] or {}
  1197. human.db.moshou[i].taskGet = human.db.moshou[i].taskGet or {}
  1198. human.db.moshou[i].taskGet[j] = j
  1199. end
  1200. end
  1201. end
  1202. human.db.moshou.lv = lv
  1203. human.db.moshou.lvExp = MoShouExcel.moshouLv[lv].needJinDu
  1204. human.db.moshou.skillLV = human.db.moshou.skillLV or 1
  1205. MoshouLogic.calMoshouHero(human)
  1206. end
  1207. function d3.activemoshou(human,moshouID)
  1208. if not moshouID or moshouID <= 0 then return end
  1209. local MoShouExcel = require("excel.moshou")
  1210. local config = MoShouExcel.moshouActive
  1211. for i=1,moshouID do
  1212. local activeTask = config[i].activeTask
  1213. for j=1,#activeTask do
  1214. human.db.moshou = human.db.moshou or {}
  1215. human.db.moshou[i] = human.db.moshou[i] or {}
  1216. human.db.moshou[i].taskGet = human.db.moshou[i].taskGet or {}
  1217. human.db.moshou[i].taskGet[j] = j
  1218. end
  1219. end
  1220. if moshouID == #config then
  1221. d3.moshoulv(human,1)
  1222. end
  1223. local MoshouLogic = require("moshou.MoshouLogic")
  1224. MoshouLogic.calMoshouHero(human)
  1225. end
  1226. function d3.moshouupneed(human)
  1227. local MoShouExcel = require("excel.moshou")
  1228. local lvUpNeed1 = MoShouExcel.moshouLv[2].lvUpNeed[1][1]
  1229. local lvUpNeed2 = MoShouExcel.moshouLv[2].lvUpNeed[2][1]
  1230. d3.it(human,lvUpNeed1)
  1231. d3.it(human,lvUpNeed2)
  1232. local jingLianUp1 = MoShouExcel.moshouJingLian[2].lvUpNeed[1][1]
  1233. local jingLianUp2 = MoShouExcel.moshouJingLian[2].lvUpNeed[2][1]
  1234. d3.it(human,jingLianUp1)
  1235. d3.it(human,jingLianUp2)
  1236. local zhuhunUp = MoShouExcel.moshouZhuHun[1].costID
  1237. d3.it(human,zhuhunUp)
  1238. local skillup1 = MoShouExcel.moshouSkillLv[2].upCost[1][1]
  1239. local skillup2 = MoShouExcel.moshouSkillLv[2].upCost[2][1]
  1240. d3.it(human,skillup1)
  1241. d3.it(human,skillup2)
  1242. end
  1243. function d3.moshoujinglian(human,val)
  1244. if not human.db.moshou then return end
  1245. human.db.moshou.jingLian = val
  1246. end
  1247. function d3.clolinereward(human)
  1248. require("onlineReward.OnlineRewardLogic").initDB(human)
  1249. end
  1250. function d3.clonlinerewardget(human)
  1251. human.db.onlineReward.getId = 0
  1252. end
  1253. function d3.bartaskfinish(human)
  1254. local BarTaskLogic = require("bar.BarTaskLogic")
  1255. BarTaskLogic.initDB(human)
  1256. for taskID, taskData in pairs(human.db.bar) do
  1257. if type(taskID) == "number" then
  1258. human.db.bar[taskID].ts = 0
  1259. end
  1260. end
  1261. end
  1262. function d3.test(human)
  1263. local str = Util.format("aa{1}{2}{3}{4}{5}{6}{7}{8}{9}{10}{11}{12}{13}{14}{15}{16}",1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16)
  1264. Broadcast.sendErr(human, str)
  1265. print(str)
  1266. end
  1267. function d3.clbattle()
  1268. local DB = require("common.DB")
  1269. local LuaMongo = _G.lua_mongo
  1270. LuaMongo.remove(DB.db_battle_shark)
  1271. end
  1272. -- 设置天梯争霸状态
  1273. function d3.jjcladderstart()
  1274. local JjcLadderLogic = require("jjcLadder.JjcLadderLogic")
  1275. local JjcLadderExcel = require("excel.jjcLadder")
  1276. local JjcLadderDefine = JjcLadderExcel.define[1]
  1277. JjcLadderLogic.onActReady()
  1278. local week = Util.getWeekDay(os.time()) - 1
  1279. if week == 0 then
  1280. week = 7
  1281. end
  1282. JjcLadderLogic.TEMP_TIMER_STAMPTIME = nil
  1283. JjcLadderDefine.startTime.week = week
  1284. JjcLadderDefine.endTime.week = week + 1
  1285. JjcLadderLogic.onTimer()
  1286. local msg = InnerMsg.lw.LW_GM
  1287. msg.gm = "jjcladderstartmiddle"
  1288. InnerMsg.sendMsg(0, msg)
  1289. end
  1290. function d3.jjcladderstartmiddle()
  1291. local JjcLadderLogic = require("jjcLadder.JjcLadderLogic")
  1292. local JjcLadderExcel = require("excel.jjcLadder")
  1293. local JjcLadderDefine = JjcLadderExcel.define[1]
  1294. JjcLadderLogic.onActReady()
  1295. local week = Util.getWeekDay(os.time()) - 1
  1296. if week == 0 then
  1297. week = 7
  1298. end
  1299. JjcLadderLogic.TEMP_TIMER_STAMPTIME = nil
  1300. JjcLadderDefine.startTime.week = week
  1301. JjcLadderDefine.endTime.week = week + 1
  1302. JjcLadderLogic.onTimer()
  1303. end
  1304. -- 天梯争霸报错
  1305. function d3.jjcladdersign(human)
  1306. local JjcLadderLogic = require("jjcLadder.JjcLadderLogic")
  1307. if JjcLadderLogic.getState() == JjcLadderLogic.STATE_ACT_START then
  1308. local commonDB = JjcLadderLogic.getCommonDB()
  1309. commonDB.uuid2sign = commonDB.uuid2sign or {}
  1310. commonDB.uuid2sign[human.db._id] = os.time()
  1311. JjcLadderLogic.saveCommonDB(commonDB)
  1312. JjcLadderLogic.onUpdatePos(human)
  1313. end
  1314. end
  1315. -- 天梯争霸结束回调
  1316. function d3.jjcladderend()
  1317. local JjcLadderLogic = require("jjcLadder.JjcLadderLogic")
  1318. JjcLadderLogic.onActEnd()
  1319. local msg = InnerMsg.lw.LW_GM
  1320. msg.gm = "jjcladderendmiddle"
  1321. InnerMsg.sendMsg(0, msg)
  1322. end
  1323. function d3.jjcladderendmiddle()
  1324. local JjcLadderLogic = require("jjcLadder.JjcLadderLogic")
  1325. JjcLadderLogic.onActEnd()
  1326. end
  1327. -- 重置天梯争霸活动信息
  1328. function d3.cljjcladder()
  1329. local JjcLadderLogic = require("jjcLadder.JjcLadderLogic")
  1330. JjcLadderLogic.saveCommonDB()
  1331. JjcLadderLogic.onActEnd()
  1332. local msg = InnerMsg.lw.LW_GM
  1333. msg.gm = "cljjcladdermiddle"
  1334. InnerMsg.sendMsg(0, msg)
  1335. end
  1336. function d3.cljjcladdermiddle()
  1337. local JjcLadderLogic = require("jjcLadder.JjcLadderLogic")
  1338. JjcLadderLogic.saveCommonDB()
  1339. JjcLadderLogic.onActEnd()
  1340. end
  1341. function d3.clcombat(human,val)
  1342. human.db.combatHero[val] = nil
  1343. end
  1344. function d3.clshop(human,val)
  1345. human.db.shop[val] = nil
  1346. end
  1347. -- 重置日常礼包
  1348. function d3.clrichanglibao(human)
  1349. human.db.richangLibao = nil
  1350. end
  1351. -- 重置荣耀峡谷(龙族战场)
  1352. function d3.clvalley()
  1353. local ValleyLogic = require("valley.ValleyLogic")
  1354. ValleyLogic.cleanDB()
  1355. local msg = InnerMsg.lw.LW_GM
  1356. msg.gm = "clvalleymiddle"
  1357. InnerMsg.sendMsg(0, msg)
  1358. end
  1359. function d3.clvalleymiddle()
  1360. local ValleyLogic = require("valley.ValleyLogic")
  1361. ValleyLogic.cleanDB()
  1362. end
  1363. -- 重置荣耀峡谷(龙族战场)成就
  1364. function d3.clvalleytask(human)
  1365. human.db.valleyTask = nil
  1366. end
  1367. -- 增加荣耀峡谷(龙族战场)个人成就值
  1368. function d3.valleytask1(human, value)
  1369. require("valley.ValleyTask").updateValue(human.db._id, value, 0)
  1370. end
  1371. -- 增加荣耀峡谷(龙族战场)团队成就值
  1372. function d3.valleytask2(human, value)
  1373. require("valley.ValleyTask").updateValue(human.db._id, 0, value)
  1374. end
  1375. function d3.touchLv(human,val)
  1376. local liveness = val + 0
  1377. require("union.UnionLivenessLogic").touchLv(human, liveness)
  1378. end
  1379. function d3.clyj()
  1380. local DB = require("common.DB")
  1381. local LuaMongo = _G.lua_mongo
  1382. LuaMongo.remove(DB.db_yjTreasure)
  1383. local YjTreasureDBLogic = require("yjTreasure.YjTreasureDB")
  1384. YjTreasureDBLogic.YJ_TREASURE_DB = {}
  1385. end
  1386. function d3.yjlayer(human,val)
  1387. local YjTreasureLogic = require("yjTreasure.YjTreasureLogic")
  1388. local YjTreasureDBLogic = require("yjTreasure.YjTreasureDB")
  1389. local YjTreasureExcel = require("excel.yjTreasure")
  1390. local Lang = require("common.Lang")
  1391. local layerData = YjTreasureDBLogic.getLayerDataByUuid(human.db._id)
  1392. local layCnf = YjTreasureExcel.layer
  1393. local nowLayer = layerData.layer
  1394. if val > #layCnf then return Broadcast.sendErr(human,Lang.YJTREASURE_LAYER_ERR) end
  1395. local roleData = YjTreasureDBLogic.getRoleDataByUuid(human.db._id)
  1396. local layerMax = roleData.layerMax or 0
  1397. if layerMax < val then
  1398. roleData.layerMax = val
  1399. YjTreasureDBLogic.updateRoleDataByUuid(roleData,human.db._id)
  1400. end
  1401. YjTreasureDBLogic.creatLayerDataByUuid(human.db._id,val)
  1402. YjTreasureLogic.CG_YJTREASURE_QUERY(human)
  1403. end
  1404. function d3.towerKing(human)
  1405. local HuanJingTowerLogic = require("huanjingTower.HuanjingTowerLogic")
  1406. HuanJingTowerLogic.unlockTowerKing(human)
  1407. end
  1408. -- 设置炼狱最大通关层
  1409. function d3.lianyu(human, value)
  1410. value = tonumber(value)
  1411. if not value then return end
  1412. if value < 0 then return end
  1413. local LianyuExcel = require("excel.lianyu")
  1414. if value > 0 and not LianyuExcel.gamelevel[value] then
  1415. return
  1416. end
  1417. LianyuLogic = require("lianyu.LianyuLogic")
  1418. LianyuLogic.setMaxLv(human, value)
  1419. end
  1420. function d3.cllianyu(human)
  1421. human.db.lianyu = nil
  1422. end
  1423. function d3.cllianyuhelp()
  1424. local CommonDB = require("common.CommonDB")
  1425. CommonDB.updateValue(CommonDB.KEY_LIANYU, nil)
  1426. end
  1427. -- 清除特权商店相关信息
  1428. function cltequanshop(human)
  1429. human.db.tequanShop = nil
  1430. human.db.tequanMopup = nil
  1431. if human.db.bar then
  1432. human.db.bar.vip = nil
  1433. human.db.bar.surVip = nil
  1434. end
  1435. end
  1436. function d3.addbts(human)
  1437. local now = os.time()
  1438. require("battle.BattleLogic").initBattleOut(human, now)
  1439. human.db.battleOut.expTs1 = now - 7200
  1440. human.db.battleOut.itemTs1 = now - 7200
  1441. human.db.battleOut.expTs2 = now - 7200
  1442. human.db.battleOut.itemTs2 = now - 7200
  1443. end
  1444. function d3.addbsd(human)
  1445. human.db.mopupDoCnt = 0
  1446. human.db.mopupFreeCnt = 0
  1447. end
  1448. function d3.addYjYj(human,type)
  1449. local YjTreasureLogic = require("yjTreasure.YjTreasureLogic")
  1450. YjTreasureLogic.yjYaoJiAdd(human,10,type)
  1451. end
  1452. function d3.ajfc(human,val)
  1453. for i = 1,val do
  1454. human.db.jjcDailyFight = (human.db.jjcDailyFight or 0) + 1
  1455. require("jjc.JjcDB").updateTotalFight(human.db._id)
  1456. end
  1457. end
  1458. function d3.godWartest(human)
  1459. local JjcGodWarLogic = require("jjcGodWar.JjcGodWarLogic")
  1460. JjcGodWarLogic.jjcGodWarFinishGm(human)
  1461. end
  1462. function d3.closeMiddle(human)
  1463. MiddleConnect.stopConnectMiddle()
  1464. end
  1465. function d3.resetMiddle(human)
  1466. MiddleConnect.autoResetMiddle()
  1467. end
  1468. function d3.loginSign(human, value)
  1469. value = tonumber(value)
  1470. local LoginSignLogic = require("loginSign.LoginSignLogic")
  1471. LoginSignLogic.updateGM(human, value)
  1472. end
  1473. function d3.yuanjun(human, value)
  1474. human.db.combatBackup = 1
  1475. end
  1476. function d3.buyItem(human, value)
  1477. require("shop.ShopLogic").buy(human, 9, 405007, 1, 1)
  1478. end
  1479. function d3.test1(human)
  1480. require("absAct.MangHeLogic").draw(human, 1)
  1481. end
  1482. function d3.zbsj(human,val)
  1483. if human.db.zhanbu == nil then
  1484. return
  1485. end
  1486. human.db.zhanbu.money = val
  1487. end
  1488. function d3.tjm(human)
  1489. require("present.RelationGiftLogic").relationBind(human, "017772140001")
  1490. end
  1491. function d3.qcjz(human)
  1492. human.db.unionDonate = nil
  1493. end
  1494. function d3.unionCopyLv(human, val)
  1495. require("union.UnionEctypeLogic").toUnionBossLvGm(human, tonumber(val))
  1496. end
  1497. function d3.fff(human)
  1498. human.db.leaveUnionLimit = nil
  1499. end
  1500. function d3.hgw(args)
  1501. require("absAct.HeroGrowUp").actLoop()
  1502. end
  1503. function d3.hgwlv(human,val)
  1504. require("absAct.HeroGrowUp").addJifen(human,tonumber(val))
  1505. end
  1506. function d3.paoma(human, val)
  1507. require("chat.ChatPaoMaLogic").notice(val)
  1508. end
  1509. -- 设置合服时间
  1510. function d3.merge(human,value)
  1511. value = value and tonumber(value)
  1512. if value == nil then
  1513. local mergeSvrTime = CommonDB.getMergeServerTime()
  1514. if mergeSvrTime == 0 then
  1515. Broadcast.sendErr(human, "未设置合服时间")
  1516. else
  1517. local tb = os.date("%Y%m%d", mergeSvrTime)
  1518. Broadcast.sendErr(human, "当前合服时间为" .. tb)
  1519. end
  1520. else
  1521. local now = os.time()
  1522. local temp = Util.getDayStartTime(now)
  1523. temp = temp - (value - 1) * 24 * 3600
  1524. CommonDB.setMergeTime(temp)
  1525. local tb = os.date("%Y%m%d", temp)
  1526. Broadcast.sendErr(human, "设置当前合服时间为" .. tb)
  1527. --同步中心服开服时间
  1528. --[[local msgRet = InnerMsg.lw.LW_OS
  1529. msgRet.uuid = human.db._id
  1530. msgRet.value = temp
  1531. InnerMsg.sendMsg(0, msgRet)]]
  1532. end
  1533. end
  1534. function d3.resetweek(human)
  1535. WeekendLoopActManger.GMResetWeekAct(human)
  1536. end
  1537. function d3.savedb(human)
  1538. ObjHuman.GM_SaveDB(human)
  1539. end