Language: 
To browser these website, it's necessary to store cookies on your computer.
The cookies contain no personal information, they are required for program control.
  the storage of cookies while browsing this website, on Login and Register.

Author Topic:  costs for remove/damnation  (Read 82 times)

0 Members and 1 Guest are viewing this topic.

Dolfo

« on: 09, September 2023, 09:57:37 »
So because this is an unbalanced money gain logic with all our expensive cursed stuff to uncurse them for some few silvers to earn 100+ gold i looked in there.

Here are some changes for church.lua script. Sadly this is a broken script from public trunk failing somehow to remove curse/damnations from items. Also public trunk has a inactive level 50 church priest and a level 1 castle church priest, so for sure 2 "expert" npc there to test this.

Prototyp price calculation works fine. I can loop player inventory from lua code only and check for cursed/damned items in there. Atm i miss to loop also containers, but this is only one more loop in logic. I also compare priest level against item level. A level 1 priest can't take money for services he can't handle later.

But the current idea is simple. Count the value of the cursed/damned items priest can "cure" and take half the value for service costs. So players have still money gain on cursed stuff, but more balanced.  ::)

Edit: This is updated priest script. Somewhere lua decides to give me null inventory pointers for container types, so recursive search in containers don't work. This script needs also an updated version of GameObject_PresentArchInOb.

Code: [Select]
/*****************************************************************************/
/* Name   : GameObject_PresentArchInOb                                       */
/* Lua    : object:PresentArchInOb("_royal_experience")                      */
/* Info   : searches for any objects with                                    */
/*          a matching archetype in the inventory of the given object.       */
/* Returns: The first matching object or NULL                                */
/*****************************************************************************/
// Prototyp to access hooks->archetype_global->_royal_experience
// can be expanded to access other archetype_global
// used to access archetype_global->_royal_experience from royal_exp_transfer.lua
// using a name string and the if check is a workaround to target the archetype_global struct
// to target this direct from lua, it needs access to both (to the archetype_global and the searched archetype in there )
// todo build better lua mechanic to target _archetype_global *archetype_global;
// I know it's ugly, but better than nothing
// extended for our priests (church.lua) to have access to the forces they can clean to make church script more intelligent
static int GameObject_PresentArchInOb(lua_State *L)
{
    char *name = NULL;
    lua_object *self;
    object_t *obj = NULL;

    get_lua_args(L, "Os", &self, &name);

    if (name)
    {
        if (strcmp(name, "_royal_experience") == 0)
        {
            obj = hooks->present_arch_in_ob(hooks->archetype_global->_royal_experience, WHO);
        }
        else if (strcmp(name, "_deathsick") == 0)
        {
            obj = hooks->present_arch_in_ob(hooks->archetype_global->_deathsick, WHO);
        }
        else if (strcmp(name, "_drain") == 0)
        {
            obj = hooks->present_arch_in_ob(hooks->archetype_global->_drain, WHO);
        }
        else if (strcmp(name, "_depletion") == 0)
        {
            obj = hooks->present_arch_in_ob(hooks->archetype_global->_depletion, WHO);
        }
        else if (strcmp(name, "_poisoning") == 0)
        {
            obj = hooks->present_arch_in_ob(hooks->archetype_global->_poisoning, WHO);
        }

        if(obj)
            return push_object(L, &GameObject, obj);
    }
  return 0;
}

Code: [Select]
require("topic_list")
require("interface_builder")

local pl = event.activator
local me = event.me
local msg = string.lower(event.message)
local ib = InterfaceBuilder()

local level = pl.level
local drain=pl:PresentArchInOb("_drain")
if drain then
    level = level + drain.level
end


local sum
local spell

local function dsCost(level)
    local cost = 100 + 4 * level * level

    if level >= 60 then
        cost = cost + 4000 * level - 240000
    end

    return cost
end

local value=0
local function countCursedValue(object)
    if object.inventory then
        local obj=object.inventory
        repeat
            if obj.f_sys_object == false then
                if obj.f_cursed == true or obj.f_damned == true then
                    if obj.level <= me.level then -- priest is to low level to uncurse/undamn this, so he can't take money for this
                        value=value+obj.value
                    end
                    -- but lets allow unapply cursed stuff for all priest levels
                    if obj.f_applied == true then
                        value=value+level*100 -- lets say 1 silver each player level to unapply cursed stuff
                        -- this is only a temporary fast solution, cursed/damned logics need for sure more rework
                        pl:Write("applied ".. obj.name, game.COLOR_YELLOW)
                    end
                end
                                   
                if obj.type==game.TYPE_CONTAINER then
                    pl:Write("container : " .. obj.name, game.COLOR_YELLOW)
                    -- why our containers have no inventory pointers in lua ???
                    if obj.inventory==nil then
                       pl:Write("inv is null", game.COLOR_YELLOW)
                    end
                end
               
                -- if necessary, loop also containers
                --if obj.inventory~=nil then
                    --value=value+countCursedValue(obj)
                --end
               
            end
            obj=obj.below
        until(obj==nil)
    end
    return value
