Example #1
0
        public void UpdateCachedCharacters(IEnumerable <CachedCharacter> characters)
        {
            AccountCharacters.Clear();
            byte slot = 0;

            foreach (var character in characters)
            {
                if (character.DeleteTime > 0)
                {
                    if (Time.GetUnixTime() > character.DeleteTime)
                    {
                        character.Deleted = true;
                        DatabaseManager.Shard.DeleteCharacter(character.Guid.Full, deleteSuccess =>
                        {
                            if (deleteSuccess)
                            {
                                log.Info($"Character {character.Guid.Full:X} successfully marked as deleted");
                            }
                            else
                            {
                                log.Error($"Unable to mark character {character.Guid.Full:X} as deleted");
                            }
                        });
                        continue;
                    }
                }
                character.SlotId = slot;
                AccountCharacters.Add(character);
                slot++;
            }
        }
Example #2
0
 public void UpdateCachedCharacters(IEnumerable <Character> characters)
 {
     AccountCharacters.Clear();
     foreach (var character in characters)
     {
         if (character.DeleteTime > 0)
         {
             if (Time.GetUnixTime() > character.DeleteTime)
             {
                 character.IsDeleted = true;
                 DatabaseManager.Shard.MarkCharacterDeleted(character.BiotaId, deleteSuccess =>
                 {
                     if (deleteSuccess)
                     {
                         log.Info($"Character {character.BiotaId:X} successfully marked as deleted");
                     }
                     else
                     {
                         log.Error($"Unable to mark character {character.BiotaId:X} as deleted");
                     }
                 });
                 continue;
             }
         }
         AccountCharacters.Add(character);
     }
 }
Example #3
0
 public void UpdateCachedCharacters(IEnumerable <CachedCharacter> characters)
 {
     AccountCharacters.Clear();
     foreach (var character in characters)
     {
         AccountCharacters.Add(character);
     }
 }
Example #4
0
        /// <summary>
        /// Parses server messages.
        /// Protocols known at time of creation:
        /// http://skunkworks.sourceforge.net/protocol/Protocol.php
        /// https://acemulator.github.io/protocol/
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void FilterCore_ServerDispatch(object sender, NetworkMessageEventArgs e)
        {
            // End 3D Mode and return to character screen
            if (e.Message.Type.Equals(0xF653))
            {
                Machine.LoggedIn  = false;
                CommandLineText  -= Machine.Interpreter.Command;
                Core.RenderFrame -= Machine.Clock;
                Core.WorldFilter.ChangeObject -= Machine.WorldFilter_ChangeObject;
                Machine.BotManagerView?.Dispose();
            }

            // Received the character list from the server
            if (e.Message.Type.Equals(0xF658))
            {
                AccountCharacters.Clear();
                TotalSlots = Convert.ToInt32(e.Message["slotCount"]);
                int charCount = Convert.ToInt32(e.Message["characterCount"]);

                MessageStruct characterStruct = e.Message.Struct("characters");
                for (int i = 0; i < charCount; i++)
                {
                    AccountCharacters.Add(characterStruct.Struct(i)["name"].ToString());
                }

                // Must sort the characters ordinally to be in the same order as displayed
                AccountCharacters.Sort((a, b) => String.Compare(a, b, StringComparison.Ordinal));
            }

            // Login Character
            if (e.Message.Type.Equals(0xF746))
            {
                LogonTimer.Stop();
            }

            // Game events
            if (e.Message.Type.Equals(0xF7B0))
            {
                // Action complete
                if (Convert.ToInt32(e.Message["event"]).Equals(0x01C7))
                {
                    Machine.CastCompleted = true;
                }

                // Status messages
                if (Convert.ToInt32(e.Message["event"]).Equals(0x028A))
                {
                    // Your spell fizzled.
                    if (Convert.ToInt32(e.Message[3]).Equals(0x0402))
                    {
                        Machine.Fizzled = true;
                    }
                }
            }

            // Server Name (last server message sent when logging out)
            if (e.Message.Type.Equals(0xF7E1) && Machine.CurrentState == SwitchingCharacters.GetInstance)
            {
                LogonTimer.Start();
            }
        }