aa-structures 2.8.0__py3-none-any.whl → 2.9.1__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (62) hide show
  1. {aa_structures-2.8.0.dist-info → aa_structures-2.9.1.dist-info}/METADATA +2 -2
  2. {aa_structures-2.8.0.dist-info → aa_structures-2.9.1.dist-info}/RECORD +62 -61
  3. structures/__init__.py +1 -1
  4. structures/admin.py +3 -3
  5. structures/app_settings.py +88 -69
  6. structures/core/notification_embeds/billing_embeds.py +40 -7
  7. structures/core/notification_embeds/{character_embeds.py → corporate_embeds.py} +23 -13
  8. structures/core/notification_embeds/main.py +76 -38
  9. structures/core/notification_embeds/moonmining_embeds.py +12 -17
  10. structures/core/notification_embeds/orbital_embeds.py +3 -8
  11. structures/core/notification_embeds/sov_embeds.py +21 -19
  12. structures/core/notification_embeds/structures_embeds.py +19 -26
  13. structures/core/notification_embeds/tower_embeds.py +2 -2
  14. structures/core/notification_embeds/war_embeds.py +298 -92
  15. structures/core/notification_types.py +63 -44
  16. structures/forms.py +0 -1
  17. structures/helpers.py +13 -0
  18. structures/locale/de/LC_MESSAGES/django.po +488 -302
  19. structures/locale/django.pot +494 -308
  20. structures/locale/en/LC_MESSAGES/django.po +494 -308
  21. structures/locale/es/LC_MESSAGES/django.po +488 -302
  22. structures/locale/fr_FR/LC_MESSAGES/django.po +494 -308
  23. structures/locale/it_IT/LC_MESSAGES/django.po +494 -308
  24. structures/locale/ja/LC_MESSAGES/django.po +494 -308
  25. structures/locale/ko_KR/LC_MESSAGES/django.po +488 -302
  26. structures/locale/ru/LC_MESSAGES/django.mo +0 -0
  27. structures/locale/ru/LC_MESSAGES/django.po +532 -349
  28. structures/locale/uk/LC_MESSAGES/django.po +488 -302
  29. structures/locale/zh_Hans/LC_MESSAGES/django.po +488 -302
  30. structures/migrations/0005_add_notification_types.py +135 -0
  31. structures/models/eveuniverse.py +0 -1
  32. structures/models/notifications.py +1 -1
  33. structures/models/owners.py +3 -1
  34. structures/tests/core/notification_embeds/test_main.py +29 -27
  35. structures/tests/core/test_notification_structuretimers.py +2 -1
  36. structures/tests/core/test_notifications_timerboard.py +2 -1
  37. structures/tests/core/test_serializers.py +4 -2
  38. structures/tests/core/test_starbases.py +4 -2
  39. structures/tests/integration/test_tasks.py +2 -1
  40. structures/tests/integration/test_views.py +6 -3
  41. structures/tests/models/test_eveuniverse.py +2 -1
  42. structures/tests/models/test_notifications_1.py +16 -21
  43. structures/tests/models/test_notifications_2.py +4 -2
  44. structures/tests/models/test_notifications_3.py +6 -3
  45. structures/tests/models/test_notifications_discord.py +2 -1
  46. structures/tests/models/test_owners_1.py +28 -4
  47. structures/tests/models/test_owners_2.py +2 -1
  48. structures/tests/models/test_owners_3.py +2 -1
  49. structures/tests/models/test_owners_4.py +2 -1
  50. structures/tests/models/test_owners_5.py +8 -4
  51. structures/tests/models/test_structures.py +16 -8
  52. structures/tests/test_helpers.py +23 -3
  53. structures/tests/test_managers_1.py +16 -8
  54. structures/tests/test_managers_2.py +2 -1
  55. structures/tests/test_tasks.py +12 -6
  56. structures/tests/testdata/entities.json +150 -0
  57. structures/tests/testdata/helpers.py +1 -0
  58. structures/tests/views/test_public.py +2 -1
  59. structures/tests/views/test_statistics.py +2 -1
  60. structures/tests/views/test_structures.py +20 -10
  61. {aa_structures-2.8.0.dist-info → aa_structures-2.9.1.dist-info}/LICENSE +0 -0
  62. {aa_structures-2.8.0.dist-info → aa_structures-2.9.1.dist-info}/WHEEL +0 -0
@@ -7,36 +7,276 @@ import dhooks_lite
7
7
 
8
8
  from django.utils.html import strip_tags
9
9
  from django.utils.translation import gettext as _
10
- from eveuniverse.models import EveEntity
11
10
 
12
11
  from app_utils.datetime import ldap_time_2_datetime
12
+ from app_utils.helpers import humanize_number
13
13
 
14
- from structures.helpers import get_or_create_esi_obj
14
+ from structures.helpers import get_or_create_eve_entity
15
15
  from structures.models import Notification, Webhook
16
16
 
17
- from .helpers import (
18
- gen_eve_entity_link,
19
- gen_eve_entity_link_from_id,
20
- target_datetime_formatted,
21
- )
17
+ from .helpers import gen_eve_entity_link, target_datetime_formatted
22
18
  from .main import NotificationBaseEmbed
