void CDevilSquare::CalcScore() { int n; for ( n=0; n<MAX_DEVILSQUARE_GROUND; n++) { this->m_DevilSquareGround[n].ClearScore(); } for ( n=OBJ_STARTUSERINDEX; n<OBJMAX; n++) { if ( gObj[n].Connected == PLAYER_PLAYING ) { if ( DS_MAP_RANGE(gObj[n].MapNumber) != FALSE ) { if ( DS_LEVEL_RANGE(gObj[n].m_bDevilSquareIndex) != FALSE ) { this->m_DevilSquareGround[gObj[n].m_bDevilSquareIndex].InsertObj(&gObj[n]); } } } } for ( n=0; n<MAX_DEVILSQUARE_GROUND; n++) { this->m_DevilSquareGround[n].SortScore(); this->m_DevilSquareGround[n].SendScore(); } }
int CDevilSquare::GetPlayUserCountRightNow(int nDevilSquareIndex) { if( DS_LEVEL_RANGE(nDevilSquareIndex) ) { return this->m_DevilSquareGround[nDevilSquareIndex].GetPlayUserCountRightNow(); } return -1; }
int CDevilSquare::ChangeUserIndex(int nExUserIndex,int nCurrentUserIndex,int nDevilSquareIndex) { if( DS_LEVEL_RANGE(nDevilSquareIndex) ) { return this->m_DevilSquareGround[nDevilSquareIndex].ChangeUserIndex(nExUserIndex,nCurrentUserIndex); } return false; }
int CDevilSquare::DelUser(int nDevilSquareIndex,int UserIndex) { if( DS_LEVEL_RANGE(nDevilSquareIndex) ) { return this->m_DevilSquareGround[nDevilSquareIndex].DelUser(UserIndex); } return false; }
void CDevilSquare::DieProcDevilSquare(LPOBJ lpObj) { char msg[255]; wsprintf(msg, "Failed. Your score is %d. Try again next time.", lpObj->m_nEventScore); GCServerMsgStringSend(msg, lpObj->m_Index, 1); if ( lpObj->m_nEventScore <= 0 ) return; PMSG_ANS_EVENTUSERSCORE pMsg; pMsg.h.c = 0xC1; pMsg.h.headcode = 0x01; pMsg.h.size = sizeof(pMsg); pMsg.SquareNum = lpObj->m_bDevilSquareIndex; pMsg.Class = lpObj->Class; pMsg.h.subcode = 0x01; if ( lpObj->Class == 1 ) { if ( lpObj->Class >= 0 && lpObj->Class < MAX_TYPE_PLAYER ) { if ( DS_LEVEL_RANGE(lpObj->m_bDevilSquareIndex) != FALSE ) { lpObj->m_nEventScore+= this->m_BonusScoreTable[lpObj->Class][lpObj->m_bDevilSquareIndex]/100; } } pMsg.Score = lpObj->m_nEventScore; } else { pMsg.Score = lpObj->m_nEventScore; } pMsg.ServerCode = gGameServerCode; memcpy(pMsg.AccountID, lpObj->AccountID, sizeof(pMsg.AccountID)); memcpy(pMsg.GameID, lpObj->Name, sizeof(pMsg.GameID)); DataSendRank((char *)&pMsg, pMsg.h.size); LogAdd("[DevilSquare] Dead [%s][%s][%d][%d]", lpObj->AccountID, lpObj->Name, lpObj->m_nEventExp, lpObj->m_nEventScore); lpObj->m_nEventScore = 0; lpObj->m_nEventMoney = 0; lpObj->m_nEventExp = 0; }
void CDevilSquareGround::InsertObj(LPOBJ lpObj) { if ( lpObj->Authority != 2 ) { if ( lpObj->Class >= 0 && lpObj->Class < MAX_TYPE_PLAYER) { if ( DS_LEVEL_RANGE(lpObj->m_bDevilSquareIndex) != FALSE ) { lpObj->m_nEventScore += this->m_BonusScoreTable[lpObj->Class][lpObj->m_bDevilSquareIndex] / 100; } } this->m_DevilSquareRankList.push_back(lpObj); } }
void CDevilSquare::Load(char * filename) { int i; for ( i=0; i<MAX_DEVILSQUARE_GROUND; i++) { this->m_DevilSquareGround[i].Init(i); } int Token; int number; int type; int monstertype; int starttime; int endtime; int x; int y; int tx; int ty; SMDFile = fopen(filename, "r"); if ( SMDFile == NULL ) { MsgBox("[DevilSquare] Info file Load Fail [%s]", filename); return; } while ( true ) { Token = GetToken(); if ( Token == 2 ) { break; } type = (int)TokenNumber; while ( true ) { if ( type == 0 ) // Time Sync { Token = GetToken(); if ( strcmp("end", TokenString) == 0 ) { break; } this->m_iCloseTime = (int)TokenNumber; Token = GetToken(); this->m_iOpenTime = (int)TokenNumber; Token = GetToken(); this->m_iPlaytime = (int)TokenNumber; } else if ( type == 1 ) // Normal Monster Settings { Token = GetToken(); if ( strcmp("end", TokenString) == 0 ) { break; } number = (int)TokenNumber; // Devils Square Index; Token = GetToken(); monstertype = (int)TokenNumber; Token = GetToken(); starttime = (int)TokenNumber; Token = GetToken(); endtime = (int)TokenNumber; this->m_DevilSquareGround[number].Set(monstertype, starttime, endtime); } else if ( type == 2 ) // Boss Monster Set { Token = GetToken(); if ( strcmp("end", TokenString) == 0 ) { break; } number = (int)TokenNumber; // Devils Square Index; Token = GetToken(); monstertype = (int)TokenNumber; Token = GetToken(); starttime = (int)TokenNumber; Token = GetToken(); x = (int)TokenNumber; Token = GetToken(); y = (int)TokenNumber; Token = GetToken(); tx = (int)TokenNumber; Token = GetToken(); ty = (int)TokenNumber; this->m_DevilSquareGround[number].SetBoss(monstertype, starttime, x, y, tx, ty); } else if ( type == 3 ) // Bonus Sttings { Token = GetToken(); if ( strcmp("end", TokenString) == 0 ) { break; } int index; int rank; int zen; int exp; index = (int)TokenNumber; Token = GetToken(); rank = (int)TokenNumber; Token = GetToken(); exp = (int)TokenNumber; Token = GetToken(); zen = (int)TokenNumber; this->m_DevilSquareGround[index].SetBonus(rank, exp, zen); } else if ( type == 4 ) { DS_TIME tmp; Token = GetToken(); if ( strcmp("end", TokenString) == 0 ) { break; } tmp.iHour = (int)TokenNumber; Token = GetToken(); tmp.iMinute = (int)TokenNumber; m_EventTime.push_back(tmp); } else if ( type == 5 ) { Token = GetToken(); if ( strcmp("end", TokenString) == 0 ) { for( i = 0; i < MAX_DEVILSQUARE_GROUND; i++) { this->m_DevilSquareGround[i].IncBonus(m_BonusIncValue[i]); } break; } int index = (int)TokenNumber; if( DS_LEVEL_RANGE(index) ) { Token = GetToken(); m_BonusIncValue[index] = TokenNumber; } else { Token = GetToken(); } } } } fclose (SMDFile ); LogAdd("%s file load!", filename); }