Exemple #1
0
        public SetPrizeWheelRaffleDefinition(WheelRaffle raffle, bool delete)
        {
            m_id             = 18246;
            m_strMessageName = "Set Prize Wheel Raffle Definition";

            m_raffle = raffle;
            m_delete = delete;
        }
Exemple #2
0
        /// <summary>
        /// Parses the response received from the server.
        /// </summary>
        protected override void UnpackResponse()
        {
            base.UnpackResponse();

            // Create the streams we will be reading from.
            using (var responseStream = new MemoryStream(m_responsePayload))
                using (var reader = new BinaryReader(responseStream, Encoding.Unicode))
                {
                    // Try to unpack the data.
                    try
                    {
                        // Seek past return code.
                        reader.BaseStream.Seek(sizeof(int), SeekOrigin.Begin);

                        Raffles = new List <WheelRaffle>();

                        // Raffle Count
                        ushort raffleCount = reader.ReadUInt16();

                        // Get all the menus.
                        for (ushort x = 0; x < raffleCount; x++)
                        {
                            WheelRaffle raffle = new WheelRaffle();

                            raffle.ID             = reader.ReadInt32();
                            raffle.Name           = ReadString(reader);
                            raffle.Description    = ReadString(reader);
                            raffle.WheelPhotoId   = reader.ReadInt32();
                            raffle.OverlayPhotoId = reader.ReadInt32();

                            ushort optionCount = reader.ReadUInt16();

                            for (ushort y = 0; y < optionCount; y++)
                            {
                                WheelRafflePrizes option = new WheelRafflePrizes();

                                option.Prize  = ReadString(reader);
                                option.Weight = reader.ReadInt32();

                                raffle.Options.Add(option);
                            }

                            Raffles.Add(raffle);
                        }
                    }
                    catch (EndOfStreamException e)
                    {
                        throw new MessageWrongSizeException(m_strMessageName, e);
                    }
                    catch (Exception e)
                    {
                        throw new ServerException(m_strMessageName, e);
                    }
                }
        }
Exemple #3
0
        /// <summary>
        /// Updates the sent in prize wheel raffle. Returns the ID of the prize wheel raffle that was edited, the wheel image ID, and the overlay ID
        /// </summary>
        /// <param name="raffle"></param>
        /// <param name="delete"></param>
        /// <returns></returns>
        public static Tuple <int, int, int> SetPrizeWheelRaffle(WheelRaffle raffle, bool delete = false)
        {
            var msg = new SetPrizeWheelRaffleDefinition(raffle, delete);

            try
            {
                msg.Send();
            }
            catch (ServerCommException ex)
            {
                throw new Exception(msg.MessageName + " Message: " + ex.Message);
            }

            return(new Tuple <int, int, int>(msg.Raffle.ID.Value, msg.m_raffle.WheelPhotoId.Value, msg.m_raffle.OverlayPhotoId.Value));
        }