⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 missionsdk.lua

📁 top web admin panel (tales of pirates)
💻 LUA
📖 第 1 页 / 共 5 页
字号:
	SetItemAttr(Item_new, ITEMATTR_VAL_DEX, now_miniute )		-------------分   
	SetItemAttr(Item_new, ITEMATTR_VAL_AGI, now_scend )		-------------秒 
	SynChaKitbag(character,13)
	return LUA_TRUE
end

function AddChaItem4(character,npc,value)
	
	local i= CheckBagItem( character, value )
		--SystemNotice( character , "i=="..i)
	if i~=1 then
		SystemNotice( character , "请确保您身上只有有1张特别行动卡")
		return LUA_FALSE
	end
	
	
	----------记录时间
	local now_yes = os.date("%y")			-------------年
	local now_month= os.date("%m")			-------------月
	local now_day= os.date("%d")			-------------日
	local now_hour= os.date("%H")			-------------时
	local now_miniute= os.date("%M")		-------------分
	local now_scend=  os.date("%S")			-------------秒
	now_yes = tonumber(now_yes)			-------------年     
	now_month= tonumber(now_month)		-------------月     
	now_day= tonumber(now_day)			-------------日     
	now_hour= tonumber(now_hour)			-------------时     
	now_miniute= tonumber(now_miniute)	 	-------------分     
	now_scend= tonumber(now_scend)		-------------秒     
	--SystemNotice ( character , "now_yes=="..now_yes )
	--SystemNotice ( character , "now_month=="..now_month )
	--SystemNotice ( character , "now_day=="..now_day )
	--SystemNotice ( character , "now_hour=="..now_hour )
	--SystemNotice ( character , "now_miniute=="..now_miniute )
	--SystemNotice ( character , "now_scend=="..now_scend )

	local item_old = GetChaItem2 ( character , 2 , value )--------特别行动卡
	---------取特别行动卡的时间	
	local old_month = GetItemAttr(item_old, ITEMATTR_VAL_STA)		-------------月 	
	local old_day = GetItemAttr(item_old, ITEMATTR_VAL_STR)			-------------日  
	local old_hour = GetItemAttr(item_old, ITEMATTR_VAL_CON)			-------------时   
	local old_miniute = GetItemAttr(item_old, ITEMATTR_VAL_DEX)		-------------分   
	local old_scend = GetItemAttr(item_old, ITEMATTR_VAL_AGI)			-------------秒 
	--SystemNotice ( character , "old_month=="..old_month )
	--SystemNotice ( character , "old_day=="..old_day )       
	--SystemNotice ( character , "old_hour=="..old_hour )    
	--SystemNotice ( character , "old_miniute=="..old_miniute)
	--SystemNotice ( character , "old_scend=="..old_scend ) 

	---------删除特别行动卡
	local del_item =TakeItem( character, 0,value, 1 )--------------			                   
	if del_item==0  then
		SystemNotice ( character ,"删除特别行动卡失败")
		return LUA_FALSE
	end


	local used_time=(now_scend - old_scend)+(now_miniute - old_miniute)*60+(now_hour - old_hour)*3600+(now_day - old_day)*86400+(JNSTime_Flag[now_month] - JNSTime_Flag[old_month] )*86400
	local cha_name = GetChaDefaultName ( character )

	if used_time>900 or used_time<0 then
		SystemNotice ( character ,"您完成特别任务的时间超长,建议中断任务从头再来!")
		return LUA_FALSE
	elseif used_time <= 900 and used_time>0 then
		SystemNotice(character ,"恭喜你完成了特别任务,全程用时"..used_time.."秒.")
	end
	
	SynChaKitbag(character,13)
	return LUA_TRUE
end


---------------判断角色是否有某乱斗点数
function HasFightingPoint(character,value)
		--SystemNotice( character , "HasFightingPoint" )
		local i= CheckBagItem( character, 3849 )
		--SystemNotice( character , "i=="..i)
		if i~=1 then
			SystemNotice( character , "请确定身上有荣誉证书")
			return LUA_FALSE
		end
		local ATKER_LD = GetChaItem2 ( character , 2 , 3849 )
		local FightingPoint=GetItemAttr ( ATKER_LD , ITEMATTR_MAXENERGY)
	      --SystemNotice( character , "HasFightingPoint=="..FightingPoint )
	if value > FightingPoint then
		return LUA_FALSE
	else
		return LUA_TRUE
	end
end

