-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathWCellUser.cs
160 lines (124 loc) · 3.84 KB
/
WCellUser.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
using System;
using System.Collections.Generic;
using Squishy.Irc;
using WCell.Constants;
using WCell.Constants.Misc;
using WCell.Constants.Factions;
using WCell.Core;
using WCell.RealmServer;
using WCell.RealmServer.Chat;
using WCell.RealmServer.Commands;
using WCell.RealmServer.Database;
using WCell.RealmServer.Entities;
using WCell.RealmServer.Misc;
using WCell.RealmServer.Privileges;
using WCell.Util.Commands;
using WCell.RealmServer.Help.Tickets;
namespace IRCAddon
{
public class WCellUser : IUser, ITicketHandler
{
private readonly RealmAccount m_Acc;
private readonly List<ChatChannel> m_channels = new List<ChatChannel>();
public WCellUser(RealmAccount acc, IrcUser user)
{
IrcUser = user;
m_Acc = acc;
EntityId = EntityId.GetPlayerId(CharacterRecord.NextId());
}
public IrcUser IrcUser { get; private set; }
#region Implementation of IEntity
public EntityId EntityId { get; private set; }
#endregion
#region Implementation of INamed
public string Name
{
get { return IrcUser.Nick; }
}
#endregion
#region Implementation of IPacketReceiver
/// <summary>
/// Unimportant
/// </summary>
/// <param name="packet"></param>
public void Send(RealmPacketOut packet)
{
}
#endregion
#region Implementation of IGenericChatTarget
public void SendMessage(string message)
{
IrcUser.Msg(message);
}
public void SendMessage(IChatter sender, string message)
{
IrcUser.Msg("[" + sender.Name + "] " + message);
}
#endregion
#region Implementation of IChatter
public ChatTag ChatTag
{
get { return Role.IsStaff ? ChatTag.GM : ChatTag.None; }
}
public ChatLanguage SpokenLanguage
{
get { return ChatLanguage.Universal; }
}
//void IChatter.ReceiveMessage(IChatter sender, ChatChannel chan, string message)
//{
//}
#endregion
#region Implementation of IHasRole
public RoleGroup Role
{
get { return m_Acc.Role; }
}
#endregion
#region Implementation of IUser
public bool IsIgnoring(IUser user)
{
return false;
}
/// <summary>
/// We have no Target by default
/// </summary>
public Unit Target
{
get { return null; }
}
public BaseCommand<RealmServerCmdArgs> SelectedCommand { get; set; }
/// <summary>
/// List of ingame Channels this User is in, is going to be important
/// when you want to let them join Channels.
/// </summary>
public List<ChatChannel> ChatChannels
{
get { return m_channels; }
}
/// <summary>
/// Doesn't quite matter
/// </summary>
public FactionGroup FactionGroup
{
get { return FactionGroup.Horde; }
}
public ClientLocale Locale
{
get { return m_Acc.Locale; }
set { } // TODO: Work out if this is appropriate / What it should be set to.
}
#endregion
public Ticket HandlingTicket
{
get; set;
}
#region ITicketHandler Members
// Only staff members can handle tickets anyway.
// Therefor they cannot call ticket handling commands without being staff
public bool MayHandle(Ticket ticket)
{
return m_Acc.Role.IsStaff;
}
#endregion
}
}