VB/VB.Net 226 Traduction

A

Anonymous

Invité
#1
Bonjour,

aujourd'hui je poste mon premier sujet en question/réponse et j'ai un problème de traduction de mon 226:



MapComplementaryInformationsDataMessage:
Public Class MapComplementaryInformationsDataMessage

Public SubareaId As UInteger = 0
Public MapId As UInteger = 0
Public SubareaAlignmentSide As Integer = 0
Public Houses As New List(Of HouseInformations)
Public Actors As New List(Of GameRolePlayActorInformations)
Public InteractiveElements As New List(Of InteractiveElement)
Public StatedElements As New List(Of StatedElement)
Public Obstacles As New List(Of MapObstacle)
Public Fights As New List(Of FightCommonInformations)

Public Property ProtocolId As UInteger = 226

Public Sub InitMapComplementaryInformationsDataMessage(ByVal Param1 As UInteger, ByVal Param2 As UInteger, ByVal Param3 As Integer, ByVal Param4 As List(Of HouseInformations), ByVal Param5 As List(Of GameRolePlayActorInformations), ByVal Param6 As List(Of InteractiveElement), ByVal Param7 As List(Of StatedElement), ByVal Param8 As List(Of MapObstacle), ByVal Param9 As List(Of FightCommonInformations))
Me.SubareaId = Param1
Me.MapId = Param2
Me.SubareaAlignmentSide = Param3
Me.Houses = Param4
Me.Actors = Param5
Me.InteractiveElements = Param6
Me.StatedElements = Param7
Me.Obstacles = Param8
Me.Fights = Param9
End Sub


Public Sub Deserialize(ByVal Data As Dofus.DofusReader)

SubareaId = Data.ReadShort
MapId = Data.ReadInt32
SubareaAlignmentSide = Data.ReadByte
For i As Integer = 1 To Data.ReadUnSignedshort
Dim House As HouseInformations = ProtocolTypeManager.GetInstance(Data.ReadUnSignedshort)
House.deserialize(Data)
Houses.Add(House)
Next
For i As Integer = 1 To Data.ReadUnSignedshort
Dim Actor As New GameRolePlayActorInformations
Dim test As UInteger = Data.ReadUnSignedshort
If test = 141 Then
Actor = ProtocolTypeManager.GetInstance(test)
Actor.deserialize(Data)
Actors.Add(Actor)
End If
Next
For i As Integer = 1 To Data.ReadUInt16
Dim InteractiveElement As New InteractiveElement
InteractiveElement.deserialize(Data)
InteractiveElements.Add(InteractiveElement)
Next
For i As Integer = 1 To Data.ReadUInt16
Dim StatedElement As New StatedElement
StatedElement.deserialize(Data)
StatedElements.Add(StatedElement)
Next
For i As Integer = 1 To Data.ReadUInt16
Dim Obstacle As New MapObstacle
Obstacle.deserialize(Data)
Obstacles.Add(Obstacle)
Next
For i As Integer = 1 To Data.ReadUInt16
Dim Fight As New FightCommonInformations
Fight.deserialize(Data)
Fights.Add(Fight)
Next

End Sub

End Class

Voilà j'espère que vous pourrez m'aider
 
A

Anonymous

Invité
#2
Valeur de i ?
Valeur de House ? (Nothing je parie)

Je te conseil de mettre des variable intermédiaire, je m'explique :

Au lieu de :
Code:
For i As Integer = 1 To Data.ReadUnSignedshort
Dim House As HouseInformations = ProtocolTypeManager.GetInstance(Data.ReadUnSignedshort)
House.deserialize(Data)
Houses.Add(House)
Next
Met plutôt :
Code:
Dim NombreMaison As Integer = Data.ReadUnSignedshort
 For i As Integer = 1 To NombreMaison
Dim Protocol As Integer = Data.ReadUnSignedshort
Dim House As HouseInformations = ProtocolTypeManager.GetInstance(Protocol)
House.deserialize(Data)
Houses.Add(House)
Next

Qui te permettras de mieux contrôler le code
 
A

Anonymous

Invité
#3
J'ai fais comme tu m'a dit, je t’avoue ne pas être super en programmation je débute, si tu pouvais m'aider par TW ?
 
Inscrit
5 Decembre 2010
Messages
114
Reactions
0
#4
Je ne sais pas ou tu as trouver ton MapComplementaryInformationsDataMessage mais le mien ressemble pas du tout à cela. Je te conseille de regarder celui des sources du jeu qui est beaucoup plus facile a traduire.
 
A

Anonymous

Invité
#5
Comme tu le vois il y a plusieurs personnes qui sont en train de traduire ce packet, donc il vaut mieux rester sur le forum.
Donne nous les valeurs de toute les variables :
NombreMaison, i, Protocol, House.
On pourra ainsi situer le problème
 
Inscrit
5 Decembre 2010
Messages
114
Reactions
0
#6
A mon avis cela vient de ta classe GetInstance, qui je pense, n'est pas correctement coder.
 
A

Anonymous

Invité
#7
Dim NombreMaison As Integer = Data.ReadUnSignedshort
Dim Protocol As Integer = Data.ReadUnSignedshort
Dim House As HouseInformations = ProtocolTypeManager.GetInstance(Protocol)
Celui de mon écoute jeu:
Dim i = _socket_Connexion.Receive(buffer) ' on met dans i le nombre d'octets recu
Celui de mon écoute connexion:
Dim i = _socket_Jeu.Receive(buffer) ' on met dans i le nombre d'octets recu
 
A

Anonymous

Invité
#8
J'ai due mal m'expliquer, je te disais dans ton MapComplementary... lorsque l'erreur ce produit, tu met ta souris sur la variable "NombreMaison" et tu regarde sa valeur, de même pour le "i" du FOR et protocol
 
Inscrit
5 Decembre 2010
Messages
114
Reactions
0
#9
pour avoir les valeurs met un point d’arrêt (F7 ou F9) sur la ligne juste avant Dim NombreMaison As Integer = Data.ReadUnSignedshort et ensuite tu exécute et arriver au point d’arrêt fait du pas à pas et en plaçant ta souris sur tes variables tu pourras voir les valeurs, c'est ce que veux Maxilia.
 
Inscrit
29 Septembre 2011
Messages
393
Reactions
3
#10
mon 226 est pas pareille du tous enfin pas terminé mais pas pareille.
 
A

Anonymous

Invité
#11
NombreMaison = 1
i = 1
Protocol = 112
 
A

Anonymous

Invité
#12
Très bien, ton problème vient donc de ton protocolTypeManager, peutx-tu nous le montrer?
 
A

Anonymous

Invité
#13
Voila:

Imports WindowsApplication1.Network.Messages.Connexion
Imports WindowsApplication1.Types.Game.Look
Imports WindowsApplication1.Types.Game.Character
Imports WindowsApplication1.Types.Game.Character.Choice
Imports WindowsApplication1.Types.Game.Character.Characteristic
Imports WindowsApplication1.Types.Game.context.Fight
Imports WindowsApplication1.Network.Types.Game.Data
Imports WindowsApplication1.Types.Game.Data.Items
Imports WindowsApplication1.tifoux.message.Items

Public Class ProtocolTypeManager
Public Shared Function GetInstance(ByVal Id As UInteger)
Dim objectValue As Object = Nothing
Select Case Id

Case 11
objectValue = New Version
Case 377
objectValue = New TrustCertificate
'Case 25
' objectValue = New GameServerInformations
Case 55
objectValue = New EntityLook
Case 54
objectValue = New SubEntity
Case 110
objectValue = New CharacterMinimalInformations
Case 163
objectValue = New CharacterMinimalPlusLookInformations
'Case 193
' objectValue = New CharacterMinimalPlusLookAndGradeInformations
Case 45
objectValue = New CharacterBaseInformations
'Case 212
' objectValue = New CharacterToRecolorInformation
'Case 86
' objectValue = New CharacterHardcoreInformations
'Case 63
' objectValue = New EntityMovementInformations
Case 60
objectValue = New EntityDispositionInformations
'Case 107
' objectValue = New IdentifiedEntityDispositionInformations
'Case 217
' objectValue = New FightEntityDispositionInformations
'Case 365
' objectValue = New BasicGuildInformations
'Case 127
' objectValue = New GuildInformations
Case 204
objectValue = New ActorRestrictionsInformations
Case 201
objectValue = New ActorAlignmentInformations
'Case 183
' objectValue = New PaddockContentInformations
'Case 184
' objectValue = New MountInformationsForPaddock
Case 202
objectValue = New ActorExtendedAlignmentInformations
'Case 135
' objectValue = New AlignmentBonusInformations
'Case 142
' objectValue = New PrismSubAreaInformation
'Case 152
' objectValue = New PrismConquestInformation
'Case 187
' objectValue = New TaxCollectorName
'Case 96
' objectValue = New TaxCollectorBasicInformations
Case 4
objectValue = New CharacterBaseCharacteristic
Case 215
objectValue = New CharacterSpellModification
Case 8
objectValue = New CharacterCharacteristicsInformations
'Case 117
' objectValue = New FightExternalInformations
Case 43
objectValue = New FightCommonInformations
Case 44
objectValue = New FightTeamMemberInformations
'Case 13
' objectValue = New FightTeamMemberCharacterInformations
Case 6
objectValue = New FightTeamMemberMonsterInformations
'Case 177
' objectValue = New FightTeamMemberTaxCollectorInformations
Case 20
objectValue = New FightOptionsInformations
Case 116
objectValue = New AbstractFightTeamInformations
Case 33
objectValue = New FightTeamInformations
'Case 115
' objectValue = New FightTeamLightInformations
'Case 31
' objectValue = New GameFightMinimalStats
'Case 360
' objectValue = New GameFightMinimalStatsPreparation
'Case 41
' objectValue = New FightLoot
'Case 16
' objectValue = New FightResultListEntry
'Case 189
' objectValue = New FightResultFighterListEntry
'Case 191
' objectValue = New FightResultAdditionalData
'Case 192
' objectValue = New FightResultExperienceData
'Case 190
' objectValue = New FightResultPvpData
'Case 24
' objectValue = New FightResultPlayerListEntry
'Case 216
' objectValue = New FightResultMutantListEntry
'Case 84
' objectValue = New FightResultTaxCollectorListEntry
'Case 206
' objectValue = New AbstractFightDispellableEffect
'Case 208
' objectValue = New FightDispellableEffectExtendedInformations
'Case 209
' objectValue = New FightTemporaryBoostEffect
'Case 366
' objectValue = New FightTemporarySpellImmunityEffect
'Case 210
' objectValue = New FightTriggeredEffect
'Case 207
' objectValue = New FightTemporarySpellBoostEffect
'Case 211
' objectValue = New FightTemporaryBoostWeaponDamagesEffect
'Case 214
' objectValue = New FightTemporaryBoostStateEffect
'Case 353
' objectValue = New ActorOrientation
'Case 205
' objectValue = New GameFightSpellCooldown
'Case 364
' objectValue = New GameFightResumeSlaveInfo
Case 7
objectValue = New Item
Case 49
objectValue = New SpellItem
'Case 76
' objectValue = New ObjectEffect
'Case 74
' objectValue = New ObjectEffectString
Case 70
objectValue = New ObjectEffectInteger
'Case 82
' objectValue = New ObjectEffectMinMax
'Case 73
' objectValue = New ObjectEffectDice
'Case 72
' objectValue = New ObjectEffectDate
'Case 75
' objectValue = New ObjectEffectDuration
'Case 71
' objectValue = New ObjectEffectCreature
'Case 81
' objectValue = New ObjectEffectLadder
'Case 179
' objectValue = New ObjectEffectMount
'Case 178
' objectValue = New MountClientData
'Case 356
' objectValue = New UpdateMountBoost
'Case 357
' objectValue = New UpdateMountIntBoost
'Case 168
' objectValue = New ItemDurability
'Case 85
' objectValue = New GameActionMarkedCell
'Case 351
' objectValue = New GameActionMark
'Case 123
' objectValue = New GoldItem
'Case 358
' objectValue = New ObjectEffects
'Case 124
' objectValue = New ObjectItemMinimalInformation
'Case 352
' objectValue = New ObjectItemToSellInNpcShop
'Case 119
' ' objectValue = New ObjectItemQuantity
'Case 134
' objectValue = New ObjectItemNotInContainer
'Case 37
' objectValue = New ObjectItem
'Case 120
' objectValue = New ObjectItemToSell
'Case 359
' objectValue = New ObjectItemToSellInHumanVendorShop
'Case 164
' objectValue = New ObjectItemToSellInBid
'Case 198
' objectValue = New ObjectItemInRolePlay
'Case 197
' objectValue = New ObjectItemWithLookInRolePlay
'Case 199
' objectValue = New OrientedObjectItemWithLookInRolePlay
'Case 185
' objectValue = New PaddockItem
Case 369
objectValue = New Shortcut
'Case 367
' objectValue = New ShortcutObject
'Case 371
' objectValue = New ShortcutObjectItem
'Case 370
' objectValue = New ShortcutObjectPreset
'Case 368
' objectValue = New ShortcutSpell
'Case 121
' objectValue = New SellerBuyerDescriptor
'Case 122
' objectValue = New BidExchangerObjectInfo
'Case 52
' objectValue = New StartupActionAddObject
'Case 363
' objectValue = New Achievement
'Case 362
' objectValue = New AchievementStartedPercent
'Case 361
' objectValue = New AchievementStartedValue
'Case 106
' objectValue = New IgnoredInformations
'Case 105
' objectValue = New IgnoredOnlineInformations
'Case 78
' objectValue = New FriendInformations
'Case 92
' objectValue = New FriendOnlineInformations
'Case 77
' objectValue = New FriendSpouseInformations
'Case 93
' objectValue = New FriendSpouseOnlineInformations
'Case 88
' objectValue = New GuildMember
'Case 87
' objectValue = New GuildEmblem
Case 219
objectValue = New InteractiveElementSkill
'Case 220
' objectValue = New InteractiveElementNamedSkill
Case 80
objectValue = New InteractiveElement
Case 108
objectValue = New StatedElement
Case 200
objectValue = New MapObstacle
'Case 213
' objectValue = New PartyUpdateCommonsInformations
'Case 90
' objectValue = New PartyMemberInformations
'Case 374
' objectValue = New PartyGuestInformations
'Case 376
' objectValue = New PartyInvitationMemberInformations
'Case 378
' objectValue = New PartyMemberGeoPosition
'Case 373
' objectValue = New DungeonPartyFinderPlayer
'Case 97
' objectValue = New JobCrafterDirectorySettings
'Case 194
' objectValue = New JobCrafterDirectoryEntryPlayerInfo
'Case 195
' objectValue = New JobCrafterDirectoryEntryJobInfo
'Case 196
' objectValue = New JobCrafterDirectoryListEntry
'Case 101
' objectValue = New JobDescription
'Case 102
' objectValue = New SkillActionDescription
'Case 103
' objectValue = New SkillActionDescriptionTimed
'Case 99
' objectValue = New SkillActionDescriptionCollect
'Case 100
' objectValue = New SkillActionDescriptionCraft
'Case 104
' objectValue = New SkillActionDescriptionCraftExtended
'Case 98
' objectValue = New JobExperience
Case 111
objectValue = New HouseInformations
'Case 112
' objectValue = New HouseInformationsExtended
'Case 218
' objectValue = New HouseInformationsInside
'Case 170
' objectValue = New HouseInformationsForGuild
'Case 221
' objectValue = New HouseInformationsForSell
'Case 132
' objectValue = New PaddockInformations
'Case 130
' objectValue = New PaddockBuyableInformations
'Case 133
' objectValue = New PaddockAbandonnedInformations
'Case 131
' objectValue = New PaddockPrivateInformations
'Case 222
' objectValue = New PaddockInformationsForSell
Case 150
objectValue = New GameContextActorInformations
Case 141
objectValue = New GameRolePlayActorInformations
Case 157
objectValue = New HumanInformations
Case 153
objectValue = New HumanWithGuildInformations
Case 154
objectValue = New GameRolePlayNamedActorInformations
Case 159
objectValue = New GameRolePlayHumanoidInformations
Case 36
objectValue = New GameRolePlayCharacterInformations
'Case 3
' objectValue = New GameRolePlayMutantInformations
'Case 129
' objectValue = New GameRolePlayMerchantInformations
'Case 146
' objectValue = New GameRolePlayMerchantWithGuildInformations
'Case 180
' objectValue = New GameRolePlayMountInformations
'Case 147
' objectValue = New TaxCollectorStaticInformations
'Case 148
' objectValue = New GameRolePlayTaxCollectorInformations
'Case 167
' objectValue = New TaxCollectorInformations
'Case 372
' objectValue = New TaxCollectorLootInformations
'Case 166
' objectValue = New TaxCollectorInformationsInWaitForHelpState
'Case 186
' objectValue = New ProtectedEntityWaitingForHelpInfo
'Case 169
' objectValue = New TaxCollectorFightersInformation
'Case 165
' objectValue = New AdditionalTaxCollectorInformations
'Case 144
' objectValue = New MonsterInGroupInformations
'Case 140
' objectValue = New GroupMonsterStaticInformations
'Case 160
' objectValue = New GameRolePlayGroupMonsterInformations
'Case 155
' objectValue = New NpcStaticInformations
'Case 156
' objectValue = New GameRolePlayNpcInformations
'Case 161
' objectValue = New GameRolePlayPrismInformations
'Case 143
' objectValue = New GameFightFighterInformations
'Case 158
' objectValue = New GameFightFighterNamedInformations
'Case 46
' objectValue = New GameFightCharacterInformations
'Case 50
' objectValue = New GameFightMutantInformations
'Case 151
' objectValue = New GameFightAIInformations
'Case 29
' objectValue = New GameFightMonsterInformations
'Case 203
' objectValue = New GameFightMonsterWithAlignmentInformations
'Case 48
' objectValue = New GameFightTaxCollectorInformations
'Case 174
' objectValue = New MapCoordinates
'Case 176
' objectValue = New MapCoordinatesExtended
'Case 175
' objectValue = New AtlasPointsInformations
'Case 354
' objectValue = New PresetItem
'Case 355
' objectValue = New Preset
'Case 350
' objectValue = New ContentPart

Case Else
'MsgBox("MsgId: " & Id)
Exit Select

End Select

Return objectValue

End Function
End Class
 
Inscrit
5 Decembre 2010
Messages
114
Reactions
0
#15
Moi j'ai problème avec mon 226, je dois utiliser mon protocoltypemanager pour obtenir l'instance d'une variable et comme ma valeur n'est pas encore entrer j'obtiens une MessageBox qui me dit que mon id = 9 or dans les sources il n'y a aucune référence pour l'id 9, que faire ?
Ou sinon des fois j'obtiens l'id 11 alors que je suis sensé obtenir le 111.
Mon 226 :
Code:
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using System.Net.Sockets;
using System.Threading;
using D2Com.Network;
using D2Com.Network.Types;
using D2Com.IO;


namespace D2Com.Network
{
	public class _MapComplementaryInformationsDataMessage
	{
		
		#region Initialisation
		public bool _isInitialized = false;
       	public short subAreaId = 0;
        public int mapId = 0;
        public int subareaAlignmentSide = 0;
        public List<HouseInformations> houses = new List<HouseInformations>();
        public List<GameRolePlayActorInformations> actors = new List<GameRolePlayActorInformations>();
        public List<InteractiveElement> interactiveElements = new List<InteractiveElement>();
        public List<StatedElement> statedElements = new List<StatedElement>();
        public List<MapObstacle> obstacles = new List<MapObstacle>();
        public List<FightCommonInformations> fights = new List<FightCommonInformations>();
        public const uint protocolId = 226;
        #endregion
        
