Пример #1
0
    // Token: 0x0600062E RID: 1582 RVA: 0x00034B84 File Offset: 0x00032D84
    private void SellItem()
    {
        ItemDrop.ItemData sellableItem = this.GetSellableItem();
        if (sellableItem == null)
        {
            return;
        }
        int stack = sellableItem.m_shared.m_value * sellableItem.m_stack;

        Player.m_localPlayer.GetInventory().RemoveItem(sellableItem);
        Player.m_localPlayer.GetInventory().AddItem(this.m_coinPrefab.gameObject.name, stack, this.m_coinPrefab.m_itemData.m_quality, this.m_coinPrefab.m_itemData.m_variant, 0L, "");
        string text;

        if (sellableItem.m_stack > 1)
        {
            text = sellableItem.m_stack + "x" + sellableItem.m_shared.m_name;
        }
        else
        {
            text = sellableItem.m_shared.m_name;
        }
        this.m_sellEffects.Create(base.transform.position, Quaternion.identity, null, 1f);
        Player.m_localPlayer.Message(MessageHud.MessageType.TopLeft, Localization.instance.Localize("$msg_sold", new string[]
        {
            text,
            stack.ToString()
        }), 0, sellableItem.m_shared.m_icons[0]);
        this.m_trader.OnSold();
        this.FillList();
        Gogan.LogEvent("Game", "SoldItem", text, 0L);
    }
        public static bool Prefix(InventoryGui __instance, Player player)
        {
            // if it's not a rune, do the normal flow
            var data = __instance.m_craftRecipe?.m_item?.m_itemData?.GetRuneData();

            if (data == null)
            {
                RunicPower.StopCraftingAll(false);
                return(true);
            }
            // if the player does not have the requeriments, do the normal flow
            var qualityLevel = 1;

            if (!player.HaveRequirements(__instance.m_craftRecipe, discover: false, qualityLevel) && !player.NoCostCheat())
            {
                RunicPower.StopCraftingAll(false);
                return(true);
            }
            // getting hte spell inventory
            var inv = SpellsBar.invBarGrid.m_inventory;

            // if there is not an 'empty' slot, do the normal flow
            if (!inv.HaveEmptySlot())
            {
                RunicPower.StopCraftingAll(false);
                return(true);
            }

            var        craftItem = __instance.m_craftRecipe.m_item;
            GameObject go        = Object.Instantiate(craftItem.gameObject);
            ItemDrop   item      = go.GetComponent <ItemDrop>();

            item.m_itemData.m_stack       = __instance.m_craftRecipe.m_amount;
            item.m_itemData.m_quality     = qualityLevel;
            item.m_itemData.m_variant     = __instance.m_craftVariant;
            item.m_itemData.m_durability  = item.m_itemData.GetMaxDurability();
            item.m_itemData.m_crafterID   = player.GetPlayerID();
            item.m_itemData.m_crafterName = player.GetPlayerName();

            var crafted = inv.AddItem(item.m_itemData);

            if (crafted)
            {
                if (!player.NoCostCheat())
                {
                    player.ConsumeResources(__instance.m_craftRecipe.m_resources, qualityLevel);
                }
                __instance.UpdateCraftingPanel();
            }
            // displaying some effects
            CraftingStation currentCraftingStation = Player.m_localPlayer.GetCurrentCraftingStation();
            var             effs = (currentCraftingStation != null) ? currentCraftingStation.m_craftItemDoneEffects : __instance.m_craftItemDoneEffects;

            effs.Create(player.transform.position, Quaternion.identity);

            Game.instance.GetPlayerProfile().m_playerStats.m_crafts++;
            Gogan.LogEvent("Game", "Crafted", __instance.m_craftRecipe.m_item.m_itemData.m_shared.m_name, qualityLevel);

            return(false);
        }
Пример #3
0
            private static bool Prefix(StoreGui __instance)
            {
                string name = Traverse.Create(__instance).Field <Trader>("m_trader").Value.m_name;

                if (OdinPlus.traderNameList.Contains(name))
                {
                    var m_selectedItem = Traverse.Create(__instance).Field <Trader.TradeItem>("m_selectedItem").Value;
                    int stack          = Mathf.Min(m_selectedItem.m_stack, m_selectedItem.m_prefab.m_itemData.m_shared.m_maxStackSize);
                    if (m_selectedItem == null || (m_selectedItem.m_price * stack - OdinData.Credits > 0))
                    {
                        return(false);
                    }
                    int quality = m_selectedItem.m_prefab.m_itemData.m_quality;
                    int variant = m_selectedItem.m_prefab.m_itemData.m_variant;
                    if (Player.m_localPlayer.GetInventory().AddItem(m_selectedItem.m_prefab.name, stack, quality, variant, 0L, "") != null)
                    {
                        OdinData.RemoveCredits(m_selectedItem.m_price * stack);                        //?
                        __instance.m_buyEffects.Create(__instance.gameObject.transform.position, Quaternion.identity, null, 1f);
                        Player.m_localPlayer.ShowPickupMessage(m_selectedItem.m_prefab.m_itemData, m_selectedItem.m_prefab.m_itemData.m_stack);
                        Traverse.Create(__instance).Method("FillList").GetValue();
                        Gogan.LogEvent("Game", "BoughtItem", m_selectedItem.m_prefab.name, 0L);
                    }
                    return(false);
                }
                return(true);
            }
Пример #4
0
    // Token: 0x06000275 RID: 629 RVA: 0x00013E74 File Offset: 0x00012074
    public void RaiseSkill(Skills.SkillType skillType, float factor = 1f)
    {
        if (skillType == Skills.SkillType.None)
        {
            return;
        }
        Skills.Skill skill = this.GetSkill(skillType);
        float        level = skill.m_level;

        if (skill.Raise(factor))
        {
            if (this.m_useSkillCap)
            {
                this.RebalanceSkills(skillType);
            }
            this.m_player.OnSkillLevelup(skillType, skill.m_level);
            MessageHud.MessageType type = ((int)level == 0) ? MessageHud.MessageType.Center : MessageHud.MessageType.TopLeft;
            this.m_player.Message(type, string.Concat(new object[]
            {
                "$msg_skillup $skill_",
                skill.m_info.m_skill.ToString().ToLower(),
                ": ",
                (int)skill.m_level
            }), 0, skill.m_info.m_icon);
            Gogan.LogEvent("Game", "Levelup", skillType.ToString(), (long)((int)skill.m_level));
        }
    }
Пример #5
0
    // Token: 0x0600038A RID: 906 RVA: 0x0001E958 File Offset: 0x0001CB58
    public StatusEffect AddStatusEffect(StatusEffect statusEffect, bool resetTime = false)
    {
        StatusEffect statusEffect2 = this.GetStatusEffect(statusEffect.name);

        if (statusEffect2)
        {
            if (resetTime)
            {
                statusEffect2.ResetTime();
            }
            return(null);
        }
        if (!statusEffect.CanAdd(this.m_character))
        {
            return(null);
        }
        StatusEffect statusEffect3 = statusEffect.Clone();

        this.m_statusEffects.Add(statusEffect3);
        statusEffect3.Setup(this.m_character);
        if (this.m_character.IsPlayer())
        {
            Gogan.LogEvent("Game", "StatusEffect", statusEffect.name, 0L);
        }
        return(statusEffect3);
    }
Пример #6
0
        public static bool Prefix(Player __instance)
        {
            long         playerID        = __instance.GetPlayerID();
            HardcoreData hardcoreProfile = Hardcore.GetHardcoreDataForProfileID(playerID);

            if (hardcoreProfile != null && hardcoreProfile.isHardcore)
            {
                hardcoreProfile.hasDied = true;

                Traverse tPlayer = Traverse.Create(__instance);
                tPlayer.Field <bool>("m_firstSpawn").Value = true;

                ZNetView nview = tPlayer.Field <ZNetView>("m_nview").Value;
                nview.GetZDO().Set("dead", true);
                nview.InvokeRPC(ZNetView.Everybody, "OnDeath", Array.Empty <object>());
                tPlayer.Method("CreateDeathEffects").GetValue(new object[] { });
                tPlayer.Field <GameObject>("m_visual").Value.SetActive(false);
                tPlayer.Field <List <Player.Food> >("m_foods").Value.Clear();

                __instance.UnequipAllItems();
                __instance.GetInventory().RemoveAll();

                if (Hardcore.Settings.ClearCustomSpawn.Value)
                {
                    Game.instance.GetPlayerProfile().ClearCustomSpawnPoint();
                }
                Game.instance.RequestRespawn(10f);

                Gogan.LogEvent("Game", "Death", "biome: " + __instance.GetCurrentBiome().ToString(), 0L);

                return(false);
            }

            return(true);
        }
Пример #7
0
 // Token: 0x06000EA4 RID: 3748 RVA: 0x00068AF0 File Offset: 0x00066CF0
 private void Talk()
 {
     if (!Player.m_localPlayer)
     {
         return;
     }
     if (this.m_currentText == null)
     {
         return;
     }
     if (this.m_currentText.m_key.Length > 0)
     {
         Player.m_localPlayer.SetSeenTutorial(this.m_currentText.m_key);
         Gogan.LogEvent("Game", "Raven", this.m_currentText.m_key, 0L);
     }
     else
     {
         Gogan.LogEvent("Game", "Raven", this.m_currentText.m_topic, 0L);
     }
     this.m_hasTalked = true;
     if (this.m_currentText.m_label.Length > 0)
     {
         Player.m_localPlayer.AddKnownText(this.m_currentText.m_label, this.m_currentText.m_text);
     }
     this.Say(this.m_currentText.m_topic, this.m_currentText.m_text, false, true, true);
 }
Пример #8
0
        public static bool Prefix(InventoryGui __instance, Player player)
        {
            if (__instance.m_craftRecipe == null)
            {
                return(false);
            }

            var newQuality = __instance.m_craftUpgradeItem?.m_quality + 1 ?? 1;

            if (newQuality > __instance.m_craftRecipe.m_item.m_itemData.m_shared.m_maxQuality ||
                !player.HaveRequirements(__instance.m_craftRecipe, false, newQuality) && !player.NoCostCheat() ||
                (__instance.m_craftUpgradeItem != null &&
                 !player.GetInventory().ContainsItem(__instance.m_craftUpgradeItem) ||
                 __instance.m_craftUpgradeItem == null &&
                 !player.GetInventory().HaveEmptySlot()))
            {
                return(false);
            }

            if (__instance.m_craftRecipe.m_item.m_itemData.m_shared.m_dlc.Length > 0 && !DLCMan.instance.IsDLCInstalled(__instance.m_craftRecipe.m_item.m_itemData.m_shared.m_dlc))
            {
                return(false);
            }

            if (__instance.m_craftUpgradeItem != null && __instance.m_craftUpgradeItem.IsMagic())
            {
                Debug.LogWarning("Trying to upgrade magic item");
                var upgradeItem = __instance.m_craftUpgradeItem;
                player.UnequipItem(upgradeItem);

                upgradeItem.m_crafterID = player.GetPlayerID();
                upgradeItem.SetCrafterName(player.GetPlayerName());
                upgradeItem.m_quality = newQuality;

                if (!player.NoCostCheat())
                {
                    player.ConsumeResources(__instance.m_craftRecipe.m_resources, newQuality);
                }
                __instance.UpdateCraftingPanel();

                var currentCraftingStation = Player.m_localPlayer.GetCurrentCraftingStation();
                if (currentCraftingStation != null)
                {
                    currentCraftingStation.m_craftItemDoneEffects.Create(player.transform.position, Quaternion.identity);
                }
                else
                {
                    __instance.m_craftItemDoneEffects.Create(player.transform.position, Quaternion.identity);
                }

                ++Game.instance.GetPlayerProfile().m_playerStats.m_crafts;
                Gogan.LogEvent("Game", "Crafted", __instance.m_craftRecipe.m_item.m_itemData.m_shared.m_name, (long)newQuality);

                return(false);
            }

            return(true);
        }
Пример #9
0
        public override void DoCrafting(InventoryGui __instance, Player player)
        {
            if (SelectedRecipe >= 0 && SelectedRecipe < Recipes.Count)
            {
                var recipe = Recipes[SelectedRecipe];

                if (!recipe.FromItem.IsExtended())
                {
                    var inventory = player.GetInventory();
                    inventory.RemoveItem(recipe.FromItem);
                    var extendedItemData = new ExtendedItemData(recipe.FromItem);
                    inventory.m_inventory.Add(extendedItemData);
                    inventory.Changed();
                    recipe.FromItem = extendedItemData;
                }

                float previousDurabilityPercent = 0;
                if (recipe.FromItem.m_shared.m_useDurability)
                {
                    previousDurabilityPercent = recipe.FromItem.m_durability / recipe.FromItem.GetMaxDurability();
                }

                var luckFactor         = player.GetTotalActiveMagicEffectValue(MagicEffectType.Luck, 0.01f);
                var magicItemComponent = recipe.FromItem.Extended().AddComponent <MagicItemComponent>();
                var magicItem          = LootRoller.RollMagicItem(SelectedRarity, recipe.FromItem.Extended(), luckFactor);
                magicItemComponent.SetMagicItem(magicItem);

                EquipmentEffectCache.Reset(player);

                // Spend Resources
                if (!player.NoCostCheat())
                {
                    player.ConsumeResources(GetRecipeRequirementArray(recipe, SelectedRarity), 1);
                }

                // Maintain durability
                if (recipe.FromItem.m_shared.m_useDurability)
                {
                    recipe.FromItem.m_durability = previousDurabilityPercent * recipe.FromItem.GetMaxDurability();
                }

                __instance.UpdateCraftingPanel();

                if (player.GetCurrentCraftingStation() != null)
                {
                    player.GetCurrentCraftingStation().m_craftItemDoneEffects.Create(player.transform.position, Quaternion.identity);
                }

                SuccessDialog.Show(recipe.FromItem.Extended());

                MagicItemEffects.Indestructible.MakeItemIndestructible(recipe.FromItem);

                Game.instance.GetPlayerProfile().m_playerStats.m_crafts++;
                Gogan.LogEvent("Game", "Enchanted", recipe.FromItem.m_shared.m_name, 1);
            }
        }
Пример #10
0
 // Token: 0x06000FF4 RID: 4084 RVA: 0x000705D8 File Offset: 0x0006E7D8
 public bool Interact(Humanoid character, bool hold)
 {
     if (hold)
     {
         return(false);
     }
     Game.instance.DiscoverClosestLocation(this.m_locationName, base.transform.position, this.m_pinName, (int)this.m_pinType);
     Gogan.LogEvent("Game", "Vegvisir", this.m_locationName, 0L);
     return(true);
 }
            static void Postfix(FejdStartup __instance)
            {
                if (!CheckKeyDown(hotKey.Value))
                {
                    return;
                }

                Dbgl("pressed hot key");

                string worldName = PlayerPrefs.GetString("world");

                Game.SetProfile(PlayerPrefs.GetString("profile"));

                if (worldName == null || worldName.Length == 0)
                {
                    return;
                }

                Dbgl($"got world name {worldName}");

                typeof(FejdStartup).GetMethod("UpdateCharacterList", BindingFlags.NonPublic | BindingFlags.Instance).Invoke(__instance, new object[] { });
                typeof(FejdStartup).GetMethod("UpdateWorldList", BindingFlags.NonPublic | BindingFlags.Instance).Invoke(__instance, new object[] { true });

                bool   isOn  = __instance.m_publicServerToggle.isOn;
                bool   isOn2 = __instance.m_openServerToggle.isOn;
                string text  = __instance.m_serverPassword.text;
                World  world = (World)typeof(FejdStartup).GetMethod("FindWorld", BindingFlags.NonPublic | BindingFlags.Instance).Invoke(__instance, new object[] { worldName });

                if (world == null)
                {
                    return;
                }

                Dbgl($"got world");


                ZNet.SetServer(true, isOn2, isOn, worldName, text, world);
                ZNet.ResetServerHost();

                Dbgl($"Set server");
                try
                {
                    string eventLabel = "open:" + isOn2.ToString() + ",public:" + isOn.ToString();
                    Gogan.LogEvent("Menu", "WorldStart", eventLabel, 0L);
                }
                catch
                {
                    Dbgl($"Error calling Gogan... oh well");
                }

                Dbgl($"transitioning...");

                typeof(FejdStartup).GetMethod("TransitionToMainScene", BindingFlags.NonPublic | BindingFlags.Instance).Invoke(__instance, new object[] { });
            }
Пример #12
0
    // Token: 0x060004EF RID: 1263 RVA: 0x00028E08 File Offset: 0x00027008
    public void OnSend()
    {
        if (!this.IsValid())
        {
            return;
        }
        string category = this.GetCategory();

        Gogan.LogEvent("Feedback_" + category, this.m_subject.text, this.m_text.text, 0L);
        UnityEngine.Object.Destroy(base.gameObject);
    }
Пример #13
0
        public override void DoCrafting(InventoryGui __instance, Player player)
        {
            if (SelectedRecipe >= 0 && SelectedRecipe < Recipes.Count)
            {
                var recipe          = Recipes[SelectedRecipe];
                var inventory       = player.GetInventory();
                var disenchantCount = _disenchantAllFlag ? recipe.FromItem.m_stack : 1;
                inventory.RemoveItem(recipe.FromItem, disenchantCount);
                var didntAdd = new List <KeyValuePair <ItemDrop.ItemData, int> >();
                foreach (var product in recipe.Products)
                {
                    var amountToAdd = product.Value * disenchantCount;
                    var addSuccess  = false;
                    var canAdd      = player.GetInventory().CanAddItem(product.Key.m_itemData, amountToAdd);
                    if (canAdd)
                    {
                        var itemData = player.GetInventory().AddItem(product.Key.name, amountToAdd, 1, 0, 0, "");
                        addSuccess = itemData != null;
                        if (itemData != null && itemData.IsMagicCraftingMaterial())
                        {
                            itemData.m_variant = EpicLoot.GetRarityIconIndex(itemData.GetRarity());
                        }
                    }

                    if (!addSuccess)
                    {
                        var newItem = product.Key.m_itemData.Clone();
                        newItem.m_dropPrefab = ObjectDB.instance.GetItemPrefab(product.Key.GetPrefabName(product.Key.gameObject.name));
                        didntAdd.Add(new KeyValuePair <ItemDrop.ItemData, int>(newItem, amountToAdd));
                    }
                }
                __instance.UpdateCraftingPanel();

                foreach (var itemNotAdded in didntAdd)
                {
                    var itemDrop = ItemDrop.DropItem(itemNotAdded.Key, itemNotAdded.Value, player.transform.position + player.transform.forward + player.transform.up, player.transform.rotation);
                    itemDrop.GetComponent <Rigidbody>().velocity = (player.transform.forward + Vector3.up) * 5f;
                    player.Message(MessageHud.MessageType.TopLeft, $"$msg_dropped {itemDrop.m_itemData.m_shared.m_name} $mod_epicloot_sacrifice_inventoryfullexplanation", itemDrop.m_itemData.m_stack, itemDrop.m_itemData.GetIcon());
                }

                if (player.GetCurrentCraftingStation() != null)
                {
                    player.GetCurrentCraftingStation().m_craftItemDoneEffects.Create(player.transform.position, Quaternion.identity);
                }

                Game.instance.GetPlayerProfile().m_playerStats.m_crafts++;
                Gogan.LogEvent("Game", "Disenchanted", recipe.FromItem.m_shared.m_name, 1);
            }

            _disenchantAllFlag = false;
        }
Пример #14
0
 public static bool Update(ref Menu __instance)
 {
     if (Game.instance.IsShuttingDown())
     {
         __instance.m_root.gameObject.SetActive(false);
         return(false);
     }
     if (__instance.m_root.gameObject.activeSelf)
     {
         AccessTools.Field(typeof(Menu), "m_hiddenFrames").SetValue(__instance, 0);
         if ((Input.GetKeyDown(KeyCode.Escape) || ZInput.GetButtonDown("JoyMenu")) && !(GameObject)AccessTools.Field(typeof(Menu), "m_settingsInstance").GetValue(__instance) && !Feedback.IsVisible())
         {
             if (__instance.m_quitDialog.gameObject.activeSelf)
             {
                 __instance.OnQuitNo();
                 return(false);
             }
             if (__instance.m_logoutDialog.gameObject.activeSelf)
             {
                 __instance.OnLogoutNo();
                 return(false);
             }
             StartTime();
             __instance.m_root.gameObject.SetActive(false);
             return(false);
         }
     }
     else
     {
         int m_hiddenFrames = (int)AccessTools.Field(typeof(Menu), "m_hiddenFrames").GetValue(__instance);
         m_hiddenFrames++;
         AccessTools.Field(typeof(Menu), "m_hiddenFrames").SetValue(__instance, m_hiddenFrames);
         bool flag = !InventoryGui.IsVisible() && !Minimap.IsOpen() && !global::Console.IsVisible() && !TextInput.IsVisible() && !ZNet.instance.InPasswordDialog() && !StoreGui.IsVisible() && !Hud.IsPieceSelectionVisible();
         if (((Input.GetKeyDown(KeyCode.Escape) || ZInput.GetButtonDown("JoyMenu")) || (!Application.isFocused && focusPause.Value && ZNet.instance.IsServer())) && flag)
         {
             __instance.m_root.gameObject.SetActive(true);
             __instance.m_menuDialog.gameObject.SetActive(true);
             if (ZNet.instance.IsServer())
             {
                 StopTime();
                 __instance.m_root.Find("OLD_menu").gameObject.SetActive(true);
                 __instance.m_root.Find("Menu").gameObject.SetActive(false);
             }
             Gogan.LogEvent("Screen", "Enter", "Menu", 0L);
             __instance.m_logoutDialog.gameObject.SetActive(false);
             __instance.m_quitDialog.gameObject.SetActive(false);
         }
     }
     return(false);
 }
Пример #15
0
        public static void LowerSkill(this Skills __instance, SkillType skillType, float factor = 1f)
        {
            if (skillType == SkillType.None)
            {
                return;
            }
            Skill skill = __instance.GetSkill(skillType);
            float level = skill.m_level;

            if (skill.Lower(factor))
            {
                __instance.m_player.OnSkillLevelup(skillType, skill.m_level);
                MessageHud.MessageType type = (((int)level != 0) ? MessageHud.MessageType.TopLeft : MessageHud.MessageType.Center);
                __instance.m_player.Message(type, "Skill reduced (control) $skill_" + skill.m_info.m_skill.ToString().ToLower() + ": " + (int)skill.m_level, 0, skill.m_info.m_icon);
                Gogan.LogEvent("Game", "Leveldown", skillType.ToString(), (int)skill.m_level);
            }
        }
Пример #16
0
        private void OnAugmentComplete(AugmentRecipe recipe, MagicItemEffect newEffect)
        {
            if (recipe != null)
            {
                var magicItem = recipe.FromItem.GetMagicItem();

                if (magicItem.HasEffect(MagicEffectType.Indestructible))
                {
                    recipe.FromItem.m_shared.m_useDurability = recipe.FromItem.m_dropPrefab?.GetComponent <ItemDrop>().m_itemData.m_shared.m_useDurability ?? false;

                    if (recipe.FromItem.m_shared.m_useDurability)
                    {
                        recipe.FromItem.m_durability = recipe.FromItem.GetMaxDurability();
                    }
                }

                magicItem.ReplaceEffect(recipe.EffectIndex, newEffect);

                if (magicItem.Rarity == ItemRarity.Rare)
                {
                    magicItem.DisplayName = MagicItemNames.GetNameForItem(recipe.FromItem, magicItem);
                }

                // Note: I do not know why I have to do this, but this is the only thing that causes this item to save correctly
                recipe.FromItem.Extended().RemoveComponent <MagicItemComponent>();
                recipe.FromItem.Extended().AddComponent <MagicItemComponent>().SetMagicItem(magicItem);

                InventoryGui.instance?.UpdateCraftingPanel();

                var player = Player.m_localPlayer;
                if (player.GetCurrentCraftingStation() != null)
                {
                    player.GetCurrentCraftingStation().m_craftItemDoneEffects.Create(player.transform.position, Quaternion.identity);
                }

                OnSelectorValueChanged(recipe.EffectIndex, true);

                MagicItemEffects.Indestructible.MakeItemIndestructible(recipe.FromItem);

                Game.instance.GetPlayerProfile().m_playerStats.m_crafts++;
                Gogan.LogEvent("Game", "Augmented", recipe.FromItem.m_shared.m_name, 1);

                EquipmentEffectCache.Reset(player);
            }
        }
Пример #17
0
        private static void StartCharacterEdit()
        {
            Dbgl($"Start editing character");

            editingCharacter = true;

            title.gameObject.SetActive(true);
            FejdStartup.instance.m_newCharacterPanel.transform.Find("Topic").gameObject.SetActive(false);

            PlayerProfile playerProfile = Traverse.Create(FejdStartup.instance).Field("m_profiles").GetValue <List <PlayerProfile> >()[Traverse.Create(FejdStartup.instance).Field("m_profileIndex").GetValue <int>()];

            FejdStartup.instance.m_newCharacterPanel.SetActive(true);
            FejdStartup.instance.m_selectCharacterPanel.SetActive(false);
            FejdStartup.instance.m_csNewCharacterName.text = playerProfile.GetName();
            FejdStartup.instance.m_newCharacterError.SetActive(false);
            Traverse.Create(FejdStartup.instance).Method("SetupCharacterPreview", new object[] { playerProfile }).GetValue();
            Gogan.LogEvent("Screen", "Enter", "CreateCharacter", 0L);
        }
Пример #18
0
    // Token: 0x0600062C RID: 1580 RVA: 0x00034A18 File Offset: 0x00032C18
    private void BuySelectedItem()
    {
        if (this.m_selectedItem == null || !this.CanAfford(this.m_selectedItem))
        {
            return;
        }
        int stack   = Mathf.Min(this.m_selectedItem.m_stack, this.m_selectedItem.m_prefab.m_itemData.m_shared.m_maxStackSize);
        int quality = this.m_selectedItem.m_prefab.m_itemData.m_quality;
        int variant = this.m_selectedItem.m_prefab.m_itemData.m_variant;

        if (Player.m_localPlayer.GetInventory().AddItem(this.m_selectedItem.m_prefab.name, stack, quality, variant, 0L, "") != null)
        {
            Player.m_localPlayer.GetInventory().RemoveItem(this.m_coinPrefab.m_itemData.m_shared.m_name, this.m_selectedItem.m_price);
            this.m_trader.OnBought(this.m_selectedItem);
            this.m_buyEffects.Create(base.transform.position, Quaternion.identity, null, 1f);
            Player.m_localPlayer.ShowPickupMessage(this.m_selectedItem.m_prefab.m_itemData, this.m_selectedItem.m_prefab.m_itemData.m_stack);
            this.FillList();
            Gogan.LogEvent("Game", "BoughtItem", this.m_selectedItem.m_prefab.name, 0L);
        }
    }
Пример #19
0
    public void RaiseSkill(Skills.SkillType skillType, float factor = 1f)
    {
        if (skillType == Skills.SkillType.None)
        {
            return;
        }
        Skills.Skill skill = this.GetSkill(skillType);
        float        level = skill.m_level;

        if (!skill.Raise(factor))
        {
            return;
        }
        if (this.m_useSkillCap)
        {
            this.RebalanceSkills(skillType);
        }
        this.m_player.OnSkillLevelup(skillType, skill.m_level);
        this.m_player.Message((int)level == 0 ? MessageHud.MessageType.Center : MessageHud.MessageType.TopLeft, "$msg_skillup $skill_" + skill.m_info.m_skill.ToString().ToLower() + ": " + (object)(int)skill.m_level, 0, skill.m_info.m_icon);
        Gogan.LogEvent("Game", "Levelup", skillType.ToString(), (long)(int)skill.m_level);
    }
Пример #20
0
 // Token: 0x06000582 RID: 1410 RVA: 0x0002F520 File Offset: 0x0002D720
 private void Update()
 {
     if (Game.instance.IsShuttingDown())
     {
         this.m_root.gameObject.SetActive(false);
         return;
     }
     if (this.m_root.gameObject.activeSelf)
     {
         this.m_hiddenFrames = 0;
         if ((Input.GetKeyDown(KeyCode.Escape) || ZInput.GetButtonDown("JoyMenu")) && !this.m_settingsInstance && !Feedback.IsVisible())
         {
             if (this.m_quitDialog.gameObject.activeSelf)
             {
                 this.OnQuitNo();
                 return;
             }
             if (this.m_logoutDialog.gameObject.activeSelf)
             {
                 this.OnLogoutNo();
                 return;
             }
             this.m_root.gameObject.SetActive(false);
             return;
         }
     }
     else
     {
         this.m_hiddenFrames++;
         bool flag = !InventoryGui.IsVisible() && !Minimap.IsOpen() && !global::Console.IsVisible() && !TextInput.IsVisible() && !ZNet.instance.InPasswordDialog() && !StoreGui.IsVisible() && !Hud.IsPieceSelectionVisible();
         if ((Input.GetKeyDown(KeyCode.Escape) || ZInput.GetButtonDown("JoyMenu")) && flag)
         {
             Gogan.LogEvent("Screen", "Enter", "Menu", 0L);
             this.m_root.gameObject.SetActive(true);
             this.m_menuDialog.gameObject.SetActive(true);
             this.m_logoutDialog.gameObject.SetActive(false);
             this.m_quitDialog.gameObject.SetActive(false);
         }
     }
 }
Пример #21
0
        private void OnAugmentComplete(AugmentRecipe recipe, MagicItemEffect newEffect)
        {
            if (recipe != null)
            {
                var magicItem = recipe.FromItem.GetMagicItem();

                if (magicItem.HasBeenAugmented())
                {
                    magicItem.ReplaceEffect(magicItem.AugmentedEffectIndex, newEffect);
                }
                else
                {
                    magicItem.ReplaceEffect(recipe.EffectIndex, newEffect);
                }

                if (magicItem.Rarity == ItemRarity.Rare)
                {
                    magicItem.DisplayName = MagicItemNames.GetNameForItem(recipe.FromItem, magicItem);
                }

                // Note: I do not know why I have to do this, but this is the only thing that causes this item to save correctly
                recipe.FromItem.Extended().RemoveComponent <MagicItemComponent>();
                recipe.FromItem.Extended().AddComponent <MagicItemComponent>().SetMagicItem(magicItem);

                InventoryGui.instance?.UpdateCraftingPanel();

                var player = Player.m_localPlayer;
                if (player.GetCurrentCraftingStation() != null)
                {
                    player.GetCurrentCraftingStation().m_craftItemDoneEffects.Create(player.transform.position, Quaternion.identity);
                }

                OnSelectorValueChanged(recipe.EffectIndex, true);

                Game.instance.GetPlayerProfile().m_playerStats.m_crafts++;
                Gogan.LogEvent("Game", "Augmented", recipe.FromItem.m_shared.m_name, 1);
            }
        }
        public override void DoCrafting(InventoryGui __instance, Player player)
        {
            if (SelectedRecipe >= 0 && SelectedRecipe < Recipes.Count)
            {
                var recipe = Recipes[SelectedRecipe];

                if (!recipe.FromItem.IsExtended())
                {
                    var inventory = player.GetInventory();
                    inventory.RemoveItem(recipe.FromItem);
                    var extendedItemData = new ExtendedItemData(recipe.FromItem);
                    inventory.m_inventory.Add(extendedItemData);
                    inventory.Changed();
                    recipe.FromItem = extendedItemData;
                }

                var magicItemComponent = recipe.FromItem.Extended().AddComponent <MagicItemComponent>();
                var magicItem          = LootRoller.RollMagicItem(recipe.ToRarity, recipe.FromItem.Extended());
                magicItemComponent.SetMagicItem(magicItem);

                // Spend Resources
                if (!player.NoCostCheat())
                {
                    player.ConsumeResources(recipe.GetRequirementArray(), 1);
                }
                __instance.UpdateCraftingPanel();

                if (player.GetCurrentCraftingStation() != null)
                {
                    player.GetCurrentCraftingStation().m_craftItemDoneEffects.Create(player.transform.position, Quaternion.identity);
                }

                Game.instance.GetPlayerProfile().m_playerStats.m_crafts++;
                Gogan.LogEvent("Game", "Disenchanted", recipe.FromItem.m_shared.m_name, 1);
            }
        }
Пример #23
0
 // Token: 0x06000AB0 RID: 2736 RVA: 0x0004D23C File Offset: 0x0004B43C
 private void Awake()
 {
     Game.m_instance = this;
     ZInput.Initialize();
     if (!global::Console.instance)
     {
         UnityEngine.Object.Instantiate <GameObject>(this.m_consolePrefab);
     }
     if (string.IsNullOrEmpty(Game.m_profileFilename))
     {
         this.m_playerProfile = new PlayerProfile("Developer");
         this.m_playerProfile.SetName("Odev");
         this.m_playerProfile.Load();
     }
     else
     {
         ZLog.Log("Loading player profile " + Game.m_profileFilename);
         this.m_playerProfile = new PlayerProfile(Game.m_profileFilename);
         this.m_playerProfile.Load();
     }
     base.InvokeRepeating("CollectResources", 600f, 600f);
     Gogan.LogEvent("Screen", "Enter", "InGame", 0L);
     Gogan.LogEvent("Game", "InputMode", ZInput.IsGamepadActive() ? "Gamepad" : "MK", 0L);
 }
Пример #24
0
            static bool Prefix(Player __instance, Inventory ___m_inventory, ref float ___m_timeSinceDeath, float ___m_hardDeathCooldown, ZNetView ___m_nview, List <Player.Food> ___m_foods, Skills ___m_skills)
            {
                if (!modEnabled.Value)
                {
                    return(true);
                }

                ___m_nview.GetZDO().Set("dead", true);
                ___m_nview.InvokeRPC(ZNetView.Everybody, "OnDeath", new object[] { });
                Game.instance.GetPlayerProfile().m_playerStats.m_deaths++;

                Game.instance.GetPlayerProfile().SetDeathPoint(__instance.transform.position);

                if (createDeathEffects.Value)
                {
                    Traverse.Create(__instance).Method("CreateDeathEffects").GetValue();
                }

                List <ItemDrop.ItemData> dropItems = new List <ItemDrop.ItemData>();

                if (!keepAllItems.Value)
                {
                    List <Inventory> inventories = new List <Inventory>();

                    if (quickSlotsAssembly != null)
                    {
                        var extendedInventory = quickSlotsAssembly.GetType("EquipmentAndQuickSlots.InventoryExtensions").GetMethod("Extended", BindingFlags.Public | BindingFlags.Static).Invoke(null, new object[] { ___m_inventory });
                        inventories = (List <Inventory>)quickSlotsAssembly.GetType("EquipmentAndQuickSlots.ExtendedInventory").GetField("_inventories", BindingFlags.NonPublic | BindingFlags.Instance).GetValue(extendedInventory);
                    }
                    else
                    {
                        inventories.Add(___m_inventory);
                    }

                    for (int i = 0; i < inventories.Count; i++)
                    {
                        Inventory inv = inventories[i];

                        if (quickSlotsAssembly != null && keepQuickSlotItems.Value && inv == (Inventory)quickSlotsAssembly.GetType("EquipmentAndQuickSlots.PlayerExtensions").GetMethod("GetQuickSlotInventory", BindingFlags.Public | BindingFlags.Static).Invoke(null, new object[] { __instance }))
                        {
                            Dbgl("Skipping quick slot inventory");
                            continue;
                        }

                        List <ItemDrop.ItemData> keepItems = Traverse.Create(inv).Field("m_inventory").GetValue <List <ItemDrop.ItemData> >();

                        if (destroyAllItems.Value)
                        {
                            keepItems.Clear();
                        }
                        else
                        {
                            for (int j = keepItems.Count - 1; j >= 0; j--)
                            {
                                ItemDrop.ItemData item = keepItems[j];

                                if (keepEquippedItems.Value && item.m_equiped)
                                {
                                    continue;
                                }

                                if (keepHotbarItems.Value && item.m_gridPos.y == 0)
                                {
                                    continue;
                                }

                                if (item.m_shared.m_questItem)
                                {
                                    continue;
                                }

                                if (destroyItemTypes.Value.Length > 0)
                                {
                                    string[] destroyTypes = destroyItemTypes.Value.Split(',');
                                    if (destroyTypes.Contains(Enum.GetName(typeof(ItemDrop.ItemData.ItemType), item.m_shared.m_itemType)))
                                    {
                                        keepItems.RemoveAt(j);
                                        continue;
                                    }
                                }

                                if (keepItemTypes.Value.Length > 0)
                                {
                                    string[] keepTypes = keepItemTypes.Value.Split(',');
                                    if (keepTypes.Contains(Enum.GetName(typeof(ItemDrop.ItemData.ItemType), item.m_shared.m_itemType)))
                                    {
                                        continue;
                                    }
                                }
                                else if (dropItemTypes.Value.Length > 0)
                                {
                                    string[] dropTypes = dropItemTypes.Value.Split(',');
                                    if (dropTypes.Contains(Enum.GetName(typeof(ItemDrop.ItemData.ItemType), item.m_shared.m_itemType)))
                                    {
                                        dropItems.Add(item);
                                        keepItems.RemoveAt(j);
                                    }
                                    continue;
                                }

                                dropItems.Add(item);
                                keepItems.RemoveAt(j);
                            }
                        }
                        Traverse.Create(inv).Method("Changed").GetValue();
                    }
                }

                if (useTombStone.Value && dropItems.Any())
                {
                    GameObject gameObject = Instantiate(__instance.m_tombstone, __instance.GetCenterPoint(), __instance.transform.rotation);
                    gameObject.GetComponent <Container>().GetInventory().RemoveAll();


                    int width  = Traverse.Create(___m_inventory).Field("m_width").GetValue <int>();
                    int height = Traverse.Create(___m_inventory).Field("m_height").GetValue <int>();
                    Traverse.Create(gameObject.GetComponent <Container>().GetInventory()).Field("m_width").SetValue(width);
                    Traverse.Create(gameObject.GetComponent <Container>().GetInventory()).Field("m_height").SetValue(height);


                    Traverse.Create(gameObject.GetComponent <Container>().GetInventory()).Field("m_inventory").SetValue(dropItems);
                    Traverse.Create(gameObject.GetComponent <Container>().GetInventory()).Method("Changed").GetValue();

                    TombStone     component     = gameObject.GetComponent <TombStone>();
                    PlayerProfile playerProfile = Game.instance.GetPlayerProfile();
                    component.Setup(playerProfile.GetName(), playerProfile.GetPlayerID());
                }
                else
                {
                    foreach (ItemDrop.ItemData item in dropItems)
                    {
                        Vector3    position = __instance.transform.position + Vector3.up * 0.5f + UnityEngine.Random.insideUnitSphere * 0.3f;
                        Quaternion rotation = Quaternion.Euler(0f, (float)UnityEngine.Random.Range(0, 360), 0f);
                        ItemDrop.DropItem(item, 0, position, rotation);
                    }
                }

                if (!keepFoodLevels.Value)
                {
                    ___m_foods.Clear();
                }

                bool hardDeath = noSkillProtection.Value || ___m_timeSinceDeath > ___m_hardDeathCooldown;

                if (hardDeath && reduceSkills.Value)
                {
                    ___m_skills.OnDeath();
                }
                Game.instance.RequestRespawn(10f);

                ___m_timeSinceDeath = 0;

                if (!hardDeath)
                {
                    __instance.Message(MessageHud.MessageType.TopLeft, "$msg_softdeath", 0, null);
                }
                __instance.Message(MessageHud.MessageType.Center, "$msg_youdied", 0, null);
                __instance.ShowTutorial("death", false);
                string eventLabel = "biome:" + __instance.GetCurrentBiome().ToString();

                Gogan.LogEvent("Game", "Death", eventLabel, 0L);

                return(false);
            }
