집을 짓는 공간 미리 확인하는 매크로 > 클래식어시스트 매크로

본문 바로가기

사이트 내 전체검색

뒤로가기 클래식어시스트 매크로

 

집을 짓는 공간 미리 확인하는 매크로

페이지 정보

작성자 fisherH 작성일 24-03-06 05:32 조회 170 댓글 4

본문

저 같이 집을 짓는 컨텐츠가 어려운 분들에게 추천하는 매크로입니다.


이 공간에 집을 지을수있는지 확인하는 매크로이며, 스크립트 중간 square_size = 15   로 집크기를 조절해서 확인해볼수있습니다

마고서버 가장 큰 집기준 15 였기에 기본값으로 저장해놨습니다.



 


 









# Name: Test Tiles for House Placement
# Description: Displays valid tiles for house placement.
# Usage: Stand where you want to place a house and hit play.
# Author: github.com/UltimaScripts/PublicScriptLibrary
# Version: 1.0.0
# Credits: Reetus made the Defs Impassable & SAWorldItem
# Notes:
# WARNING, This Script will Increase Client Memory Usage once ran.
# I recommened restarting the client after you're done using it.
from ClassicAssist.UO.Data import PacketWriter, Statics, TileFlags, MapInfo
from ClassicAssist.UO.Commands import RemoveObject
from Assistant import Engine
from System import *

#Keep in mind Housing Rules
#the east side needs 1 more valid tile
#the south side needs 5 valid tiles

# ===== Options Start =====
# ___remove_display___
## Set remove_display to True to remove the display.
## You can also just run off screen and they should be gone.
## Case / Capitalization matters. (True or False)
remove_display = False
#
# ___square_size___
## Never set square_size higher than 24.
## If you run it with a higher number and,
## want to run it again with a lower number,
## you will need to remove_display first.
## Can run it repeatedly with the same value.
square_size = 15
#
# ___height_tolerance___
## height_tolerance is usually 0.
height_tolerance = 0
# ===== Options End =====

# DO NOT EDIT BELOW THIS
# unless you know what you're doing.

def Impassable(x, y, map = int(Engine.Player.Map)):
    staticTiles = Statics.GetStatics( map, x, y )
    
    if staticTiles == None or staticTiles.Length == 0:
        return MapInfo.GetLandTile(map, x, y).Flags.HasFlag(TileFlags.Impassable)
    
    for x in staticTiles:
        if x.Flags.HasFlag(TileFlags.Impassable):
            return True

    return False

def SAWorldItem(serial, itemId, amount, x, y, z, hue):
      length = 26 if Engine.ClientVersion >= Version( 7, 0, 9, 0 ) else 24
      writer = PacketWriter(length)
      writer.Write(Byte( 0xF3 ))
      writer.Write(Int16( 1 ))
      writer.Write(Byte( 0 ))
      writer.Write(Int32(serial))
      writer.Write(Int16( itemId ))
      writer.Write(Byte( 0 ))
      writer.Write(Int16( amount ))
      writer.Write(Int16( amount ))
      writer.Write(Int16( x ))
      writer.Write(Int16( y ))
      writer.Write(SByte( z ))
      writer.Write(Byte( 0 ))
      writer.Write(Int16( hue ))
      writer.Write(Byte( 0x20 ))
      writer.Fill()
      return writer

# Removes the objects from the gameworld
if remove_display == True:
    remove_size = (((square_size + 1) * 2) * ((square_size + 1) * 2))
    for x in range(remove_size):
        value = (1073741824 + x)
        RemoveObject(value)
    Stop()

# Roads list is technically incomplete.
# May lead to false results, outside of roads.
Roads = [0x0071, 0x0078, 0x00E8, 0x00EB
         0x07AE, 0x07B1, 0x3FF4, 0x3FF4
         0x3FF8, 0x3FFB, 0x0442, 0x0479
         0x0501, 0x0510, 0x0009, 0x0015
         0x0150, 0x015C
         0x170, 0x72, 0x73, 0x74, 0x75
         0x76, 0x77, 0x79, 0x7A, 0x7C,
         0x7D, 0x7E, 0x82, 0x83, 0x85,
         0x86, 0x87, 0x88, 0x89, 0x8A,
         0x8B, 0x8C, 0x16f]

# Don't change count, it's hex value is 0x40000000
count = 1073741824
for xx in range(-abs(square_size),(square_size + 1)):
    for yy in range(-abs(square_size),(square_size + 1)):
        x = (X() + xx)
        y = (Y() + yy)
        z0 = Z()
        map = int(Engine.Player.Map)
        z = MapInfo.GetLandTile(map, x, y).Z
        idd = MapInfo.GetLandTile(map, x, y).ID
        count += 1
        # Impassable Check
        impass1 = Impassable(x, y)
        for xxx in range(-1,2):
            for yyy in range(-1,2):
                x1 = (x + xxx)
                y1 = (y + yyy)
                z1 = MapInfo.GetLandTile(map, x1, y1).Z
                impass2 = Impassable(x1, y1)
                if impass2 == True:
                    break
            if impass2 == True:
                    break
        # Height Check - Basic
        if not z == z0 and not impass1 == True and not impass2 == True:
            if not (z0 - height_tolerance) <= z <= (z0 + height_tolerance):
                impass2 = True
        
        # Items sent to world
        if impass1 == True or idd in Roads:
            Engine.SendPacketToClient(SAWorldItem(count, 0x1CDA, 1, x, y, z, 0))
        elif impass2 == True:
            Engine.SendPacketToClient(SAWorldItem(count, 0x1CDA, 1, x, y, z, 1259)) 
        else:
            Engine.SendPacketToClient(SAWorldItem(count, 0x1CDA, 1, x, y, z, 1271))

첨부파일

댓글목록 4

마스터골드님의 댓글

마스터골드 작성일

와우!!! 대박!!! 감사합니다

노다쿤님의 댓글

노다쿤 작성일

이런 유용한것을.. 감사감사합니당
집 많이 짓는 사람들한테도 필요한거네요

빡군님의 댓글

빡군 작성일

이거 너무 좋아요...
집이 왜 안지어졌는지도 알 수 있었고
어느 타일에 지으면 되는지 바로 알 수 있어서 너무 좋음...
감사합니다!

노다쿤님의 댓글

노다쿤 작성일

Square size 참고 :
18x18 = 8
23x23 = 11
32x32 = 15

전체 134건 4 페이지
게시물 검색

 

회사소개 개인정보처리방침 서비스이용약관

사이트 정보

회사명 : 회사명 / 대표 : 대표자명
주소 : OO도 OO시 OO구 OO동 123-45
사업자 등록번호 : 123-45-67890
전화 : 02-123-4567 팩스 : 02-123-4568
통신판매업신고번호 : 제 OO구 - 123호
개인정보관리책임자 : 정보책임자명

Copyright © 소유하신 도메인. All rights reserved.
PC 버전으로 보기