Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function Random_GemBox(role,Item)
- local Cha_Boat = 0
- Cha_Boat = GetCtrlBoat ( role )
- if Cha_Boat ~= nil then
- SystemNotice(role, "Cannot use while sailing!")
- UseItemFailed(role)
- return
- end
- local Item_CanGet = GetChaFreeBagGridNum ( role )
- if Item_CanGet < 1 then
- SystemNotice(role ,"Requires 1 slot on inventory!")
- UseItemFailed ( role )
- return
- end
- local Item_CanGet = GetChaFreeBagGridNum(role)
- local FreeBagNeed = 1
- if Item_CanGet < FreeBagNeed then
- SystemNotice(role, "To open a "..GetItemName(ItemID).." requires "..FreeBagNeed.." empty slots")
- UseItemFailed(role)
- return
- end
- local Box = {}
- Box[7009] = {6817,6820,6823,6826,6829} --Broken Gem Moonchest
- Box[7010] = {6818,6821,6824,6827,6830} --Cracked Gem Moonchest
- Box[7011] = {6819,6822,6825,6828,6831} --Chipped Gem Moonchest
- Box[7012] = {0878,0879,0880,0881,0882,0883,0884} --Normal Gem Moonchest
- Box[5707] = {0860,0861,0862,0863,1012} --The Universe Purse
- Box[5708] = {0866,0865,0864} --Dragon Treasure Chest
- Box[6877] = {0887,5752,5751,5750,5771,5772,5773,5774,5775} --Advanced Voucher
- local ItemID = GetItemID(Item)
- if Box[ItemID] ~= nil then
- local Key = math.random(1,table.getn(Box[ItemID]))
- GiveItem(role, 0, Box[ItemID][Key], 1, 4)
- local ChaName = GetChaDefaultName ( role )
- Notice(ChaName.." opened "..GetItemName(ItemID).." and obtained "..GetItemName(Box[ItemID][Key]))
- else
- SystemNotice(role, "Internal error!")
- UseItemFailed(role)
- return
- end
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement