2020-12-22 03:13:43 +00:00
/ * This Source Code Form is subject to the terms of the Mozilla Public
* License , v . 2.0 . If a copy of the MPL was not distributed with this
* file , You can obtain one at https : //mozilla.org/MPL/2.0/. */
using System ;
2020-03-22 19:05:26 +00:00
using System.Collections ;
using System.Collections.Generic ;
using System.Linq ;
2020-05-04 00:07:36 +01:00
using Unity.Mathematics ;
2020-03-22 19:05:26 +00:00
using static Unity . Mathematics . math ;
2020-05-04 00:07:36 +01:00
using float2 = Unity . Mathematics . float2 ;
2020-04-30 02:54:31 +01:00
using Random = Unity . Mathematics . Random ;
2020-05-10 00:16:33 +01:00
using JM.LinqFaster ;
2020-12-01 00:16:11 +00:00
using UniRx ;
2020-05-30 02:44:22 +01:00
using float4 = Unity . Mathematics . float4 ;
2020-03-22 19:05:26 +00:00
2020-12-10 23:20:38 +00:00
public class ItemManager
2020-03-22 19:05:26 +00:00
{
2020-04-30 02:54:31 +01:00
public Random Random = new Random ( ( uint ) ( DateTime . Now . Ticks % uint . MaxValue ) ) ;
2020-12-10 23:20:38 +00:00
// public Dictionary<string, GalaxyMapLayerData> MapLayers = new Dictionary<string, GalaxyMapLayerData>();
// public SimpleCommodityData[] Resources;
// public Dictionary<Guid, List<IController>> CorporationControllers = new Dictionary<Guid, List<IController>>();
// public Dictionary<Guid, ZoneDefinition> GalaxyZones;
2020-04-23 03:31:17 +01:00
2020-04-09 07:48:45 +01:00
private Action < string > _logger ;
2020-04-16 03:08:18 +01:00
private Dictionary < BlueprintStatEffect , PerformanceStat > AffectedStats =
new Dictionary < BlueprintStatEffect , PerformanceStat > ( ) ;
private double _time ;
private float _deltaTime ;
2020-11-27 22:47:33 +00:00
private Dictionary < Guid , Zone > _zones = new Dictionary < Guid , Zone > ( ) ;
2020-12-20 03:04:52 +00:00
2020-11-27 22:47:33 +00:00
// private Guid _forceLoadZone;
2020-05-12 01:42:13 +01:00
2020-12-10 23:20:38 +00:00
// public GlobalData GlobalData => _globalData ?? (_globalData = ItemData.GetAll<GlobalData>().FirstOrDefault());
public DatabaseCache ItemData { get ; }
public GameplaySettings GameplaySettings { get ; }
2020-05-10 00:16:33 +01:00
2020-04-16 03:08:18 +01:00
public double Time
{
get = > _time ;
set
{
_deltaTime = ( float ) ( value - _time ) ;
_time = value ;
2020-05-07 03:53:54 +01:00
//Log($"GameContext delta time: {_deltaTime}");
2020-04-16 03:08:18 +01:00
}
}
2020-04-09 07:48:45 +01:00
// private readonly Dictionary<CraftedItemData, int> Tier = new Dictionary<CraftedItemData, int>();
2020-03-27 01:53:03 +00:00
2020-12-10 23:20:38 +00:00
public ItemManager ( DatabaseCache itemData , GameplaySettings settings , Action < string > logger )
2020-03-27 01:53:03 +00:00
{
2020-12-10 23:20:38 +00:00
ItemData = itemData ;
2020-12-20 03:04:52 +00:00
GameplaySettings = settings ;
2020-04-09 07:48:45 +01:00
_logger = logger ;
2020-04-16 03:08:18 +01:00
}
public void Log ( string s )
{
_logger ( s ) ;
}
2020-12-01 00:16:11 +00:00
// public void Update()
// {
// foreach(var zone in _zones.Values)
// zone.Update((float) Time, _deltaTime);
//
// foreach (var corporation in Cache.GetAll<Corporation>())
// {
// foreach (var tasks in corporation.Tasks
// .Select(id => Cache.Get<AgentTask>(id)) // Fetch the tasks from the database cache
// .Where(task => !task.Reserved) // Filter out tasks that have already been reserved
// .GroupBy(task => task.Type)) // Group tasks by type
// {
// // Create a list of available controllers for this task type
// var availableControllers = CorporationControllers[corporation.ID]
// .Where(controller => controller.Available && controller.TaskType == tasks.Key).ToList();
//
// // Iterate over the highest priority tasks for which controllers are available
// foreach (var task in tasks.OrderByDescending(task => task.Priority).Take(availableControllers.Count))
// {
// // Find the nearest controller for this task
// IController nearestController = availableControllers[0];
// List<ZoneDefinition> nearestControllerPath = FindPath(GalaxyZones[availableControllers.First().Zone.Data.ID], GalaxyZones[task.Zone], true);
// foreach (var controller in availableControllers.Skip(1))
// {
// var path = FindPath(GalaxyZones[controller.Zone.Data.ID], GalaxyZones[task.Zone], true);
// if (path.Count < nearestControllerPath.Count)
// {
// nearestControllerPath = path;
// nearestController = controller;
// }
// }
// task.Reserved = true;
// nearestController.AssignTask(task.ID);
// }
// }
// }
//
// }
2020-05-28 04:50:40 +01:00
2020-04-09 07:48:45 +01:00
// public int ItemTier(CraftedItemData itemData)
// {
// if (Tier.ContainsKey(itemData)) return Tier[itemData];
//
// Tier[itemData] = itemData.Ingredients.Keys.Max(ci => _cache.Get<ItemData>(ci) is CraftedItemData craftableIngredient ? ItemTier(craftableIngredient) : 0);
//
// return Tier[itemData];
// }
2020-03-22 19:05:26 +00:00
public ItemData GetData ( ItemInstance item )
{
2020-12-10 23:20:38 +00:00
return ItemData . Get < ItemData > ( item . Data ) ;
2020-03-22 19:05:26 +00:00
}
public SimpleCommodityData GetData ( SimpleCommodity item )
{
2020-12-10 23:20:38 +00:00
return ItemData . Get < SimpleCommodityData > ( item . Data ) ;
2020-03-22 19:05:26 +00:00
}
public CraftedItemData GetData ( CraftedItemInstance item )
{
2020-12-10 23:20:38 +00:00
return ItemData . Get < CraftedItemData > ( item . Data ) ;
2020-03-22 19:05:26 +00:00
}
2020-12-10 23:20:38 +00:00
public EquippableItemData GetData ( EquippableItem equippableItem )
2020-03-22 19:05:26 +00:00
{
2020-12-10 23:20:38 +00:00
return ItemData . Get < EquippableItemData > ( equippableItem . Data ) ;
2020-03-22 19:05:26 +00:00
}
public float GetMass ( ItemInstance item )
{
var data = GetData ( item ) ;
switch ( item )
{
case CraftedItemInstance _ :
return data . Mass ;
case SimpleCommodity commodity :
return data . Mass * commodity . Quantity ;
}
return 0 ;
}
2020-06-05 04:16:33 +01:00
public float GetThermalMass ( ItemInstance item )
2020-03-22 19:05:26 +00:00
{
var data = GetData ( item ) ;
switch ( item )
{
case CraftedItemInstance _ :
return data . Mass * data . SpecificHeat ;
case SimpleCommodity commodity :
return data . Mass * data . SpecificHeat * commodity . Quantity ;
}
return 0 ;
}
2020-04-09 07:48:45 +01:00
public PerformanceStat GetAffectedStat ( BlueprintData blueprint , BlueprintStatEffect effect )
{
// We've already cached this effect's stat, return it directly
if ( AffectedStats . ContainsKey ( effect ) ) return AffectedStats [ effect ] ;
// Get the data for the item the blueprint is for, return null if not found or not equippable
2020-12-10 23:20:38 +00:00
var blueprintItem = ItemData . Get < EquippableItemData > ( blueprint . Item ) ;
2020-04-09 07:48:45 +01:00
if ( blueprintItem = = null )
{
_logger ( $"Attempted to get stat effect but Blueprint {blueprint.ID} is not for an equippable item!" ) ;
return AffectedStats [ effect ] = null ;
}
// Get the first behavior of the type specified in the blueprint stat effect, return null if not found
2020-05-12 01:42:13 +01:00
var effectObject = effect . StatReference . Target = = blueprintItem . Name ? ( object ) blueprintItem :
blueprintItem . Behaviors . FirstOrDefault ( b = > b . GetType ( ) . Name = = effect . StatReference . Target ) ;
2020-04-16 03:08:18 +01:00
if ( effectObject = = null )
2020-04-09 07:48:45 +01:00
{
2020-05-12 01:42:13 +01:00
_logger ( $"Attempted to get stat effect for Blueprint {blueprint.ID} but stat references missing behavior \" { effect . StatReference . Target } \ "!" ) ;
2020-04-09 07:48:45 +01:00
return AffectedStats [ effect ] = null ;
}
// Get the first field in the behavior matching the name specified in the stat effect, return null if not found
2020-04-16 03:08:18 +01:00
var type = effectObject . GetType ( ) ;
2020-04-09 07:48:45 +01:00
var field = type . GetField ( effect . StatReference . Stat ) ;
if ( field = = null )
{
2020-05-12 01:42:13 +01:00
_logger ( $"Attempted to get stat effect for Blueprint {blueprint.ID} but object {effect.StatReference.Target} does not have a stat named \" { effect . StatReference . Stat } \ "!" ) ;
2020-04-09 07:48:45 +01:00
return AffectedStats [ effect ] = null ;
}
// Finally we've confirmed the stat effect is valid, return the affected stat
2020-04-16 03:08:18 +01:00
return AffectedStats [ effect ] = field . GetValue ( effectObject ) as PerformanceStat ;
2020-04-09 07:48:45 +01:00
}
2020-05-22 00:23:34 +01:00
private readonly Dictionary < CraftedItemInstance , float > ItemQuality = new Dictionary < CraftedItemInstance , float > ( ) ;
2020-05-27 03:43:30 +01:00
2020-05-22 00:23:34 +01:00
public float CompoundQuality ( CraftedItemInstance item )
{
if ( ItemQuality . ContainsKey ( item ) ) return ItemQuality [ item ] ;
var quality = item . Quality ;
var craftedIngredients = item . Ingredients . Where ( i = > i is CraftedItemInstance ) . ToArray ( ) ;
if ( craftedIngredients . Length > 0 )
{
2020-12-10 23:20:38 +00:00
var ingredientQualityWeight = ItemData . Get < CraftedItemData > ( item . Data ) . IngredientQualityWeight ;
2020-05-22 00:23:34 +01:00
quality = quality * ( 1 - ingredientQualityWeight ) +
craftedIngredients . Cast < CraftedItemInstance > ( ) . Average ( CompoundQuality ) * ingredientQualityWeight ;
}
ItemQuality [ item ] = quality ;
return ItemQuality [ item ] ;
}
2021-01-17 02:45:52 +00:00
private readonly Dictionary < ( PerformanceStat stat , EquippableItem item ) , float > StatQuality = new Dictionary < ( PerformanceStat stat , EquippableItem item ) , float > ( ) ;
2020-05-22 00:23:34 +01:00
2020-03-22 19:05:26 +00:00
// Determine quality of either the item itself or the specific ingredient this stat depends on
2020-12-10 23:20:38 +00:00
public float Quality ( PerformanceStat stat , EquippableItem item )
2020-03-22 19:05:26 +00:00
{
2021-01-17 02:45:52 +00:00
if ( StatQuality . ContainsKey ( ( stat , item ) ) )
return StatQuality [ ( stat , item ) ] ;
2021-01-17 23:26:53 +00:00
var quality = CalcQuality ( stat , item ) ;
StatQuality [ ( stat , item ) ] = quality ;
return quality ;
}
private float CalcQuality ( PerformanceStat stat , EquippableItem item )
{
2020-12-10 23:20:38 +00:00
var itemData = GetData ( item ) ;
var blueprint = ItemData . Get < BlueprintData > ( item . Blueprint ) ;
2020-04-30 02:54:31 +01:00
var activeEffects = blueprint . StatEffects . Where ( x = > GetAffectedStat ( blueprint , x ) = = stat ) . ToArray ( ) ;
2020-03-22 19:05:26 +00:00
float quality ;
2020-04-09 07:48:45 +01:00
if ( ! activeEffects . Any ( ) )
2020-05-22 00:23:34 +01:00
quality = CompoundQuality ( item ) ;
2020-03-22 19:05:26 +00:00
else
{
2020-12-10 23:20:38 +00:00
var ingredients = item . Ingredients . Where ( i = > activeEffects . Any ( e = > e . Ingredient = = i . Data ) ) . ToArray ( ) ;
2020-06-05 04:16:33 +01:00
var distinctIngredients = ingredients . Select ( i = > i . Data ) . Distinct ( ) ;
if ( distinctIngredients . Count ( ) ! = activeEffects . Length )
2020-04-09 07:48:45 +01:00
{
2020-12-10 23:20:38 +00:00
_logger ( $"Item {itemData.Name} does not have the ingredients specified by the stat effects of its blueprint!" ) ;
2020-04-09 07:48:45 +01:00
return 0 ;
}
float sum = 0 ;
foreach ( var i in ingredients )
{
if ( i is CraftedItemInstance ci )
2020-05-22 00:23:34 +01:00
sum + = CompoundQuality ( ci ) ;
2020-12-10 23:20:38 +00:00
else _logger ( $"Blueprint stat effect for item {itemData.Name} specifies invalid (non crafted) ingredient!" ) ;
2020-04-09 07:48:45 +01:00
}
quality = sum / ingredients . Length ;
2020-03-22 19:05:26 +00:00
}
return quality ;
}
// Returns stat when not equipped
2020-12-10 23:20:38 +00:00
public float Evaluate ( PerformanceStat stat , EquippableItem item )
2020-03-22 19:05:26 +00:00
{
var quality = pow ( Quality ( stat , item ) , stat . QualityExponent ) ;
var result = lerp ( stat . Min , stat . Max , quality ) ;
if ( float . IsNaN ( result ) )
return stat . Min ;
return result ;
}
2020-05-25 03:05:30 +01:00
2020-12-10 23:20:38 +00:00
// public Entity CreateEntity(Guid zoneID, Guid corporation, Guid loadout)
// {
// if (!(ItemData.Get(loadout) is LoadoutData loadoutData))
// {
// _logger("Attempted to spawn invalid loadout ID");
// return null;
// }
//
// if (!(ItemData.Get(loadoutData.Hull) is HullData hullData))
// {
// _logger("Attempted to spawn loadout with invalid hull ID");
// return null;
// }
//
// if (!(ItemData.Get(zoneID) is ZoneData zoneData))
// {
// _logger("Attempted to spawn entity with invalid zone ID");
// return null;
// }
//
// if (!(ItemData.Get(corporation) is Corporation corpData))
// {
// _logger("Attempted to spawn entity with invalid corporation ID");
// return null;
// }
//
// var gearData = loadoutData.Gear
// .Take(hullData.Hardpoints.Count)
// .Where(id => id != Guid.Empty)
// .Select(id => ItemData.Get<GearData>(id))
// .ToArray();
//
// if (gearData.Any(g=>g==null))
// {
// _logger("Attempted to spawn loadout with invalid gear ID");
// return null;
// }
//
// var gear = gearData
// .Select(gd => CreateInstance(gd.ID, GlobalData.StartingGearQualityMin, GlobalData.StartingGearQualityMax))
// .ToArray();
//
// if (gear.Any(g=>g==null))
// return null;
//
// foreach(var g in gear)
// ItemData.Add(g);
//
// var cargoData = loadoutData.CompoundCargo
// .SelectMany(x => Enumerable.Repeat(ItemData.Get<CraftedItemData>(x.Key), x.Value))
// .ToArray();
//
// if (cargoData.Any(g=>g==null))
// {
// _logger("Attempted to spawn loadout with invalid cargo ID");
// return null;
// }
//
// var cargo = cargoData
// .Select(gd => CreateInstance(gd.ID, GlobalData.StartingGearQualityMin, GlobalData.StartingGearQualityMax))
// .ToArray();
//
// if (cargo.Any(g=>g==null))
// return null;
//
// foreach(var c in cargo)
// ItemData.Add(c);
//
// var simpleCargo = loadoutData.SimpleCargo?
// .Select(x => CreateInstance(x.Key, x.Value))
// .ToArray() ?? new SimpleCommodity[0];
//
// if (simpleCargo.Any(g=>g==null))
// return null;
//
// var hull = CreateInstance(loadoutData.Hull, GlobalData.StartingGearQualityMin, GlobalData.StartingGearQualityMax);
//
// if(hull==null)
// return null;
//
// // Get target zone
// var zone = _zones[zoneID];
//
// if (hullData.HullType == HullType.Ship)
// {
// var entity = CreateShip(hull.ID, gear.Select(g => g.ID),
// cargo.Select(c => c.ID).Concat(simpleCargo.Select(c => c.ID)), zone, corporation, Guid.Empty, loadoutData.Name);
// entity.Active = true;
// return entity;
// }
//
// if (hullData.HullType == HullType.Station)
// {
// var distance = lerp(.2f, .8f, Random.NextFloat()) * zoneData.Radius;
// var orbit = new OrbitData
// {
// Context = this,
// Distance = new ReactiveProperty<float>(distance),
// Parent = zone.Orbits.Values.Select(o=>o.Data)
// .First(orbitData => orbitData.Parent == Guid.Empty).ID,
// Phase = Random.NextFloat()
// };
// zone.AddOrbit(orbit);
//
// var entity = new OrbitalEntity(this, hull.ID, gear.Select(g => g.ID),
// cargo.Select(c => c.ID).Concat(simpleCargo.Select(c => c.ID)), orbit.ID, zone, corporation)
// {
// Name = $"{loadoutData.Name} {Random.NextInt(1,255):X}",
// Temperature = 293,
// Population = 4
// };
// entity.Active = true;
// var parentCorp = ItemData.Get<MegaCorporation>(corpData.Parent);
// foreach (var attribute in parentCorp.Personality)
// entity.Personality[attribute.Key] = attribute.Value;
// ItemData.Add(entity);
//
// zone.Entities[entity.ID] = entity;
// return entity;
// }
//
// return null;
// }
//
// public Ship CreateShip(Guid hull, IEnumerable<Guid> gear, IEnumerable<Guid> cargo, Zone zone, Guid corporation, Guid homeEntity, string typeName)
// {
//
// var ship = new Ship(this, hull, gear, cargo, zone, corporation)
// {
// Name = $"{typeName} {Random.NextInt(1,255):X}",
// HomeEntity = homeEntity
// };
// ItemData.Add(ship);
//
// zone.Entities[ship.ID] = ship;
// return ship;
// }
2020-03-22 19:05:26 +00:00
2020-12-12 03:42:58 +00:00
public SimpleCommodity CreateInstance ( SimpleCommodityData item , int count )
2020-03-22 19:05:26 +00:00
{
if ( item ! = null )
2020-06-02 07:01:03 +01:00
{
var newItem = new SimpleCommodity
2020-03-22 19:05:26 +00:00
{
2020-12-12 03:42:58 +00:00
Data = item . ID ,
2020-05-25 03:05:30 +01:00
Quantity = count
2020-03-22 19:05:26 +00:00
} ;
2020-12-10 23:20:38 +00:00
//ItemData.Add(newItem);
2020-06-02 07:01:03 +01:00
return newItem ;
}
2020-03-22 19:05:26 +00:00
2020-04-09 07:48:45 +01:00
_logger ( "Attempted to create Simple Commodity instance using missing or incorrect item id" ) ;
return null ;
2020-03-22 19:05:26 +00:00
}
2021-01-19 01:22:56 +00:00
public ItemInstance Instantiate ( ItemInstance item )
{
var data = GetData ( item ) ;
if ( data is CraftedItemData c )
2021-01-27 00:05:30 +00:00
{
2021-03-08 02:57:38 +00:00
var i = CreateInstance ( c ) ;
2021-01-27 00:05:30 +00:00
i . Rotation = item . Rotation ;
return i ;
}
2021-01-19 01:22:56 +00:00
if ( item is SimpleCommodity s )
2021-01-27 00:05:30 +00:00
{
var i = CreateInstance ( data as SimpleCommodityData , s . Quantity ) ;
i . Rotation = item . Rotation ;
return i ;
}
2021-01-19 01:22:56 +00:00
return null ;
}
2020-03-22 19:05:26 +00:00
2021-03-08 02:57:38 +00:00
public CraftedItemInstance CreateInstance ( CraftedItemData item )
2020-03-22 19:05:26 +00:00
{
if ( item = = null )
{
2020-04-09 07:48:45 +01:00
_logger ( "Attempted to create crafted item instance using missing or incorrect item id!" ) ;
return null ;
2020-03-22 19:05:26 +00:00
}
2020-12-12 03:42:58 +00:00
var blueprint = ItemData . GetAll < BlueprintData > ( ) . FirstOrDefault ( b = > b . Item = = item . ID ) ;
2020-04-09 07:48:45 +01:00
if ( blueprint = = null )
{
_logger ( "Attempted to create crafted item instance which has no blueprint!" ) ;
return null ;
}
2020-06-11 02:55:11 +01:00
bool invalidIngredientFound = false ;
ItemData invalidIngredient = null ;
var ingredients = new List < ItemInstance > ( ) ;
foreach ( var ingredient in blueprint . Ingredients )
{
2020-12-10 23:20:38 +00:00
var itemData = ItemData . Get < ItemData > ( ingredient . Key ) ;
2020-12-12 03:42:58 +00:00
if ( itemData is SimpleCommodityData simpleIngredientData )
2020-03-22 19:05:26 +00:00
{
2020-12-12 03:42:58 +00:00
var itemInstance = CreateInstance ( simpleIngredientData , ingredient . Value ) ;
2020-06-11 02:55:11 +01:00
if ( itemInstance = = null )
{
invalidIngredientFound = true ;
invalidIngredient = itemData ;
}
else ingredients . Add ( itemInstance ) ;
}
else
{
2020-12-12 03:42:58 +00:00
var craftedIngredientData = ItemData . Get < CraftedItemData > ( ingredient . Key ) ;
2020-06-11 02:55:11 +01:00
for ( int i = 0 ; i < ingredient . Value ; i + + )
{
2021-03-08 02:57:38 +00:00
var itemInstance = CreateInstance ( craftedIngredientData ) ;
2020-06-11 02:55:11 +01:00
if ( itemInstance = = null )
{
invalidIngredientFound = true ;
invalidIngredient = itemData ;
break ;
}
ingredients . Add ( itemInstance ) ;
}
}
}
if ( invalidIngredientFound )
{
_logger ( $"Unable to create crafted item ingredient: {invalidIngredient?.Name??" null "} for item {item.Name}" ) ;
}
2021-03-08 02:57:38 +00:00
var quality = Random . NextFloat ( ) ;
var tier = GameplaySettings . Tiers [ 0 ] ;
foreach ( var t in GameplaySettings . Tiers )
{
if ( t . Rarity > quality )
tier = t ;
}
2020-03-22 19:05:26 +00:00
if ( item is EquippableItemData equippableItemData )
{
2020-12-10 23:20:38 +00:00
var newGear = new EquippableItem
2020-03-22 19:05:26 +00:00
{
2020-12-12 03:42:58 +00:00
Data = item . ID ,
2020-12-10 23:20:38 +00:00
Ingredients = ingredients ,
2021-03-08 02:57:38 +00:00
Quality = tier . Quality ,
2020-06-02 07:01:03 +01:00
Blueprint = blueprint . ID ,
2020-06-07 03:21:47 +01:00
Name = $"{item.Name}"
2020-03-22 19:05:26 +00:00
} ;
2020-12-10 23:20:38 +00:00
newGear . Durability = equippableItemData . Durability ;
2020-04-16 03:08:18 +01:00
return newGear ;
2020-03-22 19:05:26 +00:00
}
2020-04-28 01:50:50 +01:00
var newCommodity = new CompoundCommodity
2020-03-22 19:05:26 +00:00
{
2020-12-12 03:42:58 +00:00
Data = item . ID ,
2020-12-10 23:20:38 +00:00
Ingredients = ingredients ,
2021-03-08 02:57:38 +00:00
Quality = tier . Quality ,
2020-06-02 07:01:03 +01:00
Blueprint = blueprint . ID ,
2020-06-07 03:21:47 +01:00
Name = $"{item.Name}"
2020-03-22 19:05:26 +00:00
} ;
2020-04-28 01:50:50 +01:00
return newCommodity ;
2020-03-22 19:05:26 +00:00
}
2020-05-25 03:05:30 +01:00
2021-03-08 02:57:38 +00:00
public ( RarityTier tier , int upgrades ) GetTier ( CraftedItemInstance item )
{
var tier = GameplaySettings . Tiers [ 0 ] ;
foreach ( var t in GameplaySettings . Tiers )
if ( item . Quality + . 001f > t . Quality )
tier = t ;
int upgrades = ( int ) ( ( item . Quality - tier . Quality ) / . 0499f ) ;
return ( tier , upgrades ) ;
}
2020-04-16 03:08:18 +01:00
}