Qué son los nombres cortos de funciones

Además de la llamada por grupo (Player.GetLevel(aIndex), Message.Send(...)...), el archivo Data\LuaAPI\System\Modules.lua define un conjunto adicional de nombres escritos en una sola palabra, por ejemplo GetObjectLevel(aIndex) o NoticeSend(...). Son funciones globales que solo vuelven a llamar a las funciones de GameServer, por lo que se puede usar cualquiera de las dos formas; los nombres cortos son cómodos para escribir rápido o para migrar scripts antiguos.

Las tablas de abajo contienen los nombres de uso habitual, contrastados con Modules.lua. La lista completa está en ese mismo archivo (sección "2. Short function names"); este archivo lo gestiona el sistema y no conviene editarlo.

Diferencias que hay que recordar

  • Muchas funciones de tipo "sí / no" del conjunto de nombres cortos devuelven el número 1 / 0 en lugar de true / false (por ejemplo EffectCheck, InventoryDelItemIndex, MapCheckAttr). La función de grupo equivalente devuelve true / false.
  • La tabla de objeto obtenida con InventoryGetItemTable tiene los dos juegos de nombres de campo: los de GameServer (Skill, Luck, Option, Exc, Ancient, Harmony, Option380, SocketBonus, ExpireDate, Sockets) y los nombres antiguos (Option1, Option2, Option3, NewOption, SetOption, JoHOption, 380Option, SocketOption1..5, SocketOptionBonus, DurationTime). Una casilla vacía devuelve nil.
  • El índice empieza en 0 en algunos nombres antiguos: PartyGetMemberIndex(party, slot) recibe slot desde 0 (la función de grupo Party.GetMember cuenta desde 1).
  • Sistema Gens: los nombres cortos usan 1 = Vanert, 2 = Duprian, al revés que el valor guardado en GameServer (1 = Duprian, 2 = Vanert); la función GetObjectGensFamily lo convierte para que coincida.
  • LogColor(color, text): color = 1 escribe el log en rojo (error), cualquier otro valor escribe un log normal. RandomGetNumber(max) devuelve un entero de 0 a max - 1.

Tabla de nombres de uso habitual

Objeto / servidor

Nombre cortoEquivalente
GetGameServerCode()Server.GetCode()
GetGameServerCurUser(), GetGameServerMaxUser()Server.GetOnlineCount(), Server.GetMaxUser()
GetGameServerVersion()Server.GetVersion()
GetMinUserIndex(), GetMaxUserIndex()los 2 valores de Object.GetUserRange()
GetMinMonsterIndex(), GetMaxMonsterIndex()los 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 con 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 (devuelve 1 / 0)

Personaje: lectura

Nombre cortoEquivalente
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* (las mismas 5 estadísticas)Player.GetTotalStat, GetAddStat, GetDefaultStat
GetObjectAccountLevel, GetObjectAccountExpireDatePlayer.GetVIP, Player.GetVIPExpire
GetObjectIpAddress, GetObjectHardwareId, GetPlayerMac, GetPlayerSerialPlayer.GetIP, GetHardwareId, GetMac, GetDiskSerial (el serial se devuelve como cadena)
GetObjectPartyNumber, GetObjectGuildNumber, GetObjectGuildName...Player.GetPartyNumber, GetGuildNumber, GetGuildName...
GetObjectDeathMap, GetObjectDeathMapX, GetObjectDeathMapYÚltimo lugar de muerte (Player.GetDeathLocation), -1 si no hay
GetObjectMasterReset, GetObjectLangSiempre devuelven 0 (el servidor no tiene Master Reset y solo tiene un idioma)

Personaje: escritura y acciones

Nombre cortoEquivalente
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)Permisos temporales (no se guardan): 1 mover objetos, 2 vender, 3 comprar, 4 usar objetos, 5 tirar, 6 recoger, 7 intercambiar, 8 abrir tienda personal, 10 Cash Shop, 11 chat, 12 teletransporte; otros números no son válidos

Avisos, moneda, log

Nombre cortoEquivalente
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 (cuando color = 1)
CommandGetArgNumber, CommandGetArgStringUtil.ArgNumber, Util.ArgString
SQLAsyncQueryDB.Query
ConfigReadNumber(section, key, path), ConfigReadString, ConfigSaveStringConfig.ReadNumber (predeterminado 0), Config.ReadString (predeterminado cadena vacía), Config.SaveString

Inventario y objetos

Nombre cortoEquivalente
InventoryGetItemTable(aIndex, slot)Player.GetItem + añade los nombres de campo antiguos
InventoryGetItemIndex, InventoryGetItemCount(aIndex, item, level)Código del objeto de la casilla (-1 si está vacía) / Inventory.CountItem (nivel predeterminado -1 = cualquier nivel)
InventoryDelItemIndex, InventoryDelItemCountInventory.DeleteSlot, Inventory.DeleteItems (devuelven 1 / 0)
InventoryGetFreeSlotCount, InventoryCheckSpaceByItem, InventoryCheckSpaceBySizeInventory.FreeSlots, Inventory.HasSpaceForItem, Inventory.HasSpace
InventoryGetWearSize, InventoryGetMainSize, InventoryGetFullSizeLos valores de Inventory.GetSizes()
InventorySetItemTable(aIndex, slot, t)Inventory.SetItem (acepta también los nombres de campo antiguos)
EventInventory*, MuunInventory*Inventario de eventos / inventario Muun: leer y contar objetos
ItemGive, ItemDropItem.GiveBag, Item.DropBag (entregar / soltar según la bolsa de objetos)
ItemGiveEx, ItemDropEx, CreateItem, InsertItem_GremoryCase, InsertItem_GremoryCaseExCrean un objeto con todos sus atributos (parámetros largos, consulte los comentarios en Modules.lua); se convierten a Item.Give / Item.GremoryAdd
IsItem, IsSocketItem, IsElementalItem, IsPentagramItem, GetItemKindAItem.IsValid, IsSocket, IsElemental, IsPentagram, GetKindA
GetBagItemLevel, GetAncientOpt, GetRandomValue(max)Item.RandomLevel, Item.RandomAncientOption, número aleatorio 0..max-1

Monstruos, efectos, grupo

Nombre cortoEquivalente
MonsterCreate(class, map, x, y, dir), MonsterCreateEx, MonsterDeleteMonster.Create (dir predeterminado -1), Monster.CreateEx, Monster.Delete
MonsterSummonCreate, MonsterSummonDeletePlayer.SummonMonster, Player.KillSummon
EffectAdd(aIndex, mode, effect, seconds)Buff.Add; con mode = 1, seconds es el momento de expiración (un instante), no un número de segundos
EffectDel, EffectCheck, EffectClearBuff.Remove, Buff.Has (devuelve 1 / 0), Buff.Clear
PartyGetMemberCount, PartyGetMemberIndexParty.GetCount, Party.GetMember

Nombres reservados no compatibles

Los siguientes nombres existen en Modules.lua pero todavía no son compatibles. Llamarlos provoca el error nombre() is not supported by LuaAPI (solo detiene la función que los llama, no afecta a otros módulos):

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