Ejemplo n.º 1
0
        private void FillForDamager(DamageInfo damager, ItemDropList dropList, ChestSourceInfo sourceInfo)
        {
            ConcurrentDictionary <string, ServerInventoryItem> newObjects = new ConcurrentDictionary <string, ServerInventoryItem>();

            Workshop lootWorkshop = (Workshop)damager.workshop;

            //in 10% dropped source workshop items
            if (sourceInfo != null && sourceInfo.hasWorkshop)
            {
                if (Rand.Float01() < 0.1f)
                {
                    lootWorkshop = sourceInfo.sourceWorkshop;
                }
            }

            DropManager dropManager = DropManager.Get(resource);

            int lootLevel = damager.level;

            if (sourceInfo != null && sourceInfo.level != 0)
            {
                log.InfoFormat("set loot level = {0} yellow", sourceInfo.level);
                lootLevel = sourceInfo.level;
            }

            Difficulty d = Difficulty.starter;

            if (sourceInfo != null)
            {
                d = sourceInfo.difficulty;
            }


            int groupCount = 1;

            NebulaObject playerObject = GetNebulaObject(damager);

            groupCount = GetGroupCount(playerObject);

            float remapWeight = GetColorRemapWeight(playerObject, groupCount);

            if (dropList == null)
            {
                //generate single weapon
                GenerateWeapons(dropManager, lootLevel, lootWorkshop, d, newObjects, remapWeight);

                GenerateSchemes(dropManager, lootLevel, lootWorkshop, d, newObjects, remapWeight);
            }
            else
            {
                GenerateFromDropList(
                    (Race)damager.race,
                    dropManager,
                    lootLevel,
                    lootWorkshop,
                    d,
                    newObjects,
                    remapWeight,
                    dropList,
                    damager.level,
                    groupCount);
            }
            //generate single scheme


            //generate creadits
            //CreditsObject creadits = new CreditsObject(resource.MiscItemDataRes.CreditsObject());
            //creadits.SetCount(20);
            //newObjects.TryAdd(creadits.Id, creadits);
            if (content.TryAdd(damager.DamagerId, newObjects))
            {
                if (damager.DamagerType == (byte)ItemType.Avatar)
                {
                    NotifyChestDamager(damager);
                }
            }
        }
Ejemplo n.º 2
0
        public void Fill(ConcurrentDictionary <string, DamageInfo> inDamagers, DropListComponent dropListComponent, ChestSourceInfo sourceInfo = null)
        {
            content = new ConcurrentDictionary <string, ConcurrentDictionary <string, ServerInventoryItem> >();

            if (dropListComponent != null)
            {
                foreach (var damagePair in inDamagers)
                {
                    var dropPair = dropListComponent.GetDropList(damagePair.Value);
                    FillForDamager(damagePair.Value, dropPair.dropList, sourceInfo);
                }
            }
        }