Package be.demmel.jgws.entities

Examples of be.demmel.jgws.entities.Character


    serverData.setMap(map);
  }

  private CharacterData loadCharacterById(P1280_VerifyClient packet, int charId, GameServerSession playerData, MapData map) {
    Character character = this.getCharacterByCharId(charId);

    if (character == null) {
      return null;
    }

    // We found the character, load its data
    ByteBuf appearance = Unpooled.buffer(24);
    appearance = appearance.order(ByteOrder.LITTLE_ENDIAN);
    byte professionPrimary = character.getProfessionprimary();
    byte professionSecondary = character.getProfessionSecondary();
    int level = character.getLevel();
    int skillPointsFree = character.getSkillPointsFree();
    int skillPointsTotal = character.getSkillPointsTotal();
    int attrPtsFree = character.getAttributePointsFree();
    int attrPtsTotal = character.getAttributePointsTotal();
    appearance.writeByte((character.getLookHeight() << 4) | (character.getLookSex()));
    appearance.writeByte((character.getLookHairColor() << 4) | (character.getLookSkinColor()));
    appearance.writeByte((professionPrimary << 4) | (character.getLookHairStyle()));
    appearance.writeByte((character.getLookCampaign() << 4) | (character.getLookSex()));

    String charName = character.getCharName();

    // Get spawn point (random from the list of spawn points (zero-based)
    Random r = new Random();
    int chosenSpawnPointIndex = r.nextInt(map.getPossibleSpawns().size());
    GWVector chosenSpwwnPoint = map.getPossibleSpawns().get(chosenSpawnPointIndex);

    if (!map.isIsPve() && playerData.getTeamNumber() < map.getPossibleSpawns().size()) {
      chosenSpwwnPoint = map.getPossibleSpawns().get(playerData.getTeamNumber());
    }

    Account account = this.getAccountByAccountId(playerData.getAccId());

    if (account == null) {
      return null;
    }

    int groupId = account.getGroupId();

    Group group = this.getGroupByGroupId(groupId);
    if (group == null) {
      return null;
    }

    String groupPrefix = group.getGroupPrefix();
    byte groupChatColor = group.getGroupChatColor();

    CharacterData characterData = new CharacterData();
    characterData.setCharID(charId);
    characterData.setName(charName);

    characterData.setGameFileID(map.getGameFileID());
    characterData.setGameMapID(map.getGameMapID());
    characterData.setIsOutpost(map.isIsOutpost());

    characterData.setProfessionPrimary(professionPrimary);
    characterData.setProfessionSecondary(professionSecondary);
    characterData.setLevel(level);
    characterData.setMorale(100);
    characterData.setHealth(12345);
    characterData.setEnergy(1337);


    byte[] skillBar = character.getSkillBar();
    byte[] skillsUnlocked = character.getSkillsAvailable();

    characterData.setAttPtsFree(attrPtsFree);
    characterData.setAttPtsTotal(attrPtsTotal);

    characterData.setAppearance(appearance.array());
View Full Code Here


    EntityManagerFactory entityManagerFactory = Persistence.createEntityManagerFactory("jgws");
   
    Account account = new Account(1, 1, false, new byte[]{}, "root@root", "root", 6, 0, 0, 0, 0, 0, 0, 0, 0);
    persist(entityManagerFactory, account);
   
    Character character = new Character(1, "iDemmel", 1, 123, 22, (byte)5, (byte)2, false, 1337, 1337, 0, 0, 0, 0, null, null, 0, 1, 0, 4, 9, 1, 4, false, null, null, null, null, null, null, null);
    persist(entityManagerFactory, character);
   
  }
View Full Code Here

TOP

Related Classes of be.demmel.jgws.entities.Character

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.