• There is NO official Otland's Discord server and NO official Otland's server list. The Otland's Staff does not manage any Discord server or server list. Moderators or administrator of any Discord server or server lists have NO connection to the Otland's Staff. Do not get scammed!
  • 2026 staff recruitment is open! Check it out and consider applying!

Pomoc z wypakowaniem tabeli w LUA

Seminari

Banned User
Joined
Dec 13, 2009
Messages
1,496
Reaction score
34
Location
Poland
Nie ogarniam jak wypakować tabele

getMonsterInfo(name)
getItemRWInfo(uid)

tak by wyświetliło możliwe parametry?

w monster info wiem, że mogę się odwoływać np. getMonsterInfo(name).loot itd... ale chce poznać jakie jeszcze mają atrybuty czyli by wypakowało tabele tak:

monster =
{loot, name itd.}
 
getMonsterInfo:
setField(L, "name", mType->name.c_str());
setField(L, "description", mType->nameDescription.c_str());
setField(L, "experience", mType->experience);
setField(L, "health", mType->health);
setField(L, "healthMax", mType->healthMax);
setField(L, "manaCost", mType->manaCost);
setField(L, "defense", mType->defense);
setField(L, "armor", mType->armor);
setField(L, "baseSpeed", mType->baseSpeed);
setField(L, "lookCorpse", mType->lookCorpse);
setField(L, "race", mType->race);
setField(L, "skull", mType->skull);
setField(L, "partyShield", mType->partyShield);
setFieldBool(L, "summonable", mType->isSummonable);
setFieldBool(L, "illusionable", mType->isIllusionable);
setFieldBool(L, "convinceable", mType->isConvinceable);
setFieldBool(L, "attackable", mType->isAttackable);
setFieldBool(L, "hostile", mType->isHostile);

tablica defenses:
setField(L, "speed", it->speed);
setField(L, "chance", it->chance);
setField(L, "range", it->range);

setField(L, "minCombatValue", it->minCombatValue);
setField(L, "maxCombatValue", it->maxCombatValue);
setField(L, "maxCombatValue", it->maxCombatValue);
setFieldBool(L, "isMelee", it->isMelee);
tablica attacks:
setField(L, "speed", it->speed);
setField(L, "chance", it->chance);
setField(L, "range", it->range);

setField(L, "minCombatValue", it->minCombatValue);
setField(L, "maxCombatValue", it->maxCombatValue);
setFieldBool(L, "isMelee", it->isMelee);
tablica loot:
setField(L, "id", lit->ids[0]);

setField(L, "count", lit->count);
setField(L, "chance", lit->chance);
setField(L, "subType", lit->subType);
setField(L, "actionId", lit->actionId);
setField(L, "uniqueId", lit->uniqueId);
setField(L, "text", lit->text);
tablica summons:
setField(L, "name", sit->name);
setField(L, "chance", sit->chance);

setField(L, "interval", sit->interval);
setField(L, "amount", sit->amount);
getItemRWInfo nie zwraca chyba tablic tylko sume bitów oznaczaacoczy coś jest czytalne (0x01) czy pisalne (0x02)
 
Last edited:
Code:
for key, value in pairs(getMonsterInfo(name)) do print(key .. ' => ' .. value) end

Ewenetualnie w source sprawdz.

Tak to próbowałem już ale tablice w monsterze składają się chyba na coś takiego:
Code:
[name] = {
{x =},
{loot = {a=chance1,b=chance2,c=chance3,d=chance4, child={e=chancechild1,s=chancechild2}},
}

;/


Wiem jak wypakować to pokolei, ale czy jest inny sposób bo nie chcę się pierdolić w takie, żeby dawać do każdego wypakowywanie? Jak np.:

Code:
for k, l in pairs(getMonsterInfo(getCreatureName(itemEx.uid)).summons) do
			lolek = lolek .."(".. k .. ") Name: [" .. l.name .. "] Chance: ".. l.chance.." Interval: ".. l.interval .." Amount: ".. l.amount .."\n"
			end
 
Last edited:
Code:
function unpack(t)
	local str = ""
	for key, value in pairs(t) do
		if type(value) == "table" then
			str = str .. "--------\n[Table]" .. key .. ":\n"
			str = str .. unpack(value)
			str = str .. "--------"
		else
			str = str .. key .. " => " .. (type(value) ~= "boolean" and value or value and "True" or "False") .. "\n"
		end
	end
	return str
end


function onUse(cid, item, fromPosition, itemEx, toPosition)
	doWriteLogFile('dragon.txt', unpack(getMonsterInfo('Dragon')))
	return true
end

Code:
[22/01/2012 09:32:50] description => a dragon
skull => 0
healthMax => 1000
hostile => True
armor => 25
illusionable => True
--------
[Table]outfit:
lookAddons => 0
lookType => 34
lookHead => 0
lookTypeEx => 0
lookLegs => 0
lookBody => 0
lookFeet => 0
----------------
[Table]summons:
----------------
[Table]loot:
--------
[Table]1:
text => 
count => 80
actionId => -1
chance => 75000
uniqueId => -1
subType => -1
id => 2148
----------------
[Table]2:
text => 
count => 30
actionId => -1
chance => 15000
uniqueId => -1
subType => -1
id => 2148
----------------
[Table]3:
text => 
count => 1
actionId => -1
chance => 1050
uniqueId => -1
subType => -1
id => 2434
----------------
[Table]4:
text => 
count => 1
actionId => -1
chance => 3333
uniqueId => -1
subType => -1
id => 2457
----------------
[Table]5:
text => 
count => 3
actionId => -1
chance => 66666
uniqueId => -1
subType => -1
id => 2672
----------------
[Table]6:
text => 
count => 1
actionId => -1
chance => 15000
uniqueId => -1
subType => -1
id => 2509
----------------
[Table]7:
text => 
count => 1
actionId => -1
chance => 25000
uniqueId => -1
subType => -1
id => 2406
----------------
[Table]8:
text => 
count => 1
actionId => -1
chance => 10000
uniqueId => -1
subType => -1
id => 12413
----------------
[Table]9:
text => 
count => 1
actionId => -1
chance => 20000
uniqueId => -1
subType => -1
id => 2398
----------------
[Table]10:
text => 
count => 1
actionId => -1
chance => 10000
uniqueId => -1
subType => -1
id => 2455
----------------
[Table]11:
text => 
count => 12
actionId => -1
chance => 8000
uniqueId => -1
subType => -1
id => 2546
----------------
[Table]12:
text => 
count => 1
actionId => -1
chance => 4000
uniqueId => -1
subType => -1
id => 2397
----------------
[Table]13:
text => 
count => 1
actionId => -1
chance => 2000
uniqueId => -1
subType => -1
id => 2647
----------------
[Table]14:
text => 
count => 1
actionId => -1
chance => 1000
uniqueId => -1
subType => -1
id => 2409
----------------
[Table]15:
text => 
count => 1
actionId => -1
chance => 1333
uniqueId => -1
subType => -1
id => 2387
----------------
[Table]16:
--------
[Table]child:
--------
[Table]1:
text => 
count => 1
actionId => -1
chance => 2500
uniqueId => -1
subType => -1
id => 2413
----------------
[Table]2:
text => 
count => 1
actionId => -1
chance => 1333
uniqueId => -1
subType => -1
id => 5920
----------------
[Table]3:
text => 
count => 1
actionId => -1
chance => 750
uniqueId => -1
subType => -1
id => 2145
----------------
[Table]4:
text => 
count => 1
actionId => -1
chance => 1333
uniqueId => -1
subType => -1
id => 7588
----------------
[Table]5:
text => 
count => 1
actionId => -1
chance => 1000
uniqueId => -1
subType => -1
id => 2187
----------------
[Table]6:
text => 
count => 1
actionId => -1
chance => 333
uniqueId => -1
subType => -1
id => 2177
----------------
[Table]7:
text => 
count => 1
actionId => -1
chance => 666
uniqueId => -1
subType => -1
id => 2516
----------------
[Table]8:
text => 
count => 1
actionId => -1
chance => 1250
uniqueId => -1
subType => -1
id => 5877
----------------
[Table]9:
text => 
count => 1
actionId => -1
chance => 500
uniqueId => -1
subType => -1
id => 7430
----------------text => 
count => 1
actionId => -1
chance => 100000
uniqueId => -1
subType => -1
id => 1987
----------------summonable => False
lookCorpse => 5973
--------
[Table]attacks:
--------
[Table]1:
isMelee => True
maxCombatValue => -120
speed => 2000
chance => 100
range => 1
minCombatValue => 0
----------------
[Table]2:
isMelee => False
maxCombatValue => -170
speed => 2000
chance => 10
range => 0
minCombatValue => -100
----------------
[Table]3:
isMelee => False
maxCombatValue => -140
speed => 2000
chance => 12
range => 7
minCombatValue => -60
----------------defense => 18
attackable => True
guildEmblem => 0
race => 2
--------
[Table]defenses:
--------
[Table]1:
isMelee => False
maxCombatValue => 55
speed => 2000
chance => 10
range => 0
minCombatValue => 30
----------------baseSpeed => 180
name => Dragon
partyShield => 0
convinceable => False
manaCost => 0
experience => 700
health => 1000

Takie cos?
 
Back
Top