Elin Decompiled Documentation EA 23.102 Nightly
Loading...
Searching...
No Matches
FortuneRollData Class Reference
Inheritance diagram for FortuneRollData:
EClass

Classes

class  Prize
 

Public Member Functions

void Refresh ()
 
void RefreshPrize ()
 
List< List< string > > GetPrizeList ()
 
void GetPrize (int grade, int seed)
 
void WriteNote (UINote n)
 

Public Attributes

List< Prizeprizes = new List<Prize>()
 
int count
 
int seed
 
int dateNextRefresh
 

Static Public Attributes

static string[] mats = new string[4] { "plastic", "water", "hide_dragon", "gold" }
 
static int[] chances = new int[4] { 1, 8, 25, 60 }
 
- Static Public Attributes inherited from EClass
static Core core
 

Additional Inherited Members

- Static Public Member Functions inherited from EClass
static int rnd (int a)
 
static int curve (int a, int start, int step, int rate=75)
 
static int rndHalf (int a)
 
static float rndf (float a)
 
static int rndSqrt (int a)
 
static void Wait (float a, Card c)
 
static void Wait (float a, Point p)
 
static int Bigger (int a, int b)
 
static int Smaller (int a, int b)
 
- Properties inherited from EClass
static Game game [get]
 
static bool AdvMode [get]
 
static Player player [get]
 
static Chara pc [get]
 
static UI ui [get]
 
static Map _map [get]
 
static Zone _zone [get]
 
static FactionBranch Branch [get]
 
static FactionBranch BranchOrHomeBranch [get]
 
static Faction Home [get]
 
static Faction Wilds [get]
 
static Scene scene [get]
 
static BaseGameScreen screen [get]
 
static GameSetting setting [get]
 
static GameData gamedata [get]
 
static ColorProfile Colors [get]
 
static World world [get]
 
static SourceManager sources [get]
 
static SourceManager editorSources [get]
 
static SoundManager Sound [get]
 
static CoreDebug debug [get]
 

Detailed Description

Definition at line 6 of file FortuneRollData.cs.

Member Function Documentation

◆ GetPrize()

void FortuneRollData.GetPrize ( int  grade,
int  seed 
)
inline

Definition at line 208 of file FortuneRollData.cs.

209 {
211 Prize prize = null;
212 List<Prize> list = prizes.Where((Prize p) => p.grade == grade && !p.claimed).ToList();
213 if (list.Count > 0)
214 {
215 prize = list.RandomItem();
216 }
217 Card card = null;
218 if (prize != null)
219 {
220 if (prize.id == "sister")
221 {
222 card = CharaGen.Create("sister");
223 }
224 else
225 {
226 card = ThingGen.Create(prize.id).SetNum(prize.GetNum());
227 switch (card.id)
228 {
229 case "rp_food":
230 case "rp_block":
231 card.SetLv(10);
232 break;
233 case "goods_coin":
235 if (EClass.player.luckycoin >= 10)
236 {
237 prize.claimed = true;
238 }
239 break;
240 case "mathammer":
241 card.ChangeMaterial(prize.idRef);
242 card.noSell = true;
243 break;
244 case "panty":
245 card.c_idRefCard = prize.idRef;
246 card.rarity = Rarity.Legendary;
247 break;
248 }
249 }
250 if (grade != 3)
251 {
252 prize.claimed = true;
253 }
254 }
255 else
256 {
257 card = ThingGen.Create(GetPrizeList()[0].RandomItem());
258 }
259 if (card.isChara)
260 {
261 EClass._zone.AddCard(card, EClass.pc.pos.GetNearestPoint(allowBlock: false, allowChara: false) ?? EClass.pc.pos);
262 card.Chara.MakeMinion(EClass.pc);
263 }
264 else
265 {
266 EClass.pc.Pick(card.Thing);
267 }
268 Rand.SetSeed();
269 }
Rarity
Definition: Rarity.cs:2
Definition: Card.cs:11
Thing SetNum(int a)
Definition: Card.cs:3242
Point pos
Definition: Card.cs:55
static Chara Create(string id, int lv=-1)
Definition: CharaGen.cs:17
Thing Pick(Thing t, bool msg=true, bool tryStack=true)
Definition: Chara.cs:3920
Definition: EClass.cs:5
static Zone _zone
Definition: EClass.cs:20
static Player player
Definition: EClass.cs:12
static Chara pc
Definition: EClass.cs:14
List< Prize > prizes
List< List< string > > GetPrizeList()
int luckycoin
Definition: Player.cs:763
Point GetNearestPoint(bool allowBlock=false, bool allowChara=true, bool allowInstalled=true, bool ignoreCenter=false)
Definition: Point.cs:595
Definition: Rand.cs:4
static void SetSeed(int a=-1)
Definition: Rand.cs:37
static Thing Create(string id, int idMat=-1, int lv=-1)
Definition: ThingGen.cs:53
Card AddCard(Card t, Point point)
Definition: Zone.cs:1893

References EClass._zone, Zone.AddCard(), card, FortuneRollData.Prize.claimed, ThingGen.Create(), CharaGen.Create(), Point.GetNearestPoint(), FortuneRollData.Prize.GetNum(), GetPrizeList(), FortuneRollData.Prize.grade, FortuneRollData.Prize.id, FortuneRollData.Prize.idRef, Player.luckycoin, EClass.pc, Chara.Pick(), EClass.player, Card.pos, prizes, seed, Card.SetNum(), and Rand.SetSeed().

Referenced by TraitCrafter.Craft().

◆ GetPrizeList()

List< List< string > > FortuneRollData.GetPrizeList ( )
inline

Definition at line 173 of file FortuneRollData.cs.

174 {
175 List<List<string>> list = new List<List<string>>
176 {
177 new List<string> { "scrubber", "tissue", "plat" },
178 new List<string>
179 {
180 "microchip", "1089", "150", "855", "medal", "water", "goods_charm", "electronicsS", "electronics", "plat",
181 "plat", "ration", "backpack2", "sister", "rp_food", "rp_block", "157", "sleepingbag"
182 },
183 new List<string>
184 {
185 "computer", "834", "1090", "goods_figure", "goods_canvas", "mb_1", "mb_2", "mb_3", "mb_4", "mb_5",
186 "1174", "1085", "toilet", "714", "nobility", "plat", "1165", "mathammer", "medal", "bbq",
187 "panty", "beehive", "ticket_resident", "lovepotion", "crystal_sun"
188 },
189 new List<string>
190 {
191 (EClass.player.luckycoin < 10) ? "goods_coin" : "plat",
192 "plat",
193 "1165",
194 "boat3",
195 "medal"
196 }
197 };
199 {
200 for (int i = 0; i < (EClass.debug.enable ? 50 : 5); i++)
201 {
202 list[2].Add("panty");
203 }
204 }
205 return list;
206 }
Faction faction
Definition: Chara.cs:412
bool IsGlobalPolicyActive(int id)
Definition: FACTION.cs:436

References Chara.faction, Faction.IsGlobalPolicyActive(), and EClass.pc.

Referenced by GetPrize(), and RefreshPrize().

◆ Refresh()

void FortuneRollData.Refresh ( )
inline

Definition at line 115 of file FortuneRollData.cs.

116 {
118 {
119 Date date = EClass.world.date.Copy();
120 date.day = 1;
121 date.hour = 0;
122 date.min = 0;
123 date.AddMonth(1);
124 dateNextRefresh = date.GetRaw();
125 count++;
126 RefreshPrize();
127 }
128 }
Definition: Date.cs:4
Date Copy()
Definition: Date.cs:197
void AddMonth(int a)
Definition: Date.cs:235
int GetRaw(int offsetHours=0)
Definition: Date.cs:322
static World world
Definition: EClass.cs:40
GameDate date
Definition: World.cs:6

References Date.AddMonth(), Date.Copy(), count, World.date, dateNextRefresh, Date.GetRaw(), RefreshPrize(), and EClass.world.

Referenced by Zone.GetOrCreateFortuneRollData().

◆ RefreshPrize()

void FortuneRollData.RefreshPrize ( )
inline

Definition at line 130 of file FortuneRollData.cs.

