diff --git a/rsc/scripts/door_utility.lua b/rsc/scripts/door_utility.lua index d1fc648..49f272d 100644 --- a/rsc/scripts/door_utility.lua +++ b/rsc/scripts/door_utility.lua @@ -1,3 +1,29 @@ +--[[ +/* Copyright: (c) Kayne Ruse 2013-2015 + * + * This software is provided 'as-is', without any express or implied + * warranty. In no event will the authors be held liable for any damages + * arising from the use of this software. + * + * Permission is granted to anyone to use this software for any purpose, + * including commercial applications, and to alter it and redistribute it + * freely, subject to the following restrictions: + * + * 1. The origin of this software must not be misrepresented; you must not + * claim that you wrote the original software. If you use this software + * in a product, an acknowledgment in the product documentation would be + * appreciated but is not required. + * + * 2. Altered source versions must be plainly marked as such, and must not be + * misrepresented as being the original software. + * + * 3. This notice may not be removed or altered from any source + * distribution. +*/ +--]] + +--DOCS: a placeholder door utility + local doorUtility = {} roomAPI = require("room") diff --git a/rsc/scripts/map_maker.lua b/rsc/scripts/map_maker.lua index d2a7f4e..596570f 100644 --- a/rsc/scripts/map_maker.lua +++ b/rsc/scripts/map_maker.lua @@ -1,3 +1,29 @@ +--[[ +/* Copyright: (c) Kayne Ruse 2013-2015 + * + * This software is provided 'as-is', without any express or implied + * warranty. In no event will the authors be held liable for any damages + * arising from the use of this software. + * + * Permission is granted to anyone to use this software for any purpose, + * including commercial applications, and to alter it and redistribute it + * freely, subject to the following restrictions: + * + * 1. The origin of this software must not be misrepresented; you must not + * claim that you wrote the original software. If you use this software + * in a product, an acknowledgment in the product documentation would be + * appreciated but is not required. + * + * 2. Altered source versions must be plainly marked as such, and must not be + * misrepresented as being the original software. + * + * 3. This notice may not be removed or altered from any source + * distribution. +*/ +--]] + +--DOCS: a placeholder map generator + local regionAPI = require("region") local mapMaker = {} diff --git a/rsc/scripts/map_saver.lua b/rsc/scripts/map_saver.lua index 2ec8832..f2f4ea0 100644 --- a/rsc/scripts/map_saver.lua +++ b/rsc/scripts/map_saver.lua @@ -1,3 +1,27 @@ +--[[ +/* Copyright: (c) Kayne Ruse 2013-2015 + * + * This software is provided 'as-is', without any express or implied + * warranty. In no event will the authors be held liable for any damages + * arising from the use of this software. + * + * Permission is granted to anyone to use this software for any purpose, + * including commercial applications, and to alter it and redistribute it + * freely, subject to the following restrictions: + * + * 1. The origin of this software must not be misrepresented; you must not + * claim that you wrote the original software. If you use this software + * in a product, an acknowledgment in the product documentation would be + * appreciated but is not required. + * + * 2. Altered source versions must be plainly marked as such, and must not be + * misrepresented as being the original software. + * + * 3. This notice may not be removed or altered from any source + * distribution. +*/ +--]] + local region = require("region") local mapSaver = {} diff --git a/rsc/scripts/setup_server.lua b/rsc/scripts/setup_server.lua index 5c55900..4cb4972 100644 --- a/rsc/scripts/setup_server.lua +++ b/rsc/scripts/setup_server.lua @@ -1,3 +1,29 @@ +--[[ +/* Copyright: (c) Kayne Ruse 2013-2015 + * + * This software is provided 'as-is', without any express or implied + * warranty. In no event will the authors be held liable for any damages + * arising from the use of this software. + * + * Permission is granted to anyone to use this software for any purpose, + * including commercial applications, and to alter it and redistribute it + * freely, subject to the following restrictions: + * + * 1. The origin of this software must not be misrepresented; you must not + * claim that you wrote the original software. If you use this software + * in a product, an acknowledgment in the product documentation would be + * appreciated but is not required. + * + * 2. Altered source versions must be plainly marked as such, and must not be + * misrepresented as being the original software. + * + * 3. This notice may not be removed or altered from any source + * distribution. +*/ +--]] + +--DOCS: This script is run by the server on startup + print("Lua script check") --requirements @@ -27,10 +53,9 @@ end) --NOTE: room 0 is the first that the client asks for, therefore it must exist local overworld, uidOne = roomManagerAPI.CreateRoom("overworld", "overworld.bmp") roomAPI.Initialize(overworld, mapSaver.Load, mapSaver.Save, mapMaker.DebugIsland, mapSaver.Save) + local underworld, uidTwo = roomManagerAPI.CreateRoom("underworld", "overworld.bmp") roomAPI.Initialize(underworld, mapSaver.Load, mapSaver.Save, mapMaker.DebugGrassland, mapSaver.Save) --call the monstrosity doorUtility.createDoorPair("pair 1", overworld, -64, -64, underworld, 64, 64) - -print("Finished the lua script") diff --git a/rsc/scripts/setup_server.sql b/rsc/scripts/setup_server.sql index e8f1ec3..1ef5983 100644 --- a/rsc/scripts/setup_server.sql +++ b/rsc/scripts/setup_server.sql @@ -1,6 +1,26 @@ ---TODO: (3) An archive table of all dead characters +/* Copyright: (c) Kayne Ruse 2013-2015 + * + * This software is provided 'as-is', without any express or implied + * warranty. In no event will the authors be held liable for any damages + * arising from the use of this software. + * + * Permission is granted to anyone to use this software for any purpose, + * including commercial applications, and to alter it and redistribute it + * freely, subject to the following restrictions: + * + * 1. The origin of this software must not be misrepresented; you must not + * claim that you wrote the original software. If you use this software + * in a product, an acknowledgment in the product documentation would be + * appreciated but is not required. + * + * 2. Altered source versions must be plainly marked as such, and must not be + * misrepresented as being the original software. + * + * 3. This notice may not be removed or altered from any source + * distribution. +*/ -CREATE TABLE IF NOT EXISTS Accounts ( +CREATE TABLE IF NOT EXISTS UserAccounts ( uid INTEGER PRIMARY KEY AUTOINCREMENT, username varchar(100) UNIQUE, --TODO: (3) Swap username for email address @@ -15,7 +35,7 @@ CREATE TABLE IF NOT EXISTS Accounts ( admin BIT DEFAULT 0 ); -CREATE TABLE IF NOT EXISTS Characters ( +CREATE TABLE IF NOT EXISTS LiveCharacters ( uid INTEGER PRIMARY KEY AUTOINCREMENT, --metadata @@ -31,16 +51,45 @@ CREATE TABLE IF NOT EXISTS Characters ( boundsX INTEGER DEFAULT 0, boundsY INTEGER DEFAULT 0, boundsW INTEGER DEFAULT 0, - boundsH INTEGER DEFAULT 0, + boundsH INTEGER DEFAULT 0 +); - --statistics - baseStats INTEGER REFERENCES StatisticSets(uid), +CREATE TABLE IF NOT EXISTS DeadCharacters ( + uid INTEGER PRIMARY KEY, - --equipment - weapon INTEGER REFERENCES WornEquipment(uid), - helmet INTEGER REFERENCES WornEquipment(uid), - armour INTEGER REFERENCES WornEquipment(uid) - --etc. + --metadata + owner INTEGER REFERENCES Accounts(uid), + handle varchar(100), + avatar varchar(100), + birth timestamp NOT NULL +); + +CREATE TABLE IF NOT EXISTS LiveMonsters ( + uid INTEGER PRIMARY KEY AUTOINCREMENT, + + --metadata + handle varchar(100) UNIQUE, + avatar varchar(100), + + --actions +-- script + + --physically exists in the world + roomIndex INTEGER DEFAULT 0, + originX INTEGER DEFAULT 0, + originY INTEGER DEFAULT 0, + boundsX INTEGER DEFAULT 0, + boundsY INTEGER DEFAULT 0, + boundsW INTEGER DEFAULT 0, + boundsH INTEGER DEFAULT 0 +); + +CREATE TABLE IF NOT EXISTS DeadMonsters ( + uid INTEGER PRIMARY KEY, + + --metadata + handle varchar(100) UNIQUE, + avatar varchar(100) ); ------------------------- diff --git a/server/accounts/account_manager.cpp b/server/accounts/account_manager.cpp index 328ca48..bf67d41 100644 --- a/server/accounts/account_manager.cpp +++ b/server/accounts/account_manager.cpp @@ -27,7 +27,7 @@ //Define the queries //------------------------- -static const char* CREATE_USER_ACCOUNT = "INSERT INTO Accounts (username) VALUES (?);"; +static const char* CREATE_USER_ACCOUNT = "INSERT INTO UserAccounts (username) VALUES (?);"; static const char* LOAD_USER_ACCOUNT = "SELECT " "uid, " @@ -35,18 +35,18 @@ static const char* LOAD_USER_ACCOUNT = "SELECT " "whitelisted, " "mod, " "admin " - " FROM Accounts WHERE username = ?;"; + " FROM UserAccounts WHERE username = ?;"; -static const char* SAVE_USER_ACCOUNT = "UPDATE OR FAIL Accounts SET " +static const char* SAVE_USER_ACCOUNT = "UPDATE OR FAIL UserAccounts SET " "blacklisted = ?2, " "whitelisted = ?3, " "mod = ?4, " "admin = ?5 " "WHERE uid = ?1;"; -static const char* DELETE_USER_ACCOUNT = "DELETE FROM Accounts WHERE uid = ?;"; +static const char* DELETE_USER_ACCOUNT = "DELETE FROM UserAccounts WHERE uid = ?;"; -static const char* COUNT_USER_ACCOUNT_RECORDS = "SELECT COUNT(*) FROM Accounts;"; +static const char* COUNT_USER_ACCOUNT_RECORDS = "SELECT COUNT(*) FROM UserAccounts;"; //------------------------- //Define the public methods diff --git a/server/characters/character_manager.cpp b/server/characters/character_manager.cpp index 9660197..0108b43 100644 --- a/server/characters/character_manager.cpp +++ b/server/characters/character_manager.cpp @@ -36,7 +36,7 @@ //NOTE: Programmer set variables are NOT zero-indexed //NOTE: SQLite3 returned variables (i.e. loading) ARE zero-indexed -static const char* CREATE_CHARACTER = "INSERT INTO Characters (" +static const char* CREATE_CHARACTER = "INSERT INTO LiveCharacters (" "owner, " "handle, " "avatar, " @@ -58,9 +58,9 @@ static const char* LOAD_CHARACTER = "SELECT " "boundsY, " "boundsW, " "boundsH " - "FROM Characters WHERE handle = ?;"; + "FROM LiveCharacters WHERE handle = ?;"; -static const char* SAVE_CHARACTER = "UPDATE OR FAIL Characters SET " +static const char* SAVE_CHARACTER = "UPDATE OR FAIL LiveCharacters SET " "roomIndex = ?2, " "originX = ?3, " "originY = ?4, " @@ -70,9 +70,9 @@ static const char* SAVE_CHARACTER = "UPDATE OR FAIL Characters SET " "boundsH = ?8 " "WHERE uid = ?1;"; -static const char* DELETE_CHARACTER = "DELETE FROM Characters WHERE uid = ?;"; +static const char* DELETE_CHARACTER = "DELETE FROM LiveCharacters WHERE uid = ?;"; -static const char* COUNT_CHARACTER_RECORDS = "SELECT COUNT(*) FROM Characters;"; +static const char* COUNT_CHARACTER_RECORDS = "SELECT COUNT(*) FROM LiveCharacters;"; //------------------------- //Define the methods diff --git a/server/entities/entity.hpp b/server/entities/entity.hpp index 623a912..e7e9250 100644 --- a/server/entities/entity.hpp +++ b/server/entities/entity.hpp @@ -46,7 +46,7 @@ public: const char* GetType() const; protected: - Entity(const char*); + Entity(const char* type); virtual ~Entity() = default; int roomIndex = -1; diff --git a/server/linit.cpp b/server/linit.cpp index c0552ea..f1c05bb 100644 --- a/server/linit.cpp +++ b/server/linit.cpp @@ -41,8 +41,8 @@ #include "character_manager_api.hpp" #include "region_api.hpp" #include "region_pager_api.hpp" -#include "monster_api.hpp" -#include "monster_manager_api.hpp" +//#include "monster_api.hpp" +//#include "monster_manager_api.hpp" #include "network_api.hpp" #include "room_api.hpp" #include "room_manager_api.hpp" @@ -70,8 +70,8 @@ static const luaL_Reg preloadedlibs[] = { {TORTUGA_ENTITY_API, openEntityAPI}, //required by derived classes {TORTUGA_CHARACTER_API, openCharacterAPI}, {TORTUGA_CHARACTER_MANAGER_API, openCharacterManagerAPI}, - {TORTUGA_MONSTER_API, openMonsterAPI}, - {TORTUGA_MONSTER_MANAGER_API, openMonsterManagerAPI}, +// {TORTUGA_MONSTER_API, openMonsterAPI}, +// {TORTUGA_MONSTER_MANAGER_API, openMonsterManagerAPI}, {TORTUGA_NETWORK_API, openNetworkAPI}, {TORTUGA_REGION_API, openRegionAPI}, {TORTUGA_REGION_PAGER_API, openRegionPagerAPI}, diff --git a/server/makefile b/server/makefile index cd4b993..2f8de96 100644 --- a/server/makefile +++ b/server/makefile @@ -1,5 +1,5 @@ #include directories -INCLUDES+=SDL . accounts characters clients entities monsters rooms server_utilities triggers ../common/debugging ../common/gameplay ../common/map ../common/network ../common/network/packet_types ../common/utilities +INCLUDES+=SDL . accounts characters clients entities rooms server_utilities triggers ../common/debugging ../common/gameplay ../common/map ../common/network ../common/network/packet_types ../common/utilities #libraries #the order of the $(LIBS) is important, at least for MinGW @@ -33,7 +33,7 @@ all: $(OBJ) $(OUT) $(MAKE) -C characters $(MAKE) -C clients $(MAKE) -C entities - $(MAKE) -C monsters +# $(MAKE) -C monsters $(MAKE) -C rooms $(MAKE) -C server_utilities $(MAKE) -C triggers diff --git a/server/monsters/monster_api.cpp b/server/monsters/monster_api.cpp index 915b0c3..c5c4d93 100644 --- a/server/monsters/monster_api.cpp +++ b/server/monsters/monster_api.cpp @@ -28,7 +28,7 @@ static int setAvatar(lua_State* L) { MonsterData* monster = static_cast(lua_touserdata(L, 1)); monster->SetAvatar(lua_tostring(L, 2)); - //TODO: send an update to the clients? + //TODO: (1) send an update to the clients? return 0; } diff --git a/server/monsters/monster_data.cpp b/server/monsters/monster_data.cpp index 8a29f12..d2d6abf 100644 --- a/server/monsters/monster_data.cpp +++ b/server/monsters/monster_data.cpp @@ -21,10 +21,23 @@ */ #include "monster_data.hpp" -MonsterData::MonsterData(): Entity("monster") { +MonsterData::MonsterData(std::string _avatar, int _scriptRef): + Entity("monster"), + avatar(_avatar), + scriptRef(_scriptRef) +{ //EMPTY } +void MonsterData::Update() { + Entity::Update(); + //TODO: (0) call the script reference +} + +//------------------------- +//accessors & mutators +//------------------------- + std::string MonsterData::SetAvatar(std::string s) { return avatar = s; } diff --git a/server/monsters/monster_data.hpp b/server/monsters/monster_data.hpp index 44a5300..45fb3dd 100644 --- a/server/monsters/monster_data.hpp +++ b/server/monsters/monster_data.hpp @@ -28,11 +28,22 @@ #include +/* DOCS: Monster attributes, read more + * species (avatar, script) + * level + * health/mana + * permadeath/respawn +*/ + class MonsterData: public Entity { public: - MonsterData(); + MonsterData(std::string avatar, int scriptRef); ~MonsterData() = default; + virtual void Update(); + + //accessors & mutators + std::string SetAvatar(std::string); std::string GetAvatar(); diff --git a/server/monsters/monster_manager.cpp b/server/monsters/monster_manager.cpp index cd54bc1..7f9a11a 100644 --- a/server/monsters/monster_manager.cpp +++ b/server/monsters/monster_manager.cpp @@ -29,46 +29,66 @@ MonsterManager::~MonsterManager() { UnloadAll(); } -int MonsterManager::Create(std::string) { - //TODO: (9) MonsterManager::Create() +int MonsterManager::Create(std::string avatar, int scriptRef) { + //implicitly create the new + elementMap.emplace(counter, MonsterData(avatar, scriptRef)); + + //TODO: do various things like saving to the database + return counter++; } +//TODO: (1) monster load, save + void MonsterManager::Unload(int uid) { - //TODO: (9) MonsterManager::Unload() + elementMap.erase(uid); } void MonsterManager::UnloadAll() { - //TODO: (9) MonsterManager::UnloadAll() + elementMap.clear(); } void MonsterManager::UnloadIf(std::function)> fn) { - //TODO: (9) MonsterManager::UnloadIf() + std::map::iterator it = elementMap.begin(); + while (it != elementMap.end()) { + if (fn(*it)) { + it = elementMap.erase(it); + } + else { + ++it; + } + } } MonsterData* MonsterManager::Get(int uid) { - //TODO: (9) MonsterManager::Get() + std::map::iterator it = elementMap.find(uid); + + if (it == elementMap.end()) { + return nullptr; + } + + return &it->second; } int MonsterManager::GetLoadedCount() { - //TODO: (9) MonsterManager::GetLoadedCount() + return elementMap.size(); } std::map* MonsterManager::GetContainer() { - //TODO: (9) MonsterManager::GetContainer() + return &elementMap; } lua_State* MonsterManager::SetLuaState(lua_State* L) { - //TODO: (9) MonsterManager::SetLuaState() + return lua = L; } lua_State* MonsterManager::GetLuaState() { - //TODO: (9) MonsterManager::GetLuaState() + return lua; } sqlite3* MonsterManager::SetDatabase(sqlite3* db) { - //TODO: (9) MonsterManager::SetDatabase() + return database = db; } sqlite3* MonsterManager::GetDatabase() { - //TODO: (9) MonsterManager::GetDatabase() + return database; } diff --git a/server/monsters/monster_manager.hpp b/server/monsters/monster_manager.hpp index 5d74e4c..7ab1dfd 100644 --- a/server/monsters/monster_manager.hpp +++ b/server/monsters/monster_manager.hpp @@ -37,7 +37,7 @@ public: ~MonsterManager(); //common public methods - int Create(std::string); + int Create(std::string avatar, int scriptRef); void Unload(int uid); void UnloadAll(); @@ -57,6 +57,7 @@ public: private: //members std::map elementMap; + int counter = 0; lua_State* lua = nullptr; sqlite3* database = nullptr; }; diff --git a/server/monsters/monster_manager_api.cpp b/server/monsters/monster_manager_api.cpp index 6fc6a81..08be549 100644 --- a/server/monsters/monster_manager_api.cpp +++ b/server/monsters/monster_manager_api.cpp @@ -23,7 +23,54 @@ #include "monster_manager.hpp" +static int create(lua_State* L) { + MonsterManager* mgr = static_cast(lua_touserdata(L, 1)); + int index = mgr->Create(lua_tostring(L, 2), lua_tointeger(L, 3)); + MonsterData* monster = mgr->Get(index); + lua_pushlightuserdata(L, static_cast(monster)); + lua_pushinteger(L, index); + return 2; +} + +//TOOD: this needs to take the userdata as a parameter too +static int unload(lua_State* L) { + MonsterManager* mgr = static_cast(lua_touserdata(L, 1)); + mgr->Unload(lua_tointeger(L, 2)); + return 0; +} + +static int unloadAll(lua_State* L) { + MonsterManager* mgr = static_cast(lua_touserdata(L, 1)); + mgr->UnloadAll(); + return 0; +} + +static int unloadIf(lua_State* L) { + MonsterManager* mgr = static_cast(lua_touserdata(L, 1)); + //TODO: unloadIf + return 0; +} + +static int get(lua_State* L) { + MonsterManager* mgr = static_cast(lua_touserdata(L, 1)); + MonsterData* monster = mgr->Get(lua_tointeger(L, 2)); + lua_pushlightuserdata(L, static_cast(monster)); + return 1; +} + +static int getLoadedCount(lua_State* L) { + MonsterManager* mgr = static_cast(lua_touserdata(L, 1)); + lua_pushinteger(L, mgr->GetLoadedCount()); + return 1; +} + static const luaL_Reg monsterManagerLib[] = { + {"Create", create}, + {"Unload", unload}, + {"UnloadAll", unloadAll}, +// {"UnloadIf", unloadIf}, + {"Get", get}, + {"GetLoadedCount", getLoadedCount}, {nullptr, nullptr} }; diff --git a/server/rooms/room_api.cpp b/server/rooms/room_api.cpp index a04b558..9aad030 100644 --- a/server/rooms/room_api.cpp +++ b/server/rooms/room_api.cpp @@ -56,11 +56,13 @@ static int getPager(lua_State* L) { return 1; } +/* static int getMonsterMgr(lua_State* L) { RoomData* room = reinterpret_cast(lua_touserdata(L, 1)); lua_pushlightuserdata(L, reinterpret_cast(room->GetMonsterMgr()) ); return 1; } +*/ static int getTriggerMgr(lua_State* L) { RoomData* room = reinterpret_cast(lua_touserdata(L, 1)); @@ -68,8 +70,6 @@ static int getTriggerMgr(lua_State* L) { return 1; } -//TODO: character list - static int forEachCharacter(lua_State* L) { RoomData* room = reinterpret_cast(lua_touserdata(L, 1)); //pass each character to the given function @@ -87,6 +87,26 @@ static int forEachCharacter(lua_State* L) { return 0; } +/* +static int forEachMonster(lua_State* L) { + RoomData* room = reinterpret_cast(lua_touserdata(L, 1)); + MonsterManager* monsterMgr = room->GetMonsterMgr(); + //pass each monster to the given function + for (auto& it : *monsterMgr->GetContainer()) { + lua_pushvalue(L, -1); + lua_pushlightuserdata(L, static_cast(&it.second)); + //call each iteration, throwing an exception if something happened + if (lua_pcall(L, 1, 0, 0) != LUA_OK) { + std::ostringstream os; + os << "Lua error: "; + os << lua_tostring(L, -1); + throw(std::runtime_error(os.str())); + } + } + return 0; +} +*/ + static int setOnTick(lua_State* L) { RoomData* room = reinterpret_cast(lua_touserdata(L, 1)); luaL_unref(L, LUA_REGISTRYINDEX, room->GetTickReference()); @@ -120,10 +140,11 @@ static const luaL_Reg roomLib[] = { {"GetTileset", getTilesetName}, {"GetPager",getPager}, - {"GetMonsterMgr",getMonsterMgr}, +// {"GetMonsterMgr",getMonsterMgr}, {"GetTriggerMgr",getTriggerMgr}, {"ForEachCharacter", forEachCharacter}, +// {"ForEachMonster", forEachMonster}, {"SetOnTick", setOnTick}, {"GetOnTick", getOnTick}, diff --git a/server/rooms/room_data.cpp b/server/rooms/room_data.cpp index dcb544c..cb6e8e0 100644 --- a/server/rooms/room_data.cpp +++ b/server/rooms/room_data.cpp @@ -122,10 +122,6 @@ RegionPagerLua* RoomData::GetPager() { return &pager; } -MonsterManager* RoomData::GetMonsterMgr() { - return &monsterMgr; -} - TriggerManager* RoomData::GetTriggerMgr() { return &triggerMgr; } @@ -137,7 +133,6 @@ std::list* RoomData::GetCharacterList() { lua_State* RoomData::SetLuaState(lua_State* L) { lua = L; pager.SetLuaState(lua); - monsterMgr.SetLuaState(lua); triggerMgr.SetLuaState(lua); return lua; } @@ -148,7 +143,6 @@ lua_State* RoomData::GetLuaState() { sqlite3* RoomData::SetDatabase(sqlite3* db) { database = db; - monsterMgr.SetDatabase(database); return database; } diff --git a/server/rooms/room_data.hpp b/server/rooms/room_data.hpp index dabe81d..ac4331f 100644 --- a/server/rooms/room_data.hpp +++ b/server/rooms/room_data.hpp @@ -23,11 +23,11 @@ #define ROOMDATA_HPP_ #include "character_data.hpp" -#include "monster_manager.hpp" #include "region_pager_lua.hpp" #include "trigger_manager.hpp" #include "lua.hpp" +#include "sqlite3.h" #include #include @@ -47,7 +47,6 @@ public: std::string GetTileset(); RegionPagerLua* GetPager(); - MonsterManager* GetMonsterMgr(); TriggerManager* GetTriggerMgr(); std::list* GetCharacterList(); @@ -69,7 +68,6 @@ private: //members RegionPagerLua pager; - MonsterManager monsterMgr; TriggerManager triggerMgr; std::list characterList; diff --git a/server/server_application.hpp b/server/server_application.hpp index 3ba2b39..b3effbf 100644 --- a/server/server_application.hpp +++ b/server/server_application.hpp @@ -26,7 +26,6 @@ #include "account_manager.hpp" #include "character_manager.hpp" #include "client_manager.hpp" -#include "monster_manager.hpp" #include "room_manager.hpp" //utilities @@ -105,9 +104,6 @@ private: void hCharacterAttack(CharacterPacket* const); void hCharacterDamage(CharacterPacket* const); - //character management - void hMonsterDamage(MonsterPacket* const); - //chat void hTextBroadcast(TextPacket* const); void hTextSpeech(TextPacket* const); diff --git a/server/server_logic.cpp b/server/server_logic.cpp index d0a4283..ed31f6f 100644 --- a/server/server_logic.cpp +++ b/server/server_logic.cpp @@ -327,11 +327,6 @@ void ServerApplication::HandlePacket(SerialPacket* const argPacket) { hCharacterDamage(static_cast(argPacket)); break; - //monster management - case SerialPacketType::MONSTER_DAMAGE: - hMonsterDamage(static_cast(argPacket)); - break; - //chat case SerialPacketType::TEXT_BROADCAST: hTextBroadcast(static_cast(argPacket)); diff --git a/server/server_monster_methods.cpp b/server/server_monster_methods.cpp deleted file mode 100644 index 662c255..0000000 --- a/server/server_monster_methods.cpp +++ /dev/null @@ -1,26 +0,0 @@ -/* Copyright: (c) Kayne Ruse 2013-2015 - * - * This software is provided 'as-is', without any express or implied - * warranty. In no event will the authors be held liable for any damages - * arising from the use of this software. - * - * Permission is granted to anyone to use this software for any purpose, - * including commercial applications, and to alter it and redistribute it - * freely, subject to the following restrictions: - * - * 1. The origin of this software must not be misrepresented; you must not - * claim that you wrote the original software. If you use this software - * in a product, an acknowledgment in the product documentation would be - * appreciated but is not required. - * - * 2. Altered source versions must be plainly marked as such, and must not be - * misrepresented as being the original software. - * - * 3. This notice may not be removed or altered from any source - * distribution. -*/ -#include "server_application.hpp" - -void ServerApplication::hMonsterDamage(MonsterPacket* const argPacket) { - //TODO: (9) ServerApplication::hMonsterDamage() -} \ No newline at end of file diff --git a/server/network_api.cpp b/server/server_utilities/network_api.cpp similarity index 93% rename from server/network_api.cpp rename to server/server_utilities/network_api.cpp index 2028125..c1fe6ac 100644 --- a/server/network_api.cpp +++ b/server/server_utilities/network_api.cpp @@ -64,8 +64,13 @@ static int pumpCharacterUpdate(lua_State* L) { return 1; } +static int pumpMonsterUpdate(lua_State* L) { + //TODO: (0) send the info about a specific monster instance +} + static const luaL_Reg networkLib[] = { {"PumpCharacterUpdate", pumpCharacterUpdate}, + {"PumpMonsterUpdate", pumpMonsterUpdate}, {nullptr, nullptr} }; diff --git a/server/network_api.hpp b/server/server_utilities/network_api.hpp similarity index 100% rename from server/network_api.hpp rename to server/server_utilities/network_api.hpp