RunUO Community

This is a sample guest message. Register a free account today to become a member! Once signed in, you'll be able to participate on this site by adding your own topics and posts, as well as connect with other members through your own private inbox!

Gambler NPC - 2D/3D version *updated*

Status
Not open for further replies.
Umm AOS Doesnt come with verdata.mul Anymore

I have just recently bought AOS cd and installed it but I noticed that they stopped putting the verdata.mul in the UO folders after installations, so therefore I have a problem :rolleyes: ... anyway it'd be nice if someone patched everything for me and made a verdata with nothin' on it but this patch for the gambler script Please Help me guyz I know someone will. Thnx Lots! ;)

WoOt I am the 100th Poster on this ToPic HaHa! :p
 

Zulu

Wanderer
You can download the gambler2.zip and rename the patch.uop to verdata.mul and put it in your uo directory.
 

lovemenow

Wanderer
ok here is my edited script. it is working flawlessly on my shard. I do not use versoin 2 howevr because of conflicts with another custom verdata.

[code:1]// gambler npc by zulu updated Oct 20
using System;
using Server;
using Server.Items;
using Server.Network;
using Server.Gumps;
using System.Collections;

namespace Server.Mobiles
{

public class Gambler : BaseCreature
{
private int m_current_card = 53;
private int [] Cardz = new int[53];
private int [] dealercards = new int[5];
private int [] playercards = new int[5];
private int [] gamestats = new int[6]; // win-loss-tie
private int playerbet = 100;
private bool roundend;
private bool dealercardhidden;
private bool busy;
private string pokermsg ="";
private int dwin = 0;
private int pwin = 0;
private Mobile m_player;

[Constructable]
public Gambler() : base( AIType.AI_Melee, FightMode.None, 10, 1, 0.8, 3.0 )
{
SetStr( 10, 30 );
SetDex( 10, 30 );
SetInt( 10, 30 );

Fame = 50;
Karma = 50;
SpeechHue = Utility.RandomDyedHue();
Title = "the gambler";
Hue = Utility.RandomSkinHue();
Blessed = true;

if ( this.Female = Utility.RandomBool() )
{
this.Body = 0x191;
this.Name = NameList.RandomName( "female" );
Item hair = new Item( Utility.RandomList( 0x203B, 0x203C, 0x203D, 0x2045, 0x204A, 0x2046 , 0x2049 ) );
hair.Hue = Utility.RandomHairHue();
hair.Layer = Layer.Hair;
hair.Movable = false;
AddItem( hair );
Item hat = null;
switch ( Utility.Random( 5 ) )
{
case 0: hat = new FloppyHat( Utility.RandomNeutralHue() ); break;
case 1: hat = new FeatheredHat( Utility.RandomNeutralHue() ); break;
case 2: hat = new Bonnet(); break;
case 3: hat = new Cap( Utility.RandomNeutralHue() ); break;
}
AddItem( hat );
}
else
{
this.Body = 0x190;
this.Name = NameList.RandomName( "male" );
Item hair = new Item( Utility.RandomList( 0x203B, 0x203C, 0x203D, 0x2044, 0x2045, 0x2047, 0x2048 ) );
hair.Hue = Utility.RandomHairHue();
hair.Layer = Layer.Hair;
hair.Movable = false;
AddItem( hair );
Item beard = new Item( Utility.RandomList( 0x0000, 0x203E, 0x203F, 0x2040, 0x2041, 0x2067, 0x2068, 0x2069 ) );
beard.Hue = hair.Hue;
beard.Layer = Layer.FacialHair;
beard.Movable = false;
AddItem( beard );
Item hat = null;
switch ( Utility.Random( 7 ) )
{
case 0: hat = new SkullCap( GetRandomHue() ); break;
case 1: hat = new Bandana( GetRandomHue() ); break;
case 2: hat = new WideBrimHat(); break;
case 3: hat = new TallStrawHat( Utility.RandomNeutralHue() ); break;
case 4: hat = new StrawHat( Utility.RandomNeutralHue() ); break;
case 5: hat = new TricorneHat( Utility.RandomNeutralHue() ); break;
}
AddItem( hat );
}
AddItem( new LongPants( GetRandomHue() ) );
AddItem( new FancyShirt( GetRandomHue() ) );
AddItem( new Boots( Utility.RandomNeutralHue() ) );
AddItem( new Cloak( GetRandomHue() ) );
AddItem( new BodySash( GetRandomHue() ) );

Container pack = new Backpack();

pack.DropItem( new Gold( 5, 500 ) );

pack.Movable = false;
pack.Visible = false;

AddItem( pack );

//reset stats
for ( int i = 0; i <= 5; ++i )
gamestats=0;
}

public override bool HandlesOnSpeech( Mobile from )
{
if ( from.InRange( this.Location, 12 ) )
return true;

return base.HandlesOnSpeech( from );
}

public override void OnSpeech( SpeechEventArgs e )
{
base.OnSpeech( e );

Mobile from = e.Mobile;

if ( from.InRange( this, 4 ))
{
if (m_player != null)
{
if ( m_player.NetState == null )
busy = false;
}
if (e.Speech.ToLower() == "hello" || e.Speech.ToLower() == "hi" || e.Speech.ToLower() == "vendor")
{
string message = "Let's play blackjack or poker.";
this.Say( message );
}
else if (e.Speech.ToLower() == "play")
{
string message = "Would you like to play blackjack or poker.";
this.Say( message );
}
else if (e.Speech.ToLower() == "reset")
{
if ( from.AccessLevel >= AccessLevel.Seer )
{
busy = false;
string message = "I am no longer busy playing cards.";
this.Say( message );
}
}
else if (e.Speech.ToLower() == "blackjack")
{
if (!busy)
{
playerbet = 100;
busy = true;
roundend = true;
m_current_card = 53;
dealercardhidden = false;
dwin = 0;
pwin = 0;

dealercards[0]=12;
playercards[0]=13;
dealercards[1]=11;
playercards[1]=26;

for ( int i = 2; i <= 4; ++i )
{
dealercards=0;
playercards=0;
}
pokermsg = "© 2003 Zulu Hotel";

string message = "So, you want to try your luck.";
this.Say( message );

m_player = from;
playblackjack( from );
}
else if ( m_player.NetState == from.NetState )
{
from.CloseGump( typeof( PokerGump ) );
from.CloseGump( typeof( BlackjackGump ) );
busy = false;
roundend = true;
m_current_card = 53;
playerbet = 100;
pwin = 0;
dwin = 0;
playblackjack( from );
}
else
{
string message = "I am busy playing cards.";
this.Say( message );
}
}

else if (e.Speech.ToLower() == "poker")
{
if (!busy)
{
playerbet = 100;
busy = true;
roundend = true;
m_current_card = 53;
pwin = 0;
dwin = 0;
for ( int i = 0; i <= 4; ++i )
playercards=35+i;

pokermsg = "© 2003 Zulu Hotel";

m_player = from;
playpoker( from );
string message = "So, you want to try your luck.";
this.Say( message );
}
else if ( m_player.NetState == from.NetState )
{
from.CloseGump( typeof( PokerGump ) );
from.CloseGump( typeof( BlackjackGump ) );
roundend = true;
m_current_card = 53;
playerbet = 100;
pwin = 0;
dwin = 0;
playpoker( from );
}
else
{
string message = "I am busy playing cards.";
this.Say( message );
}

}
}
}

public void payplayer( Mobile from, int quantity)
{
from.AddToBackpack( new Gold( quantity ) );
}

public bool paydealer( Mobile from, int quantity)
{
return from.Backpack.ConsumeTotal( typeof( Gold ), quantity );
}

public string CardSuit( int card )
{
if (card>=1 && card<=13)
return "C";
else if (card>=14 && card <=26)
return "D";
else if (card>=27 && card <=39)
return "H";
else
return "S";
}

public string CardName( int card )
{
while (card>13)
card -= 13;

if(card==1)
return "A";
else if(card == 11)
return "J";
else if(card == 12)
return "Q";
else if(card == 13)
return "K";
else
return "" + card;
}

public int CardValue( int card )
{
while (card>13)
card -= 13;

if(card==1)
return 11;

if(card>10)
return 10;

return card;
}

public int CardValue2( int card )
{
while (card>13)
card -= 13;

if(card==1)
return 14;

return card;
}

public void ShuffleCards( )
{
int i, tempcard , tempcard2;

for ( i = 1; i < 53; ++i )
Cardz=i;

for ( i = 52; i >= 1; --i )
{
tempcard = Utility.Random( i )+1;
tempcard2 = Cardz[tempcard];
Cardz[tempcard] = Cardz;
Cardz = tempcard2;
}
m_current_card = 1;
}

public int pickcard(Mobile from)
{
if (m_current_card == 53)
{
Effects.PlaySound( from.Location, from.Map, 0x3D );
ShuffleCards( );
}

return Cardz[m_current_card++];
}

public void playblackjack( Mobile from )
{
from.SendGump( new BlackjackGump( this, this ) );
}

public void playpoker( Mobile from )
{
from.SendGump( new PokerGump( this, this ) );
}

public override bool DisallowAllMoves
{
get { return true; }
}

public override void OnDoubleClick( Mobile from )
{
if ( from.AccessLevel >= AccessLevel.Seer )
from.SendGump( new GamblerStatsGump( this ) );
else
base.OnDoubleClick( from );
}

public Gambler( Serial serial ) : base( serial )
{
}

private int GetRandomHue()
{
switch ( Utility.Random( 6 ) )
{
default:
case 0: return 0;
case 1: return Utility.RandomBlueHue();
case 2: return Utility.RandomGreenHue();
case 3: return Utility.RandomRedHue();
case 4: return Utility.RandomYellowHue();
case 5: return Utility.RandomNeutralHue();
}
}

public class GamblerStatsGump : Gump
{

private Gambler m_From;

public GamblerStatsGump( Gambler gambler ) : base( 10, 10 )
{
m_From = gambler;

AddPage( 0 );

AddBackground( 30, 100, 90, 160, 5120 );

AddLabel( 45, 100, 70, "Blackjack" );
AddLabel( 45, 115, 600, "Wins: "+m_From.gamestats[0] );
AddLabel( 45, 130, 600, "Loss: "+m_From.gamestats[1] );
AddLabel( 45, 145, 600, "Tied: "+m_From.gamestats[2] );

AddLabel( 45, 165, 70, "Poker" );
AddLabel( 45, 180, 600, "Wins: "+m_From.gamestats[3] );
AddLabel( 45, 195, 600, "Loss: "+m_From.gamestats[4] );
AddLabel( 45, 210, 600, "Tied: "+m_From.gamestats[5] );

AddLabel( 45, 230, 1500, "Reset" );

AddButton( 85, 235, 2117, 2118, 101, GumpButtonType.Reply, 0 );
}

public override void OnResponse( NetState sender, RelayInfo info )
{

switch ( info.ButtonID )
{
case 101:
{ // reset
for ( int i = 0; i <= 5; ++i )
m_From.gamestats=0;
break;
}
}
}
}

public class PokerGump : Gump
{

private Gambler m_From;

public PokerGump( Mobile mobile, Gambler gambler ) : base( 10, 10 )
{
m_From = gambler;

int i,suitcolor=0;
string cardtemp="Player:";

Closable = false;

AddPage( 0 );

AddBackground( 30, 100, 285, 100, 5120 );
AddBackground( 30, 200, 285, 60, 5120 );

if (m_From.dwin==2||m_From.dwin==1)
cardtemp="Player: 1";

AddLabel( 45, 109, 600, cardtemp );
AddButton( 300, 103, 2360, 2361, 666, GumpButtonType.Reply, 0 );
if (m_From.pwin>0)
AddLabel( 45, 129, 70, ""+m_From.pwin );

//show player cards
for ( i = 0; i <= 4; ++i )
{
if (m_From.dwin==1)
m_From.playercards=m_From.pickcard(mobile);

if (m_From.playercards>0)
{
AddBackground( 65 + ((i+1)*40), 108, 35, 50, 2171 );

suitcolor = 0;
cardtemp = m_From.CardSuit( m_From.playercards );
if ( cardtemp == "D" || cardtemp == "H" )
suitcolor = 32;
AddLabel( 80 + ((i+1)*40), 134, suitcolor, cardtemp );
AddLabel( 72 + ((i+1)*40), 113, 600, m_From.CardName( m_From.playercards ) );
if (m_From.dwin==1||m_From.dwin==2)
{ AddCheck( 74 + ((i+1)*40), 162, 210, 211, false, (i+1) ); }
else
{ AddImage( 74 + ((i+1)*40), 162, 210 ); }

AddLabel( 70 + ((i+1)*40), 180, 500, "Hold" );
}
}

AddLabel( 240, 205, 800, "Deal" );
AddButton( 220, 208, 2117, 2118, 101, GumpButtonType.Reply, 0 );

AddLabel( 110, 205, 800, "Bet:" );
AddLabel( 160, 205, 800, ""+m_From.playerbet );
AddButton( 140, 208, 2117, 2118, 105, GumpButtonType.Reply, 0 );

AddLabel( 130, 230, 64, m_From.pokermsg );

if (m_From.dwin==1)
m_From.dwin=2;

if (m_From.dwin==3)
{
m_From.dwin=0;
m_From.roundend = true;
}
}


public override void OnResponse( NetState sender, RelayInfo info )
{
Mobile from = sender.Mobile;
int i;

switch ( info.ButtonID )
{
case 101:
{ //deal
m_From.pokermsg = "© 2003 Zulu Hotel";

if (!from.InRange( m_From.Location, 4 ))
{
m_From.roundend = true;
m_From.busy = false;
}
else
{
if (m_From.dwin==0)
{
if (m_From.paydealer( from, m_From.playerbet))
{
if ((m_From.m_current_card + 10) > 52)
{
Effects.PlaySound( from.Location, from.Map, 0x3D );
m_From.ShuffleCards();
}

for ( i = 0; i <= 4; ++i )
m_From.playercards=0;
m_From.dwin=1;
m_From.roundend = false;
m_From.pokermsg = "Check which cards you would like to hold.";
}
else
{
m_From.pokermsg = "You need more money!";
}
}
else if (m_From.dwin==2)
{
m_From.dwin=3;

ArrayList Selections = new ArrayList( info.Switches );

for ( i = 0; i <= 4; ++i )
{
if (Selections.Contains( i+1 ) == false )
m_From.playercards=m_From.pickcard(from);
}
finishpokergame(from);
}
}
from.SendGump( new PokerGump( from, m_From ) );
break;
}
case 105:
{ // bet
if (m_From.roundend)
{
m_From.playerbet += 100;
if (m_From.playerbet > 500)
m_From.playerbet = 100;
}
from.SendGump( new PokerGump( from, m_From ) );
break;
}
case 666:
{ // quit
m_From.roundend = true;
m_From.busy = false;
Effects.PlaySound( from.Location, from.Map, 0x1e9 );
break;
}

}
}


public void finishpokergame(Mobile from)
{
int i,match1=0,match2=0,match3=0,match4=0,match5=0,temp=0;
bool isStrt=true,isFlush=false;
string Temp;

for ( i = 0; i <= 4; ++i )
m_From.dealercards = m_From.playercards;


for(int j=4;j>=0;j--)
{
for ( i = 0; i < 4; i++ )
{
if (m_From.CardValue2(m_From.dealercards)>=m_From.CardValue2(m_From.dealercards[i+1]))
{
temp = m_From.dealercards;
m_From.dealercards = m_From.dealercards[i+1];
m_From.dealercards[i+1] = temp;
}
}
}

for(i=4;i>0;i--)
{
if(m_From.CardValue2(m_From.dealercards)!=(m_From.CardValue2(m_From.dealercards[0])+i))
{
isStrt=false;
m_From.pokermsg = "Game Over.";
m_From.pwin = 0;
}
}

if((m_From.CardValue2(m_From.dealercards[0])==2) && (m_From.CardValue2(m_From.dealercards[1])==3) && (m_From.CardValue2(m_From.dealercards[2])==4) && (m_From.CardValue2(m_From.dealercards[3])==5) && (m_From.CardValue2(m_From.dealercards[4])==14))
isStrt=true;

if (isStrt)
{
m_From.pokermsg = "Straight.";
m_From.pwin = m_From.playerbet * 4;
}

Temp = m_From.CardSuit(m_From.dealercards[0]);
if(Temp==m_From.CardSuit(m_From.dealercards[1]) && Temp==m_From.CardSuit(m_From.dealercards[2]) && Temp==m_From.CardSuit(m_From.dealercards[3]) && Temp==m_From.CardSuit(m_From.dealercards[4]))
{
isFlush=true;
m_From.pokermsg = "Flush.";
m_From.pwin = m_From.playerbet * 5;
}

if(!isStrt && !isFlush)
{

for ( i = 0; i <= 4; ++i )
{
temp = m_From.CardValue2(m_From.dealercards);

if ((m_From.CardValue2(m_From.dealercards[0])==temp) && i!=0)
match1++;
if ((m_From.CardValue2(m_From.dealercards[1])==temp) && i!=1)
match2++;
if ((m_From.CardValue2(m_From.dealercards[2])==temp) && i!=2)
match3++;
if ((m_From.CardValue2(m_From.dealercards[3])==temp) && i!=3)
match4++;
if ((m_From.CardValue2(m_From.dealercards[4])==temp) && i!=4)
match5++;
}

if((match1==3)||(match2==3)||(match3==3)||(match4==3)||(match5==3))
{
m_From.pokermsg = "4 of a Kind";
m_From.pwin = m_From.playerbet * 8;
}

if((match1==2)||(match2==2)||(match3==2)||(match4==2)||(match5==2))
{
m_From.pokermsg = "3 of a Kind";
m_From.pwin = m_From.playerbet * 3;
}

if((match1+match2+match3+match4+match5)==8)
{
m_From.pokermsg = "Full House.";
m_From.pwin = m_From.playerbet * 6;
}

if((match1+match2+match3+match4+match5)==4)
{
m_From.pokermsg = "Two Pair.";
m_From.pwin = m_From.playerbet * 2;
}

temp = 0;
if((match1+match2+match3+match4+match5)==2)
{
if(match1==1){temp=m_From.CardValue2(m_From.dealercards[0]);} if(match2==1){temp=m_From.CardValue2(m_From.dealercards[1]);}
if(match3==1){temp=m_From.CardValue2(m_From.dealercards[2]);} if(match4==1){temp=m_From.CardValue2(m_From.dealercards[3]);}
if(temp>=10)
{
m_From.pokermsg = "Pair 10's +";
m_From.pwin = m_From.playerbet;
}
}
} //end if(isStrt && isFlush)

if(isFlush && isStrt)
{
if(m_From.dealercards[0]==10)
{
m_From.pokermsg = "Royal Straight Flush";
m_From.pwin = m_From.playerbet * 12;
}
else
{
m_From.pokermsg = "Straight Flush";
m_From.pwin = m_From.playerbet * 10;
}
}

if (m_From.pwin>0)
{
m_From.payplayer(from,m_From.pwin);
Effects.PlaySound( from.Location, from.Map, 0x36 );
m_From.gamestats[4] += 1;
}
else if (m_From.pwin==m_From.playerbet)
{ m_From.gamestats[5] += 1; }
else
{ m_From.gamestats[3] += 1; }

}
} //class PokerGump


public class BlackjackGump : Gump
{

private Gambler m_From;

public BlackjackGump( Mobile mobile, Gambler gambler ) : base( 10, 10 )
{

m_From = gambler;

int i,suitcolor=0,dealervalue=0;
string cardtemp="";

Closable = false;

AddPage( 0 );

AddBackground( 30, 100, 285, 166, 5120 );
AddBackground( 30, 266, 285, 100, 5120 );

AddLabel( 45, 109, 1500, "Dealer:" );
AddLabel( 45, 190, 600, "Player:" );

if (m_From.dwin>0)
AddLabel( 45, 129, 70, ""+m_From.dwin );

if (m_From.pwin>0)
AddLabel( 45, 210, 70, ""+m_From.pwin );

AddButton( 50, 303, 2117, 2118, 101, GumpButtonType.Reply, 0 );
AddLabel( 70, 300, 800, "Deal" );

AddButton( 120, 303, 2117, 2118, 102, GumpButtonType.Reply, 0 );
AddLabel( 140, 300, 800, "Hit" );

AddButton( 180, 303, 2117, 2118, 103, GumpButtonType.Reply, 0 );
AddLabel( 200, 300, 800, "Stand" );

AddButton( 180, 274, 2117, 2118, 104, GumpButtonType.Reply, 0 );
AddButton( 90, 274, 2117, 2118, 105, GumpButtonType.Reply, 0 );
AddButton( 300, 103, 2360, 2361, 666, GumpButtonType.Reply, 0 );

//show dealer cards
for ( i = 0; i <= 4; ++i )
{
if (m_From.dealercards>0)
{
AddBackground( 65 + ((i+1)*40), 129, 35, 50, 2171 );
if (!m_From.dealercardhidden || (m_From.dealercardhidden && i>0))
{
suitcolor = 0;
cardtemp = m_From.CardSuit( m_From.dealercards );
if ( cardtemp == "D" || cardtemp == "H" )
suitcolor = 32;
AddLabel( 80 + ((i+1)*40), 155, suitcolor, cardtemp );
AddLabel( 72 + ((i+1)*40), 134, 1500, m_From.CardName( m_From.dealercards ) );
dealervalue += m_From.CardValue( m_From.dealercards );
}
}
}

//show player cards
for ( i = 0; i <= 4; ++i )
{
if (m_From.playercards>0)
{
AddBackground( 65 + ((i+1)*40), 210, 35, 50, 2171 );
suitcolor = 0;
cardtemp = m_From.CardSuit( m_From.playercards );
if ( cardtemp == "D" || cardtemp == "H" )
suitcolor = 32;
AddLabel( 80 + ((i+1)*40), 236, suitcolor, cardtemp );
AddLabel( 72 + ((i+1)*40), 215, 600, m_From.CardName( m_From.playercards ) );
}
}

AddLabel( 60, 271, 800, "Bet:" );
AddLabel( 110, 271, 800, ""+m_From.playerbet );
AddLabel( 200, 271, 800, "Double Down" );

if (!m_From.dealercardhidden)
dealervalue = dealercardvalue();

AddLabel( 63, 155, 1500, ""+dealervalue );
AddLabel( 63, 235, 600, ""+playercardvalue() );
AddLabel( 80, 330, 64, m_From.pokermsg );

}


public override void OnResponse( NetState sender, RelayInfo info )
{
Mobile from = sender.Mobile;

int i=0,temp=0;

switch ( info.ButtonID )
{
case 101:
{ // deal
m_From.pokermsg = "© 2003 Zulu Hotel";

if (!from.InRange( m_From.Location, 4 ))
{
m_From.roundend = true;
m_From.busy = false;
}
else
{
if (m_From.roundend)
{
if (m_From.playerbet>1000)
m_From.playerbet = 1000;

if (m_From.paydealer( from, m_From.playerbet))
{
m_From.dwin = 0;
m_From.pwin = 0;
m_From.roundend = false;
m_From.dealercardhidden = true;
// clear dealer and player cards
for ( i = 2; i <= 4; ++i )
{
m_From.dealercards=0;
m_From.playercards=0;
}
//pick card
m_From.dealercards[0]=m_From.pickcard(from);
m_From.playercards[0]=m_From.pickcard(from);
m_From.dealercards[1]=m_From.pickcard(from);
m_From.playercards[1]=m_From.pickcard(from);
}
else
m_From.pokermsg = "You need more money!";

}
from.SendGump( new BlackjackGump( from, m_From ) );
}
break;
}
case 102:
{ // hit
if (!m_From.roundend)
{
temp=0;
for ( i = 2; i <= 4; ++i )
{
if (m_From.playercards==0 && temp==0)
{
m_From.playercards=m_From.pickcard(from);
temp = i;
i=6;
}
}

if ((temp>0 && playercardvalue()<=21) && i!=5)
from.SendGump( new BlackjackGump( from, m_From ) );
else
finishgame( from );

}
else
from.SendGump( new BlackjackGump( from, m_From ) );
break;
}
case 103:
{ //stand
if (!m_From.roundend)
finishgame(from );
else
from.SendGump( new BlackjackGump( from, m_From ) );
break;
}
case 104:
{ //double down
if (!m_From.roundend)
{
temp=0;
for ( i = 0; i <= 4; ++i )
{
if (m_From.playercards>0)
temp++;
}

if (temp==2 && m_From.paydealer( from, m_From.playerbet))
{
m_From.playercards[2]=m_From.pickcard(from);
m_From.playerbet *= 2;
finishgame(from );
}
}
else
from.SendGump( new BlackjackGump( from, m_From ) );
break;
}
case 105:
{ // bet
if (m_From.roundend)
{
m_From.playerbet += 100;
if (m_From.playerbet > 1000)
m_From.playerbet = 100;
}
from.SendGump( new BlackjackGump( from, m_From ) );
break;
}
case 666:
{ // quit
m_From.roundend = true;
m_From.busy = false;
Effects.PlaySound( from.Location, from.Map, 0x1e9 );
break;
}

}
}

public void finishgame(Mobile from)
{
int i,temp,cards=0,dealervalue=dealercardvalue(),playervalue=playercardvalue();

if (playervalue>21 || (dealervalue>playervalue && dealervalue<=21))
{// dealer won
m_From.gamestats[0] += 1;
m_From.pokermsg = "Dealer Wins.";
m_From.dwin = m_From.playerbet;
m_From.pwin = 0;
}
else
{
if (dealervalue<17)
{
for ( i = 2; i <= 4; ++i )
{
if (m_From.dealercards==0)
{
m_From.dealercards=m_From.pickcard(from);
dealervalue=dealercardvalue();
}
if (dealervalue>=17)
i=6;
}
}


temp = (m_From.playerbet/2);

if (playervalue>21 || (dealervalue>playervalue && dealervalue<=21))
{// dealer won
m_From.gamestats[0] += 1;
m_From.pokermsg = "Dealer Wins.";
m_From.dwin = m_From.playerbet;
m_From.pwin = 0;
}
else if (dealervalue==playervalue)
{ // tie
m_From.dwin = temp;
m_From.pwin = m_From.playerbet+temp;

m_From.payplayer(from,m_From.pwin);
m_From.gamestats[2] += 1;
m_From.pokermsg = "Tied game.";
}
else
{ // count players card
for ( i = 0; i <= 4; ++i )
if (m_From.playercards!=0)
++cards;

if (playervalue==21 && cards==2)
{ // player won
m_From.dwin = 0;
m_From.pwin = (m_From.playerbet*2)+temp;

m_From.payplayer(from,m_From.pwin);
m_From.gamestats[1] += 1;
m_From.pokermsg = "Player Wins.";
}
else
{ // player won
m_From.dwin = 0;
m_From.pwin = (m_From.playerbet*2);

m_From.payplayer(from,m_From.pwin);
m_From.gamestats[1] += 1;
m_From.pokermsg = "Player Wins.";
}
}
} // end of else

m_From.pwin = (m_From.pwin-m_From.playerbet);
m_From.dealercardhidden = false;
m_From.roundend = true;
Effects.PlaySound( from.Location, from.Map, 0x36 );
from.SendGump( new BlackjackGump( from, m_From ) );
}

public int dealercardvalue()
{
int i,tempcard=0,gotace=0,dealervalue=0;

for ( i = 0; i <= 4; ++i )
{
tempcard = m_From.CardValue( m_From.dealercards );
if (tempcard==11)
gotace++;

dealervalue += tempcard;
}

while (dealervalue>21 && gotace>0)
{
dealervalue -= 10;
gotace--;
}

return dealervalue;
}

public int playercardvalue()
{
int i,tempcard=0,gotace=0,playervalue=0;

for ( i = 0; i <= 4; ++i )
{
tempcard = m_From.CardValue( m_From.playercards );
if (tempcard==11)
gotace++;

playervalue += tempcard;
}

while (playervalue>21 && gotace>0)
{
playervalue -= 10;
gotace--;
}

return playervalue;
}

}//class BlackjackGump

public override void Serialize( GenericWriter writer )
{
base.Serialize( writer );
writer.Write( (int) 0 ); // version
writer.Write( (bool) true );
writer.Write( (bool) false );
for ( int i = 0; i <= 5; ++i )
writer.Write( gamestats );
}

public override void Deserialize( GenericReader reader )
{
base.Deserialize( reader );
int version = reader.ReadInt();
roundend = reader.ReadBool();
busy = reader.ReadBool();
for ( int i = 0; i <= 5; ++i )
gamestats=reader.ReadInt();
}


public override bool OnGoldGiven( Mobile from, Gold dropped )
{
string message = "Are you trying to bribe me with gold to win.";
this.Say( message );
return false;
}

}
}
[/code:1]
 

TimberRidge

Wanderer
I tried out the first gambler <without verdata> and it looked nice, but I really liked the cards and the look of the newer gambler with a verdata..

so I took an old verdata.mul <since UO no longer distributes a verdata file..> patched it with the files and added the new gambler script that works with the verdata..

but when I added a gambler to the world .. and attempted to play, the cards did not appear...

Any idea why that could be happening and how it could be fixed?

Thanks!
 

Roland

Sorceror
TimberRidge;

My guess is that you are using the 3D client. It works on the 2D client (verdata.mul update).

I'm hoping someone else can explain it better then me.

I honestly like the 2D client MUCH better then the 3D *BUT* my players hate not having the 'real' graphics for all the newer things. So, I'm stuck dealing with 3D. My questions are;

1) Can the 3D graphics be updated (like we do with the 2D client and verdata)?

2) Does anyone have a Verdata.mul that would help out with all the missing things (colored orcs representing brutes just will not fly with my player base, sad to say). Or is this not possible (due to the structure of the mul and how it is indexed maybe?)
 

TimberRidge

Wanderer
Roland thanks for the reply. I wish I would have seen it sooner, as I just asked the same question in another thread.

So if I try in 2D I should see the cards from verdata? Hmm.. doesnt the 3D version read in a verdata.mul if its present all the same?

I am not sure I quite understand why one client would show them but not another.. :(



Roland said:
TimberRidge;

My guess is that you are using the 3D client. It works on the 2D client (verdata.mul update).

I'm hoping someone else can explain it better then me.

I honestly like the 2D client MUCH better then the 3D *BUT* my players hate not having the 'real' graphics for all the newer things. So, I'm stuck dealing with 3D. My questions are;

1) Can the 3D graphics be updated (like we do with the 2D client and verdata)?

2) Does anyone have a Verdata.mul that would help out with all the missing things (colored orcs representing brutes just will not fly with my player base, sad to say). Or is this not possible (due to the structure of the mul and how it is indexed maybe?)
 

Roland

Sorceror
Oddly enough no. verdata.mul is only for 2D. But in 2D you should see them fine, it worked for me and looked very nice. Too bad it’s not available in 3D.

For me, I still use the 2D client on my notebook (have too) which I use to do admin and NPC RP'ing from time to time. Only problem with doing admin functions like building and such from my notebook is that the hues never look quite right (if they show up at all…3D things do not always take the hue prop). So I end up never knowing how things will be for the players until I use my ‘game’ systems. :)
 

TimberRidge

Wanderer
Yea I noticed that too. The Lord British, Dupre and BlackThorne outfits are a good example of that. They 'wow' players in their 2d form and look like a dragqueen on acid in 3D.. ::sigh:: It's a shame theres not a better flow thru with 2D/3D -- but .. oh well, it's the price you pay I guess.

