Post by Phantomeis on Nov 16, 2018 2:11:56 GMT
This will give some inside of how awards are treated inside the medal_data.py and the database.
First a example award from medal_data.py:
#Recon Service Badge
('101_1', 'rsb', LIMIT_SINGLE, object_stat ('kits', 'kills', KIT_TYPE_RECON, 12), 20),
('101_2', 'rsb', LIMIT_SINGLE, f_and( has_medal ('101_1'),
global_stat ('ktt-0', 5400),
object_stat ('kits', 'kills', KIT_TYPE_RECON, 20)), 500),
('101_3', 'rsb', LIMIT_SINGLE, f_and( has_medal ('101_2'),
global_stat ('ktt-0', 18000),
object_stat ('kits', 'kills', KIT_TYPE_RECON, 30)), 1000),
So there is much stuff here.
The first comment states what award logic we have here. Then we got 101_1 which is the award numbering,underscore _1 to _3 means bronze, silver or gold version.
Award numbering from medal_data.py:
Awards are getting saved as a three character number like 411 or for awards with bronze/silver/gold levels as a five character number like 414_1.
The number on the most left is called "aType", meaning award Type, this is like a group.
There are four awardtypes ingame:
1 = Badges (Squares)
2 = Medals (Rectangles)
3 = Ribbons (Flat Things)
4 = Pins (Round Things)
The middle and most right number (so everything from 00 till 99) represents the "aID", meaning award ID.
This is the number inside the group or aType of the awards, counting up as they go.
So award 414 is aType=4, aID=14 -> Clear skies Pin
aid = Award ID from 1 to 99
pid = ID of the soldier holding the award (refer to as playerID)
atype = Award type, can be a number from 1 to 4 (1 = Badges, 2 = Medals, 3 = Ribbons, 4 = Pins)
alvl = award level, always 1 or higher (not earned awards arent recored in the database to begin with)
for badges it is bronze, silver or gold (1,2,3)
for pins it is the number of times you earned the pin
for medals it is the number of times earned (for purple hearth, bronze/silver/goldstar) or IF earned (eg. Distinguished Service Medal), so 1 and up
for ribbons its simply if you have earned it, so "1" for earned
earned = last time this very award got rewarded to this soldier in unixtime

Information regarding stats calculation, mainly global kills, kills with weapons, playtime, time played as <class> etc.
are written in tables called stats_a(awards), stats_e(etc), stats_m(maps), stats_v(vehicles, doesnt work, dont bother with it), stats_w(weapons).
The place where specific information is stored and also gathered from differes on an every reward.
stats_a:
A stands for awards, but not the awards in form of medals or pins, just the points for different tasts a player achieved in a round.
This means total kills, heals, repairs, captured flags, time as commander/ in squad, lonewolf etc.
Awards like purple hearth get their information from this table to see what you k/d is.
Round-stats like "Best Squad" come from here too.
stats_e:
This one saves a lot of nothing and then TOTAL times a soldier died/killed someone in what kit.
So kills and death on a per kit basis are recorded, but the kit-names need explanation as they do differ from the unlcoks-table!
So kdths-0 for example means Kit-death-0, 0 being Recon-class.
kkls-2 for example means Kit-Kills-2, 2 being pioneer.
kit-0 = recon
kit-1 = assault
kit-2 = pioneer
kit-3 = support
stats_m:
This table hold information of each played Map/Round per soldier from the point on the database was created.
It holds information on the map and its gamemode, with total time/kills/points/death/wins/losses on this map.
Awards from NorthernStrike for example use this table to read if a soldier completed all maps on every side in x amount of time.
stats_v:
This table records vehicle-stats on a per soldier basis.
Or it should, FESL simply doesnt interpret this information and so we will never get Armored Vehicle Medals and such since the server cant look up if you already met the requirements.
Sad.
stats_w:
This table records weaponstats on a per soldier basis.
This includes time used, kill, got killed, accuracy etc. for every weapon.
The game renders your weaponstats you may watch ingame at the BFHQ using this data.
As far as i know very few awards use these, except for the pistol Badge.
This badge has requirements of total time and total kills using pistols, on top of that a number of kills in a round.
Information from the first two comes from this table.
Known bugs:
You will unlock the bronze badges many times, although they should only be rewarded once.
This only happens when you have earned the silver badge of a given badge.
why?: As the alvl of a bronze badge will get up by 1 (being alvl 2 after that, meaning silver),
the database entry for the already earned alvl 1 badge is "missing", so the pythonfiles guess that you dont have bronze.
So they will reward bronze again, this also will give you the 20 points, so thats cool.




#Recon Service Badge
('101_1', 'rsb', LIMIT_SINGLE, object_stat ('kits', 'kills', KIT_TYPE_RECON, 12), 20),
('101_2', 'rsb', LIMIT_SINGLE, f_and( has_medal ('101_1'),
global_stat ('ktt-0', 5400),
object_stat ('kits', 'kills', KIT_TYPE_RECON, 20)), 500),
('101_3', 'rsb', LIMIT_SINGLE, f_and( has_medal ('101_2'),
global_stat ('ktt-0', 18000),
object_stat ('kits', 'kills', KIT_TYPE_RECON, 30)), 1000),
So there is much stuff here.
The first comment states what award logic we have here. Then we got 101_1 which is the award numbering,underscore _1 to _3 means bronze, silver or gold version.
'rsb' being a shortname, LIMIT_SINGLE meaning this reward can only be obtained once, beware that bronze silver and gold are three different rewards,each should only be obtainable once, while pins are LIMIT_MULTI, meaning infinite.
object_stat is setting requirements for this award, multiple requirements are getting chained by the f_and( command, what information it wants is stated inbetween the ().So it wants us to be infantry(kits translates to infantry), not vehicles, not weapons, not maps; then it wants kills;and the kills must be made while being recon; number of kills is 12 this round; awarded points are 20.
The silver-version gets number 101_2, named rsb, you need medal 101_1 already unlocked AND ktt-0 meaning kit-total-time-0 (0 is recon, see below) being 5400,
so 1:30 hours of time AND 20 kills with as infantry being recon class to get 500 points.
Award numbering from medal_data.py:
Awards are getting saved as a three character number like 411 or for awards with bronze/silver/gold levels as a five character number like 414_1.
The number on the most left is called "aType", meaning award Type, this is like a group.
There are four awardtypes ingame:
1 = Badges (Squares)
2 = Medals (Rectangles)
3 = Ribbons (Flat Things)
4 = Pins (Round Things)
The middle and most right number (so everything from 00 till 99) represents the "aID", meaning award ID.
This is the number inside the group or aType of the awards, counting up as they go.
So award 414 is aType=4, aID=14 -> Clear skies Pin
Database and the award numbering:
Having a look into the database now we see this columns:
aid | pid | atype | alvl | earned | first |
aid = Award ID from 1 to 99
pid = ID of the soldier holding the award (refer to as playerID)
atype = Award type, can be a number from 1 to 4 (1 = Badges, 2 = Medals, 3 = Ribbons, 4 = Pins)
alvl = award level, always 1 or higher (not earned awards arent recored in the database to begin with)
for badges it is bronze, silver or gold (1,2,3)
for pins it is the number of times you earned the pin
for medals it is the number of times earned (for purple hearth, bronze/silver/goldstar) or IF earned (eg. Distinguished Service Medal), so 1 and up
for ribbons its simply if you have earned it, so "1" for earned
earned = last time this very award got rewarded to this soldier in unixtime
first = the first time this very award got rewarded to this soldier in unixtime
An example here:

We see atype is 4 (pin) and the IDs are 0, 11 and 13.
ID 0 is the Combat Efficiency Pin and got awarded 41 times to pid 1 (thats me ;D)
ID 11 is the Emergency Rescue Pin and got awarded 6 times to pid 1.
ID 13 is the Firearm Efficiency Pin and got awarded 3 times to pid 2.
You could calculate the unixtime back to day:month:year hh:mm time, but its easier to find a specific award by its type andthen the PlayerID.
Information regarding stats calculation, mainly global kills, kills with weapons, playtime, time played as <class> etc.
are written in tables called stats_a(awards), stats_e(etc), stats_m(maps), stats_v(vehicles, doesnt work, dont bother with it), stats_w(weapons).
The place where specific information is stored and also gathered from differes on an every reward.
stats_a:
A stands for awards, but not the awards in form of medals or pins, just the points for different tasts a player achieved in a round.
This means total kills, heals, repairs, captured flags, time as commander/ in squad, lonewolf etc.
Awards like purple hearth get their information from this table to see what you k/d is.
Round-stats like "Best Squad" come from here too.
stats_e:
This one saves a lot of nothing and then TOTAL times a soldier died/killed someone in what kit.
So kills and death on a per kit basis are recorded, but the kit-names need explanation as they do differ from the unlcoks-table!
So kdths-0 for example means Kit-death-0, 0 being Recon-class.
kkls-2 for example means Kit-Kills-2, 2 being pioneer.
kit-0 = recon
kit-1 = assault
kit-2 = pioneer
kit-3 = support
stats_m:
This table hold information of each played Map/Round per soldier from the point on the database was created.
It holds information on the map and its gamemode, with total time/kills/points/death/wins/losses on this map.
Awards from NorthernStrike for example use this table to read if a soldier completed all maps on every side in x amount of time.
stats_v:
This table records vehicle-stats on a per soldier basis.
Or it should, FESL simply doesnt interpret this information and so we will never get Armored Vehicle Medals and such since the server cant look up if you already met the requirements.
Sad.
stats_w:
This table records weaponstats on a per soldier basis.
This includes time used, kill, got killed, accuracy etc. for every weapon.
The game renders your weaponstats you may watch ingame at the BFHQ using this data.
As far as i know very few awards use these, except for the pistol Badge.
This badge has requirements of total time and total kills using pistols, on top of that a number of kills in a round.
Information from the first two comes from this table.
Known bugs:
You will unlock the bronze badges many times, although they should only be rewarded once.
This only happens when you have earned the silver badge of a given badge.
why?: As the alvl of a bronze badge will get up by 1 (being alvl 2 after that, meaning silver),
the database entry for the already earned alvl 1 badge is "missing", so the pythonfiles guess that you dont have bronze.
So they will reward bronze again, this also will give you the 20 points, so thats cool.
But ultimatively we need to rewrite the medal_data.py's logic to search for the lvl 1/2 version first, before rewarding anything.
You can view the awards in googel docs, where you can search, or in the pictures below:



