当前位置: 首页>>代码示例>>C#>>正文


C# Messages.ServerMessage类代码示例

本文整理汇总了C#中Silverwave.Messages.ServerMessage的典型用法代码示例。如果您正苦于以下问题:C# ServerMessage类的具体用法?C# ServerMessage怎么用?C# ServerMessage使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


ServerMessage类属于Silverwave.Messages命名空间,在下文中一共展示了ServerMessage类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: Trade

        internal Trade(UInt32 UserOneId, UInt32 UserTwoId, UInt32 RoomId)
        {
            this.oneId = UserOneId;
            this.twoId = UserTwoId;

            this.Users = new TradeUser[2];
            this.Users[0] = new TradeUser(UserOneId, RoomId);
            this.Users[1] = new TradeUser(UserTwoId, RoomId);
            this.TradeStage = 1;
            this.RoomId = RoomId;

            foreach (TradeUser User in Users)
            {
                if (!User.GetRoomUser().Statusses.ContainsKey("trd"))
                {
                    User.GetRoomUser().AddStatus("trd", "");
                    User.GetRoomUser().UpdateNeeded = true;
                }
            }

            ServerMessage Message = new ServerMessage(Outgoing.TradeStart);
            Message.AppendInt32(UserOneId);
            Message.AppendInt32(1); // ready
            Message.AppendInt32(UserTwoId);
            Message.AppendInt32(1); // ready
            SendMessageToUsers(Message);
        }
开发者ID:BjkGkh,项目名称:07052014,代码行数:27,代码来源:Trade.cs

示例2: Compose

        internal static ServerMessage Compose(GameClient Session, List<Achievement> Achievements)
        {
            ServerMessage Message = new ServerMessage(Outgoing.AchievementList);
            Message.AppendInt32(Achievements.Count);
            foreach (Achievement Achievement in Achievements)
            {
                UserAchievement UserData = Session.GetHabbo().GetAchievementData(Achievement.GroupName);
                int TargetLevel = (UserData != null ? UserData.Level + 1 : 1);
                int TotalLevels = Achievement.Levels.Count;

                if (TargetLevel > TotalLevels)
                {
                    TargetLevel = TotalLevels;
                }
                AchievementLevel TargetLevelData = Achievement.Levels[TargetLevel];
                Message.AppendInt32(Achievement.Id);                                                           // Unknown (ID?)
                Message.AppendInt32(TargetLevel);                                                   // Target level
                Message.AppendString(Achievement.GroupName + TargetLevel);                 // Target name/desc/badge
                Message.AppendInt32(TargetLevelData.RewardPixels);
                Message.AppendInt32(TargetLevelData.Requirement);                                   // Progress req/target
                Message.AppendInt32(TargetLevelData.RewardPoints);
                Message.AppendInt32(0); // Type of reward
                Message.AppendInt32(UserData != null ? UserData.Progress : 0);                      // Current progress
                Message.AppendBoolean(UserData != null ? (UserData.Level >= TotalLevels) : false);  // Set 100% completed(??)
                Message.AppendString(Achievement.Category);                                // Category
                Message.AppendString(String.Empty);
                Message.AppendInt32(TotalLevels);                                                   // Total amount of levels
                Message.AppendInt32(0);
            }
            Message.AppendString("");
            return Message;
        }
开发者ID:BjkGkh,项目名称:07052014,代码行数:32,代码来源:AchievementListComposer.cs

示例3: SerializeWall

        internal void SerializeWall(ServerMessage Message, Boolean Inventory)
        {
            Message.AppendInt32(Id);
            Message.AppendString(mBaseItem.Type.ToString().ToUpper());
            Message.AppendInt32(Id);
            Message.AppendInt32(GetBaseItem().SpriteId);

            if (GetBaseItem().Name.Contains("a2"))
            {
                Message.AppendInt32(3);
            }
            else if (GetBaseItem().Name.Contains("wallpaper"))
            {
                Message.AppendInt32(2);
            }
            else if (GetBaseItem().Name.Contains("landscape"))
            {
                Message.AppendInt32(4);
            }
            else
            {
                Message.AppendInt32(1);
            }
            Message.AppendInt32(0);
            Message.AppendString(ExtraData);
            Message.AppendBoolean(GetBaseItem().AllowRecycle);
            Message.AppendBoolean(GetBaseItem().AllowTrade);
            Message.AppendBoolean(GetBaseItem().AllowInventoryStack);
            Message.AppendBoolean(false);
            Message.AppendInt32(-1);
            Message.AppendBoolean(true);
            Message.AppendInt32(-1);
        }
开发者ID:BjkGkh,项目名称:07052014,代码行数:33,代码来源:UserItem.cs

示例4: Serialize

        public void Serialize(ServerMessage Message)
        {
            Message.AppendString(this.Name);
            Message.AppendInt32(this.ItemId);
            Message.AppendInt32(this.X);
            Message.AppendInt32(this.Y);
            Message.AppendInt32(0); // Z
            Message.AppendInt32(1);
            Message.AppendInt32(this.Sprite);
            Message.AppendInt32(this.Rot);
            Message.AppendInt32(0);

            if (this.Name.Contains("background"))
            {
                Message.AppendBoolean(true);
                Message.AppendInt32(1);
                Message.AppendInt32(5);
                Message.AppendString("state");
                Message.AppendString("0");
                Message.AppendString("offsetZ");
                Message.AppendString("9920");
                Message.AppendString("offsetY");
                Message.AppendString("1520");
                Message.AppendString("imageUrl");
                Message.AppendString("http://localhost/c_images/DEV_tests/snst_bg_2_big.png");
                Message.AppendString("offsetX");
                Message.AppendString("-1070");
            }
            else
            {
                Message.AppendBoolean(false);
                Message.AppendInt32(0);
                Message.AppendString(this.Extradata);
            }
        }
开发者ID:BjkGkh,项目名称:07052014,代码行数:35,代码来源:SnowMap.cs

示例5: Compose

        internal static ServerMessage Compose(GameClient Session, Quest Quest)
        {
            //  518:S,I,I,I,I,B,S,S,I,S,I,I,I,S,S,B,B

            int AmountInCat = SilverwaveEnvironment.GetGame().GetQuestManager().GetAmountOfQuestsInCategory(Quest.Category);
            int Number = Quest == null ? AmountInCat : Quest.Number;
            int UserProgress = Quest == null ? 0 : Session.GetHabbo().GetQuestProgress(Quest.Id);
            ServerMessage Message = new ServerMessage(Outgoing.QuestCompletedCompser);
            Message.AppendString(Quest.Category);
            Message.AppendInt32(Number); // Quest progress in this cat
            Message.AppendInt32((Quest.Name.Contains("xmas2012")) ? 1 : AmountInCat); // Total quests in this cat
            Message.AppendInt32(Quest == null ? 3 : Quest.RewardType); // Reward type (1 = Snowflakes, 2 = Love hearts, 3 = Pixels, 4 = Seashells, everything else is pixels
            Message.AppendInt32(Quest == null ? 0 : Quest.Id); // Quest id
            Message.AppendBoolean(Quest == null ? false : Session.GetHabbo().CurrentQuestId == Quest.Id); // Quest started
            Message.AppendString(Quest == null ? string.Empty : Quest.ActionName);
            Message.AppendString(Quest == null ? string.Empty : Quest.DataBit);
            Message.AppendInt32(Quest == null ? 0 : Quest.Reward);
            Message.AppendString(Quest == null ? string.Empty : Quest.Name);
            Message.AppendInt32(UserProgress); // Current progress
            Message.AppendInt32(Quest == null ? 0 : Quest.GoalData); // Target progress
            Message.AppendInt32(Quest == null ? 0 : Quest.TimeUnlock); // "Next quest available countdown" in seconds
            Message.AppendString("");
            Message.AppendString("");
            Message.AppendBoolean(true); // ?
            Message.AppendBoolean(true); // Activate next quest..
            return Message;
        }
开发者ID:BjkGkh,项目名称:07052014,代码行数:27,代码来源:QuestCompletedComposer.cs

示例6: Serialize

        internal void Serialize(ServerMessage Request)
        {
            // [email protected]22033860

            Request.AppendInt32(FromUser);
            Request.AppendString(mUsername);
            Habbo user = SilverwaveEnvironment.getHabboForName(mUsername);
            Request.AppendString((user != null) ? user.Look : "");
        }
开发者ID:BjkGkh,项目名称:Custom-R2,代码行数:9,代码来源:MessengerRequest.cs

示例7: OnTrigger

        public void OnTrigger(GameClients.GameClient Session, RoomItem Item, int Request, bool HasRights)
        {
            if (Session == null)
                return;
            RoomUser User = Item.GetRoom().GetRoomUserManager().GetRoomUserByHabbo(Session.GetHabbo().Id);
            if (User == null)
            {
                return;
            }

            if (!((Math.Abs((int)(User.X - Item.GetX)) >= 2) || (Math.Abs((int)(User.Y - Item.GetY)) >= 2)))
            {
                User.SetRot(Rotation.Calculate(User.X, User.Y, Item.GetX, Item.GetY), false);
                if (User.RotBody % 2 != 0)
                {
                    User.MoveTo(Item.GetX + 1, Item.GetY);
                    return;
                }
                Room Room = Item.GetRoom();
                Point NewPoint = new Point(0, 0);
                if (User.RotBody == 4)
                { NewPoint = new Point(Item.GetX, Item.GetY + 1); }

                if (User.RotBody == 0)
                { NewPoint = new Point(Item.GetX, Item.GetY - 1); }

                if (User.RotBody == 6)
                { NewPoint = new Point(Item.GetX - 1, Item.GetY); }

                if (User.RotBody == 2)
                { NewPoint = new Point(Item.GetX + 1, Item.GetY); }

                if (Room.GetGameMap().ValidTile(NewPoint.X, NewPoint.Y) && Room.GetGameMap().itemCanBePlacedHere(NewPoint.X, NewPoint.Y) && Room.GetGameMap().CanRollItemHere(NewPoint.X, NewPoint.Y))
                {
                    Double NewZ = Item.GetRoom().GetGameMap().SqAbsoluteHeight(NewPoint.X, NewPoint.Y);

                    ServerMessage mMessage = new ServerMessage();
                    mMessage.Init(Outgoing.ObjectOnRoller); // Cf
                    mMessage.AppendInt32(Item.GetX);
                    mMessage.AppendInt32(Item.GetY);
                    mMessage.AppendInt32(NewPoint.X);
                    mMessage.AppendInt32(NewPoint.Y);
                    mMessage.AppendInt32(1);
                    mMessage.AppendInt32(Item.Id);
                    mMessage.AppendString(Item.GetZ.ToString().Replace(',', '.'));
                    mMessage.AppendString(NewZ.ToString().Replace(',', '.'));
                    mMessage.AppendInt32(0);
                    Room.SendMessage(mMessage);

                    Item.GetRoom().GetRoomItemHandler().SetFloorItem(User.GetClient(), Item, NewPoint.X, NewPoint.Y, Item.Rot, false, false, false);
                }
            }
            else
            {
                User.MoveTo(Item.GetX + 1, Item.GetY);
            }
        }
开发者ID:BjkGkh,项目名称:07052014,代码行数:57,代码来源:InteractorPuzzleBox.cs

示例8: DeliverInstantMessage

        internal void DeliverInstantMessage(string message, uint convoID)
        {
            ServerMessage InstantMessage = new ServerMessage(Outgoing.InstantChat);
            InstantMessage.AppendInt32(convoID);
            InstantMessage.AppendString(message);
            InstantMessage.AppendInt32(0);// + string.Empty);

            GetClient().SendMessage(InstantMessage);
        }
开发者ID:BjkGkh,项目名称:07052014,代码行数:9,代码来源:HabboMessenger.cs

示例9: SendToPlayers

 public void SendToPlayers(ServerMessage Response)
 {
     foreach (SnowPlayer Player in Players.Values)
     {
         if (Player.GetClient() != null)
         {
             Player.GetClient().SendMessage(Response);
         }
     }
 }
开发者ID:BjkGkh,项目名称:07052014,代码行数:10,代码来源:SnowGame.cs

示例10: AccountGameStatusMessage

 internal void AccountGameStatusMessage()
 {
     ServerMessage container = new ServerMessage(Outgoing.Game2AccountGameStatusMessageComposer);
     {
         container.AppendInt32(Request.PopWiredInt32());
         container.AppendInt32(-1);
         container.AppendInt32(0);
         Session.SendMessage(container);
     }
 }
开发者ID:BjkGkh,项目名称:Custom-R2,代码行数:10,代码来源:GameCenter.cs

示例11: SmallPromoComposer

        internal ServerMessage SmallPromoComposer(ServerMessage Message)
        {
            Message.AppendInt32(HotelViewPromosIndexers.Count);
            foreach (SmallPromo promo in HotelViewPromosIndexers)
            {
                promo.Serialize(Message);
            }

            return Message;
        }
开发者ID:BjkGkh,项目名称:Custom-R2,代码行数:10,代码来源:HotelView.cs

示例12: GenerateExtraData

 internal ServerMessage GenerateExtraData(ServerMessage Message)
 {
     Message.AppendInt32(0);
     Message.AppendInt32(5);
     Message.AppendInt32(4);
     Message.AppendInt32(Enabled);
     Message.AppendInt32(Data1);
     Message.AppendInt32(Data2);
     Message.AppendInt32(Data3);
     return Message;
 }
开发者ID:BjkGkh,项目名称:Custom-R2,代码行数:11,代码来源:TonerData.cs

示例13: OnCycle

        public void OnCycle()
        {
            ServerMessage Response = new ServerMessage();

            if (GameState == 0)
            {
                if (Players.Count >= 1 && NextTimeAction == 0)
                {
                    NextTimeAction = SilverwaveEnvironment.GetUnixTimestamp() + StormConfig.PreGameTimer;
                    
                    Response.Init(Outgoing.SnowStartLobbyCounter);
                    Response.AppendInt32(StormConfig.PreGameTimer);
                    SendToPlayers(Response);
                }
                else if (Players.Count >= 1 && NextTimeAction < SilverwaveEnvironment.GetUnixTimestamp())
                {
                    GameState = 1;
                    StartLobby();
                    NextTimeAction = SilverwaveEnvironment.GetUnixTimestamp() + StormConfig.LobbyTimer;
                }
                else if (Players.Count < 1 && NextTimeAction > 0)
                {
                    Response.Init(Outgoing.SnowStopLobbyCounter);
                    SendToPlayers(Response);
                    NextTimeAction = 0;
                }
            }
            else if (GameState == 1) // In Lobby
            {
                if (NextTimeAction < SilverwaveEnvironment.GetUnixTimestamp())
                {
                    StartStage();
                    GameState = 2;
                    NextTimeAction = SilverwaveEnvironment.GetUnixTimestamp() + 5;
                }
            }
            else if(GameState == 2) // On Snow, Waiting
            {
                if (NextTimeAction <= SilverwaveEnvironment.GetUnixTimestamp())
                {
                    Response.Init(Outgoing.SnowStageRunning);
                    Response.AppendInt32(StormConfig.GameLength);
                    SendToPlayers(Response);
                    GameState = 3;
                }
            }
            else if (GameState == 3) // Playing
            {
                CycleStage();
            }
            //Console.WriteLine("mILLISECONDS: " + (SilverwaveEnvironment.Now() - lastrun).ToString() + " cycle:" + CurrentCycle);
            lastrun = SilverwaveEnvironment.Now();
        }
开发者ID:BjkGkh,项目名称:07052014,代码行数:53,代码来源:SnowGame.cs

示例14: SerializeFloor

        internal void SerializeFloor(ServerMessage Message, Boolean Inventory)
        {
            int result = 0;
            if (this.GetBaseItem().InteractionType == InteractionType.gift && ExtraData.Contains(Convert.ToChar(5).ToString()))
            {
                int color = int.Parse(ExtraData.Split((char)5)[1]);
                int lazo = int.Parse(ExtraData.Split((char)5)[2]);
                result = color * 1000 + lazo;
            }

            Message.AppendInt32(Id);
            Message.AppendString(mBaseItem.Type.ToString().ToUpper());
            Message.AppendInt32(Id);
            Message.AppendInt32(GetBaseItem().SpriteId);
            if (GetBaseItem().InteractionType == InteractionType.gld_item || this.GetBaseItem().InteractionType == InteractionType.gld_gate)
            {
                Group Group = SilverwaveEnvironment.GetGame().GetGroupManager().GetGroup(GroupId);
                if (Group != null)
                {
                    Message.AppendInt32(17);


                    Message.AppendInt32(2);
                    Message.AppendInt32(5);
                    Message.AppendString(ExtraData);
                    Message.AppendString(Group.Id.ToString());
                    Message.AppendString(Group.Badge);
                    Message.AppendString(SilverwaveEnvironment.GetGame().GetGroupManager().GetGroupColour(Group.Colour1, true)); // Group Colour 1
                    Message.AppendString(SilverwaveEnvironment.GetGame().GetGroupManager().GetGroupColour(Group.Colour2, false)); // Group Colour 2
                }
                else
                {
                    Message.AppendInt32(1);
                    Message.AppendInt32(0);
                    Message.AppendString(ExtraData);
                }
            }
            else
            {
                Message.AppendInt32(1);
                Message.AppendInt32(0);
                Message.AppendString(ExtraData);
            }
            Message.AppendBoolean(GetBaseItem().AllowRecycle);
            Message.AppendBoolean(GetBaseItem().AllowTrade);
            Message.AppendBoolean(GetBaseItem().AllowInventoryStack);
            Message.AppendBoolean(false); // Marketplace
            Message.AppendInt32(-1); //second to expiration
            Message.AppendBoolean(true); //has rent period started
            Message.AppendInt32(-1);
            Message.AppendString("");
            Message.AppendInt32(0);
        }
开发者ID:BjkGkh,项目名称:07052014,代码行数:53,代码来源:UserItem.cs

示例15: Compose

        internal static ServerMessage Compose(int PlaylistCapacity, List<SongInstance> Playlist)
        {
            ServerMessage Message = new ServerMessage(Outgoing.ComposeJukebox);
            Message.AppendInt32(PlaylistCapacity);
            Message.AppendInt32(Playlist.Count);

            foreach (SongInstance Song in Playlist)
            {
                Message.AppendInt32(Song.DiskItem.itemID);
                Message.AppendInt32(Song.SongData.Id);
            }

            return Message;
        }
开发者ID:BjkGkh,项目名称:Custom-R2,代码行数:14,代码来源:JukeboxDiscksComposer.cs


注:本文中的Silverwave.Messages.ServerMessage类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。