本文整理汇总了C#中Cyber.Messages.ServerMessage.Init方法的典型用法代码示例。如果您正苦于以下问题:C# ServerMessage.Init方法的具体用法?C# ServerMessage.Init怎么用?C# ServerMessage.Init使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Cyber.Messages.ServerMessage
的用法示例。
在下文中一共展示了ServerMessage.Init方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: UpdateUserOnRoller
internal ServerMessage UpdateUserOnRoller(RoomUser pUser, Point pNextCoord, uint pRollerID, double NextZ)
{
ServerMessage serverMessage = new ServerMessage(0);
serverMessage.Init(Outgoing.ItemAnimationMessageComposer);
serverMessage.AppendInt32(pUser.X);
serverMessage.AppendInt32(pUser.Y);
serverMessage.AppendInt32(pNextCoord.X);
serverMessage.AppendInt32(pNextCoord.Y);
serverMessage.AppendInt32(0);
serverMessage.AppendUInt(pRollerID);
serverMessage.AppendInt32(2);
serverMessage.AppendInt32(pUser.VirtualId);
serverMessage.AppendString(TextHandling.GetString(pUser.Z));
serverMessage.AppendString(TextHandling.GetString(NextZ));
this.room.GetGameMap().UpdateUserMovement(new Point(pUser.X, pUser.Y), new Point(pNextCoord.X, pNextCoord.Y), pUser);
this.room.GetGameMap().GameMap[pUser.X, pUser.Y] = 1;
pUser.X = pNextCoord.X;
pUser.Y = pNextCoord.Y;
pUser.Z = NextZ;
this.room.GetGameMap().GameMap[pUser.X, pUser.Y] = 0;
return serverMessage;
}
示例2: 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;
}
示例3: 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 = CyberEnvironment.GetGame().GetClientManager().GetClientByUserID(user7.Id);
if (clientByUserID != null)
{
clientByUserID.GetHabbo().UserGroups.Remove(user7);
if (clientByUserID.GetHabbo().FavouriteGroup == group.Id)
示例4: MoveBall
internal void MoveBall(RoomItem item, GameClient mover, int newX, int newY, RoomUser user)
{
if (item == null || mover == null)
return;
if (!room.GetGameMap().itemCanBePlacedHere(newX, newY))
return;
Point oldRoomCoord = item.Coordinate;
// bool itemIsOnGameItem = GameItemOverlaps(item);
Double NewZ = room.GetGameMap().Model.SqFloorHeight[newX, newY];
ServerMessage mMessage = new ServerMessage();
mMessage.Init(Outgoing.ItemAnimationMessageComposer); // Cf
mMessage.AppendInt32(item.Coordinate.X);
mMessage.AppendInt32(item.Coordinate.Y);
mMessage.AppendInt32(newX);
mMessage.AppendInt32(newY);
mMessage.AppendInt32(1);
mMessage.AppendUInt(item.Id);
mMessage.AppendString(TextHandling.GetString(item.GetZ));
mMessage.AppendString(TextHandling.GetString(NewZ));
mMessage.AppendUInt(item.Id);
room.SendMessage(mMessage);
item.ExtraData = "11";
item.UpdateNeeded = true;
if (oldRoomCoord.X == newX && oldRoomCoord.Y == newY)
return;
if (!room.GetRoomItemHandler().SetFloorItem(mover, item, newX, newY, item.Rot, false, false, false, false))
{
room.GetRoomItemHandler().SetFloorItem(item, newX, newY, NewZ);
}
HandleFootballGameItems(item.Coordinate, user);
}
示例5: SerializeClub
internal void SerializeClub()
{
GameClient client = this.GetClient();
ServerMessage serverMessage = new ServerMessage();
serverMessage.Init(Outgoing.SubscriptionStatusMessageComposer);
serverMessage.AppendString("club_habbo");
if (client.GetHabbo().GetSubscriptionManager().HasSubscription)
{
double num = (double)client.GetHabbo().GetSubscriptionManager().GetSubscription().ExpireTime;
double num2 = num - (double)CyberEnvironment.GetUnixTimestamp();
checked
{
int num3 = (int)Math.Ceiling(num2 / 86400.0);
int i = (int)Math.Ceiling(unchecked((double)CyberEnvironment.GetUnixTimestamp() - (double)client.GetHabbo().GetSubscriptionManager().GetSubscription().ActivateTime) / 86400.0);
int num4 = num3 / 31;
if (num4 >= 1)
{
num4--;
}
serverMessage.AppendInt32(num3 - num4 * 31);
serverMessage.AppendInt32(1);
serverMessage.AppendInt32(num4);
serverMessage.AppendInt32(1);
serverMessage.AppendBoolean(true);
serverMessage.AppendBoolean(true);
serverMessage.AppendInt32(i);
serverMessage.AppendInt32(i);
serverMessage.AppendInt32(10);
}
}
else
{
serverMessage.AppendInt32(0);
serverMessage.AppendInt32(0);
serverMessage.AppendInt32(0);
serverMessage.AppendInt32(0);
serverMessage.AppendBoolean(false);
serverMessage.AppendBoolean(false);
serverMessage.AppendInt32(0);
serverMessage.AppendInt32(0);
serverMessage.AppendInt32(0);
}
client.SendMessage(serverMessage);
ServerMessage serverMessage2 = new ServerMessage(Outgoing.UserClubRightsMessageComposer);
serverMessage2.AppendInt32(this.GetSubscriptionManager().HasSubscription ? 2 : 0);
serverMessage2.AppendUInt(this.Rank);
serverMessage2.AppendInt32(0);
client.SendMessage(serverMessage2);
}
示例6: GiveRespect
internal void GiveRespect()
{
Room room = CyberEnvironment.GetGame().GetRoomManager().GetRoom(this.Session.GetHabbo().CurrentRoomId);
if (room == null || this.Session.GetHabbo().DailyRespectPoints <= 0)
{
return;
}
RoomUser roomUserByHabbo = room.GetRoomUserManager().GetRoomUserByHabbo(this.Request.PopWiredUInt());
if (roomUserByHabbo == null || roomUserByHabbo.GetClient().GetHabbo().Id == this.Session.GetHabbo().Id || roomUserByHabbo.IsBot)
{
return;
}
CyberEnvironment.GetGame().GetQuestManager().ProgressUserQuest(this.Session, QuestType.SOCIAL_RESPECT, 0u);
CyberEnvironment.GetGame().GetAchievementManager().ProgressUserAchievement(this.Session, "ACH_RespectGiven", 1, false);
CyberEnvironment.GetGame().GetAchievementManager().ProgressUserAchievement(roomUserByHabbo.GetClient(), "ACH_RespectEarned", 1, false);
checked
{
this.Session.GetHabbo().DailyRespectPoints--;
roomUserByHabbo.GetClient().GetHabbo().Respect++;
using (IQueryAdapter queryreactor = CyberEnvironment.GetDatabaseManager().getQueryReactor())
{
queryreactor.runFastQuery(string.Concat(new object[]
{
"UPDATE user_stats SET respect = respect + 1 WHERE id = ",
roomUserByHabbo.GetClient().GetHabbo().Id,
" LIMIT 1;UPDATE user_stats SET daily_respect_points = daily_respect_points - 1 WHERE id= ",
this.Session.GetHabbo().Id,
" LIMIT 1"
}));
}
ServerMessage serverMessage = new ServerMessage(Outgoing.GiveRespectsMessageComposer);
serverMessage.AppendUInt(roomUserByHabbo.GetClient().GetHabbo().Id);
serverMessage.AppendInt32(roomUserByHabbo.GetClient().GetHabbo().Respect);
room.SendMessage(serverMessage);
ServerMessage thumbsUp = new ServerMessage();
thumbsUp.Init(Outgoing.RoomUserActionMessageComposer);
thumbsUp.AppendInt32(room.GetRoomUserManager().GetRoomUserByHabbo(this.Session.GetHabbo().Username).VirtualId);
thumbsUp.AppendInt32(7);
room.SendMessage(thumbsUp);
}
}
示例7: ChooseTVPlayerVideo
internal void ChooseTVPlayerVideo()
{
uint num = this.Request.PopWiredUInt();
int num2 = this.Request.PopWiredInt32();
PlayerTV playerTV = CyberEnvironment.GetGame().GetVideoManager().AddOrGetTV(num, this.Session.GetHabbo().CurrentRoomId);
RoomItem item = this.Session.GetHabbo().CurrentRoom.GetRoomItemHandler().GetItem(num);
if (item.GetBaseItem().InteractionType == InteractionType.youtubetv)
{
if (num2 >= 1)
{
playerTV.SetNextVideo();
}
else
{
playerTV.SetPreviousVideo();
}
ServerMessage serverMessage = new ServerMessage();
serverMessage.Init(Outgoing.YouTubeLoadVideoMessageComposer);
serverMessage.AppendUInt(num);
serverMessage.AppendString(playerTV.CurrentVideo);
serverMessage.AppendInt32(0);
serverMessage.AppendInt32(playerTV.Playlist.GetDuration(playerTV.CurrentVideo));
this.Response = serverMessage;
this.SendResponse();
item.ExtraData = playerTV.CurrentVideo;
ServerMessage message = new ServerMessage(Outgoing.UpdateRoomItemMessageComposer);
item.Serialize(message);
this.Session.GetHabbo().CurrentRoom.SendMessage(message);
}
}
示例8: UpdateUserStatus
//.........这里部分代码省略.........
User.team = Team.none;
avatarEffectsInventoryComponent.ActivateCustomEffect(0);
continue;
}
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];
}
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);
示例9: 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;
}
}
示例10: 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)
{
CyberEnvironment.GetGame().GetQuestManager().ProgressUserQuest(value.GetClient(), QuestType.SOCIAL_VISIT, 0u);
CyberEnvironment.GetGame().GetAchievementManager().ProgressUserAchievement(value.GetClient(), "ACH_RoomEntry", 1, false);
}
}
if (client.GetHabbo().GetMessenger() != null)
{
client.GetHabbo().GetMessenger().OnStatusChanged(true);
}
value.GetClient().GetMessageHandler().OnRoomUserAdd();
//.........这里部分代码省略.........
示例11: DeployBot
internal RoomUser DeployBot(RoomBot Bot, Pet PetData)
{
int virtualId = this.primaryPrivateUserID++;
RoomUser roomUser = new RoomUser(0u, this.room.RoomId, virtualId, this.room, false);
int num = this.secondaryPrivateUserID++;
roomUser.InternalRoomID = num;
this.userlist.Add(num, roomUser);
DynamicRoomModel model = this.room.GetGameMap().Model;
Point coord = new Point(Bot.X, Bot.Y);
if (Bot.X > 0 && Bot.Y > 0 && Bot.X < model.MapSizeX && Bot.Y < model.MapSizeY)
{
this.room.GetGameMap().AddUserToMap(roomUser, coord);
roomUser.SetPos(Bot.X, Bot.Y, Bot.Z);
roomUser.SetRot(Bot.Rot, false);
}
else
{
Bot.X = model.DoorX;
Bot.Y = model.DoorY;
roomUser.SetPos(model.DoorX, model.DoorY, model.DoorZ);
roomUser.SetRot(model.DoorOrientation, false);
}
roomUser.BotData = Bot;
checked
{
roomUser.BotAI = Bot.GenerateBotAI(roomUser.VirtualId, (int)Bot.BotId);
if (roomUser.IsPet)
{
roomUser.BotAI.Init(Bot.BotId, roomUser.VirtualId, this.room.RoomId, roomUser, this.room);
roomUser.PetData = PetData;
roomUser.PetData.VirtualId = roomUser.VirtualId;
}
else
{
roomUser.BotAI.Init(Bot.BotId, roomUser.VirtualId, this.room.RoomId, roomUser, this.room);
}
this.UpdateUserStatus(roomUser, false);
roomUser.UpdateNeeded = true;
ServerMessage serverMessage = new ServerMessage(Outgoing.SetRoomUserMessageComposer);
serverMessage.AppendInt32(1);
roomUser.Serialize(serverMessage, this.room.GetGameMap().gotPublicPool);
this.room.SendMessage(serverMessage);
roomUser.BotAI.OnSelfEnterRoom();
if (roomUser.IsPet)
{
if (this.pets.Contains(roomUser.PetData.PetId))
{
this.pets[roomUser.PetData.PetId] = roomUser;
}
else
{
this.pets.Add(roomUser.PetData.PetId, roomUser);
}
this.petCount++;
}
if (roomUser.BotData.AiType == AIType.Generic)
{
if (this.bots.Contains(roomUser.BotData.BotId))
{
this.bots[roomUser.BotData.BotId] = roomUser;
}
else
{
this.bots.Add(roomUser.BotData.BotId, roomUser);
}
serverMessage.Init(Outgoing.DanceStatusMessageComposer);
serverMessage.AppendInt32(roomUser.VirtualId);
serverMessage.AppendInt32(roomUser.BotData.DanceId);
this.room.SendMessage(serverMessage);
this.petCount++;
}
return roomUser;
}
}
示例12: OnCycle
internal void OnCycle(ref int idleCount)
{
this.ToRemove.Clear();
int count = 0;
foreach (RoomUser roomUser in this.UserList.Values)
{
if (!this.isValid(roomUser))
{
if (roomUser.GetClient() != null)
this.RemoveUserFromRoom(roomUser.GetClient(), false, false);
else
this.RemoveRoomUser(roomUser);
}
bool updated = false;
roomUser.IdleTime++;
if (!roomUser.IsBot && !roomUser.IsAsleep && roomUser.IdleTime >= 600)
{
roomUser.IsAsleep = true;
ServerMessage sleepMsg = new ServerMessage(Outgoing.RoomUserIdleMessageComposer);
sleepMsg.AppendInt32(roomUser.VirtualId);
sleepMsg.AppendBoolean(true);
this.room.SendMessage(sleepMsg);
}
if (roomUser.NeedsAutokick && !this.ToRemove.Contains(roomUser))
{
this.ToRemove.Add(roomUser);
continue;
}
else
{
if (roomUser.CarryItemID > 0)
{
roomUser.CarryTimer--;
if (roomUser.CarryTimer <= 0)
roomUser.CarryItem(0);
}
if (this.room.GotFreeze())
{
this.room.GetFreeze().CycleUser(roomUser);
}
if (roomUser.IsPet)
{
if (!roomUser.IsWalking && roomUser.Statusses.ContainsKey("mv"))
{
roomUser.ClearMovement(true);
}
}
bool invalidStep = false;
if (roomUser.SetStep)
{
if (this.room.GetGameMap().CanWalk(roomUser.SetX, roomUser.SetY, roomUser.AllowOverride) || roomUser.RidingHorse)
{
Gamemap gameMap = this.room.GetGameMap();
Point coordinate = roomUser.Coordinate;
int x = coordinate.X;
coordinate = roomUser.Coordinate;
int y = coordinate.Y;
Point oldCoord = new Point(x, y);
Point newCoord = new Point(roomUser.SetX, roomUser.SetY);
RoomUser user = roomUser;
gameMap.UpdateUserMovement(oldCoord, newCoord, user);
List<RoomItem> coordinatedItems = this.room.GetGameMap().GetCoordinatedItems(new Point(roomUser.X, roomUser.Y));
roomUser.X = roomUser.SetX;
roomUser.Y = roomUser.SetY;
roomUser.Z = roomUser.SetZ;
this.ToSet.Remove(new Point(roomUser.SetX, roomUser.SetY));
if (this.room.GotSoccer())
{
this.room.GetSoccer().OnUserWalk(roomUser);
}
lock (coordinatedItems)
{
foreach (RoomItem itemE in coordinatedItems)
{
itemE.UserWalksOffFurni(roomUser);
switch (itemE.GetBaseItem().InteractionType)
{
case InteractionType.tent:
case InteractionType.bedtent:
if (!roomUser.IsBot && roomUser.OnCampingTent)
{
ServerMessage serverMessage = new ServerMessage();
serverMessage.Init(Outgoing.UpdateFloorItemExtraDataMessageComposer);
serverMessage.AppendString(itemE.Id.ToString());
serverMessage.AppendInt32(0);
serverMessage.AppendString("0");
roomUser.GetClient().SendMessage(serverMessage);
roomUser.OnCampingTent = false;
}
break;
case InteractionType.runwaysage:
case InteractionType.shower:
//.........这里部分代码省略.........
示例13: 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((CyberEnvironment.GetGame().GetRoomManager().GenerateRoomData(Group.RoomId) == null) ? "No room found.." : CyberEnvironment.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((CyberEnvironment.getHabboForId(Group.CreatorId) == null) ? "" : CyberEnvironment.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);
}
}
示例14: AddExperience
internal void AddExperience(int Amount)
{
checked
{
int oldExperienceGoal = this.experienceGoal;
this.Experience += Amount;
if (this.Experience >= 51900)
{
return;
}
if (this.DBState != DatabaseUpdateState.NeedsInsert)
{
this.DBState = DatabaseUpdateState.NeedsUpdate;
}
if (this.Room != null)
{
ServerMessage serverMessage = new ServerMessage(Outgoing.AddPetExperienceMessageComposer);
serverMessage.AppendUInt(this.PetId);
serverMessage.AppendInt32(this.VirtualId);
serverMessage.AppendInt32(Amount);
this.Room.SendMessage(serverMessage);
if (this.Experience >= oldExperienceGoal)
{
GameClients.GameClient OwnerSession = CyberEnvironment.GetGame().GetClientManager().GetClientByUserID(OwnerId);
// Reset pet commands
PetCommands.Clear();
PetCommands = PetCommandHandler.GetPetCommands(this);
if (OwnerSession != null)
{
ServerMessage LevelNotify = new ServerMessage(Outgoing.NotifyNewPetLevelMessageComposer);
this.SerializeInventory(LevelNotify, true);
OwnerSession.SendMessage(LevelNotify);
ServerMessage TP = new ServerMessage();
TP.Init(Outgoing.PetTrainerPanelMessageComposer);
TP.AppendUInt(this.PetId);
List<short> AvailableCommands = new List<short>();
TP.AppendInt32(PetCommands.Count);
foreach (short Sh in PetCommands.Keys)
{
TP.AppendInt32(Sh);
if (PetCommands[Sh] == true)
{
AvailableCommands.Add(Sh);
}
}
TP.AppendInt32(AvailableCommands.Count);
foreach (short Sh in AvailableCommands)
{
TP.AppendInt32(Sh);
}
OwnerSession.SendMessage(TP);
}
}
}
}
}
示例15: GetPromotionableRooms
internal void GetPromotionableRooms()
{
ServerMessage serverMessage = new ServerMessage();
serverMessage.Init(Outgoing.CatalogPromotionGetRoomsMessageComposer);
serverMessage.AppendBoolean(true);
serverMessage.AppendInt32(this.Session.GetHabbo().UsersRooms.Count);
foreach (RoomData current in this.Session.GetHabbo().UsersRooms)
{
serverMessage.AppendUInt(current.Id);
serverMessage.AppendString(current.Name);
serverMessage.AppendBoolean(false);
}
this.Response = serverMessage;
this.SendResponse();
}