Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Trade mechanic support for placeholder variables for dynamic trading #94

Open
wants to merge 10 commits into
base: dev
Choose a base branch
from

Conversation

Axolottl
Copy link

Example of Dynamic trading (Trades are automatically chosen from a set of predefined trades with random prices setup) :
Mob File :

  AirNomad-Trader:
    Type: Villager
    Display: "&fTrader"
    Options:
      Profession: CLERIC
      Type: DESERT
      Level: 5
    Skills:
    - skill{s=VarInitializeTraderAIR} @self ~onSpawn
    - skill{s=OneTimeTrade} ~onInteract

Skill File :

  GoldenAppleTrade:
    Cooldown: 99999
    Skills:
    - setvariable{var=caster.placeholderItem;type=STRING;value="ironcoin"}  ## Price
    - setvariable{var=caster.placeholderAmount1;type=STRING;value="14to20"} ## Amount of Price
    - setvariable{var=caster.placeholderItem1;type=STRING;value="GOLDEN_APPLE"} ## Traded Item
    - setvariable{var=caster.placeholderAmount;type=STRING;value="1"}       ## Amount of Traded Item
GoldenCarrotTrade:
    Cooldown: 99999
    Skills:
    - setvariable{var=caster.placeholderItem;type=STRING;value="ironcoin"}
    - setvariable{var=caster.placeholderAmount1;type=STRING;value="10to18"}
    - setvariable{var=caster.placeholderItem1;type=STRING;value="GOLDEN_CARROT"}
    - setvariable{var=caster.placeholderAmount;type=STRING;value="1"}
HoneyBottleTrade:
    Cooldown: 99999
    Skills:
    - setvariable{var=caster.placeholderItem;type=STRING;value="ironcoin"}
    - setvariable{var=caster.placeholderAmount1;type=STRING;value="4to6"}
    - setvariable{var=caster.placeholderItem1;type=STRING;value="HONEY_BOTTLE"}
    - setvariable{var=caster.placeholderAmount;type=STRING;value="1"}
MelonSliceTrade:
    Cooldown: 99999
    Skills:
    - setvariable{var=caster.placeholderItem;type=STRING;value="ironcoin"}
    - setvariable{var=caster.placeholderAmount1;type=STRING;value="1to3"}
    - setvariable{var=caster.placeholderItem1;type=STRING;value="MELON_SLICE"}
    - setvariable{var=caster.placeholderAmount;type=STRING;value="1"}
RandomTradeSell:
    Skills:
    - randomskill{s=GoldenAppleTrade,GoldenCarrotTrade,HoneyBottleTrade,MelonSliceTrade}
VarInitializeTraderAIR:
    Skills:
        # Default value setup if trade mechanic fails.
    - setvariable{var=caster.placeholderItem;type=STRING;value="APPLE"}
    - setvariable{var=caster.placeholderAmount1;type=STRING;value="3to6"}
    - setvariable{var=caster.placeholderItem1;type=STRING;value="ironcoin"}
    - setvariable{var=caster.placeholderAmount;type=STRING;value="1"}
        # Assign placeholders with a random trade
    - skill{s=RandomTradeSell}
        # Default value setup if trade mechanic fails.
    - setvariable{var=caster.placeholderItem;type=STRING;value="APPLE"}
    - setvariable{var=caster.placeholderAmount1;type=STRING;value="3to6"}
    - setvariable{var=caster.placeholderItem1;type=STRING;value="ironcoin"}
    - setvariable{var=caster.placeholderAmount;type=STRING;value="1"}
        # Assign placeholders with a random trade
    - skill{s=RandomTradeSell}
        # Assign placeholders to the variables
    - setvariable{var=caster.amountPrice1;type=STRING;value=<caster.var.placeholderAmount>}
    - setvariable{var=caster.resultsItem1;type=STRING;value=<caster.var.placeholderItem>}
    - setvariable{var=caster.resultsAmount1;type=STRING;value=<caster.var.placeholderAmount1>}
    - setvariable{var=caster.priceItem1;type=STRING;value=<caster.var.placeholderItem1>}
    
    OneTimeTrade:
      Cooldown: 99999
      Skills:
      - trade{1=result:<caster.var.resultsItem1>:<caster.var.resultsAmount1>,price1:<caster.var.priceItem1>:<caster.var.amountPrice1>,uses:20}

2021-03-18_13 16 23

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant