-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathEveCharacterCreation.cs
171 lines (127 loc) · 4.08 KB
/
EveCharacterCreation.cs
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
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
/*
* ---------------------------------------
* User: duketwo
* Date: 26.03.2014
* Time: 11:50
*
* ---------------------------------------
*/
using System;
using System.Collections.Generic;
namespace EveModel
{
/// <summary>
/// Description of EveCharacterCreation.
/// </summary>
///
//RacesIDs
//raceCaldari = 1
//raceMinmatar = 2
//raceAmarr = 4
//raceGallente = 8
//StepIDs
// 1 Race
// 2 Bloodline
// 3 Customization
// 4 Portrait
// 5 Identity
//GenderIDs
// not set -1
// female 0
// male 1
//BloodlineIDs
// not set -1
public class EveCharacterCreation : EveObject
{
public enum Race { CALDARI, GALLENTE, AMARR, MINMATAR, NONE };
private static Random rnd = new Random();
public EveCharacterCreation() : base ()
{
PointerToObject = Frame.Client.Builtin["uicore"]["layer"].PointerToObject;
}
public bool IsCharacterCreationOpen {
get {
return this["charactercreation"]["isopen"].GetValueAs<bool>() || this["charactercreation"]["isopening"].GetValueAs<bool>();
}
}
public bool IsCharacterCreationLoading {
get {
return this["charactercreation"]["isopening"].GetValueAs<bool>();
}
}
public int GetStepID {
get {
return this["charactercreation"]["stepID"].GetValueAs<int>();
}
}
public void NextStep() {
if(GetStepID >= 1 && GetStepID < 5)
this["charactercreation"].CallMethod("SwitchStep", new object[] { this.GetStepID+1 }, true);
}
public Race GetRace {
get {
int raceID = this["charactercreation"]["raceID"].GetValueAs<int>();
return raceID == 1 ? Race.CALDARI : raceID == 2 ? Race.MINMATAR : raceID == 4 ? Race.AMARR : raceID == 8 ? Race.GALLENTE : Race.NONE;
}
}
public void SetRaceID(Race race) {
int raceID = race == Race.CALDARI ? 1 : race == Race.MINMATAR ? 2 : race == Race.AMARR ? 4 : race == Race.GALLENTE ? 8 : -1;
if(raceID != -1)
this["charactercreation"].CallMethod("SelectRace", new object[] { raceID }, false);
}
public bool IsBloodlineSet {
get {
return !this["charactercreation"]["bloodlineID"].GetValueAs<int>().Equals(-1);
}
}
public void SetRandomBloodlineID() {
EveObject obj = this["charactercreation"]["sr"]["step"]["bloodlineIDs"];
if(obj.IsValid){
List<int> bloodlineIDs = obj.GetList<int>();
if(bloodlineIDs.Count > 0){
int rndBloodlineID = bloodlineIDs[rnd.Next(0,bloodlineIDs.Count)];
string btnName = "bloodlineBtn_" + rndBloodlineID.ToString();
this["charactercreation"]["sr"]["step"]["sr"][btnName].CallMethod("OnClick", new object[] {}, true);
}
}
}
private int GetBloodlineID{
get {
return this["charactercreation"]["bloodlineID"].GetValueAs<int>();
}
}
public void SetRandomGenderID(){
int genderID = rnd.Next(0,2);
int bloodlineID = GetBloodlineID;
if((genderID == 0 || genderID == 1) && bloodlineID != -1) {
string btnName = "genderBtn_" + bloodlineID.ToString() + "_" + genderID.ToString();
this["charactercreation"]["sr"]["step"]["sr"][btnName].CallMethod("OnClick", new object[] {}, true);
}
}
public bool IsGenderSet{
get {
return !this["charactercreation"]["genderID"].GetValueAs<int>().Equals(-1);
}
}
public void RandomizeCharacter(){
this["charactercreation"]["sr"]["step"].CallMethod("RandomizeCharacter", new object[0] { }, true);
}
public bool ValidateStepComplete {
get {
return this["charactercreation"]["sr"]["step"].CallMethod("ValidateStepComplete", new object[] { }, false).GetValueAs<bool>();
}
}
public void SetFirstname(string name) {
this["charactercreation"]["sr"]["step"]["sr"]["firstNameEdit"].CallMethod("SetText", new object[] { name });
}
public String GetFirstName() {
string name = this["charactercreation"]["sr"]["step"]["sr"]["firstNameEdit"].CallMethod("GetText", new object[] {}).GetValueAs<string>();
if(string.IsNullOrEmpty(name))
name = string.Empty;
return name;
}
public void FinalizeCharacter() {
this["charactercreation"].CallMethod("Save", new object[] { }, true);
}
}
}