---------------判断角色是否有某荣誉点数
function HasHonorPoint(character,value)
		--SystemNotice( character , "HasHonorPoint" )
		local i= CheckBagItem( character, 3849 )
		--SystemNotice( character , "i=="..i)
		if i~=1 then
			SystemNotice( character , "请确定身上有荣誉证书")
			return LUA_FALSE
		end
		local DEFER_RYZ1 = GetChaItem2 ( character , 2 , 3849 )
		local HonorPoint = GetItemAttr ( DEFER_RYZ1 , ITEMATTR_VAL_STR)
	if value > HonorPoint then
		return LUA_FALSE
	else
		return LUA_TRUE
	end
end

--判断好汉书时间是否小于某个值
function LessTime( character, value)
	local HHS_Num = 0
	HHS_Num = CheckBagItem( character, 2912 )
	---SystemNotice(character,""..HHS_Num)
	if HHS_Num ~= 1 then
		return 0
	end
	local role_HHS = GetChaItem2 ( character , 2 , 2912 )	
	local attr_num = GetItemAttr ( role_HHS, ITEMATTR_VAL_AGI)
	----SystemNotice(character,""..attr_num)
	if value > attr_num then
		return LUA_TRUE
	end

	return LUA_FALSE
end

--判断好汉书时间是否大于某个值
function MoreTime( character, value)
	local HHS_Num = 0
	HHS_Num = CheckBagItem( character, 2912 )
	---SystemNotice(character,""..HHS_Num)
	if HHS_Num ~= 1 then
		return 0
	end
	local role_HHS = GetChaItem2 ( character , 2 , 2912 )	
	local attr_num = GetItemAttr ( role_HHS, ITEMATTR_VAL_AGI)
	----SystemNotice(character,""..attr_num)
	if value < attr_num then
		return LUA_TRUE
	end

	return LUA_FALSE
end

--判断是否穿着白羊套装
function BaiyangOn( character )
	local head = GetChaItem ( character , 1 , 0 )
	local body = GetChaItem ( character , 1 , 2 )
	local hand = GetChaItem ( character , 1 , 3 )
	local foot = GetChaItem ( character , 1 , 4 )

	local Head_ID = GetItemID ( head )
	local Body_ID = GetItemID ( body )
	local Hand_ID = GetItemID ( hand )
	local Foot_ID = GetItemID ( foot )
	local Cha_Num = GetChaTypeID( cha )

	if Body_ID ~= 5341 and Body_ID ~= 5345 and Body_ID ~= 5349 and Body_ID ~= 5353 then
		return LUA_FALSE
	end
	if Hand_ID ~= 5342 and Hand_ID ~= 5346 and Hand_ID ~= 5350 and Hand_ID ~= 5354 then
		return LUA_FALSE
	end
	if Foot_ID ~= 5343 and Foot_ID ~= 5347 and Foot_ID ~= 5351 and Foot_ID ~= 5355 then
		return LUA_FALSE
	end
	if Cha_Num == 4 then
		if Head_ID ~= 5352 then
		return LUA_FALSE
		end
	end

	return LUA_TRUE
end

---------------扣除角色身上的乱斗点数
function TakeFightingPoint(character,value)
		--SystemNotice( character , "TakeFightingPoint" )
		local i= CheckBagItem( character, 3849 )
		--SystemNotice( character , "i=="..i)
		if i~=1 then
			SystemNotice( character , "请确定身上有荣誉证书")
			return LUA_FALSE
		end
		local ATKER_LD = GetChaItem2 ( character , 2 , 3849 )
		local FightingPoint=GetItemAttr ( ATKER_LD , ITEMATTR_MAXENERGY)
	      --SystemNotice( character , "HasFightingPoint=="..FightingPoint )
	if value > FightingPoint then
		return LUA_FALSE
	else
		local new_point=FightingPoint - value
		SetItemAttr ( ATKER_LD , ITEMATTR_MAXENERGY , new_point)
		return LUA_TRUE
	end
end

---------------扣除角色身上的荣誉点数
function TakeHonorPoint(character,value)
		--SystemNotice( character , "TakeHonorPoint" )
		local i= CheckBagItem( character, 3849 )
		--SystemNotice( character , "i=="..i)
		if i~=1 then
			SystemNotice( character , "请确定身上有荣誉证书")
			return LUA_FALSE
		end
		local DEFER_RYZ1 = GetChaItem2 ( character , 2 , 3849 )
		local HonorPoint = GetItemAttr ( DEFER_RYZ1 , ITEMATTR_VAL_STR)
		if value > HonorPoint then
			return LUA_FALSE
		else
			local new_point=HonorPoint - value
			SetItemAttr ( DEFER_RYZ1 , ITEMATTR_VAL_STR , new_point)
			return LUA_TRUE
		end
end

--判断组队贡献度
function HasOffer( character, value )
	local ret = HasZuDuiGongXianDu( character, value )
	if ret == LUA_TRUE then
		return LUA_TRUE
	end
	
	return LUA_FALSE
end

--扣除组队贡献度
function TakeOffer( character, value )
	local ret = TakeZuDuiGongXianDu( character, value )
	if ret == LUA_TRUE then
		return LUA_TRUE
	end
	
	return LUA_FALSE
end

--判断荣誉值是否小于某个值
function LessCredit( character, p1, value )
	local ret = LessYongYuZhi( character, p1, value )
	if ret == LUA_TRUE then
		return LUA_TRUE
	end
	
	return LUA_FALSE
end
------------------检测道具上编号是否相同
function CheckItem( character, itemid1, itemid2 )
	if itemid1 == nil or itemid2 == nil then
		PRINT( "CheckItem:参数错误!" )
		return LUA_ERROR
	end
	local item1=GetItemP(character,2)
	local item2=GetItemP(character,3)
	local itemida=GetItemID( item1 )
	local itemidb=GetItemID( item2 )
	local itemid1_number=GetItemAttr ( item1 , ITEMATTR_VAL_STR )
	local itemid2_number=GetItemAttr ( item2 , ITEMATTR_VAL_STR )
		
		
	if itemid1_number~=itemid2_number or itemida~=2902  or itemidb~=2903 then
	SystemNotice( character, "情缘编码不一致或者没有放在对应的背包格" )
		return LUA_FALSE	
	end
	return LUA_TRUE
end

function CheckBag( character, itemid, value1, value2)-----------value1===位置,value2===数量
	local cha = ChaIsBoat ( character ) 
	if cha ==1 then
		--SystemNotice( character ,"请您上岸接任务")
		return LUA_TRUE 
	end	
	if itemid== nil or value1== nil or value2== nil then
		PRINT( "CheckBag:参数错误!" )
		return LUA_ERROR
	end
	local item=GetItemP(character,value1)
	local itemida=GetItemID( item )
	local i = CheckBagItem( character, itemid )			---取数量
	local item_name=GetItemName ( itemid )
	local item_pos=value1+1
	if itemid~=itemida or i~=value2 then
		SystemNotice( character, "请确认背包第"..item_pos.."个位置至少有"..value2.."个"..item_name )
		return LUA_FALSE	
	end
	return LUA_TRUE
end

function CheckBagEmp( character,value)-----------value===位置
	if value==nil then
		PRINT( "CheckBagEmp:参数错误!" )
		return LUA_ERROR
	end
	local item=GetItemP(character,value)
	local itemid=GetItemID( item )
	local item_pos=value+1
	local cha = ChaIsBoat ( character ) 
	if cha ==1 then
		SystemNotice( character, "想要挑战吉尼斯的朋友可以去(2217,2911)找海云,并将背包第"..item_pos.."个位置的道具移开,水里的朋友请首先到岸上来")
		return LUA_FALSE 
	end	
	if itemid~=0 then
		SystemNotice( character, "想要挑战吉尼斯的朋友可以去(2217,2911)找海云,并将背包第"..item_pos.."个位置的道具移开,水里的朋友请首先到岸上来")
		return LUA_FALSE	
	end
	return LUA_TRUE
end
--清除PK荣誉值
function AddCredit( character, value )
	local ret = AddYongYuZhi( character, value )
	if ret == LUA_TRUE then
		return LUA_TRUE
	end
	
	return LUA_FALSE
end

--检测钱不足
function NoMoney( character, money )
	PRINT( "NoMoney:HasMoney" )
	local ret = HasMoney( character, money )
	PRINT( "NoMoney:HasMoney return ret = ", ret )
	if ret ~= LUA_TRUE then
		return LUA_TRUE
	end
	return LUA_FALSE
end

--检查是否符合转职条件
function CheckConvertProfession( character, newpf )
	if newpf == nil then
		PRINT( "CheckConvertProfession:functionparameter error!" )
		SystemNotice( character, "CheckConvertProfession:functionparameter error!" )
		return LUA_ERROR
	end
	
	--取得角色职业和类型
	local ret, cat, pf = GetCatAndPf( character )
	PRINT( "CheckConvertProfession: GetCatAndPf: ret =, pf = , newpf = , cat = , Profession = ", ret, pf, newpf, cat, Profession )
	--判断是否新手,新手没有转职限制
	if pf ~= 0 then	
		--检测是否有转职限制
		if Profession ~= nil and Profession[pf] ~= nil then
			local flag = 0
			PRINT( "CheckConvertProfession: pf count = ", Profession[pf].count )
			for n = 1, Profession[pf].count, 1 do
				PRINT( "CheckConvertProfession: n =, newpf = , pf = ", n, newpf, Profession[pf][n] )

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -