rom24-quickmud-python 2.3.1__py3-none-any.whl → 2.4.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.
@@ -4,297 +4,278 @@ Also: brief, compact, combine, prompt, color.
4
4
 
5
5
  ROM Reference: src/act_info.c lines 659-950
6
6
  """
7
+
7
8
  from __future__ import annotations
8
9
 
9
10
  from mud.models.character import Character
10
-
11
-
12
- # Player act flags (PLR_*)
13
- PLR_AUTOASSIST = 0x00000100
14
- PLR_AUTOEXIT = 0x00000200
15
- PLR_AUTOGOLD = 0x00000400
16
- PLR_AUTOLOOT = 0x00000800
17
- PLR_AUTOSAC = 0x00001000
18
- PLR_AUTOSPLIT = 0x00002000
19
- PLR_HOLYLIGHT = 0x00004000
20
- PLR_CANLOOT = 0x00008000
21
- PLR_NOSUMMON = 0x00010000
22
- PLR_NOFOLLOW = 0x00020000
23
-
24
- # Comm flags (COMM_*)
25
- COMM_COMPACT = 0x00000001
26
- COMM_BRIEF = 0x00000002
27
- COMM_PROMPT = 0x00000004
28
- COMM_COMBINE = 0x00000008
29
- COMM_TELNET_GA = 0x00000010
30
- COMM_NOCOLOUR = 0x00000020
11
+ from mud.models.constants import CommFlag, PlayerFlag
31
12
 
32
13
 
33
14
  def do_autolist(char: Character, args: str) -> str:
34
15
  """
35
16
  List all auto-settings and their status.
36
-
17
+
37
18
  ROM Reference: src/act_info.c do_autolist (lines 659-742)
38
19
  """
39
20
  if getattr(char, "is_npc", False):
40
21
  return ""
41
-
22
+
42
23
  act_flags = getattr(char, "act", 0)
43
24
  comm_flags = getattr(char, "comm", 0)
44
-
25
+
45
26
  lines = []
46
27
  lines.append(" action status")
47
28
  lines.append("---------------------")
48
-
29
+
49
30
  # Auto settings
50
31
  settings = [
51
- ("autoassist", act_flags & PLR_AUTOASSIST),
52
- ("autoexit", act_flags & PLR_AUTOEXIT),
53
- ("autogold", act_flags & PLR_AUTOGOLD),
54
- ("autoloot", act_flags & PLR_AUTOLOOT),
55
- ("autosac", act_flags & PLR_AUTOSAC),
56
- ("autosplit", act_flags & PLR_AUTOSPLIT),
57
- ("telnetga", comm_flags & COMM_TELNET_GA),
58
- ("compact mode", comm_flags & COMM_COMPACT),
59
- ("prompt", comm_flags & COMM_PROMPT),
60
- ("combine items", comm_flags & COMM_COMBINE),
32
+ ("autoassist", act_flags & PlayerFlag.AUTOASSIST),
33
+ ("autoexit", act_flags & PlayerFlag.AUTOEXIT),
34
+ ("autogold", act_flags & PlayerFlag.AUTOGOLD),
35
+ ("autoloot", act_flags & PlayerFlag.AUTOLOOT),
36
+ ("autosac", act_flags & PlayerFlag.AUTOSAC),
37
+ ("autosplit", act_flags & PlayerFlag.AUTOSPLIT),
38
+ ("telnetga", comm_flags & CommFlag.TELNET_GA),
39
+ ("compact mode", comm_flags & CommFlag.COMPACT),
40
+ ("prompt", comm_flags & CommFlag.PROMPT),
41
+ ("combine items", comm_flags & CommFlag.COMBINE),
61
42
  ]
62
-
43
+
63
44
  for name, is_on in settings:
64
45
  status = "{GON{x" if is_on else "{ROFF{x"
65
46
  lines.append(f"{name:14} {status}")
66
-
47
+
67
48
  # Extra info
68
- if not (act_flags & PLR_CANLOOT):
49
+ if not (act_flags & PlayerFlag.CANLOOT):
69
50
  lines.append("Your corpse is safe from thieves.")
70
51
  else:
71
52
  lines.append("Your corpse may be looted.")
72
-
73
- if act_flags & PLR_NOSUMMON:
53
+
54
+ if act_flags & PlayerFlag.NOSUMMON:
74
55
  lines.append("You cannot be summoned.")
75
56
  else:
76
57
  lines.append("You can be summoned.")
77
-
78
- if act_flags & PLR_NOFOLLOW:
58
+
59
+ if act_flags & PlayerFlag.NOFOLLOW:
79
60
  lines.append("You do not welcome followers.")
80
61
  else:
81
62
  lines.append("You accept followers.")
82
-
63
+
83
64
  return "\n".join(lines)
84
65
 
85
66
 
86
67
  def do_autoall(char: Character, args: str) -> str:
87
68
  """
88
69
  Toggle all auto-settings on or off.
89
-
70
+
90
71
  ROM Reference: src/act_info.c do_autoall (lines 846-875)
91
72
  """
92
73
  if getattr(char, "is_npc", False):
93
74
  return ""
94
-
75
+
95
76
  arg = (args or "").strip().lower()
96
-
77
+
97
78
  if arg == "on":
98
79
  act_flags = getattr(char, "act", 0)
99
- act_flags |= PLR_AUTOASSIST
100
- act_flags |= PLR_AUTOEXIT
101
- act_flags |= PLR_AUTOGOLD
102
- act_flags |= PLR_AUTOLOOT
103
- act_flags |= PLR_AUTOSAC
104
- act_flags |= PLR_AUTOSPLIT
80
+ act_flags |= PlayerFlag.AUTOASSIST
81
+ act_flags |= PlayerFlag.AUTOEXIT
82
+ act_flags |= PlayerFlag.AUTOGOLD
83
+ act_flags |= PlayerFlag.AUTOLOOT
84
+ act_flags |= PlayerFlag.AUTOSAC
85
+ act_flags |= PlayerFlag.AUTOSPLIT
105
86
  char.act = act_flags
106
87
  return "All autos turned on."
107
-
88
+
108
89
  elif arg == "off":
109
90
  act_flags = getattr(char, "act", 0)
110
- act_flags &= ~PLR_AUTOASSIST
111
- act_flags &= ~PLR_AUTOEXIT
112
- act_flags &= ~PLR_AUTOGOLD
113
- act_flags &= ~PLR_AUTOLOOT
114
- act_flags &= ~PLR_AUTOSAC
115
- act_flags &= ~PLR_AUTOSPLIT
91
+ act_flags &= ~PlayerFlag.AUTOASSIST
92
+ act_flags &= ~PlayerFlag.AUTOEXIT
93
+ act_flags &= ~PlayerFlag.AUTOGOLD
94
+ act_flags &= ~PlayerFlag.AUTOLOOT
95
+ act_flags &= ~PlayerFlag.AUTOSAC
96
+ act_flags &= ~PlayerFlag.AUTOSPLIT
116
97
  char.act = act_flags
117
98
  return "All autos turned off."
118
-
99
+
119
100
  return "Usage: autoall [on|off]"
120
101
 
121
102
 
122
103
  def do_autoassist(char: Character, args: str) -> str:
123
104
  """
124
105
  Toggle automatic assist in combat.
125
-
106
+
126
107
  ROM Reference: src/act_info.c do_autoassist (lines 744-758)
127
108
  """
128
109
  if getattr(char, "is_npc", False):
129
110
  return ""
130
-
111
+
131
112
  act_flags = getattr(char, "act", 0)
132
-
133
- if act_flags & PLR_AUTOASSIST:
134
- char.act = act_flags & ~PLR_AUTOASSIST
113
+
114
+ if act_flags & PlayerFlag.AUTOASSIST:
115
+ char.act = act_flags & ~PlayerFlag.AUTOASSIST
135
116
  return "Autoassist removed."
136
117
  else:
137
- char.act = act_flags | PLR_AUTOASSIST
118
+ char.act = act_flags | PlayerFlag.AUTOASSIST
138
119
  return "You will now assist when needed."
139
120
 
140
121
 
141
122
  def do_autoexit(char: Character, args: str) -> str:
142
123
  """
