Gm.lua 50 KB

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