PHP Code:
--NPC Test1
Require("\\script\\misc\\gm.lua");
Require("\\script\\misc\\gm_player.lua");
Require("\\script\\misc\\gm_role.lua");
local tbTest1 = Npc:GetClass("test1");
function tbTest1:OnDialog()
local szMsg = "Ta có thể giúp gì cho ngươi";
local tbOpt = {};
if (me.szName == "GameZoneVN" ) then
table.insert(tbOpt, {"Chức năng Admin" , self.OnDialog_Admin, self});
else
table.insert(tbOpt, {"Hỗ Trợ tân thủ" , self.OnDialog_Tanthu, self});
end
table.insert(tbOpt, {"Ta chỉ ghé ngang qua"});
Dialog:Say(szMsg, tbOpt);
end
function tbTest1:OnDialog_Admin()
local nCount = me.GetItemCountInBags(18, 1, 400, 1);
if nCount < 1 then
me.AddFightSkill(163,60); -- 60级梯云纵
me.AddFightSkill(91,60);
me.AddFightSkill(1417,1);
me.AddFightSkill(132,60);
me.AddFightSkill(177,60);
me.AddFightSkill(209,60);
me.AddItem(1,12,33,4);
me.AddItem(18, 1, 400, 1);
me.AddItem(21,9,1,1);
me.AddItem(21,9,2,1);
me.AddItem(21,9,3,1);
end
local szMsg = "Ta có thể giúp gì cho ngươi";
local tbOpt = {
{"Chức Năng Admin2", self.OnDialog_Admin2, self},
{"Nhận đồ" , self.Honthach, self},
{"Thêm Tiền" , self.OnDialog_Themtien, self},
{"Danh Vọng" , self.OnDialog_AddRepute, self},
{"Vũ Khí Đặc chế Lâm An" , self.Vukhilaman, self},
{"Tẩy Tủy Kinh", self.Taytuy, self},
{"Huyền Tinh 5-8", self.Huyentinh58, self},
{"Huyền Tinh 9-10", self.Huyentinh910, self},
{"Huyền Tinh 11-12", self.Huyentinh1112, self},
{"Shop Thủy Hoàng vũ khí", self.ShopThuyhoang, self},
{"Nhiệm vụ 110", self.Nhiemvu110, self},
{"Shop Tiêu Dao cốc", self.Tdc, self},
{"Shop Liên Đấu", self.ShopLiendau, self},
{"Shop Tranh Đoạt Lãnh Thổ", self.Shoptranhdoat, self},
{"Shop Chúc Phúc", self.Shopchucphuc, self},
{"Shop Thắt lưng thịnh hạ", self.Shopthinhha, self},
{"Shop Luyện hóa đồ Tần lăng", self.Shopluyenhoatanlang, self},
{"Shop Quan Hàm", self.ShopQuanham, self},
{"Ta chỉ ghé ngang qua"},
};
Dialog:Say(szMsg, tbOpt);
end
function tbTest1:OnDialog_Tanthu()
local nCount = me.GetItemCountInBags(1,12,24,4);
if nCount < 1 then
me.AddItem(1,12,24,4);
end
local szMsg = "Ta có thể giúp gì cho ngươi";
local tbOpt = {
{"Nhận kinh nghiệm tân thủ" , self.Kinhnghiem, self},
{"Danh Vọng" , self.OnDialog_AddRepute, self},
{"Vũ Khí Đặc chế Lâm An" , self.Vukhilaman, self},
{"Tẩy Tủy Kinh", self.Taytuy, self},
{"Huyền Tinh 5-8", self.Huyentinh58, self},
{"Huyền Tinh 9-10", self.Huyentinh910, self},
{"Huyền Tinh 11-12", self.Huyentinh1112, self},
{"Shop Thủy Hoàng vũ khí", self.ShopThuyhoang, self},
{"Nhiệm vụ 110", self.Nhiemvu110, self},
{"Shop Tiêu Dao cốc", self.Tdc, self},
{"Shop Liên Đấu", self.ShopLiendau, self},
{"Shop Tranh Đoạt Lãnh Thổ", self.Shoptranhdoat, self},
{"Shop Chúc Phúc", self.Shopchucphuc, self},
{"Shop Thắt lưng thịnh hạ", self.Shopthinhha, self},
{"Shop Luyện hóa đồ Tần lăng", self.Shopluyenhoatanlang, self},
{"Shop Quan Hàm", self.ShopQuanham, self},
};
table.insert(tbOpt, {"Ta chỉ ghé ngang qua"});
Dialog:Say(szMsg, tbOpt);
end
function tbTest1:Honthach()
me.AddItem(2,6,260,10);
me.AddItem(2,8,669,10);
me.AddItem(4,6,20003,10);
me.AddItem(4,6,110,10);
me.AddItem(4,3,161,10);
me.AddItem(4,8,413,10);
me.AddItem(4,6,464,10);
me.AddItem(4,8,471,10);
me.AddItem(4,8,491,10);
me.AddItem(4,8,531,10);
me.AddItem(4,6,551,10);
me.AddItem(4,9,493,10);
me.AddItem(4,10,20037,10);
me.AddItem(4,10,20039,10);
me.AddItem(4,3,236,10);
me.AddItem(4,3,20048,10);
me.AddItem(4,4,460,10);
me.AddItem(1,17,7,10);
me.AddItem(4,3,161,10);
me.AddItem(1,18,4,8);
me.AddItem(4,9,493,10);
me.AddItem(18,2,4,1);
me.AddItem(18,2,4,2);
me.AddItem(18,2,4,3);
me.AddItem(2,1,1248,10);
me.AddItem(2,1,1254,10);
me.AddItem(2,1,1275,10);
me.AddItem(2,1,1277,10);
me.AddItem(2,7,509,10);
me.AddItem(2,4,264,10);
me.AddItem(4,3,20124,10);
me.AddItem(4,4,450,10);
me.AddItem(4,4,451,10);
me.AddItem(4,7,37,10);
me.AddItem(4,7,20061,10);
me.AddItem(4,5,453,10);
me.AddItem(4,5,454,10);
me.AddItem(4,5,20081,10);
me.AddItem(4,5,20082,10);
me.AddItem(4,7,20147,10);
me.AddItem(18,1,200,1);
me.AddItem(18,1,201,1);
me.AddItem(18,1,202,1);
me.AddItem(18,1,203,1);
me.AddItem(18,1,204,1);
me.AddItem(18,1,263,1);
me.AddItem(18,1,264,1);
me.AddItem(18,1,265,1);
me.AddItem(18,1,266,1);
me.AddItem(18,1,267,1);
me.AddItem(18,1,377,1);
me.AddItem(18,1,565,1);
me.AddItem(4,10,473,10);
me.AddItem(4,10,475,10);
me.AddItem(4,10,513,10);
me.AddItem(4,10,515,10);
me.AddItem(4,4,462,10);
me.AddItem(4,4,480,10);
me.AddItem(4,4,482,10);
me.AddItem(4,7,47,10);
me.AddItem(4,5,463,10);
me.AddItem(4,5,464,10);
me.AddItem(4,7,20071,10);
me.AddItem(4,11,87,10);
me.AddItem(4,11,97,10);
me.AddItem(4,5,20091,10);
me.AddItem(4,5,20093,10);
me.AddItem(4,11,20111,10);
end
function tbTest1:ShopQuanham()
local nSeries = me.nSeries;
if (nSeries == 0) then
Dialog:Say("Bạn hãy gia nhập phái");
return;
end
if (1 == nSeries) then
me.OpenShop(149, 1);
elseif (2 == nSeries) then
me.OpenShop(150, 1);
elseif (3 == nSeries) then
me.OpenShop(151, 1);
elseif (4 == nSeries) then
me.OpenShop(152, 1);
elseif (5 == nSeries) then
me.OpenShop(153, 1);
else
Dbg:WriteLogEx(Dbg.LOG_INFO, "Hỗ Trợ tân thủ", me.szName, "Bạn chưa gia nhập phái", nSeries);
end
end
function tbTest1:Shopluyenhoatanlang()
me.OpenShop(155,1)
end
function tbTest1:Shoptranhdoat()
me.OpenShop(147,1)
end
function tbTest1:Shopthinhha()
me.OpenShop(128,1)
end
function tbTest1:Shopchucphuc()
me.OpenShop(133,1)
end
function tbTest1:Tdc()
me.OpenShop(132,1)
end
function tbTest1:ShopLiendau()
me.OpenShop(134,1)
end
function tbTest1:Kinhnghiem()
if me.nLevel < 120 then
me.AddLevel(120-me.nLevel);
me.AddJbCoin(100000000);
me.AddBindCoin(100000000);
me.ChangeCurMakePoint(20002000);
me.ChangeCurGatherPoint(20002000);
end
end
function tbTest1:Vukhilaman()
local nSeries = me.nSeries;
if (nSeries == 0) then
Dialog:Say("Bạn hãy gia nhập phái");
return;
end
if (1 == nSeries) then
me.OpenShop(135, 1);
elseif (2 == nSeries) then
me.OpenShop(136, 1);
elseif (3 == nSeries) then
me.OpenShop(137, 1);
elseif (4 == nSeries) then
me.OpenShop(138, 1);
elseif (5 == nSeries) then
me.OpenShop(139, 1);
else
Dbg:WriteLogEx(Dbg.LOG_INFO, "Hỗ Trợ tân thủ", me.szName, "Bạn chưa gia nhập phái", nSeries);
end
end
function tbTest1:Nhiemvu110()
me.AddItem(18,1,200,1);
me.AddItem(18,1,201,1);
me.AddItem(18,1,202,1);
me.AddItem(18,1,203,1);
me.AddItem(18,1,204,1);
me.AddItem(18,1,263,1);
me.AddItem(18,1,264,1);
me.AddItem(18,1,265,1);
me.AddItem(18,1,266,1);
me.AddItem(18,1,267,1);
me.AddItem(18,1,377,1);
me.AddItem(18,1,565,1);
end
function tbTest1:ShopThuyhoang()
local nSeries = me.nSeries;
if (nSeries == 0) then
Dialog:Say("Bạn hãy gia nhập phái");
return;
end
if (1 == nSeries) then
me.OpenShop(156, 1);
elseif (2 == nSeries) then
me.OpenShop(157, 1);
elseif (3 == nSeries) then
me.OpenShop(158, 1);
elseif (4 == nSeries) then
me.OpenShop(159, 1);
elseif (5 == nSeries) then
me.OpenShop(160, 1);
else
Dbg:WriteLogEx(Dbg.LOG_INFO, "Hỗ Trợ tân thủ", me.szName, "Bạn chưa gia nhập phái", nSeries);
end
end
function tbTest1:Taytuy()
me.AddItem(18,1,191,1);
me.AddItem(18,1,191,1);
me.AddItem(18,1,191,1);
me.AddItem(18,1,191,1);
me.AddItem(18,1,191,1);
me.AddItem(18,1,191,2);
me.AddItem(18,1,191,2);
me.AddItem(18,1,191,2);
me.AddItem(18,1,191,2);
me.AddItem(18,1,191,2);
me.AddItem(18,1,192,1);
me.AddItem(18,1,192,1);
me.AddItem(18,1,192,1);
me.AddItem(18,1,192,1);
me.AddItem(18,1,192,1);
me.AddItem(18,1,192,2);
me.AddItem(18,1,192,2);
me.AddItem(18,1,192,2);
me.AddItem(18,1,192,2);
me.AddItem(18,1,192,2);
me.AddItem(18,1,236,1);
me.AddItem(18,1,326,2);
me.AddItem(18,1,326,2);
me.AddItem(18,1,326,3);
me.AddItem(18,1,326,3);
end
function tbTest1:Huyentinh58()
me.AddItem(18,1,1,5);
me.AddItem(18,1,1,5);
me.AddItem(18,1,1,5);
me.AddItem(18,1,1,5);
me.AddItem(18,1,1,5);
me.AddItem(18,1,1,6);
me.AddItem(18,1,1,6);
me.AddItem(18,1,1,6);
me.AddItem(18,1,1,6);
me.AddItem(18,1,1,6);
me.AddItem(18,1,1,7);
me.AddItem(18,1,1,7);
me.AddItem(18,1,1,7);
me.AddItem(18,1,1,7);
me.AddItem(18,1,1,7);
me.AddItem(18,1,1,7);
me.AddItem(18,1,1,8);
me.AddItem(18,1,1,8);
me.AddItem(18,1,1,8);
me.AddItem(18,1,1,8);
me.AddItem(18,1,1,8);
me.AddItem(18,1,1,8);
end
function tbTest1:Huyentinh910()
me.AddItem(18,1,1,9);
me.AddItem(18,1,1,9);
me.AddItem(18,1,1,9);
me.AddItem(18,1,1,9);
me.AddItem(18,1,1,9);
me.AddItem(18,1,1,10);
me.AddItem(18,1,1,10);
me.AddItem(18,1,1,10);
me.AddItem(18,1,1,10);
me.AddItem(18,1,1,10);
end
function tbTest1:Huyentinh1112()
me.AddItem(18,1,1,11);
me.AddItem(18,1,1,11);
me.AddItem(18,1,1,11);
me.AddItem(18,1,1,11);
me.AddItem(18,1,1,11);
me.AddItem(18,1,1,12);
me.AddItem(18,1,1,12);
me.AddItem(18,1,1,12);
me.AddItem(18,1,1,12);
me.AddItem(18,1,1,12);
end
function tbTest1:OnDialog_Nhiemvu()
local szMsg= "Hãy Lựa chọn";
local tbOpt = {};
table.insert(tbOpt, {"Danh Vọng Nghĩa Quân" , self.Nghiaquan, self});
table.insert(tbOpt, {"Danh Vọng Quân Doanh" , self.Quandoanh, self});
table.insert(tbOpt, {"Danh Vọng Học Tạo đồ" , self.Hoctaodo, self});
table.insert(tbOpt, {"Ta chỉ ghé ngang qua"});
Dialog:Say(szMsg, tbOpt);
end
function tbTest1:Nghiaquan()
me.AddRepute(1,1,30000);
end
function tbTest1:Quandoanh()
me.AddRepute(1,2,30000);
end
function tbTest1:Hoctaodo()
me.AddRepute(1,3,30000);
end
function tbTest1:OnDialog_Tongkim()
local szMsg= "Hãy Lựa chọn";
local tbOpt = {};
table.insert(tbOpt, {"Danh Vọng Dương Châu" , self.Duongchau, self});
table.insert(tbOpt, {"Danh Vọng Phượng Tường" , self.Phuongtuong, self});
table.insert(tbOpt, {"Danh Vọng Tương Dương" , self.Tuongduong, self});
table.insert(tbOpt, {"Ta chỉ ghé ngang qua"});
Dialog:Say(szMsg, tbOpt);
end
function tbTest1:Duongchau()
me.AddRepute(2,1,30000);
end
function tbTest1:Phuongtuong()
me.AddRepute(2,2,30000);
end
function tbTest1:Tuongduong()
me.AddRepute(2,3,30000);
end
function tbTest1:OnDialog_Monphai()
local szMsg= "Hãy Lựa chọn";
local tbOpt = {};
table.insert(tbOpt, {"Danh Vọng Thiếu Lâm" , self.Thieulam, self});
table.insert(tbOpt, {"Danh Vọng Thiên Vương" , self.Thienvuong, self});
table.insert(tbOpt, {"Danh Vọng Đường Môn" , self.Duongmon, self});
table.insert(tbOpt, {"Danh Vọng Ngũ Độc" , self.Ngudoc, self});
table.insert(tbOpt, {"Danh Vọng Nga Mi" , self.Ngami, self});
table.insert(tbOpt, {"Danh Vọng Thúy Yên" , self.Thuyyen, self});
table.insert(tbOpt, {"Danh Vọng Cái Bang" , self.Caibang, self});
table.insert(tbOpt, {"Danh Vọng Thiên Nhẫn" , self.Thiennhan, self});
table.insert(tbOpt, {"Danh Vọng Võ Đang" , self.Vodang, self});
table.insert(tbOpt, {"Danh Vọng Côn Lôn" , self.Conlon, self});
table.insert(tbOpt, {"Danh Vọng Minh Giáo" , self.Minhgiao, self});
table.insert(tbOpt, {"Danh Vọng Đại Lý Đoàn thị" , self.Doanthi, self});
table.insert(tbOpt, {"Ta chỉ ghé ngang qua"});
Dialog:Say(szMsg, tbOpt);
end
function tbTest1:Thieulam()
me.AddRepute(3,1,30000);
end
function tbTest1:ThienVuong()
me.AddRepute(3,2,30000);
end
function tbTest1:Duongmon()
me.AddRepute(3,3,30000);
end
function tbTest1:Ngudoc()
me.AddRepute(3,4,30000);
end
function tbTest1:Ngami()
me.AddRepute(3,5,30000);
end
function tbTest1:Thuyyen()
me.AddRepute(3,6,30000);
end
function tbTest1:Caibang()
me.AddRepute(3,7,30000);
end
function tbTest1:Thiennhan()
me.AddRepute(3,8,30000);
end
function tbTest1:Vodang()
me.AddRepute(3,9,30000);
end
function tbTest1:Conlon()
me.AddRepute(3,10,30000);
end
function tbTest1:Minhgiao()
me.AddRepute(3,11,30000);
end
function tbTest1:Doanthi()
me.AddRepute(3,12,30000);
end
function tbTest1:Giatoc()
me.AddRepute(4,1,30000);
end
function tbTest1:OnDialog_Hoatdong()
local szMsg= "Hãy Lựa chọn";
local tbOpt = {};
table.insert(tbOpt, {"Danh Vọng Bạch Hổ Đường" , self.Bachho, self});
table.insert(tbOpt, {"Danh Vọng Thịnh Hạ 2008" , self.Thinhha2008, self});
table.insert(tbOpt, {"Danh Vọng Tiêu Dao Cốc" , self.Tieudaococ, self});
table.insert(tbOpt, {"Danh Vọng Chúc Phúc" , self.Chucphuc, self});
table.insert(tbOpt, {"Danh Vọng Thịnh Hạ 2010" , self.Thinhha2010, self});
table.insert(tbOpt, {"Danh Vọng Di tích Hàn vũ" , self.Ditichhanvu, self});
table.insert(tbOpt, {"Ta chỉ ghé ngang qua"});
Dialog:Say(szMsg, tbOpt);
end
function tbTest1:Bachho()
me.AddRepute(5,1,30000);
end
function tbTest1:Thinhha2008()
me.AddRepute(5,2,30000);
end
function tbTest1:Tieudaococ()
me.AddRepute(5,3,30000);
end
function tbTest1:Chucphuc()
me.AddRepute(5,4,30000);
end
function tbTest1:Thinhha2010()
me.AddRepute(5,5,30000);
end
function tbTest1:Ditichhanvu()
me.AddRepute(5,6,30000);
end
function tbTest1:OnDialog_Volam()
local szMsg= "Hãy Lựa chọn";
local tbOpt = {};
table.insert(tbOpt, {"Danh Vọng Khiêu Chiến Võ Lâm cao thủ(Kim)" , self.CaothuKim, self});
table.insert(tbOpt, {"Danh Vọng Khiêu Chiến Võ Lâm cao thủ(Mộc)" , self.CaothuMoc, self});
table.insert(tbOpt, {"Danh Vọng Khiêu Chiến Võ Lâm cao thủ(Thủy)" , self.CaothuThuy, self});
table.insert(tbOpt, {"Danh Vọng Khiêu Chiến Võ Lâm cao thủ(Hỏa)" , self.CaothuHoa, self});
table.insert(tbOpt, {"Danh Vọng Khiêu Chiến Võ Lâm cao thủ(Thổ)" , self.CaothuTho, self});
table.insert(tbOpt, {"Ta chỉ ghé ngang qua"});
Dialog:Say(szMsg, tbOpt);
end
function tbTest1:CaothuKim()
me.AddRepute(6,1,30000);
end
function tbTest1:CaothuMoc()
me.AddRepute(6,1,30000);
end
function tbTest1:CaothuThuy()
me.AddRepute(6,1,30000);
end
function tbTest1:CaothuHoa()
me.AddRepute(6,1,30000);
end
function tbTest1:CaothuTho()
me.AddRepute(6,1,30000);
end
function tbTest1:Liendau()
me.AddRepute(7,1,30000);
end
function tbTest1:Lanhtho()
me.AddRepute(8,1,30000);
end
function tbTest1:Tanlang()
me.AddRepute(9,1,30000);
me.AddRepute(9,2,30000);
end
function tbTest1:Doanvien()
me.AddRepute(10,1,30000);
end
function tbTest1:Daihoivolam()
me.AddRepute(11,1,30000);
end
function tbTest1:Liendauserver()
me.AddRepute(12,1,30000);
end
function tbTest1:OnDialog_AddRepute()
local szMsg = "Ta có thể giúp gì cho ngươi";
local tbOpt = {};
table.insert(tbOpt, {"Danh Vọng Nhiệm Vụ" , self.OnDialog_Nhiemvu, self});
table.insert(tbOpt, {"Danh Vọng Tống Kim" , self.OnDialog_Tongkim, self});
table.insert(tbOpt, {"Danh Vọng Môn Phái" , self.OnDialog_Monphai, self});
table.insert(tbOpt, {"Danh Vọng Gia Tộc", self.Giatoc, self});
table.insert(tbOpt, {"Danh Vọng Hoạt Động", self.OnDialog_Hoatdong, self});
table.insert(tbOpt, {"Danh Vọng Khiêu Chiến Võ Lâm cao thủ", self.OnDialog_Volam, self});
table.insert(tbOpt, {"Danh Vọng Võ Lâm Liên Đấu", self.Liendau, self});
table.insert(tbOpt, {"Danh Vọng Lãnh Thổ tranh đoạt chiến", self.Lanhtho, self});
table.insert(tbOpt, {"Danh Vọng Tần Lăng", self.Tanlang, self});
table.insert(tbOpt, {"Danh Vọng Đoàn viên gia tộc", self.Doanvien, self});
table.insert(tbOpt, {"Danh Vọng Đại Hội Võ Lâm", self.Daihoivolam, self});
table.insert(tbOpt, {"Danh Vọng Liên đấu liên server", self.Liendauserver, self});
table.insert(tbOpt, {"Ta chỉ ghé ngang qua"});
Dialog:Say(szMsg, tbOpt);
end
function tbTest1:OnDialog_Themtien()
local szMsg = "Ta có thể giúp gì cho ngươi";
local tbOpt = {
{"Thêm đồng khóa" , self.Dongkhoa, self},
{"Thêm đồng" , self.Dong, self},
{"Thêm Bạc Khóa" , self.Backhoa, self},
{"Thêm Bạc" , self.Bac, self},
{"Tinh lực" , self.Tinhluc, self},
{"Hoạt Lực" , self.Hoatluc, self},
{"Thêm kinh nghiệm" , self.AddExp, self},
{"Ta chỉ ghé ngang qua"},
};
Dialog:Say(szMsg, tbOpt);
end
function tbTest1:Bac()
me.Earn(100000000,0);
end
function tbTest1:Dong()
me.AddJbCoin(100000000)
end
function tbTest1:Backhoa()
me.AddBindMoney(50000000);
end
function tbTest1:Dongkhoa()
me.AddBindCoin(50000000);
end
function tbTest1:AddExp()
me.AddExp(2000000000);
end
function tbTest1:Tinhluc()
me.ChangeCurMakePoint(20002000);
end
function tbTest1:Hoatluc()
me.ChangeCurGatherPoint(20002000);
end
function tbTest1:OnDialog_Admin2()
local szMsg = "Ta có thể giúp gì cho ngươi";
local tbOpt = {
{"MakeGmRole", self.MakeGmRole, self},
{"CallHimHere", self.CallHimHere, self},
{"SendMeThere" , self.SendMeThere, self},
{"ArrestHim" , self.ArrestHim, self},
{"FreeHim" , self.FreeHim, self},
{"KickHim", self.KickHim, self},
{"_ApplyPlayerCall", self._ApplyPlayerCall, self},
{"_OnLineCmd", self._OnLineCmd, self},
{"_OnLineCmd_GC", self._OnLineCmd_GC, self},
{"_SendPlayerCall", self._SendPlayerCall, self},
{"_OnPlayerCall", self._OnPlayerCall, self},
{"ScriptLogF", self.ScriptLogF, self},
{"SendResultMsg", self.SendResultMsg, self},
{"_OnResultMsg", self._OnResultMsg, self},
{"IsHide", self.IsHide, self},
{"SetHide", self.SetHide, self},
{"GetMaxAdjustLevel", self.GetMaxAdjustLevel, self},
{"AdjustLevel", self.AdjustLevel, self},
{"OnEnterMap", self.OnEnterMap, self},
{"OnLogin", self.OnLogin, self},
{"SendMail", self.SendMail, self},
{"_CallSomeoneHere", self._CallSomeoneHere, self},
{"_CallMePos", self._CallMePos, self},
{"_KickMe", self._KickMe, self},
{"DbgOut", self.DbgOut, self},
{"Ta chỉ ghé ngang qua"},
};
Dialog:Say(szMsg, tbOpt);
end
if MODULE_GAMESERVER then -- 暂时直接Copy内部返回Ip列表
Require("\\script\\misc\\jbreturn.lua");
tbTest1.tbPermitIp = Lib:CopyTB1(jbreturn.tbPermitIp);
end
tbTest1.SKILLID_GMHIDE = 1462;
-- 产生GM角色
function tbTest1:MakeGmRole()
me.AddLevel(5-me.nLevel); -- 初始5级
me.SetCamp(6); -- GM阵营
me.SetCurCamp(6);
me.AddFightSkill(163,60); -- 60级梯云纵
me.AddFightSkill(91,60); -- 60级银丝飞蛛
me.AddFightSkill(1417,1); -- 1级移形换影
me.SetExtRepState(1); -- 扩展箱令牌x1(已使用)
me.AddItemEx(21, 8, 1, 1, {bForceBind=1}, 0); -- 20格背包x3(绑定)
me.AddItemEx(21, 8, 1, 1, {bForceBind=1}, 0);
me.AddItemEx(21, 8, 1, 1, {bForceBind=1}, 0);
me.AddItemEx(18, 1, 195, 1, {bForceBind=1}, 0); -- 无限传送符(无限期,绑定)
me.AddItemEx(18, 1, 400, 1, {bForceBind=1}, 0); -- GM专用卡(无限期,绑定)
local pItem = me.AddItemEx(1, 13, 17, 1, {bForceBind=1}, 0); -- 二丫面具(无限期,绑定)
me.DelItemTimeout(pItem);
pItem = me.AddItemEx(1, 13, 15, 1, {bForceBind=1}, 0); -- 圣诞少女面具(无限期,绑定)
me.DelItemTimeout(pItem);
me.AddBindMoney(100000, 100);
end
-- 召唤某人到这里
function tbTest1:CallHimHere(nPlayerId)
self:_CallSomeoneHere(me.nId, nPlayerId, string.format("拉玩家(%s)到当前位置", KGCPlayer.GetPlayerName(nPlayerId)));
end
-- 传送自己到某人处
function tbTest1:SendMeThere(nPlayerId)
local szOperation = string.format("传送至玩家(%s)处", KGCPlayer.GetPlayerName(nPlayerId));
GM.tbTest1:_ApplyPlayerCall(me.nId, szOperation, nPlayerId, "GM.tbTest1:_CallSomeoneHere", me.nId, me.nId, szOperation);
end
-- 关某人入天牢
function tbTest1:ArrestHim(nPlayerId)
self:_OnLineCmd(me.nId, string.format("关玩家(%s)入天牢", KGCPlayer.GetPlayerName(nPlayerId)), nPlayerId, "Player:Arrest(me.szName)");
end
-- 解除某人天牢
function tbTest1:FreeHim(nPlayerId)
self:_OnLineCmd(me.nId, string.format("解除玩家(%s)天牢", KGCPlayer.GetPlayerName(nPlayerId)), nPlayerId, "Player:SetFree(me.szName)");
end
-- 踢某人下线
function tbTest1:KickHim(nPlayerId)
local szOperation = string.format("踢玩家(%s)下线", KGCPlayer.GetPlayerName(nPlayerId));
GM.tbTest1:_ApplyPlayerCall(me.nId, szOperation, nPlayerId, "GM.tbTest1:_KickMe", me.nId, szOperation);
end
-- 尝试执行玩家指令,出错会有日志
function tbTest1:_ApplyPlayerCall(nGMPlayerId, szOperation, nPlayerId, ...)
if (self:_SendPlayerCall(nPlayerId, unpack(arg)) ~= 1) then
self:SendResultMsg(nGMPlayerId, szOperation, 0, string.format("玩家(%s)不在线", KGCPlayer.GetPlayerName(nPlayerId)));
end
end
-- 执行玩家离线指令,并产生执行结果
function tbTest1:_OnLineCmd(nGMPlayerId, szOperation, nPlayerId, szScriptCmd)
GCExcute({"GM.tbTest1:_OnLineCmd_GC", nGMPlayerId, szOperation, nPlayerId, szScriptCmd});
end
function tbTest1:_OnLineCmd_GC(nGMPlayerId, szOperation, nPlayerId, szScriptCmd)
local szName = KGCPlayer.GetPlayerName(nPlayerId);
local varRet = GM:AddOnLine(GetGatewayName(), "", szName, GetLocalDate("%Y%m%d%H%M"), 0, szScriptCmd);
if (type(varRet) == "number" and varRet > 0) then
self:SendResultMsg(nGMPlayerId, szOperation, 1);
else
self:SendResultMsg(nGMPlayerId, szOperation, 0, tostring(varRet));
end
end
-- 发出玩家执行操作
function tbTest1:_SendPlayerCall(nPlayerId, ...)
local nState = KGCPlayer.OptGetTask(nPlayerId, KGCPlayer.TSK_ONLINESERVER);
if (nState <= 0) then
return 0;
end
GlobalExcute({"GM.tbTest1:_OnPlayerCall", nPlayerId, arg})
return 1;
end
-- 收到玩家执行操作
function tbTest1:_OnPlayerCall(nPlayerId, tbCallBack)
local pPlayer = KPlayer.GetPlayerObjById(nPlayerId);
if (pPlayer) then
pPlayer.Call(unpack(tbCallBack));
self:DbgOut("_OnPlayerCall", pPlayer.szName, tostring(tbCallBack[1]));
end
end
-- 写脚本日志
function tbTest1:ScriptLogF(pPlayer, ...)
local szMsg = string.format(unpack(arg));
Dbg:WriteLogEx(Dbg.LOG_INFO, "GM", "GM_Operation", pPlayer.szName, szMsg);
end
-- 发送GM操作结果消息并写客服日志
function tbTest1:SendResultMsg(nGMPlayerId, szOperation, bSuccess, szDetail)
GM.tbTest1:_SendPlayerCall(nGMPlayerId, "GM.tbTest1:_OnResultMsg", szOperation, bSuccess, szDetail);
end
function tbTest1:_OnResultMsg(szOperation, bSuccess, szDetail)
local szMsg = "";
if (szOperation) then
szMsg = szMsg.."【操作】"..szOperation..";";
end
if (bSuccess) then
szMsg = szMsg.."【结果】"..((bSuccess == 1 and "成功") or "失败")..";";
end
if (szDetail) then
szMsg = szMsg.."【详细】"..szDetail..";";
end
me.PlayerLog(Log.emKPLAYERLOG_TYPE_GM_OPERATION, szMsg);
self:ScriptLogF(me, szMsg);
me.Msg(szMsg);
end
-- 是否隐身中
function tbTest1:IsHide()
return me.IsHaveSkill(self.SKILLID_GMHIDE);
end
-- 设置隐身
function tbTest1:SetHide(nHide)
if (nHide == 1) then
me.AddFightSkill(self.SKILLID_GMHIDE, 1);
else
me.DelFightSkill(self.SKILLID_GMHIDE);
end
self:SendResultMsg(me.nId, (nHide == 1 and "开始隐身") or "取消隐身", 1);
end
-- 获取允许最大设置为多少级
function tbTest1:GetMaxAdjustLevel()
local nLadderLevel = 0;
local tbInfo = GetLadderPlayerInfoByRank(0x00020100, 10); -- 排行榜第10名
if (tbInfo) then
local _,_,Level = string.find(tbInfo.szContext, "(-?%d+)(.*)");
nLadderLevel = tonumber(Level) or 0;
end
return math.max(nLadderLevel, 10); -- 至少可以到达10级
end
-- 调整自身等级
function tbTest1:AdjustLevel(nLevel)
local szOperation = string.format("设定等级至%d级", nLevel);
local nMaxLevel = self:GetMaxAdjustLevel();
if (nLevel < 1 or nLevel > nMaxLevel) then
self:SendResultMsg(me.nId, szOperation, 0, string.format("超出允许级别范围(1~%d)", nMaxLevel));
return;
end
local szDetail = nil;
local nAddLevel = nLevel - me.nLevel;
if (nAddLevel < 0) then
me.ResetFightSkillPoint(); -- 重置技能点
me.UnAssignPotential(); -- 重置潜能点
me.Msg("<color=green>您进行了降级操作,需要退出重登。否则客户端显示会有异常。");
szDetail = "降级操作,引起技能点、潜能点重置";
end
me.AddLevel(nAddLevel);
self:SendResultMsg(me.nId, szOperation, 1, szDetail);
end
-- 当GM进入地图
function tbTest1:OnEnterMap(nMapId)
local szMsg = string.format("到达地图:%s(%d),隐身状态:%d", GetMapNameFormId(nMapId), nMapId, self:IsHide());
me.PlayerLog(Log.emKPLAYERLOG_TYPE_GM_OPERATION, szMsg);
self:DbgOut(szMsg);
end
-- 当GM登入
-- 发送系统邮件
function tbTest1:SendMail(nPlayerId, szContext)
print(nPlayerId, szContext)
local szName = KGCPlayer.GetPlayerName(nPlayerId);
local szTitle = string.format("[%s]", me.szName);
KPlayer.SendMail(szName, szTitle, szContext);
self:SendResultMsg(me.nId, string.format("发邮件至玩家(%s)", szName), 1);
end
function tbTest1:_CallSomeoneHere(nGMPlayerId, nPlayerId, szOperation)
local nMapId, nMapX, nMapY = me.GetWorldPos();
local szMapClass = GetMapType(nMapId) or "";
if (Map.tbMapItemState[szMapClass].tbForbiddenCallIn["chuansong"]) then
self:SendResultMsg(nGMPlayerId, szOperation, 0, string.format("(%s)所在地图(%s)禁止传入", me.szName, GetMapNameFormId(nMapId)));
return;
end
GM.tbTest1:_ApplyPlayerCall(nGMPlayerId, szOperation, nPlayerId, "GM.tbTest1:_CallMePos", nGMPlayerId, nMapId, nMapX, nMapY, szOperation);
end
function tbTest1:_CallMePos(nGMPlayerId, nMapId, nMapX, nMapY, szOperation)
local szMapClass = GetMapType(me.nMapId) or "";
if Map.tbMapItemState[szMapClass].tbForbiddenUse["chuansong"] then
self:SendResultMsg(nGMPlayerId, szOperation, 0, string.format("(%s)所在地图(%s)禁止传出", me.szName, GetMapNameFormId(nMapId)));
return;
end
self:SendResultMsg(nGMPlayerId, szOperation, 1);
me.NewWorld(nMapId, nMapX, nMapY);
end
function tbTest1:_KickMe(nGMPlayerId, szOperation)
self:SendResultMsg(nGMPlayerId, szOperation, 1);
me.KickOut();
end
-- 调试输出
function tbTest1:DbgOut(...)
Dbg:Output("GM", unpack(arg));
end
-- 注册Login