public static void CreateEventFromDiplomacy(DiplomaticEntity sender, DiplomaticEntity target, Relation newRelation, Relation oldRelation) { int RelationImproved = newRelation > oldRelation ? 1 : 0; GalacticEventType type = DetermineDiplomaticEventType(sender.diplomaticType == 2, target.diplomaticType == 2, newRelation); GalacticEvents.AddNewEvent(type, int1: sender.id, int2: target.id, int3: (int?)newRelation, int4: (int?)oldRelation, int5: sender.diplomaticType, int6: target.diplomaticType); }
public GalacticEvents(int id , int eventType , DateTime eventDatetime , int?int1 = null , int?int2 = null , int?int3 = null , int?int4 = null , int?int5 = null , int?int6 = null , string string1 = null , string string2 = null , string string3 = null , string string4 = null , string string5 = null , string string6 = null , string string7 = null , string string8 = null) { Id = id; EventType = (GalacticEventType)eventType; EventDatetime = eventDatetime; Int1 = int1; Int2 = int2; Int3 = int3; Int4 = int4; Int5 = int5; Int6 = int6; String1 = string1; String2 = string2; String3 = string3; String4 = string4; String5 = string5; String6 = string6; String7 = string7; String8 = string8; }
public static void AddNewEvent(GalacticEventType eventType , int?int1 = null , int?int2 = null , int?int3 = null , int?int4 = null , int?int5 = null , int?int6 = null , string string1 = null , string string2 = null , string string3 = null , string string4 = null , string string5 = null , string string6 = null , string string7 = null , string string8 = null) { int eventId = (int)Core.Instance.identities.galacticEvents.getNext(); // Datetime send to JS have to be in universal, and they should not include to many milliseconds DateTime EventTime = DateTime.Now; EventTime = EventTime.ToUniversalTime(); EventTime = DateTime.Parse(EventTime.ToString("s")); GalacticEvents newEvent = new GalacticEvents(eventId, (int)eventType, EventTime, int1, int2, int3, int4, int5, int6, string1, string2, string3, string4, string5, string6, string7, string8); Core.Instance.galactivEvents.TryAdd(newEvent.Id, newEvent); Core.Instance.dataConnection.insertGalacticEvent(newEvent); //Core.Instance.dataConnection.insertGalacticEvent(new { x : newEvent }); if (Core.Instance.SendEvent != null) { Core.Instance.SendEvent(newEvent); } }