mirror of
https://github.com/EQEmu/Server.git
synced 2026-05-17 07:18:37 +00:00
[Rules] Update logic checks everywhere for FVNoDropFlag. (#2179)
* Update logic checks everywhere for FVNoDropFlag. FVNoDropFlag == 0 is disabled FVNoDropFlag == 1 is enabled for everyone FVNoDropFlag == 2 is enabled for Admin() >= Character:MinStatusForNoDropExemptions * Adding extra parenthesis to reduce ambiquity of order of operations for FVNoDropFlag checks * Move FVNoDropFlag checks into a helper function in emu_constants.cpp and make an enum for the possible values. Added console warning if setting is outside of allowed values. * Move to client scoped helper method Co-authored-by: Akkadius <akkadius1@gmail.com>
This commit is contained in:
+21
-1
@@ -156,13 +156,33 @@ void Client::SendLogServer()
|
||||
if(RuleB(World, IsGMPetitionWindowEnabled))
|
||||
l->enable_petition_wnd = 1;
|
||||
|
||||
if((RuleI(World, FVNoDropFlag) == 1 || RuleI(World, FVNoDropFlag) == 2) && GetAdmin() > RuleI(Character, MinStatusForNoDropExemptions))
|
||||
if (CanTradeFVNoDropItem()) {
|
||||
l->enable_FV = 1;
|
||||
}
|
||||
|
||||
QueuePacket(outapp);
|
||||
safe_delete(outapp);
|
||||
}
|
||||
|
||||
bool Client::CanTradeFVNoDropItem()
|
||||
{
|
||||
const int16 admin_status = GetAdmin();
|
||||
const int no_drop_flag = RuleI(World, FVNoDropFlag);
|
||||
const int no_drop_min_admin_status = RuleI(Character, MinStatusForNoDropExemptions);
|
||||
switch (no_drop_flag) {
|
||||
case FVNoDropFlagRule::Disabled:
|
||||
return false;
|
||||
case FVNoDropFlagRule::Enabled:
|
||||
return true;
|
||||
case FVNoDropFlagRule::AdminOnly:
|
||||
return admin_status >= no_drop_min_admin_status;
|
||||
default:
|
||||
LogWarning("Invalid value {0} set for FVNoDropFlag", no_drop_flag);
|
||||
return false;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
void Client::SendEnterWorld(std::string name)
|
||||
{
|
||||
char char_name[64] = { 0 };
|
||||
|
||||
Reference in New Issue
Block a user