		public void deserializeAs_MapComplementaryInformationsDataMessage(DataReader reader)
		{
			#region Variables
			ushort _loc_14 = 0;
			var _loc_15 = new HouseInformations();
            ushort _loc_16 = 0;
            var _loc_17 = new GameRolePlayActorInformations();
            var _loc_18 = new InteractiveElement();
            var _loc_19 = new StatedElement();
            var _loc_20 = new MapObstacle();
            var _loc_21 = new FightCommonInformations();
            #endregion
            
            #region Code
            this.subAreaId = reader.ReadShort();
            this.mapId = reader.ReadInt();
            this.subareaAlignmentSide = reader.ReadByte();
            var _loc_2 = reader.ReadUShort();
            uint _loc_3 = 0;
            while ( _loc_3 < _loc_2 )
            {
            	_loc_14 = reader.ReadUShort();
            	_loc_15 = (HouseInformations)_ProtocolTypeManager.GetInstance(_loc_14);
            	_loc_15.Deserialize(reader);
            	this.houses.Add(_loc_15);
            	_loc_3 += 1;
            }
            var _loc_4 = reader.ReadUShort();
            uint _loc_5 = 0;
            while ( _loc_5 < _loc_4 )
            {
            	_loc_16 = reader.ReadUShort();
            	_loc_17 = (GameRolePlayActorInformations)_ProtocolTypeManager.GetInstance(_loc_16); <---- Problème a cette ligne.
            	_loc_17.Deserialize(reader);
            	this.actors.Add(_loc_17);
            	_loc_5 += 1;
            }
            var _loc_6 = reader.ReadUShort();
            uint _loc_7 = 0;
            while ( _loc_7 < _loc_6 )
            {
            	_loc_18 = new InteractiveElement();
            	_loc_18.Deserialize(reader);
            	this.interactiveElements.Add(_loc_18);
            	_loc_7 += 1;
            }
            var _loc_8 = reader.ReadUShort();
            uint _loc_9 = 0;
            while ( _loc_9 < _loc_8 )
            {
            	_loc_19 = new StatedElement();
            	_loc_19.Deserialize(reader);
            	this.statedElements.Add(_loc_19);
            	_loc_9 += 1;
            }
            var _loc_10 = reader.ReadUShort();
            uint _loc_11 = 0;
            while ( _loc_11 < _loc_10 )
            {
            	_loc_20 = new MapObstacle();
            	_loc_20.Deserialize(reader);
            	this.obstacles.Add(_loc_20);
            	_loc_11 += 1;
            }
            var _loc_12 = reader.ReadUShort();
            uint _loc_13 = 0;
            while ( _loc_13 < _loc_12 )
            {
            	_loc_21 = new FightCommonInformations();
            	_loc_21.Deserialize(reader);
            	this.fights.Add(_loc_21);
            	_loc_13 += 1;
            }
            return;
            #endregion
		}
	}
}
 
