[Savaş, Guard Summon]

xERMANx

New member
Guard Summon Sahibine Attack Yapması Engellendi.
Savaş Zamanları İle İlgili Problem Giderildi.
Eksik Lua Komutlari Eklendi.
Lua Üzerinde Düzenlemeler Yapildi.
AiServer Patlama Sorunu Düzeltildi.

Kod:
local Ret = 0;
local NPC = 10305;

if EVENT == 165 then
Nation = CheckNation(UID)
if Nation == 2 then
SelectMsg(UID, 2, -1, 4632, NPC, 10, 168);
else
Capture = CheckMiddleStatueCapture(UID)
if Capture == 1 then
SelectMsg(UID, 2, -1, 4634, NPC, 4226, 169, 4227, 168);
else
SelectMsg(UID, 2, -1, 4633, NPC, 10, 168);
end
end
end

if EVENT == 168 then
Ret = 1;
end

if EVENT == 169 then
MoveMiddleStatue(UID)
end
AIServer/Npc.cpp Kısmından...

void CNpc::TracingAttack Bu Bölümü...

Kod:
void CNpc::TracingAttack()
if (pUser == nullptr
|| pUser->isDead()
|| pUser->m_bInvisibilityType
|| pUser->isGM()
|| !GetMap()->canAttackOtherNation()
|| pUser->m_oSocketID == m_oSocketID)
return;
Bununla Değiştiriyoruz...

GameServer/Define.h icine Girip Şu Satırları Ekliyoruz..

Kod:
// Where to respawn after dying in the Moradon arenas
#define MINI_ARENA_RESPAWN_X 734
#define MINI_ARENA_RESPAWN_Z 427
#define MINI_ARENA_RESPAWN_RADIUS 5

// Where to Warp dodo or laon camp in the enemy nation zone
#define DODO_CAMP_WARP_X 1059
#define DODO_CAMP_WARP_Z 1143
#define LAON_CAMP_WARP_X 1016
#define LAON_CAMP_WARP_Z 918
#define DODO_LAON_WARP_RADIUS 5
GameServer/GameServerDlg.cpp Aşagıdakiler'le Değiştiriyoruz..

Kod:
uint32 CGameServerDlg::Timer_UpdateGameTime(void * lpParam)
{
while (g_bRunning)
{
g_pMain->UpdateGameTime();

if (++g_pMain->m_sErrorSocketCount > 3)
g_pMain->AIServerConnect();

sleep(1 * SECOND);
}
return 0;
}
Kod:
void CGameServerDlg::BattleZoneOpenTimer()
{
int nWeekDay = g_localTime.tm_wday;
int nHour = g_localTime.tm_hour;

if (m_byBattleOpen == NO_BATTLE)
{
std::list<std::string> vargs = StrSplit(m_nBattleZoneOpenDays, ",");
uint8 nDaySize = vargs.size();
if (nDaySize > 0)
{
uint8 nDay = 0;
for (int i = 0; i < nDaySize; i++)
{
nDay = atoi(vargs.front().c_str());
if (nDay == nWeekDay)
for (int x = 0; x < WAR_TIME_COUNT; x++)
if (m_nBattleZoneOpenHourStart[x] == nHour)
BattleZoneOpen(BATTLEZONE_OPEN, m_nBattlezoneOpenWarZone[x]);
vargs.pop_front();
}
}
}
else if (m_byBattleOpen == NATION_BATTLE)
{
BattleZoneCurrentUsers();

int32 WarElapsedTime = int32(UNIXTIME) - m_byBattleOpenedTime;
m_byBattleRemainingTime = m_byBattleTime - WarElapsedTime;
uint8 nBattleZone = g_pMain->m_byBattleZone + ZONE_BATTLE_BASE;

if (m_bVictory == 0)
{
if (WarElapsedTime == (m_byBattleTime / 24)) // Select captain
{
m_KnightsRatingArray[KARUS_ARRAY].DeleteAllData();
m_KnightsRatingArray[ELMORAD_ARRAY].DeleteAllData();
LoadKnightsRankTable(true);
}
else if (WarElapsedTime == (m_byBattleTime / 8)) // War half time + 15 minutes for Nereid's Island.
{
if (nBattleZone == ZONE_BATTLE4) // Nereid's Island
{
if (m_sKarusMonuments >= 7 && m_sElmoMonuments == 0)
BattleZoneResult(KARUS);
else if (m_sKarusMonuments == 0 && m_sElmoMonuments >= 7)
BattleZoneResult(ELMORAD);
}
}
else if (WarElapsedTime == (m_byBattleTime / 2)) // War half time.
{
if (nBattleZone == ZONE_BATTLE
|| nBattleZone == ZONE_BATTLE2
||nBattleZone == ZONE_BATTLE3)
BattleWinnerResult(BATTLE_WINNER_NPC);
else if (nBattleZone == ZONE_BATTLE4) // Nereid's Island
BattleWinnerResult(BATTLE_WINNER_MONUMENT);
else if (nBattleZone == ZONE_BATTLE6) // Oreads
BattleWinnerResult(BATTLE_WINNER_KILL);
}

m_sBattleTimeDelay++;

if (m_sBattleTimeDelay >= (nBattleZone == ZONE_BATTLE4 ? (m_byBattleTime / 48) : (m_byBattleTime / 24)))
{
m_sBattleTimeDelay = 0;
Announcement(DECLARE_BATTLE_ZONE_STATUS);
}
}
else
{
if (WarElapsedTime < m_byBattleTime) // Won the war.
{
m_sBattleTimeDelay++;

if (m_sBattleTimeDelay >= (m_byBattleTime / 24))
{
m_sBattleTimeDelay = 0;
Announcement(UNDER_ATTACK_NOTIFY);
}

CheckNationMonumentRewards();
}
}

if (WarElapsedTime >= m_byBattleTime) // War is over.
BattleZoneClose();
}

if (m_byBanishFlag)
{
m_sBanishDelay++;

if (m_sBanishDelay == (m_byBattleTime / 360))
Announcement(DECLARE_BAN);
else if (m_sBanishDelay == (m_byBattleTime / 120)) {
m_byBanishFlag = false;
m_sBanishDelay = 0;
BanishLosers();
}
}
}
GameServer/GameServerDlg.h Aşagıdakiler'le Değiştiriyoruz..

