Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using Oxide.Core;
- using Random = UnityEngine.Random;
- using System.Collections.Generic;
- using UnityEngine;
- using System.Linq;
- using System.Text.RegularExpressions;
- using System;
- namespace Oxide.Plugins
- {
- // Spolszczył Mroczny
- [Info("RankFermix", "Kaidoz", "2.0.1")]
- class RankFermix : HurtworldPlugin
- {
- Dictionary<string, object> Abilities = new Dictionary<string, object>();
- Dictionary<string, object> Levels = new Dictionary<string, object>();
- protected override void LoadDefaultConfig()
- {
- Config.Clear();
- Abilities.Add("Thorns1", 18);
- Abilities.Add("Thorns2", 38);
- Abilities.Add("Thorns3", 50);
- Abilities.Add("Thorns4", 65);
- Abilities.Add("Thorns5", 80);
- if (Config["Abilities"] == null) Config["Abilities"] = Abilities;
- Levels.Add("01", 0);
- Levels.Add("02", 300);
- Levels.Add("03", 600);
- Levels.Add("04", 1000);
- Levels.Add("05", 1500);
- Levels.Add("06", 2000);
- Levels.Add("07", 2500);
- Levels.Add("08", 3000);
- Levels.Add("09", 4000);
- Levels.Add("10", 5000);
- Levels.Add("11", 6500);
- Levels.Add("12", 8000);
- Levels.Add("13", 9500);
- Levels.Add("14", 11000);
- Levels.Add("15", 13000);
- Levels.Add("16", 15000);
- Levels.Add("17", 18000);
- Levels.Add("18", 21500);
- Levels.Add("19", 25000);
- Levels.Add("20", 30000);
- Levels.Add("21", 38000);
- Levels.Add("22", 46000);
- Levels.Add("23", 56000);
- Levels.Add("24", 66000);
- Levels.Add("25", 76000);
- Levels.Add("26", 88000);
- Levels.Add("27", 98500);
- Levels.Add("28", 105000);
- Levels.Add("29", 120000);
- Levels.Add("30", 135000);
- Levels.Add("31", 150000);
- Levels.Add("32", 175000);
- Levels.Add("33", 200000);
- Levels.Add("34", 230000);
- Levels.Add("35", 260000);
- Levels.Add("36", 295000);
- Levels.Add("37", 330000);
- Levels.Add("38", 365000);
- Levels.Add("39", 400000);
- Levels.Add("40", 440000);
- Levels.Add("41", 480000);
- Levels.Add("42", 520000);
- Levels.Add("43", 560000);
- Levels.Add("44", 600000);
- Levels.Add("45", 650000);
- Levels.Add("46", 700000);
- Levels.Add("47", 750000);
- Levels.Add("48", 800000);
- Levels.Add("49", 860000);
- Levels.Add("50", 920000);
- Levels.Add("51", 1000000);
- Levels.Add("52", 1060000);
- Levels.Add("53", 1120002);
- Levels.Add("54", 1200003);
- Levels.Add("55", 1260004);
- Levels.Add("56", 1320005);
- Levels.Add("57", 1400006);
- Levels.Add("58", 1420007);
- Levels.Add("59", 1500008);
- Levels.Add("60", 1520009);
- Levels.Add("61", 1600010);
- Levels.Add("62", 1620011);
- Levels.Add("63", 1700012);
- Levels.Add("64", 1720013);
- Levels.Add("65", 1800014);
- Levels.Add("66", 1820015);
- Levels.Add("67", 1900016);
- Levels.Add("68", 1920017);
- Levels.Add("69", 2000000);
- Levels.Add("70", 2200000);
- Levels.Add("71", 3000000);
- Levels.Add("72", 3200000);
- Levels.Add("73", 3800000);
- Levels.Add("74", 4200000);
- Levels.Add("75", 4800000);
- Levels.Add("76", 4000000);
- Levels.Add("77", 4200000);
- Levels.Add("78", 4800000);
- Levels.Add("79", 4000000);
- Levels.Add("80", 4200000);
- Levels.Add("81", 4800000);
- Levels.Add("82", 5000000);
- Levels.Add("83", 5200000);
- Levels.Add("84", 5900000);
- Levels.Add("85", 6000000);
- Levels.Add("86", 6200000);
- Levels.Add("87", 7000000);
- Levels.Add("88", 7200000);
- Levels.Add("89", 7900000);
- Levels.Add("90", 7200000);
- Levels.Add("91", 7400000);
- Levels.Add("92", 7600000);
- Levels.Add("93", 7900000);
- Levels.Add("94", 8200000);
- Levels.Add("95", 8500000);
- Levels.Add("96", 8800000);
- Levels.Add("97", 9000000);
- Levels.Add("98", 9400000);
- Levels.Add("99", 9900000);
- Levels.Add("100", 10000000);
- if (Config["Levels"] == null) Config["Levels"] = Levels;
- SaveConfig();
- }
- void Init()
- {
- var save = timer.Repeat(1800f, 0, delegate
- {
- SaveData();
- });
- var sessions = GameManager.Instance.GetSessions();
- PlayerSession session = null;
- foreach (var i in sessions)
- {
- session = i.Value;
- CheckLvl(session);
- }
- var prov = timer.Repeat(30f, 0, delegate
- {
- foreach (var i in sessions)
- {
- session = i.Value;
- CheckLvl(session);
- }
- });
- permission.RegisterPermission("rankfermix.x2", this);
- permission.RegisterPermission("rankfermix.x3", this);
- permission.RegisterPermission("rankfermix.x4", this);
- permission.RegisterPermission("rankfermix.x100", this);
- LoadData();
- }
- private void OnPlayerRespawn(PlayerSession session)
- {
- int nfd = 0;
- timer.Once(0.1f, delegate
- {
- UserData con = (from x in Tops where x.SteamId == (ulong)session.SteamId select x).FirstOrDefault();
- foreach (var cmd in Config["Abilities"] as Dictionary<string, object>)
- {
- if (cmd.Key == "NoFallDamage") nfd = (int)cmd.Value;
- }
- if (con.Lvl >= nfd)
- {
- var motor = session.WorldPlayerEntity.GetComponent<CharacterMotorSimple>();
- motor.FallDamageMultiplier = 0;
- }
- session.WorldPlayerEntity.GetComponent<EntityStats>().GetFluidEffect(EEntityFluidEffectType.StorageCapacity).RemoveContinuousEffect(this);
- session.WorldPlayerEntity.GetComponent<EntityStats>().GetFluidEffect(EEntityFluidEffectType.StorageCapacity).AddContinuousEffect(this, con.Lvl / 2);
- session.WorldPlayerEntity.GetComponent<EntityStats>().GetFluidEffect(EEntityFluidEffectType.Pace).RemoveContinuousEffect(this);
- session.WorldPlayerEntity.GetComponent<EntityStats>().GetFluidEffect(EEntityFluidEffectType.Pace).AddContinuousEffect(this, con.Lvl / 100f);
- });
- }
- private void OnPlayerConnected(PlayerSession session)
- {
- int nfd = 0;
- CheckLvl(session);
- UserData con = (from x in Tops where x.SteamId == (ulong)session.SteamId select x).FirstOrDefault();
- con.TimeLastConnect = Convert.ToString(DateTime.Now);
- con.Ip = Convert.ToString(session.Player.ipAddress);
- con.Name = Convert.ToString(session.Name);
- foreach (var cmd in Config["Abilities"] as Dictionary<string, object>)
- {
- if (cmd.Key == "NoFallDamage") nfd = (int)cmd.Value;
- }
- if (con.Lvl >= nfd)
- {
- var motor = session.WorldPlayerEntity.GetComponent<CharacterMotorSimple>();
- motor.FallDamageMultiplier = 0;
- }
- session.WorldPlayerEntity.GetComponent<EntityStats>().GetFluidEffect(EEntityFluidEffectType.StorageCapacity).RemoveContinuousEffect(this);
- session.WorldPlayerEntity.GetComponent<EntityStats>().GetFluidEffect(EEntityFluidEffectType.StorageCapacity).AddContinuousEffect(this, con.Lvl / 2);
- session.WorldPlayerEntity.GetComponent<EntityStats>().GetFluidEffect(EEntityFluidEffectType.Pace).RemoveContinuousEffect(this);
- session.WorldPlayerEntity.GetComponent<EntityStats>().GetFluidEffect(EEntityFluidEffectType.Pace).AddContinuousEffect(this, con.Lvl / 100f);
- }
- public Vector3 StringToVector3(string v3)
- {
- var split = v3.Split(',').Select(Convert.ToSingle).ToArray();
- return split.Length == 3 ? new Vector3(split[0], split[1], split[2]) : Vector3.zero;
- }
- [ConsoleCommand("rank.clear")]
- private void cmdranlkHealStats(string commandString)
- {
- var TopSuicide = (from x in Tops select x).OrderByDescending(x => x.Suicide).Take(10000);
- foreach (var top in TopSuicide)
- {
- DateTime date1 = new DateTime(2017, 5, 31, 12, 0, 0);
- DateTime time2 = Convert.ToDateTime(top.TimeLastConnect);
- if (date1 > time2)
- {
- Tops.Remove(top);
- }
- }
- SaveData();
- }
- private void OnDispenserGather(GameObject resourceNode, HurtMonoBehavior player, List<ItemInstance> items)
- {
- if (resourceNode == null || player == null || items == null) return;
- string tmpName = Convert.ToString(GetNameOfObject(resourceNode));
- var KillerName = tmpName.Remove(tmpName.Length - 3);
- var session = getSession(KillerName);
- UserData con = (from x in Tops where x.SteamId == (ulong)session.SteamId select x).FirstOrDefault();
- var ItemMgr = Singleton<GlobalItemManager>.Instance;
- int oput = 0;
- if (Convert.ToString(player.name).Contains("Metal4ResourceNodeServer"))
- {
- oput = 35;
- }
- else if (Convert.ToString(player.name).Contains("Metal3ResourceNodeServer"))
- {
- oput = 30;
- }
- else if (Convert.ToString(player.name).Contains("Metal2ResourceNodeServer"))
- {
- oput = 20;
- }
- else if (Convert.ToString(player.name).Contains("SandstoneResourceNodeServer"))
- {
- oput = 12;
- }
- else if (Convert.ToString(player.name).Contains("Deadtree1ResourceNodeServer") || Convert.ToString(player.name).Contains("Deadtree2ResourceNodeServer") ||
- Convert.ToString(player.name).Contains("Deadtree3ResourceNodeServer") || Convert.ToString(player.name).Contains("LogResourceNodeServer"))
- {
- oput = 20;
- }
- else if (Convert.ToString(player.name).Contains("IronRockResourceNodeServer"))
- {
- oput = 8;
- }
- else if (Convert.ToString(player.name).Contains("CoalRockResourceNodeServer"))
- {
- oput = 5;
- }
- if (oput > 0)
- {
- if (Convert.ToString(player.name).Contains("Deadtree1ResourceNodeServer(Clone)") || Convert.ToString(player.name).Contains("Deadtree2ResourceNodeServer(Clone)") ||
- Convert.ToString(player.name).Contains("Deadtree3ResourceNodeServer(Clone)") || Convert.ToString(player.name).Contains("LogResourceNodeServer(Clone)"))
- {
- con.Wood = con.Wood + oput;
- }
- else
- {
- con.Ore = con.Ore + oput;
- }
- for (int index = 0; index < items.Count; ++index) Singleton<GlobalItemManager>.Instance.GiveItem(session.Player, items[index].Item, Convert.ToInt32(items[index].StackSize * con.Lvl / 100));
- if (permission.UserHasPermission(session.SteamId.ToString(), "rankfermix.x2"))
- {
- oput = oput * 2;
- }
- Singleton<AlertManager>.Instance.GenericTextNotificationServer("EXP: +" + oput, session.Player);
- con.Exp = con.Exp + oput;
- }
- }
- private void CheckLvl(PlayerSession session)
- {
- var check = (from x in Tops where x.SteamId == (ulong)session.SteamId select x).Count();
- if (check == 0)
- {
- Tops.Add(new UserData((ulong)session.SteamId, Convert.ToString(session.Name), Convert.ToString(session.Player.ipAddress), Convert.ToString(DateTime.Now), Convert.ToString("0"), 0, 0, 0, 0, 0, 0, 1, 0));
- //SaveData();
- }
- UserData con = (from x in Tops where x.SteamId == (ulong)session.SteamId select x).FirstOrDefault();
- int oput = 0;
- int nfd = 0;
- int dj = 0;
- int nextlvl = con.Lvl + 1;
- foreach (var cmd in Config["Levels"] as Dictionary<string, object>)
- {
- if (cmd.Key == nextlvl.ToString() || cmd.Key == "01" && nextlvl == 1 || cmd.Key == "02" && nextlvl == 2 || cmd.Key == "03" && nextlvl == 3 ||
- cmd.Key == "04" && nextlvl == 4 || cmd.Key == "05" && nextlvl == 5 || cmd.Key == "06" && nextlvl == 6 ||
- cmd.Key == "07" && nextlvl == 7 || cmd.Key == "08" && nextlvl == 8 || cmd.Key == "09" && nextlvl == 9) oput = (int)cmd.Value;
- }
- if (con.Exp >= oput)
- {
- con.Lvl++;
- foreach (var cmd in Config["Abilities"] as Dictionary<string, object>)
- {
- if (cmd.Key == "NoFallDamage") nfd = (int)cmd.Value;
- }
- if (con.Lvl >= nfd)
- {
- var motor = session.WorldPlayerEntity.GetComponent<CharacterMotorSimple>();
- motor.FallDamageMultiplier = 0;
- }
- Singleton<AlertManager>.Instance.GenericTextNotificationServer($"Podniosłeś swój poziom do: {con.Lvl}", session.Player);
- }
- }
- private void OnEntityDeath(object animal, EntityEffectSourceData dataSource)
- {
- string tmpName = GetNameOfObject(dataSource.EntitySource);
- string KillerName = tmpName.Remove(tmpName.Length - 3);
- int oput = 0;
- string anim = Convert.ToString(animal);
- UserData pakill = (from x in Tops where x.SteamId == (ulong)getSession(KillerName).SteamId select x).FirstOrDefault();
- if (anim.Contains("AIRafagaServer"))
- {
- oput = 20;
- }
- else if (anim.Contains("AIBorServer"))
- {
- oput = 10;
- }
- else if (anim.Contains("AIBorRadServer"))
- {
- oput = 12;
- }
- else if (anim.Contains("AIShepherdServer"))
- {
- oput = 6;
- }
- else if (anim.Contains("AIShigiArcticServer"))
- {
- oput = 14;
- }
- else if (anim.Contains("AIShigiForestServer"))
- {
- oput = 4;
- }
- else if (anim.Contains("AIShigiServer"))
- {
- oput = 2;
- }
- else if (anim.Contains("AIShigiWolfServer"))
- {
- oput = 8;
- }
- else if (anim.Contains("AITokarAlbinoServer"))
- {
- oput = 14;
- }
- else if (anim.Contains("AITokarBlueServer"))
- {
- oput = 14;
- }
- else if (anim.Contains("AITokarParrotServer"))
- {
- oput = 14;
- }
- else if (anim.Contains("AITokarServer"))
- {
- oput = 10;
- }
- else if (anim.Contains("AIYetiForestServer"))
- {
- oput = 40;
- }
- else if (anim.Contains("AIYetiServer"))
- {
- oput = 50;
- }
- if (permission.UserHasPermission(getSession(KillerName).SteamId.ToString(), "rankfermix.x2"))
- {
- oput = oput * 2;
- }
- Singleton<AlertManager>.Instance.GenericTextNotificationServer($"EXP: + {oput}", getSession(KillerName).Player);
- pakill.KillsAnimal = pakill.KillsAnimal + 1;
- pakill.Exp = pakill.Exp + oput;
- }
- [ConsoleCommand("rank.exp")]
- private void cmdrankexp(string commandString, string[] args)
- {
- if (args.Length == 2)
- {
- var sessions = GameManager.Instance.GetSessions().Values.ToList();
- foreach (var player in sessions)
- {
- if (player.SteamId.ToString().Contains(args[0]))
- {
- UserData con = (from x in Tops where x.SteamId == (ulong)player.SteamId select x).FirstOrDefault();
- int oput = 0;
- int nextlvl = con.Lvl + Convert.ToInt32(args[1]);
- foreach (var cmd in Config["Levels"] as Dictionary<string, object>)
- {
- if (cmd.Key == nextlvl.ToString() || cmd.Key == "01" && nextlvl == 1 || cmd.Key == "02" && nextlvl == 2 || cmd.Key == "03" && nextlvl == 3 ||
- cmd.Key == "04" && nextlvl == 4 || cmd.Key == "05" && nextlvl == 5 || cmd.Key == "06" && nextlvl == 6 ||
- cmd.Key == "07" && nextlvl == 7 || cmd.Key == "08" && nextlvl == 8 || cmd.Key == "09" && nextlvl == 9) oput = (int)cmd.Value;
- }
- con.Exp = oput;
- con.Lvl += Convert.ToInt32(args[1]);
- Puts($"[Score] {player.Name} increased its level to {con.Lvl}");
- return;
- }
- }
- }
- }
- [ChatCommand("exp")]
- void cmdsetexp(PlayerSession session, string command, string[] args)
- {
- if (!session.IsAdmin) return;
- UserData con = (from x in Tops where x.SteamId == (ulong)session.SteamId select x).FirstOrDefault();
- con.Exp += Convert.ToInt32(args[0]);
- hurt.SendChatMessage(session, null, $"<color=#FF7F00>[EXP]</color> <color=#98FB98>Successfully</color>");
- }
- [ChatCommand("jump")]
- void cmdsetjump(PlayerSession session, string command, string[] args)
- {
- int lvl = 0;
- foreach (var cmd in Config["Abilities"] as Dictionary<string, object>)
- {
- if (cmd.Key == "DoubleJump") lvl = (int)cmd.Value;
- }
- UserData con = (from x in Tops where x.SteamId == (ulong)session.SteamId select x).FirstOrDefault();
- var motor = session.WorldPlayerEntity.GetComponent<CharacterMotorSimple>();
- if (!motor || con == null || lvl == 0) return;
- if (con.Lvl < lvl)
- {
- hurt.SendChatMessage(session, null, $"<color=#FF7F00>[Rank]</color> <color=#FF6347>Skakanie jest dostepne od {lvl} poziomu</color>");
- return;
- }
- if (args[0] == "on")
- {
- if (permission.UserHasPermission(session.SteamId.ToString(), "ezconsole.flash") && Convert.ToString(motor.GravityVector) == "(0.0, -15.0, 0.0)")
- {
- session.WorldPlayerEntity.GetComponent<EntityStats>().GetFluidEffect(EEntityFluidEffectType.Pace).RemoveContinuousEffect(this);
- session.WorldPlayerEntity.GetComponent<EntityStats>().GetFluidEffect(EEntityFluidEffectType.Pace).AddContinuousEffect(this, -3f);
- hurt.SendChatMessage(session, null, $"<color=red>[Ability]</color> <color=#98FB98>Flash is on</color>");
- }
- hurt.SendChatMessage(session, null, $"<color=#FF7F00>[Ability]</color> <color=#98FB98>Aktywowano skakanie</color>");
- motor.GravityVector = new Vector3(0f, -15f, 0f);
- motor.FallDamageMultiplier = 0;
- }
- else
- {
- if (permission.UserHasPermission(session.SteamId.ToString(), "ezconsole.flash") && Convert.ToString(motor.GravityVector) == "(0.0, -25.0, 0.0)")
- {
- session.WorldPlayerEntity.GetComponent<EntityStats>().GetFluidEffect(EEntityFluidEffectType.Pace).RemoveContinuousEffect(this);
- session.WorldPlayerEntity.GetComponent<EntityStats>().GetFluidEffect(EEntityFluidEffectType.Pace).AddContinuousEffect(this, 3f);
- hurt.SendChatMessage(session, null, $"<color=#FF7F00>[Ability]</color> <color=#98FB98>Flash is on</color>");
- }
- hurt.SendChatMessage(session, null, $"<color=#FF7F00>[Rank]</color> <color=#FF6347>Wyłączono skakanie</color>");
- motor.GravityVector = new Vector3(0f, -25f, 0f);
- motor.FallDamageMultiplier = 0;
- }
- return;
- }
- private int IsLvl(PlayerSession session)
- {
- UserData con = (from x in Tops where x.SteamId == (ulong)session.SteamId select x).FirstOrDefault();
- int lvl = (int)con.Lvl;
- return lvl;
- }
- private void OnPlayerTakeDamage(PlayerSession session, EntityEffectSourceData dataSource)
- {
- string tmpName = GetNameOfObject(dataSource.EntitySource);
- if (tmpName == "" || tmpName.Contains("Creatures") || session == null) return;
- string KillerName = tmpName.Remove(tmpName.Length - 3);
- var session2 = getSession(KillerName);
- if (session2 == null) return;
- var p = Random.Range(1, 100);
- UserData con = (from x in Tops where x.SteamId == (ulong)session.SteamId select x).FirstOrDefault();
- UserData con2 = (from x in Tops where x.SteamId == (ulong)session2.SteamId select x).FirstOrDefault();
- int th1 = 0; int th2 = 0; int th3 = 0; int th4 = 0; int th5 = 0;
- int rg1 = 0; int rg2 = 0; int rg3 = 0; int rg4 = 0; int rg5 = 0;
- int dd1 = 0; int dd2 = 0; int dd3 = 0; int dd4 = 0; int dd5 = 0;
- int bonusdd = 0; int bonusrg = 0; int bonusth = 0;
- foreach (var cmd in Config["Abilities"] as Dictionary<string, object>)
- {
- if (cmd.Key == "Thorns1") th1 = (int)cmd.Value;
- if (cmd.Key == "Thorns2") th2 = (int)cmd.Value;
- if (cmd.Key == "Thorns3") th3 = (int)cmd.Value;
- if (cmd.Key == "Thorns4") th4 = (int)cmd.Value;
- if (cmd.Key == "Thorns5") th5 = (int)cmd.Value;
- }
- if (con2.Lvl >= rg1)
- {
- if (con2.Lvl >= rg1) bonusrg = 1;
- if (con2.Lvl >= rg2) bonusrg = 2;
- if (con2.Lvl >= rg3) bonusrg = 3;
- if (con2.Lvl >= rg4) bonusrg = 4;
- if (con2.Lvl >= rg5) bonusrg = 5;
- if (bonusrg >= p)
- {
- dataSource.Value = dataSource.Value * 2;
- Singleton<AlertManager>.Instance.GenericTextNotificationServer("\n Zadałeś podwójne obrażenia! \n", session2.Player);
- Singleton<AlertManager>.Instance.GenericTextNotificationServer($"\n {session2.Name} zadałeś podwójne obrażenia! \n", session.Player);
- }
- }
- if (con.Lvl >= dd1)
- {
- if (con.Lvl >= dd1) bonusdd = 2;
- if (con.Lvl >= dd2) bonusdd = 4;
- if (con.Lvl >= dd3) bonusdd = 6;
- if (con.Lvl >= dd4) bonusdd = 8;
- if (con.Lvl >= dd5) bonusdd = 10;
- if (bonusdd >= p)
- {
- dataSource.Value = 0;
- Singleton<AlertManager>.Instance.GenericTextNotificationServer("\n Uniknąłeś strzału! \n", session.Player);
- Singleton<AlertManager>.Instance.GenericTextNotificationServer($"\n {session.Name}\nuniknął strzału! \n", session2.Player);
- }
- }
- if (con.Lvl >= th1)
- {
- if (con.Lvl >= th1) bonusth = 1;
- if (con.Lvl >= th2) bonusth = 2;
- if (con.Lvl >= th3) bonusth = 3;
- if (con.Lvl >= th4) bonusth = 4;
- if (con.Lvl >= th5) bonusth = 5;
- var p3 = Random.Range(1, 100);
- if (bonusth >= p)
- {
- var effect = new EntityEffectFluid(EEntityFluidEffectType.Damage, EEntityEffectFluidModifierType.AddValuePure, dataSource.Value);
- var stats = session2.WorldPlayerEntity.GetComponent<EntityStats>();
- effect.Apply(stats);
- Singleton<AlertManager>.Instance.GenericTextNotificationServer("\n Odbiłeś obrażenia! \n", session.Player);
- Singleton<AlertManager>.Instance.GenericTextNotificationServer($"\n {session.Name} zadał obrażenia odwetowe kolcami! \n", session2.Player);
- }
- }
- }
- [ChatCommand("rank")]
- void cmdrankplayer(PlayerSession session, string command, string[] args)
- {
- int newlvl = 0;
- var motor = session.WorldPlayerEntity.GetComponent<CharacterMotorSimple>();
- EntityStats stats = session.WorldPlayerEntity.GetComponent<EntityStats>();
- CheckLvl(session);
- UserData con = (from x in Tops where x.SteamId == (ulong)session.SteamId select x).FirstOrDefault();
- string falldamage = "";
- string doublejump = "";
- string lst = "";
- string dodge = "";
- string rage = "";
- string thorns = "";
- int ls1 = 0;
- int ls2 = 0;
- int ls3 = 0;
- int ls4 = 0;
- int ls5 = 0;
- int dd1 = 0;
- int dd2 = 0;
- int dd3 = 0;
- int dd4 = 0;
- int dd5 = 0;
- int rg1 = 0;
- int rg2 = 0;
- int rg3 = 0;
- int rg4 = 0;
- int rg5 = 0;
- int th1 = 0;
- int th2 = 0;
- int th3 = 0;
- int th4 = 0;
- int th5 = 0;
- int oput = 0;
- int nextlvl = con.Lvl + 1;
- int nflvl = 0;
- int nfdlvl = 0;
- foreach (var cmd in Config["Levels"] as Dictionary<string, object>)
- {
- if (cmd.Key == nextlvl.ToString() || cmd.Key == "01" && nextlvl == 1 || cmd.Key == "02" && nextlvl == 2 || cmd.Key == "03" && nextlvl == 3 ||
- cmd.Key == "04" && nextlvl == 4 || cmd.Key == "05" && nextlvl == 5 || cmd.Key == "06" && nextlvl == 6 ||
- cmd.Key == "07" && nextlvl == 7 || cmd.Key == "08" && nextlvl == 8 || cmd.Key == "09" && nextlvl == 9) oput = (int)cmd.Value;
- }
- foreach (var cmd in Config["Abilities"] as Dictionary<string, object>)
- {
- if (cmd.Key == "Thorns1") th1 = (int)cmd.Value;
- if (cmd.Key == "Thorns2") th2 = (int)cmd.Value;
- if (cmd.Key == "Thorns3") th3 = (int)cmd.Value;
- if (cmd.Key == "Thorns4") th4 = (int)cmd.Value;
- if (cmd.Key == "Thorns5") th5 = (int)cmd.Value;
- }
- if (con.Lvl < ls1)
- {
- lst = $" [<color=#FF6347>c {ls1}lvl.</color>]";
- }
- else
- {
- if (con.Lvl >= ls1) lst = $"<color=#98FB98>[1 lvl.]</color>";
- if (con.Lvl >= ls2) lst = $"<color=#98FB98>[2 lvl.]</color>";
- if (con.Lvl >= ls3) lst = $"<color=#98FB98>[3 lvl.]</color>";
- if (con.Lvl >= ls4) lst = $"<color=#98FB98>[4 lvl.]</color>";
- if (con.Lvl >= ls5) lst = $"<color=#98FB98>[5 lvl.]</color>";
- }
- if (con.Lvl < dd1)
- {
- dodge = $" [<color=#FF6347>c {dd1}lvl.</color>]";
- }
- else
- {
- if (con.Lvl >= dd1) dodge = $"<color=#98FB98>[1 lvl.]</color>";
- if (con.Lvl >= dd2) dodge = $"<color=#98FB98>[2 lvl.]</color>";
- if (con.Lvl >= dd3) dodge = $"<color=#98FB98>[3 lvl.]</color>";
- if (con.Lvl >= dd4) dodge = $"<color=#98FB98>[4 lvl.]</color>";
- if (con.Lvl >= dd5) dodge = $"<color=#98FB98>[5 lvl.]</color>";
- }
- if (con.Lvl < rg1)
- {
- rage = $" [<color=#FF6347>c {rg1}lvl.</color>]";
- }
- else
- {
- if (con.Lvl >= rg1) rage = $"<color=#98FB98>[1 lvl.]</color>";
- if (con.Lvl >= rg2) rage = $"<color=#98FB98>[2 lvl.]</color>";
- if (con.Lvl >= rg3) rage = $"<color=#98FB98>[3 lvl.]</color>";
- if (con.Lvl >= rg4) rage = $"<color=#98FB98>[4 lvl.]</color>";
- if (con.Lvl >= rg5) rage = $"<color=#98FB98>[5 lvl.]</color>";
- }
- if (con.Lvl < th1)
- {
- thorns = $" [<color=#FF6347>c {th1}lvl.</color>]";
- }
- else
- {
- if (con.Lvl >= th1) thorns = $"<color=#98FB98>[1 lvl.]</color>";
- if (con.Lvl >= th2) thorns = $"<color=#98FB98>[2 lvl.]</color>";
- if (con.Lvl >= th3) thorns = $"<color=#98FB98>[3 lvl.]</color>";
- if (con.Lvl >= th4) thorns = $"<color=#98FB98>[4 lvl.]</color>";
- if (con.Lvl >= th5) thorns = $"<color=#98FB98>[5 lvl.]</color>";
- }
- if (con.Lvl < nfdlvl)
- {
- falldamage = $"[<color=#FF6347>{nfdlvl}lvl.</color>]";
- }
- else if (Convert.ToInt64(motor.FallDamageMultiplier) == 0)
- {
- falldamage = "[<color=#98FB98>on</color>]";
- }
- else
- {
- falldamage = "[<color=#FF6347>off</color>]";
- }
- if (con.Lvl < nflvl)
- {
- doublejump = $"[<color=#FF6347>c {nflvl}lvl.</color>]";
- }
- else if (Convert.ToString(motor.GravityVector) == "(0.0, -15.0, 0.0)")
- {
- doublejump = "[<color=#98FB98>on</color>]";
- }
- else
- {
- doublejump = "[<color=#FF6347>off</color>]";
- }
- if (args.Length == 0)
- {
- hurt.SendChatMessage(session, null, $"<color=#FF6347>--------------------------------------------------</color>");
- hurt.SendChatMessage(session, null, $"<color=#FF6347>[❧]</color> <color=#FFA07A>Poziom:</color> <b>{con.Lvl}</b> [{con.Exp}/{oput}]");
- hurt.SendChatMessage(session, null, $"<color=#FF6347>[◘]</color> <color=#20B2AA>Pojemność:</color> +{con.Lvl / 2} | <color=#3CB371>Prędkość:</color> +{con.Lvl}% |");
- hurt.SendChatMessage(session, null, $"<color=#FF6347>[✚]</color> <color=#FFA500>Premia do kopania:</color> {con.Lvl}%");
- hurt.SendChatMessage(session, null, $"<color=#FF6347>[✪]</color> <color=#FFA07A>Zdolności:</color> Kopanie {falldamage} | Ciernie {thorns}");
- hurt.SendChatMessage(session, null, $"Wampiryzm {lst} | DoubleJump {doublejump} |");
- hurt.SendChatMessage(session, null, $"Wściekłość {rage} | Unik {dodge} ");
- hurt.SendChatMessage(session, null, $"<color=#FF6347>------------------- /rank help ------------------</color>");
- return;
- }
- if (args[0] == "help")
- {
- hurt.SendChatMessage(session, null, $"\n");
- hurt.SendChatMessage(session, null, $"<color=#FF9A47>---------=== Rank Help ===---------</color>");
- hurt.SendChatMessage(session, null, $"<color=#FF6347>[✚]</color><color=#FFA07A> Więcej zdobywa się w klanie!</color>");
- hurt.SendChatMessage(session, null, $"<color=#FF6347>[✚]</color><color=#FFA07A> Poziom:</color> <i>/lvl</i>");
- hurt.SendChatMessage(session, null, $"<color=#FF6347>[✚]</color><color=#FFA07A> Topka:</color> <i>/top</i>");
- hurt.SendChatMessage(session, null, $"<color=#FF6347>[✚]</color><color=#FFA07A> Statystyki:</color> <i>/stats</i>");
- hurt.SendChatMessage(session, null, $"<color=#FF6347>[✚]</color><color=#FFA07A> DoubleJump:</color> <i>/jump on</i> <color=#FFA07A>|</color> <i>/jump off</i>");
- hurt.SendChatMessage(session, null, $"<color=#FF9A47>--------===| ========= |===--------</color>");
- }
- else
- {
- return;
- }
- }
- [ChatCommand("lvl")]
- void cmdlvlplayer(PlayerSession session, string command)
- {
- int newlvl = 0;
- var motor = session.WorldPlayerEntity.GetComponent<CharacterMotorSimple>();
- EntityStats stats = session.WorldPlayerEntity.GetComponent<EntityStats>();
- CheckLvl(session);
- UserData con = (from x in Tops where x.SteamId == (ulong)session.SteamId select x).FirstOrDefault();
- string falldamage = "";
- string doublejump = "";
- string lst = "";
- string dodge = "";
- string rage = "";
- string thorns = "";
- int ls1 = 0;
- int ls2 = 0;
- int ls3 = 0;
- int ls4 = 0;
- int ls5 = 0;
- int dd1 = 0;
- int dd2 = 0;
- int dd3 = 0;
- int dd4 = 0;
- int dd5 = 0;
- int rg1 = 0;
- int rg2 = 0;
- int rg3 = 0;
- int rg4 = 0;
- int rg5 = 0;
- int th1 = 0;
- int th2 = 0;
- int th3 = 0;
- int th4 = 0;
- int th5 = 0;
- int oput = 0;
- int nextlvl = con.Lvl + 1;
- int nflvl = 0;
- int nfdlvl = 0;
- foreach (var cmd in Config["Levels"] as Dictionary<string, object>)
- {
- if (cmd.Key == nextlvl.ToString() || cmd.Key == "01" && nextlvl == 1 || cmd.Key == "02" && nextlvl == 2 || cmd.Key == "03" && nextlvl == 3 ||
- cmd.Key == "04" && nextlvl == 4 || cmd.Key == "05" && nextlvl == 5 || cmd.Key == "06" && nextlvl == 6 ||
- cmd.Key == "07" && nextlvl == 7 || cmd.Key == "08" && nextlvl == 8 || cmd.Key == "09" && nextlvl == 9) oput = (int)cmd.Value;
- }
- hurt.SendChatMessage(session, null, $"<color=#00FF00>--------------------------------------------------</color>");
- hurt.SendChatMessage(session, null, $"<color=#7093DB>|INFO|</color> <color=red>Poziom:</color> <b>{con.Lvl}</b> [{con.Exp}/{oput}]");
- hurt.SendChatMessage(session, null, $"<color=#00FF00>--------------------------------------------------</color>");
- }
- [ChatCommand("top")]
- void cmdtopyolo(PlayerSession session, string command)
- {
- hurt.SendChatMessage(session, null, "<color=#3299CC>♔ Topka ♔</color>");
- var TopPlayer = (from x in Tops select x).OrderByDescending(x => x.Kills).Take(1);
- foreach (var top in TopPlayer)
- {
- hurt.SendChatMessage(session, null, $"<color=#3299CC>[✪] Zabójca:</color> {top.Name} ({top.Kills} zabić)");
- }
- var TopAnimal = (from x in Tops select x).OrderByDescending(x => x.KillsAnimal).Take(1);
- foreach (var top in TopAnimal)
- {
- hurt.SendChatMessage(session, null, $"<color=#3299CC>[✪] Zwierzęta:</color> {top.Name} ({top.KillsAnimal} upolował zwierząt)");
- }
- var TopOre = (from x in Tops select x).OrderByDescending(x => x.Ore).Take(1);
- foreach (var top in TopOre)
- {
- hurt.SendChatMessage(session, null, $"<color=#3299CC>[✪] Surowce:</color> {top.Name} ({top.Ore} punkty)");
- }
- var TopWood = (from x in Tops select x).OrderByDescending(x => x.Wood).Take(1);
- foreach (var top in TopWood)
- {
- hurt.SendChatMessage(session, null, $"<color=#3299CC>[✪] Drewno:</color> {top.Name} ({top.Wood} punkty)");
- }
- }
- [ChatCommand("stats")]
- void cmdtopstatsyolo(PlayerSession session, string command)
- {
- hurt.SendChatMessage(session, null, "<color=#FF7F00><b>✌ Statystyki ✌</b></color>");
- var TopOnline = (from x in Tops select x).OrderByDescending(x => x.TimeOnline);
- int i4 = 0;
- foreach (var top in TopOnline)
- {
- i4++;
- if (top.Name == session.Name)
- {
- int onl = (Convert.ToInt32(Regex.Replace(top.TimeOnline, @"[^\d]+", "")));
- hurt.SendChatMessage(session, null, $"<color=#FF7256>[✪] Spędzony czas na serwerze: {onl} godzin.</color> ({i4} miejsce)");
- }
- }
- var TopPlayer = (from x in Tops select x).OrderByDescending(x => x.Kills);
- int i = 0;
- foreach (var top in TopPlayer)
- {
- i++;
- if (top.Name == session.Name) hurt.SendChatMessage(session, null, $"<color=#FF7256>[✪] Zabójstwa: {top.Kills}</color> ({i} miejsce)");
- }
- int i2 = 0;
- var TopAnimal = (from x in Tops select x).OrderByDescending(x => x.KillsAnimal);
- foreach (var top in TopAnimal)
- {
- i2++;
- if (top.Name == session.Name) hurt.SendChatMessage(session, null, $"<color=#FF7256>[✪] Upolowane zwierzęta: {top.KillsAnimal}</color> ({i2} miejsce)");
- }
- int i5 = 0;
- var TopOre = (from x in Tops select x).OrderByDescending(x => x.Ore);
- foreach (var top in TopOre)
- {
- i5++;
- if (top.Name == session.Name) hurt.SendChatMessage(session, null, $"<color=#FF7256>[✪] Wydobyte surowce(exp): {top.Ore}</color> ({i5} miejsce)");
- }
- int i6 = 0;
- var TopWood = (from x in Tops select x).OrderByDescending(x => x.Wood);
- foreach (var top in TopWood)
- {
- i6++;
- if (top.Name == session.Name) hurt.SendChatMessage(session, null, $"<color=#FF7256>[✪] Wykopane drewno(exp): {top.Wood}</color> ({i6} miejsce)");
- }
- }
- private void OnPlayerDisconnected(PlayerSession session)
- {
- var check = (from x in Tops where x.SteamId == (ulong)session.SteamId select x).Count();
- if (check == 0)
- {
- Tops.Add(new UserData((ulong)session.SteamId, Convert.ToString(session.Name), Convert.ToString(session.Player.ipAddress), Convert.ToString(DateTime.Now), Convert.ToString("0"), 0, 0, 0, 0, 0, 0, 0, 0));
- return;
- }
- UserData dis = (from x in Tops where x.SteamId == (ulong)session.SteamId select x).FirstOrDefault();
- DateTime date2 = DateTime.Now;
- int onl = Convert.ToInt32(date2.Subtract(DateTime.Parse(dis.TimeLastConnect)).TotalHours);
- onl = (Convert.ToInt32(Regex.Replace(dis.TimeOnline, @"[^\d]+", "")) + onl);
- if (onl < 0) onl = 0;
- dis.TimeOnline = Convert.ToString(onl) + " godzin.";
- dis.TimeLastConnect = Convert.ToString(DateTime.Now);
- }
- private void OnPlayerDeath(PlayerSession session, EntityEffectSourceData dataSource)
- {
- string name = session.Name;
- string tmpName = GetNameOfObject(dataSource.EntitySource);
- UserData pdeath = (from x in Tops where x.SteamId == (ulong)session.SteamId select x).FirstOrDefault();
- if (tmpName.Contains("Creatures"))
- {
- pdeath.Deaths = pdeath.Deaths + 1;
- }
- else
- {
- if (tmpName == "Machines/Medusa Vine") return;
- var KillerName = tmpName.Remove(tmpName.Length - 3);
- UserData con = (from x in Tops where x.SteamId == (ulong)getSession(KillerName).SteamId select x).FirstOrDefault();
- int ls1 = 0;
- int ls2 = 0;
- int ls3 = 0;
- int ls4 = 0;
- int ls5 = 0;
- foreach (var cmd in Config["Abilities"] as Dictionary<string, object>)
- {
- if (cmd.Key == "LifeSteal1") ls1 = (int)cmd.Value;
- if (cmd.Key == "LifeSteal2") ls2 = (int)cmd.Value;
- if (cmd.Key == "LifeSteal3") ls3 = (int)cmd.Value;
- if (cmd.Key == "LifeSteal4") ls4 = (int)cmd.Value;
- if (cmd.Key == "LifeSteal5") ls5 = (int)cmd.Value;
- }
- if (con.Lvl >= ls1)
- {
- float hl = 5f;
- if (con.Lvl >= ls2)
- {
- hl = 10f;
- }
- else if (con.Lvl >= ls3)
- {
- hl = 15f;
- }
- else if (con.Lvl >= ls4)
- {
- hl = 20f;
- }
- else if (con.Lvl >= ls5)
- {
- hl = 25f;
- }
- var Health = getSession(KillerName).WorldPlayerEntity.GetComponent<EntityStats>().GetFluidEffect(EEntityFluidEffectType.Health);
- EntityStats stats = getSession(KillerName).WorldPlayerEntity.GetComponent<EntityStats>();
- stats.GetFluidEffect(EEntityFluidEffectType.Health).SetValue(Health.GetValue() + hl);
- }
- Singleton<AlertManager>.Instance.GenericTextNotificationServer("❧ EXP: +3", getSession(KillerName).Player);
- con.Exp += 3;
- pdeath.Deaths += 1;
- con.Kills += 1;
- }
- return;
- }
- private PlayerSession getSession(string identifier)
- {
- var sessions = GameManager.Instance.GetSessions();
- PlayerSession session = null;
- foreach (var i in sessions)
- {
- if (i.Value.Name.ToLower().Contains(identifier.ToLower()) || identifier.Equals(i.Value.SteamId.ToString()))
- {
- session = i.Value;
- break;
- }
- }
- return session;
- }
- void LoadData()
- {
- Tops = Interface.Oxide.DataFileSystem.ReadObject<List<UserData>>("UserData");
- }
- void Unload()
- {
- SaveData();
- }
- void SaveData()
- {
- Interface.Oxide.DataFileSystem.WriteObject("UserData", Tops);
- }
- string GetNameOfObject(UnityEngine.GameObject obj)
- {
- var ManagerInstance = GameManager.Instance;
- return ManagerInstance.GetDescriptionKey(obj);
- }
- #region [LISTS]
- public List<UserData> Tops = new List<UserData>();
- public class UserData
- {
- public UserData(ulong SteamId, string Name, string Ip, string TimeLastConnect, string TimeOnline, int Kills, int Deaths, int KillsAnimal, int Suicide, int Wood, int Ore, int Lvl, int Exp)
- {
- this.SteamId = SteamId;
- this.Name = Name;
- this.Ip = Ip;
- this.TimeLastConnect = TimeLastConnect;
- this.TimeOnline = TimeOnline;
- this.Kills = Kills;
- this.Deaths = Deaths;
- this.KillsAnimal = KillsAnimal;
- this.Suicide = Suicide;
- this.Wood = Wood;
- this.Ore = Ore;
- this.Lvl = Lvl;
- this.Exp = Exp;
- }
- public ulong SteamId { get; set; }
- public string Name { get; set; }
- public string Ip { get; set; }
- public string TimeLastConnect { get; set; }
- public string TimeOnline { get; set; }
- public int Kills { get; set; }
- public int Deaths { get; set; }
- public int KillsAnimal { get; set; }
- public int Suicide { get; set; }
- public int Wood { get; set; }
- public int Ore { get; set; }
- public int Lvl { get; set; }
- public int Exp { get; set; }
- }
- #endregion
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement