📄 itemgetmission.lua
字号:
---相关判断函数
function CheckMisChaBoat ( role , ChaType ) --船只人物检测
local Cha_Boat = GetCtrlBoat ( role )
local ChaIsBoat = 0
if Cha_Boat == nil then
ChaIsBoat = 1
else
ChaIsBoat = 2
end
if ChaIsBoat == ChaType then
return 1
else
return 0
end
end
function CheckChaPos ( role , Cha_x_min , Cha_x_max , Cha_y_min , Cha_y_max , MapName ) --坐标检测
local Cha_Boat = GetCtrlBoat ( role )
local ChaIsBoat = 0
if Cha_Boat ~= nil then
role = Cha_Boat
end
local pos_x , pos_y = GetChaPos ( role )
local map_name = GetChaMapName ( role )
if MapName ~= -1 then
if map_name ~= MapName then
return 0
end
end
if pos_x < Cha_x_min or pos_x > Cha_x_max then
return 0
end
if pos_y < Cha_y_min or pos_y > Cha_y_max then
return 0
end
return 1
end
function CheckChaGuildType ( role , GuildType , CheckType ) --检测公会类型
local Cha_GuildID = GetChaGuildID( role )
local ChaGuildType_Get = -1
if Cha_GuildID == 0 then
ChaGuildType_Get = 0
elseif Cha_GuildID > 0 and Cha_GuildID <= 100 then
ChaGuildType_Get = 1
elseif Cha_GuildID > 100 and Cha_GuildID <= 200 then
ChaGuildType_Get = 2
else
return 0
end
if CheckType == 1 then
if ChaGuildType_Get == GuildType then
return 1
else
return 0
end
elseif CheckType == 2 then
if ChaGuildType_Get == GuildType then
return 0
else
return 1
end
else
return 0
end
end
function MissionMsgCheck ( role , HasRecordID , NoRecordID , HasMissionID , No_MissionID , HasRecordNotice , NoRecordNotice , HasMissionNotice , NoMissionNotice )
-- SystemNotice ( role , "MissionMsgCheck")
local Have_Record = 0
local No_Record = 0
local Have_Mission = 0
local No_Mission = 0
if HasRecordID ~= -1 then
Have_Record = HasRecord( role , HasRecordID )
if Have_Record ~= LUA_TRUE then
SystemNotice ( role , HasRecordNotice )
return 0
end
end
if NoRecordID ~= -1 then
No_Record = NoRecord( role , NoRecordID )
if No_Record ~= LUA_TRUE then
SystemNotice ( role , NoRecordNotice )
return 0
end
end
if HasMissionID ~= -1 then
Have_Mission = HasMission( role , HasMissionID )
if Have_Mission ~= LUA_TRUE then
SystemNotice ( role , HasMissionNotice )
return 0
end
end
if No_MissionID ~= -1 then
No_Mission = HasMission( role , No_MissionID )
if No_Mission == LUA_TRUE then
SystemNotice ( role , NoMissionNotice )
return 0
end
end
return 1
end
function ChaMsgCheck ( role , ChaType , Need_CheckPos ,Cha_x_max , Cha_x_min , Cha_y_max , Cha_y_min , MapName , GuildType , CheckType , CheckBoatNotice , CheckPosNotice ,GuildTypeNotice )
-- SystemNotice ( role , "ChaMsgCheck")
local Is_BoatOrMan = 0
local At_Pos = 0
local CheckGuild_Type = 0
if ChaType ~= -1 then
Is_BoatOrMan = CheckMisChaBoat( role , ChaType )
if Is_BoatOrMan == 0 then
SystemNotice ( role , CheckBoatNotice )
return 0
end
end
if Need_CheckPos == 1 then
At_Pos = CheckChaPos ( role , Cha_x_min , Cha_x_max , Cha_y_min , Cha_y_max , MapName )
if At_Pos == 0 then
SystemNotice ( role , CheckPosNotice )
return 0
end
end
if GuildType ~= -1 then
CheckGuild_Type = CheckChaGuildType ( role , GuildType , CheckType )
if CheckGuild_Type == 0 then
SystemNotice ( role , GuildTypeNotice )
return 0
end
end
return 1
end
function ItemUse_LDADYW (role) --[[鲁德安的遗物]]--
local HasRecordID = 270 -- 判断是否带有某记录 ( 填要判断的记录 ID , -1 为不判断 )
local HasRecordID_1 = -1 -- 判断是否带有某记录 ( 填要判断的记录 ID , -1 为不判断 )
local NoRecordID = -1 -- 判断是否不带有某记录 ( 填要判断的记录 ID , -1为不判断 )
local NoRecordID_1 = -1 -- 判断是否不带有某记录 ( 填要判断的记录 ID , -1为不判断 )
local HasMissionID = -1 -- 判断是否带有某任务 ( 填要判断的任务 ID , -1 为不判断 )
local HasMissionID_1 = -1 -- 判断是否带有某任务 ( 填要判断的任务 ID , -1 为不判断 )
local No_MissionID = -1 -- 判断没有带某任务 ( 填要判断的任务 ID ,-1 为不判断 )
local No_MissionID_1 = -1 -- 判断没有带某任务 ( 填要判断的任务 ID ,-1 为不判断 )
local ChaType = -1 -- 判断是否为人或船只 ( 1 为 人 , 2 为 船 , -1 为不判断 )
local Need_CheckPos = -1 -- 是否判断坐标 ( 1 为 判断 , -1 为不判断 , 如果不判断则坐标和地图均填 0 )
local Cha_x_max = 4096 -- 判断人物ID 的 X 坐标最大值
local Cha_x_min = 0 -- 判断人物ID 的 X 坐标最小值
local Cha_y_max = 4096 -- 判断人物ID 的 Y 坐标最大值
local Cha_y_min = 0 -- 判断人物ID 的 Y 坐标最小值
local MapName = -1 -- 判断人物所在地图名
local GuildType = -1 -- 判断人物的公会类型 ( 1 为海军 , 2 为海盗 , 0 为没有公会 , -1 为不判断 )
local CheckType = 1 -- 判断人物公会类型的方式 ( 1 为是某种公会类型 , 2 为不是某种公会类型 )
local HasRecordNotice = "Memento of Andrew shows no responese" --判断 HasRecord 失败提示
local HasRecordNotice_1 = "Memento of Andrew shows no responese" --判断 HasRecord 失败提示
local NoRecordNotice = "Memento of Andrew shows no responese" --判断 NoRecord 失败提示
local NoRecordNotice_1 = "Memento of Andrew shows no responese" --判断 NoRecord 失败提示
local HasMissionNotice = "Memento of Andrew shows no responese" --判断 HasMission 失败提示
local HasMissionNotice_1 = "Memento of Andrew shows no responese" --判断 HasMission 失败提示
local NoMissionNotice = "Memento of Andrew shows no responese" --判断 NoMission 失败提示
local NoMissionNotice_1 = "Memento of Andrew shows no responese" --判断 NoMission 失败提示
local CheckBoatNotice = "Memento of Andrew shows no responese" --判断 人或船 失败提示
local CheckPosNotice = "Memento of Andrew shows no responese" --判断 坐标 失败提示
local GuildTypeNotice = "Memento of Andrew shows no responese" --判断 公会类型 失败提示
local CheckMissionMsg_1 = MissionMsgCheck ( role , HasRecordID , NoRecordID , HasMissionID , No_MissionID , HasRecordNotice , NoRecordNotice , HasMissionNotice , NoMissionNotice )
-- Notice("CheckMissionMsg_1 = "..CheckMissionMsg_1 )
local CheckMissionMsg_2 = MissionMsgCheck ( role , HasRecordID_1 , NoRecordID_1 , HasMissionID_1 , No_MissionID_1 , HasRecordNotice_1 , NoRecordNotice_1 , HasMissionNotice_1 , NoMissionNotice_1 )
-- Notice("CheckMissionMsg_2 = "..CheckMissionMsg_2 )
local CheckChaMsg = ChaMsgCheck ( role , ChaType , Need_CheckPos ,Cha_x_max , Cha_x_min , Cha_y_max , Cha_y_min , MapName , GuildType , CheckType , CheckBoatNotice , CheckPosNotice ,GuildTypeNotice )
-- Notice("CheckChaMsg = "..CheckChaMsg )
if CheckMissionMsg_1 ~= 1 or CheckMissionMsg_2 ~= 1 or CheckChaMsg ~= 1 then
UseItemFailed ( role )
return
end
local GiveMisson_1 = 9 --海军给与任务 (-1 为不给 )
local GiveMisson_2 = 8 --海盗给与任务 (-1 为不给 )
local GiveMisson_0 = 10 --无公会给与任务 ( -1 为不给 )
local ItemID = -1 --给与道具 ( -1 为不给 )
local ItemNum = 1 --给与道具数量
local Give_Exp = -1 -- 要给与的经验 ( 如果为 -1 为不给 )
local Give_Money = -1 -- 要给与的钱 ( 如果为 -1 为不给 )
local DelItem = 0 --是否在使用后删除道具( 1 删, 0 不删 )
if ItemID ~= -1 then
local Item_CanGet = GetChaFreeBagGridNum ( role )
if Item_CanGet < 1 then
SystemNotice(role ,"Inventory space insufficient. Usage of item failed")
UseItemFailed ( role )
return
end
end
local Cha_GuildID = GetChaGuildID( role )
local ChaGuildType_Get = -1
if Cha_GuildID == 0 then
ChaGuildType_Get = 0
elseif Cha_GuildID > 0 and Cha_GuildID <= 100 then
ChaGuildType_Get = 1
elseif Cha_GuildID > 100 and Cha_GuildID <= 200 then
ChaGuildType_Get = 2
else
SystemNotice ( role , "Illegal Guild ID" )
end
if ChaGuildType_Get == 1 then
if GiveMisson_1 ~= -1 then
GiveMission( role, GiveMisson_1 )
end
end
if ChaGuildType_Get == 2 then
if GiveMisson_2 ~= -1 then
GiveMission( role, GiveMisson_2 )
end
end
if ChaGuildType_Get == 0 then
if GiveMisson_0 ~= -1 then
GiveMission( role, GiveMisson_0 )
end
end
if ItemID ~= -1 then
GiveItem ( role , 0 , ItemID , ItemNum , 0 )
end
if Give_Money > 0 then
AddMoney ( role , 0 , Give_Money )
end
if Give_Exp > 0 then
local exp = Exp ( role )
if Lv ( TurnToCha ( role ) ) >= 80 then
Give_Exp = math.floor ( exp_dif / 50 )
end
local exp_new = exp + Give_Exp
SetCharaAttr ( exp_new , role , ATTR_CEXP )
end
if DelItem == 0 then
UseItemFailed ( role )
return
end
end
function ItemUse_GLDYS (role) --[[古老的钥匙]]--
local HasRecordID = -1 -- 判断是否带有某记录 ( 填要判断的记录 ID , -1 为不判断 )
local HasRecordID_1 = -1 -- 判断是否带有某记录 ( 填要判断的记录 ID , -1 为不判断 )
local NoRecordID = 15 -- 判断是否不带有某记录 ( 填要判断的记录 ID , -1为不判断 )
local NoRecordID_1 = -1 -- 判断是否不带有某记录 ( 填要判断的记录 ID , -1为不判断 )
local HasMissionID = -1 -- 判断是否带有某任务 ( 填要判断的任务 ID , -1 为不判断 )
local HasMissionID_1 = -1 -- 判断是否带有某任务 ( 填要判断的任务 ID , -1 为不判断 )
local No_MissionID = 15 -- 判断没有带某任务 ( 填要判断的任务 ID ,-1 为不判断 )
local No_MissionID_1 = -1 -- 判断没有带某任务 ( 填要判断的任务 ID ,-1 为不判断 )
local ChaType = -1 -- 判断是否为人或船只 ( 1 为 人 , 2 为 船 , -1 为不判断 )
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -