PDA

View Full Version : Neopets - Habi Application Flow



DarkByte
03-26-2013, 07:11 AM
AMFPHP

AMFPHP is a free open-source PHP implementation of the Action MessageFormat(AMF). AMF allows for binary serialization of Action Script (AS2, AS3) native types and objects to be sent to server side services. AMFPHP is challenged with implementing the entire AMF protocol to be an alternative to Flex Data Services (AMF3) and Flsh Remoting (AMF0). AMFPHP allows thin client applications built in languages such as Flash, Flex and AIR to communicate directly with PHP class objects on the server. For more information about AMFPHP please visit [Only registered and activated users can see links]

XML-RPC
It's remote procedure calling using HTTP as the transport and XML as the encoding. XML-RPC is designed to be as simple as possible, while allowing complex data structures to be transmitted, processed and returned.

Habitarium Service

AnalyticsService.php

This service provides reports of Player levels, Time to reach levels, Raids by date, Helps by date, Total sales and Sales from period.

Before we get the above reports, it checks for the login.

Then It loads analytics.controller.class.php file from controller folder and calls appropriate methods to get the report.

CMSService.php

This service does below actions

itemBag

Returns the items related to given Player ID.

sceneItems

Gives the SceneItems of given Player ID.

resetPlayer

This action resets the player from given Player ID.

numberOfCharacters

Returns all the scene items for given Asset type as Character and Player ID.

numberOfStructures

Returns all the scene items for given Asset type as Structure and Player ID.

playerRaidsInitiated

Results the Raids Initiated by given Player ID.

playerRaidsReceived

Results the Raids received by given Player ID.
EventService.php

This service does below actions

update

Used to get all new events for the game

simulate

Used to update the state to the current time and get information about what has changed
PestService.php

This service does below actions

updateSceneAfterPestAttack

Update the scene according to client data after pest attack.
PlayerService.php

This service does below actions

deactivate

Used to deactivate a currently registered user.

reset

Used to remove the current registered user.

playerInfo

Used to retrieve the current player's information.

setTutorialProgress

Store the tutorial progress of the player. Negative number means the tutorial is over

setInfoBubbles

Set the bit field used to store which info bubbles the user has seen
RaidService.php

This service does below actions

raidFriend

Raid a friend with selected soldiers. Result will be true or false

createVictim

Creates a user with the username $neoUsername and setsup his habitarium. If the user already exists he will be reset.
SceneService.php

This service does below actions.

setupHabitarium

Setup scene with habitarium type.

sceneItems

All items in player's scene.

moveItem

Move an item to a new location on the map.

makeTenant

Move character into structure

hatchEgg

Hatch an egg that is ready

discardEgg

Discard an egg. Egg must be fully grown to be discarded.

harvestEgg

Harvest an egg that is ready

applyStructureBooster

Apply a structure booster to a structure. Booster will be removed on success and structure object returned

applyInk

Apply an inkbottle to a structure or an inkdropper to a p3.

StoreService.php

This service does below actions.

storeItems

Get all Store Items for the active user

buyItem

Buy an item with assetId and add it to the player's item bag

TileService.php

This service does below action.

tilesForPlayer

All tiles in players scene

UpgradeService.php

This service is used to access upgrades. It does below actions.

playerUpgrades

Finds all upgrades the player has bought.

availableUpgrades

Finds all upgrades available to the player.

nextUpgradeFor

Find the next upgrade for a SceneItem.

buyUpgrade

Buy the upgrade and apply it to target.


How to troubleshoot the Habitarium Services

Below are the steps which using for troubleshoot the Services.


We have Service browser here: [Only registered and activated users can see links] this is useful to troubleshoot the application.
In browser it will show the configure popup which ask for Gateway.php path details.
Once you provide the path of gateway.php, It will get the services available inside amfphp/services folder.
When you select the service, it will display the methods having inside the service.
Then select the method and click the call button, which communicate with appropriate controller class, gives the response and displays in debug result window.

Edit , removed alot of techy data if you want to know the full techy details pm me , it was a bit bloated for new programmers though.

Reemer
03-26-2013, 10:02 AM
I was never able to get timeTravel or createVictim to do anything D:

Potatoes
03-26-2013, 10:50 AM
Beautiful! I might re-edit it again

Potatoes
03-31-2013, 06:59 PM
Self.itemcollection

DarkByte
04-02-2013, 04:33 AM
Self.itemcollection

That is not from the gateway as such , playerservice.update() returns a copy of every tile in the map , I just get that and stick it into self.itemcollection in my bots so I dont have to call playerservice.update() a bunch of times (just once per tick) whenever I want a copy of the players map which would slow the bot down :).

Potatoes
04-02-2013, 06:01 AM
As of now the main problem I'm facing is trying to understand amfphp. Seems like it's a class above me :(

The other coding are relatively easy to understand

DarkByte
04-02-2013, 06:31 AM
Im making a amfphp wrapper for vb.net right now if people prefer to use that. There is not one publicly even for legit coders so will release it on my personal site.

OpTic Specs
06-14-2015, 02:31 PM
THANK YOU