Gm.lua 50 KB

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