private int Foundry_MatchKeyToChest(FoundryActionTypes CurrentAction) { try { FoundryAction FA = FoundryActionList[(int)CurrentAction]; AetherObject Chest = AetherObjects.Collection[FA.ToDoList[0]]; int ChestMatchIndex = mGeneralSettings.FoundrySettings.ChestKeyMatchList.FindIndex(x => @x.ChestName == @Chest.Name); if(ChestMatchIndex < 0) { ClearFoundryAction(CurrentAction); return 0; } int KeyMatch = 0; List<string> KeyNames = mGeneralSettings.FoundrySettings.ChestKeyMatchList[ChestMatchIndex].KeyNames; for(int i = 0; i < KeyNames.Count; i++) { KeyMatch = mCurrentInventory.FindKey(@KeyNames[i]); if(KeyMatch != 0) {break;} } if(KeyMatch == 0) { if(mCurrentInventory.IntricateCarvingTool == 0) { WriteToChat("Character has no carving tool. " + CurrentAction.ToString() + " disabled."); ClearFoundryAction(CurrentAction); return 0; } int KeyRingMatchIndex = mGeneralSettings.FoundrySettings.KeyRingMatchList.FindIndex(x => mGeneralSettings.FoundrySettings.ChestKeyMatchList[ChestMatchIndex].KeyNames.Contains(@x.KeyName)); if(KeyRingMatchIndex == -1){return 0;} int RemoveKeyFromRing = mCurrentInventory.FindFilledKeyRing(@mGeneralSettings.FoundrySettings.KeyRingMatchList[KeyRingMatchIndex].RingName); if(RemoveKeyFromRing == 0) { WriteToChat("Character has no matching ringed keys. " + CurrentAction.ToString() + " disabled."); ClearFoundryAction(CurrentAction); return 0; } Foundry_LoadAction(FoundryActionTypes.CarvingTool, RemoveKeyFromRing); return 0; } return KeyMatch; }catch(Exception ex) { LogError(ex); ClearFoundryAction(CurrentAction); return 0; } }
private bool Foundry_InventoryIsFull(FoundryActionTypes CurrentAction) { try { int spacesneeded = 2; FoundryAction FA = FoundryActionList[(int)CurrentAction]; if(CurrentAction == FoundryActionTypes.SellTradeNote) { spacesneeded = (int)Math.Ceiling((double)FA.ToDoList[0]/25000d); } if(mCurrentInventory.InventorySpacesAvailable < spacesneeded) { WriteToChat("Inventory is full. " + CurrentAction.ToString() + " cleared."); ClearFoundryAction(CurrentAction); return true; } if(mCurrentInventory.MainPackSpacesAvailable < spacesneeded) { if(mGeneralSettings.FoundrySettings.AutoStack && mCurrentInventory.StackForSpace) { foreach(AetherObject ao in AetherObjects.GetUnstackedInventory()){Foundry_LoadAction(FoundryActionTypes.Stack, ao.Id);} return false; } else if(mGeneralSettings.FoundrySettings.AutoCram && mCurrentInventory.UnfilledPacks.Count > 0){ToggleFoundryAction(FoundryActionTypes.Cram); return false;} else { WriteToChat(CurrentAction.ToString() + " disabled due to insufficent pack space."); if(!mGeneralSettings.FoundrySettings.AutoStack) { WriteToChat("AutoStack is disabled in the Foundry tab and could have improved pack management."); } if(!mGeneralSettings.FoundrySettings.AutoCram) { WriteToChat("AutoCram is disabled in the Foundry tab and could have improved pack management."); } ClearFoundryAction(CurrentAction); return true; } } return false; } catch(Exception ex) { LogError(ex); ClearFoundryAction(CurrentAction); return true; } }