Welcome to the Builder Academy

Question Autosplit not working

More
19 Mar 2018 20:52 #7724 by Nero
Replied by Nero on topic Autosplit not working
I am using some older files of a Circle Mud so a lot of things are different. The challenge being, integrating what I like from TBAMud's code into this old Circle Mud's code and getting it to work properly since it isn't as simple as copy/paste. So far I have had a lot of success with the happyhour code, getting in there and working out the bugs.

Please Log in or Create an account to join the conversation.

More
19 Mar 2018 22:19 #7726 by thomas
Replied by thomas on topic Autosplit not working
Papaya Pete has it right - you need to add the increase_gold function call (and thus, also the function itself). Otherwise the happy hour gold won't be neither added nor split.

Please Log in or Create an account to join the conversation.

More
19 Mar 2018 22:46 #7728 by Nero
Replied by Nero on topic Autosplit not working
Thanks , I figured this was the case. I added the increase_gold function with the following snippets that Papaya Pete provided but I am still missing something I think. I will continue to work on the increase_gold function but here is an example of what is happening to people when they are grouped and killing mobs while happyhour gold is on (this is with autogold/autosplit enabled):

You get a big pile of gold coins from the corpse of the unfinished mob.
There were 1210 coins.
You split 110 coins among 2 members -- 55 coins each.

Please Log in or Create an account to join the conversation.

More
19 Mar 2018 22:48 #7729 by Nero
Replied by Nero on topic Autosplit not working
When increasing the percentage of the bonus it increases the amount of gold split but its not the full amount being looted from the corpse of the mob..not sure what I am missing with that.

Please Log in or Create an account to join the conversation.

More
20 Mar 2018 21:40 #7742 by thomas
Replied by thomas on topic Autosplit not working
How does the relevant section of fight.c look now?

Please Log in or Create an account to join the conversation.

More
21 Mar 2018 07:02 #7746 by Nero
Replied by Nero on topic Autosplit not working
Here is what I have in fight.c:
Code:
/* Uh oh. Victim died. */ if (GET_POS(victim) == POS_DEAD) { // send_to_char(ch, "DEAD\r\n"); if (ch != victim && (IS_NPC(victim) || victim->desc)) { if (AFF_FLAGGED(ch, AFF_GROUP)) group_gain(ch, victim); else solo_gain(ch, victim); } if (!IS_NPC(victim)) { mudlog(BRF, LVL_IMMORT, TRUE, "%s killed by %s at %s", GET_NAME(victim), GET_NAME(ch), world[IN_ROOM(victim)].name); if (IS_AGGRESSIVE(ch, AGGR_TYPE_MEMORY)) forget(ch, victim); } /* Cant determine GET_GOLD on corpse, so do now and store */ if (IS_NPC(victim)) { if ((IS_HAPPYHOUR) && (IS_HAPPYGOLD)) { happy_gold = (long)(GET_GOLD(victim) * (((float)(HAPPY_GOLD))/(float)100)); happy_gold = MAX(0, happy_gold); increase_gold(victim, happy_gold); } local_gold = GET_GOLD(victim); sprintf(local_buf,"%ld", (long)local_gold); }
Code:
/* transfer gold */ if (GET_GOLD(ch) > 0) { /* * following 'if' clause added to fix gold duplication loophole * The above line apparently refers to the old "partially log in, * kill the game character, then finish login sequence" duping * bug. The duplication has been fixed (knock on wood) but the * test below shall live on, for a while. -gg 3/3/2002 */ if (IS_NPC(ch) && IS_HAPPYGOLD <= 0) { money = create_money(GET_GOLD(ch)); obj_to_obj(money, corpse); } if (IS_NPC(ch) && IS_HAPPYGOLD > 0) { money = create_money(GET_GOLD(ch)+ ((GET_GOLD(ch) * HAPPY_GOLD) / 100)); obj_to_obj(money, corpse); } GET_GOLD(ch) = 0; }

Increase/decrease gold functions in limits.c:
Code:
/* Note: amt may be negative */ int increase_gold(struct char_data *ch, int amt) { int curr_gold; curr_gold = GET_GOLD(ch); if (amt < 0) { GET_GOLD(ch) = MAX(0, curr_gold+amt); /* Validate to prevent overflow */ if (GET_GOLD(ch) > curr_gold) GET_GOLD(ch) = 0; } else { GET_GOLD(ch) = MIN(MAX_GOLD, curr_gold+amt); /* Validate to prevent overflow */ if (GET_GOLD(ch) < curr_gold) GET_GOLD(ch) = MAX_GOLD; } return (GET_GOLD(ch)); }

utils.h:
Code:
int increase_gold(struct char_data *ch, int amt); int decrease_gold(struct char_data *ch, int amt);

Please Log in or Create an account to join the conversation.

Time to create page: 0.212 seconds