O conjunto de nomes de função escritos juntos (GetObjectLevel, NoticeSend, InventoryGetItemTable...) que apontam para as funções dos grupos Player / Item / Message...; diferenças nos valores de retorno.
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 curto | Equivalente |
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, GetObjectClass | Object.GetConnectStatus, GetType, GetName, GetClass |
GetObjectMap, GetObjectMapX, GetObjectMapY | Object.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 curto | Equivalente |
GetObjectAccount, GetObjectAccountID, GetObjectPlayerID | Player.GetAccount, GetAccountID, GetCharacterID |
GetObjectLevel, GetObjectMasterLevel, GetObjectMajesticLevel, GetObjectToTalLevel | Player.GetLevel, GetMasterLevel, GetMajesticLevel, GetTotalLevel |
GetObjectLevelUpPoint, GetObjectMasterPoint, GetObjectMajesticPoint | Player.GetLevelUpPoint, GetMasterPoint, GetMajesticPoint |
GetObjectMoney, GetObjectReset, GetObjectRuud | Player.GetMoney, GetReset, GetRuud |
GetObjectPKCount, GetObjectPKLevel, GetObjectPKTimer | Player.GetPKCount, GetPKLevel, GetPKTimer |
GetObjectStrength, Dexterity, Vitality, Energy, Leadership | Player.GetStat(aIndex, STAT_*) |
GetObjectTotal*, GetObjectExtra*, GetObjectDefault* (os mesmos 5 atributos) | Player.GetTotalStat, GetAddStat, GetDefaultStat |
GetObjectAccountLevel, GetObjectAccountExpireDate | Player.GetVIP, Player.GetVIPExpire |
GetObjectIpAddress, GetObjectHardwareId, GetPlayerMac, GetPlayerSerial | Player.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, GetObjectLang | Sempre retornam 0 (o servidor não tem Master Reset e possui um único idioma) |
Personagem: gravação e ações
| Nome curto | Equivalente |
SetObjectLevel, SetObjectMasterLevel, SetObjectMajesticLevel | Player.SetLevel, SetMasterLevel, SetMajesticLevel |
SetObjectMoney, ChangeObjectReset / SetObjectReset, SetObjectRuud | Player.SetMoney, SetReset, SetRuud |
SetObjectStrength... SetObjectLeadership | Player.SetStat(aIndex, STAT_*, value) |
UserCalcAttribute / CalculateCharacter, UserInfoSend, LevelUpSend | Player.ReCalc, Player.SendInfo, Player.SendLevelUp |
UserDisconnect, UserGameLogout | Player.Disconnect, Player.Logout |
MoveUser, MoveUserEx | Player.MoveGate, Player.MoveTo |
UserWarehouseOpen | Player.OpenWarehouse |
SetWindowText | Player.SetWindowText |
UserGetOptionTable, UserSetOptionTable | Player.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 curto | Equivalente |
NoticeSend, NoticeSendToAll, NoticeGlobalSend | Message.Send, Message.SendAll, Message.SendGlobal |
MessageSend, MessageSendToAll, ChatTargetSend | Message.Box, Message.BoxAll, Message.NpcSay |
CashShopGetPoint, CashShopAddPoint, CashShopSubPoint | Coin.Get, Coin.Add, Coin.Sub |
LogPrint(text), LogColor(color, text) | Log.Add, Log.AddC (quando color = 1) |
CommandGetArgNumber, CommandGetArgString | Util.ArgNumber, Util.ArgString |
SQLAsyncQuery | DB.Query |
ConfigReadNumber(section, key, path), ConfigReadString, ConfigSaveString | Config.ReadNumber (padrão 0), Config.ReadString (padrão string vazia), Config.SaveString |
Bolsa e itens
| Nome curto | Equivalente |
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, InventoryDelItemCount | Inventory.DeleteSlot, Inventory.DeleteItems (retornam 1 / 0) |
InventoryGetFreeSlotCount, InventoryCheckSpaceByItem, InventoryCheckSpaceBySize | Inventory.FreeSlots, Inventory.HasSpaceForItem, Inventory.HasSpace |
InventoryGetWearSize, InventoryGetMainSize, InventoryGetFullSize | Os 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, ItemDrop | Item.GiveBag, Item.DropBag (entregar / dropar por bolsa de itens) |
ItemGiveEx, ItemDropEx, CreateItem, InsertItem_GremoryCase, InsertItem_GremoryCaseEx | Criam 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, GetItemKindA | Item.IsValid, IsSocket, IsElemental, IsPentagram, GetKindA |
GetBagItemLevel, GetAncientOpt, GetRandomValue(max) | Item.RandomLevel, Item.RandomAncientOption, número aleatório 0..max-1 |
Monstros, efeitos, grupo
| Nome curto | Equivalente |
MonsterCreate(class, map, x, y, dir), MonsterCreateEx, MonsterDelete | Monster.Create (dir padrão -1), Monster.CreateEx, Monster.Delete |
MonsterSummonCreate, MonsterSummonDelete | Player.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, EffectClear | Buff.Remove, Buff.Has (retorna 1 / 0), Buff.Clear |
PartyGetMemberCount, PartyGetMemberIndex | Party.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.