mirror of
https://bitbucket.org/Ioncannon/project-meteor-server.git
synced 2025-04-23 13:17:45 +00:00
commit
dbdff59e0f
3 changed files with 46 additions and 41 deletions
|
@ -1247,7 +1247,7 @@ namespace FFXIVClassic_Map_Server
|
||||||
}
|
}
|
||||||
public static void EquipAbility(Player player, byte classId, ushort hotbarSlot, uint commandId, uint recastTime)
|
public static void EquipAbility(Player player, byte classId, ushort hotbarSlot, uint commandId, uint recastTime)
|
||||||
{
|
{
|
||||||
commandId ^= 0xA0F00000;
|
commandId &= 0xFFFF;
|
||||||
if (commandId > 0)
|
if (commandId > 0)
|
||||||
{
|
{
|
||||||
using (MySqlConnection conn = new MySqlConnection(
|
using (MySqlConnection conn = new MySqlConnection(
|
||||||
|
@ -2374,7 +2374,7 @@ namespace FFXIVClassic_Map_Server
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void LoadGlobalBattleCommandList(Dictionary<ushort, BattleCommand> battleCommandDict, Dictionary<Tuple<byte, short>, List<uint>> battleCommandIdByLevel)
|
public static void LoadGlobalBattleCommandList(Dictionary<ushort, BattleCommand> battleCommandDict, Dictionary<Tuple<byte, short>, List<ushort>> battleCommandIdByLevel)
|
||||||
{
|
{
|
||||||
using (MySqlConnection conn = new MySqlConnection(String.Format("Server={0}; Port={1}; Database={2}; UID={3}; Password={4}", ConfigConstants.DATABASE_HOST, ConfigConstants.DATABASE_PORT, ConfigConstants.DATABASE_NAME, ConfigConstants.DATABASE_USERNAME, ConfigConstants.DATABASE_PASSWORD)))
|
using (MySqlConnection conn = new MySqlConnection(String.Format("Server={0}; Port={1}; Database={2}; UID={3}; Password={4}", ConfigConstants.DATABASE_HOST, ConfigConstants.DATABASE_PORT, ConfigConstants.DATABASE_NAME, ConfigConstants.DATABASE_USERNAME, ConfigConstants.DATABASE_PASSWORD)))
|
||||||
{
|
{
|
||||||
|
@ -2469,7 +2469,7 @@ namespace FFXIVClassic_Map_Server
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
List<uint> list = new List<uint>() { id };
|
List<ushort> list = new List<ushort>() { id };
|
||||||
battleCommandIdByLevel.Add(tuple, list);
|
battleCommandIdByLevel.Add(tuple, list);
|
||||||
}
|
}
|
||||||
count++;
|
count++;
|
||||||
|
|
|
@ -33,7 +33,7 @@ namespace FFXIVClassic_Map_Server
|
||||||
private Dictionary<ulong, Party> currentPlayerParties = new Dictionary<ulong, Party>(); //GroupId, Party object
|
private Dictionary<ulong, Party> currentPlayerParties = new Dictionary<ulong, Party>(); //GroupId, Party object
|
||||||
private Dictionary<uint, StatusEffect> statusEffectList = new Dictionary<uint, StatusEffect>();
|
private Dictionary<uint, StatusEffect> statusEffectList = new Dictionary<uint, StatusEffect>();
|
||||||
private Dictionary<ushort, BattleCommand> battleCommandList = new Dictionary<ushort, BattleCommand>();
|
private Dictionary<ushort, BattleCommand> battleCommandList = new Dictionary<ushort, BattleCommand>();
|
||||||
private Dictionary<Tuple<byte, short>, List<uint>> battleCommandIdByLevel = new Dictionary<Tuple<byte, short>, List<uint>>();//Holds battle command ids keyed by class id and level (in that order)
|
private Dictionary<Tuple<byte, short>, List<ushort>> battleCommandIdByLevel = new Dictionary<Tuple<byte, short>, List<ushort>>();//Holds battle command ids keyed by class id and level (in that order)
|
||||||
private Dictionary<ushort, BattleTrait> battleTraitList = new Dictionary<ushort, BattleTrait>();
|
private Dictionary<ushort, BattleTrait> battleTraitList = new Dictionary<ushort, BattleTrait>();
|
||||||
private Dictionary<byte, List<ushort>> battleTraitIdsForClass = new Dictionary<byte, List<ushort>>();
|
private Dictionary<byte, List<ushort>> battleTraitIdsForClass = new Dictionary<byte, List<ushort>>();
|
||||||
private Dictionary<uint, ModifierList> battleNpcGenusMods = new Dictionary<uint, ModifierList>();
|
private Dictionary<uint, ModifierList> battleNpcGenusMods = new Dictionary<uint, ModifierList>();
|
||||||
|
@ -1967,10 +1967,10 @@ namespace FFXIVClassic_Map_Server
|
||||||
return battleCommandList.TryGetValue((ushort)id, out battleCommand) ? battleCommand.Clone() : null;
|
return battleCommandList.TryGetValue((ushort)id, out battleCommand) ? battleCommand.Clone() : null;
|
||||||
}
|
}
|
||||||
|
|
||||||
public List<uint> GetBattleCommandIdByLevel(byte classId, short level)
|
public List<ushort> GetBattleCommandIdByLevel(byte classId, short level)
|
||||||
{
|
{
|
||||||
List<uint> ids;
|
List<ushort> ids;
|
||||||
return battleCommandIdByLevel.TryGetValue(Tuple.Create(classId, level), out ids) ? ids : new List<uint>();
|
return battleCommandIdByLevel.TryGetValue(Tuple.Create(classId, level), out ids) ? ids : new List<ushort>();
|
||||||
}
|
}
|
||||||
|
|
||||||
public BattleTrait GetBattleTrait(ushort id)
|
public BattleTrait GetBattleTrait(ushort id)
|
||||||
|
|
|
@ -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);
|
||||||
|
@ -2060,7 +2063,7 @@ namespace FFXIVClassic_Map_Server.Actors
|
||||||
public void EquipAbility(byte classId, uint commandId, ushort hotbarSlot, bool printMessage = true)
|
public void EquipAbility(byte classId, uint commandId, ushort hotbarSlot, bool printMessage = true)
|
||||||
{
|
{
|
||||||
var ability = Server.GetWorldManager().GetBattleCommand(commandId);
|
var ability = Server.GetWorldManager().GetBattleCommand(commandId);
|
||||||
uint trueCommandId = 0xA0F00000 + commandId;
|
uint trueCommandId = 0xA0F00000 | commandId;
|
||||||
ushort lowHotbarSlot = (ushort)(hotbarSlot - charaWork.commandBorder);
|
ushort lowHotbarSlot = (ushort)(hotbarSlot - charaWork.commandBorder);
|
||||||
ushort maxRecastTime = (ushort)(ability != null ? ability.maxRecastTimeSeconds : 5);
|
ushort maxRecastTime = (ushort)(ability != null ? ability.maxRecastTimeSeconds : 5);
|
||||||
uint recastEnd = Utils.UnixTimeStampUTC() + maxRecastTime;
|
uint recastEnd = Utils.UnixTimeStampUTC() + maxRecastTime;
|
||||||
|
@ -2441,7 +2444,7 @@ namespace FFXIVClassic_Map_Server.Actors
|
||||||
while (exp >= diff && GetLevel() < charaWork.battleSave.skillLevelCap[classId])
|
while (exp >= diff && GetLevel() < charaWork.battleSave.skillLevelCap[classId])
|
||||||
{
|
{
|
||||||
//Level up
|
//Level up
|
||||||
LevelUp(classId);
|
LevelUp(classId, actionList);
|
||||||
leveled = true;
|
leveled = true;
|
||||||
//Reduce exp based on how much exp is needed to level
|
//Reduce exp based on how much exp is needed to level
|
||||||
exp -= diff;
|
exp -= diff;
|
||||||
|
@ -2453,14 +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());
|
|
||||||
//play levelup animation (do this outside LevelUp so that it only plays once if multiple levels are earned
|
|
||||||
//also i dunno how to do this
|
|
||||||
|
|
||||||
Database.SetLevel(this, classId, GetLevel());
|
Database.SetLevel(this, classId, GetLevel());
|
||||||
Database.SavePlayerCurrentClass(this);
|
Database.SavePlayerCurrentClass(this);
|
||||||
|
@ -2477,22 +2476,12 @@ namespace FFXIVClassic_Map_Server.Actors
|
||||||
return actionList;
|
return actionList;
|
||||||
}
|
}
|
||||||
|
|
||||||
//Increaess level of current class and equips new abilities earned at that level
|
//Equips any abilities for the given classId at the given level. If actionList is not null, adds a "You learn Command" message
|
||||||
public void LevelUp(byte classId, List<CommandResult> actionList = null)
|
private void EquipAbilitiesAtLevel(byte classId, short level, List<CommandResult> actionList = null)
|
||||||
{
|
{
|
||||||
if (charaWork.battleSave.skillLevel[classId - 1] < charaWork.battleSave.skillLevelCap[classId])
|
|
||||||
{
|
|
||||||
//Increase level
|
|
||||||
charaWork.battleSave.skillLevel[classId - 1]++;
|
|
||||||
charaWork.parameterSave.state_mainSkillLevel++;
|
|
||||||
|
|
||||||
//33909: You gain level [level]
|
|
||||||
if (actionList != null)
|
|
||||||
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.
|
//If there's any abilites that unlocks at this level, equip them.
|
||||||
List<uint> commandIds = Server.GetWorldManager().GetBattleCommandIdByLevel(classId, GetLevel());
|
List<ushort> commandIds = Server.GetWorldManager().GetBattleCommandIdByLevel(classId, GetLevel());
|
||||||
foreach(uint commandId in commandIds)
|
foreach (ushort commandId in commandIds)
|
||||||
{
|
{
|
||||||
EquipAbilityInFirstOpenSlot(classId, commandId, false);
|
EquipAbilityInFirstOpenSlot(classId, commandId, false);
|
||||||
byte jobId = ConvertClassIdToJobId(classId);
|
byte jobId = ConvertClassIdToJobId(classId);
|
||||||
|
@ -2503,10 +2492,26 @@ namespace FFXIVClassic_Map_Server.Actors
|
||||||
if (actionList != null)
|
if (actionList != null)
|
||||||
{
|
{
|
||||||
if (classId == GetCurrentClassOrJob() || jobId == GetCurrentClassOrJob())
|
if (classId == GetCurrentClassOrJob() || jobId == GetCurrentClassOrJob())
|
||||||
actionList.Add(new CommandResult(actorId, 33926, commandId));
|
actionList.Add(new CommandResult(actorId, 33926, 0, commandId));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//Increaess level of current class and equips new abilities earned at that level
|
||||||
|
public void LevelUp(byte classId, List<CommandResult> actionList = null)
|
||||||
|
{
|
||||||
|
if (charaWork.battleSave.skillLevel[classId - 1] < charaWork.battleSave.skillLevelCap[classId])
|
||||||
|
{
|
||||||
|
//Increase level
|
||||||
|
charaWork.battleSave.skillLevel[classId - 1]++;
|
||||||
|
charaWork.parameterSave.state_mainSkillLevel++;
|
||||||
|
|
||||||
|
//33909: You attain level [level].
|
||||||
|
if (actionList != null)
|
||||||
|
actionList.Add(new CommandResult(actorId, 33909, 0, (ushort)charaWork.battleSave.skillLevel[classId - 1]));
|
||||||
|
|
||||||
|
EquipAbilitiesAtLevel(classId, GetLevel(), actionList);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public static byte ConvertClassIdToJobId(byte classId)
|
public static byte ConvertClassIdToJobId(byte classId)
|
||||||
|
|
Loading…
Add table
Reference in a new issue