Jump to content

Search the Community

Showing results for tags 'shop'.



More search options

  • Search By Tags

    Type tags separated by commas.
  • Search By Author

Content Type


Forums

  • Community
    • M2Dev
    • Offtopic
    • Games Talk
    • Music / Videos / Art
    • Member Representations
    • Services & Sales
  • Metin2
    • General
    • Questions and Answers
    • Frequently Asked Questions
    • Private Servers
    • Videos
  • Suggest a Tutorial / Release
    • Suggest a Tutorial / Release
    • Temporary forum
  • Releases
    • General
    • Guides & HowTo
    • Tools
    • Programming & Scripts / Systems
    • Maps
    • Quests
    • Binaries & Clients / ServerFiles
    • 3D Models
    • 2D Graphics
    • Operating Systems

Categories

There are no results to display.

There are no results to display.


Find results in...

Find results that contain...


Date Created

  • Start

    End


Last Updated

  • Start

    End


Filter by number of...

Joined

  • Start

    End


Group


Nationality


Skype


Discord


Website


Steam ID


Mapping


3D


2D


C++


LUA


Python


PHP


SQL


HTML


CSS


JavaScript


Empire

Found 36 results

  1. Automatic payment and delivery system by: Site: http://mark3dservice.pl/ Skype: marek.mark16
  2. Hello everyone, I want to buy a really good and hassle-free offline shop. Can developers and those who have knowledge on the subject contact me?
  3. I need help with this error, please if anyone knows can you help me? thanks. https://i.imgur.com/i7Rv85B.gifv
  4. Hello devs Today I would like to present you a new solution that can make you feel more safe with your GMs. This is my first release and it's very simple to do, I'm just posting it here for the newbies and those who don't know how to start searching and other shit like that WHAT IS THIS SYSTEM? This system is a number of preventions for GameMaster characters about certain interractions with normal players in the game. The functions you are about to see are blocking GMs from: Trading items with normal players (and the opposite) Invite normal players to parties (and the opposite) Invite normal players to guilds (and the opposite) Adding normal players as friend contacts (I would say and the opposite but it already exists by default ) Drop items to the ground Build their own private shops with the Bundle item Buy items from a private shop Block a GM from buffing normal players Using the commands /set, /a and /setskillother to normal players WHO IS THIS SYSTEM FOR? I believe we can all agree that trust in partnership is a rare thing these days. This system is released from me for the Admins out there that cannot trust their GMs (and many times their self) so much. Imagine having a server and your GM just gives away items for free to everyone. Bad huh? I thought so... So with this system you are sure that your GMs will do their job properly and won't violate any game rules behind your backs. Your server has rules (as all games out there) and if you wanted people to have some items for free you can easily put those items for sale into the town vendors. People who do this kind of things behind your backs are not authorized by you to do it but I believe that it happened (if not happening yet) to the best of you guys, that's why I'm releasing it. It's time to set some things right in your servers, GMs exist to answer questions and not helping players cheat without any authorization from the administrators, so without further ado, let's get started. SORRY AGAIN, ONE MORE THING I BELIEVE THIS QUESTION IS IN THE MIND OF A DEVELOPER WHO READS THIS GUIDE: MIND RAPIST, WHY DO YOU USE THE IsGM() BOOLEAN TO CHECK IF A PLAYER IS A GM AND NOT USE THE TRADITIONAL CHECK GetGMLevel() > GM_PLAYER? In this tutorial, we will be using the bool IsGM() instead of the usual check because some of the guys who see this may have added @Alina's GM Elevation system. In that case, GetGMLevel() won't work before the character elevates, so our GMs will be able to bypass the check and just create a perfect item, relog and give it away before they elevate. We don't want that don't we? So who ever wants to use GetGMLevel() > GM_PLAYER instead of IsGM() there is no difference you can do that guys, except if you did the elevation system, then you need to use my function in order to work. So let's get the party started. PARTY INVITATION BLOCK In char.cpp search for the function "void CHARACTER::PartyInvite(LPCHARACTER pchInvitee)" and under add this: Done with party block, let's continue BUNDLE USAGE BLOCK FOR CREATING PRIVATE SHOPS In char_item.cpp search for the function "bool CHARACTER::UseItemEx(LPITEM item, TItemPos DestCell)" and under add this: Done, let's continue ITEM DROP BLOCK Still in char_item.cpp search for the function "bool CHARACTER::DropItem(TItemPos Cell, BYTE bCount)" and under add this: Done with that one, you can close char_item.cpp. Let's move on BUFF BLOCK In char_skill.cpp find this: and paste this under it: Done with that, next! /SET COMMAND BLOCK FOR PLAYERS In cmd_gm.cpp search for the function "ACMD(do_set)" and under add this: Done, but do not close, we have more commands to block! /A COMMAND BLOCK FOR PLAYERS Still in cmd_gm.cpp, search for the function "ACMD(do_advance)" and under add this: Do not close that file yet, one more command left to block /SETSKILLOTHER COMMAND BLOCK FOR PLAYERS Still in this file, search for the function "ACMD(do_setskillother)" and under add this: Done with the commands, you may close cmd_gm.cpp and move on EXCHANGE BLOCK In exchange.cpp search for the function "bool CHARACTER::ExchangeStart(LPCHARACTER victim)" and under (if you have sash system in your source, the top line may be "if ( IsOpenSafebox() || GetShopOwner() || GetMyShop() || IsCubeOpen() || IsAcceOpen() )") add this: Done with the exchange, moving on! GUILD INVITATION BLOCK In guild.cpp search for the function "void CGuild::Invite( LPCHARACTER pchInviter, LPCHARACTER pchInvitee )" and under add this: Here goes the guild invitation, let's move forward FRIEND LIST BLOCK In input_main.cpp search for the function "int CInputMain::Messenger(LPCHARACTER ch, const char* c_pData, size_t uiBytes)" and find this line: change it like this: Still in the same function, find this line in "case MESSENGER_SUBHEADER_CG_ADD_BY_NAME:": and add this: Friends are done. Let's move on to the last one! BUYING ITEMS FROM PRIVATE SHOPS BLOCK In shop_manager.cpp search for the function "void CShopManager::Buy(LPCHARACTER ch, BYTE pos)" and under add this: Done It's not something hard to do, I just gathered everything in one place, you can now sleep at night knowing that your GMs cannot fraud you. I would like to give special thanks to @VegaS who wrote the blocks for buffs, party and guild invitation, thanks so much buddy Note: These will block any interraction between a GM and a normal player, but a GM will be able to interract with another GM (example trade GM with GM). And before someone asks yes I thought about a safebox block for GMs but there is no need for that since you can login to his account and create 3 players, then logout and delete them directly from their database, leaving 3 warriors with Level 0 that cannot login to the game. Let the poor GMs have their safebox it's the only thing left to them after that I think xD So I hope I helped some folks here the tutorial is done Kind regards ~ Mind Rapist
  5. Hi change price shop offline? example: Gold for item 101 change bank shop to bank great
  6. Hello! I'd like to show you how you can check position for shops (probably offline shops too). I don't like when the map is full of shops or when shops are too close for each other. So I've made few functions for checking if the shop is in safezone or if it too close to other shops. Let's start char.h Find there: void CloseMyShop(); protected: LPSHOP m_pkShop; LPSHOP m_pkMyShop; std::string m_stShopSign; LPCHARACTER m_pkChrShopOwner; Add few new lines: void CloseMyShop(); void SetShopValidPos(bool value) { m_bShopValidPos = value; } bool GetShopValidPos() { return m_bShopValidPos; } protected: LPSHOP m_pkShop; LPSHOP m_pkMyShop; std::string m_stShopSign; LPCHARACTER m_pkChrShopOwner; bool m_bShopValidPos; char.cpp In 'void CHARACTER::Initialize()' find: m_pkMyShop = NULL; Add below: m_bShopValidPos = true; Then search for 'void CHARACTER::OpenMyShop(const char * c_pszSign, TShopItemTable * pTable, BYTE bItemCount)' Add above new function: struct CheckShopPos { LPCHARACTER m_ch; CheckShopPos(LPCHARACTER ch) { m_ch = ch; } void operator()(LPENTITY ent) { if (ent->IsType(ENTITY_CHARACTER)) { LPCHARACTER ch = (LPCHARACTER) ent; if (ch->GetRaceNum()!=30000) //shop mob vnum return; if (DISTANCE_APPROX(ch->GetX() - m_ch->GetX(), ch->GetY() - m_ch->GetY()) < 200) //distance between shops { m_ch->SetShopValidPos(false); } } } }; Then in 'void CHARACTER::OpenMyShop(const char * c_pszSign, TShopItemTable * pTable, BYTE bItemCount)' search for: if (bItemCount == 0) return; Add below: //shops pos check LPSECTREE sectree = GetSectree(); if (sectree) { SetShopValidPos(true); CheckShopPos f(this); sectree->ForEachAround(f); if(!GetShopValidPos()) { ChatPacket(CHAT_TYPE_INFO, "You cannot open a shop here (too close to other shop)."); return; } if (!sectree->IsAttr(GetX(), GetY(), ATTR_BANPK)) { ChatPacket(CHAT_TYPE_INFO, "You cannot open a shop here (use safezone)."); return; } } //shops pos check P.s: That's all, have fun Regards.
  7. Hello. I managed to put my server in offlineshop by great but i had a problem, when i try to create shop that one (shop) is normal, Not offline. My money remain in inventory and If i don’t have enough money, the message “you don’t have enough young” is Not appear. More than that when it’s created in navicat it don’t create necesary Lines in table. Can anyone help me with an answer? I don t have errors in syserr. https://www.youtube.com/watch?v=u48O29wAcZ4&feature=youtu.be
  8. Hello, To extend NPC Shop to 80 Items follow these steps. ServerSide Open "common/length.h" and search: SHOP_HOST_ITEM_MAX_NUM = 40 Replace with: SHOP_HOST_ITEM_MAX_NUM = 80 In the same file search: SHOP_PRICELIST_MAX_NUM = 40 Replace with: SHOP_PRICELIST_MAX_NUM = 80 Now open "game/shop.cpp" and search: m_pGrid = M2_NEW CGrid(5, 9) Replace with: m_pGrid = M2_NEW CGrid(10, 9) Now open "game/shop_manager.cpp" and search: CGrid grid = CGrid(5, 9) Replace with: CGrid grid = CGrid(10, 9) Now compile Db File & Game File and ServerSide's steps complete. ClientSide NOTE: If you want Only NPC Shop's with 80 Items follow this guide, else if you want NPC Shop & Private Shop follow the Update Istruction. Extract "pack/uiscript" from your Client and open "shopdialog.py". Now reaplace all content with: Shopdialog.py ~ 80 Items Now create "shopdialog2.py" and insert this content: ShopDialog2 ~ 80 Items for Shop Ok, at this point you can compress your UiScript with the new file "shopdialog2.py". Extract "pack/root" from your Client and open "interfacemodule.py" Search this: self.dlgShop = uiShop.ShopDialog() self.dlgShop.LoadDialog() self.dlgShop.Hide() After add: self.dlgShop2 = uiShop.ShopDialog2() self.dlgShop2.LoadDialog() self.dlgShop2.Hide() Same file, search this: def OpenShopDialog(self, vid): self.wndInventory.Show() self.wndInventory.SetTop() self.dlgShop.Open(vid) self.dlgShop.SetTop() After add: def OpenShopDialog2(self, vid): self.wndInventory.Show() self.wndInventory.SetTop() self.dlgShop2.Open(vid) self.dlgShop2.SetTop() Now open "game.py" and Search: def StartShop(self, vid): self.interface.OpenShopDialog(vid) Replace with: def StartShop(self, vid): if chr.IsNPC(vid): self.interface.OpenShopDialog(vid) else: self.interface.OpenShopDialog2(vid) Now open "uishop.py" and Search: def Close(self): self.OnCloseQuestionDialog() shop.Close() net.SendShopEndPacket() self.CancelShopping() self.tooltipItem.HideToolTip() self.Hide() Replace with: def Close(self): self.OnCloseQuestionDialog() shop.Close() net.SendShopEndPacket() self.CancelShopping() self.Hide() Same file, search: def OnUpdate(self): USE_SHOP_LIMIT_RANGE = 1000 (x, y, z) = player.GetMainCharacterPosition() if abs(x - self.xShopStart) > USE_SHOP_LIMIT_RANGE or abs(y - self.yShopStart) > USE_SHOP_LIMIT_RANGE: self.Close() After add: UiShop.py ~ ShopDialog2 Now you can compress "root" file. #Update [24-02-15] Fixed Client Bug. Changes in "shop_manager.cpp" added. #Update [26-02-15] Added PrivateShop with 80 Items. NPC & PrivateShop with 80 Items ClientSide: Open "UserInterface/Packet.h" in you Binary Client Source and Search: SHOP_HOST_ITEM_MAX_NUM = 40 Replace with: SHOP_HOST_ITEM_MAX_NUM = 80 Now you can compile your Binary Source. Open your Client File and extract "pack/uiscript". Open "shopdialog.py" and replace all contentwith: Shopdialog.py ~ 80 Items Now open "privateshopbuilder.py" and replace all content with: PrivateShopBuilder ~ 80 Items Now you can compress your UiScript. Screen Private Shop: Et Voilà, we ended. Good work, Bye.
  9. Hi Guys, Help me please ^^ This error is appearing when I log in My file: ui.py https://pastebin.com/MhVxqzkh My file: game.py https://pastebin.com/3wdAqxJm My file: interfacemodule:.py https://pastebin.com/znBA0LZs Please guys Error client: 0529 03:35:10389 :: invalid idx 0 0529 03:36:30758 :: Traceback (most recent call last): 0529 03:36:30758 :: File "networkModule.py", line 247, in SetGamePhase 0529 03:36:30758 :: File "game.py", line 101, in __init__ 0529 03:36:30759 :: File "interfaceModule.py", line 310, in MakeInterface 0529 03:36:30759 :: File "interfaceModule.py", line 193, in __MakeWindows 0529 03:36:30760 :: File "uiInventory.py", line 262, in __init__ 0529 03:36:30760 :: File "uiInventory.py", line 400, in __LoadWindow 0529 03:36:30761 :: File "uiInventory.py", line 468, in SetInventoryPage 0529 03:36:30761 :: File "uiInventory.py", line 588, in RefreshBagSlotWindow 0529 03:36:30762 :: File "ui.py", line 1279, in SetItemSlot 0529 03:36:30763 :: AttributeError 0529 03:36:30763 :: : 0529 03:36:30763 :: 'module' object has no attribute 'SetSlotID'
  10. Hi guys, I am having trouble compiling the following files: My file: PythonShop.cpp: https://pastebin.com/aky3y6nK PythonShop.h: https://pastebin.com/Z9eTe45Z Tut: Archive PythonShop.cpp : https://pastebin.com/gWcdh3ne Archive PythonShop.h:https://pastebin.com/LfavfwzJ 1>c:\users\renss_000\onedrive\metin2\source\editando\cliente\client\userinterface\PythonShop.h(66): error C2535: 'int CPythonShop::GetPrivateShopItemPrice(TItemPos)' : member function already defined or declared 1> c:\users\renss_000\onedrive\metin2\source\editando\cliente\client\userinterface\PythonShop.h(55) : see declaration of 'CPythonShop::GetPrivateShopItemPrice' Help me =/
  11. For starters hello! I'd like to be able to hide the Shop Search Icon and 2 I have a problem with vouchers ... that is, I want to save myself in the log table from navicat the code looks like this: char.cpp bool CHARACTER::SetCoins(long coins) { SQLMsg *msg; msg = DBManager::instance().DirectQuery("UPDATE account.account SET coins = coins + '%ld' WHERE id = '%d'", coins, GetAID()); if (msg->uiSQLErrno != 0) { sys_err("[MD] Nu pot fi predate!(a aparut o eroare)"); return false; } return true; } char_item.cpp switch (item->GetVnum()) { //Vnums case 80014: // 100 DR/Coins case 80015: // 500 DR/Coins case 80016: // 1000 DR/Coins case 80017: // 50 DR/Coins int idx[4]; idx[0] = 100; idx[1] = 500; idx[2] = 1000; idx[3] = 50; int idax; if (item->GetVnum() == 80014) idax = 0; if (item->GetVnum() == 80015) idax = 1; if (item->GetVnum() == 80016) idax = 2; if (item->GetVnum() == 80017) idax = 3; long val; val = idx[idax]; if (SetCoins(val)) { ChatPacket(CHAT_TYPE_INFO, "Ai Primit %ld Monede Dragon.", val); // {0} item->SetCount(item->GetCount() - 1); } else { ChatPacket(CHAT_TYPE_INFO, "A aparut o eroare. Contactati administratorul."); } return 1; break; default: break; } my table log tables voucher_log Target Server Type : MYSQL Target Server Version : 50533 File Encoding : 65001 Date: 2018-02-10 16:01:15 */ SET FOREIGN_KEY_CHECKS=0; -- ---------------------------- -- Table structure for voucher_log -- ---------------------------- DROP TABLE IF EXISTS `voucher_log`; CREATE TABLE `voucher_log` ( `id` int(10) unsigned NOT NULL AUTO_INCREMENT, `account_id` int(10) unsigned NOT NULL, `item_vnum` int(11) NOT NULL, `coins` int(10) unsigned NOT NULL, `data` datetime NOT NULL, PRIMARY KEY (`id`) ) ENGINE=MyISAM DEFAULT CHARSET=utf8; -- ---------------------------- -- Records of voucher_log -- ---------------------------- Sorry for my bad English
  12. Hello, I would like to view openned shop name (openned by player) in shopdialog, but I cant find this function. Just to have a viewed shop name in shopdialog. Can somebody help me, please? Thanks.
  13. Hello Guys,..i'm having a problem in offline shop max yang, when i finished adding max yang in offline shop and go to the client i created a shop successfully but when i try to add another item or to change price of the item the client logout but the server is still connected and i can connect again... i went to the syserr of the client and it was clean and in the syserr for the server i found this Process: FDWATCH: peer null in event: ident 23------------ (means that the core crashed but there was no game core) and when i added the offline_shop_item.sql which belongs to the (offlineshop max yang files) the server has crashed the core and when i made a debug i found this #0 0x08386bb2 in mysql_fetch_row () #1 0x0827fb68 in COfflineShopManager::Refresh (this=0xbfbfaa70, ch=0x5669f000) at offlineshop_manager.cpp:705 #2 0x08160ab4 in CInputMain::OfflineShop (this=0x2a35f49c, ch=0x5669f000, data=0x567df000 "8\tF▒▒▒▒▒▒▒▒", uiBytes=<value optimized out>) at input_main.cpp:1262 #3 0x08166be4 in CInputMain::Analyze (this=0x2a35f49c, d=0x2a35f400, bHeader=<value optimized out>, c_pData=0x567df000 "8\tF▒▒▒▒▒▒▒▒") at input_main.cpp:3345 #4 0x0814dfeb in CInputProcessor::Process (this=0x2a35f49c, lpDesc=0x2a35f400, c_pvOrig=0x567df000, iBytes=3, r_iBytesProceed=@0xbfbfa2f4) at input.cpp:102 #5 0x08116ed3 in DESC::ProcessInput (this=0x2a35f400) at desc.cpp:313 #6 0x08283a84 in io_loop (fdw=0x293f5500) at main.cpp:1035 #7 0x082844b0 in idle () at main.cpp:912 #8 0x08285da4 in main (argc=1, argv=Cannot access memory at address 0x4 ) at main.cpp:562 please can anyone help me at this?
  14. The problem occurs when I close the market. How can i solve it? I think the problem is in the function of giveback,2,3 #include "stdafx.h" #include "../../libgame/include/grid.h" #include "constants.h" #include "utils.h" #include "config.h" #include "offline_shop.h" #include "desc.h" #include "desc_manager.h" #include "char.h" #include "char_manager.h" #include "item.h" #include "item_manager.h" #include "buffer_manager.h" #include "packet.h" #include "log.h" #include "db.h" #include "questmanager.h" #include "monarch.h" #include "mob_manager.h" #include "locale_service.h" #include "desc_client.h" #include "group_text_parse_tree.h" #include <boost/algorithm/string/predicate.hpp> #include <cctype> #include "offlineshop_manager.h" #include "p2p.h" #include "entity.h" #include "sectree_manager.h" #include "offlineshop_config.h" COfflineShopManager::COfflineShopManager() { } COfflineShopManager::~COfflineShopManager() { } struct FFindOfflineShop { const char * szName; DWORD dwVID, dwRealOwner; FFindOfflineShop(const char * c_szName) : szName(c_szName), dwVID(0), dwRealOwner(0) {}; void operator()(LPENTITY ent) { if (!ent) return; if (ent->IsType(ENTITY_CHARACTER)) { LPCHARACTER ch = (LPCHARACTER)ent; if (ch->IsOfflineShopNPC() && !strcmp(szName, ch->GetName())) { dwVID = ch->GetVID(); dwRealOwner = ch->GetOfflineShopRealOwner(); M2_DESTROY_CHARACTER(ch); } } } }; bool COfflineShopManager::StartShopping(LPCHARACTER pkChr, LPCHARACTER pkChrShopKeeper) { if (pkChr->GetOfflineShopOwner() == pkChrShopKeeper) return false; if (pkChrShopKeeper->IsPC()) return false; sys_log(0, "OFFLINE_SHOP: START: %s", pkChr->GetName()); return true; } LPOFFLINESHOP COfflineShopManager::CreateOfflineShop(LPCHARACTER npc, DWORD dwOwnerPID) { if (FindOfflineShop(npc->GetVID())) return NULL; LPOFFLINESHOP pkOfflineShop = M2_NEW COfflineShop; pkOfflineShop->SetOfflineShopNPC(npc); m_map_pkOfflineShopByNPC.insert(TShopMap::value_type(npc->GetVID(), pkOfflineShop)); m_Map_pkOfflineShopByNPC2.insert(TOfflineShopMap::value_type(dwOwnerPID, npc->GetVID())); return pkOfflineShop; } LPOFFLINESHOP COfflineShopManager::FindOfflineShop(DWORD dwVID) { TShopMap::iterator it = m_map_pkOfflineShopByNPC.find(dwVID); if (it == m_map_pkOfflineShopByNPC.end()) return NULL; return it->second; } void COfflineShopManager::DestroyOfflineShop(LPCHARACTER ch, DWORD dwVID, bool bDestroyAll) { if (dwVID == 0 && ch) { std::auto_ptr<SQLMsg> pMsg(DBManager::instance().DirectQuery("SELECT mapIndex, mapIndex,channel FROM %soffline_shop_npc WHERE owner_id = %u", get_table_postfix(), ch->GetPlayerID())); if (pMsg->Get()->uiNumRows == 0) { ch->ChatPacket(CHAT_TYPE_INFO, LC_TEXT("You can't use this option because you don't have offline shop npc!")); return; } MYSQL_ROW row = mysql_fetch_row(pMsg->Get()->pSQLResult); long lMapIndex = 0; str_to_number(lMapIndex, row[0]); TPacketGGRemoveOfflineShop p; p.bHeader = HEADER_GG_REMOVE_OFFLINE_SHOP; p.lMapIndex = lMapIndex; // Set offline shop name char szNpcName[CHARACTER_NAME_MAX_LEN + 1]; snprintf(szNpcName, sizeof(szNpcName), "%s", ch->GetName()); strlcpy(p.szNpcName, szNpcName, sizeof(p.szNpcName)); // End Of Set offline shop name P2P_MANAGER::instance().Send(&p, sizeof(TPacketGGRemoveOfflineShop)); Giveback(ch); } else if (dwVID && ch) { LPCHARACTER npc; if (!ch) npc = CHARACTER_MANAGER::instance().Find(dwVID); else npc = CHARACTER_MANAGER::instance().Find(FindMyOfflineShop(ch->GetPlayerID())); if (!npc) { std::auto_ptr<SQLMsg> pMsg(DBManager::instance().DirectQuery("SELECT mapIndex,channel FROM %soffline_shop_npc WHERE owner_id = %u", get_table_postfix(), ch->GetPlayerID())); if (pMsg->Get()->uiNumRows == 0) { ch->ChatPacket(CHAT_TYPE_INFO, LC_TEXT("You can't use this option because you don't have offline shop npc!")); return; } MYSQL_ROW row = mysql_fetch_row(pMsg->Get()->pSQLResult); long lMapIndex = 0; str_to_number(lMapIndex, row[0]); BYTE bChannel = 0; str_to_number(bChannel, row[1]); if (g_bChannel != bChannel) { ch->ChatPacket(CHAT_TYPE_INFO, LC_TEXT("You can't close your offline shop from %d channel. You must login %d channel"), g_bChannel, bChannel); return; } char szName[CHARACTER_NAME_MAX_LEN + 1]; snprintf(szName, sizeof(szName), "%s", ch->GetName()); LPSECTREE_MAP pMap = SECTREE_MANAGER::instance().GetMap(lMapIndex); FFindOfflineShop offlineShop(szName); pMap->for_each(offlineShop); if (bDestroyAll) { Giveback(ch); m_map_pkOfflineShopByNPC.erase(offlineShop.dwVID); m_Map_pkOfflineShopByNPC2.erase(offlineShop.dwRealOwner); DBManager::instance().DirectQuery("DELETE FROM %soffline_shop_npc WHERE owner_id = %u", get_table_postfix(), offlineShop.dwRealOwner); return; } } LPOFFLINESHOP pkOfflineShop; if (!ch) pkOfflineShop = FindOfflineShop(dwVID); else pkOfflineShop = FindOfflineShop(FindMyOfflineShop(ch->GetPlayerID())); if (!pkOfflineShop) return; if (npc->GetOfflineShopChannel() != g_bChannel) { ch->ChatPacket(CHAT_TYPE_INFO, LC_TEXT("You can't close your offline shop from %d channel. You must login %d channel"), g_bChannel, npc->GetOfflineShopChannel()); return; } if (bDestroyAll) { Giveback(ch); pkOfflineShop->Destroy(npc); } m_map_pkOfflineShopByNPC.erase(npc->GetVID()); m_Map_pkOfflineShopByNPC2.erase(npc->GetOfflineShopRealOwner()); M2_DELETE(pkOfflineShop); } } void COfflineShopManager::Giveback(LPCHARACTER ch) { if (!ch) return; char szQuery[1024]; if (g_bOfflineShopSocketMax == 3) snprintf(szQuery, sizeof(szQuery), "SELECT pos,count,vnum,socket0,socket1,socket2,attrtype0, attrvalue0, attrtype1, attrvalue1, attrtype2, attrvalue2, attrtype3, attrvalue3, attrtype4, attrvalue4, attrtype5, attrvalue5, attrtype6, attrvalue6, applytype0, applyvalue0, applytype1, applyvalue1, applytype2, applyvalue2, applytype3, applyvalue3, applytype4, applyvalue4, applytype5, applyvalue5, applytype6, applyvalue6, applytype7, applyvalue7 FROM %soffline_shop_item WHERE owner_id = %u", get_table_postfix(), ch->GetPlayerID()); else if(g_bOfflineShopSocketMax == 4) snprintf(szQuery, sizeof(szQuery), "SELECT pos,count,vnum,socket0,socket1,socket2,socket3,attrtype0, attrvalue0, attrtype1, attrvalue1, attrtype2, attrvalue2, attrtype3, attrvalue3, attrtype4, attrvalue4, attrtype5, attrvalue5, attrtype6, attrvalue6, applytype0, applyvalue0, applytype1, applyvalue1, applytype2, applyvalue2, applytype3, applyvalue3, applytype4, applyvalue4, applytype5, applyvalue5, applytype6, applyvalue6, applytype7, applyvalue7 FROM %soffline_shop_item WHERE owner_id = %u", get_table_postfix(), ch->GetPlayerID()); else if(g_bOfflineShopSocketMax == 5) snprintf(szQuery, sizeof(szQuery), "SELECT pos,count,vnum,socket0,socket1,socket2,socket3,socket4,attrtype0, attrvalue0, attrtype1, attrvalue1, attrtype2, attrvalue2, attrtype3, attrvalue3, attrtype4, attrvalue4, attrtype5, attrvalue5, attrtype6, attrvalue6, applytype0, applyvalue0, applytype1, applyvalue1, applytype2, applyvalue2, applytype3, applyvalue3, applytype4, applyvalue4, applytype5, applyvalue5, applytype6, applyvalue6, applytype7, applyvalue7 FROM %soffline_shop_item WHERE owner_id = %u", get_table_postfix(), ch->GetPlayerID()); else if(g_bOfflineShopSocketMax == 6) snprintf(szQuery, sizeof(szQuery), "SELECT pos,count,vnum,socket0,socket1,socket2,socket3,socket4,socket5,attrtype0, attrvalue0, attrtype1, attrvalue1, attrtype2, attrvalue2, attrtype3, attrvalue3, attrtype4, attrvalue4, attrtype5, attrvalue5, attrtype6, attrvalue6, applytype0, applyvalue0, applytype1, applyvalue1, applytype2, applyvalue2, applytype3, applyvalue3, applytype4, applyvalue4, applytype5, applyvalue5, applytype6, applyvalue6, applytype7, applyvalue7 FROM %soffline_shop_item WHERE owner_id = %u", get_table_postfix(), ch->GetPlayerID()); std::auto_ptr<SQLMsg> pMsg(DBManager::Instance().DirectQuery(szQuery)); if (pMsg->Get()->uiNumRows == 0) { // sys_err("COfflineShopManager::GiveBack - There is nothing for this player [%s]", ch->GetName()); return; } MYSQL_ROW row; while (NULL != (row = mysql_fetch_row(pMsg->Get()->pSQLResult))) { TPlayerItem item; str_to_number(item.pos, row[0]); str_to_number(item.count, row[1]); str_to_number(item.vnum, row[2]); // Set Sockets for (int i = 0, n = 4; i < ITEM_SOCKET_MAX_NUM; ++i, n++) str_to_number(item.alSockets[i], row[n]); // End Of Set Sockets // Set Attributes for (int i = 0, iStartAttributeType = 8, iStartAttributeValue = 9 ; i < ITEM_ATTRIBUTE_MAX_NUM; ++i, iStartAttributeType += 2, iStartAttributeValue += 2) { str_to_number(item.aAttr[i].bType, row[iStartAttributeType]); str_to_number(item.aAttr[i].sValue, row[iStartAttributeValue]); } // End Of Set Attributes LPITEM pItem = ITEM_MANAGER::instance().CreateItem(item.vnum, item.count); if (pItem) { int iEmptyPos = 0; if (pItem->IsDragonSoul()) iEmptyPos = ch->GetEmptyDragonSoulInventory(pItem); else iEmptyPos = ch->GetEmptyInventory(pItem->GetSize()); if (iEmptyPos < 0) { ch->ChatPacket(CHAT_TYPE_INFO, LC_TEXT("There is no enough slot for store the items!")); return; } pItem->SetSockets(item.alSockets); pItem->SetAttributes(item.aAttr); if (pItem->IsDragonSoul()) pItem->AddToCharacter(ch, TItemPos(DRAGON_SOUL_INVENTORY, iEmptyPos)); else pItem->AddToCharacter(ch, TItemPos(INVENTORY, iEmptyPos)); ch->ChatPacket(CHAT_TYPE_INFO, LC_TEXT("You are gain %s item from your offline shop."), pItem->GetName()); DBManager::instance().DirectQuery("DELETE FROM %soffline_shop_item WHERE owner_id = %u and pos = %d", get_table_postfix(), ch->GetPlayerID(), item.pos); } } } void COfflineShopManager::Giveback3(LPCHARACTER ch) { if (!ch) return; char szQuery[1024]; if (g_bOfflineShopSocketMax == 3) snprintf(szQuery, sizeof(szQuery), "SELECT pos,count,vnum,socket0,socket1,socket2,attrtype0, attrvalue0, attrtype1, attrvalue1, attrtype2, attrvalue2, attrtype3, attrvalue3, attrtype4, attrvalue4, attrtype5, attrvalue5, attrtype6, attrvalue6, applytype0, applyvalue0, applytype1, applyvalue1, applytype2, applyvalue2, applytype3, applyvalue3, applytype4, applyvalue4, applytype5, applyvalue5, applytype6, applyvalue6, applytype7, applyvalue7 FROM %soffline_shop_item WHERE owner_id = %u", get_table_postfix(), ch->GetPlayerID()); else if(g_bOfflineShopSocketMax == 4) snprintf(szQuery, sizeof(szQuery), "SELECT pos,count,vnum,socket0,socket1,socket2,socket3,attrtype0, attrvalue0, attrtype1, attrvalue1, attrtype2, attrvalue2, attrtype3, attrvalue3, attrtype4, attrvalue4, attrtype5, attrvalue5, attrtype6, attrvalue6, applytype0, applyvalue0, applytype1, applyvalue1, applytype2, applyvalue2, applytype3, applyvalue3, applytype4, applyvalue4, applytype5, applyvalue5, applytype6, applyvalue6, applytype7, applyvalue7 FROM %soffline_shop_item WHERE owner_id = %u", get_table_postfix(), ch->GetPlayerID()); else if(g_bOfflineShopSocketMax == 5) snprintf(szQuery, sizeof(szQuery), "SELECT pos,count,vnum,socket0,socket1,socket2,socket3,socket4,attrtype0, attrvalue0, attrtype1, attrvalue1, attrtype2, attrvalue2, attrtype3, attrvalue3, attrtype4, attrvalue4, attrtype5, attrvalue5, attrtype6, attrvalue6, applytype0, applyvalue0, applytype1, applyvalue1, applytype2, applyvalue2, applytype3, applyvalue3, applytype4, applyvalue4, applytype5, applyvalue5, applytype6, applyvalue6, applytype7, applyvalue7 FROM %soffline_shop_item WHERE owner_id = %u", get_table_postfix(), ch->GetPlayerID()); else if(g_bOfflineShopSocketMax == 6) snprintf(szQuery, sizeof(szQuery), "SELECT pos,count,vnum,socket0,socket1,socket2,socket3,socket4,socket5,attrtype0, attrvalue0, attrtype1, attrvalue1, attrtype2, attrvalue2, attrtype3, attrvalue3, attrtype4, attrvalue4, attrtype5, attrvalue5, attrtype6, attrvalue6, applytype0, applyvalue0, applytype1, applyvalue1, applytype2, applyvalue2, applytype3, applyvalue3, applytype4, applyvalue4, applytype5, applyvalue5, applytype6, applyvalue6, applytype7, applyvalue7 FROM %soffline_shop_item WHERE owner_id = %u", get_table_postfix(), ch->GetPlayerID()); std::auto_ptr<SQLMsg> pMsg(DBManager::Instance().DirectQuery(szQuery)); if (pMsg->Get()->uiNumRows == 0) { ch->ChatPacket(CHAT_TYPE_INFO, LC_TEXT("geri_verilecek_nesne_yok")); return; } std::auto_ptr<SQLMsg> pMsg1(DBManager::instance().DirectQuery("SELECT mapIndex, mapIndex,channel FROM %soffline_shop_npc WHERE owner_id = %u", get_table_postfix(), ch->GetPlayerID())); if (pMsg1->Get()->uiNumRows != 0) { ch->ChatPacket(CHAT_TYPE_INFO, LC_TEXT("ct_oldugu_icin_kullanamazsin")); return; } MYSQL_ROW row; while (NULL != (row = mysql_fetch_row(pMsg->Get()->pSQLResult))) { TPlayerItem item; str_to_number(item.pos, row[0]); str_to_number(item.count, row[1]); str_to_number(item.vnum, row[2]); // Set Sockets for (int i = 0, n = 4; i < ITEM_SOCKET_MAX_NUM; ++i, n++) str_to_number(item.alSockets[i], row[n]); // End Of Set Sockets // Set Attributes for (int i = 0, iStartAttributeType = 8, iStartAttributeValue = 9 ; i < ITEM_ATTRIBUTE_MAX_NUM; ++i, iStartAttributeType += 2, iStartAttributeValue += 2) { str_to_number(item.aAttr[i].bType, row[iStartAttributeType]); str_to_number(item.aAttr[i].sValue, row[iStartAttributeValue]); } // End Of Set Attributes LPITEM pItem = ITEM_MANAGER::instance().CreateItem(item.vnum, item.count); if (pItem) { int iEmptyPos = 0; if (pItem->IsDragonSoul()) iEmptyPos = ch->GetEmptyDragonSoulInventory(pItem); else iEmptyPos = ch->GetEmptyInventory(pItem->GetSize()); if (iEmptyPos < 0) { ch->ChatPacket(CHAT_TYPE_INFO, LC_TEXT("There is no enough slot for store the items!")); return; } pItem->SetSockets(item.alSockets); pItem->SetAttributes(item.aAttr); if (pItem->IsDragonSoul()) pItem->AddToCharacter(ch, TItemPos(DRAGON_SOUL_INVENTORY, iEmptyPos)); else pItem->AddToCharacter(ch, TItemPos(INVENTORY, iEmptyPos)); ch->ChatPacket(CHAT_TYPE_INFO, LC_TEXT("You are gain %s item from your offline shop."), pItem->GetName()); DBManager::instance().DirectQuery("DELETE FROM %soffline_shop_item WHERE owner_id = %u and pos = %d", get_table_postfix(), ch->GetPlayerID(), item.pos); } } } void COfflineShopManager::Giveback2(LPCHARACTER ch) { if (!ch) return; char szQuery[1024]; snprintf(szQuery, sizeof(szQuery), "SELECT pos,count,vnum,socket0,socket1,socket2,socket3,attrtype0, attrvalue0, attrtype1, attrvalue1, attrtype2, attrvalue2, attrtype3, attrvalue3, attrtype4, attrvalue4, attrtype5, attrvalue5, attrtype6, attrvalue6, applytype0, applyvalue0, applytype1, applyvalue1, applytype2, applyvalue2, applytype3, applyvalue3, applytype4, applyvalue4, applytype5, applyvalue5, applytype6, applyvalue6, applytype7, applyvalue7 FROM %soffline_shop_item WHERE owner_id = %u and status = 1", get_table_postfix(), ch->GetPlayerID()); std::auto_ptr<SQLMsg> pMsg(DBManager::instance().DirectQuery(szQuery)); if (pMsg->Get()->uiNumRows == 0) return; MYSQL_ROW row; while (NULL != (row = mysql_fetch_row(pMsg->Get()->pSQLResult))) { TPlayerItem item; str_to_number(item.pos, row[0]); str_to_number(item.count, row[1]); str_to_number(item.vnum, row[2]); // Set Sockets for (int i = 0, n = 4; i < ITEM_SOCKET_MAX_NUM; ++i, n++) str_to_number(item.alSockets[i], row[n]); // End Of Set Sockets // Set Attributes for (int i = 0, iStartAttributeType = 8, iStartAttributeValue = 9 ; i < ITEM_ATTRIBUTE_MAX_NUM; ++i, iStartAttributeType += 2, iStartAttributeValue += 2) { str_to_number(item.aAttr[i].bType, row[iStartAttributeType]); str_to_number(item.aAttr[i].sValue, row[iStartAttributeValue]); } // End Of Set Attributes LPITEM pItem = ITEM_MANAGER::instance().CreateItem(item.vnum, item.count); if (pItem) { int iEmptyPos = 0; if (pItem->IsDragonSoul()) iEmptyPos = ch->GetEmptyDragonSoulInventory(pItem); else iEmptyPos = ch->GetEmptyInventory(pItem->GetSize()); if (iEmptyPos < 0) { ch->ChatPacket(CHAT_TYPE_INFO, LC_TEXT("There is no enough slot for store the items!")); return; } pItem->SetSockets(item.alSockets); pItem->SetAttributes(item.aAttr); if (pItem->IsDragonSoul()) pItem->AddToCharacter(ch, TItemPos(DRAGON_SOUL_INVENTORY, iEmptyPos)); else pItem->AddToCharacter(ch, TItemPos(INVENTORY, iEmptyPos)); ch->ChatPacket(CHAT_TYPE_INFO, LC_TEXT("You are gain %s item from your offline shop."), pItem->GetName()); DBManager::instance().DirectQuery("DELETE FROM %soffline_shop_item WHERE owner_id = %u and pos = %d", get_table_postfix(), ch->GetPlayerID(), item.pos); } } } void COfflineShopManager::AddItem(LPCHARACTER ch, BYTE bDisplayPos, BYTE bPos, int iPrice) { if (!ch) return; // Fixed bug 6.21.2015 if (bDisplayPos >= OFFLINE_SHOP_HOST_ITEM_MAX_NUM) { sys_err("Overflow offline shop slot count [%s]", ch->GetName()); return; } // End Of fixed bug 6.21.2015 // Check player has offline shop or not std::auto_ptr<SQLMsg> pmsg(DBManager::instance().DirectQuery("SELECT COUNT(*) FROM player.offline_shop_npc WHERE owner_id = %u", ch->GetPlayerID())); MYSQL_ROW row = mysql_fetch_row(pmsg->Get()->pSQLResult); BYTE bResult = 0; str_to_number(bResult, row[0]); if (!bResult) { ch->ChatPacket(CHAT_TYPE_INFO, LC_TEXT("You can't use this option because you don't have a offline shop!")); return; } // End Of Check player has offline shop or not LPITEM pkItem = ch->GetInventoryItem(bPos); if (!pkItem) return; // Check const TItemTable * itemTable = pkItem->GetProto(); if (IS_SET(itemTable->dwAntiFlags, ITEM_ANTIFLAG_GIVE | ITEM_ANTIFLAG_MY_OFFLINE_SHOP)) { ch->ChatPacket(CHAT_TYPE_INFO, LC_TEXT("This item is not tradeable!")); return; } if (pkItem->isLocked()) return; if (pkItem->IsEquipped()) // burdan yap { ch->ChatPacket(CHAT_TYPE_INFO, LC_TEXT("You can't sell equipped items!")); return; } if (pkItem->IsBind() || pkItem->IsUntilBind()) { ch->ChatPacket(CHAT_TYPE_INFO, LC_TEXT("ruha_bagli_nesne")); return; } char szColumns[QUERY_MAX_LEN], szValues[QUERY_MAX_LEN]; int iLen = snprintf(szColumns, sizeof(szColumns), "id,owner_id,pos,count,price,vnum"); int iUpdateLen = snprintf(szValues, sizeof(szValues), "%u,%u,%d,%u,%d,%u", pkItem->GetID(), ch->GetPlayerID(), bDisplayPos, pkItem->GetCount(), iPrice, pkItem->GetVnum()); if (g_bOfflineShopSocketMax == 3) { iLen += snprintf(szColumns + iLen, sizeof(szColumns) - iLen, ",socket0,socket1,socket2"); iUpdateLen += snprintf(szValues + iUpdateLen, sizeof(szValues) - iUpdateLen, ",%ld,%ld,%ld", pkItem->GetSocket(0), pkItem->GetSocket(1), pkItem->GetSocket(2)); } else if(g_bOfflineShopSocketMax == 4) { iLen += snprintf(szColumns + iLen, sizeof(szColumns) - iLen, ",socket0,socket1,socket2,socket3"); iUpdateLen += snprintf(szValues + iUpdateLen, sizeof(szValues) - iUpdateLen, ",%ld,%ld,%ld,%ld", pkItem->GetSocket(0), pkItem->GetSocket(1), pkItem->GetSocket(2), pkItem->GetSocket(3)); } else if(g_bOfflineShopSocketMax == 5) { iLen += snprintf(szColumns + iLen, sizeof(szColumns) - iLen, ",socket0,socket1,socket2,socket3,socket4"); iUpdateLen += snprintf(szValues + iUpdateLen, sizeof(szValues) - iUpdateLen, ",%ld,%ld,%ld,%ld,%ld", pkItem->GetSocket(0), pkItem->GetSocket(1), pkItem->GetSocket(2), pkItem->GetSocket(3), pkItem->GetSocket(4)); } else if(g_bOfflineShopSocketMax == 6) { iLen += snprintf(szColumns + iLen, sizeof(szColumns) - iLen, ",socket0,socket1,socket2,socket3,socket4,socket5"); iUpdateLen += snprintf(szValues + iUpdateLen, sizeof(szValues) - iUpdateLen, ",%ld,%ld,%ld,%ld,%ld,%ld", pkItem->GetSocket(0), pkItem->GetSocket(1), pkItem->GetSocket(2), pkItem->GetSocket(3), pkItem->GetSocket(4), pkItem->GetSocket(5)); } iLen += snprintf(szColumns + iLen, sizeof(szColumns) - iLen, ", attrtype0, attrvalue0, attrtype1, attrvalue1, attrtype2, attrvalue2, attrtype3, attrvalue3, attrtype4, attrvalue4, attrtype5, attrvalue5, attrtype6, attrvalue6, applytype0, applyvalue0, applytype1, applyvalue1, applytype2, applyvalue2, applytype3, applyvalue3, applytype4, applyvalue4, applytype5, applyvalue5, applytype6, applyvalue6, applytype7, applyvalue7"); iUpdateLen += snprintf(szValues + iUpdateLen, sizeof(szValues) - iUpdateLen, ",%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d", pkItem->GetAttributeType(0), pkItem->GetAttributeValue(0), pkItem->GetAttributeType(1), pkItem->GetAttributeValue(1), pkItem->GetAttributeType(2), pkItem->GetAttributeValue(2), pkItem->GetAttributeType(3), pkItem->GetAttributeValue(3), pkItem->GetAttributeType(4), pkItem->GetAttributeValue(4), pkItem->GetAttributeType(5), pkItem->GetAttributeValue(5), pkItem->GetAttributeType(6), pkItem->GetAttributeValue(6), pkItem->GetAttributeType(7), pkItem->GetAttributeValue(7), pkItem->GetAttributeType(8), pkItem->GetAttributeValue(8), pkItem->GetAttributeType(9), pkItem->GetAttributeValue(9), pkItem->GetAttributeType(10), pkItem->GetAttributeValue(10), pkItem->GetAttributeType(11), pkItem->GetAttributeValue(11), pkItem->GetAttributeType(12), pkItem->GetAttributeValue(12), pkItem->GetAttributeType(12), pkItem->GetAttributeValue(13), pkItem->GetAttributeType(14), pkItem->GetAttributeValue(14)); char szInsertQuery[QUERY_MAX_LEN]; snprintf(szInsertQuery, sizeof(szInsertQuery), "INSERT INTO %soffline_shop_item (%s) VALUES (%s)", get_table_postfix(), szColumns, szValues); std::auto_ptr<SQLMsg> pMsg(DBManager::instance().DirectQuery(szInsertQuery)); ch->ChatPacket(CHAT_TYPE_INFO, "%s ?temi ba?arıyla ekledin.", pkItem->GetName()); pkItem->RemoveFromCharacter(); LPCHARACTER npc = CHARACTER_MANAGER::instance().Find(FindMyOfflineShop(ch->GetPlayerID())); if (!npc) return; LPOFFLINESHOP pkOfflineShop = FindOfflineShop(npc->GetVID()); if (!pkOfflineShop) return; pkOfflineShop->BroadcastUpdateItem(bDisplayPos, ch->GetPlayerID()); LogManager::instance().ItemLog(ch, pkItem, "ADD ITEM OFFLINE SHOP", ""); } void COfflineShopManager::RemoveItem(LPCHARACTER ch, BYTE bPos) { if (!ch) return; if (bPos >= OFFLINE_SHOP_HOST_ITEM_MAX_NUM) { sys_log(0, "OfflineShopManager::RemoveItem - Overflow slot! [%s]", ch->GetName()); return; } LPCHARACTER npc = CHARACTER_MANAGER::instance().Find(FindMyOfflineShop(ch->GetPlayerID())); // Check npc if (!npc) { char szQuery[1024]; if (g_bOfflineShopSocketMax == 3) snprintf(szQuery, sizeof(szQuery), "SELECT pos,count,vnum,socket0,socket1,socket2,attrtype0, attrvalue0, attrtype1, attrvalue1, attrtype2, attrvalue2, attrtype3, attrvalue3, attrtype4, attrvalue4, attrtype5, attrvalue5, attrtype6, attrvalue6, applytype0, applyvalue0, applytype1, applyvalue1, applytype2, applyvalue2, applytype3, applyvalue3, applytype4, applyvalue4, applytype5, applyvalue5, applytype6, applyvalue6, applytype7, applyvalue7 FROM %soffline_shop_item WHERE owner_id = %u and pos = %d", get_table_postfix(), ch->GetPlayerID(), bPos); else if(g_bOfflineShopSocketMax == 4) snprintf(szQuery, sizeof(szQuery), "SELECT pos,count,vnum,socket0,socket1,socket2,socket3,attrtype0, attrvalue0, attrtype1, attrvalue1, attrtype2, attrvalue2, attrtype3, attrvalue3, attrtype4, attrvalue4, attrtype5, attrvalue5, attrtype6, attrvalue6, applytype0, applyvalue0, applytype1, applyvalue1, applytype2, applyvalue2, applytype3, applyvalue3, applytype4, applyvalue4, applytype5, applyvalue5, applytype6, applyvalue6, applytype7, applyvalue7 FROM %soffline_shop_item WHERE owner_id = %u and pos = %d", get_table_postfix(), ch->GetPlayerID(), bPos); else if(g_bOfflineShopSocketMax == 5) snprintf(szQuery, sizeof(szQuery), "SELECT pos,count,vnum,socket0,socket1,socket2,socket3,socket4,attrtype0, attrvalue0, attrtype1, attrvalue1, attrtype2, attrvalue2, attrtype3, attrvalue3, attrtype4, attrvalue4, attrtype5, attrvalue5, attrtype6, attrvalue6, applytype0, applyvalue0, applytype1, applyvalue1, applytype2, applyvalue2, applytype3, applyvalue3, applytype4, applyvalue4, applytype5, applyvalue5, applytype6, applyvalue6, applytype7, applyvalue7 FROM %soffline_shop_item WHERE owner_id = %u and pos = %d", get_table_postfix(), ch->GetPlayerID(), bPos); else if(g_bOfflineShopSocketMax == 6) snprintf(szQuery, sizeof(szQuery), "SELECT pos,count,vnum,socket0,socket1,socket2,socket3,socket4,socket5,attrtype0, attrvalue0, attrtype1, attrvalue1, attrtype2, attrvalue2, attrtype3, attrvalue3, attrtype4, attrvalue4, attrtype5, attrvalue5, attrtype6, attrvalue6, applytype0, applyvalue0, applytype1, applyvalue1, applytype2, applyvalue2, applytype3, applyvalue3, applytype4, applyvalue4, applytype5, applyvalue5, applytype6, applyvalue6, applytype7, applyvalue7 FROM %soffline_shop_item WHERE owner_id = %u and pos = %d", get_table_postfix(), ch->GetPlayerID(), bPos); std::auto_ptr<SQLMsg> pMsg(DBManager::instance().DirectQuery(szQuery)); if (pMsg->Get()->uiNumRows == 0) { sys_log(0, "OfflineShopManager::RemoveItem - This slot is empty! [%s]", ch->GetName()); return; } TPlayerItem item; int rows; if (!(rows = mysql_num_rows(pMsg->Get()->pSQLResult))) return; for (int i = 0; i < rows; ++i) { MYSQL_ROW row = mysql_fetch_row(pMsg->Get()->pSQLResult); int cur = 0; str_to_number(item.pos, row[cur++]); str_to_number(item.count, row[cur++]); str_to_number(item.vnum, row[cur++]); for (BYTE a = 0; a < ITEM_SOCKET_MAX_NUM; a++) str_to_number(item.alSockets[a], row[cur++]); for (int j = 0; j < ITEM_ATTRIBUTE_MAX_NUM; j++) { str_to_number(item.aAttr[j].bType, row[cur++]); str_to_number(item.aAttr[j].sValue, row[cur++]); } } LPITEM pItem = ITEM_MANAGER::instance().CreateItem(item.vnum, item.count); if (!pItem) { ch->ChatPacket(CHAT_TYPE_INFO, LC_TEXT("There is problem in the system at the moment. Please try again!")); return; } pItem->SetAttributes(item.aAttr); pItem->SetSockets(item.alSockets); int iEmptyPos; if (pItem->IsDragonSoul()) iEmptyPos = ch->GetEmptyDragonSoulInventory(pItem); else iEmptyPos = ch->GetEmptyInventory(pItem->GetSize()); if (iEmptyPos < 0) { ch->ChatPacket(CHAT_TYPE_INFO, LC_TEXT("You don't have enough space for store the item!")); return; } if (pItem->IsDragonSoul()) pItem->AddToCharacter(ch, TItemPos(DRAGON_SOUL_INVENTORY, iEmptyPos)); else pItem->AddToCharacter(ch, TItemPos(INVENTORY, iEmptyPos)); DBManager::instance().DirectQuery("DELETE FROM %soffline_shop_item WHERE owner_id = %u and pos = %d", get_table_postfix(), ch->GetPlayerID(), bPos); LogManager::instance().ItemLog(ch, pItem, "DELETE OFFLINE SHOP ITEM", ""); } else { LPOFFLINESHOP pkOfflineShop = npc->GetOfflineShop(); // Check pkOfflineShop if (!pkOfflineShop) return; std::auto_ptr<SQLMsg> pMsg(DBManager::instance().DirectQuery("SELECT pos,count,vnum,socket0,socket1,socket2,socket3, attrtype0, attrvalue0, attrtype1, attrvalue1, attrtype2, attrvalue2, attrtype3, attrvalue3, attrtype4, attrvalue4, attrtype5, attrvalue5, attrtype6, attrvalue6, applytype0, applyvalue0, applytype1, applyvalue1, applytype2, applyvalue2, applytype3, applyvalue3, applytype4, applyvalue4, applytype5, applyvalue5, applytype6, applyvalue6, applytype7, applyvalue7 FROM %soffline_shop_item WHERE owner_id = %u and pos = %d", get_table_postfix(), ch->GetPlayerID(), bPos)); if (pMsg->Get()->uiNumRows == 0) { sys_log(0, "OfflineShopManager::RemoveItem - This slot is empty! [%s]", ch->GetName()); return; } TPlayerItem item; int rows; if (!(rows = mysql_num_rows(pMsg->Get()->pSQLResult))) return; for (int i = 0; i < rows; ++i) { MYSQL_ROW row = mysql_fetch_row(pMsg->Get()->pSQLResult); int cur = 0; str_to_number(item.pos, row[cur++]); str_to_number(item.count, row[cur++]); str_to_number(item.vnum, row[cur++]); for (BYTE a = 0; a < ITEM_SOCKET_MAX_NUM; a++) str_to_number(item.alSockets[a], row[cur++]); for (int j = 0; j < ITEM_ATTRIBUTE_MAX_NUM; j++) { str_to_number(item.aAttr[j].bType, row[cur++]); str_to_number(item.aAttr[j].sValue, row[cur++]); } } LPITEM pItem = ITEM_MANAGER::instance().CreateItem(item.vnum, item.count); if (!pItem) { ch->ChatPacket(CHAT_TYPE_INFO, LC_TEXT("There is problem in the system at the moment. Please try again!")); return; } pItem->SetAttributes(item.aAttr); pItem->SetSockets(item.alSockets); int iEmptyPos; if (pItem->IsDragonSoul()) iEmptyPos = ch->GetEmptyDragonSoulInventory(pItem); else iEmptyPos = ch->GetEmptyInventory(pItem->GetSize()); if (iEmptyPos < 0) { ch->ChatPacket(CHAT_TYPE_INFO, LC_TEXT("You don't have enough space for store the item!")); return; } if (pItem->IsDragonSoul()) pItem->AddToCharacter(ch, TItemPos(DRAGON_SOUL_INVENTORY, iEmptyPos)); else pItem->AddToCharacter(ch, TItemPos(INVENTORY, iEmptyPos)); DBManager::instance().DirectQuery("DELETE FROM %soffline_shop_item WHERE owner_id = %u and pos = %d", get_table_postfix(), ch->GetPlayerID(), bPos); pkOfflineShop->BroadcastUpdateItem(bPos, ch->GetPlayerID(), true); if (LeftItemCount(ch) == 0) pkOfflineShop->Destroy(npc); LogManager::instance().ItemLog(ch, pItem, "DELETE OFFLINE SHOP ITEM", ""); } } void COfflineShopManager::ChangePrice(LPCHARACTER ch, BYTE bPos, DWORD dwPrice) { if (!ch) return; if (bPos >= OFFLINE_SHOP_HOST_ITEM_MAX_NUM) { sys_err("Offlineshop overflow slot count [%s][%d]", ch->GetName(), bPos); return; } LPOFFLINESHOP pkOfflineShop = FindOfflineShop(FindMyOfflineShop(ch->GetPlayerID())); if (pkOfflineShop) pkOfflineShop->BroadcastUpdatePrice(bPos, dwPrice); DBManager::instance().DirectQuery("UPDATE %soffline_shop_item SET price = %u WHERE owner_id = %u and pos = %d", get_table_postfix(), dwPrice, ch->GetPlayerID(), bPos); // pkOfflineShop->RemoveGuest(ch); sys_log(0, "PRET: %u | ITEM ID: %u | POZITIE: %d", dwPrice, ch->GetPlayerID(), bPos); } void COfflineShopManager::Refresh(LPCHARACTER ch) { if (!ch) return; LPCHARACTER npc = CHARACTER_MANAGER::instance().Find(FindMyOfflineShop(ch->GetPlayerID())); if (!npc) { TPacketGCShop pack; pack.header = HEADER_GC_OFFLINE_SHOP; pack.subheader = SHOP_SUBHEADER_GC_UPDATE_ITEM2; TPacketGCOfflineShopStart pack2; memset(&pack2, 0, sizeof(pack2)); pack2.owner_vid = 0; std::auto_ptr<SQLMsg> pMsg(DBManager::instance().DirectQuery("SELECT pos,count,vnum,price,socket0,socket1,socket2,socket3,attrtype0, attrvalue0, attrtype1, attrvalue1, attrtype2, attrvalue2, attrtype3, attrvalue3, attrtype4, attrvalue4, attrtype5, attrvalue5, attrtype6, attrvalue6, applytype0, applyvalue0, applytype1, applyvalue1, applytype2, applyvalue2, applytype3, applyvalue3, applytype4, applyvalue4, applytype5, applyvalue5, applytype6, applyvalue6, applytype7, applyvalue7 FROM %soffline_shop_item WHERE owner_id = %u", get_table_postfix(), ch->GetPlayerID())); MYSQL_ROW row; while (NULL != (row = mysql_fetch_row(pMsg->Get()->pSQLResult))) { BYTE bPos = 0; str_to_number(bPos, row[0]); str_to_number(pack2.items[bPos].count, row[1]); str_to_number(pack2.items[bPos].vnum, row[2]); str_to_number(pack2.items[bPos].price, row[3]); DWORD alSockets[ITEM_SOCKET_MAX_NUM]; for (int i = 0, n = 4; i < ITEM_SOCKET_MAX_NUM; ++i, n++) str_to_number(alSockets[i], row[n]); TPlayerItemAttribute aAttr[ITEM_ATTRIBUTE_MAX_NUM]; for (int i = 0, iStartType = 8, iStartValue = 9; i < ITEM_ATTRIBUTE_MAX_NUM; ++i, iStartType += 2, iStartValue += 2) { str_to_number(aAttr[i].bType, row[iStartType]); str_to_number(aAttr[i].sValue, row[iStartValue]); } thecore_memcpy(pack2.items[bPos].alSockets, alSockets, sizeof(pack2.items[bPos].alSockets)); thecore_memcpy(pack2.items[bPos].aAttr, aAttr, sizeof(pack2.items[bPos].aAttr)); } pack.size = sizeof(pack) + sizeof(pack2); if (ch->GetDesc()) { ch->GetDesc()->BufferedPacket(&pack, sizeof(TPacketGCShop)); ch->GetDesc()->Packet(&pack2, sizeof(TPacketGCOfflineShopStart)); } } else { LPOFFLINESHOP pkOfflineShop = npc->GetOfflineShop(); if (!pkOfflineShop) return; pkOfflineShop->Refresh(ch); } } void COfflineShopManager::RefreshMoney(LPCHARACTER ch) { if (!ch) return; std::auto_ptr<SQLMsg> pMsg(DBManager::instance().DirectQuery("SELECT money2 FROM player.player WHERE id = %u", ch->GetPlayerID())); TPacketGCShop p; TPacketGCOfflineShopMoney p2; p.header = HEADER_GC_OFFLINE_SHOP; p.subheader = SHOP_SUBHEADER_GC_REFRESH_MONEY; if (pMsg->Get()->uiNumRows == 0) { p2.dwMoney = 0; p.size = sizeof(p) + sizeof(p2); ch->GetDesc()->BufferedPacket(&p, sizeof(TPacketGCShop)); ch->GetDesc()->Packet(&p2, sizeof(TPacketGCOfflineShopMoney)); } else { MYSQL_ROW row = mysql_fetch_row(pMsg->Get()->pSQLResult); str_to_number(p2.dwMoney, row[0]); p.size = sizeof(p) + sizeof(p2); ch->GetDesc()->BufferedPacket(&p, sizeof(TPacketGCShop)); ch->GetDesc()->Packet(&p2, sizeof(TPacketGCOfflineShopMoney)); } } DWORD COfflineShopManager::FindMyOfflineShop(DWORD dwPID) { TOfflineShopMap::iterator it = m_Map_pkOfflineShopByNPC2.find(dwPID); if (m_Map_pkOfflineShopByNPC2.end() == it) return 0; return it->second; } void COfflineShopManager::ChangeOfflineShopTime(LPCHARACTER ch, BYTE bTime) { if (!ch) return; // Remember DWORD dwOfflineShopVID = FindMyOfflineShop(ch->GetPlayerID()); if (!dwOfflineShopVID) { ch->ChatPacket(CHAT_TYPE_INFO, LC_TEXT("You can't use this option because you don't have offline shop yet!")); return; } LPCHARACTER npc = CHARACTER_MANAGER::instance().Find(FindMyOfflineShop(ch->GetPlayerID())); if (npc) { if (test_server) SendNotice("#DEBUG - Offline Shop NPC Found!"); if (bTime == 4) { npc->StopOfflineShopUpdateEvent(); } else { int iTime = 0; switch (bTime) { case 1: iTime = 1 * 60 * 60; break; case 2: iTime = 2 * 60 * 60; break; case 3: iTime = 4 * 60 * 60; break; } std::auto_ptr<SQLMsg> pMsg(DBManager::instance().DirectQuery("UPDATE %soffline_shop_npc SET time = %d WHERE owner_id = %u", get_table_postfix(), iTime, ch->GetPlayerID())); // ch->ChatPacket(CHAT_TYPE_INFO, "Timp schimbat: %u ora(e)", iTime / 3600); sys_log(0, "TIMP: %u | PLAYER ID: %u", iTime, ch->GetPlayerID()); npc->StopOfflineShopUpdateEvent(); npc->SetOfflineShopTimer(iTime); npc->StartOfflineShopUpdateEvent(); LogManager::instance().CharLog(ch, 0, "OFFLINE SHOP", "CHANGE TIME"); } } else { TPacketGGChangeOfflineShopTime p; p.bHeader = HEADER_GG_CHANGE_OFFLINE_SHOP_TIME; p.bTime = bTime; std::auto_ptr<SQLMsg> pMsg(DBManager::instance().DirectQuery("SELECT mapIndex FROM %soffline_shop_npc WHERE owner_id = %u", get_table_postfix(), ch->GetPlayerID())); if (pMsg->Get()->uiNumRows == 0) { ch->ChatPacket(CHAT_TYPE_INFO, LC_TEXT("You can't use this option!")); return; } MYSQL_ROW row = mysql_fetch_row(pMsg->Get()->pSQLResult); str_to_number(p.lMapIndex, row[0]); p.dwOwnerPID = ch->GetPlayerID(); P2P_MANAGER::instance().Send(&p, sizeof(TPacketGGChangeOfflineShopTime)); } } void COfflineShopManager::StopShopping(LPCHARACTER ch) { LPOFFLINESHOP pkOfflineShop; if (!(pkOfflineShop = ch->GetOfflineShop())) return; pkOfflineShop->RemoveGuest(ch); sys_log(0, "OFFLINE_SHOP: END: %s", ch->GetName()); } void COfflineShopManager::Buy(LPCHARACTER ch, BYTE pos) { if (!ch->GetOfflineShop()) return; if (!ch->GetOfflineShopOwner()) return; if (DISTANCE_APPROX(ch->GetX() - ch->GetOfflineShopOwner()->GetX(), ch->GetY() - ch->GetOfflineShopOwner()->GetY()) > 1500) { ch->ChatPacket(CHAT_TYPE_INFO, LC_TEXT("상점과의 거리가 너무 멀어 물건을 살 수 없습니다.")); return; } LPOFFLINESHOP pkOfflineShop = ch->GetOfflineShop(); if (!pkOfflineShop) return; int ret = pkOfflineShop->Buy(ch, pos); // The result is not equal to SHOP_SUBHEADER_GC_OK, send the error to the character. if (SHOP_SUBHEADER_GC_OK != ret) { TPacketGCShop pack; pack.header = HEADER_GC_OFFLINE_SHOP; pack.subheader = ret; pack.size = sizeof(TPacketGCShop); if (ch->GetDesc()) ch->GetDesc()->Packet(&pack, sizeof(pack)); } } void COfflineShopManager::WithdrawMoney(LPCHARACTER ch, DWORD dwRequiredMoney) { if (!ch) return; if (dwRequiredMoney < 0) return; std::auto_ptr<SQLMsg> pMsg(DBManager::instance().DirectQuery("SELECT money2 FROM player.player WHERE id = %u", ch->GetPlayerID())); if (pMsg->Get()->uiNumRows == 0) return; DWORD dwCurrentMoney = 0; MYSQL_ROW row = mysql_fetch_row(pMsg->Get()->pSQLResult); str_to_number(dwCurrentMoney, row[0]); if (dwRequiredMoney >= dwCurrentMoney) { // if (test_server) // ch->ChatPacket(CHAT_TYPE_INFO, "dwCurrentMoney(%lu) - dwRequiredMoney(%lu)", dwCurrentMoney, dwRequiredMoney); ch->ChatPacket(CHAT_TYPE_INFO, LC_TEXT("You can't enter big number than current money!")); return; } bool isOverFlow = ch->GetGold() + dwRequiredMoney > GOLD_MAX - 1 ? true : false; if (isOverFlow) { ch->ChatPacket(CHAT_TYPE_INFO, LC_TEXT("You can't withdraw this money at the moment!")); return; } ch->PointChange(POINT_GOLD, dwRequiredMoney, false); ch->ChatPacket(CHAT_TYPE_INFO, LC_TEXT("You received %u yang"), dwRequiredMoney); DBManager::instance().DirectQuery("UPDATE player.player SET money2 = money2 - %u WHERE id = %u", dwRequiredMoney, ch->GetPlayerID()); LogManager::instance().CharLog(ch, 0, "OFFLINE SHOP", "WITHDRAW MONEY"); } BYTE COfflineShopManager::LeftItemCount(LPCHARACTER ch) { if (!ch) return -1; std::auto_ptr<SQLMsg> pMsg(DBManager::instance().DirectQuery("SELECT COUNT(*) FROM %soffline_shop_item WHERE owner_id = %u", get_table_postfix(), ch->GetPlayerID())); if (pMsg->Get()->uiNumRows == 0) return 0; MYSQL_ROW row = mysql_fetch_row(pMsg->Get()->pSQLResult); BYTE bCount = 0; str_to_number(bCount, row[0]); return bCount; }
  15. When the item is placed on the market, the bonus attr change. I work on 4 stone systems. what is the solution? help please Note : There are 4 stone systems.
  16. Hi, did u know how add a pages to the NPC shop? I can pay for help
  17. Hello dev, i have problem with code in python client, when i see some shop on map, then after teleport shop name keeps on screen like screen Sysser: 0314 20:40:08235 :: Traceback (most recent call last): 0314 20:40:08235 :: File "uiPrivateShopBuilder.py", line 163, in OnUpdate 0314 20:40:08235 :: TypeError 0314 20:40:08235 :: : 0314 20:40:08235 :: 'NoneType' object is not iterable 0314 20:40:08235 :: 0314 20:40:08252 :: Traceback (most recent call last): Python code: def OnUpdate(self): if not self.vid: return if systemSetting.IsShowSalesText(): if chr.GetInstanceType(self.vid) not in [chr.INSTANCE_TYPE_PLAYER,chr.INSTANCE_TYPE_NPC]: self.Hide() if GetShopNamesRange() == 1.000: self.Show() (x, y) = chr.GetProjectPosition(self.vid, 220) self.SetPosition(x - self.GetWidth() / 2, y - self.GetHeight() / 2) else: LIMIT_RANGE = abs(constInfo.SHOPNAMES_RANGE * GetShopNamesRange()) (to_x, to_y, to_z) = chr.GetPixelPosition(self.vid) (my_x, my_y, my_z) = player.GetMainCharacterPosition() if abs(my_x - to_x) <= LIMIT_RANGE and abs(my_y - to_y) <= LIMIT_RANGE: (x, y) = chr.GetProjectPosition(self.vid, 220) self.SetPosition(x - self.GetWidth() / 2, y - self.GetHeight() / 2) self.Show() else: self.Hide() self.SetPosition(-10000, 0) else: for key in g_privateShopAdvertisementBoardDict.keys(): if player.GetMainCharacterIndex() == key: g_privateShopAdvertisementBoardDict[key].Show() x, y = chr.GetProjectPosition(player.GetMainCharacterIndex(), 220) g_privateShopAdvertisementBoardDict[key].SetPosition(x - self.GetWidth()/2, y - self.GetHeight()/2) else: g_privateShopAdvertisementBoardDict[key].Hide() Line which should be bad is : (to_x, to_y, to_z) = chr.GetPixelPosition(self.vid) Please can somebody help me? Thank you.
  18. Hello devs, I got a problem with shop offline bank , i managed to do money appear in bank , but when i withdraw , it says , the amount of yang is too high (and i entered 1 yang) , what can i do to fix that? Any advice is accepted , thanks !
  19. Hello guys. A few try to describe what I developed. We have created a place where players can buy and sell items from each other. I worked on bootstrap because such a platform deserves to be accessed from a wide range of devices, not just on the desktop. Communication with the database is done using the PDO extension. The platform is available in 8 languages: Data related platform are stored in a SQLite database, no longer need for a new database. It included a store of objects (Item-Shop). It can add items with bonuses and can make payments with paypal for dragon coin. Attention! Site to function properly, you must login as a player, last_play table must be updated. Objects can be marketed after 10 minutes after disconnecting character. (Because dbcache's) Download: http://market.metin2cms.cf/ Download only item-shop, without market: https://market.metin2cms.cf/ishop Preview: https://market.metin2cms.cf/preview
  20. Hi! I have a problem. I can not sell items in shop. I use Test Client 40k. Another client working. Thanks, and sorry for bad english.
  21. Hi! I have a problem when i add the exploit. I have only client syserr: Traceback (most recent call last): 1216 09:17:15031 :: File "game.py", line 2260, in BINARY_OfflineShop_Appear 1216 09:17:15031 :: File "interfaceModule.py", line 1333, in AppearOfflineShop 1216 09:17:15031 :: File "uiOfflineShopBuilder.py", line 64, in __init__ 1216 09:17:15032 :: File "uiOfflineShopBuilder.py", line 76, in __MakeTextLine 1216 09:17:15032 :: NameError 1216 09:17:15032 :: : 1216 09:17:15032 :: global name 'textLine' is not defined #Sorry my fail. In the uiofflineshopbuilder.py 76 line: textLine.SetFontColor(8.0, 8.0, 8.0) dos't compatible whit the client. self.textLine.SetFontColor(8.0, 8.0, 8.0)
  22. Hello. Hi everone i just came accros a problem when i try to sell item that is more than 1000, my frind lookt at the items in shop they see that is only 232.can some help out with this problem. I change in offlineshop_config.cpp: ITEM_MAX_COUNT = 200, to ITEM_MAX_COUNT = 1000, And on navicat in offline_shop_item: `count` tinyint(3) to `count` int(3)
  23. Hello devs I believe the title says everything I want to prevent GMs to buy items from normal players' shops but I want to use the function IsGM() and not the GetGmLevel() Thanks in advance
  24. Hello devs I'm looking for the function in the safebox (python) that checks if safebox is open or not. For example this is for trade and this is for shop so I'm looking that function in safebox Thanks in advance
×
×
  • Create New...

Important Information

Terms of Use / Privacy Policy / Guidelines / We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.