/
Player.Fields.cs
249 lines (206 loc) · 9.72 KB
/
Player.Fields.cs
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
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
/*
Copyright 2010 MCSharp team (Modified for use with MCZall/MCLawl/MCGalaxy)
Dual-licensed under the Educational Community License, Version 2.0 and
the GNU General Public License, Version 3 (the "Licenses"); you may
not use this file except in compliance with the Licenses. You may
obtain a copy of the Licenses at
http://www.opensource.org/licenses/ecl2.php
http://www.gnu.org/licenses/gpl-3.0.html
Unless required by applicable law or agreed to in writing,
software distributed under the Licenses are distributed on an "AS IS"
BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
or implied. See the Licenses for the specific language governing
permissions and limitations under the Licenses.
*/
using System;
using System.Collections.Generic;
using System.Net;
using MCGalaxy.Drawing;
using MCGalaxy.Drawing.Transforms;
using MCGalaxy.Events.PlayerEvents;
using MCGalaxy.Games;
using MCGalaxy.Maths;
using MCGalaxy.Network;
using MCGalaxy.Tasks;
using MCGalaxy.Undo;
using BlockID = System.UInt16;
namespace MCGalaxy {
public partial class Player : IDisposable {
public PlayerIgnores Ignores = new PlayerIgnores();
public static string lastMSG = "";
public Zone ZoneIn;
//TpA
internal bool Request;
internal string senderName = "";
internal string currentTpa = "";
public string truename;
public INetSocket Socket;
public PingList Ping = new PingList();
public BlockID MaxRawBlock = Block.CLASSIC_MAX_BLOCK;
public DateTime LastAction, AFKCooldown;
public bool IsAfk, AutoAfk;
public bool cmdTimer;
public bool UsingWom;
public string BrushName = "Normal", DefaultBrushArgs = "";
public Transform Transform = NoTransform.Instance;
public string afkMessage;
public bool ClickToMark = true;
public string name;
public string DisplayName;
public int warn = 0;
public byte id;
public IPAddress IP;
public string ip;
public string color;
public Group group;
public LevelPermission hideRank = LevelPermission.Banned;
public bool hidden;
public bool painting;
public bool checkingBotInfo;
public bool muted;
public bool jailed;
public bool agreed = true;
public bool invincible;
public string prefix = "";
public string title = "";
public string titlecolor = "";
public int passtries = 0;
public bool hasreadrules;
public DateTime NextReviewTime, NextEat, NextTeamInvite;
public float ReachDistance = 5;
public bool hackrank;
public string SuperName;
/// <summary> Whether this player is a 'Super' player (Console, IRC, etc) </summary>
public bool IsSuper;
/// <summary> Whether this player is the console player instance. </summary>
public bool IsConsole { get { return this == Player.Console; } }
public virtual string FullName { get { return color + prefix + DisplayName; } }
public string ColoredName { get { return color + DisplayName; } }
public string GroupPrefix { get { return group.Prefix.Length == 0 ? "" : "&f" + group.Prefix; } }
public bool deleteMode;
public bool ignoreGrief;
public bool parseEmotes = Server.Config.ParseEmotes;
public bool opchat;
public bool adminchat;
public bool whisper;
public string whisperTo = "";
string partialMessage = "";
public bool trainGrab;
public bool onTrain, trainInvincible;
int mbRecursion;
public bool frozen;
public string following = "";
public string possess = "";
// Only used for possession.
//Using for anything else can cause unintended effects!
public bool possessed;
/// <summary> Whether the player has permission to build in the current level. </summary>
public bool AllowBuild = true;
public int money;
public long TotalModified, TotalDrawn, TotalPlaced, TotalDeleted;
public int SessionModified;
public int TimesVisited, TimesBeenKicked, TimesDied;
public int TotalMessagesSent;
DateTime startTime;
public TimeSpan TotalTime {
get { return DateTime.UtcNow - startTime; }
set { startTime = DateTime.UtcNow.Subtract(value); }
}
public DateTime SessionStartTime;
public DateTime FirstLogin, LastLogin;
public bool staticCommands;
internal DateTime lastAccessStatus;
public VolatileArray<SchedulerTask> CriticalTasks = new VolatileArray<SchedulerTask>();
public bool aiming;
public Weapon weapon;
public bool isFlying;
public bool joker;
public bool Unverified, verifiedPass;
public bool voice;
public CommandData DefaultCmdData {
get {
CommandData data = default(CommandData);
data.Rank = Rank; return data;
}
}
public bool useCheckpointSpawn;
public int lastCheckpointIndex = -1;
public ushort checkpointX, checkpointY, checkpointZ;
public byte checkpointRotX, checkpointRotY;
public bool voted;
public bool flipHead;
public GameProps Game = new GameProps();
/// <summary> Persistent ID of this user in the Players table. </summary>
public int DatabaseID;
public const int SessionIDMask = (1 << 20) - 1;
/// <summary> Temp unique ID for this session only. </summary>
public int SessionID;
public List<CopyState> CopySlots = new List<CopyState>();
public int CurrentCopySlot;
public CopyState CurrentCopy {
get { return CurrentCopySlot >= CopySlots.Count ? null : CopySlots[CurrentCopySlot]; }
set {
while (CurrentCopySlot >= CopySlots.Count) { CopySlots.Add(null); }
CopySlots[CurrentCopySlot] = value;
}
}
// BlockDefinitions
internal int gbStep = 0, lbStep = 0;
internal BlockDefinition gbBlock, lbBlock;
//Undo
public VolatileArray<UndoDrawOpEntry> DrawOps = new VolatileArray<UndoDrawOpEntry>();
internal readonly object pendingDrawOpsLock = new object();
internal List<PendingDrawOp> PendingDrawOps = new List<PendingDrawOp>();
public bool showPortals, showMBs;
public string prevMsg = "";
//Movement
internal int oldIndex = -1, lastWalkthrough = -1, startFallY = -1, lastFallY = -1;
public DateTime drownTime = DateTime.MaxValue;
//Games
public DateTime lastDeath = DateTime.UtcNow;
public BlockID ModeBlock = Block.Invalid;
/// <summary> The block ID the client specifies it is currently holding in hand. </summary>
/// <remarks> This ignores /bind and /mode. GetHeldBlock() is usually preferred. </remarks>
public BlockID ClientHeldBlock = Block.Stone;
public BlockID[] BlockBindings = new BlockID[Block.ExtendedCount];
public string[] CmdBindings = new string[10];
public string lastCMD = "";
public DateTime lastCmdTime;
public sbyte c4circuitNumber = -1;
public Level level;
public bool Loading = true; //True if player is loading a map.
internal int UsingGoto = 0, GeneratingMap = 0, LoadingMuseum = 0;
public Vec3U16 lastClick = Vec3U16.Zero;
public Position PreTeleportPos;
public Orientation PreTeleportRot;
public string PreTeleportMap;
public string summonedMap;
internal Position tempPos;
// Extra storage for custom commands
public ExtrasCollection Extras = new ExtrasCollection();
SpamChecker spamChecker;
internal DateTime cmdUnblocked;
public WarpList Waypoints = new WarpList();
public DateTime LastPatrol;
public LevelPermission Rank { get { return group.Permission; } }
/// <summary> Whether player has completed login process and been sent initial map. </summary>
public bool loggedIn;
public bool verifiedName;
bool gotSQLData;
public byte ProtocolVersion;
internal byte[] fallback = new byte[256]; // fallback for classic+CPE block IDs
public bool cancelcommand, cancelchat, cancelmove;
public bool cancellogin, cancelconnecting, cancelDeath;
/// <summary> Called when a player removes or places a block.
/// NOTE: Currently this prevents the OnBlockChange event from being called. </summary>
public event SelectionBlockChange Blockchange;
public void ClearBlockchange() { ClearSelection(); }
public object blockchangeObject;
/// <summary> Called when the player has finished providing all the marks for a selection. </summary>
/// <returns> Whether to repeat this selection, if /static mode is enabled. </returns>
public delegate bool SelectionHandler(Player p, Vec3S32[] marks, object state, BlockID block);
/// <summary> Called when the player has provided a mark for a selection. </summary>
/// <remarks> i is the index of the mark, so the 'first' mark has 0 for i. </remarks>
public delegate void SelectionMarkHandler(Player p, Vec3S32[] marks, int i, object state, BlockID block);
}
}