コード例 #1
0
        public static bool RestrictionCheckNone(Character __instance, string restriction)
        {
            Character p = __instance;

            // Are we in a zone? if so select that zone.
            if (ZoneHandler.Zones.Count() == 0)
            {
                return(false);
            }
            ZoneHandler.Zone        z     = new ZoneHandler.Zone();
            ZoneHandler.ZoneTypes   zt    = new ZoneHandler.ZoneTypes();
            List <ZoneHandler.Zone> zlist = ZoneHandler.ListOccupiedZones(p.transform.position);

            if (zlist.Count == 0)
            {
                zt = ZoneHandler.FindZoneType("wilderness");
            }
            else
            {
                z  = ZoneHandler.TopZone(zlist);
                zt = ZoneHandler.FindZoneType(z.Type);
            }
            string key = "";

            // Lets set our admin list and keys...
            key = zt.Configurations;
            if (key.ToLower().Contains(restriction))
            {
                return(true);
            }
            else
            {
                return(false);
            }
        }
コード例 #2
0
        public static float RestrictionCheckFloatReturnCharacter(Character __instance, string restriction)
        {
            Character p = __instance;
            string    CharacterSteamID = (ZNet.instance.GetPeer(__instance.GetZDOID().m_userID)).m_socket.GetHostName();

            // Are we in a zone? if so select that zone.
            ZoneHandler.Zone        z     = new ZoneHandler.Zone();
            ZoneHandler.ZoneTypes   zt    = new ZoneHandler.ZoneTypes();
            List <ZoneHandler.Zone> zlist = ZoneHandler.ListOccupiedZones(p.transform.position);

            if (zlist.Count == 0)
            {
                zt = ZoneHandler.FindZoneType("wilderness");
            }
            else
            {
                z  = ZoneHandler.TopZone(zlist);
                zt = ZoneHandler.FindZoneType(z.Type);
            }
            string key    = "";
            string admins = "";

            // Lets set our admins and keys..
            admins = zt.Admins;
            key    = zt.Configurations;
            // Lets see if the user is actually an admin in the zone first..
            if (admins.Contains(CharacterSteamID))
            {
                // Ok they are an admin. Therefore, do not initialize the change...
                return(1);
            }
            if (key.ToLower().Contains(restriction))
            {
                string s = key.ToLower();
                string restrictioncheck = restriction + "(";
                int    indexStart       = s.IndexOf(restrictioncheck) + restrictioncheck.Length;
                string test             = "";
                for (int i = indexStart; i < indexStart + 20; i++)
                {
                    if (s[i] == ')')
                    {
                        break;
                    }
                    test += s[i];
                }
                float multiplier = 1;
                multiplier = Convert.ToSingle(test, new CultureInfo("en-US"));
                return(multiplier);
            }
            else
            {
                return(1);
            }
        }
コード例 #3
0
        public static bool RestrictionCheckCharacter(Character __instance, string restriction)
        {
            Character p = __instance;
            string    CharacterSteamID = (ZNet.instance.GetPeer(__instance.GetZDOID().m_userID)).m_socket.GetHostName();

            // Are we in a zone? if so select that zone.
            if (ZoneHandler.Zones.Count() == 0)
            {
                return(false);
            }
            ZoneHandler.Zone        z     = new ZoneHandler.Zone();
            ZoneHandler.ZoneTypes   zt    = new ZoneHandler.ZoneTypes();
            List <ZoneHandler.Zone> zlist = ZoneHandler.ListOccupiedZones(p.transform.position);

            if (zlist.Count == 0)
            {
                zt = ZoneHandler.FindZoneType("wilderness");
            }
            else
            {
                z  = ZoneHandler.TopZone(zlist);
                zt = ZoneHandler.FindZoneType(z.Type);
            }
            string key    = "";
            string admins = "";

            // Lets set our admin list and keys...
            admins = zt.Admins;
            key    = zt.Configurations;
            // Lets check and see if the user is actually an admin in the zone.
            if (admins.Contains(CharacterSteamID))
            {
                return(false);
            }
            if (key.ToLower().Contains(restriction))
            {
                return(true);
            }
            else
            {
                return(false);
            }
        }
コード例 #4
0
        public static bool RestrictionCheck(string restriction)
        {
            Player p = Player.m_localPlayer;

            // Are we in a zone? if so select that zone.
            if (ZoneHandler.Zones.Count() == 0)
            {
                return(false);
            }
            ZoneHandler.Zone        z     = new ZoneHandler.Zone();
            ZoneHandler.ZoneTypes   zt    = new ZoneHandler.ZoneTypes();
            List <ZoneHandler.Zone> zlist = ZoneHandler.ListOccupiedZones(p.transform.position);

            if (zlist.Count == 0)
            {
                zt = ZoneHandler.FindZoneType("wilderness");
            }
            else
            {
                z  = ZoneHandler.TopZone(zlist);
                zt = ZoneHandler.FindZoneType(z.Type);
            }
            string key    = "";
            string admins = "";

            // Lets set our admin list and keys...
            admins = zt.Admins;
            key    = zt.Configurations;
            // Lets check and see if the user is actually an admin in the zone.
            if (admins.Contains(WorldofValheimZones.MySteamID))
            {
                return(false);
            }
            if (key.ToLower().Contains(restriction))
            {
                return(true);
            }
            else
            {
                return(false);
            }
        }
