Jump to content

Quest Functions - Get IP | Kill | Set Coins | Empire Name | Name | Job | Level


Recommended Posts

  • Premium

M2 Download Center

This is the hidden content, please
( Internal )

pc
	// New Functions by Avenue
	int pc_get_ip(lua_State* L)
	{
		LPCHARACTER ch = CQuestManager::instance().GetCurrentCharacterPtr();
		lua_pushstring(L, ch->GetDesc()->GetHostName());
		return 1;
	}

	int pc_kill(lua_State* L)
	{
		LPCHARACTER ch = CQuestManager::instance().GetCurrentCharacterPtr();
		ch->Dead();
		return 0;
	}

	int pc_set_coins(lua_State * L)
	{
		if (!lua_isnumber(L, 1))
		{
			sys_err("invalid argument");
			return 0;
		}

		LPCHARACTER ch = CQuestManager::instance().GetCurrentCharacterPtr();
		long val = (long)lua_tonumber(L, 1);
		SQLMsg *msg;

		msg = DBManager::instance().DirectQuery("UPDATE account.account SET coins = coins + '%ld' WHERE id = '%d'", val, ch->GetAID());
		
		if (msg->uiSQLErrno != 0)
		{
			sys_err("pc_update_coins query failed");
			return 0;
		}
	}

	int pc_get_empire_name(lua_State* L)
	{
		LPCHARACTER ch = CQuestManager::instance().GetCurrentCharacterPtr();
		const char* tabelle[3] = {"Shinsoo","Chunjo","Jinno"};
		int empireave = ch->GetEmpire()-1;
		lua_pushstring(L, tabelle[empireave]);
		return 1;
	}
	// New Functions by Avenue end
			// New Functions by Avenue
			{ "get_ip",				pc_get_ip			},
			{ "kill",				pc_kill				},
			{ "set_coins",			pc_set_coins		},
			{ "get_empire_name",	pc_get_empire_name	},
			// New Functions by Avenue end
 
 
npc
	// New Functions by Avenue
	int npc_get_ip(lua_State* L)
	{
		LPCHARACTER npc = CQuestManager::instance().GetCurrentNPCCharacterPtr();
		lua_pushnumber(L, npc->GetDesc()->GetHostName());
		return 1;
	}

	int npc_get_level(lua_State* L)
	{
		LPCHARACTER npc = CQuestManager::instance().GetCurrentNPCCharacterPtr();
		lua_pushnumber(L, npc->GetLevel());
		return 1;
	}

	int npc_get_name(lua_State* L)
	{
		LPCHARACTER npc = CQuestManager::instance().GetCurrentNPCCharacterPtr();
		lua_pushnumber(L, npc->GetName());
		return 1;
	}

	int npc_get_job(lua_State* L)  
	{
		LPCHARACTER npc = CQuestManager::instance().GetCurrentNPCCharacterPtr();
		lua_pushnumber(L, npc->GetJob());
		return 1;
	}
	// New Functions by Avenue end
			// New Functions by Avenue
			{ "get_ip",			npc_get_ip	},
			{ "get_level",		npc_get_level	},
			{ "get_name",		npc_get_name	},
			{ "get_job",		npc_get_job	},
			// New Functions by Avenue end
 
 
Great thanks to Sanchez,InyaProduction,Metin2 Team, Xunil , etc. @ Metin2Dev
  • Metin2 Dev 14
  • Confused 1
  • Good 1
  • Love 12
Link to comment
Share on other sites

  • Premium
pc_set_coins
 
There's already this function (charge_cash_by_voucher or something)
 
pc_get_empire_name > this should go into questlib for localization reasons
 
About your npc functions, npc.get_vid makes them redundant as you can just select the npc and use existing pc functions with it.
 
pc.kill and pc.get_ip seem the most useful for me.
 

 

Thanks for sharing anyway :)
  • Love 2
Link to comment
Share on other sites

Announcements



×
×
  • Create New...

Important Information

Terms of Use / Privacy Policy / Guidelines / We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.