예제 #1
0
void LocalPlayer::pickedUp(const ItemInfo &itemInfo, int amount)
{
    if (!amount)
    {
        if (config.getValue("showpickupchat", 1))
        {
            localChatTab->chatLog(_("Unable to pick up item."), BY_SERVER);
        }
    }
    else
    {
        if (config.getValue("showpickupchat", 1))
        {
            // TRANSLATORS: This sentence may be translated differently
            // for different grammatical numbers (singular, plural, ...)
            localChatTab->chatLog(strprintf(ngettext("You picked up %d "
                    "[@@%d|%s@@].", "You picked up %d [@@%d|%s@@].", amount),
                    amount, itemInfo.getId(), itemInfo.getName().c_str()),
                    BY_SERVER);
        }

        if (mMap && config.getValue("showpickupparticle", 0))
        {
            // Show pickup notification
            addMessageToQueue(itemInfo.getName(), Palette::PICKUP_INFO);
        }
    }
}
예제 #2
0
파일: rest.c 프로젝트: theborax/rtl-ais
/* Queue functionality */
void addRawMessageToRestQueue(char *data, int length) {
	if(!Rest.uri) {
		return;
	}
	struct queue_message *curr = malloc(sizeof(struct queue_message));
	struct timeval tv;

	gettimeofday(&tv, NULL);
	unsigned long long millisecondsSinceEpoch =
	    (unsigned long long)(tv.tv_sec) * 1000 +
	    (unsigned long long)(tv.tv_usec) / 1000;

	data[length-2] = '\0';
	json_object *json = json_object_new_object();
	json_object *adsb_data = json_object_new_string(data);
	json_object *timestamp = json_object_new_int64(millisecondsSinceEpoch);

	json_object_object_add(json, "message",  adsb_data);
	json_object_object_add(json, "timestamp", timestamp);

	curr->message = json;

	addMessageToQueue(curr);
//	printf("Message added %s\n", data);
}
예제 #3
0
void LocalPlayer::setExp(int value)
{
    if (mMap && value > mExp)
    {
        addMessageToQueue(toString(value - mExp) + " xp");
    }
    mExp = value;

    if (statusWindow)
        statusWindow->update(StatusWindow::EXP);
}
예제 #4
0
void LocalPlayer::setExperience(int skill, int current, int next)
{
    std::pair<int, int> cur = getExperience(skill);
    int diff = current - cur.first;

    cur = std::pair<int, int>(current, next);

    mSkillExp[skill] = cur;
    std::string name;
    if (skillDialog)
        name = skillDialog->update(skill);

    if (mMap && cur.first != -1 && diff > 0 && !name.empty())
    {
        addMessageToQueue(strprintf("%d %s xp", diff, name.c_str()));
    }
}