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


C# ServerMessage.Init方法代码示例

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


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

示例1: 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

示例2: 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

示例3: DeployBot

        internal RoomUser DeployBot(RoomBot Bot, Pet PetData)
        {
            int num2;
            this.primaryPrivateUserID = (num2 = this.primaryPrivateUserID) + 1;
            RoomUser BotUser = new RoomUser(0, this.room.RoomId, num2, this.room, false);
            this.secondaryPrivateUserID = (num2 = this.secondaryPrivateUserID) + 1;
            int key = num2;
            BotUser.InternalRoomID = key;
            this.userlist.Add(key, BotUser);
            DynamicRoomModel Model = this.room.GetGameMap().Model;
            Point myPoint = new Point(Bot.X,Bot.Y);
            if ((Bot.X > 0 && Bot.Y > 0) && Bot.X < Model.MapSizeX && Bot.Y < Model.MapSizeY)
            {
                room.GetGameMap().AddUserToMap(BotUser, myPoint);
                BotUser.SetPos(Bot.X, Bot.Y, Bot.Z);
                BotUser.SetRot(Bot.Rot, false);
            }
            else
            {
                Bot.X = Model.DoorX;
                Bot.Y = Model.DoorY;

                BotUser.SetPos(Model.DoorX, Model.DoorY, Model.DoorZ);
                BotUser.SetRot(Model.DoorOrientation, false);
            }

            BotUser.BotData = Bot;
            BotUser.BotAI = Bot.GenerateBotAI(BotUser.VirtualId,(int)Bot.BotId);

            if (BotUser.IsPet)
            {

                BotUser.BotAI.Init(Bot.BotId, BotUser.VirtualId, room.RoomId, BotUser, room);
                BotUser.PetData = PetData;
                BotUser.PetData.VirtualId = BotUser.VirtualId;
            }
            else
            {
                BotUser.BotAI.Init(Bot.BotId, BotUser.VirtualId, room.RoomId, BotUser, room);
            }

            this.UpdateUserStatus(BotUser, false);
            BotUser.UpdateNeeded = true;

            ServerMessage EnterMessage = new ServerMessage(Outgoing.PlaceBot);
            EnterMessage.AppendInt32(1);
            BotUser.Serialize(EnterMessage, room.GetGameMap().gotPublicPool);
            room.SendMessage(EnterMessage);

            BotUser.BotAI.OnSelfEnterRoom();

            if (BotUser.IsPet)
            {
                if (pets.ContainsKey(BotUser.PetData.PetId)) //Pet allready placed
                    pets[BotUser.PetData.PetId] = BotUser;
                else
                    pets.Add(BotUser.PetData.PetId, BotUser);

                petCount++;
            }
            if (BotUser.BotData.AiType == AIType.Generic)
            {
                if (bots.ContainsKey(BotUser.BotData.BotId))
                    bots[BotUser.BotData.BotId] = BotUser;
                else
                {
                    bots.Add(BotUser.BotData.BotId, BotUser);
                }

                EnterMessage.Init(Outgoing.Dance);
                EnterMessage.AppendInt32(BotUser.VirtualId);
                EnterMessage.AppendInt32(BotUser.BotData.DanceId);
                room.SendMessage(EnterMessage);
                petCount++;
            }

            return BotUser;
        }
开发者ID:BjkGkh,项目名称:07052014,代码行数:78,代码来源:RoomUserManager.cs

示例4: SendNewItems

 internal void SendNewItems(int Id)
 {
     ServerMessage Response = new ServerMessage();
     Response.Init(Outgoing.SendPurchaseAlert);
     Response.AppendInt32(1); // items
     Response.AppendInt32(1); // type (gift) == s
     Response.AppendInt32(1);
     Response.AppendInt32(Id);
     mClient.SendMessage(Response);
 }
开发者ID:BjkGkh,项目名称:Custom-R2,代码行数:10,代码来源:InventoryComponent.cs

示例5: UpdateUserOnRoller

        internal ServerMessage UpdateUserOnRoller(RoomUser pUser, Point pNextCoord, uint pRollerID, Double NextZ)
        {
            ServerMessage mMessage = new ServerMessage(0);
            mMessage.Init(Outgoing.ObjectOnRoller); // Cf
            mMessage.AppendInt32(pUser.X);
            mMessage.AppendInt32(pUser.Y);

            mMessage.AppendInt32(pNextCoord.X);
            mMessage.AppendInt32(pNextCoord.Y);

            mMessage.AppendInt32(0);
            mMessage.AppendInt32(pRollerID);
            mMessage.AppendInt32(2);
            mMessage.AppendInt32(pUser.VirtualId);
            mMessage.AppendString(TextHandling.GetString(pUser.Z));
            mMessage.AppendString(TextHandling.GetString(NextZ));

            room.GetGameMap().UpdateUserMovement(new Point(pUser.X, pUser.Y), new Point(pNextCoord.X, pNextCoord.Y), pUser);
            room.GetGameMap().GameMap[pUser.X, pUser.Y] = 1;
            pUser.X = pNextCoord.X;
            pUser.Y = pNextCoord.Y;
            pUser.Z = NextZ;
            room.GetGameMap().GameMap[pUser.X, pUser.Y] = 0;

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

示例6: OnUserAdd

        private void OnUserAdd(object sender, EventArgs args)
        {
            try
            {
                if (sender == null)// || args == null)
                    return;

                KeyValuePair<int, RoomUser> userPair = (KeyValuePair<int, RoomUser>)sender;;

                RoomUser user = userPair.Value;

                if (user == null || user.GetClient() == null || user.GetClient().GetHabbo() == null)
                    return;

                GameClient session = user.GetClient();

                if (session == null || session.GetHabbo() == null || room == null)
                    return;

                if (!user.IsSpectator)
                {
                    DynamicRoomModel Model = room.GetGameMap().Model;
                    if (Model == null)
                        return;
                    user.SetPos(Model.DoorX, Model.DoorY, Model.DoorZ);
                    user.SetRot(Model.DoorOrientation, false);

                    if (room.CheckRights(session, true, false))
                    {
                        user.AddStatus("flatctrl 4", "");
                    }
                    else if (room.CheckRights(session, false, true))
                    {
                        user.AddStatus("flatctrl 1", "");
                    }
                    else if (room.CheckRights(session))
                    {
                        user.AddStatus("flatctrl 1", "");
                    }
                    user.CurrentItemEffect = ItemEffectType.None;

                    //UpdateUserEffect(User, User.X, User.Y);

                    if (!user.IsBot && user.GetClient().GetHabbo().IsTeleporting)
                    {
                        RoomItem Item = room.GetRoomItemHandler().GetItem(user.GetClient().GetHabbo().TeleporterId);

                        if (Item != null)
                        {
                            Item.ExtraData = "2";
                            Item.UpdateState(false, true);

                            user.SetPos(Item.GetX, Item.GetY, Item.GetZ);
                            user.SetRot(Item.Rot, false);

                            Item.InteractingUser2 = session.GetHabbo().Id;
                            Item.ExtraData = "0";
                            Item.UpdateState(false, true);
                        }
                    }

                    if (!user.IsBot && user.GetClient().GetHabbo().IsHopping)
                    {
                        RoomItem Item = room.GetRoomItemHandler().GetItem(user.GetClient().GetHabbo().HopperId);

                        if (Item != null)
                        {
                            Item.ExtraData = "1";
                            Item.UpdateState(false, true);
                            user.SetPos(Item.GetX, Item.GetY, Item.GetZ);
                            user.SetRot(Item.Rot, false);
                            user.AllowOverride = false;
                            Item.InteractingUser2 = session.GetHabbo().Id;
                            Item.ExtraData = "2";
                            Item.UpdateState(false, true);
                        }
                    }

                    if (!AntiMutant.ValidateLook(user.GetClient().GetHabbo().Look, user.GetClient().GetHabbo().Gender.ToUpper()))
                    {
                        if (user.GetClient().GetHabbo().Gender.ToLower() == "m")
                            user.GetClient().GetHabbo().Look = "hr-893-44.hd-180-12.ch-210-73.lg-270-73";
                        else
                            user.GetClient().GetHabbo().Look = "hr-890-39.hd-629-8.ch-685-64.lg-700-78.he-1602-72.wa-2011";
                        user.GetClient().SendNotif("Your look has been flagged as invalid and reset.");

                        using (IQueryAdapter dbClient = SilverwaveEnvironment.GetDatabaseManager().getQueryreactor())
                        {
                            dbClient.setQuery("UPDATE users SET look = @look WHERE id = " + user.GetClient().GetHabbo().Id);
                            dbClient.addParameter("look", user.GetClient().GetHabbo().Look);
                            dbClient.runQuery();
                        }
                        user.GetClient().GetMessageHandler().GetResponse().Init(Outgoing.UpdateUserInformation);
                        user.GetClient().GetMessageHandler().GetResponse().AppendInt32(-1);
                        user.GetClient().GetMessageHandler().GetResponse().AppendString(user.GetClient().GetHabbo().Look);
                        user.GetClient().GetMessageHandler().GetResponse().AppendString(user.GetClient().GetHabbo().Gender.ToLower());
                        user.GetClient().GetMessageHandler().GetResponse().AppendString(user.GetClient().GetHabbo().Motto);
                        user.GetClient().GetMessageHandler().GetResponse().AppendInt32(user.GetClient().GetHabbo().AchievementPoints);
                        user.GetClient().GetMessageHandler().SendResponse();

//.........这里部分代码省略.........
开发者ID:BjkGkh,项目名称:07052014,代码行数:101,代码来源:RoomUserManager.cs

示例7: CountTeamPoints

        private void CountTeamPoints()
        {
            room.GetGameManager().Reset();

            foreach (RoomUser user in room.GetRoomUserManager().UserList.Values)
            {
                if (user.IsBot || user.team == Team.none || user.GetClient() == null)
                    continue;

                user.banzaiPowerUp = FreezePowerUp.None;
                user.FreezeLives = 3;
                user.shieldActive = false;
                user.shieldCounter = 11;

                room.GetGameManager().AddPointToTeam(user.team, 30, null);

                ServerMessage message = new ServerMessage();
                message.Init(Outgoing.UpdateFreezeLives);
                message.AppendInt32(user.InternalRoomID);
                message.AppendInt32(user.FreezeLives);

                user.GetClient().SendMessage(message);
            }
        }
开发者ID:BjkGkh,项目名称:07052014,代码行数:24,代码来源:Freeze.cs

示例8: LeaveGame

        public void LeaveGame(SnowGame Game, uint UserId)
        {
            Game.Players.Remove(UserId);

            if (Game.Players.Count == 0)
            {
                Games.Remove(Game.Id);
            }

            ServerMessage Response = new ServerMessage();
            Response.Init(Outgoing.SnowUserLeft);
            Response.AppendInt32(UserId);
            Game.SendToPlayers(Response);
        }
开发者ID:BjkGkh,项目名称:07052014,代码行数:14,代码来源:SnowManager.cs

示例9: StartStage

        private void StartStage()
        {
            foreach (SnowPlayer Player in Players.Values)
            {
                Player.X = Player.TargetX = Map.Spawns[0].Position.X;
                Player.Y = Player.TargetY = Map.Spawns[0].Position.Y;
                Player.Rotation = Map.Spawns[0].Rotation;
            }

            ServerMessage Response = new ServerMessage();
            Response.Init(Outgoing.SnowStageStarting);
            Response.AppendInt32(0);
            Response.AppendString("snowwar_arena_0");
            Response.AppendInt32(5);
            Response.AppendInt32(Players.Count);
            foreach (SnowPlayer User in Players.Values)
            {
                Response.AppendInt32((int)StormObjectId.HUMAN);
                Response.AppendInt32(User.Id);
                Response.AppendInt32(User.X * 3200); // Current X * 3200
                Response.AppendInt32(User.Y * 3200); // Current Y * 3200
                Response.AppendInt32(User.X); // Current X
                Response.AppendInt32(User.Y); // Current Y
                Response.AppendInt32(User.Rotation); // rotation
                Response.AppendInt32(User.Health); // Energy
                Response.AppendInt32(User.Balls); // Balls
                Response.AppendInt32(0);
                Response.AppendInt32(0);
                Response.AppendInt32(0); // Status
                Response.AppendInt32(User.TargetX); // Target X
                Response.AppendInt32(User.TargetY); // Target Y
                Response.AppendInt32(User.TargetX * 3200); // Target X * 3200
                Response.AppendInt32(User.TargetY * 3200); // Target Y * 3200
                Response.AppendInt32(User.Score); // Score
                Response.AppendInt32(User.Team);
                Response.AppendInt32(User.GetHabbo().Id);
                Response.AppendString(User.GetHabbo().Username);
                Response.AppendString(User.GetHabbo().Motto);
                Response.AppendString(User.GetHabbo().Look);
                Response.AppendString(User.GetHabbo().Gender.ToLower());
            }
            //Response.AppendInt32(3);
            //Response.AppendInt32(0); // id
            //Response.AppendInt32(8 * 3200);
            //Response.AppendInt32(14 * 3200);
            //Response.AppendInt32(12);
            //Response.AppendInt32(4);
            //Response.AppendInt32(8);
            

            SendToPlayers(Response);
            /*1: (Snowball)
            ints = 9 - x, y, z, direction, ?, "ttl", ?, ?, ?
            2: (Tree) //_-53S.TreeGameObject
            ints = 7 - x, y, direction, height, ?, ?, ? << Last 2 possibly tree max hits/current hits
            3: (SnowPile) //_-53S._-49F
            ints = 5 - x, y, ?, ?, ?
            4: (SnowMachine)
            ints = 6 - x, y, direction, max balls (5), current balls, ?
            5: (Human)
            ints = 17*/
        }
开发者ID:BjkGkh,项目名称:07052014,代码行数:62,代码来源:SnowGame.cs

示例10: MoveBall

        internal void MoveBall(RoomItem item, GameClient mover, int newX, int newY)
        {
            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 Message = new ServerMessage(Outgoing.UpdateItemOnRoom);
            Message.AppendUInt(item.Id);
            Message.AppendInt32(item.GetBaseItem().SpriteId);
            Message.AppendInt32(item.Coordinate.X);
            Message.AppendInt32(item.Coordinate.Y);
            Message.AppendInt32(item.Rot);
            Message.AppendString(String.Format("{0:0.00}", TextHandling.GetString(item.GetZ)));
            Message.AppendInt32(0);
            Message.AppendInt32(0);
            if (item.GetBaseItem().InteractionType != InteractionType.fbgate)
                Message.AppendString(item.ExtraData);
            else
                Message.AppendString(string.Empty);
            Message.AppendInt32(-1);
            Message.AppendInt32(1); // Type New R63 ('use bottom')
            Message.AppendUInt(item.InteractingUser);
            Message.AppendUInt(item.Id);
            Message.AppendUInt(3508);
            Message.AppendInt32(item.Coordinate.X);
            Message.AppendInt32(item.Coordinate.Y);
            Message.AppendInt32(newX);
            Message.AppendInt32(newY);
            Message.AppendUInt(4);
            Message.AppendString(NewZ.ToString());
            Message.AppendString("H11");
            Message.AppendInt32(-1);
            Message.AppendInt32(0);
            room.SendMessage(Message);*/

            ServerMessage mMessage = new ServerMessage();
            mMessage.Init(Outgoing.ObjectOnRoller); // Cf
            mMessage.AppendInt32(item.Coordinate.X);
            mMessage.AppendInt32(item.Coordinate.Y);
            mMessage.AppendInt32(newX);
            mMessage.AppendInt32(newY);
            mMessage.AppendInt32(1);
            mMessage.AppendInt32(item.Id);
            mMessage.AppendString(item.GetZ.ToString().Replace(',', '.'));
            mMessage.AppendString(NewZ.ToString().Replace(',', '.'));
            mMessage.AppendInt32(0);
            room.SendMessage(mMessage);

            if (oldRoomCoord.X == newX && oldRoomCoord.Y == newY)
                return;

            room.GetRoomItemHandler().SetFloorItem(mover, item, newX, newY, item.Rot, false, false, false, false);

            if (!itemIsOnGameItem)
                HandleFootballGameItems(new Point(newX, newY), room.GetRoomUserManager().GetRoomUserByHabbo(mover.GetHabbo().Id));
        }
开发者ID:BjkGkh,项目名称:07052014,代码行数:63,代码来源:Soccer.cs

示例11: SerializeRoomChatlog

        internal static ServerMessage SerializeRoomChatlog(uint roomID)
        {
            // NEW CHATLOGS [March 2014] Coded by Finn
            // Please don't remove credits, this took me some time to do... :(
            // Credits to Itachi for the structure's "context" enigma :D




            ServerMessage Message = new ServerMessage();
            RoomData Room = SilverwaveEnvironment.GetGame().GetRoomManager().GenerateRoomData(roomID);
            if (Room == null)
            {
                throw new NullReferenceException("No room found.");
            }




            Message.Init(Outgoing.RoomChatlog);
            Message.AppendByte(1);
            Message.AppendShort(2);
            Message.AppendString("roomName");
            Message.AppendByte(2);
            Message.AppendString(Room.Name);
            Message.AppendString("roomId");
            Message.AppendByte(1);
            Message.AppendInt32(Room.Id);




            Message.AppendShort(Room.RoomChat.Count);
            Room.RoomChat.Reverse();
            foreach (Chatlog Log in Room.RoomChat)
            {
                Habbo Habbo = SilverwaveEnvironment.getHabboForId(Log.UserId);
                DateTime Date = SilverwaveEnvironment.UnixToDateTime(Log.Timestamp);
                if (Habbo == null)
                {
                    Message.AppendInt32((DateTime.Now - Date).Seconds);
                    Message.AppendInt32(Log.UserId);
                    Message.AppendString("*User not found*");
                    Message.AppendString(Log.Message);
                    Message.AppendBoolean(true);
                }
                else
                {
                    Message.AppendInt32((DateTime.Now - Date).Seconds);
                    Message.AppendInt32(Habbo.Id);
                    Message.AppendString(Habbo.Username);
                    Message.AppendString(Log.Message);
                    Message.AppendBoolean(false); // Text is bold
                }
            }
            Room.RoomChat.Reverse();
            return Message;
        }
开发者ID:BjkGkh,项目名称:07052014,代码行数:58,代码来源:ModerationTool.cs

示例12: StartLobby

        private void StartLobby()
        {
            ServerMessage Response = new ServerMessage();

            Response.Init(Outgoing.SnowGameStarted);
            Response.AppendInt32(Id);
            Response.AppendString("SnowStorm level " + Map.Id);
            Response.AppendInt32(0);
            Response.AppendInt32(Map.Id); // level
            Response.AppendInt32(4);
            Response.AppendInt32(8);
            Response.AppendString(GameHost);
            Response.AppendInt32(14);
            Response.AppendInt32(Players.Count);
            foreach (SnowPlayer Player in Players.Values)
            {
                Response.AppendInt32(Player.Id);
                Response.AppendString(Player.GetHabbo().Username);
                Response.AppendString(Player.GetHabbo().Look);
                Response.AppendString(Player.GetHabbo().Gender.ToLower());
                Response.AppendInt32(Player.Team);
                Response.AppendInt32(0); // stars
                Response.AppendInt32(0); // points
                Response.AppendInt32(10); // points for next level
            }
            SendToPlayers(Response);

            Response.Init(Outgoing.SnowInArenaQueue);
            Response.AppendInt32(1);
            SendToPlayers(Response);
            
            Response.Init(Outgoing.SnowEnterArena);
            Response.AppendInt32(0);
            Response.AppendInt32(Map.Id);
            Response.AppendInt32(2);
            Response.AppendInt32(Players.Count);
            foreach (SnowPlayer p in Players.Values)
            {
                Response.AppendInt32(p.Id);
                Response.AppendString(p.GetHabbo().Username);
                Response.AppendString(p.GetHabbo().Look);
                Response.AppendString(p.GetHabbo().Gender.ToLower());
                Response.AppendInt32(p.Team);
            }
            Response.AppendInt32(50);
            Response.AppendInt32(50);
            Response.AppendString(Map.Model);

            Response.AppendInt32(Map.Items.Count);
            foreach (SnowItem Item in Map.Items)
            {
                Item.Serialize(Response);
            }
            SendToPlayers(Response);

            foreach (SnowPlayer Player in Players.Values)
            {
                if (Player.GetHabbo().Username == GameHost)
                {
                    continue;
                }
                Response.Init(Outgoing.SnowEnteredArena);
                Response.AppendInt32(Player.Id);
                Response.AppendString(Player.GetHabbo().Username);
                Response.AppendString(Player.GetHabbo().Look);
                Response.AppendString(Player.GetHabbo().Gender.ToLower());
                Response.AppendInt32(Player.Team);
                SendToPlayers(Response);
            }

            Response.Init(Outgoing.SnowStageLoad);
            Response.AppendInt32(0);
            SendToPlayers(Response);
            
            for (int i = 0; i == 16; i++)
            {
                Response.Init(Outgoing.SnowStageStillLoad);
                Response.AppendInt32(0);
                Response.AppendInt32(0);
                SendToPlayers(Response);
            }
            Response.Init(Outgoing.SnowStageStillLoad);
            Response.AppendInt32(17);
            Response.AppendInt32(0);
            SendToPlayers(Response);
            Response.Init(Outgoing.SnowStageStillLoad);
            Response.AppendInt32(33);
            Response.AppendInt32(0);
            SendToPlayers(Response);
            Response.Init(Outgoing.SnowStageStillLoad);
            Response.AppendInt32(44);
            Response.AppendInt32(0);
            SendToPlayers(Response);
            Response.Init(Outgoing.SnowStageStillLoad);
            Response.AppendInt32(67);
            Response.AppendInt32(0);
            SendToPlayers(Response);
        }
开发者ID:BjkGkh,项目名称:07052014,代码行数:98,代码来源:SnowGame.cs

示例13: Parse


//.........这里部分代码省略.........
                                else
                                    Room.MutedBots = true;

                                SendChatMessage(Session, "Los BOT de tu sala han sido silenciados.");
                            }
                            return true;
                        }
                        else
                        {
                            return false;
                        }
                    }
                #endregion

                #region Dance (:dance)
                case "dance":
                    {
                        int DanceId = 1;
                        if (Params.Length > 1)
                        {
                            if (int.TryParse(Params[1], out DanceId))
                            {
                                DanceId = 1;
                            }
                        }

                        if (DanceId > 4 || DanceId < 0)
                        {
                            Session.SendWhisper("El ID del baile debe de estar comprimido entre 0 y 4.");
                            DanceId = 0;
                        }

                        ServerMessage Response = new ServerMessage();
                        Response.Init(Outgoing.Dance);
                        Response.AppendInt32(Session.CurrentRoomUserID);
                        Response.AppendInt32(DanceId);
                        Session.GetHabbo().CurrentRoom.SendMessage(Response);
                        return true;
                    }
                #endregion

                #region DeleteGroup (:deletegroup)
                case "deletegroup":
                    {
                        if (Session.GetHabbo().HasCmd("deletegroup"))
                        {
                            Room Room = Session.GetHabbo().CurrentRoom;

                            if (!Room.CheckRights(Session, true, false))
                            {
                                Session.SendNotif("¡Esta sala no es tuya!");
                                return true;
                            }

                            if (Params.Length == 1 || Params[1].ToLower() != "yes")
                            {
                                Session.SendNotif("¿Estás seguro de que quieres borrar este grupo?\n" +
                                    "Una vez lo hayas borrado no podrás recuperarlo más.\n\n" +
                                    "Si estás seguro, escribe ':deletegroup yes' (sin los '')");

                                return true;
                            }

                            if (Room.Group == null)
                            {
                                Session.SendNotif("Esta sala no contiene ningún grupo.");
开发者ID:BjkGkh,项目名称:Custom-R2,代码行数:67,代码来源:ChatCommandHandler.cs

示例14: PickUpPowerUp

        private void PickUpPowerUp(RoomItem item, RoomUser user)
        {
            switch (item.freezePowerUp)
            {
                case FreezePowerUp.Heart:
                    {
                        if (user.FreezeLives < 5)
                        {
                            user.FreezeLives++;
                            room.GetGameManager().AddPointToTeam(user.team, 10, user);
                        }

                        ServerMessage message = new ServerMessage();
                        message.Init(Outgoing.UpdateFreezeLives);
                        message.AppendInt32(user.InternalRoomID);
                        message.AppendInt32(user.FreezeLives);

                        user.GetClient().SendMessage(message);
                        break;
                    }
                case FreezePowerUp.Shield:
                    {
                        ActivateShield(user);
                        break;
                    }
                case FreezePowerUp.BlueArrow:
                case FreezePowerUp.GreenArrow:
                case FreezePowerUp.OrangeSnowball:
                    {
                        user.banzaiPowerUp = item.freezePowerUp;
                        break;
                    }
            }

            item.freezePowerUp = FreezePowerUp.None;
            item.ExtraData = "1" + item.ExtraData;
            item.UpdateState(false, true);
        }
开发者ID:BjkGkh,项目名称:07052014,代码行数:38,代码来源:Freeze.cs

示例15: FreezeUser

        private void FreezeUser(RoomUser user)
        {
            if (user.IsBot || user.shieldActive || user.team == Team.none)
                return;

            if (user.Freezed)
            {
                //user.Freezed = false;
                //user.ApplyEffect((int)user.team + 39);
                return;
            }
            user.Freezed = true;
            user.FreezeCounter = 0;

            user.FreezeLives--;

            if (user.FreezeLives <= 0)
            {
                ServerMessage message2 = new ServerMessage();
                message2.Init(Outgoing.UpdateFreezeLives);
                message2.AppendInt32(user.InternalRoomID);
                message2.AppendInt32(user.FreezeLives);
                user.GetClient().SendMessage(message2);

                user.ApplyEffect(-1);
                room.GetGameManager().AddPointToTeam(user.team, -10, user);
                TeamManager t = room.GetTeamManagerForFreeze();
                t.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 (t.BlueTeam.Count <= 0 && t.RedTeam.Count <= 0 && t.GreenTeam.Count <= 0 && t.YellowTeam.Count > 0)
                    this.StopGame(); // yellow team win
                else if (t.BlueTeam.Count > 0 && t.RedTeam.Count <= 0 && t.GreenTeam.Count <= 0 && t.YellowTeam.Count <= 0)
                    this.StopGame(); // blue team win
                else if (t.BlueTeam.Count <= 0 && t.RedTeam.Count > 0 && t.GreenTeam.Count <= 0 && t.YellowTeam.Count <= 0)
                    this.StopGame(); // red team win
                else if (t.BlueTeam.Count <= 0 && t.RedTeam.Count <= 0 && t.GreenTeam.Count > 0 && t.YellowTeam.Count <= 0)
                    this.StopGame(); // green team win
                return;
            }

            room.GetGameManager().AddPointToTeam(user.team, -10, user);
            user.ApplyEffect(12);

            ServerMessage message = new ServerMessage();
            message.Init(Outgoing.UpdateFreezeLives);
            message.AppendInt32(user.InternalRoomID);
            message.AppendInt32(user.FreezeLives);

            user.GetClient().SendMessage(message);
        }
开发者ID:BjkGkh,项目名称:07052014,代码行数:58,代码来源:Freeze.cs


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