Exemplo n.º 1
0
 private static void Postfix(Tameable __instance, ref string __result)
 {
     if (__instance.gameObject.GetComponent <Character>().m_name == "$op_wolf_name")
     {
         __result += Localization.instance.Localize(String.Format("\n<color=yellow><b>[{0}]</b></color>$op_wolf_use", Plugin.KS_SecondInteractkey.Value.MainKey.ToString()));
     }
 }
Exemplo n.º 2
0
        internal static void SetName(ref Tameable instance, string name, bool save)
        {
            if (!instance)
            {
                return;
            }

            if (instance.m_character)
            {
                instance.m_character.m_name = name;
            }

            if (instance.transform && instance.transform.GetComponent <Text>())
            {
                instance.transform.GetComponent <Text>().text = name;
            }
            if (save)
            {
                if (!PrivateArea.CheckAccess(instance.transform.position, 0f, false))
                {
                    Debug.LogWarning("Cannot set name on ZDO, you do not have access.");
                    return;
                }
                instance.m_nview.ClaimOwnership();
                instance.m_nview.GetZDO().Set(Tameable_Patch.TameableNameZDOKey, name);
            }
        }
Exemplo n.º 3
0
 private static void Postfix(Tameable __instance)
 {
     if ((int)AccessTools.Method(typeof(Tameable), "GetTameness", null, null).Invoke(__instance, null) > 0)
     {
         (AccessTools.Field(typeof(Tameable), "m_monsterAI").GetValue(__instance) as MonsterAI).SetDespawnInDay(false);
     }
 }
Exemplo n.º 4
0
        static bool Tameable_Interact(ref Tameable __instance, Humanoid user, bool hold)
        {
            bool validKey = Enum.TryParse(Settings.RenameModifierKey.Value, out KeyCode key);

            if (!validKey || !Input.GetKey(key))
            {
                return(true);
            }

            if (!PrivateArea.CheckAccess(__instance.transform.position, 0f, false, true))
            {
                Debug.LogWarning("You don't have permission to edit this animal's name.");
                return(true);
            }
            if (!__instance.m_character.IsTamed())
            {
                Debug.LogWarning("Cannot name an animal before they are tame.");
                return(true);
            }

            TameableTextReciever textReciever = new TameableTextReciever(ref __instance, __instance.m_character.m_name);

            TextInput.instance.RequestText(textReciever, TameableTextInputTopic, TameableMaxNameLength);

            return(false);
        }
Exemplo n.º 5
0
 public static void VTTameNearbyCreatures(this Player player)
 {
     if (player != null)
     {
         Tameable.TameAllInArea(player.transform.position, 20f);
     }
 }
Exemplo n.º 6
0
        static void Tameable_Awake(ref Tameable __instance)
        {
            string animalName = __instance.m_nview.GetZDO().GetString(TameableNameZDOKey, "");

            if (!string.IsNullOrEmpty(animalName))
            {
                SetName(ref __instance, animalName, false);
            }
        }
Exemplo n.º 7
0
            private static void Postfix(Tameable __instance)
            {
                string a = __instance.name.Replace("(Clone)", "");

                if (cfgList.ContainsKey(a) && cfgList[a].changeFaction)
                {
                    __instance.GetComponent <Humanoid>().m_faction = Character.Faction.Players;
                }
            }
Exemplo n.º 8
0
        private static bool ShouldSetStunned(Character character, Tameable tameable, HitData hit)
        {
            bool      tameIsEssential         = (TameableMortalityTypes)Configuration.Current.Tameable.mortality == TameableMortalityTypes.Essential;
            bool      tameShouldBeDead        = character.GetHealth() <= 0f;
            bool      tameOwnerDamageOverride = Configuration.Current.Tameable.ownerDamageOverride;
            Character attacker            = hit.GetAttacker();
            bool      tameAttackerIsOwner = attacker == tameable.GetPlayer(attacker.GetZDOID());

            return(tameIsEssential && tameShouldBeDead && !(tameOwnerDamageOverride && tameAttackerIsOwner));
        }
Exemplo n.º 9
0
        private static bool ShouldIgnoreDamage(Character tame, Tameable tameable, HitData hit, ZDO zdo)
        {
            bool      tameIsImmortal          = (TameableMortalityTypes)Configuration.Current.Tameable.mortality == TameableMortalityTypes.Immortal;
            bool      tameOwnerDamageOverride = Configuration.Current.Tameable.ownerDamageOverride;
            Character attacker                 = hit.GetAttacker();
            bool      tameAttackerIsOwner      = attacker == tameable.GetPlayer(attacker.GetZDOID());
            bool      tameIsRecoveringFromStun = zdo.GetBool("isRecoveringFromStun");

            return((tameIsImmortal && !(tameOwnerDamageOverride && tameAttackerIsOwner)) || tameIsRecoveringFromStun);
        }
Exemplo n.º 10
0
        void Awake()
        {
            PetManager.TrollIns = this.gameObject;
            tame = this.GetComponent <Tameable>();
            tame.m_commandable = true;
            tame.m_fedDuration = 300;
            tame.Tame();
            Traverse.Create(tame).Method("ResetFeedingTimer").GetValue();
            Character character = this.GetComponent <Character>();

            character.m_onDeath = (Action)Delegate.Combine(new Action(this.OnDestroyed), character.m_onDeath);
        }
Exemplo n.º 11
0
        public static void Postfix(Tameable __instance, ref string __result)
        {
            if (Configuration.Current.Tameable.IsEnabled)
            {
                Tameable tameable = __instance;

                // If tamed creature is recovering from a stun, then add Stunned to hover text.
                if (tameable.m_character.m_nview.GetZDO().GetBool("isRecoveringFromStun"))
                {
                    __result = __result.Insert(__result.IndexOf(" )"), ", Stunned");
                }
            }
        }
Exemplo n.º 12
0
 // Token: 0x0600028E RID: 654 RVA: 0x00014B38 File Offset: 0x00012D38
 public static void TameAllInArea(Vector3 point, float radius)
 {
     foreach (Character character in Character.GetAllCharacters())
     {
         if (!character.IsPlayer())
         {
             Tameable component = character.GetComponent <Tameable>();
             if (component)
             {
                 component.Tame();
             }
         }
     }
 }
    private static void SetCommandable(Tameable __instance)
    {
        var zdo = ComponentCache.GetZdo(__instance);

        if (zdo is null)
        {
            return;
        }

        if (zdo.GetBool("spawnthat_tamed_commandable", false))
        {
            __instance.m_commandable = true;
        }
    }
Exemplo n.º 14
0
        private void Awake()
        {
            PetManager.WolfIns = this.gameObject;
            container          = this.GetComponent <Container>();

            Character character = this.GetComponent <Character>();

            character.m_onDeath = (Action)Delegate.Combine(new Action(this.OnDeath), character.m_onDeath);

            tame = this.GetComponent <Tameable>();
            tame.Tame();
            tame.m_fedDuration = 1800;
            Traverse.Create(tame).Method("ResetFeedingTimer").GetValue();

            m_hum = this.GetComponent <Humanoid>();
        }
Exemplo n.º 15
0
 private new void GrowUpdate()
 {
     if (!this.m_nview.IsValid() || !this.m_nview.IsOwner())
     {
         return;
     }
     growStats = Mathf.FloorToInt((float)(GetTimeSinceSpawned().TotalSeconds / (double)this.m_growTime * 100));
     if (GetTimeSinceSpawned().TotalSeconds > (double)this.m_growTime)
     {
         Tameable component2 = UnityEngine.Object.Instantiate <GameObject>(this.m_grownPrefab, base.transform.position, base.transform.rotation).GetComponent <Tameable>();
         if (component2)
         {
             component2.Tame();
         }
         this.m_nview.Destroy();
     }
 }
Exemplo n.º 16
0
            static bool Prefix(Tameable __instance, ref bool __result, Humanoid user, bool hold, ZNetView ___m_nview, ref Character ___m_character,
                               ref float ___m_lastPetTime)
            {
                if (!MobConfigManager.IsControllableMob(__instance.name))
                {
                    return(true);
                }

                if (!___m_nview.IsValid())
                {
                    __result = false;
                    return(true);
                }
                string hoverName = ___m_character.GetHoverName();

                if (___m_character.IsTamed())
                {
                    if (hold)
                    {
                        TextInput.instance.RequestText(new MyTextReceiver(___m_character), "Name", 15);
                        __result = false;
                        return(false);
                    }

                    if (Time.time - ___m_lastPetTime > 1f)
                    {
                        ___m_lastPetTime = Time.time;
                        __instance.m_petEffect.Create(___m_character.GetCenterPoint(), Quaternion.identity);
                        if (__instance.m_commandable)
                        {
                            typeof(Tameable).GetMethod("Command", BindingFlags.NonPublic | BindingFlags.Instance).Invoke(__instance, new object[] { user });
                        }
                        else
                        {
                            user.Message(MessageHud.MessageType.Center, hoverName + " $hud_tamelove");
                        }
                        __result = true;
                        return(false);
                    }
                    __result = false;
                    return(false);
                }
                __result = false;
                return(false);
            }
Exemplo n.º 17
0
            static void Postfix(Character __instance, ref ZNetView ___m_nview)
            {
                if (MobConfigManager.IsControllableMob(__instance.name))
                {
                    string   uniqueId = GetOrCreateUniqueId(___m_nview);
                    var      mobInfo  = MobConfigManager.GetMobConfig(__instance.name);
                    Tameable tameable = GetOrAddTameable(__instance);
                    tameable.m_tamingTime  = mobInfo.TamingTime;
                    tameable.m_commandable = true;

                    AddVisualEquipmentCapability(__instance);

                    ___m_nview.Register <string, string>(Constants.Z_UpdateCharacterHUD, RPC_UpdateCharacterName);
                    var ai = __instance.GetBaseAI() as MonsterAI;
                    if (__instance.IsTamed())
                    {
                        try
                        {
                            MobManager.RegisterMob(__instance, uniqueId, mobInfo.AIType, mobInfo.AIConfig);
                        }
                        catch (ArgumentException e)
                        {
                            Debug.LogError($"Failed to register Mob AI ({mobInfo.AIType}). {e.Message}");
                            return;
                        }
                        __instance.m_faction = Character.Faction.Players;
                        ai.m_consumeItems.Clear();
                        ai.m_consumeItems.AddRange(mobInfo.PostTameConsumables);
                        ai.m_consumeSearchRange = mobInfo.AIConfig.Awareness * 5;
                        ai.m_randomMoveRange    = mobInfo.AIConfig.Mobility * 2;
                        ai.m_randomMoveInterval = 15 - mobInfo.AIConfig.Mobility;
                        string givenName = ___m_nview?.GetZDO()?.GetString(Constants.Z_GivenName);
                        if (!string.IsNullOrEmpty(givenName))
                        {
                            __instance.m_name = givenName;
                        }
                    }
                    else
                    {
                        tameable.m_fedDuration = mobInfo.PreTameFeedDuration;
                        ai.m_consumeItems.Clear();
                        ai.m_consumeItems.AddRange(mobInfo.PreTameConsumables);
                    }
                }
            }
Exemplo n.º 18
0
            // Display when a tamed animal is following you by hovering the mouse over the animal.
            // Private methods are accessible because the assemblies have been run through a publicizer (https://github.com/CabbageCrow/AssemblyPublicizer)
            static bool Prefix(Tameable __instance, ref string __result, Character ___m_character, MonsterAI ___m_monsterAI, ZNetView ___m_nview)
            {
                // Construct the logic that fits your case
                if (___m_nview.IsValid() && ___m_character.IsTamed() && (bool)___m_monsterAI.GetFollowTarget())
                {
                    // Some code duplication here. Could use transpiler patch to avoid, but they're complicated.
                    // Probably not a big deal.
                    var str = Localization.instance.Localize(___m_character.m_name);
                    str += Localization.instance.Localize(" ( $hud_tame, " + __instance.GetStatusString() + ", Following )");

                    // Set result and skip original function execution using harmony concept (https://harmony.pardeike.net/articles/patching-prefix.html)
                    __result = str + Localization.instance.Localize("\n[<color=yellow><b>$KEY_Use</b></color>] $hud_pet");
                    return(false);
                }

                // Continue with original method if our case is not met
                return(true);
            }
Exemplo n.º 19
0
        public static void Prefix(Character __instance, ref HitData hit, out Tameable __state)
        {
            __state = null;
            if (Configuration.Current.Tameable.IsEnabled)
            {
                Character character = __instance;
                ZDO       zdo       = character.m_nview.GetZDO();
                __state = character.GetComponent <Tameable>();

                if (!character.IsTamed() || zdo == null || hit == null || __state)
                {
                    return;
                }

                if (ShouldIgnoreDamage(character, __state, hit, zdo))
                {
                    hit = new HitData();
                }
            }
        }
Exemplo n.º 20
0
            public static void Postfix(ref Tameable __instance)
            {
                if (__instance.m_character.IsTamed())
                {
                    monster = new MonsterConfig();

                    monster.critter    = __instance.m_character;
                    monster.monsterID  = __instance;
                    monster.experience = 0;

                    if (FindMonster(monster, ref monsters))
                    {
                        Debug.LogWarning("Found Monster.");
                    }
                    else
                    {
                        Debug.LogWarning("Added Monster.");
                        monsters.Add(monster);
                    }
                }
            }
Exemplo n.º 21
0
        public static void Postfix(Character __instance, HitData hit, Tameable __state)
        {
            if (Configuration.Current.Tameable.IsEnabled)
            {
                Character character = __instance;
                ZDO       zdo       = character.m_nview.GetZDO();
                Tameable  tameable  = __state;

                if (!character.IsTamed() || zdo == null || tameable == null)
                {
                    return;
                }

                if (ShouldSetStunned(character, tameable, hit))
                {
                    character.SetHealth(character.GetMaxHealth());
                    character.m_animator.SetBool("sleeping", true);
                    zdo.Set("sleeping", true);
                    zdo.Set("isRecoveringFromStun", true);
                }
            }
        }
Exemplo n.º 22
0
            static bool Prefix(Tameable __instance, ref string __result, ZNetView ___m_nview, Character ___m_character)
            {
                if (!MobConfigManager.IsControllableMob(__instance.name))
                {
                    return(true);
                }
                if (!___m_character.IsTamed())
                {
                    return(true);
                }
                if (!___m_nview.IsValid())
                {
                    __result = string.Empty;
                    return(true);
                }
                string aiStatus = ___m_nview.GetZDO().GetString(Constants.Z_AiStatus) ?? Traverse.Create(__instance).Method("GetStatusString").GetValue() as string;
                string str      = Localization.instance.Localize(___m_character.GetHoverName());

                str     += Localization.instance.Localize(" ( $hud_tame, " + aiStatus + " )");
                __result = str + Localization.instance.Localize("\n[<color=yellow><b>$KEY_Use</b></color>] $hud_pet" + "\n[<color=yellow>Hold E</color>] to change name");

                return(false);
            }
Exemplo n.º 23
0
        public static void Init()
        {
            zns   = ZNetScene.instance;
            wtame = zns.GetPrefab("Wolf").GetComponent <Tameable>();
            if (Plugin.HatchingEgg.Value)
            {
                InitDrakeEgg();
            }
            var list = Plugin.cfgList;

            foreach (var obj in list)
            {
                string name = obj.Key;
                if (zns.GetPrefab(name) == null)
                {
                    DBG.blogWarning("Cant find Prefab Check your name : " + name);
                    Plugin.configManager.debugInfo += "  Cant find Prefab Check your name : " + name;
                }
                AddTame(zns.GetPrefab(name), obj.Value);
            }


            isInit = true;
        }
Exemplo n.º 24
0
        public static void InputCMD(string inCommand)
        {
            if (inCommand.Length > 0)

            {
                if (inCommand.StartsWith(" "))
                {
                    inCommand = inCommand.Remove(0, 1);
                }
                #region env
                if (inCommand.StartsWith("/env"))
                {
                    inCommand = inCommand.Remove(0, 5);
                    //float num1;
                    //if (!float.TryParse(inCommand, NumberStyles.Float, CultureInfo.InvariantCulture, out num1))
                    //{
                    //cprt("Wrong Number");
                    //return;
                    //}
                    if (inCommand == "list")
                    {
                        string wl = "pick from these ones,list: ";
                        foreach (var w in WeatherList)
                        {
                            wl += w;
                            wl += ",";
                        }
                        cprt(wl);
                        return;
                    }
                    if (EnvMan.instance)
                    {
                        if (WeatherList.Contains(inCommand))
                        {
                            if (inCommand == "reset")
                            {
                                EnvMan.instance.m_debugEnv = "";
                                cprt("reset enviroment");
                                return;
                            }
                            EnvMan.instance.m_debugEnv = inCommand;
                            cprt("set enviroment to " + inCommand);
                            return;
                        }
                        else
                        {
                            cprt("Wrong Word,Try /env list");
                        }
                    }
                    blogWarning("EnvMan is null");
                    return;
                }
                #endregion
                #region admin
                if (inCommand == "/amd")
                {
                    if (CheckPlayerNull())
                    {
                        return;
                    }
                    //isAdmin = true;
                    SetAdmin(true);
                }
                if (inCommand == "/oadm")
                {
                    if (CheckPlayerNull())
                    {
                        return;
                    }
                    //isAdmin = false;
                    SetAdmin(false);
                }
                if (inCommand == "/gst")
                {
                    if (CheckPlayerNull())
                    {
                        return;
                    }
                    SetGhost();
                }
                if (inCommand == "/rds")
                {
                    ItemDrop[] array2 = UnityEngine.Object.FindObjectsOfType <ItemDrop>();
                    int        num    = 0;
                    for (int i = 0; i < array2.Length; i++)
                    {
                        ZNetView component = array2[i].GetComponent <ZNetView>();
                        if (component && component.IsValid() && component.IsOwner())
                        {
                            component.Destroy();
                            num++;
                        }
                    }
                    InfoTL("Destoyed " + num.ToString() + " items");
                }
                if (inCommand == "/cam")
                {
                    GameCamera.instance.ToggleFreeFly();
                }
                #region noclip
                if (inCommand == "/noclip")
                {
                    if (CheckPlayerNull())
                    {
                        return;
                    }
                    SetClip();
                }
                #endregion

                #endregion
                #region Terrain
                if (inCommand.StartsWith("/tf"))
                {
                    inCommand = inCommand.Remove(0, 4);
                    string[] arg = inCommand.Split(new char[] { ',' });
                    if (arg.Length > 2 || arg.Length < 2 || !inCommand.Contains(","))
                    {
                        cprt("/tf syntax wrong");
                        return;
                    }
                    try
                    {
                        float x = float.Parse(arg[0]);
                        float y = float.Parse(arg[1]);
                        Terrain.Flatten(x, y);
                    }
                    catch (Exception e)
                    {
                        blogWarning("/tf failed :" + e);
                    }
                }
                if (inCommand.StartsWith("/trf"))
                {
                    inCommand = inCommand.Remove(0, 5);
                    cprt(inCommand);
                    try
                    {
                        Terrain.RemoveFlora(float.Parse(inCommand));
                    }
                    catch (Exception e)
                    {
                        blogWarning("/trf failed:" + e);
                    }
                }
                if (inCommand.StartsWith("/trst"))
                {
                    inCommand = inCommand.Remove(0, 6);
                    cprt(inCommand);
                    try
                    {
                        Terrain.Reset(Player.m_localPlayer.transform.position, float.Parse(inCommand));
                    }
                    catch (Exception e)
                    {
                        blogWarning("/trst failed:" + e);
                    }
                }
                #endregion
                #region tod
                if (inCommand.StartsWith("/tod"))
                {
                    float a = 0;
                    inCommand = inCommand.Remove(0, 5);
                    try { a = float.Parse(inCommand); }
                    catch (Exception)
                    {
                        cprt("Wrong Number");
                    }
                    if (a <= 0 || a >= 1)
                    {
                        EnvMan.instance.m_debugTimeOfDay = false;
                        return;
                    }
                    EnvMan.instance.m_debugTimeOfDay = true;
                    EnvMan.instance.m_debugTime      = a;
                }
                #endregion
                #region tame
                if (inCommand == "/tame")
                {
                    Tameable.TameAllInArea(Player.m_localPlayer.transform.position, 30f);
                }
                #endregion
                #region list
                if (inCommand.StartsWith("/listi"))
                {
                    inCommand = inCommand.Remove(0, 7);
                    if (inCommand.Length > 0)
                    {
                        string list = "Result: ";
                        if (inCommand.StartsWith("?"))
                        {
                            foreach (GameObject g in ObjectDB.instance.m_items)
                            {
                                ItemDrop component = g.GetComponent <ItemDrop>();
                                list += component.name;
                                list += ",";
                                list  = LimitLog(list);
                            }
                            list = LimitLog(list);
                            if (list != "")
                            {
                                Traverse.Create(MessageHud.instance).Method("AddLog", new object[] { list }).GetValue();
                                cprt(list);
                                cprt("Check your Message Log");
                                list = "";
                                return;
                            }
                            return;
                        }
                        using (List <GameObject> .Enumerator enumerator3 = ObjectDB.instance.m_items.GetEnumerator())
                        {
                            while (enumerator3.MoveNext())
                            {
                                GameObject g2 = enumerator3.Current;
                                ItemDrop   c2 = g2.GetComponent <ItemDrop>();
                                if (c2.name.ToLower().Contains(inCommand.ToLower()))
                                {
                                    list += c2.name;
                                    list += ",";
                                    list  = LimitLog(list);
                                }
                            }
                            list = LimitLog(list);
                            if (list != "")
                            {
                                Traverse.Create(MessageHud.instance).Method("AddLog", new object[] { list }).GetValue();
                                cprt(list);
                                cprt("Check your Message Log");
                                list = "";
                                return;
                            }
                            return;
                        }
                    }
                    return;
                }
                #endregion
                #region trader
                if (inCommand == "/trader")
                {
                    Game.instance.DiscoverClosestLocation("Vendor_BlackForest", Player.m_localPlayer.transform.position, "Merchant", 8);
                    Minimap.PinData pinData = Enumerable.First <Minimap.PinData>((List <Minimap.PinData>)Traverse.Create(Minimap.instance).Field("m_pins").GetValue(), (Minimap.PinData p) => p.m_type == Minimap.PinType.None && p.m_name == "");
                    return;
                }
                #endregion
                #region spi
                if (inCommand.StartsWith("/spi"))
                {
                    inCommand = inCommand.Remove(0, 5);
                    string[] c = inCommand.Split(new char[] { ' ' });
                    if (c.Length == 1)
                    {
                        FT.SpawnPrefab(c[0], Player.m_localPlayer);
                        return;
                    }
                    if (c.Length == 2)
                    {
                        int amt = 1;
                        if (!int.TryParse(c[1], out amt))
                        {
                            cprt("Wrong Syntax");
                            return;
                        }
                        FT.SpawnPrefab(c[0], Player.m_localPlayer, amt);
                    }
                    else
                    {
                        cprt("Wrong Syntax");
                        return;
                    }
                }
                #endregion
                //end
            }
        }
Exemplo n.º 25
0
 public TameableTextReciever(ref Tameable instance, string name)
 {
     this.instance = instance;
     this.name     = name;
 }
Exemplo n.º 26
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;
        }
Exemplo n.º 27
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;
        }
    }
Exemplo n.º 28
0
        void Awake()
        {
            Console = new DurandaConsole();

            Console.RegisterCommand("commands", "Duranda console command list", new ConsoleCommandCallback((args) =>
            {
                Console.ListCommands();
            }));

            Console.RegisterCommand("echo", "Print to console", new ConsoleCommandCallback((args) =>
            {
                string buffer = "";
                foreach (var i in args)
                {
                    buffer += i + " ";
                }

                Console.WriteLine(buffer);
            }));

            Console.RegisterCommand("debug_mode", "Toggle debug mode.", new ConsoleCommandCallback((args) =>
            {
                if (args.Count == 0)
                {
                    Console.WriteLine($"Usage: debug_mode [value]\nCurrent value: {DebugMode}");
                    return;
                }

                if (!bool.TryParse(args[0], out DebugMode))
                {
                    Console.WriteLine("Invalid input!");
                    return;
                }

                Console.WriteLine($"Debug mode is now {DebugMode}");
                GetLocalPlayer()?.Message(MessageHud.MessageType.Center, $"Debug mode is now {DebugMode}");
            }));

            Console.RegisterCommand("fly_toggle", "Toggle debug fly.", new ConsoleCommandCallback((args) =>
            {
                if (args.Count == 0)
                {
                    Console.WriteLine($"Usage: fly_toggle [value]\nCurrent value: {FlyMode}");
                    return;
                }

                if (!bool.TryParse(args[0], out FlyMode))
                {
                    Console.WriteLine("Invalid input!");
                    return;
                }

                Console.WriteLine($"Fly mode is now {FlyMode}");
                GetLocalPlayer()?.Message(MessageHud.MessageType.Center, $"Fly mode is now {FlyMode}");
            }));

            Console.RegisterCommand("text_echo", "Print text message", new ConsoleCommandCallback((args) =>
            {
                Player localPlayer = GetLocalPlayer();
                if (localPlayer == null)
                {
                    Console.WriteLine("Not in-game");
                    return;
                }

                string buffer = "";
                foreach (var i in args)
                {
                    buffer += i + " ";
                }

                localPlayer.Message(MessageHud.MessageType.Center, buffer);
            }));

            Console.RegisterCommand("hud_echo", "Print to hud", new ConsoleCommandCallback((args) =>
            {
                string buffer = "";
                foreach (var i in args)
                {
                    buffer += i + " ";
                }

                SendHudMessage(buffer);
            }));

            Console.RegisterCommand("killmobs", "Kill mobs in the area.", new ConsoleCommandCallback((args) =>
            {
                if (args.Count == 0)
                {
                    Console.WriteLine("Usage: killmobs [amount] => 'all' for every mob");
                    return;
                }

                int amount = -1;
                if (args[0] != "all" && !int.TryParse(args[0], out amount))
                {
                    Console.WriteLine("Invalid input!");
                    return;
                }

                int killed = KillMobs(amount);
                Console.WriteLine($"Killed {killed} mobs.");
            }));

            Console.RegisterCommand("player_kill", "Kill the given player.", new ConsoleCommandCallback((args) =>
            {
                if (args.Count == 0)
                {
                    Console.WriteLine("Usage: killplayer [name]");
                    return;
                }

                if (KillPlayer(args[0]))
                {
                    Console.WriteLine($"The player has been killed.");
                }
                else
                {
                    Console.WriteLine($"No player found with name {args[0]}.");
                }
            }));

            Console.RegisterCommand("camerashake", "Set the camera shake value.", new ConsoleCommandCallback((args) =>
            {
                if (args.Count == 0)
                {
                    Console.WriteLine($"Usage: camerashake [value]\nCurrent value: {CameraShake}");
                    return;
                }

                if (!int.TryParse(args[0], out CameraShake))
                {
                    Console.WriteLine("Invalid input!");
                    return;
                }

                Console.WriteLine($"Camera shake has been changed to {CameraShake}");
            }));

            Console.RegisterCommand("interact_distance", "Set the interact distance value.", new ConsoleCommandCallback((args) =>
            {
                if (args.Count == 0)
                {
                    Console.WriteLine($"Usage: interact_distance [value]\nCurrent value: {InteractDistance}");
                    return;
                }

                if (!int.TryParse(args[0], out InteractDistance))
                {
                    Console.WriteLine("Invalid input!");
                    return;
                }

                Console.WriteLine($"Interact distance has been changed to {InteractDistance}");
            }));

            Console.RegisterCommand("place_distance", "Set the place distance value.", new ConsoleCommandCallback((args) =>
            {
                if (args.Count == 0)
                {
                    Console.WriteLine($"Usage: place_distance [value]\nCurrent value: {PlaceDistance}");
                    return;
                }

                if (!int.TryParse(args[0], out PlaceDistance))
                {
                    Console.WriteLine("Invalid input!");
                    return;
                }

                Console.WriteLine($"Interact distance has been changed to {PlaceDistance}");
            }));

            Console.RegisterCommand("pickuprange", "Set the pickup range. (aka loot magnet)", new ConsoleCommandCallback((args) =>
            {
                if (args.Count == 0)
                {
                    Console.WriteLine($"Usage: pickuprange [value]\nCurrent value: {PickupRange}");
                    return;
                }

                if (!int.TryParse(args[0], out PickupRange))
                {
                    Console.WriteLine("Invalid input!");
                    return;
                }

                Console.WriteLine($"Pickup range has been changed to {PickupRange}");
            }));

            Console.RegisterCommand("durability_toggle", "Disable durability for every item in your inventory.", new ConsoleCommandCallback((args) =>
            {
                if (args.Count == 0)
                {
                    Console.WriteLine($"Usage: durability_toggle [value]\nCurrent value: {Durability}");
                    return;
                }

                if (!bool.TryParse(args[0], out Durability))
                {
                    Console.WriteLine("Invalid input!");
                    return;
                }

                Console.WriteLine($"No durability is now {Durability}");
                GetLocalPlayer()?.Message(MessageHud.MessageType.Center, $"No durability is now {Durability}");
            }));

            Console.RegisterCommand("jumpheight", "Set the jump height.", new ConsoleCommandCallback((args) =>
            {
                if (args.Count == 0)
                {
                    Console.WriteLine($"Usage: jumpheight [value]\nCurrent value: {JumpForce}");
                    return;
                }

                if (!int.TryParse(args[0], out JumpForce))
                {
                    Console.WriteLine("Invalid input!");
                    return;
                }

                Console.WriteLine($"Jump height has been changed to {JumpForce}");
            }));

            Console.RegisterCommand("unlockdlcs", "Unlock every DLC.", new ConsoleCommandCallback((args) =>
            {
                if (args.Count == 0)
                {
                    Console.WriteLine($"Usage: unlockdlcs [value]\nCurrent value: {UnlockDLCs}");
                    return;
                }

                if (!bool.TryParse(args[0], out UnlockDLCs))
                {
                    Console.WriteLine("Invalid input!");
                    return;
                }

                Console.WriteLine($"Unlock every DLC is now {UnlockDLCs}");
                GetLocalPlayer()?.Message(MessageHud.MessageType.Center, $"Unlock every DLC is now {UnlockDLCs}");
            }));

            Console.RegisterCommand("map_reveal", "Reveals the whole map.", new ConsoleCommandCallback((args) =>
            {
                Minimap.instance.ExploreAll();
                Console.WriteLine("Revealed the whole map!");
            }));

            Console.RegisterCommand("map_reset", "Resets the whole map.", new ConsoleCommandCallback((args) =>
            {
                Minimap.instance.Reset();
                Console.WriteLine("Reseted the whole map!");
            }));

            Console.RegisterCommand("map_merchant", "Discover vendor.", new ConsoleCommandCallback((args) =>
            {
                Player localPlayer = GetLocalPlayer();
                if (localPlayer == null)
                {
                    Console.WriteLine("Not in-game");
                    return;
                }

                ZoneSystem.LocationInstance locationInstance;
                ZoneSystem.instance.FindClosestLocation("Vendor_BlackForest", localPlayer.transform.position, out locationInstance);
                Minimap.instance.DiscoverLocation(locationInstance.m_position, Minimap.PinType.Icon3, "Merchant");
                Console.WriteLine($"Merchant position: X: {locationInstance.m_position.x} Y: {locationInstance.m_position.y} Z: {locationInstance.m_position.z}");
            }));

            Console.RegisterCommand("healself", "Heal to maxhealth.", new ConsoleCommandCallback((args) =>
            {
                Player localPlayer = GetLocalPlayer();

                if (localPlayer != null)
                {
                    localPlayer.Heal(localPlayer.GetMaxHealth(), true);
                    Console.WriteLine("You have been healed up!");
                }
            }));

            Console.RegisterCommand("setfov", "Change the player fov.", new ConsoleCommandCallback((args) =>
            {
                if (args.Count == 0)
                {
                    Console.WriteLine($"Usage: setfov [value]\nCurrent value: {FOV}");
                    return;
                }

                if (!int.TryParse(args[0], out FOV))
                {
                    Console.WriteLine("Invalid input!");
                    return;
                }

                Console.WriteLine($"FOV has been changed to {FOV}");
            }));

            Console.RegisterCommand("skill_setlevel", "Set the level of a skill.", new ConsoleCommandCallback((args) =>
            {
                if (args.Count == 0)
                {
                    string skillNames = GetSkillNames();
                    Console.WriteLine($"Usage: skill_setlevel [name] [value]\n{skillNames}");
                    return;
                }

                Skills.SkillType skill = GetSkillFromName(args[0]);
                if (skill == Skills.SkillType.None)
                {
                    string skillNames = GetSkillNames();
                    Console.WriteLine($"Invalid skill name!\n{skillNames}");
                    return;
                }

                Player localPlayer = GetLocalPlayer();
                if (args.Count == 1)
                {
                    if (skill == Skills.SkillType.All)
                    {
                        foreach (var i in Enum.GetValues(typeof(Skills.SkillType)))
                        {
                            Skills.SkillType tempType = (Skills.SkillType)i;
                            if (tempType == Skills.SkillType.None || tempType == Skills.SkillType.All)
                            {
                                continue;
                            }

                            Console.WriteLine($"Current level of the {i} skill: {GetSkillLevel(tempType)}");
                        }
                    }
                    else
                    {
                        Console.WriteLine($"Current level of the {skill} skill: {GetSkillLevel(skill)}");
                    }

                    return;
                }

                if (!int.TryParse(args[1], out int skillLevel))
                {
                    Console.WriteLine("Invalid input!");
                    return;
                }

                SetSkillLevel(skill, skillLevel);

                string message = skill == Skills.SkillType.All ? $"Changed the level of every skill to {skillLevel}" : $"Changed the level of the {skill} to {skillLevel}";
                Console.WriteLine(message);
                localPlayer.Message(MessageHud.MessageType.Center, message);
            }));

            Console.RegisterCommand("god_toggle", "Toggle god mode.", new ConsoleCommandCallback((args) =>
            {
                if (args.Count == 0)
                {
                    Console.WriteLine($"Usage: god_toggle [value]\nCurrent value: {God}");
                    return;
                }

                if (!bool.TryParse(args[0], out God))
                {
                    Console.WriteLine("Invalid input!");
                    return;
                }

                Console.WriteLine($"God mode is now {God}");
                GetLocalPlayer()?.Message(MessageHud.MessageType.Center, $"God mode is now {God}");
            }));

            Console.RegisterCommand("ghost_toggle", "Toggle ghost mode.", new ConsoleCommandCallback((args) =>
            {
                if (args.Count == 0)
                {
                    Console.WriteLine($"Usage: ghost_toggle [value]\nCurrent value: {Ghost}");
                    return;
                }

                if (!bool.TryParse(args[0], out Ghost))
                {
                    Console.WriteLine("Invalid input!");
                    return;
                }

                Console.WriteLine($"Ghost mode is now {Ghost}");
                GetLocalPlayer()?.Message(MessageHud.MessageType.Center, $"Ghost mode is now {Ghost}");
            }));

            Console.RegisterCommand("food_puke", "Clear foods.", new ConsoleCommandCallback((args) =>
            {
                Player localPlayer = GetLocalPlayer();

                if (localPlayer != null)
                {
                    localPlayer.ClearFood();
                    localPlayer.Message(MessageHud.MessageType.Center, "Your foods cleared!");
                    Console.WriteLine("Your foods cleared!");
                }
            }));

            Console.RegisterCommand("tame_all", "Tame every mob in your area.", new ConsoleCommandCallback((args) =>
            {
                if (args.Count == 0)
                {
                    Console.WriteLine($"Usage: tame_all [radius]");
                    return;
                }

                if (!int.TryParse(args[0], out int radius))
                {
                    Console.WriteLine("Invalid input!");
                    return;
                }

                Player localPlayer = GetLocalPlayer();

                if (localPlayer != null)
                {
                    Tameable.TameAllInArea(localPlayer.transform.position, radius);

                    localPlayer.Message(MessageHud.MessageType.Center, "You have tamed every mob in the given area!");
                    Console.WriteLine("You have tamed every mob in the given area!");
                }
            }));

            Console.RegisterCommand("getpos", "Get your position.", new ConsoleCommandCallback((args) =>
            {
                Player localPlayer = GetLocalPlayer();
                if (localPlayer == null)
                {
                    Console.WriteLine("Couldn't get player position. (Not in-game?)");
                    return;
                }

                string message = $"X: {localPlayer.transform.position.x:F0} Y: {localPlayer.transform.position.y:F0} Z: {localPlayer.transform.position.z:F0}";

                Console.WriteLine(message);
                localPlayer.Message(MessageHud.MessageType.Center, message);
            }));

            Console.RegisterCommand("wind_reset", "Reset wind.", new ConsoleCommandCallback((args) =>
            {
                EnvMan.instance.ResetDebugWind();
                Player localPlayer = GetLocalPlayer();
                localPlayer.Message(MessageHud.MessageType.Center, "Wind reseted!");
                Console.WriteLine("Wind reseted!");
            }));

            Console.RegisterCommand("wind_set", "Set wind.", new ConsoleCommandCallback((args) =>
            {
                if (args.Count != 2)
                {
                    Console.WriteLine($"Usage: wind_set [angle] [intensity]");
                    return;
                }

                if (!int.TryParse(args[0], out int angle))
                {
                    Console.WriteLine("Invalid input!");
                    return;
                }

                if (!int.TryParse(args[1], out int intensity))
                {
                    Console.WriteLine("Invalid input!");
                    return;
                }

                EnvMan.instance.SetDebugWind(angle, intensity);

                Player localPlayer = GetLocalPlayer();
                string message     = $"Wind has been changed to angle {angle} with intensity {intensity}";

                localPlayer.Message(MessageHud.MessageType.Center, message);
                Console.WriteLine(message);
            }));

            Console.RegisterCommand("teleport_coord", "Teleport to coord.", new ConsoleCommandCallback((args) =>
            {
                if (args.Count != 3)
                {
                    Console.WriteLine($"Usage: teleport_coord [x] [y] [z]");
                    return;
                }

                int[] coords = { 0, 0, 0 };
                for (int i = 0; i < coords.Length; i++)
                {
                    if (!int.TryParse(args[i], out coords[i]))
                    {
                        Console.WriteLine("Invalid input!");
                        return;
                    }
                }

                Player localPlayer = GetLocalPlayer();
                localPlayer.TeleportTo(new Vector3(coords[0], coords[1], coords[2]), localPlayer.transform.rotation, true);
                string message = $"Teleported to coord: {coords[0]} {coords[1]} {coords[2]}";

                localPlayer.Message(MessageHud.MessageType.Center, message);
                Console.WriteLine(message);
            }));

            Console.RegisterCommand("teleport_player", "Teleport to the given player.", new ConsoleCommandCallback((args) =>
            {
                if (args.Count == 0)
                {
                    Console.WriteLine("Usage: teleport_player [name]");
                    return;
                }

                Player targetPlayer = GetPlayerFromName(args[0]);
                if (targetPlayer == null)
                {
                    Console.WriteLine($"No player found with name {args[0]}");
                    return;
                }

                Player localPlayer = GetLocalPlayer();
                localPlayer.TeleportTo(targetPlayer.transform.position, targetPlayer.transform.rotation, true);
                string message = $"Teleported to player: {targetPlayer.GetPlayerName()}";

                Console.WriteLine(message);
                localPlayer.Message(MessageHud.MessageType.Center, message);
            }));

            Console.RegisterCommand("teleport_restrict", "Disable teleport restrictions for every item in your inventory.", new ConsoleCommandCallback((args) =>
            {
                if (args.Count == 0)
                {
                    Console.WriteLine($"Usage: teleport_restrict [value]\nCurrent value: {Teleportable}");
                    return;
                }

                if (!bool.TryParse(args[0], out Teleportable))
                {
                    Console.WriteLine("Invalid input!");
                    return;
                }

                Console.WriteLine($"No teleport restrict is now {Teleportable}");
                GetLocalPlayer()?.Message(MessageHud.MessageType.Center, $"No teleport restrict is now {Teleportable}");
            }));

            Console.RegisterCommand("no_cost", "Toggle no cost.", new ConsoleCommandCallback((args) =>
            {
                if (args.Count == 0)
                {
                    Console.WriteLine($"Usage: no_cost [value]\nCurrent value: {NoCost}");
                    return;
                }

                if (!bool.TryParse(args[0], out NoCost))
                {
                    Console.WriteLine("Invalid input!");
                    return;
                }

                Console.WriteLine($"No cost is now {NoCost}");
                GetLocalPlayer()?.Message(MessageHud.MessageType.Center, $"No cost is now {NoCost}");
            }));

            Console.RegisterCommand("player_list", "Prints the available players.", new ConsoleCommandCallback((args) =>
            {
                ListPlayers();
            }));

            Console.RegisterCommand("prefab_dump", "Dump prefabs to file 'prefabs_dump.txt'. (inside Valheim's folder)", new ConsoleCommandCallback((args) =>
            {
                DumpPrefabs();
            }));

            Console.RegisterCommand("prefab_spawn", "Spawn any game prefab. (Items, mobs, etc.)", new ConsoleCommandCallback((args) =>
            {
                if (args.Count != 3)
                {
                    Console.WriteLine($"Usage: prefab_spawn [prefab_name] [amount] [level]");
                    return;
                }

                GameObject prefab = ZNetScene.instance.GetPrefab(args[0]);
                if (prefab == null)
                {
                    Console.WriteLine("Invalid prefab!\nFor prefab names, use 'prefab_dump'");
                    return;
                }

                if (!int.TryParse(args[1], out int amount))
                {
                    Console.WriteLine("Invalid input!");
                    return;
                }

                if (amount < 1)
                {
                    return;
                }

                if (!int.TryParse(args[2], out int level))
                {
                    Console.WriteLine("Invalid input!");
                    return;
                }

                try
                {
                    Player localPlayer = GetLocalPlayer();
                    DateTime now       = DateTime.Now;

                    for (int i = 0; i < amount; i++)
                    {
                        Character component = UnityEngine.Object.Instantiate <GameObject>(prefab, localPlayer.transform.position + localPlayer.transform.forward * 2.0f + Vector3.up + (UnityEngine.Random.insideUnitSphere * 0.5f), Quaternion.identity).GetComponent <Character>();

                        if (component & level > 1)
                        {
                            component.SetLevel(level);
                        }
                    }

                    string message = $"Spawned x{amount} of {prefab.name} (Level {level})";
                    localPlayer.Message(MessageHud.MessageType.Center, message);
                    Console.WriteLine(message + $" in {(DateTime.Now - now).TotalMilliseconds} ms");
                } catch (Exception ex)
                {
                    Console.Debug(ex);
                }
            }));

            Console.RegisterCommand("font_size", "Set console font size.", new ConsoleCommandCallback((args) =>
            {
                if (args.Count == 0)
                {
                    Console.WriteLine($"Usage: font_size [size]\nCurrent Value: {Console.GetFontSize()}");
                    return;
                }

                int size = Console.GetFontSize();
                if (!int.TryParse(args[0], out size))
                {
                    Console.WriteLine("Invalid input!");
                    return;
                }

                Console.SetFontSize(size);
                Console.WriteLine($"Changed console font size to {size}");
            }));

            Console.RegisterCommand("font_color", "Set console font color.", new ConsoleCommandCallback((args) =>
            {
                if (args.Count == 0)
                {
                    Console.WriteLine($"Usage: font_color [color]\nAvailable Colors: blue white black yellow cyan grey gray green clear magenta red");
                    return;
                }

                try
                {
                    var colorField = typeof(Color).GetProperty(args[0]);
                    if (colorField != null)
                    {
                        Console.SetFontColor((Color)colorField.GetValue(null));
                        Console.WriteLine($"Changed console font color to {args[0]}");
                    }
                } catch (Exception ex)
                {
                    Console.Debug(ex);
                }
            }));

            Console.RegisterCommand("inventory_carryweight", "Set the maximum inventory weight limit.", new ConsoleCommandCallback((args) =>
            {
                if (args.Count == 0)
                {
                    Console.WriteLine($"Usage: inventory_carryweight [weight]\nCurrent value: {CarryWeight}");
                    return;
                }

                if (!int.TryParse(args[0], out CarryWeight))
                {
                    Console.WriteLine("Invalid input!");
                    return;
                }

                Console.WriteLine($"Carry weight limit has been changed to {CarryWeight}");
            }));

            Console.RegisterCommand("inventory_height", "Set the inventory height. (aka more slots)", new ConsoleCommandCallback((args) =>
            {
                if (args.Count == 0)
                {
                    Console.WriteLine($"Usage: inventory_height [height]\nCurrent value: {InventoryHeight}");
                    return;
                }

                if (!int.TryParse(args[0], out InventoryHeight))
                {
                    Console.WriteLine("Invalid input!");
                    return;
                }

                Console.WriteLine($"Inventory height has been changed to {InventoryHeight}");
            }));

            Console.RegisterCommand("clear", "Clear the console output.", new ConsoleCommandCallback((args) =>
            {
                Console.Clear();
            }));

            Console.RegisterCommand("quit", "Quit from the game.", new ConsoleCommandCallback((args) =>
            {
                Application.Quit();
            }));

            Console.RegisterCommand("exec", "Execute configuration file. (Relative .cfg path from Valheim folder)", new ConsoleCommandCallback((args) =>
            {
                if (args.Count == 0)
                {
                    Console.WriteLine($"Usage: exec [path]");
                    return;
                }

                Console.LoadConfig(args[0]);
            }));

            Console.RegisterCommand("equip_toggle", "Toggle instant equip.", new ConsoleCommandCallback((args) =>
            {
                if (args.Count == 0)
                {
                    Console.WriteLine($"Usage: equip_toggle [value]\nCurrent value: {InstaEquip}");
                    return;
                }

                if (!bool.TryParse(args[0], out InstaEquip))
                {
                    Console.WriteLine("Invalid input!");
                    return;
                }

                Console.WriteLine($"Instant equip is now {InstaEquip}");
                GetLocalPlayer()?.Message(MessageHud.MessageType.Center, $"Instant equip is now {InstaEquip}");
            }));

            Console.RegisterCommand("stamina_toggle", "Toggle infinite stamina.", new ConsoleCommandCallback((args) =>
            {
                if (args.Count == 0)
                {
                    Console.WriteLine($"Usage: stamina_toggle [value]\nCurrent value: {UnlimitedStamina}");
                    return;
                }

                if (!bool.TryParse(args[0], out UnlimitedStamina))
                {
                    Console.WriteLine("Invalid input!");
                    return;
                }

                Console.WriteLine($"Infinite stamina is now {UnlimitedStamina}");
                GetLocalPlayer()?.Message(MessageHud.MessageType.Center, $"Infinite stamina is now {UnlimitedStamina}");
            }));

            Console.RegisterCommand("comfort_level", "Set the comfort level.", new ConsoleCommandCallback((args) =>
            {
                if (args.Count == 0)
                {
                    Console.WriteLine($"Usage: comfort_level [value]\nCurrent value: {ComfortLevel}");
                    return;
                }

                if (!int.TryParse(args[0], out ComfortLevel))
                {
                    Console.WriteLine("Invalid input!");
                    return;
                }

                Console.WriteLine($"Comfort level is now {ComfortLevel}");
                GetLocalPlayer()?.Message(MessageHud.MessageType.Center, $"Comfort level is now {ComfortLevel}");
            }));

            Console.RegisterCommand("roof_state", "Set roof state.", new ConsoleCommandCallback((args) =>
            {
                if (args.Count == 0)
                {
                    Console.WriteLine($"Usage: comfort_level [value]\nCurrent value: {Roof}");
                    return;
                }

                if (!bool.TryParse(args[0], out Roof))
                {
                    Console.WriteLine("Invalid input!");
                    return;
                }

                Console.WriteLine($"Roof state is now {Roof}");
                GetLocalPlayer()?.Message(MessageHud.MessageType.Center, $"Roof state is now {Roof}");
            }));

            Console.RegisterCommand("guardian_cooldown", "Toggle guardian cooldown.", new ConsoleCommandCallback((args) =>
            {
                if (args.Count == 0)
                {
                    Console.WriteLine($"Usage: guardian_cooldown [value]\nCurrent value: {NoGuardianCd}");
                    return;
                }

                if (!bool.TryParse(args[0], out NoGuardianCd))
                {
                    Console.WriteLine("Invalid input!");
                    return;
                }

                Console.WriteLine($"Disable guardian cooldown is now {NoGuardianCd}");
                GetLocalPlayer()?.Message(MessageHud.MessageType.Center, $"Disable guardian cooldown is now {NoGuardianCd}");
            }));

            Console.RegisterCommand("guardian_power", "Set guardian power to any status effect.", new ConsoleCommandCallback((args) =>
            {
                if (args.Count == 0)
                {
                    Console.WriteLine($"Usage: guardian_power [name]\nCurrent value: {GuardianPower}\nAvailable Status Effects: {GetStatusEffectNames()}");
                    return;
                }

                foreach (var i in ObjectDB.instance.m_StatusEffects)
                {
                    if (i.name == args[0])
                    {
                        GuardianPower = args[0];
                        Console.WriteLine($"Guardian power has been changed to {GuardianPower}");
                        GetLocalPlayer()?.Message(MessageHud.MessageType.Center, $"Guardian power has been changed to {GuardianPower}");
                        return;
                    }
                }

                Console.WriteLine("Invalid status effect name!");
            }));

            Console.RegisterCommand("guardian_start", "Force start guardian power.", new ConsoleCommandCallback((args) =>
            {
                Player localPlayer = GetLocalPlayer();
                if (localPlayer == null)
                {
                    Console.WriteLine("Not in-game");
                    return;
                }

                if (localPlayer.StartGuardianPower())
                {
                    Console.WriteLine("Force started guardian power.");
                    GetLocalPlayer()?.Message(MessageHud.MessageType.Center, "Force started guardian power.");
                }
                else
                {
                    Console.WriteLine("No guaridan power is equipped or coudln't force start it!");
                }
            }));

            Console.RegisterCommand("add_status_effect", "Add status effect.", new ConsoleCommandCallback((args) =>
            {
                if (args.Count == 0)
                {
                    Console.WriteLine($"Usage: add_status_effect [name]\nAvailable Status Effects: {GetStatusEffectNames()}");
                    return;
                }

                Player localPlayer = GetLocalPlayer();
                if (localPlayer == null)
                {
                    Console.WriteLine("Not in-game");
                    return;
                }

                foreach (var i in ObjectDB.instance.m_StatusEffects)
                {
                    if (i.name == args[0])
                    {
                        AddStatusEffect(args[0]);
                        Console.WriteLine($"Added status effect {args[0]}");
                        GetLocalPlayer()?.Message(MessageHud.MessageType.Center, $"Added status effect {args[0]}");
                        return;
                    }
                }

                Console.WriteLine("Invalid status effect name!");
                GetLocalPlayer()?.Message(MessageHud.MessageType.Center, "Invalid status effect name!");
            }));

            Console.RegisterCommand("set_keybind", "Set keybind to execute command", new ConsoleCommandCallback((args) =>
            {
                if (args.Count == 0)
                {
                    Console.WriteLine($"Usage: set_keybind [keycode]\nAvailable keycodes: https://docs.unity3d.com/ScriptReference/KeyCode.html");
                    return;
                }

                KeyCode keyCode = KeyCode.None;
                foreach (var i in Enum.GetValues(typeof(KeyCode)))
                {
                    if (i.ToString().ToLower() == args[0])
                    {
                        keyCode = (KeyCode)i;
                    }
                }

                if (keyCode != KeyCode.None)
                {
                    string buffer = "";
                    for (int i = 1; i < args.Count; i++)
                    {
                        buffer += args[i] + " ";
                    }

                    Keybinds[keyCode] = buffer;
                }
                else
                {
                    Console.WriteLine("Invalid keycode!");
                }
            }));

            SendHudMessage("DURANDA LOADED");

            Console.LoadConfig();
        }
Exemplo n.º 29
0
        internal static void LateLoadMiniSkelly(GameObject clone)
        {
            Character component  = (Character)clone.GetComponent <Character>();
            BaseAI    component2 = (BaseAI)clone.GetComponent <BaseAI>();

            component.m_name = "Skeleton";
            Character character1 = component;

            character1.m_health = 20;
            Character character2 = component;

            character2.m_acceleration = (float)(character2.m_acceleration * 1.75);
            Character character3 = component;

            character3.m_speed = (float)(character3.m_speed * 3.5);
            Character character4 = component;

            character4.m_walkSpeed = (float)(character4.m_walkSpeed * 2);
            Character character5 = component;

            character5.m_runSpeed = (float)(character5.m_runSpeed * 2.5);

            Rigidbody rigidbody = clone.GetComponent <Rigidbody>();

            rigidbody.mass = 0.5f;

            Humanoid humanoid = (Humanoid)component;

            Character.Faction nFaction = Character.Faction.Players;
            humanoid.m_faction      = nFaction;
            humanoid.m_defaultItems = new GameObject[1]
            {
                DesignSkellySword()
            };

            humanoid.m_randomShield = new GameObject[1]
            {
                DesignSkellyShield()
            };
            humanoid.m_randomWeapon = null;

            MonsterAI monsterAI = (MonsterAI)clone.GetComponent <BaseAI>();

            monsterAI.m_viewRange              = (int)15;
            monsterAI.m_deathMessage           = "Friendly Skelly Down!";
            monsterAI.m_enableHuntPlayer       = false;
            monsterAI.m_circulateWhileCharging = false;

            Tameable   tameable   = (Tameable)clone.AddComponent <Tameable>();
            GameObject wolfObject = (GameObject)RRRLateLoadPrefabs.Clone("Wolf", "tameClone", true, true);
            Tameable   wolfTame   = (Tameable)wolfObject.GetComponent <Tameable>();

            tameable.m_fedDuration = wolfTame.m_fedDuration;
            tameable.m_tamingTime  = wolfTame.m_tamingTime;
            tameable.m_commandable = true;

            CharacterDrop characterDrop = (CharacterDrop)clone.GetComponent <CharacterDrop>();

            characterDrop.m_drops.Clear();

            MiniSkelly.DesignAppearance(clone);
        }
Exemplo n.º 30
0
        internal static void LateLoadMiniSquito(GameObject clone)
        {
            Character component  = (Character)clone.GetComponent <Character>();
            BaseAI    component2 = (BaseAI)clone.GetComponent <BaseAI>();

            component.m_name = "Squito";
            Character character1 = component;

            character1.m_health = 5;
            Character character2 = component;

            character2.m_acceleration = (float)(character2.m_acceleration * 0.75);
            Character character3 = component;

            character3.m_speed = (float)(character3.m_speed * 0.75);
            Character character4 = component;

            character4.m_walkSpeed = (float)(character4.m_walkSpeed * 0.75);
            Character character5 = component;

            character5.m_runSpeed = (float)(character5.m_runSpeed * 0.75);
            Character character6 = component;

            character6.m_flySlowSpeed = (float)(character6.m_flySlowSpeed * 0.75);
            Character character7 = component;

            character7.m_flyFastSpeed = (float)(character7.m_flyFastSpeed * 1.25);

            Rigidbody rigidbody = clone.GetComponent <Rigidbody>();

            rigidbody.mass = 3f;

            Humanoid humanoid = (Humanoid)component;

            Character.Faction nFaction = Character.Faction.Players;
            humanoid.m_faction      = nFaction;
            humanoid.m_defaultItems = new GameObject[1]
            {
                DesignSquitoSting()
            };


            MonsterAI monsterAI = (MonsterAI)clone.GetComponent <BaseAI>();

            monsterAI.m_viewRange              = (int)15;
            monsterAI.m_deathMessage           = "Friendly Squito Down!";
            monsterAI.m_enableHuntPlayer       = false;
            monsterAI.m_circulateWhileCharging = false;
            monsterAI.m_flyAltitudeMin         = 0.4f;

            Tameable   tameable   = (Tameable)clone.AddComponent <Tameable>();
            GameObject wolfObject = (GameObject)RRRLateLoadPrefabs.Clone("Wolf", "tameClone2", true, true);
            Tameable   wolfTame   = (Tameable)wolfObject.GetComponent <Tameable>();

            tameable.m_fedDuration = wolfTame.m_fedDuration;
            tameable.m_tamingTime  = wolfTame.m_tamingTime;
            tameable.m_commandable = true;
            tameable.m_tamedEffect = new EffectList();

            CharacterDrop characterDrop = (CharacterDrop)clone.GetComponent <CharacterDrop>();

            characterDrop.m_drops.Clear();

            MiniSquito.DesignAppearance(clone);
        }