Paste #40662: Untitled Paste

Date: 2017/03/13 18:56:48 UTC-07:00
Type: Denizen Script

View Raw Paste Download This Paste
Copy Link


## 엔더리치 제단 관련 컨텐츠
##


endlich_altar_check:
    type: world
    events:
        on server start:
        - if <server.has_files[<s@EnderlichSetup.yaml_key[configpath]>]> {
            - yaml load:<s@EnderlichSetup.yaml_key[configpath]> id:endlich }
         else {
            ## 디폴트 파일 생성
            - yaml create id:endlich
            - yaml id:endlich set version:<s@EnderlichSetup.yaml_key[version]>
            - yaml savefile:<s@EnderlichSetup.yaml_key[configpath]> id:endlich
         }
        on reload scripts:
        - if <server.has_files[<s@EnderlichSetup.yaml_key[configpath]>]> {
            - yaml load:<s@EnderlichSetup.yaml_key[configpath]> id:endlich }
         else {
            ## 디폴트 파일 생성
            - yaml create id:endlich
            - yaml id:endlich set version:<s@EnderlichSetup.yaml_key[version]>
            - yaml savefile:<s@EnderlichSetup.yaml_key[configpath]> id:endlich
         }



        on player places beacon in world:

        - if <context.item_in_hand.display||null> != <&a>altar<&nbsp>core queue clear
        #중심핵 중복체크
        - define r 20
        - define duplication cu@<context.location.add[<def[r]>,<def[r]>,<def[r]>]>|<context.location.sub[<def[r]>,<def[r]>,<def[r]>]>
        - define previous_altar <yaml[endlich].list_keys[altar].unescaped||null>
#        - define previous_altar <yaml[endlich].list_keys[altar]||null>

        ## 중심핵이 한번도 설치된 적이 없다면, 에러 방지를 위해 아래로 바로 넘김.
        - if <def[previous_altar]> == null goto potato
        ## 기존 설치위치를 모두 확인함.
        - narrate "설치위치 확인 시작"
        - foreach <def[previous_altar]> {
            - narrate "<def[loop_index]> 위치 확인중"
            - define value <def[value].as_location>
            - narrate "<def[value]> 확인"
#            - define value <def[value]>
            - if <def[value].material.name||null> != beacon {
                - narrate "<&3>오류 데이터가 삭제됩니다.<n> <def[value].simple> is <def[value].material.name> <n>다시 설치를 시도해 보십시오."
                - run endlich_altar_data_remove def:<def[value]> instantly
                - determine cancelled
                - queue clear
            }
            - if <def[value].is_within[<def[duplication]>]||null> == true {
                - narrate "<&c>다른 제단과 너무 가까이 있습니다.<n> 다른 제단의 위치:<def[value].simple>"
                - if <player.has_flag[endlich_altar_duplication]> == false {
                    - playeffect <def[value]> effect:MOBSPAWNER_FLAMES quantity:1 offset:0 target:<player>
                    - playsound <def[value]> sound:ENTITY_FIREWORK_LAUNCH
                    - flag player endlich_altar_duplication:<def[value].simple> duration:5s
                }
                - narrate 실행하니?
                - determine cancelled
                - narrate 됨?
                - queue clear
            }
           # - wait 1t
        }
        - mark potato

        - yaml id:endlich set altar.<context.location.simple.escaped>.status:initial
        - yaml savefile:<s@EnderlichSetup.yaml_key[configpath]> id:endlich
        - narrate "<&a>엔드리치 제단 중심핵이 설치되었습니다! <context.location.simple>"
        - narrate "<&a>엔드리치 완드로 제단을 완성하십시오!"
        - playeffect <context.location> effect:ENDER_SIGNAL quantity:1 offset:0 target:<player>
        - playsound <context.location> sound:ENTITY_ENDERDRAGON_FLAP   pitch:0.5

        ## 비콘 제거시 이벤트, 중심핵 여부 확인 후 제거함
        on player breaks beacon in world:
        - define previous_altar <yaml[endlich].list_keys[altar].unescaped||null>
        - foreach <def[previous_altar]> {
            - if <def[value].is[equals].to[<context.location.simple>]> {
                - run endlich_altar_data_remove def:<context.location> instantly
                - queue clear
            }
        }

        #완드로 클릭하였을 때 이벤트
        ## 완드 예외처리
        on player clicks beacon with endlich_wand:
        - determine passively cancelled
        ## 중심핵이 맞는가?
        - ~run endlich_altar_exist_check def:<context.location> instantly
        - if <player.flag[endlich_altar_exist_check]||false> != true {
            - narrate "<&3>중심핵에 오류가 있습니다. 다시 설치해 보시십시오."
            - queue clear }
        - flag player endlich_altar_exist_check:!
        # 핵의 status에 따라서 이벤트 발생함.
        - choose "<yaml[endlich].read[altar.<context.location.simple>.status]>":
            - case "initial":
                - ~run endlich_altar_construct_initial def:<context.location> instantly
            - case "constructed":
                - ~run endlich_altar_check_stablility def:<context.location> instantly



