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

📄 missionsdk.lua

📁 top web admin panel (tales of pirates)
💻 LUA
📖 第 1 页 / 共 5 页
字号:
-- 	local ret1 = HasAllBoatInBerth( character, p1 )
--	local ret2 = HasAllBoatInBerth( character, p2 )
--	if ret1 ~= LUA_TRUE and  ret2 ~= LUA_TRUE  then
--		PRINT( "ConditionsTest:HasAllBoatInBerth_eitheror = false" )
--		return LUA_FALSE
--	end
--	if ret1 == LUA_TRUE  then
--		return LUA_TRUE
--	end
--	if  ret2 == LUA_TRUE  then
--		return LUA_TRUE
--	end
-- end
--检测任务记录标签信息
function HasFlag( character, id, flag )
	if id == nil or flag == nil then
		SystemNotice( character, "HasFlag:Function parameter error!" )
		return LUA_ERROR
	end
	local ret = IsValidFlag( character, flag )
	if ret ~= LUA_TRUE then
		SystemNotice( character, "HasFlag:Invalid quest record label error!" )
		return LUA_ERROR
	end
	ret = IsFlag( character, id, flag )
	return ret
end

--检测一个序列的任务记录标签信息
function HasAllFlag( character, id, startflag, count )
	if id == nil or startflag == nil or count then
		SystemNotice( character, "HasAllFlag: Function parameter error!" )
		return LUA_ERROR
	end
	local num = 0
	for i = 1, count, 1 do
		local ret = IsFlag( character, id, startflag + num )
		if ret ~= LUA_TRUE then
			return LUA_FALSE
		end
		num = num + 1
	end
	return LUA_TRUE
end

--获取一个序列的任务标签记录数量信息
function GetNumFlag( character, id, startflag, count )
	if id == nil or startflag == nil or count == nil then
		SystemNotice( character, "GetNumFlag:Function parameter error!" )
		return 0
	end
	local num = 0
	for i = 1, count, 1 do
		local ret = IsFlag( character, id, startflag + num )
		if ret ~= LUA_TRUE then
			break
		end
		num = num + 1
	end
	return num
end

--检验值
function IsValue( id1, id2 )
	if id1 == nil or id2 == nil then
		PRINT( "IsValue: Function parameter error!" )
		LG( "mission_error", "IsValue: Function parameter error!" )
		return LUA_ERROR
	end
	if id1 == id2 then
		return LUA_TRUE
	end
	return LUA_FALSE
end

--检测是否是指定的怪物类型
function IsMonster( id1, id2 )
	return IsValue( id1, id2 )
end

--检测是否指定的物品类型
function IsItem( id1, id2 )
	return IsValue( id1, id2 )
end

function NoItem( character, itemid, count )
	if itemid == nil or count == nil then
		PRINT( "NoItem: parameter error!" )
		return LUA_ERROR
	end
	
	local ret = HasItem( character, itemid, count )
	if ret == LUA_TRUE then
		return LUA_FALSE
	end
	
	return LUA_TRUE
end

function BankNoItem( character, itemid, count )
	if itemid == nil or count == nil then
		PRINT( "BankNoItem:参数错误!" )
		return LUA_ERROR
	end
	
	local ret = BankHasItem( character, itemid, count )
	if ret == LUA_TRUE then
		return LUA_FALSE
	end
	
	return LUA_TRUE
end

function EquipNoItem( character, itemid, count )
	if itemid == nil or count == nil then
		PRINT( "EquipNoItem:参数错误!" )
		return LUA_ERROR
	end
	
	local ret = EquipHasItem( character, itemid, count )
	if ret == LUA_TRUE then
		return LUA_FALSE
	end
	
	return LUA_TRUE
end

----Leo的声望函数判断,判断角色声上是否有固定枝的声望
function HasCredit(character,value)
	local Role_Credit = GetCredit(character)
	if value > Role_Credit then
		return LUA_FALSE
	else
		return LUA_TRUE
	end
end


--Leo end

----Leo的声望扣除,扣除角色声上的声望
function DelRoleCredit(character,npc,value)
	DelCredit(character,value)
	return LUA_TRUE
end
--Leo end


-------------------死亡证明----------missdk
function CheckPoint (character,value)
		--SystemNotice( character , "value=="..value)
	local i= CheckBagItem( character, value )
	if i~=1 then
		SystemNotice( character , "请确保您身上有1张死亡证明")
	return LUA_FALSE
	end
	local Point_dead = GetChaItem2 ( character , 2 , value )
	local Point = GetItemAttr(Point_dead, ITEMATTR_VAL_STR)
		--SystemNotice( character , "您死了"..Point.."次")
	if Point<41 then
		SystemNotice( character , "请确保您死了足够多次")
		return LUA_FALSE
		
	end
	return LUA_TRUE
