Gm.lua 50 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623162416251626162716281629163016311632163316341635163616371638163916401641164216431644164516461647164816491650165116521653165416551656165716581659166016611662166316641665166616671668166916701671167216731674167516761677167816791680168116821683168416851686168716881689169016911692169316941695169616971698169917001701170217031704170517061707170817091710171117121713171417151716171717181719172017211722172317241725172617271728172917301731173217331734173517361737173817391740174117421743174417451746174717481749175017511752175317541755175617571758175917601761176217631764176517661767176817691770177117721773177417751776177717781779178017811782178317841785178617871788178917901791179217931794179517961797179817991800180118021803180418051806180718081809181018111812181318141815181618171818181918201821182218231824182518261827182818291830183118321833183418351836183718381839184018411842184318441845184618471848184918501851185218531854
  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. local buyTbl = {buyID = val, price = checkMoney}
  613. BuyLogic.buy(human, buyTbl)
  614. --PlatformHandler.CG_TENCENT_BUY(human,msg)
  615. --AdminLogic.adminFunction.tencentPay(msg)
  616. end
  617. function d3.buyCharge(human, val)
  618. local BuyExcel = require("excel.buy")
  619. local buyConf = BuyExcel.buy[val]
  620. if not buyConf then
  621. return
  622. end
  623. local tOJsonInput = {}
  624. tOJsonInput.buyID = buyConf.id
  625. tOJsonInput.price = buyConf.CN
  626. tOJsonInput.money = buyConf.CN
  627. BuyLogic.charge(human, tOJsonInput)
  628. end
  629. function d3.gol(human)
  630. local AdminLogic = require("AdminLogic")
  631. AdminLogic.adminFunction.getonlinelist()
  632. end
  633. function d3.htm(human,val)
  634. local AdminLogic = require("AdminLogic")
  635. local oJsonInput = {}
  636. oJsonInput.recvType = val -- 邮件类型
  637. oJsonInput.title = "111" -- 邮件标题
  638. oJsonInput.content = "222" -- 邮件内容
  639. oJsonInput.items = nil -- 道具列表 可以为空
  640. oJsonInput.accounts = nil -- 指定玩家列表
  641. oJsonInput.startLv = 0
  642. oJsonInput.endLv = 200
  643. AdminLogic.adminFunction.mail(oJsonInput)
  644. end
  645. function d3.cluwar(human)
  646. require("union.UnionWarLogic").cleanUnionWar()
  647. local msg = InnerMsg.lw.LW_GM
  648. msg.gm = "cluwarmiddle"
  649. InnerMsg.sendMsg(0, msg)
  650. end
  651. function d3.cluniontime(human)
  652. human.db.unionJoinTime = nil
  653. end
  654. function d3.cluwarmiddle()
  655. local LuaMongo = _G.lua_mongo
  656. local DB = require("common.DB")
  657. LuaMongo.remove(DB.db_union_war)
  658. end
  659. function d3.uwarstart()
  660. -- 需要周1、3、5使用
  661. local UnionWarLogic = require("union.UnionWarLogic")
  662. UnionWarLogic.cleanUnionWar()
  663. local msg = InnerMsg.lw.LW_GM
  664. msg.gm = "cluwarmiddle"
  665. InnerMsg.sendMsg(0, msg)
  666. UnionWarLogic.onHour(0)
  667. UnionWarLogic.onHour(1)
  668. local msg = InnerMsg.lw.LW_GM
  669. msg.gm = "uwarstartmiddle"
  670. InnerMsg.sendMsg(0, msg)
  671. end
  672. function d3.warMaxtest(human, value)
  673. require("union.UnionWarLogic").auto(value)
  674. end
  675. function d3.uwar(human,state)
  676. local msg = InnerMsg.lw.LW_GM
  677. msg.gm = "muwar "..state
  678. InnerMsg.sendMsg(0, msg)
  679. if state == 1 then
  680. local UnionWarDBLogic = require("union.UnionWarDBLogic")
  681. UnionWarDBLogic.onHour(0, true)
  682. end
  683. end
  684. function d3.uwarshop(human, lv)
  685. require("union.UnionWarLogic").upWarShopLv(human, tonumber(lv))
  686. end
  687. function d3.uwarBuff(human)
  688. local msg = InnerMsg.lw.LW_GM
  689. msg.gm = "muwarBuff ".. human.db.unionUuid
  690. InnerMsg.sendMsg(0, msg)
  691. end
  692. function d3.muwar(human,state)
  693. local UnionWarDBLogic = require("union.UnionWarDBLogic")
  694. if state == 1 then
  695. UnionWarDBLogic.onHour(0, true)
  696. elseif state == 2 then
  697. UnionWarDBLogic.onHour(2, true)
  698. elseif state == 3 then
  699. UnionWarDBLogic.onHour(20, true)
  700. end
  701. end
  702. function d3.muwarBuff(human, unionUuid)
  703. local UnionWarDBLogic = require("union.UnionWarDBLogic")
  704. UnionWarDBLogic.addBuffLvByGm(unionUuid)
  705. end
  706. function d3.uwartask(human, type)
  707. local UnionWarLogic = require("union.UnionWarLogic")
  708. UnionWarLogic.chegnjiuFinishGm(human, tonumber(type))
  709. end
  710. function d3.uwarstartmiddle()
  711. -- 匹配
  712. require("union.UnionWarMiddleLogic").matchUnionStart()
  713. end
  714. function d3.cljjc(human, val)
  715. val = tonumber(val)
  716. local msgRet = InnerMsg.lw.LW_CL_JJC
  717. msgRet.type = val
  718. InnerMsg.sendMsg(0, msgRet)
  719. end
  720. function d3.cluwar(human)
  721. require("union.UnionWarLogic").cleanUnionWar()
  722. local msg = InnerMsg.lw.LW_GM
  723. msg.gm = "cluwarmiddle"
  724. InnerMsg.sendMsg(0, msg)
  725. end
  726. function d3.cluwarmiddle()
  727. local LuaMongo = _G.lua_mongo
  728. local DB = require("common.DB")
  729. LuaMongo.remove(DB.db_union_war)
  730. end
  731. function d3.uwarstart()
  732. -- 需要周1、3、5使用
  733. require("union.UnionWarLogic").onHour(0)
  734. require("union.UnionWarLogic").onHour(1)
  735. local msg = InnerMsg.lw.LW_GM
  736. msg.gm = "uwarstartmiddle"
  737. InnerMsg.sendMsg(0, msg)
  738. end
  739. function d3.uwarstartmiddle()
  740. -- 匹配
  741. require("union.UnionWarMiddleLogic").matchUnionStart()
  742. end
  743. function d3.cxh(human)
  744. d3.tgod(human)
  745. d3.lv(human,200)
  746. end
  747. function d3.drop(human,val)
  748. local BattleLogic = require("battle.BattleLogic")
  749. local param = Util.split(val, " ")
  750. local cnt = tonumber(param[1])
  751. local battleID = tonumber(param[2])
  752. BattleLogic.clacItemCntGM(human,cnt,battleID)
  753. end
  754. function d3.uif(human,val)
  755. local jsonInput = {}
  756. jsonInput.unionName = val
  757. local AdminLogic = require("AdminLogic")
  758. AdminLogic.adminFunction.unionInfo(jsonInput)
  759. end
  760. function d3.ul(human,val)
  761. local jsonInput = {}
  762. jsonInput.start = tonumber(val)
  763. local AdminLogic = require("AdminLogic")
  764. AdminLogic.adminFunction.unionList(jsonInput)
  765. end
  766. function d3.monthgaochou(human, val)
  767. local MonthSummon = require("monthAct.MonthSummon")
  768. MonthSummon.onSummon(human, tonumber(val))
  769. end
  770. function d3.jhtq(human,val)
  771. local TequanLogic = require("qqTequan.TequanLogic")
  772. local param = Util.split(val, " ")
  773. local val1 = tonumber(param[1])
  774. local val2 = tonumber(param[2])
  775. local val3 = tonumber(param[3])
  776. local val4 = tonumber(param[4])
  777. TequanLogic.activateTequan(human,val1,val2,val3,val4)
  778. end
  779. function d3.unionTecLv(human,val)
  780. local UnionTecLogic = require("union.UnionTecLogic")
  781. UnionTecLogic.lvAllUpByGm(human)
  782. end
  783. function d3.auto(human,val)
  784. local param = Util.split(val, " ")
  785. local str = param[1]
  786. local val = param[2]
  787. if not str or not val then
  788. return
  789. end
  790. for i = 1, val do
  791. require("union.UnionWarLogic").auto(str .. string.format("%02d", i))
  792. end
  793. end
  794. function d3.lvAuto(human, val)
  795. val = val + 0
  796. local lvOld = human.db.lv
  797. local lvNew = val + 0
  798. human.db.lv = lvNew
  799. end
  800. function d3.cap(human)
  801. human.db.buyCapCnt = require("hero.HeroDefine").BUY_CAP_CNT
  802. require("hero.HeroLogic").sendHeroBagCap(human)
  803. end
  804. function d3.abscharge(human)
  805. AbsBillboardLogic.charge(human,1000)
  806. end
  807. function d3.jhpt(human)
  808. if human.pf_info.pf == "qqgame" then
  809. human.db.txHall = {}
  810. elseif human.pf_info.pf == "qzone" or human.pf_info.pf == "website" then
  811. human.db.qqZone = {}
  812. end
  813. end
  814. function d3.addfuwen(human)
  815. d3.itemadd(human,"80001 10")
  816. d3.itemadd(human,"80002 10")
  817. d3.itemadd(human,"80003 10")
  818. d3.itemadd(human,"80004 10")
  819. d3.itemadd(human,"80005 10")
  820. end
  821. function d3.addSmelt(human,val)
  822. local num = tonumber(val)
  823. human.db.smeltVal = human.db.smeltVal or 0
  824. human.db.smeltVal = human.db.smeltVal + num
  825. end
  826. function d3.zdfw(human,val)
  827. local param = Util.split(val, " ")
  828. local fuwenID = tonumber(param[1])
  829. local attr1 = tonumber(param[2])
  830. local val1 = tonumber(param[3])
  831. local attr2 = tonumber(param[4])
  832. local val2 = tonumber(param[5])
  833. local skill1 = tonumber(param[6])
  834. local skill2 = tonumber(param[7])
  835. local FuwenGrid = require("fuwen.FuwenGrid")
  836. local FuwenExcel = require("excel.fuwen").skill
  837. if (skill1 ~= nil and FuwenExcel[skill1] == nil) or (skill2 ~= nil and FuwenExcel[skill2] == nil) then
  838. print("fuck! add fuwen skill is notreal")
  839. return
  840. end
  841. FuwenGrid.setFuwenSkillAttrByGM(human,fuwenID,attr1,val1,attr2,val2,skill1,skill2)
  842. end
  843. function d3.t2(human)
  844. 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"}}]]
  845. local ret = require("AdminLogic").handleAdminRequest(_, input)
  846. print(ret)
  847. end
  848. function d3.t1(human)
  849. local input = {}
  850. input.token = "fC283BD0141D50418B68200972FBEE6A13102"
  851. input.payitem = "39*60*1"
  852. input.billno = os.time()
  853. local ret = require("platform.QQApi").onDeliverReturnForBuy(input)
  854. print(ret.ret,ret.msg)
  855. end
  856. function d3.skin(human,val)
  857. local tb = Util.split(val, " ")
  858. local id = tonumber(tb[1])
  859. local cnt = tonumber(tb[2])
  860. print(id,tb[1],tb[2])
  861. if not id then
  862. human.db.skinBag = {[0] = 999}
  863. return
  864. end
  865. local SkinLogic = require("skin.SkinLogic")
  866. SkinLogic.addSkin(human,id,cnt)
  867. end
  868. function d3.ff(human,val)
  869. local FriendLogic = require("friend.FriendLogic")
  870. FriendLogic.addFriend(human, val)
  871. end
  872. function d3.chenghao(human,val)
  873. val = tonumber(val)
  874. if not val then
  875. return
  876. end
  877. local RoleHeadLogic = require("role.RoleHeadLogic")
  878. RoleHeadLogic.active(human, RoleHeadLogic.HEAD_TYPE_4, val)
  879. end
  880. function d3.unionBillboard(human,val)
  881. val = tonumber(val)
  882. if not val then
  883. return
  884. end
  885. local BRoleLogic = require("billboard.BRoleLogic")
  886. BRoleLogic.queryUnionBillboard(human,val)
  887. end
  888. function d3.herotest(human, val)
  889. local tb = Util.split(val, " ")
  890. local combatType = 1
  891. local HeroExcel = require("excel.hero")
  892. local HeroLogic = require("hero.HeroLogic")
  893. local flags = {}
  894. human.db.combatHero = human.db.combatHero or {}
  895. human.db.combatHero[combatType] = {}
  896. for pos = 1, 6 do
  897. local id = tonumber(tb[pos])
  898. local index = nil
  899. if id and HeroExcel.hero[id] then
  900. for i = 1, human.db.heroBag[0] do
  901. local heroGrid = human.db.heroBag[i]
  902. if heroGrid and (heroGrid.id == id) and
  903. (not flags[i]) then
  904. flags[i] = true
  905. index = i
  906. break
  907. end
  908. end
  909. if not index then
  910. index = HeroLogic.getEmptyIndex(human)
  911. d3.heroadd(human, id .. " 1")
  912. end
  913. end
  914. human.db.combatHero[combatType][pos] = index
  915. end
  916. local CombatHandler = require("combat.Handler")
  917. CombatHandler.CG_COMBAT_BEGIN(human,{type = combatType, param = ""})
  918. end
  919. function d3.combat(human, monsterOutID)
  920. local CombatLogic = require("combat.CombatLogic")
  921. local param = {}
  922. param.defender, _, param.defRBase, param.defFormation = CombatLogic.getMonsterObjList(monsterOutID)
  923. require("combat.CombatLogic").combatBegin(human, 1001, param, 1)
  924. end
  925. function d3.combat2(human,id)
  926. local id = tonumber(id)
  927. local combatConf = require("excel.combat").gm[id]
  928. if not combatConf then
  929. assert()
  930. end
  931. local HeroGrid = require("hero.HeroGrid")
  932. local HeroLogic = require("hero.HeroLogic")
  933. local CombatLogic = require("combat.CombatLogic")
  934. local fakeman1 = {}
  935. local account1 = "combatFakeman1"
  936. local fakeman2 = {}
  937. local account2 = "combatFakeman2"
  938. local RoleDBLogic = require("role.RoleDBLogic")
  939. local fakemanDB1 = RoleDBLogic.getDbByAccount(account1)
  940. if not fakemanDB1 then
  941. fakemanDB1 = RoleDBLogic.createDefaultRole(account1)
  942. end
  943. fakeman1.db = fakemanDB1
  944. local fakemanDB2 = RoleDBLogic.getDbByAccount(account2)
  945. if not fakemanDB2 then
  946. fakemanDB2 = RoleDBLogic.createDefaultRole(account2)
  947. end
  948. fakeman2.db = fakemanDB2
  949. local attacker = {}
  950. local defender = {}
  951. for i = 1, fakeman1.db.heroBag[0] do
  952. HeroLogic.delHeroByIndex(fakeman1, i, "gm")
  953. end
  954. for i = 1, fakeman2.db.heroBag[0] do
  955. HeroLogic.delHeroByIndex(fakeman2, i, "gm")
  956. end
  957. for k,v in ipairs(combatConf.atk) do
  958. local heroGrid = HeroGrid.createHeroGrid(v[1], v[4])
  959. heroGrid.lv = math.max(heroGrid.lv, v[3] or 0)
  960. heroGrid.quality = HeroGrid.getMaxQuality(heroGrid.star)
  961. local heroIndex = HeroLogic.addHeroByGrid(fakeman1, heroGrid, "gm")
  962. attacker[v[2]] = CombatLogic.createHumanObj(fakeman1, heroGrid.uuid)
  963. end
  964. for k,v in ipairs(combatConf.def) do
  965. local heroGrid = HeroGrid.createHeroGrid(v[1], v[4])
  966. heroGrid.lv = math.max(heroGrid.lv, v[3] or 0)
  967. heroGrid.quality = HeroGrid.getMaxQuality(heroGrid.star)
  968. local heroIndex = HeroLogic.addHeroByGrid(fakeman2, heroGrid, "gm")
  969. defender[v[2]] = CombatLogic.createHumanObj(fakeman2, heroGrid.uuid)
  970. end
  971. local atkPet = nil
  972. local defPet = nil
  973. CombatLogic.combatGm(human,1001,combatConf.atkF, attacker,combatConf.defF,defender,atkPet,defPet,{{101,1},{102,2},{103,3},{104,4}})
  974. end
  975. function d3.combatEnd(human)
  976. local CombatLogic = require("combat.CombatLogic")
  977. for i = CombatDefine.COMBAT_TYPE1, CombatDefine.COMBAT_TYPE_MAX do
  978. CombatLogic.clientFinish(human, i)
  979. end
  980. end
  981. -- it道具添加(支持中文)
  982. function d3.it(human,value)
  983. local tb = Util.split(value," ")
  984. local id = tonumber(tb[1])
  985. local cnt = tonumber(tb[2])
  986. if id == nil then id = tb[1] end
  987. if type(id) == "string" then
  988. id = ItemDefine.getIdByName(id)
  989. end
  990. if type(id) ~= "number" then
  991. print("err id", tb[1], id, type(id))
  992. return
  993. end
  994. cnt = cnt or 1000
  995. BagLogic.addItem(human, id, cnt, "gm")
  996. end
  997. -- 清除酒馆
  998. function d3.clbartask(human)
  999. human.db.bar = nil
  1000. end
  1001. function d3.updaily(human)
  1002. ObjHuman.updateDaily(human, true)
  1003. end
  1004. function d3.clguide(human)
  1005. human.db.noguide = nil
  1006. human.db.guide = nil
  1007. human.guideLoginStep = nil
  1008. require("guide.GuideLogic").refreshGuide(human)
  1009. require("guide.GuideLogic").sendStep(human)
  1010. end
  1011. function d3.nextguide(human)
  1012. local GuideExcel = require("excel.guide")
  1013. local GuideLogic = require("guide.GuideLogic")
  1014. local id = GuideLogic.getGuideID(human)
  1015. local nextstep = GuideLogic.getGuideStep(human) + 1
  1016. local cf = id and GuideExcel.main_guide[id]
  1017. local sid = cf and cf.guideList[nextstep]
  1018. GuideLogic.stepFinish(human, sid)
  1019. end
  1020. function d3.guide(human, id)
  1021. human.db.noguide = nil
  1022. human.guideLoginStep = nil
  1023. local GuideLogic = require("guide.GuideLogic")
  1024. GuideLogic.setGuide(human, id, GuideLogic.STATE_DOING)
  1025. GuideLogic.sendStep(human)
  1026. end
  1027. -- 跳过指引
  1028. function d3.noguide(human)
  1029. human.db.noguide = true
  1030. human.guideLoginStep = nil
  1031. require("guide.GuideLogic").sendStep(human, true)
  1032. end
  1033. function d3.creatunion(human,value)
  1034. d3.lv(human,30)
  1035. d3.viplv(human,2)
  1036. d3.zuanshi(human, 1000)
  1037. local UnionLogic = require("union.UnionLogic")
  1038. UnionLogic.createUnion(human, value)
  1039. end
  1040. function d3.cldraw(human, value)
  1041. human.db.drawCard = {jifen=tonumber(value),list={[1]={},[2]={},[3]={},[4]={}}}
  1042. end
  1043. function d3.cldrill(human)
  1044. require("drill.DrillDB").reset()
  1045. end
  1046. function d3.zhengdian(_, hour)
  1047. hour = tonumber(hour) or 0
  1048. require("core.Timer").doZhengDian(hour)
  1049. end
  1050. function d3.tgod(human)
  1051. local HeroLogic = require("hero.HeroLogic")
  1052. local HeroGrid = require("hero.HeroGrid")
  1053. local HeroExcel = require("excel.hero")
  1054. for heroID, config in pairs(HeroExcel.tujian) do
  1055. local heroConfig = HeroExcel.hero[heroID]
  1056. if heroConfig then
  1057. local star = heroConfig.star
  1058. local maxQuality = HeroGrid.getMaxQuality(star)
  1059. local maxLv = HeroGrid.getMaxLv(star,maxQuality)
  1060. d3.heroadd(human, heroID .. " 1".." "..maxLv.." "..maxQuality)
  1061. end
  1062. end
  1063. end
  1064. function d3.tujian(human, camp)
  1065. local HeroExcel = require("excel.hero")
  1066. camp = tonumber(camp)
  1067. for heroID, config in pairs(HeroExcel.tujian) do
  1068. if config.camp == camp or not camp then
  1069. d3.heroadd(human, heroID .. " 1")
  1070. end
  1071. end
  1072. end
  1073. function d3.cljingcailibao(human)
  1074. human.db.dailyLeiChong = nil
  1075. human.db.leichongHaoli = nil
  1076. human.db.topupAcountDaily = nil
  1077. human.db.topupAccountMonth = nil
  1078. end
  1079. function d3.qijifen(human,value)
  1080. human.db.sevenDayGoal = human.db.sevenDayGoal or {}
  1081. human.db.sevenDayGoal[9] = human.db.sevenDayGoal[8] or {}
  1082. human.db.sevenDayGoal[9].jifen = value
  1083. end
  1084. function d3.clqirimubiao(human)
  1085. human.db.sevenDayGoal = nil
  1086. end
  1087. function d3.throne(human, str)
  1088. if str == nil then return end
  1089. local tb = Util.split(str, " ")
  1090. local id = tonumber(tb[1])
  1091. local lv = tonumber(tb[2])
  1092. if not id or not lv then return end
  1093. local TheStarsDBLogic = require("theStars.TheStarsDBLogic")
  1094. local list = TheStarsDBLogic.getThroneList()
  1095. local throne = list[id]
  1096. if not throne then return end
  1097. throne.lv = lv
  1098. TheStarsDBLogic.updateThroneDB(throne)
  1099. end
  1100. function d3.cltsts(human)
  1101. human.db.throneTime = human.db.throneTime - 14400
  1102. end
  1103. -- 删号
  1104. function d3.delaccount(human, account)
  1105. if not account then return end
  1106. local target = ObjHuman.onlineAccount[account]
  1107. if target then
  1108. return Broadcast.sendErr(human, "can't delete online")
  1109. end
  1110. local RoleDBLogic = require("role.RoleDBLogic")
  1111. if not RoleDBLogic.getDbByAccount(account) then
  1112. return Broadcast.sendErr(human, "account not exist")
  1113. end
  1114. local LuaMongo = _G.lua_mongo
  1115. local DB = require("common.DB")
  1116. local query = {}
  1117. query.account = tostring(account)
  1118. LuaMongo.remove(DB.db_char, query)
  1119. require("core.RoleDel").roleDel()
  1120. Broadcast.sendErr(human, "delete ok, account = " .. account)
  1121. end
  1122. -- 临时开指引
  1123. function d3.openguide()
  1124. require("Config").HAS_GUIDE = true
  1125. end
  1126. function d3.closeguide()
  1127. require("Config").HAS_GUIDE = false
  1128. end
  1129. -- 自动上阵
  1130. function d3.autoteam(human, combatType)
  1131. if tonumber(combatType) == nil then return end
  1132. local CombatPosLogic = require("combat.CombatPosLogic")
  1133. local str = ""
  1134. for i = 1, 6 do
  1135. if not human.db.heroBag[i] then
  1136. local heroID = require("hero.HeroDefine").getRandHeroByIsElite()
  1137. local lv = math.random(50, 100)
  1138. d3.heroadd(human, heroID .. " 1 " .. lv)
  1139. end
  1140. str = str .. i
  1141. if i % 6 == 0 then str = str .. ","
  1142. else str = str .. "|" end
  1143. end
  1144. CombatPosLogic.updatePos(human,combatType,str)
  1145. end
  1146. function d3.fcmstate(human, state)
  1147. human.fcmState = state
  1148. require("fcm.FcmLogic").checkFcm(human)
  1149. end
  1150. function d3.oltimeday(human, time)
  1151. time = tonumber(time)
  1152. if not time then return end
  1153. human.db.onlineTimeDay = time
  1154. require("fcm.FcmLogic").checkFcm(human)
  1155. end
  1156. function d3.dis(human, code)
  1157. ObjHuman.doDisconnect(human, code)
  1158. end
  1159. function d3.project(human)
  1160. local Lang = require("common.Lang")
  1161. Broadcast.sendErr(human, Lang.TEST_MULTY_PROJECT)
  1162. end
  1163. function d3.clextrabattle(human)
  1164. human.db.battleExtraReward = nil
  1165. end
  1166. function d3.clsharepf(human)
  1167. human.db.plShare = nil
  1168. end
  1169. function d3.clshareboard()
  1170. require("present.SharePlatformLogic").resetBoard()
  1171. end
  1172. function d3.sharepfall(human, cnt)
  1173. cnt = tonumber(cnt) or 15
  1174. for i = 1, cnt do
  1175. require("present.SharePlatformLogic").onShareOk(human.db.account, "account" .. i, true)
  1176. end
  1177. end
  1178. function d3.sharepf(human, accountB)
  1179. require("present.SharePlatformLogic").onShareOk(human.db.account, accountB)
  1180. end
  1181. function d3.sharepf2(human, accountA)
  1182. require("present.SharePlatformLogic").onShareOk(accountA, human.db.account)
  1183. end
  1184. function d3.sharegroup(human)
  1185. require("present.SharePlatformLogic").groupShareOK(human)
  1186. end
  1187. function d3.shareinvate(human)
  1188. require("present.SharePlatformLogic").shareInvate(human)
  1189. end
  1190. function d3.cltuisonglibao(human)
  1191. human.db.tuiSongLiBao = nil
  1192. end
  1193. function d3.clmoshou(human)
  1194. human.db.moshou = nil
  1195. end
  1196. function d3.moshoulv(human,lv)
  1197. local MoShouExcel = require("excel.moshou")
  1198. if not lv or lv <= 0 or lv > #MoShouExcel.moshouLv then return end
  1199. local MoshouLogic = require("moshou.MoshouLogic")
  1200. local isAllActive = MoshouLogic.isAllMoshouActive(human)
  1201. if not isAllActive then
  1202. local MoShouExcel = require("excel.moshou")
  1203. local config = MoShouExcel.moshouActive
  1204. for i=1,#config do
  1205. local activeTask = config[i].activeTask
  1206. for j=1,#activeTask do
  1207. human.db.moshou = human.db.moshou or {}
  1208. human.db.moshou[i] = human.db.moshou[i] or {}
  1209. human.db.moshou[i].taskGet = human.db.moshou[i].taskGet or {}
  1210. human.db.moshou[i].taskGet[j] = j
  1211. end
  1212. end
  1213. end
  1214. human.db.moshou.lv = lv
  1215. human.db.moshou.lvExp = MoShouExcel.moshouLv[lv].needJinDu
  1216. human.db.moshou.skillLV = human.db.moshou.skillLV or 1
  1217. MoshouLogic.calMoshouHero(human)
  1218. end
  1219. function d3.activemoshou(human,moshouID)
  1220. if not moshouID or moshouID <= 0 then return end
  1221. local MoShouExcel = require("excel.moshou")
  1222. local config = MoShouExcel.moshouActive
  1223. for i=1,moshouID do
  1224. local activeTask = config[i].activeTask
  1225. for j=1,#activeTask do
  1226. human.db.moshou = human.db.moshou or {}
  1227. human.db.moshou[i] = human.db.moshou[i] or {}
  1228. human.db.moshou[i].taskGet = human.db.moshou[i].taskGet or {}
  1229. human.db.moshou[i].taskGet[j] = j
  1230. end
  1231. end
  1232. if moshouID == #config then
  1233. d3.moshoulv(human,1)
  1234. end
  1235. local MoshouLogic = require("moshou.MoshouLogic")
  1236. MoshouLogic.calMoshouHero(human)
  1237. end
  1238. function d3.moshouupneed(human)
  1239. local MoShouExcel = require("excel.moshou")
  1240. local lvUpNeed1 = MoShouExcel.moshouLv[2].lvUpNeed[1][1]
  1241. local lvUpNeed2 = MoShouExcel.moshouLv[2].lvUpNeed[2][1]
  1242. d3.it(human,lvUpNeed1)
  1243. d3.it(human,lvUpNeed2)
  1244. local jingLianUp1 = MoShouExcel.moshouJingLian[2].lvUpNeed[1][1]
  1245. local jingLianUp2 = MoShouExcel.moshouJingLian[2].lvUpNeed[2][1]
  1246. d3.it(human,jingLianUp1)
  1247. d3.it(human,jingLianUp2)
  1248. local zhuhunUp = MoShouExcel.moshouZhuHun[1].costID
  1249. d3.it(human,zhuhunUp)
  1250. local skillup1 = MoShouExcel.moshouSkillLv[2].upCost[1][1]
  1251. local skillup2 = MoShouExcel.moshouSkillLv[2].upCost[2][1]
  1252. d3.it(human,skillup1)
  1253. d3.it(human,skillup2)
  1254. end
  1255. function d3.moshoujinglian(human,val)
  1256. if not human.db.moshou then return end
  1257. human.db.moshou.jingLian = val
  1258. end
  1259. function d3.clolinereward(human)
  1260. require("onlineReward.OnlineRewardLogic").initDB(human)
  1261. end
  1262. function d3.clonlinerewardget(human)
  1263. human.db.onlineReward.getId = 0
  1264. end
  1265. function d3.bartaskfinish(human)
  1266. local BarTaskLogic = require("bar.BarTaskLogic")
  1267. BarTaskLogic.initDB(human)
  1268. for taskID, taskData in pairs(human.db.bar) do
  1269. if type(taskID) == "number" then
  1270. human.db.bar[taskID].ts = 0
  1271. end
  1272. end
  1273. end
  1274. function d3.test(human)
  1275. 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)
  1276. Broadcast.sendErr(human, str)
  1277. print(str)
  1278. end
  1279. function d3.clbattle()
  1280. local DB = require("common.DB")
  1281. local LuaMongo = _G.lua_mongo
  1282. LuaMongo.remove(DB.db_battle_shark)
  1283. end
  1284. -- 设置天梯争霸状态
  1285. function d3.jjcladderstart()
  1286. local JjcLadderLogic = require("jjcLadder.JjcLadderLogic")
  1287. local JjcLadderExcel = require("excel.jjcLadder")
  1288. local JjcLadderDefine = JjcLadderExcel.define[1]
  1289. JjcLadderLogic.onActReady()
  1290. local week = Util.getWeekDay(os.time()) - 1
  1291. if week == 0 then
  1292. week = 7
  1293. end
  1294. JjcLadderLogic.TEMP_TIMER_STAMPTIME = nil
  1295. JjcLadderDefine.startTime.week = week
  1296. JjcLadderDefine.endTime.week = week + 1
  1297. JjcLadderLogic.onTimer()
  1298. local msg = InnerMsg.lw.LW_GM
  1299. msg.gm = "jjcladderstartmiddle"
  1300. InnerMsg.sendMsg(0, msg)
  1301. end
  1302. function d3.jjcladderstartmiddle()
  1303. local JjcLadderLogic = require("jjcLadder.JjcLadderLogic")
  1304. local JjcLadderExcel = require("excel.jjcLadder")
  1305. local JjcLadderDefine = JjcLadderExcel.define[1]
  1306. JjcLadderLogic.onActReady()
  1307. local week = Util.getWeekDay(os.time()) - 1
  1308. if week == 0 then
  1309. week = 7
  1310. end
  1311. JjcLadderLogic.TEMP_TIMER_STAMPTIME = nil
  1312. JjcLadderDefine.startTime.week = week
  1313. JjcLadderDefine.endTime.week = week + 1
  1314. JjcLadderLogic.onTimer()
  1315. end
  1316. -- 天梯争霸报错
  1317. function d3.jjcladdersign(human)
  1318. local JjcLadderLogic = require("jjcLadder.JjcLadderLogic")
  1319. if JjcLadderLogic.getState() == JjcLadderLogic.STATE_ACT_START then
  1320. local commonDB = JjcLadderLogic.getCommonDB()
  1321. commonDB.uuid2sign = commonDB.uuid2sign or {}
  1322. commonDB.uuid2sign[human.db._id] = os.time()
  1323. JjcLadderLogic.saveCommonDB(commonDB)
  1324. JjcLadderLogic.onUpdatePos(human)
  1325. end
  1326. end
  1327. -- 天梯争霸结束回调
  1328. function d3.jjcladderend()
  1329. local JjcLadderLogic = require("jjcLadder.JjcLadderLogic")
  1330. JjcLadderLogic.onActEnd()
  1331. local msg = InnerMsg.lw.LW_GM
  1332. msg.gm = "jjcladderendmiddle"
  1333. InnerMsg.sendMsg(0, msg)
  1334. end
  1335. function d3.jjcladderendmiddle()
  1336. local JjcLadderLogic = require("jjcLadder.JjcLadderLogic")
  1337. JjcLadderLogic.onActEnd()
  1338. end
  1339. -- 重置天梯争霸活动信息
  1340. function d3.cljjcladder()
  1341. local JjcLadderLogic = require("jjcLadder.JjcLadderLogic")
  1342. JjcLadderLogic.saveCommonDB()
  1343. JjcLadderLogic.onActEnd()
  1344. local msg = InnerMsg.lw.LW_GM
  1345. msg.gm = "cljjcladdermiddle"
  1346. InnerMsg.sendMsg(0, msg)
  1347. end
  1348. function d3.cljjcladdermiddle()
  1349. local JjcLadderLogic = require("jjcLadder.JjcLadderLogic")
  1350. JjcLadderLogic.saveCommonDB()
  1351. JjcLadderLogic.onActEnd()
  1352. end
  1353. function d3.clcombat(human,val)
  1354. human.db.combatHero[val] = nil
  1355. end
  1356. function d3.clshop(human,val)
  1357. human.db.shop[val] = nil
  1358. end
  1359. -- 重置日常礼包
  1360. function d3.clrichanglibao(human)
  1361. human.db.richangLibao = nil
  1362. end
  1363. -- 重置荣耀峡谷(龙族战场)
  1364. function d3.clvalley()
  1365. local ValleyLogic = require("valley.ValleyLogic")
  1366. ValleyLogic.cleanDB()
  1367. local msg = InnerMsg.lw.LW_GM
  1368. msg.gm = "clvalleymiddle"
  1369. InnerMsg.sendMsg(0, msg)
  1370. end
  1371. function d3.clvalleymiddle()
  1372. local ValleyLogic = require("valley.ValleyLogic")
  1373. ValleyLogic.cleanDB()
  1374. end
  1375. -- 重置荣耀峡谷(龙族战场)成就
  1376. function d3.clvalleytask(human)
  1377. human.db.valleyTask = nil
  1378. end
  1379. -- 增加荣耀峡谷(龙族战场)个人成就值
  1380. function d3.valleytask1(human, value)
  1381. require("valley.ValleyTask").updateValue(human.db._id, value, 0)
  1382. end
  1383. -- 增加荣耀峡谷(龙族战场)团队成就值
  1384. function d3.valleytask2(human, value)
  1385. require("valley.ValleyTask").updateValue(human.db._id, 0, value)
  1386. end
  1387. function d3.touchLv(human,val)
  1388. local liveness = val + 0
  1389. require("union.UnionLivenessLogic").touchLv(human, liveness)
  1390. end
  1391. function d3.clyj()
  1392. local DB = require("common.DB")
  1393. local LuaMongo = _G.lua_mongo
  1394. LuaMongo.remove(DB.db_yjTreasure)
  1395. local YjTreasureDBLogic = require("yjTreasure.YjTreasureDB")
  1396. YjTreasureDBLogic.YJ_TREASURE_DB = {}
  1397. end
  1398. function d3.yjlayer(human,val)
  1399. local YjTreasureLogic = require("yjTreasure.YjTreasureLogic")
  1400. local YjTreasureDBLogic = require("yjTreasure.YjTreasureDB")
  1401. local YjTreasureExcel = require("excel.yjTreasure")
  1402. local Lang = require("common.Lang")
  1403. local layerData = YjTreasureDBLogic.getLayerDataByUuid(human.db._id)
  1404. local layCnf = YjTreasureExcel.layer
  1405. local nowLayer = layerData.layer
  1406. if val > #layCnf then return Broadcast.sendErr(human,Lang.YJTREASURE_LAYER_ERR) end
  1407. local roleData = YjTreasureDBLogic.getRoleDataByUuid(human.db._id)
  1408. local layerMax = roleData.layerMax or 0
  1409. if layerMax < val then
  1410. roleData.layerMax = val
  1411. YjTreasureDBLogic.updateRoleDataByUuid(roleData,human.db._id)
  1412. end
  1413. YjTreasureDBLogic.creatLayerDataByUuid(human.db._id,val)
  1414. YjTreasureLogic.CG_YJTREASURE_QUERY(human)
  1415. end
  1416. function d3.towerKing(human)
  1417. local HuanJingTowerLogic = require("huanjingTower.HuanjingTowerLogic")
  1418. HuanJingTowerLogic.unlockTowerKing(human)
  1419. end
  1420. -- 设置炼狱最大通关层
  1421. function d3.lianyu(human, value)
  1422. value = tonumber(value)
  1423. if not value then return end
  1424. if value < 0 then return end
  1425. local LianyuExcel = require("excel.lianyu")
  1426. if value > 0 and not LianyuExcel.gamelevel[value] then
  1427. return
  1428. end
  1429. LianyuLogic = require("lianyu.LianyuLogic")
  1430. LianyuLogic.setMaxLv(human, value)
  1431. end
  1432. function d3.cllianyu(human)
  1433. human.db.lianyu = nil
  1434. end
  1435. function d3.cllianyuhelp()
  1436. local CommonDB = require("common.CommonDB")
  1437. CommonDB.updateValue(CommonDB.KEY_LIANYU, nil)
  1438. end
  1439. -- 清除特权商店相关信息
  1440. function cltequanshop(human)
  1441. human.db.tequanShop = nil
  1442. human.db.tequanMopup = nil
  1443. if human.db.bar then
  1444. human.db.bar.vip = nil
  1445. human.db.bar.surVip = nil
  1446. end
  1447. end
  1448. function d3.addbts(human)
  1449. local now = os.time()
  1450. require("battle.BattleLogic").initBattleOut(human, now)
  1451. human.db.battleOut.expTs1 = now - 7200
  1452. human.db.battleOut.itemTs1 = now - 7200
  1453. human.db.battleOut.expTs2 = now - 7200
  1454. human.db.battleOut.itemTs2 = now - 7200
  1455. end
  1456. function d3.addbsd(human)
  1457. human.db.mopupDoCnt = 0
  1458. human.db.mopupFreeCnt = 0
  1459. end
  1460. function d3.addYjYj(human,type)
  1461. local YjTreasureLogic = require("yjTreasure.YjTreasureLogic")
  1462. YjTreasureLogic.yjYaoJiAdd(human,10,type)
  1463. end
  1464. function d3.ajfc(human,val)
  1465. for i = 1,val do
  1466. human.db.jjcDailyFight = (human.db.jjcDailyFight or 0) + 1
  1467. require("jjc.JjcDB").updateTotalFight(human.db._id)
  1468. end
  1469. end
  1470. function d3.godWartest(human)
  1471. local JjcGodWarLogic = require("jjcGodWar.JjcGodWarLogic")
  1472. JjcGodWarLogic.jjcGodWarFinishGm(human)
  1473. end
  1474. function d3.closeMiddle(human)
  1475. MiddleConnect.stopConnectMiddle()
  1476. end
  1477. function d3.resetMiddle(human)
  1478. MiddleConnect.autoResetMiddle()
  1479. end
  1480. function d3.loginSign(human, value)
  1481. value = tonumber(value)
  1482. local LoginSignLogic = require("loginSign.LoginSignLogic")
  1483. LoginSignLogic.updateGM(human, value)
  1484. end
  1485. function d3.yuanjun(human, value)
  1486. human.db.combatBackup = 1
  1487. end
  1488. function d3.buyItem(human, value)
  1489. require("shop.ShopLogic").buy(human, 9, 405007, 1, 1)
  1490. end
  1491. function d3.test1(human)
  1492. require("absAct.MangHeLogic").draw(human, 1)
  1493. end
  1494. function d3.zbsj(human,val)
  1495. if human.db.zhanbu == nil then
  1496. return
  1497. end
  1498. human.db.zhanbu.money = val
  1499. end
  1500. function d3.tjm(human)
  1501. require("present.RelationGiftLogic").relationBind(human, "017772140001")
  1502. end
  1503. function d3.qcjz(human)
  1504. human.db.unionDonate = nil
  1505. end
  1506. function d3.unionCopyLv(human, val)
  1507. require("union.UnionEctypeLogic").toUnionBossLvGm(human, tonumber(val))
  1508. end
  1509. function d3.fff(human)
  1510. human.db.leaveUnionLimit = nil
  1511. end
  1512. function d3.hgw(args)
  1513. require("absAct.HeroGrowUp").actLoop()
  1514. end
  1515. function d3.hgwlv(human,val)
  1516. require("absAct.HeroGrowUp").addJifen(human,tonumber(val))
  1517. end
  1518. function d3.paoma(human, val)
  1519. require("chat.ChatPaoMaLogic").notice(val)
  1520. end
  1521. -- 设置合服时间
  1522. function d3.merge(human,value)
  1523. value = value and tonumber(value)
  1524. if value == nil then
  1525. local mergeSvrTime = CommonDB.getMergeServerTime()
  1526. if mergeSvrTime == 0 then
  1527. Broadcast.sendErr(human, "未设置合服时间")
  1528. else
  1529. local tb = os.date("%Y%m%d", mergeSvrTime)
  1530. Broadcast.sendErr(human, "当前合服时间为" .. tb)
  1531. end
  1532. else
  1533. local now = os.time()
  1534. local temp = Util.getDayStartTime(now)
  1535. temp = temp - (value - 1) * 24 * 3600
  1536. CommonDB.setMergeTime(temp)
  1537. local tb = os.date("%Y%m%d", temp)
  1538. Broadcast.sendErr(human, "设置当前合服时间为" .. tb)
  1539. --同步中心服开服时间
  1540. --[[local msgRet = InnerMsg.lw.LW_OS
  1541. msgRet.uuid = human.db._id
  1542. msgRet.value = temp
  1543. InnerMsg.sendMsg(0, msgRet)]]
  1544. end
  1545. end