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:  Magic Money Cards  (Read 129 times)

0 Members and 1 Guest are viewing this topic.

Dolfo

« on: 23, December 2021, 09:50:11 »
Goal is a kind of Credit Card System.
Basic implementattion is not that hard.
But first think of the name and type of this.
Should it be more a kind of card? Or more a kind of jewelry?
Should it be put in pouches?
Should it be ego-binded or are players allowed to resell there old Cards?
Should there be more levels of this cards? (bronze/copper, silver, gold, mithril/platinum)
How expensive should be this cards?

I thought of making this system very expensive, so high level player come someday to the point:
"Yeah i go my card finally, the days of carrying coppers is over.

Ok implemention:
1. We need an arch item for this.
2. bank.lua must sell this card.
3. implement card paying in pl_PayAmount
-> here we can go for 2 directions (pay from card, pay to card)
--> it's mostly check for card and access player bank account
----> we could split this, like bronze card can only pay from, silver card can do both?
4. perhaps a kind mithril/platinum card, the ultimate goal for a high level player
-> platinum card has all, payin, payout, works like a kind of money pouch (picked up money is automated transfered to bank account, and you can always grap some money out of that pocket card), platinum card could be ego binded and you get an insurance on this, if you loose it, bank will give you new card.

So that's the idea, of course the platinum idea is hardest to code, but copper and silver cards must be easy to do.
we also need an idea for gold card.
And i thought about high prices for all cards.
So perhaps only platinum is ego binded, all other carts could be sold to players?
Or an upgrade option on bank.lua

i thought a mithril to buy such cards, at least a lot of gold for a simple bronze card?
« Last Edit: 23, December 2021, 09:53:45 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. School medicine 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 you life. School medicine is corrupted by bad humans, like politician, like media.

Shroud

« Reply #1 on: 23, December 2021, 17:23:58 »
I believe there is already a similar item in terms of implementation you can use as a template. DMBuster (it's egobound but that's probably a design choice rather than a functional requirement) worked in the following way:

1. Player has to "mark" the item with m when selecting it in inventory
2. Player types /talk DMBuster
2.1 It's also possible to type extended commands e.g. /talk DMBuster deposit all
3. It triggers the lua script within

So if you're wanting easiest implementation then you just put bank lua script within and it would essentially be a mobile bank linked to your bank account. If you want to refine it further then you can definitely do so with a custom script.
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: 04, January 2022, 22:18:59 »
I paid with my credit card. 8) This is my code. shopc.c line 297.
Code: [Select]
    // prototyp : paying with a marked creditcard, currently name is relevant
    object_t *mark;
    if ((mark = find_marked_object(op)))
    {
        if (strcmp(mark->name, "creditcard") == 0)
        {
            // check money from bank account
            object_t *this,
                      *next;
        FOREACH_OBJECT_IN_OBJECT(this, op, next)
            {
                if (this->name &&
                this->arch == archetype_global._player_info &&
                !strcmp(this->name, "BANK_GENERAL"))
                {
                    if (this->value>=amount)
                    {
                      this->value-=amount;
                      ndi(NDI_UNIQUE, 0, op, "You pay with your %s.",mark->name);
                      return 1;
                    }
                    else
                    {
                      ndi(NDI_UNIQUE, 0, op, "Looks like your %s is uncovered.",mark->name);
                      return 0;
                    }
                }
            }
        }
    }
It's a prototyp, currently you need to mark an item  named "creditcard". Here is my creditcard definition.
Code: [Select]
#
# - credit card
#
Allowed card
chance 0
artifact credit_card
def_arch card
editor 3:items/signs
Object
name creditcard
identified 1
type 98
material 1
value 8
weight 20
end
#
I stop here for now. Creditcard needs a balanced price. :o
« Last Edit: 04, January 2022, 22:20:56 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. School medicine 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 you life. School medicine is corrupted by bad humans, like politician, like media.

_people_

« Reply #3 on: 04, January 2022, 23:20:25 »
A few critiques:

Don't use strcmp here - if you have to compare strings strncmp is safer but even safer than that is a shared string.

Code: [Select]
shstr_t *namehash = shstr_find("credit card");
...
if (mark->name == namehash)
{
...
}

However I think the most reliable option of all would be to use an additional global archetype and check that the marked object's archetype is that global arch.

Also I don't think credit cards should be an artifact, but instead an arch. I would consider this a "base item" which could have multiple variants. AFAIK we don't have a "card" archetype so I assume you've made both an arch and artifact, which isn't necessary.
-- _people_ :)

Dolfo

« Reply #4 on: 05, January 2022, 06:07:59 »
As i said, it's a prototyp. I was happy when finishing this. To get access to the bankaccount was not easy and the day got later and later. Sure this should be improved. I am not that deep on archetyps or artifact definitions. I used the way how you implemented your potions or scrolls. And for potions or scrolls you used artifact definitions linking on generic potion or scroll archetyp. Then i found archetyp card and simply used this.

So no, i don't defined a new archtype, i used archetyp card. And linked it to artifacts with def_arch card. I am still a little confused.
For example if you have one blue potion and want use this for 10 blue mana potions, you want really 10 archetypes? As i said, currently you have the system, you have all your potion.png in arch folder, there is only one definition for a potion_gen.arc, where color is definied default blue and then you have all the potion definitions in artifacts using potion_gen.arc as a kind of base type and overwritting the stats to become more unique.

For organic foot you have the other way, you defined mostly the food as a archtype, but each food there is also a unique png? So to speak true, this is a mess somehow? One site you use this system other site you use this system? For what reason you have artifact file, when you want all defintions in archetyp?

Edit: Ok trying to deposit money with a marked creditcard is funny. bank.lua uses pay logic to reduce the coins and pay logic pays with card. So you deposit money you pay with card and nothing changes.  ;D bank.lua need a fix then and must check for a marked credit card too. Or you build an easteregg like. "Ey, you want to deposit money with you credit card, sure why not?"  :o

Edit: And if you want to deposit more coins from your inventory, than you can pay with the card, bank npc's says. "You didn't have that money to deposit!"

But other places i checked this cards worked fine.  8)
« Last Edit: 05, January 2022, 08:22:15 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. School medicine 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 you life. School medicine is corrupted by bad humans, like politician, like media.

_people_

« Reply #5 on: 05, January 2022, 17:32:47 »
As i said, it's a prototyp. I was happy when finishing this.

Wasn't trying to discourage you, I just wanted to give some advice on how the codebase works because it can be very confusing, even for someone who's been working in it for over a decade. :)

Re arches vs. artifacts: It's a bit complicated. I can see an argument being made for food being artifacts or arches, as well as potions being arches or artifacts.

Arches are base items. A loaf of bread is a different item from an apple or a banana. However if you wanted an alternative form of bread which heals more, you'd likely want to use an artifact to overwrite some of bread's attributes. Although again there's an argument to be made that something like banana bread or sourdough bread should be a different "base item" from regular bread.

A sword is a basic item, so it uses an archetype. Excalibur, a unique/legendary sword, would be a unique artifact using "sword" as its base. And with how our loot generation works, "sword of medium fire" is also an artifact (though implemented slightly differently).

A potion is, in my opinion, a base item. Though that could be argued. So to extend a potion, you would add stats and change which spell it is used for (by modifying its SP value).
-- _people_ :)

Dolfo

« Reply #6 on: 05, December 2022, 03:13:56 »
Finally i had the time to improve this. Changed the card definition from artifacts to archetyp. Defined type MONEYCARD 38. Type number 38 was free and is close to type 36 MONEY and 37 LOOT. So i don't need to check anymore for name of the card. Next is i could go for subtypes to build the different versions of this cards. I also fixed the bank deposit problem, when deposit money with a marked card.

In bank.lua
Code: [Select]
-- this is not the best logic, but temporary helps here
-- pl:deposit using shop_pay_amount to burn money and shop_pay_amount is the logic paying with moneycard
-- so we deposit money to bank account only to burn same amount from bank account
local mark = pl:FindMarkedObject()
if mark ~=nil and mark.type==game.TYPE_MONEYCARD then
  ib:SetMsg( "Sorry, unmark your moneycard first." )
  return
end
This is a fast solution. Deposit logic abuse shop_pay_amount to burn coins in inventory, but with marked money card, new shop_pay_amount logic burns the money from card. So we deposit x on account only to burn x from account in this situation.
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. School medicine 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 you life. School medicine is corrupted by bad humans, like politician, like media.

Tags:
 

Related Topics

  Subject / Started by Replies Last post
18 Replies
14442 Views
Last post 02, July 2007, 22:49:07
by Jer
5 Replies
2294 Views
Last post 28, April 2011, 04:37:23
by Killest_is_awesome
37 Replies
224702 Views
Last post 09, November 2012, 18:43:23
by hydrofiend
14 Replies
2005 Views
Last post 10, June 2015, 20:08:29
by petarkiller
11 Replies
175 Views
Last post 15, January 2022, 23:24:53
by Shroud