--两湖区 巴陵县 路人4小渔对话
--巴陵县新手任务:小渔的爹爹
--suyu

Include("\\script\\missions\\clearskill\\head.lua" );
npc_name = "Nguoi tay tuy"

function main()
nLevel = GetLevel();
if (nLevel < CSP_NEEDLEVEL) then
Talk(1, "", "Phan Tang: Dang cap can phai la"..CSP_NEEDLEVEL.."Thi moi tay tuy duoc!")
return -1;
end

nType = GetTask(CSP_TID_ClearType);
if (nLevel > CSP_NEEDLEVEL) then -- 只洗技能点
Say("Phan Tang: Nguoi co the tay <color=blue> diem ky nang<color> va <color=blue> diem tiem nang<color> o day!", 5, "Tay diem ky nang/DoClearSkill", "Tay diem tiem nang/DoClearProp", "Khong tay/OnCancel", "Ve viec tay tuy/Help", "Roi khoi dao tay tuy/LeaveHere")
end;
end

function DoClearSkill()
Say("Phan Tang: Nguoi co muon tay diem ky nang khong?", 2, "Tay diem ky nang/DoClearSkillCore", "Khong tay/OnCancel")
end
function DoClearSkillCore()
-- if (Pay(100000) == 0) then
-- Say("释明:对不起,每次洗髓需10万两� ��你身上带的钱不够。", 0)
-- return
-- end

i = HaveMagic(210) -- 轻功另外操作
j = HaveMagic(400) -- “劫富济贫”另外操作
n = RollbackSkill() -- 清除技能并返回所有技能点(包括轻� �等特殊技能)
x = 0
if (i ~= -1) then x = x + i end -- 这两句判断是排除从未学过轻功的人� �回-1从而导致点数计算错误情况
if (j ~= -1) then x = x + j end
rollback_point = n - x -- 把技能点当做空闲点数返还,但先扣� �轻功等
if (rollback_point + GetMagicPoint() < 0) then -- 如果洗成了负数,则当作0(为以后多� ��洗点保留)
rollback_point = -1 * GetMagicPoint()
end
AddMagicPoint(rollback_point)
if (i ~= -1) then AddMagic(210,i) end -- 如果学过轻功则加回原有等级
if (j ~= -1) then AddMagic(400,j) end -- 如果学过“劫富济贫”同样处理
Msg2Player("Tay tuy thanh cong!Nguoi co the phan phoi "..rollback_point.." diem ky nang lai tu dau!")
Talk(1, "KickOutSelf", "Tay tuy thanh cong!Nguoi co the phan phoi"..rollback_point.."diem ky nang lai tu dau!")
end;

function DoClearProp()
Say("Phan Tang: Nguoi co muon tay diem tiem nang khong?", 2, "Tay diem tiem nang/DoClearPropCore", "khong tay/OnCancel")
end

function DoClearPropCore()
base_str = {35,20,25,30,20} -- 五行人物的天生属性值
base_dex = {25,35,25,20,15}
base_vit = {25,20,25,30,25}
base_eng = {15,25,25,20,40}
player_series = GetSeries() + 1

Utask88 = GetTask(88)
AddStrg(base_str[player_series] + GetByte(Utask88,1)) -- 将已分配潜能重置(task(88)是任务中直 接奖励的力量、身法等)
AddDex(base_dex[player_series] - GetDex(1) + GetByte(Utask88,2))
AddVit(base_vit[player_series] - GetVit(1) + GetByte(Utask88,3))
AddEng(base_eng[player_series] - GetEng(1) + GetByte(Utask88,4))
end;

function OnCancel()
end;

function Help()
strHelp =
{
"Sau khi tay tuy, nguoi co the di ra ngoai de danh voi moc nhan, hoac ca nhom se cung di vao son dong de thuc nghiem chien dau, sau do roi khoi dao moi duoc xem la da hoan thanh",
"O day, ta co the giup nguoi tay tuy, chi can nguoi khong roi khoi dao tay tuy, ta se giup duoc nguoi",
"Ngoai thon co coc go, bao cat va moc nhan de cho nguoi thu, coc go co 3000 cai, bao cat co 10000 cai, moc nhan co 30000 cai, nhung ben ngoai thon lai khong cho phep ty vo!",
"Neu muon thi dau co the vao trong son dong, cho du co that bai cung khong bi ton that gi!",
"Nhung ben trong son dong lai rat nho hep, nhieu nhat chi chua duoc 20 nguoi, cho nen neu da du nguoi thi nguoi khong the di vao duoc",
"Nhung ben trong son dong lai rat nho hep, nhieu nhat chi chua duoc 20 nguoi, cho nen neu da du nguoi thi nguoi khong the di vao duoc",
"Cuoi cung, khi nguoi cam thay diem ky nang nang da du hay den tim ta, ta se dua nguoi tro ve cho cu."
}
Talk(7, "", strHelp[1], strHelp[2], strHelp[3], strHelp[4], strHelp[5], strHelp[6], strHelp[7]);
end;

function LeaveHere()
Say("Phan Tang: Nguoi cho rang da tay tuy xong roi u? Co muon roi khoi day khong", 2, "Muon roi khoi/LeaveHere2", "De ta suy nghi/OnCancel")
end

function LeaveHere2()
Say("Phan Tang: Roi khoi dao tay tuy, neu muon tro lai se rat kho !", 2, "Ta thuc su muon roi khoi noi ma quai nay/LeaveHere_yes", "Ta van muon o lai/OnCancel")
end

function LeaveHere_yes()
NewWorld(53, 1582, 3237);
end;