Skip to content

Commit

Permalink
Move data storage to WorldObject and add to Map
Browse files Browse the repository at this point in the history
  • Loading branch information
Foereaper committed Jan 14, 2024
1 parent a6595d2 commit bbf3e41
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 7 deletions.
7 changes: 7 additions & 0 deletions TrinityCore/MapMethods.h
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
#define MAPMETHODS_H

#include "ElunaInstanceAI.h"
#include "LuaValue.h"

/***
* A game map, e.g. Azeroth, Eastern Kingdoms, the Molten Core, etc.
Expand Down Expand Up @@ -335,6 +336,11 @@ namespace LuaMap
lua_settop(E->L, tbl);
return 1;
}

int Data(Eluna* E, Map* map)
{
return LuaVal::PushLuaVal(E->L, map->lua_data);
}

ElunaRegister<Map> MapMethods[] =
{
Expand Down Expand Up @@ -363,6 +369,7 @@ namespace LuaMap

// Other
{ "SaveInstanceData", &LuaMap::SaveInstanceData },
{ "Data", &LuaMap::Data },

{ NULL, NULL }
};
Expand Down
7 changes: 0 additions & 7 deletions TrinityCore/PlayerMethods.h
Original file line number Diff line number Diff line change
Expand Up @@ -3813,11 +3813,6 @@ namespace LuaPlayer
player->RemovePet(player->GetPet(), (PetSaveMode)mode, returnreagent);
return 0;
}

int Data(Eluna* E, Player* player)
{
return LuaVal::PushLuaVal(E->L, player->lua_data);
}

ElunaRegister<Player> PlayerMethods[] =
{
Expand Down Expand Up @@ -4099,8 +4094,6 @@ namespace LuaPlayer
{ "SendCinematicStart", &LuaPlayer::SendCinematicStart },
{ "SendMovieStart", &LuaPlayer::SendMovieStart },

{ "Data", &LuaPlayer::Data },

// Not implemented methods
{ "GetHonorStoredKills", nullptr }, // classic only
{ "GetRankPoints", nullptr }, // classic only
Expand Down
8 changes: 8 additions & 0 deletions TrinityCore/WorldObjectMethods.h
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@
#ifndef WORLDOBJECTMETHODS_H
#define WORLDOBJECTMETHODS_H

#include "LuaValue.h"

/***
* Inherits all methods from: [Object]
*/
Expand Down Expand Up @@ -1121,6 +1123,11 @@ namespace LuaWorldObject

return 0;
}

int Data(Eluna* E, WorldObject* obj)
{
return LuaVal::PushLuaVal(E->L, obj->lua_data);
}

ElunaRegister<WorldObject> WorldObjectMethods[] =
{
Expand Down Expand Up @@ -1176,6 +1183,7 @@ namespace LuaWorldObject
{ "PlayMusic", &LuaWorldObject::PlayMusic },
{ "PlayDirectSound", &LuaWorldObject::PlayDirectSound },
{ "PlayDistanceSound", &LuaWorldObject::PlayDistanceSound },
{ "Data", &LuaWorldObject::Data },

{ NULL, NULL }
};
Expand Down

0 comments on commit bbf3e41

Please sign in to comment.