O que são os nomes curtos de funções

Além da chamada por grupo (Player.GetLevel(aIndex), Message.Send(...)...), o arquivo Data\LuaAPI\System\Modules.lua define também um conjunto de nomes escritos juntos, por exemplo GetObjectLevel(aIndex) ou NoticeSend(...). São funções globais que apenas chamam de volta as funções do GameServer, portanto qualquer uma das formas pode ser usada; os nomes curtos são convenientes para escrever rápido ou para migrar scripts antigos.

A tabela abaixo traz os nomes mais usados, conferidos com o Modules.lua. A lista completa está no próprio arquivo (seção "2. Short function names"); esse arquivo é gerenciado pelo sistema e não deve ser editado.

Diferenças a lembrar

  • Muitas funções do tipo "sim / não" no conjunto de nomes curtos retornam o número 1 / 0 em vez de true / false (por exemplo EffectCheck, InventoryDelItemIndex, MapCheckAttr). As funções de grupo correspondentes retornam true / false.
  • A tabela de item obtida com InventoryGetItemTable tem os dois conjuntos de nomes de campo: os nomes do GameServer (Skill, Luck, Option, Exc, Ancient, Harmony, Option380, SocketBonus, ExpireDate, Sockets) e os nomes antigos (Option1, Option2, Option3, NewOption, SetOption, JoHOption, 380Option, SocketOption1..5, SocketOptionBonus, DurationTime). Um slot vazio retorna nil.
  • Em alguns nomes antigos o índice começa em 0: PartyGetMemberIndex(party, slot) recebe slot a partir de 0 (a função de grupo Party.GetMember conta a partir de 1).
  • Sistema Gens: os nomes curtos usam 1 = Vanert, 2 = Duprian, o inverso do valor armazenado no GameServer (1 = Duprian, 2 = Vanert); a função GetObjectGensFamily converte de volta para coincidir.
  • LogColor(color, text): color = 1 registra o log em vermelho (erro), outros valores registram o log normal. RandomGetNumber(max) retorna um inteiro de 0 a max - 1.

Tabela de nomes mais usados

Objeto / servidor

Nome curtoEquivalente
GetGameServerCode()Server.GetCode()
GetGameServerCurUser(), GetGameServerMaxUser()Server.GetOnlineCount(), Server.GetMaxUser()
GetGameServerVersion()Server.GetVersion()
GetMinUserIndex(), GetMaxUserIndex()Os 2 valores de Object.GetUserRange()
GetMinMonsterIndex(), GetMaxMonsterIndex()Os 2 valores de Object.GetMonsterRange()
GetObjectConnected, GetObjectType, GetObjectName, GetObjectClassObject.GetConnectStatus, GetType, GetName, GetClass
GetObjectMap, GetObjectMapX, GetObjectMapYObject.GetMap, GetX, GetY
GetObjectLife, GetObjectMaxLife, GetObjectMana, GetObjectMaxMana, GetObjectBP, GetObjectShield...Object.GetPower / Object.GetMaxPower com POWER_LIFE, POWER_MANA, POWER_STAMINA, POWER_SHIELD
SetObjectLife, SetObjectMaxLife, SetObjectMana...Object.SetPower / Object.SetMaxPower
GetObjectIndexByName(name)Player.GetIndexByName
GetMapName(map)Map.GetName
MapCheckAttr(map, x, y, attr)Map.CheckAttr (retorna 1 / 0)

Personagem: leitura

Nome curtoEquivalente
GetObjectAccount, GetObjectAccountID, GetObjectPlayerIDPlayer.GetAccount, GetAccountID, GetCharacterID
GetObjectLevel, GetObjectMasterLevel, GetObjectMajesticLevel, GetObjectToTalLevelPlayer.GetLevel, GetMasterLevel, GetMajesticLevel, GetTotalLevel
GetObjectLevelUpPoint, GetObjectMasterPoint, GetObjectMajesticPointPlayer.GetLevelUpPoint, GetMasterPoint, GetMajesticPoint
GetObjectMoney, GetObjectReset, GetObjectRuudPlayer.GetMoney, GetReset, GetRuud
GetObjectPKCount, GetObjectPKLevel, GetObjectPKTimerPlayer.GetPKCount, GetPKLevel, GetPKTimer
GetObjectStrength, Dexterity, Vitality, Energy, LeadershipPlayer.GetStat(aIndex, STAT_*)
GetObjectTotal*, GetObjectExtra*, GetObjectDefault* (os mesmos 5 atributos)Player.GetTotalStat, GetAddStat, GetDefaultStat
GetObjectAccountLevel, GetObjectAccountExpireDatePlayer.GetVIP, Player.GetVIPExpire
GetObjectIpAddress, GetObjectHardwareId, GetPlayerMac, GetPlayerSerialPlayer.GetIP, GetHardwareId, GetMac, GetDiskSerial (o serial é retornado como string)
GetObjectPartyNumber, GetObjectGuildNumber, GetObjectGuildName...Player.GetPartyNumber, GetGuildNumber, GetGuildName...
GetObjectDeathMap, GetObjectDeathMapX, GetObjectDeathMapYÚltimo local de morte (Player.GetDeathLocation), -1 se ainda não houver
GetObjectMasterReset, GetObjectLangSempre retornam 0 (o servidor não tem Master Reset e possui um único idioma)