コード例 #5
0
        /// <summary>
        /// FixedUpdate<> Patch
        /// Includes the following:
        ///     PushAway (Do not enter zone)
        ///     PeriodicDamage
        ///     PeriodicHeal
        ///     Last Updated: 4/24/2021
        ///     Status: 100% Working
        /// </summary>
        public static void FixedUpdatez()
        {
            if (WorldofValheimZones.EffectTick > 0)
            {
                WorldofValheimZones.EffectTick--;
            }
            if (WorldofValheimZones.HealTick > 0)
            {
                WorldofValheimZones.HealTick--;
            }
            if (WorldofValheimZones.DamageTick > 0)
            {
                WorldofValheimZones.DamageTick--;
            }
            Player p = Player.m_localPlayer;

            if (p != null)
            {
                // Are we in a zone? if so select that zone.
                ZoneHandler.Zone        z     = new ZoneHandler.Zone();
                ZoneHandler.ZoneTypes   zt    = new ZoneHandler.ZoneTypes();
                List <ZoneHandler.Zone> zlist = ZoneHandler.ListOccupiedZones(p.transform.position);
                if (zlist.Count == 0)
                {
                    zt = ZoneHandler.FindZoneType("wilderness");
                }
                else
                {
                    z  = ZoneHandler.TopZone(zlist);
                    zt = ZoneHandler.FindZoneType(z.Type);
                }
                // Lets set our strings...
                string admins = zt.Admins;
                string key    = zt.Configurations;
                // Lets see if the user is considered a Zone Admin!
                if (admins.Contains(WorldofValheimZones.MySteamID))
                {
                    return;
                }
                // Keep player out of an area.
                if (key.ToLower().Contains("pushaway"))
                {
                    Vector3 zposition  = new Vector3(z.Position.x, p.transform.position.y, z.Position.y);
                    Vector3 newVector3 = p.transform.position +
                                         (p.transform.position - zposition).normalized * 0.15f;
                    p.transform.position = new Vector3(newVector3.x, p.transform.position.y, newVector3.z);
                }
                // Deal damage to the player while they are in the area.
                if (key.ToLower().Contains("periodicdamage") && WorldofValheimZones.DamageTick <= 0)
                {
                    WorldofValheimZones.DamageTick = 100;
                    string s          = key.ToLower();
                    int    indexStart = s.IndexOf("periodicdamage(") + "periodicdamage(".Length;
                    string test       = "";
                    for (int i = indexStart; i < indexStart + 30; i++)
                    {
                        if (s[i] == ')')
                        {
                            break;
                        }
                        test += s[i];
                    }
                    int      damage = 0;
                    HitData  hit    = new HitData();
                    string[] array  = test.Split(',');
                    if (array.Count() == 2)
                    {
                        int.TryParse(array[1], out damage);
                        if (array[0].ToLower() == "fire")
                        {
                            hit.m_damage.m_fire = (float)damage;
                        }
                        else if (array[0].ToLower() == "frost")
                        {
                            hit.m_damage.m_frost = (float)damage;
                        }
                        else if (array[0].ToLower() == "poison")
                        {
                            hit.m_damage.m_poison = (float)damage;
                        }
                        else if (array[0].ToLower() == "lightning")
                        {
                            hit.m_damage.m_lightning = (float)damage;
                        }
                        else if (array[0].ToLower() == "pierce")
                        {
                            hit.m_damage.m_pierce = (float)damage;
                        }
                        else if (array[0].ToLower() == "blunt")
                        {
                            hit.m_damage.m_blunt = (float)damage;
                        }
                        else if (array[0].ToLower() == "slash")
                        {
                            hit.m_damage.m_slash = (float)damage;
                        }
                        else if (array[0].ToLower() == "damage")
                        {
                            hit.m_damage.m_damage = (float)damage;
                        }
                        else
                        {
                            hit.m_damage.m_fire = (float)damage;
                        }
                    }
                    else
                    {
                        int.TryParse(test, out damage);
                        hit.m_damage.m_fire = (float)damage;
                    }
                    p.Damage(hit);
                }
                // Heal the player while they are in the area
                if (key.ToLower().Contains("periodicheal") && WorldofValheimZones.HealTick <= 0)
                {
                    WorldofValheimZones.HealTick = 50;
                    string s          = key.ToLower();
                    int    indexStart = s.IndexOf("periodicheal(") + "periodicheal(".Length;
                    string test       = "";
                    for (int i = indexStart; i < indexStart + 20; i++)
                    {
                        if (s[i] == ')')
                        {
                            break;
                        }
                        test += s[i];
                    }
                    int damage = 0;
                    int.TryParse(test, out damage);
                    p.Heal(damage, true);
                }
            }
        }