add more handle protocol
This commit is contained in:
@@ -1817,9 +1817,9 @@ namespace BrewMonster
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Cycles through learned skills by removing all shortcuts and adding 2 new skills to slots 0 and 1.
|
||||
/// If m_startingSkillID is set (>0), uses that specific skill ID and the next one (ID+1).
|
||||
/// Otherwise, cycles through all learned skills in pairs.
|
||||
/// Cycles through learned skills by removing all shortcuts and adding 8 new skills to slots 0-7.
|
||||
/// If m_startingSkillID is set (>0), uses that specific skill ID and the next 7 (ID+1 to ID+7).
|
||||
/// Otherwise, cycles through all learned skills in groups of 8.
|
||||
/// </summary>
|
||||
public void CycleSkillShortcuts()
|
||||
{
|
||||
@@ -1833,74 +1833,51 @@ namespace BrewMonster
|
||||
|
||||
// Remove all shortcuts
|
||||
pSCS.RemoveAllShortcuts();
|
||||
const int skillsPerCycle = 8;
|
||||
|
||||
// If starting skill ID is configured, cycle through pairs starting from that ID
|
||||
// If starting skill ID is configured, cycle through groups of 8 starting from that ID
|
||||
if (m_startingSkillID > 0)
|
||||
{
|
||||
// Calculate the current skill IDs based on cycle index
|
||||
// First press: startingID + 0, startingID + 1 (e.g., 5, 6)
|
||||
// Second press: startingID + 2, startingID + 3 (e.g., 7, 8)
|
||||
// Third press: startingID + 4, startingID + 5 (e.g., 9, 10)
|
||||
int currentSkillID1 = m_startingSkillID + (m_currentSkillCycleIndex * 2);
|
||||
int currentSkillID2 = currentSkillID1 + 1;
|
||||
BMLogger.LogError($"CycleSkillShortcuts: Trying to add skills {currentSkillID1} and {currentSkillID2}");
|
||||
// First press: startingID + 0 to startingID + 7 (e.g., 5-12)
|
||||
// Second press: startingID + 8 to startingID + 15 (e.g., 13-20)
|
||||
// Third press: startingID + 16 to startingID + 23 (e.g., 21-28)
|
||||
int baseSkillID = m_startingSkillID + (m_currentSkillCycleIndex * skillsPerCycle);
|
||||
BMLogger.LogError($"CycleSkillShortcuts: Trying to add skills {baseSkillID} to {baseSkillID + skillsPerCycle - 1}");
|
||||
|
||||
CECSkill pSkill1 = GetPositiveSkillByID(currentSkillID1);
|
||||
if (pSkill1 != null)
|
||||
// Add 8 skills to slots 0-7
|
||||
for (int slot = 0; slot < skillsPerCycle; slot++)
|
||||
{
|
||||
pSCS.CreateSkillShortcut(0, pSkill1);
|
||||
Debug.LogError($"CycleSkillShortcuts: Added skill ID {currentSkillID1} to slot 0");
|
||||
}
|
||||
else
|
||||
{
|
||||
Debug.LogError($"CycleSkillShortcuts: Skill with ID {currentSkillID1} not found in learned skills");
|
||||
int find = 1;
|
||||
while (pSkill1 == null && find < 100)
|
||||
int currentSkillID = baseSkillID + slot;
|
||||
CECSkill pSkill = GetPositiveSkillByID(currentSkillID);
|
||||
|
||||
if (pSkill != null)
|
||||
{
|
||||
m_startingSkillID++;
|
||||
Debug.LogError($"CycleSkillShortcuts: m_startingSkillID {m_startingSkillID} ");
|
||||
currentSkillID1 = m_startingSkillID + (m_currentSkillCycleIndex * 2);
|
||||
pSkill1 = GetPositiveSkillByID(currentSkillID1);
|
||||
find++;
|
||||
}
|
||||
|
||||
if (pSkill1 != null)
|
||||
{
|
||||
pSCS.CreateSkillShortcut(0, pSkill1);
|
||||
pSCS.CreateSkillShortcut(slot, pSkill);
|
||||
Debug.LogError($"CycleSkillShortcuts: Added skill ID {currentSkillID} to slot {slot}");
|
||||
}
|
||||
else
|
||||
{
|
||||
Debug.LogError($"CycleSkillShortcuts: Failed to find skill after {find} attempts");
|
||||
}
|
||||
}
|
||||
Debug.LogError($"CycleSkillShortcuts: Skill with ID {currentSkillID} not found in learned skills");
|
||||
// Try to find a valid skill by incrementing starting ID
|
||||
int find = 1;
|
||||
while (pSkill == null && find < 100)
|
||||
{
|
||||
m_startingSkillID++;
|
||||
Debug.LogError($"CycleSkillShortcuts: m_startingSkillID {m_startingSkillID}");
|
||||
currentSkillID = m_startingSkillID + (m_currentSkillCycleIndex * skillsPerCycle) + slot;
|
||||
pSkill = GetPositiveSkillByID(currentSkillID);
|
||||
find++;
|
||||
}
|
||||
|
||||
// Find and add second skill
|
||||
CECSkill pSkill2 = GetPositiveSkillByID(currentSkillID2);
|
||||
if (pSkill2 != null)
|
||||
{
|
||||
pSCS.CreateSkillShortcut(1, pSkill2);
|
||||
Debug.LogError($"CycleSkillShortcuts: Added skill ID {currentSkillID2} to slot 1");
|
||||
}
|
||||
else
|
||||
{
|
||||
Debug.LogError($"CycleSkillShortcuts: Skill with ID {currentSkillID2} not found in learned skills");
|
||||
int find = 1;
|
||||
while (pSkill2 == null && find < 100)
|
||||
{
|
||||
m_startingSkillID++;
|
||||
Debug.LogError($"CycleSkillShortcuts: m_startingSkillID {m_startingSkillID} ");
|
||||
currentSkillID2 = m_startingSkillID + (m_currentSkillCycleIndex * 2) + 1;
|
||||
pSkill2 = GetPositiveSkillByID(currentSkillID2);
|
||||
find++;
|
||||
}
|
||||
|
||||
if (pSkill2 != null)
|
||||
{
|
||||
pSCS.CreateSkillShortcut(1, pSkill2);
|
||||
}
|
||||
else
|
||||
{
|
||||
Debug.LogError($"CycleSkillShortcuts: Failed to find skill after {find} attempts");
|
||||
if (pSkill != null)
|
||||
{
|
||||
pSCS.CreateSkillShortcut(slot, pSkill);
|
||||
}
|
||||
else
|
||||
{
|
||||
Debug.LogError($"CycleSkillShortcuts: Failed to find skill for slot {slot} after {find} attempts");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1926,36 +1903,29 @@ namespace BrewMonster
|
||||
return;
|
||||
}
|
||||
|
||||
// Calculate how many pairs we can make
|
||||
int maxPairs = (skillCount + 1) / 2; // Round up division
|
||||
// Calculate how many groups of 8 we can make
|
||||
int maxGroups = (skillCount + skillsPerCycle - 1) / skillsPerCycle; // Round up division
|
||||
|
||||
// Wrap around if we've reached the end
|
||||
if (m_currentSkillCycleIndex >= maxPairs)
|
||||
if (m_currentSkillCycleIndex >= maxGroups)
|
||||
{
|
||||
m_currentSkillCycleIndex = 0;
|
||||
}
|
||||
|
||||
// Calculate skill indices for this cycle
|
||||
int skillIndex1 = m_currentSkillCycleIndex * 2;
|
||||
int skillIndex2 = skillIndex1 + 1;
|
||||
int baseSkillIndex = m_currentSkillCycleIndex * skillsPerCycle;
|
||||
|
||||
// Add first skill to slot 0
|
||||
if (skillIndex1 < skillCount)
|
||||
// Add up to 8 skills to slots 0-7
|
||||
for (int slot = 0; slot < skillsPerCycle; slot++)
|
||||
{
|
||||
CECSkill pSkill1 = GetPositiveSkillByIndex(skillIndex1);
|
||||
if (pSkill1 != null)
|
||||
int skillIndex = baseSkillIndex + slot;
|
||||
if (skillIndex < skillCount)
|
||||
{
|
||||
pSCS.CreateSkillShortcut(0, pSkill1);
|
||||
}
|
||||
}
|
||||
|
||||
// Add second skill to slot 1 (if available)
|
||||
if (skillIndex2 < skillCount)
|
||||
{
|
||||
CECSkill pSkill2 = GetPositiveSkillByIndex(skillIndex2);
|
||||
if (pSkill2 != null)
|
||||
{
|
||||
pSCS.CreateSkillShortcut(1, pSkill2);
|
||||
CECSkill pSkill = GetPositiveSkillByIndex(skillIndex);
|
||||
if (pSkill != null)
|
||||
{
|
||||
pSCS.CreateSkillShortcut(slot, pSkill);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user