end


local function topicDefault()
    ib:SetHeader("st_001", me)
    ib:SetTitle("The Church of the Tabernacle")
    ib:SetMsg("Hello! I am " .. me.name ..".\n\nWelcome to the church of the Tabernacle!\n\n")

    if pl:PresentArchInOb("_poisoning")~=nil then
        ib:AddMsg("You are poisoned? Wait I cast a spell on you.\n\n")
        me:CastSpell(pl, game:GetSpellNr("cure poison"), 0, 0, "")
        ib:AddMsg("|** " .. me.name .. " casts cure poison on you! **|\n\ndone!\n\n")
    end

    ib:AddMsg("If you need information to my services, I can ^explain^ it.\n\n")
    ib:AddMsg("What can I do for you?\n\n")

    local needHelp = false

    if pl:PresentArchInOb("_deathsick")~=nil then
        ib:AddLink("Remove Death Sickness", "cast sick")
        needHelp = true
    end

    if drain~=nil then
        ib:AddLink("Cast Restoration", "cast restore")
        needHelp = true
    end

    if pl:PresentArchInOb("_depletion")~=nil then
        ib:AddLink("Cast Remove Depletion", "cast deplete")
        needHelp = true
    end

    if countCursedValue(pl)>0 then
        ib:AddLink("Remove Curse and Damnation", "cast damn")
        needHelp = true
    end

    if needHelp == false then
        ib:AddMsg("You look very healthy to me!\n\n")
    end

    -- disease.c has find_disease function we could use here, if we want diseases, but atm its a waste of time to code here more
    ib:AddLink("I think I have one of this old forgotten diseases.", "cast disease")
end

local function topicExplain()
    ib:SetHeader("st_002", me)
    ib:SetTitle("About our Services")
    ib:AddMsg("I can cure various things by casting the named spells on you when you pay me the money.\n\n")
    ib:AddMsg("Deathsick is a stronger form of depletion.\nEverytime you die stats are depleted by death sickness.")
    ib:SetButton("Back", "hi")
    pl:Interface(game.GUI_NPC_MODE_NPC, ib:Build())
end

local function topicCast(what)
    ib:SetHeader("st_005", me)
    if what=="sick" then
        if pl:PresentArchInOb("_deathsick")==nil then
            ib:SetMsg("You have no death sickness!")
            return
        else
            ib:SetMsg("I can cast ~Remove Deathsick~ for " .. pl:ShowCost(dsCost(pl.level)))
        end
    elseif what == "deplete" then
        if pl:PresentArchInOb("_depletion")==nil then
            ib:SetMsg("You are not depleted!")
            return
        else
            ib:SetMsg("I can cast ~Remove Depletion~ for ".. pl:ShowCost(5 * level))
        end
    elseif what == "restore" then
        if drain==nil then
            ib:SetMsg("You are not drained!")
            return
        else
            ib:SetMsg("I can cast ~Restoration~ for ".. pl:ShowCost(100*drain.level) ..".") -- 1 silver each drained level
        end
    elseif what == "disease" then
        ib:SetMsg("I can not see if you are diseased, but if you want,\n\n")
        ib:AddMsg("I can cast ~Cure Disease~ for ".. pl:ShowCost(100 * level) .. " on you.")
    elseif what == "damn" then

        local costs=countCursedValue(pl)/2 -- let's say priest take the half of the prices
        if costs==0 then
            ib:SetMsg("You have no cursed or damned items, why you ask me?")
            return
        else
            ib:SetMsg("I can cast ~Remove Damnation~ for " .. pl:ShowCost(costs)) --pl:ShowCost(100 + 3 * pl.level))
        end
    else
        ib:SetMsg("You want me to cast ".. what .."? Sorry I don't know this spell.")
        return
    end
    ib:AddMsg(".\n\nYou have " .. pl:ShowCost(pl:GetMoney()) .. ".\n\nDo you want me to do it now?")
    ib:SetAccept(nil, "docast " .. what)
    ib:SetDecline(nil, "hi")
end

