/*Returns true if found an appropriate name in the DB for chr, or false if it did not found such name. Also changes nameChanged if the name was found but changed since the last time we've called CheckName function */ bool CPokerTrackerThread::CheckName(int chr, bool &nameChanged) { char oh_scraped_name[k_max_length_of_playername]; char best_name[k_max_length_of_playername]; bool result = false, ok_scrape = false; int i; assert(chr >= k_min_chair_number); assert(chr <= k_max_chair_number); memset(oh_scraped_name, 0, k_max_length_of_playername); memset(best_name, 0, k_max_length_of_playername); nameChanged = false; if (p_game_state->state((p_game_state->state_index()-1)&0xff)->m_player[chr].m_name_known == 0) return false; strcpy_s(oh_scraped_name, k_max_length_of_playername, p_game_state->state((p_game_state->state_index()-1)&0xff)->m_player[chr].m_name); // Check for bad name scrape int len = (int) strlen(oh_scraped_name); for (i = 0; i < len; ++i) { if (oh_scraped_name[i]!='l' && oh_scraped_name[i]!='i' && oh_scraped_name[i]!='.' && oh_scraped_name[i]!=',') { ok_scrape = true; break; } } if (!ok_scrape) return false; // We already have the name, and it has not changed since we last checked, so do nothing if (_player_stats[chr].found && 0 == strcmp(_player_stats[chr].scraped_name, oh_scraped_name)) return true; nameChanged = true; // We have not found the name in PT, go find it // First see if we can find the exact scraped name result = FindName(oh_scraped_name, best_name); if (result) { SetPlayerName(chr, true, best_name, oh_scraped_name); } else { SetPlayerName(chr, false, "", ""); } return result; }
/* Returns true if found an appropriate name in the DB for chr, or false if it did not found such name.*/ bool CPokerTrackerThread::CheckIfNameExistsInDB(int chair) { char oh_scraped_name[kMaxLengthOfPlayername]; char best_name[kMaxLengthOfPlayername]; assert(chair >= kFirstChair); assert(chair <= kLastChair); memset(oh_scraped_name, 0, kMaxLengthOfPlayername); memset(best_name, 0, kMaxLengthOfPlayername); write_log(preferences.debug_pokertracker(), "[PokerTracker] CheckIfNameExistsInDB() chair = %i\n", chair); if (LAST_STATE.m_player[chair].m_name_known == 0) { write_log(preferences.debug_pokertracker(), "[PokerTracker] CheckIfNameExistsInDB() No name known for this chair\n"); return false; } if (strlen(LAST_STATE.m_player[chair].m_name) <= kMaxLengthOfPlayername) { strcpy_s(oh_scraped_name, kMaxLengthOfPlayername, LAST_STATE.m_player[chair].m_name); } write_log(preferences.debug_pokertracker(), "[PokerTracker] CheckIfNameExistsInDB() Scraped name: [%s]\n", oh_scraped_name); if (NameLooksLikeBadScrape(oh_scraped_name)) { write_log(preferences.debug_pokertracker(), "[PokerTracker] CheckIfNameExistsInDB() Name looks like a bad scrape\n"); return false; } // We already have the name, and it has not changed since we last checked, so do nothing if (_player_data[chair].found && 0 == strcmp(_player_data[chair].scraped_name, oh_scraped_name)) { write_log(preferences.debug_pokertracker(), "[PokerTracker] CheckIfNameExistsInDB() Name is known and good\n"); return true; } // We have not found the name in PT, go find it // First see if we can find the exact scraped name if (FindName(oh_scraped_name, best_name)) { write_log(preferences.debug_pokertracker(), "[PokerTracker] CheckIfNameExistsInDB() Name found in database\n"); SetPlayerName(chair, true, best_name, oh_scraped_name); return true; } else { write_log(preferences.debug_pokertracker(), "[PokerTracker] CheckIfNameExistsInDB() Name not found in database\n"); SetPlayerName(chair, false, "", ""); return false; } }
void CNewGameSession::CmdEditName (void) // CmdEditName // // Handles the edit name button { const CVisualPalette &VI = m_HI.GetVisuals(); if (m_bEditingName) { IAnimatron *pEdit; if (m_pRoot->FindElement(ID_PLAYER_NAME_FIELD, &pEdit)) { m_Settings.sPlayerName = CUniverse::ValidatePlayerName(pEdit->GetPropertyString(PROP_TEXT)); m_Settings.bDefaultPlayerName = false; DeleteElement(ID_PLAYER_NAME_FIELD); } SetPlayerName(m_Settings.sPlayerName, m_xPlayerName, m_yPlayerName, m_cxPlayerName); m_bEditingName = false; } // If we're not editing, then start editing else { DeleteElement(ID_PLAYER_NAME); // Create edit control IAnimatron *pEdit; VI.CreateEditControl(NULL, ID_PLAYER_NAME_FIELD, m_xPlayerName + SMALL_BUTTON_WIDTH + MAJOR_PADDING_HORZ, m_yPlayerName, NAME_FIELD_WIDTH, 0, NULL_STR, &pEdit, NULL); pEdit->SetPropertyString(PROP_TEXT, m_Settings.sPlayerName); m_pRoot->AddLine(pEdit); SetInputFocus(ID_PLAYER_NAME_FIELD); m_bEditingName = true; } }
boost::statechart::result WaitingForMPJoinAck::react(const AuthRequest& msg) { TraceLogger(FSM) << "(HumanClientFSM) WaitingForMPJoinAck.AuthRequest"; std::string player_name; std::string auth; ExtractAuthRequestMessageData(msg.m_message, player_name, auth); auto password_dialog = Client().GetClientUI().GetPasswordEnterWnd(); password_dialog->SetPlayerName(player_name); Client().Register(password_dialog); return discard_event(); }
int main() { HMODULE DarkCoreHandle = LoadLibrary("DarkCore.dll"); if (DarkCoreHandle == NULL){ std::cout << "------ WARNING DARKCORE.DLL NOT LODED -----\n"; std::cout << GetLastErrorAsString(); std::cout << "------ WARNING DARKCORE.DLL NOT LODED -----\n"; } std::cout << "------------- Loaded DarkTests ------------\n"; SetPlayerName(); ShowPlayernameLoop(); return 0; }
void CNewGameSession::CmdEditNameCancel (void) // CmdEditNameCancel // // Cancel editing name { if (m_bEditingName) { DeleteElement(ID_PLAYER_NAME_FIELD); SetPlayerName(m_Settings.sPlayerName, m_xPlayerName, m_yPlayerName, m_cxPlayerName); m_bEditingName = false; } }
void CNewGameSession::CreatePlayerName (const CString &sName, int x, int y, int cxWidth) // CreatePlayerName // // Creates the player name UI section { const CVisualPalette &VI = m_HI.GetVisuals(); const CG16bitFont &MediumBoldFont = VI.GetFont(fontMediumBold); const CG16bitFont &SubTitleFont = VI.GetFont(fontSubTitle); // Label IAnimatron *pLabel = new CAniText; pLabel->SetPropertyVector(PROP_POSITION, CVector(x + SMALL_BUTTON_WIDTH + MAJOR_PADDING_HORZ, y)); pLabel->SetPropertyVector(PROP_SCALE, CVector(cxWidth, 100.0)); pLabel->SetPropertyColor(PROP_COLOR, VI.GetColor(colorTextDialogInput)); pLabel->SetPropertyFont(PROP_FONT, &MediumBoldFont); pLabel->SetPropertyString(PROP_TEXT, CONSTLIT("name")); m_pRoot->AddLine(pLabel); // Create a button IAnimatron *pButton; VI.CreateImageButtonSmall(NULL, CMD_EDIT_NAME, x, y, &VI.GetImage(imageSmallEditIcon), 0, &pButton); pButton->SetID(CMD_EDIT_NAME); RegisterPerformanceEvent(pButton, EVENT_ON_CLICK, CMD_EDIT_NAME); m_pRoot->AddLine(pButton); // Player name SetPlayerName(sName, x, y, cxWidth); }