-
Notifications
You must be signed in to change notification settings - Fork 1
/
classes.py
170 lines (152 loc) · 5.37 KB
/
classes.py
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
170
from dataclasses import dataclass, field
from typing import Optional
@dataclass
class BigObject():
Name: str = ""
DisplayName: str = ""
Description: str = ""
Price: Optional[int] = 0
Fragility: Optional[int] = 0
CanBePlacedIndoors: Optional[bool] = True
CanBePlacedOutdoors: Optional[bool] = False
IsLamp: Optional[bool] = False
Texture: Optional[str] = ""
SpriteIndex: Optional[int] = 0
ContextTags: Optional[list] = field(default_factory=lambda: [])
def to_dict(self):
outDict = {}
mandatoryKeys = ["Name", "DisplayName", "Description", "SpriteIndex"]
for k, v in self.__dict__.items():
if k in mandatoryKeys or v:
outDict[k] = v
elif k == "CanBePlacedIndoors" and not v:
outDict[k] == v
return outDict
@dataclass
class Buff():
Duration: int = 0
Id: str = ""
FarmingLevel: Optional[int] = 0
FishingLevel: Optional[int] = 0
ForagingLevel: Optional[int] = 0
LuckLevel: Optional[int] = 0
MiningLevel: Optional[int] = 0
Attack: Optional[int] = 0
Defense: Optional[int] = 0
MagnetRadius: Optional[int] = 0
MaxStamina: Optional[int] = 0
def to_dict(self):
outDict = {"Id": "",
"Duration": 0,
"IsDebuff": False,
"CustomAttributes": {}}
for k, v in self.__dict__.items():
if k in ["Id", "Duration"]:
outDict[k] == v
else:
if v:
outDict["CustomAttributes"][k] = v
if v < 0:
outDict["IsDebuff"] = True
return outDict
@dataclass
class Crop():
Seasons: list = field(default_factory=lambda: [])
DaysInPhase: list = field(default_factory=lambda: [])
HarvestItemID: str = ""
Texture: str = ""
SpriteIndex: int = 0
RegrowDays: Optional[int] = -1
IsRaised: Optional[bool] = False
IsPaddyCrop: Optional[bool] = False
NeedsWatering: Optional[bool] = True
HarvestMethod: Optional[str] = "Grab"
HarvestMinStack: Optional[int] = 1
HarvestMaxStack: Optional[int] = 1
HarvestMinQuality: Optional[int] = 0
HarvestMaxQuality: Optional[int] = 0
HarvestMaxIncreasePerFarmingLevel: Optional[int] = 0
ExtraHarvestChance: Optional[int] = 0
TintColors: Optional[list] = field(default_factory=lambda: [])
CountForMonoculture: Optional[bool] = False
CountForPolyculture: Optional[bool] = False
PlantableLocationRules: Optional[dict] = field(default_factory=lambda: [])
def to_dict(self):
outDict = {}
mandatoryKeys = ["Seasons", "DaysInPhase", "HarvestItemID", "Texture", "SpriteIndex"]
for k, v in self.__dict__.items():
if k in mandatoryKeys or v:
outDict[k] = v
return outDict
@dataclass
class FruitTree():
DisplayName: str = ""
Seasons: list = field(default_factory=lambda: [])
Fruit: list = field(default_factory=lambda: [])
Texture: str = ""
TextureSpriteRow: int = 0
PlantableLocationRule: Optional[list] = field(default_factory=lambda: [])
def to_dict(self):
outDict = {}
mandatoryKeys = ["DisplayName", "Seasons", "Fruit", "Texture",
"TextureSpriteRow"]
for k, v in self.__dict__.items():
if k in mandatoryKeys or v:
outDict[k] = v
return outDict
@dataclass
class MeleeWeapon():
Name: str = ""
DisplayName: str = ""
Description: str = ""
Type: int = 0
Texture: str = ""
SpriteIndex: int = 0
MinDamage: int = 0
MaxDamage: int = 0
CanBeLostOnDeath: bool = True
Knockback: Optional[float] = 0.0
Speed: Optional[int] = 0
Precision: Optional[int] = 0
Defense: Optional[int] = 0
AreaOfEffect: Optional[int] = 0
CritChance: Optional[float] = 0.0
CritMultiplier: Optional[float] = 0.0
MineBaseLevel: Optional[int] = -1
MineMinLevel: Optional[int] = -1
Projectiles: Optional[list] = field(default_factory=lambda: [])
def to_dict(self):
outDict = {}
mandatoryKeys = ["Name", "DisplayName", "Description", "Type", "Texture",
"SpriteIndex", "MinDamage", "MaxDamage", "CanBeLostOnDeath"]
for k, v in self.__dict__.items():
if k in mandatoryKeys or v:
outDict[k] = v
return outDict
@dataclass
class SVObject():
Name: str = ""
DisplayName: str = ""
Description: str = ""
Type: str = ""
Category: int = 0
Price: int = 0
Texture: str = ""
SpriteIndex: int = 0
Edibility: Optional[int] = -1
IsDrink: Optional[bool] = False
GeodeDrops: Optional[list] = field(default_factory=lambda: [])
Buffs: Optional[list] = field(default_factory=lambda: [])
ArtifactSpotChances: Optional[dict] = field(default_factory=lambda: {})
ContextTags: Optional[list] = field(default_factory=lambda: [])
ExcludeFromRandomSale: Optional[bool] = False
ExcludeFromFishingCollection: Optional[bool] = False
ExcludeFromShippingCollection: Optional[bool] = False
def to_dict(self):
outDict = {}
mandatoryKeys = ["Name", "DisplayName", "Description", "Type",
"Category", "Price", "Texture", "SpriteIndex"]
for k, v in self.__dict__.items():
if k in mandatoryKeys or v:
outDict[k] = v
return outDict