Paste #133429: Unnamed YAML Paste

Date: 2025/05/18 04:34:26 UTC-07:00
Type: YAML

View Raw Paste Download This Paste
Copy Link


black_market_setup:
  type: task
  script:
  - define rare_items li@
    - superbwarfare:ak_47_blueprint|10000
    - superbwarfare:m_4_blueprint|10000
    - superbwarfare:glock_18_blueprint|10000
    - superbwarfare:ak_12_blueprint|10000
    - superbwarfare:sks_blueprint|10000 
    - superbwarfare:hk_416_blueprint|10000
    - superbwarfare:qbz_95_blueprint|10000
    - superbwarfare:k_98_blueprint|10000
    - superbwarfare:mosin_nagant_blueprint|10000
    - superbwarfare:m_870_blueprint|10000
    - superbwarfare:m_79_blueprint|10000
    - superbwarfare:rpg_blueprint|10000

  - define epic_items li@
    - superbwarfare:vector_blueprint|50000
    - superbwarfare:trachelium_blueprint|50000
    - superbwarfare:insidious_blueprint|50000
    - superbwarfare:mk_14_blueprint|50000
    - superbwarfare:svd_blueprint|50000
    - superbwarfare:m_98b_blueprint|50000
    - superbwarfare:hunting_rifle_blueprint|50000
    - superbwarfare:devotion_blueprint|50000
    - superbwarfare:rpk_blueprint|50000
    - superbwarfare:m_60_blueprint|50000
    - superbwarfare:bocek_blueprint|50000

  - define legendary_items li@
    - superbwarfare:sentinel_blueprint|100000
    - superbwarfare:ntw_20_blueprint|100000
    - superbwarfare:aa_12_blueprint|100000
    - superbwarfare:minigun_blueprint|100000
    - superbwarfare:secondary_cataclysm_blueprint|100000
    - superbwarfare:javelin_blueprint|100000

  - define container_items li@
    - superbwarfare:mk_42_blueprint|200000
    - superbwarfare:mle_1934_blueprint|250000
    - superbwarfare:hpj_11_blueprint|250000

  # Get random, unique rare items
  - define shuffled_rare <util.random.shuffle[<[rare_items]>]>
  - define today_rare1 <[shuffled_rare].get[1]>
  - define today_rare2 <[shuffled_rare].get[2]>

  # Pick others randomly
  - define today_epic <util.random_from[<[epic_items]>]>
  - define today_legendary <util.random_from[<[legendary_items]>]>
  - define today_container <util.random_from[<[container_items]>]>

  # Save flags: split into name and price
  - foreach li@rare1|rare2|epic|legendary|container:
    - define raw "<[today_<[value]>]>"
    - define name "<[raw].before[|]>"
    - define price "<[raw].after[|]>"
    - flag server "blackmarket_<[value]>_name:<[name]>"
    - flag server "blackmarket_<[value]>_price:<[price]>"

  # Update hologram on ZNPC (replace with your actual NPC ID)
  - define npc_id 123
  - execute as_server "znpcs hologram set <[npc_id]> \"&4» &lBLACK MARKET &r&4«\""
  - execute as_server "znpcs hologram add <npc.id[<npc_id>]> \"&7Rare: &f<server.flag[blackmarket_rare1_name]> &8- &a$<server.flag[blackmarket_rare1_price]>\""
  - execute as_server "znpcs hologram add <npc.id[<npc_id>]> \"&7Rare: &f<server.flag[blackmarket_rare2_name]> &8- &a$<server.flag[blackmarket_rare2_price]>\""
  - execute as_server "znpcs hologram add <npc.id[<npc_id>]> \"&5Epic: &d<server.flag[blackmarket_epic_name]> &8- &a$<server.flag[blackmarket_epic_price]>\""
  - execute as_server "znpcs hologram add <npc.id[<npc_id>]> \"&6Legendary: &e<server.flag[blackmarket_legendary_name]> &8- &a$<server.flag[blackmarket_legendary_price]>\""
  - execute as_server "znpcs hologram add <npc.id[<npc_id>]> \"&2Container: &a<server.flag[blackmarket_container_name]> &8- &a$<server.flag[blackmarket_container_price]>\""


black_market_assignment:
  type: assignment
  actions:
    on click:
    - inventory open d:gui_black_market_menu

gui_black_market_menu:
  type: inventory
  title: "&4&lBlack Market"
  size: 27
  slots:
    11:
      display: i@<server.flag[blackmarket_rare1_name]>[display_name=&fRare Item 1,lore=&7Price: $<server.flag[blackmarket_rare1_price]>]
      actions:
        - run black_market_purchase "rare1"
    12:
      display: i@<server.flag[blackmarket_rare2_name]>[display_name=&fRare Item 2,lore=&7Price: $<server.flag[blackmarket_rare2_price]>]
      actions:
        - run black_market_purchase "rare2"
    13:
      display: i@<server.flag[blackmarket_epic_name]>[display_name=&dEpic Item,lore=&7Price: $<server.flag[blackmarket_epic_price]>]
      actions:
        - run black_market_purchase "epic"
    14:
      display: i@<server.flag[blackmarket_legendary_name]>[display_name=&eLegendary Item,lore=&7Price: $<server.flag[blackmarket_legendary_price]>]
      actions:
        - run black_market_purchase "legendary"
    15:
      display: i@<server.flag[blackmarket_container_name]>[display_name=&aContainer Item,lore=&7Price: $<server.flag[blackmarket_container_price]>]
      actions:
        - run black_market_purchase "container"

black_market_purchase:
  type: procedure
  definitions: type
  script:
  - define name <server.flag[blackmarket_<[type]>_name]>
  - define price <server.flag[blackmarket_<[type]>_price].as_decimal>

  - if <player.money> >= <[price]>:
    - money take <player> qty:<[price]>
    - give i@<[name]> to:<player>
    - narrate "<green>You bought <yellow><[name]> <green>for <a>$<[price]>!"
    - playeffect at:<player.location> effect:VILLAGER_HAPPY
  - else:
    - narrate "<red>You need <a>$<[price]> <red>to buy this item."
    - playeffect at:<player.location> effect:SMOKE_NORMAL

# Keep your existing black_market_setup task script here.
# Also add the optional scheduler:

black_market_scheduler:
  type: world
  events:
    on server start:
    - run black_market_setup
    - schedule every 1d run black_market_setup


Highlighting for 'Other' types handled by Highlight.JS, which was released under the BSD 3-Clause License.