本文整理汇总了C#中Azure.Messages.ServerMessage类的典型用法代码示例。如果您正苦于以下问题:C# ServerMessage类的具体用法?C# ServerMessage怎么用?C# ServerMessage使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
ServerMessage类属于Azure.Messages命名空间,在下文中一共展示了ServerMessage类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: 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;
}
int amountOfQuestsInCategory = AzureEmulator.GetGame().GetQuestManager().GetAmountOfQuestsInCategory(Category);
{
int num = (Quest == null) ? amountOfQuestsInCategory : (Quest.Number - 1);
int 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 == null) ? 3 : Quest.RewardType);
Message.AppendInteger((Quest == null) ? 0u : Quest.Id);
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 == null) ? 0 : Quest.Reward);
Message.AppendString((Quest == null) ? string.Empty : Quest.Name);
Message.AppendInteger(num2);
Message.AppendInteger((Quest == null) ? 0u : Quest.GoalData);
Message.AppendInteger((Quest == null) ? 0 : Quest.TimeUnlock);
Message.AppendString("");
Message.AppendString("");
Message.AppendBool(true);
}
}
示例2: 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)
{
var flatCat = Azure.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);
try
{
var rooms = Azure.GetGame().GetRoomManager().GetActiveRooms();
Azure.GetGame()
.GetNavigator()
.SerializeNavigatorPopularRoomsNews(ref message, rooms, flatCatId, direct);
}
catch
{
message.AppendInteger(0);
}
}
示例3: Serialize
/// <summary>
/// Serializes the specified message.
/// </summary>
/// <param name="message">The message.</param>
internal void Serialize(ServerMessage message)
{
message.StartArray();
foreach (var clothing1 in Clothing)
{
var item1 = AzureEmulator.GetGame().GetClothingManager().GetClothesInFurni(clothing1);
foreach (var clothe in item1.Clothes)
{
message.AppendInteger(clothe);
}
message.SaveArray();
}
message.EndArray();
message.StartArray();
foreach (var clothing2 in Clothing)
{
var item2 = AzureEmulator.GetGame().GetClothingManager().GetClothesInFurni(clothing2);
foreach (var clothe in item2.Clothes)
{
message.AppendString(item2.ItemName);
}
message.SaveArray();
}
message.EndArray();
}
示例4: SendTicketToModerators
/// <summary>
/// Sends the ticket to moderators.
/// </summary>
/// <param name="ticket">The ticket.</param>
internal static void SendTicketToModerators(SupportTicket ticket)
{
var message = new ServerMessage(LibraryParser.OutgoingRequest("ModerationToolIssueMessageComposer"));
message = ticket.Serialize(message);
Azure.GetGame().GetClientManager().StaffAlert(message);
}
示例5: Execute
public override void Execute(GameClient session, string[] pms)
{
var room = session.GetHabbo().CurrentRoom;
var user = room.GetRoomUserManager().GetRoomUserByHabbo(pms[0]);
if (user == null)
{
session.SendWhisper(TextManager.GetText("user_not_found"));
}
var gender = user.GetClient().GetHabbo().Gender;
var look = user.GetClient().GetHabbo().Look;
session.GetHabbo().Gender = gender;
session.GetHabbo().Look = look;
using (var adapter = AzureEmulator.GetDatabaseManager().GetQueryReactor())
{
adapter.SetQuery(
"UPDATE users SET gender = @gender, look = @look WHERE id = " + session.GetHabbo().Id);
adapter.AddParameter("gender", gender);
adapter.AddParameter("look", look);
adapter.RunQuery();
}
var myUser = room.GetRoomUserManager().GetRoomUserByHabbo(session.GetHabbo().UserName);
if (myUser == null)
return;
var message = new ServerMessage(LibraryParser.OutgoingRequest("UpdateUserDataMessageComposer"));
message.AppendInteger(myUser.VirtualId);
message.AppendString(session.GetHabbo().Look);
message.AppendString(session.GetHabbo().Gender.ToLower());
message.AppendString(session.GetHabbo().Motto);
message.AppendInteger(session.GetHabbo().AchievementPoints);
room.SendMessage(message.GetReversedBytes());
}
示例6: Execute
public override void Execute(GameClient session, string[] pms)
{
var str = string.Join(" ", pms);
var message = new ServerMessage(LibraryParser.OutgoingRequest("BroadcastNotifMessageComposer"));
message.AppendString(string.Format("{0}\r\n- {1}", str, session.GetHabbo().UserName));
AzureEmulator.GetGame().GetClientManager().QueueBroadcaseMessage(message);
}
示例7: Execute
public override bool Execute(GameClient client, string[] pms)
{
var message =
new ServerMessage(LibraryParser.OutgoingRequest("SuperNotificationMessageComposer"));
message.AppendString("Azure");
message.AppendInteger(4);
message.AppendString("title");
message.AppendString("ManiaEVO 1.2");
message.AppendString("message");
var info = new StringBuilder();
info.Append("<h5><b>ManiaEVO 1.2 - Base: Azure</b><h5></br></br>");
info.Append("<br />");
info.AppendFormat(
"<b><br />Desenvolvedores:</b> <br />iPlezier <br />Claudi0<br />Kessiler <br /><br /> ");
info.AppendFormat(
"<b>Créditos:</b> <br />Jamal, Claudio, Boris, Lucca, Antoine, IhToN<br /> <br /> ");
info.AppendFormat("<b>Estatisticas:</b> <br />");
var userCount = Azure.GetGame().GetClientManager().Clients.Count;
var roomsCount = Azure.GetGame().GetRoomManager().LoadedRooms.Count;
info.AppendFormat("<b>Usuários:</b> {0} em {1}{2}.<br /><br /><br />", userCount, roomsCount,
(roomsCount == 1) ? " Quarto" : " Quartos");
message.AppendString(info.ToString());
message.AppendString("linkUrl");
message.AppendString("event:");
message.AppendString("linkTitle");
message.AppendString("ok");
client.SendMessage(message);
return true;
}
示例8: MatchingPollResults
internal static void MatchingPollResults(GameClient client, Poll poll)
{
var room = client.GetHabbo().CurrentRoom;
if (poll == null || poll.Type != PollType.Matching || room == null)
return;
var users = room.GetRoomUserManager().GetRoomUsers();
for (var i = 0; i < 10; i++)
{
Thread.Sleep(1000);
foreach (var roomUser in users)
{
var user = Azure.GetHabboById(roomUser.UserId);
if (user.AnsweredPool)
{
var result =
new ServerMessage(LibraryParser.OutgoingRequest("MatchingPollResultMessageComposer"));
result.AppendInteger(poll.Id);
result.AppendInteger(2);
result.AppendString("0");
result.AppendInteger(poll.AnswersNegative);
result.AppendString("1");
result.AppendInteger(poll.AnswersPositive);
client.SendMessage(result);
}
}
}
foreach (var roomUser in users)
Azure.GetHabboById(roomUser.UserId).AnsweredPool = false;
}
示例9: Execute
public override void Execute(GameClient session, string[] pms)
{
var head = session.GetHabbo().Look.Split('.').FirstOrDefault(element => element.StartsWith("hd-"));
var color = "1";
if (!string.IsNullOrEmpty(head))
{
color = head.Split('-')[2];
session.GetHabbo().Look = session.GetHabbo().Look.Replace('.' + head, string.Empty);
}
session.GetHabbo().Look += ".hd-99999-" + color;
using (var dbClient = AzureEmulator.GetDatabaseManager().GetQueryReactor())
{
dbClient.SetQuery(
"UPDATE users SET look = @look WHERE id = " + session.GetHabbo().Id);
dbClient.AddParameter("look", session.GetHabbo().Look);
dbClient.RunQuery();
}
var room = session.GetHabbo().CurrentRoom;
var user = room.GetRoomUserManager().GetRoomUserByHabbo(session.GetHabbo().Id);
if (user == null) return;
var roomUpdate = new ServerMessage(LibraryParser.OutgoingRequest("UpdateUserDataMessageComposer"));
roomUpdate.AppendInteger(user.VirtualId);
roomUpdate.AppendString(session.GetHabbo().Look);
roomUpdate.AppendString(session.GetHabbo().Gender.ToLower());
roomUpdate.AppendString(session.GetHabbo().Motto);
roomUpdate.AppendInteger(session.GetHabbo().AchievementPoints);
room.SendMessage(roomUpdate);
}
示例10: 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 = Azure.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) ? 0u : 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;
}
示例11: Execute
public override bool Execute(GameClient session, string[] pms)
{
using (var adapter = Azure.GetDatabaseManager().GetQueryReactor())
{
FurniDataParser.SetCache();
Azure.GetGame().GetItemManager().LoadItems(adapter);
Azure.GetGame().GetCatalog().Initialize(adapter);
Azure.GetGame().ReloadItems();
FurniDataParser.Clear();
}
Azure.GetGame()
.GetClientManager()
.QueueBroadcaseMessage(
new ServerMessage(LibraryParser.OutgoingRequest("PublishShopMessageComposer")));
var message = new ServerMessage(LibraryParser.OutgoingRequest("SuperNotificationMessageComposer"));
message.AppendString("ninja_promo_LTD");
message.AppendInteger(4);
message.AppendString("title");
message.AppendString("Novo Raro Limitado!");
message.AppendString("message");
message.AppendString(
"<i><h1>Como Assim?</h1>, Um Novo Raro Limitado foi Adicionado na Loja!<br> Descubra como ele é Abrindo a Loja!</br>");
message.AppendString("linkUrl");
message.AppendString("event:catalog/open/ultd_furni");
message.AppendString("linkTitle");
message.AppendString("Ver o Raro");
Azure.GetGame().GetClientManager().QueueBroadcaseMessage(message);
return true;
}
示例12: GetServerMessage
internal ServerMessage GetServerMessage(ServerMessage message, RoomItem item)
{
var cracks = 0;
var cracks_max = MaxCracks(item.GetBaseItem().Name);
if (AzureEmulator.IsNum(item.ExtraData))
cracks = Convert.ToInt16(item.ExtraData);
var state = "0";
if (cracks >= cracks_max)
state = "14";
else if (cracks >= cracks_max * 6 / 7)
state = "12";
else if (cracks >= cracks_max * 5 / 7)
state = "10";
else if (cracks >= cracks_max * 4 / 7)
state = "8";
else if (cracks >= cracks_max * 3 / 7)
state = "6";
else if (cracks >= cracks_max * 2 / 7)
state = "4";
else if (cracks >= cracks_max * 1 / 7)
state = "2";
message.AppendInteger(7);
message.AppendString(state); //state (0-7)
message.AppendInteger(cracks); //actual
message.AppendInteger(cracks_max); //max
return message;
}
示例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 = Azure.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 == null) ? 3 : quest.RewardType);
message.AppendInteger((quest == null) ? 0u : quest.Id);
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 == null) ? 0 : quest.Reward);
message.AppendString((quest == null) ? string.Empty : quest.Name);
message.AppendInteger(num2);
message.AppendInteger((quest == null) ? 0u : quest.GoalData);
message.AppendInteger((quest == null) ? 0 : quest.TimeUnlock);
message.AppendString("");
message.AppendString("");
message.AppendBool(true);
}
}
示例14: SmallPromoComposer
/// <summary>
/// Smalls the promo composer.
/// </summary>
/// <param name="message">The message.</param>
/// <returns>ServerMessage.</returns>
internal ServerMessage SmallPromoComposer(ServerMessage message)
{
message.AppendInteger(HotelViewPromosIndexers.Count);
foreach (var current in HotelViewPromosIndexers)
current.Serialize(message);
return message;
}
示例15: GenerateMessage
internal void GenerateMessage(ServerMessage message)
{
message.Init(LibraryParser.OutgoingRequest("TargetedOfferMessageComposer"));
message.AppendInteger(1);//show
message.AppendInteger(Id);
message.AppendString(Identifier);
message.AppendString(Identifier);
message.AppendInteger(CostCredits);
if (CostDiamonds > 0)
{
message.AppendInteger(CostDiamonds);
message.AppendInteger(105);
}
else
{
message.AppendInteger(CostDuckets);
message.AppendInteger(0);
}
message.AppendInteger(PurchaseLimit);
var TimeLeft = ExpirationTime - AzureEmulator.GetUnixTimeStamp();
message.AppendInteger(TimeLeft);
message.AppendString(Title);
message.AppendString(Description);
message.AppendString(Image);
message.AppendString("");
message.StartArray();
foreach (string Product in Products)
{
message.AppendString(Product);
message.SaveArray();
}
message.EndArray();
}