void HandleTogglePvP(TogglePvP packet) { if (GetPlayer().HasPlayerFlag(PlayerFlags.InPVP)) { GetPlayer().RemovePlayerFlag(PlayerFlags.InPVP); GetPlayer().AddPlayerFlag(PlayerFlags.PVPTimer); if (!GetPlayer().pvpInfo.IsHostile && GetPlayer().IsPvP()) GetPlayer().pvpInfo.EndTimer = Time.UnixTime; // start toggle-off } else { GetPlayer().AddPlayerFlag(PlayerFlags.InPVP); GetPlayer().RemovePlayerFlag(PlayerFlags.PVPTimer); if (!GetPlayer().IsPvP() || GetPlayer().pvpInfo.EndTimer != 0) GetPlayer().UpdatePvP(true, true); } }
void HandleTogglePvP(TogglePvP packet) { if (!GetPlayer().HasPlayerFlag(PlayerFlags.InPVP)) { GetPlayer().AddPlayerFlag(PlayerFlags.InPVP); GetPlayer().RemovePlayerFlag(PlayerFlags.PVPTimer); if (!GetPlayer().IsPvP() || GetPlayer().pvpInfo.EndTimer != 0) { GetPlayer().UpdatePvP(true, true); } } else if (!GetPlayer().IsWarModeLocalActive()) { GetPlayer().RemovePlayerFlag(PlayerFlags.InPVP); GetPlayer().AddPlayerFlag(PlayerFlags.PVPTimer); if (!GetPlayer().pvpInfo.IsHostile&& GetPlayer().IsPvP()) { GetPlayer().pvpInfo.EndTimer = GameTime.GetGameTime() + 300; // start toggle-off } } }
void HandleTogglePvP(TogglePvP packet) { Player player = GetPlayer(); bool inPvP = player.HasFlag(PlayerFields.Flags, PlayerFlags.InPVP); player.ApplyModFlag(PlayerFields.Flags, PlayerFlags.InPVP, !inPvP); player.ApplyModFlag(PlayerFields.Flags, PlayerFlags.PVPTimer, inPvP); if (player.HasFlag(PlayerFields.Flags, PlayerFlags.InPVP)) { if (!player.IsPvP() || player.pvpInfo.EndTimer != 0) { player.UpdatePvP(true, true); } } else { if (!player.pvpInfo.IsHostile && player.IsPvP()) { player.pvpInfo.EndTimer = Time.UnixTime; // start toggle-off } } }