--1个屋子一共1只,物品3010139 --闪光金粉5300139 2%掉落 古神晶片5300138 2%掉落 圣灵精魄6600546 0.2%掉落 活动代币6600549*10:100% 高级宝石粉 2%掉落 5300140 function I3010139_GiftBag(MapID, InstanceID, TypeID, TargetID)--宝箱(高级) local r = math.random(1000) if r <= 20 then role.AddRoleItem(MapID, InstanceID, TargetID, 6802527, 1, -1, 8, 420) end local k = math.random(1000) if k <= 20 then role.AddRoleItem(MapID, InstanceID, TargetID, 6802526, 3, -1, 8, 420) end local j = math.random(1000) if j <= 2 then role.AddRoleItem(MapID, InstanceID, TargetID, 6600238, 1, -1, 8, 420) end local m = math.random(1000) if m <= 4 then role.AddRoleItem(MapID, InstanceID, TargetID, 4510020, 10, -1, 8, 420) end local n = math.random(1000) if n <= 20 then role.AddRoleItem(MapID, InstanceID, TargetID, 4820035, 2, -1, 8, 420) end local b = math.random(1000) if b <= 100 then role.AddRoleItem(MapID, InstanceID, TargetID, 4820289, 5, -1, 8, 420) end role.AddRoleItem(MapID, InstanceID, TargetID, 4400376, 10, -1, 8, 420) role.AddRoleItem(MapID, InstanceID, TargetID, 3500208, 10, -1, 8, 420) end function I3010139_CanUseGiftBag(MapID, InstanceID, TypeID, TargetID) local bRet, bIgnore = 0, false --判断背包空闲空间是否足够 local FreeSize = role.GetBagFreeSize(TargetID) if FreeSize < 8 then --提示玩家背包空间不足 bRet = 40 end return bRet, bIgnore end aux.RegisterItemEvent(3010139, 1, "I3010139_GiftBag") aux.RegisterItemEvent(3010139, 0, "I3010139_CanUseGiftBag") function I3010140_GiftBag(MapID, InstanceID, TypeID, TargetID)--招财 local r = math.random(1000) if r <= 20 then role.AddRoleItem(MapID, InstanceID, TargetID, 4510020, 10, -1, 8, 420) end local r = math.random(1000) if r <= 20 then role.AddRoleItem(MapID, InstanceID, TargetID, 4400377, 3, -1, 8, 420) end local k = math.random(1000) if k <= 20 then role.AddRoleItem(MapID, InstanceID, TargetID, 3500208, 10, -1, 8, 420) end local a = math.random(1000) if a <= 400 then role.AddRoleItem(MapID, InstanceID, TargetID, 6600238, 1, -1, 8, 420) end local b = math.random(1000) if b <= 400 then role.AddRoleItem(MapID, InstanceID, TargetID, 4820288, 1, -1, 8, 420) end role.AddRoleItem(MapID, InstanceID, TargetID, 7602497, 10, -1, 8, 420) role.AddRoleItem(MapID, InstanceID, TargetID, 7602498, 10, -1, 8, 420) end function I3010140_CanUseGiftBag(MapID, InstanceID, TypeID, TargetID) local bRet, bIgnore = 0, false --判断背包空闲空间是否足够 local FreeSize = role.GetBagFreeSize(TargetID) if FreeSize < 7 then --提示玩家背包空间不足 bRet = 40 end return bRet, bIgnore end aux.RegisterItemEvent(3010140, 1, "I3010140_GiftBag") aux.RegisterItemEvent(3010140, 0, "I3010140_CanUseGiftBag") --1个屋子一共4只,物品3010141 --闪光金粉 2%掉落 古神晶片 2%掉落 神灵印记*3:100% function I3010141_GiftBag(MapID, InstanceID, TypeID, TargetID)--招财 local r = math.random(1000) if r <= 100 then role.AddRoleItem(MapID, InstanceID, TargetID, 4400376, 5, -1, 8, 420) end local r = math.random(1000) if r <= 100 then role.AddRoleItem(MapID, InstanceID, TargetID, 3500208, 5, -1, 8, 420) end local k = math.random(1000) if k <= 50 then role.AddRoleItem(MapID, InstanceID, TargetID, 4820035, 1, -1, 8, 420) end role.AddRoleItem(MapID, InstanceID, TargetID, 7602497, 5, -1, 8, 420) role.AddRoleItem(MapID, InstanceID, TargetID, 7602498, 5, -1, 8, 420) end function I3010141_CanUseGiftBag(MapID, InstanceID, TypeID, TargetID) local bRet, bIgnore = 0, false --判断背包空闲空间是否足够 local FreeSize = role.GetBagFreeSize(TargetID) if FreeSize < 5 then --提示玩家背包空间不足 bRet = 40 end return bRet, bIgnore end aux.RegisterItemEvent(3010141, 1, "I3010141_GiftBag") aux.RegisterItemEvent(3010141, 0, "I3010141_CanUseGiftBag") function NPC6040314_OnTalk(MapID, InstanceID, TargetID, TargetTypeID, RoleID, TalkIndex) local x1 = cre.GetCreatureScriptData(MapID, InstanceID, TargetID, 1, 1) local x2 = cre.GetCreatureScriptData(MapID, InstanceID, TargetID, 1, 2) local x3 = cre.GetCreatureScriptData(MapID, InstanceID, TargetID, 1, 3) local x4 = cre.GetCreatureScriptData(MapID, InstanceID, TargetID, 1, 4) local x5 = cre.GetCreatureScriptData(MapID, InstanceID, TargetID, 1, 5) local x6 = cre.GetCreatureScriptData(MapID, InstanceID, TargetID, 1, 6) local tbl = {x1,x2,x3,x4,x5,x6} local x = 0 local FreeSize = role.GetBagFreeSize(RoleID) for i = 1,6 do if RoleID == tbl[i] then x = 1 break end end if TalkIndex == -1 then local MsgID = msg.BeginMsgEvent() msg.AddMsgEvent(MsgID, 20, 207558) --领取属于你的宝藏吧,每人只能领取一次哦。 msg.AddMsgEvent(MsgID, 24, TargetID) --npcid msg.AddMsgEvent(MsgID, 21, 4) --取消按钮 msg.AddMsgEvent(MsgID, 1, 100001) --“确定” msg.AddMsgEvent(MsgID, 21, 5) --取消按钮 msg.AddMsgEvent(MsgID, 1, 100002) --“取消” msg.DispatchRoleMsgEvent(RoleID, MsgID) elseif TalkIndex == 4 then if FreeSize >= 1 then if x == 0 then for a = 1, 6 do if tbl[a] == 1 then role.AddRoleItem(MapID, InstanceID, RoleID, 6600809, 5, -1, 8, 102) cre.SetCreatureScriptData(MapID, InstanceID, TargetID, 1, a, RoleID) break end end else local MsgID = msg.BeginMsgEvent() msg.AddMsgEvent(MsgID, 20, 207559) --你已经领取过了,不能重复领取 msg.AddMsgEvent(MsgID, 24, TargetID) --npcid msg.AddMsgEvent(MsgID, 21, 5) --取消按钮 msg.AddMsgEvent(MsgID, 1, 100001) --“确定” msg.DispatchRoleMsgEvent(RoleID, MsgID) end else local MsgID = msg.BeginMsgEvent() msg.AddMsgEvent(MsgID, 20, 444266) -- msg.AddMsgEvent(MsgID, 24, TargetID) --npcid msg.AddMsgEvent(MsgID, 21, -1) -- 确定按钮 msg.AddMsgEvent(MsgID, 1, 100001) -- “确定” msg.DispatchRoleMsgEvent(RoleID, MsgID) end end end aux.RegisterCreatureEvent(6040314, 7, "NPC6040314_OnTalk")