本文整理汇总了C#中Yupi.Messages.ServerMessage.Init方法的典型用法代码示例。如果您正苦于以下问题:C# ServerMessage.Init方法的具体用法?C# ServerMessage.Init怎么用?C# ServerMessage.Init使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Yupi.Messages.ServerMessage
的用法示例。
在下文中一共展示了ServerMessage.Init方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: AppendEntrySubmitMessage
internal ServerMessage AppendEntrySubmitMessage(ServerMessage message, int status, Room room = null)
{
message.Init(LibraryParser.OutgoingRequest("CompetitionEntrySubmitResultMessageComposer"));
message.AppendInteger(Id);
message.AppendString(Name);
message.AppendInteger(status);
// 0 : roomSent - 1 : send room - 2 : confirm register - 3 : neededFurnis - 4 : doorClosed - 6 : acceptRules
if (status != 3)
{
message.AppendInteger(0);
message.AppendInteger(0);
}
else
{
message.StartArray();
foreach (string furni in RequiredFurnis)
{
message.AppendString(furni);
message.SaveArray();
}
message.EndArray();
if (room == null)
message.AppendInteger(0);
else
{
message.StartArray();
foreach (string furni in RequiredFurnis)
{
if (!room.GetRoomItemHandler().HasFurniByItemName(furni))
{
message.AppendString(furni);
message.SaveArray();
}
}
message.EndArray();
}
}
return message;
}
示例2: Execute
public override bool Execute(GameClient session, string[] pms)
{
Room room = session.GetHabbo().CurrentRoom;
string message = string.Join(" ", pms);
foreach (GameClient client in Yupi.GetGame().GetClientManager().Clients.Values)
{
ServerMessage serverMessage = new ServerMessage();
serverMessage.Init(LibraryParser.OutgoingRequest("WhisperMessageComposer"));
serverMessage.AppendInteger(room.RoomId);
serverMessage.AppendString(message);
serverMessage.AppendInteger(0);
serverMessage.AppendInteger(36);
serverMessage.AppendInteger(0);
serverMessage.AppendInteger(-1);
client.SendMessage(serverMessage);
}
return true;
}
示例3: Execute
public override bool Execute(GameClient session, string[] pms)
{
ushort result;
ushort.TryParse(pms[0], out result);
if (result > 4)
{
session.SendWhisper(Yupi.GetLanguage().GetVar("command_dance_false"));
result = 0;
}
ServerMessage message = new ServerMessage();
message.Init(LibraryParser.OutgoingRequest("DanceStatusMessageComposer"));
message.AppendInteger(session.CurrentRoomUserId);
message.AppendInteger(result);
session.GetHabbo().CurrentRoom.SendMessage(message);
return true;
}
示例4: GenerateMessage
internal static void GenerateMessage(ServerMessage message, TargetedOffer offer)
{
message.Init(LibraryParser.OutgoingRequest("TargetedOfferMessageComposer"));
message.AppendInteger(1);
message.AppendInteger(offer.Id);
message.AppendString(offer.Identifier);
message.AppendString(offer.Identifier);
message.AppendInteger(offer.CostCredits);
if (offer.CostDiamonds > 0)
{
message.AppendInteger(offer.CostDiamonds);
message.AppendInteger(105);
}
else
{
message.AppendInteger(offer.CostDuckets);
message.AppendInteger(0);
}
message.AppendInteger(offer.PurchaseLimit);
int timeLeft = offer.ExpirationTime - Yupi.GetUnixTimeStamp();
message.AppendInteger(timeLeft);
message.AppendString(offer.Title);
message.AppendString(offer.Description);
message.AppendString(offer.Image);
message.AppendString(string.Empty);
message.StartArray();
foreach (string product in offer.Products)
{
message.AppendString(product);
message.SaveArray();
}
message.EndArray();
}
示例5: SerializeMessengerAction
/// <summary>
/// Serializes the messenger action.
/// </summary>
/// <param name="type">The type.</param>
/// <param name="name">The name.</param>
internal void SerializeMessengerAction(int type, string name)
{
if (GetClient() == null)
return;
ServerMessage serverMessage = new ServerMessage();
serverMessage.Init(LibraryParser.OutgoingRequest("ConsoleMessengerActionMessageComposer"));
serverMessage.AppendString(GetClient().GetHabbo().Id.ToString());
serverMessage.AppendInteger(type);
serverMessage.AppendString(name);
foreach (MessengerBuddy current in Friends.Values.Where(current => current.Client != null))
current.Client.SendMessage(serverMessage);
}
示例6: OnUserAdd
/// <summary>
/// Handles the <see cref="E:UserAdd" /> event.
/// </summary>
/// <param name="user"></param>
private void OnUserAdd(RoomUser user)
{
try
{
if (user?.GetClient() == null || user.GetClient().GetHabbo() == null)
return;
GameClient client = user.GetClient();
if (client?.GetHabbo() == null || _userRoom == null)
return;
if (!user.IsSpectator)
{
DynamicRoomModel model = _userRoom.GetGameMap().Model;
if (model == null) return;
user.SetPos(model.DoorX, model.DoorY, model.DoorZ);
user.SetRot(model.DoorOrientation, false);
user.AddStatus(_userRoom.CheckRights(client, true) ? "flatctrl 4" : "flatctrl 1", string.Empty);
user.CurrentItemEffect = ItemEffectType.None;
if (!user.IsBot && client.GetHabbo().IsTeleporting)
{
client.GetHabbo().IsTeleporting = false;
client.GetHabbo().TeleportingRoomId = 0;
RoomItem item = _userRoom.GetRoomItemHandler().GetItem(client.GetHabbo().TeleporterId);
if (item != null)
{
item.ExtraData = "2";
item.UpdateState(false, true);
user.SetPos(item.X, item.Y, item.Z);
user.SetRot(item.Rot, false);
item.InteractingUser2 = client.GetHabbo().Id;
item.ExtraData = "0";
item.UpdateState(false, true);
}
}
if (!user.IsBot && client.GetHabbo().IsHopping)
{
client.GetHabbo().IsHopping = false;
client.GetHabbo().HopperId = 0;
RoomItem item2 = _userRoom.GetRoomItemHandler().GetItem(client.GetHabbo().HopperId);
if (item2 != null)
{
item2.ExtraData = "1";
item2.UpdateState(false, true);
user.SetPos(item2.X, item2.Y, item2.Z);
user.SetRot(item2.Rot, false);
user.AllowOverride = false;
item2.InteractingUser2 = client.GetHabbo().Id;
item2.ExtraData = "2";
item2.UpdateState(false, true);
}
}
if (!user.IsSpectator)
{
ServerMessage serverMessage =
new ServerMessage(LibraryParser.OutgoingRequest("SetRoomUserMessageComposer"));
serverMessage.AppendInteger(1);
user.Serialize(serverMessage, _userRoom.GetGameMap().GotPublicPool);
_userRoom.SendMessage(serverMessage);
}
if (!user.IsBot)
{
ServerMessage serverMessage2 = new ServerMessage();
serverMessage2.Init(LibraryParser.OutgoingRequest("UpdateUserDataMessageComposer"));
serverMessage2.AppendInteger(user.VirtualId);
serverMessage2.AppendString(client.GetHabbo().Look);
serverMessage2.AppendString(client.GetHabbo().Gender.ToLower());
serverMessage2.AppendString(client.GetHabbo().Motto);
serverMessage2.AppendInteger(client.GetHabbo().AchievementPoints);
_userRoom.SendMessage(serverMessage2);
}
if (_userRoom.RoomData.Owner != client.GetHabbo().UserName)
{
Yupi.GetGame()
.GetAchievementManager()
.ProgressUserAchievement(client, "ACH_RoomEntry", 1);
}
}
if (client.GetHabbo().GetMessenger() != null)
client.GetHabbo().GetMessenger().OnStatusChanged(true);
client.GetMessageHandler().OnRoomUserAdd();
//if (client.GetHabbo().HasFuse("fuse_mod")) client.GetHabbo().GetAvatarEffectsInventoryComponent().ActivateCustomEffect(102);
//if (client.GetHabbo().Rank == Convert.ToUInt32(Yupi.GetDbConfig().DbData["ambassador.minrank"])) client.GetHabbo().GetAvatarEffectsInventoryComponent().ActivateCustomEffect(178);
if (OnUserEnter != null)
OnUserEnter(user, null);
if (_userRoom.GotMusicController() && _userRoom.GotMusicController())
//.........这里部分代码省略.........
示例7: UserCanWalkInTile
internal bool UserCanWalkInTile(RoomUser roomUsers)
{
// Check if User CanWalk...
if (_userRoom.GetGameMap().CanWalk(roomUsers.SetX, roomUsers.SetY, roomUsers.AllowOverride) ||
roomUsers.RidingHorse)
{
// Let's Update his Movement...
_userRoom.GetGameMap()
.UpdateUserMovement(new Point(roomUsers.Coordinate.X, roomUsers.Coordinate.Y),
new Point(roomUsers.SetX, roomUsers.SetY), roomUsers);
List<RoomItem> hasItemInPlace = _userRoom.GetGameMap().GetCoordinatedItems(new Point(roomUsers.X, roomUsers.Y));
// Set His Actual X,Y,Z Position...
roomUsers.X = roomUsers.SetX;
roomUsers.Y = roomUsers.SetY;
roomUsers.Z = roomUsers.SetZ;
// Check Sub Items Interactionables
foreach (RoomItem roomItem in hasItemInPlace.ToArray())
{
roomItem.UserWalksOffFurni(roomUsers);
switch (roomItem.GetBaseItem().InteractionType)
{
case Interaction.RunWaySage:
case Interaction.ChairState:
case Interaction.Shower:
case Interaction.PressurePad:
case Interaction.PressurePadBed:
case Interaction.Guillotine:
roomItem.ExtraData = "0";
roomItem.UpdateState();
break;
case Interaction.Tent:
case Interaction.BedTent:
if (!roomUsers.IsBot && roomUsers.OnCampingTent)
{
ServerMessage serverMessage = new ServerMessage();
serverMessage.Init(
LibraryParser.OutgoingRequest("UpdateFloorItemExtraDataMessageComposer"));
serverMessage.AppendString(roomItem.Id.ToString());
serverMessage.AppendInteger(0);
serverMessage.AppendString("0");
roomUsers.GetClient().SendMessage(serverMessage);
roomUsers.OnCampingTent = false;
}
break;
case Interaction.None:
break;
}
}
// Let's Update user Status..
UpdateUserStatus(roomUsers, true);
return false;
}
return true;
}
示例8: SerializeTicketChatlog
/// <summary>
/// Serializes the ticket chatlog.
/// </summary>
/// <param name="ticket">The ticket.</param>
/// <param name="roomData">The room data.</param>
/// <param name="timestamp">The timestamp.</param>
/// <returns>ServerMessage.</returns>
/// <exception cref="System.NullReferenceException">No room found.</exception>
internal static ServerMessage SerializeTicketChatlog(SupportTicket ticket, RoomData roomData, double timestamp)
{
ServerMessage message = new ServerMessage();
RoomData room = Yupi.GetGame().GetRoomManager().GenerateRoomData(ticket.RoomId);
if (room != null)
{
message.Init(LibraryParser.OutgoingRequest("ModerationToolIssueChatlogMessageComposer"));
message.AppendInteger(ticket.TicketId);
message.AppendInteger(ticket.SenderId);
message.AppendInteger(ticket.ReportedId);
message.AppendInteger(ticket.RoomId);
message.AppendByte(1);
message.AppendShort(2);
message.AppendString("roomName");
message.AppendByte(2);
message.AppendString(ticket.RoomName);
message.AppendString("roomId");
message.AppendByte(1);
message.AppendInteger(ticket.RoomId);
List<Chatlog> tempChatlogs =
room.RoomChat.Reverse().Skip(Math.Max(0, room.RoomChat.Count() - 60)).Take(60).ToList();
message.AppendShort(tempChatlogs.Count);
foreach (Chatlog chatLog in tempChatlogs)
chatLog.Serialize(ref message);
return message;
}
return null;
}
示例9: NewHeightMap
/// <summary>
/// News the height map.
/// </summary>
/// <returns>ServerMessage.</returns>
private ServerMessage NewHeightMap()
{
ServerMessage serverMessage = new ServerMessage();
serverMessage.Init(LibraryParser.OutgoingRequest("HeightMapMessageComposer"));
serverMessage.AppendInteger(Model.MapSizeX);
serverMessage.AppendInteger(Model.MapSizeX*Model.MapSizeY);
for (int i = 0; i < Model.MapSizeY; i++)
{
for (int j = 0; j < Model.MapSizeX; j++)
{
serverMessage.AppendShort((short) (SqAbsoluteHeight(j, i)*256));
}
}
// serverMessage.AppendShort(this.Model.SqFloorHeight[j, i] * 256);
return serverMessage;
}
示例10: FreezeUser
private void FreezeUser(RoomUser user)
{
if (user.IsBot || user.ShieldActive || user.Team == Team.None || user.Freezed)
return;
user.Freezed = true;
user.FreezeCounter = 0;
--user.FreezeLives;
if (user.FreezeLives <= 0)
{
ServerMessage serverMessage = new ServerMessage();
serverMessage.Init(LibraryParser.OutgoingRequest("UpdateFreezeLivesMessageComposer"));
serverMessage.AppendInteger(user.InternalRoomId);
serverMessage.AppendInteger(user.FreezeLives);
user.GetClient().SendMessage(serverMessage);
user.ApplyEffect(-1);
_room.GetGameManager().AddPointToTeam(user.Team, -10, user);
TeamManager managerForFreeze = _room.GetTeamManagerForFreeze();
managerForFreeze.OnUserLeave(user);
user.Team = Team.None;
if (ExitTeleport != null) _room.GetGameMap().TeleportToItem(user, ExitTeleport);
user.Freezed = false;
user.SetStep = false;
user.IsWalking = false;
user.UpdateNeeded = true;
if (!managerForFreeze.BlueTeam.Any() && !managerForFreeze.RedTeam.Any() &&
!managerForFreeze.GreenTeam.Any() && managerForFreeze.YellowTeam.Any())
StopGame();
else if (managerForFreeze.BlueTeam.Any() && !managerForFreeze.RedTeam.Any() &&
!managerForFreeze.GreenTeam.Any() && !managerForFreeze.YellowTeam.Any())
StopGame();
else if (!managerForFreeze.BlueTeam.Any() && managerForFreeze.RedTeam.Any() &&
!managerForFreeze.GreenTeam.Any() && !managerForFreeze.YellowTeam.Any())
StopGame();
else
{
if (managerForFreeze.BlueTeam.Any() || managerForFreeze.RedTeam.Any() ||
!managerForFreeze.GreenTeam.Any() || managerForFreeze.YellowTeam.Any())
return;
StopGame();
}
}
else
{
_room.GetGameManager().AddPointToTeam(user.Team, -10, user);
user.ApplyEffect(12);
ServerMessage serverMessage = new ServerMessage();
serverMessage.Init(LibraryParser.OutgoingRequest("UpdateFreezeLivesMessageComposer"));
serverMessage.AppendInteger(user.InternalRoomId);
serverMessage.AppendInteger(user.FreezeLives);
user.GetClient().SendMessage(serverMessage);
}
}
示例11: PickUpPowerUp
private void PickUpPowerUp(RoomItem item, RoomUser user)
{
switch (item.FreezePowerUp)
{
case FreezePowerUp.BlueArrow:
case FreezePowerUp.GreenArrow:
case FreezePowerUp.OrangeSnowball:
user.BanzaiPowerUp = item.FreezePowerUp;
break;
case FreezePowerUp.Shield:
ActivateShield(user);
break;
case FreezePowerUp.Heart:
if (user.FreezeLives < 5)
{
{
++user.FreezeLives;
}
_room.GetGameManager().AddPointToTeam(user.Team, 10, user);
}
ServerMessage serverMessage = new ServerMessage();
serverMessage.Init(LibraryParser.OutgoingRequest("UpdateFreezeLivesMessageComposer"));
serverMessage.AppendInteger(user.InternalRoomId);
serverMessage.AppendInteger(user.FreezeLives);
user.GetClient().SendMessage(serverMessage);
break;
}
item.FreezePowerUp = FreezePowerUp.None;
item.ExtraData = $"1{item.ExtraData}";
item.UpdateState(false, true);
}
示例12: CountTeamPoints
private void CountTeamPoints()
{
_room.GetGameManager().Reset();
foreach (
RoomUser roomUser in
_room.GetRoomUserManager()
.UserList.Values.Where(
roomUser => !roomUser.IsBot && roomUser.Team != Team.None && roomUser.GetClient() != null))
{
roomUser.BanzaiPowerUp = FreezePowerUp.None;
roomUser.FreezeLives = 3;
roomUser.ShieldActive = false;
roomUser.ShieldCounter = 11;
_room.GetGameManager().AddPointToTeam(roomUser.Team, 30, null);
ServerMessage serverMessage = new ServerMessage();
serverMessage.Init(LibraryParser.OutgoingRequest("UpdateFreezeLivesMessageComposer"));
serverMessage.AppendInteger(roomUser.InternalRoomId);
serverMessage.AppendInteger(roomUser.FreezeLives);
roomUser.GetClient().SendMessage(serverMessage);
}
}
示例13: SerializeEventInfo
/// <summary>
/// Serializes the event information.
/// </summary>
/// <param name="roomId">The room identifier.</param>
internal void SerializeEventInfo(uint roomId)
{
Room room = Yupi.GetGame().GetRoomManager().GetRoom(roomId);
if (room == null)
{
return;
}
RoomEvent @event = GetEvent(roomId);
if (@event == null || @event.HasExpired)
{
return;
}
if (!RoomHasEvents(roomId))
{
return;
}
ServerMessage serverMessage = new ServerMessage();
serverMessage.Init(LibraryParser.OutgoingRequest("RoomEventMessageComposer"));
serverMessage.AppendInteger(roomId);
serverMessage.AppendInteger(room.RoomData.OwnerId);
serverMessage.AppendString(room.RoomData.Owner);
serverMessage.AppendInteger(1);
serverMessage.AppendInteger(1);
serverMessage.AppendString(@event.Name);
serverMessage.AppendString(@event.Description);
serverMessage.AppendInteger(0);
serverMessage.AppendInteger(
(int) Math.Floor((@event.Time - Yupi.GetUnixTimeStamp())/60.0));
serverMessage.AppendInteger(@event.Category);
room.SendMessage(serverMessage);
}
示例14: MoveBall
internal bool MoveBall(RoomItem item, GameClient mover, int newX, int newY)
{
if (item == null || item.GetBaseItem() == null /*|| mover == null || mover.GetHabbo() == null*/)
return false;
if (!_room.GetGameMap().ItemCanBePlacedHere(newX, newY))
return false;
Point oldRoomCoord = item.Coordinate;
bool itemIsOnGameItem = GameItemOverlaps(item);
double newZ = _room.GetGameMap().Model.SqFloorHeight[newX][newY];
ServerMessage mMessage = new ServerMessage();
mMessage.Init(LibraryParser.OutgoingRequest("ItemAnimationMessageComposer")); // Cf
mMessage.AppendInteger(item.Coordinate.X);
mMessage.AppendInteger(item.Coordinate.Y);
mMessage.AppendInteger(newX);
mMessage.AppendInteger(newY);
mMessage.AppendInteger(1);
mMessage.AppendInteger(item.Id);
mMessage.AppendString(ServerUserChatTextHandler.GetString(item.Z));
mMessage.AppendString(ServerUserChatTextHandler.GetString(newZ));
mMessage.AppendInteger(item.Id);
_room.SendMessage(mMessage);
if (oldRoomCoord.X == newX && oldRoomCoord.Y == newY)
return false;
item.SetState(newX, newY, item.Z,
Gamemap.GetAffectedTiles(item.GetBaseItem().Length, item.GetBaseItem().Width, newX, newY, item.Rot));
if (itemIsOnGameItem || mover == null || mover.GetHabbo() == null)
return false;
HandleFootballGameItems(new Point(newX, newY),
_room.GetRoomUserManager().GetRoomUserByHabbo(mover.GetHabbo().Id));
return false;
}
示例15: UpdateItemOnRoller
/// <summary>
/// Updates the item on roller.
/// </summary>
/// <param name="item">The item.</param>
/// <param name="nextCoord">The next coord.</param>
/// <param name="rolledId">The rolled identifier.</param>
/// <param name="nextZ">The next z.</param>
/// <returns>ServerMessage.</returns>
internal ServerMessage UpdateItemOnRoller(RoomItem item, Point nextCoord, uint rolledId, double nextZ)
{
ServerMessage serverMessage = new ServerMessage();
serverMessage.Init(LibraryParser.OutgoingRequest("ItemAnimationMessageComposer"));
serverMessage.AppendInteger(item.X);
serverMessage.AppendInteger(item.Y);
serverMessage.AppendInteger(nextCoord.X);
serverMessage.AppendInteger(nextCoord.Y);
serverMessage.AppendInteger(1);
serverMessage.AppendInteger(item.Id);
serverMessage.AppendString(ServerUserChatTextHandler.GetString(item.Z));
serverMessage.AppendString(ServerUserChatTextHandler.GetString(nextZ));
serverMessage.AppendInteger(rolledId);
SetFloorItem(item, nextCoord.X, nextCoord.Y, nextZ);
return serverMessage;
}