-
Notifications
You must be signed in to change notification settings - Fork 20
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
1,523 changed files
with
97,951 additions
and
103 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
function onThink(creature, interval) | ||
local player = creature:getPlayer() | ||
if not player then | ||
return false | ||
end | ||
|
||
local storIndex = player:getStorageValue(STORAGEVALUE_SUPERUP_INDEX) | ||
local storTime = player:getStorageValue(STORAGEVALUE_SUPERUP_TEMPO) | ||
|
||
for a, b in pairs(SUPERUP.areas) do | ||
if storIndex == a and isInArea(player:getPosition(), b.from, b.to) then | ||
if storTime <= os.time() then | ||
player:teleportTo(player:getTown():getTemplePosition()) | ||
player:getPosition():sendMagicEffect(CONST_ME_POFF) | ||
end | ||
end | ||
if storIndex == a and storTime <= os.time() then | ||
db.query(string.format("UPDATE exclusive_hunts SET `guid_player` = %d, `time` = %s, `to_time` = %s WHERE `hunt_id` = %d", 0, 0, 0, storIndex)) | ||
player:setStorageValue(STORAGEVALUE_SUPERUP_TEMPO, 0) | ||
player:setStorageValue(STORAGEVALUE_SUPERUP_INDEX, 0) | ||
player:sendCancelMessage(SUPERUP.msg.tempoAcabou) | ||
end | ||
end | ||
|
||
return true | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
function onStartup() | ||
BoostedCreature:start() | ||
if BoostedCreature.db then | ||
db.query(string.format("UPDATE `boost_creature` SET `name` = '%s', `exp` = %d, `loot` = %d", firstToUpper(boostCreature[1].name), boostCreature[1].exp, boostCreature[1].loot)) | ||
end | ||
return true | ||
end | ||
|
||
function onThink(interval) | ||
Game.broadcastMessage(string.format(BoostedCreature.msg.showBoost, firstToUpper(boostCreature[1].name), boostCreature[1].loot, boostCreature[1].exp)) | ||
return true | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
function onThink(interval) | ||
|
||
local ricardoViado = SUPERUP:freeCave() | ||
|
||
for _, b in pairs(ricardoViado) do | ||
if os.time() >= b[2] then | ||
-- db.query(string.format("UPDATE player_storage SET value = 0 WHERE `key` IN(%d,%d) AND `player_id` = %d", STORAGEVALUE_SUPERUP_INDEX, STORAGEVALUE_SUPERUP_TEMPO, b[3])) | ||
db.query(string.format("UPDATE exclusive_hunts SET `guid_player` = %d, `time` = %s, `to_time` = %s WHERE `hunt_id` = %d", 0, 0, 0, b[1])) | ||
end | ||
end | ||
return true | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
if not boostCreature then boostCreature = {} end | ||
|
||
BoostedCreature = { | ||
monsters = {"Rotworm"}, | ||
db = true, | ||
exp = {3, 15}, | ||
loot = {3, 15}, | ||
position = Position(987, 1214, 8), | ||
msg = { | ||
showBoost = "[Boosted Creature] A criatura %s foi a escolhida, adicionado +%d% de loot e +%d% de experiência.", | ||
} | ||
} | ||
|
||
function BoostedCreature:start() | ||
local rand = math.random | ||
local monsterRand = BoostedCreature.monsters[rand(#BoostedCreature.monsters)] | ||
local expRand = rand(BoostedCreature.exp[1], BoostedCreature.exp[2]) | ||
local lootRand = rand(BoostedCreature.loot[1], BoostedCreature.loot[2]) | ||
table.insert(boostCreature, {name = monsterRand:lower(), exp = expRand, loot = lootRand}) | ||
local monster = Game.createMonster(boostCreature[1].name, BoostedCreature.position, false, true) | ||
monster:setDirection(WEST) | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,47 +1,55 @@ | ||
--[[ | ||
1. Player tem uma chave, ao tentar passar por | ||
1.1. Caso não tenha uma chave disponível, retornar erro | ||
1.2. Caso já tenha uma cave, retornar erro | ||
1.3. Comprar cave se tudo certo | ||
1. Adicionar uma storage com o value do index da cave | ||
2. Adicionar no banco de dados quem comprou, horário de compra e até quando ele comprou | ||
3. Adicionar uma storage com o tempo que ele tem de cave | ||
1. Fazer um onLogin e onThink para retirar ele da cave caso tenha acabado o tempo | ||
2. Função verificar se tem cave | ||
3. Função verificar de quem é a cave e quanto tempo restante | ||
4. Função retirar player da cave caso tempo tenha acabado | ||
--]] | ||
|
||
--[[ | ||
CREATE TABLE `exclusive_hunts` ( | ||
`hunt_id` int(2) NOT NULL, | ||
`bought_by` VARCHAR(32) NOT NULL, | ||
`hunt_id` int(2) NOT NULL AUTO_INCREMENT, | ||
`guid_player` VARCHAR(32) NOT NULL, | ||
`time` int(11) NOT NULL, | ||
`to_time` int(11) NOT NULL | ||
) ENGINE=MyISAM DEFAULT CHARSET=latin1 | ||
]] | ||
|
||
SUPERUP = { | ||
msg = { | ||
naoDisponivel = "Essa cave está ocupada pelo jogador %s até %d.", | ||
disponivel = "Parabéns, você comprou uma cave do Super UP!", | ||
naoDisponivel = "Essa cave está ocupada pelo jogador %s até %s.", | ||
disponivel = "Parabéns, você comprou uma cave do Super UP com duração de %d %s!", | ||
naoItem = "Você precisa de uma %s para comprar uma cave.", | ||
tempoAcabou = "O seu tempo de Super UP acabou!", | ||
possuiCave = "Você já possui uma cave do Super UP!", | ||
}, | ||
areas = { | ||
[1] = {nome = "Demon", entrada = Position(284, 223, 7), from = Position(284, 223, 7), to = Position(284, 223, 7)}, | ||
[1] = {nome = "Demon", entrada = Position(546, 1250, 7), from = Position(1008, 889, 7), to = Position(1030, 903, 7)}, | ||
}, | ||
setTime = 3, -- Em horas | ||
itemID = 8978, | ||
} | ||
|
||
function Player.hasCave(self) | ||
if self:getStorageValue(STORAGEVALUE_SUPERUP) >= 1 or self:getStorageValue(STORAGEVALUE_SUPERUP_TEMPO) > os.time() then | ||
self:sendCancelMessage(SUPERUP.possuiCave) | ||
self:getPosition():sendMagicEffect(CONST_ME_POFF) | ||
function SUPERUP:getCave(id) | ||
local resultCave = db.storeQuery("SELECT guid_player, to_time FROM exclusive_hunts WHERE `hunt_id` = " .. id) | ||
if not resultCave then | ||
return false | ||
end | ||
|
||
local caveOwner = result.getDataInt(resultCave, "guid_player") | ||
local caveTime = result.getDataLong(resultCave, "to_time") | ||
result.free(resultCave) | ||
|
||
return {dono = caveOwner, tempo = caveTime} | ||
end | ||
|
||
function SUPERUP:freeCave() | ||
freeCaves = {} | ||
local db = db.storeQuery("SELECT `hunt_id`, `to_time`, `guid_player` FROM exclusive_hunts") | ||
if not db then | ||
return false | ||
else | ||
return true | ||
end | ||
|
||
repeat | ||
local idHunt = result.getDataInt(db, "hunt_id") | ||
local tempoFinal = result.getDataLong(db, "to_time") | ||
local guidPlayer = result.getDataInt(db, "guid_player") | ||
result.free(db) | ||
|
||
table.insert(freeCaves, {idHunt, tempoFinal, guidPlayer}) | ||
|
||
until not result.next(db) | ||
return freeCaves | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,5 @@ | ||
function onUpdateDatabase() | ||
return false | ||
end | ||
print("> Updating database to version 30 (AutoLoot)") | ||
db.query("ALTER TABLE `players` ADD `autoloot` BLOB DEFAULT NULL") | ||
return true | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
function onUpdateDatabase() | ||
print("> Updating database to version 31 (Boost Creature)") | ||
db.query("CREATE TABLE `boost_creature` ( `name` VARCHAR(255) NOT NULL , `exp` INT(11) NOT NULL DEFAULT '0' , `loot` INT(11) NOT NULL DEFAULT '0' ) ENGINE = InnoDB;") | ||
db.query("INSERT INTO `boost_creature` (`name`, `exp`, `loot`) VALUES ('', '0', '0');") | ||
return true | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
function onUpdateDatabase() | ||
return false | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.