Пример #1
0
 public void BeginSequence()
 {
     if (!PlayerFlags.HasFlag(hasFlag) || PlayerFlags.HasAnyFlag(doesntHaveFlag))
     {
         ended = true;
         return;
     }
     ended = false;
     functionOnStart.Invoke();
     if (sequence != null)
     {
         (sequence as ISequence).BeginSequence();
         StartCoroutine(WaitUntilSeqEndCoroutine());
     }
     else
     {
         StartCoroutine(WaitUntilTimeCoroutine());
     }
 }
Пример #2
0
            public CharacterInfo(SQLFields fields)
            {
                //         0                1                2                3                 4                  5                6                7
                // "SELECT characters.guid, characters.name, characters.race, characters.class, characters.gender, characters.skin, characters.face, characters.hairStyle, "
                //  8                     9                       10                         11                         12                         13
                // "characters.hairColor, characters.facialStyle, characters.customDisplay1, characters.customDisplay2, characters.customDisplay3, characters.level, "
                //  14               15              16                     17                     18
                // "characters.zone, characters.map, characters.position_x, characters.position_y, characters.position_z, "
                //  19                    20                      21                   22                   23                     24                   25
                // "guild_member.guildid, characters.playerFlags, characters.at_login, character_pet.entry, character_pet.modelid, character_pet.level, characters.equipmentCache, "
                //  26                     27               28                      29                            30                         31
                // "character_banned.guid, characters.slot, characters.logout_time, characters.activeTalentGroup, characters.lastLoginBuild, character_declinedname.genitive"

                Guid             = ObjectGuid.Create(HighGuid.Player, fields.Read <ulong>(0));
                Name             = fields.Read <string>(1);
                RaceId           = fields.Read <byte>(2);
                ClassId          = (Class)fields.Read <byte>(3);
                SexId            = fields.Read <byte>(4);
                SkinId           = fields.Read <byte>(5);
                FaceId           = fields.Read <byte>(6);
                HairStyle        = fields.Read <byte>(7);
                HairColor        = fields.Read <byte>(8);
                FacialHair       = fields.Read <byte>(9);
                CustomDisplay[0] = fields.Read <byte>(10);
                CustomDisplay[1] = fields.Read <byte>(11);
                CustomDisplay[2] = fields.Read <byte>(12);
                ExperienceLevel  = fields.Read <byte>(13);
                ZoneId           = fields.Read <uint>(14);
                MapId            = fields.Read <uint>(15);
                PreloadPos       = new Vector3(fields.Read <float>(16), fields.Read <float>(17), fields.Read <float>(18));

                ulong guildId = fields.Read <ulong>(19);

                if (guildId != 0)
                {
                    GuildGuid = ObjectGuid.Create(HighGuid.Guild, guildId);
                }

                PlayerFlags  playerFlags  = (PlayerFlags)fields.Read <uint>(20);
                AtLoginFlags atLoginFlags = (AtLoginFlags)fields.Read <ushort>(21);

                if (atLoginFlags.HasAnyFlag(AtLoginFlags.Resurrect))
                {
                    playerFlags &= ~PlayerFlags.Ghost;
                }

                if (playerFlags.HasAnyFlag(PlayerFlags.Ghost))
                {
                    Flags |= CharacterFlags.Ghost;
                }

                if (atLoginFlags.HasAnyFlag(AtLoginFlags.Rename))
                {
                    Flags |= CharacterFlags.Rename;
                }

                if (fields.Read <uint>(26) != 0)
                {
                    Flags |= CharacterFlags.LockedByBilling;
                }

                if (WorldConfig.GetBoolValue(WorldCfg.DeclinedNamesUsed) && !string.IsNullOrEmpty(fields.Read <string>(31)))
                {
                    Flags |= CharacterFlags.Declined;
                }

                if (atLoginFlags.HasAnyFlag(AtLoginFlags.Customize))
                {
                    Flags2 = CharacterCustomizeFlags.Customize;
                }
                else if (atLoginFlags.HasAnyFlag(AtLoginFlags.ChangeFaction))
                {
                    Flags2 = CharacterCustomizeFlags.Faction;
                }
                else if (atLoginFlags.HasAnyFlag(AtLoginFlags.ChangeRace))
                {
                    Flags2 = CharacterCustomizeFlags.Race;
                }

                Flags3     = 0;
                Flags4     = 0;
                FirstLogin = atLoginFlags.HasAnyFlag(AtLoginFlags.FirstLogin);

                // show pet at selection character in character list only for non-ghost character
                if (!playerFlags.HasAnyFlag(PlayerFlags.Ghost) && (ClassId == Class.Warlock || ClassId == Class.Hunter || ClassId == Class.Deathknight))
                {
                    CreatureTemplate creatureInfo = Global.ObjectMgr.GetCreatureTemplate(fields.Read <uint>(22));
                    if (creatureInfo != null)
                    {
                        PetCreatureDisplayId = fields.Read <uint>(23);
                        PetExperienceLevel   = fields.Read <ushort>(24);
                        PetCreatureFamilyId  = (uint)creatureInfo.Family;
                    }
                }

                BoostInProgress  = false;
                ProfessionIds[0] = 0;
                ProfessionIds[1] = 0;

                StringArguments equipment = new StringArguments(fields.Read <string>(25));

                ListPosition   = fields.Read <byte>(27);
                LastPlayedTime = fields.Read <uint>(28);

                var spec = Global.DB2Mgr.GetChrSpecializationByIndex(ClassId, fields.Read <byte>(29));

                if (spec != null)
                {
                    SpecID = (ushort)spec.Id;
                }

                LastLoginVersion = fields.Read <uint>(30);

                for (byte slot = 0; slot < InventorySlots.BagEnd; ++slot)
                {
                    VisualItems[slot].InvType          = (byte)equipment.NextUInt32();
                    VisualItems[slot].DisplayId        = equipment.NextUInt32();
                    VisualItems[slot].DisplayEnchantId = equipment.NextUInt32();
                    VisualItems[slot].Subclass         = (byte)equipment.NextUInt32();
                }
            }
