Jump to content

Recommended Posts

04/19/2022

 

+ Fixed addresses for GAME_13X_1 (thanks to @small666 for finding the bug);

  • Like 1
  • Thanks 1

Share this post


Link to post
Share on other sites
On 6/14/2022 at 5:52 AM, dragontechi said:

How can I prevent him from giving the daily prize to all the characters on the same account?

 

 

 

Make the items bounded to character. Not tradable,sellable,dropable, bankable or whatever. This should be a pretty good approach to this?

Share this post


Link to post
Share on other sites
7 hours ago, Unknown said:

Make the items bounded to character. Not tradable,sellable,dropable, bankable or whatever. This should be a pretty good approach to this?

What happens is that the items that I want to give, I would like you to be able to trade them between your characters, but they are only charged once per account.

Share this post


Link to post
Share on other sites

@dragontechi replied to you about the bug in that topic.

  • Like 1

Share this post


Link to post
Share on other sites
On 12/14/2021 at 7:42 AM, V3ct0r said:

[Mod] System of daily rewards for entering the game

 

screenshot_1_en.png

 

This mod implements a system of daily rewards for entering the game. Players need to enter the game every day in order to receive the next reward - with each new day the reward becomes more valuable. The chain resets and starts over from the first day if a player misses a day. The chain is also reset every week.

 

The chain of rewards is configured by the administrator in a special lua function and is generated for a week forward, after which it is saved in the server database.

 

screenshot_2_en.gif

 

 

Requirements

 

Installed mod loading system for server and client (PKOdev.NET mod loader).

 

 

Modification information

 

Name: pkodev.mod.reward;

Version: 1.0;

Author: V3ct0r;

Type: for client and server (Game.exe and GameServer.exe);

Supported executable .exe files: GAME_13X_0, GAME_13X_1, GAME_13X_2, GAME_13X_3, GAME_13X_4, GAME_13X_5, GAMESERVER_136 and GAMESERVER_138.

 

 

Installation

 

Server:

1) In the "GameServer\mods" directory of your server, create a "pkodev.mod.reward" folder;

2) Place into the folder the mod DLL file "pkodev.mod.reward.server.13<x>.dll" for your version of GameServer.exe;

3) In the functions.lua file ("GameServer\resource\script\calculate\") write the following script:


-- Daily reward system (pkodev.mod.reward)
-- Transfer the list of items to the system
function GetRewardArrayAdapter(role)
	
	-- Get a list of items for daily reward
	local arr = GetRewardArray(role)
	
	-- Transfer the list to the system
	return arr[1].id, arr[1].number, arr[2].id, arr[2].number, arr[3].id, arr[3].number, arr[4].id, arr[4].number, arr[5].id, arr[5].number, arr[6].id, arr[6].number, arr[7].id, arr[7].number

end

-- Daily reward system (pkodev.mod.reward)
-- Get a list of items for daily reward
function GetRewardArray(role)

	-- Select an item depending on character race
	local hairstyle_book = function(role)
		
		-- List of items
		-- ID: 931 Lance Trendy Hairstyle Book
		-- ID: 932 Carsise Trendy Hairstyle Book
		-- ID: 933 Phyllis Trendy Hairstyle Book
		-- ID: 934 Ami Trendy Hairstyle Book
		local items = {931, 932, 933, 934}
		
		-- Get character type ID
		local id = GetChaTypeID(role)
		
		-- Return item id depending on the type ID
		return items[id] or 0
		
	end

	-- Make a list of items for daily reward
	local items = {
		
		-- Day 1 (Short Sword x 1 or Long Sword x 1 or Fencing Sword x 1)
		{id = math.random(1, 3), number = 1},
		
		-- Day 2 (Apple x 99 or Bread x 99 or Cake x 99)
		{id = math.random(1847, 1849), number = 99},
		
		-- Day 3 (Fairy Coin x 50)
		{id = 855, number = 50},
		
		-- Day 4 (Random fairy ID 183 ... 193 x 1)
		{id = math.random(183, 193), number = 1},
		
		-- Day 5 (Hairstyle Book x 1)
		{id = hairstyle_book(role), number = 1},
		
		-- Day 6 (Fairy Ration x 10)
		{id = 227, number = 10},
		
		-- Day 7 (Refining Gem x 1)
		{id = 885, number = 1}
		
	}
	
	-- We have to return an array of items to caller function
	return items

end

4) In MSSQL Management Studio, execute the SQL query:


USE GameDB
ALTER TABLE character ADD reward VARCHAR(128) NOT NULL DEFAULT '0' WITH VALUES

 

Client:

1) In the "mods" directory of your client create a "pkodev.mod.reward" folder;

2) Place into the folder the mod DLL file "pkodev.mod.reward.client.13x_<x>.dll" for your version of Game.exe;

3) Place the daily reward form texture files "main.png" and "buttons.tga" into the "texture\mods\pkodev.mod.reward\" directory of your client;

