ADMİN
Game Master Booster
Admin
KB Moderator
KB Server Sahibi
KB Reklam Editörü
KB Grafiker
KB Kral Üye
KB Kıdemli Üye
KB Acemi Üye
- Katılım
- 22 Temmuz 2023
- Mesajlar
- 1,026
- Tepkime puanı
- 2,003
- Aktiflik Süresi
- 19s 32dk
- Puanları
- 1,112
- Konum
- İzmir
- Web sitesi
- www.kobulten.com

//source Kısmına eklenmesi gerekenler ;
User.h-> Uygun bir alana.
Kod:
User.h-> Uygun bir alana.
Kod:
COMMAND_HANDLER(HandleClanWarStartCommand); COMMAND_HANDLER(HandleClanWarCloseCommand); ChatHandler.cpp->InıtChatCommand fonksiyonu içerisine |
Kod:
{ "startclanwar", &CUser::HandleClanWarStartCommand, "Start Clan War (+startclanwar Clan1 Clan2" }, { "closeclanwar", &CUser::HandleClanWarCloseCommand, ChatHandler.cpp-> En Alt kısma |
Kod:
COMMAND_HANDLER(CUser::HandleClanWarStartCommand) { if (!isGM()) return false; if (vargs.size() < 2) return false; std::string ClanName1 = vargs.front(); vargs.pop_front(); std::string ClanName2 = vargs.front(); vargs.pop_front(); g_pMain->ClanWarStarted(ClanName1, ClanName2); return true; } COMMAND_HANDLER(CUser::HandleClanWarCloseCommand) { if (!isGM()) return false; g_pMain->ClanWarFinished(); return true; } GameServerDlg.h-> içerisinde uygun bir alana. |
Kod:
uint16 ClanWarDeathCountClan1;
uint16 ClanWarDeathCountClan2;
uint16 ClanID1, ClanID2;
uint8 ClanWarRemaingTime;
bool isClanWarStart;
void ClanWarFinished();
void ClanWarStarted(std::string ClanName1,std::string ClanName2);
void SendTerminator(uint16 ClanWarRemainingTime,uint8 ZoneID);
bool isClanWarAttackActive;
std::string ClanWarName1, ClanWarName2;
GameServerDlg.cpp-> En alt Kısmına.
Kod:
void CGameServerDlg::ClanWarStarted(string ClanName1,string ClanName2) { foreach_stlmap(itr, g_pMain->m_KnightsArray) { if (itr->second->GetName() == ClanName1.c_str()) { g_pMain->ClanID1 = itr->second->GetID(); g_pMain->ClanWarName1 = itr->second->GetName(); } if (itr->second->GetName() == ClanName2.c_str()) { g_pMain->ClanID2 = itr->second->GetID(); g_pMain->ClanWarName2 = itr->second->GetName(); } } _START_POSITION * pStartPosition = g_pMain->GetStartPosition(ZONE_ARDREAM_CLAN_WAR); SessionMap sessMap = g_pMain->m_socketMgr.GetActiveSessionMap(); foreach(itr, sessMap) { if ((TO_USER(itr->second)->isInGame() && TO_USER(itr->second)->GetClanID() == ClanID1) || (TO_USER(itr->second)->isInGame() && TO_USER(itr->second)->GetClanID() == ClanID2)) { TO_USER(itr->second)->ZoneChange(ZONE_ARDREAM_CLAN_WAR, (float)(TO_USER(itr->second)->GetNation() == KARUS ? pStartPosition->sKarusX : pStartPosition->sElmoradX + myrand(0, pStartPosition->bRangeX)), (float)(TO_USER(itr->second)->GetNation() == KARUS ? pStartPosition->sKarusZ : pStartPosition->sElmoradZ + myrand(0, pStartPosition->bRangeZ)), 0); } } printf("Clan War Event Started !\n"); g_pMain->isClanWarStart = true; g_pMain->isClanWarAttackActive = false; } void CGameServerDlg::ClanWarFinished() { std::string WinMessage; g_pMain->isClanWarAttackActive = false; g_pMain->isClanWarStart = false; if (g_pMain->ClanWarDeathCountClan1 > g_pMain->ClanWarDeathCountClan2) WinMessage = ("Winner Clan : %s Congratulations !", g_pMain->ClanWarName2.c_str()); else if (g_pMain->ClanWarDeathCountClan2 > g_pMain->ClanWarDeathCountClan1) WinMessage = ("Winner Clan : %s Congratulations ", g_pMain->ClanWarName1.c_str()); else WinMessage = ("Clan War Drawn OUT !"); SendAnnouncement(WinMessage.c_str()); SendNotice(WinMessage.c_str()); KickOutZoneUsers(ZONE_ARDREAM_CLAN_WAR, ZONE_MORADON); g_pMain->ClanWarDeathCountClan1 = 0; g_pMain->ClanWarDeathCountClan2 = 0; g_pMain->ClanWarRemaingTime = 35; printf("Clan War Event Finished !\n"); } void CGameServerDlg::SendTerminator(uint16 remainingTime,uint8 ZoneID) { Packet Inventory(WIZ_EVENT); Inventory << uint8(1); Packet aresult(WIZ_SELECT_MSG); aresult << uint16(0) << uint8(7) << uint32(0) << uint32(0) << uint8(8) << uint16(0) << uint8(0) << uint8(0x07) << remainingTime << uint16(0); Packet bresult(WIZ_BIFROST); bresult << uint8(0x05) << remainingTime; Packet cresult(WIZ_EVENT); cresult << uint8(0x03) << uint32(0) << uint32(0) << uint32(0x05008504) << uint8(0); SessionMap sessMap = g_pMain->m_socketMgr.GetActiveSessionMap(); foreach(itr, sessMap) { if ((TO_USER(itr->second)->isInGame() && TO_USER(itr->second)->GetZoneID() == ZoneID)) { cresult << (TO_USER(itr->second)->GetName()) << uint32(0); TO_USER(itr->second)->Send(&Inventory); TO_USER(itr->second)->Send(&aresult); TO_USER(itr->second)->Send(&bresult); TO_USER(itr->second)->SendToRegion(&cresult, nullptr, TO_USER(itr->second)->GetEventRoom()); } } } GameServerDlg.cpp-> Timer_CheckGameEvent Fonksiyonundaki while bloğu içerisine. Hidden Block (5 post(s) are required, you have 66): |
Code:
if (g_pMain->isClanWarStart == true && g_pMain->ClanWarRemaingTime == 0) g_pMain->ClanWarFinished(); GameServerDlg.cpp-> UpdateGameTime Fonksiyonu içerindeki if (m_sMin != now.GetMinute()) koşulunun içerisine. Hidden Block (5 post(s) are required, you have 66): |
Code:
if (g_pMain->isClanWarStart == true) { if (g_pMain->ClanWarRemaingTime == 30) { SendNotice("Clan War Event Started !"); g_pMain->isClanWarAttackActive = true; g_pMain->SendTerminator((g_pMain->ClanWarRemaingTime * 58), ZONE_ARDREAM_CLAN_WAR); } g_pMain->ClanWarRemaingTime--; } GameServerDlg.cpp -> constructor içerisine. Hidden Block (5 post(s) are required, you have 66): |
Code:
ClanWarDeathCountClan1 = 0; ClanWarDeathCountClan2 = 0; isClanWarStart = false; ClanWarRemaingTime = 35 ; isClanWarAttackActive = false; Ek Olarak Zonede Skor saklamamız için ölenlerin sayısını tutmamız gerek bunun için user.cpp->OnDeath->if (pKiller->isNPC()) bloğunun else bölümüne |
Code:
else if (GetZoneID() == ZONE_ARDREAM_CLAN_WAR) { if (GetNation() == 1 && g_pMain->isClanWarAttackActive == true) g_pMain->ClanWarDeathCountClan1++; if (GetNation() == 2 && g_pMain->isClanWarAttackActive == true) g_pMain->ClanWarDeathCountClan2++; } MagicInstance.cpp-> Run fonksiyonun içerisine. |
Kod:
if (pSkillCaster->GetZoneID() == ZONE_ARDREAM_CLAN_WAR && g_pMain->isClanWarAttackActive == false) { SendSkillFailed(); return; } Buraya kadar yaptıklarımızın kısa bir özeti. Gm kod ile +startclanwar ClanName1 ClanName2 Yazdığımızda bu iki clanı otomatik olarak clan war zonesine alır ve 5 dakikalık bir hazırlık süresi tanır. Bu süre tamamlandığında iki clan birbirine atak yapabilir hale gelir ve savaş başlamış olur. 30 Dakika sonra savaş otomatik olarak kapanır. Eğer manuel olarak kapatmak istenirse +closeclanwar yazması yeterlidir. SQL Kısmına Gelirsek ; ZONE_INFO |
Kod:
1 77 dragon_a.smd 13900 13900 0 0 0 Ardream Clan War START_POSITION |
Kod:
77 770 489 222 252 816 524 189 574 5 5 Eklenmesi gereken kontroller ; |
Kod:
Zone içerisinde gelen giden np ayarları Zone içerisinde ırkların birbirine attack yapabilmesi. Bunlar için unit.cpp'yi düzenlemeniz gerekli. Diğer zonelerden örnek alarak yapabilirsiniz |
Son düzenleme: