function c9010401_OnTalk(MapID, InstanceID, TargetID, TargetTypeID, RoleID, TalkIndex) local menuIDs = {950463,950465,950524,950619,950732,951021,951025,951050,951233,951843,951863} local collectionIDs = {} collectionIDs[1] = {6600681,{8099155,8099156,8099157},{950472,950473,950471}} collectionIDs[2] = {6600682,{8099159,8099160,8099161},{950475,950476,950474}} collectionIDs[3] = {6600687,{8099201,8099202,8099203},{950526,950527,950525}} collectionIDs[4] = {6600688,{8099212,8099213,8099214},{950621,950622,950620}} collectionIDs[5] = {6600689,{8099270,8099271,8099272},{950734,950735,950733}} collectionIDs[6] = {6600690,{8099439,8099440,8099441},{951023,951024,951022}} collectionIDs[7] = {6600691,{8099442,8099443,8099444},{951027,951028,951026}} collectionIDs[8] = {6600692,{8099515,8099516,8099517},{951052,951053,951051}} collectionIDs[9] = {6600693,{8099705,8099706,8099707},{951235,951236,951234}} collectionIDs[10] = {6600694,{8099820,8099821,8099822},{951845,951846,951844}} collectionIDs[11] = {6600695,{8099852,8099853,8099854},{951865,951866,951864}} local maskCoinNum = getMaskCoinNum(RoleID) local MsgID = msg.BeginMsgEvent() if TalkIndex == -1 then msg.AddMsgEvent(MsgID, 20, 950461) -- Собрано <p1> из 20 жетонов.\nВ зависимости от заполненности можно получать различные бонусы.\n10%: ОЗ +21000 Повышение урона всех классов +100\n20%: ОЗ +26500 Повышение урона всех классов +130\n30%: ОЗ +32000 Повышение урона всех классов +160\n40%: ОЗ +41000 Повышение урона всех классов +190\n50%: ОЗ +50000 Повышение урона всех классов +220\n65%: ОЗ +57000 Повышение урона всех классов +250\n80%: ОЗ +74000 Повышение урона всех классов +280\n100%: ОЗ +98000 Повышение урона всех классов +340. msg.AddMsgEvent(MsgID, 24, TargetID) msg.AddMsgEvent(MsgID, 9, maskCoinNum) msg.AddMsgEvent(MsgID, 21, 4) msg.AddMsgEvent(MsgID, 1, 950462) --Получить бонус за коллекцию. for i = 1, #menuIDs do msg.AddMsgEvent(MsgID, 21, i+10) msg.AddMsgEvent(MsgID, 1, menuIDs[i]) end elseif TalkIndex == 4 then if maskCoinNum >=2 then local buffLevel = math.floor(maskCoinNum/1) role.AddSkill(RoleID, 9101900+buffLevel) else msg.AddMsgEvent(MsgID, 20, 950467) -- Недостаточно коллекций для получения бонуса. msg.AddMsgEvent(MsgID, 24, TargetID) msg.AddMsgEvent(MsgID, 21, -1) msg.AddMsgEvent(MsgID, 1, 951137) -- Назад end elseif TalkIndex >= 11 and TalkIndex < 30 then local ind = TalkIndex-10 local tmp = collectionIDs[ind] if role.GetRoleItemNum(RoleID, tmp[1]) < 1 then if checkMask(RoleID, tmp[2]) == 1 then msg.AddMsgEvent(MsgID, 20, tmp[3][1]) msg.AddMsgEvent(MsgID, 24, TargetID) msg.AddMsgEvent(MsgID, 21, 30+((ind-1)*2)) msg.AddMsgEvent(MsgID, 1, 950470) --Сдать маски. else msg.AddMsgEvent(MsgID, 20, tmp[3][2]) msg.AddMsgEvent(MsgID, 24, TargetID) msg.AddMsgEvent(MsgID, 21, -1) msg.AddMsgEvent(MsgID, 1, 951137) -- normalin- end else msg.AddMsgEvent(MsgID, 20, tmp[3][3]) msg.AddMsgEvent(MsgID, 24, TargetID) msg.AddMsgEvent(MsgID, 21, 31+((ind-1)*2)) msg.AddMsgEvent(MsgID, 1, 950468) --Получить маски. end elseif TalkIndex >= 30 and TalkIndex%2 == 0 then local tmp = collectionIDs[math.floor((TalkIndex-30)/2)+1] if role.GetBagFreeSize(RoleID) >= 1 then role.QuestAddRoleItem(MapID, InstanceID, RoleID,53008, tmp[1], 1, -1, 420) for i = 1,#tmp[2] do role.RemoveFromRole(MapID, InstanceID, RoleID, tmp[2][i], 1, 400) end else msg.AddMsgEvent(MsgID, 20, 950469) -- Недостаточно свободных ячеек в инвентаре. msg.AddMsgEvent(MsgID, 24, TargetID) end elseif TalkIndex >= 30 and TalkIndex%2 == 1 then local tmp = collectionIDs[math.floor((TalkIndex-30)/2)+1] if role.GetBagFreeSize(RoleID) >= #tmp[2] then role.RemoveFromRole(MapID, InstanceID, RoleID, tmp[1], 1, 101) for i = 1,#tmp[2] do role.AddRoleItem(MapID, InstanceID, RoleID, tmp[2][i], 1, 6, 8, 420) end role.RemoveSkill(RoleID, 91019) else msg.AddMsgEvent(MsgID, 20, 950469) ---- Недостаточно свободных ячеек в инвентаре. msg.AddMsgEvent(MsgID, 24, TargetID) end end msg.DispatchRoleMsgEvent(RoleID, MsgID) end function checkMask(RoleID,MaskIDs) for i = 1,#MaskIDs do if role.GetRoleItemNum(RoleID, MaskIDs[i]) < 1 then return 0 end end return 1 end function getMaskCoinNum(RoleID) local num = 0 if role.GetRoleItemNum(RoleID, 6600681) > 0 then num = num + 1 end if role.GetRoleItemNum(RoleID, 6600682) > 0 then num = num + 1 end for i = 6600687,6600704 do if role.GetRoleItemNum(RoleID, i) > 0 then num = num + 1 end end return num end aux.RegisterCreatureEvent(9010401, 7, "c9010401_OnTalk")