--��ѩ�������� function xueqiu_OnInvest(MapID, InstanceID, TargetID, TargetTypeID, RoleID) local z = 0 local y = 0 local x = role.GetRoleItemNum(RoleID, 4800027) local FreeSize = role.GetBagFreeSize(RoleID) if FreeSize >= 1 then if x > 0 then unit.AddBuff(MapID, InstanceID, RoleID, 6936301, RoleID) role.RemoveFromRole(MapID, InstanceID, RoleID, 4800027, 1, 402) local QuestID1 = msg.BeginMsgEvent() msg.AddMsgEvent(QuestID1, 13, 0) msg.AddMsgEvent(QuestID1, 1, 206333)--��ѩ��Ч��ֻ�ܳ���30���ӣ�ֻ���ҵ������ѩ���������Ч������ѩ����ӵ�10�κ󼴿ɻ���ر����� msg.DispatchRoleMsgEvent(RoleID, QuestID1) else local QuestID1 = msg.BeginMsgEvent() msg.AddMsgEvent(QuestID1, 13, 0) msg.AddMsgEvent(QuestID1, 1, 206334)--����û��ѩ�򣬵���ʧ�� msg.DispatchRoleMsgEvent(RoleID, QuestID1) end y,z = role.GetBuffLayer(RoleID, 6936301) if y > 9 then local a = math.random(1,100) if a <= 50 then role.AddRoleItem(MapID, InstanceID, RoleID, 4800022, 1, 0, 0, 402)--ѩ��֮�� unit.CancelBuff(MapID, InstanceID, RoleID, 6936301) else role.AddRoleItem(MapID, InstanceID, RoleID, 4400048, 1, 0, 0, 402)--ˮ���� unit.CancelBuff(MapID, InstanceID, RoleID, 6936301) end end else local MsgID = msg.BeginMsgEvent() msg.AddMsgEvent(MsgID, 26, 100003) msg.AddMsgEvent(MsgID, 9, 1) msg.DispatchRoleMsgEvent(RoleID, MsgID) bRet = 40 return bRet, bIgnore end end aux.RegisterCreatureEvent(6030002, 6, "xueqiu_OnInvest") function I4800243_OnUse(MapID, InstanceID, TypeID, TargetID) local class = role.GetRoleClass(TargetID) local high,low = -1,-1 if class==2 or class==6 or class==7 then high,low = role.AddRoleItem(MapID, InstanceID, TargetID, 8210207, 1, 6, 8, 420) elseif class==4 or class==10 or class==11 then high,low = role.AddRoleItem(MapID, InstanceID, TargetID, 8213207, 1, 6, 8, 420) elseif class==3 or class==8 or class==9 then high,low = role.AddRoleItem(MapID, InstanceID, TargetID, 8211207, 1, 6, 8, 420) elseif class==5 or class==12 or class==13 then high,low = role.AddRoleItem(MapID, InstanceID, TargetID, 8212207, 1, 6, 8, 420) end if high ~= -1 then for i=1,5 do role.DigHoleOnEquip(TargetID,high,low) end end role.SetRoleScriptData(TargetID, 1, RoleDataType["SDWI_State"], 0) role.SetRoleScriptData(TargetID, 1, RoleDataType["SDWI_Times"], 0) end function I4800243_CanUse(MapID, InstanceID, TypeID, TargetID) local bRet, bIgnore = 0, false --判断背包空闲空间是否足够 local FreeSize = role.GetBagFreeSize(TargetID) local class = role.GetRoleClass(TargetID) if class==1 then bRet = 32 end if(FreeSize < 1) then --提示玩家背包空间不足 bRet = 40 end return bRet, bIgnore end aux.RegisterItemEvent(4800243, 1, "I4800243_OnUse") aux.RegisterItemEvent(4800243, 0, "I4800243_CanUse")