• There is NO official Otland's Discord server and NO official Otland's server list. The Otland's Staff does not manage any Discord server or server list. Moderators or administrator of any Discord server or server lists have NO connection to the Otland's Staff. Do not get scammed!

[released] LUA functions for TFS 0.3 beta 2

tarjei

Necronian Engineer
Joined
May 25, 2008
Messages
505
Reaction score
126
Location
Poland
Code:
[ LUA FUNCTIONS
	Project Name
		The Forgotten Server

	Version
		0.3 Beta 2

	Codenamed
		\

	License
		GNU GPLv3

	Forum
		http://otland.net/
]

//get*
getCreatureHealth(cid)
getCreatureMaxHealth(cid)
getCreatureMana(cid)
getCreatureMaxMana(cid)
getCreatureMaster(cid)
getCreatureSummons(cid)
getCreatureOutfit(cid)
getCreaturePosition(cid)
getCreatureName(cid)
getCreatureSpeed(cid)
getCreatureBaseSpeed(cid)
getCreatureTarget(cid)
getCreatureByName(name)
getCreatureSkullType(cid)
getCreatureCondition(cid, condition)
getMonsterTargetList(cid)
getMonsterFriendList(cid)
getPlayerByNameWildcard(name~)
getPlayerLossSkill(cid)
getPlayerLossPercent(cid, lossType)
getPlayerGUIDByName(name)
getPlayerNameByGUID(guid)
getPlayerFood(cid)
getPlayerLevel(cid)
getPlayerExperience(cid)
getPlayerMagLevel(cid)
getPlayerSpentMana(cid)
getPlayerAccess(cid)
getPlayerSkillLevel(cid, skillid)
getPlayerSkillTries(cid, skillid)
getPlayerTown(cid)
getPlayerVocation(cid)
getPlayerRequiredMana(cid, magicLevel)
getPlayerRequiredSkillTries(cid, skillId, skillLevel)
getPlayerItemCount(cid, itemid)
getPlayerSoul(cid)
getPlayerAccountId(cid)
getPlayerAccount(cid)
getPlayerIp(cid)
getPlayerFreeCap(cid)
getPlayerLight(cid)
getPlayerSlotItem(cid, slot)
getPlayerWeapon(cid[, ignoreAmmo])
getPlayerItemById(cid, deepSearch, itemId[, subType])
getPlayerDepotItems(cid, depotid)
getPlayerGuildId(cid)
getPlayerGuildName(cid)
getPlayerGuildRank(cid)
getPlayerGuildNick(cid)
getPlayerGuildLevel(cid)
getPlayerSex(cid)
getPlayerLookDir(cid)
getPlayerStorageValue(uid, valueid)
getPlayerGUID(cid)
getPlayerFlagValue(cid, flag)
getPlayerCustomFlagValue(cid, flag)
getPlayerPromotionLevel(cid)
getPlayerGroupId(cid)
getPlayerLearnedInstantSpell(cid, name)
getPlayerInstantSpellCount(cid)
getPlayerInstantSpellInfo(cid, index)
getPlayerSex(cid)
getPlayerBlessing(cid, blessing)
getPlayerStamina(cid)
getPlayerNoMove(cid)
getPlayerExtraExpRate(cid)
getPlayerPartner(cid)
getPlayerParty(cid)
getPlayerPremiumDays(cid)
getPlayerBalance(cid)
getPlayerRedSkullTicks(cid)
getInstantSpellInfoByName(cid, name)
getInstantSpellWords(name)
getPlayersByAccountId(accountNumber)
getPlayersByIp(ip[, mask = 0xFFFFFFFF])
getPlayersOnline()
getPartyMembers(lid)
getAccountIdByName(name)
getAccountByName(name)
getAccountIdByAccount(accName)
getIpByName(name)
getItemRWInfo(uid)
getItemDescriptionsById(itemid)
getItemNameById(itemid)
getItemPluralNameById(itemid)
getItemArticleById(itemid)
getItemWeightById(itemid, count[, precise])
getItemDescriptions(uid)
getItemName(uid)
getItemPluralName(uid)
getItemArticle(uid)
getItemWeight(uid[, precise])
getItemAttack(uid)
getItemExtraAttack(uid)
getItemDefense(uid)
getItemExtraDefense(uid)
getItemArmor(uid)
getItemAttackSpeed(uid)
getItemHitChance(uid)
getItemIdByName(name)
getFluidSourceType(type)
getContainerSize(uid)
getContainerCap(uid)
getContainerCapById(itemid)
getContainerItem(uid, slot)
getDepotId(uid)
getTileItemById(pos, itemId[, subType])
getTileItemByType(pos, type)
getTileThingByPos(pos)
getTilePzInfo(pos)
getTileHouseInfo(pos)
getTopCreature(pos)
getClosestFreeTile(cid, targetpos[, extended[, ignoreHouse]])
getThingFromPos(pos)
getThing(uid)
getThingPos(uid)
getHouseOwner(houseid)
getHouseName(houseid)
getHouseEntry(houseid)
getHouseRent(houseid)
getHousePrice(houseid)
getHouseTown(houseid)
getHouseAccessList(houseid, listid)
getHouseByPlayerGUID(playerGUID)
getHouseTilesSize(houseid)
getTownId(townName)
getTownName(townId)
getTownTemplePosition(townId)
getTownHouses(townId)
getWorldType()
getWorldTime()
getWorldLight()
getWorldCreatures(type) //0 players, 1 monsters, 2 npcs, 3 all
getWorldUpTime()
getHighscoreString(skillId)
getVocationInfo(id)
getGuildId(guildName)
getSpectators(centerPos, rangex, rangey, multifloor)
getSearchString(fromPosition, toPosition[, isPlayer])
getNotationsCound(accId)
getBanData(value)
getBanList(type[, value])
getBanReason(id)
getBanAction(id[, ipBanishment])
getGlobalStorageValue(valueid)
getConfigFile()
getLogsDir()
getDataDir()

//set*
setCreatureMaxHealth(cid, health)
setCreatureMaxMana(cid, mana)
setPlayerStorageValue(uid, valueid, newvalue)
setPlayerGroupId(cid, newGroupId)
setPlayerPromotionLevel(cid, level)
setPlayerStamina(cid, minutes)
setPlayerExtraExpRate(cid, value)
setPlayerPartner(cid, guid)
setHouseOwner(houseid, ownerGUID)
setHouseAccessList(houseid, listid, listtext)
setItemName(uid)
setItemPluralName(uid)
setItemIdArticle(uid)
setItemAttack(uid, attack)
setItemExtraAttack(uid, extraattack)
setItemDefense(uid, defense)
setItemArmor(uid, armor)
setItemExtraDefense(uid, extradefense)
setItemAttackSpeed(uid, attackspeed)
setItemHitChance(uid, hitChance)
setCombatArea(combat, area)
setCombatCondition(combat, condition)
setCombatParam(combat, key, value)
setConditionParam(condition, key, value)
setCombatCallBack(combat, key, function_name)
setCombatFormula(combat, type, mina, minb, maxa, maxb)
setConditionFormula(combat, mina, minb, maxa, maxb)
setGlobalStorageValue(valueid, newvalue)
setWorldType(type)

//do*
doCreatureAddHealth(cid, health[, force])
doCreatureAddMana(cid, mana)
doCreatureSetDropLoot(cid, doDrop)
doCreatureSetSkullType(cid, skull)
doCreatureChangeOutfit(cid, outfit)
doCreatureSay(cid, text, type[, pos])
doSetCreatureLight(cid, lightLevel, lightColor, time)
doSetCreatureOutfit(cid, outfit, time)
doRemoveCreature(cid)
doMoveCreature(cid, direction)
doSummonCreature(name, pos)
doConvinceCreature(cid, target)
doChallengeCreature(cid, target)
doChangeSpeed(cid, delta)
doMonsterChangeTarget(cid)
doMonsterSetTarget(cid, target)
doSetMonsterOutfit(cid, name, time)
doPlayerBroadcastMessage(cid, message[, type])
doPlayerSetSex(cid, newSex)
doPlayerSetTown(cid, townid)
doPlayerSetVocation(cid,voc)
doPlayerRemoveItem(cid, itemid, count[, subtype])
doPlayerAddExp(cid, exp)
doPlayerSetGuildId(cid, id)
doPlayerSetGuildRank(cid, rank)
doPlayerSetGuildNick(cid, nick)
doPlayerAddOutfit(cid,looktype, addons)
doPlayerRemoveOutfit(cid,looktype, addons)
doPlayerSetRedSkullTicks(cid, amount)
doPlayerSetLossPercent(cid, lossType, newPercent)
doPlayerSetLossSkill(cid, doLose)
doPlayerAddSkillTry(cid, skillid, n)
doPlayerAddSpentMana(cid, amount)
doPlayerAddSoul(cid, soul)
doPlayerAddItem(uid, itemid[, count/subtype[, canDropOnMap]])
doPlayerAddItemEx(cid, uid[, canDropOnMap])
doPlayerSendTextMessage(cid, MessageClasses, message)
doPlayerAddMoney(cid, money)
doPlayerRemoveMoney(cid, money)
doPlayerWithdrawMoney(cid, money)
doPlayerDepositMoney(cid, money)
doPlayerTransferMoneyTo(cid, target, money)
doPlayerPopupFYI(cid, message)
doPlayerSendTutorial(cid, id)
doPlayerAddMapMark(cid, pos, type[, description])
doPlayerAddPremiumDays(cid, days)
doPlayerAddBlessing(cid, blessing)
doPlayerAddStamina(cid, minutes)
doPlayerSetNoMove(cid, cannotMove)
doPlayerResetIdleTime(cid)
doPlayerLearnInstantSpell(cid, name)
doPlayerFeed(cid, food)
doPlayerSendCancel(cid, text)
doPlayerSendDefaultCancel(cid, ReturnValue)
doCreateItem(itemid, type/count, pos)
doCreateItemEx(itemid[, count/subtype])
doAddContainerItemEx(uid, virtuid)
doAddContainerItem(uid, itemid[, count/subtype])
doChangeTypeItem(uid, newtype)
doDecayItem(uid)
doRemoveItem(uid[, n])
doTransformItem(uid, toitemid[, count/subtype])
doSetItemActionId(uid, actionid)
doSetItemText(uid, text)
doSetItemSpecialDescription(uid, desc)
doSetItemOutfit(cid, item, time)
doTileAddItemEx(pos, uid)
doAddCondition(cid, condition)
doRemoveCondition(cid, type)
doAreaCombatHealth(cid, type, pos, area, min, max, effect)
doTargetCombatHealth(cid, target, type, min, max, effect)
doAreaCombatMana(cid, pos, area, min, max, effect)
doTargetCombatMana(cid, target, min, max, effect)
doAreaCombatCondition(cid, pos, area, condition, effect)
doTargetCombatCondition(cid, target, condition, effect)
doAreaCombatDispel(cid, pos, area, type, effect)
doTargetCombatDispel(cid, target, type, effect)
doCombat(cid, combat, param)
doTeleportThing(cid, newpos[, pushmove])
doCreateTeleport(itemid, topos, createpos)
doSendMagicEffect(pos, type[, creature])
doSendDistanceShoot(frompos, topos, type[, creature])
doSendAnimatedText(pos, text, color[, creature])
doShowTextDialog(cid, itemid, text)
doRelocate(pos, posTo)
doBroadcastMessage(message, type)
doAddIpBanishment(ip[, length[, comment[, admin]]])
doAddNamelock(name[, reason[, action[, comment[, admin]]]])
doAddBanishment(accId[, length[, reason[, action[, comment[, admin]]]]])
doAddDeletion(accId[, reason[, action[, comment[, admin]]]]])
doAddNotation(accId[, reason[, action[, comment[, admin]]]]])
doRemoveIpBanishment(ip[, mask])
doRemoveNamelock(name)
doRemoveBanisment(accId)
doRemoveDeletion(accId)
doRemoveNotations(accId)


//is*
isCreature(cid)
isMonster(uid)
isNpc(uid)
isPlayer(cid)
isPlayerPzLocked(cid)
isPlayerGhost(cid)
isItemStackable(itemid)
isItemRune(itemid)
isItemDoor(itemid)
isItemLevelDoor(itemid)
isItemContainer(itemid)
isItemFluidContainer(itemid)
isItemMovable(itemid)
isContainer(uid)
isCorpse(uid)
isMovable(uid)
isSightClear(fromPos, toPos, floorCheck)
isIpBanished(ip[, mask])
isPlayerNamelocked(name)
isAccountBanished(accId)
isAccountDeleted(accId)
isInArray({array}, value)

//others
registerCreatureEvent(uid, eventName)
createCombatArea({area}[, {exArea}])
createConditionObject(type)
addDamageCondition(condition, rounds, time, value)
addOutfitCondition(condition, lookTypeEx, lookType, lookHead, lookBody, lookLegs, lookFeet)
createCombatObject()
numberToVariant(number)
stringToVariant(string)
positionToVariant(pos)
targetPositionToVariant(pos)
variantToNumber(var)
variantToString(var)
variantToPosition(var)
canPlayerLearnInstantSpell(cid, name)
queryTileAddThing(uid, pos[, flags])
canPlayerWearOutfit(cid, looktype, addons)
executeRaid(name)
saveServer()
cleanHouse(houseId)
cleanMap()
shutdown()
addEvent(callback, delay, ...)
stopEvent(eventid)
debugPrint(text)
hasProperty(uid)

//db table

db.executeQuery(query)
db.storeQuery(query)
db.escapeString(str)
db.escapeBlob(s, length)
db.stringComparisonOperator()

//result table
result.getDataInt(resId, s)
result.getDataLong(resId, s)
result.getDataString(resId, s)
result.getDataStream(resId, s, length)
result.next(resId)
result.free(resId)

//bit table
#bit.cast
bit.bnot(n)
bit.band(type, n)
bit.bor(type, n)
bit.bxor(type, n)
bit.lshift(type, n)
bit.rshift(type, n)
#bit.arshift
#bit.ucast
bit.ubnot(n)
bit.uband(type, n)
bit.ubor(type, n)
bit.ubxor(type, n)
bit.ulshift(type, n)
bit.urshift(type, n)
#bit.uarshift

//compats
table.getPos = table.find
doSetCreatureDropLoot = doCreatureSetDropLoot
doPlayerSay = doCreatureSay
doPlayerAddMana = doCreatureAddMana
playerLearnInstantSpell = doPlayerLearnInstantSpell
doPlayerRemOutfit = doPlayerRemoveOutfit
pay = doPlayerRemoveMoney
broadcastMessage = doBroadcastMessage
getPlayerName = getCreatureName
getPlayerPosition = getCreaturePosition
getCreaturePos = getCreaturePosition
creatureGetPosition = getCreaturePosition
getPlayerMana = getCreatureMana
getPlayerMaxMana = getCreatureMaxMana
hasCondition = getCreatureCondition
isMoveable = isMovable
isItemMoveable = isItemMovable
saveData = saveServer
savePlayers = saveServer
getPlayerSkill = getPlayerSkillLevel
getPlayerSkullType = getCreatureSkullType
getAccountNumberByName = getAccountIdByName
getIPByName = getIpByName
getPlayersByIP = getPlayersByIp
getThingfromPos = getThingFromPos
getPlayersByAccountNumber = getPlayersByAccountId
getIPByPlayerName = getIpByName
getPlayersByIPNumber = getPlayersByIp
getAccountNumberByPlayerName = getAccountIdByName
convertIntToIP = doConvertIntegerToIp

//lua-made functions
doPlayerGiveItem(cid, itemid, amount, subType)
doPlayerTakeItem(cid, itemid, amount)
doPlayerBuyItem(cid, itemid, count, cost, charges)
doPlayerBuyItemContainer(cid, containerid, itemid, count, cost, charges)
doPlayerSellItem(cid, itemid, count, cost)
isInRange(pos, fromPos, toPos)
isPremium(cid)
getMonthDayEnding(day)
getMonthString(m)
getArticle(str)
isNumber(str)
getDistanceBetween(firstPosition, secondPosition)
doPlayerAddAddons(cid, addon)
isSorcerer(cid)
isDruid(cid)
isPaladin(cid)
isKnight(cid)
isRookie(cid)
getConfigInfo(info)
getDirectionTo(pos1, pos2)
getPlayerLookPos(cid)
getPosByDir(fromPosition, direction, size)
getPlayerMoney(cid)
doPlayerWithdrawAllMoney(cid)
doPlayerDepositAllMoney(cid)
doPlayerTransferAllMoneyTo(cid, target)
playerExists(name)
getTibiaTime()
doWriteLogFile(file, text)
isInArea(pos, fromPos, toPos)
getExperienceForLevel(lv)
doMutePlayer(cid, time)
getPlayerVocationName(cid)
getPromotedVocation(vid)
doPlayerRemovePremiumDays(cid, days)
getPlayerMasterPos(cid)
getOnlinePlayers()
getPlayerByName(name)
getPlayerFrags(cid)
doConvertIntegerToIp(int, mask)
getBooleanFromString(str)
doCopyItem(item, attributes)
exhaustion.check(cid, storage)
exhaustion.get(cid, storage)
exhaustion.set(cid, storage, time)
exhaustion.make(cid, storage, time)
table.find(table, value)
table.isStrIn(txt, str)
table.countElements(table, item)
table.getCombinations(table, num)
string.split(str)
string.trim(str)
string.explode(str, sep)​
 
Last edited:
and what about atrributes in items? In 0.2 was possible to get more hp by wearing item with "maxhitpoints" but in 0.3 it doesnt work and none can help me ;s
 
and what about atrributes in items? In 0.2 was possible to get more hp by wearing item with "maxhitpoints" but in 0.3 it doesnt work and none can help me ;s

To be honest, I dont know where you can find attributes for items :/

I think someone posted it already, but I'm not sure.


@up
Yeah, but newbies can take a look here, if they do not know where to find theese functions. :)
 
Back
Top