Browse Source

Command to move spawn to your current location

Fixes #56
new command : /spawn move myloc
Updates X,Y,Z,Heading to the players current values and saves the spawn_location_placement
Image 4 years ago
parent
commit
9bbd10e147
1 changed files with 18 additions and 0 deletions
  1. 18 0
      EQ2/source/WorldServer/Commands/Commands.cpp

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

@@ -1538,6 +1538,24 @@ void Commands::Process(int32 index, EQ2_16BitString* command_parms, Client* clie
 							client->SimpleMessage(CHANNEL_COLOR_YELLOW, "[PlacementMode] WIDGET CLOSE HEADING MODE");
 							client->SetSpawnPlacementMode(Client::ServerSpawnPlacementMode::CLOSE_HEADING);
 						}
+						else if (strcmp(sep->arg[0], "myloc") == 0)
+						{
+							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;
+							}
+
+							cmdTarget->SetX(client->GetPlayer()->GetX(), true);
+							cmdTarget->SetY(client->GetPlayer()->GetY(), true);
+							cmdTarget->SetZ(client->GetPlayer()->GetZ(), true);
+							cmdTarget->SetHeading(client->GetPlayer()->GetHeading(), true);
+
+							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;
+						}
 					}
 					packet->setDataByName("placement_mode", placement_mode);
 					packet->setDataByName("spawn_id", client->GetPlayer()->GetIDWithPlayerSpawn(cmdTarget));