I did see the cards in 2d and it was a very attractive setup. Zulu does incredible work... always has. He is THE MAN :D

Thanks again... back to the ugly cards :(
 

Zulu

Wanderer
Yes 3D can be done, here is my gambler system running on a uo 3d client.

 

Mixael

Wanderer
Thanks

This is great!

Im am wanting to make it show the gamblers poker cards at the end of the game? Im really new to c# and dont know where to start
Thanks
 
S

sp000n

Guest
I love when someone like Zulu puts it all together right after some know-it-all says, "not possible." Nicely done!

BTW, if that's what 3D looks like... I'm spend another 5 yrs on 2D!
 

Zulu

Wanderer
TimberRidge, thanks for the kudos. PM me about the fortune teller (the other cards)

Mixael, the dealer does not play poker. I decided to make it like video poker. You are not really playing against anyone. Just trying to get pairs (value of 10 and higher), 3 kind, etc.

sp000n, 3D is cool for magic and other stuff. The whole 3D client is slow.
 

TremerePuck

Sorceror
I have no idea what's wrong. I installed the new mul files in my client directory AND server side. I also changed to the new version of the script. But in 3d I still see the plain cards. =o\
 

Zulu

Wanderer
Very important Grasshopper!!!

Load the script in your favorite editor...then find the following text around line 14.

[code:1] private const bool NewCards = false;[/code:1]
The above code means the script will NOT show the new cards. The is the default setting.

[code:1] private const bool NewCards = true;[/code:1]
The above code means the script will show the new cards.

Make your changes and save the code and re-start runuo.
 

Whatfor?

Wanderer
just want to let ye know this script would freeze players clients, even though they was no where near the npc. This started happig with the new client 4.0.1a since I've remove the gambler the freezing of clients have stoped.
 
Status
Not open for further replies.
Top