Jump to content

Search the Community

Showing results for tags 'system'.



More search options

  • Search By Tags

    Type tags separated by commas.
  • Search By Author

Content Type


Forums

  • Russian section
    • Новости и объявления
    • Пиратия: Документация
    • Пиратия: Релизы
    • Пиратия: Разработка
    • Пиратия: Web
    • Пиратия: Помощь
    • Совместные проекты / набор команды
    • Доска объявлений
    • Программирование
    • Оффтопик
    • Корзина
  • English Section
    • News & Announcements
    • Guides
    • Releases
    • Development
    • Web
    • Questions & Help
    • Shared Projects / Team search
    • Paid services & Requests
    • Programming
    • Offtopic
    • Recycle bin
  • Servers
    • Russian servers
    • English servers

Find results in...

Find results that contain...


Date Created

  • Start

    End


Last Updated

  • Start

    End


Filter by number of...

Joined

  • Start

    End


Group


Found 8 results

  1. Mod loading system for server and client (PKOdev.NET mod loader) The Problem Many developers and administrators of Tales of Pirates servers in our community know that the functionality of the client and server can be changed by mods (addons, plugins, patches). Some examples of mods: 1) The fix of SQL Injections in AccountServer.exe and GroupServer.exe; 2) Increasing the limits for .txt / .bin files (ItemInfo, CharacterInfo, SkillInfo, etc.); 3) Local chat message handling using the lua function HandleChat(); 4) Character transformation using the lua function TransformCha(); 5) Character effects panel; 6) Displaying the levels of HP and SP under characters and monsters. Thus, with the help of mods, you can fix critical bugs and vulnerabilities, change settings, add new functionality and features. Initially, the appearance of mods was caused by the lack of open access to the source codes of the client and the server: the developers had no choice but to edit executable .exe files, developing and applying reverse engineering skills. After the publication of the source codes, the popularity of mods still remains at a high level. This is due to a few reasons: 1) Low quality of the received source codes, lack of experience in their use. To use them, the administrator needs to have an extensive knowledge of the C++ programming language, understand the client-server architecture, and understand how the server and the client work. In addition, the source codes require a long study and research for bugs and vulnerabilities, including the testing process; 2) The existing official builds of the server and client fully satisfy the requirements of most administrators and players, in addition, their performance and reliability have been confirmed by years of use. Many programs, scripts and mods were written for them, which may be incompatible with the server and client executable files compiled from the source codes; 3) The source code researching allows you to better understand the structure of the server and client executables (GameServer.exe, Game.exe). The knowledge gained makes it possible to create mods of increased complexity. When implementing their projects, administrators and developers can go in two ways: use the old, official builds of the server and client, and change their functionality using mods, or go towards the development of source codes. As it should already be clear, this topic supports the first way. At the moment, mod development is associated with some problems: 1) Our community lacks a clear standard and culture for writing mods. Someone injects the code directly into the executable file ("patching"), others prefer to write DLL. Some mods can conflict with each other, which leads to errors and subtle bugs; 2) Installing mods involves certain difficulties: for example, how to transfer a mod from one GameServer.exe to another one? Each time you need to do editing (patching) .exe file, and for this you need to have special knowledge and skills. If the mods are made in the form of DLL libraries, then each mod must be manually added into the import table of the executable file. All this is inconvenient, time-consuming and creates the possibility of errors and bugs during the installation process; 3) There are many versions of GameServer.exe and Game.exe (the rest of the server .exe's are not taken into account), which have a different binary structure. In other words, the developed mod for GameServer.exe version 1.36 will not work with GameServer.exe version 1.38 - you need to develop the mod for a specific .exe file. As a result, there is confusion about the versions of the executable files. A shining example is the addresses of the limits for .txt/.bin tables, I think many have noticed that they are different for different .exe. Based on the above, it was decided to create a system that would solve the current state of affairs in regards to mods and simplify their usage. The Mod Loader The mod loader performs several tasks: 1) Determining the type and version of the executable file (.exe) to be modified; 2) Searching for mods, determining their version, attaching to the process of the executable file; 3) Unification of the process of creating, installing and uninstalling mods. It is a DLL library that attaches one-time to the executable file of the server or client. Mods are also DLL libraries that are placed in a specific directory and are automatically launched by the loader when the server or client executable file starts. Before running the executable file, control is transferred to the loader. The loader determines the type and version of the .exe file to which it is attached and starts the process of searching for DLL libraries in the "mods" directory from the server or client root folder. The DLLs found are dynamically attached to the server or client process after which the loader requests the library information regarding the mod name, type, version of the executable target file, name and the author of the mod. If the type and version of the .exe file with attached loader matches the type and version of the .exe file obtained from the mod's library, then the loader gives the mod a command to start. Furthermore, changes to the code of the process of the executable file, thereby carrying out the modification. Before terminating the server or client process, control is again gained to the loader, which in turn detaches all mods from the process. The current version of the mod loader can work with the official 1.3x versions of GameServer.exe (server) and Game.exe (client). The type of executable file (GameServer.exe or Game.exe) and its version is determined by the build timestamp (linker timestamp), which is written in the COFF header of each executable. Supported GameServer.exe and Game.exe ---------------------+----+----------------+-------------- Name | ID | Designation | Time stamp ---------------------+----+----------------+-------------- GameServer.exe 1.36 | 1 | GAMESERVER_136 | 1204708785 ---------------------+----+----------------+-------------- GameServer.exe 1.38 | 2 | GAMESERVER_138 | 1204708785 ---------------------+----+----------------+-------------- Game.exe | 3 | GAME_13X_0 | 1222073761 ---------------------+----+----------------+-------------- Game.exe | 4 | GAME_13X_1 | 1243412597 ---------------------+----+----------------+-------------- Game.exe | 5 | GAME_13X_2 | 1252912474 ---------------------+----+----------------+-------------- Game.exe | 6 | GAME_13X_3 | 1244511158 ---------------------+----+----------------+-------------- Game.exe | 7 | GAME_13X_4 | 1585009030 ---------------------+----+----------------+-------------- Game.exe | 8 | GAME_13X_5 | 1207214236 ---------------------+----+----------------+-------------- GateServer.exe 1.38 | 101| GATESERVER_138 | 1224838480 ---------------------+----+----------------+-------------- Installing the Mod Loader 1) In the root directory of the executable file, create a folder called "mods" *. This folder will store DLL libraries of mods; 2) Open the executable file in CFF Explorer. Go to the "Import adder" tab (1); 3) Click the "Add" button (2) and select the pkodev.mod.loader.dll file (see the attachments at the end of this post); 4) In the "Exported functions" list, select "ExportedFunction" (3); 5) Click the "Import By Name" button (4); 6) Uncheck the "Rebuild OFTs" checkbox (5); 7) Click the "Rebuild Import Table" button (6); 8 ) Save the file (7). 9) Run the executable file. You should see the following message in the console window: [pkodev.mod.loader] ----------------------------------------------- [pkodev.mod.loader] PKOdev.NET mod loader ver. 1.0 by V3ct0r [pkodev.mod.loader] ----------------------------------------------- If the executable file does not have a console window, for example, Game.exe, then run it as follows: system\Game.exe startgame > output.txt The console output will now be redirected to the text file output.txt. * Note: for Game.exe, the mods folder must be in the client's root directory, not in the "system" folder. Installing mods To install a mod, just place its DLL library in the "mods" folder. For convenience, each mod can be placed in a separate folder. An example of a folder structure for GameServer.exe: GameServer | -> Mods | -> .disabled | -> .priority | -> pkodev.mod.example1.server.138.dll | -> pkodev.mod.example2 | -> pkodev.mod.example2.server.138.dll | -> pkodev.mod.example3 | -> pkodev.mod.example3.server.138.dll After launching the executable file, you should see the new mod in the list of loaded mods: Uninstalling mods To uninstall a mod, you need to delete its DLL library from the "mods" folder. Temporary disabling of mods To disable the loading of certain mods, create a ".disabled" file in the root directory with mods ("mods" folder) and write the names of the mods that you want to temporarily disable into it from a new line. For example: // File: mods\.disabled // Write here the names of mods that do not need to be loaded pkodev.mod.fullmap pkodev.mod.tablelimit Thus, mods "pkodev.mod.fullmap" and "pkodev.mod.tablelimit" will be ignored by the loader. Mod loading priority The mod loader allows you to load certain mods in the specified order. To do this, create a ".priority" file in the root directory with mods ("mods" folder) and write down the names of mods in it in descending order of priority. Mods not listed in this file will be loaded after mods with priority, in random order. For example: // File mods\.priority // Write down mods loading priority in descending order here pkodev.mod.power pkodev.mod.tablelimit pkodev.mod.fullmap Mods will be loaded in the following order: 1. pkodev.mod.power; 2. pkodev.mod.tablelimit; 3. pkodev.mod.fullmap; 4. Next - all other mods found in the "mods" folder in random order. Creating a mod In order for a mod to be loaded by the mod loader, it must meet the following requirements: 1) The name of the DLL library of the mod should be like: pkodev.mod.<mod name>.<client or server>.<.exe designation >.dll Examples: pkodev.mod.tablelimit.client.13x_0.dll pkodev.mod.mobspawn.server.138.dll 2) DLL library of the mod should export 3 functions: __declspec(dllexport) void __cdecl GetModInformation(mod_info& info) Fill in the structure of type mod_info. This structure contains basic information about the mod: its name, version, author name, executable file ID for which the mod is intended. // Mod information structure struct mod_info { // Mod name char name[128]; // Mod version char version[64]; // Author’s name char author[64]; // Type and version of the target .exe file (see the table) unsigned int exe_version; }; __declspec(dllexport) void __cdecl Start(const char* path) Enable the mod and modify the process of the executable file. The path variable contains the path to the root directory of the mod. In this function, the mod must perform its initialization, load the necessary settings and modify the process of the executable file. __declspec(dllexport) void __cdecl Stop() Disable the mod. In this function, the mod must save its settings, roll back the process modification (optional) and free resources. 3) The type and version of the executable file specified in the DLL library of the mod (structure modinfo, field exe_version) must match the type and version of the executable file for which it is intended. If the loader has defined the type and version of the executable file as GameServer.exe 1.38 (GAMESERVER_138) with ID 2, then the mod's DLL library should write the value 2 in the exe_version field, otherwise the mod will be determined as unsuitable. Mod development example Any programming language can be used to develop the mod which supports creating DLLs. I will use the C++ as programming language and the Visual Studio 2019 Community as development environment. As an example, let's create a mod for GameServer.exe version 1.38 that will display the "Hello world!" message in its window. 1) Let's define the name of the mod, let it be: pkodev.mod.helloworld Then the name of the DLL library of the mod will be: pkodev.mod.helloworld.server.138.dll 2) Create a Dynamic-Link Library (DLL) project; 3) Add the loader.h file to the project (see the attachments at the end of this post); 4) Implement the function GetModInformation(): void GetModInformation(mod_info& info) { strcpy_s(info.name, "pkodev.mod.helloworld"); strcpy_s(info.version, "1.0"); strcpy_s(info.author, "V3ct0r"); info.exe_version = GAMESERVER_138; } 5) Implement the function Start() void Start(const char* path) { std::cout << "Hello world!" << std::endl; std::cout << "path = " << path << std::endl << std::endl; } 6) Implement the function Stop() void Stop() { } 7) Compile the project. As a result, we’ll get the file pkodev.mod.helloworld.server.138.dll; 8 ) Install and test the mod. In the GameServer.exe window, we should see the message "Hello world!" and the path to the root directory of the mod. The sample mod project can be found in the attachments. Download 1) The mod loader; 2) Source code of the mod loader (C++); 3) Interface for creating mods (file loader.h); 4) The project of the sample mod "Hello world!" for Visual Studio 2019 Community (C++); 5) Samples of client and server executables from the table (7.3 MB); 6) PKOdev .NET mod loader project template for Visual Studio 2019 Community (C++). Available mods 1) Connecting Game.exe to Stall Server ("offline" stalls server connector); 2) Fixing instant respawn of killed monsters after GameServer restart; 3) Editing the limits of .txt tables; 4) Player rating system; 5) System of daily rewards for entering the game; 6) Automatically connect to the server / enter the game (Client modification that allows you to automatically connect to the server); 7) Displaying coordinates under the NPC; 8 ) Displaying additional parameters on the form with character characteristics (frmState); 9) Displaying the cooldown of skills; 10) Displaying the player's character level next to its name; 11) Antibot; 12) Displaying the name of the item in the apparel; 13) Displaying the level of items on their icons ("smart icons"); 14) Change the size of the monsters; 15) Server time; 16) Social buttons (Discord, Youtube, Twitch and etc); 17) Medals (necklaces) with titles; 18) Displaying servers response time ("ping") on the server selection form; 19) Contract system; 20) Disabling error messages when compiling .txt tables (table_bin); 21) Colored GM messages (GM notice); 22) Fixing the resetting character professions when reconnecting to the server; 23) Cleaning up chats; 24) Disabling password verification when entering into the in-game shop (IGS); 25) 60 frames per second (60 FPS); 26) Flying effect for wings; 27) Full area map for the region; 28) Highlight friends and enemies with color. (updated on 02/18/2022) If you have any questions or have problems, then feel free to write in this thread.
  2. [Mod] System of daily rewards for entering the game 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. 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!) 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.
  3. [Mod] Player rating system This mod implements a player rating system that allows players to compare their characters according to any criterion, depending on how the administrator configures the system. For example, you can define a rating as the sum of all the basic characteristics of a character (see the screenshot above) and see how much is the character stronger than another one. Or you can display the number of killed players or monsters in the rating. You can also display the amount of gold, reputation points, etc. The system is very flexible and depends on the administrator's imagination. The rating is displayed above the name of the characters and is highlighted by color. After the character leaves the game, the rating will be saved in the database, so you can display the rating of the players on your website. Requirements Installed mod loading system for server and client (PKOdev.NET mod loader). Modification information Name: pkodev.mod.power; Version: 1.1; 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. Mod update 17/01/2022 + Fixed a bug where the amount of experience was not updated for the player's character when killing a monster (thanks to @Rewind and @Tera for the bug report); + The format for outputting the number of rating points has been moved to the pkodev.mod.power.cfg settings file on the client side: - [{:power:}] - Installation Server: 1) In the "GameServer\mods" directory of your server, create a "pkodev.mod.power" folder; 2) Place into it the mod DLL file "pkodev.mod.power.server.13<x>.dll" for your version of GameServer.exe; 3) In the functions.lua file ("GameServer\resource\script\calculate\") write the following script: -- Power system (pkodev.mod.power) -- Calculate player's character power amount function CalculatePower(role) -- Get some character attributes local str = GetChaAttr(role, ATTR_STR) local agi = GetChaAttr(role, ATTR_AGI) local con = GetChaAttr(role, ATTR_CON) local spr = GetChaAttr(role, ATTR_STA) local acc = GetChaAttr(role, ATTR_DEX) -- Power formula local formula = ( str + agi + con + spr + acc ) -- Return calculated power amount and color return formula, GetPowerColor(formula) end -- Power system (pkodev.mod.power) -- Get color of power value function GetPowerColor(power) -- Green color (0xFF00FF00) return 4278255360 end 4) In MSSQL Management Studio, execute the SQL query: USE GameDB ALTER TABLE character ADD power INT NOT NULL DEFAULT (0) Client: 1) In the "mods" directory of your client, create a "pkodev.mod.power" folder; 2) Place the mod DLL file "pkodev.mod.power.client.13x_<x>.dll" for your version of Game.exe into it. 3) Place the mod settings file "pkodev.mod.power.cfg" into it and write the desired format for displaying the number of character rating points (marker {:power:}), for example: - [{:power:}] - Mod customization 1) In the functions.lua file, in the CalculatePower(role) function, write the code that will calculate the player's character rating. The function input is the role variable - the descriptor of the current character. At the output, the function should return the rating as an integer value. In the example above, the script calculates the rating as the sum of the character's base stats; 2) In the functions.lua file, in the GetPowerColor(power) function, write the code that will determine the rating color depending on its value - power. For example, you can make a rating less than 50 highlighted in yellow, from 50 to 100 in green, above 100 in red. The color must be written in the format 0xFFRRGGBB, in decimal notation. Example: green = 0xFF00FF00, after translate into decimal number system you will get the number 4278255360, and you need to write it into the script; 3) The mod provides for storing the character's rating in the database after leaving the game. For example, for displaying on the site in various TOPs. You can disable it if you do not need this feature. To do this, skip step 4 of the "Installation - Server" section and comment out the following lines in the source code of the server side of the mod (pkodev.mod.power.server project, dllmain.cpp file, Start() and Stop() functions), then compile the project: DetourAttach(&(PVOID&)pkodev::pointer::CTableCha__SaveAllData, pkodev::hook::CTableCha__SaveAllData); and DetourDetach(&(PVOID&)pkodev::pointer::CTableCha__SaveAllData, pkodev::hook::CTableCha__SaveAllData); 4) To get the rating of a character from the database, run the SQL query: SELECT power FROM GameDB.dbo.character WHERE cha_name = '<character name>' 5) No client side configuration required. 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.
  4. [Script] Promo code system This script implements a simple promo code system. Players can use promo codes to get items. Promo codes are entered into the local chat channel through a slash, for example: /agjtjSfsaAS34 The promo code can only be used once. A text file is used to store promo codes. Requirements The script requires GameServer.exe with the HandleChat() function support - local chat messages handler. Installing the script 1) Create a file named "pkodev.promo.lua" in the folder "GameServer\resource\script\calculate\mods" with the following contents: -- Print a log print("Loading pkodev.promo.lua") -- Check that HandleChat function exists if (HandleChat == nil) then -- Write a log print("pkodev.promo.lua: Warning, the HandleChat() function is not exist!") -- Do not load the script return end -- Promocodes system promo = promo or { } -- Name of the file with promocodes promo.file = "promocodes.dat" -- List with promocodes promo.list = {} -- Save data to file promo.save = function(path) -- Open the file local file, msg = io.open(path, "w") -- Check that file is open if (file == nil) then -- Write a log LG("pkodev.mod.promo", string.format("Can't save the list with promocodes to the file '%s': '%s'!", path, msg)) return false end -- Write data for key, value in promo.list do -- Write a line local ret = file:write(string.format("{%s, %d, %d}\n", value.code, value.id, value.count)) -- Check that line is written if (ret == false) then -- Write a log LG("pkodev.mod.promo", string.format("Can't write the data to the file '%s'!", path)) return false end end -- Flush the data file:flush() -- Close the file file:close() -- Write a log LG("pkodev.mod.promo", string.format("The list with promocodes has been successfully saved to the file '%s'!", path)) return true end -- Load data from file promo.load = function(path) -- Remove old promocodes for k in pairs (promo.list) do promo.list[k] = nil end -- Open the file local file, msg = io.open(path, "r") -- Check that file is open if (file == nil) then -- Write a log LG("pkodev.mod.promo", string.format("Can't load the list with promocodes from the file '%s': '%s'!", path, msg)) return false end -- Read file line by line for line in file:lines() do -- Extract data from the line local ret, _, code_, id_, count_ = string.find(line, "^{([A-Za-z0-9]+)%s*,%s*([0-9]+)%s*,%s*([0-9]+)}$") -- Check that string matches the pattern if (ret ~= nil) then -- Add data to the list table.insert( promo.list, { code = code_, id = id_, count = count_, } ) end end -- Close the file file:close() -- Write a log LG("pkodev.mod.promo", string.format("%d promocodes have been succsessfully loaded from file '%s'!", table.getn(promo.list), path)) return true end -- Handle chat function hook promo.hadle_chat__original = HandleChat HandleChat = function(role, msg) -- Check that message has the '/' symbol if ( string.sub(msg, 1, 1) == "/" ) then -- Get promocode local ret, _, code_ = string.find(msg, "^/([A-Za-z0-9]+)%s*$") -- Check that promocode is found if (ret ~= nil) then -- Search the promocode in the list for key, value in pairs(promo.list) do -- Compare promocodes if (value.code == code_) then -- Write a message BickerNotice(role, string.format("You entered the promocode '%s': %s x %d!", value.code, GetItemName(value.id), value.count) ) -- Give an item GiveItem(role, 0, value.id, value.count, 0) -- Write a log LG("pkodev.mod.promo", string.format("Player '%s' entered a promocode '%s' and received '%s' x %d!", GetChaDefaultName(role), value.code, GetItemName(value.id), value.count) ) -- Remove the promocode from the list promo.list[key] = nil -- Save the list to the file promo.save(promo.file) -- Synchronize the promocodes list local packet = GetPacket() WriteCmd(packet, 4015) WriteDword(packet, GetRoleID(role)) WriteString(packet, string.format("promo.list[%d]=nil", key)) SendPacket(role, packet) -- Do not call the original function HandleChat() return 0 end end end end -- Call the original function HandleChat() return promo.hadle_chat__original(role, msg) end promo.load(promo.file) 2) Include it in the file "SkillEffect.lua" (\GameServer\resource\script\calculate) after "functions.lua" inclusion: dofile(GetResPath("script\\calculate\\mods\\pkodev.promo.lua")) 3) In the root directory of the GameServer create a file named "promocodes.dat" and write the list of promocodes in the following format: {<Promocode>, <Item ID>, <Item number>} Example: {agjtjSfsaAS34, 1849, 45} {kgjKKKsnggklsaa, 885, 1} {0004121aAf, 1848, 10} Using the script 1) To use a promocode, player should enter it in the local chat: /agjtjSfsaAS34 The player will get Cake x 45. 2) All logs regarding promo codes usage can be found in the file: GameServer\LOG\log\pkodev.mod.promo.txt What can be improved 1) As a reward, you can also give gold, buffs and other bonuses; 2) The list of promotional codes can be stored in the database, for example, using the LuaSQL library; 3) You can make promotional codes reusable, but one player can use the promotional code only once.
  5. [Mod] Contract system This system is a "Monster Hunt" type quest, the purpose of which is to kill a certain number of specific monsters. The player is given a special item - "Contract", which says which monster to hunt. It also records the number of monsters and current progress. After killing the required number of monsters, the contract is considered completed, and the player receives a reward. Some specifics of the system: 1) The item type for the contract should be 99. A unique ID is also selected for the item; 2) The contract can be picked up, thrown away, transferred to another player, put in the bank or sold; 3) To receive a reward after the completion of the contract, a player should use the item of the contract by double-clicking. If the contract has not been completed, the player will see a corresponding message in the system chat; 4) The composition and amount of the reward is determined by the administrator in a special function in the script of the contract system; 5) If a player has several contracts for killing the same monster in his inventory, then when killing this monster, one or another contract is selected randomly. Installation All necessary files and scripts can be downloaded at the end of the topic. Server 1) Add an item for the contract to the ItemInfo.txt file: XXXX Contract n0184 10130005 0 0 0 0 0 00 99 0 0 0 0 0 1 1 1 1 1 1 0 -1 0 -1 0 0 -1 -1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0,0 0,0 0,0 0,0 0,0 0,0 0,0 0,0 0,0 0,0 0,0 0,0 0,0 0,0 0,0 0,0 0,0 0,0 0,0 0,0 0,0 0,0 0 10,10 0,0 0 0 0 0 0 0 0 0 0 ItemUse_PKOdevContract 0 0 0 0 0 0 After completion you will receive a reward! where XXXX is any unused ID. 2) Create a file with name "pkodev.contract.lua" in the directory "GameServer\resource\script\calculate\mods"; 3) Write the following code in this file: -------------------------------------------------------------- -- The contract system script -- -- Author: V3ct0r from PKOdev.NET -- Version: 1.0 (01/12/2022) -- -- How to install the system: -- 1) Put this file to '\GameServer\resource\script\calculate\mods' folder -- 2) Put the following line at the beginning of 'SkillEffect.lua' file: -- dofile(GetResPath("script\\calculate\\mods\\pkodev.contract.lua")) -- 3) Add the contract item in the ItemInfo.txt file -- XXXX Contract n0184 10130005 0 0 0 0 0 00 99 0 0 0 0 0 1 1 1 1 1 1 0 -1 0 -1 0 0 -1 -1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0,0 0,0 0,0 0,0 0,0 0,0 0,0 0,0 0,0 0,0 0,0 0,0 0,0 0,0 0,0 0,0 0,0 0,0 0,0 0,0 0,0 0,0 0 10,10 0,0 0 0 0 0 0 0 0 0 0 ItemUse_PKOdevContract 0 0 0 0 0 0 Upon completion, you are entitled to a reward -- 4) Specify the item ID in 'contract.conf.item_id' table below: -- item_id = XXXX -- 5) Write the code for issuing a reward for completing a contract in the 'contract.conf.reward_cb' function -- 6) To create a new contract use the function 'contract.create': -- local <result (0 or 1)>, <item_descriptor>, <slot (from 0 to bag_size - 1)> -- = contract.create(<character_descriptor>, <monster_id>, <monster_number>) -- For example: -- local ret, item, slot = contract.create(role, 103, 7) -- 7) Done! -------------------------------------------------------------- -- Print a log print("Loading pkodev.contract.lua") -- The contract system contract = contract or {} --------------------------------------- -- Settings --------------------------------------- contract.conf = { -- Contract item ID item_id = XXXX, -- User-defined function for reward reward_cb = function(role, item) -- Give 1,000 gold AddMoney (role, 0, 1000) -- Give an random item local arr = { -- Refining Gem x 1 {id = 885, count = 1}, -- or Gem of Rage x 2 {id = 863, count = 2}, -- or Cake x 60 {id = 1849, count = 60}, -- or Fairy of Luck x 1 {id = 231, count = 1} } local r = math.random(1, table.getn(arr)) GiveItem(role, 0, arr[r].id , arr[r].count, 4) -- Launch fireworks PlayEffect(role, 361) end } --------------------------------------- -- Constants --------------------------------------- contract.const = { item_type = 99, -- Contract item type target_id = ITEMATTR_VAL_STR, -- Item attribute ID with the ID of target monster target_max = ITEMATTR_VAL_AGI, -- Item attribute ID with the total amount of monsters to hunt target_cur = ITEMATTR_VAL_DEX -- Item attribute ID with the total amount of monsters already hunted } --------------------------------------- -- Hooks --------------------------------------- -- Adding an item to inventory event contract.Creat_Item__original = Creat_Item Creat_Item = function(item, item_type, item_lv, item_event) -- Check the item type if ( item_type == contract.const['item_type'] ) then -- Reset the previous attrbiutes Reset_item_add() -- Add new attributes to the item Add_Item_Attr(contract.const['target_id'], 0) Add_Item_Attr(contract.const['target_max'], 0) Add_Item_Attr(contract.const['target_cur'], 0) return item_add.cnt, item_add.attr[1][1], item_add.attr[1][2], item_add.attr[2][1], item_add.attr[2][2], item_add.attr[3][1], item_add.attr[3][2], item_add.attr[4][1], item_add.attr[4][2], item_add.attr[5][1], item_add.attr[5][2], item_add.attr[6][1], item_add.attr[6][2], item_add.attr[7][1], item_add.attr[7][2] end -- Call the original function Creat_Item(item, item_type, item_lv, item_event) return contract.Creat_Item__original(item, item_type, item_lv, item_event) end -- Player killed monster event contract.GetExp_PKM__original = GetExp_PKM GetExp_PKM = function(monster, role) -- Call the original function GetExp_PKM(dead, atk) contract.GetExp_PKM__original(monster, role) -- Get the main character's descriptor role = TurnToCha(role) -- Number of contracts in the player's bag local ret = CheckBagItem(role, contract.conf['item_id']) -- Check that player has contracts if ( ret > 0 ) then -- Monster ID local id = GetChaTypeID(monster) -- List of contracts in the bag local arr = {} local k = 0 -- Build the list of contracts for i = 0, ( GetKbCap(role) - 1 ), 1 do -- Get the item descriptor local item = GetChaItem(role, 2, i) -- Check the item ID if ( GetItemID(item) == contract.conf['item_id'] ) then -- Get the monster ID from contract local target_id = GetItemAttr(item, contract.const['target_id']) -- Check the monster ID if ( id == target_id ) then -- Get amount of monsters to hunt local target_cur = GetItemAttr(item, contract.const['target_cur']) local target_max = GetItemAttr(item, contract.const['target_max']) -- Check that the contract is not completed if ( target_cur < target_max ) then -- Add the item to the list k = k + 1 arr[k] = { item_ = item, cur_ = target_cur, max_ = target_max } end end end end -- Check that matching contracts have been found if ( k > 0 ) then -- Randomly select a contract local r = math.random(1, k) -- Increase the number of hunted monsters arr[r].cur_ = arr[r].cur_ + 1 -- Update amount of hunted monsters SetItemAttr(arr[r].item_, contract.const['target_cur'], arr[r].cur_) -- Synchronize the bag SynChaKitbag(role, 13) -- Check that the contract is not completed if ( arr[r].cur_ < arr[r].max_ ) then -- Write a message BickerNotice( role, string.format( "Contract: Remaining '%s' to hunt: %d / %d!", GetMonsterName(id), arr[r].cur_, arr[r].max_ ) ) else -- Write a message BickerNotice( role, string.format( "Contract: All '%s' are killed! The contract is completed.", GetMonsterName(id) ) ) end end end end --------------------------------------- -- Useful functions --------------------------------------- -- Create a contract contract.create = function(role, target_id, number) -- Get the main character's descriptor role = TurnToCha(role) -- Check that the bag is not locked if ( KitbagLock(role, 0) == LUA_FALSE ) then -- Error LG("pkodev.contract", "Can't create the contract item (id:", contract.conf['item_id'], ") because the bag is locked!") return LUA_FALSE, nil, 0 end -- Check that the bag has one free slot if ( GetChaFreeBagGridNum(role) == 0 ) then -- Error LG("pkodev.contract", "Can't create the contract item (id:", contract.conf['item_id'], ") because there are no free slots in the bag!") return LUA_FALSE, nil, 0 end -- Create an item local r1, r2 = MakeItem(role, contract.conf['item_id'], 1, 4) -- Check the result if ( r1 == 0 ) then -- Error LG("pkodev.contract", "Can't create the contract item (id:", contract.conf['item_id'], ")!") return LUA_FALSE, nil, 0 end -- Get the item descriptor local item = GetChaItem(role, 2, r2) -- Set contract data local a1 = SetItemAttr(item, contract.const['target_id'], target_id) local a2 = SetItemAttr(item, contract.const['target_max'], number) local a3 = SetItemAttr(item, contract.const['target_cur'], 0) -- Check that the data is set if ( (a1 == 0) or (a2 == 0) or (a3 == 0) ) then -- Error LG("pkodev.contract", "Can't set the contract data! a1 = ", a1, ", a2 = ", a2, ", a3 = ", a3) return LUA_FALSE, item, r2 end -- Synchronize the kitbag SynChaKitbag(role, 13) -- Write a message to the player SystemNotice(role, string.format("You received a monster hunt contract [%s] x %d!", GetMonsterName(target_id), number)) -- The contract is successfully created! return LUA_TRUE, item, r2 end -- Contract item use event ItemUse_PKOdevContract = function(role, item) -- Get the main character's descriptor role = TurnToCha(role) -- Get contract data local target_id = GetItemAttr(item, contract.const['target_id']) local target_max = GetItemAttr(item, contract.const['target_max']) local target_cur = GetItemAttr(item, contract.const['target_cur']) -- Check that the contract is not completed if ( target_cur < target_max ) then -- Print a message SystemNotice( role, string.format("You have to kill [%s] x %d more to complete this contract!", GetMonsterName(target_id), (target_max - target_cur) ) ) -- Cancel the item usage UseItemFailed(role) else -- Print a message SystemNotice(role, "You have successfully completed the contract, congratulations!") -- Call user-defined reward function if ( contract.conf['reward_cb'] ~= nil ) then contract.conf['reward_cb'](role, item) end end end 5) Write the contract item ID from ItemInfo.txt into the script of the system : contract.conf = { -- Contract item ID item_id = XXXX, . . . 6) Write your code for giving a reward for completing the contract in the function reward_cb(): -- User-defined function for reward reward_cb = function(role, item) -- Give 1,000 gold AddMoney (role, 0, 1000) -- Give an random item local arr = { -- Refining Gem x 1 {id = 885, count = 1}, -- or Gem of Rage x 2 {id = 863, count = 2}, -- or Cake x 60 {id = 1849, count = 60}, -- or Fairy of Luck x 1 {id = 231, count = 1} } local r = math.random(1, table.getn(arr)) GiveItem(role, 0, arr[r].id , arr[r].count, 4) -- Launch fireworks PlayEffect(role, 361) end 7) Open the file "GameServer\resource\script\calculate\SkillEffect.lua" and at the beginning of the file write the line: dofile(GetResPath("script\\calculate\\mods\\pkodev.contract.lua")) Client 1) Install the mod loading system PKOdev.NET mod loader; 2) Place the mod DLL file "pkodev.mod.contract.client.13x_<ID>.dll" for your version of Game.exe into the "mods" folder of the game client; 3) Add the item for the contract to the ItemInfo.txt file (see point 1 of the instructions for installing the system on the server). Creation and issuance of contracts Each contract must only be created using the contract.create() function. Using the GiveItem(), MakeItem() functions, or the &make GM command and other ways to create items is not allowed. The syntax: local <Result LUA_TRUE|LUA_FALSE>, <Item descriptor>, <Item slot> = contract.create(<Character descriptor>, <Monster ID>, <Number of monsters>) Example: local ret, item, pos = contract.create(role, 103, 7) As a result, a contract will be created for killing seven "Forest Spirits" as in the image from the topic header. You can give contracts to players, for example, through a special NPC or with the another item. 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.
  6. Scheduled player reward system With the help of this system, it is possible to give out to all players on the server at a certain time the reward (gift) specified in the schedule: all players who are currently online will receive an item. How to install 1) Create a file named "pkodev.gift.lua" in folder "GameServer\resource\script\calculate\mods"; 2) Put the following code to the file: -------------------------------------------------------------- -- Gift system script -- -- Author: V3ct0r from PKODev.NET -- Version: 1.0 (11/08/2021) -- -- How to install the system: -- 1) Put this file to '\GameServer\resource\script\calculate\mods' folder -- 2) Put the following line at the beginning of 'mlist.lua' file: -- dofile(GetResPath("script\\calculate\\mods\\pkodev.gift.lua")) -- 3) Done! -- -- Interface: -- 1) Add a gift to queue: -- local gift_id = giftmod:addGift(item_id, number, hour, minute, second, month, day, year) -- 2) Remove a gift from queue -- local success = giftmod:removeGift(gift_id) -- Where 'success' can be 'true' or 'false' -- 3) Get gift number in queue -- local number = giftmod:getGiftNumber() -- 4) Print a list of queued gifts in GameServer window: -- giftmod:printGifts() -- -- These commands also can be used with &lua_all GM-command, for example: -- &lua_all giftmod:addGift(item_id, number, hour, minute, second, month, day, year) -- Note: After GameServer.exe restart gifts. which were added using GM-command, will be removed -------------------------------------------------------------- -- Update guard if (PKODEV_GIFT_GUARD ~= nil) then -- Exit the script return end -- Define update guard PKODEV_GIFT_GUARD = true -- Print a log print("Loading pkodev.gift.lua") -- Class Gift Gift = {} -- Make a Gift function Gift:new(id, item_id, count, gift_time) -- Private fields local private = { id = id or -1, item_id = item_id or -1, count = count or 0, gift_time = gift_time or 0, is_given = false } -- Public fields local public = { } -- Get an gift ID function public:getId() return private.id end -- Get an item id function public:getItemId() return private.item_id end -- Get an item count function public:getItemCount() return private.count end -- Get a time at which to give the gift function public:getTime() return private.gift_time end setmetatable(public, self) self.__index = self; return public end -- Class GiftSystem GiftSystem = {} -- Make a Gift system function GiftSystem:new() -- Private fields local private = { -- List of gifts to give gifts = { }, -- List of active players players = { }, -- Timer function timer_func = nil, -- List of hooks hooks = { } } -- Public fields local public = { } -- Player entered a map event function private:on_player_entered_map(role, mapdesc, map) -- Check that map exists in the list if ( private.hooks[map] ~= nil ) then -- Check that enter function is hooked if ( private.hooks[map].enter ~= nil ) then -- Call original function private.hooks[map].enter(role, mapdesc) end end -- Add player to the list private.players[ GetRoleID(role) ] = role end -- Player leaved a map event function private:on_player_leaved_map(role, map) -- Check that map exists in the list if ( private.hooks[map] ~= nil ) then -- Check that leave function is hooked if ( private.hooks[map].leave ~= nil ) then -- Call original function private.hooks[map].leave(role) end end -- Remove player from the list private.players[ GetRoleID(role) ] = nil end -- Timer event function private:on_timer_event(map) -- Check that timer function is hooked if ( private.timer_func ~= nil ) then -- Call original function private.timer_func(map) end -- Get current system time local t = os.time() -- Update gifts for i = table.getn(private.gifts), 1, -1 do -- Get a gift local gift = private.gifts[i] -- Check that it's time to give out the gift if ( t >= gift:getTime() ) then -- Give the gift to players for cha_id, role in pairs(private.players) do GiveItem(role, 0, gift:getItemId(), gift:getItemCount(), 4) end -- Remove the gift from the list table.remove(private.gifts, i) end end end -- Set hooks function private:setHook() -- Search for 'after_enter_', 'before_leave_' and timer functions for key, value in pairs(_G) do -- Get a global item name in lower case local name = string.lower(key) -- Player entered a map if ( string.find(name, "after_enter_") == 1 ) then -- Get map name local map = string.sub(name, string.len("after_enter_") + 1) -- Add map to the list private.hooks[map] = private.hooks[map] or {} -- Associate original enter function address with map name private.hooks[map].enter = value -- Set the hook _G[key] = function(role, mapdesc) private:on_player_entered_map(role, mapdesc, map) end end -- Player leaved a map if ( string.find(name, "before_leave_") == 1 ) then -- Get map name local map = string.sub(name, string.len("before_leave_") + 1) -- Add map to the list private.hooks[map] = private.hooks[map] or {} -- Associate original leave function address with map name private.hooks[map].leave = value -- Set the hook _G[key] = function(role) private:on_player_leaved_map(role, map) end end -- Timer if ( private.timer_func == nil ) then -- Search for timer function if ( string.find(name, "map_copy_run_") == 1 ) then -- Number of underscore characters local n = 0 -- Count the number of underscore characters string.gsub(name, ".", function(c) if ( c == '_' ) then n = n + 1 end end) -- Number of underscore characters should be equal to 3 if (n == 3) then -- Set timer function private.timer_func = value -- Set the hook _G[key] = function(map) private:on_timer_event(map) end end end end end -- Check that timer hook is enabled if ( private.timer_func == nil ) then print("pkodev.gift: Warning, suitable timer function is not found!") end end -- Add a gift to the list function public:addGift(item_id, count, h, m, s, mon, day, year) -- Check item ID if ( string.lower(GetItemName(item_id)) == "unknown" ) then -- Do not add a gift return -1 end -- Check item count if (count <= 0) then -- Do not add a gift return -1 end -- Get item timestamp local gift_timestamp = os.time{ month = mon, day = day, year = year, hour = h, min = m, sec = s } -- Check that item time is not expired if ( gift_timestamp <= os.time() ) then -- Do not add a gift return -1 end -- Get an ID for new gift local gift_id = public:getGiftNumber() -- Create a gift local gift = Gift:new(gift_id, item_id, count, gift_timestamp) -- Add a gift to the list table.insert(private.gifts, gift) -- Return gift ID return gift_id end -- Remove a gift by ID function public:removeGift(gift_id) -- Find a gift in the list for index, gift in pairs(private.gifts) do -- Check gift ID if ( gift_id == gift:getId() ) then -- Remove the gift from the list table.remove(private.gifts, index) -- Gift removed return true end end -- Gift not found return false end -- Get gift number function public:getGiftNumber() return table.getn(private.gifts) end -- Print a list of gifts function public:printGifts() -- Get gift number local n = public:getGiftNumber() -- Check that there are gifts in the list if (n > 0) then -- Print all gifts for index, gift in pairs(private.gifts) do -- Get time data local temp = os.date("*t", gift:getTime()) -- Print a gift print( string.format( "pkodev.gift: %d) [Gift ID: %d] - %s x %d at %02d:%02d:%02d %02d/%02d/%02d", index, gift:getId(), GetItemName(gift:getItemId()), gift:getItemCount(), temp.hour, temp.min, temp.sec, temp.month, temp.day, temp.year ) ) end else -- No gifts print("There are no active gifts!") end end -- Enable the necessary hooks for the gift system to work private:setHook() setmetatable(public, self) self.__index = self; return public end -- Create an instance of the gift system giftmod = GiftSystem:new() -- Add gifts to the queue giftmod:addGift(863, 1, 16, 6, 30, 11, 9, 2022) -- 'Gem of Rage' x 1 at 16:06:30 11/09/2022 giftmod:addGift(684, 1, 16, 7, 25, 11, 15, 2022) -- 'New Sheepskin Scroll' x 1 at 16:07:25 15/09/2022 giftmod:addGift(1849, 99, 12, 7, 0, 11, 18, 2022) -- 'Cake' x 99 at 12:07:00 18/09/2022 -- Print queued gifts giftmod:printGifts() 3) Open file "GameServer\resource\script\monster\mlist.lua" and put at the beginning the line: 4) Start GameServer.exe. You should see in it's console window the following lines: pkodev.gift: 1) [Gift ID: 0] - Gem of Rage x 1 at 16:06:30 11/09/2022 pkodev.gift: 2) [Gift ID: 1] - New Sheepskin Scroll x 1 at 16:07:25 11/15/2022 pkodev.gift: 3) [Gift ID: 2] - Cake x 99 at 12:07:00 11/18/2022 5) Configure the system at your discretion (see the "How to use" section below); 6) The installation process is complete. How to use 1) You can define a queue of gifts at the end of "pkodev.gift.lua" file using giftmod:addGift() command: local gift_id = giftmod:addGift(item_id, number, hour, minute, second, month, day, year) Also you can add a gift to the queue using GM-command*: &lua_all giftmod:addGift(item_id, number, hour, minute, second, month, day, year) *Note: After GameServer.exe restart gifts. which were added using GM-command, will be removed. 2) You can remove pending gifts from the queue using giftmod:removeGift() command: local success = giftmod:removeGift(gift_id) -- Where 'success' can be 'true' or 'false' Where variable gift_id is ID of pending gift which was returned from giftmod:addGift() command. 3) You can get an amount of pending gifts using giftmod:getGiftNumber() command: local number = giftmod:getGiftNumber() 4) Finally, you can display pending gifts in the GameServer.exe window: giftmod:printGifts() That's all! Download the script of the system (3 KB)
  7. emofc

    New server Help

    Hello everyone ! I want to know what players like to play hard or medium servers or full easy ! Let me know guys what you like and i will make it! Tnx
  8. Hello friends, Im planning to create a two guilds system in my server. I want you guys to give me some suggestions of which theme i can use. For example Left x Right Red x Blue ...
×
×
  • Create New...