Merge pull request #69 from MindL0ve/main
This commit is contained in:
@@ -1,404 +0,0 @@
|
||||
#include "stdafx.h"
|
||||
#include <time.h>
|
||||
#include "SpeedServer.h"
|
||||
#include "locale_service.h"
|
||||
|
||||
// 쾌도 서버 보너스 경험치 시스템
|
||||
// by rtsummit
|
||||
|
||||
CSpeedServerManager::CSpeedServerManager()
|
||||
{
|
||||
}
|
||||
|
||||
CSpeedServerManager::~CSpeedServerManager()
|
||||
{
|
||||
}
|
||||
|
||||
CSpeedServerEmpireExp::CSpeedServerEmpireExp()
|
||||
{
|
||||
}
|
||||
|
||||
CSpeedServerEmpireExp::~CSpeedServerEmpireExp()
|
||||
{
|
||||
}
|
||||
|
||||
bool CSpeedServerManager::Initialize()
|
||||
{
|
||||
for (int i = 1; i < EMPIRE_MAX_NUM; i++)
|
||||
{
|
||||
sys_log (0,"speed manager init");
|
||||
if(!Empire[i].Initialize (i))
|
||||
{
|
||||
sys_err ("EMPIRE %d Exp Bonus Manager Init fail",i);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
bool CSpeedServerEmpireExp::Initialize (BYTE e)
|
||||
{
|
||||
empire = e;
|
||||
sys_log (0, "empire exp init %d", empire);
|
||||
snprintf (file_name, sizeof(file_name), "%s/exp_bonus_table_%d.txt", LocaleService_GetBasePath().c_str(), empire);
|
||||
|
||||
for (int i = 1; i < 6; i++)
|
||||
{
|
||||
wday_exp_table[i].push_back (HME (18, 0, 50));
|
||||
wday_exp_table[i].push_back (HME (24, 0, 100));
|
||||
}
|
||||
|
||||
wday_exp_table[0].push_back (HME (18, 0, 100));
|
||||
wday_exp_table[0].push_back (HME (24, 0, 150));
|
||||
wday_exp_table[6].push_back (HME (18, 0, 100));
|
||||
wday_exp_table[6].push_back (HME (24, 0, 150));
|
||||
|
||||
LoadExpTable();
|
||||
return true;
|
||||
}
|
||||
|
||||
bool CSpeedServerEmpireExp::LoadWdayExpTable(int wday, char *str)
|
||||
{
|
||||
std::list <HME> &lst = wday_exp_table[wday];
|
||||
lst.clear();
|
||||
char *p, *n;
|
||||
const char *delim = " \t\r\n";
|
||||
char *t;
|
||||
char *h, *m, *e;
|
||||
int hour, min, exp;
|
||||
sys_log (0, "str %s", str);
|
||||
strtok (str, delim);
|
||||
p = strtok (NULL, ";");
|
||||
n = strtok (NULL, ";");
|
||||
while (p != NULL)
|
||||
{
|
||||
t = strtok (p, delim);
|
||||
e = strtok (NULL, delim);
|
||||
h = strtok (t, ":");
|
||||
m = strtok (NULL, delim);
|
||||
if (!str_to_number (hour, h) || !str_to_number (min, m) || !str_to_number (exp, e))
|
||||
{
|
||||
sys_log (0, "h m e : %s %s %s",h, m, e);
|
||||
sys_err ("Invalid argument. Please insert hh:mm exp");
|
||||
return false;
|
||||
}
|
||||
sys_log (0, "h m e : %s %s %s",h, m, e);
|
||||
|
||||
lst.push_back (HME (hour, min, exp));
|
||||
p = strtok (n, ";");
|
||||
n = strtok (NULL, ";");
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
bool CSpeedServerManager::WriteExpTableOfEmpire(BYTE empire)
|
||||
{
|
||||
return Empire[empire].WriteExpTable();
|
||||
}
|
||||
|
||||
bool CSpeedServerEmpireExp::WriteExpTable()
|
||||
{
|
||||
FILE *fp;
|
||||
|
||||
sys_log (0, "write");
|
||||
|
||||
// if (0 == file_name || 0 == file_name[0])
|
||||
if (0 == file_name[0])
|
||||
return false;
|
||||
|
||||
if ((fp = fopen(file_name, "w")) == 0)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
char wday_name[7][4] = {"SUN", "MON", "TUE", "WED", "THU", "FRI", "SAT"};
|
||||
|
||||
for (int i = 0; i < 7; i++)
|
||||
{
|
||||
fprintf (fp, "%s", wday_name[i]);
|
||||
for (std::list <HME>::iterator it = wday_exp_table[i].begin(); it != wday_exp_table[i].end(); it++)
|
||||
{
|
||||
fprintf (fp, " %d:%d %d;", it->hour, it->min, it->exp);
|
||||
}
|
||||
fprintf(fp, "\n");
|
||||
}
|
||||
|
||||
for (std::map <Date, std::list <HME> >::iterator holi_it = holiday_map.begin(); holi_it != holiday_map.end(); holi_it++)
|
||||
{
|
||||
fprintf (fp, "HOLIDAY %d.%d.%d", holi_it->first.year + 1900, holi_it->first.mon + 1, holi_it->first.day);
|
||||
for (std::list <HME>::iterator it = holi_it->second.begin(); it != holi_it->second.end(); it++)
|
||||
{
|
||||
fprintf (fp, " %d:%d %d;", it->hour, it->min, it->exp);
|
||||
}
|
||||
fprintf(fp, "\n");
|
||||
}
|
||||
fclose (fp);
|
||||
return true;
|
||||
}
|
||||
|
||||
bool CSpeedServerEmpireExp::LoadExpTable()
|
||||
{
|
||||
FILE *fp;
|
||||
char one_line[256];
|
||||
char temp[256];
|
||||
const char *delim = " \t\r\n";
|
||||
|
||||
sys_log (0, "load");
|
||||
|
||||
// if (0 == file_name || 0 == file_name[0])
|
||||
if (file_name[0] == '\0')
|
||||
return false;
|
||||
|
||||
if ((fp = fopen(file_name, "r"))==0)
|
||||
return false;
|
||||
|
||||
while (fgets(one_line, 256, fp))
|
||||
{
|
||||
if (one_line[0]=='#')
|
||||
continue;
|
||||
|
||||
strcpy(temp, one_line);
|
||||
|
||||
const char* token_string = strtok(one_line, delim);
|
||||
|
||||
if (NULL==token_string)
|
||||
continue;
|
||||
|
||||
TOKEN("SUN")
|
||||
{
|
||||
LoadWdayExpTable (0, temp);
|
||||
}
|
||||
else TOKEN("MON")
|
||||
{
|
||||
LoadWdayExpTable (1, temp);
|
||||
}
|
||||
else TOKEN("TUE")
|
||||
{
|
||||
LoadWdayExpTable (2, temp);
|
||||
}
|
||||
else TOKEN("WED")
|
||||
{
|
||||
LoadWdayExpTable (3, temp);
|
||||
}
|
||||
else TOKEN("THU")
|
||||
{
|
||||
LoadWdayExpTable (4, temp);
|
||||
}
|
||||
else TOKEN("FRI")
|
||||
{
|
||||
LoadWdayExpTable (5, temp);
|
||||
}
|
||||
else TOKEN("SAT")
|
||||
{
|
||||
LoadWdayExpTable (6, temp);
|
||||
}
|
||||
else TOKEN("HOLIDAY")
|
||||
{
|
||||
std::list <HME> lst;
|
||||
lst.clear();
|
||||
char *p, *n;
|
||||
char *t, *v;
|
||||
char *h, *m, *e;
|
||||
int hour, min, exp;
|
||||
|
||||
v = strtok (temp, delim);
|
||||
v = strtok (NULL, delim);
|
||||
sys_log (0, "holiday %s", v);
|
||||
|
||||
p = strtok (NULL, ";");
|
||||
n = strtok (NULL, ";");
|
||||
while (p != NULL)
|
||||
{
|
||||
t = strtok (p, delim);
|
||||
e = strtok (NULL, delim);
|
||||
h = strtok (t, ":");
|
||||
m = strtok (NULL, delim);
|
||||
if (!str_to_number (hour, h) || !str_to_number (min, m) || !str_to_number (exp, e))
|
||||
{
|
||||
sys_log (0, "h m e : %s %s %s",h, m, e);
|
||||
sys_err ("Invalid argument. Please insert hh:mm exp");
|
||||
return false;
|
||||
}
|
||||
sys_log (0, "h m e : %s %s %s",h, m, e);
|
||||
|
||||
lst.push_back (HME (hour, min, exp));
|
||||
p = strtok (n, ";");
|
||||
n = strtok (NULL, ";");
|
||||
}
|
||||
int year, mon, day;
|
||||
if (!str_to_number (year, strtok (v, "."))
|
||||
|| !str_to_number ( mon, strtok (NULL, "."))
|
||||
|| !str_to_number ( day, strtok (NULL, ".")))
|
||||
{
|
||||
sys_err ("Invalid Date");
|
||||
return false;
|
||||
}
|
||||
|
||||
sys_log (0, "y m d %d %d %d",year, mon, day);
|
||||
|
||||
holiday_map.insert (std::pair <Date, std::list <HME> > (Date (year - 1900, mon - 1, day), lst));
|
||||
}
|
||||
}
|
||||
|
||||
fclose(fp);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
std::list <HME>& CSpeedServerManager::GetWdayExpTableOfEmpire(BYTE empire, int wday)
|
||||
{
|
||||
return Empire[empire].GetWdayExpTable(wday);
|
||||
}
|
||||
|
||||
std::list <HME>& CSpeedServerEmpireExp::GetWdayExpTable(int wday)
|
||||
{
|
||||
return wday_exp_table[wday];
|
||||
}
|
||||
|
||||
void CSpeedServerManager::SetWdayExpTableOfEmpire (BYTE empire, int wday, HME hme)
|
||||
{
|
||||
Empire[empire].SetWdayExpTable (wday, hme);
|
||||
}
|
||||
|
||||
void CSpeedServerEmpireExp::SetWdayExpTable (int wday, HME hme)
|
||||
{
|
||||
wday_exp_table[wday].push_back (hme);
|
||||
WriteExpTable();
|
||||
}
|
||||
|
||||
void CSpeedServerManager::InitWdayExpTableOfEmpire (BYTE empire, int wday)
|
||||
{
|
||||
if (empire > EMPIRE_MAX_NUM)
|
||||
{
|
||||
sys_err ("invalid empire");
|
||||
return;
|
||||
}
|
||||
|
||||
Empire[empire].InitWdayExpTable (wday);
|
||||
}
|
||||
|
||||
void CSpeedServerEmpireExp::InitWdayExpTable(int wday)
|
||||
{
|
||||
wday_exp_table[wday].clear();
|
||||
}
|
||||
|
||||
|
||||
std::list <HME>& CSpeedServerManager::GetHolidayExpTableOfEmpire(BYTE empire, Date date, bool &is_exist)
|
||||
{
|
||||
return Empire[empire].GetHolidayExpTable(date, is_exist);
|
||||
}
|
||||
|
||||
std::list <HME>& CSpeedServerEmpireExp::GetHolidayExpTable(Date date, bool &is_exist)
|
||||
{
|
||||
std::map <Date, std::list <HME> >::iterator it = holiday_map.find(date);
|
||||
if (it != holiday_map.end())
|
||||
{
|
||||
is_exist = true;
|
||||
return it->second;
|
||||
}
|
||||
else
|
||||
{
|
||||
is_exist = false;
|
||||
sys_err ("Cannot find Holiday %d %d %d",date.year, date.mon, date.day);
|
||||
}
|
||||
return it->second;
|
||||
}
|
||||
|
||||
void CSpeedServerManager::SetHolidayExpTableOfEmpire (BYTE empire, Date date, HME hme)
|
||||
{
|
||||
Empire[empire].SetHolidayExpTable (date, hme);
|
||||
}
|
||||
|
||||
void CSpeedServerEmpireExp::SetHolidayExpTable (Date date, HME hme)
|
||||
{
|
||||
std::map <Date, std::list <HME> >::iterator it = holiday_map.find(date);
|
||||
if (it != holiday_map.end())
|
||||
{
|
||||
it->second.push_back (hme);
|
||||
}
|
||||
WriteExpTable();
|
||||
}
|
||||
|
||||
void CSpeedServerManager::InitHolidayExpTableOfEmpire (BYTE empire, Date date)
|
||||
{
|
||||
if (empire > EMPIRE_MAX_NUM)
|
||||
{
|
||||
sys_err ("invalid empire");
|
||||
return;
|
||||
}
|
||||
|
||||
Empire[empire].InitHolidayExpTable (date);
|
||||
}
|
||||
|
||||
void CSpeedServerEmpireExp::InitHolidayExpTable(Date date)
|
||||
{
|
||||
sys_log (0, "init holiday");
|
||||
std::map <Date, std::list <HME> >::iterator it = holiday_map.find(date);
|
||||
if (it == holiday_map.end())
|
||||
{
|
||||
std::list <HME> lst;
|
||||
holiday_map.insert (std::pair <Date, std::list <HME> > (date, lst));
|
||||
}
|
||||
else
|
||||
{
|
||||
it->second.clear();
|
||||
}
|
||||
}
|
||||
|
||||
HME CSpeedServerManager::GetCurrentExpPrivOfEmpire (BYTE empire, int &duration, bool &is_change)
|
||||
{
|
||||
return Empire[empire].GetCurrentExpPriv (duration, is_change);
|
||||
}
|
||||
|
||||
HME CSpeedServerEmpireExp::GetCurrentExpPriv(int &duration, bool &is_change)
|
||||
{
|
||||
struct tm* datetime;
|
||||
time_t t;
|
||||
t = time(NULL);
|
||||
datetime = localtime(&t);
|
||||
|
||||
Date date (datetime -> tm_year, datetime -> tm_mon,
|
||||
datetime -> tm_mday);
|
||||
|
||||
std::map <Date, std::list <HME> >::iterator holi_it = holiday_map.find(date);
|
||||
|
||||
int total_sec = datetime->tm_hour * 3600 + datetime->tm_min * 60 + datetime->tm_sec;
|
||||
|
||||
HME hme;
|
||||
|
||||
// 현재 날짜가 holiday이면 holiday bonus를 도입한다.
|
||||
if (holi_it != holiday_map.end())
|
||||
{
|
||||
for (std::list <HME>::iterator it = holi_it->second.begin();
|
||||
it != wday_exp_table[datetime->tm_wday].end(); it++)
|
||||
{
|
||||
// 현재 시각이 시간 구간 안에 포함되면,
|
||||
if (total_sec < (it->hour * 3600 + it->min * 60 ))
|
||||
{
|
||||
hme = *it;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
for (std::list <HME>::iterator it = wday_exp_table[datetime->tm_wday].begin();
|
||||
it != wday_exp_table[datetime->tm_wday].end(); it++)
|
||||
{
|
||||
// 현재 시각이 시간 구간 안에 포함되면,
|
||||
if (total_sec < (it->hour * 3600 + it->min * 60 ))
|
||||
{
|
||||
hme = *it;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
duration = hme.hour * 3600 + hme.min * 60 - total_sec;
|
||||
|
||||
is_change = !(hme == current_hme);
|
||||
current_hme = hme;
|
||||
|
||||
return hme;
|
||||
|
||||
}
|
||||
@@ -1,129 +0,0 @@
|
||||
#ifndef __INC_METIN_II_GAME_SPEEDSERVER_H__
|
||||
#define __INC_METIN_II_GAME_SPEEDSERVER_H__
|
||||
|
||||
#include "common/length.h"
|
||||
#include <list>
|
||||
|
||||
// castle.cpp 에 있는 것을 복붙 하였다
|
||||
#define EMPIRE_NONE 0 // 아무국가 아님
|
||||
#define EMPIRE_RED 1 // 신수
|
||||
#define EMPIRE_YELLOW 2 // 천조
|
||||
#define EMPIRE_BLUE 3 // 진노
|
||||
|
||||
class HME
|
||||
{
|
||||
public :
|
||||
int hour;
|
||||
int min;
|
||||
int exp;
|
||||
|
||||
HME (int h=0, int m=0, int e=0){
|
||||
hour = h; min = m;
|
||||
exp = e;
|
||||
}
|
||||
|
||||
HME& operator=(const HME &rhs)
|
||||
{
|
||||
hour = rhs.hour;
|
||||
min = rhs.min;
|
||||
exp = rhs.exp;
|
||||
return *this;
|
||||
}
|
||||
|
||||
bool operator==(const HME &rhs) const
|
||||
{
|
||||
return hour == rhs.hour
|
||||
&& min == rhs.min
|
||||
&& exp == rhs.exp;
|
||||
}
|
||||
|
||||
bool operator<(const HME &rhs) const
|
||||
{
|
||||
return (hour<rhs.hour)
|
||||
|| (hour==rhs.hour) && (min<rhs.min);
|
||||
}
|
||||
};
|
||||
|
||||
class Date
|
||||
{
|
||||
public :
|
||||
int year;
|
||||
int mon;
|
||||
int day;
|
||||
|
||||
Date (int y = 0, int m = 0, int d = 0)
|
||||
{
|
||||
year = y; mon = m; day = d;
|
||||
}
|
||||
|
||||
bool operator==(const Date &rhs) const
|
||||
{
|
||||
return year == rhs.year
|
||||
&& mon == rhs.mon
|
||||
&& day == rhs.day;
|
||||
}
|
||||
bool operator<(const Date &rhs) const
|
||||
{
|
||||
return (year<rhs.year)
|
||||
|| (year==rhs.year) && (mon<rhs.mon)
|
||||
|| (year==rhs.year) && (mon==rhs.mon) && (day<rhs.day);
|
||||
}
|
||||
};
|
||||
|
||||
class CSpeedServerEmpireExp
|
||||
{
|
||||
public :
|
||||
CSpeedServerEmpireExp();
|
||||
~CSpeedServerEmpireExp();
|
||||
|
||||
bool Initialize (BYTE empire);
|
||||
|
||||
std::list <HME>& GetWdayExpTable(int wday);
|
||||
void SetWdayExpTable(int wday, HME hme);
|
||||
|
||||
std::list <HME>& GetHolidayExpTable(Date date, bool &is_exist);
|
||||
void SetHolidayExpTable(Date date, HME hme);
|
||||
|
||||
void InitWdayExpTable(int wday);
|
||||
void InitHolidayExpTable(Date date);
|
||||
HME GetCurrentExpPriv (int &duration, bool &is_change);
|
||||
|
||||
bool WriteExpTable();
|
||||
|
||||
private :
|
||||
bool LoadExpTable ();
|
||||
bool LoadWdayExpTable (int wday, char *str);
|
||||
|
||||
BYTE empire;
|
||||
char file_name [256];
|
||||
HME current_hme;
|
||||
std::map <Date, std::list <HME> > holiday_map;
|
||||
std::list <HME> wday_exp_table[7];
|
||||
};
|
||||
|
||||
class CSpeedServerManager : public singleton<CSpeedServerManager>
|
||||
{
|
||||
public:
|
||||
CSpeedServerManager();
|
||||
~CSpeedServerManager();
|
||||
|
||||
bool Initialize ();
|
||||
|
||||
std::list <HME>& GetWdayExpTableOfEmpire (BYTE empire, int wday);
|
||||
void SetWdayExpTableOfEmpire (BYTE empire, int wday, HME hme);
|
||||
void InitWdayExpTableOfEmpire (BYTE empire, int wday);
|
||||
|
||||
std::list <HME>& GetHolidayExpTableOfEmpire (BYTE empire, Date date, bool &is_exist);
|
||||
void SetHolidayExpTableOfEmpire (BYTE empire, Date date, HME hme);
|
||||
void InitHolidayExpTableOfEmpire (BYTE empire, Date date);
|
||||
|
||||
bool WriteExpTableOfEmpire (BYTE empire);
|
||||
|
||||
HME GetCurrentExpPrivOfEmpire (BYTE empire, int &duration, bool &is_change);
|
||||
|
||||
private:
|
||||
CSpeedServerEmpireExp Empire[EMPIRE_MAX_NUM];
|
||||
|
||||
};
|
||||
|
||||
#endif
|
||||
@@ -6175,16 +6175,6 @@ void CHARACTER::SetGuild(CGuild* pGuild)
|
||||
}
|
||||
}
|
||||
|
||||
void CHARACTER::SendGreetMessage()
|
||||
{
|
||||
__typeof(DBManager::instance().GetGreetMessage()) v = DBManager::instance().GetGreetMessage();
|
||||
|
||||
for (itertype(v) it = v.begin(); it != v.end(); ++it)
|
||||
{
|
||||
ChatPacket(CHAT_TYPE_NOTICE, it->c_str());
|
||||
}
|
||||
}
|
||||
|
||||
void CHARACTER::BeginStateEmpty()
|
||||
{
|
||||
MonsterLog("!");
|
||||
|
||||
@@ -741,7 +741,6 @@ class CHARACTER : public CEntity, public CFSM, public CHorseRider
|
||||
void ChatPacket(BYTE type, const char *format, ...);
|
||||
void ItemGetPacket(DWORD dwItemVnum, BYTE bCount, const char* szName = NULL, bool bIsDelivery = false);
|
||||
void MonsterChat(BYTE bMonsterChatType);
|
||||
void SendGreetMessage();
|
||||
|
||||
void ResetPoint(int iLv);
|
||||
|
||||
|
||||
@@ -535,7 +535,7 @@ bool CHARACTER::IsDead() const
|
||||
return false;
|
||||
}
|
||||
|
||||
#define GetGoldMultipler() (distribution_test_server ? 3 : 1)
|
||||
#define GetGoldMultipler() (1)
|
||||
|
||||
void CHARACTER::RewardGold(LPCHARACTER pkAttacker)
|
||||
{
|
||||
@@ -2464,10 +2464,6 @@ static void GiveExp(LPCHARACTER from, LPCHARACTER to, int iExp)
|
||||
// 레벨차 경험치 가감비율
|
||||
iExp = CALCULATE_VALUE_LVDELTA(to->GetLevel(), from->GetLevel(), iExp);
|
||||
|
||||
// 외부 테스트 서버 경험치 3배 보너스
|
||||
if (distribution_test_server)
|
||||
iExp *= 3;
|
||||
|
||||
int iBaseExp = iExp;
|
||||
|
||||
// 점술, 회사 경험치 이벤트 적용
|
||||
@@ -2572,12 +2568,6 @@ static void GiveExp(LPCHARACTER from, LPCHARACTER to, int iExp)
|
||||
iExp += (iExp * to->GetPoint(POINT_MALL_EXPBONUS)/100);
|
||||
iExp += (iExp * to->GetPoint(POINT_EXP)/100);
|
||||
|
||||
/* if (speed_server)
|
||||
{
|
||||
iExp += iExp * CSpeedServerManager::ExpBonus();
|
||||
|
||||
}
|
||||
*/
|
||||
if (test_server)
|
||||
{
|
||||
sys_log(0, "Bonus Exp : Ramadan Candy: %d MallExp: %d PointExp: %d",
|
||||
|
||||
@@ -2157,13 +2157,6 @@ bool CHARACTER::UseItemEx(LPITEM item, TItemPos DestCell)
|
||||
|
||||
int iReadDelay = number(SKILLBOOK_DELAY_MIN, SKILLBOOK_DELAY_MAX);
|
||||
|
||||
if (distribution_test_server)
|
||||
iReadDelay /= 3;
|
||||
|
||||
//한국 본섭의 경우에는 시간을 24시간 고정
|
||||
if (LC_IsKorea())
|
||||
iReadDelay = 86400;
|
||||
|
||||
SetSkillNextReadTime(dwVnum, get_global_time() + iReadDelay);
|
||||
}
|
||||
}
|
||||
@@ -3082,7 +3075,6 @@ bool CHARACTER::UseItemEx(LPITEM item, TItemPos DestCell)
|
||||
ITEM_MANAGER::instance().RemoveItem(item);
|
||||
|
||||
int iReadDelay = number(SKILLBOOK_DELAY_MIN, SKILLBOOK_DELAY_MAX);
|
||||
if (distribution_test_server) iReadDelay /= 3;
|
||||
|
||||
SetSkillNextReadTime(SKILL_LEADERSHIP, get_global_time() + iReadDelay);
|
||||
}
|
||||
@@ -3124,7 +3116,6 @@ bool CHARACTER::UseItemEx(LPITEM item, TItemPos DestCell)
|
||||
ITEM_MANAGER::instance().RemoveItem(item);
|
||||
|
||||
int iReadDelay = number(SKILLBOOK_DELAY_MIN, SKILLBOOK_DELAY_MAX);
|
||||
if (distribution_test_server) iReadDelay /= 3;
|
||||
|
||||
SetSkillNextReadTime(SKILL_COMBO, get_global_time() + iReadDelay);
|
||||
}
|
||||
@@ -3153,7 +3144,6 @@ bool CHARACTER::UseItemEx(LPITEM item, TItemPos DestCell)
|
||||
ITEM_MANAGER::instance().RemoveItem(item);
|
||||
|
||||
int iReadDelay = number(SKILLBOOK_DELAY_MIN, SKILLBOOK_DELAY_MAX);
|
||||
if (distribution_test_server) iReadDelay /= 3;
|
||||
|
||||
SetSkillNextReadTime(dwSkillVnum, get_global_time() + iReadDelay);
|
||||
}
|
||||
@@ -3182,7 +3172,6 @@ bool CHARACTER::UseItemEx(LPITEM item, TItemPos DestCell)
|
||||
ITEM_MANAGER::instance().RemoveItem(item);
|
||||
|
||||
int iReadDelay = number(SKILLBOOK_DELAY_MIN, SKILLBOOK_DELAY_MAX);
|
||||
if (distribution_test_server) iReadDelay /= 3;
|
||||
|
||||
SetSkillNextReadTime(dwSkillVnum, get_global_time() + iReadDelay);
|
||||
}
|
||||
@@ -3255,7 +3244,6 @@ bool CHARACTER::UseItemEx(LPITEM item, TItemPos DestCell)
|
||||
ITEM_MANAGER::instance().RemoveItem(item);
|
||||
|
||||
int iReadDelay = number(SKILLBOOK_DELAY_MIN, SKILLBOOK_DELAY_MAX);
|
||||
if (distribution_test_server) iReadDelay /= 3;
|
||||
|
||||
SetSkillNextReadTime(dwSkillVnum, get_global_time() + iReadDelay);
|
||||
}
|
||||
@@ -3286,7 +3274,6 @@ bool CHARACTER::UseItemEx(LPITEM item, TItemPos DestCell)
|
||||
ITEM_MANAGER::instance().RemoveItem(item);
|
||||
|
||||
int iReadDelay = number(SKILLBOOK_DELAY_MIN, SKILLBOOK_DELAY_MAX);
|
||||
if (distribution_test_server) iReadDelay /= 3;
|
||||
|
||||
SetSkillNextReadTime(dwSkillVnum, get_global_time() + iReadDelay);
|
||||
|
||||
@@ -3328,7 +3315,6 @@ bool CHARACTER::UseItemEx(LPITEM item, TItemPos DestCell)
|
||||
ITEM_MANAGER::instance().RemoveItem(item);
|
||||
|
||||
int iReadDelay = number(SKILLBOOK_DELAY_MIN, SKILLBOOK_DELAY_MAX);
|
||||
if (distribution_test_server) iReadDelay /= 3;
|
||||
|
||||
SetSkillNextReadTime(dwSkillVnum, get_global_time() + iReadDelay);
|
||||
}
|
||||
@@ -3383,7 +3369,6 @@ bool CHARACTER::UseItemEx(LPITEM item, TItemPos DestCell)
|
||||
PointChange(POINT_HORSE_SKILL, 1);
|
||||
|
||||
int iReadDelay = number(SKILLBOOK_DELAY_MIN, SKILLBOOK_DELAY_MAX);
|
||||
if (distribution_test_server) iReadDelay /= 3;
|
||||
|
||||
if (!test_server)
|
||||
SetSkillNextReadTime(dwSkillVnum, get_global_time() + iReadDelay);
|
||||
|
||||
@@ -277,9 +277,9 @@ struct command_info cmd_info[] =
|
||||
|
||||
{ "mob", do_mob, 0, POS_DEAD, GM_HIGH_WIZARD },
|
||||
{ "mob_ld", do_mob_ld, 0, POS_DEAD, GM_HIGH_WIZARD }, /* 몹의 위치와 방향을 설정해 소환 /mob_ld vnum x y dir */
|
||||
{ "ma", do_mob_aggresive, 0, POS_DEAD, GM_HIGH_WIZARD },
|
||||
{ "mc", do_mob_coward, 0, POS_DEAD, GM_HIGH_WIZARD },
|
||||
{ "mm", do_mob_map, 0, POS_DEAD, GM_HIGH_WIZARD },
|
||||
{ "mob_aggresive", do_mob_aggresive, 0, POS_DEAD, GM_HIGH_WIZARD },
|
||||
{ "mon_coward", do_mob_coward, 0, POS_DEAD, GM_HIGH_WIZARD },
|
||||
{ "mob_map", do_mob_map, 0, POS_DEAD, GM_HIGH_WIZARD },
|
||||
{ "kill", do_kill, 0, POS_DEAD, GM_HIGH_WIZARD },
|
||||
{ "ipurge", do_item_purge, 0, POS_DEAD, GM_HIGH_WIZARD },
|
||||
{ "group", do_group, 0, POS_DEAD, GM_HIGH_WIZARD },
|
||||
@@ -374,8 +374,8 @@ struct command_info cmd_info[] =
|
||||
{ "delqf", do_delqf, 0, POS_DEAD, GM_LOW_WIZARD },
|
||||
{ "set_state", do_set_state, 0, POS_DEAD, GM_LOW_WIZARD },
|
||||
|
||||
{ "로그를보여줘", do_detaillog, 0, POS_DEAD, GM_LOW_WIZARD },
|
||||
{ "몬스터보여줘", do_monsterlog, 0, POS_DEAD, GM_LOW_WIZARD },
|
||||
{ "detaillog", do_detaillog, 0, POS_DEAD, GM_LOW_WIZARD },
|
||||
{ "monsterlog", do_monsterlog, 0, POS_DEAD, GM_LOW_WIZARD },
|
||||
|
||||
{ "detaillog", do_detaillog, 0, POS_DEAD, GM_LOW_WIZARD },
|
||||
{ "monsterlog", do_monsterlog, 0, POS_DEAD, GM_LOW_WIZARD },
|
||||
@@ -512,7 +512,6 @@ struct command_info cmd_info[] =
|
||||
{ "get_mob_count", do_get_mob_count, 0, POS_DEAD, GM_LOW_WIZARD },
|
||||
|
||||
{ "dice", do_dice, 0, POS_DEAD, GM_PLAYER },
|
||||
{ "주사위", do_dice, 0, POS_DEAD, GM_PLAYER },
|
||||
{ "special_item", do_special_item, 0, POS_DEAD, GM_IMPLEMENTOR },
|
||||
|
||||
{ "click_mall", do_click_mall, 0, POS_DEAD, GM_PLAYER },
|
||||
|
||||
@@ -2015,7 +2015,8 @@ ACMD(do_setskillother)
|
||||
|
||||
ACMD(do_setskill)
|
||||
{
|
||||
char arg1[256], arg2[256];
|
||||
char arg1[256];
|
||||
char arg2[256];
|
||||
two_arguments(argument, arg1, sizeof(arg1), arg2, sizeof(arg2));
|
||||
|
||||
if (!*arg1 || !*arg2 || !isdigit(*arg2))
|
||||
@@ -2094,12 +2095,7 @@ ACMD(do_reload)
|
||||
|
||||
case 'p':
|
||||
ch->ChatPacket(CHAT_TYPE_INFO, "Reloading prototype tables,");
|
||||
db_clientdesc->DBPacket(HEADER_GD_RELOAD_PROTO, 0, NULL, 0);
|
||||
break;
|
||||
|
||||
case 's':
|
||||
ch->ChatPacket(CHAT_TYPE_INFO, "Reloading notice string.");
|
||||
DBManager::instance().LoadDBString();
|
||||
db_clientdesc->DBPacket(HEADER_GD_RELOAD_PROTO, 0, nullptr, 0);
|
||||
break;
|
||||
|
||||
case 'q':
|
||||
@@ -2114,7 +2110,7 @@ ACMD(do_reload)
|
||||
//RELOAD_ADMIN
|
||||
case 'a':
|
||||
ch->ChatPacket(CHAT_TYPE_INFO, "Reloading Admin infomation.");
|
||||
db_clientdesc->DBPacket(HEADER_GD_RELOAD_ADMIN, 0, NULL, 0);
|
||||
db_clientdesc->DBPacket(HEADER_GD_RELOAD_ADMIN, 0, nullptr, 0);
|
||||
sys_log(0, "Reloading admin infomation.");
|
||||
break;
|
||||
//END_RELOAD_ADMIN
|
||||
@@ -2131,9 +2127,6 @@ ACMD(do_reload)
|
||||
|
||||
ch->ChatPacket(CHAT_TYPE_INFO, "Reloading prototype tables,");
|
||||
db_clientdesc->DBPacket(HEADER_GD_RELOAD_PROTO, 0, NULL, 0);
|
||||
|
||||
ch->ChatPacket(CHAT_TYPE_INFO, "Reloading notice string.");
|
||||
DBManager::instance().LoadDBString();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2169,13 +2162,15 @@ ACMD(do_gwlist)
|
||||
|
||||
ACMD(do_stop_guild_war)
|
||||
{
|
||||
char arg1[256], arg2[256];
|
||||
char arg1[256];
|
||||
char arg2[256];
|
||||
two_arguments(argument, arg1, sizeof(arg1), arg2, sizeof(arg2));
|
||||
|
||||
if (!*arg1 || !*arg2)
|
||||
return;
|
||||
|
||||
int id1 = 0, id2 = 0;
|
||||
int id1 = 0;
|
||||
int id2 = 0;
|
||||
|
||||
str_to_number(id1, arg1);
|
||||
str_to_number(id2, arg2);
|
||||
@@ -2609,7 +2604,8 @@ ACMD(do_observer)
|
||||
|
||||
ACMD(do_socket_item)
|
||||
{
|
||||
char arg1[256], arg2[256];
|
||||
char arg1[256];
|
||||
char arg2[256];
|
||||
two_arguments(argument, arg1, sizeof(arg1), arg2, sizeof(arg2));
|
||||
|
||||
if (*arg1)
|
||||
@@ -2683,7 +2679,7 @@ ACMD(do_block_chat_list)
|
||||
return;
|
||||
}
|
||||
|
||||
DBManager::instance().ReturnQuery(QID_BLOCK_CHAT_LIST, ch->GetPlayerID(), NULL,
|
||||
DBManager::instance().ReturnQuery(QID_BLOCK_CHAT_LIST, ch->GetPlayerID(), nullptr,
|
||||
"SELECT p.name, a.lDuration FROM affect%s as a, player%s as p WHERE a.bType = %d AND a.dwPID = p.id",
|
||||
get_table_postfix(), get_table_postfix(), AFFECT_BLOCK_CHAT);
|
||||
}
|
||||
|
||||
@@ -37,8 +37,6 @@ DWORD g_dwTrafficProfileFlushCycle = 3600;
|
||||
// END_OF_TRAFFIC_PROFILER
|
||||
|
||||
int test_server = 0;
|
||||
int speed_server = 0;
|
||||
bool distribution_test_server = false;
|
||||
bool china_event_server = false;
|
||||
bool guild_mark_server = true;
|
||||
BYTE guild_mark_min_level = 3;
|
||||
@@ -587,21 +585,6 @@ void config_init(const string& st_localeServiceName)
|
||||
continue;
|
||||
}
|
||||
|
||||
TOKEN("speed_server")
|
||||
{
|
||||
printf("-----------------------------------------------\n");
|
||||
printf("SPEED_SERVER\n");
|
||||
printf("-----------------------------------------------\n");
|
||||
str_to_number(speed_server, value_string);
|
||||
continue;
|
||||
}
|
||||
|
||||
TOKEN("distribution_test_server")
|
||||
{
|
||||
str_to_number(distribution_test_server, value_string);
|
||||
continue;
|
||||
}
|
||||
|
||||
TOKEN("china_event_server")
|
||||
{
|
||||
str_to_number(china_event_server, value_string);
|
||||
|
||||
@@ -23,7 +23,6 @@ extern int ping_event_second_cycle;
|
||||
extern int test_server;
|
||||
extern bool guild_mark_server;
|
||||
extern BYTE guild_mark_min_level;
|
||||
extern bool distribution_test_server;
|
||||
extern bool china_event_server;
|
||||
|
||||
extern bool g_bNoMoreClient;
|
||||
|
||||
@@ -58,134 +58,6 @@ TBattleTypeStat BattleTypeStats[BATTLE_TYPE_MAX_NUM] =
|
||||
|
||||
const DWORD * exp_table = NULL;
|
||||
|
||||
const DWORD exp_table_euckr[PLAYER_EXP_TABLE_MAX + 1] =
|
||||
{
|
||||
0, // 0
|
||||
|
||||
100,
|
||||
150,
|
||||
260,
|
||||
380,
|
||||
600,
|
||||
|
||||
1300,
|
||||
3300,
|
||||
5700,
|
||||
8700,
|
||||
12800, // 10
|
||||
18000,
|
||||
25000,
|
||||
36000,
|
||||
52000,
|
||||
73000,
|
||||
100000,
|
||||
125000,
|
||||
160000,
|
||||
220000,
|
||||
280000, // 20
|
||||
370000,
|
||||
540000,
|
||||
670000,
|
||||
880000,
|
||||
1000000,
|
||||
|
||||
1237000,
|
||||
1418000,
|
||||
1624000,
|
||||
1857000,
|
||||
2122000, // 30
|
||||
2421000,
|
||||
2761000,
|
||||
3145000,
|
||||
3580000,
|
||||
4073000,
|
||||
4632000,
|
||||
5194000,
|
||||
5717000,
|
||||
6264000,
|
||||
6837000, // 40
|
||||
7600000,
|
||||
8274000,
|
||||
8990000,
|
||||
9753000,
|
||||
10560000,
|
||||
11410000,
|
||||
12320000,
|
||||
13270000,
|
||||
14280000,
|
||||
15340000, // 50
|
||||
16870000,
|
||||
18960000,
|
||||
19980000,
|
||||
21420000,
|
||||
22930000,
|
||||
24530000,
|
||||
26200000,
|
||||
27960000,
|
||||
29800000,
|
||||
32780000, // 60
|
||||
36060000,
|
||||
39670000,
|
||||
43640000,
|
||||
48000000,
|
||||
52800000,
|
||||
58080000,
|
||||
63890000,
|
||||
70280000,
|
||||
77310000,
|
||||
85040000, // 70
|
||||
93540000,
|
||||
102900000,
|
||||
113200000,
|
||||
124500000,
|
||||
137000000,
|
||||
150700000,
|
||||
165700000,
|
||||
236990000,
|
||||
260650000,
|
||||
286780000, // 80
|
||||
315380000,
|
||||
346970000,
|
||||
381680000,
|
||||
419770000,
|
||||
461760000,
|
||||
508040000,
|
||||
558740000,
|
||||
614640000,
|
||||
676130000,
|
||||
743730000, // 90
|
||||
1041222000,
|
||||
1145344200,
|
||||
1259878620,
|
||||
1385866482,
|
||||
1524453130,
|
||||
1676898443,
|
||||
1844588288,
|
||||
2029047116,
|
||||
2100000000, // 99 99레벨일 때 필요경험치 (100레벨이 되기 위한)
|
||||
2100000000, // 100
|
||||
2100000000,
|
||||
2100000000,
|
||||
2100000000,
|
||||
2100000000,
|
||||
2100000000, // 105
|
||||
2100000000,
|
||||
2100000000,
|
||||
2100000000,
|
||||
2100000000,
|
||||
2100000000, // 110
|
||||
2100000000,
|
||||
2100000000,
|
||||
2100000000,
|
||||
2100000000,
|
||||
2100000000, // 115
|
||||
2100000000,
|
||||
2100000000,
|
||||
2100000000,
|
||||
2100000000,
|
||||
2100000000, // 120
|
||||
};
|
||||
|
||||
const DWORD exp_table_common[PLAYER_EXP_TABLE_MAX + 1] =
|
||||
{
|
||||
0, // 0
|
||||
|
||||
@@ -96,8 +96,6 @@ extern const TMobRankStat MobRankStats[MOB_RANK_MAX_NUM];
|
||||
extern TBattleTypeStat BattleTypeStats[BATTLE_TYPE_MAX_NUM];
|
||||
|
||||
extern const DWORD party_exp_distribute_table[PLAYER_MAX_LEVEL_CONST + 1];
|
||||
|
||||
extern const DWORD exp_table_euckr[PLAYER_EXP_TABLE_MAX + 1];
|
||||
extern const DWORD exp_table_common[PLAYER_EXP_TABLE_MAX + 1];
|
||||
extern const DWORD exp_table_newcibn[PLAYER_EXP_TABLE_MAX + 1];
|
||||
|
||||
|
||||
@@ -35,11 +35,6 @@ bool DBManager::Connect(const char * host, const int port, const char * user, co
|
||||
if (!m_sql_direct.Setup(host, user, pwd, db, g_stLocale.c_str(), true, port))
|
||||
sys_err("cannot open direct sql connection to host %s", host);
|
||||
|
||||
if (m_bIsConnect && !g_bAuthServer)
|
||||
{
|
||||
LoadDBString();
|
||||
}
|
||||
|
||||
return m_bIsConnect;
|
||||
}
|
||||
|
||||
@@ -448,34 +443,6 @@ void DBManager::AnalyzeReturnQuery(SQLMsg * pMsg)
|
||||
}
|
||||
break;
|
||||
|
||||
case QID_DB_STRING:
|
||||
{
|
||||
m_map_dbstring.clear();
|
||||
m_vec_GreetMessage.clear();
|
||||
|
||||
for (uint i = 0; i < pMsg->Get()->uiNumRows; ++i)
|
||||
{
|
||||
MYSQL_ROW row = mysql_fetch_row(pMsg->Get()->pSQLResult);
|
||||
//ch->SetSafeboxSize(SAFEBOX_PAGE_SIZE * atoi(row[0]));
|
||||
if (row[0] && row[1])
|
||||
{
|
||||
m_map_dbstring.insert(make_pair(std::string(row[0]), std::string(row[1])));
|
||||
sys_log(0, "DBSTR '%s' '%s'", row[0], row[1]);
|
||||
}
|
||||
}
|
||||
if (m_map_dbstring.find("GREET") != m_map_dbstring.end())
|
||||
{
|
||||
std::istringstream is(m_map_dbstring["GREET"]);
|
||||
while (!is.eof())
|
||||
{
|
||||
std::string str;
|
||||
getline(is, str);
|
||||
m_vec_GreetMessage.push_back(str);
|
||||
}
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
case QID_LOTTO:
|
||||
{
|
||||
LPCHARACTER ch = CHARACTER_MANAGER::instance().FindByPID(qi->dwIdent);
|
||||
@@ -572,25 +539,6 @@ void DBManager::AnalyzeReturnQuery(SQLMsg * pMsg)
|
||||
M2_DELETE(qi);
|
||||
}
|
||||
|
||||
void DBManager::LoadDBString()
|
||||
{
|
||||
ReturnQuery(QID_DB_STRING, 0, NULL, "SELECT name, text FROM string%s", get_table_postfix());
|
||||
}
|
||||
|
||||
const std::string& DBManager::GetDBString(const std::string& key)
|
||||
{
|
||||
static std::string null_str = "";
|
||||
itertype(m_map_dbstring) it = m_map_dbstring.find(key);
|
||||
if (it == m_map_dbstring.end())
|
||||
return null_str;
|
||||
return it->second;
|
||||
}
|
||||
|
||||
const std::vector<std::string>& DBManager::GetGreetMessage()
|
||||
{
|
||||
return m_vec_GreetMessage;
|
||||
}
|
||||
|
||||
void DBManager::SendMoneyLog(BYTE type, DWORD vnum, int gold)
|
||||
{
|
||||
if (!gold)
|
||||
|
||||
@@ -14,7 +14,6 @@ enum
|
||||
enum
|
||||
{
|
||||
QID_SAFEBOX_SIZE,
|
||||
QID_DB_STRING,
|
||||
QID_AUTH_LOGIN,
|
||||
QID_LOTTO,
|
||||
QID_HIGHSCORE_REGISTER,
|
||||
@@ -93,10 +92,6 @@ class DBManager : public singleton<DBManager>
|
||||
DWORD CountQueryResult() { return m_sql.CountResult(); }
|
||||
void ResetQueryResult() { m_sql.ResetQueryFinished(); }
|
||||
|
||||
void LoadDBString();
|
||||
const std::string & GetDBString(const std::string& key);
|
||||
const std::vector<std::string> & GetGreetMessage();
|
||||
|
||||
template<class Functor> void FuncQuery(Functor f, const char * c_pszFormat, ...); // 결과를 f인자로 호출함 (SQLMsg *) 알아서 해제됨
|
||||
template<class Functor> void FuncAfterQuery(Functor f, const char * c_pszFormat, ...); // 끝나고 나면 f가 호출됨 void f(void) 형태
|
||||
|
||||
@@ -109,8 +104,6 @@ class DBManager : public singleton<DBManager>
|
||||
CAsyncSQL m_sql_direct;
|
||||
bool m_bIsConnect;
|
||||
|
||||
std::map<std::string, std::string> m_map_dbstring;
|
||||
std::vector<std::string> m_vec_GreetMessage;
|
||||
std::map<DWORD, CLoginData *> m_map_pkLoginData;
|
||||
std::vector<TUseTime> m_vec_kUseTime;
|
||||
};
|
||||
|
||||
@@ -432,7 +432,6 @@ int CInputHandshake::Analyze(LPDESC d, BYTE bHeader, const char * c_pData)
|
||||
{
|
||||
LoadStateUserCount();
|
||||
db_clientdesc->DBPacket(HEADER_GD_RELOAD_PROTO, 0, NULL, 0);
|
||||
DBManager::instance().LoadDBString();
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -448,10 +447,6 @@ int CInputHandshake::Analyze(LPDESC d, BYTE bHeader, const char * c_pData)
|
||||
db_clientdesc->DBPacket(HEADER_GD_RELOAD_PROTO, 0, NULL, 0);
|
||||
break;
|
||||
|
||||
case 's':
|
||||
DBManager::instance().LoadDBString();
|
||||
break;
|
||||
|
||||
case 'q':
|
||||
quest::CQuestManager::instance().Reload();
|
||||
break;
|
||||
|
||||
@@ -631,8 +631,6 @@ void CInputLogin::Entergame(LPDESC d, const char * data)
|
||||
p2.channel = g_bChannel;
|
||||
d->Packet(&p2, sizeof(p2));
|
||||
|
||||
ch->SendGreetMessage();
|
||||
|
||||
_send_bonus_info(ch);
|
||||
|
||||
for (int i = 0; i <= PREMIUM_MAX_NUM; ++i)
|
||||
|
||||
@@ -467,7 +467,6 @@ static void __LocaleService_Init_JAPAN()
|
||||
|
||||
check_name = check_name_sjis;
|
||||
is_twobyte = is_twobyte_sjis;
|
||||
exp_table = exp_table_euckr;
|
||||
}
|
||||
|
||||
static void __LocaleService_Init_English() //Fix (Kinda)
|
||||
@@ -553,7 +552,6 @@ static void __LocaleService_Init_Korea()
|
||||
g_setQuestObjectDir.insert("locale/korea/quest/object");
|
||||
|
||||
g_iUseLocale = TRUE;
|
||||
exp_table = exp_table_euckr;
|
||||
}
|
||||
|
||||
static void __LocaleService_Init_France()
|
||||
@@ -744,8 +742,6 @@ static void __LocaleService_Init_YMIR()
|
||||
g_setQuestObjectDir.insert(g_stQuestDir + "/object");
|
||||
|
||||
PK_PROTECT_LEVEL = 30;
|
||||
|
||||
exp_table = exp_table_euckr;
|
||||
}
|
||||
|
||||
static void __LocaleService_Init_Russia()
|
||||
|
||||
@@ -55,7 +55,6 @@
|
||||
#include "threeway_war.h"
|
||||
#include "DragonLair.h"
|
||||
#include "skill_power.h"
|
||||
#include "SpeedServer.h"
|
||||
#include "DragonSoul.h"
|
||||
|
||||
// #ifndef OS_WINDOWS
|
||||
@@ -122,7 +121,6 @@ int g_shutdown_disconnect_force_pulse;
|
||||
int g_shutdown_core_pulse;
|
||||
bool g_bShutdown=false;
|
||||
|
||||
extern int speed_server;
|
||||
extern void CancelReloadSpamEvent();
|
||||
|
||||
void ContinueOnFatalError()
|
||||
@@ -374,8 +372,6 @@ int main(int argc, char **argv)
|
||||
SpamManager spam_mgr;
|
||||
CThreeWayWar threeway_war;
|
||||
CDragonLairManager dl_manager;
|
||||
|
||||
CSpeedServerManager SSManager;
|
||||
DSManager dsManager;
|
||||
|
||||
if (!start(argc, argv)) {
|
||||
@@ -394,8 +390,6 @@ int main(int argc, char **argv)
|
||||
CGuildManager::instance().Initialize();
|
||||
fishing::Initialize();
|
||||
OXEvent_manager.Initialize();
|
||||
if (speed_server)
|
||||
CSpeedServerManager::instance().Initialize();
|
||||
|
||||
Cube_init();
|
||||
Blend_Item_init();
|
||||
|
||||
@@ -486,7 +486,6 @@ namespace quest
|
||||
RegisterBattleArenaFunctionTable();
|
||||
RegisterDanceEventFunctionTable();
|
||||
RegisterDragonLairFunctionTable();
|
||||
RegisterSpeedServerFunctionTable();
|
||||
RegisterDragonSoulFunctionTable();
|
||||
|
||||
{
|
||||
|
||||
@@ -5,7 +5,6 @@
|
||||
#include "buffer_manager.h"
|
||||
|
||||
extern int test_server;
|
||||
extern int speed_server;
|
||||
|
||||
namespace quest
|
||||
{
|
||||
@@ -32,7 +31,6 @@ namespace quest
|
||||
extern void RegisterBattleArenaFunctionTable();
|
||||
extern void RegisterDanceEventFunctionTable();
|
||||
extern void RegisterDragonLairFunctionTable();
|
||||
extern void RegisterSpeedServerFunctionTable();
|
||||
extern void RegisterDragonSoulFunctionTable();
|
||||
|
||||
extern void combine_lua_string(lua_State* L, std::ostringstream &s);
|
||||
|
||||
@@ -284,12 +284,6 @@ namespace quest
|
||||
return 1;
|
||||
}
|
||||
|
||||
int _is_speed_server(lua_State * L)
|
||||
{
|
||||
lua_pushboolean(L, speed_server);
|
||||
return 1;
|
||||
}
|
||||
|
||||
int _raw_script(lua_State* L)
|
||||
{
|
||||
if ( test_server )
|
||||
@@ -1336,7 +1330,6 @@ namespace quest
|
||||
{ "cleartimer", _clear_named_timer },
|
||||
{ "getnpcid", _getnpcid },
|
||||
{ "is_test_server", _is_test_server },
|
||||
{ "is_speed_server", _is_speed_server },
|
||||
{ "raw_script", _raw_script },
|
||||
{ "number", _number },
|
||||
|
||||
|
||||
@@ -1,202 +0,0 @@
|
||||
#include "stdafx.h"
|
||||
#include "SpeedServer.h"
|
||||
#include "questlua.h"
|
||||
#include "questmanager.h"
|
||||
|
||||
namespace quest
|
||||
{
|
||||
// "sun", "mon", "tue", "wed", "thu", "fri", "sat", "week", "weekend"
|
||||
|
||||
int speedserver_get_wday (lua_State* L)
|
||||
{
|
||||
if (!lua_isnumber(L,1) || !lua_isnumber(L,2))
|
||||
{
|
||||
sys_err("wrong argument");
|
||||
}
|
||||
|
||||
BYTE empire = lua_tonumber(L,1);
|
||||
|
||||
if (empire > 3)
|
||||
{
|
||||
sys_err("invalid empire");
|
||||
return 0;
|
||||
}
|
||||
|
||||
int wday = lua_tonumber(L,2) - 1;
|
||||
|
||||
if (wday < 0 || wday > 6)
|
||||
{
|
||||
sys_err ("wrong day");
|
||||
return 0;
|
||||
}
|
||||
|
||||
sys_log (0, "empire %d wday %d",empire, wday);
|
||||
|
||||
std::list <HME> time_lst = CSpeedServerManager::instance().GetWdayExpTableOfEmpire(empire, wday);
|
||||
|
||||
int i = 0;
|
||||
for (std::list <HME>::iterator it = time_lst.begin();
|
||||
it != time_lst.end(); it++)
|
||||
{
|
||||
sys_log (0, "%d",i);
|
||||
lua_pushnumber (L, it->hour);
|
||||
lua_pushnumber (L, it->min);
|
||||
lua_pushnumber (L, it->exp);
|
||||
i++;
|
||||
}
|
||||
|
||||
return i * 3;
|
||||
}
|
||||
|
||||
int speedserver_set_wday (lua_State* L)
|
||||
{
|
||||
BYTE empire = lua_tonumber (L, 1);
|
||||
int wday = lua_tonumber (L, 2);
|
||||
BYTE end_hour = lua_tonumber(L, 3);
|
||||
BYTE end_minite = lua_tonumber(L, 4);
|
||||
int exp_percent = lua_tonumber(L, 5);
|
||||
|
||||
CSpeedServerManager::instance().SetWdayExpTableOfEmpire (empire, wday - 1, HME (end_hour, end_minite, exp_percent));
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
int speedserver_init_wday (lua_State* L)
|
||||
{
|
||||
if (!lua_isnumber (L, 1) || !lua_isnumber (L, 2))
|
||||
{
|
||||
sys_err ("invalid argument.");
|
||||
return 0;
|
||||
}
|
||||
|
||||
BYTE empire = lua_tonumber (L, 1);
|
||||
int wday = lua_tonumber (L, 2);
|
||||
|
||||
sys_log (0, "init_wday %d %d",empire, wday);
|
||||
|
||||
CSpeedServerManager::instance().InitWdayExpTableOfEmpire (empire, wday - 1);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
int speedserver_get_holiday (lua_State* L)
|
||||
{
|
||||
if (!lua_isnumber(L,1) || !lua_isnumber(L,2) || !lua_isnumber(L,3) || !lua_isnumber(L,4))
|
||||
{
|
||||
sys_err("wrong argument");
|
||||
}
|
||||
|
||||
BYTE empire = lua_tonumber(L,1);
|
||||
|
||||
if (empire > 4)
|
||||
{
|
||||
sys_err("invalid empire");
|
||||
return 0;
|
||||
}
|
||||
|
||||
Date date = Date (lua_tonumber(L,2) - 1900, lua_tonumber(L,3) - 1, lua_tonumber(L,4));
|
||||
|
||||
sys_log (0, "empire %d date %d %d %d", empire, date.year, date.mon, date.day);
|
||||
|
||||
bool is_exist;
|
||||
|
||||
std::list <HME> time_lst = CSpeedServerManager::instance().GetHolidayExpTableOfEmpire(empire, date, is_exist);
|
||||
|
||||
int i = 0;
|
||||
if (is_exist)
|
||||
{
|
||||
for (std::list <HME>::iterator it = time_lst.begin();
|
||||
it != time_lst.end(); it++)
|
||||
{
|
||||
lua_pushnumber (L, it->hour);
|
||||
lua_pushnumber (L, it->min);
|
||||
lua_pushnumber (L, it->exp);
|
||||
i++;
|
||||
}
|
||||
return i * 3;
|
||||
}
|
||||
else
|
||||
return 0;
|
||||
|
||||
}
|
||||
|
||||
int speedserver_set_holiday (lua_State* L)
|
||||
{
|
||||
if (!lua_isnumber(L,1) || !lua_isnumber(L,2) || !lua_isnumber(L,3) || !lua_isnumber(L,4)
|
||||
|| !lua_isnumber(L,5) || !lua_isnumber(L,6) || !lua_isnumber(L,7))
|
||||
{
|
||||
sys_err("wrong argument");
|
||||
}
|
||||
|
||||
BYTE empire = lua_tonumber (L, 1);
|
||||
Date date = Date (lua_tonumber(L,2) - 1900, lua_tonumber(L,3) - 1, lua_tonumber(L,4));
|
||||
BYTE end_hour = lua_tonumber(L, 5);
|
||||
BYTE end_minite = lua_tonumber(L, 6);
|
||||
int exp_percent = lua_tonumber(L, 7);
|
||||
|
||||
sys_log (0,"h %d m %d e %d", end_hour, end_minite, exp_percent);
|
||||
|
||||
CSpeedServerManager::instance().SetHolidayExpTableOfEmpire (empire, date, HME (end_hour, end_minite, exp_percent));
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
int speedserver_init_holiday (lua_State* L)
|
||||
{
|
||||
if (!lua_isnumber(L,1) || !lua_isnumber(L,2) || !lua_isnumber(L,3) || !lua_isnumber(L,4))
|
||||
{
|
||||
sys_err("wrong argument");
|
||||
}
|
||||
|
||||
BYTE empire = lua_tonumber (L, 1);
|
||||
Date date = Date (lua_tonumber(L,2) - 1900, lua_tonumber(L,3) - 1, lua_tonumber(L,4));
|
||||
|
||||
CSpeedServerManager::instance().InitHolidayExpTableOfEmpire (empire, date);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
int speedserver_get_current_exp_priv (lua_State* L)
|
||||
{
|
||||
if (!lua_isnumber (L, 1))
|
||||
{
|
||||
sys_err ("invalid empire");
|
||||
return 0;
|
||||
}
|
||||
BYTE empire = lua_tonumber(L, 1);
|
||||
|
||||
int duration;
|
||||
bool is_change;
|
||||
|
||||
HME hme = CSpeedServerManager::instance().GetCurrentExpPrivOfEmpire (empire, duration, is_change);
|
||||
|
||||
lua_pushnumber (L, hme.hour);
|
||||
lua_pushnumber (L, hme.min);
|
||||
lua_pushnumber (L, hme.exp);
|
||||
lua_pushnumber (L, duration);
|
||||
lua_pushboolean (L, is_change);
|
||||
|
||||
sys_log (0, "empire : %d is_change : %d",empire, is_change);
|
||||
|
||||
return 5;
|
||||
}
|
||||
|
||||
void RegisterSpeedServerFunctionTable()
|
||||
{
|
||||
luaL_reg speed_server_functions[] =
|
||||
{
|
||||
{ "get_holiday", speedserver_get_holiday },
|
||||
{ "set_holiday", speedserver_set_holiday },
|
||||
{ "get_wday", speedserver_get_wday },
|
||||
{ "set_wday", speedserver_set_wday },
|
||||
{ "init_holiday", speedserver_init_holiday },
|
||||
{ "init_wday", speedserver_init_wday },
|
||||
{ "get_current_exp_priv", speedserver_get_current_exp_priv },
|
||||
|
||||
{ NULL, NULL}
|
||||
};
|
||||
|
||||
CQuestManager::instance().AddLuaFunctionTable("speedserver", speed_server_functions);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user