{"id":31009354,"url":"https://github.com/robhurring/wars","last_synced_at":"2025-09-13T04:34:27.690Z","repository":{"id":66634395,"uuid":"592149","full_name":"robhurring/wars","owner":"robhurring","description":"Wars is a DopeWars clone built on top of Sinatra. It is customizable to support any type of themed dopwars game -- just edit the data file and restart!","archived":false,"fork":false,"pushed_at":"2012-08-28T13:56:38.000Z","size":770,"stargazers_count":19,"open_issues_count":0,"forks_count":2,"subscribers_count":2,"default_branch":"master","last_synced_at":"2024-04-13T19:19:39.529Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"http://officewarsgame.com","language":"Ruby","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/robhurring.png","metadata":{"files":{"readme":"README.rdoc","changelog":null,"contributing":null,"funding":null,"license":"license.txt","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2010-04-02T19:19:55.000Z","updated_at":"2023-10-28T02:17:37.000Z","dependencies_parsed_at":"2023-02-20T08:15:23.525Z","dependency_job_id":null,"html_url":"https://github.com/robhurring/wars","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/robhurring/wars","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/robhurring%2Fwars","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/robhurring%2Fwars/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/robhurring%2Fwars/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/robhurring%2Fwars/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/robhurring","download_url":"https://codeload.github.com/robhurring/wars/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/robhurring%2Fwars/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":274919745,"owners_count":25373953,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","status":"online","status_checked_at":"2025-09-13T02:00:10.085Z","response_time":70,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2025-09-13T04:34:26.706Z","updated_at":"2025-09-13T04:34:27.669Z","avatar_url":"https://github.com/robhurring.png","language":"Ruby","funding_links":[],"categories":[],"sub_categories":[],"readme":"==About Wars\n\nWars is a web based trading game with gameplay based on DopeWars. If you were a fan of the DopeWars games then give this a shot. It doesn't have fancy graphics or any of that jazz, but it is really fun to kill a few minutes during downtime. The main objective of Wars is to become to top trader of office supplies and crush your foes!\n\n==Installing/Running Wars\n\nInstall the gems listed in the +.gems+ file and run +rackup+.\n\n==OfficeWars Demo\n\nThere is a demo up and running on heroku: http://officewars.heroku.com\n\n==Configuring Wars\n\n*See: lib/wars/wars/data.rb* You can configure most of the game details through the data file. The game length, all NPCs, encounters, products, equipment, special events, locations and shops.\n\n===Products\n\nProducts are what the player can buy and sell at different locations to make cash.\nPrices fluctuate normally between the +price_range+. Special events also occur which might bump prices down or up. \nIf the price is bumped down, the +:min_message+ is shown in the event box, if it goes up the +:max_message+ is displayed.\n\n  # Add a product for speakers, selling between 1000-3000\n  Products \u003c\u003c Product.new(\n    :id =\u003e 999\n    :name =\u003e 'Speakers',\n    :price_range =\u003e (1000..3000),\n    :min_message =\u003e 'Speakers are really cheap!',\n    :max_message =\u003e 'Speakers are really expensive!'\n  )\n    \n===Equipment\n\nEquipment is what the player can purchase to help boost certain stats. \nAs long as the equipment is in the players control that attribute is boosted.\n\nEquipment can also be +:disposable+ which is generally used for healing. \nIf an item is disposable its immediately applied to the player, but not stored in their +equipment+ array.\n\nEquipment has the following attributes:\n  \nid:: the ID used to reference the equipment\nname:: name of the equipment\nlimit:: This is how many the player is allowed to have in their equipment array. \nprice:: how much the equipment costs\nadds:: [:space, :life, :strength, :defense]\namount:: this is a modifier of the +:adds+ column.\ndisposable:: if this is set to +true+ the equipment is immediately applied to the player and disposed of\n\nEquipment can adjust the following attributes, in the +:adds+ attribute:\n\nlife:: This adds to the player's max life as long as they hold the item.\nspace:: This adds space so the player can carry more items.\nstrength:: This makes the player hit harder in fights.\ndefense:: This helps the player absorb hits in fights.\n\n  # Add an awesome weapon\n  Equipments \u003c\u003c Equipment.new(\n    :id =\u003e 999, \n    :name =\u003e 'Awesome Weapon',\n    :limit =\u003e 1,\n    :price =\u003e 120_000,\n    :adds =\u003e :strength,\n    :amount =\u003e 100,\n    :disposable =\u003e false\n  )\n\n  # Adds a healing item\n  Equipments \u003c\u003c Equipment.new(\n    :id =\u003e 998, \n    :name =\u003e 'Healing Thing',\n    :limit =\u003e 999,  # limit should be set so they can buy enough to fully heal\n    :price =\u003e 10_000,\n    :adds =\u003e :life,\n    :amount =\u003e 10,\n    :disposable =\u003e true # apply life immediately and throw away the med pack\n  )\n\n===Locations\n  \nLocations are where players buy products and see available shops. \nTo customize the locations in the game, edit the +Locations+ array in the data file.\n\n  # Have a location appear at slot 8\n  Locations \u003c\u003c Location.new(:id =\u003e 8, :name =\u003e 'Some Location')\n\n===Stores\n  \nStores are where players can buy equipment to boost their strength, defense, space or life points. You can customize the\nstores in the *data* file. Each store must be linked to a +location_id+ to show up.\n\nThere are a few built-in store types you can use for game specific needs:\n\nbank:: This is where the player can store extra cash they have and earn +BankInterestRate+ interest.\nloans:: This is where the player can borrow or repay the bookie. The bookie's name is defined in +BookieName+. If the player doesn't pay the bookie back within +BookieTolerance+ days, the bookie will break their legs and end the game.\nbulletins:: This is a place the player can go to pay +BulletinCost+ cash to leave a small message on the bulletin board. Message length is defined in +BulletinLength.\n\nAll other stores have their inventory defined in arrays of +Equipment+ objects.\n\n  # Have a store appear at location 2, that sells equipments 1,2\n  Stores \u003c\u003c Store.new(\n    :location_id =\u003e 2, \n    :name =\u003e 'My Store', \n    :sells =\u003e [\n      Equipment.find(1), \n      Equipment.find(2)\n    ])\n\n  # Add the loan shark to location 1\n  Stores \u003c\u003c Store.new(\n    :location_id =\u003e 1, \n    :name =\u003e 'Loan Shark', \n    :sells =\u003e :loans\n  )\n\n===NPCs (Fights)\n\nAn NPC is who the player fights every +EncounterRange+ days if +Encounters+ is set to true.\nAn NPC is eligible to fight if their +:condition+ block returns true, and if a fight is won the\nnpc rewards the +:reward+ proc. The condition and reward block is called with the player object passed in\n\nAn NPC has the following attributes:\n\nid:: the ID to be stored in the fight object\nname:: name of the NPC\nstrength:: how hard the NPC will hit. (can be randomized with a Range)\ndefense:: how much damage the NPC absorbs from player hits (can be randomized with a Range)\nlife:: how much life the NPC has (can be randomized with a Range)\ncondition:: (block - called with player object) this is called on the player object, if true then the NPC enters the fight pool\nrewards:: (block - called with player object) this block determines the reward for the player if the fight is won. this should return an array\nwith the [object, quantity] where object is either a +Product+, +Equipment+ or special +:cash+ type. Quantity is the\namount of the product, equipment or cash to be rewarded.\n  \n  # Simple NPC that rewards cash\n  Npcs \u003c\u003c Npc.new(\n    :id =\u003e 1,\n    :name =\u003e 'Simple NPC',\n    :strength =\u003e 25,\n    :defense =\u003e 10,\n    :life =\u003e 100,\n    :condition =\u003e Proc.new{ true }, # always available\n    :rewards =\u003e Proc.new{ [:cash, 5_000] } # always give 5k cash\n  )\n  \n  # NPC with variable strength, defense and life that shows up when a player is level 10+ and rewards\n  # a random product\n  Npcs \u003c\u003c Npc.new(\n    :id =\u003e 2,\n    :name =\u003e 'Variable NPC',\n    :strength =\u003e (25..50),\n    :defense =\u003e (10..25),\n    :life =\u003e (100..150),\n    :condition =\u003e Proc.new{ |player| player.level \u003e= 10 },\n    :rewards =\u003e Proc.new{ [Product.all[rand(Product.size)], 1] } \n  )\n\n===Events\n\nAn event is something random that happens when moving between locations. This can be a reward, or a game-over event, etc.\n\nAn event has the following attributes:\n\ndescription:: description of the event\ncondition:: (block) what triggers this event\naction:: (block - called with player object) what this event does\n  \n  # Event that randomly awards cash\n  Event.new(\n   :description =\u003e \"You found some money on the ground!\",\n   :condition =\u003e Proc.new{ rand(30) == 0 }, # Every rand(30) days\n   :action =\u003e Proc.new{ |p| p.cash += (500..1000).rand } # reward 500-1000 cash\n  )\n\n  # Event that kills the player randomly, for fun. The +check_game_conditions+ check will notice that\n  # the player is no longer +alive?+ and end the game, using the +death_description+ for the score list\n  Event.new(\n   :description =\u003e \"You stepped on a land mine!\",\n   :condition =\u003e Proc.new{ |player| player.days \u003e 100 \u0026\u0026 player.level \u003e 50 \u0026\u0026 rand(100) },\n   :action =\u003e Proc.new{ |player|\n    player.life = 0\n    player.death_description = {\n      :reason =\u003e :event,\n      :message =\u003e \"Blown up by a land mine!\"\n    }\n   }\n  )","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frobhurring%2Fwars","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Frobhurring%2Fwars","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frobhurring%2Fwars/lists"}