-
Notifications
You must be signed in to change notification settings - Fork 1
builtin model
boyism80 edited this page Jul 3, 2026
·
15 revisions
This document describes functions available to various model type objects.
- fb.model.spell
- fb.model.map
- fb.model.object
- fb.model.mob
- fb.model.npc
- fb.model.life
- fb.model.item
- fb.model.weapon
- fb.model.equipment
-
Description:
Returns the type of the spell. -
Parameters:
- None
-
Return Value:
-
SPELL_TYPE: Spell category (e.g.,SPELL_TYPE.INPUT,SPELL_TYPE.TARGET)
-
-
Example:
-- This is a real usage example from game scripts local spell_model = name2spell("비영사천문") local spell_type = spell_model:type() me:message("Spell type: " .. spell_type)
-
Description:
Returns the name of the spell. -
Parameters:
- None
-
Return Value:
-
string: Spell name
-
-
Example:
-- This is a real usage example from game scripts local spell_model = name2spell("비영사천문") local spell_name = spell_model:name() me:message("Spell name: " .. spell_name)
-
Description:
Returns the message associated with the spell. -
Parameters:
- None
-
Return Value:
-
string: Spell message
-
-
Example:
-- This is a real usage example from game scripts local spell_model = name2spell("비영사천문") local spell_message = spell_model:message() me:message("Spell message: " .. spell_message)
-
Description:
Returns the unique ID of the map. -
Parameters:
- None
-
Return Value:
-
number: Map ID
-
-
Example:
-- This is a real usage example from game scripts local map_model = me:map():model() local map_id = map_model:id() me:message("Map ID: " .. map_id)
-
Description:
Returns the name of the map. -
Parameters:
- None
-
Return Value:
-
string: Map name
-
-
Example:
-- This is a real usage example from game scripts local map_model = me:map():model() local map_name = map_model:name() me:message("Map name: " .. map_name)
-
Description:
Returns the root map model of this map. The root map represents the parent or main map reference. -
Parameters:
- None
-
Return Value:
-
fb.model.map|nil: Root map model or nil if no root map is set
-
-
Example:
-- This is a real usage example from game scripts local map_model = me:map():model() local root_map = map_model:root() if root_map then me:message("Root map: " .. root_map:name()) end
-
Description:
Returns the map connection information for a given cardinal direction. The result contains the target map and position/boundary information. -
Parameters:
-
direction:CARDINAL_DIRECTION: Cardinal direction (NORTH, SOUTH, EAST, WEST)
-
-
Return Value:
-
table|nil: Table with format{[1]=map_model, [2]=x, [3]=y, [4]=right, [5]=bottom}or nil if no connection in that direction-
[1]: Target map model (fb.model.map) -
[2]: X coordinate -
[3]: Y coordinate -
[4]: Right boundary -
[5]: Bottom boundary
-
-
-
Example:
-- This is a real usage example from game scripts local map_model = me:map():model() local north_info = map_model:cardinal(CARDINAL_DIRECTION.NORTH) if north_info then me:message("North map: " .. north_info[1]:name()) me:message("Position: " .. north_info[2] .. ", " .. north_info[3]) end
-
Description:
Returns the revive map information for this map. Maps directions to map models where players will revive. -
Parameters:
- None
-
Return Value:
-
table|nil: Table mapping direction values to map models{[direction]=map_model, ...}or nil if no revive maps configured
-
-
Example:
-- This is a real usage example from game scripts local map_model = me:map():model() local revive_maps = map_model:revive() if revive_maps then for direction, map in pairs(revive_maps) do me:message("Revive direction " .. direction .. ": " .. map:name()) end end
-
Description:
Returns the option flags for the map. -
Parameters:
- None
-
Return Value:
-
number: Map option flags
-
-
Example:
-- This is a real usage example from game scripts local map_model = me:map():model() local option = map_model:option() local pk_enabled = (option & MAP_OPTION.ENABLE_PK) == MAP_OPTION.ENABLE_PK me:message("PK enabled: " .. tostring(pk_enabled))
-
Description:
Returns the name of the object. -
Parameters:
- None
-
Return Value:
-
string: Object name
-
-
Example:
-- This is a real usage example from game scripts local obj_model = me:model() local obj_name = obj_model:name() me:message("Object name: " .. obj_name)
-
Description:
Returns the look/appearance ID of the object. -
Parameters:
- None
-
Return Value:
-
number: Look ID
-
-
Example:
-- This is a real usage example from game scripts local obj_model = me:model() local look_id = obj_model:look() me:message("Object look: " .. look_id)
-
Description:
Returns the color value of the object. -
Parameters:
- None
-
Return Value:
-
number: Color value
-
-
Example:
-- This is a real usage example from game scripts local obj_model = me:model() local color_val = obj_model:color() me:message("Object color: " .. color_val)
-
Description:
Returns the appearance value of the object model, representing extended visual information. -
Parameters:
- None
-
Return Value:
-
number: Appearance value
-
-
Example:
-- This is a real usage example from game scripts local obj_model = me:model() local appearance = obj_model:appearance() me:message("Object appearance: " .. tostring(appearance))
-
Description:
Returns the movement speed of the mob. -
Parameters:
- None
-
Return Value:
-
number: Movement speed
-
-
Example:
-- This is a real usage example from game scripts local mob_model = name2mob("다람쥐") local mob_speed = mob_model:speed() me:message("Mob speed: " .. mob_speed)
-
Description:
Returns the size of the mob. -
Parameters:
- None
-
Return Value:
-
number: Mob size
-
-
Example:
-- This is a real usage example from game scripts local mob_model = name2mob("다람쥐") local mob_size = mob_model:size() me:message("Mob size: " .. mob_size)
-
Description:
Returns the damage range of the mob. -
Parameters:
- None
-
Return Value:
-
number, number: Minimum and maximum damage
-
-
Example:
-- This is a real usage example from game scripts local mob_model = name2mob("다람쥐") local min_dmg, max_dmg = mob_model:damage() me:message("Mob damage: " .. min_dmg .. "-" .. max_dmg)
-
Description:
Returns the drop table for the mob. -
Parameters:
- None
-
Return Value:
-
table: Drop information table
-
-
Example:
-- This is a real usage example from game scripts local mob_model = name2mob("다람쥐") local drop_table = mob_model:drop() for _, drop_item in pairs(drop_table) do me:message("Drops: " .. drop_item.name) end
-
Description:
Returns the experience points granted when this mob is defeated. -
Parameters:
- None
-
Return Value:
-
number: Experience points
-
-
Example:
-- This is a real usage example from game scripts local mob_model = name2mob("다람쥐") local exp = mob_model:exp() me:message("Mob EXP: " .. exp)
-
Description:
Returns the sell table row IDs assigned to this NPC. Each ID refers to a row in the sell data table (a list of items the NPC sells to the player). Usepursuit_sell(sell_id)to resolve items and prices. Category labels are not stored in the sell table; NPC scripts handle multi-category menus withme:list(...)and pass the selected ID tolib.npc.show_sell_menu. -
Parameters:
- None
-
Return Value:
-
table: 1-based array of sell table row IDs (number)
-
-
Example:
-- This is a real usage example from game scripts local npc_model = name2npc("예쁜이") for _, sell_id in ipairs(npc_model:sell()) do for _, pair in pairs(pursuit_sell(sell_id)) do local item, price = table.unpack(pair) me:message(item:name() .. " " .. price) end end
-
Description:
Returns the selling price of a specific item. Searches all sell table rows referenced by this NPC. -
Parameters:
-
item_name:string: Name of the item
-
-
Return Value:
-
number|nil: Selling price or nil if not sold
-
-
Example:
-- This is a real usage example from game scripts local npc_model = name2npc("옥이") local price = npc_model:sell_price("도토리") if price then me:message("Sell price: " .. price) end
-
Description:
Returns the buy table row ID assigned to this NPC, or nil if the NPC does not buy items. Usepursuit_buy(buy_id)to resolve items and prices. -
Parameters:
- None
-
Return Value:
-
number|nil: Buy table row ID
-
-
Example:
-- This is a real usage example from game scripts local npc_model = name2npc("옥이") local buy_id = npc_model:buy() if buy_id ~= nil then for _, pair in pairs(pursuit_buy(buy_id)) do local item, price = table.unpack(pair) me:message(item:name() .. " " .. price) end end
-
Description:
Returns the buying price of a specific item. -
Parameters:
-
item_name:string: Name of the item
-
-
Return Value:
-
number|nil: Buying price or nil if not bought
-
-
Example:
-- This is a real usage example from game scripts local npc_model = name2npc("낙랑") local price = npc_model:buy_price("도토리") if price then me:message("Buy price: " .. price) end
-
Description:
Returns the NPC's interaction type. This determines what type of interaction the NPC supports (dialog, buy/sell, storage, etc.). -
Parameters:
- None
-
Return Value:
-
number: NPC interaction type value (NPC_INTERACTION enum)
-
-
Example:
-- This is a real usage example from game scripts local npc_model = name2npc("낙랑") local interaction_type = npc_model:interaction() me:message("NPC interaction type: " .. interaction_type)
-
Description:
Returns the base HP of the life model. -
Parameters:
- None
-
Return Value:
-
number: Base HP value
-
-
Example:
-- This is a real usage example from game scripts local life_model = me:model() local base_hp = life_model:hp() me:message("Base HP: " .. base_hp)
-
Description:
Returns the base MP of the life model. -
Parameters:
- None
-
Return Value:
-
number: Base MP value
-
-
Example:
-- This is a real usage example from game scripts local life_model = me:model() local base_mp = life_model:mp() me:message("Base MP: " .. base_mp)
-
Description:
Returns the crafting requirements for the item. -
Parameters:
- None
-
Return Value:
-
table: Crafting requirements table
-
-
Example:
-- This is a real usage example from game scripts local item_model = name2item("목검") local make_info = item_model:make() for _, requirement in pairs(make_info) do me:message("Requires: " .. requirement.name .. " x" .. requirement.count) end
-
Description:
Checks if the item has a specific attribute. -
Parameters:
-
attribute:number: Attribute flag to check
-
-
Return Value:
-
boolean: True if item has the attribute, false otherwise
-
-
Example:
-- This is a real usage example from game scripts local item_model = name2item("목검") if item_model:attr(ITEM_ATTRIBUTE.WEAPON) then me:message("This is a weapon") end
-
Description:
Returns the capacity/stack size of the item. -
Parameters:
- None
-
Return Value:
-
number: Item capacity
-
-
Example:
-- This is a real usage example from game scripts local item_model = name2item("도토리") local capacity = item_model:capacity() me:message("Item capacity: " .. capacity)
-
Description:
Returns the maximum durability of the item. -
Parameters:
- None
-
Return Value:
-
number: Maximum durability
-
-
Example:
-- This is a real usage example from game scripts local item_model = name2item("목검") local max_durability = item_model:durability() me:message("Max durability: " .. max_durability)
-
Description:
Returns the base price of the item. -
Parameters:
- None
-
Return Value:
-
number: Item price
-
-
Example:
-- This is a real usage example from game scripts local item_model = name2item("도토리") local item_price = item_model:price() me:message("Item price: " .. item_price)
-
Description:
Returns the repair cost of the item. -
Parameters:
- None
-
Return Value:
-
number: Repair price
-
-
Example:
-- This is a real usage example from game scripts local item_model = name2item("목검") local repair_cost = item_model:repair_price() me:message("Repair cost: " .. repair_cost)
-
Description:
Returns the cost to rename the item. -
Parameters:
- None
-
Return Value:
-
number: Rename price
-
-
Example:
-- This is a real usage example from game scripts local item_model = name2item("목검") local rename_cost = item_model:rename_price() me:message("Rename cost: " .. rename_cost)
-
Description:
Returns the storage fee for the item. -
Parameters:
- None
-
Return Value:
-
number: Storage fee
-
-
Example:
-- This is a real usage example from game scripts local item_model = name2item("목검") local storage_fee = item_model:storage_fee() me:message("Storage fee: " .. storage_fee)
-
Description:
Returns whether the item model can be traded between players or listed on the marketplace. -
Parameters:
- None
-
Return Value:
-
boolean:trueif the item is tradeable,falseotherwise
-
-
Example:
-- This is a real usage example from game scripts local item_model = name2item("도토리") if item_model:trade() then me:message("This item can be traded") end
-
Description:
Returns the damage against small targets. -
Parameters:
- None
-
Return Value:
-
number, number: Minimum and maximum damage against small targets
-
-
Example:
-- This is a real usage example from game scripts local weapon_model = name2item("목검") local min_dmg, max_dmg = weapon_model:damage_small() me:message("Small damage: " .. min_dmg .. "-" .. max_dmg)
-
Description:
Returns the damage against large targets. -
Parameters:
- None
-
Return Value:
-
number, number: Minimum and maximum damage against large targets
-
-
Example:
-- This is a real usage example from game scripts local weapon_model = name2item("목검") local min_dmg, max_dmg = weapon_model:damage_large() me:message("Large damage: " .. min_dmg .. "-" .. max_dmg)
-
Description:
Returns the sound effect ID for the weapon. -
Parameters:
- None
-
Return Value:
-
number: Sound effect ID
-
-
Example:
-- This is a real usage example from game scripts local weapon_model = me:weapon():model() local weapon_sound = weapon_model:sound() me:sound(weapon_sound)
-
Description:
Returns the weapon type. -
Parameters:
- None
-
Return Value:
-
WEAPON_TYPE: Weapon category (e.g.,WEAPON_TYPE.NORMAL,WEAPON_TYPE.BOW)
-
-
Example:
-- This is a real usage example from game scripts local weapon_model = me:weapon():model() local weapon_type = weapon_model:type() local is_bow = (weapon_type == WEAPON_TYPE.BOW) me:message("Is bow: " .. tostring(is_bow))
-
Description:
Returns the dress/appearance value of the equipment. This value represents how the equipment appears visually when worn. -
Parameters:
- None
-
Return Value:
-
number: Dress/appearance ID
-
-
Example:
-- This is a real usage example from game scripts local equip_model = name2item("가죽갑옷") if equip_model then local dress_id = equip_model:dress() me:message("Equipment dress ID: " .. dress_id) end