static void SaveYourselfPhase2ReqProc(SmsConn smsConn, SmPointer managerData) { ClientRec *client = (ClientRec *) managerData; if (verbose) { printf ("Client Id = %s, received SAVE YOURSELF PHASE 2 REQUEST\n", client->clientId); } if (!saveInProgress) { /* * If we are not in the middle of a checkpoint (ie. we just * started the client and sent the initial save yourself), just * send the save yourself phase2 now. */ SmsSaveYourselfPhase2 (client->smsConn); } else { ListAddLast (WaitForPhase2List, (char *) client); if (ListCount (WaitForInteractList) > 0 && OkToEnterInteractPhase ()) { LetClientInteract (ListFirst (WaitForInteractList)); } else if (OkToEnterPhase2 ()) { StartPhase2 (); } } }
void DamageTaken(Unit* pDoneBy, uint32& uiDamage) { if (uiDamage > me->GetHealth() && !phase3){ uiDamage = 0; if (phase2) StartPhase3(); if (phase1) StartPhase2(); } }
void DamageTaken(Unit* pDoneBy, uint32& uiDamage) { if ((uiDamage > m_creature->GetHealth() || m_creature->GetHealth()/m_creature->GetHealth() <= 0.1 ) && !phase3){ uiDamage = 0; if (phase2) StartPhase3(); if (phase1) StartPhase2(); } }
void JustDied(Unit* pKiller) { if (!m_pInstance) return; if (phase3) { m_pInstance->SetData(TYPE_BLACK_KNIGHT, DONE); } if (phase2) if (!m_creature->isAlive()) { m_creature->Respawn(); StartPhase3(); } if (phase1) if (!m_creature->isAlive()) { m_creature->Respawn(); StartPhase2(); } }
static void SaveYourselfDoneProc(SmsConn smsConn, SmPointer managerData, Bool success) { ClientRec *client = (ClientRec *) managerData; if (verbose) { printf("Client Id = %s, received SAVE YOURSELF DONE [Success = %s]\n", client->clientId, success ? "True" : "False"); } if (!ListSearchAndFreeOne (WaitForSaveDoneList, (char *) client)) { if (ListSearchAndFreeOne (InitialSaveList, (char *) client)) SmsSaveComplete (client->smsConn); return; } if (!success) { ListAddLast (FailedSaveList, (char *) client); } if (ListCount (WaitForSaveDoneList) == 0) { if (ListCount (FailedSaveList) > 0 && !checkpoint_from_signal) PopupBadSave (); else FinishUpSave (); } else if (ListCount (WaitForInteractList) > 0 && OkToEnterInteractPhase ()) { LetClientInteract (ListFirst (WaitForInteractList)); } else if (ListCount (WaitForPhase2List) > 0 && OkToEnterPhase2 ()) { StartPhase2 (); } }
void JustDied(Unit* pKiller) { if (!pInstance) return; if (phase3) { SetInstanceData(TYPE_BLACK_KNIGHT, DONE); GiveEmblemsToGroup(m_bIsRegularMode ? CONQUETE : 0,1,true); GiveRandomReward(); } if (phase2) if (!me->isAlive()) { me->Respawn(); StartPhase3(); } if (phase1) if (!me->isAlive()) { me->Respawn(); StartPhase2(); } }
static void InteractDoneProc(SmsConn smsConn, SmPointer managerData, Bool cancelShutdown) { ClientRec *client = (ClientRec *) managerData; List *cl; if (verbose) { printf ( "Client Id = %s, received INTERACT DONE [Cancel Shutdown = %s]\n", client->clientId, cancelShutdown ? "True" : "False"); } if (cancelShutdown) { ListFreeAllButHead (WaitForInteractList); ListFreeAllButHead (WaitForPhase2List); } if (cancelShutdown) { if (shutdownCancelled) { /* Shutdown was already cancelled */ return; } shutdownCancelled = True; for (cl = ListFirst (RunningList); cl; cl = ListNext (cl)) { client = (ClientRec *) cl->thing; SmsShutdownCancelled (client->smsConn); if (verbose) { printf ("Client Id = %s, sent SHUTDOWN CANCELLED\n", client->clientId); } } } else { if ((cl = ListFirst (WaitForInteractList)) != NULL) { LetClientInteract (cl); } else { if (verbose) { printf ("\n"); printf ("Done interacting with all clients.\n"); printf ("\n"); } if (ListCount (WaitForPhase2List) > 0) { StartPhase2 (); } } } }
void CloseDownClient(ClientRec *client) { int index_deleted = 0; if (verbose) { printf ("ICE Connection closed, IceConn fd = %d\n", IceConnectionNumber (client->ice_conn)); printf ("\n"); } SmsCleanUp (client->smsConn); IceSetShutdownNegotiation (client->ice_conn, False); IceCloseConnection (client->ice_conn); client->ice_conn = NULL; client->smsConn = NULL; if (!shutdownInProgress && client_info_visible) { for (index_deleted = 0; index_deleted < numClientListNames; index_deleted++) { if (clientListRecs[index_deleted] == client) break; } } ListSearchAndFreeOne (RunningList, (char *) client); if (saveInProgress) { Status delStatus = ListSearchAndFreeOne ( WaitForSaveDoneList, (char *) client); if (delStatus) { ListAddLast (FailedSaveList, (char *) client); client->freeAfterBadSavePopup = True; } ListSearchAndFreeOne (WaitForInteractList, (char *) client); ListSearchAndFreeOne (WaitForPhase2List, (char *) client); if (delStatus && ListCount (WaitForSaveDoneList) == 0) { if (ListCount (FailedSaveList) > 0 && !checkpoint_from_signal) PopupBadSave (); else FinishUpSave (); } else if (ListCount (WaitForInteractList) > 0 && OkToEnterInteractPhase ()) { LetClientInteract (ListFirst (WaitForInteractList)); } else if (!phase2InProgress && ListCount (WaitForPhase2List) > 0 && OkToEnterPhase2 ()) { StartPhase2 (); } } if (client->restartHint == SmRestartImmediately && !shutdownInProgress) { Clone (client, True /* use saved state */); ListAddLast (RestartImmedList, (char *) client); } else if (client->restartHint == SmRestartAnyway) { ListAddLast (RestartAnywayList, (char *) client); } else if (!client->freeAfterBadSavePopup) { FreeClient (client, True /* free props */); } if (shutdownInProgress) { if (ListCount (RunningList) == 0) EndSession (0); } else if (client_info_visible) { UpdateClientList (); if (current_client_selected == index_deleted) { if (current_client_selected == numClientListNames) current_client_selected--; if (current_client_selected >= 0) { XawListHighlight (clientListWidget, current_client_selected); ShowHint (clientListRecs[current_client_selected]); if (client_prop_visible) { DisplayProps (clientListRecs[current_client_selected]); } } } else { if (index_deleted < current_client_selected) current_client_selected--; XawListHighlight (clientListWidget, current_client_selected); } } }