qhagod9J
Język: Skript
|
Autor: Anonimowy
# ################################################## # # RPG kowal.sk # # by MatiX119 # # ################################################## # # Testowana wersja MC: 1.12 # # Testowana wersja Skript: v2.2-dev36 # # Testowana wersja SkQuery: v3.6.0-Lime # # Wymagany plugin Vault (+ plugin na ekonomię) # # Wymagany skrypt: RPG basic # # ################################################## # options: # Podaj nazwę NPC, która będzie pełnić rolę kowala. npc-name: &4Kowal # Ustaw typ moba dla NPC. Dozwolone wartości: zombie, skeleton. npc-type: skeleton # Ustaw promień, na którym NPC będzie sprawdzany na swojej lokalizacji. npc-radius: 30 # Ustaw nazwę otwieranego okna GUI jak kliknie się na kowala. GUI-name: &4&lKowal # Ustaw maksymalny poziom ulepszenia przedmiotu. max-upgrade-level: 9 # Ustaw cenę naprawy przedmiotu. repair-cost: 1000 # Ustaw podstawową cenę ulepszenia przedmiotu. upgrade-cost: 5000 # Czy koszt ulepszenia ma być mnożony w zależności od aktualnego poziomu ulepszenia przedmiotu? increasing-costs: true # Ustaw szansę (w procentach) na spalenie przedmiotu u kowala. Dozwolone wartości: 0 - 100. chance-burn-item: 50 # Ustaw przedział, w którym będzie losowane od ilu do ilu punktów będzie przyznawane do ulepszenia broni. upgrade-min: 1 upgrade-max: 5 command /kowal [<text>]: permission: admin permission message: &4Nie masz dostępu do tej komendy. trigger: if arg 1 is "ustaw" or "set" or "create" or "spawn": if {kowal} is set: loop all entities in radius {@npc-radius} around {kowal}: if name of loop-entity is "{@npc-name}": teleport loop-entity to location of player send "&aPrzeniesiono lokalizację dla kowala w tym miejscu." to player if {kowal} is not set: send "&aUstawiono lokalizację w tym miejscu dla kowala. Kowal powinien się za chwilę tu pojawić." to player set {kowal} to location of player if arg 1 is "usun" or "usuń" or "remove" or "delete" or "del": if {kowal} is set: send "&aUsunięto lokalizację kowala (%{kowal}%)." to player loop all entities in radius {@npc-radius} around {kowal}: if name of loop-entity is "{@npc-name}": clear loop-entity delete {kowal} else: send "&cLokalizacja kowala nie została ustawiona." to player if arg 1 is "tp" or "teleport": if {kowal} is set: teleport player to {kowal} send "&aPrzeteleportowano do kowala!" to player else: send "&cLokalizacja kowala nie została ustawiona." to player if arg 1 is "help" or "pomoc" or "?": send "&6/kowal set &3- tworzy NPC kowala." to player send "&6/kowal del &3- usuwa NPC kowala." to player send "&6/kowal tp &3- teleportuje do kowala." to player if arg 1 is not set: execute player command "/kowal help" if arg 1 is not "ustaw" or "set" or "create" or "spawn" or "usun" or "usuń" or "remove" or "delete" or "del" or "tp" or "teleport" or "help" or "pomoc" or "?": execute player command "/kowal help" on target: if name of entity contains "{@npc-name}": cancel event on damage: if name of victim contains "{@npc-name}": cancel event every 10 seconds: if {kowal} is set: loop all entities in radius {@npc-radius} around {kowal}: if name of loop-entity contains "{@npc-name}": set {_check} to true if {_check} is not set: spawn {@npc-type} at location of {kowal} set the last spawned entity's display name to "{@npc-name}" apply slowness 10 without particles to last spawned entity for 999 days set last spawned entity's max health to 99999 set {_check} to true if {_check} is set: loop all entities in radius {@npc-radius} around location of {kowal}: if name of loop-entity contains "{@npc-name}": set {_p} to "Blacksmiths" parsed as offlineplayer set helmet of loop-entity to {_p}'s skull set chestplate of loop-entity to a iron chestplate set leggings of loop-entity to a iron leggings set boots of loop-entity to a iron boots set tool of loop-entity to stone spade heal loop-entity if round x-location of loop-entity is not round x-location of {kowal}: teleport loop-entity to location of {kowal} if round y-location of loop-entity is not round y-location of {kowal}: teleport loop-entity to location of {kowal} if round z-location of loop-entity is not round z-location of {kowal}: teleport loop-entity to location of {kowal} on rightclick on {@npc-type}: if name of clicked entity contains "{@npc-name}": execute console command "/kowal-gui %player%" on rightclick: if name of targeted entity contains "{@npc-name}": if distance between player and targeted entity <= 3: cancel event command /kowal-gui [<player>] [<text>]: permission: admin permission message: &4Nie masz dostępu do tej komendy. executable by: player and console trigger: set {_lvl} to 0 set {_itemname} to name of player-arg's tool set {_name::*} to {_itemname} split at " " loop {_name::*}: if loop-index = "%size of {_name::*}%": if first 1 character of loop-value is "+": set {_l} to length of loop-value set {_lvl} to last {_l} - 1 characters of loop-value set {_lvl} to {_lvl} parsed as integer if {_lvl} is integer: set {_newname} to subtext of {_itemname} from characters 1 to length of {_itemname} - {_l} set {_newname} to "%{_newname}%+%{_lvl}+1%" else: set {_lvl} to 0 set {_newname} to "%{_itemname}% +1" else: set {_lvl} to 0 set {_newname} to "%{_itemname}% +1" if {@increasing-costs} is true: set {_costupgrade} to ({_lvl}+1)*{@upgrade-cost} if {@increasing-costs} is false: set {_costupgrade} to {@upgrade-cost} if arg 2 is not set: open chest inventory with 1 rows named "{@GUI-name}" to player-arg wait 1 tick set {_loreinfo1} to "|| ||&bSzansa na ulepszenie wynosi {@chance-burn-item}%%.||&bW razie niepowodzenia przedmiot spali się!||&6Aby uchronić przedmiot przed spaleniem,||&6musisz posiadać &l1x Magiczne kowadło&6." if {_lvl} < {@max-upgrade-level}: set {_loreinfo2} to "|| ||&2Proponowana cena za ulepszenie do||&2poziomu &6&l+%{_lvl}+1% &2wynosi: &e&l%{_costupgrade}%$&2.|| ||&aKliknij, aby ulepszyć trzymany przedmiot!" else: set {_loreinfo2} to "|| ||&cTwój przedmiot jest ulepszony do||&cmaksymalnego poziomu!" set {_lore0} to "&aTutaj możesz ulepszyć swój przedmiot.||&aPrzedmiot musi posiadać &nbonus siły&a." set player-arg's current inventory's slot 0 to anvil named "&e&lUlepsz siłę" with lore "%{_lore0}%%{_loreinfo1}%%{_loreinfo2}%" set {_lore1} to "&aTutaj możesz ulepszyć swój przedmiot.||&aPrzedmiot musi posiadać &nbonus zręczności&a." set player-arg's current inventory's slot 1 to anvil named "&e&lUlepsz zręczność" with lore "%{_lore1}%%{_loreinfo1}%%{_loreinfo2}%" set {_lore2} to "&aTutaj możesz ulepszyć swój przedmiot.||&aPrzedmiot musi posiadać &nbonus zwinności&a." set player-arg's current inventory's slot 2 to anvil named "&e&lUlepsz zwinność" with lore "%{_lore2}%%{_loreinfo1}%%{_loreinfo2}%" set {_lore3} to "&aTutaj możesz ulepszyć swój przedmiot.||&aPrzedmiot musi posiadać &nbonus szczęścia&a." set player-arg's current inventory's slot 3 to anvil named "&e&lUlepsz szczęście" with lore "%{_lore3}%%{_loreinfo1}%%{_loreinfo2}%" set {_lore4} to "&aTutaj możesz ulepszyć swój przedmiot.||&aPrzedmiot musi posiadać &nzaklęcie ostrości&a." set player-arg's current inventory's slot 4 to anvil named "&e&lUlepsz ostrość" with lore "%{_lore4}%%{_loreinfo1}%%{_loreinfo2}%" set {_lore5} to "&aTutaj możesz ulepszyć swój przedmiot.||&aPrzedmiot musi posiadać &nzaklęcie mocy&a." set player-arg's current inventory's slot 5 to anvil named "&e&lUlepsz moc" with lore "%{_lore5}%%{_loreinfo1}%%{_loreinfo2}%" set {_lore7} to "&aTutaj możesz naprawić swój zużyty||&aprzedmiot.|| ||&2Koszt naprawy: &e&l{@repair-cost}$&2." set player-arg's current inventory's slot 7 to anvil of unbreaking 10 named "&e&lNapraw przedmiot" with lore "%{_lore7}%" set {_lore8} to "&aDaj 64 sztuki stali kowalskiej dla kowala,||&aa otrzymasz 1 magiczne kowadło." set player-arg's current inventory's slot 8 to iron ingot of unbreaking 10 named "&e&lWymień stal kowalską na magiczne kowadło" with lore "%{_lore8}%" if arg 2 is set: set {_anvil} to 1 anvil of unbreaking 10 named "&6&lMagiczne kowadło" with lore "&aChroni przed spaleniem||&aprzedmiotu u kowala." if arg 2 is "8": set {_iron} to 64 iron ingot of unbreaking 10 named "&7&lStal kowalska" if player-arg has {_iron}: remove {_iron} from player-arg give {_anvil} to player-arg send "&aOtrzymałeś 1 magiczne kowadło." to player-arg stop else: send "&cNie masz 64 sztuk stali kowalskiej." to player-arg stop if player-arg's tool is air: send "&cMusisz trzymać w ręku przedmiot!" to player-arg stop if arg 2 is "7": if player-arg's account < {@repair-cost}: send "&cNie masz wystarczającej ilości pieniędzy." to player-arg stop else: if player-arg's tool is sword or axe or pickaxe or spade or bow or shield or helmet or chestplate or elytra or leggings or boots or flint and steel or fishing rod: if data value of player-arg's tool > 0: remove {@repair-cost} from player-arg's account repair player-arg's tool send "&2Twój przedmiot został naprawiony." to player-arg stop else: send "&cNie ma potrzeby naprawy tego przedmiotu." to player-arg stop else: send "&cNie mogę naprawić tego typu przedmiotu." to player-arg stop if "%{_itemname}%" is "<none>": send "&cTego przedmiotu nie mogę ulepszyć." to player-arg stop if arg 2 is "0" or "1" or "2" or "3" or "4" or "5": if {_lvl} >= {@max-upgrade-level}: send "&cTwój przedmiot jest ulepszony do maksymalnego poziomu!" to player-arg stop if player-arg's account < {_costupgrade}: send "&cNie masz wystarczającej ilości pieniędzy." to player-arg stop set {_rand} to random integer from {@upgrade-min} to {@upgrade-max} set {_lore::*} to lore of player-arg's tool split at "||" loop {_lore::*}: set {_check} to uncoloured loop-value replace all "+" and "%%" with "" in {_check} if arg 2 is "0": if {_check} contains "Siła: ": replace "Siła: " with "" in {_check} set {_noerror0} to true set {_line} to loop-index parsed as integer set {_check} to {_check} parsed as integer chance of {@chance-burn-item}%: set {_spalony} to true if {_spalony} is not set: add {_rand} to {_check} if {_check} > 0: set {_check} to "+%{_check}%" set line {_line} of player-arg's tool's lore to "&8Siła: &7%{_check}%" if arg 2 is "1": if {_check} contains "Zręczność: ": replace "Zręczność: " with "" in {_check} set {_noerror1} to true set {_line} to loop-index parsed as integer set {_check} to {_check} parsed as integer chance of {@chance-burn-item}%: set {_spalony} to true if {_spalony} is not set: add {_rand} to {_check} if {_check} > 0: set {_check} to "+%{_check}%" set line {_line} of player-arg's tool's lore to "&8Zręczność: &7%{_check}%" if arg 2 is "2": if {_check} contains "Zwinność: ": replace "Zwinność: " with "" in {_check} set {_noerror2} to true set {_line} to loop-index parsed as integer set {_check} to {_check} parsed as integer chance of {@chance-burn-item}%: set {_spalony} to true if {_spalony} is not set: add {_rand} to {_check} if {_check} > 0: set {_check} to "+%{_check}%" set line {_line} of player-arg's tool's lore to "&8Zwinność: &7%{_check}%" if arg 2 is "3": if {_check} contains "Szczęście: ": replace "Szczęście: " with "" in {_check} set {_noerror3} to true set {_line} to loop-index parsed as integer set {_check} to {_check} parsed as integer chance of {@chance-burn-item}%: set {_spalony} to true if {_spalony} is not set: add {_rand} to {_check} if {_check} > 0: set {_check} to "+%{_check}%" set line {_line} of player-arg's tool's lore to "&8Szczęście: &7%{_check}%" if {_noerror0} is not set: if arg 2 is "0": send "&cNie mogę ulepszyć Twojego przedmiotu, ponieważ nie posiada on bonusu siły." to player-arg stop if {_noerror1} is not set: if arg 2 is "1": send "&cNie mogę ulepszyć Twojego przedmiotu, ponieważ nie posiada on bonusu zręczności." to player-arg stop if {_noerror2} is not set: if arg 2 is "2": send "&cNie mogę ulepszyć Twojego przedmiotu, ponieważ nie posiada on bonusu zwinności." to player-arg stop if {_noerror3} is not set: if arg 2 is "3": send "&cNie mogę ulepszyć Twojego przedmiotu, ponieważ nie posiada on bonusu szczęścia." to player-arg stop if arg 2 is "4": set {_sharp} to level of sharpness of player-arg's tool if {_sharp} = 0: send "&cNie mogę ulepszyć Twojego przedmiotu, ponieważ nie posiada on zaklęcia ostrości." to player-arg stop chance of {@chance-burn-item}%: set {_spalony} to true if {_spalony} is not set: add {_rand} to {_sharp} set {_zaklecie} to "sharpness %{_sharp}%" parsed as enchantment type enchant player-arg's tool with sharpness 0 enchant player-arg's tool with {_zaklecie} if arg 2 is "5": set {_power} to level of power of player-arg's tool if {_power} = 0: send "&cNie mogę ulepszyć Twojego przedmiotu, ponieważ nie posiada on zaklęcia mocy." to player-arg stop chance of {@chance-burn-item}%: set {_spalony} to true if {_spalony} is not set: add {_rand} to {_power} set {_zaklecie} to "power %{_power}%" parsed as enchantment type enchant player-arg's tool with power 0 enchant player-arg's tool with {_zaklecie} if {_spalony} is not set: send "&2Udało się ulepszyć Twój przedmiot." to player-arg set name of player-arg's tool to {_newname} remove {_costupgrade} from player-arg's account if {_spalony} is set: remove {_costupgrade}/2 from player-arg's account if player-arg has {_anvil}: remove {_anvil} from player-arg send "&6Twój przedmiot został uchroniony przed spaleniem przy pomocy magicznego kowadła. Zwrócono połowę kosztów za próbę ulepszenia." to player-arg else: delete player-arg's tool send "&4Twój przedmiot spalił się i nie udało się go ulepszyć! Zwrócono połowę kosztów za próbę ulepszenia." to player-arg on inventory click: set {_inv} to name of player's current inventory set {_click} to player's current inventory's slot slot if {_inv} contains "{@GUI-name}": cancel event if {_click} is null or none or air: stop if "%{_click}%" is "<none>": stop if "%event-slot%" contains "inventory of <none>": set {_click2} to event-slot execute console command "/kowal-gui %player% %index of event-slot%" close player's inventory command /kowal-itemy: permission: admin permission message: &4Nie masz dostępu do tej komendy. trigger: give 1 anvil of unbreaking 10 named "&6&lMagiczne kowadło" with lore "&aChroni przed spaleniem||&aprzedmiotu u kowala." to player give 16 iron ingot of unbreaking 10 named "&7&lStal kowalska" to player # ################################################################### # # INFORMACJA: Stal kowalska powinna ogółem dropić z mobów (jak robisz # # serwer RPG). Zebraną stal wymienia się na magiczne kowadło. Stal # # można wymienić u kowala, jednak można zrobić wymianę np. u osadnika # # z pluginu Shopkeepers. # # ################################################################### #