Gm.lua 50 KB

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