stoneage8.5/服务器端lua文件/ablua/freecharlogout.lua

125 lines
4.5 KiB
Lua
Raw Normal View History

2020-06-22 17:49:02 +08:00
--<2D><>LUA<55><41><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ж<EFBFBD>ʱ<EFBFBD><CAB1><EFBFBD>Ϳ۳<CDBF>ʱ<EFBFBD><EFBFBD><E4BBB9><EFBFBD><EFBFBD><EFBFBD>ߺ<EFBFBD><DFBA><EFBFBD>¼<EFBFBD><C2BC>һ<EFBFBD><D2BB><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ڼ<EFBFBD><DABC><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ĸ<EFBFBD><C4B8><EFBFBD><EFBFBD><EFBFBD>Ϣ!
function getIntPart(x)
if x <= 0 then
return math.ceil(x);
end
if math.ceil(x) == x then
x = math.ceil(x);
else
x = math.ceil(x) - 1;
end
return x;
end
function FreeCharLogout( charindex )
if char.getWorkInt(charindex, "<EFBFBD><EFBFBD><EFBFBD><EFBFBD>") == 1 then
--if char.getWorkInt(charindex, "<22><>̯") == -1 then
-- if config.getGameservername() ~= "<22><><EFBFBD><EFBFBD>ʯ<EFBFBD><CAAF><EFBFBD><EFBFBD><EFBFBD><EFBFBD>" and config.getGameservername() ~= "<22><><EFBFBD><EFBFBD>ʯ<EFBFBD><CAAF><EFBFBD><EFBFBD><EFBFBD><EFBFBD>" then
-- local offtime = other.time() - char.getWorkInt(charindex, "<22><>½ʱ<C2BD><CAB1>")
-- char.setInt(charindex, "<22><><EFBFBD><EFBFBD>ʱ<EFBFBD><CAB1>", math.max(char.getInt(charindex, "<22><><EFBFBD><EFBFBD>ʱ<EFBFBD><CAB1>") - offtime / 60), 0)
-- end
--end
other.setLuaPLayerNum(other.getLuaPLayerNum()-1)
else
local offtime = other.time() - char.getWorkInt(charindex, "<EFBFBD><EFBFBD>½ʱ<EFBFBD><EFBFBD>")
if char.getInt(charindex, "<EFBFBD>ȼ<EFBFBD>") == 140 then
local onlinetime = char.getInt(charindex, "<EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʱ<EFBFBD><EFBFBD>") - char.getWorkInt(charindex, "<EFBFBD><EFBFBD>½ʱ<EFBFBD><EFBFBD>")
if char.getInt(charindex, "ת<EFBFBD><EFBFBD>") == 5 then
char.setInt(charindex, "<EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʱ<EFBFBD><EFBFBD>", char.getInt(charindex, "<EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʱ<EFBFBD><EFBFBD>") + getIntPart(onlinetime / 2) )
elseif char.getInt(charindex, "ת<EFBFBD><EFBFBD>") == 6 then
char.setInt(charindex, "<EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʱ<EFBFBD><EFBFBD>", char.getInt(charindex, "<EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʱ<EFBFBD><EFBFBD>") + onlinetime)
end
end
end
--if config.getGameservername() == "<22><><EFBFBD><EFBFBD>ʯ<EFBFBD><CAAF><EFBFBD><EFBFBD><EFBFBD><EFBFBD>" then
-- token = "DELETE FROM `OnlinePlayer` "
-- .. " WHERE `cdkey` = '" .. char.getChar(charindex, "<22>˺<EFBFBD>") .. "'"
-- ret = sasql.query(token)
--end
token = "SELECT * FROM `CSAinfo` "
.. " WHERE `cdkey` = '" .. char.getChar(charindex, "<EFBFBD>˺<EFBFBD>") .. "'"
.. " AND `saveindex` = '" .. char.getInt(charindex, "<EFBFBD>") .. "'"
ret = sasql.query(token)
if ret == 1 then
sasql.free_result()
sasql.store_result()
num = sasql.num_rows()
if num > 0 then
token = "UPDATE `CSAinfo` SET "
.. "`name` = '" .. char.getChar(charindex, "<EFBFBD><EFBFBD><EFBFBD><EFBFBD>") .. "',"
.. "`famename` = '" .. char.getChar(charindex, "<EFBFBD><EFBFBD><EFBFBD><EFBFBD>") .. "', "
.. "`level` = '" .. char.getInt(charindex, "<EFBFBD>ȼ<EFBFBD>") .. "',"
.. "`trans` = '" .. char.getInt(charindex, "ת<EFBFBD><EFBFBD>") .. "',"
.. "`alive` = '" .. char.getInt(charindex, "<EFBFBD><EFBFBD><EFBFBD><EFBFBD>") .. "',"
.. "`fame` = '" .. char.getInt(charindex, "<EFBFBD><EFBFBD><EFBFBD><EFBFBD>") .. "',"
.. "`TITLE_LV` = '" .. 0 .. "',"
.. "`DUELBATTLECOUNT` = '" .. char.getInt(charindex, "PK<EFBFBD><EFBFBD><EFBFBD><EFBFBD>") .. "',"
.. "`DUELWINCOUNT` = '" .. char.getInt(charindex, "PKӮ<EFBFBD><EFBFBD>") .. "',"
.. "`DUELLOSECOUNT` = '" .. char.getInt(charindex, "PK<EFBFBD><EFBFBD><EFBFBD><EFBFBD>") .. "',"
.. "`DUELSTWINCOUNT` = '" .. char.getInt(charindex, "PK<EFBFBD><EFBFBD>ʤ") .. "',"
.. "`DUELSTLOSECOUNT` = '" .. char.getInt(charindex, "PK<EFBFBD><EFBFBD><EFBFBD><EFBFBD>") .. "',"
.. "`DUELMAXSTWINCOUNT` = '" .. char.getInt(charindex, "PK<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʤ") .. "',"
.. "`vip` = '" .. char.getInt(charindex, "<EFBFBD><EFBFBD>Ա") .. "',"
.. "`time` = NOW()"
.. " WHERE `cdkey` = '" .. char.getChar(charindex, "<EFBFBD>˺<EFBFBD>") .. "'"
.. " AND `saveindex` = '" .. char.getInt(charindex, "<EFBFBD>") .. "'"
ret = sasql.query(token)
else
token = "INSERT INTO `CSAinfo` ( "
.. "`cdkey` ,"
.. "`saveindex` ,"
.. "`name` ,"
.. "`famename` ,"
.. "`level` ,"
.. "`trans` ,"
.. "`alive` ,"
.. "`fame` ,"
.. "`TITLE_LV` ,"
.. "`DUELBATTLECOUNT` ,"
.. "`DUELWINCOUNT` ,"
.. "`DUELLOSECOUNT` ,"
.. "`DUELSTWINCOUNT` ,"
.. "`DUELSTLOSECOUNT` ,"
.. "`DUELMAXSTWINCOUNT` ,"
.. "`vip` ,"
.. "`time`"
.. ")"
.. "VALUES ("
.. "'" .. char.getChar(charindex, "<EFBFBD>˺<EFBFBD>")
.. "', '" .. char.getInt(charindex, "<EFBFBD>")
.. "', '" .. char.getChar(charindex, "<EFBFBD><EFBFBD><EFBFBD><EFBFBD>")
.. "', '" .. char.getChar(charindex, "<EFBFBD><EFBFBD><EFBFBD><EFBFBD>")
.. "', '" .. char.getInt(charindex, "<EFBFBD>ȼ<EFBFBD>")
.. "', '" .. char.getInt(charindex, "ת<EFBFBD><EFBFBD>")
.. "', '" .. char.getInt(charindex, "<EFBFBD><EFBFBD><EFBFBD><EFBFBD>")
.. "', '" .. char.getInt(charindex, "<EFBFBD><EFBFBD><EFBFBD><EFBFBD>")
.. "', '" .. char.getInt(charindex, "Ӣ<EFBFBD>۳ƺ<EFBFBD>")
.. "', '" .. char.getInt(charindex, "PK<EFBFBD><EFBFBD><EFBFBD><EFBFBD>")
.. "', '" .. char.getInt(charindex, "PKӮ<EFBFBD><EFBFBD>")
.. "', '" .. char.getInt(charindex, "PK<EFBFBD><EFBFBD><EFBFBD><EFBFBD>")
.. "', '" .. char.getInt(charindex, "PK<EFBFBD><EFBFBD>ʤ")
.. "', '" .. char.getInt(charindex, "PK<EFBFBD><EFBFBD><EFBFBD><EFBFBD>")
.. "', '" .. char.getInt(charindex, "PK<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʤ")
.. "', '" .. char.getInt(charindex, "<EFBFBD><EFBFBD>Ա")
.. "', NOW()"
.. ");"
ret = sasql.query(token)
end
end
token = "update `CSAlogin` set `Offline`=0 where `Name`='" .. char.getChar(charindex,"<EFBFBD>˺<EFBFBD>") .. "'"
sasql.query(token)
end
function data()
end
function main()
data()
end