It's always the stupidest things! We had it right in
the first place.

Original Code:
temp1 = 
( obj->value[1] * 
( clan_table[clan_lookup(player_clan(ch))].taxrate /
100) );

New Code:
temp1 = 
( obj->value[1] *
clan_table[clan_lookup(player_clan(ch))].taxrate / 100
);

I had an extra set of parenthesis in there separating
the object's value from the tax calculation. The
result was always going to be zero. The MUD was going
through the code, but not doing anything because temp1
was always zero.

Mike, thank you for your help!

- Maurice

-----Original Message-----
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On
Behalf Of Michael That is strange, because it looks
pretty good.

This is one of those times that gdb is very helpful.

If you don't know gdb, making a few send_to_char calls
spread around
there can tell you what parts of the code are being
executed, what the
values of variables are, etc.

On 12/10/05, Maurice Visser <[EMAIL PROTECTED]> wrote:
> I actually put my little code into the ITEM_MONEY
> section there, but it doesn't seem to do anything.
> Even without the check to see if it's coming from a
> corpse. Strange. I'll keep looking.
>
> Maurice
>
>
>
> -----Original Message-----
>
> You can do it in do_get, search for ITEM_MONEY.  It
> should have something like:
>     if ( obj->item_type == ITEM_MONEY)
>     {
>         ch->silver += obj->value[0];
>         ch->gold += obj->value[1];
> You might put something like this in next:
>   if (container && container->item_type ==
> ITEM_CORPSE_NPC)
>   {
>    ...
>   }
> so it only affects money looted from mob corpses,
not
> money they drop
> and pick up or whatever.
>
> Alternatively, you could work it into raw_kill in
> fight.c, before the
> call to make_corpse.  In that case, you would pull
the
> money directly
> from the mob's CHAR_DATA before it's made into a
money
> object.  Then
> the mob's gold would be in victim->gold.  And there
> wouldn't be an
> obj.
>
>
> On 12/10/05, Maurice Visser <[EMAIL PROTECTED]>
wrote:
> > Quick question. I'm trying to implement a clan tax
> for
> > my guild system. I'd like it to take clan.taxrate
of
> > the gold from killing a mob (mob's wealth) and put
> it
> > into the clan.account. I have the code set up
> already.
> > I'm just not sure where I have to put it. I'm
> looking
> > through do_get, but can't seem to figure it out.
> >
> >
> >
> >   /* clan tax time */
> >
> >
> >
> >   if ( ( is_clan(ch) ) &&
> >      (
> > clan_table[clan_lookup(player_clan(ch))].taxrate >
0
> )
> > )
> >   {
> >        temp1 = ( obj->value[1] *
> > /* <---- I need the variable name of the mob's
> wealth
> > */
> >        (
> > clan_table[clan_lookup(player_clan(ch))].taxrate /
> > 100) );
> >
> >        if ( (temp1 > .5) && (temp1 < 1) )
> >
> >                 temp1 = 1;
> >
> >
> >
> >             if ( (temp1 < .5) )
> >
> >                 temp1 = 0;
> >
> >
> >
> >             if ( temp1 > 0 )
> >
> >             {
> >
> >                 sprintf( buf, "{WYour clan taxes
you
> > {Y%d {Wcoins.{x\n\r", temp1 );
> >
> >                 send_to_char( buf, ch );
> >
> >
> >
> >
> > clan_table[clan_lookup(player_clan(ch))].account
+=
> > temp1;
> >
> >                 save_guilds( ch, "all" );
> >
> >
> >
> >                 ch->gold -= temp1;
> >
> >             }
> >
> >         }
-- 
ROM mailing list
[email protected]
Unsubscribe here ->>> http://www.rom.org/cgi-bin/mailman/listinfo/rom

Reply via email to