mirror of
https://github.com/HarbourMasters/Shipwright
synced 2026-06-29 03:41:09 -04:00
060878fb2e
This is far and away the proudest thing I have been apart of in the Zelda community. Thank you to everyone who either directly or indirectly contributed to this effort. If I forgot to co-author you and you were involved, know that I simply forgot but still appreciated your help! Also thank you to the literal tens of thousands of people who have played Anchor, providing feedback and bug reports. Super thrilled to finally have this merged into the main Ship of Harkinian experience. Co-authored-by: mattman107 <65982675+mattman107@users.noreply.github.com> Co-authored-by: David Chavez <david@dcvz.io> Co-authored-by: MelonSpeedruns <melonspeedruns@outlook.com> Co-authored-by: aMannus <mannusmenting@gmail.com> Co-authored-by: Malkierian <malkierian@gmail.com> Co-authored-by: Caladius <Caladius@users.noreply.github.com> Co-authored-by: Patrick12115 <115201185+Patrick12115@users.noreply.github.com> Co-authored-by: PurpleHato <47987542+PurpleHato@users.noreply.github.com> Co-authored-by: balloondude2 <55861555+balloondude2@users.noreply.github.com> Co-authored-by: lilacLunatic <8488221+lilacLunatic@users.noreply.github.com> Co-authored-by: Felix Lee <flee135@users.noreply.github.com> Co-authored-by: Sirius902 <10891979+Sirius902@users.noreply.github.com>
39 lines
1.3 KiB
C++
39 lines
1.3 KiB
C++
#include "soh/Network/Anchor/Anchor.h"
|
|
#include <nlohmann/json.hpp>
|
|
#include <libultraship/libultraship.h>
|
|
#include "soh/Enhancements/game-interactor/GameInteractor.h"
|
|
#include "soh/OTRGlobals.h"
|
|
|
|
/**
|
|
* UPDATE_DUNGEON_ITEMS
|
|
*
|
|
* This is for 2 things, first is updating the dungeon items in vanilla saves, and second is
|
|
* for ensuring the amount of keys used is synced as players are using them.
|
|
*/
|
|
|
|
void Anchor::SendPacket_UpdateDungeonItems() {
|
|
if (!IsSaveLoaded() || !roomState.syncItemsAndFlags) {
|
|
return;
|
|
}
|
|
|
|
nlohmann::json payload;
|
|
payload["type"] = UPDATE_DUNGEON_ITEMS;
|
|
payload["targetTeamId"] = CVarGetString(CVAR_REMOTE_ANCHOR("TeamId"), "default");
|
|
payload["addToQueue"] = true;
|
|
payload["mapIndex"] = gSaveContext.mapIndex;
|
|
payload["dungeonItems"] = gSaveContext.inventory.dungeonItems[gSaveContext.mapIndex];
|
|
payload["dungeonKeys"] = gSaveContext.inventory.dungeonKeys[gSaveContext.mapIndex];
|
|
|
|
SendJsonToRemote(payload);
|
|
}
|
|
|
|
void Anchor::HandlePacket_UpdateDungeonItems(nlohmann::json payload) {
|
|
if (!IsSaveLoaded() || !roomState.syncItemsAndFlags) {
|
|
return;
|
|
}
|
|
|
|
u16 mapIndex = payload["mapIndex"].get<u16>();
|
|
gSaveContext.inventory.dungeonItems[mapIndex] = payload["dungeonItems"].get<u8>();
|
|
gSaveContext.inventory.dungeonKeys[mapIndex] = payload["dungeonKeys"].get<s8>();
|
|
}
|