private ByteString CreateHero(D3.OnlineService.HeroCreateParams createPrams)
        {
            int hashCode = ToonManager.GetUnusedHashCodeForToonName(createPrams.Name);
            var newToon  = new Toon(createPrams.Name, hashCode, createPrams.GbidClass, createPrams.IsFemale ? ToonFlags.Female : ToonFlags.Male, 1, Client.Account.CurrentGameAccount);

            if (ToonManager.SaveToon(newToon))
            {
                Logger.Trace("CreateHero() {0}", newToon);
                return(newToon.D3EntityID.ToByteString());
            }
            return(ByteString.Empty);
        }
Exemple #2
0
        public override void CreateToon(Google.ProtocolBuffers.IRpcController controller, CreateToonRequest request, Action <CreateToonResponse> done)
        {
            Logger.Trace("CreateToon()");
            var heroCreateParams = D3.OnlineService.HeroCreateParams.ParseFrom(request.AttributeList[0].Value.MessageValue);
            var builder          = CreateToonResponse.CreateBuilder();

            var toon = new Toon(request.Name, heroCreateParams.GbidClass, heroCreateParams.IsFemale ? ToonFlags.Female : ToonFlags.Male, 1, Client.Account);

            if (ToonManager.SaveToon(toon))
            {
                builder.SetToon(toon.BnetEntityID);
            }
            done(builder.Build());
        }
Exemple #3
0
        public override void CreateToon(Google.ProtocolBuffers.IRpcController controller, bnet.protocol.toon.external.CreateToonRequest request, Action <bnet.protocol.toon.external.CreateToonResponse> done)
        {
            var heroCreateParams = D3.OnlineService.HeroCreateParams.ParseFrom(request.AttributeList[0].Value.MessageValue);
            var builder          = bnet.protocol.toon.external.CreateToonResponse.CreateBuilder();

            int hashCode = ToonManager.GetUnusedHashCodeForToonName(request.Name);
            var toon     = new Toon(request.Name, hashCode, heroCreateParams.GbidClass, heroCreateParams.IsFemale ? ToonFlags.Female : ToonFlags.Male, 30, Client.Account);

            if (ToonManager.SaveToon(toon))
            {
                builder.SetToken((uint)toon.BnetEntityID.Low);
            }
            done(builder.Build());

            var notification = bnet.protocol.toon.external.ToonCreatedNotification.CreateBuilder()
                               .SetToon(toon.BnetEntityID)
                               .SetToken((uint)toon.BnetEntityID.Low)
                               .SetErrorCode(0).Build();

            this.Client.MakeRPC(() => bnet.protocol.toon.external.ToonNotifyExternal.CreateStub(this.Client).NotifyToonCreated(null, notification, callback => { }));

            Logger.Trace("CreateToon() {0}", toon);
        }