Author Topic: What fixes are needed to start building a PW  (Read 662 times)

Legacy_FunkySwerve

  • Hero Member
  • *****
  • Posts: 2325
  • Karma: +0/-0
What fixes are needed to start building a PW
« Reply #15 on: October 08, 2013, 05:28:40 am »


               

meaglyn wrote...

FunkySwerve wrote...

The added checks are to prevent spamming of Exports. ForceDelayedSave is as follows, and does the same:


ForceSave presumably just does the ExportSingleCharacter?

Sorry, overlooked that. It has a few checks, like the polymorph issue Shad mentioned:

void ForceSave (object oPC, int bDelayed=FALSE) {
    if (!GetIsPC(oPC) || GetIsDM(oPC))
        return;

    if (bDelayed) {
        int nUptime = GetLocalInt(GetModule(), "uptime");
        int nDelayedSave = GetLocalInt(oPC, "DelayedSave");

        if (nDelayedSave == nUptime)
            SetLocalInt(oPC, "DelayedSave", nUptime + 1);
    }

    if (GetLocalInt(oPC, "DebugForceSave")) {
        int nUptime = GetLocalInt(GetModule(), "uptime");

        SendMessageToPC(oPC, "<cþþþ>FORCE SAVE " + IntToString(nUptime) + "</c>");
    }

    RemoveEffectsOfType(EFFECT_TYPE_POLYMORPH, oPC);
    ExportSingleCharacter(oPC);
}

[edit: added this one] Is that the item's area or the loser's area in the unacquire test?

Sorry, here are the declarations:

    object oItem = GetModuleItemLost();
    object oLoser = GetModuleItemLostBy();
    object oArea = GetArea(oItem);
    object oPCArea = GetArea(oLoser);
    string sResRef = GetResRef(oItem);
    int nItType = GetBaseItemType(oItem);
    object oPossessor = GetItemPossessor(oItem);

That can get a bit tricky, as there may be times when you don't want to autosave, like when they're riffling through their bank items, and it autosaves when they close the chest (another potential ex+pl*oit there). Here are the other two spots where FDS is used in our mod, within a few lines of each other in onacquire:


This other one you mention here is along the same lines. If you take stuff out of or put stuff in the vault
and then cause a crash you get duplicates? Or is this something different?

That one is somewhat idiosyncratic to our vault system. We only allow saving at particular junctures during vault use - all by the bank vault system itself, to close du+ping loopholes. It all boils down to the code you're using. Some of the stuff, we only found due to heavy traffic which exposed vulnerabilities. Others are just common-sense coding measures to block easy du*ping tricks.

Funky
               
               

               
            

Legacy_FunkySwerve

  • Hero Member
  • *****
  • Posts: 2325
  • Karma: +0/-0
What fixes are needed to start building a PW
« Reply #16 on: October 08, 2013, 05:34:53 am »


               

ShaDoOoW wrote...

though, Funky little concerned me about saving character, I assume a small efficiency change could be done since when you pick a bag of 50 items, it will run 51x OnAcquire afaik, and then 51x save character at same time... but it never made any lags in my PW and we dont have a persisten storage - players using mules

If you're not having issues I wouldn't sweat it. We just did it to trim overhead. You likely wouldn't notice lag on your module, since exports are - almost uniquely in nwn - asynchronous - the mod doesn't wait for them (I only know that thanks to letoscript). Saving that many times in such a short span is just really wasteful of cpu in general, but unless you're on a pretty old machine, it's unlikely to make much difference to perceived performance. Enough optimizations like that do add up in the end, however.

Funky
               
               

               
            

Legacy_meaglyn

  • Hero Member
  • *****
  • Posts: 1451
  • Karma: +0/-0
What fixes are needed to start building a PW
« Reply #17 on: October 08, 2013, 03:10:31 pm »


               Thanks Funky!

FunkySwerve wrote...


    object oArea = GetArea(oItem);


That's what I guessed. The others were unambiguous.

That one is somewhat idiosyncratic to our vault system. We only allow saving at particular junctures during vault use - all by the bank vault system itself, to close du+ping loopholes. It all boils down to the code you're using. Some of the stuff, we only found due to heavy traffic which exposed vulnerabilities. Others are just common-sense coding measures to block easy du*ping tricks.


Okay, thanks. I'll revisit that when I get to putting in a banking/vault system ...
               
               

               
            

Legacy_ffbj

  • Hero Member
  • *****
  • Posts: 1097
  • Karma: +0/-0
What fixes are needed to start building a PW
« Reply #18 on: October 19, 2013, 07:11:48 pm »


               First I would do it on paper carefully describing my pw with features from the general to the specific. Essentially an outline. for instance:

1.I want Mounts:
a) what types?
'B)' what current systems exist that could be used.

Then apply those questions to ever feature you want.  Next overview the pre-made systems for pw on the vault and see if any have features you need or want.
Don't get caught up in too much detail.  If you ever want to get anything done it is difficult if you get too bogged down in details.  Use everything you can that others have made, and perhaps get some help from others.   Good Luck!