--═══════════════════════════════════════════════════════════════ --== INTERNATIONAL GAMING CENTER NETWORK --== www.igcn.mu --== (C) 2010-2026 IGC-Network (R) --~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ --== File is a part of IGCN Group MuOnline Server files. --═══════════════════════════════════════════════════════════════ -- ============================================================================ -- Enums.lua : shared names for custom map and custom monster scripts. -- -- Load it with require("Enums"). require reads only this folder and loads each file -- once per state, so every script that asks gets the same table. -- -- Names only. Functions belong in Helpers.lua. -- -- Ship as Enums.gsc next to the other .gsc files; the .lua form only loads while -- the server enables LuaDevMode. -- -- On isolation: these scripts run in their own lua_State, completely separate -- from the LuaUI one. Nothing here reaches LuaUI and nothing LuaUI registers -- reaches here, whether or not that plugin is installed. -- ============================================================================ local Enums = {} -- ============================================================================ -- Enums.Kind - what a T_OBJECT represents -- -- These are BIT FLAGS, not an ordered list; the client combines them, e.g. it -- picks a click target with KIND_MONSTER|KIND_EDIT. -- -- There is no bit library in this sandbox - it opens base, table, string, math and -- the clock half of os - so a combination has to be tested with arithmetic: -- local isMonster = math.floor(kind / Enums.Kind.Monster) % 2 == 1 -- The kind of an object is not exposed to scripts today either; these values -- are here to document what the client and the XML config mean by them. -- -- Player an actual player character in the world -- Monster a monster -- NPC a shop, guard or quest NPC -- Trap a damaging map trap -- Operate interactive scenery (gates, levers). No longer set anywhere in the -- client sources - treat it as legacy -- Edit a character shown outside the world: the character info and preview -- screens set this, and it is selectable together with monsters -- Pet a pet, set by the pet system -- Tmp a temporary stand-in character. The client uses it for player models -- that are not real world players, for example the Battle Castle -- dummies -- -- There is no value 0: an object with Kind 0 has never been assigned one. -- ============================================================================ Enums.Kind = { Player = 1, Monster = 2, NPC = 4, Trap = 8, Operate = 16, Edit = 32, Pet = 64, Tmp = 128, } -- ============================================================================ -- Enums.TerrainWall - what a tile allows, as Map.TerrainWall(x, y) returns it -- -- The flags of the world's EncTerrain.att. BIT FLAGS again, and a tile often -- carries several - a safe zone with a fence through it is 1 + 4 = 5 - so test one -- with the same arithmetic as Enums.Kind: -- local blocked = math.floor(Map.TerrainWall(x, y) / Enums.TerrainWall.NoMove) % 2 == 1 -- The GameServer tests the same bits in its own copy of the map, so a tile means the -- same on both sides. -- -- SafeZone no fighting - towns and the other safe areas -- Character a character is standing on the tile -- NoMove nothing walks here - walls, fences, buildings -- NoGround nothing to stand on - cliffs, the void past the map's edge -- Water water -- ============================================================================ Enums.TerrainWall = { SafeZone = 1, Character = 2, NoMove = 4, NoGround = 8, Water = 16, } -- ============================================================================ -- Enums.Action - monster animation actions -- -- The client MONSTER01_* action ids, as read through o.currentAction and written -- with o:SetAction(). The numbering is NOT contiguous: the three extra attacks -- were appended after the original eight, so Attack3 is 8 rather than 5. -- -- o:SetAction() is safe with any of these - the client itself drops an action the -- model does not actually have. -- ============================================================================ Enums.Action = { Stop1 = 0, Stop2 = 1, Walk = 2, Attack1 = 3, Attack2 = 4, Shock = 5, Die = 6, Appear = 7, Attack3 = 8, Attack4 = 9, Run = 10, Attack5 = 11, } -- The attack actions in the order the config uses them, so a -- script can map a config slot onto an action id. Enums.AttackAction = { Enums.Action.Attack1, Enums.Action.Attack2, Enums.Action.Attack3, Enums.Action.Attack4, Enums.Action.Attack5, } -- ============================================================================ -- Enums.SpriteRotate - sprite rotation axis mask -- -- Which axes the client applies o.angleZ to when it draws a sprite. It always -- passes Z itself, which reproduces the old hardcoded behaviour. -- ============================================================================ Enums.SpriteRotate = { X = 1, Y = 2, Z = 4, } -- ============================================================================ -- Enums.RenderFlags - body render flags -- -- The client RENDER_* constants. A wrong bit here is not a different look but a -- different render path, and nothing reports it. -- -- Used from a monster script as: -- m.renderFlags = Enums.RenderFlags.METAL + Enums.RenderFlags.BRIGHT -- -- Plain addition is correct because every flag is a distinct bit. Adding the same -- flag twice would not be, so build the mask from distinct names. -- -- COLOR draw untextured, flat BodyLight colour -- TEXTURE plain textured pass, the ordinary default -- CHROME environment / chrome reflection -- CHROME2 chrome variant; binds the chrome texture when the mesh has none -- CHROME3 as above, the "set item" effect -- CHROME4 as above, the "+13" effect -- CHROME5 soft light variant -- CHROME6 chrome variant -- CHROME7 chrome variant -- CHROME8 lucky item effect -- CHROME9 chrome variant of its own, scrolled on two axes at once -- METAL metallic reflection, brighter than CHROME -- OIL oily sheen variant -- LIGHTMAP modulate with the light map instead of alpha blending -- SHADOWMAP shadow pass -- BRIGHT additive blend; body light gets scaled by alpha -- DARK subtractive blend -- EXTRA extra pass on top, used to stack a second effect -- WAVE wave / distortion pass -- NODEPTH skip the depth test, so the model draws over everything -- DOPPELGANGER doppelganger tint -- MULTIPLY multiply the scene by the model: by the texture's alpha where it has one, -- by its colour where it has not -- HEIGHT_CLIP drop every triangle that sits entirely below m.blendMeshTexCoordV, which -- cuts the model off at that world height -- -- Two things about how the client reads the mask: -- * BRIGHT, DARK, MULTIPLY and LIGHTMAP are alternatives. The renderer takes the -- first one it finds, in that order, and ignores the rest. -- * Any of CHROME*/METAL/OIL moves the whole draw onto the chrome path, where -- meshes flagged NoneBlendMesh are skipped entirely. -- -- Without a script the same mask comes from the XML config instead: -- -- The two paths never both run: a monster with a script is driven only by Lua. -- ============================================================================ Enums.RenderFlags = { COLOR = 0x00000001, TEXTURE = 0x00000002, CHROME = 0x00000004, METAL = 0x00000008, LIGHTMAP = 0x00000010, SHADOWMAP = 0x00000020, BRIGHT = 0x00000040, DARK = 0x00000080, EXTRA = 0x00000100, CHROME2 = 0x00000200, WAVE = 0x00000400, CHROME3 = 0x00000800, CHROME4 = 0x00001000, NODEPTH = 0x00002000, CHROME5 = 0x00004000, OIL = 0x00008000, CHROME6 = 0x00010000, CHROME7 = 0x00020000, DOPPELGANGER = 0x00040000, CHROME8 = 0x00080000, CHROME9 = 0x00100000, HEIGHT_CLIP = 0x00200000, MULTIPLY = 0x00400000, } -- ============================================================================ -- Enums.Skill - skill ids the client itself tests, as seen in m.skill -- -- The client compares the attack's skill against these before it runs an effect. These are skill -- numbers from the server's own list, not client ids, so they stay put when the client changes. -- ============================================================================ Enums.Skill = { Boss = 50, -- the client AT_SKILL_BOSS } -- ============================================================================ -- Enums.Color - named colours -- -- Values are packed RGBA (0xRRGGBBAA), the form RGBA(...) produces. That is what -- Log.AddC takes: -- Log.AddC(Enums.Color.Crimson, "monster " .. m.index .. " spawned") -- -- It is NOT the form lights take. Everything that lights something here - SetLight, -- bodyLightR/G/B, the colour arguments of SpawnSprite and SpawnEffect - wants three -- floats from 0 to 1, so run the value through Helpers.LightOf first: -- o:SetLight(Helpers.LightOf(Enums.Color.Gold)) -- ============================================================================ Enums.Color = { AliceBlue = RGBA(0xF0, 0xF8, 0xFF, 255), AntiqueWhite = RGBA(0xFA, 0xEB, 0xD7, 255), Aqua = RGBA(0x00, 0xFF, 0xFF, 255), Aquamarine = RGBA(0x7F, 0xFF, 0xD4, 255), Azure = RGBA(0xF0, 0xFF, 0xFF, 255), Beige = RGBA(0xF5, 0xF5, 0xDC, 255), Bisque = RGBA(0xFF, 0xE4, 0xC4, 255), Black = RGBA(0x00, 0x00, 0x00, 255), BlanchedAlmond = RGBA(0xFF, 0xEB, 0xCD, 255), Blue = RGBA(0x00, 0x00, 0xFF, 255), BlueViolet = RGBA(0x8A, 0x2B, 0xE2, 255), Brown = RGBA(0xA5, 0x2A, 0x2A, 255), BurlyWood = RGBA(0xDE, 0xB8, 0x87, 255), CadetBlue = RGBA(0x5F, 0x9E, 0xA0, 255), Chartreuse = RGBA(0x7F, 0xFF, 0x00, 255), Chocolate = RGBA(0xD2, 0x69, 0x1E, 255), Coral = RGBA(0xFF, 0x7F, 0x50, 255), CornflowerBlue = RGBA(0x64, 0x95, 0xED, 255), Cornsilk = RGBA(0xFF, 0xF8, 0xDC, 255), Crimson = RGBA(0xDC, 0x14, 0x3C, 255), Cyan = RGBA(0x00, 0xFF, 0xFF, 255), DarkBlue = RGBA(0x00, 0x00, 0x8B, 255), DarkCyan = RGBA(0x00, 0x8B, 0x8B, 255), DarkGoldenrod = RGBA(0xB8, 0x86, 0x0B, 255), DarkGray = RGBA(0xA9, 0xA9, 0xA9, 255), DarkGreen = RGBA(0x00, 0x64, 0x00, 255), DarkKhaki = RGBA(0xBD, 0xB7, 0x6B, 255), DarkMagenta = RGBA(0x8B, 0x00, 0x8B, 255), DarkOliveGreen = RGBA(0x55, 0x6B, 0x2F, 255), DarkOrange = RGBA(0xFF, 0x8C, 0x00, 255), DarkOrchid = RGBA(0x99, 0x32, 0xCC, 255), DarkRed = RGBA(0x8B, 0x00, 0x00, 255), DarkSalmon = RGBA(0xE9, 0x96, 0x7A, 255), DarkSeaGreen = RGBA(0x8F, 0xBC, 0x8B, 255), DarkSlateBlue = RGBA(0x48, 0x3D, 0x8B, 255), DarkSlateGray = RGBA(0x2F, 0x4F, 0x4F, 255), DarkTurquoise = RGBA(0x00, 0xCE, 0xD1, 255), DarkViolet = RGBA(0x94, 0x00, 0xD3, 255), DeepPink = RGBA(0xFF, 0x14, 0x93, 255), DeepSkyBlue = RGBA(0x00, 0xBF, 0xFF, 255), DimGray = RGBA(0x69, 0x69, 0x69, 255), DodgerBlue = RGBA(0x1E, 0x90, 0xFF, 255), Firebrick = RGBA(0xB2, 0x22, 0x22, 255), FloralWhite = RGBA(0xFF, 0xFA, 0xF0, 255), ForestGreen = RGBA(0x22, 0x8B, 0x22, 255), Fuchsia = RGBA(0xFF, 0x00, 0xFF, 255), Gainsboro = RGBA(0xDC, 0xDC, 0xDC, 255), GhostWhite = RGBA(0xF8, 0xF8, 0xFF, 255), Gold = RGBA(0xFF, 0xD7, 0x00, 255), Goldenrod = RGBA(0xDA, 0xA5, 0x20, 255), Gray = RGBA(0x80, 0x80, 0x80, 255), Green = RGBA(0x00, 0x80, 0x00, 255), GreenYellow = RGBA(0xAD, 0xFF, 0x2F, 255), Honeydew = RGBA(0xF0, 0xFF, 0xF0, 255), HotPink = RGBA(0xFF, 0x69, 0xB4, 255), IndianRed = RGBA(0xCD, 0x5C, 0x5C, 255), Indigo = RGBA(0x4B, 0x00, 0x82, 255), Ivory = RGBA(0xFF, 0xFF, 0xF0, 255), Khaki = RGBA(0xF0, 0xE6, 0x8C, 255), Lavender = RGBA(0xE6, 0xE6, 0xFA, 255), LavenderBlush = RGBA(0xFF, 0xF0, 0xF5, 255), LawnGreen = RGBA(0x7C, 0xFC, 0x00, 255), LemonChiffon = RGBA(0xFF, 0xFA, 0xCD, 255), LightBlue = RGBA(0xAD, 0xD8, 0xE6, 255), LightCoral = RGBA(0xF0, 0x80, 0x80, 255), LightCyan = RGBA(0xE0, 0xFF, 0xFF, 255), LightGoldenrodYellow = RGBA(0xFA, 0xFA, 0xD2, 255), LightGray = RGBA(0xD3, 0xD3, 0xD3, 255), LightGreen = RGBA(0x90, 0xEE, 0x90, 255), LightPink = RGBA(0xFF, 0xB6, 0xC1, 255), LightSalmon = RGBA(0xFF, 0xA0, 0x7A, 255), LightSeaGreen = RGBA(0x20, 0xB2, 0xAA, 255), LightSkyBlue = RGBA(0x87, 0xCE, 0xFA, 255), LightSlateGray = RGBA(0x77, 0x88, 0x99, 255), LightSteelBlue = RGBA(0xB0, 0xC4, 0xDE, 255), LightYellow = RGBA(0xFF, 0xFF, 0xE0, 255), Lime = RGBA(0x00, 0xFF, 0x00, 255), LimeGreen = RGBA(0x32, 0xCD, 0x32, 255), Linen = RGBA(0xFA, 0xF0, 0xE6, 255), Magenta = RGBA(0xFF, 0x00, 0xFF, 255), Maroon = RGBA(0x80, 0x00, 0x00, 255), MediumAquamarine = RGBA(0x66, 0xCD, 0xAA, 255), MediumBlue = RGBA(0x00, 0x00, 0xCD, 255), MediumOrchid = RGBA(0xBA, 0x55, 0xD3, 255), MediumPurple = RGBA(0x93, 0x70, 0xDB, 255), MediumSeaGreen = RGBA(0x3C, 0xB3, 0x71, 255), MediumSlateBlue = RGBA(0x7B, 0x68, 0xEE, 255), MediumSpringGreen = RGBA(0x00, 0xFA, 0x9A, 255), MediumTurquoise = RGBA(0x48, 0xD1, 0xCC, 255), MediumVioletRed = RGBA(0xC7, 0x15, 0x85, 255), MidnightBlue = RGBA(0x19, 0x19, 0x70, 255), MintCream = RGBA(0xF5, 0xFF, 0xFA, 255), MistyRose = RGBA(0xFF, 0xE4, 0xE1, 255), Moccasin = RGBA(0xFF, 0xE4, 0xB5, 255), NavajoWhite = RGBA(0xFF, 0xDE, 0xAD, 255), Navy = RGBA(0x00, 0x00, 0x80, 255), OldLace = RGBA(0xFD, 0xF5, 0xE6, 255), Olive = RGBA(0x80, 0x80, 0x00, 255), OliveDrab = RGBA(0x6B, 0x8E, 0x23, 255), Orange = RGBA(0xFF, 0xA5, 0x00, 255), OrangeRed = RGBA(0xFF, 0x45, 0x00, 255), Orchid = RGBA(0xDA, 0x70, 0xD6, 255), PaleGoldenrod = RGBA(0xEE, 0xE8, 0xAA, 255), PaleGreen = RGBA(0x98, 0xFB, 0x98, 255), PaleTurquoise = RGBA(0xAF, 0xEE, 0xEE, 255), PaleVioletRed = RGBA(0xDB, 0x70, 0x93, 255), PapayaWhip = RGBA(0xFF, 0xEF, 0xD5, 255), PeachPuff = RGBA(0xFF, 0xDA, 0xB9, 255), Peru = RGBA(0xCD, 0x85, 0x3F, 255), Pink = RGBA(0xFF, 0xC0, 0xCB, 255), Plum = RGBA(0xDD, 0xA0, 0xDD, 255), PowderBlue = RGBA(0xB0, 0xE0, 0xE6, 255), Purple = RGBA(0x80, 0x00, 0x80, 255), Red = RGBA(0xFF, 0x00, 0x00, 255), RosyBrown = RGBA(0xBC, 0x8F, 0x8F, 255), RoyalBlue = RGBA(0x41, 0x69, 0xE1, 255), SaddleBrown = RGBA(0x8B, 0x45, 0x13, 255), Salmon = RGBA(0xFA, 0x80, 0x72, 255), SandyBrown = RGBA(0xF4, 0xA4, 0x60, 255), SeaGreen = RGBA(0x2E, 0x8B, 0x57, 255), SeaShell = RGBA(0xFF, 0xF5, 0xEE, 255), Sienna = RGBA(0xA0, 0x52, 0x2D, 255), Silver = RGBA(0xC0, 0xC0, 0xC0, 255), SkyBlue = RGBA(0x87, 0xCE, 0xEB, 255), SlateBlue = RGBA(0x6A, 0x5A, 0xCD, 255), SlateGray = RGBA(0x70, 0x80, 0x90, 255), Snow = RGBA(0xFF, 0xFA, 0xFA, 255), SpringGreen = RGBA(0x00, 0xFF, 0x7F, 255), SteelBlue = RGBA(0x46, 0x82, 0xB4, 255), Tan = RGBA(0xD2, 0xB4, 0x8C, 255), Teal = RGBA(0x00, 0x80, 0x80, 255), Thistle = RGBA(0xD8, 0xBF, 0xD8, 255), Tomato = RGBA(0xFF, 0x63, 0x47, 255), Transparent = RGBA(0xFF, 0xFF, 0xFF, 255), Turquoise = RGBA(0x40, 0xE0, 0xD0, 255), Violet = RGBA(0xEE, 0x82, 0xEE, 255), Wheat = RGBA(0xF5, 0xDE, 0xB3, 255), White = RGBA(0xFF, 0xFF, 0xFF, 255), WhiteSmoke = RGBA(0xF5, 0xF5, 0xF5, 255), Yellow = RGBA(0xFF, 0xFF, 0x00, 255), } return Enums