aboutsummaryrefslogtreecommitdiff
path: root/src/creature.hh
blob: a6f767837f7a5cd81f00eba9c890bd40433b2dff (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
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
#ifndef TIBIA_CREATURE_HH_
#define TIBIA_CREATURE_HH_ 1

#include "common.hh"
#include "connection.hh"
#include "containers.hh"
#include "skill.hh"

struct TCreature;

struct TCombatEntry{
	uint32 ID;
	uint32 Damage;
	int TimeStamp;
};

struct TCombat{
	// REGULAR FUNCTIONS
	// =========================================================================
	TCombat(void);

	// DATA
	// =========================================================================
	TCreature *Master;
	uint32 EarliestAttackTime;
	uint32 EarliestDefendTime;
	uint32 LastDefendTime;
	uint32 LatestAttackTime;
	uint32 AttackMode;
	uint32 ChaseMode;
	uint32 SecureMode;
	uint32 AttackDest;
	bool Following;
	Object Shield;
	Object Close;
	Object Missile;
	Object Throw;
	Object Wand;
	Object Ammo;
	bool Fist;
	uint32 CombatDamage;
	int ActCombatEntry;
	TCombatEntry CombatList[20];
	int LearningPoints;
};

struct TToDoEntry {
    ToDoType Code;
    union{
        struct{
            uint32 Time;
        } Wait;

        struct{
            int x;
            int y;
            int z;
        } Go;

        struct{
            int Direction;
        } Rotate;

        struct{
            uint32 Obj;
            int x;
            int y;
            int z;
            int Count;
        } Move;

        struct{
            uint32 Obj;
            uint32 Partner;
        } Trade;

        struct{
            uint32 Obj1;
            uint32 Obj2;
            int Dummy;
        } Use;

        struct{
            uint32 Obj;
        } Turn;

        struct{
            uint32 Text; // POINTER? Probably a reference from `AddDynamicString`?
            int Mode;
            uint32 Addressee;
            bool CheckSpamming;
        } Talk;

        struct{
            int NewState;
        } ChangeState;
    };
};

struct TOutfit{
	int OutfitID;
	union{
		uint16 ObjectType;
		uint8 Colors[4];
	};
};

struct TCreature: TSkillBase {
	// REGULAR FUNCTIONS
	// =========================================================================
	// TODO

	// VIRTUAL FUNCTIONS
	// =========================================================================
	virtual ~TCreature(void);															// VTABLE[ 0]
	// Duplicate destructor that also calls operator delete.							// VTABLE[ 1]
	virtual void Death(void);															// VTABLE[ 2]
	virtual void MovePossible(void);													// VTABLE[ 3]
	virtual void IsPeaceful(void);														// VTABLE[ 4]
	virtual void GetMaster(void);														// VTABLE[ 5]
	virtual void TalkStimulus(void);													// VTABLE[ 6]
	virtual void DamageStimulus(void);													// VTABLE[ 7]
	virtual void IdleStimulus(void);													// VTABLE[ 8]
	virtual void CreatureMoveStimulus(void);											// VTABLE[ 9]
	virtual void AttackStimulus(void);													// VTABLE[10]

	// DATA
	// =========================================================================
	//void *VTABLE;					// IMPLICIT
	//TSkillBase super_TSkillBase;	// IMPLICIT
	TCombat Combat;
	uint32 ID;
	TCreature *NextHashEntry;
	uint32 NextChainCreature;
	char Name[31];
	char Murderer[31];
	TOutfit OrgOutfit;
	TOutfit Outfit;
	int startx;
	int starty;
	int startz;
	int posx;
	int posy;
	int posz;
	int Sex;
	int Race;
	int Direction;
	int Radius;
	CreatureType Type;
	bool IsDead;
	int LoseInventory;
	bool LoggingOut;
	bool LogoutAllowed;
	uint32 EarliestLogoutRound;
	uint32 EarliestProtectionZoneRound;
	uint32 EarliestYellRound;
	uint32 EarliestTradeChannelRound;
	uint32 EarliestSpellTime;
	uint32 EarliestMultiuseTime;
	uint32 EarliestWalkTime;
	uint32 LifeEndRound;
	TKnownCreature *FirstKnowingConnection;
	int SummonedCreatures;
	uint32 FireDamageOrigin;
	uint32 PoisonDamageOrigin;
	uint32 EnergyDamageOrigin;
	Object CrObject;
	vector<TToDoEntry> ToDoList;
	int ActToDo;
	int NrToDo;
	uint32 NextWakeup;
	bool Stop;
	bool LockToDo;
	uint8 Profession;
	TConnection *Connection;
};

#endif //TIBIA_CREATURE_HH_