Gm.lua 50 KB

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