Kod:
uint8 m_byBattleOpen, m_byOldBattleOpen; // 0:전쟁중이 아님, 1:전쟁중(국가간전쟁), 2:눈싸움전쟁
uint8 m_byBattleZone,m_byBattleZoneType,m_bVictory, m_byOldVictory, m_bKarusFl*** m_bElmoradFl*** m_bMiddleStatueNation;
int32 m_byBattleOpenedTime;
int32 m_byBattleTime;
int32 m_byBattleRemainingTime;
int32 m_sBattleTimeDelay;
uint8 m_sKilledKarusNpc, m_sKilledElmoNpc;
uint8 m_sKarusMonuments, m_sElmoMonuments;
uint16 m_sKarusMonumentPoint, m_sElmoMonumentPoint;
bool m_byKarusOpenFl*** m_byElmoradOpenFl*** m_byBanishFl*** m_byBattleSave;
GameServer/LuaEngine.cpp Kısmına Şu Satırlari Ekliyoruz..

Kod:
MAKE_LUA_FUNCTION(CheckWarVictory)
MAKE_LUA_FUNCTION(CheckMiddleStatueCapture)
MAKE_LUA_FUNCTION(MoveMiddleStatue)
GameServer/Npc.cpp void CNpc::OnRespawn Bu Kısımı Aşağidakiyle Değiştiriyoruz.

Kod:
void CNpc::OnRespawn()
{
if (g_pMain->m_byBattleOpen == NATION_BATTLE
&& (m_sSid == ELMORAD_MONUMENT_SID
|| m_sSid == ASGA_VILLAGE_MONUMENT_SID
|| m_sSid == RAIBA_VILLAGE_MONUMENT_SID
|| m_sSid == DODO_CAMP_MONUMENT_SID
|| m_sSid == LUFERSON_MONUMENT_SID
|| m_sSid == LINATE_MONUMENT_SID
|| m_sSid == BELLUA_MONUMENT_SID
|| m_sSid == LAON_CAMP_MONUMENT_SID))
{
_MONUMENT_INFORMATION * pData = new _MONUMENT_INFORMATION();
pData->sSid = m_sSid;
pData->sNid = m_sNid;
pData->RepawnedTime = int32(UNIXTIME);

if (m_sSid == DODO_CAMP_MONUMENT_SID || LAON_CAMP_MONUMENT_SID)
g_pMain->m_bMiddleStatueNation = m_bNation;

if (!g_pMain->m_NationMonumentInformationArray.PutData(pData->sSid, pData))
delete pData;
}
}
GameServer/QuestHandler.cpp En Alt Kısıma Şu Satırlari Ekliyoruz..

