bonjour, j’ai un émulateur 2.47 de dofus, qui jusqu’à présent a la plupart des sorts sont desbugs, à l’exception de certaines variantes, de plus, les cadres ne fonctionnent pas car leurs protocoles ont complètement changé.
J'ai besoin de quelqu'un pour m'aider à corriger ces erreurs, qui le pourrait?
namespace Stump.DofusProtocol.Types
{
using System;
using System.Linq;
using System.Text;
using Stump.DofusProtocol.Types;
using System.Collections.Generic;
using Stump.Core.IO;
[Serializable]
public class ObjectEffectMount : ObjectEffect
{
public new const short Id = 179;
public override short TypeId
{
get { return Id; }
}
public bool sex;
public bool isRideable;
public bool isFeconded;
public bool isFecondationReady;
public ulong objectId;
public ulong expirationDate;
public uint model;
public string name;
public string owner;
public sbyte level;
public int reproductionCount;
public uint reproductionCountMax;
public IEnumerable<ObjectEffectInteger> effects;
public IEnumerable<uint> capacities;
public ObjectEffectMount(ushort actionId, bool sex, bool isRideable, bool isFeconded, bool isFecondationReady, ulong objectId, ulong expirationDate, uint model, string name, string owner, sbyte level, int reproductionCount, uint reproductionCountMax, IEnumerable<ObjectEffectInteger> effects, IEnumerable<uint> capacities)
{
this.actionId = actionId;
this.sex = sex;
this.isRideable = isRideable;
this.isFeconded = isFeconded;
this.isFecondationReady = isFecondationReady;
this.objectId = objectId;
this.expirationDate = expirationDate;
this.model = model;
this.name = name;
this.owner = owner;
this.level = level;
this.reproductionCount = reproductionCount;
this.reproductionCountMax = reproductionCountMax;
this.effects = effects;
this.capacities = capacities;
}
public ObjectEffectMount() { }
public override void Serialize(IDataWriter writer)
{
base.Serialize(writer);
var flag = new byte();
flag = BooleanByteWrapper.SetFlag(flag, 0, sex);
flag = BooleanByteWrapper.SetFlag(flag, 1, isRideable);
flag = BooleanByteWrapper.SetFlag(flag, 2, isFeconded);
flag = BooleanByteWrapper.SetFlag(flag, 3, isFecondationReady);
writer.WriteByte(flag);
writer.WriteVarULong(objectId);
writer.WriteVarULong(expirationDate);
writer.WriteVarUInt(model);
writer.WriteUTF(name);
writer.WriteUTF(owner);
writer.WriteSByte(level);
writer.WriteVarInt(reproductionCount);
writer.WriteVarUInt(reproductionCountMax);
writer.WriteShort((short)effects.Count());
foreach (var objectToSend in effects)
{
objectToSend.Serialize(writer);
}
writer.WriteShort((short)capacities.Count());
foreach (var objectToSend in capacities)
{
writer.WriteVarUInt(objectToSend);
}
}
public override void Deserialize(IDataReader reader)
{
base.Deserialize(reader);
var flag = reader.ReadByte();
sex = BooleanByteWrapper.GetFlag(flag, 0);
isRideable = BooleanByteWrapper.GetFlag(flag, 1);
isFeconded = BooleanByteWrapper.GetFlag(flag, 2);
isFecondationReady = BooleanByteWrapper.GetFlag(flag, 3);
objectId = reader.ReadVarULong();
expirationDate = reader.ReadVarULong();
model = reader.ReadVarUInt();
name = reader.ReadUTF();
owner = reader.ReadUTF();
level = reader.ReadSByte();
reproductionCount = reader.ReadVarInt();
reproductionCountMax = reader.ReadVarUInt();
var effectsCount = reader.ReadUShort();
var effects_ = new ObjectEffectInteger[effectsCount];
for (var effectsIndex = 0; effectsIndex < effectsCount; effectsIndex++)
{
var objectToAdd = new ObjectEffectInteger();
objectToAdd.Deserialize(reader);
effects_[effectsIndex] = objectToAdd;
}
effects = effects_;
var capacitiesCount = reader.ReadUShort();
var capacities_ = new uint[capacitiesCount];
for (var capacitiesIndex = 0; capacitiesIndex < capacitiesCount; capacitiesIndex++)
{
capacities_[capacitiesIndex] = reader.ReadVarUInt();
}
capacities = capacities_;
}
}
}
using System;
using Stump.Core.IO;
namespace Stump.DofusProtocol.Types
{
public class ObjectEffectMount : ObjectEffect
{
public new const short Id = 179;
public int mountId;
public double date;
public uint modelId;
public override short TypeId
{
get
{
return 179;
}
}
public ObjectEffectMount()
{
}
public ObjectEffectMount(uint actionId, int mountId, double date, uint modelId) : base(actionId)
{
this.mountId = mountId;
this.date = date;
this.modelId = modelId;
}
public override void Serialize(IDataWriter writer)
{
base.Serialize(writer);
writer.WriteInt(this.mountId);
writer.WriteDouble(this.date);
writer.WriteVarShort((short)this.modelId);
}
public override void Deserialize(IDataReader reader)
{
base.Deserialize(reader);
this.mountId = reader.ReadInt();
this.date = reader.ReadDouble();
this.modelId = reader.ReadVarUShort();
}
}
}
using ServiceStack.Text;
using Stump.Core.Extensions;
using Stump.DofusProtocol.D2oClasses;
using Stump.DofusProtocol.Enums;
using Stump.DofusProtocol.Types;
using System;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.Linq;
namespace Stump.Server.WorldServer.Game.Effects.Instances
{
[Serializable]
public class EffectMount : EffectBase
{
protected double m_date;
protected uint m_modelId;
protected uint m_mountId;
public EffectMount()
{
}
public EffectMount(EffectMount copy)
: this(copy.Id, copy.m_mountId, copy.m_date, copy.m_modelId, copy)
{
}
public EffectMount(short id, uint mountid, double date, uint modelid, EffectBase effect)
: base(id, effect)
{
m_mountId = mountid;
m_date = date;
m_modelId = modelid;
}
public EffectMount(EffectsEnum effect, uint mountid, DateTime date, uint modelId)
: this((short)effect, mountid, date.GetUnixTimeStampLong(), modelId, new EffectBase())
{
}
public EffectMount(EffectInstanceMount effect)
: base(effect)
{
m_mountId = effect.mountId;
m_date = effect.date;
m_modelId = (ushort)effect.modelId;
}
public uint MountId
{
get { return m_mountId; }
set { m_mountId = value; }
}
public DateTime Date
{
get { return ((long)m_date).FromUnixTimeMs(); }
set { m_date = value.GetUnixTimeStampLong(); }
}
public uint ModelId
{
get { return m_modelId; }
set
{
m_modelId = value;
}
}
public override int ProtocoleId => 179;
public override byte SerializationIdenfitier => 9;
public override object[] GetValues()
{
return new object[] { m_mountId, m_date, m_modelId };
}
private List<EffectInteger> m_effects;
public ReadOnlyCollection<EffectInteger> Effects => m_effects.AsReadOnly();
public override ObjectEffect GetObjectEffect()
{
return new ObjectEffectMount((uint)Id, (int)m_mountId, m_date, m_modelId);
}
public override EffectInstance GetEffectInstance()
{
return new EffectInstanceMount()
{
effectId = (uint)Id,
targetMask = TargetMask,
delay = Delay,
duration = Duration,
group = Group,
random = Random,
modificator = Modificator,
trigger = Trigger,
triggers = Triggers,
zoneMinSize = ZoneMinSize,
zoneSize = ZoneSize,
zoneShape = (uint)ZoneShape,
zoneEfficiencyPercent = ZoneEfficiencyPercent,
zoneMaxEfficiency = ZoneMaxEfficiency,
modelId = m_modelId,
date = (float)m_date,
mountId = m_mountId
};
}
public override EffectBase GenerateEffect(EffectGenerationContext context, EffectGenerationType type = EffectGenerationType.Normal)
{
return new EffectMount(Id, m_mountId, m_date, m_modelId);
}
protected override void InternalSerialize(ref System.IO.BinaryWriter writer)
{
base.InternalSerialize(ref writer);
writer.Write(m_mountId);
writer.Write(m_date);
writer.Write(m_modelId);
}
protected override void InternalDeserialize(ref System.IO.BinaryReader reader)
{
base.InternalDeserialize(ref reader);
m_mountId = reader.ReadUInt32();
m_date = reader.ReadDouble();
m_modelId = reader.ReadUInt32();
}
public override bool Equals(object obj)
{
if (!(obj is EffectMount))
{
return false;
}
var b = obj as EffectMount;
return base.Equals(obj) && m_mountId == b.m_mountId && m_date == b.m_date && m_modelId == b.m_modelId;
}
public static bool operator ==(EffectMount a, EffectMount b)
{
if (ReferenceEquals(a, b))
{
return true;
}
if (((object)a == null) || ((object)b == null))
{
return false;
}
return a.Equals(b);
}
public static bool operator !=(EffectMount a, EffectMount b)
{
return !(a == b);
}
public bool Equals(EffectMount other)
{
if (ReferenceEquals(null, other))
{
return false;
}
if (ReferenceEquals(this, other))
{
return true;
}
return base.Equals(other) && other.m_date.Equals(m_date) && other.m_modelId == m_modelId &&
other.m_mountId == m_mountId;
}
public override int GetHashCode()
{
unchecked
{
int result = base.GetHashCode();
result = (result * 397) ^ m_date.GetHashCode();
result = (int)((result * 397) ^ m_modelId);
result = (int)((result * 397) ^ m_mountId);
return result;
}
}
}
}