Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- -- # --------------------------------------------- #
- -- # Questfile from Metin2SF by Ethoard #
- -- # --------------------------------------------- #
- quest pet_system begin
- state start begin
- when letter begin
- cmdchat("petguihideshow "..q.getcurrentquestindex())
- end
- function givebonus(x)
- local mobVnum = pc.getqf("mobVnum")
- local y,boni = {10,54,1},pet_system.bonusliste()
- table.foreach(boni[x],function(i,l) cmdchat("HaustierBonus"..i.." "..l.."") affect.add_collect(y[i],l,60*60*24*365*60) end )
- cmdchat("HaustierLevel "..pc.getqf('petlevel_'..mobVnum).."")
- cmdchat("HaustierName "..pc.get_name().."")
- pc.setqf("petruf",1)
- pc.setqf("petguishow",1)
- end
- function bonusliste()
- return {
- [1] = {20,10,500},
- [2] = {30,20,1000},
- [3] = {40,30,1500},
- [4] = {50,45,2000},
- [5] = {65,60,3000},
- }
- end
- function removebonus(x)
- local y,boni = {10,54,1},pet_system.bonusliste()
- table.foreach(boni[x],function(i,l) affect.remove_collect(y[i],l,60*60*24*365*60) end )
- pc.setqf("petruf",0)
- --cmdchat("HidePetGui")
- pc.setqf("petguishow",0)
- cleartimer("bugcheck")
- end
- function get_pet_info(itemVnum)
- pet_info_map = {
- [53001] = {34001, "Ognisty Feniks", 0},
- [53002] = {34002, "Mały Reniferek", 0},
- [53003] = {34003, "Lodowy Feniks", 0},
- [53005] = {34004, "Azraeluś ", 1},
- [53006] = {34009, "Złoty Azraeluś ", 1},
- [53007] = {34010, "Bambi", 0},
- [53008] = {34011, "Knuud", 0},
- [53009] = {34012, "Bao Bao", 0},
- [53010] = {34008, "Leonidas", 0},
- [53011] = {34007, "Ethan", 0},
- [53012] = {34005, "Boczuś ", 0},
- [53013] = {34006, "Rufus", 0},
- [53017] = {34013, "Kat", 0},
- [53026] = {34026, "Scooby Doo", 0},
- [53027] = {34027, "Kudłaty", 0},
- [53028] = {34028, "Biały Lis", 0},
- [53029] = {34029, "Królik", 0},
- [53030] = {34030, "Halloween Bałwan", 0},
- [53031] = {34031, "Opanc. Smoczek", 0},
- [53032] = {34032, "Trzygłowy Smok", 0},
- [53033] = {34033, "Drakuś ", 1},
- [53034] = {34034, "Malphite", 0},
- [53035] = {34035, "Prastary Smok", 0},
- [53036] = {34036, "Azjatycki Smok", 0},
- [53037] = {34037, "Zmutowany Bulbasaur", 0},
- [53038] = {34038, "Smocze Dziecko", 0},
- [53039] = {34039, "Dostojny Żółw", 0},
- [53040] = {34040, "Lew Samuraja", 0},
- [53041] = {34041, "Słodki Koala", 0},
- [53042] = {34042, "Osa", 0},
- [53043] = {34043, "Demoniczny Lew", 0},
- [53044] = {34044, "Krokodyl Samuraj", 0},
- [53045] = {34045, "Papuga Pirat", 0},
- [53046] = {34046, "Zakochany Kundel", 0},
- [53047] = {34047, "Waleczna Pantera ", 0},
- [53048] = {34048, "Gryf", 0},
- }
- itemVnum = tonumber(itemVnum)
- return pet_info_map[itemVnum]
- end
- function get_spawn_effect_file(idx)
- effect_table = {
- [0] = nil,
- [1] = "d:\\\\ymir work\\\\effect\\\\etc\\\\appear_die\\\\npc2_appear.mse",
- }
- return effect_table [idx]
- end
- when login with pc.getqf("pet_vnum") != 0 begin
- item.select(pc.getqf("pet_item_id"))
- pet.summon(pc.getqf("pet_vnum"), " Pet", false)
- end
- when 53001.use or 53002.use or 53003.use or 53005.use or 53006.use or
- 53007.use or 53008.use or 53009.use or 53010.use or 53011.use or 53012.use or
- 53013.use or 53017.use or 53026.use or 53027.use or 53028.use or 53029.use or
- 53030.use or 53031.use or 53032.use or 53033.use or 53034.use or 53035.use or
- 53036.use or 53037.use or 53038.use or 53039.use or 53040.use or 53041.use or
- 53042.use or 53043.use or 53044.use or 53045.use or 53046.use or 53047.use or
- 53048.use begin
- local pet_info = pet_system.get_pet_info(item.vnum)
- if null != pet_info then
- local mobVnum = pet_info[1]
- local petName = pet_info[2]
- local spawn_effect_file_name = pet_system.get_spawn_effect_file(pet_info[4])
- pc.setqf("mobVnum",mobVnum)
- if true == pet.is_summon(mobVnum) then
- if spawn_effect_file_name != nil then
- pet.spawn_effect (mobVnum, spawn_effect_file_name)
- end
- pet.unsummon(mobVnum)
- pet_system.removebonus(pc.getqf('petlevel_'..mobVnum))
- cmdchat("HidePetGui")
- syschat("Twój zwierzak został odesłany")
- else
- if pet.count_summoned() < 1 then
- pet.summon(mobVnum, " Lv. "..(pc.getqf("petlevel_"..mobVnum)).." ".. petName, false)
- if pet_info[4] ~= nil then
- cmdchat(pet_info[4])
- end
- if pc.getqf('petlevel_'..mobVnum) == 0 then
- pc.setqf('petlevel_'..mobVnum,1)
- end
- syschat("Twój zwierzak został wezwany.")
- pet_system.givebonus(pc.getqf('petlevel_'..mobVnum))
- local expprocent1 = {20, 80, 160, 350, 400}
- cmdchat("PetProcentExp "..(pc.getqf("exp_"..mobVnum)/expprocent1[pc.getqf("petlevel_"..mobVnum)]).."")
- cmdchat("ShowPetGui")
- loop_timer("bugcheck", 0.2)
- else
- syschat("Masz już zwierzaka!")
- end
- if spawn_effect_file_name != nil then
- pet.spawn_effect(mobVnum, spawn_effect_file_name)
- end
- end -- if pet.is_summon
- end -- if null != pet_info
- end -- when
- when kill with not npc.is_pc() begin
- local mobVnum = pc.getqf("mobVnum")
- if pc.getqf("petlevel_"..mobVnum) == 5 then
- return
- else
- if pc.getqf("petruf")==1 then
- --intervall = 10
- --if pc.get_level() <= mob.get_level(npc.get_race())+ intervall then -- du darfst nur max 10 lvl über das monster sein
- pc.setqf("exp_"..mobVnum,pc.getqf("exp_"..mobVnum)+1)
- local exp2up = {2000, 8000, 16000, 35000, 40000}
- local expprocent = {20, 80, 160, 350, 400}
- cmdchat("PetProcentExp "..(pc.getqf("exp_"..mobVnum)/expprocent[pc.getqf("petlevel_"..mobVnum)]).."")
- if pc.getqf("exp_"..mobVnum) == exp2up[pc.getqf("petlevel_"..mobVnum)] then
- if pc.getqf("petlevel_"..mobVnum) == 4 then
- notice_all("|cFFFFFF30|h[CH"..pc.get_channel_id().."]:|h|r Zwierzak "..pc.get_name().." osiąga swój maksymalny poziom "..(pc.getqf("petlevel_"..mobVnum)+1).." Gratulacje!")
- end
- say_title("Gratulacje!")
- say("Twój zwierzak osiąga poziom "..(pc.getqf("petlevel_"..mobVnum)+1).."")
- say("Przywołaj go ponownie!")
- pc.setqf("petlevel_"..mobVnum,pc.getqf("petlevel_"..mobVnum)+1)
- pc.setqf("exp_"..mobVnum,0)
- pet_system.removebonus(pc.getqf('petlevel'))
- end
- end -- if not...
- end -- if pc.get...
- end -- when
- -- Bugschutz
- when bugcheck.timer begin
- if pc.is_dead() then
- pet_system.removebonus(pc.getqf('petlevel'))
- end
- end
- when login or logout or disconnect with pc.getqf("petruf") == 1 begin
- local mobVnum = pc.getqf("mobVnum")
- pet_system.removebonus(pc.getqf('petlevel_'..mobVnum))
- cmdchat("HidePetGui")
- chat("Twój zwierzak nie przyszedł z tobą....")
- chat("Przywołaj go ponownie!")
- end
- when button or info begin
- local mobVnum = pc.getqf("mobVnum")
- if pc.getqf("petruf") == 1 and pc.getqf("petguishow") == 1 then
- cmdchat("HidePetGui")
- pc.setqf("petguishow",0)
- syschat("Twoje okno ze zwierzakiem zostało zamknięte, możesz je ponownie otworzyć za pomocą przycisku w inwentarzu!")
- elseif pc.getqf("petruf") == 1 and pc.getqf("petguishow") == 0 then
- cmdchat("ShowPetGui")
- local expprocent1 = {20, 80, 160, 350, 400}
- cmdchat("PetProcentExp "..(pc.getqf("exp_"..mobVnum)/expprocent1[pc.getqf("petlevel_"..mobVnum)]).."")
- pc.setqf("petguishow",1)
- syschat("Twoje okno ze zwierzakiem zostało otwarte, możesz je ponownie zamknąć za pomocą przycisku w inwentarzu!")
- elseif pc.getqf("petruf") == 0 then
- syschat("Nie przywołałeś zwierzaka!")
- end
- end
- end -- state
- end -- quest
Advertisement
Add Comment
Please, Sign In to add comment