cgmsv引擎论坛

 找回密码
 注册/Sign up
搜索
查看: 1707|回复: 7

修复21.2a自带的 快速加点npc

[复制链接]

Rank: 1

发表于 2022-3-8 21:57:16 | 显示全部楼层 |阅读模式
本帖最后由 ahsin 于 2022-3-8 21:58 编辑

可能需求不高,但是bt服的玩家还是有需求的,虽然小男生cg只需鼠标长按不放开即可连点


但是
但是但是...


经过测试鼠标连点,每小时2万点左右。
我这里开的是超超超变态,50万点,需要加2天。

所以修复这个npc刻不容缓,哈哈哈哈哈


修改21.2a自带的Shortcut.lua,修复全部功能,并且添加剩余点数提示、可加点数提示、总共点数提示


  1. ------------------------------------------------------------------------------
  2. ------------------------------------------------------------------------------
  3. --                 【【【基础NPC设置】】】
  4. ------------------------------------------------------------------------------
  5. Delegate.RegInit("ShortcutNpc_Init");
  6. Delegate.RegDelTalkEvent("Shortcut_TalkEvent");
  7. function ShortcutNpc_Init()
  8.         ShortcutNpc = NL.CreateNpc(nil, "Myinit");
  9.         Char.SetData(ShortcutNpc,%对象_形象%,14722);
  10.         Char.SetData(ShortcutNpc,%对象_原形%,14722);
  11.         Char.SetData(ShortcutNpc,%对象_X%,247);
  12.         Char.SetData(ShortcutNpc,%对象_Y%,92);
  13.         Char.SetData(ShortcutNpc,%对象_地图%,1000);
  14.         Char.SetData(ShortcutNpc,%对象_方向%,4);
  15.         Char.SetData(ShortcutNpc,%对象_名字%,"快速加点");
  16.         NLG.UpChar(ShortcutNpc);
  17.         tbl_ShortcutNpc = tbl_ShortcutNpc or {}
  18.         tbl_ShortcutNpc["ShortcutNpc"] = ShortcutNpc;
  19.         Char.SetTalkedEvent(nil, "ShortcutNpc_Talked", ShortcutNpc);
  20.         Char.SetWindowTalkedEvent(nil, "ShortcutNpc_WindowTalked", ShortcutNpc);
  21.         return true;
  22. end
  23. function Myinit(_MeIndex)
  24.         return true;
  25. end
  26. function ShortcutNpc_Talked( _MeIndex, _PlayerIndex, _Mode)
  27.         local TalkBuf =        "4\\n◆哔哩快捷加点◆" ..
  28.                         "\\n【测试】快速加点系统请谨慎使用" ..
  29.                         "\\n当前加点模式不可以突破加点限制" ..
  30.                         "\\n可以单项全部加点" ..
  31.                         "\\n『快速体力加点』" ..
  32.                         "\\n『快速力量加点』" ..
  33.                         "\\n『快速耐力加点』" ..
  34.                         "\\n『快速敏捷加点』"..
  35.                         "\\n『快速魔力加点』"
  36.         TalkBuf =Shor_GAMsgFormat(TalkBuf);
  37.         Shor_ShowGAWindowTalk(_PlayerIndex, 2, 2, 1,TalkBuf,_MeIndex);
  38.         return ;
  39. end
  40. function Shor_ShowGAWindowTalk(_PlayerIndex,_Window, _Select,_Seqno,_Data,_MePtr)
  41.         return NLG.ShowWindowTalked(_PlayerIndex,_MePtr,_Window,_Select,_Seqno,_Data);
  42. end
  43. function Shor_GAMsgFormat(Msg)
  44.         local tMsg = Split(Msg,"\\n")
  45.         local NewMsg=""
  46.         for i=1,#tMsg do
  47.                 if tMsg[i]~="" and string.find(tMsg[i],"|")==nil then
  48.                         NewMsg=NewMsg..Shor_strFormat(tMsg[i],45,2).."\\n"
  49.                 else
  50.                         NewMsg=NewMsg..tMsg[i].."\\n"
  51.                 end
  52.                
  53.         end
  54.         return NewMsg
  55. end
  56. function Shor_strFormat(str,str_len,str_type)
  57.         if string.len(str)>str_len then
  58.                 str = string.sub(str,1,str_len)
  59.         end
  60.         if(str_type == 3) then
  61.                 str_tmp=string.format("%"..str_len.."s", str);
  62.         elseif(str_type == 1) then
  63.                 str_tmp=string.format("%-"..str_len.."s", str);
  64.         elseif(str_type == 2) then
  65.                 local tmp_splace=math.floor((str_len-string.len(str))/2)+string.len(str);
  66.                 str_tmp=string.format("%"..tmp_splace.."s", str);
  67.                 str_tmp=string.format("%-"..str_len.."s", str_tmp);
  68.         end
  69.         return str_tmp;
  70. end
  71. function Shortcut_TalkEvent(player,msg,color,range,size)
  72.         if msg == "[ksjd]" then
  73.                 ShortcutNpc_Talked(tbl_ShortcutNpc["ShortcutNpc"], player, 0, 0, 0)
  74.         end
  75. end
  76. function ShortcutNpc_WindowTalked( _MeIndex, _PlayerIndex, _Seqno, _Select, _Data)
  77.         local CdKey = Char.GetData(_PlayerIndex, %对象_CDK%)
  78.         local JBP = Char.GetData(_PlayerIndex, %对象_升级点%)--待加点数,正常显示
  79.         local TL = (Char.GetData(_PlayerIndex,%对象_体力%))--已加点数*100,注意
  80.         local LL = (Char.GetData(_PlayerIndex,%对象_力量%))--已加点数*100,注意
  81.         local NL = (Char.GetData(_PlayerIndex,%对象_强度%))--已加点数*100,注意
  82.         local MJ = (Char.GetData(_PlayerIndex,%对象_速度%))--已加点数*100,注意
  83.         local MF = (Char.GetData(_PlayerIndex,%对象_魔法%))--已加点数*100,注意
  84.         local lv = Char.GetData(_PlayerIndex,%对象_等级%);
  85.         local maxd = ((lv - 1)*2)+15;
  86.         local maxd1 = maxd*100
  87.         local maxd2 = TL+LL+NL+MJ+MF+JBP*100--哔哩魔力算法,按照总点数来
  88.         local maxd2 = maxd2/2--总点数除以2
  89.         local maxd2 = tonumber(maxd2)
  90.         local maxd3 = maxd2/100--准确显示单项最高加多少
  91.         --print(maxd2)
  92.         --print(JBP)
  93.         --取消按钮
  94.         if _Select==2 then
  95.                 return
  96.         end
  97.        
  98.         if _Seqno==1 then
  99.                 local PlayerSelect = tonumber(_Data)
  100.                 --查询
  101.                 if PlayerSelect==1 then
  102.                         local d1 = TL/100--已加点
  103.                         local d2 = maxd3-d1--单项总-已加=还能加
  104.                         local d3 = JBP-d1--剩余总-已加
  105.                         if d2 < JBP then--如果还能加小于剩余
  106.                         Shor_ShowGAWindowTalk(_PlayerIndex,1,%按钮_确定%,13,"\n\n剩余点数为"..JBP..",\n\n体力最多加"..maxd3.."点,已有"..d1.."点,还能加"..d2.."点!",_MeIndex);
  107.                         else
  108.                         Shor_ShowGAWindowTalk(_PlayerIndex,1,%按钮_确定%,13,"\n\n剩余点数为"..JBP..",\n\n体力最多加"..maxd3.."点,已有"..d1.."点,还能加"..JBP.."点!",_MeIndex);
  109.                         end
  110.                         return;
  111.                 end
  112.                 if PlayerSelect==2 then
  113.                         --Shor_ShowGAWindowTalk(_PlayerIndex,1,%按钮_确定%,14,"\n\n\n您好,欢迎使用力量加点\n\n\n您的当前剩余可加点数为"..JBP.."\n\n\n请合理安排!",_MeIndex);
  114.                         local d1 = LL/100--已加点
  115.                         local d2 = maxd3-d1--单项总-已加=还能加
  116.                         local d3 = JBP-d1--剩余总-已加
  117.                         if d2 < JBP then--如果还能加小于剩余
  118.                         Shor_ShowGAWindowTalk(_PlayerIndex,1,%按钮_确定%,14,"\n\n剩余点数为"..JBP..",\n\n力量最多加"..maxd3.."点,已有"..d1.."点,还能加"..d2.."点!",_MeIndex);
  119.                         else
  120.                         Shor_ShowGAWindowTalk(_PlayerIndex,1,%按钮_确定%,14,"\n\n剩余点数为"..JBP..",\n\n力量最多加"..maxd3.."点,已有"..d1.."点,还能加"..JBP.."点!",_MeIndex);
  121.                         end
  122.                         return;
  123.                 end
  124.                 if PlayerSelect==3 then
  125.                         --Shor_ShowGAWindowTalk(_PlayerIndex,1,%按钮_确定%,15,"\n\n\n您好,欢迎使用耐力加点\n\n\n您的当前剩余可加点数为"..JBP.."\n\n\n请合理安排!",_MeIndex);
  126.                         local d1 = NL/100--已加点
  127.                         local d2 = maxd3-d1--单项总-已加=还能加
  128.                         local d3 = JBP-d1--剩余总-已加
  129.                         if d2 < JBP then--如果还能加小于剩余
  130.                         Shor_ShowGAWindowTalk(_PlayerIndex,1,%按钮_确定%,15,"\n\n剩余点数为"..JBP..",\n\n耐力最多加"..maxd3.."点,已有"..d1.."点,还能加"..d2.."点!",_MeIndex);
  131.                         else
  132.                         Shor_ShowGAWindowTalk(_PlayerIndex,1,%按钮_确定%,15,"\n\n剩余点数为"..JBP..",\n\n耐力最多加"..maxd3.."点,已有"..d1.."点,还能加"..JBP.."点!",_MeIndex);
  133.                         end
  134.                         return;
  135.                 end
  136.                 if PlayerSelect==4 then
  137.                         --Shor_ShowGAWindowTalk(_PlayerIndex,1,%按钮_确定%,16,"\n\n\n您好,欢迎使用敏捷加点\n\n\n您的当前剩余可加点数为"..JBP.."\n\n\n请合理安排!",_MeIndex);
  138.                         local d1 = MJ/100--已加点
  139.                         local d2 = maxd3-d1--单项总-已加=还能加
  140.                         local d3 = JBP-d1--剩余总-已加
  141.                         if d2 < JBP then--如果还能加小于剩余
  142.                         Shor_ShowGAWindowTalk(_PlayerIndex,1,%按钮_确定%,16,"\n\n剩余点数为"..JBP..",\n\n敏捷最多加"..maxd3.."点,已有"..d1.."点,还能加"..d2.."点!",_MeIndex);
  143.                         else
  144.                         Shor_ShowGAWindowTalk(_PlayerIndex,1,%按钮_确定%,16,"\n\n剩余点数为"..JBP..",\n\n敏捷最多加"..maxd3.."点,已有"..d1.."点,还能加"..JBP.."点!",_MeIndex);
  145.                         end
  146.                         return;
  147.                 end
  148.                 if PlayerSelect==5 then
  149.                         --Shor_ShowGAWindowTalk(_PlayerIndex,1,%按钮_确定%,17,"\n\n\n您好,欢迎使用魔法加点\n\n\n您的当前剩余可加点数为"..JBP.."\n\n\n请合理安排!",_MeIndex);
  150.                         local d1 = MF/100--已加点
  151.                         local d2 = maxd3-d1--单项总-已加=还能加
  152.                         local d3 = JBP-d1--剩余总-已加
  153.                         if d2 < JBP then--如果还能加小于剩余
  154.                         Shor_ShowGAWindowTalk(_PlayerIndex,1,%按钮_确定%,17,"\n\n剩余点数为"..JBP..",\n\n魔法最多加"..maxd3.."点,已有"..d1.."点,还能加"..d2.."点!",_MeIndex);
  155.                         else
  156.                         Shor_ShowGAWindowTalk(_PlayerIndex,1,%按钮_确定%,17,"\n\n剩余点数为"..JBP..",\n\n魔法最多加"..maxd3.."点,已有"..d1.."点,还能加"..JBP.."点!",_MeIndex);
  157.                         end
  158.                         return;
  159.                 end
  160.         end
  161.         if(tonumber(_Seqno)==13 and tonumber(_Select)==%按钮_确定% and _Data~="")then
  162.                 local dian = tonumber("".._Data.."");
  163.                 local jiadian = dian*100
  164.                 local td = Char.GetData(_PlayerIndex,%对象_体力%);
  165.                 local jd = jiadian+td
  166.                 if jd > maxd2 then
  167.                         NLG.SystemMessage(_PlayerIndex, "[系统]超出体力加点范围。")
  168.                         return;
  169.                 end
  170.                 if dian <= JBP and dian >= 0 then
  171.                         Char.SetData(_PlayerIndex,%对象_体力%,TL+jiadian)
  172.                         Char.SetData(_PlayerIndex,%对象_升级点%,JBP-dian)
  173.                         NLG.UpChar(_PlayerIndex);
  174.                         NLG.SystemMessage(_PlayerIndex, "[系统]加点完成:增加体力"..dian.."点,总体力"..(TL/100)+dian.."点。")
  175.                 else
  176.                         NLG.SystemMessage(_PlayerIndex, "[系统]加点数不足,无法加点。")
  177.                 end
  178.         end
  179.         if(tonumber(_Seqno)==14 and tonumber(_Select)==%按钮_确定% and _Data~="")then
  180.                 local dian = tonumber("".._Data.."");
  181.                 local jiadian = dian*100
  182.                 local td = Char.GetData(_PlayerIndex,%对象_力量%);
  183.                 local jd = jiadian+td
  184.                 if jd > maxd2 then
  185.                         NLG.SystemMessage(_PlayerIndex, "[系统]超出力量加点范围。")
  186.                         return;
  187.                 end
  188.                 if dian <= JBP and dian >= 0 then
  189.                         Char.SetData(_PlayerIndex,%对象_力量%,LL+jiadian)
  190.                         Char.SetData(_PlayerIndex,%对象_升级点%,JBP-dian)
  191.                         NLG.UpChar(_PlayerIndex);
  192.                         NLG.SystemMessage(_PlayerIndex, "[系统]加点完成:增加力量"..dian.."点,总力量"..(LL/100)+dian.."点。")
  193.                 else
  194.                         NLG.SystemMessage(_PlayerIndex, "[系统]加点数不足,无法加点。")
  195.                 end
  196.         end
  197.         if(tonumber(_Seqno)==15 and tonumber(_Select)==%按钮_确定% and _Data~="")then
  198.                 local dian = tonumber("".._Data.."");
  199.                 local jiadian = dian*100
  200.                 local td = Char.GetData(_PlayerIndex,%对象_强度%);
  201.                 local jd = jiadian+td
  202.                 if jd > maxd2 then
  203.                         NLG.SystemMessage(_PlayerIndex, "[系统]超出强度加点范围。")
  204.                         return;
  205.                 end
  206.                 if dian <= JBP and dian >= 0 then
  207.                         Char.SetData(_PlayerIndex,%对象_强度%,NL+jiadian)
  208.                         Char.SetData(_PlayerIndex,%对象_升级点%,JBP-dian)
  209.                         NLG.UpChar(_PlayerIndex);
  210.                         NLG.SystemMessage(_PlayerIndex, "[系统]加点完成:增加强度"..dian.."点,总强度"..(NL/100)+dian.."点。")
  211.                 else
  212.                         NLG.SystemMessage(_PlayerIndex, "[系统]加点数不足,无法加点。")
  213.                 end
  214.         end
  215.         if(tonumber(_Seqno)==16 and tonumber(_Select)==%按钮_确定% and _Data~="")then
  216.                 local dian = tonumber("".._Data.."");
  217.                 local jiadian = dian*100
  218.                 local td = Char.GetData(_PlayerIndex,%对象_速度%);
  219.                 local jd = jiadian+td
  220.                 if jd > maxd2 then
  221.                         NLG.SystemMessage(_PlayerIndex, "[系统]超出速度加点范围。")
  222.                         return;
  223.                 end
  224.                 if dian <= JBP and dian >= 0 then
  225.                         Char.SetData(_PlayerIndex,%对象_速度%,MJ+jiadian)
  226.                         Char.SetData(_PlayerIndex,%对象_升级点%,JBP-dian)
  227.                         NLG.UpChar(_PlayerIndex);
  228.                         NLG.SystemMessage(_PlayerIndex, "[系统]加点完成:增加速度"..dian.."点,总速度"..(MJ/100)+dian.."点。")
  229.                 else
  230.                         NLG.SystemMessage(_PlayerIndex, "[系统]加点数不足,无法加点。")
  231.                 end
  232.         end
  233.         if(tonumber(_Seqno)==17 and tonumber(_Select)==%按钮_确定% and _Data~="") then
  234.                 local dian = tonumber("".._Data.."");
  235.                 local jiadian = dian*100
  236.                 local td = Char.GetData(_PlayerIndex,%对象_魔法%);
  237.                 local jd = jiadian+td
  238.                 if jd > maxd2 then
  239.                         NLG.SystemMessage(_PlayerIndex, "[系统]超出魔法加点范围。")
  240.                         return;
  241.                 end
  242.                 if dian <= JBP and dian >= 0 then
  243.                         Char.SetData(_PlayerIndex,%对象_魔法%,MF+jiadian)
  244.                         Char.SetData(_PlayerIndex,%对象_升级点%,JBP-dian)
  245.                         NLG.UpChar(_PlayerIndex);
  246.                         NLG.SystemMessage(_PlayerIndex, "[系统]加点完成:增加魔法"..dian.."点,总魔法"..(MF/100)+dian.."点。")
  247.                 else
  248.                         NLG.SystemMessage(_PlayerIndex, "[系统]加点数不足,无法加点。")
  249.                 end
  250.         end
  251. end
复制代码


Rank: 1

发表于 2022-3-8 22:53:25 | 显示全部楼层
辛苦了,点赞

Rank: 1

发表于 2022-3-8 23:43:23 | 显示全部楼层
感谢分享,辛苦啦

Rank: 4

发表于 2022-3-9 11:09:55 | 显示全部楼层
这个是新框架才能使用吗?还是旧框架也可以使用.

Rank: 1

 楼主| 发表于 2022-3-9 20:57:14 | 显示全部楼层
°Cayenne.S 发表于 2022-3-9 11:09
这个是新框架才能使用吗?还是旧框架也可以使用.

这个是老框架的,但是新老都可以使用。最近新老合并了好多,人要爆炸了,哈哈哈

Rank: 1

发表于 2022-3-28 09:41:01 | 显示全部楼层
新框架 不能用老的可以....

Rank: 1

 楼主| 发表于 2022-3-29 21:14:17 | 显示全部楼层
dfgh 发表于 2022-3-28 09:41
新框架 不能用老的可以....

可以用的哦
您需要登录后才可以回帖 登录 | 注册/Sign up

本版积分规则

手机版|cgmsv引擎论坛

GMT+8, 2024-5-19 10:05 , Processed in 0.122297 second(s), 8 queries , Gzip On, MemCached On.

Powered by Discuz! X3.4

© 2001-2023 Discuz! Team.

快速回复 返回顶部 返回列表