Exemple #1
0
        private void DoClear(bnet.protocol.presence.Field field)
        {
            switch ((FieldKeyHelper.Program)field.Key.Program)
            {
            case FieldKeyHelper.Program.D3:
                Logger.Warn("Unknown clear-field: {0}, {1}, {2}", field.Key.Program, field.Key.Group, field.Key.Field);
                break;

            case FieldKeyHelper.Program.BNet:
                Logger.Warn("Unknown clear-field: {0}, {1}, {2}", field.Key.Program, field.Key.Group, field.Key.Field);
                break;
            }
        }
Exemple #2
0
        private void DoSet(bnet.protocol.presence.Field field)
        {
            switch ((FieldKeyHelper.Program)field.Key.Program)
            {
            case FieldKeyHelper.Program.D3:
                if (field.Key.Group == 4 && field.Key.Field == 1)
                {
                    if (field.Value.HasMessageValue)     //7727 Sends empty SET instead of a CLEAR -Egris
                    {
                        var entityId = D3.OnlineService.EntityId.ParseFrom(field.Value.MessageValue);
                        var channel  = ChannelManager.GetChannelByEntityId(entityId);
                        this.Owner.LoggedInClient.CurrentChannel = channel;
                    }
                    else
                    {
                        Logger.Warn("Emtpy-field: {0}, {1}, {2}", field.Key.Program, field.Key.Group, field.Key.Field);
                    }
                }
                else if (field.Key.Group == 4 && field.Key.Field == 2)
                {
                    //catch to stop Logger.Warn spam on client start and exit
                    // should D3.4.2 int64 Current screen (0=in-menus, 1=in-menus, 3=in-menus); see ScreenStatus sent to ChannelService.UpdateChannelState call /raist
                }
                else if (field.Key.Group == 4 && field.Key.Field == 3)
                {
                    //Looks to be the ToonFlags of the party leader/inviter when it is an int, OR the message set in an open to friends game when it is a string /dustinconrad
                }
                else
                {
                    Logger.Warn("Unknown set-field: {0}, {1}, {2} := {3}", field.Key.Program, field.Key.Group, field.Key.Field, field.Value);
                }
                break;

            case FieldKeyHelper.Program.BNet:
                if (field.Key.Group == 3 && field.Key.Field == 5)     // Away status
                {
                    AwayStatus = (AwayStatus)field.Value.IntValue;
                }
                else
                {
                    Logger.Warn("Unknown set-field: {0}, {1}, {2} := {3}", field.Key.Program, field.Key.Group, field.Key.Field, field.Value);
                }
                break;
            }
        }
Exemple #3
0
 public void AddField(bnet.protocol.presence.Field val)
 {
     this._Field.Add(val);
 }
Exemple #4
0
 public void SetField(bnet.protocol.presence.Field val)
 {
     this.Field = val;
 }
Exemple #5
0
        private void DoSet(bnet.protocol.presence.Field field)
        {
            var operation = bnet.protocol.presence.FieldOperation.CreateBuilder();

            var returnField = bnet.protocol.presence.Field.CreateBuilder().SetKey(field.Key);

            switch ((FieldKeyHelper.Program)field.Key.Program)
            {
            case FieldKeyHelper.Program.D3:
                if (field.Key.Group == 4 && field.Key.Field == 1)
                {
                    if (field.Value.HasMessageValue)     //7727 Sends empty SET instead of a CLEAR -Egris
                    {
                        var entityId = D3.OnlineService.EntityId.ParseFrom(field.Value.MessageValue);
                        var channel  = ChannelManager.GetChannelByEntityId(entityId);
                        if (this.LoggedInClient.CurrentChannel != channel)
                        {
                            this.LoggedInClient.CurrentChannel = channel;
                            returnField.SetValue(bnet.protocol.attribute.Variant.CreateBuilder().SetMessageValue(channel.BnetEntityId.ToByteString()).Build());
                            Logger.Trace("{0} set channel to {1}", this, channel);
                        }
                    }
                    else
                    {
                        if (this.LoggedInClient.CurrentChannel != null)
                        {
                            returnField.SetValue(bnet.protocol.attribute.Variant.CreateBuilder().SetMessageValue(Google.ProtocolBuffers.ByteString.Empty).Build());
                            Logger.Warn("Emtpy-field: {0}, {1}, {2}", field.Key.Program, field.Key.Group, field.Key.Field);
                        }
                    }
                }
                else if (field.Key.Group == 4 && field.Key.Field == 2)
                {
                    //catch to stop Logger.Warn spam on client start and exit
                    // should D3.4.2 int64 Current screen (0=in-menus, 1=in-menus, 3=in-menus); see ScreenStatus sent to ChannelService.UpdateChannelState call /raist
                    if (this.ScreenStatus.Screen != field.Value.IntValue)
                    {
                        this.ScreenStatus = D3.PartyMessage.ScreenStatus.CreateBuilder().SetScreen((int)field.Value.IntValue).SetStatus(0).Build();
                        returnField.SetValue(bnet.protocol.attribute.Variant.CreateBuilder().SetIntValue(field.Value.IntValue).Build());
                        Logger.Trace("{0} set current screen to {1}.", this, field.Value.IntValue);
                    }
                }
                else if (field.Key.Group == 4 && field.Key.Field == 3)
                {
                    returnField.SetValue(field.Value);
                    //Looks to be the ToonFlags of the party leader/inviter when it is an int, OR the message set in an open to friends game when it is a string /dustinconrad
                }
                else if (field.Key.Group == 4 && field.Key.Field == 4)
                {
                    returnField.SetValue(field.Value);
                    //this is some unknown bool
                }
                else
                {
                    Logger.Warn("Unknown set-field: {0}, {1}, {2} := {3}", field.Key.Program, field.Key.Group, field.Key.Field, field.Value);
                }
                break;

            case FieldKeyHelper.Program.BNet:
                if (field.Key.Group == 2 && field.Key.Field == 3)     // Away status
                {
                    this.AwayStatus = (AwayStatusFlag)field.Value.IntValue;
                    returnField.SetValue(bnet.protocol.attribute.Variant.CreateBuilder().SetIntValue((long)this.AwayStatus).Build());
                    Logger.Trace("{0} set AwayStatus to {1}.", this, this.AwayStatus);
                }
                else
                {
                    Logger.Warn("Unknown set-field: {0}, {1}, {2} := {3}", field.Key.Program, field.Key.Group, field.Key.Field, field.Value);
                }
                break;
            }

            //We only update subscribers on fields that actually change values.
            if (returnField.HasValue)
            {
                operation.SetField(returnField);
                this.UpdateSubscribers(this.Subscribers, new List <bnet.protocol.presence.FieldOperation>()
                {
                    operation.Build()
                });
            }
        }