Exemplo n.º 1
0
        //
        public PlayerEntity(Characters character)
            : base(new ObjectGuid((uint)character.Id, TypeId.TypeidPlayer, HighGuid.HighguidMoTransport))
        {
            /* Inicializadores */
            Character        = character;
            KnownPlayers     = new List <PlayerEntity>();
            KnownGameObjects = new List <zoneObjeto>();
            KnownUnitys      = new List <UnitEntity>();

            ChrRaces chrRaces = MainForm.ChrRacesReader.GetData(character.race);

            /* Definindo Character */
            Model       = (int)CharacterHelper.GetRaceModel(character.race, character.gender);
            ModelNative = (int)CharacterHelper.GetRaceModel(character.race, character.gender);
            Scale       = CharacterHelper.GetScale(character.race, character.gender);
            /* FIM das definições */

            SetUpdateField((int)ObjectFields.OBJECT_FIELD_TYPE, 25);
            SetUpdateField((int)ObjectFields.OBJECT_FIELD_SCALE_X, Size);

            SetUpdateField((int)UnitFields.UNIT_FIELD_HEALTH, Life.Current);

            SetUpdateField((int)UnitFields.UNIT_FIELD_MAXHEALTH, Life.Maximum);

            // To Display Level Correct need this [START]
            SetUpdateField((int)UnitFields.UNIT_FIELD_LEVEL, Level);
            SetUpdateField((int)UnitFields.UNIT_FIELD_FACTIONTEMPLATE, chrRaces.FactionId);
            // [END]

            SetUpdateField((int)UnitFields.UNIT_FIELD_BYTES_0, (byte)character.race);
            SetUpdateField((int)UnitFields.UNIT_FIELD_BYTES_0, (byte)character.classe, 1);
            SetUpdateField((int)UnitFields.UNIT_FIELD_BYTES_0, (byte)character.gender, 2);

            SetUpdateField((int)UnitFields.UNIT_FIELD_DISPLAYID, Model);
            SetUpdateField((int)UnitFields.UNIT_FIELD_NATIVEDISPLAYID, ModelNative);

            SetUpdateField((int)PlayerFields.PLAYER_BYTES, character.char_skin);
            SetUpdateField((int)PlayerFields.PLAYER_BYTES, character.char_face, 1);
            SetUpdateField((int)PlayerFields.PLAYER_BYTES, character.char_hairStyle, 2);
            SetUpdateField((int)PlayerFields.PLAYER_BYTES, character.char_hairColor, 3);

            SetUpdateField((int)PlayerFields.PLAYER_BYTES_2, character.char_facialHair);

            SetUpdateField((int)PlayerFields.PLAYER_XP, 0);
            SetUpdateField((int)PlayerFields.PLAYER_NEXT_LEVEL_XP, 400);
            SetUpdateField((int)PlayerFields.PLAYER_SKILL_INFO_1_1, 26);
            SetUpdateField((int)PlayerFields.PLAYER_FIELD_WATCHED_FACTION_INDEX, character.watched_faction);

            // Helpers
            SkillGenerate();

            // Setup Equiped Itens
            EquipamentoGenerate();
        }
Exemplo n.º 2
0
 public static void LoadRacesEditorFiles()
 {
     try
     {
         DbcStores.InitFiles();
         ChrRaces.LoadData();
     }
     catch (System.Exception ex)
     {
         MessageBox.Show(ex.ToString());
     }
 }
Exemplo n.º 3
0
 public static void LoadCharStartOutfit()
 {
     try
     {
         DbcStores.InitFiles();
         CharStartOutfit.LoadData();
         ChrRaces.LoadData();
         ChrClasses.LoadData();
     }
     catch (System.Exception ex)
     {
         MessageBox.Show(ex.Message);
     }
 }
Exemplo n.º 4
0
 public static void LoadRacesClassCombosEditorFiles()
 {
     try
     {
         DbcStores.InitFiles();
         CharBaseInfo.LoadData();
         ChrClasses.LoadData();
         ChrRaces.LoadData();
     }
     catch (System.Exception ex)
     {
         MessageBox.Show(ex.Message);
     }
 }
