Пример #1
0
void psServerStatusRunEvent::ReportClient(Client * curr, ClientStatusLogger & clientLogger, csString & reportString)
{
    if (curr->IsSuperClient() || !curr->GetActor()) 
        return;

    const psCharacter *chr = curr->GetCharacterData();
    // log this client's info with the clientLogger
    clientLogger.LogClientInfo(curr);

    psGuildInfo *guild = curr->GetActor()->GetGuild();
    csString guildTitle;
    csString guildName;
    if (guild && guild->id && !guild->IsSecret())
    {
        psGuildLevel *level = curr->GetActor()->GetGuildLevel();
        if (level)
        {
            guildTitle = EscpXML(level->title);
        }
        guildName = EscpXML(guild->name);
    }
    
    reportString.AppendFmt("<player name=\"%s\" characterID=\"%u\" guild=\"%s\" title=\"%s\" security=\"%d\" kills=\"%u\" deaths=\"%u\" suicides=\"%u\" pos_x=\"%.2f\" pos_y=\"%.2f\" pos_z=\"%.2f\" sector=\"%s\" />\n",
                           EscpXML(curr->GetName()).GetData(), chr->GetPID().Unbox(), guildName.GetDataSafe(), guildTitle.GetDataSafe(), curr->GetSecurityLevel(), chr->GetKills(), chr->GetDeaths(), chr->GetSuicides(), chr->location.loc.x, chr->location.loc.y, chr->location.loc.z, EscpXML(chr->location.loc_sector->name).GetData());
}
Пример #2
0
void pawsPetStatWindow::BuySkill()
{
    csString commandData;
    commandData.Format("<B NAME=\"%s\" />", EscpXML(selectedSkill).GetData());
    psPetSkillMessage outgoing( psPetSkillMessage::BUY_SKILL, commandData);
    outgoing.SendMessage();
}
Пример #3
0
csString GetNodeXML(csRef<iDocumentNode> node, bool childrenOnly)
{
    psString xml;
    csRef<iDocumentNodeIterator> nodes;
    csRef<iDocumentAttributeIterator> attrs;
    
    if (!childrenOnly)
        xml.Format("<%s", node->GetValue());
    
    attrs = node->GetAttributes();
    while (attrs->HasNext())
    {
        csRef<iDocumentAttribute> attr = attrs->Next();
    csString escpxml = EscpXML(attr->GetValue());
        xml.AppendFmt(" %s=\"%s\"", attr->GetName(), escpxml.GetData() );
    }
    if (!childrenOnly)
        xml += ">";
    

    nodes = node->GetNodes();
    if (nodes->HasNext())
    {
        while (nodes->HasNext())
        {
            csRef<iDocumentNode> child = nodes->Next();
            if (child->GetType() == CS_NODE_TEXT)
            {
                // add the node-content to the string..but escape special XML chars in it
                xml += EscpXML(child->GetContentsValue());
            }
            else
            {
                xml += GetNodeXML(child);
            }
        }
    }
    if (!childrenOnly)
    {
        // add the node-content to the string..but escape special XML chars in it
        xml += EscpXML(node->GetContentsValue());
        xml.AppendFmt("</%s>", node->GetValue());
    }
    return xml;
}
Пример #4
0
void psServerStatusRunEvent::ReportNPC(psCharacter* chardata, csString & reportString)
{
    csString escpxml_name = EscpXML(chardata->GetCharFullName());
    csString player;
               
    player.Format("<npc name=\"%s\" characterID=\"%u\" kills=\"%u\" deaths=\"%u\" suicides=\"%u\" pos_x=\"%.2f\" pos_y=\"%.2f\" pos_z=\"%.2f\" sector=\"%s\" />\n", 
                  escpxml_name.GetData(), chardata->GetPID().Unbox(),
                  chardata->GetKills(), chardata->GetDeaths(), chardata->GetSuicides(), chardata->location.loc.x, chardata->location.loc.y, chardata->location.loc.z, (const char*) EscpXML(chardata->location.loc_sector->name));
    
    reportString.Append( player ); 
}
Пример #5
0
void pawsPetStatWindow::OnListAction( pawsListBox* widget, int status )
{
    if (status==LISTBOX_HIGHLIGHTED)
    {
        pawsListBoxRow* row = widget->GetSelectedRow();

        pawsTextBox* skillName = (pawsTextBox*)(row->GetColumn(0));

        selectedSkill.Replace( skillName->GetText() );

        csString commandData;
        commandData.Format("<S NAME=\"%s\" />", EscpXML(selectedSkill).GetData());
        psPetSkillMessage msg(psPetSkillMessage::SKILL_SELECTED, commandData);
        msg.SendMessage();
    }
}
Пример #6
0
void pawsSkillWindow::BuyMaxSkill()
{
    csString commandData;
    if (selectedSkill.IsEmpty())
    {
        PawsManager::GetSingleton().CreateWarningBox("You have to select a skill to buy.");
        return;
    }

    csStringID skillId = psengine->FindCommonStringId(selectedSkill);
    if (skillId == csInvalidStringID)
    {
        PawsManager::GetSingleton().CreateWarningBox("You have to select a skill to buy.");
        return;
    }

    psSkillCacheItem* currSkill = skillCache.getItemBySkillId(skillId);
    if(!currSkill)
    {
        return;
    }
    unsigned short possibleTraining = currSkill->getKnowledgeCost() - currSkill->getKnowledge();

    if (skillCache.getProgressionPoints() < possibleTraining)
    {
        possibleTraining = skillCache.getProgressionPoints();
    }
        
    //check for 0 pp
    if(!possibleTraining)
    {
        if(!skillCache.getProgressionPoints())
        {
            PawsManager::GetSingleton().CreateWarningBox("You don't have PP to train.");
        }
        else
        {
            PawsManager::GetSingleton().CreateWarningBox("You can't train this skill anymore.");
        }
        return;
    }

    commandData.Format("<B NAME=\"%s\" AMOUNT=\"%d\"/>", EscpXML(selectedSkill).GetData(), possibleTraining);
    psGUISkillMessage msg(psGUISkillMessage::BUY_SKILL, commandData);
    msg.SendMessage();
}
Пример #7
0
void pawsSkillWindow::OnNumberEntered(const char* /*name*/, int /*param*/, int number)
{
    csString commandData;

    if(number == -1)
        return;

    if (selectedSkill.IsEmpty())
    {
        PawsManager::GetSingleton().CreateWarningBox("You have to select a skill to buy.");
        return;
    }

    commandData.Format("<B NAME=\"%s\" AMOUNT=\"%d\"/>", EscpXML(selectedSkill).GetData(), number);
    psGUISkillMessage outgoing(psGUISkillMessage::BUY_SKILL, commandData);
    outgoing.SendMessage();
}
Пример #8
0
void pawsSkillWindow::OnListAction( pawsListBox* widget, int status )
{
    if (status == LISTBOX_HIGHLIGHTED)
    {
        pawsListBoxRow* row = widget->GetSelectedRow();
        pawsTextBox* skillName = (pawsTextBox*)(row->GetColumn(0));

        selectedSkill.Replace( skillName->GetText() );

        // Try to find cached copy of the description string */
        csStringID skillNameId = (csStringID)psengine->FindCommonStringId(selectedSkill);

        psSkillDescription *desc = NULL;
        if (skillNameId != csInvalidStringID)
        {
            desc = skillDescriptions.Get(skillNameId, NULL);
        }

        if (!desc)
        {
            // Request from the server
            csString commandData;
            commandData.Format("<S NAME=\"%s\" />", EscpXML(selectedSkill).GetData());
            psGUISkillMessage outgoing( psGUISkillMessage::SKILL_SELECTED, commandData);
            outgoing.SendMessage();
        }
        else
        {
            // Use the cached version
            if (desc->GetCategory() == CAT_FACTION)
            {
                factionsDescription->SetText(desc->GetDescription());
            }
            else
            {
                skills[desc->GetCategory()].description->SetText(desc->GetDescription());
            }
        }
    }
}
void ActionHandler::Save( const char* id, const char* masterid, const char* name, const char* sector, 
                         const char* mesh, const char* poly, const char* posx, const char* posy, 
                         const char* posz, const char* pos_instance, const char* radius, const char* triggertype, 
                         const char* responsetype, const char* response, const char* active )
{
    csString xml;
    csString escpxml_response = EscpXML(response);

    xml.Append( "<location>" );
        xml.Append( "<id>" ); 
            xml.Append( id ); 
        xml.Append( "</id>" ); 
        xml.Append( "<masterid>" ); 
            xml.Append( masterid ); 
        xml.Append( "</masterid>" ); 
        xml.Append( "<name>" ); 
            xml.Append( name ); 
        xml.Append( "</name>" ); 
        xml.Append( "<sector>" ); 
            xml.Append( sector ); 
        xml.Append( "</sector>" ); 
        xml.Append( "<mesh>" ); 
            xml.Append( mesh ); 
        xml.Append( "</mesh>" ); 
        xml.Append( "<polygon>" ); 
            xml.Append( poly ); 
        xml.Append( "</polygon>" ); 
        xml.Append( "<position>" ); 
            xml.Append( "<x>" ); 
                xml.Append( posx );
            xml.Append( "</x>" ); 
            xml.Append( "<y>" ); 
                xml.Append( posy );
            xml.Append( "</y>" ); 
            xml.Append( "<z>" ); 
                xml.Append( posz );
            xml.Append( "</z>" ); 
        xml.Append( "</position>" ); 
        xml.Append( "<pos_instance>" ); 
            xml.Append( pos_instance ); 
        xml.Append( "</pos_instance>" ); 
        xml.Append( "<radius>" ); 
            xml.Append( radius ); 
        xml.Append( "</radius>" ); 
        xml.Append( "<triggertype>" ); 
            xml.Append( triggertype ); 
        xml.Append( "</triggertype>" ); 
        xml.Append( "<responsetype>" ); 
            xml.Append( responsetype ); 
        xml.Append( "</responsetype>" ); 
        xml.Append( "<response>" ); 
            xml.Append( escpxml_response ); 
        xml.Append( "</response>" ); 
        xml.Append( "<active>" ); 
            xml.Append( active ); 
        xml.Append( "</active>" ); 
    xml.Append( "</location>" );
    // Create Message

    psMapActionMessage query_msg( 0, psMapActionMessage::SAVE, xml.GetData() );

    // Send Message
    query_msg.SendMessage();
}