4) Add the code for the daily reward form into the "main.clu" script file ("scripts\lua\forms\"):


----------------------------------------------------------------------------------------------------
-- Daily login reward form
----------------------------------------------------------------------------------------------------

-- The form
frmReward = UI_CreateForm( "frmReward", FALSE, 366, 158, 150, 200, TRUE, FALSE )
UI_SetFormStyle( frmReward , 0 )
UI_AddFormToTemplete( frmReward, FORM_MAIN )
UI_FormSetIsEscClose( frmReward, FALSE )
UI_SetIsDrag( frmReward, TRUE )

-- Form background
frmRewardImg = UI_CreateCompent( frmReward, IMAGE_TYPE, "frmRewardImg", 366, 158, 0, 0 )
UI_LoadImage( frmRewardImg, "texture/mods/pkodev.mod.reward/main.png", NORMAL, 366, 158, 0, 0 )

-- Form title
labTitle = UI_CreateCompent( frmReward, LABELEX_TYPE, "labTitle", 400, 150, 10, 7 )
UI_SetCaption( labTitle, "Daily reward!")
UI_SetTextColor( labTitle, COLOR_WHITE )

-- Reward button
btnGetReward = UI_CreateCompent( frmReward, BUTTON_TYPE, "btnGetReward", 67, 24, 150, 120 )
UI_LoadButtonImage( btnGetReward, "texture/mods/pkodev.mod.reward/main.png", 67, 24, 0, 158, TRUE )

-- Close button
btnClose = UI_CreateCompent( frmReward, BUTTON_TYPE, "btnClose", 21, 21, 343, 2 )
UI_LoadButtonImage( btnClose, "texture/mods/pkodev.mod.reward/buttons.tga", 21, 21, 270, 0, TRUE )
UI_SetButtonModalResult( btnClose, BUTTON_CLOSE )

-- Item slots
cmdItemSlot0 = UI_CreateCompent( frmReward, COMMAND_ONE_TYPE, "cmdItemSlot0", 32, 32, 20,  73 )
UI_SetIsDrag( cmdItemSlot0, FALSE )
cmdItemSlot1 = UI_CreateCompent( frmReward, COMMAND_ONE_TYPE, "cmdItemSlot1", 32, 32, 69,  73 )
UI_SetIsDrag( cmdItemSlot1, FALSE )
cmdItemSlot2 = UI_CreateCompent( frmReward, COMMAND_ONE_TYPE, "cmdItemSlot2", 32, 32, 118, 73 )
UI_SetIsDrag( cmdItemSlot2, FALSE )
cmdItemSlot3 = UI_CreateCompent( frmReward, COMMAND_ONE_TYPE, "cmdItemSlot3", 32, 32, 167, 73 )
UI_SetIsDrag( cmdItemSlot3, FALSE )
cmdItemSlot4 = UI_CreateCompent( frmReward, COMMAND_ONE_TYPE, "cmdItemSlot4", 32, 32, 216, 73 )
UI_SetIsDrag( cmdItemSlot4, FALSE )
cmdItemSlot5 = UI_CreateCompent( frmReward, COMMAND_ONE_TYPE, "cmdItemSlot5", 32, 32, 265, 73 )
UI_SetIsDrag( cmdItemSlot5, FALSE )
cmdItemSlot6 = UI_CreateCompent( frmReward, COMMAND_ONE_TYPE, "cmdItemSlot6", 32, 32, 314, 73 )
UI_SetIsDrag( cmdItemSlot6, FALSE )

----------------------------------------------------------------------------------------------------

 

 

Mod customization

 

1) In the GetRewardArray(role) function, write the code that will generate the chain of rewards for the character role for the next seven days. The function must return a table of 7 elements with fields id and number, where id is the ID of the item that is issued as a reward, and number is the number of items in the reward. Each element corresponds to its own day (1st element is the first day, 2nd element is the second day, and so on). Example:


function GetRewardArray(role)

	local items = {
    
		-- Day 1: Apple x 20
		{id = 1847, number = 20},
        
		-- Day 2: Bread x 40
		{id = 1848, number = 40},
        
		-- Day 3: Cake x 60
		{id = 1849, number = 60},
        
		-- Day 4: Fairy coin x 55
		{id = 855, number = 55},
        
		-- Day 5: Fairy ration x 15
		{id = 227, number = 15},
        
		-- Day 6: Bread x 99
		{id = 1848, number = 99},
        
		-- Day 7: Cake x 99
		{id = 1849, number = 99}
        
	}
	
	return items

end

Item IDs and their number can be generated randomly or depending on the character's race, profession, etc

 

2) By default, the reward period is 24 hours. You can change this value in the mod server-side source code (pkodev.mod.reward.server project, structure.h file), then compile the project:


// Reward interval in seconds
static const unsigned int interval{ 24 * 60 * 60 }; // 24 hours

3) No client side configuration required.

 

 

Old style GUI (Thanks to @Masuka00!)

