Code:
local tbNkt = Npc:GetClass("nhatkiemthe");
local nLevel1 = 80;
local nLevel2 = 100;
local nMoney = 50000000;
local nDongK = 5000000;
local nTinhH = 100000;
local tbCuoi = {1, 12, 10, 4};
local tbNhht = {18, 1, 244, 2};
local tbTui24 = {
{21, 9, 8, 1},
{21, 9, 9, 1},
{21, 9, 10, 1},
};
local tbAnmax = {1, 16, 13, 2};
local tbRgVoso = {18, 1, 338, 1};
local tbMathat = {18, 1, 524, 1};
local nMathat = 20;
local tbBicanh = {18, 1, 251, 1};
local TASK_GROUP_ID = 3000;
local TASK_LEVEL = 1;
local TASK_MONEY = 2;
local TASK_DONGK = 3;
local TASK_TINHH = 4;
local TASK_TCUOI = 5;
local TASK_NHHTK = 6;
local TASK_DNGAY = 7;
local TASK_TUI24 = 8;
local TASK_ANMAX = 9;
local TASK_RVOSO = 10;
local TASK_MATTH = 11;
local TASK_NONNAM = 12;
local TASK_BCANH = 13;
local TASK_AONAM = 14;
local TASK_GM = 15;
local TASK_LUNGNAM = 16;
local TASK_NHANDO = 17;
local TASK_TAYNAM = 18;
local TASK_MTCC = 19;
local TASK_GIAYNAM = 20;
local TASK_GIAYNU = 21;
local TASK_LIENNAM = 22;
local TASK_LIENNU = 23;
local TASK_NHANNAM = 24;
local TASK_NHANNU = 25;
local TASK_BOINAM = 26;
local TASK_BOINU = 27;
local TASK_PHUNAM = 28;
local TASK_PHUNU = 29;
local TASK_VUKHI = 30;
function tbNkt:OnDialog()
local szMsg = "Xin chào, bạn đang tham gia trò chơi Kiếm Thế của NKT.\nĐây là phiên bản không chính thức, Bản quyền trò chơi công ty Kingsoft.\nCông ty Cổ phần VNG phân phối duy nhất tại Việt Nam.";
local tbOpt = {};
local bLevel = 0;
local nNowDate = tonumber(GetLocalDate("%y%m%d"));
local nTrangbi = 0;
local nYeucau = 10 < me.nLevel;
if (not nYeucau) then
szMsg = szMsg.."\nBạn phải trên cấp 10 mới được nhận quà";
end
if nYeucau and (nDate ~= nNowDate) then
table.insert(tbOpt, {"<color=yellow>Quà tặng hàng ngày (giới hạn theo cấp)<color>", self.KichHoatNgay, self, nNowDate});
end
if nYeucau and (nTrangbi < 11) then
if (me.nLevel < nLevel2) then
table.insert(tbOpt, {"Nhận set đồ 8x 4%", self.TakeSetDo, self, 8});
else
table.insert(tbOpt, {"Nhận set đồ 10x 4%", self.TakeSetDo, self, 10});
end
end
if nYeucau and (me.nLevel < nLevel2) then
bLevel = me.GetTask(TASK_GROUP_ID, TASK_LEVEL) or 0;
if (bLevel == 0 or me.nLevel < nLevel1) then
table.insert(tbOpt, {"Nhận kinh nghiệm cấp: <color=yellow>"..nLevel1.."<color>", self.TakeLevel, self, nLevel1});
table.insert(tbOpt, {"Nhận kinh nghiệm cấp: <color=yellow>"..nLevel2.."<color>", self.TakeLevel, self, nLevel2});
elseif (bLevel < nLevel2) then
table.insert(tbOpt, {"Nhận kinh nghiệm cấp: <color=yellow>"..nLevel2.."<color>", self.TakeLevel, self, nLevel2});
end
end
if nYeucau and (me.nLevel >= nLevel1) then
bLevel = me.GetTask(TASK_GROUP_ID, TASK_MONEY) or 0;
if (bLevel == 0) then
table.insert(tbOpt, {"Nhận Bạc - Bạc khóa: <color=yellow>"..Lib:FormatMoney(nMoney).."<color>", self.TakeMoney, self});
end
bLevel = me.GetTask(TASK_GROUP_ID, TASK_DONGK) or 0;
if (bLevel == 0) then
table.insert(tbOpt, {"Nhận Đồng - Đồng khóa: <color=yellow>"..Lib:FormatMoney(nDongK).."<color>", self.TakeDongK, self});
end
bLevel = me.GetTask(TASK_GROUP_ID, TASK_TINHH) or 0;
if (bLevel == 0) then
table.insert(tbOpt, {"Nhận Tinh - Hoạt lực: <color=yellow>"..nTinhH.."<color>", self.TakeTinhH, self});
end
bLevel = me.GetTask(TASK_GROUP_ID, TASK_TCUOI) or 0;
if (bLevel == 0) then
table.insert(tbOpt, {"Nhận: <color=yellow>"..KItem.GetNameById(unpack(tbCuoi)).."<color>", self.TakeTcuoi, self});
end
bLevel = me.GetTask(TASK_GROUP_ID, TASK_NHHTK) or 0;
if (bLevel == 0) then
table.insert(tbOpt, {"Nhận: <color=yellow>Vật phẩm nhiệm vụ skill 11x<color>", self.TakeNhhtK, self});
end
bLevel = me.GetTask(TASK_GROUP_ID, TASK_TUI24) or 0;
if (bLevel == 0) then
table.insert(tbOpt, {"Nhận: <color=yellow>Túi 24 ô<color>", self.TakeTui24, self});
end
bLevel = me.GetTask(TASK_GROUP_ID, TASK_ANMAX) or 0;
if (bLevel == 0) then
table.insert(tbOpt, {"Nhận: <color=yellow>"..KItem.GetNameById(unpack(tbAnmax)).."<color>", self.TakeAnmax, self});
end
bLevel = me.GetTask(TASK_GROUP_ID, TASK_MATTH) or 0;
if (bLevel == 0) then
table.insert(tbOpt, {"Nhận: <color=yellow>"..KItem.GetNameById(unpack(tbMathat)).."<color>", self.TakeMatThat, self});
end
bLevel = me.GetTask(TASK_GROUP_ID, TASK_RVOSO) or 0;
if (bLevel == 0) then
table.insert(tbOpt, {"Nhận: <color=yellow>"..KItem.GetNameById(unpack(tbRgVoso)).."<color>", self.TakeRgVoso, self});
end
end
Dialog:Say(szMsg, tbOpt);
end
function tbNkt:TakeSetDo(nCap)
if me.nFaction <= 0 then
Dialog:Say("Nhật Kiếm Thế mỉm cười: Tên chữ trắng cũng muốn nhận? Hãy gia nhập phái nào đó trước khi đến đây!", {"Tôi biết"});
return;
end
local tbOpt = {};
local bLevel = 0;
local tbItemInfo = {};
tbItemInfo.nSeries = Env.SERIES_NONE;
tbItemInfo.nEnhTimes = 0;
tbItemInfo.nLucky = 0;
tbItemInfo.tbGenInfo = nil;
tbItemInfo.tbRandomInfo = nil;
tbItemInfo.nVersion = 0;
tbItemInfo.uRandSeed = 0;
tbItemInfo.bForceBind = 1;
local szMonphai = Player:GetFactionRouteName(me.nFaction, me.nRouteId);
local szMsg = "Xin chào, "..szMonphai.." nhận đồ nek";
local nMonphai = me.GetTask(TASK_GROUP_ID, me.nFaction + 30) or 0;
bLevel = me.GetTask(TASK_GROUP_ID, TASK_MTCC) or 0;
if (nMonphai == 0) then
local tbGif = nil;
local tbFile = Lib:LoadTabFile("\\setting\\nkt\\mtcc.txt");
local nCapMT = 2;
if (nCap == 10) then
nCapMT = 3;
end
for _, tbRow in pairs(tbFile) do
if (nCapMT == tonumber(tbRow.Level) and me.nFaction == tonumber(tbRow.Series) and me.nRouteId == tonumber(tbRow.ReqProp2Value)) then
tbGif = {tonumber(tbRow.Genre), tonumber(tbRow.DetailType),tonumber(tbRow.ParticularType), tonumber(tbRow.Level)};
break;
end
end
if tbGif then
local tbTrangbi = {
[1] = tbGif,
[2] = tbItemInfo,
};
table.insert(tbOpt, {"Nhận MTCC: <color=yellow>"..KItem.GetNameById(unpack(tbGif)).."<color>", self.TakeTrangbi, self, tbTrangbi, me.nFaction + 30});
end
end
bLevel = me.GetTask(TASK_GROUP_ID, TASK_VUKHI) or 0;
if (bLevel == 0) then
local tbGif = nil;
local tbFile = Lib:LoadTabFile("\\setting\\nkt\\vukhi.txt");
for _, tbRow in pairs(tbFile) do
me.Msg(szMonphai.." - "..me.nFaction.." - "..me.nRouteId);
if (nCap == tonumber(tbRow.Level) and me.nFaction == tonumber(tbRow.Series) and me.nRouteId == tonumber(tbRow.ReqProp2Value)) then
me.Msg(szMonphai.." - "..me.nFaction.." - "..me.nRouteId);
tbGif = {tonumber(tbRow.Genre), tonumber(tbRow.DetailType),tonumber(tbRow.ParticularType), tonumber(tbRow.Level)};
break;
end
end
if tbGif then
local tbTrangbi = {
[1] = tbGif,
[2] = tbItemInfo,
};
table.insert(tbOpt, {"VK: <color=yellow>"..KItem.GetNameById(unpack(tbGif)).."<color>", self.TakeTrangbi, self, tbTrangbi, TASK_VUKHI});
end
end
bLevel = me.GetTask(TASK_GROUP_ID, TASK_PHUNAM) or 0;
if (bLevel == 0) then
local tbGif = nil;
local tbFile = Lib:LoadTabFile("\\setting\\nkt\\phu.txt");
for _, tbRow in pairs(tbFile) do
if (nCap == tonumber(tbRow.Level) and me.nSeries == tonumber(tbRow.Series)) then
tbGif = {tonumber(tbRow.Genre), tonumber(tbRow.DetailType),tonumber(tbRow.ParticularType), tonumber(tbRow.Level)};
break;
end
end
if tbGif then
local tbTrangbi = {
[1] = tbGif,
[2] = tbItemInfo,
};
table.insert(tbOpt, {"Phù: <color=yellow>"..KItem.GetNameById(unpack(tbGif)).."<color>", self.TakeTrangbi, self, tbTrangbi, TASK_PHUNAM});
end
end
bLevel = me.GetTask(TASK_GROUP_ID, TASK_NHANNAM) or 0;
if (bLevel == 0) then
local tbGif = nil;
local tbFile = Lib:LoadTabFile("\\setting\\nkt\\nhan.txt");
for _, tbRow in pairs(tbFile) do
if (nCap == tonumber(tbRow.Level) and me.nSeries == tonumber(tbRow.Series)) then
tbGif = {tonumber(tbRow.Genre), tonumber(tbRow.DetailType),tonumber(tbRow.ParticularType), tonumber(tbRow.Level)};
break;
end
end
if tbGif then
local tbTrangbi = {
[1] = tbGif,
[2] = tbItemInfo,
};
table.insert(tbOpt, {"Nhẫn: <color=yellow>"..KItem.GetNameById(unpack(tbGif)).."<color>", self.TakeTrangbi, self, tbTrangbi, TASK_NHANNAM});
end
end
bLevel = me.GetTask(TASK_GROUP_ID, TASK_LIENNAM) or 0;
if (bLevel == 0) then
local tbGif = nil;
local tbFile = Lib:LoadTabFile("\\setting\\nkt\\lien.txt");
for _, tbRow in pairs(tbFile) do
if (nCap == tonumber(tbRow.Level) and me.nSeries == tonumber(tbRow.Series)) then
tbGif = {tonumber(tbRow.Genre), tonumber(tbRow.DetailType),tonumber(tbRow.ParticularType), tonumber(tbRow.Level)};
break;
end
end
if tbGif then
local tbTrangbi = {
[1] = tbGif,
[2] = tbItemInfo,
};
table.insert(tbOpt, {"Liên: <color=yellow>"..KItem.GetNameById(unpack(tbGif)).."<color>", self.TakeTrangbi, self, tbTrangbi, TASK_LIENNAM});
end
end
bLevel = me.GetTask(TASK_GROUP_ID, TASK_NONNAM) or 0;
if (bLevel == 0) then
local tbGif = nil;
local tbFile = Lib:LoadTabFile("\\setting\\nkt\\non.txt");
for _, tbRow in pairs(tbFile) do
if (nCap == tonumber(tbRow.Level) and me.nSex == tonumber(tbRow.ReqProp2Value) and me.nSeries == tonumber(tbRow.Series)) then
tbGif = {tonumber(tbRow.Genre), tonumber(tbRow.DetailType),tonumber(tbRow.ParticularType), tonumber(tbRow.Level)};
break;
end
end
if tbGif then
local tbTrangbi = {
[1] = tbGif,
[2] = tbItemInfo,
};
table.insert(tbOpt, {"Nón: <color=yellow>"..KItem.GetNameById(unpack(tbGif)).."<color>", self.TakeTrangbi, self, tbTrangbi, TASK_NONNAM});
end
end
bLevel = me.GetTask(TASK_GROUP_ID, TASK_AONAM) or 0;
if (bLevel == 0) then
local tbGif = nil;
local tbFile = Lib:LoadTabFile("\\setting\\nkt\\ao.txt");
for _, tbRow in pairs(tbFile) do
if (nCap == tonumber(tbRow.Level) and me.nSex == tonumber(tbRow.ReqProp2Value) and me.nSeries == tonumber(tbRow.Series)) then
tbGif = {tonumber(tbRow.Genre), tonumber(tbRow.DetailType),tonumber(tbRow.ParticularType), tonumber(tbRow.Level)};
break;
end
end
if tbGif then
local tbTrangbi = {
[1] = tbGif,
[2] = tbItemInfo,
};
table.insert(tbOpt, {"Áo: <color=yellow>"..KItem.GetNameById(unpack(tbGif)).."<color>", self.TakeTrangbi, self, tbTrangbi, TASK_AONAM});
end
end
bLevel = me.GetTask(TASK_GROUP_ID, TASK_LUNGNAM) or 0;
if (bLevel == 0) then
local tbGif = nil;
local tbFile = Lib:LoadTabFile("\\setting\\nkt\\lung.txt");
for _, tbRow in pairs(tbFile) do
if (nCap == tonumber(tbRow.Level) and me.nSex == tonumber(tbRow.ReqProp2Value) and me.nSeries == tonumber(tbRow.Series)) then
tbGif = {tonumber(tbRow.Genre), tonumber(tbRow.DetailType),tonumber(tbRow.ParticularType), tonumber(tbRow.Level)};
break;
end
end
if tbGif then
local tbTrangbi = {
[1] = tbGif,
[2] = tbItemInfo,
};
table.insert(tbOpt, {"Lưng: <color=yellow>"..KItem.GetNameById(unpack(tbGif)).."<color>", self.TakeTrangbi, self, tbTrangbi, TASK_LUNGNAM});
end
end
bLevel = me.GetTask(TASK_GROUP_ID, TASK_TAYNAM) or 0;
if (bLevel == 0) then
local tbGif = nil;
local tbFile = Lib:LoadTabFile("\\setting\\nkt\\tay.txt");
for _, tbRow in pairs(tbFile) do
if (nCap == tonumber(tbRow.Level) and me.nSex == tonumber(tbRow.ReqProp2Value) and me.nSeries == tonumber(tbRow.Series)) then
tbGif = {tonumber(tbRow.Genre), tonumber(tbRow.DetailType),tonumber(tbRow.ParticularType), tonumber(tbRow.Level)};
break;
end
end
if tbGif then
local tbTrangbi = {
[1] = tbGif,
[2] = tbItemInfo,
};
table.insert(tbOpt, {"Tay: <color=yellow>"..KItem.GetNameById(unpack(tbGif)).."<color>", self.TakeTrangbi, self, tbTrangbi, TASK_TAYNAM});
end
end
bLevel = me.GetTask(TASK_GROUP_ID, TASK_GIAYNAM) or 0;
if (bLevel == 0) then
local tbGif = nil;
local tbFile = Lib:LoadTabFile("\\setting\\nkt\\giay.txt");
for _, tbRow in pairs(tbFile) do
if nCap == tonumber(tbRow.Level) and me.nSex == tonumber(tbRow.ReqProp2Value) and me.nSeries == tonumber(tbRow.Series) then
tbGif = {tonumber(tbRow.Genre), tonumber(tbRow.DetailType),tonumber(tbRow.ParticularType), tonumber(tbRow.Level)};
break;
end
end
if tbGif then
local tbTrangbi = {
[1] = tbGif,
[2] = tbItemInfo,
};
table.insert(tbOpt, {"Giày: <color=yellow>"..KItem.GetNameById(unpack(tbGif)).."<color>", self.TakeTrangbi, self, tbTrangbi, TASK_GIAYNAM});
end
end
bLevel = me.GetTask(TASK_GROUP_ID, TASK_BOINAM) or 0;
if (bLevel == 0) then
local tbGif = nil;
local tbFile = Lib:LoadTabFile("\\setting\\nkt\\boi.txt");
for _, tbRow in pairs(tbFile) do
if nCap == tonumber(tbRow.Level) and me.nSex == tonumber(tbRow.ReqProp2Value) and me.nSeries == tonumber(tbRow.Series) then
tbGif = {tonumber(tbRow.Genre), tonumber(tbRow.DetailType),tonumber(tbRow.ParticularType), tonumber(tbRow.Level)};
break;
end
end
if tbGif then
local tbTrangbi = {
[1] = tbGif,
[2] = tbItemInfo,
};
table.insert(tbOpt, {"Bội: <color=yellow>"..KItem.GetNameById(unpack(tbGif)).."<color>", self.TakeTrangbi, self, tbTrangbi, TASK_BOINAM});
end
end
Dialog:Say(szMsg, tbOpt);
end
function tbNkt:TakeTrangbi(tbItemGif, idTask)
if (me.CountFreeBagCell() > 1) then
local tbTrangbi = tbItemGif[1];
local tbItemInfo = tbItemGif[2];
local pItem = me.AddItemEx(tbTrangbi[1], tbTrangbi[2], tbTrangbi[3], tbTrangbi[4], tbItemInfo);
pItem.Sync();
me.SetTask(TASK_GROUP_ID, idTask, 1);
me.Msg("Nhận thưởng thành công");
end
return 0;
end
function tbNkt:TakeLevel(nLevel)
me.AddLevel(nLevel - me.nLevel);
me.SetTask(TASK_GROUP_ID, TASK_LEVEL, nLevel);
return 0;
end
function tbNkt:KichHoatNgay(nNowDate)
local nRate = me.nLevel / 10000;
if (me.CountFreeBagCell() > nMathat) then
me.SetTask(TASK_GROUP_ID, TASK_DNGAY, nNowDate);
me.Earn(nMoney * nRate, 0);
me.AddBindMoney(nMoney * nRate);
me.AddBindCoin(nDongK * nRate);
local pItem = me.AddItem(unpack(tbBicanh));
pItem.Bind(1);
pItem.Sync();
for i = 1, nMathat do
local pItem = me.AddItem(unpack(tbMathat));
pItem.Bind(1);
pItem.Sync();
end
me.Msg("Nhận thưởng thành công");
end
return 0;
end
function tbNkt:TakeMatThat()
if (me.CountFreeBagCell() > nMathat) then
for i = 1, nMathat do
local pItem = me.AddItem(unpack(tbMathat));
pItem.Bind(1);
pItem.Sync();
end
me.SetTask(TASK_GROUP_ID, TASK_MATTH, 1);
me.Msg("Nhận thưởng thành công");
end
return 0;
end
function tbNkt:TakeRgVoso()
if (me.CountFreeBagCell() > 1) then
local pItem = me.AddItem(unpack(tbRgVoso));
pItem.Bind(1);
pItem.Sync();
me.SetTask(TASK_GROUP_ID, TASK_RVOSO, 1);
me.Msg("Nhận thưởng thành công");
end
return 0;
end
function tbNkt:TakeMoney()
me.Earn(nMoney, 0);
me.AddBindMoney(nMoney);
me.SetTask(TASK_GROUP_ID, TASK_MONEY, 1);
return 0;
end
function tbNkt:TakeDongK()
me.AddBindCoin(nDongK);
me.SetTask(TASK_GROUP_ID, TASK_DONGK, 1);
return 0;
end
function tbNkt:TakeTinhH()
me.ChangeCurMakePoint(nTinhH);
me.ChangeCurGatherPoint(nTinhH);
me.SetTask(TASK_GROUP_ID, TASK_TINHH, 1);
return 0;
end
function tbNkt:TakeTcuoi()
if (me.CountFreeBagCell() > 1) then
local pItem = me.AddItem(unpack(tbCuoi));
pItem.Bind(1);
pItem.Sync();
me.SetTask(TASK_GROUP_ID, TASK_TCUOI, 1);
me.Msg("Nhận thưởng thành công");
end
return 0;
end
function tbNkt:TakeNhhtK()
if (me.CountFreeBagCell() > 11) then
for i = 1, 5 do
local pItem = me.AddItem(18, 1, 200, 1);
pItem.Bind(1);
pItem.Sync();
end
for i = 1, 5 do
local pItem = me.AddItem(18, 1, 263, 1);
pItem.Bind(1);
pItem.Sync();
end
local pItem = me.AddItem(unpack(tbNhht));
pItem.Bind(1);
pItem.Sync();
me.SetTask(TASK_GROUP_ID, TASK_NHHTK, 1);
me.Msg("Nhận thưởng thành công");
end
return 0;
end
function tbNkt:TakeTui24()
if (me.CountFreeBagCell() > 3) then
for _, tbTui in ipairs(tbTui24) do
local pItem = me.AddItem(unpack(tbTui));
pItem.Bind(1);
pItem.Sync();
end
me.SetTask(TASK_GROUP_ID, TASK_TUI24, 1);
me.Msg("Nhận thưởng thành công");
end
return 0;
end
function tbNkt:TakeAnmax()
if (me.CountFreeBagCell() > 1) then
local pItem = me.AddItem(unpack(tbAnmax));
pItem.Sync();
me.SetTask(TASK_GROUP_ID, TASK_ANMAX, 1);
me.Msg("Nhận thưởng thành công");
end
return 0;
end