-- Учитель и ученик function x_RoleHandleMaster(MasterID, ApprenticeID) local MsgID = msg.BeginMsgEvent() -- Начало события сообщения msg.AddMsgEvent(MsgID, 100, 2330) msg.AddMsgEvent(MsgID, 2, MasterID) msg.AddMsgEvent(MsgID, 2, ApprenticeID) msg.DispatchWorldMsgEvent(MsgID) -- Отправка мирового сообщения end -- Добавление друга function x_RoleAddFriend(MapID, InstanceID, RoleID, FriendID) local k = role.GetFriendNum(RoleID) if k > 19 and k % 10 == 0 then role.NotifyFBBS(RoleID, 8, k) end local Trail = {1004, 2006, 3007, 4006, 5007, 6009} for i = 1, 6 do if role.GetTrialCompleteNum(RoleID, Trail[i]) < k then role.SetTrialCompleteNum(RoleID, Trail[i], k) end if role.GetTrialState(RoleID, Trail[i]) == 1 and role.GetTrialCompleteNum(RoleID, Trail[i]) >= Trail_maxnum[Trail[i]] then role.TrialComplete(RoleID, Trail[i]) end end end -- Изучение нового навыка function x_RoleLearnNewSkill(MapID, InstanceID, RoleID, SkillID) if SkillID >= 9100101 and SkillID <= 9100305 then local Trail = {2013, 4014, 6014, 8024} for i = 1, 4 do if role.GetTrialCompleteNum(RoleID, Trail[i]) < SkillID % 100 then role.SetTrialCompleteNum(RoleID, Trail[i], SkillID % 100) end if role.GetTrialState(RoleID, Trail[i]) == 1 and role.GetTrialCompleteNum(RoleID, Trail[i]) >= Trail_maxnum[Trail[i]] then role.TrialComplete(RoleID, Trail[i]) end end elseif SkillID == 9000301 then if role.GetTrialCompleteNum(RoleID, 3003) ~= 1 then role.SetTrialCompleteNum(RoleID, 3003, 1) end if role.GetTrialState(RoleID, 3003) == 1 and role.GetTrialCompleteNum(RoleID, 3003) >= Trail_maxnum[3003] then role.TrialComplete(RoleID, 3003) end elseif SkillID == 3050907 then role.AddSkill(RoleID, 3051101) elseif SkillID == 3040111 then role.AddSkill(RoleID, 3051201) elseif SkillID == 3060709 then role.AddSkill(RoleID, 3051301) end end -- Создание гильдии function x_RoleCreatAGuild(MapID, InstanceID, RoleID, GuildID) role.NotifyFBBS(RoleID, 5, GuildID) end -- Получение титула function x_RoleGetATitle(RoleID, TitleID) role.NotifyFBBS(RoleID, 10, TitleID) end -- Проверка возможности добавления врага function x_CanAddEnemy(MapID, InstanceID, RoleID, KillID) if MapID == 2092183860 or MapID == 3772027712 or MapID == 3772027712 or MapID == 2092184116 or MapID == 2092184372 or MapID == 965743517 or MapID == 965743261 or MapID == 965744029 or MapID == 965742749 then return 0 else return 1 end end -- Убийство монстра local YUANBAO_KILL_REWARD_PER_DROP = 1 -- Сколько юаньбао дается за один успешный прок local YUANBAO_KILL_DROP_CHANCE_PERCENT = 1 -- Шанс выпадения юаньбао (в процентах) local YUANBAO_KILL_DAILY_LIMIT = 100 -- Максимум юаньбао в сутки local YUANBAO_KILL_MIN_LEVEL = 70 -- Минимальный уровень персонажа для выпадения юаньбао local KILL_ITEM_TYPE_ID = 1160133 -- ID предмета, который может выпадать с монстров local KILL_ITEM_REWARD_PER_DROP = 1 -- Сколько предметов 1160133 дается за один успешный прок local KILL_ITEM_DROP_CHANCE_PERCENT = 1 -- Шанс выпадения предмета 1160133 (в процентах) local KILL_ITEM_DAILY_LIMIT = 10 -- Максимум предметов 1160133 в сутки local KILL_COUPON_REWARD_PER_DROP = 1 -- Сколько купонов дается за один успешный прок local KILL_COUPON_DROP_CHANCE_PERCENT = 50 -- Шанс выпадения купонов (в процентах) local KILL_COUPON_DAILY_LIMIT = 5000 -- Максимум купонов в сутки local KILL_COUPON_NOTIFY_STEP = 100 -- Шаг уведомлений по купонам (сообщение раз в каждые N купонов) function x_KillMonster(MapID, InstanceID, RoleID, MonID, CreatureTypeID) local level = role.GetRoleLevel(MapID, InstanceID, RoleID) local quest = {52064, 52072, 52120, 52133, 52137} local quest_item = {6600608, 6600761, 6601135, 6601256, 6602173} if (MapID == 3424072488 and (level >= 50 and level <= 59)) or (MapID == 3424072232 and (level >= 60 and level <= 79)) or (MapID == 3424075048 and (level >= 80 and level <= 94)) or (MapID == 3424074792 and (level >= 95 and level <= 104)) or (MapID == 3440849960 and level >= 105) then for i = 1, #quest do local isquest = role.IsRoleHaveQuest(MapID, InstanceID, RoleID, quest[i]) if isquest == true then local random_chance = math.random(1, 100) -- Генерация случайного числа от 1 до 100 if random_chance <= 5 then -- 50% шанс на получение предмета role.QuestAddRoleItem(MapID, InstanceID, RoleID, quest[i], quest_item[i], 1, -1, 420) end end end end local curDay = tonumber(os.date("%j")) or 0 local lastDay = role.GetRoleScriptData(RoleID, 1, RoleDataType["YuanbaoKillLastDay"]) or 0 local dailyCount = role.GetRoleScriptData(RoleID, 1, RoleDataType["YuanbaoKillDailyCount"]) or 0 if curDay ~= lastDay then dailyCount = 0 role.SetRoleScriptData( RoleID, 2, RoleDataType["YuanbaoKillLastDay"], curDay, RoleDataType["YuanbaoKillDailyCount"], dailyCount ) end if level >= YUANBAO_KILL_MIN_LEVEL and dailyCount < YUANBAO_KILL_DAILY_LIMIT then local dropRoll = math.random(1, 1300) if dropRoll <= YUANBAO_KILL_DROP_CHANCE_PERCENT then role.AddRoleYuanBao(MapID, InstanceID, RoleID, YUANBAO_KILL_REWARD_PER_DROP) dailyCount = dailyCount + YUANBAO_KILL_REWARD_PER_DROP if dailyCount > YUANBAO_KILL_DAILY_LIMIT then dailyCount = YUANBAO_KILL_DAILY_LIMIT end role.SetRoleScriptData(RoleID, 1, RoleDataType["YuanbaoKillDailyCount"], dailyCount) local MsgID = msg.BeginMsgEvent() msg.AddMsgEvent(MsgID, 102, 990001) msg.AddMsgEvent(MsgID, 9, dailyCount) msg.DispatchRoleMsgEvent(RoleID, MsgID) end end local itemLastDay = role.GetRoleScriptData(RoleID, 1, RoleDataType["KillItemLastDay"]) or 0 local itemDailyCount = role.GetRoleScriptData(RoleID, 1, RoleDataType["KillItemDailyCount"]) or 0 if curDay ~= itemLastDay then itemDailyCount = 0 role.SetRoleScriptData( RoleID, 2, RoleDataType["KillItemLastDay"], curDay, RoleDataType["KillItemDailyCount"], itemDailyCount ) end if itemDailyCount < KILL_ITEM_DAILY_LIMIT then local bagOk = true if type(role.GetBagFreeSize) == "function" then bagOk = (tonumber(role.GetBagFreeSize(RoleID)) or 0) >= KILL_ITEM_REWARD_PER_DROP end if bagOk then local itemDropRoll = math.random(1, 1000) if itemDropRoll <= KILL_ITEM_DROP_CHANCE_PERCENT then local addRet = role.AddRoleItem(MapID, InstanceID, RoleID, KILL_ITEM_TYPE_ID, KILL_ITEM_REWARD_PER_DROP, -1, 8, 420) local addedOk = addRet ~= nil and addRet ~= -1 if addedOk then itemDailyCount = itemDailyCount + KILL_ITEM_REWARD_PER_DROP if itemDailyCount > KILL_ITEM_DAILY_LIMIT then itemDailyCount = KILL_ITEM_DAILY_LIMIT end role.SetRoleScriptData(RoleID, 1, RoleDataType["KillItemDailyCount"], itemDailyCount) local itemMsgID = msg.BeginMsgEvent() msg.AddMsgEvent(itemMsgID, 102, 990002) msg.AddMsgEvent(itemMsgID, 9, itemDailyCount) msg.DispatchRoleMsgEvent(RoleID, itemMsgID) end end end end local couponLastDay = role.GetRoleScriptData(RoleID, 1, RoleDataType["KillCouponLastDay"]) or 0 local couponDailyCount = role.GetRoleScriptData(RoleID, 1, RoleDataType["KillCouponDailyCount"]) or 0 if curDay ~= couponLastDay then couponDailyCount = 0 role.SetRoleScriptData( RoleID, 2, RoleDataType["KillCouponLastDay"], curDay, RoleDataType["KillCouponDailyCount"], couponDailyCount ) end if couponDailyCount < KILL_COUPON_DAILY_LIMIT then local couponDropRoll = math.random(1, 100) if couponDropRoll <= KILL_COUPON_DROP_CHANCE_PERCENT then local addCoupons = KILL_COUPON_REWARD_PER_DROP if couponDailyCount + addCoupons > KILL_COUPON_DAILY_LIMIT then addCoupons = KILL_COUPON_DAILY_LIMIT - couponDailyCount end if addCoupons > 0 then local prevCouponCount = couponDailyCount role.AddRoleGiftPoints(MapID, InstanceID, RoleID, addCoupons) couponDailyCount = couponDailyCount + addCoupons role.SetRoleScriptData(RoleID, 1, RoleDataType["KillCouponDailyCount"], couponDailyCount) local prevStep = math.floor(prevCouponCount / KILL_COUPON_NOTIFY_STEP) local currStep = math.floor(couponDailyCount / KILL_COUPON_NOTIFY_STEP) if currStep > prevStep then local couponMsgID = msg.BeginMsgEvent() msg.AddMsgEvent(couponMsgID, 102, 990003) msg.AddMsgEvent(couponMsgID, 9, couponDailyCount) msg.DispatchRoleMsgEvent(RoleID, couponMsgID) end end end end end -- Получение редкого поля function x_GetRareField(MapID, InstanceId, RoleID, FieldID) local index = 411000 + math.floor(FieldID / 100) local MsgID = msg.BeginMsgEvent() msg.AddMsgEvent(MsgID, 100, index) msg.AddMsgEvent(MsgID, 2, RoleID) msg.DispatchWorldMsgEvent(MsgID) -- Отправка мирового сообщения end -- Захват редкого поля function x_CaptureRareField(MapID, InstanceId, TargetID, RoleID, FieldID) if FieldID == 3003401 then local MsgID = msg.BeginMsgEvent() msg.AddMsgEvent(MsgID, 100, 452034) msg.AddMsgEvent(MsgID, 2, RoleID) msg.AddMsgEvent(MsgID, 2, TargetID) msg.DispatchWorldMsgEvent(MsgID) elseif FieldID == 3003501 then local MsgID = msg.BeginMsgEvent() msg.AddMsgEvent(MsgID, 100, 452035) msg.AddMsgEvent(MsgID, 2, RoleID) msg.AddMsgEvent(MsgID, 2, TargetID) msg.DispatchWorldMsgEvent(MsgID) elseif FieldID == 3003601 then local MsgID = msg.BeginMsgEvent() msg.AddMsgEvent(MsgID, 100, 452036) msg.AddMsgEvent(MsgID, 2, RoleID) msg.AddMsgEvent(MsgID, 2, TargetID) msg.DispatchWorldMsgEvent(MsgID) elseif FieldID == 3003701 then local MsgID = msg.BeginMsgEvent() msg.AddMsgEvent(MsgID, 100, 452037) msg.AddMsgEvent(MsgID, 2, RoleID) msg.AddMsgEvent(MsgID, 2, TargetID) msg.DispatchWorldMsgEvent(MsgID) elseif FieldID == 3003801 then local MsgID = msg.BeginMsgEvent() msg.AddMsgEvent(MsgID, 100, 452038) msg.AddMsgEvent(MsgID, 2, RoleID) msg.AddMsgEvent(MsgID, 2, TargetID) msg.DispatchWorldMsgEvent(MsgID) elseif FieldID == 3003901 then local MsgID = msg.BeginMsgEvent() msg.AddMsgEvent(MsgID, 100, 452039) msg.AddMsgEvent(MsgID, 2, RoleID) msg.AddMsgEvent(MsgID, 2, TargetID) msg.DispatchWorldMsgEvent(MsgID) elseif FieldID == 3004001 then local MsgID = msg.BeginMsgEvent() msg.AddMsgEvent(MsgID, 100, 452040) msg.AddMsgEvent(MsgID, 2, RoleID) msg.AddMsgEvent(MsgID, 2, TargetID) msg.DispatchWorldMsgEvent(MsgID) elseif FieldID == 3004101 then local MsgID = msg.BeginMsgEvent() msg.AddMsgEvent(MsgID, 100, 452041) msg.AddMsgEvent(MsgID, 2, RoleID) msg.AddMsgEvent(MsgID, 2, TargetID) msg.DispatchWorldMsgEvent(MsgID) elseif FieldID == 3004201 then local MsgID = msg.BeginMsgEvent() msg.AddMsgEvent(MsgID, 100, 452042) msg.AddMsgEvent(MsgID, 2, RoleID) msg.AddMsgEvent(MsgID, 2, TargetID) msg.DispatchWorldMsgEvent(MsgID) elseif FieldID == 3004301 then local MsgID = msg.BeginMsgEvent() msg.AddMsgEvent(MsgID, 100, 452043) msg.AddMsgEvent(MsgID, 2, RoleID) msg.AddMsgEvent(MsgID, 2, TargetID) msg.DispatchWorldMsgEvent(MsgID) elseif FieldID == 3004401 then local MsgID = msg.BeginMsgEvent() msg.AddMsgEvent(MsgID, 100, 452044) msg.AddMsgEvent(MsgID, 2, RoleID) msg.AddMsgEvent(MsgID, 2, TargetID) msg.DispatchWorldMsgEvent(MsgID) else local index = 412000 + math.floor(FieldID / 100) local MsgID = msg.BeginMsgEvent() msg.AddMsgEvent(MsgID, 100, index) msg.AddMsgEvent(MsgID, 2, RoleID) msg.AddMsgEvent(MsgID, 2, TargetID) msg.DispatchWorldMsgEvent(MsgID) end end -- Повышение уровня бога function x_GodLevelUp(MapID, InstanceID, RoleID, Level) local k = role.GetRoleScriptData(RoleID, 1, RoleDataType["God_Quest"]) if Level > 9 then Level = 9 end role.SetRoleScriptData(RoleID, 1, RoleDataType["God_Quest"], math.floor(k / 10) * 10 + Level) if role.IsRoleHaveQuest(MapID, InstanceID, RoleID, 20201) then role.ModSpecialTargetValue(MapID, InstanceID, RoleID, 20201, 2) end if role.IsRoleHaveQuest(MapID, InstanceID, RoleID, 40064) and Level >= 3 then role.ModSpecialTargetValue(MapID, InstanceID, RoleID, 40064, 2) end end -- Пробуждение первого поля function x_FieldWakeUp(MapID, InstanceId, RoleID, FieldID) if FieldID == 2003401 then local k = role.GetRoleScriptData(RoleID, 1, RoleDataType["God_Quest"]) role.SetRoleScriptData(RoleID, 1, RoleDataType["God_Quest"], k % 100 + 100) if role.IsRoleHaveQuest(MapID, InstanceID, RoleID, 40061) then role.ModSpecialTargetValue(MapID, InstanceID, RoleID, 40061, 2) end end end -- Проверка возможности использования NPC function x_CanUseDakNPC(MapID, InstanceId, RoleID, ToMap, x, y, z) if role.IsRoleHaveBuff(MapID, InstanceID, RoleID, 61016) then local MsgID = msg.BeginMsgEvent() msg.AddMsgEvent(MsgID, 26, 444017) -- Получение текущего уровня, нельзя использовать NPC msg.DispatchRoleMsgEvent(RoleID, MsgID) return false elseif MapID == 3390517288 or ToMap == 3390517288 then return false else if ToMap == 3424071720 and role.IsRoleHaveQuest(MapID, InstanceID, RoleID, 20300) then role.SetRoleScriptData(RoleID, 1, RoleDataType["BeiZhouTianXue"], 1) role.ModSpecialTargetValue(MapID, InstanceID, RoleID, 20300, 2) end return true end end -- Проверка возможности использования храма земли function x_CanUseEarthTemple(MapID, InstanceId, RoleID, ToMap, x, y, z) if role.IsRoleHaveBuff(MapID, InstanceID, RoleID, 61016) then local MsgID = msg.BeginMsgEvent() msg.AddMsgEvent(MsgID, 26, 444017) -- Получение текущего уровня, нельзя использовать NPC msg.DispatchRoleMsgEvent(RoleID, MsgID) return false elseif MapID == 3390517288 or ToMap == 3390517288 or MapID == 965742749 or MapID == 965743517 or MapID == 965743261 or MapID == 965744029 then return false else return true end end -- Изменение количества модных костюмов function x_OnFashionSuitNumChg(MapID, InstanceID, RoleID) local _, _, _, playerSuitNum, _ = role.GetWardrobeDetailInfo(MapID, InstanceID, RoleID) local changetable = {} changetable[14] = 40 changetable[13] = 36 changetable[12] = 31 changetable[11] = 27 changetable[10] = 23 changetable[9] = 19 changetable[8] = 16 changetable[7] = 13 changetable[6] = 10 changetable[5] = 8 changetable[4] = 6 changetable[3] = 4 changetable[2] = 3 changetable[1] = 2 if playerSuitNum < 2 and role.IsLearnedSkill(RoleID, 91021) then role.RemoveSkill(RoleID, 91021) else for i = 14, 1, -1 do if playerSuitNum and playerSuitNum >= changetable[i] then local level = role.IsLearnedSkill(RoleID, 91021) if level ~= nil then role.RemoveSkill(RoleID, 91021) end role.AddSkill(RoleID, 9102100 + i) break end end end end -- Повышение уровня гардероба function x_OnWardLevelUp(MapID, InstanceID, RoleID) if role.GetRoleScriptData(RoleID, 1, RoleDataType["ShiShangPingLun"]) >= 10 then local _, _, _, playerSuitNum, _ = role.GetWardrobeDetailInfo(MapID, InstanceID, RoleID) local changetable = {} changetable[9102114] = 40 changetable[9102113] = 36 changetable[9102112] = 31 changetable[9102111] = 27 changetable[9102110] = 23 changetable[9102109] = 19 changetable[9102108] = 16 changetable[9102107] = 13 changetable[9102106] = 10 changetable[9102105] = 8 changetable[9102104] = 6 changetable[9102103] = 4 changetable[9102102] = 3 changetable[9102101] = 2 if playerSuitNum < 2 and role.IsLearnedSkill(RoleID, 91021) then role.RemoveSkill(RoleID, 91021) else for i = 9102114, 9102101, -1 do if playerSuitNum and playerSuitNum >= changetable[i] then role.RemoveSkill(RoleID, 91021) role.AddSkill(RoleID, i) break end end end end end -- Завершение задания на доске function x_OnCompleteBoardQuest(MapID, InstanceID, RoleID, QuestID, BoardID, Money, Exp) local jinqiantequan = 0 for i = 1, 6 do if role.IsRoleHaveBuff(MapID, InstanceID, RoleID, 90048 + i) then jinqiantequan = 1 elseif role.IsRoleHaveBuff(MapID, InstanceID, RoleID, 90048 + i + 6) then jinqiantequan = 2 elseif role.IsRoleHaveBuff(MapID, InstanceID, RoleID, 90048 + i + 12) then jinqiantequan = 3 end end if role.IsRoleHaveBuff(MapID, InstanceID, RoleID, 61045) then local Exp1 = 3 * Exp role.AddRoleExp(MapID, InstanceID, RoleID, Exp1) end if role.IsRoleHaveBuff(MapID, InstanceID, RoleID, 61044) then local y, z = role.GetBuffLayer(RoleID, 6104401) local Money1 = math.floor(y * 0.04 * Money) local Exp1 = math.floor(y * 0.04 * Exp) role.AddRoleExp(MapID, InstanceID, RoleID, Exp1) role.AddRoleSilver(MapID, InstanceID, RoleID, Money1) end if role.IsRoleHaveBuff(MapID, InstanceID, RoleID, 61050) or role.IsRoleHaveBuff(MapID, InstanceID, RoleID, 20586) then local Exp2 = 5 * Exp role.AddRoleExp(MapID, InstanceID, RoleID, Exp2) end if role.IsRoleHaveBuff(MapID, InstanceID, RoleID, 61051) then -- Двойной опыт if not role.IsRoleHaveBuff(MapID, InstanceID, RoleID, 61050) then local Exp2 = 2 * Exp local Money2 = 2 * Money role.AddRoleExp(MapID, InstanceID, RoleID, Exp2) role.AddRoleSilver(MapID, InstanceID, RoleID, Money2) end elseif jinqiantequan == 1 then local Money2 = 0.2 * Money role.AddRoleSilver(MapID, InstanceID, RoleID, Money2) elseif jinqiantequan == 2 then local Money2 = 1 * Money role.AddRoleSilver(MapID, InstanceID, RoleID, Money2) elseif jinqiantequan == 3 then local Money2 = 2 * Money role.AddRoleSilver(MapID, InstanceID, RoleID, Money2) end if role.IsRoleHaveBuff(MapID, InstanceID, RoleID, 20552) then local Exp1 = 9 * Exp role.AddRoleExp(MapID, InstanceID, RoleID, Exp1) end if role.IsRoleHaveBuff(MapID, InstanceID, RoleID, 90081) then local Exp1 = 1.5 * Exp role.AddRoleExp(MapID, InstanceID, RoleID, Exp1) end if role.IsRoleHaveBuff(MapID, InstanceID, RoleID, 90082) then local Exp1 = 2 * Exp role.AddRoleExp(MapID, InstanceID, RoleID, Exp1) end if role.IsRoleHaveBuff(MapID, InstanceID, RoleID, 90083) then local Exp1 = 2.5 * Exp role.AddRoleExp(MapID, InstanceID, RoleID, Exp1) end if role.IsRoleHaveBuff(MapID, InstanceID, RoleID, 90084) then local Exp1 = 3 * Exp role.AddRoleExp(MapID, InstanceID, RoleID, Exp1) end if role.IsRoleHaveBuff(MapID, InstanceID, RoleID, 90085) then local Exp1 = 4 * Exp role.AddRoleExp(MapID, InstanceID, RoleID, Exp1) end end -- Проверка экипировки при смене карты function x_OnCheckEquipAttWhenChangeMap(MapID, InstanceID, RoleID, TypeID, High_64, Low_64) if MapID == S59_MapID then return 1 else return 0 end end -- Проверка возможности использования экипировки function x_OnCheckEquipCanBeUsed(MapID, InstanceID, RoleID, TypeID, High_64, Low_64) if MapID == S59_MapID then if InstanceID ~= 100 and InstanceID ~= 101 then return 1 else local MsgID = msg.BeginMsgEvent() msg.AddMsgEvent(MsgID, 26, 211038) -- Текущая карта не позволяет использовать экипировку msg.DispatchRoleMsgEvent(RoleID, MsgID) -- Отправка сообщения return 0 end else local MsgID = msg.BeginMsgEvent() msg.AddMsgEvent(MsgID, 26, 305001) -- Экипировка доступна только на специальных картах msg.DispatchRoleMsgEvent(RoleID, MsgID) -- Отправка сообщения return 0 end end aux.RegisterRoleEvent(27, "x_RoleHandleMaster") aux.RegisterRoleEvent(46, "x_RoleAddFriend") aux.RegisterRoleEvent(47, "x_RoleLearnNewSkill") aux.RegisterRoleEvent(57, "x_RoleCreatAGuild") aux.RegisterRoleEvent(31, "x_RoleGetATitle") aux.RegisterRoleEvent(58, "x_CanAddEnemy") aux.RegisterRoleEvent(59, "x_KillMonster") aux.RegisterRoleEvent(60, "x_GodLevelUp") --aux.RegisterRoleEvent(62, "x_GodChangeModle") aux.RegisterRoleEvent(63, "x_GetRareField") aux.RegisterRoleEvent(64, "x_CaptureRareField") aux.RegisterRoleEvent(65, "x_FieldWakeUp") aux.RegisterRoleEvent(67, "x_CanUseDakNPC") aux.RegisterRoleEvent(68, "x_CanUseEarthTemple") aux.RegisterRoleEvent(72, "x_OnFashionSuitNumChg") aux.RegisterRoleEvent(73, "x_OnWardLevelUp") aux.RegisterRoleEvent(79, "x_OnCompleteBoardQuest") aux.RegisterRoleEvent(87, "x_OnCheckEquipAttWhenChangeMap") aux.RegisterRoleEvent(88, "x_OnCheckEquipCanBeUsed") function Role_OnDie(MapID, InstanceID, RoleID, KillerID) if unit.IsPlayer(RoleID) and unit.IsPlayer(KillerID) and KillerID ~= RoleID then role.SetTrialCompleteNum(KillerID, 2016, role.GetTrialCompleteNum(KillerID, 2016) + 1) if role.GetTrialState(KillerID, 2016) == 1 and role.GetTrialCompleteNum(KillerID, 2016) >= Trail_maxnum[2016] then role.TrialComplete(KillerID, 2016) end SetKillPlayer(KillerID) local TeamID = role.IsRoleHaveTeam(MapID, InstanceID, RoleID) local equipkrulogo = { {8099784, 8099753, 8099654, 8099648, 8099613, 8099458, 8099438, 8099318, 8099130, 8099124, 8099118, 8099112, 8099106, 8099100, 8099094, 8099088, 8099082, 8099076}, -- Навык Жестокость бога {8099780, 8099749, 8099650, 8099644, 8099609, 8099454, 8099434, 8099314, 8099126, 8099120, 8099114, 8099108, 8099102, 8099096, 8099090, 8099084, 8099078, 8099072}, -- Навык Последняя шалость {8099779, 8099748, 8099649, 8099643, 8099608, 8099453, 8099433, 8099313, 8099125, 8099119, 8099113, 8099107, 8099101, 8099095, 8099089, 8099083, 8099077, 8099071}, -- Навык Кровь за кровь {8099783, 8099752, 8099653, 8099647, 8099612, 8099457, 8099437, 8099317, 8099129, 8099123, 8099117, 8099111, 8099105, 8099099, 8099093, 8099087, 8099081, 8099075}, -- Навык Посмертная служба {8099781, 8099750, 8099651, 8099645, 8099610, 8099455, 8099435, 8099315, 8099127, 8099121, 8099115, 8099109, 8099103, 8099097, 8099091, 8099085, 8099079, 8099073}, -- Навык Дань почившему герою {8099782, 8099751, 8099652, 8099646, 8099611, 8099456, 8099436, 8099316, 8099128, 8099122, 8099116, 8099110, 8099104, 8099098, 8099092, 8099086, 8099080, 8099074} -- Навык Милость перерождения } for i = 1, 6 do for f = 1, 18 do if role.GetEquipIDOnPos(RoleID, 19) == equipkrulogo[i][f] then if i == 1 then local bhave = role.IsRoleHaveBuff(MapID, InstanceID, RoleID, 92448) if not bhave then local x, y, z = unit.GetPosition(MapID, InstanceID, RoleID) local hp = role.GetRoleAttValue(MapID, InstanceID, RoleID, 8) local totem = map.MapCreateColCreature(MapID, InstanceID, 9010393, x, y, z, 1) unit.SetAttValue(MapID, InstanceID, totem, 8, hp) unit.SetAttValue(MapID, InstanceID, totem, 9, hp) unit.AddBuff(MapID, InstanceID, RoleID, 9244801, RoleID) end elseif i == 2 then unit.AddBuff(MapID, InstanceID, KillerID, 9813402, KillerID) elseif i == 3 then unit.AddBuff(MapID, InstanceID, KillerID, 9813401, KillerID) elseif i == 4 then if TeamID == nil or TeamID == 4294967295 then unit.AddBuff(MapID, InstanceID, RoleID, 9813405, RoleID) else local Role = {} Role[1], Role[2], Role[3], Role[4], Role[5], Role[6] = role.IsRoleHaveTeam(MapID, InstanceID, RoleID) for j = 1, 6 do unit.AddBuff(MapID, InstanceID, Role[j], 9813405, Role[j]) unit.AddBuff(MapID, InstanceID, RoleID, 9813405, RoleID) end end elseif i == 5 then local x, y, z = unit.GetPosition(MapID, InstanceID, RoleID) local mobmp = map.MapCreateCreature(MapID, InstanceID, 6010065, x, y, z) unit.AddBuff(MapID, InstanceID, mobmp, 9813303, mobmp) unit.AddBuff(MapID, InstanceID, RoleID, 9813802, RoleID) elseif i == 6 then unit.AddBuff(MapID, InstanceID, RoleID, 9813304, RoleID) end end end end end end aux.RegisterRoleEvent(92, "Role_OnDie")