function Buff_OnDestroy ( MapID, InstanceID, RoleID, BuffID ) --buff消失 if BuffID == 9816901 then --- Сундук unit.CancelBuff(MapID, InstanceID, RoleID, 9999601) unit.AddBuff(MapID, InstanceID, RoleID,9003301,RoleID) end if BuffID == 9999602 then --- Пешая прогулка unit.CancelBuff(MapID, InstanceID, RoleID, 9999601) end if BuffID == 9846001 then unit.CancelBuff(MapID, InstanceID, RoleID, 9999601) end if BuffID == 9999602 then unit.CancelBuff(MapID, InstanceID, RoleID, 9999601) end --[[--两小时结束,第一个buff消失,添加第二个buff if BuffID == 9700101 then unit.AddBuff(MapID, InstanceID, RoleID, 9700201, RoleID) --三小时结束,第二个buff消失,添加第三个buff elseif BuffID == 9700201 then unit.AddBuff(MapID, InstanceID, RoleID, 9700301, RoleID) ------发放三小时奖励 role.BaibaoAddRoleItem(MapID, InstanceID, RoleID, 6020001, 2, -1, 12, 1200) --六小时结束,第三个buff消失,添加第四个buff elseif BuffID == 9700301 then unit.AddBuff(MapID, InstanceID, RoleID, 9700401, RoleID) ------发放六小时奖励 role.BaibaoAddRoleItem(MapID, InstanceID, RoleID, 3070010, 1, -1, 12, 1200) end]] -- if BuffID == 9999001 then -- if MapID == 2216111541 then -- local godMiracleID = GodMiracleTypeID[5010110].GodMiracleTypeID -- local guildID = guild.GetRoleGuildID(RoleID); -- if guildID ~= nil and guildID ~= -1 then -- local guildAlliance = guild.GetGuildAllianceType(godMiracleID, guildID) -- if guildAlliance ~= nil then -- if guildAlliance == 1 or guildAlliance == 0 then -- role.RoleGotoNewMap(MapID, InstanceID, RoleID, 2216111541, 9021/50,5940,45269/50) -- unit.AddBuff(MapID, InstanceID, RoleID,9999801,RoleID) -- elseif guildAlliance == 2 then -- role.RoleGotoNewMap(MapID, InstanceID, RoleID, 2216111541, 43058/50,5170,10603/50) -- unit.AddBuff(MapID, InstanceID, RoleID,9999801,RoleID) -- end -- end -- end -- end -- end if BuffID == 9812901 then role.DeleteQuest(RoleID,53001) role.DeleteQuest(RoleID,53004) end if BuffID == 3206001 then--长兵 local t = math.random(100) if t <= 5 then unit.AddBuff(MapID, InstanceID, RoleID,3206101,RoleID) elseif t > 5 and t <= 30 then unit.AddBuff(MapID, InstanceID, RoleID,3206301,RoleID) elseif t > 30 and t <= 50 then unit.AddBuff(MapID, InstanceID, RoleID,3206401,RoleID) elseif t > 50 and t <= 70 then unit.AddBuff(MapID, InstanceID, RoleID,3206601,RoleID) elseif t > 70 and t <= 100 then unit.AddBuff(MapID, InstanceID, RoleID,3206701,RoleID) end end if BuffID == 3207101 then--弓 local t = math.random(100) if t <= 5 then unit.AddBuff(MapID, InstanceID, RoleID,3206101,RoleID) elseif t > 5 and t <= 30 then unit.AddBuff(MapID, InstanceID, RoleID,3206801,RoleID) elseif t > 30 and t <= 50 then unit.AddBuff(MapID, InstanceID, RoleID,3206401,RoleID) elseif t > 50 and t <= 70 then unit.AddBuff(MapID, InstanceID, RoleID,3206601,RoleID) elseif t > 70 and t <= 100 then unit.AddBuff(MapID, InstanceID, RoleID,3206701,RoleID) end end if BuffID == 3207201 then--琴 local t = math.random(100) if t <= 5 then unit.AddBuff(MapID, InstanceID, RoleID,3206101,RoleID) elseif t > 5 and t <= 30 then unit.AddBuff(MapID, InstanceID, RoleID,3206901,RoleID) elseif t > 30 and t <= 50 then unit.AddBuff(MapID, InstanceID, RoleID,3206401,RoleID) elseif t > 50 and t <= 70 then unit.AddBuff(MapID, InstanceID, RoleID,3206601,RoleID) elseif t > 70 and t <= 100 then unit.AddBuff(MapID, InstanceID, RoleID,3206701,RoleID) end end if BuffID == 3207301 then--法器 local t = math.random(100) if t <= 5 then unit.AddBuff(MapID, InstanceID, RoleID,3206101,RoleID) elseif t > 5 and t <= 30 then unit.AddBuff(MapID, InstanceID, RoleID,3206301,RoleID) elseif t > 30 and t <= 50 then unit.AddBuff(MapID, InstanceID, RoleID,3206401,RoleID) elseif t > 50 and t <= 70 then unit.AddBuff(MapID, InstanceID, RoleID,3206601,RoleID) elseif t > 70 and t <= 100 then unit.AddBuff(MapID, InstanceID, RoleID,3206701,RoleID) end end if BuffID == 3208301 then--龙啸凤鸣戒指套装 local t = math.random(100) if t <= 25 then unit.AddBuff(MapID, InstanceID, RoleID,3208401,RoleID) elseif t <= 50 then unit.AddBuff(MapID, InstanceID, RoleID,3208601,RoleID) elseif t <= 75 then unit.AddBuff(MapID, InstanceID, RoleID,3208801,RoleID) else unit.AddBuff(MapID, InstanceID, RoleID,3208901,RoleID) end end ------仲夏夜活动 if BuffID == 9008101 then local quest = role.IsRoleHaveQuest(MapID, InstanceID, RoleID, 30798) if quest == true then unit.AddBuff(MapID, InstanceID, RoleID,9008201,RoleID) role.SetRoleScriptData(RoleID, 1, RoleDataType["zhongxiaye"], 0) end end if BuffID == 9008201 then local quest = role.IsRoleHaveQuest(MapID, InstanceID, RoleID, 30798) if quest == true then unit.AddBuff(MapID, InstanceID, RoleID,9008301,RoleID) role.SetRoleScriptData(RoleID, 1, RoleDataType["zhongxiaye"], 0) end end if BuffID == 9008301 then local quest = role.IsRoleHaveQuest(MapID, InstanceID, RoleID, 30798) if quest == true then unit.AddBuff(MapID, InstanceID, RoleID,9008401,RoleID) role.SetRoleScriptData(RoleID, 1, RoleDataType["zhongxiaye"], 0) end end if BuffID == 9008401 then local quest = role.IsRoleHaveQuest(MapID, InstanceID, RoleID, 30798) if quest == true then unit.AddBuff(MapID, InstanceID, RoleID,9008501,RoleID) role.SetRoleScriptData(RoleID, 1, RoleDataType["zhongxiaye"], 0) end end if BuffID == 9008501 then local quest = role.IsRoleHaveQuest(MapID, InstanceID, RoleID, 30798) if quest == true then role.ModSpecialTargetValue(MapID, InstanceID, RoleID, 30798, 2) role.SetRoleScriptData(RoleID, 1, RoleDataType["zhongxiaye"], 1) return end end end aux.RegisterBuffEvent( 0, "Buff_OnDestroy" ) function q30798_OnComplete(MapID, InstanceID, QuestID, RoleID, NPCID) local zhongxiayehuodong = role.GetRoleScriptData(RoleID, 1, RoleDataType["zhongxiaye"]) if zhongxiayehuodong == 1 then return 1 end end aux.RegisterQuestEvent(30798, 5, "q30798_OnComplete") function q30798_Complete(MapID, InstanceID, QuestID, RoleID, NPCID) unit.AddBuff(MapID, InstanceID, RoleID,9008101,RoleID) role.SetRoleScriptData(RoleID, 1, RoleDataType["zhongxiaye"], 0) end aux.RegisterQuestEvent(30798, 0, "q30798_Complete") function q30798_OnCancel(MapID, InstanceID, QuestID, RoleID, NPCID) unit.CancelBuff(MapID, InstanceID,RoleID,9008101) unit.CancelBuff(MapID, InstanceID,RoleID,9008201) unit.CancelBuff(MapID, InstanceID,RoleID,9008301) unit.CancelBuff(MapID, InstanceID,RoleID,9008401) unit.CancelBuff(MapID, InstanceID,RoleID,9008501) end aux.RegisterQuestEvent(30798, 2, "q30798_OnCancel")