Пример #1
0
        Character CharacterByName(string name)
        {
            if (!characters.ContainsKey(name))
            {
                characters[name] = new Character {
                    Name = name, Created = DateTime.Now
                }
            }
            ;
            return(characters[name]);
        }

        Character ReadCharacterData(GameInfo gameInfo)
        {
            Character character = CharacterByName(gameInfo.PlayerData.PlayerName);

            character.UpdateMode((D2Data.Mode)gameInfo.Player.eMode);
            character.IsHardcore  = gameInfo.Client.IsHardcore();
            character.IsExpansion = gameInfo.Client.IsExpansion();

            // Don't update stats and items while dead.
            if (!character.IsDead)
            {
                character.ParseStats(unitReader, gameInfo);
                character.InventoryItemIds = ReadInventoryItemIds(gameInfo.Player);
                character.Items            = ItemInfo.GetItemsByItems(this, GetEquippedItems(gameInfo.Player));
            }

            return(character);
        }
Пример #2
0
        Character ProcessCharacterData(D2GameInfo gameInfo)
        {
            string    playerName = gameInfo.PlayerData.PlayerName;
            Character character  = CharacterByNameCached(playerName);

            if (wasInTitleScreen)
            {
                // A brand new character has been started.
                // The extra wasInTitleScreen check prevents DI from splitting
                // when it was started AFTER Diablo 2, but the char is still a new char
                if (IsNewChar())
                {
                    ActiveCharacterTimestamp = DateTime.Now;
                    ActiveCharacter          = character;
                    OnCharacterCreated(new CharacterCreatedEventArgs(character));
                }

                // Not in title screen anymore.
                wasInTitleScreen = false;
            }

            character.UpdateMode((D2Data.Mode)gameInfo.Player.eMode);

            // Don't update stats while dead.
            if (!character.IsDead)
            {
                character.ParseStats(unitReader, gameInfo);
            }
            return(character);
        }
Пример #3
0
        void ProcessCharacterData(D2GameInfo gameInfo)
        {
            character = GetCurrentCharacter(gameInfo);
            character.UpdateMode((D2Data.Mode)gameInfo.Player.eMode);

            Dictionary <StatIdentifier, D2Stat> playerStats = unitReader.GetStatsMap(gameInfo.Player);
            Dictionary <StatIdentifier, D2Stat> itemStats   = unitReader.GetItemStatsMap(gameInfo.Player);

            character.ParseStats(playerStats, itemStats, gameInfo);
        }
Пример #4
0
        Character CharacterByName(string name)
        {
            if (!characters.ContainsKey(name))
            {
                characters[name] = new Character {
                    Name = name, Created = DateTime.Now
                }
            }
            ;
            return(characters[name]);
        }

        Character ReadCharacterData(D2GameInfo gameInfo)
        {
            Character character = CharacterByName(gameInfo.PlayerData.PlayerName);

            if (wasInTitleScreen)
            {
                // A brand new character has been started.
                // The extra wasInTitleScreen check prevents DI from splitting
                // when it was started AFTER Diablo 2, but the char is still a new char
                if (Character.IsNewChar(gameInfo.Player, unitReader, inventoryReader, skillReader))
                {
                    // disable IsAutosplitChar from the other chars created so far
                    foreach (var pair in characters)
                    {
                        pair.Value.IsAutosplitChar = false;
                    }

                    Logger.Info($"A new chararacter was created: {character.Name}");
                    charCount++;
                    character.Deaths          = 0;
                    character.IsAutosplitChar = true;
                    ActiveCharacter           = character;
                    OnCharacterCreated(new CharacterCreatedEventArgs(character));
                }

                // Not in title screen anymore.
                wasInTitleScreen = false;
            }

            character.UpdateMode((D2Data.Mode)gameInfo.Player.eMode);
            character.IsHardcore  = gameInfo.Client.IsHardcore();
            character.IsExpansion = gameInfo.Client.IsExpansion();

            // Don't update stats and items while dead.
            if (!character.IsDead)
            {
                character.ParseStats(unitReader, gameInfo);
                character.EquippedItemStrings = ReadEquippedItemStrings(gameInfo.Player);
                character.InventoryItemIds    = ReadInventoryItemIds(gameInfo.Player);
            }

            return(character);
        }