@@ -366,7 +366,7 @@ namespace LuaGlobalFunctions
366366#endif
367367 return 1 ;
368368 }
369- # if ELUNA_EXPANSION < EXP_RETAIL
369+
370370 /* *
371371 * Builds a [GameObject]'s GUID.
372372 *
@@ -382,7 +382,11 @@ namespace LuaGlobalFunctions
382382 {
383383 uint32 lowguid = E->CHECKVAL <uint32>(1 );
384384 uint32 entry = E->CHECKVAL <uint32>(2 );
385+ #if ELUNA_EXPANSION < EXP_RETAIL
385386 E->Push (MAKE_NEW_GUID (lowguid, entry, HIGHGUID_GAMEOBJECT));
387+ #else
388+ E->Push (ObjectGuid::Create<HighGuid::GameObject>(E->GetBoundMapId (), entry, lowguid));
389+ #endif
386390 return 1 ;
387391 }
388392
@@ -401,10 +405,13 @@ namespace LuaGlobalFunctions
401405 {
402406 uint32 lowguid = E->CHECKVAL <uint32>(1 );
403407 uint32 entry = E->CHECKVAL <uint32>(2 );
408+ #if ELUNA_EXPANSION < EXP_RETAIL
404409 E->Push (MAKE_NEW_GUID (lowguid, entry, HIGHGUID_UNIT));
410+ #else
411+ E->Push (ObjectGuid::Create<HighGuid::Creature>(E->GetBoundMapId (), entry, lowguid));
412+ #endif
405413 return 1 ;
406414 }
407- #endif
408415
409416 /* *
410417 * Returns the low GUID from a GUID.
@@ -1756,7 +1763,6 @@ namespace LuaGlobalFunctions
17561763 return 0 ;
17571764 }
17581765
1759- #if ELUNA_EXPANSION < EXP_RETAIL
17601766 /* *
17611767 * Performs an in-game spawn and returns the [Creature] or [GameObject] spawned.
17621768 *
@@ -1785,13 +1791,15 @@ namespace LuaGlobalFunctions
17851791 float o = E->CHECKVAL <float >(8 );
17861792 bool save = E->CHECKVAL <bool >(9 , false );
17871793 uint32 durorresptime = E->CHECKVAL <uint32>(10 , 0 );
1794+ #if ELUNA_EXPANSION < EXP_RETAIL
17881795 uint32 phase = E->CHECKVAL <uint32>(11 , PHASEMASK_NORMAL);
17891796
17901797 if (!phase)
17911798 {
17921799 E->Push ();
17931800 return 1 ;
17941801 }
1802+ #endif
17951803
17961804 Map* map = eMapMgr->FindMap (mapID, instanceID);
17971805 if (!map)
@@ -1807,14 +1815,21 @@ namespace LuaGlobalFunctions
18071815 if (save)
18081816 {
18091817 Creature* creature = new Creature ();
1818+ #if ELUNA_EXPANSION < EXP_RETAIL
18101819 if (!creature->Create (map->GenerateLowGuid <HighGuid::Unit>(), map, phase, entry, pos))
1820+ #else
1821+ if (!creature->CreateCreature (entry, map, pos))
1822+ #endif
18111823 {
18121824 delete creature;
18131825 E->Push ();
18141826 return 1 ;
18151827 }
1816-
1828+ # if ELUNA_EXPANSION < EXP_RETAIL
18171829 creature->SaveToDB (map->GetId (), (1 << map->GetSpawnMode ()), phase);
1830+ #else
1831+ creature->SaveToDB ();
1832+ #endif
18181833
18191834 uint32 db_guid = creature->GetSpawnId ();
18201835
@@ -1830,13 +1845,20 @@ namespace LuaGlobalFunctions
18301845 E->Push ();
18311846 return 1 ;
18321847 }
1833-
1848+ # if ELUNA_EXPANSION < EXP_RETAIL
18341849 eObjectMgr->AddCreatureToGrid (db_guid, eObjectMgr->GetCreatureData (db_guid));
1850+ #else
1851+ eObjectMgr->AddCreatureToGrid (eObjectMgr->GetCreatureData (db_guid));
1852+ #endif
18351853 E->Push (creature);
18361854 }
18371855 else
18381856 {
1857+ #if ELUNA_EXPANSION < EXP_RETAIL
18391858 TempSummon* creature = map->SummonCreature (entry, pos, NULL , durorresptime);
1859+ #else
1860+ TempSummon* creature = map->SummonCreature (entry, pos, NULL , Milliseconds (durorresptime));
1861+ #endif
18401862 if (!creature)
18411863 {
18421864 E->Push ();
@@ -1873,7 +1895,11 @@ namespace LuaGlobalFunctions
18731895 uint32 guidLow = map->GenerateLowGuid <HighGuid::GameObject>();
18741896 QuaternionData rot = QuaternionData::fromEulerAnglesZYX (o, 0 .f , 0 .f );
18751897
1898+ #if ELUNA_EXPANSION < EXP_RETAIL
18761899 if (!object->Create (guidLow, objectInfo->entry , map, phase, Position (x, y, z, o), rot, 0 , GO_STATE_READY))
1900+ #else
1901+ if (!object->CreateGameObject (objectInfo->entry , map, Position (x, y, z, o), rot, 0 , GO_STATE_READY))
1902+ #endif
18771903 {
18781904 delete object;
18791905 E->Push ();
@@ -1886,7 +1912,11 @@ namespace LuaGlobalFunctions
18861912 if (save)
18871913 {
18881914 // fill the gameobject data and save to the db
1915+ #if ELUNA_EXPANSION < EXP_RETAIL
18891916 object->SaveToDB (map->GetId (), (1 << map->GetSpawnMode ()), phase);
1917+ #else
1918+ object->SaveToDB ();
1919+ #endif
18901920 guidLow = object->GetSpawnId ();
18911921
18921922 // delete the old object and do a clean load from DB with a fresh new GameObject instance.
@@ -1901,7 +1931,11 @@ namespace LuaGlobalFunctions
19011931 E->Push ();
19021932 return 1 ;
19031933 }
1934+ #if ELUNA_EXPANSION < EXP_RETAIL
19041935 eObjectMgr->AddGameobjectToGrid (guidLow, eObjectMgr->GetGameObjectData (guidLow));
1936+ #else
1937+ eObjectMgr->AddGameobjectToGrid (eObjectMgr->GetGameObjectData (guidLow));
1938+ #endif
19051939 }
19061940 else
19071941 map->AddToMap (object);
@@ -1912,7 +1946,6 @@ namespace LuaGlobalFunctions
19121946 E->Push ();
19131947 return 1 ;
19141948 }
1915- #endif
19161949
19171950 /* *
19181951 * Creates a [WorldPacket].
@@ -2120,7 +2153,6 @@ namespace LuaGlobalFunctions
21202153 return 0 ;
21212154 }
21222155
2123- #if ELUNA_EXPANSION < EXP_RETAIL
21242156 /* *
21252157 * Sends mail to a [Player].
21262158 *
@@ -2193,7 +2225,11 @@ namespace LuaGlobalFunctions
21932225 luaL_error (E->L , " Item entry %d has invalid amount %d" , entry, amount);
21942226 continue ;
21952227 }
2228+ #if ELUNA_EXPANSION < EXP_RETAIL
21962229 if (Item* item = Item::CreateItem (entry, amount))
2230+ #else
2231+ if (Item* item = Item::CreateItem (entry, amount, ItemContext::NONE))
2232+ #endif
21972233 {
21982234 item->SaveToDB (trans);
21992235 draft.AddItem (item);
@@ -2212,7 +2248,6 @@ namespace LuaGlobalFunctions
22122248
22132249 return addedItems;
22142250 }
2215- #endif
22162251
22172252 /* *
22182253 * Performs a bitwise AND (a & b).
@@ -2302,7 +2337,6 @@ namespace LuaGlobalFunctions
23022337 return 1 ;
23032338 }
23042339
2305- #if ELUNA_EXPANSION < EXP_RETAIL
23062340 /* *
23072341 * Adds a taxi path to a specified map, returns the used pathId.
23082342 *
@@ -2421,7 +2455,9 @@ namespace LuaGlobalFunctions
24212455 }
24222456 if (startNode >= nodeId)
24232457 return 1 ;
2458+ #if ELUNA_EXPANSION < EXP_RETAIL
24242459 sTaxiPathSetBySource [startNode][nodeId - 1 ] = TaxiPathBySourceAndDestination (pathId, price);
2460+ #endif
24252461 TaxiPathEntry* pathEntry = new TaxiPathEntry ();
24262462
24272463 pathEntry->FromTaxiNode = startNode;
@@ -2434,7 +2470,6 @@ namespace LuaGlobalFunctions
24342470 E->Push (pathId);
24352471 return 1 ;
24362472 }
2437- #endif
24382473 /* *
24392474 * Returns `true` if Eluna is in compatibility mode, `false` if in multistate.
24402475 *
@@ -3312,17 +3347,12 @@ namespace LuaGlobalFunctions
33123347 { " GetPlayerCount" , &LuaGlobalFunctions::GetPlayerCount },
33133348 { " GetPlayerGUID" , &LuaGlobalFunctions::GetPlayerGUID },
33143349 { " GetItemGUID" , &LuaGlobalFunctions::GetItemGUID },
3350+ { " GetObjectGUID" , &LuaGlobalFunctions::GetObjectGUID },
3351+ { " GetUnitGUID" , &LuaGlobalFunctions::GetUnitGUID },
33153352 { " GetGUIDLow" , &LuaGlobalFunctions::GetGUIDLow },
33163353 { " GetGUIDType" , &LuaGlobalFunctions::GetGUIDType },
33173354 { " GetGUIDEntry" , &LuaGlobalFunctions::GetGUIDEntry },
33183355 { " GetAreaName" , &LuaGlobalFunctions::GetAreaName },
3319- #if ELUNA_EXPANSION < EXP_RETAIL
3320- { " GetObjectGUID" , &LuaGlobalFunctions::GetObjectGUID },
3321- { " GetUnitGUID" , &LuaGlobalFunctions::GetUnitGUID },
3322- #else
3323- { " GetObjectGUID" , METHOD_REG_NONE },
3324- { " GetUnitGUID" , METHOD_REG_NONE },
3325- #endif
33263356 { " bit_not" , &LuaGlobalFunctions::bit_not },
33273357 { " bit_xor" , &LuaGlobalFunctions::bit_xor },
33283358 { " bit_rshift" , &LuaGlobalFunctions::bit_rshift },
@@ -3371,22 +3401,16 @@ namespace LuaGlobalFunctions
33713401 { " CreateLuaEvent" , &LuaGlobalFunctions::CreateLuaEvent },
33723402 { " RemoveEventById" , &LuaGlobalFunctions::RemoveEventById },
33733403 { " RemoveEvents" , &LuaGlobalFunctions::RemoveEvents },
3374- { " CreatePacket" , &LuaGlobalFunctions::CreatePacket },
3375- #if ELUNA_EXPANSION < EXP_RETAIL
33763404 { " PerformIngameSpawn" , &LuaGlobalFunctions::PerformIngameSpawn },
3377- { " SendMail" , &LuaGlobalFunctions::SendMail },
3378- { " AddTaxiPath" , &LuaGlobalFunctions::AddTaxiPath },
3379- #else
3380- { " PerformIngameSpawn" , METHOD_REG_NONE },
3381- { " SendMail" , METHOD_REG_NONE },
3382- { " AddTaxiPath" , METHOD_REG_NONE },
3383- #endif
3405+ { " CreatePacket" , &LuaGlobalFunctions::CreatePacket },
33843406 { " AddVendorItem" , &LuaGlobalFunctions::AddVendorItem },
33853407 { " VendorRemoveItem" , &LuaGlobalFunctions::VendorRemoveItem },
33863408 { " VendorRemoveAllItems" , &LuaGlobalFunctions::VendorRemoveAllItems },
33873409 { " Kick" , &LuaGlobalFunctions::Kick },
33883410 { " Ban" , &LuaGlobalFunctions::Ban },
33893411 { " SaveAllPlayers" , &LuaGlobalFunctions::SaveAllPlayers },
3412+ { " SendMail" , &LuaGlobalFunctions::SendMail },
3413+ { " AddTaxiPath" , &LuaGlobalFunctions::AddTaxiPath },
33903414 { " CreateInt64" , &LuaGlobalFunctions::CreateLongLong },
33913415 { " CreateUint64" , &LuaGlobalFunctions::CreateULongLong },
33923416 { " StartGameEvent" , &LuaGlobalFunctions::StartGameEvent },
0 commit comments