Amiibo drops: Difference between revisions

imported>Leoetlino
imported>Leoetlino
Line 21: Line 21:
|}
|}


== Notes on AmiiboMgr ==
== amiibo registering ==
amiibo code call [[AmiiboMgr]]::registerAmiibo{{un}}<ref>0x710064B564 on Switch 1.5.0</ref> every time an amiibo is used.
amiibo are registered<ref>0x710064B564 on Switch 1.5.0</ref> every time an amiibo is used.
* [[AIDef:Action/CreateEpona]] calls it after Epona has been spawned.
* [[AIDef:Action/CreateEpona]] does so after Epona has been spawned.
* [[AIDef:AI/WolfLinkAmiibo]] too, after spawning Wolf Link.
* [[AIDef:AI/WolfLinkAmiibo]] does it after spawning Wolf Link.
* [[AIDef:Action/ItemAmiiboSelectDropTable]] registers an amiibo as soon as it is scanned.
* [[AIDef:Action/ItemAmiiboSelectDropTable]] registers an amiibo as soon as it is scanned, even before spawning the drops.


=== registerAmiibo ===
Whenever an amiibo is registered:
*First, AmiiboMgr determines if it should reset its daily amiibo use history (stored in the AmiiboTouchHistory flag)<ref>0x710064B3C8</ref>.
*AmiiboMgr determines if it should reset its daily amiibo use history (stored in the AmiiboTouchHistory flag)<ref>0x710064B3C8</ref>.
**If less than 86400 seconds (1 day) have elapsed since the game was launched, don't do anything.{{check}}
**If less than 86400 seconds (1 day) have elapsed since the game was launched, don't do anything.{{check}}
**AmiiboMgr then computes <code>10000 * now.year + 100 * now.month + now.day</code>. If the value is different from AmiiboLastTouchDate (which would mean that a day has elapsed), the AmiiboTouchHistory array is cleared.
**AmiiboMgr then computes <code>10000 * now.year + 100 * now.month + now.day</code>. If the value is different from AmiiboLastTouchDate (which would mean that a day has elapsed), the AmiiboTouchHistory array is cleared.
*The amiibo UID is inserted into AmiiboTouchHistory. Only the last 100 entries are kept.
*The amiibo UID is inserted into AmiiboTouchHistory. Only the last 100 entries are kept.
*It is also inserted into AmiiboTouchHistoryTotal. Only the last 200 entries are kept.
*It is also inserted into AmiiboTouchHistoryTotal. Only the last 200 entries are kept.
*Finally, AmiiboLastTouchDate is set to <code>10000 * now.year + 100 * now.month + now.day</code>.
*Finally, AmiiboLastTouchDate is set to <code>10000 * now.year + 100 * now.month + now.day</code> to update the last amiibo usage date.


== Logic<ref>[[AIDef:Action/ItemAmiiboCreateFromDropTable]]</ref> ==
== Logic<ref>[[AIDef:Action/ItemAmiiboCreateFromDropTable]]</ref> ==
Anonymous user