forked from opentibiabr/canary
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'dudantas/feat-soul-war-quest' of https://github.com/s2l…
…eandro155/rzyns into dudantas/feat-soul-war-quest
- Loading branch information
Showing
1 changed file
with
0 additions
and
87 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,87 +0,0 @@ | ||
local internalNpcName = "The Lootmonger" | ||
local npcType = Game.createNpcType(internalNpcName) | ||
local npcConfig = {} | ||
|
||
npcConfig.name = internalNpcName | ||
npcConfig.description = internalNpcName | ||
|
||
npcConfig.health = 100 | ||
npcConfig.maxHealth = npcConfig.health | ||
npcConfig.walkInterval = 2000 | ||
npcConfig.walkRadius = 2 | ||
|
||
npcConfig.outfit = { | ||
lookType = 1575, | ||
lookHead = 96, | ||
lookBody = 101, | ||
lookLegs = 120, | ||
lookFeet = 120, | ||
lookAddons = 2, | ||
} | ||
|
||
npcConfig.flags = { | ||
floorchange = false, | ||
} | ||
|
||
local keywordHandler = KeywordHandler:new() | ||
local npcHandler = NpcHandler:new(keywordHandler) | ||
|
||
npcType.onThink = function(npc, interval) | ||
npcHandler:onThink(npc, interval) | ||
end | ||
|
||
npcType.onAppear = function(npc, creature) | ||
npcHandler:onAppear(npc, creature) | ||
end | ||
|
||
npcType.onDisappear = function(npc, creature) | ||
npcHandler:onDisappear(npc, creature) | ||
end | ||
|
||
npcType.onMove = function(npc, creature, fromPosition, toPosition) | ||
npcHandler:onMove(npc, creature, fromPosition, toPosition) | ||
end | ||
|
||
npcType.onSay = function(npc, creature, type, message) | ||
npcHandler:onSay(npc, creature, type, message) | ||
end | ||
|
||
npcType.onCloseChannel = function(npc, creature) | ||
npcHandler:onCloseChannel(npc, creature) | ||
end | ||
|
||
npcHandler:addModule(FocusModule:new(), npcConfig.name, true, true, true) | ||
|
||
npcConfig.shop = LootShopConfig | ||
|
||
local function creatureSayCallback(npc, player, type, message) | ||
local formattedCategoryNames = {} | ||
for categoryName, _ in pairs(LootShopConfigTable) do | ||
table.insert(formattedCategoryNames, "{" .. categoryName .. "}") | ||
end | ||
|
||
local categoryTable = LootShopConfigTable[message:lower()] | ||
if MsgContains(message, "shop options") then | ||
npcHandler:say("I sell a selection of " .. table.concat(formattedCategoryNames, ", "), npc, player) | ||
elseif categoryTable then | ||
npcHandler:say("Here are the items for the category " .. message, npc, player) | ||
npc:openShopWindowTable(player, categoryTable) | ||
end | ||
end | ||
|
||
npcHandler:setCallback(CALLBACK_MESSAGE_DEFAULT, creatureSayCallback) | ||
npcHandler:setMessage(MESSAGE_GREET, "Ah, a customer! Be greeted, |PLAYERNAME|! I buy all kinds of loot, would you like a {trade}? I can also show you my {shop options}.") | ||
npcHandler:setMessage(MESSAGE_SENDTRADE, "Ah, a customer! Be greeted, |PLAYERNAME|! I buy all kinds of loot, would you like a {trade}? I can also show you my {shop options}.") | ||
|
||
-- On buy npc shop message | ||
npcType.onBuyItem = function(npc, player, itemId, subType, amount, ignore, inBackpacks, totalCost) | ||
npc:sellItem(player, itemId, amount, subType, 0, ignore, inBackpacks) | ||
end | ||
-- On sell npc shop message | ||
npcType.onSellItem = function(npc, player, itemId, subtype, amount, ignore, name, totalCost) | ||
player:sendTextMessage(MESSAGE_TRADE, string.format("Sold %ix %s for %i gold.", amount, name, totalCost)) | ||
end | ||
-- On check npc shop message (look item) | ||
npcType.onCheckItem = function(npc, player, clientId, subType) end | ||
|
||
npcType:register(npcConfig) | ||