Implementing: Housing

EQ2Emulator Development forum.

Moderator: Team Members

Jabantiz
Lead Developer
Posts: 2912
Joined: Wed Jul 25, 2007 2:52 pm
Location: California

Re: Implementing: Housing

Post by Jabantiz » Tue Mar 05, 2013 4:09 pm

First of all let me stress this is for future reference, something I researched back in CoE beta but forgot about until today. Again this is not something I am currently working on.

EQ2 lets you save the layout of your house so you can quickly go to another house and reproduce your work, there is even a 3rd party program that lets you easily modify the layout so you can load it up in game and some times get results not possible in the game itself. The reason I bring this up is because I think it is good for a db structure for house items when we get around to them.

Here is a file generated during CoE beta

Code: Select all

6,Version Number
2906474998,neriak_ph_1room 
2159160320, Unique House ID. 
474252292,67611,4.40261173,-0.03750569,-15.66803741,0.00000000,0.00000000,0.00000000,1.00000000, false,"Humble Altar of Brell Serilis"
3706443301,67610,-0.01215738,11.45921612,-7.94638062,0.00000000,0.00000000,0.00000000,3.00000000, false,"Basic Chandelier"
1385963439,67607,8.78586864,1.38624287,-7.72426558,-90.00489807,0.00000000,0.00000015,1.00000000, false,"Basic Mirror"
1946890604,67609,6.86765957,-0.03750854,-14.14238167,137.99998474,0.00000000,0.00000000,1.00000000, false,"Basic Table"
297271877,67612,8.78586864,4.24231386,-7.72824621,-90.00000000,0.00000000,0.00000000,1.00000000, false,"a market bulletin board"
And here is the documented format for this file.

User avatar
John Adams
Retired
Posts: 9684
Joined: Thu Jul 26, 2007 6:27 am
EQ2Emu Server: EQ2Emulator Test Center
Characters: John
Location: Arizona
Contact:

Re: Implementing: Housing

Post by John Adams » Fri Mar 08, 2013 12:48 pm

8.78586864,4.24231386,-7.72824621,-90.00000000
You know, one can never be too precise on where their stuff gets placed ;)

Jabantiz
Lead Developer
Posts: 2912
Joined: Wed Jul 25, 2007 2:52 pm
Location: California

Re: Implementing: Housing

Post by Jabantiz » Mon Apr 29, 2013 9:04 pm

Door test, requires a new table and an extra field in the spawn_widgets table.
EQ2_000000.png
First step in getting housing going, don't plan to commit anything until I get it to the first goal of being able to buy a house and create the instance.
You do not have the required permissions to view the files attached to this post.

Jabantiz
Lead Developer
Posts: 2912
Joined: Wed Jul 25, 2007 2:52 pm
Location: California

Re: Implementing: Housing

Post by Jabantiz » Tue Apr 30, 2013 8:14 pm

Second window is working
EQ2_000000 (2).png
Currently you can buy a house, but money is not taken, the instance is created and you can enter the zone. I made a design error on my end so it is only possible to enter houses you own, will have to rework some stuff so you can visit others houses.
You do not have the required permissions to view the files attached to this post.

Jabantiz
Lead Developer
Posts: 2912
Joined: Wed Jul 25, 2007 2:52 pm
Location: California

Re: Implementing: Housing

Post by Jabantiz » Fri May 03, 2013 12:59 am

Fixed the design error, and implemented visiting other players houses. You will actually zone into the other players instance when you select their house.
EQ2EmuVisitTest.png
I ran into an issue with secondary commands on a widget but got around it by having both commands set as primary.
You do not have the required permissions to view the files attached to this post.

User avatar
John Adams
Retired
Posts: 9684
Joined: Thu Jul 26, 2007 6:27 am
EQ2Emu Server: EQ2Emulator Test Center
Characters: John
Location: Arizona
Contact:

Re: Implementing: Housing

Post by John Adams » Fri May 03, 2013 9:55 am

Jabantiz wrote:I ran into an issue with secondary commands on a widget but got around it by having both commands set as primary.
Awesome work as usual, Jabantiz. Regarding the secondary commands, are they just not coded to function the same as NPCs? If not, maybe we should do that.


In case you (or anyone else) have never set a secondary command up before, you basically make a new entity_command using the same ID for all the stuff you want to show up non-primary, and assign that to the command_secondary field.

Example -
command_secondary.jpg
7 = command_primary
100 = command_secondary
You do not have the required permissions to view the files attached to this post.

Jabantiz
Lead Developer
Posts: 2912
Joined: Wed Jul 25, 2007 2:52 pm
Location: California

Re: Implementing: Housing

Post by Jabantiz » Fri May 03, 2013 1:15 pm

Did that, the new entity_command was 1006, added it to the spawn and nothing, spawn is a widget btw. After searching in code for a little I discovered the widget's copy function did not copy the secondary commands so I added that but still nothing. I have no clue why the widget won't show the secondary, also setting the command, visit, as a primary command after access I have visit listed twice in the right click menu.

I am not sure why widgets are giving me such a hard time with the right click menu, will look into it some more this weekend.

Jabantiz
Lead Developer
Posts: 2912
Joined: Wed Jul 25, 2007 2:52 pm
Location: California

Re: Implementing: Housing

Post by Jabantiz » Fri May 03, 2013 8:19 pm

Fixed a couple issues with the design fix, can also exit the house now, if the house zone has a door widget.

Jabantiz
Lead Developer
Posts: 2912
Joined: Wed Jul 25, 2007 2:52 pm
Location: California

Re: Implementing: Housing

Post by Jabantiz » Sat May 04, 2013 9:02 pm

Commited all the code/structs/tables, I believe it is at the first goal, you can get a house, enter it, leave it, and visit other players houses.

Here is the main table to set up a house. (here as a reference, table is already on the patcher)

Code: Select all

CREATE TABLE `houses` (
	`id` INT(10) UNSIGNED NOT NULL AUTO_INCREMENT,
	`name` CHAR(64) NOT NULL DEFAULT '0' COLLATE 'latin1_general_ci',
	`cost_coins` BIGINT(20) UNSIGNED NOT NULL DEFAULT '0',
	`cost_status` INT(10) UNSIGNED NOT NULL DEFAULT '0',
	`upkeep_coins` BIGINT(20) UNSIGNED NOT NULL DEFAULT '0',
	`upkeep_status` INT(10) UNSIGNED NOT NULL DEFAULT '0',
	`vault_slots` TINYINT(3) UNSIGNED NOT NULL DEFAULT '0',
	`alignment` TINYINT(3) UNSIGNED NOT NULL DEFAULT '0',
	`guild_level` TINYINT(3) UNSIGNED NOT NULL DEFAULT '0',
	`zone_id` INT(10) UNSIGNED NOT NULL DEFAULT '0',
	`exit_zone_id` INT(10) NOT NULL DEFAULT '0',
	`exit_x` FLOAT NOT NULL DEFAULT '0',
	`exit_y` FLOAT NOT NULL DEFAULT '0',
	`exit_z` FLOAT NOT NULL DEFAULT '0',
	`exit_heading` FLOAT NOT NULL DEFAULT '0',
	PRIMARY KEY (`id`)
)
COLLATE='latin1_general_ci'
ENGINE=InnoDB;
ID - use this value to assign a house to a door widget
Name - name or address of the house, like "3 Walk of the Dead"
cost_coins - the price in copper to buy this house, 500 = 5 silver
cost_status - the price in status to buy this house
upkeep_coins - the price in copper that needs to be paid each week
upkeep_status - the price in status that needs to be paid each week
vault_slots - the number of vault and vendor slots this house provides
alignment - the alignment needed to buy this house, 0 = none 1 = good 2 = evil
guild_level - the guild level needed to buy this house
zone_id - the base zone id for the house
exit_zone_id - the zone you will go to when leaving the house
exit_x - x position in the exit zone
exit_y - y position in the exit zone
exit_z - z position in the exit zone
exit_heading - heading in the exit zone

Once you fill out an entry in that table you just need to assign it to a door widget, take the id value and put it in the house_id field in the spawn_widgets table. Also make sure the widget has the command "access" assigned to it, also "visit" if you want the visit window working. Also make sure the zone you provide in the zone_id field is set up as a house instance, instance_type field in the zones table set to PERSONAL_HOUSE_INSTANCE. Once that is set up all you have to do is go to the door and click it and everything should work. If the house zone has a door widget all you need to do is make sure it has "access" as a command for the window to show.

User avatar
Zcoretri
Team Member
Posts: 1642
Joined: Fri Jul 27, 2007 12:55 pm
Location: SoCal

Re: Implementing: Housing

Post by Zcoretri » Sun May 05, 2013 11:00 am

Got on error when compiling Jabantiz

Code: Select all

Error	1	error C2668: 'std::to_string' : ambiguous call to overloaded function	G:\!EQ2Dev\trunk\source\WorldServer\Housing\HousingPackets.cpp	31
EDIT:
After some research...

Code: Select all

MSVC11 lacks the proper overloads for std::to_string so you have to do a static_cast to unsigned long long or long long
"Note that this bug is fixed in the November CTP 2012" - It should already be fixed in the plain VS 2012
This is what I changed to get it to compile, I could not figure out what typedef to use from types.h

Code: Select all

req.append(std::to_string(static_cast<long long>(hz->guild_level)));

Jabantiz
Lead Developer
Posts: 2912
Joined: Wed Jul 25, 2007 2:52 pm
Location: California

Re: Implementing: Housing

Post by Jabantiz » Sun May 05, 2013 2:35 pm

It should already be fixed in the plain VS 2012
This would be why I didn't have or know about the issue, as I use VS 2012. It looks like the bug in VS 2010 only lets std::to_string take a long long, unsigned long long, and long double. So the static_cast you used will work.

Jabantiz
Lead Developer
Posts: 2912
Joined: Wed Jul 25, 2007 2:52 pm
Location: California

Re: Implementing: Housing

Post by Jabantiz » Sun May 05, 2013 7:15 pm

Committed Zcoretri's fix posted above as well as a fix for a ClientProcess crash (client disconnect) when you don't have house data but the widget has a house id (thanks to Alfa for finding this on my server)

User avatar
thefoof
Retired
Posts: 630
Joined: Wed Nov 07, 2012 7:36 pm
Location: Florida

Frostfang housing data

Post by thefoof » Mon May 06, 2013 12:21 pm

The New Halas Magical Manor is a house from LoN, is why it doesn't have any cost or upkeep. You need a loot card item to purchase it on live.

Code: Select all

INSERT INTO `houses` (`id`, `name`, `cost_coins`, `cost_status`, `upkeep_coins`, `upkeep_status`, `vault_slots`, `alignment`, `guild_level`, `zone_id`, `exit_zone_id`, `exit_x`, `exit_y`, `exit_z`, `exit_heading`) VALUES
(1, 'Valor Homesteads', 0, 0, 500, 0, 6, 1, 0, 501, 470, -291.36, 175.78, -95.34, 171.58),
(2, 'New Halas Magical Manor', 0, 0, 0, 0, 6, 0, 0, 503, 470, -365.85, 173.29, -77.23, 228.77),
(3, 'Manors of Erollisi', 1700000, 0, 70000, 0, 6, 1, 0, 503, 470, -384.39, 171.78, -103.18, 331.18),
(4, 'Glacial Villa', 966000, 0, 38640, 0, 6, 1, 0, 502, 470, -401.35, 170.58, -131.69, 269.05),
(5, 'Halas Guild Hall', 50000000, 0, 500000, 50000, 6, 0, 30, 515, 470, -363.51, 181.39, -189.8, 217.94),
(6, 'Manors of Mithaniel', 1000000, 200000, 30000, 50000, 6, 1, 30, 503, 470, -317.8, 180.16, -204.06, 134.45),
(7, 'Tundra Village', 500000, 80000, 20000, 8000, 6, 1, 30, 502, 470, -295.137, 173.36, -158.22, 171.39),
(8, 'Honor Homesteads', 212100, 0, 8233, 0, 6, 1, 0, 501, 470, -274.72, 172.65, -150.91, 140.81);


UPDATE spawn_widgets SET house_id = 1 WHERE spawn_id = 4701534;
UPDATE spawn_widgets SET house_id = 2 WHERE spawn_id = 4701535;
UPDATE spawn_widgets SET house_id = 3 WHERE spawn_id = 4701536;
UPDATE spawn_widgets SET house_id = 4 WHERE spawn_id = 4701537;
UPDATE spawn_widgets SET house_id = 5 WHERE spawn_id = 4701542;
UPDATE spawn_widgets SET house_id = 6 WHERE spawn_id = 4701541;
UPDATE spawn_widgets SET house_id = 7 WHERE spawn_id = 4701540;
UPDATE spawn_widgets SET house_id = 8 WHERE spawn_id = 4701539;

Post Reply

Who is online

Users browsing this forum: No registered users and 1 guest