mirror of
https://github.com/DarkflameUniverse/DarkflameServer.git
synced 2025-10-14 19:38:08 +00:00
Organize dScripts (#814)
* Organize dScripts whitespace Remove parent scope Remove parent scope from initial setter Remove debug Remove helper programs * Fix NtImagimeterVisibility script Co-authored-by: aronwk-aaron <aronwk.aaron@gmail.com>
This commit is contained in:
39
dScripts/02_server/Map/AG/RemoveRentalGear.cpp
Normal file
39
dScripts/02_server/Map/AG/RemoveRentalGear.cpp
Normal file
@@ -0,0 +1,39 @@
|
||||
#include "RemoveRentalGear.h"
|
||||
#include "InventoryComponent.h"
|
||||
#include "Item.h"
|
||||
#include "Character.h"
|
||||
|
||||
/*
|
||||
--------------------------------------------------------------
|
||||
--Removes the rental gear from the player on mission turn in
|
||||
--
|
||||
--created mrb ... 5 / 25 / 11
|
||||
--updated abeechler 6 / 27 / 11 ... Add session flag resetting for set equips
|
||||
--ported Max 21/07/2020
|
||||
--------------------------------------------------------------
|
||||
--add missionID configData to the object in HF to remove this
|
||||
--gear what the specified mission is completed
|
||||
--------------------------------------------------------------
|
||||
*/
|
||||
|
||||
void RemoveRentalGear::OnMissionDialogueOK(Entity* self, Entity* target, int missionID, MissionState missionState) {
|
||||
if (missionID != defaultMission && missionID != 313) return;
|
||||
|
||||
if (missionState == MissionState::MISSION_STATE_COMPLETE || missionState == MissionState::MISSION_STATE_READY_TO_COMPLETE) {
|
||||
auto inv = static_cast<InventoryComponent*>(target->GetComponent(COMPONENT_TYPE_INVENTORY));
|
||||
if (!inv) return;
|
||||
|
||||
//remove the inventory items
|
||||
for (int item : gearSets) {
|
||||
auto* id = inv->FindItemByLot(item);
|
||||
if (id) {
|
||||
inv->UnEquipItem(id);
|
||||
inv->RemoveItem(id->GetLot(), id->GetCount());
|
||||
}
|
||||
}
|
||||
|
||||
//reset the equipment flag
|
||||
auto character = target->GetCharacter();
|
||||
if (character) character->SetPlayerFlag(equipFlag, false);
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user