mirror of
https://github.com/afritz1/OpenTESArena.git
synced 2026-09-11 12:56:41 +02:00
Page:
Shops
Pages
Character Generation
Chasms
City Generation
Combat
Dialogue
Diseases
Dungeon Generation
Home
Interiors
Items
Light levels
Loot
Movement
NPCs
Name generation
Player stats
Resting
Save File Formats
Services
Shops
Sky behavior
Skybox
Spellmaker
Spells
Thieving
Time and Calendar
Timing
Travel
User interface
Weather
Wilderness
No results
2
Shops
Carmina16 edited this page 2018-04-29 22:01:25 +07:00
Table of contents
Shop inventories
# 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.
Armor
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
Weapons
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
Magic items
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
Spells and potions
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.
Buying
(to do)
Selling
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)
Haggling
(to do)