Fixed the crash when class change is to a level 0 class. Now autosets to level 1.

This commit is contained in:
Filip Maj 2018-04-07 15:34:11 -04:00
parent 0b13b590a0
commit 880b1f3066
2 changed files with 92 additions and 0 deletions

View file

@ -990,6 +990,8 @@ namespace FFXIVClassic_Map_Server.Actors
public void PrepareClassChange(byte classId)
{
//If new class, init abilties and level
if (charaWork.battleSave.skillLevel[classId - 1] <= 0)
UpdateClassLevel(classId, 1);
SendCharaExpInfo();
}
@ -1038,6 +1040,16 @@ namespace FFXIVClassic_Map_Server.Actors
Database.SavePlayerCurrentClass(this);
}
public void UpdateClassLevel(byte classId, short level)
{
Database.PlayerCharacterUpdateClassLevel(this, classId, level);
charaWork.battleSave.skillLevel[classId - 1] = level;
ActorPropertyPacketUtil propertyBuilder = new ActorPropertyPacketUtil("charaWork/exp", this);
propertyBuilder.AddProperty(String.Format("charaWork.battleSave.skillLevel[{0}]", classId-1));
List<SubPacket> packets = propertyBuilder.Done();
QueuePackets(packets);
}
public void GraphicChange(int slot, InventoryItem invItem)
{
if (invItem == null)