-
Notifications
You must be signed in to change notification settings - Fork 69
Shops
Carmina16 edited this page Apr 29, 2018
·
2 revisions
# TODO: getShopQuality(),
getVendorPersonality(quality) <-
if interiorType == TAVERN then
a <- rnd(1, 101)
b <- rnd(40, 61)
elif interiorType == MAGESGUILD then
a <- rnd(50, 101)
b <- rnd(40, 81)
else # SHOP
a <- rnd(1, 101)
b <- rnd(30, 71)
endif
return b + quality, a + quality
seed <- max((Y<<8)+X, 1)
srand(seed)
quality <- getShopQuality()
personality, personality2 <- getVendorPersonality(quality)
generateStandardInventory(quality)
if quality >= 7 then
seen <- []
for i <- (0, quality)
if rnd() & 1 then generateMagicWeapon(quality) else generateMagicArmor(quality)
endif
generateStandardInventory(quality) <-
for at <- (0, 3)
for slot <- (0, 11)
item <- generateArmor(quality, slot=slot, type=at)
if item then shop.Armor.add(item)
for slot <- (0, 18)
item <- generateWeapon(quality, slot=slot)
if item then shop.Weapons.add(item)
See Loot generation for functions not described here.
generateMagicArmor(q) <-
for try <- (0, 200)
do
slot <- rnd(11)
item <- generateArmor(q, slot, PLATE)
while not item
item.hash <- 100 + slot
v <- rnd(1,11)
for i <- 0, 3
if enchChance[i] > v then break
if i == 0 then addArmorMaterial(item)
else if i == 1 then addItemEnchantment(item, q)
else addArmorMatEnch(item, q)
if item.hash in seen then
item <- none
continue
endif
if not player.canEquip(item) then item <- none
if item then seen.add(item.hash)
return item
generateMagicWeapon(q) <-
for try <- (0, 200)
do
slot <- rnd(18)
item <- generateWeapon(q, slot)
while not item
item.hash <- 10 + slot
v <- rnd(1,11)
for i <- 0, 3
if enchChance[i] > v then break
if i == 0 then addWeapMaterial(item)
else if i == 1 then addItemEnchantment(item, q)
else addWeapMatEnch(item, q)
if item.hash in seen then
item <- none
continue
endif
if not player.canEquip(item) then
item <- none
continue
endif
if item then seen.add(item.hash)
return item
The seed for the Mages Guilds is calculated as (currentCity.id & 0xFF) + (currentCity.latitude) + 1000
.
srand(seed)
quality <- getShopQuality()
personality, personality2 <- getVendorPersonality()
if quality >= 3
seen <- []
for try <- (0, 200)
item <- generateMagicItem(quality)
if item.hash in seen then continue
mg.shop.add(item)
seen.add(item.hash)
endif
Potions are simply chosen from the list: the names are in szlist @41CF9
, prices @41E4C
, and the spells added to a new potion item are @41E3D
.
Spells are sold at double price. The maximal price for a spell available for sell is 250 * quality
.
(to do)
For weapons and armor, the base selling price is (item.price * item.curHealth) / item.maxHealth
.
If a magical weapon/armor was sold, it is added to the shop inventory until player leaves the shop.
(to do)
(to do)