Browse Source

Support for /house command

In support of issue #124

update commands set handler=515 where command='house';

/house command works inside and outside of a house
Image 3 years ago
parent
commit
75e2f2965b

+ 28 - 2
EQ2/source/WorldServer/Commands/Commands.cpp

@@ -2721,15 +2721,41 @@ void Commands::Process(int32 index, EQ2_16BitString* command_parms, Client* clie
 			}
 			break;
 		}
-		case COMMAND_HOUSE_UI:
+		case COMMAND_HOUSE:
 		{
-			PrintSep(sep, "COMMAND_HOUSEUI");
+			PrintSep(sep, "COMMAND_HOUSE");
 			if (sep && sep->IsNumber(0))
 			{
 				int32 unique_id = atoi(sep->arg[0]);
 				PlayerHouse* ph = world.GetPlayerHouseByUniqueID(unique_id);
 				HouseZone* hz = 0;
 
+				if (ph)
+					hz = world.GetHouseZone(ph->house_id);
+				// there is a arg[1] that is true/false, but not sure what it is for investigate more later
+				ClientPacketFunctions::SendBaseHouseWindow(client, hz, ph, client->GetPlayer()->GetID());
+			}
+			else if (client->GetCurrentZone()->GetInstanceType() != 0)
+			{
+				// inside a house or something? Send the access window
+				PlayerHouse* ph = world.GetPlayerHouseByInstanceID(client->GetCurrentZone()->GetInstanceID());
+
+				HouseZone* hz = 0;
+				if ( ph )
+					hz = world.GetHouseZone(ph->house_id);
+
+				ClientPacketFunctions::SendBaseHouseWindow(client, hz, ph, client->GetPlayer()->GetID());
+			}
+			break;
+		}
+		case COMMAND_HOUSE_UI:
+		{
+			PrintSep(sep, "COMMAND_HOUSEUI");
+			if (sep && sep->IsNumber(0) && client->GetCurrentZone()->GetInstanceType() == Instance_Type::NONE)
+			{
+				int32 unique_id = atoi(sep->arg[0]);
+				PlayerHouse* ph = world.GetPlayerHouseByUniqueID(unique_id);
+				HouseZone* hz = 0;
 				if ( ph )
 					hz = world.GetHouseZone(ph->house_id);
 				// there is a arg[1] that is true/false, but not sure what it is for investigate more later

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

@@ -877,6 +877,7 @@ private:
 #define COMMAND_PLACE_HOUSE_ITEM		512
 #define COMMAND_GM						513
 #define COMMAND_HOUSE_UI				514
+#define COMMAND_HOUSE					515
 
 #define GET_AA_XML						751
 #define ADD_AA							752