Weight handling update and reducing coin weight

This commit is contained in:
kinther 2025-12-28 21:05:26 -08:00
parent cd3743018b
commit 4f502a1801
6 changed files with 45 additions and 22 deletions

View file

@ -16,6 +16,7 @@ B
~
6218 0 0 0 0 0 0 0 0 E
1 3d20+40
@ -34,17 +35,17 @@ Skill 145 5
Skill 146 5
Skill 147 5
E
L 3 118 1
L 5 131 1
L 6 110 1
L 7 108 1
L 8 115 1
L 9 124 1
L 10 107 1
L 11 111 1
L 15 117 1
L 16 117 1
L 17 127 1
L 16 117 1
L 15 117 1
L 11 111 1
L 10 107 1
L 9 124 1
L 8 115 1
L 7 108 1
L 6 110 1
L 5 131 1
L 3 118 1
#101
Sally~
slim lanky human soldier guard~
@ -64,6 +65,7 @@ B
~
6218 0 0 0 0 0 0 0 0 E
1 3d20+40
@ -84,17 +86,17 @@ Skill 152 5
Skill 156 5
Skill 163 5
E
L 17 127 1
L 16 117 1
L 15 117 1
L 11 111 1
L 10 107 1
L 9 124 1
L 8 115 1
L 7 108 1
L 6 110 1
L 5 131 1
L 3 118 1
L 5 131 1
L 6 110 1
L 7 108 1
L 8 115 1
L 9 124 1
L 10 107 1
L 11 111 1
L 15 117 1
L 16 117 1
L 17 127 1
#102
Baldy~
barkeep stocky bald~
@ -114,13 +116,14 @@ B
~
10 0 0 0 0 0 0 0 0 E
1 3d12+60
8 8 1
E
L 14 113 1
L 9 112 1
L 14 113 1
#103
Lanky~
woman lanky scarred~
@ -141,6 +144,7 @@ B
~
10 0 0 0 0 0 0 0 0 E
1 3d8+60
@ -171,6 +175,7 @@ B
It's a rat.
~
8 0 0 0 0 0 0 0 0 E

View file

@ -920,6 +920,9 @@ void weight_change_object(struct obj_data *obj, int weight)
obj_from_char(obj);
GET_OBJ_WEIGHT(obj) += weight;
obj_to_char(obj, tmp_ch);
} else if ((tmp_ch = obj->worn_by)) {
IS_CARRYING_W(tmp_ch) += weight;
GET_OBJ_WEIGHT(obj) += weight;
} else if ((tmp_obj = obj->in_obj)) {
obj_from_obj(obj);
GET_OBJ_WEIGHT(obj) += weight;

View file

@ -2801,6 +2801,9 @@ struct obj_data *read_object(obj_vnum nr, int type) /* and obj_rnum */
copy_proto_script(&obj_proto[i], obj, OBJ_TRIGGER);
assign_triggers(obj, OBJ_TRIGGER);
if (GET_OBJ_TYPE(obj) == ITEM_MONEY)
update_money_obj(obj);
return (obj);
}

View file

@ -569,6 +569,7 @@ void equip_char(struct char_data *ch, struct obj_data *obj, int pos)
GET_EQ(ch, pos) = obj;
obj->worn_by = ch;
obj->worn_on = pos;
IS_CARRYING_W(ch) += GET_OBJ_WEIGHT(obj);
if (GET_OBJ_TYPE(obj) == ITEM_ARMOR)
GET_AC(ch) -= apply_ac(ch, pos);
@ -601,6 +602,7 @@ struct obj_data *unequip_char(struct char_data *ch, int pos)
obj = GET_EQ(ch, pos);
obj->worn_by = NULL;
obj->worn_on = -1;
IS_CARRYING_W(ch) -= GET_OBJ_WEIGHT(obj);
if (GET_OBJ_TYPE(obj) == ITEM_ARMOR)
GET_AC(ch) += apply_ac(ch, pos);
@ -798,6 +800,8 @@ void obj_to_obj(struct obj_data *obj, struct obj_data *obj_to)
GET_OBJ_WEIGHT(tmp_obj) += GET_OBJ_WEIGHT(obj);
if (tmp_obj->carried_by)
IS_CARRYING_W(tmp_obj->carried_by) += GET_OBJ_WEIGHT(obj);
else if (tmp_obj->worn_by)
IS_CARRYING_W(tmp_obj->worn_by) += GET_OBJ_WEIGHT(obj);
}
}
@ -831,6 +835,8 @@ void obj_from_obj(struct obj_data *obj)
GET_OBJ_WEIGHT(temp) -= GET_OBJ_WEIGHT(obj);
if (temp->carried_by)
IS_CARRYING_W(temp->carried_by) -= GET_OBJ_WEIGHT(obj);
else if (temp->worn_by)
IS_CARRYING_W(temp->worn_by) -= GET_OBJ_WEIGHT(obj);
}
obj->in_obj = NULL;
obj->next_content = NULL;
@ -1456,7 +1462,7 @@ int get_obj_pos_in_equip_vis(struct char_data *ch, char *arg, int *number, struc
static int money_weight(int amount)
{
const int coins_per_weight = 10;
const int coins_per_weight = 30;
if (amount <= 0)
return 0;

View file

@ -573,6 +573,9 @@ obj_save_data *objsave_parse_objects(FILE *fl)
void commit_current(void) {
if (!temp) return;
if (GET_OBJ_TYPE(temp) == ITEM_MONEY)
update_money_obj(temp);
/* sanitize top-level locate range only; children will be negative later */
int loc = pending_locate;
if (pending_nest <= 0) {

View file

@ -182,6 +182,9 @@ static struct obj_data *roomsave_read_list_ctx(FILE *fl, int stop_on_E)
}
/* Append to this scope's list */
if (GET_OBJ_TYPE(obj) == ITEM_MONEY)
update_money_obj(obj);
obj->next_content = NULL;
if (!head) head = tail = obj;
else { tail->next_content = obj; tail = obj; }