www.hellss.fora.pl
Hells! Nice Forum About Helbreath
FAQ
Szukaj
Użytkownicy
Grupy
Galerie
Rejestracja
Profil
Zaloguj się, by sprawdzić wiadomości
Zaloguj
Forum www.hellss.fora.pl Strona Główna
->
FIX
Napisz odpowiedź
Użytkownik
Temat
Treść wiadomości
Emotikony
Więcej Ikon
Kolor:
Domyślny
Ciemnoczerwony
Czerwony
Pomarańćzowy
Brązowy
Żółty
Zielony
Oliwkowy
Błękitny
Niebieski
Ciemnoniebieski
Purpurowy
Fioletowy
Biały
Czarny
Rozmiar:
Minimalny
Mały
Normalny
Duży
Ogromny
Zamknij Tagi
Opcje
HTML:
NIE
BBCode
:
TAK
Uśmieszki:
TAK
Wyłącz BBCode w tym poście
Wyłącz Uśmieszki w tym poście
Kod potwierdzający: *
Wszystkie czasy w strefie EET (Europa)
Skocz do:
Wybierz forum
Hells!
----------------
Citi Hall
Hells
Helbreath
----------------
Code
FIX
Server Confing
Helbreath
Help
Anty Hacks
Screnshot
Przegląd tematu
Autor
Wiadomość
Nigga
Wysłany: Wto 14:33, 25 Mar 2008
Temat postu: [FIX]Apocalypse 100% Working
Code de Apocalypse funcionando al 100%
Código:
Kod:
//**************************************************************************************
// HBx server introduced only the skeletton off Apocalypse functions, and sometime not so good!
// I rewrote them, maybe not following the "official" pattern but it works!
// I also needed to add many new functions.
//**************************************************************************************
// SNOOPY: GlobalStartApocalypseMode
// Called by: by local command or GM command
// -> Notify all game servers to start apocalypse
// -> Used to force Open or Closed the initial Gates
//**************************************************************************************
void CGame::GlobalStartApocalypseMode(int iClientH, int iMode)
{ char * cp, cData[120];
DWORD * dwp, dwApocalypseGUID;
char cString[200];
ZeroMemory(cString, sizeof(cString));
if ((iClientH != 0) && (m_pClientList[iClientH]->m_iAdminUserLevel < 3)) {
SendNotifyMsg(NULL, iClientH, DEF_NOTIFY_ADMINUSERLEVELLOW, NULL, NULL, NULL, NULL);
return;
}
if ((m_bIsApocalypseMode == TRUE) && (iMode == 0)) return;
if (m_bIsHeldenianMode == TRUE) return;
if (m_bIsCrusadeMode == TRUE) return;
switch (iMode){
case 1: // Force open Gates
dwApocalypseGUID = 1;
if (iClientH !=0)
{ wsprintf(G_cTxt, "Admin Order(%s): /openapocalypsegate \tAdminIP(%s)"
, m_pClientList[iClientH]->m_cCharName
, m_pClientList[iClientH]->m_cIPaddress);
wsprintf(cString, "Apocalypse gate opening in progress.");
}else
{ wsprintf(G_cTxt, "Local command: openapocalypsegate");
};
break;
case 2: // Force close gates
dwApocalypseGUID = 2;
if (iClientH !=0)
{ wsprintf(G_cTxt, "Admin Order(%s): /closeapocalypsegate \tAdminIP(%s)"
, m_pClientList[iClientH]->m_cCharName
, m_pClientList[iClientH]->m_cIPaddress);
wsprintf(cString, "Apocalypse gate closing in progress.");
}else
{ wsprintf(G_cTxt, "Local command: closeapocalypsegate");
};
break;
case 0: // Start Apocalypse
dwApocalypseGUID = timeGetTime();
if (dwApocalypseGUID < 10) dwApocalypseGUID += 10;
if (iClientH !=0)
{ wsprintf(G_cTxt, "Admin Order(%s): /beginapocalypse \tAdminIP(%s)"
, m_pClientList[iClientH]->m_cCharName
, m_pClientList[iClientH]->m_cIPaddress);
wsprintf(cString, "Apocalypse starting in progress.");
}else
{ wsprintf(G_cTxt, "Local command: beginapocalypse");
};
break;
}
PutAdminLogFileList(G_cTxt);
PutLogEventFileList(G_cTxt);
PutLogList(G_cTxt);
if (iClientH !=0)
{ SendNotifyMsg(NULL, iClientH, DEF_NOTIFY_IPACCOUNTINFO, NULL, NULL, NULL, cString);
}
ZeroMemory(cData, sizeof(cData));
cp = (char *)cData;
*cp = GSM_BEGINAPOCALYPSE;
cp++;
dwp = (DWORD *)cp;
*dwp = dwApocalypseGUID;
cp += 4;
bStockMsgToGateServer(cData, 5);
LocalStartApocalypse(dwApocalypseGUID); // Gate will no return order to this server
}
//**************************************************************************************
// SNOOPY: Revamped Apocalypse functions:
// LocalStartApocalypse
// called by: started by Gate msg
// -> Notify players
// -> Opens the gates
// -> Prevent npc generation on "kill all to go out" maps
// -> Execute local Openning or closing gates by GM command
//**************************************************************************************
void CGame::LocalStartApocalypse(DWORD dwApocalypseGUID)
{ if (dwApocalypseGUID == 1)// Means want to open Gate
{ ForceOpen_ApocalypseGate();
return;
}
if (dwApocalypseGUID == 2)// Means want to open Gate
{ ForceClose_ApocalypseGate();
return;
}
register int i;
m_bIsApocalypseMode = TRUE;
if (dwApocalypseGUID != NULL)
{ _CreateApocalypseGUID(dwApocalypseGUID);
m_dwApocalypseGUID = dwApocalypseGUID;
m_dwApocalypseGateOpenTime = dwApocalypseGUID;
m_dwApocalypseGateCloseTime = dwApocalypseGUID +20*60*1000; // will close in 20 minutes
}
for (i = 1; i < DEF_MAXCLIENTS; i++)
{ if (m_pClientList[i] != NULL)
{ SendNotifyMsg(NULL, i, DEF_NOTIFY_APOCGATESTARTMSG, NULL, NULL, NULL, NULL);
}
}
for (i = 0; i < DEF_MAXMAPS; i++)
{ if (m_pMapList[i] != NULL)
{ if (m_pMapList[i]->m_iApocalypseMobGenType != 0)
//1 for no respawn, 2 for Boss spawn when map empty
{ m_pMapList[i]->m_iMaximumObjectDefault = m_pMapList[i]->m_iMaximumObject;
m_pMapList[i]->m_iMaximumObject = 0;
}
}
}
OpenCloseApocalypseGate();
wsprintf(G_cTxt,"(!)Apocalypse Mode ON.");
PutLogEventFileList(G_cTxt);
PutLogList(G_cTxt);
}
//**************************************************************************************
// SNOOPY: Revamped Apocalypse functions:
// GlobalEndApocalypseMode:
// -> Notify all game servers
//**************************************************************************************
void CGame::GlobalEndApocalypseMode(int iClientH)
{ char * cp, cData[120];
if (m_bIsApocalypseMode == FALSE) return;
if (iClientH > 0)
{ wsprintf(G_cTxt, "Admin Order(%s): /endapocalypse \tAdminIP(%s)"
, m_pClientList[iClientH]->m_cCharName
, m_pClientList[iClientH]->m_cIPaddress);
char cString[200];
ZeroMemory(cString, sizeof(cString));
wsprintf(cString, "Apocalypse ending in progress.");
SendNotifyMsg(NULL, iClientH, DEF_NOTIFY_IPACCOUNTINFO, NULL, NULL, NULL, cString);
}else
{ wsprintf(G_cTxt, "Automated: endapocalypse");
}
PutAdminLogFileList(G_cTxt);
PutLogEventFileList(G_cTxt);
PutLogList(G_cTxt);
ZeroMemory(cData, sizeof(cData));
cp = (char *)cData;
*cp = GSM_ENDAPOCALYPSE;
cp++;
bStockMsgToGateServer(cData, 5);
LocalEndApocalypse(); // Gate will not return order to this server
}
//**************************************************************************************
// SNOOPY: Revamped Apocalypse functions:
// LocalEndApocalypse: started by Gate msg
// -> Notify players
// -> Close the gates
// -> Enable npc generation on all maps
//**************************************************************************************
void CGame::LocalEndApocalypse()
{ register int i;
m_bIsApocalypseMode = FALSE;
m_bIsApocalypseGateOpen = FALSE;
WORD dwTime = timeGetTime();
m_dwApocalypseGateCloseTime = dwTime -1;
m_dwApocalypseGateOpenTime = dwTime -100; // alreaddy closed
for (i = 1; i < DEF_MAXCLIENTS; i++)
{ if (m_pClientList[i] != NULL)
{ SendNotifyMsg(NULL, i, DEF_NOTIFY_APOCGATEENDMSG, NULL, NULL, NULL, NULL);
if ( (m_pClientList[i]->m_iAdminUserLevel == 0)
&& (m_pMapList[m_pClientList[i]->m_cMapIndex]->m_bIsApocalypseMap == TRUE))
{ // forced recall
SendNotifyMsg(NULL, i, DEF_NOTIFY_TOBERECALLED, NULL, NULL, NULL, NULL);
RequestTeleportHandler(i, "0 ");
}
}
}
// restore normal spawn on apoc maps
for (i = 0; i < DEF_MAXMAPS; i++)
{ if (m_pMapList[i] != NULL)
{ if (m_pMapList[i]->m_iApocalypseMobGenType != 0)
//1 for not respawn, 2 for Boss spawn.
{ m_pMapList[i]->m_iMaximumObject = m_pMapList[i]->m_iMaximumObjectDefault;
}
if (m_pMapList[i]->m_cDynamicGateType == 4 )
{ m_pMapList[i]->m_cDynamicGateType = 3;
}
if (m_pMapList[i]->m_cDynamicGateType == 2)
{ GenerateSlime(i); // to force the gate to close
}
Open_EmptyMap_Gate(i);
}
}
wsprintf(G_cTxt,"(!)Apocalypse Mode OFF.");
PutLogEventFileList(G_cTxt);
PutLogList(G_cTxt);
}
//**************************************************************************************
// SNOOPY: Revamped Apocalypse functions:
// OpenCloseApocalypseGate
// Called by ::ForceOpen_ApocalypseGate, ::ForceClose_ApocalypseGate
// Called by ::LocalStartApocalypse
// Check if Gates's needs to be openned or closed
// then notify any change to all clients.on current server
// NB: Opens/closes only type 1 Gates
//**************************************************************************************
void CGame::OpenCloseApocalypseGate()
{ DWORD dwTime = timeGetTime();
BOOL bIsOpen = m_bIsApocalypseGateOpen;
if ( (dwTime >= m_dwApocalypseGateOpenTime)
&& (dwTime < m_dwApocalypseGateCloseTime))
{ m_bIsApocalypseGateOpen = TRUE;
}else
{ m_bIsApocalypseGateOpen = FALSE;
}
// If nothing has changed return...
if (bIsOpen == m_bIsApocalypseGateOpen) return;
if (m_bIsApocalypseGateOpen == TRUE)
{ wsprintf(G_cTxt,"(!)Apocalypse Gate opened.");
}else
{ wsprintf(G_cTxt,"(!)Apocalypse Gate closed.");
}
PutLogList(G_cTxt);
PutLogEventFileList(G_cTxt);
// Then notify all clients of change,
register int i;
for (i = 1; i < DEF_MAXCLIENTS; i++)
{ if (m_pClientList[i] != NULL)
{ Notify_ApocalypseGateState(i);
}
}
}
//**************************************************************************************
// SNOOPY: Revamped Apocalypse functions:
// Notify_ApocalypseGateState
// Called by ::RequestInitDataHandler (when client log in)
// Called by ::RequestTeleportHandler (when client changes map on same server)
// Called by ::OpenCloseApocalypseGate (when Gate is openned or closed)
// Notify the client of Gate's state, needed to show in player's screen
//**************************************************************************************
void CGame::Notify_ApocalypseGateState(int iClientH)
{ if (iClientH <= 0) return;
if (m_pClientList[iClientH] <= 0) return;
if (m_pClientList[iClientH]->m_bIsInitComplete == FALSE) return;
int iMapIndex = m_pClientList[iClientH]->m_cMapIndex;
int gX, gY;
gX = (m_pMapList[iMapIndex]->m_sDynamicGateCoordRectX1 + m_pMapList[iMapIndex]->m_sDynamicGateCoordRectX2)/2;
gY = (m_pMapList[iMapIndex]->m_sDynamicGateCoordRectY1 + m_pMapList[iMapIndex]->m_sDynamicGateCoordRectY2)/2;
switch (m_pMapList[iMapIndex]->m_cDynamicGateType){
case 0: // No gate on current map
if(m_bIsApocalypseGateOpen == TRUE)
{ SendNotifyMsg(NULL, iClientH, DEF_NOTIFY_APOCGATEOPEN, 0, 0, NULL, m_pClientList[iClientH]->m_cMapName);
SendNotifyMsg(NULL, iClientH, DEF_NOTIFY_APOCGATESTARTMSG, NULL, NULL, NULL, NULL);
}else
{ SendNotifyMsg(NULL, iClientH, DEF_NOTIFY_APOCGATECLOSE, 0, 0, NULL, m_pClientList[iClientH]->m_cMapName);
SendNotifyMsg(NULL, iClientH, DEF_NOTIFY_APOCGATEENDMSG, NULL, NULL, NULL, NULL);
}
break;
case 1: // Initial Dynamic gates (toh, IB, D4...)
if(m_bIsApocalypseGateOpen == TRUE)
{ SendNotifyMsg(NULL, iClientH, DEF_NOTIFY_APOCGATEOPEN, gX, gY, NULL, m_pClientList[iClientH]->m_cMapName);
SendNotifyMsg(NULL, iClientH, DEF_NOTIFY_APOCGATESTARTMSG, NULL, NULL, NULL, NULL);
}else
{ SendNotifyMsg(NULL, iClientH, DEF_NOTIFY_APOCGATECLOSE, gX, gY, NULL, m_pClientList[iClientH]->m_cMapName);
SendNotifyMsg(NULL, iClientH, DEF_NOTIFY_APOCGATEENDMSG, NULL, NULL, NULL, NULL);
}
break;
case 2: // Empty maps Dynamic gates (inferniaA, inferniaB, procella...)
if (m_pMapList[iMapIndex]->m_iTotalAliveObject == 0)
{ SendNotifyMsg(NULL, iClientH, DEF_NOTIFY_APOCGATEOPEN, gX, gY, NULL, m_pClientList[iClientH]->m_cMapName);
SendNotifyMsg(NULL, iClientH, DEF_NOTIFY_APOCGATESTARTMSG, NULL, NULL, NULL, NULL);
}else
{ SendNotifyMsg(NULL, iClientH, DEF_NOTIFY_APOCGATECLOSE, gX, gY , NULL, m_pClientList[iClientH]->m_cMapName);
}
break;
case 3: // Hide the n°3 gates ..
SendNotifyMsg(NULL, iClientH, DEF_NOTIFY_APOCGATECLOSE, gX, gY, NULL, m_pClientList[iClientH]->m_cMapName);
break;
case 4: // Show the gate on abaddon map..when Abaddon spawning.
SendNotifyMsg(NULL, iClientH, DEF_NOTIFY_APOCGATEOPEN, gX, gY, NULL, m_pClientList[iClientH]->m_cMapName);
SendNotifyMsg(NULL, iClientH, DEF_NOTIFY_APOCGATESTARTMSG, NULL, NULL, NULL, NULL);
break;
}
}
//**************************************************************************************
// SNOOPY: Revamped Apocalypse functions:
// Use_ApocalypseGate
// Called by ::CheckClientResponseTime()
// Test if client uses Dynamic Gate, then TP him
//**************************************************************************************
void CGame::Use_ApocalypseGate(int iClientH)
{ if (iClientH <= 0) return;
if (m_pClientList[iClientH] <= 0) return;
if (m_pClientList[iClientH]->m_bIsInitComplete == FALSE) return;
if (m_bIsApocalypseMode == FALSE) return;
int iMapIndex = m_pClientList[iClientH]->m_cMapIndex;
if (m_pMapList[iMapIndex]->m_cDynamicGateType == 0 ) return; // No Dynamic Gate on this map
if ( (m_pMapList[iMapIndex]->m_cDynamicGateType == 1 )
&& (m_bIsApocalypseGateOpen == FALSE))
return; // Dynamic Gate is closed
if ( (m_pMapList[iMapIndex]->m_cDynamicGateType == 2 )
&& (m_pMapList[iMapIndex]->m_iTotalAliveObject != 0))
return; // There are still creatures on the map
if (m_pMapList[iMapIndex]->m_cDynamicGateType == 3 )
return; // Type 3 will be changed to 4 at Abaddons spawning.
if ( (m_pClientList[iClientH]->m_sX >= m_pMapList[iMapIndex]->m_sDynamicGateCoordRectX1)
&& (m_pClientList[iClientH]->m_sX <= m_pMapList[iMapIndex]->m_sDynamicGateCoordRectX2)
&& (m_pClientList[iClientH]->m_sY >= m_pMapList[iMapIndex]->m_sDynamicGateCoordRectY1)
&& (m_pClientList[iClientH]->m_sY <= m_pMapList[iMapIndex]->m_sDynamicGateCoordRectY2))
{ RequestTeleportHandler(iClientH, "2 "
, m_pMapList[iMapIndex]->m_cDynamicGateCoordDestMap
, m_pMapList[iMapIndex]->m_sDynamicGateCoordTgtX
, m_pMapList[iMapIndex]->m_sDynamicGateCoordTgtY);
}
}
//**************************************************************************************
// SNOOPY: Revamped Apocalypse functions:
// Open_EmptyMap_Gate
// Called by ::NpcKilledHandler when last npc killed on map
// Show just openned gates to the client
//**************************************************************************************
void CGame::Open_EmptyMap_Gate(int MapIndex)
{ if (m_pMapList[MapIndex]->m_cDynamicGateType < 2 ) return;
//if (m_pMapList[MapIndex]->m_cDynamicGateType == 3 ) return;
register int i;
for (i = 1; i < DEF_MAXCLIENTS; i++)
{ if (m_pClientList[i] == NULL) continue;
if (m_pClientList[i]->m_cMapIndex != MapIndex) continue;
Notify_ApocalypseGateState(i);
}
}
//**************************************************************************************
// SNOOPY: Revamped Apocalypse functions:
// GenerateApocalypseBoss
// Called by ::NpcKilledHandler
// Creates the appropriate npc depending on map definition file
// then change the Dynamic Gate type from 3 to 4 (to open it)
//**************************************************************************************
void CGame::GenerateApocalypseBoss(int MapIndex)
{ if (m_pMapList[MapIndex]->m_iTotalAliveObject != 0) return;
char cName[21], cNpcName[21], cNpcWaypoint[11];
int x, i5;
int iNamingValue;
ZeroMemory(cNpcWaypoint, sizeof(cNpcWaypoint));
iNamingValue = m_pMapList[MapIndex]->iGetEmptyNamingValue();
if (iNamingValue == -1)
{}else
{ ZeroMemory(cNpcName, sizeof(cNpcName));
switch (m_pMapList[MapIndex]->m_iApocalypseBossMobNpcID) {
case 0: return; break;
case 49: strcpy(cNpcName, "Hellclaw");break;
case 50: strcpy(cNpcName, "Tigerworm");break;
case 66: strcpy(cNpcName, "Wyvern");break;
case 73: strcpy(cNpcName, "Fire-Wyvern");break;
case 81: strcpy(cNpcName, "Abaddon");break;
default: strcpy(cNpcName, "Demon");break;
}
ZeroMemory(cName, sizeof(cName));
wsprintf(cName, "XX%d", iNamingValue);
cName[0] = '_';
cName[1] = MapIndex+65;
if (bCreateNewNpc(cNpcName, cName, m_pMapList[MapIndex]->m_cName, 0, 0
, DEF_MOVETYPE_RANDOMAREA, NULL, NULL, cNpcWaypoint, &m_pMapList[MapIndex]->m_sApocalypseBossMobRect, NULL, -1, FALSE, FALSE, FALSE, TRUE) == FALSE)
{ m_pMapList[MapIndex]->SetNamingValueEmpty(iNamingValue);
}
else
{ wsprintf(G_cTxt, "(!) %s has spawned in %s"
, cNpcName
, m_pMapList[MapIndex]->m_cName);
PutLogList(G_cTxt);
PutLogFileList(G_cTxt);
PutLogEventFileList(G_cTxt);
}
// Search npc ID
for (i5 = 1; i5 < DEF_MAXNPCS; i5++)
{ if ((m_pNpcList[i5] != NULL) && (memcmp(m_pNpcList[i5]->m_cName, cName, 5) == 0) )
{ break;
}
}
// Show Spawns on minimap, and tell everybody on Apocalypse server.
for (x = 1; x < DEF_MAXCLIENTS; x++)
if ( (m_pClientList[x] != NULL)
&& (m_pClientList[x]->m_bIsInitComplete == TRUE))
{ if(memcmp(m_pMapList[MapIndex]->m_cName, m_pMapList[m_pClientList[x]->m_cMapIndex]->m_cName, strlen(m_pMapList[MapIndex]->m_cName)) == 0)
{ SendNotifyMsg(NULL, x, DEF_NOTIFY_SPAWNEVENT, m_pNpcList[i5]->m_sX, m_pNpcList[i5]->m_sY, m_pMapList[MapIndex]->m_iApocalypseBossMobNpcID, NULL, NULL, NULL);
}
// Tell everybody on this server if Abaddon has appeared
if (m_pMapList[MapIndex]->m_iApocalypseBossMobNpcID == 81)
{ char cInfoString[100];
ZeroMemory(cInfoString, sizeof(cInfoString));
wsprintf(cInfoString, "Abbadon has appeared ...");
SendNotifyMsg(NULL, x, DEF_NOTIFY_IPACCOUNTINFO, NULL, NULL, NULL, cInfoString);
}
}
// Prepare Abaddon's death, and Apocalypse end.
if (m_pMapList[MapIndex]->m_iApocalypseBossMobNpcID == 81)
{ // Abaddon should die by himself
DWORD dwTime = timeGetTime();
dwTime += 1000*60*5; // 5 minute
bRegisterDelayEvent(DEF_DELAYEVENTTYPE_KILL_ABADDON, 0, dwTime, i5
, DEF_OWNERTYPE_NPC, MapIndex, 0, 0, 0, 0, 0);
dwTime = timeGetTime();
dwTime += 1000*60*15; // 15 minutes
bRegisterDelayEvent(DEF_DELAYEVENTTYPE_END_APOCALYPSE, 0, dwTime, 0
, 0, MapIndex, 0, 0, 0, 0, 0);
}
// Finally open the Exit Gate if type 3 & not 2
if (m_pMapList[MapIndex]->m_cDynamicGateType == 3 )
{ m_pMapList[MapIndex]->m_cDynamicGateType = 4;
Open_EmptyMap_Gate(MapIndex);
}
}
}
//**************************************************************************************
// SNOOPY: Revamped Apocalypse functions:
// GenerateSlime
// Generate a npc now to close the gate
//**************************************************************************************
void CGame::GenerateSlime(int MapIndex)
{
if (m_pMapList[MapIndex]->m_iTotalAliveObject != 0) return;
char cName[21], cNpcName[21], cNpcWaypoint[11];
int iNamingValue;
ZeroMemory(cNpcWaypoint, sizeof(cNpcWaypoint));
iNamingValue = m_pMapList[MapIndex]->iGetEmptyNamingValue();
if (iNamingValue == -1) {
}
else {
strcpy(cNpcName, "Slime");
ZeroMemory(cName, sizeof(cName));
wsprintf(cName, "XX%d", iNamingValue);
cName[0] = '_';
cName[1] = MapIndex+65;
if (bCreateNewNpc(cNpcName, cName, m_pMapList[MapIndex]->m_cName, 0, 0
, DEF_MOVETYPE_RANDOMAREA, NULL, NULL, cNpcWaypoint, &m_pMapList[MapIndex]->m_sApocalypseBossMobRect, NULL, NULL, FALSE, FALSE, FALSE, TRUE) == FALSE)
{ m_pMapList[MapIndex]->SetNamingValueEmpty(iNamingValue);
}
}
}
//**************************************************************************************
// SNOOPY: Revamped Apocalypse functions:
// ForceOpen_ApocalypseGate
// Local execution off a global GM command to force open the gate
// Beware this will affect only current server
//**************************************************************************************
void CGame::ForceOpen_ApocalypseGate()
{ if (m_bIsApocalypseMode == FALSE) return;
DWORD dwTime = timeGetTime();
m_dwApocalypseGateOpenTime = dwTime;
m_dwApocalypseGateCloseTime = dwTime +15*60*1000; // will close in 15 minutes
OpenCloseApocalypseGate();
}
//**************************************************************************************
// SNOOPY: Revamped Apocalypse functions:
// ForceClose_ApocalypseGate
// GM command to force open the gate
// Beware this will affect only current server
//**************************************************************************************
void CGame::ForceClose_ApocalypseGate()
{ if (m_bIsApocalypseMode == FALSE) return;
DWORD dwTime = timeGetTime();
m_dwApocalypseGateCloseTime = dwTime -1;
m_dwApocalypseGateOpenTime = dwTime -100; // alreaddy closed
OpenCloseApocalypseGate();
}
//**************************************************************************************
De paso dejo el Apocalypse Thunder Fixed:
Código:
Kod:
void CGame::SendThunder(int iClient, short sX, short sY, short sV3, short sV4)
{ char * cp, cData[100];
DWORD * dwp;
WORD * wp;
short * sp;
int iRet;
ZeroMemory(cData, sizeof(cData));
dwp = (DWORD *)(cData + DEF_INDEX4_MSGID);
*dwp = MSGID_EVENT_COMMON;
wp = (WORD *)(cData + DEF_INDEX2_MSGTYPE);
*wp = DEF_COMMONTYPE_MAGIC;
cp = (char *)(cData + DEF_INDEX2_MSGTYPE + 2);
sp = (short *)cp;
*sp = sX;
cp += 2;
sp = (short *)cp;
*sp = sY;
cp += 2;
sp = (short *)cp;
*sp = sX;
cp += 2;
sp = (short *)cp;
*sp = sY;
cp += 2;
sp = (short *)cp;
*sp = sV3;
cp += 2;
sp = (short *)cp;
*sp = sV4;
cp += 2;
iRet = m_pClientList[iClient]->m_pXSock->iSendMsg(cData, 18);
}
void CGame::DoAbaddonThunderDamageHandler(char cMapIndex)
{ int iResult;
register int i;
//if (m_bIsApocalypseMode != TRUE) return;
if (iDice(1, 15) != 13) return;
DWORD dwTime = timeGetTime();
for (i = 0; i < DEF_MAXCLIENTS; i++)
{ if (m_pClientList[i] != NULL)
{ //if (m_pClientList[i]->m_iAdminUserLevel > 0) return;
if ((memcmp(m_pClientList[i]->m_cMapName, "abaddon", 7) == 0)
|| (m_pClientList[i]->m_cMapIndex == cMapIndex))
{ switch (iDice(1,4)) {
case 1:
SendThunder(i, m_pClientList[i]->m_sX, m_pClientList[i]->m_sY, 203, m_pClientList[i]->m_sType);
SendThunder(i, m_pClientList[i]->m_sX-iDice(1,7), m_pClientList[i]->m_sY+iDice(1,5), 161, m_pClientList[i]->m_sType);
break;
case 2:
SendThunder(i, m_pClientList[i]->m_sX, m_pClientList[i]->m_sY, 202, m_pClientList[i]->m_sType);
SendThunder(i, m_pClientList[i]->m_sX+iDice(1,7), m_pClientList[i]->m_sY-iDice(1,5), 161, m_pClientList[i]->m_sType);
break;
case 3:
SendThunder(i, m_pClientList[i]->m_sX, m_pClientList[i]->m_sY, 201, m_pClientList[i]->m_sType);
SendThunder(i, m_pClientList[i]->m_sX+iDice(1,7), m_pClientList[i]->m_sY+5-iDice(1,9), 161, m_pClientList[i]->m_sType);
break;
case 4:
SendThunder(i, m_pClientList[i]->m_sX, m_pClientList[i]->m_sY, 200, m_pClientList[i]->m_sType);
SendThunder(i, m_pClientList[i]->m_sX+5-iDice(1,9), m_pClientList[i]->m_sY+7-iDice(1,4), 161, m_pClientList[i]->m_sType);
break;
}
if (m_pClientList[i]->m_iAdminUserLevel > 0) continue;
iResult = iDice(1,20) + 100;
if ( (m_pClientList[i]->m_cMagicEffectStatus[DEF_MAGICTYPE_PROTECT] == 2)
|| (m_pClientList[i]->m_cMagicEffectStatus[DEF_MAGICTYPE_PROTECT] == 5))
{ iResult /= 2;
}
// Not for v3.51: SendNotifyMsg(NULL, i, DEF_NOTIFY_0BE5, NULL, NULL, NULL, NULL);
m_pClientList[i]->m_iHP -= iResult;
if (m_pClientList[i]->m_iHP <= 0)
{ ClientKilledHandler(i, NULL, NULL, iResult);
}else if (iResult > 0)
{ m_pClientList[i]->m_dwLastDamageTime = dwTime;
SendNotifyMsg(NULL, i, DEF_NOTIFY_HP, NULL, NULL, NULL, NULL);
SendEventToNearClient_TypeA(i, DEF_OWNERTYPE_PLAYER, MSGID_EVENT_MOTION, DEF_OBJECTDAMAGE, iResult, NULL, NULL);
if (m_pClientList[i]->m_bSkillUsingStatus[19] != TRUE)
{ m_pMapList[m_pClientList[i]->m_cMapIndex]->ClearOwner(0, i, DEF_OWNERTYPE_PLAYER, m_pClientList[i]->m_sX, m_pClientList[i]->m_sY);
m_pMapList[m_pClientList[i]->m_cMapIndex]->SetOwner(i, DEF_OWNERTYPE_PLAYER, m_pClientList[i]->m_sX, m_pClientList[i]->m_sY);
}
if (m_pClientList[i]->m_cMagicEffectStatus[DEF_MAGICTYPE_HOLDOBJECT] != 0)
{ SendNotifyMsg(NULL, i, DEF_NOTIFY_MAGICEFFECTOFF, DEF_MAGICTYPE_HOLDOBJECT, 2, NULL, NULL);
bRemoveFromDelayEventList(i, DEF_OWNERTYPE_PLAYER, DEF_MAGICTYPE_HOLDOBJECT);
m_pClientList[i]->m_cMagicEffectStatus[ DEF_MAGICTYPE_HOLDOBJECT ] = NULL;
} } } } }
}
fora.pl
- załóż własne forum dyskusyjne za darmo
Powered by
phpBB
© 2001, 2002 phpBB Group
Regulamin