示例#1
0
        /// <summary>
        /// Handles incoming avatar statistics, such as ratings
        /// </summary>
        /// <param name="packet"></param>
        /// <param name="simulator"></param>
        private void AvatarStatisticsHandler(Packet packet, Simulator simulator)
        {
            if (OnAvatarStatistics != null)
            {
                AvatarStatisticsReplyPacket asr   = (AvatarStatisticsReplyPacket)packet;
                Avatar.Statistics           stats = new Avatar.Statistics();

                foreach (AvatarStatisticsReplyPacket.StatisticsDataBlock b in asr.StatisticsData)
                {
                    string n = Helpers.FieldToString(b.Name);

                    switch (n)
                    {
                    case "Behavior":
                        stats.BehaviorPositive = b.Positive;
                        stats.BehaviorNegative = b.Negative;
                        break;

                    case "Appearance":
                        stats.AppearancePositive = b.Positive;
                        stats.AppearanceNegative = b.Negative;
                        break;

                    case "Building":
                        stats.AppearancePositive = b.Positive;
                        stats.AppearanceNegative = b.Negative;
                        break;

                    default:
                        Client.Log("Got an AvatarStatistics block with the name " + n, Helpers.LogLevel.Warning);
                        break;
                    }
                }

                OnAvatarStatistics(asr.AvatarData.AvatarID, stats);
            }
        }
        /// <summary>
        /// Handles incoming avatar statistics, such as ratings
        /// </summary>
        /// <param name="packet"></param>
        /// <param name="simulator"></param>
        private void AvatarStatisticsHandler(Packet packet, Simulator simulator)
        {
            if (OnAvatarStatistics != null)
            {
                AvatarStatisticsReplyPacket asr = (AvatarStatisticsReplyPacket)packet;
                Avatar.Statistics stats = new Avatar.Statistics();

                foreach (AvatarStatisticsReplyPacket.StatisticsDataBlock b in asr.StatisticsData)
                {
                    string n = Helpers.FieldToString(b.Name);

                    switch (n)
                    {
                        case "Behavior":
                            stats.BehaviorPositive = b.Positive;
                            stats.BehaviorNegative = b.Negative;
                            break;
                        case "Appearance":
                            stats.AppearancePositive = b.Positive;
                            stats.AppearanceNegative = b.Negative;
                            break;
                        case "Building":
                            stats.AppearancePositive = b.Positive;
                            stats.AppearanceNegative = b.Negative;
                            break;
                        default:
                            Client.Log("Got an AvatarStatistics block with the name " + n, Helpers.LogLevel.Warning);
                            break;
                    }
                }

                OnAvatarStatistics(asr.AvatarData.AvatarID, stats);
            }
        }