Personagem: gravação e ações

Nome curtoEquivalente
SetObjectLevel, SetObjectMasterLevel, SetObjectMajesticLevelPlayer.SetLevel, SetMasterLevel, SetMajesticLevel
SetObjectMoney, ChangeObjectReset / SetObjectReset, SetObjectRuudPlayer.SetMoney, SetReset, SetRuud
SetObjectStrength... SetObjectLeadershipPlayer.SetStat(aIndex, STAT_*, value)
UserCalcAttribute / CalculateCharacter, UserInfoSend, LevelUpSendPlayer.ReCalc, Player.SendInfo, Player.SendLevelUp
UserDisconnect, UserGameLogoutPlayer.Disconnect, Player.Logout
MoveUser, MoveUserExPlayer.MoveGate, Player.MoveTo
UserWarehouseOpenPlayer.OpenWarehouse
SetWindowTextPlayer.SetWindowText
UserGetOptionTable, UserSetOptionTablePlayer.GetOptionTable, Player.SetOptionTable
PermissionCheck / Insert / Remove(aIndex, perm)Permissões temporárias (não são salvas): 1 mover item, 2 vender, 3 comprar, 4 usar item, 5 jogar fora, 6 pegar, 7 negociar, 8 abrir loja pessoal, 10 Cash Shop, 11 chat, 12 teletransporte; outros números são inválidos

Mensagens, moedas, log

Nome curtoEquivalente
NoticeSend, NoticeSendToAll, NoticeGlobalSendMessage.Send, Message.SendAll, Message.SendGlobal
MessageSend, MessageSendToAll, ChatTargetSendMessage.Box, Message.BoxAll, Message.NpcSay
CashShopGetPoint, CashShopAddPoint, CashShopSubPointCoin.Get, Coin.Add, Coin.Sub
LogPrint(text), LogColor(color, text)Log.Add, Log.AddC (quando color = 1)
CommandGetArgNumber, CommandGetArgStringUtil.ArgNumber, Util.ArgString
SQLAsyncQueryDB.Query
ConfigReadNumber(section, key, path), ConfigReadString, ConfigSaveStringConfig.ReadNumber (padrão 0), Config.ReadString (padrão string vazia), Config.SaveString

Bolsa e itens

Nome curtoEquivalente
InventoryGetItemTable(aIndex, slot)Player.GetItem + os nomes de campo antigos adicionais
InventoryGetItemIndex, InventoryGetItemCount(aIndex, item, level)Código do item do slot (-1 se vazio) / Inventory.CountItem (nível padrão -1 = qualquer nível)
InventoryDelItemIndex, InventoryDelItemCountInventory.DeleteSlot, Inventory.DeleteItems (retornam 1 / 0)
InventoryGetFreeSlotCount, InventoryCheckSpaceByItem, InventoryCheckSpaceBySizeInventory.FreeSlots, Inventory.HasSpaceForItem, Inventory.HasSpace
InventoryGetWearSize, InventoryGetMainSize, InventoryGetFullSizeOs valores de Inventory.GetSizes()
InventorySetItemTable(aIndex, slot, t)Inventory.SetItem (aceita também os nomes de campo antigos)
EventInventory*, MuunInventory*Inventário de evento / inventário Muun: leitura e contagem de itens
ItemGive, ItemDropItem.GiveBag, Item.DropBag (entregar / dropar por bolsa de itens)
ItemGiveEx, ItemDropEx, CreateItem, InsertItem_GremoryCase, InsertItem_GremoryCaseExCriam item com todos os atributos (parâmetros longos, veja os comentários em Modules.lua); convertem para Item.Give / Item.GremoryAdd
IsItem, IsSocketItem, IsElementalItem, IsPentagramItem, GetItemKindAItem.IsValid, IsSocket, IsElemental, IsPentagram, GetKindA
GetBagItemLevel, GetAncientOpt, GetRandomValue(max)Item.RandomLevel, Item.RandomAncientOption, número aleatório 0..max-1

Monstros, efeitos, grupo

Nome curtoEquivalente
MonsterCreate(class, map, x, y, dir), MonsterCreateEx, MonsterDeleteMonster.Create (dir padrão -1), Monster.CreateEx, Monster.Delete
MonsterSummonCreate, MonsterSummonDeletePlayer.SummonMonster, Player.KillSummon
EffectAdd(aIndex, mode, effect, seconds)Buff.Add; com mode = 1, seconds é o marco de expiração (um instante), não um número de segundos
EffectDel, EffectCheck, EffectClearBuff.Remove, Buff.Has (retorna 1 / 0), Buff.Clear
PartyGetMemberCount, PartyGetMemberIndexParty.GetCount, Party.GetMember

Nomes reservados não suportados

Os nomes a seguir existem em Modules.lua, mas ainda não são suportados. Chamá-los causa o erro nome() is not supported by LuaAPI (interrompe apenas a função que fez a chamada, sem afetar outros módulos):

GetObjectMaxNormalPoints, GetObjectPassword, GetObjectPersonalCode, EventInventorySetItemTable, EventInventoryDelItemIndex, EventInventoryDelItemCount, MuunInventorySetItemTable, MuunInventoryDelItemCount, AddItemBag, PartyCreate, PartyDelete, PartyAddMember, PartyDelMember, SendRgbChat.