1.29 Cellule initiale

Inscrit
18 Février 2017
Messages
149
Reactions
18
#1
Bonjour à tous,
Oui c'est encore moi ahah, mais après des jours de recherche, je voudrais savoir si quelqu'un sait où trouver ou alors sait comment ça se passe pour déterminer lors de la connexion initiale la cellule du joueur.
Si je me déco sur la map 700 (à titre d'exemple) et que 2h après j'y retourne, j'ai bien un paquet qui me dit la map lors de la connexion (GDM) mais pour la cellule je n'ai rien (il y a GA mais c'est pour le déplacement des entités pas pour le placement initial).

En vous remerciant par avance
 
Inscrit
18 Février 2017
Messages
149
Reactions
18
#2
Sachant que le message GM qui contient l'id de la cellule n'apparaît pas pour le joueur sauf en cas de reconnexion.
Donc au départ ce n'est pas lui qui détermine la cellule
 
Inscrit
8 Septembre 2017
Messages
36
Reactions
8
#3
Il s'agit de GameMovementMessage, il s'agit du packet qui affiche une entité sur une carte et donc la cellule tout simplement :)
 
Inscrit
8 Septembre 2017
Messages
36
Reactions
8
#4
Java:
public class GameMovementMessage extends Message {
    private IEntity entity;
    public GameMovementMessage(IEntity entity) {
        this.entity = entity;
    }

    @Override
    public void serialize() {
        getOutput().append("GM");
        getOutput().append("|+");
        
        getOutput().append(entity.getCell().getId()).append(";");
        getOutput().append(entity.getOrientation()).append(";");
        getOutput().append("0;");
        getOutput().append(entity.getUnicId()).append(";");
        
        if(entity instanceof MutantEntity) {
            
            IEntity monster = ((MutantEntity)entity).getMonster();
            
            getOutput().append(monster.getId()).append(";");
            getOutput().append("-7;").append(monster.getGfxId()).append("^").append(monster.getSize());
            getOutput().append(";").append("0").append(";").append("5").append(";");
            getOutput().append(entity.getStuffString()).append(";;;").append(0);
            
        } else {
            
            getOutput().append(entity.getName()).append(";");
            getOutput().append(((PlayableCharacter)entity).getId());
            
            Optional<Title> title = ((List<Title>)entity.getProperties(Title.class).getList()).values().stream().filter(t -> t.isSelected()).findFirst();
            
            if(title.isPresent()) {
                packet.append(",").append(title.get().getTitle()).append(",").append(title.get().getColor());
            }
            
            getOutput().append(";");
            getOutput().append(entity.getGfxId()).append("^").append(entity.getSize());
            
            
            Item follower = null;
            
            if((follower = ((PlayableCharacter)entity).getItemByPosition(ItemConst.ITEM_POS_PNJ_SUIVEUR)) != null) {
                
                getOutput().append(",").append(Constants.getFollowerIdByTemplateId(follower.getTemplate().getId()));
                getOutput().append("^100");
                
            }
            
            getOutput().append(";");
            getOutput().append(entity.getSexe()).append(";");
            getOutput().append(entity.getAlign().getAlignment()).append(",0,");
            getOutput().append(entity.getAlign().isShowWings() ? entity.getAlign().getGrade() : 0).append(",").append((entity.getLvl() > 200 ? 200 : entity.getLvl())+entity.getId()).append(","); //TODO
            
            if(entity.getAlign().isShowWings() && entity.getAlign().getDeshonors() > 0) getOutput().append("1;");
            
            else getOutput().append("0;");
            
            getOutput().append((entity.colors.get(0) != -1 ? Integer.toHexString(entity.colors.get(0)) : entity.colors.get(0))+";");
            getOutput().append((entity.colors.get(1) != -1 ? Integer.toHexString(entity.colors.get(1)) : entity.colors.get(1))+";");
            getOutput().append((entity.colors.get(2) != -1 ? Integer.toHexString(entity.colors.get(2)) : entity.colors.get(2))+";");
            getOutput().append(((PlayableCharacter)entity).getStuffString()).append(";");
    
            if(entity.getLvl() > 199)
                getOutput().append("2;");
            else if(entity.getLvl() > 99)
                getOutput().append("1;");
            else
                getOutput().append("0;");
            
            getOutput().append(";");//Emote
            getOutput().append(";");//Emote timer
            getOutput().append((((PlayableCharacter)entity).getGuildMember() != null ? ((PlayableCharacter)entity).getGuildMember().getGuild().getName() : "")+";");//GuildName
            getOutput().append((((PlayableCharacter)entity).getGuildMember() != null ? ((PlayableCharacter)entity).getGuildMember().getGuild().getEmblem() : "")+";");//Emblem
            getOutput().append(entity.getProperties(ExternalRestrictions.class).getValue()).append(";");//Restriction
            getOutput().append(((PlayableCharacter)entity).isOnMount() && ((PlayableCharacter)entity).getMount() != null ? ((PlayableCharacter)entity).getMount().getStringColor(entity) : ""+";");//Mount color
            getOutput().append(";");//TODO
        }
    }

    @Override
    public void deserialize() {
        
    }

}
Voilà ma class qui gère l'affichage si tu veux regarder
 
Inscrit
18 Février 2017
Messages
149
Reactions
18
#5
Java:
public class GameMovementMessage extends Message {
    private IEntity entity;
    public GameMovementMessage(IEntity entity) {
        this.entity = entity;
    }

    @Override
    public void serialize() {
        getOutput().append("GM");
        getOutput().append("|+");
       
        getOutput().append(entity.getCell().getId()).append(";");
        getOutput().append(entity.getOrientation()).append(";");
        getOutput().append("0;");
        getOutput().append(entity.getUnicId()).append(";");
       
        if(entity instanceof MutantEntity) {
           
            IEntity monster = ((MutantEntity)entity).getMonster();
           
            getOutput().append(monster.getId()).append(";");
            getOutput().append("-7;").append(monster.getGfxId()).append("^").append(monster.getSize());
            getOutput().append(";").append("0").append(";").append("5").append(";");
            getOutput().append(entity.getStuffString()).append(";;;").append(0);
           
        } else {
           
            getOutput().append(entity.getName()).append(";");
            getOutput().append(((PlayableCharacter)entity).getId());
           
            Optional<Title> title = ((List<Title>)entity.getProperties(Title.class).getList()).values().stream().filter(t -> t.isSelected()).findFirst();
           
            if(title.isPresent()) {
                packet.append(",").append(title.get().getTitle()).append(",").append(title.get().getColor());
            }
           
            getOutput().append(";");
            getOutput().append(entity.getGfxId()).append("^").append(entity.getSize());
           
           
            Item follower = null;
           
            if((follower = ((PlayableCharacter)entity).getItemByPosition(ItemConst.ITEM_POS_PNJ_SUIVEUR)) != null) {
               
                getOutput().append(",").append(Constants.getFollowerIdByTemplateId(follower.getTemplate().getId()));
                getOutput().append("^100");
               
            }
           
            getOutput().append(";");
            getOutput().append(entity.getSexe()).append(";");
            getOutput().append(entity.getAlign().getAlignment()).append(",0,");
            getOutput().append(entity.getAlign().isShowWings() ? entity.getAlign().getGrade() : 0).append(",").append((entity.getLvl() > 200 ? 200 : entity.getLvl())+entity.getId()).append(","); //TODO
           
            if(entity.getAlign().isShowWings() && entity.getAlign().getDeshonors() > 0) getOutput().append("1;");
           
            else getOutput().append("0;");
           
            getOutput().append((entity.colors.get(0) != -1 ? Integer.toHexString(entity.colors.get(0)) : entity.colors.get(0))+";");
            getOutput().append((entity.colors.get(1) != -1 ? Integer.toHexString(entity.colors.get(1)) : entity.colors.get(1))+";");
            getOutput().append((entity.colors.get(2) != -1 ? Integer.toHexString(entity.colors.get(2)) : entity.colors.get(2))+";");
            getOutput().append(((PlayableCharacter)entity).getStuffString()).append(";");
   
            if(entity.getLvl() > 199)
                getOutput().append("2;");
            else if(entity.getLvl() > 99)
                getOutput().append("1;");
            else
                getOutput().append("0;");
           
            getOutput().append(";");//Emote
            getOutput().append(";");//Emote timer
            getOutput().append((((PlayableCharacter)entity).getGuildMember() != null ? ((PlayableCharacter)entity).getGuildMember().getGuild().getName() : "")+";");//GuildName
            getOutput().append((((PlayableCharacter)entity).getGuildMember() != null ? ((PlayableCharacter)entity).getGuildMember().getGuild().getEmblem() : "")+";");//Emblem
            getOutput().append(entity.getProperties(ExternalRestrictions.class).getValue()).append(";");//Restriction
            getOutput().append(((PlayableCharacter)entity).isOnMount() && ((PlayableCharacter)entity).getMount() != null ? ((PlayableCharacter)entity).getMount().getStringColor(entity) : ""+";");//Mount color
            getOutput().append(";");//TODO
        }
    }

    @Override
    public void deserialize() {
       
    }

}
Voilà ma class qui gère l'affichage si tu veux regarder
Merci, c'est vrai que ça aide sur la compréhension du message^^
Mais hélas pas dans mon cas car le message "GM+" n'est affiché avec les informations sur soi-même que lors du changement de carte ou du réapparition (déco/reco) mais pas lors de l'arrivée initiale du joueur.
Il faut bien comprendre que si tu te déco chez toi, que tu fais 20H d'avion pour l'autre bout du monde, que tu te reco en Inde, tu seras sur la même cellule que lors de ta déconnexion.
C'est ça qu'il me faut savoir, comment ça se fait, je ne trouve rien qui le dit (je dois surement louper la chose...)
 
Inscrit
8 Septembre 2017
Messages
36
Reactions
8
#6
Je pense que tu ne comprend pas bien ce message .. Ce message informe des informations (cellules) d'une entité sur la carte. Si tu veux afficher les autres joueurs tu dois envoyer ce paquet contenant les informations du joueur B au joueur A (le tient)
 
Inscrit
18 Février 2017
Messages
149
Reactions
18
#7
Je pense que tu ne comprend pas bien ce message .. Ce message informe des informations (cellules) d'une entité sur la carte. Si tu veux afficher les autres joueurs tu dois envoyer ce paquet contenant les informations du joueur B au joueur A (le tient)
Imagine tu es seul sur la carte, tu es le premier qui arrive d'une connexion correcte, le serveur ne t'envoie pas ce message mais tu arrives quand même sur la cellule d'où tu t'es déconnecté.
 
Inscrit
18 Février 2017
Messages
149
Reactions
18
#8
J'ai trouvé la solution, il faut envoyer le paquet "GI" lors de la réception du paquet "GDM" avant le rafraichissement de l'interface pour permettre la réception et l'affichage des informations reçues elle par les messages "GM+"
Ce paquet étant noyé dans le flux, je n'avais pas vu ce petit oubli d'envoi^^

Merci @reben de ton aide^^
 
Inscrit
8 Septembre 2017
Messages
36
Reactions
8
#9
J'ai trouvé la solution, il faut envoyer le paquet "GI" lors de la réception du paquet "GDM" avant le rafraichissement de l'interface pour permettre la réception et l'affichage des informations reçues elle par les messages "GM+"
Ce paquet étant noyé dans le flux, je n'avais pas vu ce petit oubli d'envoi^^

Merci @reben de ton aide^^
J'avais pas compris que tu étais côté client et non serveur sorry haha
 
Haut Bas