local function topicDoCast(what)
    ib:SetHeader("st_005", me)
    if what == "sick" then
        sum = dsCost(level)
        spell = "remove death sickness"
    elseif what == "deplete" then
        sum = 5 * level
        spell = "remove depletion"
    elseif what == "restore" then
        sum = 100 * (level-pl.level) -- 1 silver each drained level
        spell = "restoration"
    elseif what == "disease" then
        sum = 100 * level
        spell = "cure disease"
    elseif what == "damn" then
        sum = countCursedValue(pl)/2
        spell = "remove damnation"
    end
    ib:SetTitle("Casting " .. spell)
    if pl:PayAmount(sum) == 1 then
        me:CastSpell(pl, game:GetSpellNr(spell), 0, 0, "")
        ib:SetMsg("|** " .. me.name .. " takes your money **|\n\ndone!")
    else
        ib:SetMsg("You don't have enough money!")
    end
    ib:SetButton("Back", "Hi")
end

tl = TopicList()
tl:AddGreeting(nil, topicDefault)
tl:SetDefault(topicDefault)
tl:AddTopics("explain", topicExplain)
tl:AddTopics("cast (.*)", topicCast)
tl:AddTopics("docast (.*)", topicDoCast)
ib:ShowSENTInce(game.GUI_NPC_MODE_NPC, tl:CheckMessage(event, true))
« Last Edit: 22, September 2023, 14:20:54 by Dolfo »
Don't believe the shit, you hear in mainstream. Believe your own body. Your body is speaking always the true to you. But you need to understand your body. Hear to your body, not to your ego. And when body is calling to you: "Hey something is wrong!" find the reason(s) for that. Man in White don't go for that, they don't want to heal you. They want earn money and sell you medicine, you should take rest of your life. You are not the patient, you are their customer. Never forget this!

Shroud

« Reply #1 on: 09, September 2023, 12:25:06 »
One interesting note is that I believe shop only pays around half the value for items so if priest charges half the value then shop would only cover the priest's bill. As a side note if we start having really high bills it would be handy if the priest can take the funds directly from your bank account to avoid extra trips to the bank assuming players don't have 50g regularly on hand.
Doesn't matter, you'd die anyway. ;D Shroud's a hacker. After many hours of deep thought I have came to that conclusion.

Dolfo

« Reply #2 on: 09, September 2023, 12:51:57 »
Paying direct from bank works with bankcard. Atm my logic is limited to mark the card, but mark a card would fail, when you want to reforge something. We can't mark two items. So we need to wait for a better solution like to ready the bankcard on torch slot.  ::)

The 50% was a fast choice, like priests are "fair" and share 50/50. For sure selling to shop, the shop take 20% more from your profit. But shop has also some few % you can gain by charisma.

So the idea its mainly,

"you find potions you sell to shop"

"you find cursed potions, the priests rip you first, taking half the profit"

we can go for 40%, if we want come closer to half profit, then we are still ignoring charisma or later royal bankcard bonus in our calculation.  :P
Don't believe the shit, you hear in mainstream. Believe your own body. Your body is speaking always the true to you. But you need to understand your body. Hear to your body, not to your ego. And when body is calling to you: "Hey something is wrong!" find the reason(s) for that. Man in White don't go for that, they don't want to heal you. They want earn money and sell you medicine, you should take rest of your life. You are not the patient, you are their customer. Never forget this!

Shroud

« Reply #3 on: 09, September 2023, 13:07:01 »
Well currently removing damnation is a trivial cost so it makes sense to increase the price. Exact rate is more an economic issue and only likely edge cases is when rate is high enough that people no longer both to carry cursed items (e.g. currently most players dump items of mass as value isn't worth 65kg of loot)
Doesn't matter, you'd die anyway. ;D Shroud's a hacker. After many hours of deep thought I have came to that conclusion.

Dolfo

« Reply #4 on: 15, September 2023, 14:54:27 »
Could be also interesting, that priest can't remove the cursed/damned flags from items. Instead they can unapply these items for players? ???
Don't believe the shit, you hear in mainstream. Believe your own body. Your body is speaking always the true to you. But you need to understand your body. Hear to your body, not to your ego. And when body is calling to you: "Hey something is wrong!" find the reason(s) for that. Man in White don't go for that, they don't want to heal you. They want earn money and sell you medicine, you should take rest of your life. You are not the patient, you are their customer. Never forget this!

Shroud

« Reply #5 on: 16, September 2023, 16:57:48 »
Could be also interesting, that priest can't remove the cursed/damned flags from items. Instead they can unapply these items for players? ???
Actually I believe that's exactly how scrolls work. Although in that case all cursed items instantly become worthless as shop doesn't accept money for cursed items.
Doesn't matter, you'd die anyway. ;D Shroud's a hacker. After many hours of deep thought I have came to that conclusion.

Dolfo

« Reply #6 on: 21, September 2023, 12:53:45 »
Looks like we can also cheat our priests, when we let drain us first. Lua only checks for player levels for calculation and don't check for drained levels.
Don't believe the shit, you hear in mainstream. Believe your own body. Your body is speaking always the true to you. But you need to understand your body. Hear to your body, not to your ego. And when body is calling to you: "Hey something is wrong!" find the reason(s) for that. Man in White don't go for that, they don't want to heal you. They want earn money and sell you medicine, you should take rest of your life. You are not the patient, you are their customer. Never forget this!

Dolfo

« Reply #7 on: 22, September 2023, 19:47:54 »
I reworked the priest script. I have still some problems with browsing containers from lua site, but the other mechanics looking cleaner now. Priest is a little more intelligent.

You get only the links, when they make sense. So remove deathsickness only if you have deathsickness. Same for restoration and remove depletion. For remove poison i choosed an automatic cure without the need for money. So if you come to priest and are poisend he cures you when talking to him. Only for disease there is still a perma link in. I rebuild the dialog a little to make it cleaner for players, that they can start a cure disease at their own risk(costs). I have only looked in disease.c some seconds and was close to jump out of my window. Luckyly i live ground floor.  :P

With the new "function" to access the forces i can also get first time the real level of player (level+drained level) in lua script, so the calculation can't be exploited anymore with draining some levels.

I changed costs for restoration to 1 silver per drained level.

For remove damnation i want try half the item value to clean curse/damned flags and when this is not working (perma damned or to high level) than unapply an item is in relation to player level 1 silver each total level.

I really want to end this somehow and continue on new item slot and finish bankcard logic.
« Last Edit: 22, September 2023, 19:52:14 by Dolfo »
Don't believe the shit, you hear in mainstream. Believe your own body. Your body is speaking always the true to you. But you need to understand your body. Hear to your body, not to your ego. And when body is calling to you: "Hey something is wrong!" find the reason(s) for that. Man in White don't go for that, they don't want to heal you. They want earn money and sell you medicine, you should take rest of your life. You are not the patient, you are their customer. Never forget this!

Dolfo

« Reply #8 on: Today at 07:02:05 »
This is no end here. But when we are here, why not discuss this? Currently players mainly go to priest, uncurse their items and then sell it to shop. I personally store first all my cursed stuff in appartment and containers and go for a "big uncurse all items at once" business trip.

So cursed stuff is mostly full selling prices except the priest costs or the scroll price.

Why not give full money for cursed stuff at shop?

Its remove one line in shop.c function query_cost line 49
Code: [Select]
if (QUERY_FLAG(tmp, FLAG_CURSED) || QUERY_FLAG(tmp, FLAG_DAMNED))
  return 0;
This would end:
Players need to uncurse first before selling.
Players start to collect curse items for more money efficience and trash their apartments.
Also
We can't detect curses later in future scenarios by the value.
New changes on curse logics, didnt't kill the values for unremovable cursed items.
I didn't kill the player stock cursed item values, when i update the curse/damned flags from perma items in loader.

I see only advantages for players here.  ???

For sure i need to go also in examine logic to show value for cursed/damned stuff. Looks like this target the same function query_cost from above.

When we go this way, the need for uncurse priest services and the need for uncurse scrolls will reduce. We could also rethink the costs for the priest service. Does it makes sense to pay half the item values for uncurse then?  ???
« Last Edit: Today at 07:53:46 by Dolfo »
Don't believe the shit, you hear in mainstream. Believe your own body. Your body is speaking always the true to you. But you need to understand your body. Hear to your body, not to your ego. And when body is calling to you: "Hey something is wrong!" find the reason(s) for that. Man in White don't go for that, they don't want to heal you. They want earn money and sell you medicine, you should take rest of your life. You are not the patient, you are their customer. Never forget this!

Tags:
 

Related Topics

  Subject / Started by Replies Last post
5 Replies
759 Views
Last post 19, April 2006, 02:39:57
by longir
12 Replies
1800 Views
Last post 21, August 2008, 02:21:22
by Unislash
1 Replies
3899 Views
Last post 29, August 2010, 22:35:53
by clobber
9 Replies
5152 Views
Last post 26, September 2011, 09:32:25
by blingking114
31 Replies
77638 Views
Last post 22, July 2021, 08:57:28
by Clort