Exemple #1
0
        /*public void shift_up() {
         *  vertical_tile_offset++;
         *  Debug.Log(vertical_tile_offset);
         * }
         * public void shift_down() {
         *  vertical_tile_offset--;
         *  Debug.Log(vertical_tile_offset);
         * }
         * public void shift_left() {
         *  tile_size -= 0.5f;
         *  Debug.Log(tile_size);
         * }
         * public void shift_right() {
         *  tile_size += 0.5f;
         *  Debug.Log(tile_size);
         * }*/

        public void RegisterOffer(int ItemListLocation, CharacterBody CB)
        {
            // LocalUser User = LocalUserManager.GetFirstLocalUser();

            // Chat.AddMessage($"Item Loc: {ItemListLocation}, Item List: {InvData.Count}, {InvData[ItemListLocation].item_index}");

            ItemIndex item = InvData[ItemListLocation].item_index;

            Transform UserTransform = CB.transform;

            // Debug.Log(firstLocalUser.userProfile.name);
            CB.inventory.RemoveItem(item, 1);
            float player_rot = 0;

            Vector3 mod_rot = new Vector3((float)(Math.Cos(player_rot)) * 10, 20, (float)(Math.Sin(player_rot)) * 10);

            PickupDropletController.CreatePickupDroplet(
                new PickupIndex(item), UserTransform.position, mod_rot);

            string color_tag = "#" + ColorCatalog.GetColorHexString(ItemCatalog.GetItemDef(item).colorIndex);

            // Chat.AddMessage($"{CB.name} has dropped <color={color_tag}> {Language.GetString(ItemCatalog.GetItemDef(item).nameToken)} </color>");
            sendChatMessage($"{CB.GetUserName()} has dropped <color={color_tag}> {Language.GetString(ItemCatalog.GetItemDef(item).nameToken)} </color>");


            InvData[ItemListLocation].count -= 1;
            if (InvData[ItemListLocation].count <= 0)
            {
                InvData.RemoveAt(ItemListLocation);
                Destroy(TileList[TileList.Count - 1]);
                TileList.RemoveAt(TileList.Count - 1);
            }
        }
        private void GlobalEventManager_ServerDamageDealt(On.RoR2.GlobalEventManager.orig_ServerDamageDealt orig, DamageReport damageReport)
        {
            orig(damageReport);
            if (damageReport.attacker == null || damageReport.victimBody == null)
            {
                return;
            }
            CharacterBody attacker = damageReport.attackerBody;
            CharacterBody victim   = damageReport.victimBody;

            if (damageReport.victimIsBoss)
            {
                var attackerIndex = attacker.GetUserName();
                if (map.ContainsKey(attackerIndex))
                {
                    map[attackerIndex] += damageReport.damageDealt;
                }
                else
                {
                    map.Add(attackerIndex, damageReport.damageDealt);
                }
                bossName          = victim.GetUserName();
                totalDamageDealt += damageReport.damageDealt;
            }
        }
Exemple #3
0
        private void Extinguish(CharacterBody characterBody)
        {
            if (characterBody.HasBuff(BuffIndex.OnFire))
            {
                Chat.AddMessage("cured " + characterBody.GetUserName());
                characterBody.ClearTimedBuffs(BuffIndex.OnFire);

                if (DotController.dotControllerLocator.TryGetValue(characterBody.gameObject.GetInstanceID(), out DotController dotController))
                {
                    //var burnEffectController = dotController.burnEffectController;
                    var dotStacks = dotController.dotStackList;

                    int i     = 0;
                    int count = dotStacks.Count;
                    while (i < count)
                    {
                        if (dotStacks[i].dotIndex == DotController.DotIndex.Burn ||
                            dotStacks[i].dotIndex == DotController.DotIndex.Helfire ||
                            dotStacks[i].dotIndex == DotController.DotIndex.PercentBurn)
                        {
                            dotStacks[i].damage = 0f;
                            dotStacks[i].timer  = 0f;
                        }
                        i++;
                    }
                }
            }
        }
Exemple #4
0
        private string ComposePlayerVictimLabel(CharacterBody player)
        {
            DataContainer characterData = DataCatalog.GetCharacterDataFor(player);

            if (!characterData.DataContainerTypeIsEnabled())
            {
                return(null);
            }

            return($"<color={characterData.ColorHex}>{player.GetUserName()}</color> [<color={characterData.ColorHex}>{characterData.TruncatedDisplayName}</color>]");
        }
Exemple #5
0
        private string ComposeMinionVictimLabel(CharacterBody minion, CharacterBody minionOwner)
        {
            DataContainer minionOwnerCharacterData = DataCatalog.GetCharacterDataFor(minionOwner);
            DataContainer minionData = DataCatalog.LookupMinionDataFor(minion);

            if (!minionData.DataContainerTypeIsEnabled())
            {
                return(null);
            }

            return($"<color={minionOwnerCharacterData.ColorHex}>{minionOwner.GetUserName()}</color> [<color={minionData.ColorHex}>{minionData.TruncatedDisplayName}</color>]");
        }
Exemple #6
0
            public static bool HookOnCharacterDeath(bool ignoreDeath, DamageReport damageReport) {
                if (!ignoreDeath)
                {
                    float chance;
                    CharacterBody enemyBody = damageReport.victimBody;
                    GameObject attackerMaster = damageReport.damageInfo.attacker.GetComponent<CharacterBody>().masterObject;
                    CharacterMaster attackerController = attackerMaster.GetComponent<CharacterMaster>();

                    Listener.UpdateQuest(1, 0, enemyBody.GetUserName());

                    if (Config.enemyItemDropsEnabled)
                    {
                        bool isElite = enemyBody.isElite || enemyBody.isChampion;
                        bool isBoss = enemyBody.isBoss;

                        if (isBoss)
                        {
                            chance = Config.bossDropChance;
                        }
                        else
                        {
                            if (isElite)
                            {
                                chance = Config.eliteDropChance;
                            }
                            else
                            {
                                chance = Config.normalDropChance;
                            }
                        }

                        if (enemyBody.isElite)
                        {
                            Listener.UpdateQuest(1, Type.KillElites, "Elites");
                        }

                        chance *= ((1 - Config.playerChanceScaling) + (Config.playerChanceScaling * Run.instance.participatingPlayerCount));
                        if (Config.earlyChanceScaling - Run.instance.difficultyCoefficient > 0)
                        {
                            chance *= (Config.earlyChanceScaling - (Run.instance.difficultyCoefficient - 1));
                        }

                        // rng check
                        bool didDrop = Util.CheckRoll(chance, attackerController ? attackerController.luck : 0f, null);

                        // Gets Item and drops in world
                        if (didDrop)
                        {
                            if (!isBoss)
                            {
                                // Create a weighted selection for rng
                                WeightedSelection<List<PickupIndex>> weightedSelection = new WeightedSelection<List<PickupIndex>>(8);
                                // Check if enemy is boss, elite or normal
                                if (isElite)
                                {
                                    weightedSelection.AddChoice(Run.instance.availableTier1DropList, Config.eliteChanceCommon);
                                    weightedSelection.AddChoice(Run.instance.availableTier2DropList, Config.eliteChanceUncommon);
                                    weightedSelection.AddChoice(Run.instance.availableTier3DropList, Config.eliteChanceLegendary);
                                    weightedSelection.AddChoice(Run.instance.availableLunarDropList, Config.eliteChanceLunar);
                                }
                                else
                                {
                                    weightedSelection.AddChoice(Run.instance.availableTier1DropList, Config.normalChanceCommon);
                                    weightedSelection.AddChoice(Run.instance.availableTier2DropList, Config.normalChanceUncommon);
                                    weightedSelection.AddChoice(Run.instance.availableTier3DropList, Config.normalChanceLegendary);
                                    weightedSelection.AddChoice(Run.instance.availableEquipmentDropList, Config.normalChanceEquip);
                                }
                                // Get a Tier
                                List<PickupIndex> list = weightedSelection.Evaluate(Run.instance.spawnRng.nextNormalizedFloat);
                                // Pick random from tier
                                PickupDef item = PickupCatalog.GetPickupDef(list[Run.instance.spawnRng.RangeInt(0, list.Count)]);
                                // Spawn item
                                if (Config.dropItemsFromEnemies || list == Run.instance.availableEquipmentDropList)
                                {
                                    PickupDropletController.CreatePickupDroplet(item.pickupIndex, enemyBody.transform.position, Vector3.up * 20f);
                                }
                                else {
                                    if (attackerController.minionOwnership.ownerMaster != null)
                                    {
                                        attackerController.minionOwnership.ownerMaster.inventory.GiveItem(item.itemIndex);
                                    }
                                    else
                                    {
                                        attackerController.inventory.GiveItem(item.itemIndex);
                                    }
                                    Chat.AddMessage("Enemy Drop: 1 " + Language.GetString(item.nameToken));
                                }
                            }
                        }
                    }
                }
                else
                {
                    ignoreDeath = false;
                }
                return ignoreDeath;
            }