### 제단 데이터 제거
endlich_altar_data_remove:
    type: task
    definitions: location
    script:
    - narrate "<&c>엔드리치 제단 중심핵이 제거되었습니다! <def[location].simple>"
    - yaml id:endlich set altar.<def[location].simple>:!
    - yaml savefile:<s@EnderlichSetup.yaml_key[configpath]> id:endlich
    - playeffect <def[location]> effect:MOBSPAWNER_FLAMES quantity:1 offset:0 target:<player>
    - playsound <def[location]> sound:ITEM_BOTTLE_FILL_DRAGONBREATH

### 제단인지 여부 확인 스크립트
endlich_altar_exist_check:
    type: task
    definitions: location
    script:
    - if <yaml[endlich].list_keys[altar].contains[<def[location].simple>]||null> == true {
        - flag player endlich_altar_exist_check:true d:10s
    }

###
# 제단 초기검사.
endlich_altar_construct_initial:
    type: task
    definitions: location
    script:
    - if <player.has_flag[endlich_altar_construct_initial]> {
        - actionbar "<&6>잠시 기다리십시오."
        - queue clear }

    - flag player endlich_altar_construct_initial:true d:10s
    - playeffect <def[location].center.add[0,-0.5,0]> effect:portal quantity:30 offset:0 data:3
    - playsound <def[location].center.add[0,-0.5,0]> sound:BLOCK_PORTAL_AMBIENT pitch:1
    ## 기본조건 통과함.
    ## 범위지정 및 검사 시작
    - define altar_total cu@<def[location].add[5,7,5]>|<def[location].add[-5,-4,-5]>
    - narrate "<&a>제단의 양식이 적절하게 되어있는지 확인합니다. 제단의 범위를 확인하십시오."
    - showfake purple_wool <def[altar_total].outline> d:10s

    ## 제단 양식을 확인함
    ## 상단 다이아몬드
    - if <def[location].add[0,5,0].material.name> != diamond_block {
        - narrate "<&a>제단을 만드려면 우선 중심핵 <&c>5칸 <&a> <&b>다이아 블럭<&a> 설치되어야 합니다."
        - narrate "<&a>정확한 위치를 양털로 표시햇습니다. 확인하십시오."
        - showfake red_wool <def[location].add[0,5,0]> d:15s
        - queue clear }

    ## 최하단 석탄블럭 확인
    - define altar_base cu@<def[location].add[5,-4,5]>|<def[location].add[-5,-4,-5]>
    - if <def[altar_base].blocks[coal_block].size> < 121 {
        - define showglass cu@<def[location].add[5,-1,5]>|<def[location].add[-5,-3,-5]>
        - define showglass_notair <def[showglass].blocks>
        - define showglass_air <def[showglass].blocks[air]>
        - define showglass_notair <def[showglass_notair].exclude[<def[showglass_air]>]>
        - showfake barrier <def[showglass_notair]> d:10s
        - wait 1s
        - showfake barrier <def[showglass_notair]> d:10s
    }

    - ~run endlich_altar_postion_check def:제단기반|<def[altar_base].escaped>|coal_block|==|121

    - if <player.has_flag[endlich_altar_construstion_제단기반]||flase> {
        - flag player endlich_altar_construstion_제단기반:!
        - queue clear }

    ## 중심핵 아래 옵시디언 확인
    - define altar_corebase cu@<def[location].add[1,-1,1]>|<def[location].add[-1,-1,-1]>
    - ~run endlich_altar_postion_check def:중심핵<&nbsp>기반|<def[altar_corebase].escaped>|obsidian|==|9 instantly

    - if <player.flag[endlich_altar_construstion_중심핵<&nbsp>기반]||flase> == false {
        - flag player endlich_altar_construstion_중심핵<&nbsp>기반:!
        - queue clear }

    ## 각종 블럭의 비율 확인
    - define altar_diamond_block <def[altar_total].blocks[diamond_block].size>
    - define altar_gold_block <def[altar_total].blocks[gold_block].size>
    - define altar_emerald_block <def[altar_total].blocks[emerald_block].size>
    - define altar_iron_block <def[altar_total].blocks[iron_block].size>
    - define altar_total_metal_block <def[altar_diamond_block].add[<def[altar_gold_block]>].add[<def[altar_emerald_block]>].add[<def[altar_iron_block]>]>
    - define altar_obsidian <def[altar_total].blocks[obsidian].size>
    - define altar_end_bricks <def[altar_total].blocks[end_bricks].size>
    - define altar_total_obsiend <def[altar_obsidian].add[<def[altar_end_bricks]>]>
    - define altar_obsidian_percent <def[altar_obsidian].div[<def[altar_total_obsiend]>].mul[100]>
    - define altar_endbrick_percent <def[altar_end_bricks].div[<def[altar_total_obsiend]>].mul[100]>
    - define altar_bone_block <def[altar_total].blocks[bone_block].size>

    - if <def[altar_total_metal_block]> < 36 {
        - narrate "<&b>다이아 혹은 금, 에메랄드,  블럭<&6> 부족합니다. 모두 합쳐 <&b>36<&6> 이상이 설치되어 있어야 합니다.<n>현재 <&b><def[altar_total_metal_block]><&6>개가 설치되어 있습니다."
        - queue clear }
    - if <def[altar_total_obsiend]> < 100 {
        - narrate "<&b>흑요석 혹은 엔더 벽돌<&6> 부족합니다. 모두 합쳐 <&b>100<&6> 이상이 설치되어 있어야 합니다.<n>현재 <&b><def[altar_total_obsiend]><&6>개가 설치되어 있습니다."
        - narrate "<&b>흑요석과 엔더 벽돌<&6> 비율은 각각 최소한 <&b>30%<&6>이상이어야 합니다."
        - queue clear }
    - if <def[altar_obsidian_percent]> < 30 {
        - narrate "<&b>흑요석<&6> 비율이 너무 낮습니다.<n><&6>현재 설치된 흑요석의 비율 : <&b><def[altar_obsidian_percent]>%"
        - queue clear }
    - if <def[altar_endbrick_percent]> < 30 {
        - narrate "<&b>엔더 벽돌<&6> 비율이 너무 낮습니다.<n><&6>현재 설치된 엔더 벽돌의 비율 : <&b><def[altar_endbrick_percent]>%"
        - queue clear }
    - if <def[altar_bone_block]> < 32 {
        - narrate "<&b> 블럭<&6> 부족합니다. 모두 합쳐 <&b>32<&6> 이상이 설치되어 있어야 합니다.<n>현재 <&b><def[altar_bone_block]><&6>개가 설치되어 있습니다."
        - queue clear }

    # 상자 확인
    - define altar_chest li@<def[location].add[3,-1,0]>|<def[location].add[0,-1,3]>|<def[location].add[-3,-1,0]>|<def[location].add[0,-1,-3]>
    - define enderlich_altar_chest 0
    - foreach <def[altar_chest]> {
        - if <def[value].material.name> != chest {
            - define enderlich_altar_chest <def[enderlich_altar_chest].add[1]>
            - showfake red_wool <def[value]> d:10s
        }
    }
    - if <def[enderlich_altar_chest]> > 0 {
        - narrate "<&b>상자<&6> 설치되어 있어야 합니다. 위치를 확인하십시오."
        - queue clear }

    # 모루 확인
    - define altar_chest li@<def[location].add[4,-1,0]>|<def[location].add[0,-1,4]>|<def[location].add[-4,-1,0]>|<def[location].add[0,-1,-4]>
    - define enderlich_altar_chest 0
    - foreach <def[altar_chest]> {
        - if <def[value].material.name> != anvil {
            - define enderlich_altar_chest <def[enderlich_altar_chest].add[1]>
            - showfake red_wool <def[value]> d:10s
        }
    }
    - if <def[enderlich_altar_chest]> > 0 {
        - narrate "<&b>모루<&6> 설치되어 있어야 합니다. 위치를 확인하십시오."
        - queue clear }

    ## 완료되어 제단설치 시작
