Metatable:Player - RodrigoOt/forgottenserver GitHub Wiki
The Player metatable contains all of the methods that handle/require players.
Creating an instance of the Player metatable (2 options):
local player = Player(uid)
local player = Player(name or wildcard)
###Available methods:
addBlessing(blessing)
[addExperience(experience[, sendText = false])](#addExperience{experience[, sendText = false]})
[addItem(itemId[, count = 1[, canDropOnMap = true[, subType = 1[, slot = CONST_SLOT_WHEREEVER]]]])](#addItem{itemId[, count = 1[, canDropOnMap = true[, subType = 1[, slot = CONST_SLOT_WHEREEVER]]]]})
[addItemEx(item[, canDropOnMap = false[, index = INDEX_WHEREEVER[, flags = 0]]])](#addItemEx{item[, canDropOnMap = false[, index = INDEX_WHEREEVER[, flags = 0]]]})
[addItemEx(item[, canDropOnMap = true[, slot = CONST_SLOT_WHEREEVER]])](#addItemEx{item[, canDropOnMap = true[, slot = CONST_SLOT_WHEREEVER]]})
addManaSpent(amount)
[addMapMark(position, type, description)](#addMapMark{position, type, description})
addMoney(money)
addMount(mountId)
addOutfit(lookType)
[addOutfitAddon(lookType, addon)](#addOutfitAddon{lookType, addon})
addPremiumDays(days)
[addSkillTries(skillType, tries)](#addSkillTries{skillType, tries})
addSoul(soulChange)
canLearnSpell(spellName)
[channelSay(speaker, type, text, channelId)](#channelSay{speaker, type, text, channelId})
forgetSpell(spellName)
getAccountId()
getAccountType()
getBankBalance()
getBaseMagicLevel()
getCapacity()
getClient()
getContainerById(id)
getContainerId(container)
getContainerIndex(id)
getDeathPenalty()
[getDepotChest(depotId[, autoCreate = false])](#getDepotChest{depotId[, autoCreate = false]})
getEffectiveSkillLevel(skillType)
getExperience()
getFreeCapacity()
getGroup()
getGuid()
getGuild()
getGuildLevel()
getGuildNick()
getHouse()
getInbox()
getIp()
[getItemById(itemId, deepSearch[, subType = -1])](#getItemById{itemId, deepSearch[, subType = -1]})
[getItemCount(itemId[, subType = -1])](#getItemCount{itemId[, subType = -1]})
getLastLoginSaved()
getLastLogout()
getLevel()
getMagicLevel()
getManaSpent()
getMaxSoul()
getMoney()
getParty()
getPremiumDays()
getSex()
getSkillLevel(skillType)
getSkillPercent(skillType)
getSkillTries(skillType)
getSkullTime()
getSlotItem(slot)
getSoul()
getStamina()
getStorageValue(key)
getTown()
getVocation()
hasBlessing(blessing)
hasLearnedSpell(spellName)
hasMount(mountId)
[hasOutfit(lookType[, addon = 0])](#hasOutfit{lookType[, addon = 0]})
isPlayer()
isPzLocked()
learnSpell(spellName)
openChannel(channelId)
popupFYI(message)
removeBlessing(blessing)
[removeExperience(experience[, sendText = false])](#removeExperience{experience[, sendText = false]})
[removeItem(itemId, count[, subType = -1[, ignoreEquipped = false]])](#removeItem{itemId, count[, subType = -1[, ignoreEquipped = false]]})
removeMoney(money)
removeMount(mountId)
removeOutfit(lookType)
[removeOutfitAddon(lookType, addon)](#removeOutfitAddon{lookType, addon})
removePremiumDays(days)
save()
[sendChannelMessage(author, text, type, channelId)](#sendChannelMessage{author, text, type, channelId})
sendOutfitWindow()
[sendPrivateMessage(speaker, text[, type])](#sendPrivateMessage{speaker, text[, type]})
[sendTextMessage(type, text[, position, primaryValue = 0, primaryColor = TEXTCOLOR_NONE[, secondaryValue = 0, secondaryColor = TEXTCOLOR_NONE]])](#sendTextMessage{type, text[, position, primaryValue = 0, primaryColor = TEXTCOLOR_NONE[, secondaryValue = 0, secondaryColor = TEXTCOLOR_NONE]]})
sendTutorial(tutorialId)
setAccountType(accountType)
setBankBalance(bankBalance)
setCapacity(capacity)
setGhostMode(enabled)
setGroup(group)
setGuild(guild)
setGuildLevel(level)
setGuildNick(nick)
setMaxMana(maxMana)
setSex(newSex)
setSkullTime(skullTime)
setStamina(stamina)
[setStorageValue(key, value)](#setStorageValue{key, value})
setTown(town)
setVocation(vocation)
[showTextDialog(itemId[, text[, canWrite[, length]]])](#showTextDialog{itemId[, text[, canWrite[, length]]]})
###### addBlessing(blessing) > **Description:** N/A > **Parameters:**
- _blessing_ - _No description_
###### addExperience(experience[, sendText = false]) > **Description:** N/A > **Parameters:**
- _experience_ - _No description_
- _sendText_ - _(optional, default: false)_
###### addItem(itemId[, count = 1[, canDropOnMap = true[, subType = 1[, slot = CONST_SLOT_WHEREEVER]]]]) > **Description:** This function gives the player a newly created item. > **Parameters:**
- _itemId_ - _Type of item created._
- _count_ - _How many items that are created. (optional, default = 1)_
- _canDropOnMap_ - _Drops any remaining items on the map. (optional, default: true)_
- _subType_ - _Subtype the item(s) should have. (optional, default: 1)_
- _slot_ - _Slot the item should be assigned to. (optional, default: CONST_SLOT_WHEREEVER)_
###### addItemEx(item[, canDropOnMap = false[, index = INDEX_WHEREEVER[, flags = 0]]]) > **Description:** N/A > **Parameters:**
- _item_ - _No description_
- _canDropOnMap_ - _(optional, default: false)_
- _index_ - _(optional, default: INDEX_WHEREEVER)_
- _flags_ - _(optional, default: 0)_
###### addItemEx(item[, canDropOnMap = true[, slot = CONST_SLOT_WHEREEVER]]) > **Description:** N/A > **Parameters:**
- _item_ - _No description_
- _canDropOnMap_ - _(optional, default: true)_
- _slot_ - _(optional, default: CONST_SLOT_WHEREEVER)_
###### addManaSpent(amount) > **Description:** N/A > **Parameters:**
- _amount_ - _No description_
###### addMapMark(position, type, description) > **Description:** N/A > **Parameters:**
- _position_ - _No description_
- _type_ - _No description_
- _description_ - _No description_
###### addMoney(money) > **Description:** N/A > **Parameters:**
- _money_ - _No description_
###### addMount(mountId) > **Description:** N/A > **Parameters:**
- _mountId_ - _No description_
###### addOutfit(lookType) > **Description:** N/A > **Parameters:**
- _lookType_ - _No description_
###### addOutfitAddon(lookType, addon) > **Description:** N/A > **Parameters:**
- _lookType_ - _No description_
- _addon_ - _No description_
###### addPremiumDays(days) > **Description:** N/A > **Parameters:**
- _days_ - _No description_
###### addSkillTries(skillType, tries) > **Description:** N/A > **Parameters:**
- _skillType_ - _No description_
- _tries_ - _No description_
###### addSoul(soulChange) > **Description:** N/A > **Parameters:**
- _soulChange_ - _No description_
###### canLearnSpell(spellName) > **Description:** N/A > **Parameters:**
- _spellName_ - _No description_
###### channelSay(speaker, type, text, channelId) > **Description:** N/A > **Parameters:**
- _speaker_ - _No description_
- _type_ - _No description_
- _text_ - _No description_
- _channelId_ - _No description_
###### forgetSpell(spellName) > **Description:** N/A > **Parameters:**
- _spellName_ - _No description_
###### getAccountId() > **Description:** N/A > **Parameters:** None > **Returns:** N/A > **Example:** ```Lua local player = Player(...) player:getAccountId() ``` > **Added in version:** 1.0
###### getAccountType() > **Description:** N/A > **Parameters:** None > **Returns:** N/A > **Example:** ```Lua local player = Player(...) player:getAccountType() ``` > **Added in version:** 1.0
###### getBankBalance() > **Description:** N/A > **Parameters:** None > **Returns:** N/A > **Example:** ```Lua local player = Player(...) player:getBankBalance() ``` > **Added in version:** 1.0
###### getBaseMagicLevel() > **Description:** N/A > **Parameters:** None > **Returns:** N/A > **Example:** ```Lua local player = Player(...) player:getBaseMagicLevel() ``` > **Added in version:** 1.0
###### getCapacity() > **Description:** N/A > **Parameters:** None > **Returns:** N/A > **Example:** ```Lua local player = Player(...) player:getCapacity() ``` > **Added in version:** 1.0
###### getClient() > **Description:** N/A > **Parameters:** None > **Returns:** N/A > **Example:** ```Lua local player = Player(...) player:getClient() ``` > **Added in version:** 1.0
###### getContainerById(id) > **Description:** N/A > **Parameters:**
- _id_ - _No description_
###### getContainerId(container) > **Description:** N/A > **Parameters:**
- _container_ - _No description_
###### getContainerIndex(id) > **Description:** N/A > **Parameters:**
- _id_ - _No description_
###### getDeathPenalty() > **Description:** N/A > **Parameters:** None > **Returns:** N/A > **Example:** ```Lua local player = Player(...) player:getDeathPenalty() ``` > **Added in version:** 1.0
###### getDepotChest(depotId[, autoCreate = false]) > **Description:** N/A > **Parameters:**
- _depotId_ - _No description_
- _autoCreate_ - _(optional, default: false)_
###### getEffectiveSkillLevel(skillType) > **Description:** N/A > **Parameters:**
- _skillType_ - _No description_
###### getExperience() > **Description:** N/A > **Parameters:** None > **Returns:** N/A > **Example:** ```Lua local player = Player(...) player:getExperience() ``` > **Added in version:** 1.0
###### getFreeCapacity() > **Description:** N/A > **Parameters:** None > **Returns:** N/A > **Example:** ```Lua local player = Player(...) player:getFreeCapacity() ``` > **Added in version:** 1.0
###### getGroup() > **Description:** N/A > **Parameters:** None > **Returns:** N/A > **Example:** ```Lua local player = Player(...) player:getGroup() ``` > **Added in version:** 1.0
###### getGuid() > **Description:** N/A > **Parameters:** None > **Returns:** N/A > **Example:** ```Lua local player = Player(...) player:getGuid() ``` > **Added in version:** 1.0
###### getGuild() > **Description:** N/A > **Parameters:** None > **Returns:** N/A > **Example:** ```Lua local player = Player(...) player:getGuild() ``` > **Added in version:** 1.0
###### getGuildLevel() > **Description:** N/A > **Parameters:** None > **Returns:** N/A > **Example:** ```Lua local player = Player(...) player:getGuildLevel() ``` > **Added in version:** 1.0
###### getGuildNick() > **Description:** N/A > **Parameters:** None > **Returns:** N/A > **Example:** ```Lua local player = Player(...) player:getGuildNick() ``` > **Added in version:** 1.0
###### getHouse() > **Description:** N/A > **Parameters:** None > **Returns:** N/A > **Example:** ```Lua local player = Player(...) player:getHouse() ``` > **Added in version:** 1.0
###### getInbox() > **Description:** N/A > **Parameters:** None > **Returns:** N/A > **Example:** ```Lua local player = Player(...) player:getInbox() ``` > **Added in version:** 1.0
###### getIp() > **Description:** N/A > **Parameters:** None > **Returns:** N/A > **Example:** ```Lua local player = Player(...) player:getIp() ``` > **Added in version:** 1.0
###### getItemById(itemId, deepSearch[, subType = -1]) > **Description:** N/A > **Parameters:**
- _itemId_ - _No description_
- _deepSearch_ - _No description_
- _subType_ - _(optional, default: -1)_
###### getItemCount(itemId[, subType = -1]) > **Description:** N/A > **Parameters:**
- _itemId_ - _No description_
- _subType_ - _(optional, default: -1)_
###### getLastLoginSaved() > **Description:** N/A > **Parameters:** None > **Returns:** N/A > **Example:** ```Lua local player = Player(...) player:getLastLoginSaved() ``` > **Added in version:** 1.0
###### getLastLogout() > **Description:** N/A > **Parameters:** None > **Returns:** N/A > **Example:** ```Lua local player = Player(...) player:getLastLogout() ``` > **Added in version:** 1.1
###### getLevel() > **Description:** N/A > **Parameters:** None > **Returns:** N/A > **Example:** ```Lua local player = Player(...) player:getLevel() ``` > **Added in version:** 1.0
###### getMagicLevel() > **Description:** N/A > **Parameters:** None > **Returns:** N/A > **Example:** ```Lua local player = Player(...) player:getMagicLevel() ``` > **Added in version:** 1.0
###### getManaSpent() > **Description:** N/A > **Parameters:** None > **Returns:** N/A > **Example:** ```Lua local player = Player(...) player:getManaSpent() ``` > **Added in version:** 1.0
###### getMaxSoul() > **Description:** N/A > **Parameters:** None > **Returns:** N/A > **Example:** ```Lua local player = Player(...) player:getMaxSoul() ``` > **Added in version:** 1.0
###### getMoney() > **Description:** N/A > **Parameters:** None > **Returns:** N/A > **Example:** ```Lua local player = Player(...) player:getMoney() ``` > **Added in version:** 1.0
###### getParty() > **Description:** N/A > **Parameters:** None > **Returns:** N/A > **Example:** ```Lua local player = Player(...) player:getParty() ``` > **Added in version:** 1.0
###### getPremiumDays() > **Description:** N/A > **Parameters:** None > **Returns:** N/A > **Example:** ```Lua local player = Player(...) player:getPremiumDays() ``` > **Added in version:** 1.0
###### getSex() > **Description:** N/A > **Parameters:** None > **Returns:** N/A > **Example:** ```Lua local player = Player(...) player:getSex() ``` > **Added in version:** 1.0
###### getSkillLevel(skillType) > **Description:** N/A > **Parameters:**
- _skillType_ - _No description_
###### getSkillPercent(skillType) > **Description:** N/A > **Parameters:**
- _skillType_ - _No description_
###### getSkillTries(skillType) > **Description:** N/A > **Parameters:**
- _skillType_ - _No description_
###### getSkullTime() > **Description:** N/A > **Parameters:** None > **Returns:** N/A > **Example:** ```Lua local player = Player(...) player:getSkullTime() ``` > **Added in version:** 1.0
###### getSlotItem(slot) > **Description:** N/A > **Parameters:**
- _slot_ - _No description_
###### getSoul() > **Description:** N/A > **Parameters:** None > **Returns:** N/A > **Example:** ```Lua local player = Player(...) player:getSoul() ``` > **Added in version:** 1.0
###### getStamina() > **Description:** N/A > **Parameters:** None > **Returns:** N/A > **Example:** ```Lua local player = Player(...) player:getStamina() ``` > **Added in version:** 1.0
###### getStorageValue(key) > **Description:** N/A > **Parameters:**
- _key_ - _No description_
###### getTown() > **Description:** N/A > **Parameters:** None > **Returns:** N/A > **Example:** ```Lua local player = Player(...) player:getTown() ``` > **Added in version:** 1.0
###### getVocation() > **Description:** N/A > **Parameters:** None > **Returns:** N/A > **Example:** ```Lua local player = Player(...) player:getVocation() ``` > **Added in version:** 1.0
###### hasBlessing(blessing) > **Description:** N/A > **Parameters:**
- _blessing_ - _No description_
###### hasLearnedSpell(spellName) > **Description:** N/A > **Parameters:**
- _spellName_ - _No description_
###### hasMount(mountId) > **Description:** N/A > **Parameters:**
- _mountId_ - _No description_
###### hasOutfit(lookType[, addon = 0]) > **Description:** N/A > **Parameters:**
- _lookType_ - _No description_
- _addon_ - _(optional, default: 0)_
###### isPlayer() > **Description:** N/A > **Parameters:** None > **Returns:** N/A > **Example:** ```Lua local player = Player(...) player:isPlayer() ``` > **Added in version:** 1.0
###### isPzLocked() > **Description:** N/A > **Parameters:** None > **Returns:** N/A > **Example:** ```Lua local player = Player(...) player:isPzLocked() ``` > **Added in version:** 1.0
###### learnSpell(spellName) > **Description:** N/A > **Parameters:**
- _spellName_ - _No description_
###### openChannel(channelId) > **Description:** N/A > **Parameters:**
- _channelId_ - _No description_
###### popupFYI(message) > **Description:** N/A > **Parameters:**
- _message_ - _No description_
###### removeBlessing(blessing) > **Description:** N/A > **Parameters:**
- _blessing_ - _No description_
###### removeExperience(experience[, sendText = false]) > **Description:** N/A > **Parameters:**
- _experience_ - _No description_
- _sendText_ - _(optional, default: false)_
###### removeItem(itemId, count[, subType = -1[, ignoreEquipped = false]]) > **Description:** N/A > **Parameters:**
- _itemId_ - _No description_
- _count_ - _No description_
- _subType_ - _(optional, default: -1)_
- _ignoreEquipped_ - _(optional, default: false)_
###### removeMoney(money) > **Description:** N/A > **Parameters:**
- _money_ - _No description_
###### removeMount(mountId) > **Description:** N/A > **Parameters:**
- _mountId_ - _No description_
###### removeOutfit(lookType) > **Description:** N/A > **Parameters:**
- _lookType_ - _No description_
###### removeOutfitAddon(lookType, addon) > **Description:** N/A > **Parameters:**
- _lookType_ - _No description_
- _addon_ - _No description_
###### removePremiumDays(days) > **Description:** N/A > **Parameters:**
- _days_ - _No description_
###### save() > **Description:** N/A > **Parameters:** None > **Returns:** N/A > **Example:** ```Lua local player = Player(...) player:save() ``` > **Added in version:** 1.0
###### sendChannelMessage(author, text, type, channelId) > **Description:** N/A > **Parameters:**
- _author_ - _No description_
- _text_ - _No description_
- _type_ - _No description_
- _channelId_ - _No description_
###### sendOutfitWindow() > **Description:** N/A > **Parameters:** None > **Returns:** N/A > **Example:** ```Lua local player = Player(...) player:sendOutfitWindow() ``` > **Added in version:** 1.0
###### sendPrivateMessage(speaker, text[, type]) > **Description:** N/A > **Parameters:**
- _speaker_ - _No description_
- _text_ - _No description_
- _type_ - _(optional)_
###### sendTextMessage(type, text[, position, primaryValue = 0, primaryColor = TEXTCOLOR_NONE[, secondaryValue = 0, secondaryColor = TEXTCOLOR_NONE]]) > **Description:** N/A > **Parameters:**
- _type_ - _No description_
- _text_ - _No description_
- _position_ - _(optional)_
- _primaryValue_ - _(optional, default: 0)_
- _primaryColor_ - _(optional, default: TEXTCOLOR_NONE)_
- _secondaryValue_ - _(optional, default: 0)_
- _secondaryColor_ - _(optional, default: TEXTCOLOR_NONE)_
###### sendTutorial(tutorialId) > **Description:** N/A > **Parameters:**
- _tutorialId_ - _No description_
###### setAccountType(accountType) > **Description:** N/A > **Parameters:**
- _accountType_ - _No description_
###### setBankBalance(bankBalance) > **Description:** N/A > **Parameters:**
- _bankBalance_ - _No description_
###### setCapacity(capacity) > **Description:** N/A > **Parameters:**
- _capacity_ - _No description_
###### setGhostMode(enabled) > **Description:** N/A > **Parameters:**
- _enabled_ - _No description_
###### setGroup(group) > **Description:** N/A > **Parameters:**
- _group_ - _No description_
###### setGuild(guild) > **Description:** N/A > **Parameters:**
- _guild_ - _No description_
###### setGuildLevel(level) > **Description:** N/A > **Parameters:**
- _level_ - _No description_
###### setGuildNick(nick) > **Description:** N/A > **Parameters:**
- _nick_ - _No description_
###### setMaxMana(maxMana) > **Description:** N/A > **Parameters:**
- _maxMana_ - _No description_
###### setSex(newSex) > **Description:** N/A > **Parameters:**
- _newSex_ - _No description_
###### setSkullTime(skullTime) > **Description:** N/A > **Parameters:**
- _skullTime_ - _No description_
###### setStamina(stamina) > **Description:** N/A > **Parameters:**
- _stamina_ - _No description_
###### setStorageValue(key, value) > **Description:** N/A > **Parameters:**
- _key_ - _No description_
- _value_ - _No description_
###### setTown(town) > **Description:** N/A > **Parameters:**
- _town_ - _No description_
###### setVocation(vocation) > **Description:** N/A > **Parameters:**
- _vocation_ - _No description_
###### showTextDialog(itemId[, text[, canWrite[, length]]]) > **Description:** N/A > **Parameters:**
- _itemId_ - _No description_
- _text_ - _(optional)_
- _canWrite_ - _(optional)_
- _length_ - _(optional)_