Hi,
ich habe zur Zeit folgendes Problem.. und zwar versuche ich gerade das OfflineShopSystem von (Nicht Ken, kenne grad aber den anderen Namen nicht mehr auswdg) in meinen Source zu Implementieren.
DB erfolgreich compiled, also ist die Änderung bei tables.h und service.h in /common/ wohl korrekt gewesen.
Bei der game habe ich ein paar Fehler gelöst die beim Compilen auftraten, allerdings komme ich an diesem einen Fehler einfach nicht weiter.
Sobald ich in der Datei "input_main.cpp" die Funktion <CInputName::MyShop> wie beschrieben durch die unten stehende Funktion austausche,
werden überall in der Datei (vorher natürlich nicht) Fehler angezeigt, dass Sachen wie sys_err() nicht definiert wurden obwohl sie oben mit log.h inkludiert werden?
- int CInputMain::MyShop(LPCHARACTER ch, const char * c_pData, size_t uiBytes)
- {
- TPacketCGMyShop * p = (TPacketCGMyShop *) c_pData;
- int iExtraLen = p->bCount * sizeof(TShopItemTable);
- #ifdef SHOP_BLOCK_GAME99
- if (g_bChannel >= 99 & ch->GetGMLevel() <= 0) {
- ch->ChatPacket(CHAT_TYPE_INFO, LC_TEXT( "SHOP_OX_ERROR"));
- return (iExtraLen);
- }
- #endif
- #ifdef OFFLINE_SHOP
- if (quest::CQuestManager::instance().GetEventFlag("shop_off")==1) {
- if (ch)
- {
- ch->ChatPacket(CHAT_TYPE_INFO, LC_TEXT( "SHOP_TEMP_OFF"));
- return (iExtraLen);
- }
- }
- #endif
- #ifdef SHOP_GM_PRIVILEGES
- if (GM_PLAYER < ch->GetGMLevel() && SHOP_GM_PRIVILEGES >ch->GetGMLevel()) {
- ch->ChatPacket(CHAT_TYPE_INFO, LC_TEXT("SHOP_PRIV_ERROR"));
- return (iExtraLen);
- }
- #endif
- if (uiBytes < sizeof(TPacketCGMyShop) + iExtraLen)
- return -1;
- #ifndef FULL_YANG
- if (ch->GetGold() >= GOLD_MAX)
- {
- ch->ChatPacket(CHAT_TYPE_INFO, LC_TEXT("¼ÒÀ¯ µ·ÀÌ 20¾ï³ÉÀ» ³Ñ¾î °Å·¡¸¦ ÇÛ¼ö°¡ ¾ø½À´Ï´Ù."));
- sys_log(0, "MyShop ==> OverFlow Gold id %u name %s ", ch->GetPlayerID(), ch->GetName());
- return (iExtraLen);
- }
- #endif
- if (ch->IsStun() || ch->IsDead())
- return (iExtraLen);
- if (ch->GetExchange() || ch->IsOpenSafebox() || ch->GetShopOwner() || ch->IsCubeOpen())
- {
- ch->ChatPacket(CHAT_TYPE_INFO, LC_TEXT("´Ù¸¥ °Å·¡ÁßÀÏ°æ¿ì °³ÀλóÁ¡À» ¿¼ö°¡ ¾ø½À´Ï´Ù."));
- return (iExtraLen);
- }
- sys_log(0, "MyShop count %d", p->bCount);
- #ifdef OFFLINE_SHOP
- ch->OpenMyShop(p->szSign, (TShopItemTable *)(c_pData + sizeof(TPacketCGMyShop)), p->bCount, p->days);
- #else
- ch->OpenMyShop(p->szSign, (TShopItemTable *)(c_pData + sizeof(TPacketCGMyShop)), p->bCount);
- #endif
- return (iExtraLen);
- }
Ich hoffe ihr wisst was mir entgeht. Für mich als Laien sieht das alles plausibel aus.
Die fertig bearbeitete komplette input_main.cpp ->
- #include "stdafx.h"
- #include "constants.h"
- #include "config.h"
- #include "utils.h"
- #include "desc_client.h"
- #include "desc_manager.h"
- #include "buffer_manager.h"
- #include "packet.h"
- #include "protocol.h"
- #include "char.h"
- #include "char_manager.h"
- #include "item.h"
- #include "item_manager.h"
- #include "cmd.h"
- #include "shop.h"
- #include "shop_manager.h"
- #include "safebox.h"
- #include "regen.h"
- #include "battle.h"
- #include "exchange.h"
- #include "questmanager.h"
- #include "profiler.h"
- #include "messenger_manager.h"
- #include "party.h"
- #include "p2p.h"
- #include "affect.h"
- #include "guild.h"
- #include "guild_manager.h"
- #include "log.h"
- #include "banword.h"
- #include "empire_text_convert.h"
- #include "unique_item.h"
- #include "building.h"
- #include "locale_service.h"
- #include "gm.h"
- #include "spam.h"
- #include "ani.h"
- #include "motion.h"
- #include "OXEvent.h"
- #include "locale_service.h"
- #include "DragonSoul.h"
- extern void SendShout(const char * szText, BYTE bEmpire);
- extern int g_nPortalLimitTime;
- static int __deposit_limit()
- {
- return (1000*10000); // 1õ¸¸
- }
- void SendBlockChatInfo(LPCHARACTER ch, int sec)
- {
- if (sec <= 0)
- {
- ch->ChatPacket(CHAT_TYPE_INFO, LC_TEXT("äÆà ±ÝÁö »óÅÂÀÔ´Ï´Ù."));
- return;
- }
- long hour = sec / 3600;
- sec -= hour * 3600;
- long min = (sec / 60);
- sec -= min * 60;
- char buf[128+1];
- if (hour > 0 && min > 0)
- snprintf(buf, sizeof(buf), LC_TEXT("%d ½Ã°£ %d ºÐ %d ÃÊ µ¿¾È äÆñÝÁö »óÅÂÀÔ´Ï´Ù"), hour, min, sec);
- else if (hour > 0 && min == 0)
- snprintf(buf, sizeof(buf), LC_TEXT("%d ½Ã°£ %d ÃÊ µ¿¾È äÆñÝÁö »óÅÂÀÔ´Ï´Ù"), hour, sec);
- else if (hour == 0 && min > 0)
- snprintf(buf, sizeof(buf), LC_TEXT("%d ºÐ %d ÃÊ µ¿¾È äÆñÝÁö »óÅÂÀÔ´Ï´Ù"), min, sec);
- else
- snprintf(buf, sizeof(buf), LC_TEXT("%d ÃÊ µ¿¾È äÆñÝÁö »óÅÂÀÔ´Ï´Ù"), sec);
- ch->ChatPacket(CHAT_TYPE_INFO, buf);
- }
- EVENTINFO(spam_event_info)
- {
- char host[MAX_HOST_LENGTH+1];
- spam_event_info()
- {
- ::memset( host, 0, MAX_HOST_LENGTH+1 );
- }
- };
- typedef boost::unordered_map<std::string, std::pair<unsigned int, LPEVENT> > spam_score_of_ip_t;
- spam_score_of_ip_t spam_score_of_ip;
- EVENTFUNC(block_chat_by_ip_event)
- {
- spam_event_info* info = dynamic_cast<spam_event_info*>( event->info );
- if ( info == NULL )
- {
- sys_err("block_chat_by_ip_event> <Factor> Null pointer");
- return 0;
- }
- const char * host = info->host;
- auto it = spam_score_of_ip.find(host);
- if (it != spam_score_of_ip.end())
- {
- it->second.first = 0;
- it->second.second = NULL;
- }
- return 0;
- }
- bool SpamBlockCheck(LPCHARACTER ch, const char* const buf, const size_t buflen)
- {
- extern int g_iSpamBlockMaxLevel;
- if (ch->GetLevel() < g_iSpamBlockMaxLevel)
- {
- auto it = spam_score_of_ip.find(ch->GetDesc()->GetHostName());
- if (it == spam_score_of_ip.end())
- {
- spam_score_of_ip.insert(std::make_pair(ch->GetDesc()->GetHostName(), std::make_pair(0, (LPEVENT) NULL)));
- it = spam_score_of_ip.find(ch->GetDesc()->GetHostName());
- }
- if (it->second.second)
- {
- SendBlockChatInfo(ch, event_time(it->second.second) / passes_per_sec);
- return true;
- }
- unsigned int score;
- const char * word = SpamManager::instance().GetSpamScore(buf, buflen, score);
- it->second.first += score;
- if (word)
- sys_log(0, "SPAM_SCORE: %s text: %s score: %u total: %u word: %s", ch->GetName(), buf, score, it->second.first, word);
- extern unsigned int g_uiSpamBlockScore;
- extern unsigned int g_uiSpamBlockDuration;
- if (it->second.first >= g_uiSpamBlockScore)
- {
- spam_event_info* info = AllocEventInfo<spam_event_info>();
- strlcpy(info->host, ch->GetDesc()->GetHostName(), sizeof(info->host));
- it->second.second = event_create(block_chat_by_ip_event, info, PASSES_PER_SEC(g_uiSpamBlockDuration));
- sys_log(0, "SPAM_IP: %s for %u seconds", info->host, g_uiSpamBlockDuration);
- LogManager::instance().CharLog(ch, 0, "SPAM", word);
- SendBlockChatInfo(ch, event_time(it->second.second) / passes_per_sec);
- return true;
- }
- }
- return false;
- }
- enum
- {
- TEXT_TAG_PLAIN,
- TEXT_TAG_TAG, // ||
- TEXT_TAG_COLOR, // |cffffffff
- TEXT_TAG_HYPERLINK_START, // |H
- TEXT_TAG_HYPERLINK_END, // |h ex) |Hitem:1234:1:1:1|h
- TEXT_TAG_RESTORE_COLOR,
- };
- int GetTextTag(const char * src, int maxLen, int & tagLen, std::string & extraInfo)
- {
- tagLen = 1;
- if (maxLen < 2 || *src != '|')
- return TEXT_TAG_PLAIN;
- const char * cur = ++src;
- if (*cur == '|') // ||´Â |·Î Ç¥½ÃÇÑ´Ù.
- {
- tagLen = 2;
- return TEXT_TAG_TAG;
- }
- else if (*cur == 'c') // color |cffffffffblahblah|r
- {
- tagLen = 2;
- return TEXT_TAG_COLOR;
- }
- else if (*cur == 'H') // hyperlink |Hitem:10000:0:0:0:0|h[À̸§]|h
- {
- tagLen = 2;
- return TEXT_TAG_HYPERLINK_START;
- }
- else if (*cur == 'h') // end of hyperlink
- {
- tagLen = 2;
- return TEXT_TAG_HYPERLINK_END;
- }
- return TEXT_TAG_PLAIN;
- }
- void GetTextTagInfo(const char * src, int src_len, int & hyperlinks, bool & colored)
- {
- colored = false;
- hyperlinks = 0;
- int len;
- std::string extraInfo;
- for (int i = 0; i < src_len;)
- {
- int tag = GetTextTag(&src[i], src_len - i, len, extraInfo);
- if (tag == TEXT_TAG_HYPERLINK_START)
- ++hyperlinks;
- if (tag == TEXT_TAG_COLOR)
- colored = true;
- i += len;
- }
- }
- int ProcessTextTag(LPCHARACTER ch, const char * c_pszText, size_t len)
- {
- return 0;//BETEKINT