Exemple #1
0
        public void Create(CharacterBase c, ClientConnection Client)
        {
            uint num;

            this.ObjectType   = TYPE.PLAYER;
            this.ObjectTypeID = TYPEID.PLAYER;
            this.x            = c.x;
            this.y            = c.y;
            this.z            = c.z;
            this.o            = c.o;
            this.guid         = c.guid;
            switch (c.PowerType)
            {
            case Powers.MANA:
                num = 0xee00;
                break;

            case Powers.RAGE:
                num = 0x1100ee00;
                break;

            case Powers.ENERGY:
                num = 0;
                break;

            default:
                num = 0;
                Console.WriteLine("Unknown PowerType");
                break;
            }
            this.mask.SetBit(UpdateFields.OBJECT_FIELD_GUID, c.guid);
            if (c.race == Races.TAUREN)
            {
                this.mask.SetBit(UpdateFields.OBJECT_FIELD_SCALE_X, (float)1.35f);
            }
            else
            {
                this.mask.SetBit(UpdateFields.OBJECT_FIELD_SCALE_X, (float)1f);
            }
            this.mask.SetBit(UpdateFields.UNIT_FIELD_BOUNDINGRADIUS, (float)0.389f);
            this.mask.SetBit(UpdateFields.UNIT_FIELD_COMBATREACH, (float)1.5f);
            this.mask.SetBit(UpdateFields.UNIT_FIELD_DISPLAYID, c.displayid);
            this.mask.SetBit(UpdateFields.UNIT_FIELD_NATIVEDISPLAYID, c.displayid);
            this.mask.SetBit(UpdateFields.UNIT_FIELD_BYTES_0, new byte[] { (byte)c.race, (byte)c.class_, (byte)c.gender, (byte)c.PowerType });
            this.mask.SetBit(UpdateFields.UNIT_FIELD_BYTES_1, num);
            this.mask.SetBit(UpdateFields.UNIT_FIELD_BYTES_2, (uint)0xeeeeee00);
            this.mask.SetBit(UpdateFields.PLAYER_BYTES, new byte[] { c.skin, c.face, c.hairstyle, c.haircolor });
            byte[] buffer = new byte[4];
            buffer[0] = c.facialhair;
            buffer[1] = 0xee;
            buffer[3] = 2;
            this.mask.SetBit(UpdateFields.PLAYER_BYTES_2, buffer);
            this.mask.SetBit(UpdateFields.PLAYER_BYTES_3, (uint)c.gender);
            this.mask.SetBit(UpdateFields.PLAYER_FIELD_BYTES, (uint)0xeee00000);
            this.mask.SetBit(UpdateFields.UNIT_FIELD_LEVEL, (uint)c.level);
            this.mask.SetBit(UpdateFields.UNIT_FIELD_FACTIONTEMPLATE, c.GetFactionTemplate());
            this.mask.SetBit(UpdateFields.UNIT_FIELD_MAXHEALTH, (uint)0x3e8);
            this.mask.SetBit(UpdateFields.ITEM_FIELD_ENCHANTMENT, (uint)0x3e8);
            if (Client.User.GMLevel > 0)
            {
                this.mask.SetBit(UpdateFields.PLAYER_FLAGS, (uint)8);
            }
        }
Exemple #2
0
        public byte[] CreateList(ClientConnection Client, DatabaseManager DbManager)
        {
            Client.PlayerBase = null;
            ByteArrayBuilderV2 rv = new ByteArrayBuilderV2();

            this.Reader       = DbManager.Read("SELECT * FROM characters WHERE accname='" + Client.User.Name + "' AND realmid='" + StaticCore.RealmID.ToString() + "'");
            Client.Characters = new ArrayList();
            while (this.Reader.Read())
            {
                CharacterBase base2 = new CharacterBase();
                base2.guid = this.Reader.GetUInt64(0);
                base2.name = this.Reader[2].ToString();
                byte @byte = this.Reader.GetByte(3);
                byte num2  = this.Reader.GetByte(4);
                byte num3  = this.Reader.GetByte(5);
                base2.gender        = (Gender)num3;
                base2.race          = (Races)@byte;
                base2.class_        = (Classes)num2;
                base2.skin          = this.Reader.GetByte(6);
                base2.face          = this.Reader.GetByte(7);
                base2.hairstyle     = this.Reader.GetByte(8);
                base2.haircolor     = this.Reader.GetByte(9);
                base2.facialhair    = this.Reader.GetByte(10);
                base2.level         = this.Reader.GetByte(11);
                base2.zoneid        = this.Reader.GetUInt32(12);
                base2.map           = this.Reader.GetUInt32(13);
                base2.x             = this.Reader.GetFloat(14);
                base2.y             = this.Reader.GetFloat(15);
                base2.z             = this.Reader.GetFloat(0x10);
                base2.guildid       = this.Reader.GetUInt32(0x11);
                base2.flags         = this.Reader.GetByte(0x12);
                base2.rest          = this.Reader.GetByte(0x13);
                base2.petinfoid     = this.Reader.GetUInt32(20);
                base2.petlevel      = this.Reader.GetUInt32(0x15);
                base2.petfamilyid   = this.Reader.GetUInt32(0x16);
                base2.displayid     = this.Reader.GetUInt32(0x18);
                base2.tutorialflags = this.Reader.GetUInt32(0x1a);
                Client.Characters.Add(base2);
            }
            Client.User.team = Side.NONE;
            rv.Add((byte)Client.Characters.Count);
            foreach (CharacterBase base3 in Client.Characters)
            {
                Client.User.team = base3.GetSide();
                rv.Add(base3.guid);
                rv.Add(base3.name);
                rv.Add((byte)base3.race);
                rv.Add((byte)base3.class_);
                rv.Add((byte)base3.gender);
                rv.Add(base3.skin);
                rv.Add(base3.face);
                rv.Add(base3.hairstyle);
                rv.Add(base3.haircolor);
                rv.Add(base3.facialhair);
                rv.Add(base3.level);
                rv.Add(base3.zoneid);
                rv.Add(base3.map);
                rv.Add(base3.x);
                rv.Add(base3.y);
                rv.Add(base3.z);
                rv.Add(base3.guildid);
                rv.Add((uint)0);
                rv.Add(base3.rest);
                rv.Add(base3.petinfoid);
                rv.Add(base3.petlevel);
                rv.Add(base3.petfamilyid);
                Console.WriteLine("Guid:{0}", base3.guid);
                rv.Add(new byte[100]);
            }
            this.Reader.Close();
            lock (StaticCore.RealmDbManager)
            {
                MySqlCommand command = new MySqlCommand();
                command.Connection  = StaticCore.RealmDbManager.Connection;
                command.CommandText = "REPLACE INTO realmcharacters (accname, realmid, charcount) VALUES(?accname, ?realmid, ?charcount)";
                command.Parameters.Add("?accname", Client.User.Name);
                command.Parameters.Add("?realmid", StaticCore.RealmID);
                command.Parameters.Add("?charcount", Client.Characters.Count);
                command.ExecuteNonQuery();
            }
            return((byte[])rv);
        }
        public void Create(CharacterBase c, ClientConnection Client)
        {
            uint num;

            this.ObjectType   = TYPE.PLAYER;
            this.ObjectTypeID = TYPEID.PLAYER;
            this.x            = c.x;
            this.y            = c.y;
            this.z            = c.z;
            this.o            = c.o;
            this.guid         = c.guid;
            switch (c.PowerType)
            {
            case Powers.MANA:
                num = 0xee00;
                break;

            case Powers.RAGE:
                num = 0x1100ee00;
                break;

            case Powers.ENERGY:
                num = 0;
                break;

            default:
                num = 0;
                Console.WriteLine("Unknown PowerType");
                break;
            }
            byte[] bytes = BitConverter.GetBytes(c.guid);
            this.mask.SetBit(0, BitConverter.ToUInt32(bytes, 0));
            this.mask.SetBit(1, BitConverter.ToUInt32(bytes, 4));
            if (c.race == Races.TAUREN)
            {
                this.mask.SetBit(4, (float)1.35f);
            }
            else
            {
                this.mask.SetBit(4, (float)1f);
            }
            this.mask.SetBit(0x81, (float)0.389f);
            this.mask.SetBit(130, (float)1.5f);
            this.mask.SetBit(0x83, c.displayid);
            this.mask.SetBit(0x84, c.displayid);
            this.mask.SetBit(0x24, new byte[] { (byte)c.race, (byte)c.class_, (byte)c.gender, (byte)c.PowerType });
            this.mask.SetBit(0x8a, num);
            this.mask.SetBit(0xa4, (uint)0xeeeeee00);
            this.mask.SetBit(0x2e, (uint)0);
            this.mask.SetBit(0x8f, (uint)0x10);
            this.mask.SetBit(0xc1, new byte[] { c.skin, c.face, c.hairstyle, c.haircolor });
            byte[] buffer3 = new byte[4];
            buffer3[0] = c.facialhair;
            buffer3[1] = 0xee;
            buffer3[3] = 2;
            this.mask.SetBit(0xc2, buffer3);
            this.mask.SetBit(0xc3, (uint)c.gender);
            this.mask.SetBit(0x4c6, (uint)0xeee00000);
            this.mask.SetBit(0x22, (uint)c.level);
            this.mask.SetBit(0x23, c.GetFactionTemplate());
            this.mask.SetBit(0x1c, (uint)0x3e8);
            this.mask.SetBit(0x16, (uint)200);
            if (Client.User.GMLevel > 0)
            {
                this.mask.SetBit(190, (uint)8);
            }
            byte[] buffer2 = BitConverter.GetBytes((ulong)100);
        }
Exemple #4
0
        public byte[] CreateCharacter(ByteArrayBuilderV2 data, ClientConnection Client, DatabaseManager DbManager)
        {
            byte num;
            byte num2;
            byte num3;
            byte num4;
            ByteArrayBuilderV2 rv = new ByteArrayBuilderV2();

            if (Client.Characters.Count >= 10)
            {
                rv.Add((byte)0x34);
                return((byte[])rv);
            }
            CharacterBase base2 = new CharacterBase();

            data.Get(out base2.name);
            this.Reader = DbManager.Read("SELECT guid FROM characters WHERE name='" + base2.name + "'");
            if (this.Reader.Read())
            {
                rv.Add((byte)0x31);
                this.Reader.Close();
                return((byte[])rv);
            }
            this.Reader.Close();
            data.Get(out num);
            data.Get(out num2);
            base2.class_ = (Classes)num2;
            base2.race   = (Races)num;
            if ((Client.User.GMLevel < 1) && (Client.User.team != Side.NONE))
            {
                if ((Client.User.team != base2.GetSide()) && (StaticCore.RealmType == 1))
                {
                    rv.Add((byte)0x33);
                    return((byte[])rv);
                }
                if ((Client.User.team != base2.GetSide()) && (StaticCore.RealmType == 8))
                {
                    rv.Add((byte)0x33);
                    return((byte[])rv);
                }
            }
            data.Get(out num3);
            base2.gender = (Gender)num3;
            data.Get(out base2.skin);
            data.Get(out base2.face);
            data.Get(out base2.hairstyle);
            data.Get(out base2.haircolor);
            data.Get(out base2.facialhair);
            data.Get(out num4);
            base2.level     = 1;
            base2.displayid = base2.GetDisplayId();
            string[] strArray = new string[] { "SELECT * FROM playercreateinfo WHERE race='", ((byte)base2.race).ToString(), "' AND class='", ((byte)base2.class_).ToString(), "'" };
            this.Reader = DbManager.Read(string.Concat(strArray));
            this.Reader.Read();
            base2.map    = this.Reader.GetUInt32(2);
            base2.zoneid = this.Reader.GetUInt32(3);
            base2.x      = this.Reader.GetFloat(4);
            base2.y      = this.Reader.GetFloat(5);
            base2.z      = this.Reader.GetFloat(6);
            this.Reader.Close();
            MySqlCommand command = new MySqlCommand();

            command.Connection  = DbManager.Connection;
            command.CommandText = "INSERT INTO characters (accname, name, race, class, gender, skin, face, hairstyle, haircolor, facialhair, level, zoneid, map, x, y, z, guildid, flags, rest, petinfoid, petlevel, petfamilyid, realmid, displayid, tutorialflags) VALUES(?accname, ?name, ?race, ?class, ?gender, ?skin, ?face, ?hairstyle, ?haircolor, ?facialhair, ?level, ?zoneid, ?map, ?x, ?y, ?z, ?guildid, ?flags, ?rest, ?petinfoid, ?petlevel, ?petfamilyid, ?realmid, ?displayid, ?tutorialflags)";
            command.Parameters.Add("?accname", Client.User.Name);
            command.Parameters.Add("?name", base2.name);
            command.Parameters.Add("?race", base2.race);
            command.Parameters.Add("?class", base2.class_);
            command.Parameters.Add("?gender", base2.gender);
            command.Parameters.Add("?skin", base2.skin);
            command.Parameters.Add("?face", base2.face);
            command.Parameters.Add("?hairstyle", base2.hairstyle);
            command.Parameters.Add("?haircolor", base2.haircolor);
            command.Parameters.Add("?facialhair", base2.facialhair);
            command.Parameters.Add("?level", base2.level);
            command.Parameters.Add("?zoneid", base2.zoneid);
            command.Parameters.Add("?map", base2.map);
            command.Parameters.Add("?x", base2.x);
            command.Parameters.Add("?y", base2.y);
            command.Parameters.Add("?z", base2.z);
            command.Parameters.Add("?guildid", base2.guildid);
            command.Parameters.Add("?flags", base2.flags);
            command.Parameters.Add("?rest", base2.rest);
            command.Parameters.Add("?petinfoid", base2.petinfoid);
            command.Parameters.Add("?petlevel", base2.petlevel);
            command.Parameters.Add("?petfamilyid", base2.petfamilyid);
            command.Parameters.Add("?realmid", StaticCore.RealmID);
            command.Parameters.Add("?displayid", base2.displayid);
            command.Parameters.Add("?tutorialflags", base2.tutorialflags);
            if (command.ExecuteNonQuery() < 1)
            {
                rv.Add((byte)0x30);
                return((byte[])rv);
            }
            rv.Add((byte)0x2e);
            return((byte[])rv);
        }