Hello tout le monde,
Je suis entrain d'ajouter les prestiges sur stump 2.10 via une orbe de prestige, cependant lorsque l'action sur le pnj s’exécute j'ai le droit a une null reference. Je ne comprend pas comment l'objet orb est null alors que le code me semble correct. Voici les codes :
Inventory.cs :
public static readonly int PrestigeOrbId = 20214;
public void AddEffectOnPrestigeItem(List<EffectInteger> effects)
{
foreach(EffectInteger effect in effects)
{
this.PrestigeItem.Effects.Add(effect);
}
}
public BasePlayerItem PrestigeItem
{
get
{
ItemTemplate orb = Singleton<ItemManager>.Instance.TryGetTemplate(PrestigeOrbId);
return this.TryGetItem(orb);
}
private set { }
}
Character.cs
private void CreatePrestigeItem()
{
this.Inventory.AddItem(this.Inventory.PrestigeItem); // Ici lors du déboggage PrestigeItem = null ????
}
public void PrestigeUp()
{
switch (this.Prestige)
{
case 1:
this.CreatePrestigeItem();
this.Inventory.AddEffectOnPrestigeItem(new List<EffectInteger>
{
new EffectInteger(EffectsEnum.Effect_NonExchangeable_982,1),
new EffectInteger(EffectsEnum.Effect_AddVitality,30),
new EffectInteger(EffectsEnum.Effect_AddStrength,25),
new EffectInteger(EffectsEnum.Effect_AddWisdom,30),
new EffectInteger(EffectsEnum.Effect_AddIntelligence,25),
new EffectInteger(EffectsEnum.Effect_AddAgility,25),
new EffectInteger(EffectsEnum.Effect_AddChance,25),
});
this.OpenPopup(string.Format("Félicitation votre personnage est passé au prestige numéro {0}, vous allez être déconnecté afin d'affecter les bonus à votre personnage.", this.Prestige), "Serveur ", 10);
this.RefreshActor();
this.Map.Refresh(this);
this.RefreshStats();
this.SaveLater();
this.AddTitle(200);
this.Client.Disconnect();
break;
case 2: ect...
https://www.noelshack.com/2017-22-1496525207-prestige-pb.jpg