-
Notifications
You must be signed in to change notification settings - Fork 1
builtin model
boyism80 edited this page Jun 19, 2025
·
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.achievement
-
Description:
Returns the type of the spell. -
Parameters:
- None
-
Return Value:
-
number: Spell type value
-
-
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 position of the map. -
Parameters:
- None
-
Return Value:
-
table: Root position coordinates
-
-
Example:
-- This is a real usage example from game scripts local map_model = me:map():model() local root_pos = map_model:root() me:message("Root position: " .. root_pos.x .. ", " .. root_pos.y)
-
Description:
Returns the cardinal direction information of the map. -
Parameters:
- None
-
Return Value:
-
number: Cardinal direction value
-
-
Example:
-- This is a real usage example from game scripts local map_model = me:map():model() local cardinal = map_model:cardinal() me:message("Cardinal: " .. cardinal)
-
Description:
Returns the revive position for the map. -
Parameters:
- None
-
Return Value:
-
table: Revive position coordinates
-
-
Example:
-- This is a real usage example from game scripts local map_model = me:map():model() local revive_pos = map_model:revive() me:message("Revive position: " .. revive_pos.x .. ", " .. revive_pos.y)
-
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 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 list of items that the NPC sells. -
Parameters:
- None
-
Return Value:
-
table: Table of sellable items
-
-
Example:
-- This is a real usage example from game scripts local npc_model = name2npc("낙랑") for _, sell_item in pairs(npc_model:sell()) do me:message("NPC sells: " .. sell_item.name) end
-
Description:
Returns the selling price of a specific item. -
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 list of items that the NPC buys. -
Parameters:
- None
-
Return Value:
-
table: Table of buyable items
-
-
Example:
-- This is a real usage example from game scripts local npc_model = name2npc("낙랑") for _, buy_item in pairs(npc_model:buy()) do me:message("NPC buys: " .. buy_item.name) 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 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 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:
-
number: Weapon type value
-
-
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 unique ID of the achievement. -
Parameters:
- None
-
Return Value:
-
number: Achievement ID
-
-
Example:
-- This is a real usage example from game scripts local achievement_model = me:achievement('첫번째업적'):model() local achievement_id = achievement_model:id() me:message("Achievement ID: " .. achievement_id)
-
Description:
Returns the look/appearance ID of the achievement. -
Parameters:
- None
-
Return Value:
-
number: Look ID
-
-
Example:
-- This is a real usage example from game scripts local achievement_model = me:achievement('첫번째업적'):model() local look_id = achievement_model:look() me:message("Achievement look: " .. look_id)
-
Description:
Returns the color value of the achievement. -
Parameters:
- None
-
Return Value:
-
number: Color value
-
-
Example:
-- This is a real usage example from game scripts local achievement_model = me:achievement('첫번째업적'):model() local color_val = achievement_model:color() me:message("Achievement color: " .. color_val)
-
Description:
Returns the description text of the achievement. -
Parameters:
- None
-
Return Value:
-
string: Achievement description
-
-
Example:
-- This is a real usage example from game scripts local achievement_model = me:achievement('첫번째업적'):model() local achievement_text = achievement_model:text() me:message("Achievement: " .. achievement_text)