Пример #25
0
        static void Postfix(Console __instance)
        {
            string text = __instance.m_input.text;

            string[] array = text.Split(new char[]
                                        { ' ' });

            // do not enable unless we are on dedicated server
            if (__instance.IsCheatsEnabled() && !ZNet_Patch.m_isServer)
            {
                if (array[0] == "debugmode")
                {
                    Player.m_debugMode = !Player.m_debugMode;
                    __instance.Print("Debugmode " + Player.m_debugMode.ToString());
                }

                if (text.StartsWith("god"))
                {
                    Player.m_localPlayer.SetGodMode(!Player.m_localPlayer.InGodMode());
                    __instance.Print("God mode:" + Player.m_localPlayer.InGodMode().ToString());
                    Gogan.LogEvent("Cheat", "God", Player.m_localPlayer.InGodMode().ToString(), 0L);
                }

                if (array[0] == "raiseskill")
                {
                    if (array.Length > 2)
                    {
                        string name = array[1];
                        int    num4 = int.Parse(array[2]);
                        Player.m_localPlayer.GetSkills().CheatRaiseSkill(name, (float)num4);
                        return;
                    }
                    __instance.Print("Syntax: raiseskill [skill] [amount]");
                    return;
                }
                else if (array[0] == "resetskill")
                {
                    if (array.Length > 1)
                    {
                        string name2 = array[1];
                        Player.m_localPlayer.GetSkills().CheatResetSkill(name2);
                        return;
                    }
                    __instance.Print("Syntax: resetskill [skill]");
                    return;
                }

                if (text.StartsWith("exploremap"))
                {
                    Minimap.instance.ExploreAll();
                    return;
                }
                if (text.StartsWith("resetmap"))
                {
                    Minimap.instance.Reset();
                    return;
                }
                if (text.StartsWith("puke") && Player.m_localPlayer)
                {
                    Player.m_localPlayer.ClearFood();
                }
                if (text.StartsWith("tame"))
                {
                    Tameable.TameAllInArea(Player.m_localPlayer.transform.position, 20f);
                }
                if (text.StartsWith("killall"))
                {
                    foreach (Character character in Character.GetAllCharacters())
                    {
                        if (!character.IsPlayer())
                        {
                            HitData hitData = new HitData();
                            hitData.m_damage.m_damage = 1E+10f;
                            character.Damage(hitData);
                        }
                    }
                    return;
                }
                if (text.StartsWith("heal"))
                {
                    Player.m_localPlayer.Heal(Player.m_localPlayer.GetMaxHealth(), true);
                    return;
                }

                if (text.StartsWith("ghost"))
                {
                    Player.m_localPlayer.SetGhostMode(!Player.m_localPlayer.InGhostMode());
                    __instance.Print("Ghost mode:" + Player.m_localPlayer.InGhostMode().ToString());
                    Gogan.LogEvent("Cheat", "Ghost", Player.m_localPlayer.InGhostMode().ToString(), 0L);
                }

                if (text.StartsWith("removedrops"))
                {
                    __instance.Print("Removing item drops");
                    ItemDrop[] array2 = UnityEngine.Object.FindObjectsOfType <ItemDrop>();
                    for (int j = 0; j < array2.Length; j++)
                    {
                        ZNetView component = array2[j].GetComponent <ZNetView>();
                        if (component && component.IsValid() && component.IsOwner())
                        {
                            component.Destroy();
                        }
                    }
                }

                if (array[0] == "spawn")
                {
                    if (array.Length <= 1)
                    {
                        return;
                    }
                    string     text4  = array[1];
                    int        num8   = (array.Length >= 3) ? int.Parse(array[2]) : 1;
                    int        num9   = (array.Length >= 4) ? int.Parse(array[3]) : 1;
                    GameObject prefab = ZNetScene.instance.GetPrefab(text4);
                    if (!prefab)
                    {
                        Player.m_localPlayer.Message(MessageHud.MessageType.TopLeft, "Missing object " + text4, 0, null);
                        return;
                    }
                    DateTime now = DateTime.Now;
                    if (num8 == 1)
                    {
                        Player.m_localPlayer.Message(MessageHud.MessageType.TopLeft, "Spawning object " + text4, 0, null);
                        Character component2 = UnityEngine.Object.Instantiate <GameObject>(prefab, Player.m_localPlayer.transform.position + Player.m_localPlayer.transform.forward * 2f + Vector3.up, Quaternion.identity).GetComponent <Character>();
                        if (component2 & num9 > 1)
                        {
                            component2.SetLevel(num9);
                        }
                    }
                    else
                    {
                        for (int j = 0; j < num8; j++)
                        {
                            Vector3 vector = Random.insideUnitSphere * 0.5f;
                            Player.m_localPlayer.Message(MessageHud.MessageType.TopLeft, "Spawning object " + text4, 0, null);
                            Character component3 = UnityEngine.Object.Instantiate <GameObject>(prefab, Player.m_localPlayer.transform.position + Player.m_localPlayer.transform.forward * 2f + Vector3.up + vector, Quaternion.identity).GetComponent <Character>();
                            if (component3 & num9 > 1)
                            {
                                component3.SetLevel(num9);
                            }
                        }
                    }
                    Gogan.LogEvent("Cheat", "Spawn", text4, (long)num8);
                    return;
                }
            }

            return;
        }
Пример #26
0
 // Token: 0x06000585 RID: 1413 RVA: 0x0002F6EA File Offset: 0x0002D8EA
 public void OnQuitYes()
 {
     Gogan.LogEvent("Game", "Quit", "", 0L);
     Application.Quit();
 }
Пример #27
0
 // Token: 0x06000583 RID: 1411 RVA: 0x0002F697 File Offset: 0x0002D897
 public void OnSettings()
 {
     Gogan.LogEvent("Screen", "Enter", "Settings", 0L);
     this.m_settingsInstance = UnityEngine.Object.Instantiate <GameObject>(this.m_settingsPrefab, base.transform);
 }
Пример #28
0
 // Token: 0x0600058A RID: 1418 RVA: 0x0002F795 File Offset: 0x0002D995
 public void OnClose()
 {
     Gogan.LogEvent("Screen", "Exit", "Menu", 0L);
     this.m_root.gameObject.SetActive(false);
 }
Пример #29
0
 // Token: 0x06000588 RID: 1416 RVA: 0x0002F74F File Offset: 0x0002D94F
 public void OnLogoutYes()
 {
     Gogan.LogEvent("Game", "LogOut", "", 0L);
     Game.instance.Logout();
 }
Пример #30
0
    // Token: 0x060004D0 RID: 1232 RVA: 0x00026ED4 File Offset: 0x000250D4
    private void InputText()
    {
        string text = this.m_input.text;

        this.AddString(text);
        string[] array = text.Split(new char[]
        {
            ' '
        });
        if (text.StartsWith("help"))
        {
            this.AddString("kick [name/ip/userID] - kick user");
            this.AddString("ban [name/ip/userID] - ban user");
            this.AddString("unban [ip/userID] - unban user");
            this.AddString("banned - list banned users");
            this.AddString("ping - ping server");
            this.AddString("lodbias - set distance lod bias");
            this.AddString("info - print system info");
            this.AddString("save - force saving of world");
            if (this.IsCheatsEnabled())
            {
                this.AddString("genloc - regenerate all locations.");
                this.AddString("debugmode - fly mode");
                this.AddString("spawn [amount] [level] - spawn something");
                this.AddString("pos - print current player position");
                this.AddString("goto [x,z]- teleport");
                this.AddString("exploremap - explore entire map");
                this.AddString("resetmap - reset map exploration");
                this.AddString("killall - kill nearby enemies");
                this.AddString("tame - tame all nearby tameable creatures");
                this.AddString("hair");
                this.AddString("beard");
                this.AddString("location - spawn location");
                this.AddString("raiseskill [skill] [amount]");
                this.AddString("resetskill [skill]");
                this.AddString("freefly - freefly photo mode");
                this.AddString("ffsmooth - freefly smoothness");
                this.AddString("tod -1 OR [0-1]");
                this.AddString("env [env]");
                this.AddString("resetenv");
                this.AddString("wind [angle] [intensity]");
                this.AddString("resetwind");
                this.AddString("god");
                this.AddString("event [name] - start event");
                this.AddString("stopevent - stop current event");
                this.AddString("randomevent");
                this.AddString("resetcharacter - reset character data");
                this.AddString("removedrops - remove all item-drops in area");
                this.AddString("setkey [name]");
                this.AddString("resetkeys [name]");
                this.AddString("listkeys");
                this.AddString("players [nr] - force diffuculty scale ( 0 = reset)");
                this.AddString("dpsdebug - toggle dps debug print");
            }
        }
        if (array[0] == "devcommands")
        {
            this.m_cheat = !this.m_cheat;
            this.AddString("Dev commands: " + this.m_cheat.ToString());
            this.AddString("WARNING: using any dev commands is not recommended and is done on your own risk.");
            Gogan.LogEvent("Cheat", "CheatsEnabled", this.m_cheat.ToString(), 0L);
            return;
        }
        if (array[0] == "hidebetatext" && Hud.instance)
        {
            Hud.instance.ToggleBetaTextVisible();
        }
        if (array[0] == "ping")
        {
            if (Game.instance)
            {
                Game.instance.Ping();
            }
            return;
        }
        if (array[0] == "dpsdebug")
        {
            Character.SetDPSDebug(!Character.IsDPSDebugEnabled());
            this.AddString("DPS debug " + Character.IsDPSDebugEnabled().ToString());
        }
        if (!(array[0] == "lodbias"))
        {
            if (array[0] == "info")
            {
                this.Print("Render threading mode:" + SystemInfo.renderingThreadingMode);
                long totalMemory = GC.GetTotalMemory(false);
                this.Print("Total allocated mem: " + (totalMemory / 1048576L).ToString("0") + "mb");
            }
            if (array[0] == "gc")
            {
                long totalMemory2 = GC.GetTotalMemory(false);
                GC.Collect();
                long totalMemory3 = GC.GetTotalMemory(true);
                long num          = totalMemory3 - totalMemory2;
                this.Print(string.Concat(new string[]
                {
                    "GC collect, Delta: ",
                    (num / 1048576L).ToString("0"),
                    "mb   Total left:",
                    (totalMemory3 / 1048576L).ToString("0"),
                    "mb"
                }));
            }
            if (array[0] == "fov")
            {
                Camera mainCamera = Utils.GetMainCamera();
                if (mainCamera)
                {
                    float num2;
                    if (array.Length == 1)
                    {
                        this.Print("Fov:" + mainCamera.fieldOfView);
                    }
                    else if (float.TryParse(array[1], NumberStyles.Float, CultureInfo.InvariantCulture, out num2) && num2 > 5f)
                    {
                        this.Print("Setting fov to " + num2);
                        Camera[] componentsInChildren = mainCamera.GetComponentsInChildren <Camera>();
                        for (int i = 0; i < componentsInChildren.Length; i++)
                        {
                            componentsInChildren[i].fieldOfView = num2;
                        }
                    }
                }
            }
            if (ZNet.instance)
            {
                if (text.StartsWith("kick "))
                {
                    string user = text.Substring(5);
                    ZNet.instance.Kick(user);
                    return;
                }
                if (text.StartsWith("ban "))
                {
                    string user2 = text.Substring(4);
                    ZNet.instance.Ban(user2);
                    return;
                }
                if (text.StartsWith("unban "))
                {
                    string user3 = text.Substring(6);
                    ZNet.instance.Unban(user3);
                    return;
                }
                if (text.StartsWith("banned"))
                {
                    ZNet.instance.PrintBanned();
                    return;
                }
                if (array.Length != 0 && array[0] == "save")
                {
                    ZNet.instance.ConsoleSave();
                }
            }
            if (ZNet.instance && ZNet.instance.IsServer() && Player.m_localPlayer && this.IsCheatsEnabled())
            {
                if (array[0] == "genloc")
                {
                    ZoneSystem.instance.GenerateLocations();
                    return;
                }
                if (array[0] == "players" && array.Length >= 2)
                {
                    int num3;
                    if (int.TryParse(array[1], out num3))
                    {
                        Game.instance.SetForcePlayerDifficulty(num3);
                        this.Print("Setting players to " + num3);
                    }
                    return;
                }
                if (array[0] == "setkey")
                {
                    if (array.Length >= 2)
                    {
                        ZoneSystem.instance.SetGlobalKey(array[1]);
                        this.Print("Setting global key " + array[1]);
                    }
                    else
                    {
                        this.Print("Syntax: setkey [key]");
                    }
                }
                if (array[0] == "resetkeys")
                {
                    ZoneSystem.instance.ResetGlobalKeys();
                    this.Print("Global keys cleared");
                }
                if (array[0] == "listkeys")
                {
                    List <string> globalKeys = ZoneSystem.instance.GetGlobalKeys();
                    this.Print("Keys " + globalKeys.Count);
                    foreach (string text2 in globalKeys)
                    {
                        this.Print(text2);
                    }
                }
                if (array[0] == "debugmode")
                {
                    Player.m_debugMode = !Player.m_debugMode;
                    this.Print("Debugmode " + Player.m_debugMode.ToString());
                }
                if (array[0] == "raiseskill")
                {
                    if (array.Length > 2)
                    {
                        string name = array[1];
                        int    num4 = int.Parse(array[2]);
                        Player.m_localPlayer.GetSkills().CheatRaiseSkill(name, (float)num4);
                        return;
                    }
                    this.Print("Syntax: raiseskill [skill] [amount]");
                    return;
                }
                else if (array[0] == "resetskill")
                {
                    if (array.Length > 1)
                    {
                        string name2 = array[1];
                        Player.m_localPlayer.GetSkills().CheatResetSkill(name2);
                        return;
                    }
                    this.Print("Syntax: resetskill [skill]");
                    return;
                }
                else
                {
                    if (text == "sleep")
                    {
                        EnvMan.instance.SkipToMorning();
                        return;
                    }
                    if (array[0] == "skiptime")
                    {
                        double num5 = ZNet.instance.GetTimeSeconds();
                        float  num6 = 240f;
                        if (array.Length > 1)
                        {
                            num6 = float.Parse(array[1]);
                        }
                        num5 += (double)num6;
                        ZNet.instance.SetNetTime(num5);
                        this.Print(string.Concat(new object[]
                        {
                            "Skipping ",
                            num6.ToString("0"),
                            "s , Day:",
                            EnvMan.instance.GetDay(num5)
                        }));
                        return;
                    }
                    if (text == "resetcharacter")
                    {
                        this.AddString("Reseting character");
                        Player.m_localPlayer.ResetCharacter();
                        return;
                    }
                    if (array[0] == "randomevent")
                    {
                        RandEventSystem.instance.StartRandomEvent();
                    }
                    if (text.StartsWith("event "))
                    {
                        if (array.Length <= 1)
                        {
                            return;
                        }
                        string text3 = text.Substring(6);
                        if (!RandEventSystem.instance.HaveEvent(text3))
                        {
                            this.Print("Random event not found:" + text3);
                            return;
                        }
                        RandEventSystem.instance.SetRandomEventByName(text3, Player.m_localPlayer.transform.position);
                        return;
                    }
                    else
                    {
                        if (array[0] == "stopevent")
                        {
                            RandEventSystem.instance.ResetRandomEvent();
                            return;
                        }
                        if (text.StartsWith("removedrops"))
                        {
                            this.AddString("Removing item drops");
                            ItemDrop[] array2 = UnityEngine.Object.FindObjectsOfType <ItemDrop>();
                            for (int i = 0; i < array2.Length; i++)
                            {
                                ZNetView component = array2[i].GetComponent <ZNetView>();
                                if (component && component.IsValid() && component.IsOwner())
                                {
                                    component.Destroy();
                                }
                            }
                        }
                        if (text.StartsWith("freefly"))
                        {
                            this.Print("Toggling free fly camera");
                            GameCamera.instance.ToggleFreeFly();
                            return;
                        }
                        if (array[0] == "ffsmooth")
                        {
                            if (array.Length <= 1)
                            {
                                this.Print(GameCamera.instance.GetFreeFlySmoothness().ToString());
                                return;
                            }
                            float num7;
                            if (!float.TryParse(array[1], NumberStyles.Float, CultureInfo.InvariantCulture, out num7))
                            {
                                this.Print("syntax error");
                                return;
                            }
                            this.Print("Setting free fly camera smoothing:" + num7);
                            GameCamera.instance.SetFreeFlySmoothness(num7);
                            return;
                        }
                        else
                        {
                            if (text.StartsWith("location "))
                            {
                                if (array.Length <= 1)
                                {
                                    return;
                                }
                                string  name3 = text.Substring(9);
                                Vector3 pos   = Player.m_localPlayer.transform.position + Player.m_localPlayer.transform.forward * 10f;
                                ZoneSystem.instance.TestSpawnLocation(name3, pos);
                            }
                            if (array[0] == "spawn")
                            {
                                if (array.Length <= 1)
                                {
                                    return;
                                }
                                string     text4  = array[1];
                                int        num8   = (array.Length >= 3) ? int.Parse(array[2]) : 1;
                                int        num9   = (array.Length >= 4) ? int.Parse(array[3]) : 1;
                                GameObject prefab = ZNetScene.instance.GetPrefab(text4);
                                if (!prefab)
                                {
                                    Player.m_localPlayer.Message(MessageHud.MessageType.TopLeft, "Missing object " + text4, 0, null);
                                    return;
                                }
                                DateTime now = DateTime.Now;
                                if (num8 == 1)
                                {
                                    Player.m_localPlayer.Message(MessageHud.MessageType.TopLeft, "Spawning object " + text4, 0, null);
                                    Character component2 = UnityEngine.Object.Instantiate <GameObject>(prefab, Player.m_localPlayer.transform.position + Player.m_localPlayer.transform.forward * 2f + Vector3.up, Quaternion.identity).GetComponent <Character>();
                                    if (component2 & num9 > 1)
                                    {
                                        component2.SetLevel(num9);
                                    }
                                }
                                else
                                {
                                    for (int j = 0; j < num8; j++)
                                    {
                                        Vector3 b = UnityEngine.Random.insideUnitSphere * 0.5f;
                                        Player.m_localPlayer.Message(MessageHud.MessageType.TopLeft, "Spawning object " + text4, 0, null);
                                        Character component3 = UnityEngine.Object.Instantiate <GameObject>(prefab, Player.m_localPlayer.transform.position + Player.m_localPlayer.transform.forward * 2f + Vector3.up + b, Quaternion.identity).GetComponent <Character>();
                                        if (component3 & num9 > 1)
                                        {
                                            component3.SetLevel(num9);
                                        }
                                    }
                                }
                                ZLog.Log("Spawn time :" + (DateTime.Now - now).TotalMilliseconds + " ms");
                                Gogan.LogEvent("Cheat", "Spawn", text4, (long)num8);
                                return;
                            }
                            else
                            {
                                if (array[0] == "pos")
                                {
                                    Player localPlayer = Player.m_localPlayer;
                                    if (localPlayer)
                                    {
                                        this.AddString("Player position (X,Y,Z):" + localPlayer.transform.position.ToString("F0"));
                                    }
                                }
                                if (text.StartsWith("goto "))
                                {
                                    string text5     = text.Substring(5);
                                    char[] separator = new char[]
                                    {
                                        ',',
                                        ' '
                                    };
                                    string[] array3 = text5.Split(separator);
                                    if (array3.Length < 2)
                                    {
                                        this.AddString("Syntax /goto x,y");
                                        return;
                                    }
                                    try
                                    {
                                        float  x            = float.Parse(array3[0]);
                                        float  z            = float.Parse(array3[1]);
                                        Player localPlayer2 = Player.m_localPlayer;
                                        if (localPlayer2)
                                        {
                                            Vector3 pos2 = new Vector3(x, localPlayer2.transform.position.y, z);
                                            localPlayer2.TeleportTo(pos2, localPlayer2.transform.rotation, true);
                                        }
                                    }
                                    catch (Exception ex)
                                    {
                                        ZLog.Log("parse error:" + ex.ToString() + "  " + text5);
                                    }
                                    Gogan.LogEvent("Cheat", "Goto", "", 0L);
                                    return;
                                }
                                else
                                {
                                    if (text.StartsWith("exploremap"))
                                    {
                                        Minimap.instance.ExploreAll();
                                        return;
                                    }
                                    if (text.StartsWith("resetmap"))
                                    {
                                        Minimap.instance.Reset();
                                        return;
                                    }
                                    if (text.StartsWith("puke") && Player.m_localPlayer)
                                    {
                                        Player.m_localPlayer.ClearFood();
                                    }
                                    if (text.StartsWith("tame"))
                                    {
                                        Tameable.TameAllInArea(Player.m_localPlayer.transform.position, 20f);
                                    }
                                    if (text.StartsWith("killall"))
                                    {
                                        foreach (Character character in Character.GetAllCharacters())
                                        {
                                            if (!character.IsPlayer())
                                            {
                                                HitData hitData = new HitData();
                                                hitData.m_damage.m_damage = 1E+10f;
                                                character.Damage(hitData);
                                            }
                                        }
                                        return;
                                    }
                                    if (text.StartsWith("heal"))
                                    {
                                        Player.m_localPlayer.Heal(Player.m_localPlayer.GetMaxHealth(), true);
                                        return;
                                    }
                                    if (text.StartsWith("god"))
                                    {
                                        Player.m_localPlayer.SetGodMode(!Player.m_localPlayer.InGodMode());
                                        this.Print("God mode:" + Player.m_localPlayer.InGodMode().ToString());
                                        Gogan.LogEvent("Cheat", "God", Player.m_localPlayer.InGodMode().ToString(), 0L);
                                    }
                                    if (text.StartsWith("ghost"))
                                    {
                                        Player.m_localPlayer.SetGhostMode(!Player.m_localPlayer.InGhostMode());
                                        this.Print("Ghost mode:" + Player.m_localPlayer.InGhostMode().ToString());
                                        Gogan.LogEvent("Cheat", "Ghost", Player.m_localPlayer.InGhostMode().ToString(), 0L);
                                    }
                                    if (text.StartsWith("beard"))
                                    {
                                        string beard = (text.Length >= 6) ? text.Substring(6) : "";
                                        if (Player.m_localPlayer)
                                        {
                                            Player.m_localPlayer.SetBeard(beard);
                                        }
                                        return;
                                    }
                                    if (text.StartsWith("hair"))
                                    {
                                        string hair = (text.Length >= 5) ? text.Substring(5) : "";
                                        if (Player.m_localPlayer)
                                        {
                                            Player.m_localPlayer.SetHair(hair);
                                        }
                                        return;
                                    }
                                    if (text.StartsWith("model "))
                                    {
                                        string s = text.Substring(6);
                                        int    playerModel;
                                        if (Player.m_localPlayer && int.TryParse(s, out playerModel))
                                        {
                                            Player.m_localPlayer.SetPlayerModel(playerModel);
                                        }
                                        return;
                                    }
                                    if (text.StartsWith("tod "))
                                    {
                                        float num10;
                                        if (!float.TryParse(text.Substring(4), NumberStyles.Float, CultureInfo.InvariantCulture, out num10))
                                        {
                                            return;
                                        }
                                        this.Print("Setting time of day:" + num10);
                                        if (num10 < 0f)
                                        {
                                            EnvMan.instance.m_debugTimeOfDay = false;
                                        }
                                        else
                                        {
                                            EnvMan.instance.m_debugTimeOfDay = true;
                                            EnvMan.instance.m_debugTime      = Mathf.Clamp01(num10);
                                        }
                                    }
                                    if (array[0] == "env" && array.Length > 1)
                                    {
                                        string text6 = text.Substring(4);
                                        this.Print("Setting debug enviornment:" + text6);
                                        EnvMan.instance.m_debugEnv = text6;
                                        return;
                                    }
                                    if (text.StartsWith("resetenv"))
                                    {
                                        this.Print("Reseting debug enviornment");
                                        EnvMan.instance.m_debugEnv = "";
                                        return;
                                    }
                                    if (array[0] == "wind" && array.Length == 3)
                                    {
                                        float angle     = float.Parse(array[1]);
                                        float intensity = float.Parse(array[2]);
                                        EnvMan.instance.SetDebugWind(angle, intensity);
                                    }
                                    if (array[0] == "resetwind")
                                    {
                                        EnvMan.instance.ResetDebugWind();
                                    }
                                }
                            }
                        }
                    }
                }
            }
            return;
        }
        if (array.Length == 1)
        {
            this.Print("Lod bias:" + QualitySettings.lodBias);
            return;
        }
        float num11;

        if (float.TryParse(array[1], NumberStyles.Float, CultureInfo.InvariantCulture, out num11))
        {
            this.Print("Setting lod bias:" + num11);
            QualitySettings.lodBias = num11;
        }
    }