Removed SpeedServer
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
|
|
||||||
@@ -2568,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_MALL_EXPBONUS)/100);
|
||||||
iExp += (iExp * to->GetPoint(POINT_EXP)/100);
|
iExp += (iExp * to->GetPoint(POINT_EXP)/100);
|
||||||
|
|
||||||
/* if (speed_server)
|
|
||||||
{
|
|
||||||
iExp += iExp * CSpeedServerManager::ExpBonus();
|
|
||||||
|
|
||||||
}
|
|
||||||
*/
|
|
||||||
if (test_server)
|
if (test_server)
|
||||||
{
|
{
|
||||||
sys_log(0, "Bonus Exp : Ramadan Candy: %d MallExp: %d PointExp: %d",
|
sys_log(0, "Bonus Exp : Ramadan Candy: %d MallExp: %d PointExp: %d",
|
||||||
|
|||||||
@@ -55,7 +55,6 @@
|
|||||||
#include "threeway_war.h"
|
#include "threeway_war.h"
|
||||||
#include "DragonLair.h"
|
#include "DragonLair.h"
|
||||||
#include "skill_power.h"
|
#include "skill_power.h"
|
||||||
#include "SpeedServer.h"
|
|
||||||
#include "DragonSoul.h"
|
#include "DragonSoul.h"
|
||||||
|
|
||||||
// #ifndef OS_WINDOWS
|
// #ifndef OS_WINDOWS
|
||||||
@@ -373,8 +372,6 @@ int main(int argc, char **argv)
|
|||||||
SpamManager spam_mgr;
|
SpamManager spam_mgr;
|
||||||
CThreeWayWar threeway_war;
|
CThreeWayWar threeway_war;
|
||||||
CDragonLairManager dl_manager;
|
CDragonLairManager dl_manager;
|
||||||
|
|
||||||
CSpeedServerManager SSManager;
|
|
||||||
DSManager dsManager;
|
DSManager dsManager;
|
||||||
|
|
||||||
if (!start(argc, argv)) {
|
if (!start(argc, argv)) {
|
||||||
|
|||||||
@@ -486,7 +486,6 @@ namespace quest
|
|||||||
RegisterBattleArenaFunctionTable();
|
RegisterBattleArenaFunctionTable();
|
||||||
RegisterDanceEventFunctionTable();
|
RegisterDanceEventFunctionTable();
|
||||||
RegisterDragonLairFunctionTable();
|
RegisterDragonLairFunctionTable();
|
||||||
RegisterSpeedServerFunctionTable();
|
|
||||||
RegisterDragonSoulFunctionTable();
|
RegisterDragonSoulFunctionTable();
|
||||||
|
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -31,7 +31,6 @@ namespace quest
|
|||||||
extern void RegisterBattleArenaFunctionTable();
|
extern void RegisterBattleArenaFunctionTable();
|
||||||
extern void RegisterDanceEventFunctionTable();
|
extern void RegisterDanceEventFunctionTable();
|
||||||
extern void RegisterDragonLairFunctionTable();
|
extern void RegisterDragonLairFunctionTable();
|
||||||
extern void RegisterSpeedServerFunctionTable();
|
|
||||||
extern void RegisterDragonSoulFunctionTable();
|
extern void RegisterDragonSoulFunctionTable();
|
||||||
|
|
||||||
extern void combine_lua_string(lua_State* L, std::ostringstream &s);
|
extern void combine_lua_string(lua_State* L, std::ostringstream &s);
|
||||||
|
|||||||
@@ -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