private static void SendPinsToServer(ZRpc client) { var pins = Traverse.Create(_Minimap._instance).Field("m_pins").GetValue() as List <Minimap.PinData>; var filteredPins = new List <PinData>(); foreach (var pin in pins) { if (pin.m_save) { filteredPins.Add(UtilityPin.ConvertPin(pin)); } } var z = ExplorationDatabase.PackPins(filteredPins); if (client == null) { OnClientInitialDataPin(null, z); } else { var znet = Traverse.Create(typeof(ZNet)).Field("m_instance").GetValue() as ZNet; var server = _ZNet.GetServerRPC(znet); server.Invoke("OnClientInitialDataPin", (object)z); } }
public static void UploadAllPins(bool removeDupes = false) { var pins = Traverse.Create(_Minimap._instance).Field("m_pins").GetValue() as List <Minimap.PinData>; foreach (var pin in pins.ToList()) { if (!pin.m_save) { continue; } if (removeDupes && LocalPinIsDupe(pin)) { continue; } PinSync.SendPinToServer(pin, false); var pin1 = UtilityPin.ConvertPin(pin); _Minimap.AddPin(_Minimap._instance, pin1.Pos, pin1.Type, pin1.Name, false, pin1.Checked, 0); ExplorationDatabase.ClientPins.Add(pin1); } }
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); } }