1
Fork 0
mirror of https://bitbucket.org/Ioncannon/project-meteor-server.git synced 2025-04-24 05:37:46 +00:00

Level 0 class fixes

Add level 1 abilities when switching to level 0 class

Fix client error when switching to level 0 class
This commit is contained in:
Yogurt 2019-06-08 21:44:06 -07:00
parent 32330d557c
commit a996797beb

View file

@ -992,10 +992,6 @@ namespace FFXIVClassic_Map_Server.Actors
public void PrepareClassChange(byte classId) public void PrepareClassChange(byte classId)
{ {
//If new class, init abilties and level
if (charaWork.battleSave.skillLevel[classId - 1] <= 0)
UpdateClassLevel(classId, 1);
SendCharaExpInfo(); SendCharaExpInfo();
} }
@ -1037,6 +1033,13 @@ namespace FFXIVClassic_Map_Server.Actors
charaWork.commandCategory[i] = 0; charaWork.commandCategory[i] = 0;
} }
//If new class, init abilties and level
if (charaWork.battleSave.skillLevel[classId - 1] <= 0)
{
UpdateClassLevel(classId, 1);
EquipAbilitiesAtLevel(classId, 1);
}
ActorPropertyPacketUtil propertyBuilder = new ActorPropertyPacketUtil("charaWork/stateForAll", this); ActorPropertyPacketUtil propertyBuilder = new ActorPropertyPacketUtil("charaWork/stateForAll", this);
propertyBuilder.AddProperty("charaWork.parameterSave.state_mainSkill[0]"); propertyBuilder.AddProperty("charaWork.parameterSave.state_mainSkill[0]");
@ -1071,7 +1074,7 @@ namespace FFXIVClassic_Map_Server.Actors
{ {
Database.PlayerCharacterUpdateClassLevel(this, classId, level); Database.PlayerCharacterUpdateClassLevel(this, classId, level);
charaWork.battleSave.skillLevel[classId - 1] = level; charaWork.battleSave.skillLevel[classId - 1] = level;
ActorPropertyPacketUtil propertyBuilder = new ActorPropertyPacketUtil("charaWork/exp", this); ActorPropertyPacketUtil propertyBuilder = new ActorPropertyPacketUtil("charaWork/stateForAll", this);
propertyBuilder.AddProperty(String.Format("charaWork.battleSave.skillLevel[{0}]", classId-1)); propertyBuilder.AddProperty(String.Format("charaWork.battleSave.skillLevel[{0}]", classId-1));
List<SubPacket> packets = propertyBuilder.Done(); List<SubPacket> packets = propertyBuilder.Done();
QueuePackets(packets); QueuePackets(packets);
@ -2453,12 +2456,10 @@ namespace FFXIVClassic_Map_Server.Actors
//Set exp to current class to 0 so that exp is added correctly //Set exp to current class to 0 so that exp is added correctly
charaWork.battleSave.skillPoint[classId - 1] = 0; charaWork.battleSave.skillPoint[classId - 1] = 0;
//send new level //send new level
ActorPropertyPacketUtil expPropertyPacket2 = new ActorPropertyPacketUtil("charaWork/exp", this); ActorPropertyPacketUtil levelPropertyPacket = new ActorPropertyPacketUtil("charaWork/stateForAll", this);
ActorPropertyPacketUtil expPropertyPacket3 = new ActorPropertyPacketUtil("charaWork/stateForAll", this); levelPropertyPacket.AddProperty(String.Format("charaWork.battleSave.skillLevel[{0}]", classId - 1));
expPropertyPacket2.AddProperty(String.Format("charaWork.battleSave.skillLevel[{0}]", classId - 1)); levelPropertyPacket.AddProperty("charaWork.parameterSave.state_mainSkillLevel");
expPropertyPacket2.AddProperty("charaWork.parameterSave.state_mainSkillLevel"); QueuePackets(levelPropertyPacket.Done());
QueuePackets(expPropertyPacket2.Done());
QueuePackets(expPropertyPacket3.Done());
Database.SetLevel(this, classId, GetLevel()); Database.SetLevel(this, classId, GetLevel());
Database.SavePlayerCurrentClass(this); Database.SavePlayerCurrentClass(this);
@ -2475,6 +2476,27 @@ namespace FFXIVClassic_Map_Server.Actors
return actionList; return actionList;
} }
//Equips any abilities for the given classId at the given level. If actionList is not null, adds a "You learn Command" message
private void EquipAbilitiesAtLevel(byte classId, short level, List<CommandResult> actionList = null)
{
//If there's any abilites that unlocks at this level, equip them.
List<ushort> commandIds = Server.GetWorldManager().GetBattleCommandIdByLevel(classId, GetLevel());
foreach (ushort commandId in commandIds)
{
EquipAbilityInFirstOpenSlot(classId, commandId, false);
byte jobId = ConvertClassIdToJobId(classId);
if (jobId != classId)
EquipAbilityInFirstOpenSlot(jobId, commandId, false);
//33926: You learn [command].
if (actionList != null)
{
if (classId == GetCurrentClassOrJob() || jobId == GetCurrentClassOrJob())
actionList.Add(new CommandResult(actorId, 33926, 0, commandId));
}
}
}
//Increaess level of current class and equips new abilities earned at that level //Increaess level of current class and equips new abilities earned at that level
public void LevelUp(byte classId, List<CommandResult> actionList = null) public void LevelUp(byte classId, List<CommandResult> actionList = null)
{ {
@ -2488,22 +2510,7 @@ namespace FFXIVClassic_Map_Server.Actors
if (actionList != null) if (actionList != null)
actionList.Add(new CommandResult(actorId, 33909, 0, (ushort)charaWork.battleSave.skillLevel[classId - 1])); actionList.Add(new CommandResult(actorId, 33909, 0, (ushort)charaWork.battleSave.skillLevel[classId - 1]));
//If there's any abilites that unlocks at this level, equip them. EquipAbilitiesAtLevel(classId, GetLevel(), actionList);
List<ushort> commandIds = Server.GetWorldManager().GetBattleCommandIdByLevel(classId, GetLevel());
foreach (ushort commandId in commandIds)
{
EquipAbilityInFirstOpenSlot(classId, commandId, false);
byte jobId = ConvertClassIdToJobId(classId);
if (jobId != classId)
EquipAbilityInFirstOpenSlot(jobId, commandId, false);
//33926: You learn [command].
if (actionList != null)
{
if (classId == GetCurrentClassOrJob() || jobId == GetCurrentClassOrJob())
actionList.Add(new CommandResult(actorId, 33926, 0, commandId));
}
}
} }
} }