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

feat: Scroll of Resurrection script #9

Open
wants to merge 6 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
44 changes: 29 additions & 15 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
## lua-recruit-a-friend
Lua script for Azerothcore with ElunaLua to connect accounts from different players and reward the recruiter for bringing active players.

## lua-scroll-of-resurrection
Lua script for Azerothcore with ElunaLua to connect accounts from different players and reward the recruiter for bringing back former, inactive players.

**Proudly hosted on [ChromieCraft](https://www.chromiecraft.com/)**
#### Find me on patreon: https://www.patreon.com/Honeys

Expand All @@ -16,43 +19,54 @@ The [acore_cms](https://github.com/azerothcore/acore-cms)-RAF-module supports th

## Admin usage:
Adjust the top part of the .lua file with the config flags. The most important decisions are:
- max duration of the raf link(default 30 days)
- target level for a succesful link and a reward to the recruiter
- check for same IP yes/no, auto end RAF if same IP yes/no (default check:yes, end: no)
- text for the RAF-reward mail (see Lua for defaults)
- max duration of the RAF/SOR-link(default 30 days)
- target level for a succesful link and a reward to the recruiter/resurrected
- check for same IP yes/no, auto end RAF/SOR if same IP yes/no (default check:yes, end: no)
- text for the RAF/SOR-reward mail(s) (see Lua for defaults)
- rewards as item id and amount (see Lua for defaults)
- maps to allow summoning to (default Eastern Kingdoms and Kalimdor)
- maps to allow summoning to (default Eastern Kingdoms, Kalimdor and Outland/Bloodelf+Draenei starting zones.)

`.bindraf $recruit $recruiter` binds the accounts to each other. It is advised to use this from SOAP during account creation. One recruiter can have multiple recruits. Restricted by `Config.minGMRankForBind`. Once the recruit reaches the target level, the recruiter will receive a reward based on their amount of already finished recruits. Target level, item and amount for certain reward levels are all config flags.
`.bindraf $recruit $recruiter` binds the accounts to each other for a RAF link. It is advised to use this from SOAP during account creation. One recruiter can have multiple recruits. Restricted by `Config.minGMRankForBind`. Once the recruit reaches the target level, the recruiter will receive a reward based on their amount of already finished recruits. Target level, item and amount for certain reward levels are all config flags.
`.bindsor $resurrected $recruiter` binds the accounts to each other for a SOR link.

The RAF creates a custom db scheme specified in the config flags. Inside the scheme is a table to store all current and past RAF links.
The RAF/SOR creates a custom db scheme specified in the config flags. Inside the scheme is a table to store all current and past RAF/SOR links.
- `time_stamp` is the moment of creation in UNIX-time
- `ip_abuse_counter` is increased everytime recruiter and recruit have the same IPs during login or summon
- `kick_counter` is increased everytime a player gets kicked because they reached the allowed number of actions specified in `Config.abuseTreshold`.
- `reward_level` stores how many recruiters of that account have succesfully reached the RAF link up to `Config.targetLevel`.
- all other columns in `recruit_a_friend_links` and `recruit_a_friend_rewards` are account id's
- `comment` is for maintaining queries and not used by the scripts at all
- all other columns in `recruit_a_friend_links` and `recruit_a_friend_rewards` as well as their SOR counterparts are account id's

Optionally:

`.forcebindraf $recruit $recruiter` same as .bindraf but ignores past binds. Previously unbound, succesful or timed out doesn't matter.
`.forcebindsor $recruit $recruiter` same as .bindsor but ignores past binds. Previously unbound, succesful or timed out doesn't matter.

## Player Usage:
- `.raf` prints your account id and also prints help
- `.raf help` prints your account id and also prints help
- `.raf list` shows the account ids of all your recruits
- `.raf summon` allows the recruiter so summon the recruit. The recruit can not summon.

Players have 30 days (config flag) to reach the target level (default 39). If they succeed, their recruiter gets a reward. There is a counter in place and rewards change with a higher amount of succesful recruits. Default rewards are pets, a bag and potions/elixirs.
- `.sor` prints your account id and also prints help
- `.sor help` prints your account id and also prints help
- `.sor list` shows the account ids of all accounts you've resurrected
- `.sor summon` allows the recruiter so summon the resurrected. The resurrected can not summon.

Players have 30 days (config flag) to reach the target level (default 55 for RAF, 60 for SOR).
For RAF, if the recruit succeeds, their recruiter gets a reward. There is a counter in place and rewards change with a higher amount of succesful recruits. Default rewards are pets, a bag and potions/elixirs.
For SOR, if the resurrected succeeds, both parties get a reward. Rewards for the resurrected player default to flasks and an 18-slot bag. Recruiter rewards align with the RAF system's defaults.


## Config:
See the lua file for a description of the config flags.


## Default settings/rewards:
- There should be an option in the account creation page to determine a recruiter account. Recruiters can type `.raf` to find out about their account id.
- Once connected, recruiters can summon their recruits without a limit. Abuse might lead to kicks which are logged.
- Using the same IP for recruiter and recruit is restricted by default and also prevents teleporting and is logged.
- Once a recruit reaches the target level of 39, their recruiter gains a reward. The default rewards are a Mini-Thor pet for the first recruit, a 14-slot bag for the second recruit, the Diablos-Stone pet for the fifth recruit and a Tyrael's Hilt pet for the 10th recruit to reach the target level of 39. For the 4th recruit, the 6th - 9th recruit and any recruit past 10, the recruiter will receive a set of 4 stacks of potions/elixirs.
- If the recruit fails to reach level 39 within 30 days, the RAF-link is removed at the next login.
- If the recruit and the recruiter share an IP, they receive a warning that "possible abuse was logged" at login. If they share an IP while trying to summon, the summoning is blocked and they also see the "possible abuse was logged" message.
- There should be an option in the account creation page to determine a recruiter account. Recruiters can type `.raf`/`.sor` to find out about their account id.
- Once connected, recruiters can summon their recruits/resurrecteds without a limit. Abuse might lead to kicks which are logged.
- Using the same IP for recruiter and recruit/resurrected is restricted by default and also prevents teleporting and is logged.
- For RAF only: Once a recruit reaches the target level of 55, their recruiter gains a reward. The default rewards are a Mini-Thor pet for the first recruit, a 14-slot bag for the second recruit, the Diablos-Stone pet for the fifth recruit and a Tyrael's Hilt pet for the 10th recruit to reach the target level of 55. For the 4th recruit, the 6th - 9th recruit and any recruit past 10, the recruiter will receive a set of 4 stacks of potions/elixirs.
- For SOR only: Once a recruit reaches the target level of 60, their recruiter gains a reward. The default rewards are a set of 4 stacks of potions/elixirs. The resurrected will gain a set of flasks and an 18-slot bag.
- If the recruit/resurrected fails to reach level 55/60 within 30 days, the RAF/SOR-links are removed at the next login.
- If the recruit/resurrected and the recruiter share an IP, they receive a warning that "possible abuse was logged" at login. If they share an IP while trying to summon, the summoning is blocked and they also see the "possible abuse was logged" message.
41 changes: 24 additions & 17 deletions RecruitAFriend.lua
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,8 @@ Config.displayLoginMessage = 1
Config.targetLevel = 55

-- set to 1 to grant always rested for premium past Config.targetLevel. Any other value including nil turns it off.
-- the same feature exists in the ScrollOfResurrection.lua. Only one of them is required to be 1. Setting both to 1 causes
-- additional load but yields no benefit.
Config.premiumFeature = 0

-- maximum number of RAF related command uses before a kick. Includes summon requests.
Expand All @@ -81,7 +83,7 @@ Config.mailStationery = 41
-- should links on the same IP be removed automatically on startup / reload?
Config.AutoKillSameIPLinks = 1

-- rewards towards the recruiter for certain amounts of recruits who reached the target level. If not defined for a level, send the whole set of default potions
-- rewards towards the recruiter for certain amounts of recruits who reached the target level. If not defined for a level, send the whole set of defaultRewards
Config_rewards[1] = 56806 -- Mini Thor , Pet which is bound to account
Config_rewards[3] = 14046 -- Runecloth Bag - 14-slot
Config_rewards[5] = 13584 -- Diablos Stone, Pet which is bound to account
Expand Down Expand Up @@ -111,7 +113,7 @@ table.insert(Config_maps, 0)
-- Kalimdor
table.insert(Config_maps, 1)
-- Outland
--table.insert(Config_maps, 530)
table.insert(Config_maps, 530)
-- Northrend
--table.insert(Config_maps, 571)
------------------------------------------
Expand Down Expand Up @@ -263,11 +265,7 @@ local function RAF_checkAbuse(accountId)
else
RAF_abuseCounter[accountId] = RAF_abuseCounter[accountId] + 1
end

if RAF_abuseCounter[accountId] > Config.abuseTreshold then
return true
end
return false
return RAF_abuseCounter[accountId] > Config.abuseTreshold
end

local function RAF_command(event, player, command, chatHandler)
Expand Down Expand Up @@ -323,7 +321,9 @@ local function RAF_command(event, player, command, chatHandler)

if player ~= nil then
if player:GetGMRank() < Config.minGMRankForBind then
if Config.printErrorsToConsole == 1 then PrintInfo("Account "..player:GetAccountId().." tried the .forcebindraf command without sufficient rights.") end
if Config.printErrorsToConsole == 1 then
PrintInfo("Account "..player:GetAccountId().." tried the .forcebindraf command without sufficient rights.")
end
return
end
end
Expand Down Expand Up @@ -452,14 +452,12 @@ local function RAF_command(event, player, command, chatHandler)
if RAF_sameIpCounter[summonPlayer:GetAccountId()] == nil then
RAF_sameIpCounter[summonPlayer:GetAccountId()] = 1
CharDBExecute('UPDATE `'..Config.customDbName..'`.`recruit_a_friend_links` SET ip_abuse_counter = '..RAF_sameIpCounter[summonPlayer:GetAccountId()]..' WHERE `account_id` = '..summonPlayer:GetAccountId()..';')
RAF_cleanup()
return false
else
RAF_sameIpCounter[summonPlayer:GetAccountId()] = RAF_sameIpCounter[summonPlayer:GetAccountId()] + 1
CharDBExecute('UPDATE `'..Config.customDbName..'`.`recruit_a_friend_links` SET ip_abuse_counter = '..RAF_sameIpCounter[summonPlayer:GetAccountId()]..' WHERE `account_id` = '..summonPlayer:GetAccountId()..';')
RAF_cleanup()
return false
end
RAF_cleanup()
return false
end
v:SummonPlayer(player)
end
Expand Down Expand Up @@ -526,8 +524,19 @@ local function RAF_command(event, player, command, chatHandler)
else
chatHandler:SendSysMessage('The RAF link is active and was activated at '..RAF_gmtime(RAF_timeStamp[commandArray[3]]))
end
chatHandler:SendSysMessage('Same IP counter: '..RAF_sameIpCounter[commandArray[3]])
chatHandler:SendSysMessage('Kick counter: '..RAF_kickCounter[commandArray[3]])

if RAF_sameIpCounter[commandArray[3]] then
chatHandler:SendSysMessage('Same IP counter: '..RAF_sameIpCounter[commandArray[3]])
else
chatHandler:SendSysMessage('Same IP counter: 0')
end

if RAF_kickCounter[commandArray[3]] then
chatHandler:SendSysMessage('Kick counter: '..RAF_kickCounter[commandArray[3]])
else
chatHandler:SendSysMessage('Kick counter: 0')
end

if RAF_rewardLevel[commandArray[3]] ~=nil then
chatHandler:SendSysMessage('Reward Level: '..RAF_rewardLevel[commandArray[3]])
else
Expand Down Expand Up @@ -562,10 +571,8 @@ local function RAF_login(event, player)
if RAF_timeStamp[accountId] <= 1 then
if RAF_timeStamp[accountId] == -1 and Config.premiumFeature == 1 then
player:SetRestBonus(RAF_xpPerLevel[player:GetLevel()])
return false
else
return false
end
return false
end

--reset abuse counter
Expand Down
Loading