Exemplo n.º 1
0
static T_void GuildUIJoinGame   (T_buttonID buttonID)
{
    T_word16 map ;
    T_gameGroupID groupID ;
	T_word16 quest;

    DebugRoutine ("GuildUIJoinGame");

    /* fake it */
//    GuildUIConfirmJoinGame();

    /* real it */
    GuildUIGetSelectedGame(&map, &groupID, &quest) ;

    if (map != 0)  {
        /* Request to join in the fun. */
        PeopleHereSetOurState(PLAYER_ID_STATE_JOINING_GAME) ;
        ClientSendRequestJoin(
            map,
            groupID) ;
		StatsSetCurrentQuestNumber(quest);
    } else {
        MessageAdd("No game session selected.") ;
    }

    DebugEnd();
}
Exemplo n.º 2
0
/**
 *  MessageDisplayMessage searches for a text file in the resource
 *  identified by MESSAGES/MSG##### where ##### is the message number
 *  to display.
 *
 *<!-----------------------------------------------------------------------*/
T_void MessageDisplayMessage (T_word16 messagenum)
{
    T_byte8 *desc1;
    T_byte8 *desc2;
    T_resource res;
    T_word32 size;
    T_byte8 stmp[32];
    DebugRoutine ("MessageDisplayMessage");

    sprintf (stmp,"MESSAGES/MSG%05d.TXT",messagenum);
    DebugCheck (PictureExist(stmp));

    if (PictureExist(stmp))
    {
        /* show description file */
        desc1=PictureLockData (stmp,&res);
        size=ResourceGetSize(res);
        desc2=(T_byte8 *)MemAlloc(size+2);
        memcpy (desc2,desc1,size);
        desc2[size-1]='\0';
        MessageAdd (desc2);
        MemFree (desc2);
        PictureUnlockAndUnfind(res) ;
    }

    DebugEnd();
}
Exemplo n.º 3
0
/**
 *  After requesting to join, this is the response handler.
 *
 *  @param unqiueAddress -- unique address of person requesting to join
 *  @param groupID -- ID of group being requested to join
 *  @param adventure -- Number of adventure being requested to join
 *  @param response -- Response to attempted join
 *
 *  @return Current 16-bit adventure id.
 *
 *<!-----------------------------------------------------------------------*/
T_void PeopleHereRespondToJoin(
        T_directTalkUniqueAddress uniqueAddress,
        T_gameGroupID groupID,
        T_word16 adventure,
        E_respondJoin response)
{
    T_directTalkUniqueAddress ourAddress;
    DebugRoutine("PeopleHereRespondToJoin");

    /* Make sure this refers to us. */
    DirectTalkGetUniqueAddress(&ourAddress);
    if (memcmp(&ourAddress, &uniqueAddress, sizeof(ourAddress)) == 0) {
        /* Yep, thats us. */
        switch (response) {
            case GAME_RESPOND_JOIN_OK:
                /* Tell others that I'm trying to join in the game. */
                PeopleHereSetOurState(PLAYER_ID_STATE_JOINING_GAME);
                PeopleHereSetOurAdventure(adventure);
                ClientSyncSetGameGroupID(groupID);

                /* we are in. */
                GuildUIConfirmJoinGame();

                /* Send out a message that this is what we are doing. */
                ClientSendPlayerIDSelf();

                PeopleHereGeneratePeopleInGame(groupID);
                break;
            case GAME_RESPOND_JOIN_FULL:
                PeopleHereSetOurState(PLAYER_ID_STATE_NONE);
                MessageAdd("Game is already full.");
                break;
            case GAME_RESPOND_JOIN_CANCELED:
                PeopleHereSetOurState(PLAYER_ID_STATE_NONE);
                MessageAdd("Game was cancelled.");
                break;
            default:
                DebugCheck(FALSE);
                break;
        }
    } else {
        /* Not us.  Just ignore. */
    }

    DebugEnd();
}
Exemplo n.º 4
0
int MessagePrintf( char *fmt, ... )
{
  va_list  argptr;			/* Argument list pointer	*/
  char str[140];			/* Buffer to build sting into	*/
  int cnt;				/* Result of SPRINTF for return */

  va_start( argptr, fmt );		/* Initialize va_ functions	*/

  cnt = vsprintf( str, fmt, argptr );	/* prints string to buffer	*/
  MessageAdd(str) ;

  va_end( argptr );			/* Close va_ functions		*/

  return( cnt );			/* Return the conversion count	*/

}
Exemplo n.º 5
0
int CHudMessage::MsgFunc_HudText( const char *pszName,  int iSize, void *pbuf )
{
	BEGIN_READ( pbuf, iSize );

	char *pString = READ_STRING();

	MessageAdd( pString, gHUD.m_flTime );
	// Remember the time -- to fix up level transitions
	m_parms.time = gHUD.m_flTime;

	// Turn on drawing
	if ( !(m_iFlags & HUD_ACTIVE) )
		m_iFlags |= HUD_ACTIVE;

	return 1;
}
Exemplo n.º 6
0
int CHudMessage::MsgFunc_HudText( const char *pszName,  int iSize, void *pbuf )
{
	string content;

	NetMsg_HudText( pbuf, iSize, content );
	MessageAdd( content.c_str(), gHUD.m_flTime );

	// Remember the time -- to fix up level transitions
	m_parms.time = gHUD.m_flTime;
	
	// Turn on drawing
	if ( !(m_iFlags & HUD_ACTIVE) )
		m_iFlags |= HUD_ACTIVE;
	
	return 1;
}
Exemplo n.º 7
0
int CHudMessage::MsgFunc_HudTextPro( const char *pszName, int iSize, void *pbuf )
{
	const char *sz;
	int hint;
	BEGIN_READ(pbuf, iSize);
	sz = READ_STRING();
	hint = READ_BYTE();

	MessageAdd(sz, gHUD.m_flTime/*, hint, Newfont*/); // TODO

	// Remember the time -- to fix up level transitions
	m_parms.time = gHUD.m_flTime;

	// Turn on drawing
	if ( !(m_iFlags & HUD_ACTIVE) )
		m_iFlags |= HUD_ACTIVE;
	return 1;
}
Exemplo n.º 8
0
/**
 *  ClientReceiveMessagePacket is called when someone sends a message
 *  about someone saying something.
 *
 *<!-----------------------------------------------------------------------*/
T_void ClientReceiveMessagePacket(T_packetEitherShortOrLong *p_packet)
{
    T_messagePacket *p_msg ;
    T_gameGroupID groupID ;

    DebugRoutine("ClientReceiveMessagePacket") ;

    if ((ClientIsAttemptingLogout() == FALSE) &&
        (ClientIsActive() == TRUE))  {
        /* Get a quick pointer. */
        p_msg = (T_messagePacket *)(p_packet->data) ;

        groupID = ClientSyncGetGameGroupID() ;
        if (CompareGameGroupIDs(p_msg->groupID, groupID))
        {
            MessageAdd(p_msg->message) ;
            SoundDing() ;
        }
    }

    DebugEnd() ;
}
Exemplo n.º 9
0
T_void InnUIStart(T_word32 formNum)
{
    T_word16 i;
    T_byte8 stmp[32];
    T_word16 hotkey[4];

    DebugRoutine("InnUIStart");

    /* load backdrop */
    G_backgroundPic = GraphicCreate(4, 3, "UI/INN/INNBACK");

    hotkey[0] = KeyDual(KEY_SCAN_CODE_C,KEY_SCAN_CODE_ALT);
    hotkey[1] = KeyDual(KEY_SCAN_CODE_S,KEY_SCAN_CODE_ALT);
    hotkey[2] = KeyDual(KEY_SCAN_CODE_L,KEY_SCAN_CODE_ALT);
    hotkey[3] = KeyDual(KEY_SCAN_CODE_U,KEY_SCAN_CODE_ALT);

    for (i = 0; i < 4; i++) {
        /* place rent buttons */
        sprintf(stmp, "UI/INN/ROOMBTN%d", i + 1);

        G_rentButtons[i] = ButtonCreate(45, 24 + (i * 28), stmp,
        FALSE, hotkey[i],
        NULL, InnUIRent);

        ButtonSetData(G_rentButtons[i], i);

        /* set up rent cost displays */
        G_rentCostDisplays[i] = TxtboxCreate(45, 37 + (i * 28), 110,
                46 + (i * 28), "FontMedium", 0, 0,
                TRUE, Txtbox_JUSTIFY_CENTER, Txtbox_MODE_VIEW_NOSCROLL_FORM,
                NULL);

        /* set up current funds display */
        G_financeDisplays[i] = TxtboxCreate(164, 32 + (i * 11), 204,
                41 + (i * 11), "FontMedium", 0, 0,
                TRUE, Txtbox_JUSTIFY_CENTER, Txtbox_MODE_VIEW_NOSCROLL_FORM,
                NULL);

        sprintf(stmp, "%d", StatsGetPlayerCoins(3-i));
        TxtboxSetData(G_financeDisplays[i], stmp);

    }

    /* set rent prices */
    TxtboxSetData(G_rentCostDisplays[0], "free!");
    TxtboxSetData(G_rentCostDisplays[1], "2 gold");
    TxtboxSetData(G_rentCostDisplays[2], "1 platinum");
    TxtboxSetData(G_rentCostDisplays[3], "2 platinum");

    GraphicUpdateAllGraphics();

    /* welcome user */
    MessageAdd("^007Welcome to the inn!");

    /* add journal help page if necessary */
    if (StatsPlayerHasNotePage(31) == FALSE && StatsPlayerHasNotePage(0) == TRUE) {
        StatsAddPlayerNotePage(31);
    }

    DebugEnd();
}
Exemplo n.º 10
0
/* button callback to rent a space at the inn */
static T_void InnUIRent(T_buttonID buttonID)
{
    T_word32 whichRoom;
    T_word16 newhealth;
    T_word16 newmana;

    DebugRoutine("InnUIRent");
    DebugCheck(buttonID != NULL);

    /* figure out which room we want to rent */
    whichRoom = ButtonGetData(buttonID);

    switch (whichRoom) {
        case INN_ROOM_COMMONS:
            MessageAdd("^004Good night!");
            switch (rand() % 3) {
                case 0:
                    PromptDisplayMessage("You enjoy an uncomfortable night on the floor.");
                    break;
                case 1:
                    PromptDisplayMessage("The only warmth here is from the next body over.");
                    break;
                case 2:
                    PromptDisplayMessage("I think I got fleas now.");
                    break;
            }
            /* Go back to character selection screen */
            StatsSaveCharacter(StatsGetActive());
            ClientSetNextPlace(0, 0);
            break;

        case INN_ROOM_SMALL:
            /* deduct 12 silver */
            if (StatsGetPlayerTotalCarriedWealth() >= 200) {
                StatsChangePlayerTotalCarriedWealth(-200);
                /* Give player 25% Health, 25% Mana, 50% food and Water */
                StatsChangePlayerFood(1000);
                StatsChangePlayerWater(1000);

                newhealth = StatsGetPlayerHealth();
                newhealth += StatsGetPlayerMaxHealth() / 4;
                if (newhealth > StatsGetPlayerMaxHealth())
                    newhealth = StatsGetPlayerMaxHealth();
                newmana = StatsGetPlayerMana();
                newmana += StatsGetPlayerMaxMana() / 4;
                if (newmana > StatsGetPlayerMaxMana())
                    newmana = StatsGetPlayerMaxMana();
                StatsSetPlayerHealth(newhealth);
                StatsSetPlayerMana(newmana);

                MessageAdd("^00425% Health/Mana + 50% Food/Water");
                switch (rand() % 3) {
                    case 0:
                        PromptDisplayMessage("A tight fit in a small room, but it'll do.");
                        break;
                    case 1:
                        PromptDisplayMessage("Don't let the bedbugs bite!");
                        break;
                    case 2:
                        PromptDisplayMessage("The only thing smaller than this room ... is the bed.");
                        break;
                }

                /* Go back to character selection screen */
                StatsSaveCharacter(StatsGetActive());
                ClientSetNextPlace(0, 0);
            } else {
                MessageAdd("^005Gotta have the money first, pal.");
            }
            break;

        case INN_ROOM_LARGE:
            /* deduct 2 gold */
            if (StatsGetPlayerTotalCarriedWealth() >= 1000) {
                StatsChangePlayerTotalCarriedWealth(-1000);
                /* Give player 33% health, 33% mana, 100% food and water */
                StatsChangePlayerFood(2000);
                StatsChangePlayerWater(2000);

                newhealth = StatsGetPlayerHealth();
                newhealth += StatsGetPlayerMaxHealth() / 3;
                if (newhealth > StatsGetPlayerMaxHealth())
                    newhealth = StatsGetPlayerMaxHealth();
                newmana = StatsGetPlayerMana();
                newmana += StatsGetPlayerMaxMana() / 3;
                if (newmana > StatsGetPlayerMaxMana())
                    newmana = StatsGetPlayerMaxMana();
                StatsSetPlayerHealth(newhealth);
                StatsSetPlayerMana(newmana);

                /* Halve Poison */
                StatsSetPlayerPoisonLevel(StatsGetPlayerPoisonLevel()/2);

                MessageAdd("^00433% H/M + 100% F/W - 50% Poison");
                switch (rand() % 3) {
                    case 0:
                        PromptDisplayMessage("Bigger is better!");
                        break;
                    case 1:
                        PromptDisplayMessage("Make my bed a double!");
                        break;
                    case 2:
                        PromptDisplayMessage("Nothing like enjoying some time off!");
                        break;
                }

                /* Go back to character selection screen */
                StatsSaveCharacter(StatsGetActive());
                ClientSetNextPlace(0, 0);
            } else {
                MessageAdd("^005You don't look like you can afford it.");
            }
            break;

        case INN_ROOM_SUITE:
            /* deduct 1 platinum */
            if (StatsGetPlayerTotalCarriedWealth() >= 2000) {
                StatsChangePlayerTotalCarriedWealth(-2000);

                /* Give player 100% health, 100% mana, 100% food, 100% water */
                StatsChangePlayerFood(2000);
                StatsChangePlayerWater(2000);

                newhealth = StatsGetPlayerMaxHealth();
                newmana = StatsGetPlayerMaxMana();
                StatsSetPlayerHealth(newhealth);
                StatsSetPlayerMana(newmana);

                /* Cure poison */
                StatsSetPlayerPoisonLevel(0);

                MessageAdd("^004100% H/M + 100% F/W - 100% Poision");
                switch (rand() % 3) {
                    case 0:
                        PromptDisplayMessage("Now this is living the life!");
                        break;
                    case 1:
                        PromptDisplayMessage("I always wanted to live rich.  Now I am.");
                        break;
                    case 2:
                        PromptDisplayMessage("Oh yeah!  I feel MUCH better now.");
                        break;
                }

                /* Go back to character selection screen */
                StatsSaveCharacter(StatsGetActive());
                ClientSetNextPlace(0, 0);
            } else {
                MessageAdd("^005What, are you kidding??");
            }
            break;

        default:
            /* fail! */
            DebugCheck(0);
    }

    DebugEnd();
}
Exemplo n.º 11
0
T_void BankUIStart  (T_word32 formNum)
{
    T_word16 i;
    T_byte8 stmp[64];
    E_statsAdventureNumber adv=ADVENTURE_NONE;
    DebugRoutine ("BankUIStart");

    /* load backdrop */
    G_backgroundPic=GraphicCreate (4,3,"UI/BANK/BANKBACK");

    for (i=0;i<4;i++)
    {
        /* load deposit/withdraw buttons */
        G_depositButtons[i]=ButtonCreate(119,
                                         32+(i*11),
                                         "UI/COMMON/LTARROW",
                                         FALSE,
                                         0,
                                         NULL,
                                         BankUIDeposit);

        ButtonSetData(G_depositButtons[i],3-i);

        G_withdrawButtons[i]=ButtonCreate(131,
                                         32+(i*11),
                                         "UI/COMMON/RTARROW",
                                         FALSE,
                                         0,
                                         NULL,
                                         BankUIWithdraw);

        ButtonSetData(G_withdrawButtons[i],3-i);

        /* create financial display fields */
        G_financeDisplays[i]=TxtboxCreate(57,
                                          31+(i*11),
                                          109,
                                          40+(i*11),
                                          "FontMedium",
                                          0,
                                          0,
                                          TRUE,
                                          Txtbox_JUSTIFY_CENTER,
                                          Txtbox_MODE_VIEW_NOSCROLL_FORM,
                                          NULL);

        sprintf (stmp,"%d",StatsGetPlayerSavedCoins(3-i));
        TxtboxSetData(G_financeDisplays[i],stmp);

        G_financeDisplays[i+4]=TxtboxCreate(148,
                                          31+(i*11),
                                          200,
                                          40+(i*11),
                                          "FontMedium",
                                          0,
                                          0,
                                          TRUE,
                                          Txtbox_JUSTIFY_CENTER,
                                          Txtbox_MODE_VIEW_NOSCROLL_FORM,
                                          NULL);

        sprintf (stmp,"%d",StatsGetPlayerCoins(3-i));
        TxtboxSetData(G_financeDisplays[i+4],stmp);

    }

    GraphicUpdateAllGraphics();

    /* set up bank inventory */
    StoreSetUpInventory(10,82,112,124,6,3);

    /* tell store what items we will buy */
    StoreAddBuyType(EQUIP_OBJECT_TYPE_RING);
    StoreAddBuyType(EQUIP_OBJECT_TYPE_AMULET);

    adv=StatsGetCompletedAdventure();

    switch (adv)
    {
        case ADVENTURE_7:
        /* Ring of Strength 2 */
        StoreAddItem (408,1);
        /* Ring of Speed 2 */
        StoreAddItem (430,1);
        /* Amulet of Quickness */
        StoreAddItem (611,1);
		/* Amulet of Hiding */
		StoreAddItem(609, 1);

        case ADVENTURE_6:
        /* Amulet of Speed */
        StoreAddItem (602,1);
        /* Amulet of Mana Regeneration */
        StoreAddItem (619,1);

        case ADVENTURE_5:
        /* Amulet of Accuracy */
        StoreAddItem (605,1);
        /* Ring of Stealth */
		StoreAddItem(438, 1);
		/* Ring of Armor 1 */
        StoreAddItem (415,1);
        /* Amulet of Spell Focus */
        StoreAddItem (600,1);

        case ADVENTURE_4:
		/* Ring of Regen 2 */
		StoreAddItem(406, 1);
		/* Ring of Speed 1 */
        StoreAddItem (429,1);
        /* Ring of Accuracy 2 */
        StoreAddItem (421,1);

        case ADVENTURE_3:
        /* Ring of Strength 1 */
        StoreAddItem (407,1);
        /* Ring of Map */
        StoreAddItem (435,1);

        case ADVENTURE_2:
        /* Ring of Accuracy 1 */
        StoreAddItem (420,1);

        case ADVENTURE_1:
		/* Amulet of Stealth */
		StoreAddItem(603, 1);
		/* Ring of Regen 1 */
		StoreAddItem(405, 1);

        case ADVENTURE_NONE:
        default:
        /* Ring of Food Conservation */
        StoreAddItem (426,1);
        /* Ring of Water Conservation */
        StoreAddItem (427,1);
        /* Ring of Water Walk */
        StoreAddItem (400,1);
        /* Ring of Traction */
        StoreAddItem (432,1);
        break;

        case ADVENTURE_UNKNOWN:
        DebugCheck(0);
        break;
    }


    /* Amulet of Falling */
///  StoreAddItem (614,1);
    /* Ring of Regen 2 */
//    StoreAddItem (406,1);
    /* Ring of Strength 3 */
//    StoreAddItem (409,1);
    /* Ring of Strength 4 */
//    StoreAddItem (410,1);
    /* Ring of Strength 5 */
//    StoreAddItem (411,1);
    /* Ring of Armor 2 */
//    StoreAddItem (416,1);
    /* Ring of Armor 3 */
//    StoreAddItem (417,1);
    /* Ring of Armor 4 */
//    StoreAddItem (418,1);
    /* Ring of Armor 5 */
//    StoreAddItem (419,1);
    /* Ring of Accuracy 3 */
//  StoreAddItem (422,1);
    /* Ring of Accuracy 4 */
//  StoreAddItem (423,1);
    /* Ring of Accuracy 5 */
//  StoreAddItem (424,1);
    /* Ring of Speed 4 */
//  StoreAddItem (428,1);
    /* Ring of Speed 3 */
//  StoreAddItem (431,1);
    /* Ring of Jumping */
//  StoreAddItem (434,1);
    /* Amulet of Regeneration */
//  StoreAddItem (601,1);
    /* Amulet of Strength */
//  StoreAddItem (604,1);
    /* Amulet of Poison Protection */
//  StoreAddItem (606,1);
    /* Amulet of Fire Protection */
//  StoreAddItem (607,1);
    /* Amulet of Lava Walk */
//  StoreAddItem (608,1);
    /* Amulet of Eternal Nourishment */
//  StoreAddItem (610,1);
    /* Amulet of Jumping */
//  StoreAddItem (612,1);
    /* Amulet of Flying */
//  StoreAddItem (613,1);
    /* Amulet of Super Armor */
//  StoreAddItem (615,1);
    /* Amulet of Acid Protection */
//  StoreAddItem (616,1);
    /* Amulet of Electricity Protection */
//  StoreAddItem (617,1);
    /* Amulet of Mana Drain Protection */
//  StoreAddItem (618,1);

    InventoryReorder(INVENTORY_STORE,TRUE);
    InventoryDrawInventoryWindow (INVENTORY_STORE);

    /* set up store control callback */
    StoreSetControlCallback (BankUIUpdateGraphics);

    /* welcome user */
    MessageAdd ("^007Welcome to the bank!");

    /* add journal help page if necessary */
    if (StatsPlayerHasNotePage(33)==FALSE &&
        StatsPlayerHasNotePage(0)==TRUE)
    {
        StatsAddPlayerNotePage(33);
    }
    else
    {
        /* force loading of inventory banner display */
        BannerOpenForm(BANNER_FORM_INVENTORY);
    }

    DebugEnd();
}
Exemplo n.º 12
0
T_void ClientReceiveGameStartPacket(
           T_packetEitherShortOrLong *p_packet)
{
    T_gameStartPacket *p_start ;
    T_word16 i ;
    T_directTalkUniqueAddress ourAddress ;
    T_gameGroupID groupID ;
	T_word16 levelStatus = LEVEL_STATUS_STARTED;

    DebugRoutine("ClientReceiveGameStartPacket") ;

//puts("ClientReceiveGameStartPacket") ;
    p_start = (T_gameStartPacket *)(p_packet->data) ;

    /* Set up the time offset. */
    MapSetDayOffset(p_start->timeOfDay) ;

    /* Only consider the packet if we are in the same group. */
//printf("-- %d %d\n", ClientSyncGetGameGroupID(), p_start->groupID) ;
    groupID = ClientSyncGetGameGroupID() ;
    if (CompareGameGroupIDs(groupID, p_start->groupID))  {
        DirectTalkGetUniqueAddress(&ourAddress) ;

        /* See if we are in the list. */
        for (i=0; i<p_start->numPlayers; i++)  {
            if (memcmp(&ourAddress, &p_start->players[i], sizeof(ourAddress)) == 0)
                break ;
        }
		//Level complete packet
		if (p_start->firstLevel == LEVEL_STATUS_LEVEL_CODE_COMPLETE ||
			p_start->firstLevel == LEVEL_STATUS_LEVEL_CODE_SUCCESS)
		{
			G_CompletedPlayers++;
			if (p_start->firstLevel == LEVEL_STATUS_LEVEL_CODE_SUCCESS)
				G_SuccessPlayers++;

			//if we got complete packets from everyone
			if (G_CompletedPlayers == p_start->numPlayers)
			{
				levelStatus = LEVEL_STATUS_COMPLETE;
				if (G_SuccessPlayers > 0)
					levelStatus |= LEVEL_STATUS_SUCCESS;

				TownUIFinishedQuest(levelStatus, p_start->numPlayers, StatsGetCurrentQuestNumber());

				//once all players respond, quit the game
				ClientSyncSetGameGroupID(*DirectTalkGetNullBlankUniqueAddress());
				PeopleHereSetOurAdventure(0);
				PeopleHereSetOurState(PLAYER_ID_STATE_NONE);
			}
		}
		/* Did we find a match? */
		else if (i != p_start->numPlayers)  
		{
			//Reset number of players completed
			G_CompletedPlayers = 0;
			G_SuccessPlayers = 0;

			//puts("Matched") ;
			/* Yes, we are on the list in the ith position. */
			/* Set up the game setup and go. */
			ClientSyncSetNumberPlayers(p_start->numPlayers);
			ClientSetLoginId(i);

			/* Set up the next jump */
			ClientSetNextPlace(p_start->firstLevel, 0);
			ClientSetAdventureNumber(p_start->adventure);
			ClientSyncInitPlayersHere();

			/* Clear all the messages */
			MessageClear();

			/* Copy all the player address over to the peophere module. */
			for (i = 0; i < p_start->numPlayers; i++)
			{
				PeopleHereSetUniqueAddr(i, (&p_start->players[i]));
			}
		}
		else 
		{
			//puts("Not Matched") ;
			/* Make sure we are still in the guild and if so drop us. */
			if ((PeopleHereGetOurLocation() == PLAYER_ID_LOCATION_GUILD) &&
				(PeopleHereGetOurState() == PLAYER_ID_STATE_JOINING_GAME))  {
				/* Cancel that game we were joining, it left without us. */
				GuildUICancelJoinGame(NULL);

				/* Nope, we got excluded. */
				MessageAdd("Game started without you.");
			}
		}
    }

    DebugEnd() ;
}
Exemplo n.º 13
0
/* loads 'store ui' */
T_void StoreUIStart  (T_word32 formNum)
{
    T_word16 i;
    E_statsAdventureNumber adv=ADVENTURE_NONE;
    const T_word16 firstArmor=12988;
    const T_word16 firstWeapon=12488;
    /* bronze, silver, steel, hsteel */
    const T_word16 materialOffsets[4]={0,8192,12288,16384};
    DebugRoutine ("StoreUIStart");

    /* load backdrop */
    G_backgroundPic=GraphicCreate (4,3,"UI/STORE/STORBACK");

    for (i=0;i<4;i++)
    {
        /* create financial display fields */
        G_financeDisplays[i]=TxtboxCreate(164,
                                          32+(i*11),
                                          204,
                                          41+(i*11),
                                          "FontMedium",
                                          0,
                                          0,
                                          TRUE,
                                          Txtbox_JUSTIFY_CENTER,
                                          Txtbox_MODE_VIEW_NOSCROLL_FORM,
                                          NULL);

    }

    StoreUIUpdateGraphics();
    GraphicUpdateAllGraphics();

    /* set up store inventory */
    StoreSetUpInventory(10,26,112,124,6,7);

    /* set up what items the store will buy */
    StoreAddBuyType (EQUIP_OBJECT_TYPE_WEAPON);
    StoreAddBuyType (EQUIP_OBJECT_TYPE_ARMOR);
    StoreAddBuyType (EQUIP_OBJECT_TYPE_POTION);
    StoreAddBuyType (EQUIP_OBJECT_TYPE_WAND);
    StoreAddBuyType (EQUIP_OBJECT_TYPE_SCROLL);
    StoreAddBuyType (EQUIP_OBJECT_TYPE_THING);
    StoreAddBuyType (EQUIP_OBJECT_TYPE_BOLT);
    StoreAddBuyType (EQUIP_OBJECT_TYPE_QUIVER);

    adv=StatsGetCompletedAdventure();

    switch (adv)
    {
        case ADVENTURE_7:
        /* Potion of Invisibility */
        StoreAddItem (815,1);
        /* Wand of Disintegrate */
        StoreAddItem (918,1);
        /* Mage rune 9 */
        StoreAddItem (308,1);
        /* Adiminium long sword */
        StoreAddItem (45260, 1);
        /* Adaminium dagger */
        StoreAddItem (45256, 1);
        /* Adaminium mace */
        StoreAddItem (45257, 1);

        case ADVENTURE_6:
        /* Axe of Power */
        StoreAddItem (232,1);
        /* Dagger of Piercing */
        StoreAddItem (215,1);
        /* Scroll of Health 3 */
        StoreAddItem (356,1);
        /* Scroll of Flying */
        StoreAddItem (360,1);
        /* Scroll of Invisibility */
        StoreAddItem (361,1);
        /* Potion of Healing 3 */
        StoreAddItem (802,1);
        /* Potion of Armor 5 */
        StoreAddItem (811,1);
        /* Wand of Homing Deathballs */
        StoreAddItem (905,1);
        /* Wand of Lightning Bolts */
        StoreAddItem (907,1);
        /* Mage rune 6, 8 */
        StoreAddItem (305, 1);
        StoreAddItem (307, 1);
        /* Obsidian dagger */
        StoreAddItem(37064, 1);
        /* Obsidian short sword */
        StoreAddItem(37067,1);

        case ADVENTURE_5:
        /* Long Sword of Striking */
        StoreAddItem (212,1);
        /* Potion of Flying */
        StoreAddItem (805,1);
        /* Potion of Armor 4 */
        StoreAddItem (810,1);
        /* Potion of Lava Walking */
        StoreAddItem (813,1);
        /* Potion of Translucency */
        StoreAddItem (816,1);
        /* Potion of Demon Strength */
        StoreAddItem (820,1);
        /* Wand of Homing Fireballs */
        StoreAddItem (904,1);
        /* Wand of Berserk */
        StoreAddItem (914,1);
        /* Quiver of piercing bolts */
        StoreAddItem (147,1);
        /* Mage rune 7 */
        StoreAddItem (306,1);
        /* Cleric rune 9 */
        StoreAddItem (317,1);
        /* Dagger of fire */
        StoreAddItem (214,1);
        /* Mithril staff */
        StoreAddItem(32970,1);
        /* Mithril short sword */
        StoreAddItem(32971,1);
        /* Mithril long sword */
        StoreAddItem(32972,1);
        /* Mithril heavy armor */
        StoreAddItem (33476,1);
        StoreAddItem (33477,1);
        StoreAddItem (33478,1);
        StoreAddItem (33479,1);


        case ADVENTURE_4:
        /* Dagger of Acid */
        StoreAddItem (230,1);
        /* Staff of Poison */
        StoreAddItem (219,1);
        /* Mace of Speed */
        StoreAddItem (224,1);
        /* Short Sword of Striking */
        StoreAddItem (211,1);
        /* Scroll of Health 2 */
        StoreAddItem (355,1);
        /* Potion of Regen 2 */
        StoreAddItem (804,1);
        /* Potion of Cure Poison 2 */
        StoreAddItem (807,1);
        /* Wand of Acid */
        StoreAddItem (902,1);
        /* Wand of Fireballs */
        StoreAddItem (903,1);
        /* Wand of Earthsmite */
        StoreAddItem (906,1);
        /* Wand of Slow */
        StoreAddItem (917,1);
        /* Quiver of electricity bolts */
        StoreAddItem (149,1);
        /* Hsteel long sword */
        StoreAddItem (28876, 1);
        /* Hsteel axe */
        StoreAddItem (28877, 1);
        /* Hsteel mace */
        StoreAddItem (28873, 1);
        /* Hsteel staff */
        StoreAddItem (28874, 1);
        /* Mithril light armor, hsteel heavy armor */
        StoreAddItem (33472, 1);
        StoreAddItem (33473, 1);
        StoreAddItem (33474, 1);
        StoreAddItem (33475, 1);
        StoreAddItem (29380, 1);
        StoreAddItem (29381, 1);
        StoreAddItem (29382, 1);
        StoreAddItem (29383, 1);

        case ADVENTURE_3:
        /* Axe of Accuracy */
        StoreAddItem (228,1);
        /* Staff of Speed */
        StoreAddItem (225,1);
        /* Scroll of identify all */
        StoreAddItem (351,1);
        /* Gain Strength Scroll */
        StoreAddItem (364,1);
        /* Gain Magic Scroll */
        StoreAddItem (367,1);
        /* Gain Speed Scroll */
        StoreAddItem (368,1);
        /* Potion of Holy Strength */
        StoreAddItem (819,1);
        /* Wand of Poison Missile */
        StoreAddItem (912,1);
        /* Quiver of poison bolts */
        StoreAddItem (146,1);
        /* Cleric runes 7, 8 */
        StoreAddItem (315, 1);
        StoreAddItem (316, 1);
        /* Steel mace */
        StoreAddItem(24777,1);
        /* Steel short sword */
        StoreAddItem(24779,1);
        /* Steel long sword */
        StoreAddItem(24780,1);
        /* Steel Axe */
        StoreAddItem(24781,1);
        /* Hsteel dagger */
        StoreAddItem(28872,1);
        /* steel heavy armor */
        StoreAddItem (25284, 1);
        StoreAddItem (25285, 1);
        StoreAddItem (25286, 1);
        StoreAddItem (25287, 1);
        /* Hsteel light armor */
        StoreAddItem (29376, 1);
        StoreAddItem (29377, 1);
        StoreAddItem (29378, 1);
        StoreAddItem (29379, 1);


        case ADVENTURE_2:
        /* Dagger of Speed */
        StoreAddItem (223,1);
        /* Scroll of Regeneration 1 */
        StoreAddItem (357,1);
        /* Gain Mana Scroll #2 */
        StoreAddItem (363,1);
        /* Gain Electric Attack Scroll */
        StoreAddItem (370,1);
        /* Potion of Armor 3 */
        StoreAddItem (809,1);
        /* Potion of Speed */
        StoreAddItem (814,1);
        /* Wand of Homing Darts */
        StoreAddItem (901,1);
        /* Quiver of acid bolts */
        StoreAddItem (148,1);
        /* mage runes 4, 5 */
        StoreAddItem (303,1);
        StoreAddItem (304,1);
        /* Cleric runes 4, 5, 6*/
        StoreAddItem (312,1);
        StoreAddItem (313,1);
        StoreAddItem (314,1);
        /* Silver long sword */
        StoreAddItem(20684, 1);
        /* Silver Axe */
        StoreAddItem(20685, 1);
        /* Steel dagger */
        StoreAddItem(24776, 1);
        /* Steel staff */
        StoreAddItem(24778, 1);
        /* Steel armor */
        StoreAddItem (25277, 1);
        StoreAddItem (25278, 1);
        StoreAddItem (25279, 1);
        StoreAddItem (25280, 1);
        StoreAddItem (25281, 1);
        StoreAddItem (25282, 1);
        StoreAddItem (25283, 1);


        case ADVENTURE_1:
        /* Dagger of Accuracy */
        StoreAddItem (227,1);
        /* Gain Accuracy Scroll */
        StoreAddItem (365,1);
        /* Gain Stealth Scroll */
        StoreAddItem (366,1);
        /* Gain Fire Attack Scroll */
        StoreAddItem (371,1);
        /* Potion of Healing 2 */
        StoreAddItem (801,1);
        /* Potion of Regen 1 */
        StoreAddItem (803,1);
        /* Potion of Cure Poison 1 */
        StoreAddItem (806,1);
        /* Potion of Feather Falling */
        StoreAddItem (817,1);
        /* Potion of Night Vision */
        StoreAddItem (823,1);
        /* Potion of Traction */
        StoreAddItem (824,1);
        /* Potion of Giant Strength */
        StoreAddItem (818,1);
        /* Wand of Darts */
        StoreAddItem (900,1);
        /* Wand of Confusion */
        StoreAddItem (913,1);
        /* Wand of Unlock Door */
        StoreAddItem (920,1);
        /* Quiver of fire bolts */
        StoreAddItem (145,1);
        /* mage runes 2 and 3 */
        StoreAddItem (301,1);
        StoreAddItem (302,1);
        /* Cleric rune 2 and 3 */
        StoreAddItem (310,1);
        StoreAddItem (311,1);
        /* Silver dagger */
        StoreAddItem(20680,1);
        /* Silver mace */
        StoreAddItem(20681,1);
        /* Silver short sword */
        StoreAddItem(20683,1);
        /* Silver studded leather */
        StoreAddItem (21181, 1);
        StoreAddItem (21182, 1);
        StoreAddItem (21183, 1);
        StoreAddItem (21184, 1);
        StoreAddItem (21185, 1);
        StoreAddItem (21186, 1);
        StoreAddItem (21187, 1);
        StoreAddItem (21188, 1);
        StoreAddItem (21189, 1);
        StoreAddItem (21190, 1);
        StoreAddItem (21191, 1);

        case ADVENTURE_NONE:
        default:
        /* apple */
        StoreAddItem (19,1);
        /* Berries */
        StoreAddItem (243,1);
        /* Carrot */
        StoreAddItem (244,1);
        /* Cherry */
        StoreAddItem (245,1);
        /* Water gourd */
        StoreAddItem (246,1);
        /* Chicken */
        StoreAddItem (247,1);
        /* Grape */
        StoreAddItem (248,1);
        /* Banana */
        StoreAddItem (249,1);
        /* Pineapple */
        StoreAddItem (251,1);
        /* crossbow */
        StoreAddItem (28,1);
        /* Iron Dagger */
        StoreAddItem (200,1);
        /* Iron Mace */
        StoreAddItem (201,1);
        /* Iron Staff */
        StoreAddItem (202,1);
        /* Iron Short Sword */
        StoreAddItem (203,1);
        /* Iron Long Sword */
        StoreAddItem (204,1);
        /* Iron Axe */
        StoreAddItem (205,1);
        /* Dagger of Striking */
        StoreAddItem (210,1);
        /* Scroll of identify readied */
        StoreAddItem (350,1);
        /* Scroll of Health 1 */
        StoreAddItem (354,1);
        /* Scroll of Armor */
        StoreAddItem (358,1);
        /* Gain Mana Scroll #1 */
        StoreAddItem (362,1);
        /* Potion of Healing 1 */
        StoreAddItem (800,1);
        /* Potion of Armor 1 */
        StoreAddItem (808,1);
        /* Potion of Water Walking */
        StoreAddItem (812,1);
        /* Potion of Food */
        StoreAddItem (821,1);
        /* Potion of Water */
        StoreAddItem (822,1);
        /* Wand of Earthbind */
        StoreAddItem (911,1);
        /* Wand of Pushing */
        StoreAddItem (915,1);
        /* Wand of Pulling */
        StoreAddItem (916,1);
        /* Leather Breast */
        StoreAddItem (701,1);
        /* Leather Arm */
        StoreAddItem (702,1);
        /* Leather Leg */
        StoreAddItem (703,1);
        /* Mail Helm */
        StoreAddItem (704,1);
        /* Mail Chest */
        StoreAddItem (705,1);
        /* Mail Arm */
        StoreAddItem (706,1);
        /* Mail Leg */
        StoreAddItem (707,1);
        /* Plate Helm */
        StoreAddItem (708,1);
        /* Plate Chest */
        StoreAddItem (709,1);
        /* Plate Arm */
        StoreAddItem (710,1);
        /* Plate Leg */
        StoreAddItem (711,1);
        /* Quiver of normal bolts */
        StoreAddItem (144,1);
        /* Thieving tools */
        StoreAddItem (143,1);
        /* Mage rune 1 */
        StoreAddItem (300,1);
        /* Cleric rune 1 */
        StoreAddItem (309,1);
        break;

        case ADVENTURE_UNKNOWN:
        DebugCheck(0);
        break;
    }

    /* loop weapons */
/*    for (i=1;i<(3>adv?adv:3);i++)
    {
        for (j=0;j<6;j++)
        {
            item=firstWeapon+materialOffsets[i]+j;
            StoreAddItem(item,1);
        }
    }
*/

// multiplayer?? */
    /* Wand of Lock Door */
//  StoreAddItem (919,1);
    /* Wand of Dispell Magic 2 */
//  StoreAddItem (910,1);
    /* Quiver of mana drain bolts */
//  StoreAddItem (150,1);
    /* Gain Mana Drain Attack Scroll */
//  StoreAddItem (372,1);
    /* Wand of Mana Drain */
//  StoreAddItem (908,1);



    /* Leather Cap */
//  StoreAddItem (700,1);
    /* Wand of Dispell Magic 1 */
//    StoreAddItem (909,1);
    /* Potion of Poison */
//    StoreAddItem (825,1);
    /* Potion of Fire */
//    StoreAddItem (826,1);
    /* Potion of Hurt */
//    StoreAddItem (827,1);
    /* Gain Experience Scroll */
//  StoreAddItem (214,1);
    /* Short Sword of Piercing */
//  StoreAddItem (216,1);
    /* Long Sword of Piercing */
//  StoreAddItem (217,1);
    /* Dagger of Poison */
//  StoreAddItem (220,1);
    /* Short Sword of Poison */
//  StoreAddItem (221,1);
    /* Long Sword of Speed */
//  StoreAddItem (226,1);
    /* Mace of Poison */
//  StoreAddItem (231,1);
    /* Staff of Power */
//  StoreAddItem (233,1);
    /* Mace of Electricity */
//  StoreAddItem (234,1);

    /* loop armors */
/*    for (i=1;i<(3>adv?adv:3);i++)
    {
        for (j=1;j<12;j++)
        {
            item=firstArmor+materialOffsets[i]+j;
            StoreAddItem(item,1);
        }
    } */
    /* secondary armor loop - hardened armor has no 'light' armor */
/*    if (adv >= 3)
    {
        for (j=4;j<12;j++)
        {
            item=firstArmor+materialOffsets[3]+j;
    //        printf ("adding armor item:%d\n",item);
    //        fflush (stdout);
            StoreAddItem (item,1);
    //        printf ("done\n");
    //        fflush (stdout);
        }
    }
*/
    InventoryReorder(INVENTORY_STORE,TRUE);
    InventoryDrawInventoryWindow (INVENTORY_STORE);

    /* set up store control callback */
    StoreSetControlCallback (StoreUIUpdateGraphics);

    /* welcome user */
    MessageAdd ("^007Welcome to the store!");

    /* add journal help page if necessary */
    if (StatsPlayerHasNotePage(32)==FALSE &&
        StatsPlayerHasNotePage(0)==TRUE)
    {
        StatsAddPlayerNotePage(32);
    }
    else
    {
        /* force loading of inventory banner display */
        BannerOpenForm(BANNER_FORM_INVENTORY);
    }

    DebugEnd();
}
Exemplo n.º 14
0
/* ConfirmSellItem is called when client recieves ok from server */
T_void StoreConfirmSellItem (T_void)
{
    T_word32 amount;
    T_byte8 stmp[64];
    T_byte8 stmp2[16];
    T_3dObject *p_obj;
    T_inventoryItemStruct *p_inv;

    DebugRoutine ("StoreConfirmSellItem");
    DebugCheck (G_itemToSell != NULL);

    /* move the item from the store inventory to the
       player inventory */
//    if (G_itemToSell->numitems > 1)
//    {
        if (G_itemToSell->itemdesc.type==EQUIP_OBJECT_TYPE_QUIVER)
        {
            /* don't make a new item */
            /* just add 12 arrows */
            Effect (EFFECT_TAKE_AMMO,
                    EFFECT_TRIGGER_GET,
                    G_itemToSell->itemdesc.subtype,
                    12,
                    0,
                    G_itemToSell->object);
        }
        else
        {
            p_obj=ObjectCreateFake();
            DebugCheck (p_obj != NULL);

            ObjectSetType (p_obj,ObjectGetType(G_itemToSell->object));
            ObjectSetAngle (p_obj,0x4000);

            p_inv=InventoryTakeObject (INVENTORY_PLAYER,p_obj);
            /* set 'quick pointer' for mouse hand */
            InventorySetMouseHandPointer (p_inv->elementID);
            InventoryDoEffect(EFFECT_TRIGGER_GET,EQUIP_LOCATION_MOUSE_HAND);
        }

        /* identify arrow type for player */
        StatsPlayerIdentify(ObjectGetType(G_itemToSell->object));

        /* force mouse hand picture update */
//      ControlSetObjectPointer (p_inv->object);
//        StatsChangePlayerLoad(ObjectGetWeight(G_itemToSell->object));
//      G_itemToSell->numitems--;
//    }
//    else
//    {
//        element=InventoryTransferItemBetweenInventories(
//                  G_itemToSell,
//                  INVENTORY_STORE,
//                  INVENTORY_PLAYER);

//        DebugCheck (element != DOUBLE_LINK_LIST_ELEMENT_BAD);
        /* set the mouse hand pointer */
//        InventorySetMouseHandPointer (element);
//    }

    if (G_houseMode==FALSE)
    {
        /* go ahead and sell the item to the player */
        /* subtract the cost of this item */
        if (EffectPlayerEffectIsActive(PLAYER_EFFECT_GOD_MODE)==FALSE)
        {
            amount=ObjectGetValue(G_itemToSell->object);
            StoreConvertCurrencyToString (stmp,amount);
            if (G_itemToSell->itemdesc.type==EQUIP_OBJECT_TYPE_QUIVER)
            {
                switch (G_itemToSell->itemdesc.subtype)
                {
                    case BOLT_TYPE_NORMAL:
                    strcpy (stmp2,"normal");
                    break;
                    case BOLT_TYPE_POISON:
                    strcpy (stmp2,"green");
                    break;
                    case BOLT_TYPE_PIERCING:
                    strcpy (stmp2,"brown");
                    break;
                    case BOLT_TYPE_FIRE:
                    strcpy (stmp2,"red");
                    break;
                    case BOLT_TYPE_ELECTRICITY:
                    strcpy (stmp2,"yellow");
                    break;
                    case BOLT_TYPE_MANA_DRAIN:
                    strcpy (stmp2,"purple");
                    break;
                    case BOLT_TYPE_ACID:
                    strcpy (stmp2,"white");
                    break;
                    default:
                    DebugCheck (0); /* bad bolt! */
                    break;
                }
                MessagePrintf ("^009You bought 12 %s arrows for %s",stmp2,stmp);
            }
            else MessagePrintf ("^009Sold!! for %s",stmp);
            StatsChangePlayerTotalCarriedWealth(-(T_sword32)amount);
        }
        else
        {
            MessageAdd ("^009Well... You're a god... it's free.");
        }
//        StoreUIUpdateGraphics();

    }

    /* resort the inventory */
    InventoryReorder (INVENTORY_STORE,TRUE);

    /* redraw the inventory window */
    InventoryDrawInventoryWindow(INVENTORY_STORE);

    G_itemToSell=NULL;

    DebugEnd();
}
Exemplo n.º 15
0
/* alternate inventory */
T_void StoreHandleTransaction (E_mouseEvent event,
                                       T_word16 x,
                                       T_word16 y,
                                       T_buttonClick buttons)
{
    T_inventoryItemStruct* itemInHand=NULL;
    T_inventoryItemStruct* itemInStore=NULL;
    T_doubleLinkListElement element=DOUBLE_LINK_LIST_ELEMENT_BAD;

    DebugRoutine ("StoreHandleTransaction");

    /* first, see if we've selected the alternate inventory */
    if (InventoryFindInventoryWindow(x,y)==INVENTORY_STORE)
    {
        /* ok, we clicked on it. */
        /* do we have something in the mouse hand currently? */
        itemInHand=InventoryCheckItemInMouseHand();
        if (itemInHand != NULL)
        {
            if (G_houseMode==FALSE)
            {
                /* we must be trying to sell this item */
                /* check to see if the store wants to buy it */
                if (StoreWillBuy(itemInHand->itemdesc.type) &&
                    StoreGetBuyValue(itemInHand)>0)
                {
                    /* notify the server that the store wants to buy an item */
                    /* from the player */
                    StoreRequestBuyItem(itemInHand);
                }
                else
                {
                    MessageAdd ("^005I don't want to buy that from you.");
                }
            }
            else
            {
                StoreRequestBuyItem(itemInHand);
            }
        }
        else
        {
            if (G_houseMode==FALSE)
            {
                /* we must be trying to buy something */
                /* is there an item in this location ? */
                itemInStore=InventoryCheckItemInInventoryArea(x,y);
                if (itemInStore != NULL)
                {
                    /* there's something here. Can we buy it? */
                    if (StatsGetPlayerTotalCarriedWealth()>=ObjectGetValue(itemInStore->object)
                        || EffectPlayerEffectIsActive(PLAYER_EFFECT_GOD_MODE))
                    {
                        /* notify the server that the store wants to sell */
                        /* an item to the player */
                        StoreRequestSellItem (itemInStore);
                    }
                    else
                    {
                        MessageAdd ("^005You can't afford that!");
                    }
                }
            }
            else
            {
                itemInStore=InventoryCheckItemInInventoryArea(x,y);
                if (itemInStore != NULL)
                {
                    StoreRequestSellItem(itemInStore);
                }
            }
        }
    }

    /* notify callback */
    if (G_controlCallback != NULL) G_controlCallback();

    DebugEnd();
}