Tiberian Technologies Scripts Reference Revision: 9000
Loading...
Searching...
No Matches
cPlayer.h
1/* Renegade Scripts.dll
2 Copyright 2013 Tiberian Technologies
3
4 This file is part of the Renegade scripts.dll
5 The Renegade scripts.dll is free software; you can redistribute it and/or modify it under
6 the terms of the GNU General Public License as published by the Free
7 Software Foundation; either version 2, or (at your option) any later
8 version. See the file COPYING for more details.
9 In addition, an exemption is given to allow Run Time Dynamic Linking of this code with any closed source module that does not contain code covered by this licence.
10 Only the source code to the module(s) containing the licenced code has to be released.
11*/
12#ifndef TT_INCLUDE_CPLAYER_H
13#define TT_INCLUDE_CPLAYER_H
14#include "PlayerDataClass.h"
15#include "NetworkObjectClass.h"
16#include "engine_string.h"
17
18
19enum GAMESPY_AUTH_STATE_ENUM
20{
21 GAMESPY_AUTH_STATE_INITIAL,
22 GAMESPY_AUTH_STATE_CHALLENGED,
23 GAMESPY_AUTH_STATE_VALIDATING,
24 GAMESPY_AUTH_STATE_ACCEPTED,
25 GAMESPY_AUTH_STATE_REJECTING,
26 GAMESPY_AUTH_STATE_REJECTED,
27};
28
29
30class cPlayer : public PlayerDataClass, public NetworkObjectClass {
31public:
32 cPlayer();
33 ~cPlayer();
34 bool Load(ChunkLoadClass& chunkLoader);
35 bool Save(ChunkSaveClass& chunkSaver);
36 void Reset_Player();
37 void Set_Score(float score);
38 void Increment_Score(float score);
39 void Set_Money(float money);
40 void Increment_Money(float money);
41 unsigned int Get_Network_Class_ID() const;
42 void Import_Creation(BitStreamClass &BitStream);
43 void Import_Rare(BitStreamClass &BitStream);
44 void Import_Occasional(BitStreamClass &BitStream);
45 void Export_Creation(BitStreamClass &BitStream);
46 void Export_Rare(BitStreamClass &BitStream);
47 void Export_Occasional(BitStreamClass &BitStream);
48 void Delete();
49 void SCRIPTS_API Set_Player_Type(int type);
50 void Set_Ladder_Points(int amount);
51 void Set_Rung(int amount);
52 void Set_Is_Active(bool active);
53 void SCRIPTS_API Set_Name(const WideStringClass& name);
54 void SCRIPTS_API Set_Id(uint32 id);
55 void Set_Wol_ClanID(uint32 wolClanId);
56 void Set_Wol_Rank(sint32 wolRank);
57 void Set_Is_In_Game(bool);
58 void Set_Is_Waiting_For_Intermission(bool);
59 void Set_Last_Update_Time_Ms(uint32 lastUpdate);
60 void Set_Ip_Address(unsigned long ip);
61 int Get_Ip_Address() const {return IpAddress;}
62 void Reset_Join_Time();
63 void Increment_Total_Time();
64 void Init();
65 Vector3 Get_Color() const;
66 bool Get_Invulnerable() const {return Invulnerable;}
67 bool Is_Team_Player();
68 int Get_Ping();
69 void Get_Player_String(int id,WideStringClass &str,bool b);
70 void Increment_Kills();
71 void Increment_Deaths();
72 SCRIPTS_API void Set_Kills(int kills);
73 SCRIPTS_API void Set_Deaths(int deaths);
74private:
75 bool Invulnerable; // 1876
76 WideStringClass PlayerName; // 1880
77 int PlayerId; // 1884
78 safe_int LadderPoints; // 1888
79 safe_int Kills; // 1892
80 safe_int Deaths; // 1896
81 safe_int PlayerType; // 1900
82 safe_int Rung; // 1904
83 safe_int WolRank; // 1908
84 short WolPoints; // 1912
85 int DamageScaleFactor; // 1916
86 int Ping; // 1920
87 int JoinTime; // 1924
88 int TotalTime; // 1928
89 unsigned long IpAddress; // 1932
90 int Fps; // 1936
91 unsigned long LastUpdateTimeMs; // 1940
92 int FastSortKey; // 1944
93 int NumWolGames; // 1948
94 bool IsWaitingForIntermission; // 1952; This is used for clients that joined during intermission time, these will be notified about when the game starts by cNetwork::Enabled_Waiting_Players.
95 GAMESPY_AUTH_STATE_ENUM GameSpyAuthState; // 1956
96 unsigned long GameSpyAuthStateEntryTimeMs; // 1960
97 StringClass GameSpyChallengeString; // 1964
98 StringClass GameSpyHashId; // 1968
99 int GameSpyKickState; // 1972
100 unsigned long GameSpyKickStateEntryTimeMs; // 1976
101 bool IsInGame; // 1980
102 bool IsActive; // 1981
103 unsigned long WolClanId; // 1984
104public:
105 int Get_Join_Time() const {return JoinTime;}
106 int Get_Total_Time() const {return TotalTime;}
107 void Set_Fps(int _fps) { Fps = _fps; }
108 bool Get_Is_Active() const { return IsActive; }
109 bool Is_Human() const { return PlayerId >= 0; }
110 bool Get_Is_In_Game() const { return IsInGame; }
111 int Get_Id() const { return PlayerId; }
112 bool Get_Is_Waiting_For_Intermission() const { return IsWaitingForIntermission; }
113 void Mark_As_Modified() { Set_Object_Dirty_Bit(NetworkObjectClass::BIT_RARE, true); }
114 bool Is_Active() {return IsActive;}
115 const WideStringClass &Get_Name() const {return PlayerName;}
116 int Get_Player_Type() const {return PlayerType;}
117 int Get_Rung() const {return Rung;}
118 int Get_Ladder_Points() const {return LadderPoints;}
119 int Get_Kills() const {return Kills;}
120 int Get_Deaths() const {return Deaths;}
121 bool Is_Alive_And_Kicking() const { return PlayerId >= 0 && IsInGame && IsActive; }
122 int Get_Damage_Scale_Factor() const {return DamageScaleFactor;}
123 int Get_WOL_ClanID() const {return WolClanId;}
124 short Get_WOL_Points() const {return WolPoints;}
125 int Get_Num_WOL_Games() {return NumWolGames;}
126 int Get_Fast_Sort_Key() {return FastSortKey;}
127 void Set_Fast_Sort_Key(int key) {FastSortKey = key;}
128 float Get_Kill_To_Death_Ratio() const
129 {
130 if (Deaths > 0)
131 {
132 return (float)Kills / (float)Deaths;
133 }
134 return -1;
135 }
136
137 void Set_GameSpy_Hash_Id(const StringClass& _GameSpyHashId) { GameSpyHashId = _GameSpyHashId; }
138 void Set_GameSpy_Challenge_String(const StringClass& _GameSpyChallengeString) { GameSpyChallengeString = _GameSpyChallengeString; }
139 GAMESPY_AUTH_STATE_ENUM Get_GameSpy_Auth_State() const { return GameSpyAuthState; }
140 void Set_GameSpy_Auth_State(GAMESPY_AUTH_STATE_ENUM _GameSpyAuthState);
141
142
143 // Added by TT
144 WideStringClass customTag;
145
146 WideStringClass getNameLabel() const;
147 bool isFriendly(const DamageableGameObj& object) const;
148 bool isHostile(const DamageableGameObj& object) const;
149
150private:
151 SimpleDynVecClass<unsigned long> FloodCounter;
152
153public:
154 virtual void Increment_Flood_Counter();
155 virtual void Decrement_Flood_Counter();
156 virtual bool Is_Flooding();
157
158};
159
160#endif