Skip to content

Commit

Permalink
Merge pull request #1469 from WibbenZ/cleanup
Browse files Browse the repository at this point in the history
Cleanup
  • Loading branch information
marksamman committed Aug 9, 2015
2 parents e7da87c + 6948d99 commit 6eb07a6
Show file tree
Hide file tree
Showing 255 changed files with 1,178 additions and 1,314 deletions.
6 changes: 3 additions & 3 deletions cmake/FindLua.cmake
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# Locate Lua library
# This module defines
# LUA_EXECUTABLE, if found
# LUA_FOUND, if false, do not try to link to Lua
# LUA_FOUND, if false, do not try to link to Lua
# LUA_LIBRARIES
# LUA_INCLUDE_DIR, where to find lua.h
# LUA_VERSION_STRING, the version of Lua found (since CMake 2.8.8)
Expand Down Expand Up @@ -72,7 +72,7 @@ FIND_PATH(LUA_INCLUDE_DIR lua.h
)

# Find the lua library
FIND_LIBRARY(LUA_LIBRARY
FIND_LIBRARY(LUA_LIBRARY
NAMES ${_POSSIBLE_LUA_LIBRARY}
HINTS
$ENV{LUA_DIR}
Expand Down Expand Up @@ -108,7 +108,7 @@ IF(LUA_INCLUDE_DIR AND EXISTS "${LUA_INCLUDE_DIR}/lua.h")
ENDIF()

INCLUDE(FindPackageHandleStandardArgs)
# handle the QUIETLY and REQUIRED arguments and set LUA_FOUND to TRUE if
# handle the QUIETLY and REQUIRED arguments and set LUA_FOUND to TRUE if
# all listed variables are TRUE
FIND_PACKAGE_HANDLE_STANDARD_ARGS(Lua
REQUIRED_VARS LUA_LIBRARIES LUA_INCLUDE_DIR
Expand Down
176 changes: 88 additions & 88 deletions data/XML/outfits.xml

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion data/XML/stages.xml
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,4 @@
<stage minlevel="21" maxlevel="50" multiplier="5" />
<stage minlevel="51" maxlevel="100" multiplier="4" />
<stage minlevel="101" multiplier="5" />
</stages>
</stages>
2 changes: 1 addition & 1 deletion data/actions/lib/actions.lua
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ function destroyItem(player, target, toPosition)
-- Move items outside the container
if target:isContainer() then
for i = target:getSize() - 1, 0, -1 do
local containerItem = target:getItem(i)
local containerItem = target:getItem(i)
if containerItem then
containerItem:moveTo(toPosition)
end
Expand Down
14 changes: 7 additions & 7 deletions data/actions/scripts/other/bed_modification_kits.lua
Original file line number Diff line number Diff line change
@@ -1,23 +1,23 @@
local BEDS = {
local beds = {
[7904] = {{7811, 7812}, {7813, 7814}}, -- green kit
[7905] = {{7819, 7820}, {7821, 7822}}, -- yellow kit
[7906] = {{7815, 7816}, {7817, 7818}}, -- red kit
[7907] = {{1754, 1755}, {1760, 1761}}, -- removal kit
[7907] = {{1754, 1755}, {1760, 1761}}, -- removal kit
[20252] = {{20197, 20198}, {20199, 20200}} -- canopy kit
}

local function internalBedTransform(item, targetItem, toPosition, ids)
targetItem:transform(ids[1])
local function internalBedTransform(item, targetItem, toPosition, itemArray)
targetItem:transform(itemArray[1])
targetItem:getPosition():sendMagicEffect(CONST_ME_POFF)

Tile(toPosition):getItemByType(ITEM_TYPE_BED):transform(ids[2])
Tile(toPosition):getItemByType(ITEM_TYPE_BED):transform(itemArray[2])
toPosition:sendMagicEffect(CONST_ME_POFF)

item:remove()
end

function onUse(player, item, fromPosition, target, toPosition, isHotkey)
local newBed = BEDS[item:getId()]
local newBed = beds[item:getId()]
if not newBed or target == nil or not target:isItem() then
return false
end
Expand All @@ -33,7 +33,7 @@ function onUse(player, item, fromPosition, target, toPosition, isHotkey)
return true
end

for _, bed in pairs(BEDS) do
for _, bed in pairs(beds) do
if bed[1][1] == targetItemId or isInArray({1758, 5502, 18027}, targetItemId) then
toPosition:sendMagicEffect(CONST_ME_POFF)
toPosition.y = toPosition.y + 1
Expand Down
4 changes: 2 additions & 2 deletions data/actions/scripts/other/dice.lua
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@ function onUse(player, item, fromPosition, target, toPosition, isHotkey)
position:sendMagicEffect(CONST_ME_CRAPS, isInGhostMode and player)

local spectators = Game.getSpectators(position, false, true, 3, 3)
for _, pid in ipairs(spectators) do
player:say(player:getName() .. " rolled a " .. value .. ".", TALKTYPE_MONSTER_SAY, isInGhostMode, pid, position)
for _, spectator in ipairs(spectators) do
player:say(player:getName() .. " rolled a " .. value .. ".", TALKTYPE_MONSTER_SAY, isInGhostMode, spectator, position)
end

item:transform(5791 + value)
Expand Down
6 changes: 3 additions & 3 deletions data/actions/scripts/other/fireworksrocket.lua
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@ function onUse(player, item, fromPosition, target, toPosition, isHotkey)
if fromPosition.x ~= CONTAINER_POSITION then
fromPosition:sendMagicEffect(math.random(CONST_ME_FIREWORK_YELLOW, CONST_ME_FIREWORK_BLUE))
else
local pos = player:getPosition()
pos:sendMagicEffect(CONST_ME_HITBYFIRE)
pos:sendMagicEffect(CONST_ME_EXPLOSIONAREA)
local position = player:getPosition()
position:sendMagicEffect(CONST_ME_HITBYFIRE)
position:sendMagicEffect(CONST_ME_EXPLOSIONAREA)
player:say("Ouch! Rather place it on the ground next time.", TALKTYPE_MONSTER_SAY)
player:addHealth(-10)
end
Expand Down
4 changes: 2 additions & 2 deletions data/actions/scripts/other/food.lua
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
local FOODS = {
local foods = {
[2362] = {5, "Crunch."}, -- carrot
[2666] = {15, "Munch."}, -- meat
[2667] = {12, "Munch."}, -- fish
Expand Down Expand Up @@ -99,7 +99,7 @@ local FOODS = {
}

function onUse(player, item, fromPosition, target, toPosition, isHotkey)
local food = FOODS[item.itemid]
local food = foods[item.itemid]
if food == nil then
return false
end
Expand Down
2 changes: 1 addition & 1 deletion data/actions/scripts/other/potions.lua
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,7 @@ function onUse(player, item, fromPosition, target, toPosition, isHotkey)
item:remove(1)
player:addItem(greatEmptyPot, 1)
elseif itemId == greatHealthPot then
if (not isInArray({4, 8}, target:getVocation():getId()) or target:getLevel() < 80) and not getPlayerFlagValue(player, PlayerFlag_IgnoreSpellCheck) then
if (not isInArray({4, 8}, target:getVocation():getId()) or target:getLevel() < 80) and not getPlayerFlagValue(player, PlayerFlag_IgnoreSpellCheck) then
player:say("This potion can only be consumed by knights of level 80 or higher.", TALKTYPE_MONSTER_SAY)
return true
end
Expand Down
9 changes: 6 additions & 3 deletions data/actions/scripts/other/spellbook.lua
Original file line number Diff line number Diff line change
@@ -1,17 +1,19 @@
function onUse(player, item, fromPosition, target, toPosition, isHotkey)
local count = getPlayerInstantSpellCount(player)
local text = ""
local t = {}
local spells = {}
for i = 0, count - 1 do
local spell = getPlayerInstantSpellInfo(player, i)
if spell.level ~= 0 then
if spell.manapercent > 0 then
spell.mana = spell.manapercent .. "%"
end
t[#t+1] = spell
spells[#spells + 1] = spell
end
end
table.sort(t, function(a, b) return a.level < b.level end)

table.sort(spells, function(a, b) return a.level < b.level end)

local prevLevel = -1
for i, spell in ipairs(t) do
local line = ""
Expand All @@ -24,6 +26,7 @@ function onUse(player, item, fromPosition, target, toPosition, isHotkey)
end
text = text .. line .. " " .. spell.words .. " - " .. spell.name .. " : " .. spell.mana .. "\n"
end

player:showTextDialog(item:getId(), text)
return true
end
11 changes: 8 additions & 3 deletions data/actions/scripts/other/surprisebag.lua
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
local config = {
local presents = {
[6570] = { -- blue present
{2687, 10}, {6394, 3}, 6280, 6574, 6578, 6575, 6577, 6569, 6576, 6572, 2114
},
Expand All @@ -9,10 +9,15 @@ local config = {

function onUse(player, item, fromPosition, target, toPosition, isHotkey)
local count = 1
local gift = present[math.random(#present)]
local targetItem = presents[item.itemid]
if not targetItem then
return true
end

local gift = targetItem[math.random(#targetItem)]
if type(gift) == "table" then
count = gift[2]
gift = gift[1]
count = gift[2]
end

player:addItem(gift, count)
Expand Down
2 changes: 1 addition & 1 deletion data/actions/scripts/other/windows.lua
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,6 @@ function onUse(player, item, fromPosition, target, toPosition, isHotkey)
return false
end

item:transform(window)
item:transform(window)
return true
end
10 changes: 5 additions & 5 deletions data/actions/scripts/quests/annihilator.lua
Original file line number Diff line number Diff line change
Expand Up @@ -14,19 +14,19 @@ local newPosition = {
function onUse(player, item, fromPosition, target, toPosition, isHotkey)
if item.itemid == 1945 then
local players = {}
for _, pos in ipairs(playerPosition) do
local topPlayer = Tile(pos):getTopCreature()
for _, position in ipairs(playerPosition) do
local topPlayer = Tile(position):getTopCreature()
if topPlayer == nil or not topPlayer:isPlayer() or topPlayer:getLevel() < 100 or topPlayer:getStorageValue(30015) ~= -1 then
player:sendTextMessage(MESSAGE_STATUS_SMALL, Game.getReturnMessage(RETURNVALUE_NOTPOSSIBLE))
return false
end
players[#players + 1] = topPlayer
end

for i, tmpPlayer in ipairs(players) do
for i, targetPlayer in ipairs(players) do
Position(playerPosition[i]):sendMagicEffect(CONST_ME_POFF)
tmpPlayer:teleportTo(newPosition[i], false)
tmpPlayer:getPosition():sendMagicEffect(CONST_ME_ENERGYAREA)
targetPlayer:teleportTo(newPosition[i], false)
targetPlayer:getPosition():sendMagicEffect(CONST_ME_ENERGYAREA)
end
item:transform(1946)
elseif item.itemid == 1946 then
Expand Down
6 changes: 3 additions & 3 deletions data/actions/scripts/tools/shovel.lua
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,10 @@ function onUse(player, item, fromPosition, target, toPosition, isHotkey)
target:transform(target.itemid + 1)
target:decay()
elseif target.itemid == 231 then
local rand = math.random(1, 100)
if rand == 1 then
local randomValue = math.random(1, 100)
if randomValue == 1 then
Game.createItem(2159, 1, toPosition)
elseif rand > 95 then
elseif randomValue > 95 then
Game.createMonster("Scarab", toPosition)
end
toPosition:sendMagicEffect(CONST_ME_POFF)
Expand Down
2 changes: 1 addition & 1 deletion data/globalevents/lib/globalevents.lua
Original file line number Diff line number Diff line change
@@ -1 +1 @@
-- empty file --
-- empty file --
2 changes: 1 addition & 1 deletion data/globalevents/scripts/record.lua
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
function onRecord(current, old)
addEvent(broadcastMessage, 150, "New record: " .. current .. " players are logged in.", MESSAGE_STATUS_DEFAULT)
return true
end
end
6 changes: 3 additions & 3 deletions data/items/items.xml
Original file line number Diff line number Diff line change
Expand Up @@ -25660,7 +25660,7 @@
<item id="18559" article="an" name="adventurer's stone">
<attribute key="weight" value="30" />
<attribute key="description" value="Use it in major temples to travel to the adventurers guild. A replacement is available at temples." />
</item>
</item>
<item fromid="18560" toid="18579" name="muddy floor" />
<item fromid="18580" toid="18590" name="swamp">
<attribute key="type" value="trashholder" />
Expand Down Expand Up @@ -29360,11 +29360,11 @@
<item id="21564" article="a" name="flask mushroom fertilizer">
<attribute key="weight" value="180" />
<attribute key="description" value="It holds a liquid concentrate developed by the gnomes to fertilise mushrooms." />
</item>
</item>
<item id="21565" article="a" name="gardener mushroom"/>
<item id="21566" article="a" name="partially charged lodestone">
<attribute key="weight" value="300" />
</item>
</item>
<item id="21567" article="a" name="magnetic monolith"/>
<item id="21568" article="a" name="highly charged lodestone">
<attribute key="weight" value="300" />
Expand Down
2 changes: 1 addition & 1 deletion data/monster/Annelids/drillworm.xml
Original file line number Diff line number Diff line change
Expand Up @@ -63,4 +63,4 @@
<item id="18417" chance="9260" /><!-- brown crystal splinter -->
<item id="18418" chance="9610" /><!-- blue crystal splinter -->
</loot>
</monster>
</monster>
2 changes: 1 addition & 1 deletion data/monster/Arachnids/wailing widow.xml
Original file line number Diff line number Diff line change
Expand Up @@ -60,4 +60,4 @@
<item id="11323" chance="2210" /><!-- zaoan halberd -->
<item id="2381" chance="4460" /><!-- halberd -->
</loot>
</monster>
</monster>
2 changes: 1 addition & 1 deletion data/monster/Barbarians/barbarian skullhunter.xml
Original file line number Diff line number Diff line change
Expand Up @@ -52,4 +52,4 @@
<item id="7462" chance="100" /><!-- ragnir helmet -->
<item id="7457" chance="120" /><!-- fur boots -->
</loot>
</monster>
</monster>
2 changes: 1 addition & 1 deletion data/monster/Bio-Elementals/hideous fungus.xml
Original file line number Diff line number Diff line change
Expand Up @@ -85,4 +85,4 @@
<item id="18454" chance="60" /><!-- mycological bow -->
<item id="18393" chance="20" /><!-- mushroom backpack -->
</loot>
</monster>
</monster>
2 changes: 1 addition & 1 deletion data/monster/Bio-Elementals/humorless fungus.xml
Original file line number Diff line number Diff line change
Expand Up @@ -56,4 +56,4 @@
<voice sentence="Munch munch munch!" />
<voice sentence="Chatter" />
</voices>
</monster>
</monster>
2 changes: 1 addition & 1 deletion data/monster/Bio-Elementals/mechanical fighter.xml
Original file line number Diff line number Diff line change
Expand Up @@ -28,4 +28,4 @@
<immunity earth="1" />
<immunity invisible="1" />
</immunities>
</monster>
</monster>
2 changes: 1 addition & 1 deletion data/monster/Birds/berserker chicken.xml
Original file line number Diff line number Diff line change
Expand Up @@ -49,4 +49,4 @@
<loot>
<item id="2148" countmax="100" chance="50000" /><!-- gold coins -->
</loot>
</monster>
</monster>
2 changes: 1 addition & 1 deletion data/monster/Birds/demon parrot.xml
Original file line number Diff line number Diff line change
Expand Up @@ -43,4 +43,4 @@
<loot>
<item id="2148" countmax="99" chance="50000" /><!-- gold coins -->
</loot>
</monster>
</monster>
2 changes: 1 addition & 1 deletion data/monster/Birds/marsh stalker.xml
Original file line number Diff line number Diff line change
Expand Up @@ -42,4 +42,4 @@
<item id="7732" chance="120" /><!-- seeds -->
<item id="2120" chance="4530" /><!-- rope -->
</loot>
</monster>
</monster>
2 changes: 1 addition & 1 deletion data/monster/Birds/seagull.xml
Original file line number Diff line number Diff line change
Expand Up @@ -20,4 +20,4 @@
<attack name="melee" interval="2000" skill="10" attack="3" />
</attacks>
<defenses armor="5" defense="5" />
</monster>
</monster>
2 changes: 1 addition & 1 deletion data/monster/Bonelords/eye of the seven.xml
Original file line number Diff line number Diff line change
Expand Up @@ -35,4 +35,4 @@
<immunity drunk="1" />
<immunity outfit="1" />
</immunities>
</monster>
</monster>
2 changes: 1 addition & 1 deletion data/monster/Bonelords/gazer.xml
Original file line number Diff line number Diff line change
Expand Up @@ -42,4 +42,4 @@
<item id="2148" countmax="16" chance="65000" /><!-- gold coin -->
<item id="12468" chance="3330" /><!-- small flask of eyedrops -->
</loot>
</monster>
</monster>
2 changes: 1 addition & 1 deletion data/monster/Bosses/Bazir.xml
Original file line number Diff line number Diff line change
Expand Up @@ -154,4 +154,4 @@
<item id="2185" countmax="1" chance="3500" />
<item id="2143" countmax="15" chance="12500" />
</loot>
</monster>
</monster>
2 changes: 1 addition & 1 deletion data/monster/Bosses/Coldheart.xml
Original file line number Diff line number Diff line change
Expand Up @@ -30,4 +30,4 @@
<immunity ice="1" />
<immunity fire="1" />
</immunities>
</monster>
</monster>
2 changes: 1 addition & 1 deletion data/monster/Bosses/Doomhowl.xml
Original file line number Diff line number Diff line change
Expand Up @@ -37,4 +37,4 @@
<immunity paralyze="1" />
<immunity invisible="1" />
</immunities>
</monster>
</monster>
2 changes: 1 addition & 1 deletion data/monster/Bosses/Infernatil.xml
Original file line number Diff line number Diff line change
Expand Up @@ -133,4 +133,4 @@
<item id="2188" countmax="1" chance="2500" />
<item id="2143" countmax="15" chance="12500" />
</loot>
</monster>
</monster>
2 changes: 1 addition & 1 deletion data/monster/Bosses/Kraknaknork Demon.xml
Original file line number Diff line number Diff line change
Expand Up @@ -43,4 +43,4 @@
<item id="2148" countmax="86" chance="48025" /><!-- gold coin -->
<item id="2148" chance="24400" /><!-- gold ingot -->
</loot>
</monster>
</monster>
2 changes: 1 addition & 1 deletion data/monster/Bosses/Zoralurk.xml
Original file line number Diff line number Diff line change
Expand Up @@ -85,4 +85,4 @@
<item id="2195" chance="16033" /><!-- Boots of Haste -->
<item id="2408" chance="6000" /><!-- Warlord Sword -->
</loot>
</monster>
</monster>
Loading

0 comments on commit 6eb07a6

Please sign in to comment.