mirror of
https://github.com/Znote/ZnoteAAC.git
synced 2025-04-29 18:59:21 +02:00
Making mounts order available only for 8.7 and above (#440)
* mounts only 8.7 and up
This commit is contained in:
parent
1ae01ee342
commit
17f1ffee95
@ -1,6 +1,11 @@
|
|||||||
-- <globalevent name="Znote Shop" interval="30000" script="znoteshop.lua"/>
|
-- <globalevent name="Znote Shop" interval="30000" script="znoteshop.lua"/>
|
||||||
-- Znote Auto Shop v2.1 for Znote AAC on TFS 1.2+
|
-- Znote Auto Shop v2.1 for Znote AAC on TFS 1.2+
|
||||||
function onThink(interval, lastExecution)
|
function onThink(interval, lastExecution)
|
||||||
|
local shopTypes = {1,5,7}
|
||||||
|
-- If game support mount orders
|
||||||
|
if Game.getClientVersion().min >= 870 then
|
||||||
|
table.insert(shopTypes, 6);
|
||||||
|
end
|
||||||
local orderQuery = db.storeQuery([[
|
local orderQuery = db.storeQuery([[
|
||||||
SELECT
|
SELECT
|
||||||
MIN(`po`.`player_id`) AS `player_id`,
|
MIN(`po`.`player_id`) AS `player_id`,
|
||||||
@ -13,7 +18,7 @@ function onThink(interval, lastExecution)
|
|||||||
ON `po`.`player_id` = `p`.`id`
|
ON `po`.`player_id` = `p`.`id`
|
||||||
INNER JOIN `znote_shop_orders` AS `shop`
|
INNER JOIN `znote_shop_orders` AS `shop`
|
||||||
ON `p`.`account_id` = `shop`.`account_id`
|
ON `p`.`account_id` = `shop`.`account_id`
|
||||||
WHERE `shop`.`type` IN(1,5,6,7)
|
WHERE `shop`.`type` IN(]] .. table.concat(shopTypes, ",") .. [[)
|
||||||
GROUP BY `shop`.`id`
|
GROUP BY `shop`.`id`
|
||||||
]])
|
]])
|
||||||
-- Detect if we got any results
|
-- Detect if we got any results
|
||||||
@ -100,6 +105,7 @@ function onThink(interval, lastExecution)
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
if Game.getClientVersion().min >= 870 then
|
||||||
-- ORDER TYPE 6 (Mounts)
|
-- ORDER TYPE 6 (Mounts)
|
||||||
if orderType == 6 then
|
if orderType == 6 then
|
||||||
served = true
|
served = true
|
||||||
@ -114,6 +120,7 @@ function onThink(interval, lastExecution)
|
|||||||
print("Process canceled. [".. player:getName() .."] already have mount: ["..orderItemId.."].")
|
print("Process canceled. [".. player:getName() .."] already have mount: ["..orderItemId.."].")
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
end
|
||||||
|
|
||||||
-- ORDER TYPE 7 (Direct house purchase)
|
-- ORDER TYPE 7 (Direct house purchase)
|
||||||
if orderType == 7 then
|
if orderType == 7 then
|
||||||
|
@ -1,6 +1,11 @@
|
|||||||
local globalevent = GlobalEvent("ShopSystemGlobal")
|
local globalevent = GlobalEvent("ShopSystemGlobal")
|
||||||
|
|
||||||
function globalevent.onThink(...)
|
function globalevent.onThink(...)
|
||||||
|
local shopTypes = {1,5,7}
|
||||||
|
-- If game support mount orders
|
||||||
|
if Game.getClientVersion().min >= 870 then
|
||||||
|
table.insert(shopTypes, 6);
|
||||||
|
end
|
||||||
local orderQuery = db.storeQuery([[
|
local orderQuery = db.storeQuery([[
|
||||||
SELECT
|
SELECT
|
||||||
MIN(`po`.`player_id`) AS `player_id`,
|
MIN(`po`.`player_id`) AS `player_id`,
|
||||||
@ -13,7 +18,7 @@ function globalevent.onThink(...)
|
|||||||
ON `po`.`player_id` = `p`.`id`
|
ON `po`.`player_id` = `p`.`id`
|
||||||
INNER JOIN `znote_shop_orders` AS `shop`
|
INNER JOIN `znote_shop_orders` AS `shop`
|
||||||
ON `p`.`account_id` = `shop`.`account_id`
|
ON `p`.`account_id` = `shop`.`account_id`
|
||||||
WHERE `shop`.`type` IN(1,5,6,7)
|
WHERE `shop`.`type` IN(]] .. table.concat(shopTypes, ",") .. [[)
|
||||||
GROUP BY `shop`.`id`
|
GROUP BY `shop`.`id`
|
||||||
]])
|
]])
|
||||||
-- Detect if we got any results
|
-- Detect if we got any results
|
||||||
|
@ -76,16 +76,18 @@ function talkaction.onSay(player)
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
-- ORDER TYPE 6 (Mounts)
|
if Game.getClientVersion().min >= 870 then
|
||||||
if q_type == 6 then
|
-- ORDER TYPE 6 (Mounts)
|
||||||
served = true
|
if q_type == 6 then
|
||||||
-- Make sure player don't already have this outfit and addon
|
served = true
|
||||||
if not player:hasMount(q_itemid) then
|
-- Make sure player don't already have this outfit and addon
|
||||||
db.query("DELETE FROM `znote_shop_orders` WHERE `id` = " .. q_id .. ";")
|
if not player:hasMount(q_itemid) then
|
||||||
player:addMount(q_itemid)
|
db.query("DELETE FROM `znote_shop_orders` WHERE `id` = " .. q_id .. ";")
|
||||||
player:sendTextMessage(MESSAGE_INFO_DESCR, "Congratulations! You have received a new mount!")
|
player:addMount(q_itemid)
|
||||||
else
|
player:sendTextMessage(MESSAGE_INFO_DESCR, "Congratulations! You have received a new mount!")
|
||||||
player:sendTextMessage(MESSAGE_STATUS_WARNING, "You already have this mount!")
|
else
|
||||||
|
player:sendTextMessage(MESSAGE_STATUS_WARNING, "You already have this mount!")
|
||||||
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -76,16 +76,18 @@ function onSay(player, words, param)
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
-- ORDER TYPE 6 (Mounts)
|
if Game.getClientVersion().min >= 870 then
|
||||||
if q_type == 6 then
|
-- ORDER TYPE 6 (Mounts)
|
||||||
served = true
|
if q_type == 6 then
|
||||||
-- Make sure player don't already have this outfit and addon
|
served = true
|
||||||
if not player:hasMount(q_itemid) then
|
-- Make sure player don't already have this outfit and addon
|
||||||
db.query("DELETE FROM `znote_shop_orders` WHERE `id` = " .. q_id .. ";")
|
if not player:hasMount(q_itemid) then
|
||||||
player:addMount(q_itemid)
|
db.query("DELETE FROM `znote_shop_orders` WHERE `id` = " .. q_id .. ";")
|
||||||
player:sendTextMessage(MESSAGE_INFO_DESCR, "Congratulations! You have received a new mount!")
|
player:addMount(q_itemid)
|
||||||
else
|
player:sendTextMessage(MESSAGE_INFO_DESCR, "Congratulations! You have received a new mount!")
|
||||||
player:sendTextMessage(MESSAGE_STATUS_WARNING, "You already have this mount!")
|
else
|
||||||
|
player:sendTextMessage(MESSAGE_STATUS_WARNING, "You already have this mount!")
|
||||||
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user