
new-hashmap
\       WEAPON_TO_DEL WEAPON_TO_GIVE PRICE_AA
        {  129 2499     480000 } =>  1  \ Sword of Revolution => Elven Long Sword 
        { 2499   72     580000 } =>  2  \ Elven Long Sword  => Stormbringer
        {   72   74     696000 } =>  3  \ Stormbringer => Katana
        {   72  133     696000 } =>  4  \ Stormbringer => Raid Sword
        {   72   73     696000 } =>  5  \ Stormbringer => Shamshir
        {   72  131     696000 } =>  6  \ Stormbringer => Spirit Sword
        {   73   75    1760000 } =>  7  \ Shamshir => Caliburs
        {   73   76    1760000 } =>  8  \ Shamshir => Sword of Delusion
        {   73   77    1760000 } =>  9  \ Shamshir => Tsurugi
        {   73  134    1760000 } =>  10 \ Shamshir => Sword of Nightmare
        {   73  132    1760000 } =>  11 \ Shamshir => Sword of Limit
        {   74   75    1760000 } =>  12 \ Katana => Caliburs
        {   74   76    1760000 } =>  13 \ Katana => Sword of Delusion
        {   74   77    1760000 } =>  14 \ Katana => Tsurugi
        {   74  134    1760000 } =>  15 \ Katana => Sword of Nightmare
        {   74  132    1760000 } =>  16 \ Katana => Sword of Limit
        {  131   75    1760000 } =>  17 \ Spirit Sword => Caliburs
        {  131   76    1760000 } =>  18 \ Spirit Sword => Sword of Delusion
        {  131   77    1760000 } =>  19 \ Spirit Sword => Tsurugi
        {  131  134    1760000 } =>  20 \ Spirit Sword => Sword of Nightmare
        {  131  132    1760000 } =>  21 \ Spirit Sword => Sword of Limit
        {  133   75    1760000 } =>  22 \ Raid Sword => Caliburs
        {  133   76    1760000 } =>  23 \ Raid Sword => Sword of Delusion
        {  133   77    1760000 } =>  24 \ Raid Sword => Tsurugi
        {  133  134    1760000 } =>  25 \ Raid Sword => Sword of Nightmare
        {  133  132    1760000 } =>  26 \ Raid Sword => Sword of Limit
        {   75  135    2200000 } =>  27 \ Caliburs => Samurai Longsword
        {   76  135    2200000 } =>  28 \ Sword of Delusion => Samurai Longsword
        {   77  135    2200000 } =>  29 \ Tsurugi => Samurai Longsword
        {  134  135    2200000 } =>  30 \ Sword of Nightmare => Samurai Longsword
        {  132  135    2200000 } =>  31 \ Sword of Limit => Samurai Longsword
        {  279  280     480000 } =>  32 \ Strengthened Long Bow => Light Crossbow
        {  280  281     580000 } =>  33 \ Light Crossbow => Crystallized Ice Bow
        {  281  285     696000 } =>  34 \ Crystallized Ice Bow => Noble Elven Bow
        {  281  282     696000 } =>  35 \ Crystallized Ice Bow => Elemental Bow
        {  285  283    1760000 } =>  36 \ Noble Elven Bow => Akat Long Bow
        {  282  283    1760000 } =>  37 \ Elemental Bow => Akat Long Bow
        {  283  286    2200000 } =>  38 \ Akat Long Bow => Eminence Bow
        { 1660  225     480000 } =>  39 \ Cursed Maingauche => Mithril Dagger
        {  224  225     480000 } =>  40 \ Maingauche => Mithril Dagger
        {  225  226     580000 } =>  41 \ Mithril Dagger => Cursed Dagger
        {  225  232     580000 } =>  42 \ Mithril Dagger => Dark Elven Dagger
        {  226  242     696000 } =>  43 \ Cursed Dagger => Soulfire Dirk
        {  226  227     696000 } =>  44 \ Cursed Dagger => Stiletto
        {  232  242     696000 } =>  45 \ Dark Elven Dagger => Soulfire Dirk
        {  232  247     696000 } =>  46 \ Dark Elven Dagger => Stiletto
        {  242  231    1760000 } =>  47 \ Soulfire Dirk => Grace Dagger
        {  242  233    1760000 } =>  48 \ Soulfire Dirk => Dark Screamer
        {  247  231    1760000 } =>  49 \ Stiletto => Grace Dagger
        {  247  233    1760000 } =>  50 \ Stiletto => Dark Screamer
        {  231  228    2200000 } =>  51 \ Grace Dagger => Crystal Dagger
        {  233  228    2200000 } =>  52 \ Dark Screamer => Crystal Dagger
        {  158  189     480000 } =>  53 \ Tarbar => Staff of Life
        {  158  159     480000 } =>  54 \ Tarbar => Bonebreaker
        {   88  189     480000 } =>  55 \ Morning Star => Staff of Life
        {   88  159     480000 } =>  56 \ Morning Star => Bonebreaker
        {  169  189     480000 } =>  57 \ Skull Breaker => Staff of Life
        {  169  159     480000 } =>  58 \ Skull Breaker => Bonebreaker
        {  172  189     480000 } =>  59 \ Heavy Bone Club => Staff of Life
        {  172  159     480000 } =>  60 \ Heavy Bone Club => Bonebreaker
        {  189  193     580000 } =>  61 \ Staff of Life => Stick of Faith
        {  189   89     580000 } =>  62 \ Staff of Life => Big Hammer
        {  189  160     580000 } =>  63 \ Staff of Life => Battle Axe
        {  189  161     580000 } =>  64 \ Staff of Life => Silver Axe
        {  189  173     580000 } =>  65 \ Staff of Life => Skull Graver
        {  159  193     580000 } =>  66 \ Bonebreaker => Stick of Faith
        {  159   89     580000 } =>  67 \ Bonebreaker => Big Hammer
        {  159  160     580000 } =>  68 \ Bonebreaker => Battle Axe
        {  159  161     580000 } =>  69 \ Bonebreaker => Silver Axe
        {  159  173     580000 } =>  70 \ Bonebreaker => Skull Graver
        {  193 2502     696000 } =>  71 \ Stick of Faith => Dwarven War Hammer
        {   89 2502     696000 } =>  72 \ Big Hammer => Dwarven War Hammer
        {  160 2502     696000 } =>  73 \ Battle Axe => Dwarven War Hammer
        {  161 2502     696000 } =>  74 \ Silver Axe => Dwarven War Hammer
        {  173 2502     696000 } =>  75 \ Skull Graver => Dwarven War Hammer
        { 2502  174    1760000 } =>  76 \ Dwarven War Hammer => Nirvana Axe
        { 2502  196    1760000 } =>  77 \ Dwarven War Hammer => Stick of Eternity
        { 2502  201    1760000 } =>  78 \ Dwarven War Hammer => Club of Nature
        { 2502  202    1760000 } =>  79 \ Dwarven War Hammer => Mace of The Underworld
        { 2502  162    1760000 } =>  80 \ Dwarven War Hammer => War Axe
        {  174 2503    2200000 } =>  81 \ Nirvana Axe => Yaksa Mace
        {  196 2503    2200000 } =>  82 \ Stick of Eternity => Yaksa Mace
        {  201 2503    2200000 } =>  83 \ Club of Nature => Yaksa Mace
        {  202 2503    2200000 } =>  84 \ Mace of The Underworld => Yaksa Mace
        {  162 2503    2200000 } =>  85 \ War Axe => Yaksa Mace
        {   90  188     480000 } =>  86 \ Goat Head Staff => Ghost Staff
        {   90  190     480000 } =>  87 \ Goat Head Staff => Atuba Mace
        {   90  187     480000 } =>  88 \ Goat Head Staff => Atuba Hammer
        {  188  192     580000 } =>  89 \ Ghost Staff => Crystal Staff
        {  188  194     580000 } =>  90 \ Ghost Staff => Heavy Doom Axe
        {  188  191     580000 } =>  91 \ Ghost Staff => Heavy Doom Hammer
        {  190  192     580000 } =>  92 \ Atuba Mace => Crystal Staff
        {  190  194     580000 } =>  93 \ Atuba Mace => Heavy Doom Axe
        {  190  191     580000 } =>  94 \ Atuba Mace => Heavy Doom Hammer
        {  187  192     580000 } =>  95 \ Atuba Hammer => Crystal Staff
        {  187  194     580000 } =>  96 \ Atuba Hammer => Heavy Doom Axe
        {  187  191     580000 } =>  97 \ Atuba Hammer => Heavy Doom Hammer
        {  192  195     696000 } =>  98 \ Crystal Staff => Cursed Staff
        {  194  195     696000 } =>  99 \ Heavy Doom Axe => Cursed Staff
        {  191  195     696000 } => 100 \ Heavy Doom Hammer => Cursed Staff
        {  195  197    1760000 } => 101 \ Cursed Staff => Paradia Staff
        {  195  199    1760000 } => 102 \ Cursed Staff => Paagrio Hammer
        {  195  198    1760000 } => 103 \ Cursed Staff => Inferno Staff
        {  195  200    1760000 } => 104 \ Cursed Staff => Sage's Staff
        {  197  206    2200000 } => 105 \ Paradia Staff => Demon's Staff
        {  197  204    2200000 } => 106 \ Paradia Staff => Deadman's Staff
        {  197  205    2200000 } => 107 \ Paradia Staff => Ghoul's Staff
        {  199  206    2200000 } => 108 \ Paagrio Hammer => Demon's Staff
        {  199  204    2200000 } => 109 \ Paagrio Hammer => Deadman's Staff
        {  199  205    2200000 } => 110 \ Paagrio Hammer => Ghoul's Staff
        {  198  206    2200000 } => 111 \ Inferno Staff => Demon's Staff
        {  198  204    2200000 } => 112 \ Inferno Staff => Deadman's Staff
        {  198  205    2200000 } => 113 \ Inferno Staff => Ghoul's Staff
        {  200  206    2200000 } => 114 \ Sage's Staff => Demon's Staff
        {  200  204    2200000 } => 115 \ Sage's Staff => Deadman's Staff
        {  200  205    2200000 } => 116 \ Sage's Staff => Ghoul's Staff
        {   93  297     480000 } => 117 \ Winged Spear => Glaive
        {  294  297     480000 } => 118 \ War Pick => Glaive
        {  297   96     580000 } => 119 \ Glaive => Scythe
        {  297  298     580000 } => 120 \ Glaive => Orcish Glaive
        {  297  302     580000 } => 121 \ Glaive => Body Slasher
        {   96   94     696000 } => 122 \ Scythe => Bec de Corbin
        {  298   94     696000 } => 123 \ Orcish Glaive => Bec de Corbin
        {  302   94     696000 } => 124 \ Body Slasher => Bec de Corbin
        {   94   95    1760000 } => 125 \ Bec de Corbin => Poleaxe
        {   94  301    1760000 } => 126 \ Bec de Corbin => Scorpion
        {   94  303    1760000 } => 127 \ Bec de Corbin => Widow Maker
        {   95  299    2200000 } => 128 \ Poleaxe => Orcish Poleaxe
        {  301  299    2200000 } => 129 \ Scorpion => Orcish Poleaxe
        {  303  299    2200000 } => 130 \ Widow Maker => Orcish Poleaxe
        {  261  262     480000 } => 131 \ Bich'Hwa => Scallop Jamadhr
        {  262  263     580000 } => 132 \ Scallop Jamadhr => Chakram
        {  263 4233     686000 } => 133 \ Chakram => Knuckle Duster
        { 4233  265    1760000 } => 134 \ Knuckle Duster => Fist Blade
        {  265  266    2200000 } => 135 \ Fist Blade => Great Pata
value mammon-items-list

0 user-value npcid      \ fix: тут обязательно использовать user-value, т.к. просто value - общая для всех переменная.

: mammonshow
        ".htm" s+ "jbforth/npc/mammon/" swap s+ show
;

{ "bows" "bows1" "bows2" "bows3" "bows4" "bows5" "swords" "swords1" "swords2" "swords3" "swords4" "swords4_1" "swords5" "blunts" "blunts1" "blunts2" "blunts3" "blunts4" "blunts5" "tblunts" "tblunts1" "tblunts2" "tblunts3" "tblunts4" "tblunts5" "daggers" "daggers1" "daggers2" "daggers3" "daggers4" "daggers5" "polearms" "polearms1" "polearms2" "polearms3" "polearms4" "polearms5" "fists" "fists1" "fists2" "fists3" "fists4" "fists5" } value mammon-text

: .rexit  ( "text" -- )  \ Печатаем переданный текст и выходим из вызвавшего слова
                rdrop           \ сбрасываем адрес возврата
        parse .
        rdrop           \ сбрасываем список
;

: wtd@  ( -- weapon-to-del  )  0 rl@ ;
: wtg@  ( -- weapon-to-give )  1 rl@ ;
: paa@  ( -- price-in-aa    )  2 rl@ ;

: bypass_do-mammon
        player@ target@ "NpcId" p@ to npcid
        "swords" mammonshow
;

: bypass_mammonexchange
        string mammon-items-list swap m@                \ прочитаем список параметров
        >r                                                                              \ в стек возвратов его
        wtd@ items# 0= if "You have not item " wtd@ i.name@ s+ .rexit then
        paa@ 5575 items# > if "Not enough [ paa@ 5575 items# - ] Ancient Adena" .rexit then
        1 wtd@  items_remove
        paa@ 5575 items_remove
        1 wtg@ items_add
        rdrop \ сохранённый список более не нужен
         
        \ тут можно вывести ещё какой-нибудь диалог, например, вернуться к предыдущему
;

: bypass_mammonshow  ( "mammon-type" -- )
        dup 2 152 within if mammonshow exit then
        dup mammon-text in-list? if mammonshow exit then
        ?dup 0 = if "swords" mammonshow exit then
                "Unknown enchant " swap s+ .
;

: bypass_mammon-back
        "html/default/" npcid s+ ".htm" s+ show
;
