1
Fork 0
mirror of https://bitbucket.org/Ioncannon/project-meteor-server.git synced 2025-04-20 11:47:48 +00:00

Removed old EquipAbility function from player.cs

This commit is contained in:
yogurt 2017-09-27 18:12:02 -05:00
parent 33f8709d76
commit ab98f3662f

View file

@ -1927,80 +1927,6 @@ namespace FFXIVClassic_Map_Server.Actors
UpdateHotbar(slotsToUpdate); UpdateHotbar(slotsToUpdate);
} }
public void EquipAbility(ushort hotbarSlot, uint commandId)
{
var ability = Server.GetWorldManager().GetBattleCommand(commandId);
uint trueCommandId = commandId | 0xA0F00000;
ushort trueHotbarSlot = (ushort)(hotbarSlot + charaWork.commandBorder - 1);
ushort endOfHotbar = (ushort)(charaWork.commandBorder + 30);
List<ushort> slotsToUpdate = new List<ushort>();
bool canEquip = true;
//If the ability is already equipped we need this so we can move its recast timer to the new slot
uint oldRecast = 0;
//Check if the command is already on the hotbar
ushort oldSlot = FindFirstCommandSlotById(trueCommandId);
bool isAlreadyEquipped = oldSlot < endOfHotbar;
//New ability being added to the hotbar, set truehotbarslot to the first open slot.
if (hotbarSlot == 0)
{
//If the ability is already equipped, we can't add it to the hotbar again.
if (isAlreadyEquipped)
canEquip = false;
else
trueHotbarSlot = FindFirstCommandSlotById(0);
}
//If the slot we're moving an command to already has an command there, move that command to the new command's old slot.
//Only need to do this if the new command is already equipped, otherwise we just write over the command there
else if (charaWork.command[trueHotbarSlot] != trueCommandId && isAlreadyEquipped)
{
//Move the command to oldslot
charaWork.command[oldSlot] = charaWork.command[trueHotbarSlot];
//Move recast timers to old slot as well and store the old recast timer
oldRecast = charaWork.parameterSave.commandSlot_recastTime[oldSlot - charaWork.commandBorder];
charaWork.parameterTemp.maxCommandRecastTime[oldSlot - charaWork.commandBorder] = charaWork.parameterTemp.maxCommandRecastTime[trueHotbarSlot - charaWork.commandBorder];
charaWork.parameterSave.commandSlot_recastTime[oldSlot - charaWork.commandBorder] = charaWork.parameterSave.commandSlot_recastTime[trueHotbarSlot - charaWork.commandBorder];
//Save changes
Database.EquipAbility(this, charaWork.parameterSave.state_mainSkill[0], (ushort)(oldSlot - charaWork.commandBorder), charaWork.command[oldSlot], charaWork.parameterSave.commandSlot_recastTime[oldSlot - charaWork.commandBorder]);
slotsToUpdate.Add(oldSlot);
}
if (canEquip)
{
charaWork.command[trueHotbarSlot] = trueCommandId;
charaWork.commandCategory[trueHotbarSlot] = 1;
//Set recast time. If the ability was already equipped, then we use the previous recast timer instead of setting a new one
ushort maxRecastTime = (ushort)ability.recastTimeSeconds;
uint recastEnd = isAlreadyEquipped ? oldRecast : Utils.UnixTimeStampUTC() + maxRecastTime;
charaWork.parameterTemp.maxCommandRecastTime[trueHotbarSlot - charaWork.commandBorder] = maxRecastTime;
charaWork.parameterSave.commandSlot_recastTime[trueHotbarSlot - charaWork.commandBorder] = recastEnd;
slotsToUpdate.Add(trueHotbarSlot);
Database.EquipAbility(this, charaWork.parameterSave.state_mainSkill[0], (ushort) (trueHotbarSlot - charaWork.commandBorder), trueCommandId, recastEnd);
//"[Command] set."
if (!isAlreadyEquipped)
SendGameMessage(Server.GetWorldManager().GetActor(), 30603, 0x20, 0, commandId ^ 0xA0F00000);
}
//Ability is already equipped
else if (isAlreadyEquipped)
{
//"That action is already set to an action slot."
SendGameMessage(Server.GetWorldManager().GetActor(), 30719, 0x20, 0);
}
//Hotbar full
else
{
//"You cannot set any more actions."
SendGameMessage(Server.GetWorldManager().GetActor(), 30720, 0x20, 0);
}
UpdateHotbar(slotsToUpdate);
}
public void UnequipAbility(ushort hotbarSlot, bool printMessage = true) public void UnequipAbility(ushort hotbarSlot, bool printMessage = true)
{ {
List<ushort> slotsToUpdate = new List<ushort>(); List<ushort> slotsToUpdate = new List<ushort>();