local ____lualib = require("lualib_bundle")
local Map = ____lualib.Map
local Set = ____lualib.Set
local ____exports = {}
--- Helper function to make using maps with an index of `PtrHash` easier. Use this instead of the
-- `Map.set` method if you have a map of this type.
-- 
-- For example:
-- 
-- ```ts
-- const v = {
--   run: {
--     npcsSpeedBoost: new Map<PtrHash, int>(),
--   },
-- };
-- 
-- function incrementSpeedBoost(npc: EntityNPC) {
--   const oldSpeedBoost = mapGetNPC(v.run.npcsSpeedBoost, npc);
--   const newSpeedBoost = oldSpeedBoost + 0.1;
--   mapSetNPC(v.run.npcsSpeedBoost, npc);
-- }
-- ```
function ____exports.mapSetNPC(self, map, npc, value)
    local ptrHash = GetPtrHash(npc)
    map:set(ptrHash, value)
end
--- Helper function to make using default maps with an index of `PtrHash` easier. Use this instead of
-- the `DefaultMap.getAndSetDefault` method if you have a default map of this type.
-- 
-- For example:
-- 
-- ```ts
-- const v = {
--   run: {
--     npcsSpeedBoost: new DefaultMap<PtrHash, int>(0),
--   },
-- };
-- 
-- function npcUpdate(npc: EntityNPC) {
--   const speedBoost = defaultMapGetNPC(v.run.npcsSpeedBoost, npc);
--   // Do something with the speed boost.
-- }
-- ```
-- 
-- Note that not all NPCs should be stored in a map with a `PtrHash` as an index, so only use this
-- in the situations where that would be okay. (For example, Dark Esau should never be stored in a
-- map like this, because the scope of `PtrHash` is per room and Dark Esau is persistent between
-- rooms.)
function ____exports.defaultMapGetNPC(self, map, npc, ...)
    local ptrHash = GetPtrHash(npc)
    return map:getAndSetDefault(ptrHash, ...)
end
--- Helper function to make using maps with an index of `PtrHash` easier. Use this instead of the
-- `Map.set` method if you have a map of this type.
-- 
-- Since `Map` and `DefaultMap` set values in the same way, this function is simply an alias for the
-- `mapSetNPC` helper function.
function ____exports.defaultMapSetNPC(self, map, npc, value)
    ____exports.mapSetNPC(nil, map, npc, value)
end
--- Helper function to make using maps with an type of `PtrHash` easier. Use this instead of the
-- `Map.delete` method if you have a set of this type.
function ____exports.mapDeleteNPC(self, map, npc)
    local ptrHash = GetPtrHash(npc)
    return map:delete(ptrHash)
end
--- Helper function to make using maps with an index of `PtrHash` easier. Use this instead of the
-- `Map.get` method if you have a map of this type.
-- 
-- For example:
-- 
-- ```ts
-- const v = {
--   run: {
--     npcsSpeedBoost: new Map<PtrHash, int>(),
--   },
-- };
-- 
-- function incrementSpeedBoost(npc: EntityNPC) {
--   const oldSpeedBoost = mapGetNPC(v.run.npcsSpeedBoost, npc);
--   const newSpeedBoost = oldSpeedBoost + 0.1;
--   mapSetNPC(v.run.npcsSpeedBoost, npc);
-- }
-- ```
function ____exports.mapGetNPC(self, map, npc)
    local ptrHash = GetPtrHash(npc)
    return map:get(ptrHash)
end
--- Helper function to make using maps with an index of `PtrHash` easier. Use this instead of the
-- `Map.has` method if you have a map of this type.
function ____exports.mapHasNPC(self, map, npc)
    local ptrHash = GetPtrHash(npc)
    return map:has(ptrHash)
end
--- Helper function to make using sets with an type of `PtrHash` easier. Use this instead of the
-- `Set.add` method if you have a set of this type.
function ____exports.setAddNPC(self, set, npc)
    local ptrHash = GetPtrHash(npc)
    return set:add(ptrHash)
end
--- Helper function to make using sets with an type of `PtrHash` easier. Use this instead of the
-- `Set.delete` method if you have a set of this type.
function ____exports.setDeleteNPC(self, set, npc)
    local ptrHash = GetPtrHash(npc)
    return set:delete(ptrHash)
end
--- Helper function to make using sets with an type of `PtrHash` easier. Use this instead of the
-- `Set.has` method if you have a set of this type.
function ____exports.setHasNPC(self, set, npc)
    local ptrHash = GetPtrHash(npc)
    return set:has(ptrHash)
end
return ____exports
