Added Witch Queen's Atelier Merge - #135
Conversation
Reviewer's GuideImplements a new merge shop farming script for Witch Queen’s Atelier that integrates with core bot frameworks, configures options, and defines ingredient acquisition logic for specific shop items. Sequence diagram for Witch Queen's Atelier merge farming flowsequenceDiagram
actor User
participant WitchQueensAtelierMerge
participant CoreBots
participant CoreAdvanced
participant CoreFarms
participant IScriptInterface
User->>WitchQueensAtelierMerge: ScriptMain(IScriptInterface)
WitchQueensAtelierMerge->>CoreBots: SetOptions()
WitchQueensAtelierMerge->>CoreAdvanced: StartBuyAllMerge("birgittaspire", 2751, findIngredients, buyOnlyThis, buyMode)
CoreAdvanced-->>WitchQueensAtelierMerge: invoke findIngredients()
WitchQueensAtelierMerge->>IScriptInterface: TempInv.GetQuantity(req.Name) / Inventory.GetQuantity(req.Name)
alt [req.Name == Witch Princess' Hat]
WitchQueensAtelierMerge->>CoreBots: FarmingLogger(req.Name, quant)
WitchQueensAtelierMerge->>CoreBots: EquipClass(ClassType.Solo)
WitchQueensAtelierMerge->>CoreBots: RegisterQuests(10824)
loop until CheckInventory(req.Name, quant)
WitchQueensAtelierMerge->>CoreBots: KillMonster("birgittaspire", "r2", "Left", "Witch Queen Talia", req.Name)
CoreBots->>IScriptInterface: Wait.ForPickup(req.Name)
end
WitchQueensAtelierMerge->>CoreBots: CancelRegisteredQuests()
else [req.Name == Crystalized Darkovian Tear or Witch Princess' Astrolabe]
WitchQueensAtelierMerge->>CoreBots: FarmingLogger(req.Name, quant)
WitchQueensAtelierMerge->>CoreBots: EquipClass(ClassType.Solo)
loop until CheckInventory(req.Name, quant)
WitchQueensAtelierMerge->>CoreBots: KillMonster("birgittaspire", "r2", "Left", "Witch Queen Talia", req.Name)
CoreBots->>IScriptInterface: Wait.ForPickup(req.Name)
end
else [req.Name == Gold Voucher 100k]
WitchQueensAtelierMerge->>CoreFarms: Voucher(req.Name, quant)
else [unhandled ingredient]
WitchQueensAtelierMerge->>CoreBots: Logger("The bot hasn't been taught how to get " + req.Name)
end
WitchQueensAtelierMerge->>CoreBots: SetOptions(false)
File-Level Changes
Tips and commandsInteracting with Sourcery
Customizing Your ExperienceAccess your dashboard to:
Getting Help
|
There was a problem hiding this comment.
Hey - I've found 1 issue, and left some high level feedback:
- In
findIngredients,req.Tempandreq.Nameare accessed before the null check onreq, which can cause a null reference; move the null check immediately afterItemBase req = Adv.externalItemand before any other use ofreq. - The
currentQuantvariable infindIngredientsis computed but never used; consider removing it or using it to short‑circuit when the required quantity is already met. - The solo farming logic for "Witch Queen Talia" is duplicated across multiple cases; consider extracting this into a helper method that accepts the target item name to reduce repetition and make future maintenance easier.
Prompt for AI Agents
Please address the comments from this code review:
## Overall Comments
- In `findIngredients`, `req.Temp` and `req.Name` are accessed before the null check on `req`, which can cause a null reference; move the null check immediately after `ItemBase req = Adv.externalItem` and before any other use of `req`.
- The `currentQuant` variable in `findIngredients` is computed but never used; consider removing it or using it to short‑circuit when the required quantity is already met.
- The solo farming logic for "Witch Queen Talia" is duplicated across multiple cases; consider extracting this into a helper method that accepts the target item name to reduce repetition and make future maintenance easier.
## Individual Comments
### Comment 1
<location path="Other/MergeShops/WitchQueensAtelierMerge.cs" line_range="49-52" />
<code_context>
+ #region Dont edit this part
+ void findIngredients()
+ {
+ ItemBase req = Adv.externalItem;
+ int quant = Adv.externalQuant;
+ int currentQuant = req.Temp ? Bot.TempInv.GetQuantity(req.Name) : Bot.Inventory.GetQuantity(req.Name);
+ if (req == null)
+ {
+ Core.Logger("req is NULL");
</code_context>
<issue_to_address>
**issue (bug_risk):** Possible null dereference of `req` before the null check.
`req.Temp` is used to compute `currentQuant` before verifying `req` is non-null, so a null `Adv.externalItem` would cause a runtime exception. Move the null check before any dereference of `req`, or use a null-conditional approach to safely access its members.
</issue_to_address>Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.
| ItemBase req = Adv.externalItem; | ||
| int quant = Adv.externalQuant; | ||
| int currentQuant = req.Temp ? Bot.TempInv.GetQuantity(req.Name) : Bot.Inventory.GetQuantity(req.Name); | ||
| if (req == null) |
There was a problem hiding this comment.
issue (bug_risk): Possible null dereference of req before the null check.
req.Temp is used to compute currentQuant before verifying req is non-null, so a null Adv.externalItem would cause a runtime exception. Move the null check before any dereference of req, or use a null-conditional approach to safely access its members.
8d2e8eb to
84d5a5d
Compare
|
go to the discord, make a post at #skua-script-reports, and @tato if you want this merged. make sure you explain why and such |
Summary by Sourcery
Add an automated merge-shop farming script for Witch Queen's Atelier to obtain all items from the Birgitta Spire merge shop.
New Features:
Enhancements: