-
Notifications
You must be signed in to change notification settings - Fork 325
Some fixes events, configkey, optional stages, xp gain rate #2692
Conversation
Resolves opentibiabr/otservbr-global#2464 ## global.lua & statup.lua - moved form `global.lua -> globalevents\others\startup.lua` all events rates variables. `getEventSSkill, getEventSExp and getEventSLoot` now load after events module. - set `GlobalStorage.XpDisplayMode -> 1` ## player.lua - Fixed `onGainExperience`; Added `preyBonus & staminaBoost` variable. now use simple rule of 3... Rat: if 5 exp --- 100% | ? exp --- 150% so... 5 / 100 * 150 = 7(BaseXpGain + etc) see https://www.tibiawiki.com.br/wiki/Rat ## lib\core\functions.lua - `getLootRandom` approximate to real tibia. - `getRateFromTable` when doesn't have stages, return default. ## exercise_training.lua - deleted unnecessary variables; if not reused. - added `SCHEDULE_SKILL_RATE` to calculate exp. ## configmanager.cpp & configmanager.h - added `RATE_USE_STAGES` boolean config `rateUseStages = true`. - fixed `RATE_EXPERIENCE`. - set base rates to 1. ## creaturescript\others\login.lua - fixed `setBaseXpGain`, now work with events too. ## spawn.cpp & spawn.h - fixed interval spawn time. - when the spawn time is less than `MINSPAWN_INTERVAL`, addMonster with min value. - now `interval` to `30000`, less check time. ## game.cpp, scripts\luascript.cpp & protocolstatus.cpp - some fixes ## src\otserv.cpp & config.lua.dist - On/Off stagesExp(def: true). - set rates to 1 ## events.xml - changed date for test. - can use exprate="0", with any argument (this reduce the rate to 0, but not the exp). NOTE: exprate, lootrate, spawnrate or skillrate in 100, it's default value.
## spawn.cpp - use std: max instead. (Test done: event active, spawnrate="0" and force 1)
## Some fixes - the code is reduced to improve readability. - `setBaseXpGain` now in `advance_save.lua` file for reduce calls. - `advance_save.lua` unused code removed.
## solved issue opentibiabr/otservbr-global#2522 ## events can set rate to 0? true. ## player.lua - exp and skill rates not less than 0. ## global.lua - added `SCHEDULE_SPAWN_RATE`. ## exercise_training.lua - `SCHEDULE_SKILL_RATE` removed.. this one uses `onGainSkillTries`. ## advance_save.lua - exp rate not less than 0. ## login.lua - exp rate not less than 0. - added msg for rapid respawn. ## startup.lua - get event schedule, spawn rate. ## luascript.cpp - added `getEventSSpawnRate & luaGamegetEventSSpawnRate` ## luascript.h - added `luaGamegetEventSSpawnRate`.
i check it work only have problems on stages on magic level rates |
what kind of problem?... |
no work -- Minlevel and multiplier are MANDATORY
-- Maxlevel is OPTIONAL, but is considered infinite by default
-- Create a stage with minlevel 1 and no maxlevel to disable stages
experienceStages = {
{
minlevel = 1,
maxlevel = 50,
multiplier = 15
},
{
minlevel = 51,
maxlevel = 100,
multiplier = 13
},
{
minlevel = 101,
maxlevel = 200,
multiplier = 10
},
{
minlevel = 201,
maxlevel = 400,
multiplier = 8
},
{
minlevel = 401,
maxlevel = 600,
multiplier = 6
},
{
minlevel = 601,
multiplier = 4
}
}
skillsStages = {
{
minlevel = 1,
multiplier = 50
}
}
magicLevelStages = {
{
minlevel = 1,
multiplier = 25
}
} Level and Skills work perfecly only magic only read from config.lua |
It works perfectly for me... Edit: tested in ML 123 to 124. skillsStages = {
{
minlevel = 0,
maxlevel = 1,
multiplier = 700
}, {
minlevel = 2,
multiplier = 1
}
}
magicLevelStages = {
{
minlevel = 0,
maxlevel = 123,
multiplier = 700
}, {
minlevel = 124,
multiplier = 1
}
} |
i test and all ok only require remarge changes |
## configmanager.cpp, exercise_training.lua & player.lua - restore changes. # config.lua.dist & configmanager.cpp - `rateUseStages` false by default.
Tested and working. |
always it appears at half_ |
%50.... exp. |
The repository that submitted this pull request has been deleted. This changes need to be submitted again in a new pull request. |
Ok I'll do it! |
Can I do it or leave it to you? |
Yes you can. It makes it easier for me, as there are other things I need to do in the repository. |
Behaviour
Actual
Issues opentibiabr/otservbr-global#2464
On login you have one "XP Gain Rate", when you get experience this value changed.
Event schedule only display info, but doesn't work.
Expected
Formulae Tibia Wiki
Fixes
global.lua & statup.lua
global.lua -> globalevents\others\startup.lua
all events rates variables.getEventSSkill, getEventSExp and getEventSLoot
now load after events module.GlobalStorage.XpDisplayMode -> 1
player.lua
onGainExperience
; AddedpreyBonus & staminaBoost
variable.now use simple rule of 3...
Rat: if 5 exp --- 100% | ? exp --- 150% so... 5 / 100 * 150 = 7(BaseXpGain + etc) see Rat
lib\core\functions.lua
getLootRandom
approximate to real tibia.getRateFromTable
when doesn't have stages, return default.exercise_training.lua
SCHEDULE_SKILL_RATE
to calculate exp.configmanager.cpp & configmanager.h
RATE_USE_STAGES
boolean configrateUseStages = true
.RATE_EXPERIENCE
.creaturescript\others\login.lua
setBaseXpGain
, now work with events too.spawn.cpp & spawn.h
MINSPAWN_INTERVAL
, addMonster with min value.interval
to30000
, less check time.game.cpp, scripts\luascript.cpp & protocolstatus.cpp
src\otserv.cpp & config.lua.dist
events.xml
NOTE: exprate, lootrate, spawnrate or skillrate in 100, it's default value.
Type of change
How Has This Been Tested
Test Configuration:
Checklist