131 {
132 prizes.Clear();
134 List<List<string>> list = GetPrizeList();
135 if (EClass._zone.IsTown && EClass._zone.lv == 0)
136 {
137 Add(3);
138 Add(2);
139 Add(2);
140 Add(1);
141 Add(1);
142 Add(1);
143 }
144 Rand.SetSeed();
145 void Add(int grade)
146 {
147 List<string> list2 = list[grade];
148 int index = EClass.rnd(list2.Count);
149 Prize prize = new Prize
150 {
151 id = list2[index],
152 grade = grade
153 };
154 string id = prize.id;
155 if (!(id == "panty"))
156 {
157 if (id == "mathammer")
158 {
159 SourceMaterial.Row randomMaterial = MATERIAL.GetRandomMaterial(20);
160 prize.idRef = randomMaterial.alias;
161 }
162 }
163 else
164 {
165 IEnumerable<SourceChara.Row> ie = EClass.sources.charas.map.Values.Where((SourceChara.Row r) => (r.model.trait as TraitChara).IsWearingPanty && !r.HasTag(CTAG.noRandomProduct));
166 prize.idRef = ie.RandomItem().id;
167 }
168 prizes.Add(prize);
169 list2.RemoveAt(index);
170 }
171 }
CTAG
Definition: CTAG.cs:2
list. Add(item3)
static Game game
Definition: EClass.cs:8
static int rnd(int a)
Definition: EClass.cs:50
static SourceManager sources
Definition: EClass.cs:42
int seed
Definition: Game.cs:197
static SourceMaterial.Row GetRandomMaterial(int lv, string group=null, bool tryLevelMatTier=false)
Definition: MATERIAL.cs:43
SourceChara charas
int lv
Definition: Spatial.cs:142
virtual bool IsTown
Definition: Zone.cs:220

References EClass._zone, Add(), SourceMaterial.Row.alias, SourceManager.charas, count, EClass.game, GetPrizeList(), MATERIAL.GetRandomMaterial(), FortuneRollData.Prize.id, Zone.IsTown, Spatial.lv, prizes, EClass.rnd(), seed, Game.seed, Rand.SetSeed(), and EClass.sources.

Referenced by Refresh().

◆ WriteNote()

void FortuneRollData.WriteNote ( UINote  n)
inline

Definition at line 271 of file FortuneRollData.cs.

272 {
273 n.Clear();
274 n.AddHeader("fortuneroll_prize");
275 n.Space(4);
276 foreach (Prize prize in prizes)
277 {
278 prize.AddNote(n);
279 }
280 string text = "_circle".lang().TagColor(Color.white) + " " + Lang.GetList("fortuneroll")[0];
281 n.AddTopic("TopicDomain", text, "fortuneroll_lose".lang());
282 n.Build();
283 }
Definition: Lang.cs:6
static string[] GetList(string id)
Definition: Lang.cs:114
void Clear()
Definition: UINote.cs:35
UIItem AddHeader(string text, Sprite sprite=null)
Definition: UINote.cs:79
UIItem AddTopic(string id, string text, string value=null)
Definition: UINote.cs:144
void Space(int sizeY=0, int sizeX=1)
Definition: UINote.cs:62
void Build()
Definition: UINote.cs:49

References UINote.AddHeader(), FortuneRollData.Prize.AddNote(), UINote.Clear(), Color, Lang.GetList(), prizes, and UINote.Space().

Referenced by UIDragGridInfo.Init().

Member Data Documentation

◆ chances

int [] FortuneRollData.chances = new int[4] { 1, 8, 25, 60 }
static

Definition at line 101 of file FortuneRollData.cs.

Referenced by TraitCrafter.Craft().

◆ count

int FortuneRollData.count

Definition at line 107 of file FortuneRollData.cs.

Referenced by Zone.GetOrCreateFortuneRollData(), Refresh(), and RefreshPrize().

◆ dateNextRefresh

int FortuneRollData.dateNextRefresh

Definition at line 113 of file FortuneRollData.cs.

Referenced by Refresh().

◆ mats

string [] FortuneRollData.mats = new string[4] { "plastic", "water", "hide_dragon", "gold" }
static

Definition at line 99 of file FortuneRollData.cs.

Referenced by FortuneRollData.Prize.AddNote(), and TraitCrafter.Craft().

◆ prizes

List<Prize> FortuneRollData.prizes = new List<Prize>()

Definition at line 104 of file FortuneRollData.cs.

Referenced by GetPrize(), RefreshPrize(), and WriteNote().

◆ seed

int FortuneRollData.seed

Definition at line 110 of file FortuneRollData.cs.

Referenced by GetPrize(), and RefreshPrize().


The documentation for this class was generated from the following file: