aboutsummaryrefslogtreecommitdiff
path: root/src/houses.hh
blob: 65c6b19dd9378fa70d751ffcf8f20b7ddcab0b6e (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
#ifndef TIBIA_HOUSES_HH_
#define TIBIA_HOUSES_HH_ 1

#include "common.hh"
#include "containers.hh"
#include "map.hh"

#define MAX_HOUSE_GUEST_NAME 60

struct TPlayer;
struct TPlayerData;

struct THelpDepot {
	uint32 CharacterID;
	Object Box;
	int DepotNr;
};

struct THouseArea {
	uint16 ID;
	int SQMPrice;
	int DepotNr;
};

struct THouseGuest {
	char Name[MAX_HOUSE_GUEST_NAME];
};

struct THouse {
	THouse(void);

	// TODO(fusion): Same as `TChannel` in `operate.hh`.
	THouse(const THouse &Other);
	void operator=(const THouse &Other);

	// DATA
	// =================
	uint16 ID;
	char Name[50];
	char Description[500];
	int Size;
	int Rent;
	int DepotNr;
	bool NoAuction;
	bool GuildHouse;
	int ExitX;
	int ExitY;
	int ExitZ;
	int CenterX;
	int CenterY;
	int CenterZ;
	uint32 OwnerID;
	char OwnerName[30];
	int LastTransition;
	int PaidUntil;
	vector<THouseGuest> Subowner;
	int Subowners;
	vector<THouseGuest> Guest;
	int Guests;
	int Help;
};

THouseArea *GetHouseArea(uint16 ID);
int CheckAccessRight(const char *Rule, TPlayer *Player);
THouse *GetHouse(uint16 ID);
bool IsOwner(uint16 HouseID, TPlayer *Player);
bool IsSubowner(uint16 HouseID, TPlayer *Player, int TimeStamp);
bool IsGuest(uint16 HouseID, TPlayer *Player, int TimeStamp);
bool IsInvited(uint16 HouseID, TPlayer *Player, int TimeStamp);
const char *GetHouseName(uint16 HouseID);
const char *GetHouseOwner(uint16 HouseID);
void ShowSubownerList(uint16 HouseID, TPlayer *Player, char *Buffer);
void ShowGuestList(uint16 HouseID, TPlayer *Player, char *Buffer);
void ChangeSubowners(uint16 HouseID, TPlayer *Player, const char *Buffer);
void ChangeGuests(uint16 HouseID, TPlayer *Player, const char *Buffer);
void GetExitPosition(uint16 HouseID, int *x, int *y, int *z);
void KickGuest(uint16 HouseID, TPlayer *Guest);
void KickGuest(uint16 HouseID, TPlayer *Host, TPlayer *Guest);
void KickGuests(uint16 HouseID);
bool MayOpenDoor(Object Door, TPlayer *Player);
void ShowNameDoor(Object Door, TPlayer *Player, char *Buffer);
void ChangeNameDoor(Object Door, TPlayer *Player, const char *Buffer);
void CleanField(int x, int y, int z, Object Depot);
void CleanHouse(THouse *House, TPlayerData *PlayerData);
void ClearHouse(THouse *House);
bool FinishAuctions(void);
bool TransferHouses(void);
bool EvictFreeAccounts(void);
bool EvictDeletedCharacters(void);
bool EvictExGuildLeaders(void);
void CollectRent(void);
void ProcessRent(void);
bool StartAuctions(void);
bool UpdateHouseOwners(void);
void PrepareHouseCleanup(void);
void FinishHouseCleanup(void);
void CleanHouseField(int x, int y, int z);
void LoadHouseAreas(void);
void LoadHouses(void);
void LoadOwners(void);
void SaveOwners(void);
void ProcessHouses(void);
void InitHouses(void);
void ExitHouses(void);

#endif //TIBIA_HOUSES_HH_