Exemplo n.º 5
0
        public override void Setup()
        {
            ChrRaces   Race  = this.Session.Core.DBC.GetDBC <ChrRaces>().SingleOrDefault(cr => cr.RaceID == this.Character.race);
            ChrClasses Class = this.Session.Core.DBC.GetDBC <ChrClasses>().SingleOrDefault(cr => cr.ClassID == this.Character.@class);

            this.Info          = new PlayerInfo(this.ObjectGUID, this.Character, Race, Class);
            this.PacketBuilder = new PlayerPacketBuilder(this);

            Location.X           = Character.position_x;
            Location.Y           = Character.position_y;
            Location.Z           = Character.position_z;
            Location.Orientation = Character.orientation;
            Location.MapID       = (int)Character.map;

            base.Setup();
        }
Exemplo n.º 6
0
 public static void LoadFactionsEditorFiles()
 {
     try
     {
         DbcStores.InitFiles();
         ChrClasses.LoadData();
         ChrRaces.LoadData();
         Faction.LoadData();
         FactionGroup.LoadData();
         FactionTemplate.LoadData();
     }
     catch (System.Exception ex)
     {
         MessageBox.Show(ex.Message);
     }
 }
Exemplo n.º 7
0
 public static void LoadTalentsEditorFiles()
 {
     try
     {
         DbcStores.InitFiles();
         ChrClasses.LoadData();
         ChrRaces.LoadData();
         Spell.LoadData();
         SpellIcon.LoadData();
         Talent.LoadData();
         TalentTab.LoadData();
     }
     catch (System.Exception ex)
     {
         MessageBox.Show(ex.Message);
     }
 }
Exemplo n.º 8
0
 public static void LoadProfessionEditorFiles()
 {
     try
     {
         DbcStores.InitFiles();
         Spell.LoadData();
         SkillLine.LoadData();
         SkillLineAbility.LoadData();
         SkillRaceClassInfo.LoadData();
         SpellFocusObject.LoadData();
         ChrRaces.LoadData();
         ChrClasses.LoadData();
     }
     catch (System.Exception ex)
     {
         MessageBox.Show(ex.Message);
     }
 }
Exemplo n.º 9
0
        internal static void OnPlayerLogin(RealmServerSession session, CmsgPlayerLogin handler)
        {
            session.Character = MainForm.Database.GetCharacter(handler.Guid);

            // Change Player Status Online

            // Part One
            session.SendPacket(new SmsgLoginVerifyWorld(session.Character));  // DONE
            session.SendPacket(new SmsgAccountDataTimes());                   // DONE
            session.SendMessageMotd("Welcome to World of Warcraft.");         // DONE
            session.SendMessageMotd("Servidor do caralho vai curintia ...."); // DONE

            // Part Two
            session.SendPacket(new SmsgSetRestStart());
            session.SendPacket(new SmsgBindpointupdate(session.Character));    // DONE
            session.SendPacket(new SmsgTutorialFlags());
            session.SendPacket(new SmsgLoginSettimespeed());                   // DONE
            session.SendPacket(new SmsgInitialSpells(session.Character));
            session.SendPacket(new SmsgActionButtons(session.Character));      // DONE
            session.SendPacket(new SmsgInitializeFactions(session.Character)); // DONE

            // Send Cinematic if first time
            if (session.Character.is_movie_played == false)
            {
                ChrRaces chrRaces = MainForm.ChrRacesReader.GetData(session.Character.race);
                session.SendPacket(new SmsgTriggerCinematic(chrRaces.CinematicId)); // DONE
            }

            // Part Three
            session.SendPacket(new SmsgCorpseReclaimDelay()); // DONE

            // Spawn Player
            session.SendPacket(new SmsgInitWorldStates(session.Character));
            session.SendPacket(UpdateObject.CreateOwnCharacterUpdate(session.Character, out session.Entity));

            // Set Sesstion Player
            session.Entity.Session = session;

            WorldManager.DispatchOnPlayerSpawn(session.Entity);

            // Generate Inventory
            foreach (var inventory in MainForm.Database.GetInventory(session.Character))
            {
                session.SendPacket(UpdateObject.CreateItem(inventory, session.Character));
            }


            /*
             * // Cast talents and racial passive spells
             *
             * /////////////////////////////// PT1
             * // Setting instance ID
             *
             * // Set player to transport
             *
             * // If we have changed map
             *
             * // Loading map cell if not loaded
             *
             * // SMSG_SET_PROFICIENCY
             *
             * // SMSG_UPDATE_AURA_DURATION
             *
             *  //FillAllUpdateFlags();
             *  //SendUpdate() -> Contem ao envio dos itens
             *
             * // Adding to World
             *  // AddToWorld(Me)
             *
             * // Enable client moving
             *  // SendTimeSyncReq(client)
             *
             * // Send update on aura durations
             *
             * /////////////////////////////// PT2
             * // Update character status in database
             *
             * // Guild Message Of The Day
             *
             * // Social lists
             *
             * // Send "Friend online"
             *
             * // Send online notify for guild
             *
             * // Put back character in group if disconnected
             */
        }