143
124
  Toggle automatic exit display.
144
-
125
+
145
126
  ROM Reference: src/act_info.c do_autoexit (lines 761-775)
146
127
  """
147
128
  if getattr(char, "is_npc", False):
148
129
  return ""
149
-
130
+
150
131
  act_flags = getattr(char, "act", 0)
151
-
152
- if act_flags & PLR_AUTOEXIT:
153
- char.act = act_flags & ~PLR_AUTOEXIT
132
+
133
+ if act_flags & PlayerFlag.AUTOEXIT:
134
+ char.act = act_flags & ~PlayerFlag.AUTOEXIT
154
135
  return "Exits will no longer be displayed."
155
136
  else:
156
- char.act = act_flags | PLR_AUTOEXIT
137
+ char.act = act_flags | PlayerFlag.AUTOEXIT
157
138
  return "Exits will now be displayed."
158
139
 
159
140
 
160
141
  def do_autogold(char: Character, args: str) -> str:
161
142
  """
162
143
  Toggle automatic gold looting from corpses.
163
-
144
+
164
145
  ROM Reference: src/act_info.c do_autogold (lines 778-792)
165
146
  """
166
147
  if getattr(char, "is_npc", False):
167
148
  return ""
168
-
149
+
169
150
  act_flags = getattr(char, "act", 0)
170
-
171
- if act_flags & PLR_AUTOGOLD:
172
- char.act = act_flags & ~PLR_AUTOGOLD
151
+
152
+ if act_flags & PlayerFlag.AUTOGOLD:
153
+ char.act = act_flags & ~PlayerFlag.AUTOGOLD
173
154
  return "Autogold removed."
174
155
  else:
175
- char.act = act_flags | PLR_AUTOGOLD
156
+ char.act = act_flags | PlayerFlag.AUTOGOLD
176
157
  return "Automatic gold looting set."
177
158
 
178
159
 
179
160
  def do_autoloot(char: Character, args: str) -> str:
180
161
  """
181
162
  Toggle automatic corpse looting.
182
-
163
+
183
164
  ROM Reference: src/act_info.c do_autoloot (lines 795-809)
184
165
  """
185
166
  if getattr(char, "is_npc", False):
186
167
  return ""
187
-
168
+
188
169
  act_flags = getattr(char, "act", 0)
189
-
190
- if act_flags & PLR_AUTOLOOT:
191
- char.act = act_flags & ~PLR_AUTOLOOT
170
+
171
+ if act_flags & PlayerFlag.AUTOLOOT:
172
+ char.act = act_flags & ~PlayerFlag.AUTOLOOT
192
173
  return "Autolooting removed."
193
174
  else:
194
- char.act = act_flags | PLR_AUTOLOOT
175
+ char.act = act_flags | PlayerFlag.AUTOLOOT
195
176
  return "Automatic corpse looting set."
196
177
 
197
178
 
198
179
  def do_autosac(char: Character, args: str) -> str:
199
180
  """
200
181
  Toggle automatic corpse sacrificing.
201
-
182
+
202
183
  ROM Reference: src/act_info.c do_autosac (lines 812-826)
203
184
  """
204
185
  if getattr(char, "is_npc", False):
205
186
  return ""
206
-
187
+
207
188
  act_flags = getattr(char, "act", 0)
208
-
209
- if act_flags & PLR_AUTOSAC:
210
- char.act = act_flags & ~PLR_AUTOSAC
189
+
190
+ if act_flags & PlayerFlag.AUTOSAC:
191
+ char.act = act_flags & ~PlayerFlag.AUTOSAC
211
192
  return "Autosacrificing removed."
212
193
  else:
213
- char.act = act_flags | PLR_AUTOSAC
194
+ char.act = act_flags | PlayerFlag.AUTOSAC
214
195
  return "Automatic corpse sacrificing set."
215
196
 
216
197
 
217
198
  def do_autosplit(char: Character, args: str) -> str:
218
199
  """
