Im going to start releasing my casino stuff as I make it. This is a blackjack system, to use it with your map editor set the spot of your choice to Unknown6 or the 6th after chest you have to be facing that tile to play. You need $500, then type #deal cards, shows your numbersthentype#dealhitfor
more cards or #deal stand to stop. Most of the variables you add in on this topic will be reused through out the other casino games I will release.
start in talk.cpp and add this command in the player section
heres link
Now go to walk.cpp and find
else
{
this->player->character->npc = 0;
this->player->character->npc_type = ENF::NPC;
this->player->character->board = 0;
this->player->character->jukebox_open = false;
if (!this->player->character->Walk(direction))
{
return true;
}
}
}
Then add this here
if (this->player->character)
{
int target_x = this->player->character->x;
int target_y = this->player->character->y;
switch (this->player->character->direction)
{
case DIRECTION_UP:
target_y -= 1;
break;
case DIRECTION_RIGHT:
target_x += 1;
break;
case DIRECTION_DOWN:
target_y += 1;
break;
case DIRECTION_LEFT:
target_x -= 1;
break;
}
if (this->player->character->map->GetSpec(target_x, target_y) == Map_Tile::Unknown6 || (this->player->character->x == target_x && this->player->character->y == target_y))
{
this->player->character->deal = true;
this->player->character->map->Msg(this->player->character," Would you like to play 21 if so type #deal cards If you want to try your luck at roulette type #bet red, black, even, or odd or 1-36 for the
big $", true);
}
}
now go to character.cpp and findCharacter::Character(std::string name, World *world) add in mycards and hiscards like you see them dont copy and paste this
Database_Result res = this->world->db.Query("SELECT `name`, `title`, `home`, `fiance`, `partner`, `admin`, `hidden`, `mycards`, `hiscards`, `class`, `gender`, `race`, `hairstyle`, `haircolor`,"
scroll down alittle bit and find
this->id = this->world->GenerateCharacterID(); and add these below it
this->hascards = false;
this->hit = false;
this->stand = false;
this->deal = false;
this->mycards = GetRow<int>(row, "mycards");
this->hiscards = GetRow<int>(row, "hiscards");
near the bottom of character.cpp find void Character::Save() add in mycards and his cards and this->mycards and this->hiscards how you see them dont copy and paste this
this->world->db.Query("UPDATE `characters` SET `title` = '$', `home` = '$', `fiance` = '$', `partner` = '$', `admin` = #, `hidden` = #, `mycards` = #, `hiscards` = #, `class` = #, `gender` = #, `race` = #, "
"`hairstyle` = #, `haircolor` = #, `map` = #, `x` = #, `y` = #, `direction` = #, `level` = #, `exp` = #, `hp` = #, `tp` = #, "
"`str` = #, `int` = #, `wis` = #, `agi` = #, `con` = #, `cha` = #, `statpoints` = #, `skillpoints` = #, `karma` = #, `sitting` = #, "
"`bankmax` = #, `goldbank` = #, `usage` = #, `inventory` = '$', `bank` = '$', `paperdoll` = '$', "
"`spells` = '$', `guild` = '$', guild_rank = #, `quest` = '$', `vars` = '$' WHERE `name` = '$'",
this->title.c_str(), this->home.c_str(), this->fiance.c_str(), this->partner.c_str(), this->admin, this->hidden, this->mycards, this->hiscards, this->clas, this->gender, this->race,
this->hairstyle, this->haircolor, this->mapid, this->x, this->y, this->direction, this->level, this->exp, this->hp, this->tp,
this->str, this->intl, this->wis, this->agi, this->con, this->cha, this->statpoints, this->skillpoints, this->karma, this->sitting,
this->bankmax, this->goldbank, this->Usage(), ItemSerialize(this->inventory).c_str(), ItemSerialize(this->bank).c_str(),
DollSerialize(this->paperdoll).c_str(), SpellSerialize(this->spells).c_str(), (this->guild ? this->guild->tag.c_str() : ""), this->guild_rank, QuestSerialize(this->quests).c_str(), "", this->name.c_str());
}
Now go to character.hpp and find bool hidden; and add this below it
bool hascards, hit, stand, deal;
Then go in to your database create 2 new tables 1rst Name mycards and 2nd Name hiscards, Type INT, Length/Set 11, Default 0