Exemple #1
0
        public static void DeleteToon(Toon toon)
        {
            if (!Toons.ContainsKey(toon.ID))
            {
                Logger.Error("Attempting to delete toon that does not exist: " + toon.ID);
                return;
            }

            toon.Delete();
        }
Exemple #2
0
        public static void DeleteToon(Toon toon)
        {
            if (!Toons.ContainsKey(toon.PersistentID))
            {
                Logger.Error("Attempting to delete toon that does not exist: {0}", toon.PersistentID);
                return;
            }

            if (toon.DeleteFromDB()) Toons.Remove(toon.PersistentID);
        }
Exemple #3
0
        public static bool SaveToon(Toon toon)
        {
            if(Toons.ContainsKey(toon.PersistentID))
            {
                Logger.Error("Duplicate persistent toon id: {0}", toon.PersistentID);
                return false;
            }

            Toons.Add(toon.PersistentID, toon);
            toon.SaveToDB();
            return true;
        }
Exemple #4
0
        public static bool SaveToon(Toon toon)
        {
            if(Toons.ContainsKey(toon.ID))
            {
                Logger.Error("Duplicate toon id: " + toon.ID);
                return false;
            }

            Toons.Add(toon.ID, toon);
            toon.SaveToDB();
            return true;
        }
Exemple #5
0
        private static void LoadToons()
        {
            var query = "SELECT * from toons";
            var cmd = new SQLiteCommand(query, DBManager.Connection);
            var reader = cmd.ExecuteReader();

            if (!reader.HasRows) return;

            while(reader.Read())
            {
                var databaseId = (ulong) reader.GetInt64(0);
                var toon = new Toon(databaseId, reader.GetString(1), reader.GetByte(2), reader.GetByte(3), reader.GetByte(4), reader.GetInt64(5));
                Toons.Add(databaseId, toon);
            }
        }
        public void CreateToon(IClient client, Packet packetIn)
        {
            Logger.Trace("RPC:ToonExternal:CreateToon()");
            
            var request = bnet.protocol.toon.external.CreateToonRequest.ParseFrom(packetIn.Payload.ToArray());
            var heroCreateParams = D3.OnlineService.HeroCreateParams.ParseFrom(request.AttributeList[0].Value.MessageValue);
            var builder = bnet.protocol.toon.external.CreateToonResponse.CreateBuilder();

            var toon = new Toons.Toon(request.Name, (uint)heroCreateParams.GbidClass, heroCreateParams.IsFemale ? Toons.ToonGender.Female : Toons.ToonGender.Male, 1);
            if (Toons.ToonManager.SaveToon(toon)) builder.SetToon(toon.BnetEntityID);

            var response = builder.Build();

            var packet = new Packet(
                new Header(0xfe, 0x0, packetIn.Header.RequestID, (uint)response.SerializedSize),
                response.ToByteArray());

            client.Send(packet);
        }
Exemple #7
0
 public void Reveal(Toon t)
 {
     if (RevealMessage != null) t.Owner.LoggedInBNetClient.InGameClient.SendMessage(RevealMessage);
     t.Owner.LoggedInBNetClient.InGameClient.FlushOutgoingBuffer();
 }
Exemple #8
0
 public void Reveal(Toon t)
 {
     if (SceneData != null) t.Owner.LoggedInBNetClient.InGameClient.SendMessage(SceneData);
     if (Map != null) t.Owner.LoggedInBNetClient.InGameClient.SendMessage(Map);
     t.Owner.LoggedInBNetClient.InGameClient.FlushOutgoingBuffer();
 }
Exemple #9
0
        public void RevealWorld(Toon t)
        {
            //reveal world to player
            t.Owner.LoggedInBNetClient.InGameClient.SendMessage(new RevealWorldMessage()
            {
                Id = 0x0037,
                Field0 = WorldID,
                Field1 = WorldSNO,
            });

            //player enters world
            t.Owner.LoggedInBNetClient.InGameClient.SendMessage(new EnterWorldMessage()
            {
                Id = 0x0033,
                Field0 = new Vector3D()
                {
                    Field0 = t.PosX,
                    Field1 = t.PosY,
                    Field2 = t.PosZ
                },
                Field1 = WorldID,
                Field2 = WorldSNO,
            });

            //just reveal the whole thing to the player for now
            foreach (Scene s in Scenes)
                s.Reveal(t);

            //reveal actors
            foreach (Actor a in Actors)
            {
                if (ActorDB.isBlackListed(a.snoID)) continue;
                if (ActorDB.isNPC(a.snoID)) continue;
                a.Reveal(t);
            }
        }