- Mesaj
- 678
- Çözümler
- 30
- Beğeni
- 181
- Puan
- 604
- Ticaret Puanı
- 0
Lonca istatistik sistemi ekledim fakat tabloya hiçbirşey yansımıyor. Konuda sql'ler var player'a atılıcak olanlar onları attım fakat onlarada hiçbirşey düşmemiş..
Sorun bu
Sorun bu
cmd_general.cpp:
EN ALTA EKLEDE İŞİMİZ GÖRÜLSÜN :)
#ifdef ENABLE_LONCA_ISTATISTIK
ACMD(do_war_istatistik)
{
if (quest::CQuestManager::instance().GetEventFlag("lonca_istatistik_disable") == 1)
{
ch->ChatPacket(CHAT_TYPE_INFO, "Sistem suan icin devre disi!");
return;
}
char arg1[256];
one_argument(argument, arg1, sizeof(arg1));
if (!*arg1)
return;
int iPulse = thecore_pulse();
if (iPulse - ch->GetLastWarIstatistikLastTime() < passes_per_sec * 2)
{
ch->ChatPacket(CHAT_TYPE_INFO, "Biraz beklemelisin.");
return;
}
ch->SetLastWarIstatistikLastTime(iPulse);
CGuild * loncam = CGuildManager::instance().FindGuildByName(arg1);
CGuild * rakip = ch->GetGuild();
if (!loncam || !rakip || loncam->UnderAnyWar() || rakip->UnderAnyWar())
return;
DBManager::instance().DirectQuery("INSERT INTO player.lonca_savas(loncam, rakip, tarih, durum) VALUES('%s', '%s', CURDATE(), 1);", loncam->GetName(), rakip->GetName());
}
ACMD(do_lonca_savas_listesi)
{
if (quest::CQuestManager::instance().GetEventFlag("lonca_istatistik_disable") == 1)
{
ch->ChatPacket(CHAT_TYPE_INFO, "Sistem suan icin devre disi!");
return;
}
int iPulse = thecore_pulse();
if (iPulse - ch->GetLastSavasListesiLastTime() < passes_per_sec * 2)
{
ch->ChatPacket(CHAT_TYPE_INFO, "Biraz beklemelisin.");
return;
}
ch->SetLastSavasListesiLastTime(iPulse);
if (!ch->GetGuild())
{
ch->ChatPacket(CHAT_TYPE_INFO, "Bir lonca uyesi degilsin!");
return;
}
CGuild* g = ch->GetGuild();
if (!g)
{
ch->ChatPacket(CHAT_TYPE_INFO, "Bir lonca uyesi degilsin!");
return;
}
ch->ChatPacket(CHAT_TYPE_COMMAND, "lonca_savas_listesi_yenile");
std::unique_ptr<SQLMsg> pMsg(DBManager::instance().DirectQuery("SELECT id, loncam, rakip, tarih FROM player.lonca_savas WHERE loncam = '%s' or rakip = '%s' and durum = 0 ORDER BY tarih DESC", g->GetName(), g->GetName()));
if (pMsg->Get()->uiNumRows != 0)
{
MYSQL_ROW row;
while (NULL != (row = mysql_fetch_row(pMsg->Get()->pSQLResult)))
{
DWORD Id = 0;
str_to_number(Id, row[0]);
ch->ChatPacket(CHAT_TYPE_COMMAND, "lonca_savas_listesi %s %s %s %u", row[1], row[2], row[3], Id);
}
}
}
ACMD(do_lonca_savas_istatistik)
{
if (quest::CQuestManager::instance().GetEventFlag("lonca_istatistik_disable") == 1)
{
ch->ChatPacket(CHAT_TYPE_INFO, "Sistem suan icin devre disi!");
return;
}
int iPulse = thecore_pulse();
if (iPulse - ch->GetLastSavasIstatistikLastTime() < passes_per_sec * 2)
{
ch->ChatPacket(CHAT_TYPE_INFO, "Biraz beklemelisin.");
return;
}
ch->SetLastSavasIstatistikLastTime(iPulse);
char arg1[256];
char arg2[256];
two_arguments(argument, arg1, sizeof(arg1), arg2, sizeof(arg2));
if (!*arg1 || 0 == arg1[0])
{
ch->ChatPacket(CHAT_TYPE_INFO, "Islem Secin!");
return;
}
const std::string& IslemSec = std::string(arg1);
if (IslemSec == "Ac")
{
if (!*arg2)
return;
if (!ch->GetGuild())
return;
CGuild* g = ch->GetGuild();
if (!g)
return;
if (g->UnderAnyWar())
{
ch->ChatPacket(CHAT_TYPE_INFO, "Savas esnasinda savas gecmisine bakamazsin!");
return;
}
DWORD savas_id = 0;
str_to_number(savas_id, arg2);
std::unique_ptr<SQLMsg> pMsg(DBManager::instance().DirectQuery("SELECT isim, olum, oldurme FROM player.lonca_istatistik WHERE savas_id = '%u' and loncam = '%s'", savas_id, g->GetName()));
if (pMsg->Get()->uiNumRows != 0)
{
MYSQL_ROW row;
while (NULL != (row = mysql_fetch_row(pMsg->Get()->pSQLResult)))
{
DWORD olum = 0, oldurme = 0;
str_to_number(olum, row[1]);
str_to_number(oldurme, row[2]);
char ben[128];
snprintf(ben, sizeof(ben), "Append|%s|%u|%u|1", row[0], olum, oldurme);
ch->ChatPacket(CHAT_TYPE_COMMAND, "lonca_istatistik %s", ben);
}
}
ch->ChatPacket(CHAT_TYPE_COMMAND, "lonca_istatistik Open");
}
else if (IslemSec == "Kapat")
{
ch->ChatPacket(CHAT_TYPE_COMMAND, "lonca_istatistik Close");
}
}
//--TAB_TUSU--//
ACMD(do_lonca_istatistik)
{
if (quest::CQuestManager::instance().GetEventFlag("lonca_istatistik_disable") == 1)
{
ch->ChatPacket(CHAT_TYPE_INFO, "Sistem suan icin devre disi!");
return;
}
int iPulse = thecore_pulse();
if (iPulse - ch->GetLastLoncaIstatistikLastTime() < passes_per_sec * 2)
{
ch->ChatPacket(CHAT_TYPE_INFO, "Biraz beklemelisin.");
return;
}
ch->SetLastLoncaIstatistikLastTime(iPulse);
if (!ch->GetGuild())
return;
CGuild * g = ch->GetGuild();
if (!g->UnderAnyWar())
{
ch->ChatPacket(CHAT_TYPE_INFO, ("<Guild> Sadece lonca savasinda kullanilirsin!"));
return;
}
BYTE onoff = 1;
TGuildMember* lider = g->GetMember(ch->GetPlayerID());
if (lider && lider->grade == GUILD_LEADER_GRADE)
onoff = 0;
DWORD dwVID = 0;
std::unique_ptr<SQLMsg> pMsgs(DBManager::instance().DirectQuery("SELECT id FROM player.lonca_savas WHERE durum = 1 and tarih = CURDATE() and (loncam = '%s' or rakip = '%s')", g->GetName(), g->GetName()));
if (pMsgs->Get()->uiNumRows != 0)
{
MYSQL_ROW row = mysql_fetch_row(pMsgs->Get()->pSQLResult);
str_to_number(dwVID, row[0]);
}
if (dwVID)
{
std::unique_ptr<SQLMsg> pMsg(DBManager::instance().DirectQuery("SELECT isim, olum, oldurme FROM player.lonca_istatistik WHERE savas_id = '%u' and loncam = '%s'", dwVID, g->GetName()));
if (pMsg->Get()->uiNumRows != 0)
{
MYSQL_ROW row;
while (NULL != (row = mysql_fetch_row(pMsg->Get()->pSQLResult)))
{
DWORD olum = 0, oldurme = 0;
str_to_number(olum, row[1]);
str_to_number(oldurme, row[2]);
char ben[128];
snprintf(ben, sizeof(ben), "Append|%s|%u|%u|%u", row[0], olum, oldurme, onoff);
ch->ChatPacket(CHAT_TYPE_COMMAND, "lonca_istatistik %s", ben);
}
}
}
ch->ChatPacket(CHAT_TYPE_COMMAND, "lonca_istatistik Open");
}
#endif
cmd.cpp:
herhangi bir yere ekle işte sorgulama bu kadar...
#ifdef ENABLE_LONCA_ISTATISTIK
ACMD(do_war_istatistik);
ACMD(do_lonca_istatistik);
ACMD(do_lonca_savas_listesi);
ACMD(do_lonca_savas_istatistik);
#endif
herhangi bir yere ekle işte sorgulama bu kadar...
#ifdef ENABLE_LONCA_ISTATISTIK
{ "war_istatisti", do_inputall, 0, POS_DEAD, GM_PLAYER },
{ "war_istatistik", do_war_istatistik, 0, POS_DEAD, GM_PLAYER },
{ "lonca_istatisti", do_inputall, 0, POS_DEAD, GM_PLAYER },
{ "lonca_istatistik", do_lonca_istatistik, 0, POS_DEAD, GM_PLAYER },
{ "lonca_savas_gecmi", do_inputall, 0, POS_DEAD, GM_PLAYER },
{ "lonca_savas_gecmis", do_lonca_savas_listesi, 0, POS_DEAD, GM_PLAYER },
{ "lonca_savas_istatisti", do_inputall, 0, POS_DEAD, GM_PLAYER },
{ "lonca_savas_istatistik", do_lonca_savas_istatistik, 0, POS_DEAD, GM_PLAYER },
#endif
char.h:
void SetLastAttacked(DWORD time);
DWORD GetLastAttackTime() const { return m_dwLastAttackTime; }
buda altına eklersen çalışmak istiyor ?
#ifdef ENABLE_LONCA_ISTATISTIK
void SetLastWarIstatistikLastTime(int time) { m_dwWarIstLastTime = time; }
int GetLastWarIstatistikLastTime() const { return m_dwWarIstLastTime; }
void SetLastSavasListesiLastTime(int time) { m_dwSavListLastTime = time; }
int GetLastSavasListesiLastTime() const { return m_dwSavListLastTime; }
void SetLastSavasIstatistikLastTime(int time) { m_dwSavIstLastTime = time; }
int GetLastSavasIstatistikLastTime() const { return m_dwSavIstLastTime; }
void SetLastLoncaIstatistikLastTime(int time) { m_dwLonIstLastTime = time; }
int GetLastLoncaIstatistikLastTime() const { return m_dwLonIstLastTime; }
#endif
bool m_bWalking;
bool m_bNowWalking;
bool m_bStaminaConsume;
buda altına eklersen çalışmak istiyor ?
#ifdef ENABLE_LONCA_ISTATISTIK
int m_dwWarIstLastTime;
int m_dwSavListLastTime;
int m_dwSavIstLastTime;
int m_dwLonIstLastTime;
#endif
char.cpp:
m_bStaminaConsume = false;
altına eklersen çalışacakmış
#ifdef ENABLE_LONCA_ISTATISTIK
m_dwWarIstLastTime = 0;
m_dwSavListLastTime = 0;
m_dwSavIstLastTime = 0;
m_dwLonIstLastTime = 0;
#endif
war_map.cpp:
killer->IncWarKillCount();
ch->IncWarDeadCount();
ALTINA EKLE ÇALIŞSIN
#ifdef ENABLE_LONCA_ISTATISTIK
DWORD dwVID = 0;
std::unique_ptr<SQLMsg> pMsgs(DBManager::instance().DirectQuery("SELECT id FROM player.lonca_savas WHERE durum = 1 and tarih = CURDATE() and (loncam = '%s' and rakip = '%s' or rakip = '%s' and loncam = '%s')", killer->GetGuild()->GetName(), ch->GetGuild()->GetName(), killer->GetGuild()->GetName(), ch->GetGuild()->GetName()));
if (pMsgs->Get()->uiNumRows != 0)
{
MYSQL_ROW row = mysql_fetch_row(pMsgs->Get()->pSQLResult);
str_to_number(dwVID, row[0]);
}
if (dwVID)[/SPOILER]
{
std::unique_ptr<SQLMsg> pMsg(DBManager::instance().DirectQuery("SELECT * FROM player.lonca_istatistik WHERE savas_id = '%u' and isim = '%s' and loncam = '%s' and rakip = '%s'", dwVID, ch->GetName(), ch->GetGuild()->GetName(), killer->GetGuild()->GetName()));
if (pMsg->Get()->uiNumRows != 0)
{
DBManager::instance().DirectQuery("UPDATE player.lonca_istatistik SET olum = olum + 1 WHERE savas_id = '%u' and isim = '%s'", dwVID, ch->GetName());
}
else
{
DBManager::instance().DirectQuery("INSERT INTO player.lonca_istatistik(savas_id, isim, olum, oldurme, loncam, rakip) VALUES('%u', '%s', 1, 0, '%s', '%s')", dwVID, ch->GetName(), ch->GetGuild()->GetName(), killer->GetGuild()->GetName());
}
std::unique_ptr<SQLMsg> pMsg2(DBManager::instance().DirectQuery("SELECT * FROM player.lonca_istatistik WHERE savas_id = '%u' and isim = '%s' and loncam = '%s' and rakip = '%s'", dwVID, killer->GetName(), killer->GetGuild()->GetName(), ch->GetGuild()->GetName()));
if (pMsg2->Get()->uiNumRows != 0)
{
DBManager::instance().DirectQuery("UPDATE player.lonca_istatistik SET oldurme = oldurme + 1 WHERE savas_id = '%u' and isim = '%s'", dwVID, killer->GetName());
}
else
{
DBManager::instance().DirectQuery("INSERT INTO player.lonca_istatistik(savas_id, isim, olum, oldurme, loncam, rakip) VALUES('%u', '%s', 0, 1, '%s', '%s')", dwVID, killer->GetName(), killer->GetGuild()->GetName(), ch->GetGuild()->GetName());
}
}
#endif
lonca_istatistik.sql:
/*
Navicat MySQL Data Transfer
Source Server : ana makine
Source Server Version : 393939
Source Host : gizli
Source Database : player
Target Server Type : MYSQL
Target Server Version : 393939
File Encoding : 393939
Date: 2020-10-15 16:25:36
*/
SET FOREIGN_KEY_CHECKS=0;
-- ----------------------------
-- Table structure for `lonca_istatistik`
-- ----------------------------
DROP TABLE IF EXISTS `lonca_istatistik`;
CREATE TABLE `lonca_istatistik` (
`savas_id` int(11) unsigned NOT NULL,
`isim` varchar(20) DEFAULT NULL,
`olum` int(11) unsigned NOT NULL,
`oldurme` int(11) unsigned NOT NULL,
`loncam` varchar(20) DEFAULT NULL,
`rakip` varchar(20) DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1;
-- ----------------------------
-- Records of lonca_istatistik
-- ----------------------------
INSERT INTO `lonca_istatistik` VALUES ('16', 'SHMAAN1', '1', '0', 'DENEME111', '123');
INSERT INTO `lonca_istatistik` VALUES ('16', '[TL]Revenge', '0', '1', '123', 'DENEME111');
lonca_savas.sql:
/*
Navicat MySQL Data Transfer
Source Server : ana makine
Source Server Version : 393939
Source Host : gizli
Source Database : player
Target Server Type : MYSQL
Target Server Version : 393939
File Encoding : 393939
Date: 2020-10-15 16:25:30
*/
SET FOREIGN_KEY_CHECKS=0;
-- ----------------------------
-- Table structure for `lonca_savas`
-- ----------------------------
DROP TABLE IF EXISTS `lonca_savas`;
CREATE TABLE `lonca_savas` (
`id` int(10) unsigned NOT NULL AUTO_INCREMENT,
`loncam` varchar(20) DEFAULT NULL,
`rakip` varchar(20) DEFAULT NULL,
`tarih` date NOT NULL,
`durum` int(1) unsigned NOT NULL,
PRIMARY KEY (`id`)
) ENGINE=MyISAM AUTO_INCREMENT=17 DEFAULT CHARSET=latin1;
-- ----------------------------
-- Records of lonca_savas
-- ----------------------------[/SPOILER]
Son düzenleme: