新增商城奖励系统
This commit is contained in:
@@ -245,7 +245,6 @@ int Controller::hook_DisPatcher_ReturnToSelectCharacter_dispatch_sig(void* a1, C
|
||||
|
||||
void Controller::hook_importCashShopItemList(const std::string* str)
|
||||
{
|
||||
LOG("hook_importCashShopItemList :%s", str->c_str());
|
||||
if (str == NULL) return;
|
||||
if (*str == "[start end id]")
|
||||
{
|
||||
@@ -254,23 +253,37 @@ void Controller::hook_importCashShopItemList(const std::string* str)
|
||||
|
||||
CGameDataManager::Get()->set_cera_award_begin_id(item_id_begin_);
|
||||
CGameDataManager::Get()->set_cera_award_end_id(item_id_end_);
|
||||
LOG("hook_importCashShopItemList item_id_begin_ :%d item_id_end_ :%d", item_id_begin_, item_id_end_);
|
||||
}
|
||||
else if (*str == "[reward item]")
|
||||
{
|
||||
int _total = ScanInt();
|
||||
LOG("hook_importCashShopItemList _total :%d", _total);
|
||||
for (int i = 0; i < _total; i++)
|
||||
{
|
||||
int count_ = ScanInt();
|
||||
int item_id = ScanInt();
|
||||
int item_num = ScanInt();
|
||||
CGameDataManager::Get()->add_cera_awarw_item(count_, item_id, item_num);
|
||||
LOG("hook_importCashShopItemList count_ :%d item_id :%d item_num :%d", count_, item_id, item_num);
|
||||
}
|
||||
}
|
||||
else if (*str == "[start end package]")
|
||||
{
|
||||
int item_id_begin_ = ScanInt();
|
||||
int item_id_end_ = ScanInt();
|
||||
|
||||
|
||||
CGameDataManager::Get()->set_cera_award_package_begin_id(item_id_begin_);
|
||||
CGameDataManager::Get()->set_cera_award_package_end_id(item_id_end_);
|
||||
}
|
||||
else if (*str == "[package item]")
|
||||
{
|
||||
int _total = ScanInt();
|
||||
for (int i = 0; i < _total; i++)
|
||||
{
|
||||
int count_ = ScanInt();
|
||||
int item_id = ScanInt();
|
||||
int item_num = ScanInt();
|
||||
CGameDataManager::Get()->add_cera_award_package_item(count_, item_id, item_num);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -334,6 +347,68 @@ void Controller::hook_ProcessIPG_ResultOutput(CUser* user, int Goods_No, int ite
|
||||
pbuf->put_int(BonusItem.item_id);
|
||||
pbuf->put_int(BonusItem.item_num);
|
||||
|
||||
std::vector <unsigned char> code;
|
||||
for (int i = 0; i < 0x30; i++)
|
||||
{
|
||||
code.push_back(0x90);
|
||||
}
|
||||
//0817964F 0817967F
|
||||
CMem::WriteBytes((void*)0x0817964F, code.data(), code.size());
|
||||
return;
|
||||
}
|
||||
}
|
||||
else if (Goods_No >= CGameDataManager::Get()->get_cera_award_package_begin_id() && Goods_No <= CGameDataManager::Get()->get_cera_award_package_end_id())
|
||||
{
|
||||
int cur_purchase_count = 1;
|
||||
AWARD_ITEM BonusItem;
|
||||
LOG("Size:%d", CGameDataManager::Get()->get_cera_award_package_item_map()->Size());
|
||||
if (CGameDataManager::Get()->get_cera_award_package_item_map()->Find(cur_purchase_count, &BonusItem))
|
||||
{
|
||||
if (user->getCurCharacR())
|
||||
{
|
||||
if (BonusItem.item_id == 1)
|
||||
{
|
||||
WongWork::CCeraShop::G_CCeraShop()->_processCoin(user, BonusItem.item_num, 0);
|
||||
}
|
||||
else
|
||||
{
|
||||
auto item = CDataManager::G_CDataManager()->find_item(BonusItem.item_id);
|
||||
if (item)
|
||||
{
|
||||
//if (item->is_stackable()
|
||||
// && ((*(int(**)(CItem*))(*(_DWORD*)item + 12))(item) == 16 // GetItemType
|
||||
// || (*(int(**)(CItem*))(*(_DWORD*)item + 12))(item) == 34)) // GetItemType
|
||||
{
|
||||
int inserted = -1;
|
||||
Inven_Item v60 = {};
|
||||
*(_DWORD*)((char*)&v60 + 2) = BonusItem.item_id;
|
||||
*(_DWORD*)((char*)&v60 + 7) = BonusItem.item_num;
|
||||
|
||||
(*(void(**)(CItem*, Inven_Item*))(*(_DWORD*)item + 8))(item, &v60);
|
||||
|
||||
auto CurCharacInvenW = user->getCurCharacInvenW();
|
||||
|
||||
inserted = CurCharacInvenW->insertItemIntoInventory(v60, 15, 1, 0);
|
||||
if (inserted == -1)
|
||||
{
|
||||
auto CurCharacNo = user->getCurCharacNo();
|
||||
|
||||
((WongWork::CMailBoxHelper*)(user))->ReqDBSendNewMailCashShop(&v60, 0, CurCharacNo, 1, 0, 0);
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
user->SendUpdateItemList(1, 0, inserted);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
pbuf->put_int(BonusItem.item_id);
|
||||
pbuf->put_int(BonusItem.item_num);
|
||||
|
||||
std::vector <unsigned char> code;
|
||||
for (int i = 0; i < 0x30; i++)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user