Jump to content
Mario

Fairy Coin Chest

Recommended Posts

any one can throw to me Fairy Coin Chest  func ,, i had download the old files but unfortunly the chest deleted after first open 
im looking for function that not delete the main chest 
 

Share this post


Link to post
Share on other sites

it's so hard download any clean files and just search for it inside? 

function ItemUse_YingbiBox ( role , Item )
	local map_name_role = GetChaMapName ( role )
	if map_name_role == "darkblue" then
		local lv = GetChaAttr ( role , ATTR_LV )
		if lv >= 10 then
			local Item_CanGet = GetChaFreeBagGridNum ( role )
			if Item_CanGet < 4 then
				SystemNotice(role ,"开启精灵硬币宝箱至少需要4个格子")
				UseItemFailed ( role )
				return
			end
			local ChaName = GetChaDefaultName(role)
			if PlayUseBox1[ChaName] == nil then
				PlayUseBox1[ChaName] = 0
			end
			local Use_Num = PlayUseBox1[ChaName]
			local now_day= os.date("%d")		-------------日   
			local now_month= os.date("%m")		-------------月
			now_month= tonumber(now_month)		-------------月     
			now_day = tonumber(now_day)		-------------日
			local Date = JNSTime_Flag[now_month]+now_day
			local Yingbi_Num = 0
			if Use_Num == 0 then
				local Time = 1
				Use_Num = Date * 10 + Time
				Yingbi_Num = 20
				local j = TakeItem ( role , 0 , 855 , Yingbi_Num )
					if j == 1 then 
						PlayUseBox1[ChaName] = Use_Num
						GiveBragiItem ( role , 1 )
						GiveItem ( role , 0 , 1872 , 1 , 4 )
					else
						UseItemFailed ( role )
						SystemNotice( role, "精灵硬币不足")
					end
			else
				local Date_Box = math.floor ( Use_Num / 10 )
				local a = Date - Date_Box
				local Time = Use_Num - Date_Box * 10
				--SystemNotice ( role , "a="..a)
				if a == 0 then
					Use_Num = Use_Num +1
					local time_new = Time + 1
					if time_new >= 1 and time_new <= 3 then
						Yingbi_Num = (time_new*5) + 15
						--SystemNotice ( role  , "Round"..time_new.."次开箱子,花费"..Yingbi_Num.."个硬币,品质为1")
						local j = TakeItem ( role , 0 , 855 , Yingbi_Num )
						if j == 1 then
							GiveBragiItem ( role , 1 )
							PlayUseBox1[ChaName] = Use_Num
							GiveItem ( role , 0 , 1872 , 1 , 4 )
						else
							UseItemFailed ( role )
							SystemNotice( role, "精灵硬币不足")
						end
					elseif time_new >= 4 and time_new <= 6 then
						Yingbi_Num = Time * 15
						--SystemNotice ( role  , "Round"..time_new.."次开箱子,花费"..Yingbi_Num.."个硬币,品质为2")
						local j = TakeItem ( role , 0 , 855 , Yingbi_Num )
						if j == 1 then
							GiveBragiItem ( role , 2 )
							PlayUseBox1[ChaName] = Use_Num
							GiveItem ( role , 0 , 1872 , 1 , 4 )
						else
							UseItemFailed ( role )
							SystemNotice( role, "精灵硬币不足")
						end
					else
						Yingbi_Num = 99
						--SystemNotice ( role  , "Round"..time_new.."次开箱子,花费"..Yingbi_Num.."个硬币,品质为3")
						local j = TakeItem ( role , 0 , 855 , Yingbi_Num )
						if j == 1 then
							GiveBragiItem ( role , 3 )
							PlayUseBox1[ChaName] = Use_Num
							GiveItem ( role , 0 , 1872 , 1 , 4 )
						else
							UseItemFailed ( role )
							SystemNotice( role, "精灵硬币不足")
						end
					end
				elseif a == -1 then
					UseItemFailed ( role )
					SystemNotice ( role , "你今天已经开过10个精灵硬币宝箱了")
				else
					local Time = 1
					Use_Num = Date * 10 + Time
					Yingbi_Num = 20
					--SystemNotice ( role  , "Round"..Time.."开箱子,花费"..Yingbi_Num.."个硬币")
					local j = TakeItem ( role , 0 , 855 , Yingbi_Num )
					if j == 1 then
						PlayUseBox1[ChaName] = Use_Num
						GiveBragiItem ( role )
						GiveItem ( role , 0 , 1872 , 1 , 4 )
					else
						UseItemFailed ( role )
						SystemNotice( role, "精灵硬币不足")
					end
				end
			end
		else
			SystemNotice( role , "等级不到10,无法使用该道具")
			UseItemFailed ( role )
		end
	else
		SystemNotice( role , "该道具只能在深蓝群岛地图使用")
		UseItemFailed ( role )
	end
end

 

Share this post


Link to post
Share on other sites
On 7/14/2022 at 12:32 PM, Mario said:

@Angelix

any help 

If people don't answer your thread, it means they either don't want to help or they don't know how to help, so stop tagging people at random. It's annoying.

Share this post


Link to post
Share on other sites

Hello @Mario,

 

Try call UseItemFailed(role) function at the end of the your item usage function. This function should prevent the item deletion.

function ItemUse_XXXXXXX(role, Item)

	-- The main code here
	
	UseItemFailed(role)
	
end

 


Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.


×
×
  • Create New...