TWF Framework API Documentation


The Western Frontier Developer API Documentation

What’s this?

This is a private documentation for RAMPAGE Interactive Studio Staff who program on the game can easily understand custom framework developed by vq9o for the hit game.

Globals

Most endpoints of WF (Western Framework) use Roblox Global _G. Allows you to interact with WF without requiring the module.

Understanding

Mentions of (REF X) refers to references below, this contains example tables, etc.

References

Inventory Item (REFID: 1)

OrginatedFrom = player.UserId, -- First original player to purchase from Auction, store, or whatever.
LastOwner = 1, -- Last owner id. So A Traded to B, A is the original. B traded it to C, B is the last owner of the given item.
Dropped = false, -- If it was dropped at any given point.
DropReferenceId = 420, -- Similar to trade ref id, but for drops.
Traded = false, -- If at any point in time it was traded.
TradeReferenceId = 69, -- Trade Reference Id to track trade history
LastUpdate = os.time(),
ItemId = Item ID,
ItemInHotbar = true, -- If its equipped or not.
HotbarPosition = 0, -- Hotbar position (Set to 0 if its hidden in your inventory, not on hotbar)
Stack = 1, -- For stackables like logs, etc
Serial = MySerial -- Item serial for tracking and collectors.

Item Data (REFID: 2)

Name = "Peacekeeper Revolver",
	Description = "Standard Issue revolver for new players",
	Type = "Firearm",
	ForSale = false,
	
	CanDiscard = true,
	DropOnDeath = true,
	CanDrop = false,
	Price = 0,
	ItemId = 2,
	Image = 8054580961,
	Rare = true,
	MaxStack = 12,
	Sell = 400,```

Endpoints

_G.GetDataFromItemId(ItemId)

Get player data from item id, returns nil if doesn’t exist.

_G.GetPlayerInventory(player)

Returns a table structure like this below

{{userdata}, {itemdata}, 1}

First row is the table containing info about the item such as serial (REFID 1), second table is item data fetched using _G.GetDataFromItemId(ItemId) (REFID 2), last one is the index of this data in _G.PlayerData[player.Name].Inventory.

_G.SaveToInventoryByIndex(Player, Data, Index)

_G.GetItemInHotbarPosition(player, slot)

Returns array of inventory item data (REFID 1), item data (REFID 2), and index.

_G.LoadInventory(player)

Refreshes players inventory info, loads items, etc.

_G.CreateModLog(Log)

_G.AwardItem(player, itemid)

Award item.

_G.Morph(player, location, itemtype)

_G.PrintTable(title, tbl)

_G.csvToTable(list)

_G.tableToString(list)

_G.tableToCsv(list)

_G.LogReference(player, from, itemid, refid, log, reason, iscreation)

Used to log references and created new refids for players dropping items, trading etc. This is for moderation rollbacks.

_G.GenerateNewSerial(itemid)

Generate a new serial

_G.RepeatUntilAvailableNumberForDatastore(itemid, datastore)

Repeat generating a new number until its available in the datastore. This is used in GenerateNewSerial.

_G.HookToGameplayEvents(Player, Event, Call)

Listen to gameplay event and call a function when caught. This primary usage is for quests to listen to kills, deaths, stats, etc.

_G.CreateConnection(Connection, array)

Store a RBX Connection to a table to be disconnected at a later date.

_G.CreateControllerForEvents(player, array)

Returns table of functions to control a Event for _G.HookToGameplayEvents()

Client Side

_G.Dragify(Frame)

Exploiter’s Message

WF is entirely server-sided and cannot be exploited. Client-side functions are there, however, don’t do much but provide small assistance.

In case players drop items from stolen accounts and pick them up then trade them, it’s lost. Therefore we will now migrate Drop Logging into Trade logs for easier rollbacks.