Jump to content
  • 0

Quest Functions


Despero

Question

Hello M2Dev,

 

i need this quest functions for mainline_released source

  • item2.equip
  • item2.get_attr
  • item2.get_wearflag
  • item2.is_wearflag
  • item2.set_attr
  • npc2.get_level
  • npc2.get_pc_pid
  • npc2.get_pc_vid
  • npc2.select
  • pc2.give_or_drop_item_and_select
  • pc2.send_effect
  • pc2.set_level

A how to with this Quest functions was very nice :D

 

Here is the topic from the QUest functions http://www.elitepvpers.com/forum/metin2-pserver-guides-strategies/3225317-lib-source-34k-imers-libgame-random-collection-stuff.html

Link to comment
  • Answers 2
  • Created
  • Last Reply

Top Posters For This Question

Popular Days

Top Posters For This Question

2 answers to this question

Recommended Posts

  • 0

ITEM:

int item_get_wearflag(lua_State* L)
{
LPITEM item = CQuestManager::instance().GetCurrentItem();
if(item)
{
lua_pushnumber(L,item->GetProto()->dwWearFlags);
return 1;
}
lua_pushnumber(L,0);
return 1;
}

int item_is_wearflag(lua_State* L)
{
LPITEM item = CQuestManager::instance().GetCurrentItem();
if(item)
{
lua_pushboolean(L,(item->GetProto()->dwWearFlags & (DWORD)lua_tonumber(L,1)));
return 1;
}
lua_pushnumber(L,0);
return 1;
}

int item_get_attr(lua_State* L)
{
LPITEM item = CQuestManager::instance().GetCurrentItem();

if(!lua_isnumber(L,1) || !item)
{
return 0;
}

int attr_index = lua_tonumber(L,1);

if(attr_index < 0 || attr_index > 6)
{
return 0;
}

TPlayerItemAttribute attr = item->GetAttribute(attr_index);
lua_pushnumber(L,attr.bType);
lua_pushnumber(L,attr.sValue);
return 2;
}

int item_set_attr(lua_State* L)
{
LPITEM item = CQuestManager::instance().GetCurrentItem();

if(!lua_isnumber(L,1) || !lua_isnumber(L,2) || !lua_isnumber(L,3) || !item)
{
lua_pushboolean(L,false);
return 1;
}

int attr_index = lua_tonumber(L,1);

if(attr_index < 0 || attr_index > 6)
{
lua_pushboolean(L,false);
return 1;
}

item->SetForceAttribute(attr_index,lua_tonumber(L,2),lua_tonumber(L,3));
lua_pushboolean(L,true);
return 1;
}

int item_equip(lua_State* L)
{
LPITEM item = CQuestManager::instance().GetCurrentItem();
LPCHARACTER ch = CQuestManager::instance().GetCurrentCharacterPtr();

if(!lua_isnumber(L,1) || !item || !ch)
{
lua_pushboolean(L,false);
return 1;
}

int equipcell = lua_tonumber(L,1);

LPITEM wear = ch->GetWear(equipcell);

if(wear)
{
ch->UnequipItem(wear);
}
item->EquipTo(ch,equipcell);
lua_pushboolean(L,true);
return 1;
}

NPC:

int npc_get_vid(lua_State* L)
{
CQuestManager& q = CQuestManager::instance();
LPCHARACTER npc = q.GetCurrentNPCCharacterPtr();


lua_pushnumber(L, npc->GetVID());




return 1;
}


int npc_get_level(lua_State* L) 
{
LPCHARACTER ch = CQuestManager::instance()->GetCurrentNPCCharacterPtr();


if(ch != NULL) 
{
lua_pushnumber(L, pkCh->GetLevel());
}
else
{
lua_pushnil(L);
}
return 1;
}


int npc_get_pid(lua_State* L)
{
CQuestManager & q = CQuestManager::instance();
LPCHARACTER npc = q.GetCurrentNPCCharacterPtr();
lua_pushnumber(L, npc->GetPlayerID());
return 1;
}


int npc_select(lua_State* L)
{
if(lua_isnumber(L,1))
{
DWORD vid = lua_tonumber(L, 1);
LPCHARACTER pc = CQuestManager::instance().GetCurrentCharacterPtr();
LPCHARACTER ch = CHARACTER_MANAGER::instance().Find(vid);
if(ch)
{
pc->SetQuestNPCID(vid);
lua_pushnumber(L, 1);
return 1;
}
}
lua_pushnumber(L,0);
return 1;
}

PC:

int pc2_set_level(lua_State* L)
{
LPCHARACTER ch = CQuestManager::instance().GetCurrentCharacterPtr();


if (ch && lua_isnumber(L, 1)) 
{
ch->ResetPoint(lua_tonumber(L, 1));
lua_pushboolean(L, 1);
return 1;
}


lua_pushboolean(L, 0);
return 1;
}


int pc2_send_effect(lua_State *L)
{
LPCHARACTER ch = CQuestManager::instance().GetCurrentCharacterPtr();


    if (ch != NULL)
{
if (lua_isstring(L, 1))
{
ch->SpecificEffectPacket(lua_tostring(L, 1));
}
} 
else 
{
lua_pushnumber(L, 0);
}


return 1;
}

  • Love 1
Link to comment

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now


×
×
  • 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.