-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathCurrentLocation.cs
More file actions
62 lines (61 loc) · 2.95 KB
/
Copy pathCurrentLocation.cs
File metadata and controls
62 lines (61 loc) · 2.95 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace OlyCommonClasses
{
public class CurrentLocation
{
public string _current_loc { get; set; }
public int _current_region { get; set; }
public int _current_loctype { get; set; }
public static CurrentLocation Where_Am_I(int entityid, CurrentLocation mycurrloc, List<Character> _characters, List<Location> _locations, List<Ship> _ships)
{
if (entityid != 0)
{
Character mychar = _characters.Find(x => x._CharId == entityid);
if (mychar != null)
{
mycurrloc = Where_Am_I(mychar._LI_Where, mycurrloc, _characters, _locations, _ships);
}
else
{
Ship myship = _ships.Find(x => x._ShipId == entityid);
if (myship != null)
{
mycurrloc._current_loctype = (mycurrloc._current_loctype == 0 ? 2 : mycurrloc._current_loctype);
mycurrloc._current_loc += (mycurrloc._current_loc == null ? myship._ShipId.ToString() : "|" + myship._ShipId.ToString());
mycurrloc = Where_Am_I(myship._LI_Where, mycurrloc, _characters, _locations, _ships);
}
else
{
Location myloc = _locations.Find(x => x._LocId == entityid);
if (myloc != null)
{
mycurrloc._current_loctype = (mycurrloc._current_loctype == 0 ? 1 : mycurrloc._current_loctype);
if (_locations.Find(f => f._LocId == myloc._LI_Where)._Loc_Type == "region")
{
mycurrloc._current_loc += (mycurrloc._current_loc == null ? myloc._LocId_Conv : "|" + myloc._LocId_Conv);
mycurrloc._current_region = myloc._LI_Where;
}
else
{
mycurrloc._current_loc += (mycurrloc._current_loc == null ? myloc._LocId_Conv : "|" + myloc._LocId_Conv);
//Location myloc2 = Program._locations.Find(f => f._LocId == myloc._LI_Where);
mycurrloc = Where_Am_I(myloc._LI_Where, mycurrloc, _characters, _locations, _ships);
}
}
else
{
mycurrloc._current_loc = "unknown";
mycurrloc._current_region = 999;
mycurrloc._current_loctype = 999;
}
}
}
}
return mycurrloc;
}
}
}