Exemplo n.º 10
0
        public PlayerInfo(ObjectGUID guid, character databaseCharacter, ChrRaces race, ChrClasses chrClass) : base(guid)
        {
            this.Class   = chrClass;
            this.ClassID = this.Class.ClassID;
            this.Gender  = databaseCharacter.gender;
            this.Power   = (byte)this.Class.PowerType;

            this.Race            = race;
            this.RaceID          = race.RaceID;
            this.FactionTemplate = race.FactionID;
            this.DisplayID       = this.NativeDisplayID = (int)(this.Gender == 0 ? race.ModelM : race.ModelF);
            this.Health          = (int)databaseCharacter.health;

            //Level = databaseCharacter.Level;
            this.XP          = (int)databaseCharacter.xp;
            this.NextLevelXP = 400;

            Byte[] playerBytes  = BitConverter.GetBytes(databaseCharacter.playerBytes);
            Byte[] playerBytes2 = BitConverter.GetBytes(databaseCharacter.playerBytes2);

            this.Skin      = playerBytes[0];
            this.Face      = playerBytes[1];
            this.HairStyle = playerBytes[2];
            this.HairColor = playerBytes[3];
            this.Accessory = playerBytes2[0];

            FactionTemplate     = race.FactionID;
            UnitFlag            = (int)UnitFlags.UNIT_FLAG_PVP;
            FlagUnk             = 0x08 | 0x20;
            WatchedFactionIndex = (int)databaseCharacter.watchedFaction;


            this.Money = (int)databaseCharacter.money;

/*
 *
 *          item_template[] equipment = ItemUtils.GenerateInventoryByIDs(Utils.CSVStringToIntArray(databaseCharacter.equipmentCache));
 *          VisualItems = new Item[19];
 *          for (byte itemSlot = 0; itemSlot < 19; itemSlot++)
 *          {
 *              if (equipment == null) return;
 *              if (equipment[itemSlot] != null)
 *              {
 *                  VisualItems[itemSlot] = new Item()
 *                                              {
 *                                                  Creator = guid.RawGUID,
 *                                                  EnchantmentIDs = new[] { 0, 0 },
 *                                                  Entry = equipment[itemSlot].entry,
 *                                                  RandomPropertyID = equipment[itemSlot].RandomProperty,
 *                                                  ItemSuffixFactor = 3
 *                                              };
 *
 *              }
 *              else
 *              {
 *                  VisualItems[itemSlot] = new Item()
 *                                              {
 *                                                  Creator = 0,
 *                                                  EnchantmentIDs = new[] { 0, 0 },
 *                                                  Entry = 0,
 *                                                  RandomPropertyID = 0,
 *                                                  ItemSuffixFactor = 0
 *                                              };
 *              }
 *          }*/

            Type |= (int)TypeMask.TYPEMASK_PLAYER;
        }