Пример #3
0
            public CharacterInfo(SQLFields fields)
            {
                Guid            = ObjectGuid.Create(HighGuid.Player, fields.Read <ulong>(0));
                Name            = fields.Read <string>(1);
                RaceId          = fields.Read <byte>(2);
                ClassId         = (Class)fields.Read <byte>(3);
                SexId           = fields.Read <byte>(4);
                ExperienceLevel = fields.Read <byte>(5);
                ZoneId          = fields.Read <uint>(6);
                MapId           = fields.Read <uint>(7);
                PreloadPos      = new Vector3(fields.Read <float>(8), fields.Read <float>(9), fields.Read <float>(10));

                ulong guildId = fields.Read <ulong>(11);

                if (guildId != 0)
                {
                    GuildGuid = ObjectGuid.Create(HighGuid.Guild, guildId);
                }

                PlayerFlags  playerFlags  = (PlayerFlags)fields.Read <uint>(12);
                AtLoginFlags atLoginFlags = (AtLoginFlags)fields.Read <ushort>(13);

                if (atLoginFlags.HasAnyFlag(AtLoginFlags.Resurrect))
                {
                    playerFlags &= ~PlayerFlags.Ghost;
                }

                if (playerFlags.HasAnyFlag(PlayerFlags.Ghost))
                {
                    Flags |= CharacterFlags.Ghost;
                }

                if (atLoginFlags.HasAnyFlag(AtLoginFlags.Rename))
                {
                    Flags |= CharacterFlags.Rename;
                }

                if (fields.Read <uint>(18) != 0)
                {
                    Flags |= CharacterFlags.LockedByBilling;
                }

                if (WorldConfig.GetBoolValue(WorldCfg.DeclinedNamesUsed) && !string.IsNullOrEmpty(fields.Read <string>(23)))
                {
                    Flags |= CharacterFlags.Declined;
                }

                if (atLoginFlags.HasAnyFlag(AtLoginFlags.Customize))
                {
                    Flags2 = CharacterCustomizeFlags.Customize;
                }
                else if (atLoginFlags.HasAnyFlag(AtLoginFlags.ChangeFaction))
                {
                    Flags2 = CharacterCustomizeFlags.Faction;
                }
                else if (atLoginFlags.HasAnyFlag(AtLoginFlags.ChangeRace))
                {
                    Flags2 = CharacterCustomizeFlags.Race;
                }

                Flags3     = 0;
                Flags4     = 0;
                FirstLogin = atLoginFlags.HasAnyFlag(AtLoginFlags.FirstLogin);

                // show pet at selection character in character list only for non-ghost character
                if (!playerFlags.HasAnyFlag(PlayerFlags.Ghost) && (ClassId == Class.Warlock || ClassId == Class.Hunter || ClassId == Class.Deathknight))
                {
                    CreatureTemplate creatureInfo = Global.ObjectMgr.GetCreatureTemplate(fields.Read <uint>(14));
                    if (creatureInfo != null)
                    {
                        PetCreatureDisplayId = fields.Read <uint>(15);
                        PetExperienceLevel   = fields.Read <ushort>(16);
                        PetCreatureFamilyId  = (uint)creatureInfo.Family;
                    }
                }

                BoostInProgress  = false;
                ProfessionIds[0] = 0;
                ProfessionIds[1] = 0;

                StringArguments equipment = new(fields.Read <string>(17));

                ListPosition   = fields.Read <byte>(19);
                LastPlayedTime = fields.Read <long>(20);

                var spec = Global.DB2Mgr.GetChrSpecializationByIndex(ClassId, fields.Read <byte>(21));

                if (spec != null)
                {
                    SpecID = (ushort)spec.Id;
                }

                LastLoginVersion = fields.Read <uint>(22);

                for (byte slot = 0; slot < InventorySlots.BagEnd; ++slot)
                {
                    VisualItems[slot].InvType          = (byte)equipment.NextUInt32();
                    VisualItems[slot].DisplayId        = equipment.NextUInt32();
                    VisualItems[slot].DisplayEnchantId = equipment.NextUInt32();
                    VisualItems[slot].Subclass         = (byte)equipment.NextUInt32();
                }
            }