-
-
Notifications
You must be signed in to change notification settings - Fork 647
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: coryms black market monster and npcs (#1991)
Thanks @Gtravisani for contributing the map and spawn locations. You can download the updated map from the 3.1.0 and 3.0.0 releases (and of course, any future releases).
- Loading branch information
Showing
4 changed files
with
475 additions
and
0 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 |
---|---|---|
@@ -0,0 +1,68 @@ | ||
local internalNpcName = "Larry" | ||
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 = { | ||
lookTypeEx = 24432, | ||
} | ||
|
||
npcConfig.flags = { | ||
floorchange = false, | ||
} | ||
|
||
npcConfig.voices = { | ||
interval = 15000, | ||
chance = 50, | ||
} | ||
|
||
npcConfig.shop = {} | ||
|
||
-- 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_INFO_DESCR, 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 | ||
|
||
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) | ||
|
||
npcType:register(npcConfig) |
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 |
---|---|---|
@@ -0,0 +1,74 @@ | ||
local internalNpcName = "Squeekquek" | ||
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 = 532, | ||
lookHead = 0, | ||
lookBody = 113, | ||
lookLegs = 95, | ||
lookFeet = 0, | ||
lookAddons = 0, | ||
lookMount = 0, | ||
} | ||
|
||
npcConfig.flags = { | ||
floorchange = false, | ||
} | ||
|
||
npcConfig.voices = { | ||
interval = 15000, | ||
chance = 50, | ||
} | ||
|
||
npcConfig.shop = {} | ||
|
||
-- 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_INFO_DESCR, 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 | ||
|
||
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) | ||
|
||
npcType:register(npcConfig) |
Oops, something went wrong.