Global_Reg.RegTalkEvent("TalkEvent_Watch");
LB = {};
local TalkConfig={1,500};--1表示是否收费0为不收费,500表示收取的费用,
function TalkEvent_Watch(_charaIndex, _msg, _color, _range, _size)
if(string.sub(_msg,1,7)=="P|/转播")then
ShowLB(_charaIndex);
return -1;
end
if(string.sub(_msg,1,7)=="P|/停播")then
StopLB(_charaIndex);
return -1;
end
if(string.sub(_msg,1,8)=="P|/观战 ")then
local NewMsg = Stringsplitplus(_msg," ");
Date = NewMsg[2];
if(Date == "")then
return 1;
end
StartLB(_charaIndex,Date);
return -1;
end
end
function ShowLB(_PlayerIndex)
local CheckGold = 0;
if(NLG.Get_Char_Date(_PlayerIndex, 273)>0)then
if(LB [_PlayerIndex]==1)then
NLG.SystemMessage(_PlayerIndex,"[观战系统] 您当前已经是开启着战况转播[转播码为:".._PlayerIndex.."],无需再次开启,如果需要全服公告您的转播码请先/停播后再次/转播");
return;
end
if(tonumber(TalkConfig[1]) == 1)then
local gold=Char.GetData(_PlayerIndex, %对象_金币%);
if(gold >= tonumber(TalkConfig[2]))then
NLG.AddGold(_PlayerIndex,-500);
else
NLG.SystemMessage(_PlayerIndex,"[观战系统] 您当前魔币少于500无法发起战况转播分享");
return;
end
end
LB [_PlayerIndex] = 1;
NLG.TalkToCli( _PlayerIndex,"[观战系统] 您开启了战况转播您的转播码为:" .. _PlayerIndex,4, 1);
NLG.TalkToCli( _PlayerIndex,"[观战系统] 关闭实况转播模式,请输入 /停播 或直接注销登出即可" , 4, 1);
--如果需要全服把下面的--去掉即可
NLG.SystemMessage(-1,"[观战系统] "..Char.GetData(_PlayerIndex, %对象_原名%).."开启了战况转播,转播码:".._PlayerIndex.."(远程观战使用方式对话框 /观战 N,N为转播码)");
else
NLG.SystemMessage(_PlayerIndex,"[观战系统] 当前不在战斗中无法开启战况转播");
end
return;
end
function StopLB(_PlayerIndex)
if(LB [_PlayerIndex]==1)then
NLG.SystemMessage(_PlayerIndex,"[观战系统] 关闭战况转播,如需再开启请输入 /转播");
LB [_PlayerIndex]=0;
return;
else
NLG.SystemMessage(_PlayerIndex,"[观战系统] 您并无开启战况转播如需开启请输入 /转播");
return;
end
end
function StartLB(_PlayerIndex,LBnum)
if(ISstring(LBnum)==1)then
return;
end
local lennumber=0;
lennumber=tonumber(LBnum);
if(lennumber<0)then
return;
end
if(LB [tonumber(LBnum)] == 1)then
NLG.WatchEntry(_PlayerIndex,LBnum);
end
end
function ISstring(str)
local lenInByte = #str
if(lenInByte>4)then
return 1;
end
for i=1,lenInByte do
local curByte = string.byte(str, i)
if(curByte>57 or curByte<48)then
return 1;
end
end
return 0;
end
|
|