masuka_style_gif.gif

 

main.clu:


-- Close button
btnClose = UI_CreateCompent( frmReward, BUTTON_TYPE, "btnClose", 14, 14, 342, 4 )
UI_LoadButtonImage( btnClose, "texture/mods/pkodev.mod.reward/main.png", 14, 14, 271, 174, TRUE )
UI_SetButtonModalResult( btnClose, BUTTON_CLOSE )

 

Download

 

 

Download

 

1) Binary release (.dll);

2) The source code of the mod for Visual Studio 2019 Community (C++).

 

 

If you encounter any problem, bug or have any questions, then feel free to write in this thread.

 

I have a problem and it is that every time I enter the map it gives me the reward, but if I go out and come back and enter it gives me the next day's reward again. Any way to fix this?spacer.pngspacer.png

Share this post


Link to post
Share on other sites
19 hours ago, eatsangels said:

 

I have a problem and it is that every time I enter the map it gives me the reward, but if I go out and come back and enter it gives me the next day's reward again. Any way to fix this?spacer.pngspacer.png

Did you make any kind of modification to the mod? and what version of client are you using

Share this post


Link to post
Share on other sites
6 hours ago, dragontechi said:

Did you make any kind of modification to the mod? and what version of client are you using

I am using the client version 13x ID 3 and did not make any changes.

Share this post


Link to post
Share on other sites
9 hours ago, eatsangels said:

I am using the client version 13x ID 3 and did not make any changes.

I could give you free support as long as you agree that everything that happens is recorded and uploaded to the forum in case someone has the same problem and can find the solution, serve as a guide

Share this post


Link to post
Share on other sites
10 hours ago, dragontechi said:

I could give you free support as long as you agree that everything that happens is recorded and uploaded to the forum in case someone has the same problem and can find the solution, serve as a guide

Of course, brother. this is my discord EatsAngels #8052

Share this post


Link to post
Share on other sites

Good day comunity,

 

Could someone solve the issue of when you do switch character, do you think that a whole day has passed?

I have not made any changes in the game.exe


xbx3.png

Share this post


Link to post
Share on other sites

Hello @Ximboliex,

 

I don't understand the question. You can receive a reward for a specific character once every 24 hours. This is a character-specific limit, not an account-wide limit. So you can receive 3 rewards once every 24 hours.

 


Share this post


Link to post
Share on other sites
4 hours ago, V3ct0r said:

Hello @Ximboliex,

 

I don't understand the question. You can receive a reward for a specific character once every 24 hours. This is a character-specific limit, not an account-wide limit. So you can receive 3 rewards once every 24 hours.

 

Ok, 

Every time the player disconnects and connects or makes a switch character and re-enters the game, he receives the login prize regardless of 24 hours.


xbx3.png

Share this post


Link to post
Share on other sites
On 5/1/2023 at 6:28 PM, Ximboliex said:

Ok, 

Every time the player disconnects and connects or makes a switch character and re-enters the game, he receives the login prize regardless of 24 hours.

Did you build the modification's .dll from source codes or take the existing one from GitHub?


Share this post


Link to post
Share on other sites
On 5/2/2023 at 1:18 PM, V3ct0r said:

Did you build the modification's .dll from source codes or take the existing one from GitHub?

i dont touch it, just download from GitHub


xbx3.png

Share this post


Link to post
Share on other sites

Share this post


Link to post
Share on other sites
23 hours ago, Ximboliex said:

now work, thanks so much!

You are welcome!

 

Updated the release on GitHub.


Share this post


Link to post
Share on other sites

there is bug with the client.  after you log and get the reward.  double click on pots, chest. etc doesnt work anymore. you need restart client

Share this post


Link to post
Share on other sites
On 12/20/2023 at 9:42 PM, Andy said:

there is bug with the client.  after you log and get the reward.  double click on pots, chest. etc doesnt work anymore. you need restart client

Hello @Andy,

 

Yes, there is the problem in the pkodev.mod.reward.client\dllmain.cpp file.

 

Change

// bool CCommandObj::IsAllowUse()
bool __cdecl IsAllowUse()
{
    return false;
}

to

// bool CCommandObj::IsAllowUse()
bool __cdecl IsAllowUse()
{
    return true;
}

and rebuild the mod using Visual Studio version 2019 or newer.

  • Like 1
  • Thanks 1

Share this post


Link to post
Share on other sites
On 12/22/2023 at 12:54 AM, V3ct0r said:

Hello @Andy,

 

Yes, there is the problem in the pkodev.mod.reward.client\dllmain.cpp file.

 

Change


// bool CCommandObj::IsAllowUse()
bool __cdecl IsAllowUse()
{
    return false;
}

to


// bool CCommandObj::IsAllowUse()
bool __cdecl IsAllowUse()
{
    return true;
}

and rebuild the mod using Visual Studio version 2019 or newer.

 

How ican compile ? you can do it for me ?

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.


×
×
  • Create New...