mirror of
https://github.com/Znote/ZnoteAAC.git
synced 2025-04-30 11:19:22 +02:00
LUA - More stable shopsystem
When working with custom types.
This commit is contained in:
parent
0c64adb55e
commit
0eb2972e30
@ -1,4 +1,4 @@
|
|||||||
-- Znote Shop v1.0 for Znote AAC on TFS 0.2.13+ Mystic Spirit.
|
-- Znote Shop v1.1 for Znote AAC on TFS 0.2.13+ Mystic Spirit.
|
||||||
function onSay(cid, words, param)
|
function onSay(cid, words, param)
|
||||||
local storage = 54073 -- Make sure to select non-used storage. This is used to prevent SQL load attacks.
|
local storage = 54073 -- Make sure to select non-used storage. This is used to prevent SQL load attacks.
|
||||||
local cooldown = 15 -- in seconds.
|
local cooldown = 15 -- in seconds.
|
||||||
@ -12,7 +12,9 @@ function onSay(cid, words, param)
|
|||||||
"pending premium (skip)",
|
"pending premium (skip)",
|
||||||
"pending gender change (skip)",
|
"pending gender change (skip)",
|
||||||
"pending character name change (skip)",
|
"pending character name change (skip)",
|
||||||
"Outfit and addons"
|
"Outfit and addons",
|
||||||
|
"Mounts",
|
||||||
|
"Instant house purchase"
|
||||||
}
|
}
|
||||||
print("Player: " .. getCreatureName(cid) .. " triggered !shop talkaction.")
|
print("Player: " .. getCreatureName(cid) .. " triggered !shop talkaction.")
|
||||||
-- Create the query
|
-- Create the query
|
||||||
@ -26,7 +28,12 @@ function onSay(cid, words, param)
|
|||||||
local q_type = result.getDataInt(orderQuery, "type")
|
local q_type = result.getDataInt(orderQuery, "type")
|
||||||
local q_itemid = result.getDataInt(orderQuery, "itemid")
|
local q_itemid = result.getDataInt(orderQuery, "itemid")
|
||||||
local q_count = result.getDataInt(orderQuery, "count")
|
local q_count = result.getDataInt(orderQuery, "count")
|
||||||
print("Processing type "..q_type..": ".. type_desc[q_type])
|
|
||||||
|
local description = "Unknown or custom type"
|
||||||
|
if type_desc[q_type] ~= nil then
|
||||||
|
description = type_desc[q_type]
|
||||||
|
end
|
||||||
|
print("Processing type "..q_type..": ".. description)
|
||||||
|
|
||||||
-- ORDER TYPE 1 (Regular item shop products)
|
-- ORDER TYPE 1 (Regular item shop products)
|
||||||
if q_type == 1 then
|
if q_type == 1 then
|
||||||
@ -78,8 +85,9 @@ function onSay(cid, words, param)
|
|||||||
-- Type 4 is for character name change (Coded on web)
|
-- Type 4 is for character name change (Coded on web)
|
||||||
-- Type 5 is for character outfit and addon (Already coded here)
|
-- Type 5 is for character outfit and addon (Already coded here)
|
||||||
-- Type 6 is for mounts (Not for TFS 0.2)
|
-- Type 6 is for mounts (Not for TFS 0.2)
|
||||||
-- So use type 7+ for custom stuff, like etc packages.
|
-- Type 7 is for Instant house purchase (Not for TFS 0.2)
|
||||||
-- if q_type == 7 then
|
-- So use type 8+ for custom stuff, like etc packages.
|
||||||
|
-- if q_type == 8 then
|
||||||
-- end
|
-- end
|
||||||
result.free(orderQuery)
|
result.free(orderQuery)
|
||||||
if not served then
|
if not served then
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
-- Znote Shop v1.0 for Znote AAC on TFS 0.3.6+ Crying Damson.
|
-- Znote Shop v1.1 for Znote AAC on TFS 0.3.6+ Crying Damson. [Alternative]
|
||||||
function onSay(cid, words, param)
|
function onSay(cid, words, param)
|
||||||
local storage = 54073 -- Make sure to select non-used storage. This is used to prevent SQL load attacks.
|
local storage = 54073 -- Make sure to select non-used storage. This is used to prevent SQL load attacks.
|
||||||
local cooldown = 15 -- in seconds.
|
local cooldown = 15 -- in seconds.
|
||||||
@ -13,7 +13,8 @@ function onSay(cid, words, param)
|
|||||||
"pending gender change (skip)",
|
"pending gender change (skip)",
|
||||||
"pending character name change (skip)",
|
"pending character name change (skip)",
|
||||||
"Outfit and addons",
|
"Outfit and addons",
|
||||||
"Mounts"
|
"Mounts",
|
||||||
|
"Instant house purchase"
|
||||||
}
|
}
|
||||||
print("Player: " .. getCreatureName(cid) .. " triggered !shop talkaction.")
|
print("Player: " .. getCreatureName(cid) .. " triggered !shop talkaction.")
|
||||||
-- Create the query
|
-- Create the query
|
||||||
@ -28,7 +29,12 @@ function onSay(cid, words, param)
|
|||||||
local q_type = result.getDataInt(orderQuery, "type")
|
local q_type = result.getDataInt(orderQuery, "type")
|
||||||
local q_itemid = result.getDataInt(orderQuery, "itemid")
|
local q_itemid = result.getDataInt(orderQuery, "itemid")
|
||||||
local q_count = result.getDataInt(orderQuery, "count")
|
local q_count = result.getDataInt(orderQuery, "count")
|
||||||
print("Processing type "..q_type..": ".. type_desc[q_type])
|
|
||||||
|
local description = "Unknown or custom type"
|
||||||
|
if type_desc[q_type] ~= nil then
|
||||||
|
description = type_desc[q_type]
|
||||||
|
end
|
||||||
|
print("Processing type "..q_type..": ".. description)
|
||||||
|
|
||||||
-- ORDER TYPE 1 (Regular item shop products)
|
-- ORDER TYPE 1 (Regular item shop products)
|
||||||
if q_type == 1 then
|
if q_type == 1 then
|
||||||
@ -93,8 +99,9 @@ function onSay(cid, words, param)
|
|||||||
-- Type 4 is for character name change (Coded on web)
|
-- Type 4 is for character name change (Coded on web)
|
||||||
-- Type 5 is for character outfit and addon (Already coded here)
|
-- Type 5 is for character outfit and addon (Already coded here)
|
||||||
-- Type 6 is for mounts (Already coded here)
|
-- Type 6 is for mounts (Already coded here)
|
||||||
-- So use type 7+ for custom stuff, like etc packages.
|
-- Type 7 is for Instant house purchase (Not for TFS 0.3)
|
||||||
-- if q_type == 7 then
|
-- So use type 8+ for custom stuff, like etc packages.
|
||||||
|
-- if q_type == 8 then
|
||||||
-- end
|
-- end
|
||||||
until not result.next(orderQuery)
|
until not result.next(orderQuery)
|
||||||
result.free(orderQuery)
|
result.free(orderQuery)
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
-- Znote Shop v1.0 for Znote AAC on TFS 0.3.6+ Crying Damson.
|
-- Znote Shop v1.1 for Znote AAC on TFS 0.3.6+ Crying Damson.
|
||||||
function onSay(cid, words, param)
|
function onSay(cid, words, param)
|
||||||
local storage = 54073 -- Make sure to select non-used storage. This is used to prevent SQL load attacks.
|
local storage = 54073 -- Make sure to select non-used storage. This is used to prevent SQL load attacks.
|
||||||
local cooldown = 15 -- in seconds.
|
local cooldown = 15 -- in seconds.
|
||||||
@ -13,7 +13,8 @@ function onSay(cid, words, param)
|
|||||||
"pending gender change (skip)",
|
"pending gender change (skip)",
|
||||||
"pending character name change (skip)",
|
"pending character name change (skip)",
|
||||||
"Outfit and addons",
|
"Outfit and addons",
|
||||||
"Mounts"
|
"Mounts",
|
||||||
|
"Instant house purchase"
|
||||||
}
|
}
|
||||||
print("Player: " .. getCreatureName(cid) .. " triggered !shop talkaction.")
|
print("Player: " .. getCreatureName(cid) .. " triggered !shop talkaction.")
|
||||||
-- Create the query
|
-- Create the query
|
||||||
@ -28,7 +29,13 @@ function onSay(cid, words, param)
|
|||||||
local q_type = result.getDataInt(orderQuery, "type")
|
local q_type = result.getDataInt(orderQuery, "type")
|
||||||
local q_itemid = result.getDataInt(orderQuery, "itemid")
|
local q_itemid = result.getDataInt(orderQuery, "itemid")
|
||||||
local q_count = result.getDataInt(orderQuery, "count")
|
local q_count = result.getDataInt(orderQuery, "count")
|
||||||
print("Processing type "..q_type..": ".. type_desc[q_type])
|
|
||||||
|
local description = "Unknown or custom type"
|
||||||
|
if type_desc[q_type] ~= nil then
|
||||||
|
description = type_desc[q_type]
|
||||||
|
end
|
||||||
|
print("Processing type "..q_type..": ".. description)
|
||||||
|
|
||||||
-- ORDER TYPE 1 (Regular item shop products)
|
-- ORDER TYPE 1 (Regular item shop products)
|
||||||
if q_type == 1 then
|
if q_type == 1 then
|
||||||
served = true
|
served = true
|
||||||
@ -101,8 +108,9 @@ function onSay(cid, words, param)
|
|||||||
-- Type 4 is for character name change (Coded on web)
|
-- Type 4 is for character name change (Coded on web)
|
||||||
-- Type 5 is for character outfit and addon (Already coded here)
|
-- Type 5 is for character outfit and addon (Already coded here)
|
||||||
-- Type 6 is for mounts (Already coded here)
|
-- Type 6 is for mounts (Already coded here)
|
||||||
-- So use type 7+ for custom stuff, like etc packages.
|
-- Type 7 is for Instant house purchase (Not for TFS 0.3)
|
||||||
-- if q_type == 7 then
|
-- So use type 8+ for custom stuff, like etc packages.
|
||||||
|
-- if q_type == 8 then
|
||||||
-- end
|
-- end
|
||||||
until not result.next(orderQuery)
|
until not result.next(orderQuery)
|
||||||
result.free(orderQuery)
|
result.free(orderQuery)
|
||||||
|
@ -1,3 +1,4 @@
|
|||||||
|
-- Znote Auto Shop v2.1 for Znote AAC on TFS 1.2+
|
||||||
function onThink(interval, lastExecution)
|
function onThink(interval, lastExecution)
|
||||||
local orderQuery = db.storeQuery([[
|
local orderQuery = db.storeQuery([[
|
||||||
SELECT
|
SELECT
|
||||||
@ -35,7 +36,14 @@ function onThink(interval, lastExecution)
|
|||||||
|
|
||||||
local player = Player(player_id)
|
local player = Player(player_id)
|
||||||
if player ~= nil then
|
if player ~= nil then
|
||||||
print("Processing shop order for: [".. player:getName() .."] type "..orderType..": ".. type_desc[orderType])
|
|
||||||
|
local description = "Unknown or custom type"
|
||||||
|
if type_desc[orderType] ~= nil then
|
||||||
|
description = type_desc[orderType]
|
||||||
|
end
|
||||||
|
print("Processing type "..orderType..": ".. description)
|
||||||
|
print("Processing shop order for: [".. player:getName() .."] type "..orderType..": ".. description)
|
||||||
|
|
||||||
local tile = Tile(player:getPosition())
|
local tile = Tile(player:getPosition())
|
||||||
if tile ~= nil and tile:hasFlag(TILESTATE_PROTECTIONZONE) then
|
if tile ~= nil and tile:hasFlag(TILESTATE_PROTECTIONZONE) then
|
||||||
-- ORDER TYPE 1 (Regular item shop products)
|
-- ORDER TYPE 1 (Regular item shop products)
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
-- Znote Shop v1.0 for Znote AAC on TFS 1.1
|
-- Znote Shop v1.1 for Znote AAC on TFS 1.2+
|
||||||
function onSay(player, words, param)
|
function onSay(player, words, param)
|
||||||
local storage = 54073 -- Make sure to select non-used storage. This is used to prevent SQL load attacks.
|
local storage = 54073 -- Make sure to select non-used storage. This is used to prevent SQL load attacks.
|
||||||
local cooldown = 15 -- in seconds.
|
local cooldown = 15 -- in seconds.
|
||||||
@ -29,7 +29,11 @@ function onSay(player, words, param)
|
|||||||
local q_itemid = result.getNumber(orderQuery, "itemid")
|
local q_itemid = result.getNumber(orderQuery, "itemid")
|
||||||
local q_count = result.getNumber(orderQuery, "count")
|
local q_count = result.getNumber(orderQuery, "count")
|
||||||
|
|
||||||
print("Processing type "..q_type..": ".. type_desc[q_type])
|
local description = "Unknown or custom type"
|
||||||
|
if type_desc[q_type] ~= nil then
|
||||||
|
description = type_desc[q_type]
|
||||||
|
end
|
||||||
|
print("Processing type "..q_type..": ".. description)
|
||||||
|
|
||||||
-- ORDER TYPE 1 (Regular item shop products)
|
-- ORDER TYPE 1 (Regular item shop products)
|
||||||
if q_type == 1 then
|
if q_type == 1 then
|
||||||
@ -110,8 +114,9 @@ function onSay(player, words, param)
|
|||||||
-- Type 4 is for character name change (Coded on web)
|
-- Type 4 is for character name change (Coded on web)
|
||||||
-- Type 5 is for character outfit and addon (Already coded here)
|
-- Type 5 is for character outfit and addon (Already coded here)
|
||||||
-- Type 6 is for mounts (Already coded here)
|
-- Type 6 is for mounts (Already coded here)
|
||||||
-- So use type 7+ for custom stuff, like etc packages.
|
-- Type 7 is for Instant house purchase (Already coded here)
|
||||||
-- if q_type == 7 then
|
-- So use type 8+ for custom stuff, like etc packages.
|
||||||
|
-- if q_type == 8 then
|
||||||
-- end
|
-- end
|
||||||
until not result.next(orderQuery)
|
until not result.next(orderQuery)
|
||||||
result.free(orderQuery)
|
result.free(orderQuery)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user