Kod:
uint8 CUser::GetBeefRoastVictory() { return g_pMain->m_BifrostVictory; }

uint8 CUser::GetWarVictory() { return g_pMain->m_bVictory; }

uint8 CUser::CheckMiddleStatueCapture() { return g_pMain->m_bMiddleStatueNation; }

void CUser::MoveMiddleStatue() { Warp((GetNation() == KARUS ? DODO_CAMP_WARP_X : LAON_CAMP_WARP_X) + myrand(0, DODO_LAON_WARP_RADIUS) * 10,(GetNation() == KARUS ? DODO_CAMP_WARP_Z : LAON_CAMP_WARP_Z) + myrand(0, DODO_LAON_WARP_RADIUS) * 10); }
GameServer/Unit.h İcerisine Girip Şu Satırlari siliyoruz.
Kod:
// Guard Summmon
uint16 m_sGuardSummonNid;
GameServer/User.cpp İcerisine Girip Şununla Değiştiriyoruz.

Kod:
void CUser::SendLoyaltyChange(int32 nChangeAmount /*= 0*/, bool bIsKillReward /*
{
if (nChangeAmountLoyaltyMonthly > 40)
nChangeAmountLoyaltyMonthly += 20;
else if (nChangeAmountLoyaltyMonthly >= 20 && nChangeAmountLoyaltyMonthly < 40)
nChangeAmountLoyaltyMonthly += 10;

if (amt > m_iLoyaltyMonthly)
Kod:
void CUser::SendLoyaltyChange(int32 nChangeAmount /*= 0*/, bool bIsKillReward /*
{
if (nChangeAmountLoyaltyMonthly > 40)
nChangeAmountLoyaltyMonthly -= 20;
else if (nChangeAmountLoyaltyMonthly >= 20 && nChangeAmountLoyaltyMonthly < 40)
nChangeAmountLoyaltyMonthly -= 10;

if (m_iLoyaltyMonthly + nChangeAmountLoyaltyMonthly > LOYALTY_MAX)
GameServer/User.h icerisine girip Şu Satırlari Ekliyoruz.
Kod:
INLINE uint16 GetActiveQuestID() { return m_sEventDataIndex; }
uint8 GetClanGrade();
uint8 GetClanRank();
uint32 GetClanPoint();
void SendClanPointChange(int32 nChangeAmount = 0);
uint8 GetBeefRoastVictory();
uint8 GetRankReward(bool isMonthly);
uint8 GetWarVictory();
uint8 CheckMiddleStatueCapture();
void MoveMiddleStatue();
Kod:
DECLARE_LUA_FUNCTION(CheckMiddleStatueCapture) {
LUA_RETURN(LUA_GET_INSTANCE()->CheckMiddleStatueCapture());
}

DECLARE_LUA_FUNCTION(MoveMiddleStatue) {
LUA_NO_RETURN(LUA_GET_INSTANCE()->MoveMiddleStatue());
}
GameServer/lua_bindings.cpp icerisine Şu Satırlari ekliyoruz..
Kod:
MAKE_LUA_METHOD(CheckMiddleStatueCapture)
MAKE_LUA_METHOD(MoveMiddleStatue)
Kod:
_LUA_WRAPPER_USER_FUNCTION(CheckMiddleStatueCapture, CheckMiddleStatueCapture);
_LUA_WRAPPER_USER_FUNCTION(MoveMiddleStatue, MoveMiddleStatue);
Son olarak. GameServer/lua_bindings.h icerisine Girip Şu Satırlari Ekliyoruz..
Kod:
LUA_FUNCTION(CheckMiddleStatueCapture);
LUA_FUNCTION(MoveMiddleStatue);
 

heracles

New member
hocam bendede guard summon sahibine dalıyor onu nasıl önleyebilirim ? kısaca bir kodu varmı..
bide yukarda verdigin .lua kodlarını hangi lua içerisine kayıt edicez
 

Emek Server ExeMT2

Üst