23
19
 
24
20
 
25
- class NotificationWarEmbed(NotificationBaseEmbed):
21
+ class NotificationAcceptedAlly(NotificationBaseEmbed):
26
22
  def __init__(self, notification: Notification) -> None:
27
23
  super().__init__(notification)
28
- self._declared_by = get_or_create_esi_obj(
29
- EveEntity, id=self._parsed_text["declaredByID"]
24
+ self._title = _("Accepted Ally")
25
+ ally = get_or_create_eve_entity(id=self._data["allyID"])
26
+ enemy = get_or_create_eve_entity(id=self._data["enemyID"])
27
+ character = get_or_create_eve_entity(id=self._data["charID"])
28
+ isk_value = self._data["iskValue"]
29
+ time = ldap_time_2_datetime(self._data["time"])
30
+ self._description = _(
31
+ "%(ally)s has been accepted in a war against %(enemy)s. "
32
+ "The offer was accepted at %(time)s by %(character)s for %(isk_value)s ISK."
33
+ ) % {
34
+ "enemy": gen_eve_entity_link(enemy),
35
+ "ally": gen_eve_entity_link(ally),
36
+ "character": gen_eve_entity_link(character),
37
+ "isk_value": humanize_number(isk_value),
38
+ "time": target_datetime_formatted(time),
39
+ }
40
+ self._thumbnail = dhooks_lite.Thumbnail(
41
+ ally.icon_url(size=self.ICON_DEFAULT_SIZE)
42
+ )
43
+ self._color = Webhook.Color.WARNING
44
+
45
+
46
+ class NotificationAllWarCorpJoinedAllianceMsg(NotificationBaseEmbed):
47
+ def __init__(self, notification: Notification) -> None:
48
+ super().__init__(notification)
49
+ self._title = _("Corporation you are at war with is joining an alliance")
50
+ alliance = get_or_create_eve_entity(id=self._data["allianceID"])
51
+ corporation = get_or_create_eve_entity(id=self._data["corpID"])
52
+ self._description = _(
53
+ "%(corporation)s is joining %(alliance)s alliance. "
54
+ "Since you are at war with %(corporation)s, "
55
+ "in 24 hours you will also be at war with %(alliance)s."
56
+ ) % {
57
+ "alliance": gen_eve_entity_link(alliance),
58
+ "corporation": gen_eve_entity_link(corporation),
59
+ }
60
+ self._thumbnail = dhooks_lite.Thumbnail(
61
+ corporation.icon_url(size=self.ICON_DEFAULT_SIZE)
62
+ )
63
+ self._color = Webhook.Color.INFO
64
+
65
+
66
+ class NotificationAllyJoinedWarMsg(NotificationBaseEmbed):
67
+ def __init__(self, notification: Notification) -> None:
68
+ super().__init__(notification)
69
+ self._title = _("Ally Has Joined a War")
70
+ aggressor = get_or_create_eve_entity(id=self._data["aggressorID"])
71
+ ally = get_or_create_eve_entity(id=self._data["allyID"])
72
+ defender = get_or_create_eve_entity(id=self._data["defenderID"])
73
+ start_time = ldap_time_2_datetime(self._data["startTime"])
74
+ self._description = _(
75
+ "%(ally)s has joined %(defender)s in a war against %(aggressor)s. "
76
+ "Their participation in the war will start at %(start_time)s."
77
+ ) % {
78
+ "aggressor": gen_eve_entity_link(aggressor),
79
+ "ally": gen_eve_entity_link(ally),
80
+ "defender": gen_eve_entity_link(defender),
81
+ "start_time": target_datetime_formatted(start_time),
82
+ }
83
+ self._thumbnail = dhooks_lite.Thumbnail(
84
+ ally.icon_url(size=self.ICON_DEFAULT_SIZE)
85
+ )
86
+ self._color = Webhook.Color.WARNING
87
+
88
+
89
+ class NotificationDeclareWar(NotificationBaseEmbed):
90
+ def __init__(self, notification: Notification) -> None:
91
+ super().__init__(notification)
92
+ entity = get_or_create_eve_entity(id=self._data["entityID"])
93
+ defender = get_or_create_eve_entity(id=self._data["defenderID"])
94
+ self._title = _("%(entity)s Declares War Against %(defender)s") % {
95
+ "entity": entity.name,
96
+ "defender": defender.name,
97
+ }
98
+ self._description = _(
99
+ "%(entity)s has declared war on %(defender)s. "
100
+ "Within 24 hours fighting can legally occur between those involved."
101
+ ) % {
102
+ "entity": gen_eve_entity_link(entity),
103
+ "defender": gen_eve_entity_link(defender),
104
+ }
105
+ self._thumbnail = dhooks_lite.Thumbnail(
106
+ entity.icon_url(size=self.ICON_DEFAULT_SIZE)
107
+ )
108
+ self._color = Webhook.Color.DANGER
109
+
110
+
111
+ class NotificationMercOfferedNegotiationMsg(NotificationBaseEmbed):
112
+ def __init__(self, notification: Notification) -> None:
113
+ super().__init__(notification)
114
+ aggressor = get_or_create_eve_entity(id=self._data["aggressorID"])
115
+ defender = get_or_create_eve_entity(id=self._data["defenderID"])
116
+ mercenary = get_or_create_eve_entity(id=self._data["mercID"])
117
+ isk_value = self._data["iskValue"]
118
+ self._title = (
119
+ _("%s has offered its services in one of your wars") % mercenary.name
120
+ )
121
+ self._description = _(
122
+ "%(mercenary)s has offered %(defender)s it's services in it's war against %(aggressor)s for %(isk_value)s. "
123
+ ) % {
124
+ "aggressor": gen_eve_entity_link(aggressor),
125
+ "defender": gen_eve_entity_link(defender),
126
+ "mercenary": gen_eve_entity_link(mercenary),
127
+ "isk_value": humanize_number(isk_value),
128
+ }
129
+ self._thumbnail = dhooks_lite.Thumbnail(
130
+ mercenary.icon_url(size=self.ICON_DEFAULT_SIZE)
30
131
  )
31
- self._against = get_or_create_esi_obj(
32
- EveEntity, id=self._parsed_text["againstID"]
132
+ self._color = Webhook.Color.INFO
133
+
134
+
135
+ class NotificationMercOfferRetractedMsg(NotificationBaseEmbed):
136
+ def __init__(self, notification: Notification) -> None:
137
+ super().__init__(notification)
138
+ self._title = _("Mercenary offered services")
139
+ aggressor = get_or_create_eve_entity(id=self._data["aggressorID"])
140
+ defender = get_or_create_eve_entity(id=self._data["defenderID"])
141
+ mercenary = get_or_create_eve_entity(id=self._data["mercID"])
142
+ self._description = _(
143
+ "%(mercenary)s has retracted it's offer to support %(defender)s in a war against %(aggressor)s."
144
+ ) % {
145
+ "aggressor": gen_eve_entity_link(aggressor),
146
+ "defender": gen_eve_entity_link(defender),
147
+ "mercenary": gen_eve_entity_link(mercenary),
148
+ }
149
+ self._thumbnail = dhooks_lite.Thumbnail(
150
+ mercenary.icon_url(size=self.ICON_DEFAULT_SIZE)
33
151
  )
152
+ self._color = Webhook.Color.INFO
153
+
154
+
155
+ class NotificationOfferedToAlly(NotificationBaseEmbed):
156
+ def __init__(self, notification: Notification) -> None:
157
+ super().__init__(notification)
158
+ aggressor = get_or_create_eve_entity(id=self._data["aggressorID"])
159
+ defender = get_or_create_eve_entity(id=self._data["defenderID"])
160
+ character = get_or_create_eve_entity(id=self._data["mercID"])
161
+ isk_value = self._data["iskValue"]
162
+ self._title = _("You have offered to ally with %s ") % defender.name
163
+ self._description = _(
164
+ "%(character)s has offered to ally to %(defender)s in their war "
165
+ "against %(aggressor)s. The offer asked for %(isk_value)s ISK as payment."
166
+ ) % {
167
+ "aggressor": gen_eve_entity_link(aggressor),
168
+ "defender": gen_eve_entity_link(defender),
169
+ "character": gen_eve_entity_link(character),
170
+ "isk_value": humanize_number(isk_value),
171
+ }
172
+ self._thumbnail = dhooks_lite.Thumbnail(
173
+ character.icon_url(size=self.ICON_DEFAULT_SIZE)
174
+ )
175
+ self._color = Webhook.Color.INFO
176
+
177
+
178
+ class NotificationOfferedSurrender(NotificationBaseEmbed):
179
+ def __init__(self, notification: Notification) -> None:
180
+ super().__init__(notification)
181
+ character = get_or_create_eve_entity(id=self._data["charID"])
182
+ entity = get_or_create_eve_entity(id=self._data["entityID"])
183
+ offered = get_or_create_eve_entity(id=self._data["offeredID"])
184
+ isk_value = self._data["iskValue"]
185
+ self._title = _("%s offered to surrender") % entity.name
186
+ self._description = _(
187
+ "%(character)s has offered to surrender to %(offered)s, "
188
+ "offering %(isk_value)s ISK. If accepted, the war will end in 24 hours "
189
+ "and neither organization will be able to declare new wars against "
190
+ "the other for the next 2 weeks."
191
+ ) % {
192
+ "character": gen_eve_entity_link(character),
193
+ "offered": gen_eve_entity_link(offered),
194
+ "isk_value": humanize_number(isk_value),
195
+ }
196
+ self._color = Webhook.Color.WARNING
197
+
198
+
199
+ class NotificationWarCorporationBecameEligible(NotificationBaseEmbed):
200
+ def __init__(self, notification: Notification) -> None:
201
+ super().__init__(notification)
202
+ self._title = _(
203
+ "Corporation or alliance is now eligible for formal war declarations"
204
+ )
205
+ self._description = _(
206
+ "Your corporation or alliance is **now eligible** to participate in "
207
+ "formal war declarations. This could be because your corporation "
208
+ "and/or one of the corporations in your alliance owns a structure "
209
+ "deployed in space."
210
+ )
211
+ self._color = Webhook.Color.WARNING
212
+
213
+
214
+ class NotificationWarCorporationNoLongerEligible(NotificationBaseEmbed):
215
+ def __init__(self, notification: Notification) -> None:
216
+ super().__init__(notification)
217
+ self._title = _(
218
+ "Corporation or alliance is no longer eligible for formal war declarations"
219
+ )
220
+ self._description = _(
221
+ "Your corporation or alliance is **no longer eligible** to participate "
222
+ "in formal war declarations.\n"
223
+ "Neither your corporation nor any of the corporations "
224
+ "in your alliance own a structure deployed in space at this time. "
225
+ "If your corporation or alliance is currently involved in a formal war, "
226
+ "that war will end in 24 hours."
227
+ )
228
+ self._color = Webhook.Color.INFO
229
+
230
+
231
+ class NotificationWarSurrenderOfferMsg(NotificationBaseEmbed):
232
+ def __init__(self, notification: Notification) -> None:
233
+ super().__init__(notification)
234
+ owner_1 = get_or_create_eve_entity(id=self._data.get("ownerID1"))
235
+ owner_2 = get_or_create_eve_entity(id=self._data.get("ownerID2"))
236
+ isk_value = self._data.get("iskValue", 0)
237
+ self._title = _("%s has offered a surrender") % owner_1.name
238
+ self._description = _(
239
+ "%(owner_1)s has offered to end the war with %(owner_2)s in the exchange "
240
+ "for %(isk_value)s ISK. "
241
+ "If accepted, the war will end in 24 hours and your organizations will "
242
+ "be unable to declare new wars against each other for the next 2 weeks."
243
+ ) % {
244
+ "owner_1": gen_eve_entity_link(owner_1),
245
+ "owner_2": gen_eve_entity_link(owner_2),
246
+ "isk_value": humanize_number(isk_value),
247
+ }
248
+ self._color = Webhook.Color.INFO
249
+
250
+
251
+ #################################
252
+ # War notifs with common elements
253
+ #################################
254
+
255
+
256
+ class NotificationWarBaseEmbed(NotificationBaseEmbed):
257
+ def __init__(self, notification: Notification) -> None:
258
+ super().__init__(notification)
259
+ self._declared_by = get_or_create_eve_entity(id=self._data["declaredByID"])
260
+ self._against = get_or_create_eve_entity(id=self._data["againstID"])
34
261
  self._thumbnail = dhooks_lite.Thumbnail(
35
262
  self._declared_by.icon_url(size=self.ICON_DEFAULT_SIZE)
36
263
  )
37
264
 
38
265
 
39
- class NotificationCorpWarSurrenderMsg(NotificationWarEmbed):
266
+ class NotificationAllWarSurrenderMsg(NotificationWarBaseEmbed):
267
+ def __init__(self, notification: Notification) -> None:
268
+ super().__init__(notification)
269
+ self._title = _("%s has surrendered") % self._declared_by.name
270
+ self._description = _(
271
+ "%(declared_by)s has surrendered in the war against %(against)s."
272
+ ) % {
273
+ "declared_by": gen_eve_entity_link(self._declared_by),
274
+ "against": gen_eve_entity_link(self._against),
275
+ }
276
+ self._color = Webhook.Color.WARNING
277
+
278
+
279
+ class NotificationCorpWarSurrenderMsg(NotificationWarBaseEmbed):
40
280
  def __init__(self, notification: Notification) -> None:
41
281
  super().__init__(notification)
42
282
  self._title = _("One party has surrendered")
@@ -51,10 +291,30 @@ class NotificationCorpWarSurrenderMsg(NotificationWarEmbed):
51
291
  self._color = Webhook.Color.WARNING
52
292
 
53
293
 
54
- class NotificationWarAdopted(NotificationWarEmbed):
294
+ class NotificationWarHQRemovedFromSpace(NotificationWarBaseEmbed):
295
+ def __init__(self, notification: Notification) -> None:
296
+ super().__init__(notification)
297
+ war_hq = self._data["warHQ"]
298
+ time_declared = ldap_time_2_datetime(self._data["timeDeclared"])
299
+ self._title = _("WarHQ %s lost") % war_hq
300
+ self._description = _(
301
+ "The war HQ %(war_hq)s is no more. "
302
+ "As a consequence, the war declared by %(declared_by)s "
303
+ "against %(against)s on %(time_declared)s "
304
+ "has been declared invalid by CONCORD and has entered its cooldown period."
305
+ ) % {
306
+ "war_hq": war_hq,
307
+ "declared_by": self._declared_by,
308
+ "against": self._against,
309
+ "time_declared": time_declared,
310
+ }
311
+ self._color = Webhook.Color.WARNING
312
+
313
+
314
+ class NotificationWarAdopted(NotificationWarBaseEmbed):
55
315
  def __init__(self, notification: Notification) -> None:
56
316
  super().__init__(notification)
57
- alliance = get_or_create_esi_obj(EveEntity, id=self._parsed_text["allianceID"])
317
+ alliance = get_or_create_eve_entity(id=self._data["allianceID"])
58
318
  self._title = _("War update: %(against)s has left %(alliance)s") % {
59
319
  "against": self._against.name,
60
320
  "alliance": alliance.name,
@@ -72,7 +332,7 @@ class NotificationWarAdopted(NotificationWarEmbed):
72
332
  self._color = Webhook.Color.WARNING
73
333
 
74
334
 
75
- class NotificationWarDeclared(NotificationWarEmbed):
335
+ class NotificationWarDeclared(NotificationWarBaseEmbed):
76
336
  def __init__(self, notification: Notification) -> None:
77
337
  super().__init__(notification)
78
338
  self._title = _("%(declared_by)s Declares War Against %(against)s") % {
@@ -87,18 +347,18 @@ class NotificationWarDeclared(NotificationWarEmbed):
87
347
  ) % {
88
348
  "declared_by": gen_eve_entity_link(self._declared_by),
89
349
  "against": gen_eve_entity_link(self._against),
90
- "war_hq": Webhook.text_bold(strip_tags(self._parsed_text["warHQ"])),
91
- "delay_hours": Webhook.text_bold(self._parsed_text["delayHours"]),
350
+ "war_hq": Webhook.text_bold(strip_tags(self._data["warHQ"])),
351
+ "delay_hours": Webhook.text_bold(self._data["delayHours"]),
92
352
  }
93
353
  self._color = Webhook.Color.DANGER
94
354
 
95
355
 
96
- class NotificationWarInherited(NotificationWarEmbed):
356
+ class NotificationWarInherited(NotificationWarBaseEmbed):
97
357
  def __init__(self, notification: Notification) -> None:
98
358
  super().__init__(notification)
99
- alliance = get_or_create_esi_obj(EveEntity, id=self._parsed_text["allianceID"])
100
- opponent = get_or_create_esi_obj(EveEntity, id=self._parsed_text["opponentID"])
101
- quitter = get_or_create_esi_obj(EveEntity, id=self._parsed_text["quitterID"])
359
+ alliance = get_or_create_eve_entity(id=self._data["allianceID"])
360
+ opponent = get_or_create_eve_entity(id=self._data["opponentID"])
361
+ quitter = get_or_create_eve_entity(id=self._data["quitterID"])
102
362
  self._title = _("%(alliance)s inherits war against %(opponent)s") % {
103
363
  "alliance": alliance.name,
104
364
  "opponent": opponent.name,
@@ -116,16 +376,17 @@ class NotificationWarInherited(NotificationWarEmbed):
116
376
  self._color = Webhook.Color.DANGER
117
377
 
118
378
 
119
- class NotificationWarRetractedByConcord(NotificationWarEmbed):
379
+ class NotificationWarInvalid(NotificationWarBaseEmbed):
120
380
  def __init__(self, notification: Notification) -> None:
121
381
  super().__init__(notification)
382
+ war_ends = ldap_time_2_datetime(self._data["endDate"])
122
383
  self._title = _("CONCORD invalidates war")
123
- war_ends = ldap_time_2_datetime(self._parsed_text["endDate"])
124
384
  self._description = _(
125
385
  "The war between %(declared_by)s and %(against)s "
126
- "has been retracted by CONCORD.\n"
127
- "After %(end_date)s CONCORD will again respond to any hostilities "
128
- "between those involved with full force."
386
+ "has been retracted by CONCORD, "
387
+ "because at least one of the involved parties "
388
+ "has become ineligible for war declarations."
389
+ "Fighting must cease on %(end_date)s."
129
390
  ) % {
130
391
  "declared_by": gen_eve_entity_link(self._declared_by),
131
392
  "against": gen_eve_entity_link(self._against),
@@ -134,74 +395,19 @@ class NotificationWarRetractedByConcord(NotificationWarEmbed):
134
395
  self._color = Webhook.Color.WARNING
135
396
 
136
397
 
137
- class NotificationWarCorporationBecameEligible(NotificationBaseEmbed):
398
+ class NotificationWarRetractedByConcord(NotificationWarBaseEmbed):
138
399
  def __init__(self, notification: Notification) -> None:
139
400
  super().__init__(notification)
140
- self._title = _(
141
- "Corporation or alliance is now eligible for formal war declarations"
142
- )
401
+ self._title = _("CONCORD retracts war")
402
+ war_ends = ldap_time_2_datetime(self._data["endDate"])
143
403
  self._description = _(
144
- "Your corporation or alliance is **now eligible** to participate in "
145
- "formal war declarations. This could be because your corporation "
146
- "and/or one of the corporations in your alliance owns a structure "
147
- "deployed in space."
148
- )
149
- self._color = Webhook.Color.WARNING
150
-
151
-
152
- class NotificationWarCorporationNoLongerEligible(NotificationBaseEmbed):
153
- def __init__(self, notification: Notification) -> None:
154
- super().__init__(notification)
155
- self._title = _(
156
- "Corporation or alliance is no longer eligible for formal war declarations"
157
- )
158
- self._description = _(
159
- "Your corporation or alliance is **no longer eligible** to participate "
160
- "in formal war declarations.\n"
161
- "Neither your corporation nor any of the corporations "
162
- "in your alliance own a structure deployed in space at this time. "
163
- "If your corporation or alliance is currently involved in a formal war, "
164
- "that war will end in 24 hours."
165
- )
166
- self._color = Webhook.Color.INFO
167
-
168
-
169
- class NotificationWarSurrenderOfferMsg(NotificationBaseEmbed):
170
- def __init__(self, notification: Notification) -> None:
171
- super().__init__(notification)
172
- isk_value = self._parsed_text.get("iskValue", 0)
173
- owner_1 = get_or_create_esi_obj(EveEntity, id=self._parsed_text.get("ownerID1"))
174
- owner_1_link = gen_eve_entity_link(owner_1)
175
- owner_2_link = gen_eve_entity_link_from_id(self._parsed_text.get("ownerID2"))
176
- self._title = _("%s has offered a surrender") % (owner_1,)
177
- self._description = _(
178
- "%s has offered to end the war with %s in the exchange for %s ISK. "
179
- "If accepted, the war will end in 24 hours and your organizations will "
180
- "be unable to declare new wars against each other for the next 2 weeks."
181
- ) % (owner_1_link, owner_2_link, f"{isk_value:,.2f}")
182
- self._color = Webhook.Color.INFO
183
-
184
-
185
- class NotificationAllyJoinedWarMsg(NotificationBaseEmbed):
186
- def __init__(self, notification: Notification) -> None:
187
- super().__init__(notification)
188
- self._title = _("Ally Has Joined a War")
189
- aggressor = get_or_create_esi_obj(
190
- EveEntity, id=self._parsed_text["aggressorID"]
191
- )
192
- ally = get_or_create_esi_obj(EveEntity, id=self._parsed_text["allyID"])
193
- defender = get_or_create_esi_obj(EveEntity, id=self._parsed_text["defenderID"])
194
- start_time = ldap_time_2_datetime(self._parsed_text["startTime"])
195
- self._description = _(
196
- "%(ally)s has joined %(defender)s in a war against %(aggressor)s. "
197
- "Their participation in the war will start at %(start_time)s."
404
+ "The war between %(declared_by)s and %(against)s "
405
+ "has been retracted by CONCORD.\n"
406
+ "After %(end_date)s CONCORD will again respond to any hostilities "
407
+ "between those involved with full force."
198
408
  ) % {
199
- "aggressor": gen_eve_entity_link(aggressor),
200
- "ally": gen_eve_entity_link(ally),
201
- "defender": gen_eve_entity_link(defender),
202
- "start_time": target_datetime_formatted(start_time),
409
+ "declared_by": gen_eve_entity_link(self._declared_by),
410
+ "against": gen_eve_entity_link(self._against),
411
+ "end_date": target_datetime_formatted(war_ends),
203
412
  }
204
- self._thumbnail = dhooks_lite.Thumbnail(
205
- ally.icon_url(size=self.ICON_DEFAULT_SIZE)
206
- )
207
413
  self._color = Webhook.Color.WARNING
@@ -12,35 +12,34 @@ class NotificationType(models.TextChoices):
12
12
  """Definition of all supported notification types."""
13
13
 
14
14
  # upwell structures
15
+ OWNERSHIP_TRANSFERRED = "OwnershipTransferred", _(
16
+ "Upwell structure ownership transferred"
17
+ )
15
18
  STRUCTURE_ANCHORING = "StructureAnchoring", _("Upwell structure anchoring")
19
+ STRUCTURE_DESTROYED = "StructureDestroyed", _("Upwell structure destroyed")
20
+ STRUCTURE_FUEL_ALERT = "StructureFuelAlert", _("Upwell structure fuel alert")
21
+ STRUCTURE_JUMP_FUEL_ALERT = "StructureJumpFuelAlert", _(
22
+ "Upwell structure jump fuel alert"
23
+ )
24
+ STRUCTURE_LOST_ARMOR = "StructureLostArmor", _("Upwell structure lost armor")
25
+ STRUCTURE_LOST_SHIELD = "StructureLostShields", _("Upwell structure lost shields")
16
26
  STRUCTURE_ONLINE = "StructureOnline", _("Upwell structure went online")
27
+ STRUCTURE_REFUELED_EXTRA = "StructureRefueledExtra", _("Upwell structure refueled")
28
+ STRUCTURE_REINFORCEMENT_CHANGED = "StructuresReinforcementChanged", _(
29
+ "Upwell structure reinforcement time changed"
30
+ )
17
31
  STRUCTURE_SERVICES_OFFLINE = "StructureServicesOffline", _(
18
32
  "Upwell structure services went offline"
19
33
  )
20
- STRUCTURE_WENT_HIGH_POWER = "StructureWentHighPower", _(
21
- "Upwell structure went high power"
22
- )
23
- STRUCTURE_WENT_LOW_POWER = "StructureWentLowPower", _(
24
- "Upwell structure went low power"
25
- )
26
34
  STRUCTURE_UNANCHORING = "StructureUnanchoring", _("Upwell structure unanchoring")
27
- STRUCTURE_FUEL_ALERT = "StructureFuelAlert", _("Upwell structure fuel alert")
28
- STRUCTURE_REFUELED_EXTRA = "StructureRefueledExtra", _("Upwell structure refueled")
29
- STRUCTURE_JUMP_FUEL_ALERT = "StructureJumpFuelAlert", _(
30
- "Upwell structure jump fuel alert"
31
- )
32
35
  STRUCTURE_UNDER_ATTACK = "StructureUnderAttack", _(
33
36
  "Upwell structure is under attack"
34
37
  )
35
- STRUCTURE_LOST_SHIELD = "StructureLostShields", _("Upwell structure lost shields")
36
- STRUCTURE_LOST_ARMOR = "StructureLostArmor", _("Upwell structure lost armor")
37
- STRUCTURE_DESTROYED = "StructureDestroyed", _("Upwell structure destroyed")
38
-
39
- STRUCTURE_REINFORCEMENT_CHANGED = "StructuresReinforcementChanged", _(
40
- "Upwell structure reinforcement time changed"
38
+ STRUCTURE_WENT_HIGH_POWER = "StructureWentHighPower", _(
39
+ "Upwell structure went high power"
41
40
  )
42
- OWNERSHIP_TRANSFERRED = "OwnershipTransferred", _(
43
- "Upwell structure ownership transferred"
41
+ STRUCTURE_WENT_LOW_POWER = "StructureWentLowPower", _(
42
+ "Upwell structure went low power"
44
43
  )
45
44
 
46
45
  # customs offices
@@ -54,43 +53,49 @@ class NotificationType(models.TextChoices):
54
53
  TOWER_REINFORCED_EXTRA = "TowerReinforcedExtra", _("Starbase reinforced (BETA)")
55
54
 
56
55
  # moon mining
57
- MOONMINING_EXTRACTION_STARTED = "MoonminingExtractionStarted", _(
58
- "Moon mining extraction started"
56
+ MOONMINING_AUTOMATIC_FRACTURE = "MoonminingAutomaticFracture", _(
57
+ "Moon mining automatic fracture triggered"
59
58
  )
60
- MOONMINING_LASER_FIRED = "MoonminingLaserFired", _("Moonmining laser fired")
61
59
  MOONMINING_EXTRACTION_CANCELLED = "MoonminingExtractionCancelled", _(
62
60
  "Moon mining extraction cancelled"
63
61
  )
64
62
  MOONMINING_EXTRACTION_FINISHED = "MoonminingExtractionFinished", _(
65
63
  "Moon mining extraction finished"
66
64
  )
67
- MOONMINING_AUTOMATIC_FRACTURE = "MoonminingAutomaticFracture", _(
68
- "Moon mining automatic fracture triggered"
65
+ MOONMINING_EXTRACTION_STARTED = "MoonminingExtractionStarted", _(
66
+ "Moon mining extraction started"
69
67
  )
68
+ MOONMINING_LASER_FIRED = "MoonminingLaserFired", _("Moonmining laser fired")
70
69
 
71
70
  # sov
72
- SOV_STRUCTURE_REINFORCED = "SovStructureReinforced", _(
73
- "Sovereignty structure reinforced"
71
+ SOV_ALL_CLAIM_ACQUIRED_MSG = "SovAllClaimAquiredMsg", _(
72
+ "Sovereignty claim acknowledgment" # SovAllClaimAquiredMsg [sic!]
74
73
  )
75
- SOV_STRUCTURE_DESTROYED = "SovStructureDestroyed", _(
76
- "Sovereignty structure destroyed"
74
+ SOV_ALL_CLAIM_LOST_MSG = "SovAllClaimLostMsg", _("Sovereignty lost")
75
+ SOV_ALL_ANCHORING_MSG = "AllAnchoringMsg", _(
76
+ "Structure anchoring in alliance space"
77
77
  )
78
78
  SOV_ENTOSIS_CAPTURE_STARTED = "EntosisCaptureStarted", _(
79
79
  "Sovereignty entosis capture started"
80
80
  )
81
- SOV_COMMAND_NODE_EVENT_STARTED = "SovCommandNodeEventStarted", _(
82
- "Sovereignty command node event started"
81
+ SOV_STRUCTURE_DESTROYED = "SovStructureDestroyed", _(
82
+ "Sovereignty structure destroyed"
83
83
  )
84
- SOV_ALL_CLAIM_ACQUIRED_MSG = "SovAllClaimAquiredMsg", _(
85
- "Sovereignty claim acknowledgment" # SovAllClaimAquiredMsg [sic!]
84
+ SOV_STRUCTURE_REINFORCED = "SovStructureReinforced", _(
85
+ "Sovereignty structure reinforced"
86
86
  )
87
- SOV_ALL_CLAIM_LOST_MSG = "SovAllClaimLostMsg", _("Sovereignty lost")
88
- SOV_ALL_ANCHORING_MSG = "AllAnchoringMsg", _(
89
- "Structure anchoring in alliance space"
87
+ SOV_COMMAND_NODE_EVENT_STARTED = "SovCommandNodeEventStarted", _(
88
+ "Sovereignty command node event started"
90
89
  )
91
90
 
92
91
  # wars
93
- WAR_WAR_DECLARED = "WarDeclared", _("War declared")
92
+ WAR_ACCEPTED_ALLY = "AcceptedAlly", _("War accepted ally")
93
+ WAR_ALL_WAR_CORP_JOINED_ALLIANCE_MSG = "AllWarCorpJoinedAllianceMsg", _(
94
+ "Alliance war corporation joined alliance message"
95
+ )
96
+ WAR_ALL_WAR_SURRENDER_MSG = "AllWarSurrenderMsg", _(
97
+ "Alliance war surrender message"
98
+ )
94
99
  WAR_ALLY_JOINED_WAR_AGGRESSOR_MSG = "AllyJoinedWarAggressorMsg", _(
95
100
  "War ally joined aggressor"
96
101
  )
@@ -98,33 +103,47 @@ class NotificationType(models.TextChoices):
98
103
  WAR_ALLY_JOINED_WAR_DEFENDER_MSG = "AllyJoinedWarDefenderMsg", _(
99
104
  "War ally joined defender"
100
105
  )
101
- WAR_WAR_ADOPTED = "WarAdopted", _("War adopted")
102
- WAR_WAR_INHERITED = "WarInherited", _("War inherited")
103
106
  WAR_CORP_WAR_SURRENDER_MSG = "CorpWarSurrenderMsg", _("War party surrendered")
104
- WAR_WAR_RETRACTED_BY_CONCORD = "WarRetractedByConcord", _(
105
- "War retracted by Concord"
106
- )
107
107
  WAR_CORPORATION_BECAME_ELIGIBLE = "CorpBecameWarEligible", _(
108
108
  "War corporation became eligible"
109
109
  )
110
110
  WAR_CORPORATION_NO_LONGER_ELIGIBLE = "CorpNoLongerWarEligible", _(
111
111
  "War corporation no longer eligible"
112
112
  )
113
+ WAR_DECLARE_WAR = "DeclareWar", _("War declared")
114
+ WAR_HQ_REMOVED_FROM_SPACE = "WarHQRemovedFromSpace", _("War HQ removed from space")
115
+ WAR_INVALID = "WarInvalid", _("War invalid")
116
+ WAR_MERC_OFFERED_NEGOTIATION_MSG = "MercOfferedNegotiationMsg", _(
117
+ "War mercenary offered negotiation message"
118
+ )
119
+ WAR_MERC_OFFER_RETRACTED_MSG = "MercOfferRetractedMsg", _(
120
+ "War mercenary offer retracted message"
121
+ )
122
+ WAR_OFFERED_SURRENDER = "OfferedSurrender", _("War offered surrender")
123
+ WAR_OFFERED_TO_ALLY = "OfferedToAlly", _("War offered to become ally")
124
+ WAR_WAR_ADOPTED = "WarAdopted", _("War adopted")
125
+ WAR_WAR_DECLARED = "WarDeclared", _("War declared")
126
+ WAR_WAR_INHERITED = "WarInherited", _("War inherited")
127
+ WAR_WAR_RETRACTED_BY_CONCORD = "WarRetractedByConcord", _(
128
+ "War retracted by Concord"
129
+ )
113
130
  WAR_WAR_SURRENDER_OFFER_MSG = "WarSurrenderOfferMsg", _("War surrender offered")
114
131
 
115
132
  # corporation membership
116
- CORP_APP_NEW_MSG = "CorpAppNewMsg", _("Character submitted application")
133
+ CHAR_APP_ACCEPT_MSG = "CharAppAcceptMsg", _("Character joins corporation")
117
134
  CORP_APP_INVITED_MSG = "CorpAppInvitedMsg", _(
118
135
  "Character invited to join corporation"
119
136
  )
137
+ CORP_APP_NEW_MSG = "CorpAppNewMsg", _("Character submitted application")
138
+ CORP_APP_REJECT_MSG = "CharAppRejectMsg", _("Corp application rejected message")
120
139
  CORP_APP_REJECT_CUSTOM_MSG = "CorpAppRejectCustomMsg", _(
121
- "Corp application rejected"
140
+ "Corp application rejected custom message"
122
141
  )
123
142
  CHAR_APP_WITHDRAW_MSG = "CharAppWithdrawMsg", _("Character withdrew application")
124
- CHAR_APP_ACCEPT_MSG = "CharAppAcceptMsg", _("Character joins corporation")
125
143
  CHAR_LEFT_CORP_MSG = "CharLeftCorpMsg", _("Character leaves corporation")
126
144
 
127
145
  # billing
146
+ BILLING_CORP_ALL_BILL_MSG = "CorpAllBillMsg", _("Corp alliance billing message")
128
147
  BILLING_BILL_OUT_OF_MONEY_MSG = "BillOutOfMoneyMsg", _("Bill out of money")
129
148
  BILLING_I_HUB_BILL_ABOUT_TO_EXPIRE = (
130
149
  "InfrastructureHubBillAboutToExpire",
structures/forms.py CHANGED
@@ -1,6 +1,5 @@
1
1
  """Forms for Structures."""
2
2
 
3
-
4
3
  from django import forms
5
4
 
6
5
  from .models import StructureTag