builtin clan - boyism80/fb GitHub Wiki

Built-in Functions Documentation (Clan)

This document describes functions available to clan type objects.


name

name()

  • Description:
    Returns the unique name of the clan.
  • Parameters:
    • None
  • Return Value:
    • string: Clan name
  • Example:
    -- This is a real usage example from game scripts
    local clan = me:clan()
    if clan ~= nil then
        local clan_name = clan:name()
        local selected = me:menu(npc, string.format('클랜 이름 : %s', clan_name), 
            {'문파 칭호 바꾸기', '문파 해체', '문파 가입', '문파 추방', '메시지'})
    end
    

members

members()

  • Description:
    Returns a list of member (fb.model.character) objects belonging to the clan as an array.
  • Parameters:
    • None
  • Return Value:
    • table: List of fb.model.character objects
  • Example:
    -- This is a real usage example from game scripts
    local clan = me:clan()
    if clan then
        local members = clan:members()
        me:message(string.format("Clan has %d members", #members))
        for i, member in ipairs(members) do
            me:message("Member " .. i .. ": " .. member:name())
        end
    end
    

nears

nears(map:fb.game.map, position:table)

  • Description:
    Returns a list of character (fb.model.character) objects near the specified position on the given map as an array.
  • Parameters:
    • map:fb.game.map: Map object to search in
    • position:table: Position coordinates to search (table with x, y values)
  • Return Value:
    • table: List of fb.model.character objects
  • Example:
    -- This is a real usage example from game scripts
    local group = me:group()
    if group then
        local map = me:map()
        for _, ch in pairs(group:nears(map, { me:position() })) do
            if me ~= ch then
                ch:heal(hp)
                ch:message(string.format('%s님이 %s 외워주셨습니다.', me:name(), name_with(spell:name())))
            end
        end
    end
    

title

title()

  • Description:
    Returns the clan's title. Returns nil if no title is set.
  • Parameters:
    • None
  • Return Value:
    • string | nil: Current title
  • Example:
    -- This is a real usage example from game scripts
    local clan = me:clan()
    if clan then
        local title = clan:title()
        me:message("Clan title: " .. (title or "None"))
    end
    

title(new_title:string)

  • Description:
    Sets the clan's title to new_title.
  • Parameters:
    • new_title:string: Title name to set
  • Return Value:
    • None
  • Example:
    -- This is a real usage example from game scripts
    local clan = me:clan()
    if clan then
        clan:title("국내성")
        me:message("Clan title updated")
    end
    

join

join(member:fb.model.character)

  • Description:
    Makes the specified character join the clan.
  • Parameters:
    • member:fb.model.character: Character object to join
  • Return Value:
    • None
  • Example:
    -- This is a real usage example from game scripts
    local clan = me:clan()
    local new_member = name2ch("낙랑")
    if clan and new_member then
        clan:join(new_member)
        me:message("New member joined the clan")
    end
    

leave

leave(member_name:string[, kick:boolean])

  • Description:
    Removes the member with the specified name from the clan.
    If kick is true, it's treated as forced expulsion; if false, as voluntary departure.
  • Parameters:
    • member_name:string: Name of the member to remove
    • [kick:boolean]: Whether it's forced expulsion (optional, default false)
  • Return Value:
    • None
  • Example:
    -- This is a real usage example from game scripts
    local clan = me:clan()
    if clan then
        clan:leave("낙랑")         -- Voluntary departure
        clan:leave("다람쥐", true)  -- Forced expulsion
        me:message("Member removed from clan")
    end
    

message

message(text:string[, type:number])

  • Description:
    Sends a text message to clan chat.
    type is the message type (MESSAGE_TYPE_* enum, default MESSAGE_TYPE_STATE).
  • Parameters:
    • text:string: Message content to send
    • [type:number]: Message type (optional, default MESSAGE_TYPE_STATE)
  • Return Value:
    • None
  • Example:
    -- This is a real usage example from game scripts
    local clan = me:clan()
    if clan then
        clan:message("Hello, clan members!")  
        clan:message("Important announcement!", MESSAGE_TYPE_ALERT)
    end