[src] Apocalypse Thunder

Codes already submitted by people of the forums.
Post Reply
snoopy81
Loyal fan
Posts: 338
Joined: Mon Jul 12, 2004 7:13 pm

Post by snoopy81 »

There was som specific msg in v 2.24b sources for that, but I wasn't able do have this work (maybe today I could but no time to investigate now), so I wrote my own system:

Code: Select all

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;
	}	}	}	}	}
}
Function called on Time (weather timer with of course an Apoc running test !

<span style='color:purple'>As always this code needs declarations and may need some little things in other parts of the source, Clip'n Paste-rs, learn C++ first !</span>
_\_ _<br> / , \__/ . \ Admin of Equilibrium Project<br> II\ \___ . O<br> III \_/ \ _ / <a href='http://www.equiprojet.com' target='_blank'>http://www.equiprojet.com</a><br> II I¯I
diuuude
Outpost bitch
Posts: 592
Joined: Wed Dec 28, 2005 11:57 pm

Post by diuuude »

It Took me like 5 mins to add your code and have it working :), but i took me like 1 hour to see it in game... I played apoc alone and it's quite boring to clear all npc on maps alone. btw it was very hard to cross over inferniaB with such a load of fire wyverns :-D.

Thanks a lot for sharing this, it's tidy code that saves us a lot of time.

<3 Snoopy :)
<a href='http://www.technohell.net' target='_blank'><b><span style='color:red'>>>> Helbreath Ressources Website Here <<<</span></b></a><br>C++ Sources, Tools, Server Files, Help on Forum, C++ Snippets, Toplist... Updated often, come visit us !
RageIlluminati
Outpost bitch
Posts: 559
Joined: Wed Mar 30, 2005 6:45 am

Post by RageIlluminati »

diuuude wrote: It Took me like 5 mins to add your code and have it working :), but i took me like 1 hour to see it in game... I played apoc alone and it's quite boring to clear all npc on maps alone. btw it was very hard to cross over inferniaB with such a load of fire wyverns :-D.

Thanks a lot for sharing this, it's tidy code that saves us a lot of time.

<3 Snoopy :)
you can modify number of mobs on maps.. with mapü config.. and there is line: max-objects or smthing.. sure you should comment spot-mobs as well...

As in my server is smthing 50-100 players.. they can't kill all mobs.. so I reduced numbers and now they can clear all apocalypse maps in 4-5hour... with original configs it would take time like hundreds of years:-P
<img src='http://helbreath.pri.ee/userbars/hbest-gamemaster2.jpg' border='0' alt='user posted image' /> <img src='http://helbreath.pri.ee/userbars/hbsoccer-owner.jpg' border='0' alt='user posted image' /> <img src='http://helbreath.pri.ee/userbars/scorpa-rider.jpg' border='0' alt='user posted image' /> <img src='http://helbreath.pri.ee/userbars/logout-master.jpg' border='0' alt='user posted image' /> <br>.<br>................................Ego sum Rage, flagellum Dei!<br><br>The problem with America is stupidity. I'm not saying there should be a capital punishment for stupidity, but why don't we just take the safety labels off of everything and let the problem solve itself? (bash.org)
diuuude
Outpost bitch
Posts: 592
Joined: Wed Dec 28, 2005 11:57 pm

Post by diuuude »

RageIlluminati wrote:
diuuude wrote: It Took me like 5 mins to add your code and have it working :), but i took me like 1 hour to see it in game... I played apoc alone and it's quite boring to clear all npc on maps alone. btw it was very hard to cross over inferniaB with such a load of fire wyverns :-D.

Thanks a lot for sharing this, it's tidy code that saves us a lot of time.

<3 Snoopy :)
you can modify number of mobs on maps.. with mapü config.. and there is line: max-objects or smthing.. sure you should comment spot-mobs as well...

As in my server is smthing 50-100 players.. they can't kill all mobs.. so I reduced numbers and now they can clear all apocalypse maps in 4-5hour... with original configs it would take time like hundreds of years:-P
it took me 1 hour to go from druncncity to abaddon... so of course i reduced the nb of mobs. I used a lot of GM-Kills too :-D
<a href='http://www.technohell.net' target='_blank'><b><span style='color:red'>>>> Helbreath Ressources Website Here <<<</span></b></a><br>C++ Sources, Tools, Server Files, Help on Forum, C++ Snippets, Toplist... Updated often, come visit us !
Post Reply