Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- common/service.h:
- #define ENABLE_BUY_WITH_ITEM
- common/tables.h:
- // Ara:
- typedef struct SShopItemTable
- // İçine ekle:
- #ifdef ENABLE_BUY_WITH_ITEM
- DWORD witemVnum;
- #endif
- game/packet.h:
- // Ara:
- SHOP_SUBHEADER_GC_NOT_ENOUGH_MONEY
- // Altına ekle:
- #ifdef ENABLE_BUY_WITH_ITEM
- SHOP_SUBHEADER_GC_NOT_ENOUGH_ITEM,
- #endif
- // Ara:
- struct packet_shop_item
- // İçine ekle:
- #ifdef ENABLE_BUY_WITH_ITEM
- DWORD witemVnum;
- #endif
- game/shop.cpp:
- // void CShop::SetShopItems(TShopItemTable * pTable, BYTE bItemCount) Fonksiyonun içinde ara:
- item.price = pTable->price; // yada
- item.count = pTable->count; // hangisi varsa
- // Altına ekle:
- #ifdef ENABLE_BUY_WITH_ITEM
- item.witemVnum = pTable->witemVnum;
- #endif
- // int CShop::Buy( fonksiyonunun içinde ara:
- DWORD dwPrice = r_item.price;
- // Altına ekle:
- #ifdef ENABLE_BUY_WITH_ITEM
- DWORD dwWItemVnum = r_item.witemVnum;
- #endif
- // Arat:
- if (ch->GetGold() < (int) dwPrice)
- {
- sys_log(1, "Shop::Buy : Not enough money : %s has %d, price %d", ch->GetName(), ch->GetGold(), dwPrice);
- return SHOP_SUBHEADER_GC_NOT_ENOUGH_MONEY;
- }
- // Değiştir:
- #ifdef ENABLE_BUY_WITH_ITEM
- if (dwWItemVnum > 0)
- if (ch->CountSpecifyItem(dwWItemVnum) < (int)dwPrice)
- return SHOP_SUBHEADER_GC_NOT_ENOUGH_ITEM;
- else if (ch->GetGold() < (int) dwPrice)
- #else
- if (ch->GetGold() < (int) dwPrice)
- #endif
- // Arat:
- ch->PointChange(POINT_GOLD, -dwPrice, false);
- // Değiştir:
- #ifdef ENABLE_BUY_WITH_ITEM
- if (dwWItemVnum > 0)
- ch->RemoveSpecifyItem(dwWItemVnum, dwPrice);
- else
- ch->PointChange(POINT_GOLD, -dwPrice, false);
- #else
- ch->PointChange(POINT_GOLD, -dwPrice, false);
- #endif
- // Arat:
- pack2.items[i].price = item.price;
- // Altına ekle:
- #ifdef ENABLE_BUY_WITH_ITEM
- pack2.items[i].witemVnum = item.witemVnum;
- #endif
- // Arat:
- else if (!m_pkPC && !IsPCShop())
- // İçine ekle:
- #ifdef ENABLE_BUY_WITH_ITEM
- pack2.item.witemVnum = m_itemVector[pos].witemVnum;
- #endif
- game/shop.h:
- // Arat:
- shop_item()
- // Üstüne ekle:
- #ifdef ENABLE_BUY_WITH_ITEM
- DWORD witemVnum;
- #endif
- // Arat:
- pkItem = NULL;
- // Üstüne ekle:
- #ifdef ENABLE_BUY_WITH_ITEM
- witemVnum = 0;
- #endif
- db/ClientManagerBoot.cpp:
- // Arat:
- "shop_item.count "
- // Altına ekle:
- #ifdef ENABLE_BUY_WITH_ITEM
- ",shop_item.witemVnum "
- #endif
- // Arat:
- str_to_number(pItem->count, data[col++]);
- // Altına ekle:
- #ifdef ENABLE_BUY_WITH_ITEM
- str_to_number(pItem->witemVnum, data[col++]);
- #endif
- Client Source:
- Locale_inc.h:
- #define ENABLE_BUY_WITH_ITEM
- GameType.h:
- // Arat:
- typedef struct packet_shop_item
- // İçine ekle:
- #ifdef ENABLE_BUY_WITH_ITEM
- DWORD witemVnum;
- #endif
- PythonApplicationModule.cpp:
- #ifdef ENABLE_BUY_WITH_ITEM
- PyModule_AddIntConstant(poModule, "ENABLE_BUY_WITH_ITEM", 1);
- #else
- PyModule_AddIntConstant(poModule, "ENABLE_BUY_WITH_ITEM", 0);
- #endif
- PythonNetworkStreamPhaseGame.cpp:
- // Arat:
- case SHOP_SUBHEADER_GC_NOT_ENOUGH_MONEY:
- PyCallClassMemberFunc(m_apoPhaseWnd[PHASE_WINDOW_GAME], "OnShopError", Py_BuildValue("(s)", "NOT_ENOUGH_MONEY"));
- break;
- // Altına ekle:
- #ifdef ENABLE_BUY_WITH_ITEM
- case SHOP_SUBHEADER_GC_NOT_ENOUGH_ITEM:
- PyCallClassMemberFunc(m_apoPhaseWnd[PHASE_WINDOW_GAME], "OnShopError", Py_BuildValue("(s)", "NOT_ENOUGH_ITEM"));
- break;
- #endif
- PythonShop.cpp:
- // Arat:
- PyObject * shopGetItemMetinSocket(PyObject * poSelf, PyObject * poArgs)
- // Altına ekle:
- #ifdef ENABLE_BUY_WITH_ITEM
- PyObject * shopGetBuyWithItem(PyObject * poSelf, PyObject * poArgs)
- {
- int nPos;
- if (!PyTuple_GetInteger(poArgs, 0, &nPos))
- return Py_BuildException();
- const TShopItemData * c_pItemData;
- if (CPythonShop::Instance().GetItemData(nPos, &c_pItemData))
- return Py_BuildValue("i", c_pItemData->witemVnum);
- return Py_BuildValue("i", 0);
- }
- #endif
- // Arat:
- { "GetItemMetinSocket", shopGetItemMetinSocket, METH_VARARGS },
- // Altına ekle:
- #ifdef ENABLE_BUY_WITH_ITEM
- { "GetBuyWithItem", shopGetBuyWithItem, METH_VARARGS },
- #endif
- Packet.h:
- // Arat:
- typedef struct SShopItemTable
- // İçine ekle:
- #ifdef ENABLE_BUY_WITH_ITEM
- DWORD witemVnum;
- #endif
- // Arat:
- SHOP_SUBHEADER_GC_NOT_ENOUGH_MONEY,
- // Altına ekle:
- #ifdef ENABLE_BUY_WITH_ITEM
- SHOP_SUBHEADER_GC_NOT_ENOUGH_ITEM,
- #endif
- Python:
- root/localeinfo.py:
- # Arat:
- SHOP_ERROR_DICT = {
- # Altına veya üstüne ekle:
- if app.ENABLE_BUY_WITH_ITEM:
- SHOP_ERROR_DICT.update({
- "NOT_ENOUGH_ITEM" : SHOP_NOT_ENOUGH_ITEM,
- }
- )
- # Arat:
- def NumberToMoneyString(n):
- # Altına ekle:
- if app.ENABLE_BUY_WITH_ITEM:
- def NumberToWithItemString(n,c) :
- if n <= 0 :
- return "0 %s" % (c)
- return "%s adet | %s" % ('.'.join([ i-3<0 and str(n)[:i] or str(n)[i-3:i] for i in range(len(str(n))%3, len(str(n))+1, 3) if i ]), c)
- root/uishop.py:
- # def AskBuyItem(self, slotPos): fonksiyonu içinde ara:
- itemBuyQuestionDialog.SetText(localeInfo.DO_YOU_BUY_ITEM(itemName, itemCount, localeInfo.NumberToMoneyString(itemPrice)))
- # Değiştir:
- if app.ENABLE_BUY_WITH_ITEM:
- buyItemVnum = shop.GetBuyWithItem(slotPos)
- if buyItemVnum != 0:
- item.SelectItem(buyItemVnum)
- istenenItemAd = item.GetItemName()
- itemBuyQuestionDialog.SetText(localeInfo.DO_YOU_BUY_ITEM(itemName, itemCount, localeInfo.NumberToWithItemString(itemPrice, istenenItemAd)))
- else:
- itemBuyQuestionDialog.SetText(localeInfo.DO_YOU_BUY_ITEM(itemName, itemCount, localeInfo.NumberToMoneyString(itemPrice)))
- else:
- itemBuyQuestionDialog.SetText(localeInfo.DO_YOU_BUY_ITEM(itemName, itemCount, localeInfo.NumberToMoneyString(itemPrice)))
- root/uitooltip.py:
- # def SetShopItem veya shopEx kullananlar için SetShopExItem fonksiyonu içinde ara:
- else:
- self.AppendPrice(price)
- # Değiştir:
- elif app.ENABLE_BUY_WITH_ITEM:
- buyItemVnum = shop.GetBuyWithItem(slotIndex)
- if buyItemVnum != 0:
- item.SelectItem(buyItemVnum)
- istenenItemAd = item.GetItemName()
- istenenItemVnum = item.GetVnum()
- self.AppendPrice_WithItem(price, istenenItemVnum, istenenItemAd)
- else:
- self.AppendPrice(price)
- else:
- self.AppendPrice(price)
- # Müsait bir yere ekle:
- if app.ENABLE_BUY_WITH_ITEM:
- def AppendTextLine_WithItem(self, text, image, color = FONT_COLOR):
- ayraC = text.split("|")
- resimdenOnce, resimdenSonra = (ayraC[0], ayraC[1])
- textLine = ui.TextLine()
- textLine.SetParent(self)
- textLine.SetFontName(self.defFontName)
- textLine.SetPackedFontColor(color)
- textLine.SetText(resimdenOnce)
- textLine.SetOutline()
- textLine.SetFeather(FALSE)
- itemIcon = ui.ImageBox()
- itemIcon.SetParent(self)
- itemIcon.LoadImage(image)
- textLine2 = ui.TextLine()
- textLine2.SetParent(self)
- textLine2.SetFontName(self.defFontName)
- textLine2.SetPackedFontColor(color)
- textLine2.SetText(resimdenSonra)
- textLine2.SetOutline()
- textLine2.SetFeather(FALSE)
- textLine.Show()
- itemIcon.Show()
- textLine2.Show()
- baslangicX_a = self.GetWidth() / 2 - 75
- baslangicX_b = textLine.GetTextSize()[0]
- baslangicX_c = itemIcon.GetWidth()
- textLine.SetPosition(baslangicX_a, self.toolTipHeight+6)
- itemIcon.SetPosition(baslangicX_a + baslangicX_b, self.toolTipHeight)
- textLine2.SetPosition(baslangicX_a + baslangicX_b + baslangicX_c, self.toolTipHeight+6)
- self.childrenList.append(textLine)
- self.childrenList.append(itemIcon)
- self.childrenList.append(textLine2)
- self.toolTipHeight += itemIcon.GetHeight()
- self.ResizeToolTip()
- return textLine
- return itemIcon
- return textLine2
- if app.ENABLE_BUY_WITH_ITEM:
- def AppendPrice_WithItem(self, price, itemVnum, itemName):
- self.AppendSpace(5)
- self.AppendTextLine("[Nesne ile satın alınabilir]" , self.SHOP_ITEM_COLOR)
- item.SelectItem(itemVnum)
- eklenecekIcon = item.GetIconImageFileName()
- self.AppendTextLine_WithItem((localeInfo.NumberToWithItemString(price, itemName)), eklenecekIcon, self.GetPriceColor(price))
- locale/locale_game.txt:
- SHOP_NOT_ENOUGH_ITEM Yeterli Nesne'ye sahip değilsin.
- #### Pentru a funcționa se face în navicat o coloană nouă în db-ul "player" la shop_item cu numele "witemVnum"
- Alte info: Prețul itemului = count eg. dacă ai 1 yang pus ca preț în item_proto la item și pui la witemvnum x5, yang ul va fi x5
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement