70 lines
2.1 KiB
Plaintext
70 lines
2.1 KiB
Plaintext
#include "x4_inc_functions"
|
|
#include "mpoker_include"
|
|
void PlayersCheck()
|
|
{
|
|
object oStool1 = GetNearestObjectByTag("mpoker_stool1");
|
|
object oStool2 = GetNearestObjectByTag("mpoker_stool2");
|
|
|
|
object oP1 = GetSittingCreature(oStool1);
|
|
object oP2 = GetSittingCreature(oStool2);
|
|
|
|
if (!GetIsObjectValid(oP1) || !GetIsObjectValid(oP2)) //if there aren't two players anymore
|
|
{
|
|
int nPot = GetLocalInt(OBJECT_SELF, "POT");
|
|
if (GetIsObjectValid(oP1)) GiveGoldToCreature(oP1, nPot);
|
|
if (GetIsObjectValid(oP2)) GiveGoldToCreature(oP2, nPot); //we want to give everything in the pot to the remaining player
|
|
|
|
DeleteLocalInt(OBJECT_SELF, "STAGE");
|
|
DeleteLocalInt(OBJECT_SELF, "BET");
|
|
DeleteLocalInt(OBJECT_SELF, "POT");
|
|
DeleteLocalString(OBJECT_SELF, "SPOKEN");
|
|
DeleteLocalInt(OBJECT_SELF, "STARTER");
|
|
DeleteLocalString(OBJECT_SELF, "CURRENT");
|
|
DeleteLocalObject(OBJECT_SELF, "oP1");
|
|
DeleteLocalObject(OBJECT_SELF, "oP2");
|
|
|
|
InitializeMDeck();
|
|
|
|
AssignCommand(OBJECT_SELF, SpeakOneLinerConversation("mpoker"));
|
|
return;
|
|
}
|
|
|
|
DelayCommand(1.0, PlayersCheck());
|
|
}
|
|
|
|
int StartingConditional()
|
|
{
|
|
object oStool1 = GetNearestObjectByTag("mpoker_stool1");
|
|
object oStool2 = GetNearestObjectByTag("mpoker_stool2");
|
|
|
|
object oP1 = GetSittingCreature(oStool1);
|
|
object oP2 = GetSittingCreature(oStool2);
|
|
|
|
SetLocalObject(OBJECT_SELF, "oP1", oP1);
|
|
SetLocalObject(OBJECT_SELF, "oP2", oP2);
|
|
|
|
if (GetLocalInt(OBJECT_SELF, "STAGE") == 0)
|
|
{
|
|
//Create pseudo-heartbeat
|
|
PlayersCheck();
|
|
|
|
//Randomly decide the starting player
|
|
SetLocalInt(OBJECT_SELF, "STARTER", Random(2)+1);
|
|
|
|
object oStarter = GetLocalObject(OBJECT_SELF, "oP"+IntToString(GetLocalInt(OBJECT_SELF, "STARTER")));
|
|
|
|
//Set the PC as current player
|
|
SetLocalString(OBJECT_SELF, "CURRENT", "oP"+IntToString(GetLocalInt(OBJECT_SELF, "STARTER")));
|
|
|
|
//Set token
|
|
SetCustomToken(916, GetName(oStarter));
|
|
|
|
//Prepare the next stage
|
|
SetLocalInt(OBJECT_SELF, "STAGE", 1);
|
|
|
|
return TRUE;
|
|
}
|
|
|
|
return FALSE;
|
|
}
|