Login
User Name:

Password:



Register

Forgot your password?
do_owhere recursive
Author: Khonsu
Submitted by: Khonsu
Changes list / Addchange
Author: Khonsu
Submitted by: Khonsu
6Dragons mp3 sound pack
Author: Vladaar
Submitted by: Vladaar
AFKMud 2.2.3
Author: AFKMud Team
Submitted by: Samson
SWFOTEFUSS 1.5
Author: Various
Submitted by: Samson
Users Online
Bing, AhrefsBot, Gdub

Members: 1
Guests: 47
Stats
Files
Topics
Posts
Members
Newest Member
489
3,792
19,646
597
Aileenutz

Today's Birthdays
There are no member birthdays today.
» SmaugMuds » Codebases » LoP Codebase » Lottery
Forum Rules | Mark all | Recent Posts

Lottery
< Newer Topic :: Older Topic > Thoughts and ideas on the lottery?

Pages:<< prev 1, 2, 3, 4 next >>
Post is unread #41 Sep 4, 2013 9:39 pm   
Go to the top of the page
Go to the bottom of the page

dbna2
Sorcerer
GroupMembers
Posts600
JoinedDec 3, 2008

 
eh I wouldn't even know how to make it for objs too.

Post is unread #42 Sep 4, 2013 9:48 pm   
Go to the top of the page
Go to the bottom of the page

Remcon
Geomancer
GroupAdministrators
Posts1,917
JoinedJul 26, 2005

 
obj would be fairly simple, just add in a vnum and then if someone wins the jackpot, when they claim have it create the object and give it to them :)

btw

Instead of claiming should have looked, It doubles well. There isn't a history claiming clears off you as a winner and if no more winners it clears that drawing info.

wow when I was looking over the post I said this earlier this morning and looking back i see that it could easily come off as rude. I meant you should have looked at the winnings using lottery instead of claiming the winnings because they are cleared when you do. It should double well because I tested that quite a few times :)

Post is unread #43 Sep 8, 2013 4:24 am   
Go to the top of the page
Go to the bottom of the page

dbna2
Sorcerer
GroupMembers
Posts600
JoinedDec 3, 2008

 
can you post the thing you did for the logon check?

Post is unread #44 Sep 8, 2013 9:54 am   
Go to the top of the page
Go to the bottom of the page

Remcon
Geomancer
GroupAdministrators
Posts1,917
JoinedJul 26, 2005

 
void has_winnings( CHAR_DATA *ch )
{
   LOTTERY_DATA *lottery;
   LHISTORY_DATA *lhistory;
   LWINNER_DATA *lwinner;
   int cntwins = 0;

   if( !ch )
      return;

   for( lottery = first_lottery; lottery; lottery = lottery->next )
   {
      for( lhistory = lottery->first_lhistory; lhistory; lhistory = lhistory->next )
      {
         if( !lhistory->drawn )
            continue;

         for( lwinner = lhistory->first_lwinner; lwinner; lwinner = lwinner->next )
         {
            if( !str_cmp( lwinner->winner, ch->name ) )
               cntwins++;
         }
      }
   }

   if( cntwins > 0 )
      ch_printf( ch, "&[plain]You have %d wins in the lottery waiting for you to claim them.\r\n", cntwins );
}

Post is unread #45 Sep 8, 2013 1:53 pm   
Go to the top of the page
Go to the bottom of the page

dbna2
Sorcerer
GroupMembers
Posts600
JoinedDec 3, 2008

 
Winnings does not take into account if the pwipe is gone or renamed.

Post is unread #46 Sep 8, 2013 5:11 pm   Last edited Sep 8, 2013 6:50 pm by Remcon
Go to the top of the page
Go to the bottom of the page

Remcon
Geomancer
GroupAdministrators
Posts1,917
JoinedJul 26, 2005

 
nope but both might be good things to consider lol

Edit: ok, next release should handle renaming and deleting/destroying/etc...

Post is unread #47 Sep 9, 2013 5:31 pm   
Go to the top of the page
Go to the bottom of the page

dbna2
Sorcerer
GroupMembers
Posts600
JoinedDec 3, 2008

 
[Info] ::The Raffle lottery numbers have been drawn.::
[Info] ::A winner was not drawn for this lotto, so the jackpot will continue over::

Maybe I have this set up wrong?

#LOTTERY
Name Raffle~
Jackpot 290
TimeToDraw 1378852195
Price 100
Tickets 2
AutoRedraw
Raffle
History 2~ TRUE
History ~ FALSE
Winner Isshin~ 1~ 0
Winner Hokai~ 2~ 0

Post is unread #48 Sep 9, 2013 5:34 pm   
Go to the top of the page
Go to the bottom of the page

dbna2
Sorcerer
GroupMembers
Posts600
JoinedDec 3, 2008

 
Also I have a question about your account system is that the way you plan on having people log in now? and how player files will be stored, because I have some ideas for that kind of system.

Post is unread #49 Sep 9, 2013 5:51 pm   Last edited Sep 9, 2013 6:26 pm by dbna2
Go to the top of the page
Go to the bottom of the page

dbna2
Sorcerer
GroupMembers
Posts600
JoinedDec 3, 2008

 
Also in the new update

around 1175 you will find a repeat ifcheck which causes the jackpot to show twice.

Post is unread #50 Sep 9, 2013 6:28 pm   Last edited Sep 9, 2013 7:08 pm by dbna2
Go to the top of the page
Go to the bottom of the page

dbna2
Sorcerer
GroupMembers
Posts600
JoinedDec 3, 2008

 
Also not sure if you meant to not add it or not, but the function you made to have it show the next drawing on who isn't in the update.

And I have changed this one to read obj names, but for some reason it crashes and gdb isn't giving me any info on why....


char *display_nextdrawing( void )
{
   LOTTERY_DATA *lottery, *lotdraw = NULL;
   int jack = 0;
   time_t nextdraw = 0;
   static char buf[MIL];
   bool foundfirst =FALSE;
   OBJ_INDEX_DATA *oindex;

   for( lottery = first_lottery; lottery; lottery = lottery->next )
   {
      /* There is some reason it hasn't been drawn so skip it */
      if( lottery->timetodraw < current_time )
         continue;
      if( !foundfirst || lottery->timetodraw < nextdraw )
      {
         lotdraw = lottery;
         nextdraw = lottery->timetodraw;
		 jack = lottery->jackpot;
      }
      foundfirst = TRUE;
   }
   if( !lotdraw )
      snprintf( buf, sizeof( buf ), "%s", "&WThere is currently no lottery set to be drawn." );
   else
   {
     if( lottery->lwtype == LW_GOLD )
      snprintf( buf, sizeof( buf ), "&Y%s&W will be drawn at &Y%s&W. Current Jackpot: &Y%s&D", lotdraw->name, distime( nextdraw ), format_pl(jack) );
	 else if( lottery->lwtype == LW_GLORY )
      snprintf( buf, sizeof( buf ), "&Y%s&W will be drawn at &Y%s&W. Current Jackpot: &Y%s&D", lotdraw->name, distime( nextdraw ), format_pl(jack) );
	 else if( lottery->lwtype == LW_OBJ )
   {

     if( !( oindex = get_obj_index(lottery->jackpot ) ) )
      snprintf( buf, sizeof( buf ), "&Y%s&W will be drawn at &Y%s&W. Current Jackpot: &Y*BUG* Item Not Found&D", lotdraw->name, distime( nextdraw ) );
     else
      snprintf( buf, sizeof( buf ), "&Y%s&W will be drawn at &Y%s&W. Current Jackpot: &Y%s&D", lotdraw->name, distime( nextdraw ), oindex->short_descr );
    }
	else
	      snprintf( buf, sizeof( buf ), "&Y%s&W will be drawn at &Y%s&W. Current Jackpot: &Y%s&D", lotdraw->name, distime( nextdraw ), format_pl(jack) );

   }
   return buf;
}

Post is unread #51 Sep 9, 2013 9:44 pm   Last edited Sep 9, 2013 9:48 pm by Remcon
Go to the top of the page
Go to the bottom of the page

Remcon
Geomancer
GroupAdministrators
Posts1,917
JoinedJul 26, 2005

 
[Info] ::The Raffle lottery numbers have been drawn.:: 
[Info] ::A winner was not drawn for this lotto, so the jackpot will continue over:: 

Maybe I have this set up wrong? 

#LOTTERY 
Name Raffle~ 
Jackpot 290 
TimeToDraw 1378852195 
Price 100 
Tickets 2 
AutoRedraw 
Raffle 
History 2~ TRUE 
History ~ FALSE 
Winner Isshin~ 1~ 0 
Winner Hokai~ 2~ 0

around line 274 find
      if( matchednums == lottery->numbers )

change it to
      if( ( matchednums == lottery->numbers ) || ( lottery->raffle && matchednums == 1 ) )

My fault looks like i missed updating it lol.

Also I have a question about your account system is that the way you plan on having people log in now? and how player files will be stored, because I have some ideas for that kind of system. 

That was just to make it easier for people to set up the system for a basic guide, I plan to change it a whole lot, I welcome all ideas on it, but please put it in another topic :)

Also in the new update 

around 1175 you will find a repeat ifcheck which causes the jackpot to show twice.

            if( lottery->lwtype == LW_OBJ )
            {
               if( !( oindex = get_obj_index( lottery->jackpot ) ) )
                  ch_printf( ch, "Jackpot:         %d, object doesn't exist.", lottery->jackpot );
               else
                  ch_printf( ch, "Jackpot:         %s", oindex->short_descr );
            }
            else
               ch_printf( ch, "Jackpot:         %d\r\n", lottery->jackpot );

            if( lottery->lwtype == LW_OBJ )
            {
               if( !( oindex = get_obj_index( lottery->basejackpot ) ) )
                  ch_printf( ch, "BaseJackpot:     %d, object doesn't exist.", lottery->basejackpot );
               else
                  ch_printf( ch, "BaseJackpot:     %s", oindex->short_descr );
            }
            else
            ch_printf( ch, "BaseJackpot:     %d\r\n", lottery->basejackpot );


These? it shouldn't if it is an object it should show the info if not it shows it doesn't exist, if not an object it will show the jackpot. Notice the second is basejackpot.

char *display_nextdrawing( void )
{
   LOTTERY_DATA *lottery, *lotdraw = NULL;
   int jack = 0;
   time_t nextdraw = 0;
   static char buf[MIL];
   bool foundfirst =FALSE;
   OBJ_INDEX_DATA *oindex;

   for( lottery = first_lottery; lottery; lottery = lottery->next )
   {
      /* There is some reason it hasn't been drawn so skip it */
      if( lottery->timetodraw < current_time )
         continue;
      if( !foundfirst || lottery->timetodraw < nextdraw )
      {
         lotdraw = lottery;
         nextdraw = lottery->timetodraw;
		 jack = lottery->jackpot;
      }
      foundfirst = TRUE;
   }
   if( !lotdraw )
      snprintf( buf, sizeof( buf ), "%s", "&WThere is currently no lottery set to be drawn." );
   else
   {
      if( lottery->lwtype == LW_GOLD )
         snprintf( buf, sizeof( buf ), "&Y%s&W will be drawn at &Y%s&W. Current Jackpot: &Y%s&D", lotdraw->name, distime( nextdraw ), format_pl(jack) );
      else if( lottery->lwtype == LW_GLORY )
         snprintf( buf, sizeof( buf ), "&Y%s&W will be drawn at &Y%s&W. Current Jackpot: &Y%s&D", lotdraw->name, distime( nextdraw ), format_pl(jack) );
      else if( lottery->lwtype == LW_OBJ )
      {
         if( !( oindex = get_obj_index(lottery->jackpot ) ) )
            snprintf( buf, sizeof( buf ), "&Y%s&W will be drawn at &Y%s&W. Current Jackpot: &Y*BUG* Item Not Found&D", lotdraw->name, distime( nextdraw ) );
         else
            snprintf( buf, sizeof( buf ), "&Y%s&W will be drawn at &Y%s&W. Current Jackpot: &Y%s&D", lotdraw->name, distime( nextdraw ), oindex->short_descr );
      }
      else
         snprintf( buf, sizeof( buf ), "&Y%s&W will be drawn at &Y%s&W. Current Jackpot: &Y%s&D", lotdraw->name, distime( nextdraw ), format_pl(jack) );
   }
   return buf;
}

The reason it is crashing is the lottery->lwtype ==, change them to lotdraw->lwtype == and the oindex = get_obj_index( lottery->jackpot ) change lottery to lotdraw
Also it will be added in the next update.

Post is unread #52 Sep 10, 2013 10:29 am   
Go to the top of the page
Go to the bottom of the page

dbna2
Sorcerer
GroupMembers
Posts600
JoinedDec 3, 2008

 
A sorry misread the ifcheck for the jackpot thanks :) so far I haven't had too many issues with it. Other then the ones posted here it seems to be working perfect.

Post is unread #53 Sep 10, 2013 11:08 am   
Go to the top of the page
Go to the bottom of the page

dbna2
Sorcerer
GroupMembers
Posts600
JoinedDec 3, 2008

 
K bug with Objs type

Log: [*****] BUG: do_lottery: lottery->jackpot 8143898, object doesn't exist.

But it does exist.

Post is unread #54 Sep 10, 2013 11:26 am   
Go to the top of the page
Go to the bottom of the page

dbna2
Sorcerer
GroupMembers
Posts600
JoinedDec 3, 2008

 
I see why its because if the type is obj buying tickets still add to the jackpott

Post is unread #55 Sep 10, 2013 2:15 pm   
Go to the top of the page
Go to the bottom of the page

Remcon
Geomancer
GroupAdministrators
Posts1,917
JoinedJul 26, 2005

 
ah kk thanks probably good idea to fix that lol i hadn't tested objects just tossed them in haha

Post is unread #56 Sep 10, 2013 2:16 pm   
Go to the top of the page
Go to the bottom of the page

Remcon
Geomancer
GroupAdministrators
Posts1,917
JoinedJul 26, 2005

 
actually in mine and the release it already has
         /* Only increase for gold */
         if( lottery->lwtype == LW_GOLD )
            lottery->jackpot += (int)( (double)( ( lottery->price * lottery->jpercent ) / 100 ) );

Post is unread #57 Sep 12, 2013 1:04 pm   
Go to the top of the page
Go to the bottom of the page

dbna2
Sorcerer
GroupMembers
Posts600
JoinedDec 3, 2008

 
Had a raffle set up with autoredraw turned off, but by the time it went through autoredraw was turned to TRUE again.

Post is unread #58 Sep 12, 2013 3:40 pm   
Go to the top of the page
Go to the bottom of the page

Remcon
Geomancer
GroupAdministrators
Posts1,917
JoinedJul 26, 2005

 
ok ill look at it when I have time :) ty

Post is unread #59 Sep 12, 2013 9:24 pm   
Go to the top of the page
Go to the bottom of the page

Remcon
Geomancer
GroupAdministrators
Posts1,917
JoinedJul 26, 2005

 
in the new_lottery find
   lottery->drawdifflast = false;
   lottery->matchorder = false;
   lottery->autoredraw = true;
   lottery->raffle = false;

just change autoredraw = true to = false since when it loads them it setting it to true by default is what is causing the issue lol

Post is unread #60 Sep 13, 2013 11:32 am   
Go to the top of the page
Go to the bottom of the page

dbna2
Sorcerer
GroupMembers
Posts600
JoinedDec 3, 2008

 
Well with that I am sure the lottery system is bug free now. I have tested every kind there is.

Pages:<< prev 1, 2, 3, 4 next >>