219
200
  Toggle automatic gold splitting with group.
220
-
201
+
221
202
  ROM Reference: src/act_info.c do_autosplit (lines 829-843)
222
203
  """
223
204
  if getattr(char, "is_npc", False):
224
205
  return ""
225
-
206
+
226
207
  act_flags = getattr(char, "act", 0)
227
-
228
- if act_flags & PLR_AUTOSPLIT:
229
- char.act = act_flags & ~PLR_AUTOSPLIT
208
+
209
+ if act_flags & PlayerFlag.AUTOSPLIT:
210
+ char.act = act_flags & ~PlayerFlag.AUTOSPLIT
230
211
  return "Autosplitting removed."
231
212
  else:
232
- char.act = act_flags | PLR_AUTOSPLIT
213
+ char.act = act_flags | PlayerFlag.AUTOSPLIT
233
214
  return "Automatic gold splitting set."
234
215
 
235
216
 
236
217
  def do_brief(char: Character, args: str) -> str:
237
218
  """
238
219
  Toggle brief room descriptions.
239
-
220
+
240
221
  ROM Reference: src/act_info.c do_brief (lines 877-888)
241
222
  """
242
223
  comm_flags = getattr(char, "comm", 0)
243
-
244
- if comm_flags & COMM_BRIEF:
245
- char.comm = comm_flags & ~COMM_BRIEF
224
+
225
+ if comm_flags & CommFlag.BRIEF:
226
+ char.comm = comm_flags & ~CommFlag.BRIEF
246
227
  return "Full descriptions activated."
247
228
  else:
248
- char.comm = comm_flags | COMM_BRIEF
229
+ char.comm = comm_flags | CommFlag.BRIEF
249
230
  return "Short descriptions activated."
250
231
 
251
232
 
252
233
  def do_compact(char: Character, args: str) -> str:
253
234
  """
254
235
  Toggle compact output mode (no extra blank lines).
255
-
236
+
256
237
  ROM Reference: src/act_info.c do_compact (lines 890-901)
257
238
  """
258
239
  comm_flags = getattr(char, "comm", 0)
259
-
260
- if comm_flags & COMM_COMPACT:
261
- char.comm = comm_flags & ~COMM_COMPACT
240
+
241
+ if comm_flags & CommFlag.COMPACT:
242
+ char.comm = comm_flags & ~CommFlag.COMPACT
262
243
  return "Compact mode removed."
263
244
  else:
264
- char.comm = comm_flags | COMM_COMPACT
245
+ char.comm = comm_flags | CommFlag.COMPACT
265
246
  return "Compact mode set."
266
247
 
267
248
 
268
249
  def do_combine(char: Character, args: str) -> str:
269
250
  """
270
251
  Toggle combining identical items in inventory display.
271
-
252
+
272
253
  ROM Reference: src/act_info.c do_combine
273
254
  """
274
255
  comm_flags = getattr(char, "comm", 0)
275
-
276
- if comm_flags & COMM_COMBINE:
277
- char.comm = comm_flags & ~COMM_COMBINE
256
+
257
+ if comm_flags & CommFlag.COMBINE:
258
+ char.comm = comm_flags & ~CommFlag.COMBINE
278
259
  return "Items will no longer be combined in lists."
279
260
  else:
280
- char.comm = comm_flags | COMM_COMBINE
261
+ char.comm = comm_flags | CommFlag.COMBINE
281
262
  return "Items will now be combined in lists."
282
263
 
283
264
 
284
265
  def do_colour(char: Character, args: str) -> str:
285
266
  """
286
267
  Toggle ANSI color output.
287
-
268
+
288
269
  ROM Reference: src/act_info.c do_colour
