Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

improve: better player group flags management #942

Merged
merged 8 commits into from
May 9, 2023

Conversation

dudantas
Copy link
Member

@dudantas dudantas commented Mar 21, 2023

Description

This allows us to add or remove flags on specific players, for example, so that a certain player is not visible by a monster, or cannot drop loot at a certain time (for example, in a specific quest). Instead of the flags being determined globally, they can be set differently for each player, depending on our wishes.

Behaviour

Actual

Flags are defined globally, in groups.xml, and cannot be modified in a specific player.

Expected

We can now modify the flag in just one player, if we want.

Type of change

  • New feature (non-breaking change which adds functionality)

How Has This Been Tested

Try to add this for example in login.lua:

	local haveSkill = "no have"
	if player:getName() == "Druid Sample" then
		player:setGroupFlag(PlayerFlag_NotGainSkill)
	end
	if player:hasFlag(PlayerFlag_NotGainSkill) then
		haveSkill = "have"
	end
	Spdlog.info("player name: ".. player:getName().." flag: ".. haveSkill.."")

Change the name "Druid Sample" to the name of the player you want... When he logs in, he will have the flag of not advancing skill when attacking a monster. The same can be done to remove the flag.

Checklist

  • My code follows the style guidelines of this project
  • I have performed a self-review of my own code
  • I checked the PR checks reports
  • I have commented my code, particularly in hard-to-understand areas
  • I have made corresponding changes to the documentation
  • My changes generate no new warnings
  • I have added tests that prove my fix is effective or that my feature works

@dudantas dudantas force-pushed the improve-flags-management branch 3 times, most recently from 835afe5 to 24ad7f2 Compare March 21, 2023 01:52
@dudantas dudantas force-pushed the improve-flags-management branch from 63e199a to a55bddf Compare March 21, 2023 01:53
@sonarqubecloud
Copy link

SonarCloud Quality Gate failed.    Quality Gate failed

Bug A 0 Bugs
Vulnerability A 0 Vulnerabilities
Security Hotspot A 0 Security Hotspots
Code Smell A 0 Code Smells

0.0% 0.0% Coverage
13.5% 13.5% Duplication

@dudantas dudantas marked this pull request as draft March 24, 2023 21:19
@github-actions
Copy link
Contributor

This PR is stale because it has been open 45 days with no activity.

new talkactions:
/hasflag playername, flagname or number
/setflag playername, flagname or number
/removeflag playername, flagname or number

new string function:
string.trimSpace(str) or string:trimSpace()

documented the strings functions and moved from global.lua to string.lua
@dudantas dudantas force-pushed the improve-flags-management branch from 64a695a to 54444d1 Compare April 27, 2023 21:24
@dudantas dudantas marked this pull request as ready for review April 28, 2023 01:06
@github-actions github-actions bot removed the Stale No activity label Apr 28, 2023
@sonarqubecloud
Copy link

sonarqubecloud bot commented May 9, 2023

Kudos, SonarCloud Quality Gate passed!    Quality Gate passed

Bug A 0 Bugs
Vulnerability A 0 Vulnerabilities
Security Hotspot A 0 Security Hotspots
Code Smell A 0 Code Smells

0.0% 0.0% Coverage
0.0% 0.0% Duplication

@dudantas dudantas merged commit 6a0bb66 into opentibiabr:main May 9, 2023
luan pushed a commit that referenced this pull request Jul 11, 2023
This allows us to add or remove flags on specific players, for example, so that a certain player is not visible by a monster, or cannot drop loot at a certain time (for example, in a specific quest). Instead of the flags being determined globally, they can be set differently for each player, depending on our wishes.

New talkactions:
• /hasflag playername, flagname or number
• /setflag playername, flagname or number
• /removeflag playername, flagname or number

New string function:
string.trimSpace(str) or string:trimSpace()

Documented the strings functions and moved from global.lua to string.lua
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants