Skip to content

Commit

Permalink
Added not moveable action function (#319)
Browse files Browse the repository at this point in the history
Not moveable action id = 100
So that the item cannot be moved, just put this action id in the item
  • Loading branch information
dudantas authored Apr 19, 2022
1 parent 1f81077 commit 9c49c95
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 4 deletions.
16 changes: 12 additions & 4 deletions data/events/events.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,8 @@
<event class="Creature" method="onChangeOutfit" enabled="1" />
<event class="Creature" method="onDrainHealth" enabled="1" />
<event class="Creature" method="onHear" enabled="0" />
<event class="Creature" method="onTargetCombat" enabled="1" /><!-- removeCombatProtection on secure modes protection -->
<!-- onTargetCombat = remove combat protection on secure modes protection -->
<event class="Creature" method="onTargetCombat" enabled="1" />

<!-- Monster Methods -->
<event class="Monster" method="onDropLoot" enabled="1" />
Expand All @@ -26,12 +27,19 @@
<event class="Player" method="onLook" enabled="1" />
<event class="Player" method="onLookInBattleList" enabled="1" />
<event class="Player" method="onLookInShop" enabled="0" />
<event class="Player" method="onLookInTrade" enabled="1" />
<event class="Player" method="onLoseExperience" enabled="0" />
<event class="Player" method="onMoveCreature" enabled="1" />
<!-- onMoveItem = Protections on somes systems/items not moveable -->
<event class="Player" method="onMoveItem" enabled="1" />
<event class="Player" method="onReportBug" enabled="1" />
<event class="Player" method="onReportRuleViolation" enabled="1" />
<event class="Player" method="onRequestQuestLine" enabled="1" />
<event class="Player" method="onRequestQuestLog" enabled="1" />
<event class="Player" method="onStorageUpdate" enabled="1" />
<event class="Player" method="onTradeAccept" enabled="1" />
<event class="Player" method="onTurn" enabled="1" /><!-- Move with ( ctrl + arrows ) like to TFS 0.3.x : 0.4 -->
<event class="Player" method="onTradeRequest" enabled="1" />-->
<event class="Player" method="onTurn" enabled="1" />
<event class="Player" method="onCombat" enabled="1" />
<event class="Player" method="onRemoveCount" enabled="1" /><!-- Tibia 11 function -->

<event class="Player" method="onRemoveCount" enabled="1" />
</events>
10 changes: 10 additions & 0 deletions data/events/scripts/player.lua
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,12 @@ function Player:onLookInShop(itemType, count)
end

function Player:onMoveItem(item, count, fromPosition, toPosition, fromCylinder, toCylinder)
-- No move items with actionID = 100
if item:getActionId() == NOT_MOVEABLE_ACTION then
self:sendCancelMessage(RETURNVALUE_NOTPOSSIBLE)
return false
end

if toPosition.x ~= CONTAINER_POSITION then
return true
end
Expand Down Expand Up @@ -214,6 +220,10 @@ function Player:onTurn(direction)
end

function Player:onTradeRequest(target, item)
-- No trade items with actionID = 100
if item:getActionId() == NOT_MOVEABLE_ACTION then
return false
end
return true
end

Expand Down

0 comments on commit 9c49c95

Please sign in to comment.