I reread the initial post and took this part as the most important with the code being possible things that might pop up from it. I was really hoping for more rare recipes like the horadric cube but this appears to be all there is:
A neat tidbit small note that I have thought very cool is that when you polypile the items the successful items(s) go into your inventory instead of just sitting there. That is pretty awesome IMHO.
Code: Select all
-- Polypile Wand - 0x502
pp_food = {
0x117, -- fish
0x12a, -- cheese
0x12b, -- bread
0x17f, --boiled egg
0x500, --carrot
0x12c, -- meat
0x440, --fortune cookie
0x530, 0x54d, 0x54e, 0x54f, 0x550, 0x551, 0x552, 0x553, 0x554, 0x556, 0x557, 0x559, 0x599, 0x59a
}
pp_gems = {
0x427, -- diamond
0x428, -- emerald
0x429, -- ruby
0x42a, -- sapphire
0x42c, -- onyx
0x42d, -- topaz
0x42e, -- amethyst
0x42f, -- zircon
0x430 -- fire opal
}
pp_potions = {
0x104, -- yellow potion
0x105, -- blue potion
0x106, -- red potion
0x160, -- black potion
0x161, -- green potion
0x162, -- white potion
0x163, -- orange potion
0x164, -- cyan potion
0x165, -- lime potion
0x166, -- brown potion
0x167, -- clear potion
0x168, -- purple potion
0x169, -- pink potion
0x16b, -- mega yellow potion
0x16c -- mega blue potion
}
pp_scrolls = {
0x41d, -- blank scroll
0x120, -- ressurection scroll
0x125, -- town portal scroll
0x13a, -- scroll of unweld
0x13b, -- scroll of uncurse
0x13c, -- scroll of identify
0x16d -- raise pet scroll
}
pp_reagents = {
0x146, -- black_pearl
0x147, -- blood moss
0x148, -- garlic
0x149, -- ginseng
0x14a, -- mandrake root
0x14b, -- nightshade
0x14c, -- spider's silk
0x14d -- sulphurous ash
}
pp_parts = {
0x401, -- eye
0x403, -- heart
0x406, -- ooze
0x407, -- brain
0x402, -- horn
0x404, -- carapace
0x405, -- fang
0x40a, -- diseased bandage
0x40b, -- sparkling mote
0x412, -- dragon hide
0x41b, -- raw glass
0x41e, -- cowhide
0x528, -- wet clay
0x52d, -- hydra fang
0x52e, -- glowing ember
0x5e4 -- magic spleen
}
pp_rare_items = {
0x17c, -- khaki potion
0x502, -- polypile wand
0x43e, -- goblin brew
0x432, -- golem power crystal
0x107, -- sextant
0x53b, -- deconstruction wand
0x529, -- healing ward
0x52a -- fire ward
}
pp_rare_mobs = {
0x297, -- cow
0x264, -- horse
0x24a, -- rabbit
0x255, -- wisp
0x213, -- bat
0x21b, -- rat
0x298, -- insect swarm
0x210, -- snake
0x21a -- slime
}
pp_crafting_materials = {
0x118, -- ingot
0x115, -- log
0x40e, -- cloth
0x40f, -- leather
}
pp_crafting_weapon_enchants = {
{0x1,4} -- +ATK, max +5; accept up to +4s
}
pp_crafting_armour_enchants = {
{0x7,3}, -- +DEF, max +4; accept up to +3s
{0x4,14}, -- +DEX, max +15; accept up to +14s
{0x3,14}, -- +STR, max +15; accept up to +14s
{0x2,14}, -- +INT, max +15; accept up to +14s
}
pp_crafting_weapon_tints = {
0,
0x3, -- copper
0x6, -- silver
0x7, -- gold
0xa, -- venomous
}
pp_crafting_metal_armour_tints = {
0,
0x1, -- steel
0x3, -- copper
0x6, -- silver
0x7, -- gold
0xc, -- blackrock
}
pp_crafting_wooden_armour_tints = {
0,
0x3, -- oak
0x6, -- silverleaf
0x7, -- ash
0xc, -- ebony
}
pp_crafting_leather_armour_tints = {
0,
0x1, -- studded
0x3, -- boiled
0x6, -- silverhide
0x7, -- goldhide
0xc, -- darkhide
}
pp_crafting_cloth_armour_tints = {
0,
0x3, -- boiled
0x6, -- silverweave
0x7, -- goldweave
0xc, -- darkweave
}
accepted_crafting_materials={}
for i=1,#pp_crafting_materials do
for j=1,#pp_crafting_weapon_enchants do
for k=1,pp_crafting_weapon_enchants[j][2] do
for l=1,#pp_crafting_weapon_tints do
tmp_itm=make_code(pp_crafting_materials[i],pp_crafting_weapon_tints[l],pp_crafting_weapon_enchants[j][1],k)
table.insert(accepted_crafting_materials,tmp_itm)
end
end
end
for j=1,#pp_crafting_armour_enchants do
for k=1,pp_crafting_armour_enchants[j][2] do
for l=1,#pp_crafting_metal_armour_tints do
tmp_itm=make_code(pp_crafting_materials[i],pp_crafting_metal_armour_tints[l],pp_crafting_armour_enchants[j][1],k)
table.insert(accepted_crafting_materials,tmp_itm)
end
for l=1,#pp_crafting_wooden_armour_tints do
tmp_itm=make_code(pp_crafting_materials[i],pp_crafting_wooden_armour_tints[l],pp_crafting_armour_enchants[j][1],k)
table.insert(accepted_crafting_materials,tmp_itm)
end
for l=1,#pp_crafting_leather_armour_tints do
tmp_itm=make_code(pp_crafting_materials[i],pp_crafting_leather_armour_tints[l],pp_crafting_armour_enchants[j][1],k)
table.insert(accepted_crafting_materials,tmp_itm)
end
for l=1,#pp_crafting_cloth_armour_tints do
tmp_itm=make_code(pp_crafting_materials[i],pp_crafting_cloth_armour_tints[l],pp_crafting_armour_enchants[j][1],k)
table.insert(accepted_crafting_materials,tmp_itm)
end
end
end
end
function use_502 (id,tgt_id,alt,itm,bcode,x,y,z)
local plyr=get_player_ptr(id)
local race=sc:get_racename(plyr.race)
local map=get_map_ptr(z)
if(map:feature_is_hook(x,y) and plyr.account_name~=map:get_feat_text(x,y)) then
send_message(id, "Not here!");
return
end
-- go thru the pile of items and make sure they are either ownerless or owned by user
-- also no poly soulbound
local ptr=map:get_item_ptr(x,y)
local pilecnt=0
local i1=Item(0)
local i2=Item(0)
local i3=Item(0)
local cnt=0
while ptr~=nil and cnt<3 do
if(ptr.owner~="" and ptr.owner~=plyr.name or is_no_drop(ptr.code) or ptr.furniture) then
send_message(id, "There are items here that are either not yours or are soulbound!");
return;
end
if cnt==0 then
i1=ptr.code
if ptr.qty>1 then
i2=ptr.code
if ptr.qty>2 then
i3=ptr.code
break
end
end
end
if cnt==1 then
if not i2:isValid() then
i2=ptr.code
if ptr.qty>1 then
i3=ptr.code
break
end
else
i3=ptr.code
break
end
end
if cnt==2 then
i3=ptr.code
end
ptr=ptr.next
cnt=cnt+1
end
if not i1:isValid() or not i2:isValid() or not i3:isValid() then
send_message(id, "Requires at least three items in the pile!")
return
end
local i4 = 0
local i5 = 0
-- yellow pot+2other pot->2mead
if race=="dwarf" and get_base_code(i1)==0x104 and in_array(get_base_code(i2), pp_potions) and in_array(get_base_code(i3), pp_potions) then
i4=0x5b3
i5=0x5b3
elseif race=="dwarf" and get_base_code(i1)==0x105 and in_array(get_base_code(i2), pp_potions) and in_array(get_base_code(i3), pp_potions) then
i4=0x5b4
i5=0x5b4
elseif race=="dwarf" and get_base_code(i1)==0x106 and in_array(get_base_code(i2), pp_potions) and in_array(get_base_code(i3), pp_potions) then
i4=0x5b2
i5=0x5b2
elseif (wl:is_weapon(i1) or wl:is_wearable(i1)) and (wl:is_weapon(i2) or wl:is_wearable(i2)) and (wl:is_weapon(i3) or wl:is_wearable(i3)) and wl:is_enchanted(i1) and wl:is_enchanted(i2) and wl:is_enchanted(i3) then
-- sev's polypile
local ia={i1,i2,i3}
local t=0
local found=0
local i
for i=1,3 do
local m=get_to_mod(ia[i])
local v=get_modifier(ia[i])
if m==MP_WEAPON_BONUS then
if v>MAX_WEAPON_BONUS then v=MAX_WEAPON_BONUS end
t=t+16*v/MAX_WEAPON_BONUS
found=found+1
elseif m==MP_ARMOUR_BONUS then
if v>MAX_ARMOUR_BONUS then v=MAX_ARMOUR_BONUS end
t=t+16*v/MAX_ARMOUR_BONUS
found=found+1
elseif m==MP_INT_BONUS or m==MP_STR_BONUS or m==MP_DEX_BONUS then
if v>MAX_ITEM_STAT_BONUS then v=MAX_ITEM_STAT_BONUS end
t=t+16*(v-MIN_ITEM_STAT_BONUS)/(MAX_ITEM_STAT_BONUS-MIN_ITEM_STAT_BONUS)
found=found+1
elseif m==MP_VIGOUR then
if v>MAX_VIGOUR_BONUS then v=MAX_VIGOUR_BONUS end
t=t+16*(v-MIN_VIGOUR_BONUS)/(MAX_VIGOUR_BONUS-MIN_VIGOUR_BONUS)
found=found+1
elseif m==MP_MAGIC_RESISTANCE then
if v>MAX_MR_BONUS then v=MAX_MR_BONUS end
t=t+16*v/MAX_MR_BONUS
found=found+1
elseif m==MP_NIGHTVISION then
if v>MAX_NV_BONUS then v=MAX_NV_BONUS end
t=t+16*v/MAX_NV_BONUS
found=found+1
elseif m==MP_LEECHING then
if v>3 then v=3 end
t=t+2*v+5
found=found+1
elseif m==MP_ENCHANTED then
t=t+int_rand(6)+10
found=found+1
end
end
if found~=3 then
send_message(id, "Nothing happened.")
return
end
local q=t/3 -- work out avg
local itm=wl:get_rand_weapon_armour()
-- itm=Item(0x72)
i4=random_enchant(itm, q)
-- end_message(id,"q="..q.." result="..wl:get_full_name(i4))
-- for plain orbs, runes, rods
elseif in_array(get_base_code(i1),{0x036,0x037,0x038}) and in_array(get_base_code(i2),{0x036,0x037,0x038}) and in_array(get_base_code(i3),{0x036,0x037,0x038}) then
if math.random(1,3)==1 then i4=0x036
elseif math.random(1,2)==1 then i4=0x037
else i4=0x038 end
if math.random(1,3)==1 then i5=0x036
elseif math.random(1,2)==1 then i5=0x037
else i5=0x038 end
elseif wl:is_food(i1) and wl:is_food(i2) and wl:is_food(i3) then
i4 = get_random_element(pp_food)
i5 = get_random_element(pp_food)
elseif in_array(get_base_code(i1), pp_gems) and in_array(get_base_code(i2), pp_gems) and in_array(get_base_code(i3), pp_gems) then
i4 = get_random_element(pp_gems)
i5 = get_random_element(pp_gems)
elseif in_array(get_base_code(i1), pp_potions) and in_array(get_base_code(i2), pp_potions) and in_array(get_base_code(i3), pp_potions) then
i4 = get_random_element(pp_potions)
i5 = get_random_element(pp_potions)
elseif in_array(get_base_code(i1), pp_scrolls) and in_array(get_base_code(i2), pp_scrolls) and in_array(get_base_code(i3), pp_scrolls) then
i4 = get_random_element(pp_scrolls)
i5 = get_random_element(pp_scrolls)
elseif in_array(get_base_code(i1), pp_reagents) and in_array(get_base_code(i2), pp_reagents) and in_array(get_base_code(i3), pp_reagents) then
i4 = get_random_element(pp_reagents)
i5 = get_random_element(pp_reagents)
elseif in_array(get_base_code(i1), pp_parts) and in_array(get_base_code(i2), pp_parts) and in_array(get_base_code(i3), pp_parts) then
i4 = get_random_element(pp_parts)
i5 = get_random_element(pp_parts)
elseif i1 == i2 and i2 == i3 and in_array(i1, accepted_crafting_materials) then
i4 = make_code(get_base_code(i1), get_material(i1), get_to_mod(i1), get_modifier(i1)+1)
else
send_message(id, "Nothing happened.")
return
end
if math.random(1,25) == 1 then
local rr = math.random(1,3) -- rare item, mob or explosion
if rr == 1 then -- rare item
i4 = get_random_element(pp_rare_items)
map:remove_item(x,y)
map:remove_item(x,y)
map:remove_item(x,y)
--map:add_item(x,y,1,Item(i4),true,game_time,plyr.name)
give_item(id,Item(i4),1)
send_message(id, "Something strange happened!")
update_fov(id)
return
elseif rr == 2 or PERMADEATH then -- summon mob
map:remove_item(x,y)
map:remove_item(x,y)
map:remove_item(x,y)
m = spawn_at(get_random_element(pp_rare_mobs), x, y, plyr.map_level)
if math.random(1,3) == 1 then
m.large = true
m:set_hp_max(m:get_hp_max() * 10)
save_achievement(id, 12)
end
simple_send_event(id,EVENT_MAGIC,0x17,x,y)
send_message(id, "Something strange happened!")
update_fov(id)
return
else -- explosion
map:remove_item(x,y)
map:remove_item(x,y)
map:remove_item(x,y)
-- send_message(id, "Explosion!")
send_event(plyr.map_level,-1,x,y,26,0); -- 26 is explosion
agls = 45
for d = 1, 3 do
for a = 0, 360, agls / (2 ^ (d-1)) do
xx = x + d * math.cos(math.rad(a))
yy = y + d * math.sin(math.rad(a))
ptr=get_sent_ptr_xyz(xx,yy,plyr.map_level)
if ptr~=nil and not ptr:is_dm() and ptr.id < 100 then
hurt(ptr.id, math.random(10,30), "the explosion")
end
end
end
update_fov(id)
return
end
else
map:remove_item(x,y)
map:remove_item(x,y)
map:remove_item(x,y)
--if i4~=0 then map:add_item(x,y,1,Item(i4),true,game_time,plyr.name); end
--if i5~=0 then map:add_item(x,y,1,Item(i5),true,game_time,plyr.name); end
if i4~=0 then give_item(id,Item(i4),1); end
if i5~=0 then give_item(id,Item(i5),1); end
send_message(id, "Polypile successful!")
end
if math.random(1,50) == 1 and not plyr:is_dm() and not plyr.perks[PERK_LOTL] and get_material(itm)~=MAT_BLACKROCK then
send_message(id,"Your wand fizzles!")
remove_item(id,itm)
end
update_fov(id)
end