Beispiel #1
0
        public override void Update(Google.ProtocolBuffers.IRpcController controller, bnet.protocol.presence.UpdateRequest request, System.Action <bnet.protocol.NoData> done)
        {
            //Logger.Warn("request:\n{0}", request.ToString());
            // This "UpdateRequest" is not, as it may seem, a request to update the client on the state of an object,
            // but instead the *client* requesting to change fields on an object that it has subscribed to.
            // Check docs/rpc/presence.txt in branch wip-docs (or master)

            switch (request.EntityId.GetHighIdType())
            {
            case EntityIdHelper.HighIdType.AccountId:
                var account = AccountManager.GetAccountByPersistentID(request.EntityId.Low);
                Logger.Trace("Update() {0} {1} - {2} Operations", this.Client, account, request.FieldOperationCount);
                Logger.Warn("No AccountManager updater.");
                break;

            case EntityIdHelper.HighIdType.GameAccountId:
                var gameaccount = GameAccountManager.GetAccountByPersistentID(request.EntityId.Low);
                var trace       = string.Format("Update() {0} {1} - {2} Operations", this.Client, gameaccount, request.FieldOperationCount);
                foreach (var fieldOp in request.FieldOperationList)
                {
                    trace += string.Format("\t{0}, {1}, {2}", (FieldKeyHelper.Program)fieldOp.Field.Key.Program, (FieldKeyHelper.OriginatingClass)fieldOp.Field.Key.Group, fieldOp.Field.Key.Field);
                    gameaccount.Update(fieldOp);
                }
                Logger.Trace(trace);
                break;

            default:
                Logger.Warn("Recieved an unhandled Presence.Update request with type {0} (0x{1})", request.EntityId.GetHighIdType(), request.EntityId.High.ToString("X16"));
                break;
            }

            var builder = bnet.protocol.NoData.CreateBuilder();

            done(builder.Build());
        }
Beispiel #2
0
 public override void Heal(Google.ProtocolBuffers.IRpcController controller, bnet.protocol.presence.UpdateRequest request, Action <bnet.protocol.NoData> done)
 {
     throw new NotImplementedException();
 }
Beispiel #3
0
        public override void Update(Google.ProtocolBuffers.IRpcController controller, bnet.protocol.presence.UpdateRequest request, System.Action <bnet.protocol.NoData> done)
        {
            Logger.Trace("Update() {0}: {1}", request.EntityId.GetHighIdType(), request.EntityId.Low);
            //Logger.Warn("request:\n{0}", request.ToString());
            // This "UpdateRequest" is not, as it may seem, a request to update the client on the state of an object,
            // but instead the *client* requesting to change fields on an object that it has subscribed to.
            // Check docs/rpc/presence.txt in branch wip-docs (or master)

            switch (request.EntityId.GetHighIdType())
            {
            case EntityIdHelper.HighIdType.AccountId:
                var account = AccountManager.GetAccountByEntityID(request.EntityId);
                break;

            case EntityIdHelper.HighIdType.ToonId:
                var toon = ToonManager.GetToonByLowID(request.EntityId.Low);
                break;

            default:
                Logger.Warn("Recieved an unhandled Presence.Update request with type {0}", request.EntityId.GetHighIdType());
                break;
            }

            var builder = NoData.CreateBuilder();

            done(builder.Build());
        }