HGSRC:
Game.cpp:
Buscar:
Código:
ZeroMemory(m_cHeldenianMapName, sizeof(m_cHeldenianMapName));
justo despues agregar:
Código:
//50Cent - Capture The Flag
m_sFlagCountWin = 0;
m_bIsCTFMode = false;
m_bIsElvineFlagCaptured = false;
m_bIsAresdenFlagCaptured = false;
m_iFlagCarrierIndex = -1;
Buscar:
Código:
delete m_pClientList[iClientH];
m_pClientList[iClientH] = NULL;
RemoveClientShortCut(iClientH);
y justo antes agregar:
Código:
//50Cent - Capture The Flag
if(bCheckIfIsFlagCarrier(iClientH))
{
SetFlagCarrierFlag(iClientH, false);
SetIceFlag(iClientH, DEF_OWNERTYPE_PLAYER, false);
}
Buscar:
Código:
if (m_bIsApocalypseMode == TRUE) {
if (memcmp(m_pMapList[m_pClientList[i]->m_cMapIndex]->m_cName, "abaddon", 7) == 0) {
SendNotifyMsg(NULL, i, DEF_NOTIFY_APOCGATEOPEN, 167, 169, NULL, m_pClientList[i]->m_cMapName);
}
else if (memcmp(m_pMapList[m_pClientList[i]->m_cMapIndex]->m_cName, "icebound", == 0) {
SendNotifyMsg(NULL, i, DEF_NOTIFY_APOCGATEOPEN, 89, 31, NULL, m_pClientList[i]->m_cMapName);
}
}
justo despues agregar:
Código:
//50Cent - Capture The Flag
if(m_bIsCTFMode)
{
RequestCheckFlag(i);
if(bCheckIfIsFlagCarrier(i))
{
if(m_pClientList[i]->m_iHP >= 1)
{
SetInvisibilityFlag(i, DEF_OWNERTYPE_PLAYER, false);
SetIceFlag(i, DEF_OWNERTYPE_PLAYER, true);
}
}
}
Buscar:
Código:
if (memcmp(cp, "/who", 4) == 0) {
// New 08/05/2003
if (m_pClientList[iClientH]->m_iAdminUserLevel >= m_iAdminLevelWho) {
// Àüü »ç¿ëÀÚ ¼ö¸¦ ¹¯´Â °ÃÀÌ´Ã
.
SendNotifyMsg(NULL, iClientH, DEF_NOTIFY_TOTALUSERS, NULL, NULL, NULL, NULL);
}
return;
}
justo despues agregar:
Código:
//50Cent - Capture The Flag
if (memcmp(cp, "/startctf", 9) == 0) {
if (m_pClientList[iClientH]->m_iAdminUserLevel >= 4) StartCaptureTheFlag();
return;
}
if (memcmp(cp, "/endctf", 7) == 0) {
if (m_pClientList[iClientH]->m_iAdminUserLevel >= 4) EndCaptureTheFlag(0);
return;
}
buscar:
Código:
case DEF_NOTIFY_NORECALL:
justo despues agregar:
Código:
//50Cent - Capture The Flag
case DEF_NOTIFY_CAPTURETHEFLAGSTART:
case DEF_NOTIFY_ARESDENCAPTUREDELVINEFLAG:
case DEF_NOTIFY_ELVINECAPTUREDARESDENFLAG:
case DEF_NOTIFY_ELVINEFLAGBACKTOCH:
case DEF_NOTIFY_ARESDENFLAGBACKTOCH:
case DEF_NOTIFY_ELVINEWINSROUND:
case DEF_NOTIFY_ARESDENWINSROUND:
case DEF_NOTIFY_ELVINEWINCTF:
case DEF_NOTIFY_ARESDENWINCTF:
case DEF_NOTIFY_TIECTF:
Buscar:
Código:
case DEF_MAGICTYPE_TELEPORT:
// ÅÚ·¹Ãâ€*÷Ãâ€*ÂÂ
¸¶¹ý. sValue 4¿¡ µû¶ó¼ÂÂ* ÅÚ·¹Ãâ€*÷Ãâ€*ÂÂ
¸ñÀûÃÂö°¡ °áäµÈ´Ù.
m_pMapList[m_pClientList[iClientH]->m_cMapIndex]->GetOwner(&sOwnerH, &cOwnerType, dX, dY);
y justo despues del //comentario agregar:
Código:
//50Cent - Capture The Flag
if(bCheckIfIsFlagCarrier(iClientH))
{
ShowClientMsg(iClientH, "You can not use that magic being a flag carrier.");
goto MAGIC_NOEFFECT;
}
Buscar:
Código:
case DEF_MAGICTYPE_INVISIBILITY:
switch (m_pMagicConfigList[sType]->m_sValue4) {
y justo antes del comienzo del switch, agregar:
Código:
//50Cent - Capture The flag
if(bCheckIfIsFlagCarrier(iClientH))
{
ShowClientMsg(iClientH, "You can not use that magic being a flag carrier.");
goto MAGIC_NOEFFECT;
}
Buscar:
Código:
if (cAttackerType == DEF_OWNERTYPE_PLAYER) {
// v1.432
// Ư¼ö ´É·ÂÀÌ ÀÖ´Â ¹«±â·Î °ø°ÝÀ» ´çÇß´Ù.
switch (m_pClientList[iAttackerH]->m_iSpecialAbilityType) {
case 1:
case 2:
case 3:
case 4:
case 5:
bIsSAattacked = TRUE;
break;
}
y justo arriba agregar:
Código:
//50Cent - Capture The Flag
if(bCheckIfIsFlagCarrier(iClientH))
{
SetIceFlag(iClientH, DEF_OWNERTYPE_PLAYER, false);
SetFlagCarrierFlag(iClientH, false);
}
Buscar:
Código:
switch (m_pClientList[iClientH]->m_pItemList[sItemIndex]->m_sItemEffectValue1) {
case 1:
// Recall ¸¶¹ý È¿°ú°¡ ÀÖ´Â ¾ÆÀÌÅÛ.
// testcode
RequestTeleportHandler(iClientH, "1 ");
y remplazar "RequestTeleportHandler(iClientH, "1 ");" por:
Código:
if(bCheckIfIsFlagCarrier(iClientH)) ShowClientMsg(iClientH, "You can not use that item being a flag carrier.");
else RequestTeleportHandler(iClientH, "1 ");
Buscar:
Código:
case 2:
// Åõ¸Ã* ¸¶¹ýÈ¿°ú°¡ ÀÖ´Â ¾ÆÀÌÅÛ.
PlayerMagicHandler(iClientH, m_pClientList[iClientH]->m_sX, m_pClientList[iClientH]->m_sY, 32, TRUE);
y remplzar "PlayerMagicHandler(iClientH, m_pClientList[iClientH]->m_sX, m_pClientList[iClientH]->m_sY, 32, TRUE);" por:
if(bCheckIfIsFlagCarrier(iClientH)) ShowClientMsg(iClientH, "You can not use that item being a flag carrier.");
else PlayerMagicHandler(iClientH, m_pClientList[iClientH]->m_sX, m_pClientList[iClientH]->m_sY, 32, TRUE);
Buscar:
Código:
case 4:
// fixed location teleportation: ÀÔÀå±Ç µÃ
µÃ
switch (m_pClientList[iClientH]->m_pItemList[sItemIndex]->m_sItemEffectValue2) {
case 1:
// ºÃ*¸Â
µù ¾ÆÀ÷Π°£´Ã
if (memcmp(m_pClientList[iClientH]->m_cMapName, "bisle", 5) != 0) {
//v1.42
ItemDepleteHandler(iClientH, sItemIndex, TRUE, TRUE);
RequestTeleportHandler(iClientH, "2 ", "bisle", -1, -1);
}
y remplazar:
Código:
if (memcmp(m_pClientList[iClientH]->m_cMapName, "bisle", 5) != 0) {
//v1.42
ItemDepleteHandler(iClientH, sItemIndex, TRUE, TRUE);
RequestTeleportHandler(iClientH, "2 ", "bisle", -1, -1);
}
por:
Código:
if(bCheckIfIsFlagCarrier(iClientH)) ShowClientMsg(iClientH, "You can not use that item being a flag carrier.");
else
{
if (memcmp(m_pClientList[iClientH]->m_cMapName, "bisle", 5) != 0)
{
ItemDepleteHandler(iClientH, sItemIndex, TRUE, TRUE);
RequestTeleportHandler(iClientH, "2 ", "bisle", -1, -1);
}
}
alfinal del game.cpp agregar:
Código:
//50Cent - Capture The Flag
void CGame::StartCaptureTheFlag()
{
if(m_bIsCTFMode) return;
m_sFlagCountWin = 5;
wsprintf(G_cTxt,"Capture The Flag: Win Flag Count(%d)", m_sFlagCountWin);
PutLogList(G_cTxt);
m_bIsCTFMode = true;
for(int i = 0; i < DEF_MAXCLIENTS; i++)
{
if(m_pClientList[i] != NULL)
{
SendNotifyMsg(NULL, i, DEF_NOTIFY_CAPTURETHEFLAGSTART, NULL, NULL, NULL, NULL,NULL,NULL,NULL,NULL,NULL,NULL, NULL);
}
}
PutLogList("(*) Capture The Flag Started!");
}
void CGame::RequestCheckFlag(int iClientH)
{
if(!m_bIsCTFMode) return;
if(m_pClientList[iClientH] == NULL) return;
if(m_pClientList[iClientH]->m_cSide == 0) RequestTeleportHandler(iClientH, "2 ", "default", -1, -1);
if((m_pClientList[iClientH]->m_sX == 151) && (m_pClientList[iClientH]->m_sY == 132))//Elvine Flag Cords
{
if(m_pClientList[iClientH]->m_iLevel >= 120)
{
if(m_pClientList[iClientH]->m_cSide == 1) //Aresden Side
{
if((!m_bIsAresdenFlagCaptured) && (!m_bIsElvineFlagCaptured)) //Aresden Capture Elvine Flag
{
PutLogList("Capture The Flag: Aresden Captured Elvine Flag!");
SetFlagCarrierFlag(iClientH, true);
}
}
else //Elvine Side
{
if((m_bIsAresdenFlagCaptured) && (!m_bIsElvineFlagCaptured))
{
PutLogList("Capture The Flag: Elvine wins this round!");
m_sElvineFlagCount++;
m_bIsAresdenFlagCaptured = false;
for(int i = 0; i < DEF_MAXCLIENTS; i++) if(m_pClientList[i] != NULL) SendNotifyMsg(NULL, i, DEF_NOTIFY_ELVINEWINSROUND, NULL, NULL, NULL, NULL,NULL,NULL,NULL,NULL,NULL,NULL, NULL);
if(m_sElvineFlagCount == 5)
{
EndCaptureTheFlag(2);
}
}
}
}
else RequestTeleportHandler(iClientH, "2 ", "elvine", -1, -1);
}
else if((m_pClientList[iClientH]->m_sX == 151) && (m_pClientList[iClientH]->m_sY == 128))//Aresden Flag Cords
{
if(m_pClientList[iClientH]->m_iLevel >= 120)
{
if(m_pClientList[iClientH]->m_cSide == 2) //Elvine Side
{
if((!m_bIsElvineFlagCaptured) && (!m_bIsAresdenFlagCaptured)) //Elvine Capture Aresden Flag
{
PutLogList("Capture The Flag: Elvine Captured Aresden Flag!");
SetFlagCarrierFlag(iClientH, true);
}
}
else //Aresden Side
{
if((m_bIsElvineFlagCaptured) && (!m_bIsAresdenFlagCaptured))
{
PutLogList("Capture The Flag: Aresden wins this round!");
m_sAresdenFlagCount++;
m_bIsElvineFlagCaptured = false;
for(int i = 0; i < DEF_MAXCLIENTS; i++) if(m_pClientList[i] != NULL) SendNotifyMsg(NULL, i, DEF_NOTIFY_ARESDENWINSROUND, NULL, NULL, NULL, NULL,NULL,NULL,NULL,NULL,NULL,NULL, NULL);
if(m_sAresdenFlagCount == 5)
{
EndCaptureTheFlag(1);
}
}
}
}
else RequestTeleportHandler(iClientH, "2 ", "aresden", -1, -1);
}
}
BOOL CGame::bCheckIfIsFlagCarrier(int iClientH)
{
if(!m_bIsCTFMode) return false;
if(m_iFlagCarrierIndex == -1) return false;
if(m_pClientList[iClientH] == NULL) return false;
if(iClientH == m_iFlagCarrierIndex) return true;
else return false;
}
void CGame::SetFlagCarrierFlag(int iClientH, BOOL bFlagMode)
{
if(!m_bIsCTFMode) return;
if(m_pClientList[iClientH] == NULL) return;
if(bFlagMode)
{
PutLogList("Capture The Flag: New Flag Carrier!");
m_iFlagCarrierIndex = iClientH;
if(m_pClientList[iClientH]->m_cSide == 1)
{
m_bIsElvineFlagCaptured = true;
for(int i = 0; i < DEF_MAXCLIENTS; i++) if(m_pClientList[i] != NULL) SendNotifyMsg(NULL, i, DEF_NOTIFY_ARESDENCAPTUREDELVINEFLAG, NULL, NULL, NULL, NULL,NULL,NULL,NULL,NULL,NULL,NULL, NULL);
}
else
{
m_bIsAresdenFlagCaptured = true;
for(int i = 0; i < DEF_MAXCLIENTS; i++) if(m_pClientList[i] != NULL) SendNotifyMsg(NULL, i, DEF_NOTIFY_ELVINEFLAGBACKTOCH, NULL, NULL, NULL, NULL,NULL,NULL,NULL,NULL,NULL,NULL, NULL);
}
m_pClientList[iClientH]->m_iEnemyKillCount += 20;
SendNotifyMsg(NULL, iClientH, DEF_NOTIFY_ENEMYKILLREWARD, iClientH, NULL, NULL, NULL);
if(m_pClientList[iClientH]->m_cSide == 1) m_pClientList[iClientH]->m_iStatus = m_pClientList[iClientH]->m_iStatus | 0x80000; //Aresden Flag
else if(m_pClientList[iClientH]->m_cSide == 2) m_pClientList[iClientH]->m_iStatus = m_pClientList[iClientH]->m_iStatus | 0x40000; //Elvine Flag
}
else
{
PutLogList("Capture The Flag: Flag Carrier Reset.");
m_iFlagCarrierIndex = -1;
if(m_pClientList[iClientH]->m_cSide == 1)
{
m_bIsElvineFlagCaptured = false;
for(int i = 0; i < DEF_MAXCLIENTS; i++) if(m_pClientList[i] != NULL) SendNotifyMsg(NULL, i, DEF_NOTIFY_ELVINECAPTUREDARESDENFLAG, NULL, NULL, NULL, NULL,NULL,NULL,NULL,NULL,NULL,NULL, NULL);
}
else
{
m_bIsAresdenFlagCaptured = false;
for(int i = 0; i < DEF_MAXCLIENTS; i++) if(m_pClientList[i] != NULL) SendNotifyMsg(NULL, i, DEF_NOTIFY_ARESDENFLAGBACKTOCH, NULL, NULL, NULL, NULL,NULL,NULL,NULL,NULL,NULL,NULL, NULL);
}
m_pClientList[iClientH]->m_iStatus = m_pClientList[iClientH]->m_iStatus | 0x00001000;
}
}
void CGame::EndCaptureTheFlag(int iOption)
{
if(!m_bIsCTFMode) return;
int i;
switch(iOption)
{
case 0://Finished by GM
for(i = 0; i < DEF_MAXCLIENTS; i++) if(m_pClientList[i] != NULL) SendNotifyMsg(NULL, i, DEF_NOTIFY_TIECTF, NULL, NULL, NULL, NULL,NULL,NULL,NULL,NULL,NULL,NULL, NULL);
_CreateCTFGUID(0);
break;
case 1://Aresden Win
for(i = 0; i < DEF_MAXCLIENTS; i++) if(m_pClientList[i] != NULL) SendNotifyMsg(NULL, i, DEF_NOTIFY_ARESDENWINCTF, NULL, NULL, NULL, NULL,NULL,NULL,NULL,NULL,NULL,NULL, NULL);
_CreateCTFGUID(1);
break;
case 2://Elvine Win
for(i = 0; i < DEF_MAXCLIENTS; i++) if(m_pClientList[i] != NULL) SendNotifyMsg(NULL, i, DEF_NOTIFY_ELVINEWINCTF, NULL, NULL, NULL, NULL,NULL,NULL,NULL,NULL,NULL,NULL, NULL);
_CreateCTFGUID(2);
break;
}
}
void CGame::_CreateCTFGUID(int iWinnerSide)
{
char * cp, cTxt[256], cFn[256], cTemp[1024];
FILE * pFile;
_mkdir("GameData");
ZeroMemory(cFn, sizeof(cFn));
strcat(cFn,"GameData");
strcat(cFn,"\\");
strcat(cFn,"\\");
strcat(cFn,"CTFGUID.Txt");
pFile = fopen(cFn, "wt");
if (pFile == NULL) {
PutLogList("(!) Cannot create CTFGUID(%d) file");
}
else {
ZeroMemory(cTemp, sizeof(cTemp));
ZeroMemory(cTxt, sizeof(cTxt));
wsprintf(cTxt, "winner-side = %d\n", iWinnerSide);
strcat(cTemp, cTxt);
cp = (char *)cTemp;
fwrite(cp, strlen(cp), 1, pFile);
PutLogList("(O) CTFGUID(%d) file created");
}
if (pFile != NULL) fclose(pFile);
}
Game.h:
Declarar:
Código:
//50Cent - Capture The Flag
void StartCaptureTheFlag();
void RequestCheckFlag(int iClientH);
BOOL bCheckIfIsFlagCarrier(int iClientH);
void SetFlagCarrierFlag(int iClientH, BOOL bFlagMode);
void EndCaptureTheFlag(int iOption);
void _CreateCTFGUID(int iWinnerSide);
//50Cent - Capture The Flag
BOOL m_bIsCTFMode;
short m_sFlagCountWin;
short m_sElvineFlagCount;
short m_sAresdenFlagCount;
BOOL m_bIsElvineFlagCaptured;
BOOL m_bIsAresdenFlagCaptured;
int m_iFlagCarrierIndex;
Netmessage.h:
Código:
//50Cent - Capture The Flag
#define DEF_NOTIFY_CAPTURETHEFLAGSTART 0x1F19
#define MSGID_REQUEST_CHECKFLAG 0x1F20
#define DEF_NOTIFY_ARESDENCAPTUREDELVINEFLAG 0x1F21
#define DEF_NOTIFY_ELVINECAPTUREDARESDENFLAG 0x1F22
#define DEF_NOTIFY_ELVINEFLAGBACKTOCH 0x1F23
#define DEF_NOTIFY_ARESDENFLAGBACKTOCH 0x1F24
#define DEF_NOTIFY_ELVINEWINSROUND 0x1F25
#define DEF_NOTIFY_ARESDENWINSROUND 0x1F26
#define DEF_NOTIFY_ELVINEWINCTF 0x1F27
#define DEF_NOTIFY_ARESDENWINCTF 0x1F28
#define DEF_NOTIFY_TIECTF 0x1F29