Ancordia_PRC8/_module/nss/mpoker_include.nss
Jaysyn904 102ba7dab6 Initial Commit
Initial Commit
2023-09-21 19:51:32 -04:00

123 lines
6.5 KiB
Plaintext

#include "gh_poker_include"
/* SHOW PLAYER OR DEALER HANDS AND SCORES
Shows the cards and score of the hand */
string ShowMHandAndScores(string sWho) {
SortHand(sWho);
string sHand = GetStringLeft(sWho, 1) + GetStringLowerCase(GetStringRight(sWho, 5)) + ": ";
{ //If discard time, hide cards.
int iCount = 0;
for(iCount = 1; iCount <= 5; iCount++) { //Check each card, if discarded, show as HIDDEN for now.
if(GetLocalInt(OBJECT_SELF, sWho+"_DISCARD_" + IntToString(iCount)) == 0) {
sHand = sHand + CardName(GetLocalInt(OBJECT_SELF, sWho + "_CARD_" + IntToString(iCount))) + " of " + GetSuit(GetLocalInt(OBJECT_SELF, sWho + "_CARD_" + IntToString(iCount))) + "s, ";
}
else {
sHand = sHand + "[" + CardName(GetLocalInt(OBJECT_SELF, sWho + "_CARD_" + IntToString(iCount))) + " of " + GetSuit(GetLocalInt(OBJECT_SELF, sWho + "_CARD_" + IntToString(iCount))) + "s], ";
}
}
sHand = GetStringLeft(sHand, GetStringLength(sHand) - 2) + ".";
sHand = sHand + "\n" + GetHandValue(sWho);
}
/*else { //Else its not discard time, so dont hide. And also show the hand value.
SortHand(sWho); //Sort the cards when showing them all.
sHand = sHand + CardName(GetLocalInt(OBJECT_SELF, sWho + "_CARD_1")) + " of " + GetSuit(GetLocalInt(OBJECT_SELF, sWho + "_CARD_1")) + "s";
sHand = sHand + ", " + CardName(GetLocalInt(OBJECT_SELF, sWho + "_CARD_2")) + " of " + GetSuit(GetLocalInt(OBJECT_SELF, sWho + "_CARD_2")) + "s";
sHand = sHand + ", " + CardName(GetLocalInt(OBJECT_SELF, sWho + "_CARD_3")) + " of " + GetSuit(GetLocalInt(OBJECT_SELF, sWho + "_CARD_3")) + "s";
sHand = sHand + ", " + CardName(GetLocalInt(OBJECT_SELF, sWho + "_CARD_4")) + " of " + GetSuit(GetLocalInt(OBJECT_SELF, sWho + "_CARD_4")) + "s";
sHand = sHand + ", " + CardName(GetLocalInt(OBJECT_SELF, sWho + "_CARD_5")) + " of " + GetSuit(GetLocalInt(OBJECT_SELF, sWho + "_CARD_5")) + "s";
sHand = sHand + ".\n" + GetHandValue(sWho);
}*/
return sHand;
}
/* INITIALIZE DECK
Resets deck so all cards are 'undrawn'.
The 'Y' and 'N' at the end of the value indicates whether its been drawn or
not. 'N' = drawn, 'Y' = undrawn or available to be drawn :)
Also resets the players and dealers hands so they have no cards.
Also in the value of the cards, I included the suit. H, D, C, S
Heart, Diamond, Club, Spade.*/
void InitializeMDeck() { //Resets deck and hands so none are 'drawn'.
SetLocalString(OBJECT_SELF, "1", "02HY"); //TWOS
SetLocalString(OBJECT_SELF, "2", "02DY");
SetLocalString(OBJECT_SELF, "3", "02CY");
SetLocalString(OBJECT_SELF, "4", "02SY");
SetLocalString(OBJECT_SELF, "5", "03HY"); //THREES
SetLocalString(OBJECT_SELF, "6", "03DY");
SetLocalString(OBJECT_SELF, "7", "03CY");
SetLocalString(OBJECT_SELF, "8", "03SY");
SetLocalString(OBJECT_SELF, "9", "04HY"); //FOURS
SetLocalString(OBJECT_SELF, "10", "04DY");
SetLocalString(OBJECT_SELF, "11", "04CY");
SetLocalString(OBJECT_SELF, "12", "04SY");
SetLocalString(OBJECT_SELF, "13", "05HY"); //FIVES
SetLocalString(OBJECT_SELF, "14", "05DY");
SetLocalString(OBJECT_SELF, "15", "05CY");
SetLocalString(OBJECT_SELF, "16", "05SY");
SetLocalString(OBJECT_SELF, "17", "06HY"); //SIXES
SetLocalString(OBJECT_SELF, "18", "06DY");
SetLocalString(OBJECT_SELF, "19", "06CY");
SetLocalString(OBJECT_SELF, "20", "06SY");
SetLocalString(OBJECT_SELF, "21", "07HY"); //SEVENS
SetLocalString(OBJECT_SELF, "22", "07DY");
SetLocalString(OBJECT_SELF, "23", "07CY");
SetLocalString(OBJECT_SELF, "24", "07SY");
SetLocalString(OBJECT_SELF, "25", "08HY"); //EIGHTS
SetLocalString(OBJECT_SELF, "26", "08DY");
SetLocalString(OBJECT_SELF, "27", "08CY");
SetLocalString(OBJECT_SELF, "28", "08SY");
SetLocalString(OBJECT_SELF, "29", "09HY"); //NINES
SetLocalString(OBJECT_SELF, "30", "09DY");
SetLocalString(OBJECT_SELF, "31", "09CY");
SetLocalString(OBJECT_SELF, "32", "09SY");
SetLocalString(OBJECT_SELF, "33", "10HY"); //TENS
SetLocalString(OBJECT_SELF, "34", "10DY");
SetLocalString(OBJECT_SELF, "35", "10CY");
SetLocalString(OBJECT_SELF, "36", "10SY");
SetLocalString(OBJECT_SELF, "37", "11HY"); //JACKS
SetLocalString(OBJECT_SELF, "38", "11DY");
SetLocalString(OBJECT_SELF, "39", "11CY");
SetLocalString(OBJECT_SELF, "40", "11SY");
SetLocalString(OBJECT_SELF, "41", "12HY"); //QUEENS
SetLocalString(OBJECT_SELF, "42", "12DY");
SetLocalString(OBJECT_SELF, "43", "12CY");
SetLocalString(OBJECT_SELF, "44", "12SY");
SetLocalString(OBJECT_SELF, "45", "13HY"); //KINGS
SetLocalString(OBJECT_SELF, "46", "13DY");
SetLocalString(OBJECT_SELF, "47", "13CY");
SetLocalString(OBJECT_SELF, "48", "13SY");
SetLocalString(OBJECT_SELF, "49", "14HY"); //ACES
SetLocalString(OBJECT_SELF, "50", "14DY");
SetLocalString(OBJECT_SELF, "51", "14CY");
SetLocalString(OBJECT_SELF, "52", "14SY");
//Resetting Dealer and Player hands to 'empty'.
SetLocalInt(OBJECT_SELF, "PLAYER1_CARD_1", 0);
SetLocalInt(OBJECT_SELF, "PLAYER1_CARD_2", 0);
SetLocalInt(OBJECT_SELF, "PLAYER1_CARD_3", 0);
SetLocalInt(OBJECT_SELF, "PLAYER1_CARD_4", 0);
SetLocalInt(OBJECT_SELF, "PLAYER1_CARD_5", 0);
SetLocalInt(OBJECT_SELF, "PLAYER2_CARD_1", 0);
SetLocalInt(OBJECT_SELF, "PLAYER2_CARD_2", 0);
SetLocalInt(OBJECT_SELF, "PLAYER2_CARD_3", 0);
SetLocalInt(OBJECT_SELF, "PLAYER2_CARD_4", 0);
SetLocalInt(OBJECT_SELF, "PLAYER2_CARD_5", 0);
//Resetting variables used for tracking discarded cards.
SetLocalInt(OBJECT_SELF, "PLAYER1_DISCARD_1", 0);
SetLocalInt(OBJECT_SELF, "PLAYER1_DISCARD_2", 0);
SetLocalInt(OBJECT_SELF, "PLAYER1_DISCARD_3", 0);
SetLocalInt(OBJECT_SELF, "PLAYER1_DISCARD_4", 0);
SetLocalInt(OBJECT_SELF, "PLAYER1_DISCARD_5", 0);
SetLocalInt(OBJECT_SELF, "PLAYER2_DISCARD_1", 0);
SetLocalInt(OBJECT_SELF, "PLAYER2_DISCARD_2", 0);
SetLocalInt(OBJECT_SELF, "PLAYER2_DISCARD_3", 0);
SetLocalInt(OBJECT_SELF, "PLAYER2_DISCARD_4", 0);
SetLocalInt(OBJECT_SELF, "PLAYER2_DISCARD_5", 0);
}