Skip to content

Commit

Permalink
Improve code and cleanups:
Browse files Browse the repository at this point in the history
- Added custom scripts: firebug, lotteryticket, musicbox, partytrumpet, premiumscroll, voodoodoll
- Added custom commands: save, pos, attr, addons, mounts
- Added Lua functions for player chase, secure and fight mode (TFT)
- Added Game.getVersion (table) (TFT)
- Fix missing and negated conditions on looktype.lua (TFT)
- Move bug report to Lua (TFT)
- Move summon/illusion creature to Lua (TFT)
- Remove compat function from swimming.lua (TFC)
- Update Party spells (TFC)
  • Loading branch information
mattyx14 committed Jan 19, 2017
1 parent e120f19 commit 7d93ba8
Show file tree
Hide file tree
Showing 34 changed files with 358 additions and 339 deletions.
8 changes: 8 additions & 0 deletions CHANGELOG
Original file line number Diff line number Diff line change
Expand Up @@ -76,24 +76,32 @@
How use all configs from TFT / OTX "WIP" - /configHelp
- Added condition type immunity check (TFC)
- Added spell methods to Lua (TFC)
- Added missing custom scripts and commands
- Added set NPCs to idle state when no player is in range (TFT)
- Added Lua functions for player chase, secure and fight mode (TFT)
- Added Game.getVersion (table) (TFT)
- Fix MoveItem and storeInbox on 10.x // 11 (Eternal-Scripts)
- Fix compiler errors on 8.7x
- Fix features from: Xeraphus(Monster:onSpawn) - Mkalo(Bank Account of Premium Accounts) - (brunominervino)
- Fix blood splashes on pz tiles (TFC)
- Fix Disallow setting mounts for unsupported outfits(TFT)
- Fix onStep callback return value matter (TFC)
- Fix allowfaruse (TFC)
- Fix missing and negated conditions on looktype.lua (TFT)
- Move findPerson to Lua (TFC)
- Move doSet*Outfit functions to Lua (TFC)
- Move house management function to Lua scripts (TFT)
- Move reload to talkactions (TFC)
- Move bug report to Lua (TFT)
- Move summon creature to Lua (TFT)
- Improve code and cleanups (TFT)
- Remove player from attack list upon death (TFC)
- Remove support to clientVersion 11_ - aka10
- Remove compat function from swimming.lua (TFC)
- Updated spells (TFC)
- Updated enchantingScript (TFC)
- Updated monsters (TFT)
- Updated Party spells (TFC)
]

[ OTX Server 3.8 :: Version " LEZICK "
Expand Down
21 changes: 16 additions & 5 deletions path_10_9/data/actions/actions.xml
Original file line number Diff line number Diff line change
Expand Up @@ -270,6 +270,10 @@
actions.lua
quest.lua
teleport.lua
fluids.lua
potions.lua
doors.lua
"tools scripts"
-->

<!-- Quests -->
Expand Down Expand Up @@ -314,9 +318,16 @@
<action itemid="20138" script="_scripts_otx/taming.lua" />
<action itemid="22608" script="_scripts_otx/taming.lua" />

<!-- Spellbooks -->
<action itemid="12647" script="_scripts_otx/spellbook.lua" />
<action itemid="16112" script="_scripts_otx/spellbook.lua" />
<action itemid="18401" script="_scripts_otx/spellbook.lua" />
<action fromid="22422" toid="22424" script="_scripts_otx/spellbook.lua" />
<!-- Others -->
<action itemid="3955" script="_scripts_otx/voodoodoll.lua" />
<action itemid="5468" script="_scripts_otx/firebug.lua" />
<action itemid="5957" script="_scripts_otx/lotteryticket.lua" />
<action itemid="6572" script="_scripts_otx/partytrumpet.lua" />
<action itemid="16101" script="_scripts_otx/premiumscroll.lua" />
<action itemid="18511" script="_scripts_otx/musicbox.lua" />

<action itemid="12647" script="other/spellbook.lua" />
<action itemid="16112" script="other/spellbook.lua" />
<action itemid="18401" script="other/spellbook.lua" />
<action fromid="22422" toid="22424" script="other/spellbook.lua" />
</actions>
11 changes: 0 additions & 11 deletions path_10_9/data/actions/scripts/other/hive_doors1.lua

This file was deleted.

11 changes: 0 additions & 11 deletions path_10_9/data/actions/scripts/other/hive_doors2.lua

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,9 +1,7 @@
function onUse(player, item, fromPosition, target, toPosition, isHotkey)
local count = getPlayerInstantSpellCount(player)
local text = ""
local spells = {}
for i = 0, count - 1 do
local spell = getPlayerInstantSpellInfo(player, i)
for _, spell in ipairs(player:getInstantSpells()) do
if spell.level ~= 0 then
if spell.manapercent > 0 then
spell.mana = spell.manapercent .. "%"
Expand Down
108 changes: 0 additions & 108 deletions path_10_9/data/actions/scripts/valuables/randomitems.lua

This file was deleted.

1 change: 1 addition & 0 deletions path_10_9/data/events/events.xml
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
<event class="Player" method="onLookInShop" enabled="0" />
<event class="Player" method="onMoveItem" enabled="1" />
<event class="Player" method="onMoveCreature" enabled="0" />
<event class="Player" method="onReport" enabled="1" />
<event class="Player" method="onTurn" enabled="1" />
<event class="Player" method="onTradeRequest" enabled="1" />
<event class="Player" method="onTradeAccept" enabled="0" />
Expand Down
32 changes: 32 additions & 0 deletions path_10_9/data/events/scripts/player.lua
Original file line number Diff line number Diff line change
Expand Up @@ -214,6 +214,38 @@ function Player:onMoveItem(item, count, fromPosition, toPosition, fromCylinder,
return true
end

function Player:onMoveCreature(creature, fromPosition, toPosition)
return true
end

function Player:onReport(message, position, category)
if self:getAccountType() == ACCOUNT_TYPE_NORMAL then
return false
end

local name = self:getName()
local file = io.open("data/reports/" .. name .. " report.txt", "a")

if not file then
self:sendTextMessage(MESSAGE_EVENT_DEFAULT, "There was an error when processing your report, please contact a gamemaster.")
return true
end

io.output(file)
io.write("------------------------------\n")
io.write("Name: " .. name)
if category == BUG_CATEGORY_MAP then
io.write(" [Map position: " .. position.x .. ", " .. position.y .. ", " .. position.z .. "]")
end
local playerPosition = self:getPosition()
io.write(" [Player Position: " .. playerPosition.x .. ", " .. playerPosition.y .. ", " .. playerPosition.z .. "]\n")
io.write("Comment: " .. message .. "\n")
io.close(file)

self:sendTextMessage(MESSAGE_EVENT_DEFAULT, "Your report has been sent to " .. configManager.getString(configKeys.SERVER_NAME) .. ".")
return true
end

function Player:onTurn(direction)
if self:getGroup():getAccess() and self:getDirection() == direction then
local nextPosition = self:getPosition()
Expand Down
9 changes: 1 addition & 8 deletions path_10_9/data/lib/compat/compat.lua
Original file line number Diff line number Diff line change
Expand Up @@ -1019,14 +1019,7 @@ function getPlayerInstantSpellInfo(cid, spellId)
return false
end

return {
["name"] = spell:getName(),
["words"] = spell:getWords(),
["level"] = spell:getLevel(),
["mlevel"] = spell:getMagicLevel(),
["mana"] = spell:getManaCost(player),
["manapercent"] = spell:getManaPercent()
}
return spell
end

function doSetItemOutfit(cid, item, time) local c = Creature(cid) return c ~= nil and c:setItemOutfit(item, time) end
Expand Down
6 changes: 4 additions & 2 deletions path_10_9/data/movements/scripts/swimming.lua
Original file line number Diff line number Diff line change
@@ -1,11 +1,13 @@
local outfit = {lookType = 267, lookHead = 0, lookBody = 0, lookLegs = 0, lookFeet = 0, lookTypeEx = 0, lookAddons = 0}
local condition = Condition(CONDITION_OUTFIT)
condition:setOutfit({lookType = 267})
condition:setTicks(-1)

function onStepIn(creature, item, position, fromPosition)
if not creature:isPlayer() then
return false
end

doSetCreatureOutfit(creature, outfit, -1)
creature:addCondition(condition)
return true
end

Expand Down
7 changes: 3 additions & 4 deletions path_10_9/data/spells/lib/spells.lua
Original file line number Diff line number Diff line change
Expand Up @@ -301,10 +301,10 @@ function Creature:addDamageCondition(target, conditionType, listType, damage, ti
return true
end

function Creature:addPartyCondition(combat, variant, condition, baseMana)
function Player:addPartyCondition(combat, variant, condition, baseMana)
local party = self:getParty()
if not party then
self:sendCancelMessage("No party members in range.")
self:sendCancelMessage(RETURNVALUE_NOPARTYMEMBERSINRANGE)
self:getPosition():sendMagicEffect(CONST_ME_POFF)
return false
end
Expand All @@ -321,7 +321,7 @@ function Creature:addPartyCondition(combat, variant, condition, baseMana)
end

if #affectedMembers <= 1 then
self:sendCancelMessage("No party members in range.")
self:sendCancelMessage(RETURNVALUE_NOPARTYMEMBERSINRANGE)
position:sendMagicEffect(CONST_ME_POFF)
return false
end
Expand All @@ -347,4 +347,3 @@ function Creature:addPartyCondition(combat, variant, condition, baseMana)
end
return true
end

2 changes: 1 addition & 1 deletion path_10_9/data/spells/scripts/party/enchant.lua
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
local combat = Combat()
combat:setParameter(COMBAT_PARAM_EFFECT, CONST_ME_MAGIC_BLUE)
combat:setParameter(COMBAT_PARAM_AGGRESSIVE, false)
combat:setArea(createCombatArea(AREA_CIRCLE5X5))
combat:setArea(createCombatArea(AREA_CIRCLE3X3))

local condition = Condition(CONDITION_ATTRIBUTES)
condition:setParameter(CONDITION_PARAM_SUBID, 3)
Expand Down
2 changes: 1 addition & 1 deletion path_10_9/data/spells/scripts/party/heal.lua
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
local combat = Combat()
combat:setParameter(COMBAT_PARAM_EFFECT, CONST_ME_MAGIC_BLUE)
combat:setParameter(COMBAT_PARAM_AGGRESSIVE, false)
combat:setArea(createCombatArea(AREA_CIRCLE5X5))
combat:setArea(createCombatArea(AREA_CIRCLE3X3))

local condition = Condition(CONDITION_REGENERATION)
condition:setParameter(CONDITION_PARAM_SUBID, 4)
Expand Down
2 changes: 1 addition & 1 deletion path_10_9/data/spells/scripts/party/protect.lua
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
local combat = Combat()
combat:setParameter(COMBAT_PARAM_EFFECT, CONST_ME_MAGIC_BLUE)
combat:setParameter(COMBAT_PARAM_AGGRESSIVE, false)
combat:setArea(createCombatArea(AREA_CIRCLE5X5))
combat:setArea(createCombatArea(AREA_CIRCLE3X3))

local condition = Condition(CONDITION_ATTRIBUTES)
condition:setParameter(CONDITION_PARAM_SUBID, 2)
Expand Down
2 changes: 1 addition & 1 deletion path_10_9/data/spells/scripts/party/train.lua
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
local combat = Combat()
combat:setParameter(COMBAT_PARAM_EFFECT, CONST_ME_MAGIC_BLUE)
combat:setParameter(COMBAT_PARAM_AGGRESSIVE, false)
combat:setArea(createCombatArea(AREA_CIRCLE5X5))
combat:setArea(createCombatArea(AREA_CIRCLE3X3))

local condition = Condition(CONDITION_ATTRIBUTES)
condition:setParameter(CONDITION_PARAM_SUBID, 1)
Expand Down
23 changes: 23 additions & 0 deletions path_10_9/data/spells/scripts/support/illusion.lua
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
local condition = Condition(CONDITION_OUTFIT)
condition:setTicks(180000)

function onCastSpell(creature, variant)
local returnValue = RETURNVALUE_NOERROR
local monsterType = MonsterType(variant:getString())
if not monsterType then
returnValue = RETURNVALUE_CREATUREDOESNOTEXIST
elseif not getPlayerFlagValue(creature, PlayerFlag_CanIllusionAll) and not monsterType:isIllusionable() then
returnValue = RETURNVALUE_NOTPOSSIBLE
end

if returnValue ~= RETURNVALUE_NOERROR then
creature:sendCancelMessage(returnValue)
creature:getPosition():sendMagicEffect(CONST_ME_POFF)
return false
end

condition:setOutfit(monsterType:getOutfit())
creature:addCondition(condition)
creature:getPosition():sendMagicEffect(CONST_ME_MAGIC_RED)
return true
end
Loading

0 comments on commit 7d93ba8

Please sign in to comment.