本文整理汇总了C#中Yupi.Messages.ServerMessage.AppendBool方法的典型用法代码示例。如果您正苦于以下问题:C# ServerMessage.AppendBool方法的具体用法?C# ServerMessage.AppendBool怎么用?C# ServerMessage.AppendBool使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Yupi.Messages.ServerMessage
的用法示例。
在下文中一共展示了ServerMessage.AppendBool方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Compose
/// <summary>
/// Composes the specified session.
/// </summary>
/// <param name="session">The session.</param>
/// <param name="quest">The quest.</param>
/// <returns>ServerMessage.</returns>
internal static ServerMessage Compose(GameClient session, Quest quest)
{
var amountOfQuestsInCategory = Yupi.GetGame().GetQuestManager().GetAmountOfQuestsInCategory(quest.Category);
var i = quest == null ? amountOfQuestsInCategory : quest.Number;
var i2 = quest == null ? 0 : session.GetHabbo().GetQuestProgress(quest.Id);
var serverMessage = new ServerMessage(LibraryParser.OutgoingRequest("QuestCompletedMessageComposer"));
serverMessage.AppendString(quest.Category);
serverMessage.AppendInteger(i);
serverMessage.AppendInteger(quest.Name.Contains("xmas2012") ? 1 : amountOfQuestsInCategory);
serverMessage.AppendInteger(quest == null ? 3 : quest.RewardType);
serverMessage.AppendInteger(quest == null ? 0 : quest.Id);
serverMessage.AppendBool(quest != null && session.GetHabbo().CurrentQuestId == quest.Id);
serverMessage.AppendString(quest == null ? string.Empty : quest.ActionName);
serverMessage.AppendString(quest == null ? string.Empty : quest.DataBit);
serverMessage.AppendInteger(quest == null ? 0 : quest.Reward);
serverMessage.AppendString(quest == null ? string.Empty : quest.Name);
serverMessage.AppendInteger(i2);
serverMessage.AppendInteger(quest == null ? 0u : quest.GoalData);
serverMessage.AppendInteger(quest == null ? 0 : quest.TimeUnlock);
serverMessage.AppendString("");
serverMessage.AppendString("");
serverMessage.AppendBool(true);
serverMessage.AppendBool(true);
return serverMessage;
}
示例2: ComposeIndex
/// <summary>
/// Composes the index.
/// </summary>
/// <param name="rank">The rank.</param>
/// <param name="type">The type.</param>
/// <returns>ServerMessage.</returns>
internal static ServerMessage ComposeIndex(uint rank, string type)
{
IEnumerable<CatalogPage> pages =
Yupi.GetGame().GetCatalogManager().Categories.Values.OfType<CatalogPage>().ToList();
IOrderedEnumerable<CatalogPage> sortedPages = pages.Where(x => x.ParentId == -2 && x.MinRank <= rank).OrderBy(x => x.OrderNum);
if (type == "NORMAL")
sortedPages = pages.Where(x => x.ParentId == -1 && x.MinRank <= rank).OrderBy(x => x.OrderNum);
ServerMessage message = new ServerMessage(LibraryParser.OutgoingRequest("CatalogueIndexMessageComposer"));
message.AppendBool(true);
message.AppendInteger(0);
message.AppendInteger(-1);
message.AppendString("root");
message.AppendString(string.Empty);
message.AppendInteger(0);
message.AppendInteger(sortedPages.Count());
foreach (CatalogPage cat in sortedPages)
{
message.AppendBool(cat.Visible);
message.AppendInteger(cat.IconImage);
message.AppendInteger(cat.PageId);
message.AppendString(cat.CodeName);
message.AppendString(cat.Caption);
message.AppendInteger(cat.FlatOffers.Count);
foreach (uint i in cat.FlatOffers.Keys)
message.AppendInteger(i);
IOrderedEnumerable<CatalogPage> sortedSubPages =
pages.Where(x => x.ParentId == cat.PageId && x.MinRank <= rank).OrderBy(x => x.OrderNum);
message.AppendInteger(sortedSubPages.Count());
foreach (CatalogPage subCat in sortedSubPages)
{
message.AppendBool(subCat.Visible);
message.AppendInteger(subCat.IconImage);
message.AppendInteger(subCat.PageId);
message.AppendString(subCat.CodeName);
message.AppendString(subCat.Caption);
message.AppendInteger(subCat.FlatOffers.Count);
foreach (uint i2 in subCat.FlatOffers.Keys)
message.AppendInteger(i2);
message.AppendInteger(0);
}
}
message.AppendBool(false);
message.AppendString(type);
return message;
}
示例3: Searialize
/// <summary>
/// Searializes the specified reply.
/// </summary>
/// <param name="reply">The reply.</param>
internal void Searialize(ServerMessage reply)
{
reply.AppendInteger(UserId);
reply.AppendString(UserName);
reply.AppendString(Motto);
reply.AppendBool(Yupi.GetGame().GetClientManager().GetClient(UserId) != null);
reply.AppendBool(false);
reply.AppendString(string.Empty);
reply.AppendInteger(0);
reply.AppendString(Look);
reply.AppendString(LastOnline);
}
示例4: GenerateMessage
internal static void GenerateMessage(Pet pet)
{
ServerMessage serverMessage = new ServerMessage(LibraryParser.OutgoingRequest("RespectPetComposer"));
serverMessage.AppendInteger(pet.VirtualId);
serverMessage.AppendBool(true);
pet.Room.SendMessage(serverMessage);
}
示例5: Serialize
internal void Serialize(ref ServerMessage message)
{
Habbo habbo = Yupi.GetHabboById(UserId);
message.AppendInteger(Yupi.DifferenceInMilliSeconds(TimeStamp, DateTime.Now));
message.AppendInteger(UserId);
message.AppendString(habbo == null ? "*User not found*" : habbo.UserName);
message.AppendString(Message);
message.AppendBool(GlobalMessage);
}
示例6: Compose
/// <summary>
/// Composes the specified session.
/// </summary>
/// <param name="session">The session.</param>
/// <param name="quests">The quests.</param>
/// <param name="send">if set to <c>true</c> [send].</param>
/// <returns>ServerMessage.</returns>
internal static ServerMessage Compose(GameClient session, List<Quest> quests, bool send)
{
var dictionary = new Dictionary<string, int>();
var dictionary2 = new Dictionary<string, Quest>();
foreach (var current in quests)
{
if (!current.Category.Contains("xmas2012"))
{
if (!dictionary.ContainsKey(current.Category))
{
dictionary.Add(current.Category, 1);
dictionary2.Add(current.Category, null);
}
if (current.Number >= dictionary[current.Category])
{
var questProgress = session.GetHabbo().GetQuestProgress(current.Id);
if (session.GetHabbo().CurrentQuestId != current.Id && questProgress >= current.GoalData)
{
dictionary[current.Category] = current.Number + 1;
}
}
}
}
foreach (var current2 in quests)
{
foreach (var current3 in dictionary)
{
if (!current2.Category.Contains("xmas2012") && current2.Category == current3.Key &&
current2.Number == current3.Value)
{
dictionary2[current3.Key] = current2;
break;
}
}
}
var serverMessage = new ServerMessage(LibraryParser.OutgoingRequest("QuestListMessageComposer"));
serverMessage.AppendInteger(dictionary2.Count);
foreach (var current4 in dictionary2)
{
if (current4.Value != null)
{
SerializeQuest(serverMessage, session, current4.Value, current4.Key);
}
}
foreach (var current5 in dictionary2)
{
if (current5.Value == null)
{
SerializeQuest(serverMessage, session, current5.Value, current5.Key);
}
}
serverMessage.AppendBool(send);
return serverMessage;
}
示例7: SerializePromotionsResultListFlatcats
/// <summary>
/// Serializes the promotions result list flatcats.
/// </summary>
/// <param name="flatCatId">The flat cat identifier.</param>
/// <param name="direct">if set to <c>true</c> [direct].</param>
/// <param name="message">The message.</param>
internal static void SerializePromotionsResultListFlatcats(int flatCatId, bool direct, ServerMessage message)
{
PublicCategory flatCat = Yupi.GetGame().GetNavigator().GetFlatCat(flatCatId);
message.AppendString("new_ads");
message.AppendString(flatCat.Caption);
message.AppendInteger(0);
message.AppendBool(true);
message.AppendInteger(-1);
KeyValuePair<RoomData, uint>[] rooms = Yupi.GetGame().GetRoomManager().GetEventRooms();
Yupi.GetGame().GetNavigator().SerializeNavigatorPopularRoomsNews(ref message, rooms, flatCatId, direct);
}
示例8: SerializeSearchResultListFlatcats
/// <summary>
/// Serializes the search result list flatcats.
/// </summary>
/// <param name="flatCatId">The flat cat identifier.</param>
/// <param name="direct">if set to <c>true</c> [direct].</param>
/// <param name="message">The message.</param>
internal static void SerializeSearchResultListFlatcats(int flatCatId, bool direct, ServerMessage message)
{
PublicCategory flatCat = Yupi.GetGame().GetNavigator().GetFlatCat(flatCatId);
if (flatCat == null)
return;
message.AppendString($"category__{flatCat.Caption}");
message.AppendString(flatCat.Caption);
message.AppendInteger(0);
message.AppendBool(true);
message.AppendInteger(-1);
KeyValuePair<RoomData, uint>[] rooms = Yupi.GetGame().GetRoomManager().GetActiveRooms();
Yupi.GetGame().GetNavigator().SerializeNavigatorPopularRoomsNews(ref message, rooms, flatCatId, direct);
}
示例9: GetPacket
/// <summary>
/// Gets the packet.
/// </summary>
/// <returns>ServerMessage.</returns>
internal ServerMessage GetPacket()
{
ServerMessage serverMessage = new ServerMessage(LibraryParser.OutgoingRequest("EffectsInventoryMessageComposer"));
serverMessage.AppendInteger(_effects.Count);
foreach (AvatarEffect current in _effects)
{
serverMessage.AppendInteger(current.EffectId);
serverMessage.AppendInteger(current.Type);
serverMessage.AppendInteger(current.TotalDuration);
serverMessage.AppendInteger(0);
serverMessage.AppendInteger(current.TimeLeft);
serverMessage.AppendBool(current.TotalDuration == -1);
}
return serverMessage;
}
示例10: Compose
/// <summary>
/// Composes the specified achievement.
/// </summary>
/// <param name="achievement">The achievement.</param>
/// <param name="level">The level.</param>
/// <param name="pointReward">The point reward.</param>
/// <param name="pixelReward">The pixel reward.</param>
/// <returns>ServerMessage.</returns>
internal static ServerMessage Compose(Achievement achievement, uint level, uint pointReward, uint pixelReward)
{
ServerMessage serverMessage = new ServerMessage(LibraryParser.OutgoingRequest("UnlockAchievementMessageComposer"));
serverMessage.AppendInteger(achievement.Id);
serverMessage.AppendInteger(level);
serverMessage.AppendInteger(144);
serverMessage.AppendString($"{achievement.GroupName}{level}");
serverMessage.AppendInteger(pointReward);
serverMessage.AppendInteger(pixelReward);
serverMessage.AppendInteger(0);
serverMessage.AppendInteger(10);
serverMessage.AppendInteger(21);
serverMessage.AppendString(level > 1 ? $"{achievement.GroupName}{level - 1}" : string.Empty);
serverMessage.AppendString(achievement.Category);
serverMessage.AppendBool(true);
return serverMessage;
}
示例11: Compose
/// <summary>
/// Composes the specified achievement.
/// </summary>
/// <param name="achievement">The achievement.</param>
/// <param name="targetLevel">The target level.</param>
/// <param name="targetLevelData">The target level data.</param>
/// <param name="totalLevels">The total levels.</param>
/// <param name="userData">The user data.</param>
/// <returns>ServerMessage.</returns>
internal static ServerMessage Compose(Achievement achievement, uint targetLevel, AchievementLevel targetLevelData, uint totalLevels, UserAchievement userData)
{
ServerMessage serverMessage = new ServerMessage(LibraryParser.OutgoingRequest("AchievementProgressMessageComposer"));
serverMessage.AppendInteger(achievement.Id);
serverMessage.AppendInteger(targetLevel);
serverMessage.AppendString($"{achievement.GroupName}{targetLevel}");
serverMessage.AppendInteger(targetLevelData.Requirement);
serverMessage.AppendInteger(targetLevelData.Requirement);
serverMessage.AppendInteger(targetLevelData.RewardPixels);
serverMessage.AppendInteger(0);
serverMessage.AppendInteger(userData.Progress);
serverMessage.AppendBool(userData.Level >= totalLevels);
serverMessage.AppendString(achievement.Category);
serverMessage.AppendString(string.Empty);
serverMessage.AppendInteger(totalLevels);
serverMessage.AppendInteger(0);
return serverMessage;
}
示例12: Compose
/// <summary>
/// Composes the specified session.
/// </summary>
/// <param name="session">The session.</param>
/// <param name="achievements">The achievements.</param>
/// <returns>ServerMessage.</returns>
internal static ServerMessage Compose(GameClient session, List<Achievement> achievements)
{
ServerMessage serverMessage = new ServerMessage(LibraryParser.OutgoingRequest("AchievementListMessageComposer"));
serverMessage.AppendInteger(achievements.Count);
foreach (Achievement achievement in achievements)
{
UserAchievement achievementData = session.GetHabbo().GetAchievementData(achievement.GroupName);
uint i = achievementData?.Level + 1 ?? 1;
uint count = (uint) achievement.Levels.Count;
if (i > count)
i = count;
AchievementLevel achievementLevel = achievement.Levels[i];
AchievementLevel oldLevel = achievement.Levels.ContainsKey(i - 1) ? achievement.Levels[i - 1] : achievementLevel;
serverMessage.AppendInteger(achievement.Id);
serverMessage.AppendInteger(i);
serverMessage.AppendString($"{achievement.GroupName}{i}");
serverMessage.AppendInteger(oldLevel.Requirement);
serverMessage.AppendInteger(achievementLevel.Requirement);
serverMessage.AppendInteger(achievementLevel.RewardPoints);
serverMessage.AppendInteger(0);
serverMessage.AppendInteger(achievementData?.Progress ?? 0);
serverMessage.AppendBool(!(achievementData == null || achievementData.Level < count));
serverMessage.AppendString(achievement.Category);
serverMessage.AppendString(string.Empty);
serverMessage.AppendInteger(count);
serverMessage.AppendInteger(0);
}
serverMessage.AppendString(string.Empty);
return serverMessage;
}
示例13: SerializeQuest
/// <summary>
/// Serializes the quest.
/// </summary>
/// <param name="message">The message.</param>
/// <param name="session">The session.</param>
/// <param name="quest">The quest.</param>
/// <param name="category">The category.</param>
internal static void SerializeQuest(ServerMessage message, GameClient session, Quest quest, string category)
{
if (message == null || session == null)
{
return;
}
var amountOfQuestsInCategory = Yupi.GetGame().GetQuestManager().GetAmountOfQuestsInCategory(category);
{
var num = quest == null ? amountOfQuestsInCategory : quest.Number - 1;
var num2 = quest == null ? 0 : session.GetHabbo().GetQuestProgress(quest.Id);
if (quest != null && quest.IsCompleted(num2))
{
num++;
}
message.AppendString(category);
message.AppendInteger(quest == null ? 0 : (quest.Category.Contains("xmas2012") ? 0 : num));
message.AppendInteger(quest == null
? 0
: (quest.Category.Contains("xmas2012") ? 0 : amountOfQuestsInCategory));
message.AppendInteger(quest?.RewardType ?? 3);
message.AppendInteger(quest?.Id ?? 0);
message.AppendBool(quest != null && session.GetHabbo().CurrentQuestId == quest.Id);
message.AppendString(quest == null ? string.Empty : quest.ActionName);
message.AppendString(quest == null ? string.Empty : quest.DataBit);
message.AppendInteger(quest?.Reward ?? 0);
message.AppendString(quest == null ? string.Empty : quest.Name);
message.AppendInteger(num2);
message.AppendInteger(quest?.GoalData ?? 0u);
message.AppendInteger(quest?.TimeUnlock ?? 0);
message.AppendString(string.Empty);
message.AppendString(string.Empty);
message.AppendBool(true);
}
}
示例14: OnTrigger
public override void OnTrigger(GameClient session, RoomItem item, int request, bool hasRights)
{
if (session == null || item?.GetRoom() == null || !hasRights)
return;
IWiredItem wired = item.GetRoom().GetWiredHandler().GetWired(item);
if (wired == null)
return;
string extraInfo = wired.OtherString;
bool flag = wired.OtherBool;
int delay = wired.Delay/500;
List<RoomItem> list = wired.Items.Where(roomItem => roomItem != null).ToList();
string extraString = wired.OtherExtraString;
string extraString2 = wired.OtherExtraString2;
switch (item.GetBaseItem().InteractionType)
{
case Interaction.TriggerTimer:
{
ServerMessage serverMessage = new ServerMessage(LibraryParser.OutgoingRequest("WiredTriggerMessageComposer"));
serverMessage.AppendBool(false);
serverMessage.AppendInteger(5);
serverMessage.AppendInteger(list.Count);
foreach (RoomItem current in list) serverMessage.AppendInteger(current.Id);
serverMessage.AppendInteger(item.GetBaseItem().SpriteId);
serverMessage.AppendInteger(item.Id);
serverMessage.AppendString(extraInfo);
serverMessage.AppendInteger(1);
serverMessage.AppendInteger(delay);
serverMessage.AppendInteger(1);
serverMessage.AppendInteger(3);
serverMessage.AppendInteger(0);
serverMessage.AppendInteger(0);
session.SendMessage(serverMessage);
return;
}
case Interaction.TriggerRoomEnter:
{
ServerMessage serverMessage2 = new ServerMessage(LibraryParser.OutgoingRequest("WiredTriggerMessageComposer"));
serverMessage2.AppendBool(false);
serverMessage2.AppendInteger(0);
serverMessage2.AppendInteger(list.Count);
foreach (RoomItem current2 in list) serverMessage2.AppendInteger(current2.Id);
serverMessage2.AppendInteger(item.GetBaseItem().SpriteId);
serverMessage2.AppendInteger(item.Id);
serverMessage2.AppendString(extraInfo);
serverMessage2.AppendInteger(0);
serverMessage2.AppendInteger(0);
serverMessage2.AppendInteger(7);
serverMessage2.AppendInteger(0);
serverMessage2.AppendInteger(0);
serverMessage2.AppendInteger(0);
session.SendMessage(serverMessage2);
return;
}
case Interaction.TriggerGameEnd:
{
ServerMessage serverMessage3 = new ServerMessage(LibraryParser.OutgoingRequest("WiredTriggerMessageComposer"));
serverMessage3.AppendBool(false);
serverMessage3.AppendInteger(0);
serverMessage3.AppendInteger(list.Count);
foreach (RoomItem current3 in list) serverMessage3.AppendInteger(current3.Id);
serverMessage3.AppendInteger(item.GetBaseItem().SpriteId);
serverMessage3.AppendInteger(item.Id);
serverMessage3.AppendString(extraInfo);
serverMessage3.AppendInteger(0);
serverMessage3.AppendInteger(0);
serverMessage3.AppendInteger(8);
serverMessage3.AppendInteger(0);
serverMessage3.AppendInteger(0);
serverMessage3.AppendInteger(0);
session.SendMessage(serverMessage3);
return;
}
case Interaction.TriggerGameStart:
{
ServerMessage serverMessage4 = new ServerMessage(LibraryParser.OutgoingRequest("WiredTriggerMessageComposer"));
serverMessage4.AppendBool(false);
serverMessage4.AppendInteger(0);
serverMessage4.AppendInteger(list.Count);
foreach (RoomItem current4 in list) serverMessage4.AppendInteger(current4.Id);
serverMessage4.AppendInteger(item.GetBaseItem().SpriteId);
serverMessage4.AppendInteger(item.Id);
serverMessage4.AppendString(extraInfo);
serverMessage4.AppendInteger(0);
serverMessage4.AppendInteger(0);
serverMessage4.AppendInteger(8);
serverMessage4.AppendInteger(0);
serverMessage4.AppendInteger(0);
serverMessage4.AppendInteger(0);
session.SendMessage(serverMessage4);
return;
}
case Interaction.TriggerLongRepeater:
{
ServerMessage serverMessage = new ServerMessage(LibraryParser.OutgoingRequest("WiredTriggerMessageComposer"));
serverMessage.AppendBool(false);
serverMessage.AppendInteger(5);
//.........这里部分代码省略.........
示例15: SerializeGroupInfo
/// <summary>
/// Serializes the theGroup information.
/// </summary>
/// <param name="group">The theGroup.</param>
/// <param name="response">The response.</param>
/// <param name="session">The session.</param>
/// <param name="room">The room.</param>
/// <param name="newWindow">if set to <c>true</c> [new window].</param>
internal void SerializeGroupInfo(Group group, ServerMessage response, GameClient session, Room room,
bool newWindow = false)
{
if (room == null || group == null)
return;
DateTime dateTime = new DateTime(1970, 1, 1, 0, 0, 0, 0);
DateTime dateTime2 = dateTime.AddSeconds(group.CreateTime);
response.Init(LibraryParser.OutgoingRequest("GroupDataMessageComposer"));
response.AppendInteger(group.Id);
response.AppendBool(true);
response.AppendInteger(group.State);
response.AppendString(group.Name);
response.AppendString(group.Description);
response.AppendString(group.Badge);
response.AppendInteger(group.RoomId);
response.AppendString(Yupi.GetGame().GetRoomManager().GenerateRoomData(@group.RoomId) == null
? "No room found.."
: Yupi.GetGame().GetRoomManager().GenerateRoomData(group.RoomId).Name);
response.AppendInteger(@group.CreatorId == session.GetHabbo().Id
? 3
: (group.Requests.ContainsKey(session.GetHabbo().Id)
? 2
: (group.Members.ContainsKey(session.GetHabbo().Id) ? 1 : 0)));
response.AppendInteger(group.Members.Count);
response.AppendBool(session.GetHabbo().FavouriteGroup == group.Id);
response.AppendString($"{dateTime2.Day.ToString("00")}-{dateTime2.Month.ToString("00")}-{dateTime2.Year}");
response.AppendBool(group.CreatorId == session.GetHabbo().Id);
response.AppendBool(group.Admins.ContainsKey(session.GetHabbo().Id));
response.AppendString(Yupi.GetHabboById(@group.CreatorId) == null
? string.Empty
: Yupi.GetHabboById(group.CreatorId).UserName);
response.AppendBool(newWindow);
response.AppendBool(group.AdminOnlyDeco == 0u);
response.AppendInteger(group.Requests.Count);
response.AppendBool(group.Forum.Id != 0);
room.SendMessage(response);
}