本文整理汇总了C#中Mercury.Messages.ServerMessage.Init方法的典型用法代码示例。如果您正苦于以下问题:C# ServerMessage.Init方法的具体用法?C# ServerMessage.Init怎么用?C# ServerMessage.Init使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Mercury.Messages.ServerMessage
的用法示例。
在下文中一共展示了ServerMessage.Init方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: NewHeightMap
private ServerMessage NewHeightMap()
{
ServerMessage serverMessage = new ServerMessage();
serverMessage.Init(Outgoing.HeightMapMessageComposer);
serverMessage.AppendInt32(this.Model.MapSizeX);
checked
{
serverMessage.AppendInt32(this.Model.MapSizeX * this.Model.MapSizeY);
for (int i = 0; i < this.Model.MapSizeY; i++)
{
for (int j = 0; j < this.Model.MapSizeX; j++)
{
serverMessage.AppendShort((short)(this.SqAbsoluteHeight(j, i) * 256));
// serverMessage.AppendShort(this.Model.SqFloorHeight[j, i] * 256);
}
}
return serverMessage;
}
}
示例2: UpdateUserStatus
//.........这里部分代码省略.........
teamManagerForBanzai.OnUserLeave(User);
if (avatarEffectsInventoryComponent.CurrentEffect == num3)
{
avatarEffectsInventoryComponent.ActivateCustomEffect(0);
}
User.team = Team.none;
continue;
}
}
default:
continue;
}
}
else
{
if (User.IsBot)
{
continue;
}
string look = Item.ExtraData.Split(',')[0];
if (User.GetClient().GetHabbo().Gender.ToUpper() == "F")
{
look = Item.ExtraData.Split(',')[1];
}
if (!look.Contains("hd-99999-99999"))
{
look = "hd-99999-99999." + look;
}
look = look.Replace("hd-99999-99999", User.GetClient().GetHabbo().HeadPart);
User.GetClient().GetHabbo().Look = look;
ServerMessage serverMessage = new ServerMessage();
serverMessage.Init(Outgoing.UpdateUserDataMessageComposer);
serverMessage.AppendInt32(-1);
serverMessage.AppendString(User.GetClient().GetHabbo().Look);
serverMessage.AppendString(User.GetClient().GetHabbo().Gender.ToLower());
serverMessage.AppendString(User.GetClient().GetHabbo().Motto);
serverMessage.AppendInt32(User.GetClient().GetHabbo().AchievementPoints);
User.GetClient().SendMessage(serverMessage);
ServerMessage serverMessage2 = new ServerMessage();
serverMessage2.Init(Outgoing.UpdateUserDataMessageComposer);
serverMessage2.AppendInt32(User.VirtualId);
serverMessage2.AppendString(User.GetClient().GetHabbo().Look);
serverMessage2.AppendString(User.GetClient().GetHabbo().Gender.ToLower());
serverMessage2.AppendString(User.GetClient().GetHabbo().Motto);
serverMessage2.AppendInt32(User.GetClient().GetHabbo().AchievementPoints);
this.room.SendMessage(serverMessage2);
ServerMessage serverMessage3 = new ServerMessage();
serverMessage3.Init(Outgoing.UpdateAvatarAspectMessageComposer);
serverMessage3.AppendString(User.GetClient().GetHabbo().Look);
serverMessage3.AppendString(User.GetClient().GetHabbo().Gender.ToUpper());
User.GetClient().SendMessage(serverMessage3);
continue;
}
}
}
else
{
if (interactionType <= InteractionType.freezebluegate)
{
if (interactionType == InteractionType.banzaitele)
{
this.room.GetGameItemHandler().onTeleportRoomUserEnter(User, Item);
示例3: SerializeMessengerAction
internal void SerializeMessengerAction(int Type, string Name)
{
if (this.GetClient() == null)
{
return;
}
ServerMessage serverMessage = new ServerMessage();
serverMessage.Init(Outgoing.ConsoleMessengerActionMessageComposer);
serverMessage.AppendString(this.GetClient().GetHabbo().Id.ToString());
serverMessage.AppendInt32(Type);
serverMessage.AppendString(Name);
foreach (MessengerBuddy current in this.friends.Values)
{
if (current.client != null)
{
current.client.SendMessage(serverMessage);
}
}
}
示例4: Parse
//.........这里部分代码省略.........
}
return true;
case "mutebots":
case "mutepets":
if (this.Session.GetHabbo().GotCommand("mutebots") && this.Session.GetHabbo().CurrentRoom.CheckRights(this.Session, true, false))
{
Room room9 = this.Session.GetHabbo().CurrentRoom;
if (!room9.MutedBots)
{
room9.MutedBots = true;
}
else
{
room9.MutedBots = false;
}
SendChatMessage(this.Session, "Muted bots have been toggled");
}
return true;
case "dance":
{
int result = 1;
if ((Params.Length > 1) && int.TryParse(Params[1], out result))
{
result = 1;
}
if ((result > 4) || (result < 0))
{
this.Session.SendWhisper("The dance ID must be between 0 and 4!");
result = 0;
}
ServerMessage message2 = new ServerMessage();
message2.Init(Outgoing.DanceStatusMessageComposer);
message2.AppendInt32(this.Session.CurrentRoomUserID);
message2.AppendInt32(result);
this.Session.GetHabbo().CurrentRoom.SendMessage(message2);
return true;
}
case "deletegroup":
{
if (!this.Session.GetHabbo().GotCommand("deletegroup"))
{
return true;//1E19;
}
Room room12 = this.Session.GetHabbo().CurrentRoom;
if (room12.CheckRights(this.Session, true, false))
{
if ((Params.Length == 1) || (Params[1].ToLower() != "yes"))
{
this.Session.SendNotif("Are you sure you want to delete this group?\nOnce you delete it you will never be able to get it back.\n\nTo continue, type ':deletegroup yes' (without '')");
return true;
}
if (room12.Group == null)
{
this.Session.SendNotif("This room does not have a group.");
return true;
}
Guild group = room12.Group;
foreach (GroupUser user7 in group.Members.Values)
{
GameClient clientByUserID = MercuryEnvironment.GetGame().GetClientManager().GetClientByUserID(user7.Id);
if (clientByUserID != null)
{
clientByUserID.GetHabbo().UserGroups.Remove(user7);
if (clientByUserID.GetHabbo().FavouriteGroup == group.Id)
示例5: OnUserAdd
private void OnUserAdd(object sender, EventArgs args)
{
try
{
if (sender != null)
{
RoomUser value = ((KeyValuePair<int, RoomUser>)sender).Value;
if (value != null && value.GetClient() != null && value.GetClient().GetHabbo() != null)
{
GameClient client = value.GetClient();
if (client != null && client.GetHabbo() != null && this.room != null)
{
if (!value.IsSpectator)
{
DynamicRoomModel model = this.room.GetGameMap().Model;
if (model == null)
{
return;
}
value.SetPos(model.DoorX, model.DoorY, model.DoorZ);
value.SetRot(model.DoorOrientation, false);
if (this.room.CheckRights(client, true, false))
{
value.AddStatus("flatctrl 4", "");
}
else
{
if (this.room.CheckRights(client, false, true))
{
value.AddStatus("flatctrl 1", "");
}
else
{
if (this.room.CheckRights(client))
{
value.AddStatus("flatctrl 1", "");
}
}
}
value.CurrentItemEffect = ItemEffectType.None;
if (!value.IsBot && value.GetClient().GetHabbo().IsTeleporting)
{
RoomItem item = this.room.GetRoomItemHandler().GetItem(value.GetClient().GetHabbo().TeleporterId);
if (item != null)
{
item.ExtraData = "2";
item.UpdateState(false, true);
value.SetPos(item.GetX, item.GetY, item.GetZ);
value.SetRot(item.Rot, false);
item.InteractingUser2 = client.GetHabbo().Id;
item.ExtraData = "0";
item.UpdateState(false, true);
}
}
if (!value.IsBot && value.GetClient().GetHabbo().IsHopping)
{
RoomItem item2 = this.room.GetRoomItemHandler().GetItem(value.GetClient().GetHabbo().HopperId);
if (item2 != null)
{
item2.ExtraData = "1";
item2.UpdateState(false, true);
value.SetPos(item2.GetX, item2.GetY, item2.GetZ);
value.SetRot(item2.Rot, false);
value.AllowOverride = false;
item2.InteractingUser2 = client.GetHabbo().Id;
item2.ExtraData = "2";
item2.UpdateState(false, true);
}
}
if (!value.IsSpectator)
{
ServerMessage serverMessage = new ServerMessage(Outgoing.SetRoomUserMessageComposer);
serverMessage.AppendInt32(1);
value.Serialize(serverMessage, this.room.GetGameMap().gotPublicPool);
this.room.SendMessage(serverMessage);
}
if (!value.IsBot)
{
ServerMessage serverMessage2 = new ServerMessage();
serverMessage2.Init(Outgoing.UpdateUserDataMessageComposer);
serverMessage2.AppendInt32(value.VirtualId);
serverMessage2.AppendString(value.GetClient().GetHabbo().Look);
serverMessage2.AppendString(value.GetClient().GetHabbo().Gender.ToLower());
serverMessage2.AppendString(value.GetClient().GetHabbo().Motto);
serverMessage2.AppendInt32(value.GetClient().GetHabbo().AchievementPoints);
this.room.SendMessage(serverMessage2);
}
if (this.room.Owner != client.GetHabbo().Username)
{
MercuryEnvironment.GetGame().GetQuestManager().ProgressUserQuest(value.GetClient(), QuestType.SOCIAL_VISIT, 0u);
MercuryEnvironment.GetGame().GetAchievementManager().ProgressUserAchievement(value.GetClient(), "ACH_RoomEntry", 1, false);
}
}
if (client.GetHabbo().GetMessenger() != null)
{
client.GetHabbo().GetMessenger().OnStatusChanged(true);
}
value.GetClient().GetMessageHandler().OnRoomUserAdd();
//.........这里部分代码省略.........
示例6: OnTrigger
public void OnTrigger(GameClient Session, RoomItem Item, int Request, bool HasRights)
{
if (Session == null)
{
return;
}
RoomUser roomUserByHabbo = Item.GetRoom().GetRoomUserManager().GetRoomUserByHabbo(Session.GetHabbo().Id);
if (roomUserByHabbo == null)
{
return;
}
checked
{
if (Math.Abs(roomUserByHabbo.X - Item.GetX) < 2 && Math.Abs(roomUserByHabbo.Y - Item.GetY) < 2)
{
roomUserByHabbo.SetRot(PathFinder.CalculateRotation(roomUserByHabbo.X, roomUserByHabbo.Y, Item.GetX, Item.GetY), false);
Room room = Item.GetRoom();
Point point = new Point(0, 0);
if (roomUserByHabbo.RotBody == 4)
{
point = new Point(Item.GetX, Item.GetY + 1);
}
else
{
if (roomUserByHabbo.RotBody == 0)
{
point = new Point(Item.GetX, Item.GetY - 1);
}
else
{
if (roomUserByHabbo.RotBody == 6)
{
point = new Point(Item.GetX - 1, Item.GetY);
}
else
{
if (roomUserByHabbo.RotBody != 2)
{
return;
}
point = new Point(Item.GetX + 1, Item.GetY);
}
}
}
if (room.GetGameMap().validTile(point.X, point.Y))
{
double num = Item.GetRoom().GetGameMap().SqAbsoluteHeight(point.X, point.Y);
ServerMessage serverMessage = new ServerMessage();
serverMessage.Init(Outgoing.ItemAnimationMessageComposer);
serverMessage.AppendInt32(Item.GetX);
serverMessage.AppendInt32(Item.GetY);
serverMessage.AppendInt32(point.X);
serverMessage.AppendInt32(point.Y);
serverMessage.AppendInt32(1);
serverMessage.AppendUInt(Item.Id);
serverMessage.AppendString(Item.GetZ.ToString(MercuryEnvironment.cultureInfo));
serverMessage.AppendString(num.ToString(MercuryEnvironment.cultureInfo));
serverMessage.AppendInt32(0);
room.SendMessage(serverMessage);
Item.GetRoom().GetRoomItemHandler().SetFloorItem(roomUserByHabbo.GetClient(), Item, point.X, point.Y, Item.Rot, false, false, false);
return;
}
}
else
{
roomUserByHabbo.MoveTo(Item.GetX + 1, Item.GetY);
}
}
}
示例7: UpdateItemOnRoller
internal ServerMessage UpdateItemOnRoller(RoomItem pItem, Point NextCoord, uint pRolledID, double NextZ)
{
ServerMessage serverMessage = new ServerMessage();
serverMessage.Init(Outgoing.ItemAnimationMessageComposer);
serverMessage.AppendInt32(pItem.GetX);
serverMessage.AppendInt32(pItem.GetY);
serverMessage.AppendInt32(NextCoord.X);
serverMessage.AppendInt32(NextCoord.Y);
serverMessage.AppendInt32(1);
serverMessage.AppendUInt(pItem.Id);
serverMessage.AppendString(TextHandling.GetString(pItem.GetZ));
serverMessage.AppendString(TextHandling.GetString(NextZ));
serverMessage.AppendUInt(pRolledID);
this.SetFloorItem(pItem, NextCoord.X, NextCoord.Y, NextZ);
return serverMessage;
}
示例8: LoadClubGifts
internal void LoadClubGifts()
{
if (this.Session == null || this.Session.GetHabbo() == null)
{
return;
}
int i = 0;
int i2 = 0;
this.Session.GetHabbo().GetSubscriptionManager().GetSubscription();
ServerMessage serverMessage = new ServerMessage();
serverMessage.Init(Outgoing.LoadCatalogClubGiftsMessageComposer);
serverMessage.AppendInt32(i);
serverMessage.AppendInt32(i2);
serverMessage.AppendInt32(1);
}
示例9: TriggerLoveLock
internal void TriggerLoveLock(RoomItem LoveLock)
{
string[] loveLockParams = LoveLock.ExtraData.Split(Convert.ToChar(5));
try
{
if (loveLockParams[0] == "1")
{
//Love lock already locked!
return;
}
Point PointOne;
Point PointTwo;
switch (LoveLock.Rot)
{
case 2:
PointOne = new Point(LoveLock.GetX, LoveLock.GetY + 1);
PointTwo = new Point(LoveLock.GetX, LoveLock.GetY - 1);
break;
case 4:
PointOne = new Point(LoveLock.GetX - 1, LoveLock.GetY);
PointTwo = new Point(LoveLock.GetX + 1, LoveLock.GetY);
break;
default:
return;
}
RoomUser RoomUserOne = LoveLock.GetRoom().GetRoomUserManager().GetUserForSquare(PointOne.X, PointOne.Y);
RoomUser RoomUserTwo = LoveLock.GetRoom().GetRoomUserManager().GetUserForSquare(PointTwo.X, PointTwo.Y);
if (RoomUserOne == null || RoomUserTwo == null)
{
Session.SendNotif("You and your friend must stand side by side to the Lovelock!");
return;
}
else if (RoomUserOne.GetClient() == null || RoomUserTwo.GetClient() == null)
{
Session.SendNotif("You can't lock your friendship to that partner! Please choose another one.");
return;
}
RoomUserOne.CanWalk = false;
RoomUserTwo.CanWalk = false;
ServerMessage LockDialogue = new ServerMessage();
LockDialogue.Init(Outgoing.LoveLockDialogueMessageComposer);
LockDialogue.AppendUInt(LoveLock.Id);
LockDialogue.AppendBoolean(true);
LoveLock.InteractingUser = RoomUserOne.GetClient().GetHabbo().Id;
LoveLock.InteractingUser2 = RoomUserTwo.GetClient().GetHabbo().Id;
RoomUserOne.GetClient().SendMessage(LockDialogue);
RoomUserTwo.GetClient().SendMessage(LockDialogue);
}
catch
{
Session.SendNotif("You can't use this lovelock for some reason. Please report it.");
return;
}
}
示例10: SerializeBotInventory
internal ServerMessage SerializeBotInventory()
{
ServerMessage serverMessage = new ServerMessage();
serverMessage.Init(Outgoing.BotInventoryMessageComposer);
serverMessage.AppendInt32(this.InventoryBots.Count);
foreach (RoomBot current in this.InventoryBots.Values)
{
serverMessage.AppendUInt(current.BotId);
serverMessage.AppendString(current.Name);
serverMessage.AppendString(current.Motto);
serverMessage.AppendString("m");
serverMessage.AppendString(current.Look);
}
return serverMessage;
}
示例11: SendNewItems
internal void SendNewItems(uint Id)
{
ServerMessage serverMessage = new ServerMessage();
serverMessage.Init(Outgoing.NewInventoryObjectMessageComposer);
serverMessage.AppendInt32(1);
serverMessage.AppendInt32(1);
serverMessage.AppendInt32(1);
serverMessage.AppendUInt(Id);
this.mClient.SendMessage(serverMessage);
}
示例12: SerializeBadgeReward
internal ServerMessage SerializeBadgeReward(bool Success)
{
ServerMessage serverMessage = new ServerMessage();
serverMessage.Init(Outgoing.WiredRewardAlertMessageComposer);
serverMessage.AppendInt32(Success ? 7 : 1);
return serverMessage;
}
示例13: SerializeBadge
internal ServerMessage SerializeBadge(string Badge)
{
ServerMessage serverMessage = new ServerMessage();
serverMessage.Init(Outgoing.ReceiveBadgeMessageComposer);
serverMessage.AppendInt32(1);
serverMessage.AppendString(Badge);
return serverMessage;
}
示例14: SerializeGroupInfo
internal void SerializeGroupInfo(Guild Group, ServerMessage Response, GameClient Session, Room Room, bool NewWindow = false)
{
if (Room == null) { return; }
DateTime dateTime = new DateTime(1970, 1, 1, 0, 0, 0, 0);
DateTime dateTime2 = dateTime.AddSeconds((double)Group.CreateTime);
Response.Init(Outgoing.GroupDataMessageComposer);
Response.AppendUInt(Group.Id);
Response.AppendBoolean(true);
Response.AppendUInt(Group.State);
Response.AppendString(Group.Name);
Response.AppendString(Group.Description);
Response.AppendString(Group.Badge);
Response.AppendUInt(Group.RoomId);
Response.AppendString((MercuryEnvironment.GetGame().GetRoomManager().GenerateRoomData(Group.RoomId) == null) ? "No room found.." : MercuryEnvironment.GetGame().GetRoomManager().GenerateRoomData(Group.RoomId).Name);
Response.AppendInt32((Group.CreatorId == Session.GetHabbo().Id) ? 3 : (Group.Requests.Contains(Session.GetHabbo().Id) ? 2 : (Group.Members.ContainsKey(Session.GetHabbo().Id) ? 1 : 0)));
Response.AppendInt32(Group.Members.Count);
Response.AppendBoolean(Session.GetHabbo().FavouriteGroup == Group.Id);
Response.AppendString(string.Concat(new object[]
{
dateTime2.Day,
"-",
dateTime2.Month,
"-",
dateTime2.Year
}));
Response.AppendBoolean(Group.CreatorId == Session.GetHabbo().Id);
Response.AppendBoolean(Group.Admins.ContainsKey(Session.GetHabbo().Id));
Response.AppendString((MercuryEnvironment.getHabboForId(Group.CreatorId) == null) ? "" : MercuryEnvironment.getHabboForId(Group.CreatorId).Username);
Response.AppendBoolean(NewWindow);
Response.AppendBoolean(Group.AdminOnlyDeco == 0u);
Response.AppendInt32(Group.Requests.Count);
Response.AppendBoolean(Group.HasForum);
if (Room != null)
{
Room.SendMessage(Response);
return;
}
if (Session != null)
{
Session.SendMessage(Response);
}
}
示例15: SerializeRoomData
internal void SerializeRoomData(ServerMessage Response, bool FromView, GameClient Session, bool SendRoom = false)
{
Room room = MercuryEnvironment.GetGame().GetRoomManager().GetRoom(Session.GetHabbo().CurrentRoomId);
if (room == null || !room.CheckRights(Session, true, false))
{
return;
}
Response.Init(Outgoing.RoomDataMessageComposer);
Response.AppendBoolean(true);
Response.AppendUInt(this.Id);
Response.AppendString(this.Name);
Response.AppendBoolean(this.Type == "private");
Response.AppendInt32(this.OwnerId);
Response.AppendString(this.Owner);
Response.AppendInt32(this.State);
Response.AppendInt32(this.UsersNow);
Response.AppendInt32(this.UsersMax);
Response.AppendString(this.Description);
Response.AppendInt32(this.TradeState);
Response.AppendInt32(this.Score);
Response.AppendInt32(0);
Response.AppendInt32(0);
Response.AppendInt32(this.Category);
if (this.GroupId > 0u)
{
Response.AppendUInt(this.Group.Id);
Response.AppendString(this.Group.Name);
Response.AppendString(this.Group.Badge);
Response.AppendString("");
}
else
{
Response.AppendInt32(0);
Response.AppendString("");
Response.AppendString("");
Response.AppendString("");
}
Response.AppendInt32(this.TagCount);
string[] array = this.Tags.ToArray();
for (int i = 0; i < array.Length; i++)
{
string s = array[i];
Response.AppendString(s);
}
Response.AppendInt32(0);
Response.AppendInt32(0);
Response.AppendInt32(0);
Response.AppendBoolean(this.AllowPets == 1);
Response.AppendBoolean(this.AllowPetsEating == 1);
Response.AppendString("");
Response.AppendString("");
Response.AppendInt32(0);
Response.AppendBoolean(FromView);
Response.AppendBoolean(MercuryEnvironment.GetGame().GetNavigator().RoomIsPublicItem(this.Id));
Response.AppendBoolean(false);
Response.AppendBoolean(false);
Response.AppendInt32(this.WhoCanMute);
Response.AppendInt32(this.WhoCanKick);
Response.AppendInt32(this.WhoCanBan);
Response.AppendBoolean(room.CheckRights(Session, true, false));
Response.AppendInt32(this.ChatType);
Response.AppendInt32(this.ChatBalloon);
Response.AppendInt32(this.ChatSpeed);
Response.AppendInt32(this.ChatMaxDistance);
Response.AppendInt32(this.ChatFloodProtection);
if (SendRoom)
{
if (MercuryEnvironment.GetGame().GetRoomManager().GetRoom(this.Id) != null)
{
MercuryEnvironment.GetGame().GetRoomManager().GetRoom(this.Id).SendMessage(Response);
return;
}
}
else
{
Session.SendMessage(Response);
}
}