-
Notifications
You must be signed in to change notification settings - Fork 85
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[added] Field faction change functionality when attacking an opposing
faction npc while not being the correct faction status Change-Id: Id5ff65e3f687d5537911ea77b4030be92fa2643e
- Loading branch information
Showing
6 changed files
with
173 additions
and
10 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
88 changes: 88 additions & 0 deletions
88
MMOCoreORB/src/server/zone/objects/player/sui/callbacks/FieldFactionChangeSuiCallback.h
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,88 @@ | ||
#ifndef FIELDFACTIONCHANGESUICALLBACK_H_ | ||
#define FIELDFACTIONCHANGESUICALLBACK_H_ | ||
|
||
#include "server/zone/objects/player/sui/SuiCallback.h" | ||
#include "server/zone/objects/player/FactionStatus.h" | ||
#include "engine/task/ScheduledTask.h" | ||
|
||
class FieldFactionChangeSuiCallback : public SuiCallback { | ||
private: | ||
int newStatus; | ||
public: | ||
FieldFactionChangeSuiCallback(ZoneServer* server, int status) | ||
: SuiCallback(server) { | ||
newStatus = status; | ||
} | ||
|
||
void run(CreatureObject* player, SuiBox* suiBox, uint32 eventIndex, Vector<UnicodeString>* args) { | ||
bool cancelPressed = (eventIndex == 1); | ||
|
||
if (cancelPressed || args->size() < 1) { | ||
player->sendSystemMessage("@gcw:abort_field_change"); // You cancel your factional change. | ||
return; | ||
} | ||
|
||
String arg1 = args->get(0).toString(); | ||
|
||
if (arg1.toLowerCase() != "yes") { | ||
player->sendSystemMessage("@gcw:abort_field_change"); // You cancel your factional change. | ||
return; | ||
} | ||
|
||
uint32 pvpStatusBitmask = player->getPvpStatusBitmask(); | ||
|
||
if (pvpStatusBitmask & CreatureFlag::CHANGEFACTIONSTATUS) | ||
return; | ||
|
||
ManagedReference<PlayerObject*> ghost = player->getPlayerObject(); | ||
|
||
if (ghost == NULL) | ||
return; | ||
|
||
int curStatus = ghost->getFactionStatus(); | ||
|
||
if (curStatus == newStatus) | ||
return; | ||
|
||
if (newStatus == FactionStatus::COVERT) { | ||
if (curStatus == FactionStatus::OVERT) { | ||
player->sendSystemMessage("@gcw:cannot_change_from_combatant_in_field"); // You cannot change you status to combatant in the field. Go talk to a faction recruiter. | ||
return; | ||
} | ||
|
||
player->sendSystemMessage("@gcw:handle_go_covert"); // You will be flagged as a Combatant in 30 seconds. | ||
player->setPvpStatusBitmask(CreatureFlag::CHANGEFACTIONSTATUS); | ||
|
||
ManagedReference<CreatureObject*> creo = player->asCreatureObject(); | ||
|
||
SCHEDULE_TASK_2(creo, newStatus, 30000, { | ||
if (creo_p != NULL) { | ||
Locker locker(creo_p); | ||
|
||
PlayerObject* ghost = creo_p->getPlayerObject(); | ||
|
||
if (ghost != NULL) | ||
ghost->setFactionStatus(newStatus_p); | ||
} | ||
}); | ||
} else if (newStatus == FactionStatus::OVERT) { | ||
player->sendSystemMessage("You will be flagged as Special Forces in 5 minutes."); // No string available for overt. | ||
player->setPvpStatusBitmask(CreatureFlag::CHANGEFACTIONSTATUS); | ||
|
||
ManagedReference<CreatureObject*> creo = player->asCreatureObject(); | ||
|
||
SCHEDULE_TASK_2(creo, newStatus, 300000, { | ||
if (creo_p != NULL) { | ||
Locker locker(creo_p); | ||
|
||
PlayerObject* ghost = creo_p->getPlayerObject(); | ||
|
||
if (ghost != NULL) | ||
ghost->setFactionStatus(newStatus_p); | ||
} | ||
}); | ||
} | ||
} | ||
}; | ||
|
||
#endif /* FIELDFACTIONCHANGESUICALLBACK_H_ */ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters