diff --git a/FFXIVClassic Map Server/actors/chara/player/Player.cs b/FFXIVClassic Map Server/actors/chara/player/Player.cs index 2c139abd..8876c08f 100644 --- a/FFXIVClassic Map Server/actors/chara/player/Player.cs +++ b/FFXIVClassic Map Server/actors/chara/player/Player.cs @@ -1927,80 +1927,6 @@ namespace FFXIVClassic_Map_Server.Actors 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 slotsToUpdate = new List(); - 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) { List slotsToUpdate = new List();