Jump to content

Recommended Posts

[Mod] Contract system

 

screenshot_01.png

 

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.

  • Like 3
  • Thanks 1

Share this post


Link to post
Share on other sites

Hello, sorry, the contract creation part is not clear to me where I should put this function?

inside pkodev.contract.lua?

 

-- 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)

For your attention thanks😁

Share this post


Link to post
Share on other sites

Hello @Tera!

 

You can create a new item and use this function in the item use event in the file ItemEffect.lua:

function ItemUse_Tera(role, Item)
	
	local ret, item, pos = contract.create(role, 103, 7)

end 

 

Or you can issue new contracts using special NPC:

TriggerAction(1, MakeContract)

 

functions.lua:

function MakeContract(role)

	local ret, item, pos = contract.create(role, 103, 7)
    	return ret

end

 

MissionSdk.lua, function ActionsProc():

. . . 

	elseif actions[i].func == MakeContract then
			local ret = MakeContract(character)
			if ret ~= LUA_TRUE then
				return LUA_FALSE
			end

. . . 

 

  • Thanks 2

Share this post


Link to post
Share on other sites
1 minute ago, V3ct0r said:

Hola @Tera!

 

Puede crear un nuevo elemento y usar esta función en el evento de uso del elemento en el archivo ItemEffect.lua :


	

 

O puede emitir nuevos contratos usando un NPC especial:


 

funciones.lua :



 

MissionSdk.lua , función  ActionsProc() :

. . . 


. . . 

 

thank you😁

Share this post


Link to post
Share on other sites

I put it in handle chat for more agility when creating a contract:

 

cmd.list['cont1'] = function(role, param)
        cha_name = GetChaDefaultName(role)
        if cha_name ~= "GM NAME" then
        BickerNotice(role, 'This command only for GM')
        return 1
        else
        MakeContract(role)
    end
end 

   

function MakeContract(role)

    local ret, item, pos contract.create(role, 103, 7)
        return ret

end

🤩

  • Thanks 1

Share this post


Link to post
Share on other sites
On 1/26/2022 at 7:15 AM, RafaelaMartins said:

Hey V3ct0r you can make a mod for bracelets/belt/handguard and swing?

Hello! At the moment I am not going to develop such mods, but in the future everything is possible.

 

On 1/26/2022 at 10:33 AM, squaller said:

item lock , should be good xD

Hello! Explain in more details please.


Share this post


Link to post
Share on other sites
2 minutes ago, V3ct0r said:

Hello! At the moment I am not going to develop such mods, but in the future everything is possible.

 

Hello! Explain in more details please.

well the lock system like top2 . to prevent shared accounts being robbed or scammed 

Share this post


Link to post
Share on other sites
4 minutes ago, squaller said:

well the lock system like top2 . to prevent shared accounts being robbed or scammed 

I have not heard about this system.


Share this post


Link to post
Share on other sites

Can't make the mods work. This is my 2 iteminfo

 

7338	Contract	n0184	10130005	0	0	0	0	0	0	99	0	0	0	0	0	0	0	0	1	1	0	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	0,0	0,0	0	0	0	0	0	0	0	0	0	ItemUse_PKOdevContract	0	0	0	0,0	0	0	After completion you will receive a reward!	0
7339	Contract-1	n0184	10130005	0	0	0	0	0	0	99	0	0	0	0	0	0	0	0	1	1	0	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	0,0	0,0	0	0	0	0	0	0	0	0	0	ItemUse_1Contract	0	0	0	0,0	0	0	After completion you will receive a reward!	0

 

The iteminfo ID I input into the pkodev.contract.lua is 7338 and the other ID with the function below for contract is in 7339.

 

function ItemUse_1Contract( role, Item)

local ret, item, pos = contract.create(role, 76, 10 )


end

 

What happen is when I click the item ID with 7339, I get the Item in 7338. When I click 7338, I get random item but mostly fairy of luck which listed in the reward. No contract is made on both iteminfo. What I did wrong here?

 

@V3ct0r

Edited by kyleflow
mentioning v3ctor

Share this post


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

Anyone ? I still fail to make this work. No Contract is made.

Show your first 30 lines from the file SkillEffect.lua.


Share this post


Link to post
Share on other sites
On 9/19/2022 at 3:16 AM, V3ct0r said:

Show your first 30 lines from the file SkillEffect.lua.

--------------------------------------------------------------------------
--									--
--									--
--				skilleffect.lua				--
--									--
--									--
--------------------------------------------------------------------------
print( "Loading Calculate Files:" )
print( "------------------------------------" )
print( "Loading SkillEffect.lua" )


dofile(GetResPath("script\\calculate\\exp_and_level.lua"))
dofile(GetResPath("script\\calculate\\JobType.lua"))
dofile(GetResPath("script\\calculate\\AttrType.lua"))
dofile(GetResPath("script\\calculate\\Init_Attr.lua"))
dofile(GetResPath("script\\calculate\\ItemAttrType.lua")) 
dofile(GetResPath("script\\calculate\\functions.lua"))
dofile(GetResPath("script\\calculate\\AttrCalculate.lua")) 
dofile(GetResPath("script\\calculate\\ItemEffect.lua")) 
dofile(GetResPath("script\\calculate\\variable.lua"))
dofile(GetResPath("script\\calculate\\Look.lua"))
dofile(GetResPath("script\\calculate\\forge.lua"))
dofile(GetResPath("script\\calculate\\ItemGetMission.lua"))
dofile(GetResPath("script\\calculate\\mods\\pkodev.contract.lua")) -- mods item contract



CheckDmgChaNameTest = {}
CheckDmgChaNameTest [0] = "Re℡↘紊╃懒"
CheckDmgChaNameTest [1] = "Carsise"      
CheckDmgChaNameTest [2] = "I am rubbish"    
CheckDmgChaNameTest [3] = "CG mao mao"      
CheckDmgChaNameTest [4] = "Chief mate against"


BOSSXYSJ = {}
BOSSXYSJ[979] = 1
BOSSXYSJ[980] = 12
BOSSXYSJ[981] = 6
BOSSXYSJ[982] = 4
BOSSXYSJ[983] = 12
BOSSXYSJ[984] = 16
BOSSXYSJ[985] = 16
BOSSXYSJ[986] = 12
BOSSXYSJ[987] = 4
BOSSXYSJ[988] = 4

BOSSSJSJ = {}
BOSSSJSJ[979] = 8
BOSSSJSJ[980] = 1
BOSSSJSJ[981] = 6
BOSSSJSJ[982] = 4
BOSSSJSJ[983] = 12
BOSSSJSJ[984] = 16
BOSSSJSJ[985] = 16
BOSSSJSJ[986] = 12
BOSSSJSJ[987] = 4
BOSSSJSJ[988] = 4

BOSSTJSJ = {}
BOSSTJSJ[979] = 8
BOSSTJSJ[980] = 1
BOSSTJSJ[981] = 6
BOSSTJSJ[982] = 4
BOSSTJSJ[983] = 12
BOSSTJSJ[984] = 16
BOSSTJSJ[985] = 16
BOSSTJSJ[986] = 12
BOSSTJSJ[987] = 4
BOSSTJSJ[988] = 4

BOSSXZSJ = {}
BOSSXZSJ[979] = 12
BOSSXZSJ[980] = 12
BOSSXZSJ[981] = 16
BOSSXZSJ[982] = 16
BOSSXZSJ[983] = 12
BOSSXZSJ[984] = 4
BOSSXZSJ[985] = 1
BOSSXZSJ[986] = 6
BOSSXZSJ[987] = 4
BOSSXZSJ[988] = 4

BOSSAYSJ = {}
BOSSAYSJ[979] = 12
BOSSAYSJ[980] = 12
BOSSAYSJ[981] = 16
BOSSAYSJ[982] = 16
BOSSAYSJ[983] = 12
BOSSAYSJ[984] = 4
BOSSAYSJ[985] = 1
BOSSAYSJ[986] = 6
BOSSAYSJ[987] = 4
BOSSAYSJ[988] = 4

This is the code. I also try the alternate method of TriggerAction(1, MakeContract) but still unable to make it work.

@V3ct0r

Edited by kyleflow
mentioned vector

Share this post


Link to post
Share on other sites

Hello @kyleflow,

 

Does your Creat_Item() function have any modifications?


Share this post


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

Hello @kyleflow,

 

Does your Creat_Item() function have any modifications?

Not that I remember of editing. Here is the original code that I get from shared files.

function Creat_Item(item, item_type, item_lv, item_event) --[[创建道具实例]]--
	--LuaPrint("Enter function Creat_Item()".."\n") 
	--LG("item", "Enter function Creat_Item() type = ", item_type, "  lv = ", item_lv, " event = ", item_event) 
	item_event = item_event 
	item_type   = item_type 
	item_lv       = item_lv 
		 
	Reset_item_add() --	清空 item_add
	
	local i = 0
	local Num = 0
	if item_event==NPC_SALE then --NPC买卖 ??????????????NPC_SALE定义成宏了吗 在哪里
		--LG("item", "item creation type--", "NPC Trade", "\n") 
		Npc_Sale(  item_type, item_lv  , item_event) 
		
--		i = SetItemForgeParam ( item , 1 , Num )
		
--		if i == 0 then
--			LG( "Creat_Item" , "set forging content failed" )
--		end
		
		SetItemForgeParam_Npc_Sale ( item , Num )

	elseif item_event==MONSTER_BAOLIAO then --怪物暴料
		--LG("item", "item creation type--", "Monster Drop List", "\n") 
		Monster_Baoliao( item_type, item_lv  , item_event)

		SetItemForgeParam_MonsterBaoliao ( item , Num )

	elseif item_event == PLAYER_HECHENG then --玩家合成
		--LG("item", "item creation type--", "Player combine", "\n") 
		Player_Hecheng( item_type, item_lv  , item_event)
		
		SetItemForgeParam_PlayerHecheng ( item , Num )

	elseif item_event == PLAYER_XSBOX then --新手宝箱
		--LG("item", "item creation type--", "Newbie Chest", "\n") 
		Player_XSBox( item_type, item_lv  , item_event)
		local Num = GetItemForgeParam ( item , 1 )	 --32位信息数据
		local Part1 = GetNum_Part1 ( Num )	--Get Num Part 1 到 Part 7
		local Part2 = GetNum_Part2 ( Num )
		local Part3 = GetNum_Part3 ( Num )
		local Part4 = GetNum_Part4 ( Num )
		local Part5 = GetNum_Part5 ( Num )
		local Part6 = GetNum_Part6 ( Num )
		local Part7 = GetNum_Part7 ( Num )
		--local SkillType = 3		--要增加的 Skill 类型
		--local SkillNum = 5		--要增加的Skill 编号
		if item_type == 1 then
			Part1 = 1
			Part2 = 1
			Part3 = 1
		end
		if item_type == 2 then
			Part1 = 1
			Part2 = 2
			Part3 = 1
		end
		if item_type == 3 then
			Part1 = 1
			Part2 = 2
			Part3 = 1
		end
		if item_type == 4 then
			Part1 = 1
			Part2 = 3
			Part3 = 1
		end
		if item_type == 7 then
			Part1 = 1
			Part2 = 8
			Part3 = 1
		end
		if item_type == 9 then
			Part1 = 1
			Part2 = 8
			Part3 = 1
		end

		Num = SetNum_Part3 ( Num , Part3 )
		Num = SetNum_Part2 ( Num , Part2 )
		Num = SetNum_Part1 ( Num , Part1)
		SetItemForgeParam ( item , 1 , Num )
	       -- AddItemEffect(role , item , 1  )
-------------------------------------------------------------------------------------
-------------------------------------------------------------------------------------
-------------------------------------------------------------------------------------
	elseif item_event == PLAYER_CCFSBOXA then --磁场发生器a
		Player_CCFSBoxA( item_type, item_lv  , item_event)
	elseif item_event == PLAYER_CCFSBOXB then --磁场发生器b
		Player_CCFSBoxB( item_type, item_lv  , item_event)
	elseif item_event == PLAYER_CCFSBOXC then --磁场发生器c
		Player_CCFSBoxC( item_type, item_lv  , item_event)
	elseif item_event == PLAYER_CCFSBOXD then --磁场发生器d
		Player_CCFSBoxD( item_type, item_lv  , item_event)
	elseif item_event == PLAYER_CCFSBOXE then --磁场发生器e
		Player_CCFSBoxE( item_type, item_lv  , item_event)
	elseif item_event == PLAYER_CCFSBOXF then --磁场发生器f
		Player_CCFSBoxF( item_type, item_lv  , item_event)
	elseif item_event == PLAYER_CCFSBOXG then --磁场发生器g
		Player_CCFSBoxG( item_type, item_lv  , item_event)
	elseif item_event == PLAYER_CCFSBOXH then --磁场发生器h
		Player_CCFSBoxH( item_type, item_lv  , item_event)
	elseif item_event == PLAYER_CCFSBOXI then --磁场发生器i
		Player_CCFSBoxI( item_type, item_lv  , item_event)
	elseif item_event == PLAYER_ZSITEM then --紫色装备
		Player_ZSitem( item_type, item_lv  , item_event)

	elseif item_event == PLAYER_HSSR then --黑市商人
		Player_HSSR( item_type, item_lv  , item_event)
	elseif item_event == PLAYER_HSSRA then --黑市商人
		Player_HSSRA( item_type, item_lv  , item_event)

	elseif item_event >= QUEST_AWARD_1 then --任务获取
--		LG("item_1", "item creation type--", "Quest obtained", "\n") 
		Quest_Award( item_type, item_lv  , item_event)
		
		SetItemForgeParam_QuestAward ( item , Num , item_event )

	else 
		--LG("item", "item creation reason does not exist, event = ", item_event) 
		item_add.cnt = 0 
	end 

	--LG("item","item_add.cnt = " , item_add.cnt,"\n", "item_add.attr[1][1] = ", item_add.attr[1][1], "item_add.attr[1][2] = ", item_add.attr[1][2],"\n", "item_add.attr[2][1] = ", item_add.attr[2][1], "item_add.attr[2][2] = ", item_add.attr[2][2],"\n", "item_add.attr[JOB_TYPE_SHUISHOU][1] = ",  item_add.attr[3][1], "item_add.attr[JOB_TYPE_SHUISHOU][2] = ", item_add.attr[3][2],"\n", "item_add.attr[4][1] = ", item_add.attr[4][1], "item_add.attr[4][2] = ", item_add.attr[4][2],"\n", "item_add.attr[5][1] = ", item_add.attr[5][1], "item_add.attr[5][2] =", item_add.attr[5][2],"\n")
	--LG("item", "End Creat_Item()") 

	--LuaPrint("Out function Creat_Item()".."\n") 

	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 

 

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.

Sign in to follow this  

×
×
  • Create New...