Browse Source

added /gm luadebug on/off for persisting cross zone luadebug

Fix #135
Image 4 years ago
parent
commit
0dfce44b5a

+ 23 - 0
EQ2/source/WorldServer/Commands/Commands.cpp

@@ -2890,6 +2890,29 @@ void Commands::Process(int32 index, EQ2_16BitString* command_parms, Client* clie
 					else
 						client->SimpleMessage(CHANNEL_COLOR_YELLOW, "GM Vision Disabled!");
 				}
+				else if (strcmp(sep->arg[0], "luadebug") == 0)
+				{
+					client->SetLuaDebugClient(onOff);
+#if defined(__GNUC__)
+					database.insertCharacterProperty(client, CHAR_PROPERTY_LUADEBUG, (onOff) ? (char*)"1" : (char*)"0");
+#else
+					database.insertCharacterProperty(client, CHAR_PROPERTY_LUADEBUG, (onOff) ? "1" : "0");
+#endif
+
+					if (onOff)
+					{
+						if (lua_interface)
+							lua_interface->UpdateDebugClients(client);
+
+						client->SimpleMessage(CHANNEL_COLOR_YELLOW, "You will now receive LUA error messages.");
+					}
+					else
+					{
+						if (lua_interface)
+							lua_interface->RemoveDebugClients(client);
+						client->SimpleMessage(CHANNEL_COLOR_YELLOW, "You will no longer receive LUA error messages.");
+					}
+				}
 			}
 			break;
 		}

+ 12 - 0
EQ2/source/WorldServer/WorldDatabase.cpp

@@ -1705,6 +1705,18 @@ bool WorldDatabase::loadCharacterProperties(Client* client) {
 			if (val)
 				client->SimpleMessage(CHANNEL_COLOR_YELLOW, "GM Vision Enabled!");
 		}
+		else if (!stricmp(prop_name, CHAR_PROPERTY_LUADEBUG))
+		{
+			int8 val = atoi(prop_value);
+			if (val)
+			{
+				client->SetLuaDebugClient(true);
+				if (lua_interface)
+					lua_interface->UpdateDebugClients(client);
+
+				client->SimpleMessage(CHANNEL_COLOR_YELLOW, "You will now receive LUA error messages.");
+			}
+		}
 	}
 
 	return true;

+ 1 - 0
EQ2/source/WorldServer/WorldDatabase.h

@@ -105,6 +105,7 @@ using namespace std;
 #define CHAR_PROPERTY_FLYMODE		"modify_flymode"
 #define CHAR_PROPERTY_INVUL			"modify_invul"
 #define CHAR_PROPERTY_GMVISION		"modify_gmvision"
+#define CHAR_PROPERTY_LUADEBUG		"modify_luadebug"
 
 
 struct StartingItem{

+ 4 - 1
EQ2/source/WorldServer/client.cpp

@@ -936,8 +936,11 @@ bool Client::HandlePacket(EQApplicationPacket* app) {
 	case OP_SysClient: {
 		LogWrite(OPCODE__DEBUG, 1, "Opcode", "Opcode 0x%X (%i): OP_SysClient", opcode, opcode);
 		LogWrite(CCLIENT__DEBUG, 0, "Client", "Client '%s' (%u) is ready for spawn updates.", GetPlayer()->GetName(), GetPlayer()->GetCharacterID());
+
+		if (!ready_for_updates)
+			database.loadCharacterProperties(this);
+
 		ready_for_updates = true;
-		database.loadCharacterProperties(this);
 		break;
 	}
 	case OP_MapRequest: {