1
0
Fork 1
mirror of https://github.com/TES3MP/openmw-tes3mp.git synced 2025-01-15 19:49:54 +00:00
Commit graph

258 commits

Author SHA1 Message Date
David Cernat
6bf3a0be1e [General] Rename WorldPackets into ObjectPackets for clarity 2018-05-12 19:40:00 +03:00
David Cernat
d8b48f6cf4 [Client] Remove redundant container methods from CellController 2018-04-01 07:11:43 +03:00
David Cernat
5f6ddcfc59 [General] Rework container sync to prevent item duping
A main priority in TES3MP development is to avoid making major changes to OpenMW code, so as to avoid merge conflicts in the future. Whenever avoiding potential conflicts seems especially difficult for the proper implementation of a particular multiplayer feature, that multiplayer feature is often put off until later or partially implemented with the intent of being revisited in the future.

Container sync is the perfect example. Previously, the OpenMW code for container actions was kept exactly as it was, with clients unilaterally accepting their own container changes as per singleplayer-specific code, with only the addition that clients sent container packets every time they made a change in a container, packets which were then forwarded unquestioningly by the server to other players. This meant that two players clicking on the same item in a container at the same time both managed to take it, thus duplicating the item.

Immediately after the packets were already forwarded, server scripts were able to check for incorrect changes, such as the removal of more items than should have existed in a container, but they had to send their own packets that attempted to fix what had already been accepted on the initial client and then forwarded to all clients, which was quite onerous in some scenarios, such as when a player on a slow connection immediately dropped items in the world after taking them from a container (which is why the default TES3MP serverside scripts made no attempt at sending corrective packets at all, preferring to expect the matter to be solved in a later C++ implementation).

This commit fixes item duping in containers by preventing container actions from initially running on clients and by ending the automatic forwarding of container packets by the server. Instead, clients now send container packets that act as requests for container actions, and serverside scripts have to forward these requests themselves. In other words, without a matching Container event in the server's Lua scripts, players are completely unable to affect containers for themselves or for others.

To forward a received Container packet, the following line must be used in a Container event in the Lua scripts:

tes3mp.SendContainer(true, true)

When an invalid action count is used in a container request, the serverside scripts can amend it using the following new function:

tes3mp.SetReceivedContainerItemActionCount(objectIndex, itemIndex, actionCount)

Thus, the serverside scripts are able to allow only container actions that are correct based on their own recorded contents for that container.

The OpenMW code allowing unilateral container actions in mwgui/container.cpp is now prevented from executing. When a player's container request is returned to them, code in mwmp/WorldEvent.cpp simulates those container actions instead.
2018-03-26 19:27:36 +03:00
David Cernat
f746958afa [Client] Send enchantmentCharge for items added or removed in containers 2018-01-17 08:10:49 +02:00
David Cernat
07f0cc2b0e
Merge pull request #353 from OpenMW/master
Add OpenMW commits up to 4 Dec 2017
2017-12-04 04:38:38 +02:00
Andrei Kortunov
8decd35607 Fixes crash on quickload from the container menu (bug #4239) 2017-12-03 21:49:13 +04:00
David Cernat
2ba1c84cf7 Merge pull request #335 from OpenMW/master while resolving conflicts
# Conflicts:
#	apps/openmw/mwgui/container.cpp
2017-11-12 06:35:15 +02:00
Andrei Kortunov
03f129b53c remove redundant allowedToInsertItems() function from ItemModel 2017-11-11 11:58:22 +04:00
Andrei Kortunov
3694b6ec90 Move onClose() check to item models 2017-11-10 10:58:43 +04:00
Andrei Kortunov
ac33ff9482 Move onDropItem() check to item models 2017-11-10 10:58:43 +04:00
Andrei Kortunov
3604b73d60 Move onTakeItem() to item models 2017-11-10 10:58:40 +04:00
David Cernat
711c4d83da [Client] Fix build after recent OpenMW changes to GUI 2017-10-07 23:33:36 +03:00
David Cernat
38247ff086 Merge pull request #303 from OpenMW/master while resolving conflicts
# Conflicts:
#	apps/openmw/mwbase/dialoguemanager.hpp
#	apps/openmw/mwdialogue/dialoguemanagerimp.hpp
#	apps/openmw/mwgui/container.cpp
#	apps/openmw/mwgui/windowmanagerimp.cpp
#	apps/openmw/mwscript/dialogueextensions.cpp
2017-10-06 04:10:04 +03:00
Andrei Kortunov
1cb7ed5db1 Use owned tooltips for items in containers correctly 2017-10-04 12:13:45 +04:00
Andrei Kortunov
04452b0949 Use a pickpocket crime instead of theft when pickpocketing was failed 2017-09-30 20:11:53 +04:00
scrawl
64e27c032b Merge pull request #1481 from scrawl/keyfocus
WindowManager overhaul & improved keyboard support
2017-09-28 22:34:05 +00:00
scrawl
d58ff4a736 Remove obsolete Container GUI keyboard handling 2017-09-24 19:08:16 +02:00
scrawl
4fff2e2e34 Refactor exitCurrentGuiMode 2017-09-24 19:08:13 +02:00
scrawl
84657271c7 Improve WindowManager API with a generic way of passing a Ptr to the opened GUI window 2017-09-24 19:08:12 +02:00
scrawl
01391b7eed Rename WindowBase's open/close to onOpen/onClose 2017-09-24 19:08:12 +02:00
David Cernat
73e7aa838d Merge pull request #296 from OpenMW/master while resolving conflicts
# Conflicts:
#	apps/openmw/mwgui/container.cpp
2017-09-22 19:12:41 +03:00
Andrei Kortunov
4580024d76 Unequip all items from dead corpse when take all items (bug #4095) 2017-09-22 12:32:47 +04:00
David Cernat
e3929df38a Merge pull request #239 from OpenMW/master
Add OpenMW commits up to 14 Jul 2017
2017-07-15 09:13:04 +03:00
Andrei Kortunov
54b4d93f79 Added a special function for GUI sounds playing 2017-07-10 15:48:00 +04:00
David Cernat
5bd95628ce [Client] Send an ObjectDelete packet when disposing of corpses 2017-05-08 08:44:43 +03:00
David Cernat
9d2c5c3502 [General] Simplify structure of BaseEvent 2017-05-06 21:57:29 +03:00
David Cernat
a82646a130 [Client] Delineate tes3mp-only code more clearly, part 2 2017-04-24 19:46:12 +03:00
David Cernat
679e790d8d [Client] Rename WorldController into CellController to avoid confusion with Networking's WorldPacketController 2017-04-05 12:00:21 +03:00
David Cernat
9759764699 [Client] Clean up getting and resetting of WorldEvent 2017-04-05 09:04:41 +03:00
David Cernat
2bd81c3de0 [Client] Use mpNum for every WorldObject 2017-04-04 11:07:16 +03:00
Koncord
690211ad99 [General] Extract BaseEvent & BasePlayer from packets to functions
Move Send and Read functions to BasePacket
2017-03-06 18:40:07 +08:00
Koncord
cea1425db1 [Client] Remove redundant newlines & keep ~120 columns 2017-03-04 14:55:35 +08:00
David Cernat
a58601fb2b [Client] Delineate tes3mp-only code more clearly, part 1 2017-02-26 16:59:53 +02:00
David Cernat
ed2176c984 [Client] Reuse 1 BaseEvent over and over instead of creating new ones 2017-02-23 09:19:09 +02:00
David Cernat
a4526605a6 [General] Remove goldValue from ContainerItem because it is never useful 2017-02-20 12:31:11 +02:00
David Cernat
4f2b88df8a [General] Remove owner var from ContainerItem because it is always empty 2017-02-18 23:59:02 +02:00
David Cernat
3b604a432e [General] Restructure ID_CONTAINER to allow multiple containers at once 2017-02-15 20:14:25 +02:00
David Cernat
f02840d638 [Client] Fix log messages when sending ID_CONTAINER 2017-02-09 21:48:22 +02:00
David Cernat
e52823394c [Client] Use correct count for ID_CONTAINER when dropping items 2017-02-06 22:53:18 +02:00
David Cernat
d8a9a5f6c9 [General] Send item owner in ID_CONTAINER 2017-02-06 22:45:23 +02:00
David Cernat
3614b21e10 [General] Send charge and goldValue in ID_CONTAINER 2017-02-06 21:28:03 +02:00
David Cernat
e703dd42aa [Client] Rename LocalEvent into WorldEvent 2017-02-06 17:40:32 +02:00
David Cernat
1f03c12d96 [Client] See when other players use the Take All button with a container 2017-02-05 20:04:50 +02:00
David Cernat
d2c5a3387a [Client] See when other players add items to containers 2017-02-05 19:33:11 +02:00
David Cernat
9c76b805b2 [Client] Send ID_CONTAINER when starting to drag a container item 2017-02-04 21:33:50 +02:00
Koncord
9ca206dda9 Add hooks for containers 2016-12-16 17:27:19 +08:00
scrawl
f64bc3c7ef Pass the victim to commitCrime on pickpocket detection (Fixes #3424) 2016-06-06 23:50:22 +02:00
scrawl
763f647412 Add ItemModel::allowedToInsertItems 2016-03-05 19:53:24 +01:00
dteviot
77a1d947cc extracted MWMechanics::getPlayer() 2015-08-21 21:12:39 +12:00
scrawl
77f1387da8 Include cleanup 2015-07-18 20:36:28 +02:00
scrawl
e66e9916db Merge branch 'master' of https://github.com/OpenMW/openmw into osg
Conflicts:
	apps/opencs/CMakeLists.txt
	apps/opencs/model/doc/document.cpp
	apps/opencs/model/doc/document.hpp
2015-06-07 15:23:54 +02:00
Stanislav Bas
c40987338d Scrollbars don't save their positions between openings 2015-06-04 23:09:40 +03:00
scrawl
e23775e338 Fix -Woverloaded-virtual clang warnings 2015-06-04 20:31:28 +02:00
Rohit Nirmal
396fba7fa9 Silence -Wreorder warnings, and remove -Wno-reorder. 2015-05-21 22:46:44 -05:00
scrawl
aa6ebcd75c Change stolen items handling to match MW (Fixes #1443, Fixes #2290) 2015-02-05 04:18:43 +01:00
scrawl
4921c6ef9e Split window caption bars so that the caption can be transparent (Fixes #531)
Fix transparent window background not applying to the header bar (Fixes #2294)
2015-01-27 23:05:19 +01:00
scrawl
728b842e72 Use MyGUI::utility in favor of boost lexical_cast 2015-01-10 03:01:01 +01:00
scrawl
eecea4131f Reduce MyGUI includes 2015-01-10 02:50:43 +01:00
scrawl
4b704f665f Reduce includes, move DragAndDrop to separate file 2015-01-10 01:21:17 +01:00
scrawl
866fdfe8bd Crime system improvements
- If someone saw the crime, they will notify everyone else in range, even if the Alarm rating of the witness is 0.
- Pickpocket and selling stolen items now works properly, i.e. honors the victim's Alarm rating instead of always being reported.
2014-12-24 15:45:12 +01:00
scrawl
0dc9401269 Fix GUI crash due to outdated spells list 2014-12-15 20:20:17 +01:00
Nikolay Kasyanov
138e3032ce Fix: initialize boolean field with boolean value, not NULL 2014-10-11 10:07:01 +04:00
scrawl
cbc242d857 Move item count text to ItemWidget 2014-09-19 09:29:00 +02:00
Ragora
f250e3df4b Replaced old bound item checks that I knew of to use the new ItemStack::Flag_Bound bit 2014-09-13 18:48:41 -04:00
Ragora
74e1db3ac8 Minor Correction to existing conjured item logic 2014-09-11 01:00:39 -04:00
Ragora
69dbd6b30f Added checks for different bound item situations 2014-09-10 23:38:38 -04:00
Ragora
141755b473 Appears to have resolved the issue with unequipping conjured items and all possible error conditions deriving from being able to unequip them 2014-09-10 21:34:17 -04:00
scrawl
10a0e2434e Open inventory when activating an unconscious actor (Fixes #1848) 2014-08-26 03:06:23 +02:00
scrawl
715d357f24 Use a controller to move Drag&Drop widget with the mouse cursor 2014-08-01 17:14:35 +02:00
scrawl
5839691530 Check for container organic flag before checking weight (Fixes #1654) 2014-07-14 17:27:36 +02:00
scrawl
6cd739678a Fix dangling model pointer after reference cleanup (Fixes #1653) 2014-07-14 16:53:58 +02:00
scrawl
f2799ea1d9 Reset item model when reference is reset (Fixes #1628)
This caused crashes when the window was resized after the reference no longer exists (e.g. when a savegame is loaded)
2014-07-12 18:53:22 +02:00
scrawl
4f73e8bb71 Add items to player inventory upon drag start (Fixes #1507) 2014-06-16 02:52:25 +02:00
scrawl
6db936bb3a Refactor item icon code into ItemWidget (Fixes #1391)
- Removed duplicate code
 - Fixed missing magic backgrounds during item drag&drop
 - Change background texture used for HUD icons
2014-06-05 22:13:18 +02:00
Digmaster
e3e51324a4 Esc button exits all non-modal GUI windows 2014-05-26 23:13:37 -04:00
Emanuel Guevel
1e4a854433 Remove static method MWWorld::Class::get(&Ptr)
It was just adding a level of indirection to Ptr.getClass().
All the call were replaced by that instead. The number of lines changed
is important, but the change itself is trivial, so everything should be
fine. :)
2014-05-22 20:50:00 +02:00
scrawl
940a434479 Use ItemModel for moving items from a container to the world
Fixes owner not resetting when moving an item from a corpse to the world.
2014-05-16 03:19:38 +02:00
scrawl
93b76a603b Fixes #1100: Looting a corpse is no longer considered stealing 2014-04-27 06:08:08 +02:00
scrawl
c8c0e5de38 Fixed code issues found with unity build. Missing include guards, duplicated functions, ... 2014-03-16 23:49:06 +01:00
scrawl
1deb0a7cdf Savegame dialog: Set key focus to editbox 2014-02-01 18:42:01 +01:00
scrawl
ba27b693f8 Increase sneak skill on successful pickpocket 2014-01-13 10:18:03 +01:00
scrawl
d01f89b153 Rewrite some awful code 2014-01-11 00:24:21 +01:00
scrawl
9baa1bef78 Expell player from faction when committing a crime against a faction member 2014-01-08 19:26:03 +01:00
scrawl
098f9712f1 Add getPlayerPtr() utility method. Reduces dependencies a lot. 2014-01-08 18:39:44 +01:00
scrawl
3c0080d2c1 Implement theft detection 2014-01-07 19:58:17 +01:00
scrawl
c4ab2f417a Fix exception closing container window 2014-01-07 18:11:19 +01:00
scrawl
780bf5a2cd Implement pickpocket detection. Play a voiced dialogue entry when detected. 2014-01-07 03:01:33 +01:00
scrawl
b6bad969a0 Fix an issue with items that have no UI icon 2013-12-26 20:53:51 +01:00
scrawl
7eb1dcb682 Fix trade windows crashing after a new game 2013-11-16 22:29:40 +01:00
Emanuel Guevel
f428921b93 Always update the source container view on drag&drop
This fix the indicator not being displayed for items auto-equipped
after an other item is removed.
2013-11-10 02:45:17 +01:00
scrawl
c6d2d1999a Fix an item duplication glitch 2013-08-25 17:40:08 +02:00
scrawl
7a2d1cd8ce Security skill 2013-05-19 18:40:37 +02:00
scrawl
3cadb5918f Fix containers showing random items from my commit earlier 2013-05-17 14:11:02 +02:00
scrawl
8a3d3f954b NPC/creature persistence flag 2013-05-16 18:50:26 +02:00
scrawl
0c4a963132 Container UI rewrite 2013-05-11 18:38:27 +02:00
Britt Mathis
7eee86ab66 No more using namespace 2013-04-17 18:56:48 -04:00
Britt Mathis
60fadaeaf0 Cleaned up includes in implementation files 2013-04-16 20:16:22 -04:00
Britt Mathis
f7383905b7 Finally eliminated calls to MWBase::WindowManager in constructors 2013-04-10 14:46:21 -04:00
Britt Mathis
ce9bc6d9ba MwGui windowManager calls fixed to use MWBase::Environment::get().getWindowManager, filenames in MwGui now comply with naming conventions 2013-04-10 00:32:05 -04:00
scrawl
1a2daa3bc1 Merge branch 'master' of git://github.com/zinnschlag/openmw into companion 2013-03-31 14:50:03 +02:00