本文整理汇总了C#中BrickEmulator.Messages.Response.Initialize方法的典型用法代码示例。如果您正苦于以下问题:C# Response.Initialize方法的具体用法?C# Response.Initialize怎么用?C# Response.Initialize使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类BrickEmulator.Messages.Response
的用法示例。
在下文中一共展示了Response.Initialize方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: GetSecondairResponse
public void GetSecondairResponse(Client Client)
{
Response PasteLink = new Response(166);
PasteLink.AppendStringWithBreak("/client/private/" + Id + "/id");
Client.SendResponse(PasteLink);
Response ModelParams = new Response(69);
ModelParams.AppendStringWithBreak(ModelParam.ToLower());
ModelParams.AppendInt32(Id);
Client.SendResponse(ModelParams);
Response Environment = new Response();
if (!Wallpaper.Equals("0.0"))
{
Environment.Initialize(46);
Environment.AppendStringWithBreak("wallpaper");
Environment.AppendStringWithBreak(Wallpaper);
}
if (!Floor.Equals("0.0"))
{
Environment.Initialize(46);
Environment.AppendStringWithBreak("floor");
Environment.AppendStringWithBreak(Floor);
}
Environment.Initialize(46);
Environment.AppendStringWithBreak("landscape");
Environment.AppendStringWithBreak(Landscape);
Environment.Initialize(345);
if (GetRoomEngine().HasRights(Client.GetUser().HabboId, RightsType.Founder) || Client.GetUser().VotedRooms.Contains(Id))
{
Environment.AppendInt32(Rating);
}
else
{
Environment.AppendInt32(-1);
}
Environment.Initialize(370);
if (Event != null)
{
Event.GetResponse(Environment);
}
else
{
Environment.AppendRawInt32(-1);
Environment.AppendChar(2);
}
Client.SendResponse(Environment);
}
示例2: EndEditRoom
//.........这里部分代码省略.........
Commands.Add("tags = @tags");
Params.Add("tags", SplittedTags.ToString());
Room.Tags = Tags;
}
if (!Room.AllowPets.Equals(AllowPets))
{
Commands.Add("allow_pets = @allow_pets");
Params.Add("allow_pets", AllowPets ? 1 : 0);
Room.AllowPets = AllowPets;
}
if (!Room.AllowPetsEat.Equals(AllowPetsEat))
{
Commands.Add("allow_pets_eat = @allow_pets_eat");
Params.Add("allow_pets_eat", AllowPetsEat ? 1 : 0);
Room.AllowPetsEat = AllowPetsEat;
}
if (!Room.AllowWalkthough.Equals(AllowWalkthough))
{
Commands.Add("allow_walkthough = @allow_walkthough");
Params.Add("allow_walkthough", AllowWalkthough ? 1 : 0);
Room.AllowWalkthough = AllowWalkthough;
}
if (!Room.AllowHideWall.Equals(AllowHideWall))
{
Commands.Add("allow_hidewall = @allow_hidewall");
Params.Add("allow_hidewall", AllowHideWall ? 1 : 0);
Room.AllowHideWall = AllowHideWall;
}
if (!Room.WallThick.Equals(WallThick))
{
Commands.Add("walls_thick = @walls_thick");
Params.Add("walls_thick", WallThick);
Room.WallThick = WallThick;
}
if (!Room.FloorThick.Equals(FloorThick))
{
Commands.Add("floors_thick = @floors_thick");
Params.Add("floors_thick", FloorThick);
Room.FloorThick = FloorThick;
}
Response Data = new Response(454);
Data.AppendBoolean(true);
Room.GetNavigatorResponse(Data, false);
Client.SendRoomResponse(Data);
Response Response = new Response();
Response.Initialize(467);
Response.AppendInt32(Client.GetUser().RoomId);
Response.Initialize(456);
Response.AppendInt32(Client.GetUser().RoomId);
Client.SendResponse(Response);
Response RoomStruct = new Response(472);
RoomStruct.AppendBoolean(AllowHideWall);
RoomStruct.AppendInt32(WallThick);
RoomStruct.AppendInt32(FloorThick);
Client.SendRoomResponse(RoomStruct);
if (Commands.Count > 0)
{
using (QueryReactor Reactor = BrickEngine.GetQueryReactor())
{
StringBuilder Builder = new StringBuilder();
Builder.Append("UPDATE private_rooms SET ");
int i = 0;
foreach (string Command in Commands)
{
i++;
Builder.Append(Command);
if (i < Commands.Count)
{
Builder.Append(", ");
}
}
Builder.Append(" WHERE id = @roomid LIMIT 1");
Reactor.SetQuery(Builder.ToString());
foreach (KeyValuePair<string, Object> kvp in Params)
{
Reactor.AddParam(kvp.Key, kvp.Value);
}
Reactor.AddParam("roomid", Room.Id);
Reactor.ExcuteQuery();
}
}
}
示例3: BeginEnterRoom
public Boolean BeginEnterRoom(Client Client, string Password)
{
RoomEnterMessage EnterMessage = TryEnterRoom(Client,Password);
if (!EnterMessage.Equals(RoomEnterMessage.Accepted))
{
Response ErrorResponse = new Response();
if (EnterMessage.Equals(RoomEnterMessage.Banned))
{
ErrorResponse.Initialize(224);
ErrorResponse.AppendInt32(4);
ErrorResponse.Initialize(18);
Client.SendResponse(ErrorResponse);
return false;
}
else if (EnterMessage.Equals(RoomEnterMessage.LimitUsers))
{
ErrorResponse.Initialize(224);
ErrorResponse.AppendInt32(1);
ErrorResponse.Initialize(18);
Client.SendResponse(ErrorResponse);
return false;
}
else if (EnterMessage.Equals(RoomEnterMessage.NoAnswer))
{
Client.SendResponse(new Response(131));
return false;
}
else if (EnterMessage.Equals(RoomEnterMessage.WrongPassword))
{
ErrorResponse.Initialize(33);
ErrorResponse.AppendInt32(-100002);
ErrorResponse.Initialize(18);
Client.SendResponse(ErrorResponse);
return false;
}
}
else
{
Client.SendResponse(new Response(19));
return true;
}
return false;
}
示例4: GetResponse
public void GetResponse(Client Client, Response Response)
{
var Effects = GetEffectsForUser(Client.GetUser().HabboId);
Response.Initialize(460);
Response.AppendInt32(Effects.Count);
foreach (Effect Effect in Effects)
{
Effect.GetResponse(Response);
}
}
示例5: UpdateRoomIcon
private void UpdateRoomIcon(Client Client, Request Request)
{
if (!Client.GetUser().IsInRoom)
{
return;
}
int Q = Request.PopWiredInt32();
if (!Client.GetUser().GetRoom().GetRoomEngine().HasRights(Client.GetUser().HabboId, Rooms.RightsType.Founder))
{
return;
}
var Icons = new Dictionary<int, int>();
int BackgroundIcon = Request.PopWiredInt32();
if (BackgroundIcon < 1 || BackgroundIcon > 24)
{
BackgroundIcon = 1;
}
int ForegroundIcon = Request.PopWiredInt32();
if (ForegroundIcon < 0 || ForegroundIcon > 11)
{
ForegroundIcon = 0;
}
int IconsAmount = Request.PopWiredInt32();
for (int i = 0; i < IconsAmount; i++)
{
int SlotId = Request.PopWiredInt32();
int Icon = Request.PopWiredInt32();
if (SlotId < 0 || SlotId > 10 || Icon < 1 || Icon > 27)
{
continue;
}
if (!Icons.ContainsKey(SlotId))
{
Icons.Add(SlotId, Icon);
}
}
int x = 0;
StringBuilder Query = new StringBuilder();
foreach (KeyValuePair<int, int> kvp in Icons)
{
if (x < Icons.Count)
{
Query.Append(',');
}
Query.Append(kvp.Key);
Query.Append('.');
Query.Append(kvp.Value);
x++;
}
Client.GetUser().GetRoom().Icon = new RoomIcon(Client.GetUser().GetRoom().Id, BackgroundIcon, ForegroundIcon, Query.ToString());
Response Response = new Response();
Response.Initialize(457);
Response.AppendInt32(Client.GetUser().RoomId);
Response.AppendBoolean(true);
Response.Initialize(456);
Response.AppendInt32(Client.GetUser().RoomId);
Client.SendResponse(Response);
Response Data = new Response(454);
Data.AppendBoolean(false);
Client.GetUser().GetRoom().GetNavigatorResponse(Data, false);
Client.SendRoomResponse(Data);
using (QueryReactor Reactor = BrickEngine.GetQueryReactor())
{
Reactor.SetQuery("UPDATE private_rooms SET nav_icon_bg = @bg, nav_icon_fg = @fg, nav_icons = @icons WHERE id = @roomid LIMIT 1");
Reactor.AddParam("bg", BackgroundIcon);
Reactor.AddParam("fg", ForegroundIcon);
Reactor.AddParam("icons", Query.ToString());
Reactor.AddParam("roomid", Client.GetUser().RoomId);
Reactor.ExcuteQuery();
}
}
示例6: GetLoginResponse
public Response GetLoginResponse()
{
LoadAchievements();
LoadFavoriteRooms();
LoadIgnores();
LoadQuests();
LoadTags();
BrickEngine.GetAchievementReactor().UpdateUsersAchievement(GetClient(), 1);
Response Builder = new Response();
BrickEngine.GetEffectsHandler().GetResponse(GetClient(), Builder);
var FloorItems = BrickEngine.GetItemReactor().GetUnseenItems(HabboId, 1);
var WallItems = BrickEngine.GetItemReactor().GetUnseenItems(HabboId, 2);
var PetItems = BrickEngine.GetItemReactor().GetUnseenItems(HabboId, 3);
var BadgeItems = BrickEngine.GetItemReactor().GetUnseenItems(HabboId, 4);
Builder.Initialize(832);
Builder.AppendInt32(FloorItems.Count + WallItems.Count + PetItems.Count + BadgeItems.Count);
if (FloorItems.Count > 0)
{
Builder.AppendInt32(1);
Builder.AppendInt32(FloorItems.Count);
foreach (int ItemId in FloorItems)
{
Builder.AppendInt32(ItemId);
}
}
if (WallItems.Count > 0)
{
Builder.AppendInt32(2);
Builder.AppendInt32(WallItems.Count);
foreach (int ItemId in WallItems)
{
Builder.AppendInt32(ItemId);
}
}
if (PetItems.Count > 0)
{
Builder.AppendInt32(3);
Builder.AppendInt32(PetItems.Count);
foreach (int PetId in PetItems)
{
Builder.AppendInt32(PetId);
}
}
if (BadgeItems.Count > 0)
{
Builder.AppendInt32(4);
Builder.AppendInt32(BadgeItems.Count);
foreach (int BadgeId in BadgeItems)
{
Builder.AppendInt32(BadgeId);
}
}
AtLogin();
Builder.Initialize(455);
Builder.AppendInt32(HomeRoomId);
Builder.Initialize(458);
Builder.AppendInt32(30);
Builder.AppendInt32(FavoriteRoomIds.Count);
FavoriteRoomIds.ToList().ForEach(Builder.AppendInt32);
Builder.Initialize(2);
if (GetMembership() != null)
{
Builder.AppendInt32(GetMembership().MemberScale + 1);
}
else
{
Builder.AppendInt32(0);
}
Builder.Initialize(290);
Builder.AppendBoolean(true);
Builder.AppendBoolean(false);
Builder.Initialize(517);
Builder.AppendBoolean(true);
Builder.Initialize(628);
Builder.AppendBoolean(true);
Builder.AppendBoolean(false);
Builder.AppendInt32(Pixels);
return Builder;
}
示例7: ChangeName
private void ChangeName(Client Client, Request Request)
{
string Username = BrickEngine.CleanString(Request.PopFixedString());
Boolean UpdatedName = false;
if (!Client.GetUser().Username.ToLower().Equals(Username.ToLower()))
{
foreach (VirtualRoom Room in BrickEngine.GetRoomReactor().GetMe(Client.GetUser().HabboId))
{
if (Room.InternalState.Equals(RoomRunningState.Alive))
{
Boolean IsMatch = false;
if (Regex.IsMatch(Room.Name.ToLower(), Client.GetUser().Username.ToLower()))
{
Room.Name = Room.Name.Replace(Client.GetUser().Username, Username);
IsMatch = true;
}
if (Regex.IsMatch(Room.Description.ToLower(), Client.GetUser().Username.ToLower()))
{
Room.Description = Room.Description.Replace(Client.GetUser().Username, Username);
IsMatch = true;
}
if (IsMatch)
{
using (QueryReactor Reactor = BrickEngine.GetQueryReactor())
{
Reactor.SetQuery("UPDATE private_rooms SET name = @name, description = @desc WHERE id = @roomid LIMIT 1");
Reactor.AddParam("name", Room.Name);
Reactor.AddParam("desc", Room.Description);
Reactor.AddParam("roomid", Room.Id);
Reactor.ExcuteQuery();
}
Response Data = new Response(454);
Data.AppendBoolean(true);
Room.GetNavigatorResponse(Data, false);
Client.SendRoomResponse(Data);
}
}
}
Client.GetUser().Username = Username;
Client.GetUser().RefreshUser();
Client.Notif("Successfully changed name, reload your room to see changes.", false);
if (Client.GetUser().EnableShowOnline)
{
lock (Client.GetUser().MessengerLocker)
{
BrickEngine.GetMessengerHandler().AlertStatusFriends(Client.GetUser(), true);
}
}
UpdatedName = true;
}
Client.GetUser().ProgressedNewbie = true;
Response Response = new Response();
Response.Initialize(571);
Response.AppendBoolean(false);
Response.AppendStringWithBreak(Username);
Response.AppendBoolean(false);
Response.Initialize(570);
Response.AppendBoolean(false);
Response.AppendStringWithBreak(Username);
Response.AppendBoolean(false);
Client.SendResponse(Response);
BrickEngine.GetAchievementReactor().UpdateUsersAchievement(Client, 4);
using (QueryReactor Reactor = BrickEngine.GetQueryReactor())
{
Reactor.SetQuery("UPDATE users SET changed_name = '1' WHERE id = @habboid");
Reactor.AddParam("habboid", Client.GetUser().HabboId);
Reactor.ExcuteQuery();
}
if (UpdatedName)
{
using (QueryReactor Reactor = BrickEngine.GetQueryReactor())
{
Reactor.SetQuery("UPDATE users SET username = @username WHERE id = @habboid");
Reactor.AddParam("habboid", Client.GetUser().HabboId);
Reactor.AddParam("username", Username);
Reactor.ExcuteQuery();
}
}
}
示例8: GetTriggerResponse
public Response GetTriggerResponse()
{
Response Response = new Response();
if (GetBaseItem().InternalType.ToLower().Equals("s"))
{
Response.Initialize(88);
Response.AppendRawInt32(Id);
Response.AppendChar(2);
Response.AppendStringWithBreak(ExtraData);
}
else
{
Response.Initialize(85);
GetRoomResponse(Response);
}
return Response;
}
示例9: HandleIncomingItemPickUp
public void HandleIncomingItemPickUp(Item Item, VirtualRoomUser User)
{
// Handling Messages (FIRST, to avoid laggys)
Response Response = new Response();
if (Item.GetBaseItem().InternalType.ToLower().Equals("s"))
{
Response.Initialize(94);
}
else
{
Response.Initialize(84);
}
Response.AppendRawInt32(Item.Id);
Response.AppendChar(2);
Response.AppendBoolean(false);
BroadcastResponse(Response);
Item.GetTrigger().OnRemove(Item, User);
if (Item.GetBaseItem().ExternalType.ToLower().Equals("default"))
{
Item.ExtraData = "0";
// Update Info & MySQL
using (QueryReactor Reactor = BrickEngine.GetQueryReactor())
{
Reactor.SetQuery("UPDATE items SET room_id = '0', extra_data = '0',point_wall = '' WHERE id = @itemid LIMIT 1");
Reactor.AddParam("itemid", Item.Id);
Reactor.ExcuteQuery();
}
}
else
{
// Update Info & MySQL
using (QueryReactor Reactor = BrickEngine.GetQueryReactor())
{
Reactor.SetQuery("UPDATE items SET room_id = '0', point_wall = '' WHERE id = @itemid LIMIT 1");
Reactor.AddParam("itemid", Item.Id);
Reactor.ExcuteQuery();
}
}
}