mirror of
https://github.com/Znote/ZnoteAAC.git
synced 2025-10-13 18:04:54 +02:00
Znote AAC rev 168 from subversion.
This commit is contained in:
@@ -0,0 +1,4 @@
|
||||
Step 1: Copy firstitems.lua to /data/creaturescripts/scripts/ folder
|
||||
-- Edit firstitems.lua with item IDs you want characters to start with on your server.
|
||||
|
||||
Step 2: Restart OT server, and it should work. :)
|
77
LUA/TFS_02/creaturescript firstitems/firstitems.lua
Normal file
77
LUA/TFS_02/creaturescript firstitems/firstitems.lua
Normal file
@@ -0,0 +1,77 @@
|
||||
function onLogin(cid)
|
||||
local storage = 30055 -- storage value
|
||||
|
||||
local sorcItems = {
|
||||
2460, -- Brass helmet
|
||||
2465, -- Brass armor
|
||||
2190, -- Wand of vortex
|
||||
2511, -- Brass shield
|
||||
2478, -- Brass legs
|
||||
2643, -- Leather boots
|
||||
1988, -- Brown backpack
|
||||
2050 -- torch
|
||||
}
|
||||
local druidItems = {
|
||||
2460, -- Brass helmet
|
||||
2465, -- Brass armor
|
||||
2511, -- Brass shield
|
||||
2182, -- Snakebite rod
|
||||
2478, -- Brass legs
|
||||
2643, -- Leather boots
|
||||
1988, -- Brown backpack
|
||||
2050 -- torch
|
||||
}
|
||||
local pallyItems = {
|
||||
2460, -- Brass helmet
|
||||
2465, -- Brass armor
|
||||
2456, -- Bow
|
||||
2478, -- Brass legs
|
||||
2643, -- Leather boots
|
||||
1988, -- Brown backpack
|
||||
}
|
||||
local kinaItems = {
|
||||
2460, -- Brass helmet
|
||||
2465, -- Brass armor
|
||||
2511, -- Brass shield
|
||||
2412, -- Katana
|
||||
2478, -- Brass legs
|
||||
2643, -- Leather boots
|
||||
1988, -- Brown backpack
|
||||
2050 -- torch
|
||||
}
|
||||
|
||||
if getPlayerStorageValue(cid, storage) == -1 then
|
||||
setPlayerStorageValue(cid, storage, 1)
|
||||
if getPlayerVocation(cid) == 1 then
|
||||
-- Sorcerer
|
||||
for i = 1, table.getn(sorcItems), 1 do
|
||||
doPlayerAddItem(cid, sorcItems[i], 1, FALSE)
|
||||
end
|
||||
|
||||
elseif getPlayerVocation(cid) == 2 then
|
||||
-- Druid
|
||||
for i = 1, table.getn(druidItems), 1 do
|
||||
doPlayerAddItem(cid, druidItems[i], 1, FALSE)
|
||||
end
|
||||
|
||||
elseif getPlayerVocation(cid) == 3 then
|
||||
-- Paladin
|
||||
for i = 1, table.getn(pallyItems), 1 do
|
||||
doPlayerAddItem(cid, pallyItems[i], 1, FALSE)
|
||||
end
|
||||
-- 8 arrows
|
||||
doPlayerAddItem(cid, 2544, 8, FALSE)
|
||||
|
||||
elseif getPlayerVocation(cid) == 4 then
|
||||
-- Knight
|
||||
for i = 1, table.getn(kinaItems), 1 do
|
||||
doPlayerAddItem(cid, kinaItems[i], 1, FALSE)
|
||||
end
|
||||
end
|
||||
|
||||
-- Common for all
|
||||
doPlayerAddItem(cid, 2674, 5, FALSE) -- 5 apples
|
||||
doPlayerAddItem(cid, 2120, 1, FALSE) -- 1 rope
|
||||
end
|
||||
return true
|
||||
end
|
1
LUA/TFS_02/talkaction shopsystem/talkaction XML.txt
Normal file
1
LUA/TFS_02/talkaction shopsystem/talkaction XML.txt
Normal file
@@ -0,0 +1 @@
|
||||
<talkaction words="!shop" script="znoteshop.lua"/>
|
49
LUA/TFS_02/talkaction shopsystem/znoteshop.lua
Normal file
49
LUA/TFS_02/talkaction shopsystem/znoteshop.lua
Normal file
@@ -0,0 +1,49 @@
|
||||
-- Znote Shop v1.0 for Znote AAC on TFS 0.2.13+ Mystic Spirit.
|
||||
function onSay(cid, words, param)
|
||||
local storage = 54073 -- Make sure to select non-used storage. This is used to prevent SQL load attacks.
|
||||
local cooldown = 15 -- in seconds.
|
||||
|
||||
if getPlayerStorageValue(cid, storage) <= os.time() then
|
||||
setPlayerStorageValue(cid, storage, os.time() + cooldown)
|
||||
local accid = getAccountNumberByPlayerName(getCreatureName(cid))
|
||||
|
||||
-- Create the query
|
||||
local orderQuery = db.storeQuery("SELECT `id`, `type`, `itemid`, `count` FROM `znote_shop_orders` WHERE `account_id` = " .. accid .. " LIMIT 1;")
|
||||
|
||||
-- Detect if we got any results
|
||||
if orderQuery ~= false then
|
||||
-- Fetch order values
|
||||
local q_id = result.getDataInt(orderQuery, "id")
|
||||
local q_type = result.getDataInt(orderQuery, "type")
|
||||
local q_itemid = result.getDataInt(orderQuery, "itemid")
|
||||
local q_count = result.getDataInt(orderQuery, "count")
|
||||
result.free(orderQuery)
|
||||
|
||||
-- ORDER TYPE 1 (Regular item shop products)
|
||||
if q_type == 1 then
|
||||
-- Get wheight
|
||||
local playerCap = getPlayerFreeCap(cid)
|
||||
local itemweight = getItemWeight(q_itemid, q_count)
|
||||
if playerCap >= itemweight then
|
||||
db.query("DELETE FROM `znote_shop_orders` WHERE `id` = " .. q_id .. ";")
|
||||
doPlayerAddItem(cid, q_itemid, q_count)
|
||||
doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "Congratulations! You have recieved ".. q_count .." "..getItemName(q_itemid).."(s)!")
|
||||
else
|
||||
doPlayerSendTextMessage(cid, MESSAGE_STATUS_WARNING, "Need more CAP!")
|
||||
end
|
||||
end
|
||||
-- Add custom order types here
|
||||
-- Type 2 is reserved for premium days and is handled on website, not needed here.
|
||||
-- Type 3 is reserved for character gender(sex) change and is handled on website as well.
|
||||
-- So use type 4+ for custom stuff, like etc packages.
|
||||
-- if q_type == 4 then
|
||||
-- end
|
||||
else
|
||||
doPlayerSendTextMessage(cid, MESSAGE_STATUS_WARNING, "You have no orders.")
|
||||
end
|
||||
|
||||
else
|
||||
doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Can only be executed once every "..cooldown.." seconds. Remaining cooldown: ".. getPlayerStorageValue(cid, storage) - os.time())
|
||||
end
|
||||
return false
|
||||
end
|
@@ -0,0 +1,10 @@
|
||||
Step 1: Copy firstitems.lua to /data/creaturescripts/scripts/ folder
|
||||
-- Edit firstitems.lua with item IDs you want characters to start with on your server.
|
||||
|
||||
Step 2: Edit the /data/creaturescripts/creaturescripts.XML file
|
||||
- ADD: <event type="login" name="firstItems" event="script" value="firstitems.lua"/>
|
||||
|
||||
Step 3: Edit the /data/creaturescripts/scripts/login.lua file
|
||||
- ADD: registerCreatureEvent(cid, "firstItems")
|
||||
|
||||
Step 4: Restart OT server, and it should work. :)
|
77
LUA/TFS_03/creaturescript firstitems/firstitems.lua
Normal file
77
LUA/TFS_03/creaturescript firstitems/firstitems.lua
Normal file
@@ -0,0 +1,77 @@
|
||||
function onLogin(cid)
|
||||
local storage = 30055 -- storage value
|
||||
|
||||
local sorcItems = {
|
||||
2460, -- Brass helmet
|
||||
2465, -- Brass armor
|
||||
2190, -- Wand of vortex
|
||||
2511, -- Brass shield
|
||||
2478, -- Brass legs
|
||||
2643, -- Leather boots
|
||||
1988, -- Brown backpack
|
||||
2050 -- torch
|
||||
}
|
||||
local druidItems = {
|
||||
2460, -- Brass helmet
|
||||
2465, -- Brass armor
|
||||
2511, -- Brass shield
|
||||
2182, -- Snakebite rod
|
||||
2478, -- Brass legs
|
||||
2643, -- Leather boots
|
||||
1988, -- Brown backpack
|
||||
2050 -- torch
|
||||
}
|
||||
local pallyItems = {
|
||||
2460, -- Brass helmet
|
||||
2465, -- Brass armor
|
||||
2456, -- Bow
|
||||
2478, -- Brass legs
|
||||
2643, -- Leather boots
|
||||
1988, -- Brown backpack
|
||||
}
|
||||
local kinaItems = {
|
||||
2460, -- Brass helmet
|
||||
2465, -- Brass armor
|
||||
2511, -- Brass shield
|
||||
2412, -- Katana
|
||||
2478, -- Brass legs
|
||||
2643, -- Leather boots
|
||||
1988, -- Brown backpack
|
||||
2050 -- torch
|
||||
}
|
||||
|
||||
if getPlayerStorageValue(cid, storage) == -1 then
|
||||
setPlayerStorageValue(cid, storage, 1)
|
||||
if getPlayerVocation(cid) == 1 then
|
||||
-- Sorcerer
|
||||
for i = 1, table.getn(sorcItems), 1 do
|
||||
doPlayerAddItem(cid, sorcItems[i], 1, FALSE)
|
||||
end
|
||||
|
||||
elseif getPlayerVocation(cid) == 2 then
|
||||
-- Druid
|
||||
for i = 1, table.getn(druidItems), 1 do
|
||||
doPlayerAddItem(cid, druidItems[i], 1, FALSE)
|
||||
end
|
||||
|
||||
elseif getPlayerVocation(cid) == 3 then
|
||||
-- Paladin
|
||||
for i = 1, table.getn(pallyItems), 1 do
|
||||
doPlayerAddItem(cid, pallyItems[i], 1, FALSE)
|
||||
end
|
||||
-- 8 arrows
|
||||
doPlayerAddItem(cid, 2544, 8, FALSE)
|
||||
|
||||
elseif getPlayerVocation(cid) == 4 then
|
||||
-- Knight
|
||||
for i = 1, table.getn(kinaItems), 1 do
|
||||
doPlayerAddItem(cid, kinaItems[i], 1, FALSE)
|
||||
end
|
||||
end
|
||||
|
||||
-- Common for all
|
||||
doPlayerAddItem(cid, 2674, 5, FALSE) -- 5 apples
|
||||
doPlayerAddItem(cid, 2120, 1, FALSE) -- 1 rope
|
||||
end
|
||||
return true
|
||||
end
|
50
LUA/TFS_03/talkaction shopsystem/Alternatives/znoteshop.lua
Normal file
50
LUA/TFS_03/talkaction shopsystem/Alternatives/znoteshop.lua
Normal file
@@ -0,0 +1,50 @@
|
||||
-- Znote Shop v1.0 for Znote AAC on TFS 0.3.6+ Crying Damson.
|
||||
function onSay(cid, words, param)
|
||||
local storage = 54073 -- Make sure to select non-used storage. This is used to prevent SQL load attacks.
|
||||
local cooldown = 15 -- in seconds.
|
||||
|
||||
if getPlayerStorageValue(cid, storage) <= os.time() then
|
||||
setPlayerStorageValue(cid, storage, os.time() + cooldown)
|
||||
local accid = getAccountNumberByPlayerName(getCreatureName(cid))
|
||||
|
||||
-- Create the query
|
||||
local orderQuery = db.storeQuery("SELECT `id`, `type`, `itemid`, `count` FROM `znote_shop_orders` WHERE `account_id` = " .. accid .. ";")
|
||||
|
||||
-- Detect if we got any results
|
||||
if orderQuery ~= false then
|
||||
-- Fetch order values
|
||||
local q_id = result.getDataInt(orderQuery, "id")
|
||||
local q_type = result.getDataInt(orderQuery, "type")
|
||||
local q_itemid = result.getDataInt(orderQuery, "itemid")
|
||||
local q_count = result.getDataInt(orderQuery, "count")
|
||||
result.free(orderQuery)
|
||||
|
||||
-- ORDER TYPE 1 (Regular item shop products)
|
||||
if q_type == 1 then
|
||||
-- Get wheight
|
||||
local playerCap = getPlayerFreeCap(cid)
|
||||
local itemweight = getItemWeightById(q_itemid, q_count)
|
||||
if playerCap >= itemweight then
|
||||
local delete = db.storeQuery("DELETE FROM `znote_shop_orders` WHERE `id` = " .. q_id .. ";")
|
||||
result.free(delete)
|
||||
doPlayerAddItem(cid, q_itemid, q_count)
|
||||
doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "Congratulations! You have recieved ".. q_count .." "..getItemNameById(q_itemid).."(s)!")
|
||||
else
|
||||
doPlayerSendTextMessage(cid, MESSAGE_STATUS_WARNING, "Need more CAP!")
|
||||
end
|
||||
end
|
||||
-- Add custom order types here
|
||||
-- Type 2 is reserved for premium days and is handled on website, not needed here.
|
||||
-- Type 3 is reserved for character gender(sex) change and is handled on website as well.
|
||||
-- So use type 4+ for custom stuff, like etc packages.
|
||||
-- if q_type == 4 then
|
||||
-- end
|
||||
else
|
||||
doPlayerSendTextMessage(cid, MESSAGE_STATUS_WARNING, "You have no orders.")
|
||||
end
|
||||
|
||||
else
|
||||
doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Can only be executed once every "..cooldown.." seconds. Remaining cooldown: ".. getPlayerStorageValue(cid, storage) - os.time())
|
||||
end
|
||||
return false
|
||||
end
|
1
LUA/TFS_03/talkaction shopsystem/talkaction XML.txt
Normal file
1
LUA/TFS_03/talkaction shopsystem/talkaction XML.txt
Normal file
@@ -0,0 +1 @@
|
||||
<talkaction words="!shop" event="script" value="znoteshop.lua"/>
|
49
LUA/TFS_03/talkaction shopsystem/znoteshop.lua
Normal file
49
LUA/TFS_03/talkaction shopsystem/znoteshop.lua
Normal file
@@ -0,0 +1,49 @@
|
||||
-- Znote Shop v1.0 for Znote AAC on TFS 0.3.6+ Crying Damson.
|
||||
function onSay(cid, words, param)
|
||||
local storage = 54073 -- Make sure to select non-used storage. This is used to prevent SQL load attacks.
|
||||
local cooldown = 15 -- in seconds.
|
||||
|
||||
if getPlayerStorageValue(cid, storage) <= os.time() then
|
||||
setPlayerStorageValue(cid, storage, os.time() + cooldown)
|
||||
local accid = getAccountNumberByPlayerName(getCreatureName(cid))
|
||||
|
||||
-- Create the query
|
||||
local orderQuery = db.storeQuery("SELECT `id`, `type`, `itemid`, `count` FROM `znote_shop_orders` WHERE `account_id` = " .. accid .. " LIMIT 1;")
|
||||
|
||||
-- Detect if we got any results
|
||||
if orderQuery ~= false then
|
||||
-- Fetch order values
|
||||
local q_id = result.getDataInt(orderQuery, "id")
|
||||
local q_type = result.getDataInt(orderQuery, "type")
|
||||
local q_itemid = result.getDataInt(orderQuery, "itemid")
|
||||
local q_count = result.getDataInt(orderQuery, "count")
|
||||
result.free(orderQuery)
|
||||
|
||||
-- ORDER TYPE 1 (Regular item shop products)
|
||||
if q_type == 1 then
|
||||
-- Get wheight
|
||||
local playerCap = getPlayerFreeCap(cid)
|
||||
local itemweight = getItemWeightById(q_itemid, q_count)
|
||||
if playerCap >= itemweight then
|
||||
db.executeQuery("DELETE FROM `znote_shop_orders` WHERE `id` = " .. q_id .. ";")
|
||||
doPlayerAddItem(cid, q_itemid, q_count)
|
||||
doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "Congratulations! You have recieved ".. q_count .." "..getItemNameById(q_itemid).."(s)!")
|
||||
else
|
||||
doPlayerSendTextMessage(cid, MESSAGE_STATUS_WARNING, "Need more CAP!")
|
||||
end
|
||||
end
|
||||
-- Add custom order types here
|
||||
-- Type 2 is reserved for premium days and is handled on website, not needed here.
|
||||
-- Type 3 is reserved for character gender(sex) change and is handled on website as well.
|
||||
-- So use type 4+ for custom stuff, like etc packages.
|
||||
-- if q_type == 4 then
|
||||
-- end
|
||||
else
|
||||
doPlayerSendTextMessage(cid, MESSAGE_STATUS_WARNING, "You have no orders.")
|
||||
end
|
||||
|
||||
else
|
||||
doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Can only be executed once every "..cooldown.." seconds. Remaining cooldown: ".. getPlayerStorageValue(cid, storage) - os.time())
|
||||
end
|
||||
return false
|
||||
end
|
Reference in New Issue
Block a user