Gm.lua 66 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607160816091610161116121613161416151616161716181619162016211622162316241625162616271628162916301631163216331634163516361637163816391640164116421643164416451646164716481649165016511652165316541655165616571658165916601661166216631664166516661667166816691670167116721673167416751676167716781679168016811682168316841685168616871688168916901691169216931694169516961697169816991700170117021703170417051706170717081709171017111712171317141715171617171718171917201721172217231724172517261727172817291730173117321733173417351736173717381739174017411742174317441745174617471748174917501751175217531754175517561757175817591760176117621763176417651766176717681769177017711772177317741775177617771778177917801781178217831784178517861787178817891790179117921793179417951796179717981799180018011802180318041805180618071808180918101811181218131814181518161817181818191820182118221823182418251826182718281829183018311832183318341835183618371838183918401841184218431844184518461847184818491850185118521853185418551856185718581859186018611862186318641865186618671868186918701871187218731874187518761877187818791880188118821883188418851886188718881889189018911892189318941895189618971898189919001901190219031904190519061907190819091910191119121913191419151916191719181919192019211922192319241925192619271928192919301931193219331934193519361937193819391940194119421943194419451946194719481949195019511952195319541955195619571958195919601961196219631964196519661967196819691970197119721973197419751976197719781979198019811982198319841985198619871988198919901991199219931994199519961997199819992000200120022003200420052006200720082009201020112012201320142015201620172018201920202021202220232024202520262027202820292030203120322033203420352036203720382039204020412042204320442045204620472048204920502051205220532054205520562057205820592060206120622063206420652066206720682069207020712072207320742075207620772078207920802081208220832084208520862087208820892090209120922093209420952096209720982099210021012102210321042105210621072108210921102111211221132114211521162117211821192120212121222123212421252126212721282129213021312132213321342135213621372138213921402141214221432144214521462147214821492150215121522153215421552156215721582159216021612162216321642165216621672168216921702171217221732174217521762177217821792180218121822183218421852186218721882189219021912192219321942195219621972198219922002201220222032204220522062207220822092210221122122213221422152216221722182219222022212222222322242225222622272228222922302231223222332234223522362237223822392240224122422243224422452246224722482249225022512252225322542255225622572258225922602261226222632264226522662267226822692270227122722273227422752276227722782279228022812282228322842285228622872288228922902291229222932294229522962297229822992300230123022303230423052306230723082309231023112312231323142315231623172318231923202321232223232324232523262327232823292330233123322333233423352336233723382339234023412342234323442345234623472348234923502351235223532354235523562357235823592360236123622363236423652366236723682369237023712372237323742375237623772378237923802381238223832384238523862387238823892390239123922393239423952396239723982399240024012402240324042405240624072408240924102411241224132414241524162417241824192420242124222423242424252426242724282429243024312432
  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 InnerMsg = require("core.InnerMsg")
  9. local CommonDB = require("common.CommonDB")
  10. local JjcDB = require("jjc.JjcDB")
  11. local VipLogic = require("vip.VipLogic")
  12. local VipExcel = require("excel.vip")
  13. local GMExcel = require("excel.gm")
  14. local RoleLogic = require("role.RoleLogic")
  15. local UnionDBLogic = require("union.UnionDBLogic")
  16. local CombatPosLogic = require("combat.CombatPosLogic")
  17. local CombatDefine = require("combat.CombatDefine")
  18. local ItemDefine = require("bag.ItemDefine")
  19. local MiddleConnect = require("middle.MiddleConnect")
  20. local BuyLogic = require("topup.BuyLogic")
  21. local WeekendLoopActManger = require("WeekendLoopActivity.WeekendLoopActManager")
  22. local RecommendLineup = require("drawCard.RecommendLineup")
  23. local NewFirstCharge = require("present.NewFirstChargeLogic")
  24. local ActPowerUp = require("present.OpenServerActPowerUp")
  25. local FestivalSevenDayCardLogic = require("absAct.FestivalSevenDayCardLogic")
  26. local TreasureChestLogic = require("treasurechest.TreasureChestLogic")
  27. local MaiDianLogic = require("MaiDian.MaiDianLogic")
  28. local CommerceManger = require("serverCommerce.ServerCommerceManager")
  29. local CommonDefine = require("common.CommonDefine")
  30. local winner = require("winnerRelic.WinnerRelicLogic")
  31. local day = require("dailyTask.DailyTaskLogic")
  32. local week = require("dailyTask.WeekTaskLogic")
  33. local honor = require("dailyTask.HonorJourney")
  34. local QQBigShot = require("platform.QQBigShot")
  35. local MergeServerCharge = require("present.MergeServerCharge")
  36. local HeroTable = require("excel.hero").hero
  37. d3 = {}
  38. local function send(human, err)
  39. local mm = Msg.gc.GC_CHAT
  40. mm.item.msgType = 3
  41. mm.item.targetUuid = ""
  42. mm.item.sendTime = os.time()
  43. mm.item.msg = tostring(err)
  44. mm.item.vipLv = human.db.vipLv or 0
  45. mm.item.videoUuid = ""
  46. mm.item.isJson = 0
  47. mm.item.unionFrame = 0
  48. local union = {}
  49. if human.db.unionUuid ~= nil then
  50. union = UnionDBLogic.getUnion(human.db.unionUuid)
  51. end
  52. RoleLogic.getRoleBase(human,mm.item.roleBase)
  53. mm.item.label = human.db.throneLabel or 0
  54. Msg.send(mm, human.fd)
  55. end
  56. -- 直接调用gm命令
  57. function execGm(human, cmd,pos)
  58. print("直接调用gm命令",cmd,pos)
  59. --Log.write(Log.LOGID_OSS_GM_CODE, human.db._id, human.db.account, human.db.name, cmd, pos)
  60. Log.write(Log.LOGID_OSS_GM_CODE, human.db._id, human.db.newUniqueTag, human.db.name, cmd, pos)
  61. d3[cmd](human, tonumber(pos) or pos)
  62. return true
  63. end
  64. function checkGm(human, str)
  65. if not Config.IS_USE_GM_CMD and human.db.gm == nil then
  66. return
  67. end
  68. local pos = string.find(str, " ", 1, true)
  69. local cmd = string.sub(str, 1, pos and pos - 1)
  70. if not Config.IS_USE_GM_CMD then
  71. if human.db.gm == 1 and not GmControl[cmd] then -- 一级权限的gm只能使用部分gm命令
  72. send(human, "not permit for this gm cmd!")
  73. return true
  74. end
  75. if human.db.gm == 100 then -- 新手引导员不能使用gm命令
  76. return
  77. end
  78. end
  79. if not d3[cmd] then
  80. return
  81. end
  82. local arg = string.sub(str, #cmd + 2)
  83. --Log.write(Log.LOGID_OSS_GM_CODE, human.db._id, human.db.account, human.db.name, cmd, arg)
  84. Log.write(Log.LOGID_OSS_GM_CODE, human.db._id, human.db.newUniqueTag, human.db.name, cmd, arg)
  85. d3[cmd](human, tonumber(arg) or arg)
  86. return true
  87. end
  88. function d3.heroadd(human,val)
  89. if val == nil then return end
  90. local tb = Util.split(val, " ")
  91. local id = tonumber(tb[1])
  92. local cnt = tonumber(tb[2])
  93. local lv = tonumber(tb[3])
  94. local star = tonumber(tb[4])
  95. if not (id and cnt) then return end
  96. for i = 1, cnt do
  97. local heroGrid = require("hero.HeroGrid").createHeroGrid(id , star)
  98. if not heroGrid then break end
  99. local skinLogic = require("skin.SkinLogic")
  100. local skinOn = skinLogic.checkHeroSkinById(human,id)
  101. if skinOn then
  102. heroGrid.skinOn = skinOn
  103. end
  104. local attrConfig = require("hero.HeroDefine").getAttrConfig(id, heroGrid.star)
  105. if not attrConfig then return end
  106. local quality = require("hero.HeroGrid").getMaxQualityByLv(heroGrid.star, lv)
  107. local maxLv = require("hero.HeroGrid").getMaxLv(heroGrid.star, quality)
  108. heroGrid.lv = math.min(maxLv, lv or 0)
  109. heroGrid.quality = math.max(heroGrid.quality, quality or 0)
  110. require("hero.HeroLogic").addHeroByGrid(human, heroGrid, "gm")
  111. end
  112. end
  113. function d3.herodel(human,val)
  114. if val == nil then return end
  115. local pos = string.find(val, " ", 1, true)
  116. if pos == nil then return end
  117. local index = tonumber(string.sub(val, 1, pos - 1))
  118. local cnt= tonumber(string.sub(val,pos+1,#val))
  119. require("hero.HeroLogic").delHeroByIndex(human,index,"gm")
  120. end
  121. function d3.herodelAll(human,val)
  122. for index = 1, human.db.heroBag[0]do
  123. require("hero.HeroLogic").delHeroByIndex(human,index,"gm")
  124. end
  125. end
  126. function d3.itemadd(human,val)
  127. if val == nil then return end
  128. local pos = string.find(val, " ", 1, true)
  129. if pos == nil then return end
  130. local id = tonumber(string.sub(val, 1, pos - 1))
  131. if not id then
  132. local name = string.sub(val, 1, pos - 1)
  133. local ItemExcel = require("excel.item").item
  134. for k,v in pairs(ItemExcel) do
  135. if v.name == name then
  136. id = k
  137. break
  138. end
  139. end
  140. end
  141. if not id then
  142. local name = string.sub(val,1,pos - 1)
  143. local EquipExcel = require("excel.equip").equip
  144. for k,v in pairs(EquipExcel) do
  145. if v.name == name then
  146. id = k
  147. break
  148. end
  149. end
  150. end
  151. if not id then
  152. return
  153. end
  154. local EquipExcel = require("excel.equip").equip
  155. if EquipExcel[id] then
  156. local cnt= tonumber(string.sub(val,pos+1,pos + 2))
  157. local rare= tonumber(string.sub(val,pos+2,#val))
  158. require("bag.BagLogic").addItem(human, id, cnt, "gm", nil, rare)
  159. human.getEquip = nil
  160. else
  161. -- 分开是因为 常规道具 给不了
  162. local cnt= tonumber(string.sub(val,pos+1,#val))
  163. print("[itemadd] id, cnt = ", id, cnt)
  164. require("bag.BagLogic").addItem(human,id,cnt,"gm")
  165. end
  166. end
  167. -- 删除道具
  168. function d3.itemdel(human,val)
  169. if val == nil then return end
  170. local pos = string.find(val, " ", 1, true)
  171. if pos == nil then return end
  172. local id = tonumber(string.sub(val, 1, pos - 1))
  173. local cnt= tonumber(string.sub(val,pos+1,#val))
  174. require("bag.BagLogic").delItem(human,id,cnt,"gm")
  175. end
  176. function d3.qingbaoMax(human)
  177. require("bar.BarTaskLogic").addBarQingBao(human, 10000)
  178. end
  179. function d3.maxbattle(human, val)
  180. val = val + 0
  181. human.db.battleID = val
  182. human.db.guajiID = val - 1
  183. local BRoleLogic = require("billboard.BRoleLogic")
  184. local BillboardDefine = require("billboard.BillboardDefine")
  185. BRoleLogic.updateData(BillboardDefine.TYPE_BATTLE, human.db)
  186. end
  187. function d3.dbsave(human)
  188. ObjHuman.save(human)
  189. end
  190. -- 设置当前金币
  191. function d3.jinbi(human, val)
  192. val = val + 0
  193. ObjHuman.updateJinbi(human, val - human.db.jinbi, "gm")
  194. end
  195. -- 设置钻石
  196. function d3.zuanshi(human, val)
  197. val = val + 0
  198. if val > human.db.zuanshi then
  199. print("234234234",val)
  200. ObjHuman.addZuanshi(human, val - human.db.zuanshi, "gm")
  201. else
  202. ObjHuman.decZuanshi(human, val - human.db.zuanshi, "gm")
  203. end
  204. end
  205. --添加邮件
  206. function d3.mail(human,val)
  207. local param = Util.split(val, " ")
  208. local mailtype = tonumber(param[1])
  209. local title = param[2]
  210. local content = param[3]
  211. local max = #param
  212. local count = (type(param[max]) == "number") and param[max] or 1
  213. local items
  214. if param[4] then
  215. items = {}
  216. for i = 4,max-1 do
  217. items[#items + 1] = {tonumber(param[i]),math.floor(math.random(1,10))}
  218. end
  219. end
  220. if not (mailtype == 1 or mailtype == 2) or not title or not content then
  221. send(human, "参数错误 "..type.." "..title.." "..content.." "..#items)
  222. end
  223. local MailManager = require("mail.MailManager")
  224. for i= 1,count do
  225. MailManager.add(mailtype,human.db._id,title,content,items,mailtype == 2 and [[测试用户]])
  226. end
  227. end
  228. function d3.clbag(human)
  229. human.db.bag = {}
  230. local msgRet = Msg.gc.GC_BAG_LIST
  231. msgRet.list[0] = 0
  232. Msg.send(msgRet, human.fd)
  233. end
  234. function d3.clhero(human)
  235. local HeroLogic = require("hero.HeroLogic")
  236. for i = 1, human.db.heroBag[0] do
  237. HeroLogic.delHeroByIndex(human, i, "gm")
  238. end
  239. end
  240. function d3.god(human)
  241. local GMExcelConfig = GMExcel.god[1]
  242. BagLogic.addItemList(human, GMExcelConfig.addItem, "gm")
  243. for k, v in ipairs(GMExcelConfig.addHero) do
  244. local id = tonumber(v[1])
  245. local cnt = tonumber(v[2])
  246. local lv = tonumber(v[3])
  247. local star = tonumber(v[4])
  248. local quality = require("hero.HeroGrid").getMaxQualityByLv(star, lv)
  249. for i = 1, cnt do
  250. local heroGrid = require("hero.HeroGrid").createHeroGrid(id, star)
  251. if heroGrid then
  252. heroGrid.lv = math.max(heroGrid.lv, lv or 0)
  253. heroGrid.quality = math.max(heroGrid.quality, quality or 0)
  254. require("hero.HeroLogic").addHeroByGrid(human, heroGrid, "gm")
  255. end
  256. end
  257. end
  258. --d3.viplv(human, 13)
  259. --d3.lv(human, 1)
  260. --d3.noguide(human)
  261. end
  262. function d3.wudi(human)
  263. if wudi then
  264. wudi = false
  265. Broadcast.sendErr(human, "取消无敌状态")
  266. else
  267. wudi = true
  268. Broadcast.sendErr(human, "进入无敌状态")
  269. end
  270. end
  271. -- 清空副本次数和购买次数
  272. function d3.clcopy(human)
  273. human.db.copy = nil
  274. end
  275. -- 设置等级
  276. function d3.lv(human, val)
  277. val = val + 0
  278. local lvOld = human.db.lv
  279. local lvNew = val + 0
  280. human.db.lv = lvNew
  281. ObjHuman.onLvUpCB(human,lvOld , lvNew)
  282. end
  283. -- 加经验
  284. function d3.addexp(human, val)
  285. val = val + 0
  286. ObjHuman.addExp(human, val)
  287. end
  288. -- 设置vip等级
  289. function d3.viplv(human, val)
  290. val = val + 0
  291. local oldVipLv = VipLogic.getVipLv(human)
  292. human.db.vipExp = VipExcel.vip[val] and VipExcel.vip[val].exp or 0
  293. human.db.vipLv = val
  294. VipLogic.addExp(human, 0)
  295. end
  296. -- 增加vip经验
  297. function d3.vipexp(human, val)
  298. val = val + 0
  299. VipLogic.addExp(human, val)
  300. end
  301. -- 设置玩家年龄(测试充值限额):1=8岁以下 2=8~16岁 3=16~18岁 4=18岁以上
  302. function d3.age(human, val)
  303. local ageType = tonumber(val)
  304. if not ageType or ageType < 1 or ageType > 4 then
  305. return Broadcast.sendErr(human, "参数错误:1=8岁以下 2=8~16岁 3=16~18岁 4=18岁以上")
  306. end
  307. local ageMap = {[1] = 7, [2] = 10, [3] = 17, [4] = 18}
  308. human.db.age = ageMap[ageType]
  309. local AgeLimitLogic = require("topup.AgeLimitLogic")
  310. if human.fd then
  311. AgeLimitLogic.query(human)
  312. end
  313. Broadcast.sendErr(human, "年龄已设置为" .. human.db.age .. "岁")
  314. end
  315. function d3.it1(human, value)
  316. value = tonumber(value)
  317. if not value then return end
  318. local ItemExcel = require("excel.item").item
  319. local BagLogic = require("bag.BagLogic")
  320. for itemID, cf in pairs(ItemExcel) do
  321. if cf.subType == value then
  322. BagLogic.addItem(human, itemID, 1, "gm", true)
  323. end
  324. end
  325. BagLogic.sendBagList(human)
  326. end
  327. function d3.equip(human, value)
  328. value = tonumber(value)
  329. if not value then return end
  330. local BagLogic = require("bag.BagLogic")
  331. local EquipExcel = require("excel.equip").equip
  332. for itemID in pairs(EquipExcel) do
  333. BagLogic.addItem(human, itemID, 1, "gm", true)
  334. end
  335. BagLogic.sendBagList(human)
  336. end
  337. function d3.task(human, val)
  338. if val == nil then return end
  339. local task = string.find(val, " ", 1, true)
  340. if task == nil then return end
  341. local id = tonumber(string.sub(val, 1, task - 1))
  342. local cnt= tonumber(string.sub(val,task+1,#val))
  343. local DailyTaskLogic = require("dailyTask.DailyTaskLogic")
  344. DailyTaskLogic.recordDailyTaskFinishCnt(human, id, cnt, nil)
  345. end
  346. function d3.os(human, value)
  347. value = value and tonumber(value)
  348. if value == nil then
  349. local openSvrTime = CommonDB.getServerOpenTime()
  350. if openSvrTime == 0 then
  351. Broadcast.sendErr(human, "未设置开服时间")
  352. else
  353. local tb = os.date("%Y%m%d", openSvrTime)
  354. Broadcast.sendErr(human, "当前开服时间为" .. tb)
  355. end
  356. else
  357. local now = os.time()
  358. local temp = Util.getDayStartTime(now)
  359. temp = temp - (value - 1) * 24 * 3600
  360. CommonDB.setServerOpenTime(temp)
  361. local tb = os.date("%Y%m%d", temp)
  362. Broadcast.sendErr(human, "设置当前开服时间为" .. tb)
  363. --同步中心服开服时间
  364. --[[local msgRet = InnerMsg.lw.LW_OS
  365. msgRet.uuid = human.db._id
  366. msgRet.value = temp
  367. InnerMsg.sendMsg(0, msgRet)]]
  368. end
  369. end
  370. function d3.createtime(human, value)
  371. value = value and tonumber(value)
  372. if not value then return end
  373. local now = os.time()
  374. local temp = Util.getDayStartTime(now)
  375. temp = temp - (value - 1) * 24 * 3600
  376. human.db.createTime = temp
  377. local tb = os.date("%Y%m%d", temp)
  378. Broadcast.sendErr(human, "设置当前创角时间为" .. tb)
  379. end
  380. --设置中心服开服时间
  381. function d3.osw(human, value)
  382. value = value and tonumber(value)
  383. local msgRet = InnerMsg.lw.LW_OS
  384. msgRet.uuid = human.db._id
  385. msgRet.value = value
  386. InnerMsg.sendMsg(0, msgRet)
  387. end
  388. function d3.chengjiu(human,val)
  389. local param = Util.split(val, " ")
  390. local ChengjiuLogic = require("chengjiu.ChengjiuLogic")
  391. ChengjiuLogic.onCallback(human,3,3,4)
  392. end
  393. function d3.cjcl(human)
  394. local ChengjiuLogic = require("chengjiu.ChengjiuLogic")
  395. ChengjiuLogic.GM_ClearAllData(human)
  396. end
  397. function d3.jjczero()
  398. local JjcLogic = require("jjc.JjcLogic")
  399. JjcLogic.onZero()
  400. end
  401. function d3.jjcreset()
  402. JjcDB.resetJJCDB()
  403. end
  404. function d3.jpSet(human,val)
  405. local point = tonumber(val)
  406. JjcDB.updatePlayerPoint(human.db._id, point, nil)
  407. end
  408. function d3.billboard(human)
  409. local BillboardDB = require("billboard.BillboardDB")
  410. BillboardDB.sort()
  411. end
  412. function d3.cldjs(human)
  413. human.db.jinbiExchange = nil
  414. end
  415. -- 激活钻石基金
  416. function d3.fund(human, val)
  417. local type = tonumber(val)
  418. local FundLogic = require("present.FundLogic")
  419. FundLogic.fundBuy(human, type)
  420. end
  421. -- 清空钻石基金购买和发放记录
  422. function d3.clfund(human)
  423. human.db.fundFlag = nil
  424. end
  425. function d3.clbuy(human)
  426. human.db.buy = {}
  427. end
  428. --增加好战者计数 仅限竞技场和试炼
  429. function d3.hzzadd(human, val)
  430. if val == nil then return end
  431. local pos = string.find(val, " ", 1, true)
  432. if pos == nil then return end
  433. local type = tonumber(string.sub(val, 1, pos - 1))
  434. local add= tonumber(string.sub(val,pos+1,#val))
  435. local MonthHzz = require("monthAct.MonthHzz")
  436. if type == MonthHzz.MONTHACT_HZZ_TYPE_1 then
  437. MonthHzz.addJjcFight(human, nil, add)
  438. elseif type == MonthHzz.MONTHACT_HZZ_TYPE_2 then
  439. MonthHzz.addTrialCnt(human, nil, add)
  440. end
  441. end
  442. function d3.ydjiuguan(human, val)
  443. if val == nil then return end
  444. local pos = string.find(val, " ", 1, true)
  445. if pos == nil then return end
  446. local star = tonumber(string.sub(val, 1, pos - 1))
  447. local add= tonumber(string.sub(val,pos+1,#val))
  448. local MonthDrunkery = require("monthAct.MonthDrunkery")
  449. MonthDrunkery.addDrunkCntEx(human, star, add)
  450. end
  451. function d3.ydhcjx(human, val)
  452. if val == nil then return end
  453. local param = Util.split(val, " ")
  454. local type = tonumber(param[1])
  455. local heroId= tonumber(param[2])
  456. local add = tonumber(param[3])
  457. local MonthHecJuex = require("monthAct.MonthHecJuex")
  458. MonthHecJuex.addCntByGm(human,type,heroId, add)
  459. end
  460. function d3.clboss(human)
  461. local DB = require("common.DB")
  462. local LuaMongo = _G.lua_mongo
  463. LuaMongo.remove(DB.db_boss)
  464. end
  465. function d3.clwish(human)
  466. human.db.wishCnt = nil
  467. human.db.wishActAlrCnt = nil
  468. end
  469. -- 设置高抽次数
  470. function d3.hsum(human,val)
  471. human.db.summonCnt = val
  472. end
  473. function d3.clhsum(human)
  474. human.db.summonCnt = nil
  475. human.db.sumWinScoCnt = nil
  476. end
  477. function d3.unionquery(human,val)
  478. local name = val
  479. local UnionLogic = require("union.UnionLogic")
  480. UnionLogic.createUnion(human,name)
  481. end
  482. function d3.uniondonate(human, value)
  483. local UnionDBLogic = require("union.UnionDBLogic")
  484. local union = UnionDBLogic.getUnion(human.db.unionUuid)
  485. if union == nil then
  486. return
  487. end
  488. union.donate = union.donate or {}
  489. union.donate[1] = value
  490. union.donate[2] = os.time()
  491. UnionDBLogic.updateUnionData(union)
  492. end
  493. function d3.settower(human,val)
  494. local HuanjingTowerLogic = require("huanjingTower.HuanjingTowerLogic")
  495. HuanjingTowerLogic.setTowerByGm(human, val)
  496. end
  497. function d3.setbattle(human,val)
  498. local BattleLogic = require("battle.BattleLogic")
  499. local param = Util.split(val, " ")
  500. BattleLogic.setBattleByGm(human, param[1], param[2])
  501. end
  502. function d3.clattr(human)
  503. local BattleLogic = require("battle.BattleLogic")
  504. BattleLogic.GM_ClearNowModelAttrData(human)
  505. end
  506. function d3.overmonth(human, val)
  507. val = math.max(tonumber(val) or 0, 10)
  508. human.db.actMonthEndTime = os.time() + val
  509. end
  510. function d3.zhuanpantime(human,val)
  511. local param = Util.split(val, " ")
  512. local ZhuanpanLogic = require("zhuanpan.ZhuanpanLogic")
  513. ZhuanpanLogic.zhuanpanByGm(human, tonumber(param[1]), tonumber(param[2]) )
  514. end
  515. function d3.signin(human,val)
  516. human.db.signInCnt = val
  517. for i =1,human.db.signInCnt do
  518. human.db.signIn[i] = 1
  519. end
  520. end
  521. function d3.unionLv(human, val)
  522. val = tonumber(val)
  523. if not val then return end
  524. local UnionDBLogic = require("union.UnionDBLogic")
  525. local union = UnionDBLogic.getUnion(human.db.unionUuid)
  526. if not union then return end
  527. UnionDBLogic.upsetUnionData(union._id, "lv", val)
  528. UnionDBLogic.upsetUnionData(union._id, "exp", 0)
  529. end
  530. function d3.unionexp(human, val)
  531. val = tonumber(val)
  532. if not val then return end
  533. local UnionDBLogic = require("union.UnionDBLogic")
  534. local UnionLogic = require("union.UnionLogic")
  535. local union = UnionDBLogic.getUnion(human.db.unionUuid)
  536. if not union then return end
  537. UnionLogic.addUnionExp(union, val)
  538. UnionDBLogic.updateUnionData(union)
  539. end
  540. function d3.gws(human,val)
  541. local LoginSignLogic = require("loginSign.LoginSignLogic")
  542. for i = 1,val do
  543. LoginSignLogic.getReward(human)
  544. end
  545. end
  546. function d3.tsht(human)
  547. local AdminLogic = require("AdminLogic")
  548. local JsonInput = {}
  549. JsonInput.accountName = human.db.account
  550. JsonInput.roleName = human.db.name
  551. AdminLogic.adminFunction.getuserstatus(JsonInput)
  552. end
  553. function d3.bs(human,val)
  554. local param = Util.split(val, " ")
  555. local AdminLogic = require("AdminLogic")
  556. local JsonInput = {}
  557. JsonInput.account = human.db.account
  558. JsonInput.minute = param[1]
  559. JsonInput.reason = param[2]
  560. AdminLogic.adminFunction.banSay(JsonInput)
  561. end
  562. function d3.bl(human,val)
  563. local AdminLogic = require("AdminLogic")
  564. local JsonInput = {}
  565. JsonInput.accountName = human.db.account
  566. JsonInput.minute = val
  567. AdminLogic.adminFunction.banAccount(JsonInput)
  568. end
  569. function d3.bl2(human,val)
  570. local AdminLogic = require("AdminLogic")
  571. local param = Util.split(val, " ")
  572. local JsonInput = {}
  573. JsonInput.accountName = param[1]
  574. JsonInput.minute = tonumber(param[2])
  575. AdminLogic.adminFunction.banAccount(JsonInput)
  576. end
  577. function d3.cbl(human,val)
  578. local param = Util.split(val, " ")
  579. local AdminLogic = require("AdminLogic")
  580. local JsonInput = {}
  581. JsonInput.accountName = param[1]
  582. JsonInput.cancelBanSay = param[2]
  583. AdminLogic.adminFunction.cancelBanAccount(JsonInput)
  584. end
  585. function d3.bip(human,val)
  586. local param = Util.split(val, " ")
  587. local AdminLogic = require("AdminLogic")
  588. local JsonInput = {}
  589. JsonInput.IP = param[1]
  590. JsonInput.banTime = param[2]
  591. AdminLogic.adminFunction.banIp(JsonInput)
  592. end
  593. function d3.ursc(human)
  594. human.db.ectypeCnt = nil
  595. human.db.ectypeFreeTime = nil
  596. end
  597. function d3.sue(human,val)
  598. local newLevel = tonumber(val)
  599. if not newLevel then return end
  600. local UnionDBLogic = require("union.UnionDBLogic")
  601. local union = UnionDBLogic.getUnion(human.db.unionUuid)
  602. if not union then return end
  603. UnionDBLogic.updateBossLv(union,newLevel)
  604. end
  605. function d3.smtp(human,val)
  606. local param = Util.split(val, " ")
  607. local AdminLogic = require("AdminLogic")
  608. local JsonInput = {}
  609. JsonInput.recvType = 3
  610. JsonInput.title = param[1]
  611. JsonInput.content = param[2]
  612. JsonInput.fbAccount = param[3]
  613. JsonInput.senderName = "系统邮件"
  614. JsonInput.fbTime = os.time()
  615. JsonInput.fbContent = "反馈"
  616. JsonInput.startLv =0
  617. JsonInput.endLv = 51
  618. JsonInput.lastLoginTime = os.time() - 60*60
  619. AdminLogic.adminFunction.mail(JsonInput)
  620. end
  621. function d3.clmilltime(human)
  622. human.db.unionTaskGetTime = nil
  623. end
  624. function d3.tstx(human,val)
  625. local RoleHeadLogic = require("role.RoleHeadLogic")
  626. RoleHeadLogic.active(human, RoleHeadLogic.HEAD_TYPE_1, val)
  627. end
  628. function d3.tstxk(human,val)
  629. local RoleHeadLogic = require("role.RoleHeadLogic")
  630. RoleHeadLogic.active(human, RoleHeadLogic.HEAD_TYPE_2, val)
  631. end
  632. function d3.buy(human,val)
  633. local AdminLogic = require("AdminLogic")
  634. local PlatformHandler = require("platform.Handler")
  635. local ApiLogic = require("platform.ApiLogic")
  636. local BuyExcel = require("excel.buy")
  637. local buyConf = BuyExcel.buy[val]
  638. if not buyConf then return end
  639. local shopConf = BuyExcel.topup[val]
  640. if shopConf and shopConf.buyID == val then
  641. else
  642. shopConf = nil
  643. end
  644. local checkMoney = buyConf["CN"]
  645. if human.phpChanelID and table.find(CommonDefine.SEA_CHANNEL_ARR, human.phpChanelID) then
  646. checkMoney = buyConf["US"]
  647. end
  648. local msg = {}
  649. msg.logintype = 2
  650. msg.openid = "oCD-L5RxAtfRe8-aiezdY-Ccla5U"
  651. msg.openkey = "VsBJf2DKah7QhzU5xuzLNA=="
  652. msg.yuanbao = shopConf and shopConf.cnt or buyConf.CN * 10
  653. msg.buyID = val
  654. msg.account = human.db.account
  655. msg.transaction_id = "transaction_id1"
  656. msg.pf = "android"
  657. msg.money = checkMoney
  658. ApiLogic.CHARGE_CODE_HIS = {}
  659. print("cccc:",val)
  660. local buyData = {buyID = val, price = checkMoney}
  661. BuyLogic.buy(human, buyData)
  662. --PlatformHandler.CG_TENCENT_BUY(human,msg)
  663. --AdminLogic.adminFunction.tencentPay(msg)
  664. end
  665. function d3.buyCharge(human, val)
  666. local BuyExcel = require("excel.buy")
  667. local buyConf = BuyExcel.buy[val]
  668. if not buyConf then
  669. return
  670. end
  671. local tOJsonInput = {}
  672. tOJsonInput.buyID = buyConf.id
  673. tOJsonInput.price = buyConf.CN
  674. tOJsonInput.money = buyConf.CN
  675. BuyLogic.charge(human, tOJsonInput)
  676. end
  677. function d3.gol(human)
  678. local AdminLogic = require("AdminLogic")
  679. AdminLogic.adminFunction.getonlinelist()
  680. end
  681. function d3.htm(human,val)
  682. local AdminLogic = require("AdminLogic")
  683. local oJsonInput = {}
  684. oJsonInput.recvType = val -- 邮件类型
  685. oJsonInput.title = "111" -- 邮件标题
  686. oJsonInput.content = "222" -- 邮件内容
  687. oJsonInput.items = nil -- 道具列表 可以为空
  688. oJsonInput.accounts = nil -- 指定玩家列表
  689. oJsonInput.startLv = 0
  690. oJsonInput.endLv = 200
  691. AdminLogic.adminFunction.mail(oJsonInput)
  692. end
  693. function d3.cluwar(human)
  694. require("union.UnionWarLogic").cleanUnionWar()
  695. local msg = InnerMsg.lw.LW_GM
  696. msg.gm = "cluwarmiddle"
  697. InnerMsg.sendMsg(0, msg)
  698. end
  699. function d3.cluniontime(human)
  700. human.db.unionJoinTime = nil
  701. end
  702. function d3.cluwarmiddle()
  703. local LuaMongo = _G.lua_mongo
  704. local DB = require("common.DB")
  705. LuaMongo.remove(DB.db_union_war)
  706. end
  707. function d3.uwarstart()
  708. -- 需要周1、3、5使用
  709. local UnionWarLogic = require("union.UnionWarLogic")
  710. UnionWarLogic.cleanUnionWar()
  711. local msg = InnerMsg.lw.LW_GM
  712. msg.gm = "cluwarmiddle"
  713. InnerMsg.sendMsg(0, msg)
  714. UnionWarLogic.onHour(0)
  715. UnionWarLogic.onHour(1)
  716. local msg = InnerMsg.lw.LW_GM
  717. msg.gm = "uwarstartmiddle"
  718. InnerMsg.sendMsg(0, msg)
  719. end
  720. function d3.warMaxtest(human, value)
  721. require("union.UnionWarLogic").auto(value)
  722. end
  723. function d3.uwar(human,state)
  724. local msg = InnerMsg.lw.LW_GM
  725. msg.gm = "muwar "..state
  726. InnerMsg.sendMsg(0, msg)
  727. if state == 1 then
  728. local UnionWarDBLogic = require("union.UnionWarDBLogic")
  729. UnionWarDBLogic.onHour(0, true)
  730. end
  731. end
  732. function d3.uwarshop(human, lv)
  733. require("union.UnionWarLogic").upWarShopLv(human, tonumber(lv))
  734. end
  735. function d3.uwarBuff(human)
  736. local msg = InnerMsg.lw.LW_GM
  737. msg.gm = "muwarBuff ".. human.db.unionUuid
  738. InnerMsg.sendMsg(0, msg)
  739. end
  740. function d3.muwar(human,state)
  741. local UnionWarDBLogic = require("union.UnionWarDBLogic")
  742. if state == 1 then
  743. UnionWarDBLogic.onHour(0, true)
  744. elseif state == 2 then
  745. UnionWarDBLogic.onHour(2, true)
  746. elseif state == 3 then
  747. UnionWarDBLogic.onHour(20, true)
  748. end
  749. end
  750. function d3.muwarBuff(human, unionUuid)
  751. local UnionWarDBLogic = require("union.UnionWarDBLogic")
  752. UnionWarDBLogic.addBuffLvByGm(unionUuid)
  753. end
  754. function d3.uwartask(human, type)
  755. local UnionWarLogic = require("union.UnionWarLogic")
  756. UnionWarLogic.chegnjiuFinishGm(human, tonumber(type))
  757. end
  758. function d3.uwarstartmiddle()
  759. -- 匹配
  760. require("union.UnionWarMiddleLogic").matchUnionStart()
  761. end
  762. function d3.cljjc(human, val)
  763. val = tonumber(val)
  764. local msgRet = InnerMsg.lw.LW_CL_JJC
  765. msgRet.type = val
  766. InnerMsg.sendMsg(0, msgRet)
  767. end
  768. function d3.cluwar(human)
  769. require("union.UnionWarLogic").cleanUnionWar()
  770. local msg = InnerMsg.lw.LW_GM
  771. msg.gm = "cluwarmiddle"
  772. InnerMsg.sendMsg(0, msg)
  773. end
  774. function d3.cluwarmiddle()
  775. local LuaMongo = _G.lua_mongo
  776. local DB = require("common.DB")
  777. LuaMongo.remove(DB.db_union_war)
  778. end
  779. function d3.uwarstart()
  780. -- 需要周1、3、5使用
  781. require("union.UnionWarLogic").onHour(0)
  782. require("union.UnionWarLogic").onHour(1)
  783. local msg = InnerMsg.lw.LW_GM
  784. msg.gm = "uwarstartmiddle"
  785. InnerMsg.sendMsg(0, msg)
  786. end
  787. function d3.uwarstartmiddle()
  788. -- 匹配
  789. require("union.UnionWarMiddleLogic").matchUnionStart()
  790. end
  791. function d3.cxh(human)
  792. d3.tgod(human)
  793. d3.lv(human,200)
  794. end
  795. function d3.drop(human,val)
  796. local BattleLogic = require("battle.BattleLogic")
  797. local param = Util.split(val, " ")
  798. local cnt = tonumber(param[1])
  799. local battleID = tonumber(param[2])
  800. BattleLogic.clacItemCntGM(human,cnt,battleID)
  801. end
  802. function d3.uif(human,val)
  803. local jsonInput = {}
  804. jsonInput.unionName = val
  805. local AdminLogic = require("AdminLogic")
  806. AdminLogic.adminFunction.unionInfo(jsonInput)
  807. end
  808. function d3.ul(human,val)
  809. local jsonInput = {}
  810. jsonInput.start = tonumber(val)
  811. local AdminLogic = require("AdminLogic")
  812. AdminLogic.adminFunction.unionList(jsonInput)
  813. end
  814. function d3.monthgaochou(human, val)
  815. local MonthSummon = require("monthAct.MonthSummon")
  816. MonthSummon.onSummon(human, tonumber(val))
  817. end
  818. function d3.jhtq(human,val)
  819. local TequanLogic = require("qqTequan.TequanLogic")
  820. local param = Util.split(val, " ")
  821. local val1 = tonumber(param[1])
  822. local val2 = tonumber(param[2])
  823. local val3 = tonumber(param[3])
  824. local val4 = tonumber(param[4])
  825. TequanLogic.activateTequan(human,val1,val2,val3,val4)
  826. end
  827. function d3.unionTecLv(human,val)
  828. local UnionTecLogic = require("union.UnionTecLogic")
  829. UnionTecLogic.lvAllUpByGm(human)
  830. end
  831. function d3.auto(human,val)
  832. local param = Util.split(val, " ")
  833. local str = param[1]
  834. local val = param[2]
  835. if not str or not val then
  836. return
  837. end
  838. for i = 1, val do
  839. require("union.UnionWarLogic").auto(str .. string.format("%02d", i))
  840. end
  841. end
  842. function d3.lvAuto(human, val)
  843. val = val + 0
  844. local lvOld = human.db.lv
  845. local lvNew = val + 0
  846. human.db.lv = lvNew
  847. end
  848. function d3.cap(human)
  849. human.db.buyCapCnt = require("hero.HeroDefine").BUY_CAP_CNT
  850. require("hero.HeroLogic").sendHeroBagCap(human)
  851. end
  852. function d3.abscharge(human)
  853. AbsBillboardLogic.charge(human,1000)
  854. end
  855. function d3.jhpt(human)
  856. if human.pf_info.pf == "qqgame" then
  857. human.db.txHall = {}
  858. elseif human.pf_info.pf == "qzone" or human.pf_info.pf == "website" then
  859. human.db.qqZone = {}
  860. end
  861. end
  862. function d3.addfuwen(human)
  863. d3.itemadd(human,"80001 10")
  864. d3.itemadd(human,"80002 10")
  865. d3.itemadd(human,"80003 10")
  866. d3.itemadd(human,"80004 10")
  867. d3.itemadd(human,"80005 10")
  868. end
  869. function d3.addSmelt(human,val)
  870. local num = tonumber(val)
  871. human.db.smeltVal = human.db.smeltVal or 0
  872. human.db.smeltVal = human.db.smeltVal + num
  873. end
  874. function d3.zdfw(human,val)
  875. local param = Util.split(val, " ")
  876. local fuwenID = tonumber(param[1])
  877. local attr1 = tonumber(param[2])
  878. local val1 = tonumber(param[3])
  879. local attr2 = tonumber(param[4])
  880. local val2 = tonumber(param[5])
  881. local skill1 = tonumber(param[6])
  882. local skill2 = tonumber(param[7])
  883. local FuwenGrid = require("fuwen.FuwenGrid")
  884. local FuwenExcel = require("excel.fuwen").skill
  885. if (skill1 ~= nil and FuwenExcel[skill1] == nil) or (skill2 ~= nil and FuwenExcel[skill2] == nil) then
  886. print("fuck! add fuwen skill is notreal")
  887. return
  888. end
  889. FuwenGrid.setFuwenSkillAttrByGM(human,fuwenID,attr1,val1,attr2,val2,skill1,skill2)
  890. end
  891. function d3.t2(human)
  892. 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"}}]]
  893. local ret = require("AdminLogic").handleAdminRequest(_, input)
  894. print(ret)
  895. end
  896. function d3.t1(human)
  897. local input = {}
  898. input.token = "fC283BD0141D50418B68200972FBEE6A13102"
  899. input.payitem = "39*60*1"
  900. input.billno = os.time()
  901. local ret = require("platform.QQApi").onDeliverReturnForBuy(input)
  902. print(ret.ret,ret.msg)
  903. end
  904. function d3.skin(human,val)
  905. local tb = Util.split(val, " ")
  906. local id = tonumber(tb[1])
  907. local cnt = tonumber(tb[2])
  908. print(id,tb[1],tb[2])
  909. if not id then
  910. human.db.skinBag = {[0] = 999}
  911. return
  912. end
  913. local SkinLogic = require("skin.SkinLogic")
  914. SkinLogic.addSkin(human,id,cnt)
  915. end
  916. function d3.ff(human,val)
  917. local FriendLogic = require("friend.FriendLogic")
  918. FriendLogic.addFriend(human, val)
  919. end
  920. function d3.chenghao(human,val)
  921. val = tonumber(val)
  922. if not val then
  923. return
  924. end
  925. local RoleHeadLogic = require("role.RoleHeadLogic")
  926. RoleHeadLogic.active(human, RoleHeadLogic.HEAD_TYPE_4, val)
  927. end
  928. function d3.unionBillboard(human,val)
  929. val = tonumber(val)
  930. if not val then
  931. return
  932. end
  933. local BRoleLogic = require("billboard.BRoleLogic")
  934. BRoleLogic.queryUnionBillboard(human,val)
  935. end
  936. function d3.herotest(human, val)
  937. local tb = Util.split(val, " ")
  938. local combatType = 1
  939. local HeroExcel = require("excel.hero")
  940. local HeroLogic = require("hero.HeroLogic")
  941. local flags = {}
  942. human.db.combatHero = human.db.combatHero or {}
  943. human.db.combatHero[combatType] = {}
  944. for pos = 1, 6 do
  945. local id = tonumber(tb[pos])
  946. local index = nil
  947. if id and HeroExcel.hero[id] then
  948. for i = 1, human.db.heroBag[0] do
  949. local heroGrid = human.db.heroBag[i]
  950. if heroGrid and (heroGrid.id == id) and
  951. (not flags[i]) then
  952. flags[i] = true
  953. index = i
  954. break
  955. end
  956. end
  957. if not index then
  958. index = HeroLogic.getEmptyIndex(human)
  959. d3.heroadd(human, id .. " 1")
  960. end
  961. end
  962. human.db.combatHero[combatType][pos] = index
  963. end
  964. local CombatHandler = require("combat.Handler")
  965. CombatHandler.CG_COMBAT_BEGIN(human,{type = combatType, param = ""})
  966. end
  967. function d3.combat(human, monsterOutID)
  968. local CombatLogic = require("combat.CombatLogic")
  969. local param = {}
  970. param.defender, _, param.defRBase, param.defFormation = CombatLogic.getMonsterObjList(monsterOutID)
  971. require("combat.CombatLogic").combatBegin(human, 1001, param, 1)
  972. end
  973. function d3.combat2(human,id)
  974. local id = tonumber(id)
  975. local combatConf = require("excel.combat").gm[id]
  976. if not combatConf then
  977. assert()
  978. end
  979. local HeroGrid = require("hero.HeroGrid")
  980. local HeroLogic = require("hero.HeroLogic")
  981. local CombatLogic = require("combat.CombatLogic")
  982. local fakeman1 = {}
  983. local account1 = "combatFakeman1"
  984. local fakeman2 = {}
  985. local account2 = "combatFakeman2"
  986. local RoleDBLogic = require("role.RoleDBLogic")
  987. local fakemanDB1 = RoleDBLogic.getDbByAccount(account1)
  988. if not fakemanDB1 then
  989. fakemanDB1 = RoleDBLogic.createDefaultRole(account1)
  990. end
  991. fakeman1.db = fakemanDB1
  992. local fakemanDB2 = RoleDBLogic.getDbByAccount(account2)
  993. if not fakemanDB2 then
  994. fakemanDB2 = RoleDBLogic.createDefaultRole(account2)
  995. end
  996. fakeman2.db = fakemanDB2
  997. local attacker = {}
  998. local defender = {}
  999. for i = 1, fakeman1.db.heroBag[0] do
  1000. HeroLogic.delHeroByIndex(fakeman1, i, "gm")
  1001. end
  1002. for i = 1, fakeman2.db.heroBag[0] do
  1003. HeroLogic.delHeroByIndex(fakeman2, i, "gm")
  1004. end
  1005. for k,v in ipairs(combatConf.atk) do
  1006. local heroGrid = HeroGrid.createHeroGrid(v[1], v[4])
  1007. heroGrid.lv = math.max(heroGrid.lv, v[3] or 0)
  1008. heroGrid.quality = HeroGrid.getMaxQuality(heroGrid.star)
  1009. local heroIndex = HeroLogic.addHeroByGrid(fakeman1, heroGrid, "gm")
  1010. attacker[v[2]] = CombatLogic.createHumanObj(fakeman1, heroGrid.uuid)
  1011. end
  1012. for k,v in ipairs(combatConf.def) do
  1013. local heroGrid = HeroGrid.createHeroGrid(v[1], v[4])
  1014. heroGrid.lv = math.max(heroGrid.lv, v[3] or 0)
  1015. heroGrid.quality = HeroGrid.getMaxQuality(heroGrid.star)
  1016. local heroIndex = HeroLogic.addHeroByGrid(fakeman2, heroGrid, "gm")
  1017. defender[v[2]] = CombatLogic.createHumanObj(fakeman2, heroGrid.uuid)
  1018. end
  1019. local atkPet = nil
  1020. local defPet = nil
  1021. CombatLogic.combatGm(human,1001,combatConf.atkF, attacker,combatConf.defF,defender,atkPet,defPet,{{101,1},{102,2},{103,3},{104,4}})
  1022. end
  1023. function d3.combatEnd(human)
  1024. local CombatLogic = require("combat.CombatLogic")
  1025. for i = CombatDefine.COMBAT_TYPE1, CombatDefine.COMBAT_TYPE_MAX do
  1026. CombatLogic.clientFinish(human, i)
  1027. end
  1028. end
  1029. -- it道具添加(支持中文)
  1030. function d3.it(human,value)
  1031. local tb = Util.split(value," ")
  1032. local id = tonumber(tb[1])
  1033. local cnt = tonumber(tb[2])
  1034. if id == nil then id = tb[1] end
  1035. if type(id) == "string" then
  1036. id = ItemDefine.getIdByName(id)
  1037. end
  1038. if type(id) ~= "number" then
  1039. print("err id", tb[1], id, type(id))
  1040. return
  1041. end
  1042. cnt = cnt or 1000
  1043. BagLogic.addItem(human, id, cnt, "gm")
  1044. end
  1045. -- 清除酒馆
  1046. function d3.clbartask(human)
  1047. human.db.bar = nil
  1048. end
  1049. function d3.updaily(human)
  1050. ObjHuman.updateDaily(human, true)
  1051. end
  1052. -- 模拟跨月,重置月累充等跨月数据
  1053. function d3.kuayue(human)
  1054. local oldMonthTopup = human.db.topupAccountMonth or 0
  1055. local t = os.date("*t")
  1056. t.month = t.month - 1
  1057. if t.month <= 0 then
  1058. t.month = 12
  1059. t.year = t.year - 1
  1060. end
  1061. human.db.update_daily_time = os.time(t)
  1062. -- 跨月重置月累充,与 ObjHuman.updateDaily 保持一致
  1063. if human.db.update_daily_time and Util.isSameMonth(human.db.update_daily_time) ~= true then
  1064. human.db.topupAccountMonth = nil
  1065. end
  1066. ObjHuman.updateDaily(human, true)
  1067. local AgeLimitLogic = require("topup.AgeLimitLogic")
  1068. if human.fd then
  1069. AgeLimitLogic.query(human)
  1070. end
  1071. send(human, string.format("跨月成功,月累充 %d -> %d", oldMonthTopup, human.db.topupAccountMonth or 0))
  1072. end
  1073. function d3.clguide(human)
  1074. human.db.noguide = nil
  1075. human.db.guide = nil
  1076. human.guideLoginStep = nil
  1077. require("guide.GuideLogic").refreshGuide(human)
  1078. require("guide.GuideLogic").sendStep(human)
  1079. end
  1080. function d3.nextguide(human)
  1081. local GuideExcel = require("excel.guide")
  1082. local GuideLogic = require("guide.GuideLogic")
  1083. local id = GuideLogic.getGuideID(human)
  1084. local nextstep = GuideLogic.getGuideStep(human) + 1
  1085. local cf = id and GuideExcel.main_guide[id]
  1086. local sid = cf and cf.guideList[nextstep]
  1087. GuideLogic.stepFinish(human, sid)
  1088. end
  1089. function d3.guide(human, id)
  1090. human.db.noguide = nil
  1091. human.guideLoginStep = nil
  1092. local GuideLogic = require("guide.GuideLogic")
  1093. GuideLogic.setGuide(human, id, GuideLogic.STATE_DOING)
  1094. GuideLogic.sendStep(human)
  1095. end
  1096. -- 跳过指引
  1097. function d3.noguide(human)
  1098. human.db.noguide = true
  1099. human.guideLoginStep = nil
  1100. require("guide.GuideLogic").sendStep(human, true)
  1101. end
  1102. function d3.creatunion(human,value)
  1103. d3.lv(human,30)
  1104. d3.viplv(human,2)
  1105. d3.zuanshi(human, 1000)
  1106. local UnionLogic = require("union.UnionLogic")
  1107. UnionLogic.createUnion(human, value)
  1108. end
  1109. function d3.cldraw(human, value)
  1110. human.db.drawCard = {jifen=tonumber(value),list={[1]={},[2]={},[3]={},[4]={}}}
  1111. end
  1112. function d3.cldrill(human)
  1113. require("drill.DrillDB").reset()
  1114. end
  1115. function d3.zhengdian(_, hour)
  1116. hour = tonumber(hour) or 0
  1117. require("core.Timer").doZhengDian(hour)
  1118. end
  1119. function d3.tgod(human)
  1120. local HeroLogic = require("hero.HeroLogic")
  1121. local HeroGrid = require("hero.HeroGrid")
  1122. local HeroExcel = require("excel.hero")
  1123. for heroID, config in pairs(HeroExcel.tujian) do
  1124. local heroConfig = HeroExcel.hero[heroID]
  1125. if heroConfig then
  1126. local star = heroConfig.star
  1127. local maxQuality = HeroGrid.getMaxQuality(star)
  1128. local maxLv = HeroGrid.getMaxLv(star,maxQuality)
  1129. d3.heroadd(human, heroID .. " 1".." "..maxLv.." "..maxQuality)
  1130. end
  1131. end
  1132. end
  1133. function d3.tujian(human, camp)
  1134. local HeroExcel = require("excel.hero")
  1135. camp = tonumber(camp)
  1136. for heroID, config in pairs(HeroExcel.tujian) do
  1137. if config.camp == camp or not camp then
  1138. d3.heroadd(human, heroID .. " 1")
  1139. end
  1140. end
  1141. end
  1142. function d3.cljingcailibao(human)
  1143. human.db.dailyLeiChong = nil
  1144. human.db.leichongHaoli = nil
  1145. human.db.topupAcountDaily = nil
  1146. human.db.topupAccountMonth = nil
  1147. end
  1148. function d3.qijifen(human,value)
  1149. human.db.sevenDayGoal = human.db.sevenDayGoal or {}
  1150. human.db.sevenDayGoal[9] = human.db.sevenDayGoal[8] or {}
  1151. human.db.sevenDayGoal[9].jifen = value
  1152. end
  1153. function d3.clqirimubiao(human)
  1154. human.db.sevenDayGoal = nil
  1155. end
  1156. function d3.throne(human, str)
  1157. if str == nil then return end
  1158. local tb = Util.split(str, " ")
  1159. local id = tonumber(tb[1])
  1160. local lv = tonumber(tb[2])
  1161. if not id or not lv then return end
  1162. local TheStarsDBLogic = require("theStars.TheStarsDBLogic")
  1163. local list = TheStarsDBLogic.getThroneList()
  1164. local throne = list[id]
  1165. if not throne then return end
  1166. throne.lv = lv
  1167. TheStarsDBLogic.updateThroneDB(throne)
  1168. end
  1169. function d3.cltsts(human)
  1170. human.db.throneTime = human.db.throneTime - 14400
  1171. end
  1172. -- 删号
  1173. function d3.delaccount(human, account)
  1174. if not account then return end
  1175. local target = ObjHuman.onlineAccount[account]
  1176. if target then
  1177. return Broadcast.sendErr(human, "can't delete online")
  1178. end
  1179. local RoleDBLogic = require("role.RoleDBLogic")
  1180. if not RoleDBLogic.getDbByAccount(account) then
  1181. return Broadcast.sendErr(human, "account not exist")
  1182. end
  1183. local LuaMongo = _G.lua_mongo
  1184. local DB = require("common.DB")
  1185. local query = {}
  1186. query.account = tostring(account)
  1187. LuaMongo.remove(DB.db_char, query)
  1188. require("core.RoleDel").roleDel()
  1189. Broadcast.sendErr(human, "delete ok, account = " .. account)
  1190. end
  1191. -- 临时开指引
  1192. function d3.openguide()
  1193. require("Config").HAS_GUIDE = true
  1194. end
  1195. function d3.closeguide()
  1196. require("Config").HAS_GUIDE = false
  1197. end
  1198. -- 自动上阵
  1199. function d3.autoteam(human, combatType)
  1200. if tonumber(combatType) == nil then return end
  1201. local CombatPosLogic = require("combat.CombatPosLogic")
  1202. local str = ""
  1203. for i = 1, 6 do
  1204. if not human.db.heroBag[i] then
  1205. local heroID = require("hero.HeroDefine").getRandHeroByIsElite()
  1206. local lv = math.random(50, 100)
  1207. d3.heroadd(human, heroID .. " 1 " .. lv)
  1208. end
  1209. str = str .. i
  1210. if i % 6 == 0 then str = str .. ","
  1211. else str = str .. "|" end
  1212. end
  1213. CombatPosLogic.updatePos(human,combatType,str)
  1214. end
  1215. function d3.fcmstate(human, state)
  1216. human.fcmState = state
  1217. require("fcm.FcmLogic").checkFcm(human)
  1218. end
  1219. function d3.oltimeday(human, time)
  1220. time = tonumber(time)
  1221. if not time then return end
  1222. human.db.onlineTimeDay = time
  1223. require("fcm.FcmLogic").checkFcm(human)
  1224. end
  1225. function d3.dis(human, code)
  1226. ObjHuman.doDisconnect(human, code)
  1227. end
  1228. function d3.project(human)
  1229. local Lang = require("common.Lang")
  1230. Broadcast.sendErr(human, Lang.TEST_MULTY_PROJECT)
  1231. end
  1232. function d3.clextrabattle(human)
  1233. human.db.battleExtraReward = nil
  1234. end
  1235. function d3.clsharepf(human)
  1236. human.db.plShare = nil
  1237. end
  1238. function d3.clshareboard()
  1239. require("present.SharePlatformLogic").resetBoard()
  1240. end
  1241. function d3.sharepfall(human, cnt)
  1242. cnt = tonumber(cnt) or 15
  1243. for i = 1, cnt do
  1244. require("present.SharePlatformLogic").onShareOk(human.db.account, "account" .. i, true)
  1245. end
  1246. end
  1247. function d3.sharepf(human, accountB)
  1248. require("present.SharePlatformLogic").onShareOk(human.db.account, accountB)
  1249. end
  1250. function d3.sharepf2(human, accountA)
  1251. require("present.SharePlatformLogic").onShareOk(accountA, human.db.account)
  1252. end
  1253. function d3.sharegroup(human)
  1254. require("present.SharePlatformLogic").groupShareOK(human)
  1255. end
  1256. function d3.shareinvate(human)
  1257. require("present.SharePlatformLogic").shareInvate(human)
  1258. end
  1259. function d3.cltuisonglibao(human)
  1260. human.db.tuiSongLiBao = nil
  1261. end
  1262. function d3.clmoshou(human)
  1263. human.db.moshou = nil
  1264. end
  1265. function d3.moshoulv(human,lv)
  1266. local MoShouExcel = require("excel.moshou")
  1267. if not lv or lv <= 0 or lv > #MoShouExcel.moshouLv then return end
  1268. local MoshouLogic = require("moshou.MoshouLogic")
  1269. local isAllActive = MoshouLogic.isAllMoshouActive(human)
  1270. if not isAllActive then
  1271. local MoShouExcel = require("excel.moshou")
  1272. local config = MoShouExcel.moshouActive
  1273. for i=1,#config do
  1274. local activeTask = config[i].activeTask
  1275. for j=1,#activeTask do
  1276. human.db.moshou = human.db.moshou or {}
  1277. human.db.moshou[i] = human.db.moshou[i] or {}
  1278. human.db.moshou[i].taskGet = human.db.moshou[i].taskGet or {}
  1279. human.db.moshou[i].taskGet[j] = j
  1280. end
  1281. end
  1282. end
  1283. human.db.moshou.lv = lv
  1284. human.db.moshou.lvExp = MoShouExcel.moshouLv[lv].needJinDu
  1285. human.db.moshou.skillLV = human.db.moshou.skillLV or 1
  1286. MoshouLogic.calMoshouHero(human)
  1287. end
  1288. function d3.activemoshou(human,moshouID)
  1289. if not moshouID or moshouID <= 0 then return end
  1290. local MoShouExcel = require("excel.moshou")
  1291. local config = MoShouExcel.moshouActive
  1292. for i=1,moshouID do
  1293. local activeTask = config[i].activeTask
  1294. for j=1,#activeTask do
  1295. human.db.moshou = human.db.moshou or {}
  1296. human.db.moshou[i] = human.db.moshou[i] or {}
  1297. human.db.moshou[i].taskGet = human.db.moshou[i].taskGet or {}
  1298. human.db.moshou[i].taskGet[j] = j
  1299. end
  1300. end
  1301. if moshouID == #config then
  1302. d3.moshoulv(human,1)
  1303. end
  1304. local MoshouLogic = require("moshou.MoshouLogic")
  1305. MoshouLogic.calMoshouHero(human)
  1306. end
  1307. function d3.moshouupneed(human)
  1308. local MoShouExcel = require("excel.moshou")
  1309. local lvUpNeed1 = MoShouExcel.moshouLv[2].lvUpNeed[1][1]
  1310. local lvUpNeed2 = MoShouExcel.moshouLv[2].lvUpNeed[2][1]
  1311. d3.it(human,lvUpNeed1)
  1312. d3.it(human,lvUpNeed2)
  1313. local jingLianUp1 = MoShouExcel.moshouJingLian[2].lvUpNeed[1][1]
  1314. local jingLianUp2 = MoShouExcel.moshouJingLian[2].lvUpNeed[2][1]
  1315. d3.it(human,jingLianUp1)
  1316. d3.it(human,jingLianUp2)
  1317. local zhuhunUp = MoShouExcel.moshouZhuHun[1].costID
  1318. d3.it(human,zhuhunUp)
  1319. local skillup1 = MoShouExcel.moshouSkillLv[2].upCost[1][1]
  1320. local skillup2 = MoShouExcel.moshouSkillLv[2].upCost[2][1]
  1321. d3.it(human,skillup1)
  1322. d3.it(human,skillup2)
  1323. end
  1324. function d3.moshoujinglian(human,val)
  1325. if not human.db.moshou then return end
  1326. human.db.moshou.jingLian = val
  1327. end
  1328. function d3.clolinereward(human)
  1329. require("onlineReward.OnlineRewardLogic").initDB(human)
  1330. end
  1331. function d3.clonlinerewardget(human)
  1332. human.db.onlineReward.getId = 0
  1333. end
  1334. function d3.bartaskfinish(human)
  1335. local BarTaskLogic = require("bar.BarTaskLogic")
  1336. BarTaskLogic.initDB(human)
  1337. for taskID, taskData in pairs(human.db.bar) do
  1338. if type(taskID) == "number" then
  1339. human.db.bar[taskID].ts = 0
  1340. end
  1341. end
  1342. end
  1343. function d3.test(human)
  1344. 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)
  1345. Broadcast.sendErr(human, str)
  1346. print(str)
  1347. end
  1348. function d3.clbattle()
  1349. local DB = require("common.DB")
  1350. local LuaMongo = _G.lua_mongo
  1351. LuaMongo.remove(DB.db_battle_shark)
  1352. end
  1353. -- 设置天梯争霸状态
  1354. function d3.jjcladderstart()
  1355. local JjcLadderLogic = require("jjcLadder.JjcLadderLogic")
  1356. local JjcLadderExcel = require("excel.jjcLadder")
  1357. local JjcLadderDefine = JjcLadderExcel.define[1]
  1358. JjcLadderLogic.onActReady()
  1359. local week = Util.getWeekDay(os.time()) - 1
  1360. if week == 0 then
  1361. week = 7
  1362. end
  1363. JjcLadderLogic.TEMP_TIMER_STAMPTIME = nil
  1364. JjcLadderDefine.startTime.week = week
  1365. JjcLadderDefine.endTime.week = week + 1
  1366. JjcLadderLogic.onTimer()
  1367. local msg = InnerMsg.lw.LW_GM
  1368. msg.gm = "jjcladderstartmiddle"
  1369. InnerMsg.sendMsg(0, msg)
  1370. end
  1371. function d3.jjcladderstartmiddle()
  1372. local JjcLadderLogic = require("jjcLadder.JjcLadderLogic")
  1373. local JjcLadderExcel = require("excel.jjcLadder")
  1374. local JjcLadderDefine = JjcLadderExcel.define[1]
  1375. JjcLadderLogic.onActReady()
  1376. local week = Util.getWeekDay(os.time()) - 1
  1377. if week == 0 then
  1378. week = 7
  1379. end
  1380. JjcLadderLogic.TEMP_TIMER_STAMPTIME = nil
  1381. JjcLadderDefine.startTime.week = week
  1382. JjcLadderDefine.endTime.week = week + 1
  1383. JjcLadderLogic.onTimer()
  1384. end
  1385. -- 天梯争霸报错
  1386. function d3.jjcladdersign(human)
  1387. local JjcLadderLogic = require("jjcLadder.JjcLadderLogic")
  1388. if JjcLadderLogic.getState() == JjcLadderLogic.STATE_ACT_START then
  1389. local commonDB = JjcLadderLogic.getCommonDB()
  1390. commonDB.uuid2sign = commonDB.uuid2sign or {}
  1391. commonDB.uuid2sign[human.db._id] = os.time()
  1392. JjcLadderLogic.saveCommonDB(commonDB)
  1393. JjcLadderLogic.onUpdatePos(human)
  1394. end
  1395. end
  1396. -- 天梯争霸结束回调
  1397. function d3.jjcladderend()
  1398. local JjcLadderLogic = require("jjcLadder.JjcLadderLogic")
  1399. JjcLadderLogic.onActEnd()
  1400. local msg = InnerMsg.lw.LW_GM
  1401. msg.gm = "jjcladderendmiddle"
  1402. InnerMsg.sendMsg(0, msg)
  1403. end
  1404. function d3.jjcladderendmiddle()
  1405. local JjcLadderLogic = require("jjcLadder.JjcLadderLogic")
  1406. JjcLadderLogic.onActEnd()
  1407. end
  1408. -- 重置天梯争霸活动信息
  1409. function d3.cljjcladder()
  1410. local JjcLadderLogic = require("jjcLadder.JjcLadderLogic")
  1411. JjcLadderLogic.saveCommonDB()
  1412. JjcLadderLogic.onActEnd()
  1413. local msg = InnerMsg.lw.LW_GM
  1414. msg.gm = "cljjcladdermiddle"
  1415. InnerMsg.sendMsg(0, msg)
  1416. end
  1417. function d3.cljjcladdermiddle()
  1418. local JjcLadderLogic = require("jjcLadder.JjcLadderLogic")
  1419. JjcLadderLogic.saveCommonDB()
  1420. JjcLadderLogic.onActEnd()
  1421. end
  1422. function d3.clcombat(human,val)
  1423. human.db.combatHero[val] = nil
  1424. end
  1425. function d3.clshop(human,val)
  1426. human.db.shop[val] = nil
  1427. end
  1428. -- 重置日常礼包
  1429. function d3.clrichanglibao(human)
  1430. human.db.richangLibao = nil
  1431. end
  1432. -- 重置荣耀峡谷(龙族战场)
  1433. function d3.clvalley()
  1434. local ValleyLogic = require("valley.ValleyLogic")
  1435. ValleyLogic.cleanDB()
  1436. local msg = InnerMsg.lw.LW_GM
  1437. msg.gm = "clvalleymiddle"
  1438. InnerMsg.sendMsg(0, msg)
  1439. end
  1440. function d3.clvalleymiddle()
  1441. local ValleyLogic = require("valley.ValleyLogic")
  1442. ValleyLogic.cleanDB()
  1443. end
  1444. -- 重置荣耀峡谷(龙族战场)成就
  1445. function d3.clvalleytask(human)
  1446. human.db.valleyTask = nil
  1447. end
  1448. -- 增加荣耀峡谷(龙族战场)个人成就值
  1449. function d3.valleytask1(human, value)
  1450. require("valley.ValleyTask").updateValue(human.db._id, value, 0)
  1451. end
  1452. -- 增加荣耀峡谷(龙族战场)团队成就值
  1453. function d3.valleytask2(human, value)
  1454. require("valley.ValleyTask").updateValue(human.db._id, 0, value)
  1455. end
  1456. function d3.touchLv(human,val)
  1457. local liveness = val + 0
  1458. require("union.UnionLivenessLogic").touchLv(human, liveness)
  1459. end
  1460. function d3.clyj()
  1461. local DB = require("common.DB")
  1462. local LuaMongo = _G.lua_mongo
  1463. LuaMongo.remove(DB.db_yjTreasure)
  1464. local YjTreasureDBLogic = require("yjTreasure.YjTreasureDB")
  1465. YjTreasureDBLogic.YJ_TREASURE_DB = {}
  1466. end
  1467. function d3.yjlayer(human,val)
  1468. local YjTreasureLogic = require("yjTreasure.YjTreasureLogic")
  1469. local YjTreasureDBLogic = require("yjTreasure.YjTreasureDB")
  1470. local YjTreasureExcel = require("excel.yjTreasure")
  1471. local Lang = require("common.Lang")
  1472. local layerData = YjTreasureDBLogic.getLayerDataByUuid(human.db._id)
  1473. local layCnf = YjTreasureExcel.layer
  1474. local nowLayer = layerData.layer
  1475. if val > #layCnf then return Broadcast.sendErr(human,Lang.YJTREASURE_LAYER_ERR) end
  1476. local roleData = YjTreasureDBLogic.getRoleDataByUuid(human.db._id)
  1477. local layerMax = roleData.layerMax or 0
  1478. if layerMax < val then
  1479. roleData.layerMax = val
  1480. YjTreasureDBLogic.updateRoleDataByUuid(roleData,human.db._id)
  1481. end
  1482. YjTreasureDBLogic.creatLayerDataByUuid(human.db._id,val)
  1483. YjTreasureLogic.CG_YJTREASURE_QUERY(human)
  1484. end
  1485. function d3.towerKing(human)
  1486. local HuanJingTowerLogic = require("huanjingTower.HuanjingTowerLogic")
  1487. HuanJingTowerLogic.unlockTowerKing(human)
  1488. end
  1489. -- 设置炼狱最大通关层
  1490. function d3.lianyu(human, value)
  1491. value = tonumber(value)
  1492. if not value then return end
  1493. if value < 0 then return end
  1494. local LianyuExcel = require("excel.lianyu")
  1495. if value > 0 and not LianyuExcel.gamelevel[value] then
  1496. return
  1497. end
  1498. LianyuLogic = require("lianyu.LianyuLogic")
  1499. LianyuLogic.setMaxLv(human, value)
  1500. end
  1501. function d3.cllianyu(human)
  1502. human.db.lianyu = nil
  1503. end
  1504. function d3.cllianyuhelp()
  1505. local CommonDB = require("common.CommonDB")
  1506. CommonDB.updateValue(CommonDB.KEY_LIANYU, nil)
  1507. end
  1508. -- 清除特权商店相关信息
  1509. function cltequanshop(human)
  1510. human.db.tequanShop = nil
  1511. human.db.tequanMopup = nil
  1512. if human.db.bar then
  1513. human.db.bar.vip = nil
  1514. human.db.bar.surVip = nil
  1515. end
  1516. end
  1517. function d3.addbts(human)
  1518. local now = os.time()
  1519. require("battle.BattleLogic").initBattleOut(human, now)
  1520. human.db.battleOut.expTs1 = now - 7200
  1521. human.db.battleOut.itemTs1 = now - 7200
  1522. human.db.battleOut.expTs2 = now - 7200
  1523. human.db.battleOut.itemTs2 = now - 7200
  1524. end
  1525. function d3.addbsd(human)
  1526. human.db.mopupDoCnt = 0
  1527. human.db.mopupFreeCnt = 0
  1528. end
  1529. function d3.addYjYj(human,type)
  1530. local YjTreasureLogic = require("yjTreasure.YjTreasureLogic")
  1531. YjTreasureLogic.yjYaoJiAdd(human,10,type)
  1532. end
  1533. function d3.ajfc(human,val)
  1534. for i = 1,val do
  1535. human.db.jjcDailyFight = (human.db.jjcDailyFight or 0) + 1
  1536. require("jjc.JjcDB").updateTotalFight(human.db._id)
  1537. end
  1538. end
  1539. function d3.godWartest(human)
  1540. local JjcGodWarLogic = require("jjcGodWar.JjcGodWarLogic")
  1541. JjcGodWarLogic.jjcGodWarFinishGm(human)
  1542. end
  1543. function d3.closeMiddle(human)
  1544. MiddleConnect.stopConnectMiddle()
  1545. end
  1546. function d3.resetMiddle(human)
  1547. MiddleConnect.autoResetMiddle()
  1548. end
  1549. function d3.loginSign(human, value)
  1550. value = tonumber(value)
  1551. local LoginSignLogic = require("loginSign.LoginSignLogic")
  1552. LoginSignLogic.updateGM(human, value)
  1553. end
  1554. function d3.yuanjun(human, value)
  1555. human.db.combatBackup = 1
  1556. end
  1557. function d3.buyItem(human, value)
  1558. require("shop.ShopLogic").buy(human, 9, 405007, 1, 1)
  1559. end
  1560. function d3.test1(human)
  1561. require("absAct.MangHeLogic").draw(human, 1)
  1562. end
  1563. function d3.zbsj(human,val)
  1564. if human.db.zhanbu == nil then
  1565. return
  1566. end
  1567. human.db.zhanbu.money = val
  1568. end
  1569. function d3.tjm(human)
  1570. require("present.RelationGiftLogic").relationBind(human, "017772140001")
  1571. end
  1572. function d3.qcjz(human)
  1573. human.db.unionDonate = nil
  1574. end
  1575. function d3.unionCopyLv(human, val)
  1576. require("union.UnionEctypeLogic").toUnionBossLvGm(human, tonumber(val))
  1577. end
  1578. function d3.fff(human)
  1579. human.db.leaveUnionLimit = nil
  1580. end
  1581. function d3.hgw(args)
  1582. require("absAct.HeroGrowUp").actLoop()
  1583. end
  1584. function d3.hgwlv(human,val)
  1585. require("absAct.HeroGrowUp").addJifen(human,tonumber(val))
  1586. end
  1587. function d3.paoma(human, val)
  1588. require("chat.ChatPaoMaLogic").notice(val)
  1589. end
  1590. -- 设置合服时间
  1591. function d3.merge(human,value)
  1592. value = value and tonumber(value)
  1593. if value == nil then
  1594. local mergeSvrTime = CommonDB.getMergeServerTime()
  1595. if mergeSvrTime == 0 then
  1596. Broadcast.sendErr(human, "未设置合服时间")
  1597. else
  1598. local tb = os.date("%Y%m%d", mergeSvrTime)
  1599. Broadcast.sendErr(human, "当前合服时间为" .. tb)
  1600. end
  1601. else
  1602. local now = os.time()
  1603. local temp = Util.getDayStartTime(now)
  1604. temp = temp - (value - 1) * 24 * 3600
  1605. CommonDB.setMergeTime(temp)
  1606. local tb = os.date("%Y%m%d", temp)
  1607. Broadcast.sendErr(human, "设置当前合服时间为" .. tb)
  1608. --同步中心服开服时间
  1609. --[[local msgRet = InnerMsg.lw.LW_OS
  1610. msgRet.uuid = human.db._id
  1611. msgRet.value = temp
  1612. InnerMsg.sendMsg(0, msgRet)]]
  1613. end
  1614. end
  1615. -- 设置战斗界面挂机时间
  1616. function d3.guaji(human,value)
  1617. value = value and tonumber(value)
  1618. local gmFuc = require("battle.BattleLogic").gmSetHangTime
  1619. gmFuc(human, value)
  1620. end
  1621. function d3.resetweek(human)
  1622. WeekendLoopActManger.GMResetWeekAct(human)
  1623. end
  1624. function d3.savedb(human)
  1625. ObjHuman.GM_SaveDB(human)
  1626. end
  1627. ------种族试炼------------
  1628. ---开启某个种族的试炼,value为种族
  1629. function d3.zzkq(human, value)
  1630. local RacialTrialLogic = require("racialTrial.RacialTrialLogic")
  1631. RacialTrialLogic.GmOpenTrial(human, value)
  1632. end
  1633. --某个种族关卡的跳关
  1634. function d3.zztg(human, value)
  1635. local pos = string.find(value, " ", 1, true)
  1636. if pos == nil then return end
  1637. local camp = tonumber(string.sub(value, 1, pos - 1))
  1638. local levelCnt = tonumber(string.sub(value,pos+1,#value))
  1639. local RacialTrialLogic = require("racialTrial.RacialTrialLogic")
  1640. RacialTrialLogic.GmSetlevel(human, camp, levelCnt)
  1641. end
  1642. --z增加某个种族关卡的每日奖励次数
  1643. function d3.zzjl(human, value)
  1644. local pos = string.find(value, " ", 1, true)
  1645. if pos == nil then return end
  1646. local camp = tonumber(string.sub(value, 1, pos - 1))
  1647. local levelCnt = tonumber(string.sub(value,pos+1,#value))
  1648. local RacialTrialLogic = require("racialTrial.RacialTrialLogic")
  1649. RacialTrialLogic.GmAddDailyAwardCnt(human, camp, levelCnt)
  1650. end
  1651. ------------秘宝---------------------
  1652. --设置某个秘宝的等级
  1653. function d3.mblv(human, value)
  1654. local pos = string.find(value, " ", 1, true)
  1655. if pos == nil then return end
  1656. local id = tonumber(string.sub(value, 1, pos - 1))
  1657. local level = tonumber(string.sub(value,pos+1,#value))
  1658. local TalismanLogic = require("talisman.TalismanLogic")
  1659. TalismanLogic.GmSetlevel(human, id, level)
  1660. end
  1661. function d3.delZR(human)
  1662. RecommendLineup.RecommendLineup_GMClear()
  1663. end
  1664. function d3.clearnewcharge(human)
  1665. NewFirstCharge.NewFirstCharge_GMClear(human)
  1666. end
  1667. --战令增加进度
  1668. function d3.zljd(human, value)
  1669. local pos = string.find(value, " ", 1, true)
  1670. if pos == nil then return end
  1671. local orderType = tonumber(string.sub(value, 1, pos - 1))
  1672. local cnt = tonumber(string.sub(value,pos+1,#value))
  1673. local WarOrder = require("shop.WarOrder")
  1674. WarOrder.warOrderUnlock(human,orderType)
  1675. WarOrder.trigger(human, orderType, cnt)
  1676. end
  1677. -- 删除数据
  1678. function d3.delActPower(human)
  1679. ActPowerUp.ActPowerUp_GMClear(human)
  1680. end
  1681. function d3.delSevenDayCard(human, id)
  1682. FestivalSevenDayCardLogic.SEVENDAYCARD_GMCLEAR(human, id)
  1683. end
  1684. function d3.delTreasure(human)
  1685. TreasureChestLogic.TreasureChestLogic_GmClear(human)
  1686. end
  1687. --新商业活动——秘境翻牌, value > 0 表示该活动抽卡时使用GM模式
  1688. function d3.chouka(human, value)
  1689. value = tonumber(value)
  1690. local AbsLotteryCardLogic = require("absAct.AbsLotteryCardLogic")
  1691. AbsLotteryCardLogic.SetMode(value)
  1692. end
  1693. --事件GM,设置某个事件进度
  1694. function d3.czhl(human, value)
  1695. local pos = string.find(value, " ", 1, true)
  1696. if pos == nil then return end
  1697. local triggerId = tonumber(string.sub(value, 1, pos - 1))
  1698. local progress = tonumber(string.sub(value,pos+1,#value))
  1699. local AbsExcellentGiftLogic = require("absAct.AbsExcellentGiftLogic")
  1700. AbsExcellentGiftLogic.TriggerCbFunc(human, triggerId, progress, true)
  1701. end
  1702. -- 清空玩家加成时间
  1703. function d3.delBonusTime(human)
  1704. if not human or not human.db then
  1705. Log.write("GM_ERROR", "delBonusTime: invalid human object")
  1706. return
  1707. end
  1708. CommonDB.setFireWorkBonusTime(0)
  1709. end
  1710. function d3.writeLog(human)
  1711. MaiDianLogic.MaiDianLogic_GM()
  1712. end
  1713. ------专属武器--------------
  1714. function d3.wlv(human, value)
  1715. local pos = string.find(value, " ", 1, true)
  1716. if pos == nil then return end
  1717. local heroId = tonumber(string.sub(value, 1, pos - 1))
  1718. local level = tonumber(string.sub(value,pos+1, #value))
  1719. local HeroExclusiveWeapon = require("hero.HeroExclusiveWeapon")
  1720. HeroExclusiveWeapon.GmSetHeroWeaponLv(human, heroId, level)
  1721. end
  1722. -- 清理跨服商业活动个人数据
  1723. function d3.ClearCommerce(human)
  1724. CommerceManger.CommerveManager_GMClear(human)
  1725. end
  1726. function d3.CSAHumanPoint(human, nAddNum)
  1727. CommerceManger.CommerveManager_GMAddHumanPoint(human, nAddNum)
  1728. end
  1729. function d3.CSAServerPoint(human, nAddNum)
  1730. CommerceManger.CommerveManager_AddServerPoint(nAddNum)
  1731. end
  1732. function d3.CSSendMail(human)
  1733. CommerceManger.CommerveManager_SendMail()
  1734. end
  1735. function d3.CSARest(human)
  1736. CommerceManger.CommerveManager_GMRest(human)
  1737. end
  1738. function d3.CSARestCommon(human)
  1739. CommerceManger.CommerveManager_GMRestCommonDB()
  1740. end
  1741. function d3.CSAClearMiddleMail(human)
  1742. CommerceManger.CommerveManager_GMClearMiddleMail()
  1743. end
  1744. function d3.clearRelic(human)
  1745. for i = 1, human.db.heroBag[0] do
  1746. local heroGrid = human.db.heroBag[i]
  1747. if heroGrid and heroGrid.relic and heroGrid.relic.relicID then
  1748. heroGrid.relic = {}
  1749. end
  1750. end
  1751. human.db.relicListData = {}
  1752. end
  1753. function d3.equipRelic(human, heroID, heroIdx, relicId, operate)
  1754. -- 参数校验
  1755. if not heroID then
  1756. return Broadcast.sendErr(human, "参数错误,格式:/gm equipRelic [英雄ID] ")
  1757. end
  1758. if not heroIdx then
  1759. return Broadcast.sendErr(human, "参数错误,格式:/gm equipRelic [英雄索引] ")
  1760. end
  1761. if not relicId then
  1762. return Broadcast.sendErr(human, "参数错误,格式:/gm equipRelic [遗物ID] ")
  1763. end
  1764. if not operate then
  1765. return Broadcast.sendErr(human, "参数错误,格式:/gm equipRelic [0=卸下|1=装备] ")
  1766. end
  1767. -- 模拟客户端协议结构
  1768. local tMsgData = {
  1769. heroID = heroID,
  1770. heroIdx = heroIdx,
  1771. relicId = relicId,
  1772. operate = operate
  1773. }
  1774. -- 调用原有处理逻辑(假设你已有处理函数)
  1775. local oldData, newData = winner.EquipeandRemove(human, tMsgData.heroID, tMsgData.heroIdx, tMsgData.relicId, tMsgData.operate)
  1776. end
  1777. --周任务和荣耀历程访问接口---
  1778. function d3.weekTask(human)
  1779. local d= week.WeekTaskQuery(human)
  1780. end
  1781. function d3.weekHonorJourney(human)
  1782. local d= honor.HonorJourneyTaskQuery(human)
  1783. end
  1784. function d3.honorclear(human)
  1785. honor.HonorJourney_GMClear(human)
  1786. end
  1787. function d3.weekreward(human)
  1788. local d= week.weekTaskGetReward(human)
  1789. end
  1790. function d3.weekhuoyue(human)
  1791. local d= week.CG_WEEKTASK_GET_HUOYUEBOX(human)
  1792. end
  1793. function d3.dayhuoyue(human)
  1794. local d= day.CG_DAILYTASK_GET_HUOYUEBOX(human)
  1795. end
  1796. function d3.honorcaddpoint(human, nAddNum)
  1797. honor.HonorJourney_GMAddPoint(human, nAddNum)
  1798. end
  1799. function d3.dayreward(human)
  1800. local d= day.dailyTaskGetReward(human)
  1801. end
  1802. function d3.dayaddHuoYue(human, nNum)
  1803. day.Gm_AddHuoYue(human, nNum)
  1804. end
  1805. -- 批量获取英雄:getAllHero [星级] [等级] [grade] [camp]
  1806. -- 星级/等级/camp 未填时使用默认值;grade 未填时增加 grade>=4 的英雄,填写时按 grade 精确匹配
  1807. function d3.getAllHero(human, val)
  1808. val = val or ""
  1809. local tb = Util.split(val, " ")
  1810. local HeroLogic = require("hero.HeroLogic")
  1811. local HERO_MAX_STAR = 20
  1812. local DEFAULT_MAX_LV = 9999
  1813. local star
  1814. if tb[1] == nil or tb[1] == "" then
  1815. star = HERO_MAX_STAR
  1816. else
  1817. star = tonumber(tb[1])
  1818. if not star or star <= 0 then
  1819. return Broadcast.sendErr(human, "星级参数错误,必须大于0")
  1820. end
  1821. end
  1822. local lv
  1823. if tb[2] == nil or tb[2] == "" then
  1824. lv = DEFAULT_MAX_LV
  1825. else
  1826. lv = tonumber(tb[2])
  1827. if not lv or lv <= 0 then
  1828. return Broadcast.sendErr(human, "等级参数错误,必须大于0")
  1829. end
  1830. end
  1831. local useDefaultGrade = (tb[3] == nil or tb[3] == "")
  1832. local grade
  1833. if not useDefaultGrade then
  1834. grade = tonumber(tb[3])
  1835. if not grade or grade <= 0 or grade > 5 then
  1836. return Broadcast.sendErr(human, "grade参数错误,必须在1~5之间")
  1837. end
  1838. end
  1839. local camp
  1840. if tb[4] ~= nil and tb[4] ~= "" then
  1841. camp = tonumber(tb[4])
  1842. if not camp or camp < 1 or camp > 5 then
  1843. return Broadcast.sendErr(human, "种族参数错误,必须在1~5之间")
  1844. end
  1845. end
  1846. local addCnt = 0
  1847. for id, hero in pairs(HeroTable) do
  1848. local gradeMatch
  1849. if useDefaultGrade then
  1850. gradeMatch = hero.grade >= 4
  1851. else
  1852. gradeMatch = hero.grade == grade
  1853. end
  1854. local campMatch = not camp or hero.camp == camp
  1855. if gradeMatch and campMatch then
  1856. d3.heroadd(human, string.format("%d %d %d %d", id, 1, lv, star))
  1857. addCnt = addCnt + 1
  1858. end
  1859. end
  1860. end
  1861. local allHeroIds= {}
  1862. -- 一键获取所有资源--
  1863. function d3.getAll(human)
  1864. for id, hero in pairs(HeroTable) do
  1865. if hero.grade == 4 or hero.grade == 5 then
  1866. table.insert(allHeroIds, id)
  1867. end
  1868. end
  1869. for _, id in ipairs(allHeroIds) do
  1870. local val = string.format("%d %d %d %d", id, 1, 1000, 20)
  1871. d3.heroadd(human, val)
  1872. end
  1873. local items = {
  1874. {31,999999},
  1875. {101, 1000000000},
  1876. {111, 1000000000},
  1877. {112, 1000000},
  1878. {114, 10000},
  1879. {118, 10000},
  1880. {124, 10000},
  1881. {120, 10000},
  1882. {135, 10000},
  1883. {80005, 10},
  1884. {80006, 10},
  1885. {1009, 10000},
  1886. {1011, 900000},
  1887. {1023, 99},
  1888. {1024, 99},
  1889. {1025, 99},
  1890. {1014, 99},
  1891. {1015, 99},
  1892. {1016, 99},
  1893. {1017, 99},
  1894. {1031, 99},
  1895. {1032, 99},
  1896. {1033, 99},
  1897. }
  1898. for _, item in ipairs(items) do
  1899. local cmd = string.format("%d %d", item[1], item[2])
  1900. d3.itemadd(human, cmd)
  1901. end
  1902. end
  1903. --清空周任务数据
  1904. function d3.clearWeek(human)
  1905. human.db.weekTask ={}
  1906. end
  1907. function d3.setWeekhuoyue(human,num)
  1908. human.db.weekTask.nowHuoYue = num
  1909. end
  1910. function d3.CSASendHuma(human)
  1911. CommerceManger.CommerveManager_GMSendHumanMail(human)
  1912. end
  1913. ------------------------主线任务流-------------------------------
  1914. function d3.zxjd(human, value)
  1915. local pos = string.find(value, " ", 1, true)
  1916. if pos == nil then return end
  1917. local taskId = tonumber(string.sub(value, 1, pos - 1))
  1918. local progress = tonumber(string.sub(value,pos+1,#value))
  1919. local MainTask = require("dailyTask.MainTask")
  1920. MainTask.GM_UpdateTaskProgress(human, taskId, progress)
  1921. end
  1922. function d3.zxnt(human, value)
  1923. local taskId = tonumber(value)
  1924. local MainTask = require("dailyTask.MainTask")
  1925. MainTask.GM_UpdateNowTask(human, taskId)
  1926. end
  1927. function d3.zxqc(human, value)
  1928. local taskId = tonumber(value)
  1929. local MainTask = require("dailyTask.MainTask")
  1930. MainTask.GM_ClearTask(human, taskId)
  1931. end
  1932. function d3.zxreset(human)
  1933. local MainTask = require("dailyTask.MainTask")
  1934. MainTask.GM_ClearAllTaskData(human)
  1935. end
  1936. function d3.qqbsreset(human)
  1937. QQBigShot.QQBigShot_GMReset(human)
  1938. end
  1939. --测试封号功能GM
  1940. function d3.fh(human, value)
  1941. print("=====================fh===================", value)
  1942. local pos = string.find(value, " ", 1, true)
  1943. if pos == nil then return end
  1944. local banType = tonumber(string.sub(value, 1, pos - 1))
  1945. local banMinutes = tonumber(string.sub(value,pos+1,#value))
  1946. local banInfo = {}
  1947. local targetBanInfo
  1948. if banType == 1 then
  1949. banInfo.roleBanInfo = {}
  1950. banInfo.roleBanInfo.roleTag = human.db._id
  1951. targetBanInfo = banInfo.roleBanInfo
  1952. elseif banType == 2 then
  1953. banInfo.accountBanInfo = {}
  1954. banInfo.accountBanInfo.channelTag = human.phpChanelID
  1955. banInfo.accountBanInfo.accountTag = human.db.account
  1956. targetBanInfo = banInfo.accountBanInfo
  1957. elseif banType == 3 then
  1958. banInfo.appBanInfo = {}
  1959. banInfo.appBanInfo.appId = human.appid
  1960. targetBanInfo = banInfo.appBanInfo
  1961. end
  1962. if targetBanInfo then
  1963. if banMinutes <= 0 then
  1964. targetBanInfo.banTime = 0
  1965. else
  1966. targetBanInfo.banTime = banMinutes * 60 + os.time()
  1967. end
  1968. local JsonLogic = require("common.Json")
  1969. local banStr = JsonLogic.Encode(banInfo)
  1970. print("==================fh2=================", banStr)
  1971. local BanLogic = require("scene.BanLogic")
  1972. BanLogic.Update_Ban_Info(banStr)
  1973. end
  1974. end
  1975. --酒馆
  1976. function d3.jgidx(human, value)
  1977. value = tonumber(value)
  1978. local HeroPubLogic = require("hero.HeroPubLogic")
  1979. HeroPubLogic.GM_SetAttrIdx(human, value)
  1980. end
  1981. function d3.MergeChargeDay(human, nDay)
  1982. MergeServerCharge.MergeServerCharge_GMReset(human, nDay)
  1983. end
  1984. -- 绝望深渊设置当天通关关卡
  1985. function d3.jwlv(human, value)
  1986. value = tonumber(value)
  1987. local LianyuLogic = require("lianyu.LianyuLogic")
  1988. LianyuLogic.GM_SetTodayWinLv(human, value)
  1989. end
  1990. -- 删除诸神圣域称号
  1991. function d3.delzsch(human)
  1992. local GodsAreaNS = require("godsArea.GodsAreaNS")
  1993. GodsAreaNS.GM_ClearChenghao(human)
  1994. end
  1995. -- 开启下一个循环活动
  1996. function d3.cycleAct(human)
  1997. local CycleActivityLogic = require("yunying.CycleActivity")
  1998. CycleActivityLogic.GM_EnterNext(human)
  1999. end
  2000. function d3.active(human, value)
  2001. local pos = string.find(value, " ", 1, true)
  2002. if pos == nil then return end
  2003. local tp = tonumber(string.sub(value, 1, pos - 1))
  2004. local id = tonumber(string.sub(value,pos+1, #value))
  2005. local RoleHeadLogic = require("role.RoleHeadLogic")
  2006. RoleHeadLogic.GM_Active(human, tp, id)
  2007. end
  2008. function d3.unaActive(human, value)
  2009. local pos = string.find(value, " ", 1, true)
  2010. if pos == nil then return end
  2011. local tp = tonumber(string.sub(value, 1, pos - 1))
  2012. local id = tonumber(string.sub(value,pos+1, #value))
  2013. local RoleHeadLogic = require("role.RoleHeadLogic")
  2014. RoleHeadLogic.GM_UnActive(human, tp, id)
  2015. end