#    - yaml id:endlich set altar.<context.location.simple.escaped>.status:initial
    - yaml id:endlich set altar.<def[location].simple>.status:constructed
    - yaml savefile:<s@EnderlichSetup.yaml_key[configpath]> id:endlich
    - run enderlich_altar_effect1 def:<def[location].center.add[0,0,0]> instantly
    - narrate "<&2>축하합니다. 제단이 설치되었습니다!!"
    - ~run endlich_altar_check_stablility def:<def[location]> instantly

#region check
#region - cuboid.escaped로 넘겨받음 받는즉시 .unescaped
# first_block, first_count: 블럭과 숫자
endlich_altar_postion_check:
    type: task
    definitions: class|region|block|operator|count
    script:
    - define region <def[region].unescaped>
    - if <def[region].blocks[<def[block]>].size.is[<def[operator]>].to[<def[count]>]> {
        - ~run endlich_altar_postion_check_showfakeblocks_true }
    else {
        - ~run endlich_altar_postion_check_showfakeblocks_false def:<def[class]>|<def[region].escaped>|<def[block]>|<def[count]> instantly }

endlich_altar_postion_check_showfakeblocks_true:
    type: task
    debug: false
    script:
    - mark dummy

endlich_altar_postion_check_showfakeblocks_false:
    type: task
    debug: false
    definitions: class|region|block|count
    script:
    - define region <def[region].unescaped>
    - narrate "<&b><def[class]><&6> 제대로 설치되지 않았습니다. <n>  - <&b><def[block]> <def[count]><&6>개가 있어야 합니다.<n>  - 현재 <&b><def[count].sub[<def[region].blocks[<def[block]>].size>]><&6>개가 부족합니다."
    - narrate "  <&6>- <&4>붉은색 양털<&6> 위치가 표시됩니다.<n>  <&6>- <&b><def[region].blocks.get[1].simple><&6>부터 <&b><def[region].blocks.get[<def[region].blocks.size>].simple>"
    - flag player endlich_altar_construstion_<def[class]>:false
    - run endlich_altar_showfakes def:<def[region].escaped> instantly

endlich_altar_showfakes:
    type: task
    debug: false
    definitions: region
    script:
    - define region <def[region].unescaped>
    - repeat 5 {
        - showfake red_wool <def[region].blocks> d:1s
        - wait 0.5s
        - showfake cancel <def[region].blocks>
        - wait 0.5s
    }


endlich_altar_check_stablility:
    type: task
    debug: false
    definitions: location
    script:
    ## 중복실행 금지 예외처리 먼저.
#    - if <player.has_flag[endlich_altar_construct_stable_check]> {
#        - actionbar "<&6>잠시 기다리십시오."
#        - queue clear }
#    - flag player endlich_altar_construct_stable_check:true d:5s
#    - playeffect <def[location].center.add[0,-0.5,0]> effect:portal quantity:30 offset:0 data:3
#    - playsound <def[location].center.add[0,-0.5,0]> sound:BLOCK_PORTAL_AMBIENT pitch:1
    ## 기본조건 통과함.


    ## 범위지정 및 검사 시작
    - define altar cu@<def[location].add[5,7,5]>|<def[location].add[-5,-4,-5]>
    - define altar_block <def[altar].blocks>

    ## 대칭검사
    - define symmetry 0
    - foreach <def[altar_block]> {
        - define altar_pos <def[location].sub[<def[value]>]>
        - define altar_pos_y <def[altar_pos].y.mul[-2]>
        - define altar_pos_oppsite <def[location].add[<def[altar_pos]>].add[0,<def[altar_pos_y]>,0]>
        #- showfake lime_wool <def[value]> d:1s
        #- showfake blue_wool <def[altar_pos_oppsite]> d:1s
        - if <def[value].material.name> != <def[altar_pos_oppsite].material.name> {
            - define symmetry <def[symmetry].add[1]>
#            - narrate "대칭아님 <def[value]>"
#            - narrate "대칭아님 <def[value].material>"
#            - narrate "대칭아님 <def[altar_pos_oppsite].material>"
#            - showfake lime_wool <def[value]> d:1s
#            - showfake red_wool <def[altar_pos_oppsite]> d:1s
        }
    }
    # 대칭검사결과
 #   - narrate <def[symmetry]>

    ##자원사용
#
#
#
#
#








endlich_altar_check_dummy_need_to_remove:
    type: world
    events:
        on player clicks beacon with ddd:
#알타의 조건
# 다이아 블럭 or 철 or 금 or 에메 > 36개
# 옵시/엔더벽돌 합쳐서 > 100개, 각각 30% 이상 비중
# 뼈 블럭 > 32개 이상
# 비콘 > 안정성 max 5
        ## 안정성검사
        # 한쪽만 디파인
        - define altar_stabe_part cu@<context.location.add[5,7,5]>|<context.location.add[1,-3,1]>
        - showfake stone <def[altar_stabe_part].blocks> d:5s
        - narrate 검사종료
#        - ~run endlich_altar_postion_check def:매트릭스|<def[altar_matrix].escaped>|diamond_block|>=|1
#            - define altar_base cu@<context.location.add[5,-4,5]>|<context.location.add[-5,-4,-5]>
#            - narrate airsize=<def[altar_base].blocks[air].size>
#            - narrate <&6>altar_base<&b><def[altar_base]>
#            - run endlich_altar_postion_check def:제단기반|<def[altar_base].escaped>|coal_block|==|121
#            - define size <def[altar_base].size>
#            - define size <def[size].x.mul[<def[size].y>].mul[<def[size].z>].round>
#        }
# /dn <player.location.cursor_on.find.entities.within[2].parse[entity_type]>
#/dn <player.location.cursor_on.find.entities.within[2].parse[entity_type]>
# <player.location.cursor_on.find.entities.within[2].filter[<entity_type.is[==].to[dropped_item]>].parse[item]> 
###cuboid comperator basic form
#    - if <def[region].blocks[<def[block]>].size.is[<def[operator]>].to[<def[count]>]> {
#        - narrate true  }
#    else {
#        - narrate false }