- Katılım
- Tem 11, 2024
- Mesajlar
- 260
- Tepkime puanı
- 369
- Konum
- ANKARA
- Dark Puan
- 3,203
- Discord
- farques6
- TagLise
- farques
game/cmd.cpp aratılır.
game/cmd_gm.cpp aratılır.
altına ekle.
game/sectree_manager.cpp aratılır.
altına ekle.
game/regen.cpp aratılır.
game/sectree_manager.h aratılır.
altına ekle
game/utils.h
altına ekle.
Not : Oyunculu PvpServerlerinizde
/reload regen çekmeyiniz. 3 5 Saniyelik Lag Girmesine Sebep Olur.
aratACMD(do_purge);
altına ekle.ACMD(reload_regen);
arat{ "nowar", do_nowar, 0, POS_DEAD, GM_PLAYER },
altına ekle.{ "reload_regen", reload_regen , 0, POS_DEAD, GM_GOD },
game/cmd_gm.cpp aratılır.
aratACMD(do_purge)
C++:
ACMD(reload_regen)
{
std::vector<LPEVENT> regenEvent = SECTREE_MANAGER::instance().GetRegenEvent(ch->GetMapIndex());
for (std::vector<LPEVENT>::iterator it = regenEvent.begin(); it != regenEvent.end(); ++it)
{
event_cancel(&(*it));
}
FuncPurge func(ch);
func.m_bAll = true;
LPSECTREE_MAP lm = SECTREE_MANAGER::instance().GetMap(ch->GetMapIndex());
lm->for_each(func);
char * mapIndex;
mapIndex = number_to_str(ch->GetMapIndex(), 10);
SECTREE_MANAGER::instance().BuildMap(mapIndex, LocaleService_GetMapPath().c_str());
}
game/sectree_manager.cpp aratılır.
aratint SECTREE_MANAGER::Build(const char * c_pszListFileName, const char* c_pszMapBasePath)
C++:
int SECTREE_MANAGER::BuildMap(const char * c_pszMapID, const char* c_pszMapBasePath)
{
std::string mapIndexPath = c_pszMapBasePath;
mapIndexPath += "/index";
int test;
FILE* fp = fopen(mapIndexPath.c_str(), "rb");
if (fp == NULL)
{
return 0;
}
std::string line;
char buf[256 + 1];
while (fgets(buf, 256, fp))
{
std::string tmp = buf;
if (tmp.find(c_pszMapID) != std::string::npos)
{
printf("found!!");
break;
}
}
char szFilename[256];
char szMapName[256];
int iIndex;
*strrchr(buf, '\n') = '\0';
if (!strncmp(buf, "//", 2) || *buf == '#')
return 0;
sscanf(buf, " %d %s ", &iIndex, szMapName);
snprintf(szFilename, sizeof(szFilename), "%s/%s/Setting.txt", c_pszMapBasePath, szMapName);
TMapSetting setting;
setting.iIndex = iIndex;
if (!LoadSettingFile(iIndex, szFilename, setting))
{
sys_err("can't load file %s in LoadSettingFile", szFilename);
return 0;
}
snprintf(szFilename, sizeof(szFilename), "%s/%s/Town.txt", c_pszMapBasePath, szMapName);
if (!LoadMapRegion(szFilename, setting, szMapName))
{
sys_err("can't load file %s in LoadMapRegion", szFilename);
return 0;
}
if (true == test_server)
sys_log(0, "[BUILD] Build %s %s %d ", c_pszMapBasePath, szMapName, iIndex);
// ¸ÕÀú ÀÌ ¼¹ö¿¡¼ ÀÌ ¸ÊÀÇ ¸ó½ºÅ͸¦ ½ºÆùÇØ¾ß Çϴ°¡ È®ÀÎ ÇÑ´Ù.
if (map_allow_find(iIndex))
{
LPSECTREE_MAP pkMapSectree = BuildSectreeFromSetting(setting);
m_map_pkSectree.insert(std::map<DWORD, LPSECTREE_MAP>::value_type(iIndex, pkMapSectree));
snprintf(szFilename, sizeof(szFilename), "%s/%s/server_attr", c_pszMapBasePath, szMapName);
LoadAttribute(pkMapSectree, szFilename, setting);
snprintf(szFilename, sizeof(szFilename), "%s/%s/regen.txt", c_pszMapBasePath, szMapName);
regen_load(szFilename, setting.iIndex, setting.iBaseX, setting.iBaseY);
snprintf(szFilename, sizeof(szFilename), "%s/%s/npc.txt", c_pszMapBasePath, szMapName);
regen_load(szFilename, setting.iIndex, setting.iBaseX, setting.iBaseY);
snprintf(szFilename, sizeof(szFilename), "%s/%s/boss.txt", c_pszMapBasePath, szMapName);
regen_load(szFilename, setting.iIndex, setting.iBaseX, setting.iBaseY);
snprintf(szFilename, sizeof(szFilename), "%s/%s/stone.txt", c_pszMapBasePath, szMapName);
regen_load(szFilename, setting.iIndex, setting.iBaseX, setting.iBaseY);
snprintf(szFilename, sizeof(szFilename), "%s/%s/dungeon.txt", c_pszMapBasePath, szMapName);
LoadDungeon(iIndex, szFilename);
pkMapSectree->Build();
}
return 1;
}
game/regen.cpp aratılır.
aratregen->event = event_create(regen_event, info, PASSES_PER_SEC(number(0, 16)) + PASSES_PER_SEC(regen->time));
altına ekle.SECTREE_MANAGER::instance().AddRegenEventToMap(lMapIndex, regen->event);
game/sectree_manager.h aratılır.
aratstd::map<DWORD, std::vector<npc_info> > m_mapNPCPosition;
altına eklestd::map<long, std::vector<LPEVENT>> m_mapRegen;
aratbool GetRandomLocation(long lMapIndex, PIXEL_POSITION & r_pos, DWORD dwCurrentX = 0, DWORD dwCurrentY = 0, int iMaxDistance = 0);
C++:
void AddRegenEventToMap(long lMapIndex, LPEVENT event) { m_mapRegen[lMapIndex].push_back(event); }
std::vector<LPEVENT> GetRegenEvent(long lMapIndex) { return m_mapRegen[lMapIndex]; }
game/utils.h
arat/*----atoi function-----*/
C++:
/*----itoa function-----*/
inline char* number_to_str(int val, int base)
{
static char buf[32] = { 0 };
int i = 30;
for (; val && i; --i, val /= base)
buf[i] = "0123456789abcdef"[val % base];
return &buf[i + 1];
}
/*----itoa function-----*/
Not : Oyunculu PvpServerlerinizde
/reload regen çekmeyiniz. 3 5 Saniyelik Lag Girmesine Sebep Olur.