diff --git a/Lua/TFS_10/globalevent shopsystem/znoteshop.lua b/Lua/TFS_10/globalevent shopsystem/znoteshop.lua index 6d8659a..84f7832 100644 --- a/Lua/TFS_10/globalevent shopsystem/znoteshop.lua +++ b/Lua/TFS_10/globalevent shopsystem/znoteshop.lua @@ -1,6 +1,11 @@ -- -- Znote Auto Shop v2.1 for Znote AAC on TFS 1.2+ 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([[ SELECT MIN(`po`.`player_id`) AS `player_id`, @@ -13,7 +18,7 @@ function onThink(interval, lastExecution) ON `po`.`player_id` = `p`.`id` INNER JOIN `znote_shop_orders` AS `shop` 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` ]]) -- Detect if we got any results @@ -100,6 +105,7 @@ function onThink(interval, lastExecution) end end +if Game.getClientVersion().min >= 870 then -- ORDER TYPE 6 (Mounts) if orderType == 6 then served = true @@ -114,6 +120,7 @@ function onThink(interval, lastExecution) print("Process canceled. [".. player:getName() .."] already have mount: ["..orderItemId.."].") end end +end -- ORDER TYPE 7 (Direct house purchase) if orderType == 7 then diff --git a/Lua/TFS_10/revscriptsys/shopsystem_globalevent.lua b/Lua/TFS_10/revscriptsys/shopsystem_globalevent.lua index b2f0724..aaa338d 100644 --- a/Lua/TFS_10/revscriptsys/shopsystem_globalevent.lua +++ b/Lua/TFS_10/revscriptsys/shopsystem_globalevent.lua @@ -1,6 +1,11 @@ local globalevent = GlobalEvent("ShopSystemGlobal") 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([[ SELECT MIN(`po`.`player_id`) AS `player_id`, @@ -13,7 +18,7 @@ function globalevent.onThink(...) ON `po`.`player_id` = `p`.`id` INNER JOIN `znote_shop_orders` AS `shop` 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` ]]) -- Detect if we got any results diff --git a/Lua/TFS_10/revscriptsys/shopsystem_talkaction.lua b/Lua/TFS_10/revscriptsys/shopsystem_talkaction.lua index 6c17ee7..7d5ada9 100644 --- a/Lua/TFS_10/revscriptsys/shopsystem_talkaction.lua +++ b/Lua/TFS_10/revscriptsys/shopsystem_talkaction.lua @@ -76,16 +76,18 @@ function talkaction.onSay(player) end end - -- ORDER TYPE 6 (Mounts) - if q_type == 6 then - served = true - -- Make sure player don't already have this outfit and addon - if not player:hasMount(q_itemid) then - db.query("DELETE FROM `znote_shop_orders` WHERE `id` = " .. q_id .. ";") - player:addMount(q_itemid) - player:sendTextMessage(MESSAGE_INFO_DESCR, "Congratulations! You have received a new mount!") - else - player:sendTextMessage(MESSAGE_STATUS_WARNING, "You already have this mount!") + if Game.getClientVersion().min >= 870 then + -- ORDER TYPE 6 (Mounts) + if q_type == 6 then + served = true + -- Make sure player don't already have this outfit and addon + if not player:hasMount(q_itemid) then + db.query("DELETE FROM `znote_shop_orders` WHERE `id` = " .. q_id .. ";") + player:addMount(q_itemid) + player:sendTextMessage(MESSAGE_INFO_DESCR, "Congratulations! You have received a new mount!") + else + player:sendTextMessage(MESSAGE_STATUS_WARNING, "You already have this mount!") + end end end diff --git a/Lua/TFS_10/talkaction shopsystem/znoteshop.lua b/Lua/TFS_10/talkaction shopsystem/znoteshop.lua index 4894053..9c05bac 100644 --- a/Lua/TFS_10/talkaction shopsystem/znoteshop.lua +++ b/Lua/TFS_10/talkaction shopsystem/znoteshop.lua @@ -76,16 +76,18 @@ function onSay(player, words, param) end end - -- ORDER TYPE 6 (Mounts) - if q_type == 6 then - served = true - -- Make sure player don't already have this outfit and addon - if not player:hasMount(q_itemid) then - db.query("DELETE FROM `znote_shop_orders` WHERE `id` = " .. q_id .. ";") - player:addMount(q_itemid) - player:sendTextMessage(MESSAGE_INFO_DESCR, "Congratulations! You have received a new mount!") - else - player:sendTextMessage(MESSAGE_STATUS_WARNING, "You already have this mount!") + if Game.getClientVersion().min >= 870 then + -- ORDER TYPE 6 (Mounts) + if q_type == 6 then + served = true + -- Make sure player don't already have this outfit and addon + if not player:hasMount(q_itemid) then + db.query("DELETE FROM `znote_shop_orders` WHERE `id` = " .. q_id .. ";") + player:addMount(q_itemid) + player:sendTextMessage(MESSAGE_INFO_DESCR, "Congratulations! You have received a new mount!") + else + player:sendTextMessage(MESSAGE_STATUS_WARNING, "You already have this mount!") + end end end