예제 #1
0
        /// <summary>
        /// Sync Pin with clients via the server
        /// </summary>
        public static void RPC_VPlusMapPinSync(long sender, ZPackage mapPinPkg)
        {
            if (ZNet.m_isServer) //Server
            {
                if (sender == ZRoutedRpc.instance.GetServerPeerID())
                {
                    return;
                }

                if (mapPinPkg == null)
                {
                    return;
                }

                foreach (ZNetPeer peer in ZRoutedRpc.instance.m_peers)
                {
                    if (peer.m_uid != sender)
                    {
                        ZRoutedRpc.instance.InvokeRoutedRPC(peer.m_uid, "VPlusMapPinSync", new object[] { mapPinPkg });
                    }
                }

                ZLog.Log($"Sent map pin to all clients");
                //VPlusAck.SendAck(sender);
            }
            else //Client
            {
                if (sender != ZRoutedRpc.instance.GetServerPeerID())
                {
                    return;                                                  //Only bother if it's from the server.
                }
                if (mapPinPkg == null)
                {
                    ZLog.LogWarning("Warning: Got empty map pin package from server.");
                    return;
                }
                long   pinSender  = mapPinPkg.ReadLong();
                string senderName = mapPinPkg.ReadString();
                if (senderName != Player.m_localPlayer.GetPlayerName() && pinSender != ZRoutedRpc.instance.m_id)
                {
                    ZLog.Log("Checking sent pin");
                    Vector3 pinPos    = mapPinPkg.ReadVector3();
                    int     pinType   = mapPinPkg.ReadInt();
                    string  pinName   = mapPinPkg.ReadString();
                    bool    keepQuiet = mapPinPkg.ReadBool();
                    if (!Minimap.instance.HaveSimilarPin(pinPos, (Minimap.PinType)pinType, pinName, true))
                    {
                        Minimap.PinData addedPin = Minimap.instance.AddPin(pinPos, (Minimap.PinType)pinType, pinName, true, false);
                        if (!keepQuiet)
                        {
                            MessageHud.instance.ShowMessage(MessageHud.MessageType.Center, $"Received map pin {pinName} from {senderName}!",
                                                            0, Minimap.instance.GetSprite((Minimap.PinType)pinType));
                        }
                        ZLog.Log($"I got pin named {pinName} from {senderName}!");
                    }
                }
                //Send Ack
                //VPlusAck.SendAck(sender);
            }
        }
예제 #2
0
 private void MinimapPatcher_PinAdded(object sender, Minimap.PinData e)
 {
     if (!_addedPins.Any(pin => pin.m_pos == e.m_pos))
     {
         _addedPins.Add(e);
     }
 }
 public static bool SimilarPinExists(
     Vector3 pos,
     Minimap.PinType type,
     List <Minimap.PinData> pins,
     string aName,
     Sprite aIcon,
     out Minimap.PinData match)
 {
     foreach (Minimap.PinData pin in pins)
     {
         if (pos == pin.m_pos)
         {
             match = pin;
             return(true);
         }
         else
         //Mod.Log.LogInfo(string.Format("[AMP] Checking Distance between Pins {0} & {1}: {2}", aName, pin.m_name, (double)Utils.DistanceXZ(pos, pin.m_pos)));
         if ((double)Utils.DistanceXZ(pos, pin.m_pos) < pinOverlapDistance.Value &&
             type == pin.m_type &&
             (aName == pin.m_name || aIcon == pin.m_icon))
         {
             //Mod.Log.LogInfo(string.Format("[AMP] Duplicate pins for {0} found", aName));
             match = pin;
             return(true);
         }
     }
     match = null;
     return(false);
 }
예제 #4
0
 static void Prefix(ZNetView ___m_nview)
 {
     if (___m_nview)
     {
         if (___m_nview.GetPrefabName() == "portal_wood")
         {
             if (ZNet.instance.IsServer())
             {
                 ZDO             temp_zdo  = ___m_nview.GetZDO();
                 Minimap.PinData temp_data = Minimap.instance.AddPin(___m_nview.transform.position, portal_pin_type, GetLocalizedString(configPortalNamePrefix.Value) + "unnamed", false, false);
                 tp_list.Add(temp_zdo, temp_data);
                 ZDOMan.instance.ForceSendZDO(temp_zdo.m_uid);
             }
             else
             {
                 ZDO temp_zdo = ___m_nview.GetZDO();
                 var list     = (List <int>)GetInstanceField(ZDOMan.instance, "m_peers");
                 logger.LogWarning("portal placed ");
                 logger.LogWarning("m_peers count: " + list.Count);
                 ZDOMan.instance.ForceSendZDO(temp_zdo.m_uid);
                 //ZRoutedRpc.instance.InvokeRoutedRPC("RequestPortalZDOs", new object[] { new ZPackage() });
             }
         }
     }
 }
예제 #5
0
        private static bool Minimap_OnMapMiddleClick(UIInputHandler handler, Minimap __instance, float ___m_removeRadius, float ___m_largeZoom)
        {
            Vector3 pos = ScreenToWorldPoint(__instance, Input.mousePosition);

            if (Settings.ShareIndividualPin.Value)
            {
                if (Settings.ShareIndividualPinRequireKey.Value)
                {
                    bool validKey = Enum.TryParse(Settings.ShareIndividualPinKey.Value, out KeyCode key);
                    if (!validKey || !Input.GetKey(key))
                    {
                        return(true);
                    }
                }

                Minimap.PinData closestPin = GetClosestPin(__instance, pos, ___m_removeRadius * (___m_largeZoom * 2f));
                if (closestPin != null)
                {
                    Plugin.SendPin(closestPin, closestPin.m_name);

                    Plugin.AddString($"Shared {closestPin.m_name}");
                    return(Settings.ShowPingWhenSharingIndividualPin.Value);
                }
            }

            return(true);
        }
예제 #6
0
 private void MinimapPatcher_PinRemoved(object sender, Minimap.PinData e)
 {
     Minimap.PinData pin = _addedPins.FirstOrDefault(p => p.m_pos == e.m_pos);
     if (pin != null)
     {
         _addedPins.Remove(pin);
     }
 }
예제 #7
0
 private static bool Minimap_RemovePin(Minimap.PinData pin, Minimap.PinData ___m_deathPin)
 {
     if (Settings.PersistentDeathMarkers.Value && ___m_deathPin == pin)
     {
         return(false);
     }
     return(true);
 }
예제 #8
0
 // ReSharper disable once InconsistentNaming
 private static void Postfix(Minimap __instance, Minimap.PinData pin)
 {
     // var clientPin = UtilityPin.GetClientPin(pin);
     //
     // if (clientPin == null) return;
     //
     // RemovePinFromServer(clientPin);
 }
예제 #9
0
 private static bool HaveSimilarPin(List <Minimap.PinData> pinData, Minimap.PinData sp)
 {
     return(pinData.Any(pin =>
     {
         var dist = DistanceXZ(sp.m_pos, pin.m_pos);
         return dist < Settings.MapSettings.SkipPinRange.Value;
     }));
 }
예제 #10
0
 public static PinData ConvertPin(Minimap.PinData pin)
 {
     return(new PinData {
         Name = pin.m_name,
         Pos = pin.m_pos,
         Type = pin.m_type,
         Checked = pin.m_checked
     });
 }
예제 #11
0
 public static bool LocalPinIsDupe(Minimap.PinData pin)
 {
     foreach (var serverpin in  ExplorationDatabase.ClientPins)
     {
         if (ArePinsDupes(pin, serverpin, Store.GetDuplicatePinRadius()))
         {
             return(true);
         }
     }
     return(false);
 }
예제 #12
0
 public static void AddPin(ref Minimap __instance)
 {
     Minimap.PinType pintype  = iconSelected.value == 4 ? Minimap.PinType.Icon4 : (Minimap.PinType)iconSelected.value;
     Minimap.PinData addedPin = __instance.AddPin(pinPos, pintype, pinName.text, true, false);
     if (Configuration.Current.Map.shareablePins && sharePin.isOn && !Configuration.Current.Map.shareAllPins)
     {
         VPlusMapPinSync.SendMapPinToServer(addedPin);
     }
     pinEditorPanel.SetActive(false);
     __instance.m_wasFocused = false;
 }
예제 #13
0
 public static PinData GetClientPin(Minimap.PinData needle)
 {
     foreach (var pin in ExplorationDatabase.ClientPins)
     {
         if (ArePinsEqual(pin, needle))
         {
             return(pin);
         }
     }
     return(null);
 }
예제 #14
0
        /// <summary>
        ///     Create PinData objects without adding them to the map directly
        /// </summary>
        public static Minimap.PinData CreatePinData(Vector3 pos, Minimap.PinType type, string name, bool save, bool isChecked)
        {
            var pinData = new Minimap.PinData();

            pinData.m_type    = type;
            pinData.m_name    = name;
            pinData.m_pos     = pos;
            pinData.m_icon    = Minimap.instance.GetSprite(type);
            pinData.m_save    = save;
            pinData.m_checked = isChecked;
            return(pinData);
        }
예제 #15
0
            // ReSharper disable once InconsistentNaming
            private static void Postfix(Minimap __instance, Minimap.PinData ___m_namePin)
            {
                if (CurrentPin == null)
                {
                    return;
                }

                if (___m_namePin == null)
                {
                    SendPinToServer(CurrentPin);
                    CurrentPin = null;
                }
            }
예제 #16
0
 public static Minimap.PinData CreatePin(
     Vector3 pos,
     Minimap.PinType type,
     string name,
     bool save,
     bool isChecked)
 {
     Minimap.PinData pinData = new Minimap.PinData();
     pinData.m_type    = type;
     pinData.m_name    = name;
     pinData.m_pos     = pos;
     pinData.m_save    = save;
     pinData.m_checked = isChecked;
     return(pinData);
 }
        private static bool ShouldPinRender(Minimap.PinData pin)
        {
            if (filteredPins == null || filteredPins.Count == 0)
            {
                return(true);
            }

            if (!filteredPins.Contains(pin.m_type.ToString()))
            {
                return(true);
            }

            return(false);
            //return (uint)((IEnumerable<string>)filteredPins).Count(filter => !pin.m_type.ToString().ToLower().Replace(' ', '_').Contains(filter)) > 0U;
        }
        public static Minimap.PinData GetNearestPin(Vector3 pos, float radius, List <Minimap.PinData> pins)
        {
            Minimap.PinData pinData = null;
            float           num1    = 999999f;

            foreach (Minimap.PinData pin in pins)
            {
                float num2 = Utils.DistanceXZ(pos, pin.m_pos);
                if (num2 < radius && (num2 < num1 || pinData == null))
                {
                    pinData = pin;
                    num1    = num2;
                    //Log.LogInfo(string.Format("[AMP] Nearest Pin Type = {0} at {1}", pinData.m_type, pinData.m_pos));
                }
            }
            return(pinData);
        }
예제 #19
0
 private static void Postfix(ref Minimap __instance, ref Minimap.PinData __result)
 {
     if (Configuration.Current.Map.IsEnabled && Configuration.Current.Map.shareAllPins)
     {
         if (shareablePins.Contains(__result.m_type))
         {
             if (__instance.m_mode != Minimap.MapMode.Large)
             {
                 VPlusMapPinSync.SendMapPinToServer(__result, true);
             }
             else
             {
                 VPlusMapPinSync.SendMapPinToServer(__result);
             }
         }
     }
 }
예제 #20
0
            // ReSharper disable once InconsistentNaming
            private static void Postfix(Minimap __instance, ref Minimap.PinData __result, Vector3 pos, float radius)
            {
                if (!Store.IsSharingPin())
                {
                    return;
                }

                LatestClosestPin = __result;

                var pinData = (PinData)null;
                var num1    = 999999f;

                foreach (var p in ExplorationDatabase.ClientPins)
                {
                    var num2 = Utils.DistanceXZ(pos, p.Pos);
                    if ((double)num2 < (double)radius && ((double)num2 < (double)num1 || pinData == null))
                    {
                        pinData = p;
                        num1    = num2;
                    }
                }

                if (pinData == null)
                {
                    return;
                }

                var pin = UtilityPin.GetMapPin(pinData);

                if (__result == null)
                {
                    __result         = pin;
                    LatestClosestPin = pin;
                    return;
                }

                var distance = Utils.DistanceXZ(pos, __result.m_pos);

                if (distance > num1)
                {
                    __result         = pin;
                    LatestClosestPin = pin;
                }
            }
        private static bool Minimap_OMLC(
            Minimap __instance,
            ref List <Minimap.PinData> ___m_pins)
        {
            ZLog.Log("[AMP] Left click");
            Vector3 worldPoint = ScreenToWorldPoint(__instance, Input.mousePosition);

            //Mod.Log.LogInfo(string.Format("WorldPoint = {0}", worldPoint));
            Minimap.PinData closestPin = Mod.GetNearestPin(worldPoint, 5, ___m_pins);

            if (closestPin == null)
            {
                //Mod.Log.LogInfo("[AMP] Closest pin is null");
                return(true);
            }

            closestPin.m_checked = !closestPin.m_checked;
            return(false);
        }
예제 #22
0
        public static void SendPinToServer(Minimap.PinData pin, bool deletePin = true)
        {
            if (!Store.IsSharingPin())
            {
                return;
            }

            var convertedPin = UtilityPin.ConvertPin(pin);
            var data         = ExplorationDatabase.PackPin(convertedPin);

            pin.m_save = !deletePin && pin.m_save;
            ExplorationDatabase.ClientPins.Add(convertedPin);

            if (!_ZNet.IsServer(_ZNet._instance))
            {
                _ZNet.GetServerRPC(_ZNet._instance).Invoke("OnClientAddPin", data);
            }
            else
            {
                OnClientAddPin(null, data);
            }
        }
예제 #23
0
파일: Plugin.cs 프로젝트: jsza/ValheimMods
 public static void SendPin(Minimap.PinData pin, string text)
 {
     if (pin == null)
     {
         return;
     }
     if (pin.m_type == Minimap.PinType.Player)
     {
         return;
     }
     if (pin.m_type == Minimap.PinType.Ping)
     {
         return;
     }
     if (pin.m_type == Minimap.PinType.Bed)
     {
         return;
     }
     if (Minimap_Patch.cartPins.Contains(pin))
     {
         return;
     }
     if (Minimap_Patch.boatPins.Contains(pin))
     {
         return;
     }
     if (pin.m_type == Minimap.PinType.Death)
     {
         if (!Settings.ShareDeathMarkers.Value)
         {
             return;
         }
         if (pin.m_name == string.Empty)
         {
             text = Player.m_localPlayer.GetPlayerName() + "'s Gravestone";
         }
     }
     ZRoutedRpc.instance.InvokeRoutedRPC(ZRoutedRpc.Everybody, "PlayerAddedPin", pin.m_pos, pin.m_type.ToString(), text, Player.m_localPlayer.GetPlayerName());
 }
        private static bool Minimap_OMRC(
            Minimap __instance,
            ref List <Minimap.PinData> ___m_pins)
        {
            ZLog.Log("[AMP] Right click");
            Vector3 worldPoint = ScreenToWorldPoint(__instance, Input.mousePosition);

            //Mod.Log.LogInfo(string.Format("WorldPoint = {0}", worldPoint));
            Minimap.PinData closestPin = Mod.GetNearestPin(worldPoint, 5, ___m_pins);

            //Mod.Log.LogInfo(string.Format("Pin Name - {0}, Pin Icon - {1}, Pin Type {2}", closestPin.m_name, closestPin.m_icon.name, closestPin.m_type));

            if (closestPin == null || closestPin.m_icon.name == "mapicon_start")
            {
                return(true);
            }

            __instance.RemovePin(closestPin);
            Mod.addedPinLocs.Remove(closestPin.m_pos);
            Mod.autoPins.Remove(closestPin);
            Mod.remPinDict.Remove(closestPin.m_pos);
            return(false);
        }
예제 #25
0
        /// <summary>
        /// Send the pin, attach client ID
        /// </summary>
        public static void SendMapPinToServer(Minimap.PinData pinData, bool keepQuiet = false)
        {
            ZLog.Log("-------------------- SENDING VPLUS MapPin DATA");
            ZPackage pkg = new ZPackage();

            pkg.Write(ZRoutedRpc.instance.m_id); // Sender ID
            if (keepQuiet)
            {
                pkg.Write(""); // Loaded in
            }
            else
            {
                pkg.Write(Player.m_localPlayer.GetPlayerName()); // Sender Name
            }
            pkg.Write(pinData.m_pos);                            // Pin position
            pkg.Write((int)pinData.m_type);                      // Pin type
            pkg.Write(pinData.m_name);                           // Pin name
            pkg.Write(keepQuiet);                                // Don't shout

            ZRoutedRpc.instance.InvokeRoutedRPC(ZRoutedRpc.instance.GetServerPeerID(), "VPlusMapPinSync", new object[] { pkg });

            ZLog.Log($"Sent map pin {pinData.m_name} to the server");
        }
예제 #26
0
        public static ZDO GetClosestTP()
        {
            logger.LogWarning("GetClosestTP");
            MethodInfo dynMethod = Minimap.instance.GetType().GetMethod("ScreenToWorldPoint", BindingFlags.NonPublic | BindingFlags.Instance);
            Vector3    pos       = (Vector3)dynMethod.Invoke(Minimap.instance, new object[] { Input.mousePosition });

            Minimap.PinData pinData = null;
            ZDO             zdo     = null;
            float           zoom    = GetMinimapLargeZoom() * 2f * 128f * 2f;
            float           num     = 999999f;

            foreach (KeyValuePair <ZDO, Minimap.PinData> entry in tp_list)
            {
                float num2 = Utils.DistanceXZ(pos, entry.Value.m_pos);
                if (num2 < zoom && (num2 < num || pinData == null))
                {
                    pinData = entry.Value;
                    zdo     = entry.Key;
                    num     = num2;
                }
            }
            return(zdo);
        }
예제 #27
0
        public static void ResetPins()
        {
            tplist  = new List <ZDO>();
            tp_list = new Dictionary <ZDO, Minimap.PinData>();
            ZDOMan.instance.GetAllZDOsWithPrefab(portal_name, tplist);
            List <Minimap.PinData> m_pins = (List <Minimap.PinData>)GetInstanceField(Minimap.instance, "m_pins");

            foreach (Minimap.PinData item in m_pins.ToList())
            {
                if (item.m_type == portal_pin_type)
                {
                    Minimap.instance.RemovePin(item);
                }
            }
            foreach (ZDO item in tplist)
            {
                Minimap.PinData temp = Minimap.instance.AddPin(item.GetPosition(), portal_pin_type, GetLocalizedString(configPortalNamePrefix.Value) + item.GetString("tag"), false, false);
                tp_list.Add(item, temp);
                if (ZNet.instance.IsServer())
                {
                    ZDOMan.instance.ForceSendZDO(item.m_uid);
                }
            }
        }
예제 #28
0
 public static void findLoc()
 {
     Game.instance.DiscoverClosestLocation("Crypt4", Player.m_localPlayer.transform.position, "test", 1);
     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 == "");
     ZoneSystem.instance.FindClosestLocation("Crypt4", Player.m_localPlayer.transform.position, out dbginsa);
 }
예제 #29
0
파일: Plugin.cs 프로젝트: jsza/ValheimMods
 public static bool SimilarPinExists(Vector3 pos, Minimap.PinType type, List <Minimap.PinData> pins, out Minimap.PinData match)
 {
     foreach (Minimap.PinData pinData in pins)
     {
         if (Utils.DistanceXZ(pos, pinData.m_pos) < Settings.SharedPinOverlapDistance.Value && type == pinData.m_type)
         {
             match = pinData;
             return(true);
         }
     }
     match = null;
     return(false);
 }
예제 #30
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
            }
        }