--[[
MAPMARK_TICK = 0,
MAPMARK_QUESTION = 1,
MAPMARK_EXCLAMATION = 2,
MAPMARK_STAR = 3,
MAPMARK_CROSS = 4,
MAPMARK_TEMPLE = 5,
MAPMARK_KISS = 6,
MAPMARK_SHOVEL = 7,
MAPMARK_SWORD = 8,
MAPMARK_FLAG = 9,
MAPMARK_LOCK = 10,
MAPMARK_BAG = 11,
MAPMARK_SKULL = 12,
MAPMARK_DOLLAR = 13,
MAPMARK_REDNORTH = 14,
MAPMARK_REDSOUTH = 15,
MAPMARK_REDEAST = 16,
MAPMARK_REDWEST = 17,
MAPMARK_GREENNORTH = 18,
MAPMARK_GREENSOUTH = 19,
]]
local mapMarks = {
[6578] = {
{
position = Position(1030, 1030, 7),
type = MAPMARK_TEMPLE,
text = "Temple"
},
{
position = Position(1040, 1040, 7),
type = MAPMARK_SHOVEL,
text = "Hunts"
},
premium = false,
storage = PlayerStorageKeys.markstorageone
},
[9941] = {
{
position = Position(1050, 1050, 7),
type = MAPMARK_FLAG,
text = "Depot"
},
{
position = Position(1060, 1060, 7),
type = MAPMARK_BAG,
text = "Quests"
},
premium = true,
storage = PlayerStorageKeys.markstoragetwo
}
}
local mapMark = Action()
function mapMark.onUse(player, item, fromPosition, target, toPosition, isHotkey)
local minimapItems = mapMarks[item.itemid]
local playerPosition = player:getPosition()
if not player:isPremium() and minimapItems.premium then
player:sendCancelMessage("You need a premium account.")
return true
end
if player:getStorageValue(minimapItems.storage) == 1 then -- optional to avoid players using the same item once more.
player:sendCancelMessage("You have already marked this position.")
return true
end
for _, minimapItem in ipairs(minimapItems) do
player:addMapMark(minimapItem.position, minimapItem.type, minimapItem.text)
end
player:setStorageValue(minimapItems.storage, 1)
playerPosition:sendMagicEffect(CONST_ME_MAGIC_BLUE)
player:sendTextMessage(MESSAGE_EVENT_ADVANCE, "You have explored and marked new maps!")
item:remove(1)
return true
end
for id, _ in pairs(mapMarks) do
mapMark:id(id)
end
mapMark:register()