[Bug Fix] Fix Flag Updating with SetGMStatus() in Lua. (#2554)

# Notes
- Perl was sending `UpdateAdmin()` after `SetGMStatus()`, Lua wasn't, so only Perl was updating properly.
- Fix is to just put `UpdateAdmin()` inside `SetGMStatus()`.
This commit is contained in:
Kinglykrab
2022-11-19 22:05:01 -05:00
committed by GitHub
parent 5173a9179b
commit e2dfbeb116
5 changed files with 32 additions and 18 deletions
+14 -13
View File
@@ -1199,7 +1199,7 @@ void Client::ChannelMessageReceived(uint8 chan_num, uint8 language, uint8 lang_s
CheckEmoteHail(t, message);
if (DistanceNoZ(m_Position, t->GetPosition()) <= RuleI(Range, Say)) {
parse->EventNPC(EVENT_SAY, t, this, message, language);
if (RuleB(TaskSystem, EnableTaskSystem)) {
@@ -1680,19 +1680,18 @@ void Client::FriendsWho(char *FriendsString) {
}
}
void Client::UpdateAdmin(bool iFromDB) {
void Client::UpdateAdmin(bool from_database) {
int16 tmp = admin;
if (iFromDB)
if (from_database) {
admin = database.CheckStatus(account_id);
if (tmp == admin && iFromDB)
return;
}
if(m_pp.gm)
{
if (tmp == admin && from_database) {
return;
}
if (m_pp.gm) {
LogInfo("[{}] - [{}] is a GM", __FUNCTION__ , GetName());
// no need for this, having it set in pp you already start as gm
// and it's also set in your spawn packet so other people see it too
// SendAppearancePacket(AT_GM, 1, false);
petition_list.UpdateGMQueue();
}
@@ -10786,9 +10785,11 @@ void Client::RemoveItem(uint32 item_id, uint32 quantity)
}
}
void Client::SetGMStatus(int newStatus) {
if (Admin() != newStatus)
database.UpdateGMStatus(AccountID(), newStatus);
void Client::SetGMStatus(int16 new_status) {
if (Admin() != new_status) {
database.UpdateGMStatus(AccountID(), new_status);
UpdateAdmin();
}
}
void Client::ApplyWeaponsStance()