289
270
  """
290
- comm_flags = getattr(char, "comm", 0)
291
-
292
- if comm_flags & COMM_NOCOLOUR:
293
- char.comm = comm_flags & ~COMM_NOCOLOUR
294
- return "{RColour{x is now {GON{x."
295
- else:
296
- char.comm = comm_flags | COMM_NOCOLOUR
271
+ act_flags = getattr(char, "act", 0)
272
+
273
+ if act_flags & PlayerFlag.COLOUR:
274
+ char.act = act_flags & ~PlayerFlag.COLOUR
297
275
  return "Colour is now OFF."
276
+ else:
277
+ char.act = act_flags | PlayerFlag.COLOUR
278
+ return "{RColour{x is now {GON{x."
298
279
 
299
280
 
300
281
  # Alias for American spelling
@@ -304,37 +285,37 @@ do_color = do_colour
304
285
  def do_prompt(char: Character, args: str) -> str:
305
286
  """
306
287
  Toggle or set custom prompt.
307
-
288
+
308
289
  ROM Reference: src/act_info.c do_prompt
309
-
290
+
310
291
  Usage:
311
292
  - prompt - Toggle prompt on/off
312
293
  - prompt all - Set default full prompt
313
294
  - prompt <str> - Set custom prompt string
314
295
  """
315
296
  arg = (args or "").strip()
316
-
297
+
317
298
  if not arg:
318
299
  # Toggle prompt
319
300
  comm_flags = getattr(char, "comm", 0)
320
- if comm_flags & COMM_PROMPT:
321
- char.comm = comm_flags & ~COMM_PROMPT
301
+ if comm_flags & CommFlag.PROMPT:
302
+ char.comm = comm_flags & ~CommFlag.PROMPT
322
303
  return "You will no longer see prompts."
323
304
  else:
324
- char.comm = comm_flags | COMM_PROMPT
305
+ char.comm = comm_flags | CommFlag.PROMPT
325
306
  return "You will now see prompts."
326
-
307
+
327
308
  if arg.lower() == "all":
328
309
  # Set default prompt
329
310
  pcdata = getattr(char, "pcdata", None)
330
311
  if pcdata:
331
312
  pcdata.prompt = "<%hhp %mm %vmv> "
332
- char.comm = getattr(char, "comm", 0) | COMM_PROMPT
313
+ char.comm = getattr(char, "comm", 0) | CommFlag.PROMPT
333
314
  return "Prompt set."
334
-
315
+
335
316
  # Custom prompt
336
317
  pcdata = getattr(char, "pcdata", None)
337
318
  if pcdata:
338
319
  pcdata.prompt = arg
339
- char.comm = getattr(char, "comm", 0) | COMM_PROMPT
320
+ char.comm = getattr(char, "comm", 0) | CommFlag.PROMPT
340
321
  return "Prompt set."
mud/commands/character.py CHANGED
@@ -78,7 +78,9 @@ def do_title(ch: Character, args: str) -> str:
78
78
 
79
79
  # Set the title
80
80
  try:
81
- ch.title = args
81
+ pcdata = getattr(ch, "pcdata", None)
82
+ if pcdata:
83
+ pcdata.title = args
82
84
  return "Ok."
83
85
  except Exception as e:
84
86
  return f"Error setting title: {e}"
mud/commands/equipment.py CHANGED
@@ -8,7 +8,7 @@ from __future__ import annotations
8
8
 
9
9
  from typing import TYPE_CHECKING
10
10
 
11
- from mud.models.constants import ItemType, Position, WearLocation
11
+ from mud.models.constants import ItemType, Position, WearFlag, WearLocation
12
12
 
13
13
  if TYPE_CHECKING:
14
14
  from mud.models.character import Character
@@ -45,12 +45,13 @@ def do_wear(ch: Character, args: str) -> str:
45
45
 
46
46
  # Determine where this can be worn
47
47
  wear_flags = getattr(obj, "wear_flags", 0)
48
- item_type = getattr(obj, "item_type", ItemType.TRASH)
48
+ item_type_str = getattr(obj, "item_type", None)
49
+ item_type = int(item_type_str) if item_type_str else ItemType.TRASH
49
50
 
50
51
  # Weapons and held items should use wield/hold
51
52
  if item_type == ItemType.WEAPON:
52
53
  return "You need to wield weapons, not wear them."
53
- if wear_flags & WearLocation.WEAR_HOLD:
54
+ if wear_flags & WearFlag.HOLD:
54
55
  return "You need to hold that, not wear it."
55
56
 
56
57
  # Find appropriate wear location
@@ -73,7 +74,7 @@ def do_wear(ch: Character, args: str) -> str:
73
74
  obj.wear_loc = wear_loc
74
75
 
75
76
  # Remove from inventory
76
- inventory = getattr(ch, "carrying", [])
77
+ inventory = getattr(ch, "inventory", [])
77
78
  if obj in inventory:
78
79
  inventory.remove(obj)
79
80
 
@@ -105,8 +106,9 @@ def do_wield(ch: Character, args: str) -> str:
105
106
  if ch.position < Position.SLEEPING:
106
107
  return "You can't do that right now."
107
108
 
108
- # Check if it's a weapon
109
- item_type = getattr(obj, "item_type", ItemType.TRASH)
109
+ # Check if it's a weapon (item_type is stored as string, enum value is int)
110
+ item_type_str = getattr(obj, "item_type", None)
111
+ item_type = int(item_type_str) if item_type_str else ItemType.TRASH
110
112
  if item_type != ItemType.WEAPON:
111
113
  return "You can't wield that."
112
114
 
@@ -137,7 +139,7 @@ def do_wield(ch: Character, args: str) -> str:
137
139
  obj.wear_loc = wear_loc
138
140
 
139
141
  # Remove from inventory
140
- inventory = getattr(ch, "carrying", [])
142
+ inventory = getattr(ch, "inventory", [])
141
143
  if obj in inventory:
142
144
  inventory.remove(obj)
143
145
 
@@ -171,12 +173,12 @@ def do_hold(ch: Character, args: str) -> str:
171
173
 
172
174
  # Check if it can be held
173
175
  wear_flags = getattr(obj, "wear_flags", 0)
174
- if not (wear_flags & WearLocation.WEAR_HOLD):
176
+ if not (wear_flags & WearFlag.HOLD):
175
177
  return "You can't hold that."
176
178
 
177
179
  # Check if hold slot is occupied
178
180
  equipment = getattr(ch, "equipment", {})
179
- wear_loc = WearLocation.WEAR_HOLD
181
+ wear_loc = WearLocation.HOLD
180
182
 
181
183
  if wear_loc in equipment and equipment[wear_loc] is not None:
182
184
  existing = equipment[wear_loc]
@@ -191,14 +193,15 @@ def do_hold(ch: Character, args: str) -> str:
191
193
  obj.wear_loc = wear_loc
192
194
 
193
195
  # Remove from inventory
194
- inventory = getattr(ch, "carrying", [])
196
+ inventory = getattr(ch, "inventory", [])
195
197
  if obj in inventory:
196
198
  inventory.remove(obj)
197
199
 
198
200
  obj_name = getattr(obj, "short_descr", "something")
199
201
 
200
- # Special message for lights
201
- item_type = getattr(obj, "item_type", ItemType.TRASH)
202
+ # Special message for lights (item_type is stored as string)
203
+ item_type_str = getattr(obj, "item_type", None)
204
+ item_type = int(item_type_str) if item_type_str else ItemType.TRASH
202
205
  if item_type == ItemType.LIGHT:
203
206
  return f"You hold {obj_name} as your light."
204
207
 
@@ -207,7 +210,7 @@ def do_hold(ch: Character, args: str) -> str:
207
210
 
208
211
  def _wear_all(ch: Character) -> str:
209
212
  """Wear all wearable items in inventory."""
210
- inventory = getattr(ch, "carrying", [])
213
+ inventory = getattr(ch, "inventory", [])
211
214
  if not inventory:
212
215
  return "You are not carrying anything."
213
216
 
@@ -218,12 +221,13 @@ def _wear_all(ch: Character) -> str:
218
221
  continue
219
222
 
220
223
  # Skip weapons and held items
221
- item_type = getattr(obj, "item_type", ItemType.TRASH)
224
+ item_type_str = getattr(obj, "item_type", None)
225
+ item_type = int(item_type_str) if item_type_str else ItemType.TRASH
222
226
  wear_flags = getattr(obj, "wear_flags", 0)
223
227
 
224
228
  if item_type == ItemType.WEAPON:
225
229
  continue
226
- if wear_flags & WearLocation.WEAR_HOLD:
230
+ if wear_flags & WearFlag.HOLD:
227
231
  continue
228
232
 
229
233
  # Try to wear it
@@ -255,39 +259,40 @@ def _wear_all(ch: Character) -> str:
255
259
  def _get_wear_location(obj: Object, wear_flags: int) -> WearLocation | None:
256
260
  """Determine which slot an item should be worn in."""
257
261
  # Priority order for wear locations (from ROM)
258
- if wear_flags & WearLocation.WEAR_FINGER:
259
- return WearLocation.WEAR_FINGER
260
- if wear_flags & WearLocation.WEAR_NECK:
261
- return WearLocation.WEAR_NECK
262
- if wear_flags & WearLocation.WEAR_BODY:
263
- return WearLocation.WEAR_BODY
264
- if wear_flags & WearLocation.WEAR_HEAD:
265
- return WearLocation.WEAR_HEAD
266
- if wear_flags & WearLocation.WEAR_LEGS:
267
- return WearLocation.WEAR_LEGS
268
- if wear_flags & WearLocation.WEAR_FEET:
269
- return WearLocation.WEAR_FEET
270
- if wear_flags & WearLocation.WEAR_HANDS:
271
- return WearLocation.WEAR_HANDS
272
- if wear_flags & WearLocation.WEAR_ARMS:
273
- return WearLocation.WEAR_ARMS
274
- if wear_flags & WearLocation.WEAR_ABOUT:
275
- return WearLocation.WEAR_ABOUT
276
- if wear_flags & WearLocation.WEAR_WAIST:
277
- return WearLocation.WEAR_WAIST
278
- if wear_flags & WearLocation.WEAR_WRIST:
279
- return WearLocation.WEAR_WRIST
280
- if wear_flags & WearLocation.WEAR_SHIELD:
281
- return WearLocation.WEAR_SHIELD
282
- if wear_flags & WearLocation.WEAR_FLOAT:
283
- return WearLocation.WEAR_FLOAT
262
+ # Check WearFlag bits and return corresponding WearLocation slot
263
+ if wear_flags & WearFlag.WEAR_FINGER:
264
+ return WearLocation.FINGER_L # Will need multi-slot handling later
265
+ if wear_flags & WearFlag.WEAR_NECK:
266
+ return WearLocation.NECK_1
267
+ if wear_flags & WearFlag.WEAR_BODY:
268
+ return WearLocation.BODY
269
+ if wear_flags & WearFlag.WEAR_HEAD:
270
+ return WearLocation.HEAD
271
+ if wear_flags & WearFlag.WEAR_LEGS:
272
+ return WearLocation.LEGS
273
+ if wear_flags & WearFlag.WEAR_FEET:
274
+ return WearLocation.FEET
275
+ if wear_flags & WearFlag.WEAR_HANDS:
276
+ return WearLocation.HANDS
277
+ if wear_flags & WearFlag.WEAR_ARMS:
278
+ return WearLocation.ARMS
279
+ if wear_flags & WearFlag.WEAR_ABOUT:
280
+ return WearLocation.ABOUT
281
+ if wear_flags & WearFlag.WEAR_WAIST:
282
+ return WearLocation.WAIST
283
+ if wear_flags & WearFlag.WEAR_WRIST:
284
+ return WearLocation.WRIST_L # Will need multi-slot handling later
285
+ if wear_flags & WearFlag.WEAR_SHIELD:
286
+ return WearLocation.SHIELD
287
+ if wear_flags & WearFlag.WEAR_FLOAT:
288
+ return WearLocation.FLOAT
284
289
 
285
290
  return None
286
291
 
287
292
 
288
293
  def _find_obj_inventory(ch: Character, name: str) -> Object | None:
289
294
  """Find an object in character's inventory by name."""
290
- inventory = getattr(ch, "carrying", [])
295
+ inventory = getattr(ch, "inventory", [])
291
296
  if not inventory or not name:
292
297
  return None
293
298