mirror of
https://github.com/TES3MP/openmw-tes3mp.git
synced 2025-03-29 23:36:43 +00:00
[Client] Synchronize changes to gold pools from other services
This commit is contained in:
parent
3c51f1c23a
commit
94b211dd4f
5 changed files with 123 additions and 5 deletions
|
@ -6,6 +6,18 @@
|
|||
#include <MyGUI_ScrollView.h>
|
||||
#include <MyGUI_Gui.h>
|
||||
|
||||
/*
|
||||
Start of tes3mp addition
|
||||
|
||||
Include additional headers for multiplayer purposes
|
||||
*/
|
||||
#include "../mwmp/Main.hpp"
|
||||
#include "../mwmp/Networking.hpp"
|
||||
#include "../mwmp/ObjectList.hpp"
|
||||
/*
|
||||
End of tes3mp addition
|
||||
*/
|
||||
|
||||
#include "../mwbase/world.hpp"
|
||||
#include "../mwbase/environment.hpp"
|
||||
#include "../mwbase/mechanicsmanager.hpp"
|
||||
|
@ -135,7 +147,23 @@ void MerchantRepair::onRepairButtonClick(MyGUI::Widget *sender)
|
|||
|
||||
// add gold to NPC trading gold pool
|
||||
MWMechanics::CreatureStats& actorStats = mActor.getClass().getCreatureStats(mActor);
|
||||
actorStats.setGoldPool(actorStats.getGoldPool() + price);
|
||||
|
||||
/*
|
||||
Start of tes3mp change (major)
|
||||
|
||||
Don't unilaterally change the merchant's gold pool on our client and instead let the server do it
|
||||
*/
|
||||
//actorStats.setGoldPool(actorStats.getGoldPool() + price);
|
||||
|
||||
mwmp::ObjectList* objectList = mwmp::Main::get().getNetworking()->getObjectList();
|
||||
objectList->reset();
|
||||
objectList->packetOrigin = mwmp::CLIENT_GAMEPLAY;
|
||||
objectList->addObjectMiscellaneous(mActor, actorStats.getGoldPool() + price, actorStats.getLastRestockTime().getHour(),
|
||||
actorStats.getLastRestockTime().getDay());
|
||||
objectList->sendObjectMiscellaneous();
|
||||
/*
|
||||
End of tes3mp change (major)
|
||||
*/
|
||||
|
||||
setPtr(mActor);
|
||||
}
|
||||
|
|
|
@ -10,7 +10,9 @@
|
|||
Include additional headers for multiplayer purposes
|
||||
*/
|
||||
#include "../mwmp/Main.hpp"
|
||||
#include "../mwmp/Networking.hpp"
|
||||
#include "../mwmp/LocalPlayer.hpp"
|
||||
#include "../mwmp/ObjectList.hpp"
|
||||
/*
|
||||
End of tes3mp addition
|
||||
*/
|
||||
|
@ -182,7 +184,23 @@ namespace MWGui
|
|||
|
||||
// add gold to NPC trading gold pool
|
||||
MWMechanics::CreatureStats& npcStats = mPtr.getClass().getCreatureStats(mPtr);
|
||||
npcStats.setGoldPool(npcStats.getGoldPool() + price);
|
||||
|
||||
/*
|
||||
Start of tes3mp change (major)
|
||||
|
||||
Don't unilaterally change the merchant's gold pool on our client and instead let the server do it
|
||||
*/
|
||||
//npcStats.setGoldPool(npcStats.getGoldPool() + price);
|
||||
|
||||
mwmp::ObjectList* objectList = mwmp::Main::get().getNetworking()->getObjectList();
|
||||
objectList->reset();
|
||||
objectList->packetOrigin = mwmp::CLIENT_GAMEPLAY;
|
||||
objectList->addObjectMiscellaneous(mPtr, npcStats.getGoldPool() + price, npcStats.getLastRestockTime().getHour(),
|
||||
npcStats.getLastRestockTime().getDay());
|
||||
objectList->sendObjectMiscellaneous();
|
||||
/*
|
||||
End of tes3mp change (major)
|
||||
*/
|
||||
|
||||
setPtr(mPtr, mSpellsView->getViewOffset().top);
|
||||
|
||||
|
|
|
@ -419,7 +419,23 @@ namespace MWGui
|
|||
|
||||
// add gold to NPC trading gold pool
|
||||
MWMechanics::CreatureStats& npcStats = mPtr.getClass().getCreatureStats(mPtr);
|
||||
npcStats.setGoldPool(npcStats.getGoldPool() + price);
|
||||
|
||||
/*
|
||||
Start of tes3mp change (major)
|
||||
|
||||
Don't unilaterally change the merchant's gold pool on our client and instead let the server do it
|
||||
*/
|
||||
//npcStats.setGoldPool(npcStats.getGoldPool() + price);
|
||||
|
||||
mwmp::ObjectList* objectList = mwmp::Main::get().getNetworking()->getObjectList();
|
||||
objectList->reset();
|
||||
objectList->packetOrigin = mwmp::CLIENT_GAMEPLAY;
|
||||
objectList->addObjectMiscellaneous(mPtr, npcStats.getGoldPool() + price, npcStats.getLastRestockTime().getHour(),
|
||||
npcStats.getLastRestockTime().getDay());
|
||||
objectList->sendObjectMiscellaneous();
|
||||
/*
|
||||
End of tes3mp change (major)
|
||||
*/
|
||||
|
||||
MWBase::Environment::get().getWindowManager()->playSound ("Mysticism Hit");
|
||||
|
||||
|
|
|
@ -2,6 +2,18 @@
|
|||
|
||||
#include <MyGUI_Gui.h>
|
||||
|
||||
/*
|
||||
Start of tes3mp addition
|
||||
|
||||
Include additional headers for multiplayer purposes
|
||||
*/
|
||||
#include "../mwmp/Main.hpp"
|
||||
#include "../mwmp/Networking.hpp"
|
||||
#include "../mwmp/ObjectList.hpp"
|
||||
/*
|
||||
End of tes3mp addition
|
||||
*/
|
||||
|
||||
#include "../mwbase/windowmanager.hpp"
|
||||
#include "../mwbase/environment.hpp"
|
||||
#include "../mwbase/world.hpp"
|
||||
|
@ -166,7 +178,23 @@ namespace MWGui
|
|||
|
||||
// add gold to NPC trading gold pool
|
||||
MWMechanics::NpcStats& npcStats = mPtr.getClass().getNpcStats(mPtr);
|
||||
npcStats.setGoldPool(npcStats.getGoldPool() + price);
|
||||
|
||||
/*
|
||||
Start of tes3mp change (major)
|
||||
|
||||
Don't unilaterally change the merchant's gold pool on our client and instead let the server do it
|
||||
*/
|
||||
//npcStats.setGoldPool(npcStats.getGoldPool() + price);
|
||||
|
||||
mwmp::ObjectList* objectList = mwmp::Main::get().getNetworking()->getObjectList();
|
||||
objectList->reset();
|
||||
objectList->packetOrigin = mwmp::CLIENT_GAMEPLAY;
|
||||
objectList->addObjectMiscellaneous(mPtr, npcStats.getGoldPool() + price, npcStats.getLastRestockTime().getHour(),
|
||||
npcStats.getLastRestockTime().getDay());
|
||||
objectList->sendObjectMiscellaneous();
|
||||
/*
|
||||
End of tes3mp change (major)
|
||||
*/
|
||||
|
||||
// advance time
|
||||
MWBase::Environment::get().getMechanicsManager()->rest(2, false);
|
||||
|
|
|
@ -6,6 +6,18 @@
|
|||
|
||||
#include <components/settings/settings.hpp>
|
||||
|
||||
/*
|
||||
Start of tes3mp addition
|
||||
|
||||
Include additional headers for multiplayer purposes
|
||||
*/
|
||||
#include "../mwmp/Main.hpp"
|
||||
#include "../mwmp/Networking.hpp"
|
||||
#include "../mwmp/Worldstate.hpp"
|
||||
/*
|
||||
End of tes3mp addition
|
||||
*/
|
||||
|
||||
#include "../mwbase/environment.hpp"
|
||||
#include "../mwbase/world.hpp"
|
||||
#include "../mwbase/windowmanager.hpp"
|
||||
|
@ -160,7 +172,23 @@ namespace MWGui
|
|||
|
||||
// add gold to NPC trading gold pool
|
||||
MWMechanics::CreatureStats& npcStats = mPtr.getClass().getCreatureStats(mPtr);
|
||||
npcStats.setGoldPool(npcStats.getGoldPool() + price);
|
||||
|
||||
/*
|
||||
Start of tes3mp change (major)
|
||||
|
||||
Don't unilaterally change the merchant's gold pool on our client and instead let the server do it
|
||||
*/
|
||||
//npcStats.setGoldPool(npcStats.getGoldPool() + price);
|
||||
|
||||
mwmp::ObjectList* objectList = mwmp::Main::get().getNetworking()->getObjectList();
|
||||
objectList->reset();
|
||||
objectList->packetOrigin = mwmp::CLIENT_GAMEPLAY;
|
||||
objectList->addObjectMiscellaneous(mPtr, npcStats.getGoldPool() + price, npcStats.getLastRestockTime().getHour(),
|
||||
npcStats.getLastRestockTime().getDay());
|
||||
objectList->sendObjectMiscellaneous();
|
||||
/*
|
||||
End of tes3mp change (major)
|
||||
*/
|
||||
|
||||
MWBase::Environment::get().getWindowManager()->fadeScreenOut(1);
|
||||
ESM::Position pos = *_sender->getUserData<ESM::Position>();
|
||||
|
|
Loading…
Reference in a new issue