From 4f502a1801a3ed08d777bf117b5b0d101c5810b2 Mon Sep 17 00:00:00 2001 From: kinther Date: Sun, 28 Dec 2025 21:05:26 -0800 Subject: [PATCH] Weight handling update and reducing coin weight --- lib/world/mob/1.mob | 47 +++++++++++++++++++++++++-------------------- src/act.item.c | 3 +++ src/db.c | 3 +++ src/handler.c | 8 +++++++- src/objsave.c | 3 +++ src/roomsave.c | 3 +++ 6 files changed, 45 insertions(+), 22 deletions(-) diff --git a/lib/world/mob/1.mob b/lib/world/mob/1.mob index 948687c..41783ba 100644 --- a/lib/world/mob/1.mob +++ b/lib/world/mob/1.mob @@ -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 diff --git a/src/act.item.c b/src/act.item.c index 88a8742..5173d65 100644 --- a/src/act.item.c +++ b/src/act.item.c @@ -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; diff --git a/src/db.c b/src/db.c index 1cd9b68..b0cef55 100644 --- a/src/db.c +++ b/src/db.c @@ -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); } diff --git a/src/handler.c b/src/handler.c index b23111e..8d6747f 100644 --- a/src/handler.c +++ b/src/handler.c @@ -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; diff --git a/src/objsave.c b/src/objsave.c index 1094cdd..e3800e9 100644 --- a/src/objsave.c +++ b/src/objsave.c @@ -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) { diff --git a/src/roomsave.c b/src/roomsave.c index 81e217a..02a37f3 100644 --- a/src/roomsave.c +++ b/src/roomsave.c @@ -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; }