Thread: Housing APIs
View Single Post
11/01/16, 08:50 AM   #9
Ayantir
 
Ayantir's Avatar
AddOn Author - Click to view addons
Join Date: Jul 2014
Posts: 1,019
Okay. so

What we know :

https://forums.elderscrollsonline.co...afting-more/p1

So..


Okay, they're a bit too technical; but it's a bit easier for me to write them here as every contributor understand what I say.


API to get House name, address, desc, numfurnitures, total.
API to get for each furniture its emplacement (x, y, z, rotationangle) and its itemlink.
API to get for the house the name of visitors (including player).
API to get for the house the special furnitures (tapestry, floor, music, etc).
API to check if an item is a furniture.
API to interact with EVERY furniture <- very complicated but very asked
API to recommend the house / get house reputation
API to get the best house reputation (leaderboards). with their owners and address. <- Please Hype +++++
API to visit a house "as a guest" : Visiting "nice houses without disturbing owner". <- A very thank you if this is doable


Events:
When a house is bought
When a house is sold (and know if it's sold by game itself).
When you rent a house (if there is rentings) and how much and with which currency.
When you place a furniture
When you remove a furniture
When you change a special furniture.
When someone enters in your house.
















functions

local name, description, address, houseType = GetHouseDescription(houseId)
-- name is the name of the house "A little bosmer house". It could be rennammed by player : "My House"
-- description is its description, if needed (not very important)
-- address is the textual address of the house : "32 Main Street, Wayrest"
-- houseType is a houseType constant : basic, small, big, mansion, castle, etc.


local actualFurniture, maxFurnitures = GetHouseFurnitureCount(houseId)
-- actualFurnitures is the number of furnitures we put on the house
-- maxFurnitures is the max furnitures we can put in this house

Note: If you consider that 1 furniture = 1 point, it's okay, but if you consider that 1 small furniture is 1 point and 1 big furniture is 3 points, I would enjoy a classification per points. (I also saw this in other games).


local itemLink, normalizedX, normalizedY, normalizedZ, rotationAngle = GetHouseFurnitureInfo(houseId, furnitureIndex)
-- houseId can be avoided, but it should be cool to have it.
-- this function could only work while being in the house, but it would be cool it works everywhere.

-- itemLink is the itemLink of the furniture.
-- normalizedX, normalizedY, normalizedZ are the coordinates of the item placed in da house.
-- rotationAngle : it's the angle of rotation of the furniture. 0-360. I'm not good in geometry, so any system which can do this is good. If you allow rotation in 3 dimensions.. 2 values? But I don't think you'll allow this ..

local isFurniture = IsItemLinkFurniture(itemLink)
--return true if itemLink is a furniture (can be placed inworld).

local furnitureType = GetItemLinkFurnitureType(itemLink)
-- return a furnitureType constant

InteractWithTargettedFurniture(furnitureInteractionType)
-- will interact with the furniture targetted by reticle.
Each furniture will have X possible interactions.
A chair per example will accept FURNITURE_INTERACTION_SIT. Character will automove to the chair then sit on it.

If you add this :
local musicIndex = GetMusicPlayedInHouse(houseId)
if houseId is not given, it will return the music played in the actual house (if we are in a house). to know the music played by a friend.

If you add this :
local itemLink = GetFurnitureForHouse(specialFurniture)
-- In some games, you can add "special furnitures", they're unique to the house. per example the tapestry will be "Dwemer" and all walls of the house will have this tapestry. Same for music, player choose to play one of the music of the game in its house. I've listed few examples in constants.
In case you add unique Maid (or gardener, or any "NPC", the itemLink should be the itemLink of the NPC (they should be added as "item" or "collectible" if you add NPC "maids").


If you add this:
EnterInHouse(ownerDisplayName, asGuest)
-- will enter in the house of ownerDisplayName. this function only works while interacting with the main door of the house.
If asGuest is true, you'll enter in the hous as a guest, you'll be in an alternate instance of the owner house. If he enters, you won't see him. If another enter as guest, another instance will be created. this is mainly to visit nice houses.


If you add this:
GiveRecommendationToHouse()
-- it will give a recommandation to the house (+1). It's basically a count used for housing leaderboard.
local numRecommandations = GetRecommendation(houseId)
-- it will return the count of recommendation you received for your house.
local gratifierDisplayName = GetGratifierDisplayName(houseId, recommendationIndex)
-- will return the displayName of the people who recommended your house.
local houseId, displayName = GetTopHouseForType(houseType, leaderboardIndex)
-- will return the houseId (address) and name of the owner for a type of house (big, small) at position X (1-100 per ex)
local displayName = GetTopHouseForAddress(leaderboardIndex)
-- will return the name of the owner for an address (a houseId) at position X (1-10 per ex)


Placement/Recuperation of furnitures:
I didn't looked at it, but we should be able to set an item in world throught the your editor (or ours). Here would only like to be able to grab any furniture were ever I am in da house (I can be a bit far from the furniture but should be able to grab it anyways).









Events :

EVENT_HOUSE_BOUGHT(eventId, houseid)
--houseId is the houseId Constant
-- if we can buy a house with gold or crowns, I would like currencyType in event too. (CURT_GOLD, etc).

EVENT_HOUSE_SOLD(eventId, houseid, autoSell)
--houseId is the houseId Constant
-- autoSell is a boolean which indicate if it's the game which sell the house (because you did not played for a certain time, I already saw it in other games).

If we need to pay a rent :
EVENT_HOUSE_RENT_PAYED(eventId, houseid, amount)
-- amount parameter could be replaced by the date of when the rent will expire. But I would prefer amount.
-- If we can pay in crowns, I would like currencyType in event too. (CURT_GOLD, etc).
-- if a house can only be rentd throught crowns, no need. we'll deduct it with houseId.


EVENT_FURNITURE_ADDED(event)
-- will trigger for every player present in the house.
-- itemLink is the itemLink of the item added.

EVENT_FURNITURE_REMOVED(event)
-- will trigger for every player present in the house.
-- itemLink is the itemLink of the item removed.

Those 2 events.. I still don't know. Maybe we could have it only for owner. I don't really know.
A note: When adding an item the world, it should be cool if furnitureIndex of item added was equal to actualFurniture of function GetHouseFurnitureCount(houseId)

So when we put an item into the world, we listen
EVENT_FURNITURE_ADDED and get its desc with GetHouseFurnitureInfo(houseId, GetHouseFurnitureCount(houseId))
like when you join a guild, index is always the last one.
After, it's more your internal way of code.

EVENT_VISITOR_ENTERED(event, displayName, characterName)
-- When somenone enter in your house. trigger only when you're in the house.

EVENT_VISITOR_LEFT(event, displayName, characterName)
-- When somenone exits your house. trigger only when you're in the house.

EVENT_HOUSE_RECOMMENDED(eventId, houseId, displayName)
-- When someone recommend your houseId. (so you can say thank you).




Constants :

houseType
HOUSE_TYPE_SMALL
HOUSE_TYPE_BASIC
HOUSE_TYPE_MANSION
HOUSE_TYPE_BIGCASTLE

houseId =
The HouseId of the House at a certain location. For now, we have 32 addresses.

HOUSE_TYPE_BOSMER_SMALL
HOUSE_TYPE_BOSMER_MEDIUM
HOUSE_TYPE_BOSMER_LARGE
HOUSE_TYPE_BRETON_MEDIUM
HOUSE_TYPE_CROWNSTORE_BRETON <-
etc.


furnitureType
A type of furniture - Each furnitureType will have its set of furnitureInteractionType linked with.
FURNITURE_TYPE_CHAIR
FURNITURE_TYPE_TABLE
FURNITURE_TYPE_BED
FURNITURE_TYPE_PAINTING
etc.

furnitureInteractionType
An interaction played and broadcasted to every people in the house (or at least nearby).

FURNITURE_INTERACTION_SIT <- player will sit on the furniture
FURNITURE_INTERACTION_LAY <- player will lay on the furniture
FURNITURE_INTERACTION_JUMP <- player will jump on the furniture
FURNITURE_INTERACTION_OPEN <- player will open the furniture
FURNITURE_INTERACTION_CLOSE <- player will close on the furniture
etc. (there is a lot, ask roleplayers).


if you add this music played in da house :
HOUSE_MUSIC_RAGNAR_THE_RED
HOUSE_MUSIC_HEAVY_METAL
HOUSE_MUSIC_CLASSIC
HOUSE_MUSIC_BIEBER

if you add "special furnitures" :
FURNITURE_SPECIAL_FLOORING
FURNITURE_SPECIAL_TAPESTRY
FURNITURE_SPECIAL_MUSIC
FURNITURE_SPECIAL_MAID
FURNITURE_SPECIAL_SHUTTERS



Housing visits and leaderboards


Per address :

When you approch house, you'll have at choice :
- Enter in the house of your friends if they live here
- Visit a nice house : Will list the X top house at the specified address.

Per type :

In J panel
we'll have per type (small, big) the top houses.
we'll have per address (houseId) the top houses.

Leaderboards are resetted at each major patch (DLC or API bump).




I didn't finished.


It was a quick 1 hour brainstorm.
  Reply With Quote