|
You last visited: Today at 13:26
Advertisement
[40k/Src]item.get_attr function gesucht
Discussion on [40k/Src]item.get_attr function gesucht within the Metin2 Private Server forum part of the Metin2 category.
08/25/2015, 00:57
|
#1
|
elite*gold: 0
Join Date: Jan 2009
Posts: 267
Received Thanks: 103
|
[40k/Src]item.get_attr function gesucht
hallo,
da ich vorher die vanilla game hatte und jzt 40k game source suche ich nach diesen function in der vanilla ist es die:
item.get_attr_type
item.get_attr_value
bei den 40k was brauch ich da und wo muss ich die neue einfügen?
danke im vorraus und nen schönen abend wünsche ich euch
|
|
|
08/25/2015, 02:24
|
#2
|
elite*gold: 26
Join Date: Jan 2009
Posts: 1,175
Received Thanks: 469
|
Such in der questlua_item.cpp nach (Zeile 461 bei mir) :
PHP Code:
int item_copy_and_give_before_remove(lua_State* L) { lua_pushboolean(L, 0); if (!lua_isnumber(L, 1)) return 1;
DWORD vnum = (DWORD)lua_tonumber(L, 1);
CQuestManager& q = CQuestManager::instance(); LPITEM pItem = q.GetCurrentItem(); LPCHARACTER pChar = q.GetCurrentCharacterPtr();
LPITEM pkNewItem = ITEM_MANAGER::instance().CreateItem(vnum, 1, 0, false);
if (pkNewItem) { ITEM_MANAGER::CopyAllAttrTo(pItem, pkNewItem); LogManager::instance().ItemLog(pChar, pkNewItem, "COPY SUCCESS", pkNewItem->GetName());
BYTE bCell = pItem->GetCell();
ITEM_MANAGER::instance().RemoveItem(pItem, "REMOVE (COPY SUCCESS)");
pkNewItem->AddToCharacter(pChar, TItemPos(INVENTORY, bCell)); ITEM_MANAGER::instance().FlushDelayedSave(pkNewItem); pkNewItem->AttrLog();
// ¼º°ø! lua_pushboolean(L, 1); }
return 1; }
Füg darunter Die beiden Funktionen ein :
PHP Code:
int item_get_attr_type(lua_State* L) { CQuestManager& q = CQuestManager::instance(); LPITEM item = q.GetCurrentItem();
if (!item) { sys_err("cannot get current item"); lua_pushnumber(L, 0); return 1; }
if (false == lua_isnumber(L, 1)) { sys_err("index is not a number"); lua_pushnumber(L, 0); return 1; }
int index = lua_tonumber(L, 1); const TPlayerItemAttribute& attrItem = item->GetAttribute(index); lua_pushnumber(L, attrItem.bType);
return 1; }
PHP Code:
int item_get_attr_value(lua_State* L) { CQuestManager& q = CQuestManager::instance(); LPITEM item = q.GetCurrentItem();
if (!item) { sys_err("cannot get current item"); lua_pushnumber(L, 0); return 1; }
if (false == lua_isnumber(L, 1)) { sys_err("index is not a number"); lua_pushnumber(L, 0); return 1; }
int index = lua_tonumber(L, 1); const TPlayerItemAttribute& attrItem = item->GetAttribute(index); lua_pushnumber(L, attrItem.sValue);
return 1; }
& nun suchst du nach luaL_Reg item_functions[] = : und fügst Folgendes ein :
PHP Code:
{ "get_attr_type", item_get_attr_type}, { "get_attr_value", item_get_attr_value},
|
|
|
08/25/2015, 11:42
|
#3
|
elite*gold: 2
Join Date: Jun 2013
Posts: 1,063
Received Thanks: 1,725
|
du hast die item_get_attr_value vergessen, bzw hast die falsche reingestellt.
|
|
|
08/25/2015, 14:40
|
#4
|
elite*gold: 0
Join Date: Jan 2009
Posts: 267
Received Thanks: 103
|
Quote:
Originally Posted by xXGaardenXx
Such in der questlua_item.cpp nach (Zeile 461 bei mir) :
PHP Code:
int item_copy_and_give_before_remove(lua_State* L) { lua_pushboolean(L, 0); if (!lua_isnumber(L, 1)) return 1; DWORD vnum = (DWORD)lua_tonumber(L, 1); CQuestManager& q = CQuestManager::instance(); LPITEM pItem = q.GetCurrentItem(); LPCHARACTER pChar = q.GetCurrentCharacterPtr(); LPITEM pkNewItem = ITEM_MANAGER::instance().CreateItem(vnum, 1, 0, false); if (pkNewItem) { ITEM_MANAGER::CopyAllAttrTo(pItem, pkNewItem); LogManager::instance().ItemLog(pChar, pkNewItem, "COPY SUCCESS", pkNewItem->GetName()); BYTE bCell = pItem->GetCell(); ITEM_MANAGER::instance().RemoveItem(pItem, "REMOVE (COPY SUCCESS)"); pkNewItem->AddToCharacter(pChar, TItemPos(INVENTORY, bCell)); ITEM_MANAGER::instance().FlushDelayedSave(pkNewItem); pkNewItem->AttrLog(); // ¼º°ø! lua_pushboolean(L, 1); } return 1; }
Füg darunter Die beiden Funktionen ein :
PHP Code:
int item_get_attr_type(lua_State* L) { CQuestManager& q = CQuestManager::instance(); LPITEM item = q.GetCurrentItem(); if (!item) { sys_err("cannot get current item"); lua_pushnumber(L, 0); return 1; } if (false == lua_isnumber(L, 1)) { sys_err("index is not a number"); lua_pushnumber(L, 0); return 1; } int index = lua_tonumber(L, 1); const TPlayerItemAttribute& attrItem = item->GetAttribute(index); lua_pushnumber(L, attrItem.bType); return 1; }
PHP Code:
int item_set_attr(lua_State* L) { CQuestManager& q = CQuestManager::instance(); LPITEM item = q.GetCurrentItem(); if (!item) { sys_err("item_set_attr: cannot get current item"); lua_pushboolean(L, 0); return 1; } if (false == lua_isnumber(L, 1)) { sys_err("item_set_attr: first argument must be attr_id"); lua_pushboolean(L, 0); return 1; } int vnum = lua_tonumber(L, 1); if (false == lua_isnumber(L, 2)) { sys_err("item_set_attr: second argument must be attr_value"); lua_pushboolean(L, 0); return 1; } int value = lua_tonumber(L, 2); int pos = 0; if (true == lua_isnumber(L, 3)) { pos = lua_tonumber(L, 3); } item->SetAttribute(pos, (BYTE)vnum, (short)value); lua_pushboolean(L, 1); return 1; }
& nun suchst du nach luaL_Reg item_functions[] = : und fügst Folgendes ein :
PHP Code:
{ "get_attr_type", item_get_attr_type}, { "get_attr_value", item_get_attr_value},
|
Danke dir fehlt nur item.get_attr_value wie mein vor poster es gesagt hat
|
|
|
08/25/2015, 16:25
|
#5
|
elite*gold: 26
Join Date: Jan 2009
Posts: 1,175
Received Thanks: 469
|
Quote:
Originally Posted by ProfessorEnte
du hast die item_get_attr_value vergessen, bzw hast die falsche reingestellt.
|
Im ersten Beitrag nun auch die Richtige eingefügt
Hier nochmal die Richtige war gestern schon zu spät
PHP Code:
int item_get_attr_value(lua_State* L) { CQuestManager& q = CQuestManager::instance(); LPITEM item = q.GetCurrentItem();
if (!item) { sys_err("cannot get current item"); lua_pushnumber(L, 0); return 1; }
if (false == lua_isnumber(L, 1)) { sys_err("index is not a number"); lua_pushnumber(L, 0); return 1; }
int index = lua_tonumber(L, 1); const TPlayerItemAttribute& attrItem = item->GetAttribute(index); lua_pushnumber(L, attrItem.sValue);
return 1; }
|
|
|
|
Similar Threads
|
[LIB]Item2, PC2 (set_attr, get_attr, equip, set_level und mehr)
06/18/2014 - Metin2 PServer Guides & Strategies - 58 Replies
Hey,
Lib enthält folgende Funktionen/Lib contains the following functions:
# function(arguments) -- return type - notes
item2.get_wearflag() -- int
item2.is_wearflag(WEAR_FLAG) -- bool
item2.set_attr(index, type, value) -- bool
item2.get_attr(index) -- int, int
item2.equip(slot) -- bool - equips the current item to the wearslot "slot"
pc2.give_or_drop_item_and_select(int vnum||string item_name) -- official function
|
Auto item drop function.
04/12/2011 - Conquer Online 2 - 2 Replies
Ive been waiting for this for such a long time: A program that drops items in ur bag accept for special ones (+1, elite, super, mets, dbs, etc). I guess its not impossible to make because bots can do it to.
I guess it would work by pressing ctrl+d (drop) and then it would auto drop 9 items in a second. Without opening my bag or loosing control over my mouse.
Does anyone have such a problem or can make one? Ive serched trought the forum but coudnt find it (sorry if im wrong)
Would be...
|
[HELP] CoEmu - Use item function
05/31/2009 - CO2 Private Server - 3 Replies
Hey. I make a class money bag.
Have 1 problem.
Here is my code:
So what is my problem? Function
Dont work how to fix it? please help me.
|
All times are GMT +2. The time now is 13:26.
|
|