A

Anonymous

Invité
#16
Je n'ai pas de class HouseInformationsExtended.
Je traduit sa tout de suite.
 
A

Anonymous

Invité
#17
Il y a un endroit où tu lis mal le flux, c'est à quel endroit que tu rencontre cette erreur ?
Au niveau des houses, des actors, des interactiveElements , etc... ?


Edit : essaye aussi d'utiliser des variables avec des nom plus "parlant" que des "_loc_", on a du mal à s'y retrouver
 
Inscrit
5 Decembre 2010
Messages
114
Reactions
0
#18
LulsKiller a dit:
Protocol = 112
112 tu es sur ? Moi j'obtiens le 111. Est ce possible que se soit par rapport à la taille de la maison ?
 
Inscrit
5 Decembre 2010
Messages
114
Reactions
0
#19
Maxilia a dit:
Il y a un endroit où tu lis mal le flux, c'est à quel endroit que tu rencontre cette erreur ?
Au niveau des houses, des actors, des interactiveElements , etc... ?
des actors, regarde le code j'ai mis une indication ^^
 
A

Anonymous

Invité
#20
kangogoo a dit:
LulsKiller a dit:
Protocol = 112
112 tu es sur ? Moi j'obtiens le 111. Est ce possible que se soit par rapport à la taille de la maison ?
Tout dépend de la maison qu'il y a sur la map

Si c'est au niveau des actors, qu'elle est la valeur de _loc_5?
 
Haut Bas