end
		
--------------------判断背包内无某种道具
function HaveNoItem (character,value)
		--SystemNotice( character , "value=="..value)
	local i= CheckBagItem( character, value )
	--SystemNotice( character , "i=="..i)
	if i~=0 then
		SystemNotice( character , "请确保您身上没有死亡证明")
		return LUA_FALSE
	end
	return LUA_TRUE
end
----给角色背包固定位置添加道具
function AddChaItem1(character,npc,value)
	--SystemNotice( character ,"value=="..value)		
	local item_number = CheckBagItem( character, value )			
	if item_number >=1 then
		SystemNotice( character ,"您已经有挑战书了")
		return LUA_FALSE 
	end
	------------判断背包第一栏是否为空
	--local item1=GetItemP(character,0)
	--local itemid1=GetItemID( item1 )
	--if itemid1==0 or itemid1==nil then
	--	SystemNotice( character, "请把背包第一栏的物品移开" )
	--	return LUA_FALSE
	--end

	------------取挑战书的指针
	local r1=0
	local r2=0
		--SystemNotice( character ,"r1=="..r1)
	r1,r2 =MakeItem ( character , value  , 1 , 4 )
	local Item_new = GetChaItem ( character , 2 , r2 )

	----------记录时间
	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)		-------------秒     
	--local CheckDateNum = NowMonthNum * 10000 + NowDayNum * 100 + NowTimeNum
	--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 )
	SetItemAttr(Item_new, ITEMATTR_VAL_STA, now_month )		-------------月 	
	SetItemAttr(Item_new, ITEMATTR_VAL_STR, now_day )		-------------日  
	SetItemAttr(Item_new, ITEMATTR_VAL_CON, now_hour )		-------------时   
	SetItemAttr(Item_new, ITEMATTR_VAL_DEX, now_miniute )		-------------分   
	SetItemAttr(Item_new, ITEMATTR_VAL_AGI, now_scend )		-------------秒 
	SynChaKitbag(character,13)
	return LUA_TRUE
end
function AddChaItem2(character,npc,value)
	local cha = ChaIsBoat ( character ) 
	if cha ==1 then
		SystemNotice( character ,"您需要上岸才能还吉尼斯任务")
		return LUA_FALSE 
	end	
	------------取挑战书的指针
	local item1=GetItemP(character,0)
	local itemid1=GetItemID( item1 )
	if itemid1~=2911 then
		SystemNotice( character, "请把挑战书放在背包第一栏" )
		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=GetItemP(character,0)
	---------去好汉书的时间	
	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,2911, 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>28800 or used_time<0 then
		SystemNotice ( character ,"由于您完成吉尼斯任务的时间过长,不能获得任何奖励,希望英雄从头再来!")
		return LUA_TRUE
	elseif used_time < 2400 and used_time>0 then
		Notice("恭喜"..cha_name.."玩家完成了挑战吉尼斯的全部航程,全程用时"..used_time.."秒,大家努力啊!")
	end
	if used_time < JINISI_TIME then
		JINISI_TIME=used_time
		LG( "JiNiSiJiLu_XinXi" , "玩家"..cha_name.."打破了世界纪录,全程用时"..used_time.."秒" )
	end
	------------取好汉书的指针
	local r1=0
	local r2=0
	r1,r2 =MakeItem ( character , value  , 1 , 4 )
	local Item_new = GetChaItem ( character , 2 , r2 )
	GiveItem ( character , 0 , 3094  , 1 , 4 )	
	SetItemAttr(Item_new, ITEMATTR_VAL_AGI, used_time )		-------------秒  
	SynChaKitbag(character,13)
	return LUA_TRUE
end


----给角色背包添加道具
function AddChaItem3(character,npc,value)

	local item_number = CheckBagItem( character, value )			
	if item_number >=1 then
		SystemNotice( character ,"您已经有特别行动卡了")
		return LUA_FALSE 
	end
	
	local r1=0
	local r2=0
		--SystemNotice( character ,"r1=="..r1)
	r1,r2 =MakeItem ( character , value  , 1 , 4 )
	local Item_new = GetChaItem ( character , 2 , r2 )
	


	----------记录时间
	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)		-------------秒     
	--local CheckDateNum = NowMonthNum * 10000 + NowDayNum * 100 + NowTimeNum
	--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 )
	SetItemAttr(Item_new, ITEMATTR_VAL_STA, now_month )		-------------月 	
	SetItemAttr(Item_new, ITEMATTR_VAL_STR, now_day )		-------------日  
	SetItemAttr(Item_new, ITEMATTR_VAL_CON, now_hour )		-------------时   

⌨️ 快捷键说明

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