本文整理汇总了C#中Client.SendResponse方法的典型用法代码示例。如果您正苦于以下问题:C# Client.SendResponse方法的具体用法?C# Client.SendResponse怎么用?C# Client.SendResponse使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Client
的用法示例。
在下文中一共展示了Client.SendResponse方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: ActivateEffect
public void ActivateEffect(Client Client, Effect Effect)
{
if (Effect.RemainingTime == 0)
{
return;
}
Effect.Excecute();
if (Client != null)
{
Response Response = new Response(462);
Response.AppendInt32(Effect.EffectId);
Response.AppendInt32(Effect.EffectLength);
Client.SendResponse(Response);
}
using (QueryReactor Reactor = BrickEngine.GetQueryReactor())
{
Reactor.SetQuery("UPDATE user_effects SET activated = @dt WHERE id = @effectid LIMIT 1");
Reactor.AddParam("dt", Effect.Activated);
Reactor.AddParam("effectid", Effect.Id);
Reactor.ExcuteQuery();
}
}
示例2: OnConnectRequest
public static void OnConnectRequest(Client pClient, Header pHeader, MemoryStream pData)
{
ConnectRequest connectRequest = new ConnectRequest();
if (!connectRequest.Read(pData)) return;
ConnectResponse connectResponse = new ConnectResponse();
connectResponse.ServerId.Label = 0;
connectResponse.ServerId.Epoch = DateTime.Now.ToUnixTime();
connectResponse.HasClientId = true;
connectResponse.ClientId.Label = 1;
connectResponse.ClientId.Epoch = connectResponse.ServerId.Epoch;
if (connectRequest.HasClientId) connectResponse.ClientId.Label = connectResponse.ClientId.Label;
ContentHandle contentHandle = new ContentHandle();
byte[] region = Encoding.ASCII.GetBytes("US");
contentHandle.Region = (uint)(region[0] << 8) | region[1];
byte[] usage = Encoding.ASCII.GetBytes("mtrz");
contentHandle.Usage = (uint)(usage[0] << 24) | (uint)(usage[1] << 16) | (uint)(usage[2] << 8) | usage[3];
contentHandle.Hash = new byte[] { 0x18, 0xe9, 0x8c, 0xde, 0x12, 0x83, 0x71, 0x49, 0x62, 0x19, 0x88, 0xce, 0xee, 0x55, 0x12, 0x3b,
0xf2, 0xbe, 0x83, 0x9a, 0x6d, 0xc1, 0xd6, 0xbb, 0x00, 0xa3, 0x99, 0x52, 0x06, 0x56, 0xb2, 0xa6 };
connectResponse.HasConnectionMeteringContentHandles = true;
connectResponse.ConnectionMeteringContentHandles.ContentHandles.Add(contentHandle);
pClient.PermittedServices.Add(ClientImportedServiceIds.AuthenticationServer);
//pClient.PermittedServices.Add(ClientServiceIds.ChallengeService);
//pClient.PermittedServices.Add(ClientServiceIds.ChannelService);
//pClient.PermittedServices.Add(ClientServiceIds.AchievementsService);
//pClient.PermittedServices.Add(ClientServiceIds.ReportService);
MemoryStream response = new MemoryStream(128);
connectResponse.Write(response);
pClient.SendResponse(pHeader.Token, 0, 0, null, response);
}
示例3: OnBindRequest
public static void OnBindRequest(Client pClient, Header pHeader, MemoryStream pData)
{
BindRequest bindRequest = new BindRequest();
if (!bindRequest.Read(pData)) return;
BindResponse bindResponse = new BindResponse();
foreach (uint hash in bindRequest.ImportedServiceHashes)
{
uint serviceId = 0;
if (Program.GetClientServiceId(hash, out serviceId) && !pClient.ImportedServices.Contains(serviceId))
{
if (pClient.PermittedServices.Contains(serviceId))
{
pClient.Log(ELogLevel.Debug, "Importing Service {0}", serviceId);
pClient.ImportedServices.Add(serviceId);
bindResponse.ImportedServiceIds.Add(serviceId);
}
else pClient.RequestedServices.Add(new Tuple<uint, uint>(serviceId, pHeader.Token));
}
}
if (bindResponse.HasImportedServiceIds)
{
MemoryStream response = new MemoryStream(128);
bindResponse.Write(response);
pClient.SendResponse(pHeader.Token, 0, 0, null, response);
}
}
示例4: InsertEffect
public void InsertEffect(Client Client, int EffectId, int Duration)
{
Dictionary<int, Object> Row = new Dictionary<int, object>();
Row[0] = EffectIdCounter.Next;
Row[1] = Client.GetUser().HabboId;
Row[2] = EffectId;
Row[3] = Duration;
Row[4] = string.Empty;
Effect Effect = new Effect(Row);
Effects.Add(Effect.Id, Effect);
Response Response = new Response(461);
Response.AppendInt32(EffectId);
Response.AppendInt32(Duration);
Client.SendResponse(Response);
using (QueryReactor Reactor = BrickEngine.GetQueryReactor())
{
Reactor.SetQuery("INSERT INTO user_effects (user_id, effect_id, effect_length) VALUES (@habboid, @effectid, @length)");
Reactor.AddParam("habboid", Client.GetUser().HabboId);
Reactor.AddParam("effectid", EffectId);
Reactor.AddParam("length", Duration);
Reactor.ExcuteQuery();
}
}
示例5: GiveBadge
public void GiveBadge(Client Client, string BadgeCode)
{
Dictionary<int, Object> Row = new Dictionary<int,object>();
Row[1] = Client.GetUser().HabboId;
Row[2] = BadgeCode;
Row[3] = 0;
// Add @ cache
Badges.Add(new Badge(Row));
// Add @ database
using (QueryReactor Reactor = BrickEngine.GetQueryReactor())
{
Reactor.SetQuery("INSERT INTO user_badges (user_id, badge) VALUES (@habboid, @badge)");
Reactor.AddParam("habboid", Client.GetUser().HabboId);
Reactor.AddParam("badge", BadgeCode);
Reactor.ExcuteQuery();
}
if (GetIdForBadge(BadgeCode) > 0)
{
Response ShowItem = new Response(832);
ShowItem.AppendInt32(1);
ShowItem.AppendInt32(4); // TabID
ShowItem.AppendInt32(1);
ShowItem.AppendInt32(GetIdForBadge(BadgeCode));
Client.SendResponse(ShowItem);
BrickEngine.GetItemReactor().AddNewUpdate(GetIdForBadge(BadgeCode), 4, Client.GetUser().HabboId);
}
}
示例6: UpdateBadge
public void UpdateBadge(Client Client, string BadgeCode, string UpdateBadgeCode)
{
Badge Badge = GetBadge(BadgeCode, Client.GetUser().HabboId);
if (Badge == null)
{
return;
}
// Update @ cache
Badge.BadgeCode = UpdateBadgeCode;
// Update @ database
using (QueryReactor Reactor = BrickEngine.GetQueryReactor())
{
Reactor.SetQuery("UPDATE user_badges SET badge = @newbadge WHERE user_id = @habboid AND badge = @badge LIMIT 1");
Reactor.AddParam("newbadge", UpdateBadgeCode);
Reactor.AddParam("habboid", Client.GetUser().HabboId);
Reactor.AddParam("badge", BadgeCode);
Reactor.ExcuteQuery();
}
if (GetIdForBadge(UpdateBadgeCode) > 0)
{
Response ShowItem = new Response(832);
ShowItem.AppendInt32(1);
ShowItem.AppendInt32(4); // TabID
ShowItem.AppendInt32(1);
ShowItem.AppendInt32(GetIdForBadge(BadgeCode));
Client.SendResponse(ShowItem);
BrickEngine.GetItemReactor().AddNewUpdate(GetIdForBadge(UpdateBadgeCode), 4, Client.GetUser().HabboId);
}
}