Browse Source

command changes

GM vision support
reverted spawn move command changes since that broke it!  Basis of GM command added
Image 3 years ago
parent
commit
b3534cc556

+ 44 - 7
EQ2/source/WorldServer/Commands/Commands.cpp

@@ -1533,8 +1533,10 @@ void Commands::Process(int32 index, EQ2_16BitString* command_parms, Client* clie
 			}
 			break;
 									 }
-		case COMMAND_SPAWN_MOVE:{
-			if(cmdTarget && cmdTarget->IsPlayer() == false){
+		case COMMAND_SPAWN_MOVE: {
+			if (cmdTarget && cmdTarget->IsPlayer() == false) {
+				PacketStruct* packet = configReader.getStruct("WS_MoveObjectMode", client->GetVersion());
+				if (packet) {
 					float unknown2_3 = 0;
 					int8 placement_mode = 0;
 					client->SetSpawnPlacementMode(Client::ServerSpawnPlacementMode::DEFAULT);
@@ -1559,6 +1561,7 @@ void Commands::Process(int32 index, EQ2_16BitString* command_parms, Client* clie
 						{
 							if (cmdTarget->GetSpawnLocationPlacementID() < 1) {
 								client->Message(CHANNEL_COLOR_YELLOW, "[PlacementMode] Spawn %s cannot be moved it is not assigned a spawn location placement id.", cmdTarget->GetName());
+								safe_delete(packet);
 								break;
 							}
 
@@ -1569,19 +1572,30 @@ void Commands::Process(int32 index, EQ2_16BitString* command_parms, Client* clie
 
 							if (database.UpdateSpawnLocationSpawns(cmdTarget))
 								client->Message(CHANNEL_COLOR_YELLOW, "[PlacementMode] Spawn %s placed at your location.  Updated spawn_location_placement for spawn.", cmdTarget->GetName());
+							safe_delete(packet);
 							break;
 						}
-
-
-						client->SendMoveObjectMode(cmdTarget, placement_mode, unknown2_3);
 					}
+					packet->setDataByName("placement_mode", placement_mode);
+					packet->setDataByName("spawn_id", client->GetPlayer()->GetIDWithPlayerSpawn(cmdTarget));
+					packet->setDataByName("model_type", cmdTarget->GetModelType());
+					packet->setDataByName("unknown", 1); //size
+					packet->setDataByName("unknown2", 1); //size 2
+					packet->setDataByName("unknown2", .5, 1); //size 3
+					packet->setDataByName("unknown2", 3, 2);
+					packet->setDataByName("unknown2", unknown2_3, 3);
+					packet->setDataByName("max_distance", 500);
+					packet->setDataByName("CoEunknown", 0xFFFFFFFF);
+					client->QueuePacket(packet->serialize());
+					safe_delete(packet);
+				}
 			}
-			else{
+			else {
 				client->SimpleMessage(CHANNEL_COLOR_YELLOW, "Usage: /spawn move (wall OR ceiling)");
 				client->SimpleMessage(CHANNEL_COLOR_YELLOW, "Moves a spawn anywhere you like.  Optionally wall/ceiling can be provided to place wall/ceiling items.");
 			}
 			break;
-								}
+		}
 		case COMMAND_HAIL:{
 			Spawn* spawn = cmdTarget;
 			if(spawn && spawn->GetTargetable())
@@ -2761,6 +2775,29 @@ void Commands::Process(int32 index, EQ2_16BitString* command_parms, Client* clie
 			}
 			break;
 		}
+		case COMMAND_GM:
+		{
+			if (sep->arg[0] && sep->arg[1])
+			{
+				bool onOff = (strcmp(sep->arg[1], "on") == 0);
+				if (strcmp(sep->arg[0], "vision") == 0)
+				{
+					client->GetPlayer()->SetGMVision(onOff);
+					#if defined(__GNUC__)
+						database.insertCharacterProperty(client, CHAR_PROPERTY_GMVISION, (onOff) ? (char*)"1" : (char*)"0");
+					#else
+						database.insertCharacterProperty(client, CHAR_PROPERTY_GMVISION, (onOff) ? "1" : "0");
+					#endif
+					client->GetCurrentZone()->SendAllSpawnsForVisChange(client, false);
+
+					if (onOff)
+						client->SimpleMessage(CHANNEL_COLOR_YELLOW, "GM Vision Enabled!");
+					else
+						client->SimpleMessage(CHANNEL_COLOR_YELLOW, "GM Vision Disabled!");
+				}
+			}
+			break;
+		}
 		case COMMAND_ATTACK:
 		case COMMAND_AUTO_ATTACK:{
 			int8 type = 1;

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

@@ -875,6 +875,7 @@ private:
 #define COMMAND_DISARM					510
 #define COMMAND_KNOWLEDGEWINDOWSORT		511
 #define COMMAND_PLACE_HOUSE_ITEM		512
+#define COMMAND_GM						513
 
 #define GET_AA_XML						751
 #define ADD_AA							752

+ 1 - 0
EQ2/source/WorldServer/Player.cpp

@@ -115,6 +115,7 @@ Player::Player(){
 	info_mutex.SetName("Player::info_mutex");
 	m_playerSpawnQuestsRequired.SetName("Player::player_spawn_quests_required");
 	m_playerSpawnHistoryRequired.SetName("Player::player_spawn_history_required");
+	gm_vision = false;
 }
 Player::~Player(){
 	for(int32 i=0;i<spells.size();i++){

+ 4 - 2
EQ2/source/WorldServer/Player.h

@@ -829,8 +829,8 @@ public:
 	void UpdateLUAHistory(int32 event_id, int32 value, int32 value2);
 	LUAHistory* GetLUAHistory(int32 event_id);
 
-
-
+	bool HasGMVision() { return gm_vision; }
+	void SetGMVision(bool val) { gm_vision = val; }
 
 
 
@@ -958,6 +958,8 @@ private:
 	int32 tmp_mount_model;
 	EQ2_Color tmp_mount_color;
 	EQ2_Color tmp_mount_saddle_color;
+
+	bool gm_vision;
 };
 #pragma pack()
 #endif

+ 9 - 0
EQ2/source/WorldServer/Spawn.cpp

@@ -252,6 +252,15 @@ void Spawn::InitializeVisPacketData(Player* player, PacketStruct* vis_packet) {
 		//Check to see if there's an override value set
 			vis_flags = req_quests_override & 0xFF;
 	}
+
+	if (player->HasGMVision())
+	{
+		if ((vis_flags & 16) == 0 && appearance.display_name == 0)
+			vis_flags += 16;
+		if ((vis_flags & 4) == 0)
+			vis_flags += 4;
+	}
+
 	vis_packet->setDataByName("vis_flags", vis_flags);
 
 

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

@@ -1697,6 +1697,14 @@ bool WorldDatabase::loadCharacterProperties(Client* client) {
 			if (client->GetPlayer()->GetInvulnerable())
 				client->SimpleMessage(CHANNEL_COLOR_YELLOW, "You are now invulnerable!");
 		}
+		else if (!stricmp(prop_name, CHAR_PROPERTY_GMVISION))
+		{
+			int8 val = atoi(prop_value);
+			client->GetPlayer()->SetGMVision(val == 1);
+			client->GetCurrentZone()->SendAllSpawnsForVisChange(client, false);
+			if (val)
+				client->SimpleMessage(CHANNEL_COLOR_YELLOW, "GM Vision Enabled!");
+		}
 	}
 
 	return true;

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

@@ -104,6 +104,7 @@ using namespace std;
 #define CHAR_PROPERTY_SPEED			"modify_speed"
 #define CHAR_PROPERTY_FLYMODE		"modify_flymode"
 #define CHAR_PROPERTY_INVUL			"modify_invul"
+#define CHAR_PROPERTY_GMVISION		"modify_gmvision"
 
 
 struct StartingItem{

+ 2 - 2
EQ2/source/WorldServer/zoneserver.cpp

@@ -4013,13 +4013,13 @@ void ZoneServer::SendAllSpawnsForSeeInvisChange(Client* client) {
 }
 
 
-void ZoneServer::SendAllSpawnsForVisChange(Client* client) {
+void ZoneServer::SendAllSpawnsForVisChange(Client* client, bool limitToEntities) {
 	Spawn* spawn = 0;
 	if (spawn_range_map.count(client) > 0) {
 		MutexMap<int32, float >::iterator itr = spawn_range_map.Get(client)->begin();
 		while (itr.Next()) {
 			spawn = GetSpawnByID(itr->first);
-			if (spawn && spawn->IsEntity() && client->GetPlayer()->WasSentSpawn(spawn->GetID()) && !client->GetPlayer()->WasSpawnRemoved(spawn)) {
+			if (spawn && (!limitToEntities || (limitToEntities && spawn->IsEntity())) && client->GetPlayer()->WasSentSpawn(spawn->GetID()) && !client->GetPlayer()->WasSpawnRemoved(spawn)) {
 				SendSpawnChanges(spawn, client, false, true);
 			}
 		}

+ 1 - 1
EQ2/source/WorldServer/zoneserver.h

@@ -328,7 +328,7 @@ public:
 	void	ReloadClientQuests();
 	void	SendAllSpawnsForLevelChange(Client* client);
 	void	SendAllSpawnsForSeeInvisChange(Client* client);
-	void	SendAllSpawnsForVisChange(Client* client);
+	void	SendAllSpawnsForVisChange(Client* client, bool limitToEntities=true);
 	
 	void	AddLocationGrid(LocationGrid* grid);
 	void	RemoveLocationGrids();